| | |
| | | package com.consum.base.controller; |
| | | |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.pojo.BaseWarehouseParam; |
| | | import com.consum.base.pojo.query.WarehouseQry; |
| | | import com.consum.base.service.BaseWarehouseServiceImpl; |
| | | import com.consum.base.service.LWhGoodsService; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.web.ResponseValue; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * @Description 仓库管理 |
| | |
| | | |
| | | @Autowired |
| | | private BaseWarehouseServiceImpl baseWarehouseService; |
| | | @Autowired |
| | | private LWhGoodsService lWhGoodsService; |
| | | |
| | | |
| | | /** |
| | | * @Description 新增 |
| | |
| | | * @Date 2023/10/26 |
| | | */ |
| | | @PostMapping("/add") |
| | | public ResponseValue add(@RequestBody BaseWarehouseParam param) { |
| | | public ResponseValue add() { |
| | | BaseWarehouseParam param = CommonUtil.getObjFromReqBody(BaseWarehouseParam.class); |
| | | BaseWarehouseParam param2 = new BaseWarehouseParam(); |
| | | CommonUtil.copyProperties(param, param2); |
| | | param = param2; |
| | | |
| | | if (StringUtils.isEmpty(param.getWarehouseName())) { |
| | | return ResponseValue.error("仓库名称为空"); |
| | | } |
| | |
| | | * @Date 2023/10/26 |
| | | */ |
| | | @GetMapping("/list") |
| | | public ResponseValue queryList(BaseWarehouseParam param) { |
| | | // FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | // if (sysInfo == null) { |
| | | // return ResponseValue.error("登录用户信息不存在"); |
| | | // } |
| | | public ResponseValue queryList() { |
| | | BaseWarehouseParam param = CommonUtil.getObjFromReq(BaseWarehouseParam.class); |
| | | BaseWarehouseParam param2 = new BaseWarehouseParam(); |
| | | CommonUtil.copyProperties(param, param2); |
| | | param = param2; |
| | | |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | if (sysInfo == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | param.setAgencyId(Long.valueOf(sysInfo.getTenantId())); |
| | | GenericPager<BaseWarehouse> pager = this.baseWarehouseService.queryList(param); |
| | | return ResponseValue.success(pager); |
| | | } |
| | |
| | | * @Date 2023/10/26 |
| | | */ |
| | | @PostMapping("/edit") |
| | | public ResponseValue edit(@RequestBody BaseWarehouse baseWarehouse) { |
| | | public ResponseValue edit() { |
| | | BaseWarehouse baseWarehouse = CommonUtil.getObjFromReqBody(BaseWarehouse.class); |
| | | BaseWarehouse param2 = new BaseWarehouse(); |
| | | CommonUtil.copyProperties(baseWarehouse, param2); |
| | | baseWarehouse = param2; |
| | | |
| | | Long id = baseWarehouse.getId(); |
| | | if (id == null || id <= 0) { |
| | | return ResponseValue.error("编辑的仓库不存在"); |
| | |
| | | * @Date 2023/10/26 |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public ResponseValue updateById(@RequestBody BaseWarehouse baseWarehouse) { |
| | | public ResponseValue updateById() { |
| | | BaseWarehouse baseWarehouse = CommonUtil.getObjFromReqBody(BaseWarehouse.class); |
| | | BaseWarehouse param2 = new BaseWarehouse(); |
| | | CommonUtil.copyProperties(baseWarehouse, param2); |
| | | baseWarehouse = param2; |
| | | |
| | | if (baseWarehouse.getId() == null) { |
| | | return ResponseValue.error("仓库id为空"); |
| | | } |
| | |
| | | */ |
| | | @GetMapping("/select/tenant_warehouse") |
| | | public ResponseValue getByAgencyId(Long agencyId) { |
| | | // TODO 暂无机构 |
| | | // if (agencyId == null) { |
| | | // return ResponseValue.error("机构id为空"); |
| | | // } |
| | | List<BaseWarehouse> list = this.baseWarehouseService.getByAgencyId(agencyId,null,null); |
| | | if (agencyId == null) { |
| | | return ResponseValue.success(new ArrayList<>()); |
| | | } |
| | | List<BaseWarehouse> list = this.baseWarehouseService.getByAgencyId(agencyId, null, null); |
| | | if (list == null) { |
| | | return ResponseValue.error("查询失败!"); |
| | | } |
| | | return ResponseValue.success("查询成功!", list); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据仓库id和型号id 查询库存", notes = "根据仓库id和型号id 查询库存") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "warehouseQry", value = "仓库id和型号id", required = true, dataType = "WarehouseQry", paramType = "query") |
| | | }) |
| | | @GetMapping("/select/number") |
| | | public ResponseValue selectNumber() { |
| | | WarehouseQry warehouseQry = CommonUtil.getObjFromReq(WarehouseQry.class); |
| | | WarehouseQry param2 = new WarehouseQry(); |
| | | CommonUtil.copyProperties(warehouseQry, param2); |
| | | warehouseQry = param2; |
| | | |
| | | Long warehouseId = warehouseQry.getWarehouseId(); |
| | | if (warehouseId == null) { |
| | | Long agencyId = warehouseQry.getAgencyId(); |
| | | BaseWarehouse defaultWarehouseByAgencyId = this.baseWarehouseService.getDefaultWarehouseByAgencyId(agencyId); |
| | | warehouseId = defaultWarehouseByAgencyId.getId(); |
| | | } |
| | | Long baseGoodsModelsId = warehouseQry.getBaseGoodsModelsId(); |
| | | Integer warehouseType = warehouseQry.getWarehouseType(); |
| | | Integer states = warehouseQry.getStates(); |
| | | Integer buyType = warehouseQry.getBuyType(); |
| | | |
| | | int num = this.lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseId, baseGoodsModelsId, 1, buyType); |
| | | return ResponseValue.success(num); |
| | | } |
| | | |
| | | |
| | | } |
| | | |