diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/StructattrVechielDto.java b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/StructattrVechielDto.java index e6a8533..0ad847c 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/StructattrVechielDto.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/StructattrVechielDto.java @@ -16,41 +16,21 @@ public class StructattrVechielDto extends GroupPlate { /** * 仓位标识 */ - private String id; - /** - * 载具物料id - */ - private String vm_id; - /** - * 入库类型 - */ - private String source_form_type; + private String struct_id; /** * 仓位编码 */ private String struct_code; - - /** - * 仓位名称 - */ - private String struct_name; - /** * 库区标识 */ private String sect_code; - /** * 仓库标识 */ private String stor_code; - /** - * 容量 - */ - private Integer capacity; - /** * 宽度 */ @@ -71,21 +51,6 @@ public class StructattrVechielDto extends GroupPlate { */ private Integer weight; - /** - * 起始X坐标 - */ - private BigDecimal xqty; - - /** - * 起始Y坐标 - */ - private BigDecimal yqty; - - /** - * 起始Z坐标 - */ - private BigDecimal zqty; - /** * 排 */ @@ -111,21 +76,6 @@ public class StructattrVechielDto extends GroupPlate { */ private String control_code; - /** - * 创建人 - */ - private String create_id; - - /** - * 创建人姓名 - */ - private String create_name; - - /** - * 创建时间 - */ - private String create_time; - /** * 是否临时仓位 */ @@ -149,33 +99,7 @@ public class StructattrVechielDto extends GroupPlate { /** * 存储载具号 */ - private String vehicle_code; - - /** - * 备注 - */ - private String remark; - - /** - * 背景图片 - */ - private String back_ground_pic; - - /** - * 前景色 - */ - private String front_ground_color; - - /** - * 背景色 - */ - private String back_ground_color; - - /** - * 字体显示方向 - */ - private String font_direction_scode; - + private String storagevehicle_code; /** * 物料编码 diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/mapper/StructattrMapper.xml b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/mapper/StructattrMapper.xml index ad8ae03..3028084 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/mapper/StructattrMapper.xml +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dao/mapper/StructattrMapper.xml @@ -7,9 +7,13 @@ gro.frozen_qty, gro.create_time, gro.qty_unit_name, + gro.qty_unit_id, gro.material_id, gro.pcsn, gro.group_id, + gro.ext_code, + gro.ext_type, + gro.group_id, mater.material_code, mater.material_name, ivt.* diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dto/StrategyStructMaterialVO.java b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dto/StrategyStructMaterialVO.java index df23140..d8916af 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dto/StrategyStructMaterialVO.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dto/StrategyStructMaterialVO.java @@ -6,26 +6,37 @@ import java.math.BigDecimal; @Data public class StrategyStructMaterialVO { - + /** + * 分配的货位的仓库库区编码 + */ + private String stor_id; + private String stor_code; + private String stor_name; + private String sect_id; private String sect_code; + private String sect_name; /** * 仓位编码 */ private String struct_code; + private String struct_id; + private String struct_name; /** * 锁定类型 */ private String lock_type; /** - * 载具编码 + * 分配的载具编码 */ + private String group_id; private String storagevehicle_code; /** * 物料标识 */ private String material_code; + private String material_id; /** * 批次 @@ -33,13 +44,15 @@ public class StrategyStructMaterialVO { private String pcsn; /** - * 组盘数量 + * 托盘物料数量 */ private BigDecimal qty; /** - * 当前仓库冻结数 + * 当前托盘分配数量 */ private BigDecimal frozen_qty; + private String qty_unit_id; + private String qty_unit_name; /** * 来源单据号 diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dto/StrategyStructParam.java b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dto/StrategyStructParam.java index 72ba054..e0f4241 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dto/StrategyStructParam.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/basedata_manage/service/dto/StrategyStructParam.java @@ -25,6 +25,7 @@ public class StrategyStructParam { * 物料标识 */ private String material_code; + private String material_id; /** * 批次 diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/decision_manage/service/strategyConfig/decisioner/impl/base/FIFORuleHandler.java b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/decision_manage/service/strategyConfig/decisioner/impl/base/FIFORuleHandler.java index 2ad50cf..3ddad27 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/decision_manage/service/strategyConfig/decisioner/impl/base/FIFORuleHandler.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/decision_manage/service/strategyConfig/decisioner/impl/base/FIFORuleHandler.java @@ -7,7 +7,10 @@ import org.nl.common.exception.BadRequestException; import org.nl.common.utils.MapOf; import org.nl.wms.basedata_manage.service.IStructattrService; import org.nl.wms.basedata_manage.service.dao.StructattrVechielDto; +import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO; +import org.nl.wms.basedata_manage.service.dto.StrategyStructParam; import org.nl.wms.decision_manage.service.strategyConfig.decisioner.Decisioner; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -22,7 +25,7 @@ import java.util.stream.Collectors; */ @Service("fifo") @Slf4j -public class FIFORuleHandler extends Decisioner { +public class FIFORuleHandler extends Decisioner { /** * 出入库明细服务 @@ -31,118 +34,41 @@ public class FIFORuleHandler extends Decisioner handler(List list, JSONObject param) { + public List handler(List list, StrategyStructParam param) { //分配数量 - int plan_qty = param.getInteger("qty"); - int finalPlan_qty = plan_qty; //当前条件只有id,批次 log.info("---------执行fifo出库分配规则---------"); - List vechielDtos = iStructattrService.collectVechicle(MapOf.of("material_id", param.getString("material_id") - , "pcsn", param.getString("pcsn") - , "stor_code", param.getString("stor_code") - , "plan_qty", plan_qty + BigDecimal planQty = param.getQty(); + List vechielDtos = + iStructattrService.collectVechicle(MapOf.of("material_id", param.getMaterial_id() + , "pcsn", param.getPcsn() + , "stor_code", param.getStor_code() + , "sect_code", param.getSect_code() + , "plan_qty", planQty , "is_lock", "false" - , "order_by", "md_pb_vehicleMater.pcsn asc") + , "order_by", "gro.update_time asc") ); if (ObjectUtils.isEmpty(vechielDtos)) { throw new BadRequestException("当前出库策略:先进先出,库存分配失败,失败原因:库存不足!"); } - List disList = new ArrayList<>(); - Map> groupedMap = vechielDtos.stream() - .collect(Collectors.groupingBy( - StructattrVechielDto::getPcsn, - Collectors.collectingAndThen( - Collectors.toList(), - r -> r.stream() - .sorted(Comparator.comparing(StructattrVechielDto::getPcsn)) - .collect(Collectors.toList()) - ) - )); - LinkedHashMap> sortedGroupMap = groupedMap.entrySet().stream() - .sorted(Comparator.comparing(entry -> entry.getValue().get(0).getPcsn())) - .collect(Collectors.toMap( - Map.Entry::getKey, - Map.Entry::getValue, - (r, s) -> r, - LinkedHashMap::new - )); - for (Map.Entry> entry : sortedGroupMap.entrySet()) { - List sortedList = new ArrayList<>(entry.getValue()); - for (StructattrVechielDto structattr : sortedList) { - BigDecimal qty = structattr.getXqty() != null ? structattr.getQty() : BigDecimal.ZERO; - BigDecimal frozen = structattr.getFrozen_qty() != null ? structattr.getFrozen_qty() : BigDecimal.ZERO; - int available = qty.subtract(frozen).intValue(); - if (available <= 0) { - continue; - } - if (finalPlan_qty <= available) { - structattr.setFrozen_qty(frozen.add(new BigDecimal(finalPlan_qty))); - disList.add(structattr); - finalPlan_qty = 0; - break; - } else { - structattr.setFrozen_qty(frozen.add(new BigDecimal(available))); - disList.add(structattr); - finalPlan_qty -= available; - } - } - if (finalPlan_qty <= 0) { + List divStruct = new ArrayList<>(); + for (StructattrVechielDto vechielDto : vechielDtos) { + if (planQty.intValue()<=0){ break; } + BigDecimal qty = vechielDto.getQty(); + BigDecimal subQty = planQty.subtract(qty); + if (subQty.doubleValue()>=0){ + vechielDto.setFrozen_qty(vechielDto.getQty()); + }else { + vechielDto.setFrozen_qty(planQty); + } + planQty=subQty; + StrategyStructMaterialVO materialVO = new StrategyStructMaterialVO(); + BeanUtils.copyProperties(vechielDto,materialVO); + divStruct.add(materialVO); } - return disList; + return divStruct; } - /** - * 巷道均衡策略 - * - * @param list :仓位集合 - * @param param:物料相关信息、出入类型:{ ioType: 出入类型 - * materialId: 物料标识 - * ... - * } - * @return List :仓位集合 - */ - // @Override - // public List handler1(List list, JSONObject param) { - // // 判断仓位是否为空 - //// if (ObjectUtil.isEmpty(list)) { - //// throw new BadRequestException("库存分配失败:库存不足!"); - //// } - //// List need = list.stream().map(StructattrVechielDto::getStoragevehicle_code).collect(Collectors.toList()); - // //分配数量 - // int plan_qty = param.getInteger("qty"); - // //当前条件只有id,批次 - // log.info("---------执行fifo出库分配规则---------"); - // List vechielDtos = iStructattrService.collectVechicle(MapOf.of("material_id", param.getString("material_id") - // , "pcsn", param.getString("pcsn") - // , "stor_code", param.getString("stor_code") - // , "plan_qty", plan_qty - // , "is_lock", "false" - //// , "order_by","block_num asc,ABS(qty-#{plan_qty}) asc,update_time asc") - // , "order_by","block_num asc,ABS(qty-#{plan_qty}) asc,update_time asc") - // ); - // int finalPlan_qty = 0; - //// vechielDtos.sort(Comparator.comparingInt(o -> (o.getQty().intValue() - finalPlan_qty))); - // List disList = new ArrayList<>(); - // for (StructattrVechielDto structattr : vechielDtos) { - //// if (need.contains(structattr.getStoragevehicle_code()) && structattr.getFrozen_qty().intValue()==0){ - // if (structattr.getFrozen_qty().intValue()==0){ - // int cause_qty = structattr.getQty().subtract(structattr.getFrozen_qty()).intValue(); - // int sub = plan_qty - cause_qty; - // finalPlan_qty = sub; - // disList.add(structattr); - // if (sub<=0){ - // structattr.setFrozen_qty(new BigDecimal(plan_qty)); - // break; - // } - // structattr.setFrozen_qty(new BigDecimal(cause_qty)); - // plan_qty = sub; - // } - // } - // if (finalPlan_qty>0){ - // throw new BadRequestException("库存不足:物料"+param.getString("material_id")+"当前库存可用数"+(param.getInteger("qty").intValue()-finalPlan_qty)); - // } - // return disList; - // } } diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/service/impl/OutBillServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/service/impl/OutBillServiceImpl.java index eab1f2a..1db638c 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/service/impl/OutBillServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/wms/warehouse_manage/service/impl/OutBillServiceImpl.java @@ -25,6 +25,9 @@ import org.nl.wms.basedata_manage.service.IStructattrService; import org.nl.wms.basedata_manage.service.dao.BsrealStorattr; import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleextMapper; import org.nl.wms.basedata_manage.service.dto.MdPbStoragevehicleextDto; +import org.nl.wms.basedata_manage.service.dto.StrategyStructMaterialVO; +import org.nl.wms.basedata_manage.service.dto.StrategyStructParam; +import org.nl.wms.basedata_manage.service.dto.StructattrChangeDto; import org.nl.wms.sch_manage.enums.TaskStatus; import org.nl.wms.sch_manage.service.ISchBaseTaskService; import org.nl.wms.sch_manage.service.dao.SchBasePoint; @@ -70,13 +73,6 @@ public class OutBillServiceImpl extends ServiceImpl i @Resource private IStructattrService iStructattrService; - @Resource - private IMdPbStoragevehicleextService iMdPbStoragevehicleextService; - /** - * 组盘记录mapper - */ - @Autowired - private MdPbGroupplateMapper mdPbGroupplateMapper; /** * 载具扩展属性mapper */ @@ -346,7 +342,7 @@ public class OutBillServiceImpl extends ServiceImpl i String currentUserId = SecurityUtils.getCurrentUserId(); String nickName = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); - + String sectCode = whereJson.getString("sect_code"); String iostorinv_id = whereJson.getString("iostorinv_id"); //查询主表信息 @@ -361,39 +357,33 @@ public class OutBillServiceImpl extends ServiceImpl i queryDtl.put("unassign_flag", BaseDataEnum.IS_YES_NOT.code("是")); queryDtl.put("iostorinv_id", iostorinv_id); List dtls = ioStorInvMapper.getIODtl(queryDtl); -// List dtls = ioStorInvDtlMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDtl.class) -// .le(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完")) -// .gt(IOStorInvDtl::getUnassign_qty,0) -// .eq(IOStorInvDtl::getIostorinv_id, iostorinv_id)); if (ObjectUtil.isEmpty(dtls)) { throw new BadRequestException("当前订单无可分配出库明细"); } for (int i = 0; i < dtls.size(); i++) { IOStorInvDtlDto dtl = dtls.get(i); - double unassign_qty = dtl.getUnassign_qty().doubleValue(); + BigDecimal unassign_qty = dtl.getUnassign_qty(); String pcsn = dtl.getPcsn(); String material_id = dtl.getMaterial_id(); - + String material_code = dtl.getMaterial_code(); // 根据物料和批次号查询库存可用 - BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSum(pcsn,material_id); - - if (ObjectUtil.isEmpty(canuseSum) || canuseSum.doubleValue() structMaterials = iStructattrService.outBoundSectDiv( + StrategyStructParam.builder() + .qty(unassign_qty) + .pcsn(pcsn) + .material_code(material_code) + .stor_code(ioStorInv.getStor_code()) + .sect_code(sectCode) + .build() + ); - /* - * 分配规则: - * 1.按批次先进先出 - * 2.相同批次载具量小优先 - */ - //出库分配查询货位信息 List outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn,material_id); int seq_no = 1; - double allocation_canuse_qty = 0; - for (MdPbStoragevehicleextDto outAllocation : outAllocationList) { + BigDecimal allocation_canuse_qty=BigDecimal.ZERO; + for (StrategyStructMaterialVO outAllocation : structMaterials) { //分配明细 IOStorInvDis ioStorInvDis = new IOStorInvDis(); ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId()); @@ -402,7 +392,8 @@ public class OutBillServiceImpl extends ServiceImpl i ioStorInvDis.setSeq_no((seq_no++)+""); ioStorInvDis.setSect_id(outAllocation.getSect_id()); ioStorInvDis.setPcsn(outAllocation.getPcsn()); - ioStorInvDis.setMaterial_id(material_id); + ioStorInvDis.setMaterial_id(outAllocation.getMaterial_id()); + ioStorInvDis.setMaterial_code(outAllocation.getMaterial_code()); ioStorInvDis.setSect_name(outAllocation.getSect_name()); ioStorInvDis.setSect_code(outAllocation.getSect_code()); ioStorInvDis.setStruct_id(outAllocation.getStruct_id()); @@ -413,22 +404,7 @@ public class OutBillServiceImpl extends ServiceImpl i ioStorInvDis.setQty_unit_id(outAllocation.getQty_unit_id()); ioStorInvDis.setQty_unit_name(outAllocation.getQty_unit_name()); ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成")); - - // 未分配数量 - 该库位上的可用数量 < 0 目前做整出 -// double canuse_qty = outAllocation.getCanuse_qty().doubleValue(); -// if (unassign_qty-canuse_qty>=0){ -// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty)); -// }else { -// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty)); -// } -// unassign_qty = unassign_qty-canuse_qty; - unassign_qty = unassign_qty-outAllocation.getCanuse_qty().doubleValue(); - if (unassign_qty<0){ - unassign_qty=0; - } - allocation_canuse_qty = allocation_canuse_qty + outAllocation.getCanuse_qty().doubleValue(); - ioStorInvDis.setPlan_qty(outAllocation.getCanuse_qty()); - + ioStorInvDis.setPlan_qty(outAllocation.getFrozen_qty()); //锁定货位 JSONObject lock_map = new JSONObject(); lock_map.put("struct_code", outAllocation.getStruct_code()); @@ -437,34 +413,27 @@ public class OutBillServiceImpl extends ServiceImpl i lock_map.put("inv_type", ioStorInv.getBill_type()); lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁")); iStructattrService.updateStatusByCode("0",lock_map); - + //更新组盘表冻结数量状态 + iMdPbGroupPlateService.update(new LambdaUpdateWrapper() + .set(GroupPlate::getFrozen_qty, outAllocation.getFrozen_qty()) + .set(GroupPlate::getUpdate_time, now) + .eq(GroupPlate::getStoragevehicle_code, outAllocation.getStoragevehicle_code()) + .eq(GroupPlate::getPcsn, outAllocation.getPcsn()) + .eq(GroupPlate::getMaterial_id, outAllocation.getMaterial_id()) + .eq(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("入库"))); //生成分配明细 ioStorInvDisMapper.insert(ioStorInvDis); - - //更新库存 加冻结减可用 - List updateIvtList = new ArrayList<>(); - JSONObject jsonIvt = new JSONObject(); - jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_FROZEN); - jsonIvt.put("storagevehicle_code", outAllocation.getStoragevehicle_code()); - jsonIvt.put("material_id", outAllocation.getMaterial_id()); - jsonIvt.put("pcsn", outAllocation.getPcsn()); - jsonIvt.put("qty_unit_id", outAllocation.getQty_unit_id()); - jsonIvt.put("qty_unit_name", outAllocation.getQty_unit_name()); - jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty()); - updateIvtList.add(jsonIvt); - iMdPbGroupPlateService.updateIvt(updateIvtList); - + allocation_canuse_qty = allocation_canuse_qty.add(outAllocation.getFrozen_qty()); //分配完成 结束分配 - if (unassign_qty==0){ + if (unassign_qty.doubleValue() <= 0){ break; } } //更新详情 dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完")); - double assign_qty = allocation_canuse_qty + dtl.getAssign_qty().doubleValue(); - dtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty)); - dtl.setAssign_qty(BigDecimal.valueOf(assign_qty)); + dtl.setUnassign_qty(unassign_qty); + dtl.setAssign_qty(dtl.getAssign_qty().add(allocation_canuse_qty)); ioStorInvDtlMapper.updateById(dtl); } @@ -560,13 +529,11 @@ public class OutBillServiceImpl extends ServiceImpl i @Override @Transactional(rollbackFor = Exception.class) public void autoDiv(JSONObject whereJson) { - String currentUserId = SecurityUtils.getCurrentUserId(); String nickName = SecurityUtils.getCurrentNickName(); String now = DateUtil.now(); - + String sectCode = whereJson.getString("sect_code"); String iostorinv_id = whereJson.getString("iostorinv_id"); - //查询主表信息 IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinv_id); if (ObjectUtil.isEmpty(ioStorInv)) { @@ -583,32 +550,24 @@ public class OutBillServiceImpl extends ServiceImpl i if (ObjectUtil.isEmpty(dtls)) { throw new BadRequestException("当前订单无可分配出库明细"); } - for (int i = 0; i < dtls.size(); i++) { IOStorInvDtlDto dtl = dtls.get(i); - double unassign_qty = dtl.getUnassign_qty().doubleValue(); + BigDecimal unassign_qty = dtl.getUnassign_qty(); String pcsn = dtl.getPcsn(); - String material_id = dtl.getMaterial_id(); - - // 根据物料和批次号查询库存可用 - BigDecimal canuseSum = mdPbStoragevehicleextMapper.queryCanuseSum(pcsn,material_id); - - if (canuseSum.doubleValue() outAllocationList = mdPbStoragevehicleextMapper.queryOutAllocation(pcsn,material_id); - + String material_code = dtl.getMaterial_code(); + //调用分配规则获取分配的库位:如果库存不足则直接报错 + List structMaterials = iStructattrService.outBoundSectDiv( + StrategyStructParam.builder() + .qty(unassign_qty) + .pcsn(pcsn) + .material_code(material_code) + .stor_code(ioStorInv.getStor_code()) + .sect_code(sectCode) + .build() + ); int seq_no = 1; - double allocation_canuse_qty = 0; - for (MdPbStoragevehicleextDto outAllocation : outAllocationList) { + BigDecimal allocation_canuse_qty=BigDecimal.ZERO; + for (StrategyStructMaterialVO outAllocation : structMaterials) { //分配明细 IOStorInvDis ioStorInvDis = new IOStorInvDis(); ioStorInvDis.setIostorinvdis_id(IdUtil.getStringId()); @@ -617,7 +576,8 @@ public class OutBillServiceImpl extends ServiceImpl i ioStorInvDis.setSeq_no((seq_no++)+""); ioStorInvDis.setSect_id(outAllocation.getSect_id()); ioStorInvDis.setPcsn(outAllocation.getPcsn()); - ioStorInvDis.setMaterial_id(material_id); + ioStorInvDis.setMaterial_id(outAllocation.getMaterial_id()); + ioStorInvDis.setMaterial_code(outAllocation.getMaterial_code()); ioStorInvDis.setSect_name(outAllocation.getSect_name()); ioStorInvDis.setSect_code(outAllocation.getSect_code()); ioStorInvDis.setStruct_id(outAllocation.getStruct_id()); @@ -628,22 +588,7 @@ public class OutBillServiceImpl extends ServiceImpl i ioStorInvDis.setQty_unit_id(outAllocation.getQty_unit_id()); ioStorInvDis.setQty_unit_name(outAllocation.getQty_unit_name()); ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成")); - - // 未分配数量 - 该库位上的可用数量 < 0 目前做整出 -// double canuse_qty = outAllocation.getCanuse_qty().doubleValue(); -// if (unassign_qty-canuse_qty>=0){ -// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(canuse_qty)); -// }else { -// ioStorInvDis.setPlan_qty(BigDecimal.valueOf(unassign_qty)); -// } -// unassign_qty = unassign_qty-canuse_qty; - unassign_qty = unassign_qty-outAllocation.getCanuse_qty().doubleValue(); - if (unassign_qty<0){ - unassign_qty=0; - } - allocation_canuse_qty = allocation_canuse_qty + outAllocation.getCanuse_qty().doubleValue(); - ioStorInvDis.setPlan_qty(outAllocation.getCanuse_qty()); - + ioStorInvDis.setPlan_qty(outAllocation.getFrozen_qty()); //锁定货位 JSONObject lock_map = new JSONObject(); lock_map.put("struct_code", outAllocation.getStruct_code()); @@ -652,44 +597,34 @@ public class OutBillServiceImpl extends ServiceImpl i lock_map.put("inv_type", ioStorInv.getBill_type()); lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁")); iStructattrService.updateStatusByCode("0",lock_map); - + //更新组盘表冻结数量状态 + iMdPbGroupPlateService.update(new LambdaUpdateWrapper() + .set(GroupPlate::getFrozen_qty, outAllocation.getFrozen_qty()) + .set(GroupPlate::getUpdate_time, now) + .eq(GroupPlate::getStoragevehicle_code, outAllocation.getStoragevehicle_code()) + .eq(GroupPlate::getPcsn, outAllocation.getPcsn()) + .eq(GroupPlate::getMaterial_id, outAllocation.getMaterial_id()) + .eq(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("入库"))); //生成分配明细 ioStorInvDisMapper.insert(ioStorInvDis); - - //更新库存 加冻结减可用 - List updateIvtList = new ArrayList<>(); - JSONObject jsonIvt = new JSONObject(); - jsonIvt.put("type", IOSConstant.UPDATE_IVT_TYPE_ADD_FROZEN); - jsonIvt.put("storagevehicle_code", outAllocation.getStoragevehicle_code()); - jsonIvt.put("material_id", outAllocation.getMaterial_id()); - jsonIvt.put("pcsn", outAllocation.getPcsn()); - jsonIvt.put("qty_unit_id", outAllocation.getQty_unit_id()); - jsonIvt.put("qty_unit_name", outAllocation.getQty_unit_name()); - jsonIvt.put("change_qty", ioStorInvDis.getPlan_qty()); - updateIvtList.add(jsonIvt); - iMdPbGroupPlateService.updateIvt(updateIvtList); - + allocation_canuse_qty = allocation_canuse_qty.add(outAllocation.getFrozen_qty()); //分配完成 结束分配 - if (unassign_qty==0){ + if (unassign_qty.doubleValue() <= 0){ break; } } - //更新详情 dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完")); - double assign_qty = allocation_canuse_qty + dtl.getAssign_qty().doubleValue(); - dtl.setUnassign_qty(BigDecimal.valueOf(unassign_qty)); - dtl.setAssign_qty(BigDecimal.valueOf(assign_qty)); + dtl.setUnassign_qty(unassign_qty); + dtl.setAssign_qty(dtl.getAssign_qty().add(allocation_canuse_qty)); ioStorInvDtlMapper.updateById(dtl); } - //更新主表 //根据单据标识判断明细是否都已经分配完成 int disCount = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class) .eq(IOStorInvDtl::getIostorinv_id,iostorinv_id) .lt(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("分配完")) ); - // 根据分配货位情况 更新主表单据状态 IOStorInv ios = new IOStorInv(); ios.setIostorinv_id(iostorinv_id); @@ -1121,7 +1056,6 @@ public class OutBillServiceImpl extends ServiceImpl i updateIvtList.add(jsonIvt); iMdPbGroupPlateService.updateIvt(updateIvtList); } - //更新分配明细数据 ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class) .set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成")) @@ -1129,12 +1063,10 @@ public class OutBillServiceImpl extends ServiceImpl i .eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id()) .ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成")) ); - //添加需要更新的明细标识 dtlSet.add(ioStorInvDis.getIostorinvdtl_id()); - //更新组盘记录表 - mdPbGroupplateMapper.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class) + iMdPbGroupPlateService.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class) .set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库")) .eq(GroupPlate::getPcsn,ioStorInvDis.getPcsn()) .eq(GroupPlate::getMaterial_id,ioStorInvDis.getMaterial_id()) @@ -1200,18 +1132,12 @@ public class OutBillServiceImpl extends ServiceImpl i 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_ADD_CANUSE); - 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); - iMdPbGroupPlateService.updateIvt(updateIvtList); + //库存变动 + StructattrChangeDto changeDto = StructattrChangeDto.builder() + .inv(ioStorInvDis.getIostorinv_id()) + .storagevehicleCode(ioStorInvDis.getStoragevehicle_code()) + .structCode(ioStorInvDis.getStruct_code()).taskType(task.getConfig_code()).inBound(false).build(); + iStructattrService.changeStruct(changeDto); // 查询该明细下是否还有未完成的分配明细 int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class) .eq(IOStorInvDis::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id()) diff --git a/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue b/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue index d3dacbb..2c7bf93 100644 --- a/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue +++ b/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue @@ -324,7 +324,7 @@ export default { this.sects = res.content }) - const area_type = 'NBJ01' + const area_type = 'CKQ' crudPoint.getPointList({ 'region_code': area_type }).then(res => { this.pointList = res }) @@ -356,16 +356,16 @@ export default { }, sectQueryChange(val) { if (val.length === 1) { - this.mstrow.stor_id = val[0] - this.mstrow.sect_id = '' + this.mstrow.stor_code = val[0] + this.mstrow.sect_code = '' } if (val.length === 0) { - this.mstrow.sect_id = '' - this.mstrow.stor_id = '' + this.mstrow.sect_code = '' + this.mstrow.stor_code = '' } if (val.length === 2) { - this.mstrow.stor_id = val[0] - this.mstrow.sect_id = val[1] + this.mstrow.stor_code = val[0] + this.mstrow.sect_code = val[1] } }, tabledisabled(row) { diff --git a/nladmin-ui/src/views/wms/statement/record/curdStructIvtFlow.js b/nladmin-ui/src/views/wms/statement/record/curdStructIvtFlow.js new file mode 100644 index 0000000..c38c0a1 --- /dev/null +++ b/nladmin-ui/src/views/wms/statement/record/curdStructIvtFlow.js @@ -0,0 +1,28 @@ +import request from '@/utils/request' + +export function add(data) { + return request({ + url: 'api/stIvtStructivtflow', + method: 'post', + data + }) +} + +export function del(ids) { + return request({ + url: 'api/stIvtStructivtflow', + method: 'delete', + data: ids + }) +} + +export function edit(data) { + return request({ + url: 'api/stIvtStructivtflow', + method: 'put', + data + }) +} + + +export default {add, edit, del}