From 5b6add0c1c43f595b199e7f9548377236234366c Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Mon, 10 Jul 2023 09:08:52 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/nl/acs/agv/AgvUtil.java | 16 + .../device/device_driver/DriverTypeEnum.java | 39 +- .../nl/acs/device/rest/DeviceController.java | 8 + .../service/impl/DeviceServiceImpl.java | 77 +- .../nl/acs/device/wql/Qdevice_query_002.wql | 2 +- .../acs/device_driver/RequestMethodEnum.java | 130 ++ .../device_driver/StandardRequestMethod.java | 103 ++ .../agv/ndcone/AgvNdcOneDefination.java | 49 + .../agv/ndcone/AgvNdcOneDeviceDriver.java | 426 ++++++ .../LnshKilnTrussDefination.java | 14 +- .../lnsh/lnsh_mixing_mill/ItemProtocol.java | 34 +- .../LnshMixingMillDefination.java | 20 +- .../LnshMixingMillDeviceDriver.java | 238 +-- .../LnshPackageLineDefination.java | 16 +- ...nshPackagePalletManipulatorDefination.java | 26 +- ...hPackagePalletManipulatorDeviceDriver.java | 352 ----- .../LnshPalletizingManipulatorDefination.java | 16 +- .../ItemProtocol.java | 1 - ...hPalletizingManipulatorSiteDefination.java | 74 +- ...alletizingManipulatorSiteDeviceDriver.java | 1313 +++++++++-------- .../lnsh/lnsh_station/ItemProtocol.java | 26 +- .../lnsh_station/LnshStationDefination.java | 17 +- .../lnsh_station/LnshStationDeviceDriver.java | 601 ++++---- .../main/java/org/nl/acs/ext/wms/LmsUtil.java | 50 + .../java/org/nl/acs/ext/wms/RespUtil.java | 18 + .../org/nl/acs/ext/wms/data/BaseRequest.java | 42 + .../org/nl/acs/ext/wms/data/BaseResponse.java | 36 + .../java/org/nl/acs/ext/wms/data/Resp.java | 32 + .../wms/data/applyTask/ApplyTaskRequest.java | 39 + .../wms/data/applyTask/ApplyTaskResponse.java | 6 + .../FeedBackTaskStautsRequest.java | 45 + .../FeedBackTaskStautsResponse.java | 6 + .../acs/ext/wms/service/AcsToWmsService.java | 8 + .../wms/service/impl/AcsToWmsServiceImpl.java | 23 +- .../wms/service/impl/WmsToAcsServiceImpl.java | 20 +- .../acs/instruction/enums/InstStatusEnum.java | 8 +- .../java/org/nl/acs/opc/DeviceManageDto.java | 3 +- .../org/nl/acs/task/enums/TaskStatusEnum.java | 7 +- acs/nladmin-ui/src/api/acs/device/device.js | 10 +- .../src/api/acs/device/driverConfig.js | 3 +- .../acs/device/driver/agv/agv_ndc_one.vue | 2 +- .../acs/device/driver/agv/agv_ndc_two.vue | 2 +- .../acs/device/driver/cargo_lift_conveyor.vue | 2 +- .../empty_vehicle_stacking_position.vue | 2 +- .../device/driver/hailiang_smart_plc_test.vue | 2 +- .../device/driver/haokai_auto_conveyor.vue | 2 +- .../acs/device/driver/lamp_three_color.vue | 2 +- .../driver/lnsh/lnsh_Laminating_machine.vue | 2 +- .../acs/device/driver/lnsh/lnsh_crusher.vue | 2 +- .../driver/lnsh/lnsh_fold_disc_site.vue | 2 +- .../acs/device/driver/lnsh/lnsh_kiln_lane.vue | 3 +- .../device/driver/lnsh/lnsh_kiln_truss.vue | 2 +- .../driver/lnsh/lnsh_labeling_machine.vue | 80 +- .../device/driver/lnsh/lnsh_mixing_mill.vue | 135 +- .../driver/lnsh/lnsh_out_kiln_truss.vue | 2 +- .../device/driver/lnsh/lnsh_package_line.vue | 2 +- .../lnsh/lnsh_package_pallet_manipulator.vue | 2 +- .../device/driver/lnsh/lnsh_package_site.vue | 2 +- .../driver/lnsh/lnsh_pallet_storage.vue | 2 +- .../lnsh/lnsh_palletizing_manipulator.vue | 2 +- .../lnsh_palletizing_manipulator_site.vue | 132 +- .../acs/device/driver/lnsh/lnsh_press.vue | 2 +- .../views/acs/device/driver/lnsh/lnsh_rgv.vue | 2 +- .../driver/lnsh/lnsh_split_manipulator.vue | 2 +- .../acs/device/driver/lnsh/lnsh_station.vue | 134 +- .../acs/device/driver/paint_conveyor.vue | 2 +- .../driver/standard_conveyor_control.vue | 2 +- ...standard_conveyor_control_with_scanner.vue | 2 +- .../driver/standard_conveyor_monitor.vue | 2 +- .../device/driver/standard_inspect_site.vue | 2 +- .../acs/device/driver/standard_scanner.vue | 2 +- .../acs/device/driver/standard_storage.vue | 2 +- 72 files changed, 2826 insertions(+), 1666 deletions(-) create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/StandardRequestMethod.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDefination.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/LmsUtil.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/RespUtil.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseResponse.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/Resp.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/applyTask/ApplyTaskRequest.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/applyTask/ApplyTaskResponse.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStautsRequest.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStautsResponse.java diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/AgvUtil.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/AgvUtil.java index c24981b..86b0739 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/AgvUtil.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/AgvUtil.java @@ -23,4 +23,20 @@ public class AgvUtil { String nowAsISO = df.format(date); return nowAsISO; } + + /** + * 获得之后num个天的时间 + * + * @return + */ + public static String getDate() { + Calendar calendar = Calendar.getInstance(); + Date date = calendar.getTime(); + TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai"); + DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + df.setTimeZone(tz); + String nowAsISO = df.format(date); + return nowAsISO; + } + } 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 85dcc6d..4bd3995 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 @@ -43,42 +43,45 @@ public enum DriverTypeEnum { STANDARD_RGV(35, "standard_rgv", "标准版-RGV", "rgv"), - LNSH_MIXING_MILL(37, "lnsh_mixing_mill", "晟华-混碾机", "station"), + LNSH_MIXING_MILL(37, "lnsh_mixing_mill", "标准版-混碾机", "station"), - LNSH_PRESS(38, "lnsh_press", "晟华-压力机", "station"), + LNSH_PRESS(38, "lnsh_press", "标准版-压力机", "station"), - LNSH_PALLETIZING_MANIPULATOR(39, "lnsh_palletizing_manipulator", "晟华-码垛机械手", "station"), + LNSH_PALLETIZING_MANIPULATOR(39, "lnsh_palletizing_manipulator", "标准版-压制码垛机械手", "station"), - LNSH_KILN_TRUSS(40, "lnsh_kiln_truss", "晟华-进窑桁架", "station"), + LNSH_KILN_TRUSS(40, "lnsh_kiln_truss", "标准版-进窑桁架", "station"), - LNSH_OUT_KILN_TRUSS(41, "lnsh_out_kiln_truss", "晟华-出窑桁架", "station"), + LNSH_OUT_KILN_TRUSS(41, "lnsh_out_kiln_truss", "标准版-出窑桁架", "station"), - LNSH_KILN_LANE(42, "lnsh_kiln_lane", "晟华-窑车道", "station"), + LNSH_KILN_LANE(42, "lnsh_kiln_lane", "标准版-窑车道", "station"), - LNSH_FOLD_DISC_SITE(43, "lnsh_fold_disc_site", "晟华-叠盘机", "station"), + LNSH_FOLD_DISC_SITE(43, "lnsh_fold_disc_site", "标准版-叠盘机", "station"), - LNSH_PALLET_STORAGE(44, "lnsh_pallet_storage", "晟华-托盘存储线", "station"), + LNSH_PALLET_STORAGE(44, "lnsh_pallet_storage", "标准版-托盘存储线", "station"), - LNSH_PACKAGE_PALLET_MANIPULATOR(45, "lnsh_package_pallet_manipulator", "晟华-分拣机械手", "station"), + LNSH_PACKAGE_PALLET_MANIPULATOR(45, "lnsh_package_pallet_manipulator", "标准版-分拣机械手", "station"), - LNSH_LABELING_MACHINE(46, "lnsh_labeling_machine", "晟华-贴标机", "station"), + LNSH_LABELING_MACHINE(46, "lnsh_labeling_machine", "标准版-贴标机", "station"), - LNSH_SPLIT_MANIPULATOR(47, "lnsh_split_manipulator", "晟华-拆垛机械手", "station"), + LNSH_SPLIT_MANIPULATOR(47, "lnsh_split_manipulator", "标准版-拆垛机械手", "station"), - LNSH_RGV(48, "lnsh_rgv", "晟华-RGV", "rgv"), + LNSH_RGV(48, "lnsh_rgv", "标准版-RGV", "rgv"), - LNSH_PACKAGE_LINE(49, "lnsh_package_line", "晟华-包装机", "station"), + LNSH_PACKAGE_LINE(49, "lnsh_package_line", "标准版-包装机", "station"), - LNSH_STATION(50, "lnsh_station", "晟华-工位(交互模板)", "station"), + LNSH_STATION(50, "lnsh_station", "标准版-工位(交互模板)", "station"), - LNSH_LAMINATING_MACHINE(51, "lnsh_Laminating_machine", "晟华-覆膜机", "station"), + LNSH_LAMINATING_MACHINE(51, "lnsh_Laminating_machine", "标准版-覆膜机", "station"), - LNSH_PACKAGE_SITE(52, "lnsh_package_site", "晟华-包装线工位", "station"), + LNSH_PACKAGE_SITE(52, "lnsh_package_site", "标准版-包装线工位", "station"), - LNSH_CRUSHER(53, "lnsh_crusher", "晟华-破碎机", "station"), + LNSH_CRUSHER(53, "lnsh_crusher", "标准版-破碎机", "station"), - LNSH_PALLETIZING_MANIPULATOR_SITE(54, "lnsh_palletizing_manipulator_site", "晟华-机械手对接位", "station"); + LNSH_PALLETIZING_MANIPULATOR_SITE(54, "lnsh_palletizing_manipulator_site", "标准版-机械手对接位", "station"), + AGV_NDC_ONE(55, "agv_ndc_one", "NDC1楼AGV", "agv"), + + AGV_NDC_TWO(56, "agv_ndc_two", "NDC2楼AGV", "agv"); //驱动索引 private int index; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java index ee5735b..d477e95 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/rest/DeviceController.java @@ -13,6 +13,7 @@ import org.nl.acs.device.device_driver.standard_inspect.OpcPlcDto; import org.nl.acs.device.service.DeviceExtraService; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.dto.DeviceDto; +import org.nl.acs.device_driver.RequestMethodEnum; import org.nl.modules.logging.annotation.Log; import org.nl.modules.wql.core.bean.WQLObject; import org.springframework.data.domain.Pageable; @@ -247,6 +248,13 @@ public class DeviceController { return new ResponseEntity<>(DriverTypeEnum.getListByType(device.getDevice_type()), HttpStatus.OK); } + @GetMapping("/selectRequestMethodList") + @Log("下拉选设备请求方法") + @ApiOperation("下拉选设备请求方法") + public ResponseEntity selectRequestMethodList() { + return new ResponseEntity<>(RequestMethodEnum.getList(), HttpStatus.OK); + } + @ApiOperation("查询") @GetMapping({"/{device_code}"}) public ResponseEntity query(@PathVariable String device_code) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index c259911..1bfa2f1 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -197,6 +197,8 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial @Transactional(rollbackFor = Exception.class) public void deleteAll(String[] ids) { WQLObject wo = WQLObject.getWQLObject("acs_device"); + WQLObject wo_extra = WQLObject.getWQLObject("acs_device_extra"); + WQLObject storageTab = WQLObject.getWQLObject("acs_storage_cell"); //路由路线表【acs_route_line】 WQLObject routeLineTab = WQLObject.getWQLObject("acs_route_line"); @@ -213,20 +215,21 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial if (!MapUtil.isEmpty(json)) { throw new BadRequestException("设备:【" + device_code + "】在路由已存在,无法删除!"); } - log.debug("删除舞台里面的设备!"); - Map map = new HashMap<>(); - map.put("device_id", ""); - map.put("device_code", ""); - map.put("device_name", ""); - stageActorTab.update(map, "device_code = '" + device_code + "'"); - - log.debug("根据设备编码查询在缓存里面的舞台数据,并删除掉!"); - JSONArray jsonArr = WQL.getWO("QStage_01").addParam("flag", "1").addParam("device_code", device_code).process().getResultJSONArray(0); - for (int i = 0; i < jsonArr.size(); i++) { - String stage_code = jsonArr.getJSONObject(i).getString("stage_code"); - redisUtils.del("stage:mst:" + stage_code); - redisUtils.del("stage:dtl:" + stage_code); - } + +// log.debug("删除舞台里面的设备!"); +// Map map = new HashMap<>(); +// map.put("device_id", ""); +// map.put("device_code", ""); +// map.put("device_name", ""); +// stageActorTab.update(map, "device_code = '" + device_code + "'"); + +// log.debug("根据设备编码查询在缓存里面的舞台数据,并删除掉!"); +// JSONArray jsonArr = WQL.getWO("QStage_01").addParam("flag", "1").addParam("device_code", device_code).process().getResultJSONArray(0); +// for (int i = 0; i < jsonArr.size(); i++) { +// String stage_code = jsonArr.getJSONObject(i).getString("stage_code"); +// redisUtils.del("stage:mst:" + stage_code); +// redisUtils.del("stage:dtl:" + stage_code); +// } log.debug("删除缓存里面的设备!"); Device deviceByCode = deviceAppService.findDeviceByCode(device_code); List allDevice = deviceAppService.findAllDevice(); @@ -254,6 +257,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial } } wo.delete("device_id = '" + device_id + "'"); + wo_extra.delete("device_id = '" + device_id + "'"); } } @@ -643,6 +647,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial JSONObject parentForm = jsonObject.getJSONObject("parentForm"); //得到扩展属性表字段记录 JSONObject form = jsonObject.getJSONObject("form"); + JSONObject modeform = jsonObject.getJSONObject("modeform"); //设备标识 String device_id = parentForm.getString("device_id"); String device_code = parentForm.getString("device_code"); @@ -767,8 +772,8 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial } } - WQLObject wo = WQLObject.getWQLObject("acs_storage_cell"); if (StrUtil.equals(device_type, "storage")) { + WQLObject wo = WQLObject.getWQLObject("acs_storage_cell"); int x = form.getInteger("x"); int maxY = form.getInteger("maxY"); int minY = form.getInteger("minY"); @@ -794,6 +799,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial } } else { //空盘堆叠驱动 需要按照数量生成 + WQLObject wo = WQLObject.getWQLObject("acs_storage_cell"); if (StrUtil.equals(driver_code, "standard_emptypallet_site") && form.containsKey("max_emptypalletnum")) { int num = form.getInteger("max_emptypalletnum"); for (int i = 1; i < num + 1; i++) { @@ -830,8 +836,33 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial } } + JSONArray tableData = new JSONArray(); + if(ObjectUtil.isNotEmpty(modeform)){ + tableData = modeform.getJSONArray("tableData"); + } - //deviceAppService.reload(); + if (tableData != null) { + //设备扩展表【acs_device_extra】 + WQLObject wo = WQLObject.getWQLObject("acs_device_extra"); + wo.delete("device_id = '" + device_id + "' and filed_type = '04'"); + for (int i = 0; i < tableData.size(); i++) { + JSONObject param = new JSONObject(); + JSONObject json = tableData.getJSONObject(i); + param.put("extra_id", IdUtil.simpleUUID()); + //heartbeat + param.put("extra_code", json.getString("mode")); + param.put("extra_name", json.getString("request")); + param.put("remark", json.getString("mode")); + param.put("order_seq", i + 1); + //DB读 + param.put("filed_type", "04"); + param.put("device_id", device_id); + param.put("device_code", device_code); + param.put("create_by", SecurityUtils.getCurrentUsername()); + param.put("create_time", DateUtil.now()); + wo.insert(param); + } + } } @Override @@ -1260,7 +1291,19 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial } } - + JSONArray modeRequest = WQLObject.getWQLObject("acs_device_extra").query("filed_type='04' and device_id = '" + device_id + "'", "order_seq").getResultJSONArray(0); + JSONArray mq_arr = new JSONArray(); + for (int i = 0; i < modeRequest.size(); i++) { + JSONObject jo = new JSONObject(); + String extra_code = modeRequest.getJSONObject(i).getString("extra_code"); + String extra_name = modeRequest.getJSONObject(i).getString("extra_name"); + jo.put("mode", extra_code); + jo.put("request", extra_name); + mq_arr.add(jo); + } + if (!mq_arr.isEmpty()) { + result.put("modeform", mq_arr); + } } else { //处理DB读和写属性 // result.put("rs", ReadUtil.getReadableItemDtos()); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/wql/Qdevice_query_002.wql b/acs/nladmin-system/src/main/java/org/nl/acs/device/wql/Qdevice_query_002.wql index b3a2156..221da57 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/wql/Qdevice_query_002.wql +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/wql/Qdevice_query_002.wql @@ -79,7 +79,7 @@ LEFT JOIN acs_opc_plc plc ON d.opc_plc_id = plc.plc_id WHERE d.is_delete = '0' - and e.filed_type != '01' + and e.filed_type in ('02','03') OPTION 输入.blurry <> "" ( d.device_code LIKE 输入.blurry or d.device_name LIKE 输入.blurry) ENDOPTION diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java new file mode 100644 index 0000000..33b59b3 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/RequestMethodEnum.java @@ -0,0 +1,130 @@ +package org.nl.acs.device_driver; + + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +/** + * 驱动类型 + * https://blog.csdn.net/moneyshi/article/details/82978073 + */ +public enum RequestMethodEnum { + order_verify(1, "order_verify", "人工排产确认"), + + order_finish(2, "order_finish", "工单完成"), + + apply_put_full_vehicle(3, "apply_put_full_vehicle", "申请补满料盅托盘(叫料)"), + + apply_put_empty_vehicle(4, "apply_put_empty_vehicle", "申请补空料盅托盘(叫空盘)"), + + apply_take_empty_vehicle(5, "apply_take_empty_vehicle", "申请取走空料盅托盘(取空盘)"), + + apply_take_full_vehicle(6, "apply_take_full_vehicle", "申请取走满料盅托盘(入库)"), + + apply_force_take_full_vehicle(7, "apply_force_take_full_vehicle", "申请强制取走满料盅托盘(强制入库)"), + + apply_force_take_full_vehicle_in_storage(8, "apply_force_take_full_vehicle_in_storage", "申请强制满托入缓存"), + + barcode_sucess_apply(9, "barcode_sucess_apply", "扫码成功申请"), + + get_vehicle_info(10, "get_vehicle_info", "获取组盘信息"), + + force_no_package(11, "force_no_package", "强制去包装位-不包装"), + + apply_labelling(12, "apply_labelling", "申请贴标"), + + apply_one_grab(13, "apply_one_grab", "单次放置完成"); + + + //驱动索引 + private int index; + //驱动编码 + private String code; + // 驱动名字 + private String name; + //驱动描述 + private String desc; + //设备驱动类型 + private String type; + + // 构造方法 + RequestMethodEnum(int index, String code, String name) { + this.index = index; + this.code = code; + this.name = name; + } + + + public static JSONArray getList() { + JSONArray arr = new JSONArray(); + for (RequestMethodEnum em : RequestMethodEnum.values()) { + JSONObject json = new JSONObject(); + json.put("code", em.getCode()); + json.put("name", em.getName()); + arr.add(json); + } + return arr; + } + + public static JSONArray getListByType(String type) { + JSONArray arr = new JSONArray(); + for (RequestMethodEnum em : RequestMethodEnum.values()) { + if (em.getType().equals(type)) { + JSONObject json = new JSONObject(); + json.put("code", em.getCode()); + json.put("name", em.getName()); + arr.add(json); + } + } + return arr; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public static String getName(String code) { + for (RequestMethodEnum c : RequestMethodEnum.values()) { + if (c.code == code) { + return c.name; + } + } + return null; + } + + public int getIndex() { + return index; + } + + public void setIndex(int index) { + this.index = index; + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/StandardRequestMethod.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/StandardRequestMethod.java new file mode 100644 index 0000000..8659b4a --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/StandardRequestMethod.java @@ -0,0 +1,103 @@ +package org.nl.acs.device_driver; + +public interface StandardRequestMethod { + + /** + * 人工排产确认 + * @return + */ + public default boolean order_verify() { + throw new RuntimeException("未实现"); + }; + + /** + * 工单完成 + * @return + */ + public default boolean order_finish() { + throw new RuntimeException("未实现"); + }; + + /** + * 申请补满料盅托盘 + * @return + */ + public default boolean apply_put_full_vehicle() { + throw new RuntimeException("未实现"); + }; + + /** + * 申请补空料盅托盘 + * @return + */ + public default boolean apply_put_empty_vehicle() { + throw new RuntimeException("未实现"); + }; + + /** + * 申请取走空料盅托盘 + * @return + */ + public default boolean apply_take_empty_vehicle() { + throw new RuntimeException("未实现"); + }; + + /** + * 申请取走满料盅托盘(入库) + * @return + */ + public default boolean apply_take_full_vehicle() { + throw new RuntimeException("未实现"); + }; + + /** + * 申请强制取走满料盅托盘 + * @return + */ + public default boolean apply_force_take_full_vehicle() { + throw new RuntimeException("未实现"); + }; + + /** + * 申请强制满托入缓存 + * @return + */ + public default boolean apply_force_take_full_vehicle_in_storage() { + throw new RuntimeException("未实现"); + }; + + /** + * 扫码成功申请 + * @return + */ + public default boolean barcode_sucess_apply() { + throw new RuntimeException("未实现"); + }; + + /** + * 获取组盘信息 + * @return + */ + public default boolean get_vehicle_info() { + throw new RuntimeException("未实现"); + }; + + /** + * 强制去包装位-不包装 + * @return + */ + public default boolean force_no_package() { + throw new RuntimeException("未实现"); + }; + + + /** + * 申请贴标 + * @return + */ + public default boolean apply_labelling() { + throw new RuntimeException("未实现"); + }; + + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDefination.java new file mode 100644 index 0000000..7a7ec93 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDefination.java @@ -0,0 +1,49 @@ +package org.nl.acs.device_driver.basedriver.agv.ndcone; + +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.DeviceDriverDefination; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceType; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +/** + * NDC单工位AGV + */ +@Service +public class AgvNdcOneDefination implements DeviceDriverDefination { + @Override + public String getDriverCode() { + return "agv_ndc_one"; + } + + @Override + public String getDriverName() { + return "NDC1楼AGV"; + } + + @Override + public String getDriverDescription() { + return "NDC1楼AGV"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new AgvNdcOneDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return AgvNdcOneDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList(); + types.add(DeviceType.agv); + return types; + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java new file mode 100644 index 0000000..a318a54 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -0,0 +1,426 @@ +package org.nl.acs.device_driver.basedriver.agv.ndcone; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.mvel2.util.ErrorUtil; +import org.nl.acs.agv.server.NDCAgvService; +import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.basedriver.agv.utils.OneAgvPhase; +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; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.instruction.service.impl.InstructionServiceImpl; +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; +import org.nl.modules.system.service.ParamService; +import org.nl.modules.system.service.impl.ParamServiceImpl; +import org.nl.modules.wql.util.SpringContextHolder; +import org.nl.start.auto.run.NDCSocketConnectionAutoRun; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * NDC单工位AGV + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor { + + ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); + InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); + NDCAgvService NDCAgvService = SpringContextHolder.getBean(NDCAgvService.class); + DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); + DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); + DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); + + OneAgvPhase oneAgvPhase = new OneAgvPhase(); + + int agvaddr = 0; + int agvaddr_copy = 0; + int weight = 0; + String device_code = ""; + int phase = 0; + String error_type = "agv_error_type"; + String error_code = "0"; + int x = 0; //x坐标 + int y = 0; //y坐标 + int angle = 0; //角度 + int electric_qty = 0; //电量 + int status = 0; //三色灯状态 + int error = 0; + int last_error = 0; + String error_message = ""; + + private synchronized void setErrorInfo(int error, String error_code, String error_message) { + this.error = error; + this.error_code = error_code; + this.error_message = error_message; + } + + private Instruction instruction; + + int mode = 2; + + // @LokiLog(type = LokiLogType.AGV) + public synchronized void processSocket(int[] arr) throws Exception { + device_code = this.getDeviceCode(); + byte[] data = null; + phase = arr[16] * 256 + arr[17]; + // agv任务号 + int index = arr[12] * 256 + arr[13]; + //任务号 + int ikey = arr[26] * 256 + arr[27]; + //站点号 + agvaddr = arr[18] * 256 + arr[19]; + //车号 + int carno = arr[20]; + logServer.deviceExecuteLog(this.device_code, "", "", "接收agv上报信息:" + "phase--" + phase + " index--" + index + " 指令号--" + ikey + " 站点号--" + agvaddr + " 车号--" + carno); + Instruction link_inst = null; + List insts = null; + Instruction inst = null; + boolean link_flag = false; + Device agv_device = null; + if (carno != 0) { + agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno)); + } + if (ikey != 0) { + if (phase != 0x67 && phase != 0x71 && phase != 0x72 && phase != 0x73 && phase != 0x74 && phase != 0x75) { + inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); + this.instruction = inst; + } +// if (ObjectUtil.isEmpty(inst)){ +// inst = instructionService.findByCode(String.valueOf(ikey)); +// } + } + if (!ObjectUtil.isEmpty(link_inst)) { + link_flag = true; + } + + Device device = null; + String old_device_code = null; + String emptyNum = null; + String device_code = null; + +// if (phase == 0x67) { +// //故障信息 +// if (arr[18] * 256 + arr[19] == 0) { +// +// } +// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); +// } + + //普通站点 + StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; + //货架 + StandardStorageDeviceDriver standardStorageDeviceDriver; + + + //分配 车id + //(不需要WCS反馈) + if (phase == 0x02) { + inst.setCarno(String.valueOf(carno)); + instructionService.update(inst); + logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈车号:" + carno + ",指令号:" + ikey); + + //到达取货点 + //(需要WCS反馈) + } else if (phase == 0x03) { + if (agvaddr == 0) { + agvaddr = agvaddr_copy; + } + if (agvaddr < 1) { + logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); + return; + } + device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (agvaddr != 0) { + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, "-")) { + String[] point = old_device_code.split("-"); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, ".")) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + emptyNum = point[1]; + } else { + device_code = old_device_code; + } + } + + device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device_code)) { + log.info(agvaddr + "对应设备号为空!"); + logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空"); + return; + } + //校验agv上报站点编号与指令起始点相同 + if (ObjectUtil.isEmpty(inst)) { + log.info("未找到编号{}对应的指令", ikey); + logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); + return; + } + + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + standardOrdinarySiteDeviceDriver.setAgvphase(phase); + standardOrdinarySiteDeviceDriver.setIndex(index); + standardOrdinarySiteDeviceDriver.setInst(inst); + } + + + if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } + //取货完毕 + //(需要WCS反馈) + } else if (phase == 0x05) { + if (agvaddr == 0) { + agvaddr = agvaddr_copy; + } + if (agvaddr < 1) { + logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); + return; + } + if (agvaddr != 0) { + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, "-")) { + String[] point = old_device_code.split("-"); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, ".")) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + emptyNum = point[1]; + } else { + device_code = old_device_code; + } + } + device = deviceAppService.findDeviceByCode(device_code); + + if (ObjectUtil.isEmpty(device_code)) { + log.info(agvaddr + "对应设备号为空!"); + logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code); + return; + } + //校验agv上报站点编号与指令起始点相同 + if (ObjectUtil.isEmpty(inst)) { + log.info("未找到关联编号{}对应的指令", ikey); + logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); + return; + } + + if (StrUtil.equals(inst.getStart_device_code(), device_code)) { + + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + standardOrdinarySiteDeviceDriver.setAgvphase(phase); + standardOrdinarySiteDeviceDriver.setIndex(index); + standardOrdinarySiteDeviceDriver.setInst(inst); + } + + if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { + standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver(); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } + + } + if (ObjectUtil.isNotEmpty(data)) { + logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); + } + //到达放货点 + //(需要WCS反馈) + } else if (phase == 0x07) { + if (agvaddr == 0) { + agvaddr = agvaddr_copy; + } + if (agvaddr < 1) { + logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); + return; + } + if (agvaddr != 0) { + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, "-")) { + String[] point = old_device_code.split("-"); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, ".")) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + emptyNum = point[1]; + } else { + device_code = old_device_code; + } + } + device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device_code)) { + log.info(agvaddr + "对应设备号为空!"); + return; + } + //校验agv上报站点编号与指令起始点相同 + if (ObjectUtil.isEmpty(inst)) { + log.info("未找到关联编号{}对应的指令", ikey); + return; + } + if (StrUtil.equals(inst.getNext_device_code(), device_code)) { + + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } + + if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { + standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver(); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } + + } + //放货完毕 + //(需要WCS反馈) + } else if (phase == 0x09) { + if (agvaddr == 0) { + agvaddr = agvaddr_copy; + } + if (agvaddr < 1) { + logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); + return; + } + if (agvaddr != 0) { + old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); + if (StrUtil.contains(old_device_code, "-")) { + String[] point = old_device_code.split("-"); + device_code = point[0]; + } else if (StrUtil.contains(old_device_code, ".")) { + String[] point = old_device_code.split("\\."); + device_code = point[0]; + emptyNum = point[1]; + } else { + device_code = old_device_code; + } + } + + device = deviceAppService.findDeviceByCode(device_code); + if (ObjectUtil.isEmpty(device_code)) { + log.info(agvaddr + "对应设备号为空!"); + return; + } + //校验agv上报站点编号与指令起始点相同 + if (ObjectUtil.isEmpty(inst)) { + log.info("未找到编号{}对应的指令", ikey); + return; + } + if (StrUtil.equals(inst.getNext_device_code(), device_code)) { + + if (device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { + standardStorageDeviceDriver = (StandardStorageDeviceDriver) device.getDeviceDriver(); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } + + if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { + standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } + + } + } + //到达位置点 + //(需要WCS反馈) + else if (phase == 0x64) {//param,agv货位id待定 + //1、根据货位id找到对应三工位设备,赋给agv属性地址对应的满料位设备 + agvaddr = arr[18] * 256 + arr[19]; + agvaddr_copy = agvaddr; + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } else if (phase == 0x50) {//进入交通灯区域 + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } else if (phase == 0x51) {//离开交通灯区域 + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } else if (phase == 0x67) {//agv异常 + if (ikey == 0) { + this.setErrorInfo(ikey, "0", "正常"); + } else { + + } + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + last_error = error; + } else if (phase == 0x70) { + //x坐标 + x = ikey; + } else if (phase == 0x71) { + //y坐标 + y = ikey; + } else if (phase == 0x72) { + //车辆角度 + angle = ikey; + } else if (phase == 0x73) { + //agv电量 + electric_qty = ikey; + } else if (phase == 0x74) { + //三色灯状态 + status = ikey; + } + if (!ObjectUtil.isEmpty(data)) { + phase = 0; + logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); + NDCSocketConnectionAutoRun.write(data); + } + + } + + public static String Bytes2HexString(byte[] b) { + String ret = ""; + for (int i = 0; i < b.length; i++) { + String hex = Integer.toHexString(b[i] & 0xFF); + if (hex.length() == 1) { + hex = '0' + hex; + } + ret += hex.toUpperCase(); + } + return ret; + } + + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + //agv编码 + jo.put("car_no", this.getDevice().getDevice_code()); + //agv名称 + jo.put("device_name", this.getDevice().getDevice_name()); + //x坐标 + jo.put("x", this.getX()); + //y坐标 + jo.put("y", this.getY()); + //角度 + jo.put("angle", this.getAngle()); + jo.put("phase", phase); + jo.put("phase_name", oneAgvPhase.getPhaseName(phase)); + //电量 + jo.put("electricity", this.getElectric_qty()); + String status_name = this.status == 1 ? "关机" : this.status == 2 ? "工作中" : this.status == 3 ? "交通管制" : this.status == 4 ? "任务等待" : this.status == 5 ? "充电中" : this.status == 6 ? "故障中" : this.status == 7 ? "电量低" : "正常"; + //agv状态 + jo.put("status_name", status_name); + //任务号 + jo.put("task_code", ObjectUtil.isEmpty(instruction) ? "0" : instruction.getTask_code()); + //异常 + jo.put("fault", this.getError_message()); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDefination.java index 5043ddd..9edd2cf 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDefination.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_truss/LnshKilnTrussDefination.java @@ -50,19 +50,7 @@ public class LnshKilnTrussDefination implements OpcDeviceDriverDefination { @Override public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.STRING4.50")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D56")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D60")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D64")); - return list; + return ItemProtocol.getReadableItemDtos(); } @Override diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java index 3a9398b..5642abe 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/ItemProtocol.java @@ -135,29 +135,29 @@ public class ItemProtocol { public static List getReadableItemDtos() { ArrayList list = new ArrayList<>(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB4.B0")); - list.add(new ItemDto(item_mode, "工作模式", "DB4.B1", Boolean.TRUE)); - list.add(new ItemDto(item_status, "设备状态", "DB4.B2")); - list.add(new ItemDto(item_error, "故障代码", "DB4.B3")); - list.add(new ItemDto(item_open_time, "开机时间", "DB4.STRING4.50")); - list.add(new ItemDto(item_standby_time, "待机时间", "DB4.D56")); - list.add(new ItemDto(item_production_time, "生产时间", "DB4.D60")); - list.add(new ItemDto(item_error_time, "故障时间", "DB4.D64")); - list.add(new ItemDto(item_weight, "当前生产重量", "DB4.D68")); - list.add(new ItemDto(item_order_No, "工单号", "DB4.STRING72.50")); - list.add(new ItemDto(item_mix_num, "碾次", "DB4.D124")); - list.add(new ItemDto(item_material, "当前生产物料", "DB4.STRING128.50")); + list.add(new ItemDto(item_heartbeat, "心跳", "DB6.B0")); + list.add(new ItemDto(item_mode, "工作模式", "DB6.B1", Boolean.TRUE)); + list.add(new ItemDto(item_status, "设备状态", "DB6.B2")); + list.add(new ItemDto(item_error, "故障代码", "DB6.B3")); + list.add(new ItemDto(item_open_time, "开机时间", "DB6.STRING4.50")); + list.add(new ItemDto(item_standby_time, "待机时间", "DB6.D56")); + list.add(new ItemDto(item_production_time, "生产时间", "DB6.D60")); + list.add(new ItemDto(item_error_time, "故障时间", "DB6.D64")); + list.add(new ItemDto(item_weight, "当前生产重量", "DB6.D68")); + list.add(new ItemDto(item_order_No, "工单号", "DB6.STRING72.50")); + list.add(new ItemDto(item_mix_num, "碾次", "DB6.D124")); + list.add(new ItemDto(item_material, "当前生产物料", "DB6.STRING128.50")); return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList<>(); - list.add(new ItemDto(item_to_command, "反馈", "DB5.W0", Boolean.TRUE)); - list.add(new ItemDto(item_to_error, "error", "DB5.W2")); - list.add(new ItemDto(item_to_order_No, "工单号", "DB5.STRING4.50")); - list.add(new ItemDto(item_to_weight, "生产重量", "DB5.D56")); - list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB5.STRING60.50")); + list.add(new ItemDto(item_to_command, "反馈", "DB7.W0", Boolean.TRUE)); + list.add(new ItemDto(item_to_error, "error", "DB7.W2")); + list.add(new ItemDto(item_to_order_No, "工单号", "DB7.STRING4.50")); + list.add(new ItemDto(item_to_weight, "生产重量", "DB7.D56")); + list.add(new ItemDto(item_to_material_code, "下发物料编号", "DB7.STRING60.50")); return list; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDefination.java index 12bd454..436f1b4 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDefination.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDefination.java @@ -52,25 +52,7 @@ public class LnshMixingMillDefination implements OpcDeviceDriverDefination { @Override public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList<>(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB4.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB4.B1", Boolean.TRUE)); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB4.B2")); - list.add(new ItemDto(ItemProtocol.item_error, "故障代码", "DB4.B3")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB4.STRING4.50")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB4.D56")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB4.D60")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB4.D64")); - list.add(new ItemDto(ItemProtocol.item_weight, "当前生产重量", "DB4.D68")); - list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB4.STRING72.50")); - list.add(new ItemDto(ItemProtocol.item_mix_num, "碾次", "DB4.D124")); - list.add(new ItemDto(ItemProtocol.item_material, "当前生产物料", "DB4.STRING128.50")); - - return list; + return ItemProtocol.getReadableItemDtos(); } @Override diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java index 394cb8c..714a600 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_mixing_mill/LnshMixingMillDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.lnsh.lnsh_mixing_mill; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpResponse; @@ -8,12 +9,17 @@ import lombok.Getter; import lombok.Setter; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.agv.AgvUtil; import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.RequestMethodEnum; import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.StandardRequestMethod; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.data.Resp; +import org.nl.acs.ext.wms.data.applyTask.ApplyTaskRequest; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; @@ -21,15 +27,16 @@ import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.Device; import org.nl.acs.order.service.ProduceshiftorderService; -import org.nl.acs.order.service.dto.ProduceshiftorderDto; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.task.service.TaskService; +import org.nl.modules.lucene.service.LuceneExecuteLogService; +import org.nl.modules.lucene.service.dto.LuceneLogDto; import org.nl.modules.wql.util.SpringContextHolder; import org.openscada.opc.lib.da.Server; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -42,9 +49,11 @@ import java.util.Map; @Getter @Setter @RequiredArgsConstructor -public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { +public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, StandardRequestMethod { protected ItemProtocol itemProtocol = new ItemProtocol(this); + LuceneExecuteLogService lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); + InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); @@ -115,7 +124,7 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen @Override public void execute() { - String message = null; + message = null; try { device_code = this.getDeviceCode(); mode = this.itemProtocol.getMode(); @@ -132,50 +141,13 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen if (mode != last_mode) { this.setRequireSucess(false); - logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); - logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + " -> " + mode); } if (error != last_error) { - logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + " -> " + error); - } - if (status != last_status) { - logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); - logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + " -> " + status); - } - if (!open_time.equals(last_open_time)) { - logServer.deviceItemValue(this.device_code,"open_time" ,String.valueOf(open_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号open_time:" + last_open_time + " -> " + open_time); - } - if (standby_time != last_standby_time) { - logServer.deviceItemValue(this.device_code,"standby_time" ,String.valueOf(standby_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号standby_time:" + last_standby_time + " -> " + standby_time); - } - if (production_time != last_production_time) { - logServer.deviceItemValue(this.device_code,"production_time" ,String.valueOf(production_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号production_time:" + last_production_time + " -> " + production_time); - } - if (error_time != last_error_time) { - logServer.deviceItemValue(this.device_code,"error_time" ,String.valueOf(error_time)); - logServer.deviceExecuteLog(this.device_code,"","","信号error_time:" + last_error_time + " -> " + error_time); - } - if (weight != last_weight) { - logServer.deviceItemValue(this.device_code,"weight" ,String.valueOf(weight)); - logServer.deviceExecuteLog(this.device_code,"","","信号weight:" + last_weight + " -> " + weight); - } - if (!StrUtil.equals(material,last_material)) { - logServer.deviceItemValue(this.device_code,"material" ,String.valueOf(material)); - logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + " -> " + material); - } - if (!StrUtil.equals(order_No,last_order_No)) { - logServer.deviceItemValue(this.device_code,"order_No" ,order_No); - logServer.deviceExecuteLog(this.device_code,"","","信号order_No:" + last_order_No + " -> " + order_No); - } - if (mix_num != last_mix_num) { - logServer.deviceItemValue(this.device_code,"mix_num" ,String.valueOf(mix_num)); - logServer.deviceExecuteLog(this.device_code,"","","信号mix_num:" + last_mix_num + " -> " + mix_num); + logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); + logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + " -> " + error); } + } catch (Exception var17) { return; } @@ -196,44 +168,22 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen message = ""; Instruction instruction = null; List toInstructions; - switch (mode) { - case 1: - log.debug("设备运转模式:等待工作"); - return; - case 2: - break; - case 3: - //排产单确认 - if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) { - JSONObject json = new JSONObject(); - json.put("workorder_code", order_No); - json.put("type", "1"); - enterProduction(json); - } - break; - case 4: - //工单完成反馈 - if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) { - JSONObject json = new JSONObject(); - json.put("workorder_code", order_No); - json.put("qty", weight); - json.put("type", "2"); - enterProduction(json); - } - break; - } - switch (flag) { - //取货完成 - case 3: - writing(3); - return; - //放货完成 - case 4: - writing(4); - return; + if (mode > 2) { + if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get(String.valueOf(mode)))) { + String modethod = this.device.getExtraValue().get(String.valueOf(mode)).toString(); + try { + applyRequest(modethod); + } catch (Exception e) { + message = "错误:" + e.getMessage(); + this.setIserror(true); + } + } else { + message = "无效模式请求,驱动未配置此请求方法"; + } + } else { + message = "无请求"; } - } last_mode = mode; last_status = status; @@ -248,39 +198,6 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen last_mix_num = mix_num; } - /** - * 排产单确认 - * - * @param - */ - public synchronized boolean enterProduction(JSONObject json) { - 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; - HttpResponse result = acsToWmsService.enterOrder(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == HttpStatus.OK.value()) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { -// ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); -// if (this.mode == 3) { -// dto.setOrder_status("1"); -// } else if (this.mode == 4) { -// dto.setOrder_status("2"); -// } -// produceshiftorderService.update(dto); - this.writing(this.mode); - this.setRequireSucess(true); - } - } - } - return true; - } - } - public boolean exe_error() { if (this.error == 0) { @@ -352,7 +269,6 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen } - public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { if (obj == null || StrUtil.isBlank(fieldName)) { return null; @@ -450,4 +366,98 @@ public class LnshMixingMillDeviceDriver extends AbstractOpcDeviceDriver implemen public void setDeviceStatus(JSONObject data) { } + + + /** + * 请求 + * + * @param + */ + public synchronized boolean applyRequest(String modethod) throws Exception { + Object obj1 = this; + 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; + Object obj = this.getClass().getDeclaredConstructor().newInstance(); + Method method1 = this.getClass().getMethod(modethod, null); + method1.invoke(this, null); + return true; + } + } + + public synchronized boolean order_verify() { + if (!"0".equals(order_No) && StrUtil.isNotBlank(order_No)) { + JSONObject json = new JSONObject(); + json.put("workorder_code", order_No); + json.put("type", "1"); + message = RequestMethodEnum.getName("order_verify") + "order_verify 接口请求LMS..."; + lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + json)); + HttpResponse result = acsToWmsService.enterOrder(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(mode); + this.setRequireSucess(true); + } + lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, RequestMethodEnum.getName("order_verify") + jsonObject)); + } + } else { + message = "order_verify接口请求失败,无返回信息"; + lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); + } + } + return true; + } + + public synchronized boolean order_finish() { + if (!"0".equals(order_No) && StrUtil.isNotBlank(order_No)) { + JSONObject json = new JSONObject(); + json.put("workorder_code", order_No); + json.put("type", "1"); + message = RequestMethodEnum.getName("order_finish") + "order_finish 接口请求LMS..."; + lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + json)); + HttpResponse result = acsToWmsService.enterOrder(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(mode); + this.setRequireSucess(true); + } + lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, RequestMethodEnum.getName("order_verify") + jsonObject)); + } + } else { + message = RequestMethodEnum.getName("order_finish") + "order_finish 接口请求失败,无返回信息"; + lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); + } + } + return true; + } + + /** + * 申请补空料盅托盘 + * + * @param + */ + public synchronized boolean apply_put_empty_vehicle() { + ApplyTaskRequest request = new ApplyTaskRequest(); + request.setDevice_code(this.getDevice_code()); + request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); + request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); + request.setRequestNo(IdUtil.simpleUUID()); + request.setRequestDate(AgvUtil.getDate()); + Resp resp = acsToWmsService.applyTask(request); + if (StrUtil.equals(resp.result, "true")) { + this.writing(this.mode); + this.setRequireSucess(true); + } else { + this.writing(400); + } + return true; + + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDefination.java index acce576..f9731aa 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDefination.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_line/LnshPackageLineDefination.java @@ -50,23 +50,9 @@ public class LnshPackageLineDefination implements OpcDeviceDriverDefination { @Override public List getReadableItemDtos() { - return getReadableItemDtos2(); + return ItemProtocol.getReadableItemDtos(); } - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList<>(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "VB6000")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "VB6001", Boolean.TRUE)); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "VB6002")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "VB6010.20")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "VD6030")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "VD6035")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "VD6040")); - list.add(new ItemDto(ItemProtocol.item_vehicle_code, "载具编码", "VW6005")); - list.add(new ItemDto(ItemProtocol.item_vehicle_type, "载具类型", "VB6003")); - list.add(new ItemDto(ItemProtocol.item_error, "故障类型", "VB6004")); - return list; - } @Override public List getWriteableItemDtos() { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDefination.java index 8aaf6fc..8f08ec6 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDefination.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDefination.java @@ -52,31 +52,7 @@ public class LnshPackagePalletManipulatorDefination implements OpcDeviceDriverDe @Override public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(ItemProtocol.item_error, "故障代码", "DB1.B3")); - list.add(new ItemDto(ItemProtocol.item_putStation, "当前工位", "DB1.D4")); - list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB1.STRING8.50")); - list.add(new ItemDto(ItemProtocol.item_qty, "拆/码垛数量", "DB1.D60")); - list.add(new ItemDto(ItemProtocol.item_order_qty, "工单总数量", "DB1.D64")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.STRING68.50")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D120")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D124")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D128")); - list.add(new ItemDto(ItemProtocol.item_order_No, "工单号", "DB1.STRING132.50")); - - list.add(new ItemDto(ItemProtocol.item_product_code, "产品编号", "DB1.W184")); - list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB1.W186")); - list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB1.W188")); - list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB1.W190")); - list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB1.W192")); - return list; + return ItemProtocol.getReadableItemDtos(); } @Override diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java index 9396ad7..66ed072 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java @@ -245,67 +245,7 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD message = ""; Instruction instruction = null; List toInstructions; - switch (mode) { - case 1: - log.debug("设备运转模式:等待工作"); - return; - case 2: - break; - case 4: - //排产单确认 - if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) { - JSONObject json = new JSONObject(); - json.put("workorder_code", order_No); - json.put("type", "1"); - enterProduction(json); - } - break; -// case 5: -// //获取托盘信息 -// if (!requireSucess) { -// getVehicle(); -// } -// break; -// case 6: -// //码垛完成 -// if (!requireSucess) { -// applyEmpty(); -// palletizing(); -// } -// break; -// case 7: -// //码垛强制完成 -// if (!requireSucess) { -// mandatoryPalletizing(); -// } -// break; -// case 8: -// //申请空盘 -// if (!requireSucess) { -// applyEmpty(); -// } -// break; - case 9: - //工单完成 - if (!requireSucess && !"0".equals(order_No) && StrUtil.isNotBlank(order_No)) { - JSONObject json = new JSONObject(); - json.put("workorder_code", order_No); - json.put("qty", qty); - json.put("type", "2"); - enterProduction(json); - } - break; - } - - switch (flag) { - //取货完成 - case 1: - return; - //放货完成 - case 2: - return; - } } last_mode = mode; @@ -340,298 +280,6 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD } } - /** - * 排产单确认 - * - * @param - */ - public synchronized boolean enterProduction(JSONObject json) { - 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; - HttpResponse result = acsToWmsService.enterOrder(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == HttpStatus.OK.value()) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { -// ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); -// if (this.mode == 4) { -// dto.setOrder_status("1"); -// } else if (this.mode == 9) { -// dto.setOrder_status("2"); -// } -// produceshiftorderService.update(dto); - this.writing(this.mode); - this.setRequireSucess(true); - } - } - } - return true; - } - } - - /** - * 获取托盘信息 - * - * @param - */ - public synchronized boolean getVehicle() { - 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; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("vehicle_code",barcode); - JSONObject jo = new JSONObject(); - - if (jo.getInteger("status") == 200) { - JSONObject content = jo.getJSONObject("content"); - String qty = content.getString("qty"); - String material_code = content.getString("material_code"); - String material_name = content.getString("material_name"); - String product_code = content.getString("product_code"); - String AlongSide = content.getString("AlongSide"); - String BshortSide = content.getString("BshortSide"); - String Htrapezoidal = content.getString("Htrapezoidal"); - String Wthickness = content.getString("Wthickness"); - String tray_qty = content.getString("tray_qty"); - String tray_high = content.getString("tray_high"); - String crib_category = content.getString("crib_category"); - String palletX1_line = content.getString("palletX1_line"); - String palletY1_row = content.getString("palletY1_row"); - String palletA1_angle = content.getString("palletA1_angle"); - String palletX2_line = content.getString("palletX2_line"); - String palletY2_row = content.getString("palletY2_row"); - String palletA2_angle = content.getString("palletA2_angle"); - String palletX3_line = content.getString("palletX3_line"); - String palletY3_row = content.getString("palletY3_row"); - String palletA3_angle = content.getString("palletA3_angle"); - String pressCribX1_line = content.getString("pressCribX1_line"); - String pressCribY1_row = content.getString("pressCribY1_row"); - String pressCribA1_angle = content.getString("pressCribA1_angle"); - String pressCribX2_line = content.getString("pressCribX2_line"); - String pressCribY2_row = content.getString("pressCribY2_row"); - String pressCribA2_angle = content.getString("pressCribA2_angle"); - String pressCribX3_line = content.getString("pressCribX3_line"); - String pressCribY3_row = content.getString("pressCribY3_row"); - String pressCribA3_angle = content.getString("pressCribA3_angle"); - String Zoffset = content.getString("Zoffset"); - String pallet_layerQty = content.getString("pallet_layerQty"); - String pressCrib_layerQty = content.getString("pressCrib_layerQty"); - String codeLayerX1_interval = content.getString("codeLayerX1_interval"); - String codeLayerY1_interval = content.getString("codeLayerY1_interval"); - String codeLayerX2_interval = content.getString("codeLayerX2_interval"); - String codeLayerY2_interval = content.getString("codeLayerY2_interval"); - String codeLayerX3_interval = content.getString("codeLayerX3_interval"); - String codeLayerY3_interval = content.getString("codeLayerY3_interval"); - String codeLayerX1_offset = content.getString("codeLayerX1_offset"); - String codeLayerY1_offset = content.getString("codeLayerY1_offset"); - String codeLayerX2_offset = content.getString("codeLayerX2_offset"); - String codeLayerY2_offset = content.getString("codeLayerY2_offset"); - String codeLayerX3_offset = content.getString("codeLayerX3_offset"); - String codeLayerY3_offset = content.getString("codeLayerY3_offset"); - String pressLayerX1_interval = content.getString("pressLayerX1_interval"); - String pressLayerY1_interval = content.getString("pressLayerY1_interval"); - String pressLayerX2_interval = content.getString("pressLayerX2_interval"); - String pressLayerY2_interval = content.getString("pressLayerY2_interval"); - String pressLayerX3_interval = content.getString("pressLayerX3_interval"); - String pressLayerY3_interval = content.getString("pressLayerY3_interval"); - String pressLayerX1_offset = content.getString("pressLayerX1_offset"); - String pressLayerY1_offset = content.getString("pressLayerY1_offset"); - String pressLayerX2_offset = content.getString("pressLayerX2_offset"); - String pressLayerY2_offset = content.getString("pressLayerY2_offset"); - String pressLayerX3_offset = content.getString("pressLayerX3_offset"); - String pressLayerY3_offset = content.getString("pressLayerY3_offset"); - String one_cribTotal = content.getString("one_cribTotal"); - String two_cribTotal = content.getString("two_cribTotal"); - String one_qty = content.getString("one_qty"); - String two_qty = content.getString("two_qty"); - String tool_coordinate = content.getString("tool_coordinate"); - - this.writing("to_material_qty",qty); - this.writing("to_material_code",material_code); - this.writing("to_product_code",product_code); - this.writing("to_AlongSide",AlongSide); - this.writing("to_BshortSide",BshortSide); - this.writing("to_Htrapezoidal",Htrapezoidal); - this.writing("to_Wthickness",Wthickness); - this.writing("to_tray_qty",tray_qty); - this.writing("to_tray_high",tray_high); - this.writing("to_crib_category",crib_category); - this.writing("to_palletX1_line",palletX1_line); - this.writing("to_palletY1_row",palletY1_row); - this.writing("to_palletA1_angle",palletA1_angle); - this.writing("to_palletX2_line",palletX2_line); - this.writing("to_palletY2_row",palletY2_row); - this.writing("to_palletA2_angle",palletA2_angle); - this.writing("to_palletX3_line",palletX3_line); - this.writing("to_palletY3_row",palletY3_row); - this.writing("to_palletA3_angle",palletA3_angle); - this.writing("to_pressCribX1_line",pressCribX1_line); - this.writing("to_pressCribY1_row",pressCribY1_row); - this.writing("to_pressCribA1_angle",pressCribA1_angle); - this.writing("to_pressCribX2_line",pressCribX2_line); - this.writing("to_pressCribY2_row",pressCribY2_row); - this.writing("to_pressCribA2_angle",pressCribA2_angle); - this.writing("to_pressCribX3_line",pressCribX3_line); - this.writing("to_pressCribY3_row",pressCribY3_row); - this.writing("to_pressCribA3_angle",pressCribA3_angle); - this.writing("to_Zoffset",Zoffset); - this.writing("to_pallet_layerQty",pallet_layerQty); - this.writing("to_pressCrib_layerQty",pressCrib_layerQty); - this.writing("to_codeLayerX1_interval",codeLayerX1_interval); - this.writing("to_codeLayerY1_interval",codeLayerY1_interval); - this.writing("to_codeLayerX2_interval",codeLayerX2_interval); - this.writing("to_codeLayerY2_interval",codeLayerY2_interval); - this.writing("to_codeLayerX3_interval",codeLayerX3_interval); - this.writing("to_codeLayerY3_interval",codeLayerY3_interval); - this.writing("to_codeLayerX1_offset",codeLayerX1_offset); - this.writing("to_codeLayerY1_offset",codeLayerY1_offset); - this.writing("to_codeLayerX2_offset",codeLayerX2_offset); - this.writing("to_codeLayerY2_offset",codeLayerY2_offset); - this.writing("to_codeLayerX3_offset",codeLayerX3_offset); - this.writing("to_codeLayerY3_offset",codeLayerY3_offset); - this.writing("to_pressLayerX1_interval",pressLayerX1_interval); - this.writing("to_pressLayerY1_interval",pressLayerY1_interval); - this.writing("to_pressLayerX2_interval",pressLayerX2_interval); - this.writing("to_pressLayerY2_interval",pressLayerY2_interval); - this.writing("to_pressLayerX3_interval",pressLayerX3_interval); - this.writing("to_pressLayerY3_interval",pressLayerY3_interval); - this.writing("to_pressLayerX1_offset",pressLayerX1_offset); - this.writing("to_pressLayerY1_offset",pressLayerY1_offset); - this.writing("to_pressLayerX2_offset",pressLayerX2_offset); - this.writing("to_pressLayerY2_offset",pressLayerY2_offset); - this.writing("to_pressLayerX3_offset",pressLayerX3_offset); - this.writing("to_pressLayerY3_offset",pressLayerY3_offset); - this.writing("to_one_cribTotal",one_cribTotal); - this.writing("to_two_cribTotal",two_cribTotal); - this.writing("to_one_qty",one_qty); - this.writing("to_two_qty",two_qty); - this.writing("to_tool_coordinate",tool_coordinate); - this.writing(this.mode); - requireSucess = true; - - } - return true; - } - } - - /** - * 码垛完成 - * - * @param - */ - public synchronized boolean palletizing() { - 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; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("qty",qty); - json.put("vehicle_code",barcode); - json.put("is_full","1"); - json.put("product_code",product_code); - json.put("AlongSide",AlongSide); - json.put("BshortSide",BshortSide); - json.put("Htrapezoidal",Htrapezoidal); - json.put("Wthickness",Wthickness); - - HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - } - return true; - } - } - - /** - * 码垛强制完成 - * - * @param - */ - public synchronized boolean mandatoryPalletizing() { - 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; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("qty",qty); - json.put("vehicle_code",barcode); - json.put("is_full","0"); - json.put("product_code",product_code); - json.put("AlongSide",AlongSide); - json.put("BshortSide",BshortSide); - json.put("Htrapezoidal",Htrapezoidal); - json.put("Wthickness",Wthickness); - - HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - } - return true; - } - } - - /** - * 申请空盘 - * - * @param - */ - public synchronized boolean applyEmpty() { - 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; - JSONObject json = new JSONObject(); - String linkobj = (String)this.getDevice().getExtraValue().get("link_device_code"); - String demosub = linkobj.substring(1,linkobj.length()-1); - String demoArray[] = demosub.split(","); - List demoList = Arrays.asList(demoArray); - json.put("device_code",demoList.get(put_station-1).replace("\"","")); - json.put("type","4"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == 200) { - this.writing(this.mode); - requireSucess = true; - } - } - return true; - } - } - public boolean exe_business() { return true; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDefination.java index 24d095f..cd74017 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDefination.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDefination.java @@ -52,21 +52,7 @@ public class LnshPalletizingManipulatorDefination implements OpcDeviceDriverDefi @Override public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB1.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB1.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_status, "设备状态", "DB1.B2")); - list.add(new ItemDto(ItemProtocol.item_action, "动作", "DB1.B3")); - list.add(new ItemDto(ItemProtocol.item_error, "故障代码", "DB1.B4")); - list.add(new ItemDto(ItemProtocol.item_open_time, "开机时间", "DB1.STRING6.50")); - list.add(new ItemDto(ItemProtocol.item_standby_time, "待机时间", "DB1.D58")); - list.add(new ItemDto(ItemProtocol.item_production_time, "生产时间", "DB1.D62")); - list.add(new ItemDto(ItemProtocol.item_error_time, "故障时间", "DB1.D66")); - return list; + return ItemProtocol.getReadableItemDtos(); } @Override diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java index ea72af4..26160ac 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java @@ -651,7 +651,6 @@ public class ItemProtocol { public int getOpcIntegerValue(String protocol) { Integer value = this.driver.getIntegeregerValue(protocol); if (value == null) { -// log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); setIsonline(false); } else { setIsonline(true); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDefination.java index 448dad3..33fa62b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDefination.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDefination.java @@ -52,79 +52,7 @@ public class LnshPalletizingManipulatorSiteDefination implements OpcDeviceDriver @Override public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB3.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB3.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB3.B2")); - list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "DB3.B3")); - list.add(new ItemDto(ItemProtocol.item_ioaction, "进出信号", "DB3.B4")); - list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB3.B5")); - list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB3.D6")); - list.add(new ItemDto(ItemProtocol.item_weight, "重量", "DB3.D10")); - list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB3.STRING14.50")); - list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB3.W66")); - list.add(new ItemDto(ItemProtocol.item_encoder_qty, "码盘位当前码盘数量", "DB3.W68")); - list.add(new ItemDto(ItemProtocol.item_unqualified_qty, "不合格数量", "DB3.W70")); - - list.add(new ItemDto(ItemProtocol.item_product_code, "产品编号", "DB3.W72")); - list.add(new ItemDto(ItemProtocol.item_AlongSide, "A长边", "DB3.W74")); - list.add(new ItemDto(ItemProtocol.item_BshortSide, "B短边", "DB3.W76")); - list.add(new ItemDto(ItemProtocol.item_Htrapezoidal, "H梯形高", "DB3.W78")); - list.add(new ItemDto(ItemProtocol.item_Wthickness, "W厚度", "DB3.W80")); - list.add(new ItemDto(ItemProtocol.item_tray_qty, "当前垛盘数", "DB3.W82")); - list.add(new ItemDto(ItemProtocol.item_tray_high, "垛盘高度", "DB3.W84")); - list.add(new ItemDto(ItemProtocol.item_crib_category, "垛型类别", "DB3.W86")); - list.add(new ItemDto(ItemProtocol.item_palletX1_line, "码垛X1行", "DB3.W88")); - list.add(new ItemDto(ItemProtocol.item_palletY1_row, "码垛Y1列", "DB3.W90")); - list.add(new ItemDto(ItemProtocol.item_palletA1_angle, "码垛A1角度", "DB3.W92")); - list.add(new ItemDto(ItemProtocol.item_palletX2_line, "码垛X2行", "DB3.W94")); - list.add(new ItemDto(ItemProtocol.item_palletY2_row, "码垛Y2列", "DB3.W96")); - list.add(new ItemDto(ItemProtocol.item_palletA2_angle, "码垛A2角度", "DB3.W98")); - list.add(new ItemDto(ItemProtocol.item_palletX3_line, "码垛X3行", "DB3.W100")); - list.add(new ItemDto(ItemProtocol.item_palletY3_row, "码垛Y3列", "DB3.W102")); - list.add(new ItemDto(ItemProtocol.item_palletA3_angle, "码垛A3角度", "DB3.W104")); - list.add(new ItemDto(ItemProtocol.item_pressCribX1_line, "压垛X1行", "DB3.W106")); - list.add(new ItemDto(ItemProtocol.item_pressCribY1_row, "压垛Y1列", "DB3.W108")); - list.add(new ItemDto(ItemProtocol.item_pressCribA1_angle, "压垛A1角度", "DB3.W110")); - list.add(new ItemDto(ItemProtocol.item_pressCribX2_line, "压垛X2行", "DB3.W112")); - list.add(new ItemDto(ItemProtocol.item_pressCribY2_row, "压垛Y2列", "DB3.W114")); - list.add(new ItemDto(ItemProtocol.item_pressCribA2_angle, "压垛A2角度", "DB3.W116")); - list.add(new ItemDto(ItemProtocol.item_pressCribX3_line, "压垛X3行", "DB3.W118")); - list.add(new ItemDto(ItemProtocol.item_pressCribY3_row, "压垛Y3列", "DB3.W120")); - list.add(new ItemDto(ItemProtocol.item_pressCribA3_angle, "压垛A3角度", "DB3.W122")); - list.add(new ItemDto(ItemProtocol.item_Zoffset, "Z轴偏移", "DB3.W124")); - list.add(new ItemDto(ItemProtocol.item_pallet_layerQty, "码垛层数", "DB3.W126")); - list.add(new ItemDto(ItemProtocol.item_pressCrib_layerQty, "压垛层数", "DB3.W128")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX1_interval, "码层X1间隔", "DB3.W130")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY1_interval, "码层Y1间隔", "DB3.W132")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX2_interval, "码层X2间隔", "DB3.W134")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY2_interval, "码层Y2间隔", "DB3.W136")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX3_interval, "码层X3间隔", "DB3.W138")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY3_interval, "码层Y3间隔", "DB3.W140")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX1_offset, "码层X1偏移", "DB3.W142")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY1_offset, "码层Y1偏移", "DB3.W144")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX2_offset, "码层X2偏移", "DB3.W146")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY2_offset, "码层Y2偏移", "DB3.W148")); - list.add(new ItemDto(ItemProtocol.item_codeLayerX3_offset, "码层X3偏移", "DB3.W150")); - list.add(new ItemDto(ItemProtocol.item_codeLayerY3_offset, "码层Y3偏移", "DB3.W152")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX1_interval, "压层X1间隔", "DB3.W154")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY1_interval, "压层Y1间隔", "DB3.W156")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX2_interval, "压层X2间隔", "DB3.W158")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY2_interval, "压层Y2间隔", "DB3.W160")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX3_interval, "压层X3间隔", "DB3.W162")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY3_interval, "压层Y3间隔", "DB3.W164")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX1_offset, "压层X1偏移", "DB3.W166")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY1_offset, "压层Y1偏移", "DB3.W168")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX2_offset, "压层X2偏移", "DB3.W170")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY2_offset, "压层Y2偏移", "DB3.W172")); - list.add(new ItemDto(ItemProtocol.item_pressLayerX3_offset, "压层X3偏移", "DB3.W174")); - list.add(new ItemDto(ItemProtocol.item_pressLayerY3_offset, "压层Y3偏移", "DB3.W176")); - list.add(new ItemDto(ItemProtocol.item_tool_coordinate, "工具坐标", "DB3.W178")); - return list; + return ItemProtocol.getReadableItemDtos(); } @Override diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java index 99df0e4..cbae0df 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpResponse; @@ -8,29 +9,32 @@ import lombok.Getter; import lombok.Setter; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.agv.AgvUtil; import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.RequestMethodEnum; import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.StandardRequestMethod; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.data.Resp; +import org.nl.acs.ext.wms.data.applyTask.ApplyTaskRequest; import org.nl.acs.ext.wms.service.AcsToWmsService; 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.ItemValue; import org.nl.acs.order.service.ProduceshiftorderService; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.task.service.TaskService; -import org.nl.modules.lucene.service.dto.LuceneLogDto; -import org.nl.modules.lucene.service.impl.LuceneExecuteLogServiceImpl; +import org.nl.modules.lucene.service.LuceneExecuteLogService; import org.nl.modules.wql.util.SpringContextHolder; import org.openscada.opc.lib.da.Server; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; +import java.lang.reflect.Method; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -43,10 +47,10 @@ import java.util.Map; @Getter @Setter @RequiredArgsConstructor -public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { +public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, StandardRequestMethod { protected ItemProtocol itemProtocol = new ItemProtocol(this); - + LuceneExecuteLogService lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); @@ -62,8 +66,6 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean("produceshiftorderServiceImpl"); - LuceneExecuteLogServiceImpl lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); - String device_code; int mode = 0; int error = 0; @@ -324,262 +326,262 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + " -> " + mode); } - if (move != last_move) { - logServer.deviceItemValue(this.device_code, "move", String.valueOf(move)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + " -> " + move); - } - if (error != last_error) { - logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + " -> " + error); - } - if (task != last_task) { - logServer.deviceItemValue(this.device_code, "task", String.valueOf(task)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + " -> " + task); - } - if (action != last_action) { - logServer.deviceItemValue(this.device_code, "action", String.valueOf(action)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + last_action + " -> " + action); - } - if (io_action != last_ioaction) { - logServer.deviceItemValue(this.device_code, "io_action", String.valueOf(io_action)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号io_action: " + last_ioaction + " -> " + io_action); - } - if (weight != last_weight) { - logServer.deviceItemValue(this.device_code, "weight", String.valueOf(weight)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号weight: " + last_weight + " -> " + weight); - } - if (!StrUtil.equals(material, last_material)) { - logServer.deviceItemValue(this.device_code, "material", material); - logServer.deviceExecuteLog(this.device_code, "", "", "信号material:" + last_material + " -> " + material); - } - if (barcode != last_barcode) { - logServer.deviceItemValue(this.device_code, "barcode", String.valueOf(barcode)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode:" + last_barcode + " -> " + barcode); - } - if (product_code != last_product_code) { - logServer.deviceItemValue(this.device_code, "product_code", String.valueOf(product_code)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号product_code:" + last_product_code + " -> " + product_code); - } - if (AlongSide != last_AlongSide) { - logServer.deviceItemValue(this.device_code, "AlongSide", String.valueOf(AlongSide)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号AlongSide: " + last_AlongSide + " -> " + AlongSide); - } - if (BshortSide != last_BshortSide) { - logServer.deviceItemValue(this.device_code, "BshortSide", String.valueOf(BshortSide)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号BshortSide: " + last_BshortSide + " -> " + BshortSide); - } - if (Htrapezoidal != last_Htrapezoidal) { - logServer.deviceItemValue(this.device_code, "Htrapezoidal", String.valueOf(Htrapezoidal)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号Htrapezoidal: " + last_Htrapezoidal + " -> " + Htrapezoidal); - } - if (Wthickness != last_Wthickness) { - logServer.deviceItemValue(this.device_code, "Wthickness", String.valueOf(Wthickness)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号Wthickness: " + last_Wthickness + " -> " + Wthickness); - } - if (encoder_qty != last_encoder_qty) { - logServer.deviceItemValue(this.device_code, "encoder_qty", String.valueOf(encoder_qty)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号encoder_qty:" + last_encoder_qty + " -> " + encoder_qty); - } - if (unqualified_qty != last_unqualified_qty) { - logServer.deviceItemValue(this.device_code, "unqualified_qty", String.valueOf(unqualified_qty)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号unqualified_qty:" + last_unqualified_qty + " -> " + unqualified_qty); - } - if (tray_qty != last_tray_qty) { - logServer.deviceItemValue(this.device_code, "tray_qty", String.valueOf(tray_qty)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号tray_qty:" + last_tray_qty + " -> " + tray_qty); - } - if (tray_high != last_tray_high) { - logServer.deviceItemValue(this.device_code, "tray_high", String.valueOf(tray_high)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号tray_high:" + last_tray_high + " -> " + tray_high); - } - if (crib_category != last_crib_category) { - logServer.deviceItemValue(this.device_code, "crib_category", String.valueOf(crib_category)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号crib_category:" + last_crib_category + " -> " + crib_category); - } - if (palletX1_line != last_palletX1_line) { - logServer.deviceItemValue(this.device_code, "palletX1_line", String.valueOf(palletX1_line)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号palletX1_line:" + last_palletX1_line + " -> " + palletX1_line); - } - if (palletY1_row != last_palletY1_row) { - logServer.deviceItemValue(this.device_code, "palletY1_row", String.valueOf(palletY1_row)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号palletY1_row:" + last_palletY1_row + " -> " + palletY1_row); - } - if (palletA1_angle != last_palletA1_angle) { - logServer.deviceItemValue(this.device_code, "palletA1_angle", String.valueOf(palletA1_angle)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号palletA1_angle:" + last_palletA1_angle + " -> " + palletA1_angle); - } - if (palletX2_line != last_palletX2_line) { - logServer.deviceItemValue(this.device_code, "palletX2_line", String.valueOf(palletX2_line)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号palletX2_line:" + last_palletX2_line + " -> " + palletX2_line); - } - if (palletY2_row != last_palletY2_row) { - logServer.deviceItemValue(this.device_code, "palletY2_row", String.valueOf(palletY2_row)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号palletY2_row:" + last_palletY2_row + " -> " + palletY2_row); - } - if (palletA2_angle != last_palletA2_angle) { - logServer.deviceItemValue(this.device_code, "palletA2_angle", String.valueOf(palletA2_angle)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号palletA2_angle:" + last_palletA2_angle + " -> " + palletA2_angle); - } - if (palletX3_line != last_palletX3_line) { - logServer.deviceItemValue(this.device_code, "palletX3_line", String.valueOf(palletX3_line)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号palletX3_line:" + last_palletX3_line + " -> " + palletX3_line); - } - if (palletY3_row != last_palletY3_row) { - logServer.deviceItemValue(this.device_code, "palletY3_row", String.valueOf(palletY3_row)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号palletY3_row:" + last_palletY3_row + " -> " + palletY3_row); - } - if (palletA3_angle != last_palletA3_angle) { - logServer.deviceItemValue(this.device_code, "palletA3_angle", String.valueOf(palletA3_angle)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号palletA3_angle:" + last_palletA3_angle + " -> " + palletA3_angle); - } - if (pressCribX1_line != last_pressCribX1_line) { - logServer.deviceItemValue(this.device_code, "pressCribX1_line", String.valueOf(pressCribX1_line)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribX1_line:" + last_pressCribX1_line + " -> " + pressCribX1_line); - } - if (pressCribY1_row != last_pressCribY1_row) { - logServer.deviceItemValue(this.device_code, "pressCribY1_row", String.valueOf(pressCribY1_row)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribY1_row:" + last_pressCribY1_row + " -> " + pressCribY1_row); - } - if (pressCribA1_angle != last_pressCribA1_angle) { - logServer.deviceItemValue(this.device_code, "pressCribA1_angle", String.valueOf(pressCribA1_angle)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribA1_angle:" + last_pressCribA1_angle + " -> " + pressCribA1_angle); - } - if (pressCribX2_line != last_pressCribX2_line) { - logServer.deviceItemValue(this.device_code, "pressCribX2_line", String.valueOf(pressCribX2_line)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribX2_line:" + last_pressCribX2_line + " -> " + pressCribX2_line); - } - if (pressCribY2_row != last_pressCribY2_row) { - logServer.deviceItemValue(this.device_code, "pressCribY2_row", String.valueOf(pressCribY2_row)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribY2_row:" + last_pressCribY2_row + " -> " + pressCribY2_row); - } - if (pressCribA2_angle != last_pressCribA2_angle) { - logServer.deviceItemValue(this.device_code, "pressCribA2_angle", String.valueOf(pressCribA2_angle)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribA2_angle:" + last_pressCribA2_angle + " -> " + pressCribA2_angle); - } - if (pressCribX3_line != last_pressCribX3_line) { - logServer.deviceItemValue(this.device_code, "pressCribX3_line", String.valueOf(pressCribX3_line)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribX3_line:" + last_pressCribX3_line + " -> " + pressCribX3_line); - } - if (pressCribY3_row != last_pressCribY3_row) { - logServer.deviceItemValue(this.device_code, "pressCribY3_row", String.valueOf(pressCribY3_row)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribY3_row:" + last_pressCribY3_row + " -> " + pressCribY3_row); - } - if (pressCribA3_angle != last_pressCribA3_angle) { - logServer.deviceItemValue(this.device_code, "pressCribA3_angle", String.valueOf(pressCribA3_angle)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribA3_angle:" + last_pressCribA3_angle + " -> " + pressCribA3_angle); - } - if (Zoffset != last_Zoffset) { - logServer.deviceItemValue(this.device_code, "Zoffset", String.valueOf(Zoffset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号Zoffset:" + last_Zoffset + " -> " + Zoffset); - } - if (pallet_layerQty != last_pallet_layerQty) { - logServer.deviceItemValue(this.device_code, "pallet_layerQty", String.valueOf(pallet_layerQty)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pallet_layerQty:" + last_pallet_layerQty + " -> " + pallet_layerQty); - } - if (pressCrib_layerQty != last_pressCrib_layerQty) { - logServer.deviceItemValue(this.device_code, "pressCrib_layerQty", String.valueOf(pressCrib_layerQty)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCrib_layerQty:" + last_pressCrib_layerQty + " -> " + pressCrib_layerQty); - } - if (codeLayerX1_interval != last_codeLayerX1_interval) { - logServer.deviceItemValue(this.device_code, "codeLayerX1_interval", String.valueOf(codeLayerX1_interval)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerX1_interval:" + last_codeLayerX1_interval + " -> " + codeLayerX1_interval); - } - if (codeLayerY1_interval != last_codeLayerY1_interval) { - logServer.deviceItemValue(this.device_code, "codeLayerY1_interval", String.valueOf(codeLayerY1_interval)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerY1_interval:" + last_codeLayerY1_interval + " -> " + codeLayerY1_interval); - } - if (codeLayerX2_interval != last_codeLayerX2_interval) { - logServer.deviceItemValue(this.device_code, "codeLayerX2_interval", String.valueOf(codeLayerX2_interval)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerX2_interval:" + last_codeLayerX2_interval + " -> " + codeLayerX2_interval); - } - if (codeLayerY2_interval != last_codeLayerY2_interval) { - logServer.deviceItemValue(this.device_code, "codeLayerY2_interval", String.valueOf(codeLayerY2_interval)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerY2_interval:" + last_codeLayerY2_interval + " -> " + codeLayerY2_interval); - } - if (codeLayerX3_interval != last_codeLayerX3_interval) { - logServer.deviceItemValue(this.device_code, "codeLayerX3_interval", String.valueOf(codeLayerX3_interval)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerX3_interval:" + last_codeLayerX3_interval + " -> " + codeLayerX3_interval); - } - if (codeLayerY3_interval != last_codeLayerY3_interval) { - logServer.deviceItemValue(this.device_code, "codeLayerY3_interval", String.valueOf(codeLayerY3_interval)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerY3_interval:" + last_codeLayerY3_interval + " -> " + codeLayerY3_interval); - } - if (codeLayerX1_offset != last_codeLayerX1_offset) { - logServer.deviceItemValue(this.device_code, "codeLayerX1_offset", String.valueOf(codeLayerX1_offset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerX1_offset:" + last_codeLayerX1_offset + " -> " + codeLayerX1_offset); - } - if (codeLayerY1_offset != last_codeLayerY1_offset) { - logServer.deviceItemValue(this.device_code, "codeLayerY1_offset", String.valueOf(codeLayerY1_offset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerY1_offset:" + last_codeLayerY1_offset + " -> " + codeLayerY1_offset); - } - if (codeLayerX2_offset != last_codeLayerX2_offset) { - logServer.deviceItemValue(this.device_code, "codeLayerX2_offset", String.valueOf(codeLayerX2_offset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerX2_offset:" + last_codeLayerX2_offset + " -> " + codeLayerX2_offset); - } - if (codeLayerY2_offset != last_codeLayerY2_offset) { - logServer.deviceItemValue(this.device_code, "codeLayerY2_offset", String.valueOf(codeLayerY2_offset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerY2_offset:" + last_codeLayerY2_offset + " -> " + codeLayerY2_offset); - } - if (codeLayerX3_offset != last_codeLayerX3_offset) { - logServer.deviceItemValue(this.device_code, "codeLayerX3_offset", String.valueOf(codeLayerX3_offset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerX3_offset:" + last_codeLayerX3_offset + " -> " + codeLayerX3_offset); - } - if (codeLayerY3_offset != last_codeLayerY3_offset) { - logServer.deviceItemValue(this.device_code, "codeLayerY3_offset", String.valueOf(codeLayerY3_offset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerY3_offset:" + last_codeLayerY3_offset + " -> " + codeLayerY3_offset); - } - if (pressLayerX1_interval != last_pressLayerX1_interval) { - logServer.deviceItemValue(this.device_code, "pressLayerX1_interval", String.valueOf(pressLayerX1_interval)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerX1_interval:" + last_pressLayerX1_interval + " -> " + pressLayerX1_interval); - } - if (pressLayerY1_interval != last_pressLayerY1_interval) { - logServer.deviceItemValue(this.device_code, "pressLayerY1_interval", String.valueOf(pressLayerY1_interval)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY1_interval:" + last_pressLayerY1_interval + " -> " + pressLayerY1_interval); - } - if (pressLayerX2_interval != last_pressLayerX2_interval) { - logServer.deviceItemValue(this.device_code, "pressLayerX2_interval", String.valueOf(pressLayerX2_interval)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerX2_interval:" + last_pressLayerX2_interval + " -> " + pressLayerX2_interval); - } - if (pressLayerY2_interval != last_pressLayerY2_interval) { - logServer.deviceItemValue(this.device_code, "pressLayerY2_interval", String.valueOf(pressLayerY2_interval)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY2_interval:" + last_pressLayerY2_interval + " -> " + pressLayerY2_interval); - } - if (pressLayerX3_interval != last_pressLayerX3_interval) { - logServer.deviceItemValue(this.device_code, "pressLayerX3_interval", String.valueOf(pressLayerX3_interval)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerX3_interval:" + last_pressLayerX3_interval + " -> " + pressLayerX3_interval); - } - if (pressLayerY3_interval != last_pressLayerY3_interval) { - logServer.deviceItemValue(this.device_code, "pressLayerY3_interval", String.valueOf(pressLayerY3_interval)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY3_interval:" + last_pressLayerY3_interval + " -> " + pressLayerY3_interval); - } - if (pressLayerX1_offset != last_pressLayerX1_offset) { - logServer.deviceItemValue(this.device_code, "pressLayerX1_offset", String.valueOf(pressLayerX1_offset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerX1_offset:" + last_pressLayerX1_offset + " -> " + pressLayerX1_offset); - } - if (pressLayerY1_offset != last_pressLayerY1_offset) { - logServer.deviceItemValue(this.device_code, "pressLayerY1_offset", String.valueOf(pressLayerY1_offset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY1_offset:" + last_pressLayerY1_offset + " -> " + pressLayerY1_offset); - } - if (pressLayerX2_offset != last_pressLayerX2_offset) { - logServer.deviceItemValue(this.device_code, "pressLayerX2_offset", String.valueOf(pressLayerX2_offset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerX2_offset:" + last_pressLayerX2_offset + " -> " + pressLayerX2_offset); - } - if (pressLayerY2_offset != last_pressLayerY2_offset) { - logServer.deviceItemValue(this.device_code, "pressLayerY2_offset", String.valueOf(pressLayerY2_offset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY2_offset:" + last_pressLayerY2_offset + " -> " + pressLayerY2_offset); - } - if (pressLayerX3_offset != last_pressLayerX3_offset) { - logServer.deviceItemValue(this.device_code, "pressLayerX3_offset", String.valueOf(pressLayerX3_offset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerX3_offset:" + last_pressLayerX3_offset + " -> " + pressLayerX3_offset); - } - if (pressLayerY3_offset != last_pressLayerY3_offset) { - logServer.deviceItemValue(this.device_code, "pressLayerY3_offset", String.valueOf(pressLayerY3_offset)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY3_offset:" + last_pressLayerY3_offset + " -> " + pressLayerY3_offset); - } - if (tool_coordinate != last_tool_coordinate) { - logServer.deviceItemValue(this.device_code, "tool_coordinate", String.valueOf(tool_coordinate)); - logServer.deviceExecuteLog(this.device_code, "", "", "信号tool_coordinate:" + last_tool_coordinate + " -> " + tool_coordinate); - } +// if (move != last_move) { +// logServer.deviceItemValue(this.device_code, "move", String.valueOf(move)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + " -> " + move); +// } +// if (error != last_error) { +// logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + " -> " + error); +// } +// if (task != last_task) { +// logServer.deviceItemValue(this.device_code, "task", String.valueOf(task)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + " -> " + task); +// } +// if (action != last_action) { +// logServer.deviceItemValue(this.device_code, "action", String.valueOf(action)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + last_action + " -> " + action); +// } +// if (io_action != last_ioaction) { +// logServer.deviceItemValue(this.device_code, "io_action", String.valueOf(io_action)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号io_action: " + last_ioaction + " -> " + io_action); +// } +// if (weight != last_weight) { +// logServer.deviceItemValue(this.device_code, "weight", String.valueOf(weight)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号weight: " + last_weight + " -> " + weight); +// } +// if (!StrUtil.equals(material, last_material)) { +// logServer.deviceItemValue(this.device_code, "material", material); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号material:" + last_material + " -> " + material); +// } +// if (barcode != last_barcode) { +// logServer.deviceItemValue(this.device_code, "barcode", String.valueOf(barcode)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号barcode:" + last_barcode + " -> " + barcode); +// } +// if (product_code != last_product_code) { +// logServer.deviceItemValue(this.device_code, "product_code", String.valueOf(product_code)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号product_code:" + last_product_code + " -> " + product_code); +// } +// if (AlongSide != last_AlongSide) { +// logServer.deviceItemValue(this.device_code, "AlongSide", String.valueOf(AlongSide)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号AlongSide: " + last_AlongSide + " -> " + AlongSide); +// } +// if (BshortSide != last_BshortSide) { +// logServer.deviceItemValue(this.device_code, "BshortSide", String.valueOf(BshortSide)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号BshortSide: " + last_BshortSide + " -> " + BshortSide); +// } +// if (Htrapezoidal != last_Htrapezoidal) { +// logServer.deviceItemValue(this.device_code, "Htrapezoidal", String.valueOf(Htrapezoidal)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号Htrapezoidal: " + last_Htrapezoidal + " -> " + Htrapezoidal); +// } +// if (Wthickness != last_Wthickness) { +// logServer.deviceItemValue(this.device_code, "Wthickness", String.valueOf(Wthickness)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号Wthickness: " + last_Wthickness + " -> " + Wthickness); +// } +// if (encoder_qty != last_encoder_qty) { +// logServer.deviceItemValue(this.device_code, "encoder_qty", String.valueOf(encoder_qty)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号encoder_qty:" + last_encoder_qty + " -> " + encoder_qty); +// } +// if (unqualified_qty != last_unqualified_qty) { +// logServer.deviceItemValue(this.device_code, "unqualified_qty", String.valueOf(unqualified_qty)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号unqualified_qty:" + last_unqualified_qty + " -> " + unqualified_qty); +// } +// if (tray_qty != last_tray_qty) { +// logServer.deviceItemValue(this.device_code, "tray_qty", String.valueOf(tray_qty)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号tray_qty:" + last_tray_qty + " -> " + tray_qty); +// } +// if (tray_high != last_tray_high) { +// logServer.deviceItemValue(this.device_code, "tray_high", String.valueOf(tray_high)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号tray_high:" + last_tray_high + " -> " + tray_high); +// } +// if (crib_category != last_crib_category) { +// logServer.deviceItemValue(this.device_code, "crib_category", String.valueOf(crib_category)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号crib_category:" + last_crib_category + " -> " + crib_category); +// } +// if (palletX1_line != last_palletX1_line) { +// logServer.deviceItemValue(this.device_code, "palletX1_line", String.valueOf(palletX1_line)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号palletX1_line:" + last_palletX1_line + " -> " + palletX1_line); +// } +// if (palletY1_row != last_palletY1_row) { +// logServer.deviceItemValue(this.device_code, "palletY1_row", String.valueOf(palletY1_row)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号palletY1_row:" + last_palletY1_row + " -> " + palletY1_row); +// } +// if (palletA1_angle != last_palletA1_angle) { +// logServer.deviceItemValue(this.device_code, "palletA1_angle", String.valueOf(palletA1_angle)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号palletA1_angle:" + last_palletA1_angle + " -> " + palletA1_angle); +// } +// if (palletX2_line != last_palletX2_line) { +// logServer.deviceItemValue(this.device_code, "palletX2_line", String.valueOf(palletX2_line)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号palletX2_line:" + last_palletX2_line + " -> " + palletX2_line); +// } +// if (palletY2_row != last_palletY2_row) { +// logServer.deviceItemValue(this.device_code, "palletY2_row", String.valueOf(palletY2_row)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号palletY2_row:" + last_palletY2_row + " -> " + palletY2_row); +// } +// if (palletA2_angle != last_palletA2_angle) { +// logServer.deviceItemValue(this.device_code, "palletA2_angle", String.valueOf(palletA2_angle)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号palletA2_angle:" + last_palletA2_angle + " -> " + palletA2_angle); +// } +// if (palletX3_line != last_palletX3_line) { +// logServer.deviceItemValue(this.device_code, "palletX3_line", String.valueOf(palletX3_line)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号palletX3_line:" + last_palletX3_line + " -> " + palletX3_line); +// } +// if (palletY3_row != last_palletY3_row) { +// logServer.deviceItemValue(this.device_code, "palletY3_row", String.valueOf(palletY3_row)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号palletY3_row:" + last_palletY3_row + " -> " + palletY3_row); +// } +// if (palletA3_angle != last_palletA3_angle) { +// logServer.deviceItemValue(this.device_code, "palletA3_angle", String.valueOf(palletA3_angle)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号palletA3_angle:" + last_palletA3_angle + " -> " + palletA3_angle); +// } +// if (pressCribX1_line != last_pressCribX1_line) { +// logServer.deviceItemValue(this.device_code, "pressCribX1_line", String.valueOf(pressCribX1_line)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribX1_line:" + last_pressCribX1_line + " -> " + pressCribX1_line); +// } +// if (pressCribY1_row != last_pressCribY1_row) { +// logServer.deviceItemValue(this.device_code, "pressCribY1_row", String.valueOf(pressCribY1_row)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribY1_row:" + last_pressCribY1_row + " -> " + pressCribY1_row); +// } +// if (pressCribA1_angle != last_pressCribA1_angle) { +// logServer.deviceItemValue(this.device_code, "pressCribA1_angle", String.valueOf(pressCribA1_angle)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribA1_angle:" + last_pressCribA1_angle + " -> " + pressCribA1_angle); +// } +// if (pressCribX2_line != last_pressCribX2_line) { +// logServer.deviceItemValue(this.device_code, "pressCribX2_line", String.valueOf(pressCribX2_line)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribX2_line:" + last_pressCribX2_line + " -> " + pressCribX2_line); +// } +// if (pressCribY2_row != last_pressCribY2_row) { +// logServer.deviceItemValue(this.device_code, "pressCribY2_row", String.valueOf(pressCribY2_row)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribY2_row:" + last_pressCribY2_row + " -> " + pressCribY2_row); +// } +// if (pressCribA2_angle != last_pressCribA2_angle) { +// logServer.deviceItemValue(this.device_code, "pressCribA2_angle", String.valueOf(pressCribA2_angle)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribA2_angle:" + last_pressCribA2_angle + " -> " + pressCribA2_angle); +// } +// if (pressCribX3_line != last_pressCribX3_line) { +// logServer.deviceItemValue(this.device_code, "pressCribX3_line", String.valueOf(pressCribX3_line)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribX3_line:" + last_pressCribX3_line + " -> " + pressCribX3_line); +// } +// if (pressCribY3_row != last_pressCribY3_row) { +// logServer.deviceItemValue(this.device_code, "pressCribY3_row", String.valueOf(pressCribY3_row)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribY3_row:" + last_pressCribY3_row + " -> " + pressCribY3_row); +// } +// if (pressCribA3_angle != last_pressCribA3_angle) { +// logServer.deviceItemValue(this.device_code, "pressCribA3_angle", String.valueOf(pressCribA3_angle)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCribA3_angle:" + last_pressCribA3_angle + " -> " + pressCribA3_angle); +// } +// if (Zoffset != last_Zoffset) { +// logServer.deviceItemValue(this.device_code, "Zoffset", String.valueOf(Zoffset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号Zoffset:" + last_Zoffset + " -> " + Zoffset); +// } +// if (pallet_layerQty != last_pallet_layerQty) { +// logServer.deviceItemValue(this.device_code, "pallet_layerQty", String.valueOf(pallet_layerQty)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pallet_layerQty:" + last_pallet_layerQty + " -> " + pallet_layerQty); +// } +// if (pressCrib_layerQty != last_pressCrib_layerQty) { +// logServer.deviceItemValue(this.device_code, "pressCrib_layerQty", String.valueOf(pressCrib_layerQty)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressCrib_layerQty:" + last_pressCrib_layerQty + " -> " + pressCrib_layerQty); +// } +// if (codeLayerX1_interval != last_codeLayerX1_interval) { +// logServer.deviceItemValue(this.device_code, "codeLayerX1_interval", String.valueOf(codeLayerX1_interval)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerX1_interval:" + last_codeLayerX1_interval + " -> " + codeLayerX1_interval); +// } +// if (codeLayerY1_interval != last_codeLayerY1_interval) { +// logServer.deviceItemValue(this.device_code, "codeLayerY1_interval", String.valueOf(codeLayerY1_interval)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerY1_interval:" + last_codeLayerY1_interval + " -> " + codeLayerY1_interval); +// } +// if (codeLayerX2_interval != last_codeLayerX2_interval) { +// logServer.deviceItemValue(this.device_code, "codeLayerX2_interval", String.valueOf(codeLayerX2_interval)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerX2_interval:" + last_codeLayerX2_interval + " -> " + codeLayerX2_interval); +// } +// if (codeLayerY2_interval != last_codeLayerY2_interval) { +// logServer.deviceItemValue(this.device_code, "codeLayerY2_interval", String.valueOf(codeLayerY2_interval)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerY2_interval:" + last_codeLayerY2_interval + " -> " + codeLayerY2_interval); +// } +// if (codeLayerX3_interval != last_codeLayerX3_interval) { +// logServer.deviceItemValue(this.device_code, "codeLayerX3_interval", String.valueOf(codeLayerX3_interval)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerX3_interval:" + last_codeLayerX3_interval + " -> " + codeLayerX3_interval); +// } +// if (codeLayerY3_interval != last_codeLayerY3_interval) { +// logServer.deviceItemValue(this.device_code, "codeLayerY3_interval", String.valueOf(codeLayerY3_interval)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerY3_interval:" + last_codeLayerY3_interval + " -> " + codeLayerY3_interval); +// } +// if (codeLayerX1_offset != last_codeLayerX1_offset) { +// logServer.deviceItemValue(this.device_code, "codeLayerX1_offset", String.valueOf(codeLayerX1_offset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerX1_offset:" + last_codeLayerX1_offset + " -> " + codeLayerX1_offset); +// } +// if (codeLayerY1_offset != last_codeLayerY1_offset) { +// logServer.deviceItemValue(this.device_code, "codeLayerY1_offset", String.valueOf(codeLayerY1_offset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerY1_offset:" + last_codeLayerY1_offset + " -> " + codeLayerY1_offset); +// } +// if (codeLayerX2_offset != last_codeLayerX2_offset) { +// logServer.deviceItemValue(this.device_code, "codeLayerX2_offset", String.valueOf(codeLayerX2_offset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerX2_offset:" + last_codeLayerX2_offset + " -> " + codeLayerX2_offset); +// } +// if (codeLayerY2_offset != last_codeLayerY2_offset) { +// logServer.deviceItemValue(this.device_code, "codeLayerY2_offset", String.valueOf(codeLayerY2_offset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerY2_offset:" + last_codeLayerY2_offset + " -> " + codeLayerY2_offset); +// } +// if (codeLayerX3_offset != last_codeLayerX3_offset) { +// logServer.deviceItemValue(this.device_code, "codeLayerX3_offset", String.valueOf(codeLayerX3_offset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerX3_offset:" + last_codeLayerX3_offset + " -> " + codeLayerX3_offset); +// } +// if (codeLayerY3_offset != last_codeLayerY3_offset) { +// logServer.deviceItemValue(this.device_code, "codeLayerY3_offset", String.valueOf(codeLayerY3_offset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号codeLayerY3_offset:" + last_codeLayerY3_offset + " -> " + codeLayerY3_offset); +// } +// if (pressLayerX1_interval != last_pressLayerX1_interval) { +// logServer.deviceItemValue(this.device_code, "pressLayerX1_interval", String.valueOf(pressLayerX1_interval)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerX1_interval:" + last_pressLayerX1_interval + " -> " + pressLayerX1_interval); +// } +// if (pressLayerY1_interval != last_pressLayerY1_interval) { +// logServer.deviceItemValue(this.device_code, "pressLayerY1_interval", String.valueOf(pressLayerY1_interval)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY1_interval:" + last_pressLayerY1_interval + " -> " + pressLayerY1_interval); +// } +// if (pressLayerX2_interval != last_pressLayerX2_interval) { +// logServer.deviceItemValue(this.device_code, "pressLayerX2_interval", String.valueOf(pressLayerX2_interval)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerX2_interval:" + last_pressLayerX2_interval + " -> " + pressLayerX2_interval); +// } +// if (pressLayerY2_interval != last_pressLayerY2_interval) { +// logServer.deviceItemValue(this.device_code, "pressLayerY2_interval", String.valueOf(pressLayerY2_interval)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY2_interval:" + last_pressLayerY2_interval + " -> " + pressLayerY2_interval); +// } +// if (pressLayerX3_interval != last_pressLayerX3_interval) { +// logServer.deviceItemValue(this.device_code, "pressLayerX3_interval", String.valueOf(pressLayerX3_interval)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerX3_interval:" + last_pressLayerX3_interval + " -> " + pressLayerX3_interval); +// } +// if (pressLayerY3_interval != last_pressLayerY3_interval) { +// logServer.deviceItemValue(this.device_code, "pressLayerY3_interval", String.valueOf(pressLayerY3_interval)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY3_interval:" + last_pressLayerY3_interval + " -> " + pressLayerY3_interval); +// } +// if (pressLayerX1_offset != last_pressLayerX1_offset) { +// logServer.deviceItemValue(this.device_code, "pressLayerX1_offset", String.valueOf(pressLayerX1_offset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerX1_offset:" + last_pressLayerX1_offset + " -> " + pressLayerX1_offset); +// } +// if (pressLayerY1_offset != last_pressLayerY1_offset) { +// logServer.deviceItemValue(this.device_code, "pressLayerY1_offset", String.valueOf(pressLayerY1_offset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY1_offset:" + last_pressLayerY1_offset + " -> " + pressLayerY1_offset); +// } +// if (pressLayerX2_offset != last_pressLayerX2_offset) { +// logServer.deviceItemValue(this.device_code, "pressLayerX2_offset", String.valueOf(pressLayerX2_offset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerX2_offset:" + last_pressLayerX2_offset + " -> " + pressLayerX2_offset); +// } +// if (pressLayerY2_offset != last_pressLayerY2_offset) { +// logServer.deviceItemValue(this.device_code, "pressLayerY2_offset", String.valueOf(pressLayerY2_offset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY2_offset:" + last_pressLayerY2_offset + " -> " + pressLayerY2_offset); +// } +// if (pressLayerX3_offset != last_pressLayerX3_offset) { +// logServer.deviceItemValue(this.device_code, "pressLayerX3_offset", String.valueOf(pressLayerX3_offset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerX3_offset:" + last_pressLayerX3_offset + " -> " + pressLayerX3_offset); +// } +// if (pressLayerY3_offset != last_pressLayerY3_offset) { +// logServer.deviceItemValue(this.device_code, "pressLayerY3_offset", String.valueOf(pressLayerY3_offset)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号pressLayerY3_offset:" + last_pressLayerY3_offset + " -> " + pressLayerY3_offset); +// } +// if (tool_coordinate != last_tool_coordinate) { +// logServer.deviceItemValue(this.device_code, "tool_coordinate", String.valueOf(tool_coordinate)); +// logServer.deviceExecuteLog(this.device_code, "", "", "信号tool_coordinate:" + last_tool_coordinate + " -> " + tool_coordinate); +// } } catch (Exception var17) { return; @@ -589,400 +591,487 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic if (this.isStop()) { //未在线无心跳 - } else if (!this.itemProtocol.getIsonline()) { - 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); - message = ""; - Instruction instruction = null; - List toInstructions; - switch (mode) { - case 1: - log.debug("设备运转模式:等待工作"); - break; - case 2: - break; - case 4: - // 叫料 - if (!requireSucess && this.move == 0) { - callMaterial(); - } - break; - case 5: - // 申请空盘 - if (!requireSucess && this.move == 0) { - applyEmpty(); - } - break; - case 6: - // 送空托盘 - if (!requireSucess && this.move != 0) { - sendEmpty(); - } - break; - case 7: - //码垛完成 - if (!requireSucess) { - palletizing(); - } - break; - case 8: - //码垛强制完成 - if (!requireSucess) { - mandatoryPalletizing(); - } - break; - case 9: - //获取托盘信息 - if (!requireSucess && this.move != 0) { - getVehicle(); - } - break; - case 11: - // 强制去包装(打包) - if (!requireSucess && this.move != 0) { - this.toPackage(true); - } - break; - case 14: - // 强制去包装(不打包) - if (!requireSucess && this.move != 0) { - this.toPackage(false); + 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); + message = ""; + Instruction instruction = null; + List toInstructions; + + + if (mode > 2) { + if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get(String.valueOf(mode)))) { + String modethod = this.device.getExtraValue().get(String.valueOf(mode)).toString(); + try { + applyRequest(modethod); + } catch (Exception e) { + message = "错误:" + e.getMessage(); + this.setIserror(true); + } + } else { + message = "无效模式请求,驱动未配置此请求方法"; } - } + } else { + message = "无请求"; + } -// switch (flag) { -// //取货完成 -// case 2: -// writing(2); -// return; -// //放货完成 -// case 4: -// writing(3); -// return; -// } + Object ignore_pickup_check = this.getExtraValue().get("ignore_pickup_check"); + + } + + last_mode = mode; + last_error = error; + last_move = move; + last_task = task; + last_action = action; + last_ioaction = io_action; + last_weight = weight; + last_material = material; + last_barcode = barcode; + last_encoder_qty = encoder_qty; + last_unqualified_qty = unqualified_qty; + + last_product_code = product_code; + last_AlongSide = AlongSide; + last_BshortSide = BshortSide; + last_Htrapezoidal = Htrapezoidal; + last_Wthickness = Wthickness; + last_tray_qty = tray_qty; + last_tray_high = tray_high; + last_crib_category = crib_category; + last_palletX1_line = palletX1_line; + last_palletY1_row = palletY1_row; + last_palletA1_angle = palletA1_angle; + last_palletX2_line = palletX2_line; + last_palletY2_row = palletY2_row; + last_palletA2_angle = palletA2_angle; + last_palletX3_line = palletX3_line; + last_palletY3_row = palletY3_row; + last_palletA3_angle = palletA3_angle; + last_pressCribX1_line = pressCribX1_line; + last_pressCribY1_row = pressCribY1_row; + last_pressCribA1_angle = pressCribA1_angle; + last_pressCribX2_line = pressCribX2_line; + last_pressCribY2_row = pressCribY2_row; + last_pressCribA2_angle = pressCribA2_angle; + last_pressCribX3_line = pressCribX3_line; + last_pressCribY3_row = pressCribY3_row; + last_pressCribA3_angle = pressCribA3_angle; + last_Zoffset = Zoffset; + last_pallet_layerQty = pallet_layerQty; + last_pressCrib_layerQty = pressCrib_layerQty; + last_codeLayerX1_interval = codeLayerX1_interval; + last_codeLayerY1_interval = codeLayerY1_interval; + last_codeLayerX2_interval = codeLayerX2_interval; + last_codeLayerY2_interval = codeLayerY2_interval; + last_codeLayerX3_interval = codeLayerX3_interval; + last_codeLayerY3_interval = codeLayerY3_interval; + last_codeLayerX1_offset = codeLayerX1_offset; + last_codeLayerY1_offset = codeLayerY1_offset; + last_codeLayerX2_offset = codeLayerX2_offset; + last_codeLayerY2_offset = codeLayerY2_offset; + last_codeLayerX3_offset = codeLayerX3_offset; + last_codeLayerY3_offset = codeLayerY3_offset; + last_pressLayerX1_interval = pressLayerX1_interval; + last_pressLayerY1_interval = pressLayerY1_interval; + last_pressLayerX2_interval = pressLayerX2_interval; + last_pressLayerY2_interval = pressLayerY2_interval; + last_pressLayerX3_interval = pressLayerX3_interval; + last_pressLayerY3_interval = pressLayerY3_interval; + last_pressLayerX1_offset = pressLayerX1_offset; + last_pressLayerY1_offset = pressLayerY1_offset; + last_pressLayerX2_offset = pressLayerX2_offset; + last_pressLayerY2_offset = pressLayerY2_offset; + last_pressLayerX3_offset = pressLayerX3_offset; + last_pressLayerY3_offset = pressLayerY3_offset; + last_tool_coordinate = tool_coordinate; } - - last_mode = mode; - last_error = error; - last_move = move; - last_task = task; - last_action = action; - last_ioaction = io_action; - last_weight = weight; - last_material = material; - last_barcode = barcode; - last_encoder_qty = encoder_qty; - last_unqualified_qty = unqualified_qty; - - last_product_code = product_code; - last_AlongSide = AlongSide; - last_BshortSide = BshortSide; - last_Htrapezoidal = Htrapezoidal; - last_Wthickness = Wthickness; - last_tray_qty = tray_qty; - last_tray_high = tray_high; - last_crib_category = crib_category; - last_palletX1_line = palletX1_line; - last_palletY1_row = palletY1_row; - last_palletA1_angle = palletA1_angle; - last_palletX2_line = palletX2_line; - last_palletY2_row = palletY2_row; - last_palletA2_angle = palletA2_angle; - last_palletX3_line = palletX3_line; - last_palletY3_row = palletY3_row; - last_palletA3_angle = palletA3_angle; - last_pressCribX1_line = pressCribX1_line; - last_pressCribY1_row = pressCribY1_row; - last_pressCribA1_angle = pressCribA1_angle; - last_pressCribX2_line = pressCribX2_line; - last_pressCribY2_row = pressCribY2_row; - last_pressCribA2_angle = pressCribA2_angle; - last_pressCribX3_line = pressCribX3_line; - last_pressCribY3_row = pressCribY3_row; - last_pressCribA3_angle = pressCribA3_angle; - last_Zoffset = Zoffset; - last_pallet_layerQty = pallet_layerQty; - last_pressCrib_layerQty = pressCrib_layerQty; - last_codeLayerX1_interval = codeLayerX1_interval; - last_codeLayerY1_interval = codeLayerY1_interval; - last_codeLayerX2_interval = codeLayerX2_interval; - last_codeLayerY2_interval = codeLayerY2_interval; - last_codeLayerX3_interval = codeLayerX3_interval; - last_codeLayerY3_interval = codeLayerY3_interval; - last_codeLayerX1_offset = codeLayerX1_offset; - last_codeLayerY1_offset = codeLayerY1_offset; - last_codeLayerX2_offset = codeLayerX2_offset; - last_codeLayerY2_offset = codeLayerY2_offset; - last_codeLayerX3_offset = codeLayerX3_offset; - last_codeLayerY3_offset = codeLayerY3_offset; - last_pressLayerX1_interval = pressLayerX1_interval; - last_pressLayerY1_interval = pressLayerY1_interval; - last_pressLayerX2_interval = pressLayerX2_interval; - last_pressLayerY2_interval = pressLayerY2_interval; - last_pressLayerX3_interval = pressLayerX3_interval; - last_pressLayerY3_interval = pressLayerY3_interval; - last_pressLayerX1_offset = pressLayerX1_offset; - last_pressLayerY1_offset = pressLayerY1_offset; - last_pressLayerX2_offset = pressLayerX2_offset; - last_pressLayerY2_offset = pressLayerY2_offset; - last_pressLayerX3_offset = pressLayerX3_offset; - last_pressLayerY3_offset = pressLayerY3_offset; - last_tool_coordinate = tool_coordinate; } - /** - * 申请空盘 + * 请求 * * @param */ - public synchronized boolean applyEmpty() { + public synchronized boolean applyRequest(String modethod) throws Exception { + Object obj1 = this; 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; - JSONObject json = new JSONObject(); - json.put("device_code", this.device_code); - json.put("type", "4"); - json.put("vehicle_code", barcode); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == HttpStatus.OK.value()) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - } + Object obj = this.getClass().getDeclaredConstructor().newInstance(); + Method method1 = this.getClass().getMethod(modethod, null); + method1.invoke(this, null); return true; } } /** * 码垛完成 - * + * 申请取走满料盅托盘 * @param */ - public synchronized boolean palletizing() { - 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; - JSONObject json = new JSONObject(); - json.put("type", "1"); - json.put("device_code", device_code); - json.put("qty", encoder_qty); - json.put("weight", weight); - json.put("vehicle_code", barcode); - json.put("is_full", "1"); - json.put("is_package", "1"); - json.put("product_code", product_code); - json.put("AlongSide", AlongSide); - json.put("BshortSide", BshortSide); - json.put("Htrapezoidal", Htrapezoidal); - json.put("Wthickness", Wthickness); - json.put("tray_qty", tray_qty); - json.put("tray_high", tray_high); - json.put("crib_category", crib_category); - json.put("palletX1_line", palletX1_line); - json.put("palletY1_row", palletY1_row); - json.put("palletA1_angle", palletA1_angle); - json.put("palletX2_line", palletX2_line); - json.put("palletY2_row", palletY2_row); - json.put("palletA2_angle", palletA2_angle); - json.put("palletX3_line", palletX3_line); - json.put("palletY3_row", palletY3_row); - json.put("palletA3_angle", palletA3_angle); - json.put("pressCribX1_line", pressCribX1_line); - json.put("pressCribY1_row", pressCribY1_row); - json.put("pressCribA1_angle", pressCribA1_angle); - json.put("pressCribX2_line", pressCribX2_line); - json.put("pressCribY2_row", pressCribY2_row); - json.put("pressCribA2_angle", pressCribA2_angle); - json.put("pressCribX3_line", pressCribX3_line); - json.put("pressCribY3_row", pressCribY3_row); - json.put("pressCribA3_angle", pressCribA3_angle); - json.put("Zoffset", Zoffset); - json.put("pallet_layerQty", pallet_layerQty); - json.put("pressCrib_layerQty", pressCrib_layerQty); - json.put("codeLayerX1_interval", codeLayerX1_interval); - json.put("codeLayerY1_interval", codeLayerY1_interval); - json.put("codeLayerX2_interval", codeLayerX2_interval); - json.put("codeLayerY2_interval", codeLayerY2_interval); - json.put("codeLayerX3_interval", codeLayerX3_interval); - json.put("codeLayerY3_interval", codeLayerY3_interval); - json.put("codeLayerX1_offset", codeLayerX1_offset); - json.put("codeLayerY1_offset", codeLayerY1_offset); - json.put("codeLayerX2_offset", codeLayerX2_offset); - json.put("codeLayerY2_offset", codeLayerY2_offset); - json.put("codeLayerX3_offset", codeLayerX3_offset); - json.put("codeLayerY3_offset", codeLayerY3_offset); - json.put("pressLayerX1_interval", pressLayerX1_interval); - json.put("pressLayerY1_interval", pressLayerY1_interval); - json.put("pressLayerX2_interval", pressLayerX2_interval); - json.put("pressLayerY2_interval", pressLayerY2_interval); - json.put("pressLayerX3_interval", pressLayerX3_interval); - json.put("pressLayerY3_interval", pressLayerY3_interval); - json.put("pressLayerX1_offset", pressLayerX1_offset); - json.put("pressLayerY1_offset", pressLayerY1_offset); - json.put("pressLayerX2_offset", pressLayerX2_offset); - json.put("pressLayerY2_offset", pressLayerY2_offset); - json.put("pressLayerX3_offset", pressLayerX3_offset); - json.put("pressLayerY3_offset", pressLayerY3_offset); - json.put("tool_coordinate", tool_coordinate); - HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == HttpStatus.OK.value()) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { - this.writing(this.mode); - this.setRequireSucess(true); - } + public synchronized boolean apply_take_full_vehicle() { + JSONObject json = new JSONObject(); + json.put("type", "1"); + json.put("device_code", device_code); + json.put("qty", encoder_qty); + json.put("weight", weight); + json.put("vehicle_code", barcode); + json.put("is_full", "1"); + json.put("is_package", "1"); + json.put("product_code", product_code); + json.put("AlongSide", AlongSide); + json.put("BshortSide", BshortSide); + json.put("Htrapezoidal", Htrapezoidal); + json.put("Wthickness", Wthickness); + json.put("tray_qty", tray_qty); + json.put("tray_high", tray_high); + json.put("crib_category", crib_category); + json.put("palletX1_line", palletX1_line); + json.put("palletY1_row", palletY1_row); + json.put("palletA1_angle", palletA1_angle); + json.put("palletX2_line", palletX2_line); + json.put("palletY2_row", palletY2_row); + json.put("palletA2_angle", palletA2_angle); + json.put("palletX3_line", palletX3_line); + json.put("palletY3_row", palletY3_row); + json.put("palletA3_angle", palletA3_angle); + json.put("pressCribX1_line", pressCribX1_line); + json.put("pressCribY1_row", pressCribY1_row); + json.put("pressCribA1_angle", pressCribA1_angle); + json.put("pressCribX2_line", pressCribX2_line); + json.put("pressCribY2_row", pressCribY2_row); + json.put("pressCribA2_angle", pressCribA2_angle); + json.put("pressCribX3_line", pressCribX3_line); + json.put("pressCribY3_row", pressCribY3_row); + json.put("pressCribA3_angle", pressCribA3_angle); + json.put("Zoffset", Zoffset); + json.put("pallet_layerQty", pallet_layerQty); + json.put("pressCrib_layerQty", pressCrib_layerQty); + json.put("codeLayerX1_interval", codeLayerX1_interval); + json.put("codeLayerY1_interval", codeLayerY1_interval); + json.put("codeLayerX2_interval", codeLayerX2_interval); + json.put("codeLayerY2_interval", codeLayerY2_interval); + json.put("codeLayerX3_interval", codeLayerX3_interval); + json.put("codeLayerY3_interval", codeLayerY3_interval); + json.put("codeLayerX1_offset", codeLayerX1_offset); + json.put("codeLayerY1_offset", codeLayerY1_offset); + json.put("codeLayerX2_offset", codeLayerX2_offset); + json.put("codeLayerY2_offset", codeLayerY2_offset); + json.put("codeLayerX3_offset", codeLayerX3_offset); + json.put("codeLayerY3_offset", codeLayerY3_offset); + json.put("pressLayerX1_interval", pressLayerX1_interval); + json.put("pressLayerY1_interval", pressLayerY1_interval); + json.put("pressLayerX2_interval", pressLayerX2_interval); + json.put("pressLayerY2_interval", pressLayerY2_interval); + json.put("pressLayerX3_interval", pressLayerX3_interval); + json.put("pressLayerY3_interval", pressLayerY3_interval); + json.put("pressLayerX1_offset", pressLayerX1_offset); + json.put("pressLayerY1_offset", pressLayerY1_offset); + json.put("pressLayerX2_offset", pressLayerX2_offset); + json.put("pressLayerY2_offset", pressLayerY2_offset); + json.put("pressLayerX3_offset", pressLayerX3_offset); + json.put("pressLayerY3_offset", pressLayerY3_offset); + json.put("tool_coordinate", tool_coordinate); + HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); } } - return true; } + return true; } /** * 码垛强制完成 + * 申请强制取走满料盅托盘 + * @param + */ + public synchronized boolean apply_force_take_full_vehicle() { + JSONObject json = new JSONObject(); + json.put("type", "1"); + json.put("device_code", device_code); + json.put("qty", encoder_qty); + json.put("weight", weight); + json.put("vehicle_code", barcode); + json.put("is_full", "0"); + json.put("is_package", "1"); + json.put("product_code", product_code); + json.put("AlongSide", AlongSide); + json.put("BshortSide", BshortSide); + json.put("Htrapezoidal", Htrapezoidal); + json.put("Wthickness", Wthickness); + json.put("tray_qty", tray_qty); + json.put("tray_high", tray_high); + json.put("crib_category", crib_category); + json.put("palletX1_line", palletX1_line); + json.put("palletY1_row", palletY1_row); + json.put("palletA1_angle", palletA1_angle); + json.put("palletX2_line", palletX2_line); + json.put("palletY2_row", palletY2_row); + json.put("palletA2_angle", palletA2_angle); + json.put("palletX3_line", palletX3_line); + json.put("palletY3_row", palletY3_row); + json.put("palletA3_angle", palletA3_angle); + json.put("pressCribX1_line", pressCribX1_line); + json.put("pressCribY1_row", pressCribY1_row); + json.put("pressCribA1_angle", pressCribA1_angle); + json.put("pressCribX2_line", pressCribX2_line); + json.put("pressCribY2_row", pressCribY2_row); + json.put("pressCribA2_angle", pressCribA2_angle); + json.put("pressCribX3_line", pressCribX3_line); + json.put("pressCribY3_row", pressCribY3_row); + json.put("pressCribA3_angle", pressCribA3_angle); + json.put("Zoffset", Zoffset); + json.put("pallet_layerQty", pallet_layerQty); + json.put("pressCrib_layerQty", pressCrib_layerQty); + json.put("codeLayerX1_interval", codeLayerX1_interval); + json.put("codeLayerY1_interval", codeLayerY1_interval); + json.put("codeLayerX2_interval", codeLayerX2_interval); + json.put("codeLayerY2_interval", codeLayerY2_interval); + json.put("codeLayerX3_interval", codeLayerX3_interval); + json.put("codeLayerY3_interval", codeLayerY3_interval); + json.put("codeLayerX1_offset", codeLayerX1_offset); + json.put("codeLayerY1_offset", codeLayerY1_offset); + json.put("codeLayerX2_offset", codeLayerX2_offset); + json.put("codeLayerY2_offset", codeLayerY2_offset); + json.put("codeLayerX3_offset", codeLayerX3_offset); + json.put("codeLayerY3_offset", codeLayerY3_offset); + json.put("pressLayerX1_interval", pressLayerX1_interval); + json.put("pressLayerY1_interval", pressLayerY1_interval); + json.put("pressLayerX2_interval", pressLayerX2_interval); + json.put("pressLayerY2_interval", pressLayerY2_interval); + json.put("pressLayerX3_interval", pressLayerX3_interval); + json.put("pressLayerY3_interval", pressLayerY3_interval); + json.put("pressLayerX1_offset", pressLayerX1_offset); + json.put("pressLayerY1_offset", pressLayerY1_offset); + json.put("pressLayerX2_offset", pressLayerX2_offset); + json.put("pressLayerY2_offset", pressLayerY2_offset); + json.put("pressLayerX3_offset", pressLayerX3_offset); + json.put("pressLayerY3_offset", pressLayerY3_offset); + json.put("tool_coordinate", tool_coordinate); + HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } + } + } + return true; + } + + + /** + * 申请补满料盅托盘 * * @param */ - public synchronized boolean mandatoryPalletizing() { - 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; - JSONObject json = new JSONObject(); - json.put("type", "1"); - json.put("device_code", device_code); - json.put("qty", encoder_qty); - json.put("weight", weight); - json.put("vehicle_code", barcode); - json.put("is_full", "0"); - json.put("is_package", "1"); - json.put("product_code", product_code); - json.put("AlongSide", AlongSide); - json.put("BshortSide", BshortSide); - json.put("Htrapezoidal", Htrapezoidal); - json.put("Wthickness", Wthickness); - json.put("tray_qty", tray_qty); - json.put("tray_high", tray_high); - json.put("crib_category", crib_category); - json.put("palletX1_line", palletX1_line); - json.put("palletY1_row", palletY1_row); - json.put("palletA1_angle", palletA1_angle); - json.put("palletX2_line", palletX2_line); - json.put("palletY2_row", palletY2_row); - json.put("palletA2_angle", palletA2_angle); - json.put("palletX3_line", palletX3_line); - json.put("palletY3_row", palletY3_row); - json.put("palletA3_angle", palletA3_angle); - json.put("pressCribX1_line", pressCribX1_line); - json.put("pressCribY1_row", pressCribY1_row); - json.put("pressCribA1_angle", pressCribA1_angle); - json.put("pressCribX2_line", pressCribX2_line); - json.put("pressCribY2_row", pressCribY2_row); - json.put("pressCribA2_angle", pressCribA2_angle); - json.put("pressCribX3_line", pressCribX3_line); - json.put("pressCribY3_row", pressCribY3_row); - json.put("pressCribA3_angle", pressCribA3_angle); - json.put("Zoffset", Zoffset); - json.put("pallet_layerQty", pallet_layerQty); - json.put("pressCrib_layerQty", pressCrib_layerQty); - json.put("codeLayerX1_interval", codeLayerX1_interval); - json.put("codeLayerY1_interval", codeLayerY1_interval); - json.put("codeLayerX2_interval", codeLayerX2_interval); - json.put("codeLayerY2_interval", codeLayerY2_interval); - json.put("codeLayerX3_interval", codeLayerX3_interval); - json.put("codeLayerY3_interval", codeLayerY3_interval); - json.put("codeLayerX1_offset", codeLayerX1_offset); - json.put("codeLayerY1_offset", codeLayerY1_offset); - json.put("codeLayerX2_offset", codeLayerX2_offset); - json.put("codeLayerY2_offset", codeLayerY2_offset); - json.put("codeLayerX3_offset", codeLayerX3_offset); - json.put("codeLayerY3_offset", codeLayerY3_offset); - json.put("pressLayerX1_interval", pressLayerX1_interval); - json.put("pressLayerY1_interval", pressLayerY1_interval); - json.put("pressLayerX2_interval", pressLayerX2_interval); - json.put("pressLayerY2_interval", pressLayerY2_interval); - json.put("pressLayerX3_interval", pressLayerX3_interval); - json.put("pressLayerY3_interval", pressLayerY3_interval); - json.put("pressLayerX1_offset", pressLayerX1_offset); - json.put("pressLayerY1_offset", pressLayerY1_offset); - json.put("pressLayerX2_offset", pressLayerX2_offset); - json.put("pressLayerY2_offset", pressLayerY2_offset); - json.put("pressLayerX3_offset", pressLayerX3_offset); - json.put("pressLayerY3_offset", pressLayerY3_offset); - json.put("tool_coordinate", tool_coordinate); - HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == HttpStatus.OK.value()) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { - this.writing(this.mode); - this.setRequireSucess(true); - } + public synchronized boolean apply_put_full_vehicle() { + JSONObject json = new JSONObject(); + json.put("device_code", this.device_code); + json.put("type", "2"); + json.put("qty", weight); + json.put("vehicle_code", barcode); + json.put("is_full", "1"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); } } - return true; } + return true; } /** - * 申请入库 + * 申请补空料盅托盘 * * @param */ - public synchronized boolean putStorage() { - 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; + public synchronized boolean apply_put_empty_vehicle() { + ApplyTaskRequest request = new ApplyTaskRequest(); + request.setDevice_code(this.getDevice_code()); + request.setRequest_medthod_code(this.getClass().getName()); + request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName())); + request.setRequestNo(IdUtil.simpleUUID()); + request.setRequestDate(AgvUtil.getDate()); + Resp resp = acsToWmsService.applyTask(request); + if (StrUtil.equals(resp.result, "true")) { + this.writing(this.mode); + this.setRequireSucess(true); } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("device_code", this.device_code); - json.put("type", "1"); - json.put("material_code", material); - json.put("vehicle_code", barcode); - json.put("qty", encoder_qty); - json.put("is_full", "1"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == HttpStatus.OK.value()) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { - this.writing(this.mode); - this.setRequireSucess(true); - } + this.writing(400); + } + return true; + + } + + /** + * 申请取走空料盅托盘 + * + * @param + */ + public synchronized boolean apply_take_empty_vehicle() { + JSONObject json = new JSONObject(); + json.put("device_code", this.device_code); + json.put("type", "2"); + json.put("is_full", "1"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); } } - return true; } + return true; + } + + /** + * 申请强制满托入缓存 + * + * @param + */ + public synchronized boolean apply_force_take_full_vehicle_in_storage() { + JSONObject json = new JSONObject(); + json.put("device_code", this.device_code); + json.put("type", "1"); + json.put("weight", weight); + json.put("vehicle_code", barcode); + json.put("is_full", "1"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } + } + } + return true; + } + + /** + * 扫码成功申请 + * + * @param + */ + public synchronized boolean barcode_sucess_apply() { + JSONObject json = new JSONObject(); + json.put("device_code", this.device_code); + json.put("type", "1"); + json.put("weight", weight); + json.put("vehicle_code", barcode); + json.put("is_full", "1"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } + } + } + + return true; + + } + + /** + * 获取组盘信息 + * + * @param + */ + public synchronized boolean get_vehicle_info() { + JSONObject json = new JSONObject(); + json.put("device_code", this.device_code); + json.put("type", "1"); + json.put("weight", weight); + json.put("vehicle_code", barcode); + json.put("is_full", "1"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } + } + } + + return true; + + } + + /** + * 强制去包装-不包装 + */ + public synchronized boolean force_no_package() { + JSONObject json = new JSONObject(); + json.put("type", "5"); + json.put("device_code", device_code); + + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } + } + } + return true; + } + + + /** + * 申请贴标 + */ + public synchronized boolean apply_labelling() { + JSONObject json = new JSONObject(); + json.put("type", "5"); + json.put("device_code", device_code); + + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } + } + } + return true; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java index 26d0077..3d247d2 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java @@ -118,24 +118,24 @@ public class ItemProtocol { public static List getReadableItemDtos() { ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB4.B0")); - list.add(new ItemDto(item_mode, "工作模式", "DB4.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_move, "光电开关信号", "DB4.B2")); - list.add(new ItemDto(item_action, "取放信号", "DB4.B3")); - list.add(new ItemDto(item_ioaction, "进出信号", "DB4.B4")); - list.add(new ItemDto(item_error, "报警信号", "DB4.B5")); - list.add(new ItemDto(item_task, "任务号", "DB4.D6")); - list.add(new ItemDto(item_weight, "重量", "DB4.D10")); - list.add(new ItemDto(item_material, "物料", "DB4.STRING14.50")); - list.add(new ItemDto(item_barcode, "条码", "DB4.W66")); + list.add(new ItemDto(item_heartbeat, "心跳", "DB8.B0")); + list.add(new ItemDto(item_mode, "工作模式", "DB8.B1", Boolean.valueOf(true))); + list.add(new ItemDto(item_move, "光电开关信号", "DB8.B2")); + list.add(new ItemDto(item_action, "取放信号", "DB8.B3")); + list.add(new ItemDto(item_ioaction, "进出信号", "DB8.B4")); + list.add(new ItemDto(item_error, "报警信号", "DB8.B5")); + list.add(new ItemDto(item_task, "任务号", "DB8.D6")); + list.add(new ItemDto(item_weight, "重量", "DB8.D10")); + list.add(new ItemDto(item_material, "物料", "DB8.STRING14.50")); + list.add(new ItemDto(item_barcode, "条码", "DB8.W66")); return list; } public static List getWriteableItemDtos() { ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "作业命令", "DB5.W0", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_target, "目标站", "DB5.W2")); - list.add(new ItemDto(item_to_task, "任务号", "DB5.D4")); + list.add(new ItemDto(item_to_command, "作业命令", "DB9.W0", Boolean.valueOf(true))); + list.add(new ItemDto(item_to_target, "目标站", "DB9.W2")); + list.add(new ItemDto(item_to_task, "任务号", "DB9.D4")); return list; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDefination.java index 100e782..0fce903 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDefination.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDefination.java @@ -52,22 +52,7 @@ public class LnshStationDefination implements OpcDeviceDriverDefination { @Override public List getReadableItemDtos() { - return getReadableItemDtos2(); - } - - public static List getReadableItemDtos2() { - List list = new ArrayList(); - list.add(new ItemDto(ItemProtocol.item_heartbeat, "心跳", "DB4.B0")); - list.add(new ItemDto(ItemProtocol.item_mode, "工作模式", "DB4.B1", Boolean.valueOf(true))); - list.add(new ItemDto(ItemProtocol.item_move, "光电开关信号", "DB4.B2")); - list.add(new ItemDto(ItemProtocol.item_action, "取放信号", "DB4.B3")); - list.add(new ItemDto(ItemProtocol.item_ioaction, "进出信号", "DB4.B4")); - list.add(new ItemDto(ItemProtocol.item_error, "报警信号", "DB4.B5")); - list.add(new ItemDto(ItemProtocol.item_task, "任务号", "DB4.D6")); - list.add(new ItemDto(ItemProtocol.item_weight, "重量", "DB4.D10")); - list.add(new ItemDto(ItemProtocol.item_material, "物料", "DB4.STRING14.50")); - list.add(new ItemDto(ItemProtocol.item_barcode, "条码", "DB4.W66")); - return list; + return ItemProtocol.getReadableItemDtos(); } @Override diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java index 63b5e3f..3ad19c1 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.lnsh.lnsh_station; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpResponse; @@ -8,12 +9,17 @@ import lombok.Getter; import lombok.Setter; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.agv.AgvUtil; import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.RequestMethodEnum; import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.StandardRequestMethod; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.ext.wms.data.Resp; +import org.nl.acs.ext.wms.data.applyTask.ApplyTaskRequest; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; @@ -22,11 +28,12 @@ import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.Device; import org.nl.acs.route.service.RouteLineService; import org.nl.acs.task.service.TaskService; +import org.nl.modules.lucene.service.LuceneExecuteLogService; import org.nl.modules.wql.util.SpringContextHolder; import org.openscada.opc.lib.da.Server; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; +import java.lang.reflect.Method; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -39,9 +46,11 @@ import java.util.Map; @Getter @Setter @RequiredArgsConstructor -public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { +public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, StandardRequestMethod { protected ItemProtocol itemProtocol = new ItemProtocol(this); + LuceneExecuteLogService lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); + InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); @@ -116,7 +125,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements @Override public void execute() { - String message = null; + message = null; try { device_code = this.getDeviceCode(); @@ -193,101 +202,25 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements message = ""; Instruction instruction = null; List toInstructions; - Object ignore_pickup_check = this.getExtraValue().get("ignore_pickup_check"); - switch (mode) { - case 1: - log.debug("设备运转模式:等待工作"); - break; - case 2: - break; - case 4: - //叫料 - if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) { - if (!requireSucess) { - callMaterial(); - } - } else { - if (!requireSucess && this.move == 0) { - callMaterial(); - } - } - break; - case 5: - //申请空盘 - if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) { - if (!requireSucess) { - applyEmpty(); - } - } else { - if (!requireSucess && this.move == 0) { - applyEmpty(); - } - } - break; - case 6: - //申请入库 - if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) { - if (!requireSucess) { - putStorage(); - } - } else { - if (!requireSucess && this.move != 0) { - putStorage(); - } - } - break; - case 7: - //申请出窑分配 - if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) { - if (!requireSucess) { - applyOuttoKiln(); - } - } else { - if (!requireSucess && this.move != 0) { - applyOuttoKiln(); - } - } - break; - case 8: - //入窑扫码 -// if (!requireSucess && this.move != 0) { -// reverseGroup(); -// } - break; - case 11: - // 半托缓存强制去包装 - if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) { - if (!requireSucess) { - toPackage(); - } - } else { - if (!requireSucess && this.move != 0) { - toPackage(); - } - } - case 15: - // 送空托盘 - if (ObjectUtil.isNotEmpty(ignore_pickup_check) && "true".equals(ignore_pickup_check.toString())) { - if (!requireSucess) { - sendEmpty(); - } - } else { - if (!requireSucess && this.move != 0) { - sendEmpty(); - } + + + if (mode > 2) { + if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get(String.valueOf(mode)))) { + String modethod = this.device.getExtraValue().get(String.valueOf(mode)).toString(); + try { + applyRequest(modethod); + } catch (Exception e) { + message = "错误:" + e.getMessage(); + this.setIserror(true); } + } else { + message = "无效模式请求,驱动未配置此请求方法"; + } + } else { + message = "无请求"; } -// switch (flag) { -// //取货完成 -// case 2: -// writing(2); -// return; -// //放货完成 -// case 4: -// writing(3); -// return; -// } + Object ignore_pickup_check = this.getExtraValue().get("ignore_pickup_check"); } last_mode = mode; @@ -302,133 +235,8 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements } - /** - * 申请空盘 - * - * @param - */ - public synchronized boolean applyEmpty() { - 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; - JSONObject json = new JSONObject(); - json.put("device_code", this.device_code); - json.put("type", "4"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == HttpStatus.OK.value()) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - } - return true; - } - } - - /** - * 叫料 - * - * @param - */ - public synchronized boolean callMaterial() { - 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; - JSONObject json = new JSONObject(); - json.put("device_code", this.device_code); - json.put("type", "2"); - json.put("qty", weight); - json.put("vehicle_code", barcode); - json.put("is_full", "1"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == HttpStatus.OK.value()) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - } - return true; - } - } - - /** - * 申请入库 - * - * @param - */ - public synchronized boolean putStorage() { - 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; - JSONObject json = new JSONObject(); - json.put("device_code", this.device_code); - json.put("type", "1"); - json.put("weight", weight); - json.put("vehicle_code", barcode); - json.put("is_full", "1"); - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == HttpStatus.OK.value()) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - } - - return true; - } - } - /** - * 申请出窑去包装 - * - * @param - */ - public synchronized boolean applyOuttoKiln() { - 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; - JSONObject json = new JSONObject(); - json.put("device_code", this.device_code); - json.put("vehicle_code", barcode); - HttpResponse result = acsToWmsService.applyOuttoKiln(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == HttpStatus.OK.value()) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { - JSONObject jo = JSONObject.parseObject(result.body()); - String is_package = jo.getString("is_package"); - this.writing(2, Integer.parseInt(is_package)); - this.writing(1); - requireSucess = true; - } - } - } - return true; - } - } - public boolean exe_error() { if (this.error == 0) { return true; @@ -527,77 +335,6 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements return ""; } - public synchronized void reverseGroup() { - 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); - } else { - this.instruction_require_time = date; - String task_id = SpringContextHolder.getBean(InstructionService.class).findByCode(String.valueOf(task)).getTask_id(); - String task_uuid = SpringContextHolder.getBean(TaskService.class).findById(task_id).getExt_task_uuid(); - - JSONObject json = new JSONObject(); - json.put("task_id", task_uuid); - json.put("vehicle_code", barcode); - HttpResponse result = acsToWmsService.reverseGroup(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 || StrUtil.equals(jsonObject.getString("status"), "200")) { - this.writing(1); - this.setRequireSucess(true); - } - } - } - } - - /** - * 强制去包装 - */ - public synchronized void toPackage() { - 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); - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("type", "5"); - json.put("device_code", device_code); - - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == HttpStatus.OK.value()) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - } - } - } - - public synchronized void sendEmpty() { - 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); - } else { - this.instruction_require_time = date; - JSONObject json = new JSONObject(); - json.put("type", "3"); - json.put("device_code", device_code); - - HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == HttpStatus.OK.value()) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { - this.writing(this.mode); - this.setRequireSucess(true); - } - } - } - } - } @Override public JSONObject getDeviceStatusName() throws Exception { @@ -711,4 +448,286 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements public void setDeviceStatus(JSONObject data) { } + + + /** + * 请求 + * + * @param + */ + public synchronized boolean applyRequest(String modethod) throws Exception { + Object obj1 = this; + 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; + Object obj = this.getClass().getDeclaredConstructor().newInstance(); + Method method1 = this.getClass().getMethod(modethod, null); + method1.invoke(this, null); + return true; + } + } + + /** + * 申请补满料盅托盘 + * + * @param + */ + public synchronized boolean apply_put_full_vehicle() { + JSONObject json = new JSONObject(); + json.put("device_code", this.device_code); + json.put("type", "2"); + json.put("qty", weight); + json.put("vehicle_code", barcode); + json.put("is_full", "1"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } + } + } + return true; + } + + /** + * 申请补空料盅托盘 + * + * @param + */ + public synchronized boolean apply_put_empty_vehicle() { + ApplyTaskRequest request = new ApplyTaskRequest(); + request.setDevice_code(this.getDevice_code()); + request.setRequest_medthod_code(this.getClass().getName()); + request.setRequest_medthod_name(RequestMethodEnum.getName(this.getClass().getName())); + request.setRequestNo(IdUtil.simpleUUID()); + request.setRequestDate(AgvUtil.getDate()); + Resp resp = acsToWmsService.applyTask(request); + if (StrUtil.equals(resp.result, "true")) { + this.writing(this.mode); + this.setRequireSucess(true); + } else { + this.writing(400); + } + return true; + + } + + /** + * 申请取走空料盅托盘 + * + * @param + */ + public synchronized boolean apply_take_empty_vehicle() { + JSONObject json = new JSONObject(); + json.put("device_code", this.device_code); + json.put("type", "2"); + json.put("is_full", "1"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } + } + } + return true; + } + + + /** + * 申请取走满料盅托盘 + * + * @param + */ + public synchronized boolean apply_take_full_vehicle() { + JSONObject json = new JSONObject(); + json.put("device_code", this.device_code); + json.put("type", "1"); + json.put("weight", weight); + json.put("vehicle_code", barcode); + json.put("is_full", "1"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } else { + this.writing(400); + } + } + } + + return true; + + } + + /** + * 申请强制取走满料盅托盘 + * + * @param + */ + public synchronized boolean apply_force_take_full_vehicle() { + JSONObject json = new JSONObject(); + json.put("device_code", this.device_code); + json.put("type", "1"); + json.put("weight", weight); + json.put("vehicle_code", barcode); + json.put("is_full", "1"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } else { + this.writing(400); + } + } + } + + return true; + + } + + /** + * 申请强制满托入缓存 + * + * @param + */ + public synchronized boolean apply_force_take_full_vehicle_in_storage() { + JSONObject json = new JSONObject(); + json.put("device_code", this.device_code); + json.put("type", "1"); + json.put("weight", weight); + json.put("vehicle_code", barcode); + json.put("is_full", "1"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } else { + this.writing(400); + } + } + } + + return true; + + } + + /** + * 扫码成功申请 + * + * @param + */ + public synchronized boolean barcode_sucess_apply() { + JSONObject json = new JSONObject(); + json.put("device_code", this.device_code); + json.put("vehicle_code", barcode); + HttpResponse result = acsToWmsService.applyOuttoKiln(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } else { + this.writing(400); + } + } + } + + return true; + + } + + /** + * 获取组盘信息 + * + * @param + */ + public synchronized boolean get_vehicle_info() { + JSONObject json = new JSONObject(); + json.put("device_code", this.device_code); + json.put("type", "1"); + json.put("weight", weight); + json.put("vehicle_code", barcode); + json.put("is_full", "1"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } else { + this.writing(400); + } + } + } + + return true; + + } + + /** + * 强制去包装-不包装 + */ + public synchronized boolean force_no_package() { + JSONObject json = new JSONObject(); + json.put("type", "5"); + json.put("device_code", device_code); + + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } else { + this.writing(400); + } + } + } + return true; + } + + + /** + * 申请贴标 + */ + public synchronized boolean apply_labelling() { + JSONObject json = new JSONObject(); + json.put("type", "5"); + json.put("device_code", device_code); + + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + if (result.getStatus() == HttpStatus.OK.value()) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setRequireSucess(true); + } else { + this.writing(400); + } + } + } + return true; + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/LmsUtil.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/LmsUtil.java new file mode 100644 index 0000000..21cb8b9 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/LmsUtil.java @@ -0,0 +1,50 @@ + +package org.nl.acs.ext.wms; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.log.LokiLog; +import org.nl.acs.log.LokiLogType; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.system.service.ParamService; +import org.nl.modules.system.service.impl.ParamServiceImpl; +import org.nl.modules.wql.util.SpringContextHolder; + +/** + * ACS连接外部系统工具类: + */ +@Slf4j +public class LmsUtil { + + public static String notifyAcs(String api, W requestParam) { + DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);; + ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); + //判断是否连接立库WCS系统 + String isConnect = paramService.findByCode("hasWms").getValue(); + if (StrUtil.equals("0", isConnect)) { + throw new BadRequestException("参数配置表中-hasWms为:0"); + } + String liKu_wcs_url = paramService.findByCode("wmsurl").getValue(); + try { + log.info("请求LMS参数:{}", JSON.toJSONString(requestParam)); + String body = HttpRequest + .post(liKu_wcs_url + api).setConnectionTimeout(3000) + .body(JSON.toJSONString(requestParam)) + .execute() + .body(); + log.info("请求LMS参数返回参数:{}", body); + return body; + } catch (Exception e) { + JSONObject result = new JSONObject(); + result.put("result", "false"); + result.put("code", "1"); + result.put("comment", e.getMessage()); + log.info("请求LMS异常返回参数:{}", String.valueOf(result)); + return String.valueOf(result); + } + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/RespUtil.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/RespUtil.java new file mode 100644 index 0000000..1480660 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/RespUtil.java @@ -0,0 +1,18 @@ +package org.nl.acs.ext.wms; + +import com.alibaba.fastjson.JSONObject; +import org.nl.acs.ext.wms.data.Resp; + +/** + * @author: geng by + * @createDate: 2022/11/24 + */ +public class RespUtil { + public static Resp getResp(String result, T t) { + JSONObject jsonObject = JSONObject.parseObject(result); + Resp resp = new Resp<>(); + resp.setData(t); + resp = JSONObject.toJavaObject(jsonObject, Resp.class); + return resp; + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java new file mode 100644 index 0000000..e9c8d0b --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java @@ -0,0 +1,42 @@ +package org.nl.acs.ext.wms.data; + +import lombok.Data; + +import java.util.HashMap; +import java.util.Map; + +@Data +public class BaseRequest { + + /** + * 请求号:uuid 唯一,LMS需要返回对应值 + */ + private String requestNo; + + /** + * 请求时间 + */ + private String requestDate; + + /** + * 请求方法编号 + */ + private String request_medthod_code; + + /** + * 请求方法名称 + */ + private String request_medthod_name; + + + /** + * 系统编号 + */ + private String systemCode; + + /** + * 扩展参数:砖型等 + */ + private Map parameters = new HashMap(); + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseResponse.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseResponse.java new file mode 100644 index 0000000..8558e0e --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/BaseResponse.java @@ -0,0 +1,36 @@ +package org.nl.acs.ext.wms.data; + +import lombok.Data; + +import java.util.HashMap; +import java.util.Map; + +@Data +public class BaseResponse { + + /** + * 请求号 + */ + private String requestNo; + + /** + * 响应时间 + */ + private String responseDate; + + /** + * 结果 200成功 + */ + private int code; + + /** + * 信息 + */ + private String message; + + + private Map parameters = new HashMap(); + + + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/Resp.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/Resp.java new file mode 100644 index 0000000..03f2b41 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/Resp.java @@ -0,0 +1,32 @@ +package org.nl.acs.ext.wms.data; + +import lombok.Data; + +/** + * 调用立库接口统一返回参数类 + * + * @author: geng by + * @createDate: 2022/11/24 + */ +@Data +public class Resp { + /** + * 成功返回true,失败返回false + */ + public String result; + + /** + * 错误码(0表示成功)1代表入库目的位置有货,其他更多情况待定 + */ + public String code; + + /** + * 错误信息,如果成功则为null + */ + public String comment; + + /** + * 报文携带的数据 + */ + public T data; +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/applyTask/ApplyTaskRequest.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/applyTask/ApplyTaskRequest.java new file mode 100644 index 0000000..84a2f21 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/applyTask/ApplyTaskRequest.java @@ -0,0 +1,39 @@ +package org.nl.acs.ext.wms.data.applyTask; + +import lombok.Data; +import org.nl.acs.ext.wms.data.BaseRequest; + +@Data +public class ApplyTaskRequest extends BaseRequest { + + /** + * 请求设备 + */ + private String device_code; + + /** + * 载具号 + */ + private String vehicle_code; + + /** + * 重量 + */ + private String weight; + + /** + * 工单号 + */ + private String order_code; + + /** + * 物料 + */ + private String material_code; + + /** + * 数量 + */ + private String qty; + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/applyTask/ApplyTaskResponse.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/applyTask/ApplyTaskResponse.java new file mode 100644 index 0000000..85005b9 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/applyTask/ApplyTaskResponse.java @@ -0,0 +1,6 @@ +package org.nl.acs.ext.wms.data.applyTask; + +import org.nl.acs.ext.wms.data.BaseResponse; + +public class ApplyTaskResponse extends BaseResponse { +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStautsRequest.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStautsRequest.java new file mode 100644 index 0000000..c563816 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStautsRequest.java @@ -0,0 +1,45 @@ +package org.nl.acs.ext.wms.data.feedBackTaskStatus; + +import lombok.Data; +import org.nl.acs.ext.wms.data.BaseRequest; + +@Data +public class FeedBackTaskStautsRequest extends BaseRequest { + + /** + * 任务id + */ + private String task_id; + + /** + * 任务code + */ + private String task_code; + + /** + * 任务状态 + */ + private String task_status; + + /** + * 任务类型 + */ + private String task_type; + + /** + * 车号 + */ + private String car_no; + + /** + * 载具号 + */ + private String vehicle_code; + + /** + * 动作 1请求取货 2取货完成 3请求放货 4放货完成 + */ + private String action; + + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStautsResponse.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStautsResponse.java new file mode 100644 index 0000000..26d53f8 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStautsResponse.java @@ -0,0 +1,6 @@ +package org.nl.acs.ext.wms.data.feedBackTaskStatus; + +import org.nl.acs.ext.wms.data.BaseResponse; + +public class FeedBackTaskStautsResponse extends BaseResponse { +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index d677a0c..cb961ba 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -3,6 +3,9 @@ package org.nl.acs.ext.wms.service; import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import org.nl.acs.ext.wms.data.Resp; +import org.nl.acs.ext.wms.data.applyTask.ApplyTaskRequest; +import org.nl.acs.ext.wms.data.applyTask.ApplyTaskResponse; import java.util.Map; @@ -19,6 +22,11 @@ public interface AcsToWmsService { HttpResponse lnshApplyTaskToWms(JSONObject json); + /** + * ACS向WMS申请晟华任务 + */ + public Resp applyTask(ApplyTaskRequest request); + /** * ACS向WMS申请贴标 */ diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 31e62f1..f7c736d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -13,6 +13,11 @@ import org.nl.acs.config.AcsConfig; import org.nl.acs.device.address.service.AddressService; import org.nl.acs.device.address.service.dto.AddressDto; import org.nl.acs.device.service.DeviceService; +import org.nl.acs.ext.wms.LmsUtil; +import org.nl.acs.ext.wms.RespUtil; +import org.nl.acs.ext.wms.data.Resp; +import org.nl.acs.ext.wms.data.applyTask.ApplyTaskRequest; +import org.nl.acs.ext.wms.data.applyTask.ApplyTaskResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.task.service.TaskService; @@ -23,7 +28,6 @@ import org.nl.modules.system.service.ParamService; import org.nl.modules.wql.core.bean.WQLObject; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; @@ -268,6 +272,23 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } + + + @Override + public Resp applyTask(ApplyTaskRequest requestParam) { + try { + MDC.put(log_file_type, log_type); + String api = addressService.findByCode("lnshApplyTaskToWms").getMethods_url(); + log.info("lnshApplyTaskToWms-----输入参数{}", JSON.toJSONString(requestParam)); + String result = LmsUtil.notifyAcs(api, requestParam); + log.info("lnshApplyTaskToWms-----输出参数{}", result); + return RespUtil.getResp(result, new ApplyTaskResponse()); + } finally { + MDC.remove(log_file_type); + } + + } + @Override public HttpResponse lnshApplyTaskToWms(JSONObject json) { try { 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 30cf5ec..175e1e4 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 @@ -314,8 +314,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { lnshMixingMillDeviceDriver.writing("to_order_No", producetask_code); lnshMixingMillDeviceDriver.writing("to_weight", qty); lnshMixingMillDeviceDriver.writing("to_material_code", material_code); - lnshMixingMillDeviceDriver.writing(1); - lnshMixingMillDeviceDriver.writing(1); + lnshMixingMillDeviceDriver.writing(100); + lnshMixingMillDeviceDriver.writing(100); is_flag = true; } if (device.getDeviceDriver() instanceof LnshPressDeviceDriver) { @@ -345,8 +345,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { lnshPressDeviceDriver.writing("to_BshortSide", BshortSide); lnshPressDeviceDriver.writing("to_Htrapezoidal", Htrapezoidal); lnshPressDeviceDriver.writing("to_Wthickness", Wthickness); - lnshPressDeviceDriver.writing(1); - lnshPressDeviceDriver.writing(1); + lnshPressDeviceDriver.writing(100); + lnshPressDeviceDriver.writing(100); is_flag = true; } if (device.getDeviceDriver() instanceof LnshPackagePalletManipulatorDeviceDriver) { @@ -378,8 +378,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { lnshPackagePalletManipulatorDeviceDriver.writing("to_Htrapezoidal", Htrapezoidal); lnshPackagePalletManipulatorDeviceDriver.writing("to_Wthickness", Wthickness); lnshPackagePalletManipulatorDeviceDriver.writing("to_vehicle_type", String.valueOf(json.getIntValue("vehicle_type") - 2)); - lnshPackagePalletManipulatorDeviceDriver.writing(1); - lnshPackagePalletManipulatorDeviceDriver.writing(1); + lnshPackagePalletManipulatorDeviceDriver.writing(100); + lnshPackagePalletManipulatorDeviceDriver.writing(100); is_flag = true; } if (device.getDeviceDriver() instanceof LnshSplitManipulatorDeviceDriver) { @@ -409,8 +409,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { lnshSplitManipulatorDeviceDriver.writing("to_BshortSide", BshortSide); lnshSplitManipulatorDeviceDriver.writing("to_Htrapezoidal", Htrapezoidal); lnshSplitManipulatorDeviceDriver.writing("to_Wthickness", Wthickness); - lnshSplitManipulatorDeviceDriver.writing(1); - lnshSplitManipulatorDeviceDriver.writing(1); + lnshSplitManipulatorDeviceDriver.writing(100); + lnshSplitManipulatorDeviceDriver.writing(100); is_flag = true; } //下发成功后,写入工单信息表记录 @@ -983,8 +983,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { if (driver.getMode() != 0 && driver.getError() == 0 && driver.getMove() != 0) { - driver.writing(1); - driver.writing(1); + driver.writing(100); + driver.writing(100); } else { String message = ""; if (driver.getMode() != 0) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/enums/InstStatusEnum.java b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/enums/InstStatusEnum.java index 71d6d3a..8ad0b51 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/enums/InstStatusEnum.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/enums/InstStatusEnum.java @@ -8,10 +8,10 @@ import com.alibaba.fastjson.JSONObject; * 任务状态 */ public enum InstStatusEnum { - READY(1, "READY", "就绪"), - ISSUE(2, "ISSUE", "已下发"), - BUSY(3, "BUSY", "执行中"), - FINISHED(4, "FINISHED", "完成"); + READY(1, "0", "就绪"), + BUSY(2, "1", "执行中"), + FINISHED(3, "2", "完成"), + CANCEL(4, "3", "取消"); //索引 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceManageDto.java b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceManageDto.java index 96c8e6f..c4e9753 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceManageDto.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/opc/DeviceManageDto.java @@ -70,7 +70,8 @@ public class DeviceManageDto { while (var2.hasNext()) { DeviceExtraManageDto dto = (DeviceExtraManageDto) var2.next(); - result.put(dto.getExtra_code(), dto.parseName()); +// result.put(dto.getExtra_code(), dto.parseName()); + result.put(dto.getExtra_code(), dto.getExtra_name()); } this.extra_map = result; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/enums/TaskStatusEnum.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/enums/TaskStatusEnum.java index 0a841b7..5d6ab16 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/enums/TaskStatusEnum.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/enums/TaskStatusEnum.java @@ -8,9 +8,10 @@ import com.alibaba.fastjson.JSONObject; * 任务状态 */ public enum TaskStatusEnum { - READY(1, "READY", "就绪"), - BUSY(2, "BUSY", "执行中"), - FINISHED(3, "FINISHED", "完成"); + READY(1, "0", "就绪"), + BUSY(2, "1", "执行中"), + FINISHED(3, "2", "完成"), + CANCEL(3, "3", "取消"); //索引 diff --git a/acs/nladmin-ui/src/api/acs/device/device.js b/acs/nladmin-ui/src/api/acs/device/device.js index d1d28ed..9272096 100644 --- a/acs/nladmin-ui/src/api/acs/device/device.js +++ b/acs/nladmin-ui/src/api/acs/device/device.js @@ -149,6 +149,14 @@ export function reload() { }) } + +export function selectRequestMethodList() { + return request({ + url: 'api/device/selectRequestMethodList', + method: 'get' + }) +} + export default { add, edit, del, selectDeviceList, selectDeviceListByRegion, callAgv, responseAgv, selectDeviceDevicerInfo, autoCreateTask, changeDeviceStatus, cleanTask, queryStorageExtra, selectConDeviceList, saveBarcode, selectDeviceListOne, selectDeviceListTwo, selectDeviceListThree, - addMaterial, cleanMaterial, reload } + addMaterial, cleanMaterial, reload, selectRequestMethodList } diff --git a/acs/nladmin-ui/src/api/acs/device/driverConfig.js b/acs/nladmin-ui/src/api/acs/device/driverConfig.js index 79b2b5d..fee622d 100644 --- a/acs/nladmin-ui/src/api/acs/device/driverConfig.js +++ b/acs/nladmin-ui/src/api/acs/device/driverConfig.js @@ -26,10 +26,11 @@ export function selectDriverCodeList(device_code) { }) } -export function updateConfig(parentForm, form, data1, data2) { +export function updateConfig(parentForm, form, modeform,data1, data2) { const data = { parentForm, form, + modeform, data1, data2 } diff --git a/acs/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_one.vue b/acs/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_one.vue index c1273a7..b1240a5 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_one.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_one.vue @@ -83,7 +83,7 @@ export default { // 根据驱动类型判断是否为路由设备 const parentForm = this.parentForm parentForm.is_route = true - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_two.vue b/acs/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_two.vue index 013bc25..aaf2c47 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_two.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/agv/agv_ndc_two.vue @@ -95,7 +95,7 @@ export default { this.configLoading = true // 根据驱动类型判断是否为路由设备 const parentForm = this.parentForm - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/cargo_lift_conveyor.vue b/acs/nladmin-ui/src/views/acs/device/driver/cargo_lift_conveyor.vue index ef7b1fa..572e625 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/cargo_lift_conveyor.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/cargo_lift_conveyor.vue @@ -464,7 +464,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/empty_vehicle_stacking_position.vue b/acs/nladmin-ui/src/views/acs/device/driver/empty_vehicle_stacking_position.vue index ecbcdff..626fd66 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/empty_vehicle_stacking_position.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/empty_vehicle_stacking_position.vue @@ -464,7 +464,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/hailiang_smart_plc_test.vue b/acs/nladmin-ui/src/views/acs/device/driver/hailiang_smart_plc_test.vue index d1b3d3d..dde7369 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/hailiang_smart_plc_test.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/hailiang_smart_plc_test.vue @@ -455,7 +455,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/haokai_auto_conveyor.vue b/acs/nladmin-ui/src/views/acs/device/driver/haokai_auto_conveyor.vue index 605fa7c..1176e65 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/haokai_auto_conveyor.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/haokai_auto_conveyor.vue @@ -435,7 +435,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lamp_three_color.vue b/acs/nladmin-ui/src/views/acs/device/driver/lamp_three_color.vue index f117c07..79ba2cd 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lamp_three_color.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lamp_three_color.vue @@ -318,7 +318,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_Laminating_machine.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_Laminating_machine.vue index e06425b..ed25fa1 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_Laminating_machine.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_Laminating_machine.vue @@ -473,7 +473,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_crusher.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_crusher.vue index e46b1db..df4ce75 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_crusher.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_crusher.vue @@ -464,7 +464,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_fold_disc_site.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_fold_disc_site.vue index ccff38f..4713e12 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_fold_disc_site.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_fold_disc_site.vue @@ -475,7 +475,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_kiln_lane.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_kiln_lane.vue index 550d654..e4e88aa 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_kiln_lane.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_kiln_lane.vue @@ -464,7 +464,8 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { + this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_kiln_truss.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_kiln_truss.vue index 64fe32e..d648849 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_kiln_truss.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_kiln_truss.vue @@ -464,7 +464,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_labeling_machine.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_labeling_machine.vue index d8e4e0a..847bd25 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_labeling_machine.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_labeling_machine.vue @@ -158,6 +158,66 @@ + +
+ 交互相关: +
+
+ + + + + 新增一行 + + + +
+
+ + + + + + + + + + + +
+
@@ -294,8 +354,17 @@ export default { dataOpcservers: [], dataOpcPlcs: [], deviceList: [], + requestMethodList: [], data1: [], data2: [], + modeform: { + tableData: [ + { + mode: '14', + request: 'apply_labelling' + } + ] + }, form: { inspect_in_stocck: true, ignore_pickup_check: true, @@ -349,9 +418,18 @@ export default { deviceCrud.selectDeviceList().then(data => { this.deviceList = data }) + deviceCrud.selectRequestMethodList().then(data => { + this.requestMethodList = data + }) }) }, methods: { + insertdtl() { + this.modeform.tableData.push({mode: '', request: '' }) + }, + deleteRow(index, rows) { + rows.splice(index, 1) + }, finishReadEdit(data) { // 编辑的是code列,并且值包含mode if (data.code.indexOf('mode') !== -1) { @@ -462,7 +540,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_mixing_mill.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_mixing_mill.vue index 3d8b3f7..81111a1 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_mixing_mill.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_mixing_mill.vue @@ -159,6 +159,67 @@ + +
+ 交互相关: +
+
+ + + + + 新增一行 + + + +
+
+ + + + + + + + + + + +
+
+
PLC读取字段: @@ -294,8 +355,61 @@ export default { dataOpcservers: [], dataOpcPlcs: [], deviceList: [], + requestMethodList: [], data1: [], data2: [], + modeform: { + tableData: [ + { + mode: '3', + request: 'order_verify' + }, + { + mode: '4', + request: 'order_finish' + }, + { + mode: '5', + request: 'apply_put_full_vehicle' + }, + { + mode: '6', + request: 'apply_put_empty_vehicle' + }, + { + mode: '7', + request: 'apply_take_empty_vehicle' + }, + { + mode: '8', + request: 'apply_take_full_vehicle' + }, + { + mode: '9', + request: 'apply_force_take_full_vehicle' + }, + { + mode: '10', + request: 'apply_force_take_full_vehicle_in_storage' + }, + { + mode: '11', + request: 'barcode_sucess_apply' + }, + { + mode: '12', + request: 'get_vehicle_info' + }, + { + mode: '13', + request: 'force_no_package' + }, + { + mode: '14', + request: 'apply_labelling' + } + ] + }, form: { inspect_in_stocck: true, ignore_pickup_check: true, @@ -336,6 +450,15 @@ export default { } this.data1 = data.rs this.data2 = data.ws + + if (data.modeform) { + const arr = Object.keys(data.modeform) + // 不为空 + if (arr.length > 0) { + this.modeform.tableData = data.modeform + } + } + this.sliceItem() }) selectPlcList().then(data => { @@ -349,6 +472,9 @@ export default { deviceCrud.selectDeviceList().then(data => { this.deviceList = data }) + deviceCrud.selectRequestMethodList().then(data => { + this.requestMethodList = data + }) }) }, methods: { @@ -404,6 +530,13 @@ export default { } } }, + insertdtl() { + this.modeform.tableData.push({mode: '', request: '' }) + }, + deleteRow(index, rows) { + debugger + rows.splice(index, 1) + }, finishWriteEdit(data) { // 编辑的是code列,并且值包含mode if (data.code.indexOf('to_command') !== -1) { @@ -494,7 +627,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, this.modeform, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_out_kiln_truss.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_out_kiln_truss.vue index 4fd2d3d..ffbfb61 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_out_kiln_truss.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_out_kiln_truss.vue @@ -464,7 +464,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_line.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_line.vue index 760df2e..c6ce80d 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_line.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_line.vue @@ -464,7 +464,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_pallet_manipulator.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_pallet_manipulator.vue index 2173afa..a22d6f0 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_pallet_manipulator.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_pallet_manipulator.vue @@ -464,7 +464,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_site.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_site.vue index 84d5e65..0479746 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_site.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_package_site.vue @@ -450,7 +450,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_pallet_storage.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_pallet_storage.vue index a9c75d3..5449285 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_pallet_storage.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_pallet_storage.vue @@ -464,7 +464,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_palletizing_manipulator.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_palletizing_manipulator.vue index e0b7012..eb1f1d7 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_palletizing_manipulator.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_palletizing_manipulator.vue @@ -464,7 +464,7 @@ export default { parentForm.is_route = true parentForm.plc_id = this.plc_id parentForm.opc_id = this.opc_id - updateConfig(parentForm, this.form, this.data1, this.data2).then(res => { + updateConfig(parentForm, this.form, null, this.data1, this.data2).then(res => { this.notify('保存成功', 'success') this.configLoading = false }).catch(err => { diff --git a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_palletizing_manipulator_site.vue b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_palletizing_manipulator_site.vue index 06519b6..0cda84d 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_palletizing_manipulator_site.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/lnsh/lnsh_palletizing_manipulator_site.vue @@ -1,5 +1,5 @@