| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.apache.commons.compress.utils.Lists; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | import com.consum.base.BaseController; |
| | | import com.consum.base.core.WhBusinessEnum; |
| | | import com.consum.base.core.type.StatesType; |
| | | import com.consum.base.core.type.TransferStatesType; |
| | | import com.consum.base.core.utils.CommonUtil; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.pojo.GoodsUseRecordVO; |
| | |
| | | import com.consum.base.service.LWhProcureModelService; |
| | | import com.consum.base.service.LWhProcureModelUserRecordService; |
| | | import com.consum.base.service.LWhProcureModelUserService; |
| | | import com.consum.base.service.impl.LWhFormTransferCoreService; |
| | | import com.consum.base.service.core.LWhFormTransferCoreService; |
| | | import com.consum.model.po.BaseWarehouse; |
| | | import com.consum.model.po.FinSysTenantUser; |
| | | import com.consum.model.po.LWhFormTransfer; |
| | | import com.consum.model.po.LWhProcureModel; |
| | |
| | | @Autowired |
| | | private LWhProcureModelUserRecordService lWhProcureModelUserRecordService; |
| | | @Autowired |
| | | private BaseWarehouseService baseWarehouseService; |
| | | @Autowired |
| | | private LGoodsUserRecordCoreService lGoodsUserRecordCoreService; |
| | | @Autowired |
| | | private LWhGoodsService lWhGoodsService; |
| | | @Autowired |
| | | private BaseWarehouseService baseWarehouseService; |
| | | |
| | | /** |
| | | * @Description 新增 |
| | |
| | | if (transferBusinessType == 1) { |
| | | // 先出库,再入库 |
| | | // 出库前 设置出库仓库 |
| | | List<LWhProcureModel> modelByForm = lWhProcureModelService.getModelByForm(WhBusinessEnum.DIAOBO, id); |
| | | List<LWhProcureModel> modelByForm = lWhProcureModelService.getModelByForm(WhBusinessEnum.BUMENFENFA, id); |
| | | Set<Long> baseModelIds = |
| | | modelByForm.stream().map(LWhProcureModel::getBaseGoodsModelsId).collect(Collectors.toSet()); |
| | | |
| | | // TODO 不同库处理 |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | String agencyId = sysTenantUser.getTenantId(); |
| | | List<BaseWarehouse> baseWarehouseList = |
| | | baseWarehouseService.getBaseWareHouseList(Long.valueOf(agencyId), StatesType.NORMAL.getValue()); |
| | | Set<Long> wareHouseIds = baseWarehouseList.stream().map(BaseWarehouse::getId).collect(Collectors.toSet()); |
| | | // 通过调拨单中的型号id查询出该型号物品所在的仓库位置 |
| | | List<GoodsInfoDTO> goodsInfoDTOS = lWhGoodsService.queryGoodsInfo(baseModelIds); |
| | | List<GoodsInfoDTO> goodsInfoDTOS = lWhGoodsService.queryGoodsInfo(baseModelIds, wareHouseIds); |
| | | GoodsInfoDTO goodsInfoDTO = goodsInfoDTOS.stream().findFirst().orElse(null); |
| | | |
| | | // FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | // String agencyId = sysTenantUser.getTenantId(); |
| | | // List<BaseWarehouse> baseWarehouseList = |
| | | // baseWarehouseService.getBaseWareHouseList(Long.valueOf(agencyId), (short)1, (short)1); |
| | | // if (CollectionUtils.isEmpty(baseWarehouseList)) { |
| | | // return ResponseValue.error("机构无默认仓库!"); |
| | | // } |
| | | // BaseWarehouse baseWarehouse = baseWarehouseList.get(0); |
| | | if (ObjectUtils.isEmpty(goodsInfoDTO)) { |
| | | return ResponseValue.error("该型号没有库存可使用"); |
| | | } |
| | | |
| | | Long wareHouseId = goodsInfoDTO.getWarehouseId(); |
| | | String warehouseName = goodsInfoDTO.getWarehouseName(); |
| | |
| | | if (sysInfo == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | String tenantId = sysInfo.getTenantId(); |
| | | if (param.getInAgencyId() == null) { |
| | | param.setInAgencyId(Long.valueOf(tenantId)); |
| | | } |
| | | GenericPager<Map<String, Object>> mapGenericPager = lWhFormTransferService.queryFormTransferDetailList(param); |
| | | |
| | | return ResponseValue.success(mapGenericPager); |
| | |
| | | public ResponseValue updateStatus(Long id) { |
| | | if (id == null) { |
| | | return ResponseValue.error("参数错误"); |
| | | } |
| | | LWhFormTransfer lWhFormTransfer = lWhFormTransferService.selectById(id); |
| | | if (lWhFormTransfer.getStates() != TransferStatesType.OUT_PENDING.getValue()) { |
| | | return ResponseValue.error("状态错误,不能撤销"); |
| | | } |
| | | |
| | | int num = this.lWhFormTransferService.updateStatus(id); |
| | |
| | | Set<Long> baseModelIds = |
| | | modelByForm.stream().map(LWhProcureModel::getBaseGoodsModelsId).collect(Collectors.toSet()); |
| | | |
| | | // TODO 不同库处理 |
| | | // 通过调拨单中的型号id查询出该型号物品所在的仓库位置 |
| | | List<GoodsInfoDTO> goodsInfoDTOS = lWhGoodsService.queryGoodsInfo(baseModelIds); |
| | | GoodsInfoDTO goodsInfoDTO = goodsInfoDTOS.stream().findFirst().orElse(null); |
| | | // 出库前 设置出库仓库 |
| | | // FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | // String agencyId = sysTenantUser.getTenantId(); |
| | | // List<BaseWarehouse> baseWarehouseList = |
| | | // baseWarehouseService.getBaseWareHouseList(Long.valueOf(agencyId), (short)1, (short)1); |
| | | // if (CollectionUtils.isEmpty(baseWarehouseList)) { |
| | | // return ResponseValue.error("机构无默认仓库!"); |
| | | // } |
| | | FinSysTenantUser sysTenantUser = this.getSysInfo(); |
| | | String agencyId = sysTenantUser.getTenantId(); |
| | | List<BaseWarehouse> baseWarehouseList = |
| | | baseWarehouseService.getBaseWareHouseList(Long.valueOf(agencyId), StatesType.NORMAL.getValue()); |
| | | Set<Long> wareHouseIds = baseWarehouseList.stream().map(BaseWarehouse::getId).collect(Collectors.toSet()); |
| | | |
| | | // 通过调拨单中的型号id查询出该型号物品所在的仓库位置 |
| | | List<GoodsInfoDTO> goodsInfoDTOS = lWhGoodsService.queryGoodsInfo(baseModelIds, wareHouseIds); |
| | | GoodsInfoDTO goodsInfoDTO = goodsInfoDTOS.stream().findFirst().orElse(null); |
| | | if (ObjectUtils.isEmpty(goodsInfoDTO)) { |
| | | return ResponseValue.error("该型号没有库存可使用"); |
| | | } |
| | | Long wareHouseId = goodsInfoDTO.getWarehouseId(); |
| | | String warehouseName = goodsInfoDTO.getWarehouseName(); |
| | | LWhFormTransfer lWhFormTransfer = new LWhFormTransfer(id); |
| | |
| | | |
| | | goodsUseRecordVO.setRecordSkuDtoList(useRecordSkuList); |
| | | return goodsUseRecordVO; |
| | | |
| | | }).sorted(Comparator.comparing(GoodsUseRecordVO::getUpdateTime, Comparator.nullsFirst(Long::compareTo)) |
| | | .reversed()) |
| | | .collect(Collectors.toList()); |