diff --git a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/large_material_box/controller/PdaLargeMaterialBoxController.java b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/large_material_box/controller/PdaLargeMaterialBoxController.java index 77a57c5..651995f 100644 --- a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/large_material_box/controller/PdaLargeMaterialBoxController.java +++ b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/large_material_box/controller/PdaLargeMaterialBoxController.java @@ -42,6 +42,13 @@ public class PdaLargeMaterialBoxController { return new ResponseEntity<>(pdaLargeMaterialBoxService.unBindEmptyVehicle(reqParam), HttpStatus.OK); } + @PostMapping("/getType") + @Log("大料箱-料箱入库-获取入库类型") + @SaIgnore + public ResponseEntity getType(@RequestBody JSONObject reqParam) { + return new ResponseEntity<>(pdaLargeMaterialBoxService.getType(reqParam), HttpStatus.OK); + } + @PostMapping("/materialBoxInConfirm") @Log("大料箱-料箱入库-确认入库") @SaIgnore diff --git a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/large_material_box/service/PdaLargeMaterialBoxService.java b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/large_material_box/service/PdaLargeMaterialBoxService.java index ee98a27..a9f741d 100644 --- a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/large_material_box/service/PdaLargeMaterialBoxService.java +++ b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/large_material_box/service/PdaLargeMaterialBoxService.java @@ -121,4 +121,11 @@ public interface PdaLargeMaterialBoxService { * @return */ PdaResponse getInvInfoQty(JSONObject reqParam); + + /** + * 获取入库类型 + * @param reqParam + * @return + */ + PdaResponse getType(JSONObject reqParam); } \ No newline at end of file diff --git a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/large_material_box/service/impl/PadLargeMaterialBoxServiceImpl.java b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/large_material_box/service/impl/PadLargeMaterialBoxServiceImpl.java index c61ce2b..d628935 100644 --- a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/large_material_box/service/impl/PadLargeMaterialBoxServiceImpl.java +++ b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/large_material_box/service/impl/PadLargeMaterialBoxServiceImpl.java @@ -16,6 +16,7 @@ import org.nl.common.utils.SecurityUtils; import org.nl.wms.basedata_manage.service.*; import org.nl.wms.basedata_manage.service.dao.*; import org.nl.wms.pda.large_material_box.service.PdaLargeMaterialBoxService; +import org.nl.wms.pda.util.PDAEnum; import org.nl.wms.pda.util.PdaResponse; import org.nl.wms.pdm_manage.enums.BomEnum; import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialDtlService; @@ -36,10 +37,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -99,21 +97,37 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic Assert.notEmpty(storagevehicle_code, "载具编码不能为空!"); Structattr structattr = structattrService.getOne(new LambdaQueryWrapper() .eq(Structattr::getStruct_code, struct_code) - .eq(Structattr::getIs_delete, "0") - .eq(Structattr::getIs_used, "1")); + .eq(Structattr::getIs_delete, IOSConstant.ZERO) + .eq(Structattr::getIs_used, IOSConstant.ONE)); if (ObjectUtil.isEmpty(structattr)) { throw new BadRequestException("仓位信息不存在或未启用!"); } + // 判断是否是大料箱库区 + if (!structattr.getSect_code().equals(IOSEnum.SECT_CODE.code("大料箱区"))) { + throw new BadRequestException("当前仓位不属于大料箱库区【" + structattr.getStruct_code() + "】"); + } + // 判断是否有货 + if (ObjectUtil.isNotEmpty(structattr.getStoragevehicle_code())) { + throw new BadRequestException("当前仓位有载具存在【" + structattr.getStoragevehicle_code() + "】"); + } + if (!structattr.getLock_type().equals(IOSEnum.LOCK_TYPE.code("未锁定"))) { + throw new BadRequestException("当前仓位被锁定,无法绑定!"); + } + MdPbStoragevehicleinfo storagevehicleinfo = mdPbStoragevehicleinfoService.getOne(new LambdaQueryWrapper() .eq(MdPbStoragevehicleinfo::getStoragevehicle_code, storagevehicle_code) - .eq(MdPbStoragevehicleinfo::getIs_delete, "0") - .eq(MdPbStoragevehicleinfo::getIs_used, "1")); + .eq(MdPbStoragevehicleinfo::getIs_delete, IOSConstant.ZERO) + .eq(MdPbStoragevehicleinfo::getIs_used, IOSConstant.ONE)); if (ObjectUtil.isEmpty(storagevehicleinfo)) { throw new BadRequestException("载具信息不存在或未启用!"); } + // 判断当前载具是否是大料箱载具 + if (!storagevehicleinfo.getStoragevehicle_type().equals(IOSEnum.VEHICLE_TYPE.code("大料箱"))) { + throw new BadRequestException("当前载具不属于大料箱载具【" + storagevehicleinfo.getStoragevehicle_code() + "】"); + } + structattr.setStoragevehicle_code(storagevehicle_code); - structattr.setStoragevehicle_type(storagevehicleinfo.getStoragevehicle_type()); - structattr.setIs_emptyvehicle("1"); + structattr.setIs_emptyvehicle(IOSConstant.ONE); structattr.setUpdate_optid(SecurityUtils.getCurrentUserId()); structattr.setUpdate_optname(SecurityUtils.getCurrentNickName()); structattr.setUpdate_time(DateUtil.now()); @@ -132,16 +146,21 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic .eq(Structattr::getStruct_code, struct_code) .or() .eq(Structattr::getStoragevehicle_code, storagevehicle_code) - .eq(Structattr::getIs_delete, "0") - .eq(Structattr::getIs_used, "1")); + .eq(Structattr::getIs_delete, IOSConstant.ONE) + .eq(Structattr::getIs_used, IOSConstant.ZERO)); + if (ObjectUtil.isEmpty(structattr)) { throw new BadRequestException("仓位信息不存在或未启用!"); } - if (!StrUtil.equals(structattr.getIs_emptyvehicle(), "0")) { - throw new BadRequestException("当前点位或载具不是空载具,无法解绑!"); + if (!StrUtil.equals(structattr.getIs_emptyvehicle(), IOSConstant.ONE)) { + throw new BadRequestException("当前仓位或载具不是空载具,无法解绑!"); } + if (!structattr.getLock_type().equals(IOSEnum.LOCK_TYPE.code("未锁定"))) { + throw new BadRequestException("当前仓位被锁定,无法解绑!"); + } + structattr.setStoragevehicle_code(""); - structattr.setIs_emptyvehicle("0"); + structattr.setIs_emptyvehicle(IOSConstant.ZERO); structattr.setUpdate_optid(SecurityUtils.getCurrentUserId()); structattr.setUpdate_optname(SecurityUtils.getCurrentNickName()); structattr.setUpdate_time(DateUtil.now()); @@ -161,7 +180,20 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic Structattr structattr = structattrService.getOne(new LambdaQueryWrapper() .eq(Structattr::getStruct_code, struct_code)); Assert.notNull(structattr, "仓位信息不存在!"); - JSONArray tableData = reqParam.getJSONArray("tableData"); + + // 判断是否是大料箱库区 + if (!structattr.getSect_code().equals(IOSEnum.SECT_CODE.code("大料箱区"))) { + throw new BadRequestException("当前仓位不属于大料箱库区【" + structattr.getStruct_code() + "】"); + } + // 判断是否有货 + if (ObjectUtil.isNotEmpty(structattr.getStoragevehicle_code())) { + throw new BadRequestException("当前仓位有载具存在【" + structattr.getStoragevehicle_code() + "】"); + } + if (!structattr.getLock_type().equals(IOSEnum.LOCK_TYPE.code("未锁定"))) { + throw new BadRequestException("当前仓位被锁定!"); + } + + List tableData = reqParam.getJSONArray("tableData").toJavaList(LinkedHashMap.class); Assert.notEmpty(tableData, "组盘信息数据不能为空!"); JSONObject param = new JSONObject(); param.put("bill_type", bill_type); @@ -175,17 +207,22 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic param.put("tableData", tableData); rawAssistIStorService.insertPdaDtl(param); //更新组盘表组盘状态为入库状态 - JSONObject row = tableData.getJSONObject(0); - String group_id = row.getString("group_id"); + LinkedHashMap row = tableData.get(0); + String group_id = row.get("group_id").toString(); GroupPlate groupPlate = mdPbGroupplateService.getById(group_id); groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("入库")); mdPbGroupplateService.updateById(groupPlate); MdPbStoragevehicleinfo storagevehicleinfo = mdPbStoragevehicleinfoService.getByCode(groupPlate.getStoragevehicle_code()); Assert.notNull(storagevehicleinfo, "载具信息不存在!"); + + // 判断当前载具是否是大料箱载具 + if (!storagevehicleinfo.getStoragevehicle_type().equals(IOSEnum.VEHICLE_TYPE.code("大料箱"))) { + throw new BadRequestException("当前载具不属于大料箱载具【" + storagevehicleinfo.getStoragevehicle_code() + "】"); + } + //更新仓位表载具信息 structattr.setStoragevehicle_code(storagevehicleinfo.getStoragevehicle_code()); - structattr.setStoragevehicle_type(storagevehicleinfo.getStoragevehicle_type()); - structattr.setIs_emptyvehicle("0"); + structattr.setIs_emptyvehicle(IOSConstant.ZERO); structattr.setUpdate_optid(SecurityUtils.getCurrentUserId()); structattr.setUpdate_optname(SecurityUtils.getCurrentNickName()); structattr.setUpdate_time(DateUtil.now()); @@ -280,69 +317,68 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic String ts_storagevehicle_code = reqParam.getString("ts_storagevehicle_code"); String plan_qty = reqParam.getString("plan_qty"); Assert.notEmpty(plan_qty, "计划数量不能为空!"); - if (StrUtil.isBlank(ts_storagevehicle_code)) { - //如果配送载具为空,则直接清除库存,将仓位表中的载具号清除,并标记为空载具,组盘信息更新为出库 - MdPbStoragevehicleext storagevehicleext = mdPbStoragevehicleextService.getOne(new LambdaQueryWrapper() - .eq(MdPbStoragevehicleext::getStoragevehicle_code, storagevehicle_code)); - if (storagevehicleext != null) { - mdPbStoragevehicleextService.removeById(storagevehicleext.getStoragevehicleext_id()); - } - Structattr structattr = structattrService.findByCode(struct_code); - if (structattr != null) { - structattr.setIs_emptyvehicle("1"); - structattr.setUpdate_optid(SecurityUtils.getCurrentUserId()); - structattr.setUpdate_optname(SecurityUtils.getCurrentNickName()); - structattr.setUpdate_time(DateUtil.now()); - structattrService.updateById(structattr); - } - GroupPlate groupPlate = mdPbGroupplateService.getOne(new LambdaQueryWrapper() - .eq(GroupPlate::getStoragevehicle_code, storagevehicle_code)); - if (groupPlate != null) { - groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("出库")); - mdPbGroupplateService.updateById(groupPlate); - } - } else { - //如果配送载具不为空,则更新库存,更新组盘信息中的数量 - GroupPlate groupPlate = mdPbGroupplateService.getOne(new LambdaQueryWrapper() - .eq(GroupPlate::getStoragevehicle_code, storagevehicle_code)); - if (groupPlate != null) { - groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("出库")); - groupPlate.setQty(groupPlate.getQty().subtract(new BigDecimal(plan_qty))); - mdPbGroupplateService.updateById(groupPlate); - } - MdPbStoragevehicleext storagevehicleext = mdPbStoragevehicleextService.getOne(new LambdaQueryWrapper() - .eq(MdPbStoragevehicleext::getStoragevehicle_code, ts_storagevehicle_code)); - if (storagevehicleext != null) { - storagevehicleext.setCanuse_qty(storagevehicleext.getCanuse_qty().subtract(new BigDecimal(plan_qty))); - mdPbStoragevehicleextService.updateById(storagevehicleext); - } - } + + // 查询分配明细 IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectById(iostorinvdis_id); - if (ioStorInvDis != null) { - ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("完成")); - ioStorInvDisMapper.updateById(ioStorInvDis); - List ioStorInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper() - .eq(IOStorInvDis::getIostorinvdtl_id, ioStorInvDis.getIostorinvdtl_id()) - .lt(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))); - if (ioStorInvDisList.size() == 0) { - //更新单据状态为完成 - IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id()); - if (ioStorInvDtl != null) { - ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成")); - ioStorInvDtlMapper.updateById(ioStorInvDtl); - List storInvDtlList = ioStorInvDtlMapper.selectList(new LambdaQueryWrapper() - .eq(IOStorInvDtl::getIostorinv_id, ioStorInvDtl.getIostorinv_id()) - .lt(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("完成"))); - if (storInvDtlList.size() == 0) { - IOStorInv ioStorInv = iOutBillService.getById(ioStorInvDtl.getIostorinv_id()); - if (ioStorInv != null) { - ioStorInv.setBill_status(IOSEnum.BILL_STATUS.code("完成")); - iOutBillService.updateById(ioStorInv); - } - } + // 判断是否是拣选:不是:清空仓位信息 + if (ioStorInvDis.getIs_check().equals(IOSConstant.ZERO)) { + Structattr attrDao = structattrService.getByCode(ioStorInvDis.getStruct_code()); + + // 判断是否有新载具 + if (ObjectUtil.isNotEmpty(ts_storagevehicle_code)) { + MdPbStoragevehicleinfo tsVehicle = mdPbStoragevehicleinfoService.getByCode(ts_storagevehicle_code); + if (ObjectUtil.isEmpty(tsVehicle)) { + throw new BadRequestException("配送载具不存在!【"+ts_storagevehicle_code+"】"); } + if (!tsVehicle.getStoragevehicle_type().equals(IOSEnum.VEHICLE_TYPE.code("大料箱"))) { + throw new BadRequestException("当前配送载具不属于大料箱载具!【"+ts_storagevehicle_code+"】"); + } + // 更新组盘信息为新载具信息 + mdPbGroupplateService.update( + new UpdateWrapper().lambda() + .set(GroupPlate::getStoragevehicle_code, ts_storagevehicle_code) + .eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code()) + .eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn()) + .eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id()) + .eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")) + ); + // 更新仓位 + attrDao.setIs_emptyvehicle(IOSConstant.ONE); + } else { + // 更新仓位 + attrDao.setStoragevehicle_code(""); + } + + structattrService.updateById(attrDao); + } else { + // 拣选 + // 判断是否有新载具 + if (ObjectUtil.isNotEmpty(ts_storagevehicle_code)) { + MdPbStoragevehicleinfo tsVehicle = mdPbStoragevehicleinfoService.getByCode(ts_storagevehicle_code); + if (ObjectUtil.isEmpty(tsVehicle)) { + throw new BadRequestException("配送载具不存在!【"+ts_storagevehicle_code+"】"); + } + if (!tsVehicle.getStoragevehicle_type().equals(IOSEnum.VEHICLE_TYPE.code("大料箱"))) { + throw new BadRequestException("当前配送载具不属于大料箱载具!【"+ts_storagevehicle_code+"】"); + } + + // 新增组盘信息 + GroupPlate plate = mdPbGroupplateService.getOne( + new QueryWrapper().lambda() + .eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code()) + .eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn()) + .eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id()) + .eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")) + ); + plate.setStoragevehicle_code(ts_storagevehicle_code); + plate.setQty(ioStorInvDis.getPlan_qty()); + plate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("组盘")); + mdPbGroupplateService.create(plate); } } + + // 调用出库服务明细确认方法 + iOutBillService.disFinish(ioStorInvDis); return PdaResponse.requestOk(); } @@ -441,7 +477,7 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic // 更新移入库存信息 iMdPbStoragevehicleextService.update( new UpdateWrapper().lambda() - .set(MdPbStoragevehicleext::getCanuse_qty, NumberUtil.add(jsonOut.getBigDecimal("qty"),jsonIn.getBigDecimal("qty"))) + .set(MdPbStoragevehicleext::getCanuse_qty, NumberUtil.add(jsonOut.getBigDecimal("qty"), jsonIn.getBigDecimal("qty"))) .eq(MdPbStoragevehicleext::getStoragevehicle_code, jsonIn.getString("storagevehicle_code")) .eq(MdPbStoragevehicleext::getMaterial_id, jsonIn.getString("material_id")) .eq(MdPbStoragevehicleext::getPcsn, jsonIn.getString("pcsn")) @@ -450,8 +486,8 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic // 更新组盘信息 mdPbGroupplateService.update( new UpdateWrapper().lambda() - .set(GroupPlate::getQty, NumberUtil.add(jsonOut.getBigDecimal("qty"),jsonIn.getBigDecimal("qty"))) - .eq(GroupPlate::getGroup_id, jsonIn.getString("group_id")) + .set(GroupPlate::getQty, NumberUtil.add(jsonOut.getBigDecimal("qty"), jsonIn.getBigDecimal("qty"))) + .eq(GroupPlate::getGroup_id, jsonIn.getString("group_id")) ); // 删除移出货位组盘信息 @@ -460,7 +496,7 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic // 删除库存信息 iMdPbStoragevehicleextService.remove( new QueryWrapper().lambda() - .eq(MdPbStoragevehicleext::getStoragevehicle_code, jsonOut.getString("storagevehicle_code")) + .eq(MdPbStoragevehicleext::getStoragevehicle_code, jsonOut.getString("storagevehicle_code")) ); // 更新移出仓位为空载具 @@ -473,7 +509,7 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic iStIvtMoveinvService.confirmTask(dtlDao); } else { // 创建移库单据并确认 - createPdaMove(jsonOut,jsonIn); + createPdaMove(jsonOut, jsonIn); } return PdaResponse.requestOk(); @@ -481,8 +517,9 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic /** * 创建移库单据 + * * @param jsonOut 移出数据 - * @param jsonIn 移入数据 + * @param jsonIn 移入数据 */ private void createPdaMove(JSONObject jsonOut, JSONObject jsonIn) { // 查询移出货位 @@ -539,16 +576,16 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic // 更新移入库存信息 iMdPbStoragevehicleextService.update( new UpdateWrapper().lambda() - .set(MdPbStoragevehicleext::getCanuse_qty, NumberUtil.add(jsonOut.getBigDecimal("qty"),jsonIn.getBigDecimal("qty"))) - .eq(MdPbStoragevehicleext::getStoragevehicle_code, jsonIn.getString("storagevehicle_code")) - .eq(MdPbStoragevehicleext::getMaterial_id, jsonIn.getString("material_id")) - .eq(MdPbStoragevehicleext::getPcsn, jsonIn.getString("pcsn")) + .set(MdPbStoragevehicleext::getCanuse_qty, NumberUtil.add(jsonOut.getBigDecimal("qty"), jsonIn.getBigDecimal("qty"))) + .eq(MdPbStoragevehicleext::getStoragevehicle_code, jsonIn.getString("storagevehicle_code")) + .eq(MdPbStoragevehicleext::getMaterial_id, jsonIn.getString("material_id")) + .eq(MdPbStoragevehicleext::getPcsn, jsonIn.getString("pcsn")) ); // 更新组盘信息 mdPbGroupplateService.update( new UpdateWrapper().lambda() - .set(GroupPlate::getQty, NumberUtil.add(jsonOut.getBigDecimal("qty"),jsonIn.getBigDecimal("qty"))) + .set(GroupPlate::getQty, NumberUtil.add(jsonOut.getBigDecimal("qty"), jsonIn.getBigDecimal("qty"))) .eq(GroupPlate::getGroup_id, jsonIn.getString("group_id")) ); @@ -592,7 +629,7 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic * "fac_qty": 48 -- 盘点数量 * } */ - iStIvtCheckmstService.dtlCheckConfirm(JSONObject.toJavaObject(reqParam,StIvtCheckdtl.class)); + iStIvtCheckmstService.dtlCheckConfirm(JSONObject.toJavaObject(reqParam, StIvtCheckdtl.class)); return PdaResponse.requestOk(); } @@ -644,7 +681,7 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic Assert.notBlank(storagevehicle_code, "载具号不能为空!"); List groupPlateList = mdPbGroupplateService.list(new LambdaQueryWrapper() .eq(GroupPlate::getStoragevehicle_code, storagevehicle_code) - .eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))); + .eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))); //将GroupPlate对象转换为Map List> groupPlateListMap = groupPlateList.stream() .map(groupPlate -> { @@ -658,20 +695,22 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic groupPlateMap.put("material_name", materialbase.getMaterial_name()); groupPlateMap.put("material_spec", materialbase.getMaterial_spec()); groupPlateMap.put("material_mode", materialbase.getMaterial_model()); + groupPlateMap.put("quality_time", materialbase.getQuality_time()); } groupPlateMap.put("qty_unit_name", groupPlate.getQty_unit_name()); + groupPlateMap.put("qty_unit_id", groupPlate.getQty_unit_id()); groupPlateMap.put("qty", groupPlate.getQty()); MdCsSupplierbase mdCsSupplierbase = mdCsSupplierbaseService.getOne(new LambdaQueryWrapper().eq(MdCsSupplierbase::getSupp_code, groupPlate.getSupp_code())); groupPlateMap.put("supp_code", groupPlate.getSupp_code()); if (ObjectUtil.isNotEmpty(mdCsSupplierbase)) { groupPlateMap.put("supp_name", mdCsSupplierbase.getSupp_name()); } - groupPlateMap.put("quality_time", groupPlate.getQuality_time()); groupPlateMap.put("produce_time", groupPlate.getProduce_time()); groupPlateMap.put("execution_stand", groupPlate.getExecution_stand()); groupPlateMap.put("bake_num", groupPlate.getBake_num()); groupPlateMap.put("quality_type", groupPlate.getQuality_type()); groupPlateMap.put("box_type", groupPlate.getBox_type()); + groupPlateMap.put("pcsn", groupPlate.getPcsn()); return groupPlateMap; }).collect(Collectors.toList()); return PdaResponse.requestParamOk(groupPlateListMap); @@ -760,12 +799,9 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic @Override public PdaResponse getIoDisDocumentInfo(JSONObject reqParam) { Assert.notNull(reqParam, "请求参数不能为空!"); - String type = reqParam.getString("type"); - Assert.notBlank(type, "出入库单据类型不能为空!"); JSONObject param = new JSONObject(); param.put("query", reqParam.getString("query")); param.put("biz_date", reqParam.getString("biz_date")); - param.put("bill_type", type); param.put("bill_status", IOSEnum.BILL_STATUS.code("分配完")); List> ioDisDtl = iOutBillService.getIoDisDtl(param); return PdaResponse.requestParamOk(ioDisDtl); @@ -776,7 +812,7 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic String type = reqParam.getString("type"); Assert.notBlank(type, "移库类型不能为空!"); String vehicleStructCode = reqParam.getString("vehicleStructCode"); - if(ObjectUtil.isEmpty(vehicleStructCode)) { + if (ObjectUtil.isEmpty(vehicleStructCode)) { if (ObjectUtil.isEmpty(reqParam.getString("moveinvdtl_id"))) { throw new BadRequestException("载具编码或点位编码不能为空!"); } @@ -818,4 +854,9 @@ public class PadLargeMaterialBoxServiceImpl implements PdaLargeMaterialBoxServic data.put("ivt_qty", storagevehicleext == null ? 0 : storagevehicleext.getCanuse_qty()); return PdaResponse.requestParamOk(data); } + + @Override + public PdaResponse getType(JSONObject reqParam) { + return PdaResponse.requestParamOk(PDAEnum.IN_BILL_TYPE.getDict()); + } } diff --git a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/enums/IOSEnum.java b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/enums/IOSEnum.java index a9ee989..0bd957e 100644 --- a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/enums/IOSEnum.java +++ b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/enums/IOSEnum.java @@ -77,15 +77,14 @@ public enum IOSEnum { PLACEMENT_TYPE(MapOf.of("深货位", "1", "浅货位", "2")), // 库区编码 - SECT_CODE(MapOf.of("合格区", "HG01", "待检区", "DJ01", "不合格区", "BHG01")), + SECT_CODE(MapOf.of("合格区", "HG01", "待检区", "DJ01", "不合格区", "BHG01", "大料箱区", "DLX01")), // 存放载具类型 VEHICLE_TYPE_PUT(MapOf.of("大料架(短边)", "1", "大料架(长边)", "2", "金属托盘", "3" , "小料架", "4")), // 载具类型 - VEHICLE_TYPE(MapOf.of("金属托盘", "00", "小料架", "01", "大料架(短边)", "02" - , "大料架(长边)", "03")), + VEHICLE_TYPE(MapOf.of("小料箱", "1", "大料箱", "2", "焊条筒", "3")), // 点位状态 POINT_STATUS(MapOf.of("空位", "1", "有箱有料", "2", "空载具", "3" )), diff --git a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/IOutBillService.java b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/IOutBillService.java index f629932..03a044c 100644 --- a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/IOutBillService.java +++ b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/IOutBillService.java @@ -171,6 +171,13 @@ public interface IOutBillService extends IService { */ void taskFinish(SchBaseTask task); + /** + * 出库分配明细完成 + * + * @param dis + */ + void disFinish(IOStorInvDis dis); + /** * 获取出入库单据分配明细 * diff --git a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/dao/mapper/IOStorInvDisMapper.xml b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/dao/mapper/IOStorInvDisMapper.xml index b0757fc..e2887eb 100644 --- a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/dao/mapper/IOStorInvDisMapper.xml +++ b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/dao/mapper/IOStorInvDisMapper.xml @@ -75,11 +75,13 @@ sb.supp_name FROM st_ivt_iostorinv ios LEFT JOIN st_ivt_iostorinvdis dis ON ios.iostorinv_id = dis.iostorinv_id + LEFT JOIN st_ivt_structattr attr ON dis.struct_code = attr.struct_code LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id LEFT JOIN md_pb_groupplate gp ON gp.storagevehicle_code = dis.storagevehicle_code - LEFT JOIN md_cs_supplierbase sb ON sb.supplier_code = gp.supplier_code + LEFT JOIN md_cs_supplierbase sb ON sb.supp_code = gp.supp_code - is_delete = '0' + ios.is_delete = '0' + AND attr.sect_code = 'DLX01' AND (ios.bill_code LIKE CONCAT('%', #{param.query}, '%') OR mb.material_code LIKE CONCAT('%', #{param.query}, '%') diff --git a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/impl/OutBillServiceImpl.java b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/impl/OutBillServiceImpl.java index c8b7fa8..a654718 100644 --- a/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/impl/OutBillServiceImpl.java +++ b/wms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_management/service/impl/OutBillServiceImpl.java @@ -28,8 +28,10 @@ import org.nl.wms.basedata_manage.service.dao.Structattr; import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper; import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto; import org.nl.wms.pdm_manage.enums.BomEnum; +import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialDtlService; import org.nl.wms.pdm_manage.service.IPdmBomCallMaterialService; import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterial; +import org.nl.wms.pdm_manage.service.dao.PdmBomCallMaterialDtl; import org.nl.wms.sch_manage.enums.TaskStatus; import org.nl.wms.sch_manage.service.ISchBaseTaskService; import org.nl.wms.sch_manage.service.dao.SchBaseTask; @@ -150,6 +152,12 @@ public class OutBillServiceImpl extends ServiceImpl @Autowired private TaskFactory taskFactory; + /** + * 退料单服务 + */ + @Resource + private IPdmBomCallMaterialDtlService iPdmBomCallMaterialDtlService; + @Override public IPage pageQuery(Map whereJson, PageQuery page, String[] stor_id, String[] bill_status, String[] bill_type) { HashMap map = new HashMap<>(whereJson); @@ -1498,6 +1506,138 @@ public class OutBillServiceImpl extends ServiceImpl } } + @Override + @Transactional(rollbackFor = Exception.class) + public void disFinish(IOStorInvDis dis) { + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + String now = DateUtil.now(); + + IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class) + .eq(IOStorInvDis::getTask_id, dis.getIostorinvdis_id()) + ); + if (ObjectUtil.isEmpty(ioStorInvDis)) { + throw new BadRequestException("未找分配明细"); + } + //查询主表信息 + IOStorInv ioStorInv = ioStorInvMapper.selectById(ioStorInvDis.getIostorinv_id()); + + //查询明细信息 + IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(ioStorInvDis.getIostorinvdtl_id()); + if (ObjectUtil.isEmpty(ioStorInvDtl)) { + throw new BadRequestException("未找到明细"); + } + + ioStorInvDisMapper.update(ioStorInvDis, new LambdaUpdateWrapper<>(IOStorInvDis.class) + .set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成")) + .set(IOStorInvDis::getReal_qty, dis.getPlan_qty()) + .eq(IOStorInvDis::getIostorinvdis_id, ioStorInvDis.getIostorinvdis_id()) + ); + + //解锁库位 + JSONObject finish_map = new JSONObject(); + finish_map.put("struct_code", ioStorInvDis.getStruct_code()); + finish_map.put("storagevehicle_code", null); + finish_map.put("inv_type", null); + finish_map.put("inv_id", null); + finish_map.put("inv_code", null); + iStructattrService.updateStatusByCode("1", finish_map); + + //修改库存 恢复库存 手持进行减扣 + List updateIvtList = new ArrayList<>(); + JSONObject jsonIvt = new JSONObject(); + jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_SUB_FROZEN); + jsonIvt.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code()); + jsonIvt.put("material_id", ioStorInvDis.getMaterial_id()); + jsonIvt.put("pcsn", ioStorInvDis.getPcsn()); + jsonIvt.put("qty_unit_id", ioStorInvDis.getQty_unit_id()); + jsonIvt.put("qty_unit_name", ioStorInvDis.getQty_unit_name()); + jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty()); + updateIvtList.add(jsonIvt); + iMdPbStoragevehicleextService.updateIvt(updateIvtList); + + GroupPlate groupPlate = groupPlateMapper.selectOne( + new QueryWrapper().lambda() + .eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn()) + .eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code()) + .eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id()) + .eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")) + ); + + double sub_qty = NumberUtil.sub(groupPlate.getQty(), ioStorInvDis.getPlan_qty()).doubleValue(); + if (sub_qty != 0) { + groupPlate.setQty(BigDecimal.valueOf(sub_qty)); + } + groupPlate.setOut_type(ioStorInv.getBill_type()); + if (ioStorInvDis.getIs_check().equals(IOSConstant.ZERO)) { + groupPlate.setIs_need_delete(IOSConstant.ONE); + groupPlate.setStatus(IOSEnum.GROUP_PLATE_STATUS.code("出库")); + } + + groupPlateMapper.updateById(groupPlate); + + // 判断是否是领料出库或者烘干出库 + if (ioStorInv.getBill_type().equals(IOSEnum.OUT_BILL_TYPE.code("领料出库")) + || ioStorInv.getBill_type().equals(IOSEnum.OUT_BILL_TYPE.code("烘干出库")) + ) { + // 创建退料明细 + PdmBomCallMaterialDtl materDtlDao = new PdmBomCallMaterialDtl(); + materDtlDao.setBomdtl_id(IdUtil.getStringId()); + materDtlDao.setBom_id(ioStorInvDtl.getSource_billdtl_id()); + materDtlDao.setMaterial_id(ioStorInvDis.getMaterial_id()); + materDtlDao.setPcsn(ioStorInvDis.getPcsn()); + materDtlDao.setVehicle_code(ioStorInvDis.getStoragevehicle_code()); + materDtlDao.setStruct_code(ioStorInvDis.getStruct_code()); + materDtlDao.setBom_status(BomEnum.CALL_BOM_DTL_STATUS.code("生成")); + materDtlDao.setOut_dis_id(ioStorInvDis.getIostorinvdis_id()); + materDtlDao.setOut_qty(ioStorInvDis.getReal_qty()); + materDtlDao.setCreate_id(SecurityUtils.getCurrentUserId()); + materDtlDao.setCreate_name(SecurityUtils.getCurrentNickName()); + materDtlDao.setCreate_time(DateUtil.now()); + iPdmBomCallMaterialDtlService.save(materDtlDao); + } + + // 查询该明细下是否还有未完成的分配明细 + int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class) + .eq(IOStorInvDis::getIostorinvdtl_id, ioStorInvDis.getIostorinvdtl_id()) + .ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成")) + ); + + + // 如果分配明细全部完成则更新明细表状态 + if (countDis == 0) { + // 更新明细表状态 + ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成")); + ioStorInvDtl.setReal_qty(ioStorInvDtl.getAssign_qty()); + // 如果是领料出库单则更新工单状态以及实际出库重量 + if (ObjectUtil.isNotEmpty(ioStorInvDtl.getSource_bill_code())) { + PdmBomCallMaterial callMaterDao = iPdmBomCallMaterialService.findByCode(ioStorInvDtl.getSource_bill_code()); + callMaterDao.setReal_qty(ioStorInvDtl.getPlan_qty()); + callMaterDao.setBom_status(BomEnum.CALL_BOM_STATUS.code("叫料完成")); + iPdmBomCallMaterialService.updateById(callMaterDao); + } + ioStorInvDtlMapper.updateById(ioStorInvDtl); + + // 查看明细是否全部完成 + int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class) + .eq(IOStorInvDtl::getIostorinv_id, ioStorInvDtl.getIostorinv_id()) + .ne(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("完成")) + ); + + // 如果明细全部完成则更新主表状态 + if (countDtl == 0) { + //更新主表状态 + ioStorInvMapper.update(new IOStorInv(), new LambdaUpdateWrapper<>(IOStorInv.class) + .set(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成")) + .set(IOStorInv::getConfirm_optid, currentUserId) + .set(IOStorInv::getConfirm_optname, nickName) + .set(IOStorInv::getConfirm_time, now) + .eq(IOStorInv::getIostorinv_id, ioStorInvDtl.getIostorinv_id()) + ); + } + } + } + @Override public List> getIoDisDtl(JSONObject param) { return ioStorInvDisMapper.getIoDisDtl(param);