diff --git a/ktg-admin/src/main/resources/application-druid.yml b/ktg-admin/src/main/resources/application-druid.yml index f013bae..1c3a137 100644 --- a/ktg-admin/src/main/resources/application-druid.yml +++ b/ktg-admin/src/main/resources/application-druid.yml @@ -6,7 +6,7 @@ spring: druid: # 主库数据源 master: - url: jdbc:dm://30.30.2.24:5237/WMS_GJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:dm://30.30.2.24:5237/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:dm://172.16.99.19:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: SYSDBA password: SYSDBA diff --git a/ktg-admin/src/test/WmsInPlanTest.java b/ktg-admin/src/test/WmsInPlanTest.java index e18390d..30dddbf 100644 --- a/ktg-admin/src/test/WmsInPlanTest.java +++ b/ktg-admin/src/test/WmsInPlanTest.java @@ -42,7 +42,7 @@ public class WmsInPlanTest { public void insertWmsInPlan() { WmsInPlan wmsInPlan = new WmsInPlan(); wmsInPlan.setState("0"); - wmsInPlan.setSourceType("SGLR"); + wmsInPlan.setSourceType("ZDSC"); wmsInPlan.setWareId("10"); wmsInPlan.setCellCode("A0089"); wmsInPlan.setRelBillCode("123456"); @@ -60,7 +60,7 @@ public class WmsInPlanTest { WmsInPlan wmsInPlan = new WmsInPlan(); wmsInPlan.setPlanId("41"); wmsInPlan.setState("0"); - wmsInPlan.setSourceType("SGLR"); + wmsInPlan.setSourceType("ZDSC"); wmsInPlan.setWareId("10"); wmsInPlan.setCellCode("A0089"); wmsInPlan.setRelBillCode("123456"); diff --git a/ktg-admin/src/test/WmsOutPlanTest.java b/ktg-admin/src/test/WmsOutPlanTest.java index 2c8f6e4..53de195 100644 --- a/ktg-admin/src/test/WmsOutPlanTest.java +++ b/ktg-admin/src/test/WmsOutPlanTest.java @@ -24,7 +24,7 @@ public class WmsOutPlanTest { WmsOutPlan wmsOutPlan = new WmsOutPlan(); wmsOutPlan.setPlanCode("CKJH202411020949"); wmsOutPlan.setWmsBusinessTypeId(12L); - wmsOutPlan.setPlanType("SGLR"); + wmsOutPlan.setPlanType("ZDSC"); wmsOutPlan.setPlanState("1"); int i = wmsOutPlanService.insertWmsOutPlan(wmsOutPlan); System.out.println(i); @@ -39,7 +39,7 @@ public class WmsOutPlanTest { wmsOutPlan.setWmsOutPlanId(27L); wmsOutPlan.setPlanCode("CKJH202411020949"); wmsOutPlan.setWmsBusinessTypeId(12L); - wmsOutPlan.setPlanType("SGLR"); + wmsOutPlan.setPlanType("ZDSC"); wmsOutPlan.setPlanState("0"); int i = wmsOutPlanService.updateWmsOutPlan(wmsOutPlan); System.out.println(i); diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java index a36a991..21adc14 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/BaseKnifeController.java @@ -890,7 +890,7 @@ public class BaseKnifeController extends BaseController { if (wmsInPlan == null) { WmsInPlan wmsInPlanTemp = new WmsInPlan(); wmsInPlanTemp.setState("1"); - wmsInPlanTemp.setSourceType("SGLR"); + wmsInPlanTemp.setSourceType("ZDSC"); wmsInPlanTemp.setCellCode(zdTask.getAttr3()); wmsInPlanTemp.setPlanCode(zdTask.getAttr4() == null ? zdTask.getCode() : zdTask.getAttr4()); wmsInPlanTemp.setRelBillCode("组装单据"); diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/InventoryBatch.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/InventoryBatch.java index 34b92cf..e7dd776 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/domain/InventoryBatch.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/InventoryBatch.java @@ -70,6 +70,9 @@ public class InventoryBatch { @Excel(name = "入库/出库") private Integer inOrOut; + @Excel(name = "入库/出库明细") + private List> infoList; + /** * 日期 */ @@ -155,4 +158,12 @@ public class InventoryBatch { public void setMdItemNum(Integer mdItemNum) { this.mdItemNum = mdItemNum; } + + public List> getInfoList() { + return infoList; + } + + public void setInfoList(List> infoList) { + this.infoList = infoList; + } } diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/InventoryBatchServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/InventoryBatchServiceImpl.java index 360c566..7abdb73 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/InventoryBatchServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/InventoryBatchServiceImpl.java @@ -4,10 +4,8 @@ import com.ktg.common.utils.DateUtils; import com.ktg.mes.md.domain.*; import com.ktg.mes.md.mapper.*; import com.ktg.mes.md.service.IInventoryBatchService; -import com.ktg.mes.wm.domain.WmsInPlanDetailEntity; -import com.ktg.mes.wm.domain.WmsInTask; -import com.ktg.mes.wm.mapper.WmsInPlanDetailEntityMapper; -import com.ktg.mes.wm.mapper.WmsInTaskMapper; +import com.ktg.mes.wm.domain.*; +import com.ktg.mes.wm.mapper.*; import com.ktg.mes.wm.service.impl.WmsInPlanDetailEntityServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -35,6 +33,21 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService { @Autowired private WmsOutPlanMapper wmsOutPlanMapper; + @Autowired + private WmsInPlanMapper wmsInPlanMapper; + + @Autowired + private WmStorageLocationMapper wmStorageLocationMapper; + + @Autowired + private WmStorageAreaMapper wmStorageAreaMapper; + + @Autowired + private WmWarehouseMapper wmWarehouseMapper; + + @Autowired + private MdItemMapper mdItemMapper; + @Autowired private WmsOutPlanDetailEntityMapper wmsOutPlanDetailEntityMapper; @@ -72,6 +85,7 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService { @Override public List selectInventoryBatchList(InventoryBatch inventoryBatch) { + // 构建出库信息 List result = new ArrayList<>(); WmsOutTask wmsOutTaskWrapper = new WmsOutTask(); @@ -89,6 +103,69 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService { inventoryBatchOut.setInOrOut(0); inventoryBatchOut.setDateTime(outTask.getCreateTime()); inventoryBatchOut.setStatus(outTask.getTaskState()); + + // 获得当前出库计划明细实体列表,并遍历 + List> hashMapList = new ArrayList<>(); + WmsOutPlanDetailEntity entityQuery = new WmsOutPlanDetailEntity(); + entityQuery.setWmsOutPlanDetailId(outTask.getWmsOutPlanDetailId()); + List wmsOutPlanDetailEntityList = wmsOutPlanDetailEntityMapper.selectWmsOutPlanDetailEntityList(entityQuery); + wmsOutPlanDetailEntityList.forEach(outPlanDetailEntity -> { + // 根据出库实例对象获取出库计划明细 + WmsOutPlanDetail wmsOutPlanDetail = this.wmsOutPlanMapper.selectWmsOutPlanDetailById(outPlanDetailEntity.getWmsOutPlanDetailId()); + + // 根据计划明细获得出库计划 + WmsOutPlan wmsOutPlan = this.wmsOutPlanMapper.selectWmsOutPlanByWmsOutPlanId(wmsOutPlanDetail.getWmsOutPlanId()); + + // 根据出库计划获得出库类型 + WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsOutPlan.getWmsBusinessTypeId().toString()); + + // 获得物料 + MdItem mdItem = this.mdItemMapper.selectMdItemById(outTask.getMdItemId()); + + // 设定出库信息数据 + HashMap hashMap = new HashMap<>(); + /* 来自物料 */ + hashMap.put("mdItemId", mdItem.getItemId()); // 物料ID + hashMap.put("mdItemCode", mdItem.getItemCode()); // 物料编码 + hashMap.put("mdItemName", mdItem.getItemName()); // 物料名称 + hashMap.put("mdItemUnit", mdItem.getUnitName()); // 物料单位 + hashMap.put("mdItemKnifeWarn", mdItem.getAttr2()); // 物料名称 + /* 来自出入库计划类型 */ + hashMap.put("planTypeId", wmsBusinessType.getTypeId()); // 出库类型ID + hashMap.put("planTypeCode", wmsBusinessType.getCode()); // 出库类型编码 + hashMap.put("planTypeName", wmsBusinessType.getName()); // 出库类型名称 + /* 来自计划明细 */ + hashMap.put("detailBatchNum", wmsOutPlanDetail.getDetailBatchNum()); // 明细批次 + hashMap.put("wmStorageAreaId", wmsOutPlanDetail.getWmStorageAreaId()); // 库位ID + hashMap.put("wmStorageAreaCode", wmsOutPlanDetail.getWmStorageAreaCode()); // 库位编码 + hashMap.put("wmStorageAreaName", wmsOutPlanDetail.getWmStorageAreaName()); // 库位名称 + hashMap.put("detailStatus", wmsOutPlanDetail.getDetailState()); // 明细状态 + + // 查询库区信息 + WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(wmsOutPlanDetail.getWmStorageAreaId()); + WmStorageLocation wmStorageLocation = wmStorageLocationMapper.selectWmStorageLocationByLocationId(wmStorageArea.getLocationId()); + // 查询库房信息 + WmWarehouse wmWarehouse = wmWarehouseMapper.selectWmWarehouseByWarehouseId(wmStorageLocation.getWarehouseId()); + hashMap.put("wmWarehouseName", wmWarehouse.getWarehouseName()); // 库位名称 + /* 实体 */ + String outTime = null; + if (outPlanDetailEntity.getCreateTime() != null) + outTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(outPlanDetailEntity.getCreateTime()); + hashMap.put("dateTime", outTime); // 出库时间 + hashMap.put("baseKnifeId", outPlanDetailEntity.getBaseKnifeId()); + hashMap.put("planCode", outTask.getWmsOutPlanCode()); +// hashMap.put("knifeLife", nowWmsOutPlanDetailEntity.getKnifeLife()); +// hashMap.put("resetCount", nowWmsOutPlanDetailEntity.getResetCount()); + + // 寿命预警 + if ("PRODUCT".equals(outPlanDetailEntity.getItemOrProduct()) && outPlanDetailEntity.getKnifeLife() <= mdItem.getAttr2()) + hashMap.put("knifeWarning", true); + else + hashMap.put("knifeWarning", false); + hashMapList.add(hashMap); + }); + // 注入出库信息对象 + inventoryBatchOut.setInfoList(hashMapList); result.add(inventoryBatchOut); }); @@ -108,6 +185,61 @@ public class InventoryBatchServiceImpl implements IInventoryBatchService { inventoryBatchIn.setInOrOut(1); inventoryBatchIn.setDateTime(inTask.getCreateTime()); inventoryBatchIn.setStatus("1"); + + // 获取当期入库明细数据 + List> hashMapList = new ArrayList<>(); + WmsInPlanDetailEntity entityQuery = new WmsInPlanDetailEntity(); + entityQuery.setPlanDetailsId(inTask.getDetailInId()); + List wmsInPlanDetailEntityList = wmsInPlanDetailEntityMapper.selectWmsInPlanDetailEntityList(entityQuery); + wmsInPlanDetailEntityList.forEach(inPlanDetailEntity -> { + // 根据出库实例对象获取出库计划明细 + WmsInPlanDetails wmsInPlanDetails = this.wmsInPlanMapper.selectWmsInPlanDetailById(inPlanDetailEntity.getPlanDetailsId()); + + // 根据计划明细获得出库计划 + WmsInPlan wmsInPlan = this.wmsInPlanMapper.selectWmsInPlanByPlanId(wmsInPlanDetails.getPlanId().toString()); + + // 根据出库计划获得出库类型 + WmsBusinessType wmsBusinessType = this.wmsBusinessTypeMapper.selectWmsBusinessTypeByTypeId(wmsInPlan.getBusinessTypeId()); + + // 获得物料 + MdItem mdItem = this.mdItemMapper.selectMdItemById(Long.parseLong(inTask.getMaterialId())); + + // 设定出库信息数据 + HashMap hashMap = new HashMap<>(); + /* 来自物料 */ + hashMap.put("mdItemId", mdItem.getItemId()); // 物料ID + hashMap.put("mdItemCode", mdItem.getItemCode()); // 物料编码 + hashMap.put("mdItemName", mdItem.getItemName()); // 物料名称 + hashMap.put("mdItemUnit", mdItem.getUnitName()); // 物料单位 + hashMap.put("mdItemKnifeWarn", mdItem.getAttr2()); // 物料名称 + /* 来自出入库计划类型 */ + hashMap.put("planTypeId", wmsBusinessType.getTypeId()); // 出库类型ID + hashMap.put("planTypeCode", wmsBusinessType.getCode()); // 出库类型编码 + hashMap.put("planTypeName", wmsBusinessType.getName()); // 出库类型名称 + /* 来自计划明细 */ + hashMap.put("detailBatchNum", wmsInPlanDetails.getBatch()); // 明细批次 + hashMap.put("wmStorageAreaId", wmsInPlanDetails.getCellId()); // 库位ID + hashMap.put("wmStorageAreaName", inTask.getCellName()); // 库位名称 + hashMap.put("detailStatus", wmsInPlanDetails.getPlanInStatus()); // 明细状态 + + // 查询库区信息 + WmStorageArea wmStorageArea = wmStorageAreaMapper.selectWmStorageAreaByAreaId(wmsInPlanDetails.getCellId()); + WmStorageLocation wmStorageLocation = wmStorageLocationMapper.selectWmStorageLocationByLocationId(wmStorageArea.getLocationId()); + // 查询库房信息 + WmWarehouse wmWarehouse = wmWarehouseMapper.selectWmWarehouseByWarehouseId(wmStorageLocation.getWarehouseId()); + hashMap.put("wmWarehouseName", wmWarehouse.getWarehouseName()); // 库位名称 + /* 实体 */ + String outTime = null; + if (wmsInPlanDetails.getCreateTime() != null) + outTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(wmsInPlanDetails.getCreateTime()); + hashMap.put("dateTime", outTime); // 出库时间 + hashMap.put("baseKnifeId", inPlanDetailEntity.getKnifeId()); + hashMap.put("planCode", inTask.getPlanInCode()); +// hashMap.put("knifeLife", nowWmsOutPlanDetailEntity.getKnifeLife()); +// hashMap.put("resetCount", nowWmsOutPlanDetailEntity.getResetCount()); + hashMapList.add(hashMap); + }); + result.add(inventoryBatchIn); }); diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsOutPlanServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsOutPlanServiceImpl.java index eba2f13..5ace0cc 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsOutPlanServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/WmsOutPlanServiceImpl.java @@ -293,7 +293,7 @@ public class WmsOutPlanServiceImpl implements IWmsOutPlanService { wmsOutPlan.setPlanCode(Long.toString(System.currentTimeMillis(), 32).toUpperCase(Locale.ROOT)); wmsOutPlan.setWmsBusinessTypeId(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId() != null ? Long.parseLong(this.wmsBusinessTypeMapper.selectWmsBusinessTypeByCode("CK04").getTypeId()) : 14L); wmsOutPlan.setPlanState("1"); - wmsOutPlan.setPlanType("SGLR"); + wmsOutPlan.setPlanType("ZDSC"); wmsOutPlan.setRemark("一键清退无寿命物品"); wmsOutPlan.setCreateBy(username); wmsOutPlan.setCreateTime(new Date()); diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsInPlanMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsInPlanMapper.java index b5d9a65..33b3ead 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsInPlanMapper.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmsInPlanMapper.java @@ -93,4 +93,6 @@ public interface WmsInPlanMapper * @return 结果 */ public Boolean isDuplicatePlanCode(String planCode); + + WmsInPlanDetails selectWmsInPlanDetailById(Long planDetailsId); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java index 3b34e2c..8f11956 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmsZdTaskServiceImpl.java @@ -381,7 +381,7 @@ public class WmsZdTaskServiceImpl implements IWmsZdTaskService if (wmsInPlan == null) { WmsInPlan wmsInPlanTemp = new WmsInPlan(); wmsInPlanTemp.setState("1"); - wmsInPlanTemp.setSourceType("SGLR"); + wmsInPlanTemp.setSourceType("ZDSC"); wmsInPlanTemp.setCellCode(wmStorageArea.getAreaCode()); wmsInPlanTemp.setPlanCode(zdTask.getCode()); wmsInPlanTemp.setRelBillCode("组装单据"); diff --git a/ktg-mes/src/main/resources/mapper/wm/WmsInPlanMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmsInPlanMapper.xml index bb1025f..b70c205 100644 --- a/ktg-mes/src/main/resources/mapper/wm/WmsInPlanMapper.xml +++ b/ktg-mes/src/main/resources/mapper/wm/WmsInPlanMapper.xml @@ -361,4 +361,10 @@ FROM WMS_IN_PLAN WHERE PLAN_CODE = #{value} + + \ No newline at end of file