diff --git a/ktg-admin/src/main/resources/application-druid.yml b/ktg-admin/src/main/resources/application-druid.yml index 7bf5910..76beb88 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://localhost:5236/CS_HF_WMS?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:dm://localhost:5236/WMS_DJ?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: SYSDBA password: SYSDBA # 从库数据源 diff --git a/ktg-admin/src/main/resources/application.yml b/ktg-admin/src/main/resources/application.yml index bb9acb2..eea2fcf 100644 --- a/ktg-admin/src/main/resources/application.yml +++ b/ktg-admin/src/main/resources/application.yml @@ -46,15 +46,15 @@ spring: messages: # 国际化资源文件路径 basename: i18n/messages - profiles: + profiles: active: druid # 文件上传 servlet: - multipart: - # 单个文件大小 - max-file-size: 10MB - # 设置总上传的文件大小 - max-request-size: 20MB + multipart: + # 单个文件大小 + max-file-size: 10MB + # 设置总上传的文件大小 + max-request-size: 20MB # 服务模块 devtools: restart: @@ -63,13 +63,13 @@ spring: # redis 配置 redis: # 地址 - host: jjml.cc + host: localhost # 端口,默认为6379 - port: 7067 + port: 6379 # 数据库索引 - database: 1 + database: 0 # 密码 - password: redis_HtWAZW + password: # 连接超时时间 timeout: 10s lettuce: @@ -85,27 +85,27 @@ spring: # token配置 token: - # 令牌自定义标识 - header: Authorization - # 令牌密钥 - secret: abcdefghijklmnopqrstuvwxyz - # 令牌有效期(默认30分钟) - expireTime: 30 - + # 令牌自定义标识 + header: Authorization + # 令牌密钥 + secret: abcdefghijklmnopqrstuvwxyz + # 令牌有效期(默认30分钟) + expireTime: 30 + # MyBatis配置 mybatis: - # 搜索指定包别名 - typeAliasesPackage: com.ktg.**.domain - # 配置mapper的扫描,找到所有的mapper.xml映射文件 - mapperLocations: classpath*:mapper/**/*Mapper.xml - # 加载全局的配置文件 - configLocation: classpath:mybatis/mybatis-config.xml + # 搜索指定包别名 + typeAliasesPackage: com.ktg.**.domain + # 配置mapper的扫描,找到所有的mapper.xml映射文件 + mapperLocations: classpath*:mapper/**/*Mapper.xml + # 加载全局的配置文件 + configLocation: classpath:mybatis/mybatis-config.xml # PageHelper分页插件 -pagehelper: +pagehelper: helperDialect: oracle supportMethodsArguments: true - params: count=countSql + params: count=countSql # Swagger配置 swagger: @@ -116,7 +116,7 @@ swagger: pathMapping: /dev-api # 防止XSS攻击 -xss: +xss: # 过滤开关 enabled: true # 排除链接(多个用逗号分隔) @@ -126,7 +126,7 @@ xss: #Mino配置 minio: - url: http://192.168.100.106:9000 - accessKey: mi80JZXet0K0v8sSHzOm - secretKey: 2BaCUhfkFStLHdUfkBRwhshLyKFfbOBG366uakzx - bucketName: ktg-mes + url: http://localhost:9000 + accessKey: seBsDKT7Ss8B4aGiNiNn + secretKey: IYvTR63NZE3EemLfIHGTXu72O7svMEiNHG2OoOWI + bucketName: wms-dj 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 b873937..ccf6231 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 @@ -95,8 +95,8 @@ public class BaseKnifeController extends BaseController map.put("mbbMrlClass", item.getKnifeType()); map.put("wmsAreaCode", item.getAreaCode()); map.put("knifeLife", "100"); - map.put("knifeLifeUser", item.getKnifeLife() == null ? null : String.valueOf(100 - Integer.parseInt(item.getKnifeLife()))); - map.put("knifeLifeLeave", item.getKnifeLife() == null ? null : item.getKnifeLife()); + map.put("knifeLifeUser", item.getKnifeLife() == 0 ? null : String.valueOf(100 - item.getKnifeLife())); + map.put("knifeLifeLeave", item.getKnifeLife() == 0 ? null : String.valueOf(item.getKnifeLife())); map.put("isLocked", item.getIsLocked().toString()); map.put("lockedStartTime", item.getLockedStartTime() == null ? null : item.getLockedStartTime().toString()); map.put("lockedEndTime",item.getLockedEndTime() == null ? null : item.getLockedEndTime().toString()); @@ -126,9 +126,11 @@ public class BaseKnifeController extends BaseController @PostMapping("/open/checkForAlignment") @ResponseBody public AjaxResult checkForAlignment(@RequestBody String json) { + // 检查请求json是否正确 List technologyBomList = JSON.parseArray(json, BaseTechnologyBom.class); if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null) return AjaxResult.error("未检测到工艺bom项"); + // 记录请求数据 technologyBomList.forEach(baseTechnologyBom -> baseTechnologyBomService.insertBaseTechnologyBom(baseTechnologyBom)); // 构建日志 @@ -164,10 +166,11 @@ public class BaseKnifeController extends BaseController return AjaxResult.error("物料台账查询错误", techBom.getKnifeCode()); } + // 查询台账数据 baseKnifeWrapper.setMbbBdMrlId(mdItemTemp.getItemId()); baseKnifeWrapper.setIsLocked(0); List tempList = this.baseKnifeService.selectBaseKnifeList(baseKnifeWrapper); - tempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife())); + tempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife()); AtomicInteger knifeCount = new AtomicInteger(techBom.getKnifeCount()); // 如果台账表中不存在,尝试组刀任务查询 @@ -191,7 +194,7 @@ public class BaseKnifeController extends BaseController baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId()); baseKnifeWrapper.setIsLocked(0); List sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper); - sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife())); + sitmTempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife()); if (sitmTempList.isEmpty()){ operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode()); @@ -229,7 +232,7 @@ public class BaseKnifeController extends BaseController } else { // 将物料填入集合 tempList.forEach(item -> { - if (knifeCount.get() > 0 && Integer.parseInt(item.getKnifeLife()) >= Integer.parseInt(techBom.getExpendLife()) && tempList.size() > countMap.get(item.getKnifeCode())) { + if (knifeCount.get() > 0 && tempList.size() > countMap.get(item.getKnifeCode())) { knifeCount.getAndDecrement(); countMap.put(item.getKnifeCode(), countMap.get(item.getKnifeCode()) + 1); } @@ -245,7 +248,6 @@ public class BaseKnifeController extends BaseController return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode()); } - BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId()); if (!bomRoute.getMbbProduBomList().isEmpty()) { @@ -255,7 +257,7 @@ public class BaseKnifeController extends BaseController baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId()); baseKnifeWrapper.setIsLocked(0); List sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper); - sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife())); + sitmTempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife()); if (sitmTempList.isEmpty()){ operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode()); @@ -304,11 +306,15 @@ public class BaseKnifeController extends BaseController @PostMapping("/open/productionArrangements") @ResponseBody public AjaxResult productionArrangements(@RequestBody String json) { + // 验证请求数据 List technologyBomList = JSON.parseArray(json, BaseTechnologyBom.class); if (technologyBomList.isEmpty() || technologyBomList.size() == 1 && technologyBomList.get(0).getKnifeCode() == null) return AjaxResult.error("未检测到工艺bom项"); technologyBomList.forEach(baseTechnologyBom -> baseTechnologyBomService.insertBaseTechnologyBom(baseTechnologyBom)); + // 记录数据修改 + List baseKnifeOriginList = new ArrayList<>(); + // 构建日志 SysOperLog operLog = new SysOperLog(); operLog.setTitle("生产准备"); @@ -338,6 +344,7 @@ public class BaseKnifeController extends BaseController // 台账表中查询工具 :并记录数量 mdItemTemp = mdItemService.selectMdItemByCode(techBom.getKnifeCode()); if (mdItemTemp == null){ + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("物料台账查询错误:" + techBom.getKnifeCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("物料台账查询错误", techBom.getKnifeCode()); @@ -346,7 +353,7 @@ public class BaseKnifeController extends BaseController baseKnifeWrapper.setMbbBdMrlId(mdItemTemp.getItemId()); baseKnifeWrapper.setIsLocked(0); List tempList = this.baseKnifeService.selectBaseKnifeList(baseKnifeWrapper); - tempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife())); + tempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife()); AtomicInteger knifeCount = new AtomicInteger(techBom.getKnifeCount()); // 如果台账表中不存在,尝试组刀任务查询 @@ -356,12 +363,12 @@ public class BaseKnifeController extends BaseController bomRouteTemp.setMdItemId(mdItemTemp.getItemId()); List bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp); if (bomRouteList.isEmpty()){ + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("Bom头查询错误:" + techBom.getKnifeCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode()); } - BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(bomRouteList.get(0).getBomRouteId()); if (!bomRoute.getMbbProduBomList().isEmpty()) { @@ -371,9 +378,10 @@ public class BaseKnifeController extends BaseController baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId()); baseKnifeWrapper.setIsLocked(0); List sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper); - sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife())); + sitmTempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife()); if (sitmTempList.isEmpty()){ + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode()); @@ -381,6 +389,7 @@ public class BaseKnifeController extends BaseController if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()){ countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get()); } else { + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode()); @@ -391,17 +400,20 @@ public class BaseKnifeController extends BaseController // 判断基础物料是否充足 if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()){ + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("基础物料不足进行组装工具:" + techBom.getKnifeCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode()); } } } else { + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("暂无记录整刀bom项:" + techBom.getKnifeCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode()); } } else { + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("基础物料不足:" + techBom.getKnifeCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("基础物料不足", techBom.getKnifeCode()); @@ -409,9 +421,17 @@ public class BaseKnifeController extends BaseController } else { // 将物料填入集合 tempList.forEach(item -> { - if (knifeCount.get() > 0 && Integer.parseInt(item.getKnifeLife()) >= Integer.parseInt(techBom.getExpendLife()) && tempList.size() > countMap.get(item.getKnifeCode())) { + if (knifeCount.get() > 0 && tempList.size() > countMap.get(item.getKnifeCode())) { + // 更新数量 knifeCount.getAndDecrement(); countMap.put(item.getKnifeCode(), countMap.get(item.getKnifeCode()) + 1); + // 记录源数据然后锁定 + baseKnifeOriginList.add(item); + item.setPlanSheet(techBom.getTechnologyBomId()); + item.setIsLocked(1); + item.setLockedStartTime(techBom.getLockedStartTime()); + item.setLockedEndTime(techBom.getLockedEndTime()); + baseKnifeService.updateBaseKnife(item); } }); if (knifeCount.get() > 0) { @@ -421,6 +441,7 @@ public class BaseKnifeController extends BaseController List bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp); if (bomRouteList.isEmpty()){ + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("Bom头查询错误:" + techBom.getKnifeCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode()); @@ -435,9 +456,10 @@ public class BaseKnifeController extends BaseController baseKnifeWrapper.setMbbBdMrlId(bom.getMdItemId()); baseKnifeWrapper.setIsLocked(0); List sitmTempList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper); - sitmTempList.removeIf(baseKnife -> Integer.parseInt(baseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife())); + sitmTempList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife()); if (sitmTempList.isEmpty()){ + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode()); @@ -445,6 +467,7 @@ public class BaseKnifeController extends BaseController if (sitmTempList.size() >= bom.getStandardDosage() * knifeCount.get()){ countMap.put(sitmTempList.get(0).getKnifeCode(), bom.getStandardDosage() * knifeCount.get()); } else { + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("基础物料不足进行组装工具:" + bom.getMdItemCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode()); @@ -455,17 +478,20 @@ public class BaseKnifeController extends BaseController // 判断基础物料是否充足 if (sitmTempList.size() < countMap.get(sitmTempList.get(0).getKnifeCode()) && countMap.get(sitmTempList.get(0).getKnifeCode()) > bom.getStandardDosage() * knifeCount.get()){ + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("基础物料不足进行组装工具:" + techBom.getKnifeCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("基础物料不足进行组装工具", bom.getMdItemCode()); } } } else { + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("暂无记录整刀bom项:" + techBom.getKnifeCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("暂无记录整刀bom项", techBom.getKnifeCode()); } } else { + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("基础物料不足:" + techBom.getKnifeCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("基础物料不足", techBom.getKnifeCode()); @@ -481,15 +507,15 @@ public class BaseKnifeController extends BaseController List bomList; for (BaseTechnologyBom techBom : technologyBomList){ mdItem = mdItemService.selectMdItemByCode(techBom.getKnifeCode()); - count = techBom.getKnifeCount(); + count = techBom.getKnifeCount() - countMap.get(techBom.getKnifeCode()); // 先从台账表找 baseKnifeWrapper.setMbbBdMrlId(mdItem.getItemId()); baseKnifeWrapper.setIsLocked(0); baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper); - baseKnifeList.removeIf(wmsBaseKnife -> Integer.parseInt(wmsBaseKnife.getKnifeLife()) < Integer.parseInt(techBom.getExpendLife())); + baseKnifeList.removeIf(baseKnife -> baseKnife.getKnifeLife() + baseKnife.getResetCount() * 100 < techBom.getExpendLife()); for (BaseKnife wmsBaseKnife : baseKnifeList){ - if (Integer.parseInt(wmsBaseKnife.getKnifeLife()) >= Integer.parseInt(techBom.getExpendLife()) && count > 0){ + if (wmsBaseKnife.getKnifeLife() >= techBom.getExpendLife() && count > 0){ count--; } } @@ -502,6 +528,7 @@ public class BaseKnifeController extends BaseController List bomRouteList = bomRouteService.selectBomRouteList(bomRouteTemp); if (bomRouteList.isEmpty()){ + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("Bom头查询错误:" + techBom.getKnifeCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("Bom头查询错误", techBom.getKnifeCode()); @@ -509,14 +536,16 @@ public class BaseKnifeController extends BaseController WmsZdTask wmsZdTask = new WmsZdTask(); wmsZdTask.setmProductId(mdItem.getItemId()); - wmsZdTask.setCode(techBom.getProcessCode() + mdItem.getItemCode()); - wmsZdTask.setName(techBom.getProcessName() + "[" + mdItem.getItemName() + "]"); + wmsZdTask.setAttr4(techBom.getTechnologyBomId()); + wmsZdTask.setCode(techBom.getProcessCode()); + wmsZdTask.setName(techBom.getProcessName()); wmsZdTask.setProductIdQty(count); wmsZdTask.setAttr1(bomRouteList.get(0).getBomRouteId()); wmsZdTask.setCreateTime(DateUtils.getNowDate()); zdTaskService.insertWmsZdTask(wmsZdTask); - msg = "生产准备验证成功!已生成组装任务!"; + msg = "生产准备验证成功!缺少物料已生成组装任务!"; } else { + baseKnifeOriginList.forEach(baseKnife -> baseKnifeService.updateBaseKnife(baseKnife)); operLog.setJsonResult("缺少BOM项:" + techBom.getKnifeCode()); operLogService.insertOperlog(operLog); return AjaxResult.error("缺少BOM项", techBom.getKnifeCode()); @@ -539,6 +568,8 @@ public class BaseKnifeController extends BaseController @PutMapping("/zdTask") public AjaxResult zdTask(@RequestBody WmsZdTask zdTask) { + String batchNum = "ZZPC001"; + // 判断物料是否充足 BomRoute bomRoute = bomRouteService.selectBomRouteByBomRouteId(zdTask.getAttr1()); BaseKnife baseKnifeWrapper = new BaseKnife(); @@ -555,8 +586,19 @@ public class BaseKnifeController extends BaseController List wmsOutPlanDetailList = new ArrayList<>(); List baseKnifeListOutPlan = new ArrayList<>(); + // 查询工艺bom + BaseTechnologyBom technologyBom = new BaseTechnologyBom(); + if (zdTask.getAttr4() != null){ + technologyBom = baseTechnologyBomService.selectBaseTechnologyBomByTechnologyBomId(zdTask.getAttr4()); + } else { + technologyBom.setFigureCode(zdTask.getCode()); + technologyBom.setLockedStartTime(DateUtils.getNowDate()); + technologyBom.setLockedEndTime(DateUtils.getNowDate()); + } + + // 出库基础物料 WmsOutPlan outPlan = new WmsOutPlan(); - outPlan.setPlanCode(zdTask.getCode()); + outPlan.setPlanCode(technologyBom.getFigureCode()); outPlan.setWmsBusinessTypeId(12L); outPlan.setPlanState("1"); outPlan.setPlanType("ZDCK"); @@ -567,6 +609,7 @@ public class BaseKnifeController extends BaseController // 锁定物料 Boolean outPlanFlag = true; for (int i = 0; i < zdTask.getProductIdQty(); i++) { + // 构建整刀 BaseKnife baseKnife = new BaseKnife(); MdItem mdItem = mdItemService.selectMdItemById(zdTask.getmProductId()); baseKnife.setMbbBdMrlId(zdTask.getmProductId()); @@ -575,17 +618,20 @@ public class BaseKnifeController extends BaseController baseKnife.setKnifeUnit(mdItem.getUnitName()); baseKnife.setKnifeType(mdItem.getItemTypeName()); baseKnife.setAreaCode(zdTask.getAttr3()); - baseKnife.setSafeStock(mdItem.getMinStock().toString().split("\\.")[0]); + baseKnife.setSafeStock(mdItem.getMinStock()); baseKnife.setStandardQuantity("1"); - baseKnife.setKnifeLife("100"); + baseKnife.setKnifeLife(100); baseKnife.setKnifeFineState(0); - baseKnife.setIsLocked(0); - baseKnife.setPlanSheet(""); + baseKnife.setIsLocked(1); + baseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); + baseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); + baseKnife.setPlanSheet(zdTask.getAttr4()); baseKnife.setItemOrProduct("PRODUCT"); baseKnife.setCreateBy(getUsername()); baseKnife.setCreateTime(DateUtils.getNowDate()); baseKnifeService.insertBaseKnife(baseKnife); + // 锁定物料 int resetCount = 0; for (MbbProduBom mbbProduBom : bomRoute.getMbbProduBomList()) { baseKnifeWrapper.setMbbBdMrlId(mbbProduBom.getMdItemId()); @@ -593,6 +639,7 @@ public class BaseKnifeController extends BaseController baseKnifeList = baseKnifeService.selectBaseKnifeList(baseKnifeWrapper); if (outPlanFlag) { + // 出库任务 MdItem mdItemOutPlan = mdItemService.selectMdItemById(mbbProduBom.getMdItemId()); WmsOutPlanDetail outPlanDetail = new WmsOutPlanDetail(); outPlanDetail.setWmsOutPlanId(outPlan.getWmsOutPlanId()); @@ -602,7 +649,7 @@ public class BaseKnifeController extends BaseController outPlanDetail.setMdItemUnit(mdItemOutPlan.getUnitName()); outPlanDetail.setPlannedQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty()); outPlanDetail.setRealQuantity(mbbProduBom.getStandardDosage() * zdTask.getProductIdQty()); - outPlanDetail.setDetailBatchNum("1"); + outPlanDetail.setDetailBatchNum(batchNum); WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaCode(zdTask.getAttr3()); outPlanDetail.setWmStorageAreaId(wmStorageArea.getAreaId()); outPlanDetail.setWmStorageAreaCode(wmStorageArea.getAreaCode()); @@ -611,13 +658,14 @@ public class BaseKnifeController extends BaseController wmsOutPlanDetailList.add(outPlanDetail); } + // 锁定物料 int bomCount = mbbProduBom.getStandardDosage(); for (BaseKnife wmsBaseKnife : baseKnifeList){ if (bomCount > 0){ wmsBaseKnife.setIsLocked(1); wmsBaseKnife.setKnifeFineState(2); - wmsBaseKnife.setLockedStartTime(new Date()); - wmsBaseKnife.setLockedEndTime(new Date()); + wmsBaseKnife.setLockedStartTime(technologyBom.getLockedStartTime()); + wmsBaseKnife.setLockedEndTime(technologyBom.getLockedEndTime()); wmsBaseKnife.setAttr1(baseKnife.getBaseKnifeId()); baseKnifeListOutPlan.add(wmsBaseKnife); baseKnifeService.updateBaseKnife(wmsBaseKnife); @@ -627,15 +675,18 @@ public class BaseKnifeController extends BaseController } } + // 更新重置次数 outPlanFlag = false; baseKnife.setResetCount(resetCount); baseKnifeService.updateBaseKnife(baseKnife); } + // 出库 int i = 0; for (WmsOutPlanDetail outPlanDetail : wmsOutPlanDetailList){ wmsOutPlanMapper.insertWmsOutPlanDetail(outPlanDetail); + // 出库计划明细 for (int j = 0; j < outPlanDetail.getPlannedQuantity(); j++) { WmsOutPlanDetailEntity wmsOutPlanDetailEntity = new WmsOutPlanDetailEntity(); wmsOutPlanDetailEntity.setBaseKnifeId(baseKnifeListOutPlan.get(i++).getBaseKnifeId()); @@ -645,6 +696,7 @@ public class BaseKnifeController extends BaseController wmsOutPlanDetailEntityMapper.insertWmsOutPlanDetailEntity(wmsOutPlanDetailEntity); } + // 出库任务 WmsOutTask wmsOutTask = new WmsOutTask(); wmsOutTask.setWmsOutPlanId(outPlan.getWmsOutPlanId()); wmsOutTask.setWmsOutPlanCode(outPlan.getPlanCode()); @@ -654,7 +706,7 @@ public class BaseKnifeController extends BaseController wmsOutTask.setTaskNumber(outPlanDetail.getPlannedQuantity()); wmsOutTask.setOutNumber(outPlanDetail.getRealQuantity()); wmsOutTask.setWmStorageAreaId(outPlanDetail.getWmStorageAreaId()); - wmsOutTask.setBatchNum("1"); + wmsOutTask.setBatchNum(batchNum); wmsOutTask.setMdItemId(outPlanDetail.getMdItemId()); wmsOutTask.setMdItemCode(outPlanDetail.getMdItemCode()); wmsOutTask.setMdItemName(outPlanDetail.getMdItemName()); @@ -666,22 +718,23 @@ public class BaseKnifeController extends BaseController wmsOutTaskMapper.insertWmsOutTask(wmsOutTask); } + // 整刀入库计划 Random random = new Random(); WmsInPlan wmsInPlan = new WmsInPlan(); wmsInPlan.setState("1"); wmsInPlan.setSourceType("SGLR"); - wmsInPlan.setWareId("10"); wmsInPlan.setCellCode(zdTask.getAttr3()); - wmsInPlan.setPlanCode(zdTask.getCode() + random.nextInt(100)); + wmsInPlan.setPlanCode(technologyBom.getFigureCode()); wmsInPlan.setRelBillCode("组装单据"); - wmsInPlan.setPlanTypeId("7"); + wmsInPlan.setPlanTypeId("13"); wmsInPlan.setCreateBy(getUsername()); wmsInPlan.setCreateTime(DateUtils.getNowDate()); + // 入库任务明细 List wmsInPlanDetailsList = new ArrayList<>(); WmsInPlanDetails wmsInPlanDetails = new WmsInPlanDetails(); wmsInPlanDetails.setMaterialId(zdTask.getmProductId().toString()); - wmsInPlanDetails.setBatch("10112"); + wmsInPlanDetails.setBatch(batchNum); wmsInPlanDetails.setCellId("1"); wmsInPlanDetails.setQuantity(zdTask.getProductIdQty().toString()); wmsInPlanDetails.setQuantityIn(zdTask.getProductIdQty().toString()); @@ -690,6 +743,7 @@ public class BaseKnifeController extends BaseController wmsInPlan.setWmsInPlanDetailsList(wmsInPlanDetailsList); wmsInPlanService.insertWmsInPlan(wmsInPlan); + // 入库任务 MdItem mdItem = mdItemService.selectMdItemById(zdTask.getmProductId()); WmsInTask wmsInTask = new WmsInTask(); wmsInTask.setPlanInId(wmsInPlan.getPlanId()); @@ -699,15 +753,17 @@ public class BaseKnifeController extends BaseController wmsInTask.setActualInQuantity(zdTask.getProductIdQty()); WmStorageArea wmStorageArea = wmStorageAreaService.selectWmStorageAreaByAreaCode(zdTask.getAttr3()); wmsInTask.setCellTgt(wmStorageArea.getAreaId()); - wmsInTask.setBatch("11011"); + wmsInTask.setBatch(batchNum); wmsInTask.setMaterialId(zdTask.getmProductId().toString()); wmsInTask.setPlanTypeId("9"); wmsInTask.setPlanInStatus("1"); wmsInTaskService.insertWmsInTask(wmsInTask); + // 更新数量 mdItem.setStandardNumber(mdItem.getStandardNumber() + zdTask.getProductIdQty()); mdItemService.updateMdItem(mdItem); + // 更新组装任务 zdTask.setStatus("1"); zdTask.setQtyOk(zdTask.getProductIdQty()); zdTaskService.updateWmsZdTask(zdTask); diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdItemController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdItemController.java index 5f75994..1c9cd4c 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdItemController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdItemController.java @@ -255,10 +255,10 @@ public class MdItemController extends BaseController { mdItem.setItemTypeName(type.getItemTypeName()); mdItem.setItemOrProduct(type.getItemOrProduct()); } - if (StringUtils.isNotNull(mdItem.getSafeStockFlag()) && "N".equals(mdItem.getSafeStockFlag())) { - mdItem.setMinStock(0D); - mdItem.setMaxStock(0D); - } +// if (StringUtils.isNotNull(mdItem.getSafeStockFlag()) && "N".equals(mdItem.getSafeStockFlag())) { +// mdItem.setMinStock(0D); +// mdItem.setMaxStock(0D); +// } MdUnitMeasure measure = mdUnitMeasureService.selectMdUnitByCode(mdItem.getUnitOfMeasure()); if (StringUtils.isNotNull(measure)) { mdItem.setUnitName(measure.getMeasureName()); diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseKnife.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseKnife.java index 9d4bf65..218a64c 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseKnife.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseKnife.java @@ -9,7 +9,7 @@ import java.util.HashMap; import java.util.List; /** - * 工具台账对象 BASE_KNIFE + * 刀具台账对象 BASE_KNIFE * * @author yinjinlu * @date 2024-10-31 @@ -35,15 +35,15 @@ public class BaseKnife extends BaseEntity { private String rfid; /** - * 工具编码 + * 刀具编码 */ - @Excel(name = "工具编码") + @Excel(name = "刀具编码") private String knifeCode; /** - * 工具名称 + * 刀具名称 */ - @Excel(name = "工具名称") + @Excel(name = "刀具名称") private String knifeName; /** @@ -53,16 +53,16 @@ public class BaseKnife extends BaseEntity { private String knifeUnit; /** - * 工具类型(物料分类) + * 刀具类型(物料分类) */ - @Excel(name = "工具类型", readConverterExp = "物料分类") + @Excel(name = "刀具类型", readConverterExp = "物料分类") private String knifeType; /** * 安全库存 */ @Excel(name = "安全库存") - private String safeStock; + private Integer safeStock; /** * 标准数量 @@ -77,15 +77,15 @@ public class BaseKnife extends BaseEntity { private String areaCode; /** - * 工具寿命 + * 刀具寿命 */ - @Excel(name = "工具寿命") - private String knifeLife; + @Excel(name = "刀具寿命") + private Integer knifeLife; /** - * 工具状态 + * 刀具状态 */ - @Excel(name = "工具状态") + @Excel(name = "刀具状态") private Integer knifeFineState; /** @@ -262,7 +262,7 @@ public class BaseKnife extends BaseEntity { this.knifeType = knifeType; } - public String getSafeStock() { + public Integer getSafeStock() { return safeStock; } @@ -274,7 +274,7 @@ public class BaseKnife extends BaseEntity { this.itemOrProduct = itemOrProduct; } - public void setSafeStock(String safeStock) { + public void setSafeStock(Integer safeStock) { this.safeStock = safeStock; } @@ -294,11 +294,11 @@ public class BaseKnife extends BaseEntity { this.areaCode = areaCode; } - public String getKnifeLife() { + public Integer getKnifeLife() { return knifeLife; } - public void setKnifeLife(String knifeLife) { + public void setKnifeLife(Integer knifeLife) { this.knifeLife = knifeLife; } diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseTechnologyBom.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseTechnologyBom.java index 370f094..a2ba55c 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseTechnologyBom.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/BaseTechnologyBom.java @@ -46,7 +46,7 @@ public class BaseTechnologyBom extends BaseEntity /** 消耗定额 */ @Excel(name = "消耗定额") - private String expendLife; + private Integer expendLife; /** 锁定开始时间 */ @Excel(name = "锁定开始时间") @@ -135,12 +135,12 @@ public class BaseTechnologyBom extends BaseEntity { return knifeCount; } - public void setExpendLife(String expendLife) + public void setExpendLife(Integer expendLife) { this.expendLife = expendLife; } - public String getExpendLife() + public Integer getExpendLife() { return expendLife; } diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdItem.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdItem.java index e1ffc00..e3102a1 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdItem.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdItem.java @@ -34,11 +34,11 @@ public class MdItem extends BaseEntity { private String itemTypeName; private String enableFlag; private String safeStockFlag; - private Double minStock; + private Integer minStock; private Double maxStock; private String highValue; private Integer attr1; - private String attr2; + private Integer attr2; private String attr3; private String attr4; @@ -163,11 +163,11 @@ public class MdItem extends BaseEntity { this.safeStockFlag = safeStockFlag; } - public Double getMinStock() { + public Integer getMinStock() { return minStock; } - public void setMinStock(Double minStock) { + public void setMinStock(Integer minStock) { this.minStock = minStock; } @@ -195,11 +195,11 @@ public class MdItem extends BaseEntity { this.attr1 = attr1; } - public String getAttr2() { + public Integer getAttr2() { return attr2; } - public void setAttr2(String attr2) { + public void setAttr2(Integer attr2) { this.attr2 = attr2; } diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInTaskController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInTaskController.java index e5894b2..1a93db2 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInTaskController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmsInTaskController.java @@ -140,9 +140,9 @@ public class WmsInTaskController extends BaseController { baseKnife.setKnifeUnit(mbbBdMrlMitm.getUnitName()); baseKnife.setKnifeType(mbbBdMrlMitm.getItemTypeName()); baseKnife.setAreaCode(wmStorageArea.getAreaCode()); - baseKnife.setSafeStock(mbbBdMrlMitm.getMinStock().toString().split("\\.")[0]); + baseKnife.setSafeStock(mbbBdMrlMitm.getMinStock()); baseKnife.setStandardQuantity("1"); - baseKnife.setKnifeLife("100"); + baseKnife.setKnifeLife(100); baseKnife.setKnifeFineState(0); baseKnife.setPlanSheet(""); baseKnife.setResetCount(mbbBdMrlMitm.getAttr1()); diff --git a/ktg-mes/src/main/resources/mapper/md/BomRouteMapper.xml b/ktg-mes/src/main/resources/mapper/md/BomRouteMapper.xml index 7dcaaf1..69565e3 100644 --- a/ktg-mes/src/main/resources/mapper/md/BomRouteMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/BomRouteMapper.xml @@ -154,9 +154,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into MBB_PRODU_BOM( MBB_PRODU_BOM_ID, BOM_ROUTE_ID, MD_ITEM_ID, MD_ITEM_NAME, MD_ITEM_CODE, MD_ITEM_UNIT, STANDARD_DOSAGE, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME) values + insert into MBB_PRODU_BOM( BOM_ROUTE_ID, MD_ITEM_ID, MD_ITEM_NAME, MD_ITEM_CODE, MD_ITEM_UNIT, STANDARD_DOSAGE, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME) values - ( #{item.mbbProduBomId}, #{item.bomRouteId}, #{item.mdItemId}, #{item.mdItemName}, #{item.mdItemCode}, #{item.mdItemUnit}, #{item.standardDosage}, #{item.remark}, #{item.attr1}, #{item.attr2}, #{item.attr3}, #{item.attr4}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}) + ( #{item.bomRouteId}, #{item.mdItemId}, #{item.mdItemName}, #{item.mdItemCode}, #{item.mdItemUnit}, #{item.standardDosage}, #{item.remark}, #{item.attr1}, #{item.attr2}, #{item.attr3}, #{item.attr4}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}) \ No newline at end of file diff --git a/ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml index 90d4006..db0ad4f 100644 --- a/ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/MdItemMapper.xml @@ -51,6 +51,7 @@ max_stock, high_value, attr1, + attr2, create_by, create_time, remark @@ -183,12 +184,9 @@ enable_flag, safe_stock_flag, - + min_stock, - - max_stock, - high_value, @@ -238,22 +236,19 @@ #{enableFlag}, #{safeStockFlag}, - + #{minStock}, - - #{maxStock}, - #{highValue}, #{remark}, - + #{attr1}, - + #{attr2}, @@ -319,10 +314,10 @@ remark = #{remark}, - + attr1=#{attr1}, - + attr2=#{attr2}, diff --git a/ktg-mes/src/main/resources/mapper/md/WmsOutPlanMapper.xml b/ktg-mes/src/main/resources/mapper/md/WmsOutPlanMapper.xml index f47a689..85e0494 100644 --- a/ktg-mes/src/main/resources/mapper/md/WmsOutPlanMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/WmsOutPlanMapper.xml @@ -344,13 +344,13 @@ - insert into WMS_OUT_PLAN_DETAIL(WMS_OUT_PLAN_DETAIL_ID, WMS_OUT_PLAN_ID, MD_ITEM_ID, MD_ITEM_CODE, MD_ITEM_NAME, + insert into WMS_OUT_PLAN_DETAIL( WMS_OUT_PLAN_ID, MD_ITEM_ID, MD_ITEM_CODE, MD_ITEM_NAME, MD_ITEM_UNIT, PLANNED_QUANTITY, REAL_QUANTITY, DETAIL_BATCH_NUM, WM_STORAGE_AREA_ID, WM_STORAGE_AREA_CODE, WM_STORAGE_AREA_NAME, DETAIL_STATE, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME) values - (#{item.wmsOutPlanDetailId}, #{item.wmsOutPlanId}, #{item.mdItemId}, #{item.mdItemCode}, #{item.mdItemName}, + ( #{item.wmsOutPlanId}, #{item.mdItemId}, #{item.mdItemCode}, #{item.mdItemName}, #{item.mdItemUnit}, #{item.plannedQuantity}, #{item.realQuantity}, #{item.detailBatchNum}, #{item.wmStorageAreaId}, #{item.wmStorageAreaCode}, #{item.wmStorageAreaName}, #{item.detailState}, #{item.remark}, #{item.attr1}, #{item.attr2}, #{item.attr3}, #{item.attr4}, #{item.createBy}, @@ -360,12 +360,12 @@ - insert into WMS_OUT_PLAN_DETAIL(WMS_OUT_PLAN_DETAIL_ID, WMS_OUT_PLAN_ID, MD_ITEM_ID, MD_ITEM_CODE, MD_ITEM_NAME, + insert into WMS_OUT_PLAN_DETAIL( WMS_OUT_PLAN_ID, MD_ITEM_ID, MD_ITEM_CODE, MD_ITEM_NAME, MD_ITEM_UNIT, PLANNED_QUANTITY, REAL_QUANTITY, DETAIL_BATCH_NUM, WM_STORAGE_AREA_ID, WM_STORAGE_AREA_CODE, WM_STORAGE_AREA_NAME, DETAIL_STATE, REMARK, ATTR1, ATTR2, ATTR3, ATTR4, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME) - values (#{wmsOutPlanDetailId}, #{wmsOutPlanId}, #{mdItemId}, #{mdItemCode}, #{mdItemName}, + values ( #{wmsOutPlanId}, #{mdItemId}, #{mdItemCode}, #{mdItemName}, #{mdItemUnit}, #{plannedQuantity}, #{realQuantity}, #{detailBatchNum}, #{wmStorageAreaId}, #{wmStorageAreaCode}, #{wmStorageAreaName}, #{detailState}, #{remark}, #{attr1}, #{attr2}, #{attr3}, #{attr4}, #{createBy},