From 4a853a80cb0a61f674827066867ba36bf2fcf1fe Mon Sep 17 00:00:00 2001 From: liuxy Date: Mon, 27 Feb 2023 09:36:13 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 233dc99f4..f7c622027 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -603,8 +603,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { data.put("box_width", box_width); data.put("box_high", box_high); + String bundle_times_num = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("bundle_times_num").getValue(); Double box_length_value = Double.valueOf(box_length); - if (box_length_value >= 772) { + Double box_bundle_times_num = Double.valueOf(bundle_times_num); + + if (box_length_value >= box_bundle_times_num) { data.put("bundle_times", 3); } else { data.put("bundle_times", 2); From ff26cddbbaad3e56c6ce8424e2bd5218a32f1dec Mon Sep 17 00:00:00 2001 From: "ZHOUZ\\Noble'lift" <1014987728@qq.com> Date: Tue, 28 Feb 2023 10:08:47 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=88=86=E5=88=87=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/service/impl/MesToLmsServiceImpl.java | 72 +++++++---- .../wms/pda/mps/rest/FeedingController.java | 14 +++ .../wms/pda/mps/service/FeedingService.java | 16 +++ .../mps/service/impl/BakingServiceImpl.java | 4 +- .../mps/service/impl/FeedingServiceImpl.java | 119 +++++++++++++++++- .../mps/service/impl/RawFoilServiceImpl.java | 2 +- .../org/nl/wms/sch/tasks/CallEmpReelTask.java | 106 ++++++++-------- .../org/nl/wms/sch/tasks/CutConveyorTask.java | 27 ++-- .../java/org/nl/wms/sch/tasks/InHotTask.java | 36 +++--- .../wms/pdm/order/slittingplan/index.vue | 80 +++++++----- 10 files changed, 342 insertions(+), 134 deletions(-) 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 3c4c3e418..39d326a9a 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 @@ -468,26 +468,25 @@ public class MesToLmsServiceImpl implements MesToLmsService { try { String is_mesTolms = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_mesTolms").getValue(); + String container_name = param.getString("ContainerName"); + if (StrUtil.isEmpty(container_name)) { + throw new BadRequestException("子卷号不能为空!"); + } + + JSONObject plan_jo = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("container_name = '" + container_name + "' AND is_delete = '0'").uniqueResult(0); + + if (ObjectUtil.isEmpty(plan_jo)) { + throw new BadRequestException("未查询到该子卷号对应的分切计划!"); + } + String Attribute1 = param.getString("Attribute1"); + String Attribute2 = param.getString("Attribute2"); + + if (StrUtil.equals("1", Attribute2)) { + //更新该子卷号对应的分切计划为已呼叫 + plan_jo.put("is_call", "1"); + WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").update(plan_jo); + } if (StrUtil.equals(is_mesTolms, "1")) { - String container_name = param.getString("ContainerName"); - if (StrUtil.isEmpty(container_name)) { - throw new BadRequestException("子卷号不能为空!"); - } - - JSONObject plan_jo = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("container_name = '" + container_name + "' AND is_delete = '0'").uniqueResult(0); - - if (ObjectUtil.isEmpty(plan_jo)) { - throw new BadRequestException("未查询到该子卷号对应的分切计划!"); - } - String Attribute1 = param.getString("Attribute1"); - String Attribute2 = param.getString("Attribute2"); - - if (StrUtil.equals("1", Attribute2)) { - //更新该子卷号对应的分切计划为已呼叫 - plan_jo.put("is_call", "1"); - WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").update(plan_jo); - } - if (Attribute1.equals("0")) { result.put("RTYPE", "S"); result.put("RTMSG", "操作成功!"); @@ -743,6 +742,8 @@ public class MesToLmsServiceImpl implements MesToLmsService { JSONArray up_rows = new JSONArray(); JSONArray down_rows = new JSONArray(); + String up_qzz = ""; + String down_qzz = ""; for (int i = 0; i < param.size(); i++) { JSONObject row = param.getJSONObject(i); //查询对应的分切计划 @@ -750,6 +751,7 @@ public class MesToLmsServiceImpl implements MesToLmsService { if (ObjectUtil.isEmpty(plan_jo)) { throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup")); } + String qzzno = plan_jo.getString("qzzno"); String need_down = row.getString("Attribute1"); if (StrUtil.isEmpty(need_down)) { throw new BadRequestException("子卷:" + row.getString("ContainerGroup") + "对应的是否需要下轴字段不能为空!"); @@ -759,10 +761,38 @@ public class MesToLmsServiceImpl implements MesToLmsService { WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo); } else { if (row.getString("ContainerPosition").equals("1")) { - up_rows.add(plan_jo); + if (StrUtil.isEmpty(up_qzz)) { + up_qzz = qzzno; + up_rows.add(plan_jo); + } else { + if (!StrUtil.equals(qzzno, up_qzz)) { + down_qzz = qzzno; + down_rows.add(plan_jo); + } else { + up_rows.add(plan_jo); + } + } } if (row.getString("ContainerPosition").equals("2")) { - down_rows.add(plan_jo); + if (StrUtil.isEmpty(down_qzz)) { + if (StrUtil.isEmpty(up_qzz)) { + down_qzz = qzzno; + down_rows.add(plan_jo); + } else { + if (StrUtil.equals(up_qzz, qzzno)) { + up_rows.add(plan_jo); + } else { + down_qzz = qzzno; + down_rows.add(plan_jo); + } + } + } else { + if (StrUtil.equals(down_qzz, qzzno)) { + down_rows.add(plan_jo); + } else { + up_rows.add(plan_jo); + } + } } } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/FeedingController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/FeedingController.java index 94819e294..72b33a8c9 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/FeedingController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/FeedingController.java @@ -41,4 +41,18 @@ public class FeedingController { public ResponseEntity confirm(@RequestBody JSONObject whereJson) { return new ResponseEntity<>(feedingService.confirm(whereJson), HttpStatus.OK); } + + @PostMapping("/queryPoint") + @Log("扫码起点获取母卷") + @ApiOperation("扫码起点获取母卷") + public ResponseEntity queryPoint(@RequestBody JSONObject whereJson) { + return new ResponseEntity<>(feedingService.queryPoint(whereJson), HttpStatus.OK); + } + + @PostMapping("/handleConfirm") + @Log("人工呼叫母卷确认") + @ApiOperation("人工呼叫母卷确认") + public ResponseEntity handleConfirm(@RequestBody JSONObject whereJson) { + return new ResponseEntity<>(feedingService.handleConfirm(whereJson), HttpStatus.OK); + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/FeedingService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/FeedingService.java index 4f985f0a4..0670e61f6 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/FeedingService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/FeedingService.java @@ -21,4 +21,20 @@ public interface FeedingService { */ JSONObject confirm(JSONObject whereJson); + /** + * 套轴确认 + * + * @param whereJson / + * @return JSONObject + */ + JSONObject queryPoint(JSONObject whereJson); + + /** + * 套轴确认 + * + * @param whereJson / + * @return JSONObject + */ + JSONObject handleConfirm(JSONObject whereJson); + } 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 0f33d1579..5ed6260bf 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 @@ -174,8 +174,8 @@ public class BakingServiceImpl implements BakingService { JSONObject jsonMap = new JSONObject(); jsonMap.put("flag", "1"); jsonMap.put("product_area", product_area); - jsonMap.put("min_temperature", NumberUtil.sub(temperature, temperature_lose)); - jsonMap.put("max_temperature", NumberUtil.add(temperature, temperature_lose)); + jsonMap.put("min_temperature", NumberUtil.sub(temperature, temperature_lose)+""); + jsonMap.put("max_temperature", NumberUtil.add(temperature, temperature_lose)+""); jsonMap.put("point_location", map.getString("point_location")); JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0); if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有合适温度的空位!"); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/FeedingServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/FeedingServiceImpl.java index 390d606a8..a692e0500 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/FeedingServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/FeedingServiceImpl.java @@ -211,9 +211,126 @@ public class FeedingServiceImpl implements FeedingService { } JSONObject jo = new JSONObject(); - jo.put("message", "查询成功!"); + jo.put("message", "操作成功!"); return jo; } + @Override + public JSONObject queryPoint(JSONObject form) { + String point_code = form.getString("point_code"); + if (StrUtil.isEmpty(point_code)) { + throw new BadRequestException("输入的点位不能为空!"); + } + + JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0); + + if (ObjectUtil.isEmpty(cool_jo)) { + throw new BadRequestException("请输入或者扫描冷却区满轴位的点位!"); + } + + if (!StrUtil.equals(cool_jo.getString("full_point_status"), "02")) { + throw new BadRequestException("该点位上不存在母卷!"); + } + + JSONObject result = new JSONObject(); + result.put("content", cool_jo); + result.put("message", "查询成功!"); + return result; + } + + @Transactional(rollbackFor = Exception.class) + @Override + public JSONObject handleConfirm(JSONObject form) { + String point_code = form.getString("point_code"); + String next_point_code = form.getString("next_point_code"); + + if (StrUtil.isEmpty(point_code)) { + throw new BadRequestException("输入的起点不能为空!"); + } + + JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0); + + if (ObjectUtil.isEmpty(cool_jo)) { + throw new BadRequestException("请输入或者扫描冷却区满轴位的点位做为起点!"); + } + + if (!StrUtil.equals(cool_jo.getString("full_point_status"), "02")) { + throw new BadRequestException("该点位上不存在母卷!"); + } + + //查询该分切机对应的点位 + JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + next_point_code + "'").uniqueResult(0); + + if (ObjectUtil.isEmpty(cut_jo)) { + throw new BadRequestException("请扫描或者输入分切区域的满轴点位做为终点!"); + } + + if (StrUtil.isNotEmpty(cut_jo.getString("container_name")) || cut_jo.getString("full_point_status").equals("02")) { + throw new BadRequestException("该分切机对应的上料位存在母卷,不能下发搬运任务!"); + } + + JSONObject jo = new JSONObject(); + if (StrUtil.equals("01", cut_jo.getString("empty_point_code"))) { + jo.put("point_code1", point_code); + jo.put("point_code2", next_point_code); + jo.put("vehicle_code", cool_jo.getString("container_name")); + jo.put("product_area", cut_jo.getString("product_area")); + jo.put("task_type", "010302"); + } else { + jo.put("point_code1", point_code); + jo.put("point_code2", next_point_code); + jo.put("point_code3", cut_jo.getString("empty_point_code")); + jo.put("point_code4", cool_jo.getString("empty_point_code")); + jo.put("vehicle_code", cool_jo.getString("container_name")); + jo.put("vehicle_code2", cut_jo.getString("empty_vehicle_code")); + jo.put("product_area", cut_jo.getString("product_area")); + jo.put("task_type", "010301"); + } + + //查询该母卷号对应的生箔信息 + JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + cool_jo.getString("container_name") + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(raw_jo)) { + throw new BadRequestException("未查询到母卷:" + cool_jo.getString("container_name") + ",对应的生箔信息!"); + } + + JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + raw_jo.getString("product_name") + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(mater_jo)) { + throw new BadRequestException("未查询到物料:" + raw_jo.getString("product_name") + "基础信息!"); + } + + AbstractAcsTask task = new CoolCutTask(); + String task_id = task.createTask(jo); + + //生成半成品出库单据 + String 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", mater_jo.getString("material_id")); + jsonCool.put("pcsn", cool_jo.getString("container_name")); + jsonCool.put("bill_status", "50"); + jsonCool.put("task_id", task_id); + jsonCool.put("qty_unit_id", "1"); + jsonCool.put("start_point_code", cool_jo.getString("full_point_code")); + jsonCool.put("end_point_code", cut_jo.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()); + WQLObject.getWQLObject("ST_IVT_CoolRegionIO").insert(jsonCool); + + JSONObject result = new JSONObject(); + result.put("message", "操作成功!"); + return jo; + } } 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 cb464ec39..7e1d16a39 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 @@ -287,7 +287,7 @@ public class RawFoilServiceImpl implements RawFoilService { JSONObject task_jo = WQLObject.getWQLObject("SCH_BASE_Task").query("material_code = '" + container_name + "' and task_status <> '07' AND is_delete = '0'").uniqueResult(0); // 查询生箔点位库存表 - JSONObject jsonSb = rawTab.query("ext_code = '" + jsonRaw.getString("resource_name") + "'and is_used = '1'").uniqueResult(0); + JSONObject jsonSb = WQLObject.getWQLObject("st_ivt_sbpointivt").query("ext_code = '" + jsonRaw.getString("resource_name") + "'and is_used = '1'").uniqueResult(0); if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位不存在"); //下发ACS,执行取满放空的AGV动作 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 21201a5de..db0e71b55 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 @@ -46,10 +46,10 @@ public class CallEmpReelTask extends AbstractAcsTask { String product_area = json.getString("product_area"); String agv_system_type = ""; - if (product_area.equals("A1") || product_area.equals("A2")){ + if (product_area.equals("A1") || product_area.equals("A2")) { agv_system_type = "2"; } - if (product_area.equals("A3") || product_area.equals("A4")){ + if (product_area.equals("A3") || product_area.equals("A4")) { agv_system_type = "3"; } AcsTaskDto dto = AcsTaskDto.builder() @@ -87,7 +87,7 @@ public class CallEmpReelTask extends AbstractAcsTask { //更新车号和重量 String car_no = taskObj.getString("car_no"); - if (StrUtil.isNotEmpty(car_no)){ + if (StrUtil.isNotEmpty(car_no)) { JSONObject jsonRaw = rawTab.query("container_name ='" + jsonTask.getString("material_code") + "' AND status <> '09' AND is_delete = '0'").uniqueResult(0); jsonRaw.put("agvno", car_no); rawTab.update(jsonRaw); @@ -96,12 +96,12 @@ public class CallEmpReelTask extends AbstractAcsTask { 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)); + jsonRaw.put("productin_qty", weight); rawTab.update(jsonRaw); } if (StrUtil.equals(status, "0")) { // 更新删除字段 - jsonTask.put("is_delete","1"); + jsonTask.put("is_delete", "1"); jsonTask.put("update_time", DateUtil.now()); taskTab.update(jsonTask); @@ -145,7 +145,7 @@ public class CallEmpReelTask extends AbstractAcsTask { // 判断是两个点位的任务还是四个点位的任务 if (ObjectUtil.isEmpty(point_code3)) { // 判断是取满 or 取空 :取满起点是生箔区域、取空起点是冷却区域 - JSONObject jsonSbIvt = sbTab.query("point_code = '" + point_code1 + "'").uniqueResult(0); + JSONObject jsonSbIvt = sbTab.query("point_code = '" + point_code1.substring(0, point_code1.length() - 2) + "'").uniqueResult(0); if (ObjectUtil.isNotEmpty(jsonSbIvt)) { // 取满 JSONObject jsonCoolIvt = ivtTab.query("full_point_code = '" + point_code2 + "'").uniqueResult(0); @@ -158,17 +158,17 @@ public class CallEmpReelTask extends AbstractAcsTask { ivtTab.update(jsonCoolIvt); //更新母卷工单状态 - HashMap map = new HashMap<>(); + HashMap map = new HashMap<>(); map.put("status", "09"); map.put("realend_time", DateUtil.now()); - map.put("update_optid",currentUserId+""); - map.put("update_optname",currentUsername); + map.put("update_optid", currentUserId + ""); + map.put("update_optname", currentUsername); map.put("finish_type", "01"); - map.put("update_time",DateUtil.now()); - WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map,"container_name = '"+jsonTask.getString("material_code")+"'"); + map.put("update_time", DateUtil.now()); + WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + jsonTask.getString("material_code") + "'"); } else { // 取空 - JSONObject jsonCoolIvt = ivtTab.query("full_point_code = '" + point_code1 + "'").uniqueResult(0); + JSONObject jsonCoolIvt = ivtTab.query("empty_point_code = '" + point_code1 + "'").uniqueResult(0); jsonCoolIvt.put("empty_point_status", "01"); jsonCoolIvt.put("empty_vehicle_code", ""); ivtTab.update(jsonCoolIvt); @@ -179,9 +179,9 @@ public class CallEmpReelTask extends AbstractAcsTask { JSONObject jsonIvt = ivtTab.query("empty_point_code ='" + point_code1 + "'").uniqueResult(0); if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("未找到可用点位:" + point_code1); // 校验终点是否存在 - JSONObject nextDto = sbTab.query("point_code ='" + point_code2 + "'").uniqueResult(0); + /*JSONObject nextDto = sbTab.query("point_code ='" + point_code2.substring(point_code2.length()-2) + "'").uniqueResult(0); if (ObjectUtil.isEmpty(nextDto)) - throw new BadRequestException("未找到可用点位:" + jsonTask.getString("point_code2")); + throw new BadRequestException("未找到可用点位:" + jsonTask.getString("point_code2"));*/ // 更新冷却库存状态 jsonIvt.put("empty_point_status", "01"); @@ -194,14 +194,14 @@ public class CallEmpReelTask extends AbstractAcsTask { // 更新工单状态为完成 //更新母卷工单状态 - HashMap map = new HashMap<>(); + HashMap map = new HashMap<>(); map.put("status", "09"); map.put("realend_time", DateUtil.now()); - map.put("update_optid",currentUserId+""); - map.put("update_optname",currentUsername); + map.put("update_optid", currentUserId + ""); + map.put("update_optname", currentUsername); map.put("finish_type", "01"); - map.put("update_time",DateUtil.now()); - WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map,"container_name = '"+jsonTask.getString("material_code")+"'"); + map.put("update_time", DateUtil.now()); + WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + jsonTask.getString("material_code") + "'"); // 更新冷却库存状态 jsonIvt2.put("full_point_status", "02"); @@ -211,38 +211,36 @@ public class CallEmpReelTask extends AbstractAcsTask { jsonIvt2.put("ivt_qty", jsonRaw.getString("productin_qty")); ivtTab.update(jsonIvt2); +// 插入入库单 + JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").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", "0"); + 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", "50"); + jsonRegion.put("start_point_code", point_code2); + 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()); + jsonRegion.put("update_optid", currentUserId); + jsonRegion.put("update_optname", currentUsername); + jsonRegion.put("update_time", DateUtil.now()); + jsonRegion.put("confirm_optid", currentUserId); + jsonRegion.put("confirm_optname", currentUsername); + jsonRegion.put("confirm_time", DateUtil.now()); + coolTab.insert(jsonRegion); } - - // 插入入库单 - JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").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", "0"); - 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", "50"); - jsonRegion.put("start_point_code", point_code2); - 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()); - jsonRegion.put("update_optid", currentUserId); - jsonRegion.put("update_optname", currentUsername); - jsonRegion.put("update_time", DateUtil.now()); - jsonRegion.put("confirm_optid", currentUserId); - jsonRegion.put("confirm_optname", currentUsername); - jsonRegion.put("confirm_time", DateUtil.now()); - coolTab.insert(jsonRegion); } } @@ -284,7 +282,7 @@ public class CallEmpReelTask extends AbstractAcsTask { JSONObject json = new JSONObject(); json.put("task_id", IdUtil.getSnowflake(1, 1).nextId()); - json.put("task_code", IdUtil.getSnowflake(1,1).nextId()); + json.put("task_code", IdUtil.getSnowflake(1, 1).nextId()); 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")); @@ -299,14 +297,16 @@ public class CallEmpReelTask extends AbstractAcsTask { json.put("create_name", currentUsername); json.put("create_time", DateUtil.now()); //根据类型获取对应的任务优先级 - JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag","3").addParam("task_type",json.getString("task_type")).process().uniqueResult(0); - if (ObjectUtil.isEmpty(priority_jo)){ + JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", json.getString("task_type")).process().uniqueResult(0); + if (ObjectUtil.isEmpty(priority_jo)) { json.put("priority", "1"); - }else { + } else { json.put("priority", priority_jo.getString("value")); } if (form.getString("task_type").equals("010101")) { json.put("acs_task_type", "1"); + } else { + json.put("acs_task_type", "3"); } tab.insert(json); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CutConveyorTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CutConveyorTask.java index 37ea36732..4726c265b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CutConveyorTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CutConveyorTask.java @@ -104,18 +104,21 @@ public class CutConveyorTask extends AbstractAcsTask { jsonTask.put("update_time", DateUtil.now()); taskTab.update(jsonTask); - //调用MES接口,通知MES运输中 - LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class); - JSONArray rows = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("qzzno = '" + jsonTask.getString("vehicle_code") + "' AND is_child_tz_ok = '1' AND is_delete ='0' AND status < '09'").getResultJSONArray(0); - for (int i = 0; i < rows.size(); i++) { - JSONObject row = rows.getJSONObject(i); - JSONObject jo = new JSONObject(); - jo.put("container_name", row.getString("container_name")); - jo.put("is_send", "1"); - //判断该接口是否需要回传 - JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'airSwellWithPaperTubeAssComplete'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(back_jo) && back_jo.getString("is_back").equals("1")) { - lmsToMesService.airSwellWithPaperTubeAssComplete(jo); + //只有输送入的时候才调用MES + if (jsonTask.getString("task_type").equals("010402")) { + //调用MES接口,通知MES运输中 + LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class); + JSONArray rows = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("qzzno = '" + jsonTask.getString("vehicle_code") + "' AND is_child_tz_ok = '1' AND is_delete ='0' AND status < '09'").getResultJSONArray(0); + for (int i = 0; i < rows.size(); i++) { + JSONObject row = rows.getJSONObject(i); + JSONObject jo = new JSONObject(); + jo.put("container_name", row.getString("container_name")); + jo.put("is_send", "1"); + //判断该接口是否需要回传 + JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'airSwellWithPaperTubeAssComplete'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(back_jo) && back_jo.getString("is_back").equals("1")) { + lmsToMesService.airSwellWithPaperTubeAssComplete(jo); + } } } } 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 54e5202ed..cce0f3b22 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 @@ -45,10 +45,10 @@ public class InHotTask extends AbstractAcsTask { String product_area = json.getString("product_area"); String agv_system_type = ""; - if (product_area.equals("A1") || product_area.equals("A2")){ + if (product_area.equals("A1") || product_area.equals("A2")) { agv_system_type = "2"; } - if (product_area.equals("A3") || product_area.equals("A4")){ + if (product_area.equals("A3") || product_area.equals("A4")) { agv_system_type = "3"; } @@ -63,10 +63,10 @@ public class InHotTask extends AbstractAcsTask { .priority(json.getString("priority")) .remark(json.getString("remark")) .build(); - if (StrUtil.isNotEmpty(json.getString("point_code3"))){ + if (StrUtil.isNotEmpty(json.getString("point_code3"))) { dto.setNext_device_code(json.getString("point_code3")); dto.setPut_device_code(json.getString("point_code2")); - }else { + } else { dto.setNext_device_code(json.getString("point_code2")); } @@ -91,7 +91,7 @@ public class InHotTask extends AbstractAcsTask { if (StrUtil.equals(status, "0")) { // 更新删除字段 - jsonTask.put("is_delete","1"); + jsonTask.put("is_delete", "1"); jsonTask.put("update_time", DateUtil.now()); taskTab.update(jsonTask); @@ -202,7 +202,7 @@ public class InHotTask extends AbstractAcsTask { //判断该接口是否需要回传 JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollBakeInBound'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(back_jo) && back_jo.getString("is_back").equals("1")){ + if (ObjectUtil.isNotEmpty(back_jo) && back_jo.getString("is_back").equals("1")) { new LmsToMesServiceImpl().momRollBakeInBound(param); } } @@ -244,7 +244,7 @@ public class InHotTask extends AbstractAcsTask { } JSONObject json = new JSONObject(); json.put("task_id", IdUtil.getSnowflake(1, 1).nextId()); - json.put("task_code", IdUtil.getSnowflake(1,1).nextId()); + json.put("task_code", IdUtil.getSnowflake(1, 1).nextId()); json.put("task_type", "010201"); json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode()); json.put("point_code1", form.getString("point_code1")); @@ -255,17 +255,21 @@ public class InHotTask extends AbstractAcsTask { json.put("sort_seq", "1"); json.put("handle_class", THIS_CLASS); json.put("create_id", currentUserId); - json.put("material_code",form.getString("material_code")); + json.put("material_code", form.getString("material_code")); json.put("create_name", currentUsername); json.put("create_time", DateUtil.now()); //根据类型获取对应的任务优先级 - JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag","3").addParam("task_type",json.getString("task_type")).process().uniqueResult(0); - if (ObjectUtil.isEmpty(priority_jo)){ + JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", json.getString("task_type")).process().uniqueResult(0); + if (ObjectUtil.isEmpty(priority_jo)) { json.put("priority", "1"); - }else { + } else { json.put("priority", priority_jo.getString("value")); } - json.put("acs_task_type", "8"); + if (StrUtil.isNotEmpty(form.getString("point_code3"))) { + json.put("acs_task_type", "8"); + } else { + json.put("acs_task_type", "6"); + } tab.insert(json); task_id = json.getString("task_id"); @@ -292,7 +296,7 @@ public class InHotTask extends AbstractAcsTask { JSONObject json = new JSONObject(); json.put("task_id", IdUtil.getSnowflake(1, 1).nextId()); - json.put("task_code", IdUtil.getSnowflake(1,1).nextId()); + json.put("task_code", IdUtil.getSnowflake(1, 1).nextId()); json.put("task_type", "010203"); json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode()); json.put("point_code1", form.getString("point_code1")); @@ -305,10 +309,10 @@ public class InHotTask extends AbstractAcsTask { json.put("create_name", currentUsername); json.put("create_time", DateUtil.now()); //根据类型获取对应的任务优先级 - JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag","3").addParam("task_type",json.getString("task_type")).process().uniqueResult(0); - if (ObjectUtil.isEmpty(priority_jo)){ + JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", json.getString("task_type")).process().uniqueResult(0); + if (ObjectUtil.isEmpty(priority_jo)) { json.put("priority", "1"); - }else { + } else { json.put("priority", priority_jo.getString("value")); } json.put("acs_task_type", "8"); diff --git a/lms/nladmin-ui/src/views/wms/pdm/order/slittingplan/index.vue b/lms/nladmin-ui/src/views/wms/pdm/order/slittingplan/index.vue index 76fcd6e41..c7a3ff2da 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/order/slittingplan/index.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/order/slittingplan/index.vue @@ -113,33 +113,6 @@ - - - - - - - - - - - - @@ -196,11 +169,57 @@ + + + + + + + + + + + + + + + + + + + + + - @@ -438,6 +457,8 @@ + + @@ -628,6 +649,9 @@ export default { }, formatChildPsName(row) { return this.dict.label.IS_OR_NOT[row.is_child_ps_ok] + }, + formatChildCallName(row) { + return this.dict.label.IS_OR_NOT[row.is_call] } } } From 1bd739f3801f87a4dd06124a6f968b53018c8d57 Mon Sep 17 00:00:00 2001 From: liuxy Date: Tue, 28 Feb 2023 12:35:17 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT04.wql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT04.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT04.wql index e361b9231..213e9dc4f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT04.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/ST_OUTIVT04.wql @@ -257,6 +257,8 @@ AND attr.out_order_seq > 输入.out_order_seq AND IFNULL( attr.storagevehicle_code, '' ) <> '' + ORDER BY out_order_seq DESC + ENDSELECT ENDQUERY ENDIF @@ -274,6 +276,8 @@ AND attr.out_order_seq < 输入.out_order_seq AND IFNULL( attr.storagevehicle_code, '' ) <> '' + ORDER BY out_order_seq + ENDSELECT ENDQUERY ENDIF From 9c77b9f963e8f5543630972aa32eaa7f6818d749 Mon Sep 17 00:00:00 2001 From: liuxy Date: Tue, 28 Feb 2023 14:16:28 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inbill/service/RawAssistIStorService.java | 2 + .../impl/RawAssistIStorServiceImpl.java | 294 ++++++++++++++++++ .../st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql | 13 + .../service/impl/CheckOutBillServiceImpl.java | 6 +- 4 files changed, 314 insertions(+), 1 deletion(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/RawAssistIStorService.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/RawAssistIStorService.java index 59532a500..996f51c6a 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/RawAssistIStorService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/RawAssistIStorService.java @@ -58,4 +58,6 @@ public interface RawAssistIStorService { JSONObject autoDis(JSONObject whereJson); + JSONObject autoDisMove(JSONObject whereJson); + } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java index d4b17be9b..72f62961a 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java @@ -1093,6 +1093,300 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { return struct_jo; } + @Override + public JSONObject autoDisMove(JSONObject whereJson) { + /* + * 分配逻辑: + * 1、先查找该木箱内属于什么物料、订单,定位到具体的块、排,查看是否存在空位 + * a、存在的话,优先放在这一块这一排中(遍历) + * b、不存在则根据该订单物料大概数量、选择数量相近的一个空巷道 + * 1)存在空巷道 + * 2)不存在,则找一个双通有空位置、数量相近的巷道 + * */ + + + JSONObject struct_jo = new JSONObject(); + + String box_no = whereJson.getString("box_no"); + + String sect_id = whereJson.getString("sect_id"); + + String col_num = whereJson.getString("layer_num"); // 转库时用 + + JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + box_no + "' AND status < 3").uniqueResult(0); + + String material_code = sub_jo.getString("product_name"); + + String sale_order_name = sub_jo.getString("sale_order_name"); + + HashMap row_map = new HashMap<>(); + row_map.put("material_code", material_code); + row_map.put("sale_order_name", sale_order_name); + row_map.put("col_num", col_num); + row_map.put("sect_id", sect_id); + row_map.put("flag", "11"); + //查询到当前可用的巷道 + JSONArray rowArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0); + + for (int i = 0; i < rowArr.size(); i++) { + JSONObject row_jo = rowArr.getJSONObject(i); + + String block_num = row_jo.getString("block_num"); + String row_num = row_jo.getString("row_num"); + String placement_type = row_jo.getString("placement_type"); + + // 判断此排是否有除:入库锁、移入锁以外的锁 + JSONArray isLock = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0); + if (ObjectUtil.isEmpty(isLock)) { + if (placement_type.equals("02")) { + // 左通 + struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0); + break; + } else if (placement_type.equals("03")) { + // 右通 + struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0); + break; + } else { + // 双通 + + // 先倒序找到第一个木箱、判断上一个是否有货位 + JSONObject jsonDescBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0); + + JSONObject jsonDescStruct = new JSONObject(); + if (ObjectUtil.isNotEmpty(jsonDescBox)) { + String out_order_seq = jsonDescBox.getString("out_order_seq"); + jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0); + } else { + // 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位 + JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) { + String out_order_seq = jsonDescEmpStruct.getString("out_order_seq"); + jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0); + } + } + + if (ObjectUtil.isNotEmpty(jsonDescStruct)) { + struct_jo = jsonDescStruct; + break; + } else { + // 没有就正序找到第一个物料、判断上一个是否有货位 + JSONObject jsonAscBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0); + + JSONObject jsonAscStruct = new JSONObject(); + if (ObjectUtil.isNotEmpty(jsonAscBox)) { + String out_order_seq2 = jsonAscBox.getString("out_order_seq"); + // 上一个货位顺序号 + jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0); + } else { + JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) { + String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq"); + jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0); + } + + } + if (ObjectUtil.isNotEmpty(jsonAscStruct)) { + struct_jo = jsonAscStruct; + break; + } else { + // 说明这排有任务在执行,新开一排 + //根据分切计划查询该订单物料大概还有多少未入 + row_map.put("flag", "12"); + JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0); + if (ObjectUtil.isEmpty(plan_rows)) { + plan_rows = new JSONArray(); + } + //查询该销售订单及行号有多少个生成状态的箱子 + row_map.put("flag", "27"); + JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0); + if (ObjectUtil.isEmpty(box_rows)) { + box_rows = new JSONArray(); + } + int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size(); + + //查询数量与订单物料箱子数量相近的一排 + JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num").process().uniqueResult(0); + if (ObjectUtil.isNotEmpty(empty_row)) { + String block_num2 = empty_row.getString("block_num"); + String row_num2 = empty_row.getString("row_num"); + String placement_type2 = empty_row.getString("placement_type"); + + if (placement_type.equals("02")) { + struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0); + break; + } else { + struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0); + break; + } + } else { + //如果查询不到空的一排,则查询有空位双通的一排 + JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0); + + for (int j = 0; j < haveArr.size(); j++) { + JSONObject have_row = haveArr.getJSONObject(j); + + String block_num3 = have_row.getString("block_num"); + String row_num3 = have_row.getString("row_num"); + + JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0); + + if (ObjectUtil.isEmpty(isLock2)) { + // 先倒序找到第一个木箱、判断上一个是否有货位 + JSONObject jsonDescBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0); + + JSONObject jsonDescStruct2 = new JSONObject(); + if (ObjectUtil.isNotEmpty(jsonDescBox2)) { + String out_order_seq = jsonDescBox2.getString("out_order_seq"); + jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0); + } else { + // 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位 + JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) { + String out_order_seq = jsonDescEmpStruct.getString("out_order_seq"); + jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0); + } + } + + if (ObjectUtil.isNotEmpty(jsonDescStruct2)) { + struct_jo = jsonDescStruct2; + break; + } else { + // 没有就正序找到第一个物料、判断上一个是否有货位 + JSONObject jsonAscBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0); + + JSONObject jsonAscStruct2 = new JSONObject(); + if (ObjectUtil.isNotEmpty(jsonAscBox2)) { + String out_order_seq2 = jsonAscBox2.getString("out_order_seq"); + // 上一个货位顺序号 + jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0); + } else { + JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) { + String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq"); + jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0); + } + + } + if (ObjectUtil.isNotEmpty(jsonAscStruct2)) { + struct_jo = jsonAscStruct2; + break; + } + } + } else { + continue; + } + } + } + } + } + } + } else { + continue; + } + } + + if (ObjectUtil.isEmpty(rowArr) || ObjectUtil.isEmpty(struct_jo)) { + //如果不存在相同订单物料的巷道 或者未找到相同物料订单号巷道中的货位 则 + + //根据分切计划查询该订单物料大概还有多少未入 + row_map.put("flag", "12"); + JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0); + if (ObjectUtil.isEmpty(plan_rows)) { + plan_rows = new JSONArray(); + } + //查询该销售订单及行号有多少个生成状态的箱子 + row_map.put("flag", "27"); + JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0); + if (ObjectUtil.isEmpty(box_rows)) { + box_rows = new JSONArray(); + } + int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size(); + + //查询数量与订单物料箱子数量相近的一排 + JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num").process().uniqueResult(0); + if (ObjectUtil.isNotEmpty(empty_row)) { + String block_num = empty_row.getString("block_num"); + String row_num = empty_row.getString("row_num"); + String placement_type = empty_row.getString("placement_type"); + + if (placement_type.equals("02")) { + struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0); + } else { + struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0); + } + } else { + + //如果查询不到空的一排,则查询有空位双通的一排 + JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0); + for (int j = 0; j < haveArr.size(); j++) { + JSONObject have_row = haveArr.getJSONObject(j); + + String block_num3 = have_row.getString("block_num"); + String row_num3 = have_row.getString("row_num"); + + JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0); + + if (ObjectUtil.isEmpty(isLock2)) { + // 先倒序找到第一个木箱、判断上一个是否有货位 + JSONObject jsonDescBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0); + + JSONObject jsonDescStruct2 = new JSONObject(); + if (ObjectUtil.isNotEmpty(jsonDescBox2)) { + String out_order_seq = jsonDescBox2.getString("out_order_seq"); + jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0); + } else { + // 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位 + JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) { + String out_order_seq = jsonDescEmpStruct.getString("out_order_seq"); + jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0); + } + } + + if (ObjectUtil.isNotEmpty(jsonDescStruct2)) { + struct_jo = jsonDescStruct2; + break; + } else { + // 没有就正序找到第一个物料、判断上一个是否有货位 + JSONObject jsonAscBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0); + + JSONObject jsonAscStruct2 = new JSONObject(); + if (ObjectUtil.isNotEmpty(jsonAscBox2)) { + String out_order_seq2 = jsonAscBox2.getString("out_order_seq"); + // 上一个货位顺序号 + jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0); + } else { + JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) { + String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq"); + jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0); + } + + } + if (ObjectUtil.isNotEmpty(jsonAscStruct2)) { + struct_jo = jsonAscStruct2; + break; + } + } + } else { + continue; + } + } + } + } + + if (ObjectUtil.isEmpty(struct_jo)) { + throw new BadRequestException("未查询到可用的仓位!"); + } + return struct_jo; + } + public JSONObject queryEmpStruct(JSONObject whereJson) { JSONObject struct_jo = new JSONObject(); String sect_id = whereJson.getString("sect_id"); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql index f07a9928d..e101b56ac 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql @@ -22,6 +22,7 @@ 输入.stor_id TYPEAS s_string 输入.sap_pcsn TYPEAS s_string 输入.pcsn TYPEAS s_string + 输入.col_num TYPEAS s_string 输入.bill_status TYPEAS s_string 输入.bill_type TYPEAS s_string 输入.box_no TYPEAS s_string @@ -452,6 +453,9 @@ ENDOPTION OPTION 输入.sale_order_name <> "" sub.sale_order_name = 输入.sale_order_name + ENDOPTION + OPTION 输入.col_num <> "" + sa2.layer_num = 输入.col_num ENDOPTION GROUP BY sa2.block_num,sa2.row_num,sa2.placement_type @@ -498,6 +502,11 @@ sa.is_delete = '0' AND is_used = '1' AND sa.sect_id = 输入.sect_id + + OPTION 输入.col_num <> "" + sa.layer_num = 输入.col_num + ENDOPTION + GROUP BY sa.block_num, sa.row_num, @@ -553,6 +562,10 @@ AND is_used = '1' AND placement_type = '01' AND sa.sect_id = 输入.sect_id + + OPTION 输入.col_num <> "" + sa.layer_num = 输入.col_num + ENDOPTION GROUP BY sa.block_num, sa.row_num, diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java index 5b9e9d9e4..2e22ec9b2 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java @@ -3396,12 +3396,15 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { public void createMove(JSONObject whereJson) { //任务表 WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task"); + WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr"); JSONArray jsonAllBlockPoint = whereJson.getJSONArray("jsonAllBlockPoint"); for (int i = 0; i < jsonAllBlockPoint.size(); i++) { JSONObject json = jsonAllBlockPoint.getJSONObject(i); + JSONObject jsonAttr = attrTab.query("struct_code = '" + json.getString("struct_code") + "'").uniqueResult(0); + JSONObject mapParam = new JSONObject();// 生成移库单传入参数 JSONArray table = new JSONArray(); // 明细参数 mapParam.put("bill_status", "10"); @@ -3417,7 +3420,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { JSONObject moveParam = new JSONObject(); moveParam.put("box_no", json.getString("storagevehicle_code")); moveParam.put("sect_id", RegionTypeEnum.ZZ01.getId()); - JSONObject jsonMove = rawAssistIStorService.autoDis(moveParam); + moveParam.put("layer_num", jsonAttr.getString("layer_num")); + JSONObject jsonMove = rawAssistIStorService.autoDisMove(moveParam); // 查询移出货位的库存物料 JSONObject jsonMoveIvt = WQL.getWO("ST_OUTIVT03") .addParam("flag", "6") From 0c3075584d956b2132c2e8bb77ac5b2d79eb5a32 Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Tue, 28 Feb 2023 18:39:32 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../run/TwoNDCSocketConnectionAutoRun.java | 31 ++ .../device/device_driver/DriverTypeEnum.java | 4 +- .../agv/ndctwo/AgvNdcTwoDeviceDriver.java | 50 ++- .../OvenGantryManipulatorDeviceDriver.java | 46 ++- .../SiemensConveyorLabelingDeviceDriver.java | 16 +- .../SlitTwoManipulatorDeviceDriver.java | 15 - .../standard_autodoor/ItemProtocol.java | 82 ++++ .../StandardAutodoorDefination.java | 63 ++++ .../StandardAutodoorDeviceDriver.java | 69 ++++ ...CoveyorControlWithScannerDeviceDriver.java | 32 +- .../standard_inspect_site/ItemProtocol.java | 18 +- .../StandardInspectSiteDefination.java | 14 +- .../StandardInspectSiteDeviceDriver.java | 301 ++------------- .../wms/service/impl/WmsToAcsServiceImpl.java | 26 +- .../service/InstructionService.java | 17 +- .../service/impl/InstructionServiceImpl.java | 130 ++++++- .../task/service/impl/TaskServiceImpl.java | 29 +- .../modules/quartz/task/AutoCreateInst.java | 3 +- .../src/views/acs/device/config.vue | 4 +- .../acs/device/driver/standard_autodoor.vue | 352 ++++++++++++++++++ .../src/views/acs/instruction/index.vue | 17 +- acs/nladmin-ui/src/views/acs/task/index.vue | 33 +- 22 files changed, 931 insertions(+), 421 deletions(-) create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/ItemProtocol.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutodoorDefination.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutodoorDeviceDriver.java create mode 100644 acs/nladmin-ui/src/views/acs/device/driver/standard_autodoor.vue diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java index fb3cf06ac..574ababaf 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java @@ -8,6 +8,7 @@ import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver; import org.nl.acs.device_driver.basedriver.agv.ndctwo.AgvNdcTwoDeviceDriver; +import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.instruction.service.InstructionService; @@ -132,6 +133,8 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { String device_code = null; String old_device_code = null; String emptyNum = null; + //自动门 + StandardAutodoorDeviceDriver standardAutodoorDeviceDriver; if (agvaddr != 0) { old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); if (StrUtil.contains(old_device_code, "-")) { @@ -187,6 +190,34 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { instructionService.cancelNOSendAgv(inst.getInstruction_id()); } data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } else if (phase == 0x50) { + if (ObjectUtil.isEmpty(device_code)) { + log.info(agvaddr + "对应设备号为空!"); + return; + } + if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { + standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); + standardAutodoorDeviceDriver.writing("to_open","1"); + standardAutodoorDeviceDriver.writing("to_close","0"); + if(standardAutodoorDeviceDriver.getOpen() == 1){ + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } + } + + } else if (phase == 0x51) { + if (ObjectUtil.isEmpty(device_code)) { + log.info(agvaddr + "对应设备号为空!"); + return; + } + if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { + standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); + standardAutodoorDeviceDriver.writing("to_close","1"); + standardAutodoorDeviceDriver.writing( + "to_open","0"); + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + + } + } else { //上报异常信息 //(不需要WCS反馈) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index 8dc24067a..7ba3fb466 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -47,7 +47,9 @@ public enum DriverTypeEnum { SIEMENS_ONEFLOOR_AGV_CONVEYOR(17, "siemens_onefloor_agv_conveyor", "西门子-1LAGV-输送机驱动", "conveyor"), - PHOTOELECTRIC_INSPECTION_SITE(19, "photoelectric_inspection_site", "光电-检测站点", "conveyor"); + PHOTOELECTRIC_INSPECTION_SITE(19, "photoelectric_inspection_site", "光电-检测站点", "conveyor"), + + STANDARD_AUTODOOR(20, "standard_autodoor", "标准版-自动门", "autodoor"); //驱动索引 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index 1783d0493..fea7bbc2b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -12,6 +12,8 @@ import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver; +import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver; +import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver; import org.nl.acs.device_driver.driver.AbstractDeviceDriver; @@ -114,6 +116,10 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic StandardStorageDeviceDriver standardStorageDeviceDriver; //普通-光电检测 PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver; + //标准-光电检测 + StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; + //自动门 + StandardAutodoorDeviceDriver standardAutodoorDeviceDriver; if (phase == 0x02) { if (ObjectUtil.isEmpty(inst)) { @@ -184,6 +190,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) device.getDeviceDriver(); if(photoelectricInspectionSiteDeviceDriver.getMove() == 1) data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + standardInspectSiteDeviceDriver.writing("to_command","1"); + if(standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1){ + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -240,6 +252,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic this.setPhase(phase); + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + standardInspectSiteDeviceDriver.writing("to_command","0"); + if(standardInspectSiteDeviceDriver.getMove() == 0 ){ + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } @@ -419,6 +437,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) device.getDeviceDriver(); if(photoelectricInspectionSiteDeviceDriver.getMove() == 0) data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + standardInspectSiteDeviceDriver.writing("to_command","1"); + if(standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() ==1 ){ + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -474,6 +498,12 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } this.setPhase(phase); + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); + standardInspectSiteDeviceDriver.writing("to_command","0"); + if(standardInspectSiteDeviceDriver.getMove() == 1 ){ + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } @@ -481,9 +511,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic //到达放货点 //(Itype=1、3,需要WCS反馈) else if (phase == 0x10) { - if (agvaddr == 0) { - agvaddr = agvaddr_copy; - } if (agvaddr < 1) { logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); return; @@ -601,22 +628,15 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } //进入区域(phase值) else if (phase == 0x50) { - if (ObjectUtil.isEmpty(inst)) { - log.info("未找到指令号{}对应的指令", ikey); - return; - } - region = agvaddr; - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + + + } //离开区域(phase值) else if (phase == 0x51) { - if (ObjectUtil.isEmpty(inst)) { - log.info("未找到指令号{}对应的指令", ikey); - return; - } - region = agvaddr; - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + + } //上报异常信息 //(不需要WCS反馈) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index 9a218cf39..dd51383a9 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -16,6 +16,7 @@ import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver; import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver; +import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; @@ -87,7 +88,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i Integer heartbeat_tag; private Date instruction_require_time = new Date(); - private int instruction_require_time_out; + private int instruction_require_time_out = 3000; //行架机械手申请任务成功标识 boolean requireSucess = false; @@ -531,33 +532,40 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i Device startdevice = deviceAppService.findDeviceByCode(start_device_code); PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver; HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; - + StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) { photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver(); if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!"; + notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:"+instruction.getInstruction_code(); + return false; + } + } + if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); + if (standardInspectSiteDeviceDriver.getMove() != 1) { + notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "无货,无法下发指令!指令号:"+instruction.getInstruction_code(); return false; } } if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver(); if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "无货,无法下发指令!"; + notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或无货,无法下发指令!指令号:"+instruction.getInstruction_code(); return false; } } - if (nextdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) { - photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) nextdevice.getDeviceDriver(); - if (photoelectricInspectionSiteDeviceDriver.getMove() != 0) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + photoelectricInspectionSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!"; + if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); + if (standardInspectSiteDeviceDriver.getMove() != 0) { + notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "有货,无法下发指令!指令号:"+instruction.getInstruction_code(); return false; } } if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 1) { - notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "有货,无法下发指令!"; + notCreateInstMessage = "手动创建指令未下发电气信号原因->放货位-烘箱:" + hongXiangConveyorDeviceDriver.getDevice_code() + "未联机或者有货,无法下发指令!指令号:"+instruction.getInstruction_code(); return false; } } @@ -584,7 +592,10 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i this.writing("to_target", next_addr); this.writing("to_task", instruction.getInstruction_code()); this.writing("to_command", "1"); - + if (nextdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { + hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) nextdevice.getDeviceDriver(); + hongXiangConveyorDeviceDriver.writing("to_open_door","1"); + } this.setNow_steps_type(2); this.setRequireSucess(true); return true; @@ -603,6 +614,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code()); PhotoelectricInspectionSiteDeviceDriver photoelectricInspectionSiteDeviceDriver; HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; + StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; if (startdevice.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) { photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) startdevice.getDeviceDriver(); if (photoelectricInspectionSiteDeviceDriver.getMove() != 1) { @@ -610,6 +622,13 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i return false; } } + if (startdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) startdevice.getDeviceDriver(); + if (standardInspectSiteDeviceDriver.getMove() != 1) { + notCreateInstMessage = "就绪任务未创建指令原因->取货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "光电无货,无法生成指令!"; + return false; + } + } if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) { hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver(); if (hongXiangConveyorDeviceDriver.getMode() == 0 || hongXiangConveyorDeviceDriver.getMove() == 0) { @@ -632,6 +651,13 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i return false; } } + if (nextdevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { + standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextdevice.getDeviceDriver(); + if (standardInspectSiteDeviceDriver.getMove() != 0) { + notCreateInstMessage = "就绪任务未创建指令原因->放货位-烘箱对接位:" + standardInspectSiteDeviceDriver.getDevice_code() + "光电有货,无法生成指令!"; + return false; + } + } String taskid = task.getTask_id(); String taskcode = task.getTask_code(); String vehiclecode = task.getVehicle_code(); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java index 1fbddf5fe..82c1f5c56 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java @@ -102,7 +102,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver private Date require_empty_in_time = new Date(); private Date require_empty_out_time = new Date(); - private int instruction_require_time_out; + private int instruction_require_time_out =3000; // 行架机械手申请任务成功标识 boolean requireSucess = false; boolean requireApplyLabelingSuccess = false; @@ -214,24 +214,12 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver var17.printStackTrace(); inst_message = var17.getMessage(); logServer.deviceExecuteLog(this.getDevice_code(), "", "", "读取信号值时出现异常:" + var17.getMessage()); - // return; } - // if (!this.itemProtocol.getIsonline()) { - // this.setIsonline(false); - // this.setIserror(true); - // message = "信号量同步异常"; - // //未联机 - // } else + if (mode == 0) { this.setIsonline(false); message = "未联机"; - // 有报警 - // } else if (error != 0) { - // this.setIsonline(false); - // this.setIserror(true); - // message = "有报警"; - // //无报警 } else { this.setIsonline(true); this.setIserror(false); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index 90daa4c78..41f65f969 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -225,19 +225,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl inst1.setInstruction_status("1"); inst1.setExecute_device_code(this.getDevice_code()); instructionService.update(inst1); -// TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code()); -// if (!ObjectUtil.isEmpty(taskDto)) { -// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) { -// JSONArray array = new JSONArray(); -// JSONObject map = new JSONObject(); -// map.put("task_id", taskDto.getExt_task_id()); -// map.put("task_status", "1"); -// array.add(map); -// acsToWmsService.feedbackTaskStatusToWms(array); -// } -// } - ; - //this.setNow_steps_type1(1); } } } @@ -1213,8 +1200,6 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl public void writing(String param, String value) { String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); Map itemMap = new HashMap(); itemMap.put(to_param, Integer.parseInt(value)); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/ItemProtocol.java new file mode 100644 index 000000000..6eddab0ef --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/ItemProtocol.java @@ -0,0 +1,82 @@ +package org.nl.acs.device_driver.basedriver.standard_autodoor; + +import cn.hutool.core.util.StrUtil; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +public class ItemProtocol { + public static String item_open = "open"; + public static String item_close = "close"; + public static String item_to_open = "to_open"; + public static String item_to_close = "to_close"; + + + private StandardAutodoorDeviceDriver driver; + + public ItemProtocol(StandardAutodoorDeviceDriver driver) { + this.driver = driver; + } + + public int getOpen() { + return this.getOpcIntegerValue(item_open); + } + + public int getClose() { + return this.getOpcIntegerValue(item_close); + } + + + public int getToOpen() { + return this.getOpcIntegerValue(item_to_open); + } + + public int getToClose() { + return this.getOpcIntegerValue(item_to_close); + } + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + // log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + } else { + return value; + } + return 0; + + } + + public String getOpcStringValue(String protocol) { + String value = this.driver.getStringValue(protocol); + if (StrUtil.isEmpty(value)) { + + } else { + return value; + } + return "0"; + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_open, "开到位", "10001")); + list.add(new ItemDto(item_close, "关到位", "10002")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_open, "下发开门", "00001" )); + list.add(new ItemDto(item_to_close, "下发关门", "00002")); + return list; + } + + + @Override + public String toString() { + return ""; + } +} + diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutodoorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutodoorDefination.java new file mode 100644 index 000000000..76bc39bb7 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutodoorDefination.java @@ -0,0 +1,63 @@ +package org.nl.acs.device_driver.basedriver.standard_autodoor; + +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceType; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +/** + * 自动门驱动定义 + */ +@Service +public class StandardAutodoorDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "standard_autodoor"; + } + + @Override + public String getDriverName() { + return "标准版-自动门"; + } + + @Override + public String getDriverDescription() { + return "标准版-自动门"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new StandardAutodoorDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return StandardAutodoorDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList(); + types.add(DeviceType.conveyor); + return types; + } + + + @Override + public List getReadableItemDtos() { + return ItemProtocol.getReadableItemDtos(); + } + + @Override + public List getWriteableItemDtos() { + return ItemProtocol.getWriteableItemDtos(); + } + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutodoorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutodoorDeviceDriver.java new file mode 100644 index 000000000..3f57a45c1 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_autodoor/StandardAutodoorDeviceDriver.java @@ -0,0 +1,69 @@ +package org.nl.acs.device_driver.basedriver.standard_autodoor; + +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.opc.Device; +import org.nl.modules.wql.util.SpringContextHolder; + +import java.util.HashMap; +import java.util.Map; + + +/** + * 自动门驱动 + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + + int open = 0; + int close = 0; + + int last_open = 0; + int last_close = 0; + String device_code = null; + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() { + String message = null; + + device_code = this.getDevice().getDevice_code(); + open = this.itemProtocol.getOpen(); + close = this.itemProtocol.getClose(); + if (open != last_open) { + + } + if (close != last_close) { + + } + + last_open = open; + last_close = close; + } + + + public void writing(String param, String value) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + param; + Map itemMap = new HashMap(); + itemMap.put(to_param, Integer.parseInt(value)); + + this.control(itemMap); + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); + } + + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index ac3042120..feb06818a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -507,22 +507,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe message ="当前载具号"+container_code+"查找对应指令起点与当前设备不符"; logServer.deviceExecuteLog(this.device_code, "", "", "申请任务" +"当前载具号"+container_code+"查找对应指令起点与当前设备不符"); -// this.setIserror(true); -// List list = new ArrayList(); -// Map map = new HashMap(); -// map.put("code","to_target"); -// map.put("value","1011"); -// list.add(map); -// Map map2 = new HashMap(); -// map2.put("code","to_command"); -// map2.put("value","1"); -// Map map3 = new HashMap(); -// map3.put("code","to_task"); -// map3.put("value","0"); -// list.add(map3); -// this.writing(list); -// this.setRequireSucess(true); -// this.setApplySucess(true); return false; } this.setIserror(false); @@ -555,16 +539,22 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe message = "下发电气任务号成功"; logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号"+container_code +"已存在对应任务,下发电气信号"); -// if(task != Integer.parseInt(instdto.getInstruction_code()) ){ -// this.writing(list); -// logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发电气信号"); -// } requireSucess = true; applySucess = true; } else { message = "任务号:" + taskdto.getTask_code() + "未找到指令"; } return true; + } else { + //需要判断指令中的指令 再次请求不能生成 + if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(),"1"))) { + { + logServer.deviceExecuteLog(this.device_code, "", "", "申请任务时该载具号" + container_code + + "已存在对应任务"); + requireSucess = true; + applySucess = true; + } + } } String taskid = taskdto.getTask_id(); @@ -722,6 +712,8 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe map3.put("value","0"); list.add(map3); this.writing(list); + requireSucess = true; + applySucess = true; message = "申请任务失败接口不通下发退回"; } else { if (jo.getInteger("status") == 200) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java index 1398148a5..220afccdd 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/ItemProtocol.java @@ -14,13 +14,12 @@ public class ItemProtocol { public static String item_heartbeat = "heartbeat"; public static String item_mode = "mode"; public static String item_move = "move"; - public static String item_ioaction = "ioaction"; + public static String item_action = "action"; public static String item_error = "error"; public static String item_task = "task"; public static String item_to_command = "to_command"; public static String item_to_target = "to_target"; public static String item_to_task = "to_task"; - public static String item_weight = "weight"; private StandardInspectSiteDeviceDriver driver; @@ -40,8 +39,8 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_move); } - public int getIoaction() { - return this.getOpcIntegerValue(item_ioaction); + public int getAction() { + return this.getOpcIntegerValue(item_action); } public int getError() { @@ -87,16 +86,17 @@ public class ItemProtocol { public static List getReadableItemDtos() { ArrayList list = new ArrayList(); list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB600.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_move, "光电开关信号", "DB600.B2")); - list.add(new ItemDto(item_error, "报警信号", "DB600.B6")); - list.add(new ItemDto(item_task, "任务号", "DB600.D8")); + list.add(new ItemDto(item_mode, "工作状态", "DB600.B2")); + list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3")); + list.add(new ItemDto(item_action, "动作信号", "DB600.B4")); + list.add(new ItemDto(item_error, "报警信号", "DB600.B5")); + list.add(new ItemDto(item_task, "任务号", "DB600.D6")); return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true))); + list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2")); list.add(new ItemDto(item_to_target, "目标站", "DB601.W4")); list.add(new ItemDto(item_to_task, "任务号", "DB601.D8")); return list; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDefination.java index 4299036e3..7f8026a31 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDefination.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDefination.java @@ -50,19 +50,10 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination return types; } + @Override public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - List list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB600.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作状态", "DB600.B1", true)); - list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB600.B2")); - list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB600.B6")); - list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB600.D8")); - return list; + return ItemProtocol.getReadableItemDtos(); } @Override @@ -70,4 +61,5 @@ public class StandardInspectSiteDefination implements OpcDeviceDriverDefination return ItemProtocol.getWriteableItemDtos(); } + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java index fcdd34ce2..773565456 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java @@ -15,6 +15,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; @@ -43,14 +44,10 @@ import java.util.Map; @RequiredArgsConstructor public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor { protected ItemProtocol itemProtocol = new ItemProtocol(this); - @Autowired - InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); - @Autowired - DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); - @Autowired - RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl"); - @Autowired - TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); + + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + + String container; String container_type_desc; String last_container_type_desc; @@ -64,6 +61,8 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp int error = 0; int move = 0; int task = 0; + int action = 0; + int last_action = 0; int last_mode = 0; int last_error = 0; int last_move = 0; @@ -117,7 +116,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 int flag; - String devicecode; + String device_code = null; @Override public Device getDevice() { @@ -129,91 +128,41 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp public void execute() { String message = null; try { - String device_code = this.getDeviceCode(); + device_code = this.getDeviceCode(); mode = this.itemProtocol.getMode(); error = this.itemProtocol.getError(); move = this.itemProtocol.getMove(); + action = this.itemProtocol.getAction(); task = this.itemProtocol.getTask(); hasGoods = this.itemProtocol.getMove(); if (mode != last_mode) { - this.setRequireSucess(false); + logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记"); } if (move != last_move) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move); } - if (error != last_error) { - } - - if (this.getApply_handling()) { - String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString(); - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - Device link_device = appService.findDeviceByCode(link_device_code); - StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver; - if (link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver(); -// if(standardInspectSiteDevicedriver.getMode() != 2){ -// log.debug("设备未待机"); -// return; -// } -// if(standardInspectSiteDevicedriver.getMove() != 0){ -// log.debug("设备不满足放货条件"); -// return; -// } - - //如果目标设备申请叫料 则允许生成任务 - if (standardInspectSiteDevicedriver.getApply_material()) { - TaskDto dto = new TaskDto(); - String now = DateUtil.now(); - dto.setTask_id(IdUtil.simpleUUID()); - dto.setCreate_by(this.getDevice().getDevice_code()); - dto.setUpdate_by(this.getDevice().getDevice_code()); - dto.setStart_point_code(this.getDevice().getDevice_code()); - - String taskcode = CodeUtil.getNewCode("TASK_NO"); - dto.setTask_code("-" + taskcode); - dto.setTask_status("0"); - dto.setPriority("101"); -// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code()); -// String next_device_codecode = jo.getNext_device_code(); -// if(StrUtil.isEmpty(next_device_codecode)){ -// throw new RuntimeException("该设备未找到对应路由"); -// } - dto.setNext_point_code(standardInspectSiteDevicedriver.getDevicecode()); - dto.setUpdate_time(now); - dto.setCreate_time(now); - - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = (JSONObject) JSONObject.toJSON(dto); - - wo.insert(json); - standardInspectSiteDevicedriver.setApply_material(false); - } - } - this.setApply_handling(false); + if (action != last_action) { + logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + last_action + "->" + action); } } catch (Exception var17) { - return; + + } - if (!this.itemProtocol.getIsonline()) { + if (mode == 0) { this.setIsonline(false); - this.setIserror(true); - message = "信号量同步异常"; - //未联机 - } else if (mode == 0) { - this.setIsonline(false); - this.setIserror(true); message = "未联机"; //有报警 - } else if (error != 0) { - this.setIsonline(false); - this.setIserror(true); - message = "有报警"; - //无报警 + } else { this.setIsonline(true); this.setIserror(false); + if (error != 0) { + this.setIserror(true); + message = "有报警"; + } message = ""; Instruction instruction = null; List toInstructions; @@ -222,76 +171,14 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp log.debug("设备运转模式:等待工作"); return; case 2: - //申请任务 -// if (this.getApply_handling()) { -// String link_device_code = this.getDevice().getExtraValue().get("link_device_code").toString(); -// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); -// Device link_device = appService.findDeviceByCode(link_device_code); -// StandardInspectSiteDeviceDriver standardInspectSiteDevicedriver; -// if(link_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { -// standardInspectSiteDevicedriver = (StandardInspectSiteDeviceDriver) link_device.getDeviceDriver(); -// if(standardInspectSiteDevicedriver.getMode() != 2){ -// log.debug("设备未待机"); -// return; -// } -// if(standardInspectSiteDevicedriver.getMove() != 0){ -// log.debug("设备不满足放货条件"); -// return; -// } -// -// //如果目标设备申请叫料 则允许生成任务 -// if(standardInspectSiteDevicedriver.getApply_material()){ -// TaskDto dto = new TaskDto(); -// String now = DateUtil.now(); -// dto.setTask_id(IdUtil.simpleUUID()); -// dto.setCreate_by(this.getDevice().getDevice_code()); -// dto.setUpdate_by(this.getDevice().getDevice_code()); -// dto.setStart_point_code(this.getDevice().getDevice_code()); -// -// String taskcode = CodeGenerateUtil.getNewCode("TASK_NO"); -// dto.setTask_code("-"+taskcode); -// dto.setTask_status("0"); -// dto.setPriority("101"); -// RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code()); -// String next_device_codecode = jo.getNext_device_code(); -// if(StrUtil.isEmpty(next_device_codecode)){ -// throw new RuntimeException("该设备未找到对应路由"); -// } -// dto.setNext_point_code(next_device_codecode); -// dto.setUpdate_time(now); -// dto.setCreate_time(now); -// -// WQLObject wo = WQLObject.getWQLObject("acs_task"); -// JSONObject json = (JSONObject) JSONObject.toJSON(dto); - -// wo.insert(json); -// standardInspectSiteDevicedriver.setApply_material(false); -// } -// } -// this.setApply_handling(false); -// } - - if (material.length() > 0 && qty.length() > 0 && !requireSucess) { - this.instruction_require(container); - } - } - - switch (flag) { - //取货完成 - case 1: - writing(2); - return; - //放货完成 - case 2: - writing(3); - return; - + break; } } last_mode = mode; last_error = error; last_move = move; + last_action = action; last_task = task; } @@ -306,137 +193,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp } } - protected void thingToNothing() { - log.debug("从有货到无货 清理数据"); - this.set_last_container(container, container_type_desc); - } - public void set_last_container(String barcode, String type_desc) { - this.set_last_container(barcode); - this.set_last_container_type_desc(type_desc); - } - - public void set_last_container(String barcode) { - } - - public void set_last_container_type_desc(String type) { - } - - public boolean exe_business() { - return true; - } - - protected void executing(Instruction instruction) { - this.executing(1, instruction, ""); - } - - public void executing(int command, Instruction instruction, String appendMessage) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - if (appendMessage == null) { - appendMessage = ""; - } - if (instruction != null) { - instruction_num = Integer.parseInt(instruction.getInstruction_code()); - } - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, 1); - itemMap.put(to_task, instruction_num); - this.control(itemMap); - - } - - public void executing(Server server, Map itemMap) { - this.control(itemMap); - } - - public void writing(int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - this.control(itemMap); - - } - - public void writing(int type, int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (type == 1) { - itemMap.put(to_command, command); - } else if (type == 2) { - itemMap.put(to_target, command); - - } else if (type == 3) { - itemMap.put(to_task, command); - } - this.control(itemMap); - - } - - public boolean instruction_require(String container_code) { - return instruction_require(container_code, WcsConfig.task_container_type_default_desc); - } - - /** - * 请求指令 - * - * @param container_code - * @param container_type - */ - public synchronized boolean instruction_require(String container_code, String container_type) { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - TaskDto dto = new TaskDto(); - String now = DateUtil.now(); - dto.setTask_id(IdUtil.simpleUUID()); - dto.setCreate_by(this.getDevice().getDevice_code()); - dto.setUpdate_by(this.getDevice().getDevice_code()); - dto.setStart_point_code(this.getDevice().getDevice_code()); - dto.setVehicle_code(container_code); - dto.setVehicle_type(container_type); - - String taskcode = CodeUtil.getNewCode("TASK_NO"); - dto.setTask_code("-" + taskcode); - dto.setTask_status("0"); - dto.setPriority("101"); - RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code()); - String next_device_codecode = jo.getNext_device_code(); - if (StrUtil.isEmpty(next_device_codecode)) { - throw new RuntimeException("该设备未找到对应路由"); - } - dto.setNext_point_code(next_device_codecode); - dto.setUpdate_time(now); - dto.setCreate_time(now); - - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = (JSONObject) JSONObject.toJSON(dto); - - wo.insert(json); - requireSucess = false; - return true; - } - } @Override public JSONObject getDeviceStatusName() { @@ -479,4 +236,14 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp public void setDeviceStatus(JSONObject data) { } + + public void writing(String param, String value) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + param; + Map itemMap = new HashMap(); + itemMap.put(to_param, Integer.parseInt(value)); + + this.control(itemMap); + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号设备号:" + device_code + ",下发电气:" + to_param + ",下发电气值:" + value); + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 5b62968c6..355fc01f4 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -1,5 +1,6 @@ package org.nl.acs.ext.wms.service.impl; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; @@ -527,6 +528,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { continue; } + if(StrUtil.equals(task_type,"8")){ + next_device_code = request.getPut_device_code(); + put_device_code = request.getNext_device_code(); + } JSONObject start_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code + "'").uniqueResult(0); if (!ObjectUtil.isEmpty(start_device_json)) { @@ -654,8 +659,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } JSONObject jo = new JSONObject(); + jo.put("task_id", IdUtil.simpleUUID()); jo.put("task_code", task_code); - jo.put("task_id", ext_task_id); jo.put("start_point_code", start_point_code); jo.put("next_point_code", next_point_code); jo.put("start_point_code2", start_point_code2); @@ -688,7 +693,17 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { if (StrUtil.equals(task_dto.getTask_type(), "7")) { //创建临时指令 不创建、不生成 //等立库反馈成功才能创建任务和指令 - Instruction inst = taskService.createTemporaryInst(task_dto); + Instruction inst = null; + try { + inst = taskService.createTemporaryInst(task_dto); + } catch (Exception e){ + JSONObject json = new JSONObject(); + json.put("task_code", task_code); + json.put("ext_task_id", ext_task_id); + json.put("message", e.getMessage()); + errArr.add(json); + continue; + } Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(),inst); if(StrUtil.equals(resp.result,"true")){ @@ -798,10 +813,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } JSONObject resultJson = new JSONObject(); if (ObjectUtil.isEmpty(errArr)) { - resultJson.put("status", HttpStatus.OK); - } else { - resultJson.put("status", HttpStatus.BAD_REQUEST); + resultJson.put("status", HttpStatus.OK.value()); resultJson.put("message", "操作成功"); + } else { + resultJson.put("status", HttpStatus.BAD_REQUEST.value()); + resultJson.put("message", "操作失败"); if(ObjectUtil.isNotEmpty(errArr)){ resultJson.put("errArr",errArr); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java index 203e45e51..9bfc719a6 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java @@ -88,6 +88,8 @@ public interface InstructionService { Instruction findByTaskcodeAndStatus(String code); + Instruction findByTaskcodeAndStatus(String code,String status); + /** * 根据任务id查询 * @@ -158,6 +160,13 @@ public interface InstructionService { void finishAndCreateNextInst(Instruction dto) throws Exception; + /** + * 完成并创建指令 + * + * @param + */ + void finishAndCreateHXInst(Instruction dto) throws Exception; + /** * 取消指令 * @@ -261,14 +270,6 @@ public interface InstructionService { */ Integer querySameOriginInst(String code); - /** - * 查询相同起点、终点指令的数量 - * - * @param code - * @return - */ - //Integer querySameOriginInst(String code); - boolean removeByCodeFromCache(String code); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 3081615c6..c93ae2124 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -261,6 +261,21 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu return null; } + + @Override + public Instruction findByTaskcodeAndStatus(String code,String status) { + Iterator var3 = instructions.iterator(); + while (var3.hasNext()) { + Instruction instruction = (Instruction) var3.next(); + if (StrUtil.equals(instruction.getTask_code(), code) + && StrUtil.equals(instruction.getInstruction_status(), status)) { + return instruction; + } + } + return null; + } + + @Override public Instruction findByTaskid(String id, String wherecaluse) { if (!StrUtil.isEmpty(wherecaluse)) { @@ -728,11 +743,30 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu TaskDto obj = taskjson.toJavaObject(TaskDto.class); // =0 则不用再次请求 if (StrUtil.equals(obj.getRequest_again(), "0")) { - if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) { - taskService.finish(obj.getTask_id()); + if(StrUtil.equals(obj.getTask_type(),"8")){ + //中转为空 + if(StrUtil.isEmpty(obj.getPut_device_code())){ + if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) { + taskService.finish(obj.getTask_id()); + } else { + finishAndCreateNextInst(entity); + } + } else { + if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) { + finishAndCreateHXInst(entity); + } else if (StrUtil.equals(obj.getPut_device_code(), instnextdevice)) { + taskService.finish(obj.getTask_id()); + } + } + } else { - finishAndCreateNextInst(entity); + if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) { + taskService.finish(obj.getTask_id()); + } else { + finishAndCreateNextInst(entity); + } } + } removeByCodeFromCache(entity.getInstruction_code()); @@ -755,11 +789,30 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu TaskDto obj = taskjson.toJavaObject(TaskDto.class); // =0 则不用再次请求 if (StrUtil.equals(obj.getRequest_again(), "0")) { - if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) { - taskService.finish(obj.getTask_id()); + if(StrUtil.equals(obj.getTask_type(),"8")){ + //中转为空 + if(StrUtil.isEmpty(obj.getPut_device_code())){ + if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) { + taskService.finish(obj.getTask_id()); + } else { + finishAndCreateNextInst(dto); + } + } else { + if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) { + finishAndCreateHXInst(dto); + } else if (StrUtil.equals(obj.getPut_device_code(), instnextdevice)) { + taskService.finish(obj.getTask_id()); + } + } + } else { - finishAndCreateNextInst(dto); + if (StrUtil.equals(obj.getNext_device_code(), instnextdevice)) { + taskService.finish(obj.getTask_id()); + } else { + finishAndCreateNextInst(dto); + } } + } DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); @@ -876,6 +929,71 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu } } + @Override + @Transactional(rollbackFor = Exception.class) + public void finishAndCreateHXInst(Instruction dto) { + dto = foramte(dto); + String device_code = dto.getNext_device_code(); + WQLObject taskwo = WQLObject.getWQLObject("acs_task"); + JSONObject taskjson = taskwo.query("task_id ='" + dto.getTask_id() + "'").uniqueResult(0); + TaskDto acsTask = taskjson.toJavaObject(TaskDto.class); + + String next_device_code = acsTask.getPut_device_code(); + String start_device_code = dto.getNext_device_code(); + String start_point_code = null; + String next_point_code = null; + String start_device = + deviceAppService + .findDeviceByCode(start_device_code) + .getDeviceDriverDefination() + .getFitDeviceTypes() + .get(0) + .name(); + String next_device = + deviceAppService + .findDeviceByCode(next_device_code) + .getDeviceDriverDefination() + .getFitDeviceTypes() + .get(0) + .name(); + if (StrUtil.equals("storage", start_device)) { + start_point_code = start_device_code + "-" + acsTask.getFrom_y() + "-" + acsTask.getFrom_z(); + } else { + start_point_code = start_device_code; + } + if (StrUtil.equals("storage", next_device)) { + next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z(); + } else { + next_point_code = next_device_code; + } + Instruction instdto = new Instruction(); + instdto.setInstruction_id(IdUtil.simpleUUID()); + instdto.setRoute_plan_code(acsTask.getRoute_plan_code()); + instdto.setRemark(acsTask.getRemark()); + instdto.setMaterial(acsTask.getMaterial()); + instdto.setQuantity(acsTask.getQuantity()); + instdto.setTask_id(acsTask.getTask_id()); + instdto.setTask_code(acsTask.getTask_code()); + instdto.setVehicle_code(acsTask.getVehicle_code()); + String now = DateUtil.now(); + instdto.setCreate_time(now); + instdto.setCreate_by("auto"); + instdto.setStart_device_code(start_device_code); + instdto.setNext_device_code(next_device_code); + instdto.setStart_point_code(start_point_code); + instdto.setNext_point_code(next_point_code); + instdto.setPriority(acsTask.getPriority()); + instdto.setInstruction_status("0"); + instdto.setExecute_device_code(dto.getNext_device_code()); + try { + this.create(instdto); + } catch (Exception e) { + e.printStackTrace(); + log.error("完成并创建下一条指令", e.getMessage()); + } + } + + @Override public void cancel(String id) throws Exception { // flag= true时取消指令 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 347bb922f..b011cd6d0 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -367,6 +367,23 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { if (ObjectUtil.isNotEmpty(instruction)) { list.add(task); } + } else { + if(StrUtil.equals(task.getTask_type(),"8") && StrUtil.isNotEmpty(task.getPut_device_code())) + { +// if(task.getNext_device_code().equals(device_code) +// && StrUtil.equals(task.getTask_status(), "1")){ +// Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code()); +// if (ObjectUtil.isNotEmpty(instruction)) { +// list.add(task); +// } +// } + Instruction instruction = instructionService.findByDeviceCodeFromCache(device_code); + if (ObjectUtil.isNotEmpty(instruction)) { + if(StrUtil.equals(instruction.getStart_device_code(),device_code)){ + list.add(task); + } + } + } } } return list; @@ -777,7 +794,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code()); System.out.println(feefbackdto == null); JSONObject feed_jo = new JSONObject(); - feed_jo.put("task_id", entity.getTask_id()); + feed_jo.put("task_id", entity.getExt_task_id()); feed_jo.put("task_code", entity.getTask_code()); feed_jo.put("task_status", entity.getTask_status()); JSONArray ja = new JSONArray(); @@ -909,7 +926,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { JSONObject feed_jo = new JSONObject(); - feed_jo.put("task_id", entity.getTask_id()); + feed_jo.put("task_id", entity.getExt_task_id()); feed_jo.put("task_code", entity.getTask_code()); feed_jo.put("task_status", entity.getTask_status()); JSONArray ja = new JSONArray(); @@ -939,11 +956,6 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { ParamService paramService = SpringContextHolder.getBean(ParamService.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); - // InstructionDto inst = instructionservice.findByTaskid(acsTask, "instruction_status < 2 - // "); - // if (inst != null) { - // throw new BadRequestException("有指令未完成!"); - // } String taskid = acsTask.getTask_id(); String taskcode = acsTask.getTask_code(); @@ -975,6 +987,9 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { List shortPathsList = routeLineService.getShortPathLines( start_device_code, acsTask.getNext_device_code(), route_plan_code); + if(ObjectUtil.isEmpty(shortPathsList)){ + throw new BadRequestException(start_device_code + "->" + acsTask.getNext_device_code() + "路由不通!"); + } RouteLineDto routeLineDto = shortPathsList.get(0); String path = routeLineDto.getPath(); String type = routeLineDto.getType(); diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java index f68170c29..6d2700d70 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java @@ -65,7 +65,6 @@ public class AutoCreateInst { String next_point_code2 = acsTask.getNext_point_code2(); String next_device_code2 = acsTask.getNext_device_code2(); - String route_plan_code = acsTask.getRoute_plan_code(); String vehicleType = acsTask.getVehicle_type(); String agv_system_type = acsTask.getAgv_system_type(); @@ -158,6 +157,8 @@ public class AutoCreateInst { instdto.setAgv_inst_type("2"); } else if (StrUtil.equals(task_type, "2")) { instdto.setAgv_inst_type("3"); + } else if (StrUtil.equals(task_type, "8")) { + instdto.setAgv_inst_type("2"); } } else { instdto.setAgv_inst_type("4"); diff --git a/acs/nladmin-ui/src/views/acs/device/config.vue b/acs/nladmin-ui/src/views/acs/device/config.vue index 594935985..96cdcc222 100644 --- a/acs/nladmin-ui/src/views/acs/device/config.vue +++ b/acs/nladmin-ui/src/views/acs/device/config.vue @@ -97,6 +97,7 @@ import siemens_conveyor_labeling from '@/views/acs/device/driver/siemens_conveyo import siemens_conveyor_ckk from '@/views/acs/device/driver/siemens_conveyor_ckk' import siemens_onefloor_agv_conveyor from '@/views/acs/device/driver/siemens_onefloor_agv_conveyor' import photoelectric_inspection_site from '@/views/acs/device/driver/photoelectric_inspection_site' +import standard_autodoor from '@/views/acs/device/driver/standard_autodoor' export default { name: 'DeviceConfig', @@ -124,7 +125,8 @@ export default { siemens_conveyor_labeling, siemens_conveyor_ckk, siemens_onefloor_agv_conveyor, - photoelectric_inspection_site + photoelectric_inspection_site, + standard_autodoor }, dicts: ['device_type'], mixins: [crud], diff --git a/acs/nladmin-ui/src/views/acs/device/driver/standard_autodoor.vue b/acs/nladmin-ui/src/views/acs/device/driver/standard_autodoor.vue new file mode 100644 index 000000000..41e2f4695 --- /dev/null +++ b/acs/nladmin-ui/src/views/acs/device/driver/standard_autodoor.vue @@ -0,0 +1,352 @@ + + + + + diff --git a/acs/nladmin-ui/src/views/acs/instruction/index.vue b/acs/nladmin-ui/src/views/acs/instruction/index.vue index 2834662bd..d0c3188bf 100644 --- a/acs/nladmin-ui/src/views/acs/instruction/index.vue +++ b/acs/nladmin-ui/src/views/acs/instruction/index.vue @@ -147,27 +147,18 @@ - + - - - - - - - - - - + + - - + --> -