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 d52cdfa..e8efcad 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 @@ -118,7 +118,6 @@ public class MesToLmsServiceImpl implements MesToLmsService { * @return */ @Override - @Transactional(rollbackFor = Exception.class) public JSONObject momRollFoilStart(JSONObject param) { log.info("momRollFoilStart接口输入参数为:-------------------" + param.toString()); //母卷号 @@ -419,13 +418,16 @@ public class MesToLmsServiceImpl implements MesToLmsService { log.info("母卷:" + ContainerName + "被决策入烘箱,请求烘烤标识改为1"); String point_code = ""; + //冷却区点位库存 查询母卷号且满轴位状态为满轴02,且点位类型为1和3 JSONObject jsonCoolIvt = coolIvtTab.query("container_name = '" + containerName + "' and full_point_status = '02' AND point_type IN ('1','3')").uniqueResult(0); if (ObjectUtil.isEmpty(jsonCoolIvt)) { + //点位表查询母卷号 JSONObject jsonPoint = pointTab.query("material_code ='" + containerName + "'").uniqueResult(0); if (ObjectUtil.isNotEmpty(jsonPoint)) { point_code = jsonPoint.getString("point_code"); } } else { + //?? if (containerName.startsWith("B1") || containerName.startsWith("B3")) { point_code = jsonCoolIvt.getString("point_code"); }else { @@ -437,20 +439,26 @@ public class MesToLmsServiceImpl implements MesToLmsService { } // 调用接口输入参数 + //1-入箱;2-出箱 jsonParam.put("option", "1"); + //母卷 jsonParam.put("container_name", containerName); + //温度 jsonParam.put("temperature", bakingTemperature); + //烘烤时间h jsonParam.put("hours", bakingTimer); + //点位 jsonParam.put("point_code", point_code); - // 调用手持接口 + // 调用手持接口,入烘箱 BakingServiceImpl bakingService = SpringContextHolder.getBean(BakingServiceImpl.class); bakingService.ovenInAndOut(jsonParam); - } else { + } + else { /* * 入冷却区 */ - //更新生箔工单的是否下发烘烤为是 + //更新生箔工单的是否入半成品库为是 HashMap map = new HashMap<>(); map.put("is_instor", "1"); WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + ContainerName + "'"); 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 dde4d27..5492274 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 @@ -59,26 +59,47 @@ public class BakingServiceImpl implements BakingService { public JSONObject ovenInAndOut(JSONObject whereJson) { String option = whereJson.getString("option"); // 1-入箱 2-出箱 - - WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位表 - 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 coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表 - WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 - WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表 + // 点位表 + WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); + // 任务表 + WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); + // 冷却区点位库存表 + WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); + // 冷却区出入表 + WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); + // 烤箱区点位库存表 + WQLObject hosIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); + // 生箔工单表 + WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); + // 物料表 + WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); //获取人员对应的区域 UserAreaServiceImpl userAreaService = new UserAreaServiceImpl(); String in_area_id = userAreaService.getInArea(); - + // 入箱 if (StrUtil.equals(option, "1")) { - // 入箱 - String container_name = whereJson.getString("container_name"); // 母卷号 - String temperature = whereJson.getString("temperature"); // 温度 - String hours = whereJson.getString("hours"); // 时间 - String point_code1 = whereJson.getString("point_code"); // 点位 + // 母卷号 + String container_name = whereJson.getString("container_name"); + // 温度 + String temperature = whereJson.getString("temperature"); + // 时间 + String hours = whereJson.getString("hours"); + // 点位 + String point_code1 = whereJson.getString("point_code"); + + if (ObjectUtil.isEmpty(container_name)) { + throw new BadRequestException("母卷号不能为空"); + } + if (ObjectUtil.isEmpty(temperature)) { + throw new BadRequestException("温度不能为空"); + } + if (ObjectUtil.isEmpty(hours)) { + throw new BadRequestException("时间不能为空"); + } + if (ObjectUtil.isEmpty(point_code1)) { + throw new BadRequestException("点位不能为空"); + } //校验该设备是否启用,且母卷MES是否请求烘烤 //查询该母卷号、设备号对应的生箔工单 @@ -95,51 +116,44 @@ public class BakingServiceImpl implements BakingService { if (ObjectUtil.isEmpty(sb_jo)) { throw new BadRequestException("未查询到母卷号:" + container_name + "对应的生箔机台编号!"); } - + //MES启用mes_used为1,且请求烘烤is_baking为0 if (StrUtil.equals("1", sb_jo.getString("mes_used")) && !"1".equals(raw_jo.getString("is_baking"))) { throw new BadRequestException("该母卷在MES上未进行决策入烘箱,不允许进行入烘箱操作!"); } - if (ObjectUtil.isEmpty(container_name)) { - throw new BadRequestException("母卷号不能为空"); - } - if (ObjectUtil.isEmpty(temperature)) { - throw new BadRequestException("温度不能为空"); - } - if (ObjectUtil.isEmpty(hours)) { - throw new BadRequestException("时间不能为空"); - } - if (ObjectUtil.isEmpty(point_code1)) { - throw new BadRequestException("点位不能为空"); - } - /* * 根据点位判断是 冷却区入烘箱还是暂存区入烘箱 */ JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0); JSONObject cool_jo = coolIvtTab.query("point_code = '" + point_code1 + "' AND point_type = '3'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(jsonPointZc) || ObjectUtil.isNotEmpty(cool_jo)) { if (ObjectUtil.isEmpty(jsonPointZc)) { jsonPointZc = cool_jo; } + //判断人员区域操作权限 if (!in_area_id.contains(jsonPointZc.getString("product_area"))) { throw new BadRequestException("当前登录人员暂无【" + jsonPointZc.getString("product_area") + "】操作权限"); } /* * 暂存区入烘箱 */ - // 1.查询烘箱对应的空位 + // 1.查询烘箱对应的空位:符合温度要求,并且有空位的烘箱 JSONObject jsonMap = new JSONObject(); jsonMap.put("flag", "1"); + //区域 jsonMap.put("product_area", jsonPointZc.getString("product_area")); - //获取温度幅度 + //位置1或0 jsonMap.put("point_location", jsonPointZc.getString("point_location")); + //获取温度幅度 + //查询烤箱区点位库存表ST_IVT_HotPointIvt,启用、空位、且无未完成的任务的点位 JSONArray hot_rows = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().getResultJSONArray(0); JSONObject jsonHotIvt = new JSONObject(); for (int i = 0; i < hot_rows.size(); i++) { JSONObject hot_row = hot_rows.getJSONObject(i); String point_code = hot_row.getString("point_code"); + //?? String point_temperature = (String) redisUtils.hget(point_code, "temperature"); if (!ObjectUtil.isEmpty(point_temperature)) { if (point_temperature.equals(temperature)) { @@ -148,10 +162,11 @@ public class BakingServiceImpl implements BakingService { } } } - + //未找到满足的点位 if (ObjectUtil.isEmpty(jsonHotIvt)) { //如果属于B1的烘箱,变更位置再查询 if (ObjectUtil.isNotEmpty(cool_jo) && cool_jo.getString("product_area").equals("B1")) { + //二期换另一排查询 jsonMap.put("point_location", jsonPointZc.getString("point_location").equals("0") ? "1" : "0"); hot_rows = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().getResultJSONArray(0); for (int i = 0; i < hot_rows.size(); i++) { @@ -174,36 +189,56 @@ public class BakingServiceImpl implements BakingService { } // 2.创建暂存位 --> 烘烤区任务 JSONObject param = new JSONObject(); - param.put("type", "2"); // 1- 冷却区入烘箱 2- 暂存位入烘箱 + // 1- 冷却区入烘箱 2- 暂存位入烘箱 + param.put("type", "2"); + //设置起点 if (ObjectUtil.isNotEmpty(cool_jo)) { param.put("point_code1", cool_jo.getString("point_code")); } else { param.put("point_code1", point_code1); } + //终点 param.put("point_code2", jsonHotIvt.getString("point_code")); + //母卷 param.put("material_code", container_name); + //任务来源区域 param.put("product_area", jsonPointZc.getString("product_area")); + //烘烤时间h param.put("request_param", NumberUtil.mul(Double.parseDouble(hours), 60)); InHotTask inHotTask = new InHotTask(); + //创建入烘箱任务 String task_id = inHotTask.createTask(param); // 3.插入主表 + //查询母卷 对应生箔工单表 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); JSONObject hotParam = new JSONObject(); + //母卷 hotParam.put("container_name", container_name); + //工单标识 hotParam.put("workorder_id", jsonRaw.getString("workorder_id")); + //产品id hotParam.put("material_id", jsonMater.getString("material_id")); + //工单重量 hotParam.put("qty", jsonRaw.get("productin_qty")); + //出入类型 hotParam.put("io_type", "0"); hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id")); + //入烘箱任务id hotParam.put("task_id", task_id); + //起点 hotParam.put("start_point_code", point_code1); + //终点 hotParam.put("end_point_code", jsonHotIvt.getString("point_code")); + //温度 hotParam.put("temperature", temperature); + //烘烤时间 hotParam.put("oven_time", hours); + //创建烘箱主表ST_IVT_HotRegionIOMst this.createHotIoMst(hotParam); } else { /* @@ -215,9 +250,10 @@ public class BakingServiceImpl implements BakingService { if (ObjectUtil.isEmpty(jsonCoolIvt)) { throw new BadRequestException("请扫描正确的冷却区或对接点位!"); } - - String product_area = jsonCoolIvt.getString("product_area"); // 生产区域 - String point_location = jsonCoolIvt.getString("point_location"); // 位置 + // 生产区域 + String product_area = jsonCoolIvt.getString("product_area"); + // 位置 + String point_location = jsonCoolIvt.getString("point_location"); String reging_id = ""; if (!in_area_id.contains(product_area)) { @@ -249,6 +285,13 @@ public class BakingServiceImpl implements BakingService { } map.put("reging_id", reging_id); map.put("point_location", point_location); + /** + * 共用 3 + * 点位 1 + * 仓位 2 + * 入箱 4 + * 出箱 5 + */ //只找入箱点位 map.put("point_type", "4"); @@ -288,9 +331,13 @@ public class BakingServiceImpl implements BakingService { // 3.创建冷却区 --> 烘烤区任务 JSONObject param = new JSONObject(); - param.put("type", "1"); // 1- 冷却区入烘箱 2- 暂存位入烘箱 + //// 1- 冷却区入烘箱 2- 暂存位入烘箱 + param.put("type", "1"); + //起点 param.put("point_code1", point_code1); + //暂存位 param.put("point_code2", point_code2_jo.getString("point_code")); + //烘烤点位 param.put("point_code3", jsonHotIvt.getString("point_code")); param.put("material_code", container_name); param.put("product_area", product_area); @@ -308,21 +355,31 @@ public class BakingServiceImpl implements BakingService { } JSONObject hotParam = new JSONObject(); + //母卷 hotParam.put("container_name", container_name); + //工单id hotParam.put("workorder_id", jsonRaw.getString("workorder_id")); + //产品id hotParam.put("material_id", jsonMater.getString("material_id")); + //重量 hotParam.put("qty", jsonRaw.get("productin_qty")); hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id")); + //任务id hotParam.put("task_id", task_id); + //出入类型 hotParam.put("io_type", "0"); + //起点 hotParam.put("start_point_code", point_code1); + //终点 hotParam.put("end_point_code", jsonHotIvt.getString("point_code")); + //温度 hotParam.put("temperature", temperature); + //时间 hotParam.put("oven_time", hours); this.createHotIoMst(hotParam); - // 生成冷却区出入表 + // 生成冷却区出入表ST_IVT_CoolRegionIO String currentUserId = SecurityUtils.getCurrentUserId(); String currentUsername = SecurityUtils.getCurrentUsername(); @@ -350,8 +407,9 @@ public class BakingServiceImpl implements BakingService { jsonCool.put("confirm_time", DateUtil.now()); coolTab.insert(jsonCool); } - } else if (StrUtil.equals(option, "2")) { - // 出箱 + } + //出箱 + else if (StrUtil.equals(option, "2")) { String point_code1 = whereJson.getString("point_code"); if (ObjectUtil.isEmpty(point_code1)) { throw new BadRequestException("点位不能为空"); @@ -548,14 +606,18 @@ public class BakingServiceImpl implements BakingService { @Override @Transactional(rollbackFor = Exception.class) public JSONObject inCoolIvt(JSONObject whereJson) { - WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位点 - 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"); // 暂存位:起点 - String container_name = whereJson.getString("container_name"); // 母卷号 + // 点位点 + WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); + // 冷却区出入表 + 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"); + // 母卷号 + String container_name = whereJson.getString("container_name"); //获取人员对应的区域 UserAreaServiceImpl userAreaService = new UserAreaServiceImpl(); @@ -623,8 +685,11 @@ public class BakingServiceImpl implements BakingService { // 3.创建任务 JSONObject param = new JSONObject(); + //点位 param.put("point_code1", point_code1); + //冷却区 param.put("point_code2", jsonCooIvt.getString("full_point_code")); + //母卷 param.put("container_name", container_name); param.put("product_area", jsonPoint.getString("product_area")); 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 0a109b1..908a55e 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 @@ -235,6 +235,7 @@ public class RawFoilServiceImpl implements RawFoilService { param.put("material_code", jsonRaw.getString("container_name")); param.put("product_area", jsonSb.getString("product_area")); + //生箔区域和冷却区之前的任务创建 CallEmpReelTask callEmpReelTask = new CallEmpReelTask(); callEmpReelTask.createTask(param); } else { 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 9bb228c..6fe162f 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 @@ -264,7 +264,7 @@ public class InHotTask extends AbstractAcsTask { String currentUsername = SecurityUtils.getCurrentUsername(); String task_id = ""; - + // 1- 冷却区入烘箱 if (StrUtil.equals(form.getString("type"), "1")) { String point_code1 = form.getString("point_code1"); String point_code2 = form.getString("point_code2"); @@ -315,7 +315,7 @@ public class InHotTask extends AbstractAcsTask { WQLObject.getWQLObject("st_ivt_coolpointivt").update(cool_ivt); } - + // 2- 暂存位入烘箱 if (StrUtil.equals(form.getString("type"), "2")) { String point_code1 = form.getString("point_code1"); String point_code2 = form.getString("point_code2");