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 5afe99ed2..cac26bea5 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 @@ -51,7 +51,7 @@ public class BakingServiceImpl implements BakingService { WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表 WQLObject hosIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烤箱区点位库存表 - WQLObject hosReMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烤箱区点位库存表 + WQLObject hosReMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烤箱区出入主表 if (StrUtil.equals(option, "1")) { @@ -83,7 +83,7 @@ public class BakingServiceImpl implements BakingService { param.put("point_code1",point_code1); param.put("point_code2",jsonHotIvt.getString("point_code")); - InHotTask inHotTask = new InHotTask(null); + InHotTask inHotTask = new InHotTask(); String task_id = inHotTask.createTask(param); // 3.插入明细明细 @@ -112,9 +112,11 @@ public class BakingServiceImpl implements BakingService { /* * 冷却区入烘箱 */ + // 1.根据冷却区此母卷的点位找到对应的暂存区、找到空位 - JSONObject jsonCoolIvt = coolIvtTab.query("container_name ='" + container_name + "' and is is_used = '1' and full_point_status = '02' and cool_ivt_status = '01'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonCoolIvt)) throw new BadRequestException("母卷不存在"); +// 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); + if (ObjectUtil.isEmpty(jsonCoolIvt)) throw new BadRequestException("点位不存在或母卷不存在"); String product_area = jsonCoolIvt.getString("product_area"); // 生产区域 String point_location = jsonCoolIvt.getString("point_location"); // 位置 @@ -154,10 +156,10 @@ public class BakingServiceImpl implements BakingService { JSONObject jsonPoint = pointArr.getJSONObject(i); String point_code = jsonPoint.getString("point_code"); - JSONObject json_point_code1 = taskTab.query("point_code1 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0); - JSONObject json_point_code2 = taskTab.query("point_code2 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0); - JSONObject json_point_code3 = taskTab.query("point_code3 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0); - JSONObject json_point_code4 = taskTab.query("point_code4 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0); + JSONObject json_point_code1 = taskTab.query("point_code1 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); + JSONObject json_point_code2 = taskTab.query("point_code2 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); + JSONObject json_point_code3 = taskTab.query("point_code3 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); + JSONObject json_point_code4 = taskTab.query("point_code4 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); if (ObjectUtil.isEmpty(json_point_code1) && ObjectUtil.isEmpty(json_point_code2) && ObjectUtil.isEmpty(json_point_code3) && ObjectUtil.isEmpty(json_point_code4)) { point_code2 = point_code; break; @@ -177,7 +179,7 @@ public class BakingServiceImpl implements BakingService { param.put("point_code3",jsonHotIvt.getString("point_code")); // 创建冷却区 --> 暂存位的任务 - InHotTask inHotTask = new InHotTask(null); + InHotTask inHotTask = new InHotTask(); String task_id = inHotTask.createTask(param); // 4.插入烘箱区出入主表 和 明细表 @@ -201,6 +203,10 @@ public class BakingServiceImpl implements BakingService { 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")) { @@ -240,10 +246,10 @@ public class BakingServiceImpl implements BakingService { JSONObject jsonPoint = pointArr.getJSONObject(i); String point_code = jsonPoint.getString("point_code"); - JSONObject json_point_code1 = taskTab.query("point_code1 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0); - JSONObject json_point_code2 = taskTab.query("point_code2 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0); - JSONObject json_point_code3 = taskTab.query("point_code3 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0); - JSONObject json_point_code4 = taskTab.query("point_code4 = '" + point_code + "' and task_status != '99' and is_delete = '0'").uniqueResult(0); + JSONObject json_point_code1 = taskTab.query("point_code1 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); + JSONObject json_point_code2 = taskTab.query("point_code2 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); + JSONObject json_point_code3 = taskTab.query("point_code3 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); + JSONObject json_point_code4 = taskTab.query("point_code4 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); if (ObjectUtil.isEmpty(json_point_code1) && ObjectUtil.isEmpty(json_point_code2) && ObjectUtil.isEmpty(json_point_code3) && ObjectUtil.isEmpty(json_point_code4)) { point_code2 = point_code; break; @@ -253,7 +259,7 @@ public class BakingServiceImpl implements BakingService { JSONObject param = new JSONObject(); param.put("point_code1", point_code1); param.put("point_code2", point_code2); - OutHotTask outHotTask = new OutHotTask(null); + OutHotTask outHotTask = new OutHotTask(); String task_id = outHotTask.createTask(param); // 4.插入烘箱区出入明细表 @@ -287,6 +293,7 @@ public class BakingServiceImpl implements BakingService { 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"); String point_code1 = whereJson.getString("point_code"); // 暂存位:起点 String container_name = whereJson.getString("container_name"); // 母卷号 @@ -315,13 +322,23 @@ public class BakingServiceImpl implements BakingService { // 3.创建任务 JSONObject param = new JSONObject(); param.put("point_code1", point_code1); - param.put("point_code2", jsonCooIvt.getString("point_code")); + param.put("point_code2", jsonCooIvt.getString("full_point_code")); param.put("container_name", container_name); - InCoolIvtTask inCoolIvtTask = new InCoolIvtTask(null); + InCoolIvtTask inCoolIvtTask = new InCoolIvtTask(); String task_id = inCoolIvtTask.createTask(param); - // 4.下发任务 + // 4.插入明细 + 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")); + this.createHotDtl(hotParam); + + // 5.下发任务 JSONObject jsonObject = inCoolIvtTask.renotifyAcs(task_id); if (StrUtil.equals(jsonObject.getString("status"), "200")) { // 成功返回 更新任务状态 @@ -352,6 +369,7 @@ public class BakingServiceImpl implements BakingService { jsonHotMst.put("workorder_id", jsonCoolIvt.getString("workorder_id")); jsonHotMst.put("qty", jsonCoolIvt.getString("ivt_qty")); jsonHotMst.put("bill_status", "10"); + jsonHotMst.put("qty_unit_id", "1"); jsonHotMst.put("create_mode", "03"); jsonHotMst.put("task_id", param.getString("task_id")); jsonHotMst.put("create_id", SecurityUtils.getCurrentUserId()); 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 61994466b..60bfba9c8 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 @@ -60,6 +60,8 @@ point_location = 输入.point_location ENDOPTION + order by point_code ASC + ENDSELECT ENDQUERY 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 e9e0fbbea..cae5d1091 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 @@ -24,7 +24,6 @@ import org.springframework.transaction.annotation.Transactional; @Slf4j public class InCoolIvtTask extends AbstractAcsTask { private final String THIS_CLASS = InCoolIvtTask.class.getName(); - private final CutConveyorTask conveyorTask; @Override @Transactional @@ -69,9 +68,14 @@ public class InCoolIvtTask extends AbstractAcsTask { if (ObjectUtil.isEmpty(startDto)) throw new BadRequestException("起点未找到可用点位:" + point_code1); // 校验终点是否存在 - JSONObject jsonIvt = ivtTab.query("point_code ='" + point_code2 + "'").uniqueResult(0); + JSONObject jsonIvt = ivtTab.query("full_point_code ='" + point_code2 + "'").uniqueResult(0); if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("终点未找到可用点位:" + point_code2); + // 更新暂存位状态为空位 + JSONObject jsonPoint = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0); + jsonPoint.put("point_status","00"); + pointTab.update(jsonPoint); + // 更新冷却库存状态 JSONObject jsonHotMst = hotMstTab.query("container_name = '" + jsonTask.getString("material_code") + "'").uniqueResult(0); @@ -85,7 +89,7 @@ public class InCoolIvtTask extends AbstractAcsTask { // 更新烘烤出入主表为完成 jsonHotMst.put("bill_status", "50"); - hotMstTab.update(jsonIvt); + hotMstTab.update(jsonHotMst); } } @@ -103,15 +107,17 @@ public class InCoolIvtTask extends AbstractAcsTask { @Transactional public String createTask(JSONObject form) { WQLObject tab = WQLObject.getWQLObject("SCH_BASE_Task"); + CutConveyorTask cutConveyorTask = new CutConveyorTask(); + Long currentUserId = SecurityUtils.getCurrentUserId(); String currentUsername = SecurityUtils.getCurrentUsername(); String point_code1 = form.getString("point_code1"); String point_code2 = form.getString("point_code2"); - if (conveyorTask.isSingleTask(point_code1)){ + if (cutConveyorTask.isSingleTask(point_code1)){ throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!"); } - if (conveyorTask.isSingleTask(point_code2)){ + if (cutConveyorTask.isSingleTask(point_code2)){ throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!"); } 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 6c07b9568..c700ff838 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 @@ -24,7 +24,6 @@ import org.springframework.transaction.annotation.Transactional; @Slf4j public class InHotTask extends AbstractAcsTask { private final String THIS_CLASS = InHotTask.class.getName(); - private final CutConveyorTask conveyorTask; @Override @Transactional @@ -99,6 +98,11 @@ public class InHotTask extends AbstractAcsTask { jsonHotIvt.put("update_optname", currentUsername); jsonHotIvt.put("update_time", DateUtil.now()); hotIvtTab.update(jsonHotIvt); + + // 更新暂存区点位状态为空位 + JSONObject jsonPoint = pointTab.query("point_code = '" + jsonTask.getString("point_code1") + "'").uniqueResult(0); + jsonPoint.put("point_status", "00"); + pointTab.update(jsonPoint); } else { /* * 冷却区入烘箱任务 @@ -150,6 +154,8 @@ public class InHotTask extends AbstractAcsTask { @Transactional public String createTask(JSONObject form) { WQLObject tab = WQLObject.getWQLObject("SCH_BASE_Task"); + + CutConveyorTask cutConveyorTask = new CutConveyorTask(); Long currentUserId = SecurityUtils.getCurrentUserId(); String currentUsername = SecurityUtils.getCurrentUsername(); @@ -159,13 +165,13 @@ public class InHotTask extends AbstractAcsTask { String point_code1 = form.getString("point_code1"); String point_code2 = form.getString("point_code2"); String point_code3 = form.getString("point_code3"); - if (conveyorTask.isSingleTask(point_code1)){ + if (cutConveyorTask.isSingleTask(point_code1)){ throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!"); } - if (conveyorTask.isSingleTask(point_code2)){ + if (cutConveyorTask.isSingleTask(point_code2)){ throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!"); } - if (conveyorTask.isSingleTask(point_code3)){ + if (cutConveyorTask.isSingleTask(point_code3)){ throw new BadRequestException("点位:"+point_code3+"存在未完成的任务!"); } JSONObject json = new JSONObject(); @@ -191,10 +197,10 @@ public class InHotTask extends AbstractAcsTask { String point_code1 = form.getString("point_code1"); String point_code2 = form.getString("point_code2"); - if (conveyorTask.isSingleTask(point_code1)){ + if (cutConveyorTask.isSingleTask(point_code1)){ throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!"); } - if (conveyorTask.isSingleTask(point_code2)){ + if (cutConveyorTask.isSingleTask(point_code2)){ throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!"); } 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 d95c8d6c4..97979ee1a 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 @@ -20,7 +20,6 @@ import org.springframework.transaction.annotation.Transactional; @Slf4j public class OutHotTask extends AbstractAcsTask { private final String THIS_CLASS = OutHotTask.class.getName(); - private final CutConveyorTask conveyorTask; @Override @Transactional @@ -89,7 +88,7 @@ public class OutHotTask extends AbstractAcsTask { jsonHotIvt.put("container_name","" ); jsonHotIvt.put("workorder_id","" ); jsonHotIvt.put("ivt_qty",0 ); - jsonHotIvt.put("instorage_time",DateUtil.now() ); + jsonHotIvt.put("instorage_time",""); jsonHotIvt.put("update_optid", currentUserId); jsonHotIvt.put("update_optname", currentUsername); jsonHotIvt.put("update_time", DateUtil.now()); @@ -111,15 +110,17 @@ public class OutHotTask extends AbstractAcsTask { @Transactional public String createTask(JSONObject form) { WQLObject tab = WQLObject.getWQLObject("SCH_BASE_Task"); + CutConveyorTask cutConveyorTask = new CutConveyorTask(); + Long currentUserId = SecurityUtils.getCurrentUserId(); String currentUsername = SecurityUtils.getCurrentUsername(); String point_code1 = form.getString("point_code1"); String point_code2 = form.getString("point_code2"); - if (conveyorTask.isSingleTask(point_code1)){ + if (cutConveyorTask.isSingleTask(point_code1)){ throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!"); } - if (conveyorTask.isSingleTask(point_code2)){ + if (cutConveyorTask.isSingleTask(point_code2)){ throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!"); }