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 81da3aaf7..e715587eb 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 @@ -52,6 +52,7 @@ public class BakingServiceImpl implements BakingService { WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表 WQLObject hosIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烤箱区点位库存表 WQLObject hosReMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烤箱区出入主表 + WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表 if (StrUtil.equals(option, "1")) { @@ -75,13 +76,13 @@ public class BakingServiceImpl implements BakingService { * 暂存区入烘箱 */ // 1.查询烘箱对应的空位 - JSONObject jsonHotIvt = hosIvtTab.query("product_area = '" + jsonPointZc.getString("product_area") + "' and temperature = '" + temperature + "' and point_location = '"+jsonPointZc.getString("point_location")+"' and is_used = '1' and point_status = '01' order by point_code ASC").uniqueResult(0); + JSONObject jsonHotIvt = hosIvtTab.query("product_area = '" + jsonPointZc.getString("product_area") + "' and temperature = '" + temperature + "' and point_location = '" + jsonPointZc.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("烘烤区没有对应空位"); // 2.创建暂存位 --> 烘烤区任务 JSONObject param = new JSONObject(); - param.put("type","2"); // 1- 冷却区入烘箱 2- 暂存位入烘箱 - param.put("point_code1",point_code1); - param.put("point_code2",jsonHotIvt.getString("point_code")); + param.put("type", "2"); // 1- 冷却区入烘箱 2- 暂存位入烘箱 + param.put("point_code1", point_code1); + param.put("point_code2", jsonHotIvt.getString("point_code")); InHotTask inHotTask = new InHotTask(); String task_id = inHotTask.createTask(param); @@ -91,13 +92,13 @@ public class BakingServiceImpl implements BakingService { if (ObjectUtil.isEmpty(jsonHotReMst)) throw new BadRequestException("烘箱区出入主表不存在"); JSONObject hotParam = new JSONObject(); - hotParam.put("container_name",container_name); - hotParam.put("task_id",task_id); - hotParam.put("iostorinv_id",jsonHotReMst.getString("iostorinv_id")); - hotParam.put("start_point_code",point_code1); - hotParam.put("next_point_code",jsonHotIvt.getString("point_code")); - hotParam.put("temperature",temperature); - hotParam.put("oven_time",hours); + hotParam.put("container_name", container_name); + hotParam.put("task_id", task_id); + hotParam.put("iostorinv_id", jsonHotReMst.getString("iostorinv_id")); + hotParam.put("start_point_code", point_code1); + hotParam.put("next_point_code", jsonHotIvt.getString("point_code")); + hotParam.put("temperature", temperature); + hotParam.put("oven_time", hours); this.createHotDtl(hotParam); // 4.下发任务 @@ -115,7 +116,7 @@ public class BakingServiceImpl implements BakingService { // 1.根据冷却区此母卷的点位找到对应的暂存区、找到空位 // JSONObject jsonCoolIvt = coolIvtTab.query("container_name ='" + container_name + "' and is_used = '1' and full_point_status = '02' and cool_ivt_status = '01'").uniqueResult(0); - JSONObject jsonCoolIvt = coolIvtTab.query("full_point_code = '" + point_code1 + "'and container_name = '"+container_name+"' and is_used = '1' and full_point_status = '02' and cool_ivt_status = '01'").uniqueResult(0); + JSONObject jsonCoolIvt = coolIvtTab.query("full_point_code = '" + point_code1 + "'and container_name = '" + container_name + "' and is_used = '1' and full_point_status = '02' and cool_ivt_status = '01'").uniqueResult(0); if (ObjectUtil.isEmpty(jsonCoolIvt)) throw new BadRequestException("点位不存在或母卷不存在"); String product_area = jsonCoolIvt.getString("product_area"); // 生产区域 @@ -143,8 +144,8 @@ public class BakingServiceImpl implements BakingService { JSONArray pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0); if (ObjectUtil.isEmpty(pointArr)) { - if (StrUtil.equals(point_location, "0")) map.put("point_location","1"); - if (StrUtil.equals(point_location, "1")) map.put("point_location","0"); + if (StrUtil.equals(point_location, "0")) map.put("point_location", "1"); + if (StrUtil.equals(point_location, "1")) map.put("point_location", "0"); pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0); if (ObjectUtil.isEmpty(pointArr)) throw new BadRequestException("没有空暂存位"); @@ -168,15 +169,15 @@ 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 = '00' order by point_code ASC").uniqueResult(0); if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位"); // 3.创建冷却区 --> 烘烤区任务 JSONObject param = new JSONObject(); - param.put("type","1"); // 1- 冷却区入烘箱 2- 暂存位入烘箱 - param.put("point_code1",point_code1); - param.put("point_code2",point_code2); - param.put("point_code3",jsonHotIvt.getString("point_code")); + param.put("type", "1"); // 1- 冷却区入烘箱 2- 暂存位入烘箱 + param.put("point_code1", point_code1); + param.put("point_code2", point_code2); + param.put("point_code3", jsonHotIvt.getString("point_code")); // 创建冷却区 --> 暂存位的任务 InHotTask inHotTask = new InHotTask(); @@ -184,18 +185,44 @@ public class BakingServiceImpl implements BakingService { // 4.插入烘箱区出入主表 和 明细表 JSONObject hotParam = new JSONObject(); - hotParam.put("container_name",container_name); - hotParam.put("task_id",task_id); + hotParam.put("container_name", container_name); + hotParam.put("task_id", task_id); // 创建主表 String iostorinv_id = this.createHotIoMst(hotParam); // 创建明细 - hotParam.put("iostorinv_id",iostorinv_id); - hotParam.put("start_point_code",point_code2); - hotParam.put("next_point_code",jsonHotIvt.getString("point_code")); - hotParam.put("temperature",temperature); - hotParam.put("oven_time",hours); + hotParam.put("iostorinv_id", iostorinv_id); + hotParam.put("start_point_code", point_code2); + hotParam.put("next_point_code", jsonHotIvt.getString("point_code")); + hotParam.put("temperature", temperature); + hotParam.put("oven_time", hours); this.createHotDtl(hotParam); + // 生成冷却区出入表 + Long currentUserId = SecurityUtils.getCurrentUserId(); + String currentUsername = SecurityUtils.getCurrentUsername(); + + 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("bill_status", "10"); + jsonCool.put("task_id", task_id); + jsonCool.put("start_point_code", point_code1); + jsonCool.put("end_point_code", jsonHotIvt.getString("point_code")); + jsonCool.put("create_mode", "03"); + jsonCool.put("create_id", currentUserId); + jsonCool.put("create_name", currentUsername); + jsonCool.put("create_time", DateUtil.now()); + jsonCool.put("update_optid", currentUserId); + jsonCool.put("update_optname", currentUsername); + jsonCool.put("update_time", DateUtil.now()); + jsonCool.put("confirm_optid", currentUserId); + 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")) { @@ -218,7 +245,7 @@ public class BakingServiceImpl implements BakingService { // 1.查询暂存位有没有空位 String product_area = jsonHotIvt.getString("product_area"); String reging_id = ""; - /* switch (product_area) { + switch (product_area) { case "A": reging_id = RegionTypeEnum.A_HKZC.getId(); break; @@ -231,7 +258,7 @@ public class BakingServiceImpl implements BakingService { case "D": reging_id = RegionTypeEnum.D_HKZC.getId(); break; - }*/ + } JSONObject map = new JSONObject(); map.put("flag", "1"); map.put("reging_id", reging_id); @@ -268,23 +295,23 @@ public class BakingServiceImpl implements BakingService { // 创建明细 JSONObject hotParam = new JSONObject(); - hotParam.put("task_id",task_id); - hotParam.put("iostorinv_id",jsonHotReMst.getString("iostorinv_id")); - hotParam.put("start_point_code",point_code1); - hotParam.put("next_point_code",point_code2); + hotParam.put("task_id", task_id); + hotParam.put("iostorinv_id", jsonHotReMst.getString("iostorinv_id")); + hotParam.put("start_point_code", point_code1); + hotParam.put("next_point_code", point_code2); this.createHotDtl(hotParam); // 5.下发任务 - JSONObject jsonObject = outHotTask.immediateNotifyAcs(); + /* 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","操作成功!"); + result.put("message", "操作成功!"); return result; } @@ -294,6 +321,8 @@ public class BakingServiceImpl implements BakingService { 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"); // 冷却区出入表 + String point_code1 = whereJson.getString("point_code"); // 暂存位:起点 String container_name = whereJson.getString("container_name"); // 母卷号 @@ -313,8 +342,8 @@ public class BakingServiceImpl implements BakingService { JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0); // 如果为空 if (ObjectUtil.isEmpty(jsonCooIvt)) { - if (StrUtil.equals(jsonPoint.getString("point_location"), "0")) map.put("point_location","1"); - if (StrUtil.equals(jsonPoint.getString("point_location"), "1")) map.put("point_location","0"); + if (StrUtil.equals(jsonPoint.getString("point_location"), "0")) map.put("point_location", "1"); + if (StrUtil.equals(jsonPoint.getString("point_location"), "1")) map.put("point_location", "0"); jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0); } if (ObjectUtil.isEmpty(jsonCooIvt)) throw new BadRequestException("冷却区空位不足"); @@ -332,23 +361,49 @@ public class BakingServiceImpl implements BakingService { JSONObject jsonHotMst = hotMstTab.query("container_name = '" + container_name + "' and is_delete = '0' and bill_status <> '50'").uniqueResult(0); if (ObjectUtil.isEmpty(jsonHotMst)) throw new BadRequestException("烘烤区出入主表不存在"); JSONObject hotParam = new JSONObject(); - hotParam.put("task_id",task_id); - hotParam.put("iostorinv_id",jsonHotMst.getString("iostorinv_id")); - hotParam.put("start_point_code",point_code1); - hotParam.put("next_point_code",jsonCooIvt.getString("full_point_code")); + hotParam.put("task_id", task_id); + hotParam.put("iostorinv_id", jsonHotMst.getString("iostorinv_id")); + hotParam.put("start_point_code", point_code1); + hotParam.put("next_point_code", jsonCooIvt.getString("full_point_code")); this.createHotDtl(hotParam); + // 生成冷却区出入表 + Long currentUserId = SecurityUtils.getCurrentUserId(); + String currentUsername = SecurityUtils.getCurrentUsername(); + + 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("bill_status", "10"); + jsonCool.put("task_id", task_id); + jsonCool.put("start_point_code", point_code1); + jsonCool.put("end_point_code", jsonCooIvt.getString("full_point_code")); + jsonCool.put("create_mode", "03"); + jsonCool.put("create_id", currentUserId); + jsonCool.put("create_name", currentUsername); + jsonCool.put("create_time", DateUtil.now()); + jsonCool.put("update_optid", currentUserId); + jsonCool.put("update_optname", currentUsername); + jsonCool.put("update_time", DateUtil.now()); + jsonCool.put("confirm_optid", currentUserId); + jsonCool.put("confirm_optname", currentUsername); + jsonCool.put("confirm_time", DateUtil.now()); + coolTab.insert(jsonCool); + // 5.下发任务 - JSONObject jsonObject = inCoolIvtTask.immediateNotifyAcs(); + /* 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","操作成功!"); + result.put("message", "操作成功!"); return result; } @@ -363,7 +418,7 @@ public class BakingServiceImpl implements BakingService { 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("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")); @@ -388,7 +443,7 @@ public class BakingServiceImpl implements BakingService { WQLObject hotDtlTab = WQLObject.getWQLObject("ST_IVT_HotRegionIODtl"); // 烘箱区出入明细表 JSONObject jsonHotDtl = new JSONObject(); - jsonHotDtl.put("iostorinvdtl_id",IdUtil.getSnowflake(1,1).nextId()); + jsonHotDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId()); jsonHotDtl.put("iostorinv_id", param.getString("iostorinv_id")); jsonHotDtl.put("start_point_code", param.getString("start_point_code")); jsonHotDtl.put("next_point_code", param.getString("next_point_code")); 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 df99cc080..973e60d0b 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 @@ -120,6 +120,11 @@ public class InCoolIvtTask extends AbstractAcsTask { jsonIvt.put("ivt_qty", jsonHotMst.getString("qty")); ivtTab.update(jsonIvt); + // 更新冷却出入主表状态 + JSONObject jsonCool = coolTab.query("task_id = '" + task_id + "'").uniqueResult(0); + jsonCool.put("bill_status", "50"); + coolTab.update(jsonCool); + // 更新烘烤出入主表为完成 jsonHotMst.put("bill_status", "50"); hotMstTab.update(jsonHotMst); 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 9b4d4ac6d..e0de33eab 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 @@ -63,6 +63,7 @@ public class InHotTask extends AbstractAcsTask { WQLObject hotIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烘箱区库存表 WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱区出入主表 WQLObject hotDtlTab = WQLObject.getWQLObject("ST_IVT_HotRegionIODtl"); // 烘箱区出入明细表 + WQLObject coolIoTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表 String task_id = taskObj.getString("task_id"); JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); @@ -137,6 +138,11 @@ public class InHotTask extends AbstractAcsTask { * 冷却区入烘箱任务 */ + // 更新冷却出入主表状态 + JSONObject jsonCool = coolIoTab.query("task_id = '" + task_id + "'").uniqueResult(0); + jsonCool.put("bill_status", "50"); + coolIoTab.update(jsonCool); + // 更新冷却区库存状态 JSONObject jsonCoolIvt = coolIvtTab.query("full_point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0); String container_name = jsonCoolIvt.getString("container_name"); // 母卷号 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 a22c67f86..91824afaf 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 @@ -116,7 +116,7 @@ public class OutHotTask extends AbstractAcsTask { // 更新烘箱区库存状态 JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0); - jsonHotIvt.put("point_status", "01"); + jsonHotIvt.put("point_status", "00"); jsonHotIvt.put("container_name","" ); jsonHotIvt.put("workorder_id","" ); jsonHotIvt.put("ivt_qty",0 );