diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanLog.java b/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanLog.java new file mode 100644 index 000000000..3d82c433b --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/autotask/CleanLog.java @@ -0,0 +1,26 @@ +package org.nl.wms.autotask; + +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.modules.system.service.ParamService; +import org.nl.modules.wql.core.bean.WQLObject; +import org.springframework.stereotype.Component; + +/** + * 自动清除日志(操作日志、异常日志)数据 + */ +@Slf4j +@Component +@RequiredArgsConstructor +public class CleanLog { + private final ParamService paramService; + + public void run(){ + //delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10; + WQLObject logTab = WQLObject.getWQLObject("sys_log"); + int days = Integer.parseInt(paramService.findByCode("log_day").getValue()); + logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))"); + log.info("自动清理日志执行成功...!"); + } + +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/WmsToAcsController.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/WmsToAcsController.java index 4b72d308b..51816c776 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/WmsToAcsController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/WmsToAcsController.java @@ -79,4 +79,13 @@ public class WmsToAcsController { } + @PostMapping("/updateTask") + @Log("WMS向acs发送更新任务状态") + @ApiOperation("WMS向acs发送更新任务状态") + public ResponseEntity updateTask(@RequestBody Map whereJson) { + JSONArray arr = JSONArray.parseArray(JSON.toJSONString(whereJson.get("data"))); + return new ResponseEntity<>(wmsToAcsService.updateTask(arr), HttpStatus.OK); + } + + } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java index 3735345de..5fc098b00 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java @@ -55,4 +55,11 @@ public interface WmsToAcsService { * @return */ JSONObject getPointStatus(JSONArray whereJson); + + /** + * 更新任务状态 + * @param arr / + * @return JSONObject + */ + JSONObject updateTask(JSONArray arr); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java index 9c28278bb..5a611446d 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java @@ -54,4 +54,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { return AcsUtil.notifyAcs(api, whereJson); } + @Override + public JSONObject updateTask(JSONArray whereJson) { + String api = "api/wms/updateTask"; + return AcsUtil.notifyAcs(api, whereJson); + } + } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/LmsToMesServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/LmsToMesServiceImpl.java index 10920f7b5..0ca7fbb8f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/LmsToMesServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/LmsToMesServiceImpl.java @@ -21,7 +21,7 @@ import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor @Slf4j -public class LmsToMesServiceImpl implements LmsToMesService { +public class LmsToMesServiceImpl implements LmsToMesService { /** diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java index 26b0a9491..cca5e7b13 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java @@ -12,12 +12,14 @@ import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl; import org.nl.wms.ext.mes.service.MesToLmsService; import org.nl.wms.log.LokiLog; import org.nl.wms.log.LokiLogType; import org.nl.wms.sch.manage.AbstractAcsTask; import org.nl.wms.sch.tasks.CoolCutTask; import org.nl.wms.st.inbill.service.CheckOutBillService; +import org.nl.wms.pda.mps.service.impl.BakingServiceImpl; import org.springframework.stereotype.Service; import sun.security.krb5.internal.crypto.Des; @@ -174,13 +176,48 @@ public class MesToLmsServiceImpl implements MesToLmsService { @Override public JSONObject momRollFoilComplete(JSONObject param) { log.info("momRollFoilComplete接口输入参数为:-------------------" + param.toString()); - JSONObject result = new JSONObject(); - result.put("RTYPE", "S"); - result.put("RTMSG", "操作成功!"); - result.put("RTOAL", 1); - result.put("RTDAT", null); - System.out.println(result); + + WQLObject sbTab = WQLObject.getWQLObject("st_ivt_sbpointivt"); // 生箔点位库存表 + WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 + + try { + String containerName = param.getString("ContainerName"); + String resourceName = param.getString("ResourceName"); + if (ObjectUtil.isEmpty(resourceName)) throw new BadRequestException("机台编码不能为空"); + if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空"); + + JSONObject jsonSb = sbTab.query("ext_code = '" + resourceName + "' and is_used = '1'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位设备不存在"); + + // 下发ACS更改任务状态 + JSONArray paramArr = new JSONArray(); + JSONObject json = new JSONObject(); + json.put("device_code", jsonSb.getString("point_code")); + json.put("option ", "2"); + paramArr.add(json); + + JSONObject resultAcs = new WmsToAcsServiceImpl().updateTask(paramArr); + if (!StrUtil.equals(resultAcs.getString("status"), "200")) { + throw new BadRequestException(resultAcs.getString("message ")); + } + + // 更新工单状态 + JSONObject jsonRaw = rawTab.query("container_name = '" + containerName + "'").uniqueResult(0); + jsonRaw.put("status", "03"); + rawTab.update(jsonRaw); + + result.put("RTYPE", "S"); + result.put("RTMSG", "操作成功!"); + result.put("RTOAL", 1); + result.put("RTDAT", resultAcs); + } catch (Exception e) { + result.put("RTYPE", "1"); + result.put("RTMSG", "操作失败!"+e.getMessage()); + result.put("RTOAL", 1); + result.put("RTDAT", null); + } + log.info("momRollFoilComplete接口输出参数为:-------------------" + result.toString()); return result; } @@ -194,13 +231,74 @@ public class MesToLmsServiceImpl implements MesToLmsService { @Override public JSONObject momRollBakeNextSpecTransfer(JSONObject param) { log.info("momRollBakeNextSpecTransfer接口输入参数为:-------------------" + param.toString()); - JSONObject result = new JSONObject(); - result.put("RTYPE", "S"); - result.put("RTMSG", "操作成功!"); - result.put("RTOAL", 1); - result.put("RTDAT", null); - System.out.println(result); + + WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表 + WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表 + + JSONObject jsonParam = new JSONObject(); + try { + String containerName = param.getString("ContainerName"); // 母卷号 + String nextSpec = param.getString("NextSpec"); // 下工序:1-入烘箱,2-入冷却 + String bakingTemperature = param.getString("BakingTemperature"); // 温度 + String bakingTimer = param.getString("BakingTimer"); // 烘烤时间 + + if (ObjectUtil.isEmpty(containerName)) throw new BadRequestException("母卷号不能为空"); + if (ObjectUtil.isEmpty(nextSpec)) throw new BadRequestException("下工序不能为空"); + + if (StrUtil.equals(nextSpec, "1")) { + /* + * 入烘箱 + */ + if (ObjectUtil.isEmpty(bakingTemperature)) throw new BadRequestException("温度不能为空"); + if (ObjectUtil.isEmpty(bakingTimer)) throw new BadRequestException("烘烤时间不能为空"); + + JSONObject jsonCoolIvt = coolIvtTab.query("container_name = '" + containerName + "' and full_point_status = '02' and cool_ivt_status <> '03'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonCoolIvt)) throw new BadRequestException("母卷不存在或已烘烤完成"); + + // 调用接口输入参数 + jsonParam.put("option", "1"); + jsonParam.put("container_name", containerName); + jsonParam.put("temperature", bakingTemperature); + jsonParam.put("hours", bakingTimer); + jsonParam.put("point_code", jsonCoolIvt.getString("full_point_code")); + + // 调用手持接口 + BakingServiceImpl bakingService = new BakingServiceImpl(); + bakingService.ovenInAndOut(jsonParam); + + result.put("RTYPE", "S"); + result.put("RTMSG", "操作成功!"); + result.put("RTOAL", 1); + result.put("RTDAT", null); + } else { + /* + * 入冷却区 + */ + JSONObject jsonPoint = pointTab.query("material_code = '" + containerName + "' and is_delete = '0' and is_used = '1'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonPoint)) throw new BadRequestException("母卷不存在"); + + // 调用接口输入参数 + jsonParam.put("point_code", jsonPoint.getString("point_code")); + jsonParam.put("container_name", containerName); + + // 调用手持接口 + BakingServiceImpl bakingService = new BakingServiceImpl(); + bakingService.inCoolIvt(jsonParam); + + result.put("RTYPE", "S"); + result.put("RTMSG", "操作成功!"); + result.put("RTOAL", 1); + result.put("RTDAT", null); + } + } catch (Exception e) { + result.put("RTYPE", "1"); + result.put("RTMSG", "操作失败!"+e.getMessage()); + result.put("RTOAL", 1); + result.put("RTDAT", null); + } + + log.info("momRollBakeNextSpecTransfer接口输出参数为:-------------------" + result.toString()); return result; } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/RawFoilController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/RawFoilController.java index 51122feeb..730720912 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/RawFoilController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/RawFoilController.java @@ -48,7 +48,6 @@ public class RawFoilController { @Log("呼叫空轴") @ApiOperation("呼叫空轴") public ResponseEntity needEmptyAxis(@RequestBody JSONObject whereJson) { - return new ResponseEntity<>(rawFoilService.needEmptyAxis(whereJson), HttpStatus.OK); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/BakingService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/BakingService.java index 2131c05e3..ef53194c7 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/BakingService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/BakingService.java @@ -12,7 +12,7 @@ public interface BakingService { JSONObject ovenInAndOut(JSONObject whereJson); /** - * 烘箱出入 + * 入冷却 * @param whereJson / * @return JSONObject */ diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/RawFoilService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/RawFoilService.java index dc1251681..3d4925524 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/RawFoilService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/RawFoilService.java @@ -26,14 +26,14 @@ public interface RawFoilService { JSONObject queryRawFoilList(JSONObject whereJson); /** - * 确认下卷 + * 呼叫空卷轴 * @param whereJson / * @return JSONObject */ JSONObject needEmptyAxis(JSONObject whereJson); /** - * 查询生箔工单 + * 下卷确认 * @param whereJson / * @return JSONObject */ diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java index 4fb6b9900..7835186e1 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java @@ -53,6 +53,8 @@ public class BakingServiceImpl implements BakingService { WQLObject hosIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烤箱区点位库存表 WQLObject hosReMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烤箱区出入主表 WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表 + WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 + WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表 if (StrUtil.equals(option, "1")) { @@ -100,15 +102,6 @@ public class BakingServiceImpl implements BakingService { hotParam.put("temperature", temperature); hotParam.put("oven_time", hours); this.createHotDtl(hotParam); - - // 4.下发任务 - /*JSONObject jsonObject = inHotTask.renotifyAcs(task_id); - if (StrUtil.equals(jsonObject.getString("status"), "200")) { - // 成功返回 更新任务状态 - JSONObject jsonTask = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0); - jsonTask.put("task_status", "05"); - taskTab.update(jsonTask); - }*/ } else { /* * 冷却区入烘箱 @@ -169,7 +162,7 @@ public class BakingServiceImpl implements BakingService { if (ObjectUtil.isEmpty(point_code2)) throw new BadRequestException("没有空暂存位"); // 查询烘箱对应的空位 - JSONObject jsonHotIvt = hosIvtTab.query("product_area = '" + product_area + "' and temperature = '" + temperature + "' and point_location = '" + map.getString("point_location") + "' and is_used = '1' and point_status = '00' order by point_code ASC").uniqueResult(0); + JSONObject jsonHotIvt = hosIvtTab.query("product_area = '" + product_area + "' and temperature = '" + temperature + "' and point_location = '" + map.getString("point_location") + "' and is_used = '1' and point_status = '01' order by point_code ASC").uniqueResult(0); if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位"); // 3.创建冷却区 --> 烘烤区任务 @@ -184,9 +177,17 @@ public class BakingServiceImpl implements BakingService { String task_id = inHotTask.createTask(param); // 4.插入烘箱区出入主表 和 明细表 + JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); + JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("物料不存在"); + JSONObject hotParam = new JSONObject(); hotParam.put("container_name", container_name); hotParam.put("task_id", task_id); + hotParam.put("workorder_id", jsonRaw.getString("workorder_id")); + hotParam.put("material_id", jsonMater.get("material_id")); + hotParam.put("qty", jsonMater.get("productin_qty")); + hotParam.put("qty_unit_id", jsonMater.get("base_unit_id")); // 创建主表 String iostorinv_id = this.createHotIoMst(hotParam); // 创建明细 @@ -198,18 +199,18 @@ public class BakingServiceImpl implements BakingService { this.createHotDtl(hotParam); // 生成冷却区出入表 - Long currentUserId = SecurityUtils.getCurrentUserId(); - String currentUsername = SecurityUtils.getCurrentUsername(); + Long currentUserId = 2L; + String currentUsername = "mes用户"; JSONObject jsonCool = new JSONObject(); jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE")); jsonCool.put("io_type", "1"); - jsonCool.put("material_id", ""); - jsonCool.put("pcsn", ""); + jsonCool.put("material_id", jsonMater.getString("material_id")); + jsonCool.put("pcsn", container_name); jsonCool.put("bill_status", "10"); jsonCool.put("task_id", task_id); - jsonCool.put("qty_unit_id", "1"); + jsonCool.put("qty_unit_id", jsonMater.getString("base_unit_id")); jsonCool.put("start_point_code", point_code1); jsonCool.put("end_point_code", jsonHotIvt.getString("point_code")); jsonCool.put("create_mode", "03"); @@ -223,19 +224,6 @@ public class BakingServiceImpl implements BakingService { jsonCool.put("confirm_optname", currentUsername); jsonCool.put("confirm_time", DateUtil.now()); coolTab.insert(jsonCool); - - // 5.下发任务 - /* JSONObject jsonObject = inHotTask.renotifyAcs(task_id); - if (StrUtil.equals(jsonObject.getString("status"), "200")) { - // 成功返回 更新任务状态 - JSONObject jsonTask = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0); - jsonTask.put("task_status", "05"); - taskTab.update(jsonTask); - - // 更新烘烤区主表状态为执行中 - JSONObject jsonHotMst = hosReMstTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); - jsonHotMst.put("bill_status", "40"); - }*/ } } else if (StrUtil.equals(option, "2")) { // 出箱 @@ -287,6 +275,7 @@ public class BakingServiceImpl implements BakingService { JSONObject param = new JSONObject(); param.put("point_code1", point_code1); param.put("point_code2", point_code2); + param.put("material_code", jsonHotIvt.getString("container_name")); OutHotTask outHotTask = new OutHotTask(); String task_id = outHotTask.createTask(param); @@ -300,16 +289,8 @@ public class BakingServiceImpl implements BakingService { hotParam.put("iostorinv_id", jsonHotReMst.getString("iostorinv_id")); hotParam.put("start_point_code", point_code1); hotParam.put("next_point_code", point_code2); + hotParam.put("temperature", jsonHotIvt.getString("temperature")); this.createHotDtl(hotParam); - - // 5.下发任务 - /* JSONObject jsonObject = outHotTask.immediateNotifyAcs(); - if (StrUtil.equals(jsonObject.getString("status"), "200")) { - // 成功返回 更新任务状态 - JSONObject jsonTask = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0); - jsonTask.put("task_status", "05"); - taskTab.update(jsonTask); - }*/ } JSONObject result = new JSONObject(); result.put("message", "操作成功!"); @@ -319,10 +300,12 @@ public class BakingServiceImpl implements BakingService { @Override @Transactional public JSONObject inCoolIvt(JSONObject whereJson) { - WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); - WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); - WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); + WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位点 + WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 + WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱出入主表 WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表 + WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 + WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表 String point_code1 = whereJson.getString("point_code"); // 暂存位:起点 @@ -370,17 +353,21 @@ public class BakingServiceImpl implements BakingService { this.createHotDtl(hotParam); // 生成冷却区出入表 - Long currentUserId = SecurityUtils.getCurrentUserId(); - String currentUsername = SecurityUtils.getCurrentUsername(); + Long currentUserId = 2L; + String currentUsername = "mes用户"; + + JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); + JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("物料不存在"); JSONObject jsonCool = new JSONObject(); jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE")); jsonCool.put("io_type", "0"); - jsonCool.put("material_id", ""); - jsonCool.put("pcsn", ""); + jsonCool.put("material_id", jsonMater.getString("material_id")); + jsonCool.put("pcsn", container_name); jsonCool.put("bill_status", "10"); - jsonCool.put("qty_unit_id", "1"); + jsonCool.put("qty_unit_id", jsonMater.get("base_unit_id")); jsonCool.put("task_id", task_id); jsonCool.put("start_point_code", point_code1); jsonCool.put("end_point_code", jsonCooIvt.getString("full_point_code")); @@ -396,15 +383,6 @@ public class BakingServiceImpl implements BakingService { jsonCool.put("confirm_time", DateUtil.now()); coolTab.insert(jsonCool); - // 5.下发任务 - /* JSONObject jsonObject = inCoolIvtTask.immediateNotifyAcs(); - if (StrUtil.equals(jsonObject.getString("status"), "200")) { - // 成功返回 更新任务状态 - JSONObject jsonTask = taskTab.query("task_id ='" + task_id + "'").uniqueResult(0); - jsonTask.put("task_status", "05"); - taskTab.update(jsonTask); - }*/ - JSONObject result = new JSONObject(); result.put("message", "操作成功!"); return result; @@ -416,22 +394,20 @@ public class BakingServiceImpl implements BakingService { * 创建烘箱区出入主表 */ WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱区出入主表 - WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表 - - JSONObject jsonCoolIvt = coolTab.query("container_name = '" + param.getString("container_name") + "'").uniqueResult(0); JSONObject jsonHotMst = new JSONObject(); jsonHotMst.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); jsonHotMst.put("bill_code", CodeUtil.getNewCode("HOT_BILL_CODE")); jsonHotMst.put("container_name", param.getString("container_name")); - jsonHotMst.put("workorder_id", jsonCoolIvt.getString("workorder_id")); - jsonHotMst.put("qty", jsonCoolIvt.getString("ivt_qty")); + jsonHotMst.put("workorder_id", param.getString("workorder_id")); + jsonHotMst.put("material_id", param.get("material_id")); + jsonHotMst.put("qty", param.getString("qty")); jsonHotMst.put("bill_status", "10"); - jsonHotMst.put("qty_unit_id", "1"); + jsonHotMst.put("qty_unit_id", param.getString("qty_unit_id")); jsonHotMst.put("create_mode", "03"); jsonHotMst.put("task_id", param.getString("task_id")); - jsonHotMst.put("create_id", SecurityUtils.getCurrentUserId()); - jsonHotMst.put("create_name", SecurityUtils.getCurrentUsername()); + jsonHotMst.put("create_id", 2); + jsonHotMst.put("create_name", "mes用户"); jsonHotMst.put("create_time", DateUtil.now()); hotMstTab.insert(jsonHotMst); @@ -454,8 +430,8 @@ public class BakingServiceImpl implements BakingService { jsonHotDtl.put("oven_time", param.getString("oven_time")); jsonHotDtl.put("task_type", "1"); jsonHotDtl.put("task_id", param.getString("task_id")); - jsonHotDtl.put("create_id", SecurityUtils.getCurrentUserId()); - jsonHotDtl.put("create_name", SecurityUtils.getCurrentUsername()); + jsonHotDtl.put("create_id", 2); + jsonHotDtl.put("create_name", "mes用户"); jsonHotDtl.put("create_time", DateUtil.now()); jsonHotDtl.put("dtl_status", "10"); hotDtlTab.insert(jsonHotDtl); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java index 11b5589be..b9ebab32e 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java @@ -16,6 +16,7 @@ import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.WQL; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.wms.ext.acs.service.AcsToWmsService; +import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl; import org.nl.wms.pda.mps.service.RawFoilService; import org.nl.wms.sch.service.PointService; import org.nl.wms.sch.tasks.CallEmpReelTask; @@ -122,23 +123,30 @@ public class RawFoilServiceImpl implements RawFoilService { @Transactional(rollbackFor = Exception.class) public JSONObject needEmptyAxis(JSONObject whereJson) { - WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); - WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); + WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 + WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 + WQLObject regionTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表 + WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料信息表 + WQLObject sbTab = WQLObject.getWQLObject("ST_IVT_SbPointIvt"); // 生箔点位库存表 + JSONObject raw_jo = whereJson.getJSONObject("raw_jo"); JSONObject jsonRaw = rawTab.query("workorder_id = '" + raw_jo.getString("workorder_id") + "'").uniqueResult(0); if (!StrUtil.equals(jsonRaw.getString("status"), "01")) throw new BadRequestException("工单状态不为开始"); + JSONObject jsonSb = sbTab.query("ext_code = '" + jsonRaw.getString("resource_name") + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("生箔点位不存在"); + String start_pint_code = ""; // 2.根据就近原则查对应空卷抽 JSONObject map = new JSONObject(); map.put("flag", "1"); - map.put("product_area", raw_jo.getString("product_area")); - map.put("point_location", raw_jo.getString("point_location")); + map.put("product_area", jsonSb.getString("product_area")); + map.put("point_location", jsonSb.getString("point_location")); JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0); // 3.如果没找到则继续找下一节点 if (ObjectUtil.isEmpty(jsonIvt)) { - String point_location = raw_jo.getString("point_location"); + String point_location = jsonSb.getString("point_location"); if (StrUtil.equals(point_location, "0")) map.put("point_location", "1"); if (StrUtil.equals(point_location, "1")) map.put("point_location", "0"); JSONObject jsonIvt_tow = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0); @@ -154,12 +162,12 @@ public class RawFoilServiceImpl implements RawFoilService { String point_code4= ""; JSONObject map4 = new JSONObject(); map4.put("flag", "2"); - map4.put("product_area", raw_jo.getString("product_area")); - map4.put("point_location", raw_jo.getString("point_location")); + map4.put("product_area", jsonSb.getString("product_area")); + map4.put("point_location", jsonSb.getString("point_location")); JSONObject jsonIvt4 = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map4).process().uniqueResult(0); // 3.如果没找到则继续找下一节点 if (ObjectUtil.isEmpty(jsonIvt4)) { - String point_location = raw_jo.getString("point_location"); + String point_location = jsonSb.getString("point_location"); if (StrUtil.equals(point_location, "0")) { map4.put("point_location", "1"); } @@ -178,8 +186,8 @@ public class RawFoilServiceImpl implements RawFoilService { // 起点和终点确定 生成任务 JSONObject param = new JSONObject(); param.put("point_code1", start_pint_code); - param.put("point_code2", jsonRaw.getString("point_code")); - param.put("point_code3", jsonRaw.getString("point_code")); + param.put("point_code2", jsonSb.getString("point_code")); + param.put("point_code3", jsonSb.getString("point_code")); param.put("point_code4", point_code4); param.put("task_type", "010101"); param.put("material_code", jsonRaw.getString("container_name")); @@ -187,6 +195,33 @@ public class RawFoilServiceImpl implements RawFoilService { CallEmpReelTask callEmpReelTask = new CallEmpReelTask(); String task_id = callEmpReelTask.createTask(param); + // 插入入库单 + Long currentUserId = SecurityUtils.getCurrentUserId(); + String currentUsername = SecurityUtils.getCurrentUsername(); + + JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("产品不存在"); + + JSONObject jsonRegion = new JSONObject(); + jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); + jsonRegion.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE")); + jsonRegion.put("io_type", "1"); + jsonRegion.put("material_id", jsonMater.getString("material_id")); + jsonRegion.put("pcsn", jsonRaw.getString("container_name")); + jsonRegion.put("vehicle_code", ""); + jsonRegion.put("qty", jsonRaw.getString("productin_qty")); + jsonRegion.put("qty_unit_id", jsonMater.get("base_unit_id")); + jsonRegion.put("bill_status", "10"); + jsonRegion.put("start_point_code", jsonSb.getString("point_code")); + jsonRegion.put("end_point_code", point_code4); + jsonRegion.put("cust_id", ""); + jsonRegion.put("create_mode", "03"); + jsonRegion.put("task_id", task_id); + jsonRegion.put("create_id", currentUserId); + jsonRegion.put("create_name", currentUsername); + jsonRegion.put("create_time", DateUtil.now()); + regionTab.insert(jsonRegion); + // 更新工单状态 jsonRaw.put("status", "02"); rawTab.update(jsonRaw); @@ -198,7 +233,8 @@ public class RawFoilServiceImpl implements RawFoilService { @Override public void confirmBlanking(JSONObject whereJson) { - WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); + WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单 + WQLObject sbTab = WQLObject.getWQLObject("st_ivt_sbpointivt"); // 生箔点位库存表 JSONObject raw_jo = whereJson.getJSONObject("raw_jo"); JSONObject jsonRaw = rawTab.query("workorder_id = '" + raw_jo.getString("workorder_id") + "'").uniqueResult(0); @@ -207,9 +243,25 @@ public class RawFoilServiceImpl implements RawFoilService { //查询该母卷号对应的任务 String container_name = whereJson.getString("container_name"); - JSONObject task_jo = WQLObject.getWQLObject("SCH_BASE_Task").query("material_code = '"+container_name+"'").uniqueResult(0); + JSONObject task_jo = WQLObject.getWQLObject("SCH_BASE_Task").query("material_code = '"+container_name+"' and task_status <> '07'").uniqueResult(0); + + // 查询生箔点位库存表 + JSONObject jsonSb = sbTab.query("ext_code = '" + jsonRaw.getString("resource_name") + "'and is_used = '1'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位不存在"); //下发ACS,执行取满放空的AGV动作 + JSONArray paramArr = new JSONArray(); + JSONObject param = new JSONObject(); + param.put("device_code", jsonSb.getString("point_code")); + param.put("option ", "1"); + paramArr.add(param); + + WmsToAcsServiceImpl wmsToAcsService = new WmsToAcsServiceImpl(); + JSONObject result = wmsToAcsService.updateTask(paramArr); + + if (!StrUtil.equals(result.getString("status"), "200")) { + throw new BadRequestException("操作失败:"+result.getString("message ")); + } // 更新工单状态为确认下卷 jsonRaw.put("status","03"); @@ -220,92 +272,15 @@ public class RawFoilServiceImpl implements RawFoilService { public JSONObject finishBlanking(JSONObject whereJson) { JSONObject raw_jo = whereJson.getJSONObject("raw_jo"); - String start_pint_code = raw_jo.getString("point_code"); - - WQLObject regionTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表 - WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表 WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 - WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 - - //查询该母卷号对应的任务 - String container_name = raw_jo.getString("container_name"); - JSONObject task_jo = WQLObject.getWQLObject("SCH_BASE_Task").query("material_code = '"+container_name+"'").uniqueResult(0); JSONObject jsonRaw = rawTab.query("mfg_order_name = '" + raw_jo.getString("mfg_order_name") + "'").uniqueResult(0); if (!StrUtil.equals(jsonRaw.getString("status"), "03")) throw new BadRequestException("工单不为确认下卷"); - /*// 2.根据就近原则查对应空卷抽 - JSONObject map = new JSONObject(); - map.put("flag", "2"); - map.put("product_area", jsonPoint.getProduct_area()); - map.put("point_location", jsonPoint.getPoint_location()); - JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0); - // 3.如果没找到则继续找下一节点 - if (ObjectUtil.isEmpty(jsonIvt)) { - String point_location = jsonPoint.getPoint_location(); - if (StrUtil.equals(point_location, "0")) map.put("point_location", "1"); - if (StrUtil.equals(point_location, "1")) map.put("point_location", "0"); - JSONObject jsonIvt_tow = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0); - - if (ObjectUtil.isEmpty(jsonIvt_tow)) throw new BadRequestException("没有空位"); - end_point_code = jsonIvt_tow.getString("full_point_code"); - } else { - end_point_code = jsonIvt.getString("full_point_code"); - } - - // 4.起点和终点确定 生成任务 - JSONObject param = new JSONObject(); - param.put("start_pint_code", start_pint_code); - param.put("end_pint_code", end_point_code); - String task_id = bookTwoConfirmTask.createTask(param);*/ - - // 插入入库单 - Long currentUserId = SecurityUtils.getCurrentUserId(); - String currentUsername = SecurityUtils.getCurrentUsername(); - - // 测试暂时注释 -// JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); - - JSONObject jsonRegion = new JSONObject(); - jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); - jsonRegion.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE")); - jsonRegion.put("io_type", "1"); - // 测试暂时注释 -// jsonRegion.put("material_id", jsonMater.getString("material_id")); - jsonRegion.put("pcsn", ""); - jsonRegion.put("vehicle_code", ""); - jsonRegion.put("qty", jsonRaw.getString("productin_qty")); - jsonRegion.put("qty_unit_id", "1"); - jsonRegion.put("bill_status", "10"); - jsonRegion.put("start_point_code", task_jo.getString("point_code2")); - jsonRegion.put("end_point_code", task_jo.getString("point_code4")); - jsonRegion.put("cust_id", ""); - jsonRegion.put("create_mode", "03"); - jsonRegion.put("task_id", task_jo.getString("task_id")); - jsonRegion.put("create_id", currentUserId); - jsonRegion.put("create_name", currentUsername); - jsonRegion.put("create_time", DateUtil.now()); - regionTab.insert(jsonRegion); - // 更新工单状态为下卷完成 jsonRaw.put("status", "04"); rawTab.update(jsonRaw); - // 下发任务入库任务 - /*CallEmpReelTask callEmpReelTask = new CallEmpReelTask(); - JSONObject jsonObject = callEmpReelTask.renotifyAcs(task_jo.getString("task_id")); - if (StrUtil.equals(jsonObject.getString("status"), "200")) { - // 成功返回 更新任务状态 - JSONObject jsonTask = taskTab.query("task_id ='" + task_jo.getString("task_id") + "'").uniqueResult(0); - jsonTask.put("task_status", "05"); - taskTab.update(jsonTask); - // 更新出入表状态 - jsonRegion.put("bill_status", "30"); - jsonRegion.put("update_optid", currentUserId); - jsonRegion.put("update_optname", currentUsername); - jsonRegion.put("update_time", DateUtil.now()); - regionTab.update(jsonRegion); - }*/ JSONObject jo = new JSONObject(); jo.put("message", "操作成功!"); return jo; diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_OVENINANDOUT_01.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_OVENINANDOUT_01.wql index 60bfba9c8..512407aa5 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_OVENINANDOUT_01.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_OVENINANDOUT_01.wql @@ -50,7 +50,7 @@ WHERE is_delete = '0' AND is_used = '1' - AND point_status = '00' + AND point_status = '1' OPTION 输入.reging_id <> "" region_id = 输入.reging_id diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls index 1d5b18fe2..298b67d10 100644 Binary files a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls and b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls differ diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/sch.xls b/lms/nladmin-system/src/main/java/org/nl/wms/sch/sch.xls index 29551439f..21ba511d2 100644 Binary files a/lms/nladmin-system/src/main/java/org/nl/wms/sch/sch.xls and b/lms/nladmin-system/src/main/java/org/nl/wms/sch/sch.xls differ diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CallEmpReelTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CallEmpReelTask.java index 2d41c5b11..7a14c2613 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CallEmpReelTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CallEmpReelTask.java @@ -59,12 +59,12 @@ public class CallEmpReelTask extends AbstractAcsTask { @Override @Transactional public void updateTaskStatus(JSONObject taskObj, String status) { - WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); - WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); - WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); + WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 + WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表 + WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区库存表 WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表 WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工序工单表 - WQLObject sbTab = WQLObject.getWQLObject("st_ivt_sbpointivt"); // 生箔工序工单表 + WQLObject sbTab = WQLObject.getWQLObject("st_ivt_sbpointivt"); // 生箔区域点位表 String task_id = taskObj.getString("task_id"); JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); @@ -72,18 +72,36 @@ public class CallEmpReelTask extends AbstractAcsTask { if (StrUtil.equals(status, "0")) { // 取消删除任务 taskTab.delete("task_id = '" + task_id + "'"); + + // 删除冷却区出入单据 + coolTab.delete("task_id = '"+task_id+"'"); + + // 更新生箔工单状态为开始、清除称重信息 + JSONObject jsonRaw = rawTab.query("container_name ='" + jsonTask.getString("material_code") + "' AND status <> '09' AND is_delete = '0'").uniqueResult(0); + jsonRaw.put("status", "01"); + jsonRaw.put("productin_qty", 0); + rawTab.update(jsonRaw); } if (TaskStatusEnum.EXECUTING.getCode().equals(status)) { + // 更新任务状态为执行中 + jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode()); + jsonTask.put("update_time", DateUtil.now()); + taskTab.update(jsonTask); + // 更新冷却区出入表 状态为执行中 JSONObject jsonCool = coolTab.query("task_id = '" + task_id + "'").uniqueResult(0); jsonCool.put("bill_status", "40"); coolTab.update(jsonCool); - // 更新任务状态为执行中 - jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode()); - jsonTask.put("update_time", DateUtil.now()); - taskTab.update(jsonTask); + // 更新生箔工单称重信息 + String weight = taskObj.getString("weight"); + if (ObjectUtil.isNotEmpty(weight)) { + JSONObject jsonRaw = rawTab.query("container_name ='" + jsonTask.getString("material_code") + "' AND status <> '09' AND is_delete = '0'").uniqueResult(0); + + jsonRaw.put("productin_qty", taskObj.getDoubleValue(weight)); + rawTab.update(jsonRaw); + } } if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) { @@ -178,7 +196,7 @@ public class CallEmpReelTask extends AbstractAcsTask { JSONObject json = new JSONObject(); json.put("task_id", IdUtil.getSnowflake(1, 1).nextId()); json.put("task_code", CodeUtil.getNewCode("TASK_CODE")); - json.put("task_status", "01"); + json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode()); json.put("material_code", form.getString("material_code")); json.put("point_code1", form.getString("point_code1")); json.put("point_code2", form.getString("point_code2")); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InCoolIvtTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InCoolIvtTask.java index 973e60d0b..c7a070b49 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InCoolIvtTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InCoolIvtTask.java @@ -13,6 +13,7 @@ import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.SpringContextHolder; +import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl; import org.nl.wms.sch.AcsTaskDto; import org.nl.wms.sch.manage.AbstractAcsTask; import org.nl.wms.sch.manage.TaskStatusEnum; @@ -74,6 +75,12 @@ public class InCoolIvtTask extends AbstractAcsTask { if (StrUtil.equals(status,"0")) { // 取消删除任务 taskTab.delete("task_id = '"+task_id+"'"); + + // 删除烘箱任务明细 + hotDtlTab.delete("task_id = '"+task_id+"'"); + + // 删除冷却区出入表 + coolTab.delete("task_id = '"+task_id+"'"); } if (TaskStatusEnum.EXECUTING.getCode().equals(status)) { @@ -106,7 +113,8 @@ public class InCoolIvtTask extends AbstractAcsTask { // 更新暂存位状态为空位 JSONObject jsonPoint = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0); - jsonPoint.put("point_status","00"); + jsonPoint.put("point_status","1"); + jsonPoint.put("material_code",""); pointTab.update(jsonPoint); // 更新冷却库存状态 @@ -133,6 +141,16 @@ public class InCoolIvtTask extends AbstractAcsTask { JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0); jsonHotDtl.put("dtl_status", "50"); hotDtlTab.update(jsonHotDtl); + + // 将入冷却信息发送给mes + JSONObject param = new JSONObject(); + param.put("iContainerName", jsonTask.getString("material_code")); + param.put("iArrivalTime", DateUtil.now()); + param.put("iWarehouse", 2); + param.put("UserName", ""); + param.put("PassWord", ""); + + JSONObject result = new LmsToMesServiceImpl().momRollSemiFGInboundComplete(param); } } @@ -168,7 +186,7 @@ public class InCoolIvtTask extends AbstractAcsTask { json.put("task_id",IdUtil.getSnowflake(1,1).nextId()); json.put("task_code", CodeUtil.getNewCode("TASK_CODE")); json.put("task_type", "010204"); - json.put("task_status", "01"); + json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode()); json.put("point_code1", point_code1); json.put("point_code2", point_code2); json.put("material_code", form.getString("container_name")); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java index e0de33eab..70965658b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java @@ -12,6 +12,7 @@ import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl; import org.nl.wms.sch.AcsTaskDto; import org.nl.wms.sch.manage.AbstractAcsTask; import org.nl.wms.sch.manage.TaskStatusEnum; @@ -69,9 +70,25 @@ public class InHotTask extends AbstractAcsTask { JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); if (StrUtil.equals(status,"0")) { + // 判断此条明细是否是冷却区 -> 烘箱,是则删除主表 + if (ObjectUtil.isNotEmpty(jsonTask.getString("point_code3"))) { + + // 删除烘箱主表 + JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonHotDtl)) throw new BadRequestException("明细单据不存在"); + + hotMstTab.delete("iostorinv_id = '"+jsonHotDtl.getString("iostorinv_id")+"'"); + + // 删除冷却出入表 + coolIoTab.delete("task_id = '"+task_id+"'"); + } + // 取消删除任务 taskTab.delete("task_id = '"+task_id+"'"); - } + + // 删除烘箱明细 + hotDtlTab.delete("task_id = '"+task_id+"'"); + } if (TaskStatusEnum.EXECUTING.getCode().equals(status)) { // 更新任务状态为执行中 @@ -88,6 +105,13 @@ public class InHotTask extends AbstractAcsTask { JSONObject jsonHotMst = hotMstTab.query("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'").uniqueResult(0); jsonHotMst.put("bill_status", "40"); hotMstTab.update(jsonHotMst); + + // 如果是冷却区入烘箱则更新 冷却区出入表状态 + if (ObjectUtil.isNotEmpty(jsonTask.getString("point_code3"))) { + JSONObject jsonCoolIo = coolIoTab.query("task_id = '" + task_id + "'").uniqueResult(0); + jsonCoolIo.put("bill_status", "40"); + coolIoTab.update(jsonCoolIo); + } } if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) { @@ -112,6 +136,7 @@ public class InHotTask extends AbstractAcsTask { // 更新主表: 什么时候更新主表 JSONObject jsonHotMst = hotMstTab.query("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'").uniqueResult(0); + String hot_point_code = ""; // 判断此任务是否有三个点位 if (ObjectUtil.isEmpty(jsonTask.getString("point_code3"))) { /* @@ -131,8 +156,11 @@ public class InHotTask extends AbstractAcsTask { // 更新暂存区点位状态为空位 JSONObject jsonPoint = pointTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0); - jsonPoint.put("point_status", "00"); + jsonPoint.put("point_status", "1"); + jsonPoint.put("material_code", ""); pointTab.update(jsonPoint); + + hot_point_code = jsonHotIvt.getString("point_code"); } else { /* * 冷却区入烘箱任务 @@ -170,8 +198,21 @@ public class InHotTask extends AbstractAcsTask { jsonHotIvt.put("update_optname", currentUsername); jsonHotIvt.put("update_time", DateUtil.now()); hotIvtTab.update(jsonHotIvt); + + hot_point_code = jsonHotIvt.getString("point_code"); } + // 将入烘箱信息发送给mes + JSONObject param = new JSONObject(); + param.put("iContainerName", jsonHotMst.getString("container_name")); + param.put("iResourceName", hot_point_code); + param.put("iMoveInDate", DateUtil. now()); + param.put("iPlanBakingTemperature", jsonHotDtl.getDoubleValue("temperature")); + param.put("iPlanBakingTimer", jsonHotDtl.getDoubleValue("oven_time")); + param.put("UserName", ""); + param.put("PassWord", ""); + + JSONObject result = new LmsToMesServiceImpl().momRollBakeInBound(param); } } @@ -213,7 +254,7 @@ public class InHotTask extends AbstractAcsTask { json.put("task_id",IdUtil.getSnowflake(1,1).nextId()); json.put("task_code", CodeUtil.getNewCode("TASK_CODE")); json.put("task_type", "010201"); - json.put("task_status", "01"); + json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode()); json.put("point_code1", form.getString("point_code1")); json.put("point_code2", form.getString("point_code2")); json.put("point_code3", form.getString("point_code3")); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/OutHotTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/OutHotTask.java index 91824afaf..51c1c7f6c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/OutHotTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/OutHotTask.java @@ -1,5 +1,6 @@ package org.nl.wms.sch.tasks; +import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; @@ -11,6 +12,7 @@ import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl; import org.nl.wms.sch.AcsTaskDto; import org.nl.wms.sch.manage.AbstractAcsTask; import org.nl.wms.sch.manage.TaskStatusEnum; @@ -18,6 +20,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; +import java.util.Date; import java.util.List; @Service @@ -68,6 +71,9 @@ public class OutHotTask extends AbstractAcsTask { if (StrUtil.equals(status,"0")) { // 取消删除任务 taskTab.delete("task_id = '"+task_id+"'"); + + // 删除出入烘箱任务明细 + hotDtlTab.delete("task_id = '"+task_id+"'"); } if (TaskStatusEnum.EXECUTING.getCode().equals(status)) { @@ -81,10 +87,6 @@ public class OutHotTask extends AbstractAcsTask { jsonHotDtl.put("dtl_status", "40"); hotDtlTab.update(jsonHotDtl); - // 更新主表状态 -// JSONObject jsonHotMst = hotMstTab.query("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'").uniqueResult(0); -// jsonHotMst.put("bill_status", "40"); -// hotMstTab.update(jsonHotMst); } if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) { @@ -98,12 +100,20 @@ public class OutHotTask extends AbstractAcsTask { jsonTask.put("update_time", DateUtil.now()); taskTab.update(jsonTask); + JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0); + // 更新明细表 JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0); + + Date date1 = DateUtil.parse(jsonHotIvt.getString("instorage_time")); + Date date2 = DateUtil.parse(DateUtil.now()); + long betweenDay = DateUtil.between(date1, date2, DateUnit.MINUTE); + jsonHotDtl.put("dtl_status", "50"); jsonHotDtl.put("confirm_optid", currentUserId); jsonHotDtl.put("confirm_optname", currentUsername); jsonHotDtl.put("confirm_time", DateUtil.now()); + jsonHotDtl.put("oven_time", Double.valueOf(betweenDay)); hotDtlTab.update(jsonHotDtl); // 更新主表: 什么时候更新主表 @@ -111,12 +121,12 @@ public class OutHotTask extends AbstractAcsTask { // 更新暂存区点位状态 JSONObject jsonPoint2 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0); - jsonPoint2.put("point_status", "02"); + jsonPoint2.put("point_status", "2"); + jsonPoint2.put("material_code", jsonHotIvt.getString("container_name")); pointTab.update(jsonPoint2); // 更新烘箱区库存状态 - JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0); - jsonHotIvt.put("point_status", "00"); + jsonHotIvt.put("point_status", "01"); jsonHotIvt.put("container_name","" ); jsonHotIvt.put("workorder_id","" ); jsonHotIvt.put("ivt_qty",0 ); @@ -125,6 +135,18 @@ public class OutHotTask extends AbstractAcsTask { jsonHotIvt.put("update_optname", currentUsername); jsonHotIvt.put("update_time", DateUtil.now()); hotIvtTab.update(jsonHotIvt); + + // 将出烘箱信息发送给mes + JSONObject param = new JSONObject(); + param.put("iContainerName", jsonHotMst.getString("container_name")); + param.put("iResourceName", jsonHotIvt.getString("point_code")); + param.put("iMoveOutDate", DateUtil. now()); + param.put("iabxActualBakingTemperature", jsonHotDtl.getDoubleValue("temperature")); + param.put("iabxActualBakingTimer", jsonHotDtl.getDoubleValue("oven_time")); + param.put("UserName", ""); + param.put("PassWord", ""); + + JSONObject result = new LmsToMesServiceImpl().momRollBakeOutBound(param); } } @@ -160,9 +182,10 @@ public class OutHotTask extends AbstractAcsTask { json.put("task_id",IdUtil.getSnowflake(1,1).nextId()); json.put("task_code", CodeUtil.getNewCode("TASK_CODE")); json.put("task_type", "010202"); - json.put("task_status", "01"); + json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode()); json.put("point_code1", form.getString("point_code1")); json.put("point_code2", form.getString("point_code2")); + json.put("material_code", form.getString("material_code")); json.put("sort_seq", "1"); json.put("handle_class", THIS_CLASS); json.put("create_id", currentUserId); diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue b/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue index 5cea98a79..068f9f5c6 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue @@ -138,19 +138,16 @@ disabled /> - - +