From 54d5312cc599a4af91447a776f171972b17c20e6 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Sat, 17 Dec 2022 19:43:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acs/agv/server/impl/AgvServiceImpl.java | 20 +- .../agv/server/impl/MagicAgvServiceImpl.java | 75 +-- .../agv/server/impl/NDCAgvServiceImpl.java | 79 +-- .../server/impl/XianGongAgvServiceImpl.java | 77 +-- .../agv/server/impl/ZheDaAgvServiceImpl.java | 237 ------- ...andardCoveyorControlWithScannerDevice.java | 29 +- .../service/impl/DeviceServiceImpl.java | 10 +- .../CargoLiftConveyorDefination.java | 60 -- .../CargoLiftConveyorDeviceDriver.java | 313 --------- .../cargo_lift_conveyor/ItemProtocol.java | 97 --- ...mptyVehicleStackingPositionDefination.java | 60 -- ...tyVehicleStackingPositionDeviceDriver.java | 194 ------ .../ItemProtocol.java | 100 --- .../HailiangSmartplcTestDefination.java | 61 -- .../HailiangSmartplcTestDeviceDriver.java | 227 ------- .../hailiang_smart_plc_test/ItemProtocol.java | 105 --- .../HaoKaiAutoConveyorDefination.java | 60 -- .../HaoKaiAutoConveyorDeviceDriver.java | 236 ------- .../haokai_auto_conveyor/ItemProtocol.java | 93 --- .../paint_conveyor/ItemProtocol.java | 99 --- .../PaintConveyorDefination.java | 61 -- .../PaintConveyorDeviceDriver.java | 260 -------- .../ItemProtocol.java | 121 ---- .../StandardConveyorControlDefination.java | 64 -- .../StandardCoveyorControlDeviceDriver.java | 438 ------------- .../ItemProtocol.java | 97 --- ...dConveyorControlWithScannerDefination.java | 63 -- .../StandardConveyorWithScannerConfig.java | 12 - ...CoveyorControlWithScannerDeviceDriver.java | 615 ----------------- .../HfGantryManipulatorDeviceDriver.java | 45 +- .../hf_station/HfStationDeviceDriver.java | 113 ++-- .../hf_two_rgv/HfTwoRGVDeviceDriver.java | 73 +-- .../acs/ext/wms/rest/AcsToWmsController.java | 48 -- .../acs/ext/wms/rest/WmsToAcsController.java | 38 -- .../acs/ext/wms/service/AcsToWmsService.java | 108 +-- .../acs/ext/wms/service/WmsToAcsService.java | 37 -- .../wms/service/impl/AcsToWmsServiceImpl.java | 620 +++--------------- .../wms/service/impl/WmsToAcsServiceImpl.java | 167 +---- .../service/impl/InstructionServiceImpl.java | 60 -- .../log/service/DeviceExecuteLogService.java | 12 + .../impl/DeviceExecuteLogServiceImpl.java | 65 ++ .../rest/ProduceshiftorderController.java | 9 + .../service/ProduceshiftorderService.java | 1 + .../impl/ProduceshiftorderServiceImpl.java | 38 +- .../service/impl/TaskFeedbackServiceImpl.java | 16 +- .../task/service/impl/TaskServiceImpl.java | 24 +- .../src/api/acs/order/produceshiftorder.js | 10 +- acs/nladmin-ui/src/views/acs/order/index.vue | 17 + .../acs/service/impl/AcsToWmsServiceImpl.java | 56 +- .../service/impl/WorkorderServiceImpl.java | 82 +-- .../src/main/java/org/nl/wms/wms.xls | Bin 272896 -> 272896 bytes 51 files changed, 595 insertions(+), 5007 deletions(-) delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDefination.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/ItemProtocol.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDefination.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/ItemProtocol.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDefination.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/ItemProtocol.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/HaoKaiAutoConveyorDefination.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/HaoKaiAutoConveyorDeviceDriver.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/ItemProtocol.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/ItemProtocol.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDefination.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDeviceDriver.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/ItemProtocol.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardConveyorControlDefination.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardConveyorControlWithScannerDefination.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardConveyorWithScannerConfig.java delete mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java index 6bd14f5..72f6e5d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java @@ -59,16 +59,16 @@ public class AgvServiceImpl implements AgvService { @Override public String requestOpenOrCloseDoor(String device_code, String param) { - log.info("AGV请求开关门参数,设备:{},参数:{}", device_code, param); - int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); - switch (type) { - case 4: - acsToWmsService.applyOpenOrCloseDoor(device_code, param); - break; - default: - break; - - } +// log.info("AGV请求开关门参数,设备:{},参数:{}", device_code, param); +// int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); +// switch (type) { +// case 4: +// acsToWmsService.applyOpenOrCloseDoor(device_code, param); +// break; +// default: +// break; +// +// } return null; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java index d074229..6cc61b1 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/MagicAgvServiceImpl.java @@ -696,43 +696,44 @@ public class MagicAgvServiceImpl implements MagicAgvService { @LokiLog(type = LokiLogType.AGV) @Override public String queryDoorStatus(String device) { - log.info("AGV查询自动门状态,参数:{}", device); - int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); - switch (type) { - case 4: - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASOTHERSYSTEM).getValue(), "1")) { - String result = acsToWmsService.queryDoorsStatus().body(); - JSONArray ja = JSONArray.parseArray(result); - log.info("AGV查询自动门状态,反馈:{}", ja.toString()); - return ja.toString(); - } - return null; - default: - if (StrUtil.equals("doors", device)) { - List list = deviceAppService.findDevice(DeviceType.autodoor); - JSONArray ja = new JSONArray(); - for (int i = 0; i < list.size(); i++) { - Device doordevice = deviceAppService.findDeviceByCode(list.get(i).getDevice_code()); - if (ObjectUtil.isEmpty(doordevice)) { - throw new BadRequestException("未找到对应设备"); - } - String mes = null; - - } - log.info("AGV查询自动门状态,反馈:{}", ja.toString()); - return ja.toString(); - - } else { - Device doordevice = deviceAppService.findDeviceByCode(device); - if (ObjectUtil.isEmpty(doordevice)) { - throw new BadRequestException("未找到对应设备"); - } - String mes = null; - JSONObject jo = JSONObject.parseObject(mes); - log.info("AGV查询自动门状态,反馈:{}", jo.toString()); - return jo.toString(); - } - } +// log.info("AGV查询自动门状态,参数:{}", device); +// int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); +// switch (type) { +// case 4: +// if (StrUtil.equals(paramService.findByCode(AcsConfig.HASOTHERSYSTEM).getValue(), "1")) { +// String result = acsToWmsService.queryDoorsStatus().body(); +// JSONArray ja = JSONArray.parseArray(result); +// log.info("AGV查询自动门状态,反馈:{}", ja.toString()); +// return ja.toString(); +// } +// return null; +// default: +// if (StrUtil.equals("doors", device)) { +// List list = deviceAppService.findDevice(DeviceType.autodoor); +// JSONArray ja = new JSONArray(); +// for (int i = 0; i < list.size(); i++) { +// Device doordevice = deviceAppService.findDeviceByCode(list.get(i).getDevice_code()); +// if (ObjectUtil.isEmpty(doordevice)) { +// throw new BadRequestException("未找到对应设备"); +// } +// String mes = null; +// +// } +// log.info("AGV查询自动门状态,反馈:{}", ja.toString()); +// return ja.toString(); +// +// } else { +// Device doordevice = deviceAppService.findDeviceByCode(device); +// if (ObjectUtil.isEmpty(doordevice)) { +// throw new BadRequestException("未找到对应设备"); +// } +// String mes = null; +// JSONObject jo = JSONObject.parseObject(mes); +// log.info("AGV查询自动门状态,反馈:{}", jo.toString()); +// return jo.toString(); +// } +// } + return null; } @Override diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index 714b4bd..640abdd 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -364,45 +364,46 @@ public class NDCAgvServiceImpl implements NDCAgvService { @LokiLog(type = LokiLogType.AGV) @Override public String queryDoorStatus(String device) { - log.info("AGV查询自动门状态,参数:{}", device); - int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); - switch (type) { - case 4: - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASOTHERSYSTEM).getValue(), "1")) { - String result = acsToWmsService.queryDoorsStatus().body(); - JSONArray ja = JSONArray.parseArray(result); - log.info("AGV查询自动门状态,反馈:{}", ja.toString()); - return ja.toString(); - } - return null; - default: - if (StrUtil.equals("doors", device)) { - List list = deviceAppService.findDevice(DeviceType.autodoor); - JSONArray ja = new JSONArray(); - for (int i = 0; i < list.size(); i++) { - Device doordevice = deviceAppService.findDeviceByCode(list.get(i).getDevice_code()); - if (ObjectUtil.isEmpty(doordevice)) { - throw new BadRequestException("未找到对应设备"); - } - String mes = null; - - JSONObject jo = JSONObject.parseObject(mes); - ja.add(jo); - } - log.info("AGV查询自动门状态,反馈:{}", ja.toString()); - return ja.toString(); - - } else { - Device doordevice = deviceAppService.findDeviceByCode(device); - if (ObjectUtil.isEmpty(doordevice)) { - throw new BadRequestException("未找到对应设备"); - } - String mes = null; - JSONObject jo = JSONObject.parseObject(mes); - log.info("AGV查询自动门状态,反馈:{}", jo.toString()); - return jo.toString(); - } - } + return null; +// log.info("AGV查询自动门状态,参数:{}", device); +// int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); +// switch (type) { +// case 4: +// if (StrUtil.equals(paramService.findByCode(AcsConfig.HASOTHERSYSTEM).getValue(), "1")) { +// String result = acsToWmsService.queryDoorsStatus().body(); +// JSONArray ja = JSONArray.parseArray(result); +// log.info("AGV查询自动门状态,反馈:{}", ja.toString()); +// return ja.toString(); +// } +// return null; +// default: +// if (StrUtil.equals("doors", device)) { +// List list = deviceAppService.findDevice(DeviceType.autodoor); +// JSONArray ja = new JSONArray(); +// for (int i = 0; i < list.size(); i++) { +// Device doordevice = deviceAppService.findDeviceByCode(list.get(i).getDevice_code()); +// if (ObjectUtil.isEmpty(doordevice)) { +// throw new BadRequestException("未找到对应设备"); +// } +// String mes = null; +// +// JSONObject jo = JSONObject.parseObject(mes); +// ja.add(jo); +// } +// log.info("AGV查询自动门状态,反馈:{}", ja.toString()); +// return ja.toString(); +// +// } else { +// Device doordevice = deviceAppService.findDeviceByCode(device); +// if (ObjectUtil.isEmpty(doordevice)) { +// throw new BadRequestException("未找到对应设备"); +// } +// String mes = null; +// JSONObject jo = JSONObject.parseObject(mes); +// log.info("AGV查询自动门状态,反馈:{}", jo.toString()); +// return jo.toString(); +// } +// } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java index b4832e6..dcb3989 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/XianGongAgvServiceImpl.java @@ -416,44 +416,45 @@ public class XianGongAgvServiceImpl implements XianGongAgvService { @LokiLog(type = LokiLogType.AGV) @Override public String queryDoorStatus(String device) { - log.info("AGV查询自动门状态,参数:{}", device); - int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); - switch (type) { - case 4: - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASOTHERSYSTEM).getValue(), "1")) { - String result = acsToWmsService.queryDoorsStatus().body(); - JSONArray ja = JSONArray.parseArray(result); - log.info("AGV查询自动门状态,反馈:{}", ja.toString()); - return ja.toString(); - } - return null; - default: - if (StrUtil.equals("doors", device)) { - List list = deviceAppService.findDevice(DeviceType.autodoor); - JSONArray ja = new JSONArray(); - for (int i = 0; i < list.size(); i++) { - Device doordevice = deviceAppService.findDeviceByCode(list.get(i).getDevice_code()); - if (ObjectUtil.isEmpty(doordevice)) { - throw new BadRequestException("未找到对应设备"); - } - String mes = null; - JSONObject jo = JSONObject.parseObject(mes); - ja.add(jo); - } - log.info("AGV查询自动门状态,反馈:{}", ja.toString()); - return ja.toString(); - - } else { - Device doordevice = deviceAppService.findDeviceByCode(device); - if (ObjectUtil.isEmpty(doordevice)) { - throw new BadRequestException("未找到对应设备"); - } - String mes = null; - JSONObject jo = JSONObject.parseObject(mes); - log.info("AGV查询自动门状态,反馈:{}", jo.toString()); - return jo.toString(); - } - } + return null; +// log.info("AGV查询自动门状态,参数:{}", device); +// int type = Integer.parseInt(paramService.findByCode(AcsConfig.BUSINESSTYPE).getValue()); +// switch (type) { +// case 4: +// if (StrUtil.equals(paramService.findByCode(AcsConfig.HASOTHERSYSTEM).getValue(), "1")) { +// String result = acsToWmsService.queryDoorsStatus().body(); +// JSONArray ja = JSONArray.parseArray(result); +// log.info("AGV查询自动门状态,反馈:{}", ja.toString()); +// return ja.toString(); +// } +// return null; +// default: +// if (StrUtil.equals("doors", device)) { +// List list = deviceAppService.findDevice(DeviceType.autodoor); +// JSONArray ja = new JSONArray(); +// for (int i = 0; i < list.size(); i++) { +// Device doordevice = deviceAppService.findDeviceByCode(list.get(i).getDevice_code()); +// if (ObjectUtil.isEmpty(doordevice)) { +// throw new BadRequestException("未找到对应设备"); +// } +// String mes = null; +// JSONObject jo = JSONObject.parseObject(mes); +// ja.add(jo); +// } +// log.info("AGV查询自动门状态,反馈:{}", ja.toString()); +// return ja.toString(); +// +// } else { +// Device doordevice = deviceAppService.findDeviceByCode(device); +// if (ObjectUtil.isEmpty(doordevice)) { +// throw new BadRequestException("未找到对应设备"); +// } +// String mes = null; +// JSONObject jo = JSONObject.parseObject(mes); +// log.info("AGV查询自动门状态,反馈:{}", jo.toString()); +// return jo.toString(); +// } +// } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java index 24bfc0f..7235dea 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/ZheDaAgvServiceImpl.java @@ -10,11 +10,6 @@ import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; import org.nl.acs.agv.AgvUtil; import org.nl.acs.agv.server.ZheDaAgvService; -import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver; -import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver; -import org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test.HailiangSmartplcTestDeviceDriver; -import org.nl.acs.device_driver.basedriver.haokai_auto_conveyor.HaoKaiAutoConveyorDeviceDriver; -import org.nl.acs.device_driver.basedriver.paint_conveyor.PaintConveyorDeviceDriver; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.LokiLog; @@ -134,239 +129,7 @@ public class ZheDaAgvServiceImpl implements ZheDaAgvService { DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); Device addressdevice = appService.findDeviceByCode(address); - CargoLiftConveyorDeviceDriver cargoLiftConveyorDeviceDriver; - EmptyVehicleStackingPositionDeviceDriver emptyVehicleStackingPositionDeviceDriver; - HailiangSmartplcTestDeviceDriver hailiangSmartplcTestDeviceDriver; - HaoKaiAutoConveyorDeviceDriver haoKaiAutoConveyorDeviceDriver; - PaintConveyorDeviceDriver paintConveyorDeviceDriver; - //取货的进入前等待和离开等待 - if (action.equals("Load")) { - if ("EntryRequired".equals(type)) { - //共挤线三工位 - if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) { - hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); - if ((hailiangSmartplcTestDeviceDriver.getAction() == 1 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 1) { - inst.setExecute_status("1"); - is_feedback = true; - } - } - //叠盘位 - if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { - emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); - int number = emptyVehicleStackingPositionDeviceDriver.getNumber(); - if (number < Integer.valueOf(str)) { - log.info("叠盘位:" + jobno + "当前层高为:" + number + ",不存在第" + str + "的托盘!"); - return null; - } - inst.setExecute_status("1"); - is_feedback = true; - } - //货梯对接线 - if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { - cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); - if ((cargoLiftConveyorDeviceDriver.getAction() == 1 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 1) { - inst.setExecute_status("1"); - is_feedback = true; - } - } - //豪凯自动线对接位 - if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { - haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver(); - if ((haoKaiAutoConveyorDeviceDriver.getAction() == 1 || haoKaiAutoConveyorDeviceDriver.getAction() == 3) && haoKaiAutoConveyorDeviceDriver.getMove() == 1) { - inst.setExecute_status("1"); - is_feedback = true; - } - } - //油漆线 - if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { - paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); - if ((paintConveyorDeviceDriver.getAction() == 1 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 1) { - inst.setExecute_status("1"); - is_feedback = true; - } - } - } - if ("PauseOnStation".equals(type)) { - if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) { - hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); - inst.setExecute_status("2"); - hailiangSmartplcTestDeviceDriver.writing(2); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { - emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); - inst.setExecute_status("2"); - emptyVehicleStackingPositionDeviceDriver.writing(2); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { - cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); - inst.setExecute_status("2"); - cargoLiftConveyorDeviceDriver.writing(2); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { - haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver(); - inst.setExecute_status("2"); - haoKaiAutoConveyorDeviceDriver.writing(2); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { - paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); - inst.setExecute_status("2"); - paintConveyorDeviceDriver.writing(2); - is_feedback = true; - } - - } - } - //等待点等待 - if (action.equals("Wait")) { - if ("Wait".equals(type)) { - JSONObject jo = new JSONObject(); - jo.put("task_code", inst.getInstruction_code()); - JSONArray destinations = new JSONArray(); - String inst_type = inst.getInstruction_type(); - //如果任务类型为1,在点位进行等待,则查询当前叠盘位的数量,取当前数量的层数进行追加任务 - if ("1".equals(inst_type)) { - emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); - int current_num = emptyVehicleStackingPositionDeviceDriver.getNumber(); - if (current_num > 12) { - log.info("当前叠盘架:" + jobno + "已放满!"); - return null; - } - String start_point_code = inst.getStart_point_code(); - String next_point_code = inst.getNext_point_code(); - start_point_code = start_point_code + "." + (current_num + 1); - destinations.add(destination(start_point_code, "Load", "1", "1")); - destinations.add(destination(next_point_code, "Unload", "1", "1")); - - } - - //如果任务类型为2,在点位进行等待,则调用LMS的货位申请接口 - if ("2".equals(inst_type)) { - String next_point_code = ""; - //调用LMS接口 - - - destinations.add(destination(next_point_code, "Unload", "5", "1")); - } - jo.put("destinations", destinations); - - String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue(); - String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue(); - - String url = agvurl + ":" + agvport + "addDestinations"; - log.info("下发agv任务请求:{}", url); - - HttpResponse result = HttpRequest.post(url) - .body(String.valueOf(jo))//表单内容 - .timeout(20000)//超时,毫秒 - .execute(); - log.info("下发agv任务请求反馈:{}", result); - - //对任务进行封口 - JSONObject complete = new JSONObject(); - complete.put("task_code", inst.getInstruction_code()); - - String url2 = agvurl + ":" + agvport + "markComplete"; - log.info("下发agv任务请求:{}", url2); - - HttpResponse result2 = HttpRequest.post(url2) - .body(String.valueOf(complete))//表单内容 - .timeout(20000)//超时,毫秒 - .execute(); - log.info("下发agv任务请求反馈:{}", result2); - } - } - //放货的进入前等待和离开等待 - if (action.equals("Unload")) { - if ("EntryRequired".equals(type)) { - if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) { - hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); - if ((hailiangSmartplcTestDeviceDriver.getAction() == 2 || hailiangSmartplcTestDeviceDriver.getAction() == 3) && hailiangSmartplcTestDeviceDriver.getMove() == 0) { - inst.setExecute_status("3"); - is_feedback = true; - } - } - - if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { - emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); - int number = emptyVehicleStackingPositionDeviceDriver.getNumber(); - if (number >= Integer.valueOf(str)) { - log.info("叠盘位:" + jobno + "第" + str + "上有货!"); - return null; - } - inst.setExecute_status("3"); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { - cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); - if ((cargoLiftConveyorDeviceDriver.getAction() == 2 || cargoLiftConveyorDeviceDriver.getAction() == 3) && cargoLiftConveyorDeviceDriver.getMove() == 0) { - inst.setExecute_status("3"); - is_feedback = true; - } - } - - if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { - haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver(); - if ((haoKaiAutoConveyorDeviceDriver.getAction() == 2 || haoKaiAutoConveyorDeviceDriver.getAction() == 3) && haoKaiAutoConveyorDeviceDriver.getMove() == 0) { - inst.setExecute_status("3"); - is_feedback = true; - } - } - - if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { - paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); - if ((paintConveyorDeviceDriver.getAction() == 2 || paintConveyorDeviceDriver.getAction() == 3) && paintConveyorDeviceDriver.getMove() == 0) { - inst.setExecute_status("3"); - is_feedback = true; - } - } - } - if ("PauseOnStation".equals(type)) { - if (addressdevice.getDeviceDriver() instanceof HailiangSmartplcTestDeviceDriver) { - hailiangSmartplcTestDeviceDriver = (HailiangSmartplcTestDeviceDriver) addressdevice.getDeviceDriver(); - inst.setExecute_status("4"); - hailiangSmartplcTestDeviceDriver.writing(3); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { - emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) addressdevice.getDeviceDriver(); - inst.setExecute_status("4"); - emptyVehicleStackingPositionDeviceDriver.writing(3); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { - cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) addressdevice.getDeviceDriver(); - inst.setExecute_status("4"); - cargoLiftConveyorDeviceDriver.writing(3); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { - haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) addressdevice.getDeviceDriver(); - inst.setExecute_status("4"); - haoKaiAutoConveyorDeviceDriver.writing(3); - is_feedback = true; - } - - if (addressdevice.getDeviceDriver() instanceof PaintConveyorDeviceDriver) { - paintConveyorDeviceDriver = (PaintConveyorDeviceDriver) addressdevice.getDeviceDriver(); - inst.setExecute_status("4"); - paintConveyorDeviceDriver.writing(3); - is_feedback = true; - } - } - } JSONObject requestjo = new JSONObject(); if (is_feedback) { requestjo.put("task_code", jobno); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/common/StandardCoveyorControlWithScannerDevice.java b/acs/nladmin-system/src/main/java/org/nl/acs/common/StandardCoveyorControlWithScannerDevice.java index 8941e37..04a2a05 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/common/StandardCoveyorControlWithScannerDevice.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/common/StandardCoveyorControlWithScannerDevice.java @@ -1,8 +1,6 @@ package org.nl.acs.common; -import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; -import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; import org.nl.acs.opc.Device; import org.springframework.stereotype.Service; @@ -16,19 +14,20 @@ public class StandardCoveyorControlWithScannerDevice extends AbstractDriverServi @Override public JSONObject getDeviceInfo(Device device) { - StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver(); - JSONObject jo = super.getCommonDeviceInfo(standardCoveyorControlWithScannerDeviceDriver,0,0); - jo.put("error", standardCoveyorControlWithScannerDeviceDriver.getError()); - jo.put("isError", standardCoveyorControlWithScannerDeviceDriver.getIserror()); - jo.put("action", standardCoveyorControlWithScannerDeviceDriver.getAction()); - try { - jo.put("container", StrUtil.isEmpty(standardCoveyorControlWithScannerDeviceDriver.barcode()) ? "" : standardCoveyorControlWithScannerDeviceDriver.barcode()); - } catch (Exception e) { - e.printStackTrace(); - } - jo.put("message", StrUtil.equals(standardCoveyorControlWithScannerDeviceDriver.getMessage(), "null") ? "" : standardCoveyorControlWithScannerDeviceDriver.getMessage()); - jo.put("requestSucess", standardCoveyorControlWithScannerDeviceDriver.getRequireSucess().toString()); - jo.put("applySucess", standardCoveyorControlWithScannerDeviceDriver.getApplySucess().toString()); + // StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver(); + // JSONObject jo = super.getCommonDeviceInfo(standardCoveyorControlWithScannerDeviceDriver,0,0); +// jo.put("error", standardCoveyorControlWithScannerDeviceDriver.getError()); +// jo.put("isError", standardCoveyorControlWithScannerDeviceDriver.getIserror()); +// jo.put("action", standardCoveyorControlWithScannerDeviceDriver.getAction()); +// try { +// jo.put("container", StrUtil.isEmpty(standardCoveyorControlWithScannerDeviceDriver.barcode()) ? "" : standardCoveyorControlWithScannerDeviceDriver.barcode()); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// jo.put("message", StrUtil.equals(standardCoveyorControlWithScannerDeviceDriver.getMessage(), "null") ? "" : standardCoveyorControlWithScannerDeviceDriver.getMessage()); +// jo.put("requestSucess", standardCoveyorControlWithScannerDeviceDriver.getRequireSucess().toString()); +// jo.put("applySucess", standardCoveyorControlWithScannerDeviceDriver.getApplySucess().toString()); + JSONObject jo = new JSONObject(); return jo; } } 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 9850e63..2841ce1 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 @@ -20,7 +20,6 @@ import org.nl.acs.device.service.*; import org.nl.acs.device.service.dto.*; import org.nl.acs.device_driver.DeviceDriverDefination; import org.nl.acs.device_driver.ScannerDeviceDriver; -import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_scanner.StandardScannerDeviceDriver; @@ -1477,12 +1476,11 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial @Override public String queryScannerByCode(String device_code) throws Exception { Device device = deviceAppService.findDeviceByCode(device_code); - StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver = null; String str = null; - if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) { - standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver(); - str = standardCoveyorControlWithScannerDeviceDriver.barcode(); - } +// if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) { +// standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver(); +// str = standardCoveyorControlWithScannerDeviceDriver.barcode(); +// } return str; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDefination.java deleted file mode 100644 index eb17957..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDefination.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.nl.acs.device_driver.basedriver.cargo_lift_conveyor; - -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceType; -import org.springframework.stereotype.Service; - -import java.util.LinkedList; -import java.util.List; - -/** - * 货梯对接线 - */ -@Service -public class CargoLiftConveyorDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "cargo_lift_conveyor"; - } - - @Override - public String getDriverName() { - return "货梯对接线"; - } - - @Override - public String getDriverDescription() { - return "货梯对接线"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new CargoLiftConveyorDeviceDriver()).setDevice(device).setDriverDefination(this); - } - - @Override - public Class getDeviceDriverType() { - return CargoLiftConveyorDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.conveyor); - return types; - } - - @Override - public List getReadableItemDtos() { - return ItemProtocol.getReadableItemDtos(); - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java deleted file mode 100644 index 2a8cb33..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDeviceDriver.java +++ /dev/null @@ -1,313 +0,0 @@ -package org.nl.acs.device_driver.basedriver.cargo_lift_conveyor; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import lombok.Data; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.ObjectUtils; -import org.nl.acs.agv.server.AgvService; -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.RouteableDeviceDriver; -import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; -import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -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.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.route.service.dto.RouteLineDto; -import org.nl.acs.task.service.TaskService; -import org.nl.acs.task.service.dto.TaskDto; -import org.nl.modules.system.service.ParamService; -import org.nl.modules.wql.util.SpringContextHolder; -import org.openscada.opc.lib.da.Server; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.*; - -/** - * 货梯对接线 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class CargoLiftConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { - - protected ItemProtocol itemProtocol = new ItemProtocol(this); - @Autowired - DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); - @Autowired - InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); - @Autowired - DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class); - @Autowired - TaskService taskserver = SpringContextHolder.getBean(TaskService.class); - @Autowired - RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - @Autowired - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - @Autowired - AgvService agvService = SpringContextHolder.getBean(AgvService.class); - - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; - - int heartbeat = 0; - int mode = 0; - int move = 0; - int action = 0; - int error = 0; - int task = 0; - - Boolean isonline = true; - - Boolean iserror = false; - - //1-执行任务;2-取货完成;3-放货完成; - int flag; - - int last_mode = 0; - int last_move = 0; - int last_error = 0; - - String device_code; - - @Override - public Device getDevice() { - return this.device; - } - - //请求成功标记 - Boolean requireSucess = false; - - @Override - public void execute() throws Exception { - String message = null; - - device_code = this.getDeviceCode(); - heartbeat = this.itemProtocol.getItem_heartbeat(); - mode = this.itemProtocol.getItem_mode(); - move = this.itemProtocol.getItem_mode(); - error = this.itemProtocol.getItem_error(); - task = this.itemProtocol.getItem_task(); - action = this.itemProtocol.getItem_action(); - - - if (mode != last_mode) { - this.setRequireSucess(false); - } - if (move != last_move) { - if (move == 0) { - thingToNothing(); - } - } - if (error != last_error) { - } - - - 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: - //申请任务 - if (move > 0 && !requireSucess) { - instruction_require(); - } - } - switch (flag) { - //取货完成 - case 1: - writing(2); - break; - //放货完成 - case 2: - writing(3); - break; - - } - } - - last_mode = mode; - last_move = move; - last_error = error; - } - - - public synchronized boolean instruction_apply(String container_code) throws Exception { - Date date = new Date(); - if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_apply_time = date; - requireSucess = true; - return true; - } - } - - public synchronized boolean instruction_require() throws Exception { - 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; - //container_code - TaskDto task = taskserver.queryTaskByDeviceCode(device_code).get(0); - if (!ObjectUtil.isEmpty(task)) { - if (!ObjectUtils.isEmpty(instructionService.findByDeviceCodeFromCache(device_code))) { - return false; - } - String taskid = task.getTask_id(); - String taskcode = task.getTask_code(); - String vehiclecode = task.getVehicle_code(); - String priority = task.getPriority(); - String start_point_code = task.getStart_point_code(); - String start_device_code = task.getStart_device_code(); - String route_plan_code = task.getRoute_plan_code(); - String next_device_code = ""; - - /** - * 开始平均分配 - */ - String this_coevice_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code()); - if (StrUtil.isEmpty(this_coevice_code)) { - List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code); - RouteLineDto routeLineDto = shortPathsList.get(0); - - String path = routeLineDto.getPath(); - String type = routeLineDto.getType(); - String[] str = path.split("->"); - if (!StrUtil.equals(type, "0")) { - return false; - } - List pathlist = Arrays.asList(str); - int index = 0; - for (int m = 0; m < pathlist.size(); m++) { - if (pathlist.get(m).equals(start_device_code)) { - index = m + 1; - break; - } - } - next_device_code = pathlist.get(index); - } else { - next_device_code = this_coevice_code; - } - //校验路由关系 - List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); - if (ObjectUtils.isEmpty(shortPathsList)) { - throw new RuntimeException("路由不通!"); - } - - Device startdevice = deviceAppservice.findDeviceByCode(start_device_code); - Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code); - String next_point_code; - if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) { - next_point_code = task.getTo_x() + "-" + task.getTo_y() + "-" + task.getTo_z(); - } else { - next_point_code = next_device_code; - } - Instruction instdto = new Instruction(); - instdto.setInstruction_id(IdUtil.simpleUUID()); - instdto.setRoute_plan_code(route_plan_code); - instdto.setRemark(task.getRemark()); - instdto.setMaterial(task.getMaterial()); - instdto.setQuantity(task.getQuantity()); - instdto.setTask_id(taskid); - instdto.setTask_code(taskcode); - instdto.setVehicle_code(vehiclecode); - String now = DateUtil.now(); - instdto.setCreate_time(now); - instdto.setCreate_by("auto"); - instdto.setStart_device_code(start_device_code); - instdto.setNext_device_code(next_device_code); - instdto.setStart_point_code(start_point_code); - instdto.setNext_point_code(next_point_code); - instdto.setPriority(priority); - instdto.setInstruction_status("0"); - instdto.setExecute_device_code(start_point_code); - instructionService.create(instdto); - //创建指令后修改任务状态 - task.setTask_status("1"); - taskserver.update(task); - requireSucess = true; - } - return true; - } - } - - protected void thingToNothing() { - - } - - public void writing(int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - } - - public void writing(int type, int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (type == 1) { - itemMap.put(to_command, command); - log.info("设备:" + device_code + ",下发PLC信号" + to_command + ",value:" + command); - } else if (type == 2) { - itemMap.put(to_target, command); - log.info("设备:" + device_code + ",下发PLC信号" + to_target + ",value:" + command); - - } else if (type == 3) { - itemMap.put(to_task, command); - log.info("设备:" + device_code + ",下发PLC信号" + to_task + ",value:" + command); - } - - ReadUtil.write(itemMap, server); - } -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/ItemProtocol.java deleted file mode 100644 index 9fde67b..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/ItemProtocol.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.nl.acs.device_driver.basedriver.cargo_lift_conveyor; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; - -import java.util.ArrayList; -import java.util.List; - -@Slf4j -@Data -public class ItemProtocol { - - public static String item_heartbeat = "heartbeat"; - public static String item_mode = "mode"; - public static String item_move = "move"; - public static String item_action = "action"; - public static String item_error = "error"; - public static String item_task = "task"; - - - public static String item_to_command = "to_command"; - public static String item_to_target = "to_target"; - public static String item_to_task = "to_task"; - public static String item_to_door = "to_door"; - public static String item_to_floor = "to_floor"; - - - private CargoLiftConveyorDeviceDriver driver; - - public ItemProtocol(CargoLiftConveyorDeviceDriver driver) { - this.driver = driver; - } - - public int getItem_heartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getItem_mode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getItem_move() { - return this.getOpcIntegerValue(item_move); - } - - public int getItem_error() { - return this.getOpcIntegerValue(item_error); - } - - public int getItem_action() { - return this.getOpcIntegerValue(item_action); - } - - public int getItem_task() { - return this.getOpcIntegerValue(item_task); - } - - Boolean isonline; - - public int getOpcIntegerValue(String protocol) { - Integer value = this.driver.getIntegeregerValue(protocol); - if (value == null) { - setIsonline(false); - } else { - setIsonline(true); - return value; - } - return 0; - - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "VW0")); - list.add(new ItemDto(item_mode, "工作模式", "VW2")); - list.add(new ItemDto(item_move, "光电信号", "VW4")); - list.add(new ItemDto(item_action, "取放信号", "VW6")); - list.add(new ItemDto(item_error, "故障", "VW8")); - list.add(new ItemDto(item_task, "任务号", "VD10")); - - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "VW102")); - list.add(new ItemDto(item_to_target, "下发目标站", "VW104")); - list.add(new ItemDto(item_to_task, "任务号", "VD108")); - list.add(new ItemDto(item_to_door, "门", "VD112")); - list.add(new ItemDto(item_to_floor, "楼层", "VD114")); - return list; - } - - -} - diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDefination.java deleted file mode 100644 index a5e78fc..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDefination.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position; - -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceType; -import org.springframework.stereotype.Service; - -import java.util.LinkedList; -import java.util.List; - -/** - * 空托盘叠盘位 - */ -@Service -public class EmptyVehicleStackingPositionDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "empty_vehicle_stacking_position"; - } - - @Override - public String getDriverName() { - return "永裕叠盘位smart200"; - } - - @Override - public String getDriverDescription() { - return "永裕叠盘位smart200"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new EmptyVehicleStackingPositionDeviceDriver()).setDevice(device).setDriverDefination(this); - } - - @Override - public Class getDeviceDriverType() { - return EmptyVehicleStackingPositionDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.conveyor); - return types; - } - - @Override - public List getReadableItemDtos() { - return ItemProtocol.getReadableItemDtos(); - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java deleted file mode 100644 index 8fdbcd6..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/EmptyVehicleStackingPositionDeviceDriver.java +++ /dev/null @@ -1,194 +0,0 @@ -package org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position; - -import lombok.Data; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.agv.server.AgvService; -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.RouteableDeviceDriver; -import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; -import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -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.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.task.service.TaskService; -import org.nl.modules.system.service.ParamService; -import org.nl.modules.wql.util.SpringContextHolder; -import org.openscada.opc.lib.da.Server; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 空托盘叠盘位 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class EmptyVehicleStackingPositionDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { - protected ItemProtocol itemProtocol = new ItemProtocol(this); - @Autowired - DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); - @Autowired - InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); - @Autowired - DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class); - @Autowired - TaskService taskserver = SpringContextHolder.getBean(TaskService.class); - @Autowired - RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - @Autowired - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - @Autowired - AgvService agvService = SpringContextHolder.getBean(AgvService.class); - - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; - - int heartbeat = 0; - int mode = 0; - int move = 0; - int error = 0; - int number = 0; - int container_type = 0; - int task = 0; - - Boolean isonline = true; - - Boolean iserror = false; - - //1-执行任务;2-取货完成;3-放货完成; - int flag; - - int last_mode = 0; - int last_move = 0; - int last_error = 0; - - String device_code; - - @Override - public Device getDevice() { - return this.device; - } - - //请求成功标记 - Boolean requireSucess = false; - - @Override - public void execute() { - String message = null; - - device_code = this.getDeviceCode(); - heartbeat = this.itemProtocol.getItem_heartbeat(); - mode = this.itemProtocol.getItem_mode(); - move = this.itemProtocol.getItem_mode(); - error = this.itemProtocol.getItem_error(); - number = this.itemProtocol.getItem_number(); - container_type = this.itemProtocol.getItem_container_type(); - task = this.itemProtocol.getItem_task(); - - - if (mode != last_mode) { - this.setRequireSucess(false); - } - if (move != last_move) { - if (move == 0) { - thingToNothing(); - } - } - if (error != last_error) { - } - - - 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 (flag) { - //取货完成 - case 1: - writing(2); - break; - //放货完成 - case 2: - writing(3); - break; - - } - } - - last_mode = mode; - last_move = move; - last_error = error; - } - - - public synchronized boolean instruction_apply(String container_code) throws Exception { - Date date = new Date(); - if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_apply_time = date; - requireSucess = true; - return true; - } - } - - protected void thingToNothing() { - - } - - public void writing(int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - } - - public void writing(String key, String value) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + key; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, value); - ReadUtil.write(itemMap, server); - } -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/ItemProtocol.java deleted file mode 100644 index adc0f2a..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/empty_vehicle_stacking_position/ItemProtocol.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; - -import java.util.ArrayList; -import java.util.List; - -@Slf4j -@Data -public class ItemProtocol { - - public static String item_heartbeat = "heartbeat"; - public static String item_mode = "mode"; - public static String item_move = "move"; - public static String item_error = "error"; - public static String item_number = "number"; - public static String item_container_type = "container_type"; - public static String item_task = "task"; - - - public static String item_to_command = "to_command"; - public static String item_to_target = "to_target"; - public static String item_to_container_type = "to_container_type"; - public static String item_to_task = "to_task"; - - - private EmptyVehicleStackingPositionDeviceDriver driver; - - public ItemProtocol(EmptyVehicleStackingPositionDeviceDriver driver) { - this.driver = driver; - } - - public int getItem_heartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getItem_mode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getItem_move() { - return this.getOpcIntegerValue(item_move); - } - - public int getItem_error() { - return this.getOpcIntegerValue(item_error); - } - - public int getItem_number() { - return this.getOpcIntegerValue(item_number); - } - - public int getItem_container_type() { - return this.getOpcIntegerValue(item_container_type); - } - - public int getItem_task() { - return this.getOpcIntegerValue(item_task); - } - - Boolean isonline; - - public int getOpcIntegerValue(String protocol) { - Integer value = this.driver.getIntegeregerValue(protocol); - if (value == null) { - setIsonline(false); - } else { - setIsonline(true); - return value; - } - return 0; - - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "VW0")); - list.add(new ItemDto(item_mode, "工作模式", "VW2")); - list.add(new ItemDto(item_move, "光电信号", "VW4")); - list.add(new ItemDto(item_number, "数量", "VW6")); - list.add(new ItemDto(item_container_type, "托盘类型", "VW8")); - list.add(new ItemDto(item_error, "故障", "VW10")); - list.add(new ItemDto(item_task, "任务号", "VD12")); - - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "VW52")); - list.add(new ItemDto(item_to_target , "下发目标站", "VW54")); - list.add(new ItemDto(item_to_task, "任务号", "VD58")); - return list; - } - - -} - diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDefination.java deleted file mode 100644 index f650942..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDefination.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test; - -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceType; -import org.springframework.stereotype.Service; - -import java.util.LinkedList; -import java.util.List; - -/** - * 三工位 - */ -@Service -public class HailiangSmartplcTestDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "hailiang_smart_plc_test"; - } - - @Override - public String getDriverName() { - return "永裕共挤线smart200"; - } - - @Override - public String getDriverDescription() { - return "永裕共挤线smart200"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new HailiangSmartplcTestDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return HailiangSmartplcTestDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.conveyor); - return types; - } - - @Override - public List getReadableItemDtos() { - return ItemProtocol.getReadableItemDtos(); - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java deleted file mode 100644 index 481d7b6..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/HailiangSmartplcTestDeviceDriver.java +++ /dev/null @@ -1,227 +0,0 @@ -package org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test; - -import com.alibaba.fastjson.JSONObject; -import lombok.Data; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.agv.server.AgvService; -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.RouteableDeviceDriver; -import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; -import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -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.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.task.service.TaskService; -import org.nl.modules.system.service.ParamService; -import org.nl.modules.wql.util.SpringContextHolder; -import org.openscada.opc.lib.da.Server; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * 三工位 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class HailiangSmartplcTestDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { - protected ItemProtocol itemProtocol = new ItemProtocol(this); - @Autowired - DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); - @Autowired - InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); - @Autowired - DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class); - @Autowired - TaskService taskserver = SpringContextHolder.getBean(TaskService.class); - @Autowired - RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - @Autowired - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - @Autowired - AgvService agvService = SpringContextHolder.getBean(AgvService.class); - - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; - - int heartbeat = 0; - int mode = 0; - int move = 0; - int action = 0; - int error = 0; - int number = 0; - int container_type = 0; - int task = 0; - - Boolean isonline = true; - - Boolean iserror = false; - - //1-执行任务;2-取货完成;3-放货完成; - int flag; - - int last_mode = 0; - int last_move = 0; - int last_error = 0; - - String device_code; - - @Override - public Device getDevice() { - return this.device; - } - - //请求成功标记 - Boolean requireSucess = false; - - @Override - public void execute() { - String message = null; - - device_code = this.getDeviceCode(); - heartbeat = this.itemProtocol.getItem_heartbeat(); - mode = this.itemProtocol.getItem_mode(); - move = this.itemProtocol.getItem_move(); - action = this.itemProtocol.getItem_action(); - error = this.itemProtocol.getItem_error(); - number = this.itemProtocol.getItem_number(); - container_type = this.itemProtocol.getItem_container_type(); - task = this.itemProtocol.getItem_task(); - - - if (mode != last_mode) { - this.setRequireSucess(false); - } - if (move != last_move) { - if (move == 0) { - thingToNothing(); - } - } - if (error != last_error) { - } - - - 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); - JSONObject jo = new JSONObject(); - switch (mode) { - case 1: - log.debug("设备运转模式:等待工作"); - break; - case 4: - //申请空盘 - if (move == 0 && !requireSucess) { - 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 { - //向LMS发送请求,发送终点和托盘类型 - jo.put("type", "1"); - jo.put("point_code", device_code); - jo.put("vehicle_num", "1"); - jo.put("vehicle_type", container_type); - String result = acsToWmsService.applyTaskToWms(jo); - JSONObject res_jo = JSONObject.parseObject(result); - if (res_jo.getString("status").equals("200")){ - requireSucess = true; - } - } - } - break; - case 5: - //满托入库 - if (move == 1 && !requireSucess) { - 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 { - //向LMS发送请求,发送起点 - jo.put("type", "2"); - jo.put("point_code", device_code); - jo.put("vehicle_num", "1"); - jo.put("vehicle_type", container_type); - jo.put("qty", number); - String result = acsToWmsService.applyTaskToWms(jo); - JSONObject res_jo = JSONObject.parseObject(result); - if (res_jo.getString("status").equals("200")){ - requireSucess = true; - } - } - } - break; - } - switch (flag) { - //取货完成 - case 1: - writing(2); - break; - //放货完成 - case 2: - writing(3); - break; - - } - } - - last_mode = mode; - last_move = move; - last_error = error; - } - - - protected void thingToNothing() { - - } - - public void writing(int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - } - - public void writing(String key, String value) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + key; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, value); - ReadUtil.write(itemMap, server); - } -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/ItemProtocol.java deleted file mode 100644 index 4ecd889..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hailiang_smart_plc_test/ItemProtocol.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.nl.acs.device_driver.basedriver.hailiang_smart_plc_test; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; - -import java.util.ArrayList; -import java.util.List; - -@Slf4j -@Data -public class ItemProtocol { - - public static String item_heartbeat = "heartbeat"; - public static String item_mode = "mode"; - public static String item_move = "move"; - public static String item_action = "action"; - public static String item_error = "error"; - public static String item_number = "number"; - public static String item_container_type = "container_type"; - public static String item_task = "task"; - - - public static String item_to_target = "to_target";// - public static String item_to_command = "to_command";// - public static String item_to_task = "to_task";// - - - private HailiangSmartplcTestDeviceDriver driver; - - public ItemProtocol(HailiangSmartplcTestDeviceDriver driver) { - this.driver = driver; - } - - public int getItem_heartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getItem_mode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getItem_move() { - return this.getOpcIntegerValue(item_move); - } - - public int getItem_action() { - return this.getOpcIntegerValue(item_action); - } - - public int getItem_error() { - return this.getOpcIntegerValue(item_error); - } - - public int getItem_number() { - return this.getOpcIntegerValue(item_number); - } - - public int getItem_container_type() { - return this.getOpcIntegerValue(item_container_type); - } - - public int getItem_task() { - return this.getOpcIntegerValue(item_task); - } - - Boolean isonline; - - public int getOpcIntegerValue(String protocol) { - Integer value = this.driver.getIntegeregerValue(protocol); - if (value == null) { - setIsonline(false); - } else { - setIsonline(true); - return value; - } - return 0; - - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "VW0")); - list.add(new ItemDto(item_mode, "模式", "VW2")); - list.add(new ItemDto(item_move, "光电信号", "VW4")); - list.add(new ItemDto(item_action, "取放信号", "VW6")); - list.add(new ItemDto(item_error, "故障", "VW8")); - list.add(new ItemDto(item_number, "数量", "VW10")); - list.add(new ItemDto(item_container_type, "托盘类型", "VW12")); - list.add(new ItemDto(item_task, "任务号", "VD14")); - - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "VW102")); - list.add(new ItemDto(item_to_target , "下发目标站", "VW104")); - list.add(new ItemDto(item_to_task, "任务号", "VD108")); - return list; - } - - -} - diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/HaoKaiAutoConveyorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/HaoKaiAutoConveyorDefination.java deleted file mode 100644 index b9e1141..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/HaoKaiAutoConveyorDefination.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.nl.acs.device_driver.basedriver.haokai_auto_conveyor; - -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceType; -import org.springframework.stereotype.Service; - -import java.util.LinkedList; -import java.util.List; - -/** - * 豪凯自动对接线 - */ -@Service -public class HaoKaiAutoConveyorDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "haokai_auto_conveyor"; - } - - @Override - public String getDriverName() { - return "豪凯自动线对接位"; - } - - @Override - public String getDriverDescription() { - return "豪凯自动线对接位"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new HaoKaiAutoConveyorDeviceDriver()).setDevice(device).setDriverDefination(this); - } - - @Override - public Class getDeviceDriverType() { - return HaoKaiAutoConveyorDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.conveyor); - return types; - } - - @Override - public List getReadableItemDtos() { - return ItemProtocol.getReadableItemDtos(); - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/HaoKaiAutoConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/HaoKaiAutoConveyorDeviceDriver.java deleted file mode 100644 index e1a086c..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/HaoKaiAutoConveyorDeviceDriver.java +++ /dev/null @@ -1,236 +0,0 @@ -package org.nl.acs.device_driver.basedriver.haokai_auto_conveyor; - -import cn.hutool.core.util.ObjectUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import lombok.Data; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.agv.server.AgvService; -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.RouteableDeviceDriver; -import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; -import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -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.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.task.service.TaskService; -import org.nl.modules.system.service.ParamService; -import org.nl.modules.wql.util.SpringContextHolder; -import org.openscada.opc.lib.da.Server; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 豪凯自动对接线 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class HaoKaiAutoConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { - protected ItemProtocol itemProtocol = new ItemProtocol(this); - @Autowired - DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); - @Autowired - InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); - @Autowired - DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class); - @Autowired - TaskService taskserver = SpringContextHolder.getBean(TaskService.class); - @Autowired - RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - @Autowired - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - @Autowired - AgvService agvService = SpringContextHolder.getBean(AgvService.class); - - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; - - int heartbeat = 0; - int mode = 0; - int move = 0; - int action = 0; - int error = 0; - int task = 0; - - Boolean isonline = true; - - Boolean iserror = false; - - //1-执行任务;2-取货完成;3-放货完成; - int flag; - - int last_mode = 0; - int last_move = 0; - int last_error = 0; - - String device_code; - - @Override - public Device getDevice() { - return this.device; - } - - //请求成功标记 - Boolean requireSucess = false; - - @Override - public void execute() { - String message = null; - - device_code = this.getDeviceCode(); - heartbeat = this.itemProtocol.getItem_heartbeat(); - mode = this.itemProtocol.getItem_mode(); - move = this.itemProtocol.getItem_mode(); - error = this.itemProtocol.getItem_error(); - task = this.itemProtocol.getItem_task(); - action = this.itemProtocol.getItem_action(); - - - if (mode != last_mode) { - this.setRequireSucess(false); - } - if (move != last_move) { - if (move == 0) { - thingToNothing(); - } - } - if (error != last_error) { - } - - - 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: - //申请任务 - if (move > 0 && !requireSucess) { - message = "申请任务中..."; - JSONObject apply = new JSONObject(); - apply.put("type","8"); - apply.put("point_code",device_code); - String str = acsToWmsService.applyTaskToWms(apply); - JSONObject jo = JSON.parseObject(str); - if (ObjectUtil.isEmpty(jo)) { - message = "接口不通"; - } else { - if (jo.getInteger("status") == 200) { - requireSucess = true; - } else { - requireSucess = false; - message = jo.get("message").toString(); - } - } - } - - } - switch (flag) { - //取货完成 - case 1: - writing(2); - break; - //放货完成 - case 2: - writing(3); - break; - - } - } - - last_mode = mode; - last_move = move; - last_error = error; - } - - - public synchronized boolean instruction_apply(String container_code) throws Exception { - Date date = new Date(); - if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_apply_time = date; - requireSucess = true; - return true; - } - } - - protected void thingToNothing() { - this.setRequireSucess(false); - } - - public void writing(int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - } - - public void writing(int type, int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_task; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (type == 1) { - itemMap.put(to_command, command); - log.info("设备:" + device_code + ",下发PLC信号" + to_command + ",value:" + command); - } else if (type == 2) { - itemMap.put(to_target, command); - log.info("设备:" + device_code + ",下发PLC信号" + to_target + ",value:" + command); - - } else if (type == 3) { - itemMap.put(to_task, command); - log.info("设备:" + device_code + ",下发PLC信号" + to_task + ",value:" + command); - } - - ReadUtil.write(itemMap, server); - } -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/ItemProtocol.java deleted file mode 100644 index 8478d0d..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/haokai_auto_conveyor/ItemProtocol.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.nl.acs.device_driver.basedriver.haokai_auto_conveyor; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; - -import java.util.ArrayList; -import java.util.List; - -@Slf4j -@Data -public class ItemProtocol { - - public static String item_heartbeat = "heartbeat"; - public static String item_mode = "mode"; - public static String item_move = "move"; - public static String item_action = "action"; - public static String item_error = "error"; - public static String item_task = "task"; - - - public static String item_to_command = "to_command"; - public static String item_to_target = "to_target"; - public static String item_to_task = "to_task"; - - - private HaoKaiAutoConveyorDeviceDriver driver; - - public ItemProtocol(HaoKaiAutoConveyorDeviceDriver driver) { - this.driver = driver; - } - - public int getItem_heartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getItem_mode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getItem_move() { - return this.getOpcIntegerValue(item_move); - } - - public int getItem_error() { - return this.getOpcIntegerValue(item_error); - } - - public int getItem_action() { - return this.getOpcIntegerValue(item_action); - } - - public int getItem_task() { - return this.getOpcIntegerValue(item_task); - } - - Boolean isonline; - - public int getOpcIntegerValue(String protocol) { - Integer value = this.driver.getIntegeregerValue(protocol); - if (value == null) { - setIsonline(false); - } else { - setIsonline(true); - return value; - } - return 0; - - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "VW0")); - list.add(new ItemDto(item_mode, "工作模式", "VW2")); - list.add(new ItemDto(item_move, "光电信号", "VW4")); - list.add(new ItemDto(item_action, "取放信号", "VW6")); - list.add(new ItemDto(item_error, "故障", "VW8")); - list.add(new ItemDto(item_task, "任务号", "VD10")); - - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "VW102")); - list.add(new ItemDto(item_to_target, "下发目标站", "VW104")); - list.add(new ItemDto(item_to_task, "任务号", "VD108")); - return list; - } - - -} - diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/ItemProtocol.java deleted file mode 100644 index 8707e77..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/ItemProtocol.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.nl.acs.device_driver.basedriver.paint_conveyor; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; - -import java.util.ArrayList; -import java.util.List; - -@Slf4j -@Data -public class ItemProtocol { - - public static String item_heartbeat = "heartbeat"; - public static String item_mode = "mode"; - public static String item_move = "move"; - public static String item_action = "action"; - public static String item_error = "error"; - public static String item_number = "number"; - public static String item_task = "task"; - - - public static String item_to_target = "to_target";// - public static String item_to_command = "to_command";// - public static String item_to_task = "to_task";// - - - private PaintConveyorDeviceDriver driver; - - public ItemProtocol(PaintConveyorDeviceDriver driver) { - this.driver = driver; - } - - public int getItem_heartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getItem_mode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getItem_move() { - return this.getOpcIntegerValue(item_move); - } - - public int getItem_action() { - return this.getOpcIntegerValue(item_action); - } - - public int getItem_error() { - return this.getOpcIntegerValue(item_error); - } - - public int getItem_number() { - return this.getOpcIntegerValue(item_number); - } - - public int getItem_task() { - return this.getOpcIntegerValue(item_task); - } - - Boolean isonline; - - public int getOpcIntegerValue(String protocol) { - Integer value = this.driver.getIntegeregerValue(protocol); - if (value == null) { - setIsonline(false); - } else { - setIsonline(true); - return value; - } - return 0; - - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "D0000000")); - list.add(new ItemDto(item_mode, "模式", "D0000004")); - list.add(new ItemDto(item_move, "光电信号", "D0000008")); - list.add(new ItemDto(item_action, "取放信号", "D0000012")); - list.add(new ItemDto(item_error, "故障", "D0000016")); - list.add(new ItemDto(item_number, "数量", "D0000020")); - list.add(new ItemDto(item_task, "任务号", "D0000024")); - - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "D00000102")); - list.add(new ItemDto(item_to_target , "下发目标站", "D00000106")); - list.add(new ItemDto(item_to_task, "任务号", "D00000110")); - return list; - } - - -} - diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDefination.java deleted file mode 100644 index 322e715..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDefination.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.nl.acs.device_driver.basedriver.paint_conveyor; - -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceType; -import org.springframework.stereotype.Service; - -import java.util.LinkedList; -import java.util.List; - -/** - * 油漆线 - */ -@Service -public class PaintConveyorDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "paint_conveyor"; - } - - @Override - public String getDriverName() { - return "油漆线"; - } - - @Override - public String getDriverDescription() { - return "油漆线"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new PaintConveyorDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return PaintConveyorDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.conveyor); - return types; - } - - @Override - public List getReadableItemDtos() { - return ItemProtocol.getReadableItemDtos(); - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDeviceDriver.java deleted file mode 100644 index 9ad35d0..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paint_conveyor/PaintConveyorDeviceDriver.java +++ /dev/null @@ -1,260 +0,0 @@ -package org.nl.acs.device_driver.basedriver.paint_conveyor; - -import com.alibaba.fastjson.JSONObject; -import lombok.Data; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.agv.server.AgvService; -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.RouteableDeviceDriver; -import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; -import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -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.log.service.DeviceExecuteLogService; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.task.service.TaskService; -import org.nl.modules.system.service.ParamService; -import org.nl.modules.wql.util.SpringContextHolder; -import org.openscada.opc.lib.da.Server; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * 油漆线 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class PaintConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { - protected ItemProtocol itemProtocol = new ItemProtocol(this); - @Autowired - DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); - @Autowired - InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); - @Autowired - DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class); - @Autowired - TaskService taskserver = SpringContextHolder.getBean(TaskService.class); - @Autowired - RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - @Autowired - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - @Autowired - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); - @Autowired - AgvService agvService = SpringContextHolder.getBean(AgvService.class); - - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; - - int heartbeat = 0; - int mode = 0; - int move = 0; - int action = 0; - int error = 0; - int number = 0; - int task = 0; - - Boolean isonline = true; - - Boolean iserror = false; - - //1-执行任务;2-取货完成;3-放货完成; - int flag; - - int last_mode = 0; - int last_move = 0; - int last_error = 0; - - String device_code; - - @Override - public Device getDevice() { - return this.device; - } - - //请求成功标记 - Boolean requireSucess = false; - - @Override - public void execute() { - String message = null; - - device_code = this.getDeviceCode(); - heartbeat = this.itemProtocol.getItem_heartbeat(); - mode = this.itemProtocol.getItem_mode(); - move = this.itemProtocol.getItem_move(); - action = this.itemProtocol.getItem_action(); - error = this.itemProtocol.getItem_error(); - number = this.itemProtocol.getItem_number(); - task = this.itemProtocol.getItem_task(); - - - if (mode != last_mode) { - this.setRequireSucess(false); - } - if (move != last_move) { - if (move == 0) { - thingToNothing(); - } - } - if (error != last_error) { - } - - - 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); - JSONObject jo = new JSONObject(); - switch (mode) { - case 1: - log.debug("设备运转模式:等待工作"); - break; - case 5: - //下料位申请空盘 - if (move == 0 && !requireSucess) { - //向LMS发送请求,发送终点和托盘类型 - jo.put("type","3"); - jo.put("point_code",device_code); - jo.put("vehicle_num","10"); - String result = acsToWmsService.applyTaskToWms(jo); - JSONObject res_jo = JSONObject.parseObject(result); - if (res_jo.getString("status").equals("200")){ - requireSucess = true; - } - } - case 6: - //下料位满拖申请 - if (move == 1 && !requireSucess) { - //向LMS发送请求,发送起点 - jo.put("type","7"); - jo.put("point_code",device_code); - String result = acsToWmsService.applyTaskToWms(jo); - JSONObject res_jo = JSONObject.parseObject(result); - if (res_jo.getString("status").equals("200")){ - requireSucess = true; - } - } - case 7: - //上料位满拖申请 - if (move == 0 && !requireSucess) { - //向LMS发送请求,发送起点 - jo.put("type","4"); - jo.put("point_code",device_code); - String result = acsToWmsService.applyTaskToWms(jo); - JSONObject res_jo = JSONObject.parseObject(result); - if (res_jo.getString("status").equals("200")){ - requireSucess = true; - } - } - break; - case 8: - if (move == 1 && !requireSucess) { - //上料位空托入库 - jo.put("type", "5"); - jo.put("point_code", device_code); - jo.put("vehicle_num", number); - String result = acsToWmsService.applyTaskToWms(jo); - JSONObject res_jo = JSONObject.parseObject(result); - if (res_jo.getString("status").equals("200")){ - requireSucess = true; - } - break; - } - case 9: - if (move == 1 && !requireSucess) { - //强制满垛入库 - jo.put("type", "5"); - jo.put("point_code", device_code); - jo.put("vehicle_num", number); - String result = acsToWmsService.applyTaskToWms(jo); - JSONObject res_jo = JSONObject.parseObject(result); - if (res_jo.getString("status").equals("200")){ - requireSucess = true; - } - break; - } - } - switch (flag) { - //取货完成 - case 1: - writing(2); - break; - //放货完成 - case 2: - writing(3); - break; - - } - } - - last_mode = mode; - last_move = move; - last_error = error; - } - - - public synchronized boolean instruction_apply(String container_code) throws Exception { - Date date = new Date(); - if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_apply_time = date; - requireSucess = true; - return true; - } - } - - protected void thingToNothing() { - - } - - public void writing(int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - } - - public void writing(String key, String value) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + key; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, value); - ReadUtil.write(itemMap, server); - } -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/ItemProtocol.java deleted file mode 100644 index e33c7e1..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/ItemProtocol.java +++ /dev/null @@ -1,121 +0,0 @@ -package org.nl.acs.device_driver.basedriver.standard_conveyor_control; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; - -import java.util.ArrayList; -import java.util.List; - -@Slf4j -@Data -public class ItemProtocol { - - public static String item_heartbeat = "heartbeat"; - public static String item_mode = "mode"; - public static String item_move = "move"; - public static String item_action = "action"; - public static String item_ioaction = "ioaction"; - public static String item_height = "height"; - public static String item_error = "error"; - public static String item_direction = "direction"; - public static String item_operation_type = "operation_type"; - public static String item_task = "task"; - - public static String item_to_command = "to_command"; - public static String item_to_target = "to_target"; - public static String item_to_task = "to_task"; - public static String item_weight = "weight"; - - private StandardCoveyorControlDeviceDriver driver; - - public ItemProtocol(StandardCoveyorControlDeviceDriver driver) { - this.driver = driver; - } - - public int getHeartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getMode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getMove() { - return this.getOpcIntegerValue(item_move); - } - - public int getAction() { - return this.getOpcIntegerValue(item_action); - } - - public int getError() { - return this.getOpcIntegerValue(item_error); - } - - public int getOperation_type() { - return this.getOpcIntegerValue(item_operation_type); - } - - public int getTask() { - return this.getOpcIntegerValue(item_task); - } - - public int getToCommand() { - return this.getOpcIntegerValue(item_to_command); - } - - public int getToTarget() { - return this.getOpcIntegerValue(item_to_target); - } - - public int getToTask() { - return this.getOpcIntegerValue(item_to_task); - } - - - //是否有货 - public int hasGoods(int move) { - return move; - } - - Boolean isonline; - - 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); - return value; - } - return 0; - - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); - list.add(new ItemDto(item_mode, "工作状态", "DB600.B1", Boolean.valueOf(true))); - list.add(new ItemDto(item_move, "光电开关信号", "DB600.B2")); - list.add(new ItemDto(item_action, "取放信号", "DB600.B3")); - list.add(new ItemDto(item_ioaction, "进出类型", "DB600.B4")); - list.add(new ItemDto(item_height, "高度类型", "DB600.B5")); - list.add(new ItemDto(item_error, "报警信号", "DB600.B6")); - list.add(new ItemDto(item_direction, "电机方向", "DB600.B7")); - list.add(new ItemDto(item_operation_type, "作业类型", "DB600.B8")); - list.add(new ItemDto(item_task, "任务号", "DB600.D22")); - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "作业命令", "DB601.W2", Boolean.valueOf(true))); - list.add(new ItemDto(item_to_target, "目标站", "DB601.W4")); - list.add(new ItemDto(item_to_task, "任务号", "DB601.D8")); - return list; - } - -} - diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardConveyorControlDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardConveyorControlDefination.java deleted file mode 100644 index f8a8cdd..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardConveyorControlDefination.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.nl.acs.device_driver.basedriver.standard_conveyor_control; - -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceType; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -/** - * 检测站点驱动定义 - * 说明:该站点为普通带光电检测站点 - */ -@Service -public class StandardConveyorControlDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "standard_conveyor_control"; - } - - @Override - public String getDriverName() { - return "标准版-输送机-控制点"; - } - - @Override - public String getDriverDescription() { - return "标准版-输送机-控制点"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new StandardCoveyorControlDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return StandardCoveyorControlDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.conveyor); - return types; - } - - @Override - public List getReadableItemDtos() { - return ItemProtocol.getReadableItemDtos(); - } - - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java deleted file mode 100644 index 0d69401..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java +++ /dev/null @@ -1,438 +0,0 @@ -package org.nl.acs.device_driver.basedriver.standard_conveyor_control; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSONObject; -import lombok.Data; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -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.RouteableDeviceDriver; -import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; -import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -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.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.opc.WcsConfig; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.route.service.dto.RouteLineDto; -import org.nl.acs.task.service.TaskService; -import org.nl.acs.task.service.dto.TaskDto; -import org.nl.modules.system.service.ParamService; -import org.nl.modules.system.util.CodeUtil; -import org.nl.modules.wql.core.bean.WQLObject; -import org.nl.modules.wql.util.SpringContextHolder; -import org.openscada.opc.lib.da.Server; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 输送机-控制点驱动 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { - protected ItemProtocol itemProtocol = new ItemProtocol(this); - @Autowired - DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); - @Autowired - InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); - @Autowired - DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); - @Autowired - RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl"); - @Autowired - TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); - @Autowired - RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); - @Autowired - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - String container; - String container_type_desc; - String last_container_type_desc; - String last_container; - //放货准备锁 - String putReadyLock = null; - //有货标记 - protected boolean has_goods_tag = false; - - int mode = 0; - int error = 0; - int move = 0; - int task = 0; - //出入库模式 - int operation_type = 0; - int last_mode = 0; - int last_error = 0; - int last_move = 0; - int last_task = 0; - - Boolean isonline = true; - int hasGoods = 0; - String message = null; - Boolean iserror = false; - - - boolean hasVehicle = false; - boolean isReady = false; - protected int instruction_num = 0; - protected int instruction_num_truth = 0; - boolean isFold = false; - private String assemble_check_tag; - - protected String current_stage_instruction_message; - protected String last_stage_instruction_message; - Integer heartbeat_tag; - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; - //请求成功标记 - Boolean requireSucess = false; - //申请指令成功标记 - Boolean applySucess = false; - String inst_message; - - private int instruction_finished_time_out; - - int branchProtocol = 0; - //备注 - String remark; - //数量 - String qty; - //物料 - String material; - //当前指令 - Instruction inst = null; - //上次指令 - Instruction last_inst = null; - - //触摸屏手动触发任务 - private Boolean is_has_task = false; - - //申请搬运任务 - private Boolean apply_handling = false; - //申请物料 - private Boolean apply_material = false; - - //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 - int flag = 0; - - String device_code; - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() throws Exception { - String message = null; - try { - device_code = this.getDeviceCode(); - mode = this.itemProtocol.getMode(); - error = this.itemProtocol.getError(); - move = this.itemProtocol.getMove(); - task = this.itemProtocol.getTask(); - hasGoods = this.itemProtocol.getMove(); - operation_type = this.itemProtocol.getOperation_type(); - if (mode != last_mode) { - } - if (move != last_move) { - if (move == 0) { - thingToNothing(); - } - this.setRequireSucess(false); - - } - if (error != last_error) { - } - - if (mode == 2 && move != 0 && task > 0) { - //inst_message - inst = instructionService.findByCodeFromCache(String.valueOf(task)); - if (inst != null) { - inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code(); - if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { - finish_instruction(); - } - if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) { - inst.setInstruction_status("1"); - instructionService.update(inst); - } - } - } - } catch (Exception var17) { - return; - } - - 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: - //申请任务 - if (!StrUtil.isEmpty(material) && !StrUtil.isEmpty(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) { - this.instruction_require(container); - } - break; - case 3: - - break; - case 4: - //叫料 - - break; - case 5: - //申请空盘 - if (move == 0 && !requireSucess) { - apply_OutEmpty(); - } - break; - case 6: - //申请入库 - if (move != 0 && !applySucess) { - instruction_apply(); - } - if (move != 0 && !requireSucess) { - apply_InEmpty(); - } - break; - } - - - switch (flag) { - //取货完成 - case 1: - writing(2); - break; - //放货完成 - case 2: - writing(3); - break; - - } - - } - last_mode = mode; - last_error = error; - last_move = move; - last_task = task; - } - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - protected void thingToNothing() { - log.debug("从有货到无货 清理数据"); - this.setRequireSucess(false); - this.setApplySucess(false); - this.set_last_container(container, container_type_desc); - } - - public void set_last_container(String barcode, String type_desc) { - this.setInst_message(null); - this.setContainer(null); - this.set_last_container(barcode); - this.set_last_container_type_desc(type_desc); - } - - public void set_last_container(String barcode) { - } - - public void set_last_container_type_desc(String type) { - } - - - public boolean exe_business() { - return true; - } - - protected void executing(Instruction instruction) { - this.executing(1, instruction, ""); - } - - public void executing(int command, Instruction instruction, String appendMessage) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - if (appendMessage == null) { - appendMessage = ""; - } - if (instruction != null) { - instruction_num = Integer.parseInt(instruction.getInstruction_code()); - } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, 1); - itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); - - } - - public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); - } - - public void writing(int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - - } - - public void writing(int command, int target, int task) { - - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_task; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - itemMap.put(to_target, target); - itemMap.put(to_task, task); - ReadUtil.write(itemMap, server); - } - - public void writing(int type, int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (type == 1) { - itemMap.put(to_command, command); - } else if (type == 2) { - itemMap.put(to_target, command); - - } else if (type == 3) { - itemMap.put(to_task, command); - } - ReadUtil.write(itemMap, server); - - } - - public boolean instruction_apply() throws Exception { - return false; - } - - public boolean instruction_require(String container_code) { - return instruction_require(container_code, WcsConfig.task_container_type_default_desc); - } - - /** - * 请求指令 - * - * @param container_code - * @param container_type - */ - public synchronized boolean instruction_require(String container_code, String container_type) { - Date date = new Date(); - if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_require_time = date; - TaskDto dto = new TaskDto(); - String now = DateUtil.now(); - dto.setTask_id(IdUtil.simpleUUID()); - dto.setCreate_by(this.getDevice().getDevice_code()); - dto.setUpdate_by(this.getDevice().getDevice_code()); - dto.setStart_point_code(this.getDevice().getDevice_code()); - dto.setVehicle_code(container_code); - dto.setVehicle_type(container_type); - - String taskcode = CodeUtil.getNewCode("TASK_NO"); - dto.setTask_code("-" + taskcode); - dto.setTask_status("0"); - dto.setPriority("101"); - RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code()); - String next_device_codecode = jo.getNext_device_code(); - if (StrUtil.isEmpty(next_device_codecode)) { - throw new RuntimeException("该设备未找到对应路由"); - } - dto.setNext_point_code(next_device_codecode); - dto.setUpdate_time(now); - dto.setCreate_time(now); - - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = (JSONObject) JSONObject.toJSON(dto); - - wo.insert(json); - requireSucess = false; - return true; - } - } - - - public synchronized boolean finish_instruction() throws Exception { - instructionService.finish(inst); - return true; - } - - public void apply_OutEmpty() { - - } - - public synchronized boolean apply_InEmpty() throws Exception { - return false; - } -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java deleted file mode 100644 index f39ffe3..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/ItemProtocol.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; - -import java.util.ArrayList; -import java.util.List; - -@Slf4j -@Data -public class ItemProtocol { - - public static String item_heartbeat = "heartbeat"; - public static String item_mode = "mode"; - public static String item_move = "move"; - public static String item_action = "action"; - public static String item_error = "error"; - public static String item_task = "task"; - - - public static String item_to_command = "to_command"; - public static String item_to_target = "to_target"; - public static String item_to_task = "to_task"; - public static String item_to_door = "to_door"; - public static String item_to_floor = "to_floor"; - - - private StandardCoveyorControlWithScannerDeviceDriver driver; - - public ItemProtocol(StandardCoveyorControlWithScannerDeviceDriver driver) { - this.driver = driver; - } - - public int getItem_heartbeat() { - return this.getOpcIntegerValue(item_heartbeat); - } - - public int getItem_mode() { - return this.getOpcIntegerValue(item_mode); - } - - public int getItem_move() { - return this.getOpcIntegerValue(item_move); - } - - public int getItem_error() { - return this.getOpcIntegerValue(item_error); - } - - public int getItem_action() { - return this.getOpcIntegerValue(item_action); - } - - public int getItem_task() { - return this.getOpcIntegerValue(item_task); - } - - Boolean isonline; - - public int getOpcIntegerValue(String protocol) { - Integer value = this.driver.getIntegeregerValue(protocol); - if (value == null) { - setIsonline(false); - } else { - setIsonline(true); - return value; - } - return 0; - - } - - public static List getReadableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "VW0")); - list.add(new ItemDto(item_mode, "工作模式", "VW2")); - list.add(new ItemDto(item_move, "光电信号", "VW4")); - list.add(new ItemDto(item_action, "取放信号", "VW6")); - list.add(new ItemDto(item_error, "故障", "VW8")); - list.add(new ItemDto(item_task, "任务号", "VD10")); - - return list; - } - - public static List getWriteableItemDtos() { - ArrayList list = new ArrayList(); - list.add(new ItemDto(item_to_command, "下发命令", "VW102")); - list.add(new ItemDto(item_to_target, "下发目标站", "VW104")); - list.add(new ItemDto(item_to_task, "任务号", "VD108")); - list.add(new ItemDto(item_to_door, "门", "VD112")); - list.add(new ItemDto(item_to_floor, "楼层", "VD114")); - return list; - } - - -} - diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardConveyorControlWithScannerDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardConveyorControlWithScannerDefination.java deleted file mode 100644 index c95e518..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardConveyorControlWithScannerDefination.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner; - -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceType; -import org.springframework.stereotype.Service; - -import java.util.LinkedList; -import java.util.List; - -/** - * 检测站点驱动定义 - * 说明:该站点为普通带光电检测站点 - */ -@Service -public class StandardConveyorControlWithScannerDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "standard_conveyor_control_with_scanner"; - } - - @Override - public String getDriverName() { - return "货梯对接线-关联扫码器"; - } - - @Override - public String getDriverDescription() { - return "货梯对接线-关联扫码器"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new StandardCoveyorControlWithScannerDeviceDriver()).setDevice(device).setDriverDefination(this); - - } - - @Override - public Class getDeviceDriverType() { - return StandardCoveyorControlWithScannerDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.conveyor); - return types; - } - - @Override - public List getReadableItemDtos() { - return ItemProtocol.getReadableItemDtos(); - } - - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardConveyorWithScannerConfig.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardConveyorWithScannerConfig.java deleted file mode 100644 index ebc1f60..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardConveyorWithScannerConfig.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner; - -public class StandardConveyorWithScannerConfig { - public static String relation_scanner = "link_scanner"; - public static String ignoreInstructionCheck = "ignoreInstructionCheck"; - public static String empty_tray_in = "emptyTrayIn"; - public static String empty_tray_out = "emptyTrayOut"; - public static String execute_time_out = "executeTimeOut"; - - public StandardConveyorWithScannerConfig() { - } -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java deleted file mode 100644 index c2af26a..0000000 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ /dev/null @@ -1,615 +0,0 @@ -package org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner; - -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import lombok.Data; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.ObjectUtils; -import org.nl.acs.AcsConfig; -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.RouteableDeviceDriver; -import org.nl.acs.device_driver.ScannerDeviceDriver; -import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; -import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -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.monitor.DeviceStageMonitor; -import org.nl.acs.opc.Device; -import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.opc.WcsConfig; -import org.nl.acs.route.service.RouteLineService; -import org.nl.acs.route.service.dto.RouteLineDto; -import org.nl.acs.task.service.TaskService; -import org.nl.acs.task.service.dto.TaskDto; -import org.nl.modules.system.service.ParamService; -import org.nl.modules.wql.core.bean.WQLObject; -import org.nl.modules.wql.util.SpringContextHolder; -import org.openscada.opc.lib.da.Server; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.*; - -/** - * 输送机控制点-带扫描驱动 - */ -@Slf4j -@Data -@RequiredArgsConstructor -public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { - protected ItemProtocol itemProtocol = new ItemProtocol(this); - @Autowired - InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); - @Autowired - DeviceService deviceservice = SpringContextHolder.getBean(DeviceService.class); - @Autowired - RouteLineService routelineserver = SpringContextHolder.getBean(RouteLineService.class); - @Autowired - TaskService taskserver = SpringContextHolder.getBean(TaskService.class); - @Autowired - DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); - @Autowired - RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class); - @Autowired - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - - @Autowired - AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class); - - String container; - - protected String barcode = null; - protected String formatcode = null; - - private Date instruction_require_time = new Date(); - private Date instruction_finished_time = new Date(); - private Date instruction_apply_time = new Date(); - private int instruction_require_time_out = 3000; - - int heartbeat = 0; - int mode = 0; - int move = 0; - int action = 0; - int error = 0; - int task = 0; - - Boolean isonline = true; - - Boolean iserror = false; - - //1-执行任务;2-取货完成;3-放货完成; - int flag; - - int last_mode = 0; - int last_move = 0; - int last_error = 0; - int last_task = 0; - String last_container; - - String device_code; - - String message; - - //请求成功标记 - Boolean requireSucess = false; - - //申请成功标记 - Boolean applySucess = false; - - public boolean exe_declaration() { - try { - this.barcode = this.barcode(); - this.formatcode = this.formatBarcode(); - return true; - } catch (Exception var3) { - String message = "获取条码异常"; - return false; - } - } - - public String formatBarcode() throws Exception { - String barcode = this.barcode(); - if (!StrUtil.isEmpty(barcode)) { - barcode = barcode.trim(); - } - - return barcode; - } - - public String barcode() throws Exception { - ScannerDeviceDriver scanner = this.getScanner(); - return scanner.readBarcode(); - } - - public void clearBarcode() throws Exception { - ScannerDeviceDriver scanner = this.getScanner(); - scanner.cleanBarcode(); - } - - - private ScannerDeviceDriver getScanner() throws Exception { - String scanner_code = (String) this.getDevice().getExtraValue().get(StandardConveyorWithScannerConfig.relation_scanner); - if (StrUtil.isEmpty(scanner_code)) { - throw new Exception("未配置读码器"); - } else { - Device device = deviceAppservice.findDeviceByCode(scanner_code); - if (device == null) { - throw new Exception("无设备:" + scanner_code); - } else { - DeviceDriver deviceDriver = device.getDeviceDriver(); - if (!(deviceDriver instanceof ScannerDeviceDriver)) { - throw new Exception("扫码器类型不对,不是ScannerDeviceDriver"); - } else { - ScannerDeviceDriver driver = (ScannerDeviceDriver) deviceDriver; - return driver; - } - } - } - } - - @Override - public Device getDevice() { - return this.device; - } - - - @Override - public void execute() throws Exception { - String message = null; - try { - device_code = this.getDeviceCode(); - heartbeat = this.itemProtocol.getItem_heartbeat(); - mode = this.itemProtocol.getItem_mode(); - move = this.itemProtocol.getItem_move(); - error = this.itemProtocol.getItem_error(); - task = this.itemProtocol.getItem_task(); - action = this.itemProtocol.getItem_action(); - - if (mode != last_mode) { - this.setRequireSucess(false); - } - if (move != last_move) { - if (move == 0 && mode == 2) { - thingToNothing(); - } - } - if (error != last_error) { - } - - } catch (Exception var17) { - return; - } - 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: - //申请任务 - if (move > 0 && !StrUtil.isEmpty(barcode()) && !requireSucess) { - instruction_require(barcode()); - } - if (move > 0 && !StrUtil.isEmpty(barcode()) && !applySucess) { - instruction_apply(barcode()); - } - } - switch (flag) { - //取货完成 - case 1: - writing(2); - break; - //放货完成 - case 2: - writing(3); - break; - - } - } - last_mode = mode; - last_error = error; - last_move = move; - last_task = task; - } - - public boolean exe_error() { - if (this.error == 0) { - return true; - } else { - log.debug("设备报警"); - return false; - } - } - - protected void thingToNothing() throws Exception { - this.setBarcode(null); - this.setRequireSucess(false); - this.setApplySucess(false); - clearBarcode(); - this.set_last_container(container); - } - - public void set_last_container(String barcode) { - this.setContainer(null); - } - - - public void set_last_container_type_desc(String type) { - } - - public boolean exe_business() { - return true; - } - - public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); - } - - public void writing(int command, int target, int task) { - - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - itemMap.put(to_target, target); - itemMap.put(to_task, task); - - ReadUtil.write(itemMap, server); - } - - public void writing(int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); - } - - public void writing(int type, int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_task; - String to_door = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_door; - String to_floor = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + ItemProtocol.item_to_floor; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (type == 1) { - itemMap.put(to_command, command); - } else if (type == 2) { - itemMap.put(to_target, command); - - } else if (type == 3) { - itemMap.put(to_task, command); - } else if (type == 4) { - itemMap.put(to_door, command); - } else if (type == 5) { - itemMap.put(to_floor, command); - } - - ReadUtil.write(itemMap, server); - } - - public boolean instruction_require(String container_code) throws Exception { - return instruction_require(container_code, WcsConfig.task_container_type_default_desc); - } - - public synchronized boolean instruction_apply(String container_code) throws Exception { - Date date = new Date(); - if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); - return false; - } else { - this.instruction_apply_time = date; - //container_code - TaskDto task = taskserver.findByContainer(container_code); - if (!ObjectUtil.isEmpty(task)) { - String taskid = task.getTask_id(); - String taskcode = task.getTask_code(); - String vehiclecode = task.getVehicle_code(); - String priority = task.getPriority(); - String start_point_code = task.getStart_point_code(); - String start_device_code = task.getStart_device_code(); - String route_plan_code = task.getRoute_plan_code(); - String next_device_code = ""; - - /** - * 开始平均分配 - */ - String this_coevice_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code()); - if (StrUtil.isEmpty(this_coevice_code)) { - List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code); - RouteLineDto routeLineDto = shortPathsList.get(0); - - String path = routeLineDto.getPath(); - String type = routeLineDto.getType(); - String[] str = path.split("->"); - if (!StrUtil.equals(type, "0")) { - return false; - } - List pathlist = Arrays.asList(str); - int index = 0; - for (int m = 0; m < pathlist.size(); m++) { - if (pathlist.get(m).equals(start_device_code)) { - index = m + 1; - break; - } - } - next_device_code = pathlist.get(index); - } else { - next_device_code = this_coevice_code; - } - //校验路由关系 - List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); - if (ObjectUtils.isEmpty(shortPathsList)) { - throw new RuntimeException("路由不通!"); - } - - Device startdevice = deviceAppservice.findDeviceByCode(start_device_code); - Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code); - String next_point_code; - if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) { - next_point_code = task.getTo_x() + "-" + task.getTo_y() + "-" + task.getTo_z(); - } else { - next_point_code = next_device_code; - } - Instruction instdto = new Instruction(); - instdto.setInstruction_id(IdUtil.simpleUUID()); - instdto.setRoute_plan_code(route_plan_code); - instdto.setRemark(task.getRemark()); - instdto.setMaterial(task.getMaterial()); - instdto.setQuantity(task.getQuantity()); - instdto.setTask_id(taskid); - instdto.setTask_code(taskcode); - instdto.setVehicle_code(vehiclecode); - String now = DateUtil.now(); - instdto.setCreate_time(now); - instdto.setCreate_by("auto"); - instdto.setStart_device_code(start_device_code); - instdto.setNext_device_code(next_device_code); - instdto.setStart_point_code(start_point_code); - instdto.setNext_point_code(next_point_code); - instdto.setPriority(priority); - instdto.setInstruction_status("0"); - instdto.setExecute_device_code(start_point_code); - instructionService.create(instdto); - //创建指令后修改任务状态 - WQLObject taskwo = WQLObject.getWQLObject("acs_task"); - - task.setTask_status("1"); - //创建指令后修改任务状态 - task.setTask_status("1"); - taskserver.update(task); - - applySucess = true; - } else { - log.info("未找到载具号{}对应任务", container_code); - } - } - return true; - } - - /** - * 请求指令 - * - * @param container_code - * @param container_type - */ - public synchronized boolean instruction_require(String container_code, String container_type) throws Exception { - 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; - //container_code - TaskDto task = taskserver.findByContainer(container_code); - if (!ObjectUtil.isEmpty(task)) { - if (!ObjectUtils.isEmpty(instructionService.findByBarcodeFromCache(container_code))) { - return false; - } - String taskid = task.getTask_id(); - String taskcode = task.getTask_code(); - String vehiclecode = task.getVehicle_code(); - String priority = task.getPriority(); - String start_point_code = task.getStart_point_code(); - String start_device_code = task.getStart_device_code(); - String route_plan_code = task.getRoute_plan_code(); - String next_device_code = ""; - - /** - * 开始平均分配 - */ - String this_coevice_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code()); - if (StrUtil.isEmpty(this_coevice_code)) { - List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code); - RouteLineDto routeLineDto = shortPathsList.get(0); - - String path = routeLineDto.getPath(); - String type = routeLineDto.getType(); - String[] str = path.split("->"); - if (!StrUtil.equals(type, "0")) { - return false; - } - List pathlist = Arrays.asList(str); - int index = 0; - for (int m = 0; m < pathlist.size(); m++) { - if (pathlist.get(m).equals(start_device_code)) { - index = m + 1; - break; - } - } - next_device_code = pathlist.get(index); - } else { - next_device_code = this_coevice_code; - } - //校验路由关系 - List shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code); - if (ObjectUtils.isEmpty(shortPathsList)) { - throw new RuntimeException("路由不通!"); - } - - Device startdevice = deviceAppservice.findDeviceByCode(start_device_code); - Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code); - String next_point_code; - if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) { - next_point_code = task.getTo_x() + "-" + task.getTo_y() + "-" + task.getTo_z(); - } else { - next_point_code = next_device_code; - } - Instruction instdto = new Instruction(); - instdto.setInstruction_id(IdUtil.simpleUUID()); - instdto.setRoute_plan_code(route_plan_code); - instdto.setRemark(task.getRemark()); - instdto.setMaterial(task.getMaterial()); - instdto.setQuantity(task.getQuantity()); - instdto.setTask_id(taskid); - instdto.setTask_code(taskcode); - instdto.setVehicle_code(vehiclecode); - String now = DateUtil.now(); - instdto.setCreate_time(now); - instdto.setCreate_by("auto"); - instdto.setStart_device_code(start_device_code); - instdto.setNext_device_code(next_device_code); - instdto.setStart_point_code(start_point_code); - instdto.setNext_point_code(next_point_code); - instdto.setPriority(priority); - instdto.setInstruction_status("0"); - instdto.setExecute_device_code(start_point_code); - instructionService.create(instdto); - //创建指令后修改任务状态 - task.setTask_status("1"); - taskserver.update(task); - requireSucess = true; - applySucess = true; - } else { - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - message = "申请任务中..."; - JSONObject apply = new JSONObject(); - apply.put("type", "6"); - apply.put("vehicle_code", container_code); - apply.put("point_code", device_code); - String str = acsToWmsService.applyTaskToWms(apply); - JSONObject jo = JSON.parseObject(str); - if (ObjectUtil.isEmpty(jo)) { - message = "接口不通"; - } else { - if (jo.getInteger("status") == 200) { - requireSucess = true; - } else { - requireSucess = false; - message = jo.get("message").toString(); - } - } - - } - } - return true; - } - } - - @Override - public JSONObject getDeviceStatusName() { - JSONObject jo = new JSONObject(); - String mode = ""; - String action = ""; - String io_action = ""; - String move = ""; - String status = ""; - if (this.getMode() == 0) { - mode = "未联机"; - } else if (this.getMode() == 1) { - mode = "单机"; - } else if (this.getMode() == 2) { - mode = "联机"; - } else if (this.getMode() == 4) { - mode = "人工排产确认"; - } else if (this.getMode() == 5) { - mode = "申请空盘"; - } else if (this.getMode() == 6) { - mode = "申请入库"; - } else if (this.getMode() == 7) { - mode = "码垛完成"; - } else if (this.getMode() == 8) { - mode = "码垛强制完成"; - } else if (this.getMode() == 9) { - mode = "工单完成"; - } - - if (this.getAction() == 0) { - action = "禁止取放"; - } else if (this.getAction() == 1) { - action = "允许取货"; - } else if (this.getAction() == 2) { - action = "允许放货"; - } else if (this.getAction() == 3) { - action = "允许取放"; - } - - - if (this.getMove() == 0) { - move = "无货"; - } else if (this.getMove() == 1) { - move = "有货"; - } else if (this.getMove() == 2) { - move = "有托盘有货"; - } - jo.put("device_name", this.getDevice().getDevice_name()); - jo.put("mode", mode); - jo.put("move", move); - jo.put("action", action); - jo.put("status", status); - jo.put("io_action", io_action); - jo.put("isOnline", this.getIsonline()); - jo.put("error", this.getError()); - jo.put("isError", this.getIserror()); - jo.put("message", this.getMessage()); - jo.put("task", this.getTask()); - jo.put("barcode", this.getBarcode()); - return jo; - } - - @Override - public void setDeviceStatus(JSONObject data) { - - } -} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/hongfeng/hf_manipulator/HfGantryManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/hongfeng/hf_manipulator/HfGantryManipulatorDeviceDriver.java index 3cfd00d..a68b695 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/hongfeng/hf_manipulator/HfGantryManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/hongfeng/hf_manipulator/HfGantryManipulatorDeviceDriver.java @@ -153,18 +153,6 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp if (StrUtil.equals(inst1.getInstruction_status(), "0")) { inst1.setInstruction_status("1"); instructionService.update(inst1); -// TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code()); -// if (ObjectUtil.isNotEmpty(taskDto)) { -// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) { -// JSONArray array = new JSONArray(); -// JSONObject map = new JSONObject(); -// map.put("task_id", taskDto.getExt_task_id()); -// map.put("task_status", "1"); -// array.add(map); -// acsToWmsService.feedbackTaskStatusToWms(array); -// } -// } - } } } @@ -179,7 +167,10 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp if (device.getDeviceDriver() instanceof HfStationDeviceDriver) { hfStationDeviceDriver = (HfStationDeviceDriver) device.getDeviceDriver(); if (hfStationDeviceDriver.getMove() == 1) { + logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "机械手取货时,开始反馈电气信号"); this.writing("to_command", "2"); + } else { + logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "机械手取货时,取货位不满足有货条件"); } } } @@ -187,6 +178,7 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp //行架机械手取货时校验条码 校验失败,取消任务 if (mode == 4 && action == 1 && move == 0 && task > 0) { + logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "机械手取货时条码校验失败,开始反馈电气信号"); Instruction instructionDto = instructionService.findByCodeFromCache(String.valueOf(task)); instructionService.cancel(instructionDto.getInstruction_id()); this.writing("to_command", "4"); @@ -205,7 +197,10 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp hfStationDeviceDriver = (HfStationDeviceDriver) nextDevice.getDeviceDriver(); int move = hfStationDeviceDriver.getMove(); if (move == 0) { + logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "机械手放货时,开始反馈电气信号"); this.writing("to_command", "3"); + } else { + logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "机械手放货时,放货位不满足无货条件"); } } } @@ -237,7 +232,7 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp acsToWmsService.feedbackTaskStatusToWms(array); } } - + logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "机械手任务完成,开始反馈电气信号"); this.writing("to_command", "0"); this.writing("to_onset", "0"); this.writing("to_target", "0"); @@ -274,11 +269,14 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp List toInstructions; //行架机械手申请任务 - if (mode == 2 && move == 0 && task == 0 && !requireSucess) { - applyTask(); - log.info("行架机械手开始申请任务"); + if (mode == 2) { + if (mode == 2 && move == 0 && task == 0 && !requireSucess) { + logServer.queryTask("机械手申请任务", this.getDevice_code(), "机械手开始申请任务!满足信号->mode == 2 && move == 0 && task == 0"); + applyTask(); + } else { + logServer.queryTask("机械手申请任务", this.getDevice_code(), "机械手不满足申请任务!此时:mode = " + mode + "move = " + move + "task = " + task + "requireSucess = " + requireSucess); + } } - } last_mode = mode; last_move = move; @@ -317,7 +315,7 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp instructionService.update(instruction); this.sendSignalType(instruction); this.setRequireSucess(true); - log.info("重新生成指令任务生成成功,指令号:{}", instruction.getInstruction_code()); + logServer.deviceInfo("机械手申请任务", this.getDevice_code(), "机械手申请任务任务成功,任务为重新创建指令的任务,指令号:" + instruction.getInstruction_code()); return true; } else { List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); @@ -360,17 +358,19 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp try { instructionService.create(instdto); - log.info("就绪任务生成指令生成成功,指令号:{}", instdto.getInstruction_code()); } catch (Exception e) { - log.error("就绪任务生成指令生成失败,任务号:{}", task.getTask_code()); e.printStackTrace(); } //创建指令后修改任务状态 task.setTask_status("1"); task.setUpdate_time(DateUtil.now()); taskserver.update(task); + this.sendSignalType(instdto); this.setRequireSucess(true); + logServer.deviceInfo("机械手申请任务", this.getDevice_code(), "机械手申请任务成功,任务为就绪状态下的任务,指令号:" + instdto.getInstruction_code()); + } else { + logServer.deviceInfo("机械手申请任务", this.getDevice_code(), "机械手申请任务失败,未找到机械手取货位关联设备的起点任务!"); } return true; } @@ -405,6 +405,7 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp itemMap.put(to_param, value); // itemMap.put(to_param, Integer.parseInt(value)); ReadUtil.write(itemMap, server); + logServer.writeLog("下发电气信号", this.getDevice_code(), "下发信号:" + to_param + "信号值:" + value); } public void executing(Server server, Map itemMap) { @@ -421,6 +422,7 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp } public synchronized void sendSignalType(Instruction dto) { + logServer.deviceInfo("机械手申请任务", this.getDevice_code(), "机械手申请任务指令创建成功,开始写入信号"); String start_device_code = dto.getStart_device_code(); String next_device_code = dto.getNext_device_code(); Device startDevice = appService.findDeviceByCode(start_device_code); @@ -433,12 +435,13 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp this.writing("to_target", next_addr); this.writing("to_task", dto.getInstruction_code()); this.writing("to_command", "1"); + logServer.deviceInfo("机械手申请任务", this.getDevice_code(), "机械手申请任务指令创建成功,信号写入成功"); } //判断点位是否设置电气值 public void isSetAddress(Device device) { if (ObjectUtil.isEmpty(device.getExtraValue().get("address"))) { - log.error("设备:{},未设置电气调度号!", device.getDevice_code()); + logServer.deviceError("未设置电气调度号", this.getDevice_code(), "下发指令,设备: '" + device.getDevice_code() + "'未查询到电气调度号"); throw new BadRequestException("设备:" + device.getDevice_code() + "未设置电气调度号!"); } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/hongfeng/hf_station/HfStationDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/hongfeng/hf_station/HfStationDeviceDriver.java index 546e602..50c5054 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/hongfeng/hf_station/HfStationDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/hongfeng/hf_station/HfStationDeviceDriver.java @@ -186,6 +186,22 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De order = this.itemProtocol.getOrder(); if (mode != last_mode) { + if (mode == 3) { + this.setRequireSucess(false); + } + if (mode == 4) { + this.setFinishRequireSucess(false); + } + + if (mode == 6) { + this.setCallEmptyRequireSucess(false); + } + if (mode == 7) { + this.setFullInRequireSucess(false); + } + if (mode == 8) { + this.setCallMaterialRequireSucess(false); + } logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); } @@ -348,6 +364,7 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); return false; } else { + logServer.deviceInfo("人工排产确认", this.getDevice_code(), "开始人工排产确认!"); this.instruction_require_time = date; ProduceshiftorderDto dto = produceshiftorderService.findByCode(order); JSONObject json = new JSONObject(); @@ -355,16 +372,13 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De json.put("material_code", dto.getMaterial_code()); json.put("ext_order_id", dto.getExt_order_id()); json.put("order_code", order); - HttpResponse result = acsToWmsService.orderConfirm(json); - if (ObjectUtil.isNotEmpty(result)) { - JSONObject jsonObject = JSONObject.parseObject(result.body()); - if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"), "200")) { - dto.setOrder_status("1"); - dto.setUpdate_time(DateUtil.now()); - produceshiftorderService.update(dto); - this.writing(3); - this.setRequireSucess(true); - } + JSONObject resp = acsToWmsService.orderConfirm(json); + if (StrUtil.equals(resp.getString("status"), "200")) { + dto.setOrder_status("1"); + dto.setUpdate_time(DateUtil.now()); + produceshiftorderService.update(dto); + this.setRequireSucess(true); + logServer.deviceInfo("人工排产确认", this.getDevice_code(), "人工排产确认成功!"); } return true; } @@ -381,6 +395,7 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_finished_time); return false; } else { + logServer.deviceInfo("反馈工单状态", this.getDevice_code(), "开始反馈设备完成状态!"); this.instruction_finished_time = date; ProduceshiftorderDto dto = produceshiftorderService.findByCode(order); JSONObject json = new JSONObject(); @@ -389,15 +404,14 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De json.put("ext_order_id", dto.getExt_order_id()); json.put("qty", current_order_num); json.put("type", "3"); - HttpResponse result = acsToWmsService.feedbackOrderStatus(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == 200) { - dto.setOrder_status("2"); - dto.setUpdate_time(DateUtil.now()); - produceshiftorderService.update(dto); - this.writing(4); - this.setFinishRequireSucess(true); - } + JSONObject resp = acsToWmsService.feedbackOrderStatus(json); + if (StrUtil.equals(resp.getString("status"), "200")) { + dto.setOrder_status("2"); + dto.setUpdate_time(DateUtil.now()); + produceshiftorderService.update(dto); + this.writing(4); + this.setFinishRequireSucess(true); + logServer.deviceInfo("反馈工单状态", this.getDevice_code(), "反馈设备完成状态成功!"); } return true; } @@ -414,18 +428,18 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_call_material_time); return false; } else { + logServer.deviceInfo("acs申请任务", this.getDevice_code(), "开始申请空托盘任务!!"); this.instruction_call_material_time = date; JSONObject json = new JSONObject(); json.put("device_code", this.device_code); json.put("create_mode", "2"); json.put("is_auto_issue", "0"); json.put("type", "1"); - HttpResponse result = acsToWmsService.apply(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == 200) { - this.writing(6); - this.setCallEmptyRequireSucess(true); - } + JSONObject resp = acsToWmsService.apply(json); + if (StrUtil.equals(resp.getString("status"), "200")) { + this.writing(6); + this.setCallEmptyRequireSucess(true); + logServer.deviceInfo("acs申请任务", this.getDevice_code(), "空托盘任务申请成功!"); } return true; } @@ -443,6 +457,7 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_full_in_time); return false; } else { + logServer.deviceInfo("acs申请任务", this.getDevice_code(), "开始申请满盅入库任务!"); this.instruction_full_in_time = date; JSONObject json = new JSONObject(); json.put("device_code", device_code); @@ -451,12 +466,11 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De json.put("create_mode", "2"); json.put("is_auto_issue", "0"); json.put("type", "2"); - HttpResponse result = acsToWmsService.apply(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == 200) { - this.writing(7); - this.setFullInRequireSucess(true); - } + JSONObject resp = acsToWmsService.apply(json); + if (StrUtil.equals(resp.getString("status"), "200")) { + this.writing(7); + this.setFullInRequireSucess(true); + logServer.deviceInfo("acs申请任务", this.getDevice_code(), "满盅入库任务申请成功!"); } return true; } @@ -474,18 +488,18 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_call_material_time); return false; } else { + logServer.deviceInfo("acs申请任务", this.getDevice_code(), "开始申请压机叫料任务!"); this.instruction_call_material_time = date; JSONObject json = new JSONObject(); json.put("device_code", this.device_code); json.put("create_mode", "2"); json.put("is_auto_issue", "0"); json.put("type", "3"); - HttpResponse result = acsToWmsService.apply(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == 200) { - this.writing(8); - this.setCallMaterialRequireSucess(true); - } + JSONObject resp = acsToWmsService.apply(json); + if (StrUtil.equals(resp.getString("status"), "200")) { + this.writing(8); + this.setCallMaterialRequireSucess(true); + logServer.deviceInfo("acs申请任务", this.getDevice_code(), "压机叫料任务申请成功!"); } return true; } @@ -502,17 +516,17 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_empty_hasGoods_time); return false; } else { + logServer.deviceInfo("acs申请任务", this.getDevice_code(), "开始申请空盅对接位GT04任务,将GT04空盅搬运至空料盅缓存区!"); this.instruction_empty_hasGoods_time = date; JSONObject json = new JSONObject(); json.put("device_code", device_code); json.put("create_mode", "2"); json.put("is_auto_issue", "0"); json.put("type", "4"); - HttpResponse result = acsToWmsService.apply(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == 200) { - this.setEmptyHasGoodsRequireSucess(true); - } + JSONObject resp = acsToWmsService.apply(json); + if (StrUtil.equals(resp.getString("status"), "200")) { + this.setEmptyHasGoodsRequireSucess(true); + logServer.deviceInfo("acs申请任务", this.getDevice_code(), "空盅对接位GT04任务,将GT04空盅搬运至空料盅缓存区申请成功!"); } } return true; @@ -529,6 +543,7 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_barcode_time); return false; } else { + logServer.deviceInfo("acs更新条码", this.getDevice_code(), "开始更新满料盅库位条码信息!"); this.instruction_update_barcode_time = date; JSONObject json = new JSONObject(); Object inspect_in_stocck = this.getDevice().getExtraValue().get("inspect_in_stocck"); @@ -539,16 +554,15 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De json.put("is_first", "true"); } String prx = "00"; - if (barcode < 10){ + if (barcode < 10) { prx = "000"; } json.put("device_code", device_code); json.put("barcode", prx + barcode); - HttpResponse result = acsToWmsService.updateBarcode(json); - if (ObjectUtil.isNotEmpty(result)) { - if (result.getStatus() == 200) { - this.setEmptyHasGoodsRequireSucess(true); - } + JSONObject resp = acsToWmsService.updateBarcode(json); + if (StrUtil.equals(resp.getString("status"), "200")) { + this.setUpdateBarcodeRequireSucess(true); + logServer.deviceInfo("acs更新条码", this.getDevice_code(), "更新满料盅库位条码信息成功!"); } } return true; @@ -620,7 +634,6 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De itemMap.put(to_task, command); } ReadUtil.write(itemMap, server); - } public void writing(int command) { @@ -631,6 +644,7 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De Map itemMap = new HashMap(); itemMap.put(to_command, command); ReadUtil.write(itemMap, server); + logServer.writeLog("下发电气信号", this.getDevice_code(), "下发信号:" + to_command + "信号值:" + command); } public void writing(String param, String value) { @@ -641,6 +655,7 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De Map itemMap = new HashMap(); itemMap.put(to_param, value); ReadUtil.write(itemMap, server); + logServer.writeLog("下发电气信号", this.getDevice_code(), "下发信号:" + to_param + "信号值:" + value); } public synchronized boolean finish_instruction() throws Exception { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/hongfeng/hf_two_rgv/HfTwoRGVDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/hongfeng/hf_two_rgv/HfTwoRGVDeviceDriver.java index e44e17c..1035b4d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/hongfeng/hf_two_rgv/HfTwoRGVDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/hongfeng/hf_two_rgv/HfTwoRGVDeviceDriver.java @@ -192,18 +192,6 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev if (StrUtil.equals(inst1.getInstruction_status(), "0")) { inst1.setInstruction_status("1"); instructionService.update(inst1); -// TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code()); -// if (ObjectUtil.isNotEmpty(taskDto)) { -// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) { -// JSONArray array = new JSONArray(); -// JSONObject map = new JSONObject(); -// map.put("task_id", taskDto.getExt_task_id()); -// map.put("task_status", "1"); -// array.add(map); -// acsToWmsService.feedbackTaskStatusToWms(array); -// } -// } - } } } @@ -226,6 +214,7 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev acsToWmsService.feedbackTaskStatusToWms(array); } } + logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "RGV前工位任务完成,开始反馈电气信号"); this.writing("to_command1", "0"); this.writing("to_onset1", "0"); this.writing("to_target1", "0"); @@ -242,18 +231,6 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev if (StrUtil.equals(inst2.getInstruction_status(), "0")) { inst2.setInstruction_status("1"); instructionService.update(inst2); -// TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code()); -// if (ObjectUtil.isNotEmpty(taskDto)) { -// if (StrUtil.isNotEmpty(taskDto.getExt_task_id())) { -// JSONArray array = new JSONArray(); -// JSONObject map = new JSONObject(); -// map.put("task_id", taskDto.getExt_task_id()); -// map.put("task_status", "1"); -// array.add(map); -// acsToWmsService.feedbackTaskStatusToWms(array); -// } -// } - } } } @@ -276,6 +253,7 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev acsToWmsService.feedbackTaskStatusToWms(array); } } + logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "RGV后工位任务完成,开始反馈电气信号"); this.writing("to_command2", "0"); this.writing("to_onset2", "0"); this.writing("to_target2", "0"); @@ -294,9 +272,10 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev hfStationDeviceDriver = (HfStationDeviceDriver) startDevice.getDeviceDriver(); int move = hfStationDeviceDriver.getMove(); if (move == 1) { + logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "RGV前工位取货时,开始反馈电气信号"); this.writing("to_command1", "2"); } else { - log.warn("前工位取货位无货,取货位:{}", start_device_code); + logServer.deviceError("反馈电气信号", this.getDevice_code(), "RGV前工位取货时,取货位光电信号不满足有货条件,反馈失败!"); } } } @@ -310,9 +289,10 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev hfStationDeviceDriver = (HfStationDeviceDriver) nextDevice.getDeviceDriver(); int move = hfStationDeviceDriver.getMove(); if (move == 0) { + logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "RGV前工位放货时,开始反馈电气信号"); this.writing("to_command1", "3"); } else { - log.warn("前工位放货位有货,放货位:{}", next_device_code); + logServer.deviceError("反馈电气信号", this.getDevice_code(), "RGV前工位放货时,放货位光电信号不满足无货条件,反馈失败!"); } } } @@ -326,9 +306,10 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev hfStationDeviceDriver = (HfStationDeviceDriver) startDevice.getDeviceDriver(); int move = hfStationDeviceDriver.getMove(); if (move == 1) { + logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "RGV后工位取货时,开始反馈电气信号"); this.writing("to_command2", "2"); } else { - log.warn("后工位取货位无货,取货位:{}", start_device_code); + logServer.deviceError("反馈电气信号", this.getDevice_code(), "RGV后工位取货时,放货位光电信号不满足有货条件,反馈失败!"); } } } @@ -343,8 +324,9 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev int move = hfStationDeviceDriver.getMove(); if (move == 0) { this.writing("to_command2", "3"); + logServer.deviceInfo("反馈电气信号", this.getDevice_code(), "RGV后工位放货时,开始反馈电气信号"); } else { - log.warn("后工位放货位有货,放货位:{}", next_device_code); + logServer.deviceError("反馈电气信号", this.getDevice_code(), "RGV后工位放货时,放货位光电信号不满足无货条件,反馈失败!"); } } } @@ -381,20 +363,26 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev case 2: //后工位申请任务 if (mode == 2 && move2 == 0 && action2 == 0 && !requireBackSucess) { + logServer.queryTask("RGV申请后工位任务", this.getDevice_code(), "RGV开始申请后工位任务!满足信号->mode == 2 && move2 == 0 && action2 == 0"); instruction_require2(); - logServer.deviceExecuteLog(device_code, "", String.valueOf(task2), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",task2:" + task2 + ",requireBackSucess:" + requireBackSucess); + } else { + logServer.queryTask("RGV申请后工位任务", this.getDevice_code(), "RGV不满足申请后工位任务!此时:mode = " + mode + "move2 = " + move2 + "action2 = " + action2 + "requireBackSucess = " + requireBackSucess); } //前工位申请任务 if (mode == 2 && move2 == 0 && action2 == 0 && task2 == 0 && move1 == 0 && !requireHeadSucess) { + logServer.queryTask("RGV申请前工位任务", this.getDevice_code(), "RGV开始申请前工位任务!满足信号->mode == 2 && move2 == 0 && action2 == 0 && task2 == 0 && move1 == 0"); instruction_require(); - logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",task2:" + task2 + ",requireHeadSucess:" + requireHeadSucess); + } else { + logServer.queryTask("RGV申请前工位任务", this.getDevice_code(), "RGV不满足申请前工位任务!此时:mode = " + mode + "move2 = " + move2 + "action2 = " + action2 + "task2 = " + task2 + "move1 = " + move1 + "requireHeadSucess = " + requireHeadSucess); } break; case 3: //前工位申请任务 if (mode == 3 && move2 == 1 && action2 == 1 && move1 == 0 && !requireHeadSucess) { + logServer.queryTask("RGV申请前工位任务", this.getDevice_code(), "RGV开始申请前工位任务!满足信号->mode == 3 && move2 == 1 && action2 == 1 && move1 == 0"); instruction_require(); - logServer.deviceExecuteLog(device_code, "", String.valueOf(task1), "move2:" + move2 + ",action2:" + action2 + ",move1:" + move1 + ",task2:" + task2 + ",requireHeadSucess:" + requireHeadSucess); + } else { + logServer.queryTask("RGV申请前工位任务", this.getDevice_code(), "RGV不满足申请前工位任务!此时:mode = " + mode + "move2 = " + move2 + "action2 = " + action2 + "move1 = " + move1 + "requireHeadSucess = " + requireHeadSucess); } } @@ -446,6 +434,7 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev instructionService.update(instruction); this.sendHeadSignalType(instruction); requireHeadSucess = true; + logServer.deviceInfo("RGV申请前工位任务", this.getDevice_code(), "RGV申请前工位任务成功,任务为重新创建指令的任务,指令号:" + instruction.getInstruction_code()); return true; } else { List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); @@ -505,6 +494,9 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev taskserver.update(task); this.sendHeadSignalType(instdto); requireHeadSucess = true; + logServer.deviceInfo("RGV申请前工位任务", this.getDevice_code(), "RGV申请前工位任务成功,任务为就绪状态下的任务,指令号:" + instdto.getInstruction_code()); + } else { + logServer.deviceInfo("RGV申请前工位任务", this.getDevice_code(), "RGV申请前工位任务失败,未找到前工位取货位关联设备的起点任务!"); } } return true; @@ -546,6 +538,7 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev instructionService.update(instruction); this.sendBackSignalType(instruction); requireBackSucess = true; + logServer.deviceInfo("RGV申请后工位任务", this.getDevice_code(), "RGV申请后工位任务成功,任务为重新创建指令的任务,指令号:" + instruction.getInstruction_code()); return true; } else { List taskDtoList = taskserver.queryTaskByDeviceCode(startDeviceCode); @@ -603,12 +596,16 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev task.setTask_status("1"); taskserver.update(task); this.sendBackSignalType(instdto); + logServer.deviceInfo("RGV申请后工位任务", this.getDevice_code(), "RGV申请后工位任务成功,任务为就绪状态下的任务,指令号:" + instdto.getInstruction_code()); + } else { + logServer.deviceInfo("RGV申请后工位任务", this.getDevice_code(), "RGV申请后工位任务失败,未找到后工位取货位关联设备的起点任务!"); } } return true; } public synchronized void sendHeadSignalType(Instruction dto) { + logServer.deviceInfo("RGV申请前工位任务", this.getDevice_code(), "RGV前工位任务指令创建成功,开始写入信号"); String start_device_code = dto.getStart_device_code(); String next_device_code = dto.getNext_device_code(); Device startDevice = deviceAppservice.findDeviceByCode(start_device_code); @@ -621,9 +618,11 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev this.writing("to_target1", next_addr); this.writing("to_task1", dto.getInstruction_code()); this.writing("to_command1", "1"); + logServer.deviceInfo("RGV申请前工位任务", this.getDevice_code(), "RGV前工位任务指令创建成功,信号写入成功"); } public synchronized void sendBackSignalType(Instruction dto) { + logServer.deviceInfo("RGV申请后工位任务", this.getDevice_code(), "RGV后工位任务指令创建成功,开始写入信号"); String start_device_code = dto.getStart_device_code(); String next_device_code = dto.getNext_device_code(); Device startDevice = deviceAppservice.findDeviceByCode(start_device_code); @@ -636,12 +635,13 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev this.writing("to_target2", next_addr); this.writing("to_task2", dto.getInstruction_code()); this.writing("to_command2", "1"); + logServer.deviceInfo("RGV申请后工位任务", this.getDevice_code(), "RGV后工位任务指令创建成功,信号写入成功"); } //判断点位是否设置电气值 public void isSetAddress(Device device) { if (ObjectUtil.isEmpty(device.getExtraValue().get("address"))) { - log.error("设备:{},未设置电气调度号!", device.getDevice_code()); + logServer.deviceError("未设置电气调度号", this.getDevice_code(), "下发指令,设备: '" + device.getDevice_code() + "'未查询到电气调度号"); throw new BadRequestException("设备:" + device.getDevice_code() + "未设置电气调度号!"); } } @@ -665,7 +665,7 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev itemMap.put(to_param, value); ReadUtil.write(itemMap, server); - log.info("设备号:{},下发信号{},下发信号值{}", device_code, to_param, value); + logServer.writeLog("下发电气信号", this.getDevice_code(), "下发信号:" + to_param + "信号值:" + value); } public boolean exe_business() { @@ -720,13 +720,6 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev } - public void writing(int type, int command) { - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); - } - //将扩展表中的字符串数组数据转换成集合 public List getExtraDeviceCodes(String extraName) { String extraValue = (String) this.getDevice().getExtraValue().get(extraName); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java index b081e4b..8fea224 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java @@ -31,13 +31,6 @@ import java.util.Map; public class AcsToWmsController { private final AcsToWmsService acstowmsService; - @PostMapping("/applyTask") - @Log("向WMS申请任务") - @ApiOperation("向WMS申请任务") - public ResponseEntity applyTaskToWms(@RequestBody JSONObject jo) { - return new ResponseEntity<>(acstowmsService.applyTaskToWms(jo), HttpStatus.OK); - } - @PostMapping("/taskStatusFeedback") @Log("向WMS反馈任务状态") @ApiOperation("向WMS反馈任务状态") @@ -46,33 +39,6 @@ public class AcsToWmsController { return new ResponseEntity<>(acstowmsService.feedbackTaskStatusToWms(data), HttpStatus.OK); } - @PostMapping("/pointStatusFeedback") - @Log("向WMS反馈点位状态") - @ApiOperation("向WMS反馈点位状态") - public ResponseEntity feedbackPointStatusToWms(@RequestBody Map whereJson) { - return new ResponseEntity<>(acstowmsService.feedbackPointStatusToWms(whereJson), HttpStatus.OK); - } - - @PostMapping("/feedbackAgvStatus") - @Log("反馈AGV设备状态") - @ApiOperation("反馈AGV设备状态") - public ResponseEntity feedbackAgvStatus(@RequestBody String device_code, String error, String error_message) { - return new ResponseEntity<>(acstowmsService.feedbackAgvStatus(device_code, error, error_message), HttpStatus.OK); - } - - @PostMapping("/feedbackAgv") - @Log("反馈AGV设备信息") - @ApiOperation("反馈AGV设备信息") - public ResponseEntity feedbackAgv(@RequestBody JSONArray from) { - return new ResponseEntity<>(acstowmsService.feedbackAgv(from), HttpStatus.OK); - } - - @PostMapping("/feedbackDeviceStatus") - @Log("反馈设备状态") - @ApiOperation("反馈设备状态") - public ResponseEntity feedbackDeviceStatus(@RequestBody String device_code, String code, String value) { - return new ResponseEntity<>(acstowmsService.feedbackDeviceStatus(device_code, code, value), HttpStatus.OK); - } @PostMapping("/feedbackOrderStatus") @Log("acs强制完成向wms反馈") @@ -82,20 +48,6 @@ public class AcsToWmsController { } - @PostMapping("/applyInCacheLineTask") - @Log("ACS申请缓存线入库任务") - @ApiOperation("ACS申请缓存线入库任务") - public ResponseEntity applyInCacheLineTask(@RequestBody JSONObject param) { - return new ResponseEntity<>(acstowmsService.applyInCacheLineTask(param), HttpStatus.OK); - } - - @PostMapping("/applyOutCacheLineTask") - @Log("ACS系统申请出库任务") - @ApiOperation("ACS系统申请出库任务") - public ResponseEntity applyOutCacheLineTask(@RequestBody JSONObject param) { - return new ResponseEntity<>(acstowmsService.applyOutCacheLineTask(param), HttpStatus.OK); - } - @PostMapping("/apply") @Log("acs向lms申请任务") @ApiOperation("acs向lms申请任务") diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java index 1d52f48..78f4b30 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/WmsToAcsController.java @@ -69,44 +69,6 @@ public class WmsToAcsController { return new ResponseEntity<>(wmstoacsService.forceFinishFromWms(whereJson), HttpStatus.OK); } - @PostMapping("/updateDeviceGoodsFromWms") - @Log("WMS修改点位状态") - @ApiOperation("WMS修改点位状态") - @SaIgnore - public ResponseEntity updateDeviceGoodsFromWms(@RequestBody String whereJson) { - return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK); - } - @PostMapping("/areaControl") - @Log("区域控制") - @ApiOperation("区域控制") - @SaIgnore - public ResponseEntity areaControl(@RequestBody JSONObject whereJson) { - return new ResponseEntity<>(wmstoacsService.areaControl(whereJson), HttpStatus.OK); - } - - @PostMapping("/action") - @Log("下发动作") - @ApiOperation("WMS修改点位状态") - @SaIgnore - public ResponseEntity putAction(@RequestBody String whereJson) throws Exception { - return new ResponseEntity<>(wmstoacsService.putAction(whereJson), HttpStatus.OK); - } - - @PostMapping("/querydevice") - @Log("查询设备状态") - @ApiOperation("查询设备状态") - @SaIgnore - public ResponseEntity queryDevice(@RequestBody String whereJson) throws Exception { - return new ResponseEntity<>(wmstoacsService.queryDevice(whereJson), HttpStatus.OK); - } - - @PostMapping("/queryDeviceDBValue") - @Log("查询设备DB值") - @ApiOperation("查询设备DB值") - @SaIgnore - public ResponseEntity queryDeviceDBValue(@RequestBody String whereJson){ - return new ResponseEntity<>(wmstoacsService.queryDeviceDBValue(whereJson), HttpStatus.OK); - } } 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 cb9e865..1169942 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 @@ -8,95 +8,14 @@ import java.util.Map; public interface AcsToWmsService { - /** - * ACS向WMS申请任务 - * type:必填;1共挤线申请空盘、2共挤线满托入库、3油漆线申请空盘、4油漆线申请物料、5油漆线空盘入库、6、一楼空托入库 - * point_code:必填; - * vehicle_num 载具数量 - * vehicle_type 载具类型 - * vehicle_code 载具号 - * qty 物料数量 - */ - String applyTaskToWms(JSONObject jo); + /** * 向WMS反馈任务状态 * * @return Map */ - public HttpResponse feedbackTaskStatusToWms(JSONArray arr); - - /** - * 向WMS反馈点位状态 - * - * @param jsonObject 条件 - * @return Map - */ - Map feedbackPointStatusToWms(Map jsonObject); - - /** - * 向WMS获取设备状态 - * - * @return - */ - JSONArray getDeviceStatusToWms(); - - /** - * 请求信号交互 - * - * @param - * @return - */ - public HttpResponse requestSignalInteraction(String device_code, String vehicle_code, String action); - - public String requestTaskAgain(String address, String task_id, String vehicle_code); - - public String apply_InEmpty(String device_code, String type, String quantity, String pallet); - - public String apply_OutEmpty(String device_code); - - /** - * 反馈AGV设备状态 - * - * @param device_code - * @param error - * @param error_message - * @return - */ - HttpResponse feedbackAgvStatus(String device_code, String error, String error_message); - - /** - * 反馈AGV设备状态 - * - * @param device_code - * @return - */ - HttpResponse feedbackDeviceStatus(String device_code, String code, String value); - - /** - * 反馈AGV设备信息 - * - * @param from - * @return - */ - HttpResponse feedbackAgv(JSONArray from); - - /** - * 请求开门或关门 - * - * @param device_code - * @param status - * @return - */ - HttpResponse applyOpenOrCloseDoor(String device_code, String status); - - /** - * 查询自动门状态 - * - * @param - * @returna - */ - HttpResponse queryDoorsStatus(); + JSONObject feedbackTaskStatusToWms(JSONArray arr); /** @@ -105,42 +24,27 @@ public interface AcsToWmsService { * @param param * @return */ - HttpResponse feedbackOrderStatus(JSONObject param); + JSONObject feedbackOrderStatus(JSONObject param); - /** - * ACS申请缓存线入库任务 - * - * @param param - * @return - */ - HttpResponse applyInCacheLineTask(JSONObject param); - - /** - * ACS系统申请出库任务 - * - * @param param - * @return - */ - HttpResponse applyOutCacheLineTask(JSONObject param); /** * 申请lms任务 * @param param * @return */ - HttpResponse apply(JSONObject param); + JSONObject apply(JSONObject param); /** * 人工排产确认 * @param param * @return */ - HttpResponse orderConfirm(JSONObject param); + JSONObject orderConfirm(JSONObject param); /** * 人工排产确认 * @param param * @return */ - HttpResponse updateBarcode(JSONObject param); + JSONObject updateBarcode(JSONObject param); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java index a0d45bd..0fa4a05 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/WmsToAcsService.java @@ -40,43 +40,6 @@ public interface WmsToAcsService { Map forceFinishFromWms(String jsonObject) throws Exception; - /** - * 修改设置有无货属性 - * - * @param jsonObject 条件 - * @return Map - */ - Map updateDeviceGoodsFromWms(String jsonObject); - /** - * 区域控制 - * - * @param jsonObject 条件 - * @return Map - */ - Map areaControl(JSONObject jsonObject); - - /** - * 下发动作 - * - * @param jsonObject 条件 - * @return Map - */ - Map putAction(String jsonObject) throws Exception; - - /** - * 查询设备状态 - * - * @param jsonObject 条件 - * @return Map - */ - Map queryDevice(String jsonObject) throws Exception; - - /** - * 查询设备DB值 - * @param whereJson - * @return - */ - Map queryDeviceDBValue(String whereJson); } 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 7e8dadd..3eb4332 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 @@ -1,9 +1,9 @@ package org.nl.acs.ext.wms.service.impl; -import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; @@ -15,11 +15,8 @@ import org.nl.acs.device.service.DeviceService; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.task.service.TaskService; -import org.nl.acs.task.service.dto.TaskDto; -import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.system.service.ParamService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import java.util.Map; @@ -46,562 +43,133 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { /*@Value("${acsTowms.token}")*/ public String token; + @Override - public String applyTaskToWms(JSONObject jo) { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyTaskToWms"); - String url = wmsurl + addressDto.getMethods_url(); - log.info("applyTaskToWms-----请求参数{}", jo.toString()); - HttpResponse result2 = null; + public JSONObject feedbackTaskStatusToWms(JSONArray data) { + String url = ""; try { - result2 = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(jo)) - .execute(); - System.out.println(result2); + String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms"); + String methods_url = addressDto.getMethods_url(); + url = wmsurl + methods_url; + HttpResponse result = + HttpRequest + .post(url) + .header("Authorization", token) + .body(JSON.toJSONString(data)) + .execute(); + JSONObject jsonObject = JSONObject.parseObject(result.body()); + logServer.acsToLms("反馈任务状态", url, String.valueOf(data), jsonObject.getString("status"), jsonObject.getString("message")); + return jsonObject; } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("status", "400"); + jsonObject.put("message", e.getMessage()); + logServer.acsToLms("反馈任务状态", url, String.valueOf(data), jsonObject.getString("status"), jsonObject.getString("message")); + return jsonObject; } - String type = ""; - if (result2.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - log.info("applyTaskToWms-----输出参数{}", result2.body()); - return result2.body(); } @Override - public HttpResponse feedbackTaskStatusToWms(JSONArray data) { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - HttpResponse result2 = null; - log.info("feedbackTaskStatusToWms-----请求参数{}", data.toString()); - - AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms"); - String methods_url = addressDto.getMethods_url(); + public JSONObject feedbackOrderStatus(JSONObject param) { + String url = ""; try { - result2 = HttpRequest.post(wmsurl + methods_url) - .header("Authorization", token).body(String.valueOf(data)) - .execute(); - System.out.println(result2); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - - String type = ""; - if (result2.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - - JSONObject jo = JSONObject.parseObject(result2.body()); - log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString()); - return result2; - } - - @Override - public Map feedbackPointStatusToWms(Map jsonObject) { - - AddressDto addressDto = addressService.findByCode("feedbackPointStatusToWms"); - String methods_url = addressDto.getMethods_url(); - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - String url = wmsurl + methods_url; - - JSONObject json = new JSONObject(); - json.put("task_uuid", jsonObject.get("device_code")); - json.put("task_code", jsonObject.get("point_status")); - json.put("task_status", jsonObject.get("point_mode")); - json.put("point_error", jsonObject.get("point_error")); - log.info("feedbackPointStatusToWms----请求参数{}", json.toString()); - try { - String result2 = HttpRequest.post(url) - .body(String.valueOf(json)) - .execute().body(); - System.out.println(result2); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - - } - - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", new JSONArray()); - log.info("feedbackPointStatusToWms----输出参数{}", resultJson.toString()); - return resultJson; - } - - @Override - public JSONArray getDeviceStatusToWms() { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("getDeviceStatusToWms"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - String result = ""; - try { - result = HttpRequest.get(url) - .execute().body(); - System.out.println(result); - log.info("getTaskStatusToWms----返回参数{}", result); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - JSONArray jsonArray = JSONArray.parseArray(result); - return jsonArray; - - } - - @Override - public HttpResponse requestSignalInteraction(String device_code, String vehicle_code, String action) { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - JSONObject json = new JSONObject(); - json.put("device_code", device_code); - json.put("vehicle_code", vehicle_code); - json.put("action", action); - - AddressDto addressDto = addressService.findByCode("requestSignalInteraction"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - HttpResponse result = null; - log.info("requestSignalInteraction----请求参数{}", json.toString()); - try { - result = HttpRequest.post(url) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("requestSignalInteraction----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - - } - return result; - } - - - @Override - public String requestTaskAgain(String address, String task_id, String vehicle_code) { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - String device_code = deviceService.queryDeviceCodeByAddress(Integer.parseInt(address)); - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - jo.put("task_id", task_id); - jo.put("vehicle_code", vehicle_code); - String result2 = null; - - AddressDto addressDto = addressService.findByCode("requestTaskAgain"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - log.info("requestTaskAgain----请求参数{}", jo); - - try { - result2 = HttpRequest.post(url) - .body(String.valueOf(jo)) - .execute().body(); - System.out.println(result2); - log.info("requestTaskAgain----返回参数{}", result2); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result2; - } - - @Override - public String apply_InEmpty(String device_code, String type, String quantity, String container_code) { - if (StrUtil.isEmpty(container_code)) { - log.info("apply_InEmpty----空盘入库申请校验失败,{}{}", device_code, "设备条码为空"); - throw new BadRequestException("地址对应设备未找到"); - } - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - jo.put("type", type); - jo.put("quantity", quantity); - jo.put("container_code", container_code); - - String result2 = ""; - - AddressDto addressDto = addressService.findByCode("apply_InEmpty"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - log.info("requestTaskAgain----请求参数{}", jo); - - try { - result2 = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(jo)) - .execute().body(); - System.out.println(result2); - log.info("requestTaskAgain----返回参数{}", result2); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result2; - } - - @Override - public String apply_OutEmpty(String device_code) { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - String result2 = ""; - - AddressDto addressDto = addressService.findByCode("apply_OutEmpty"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - log.info("apply_OutEmpty----请求参数{}", jo); - try { - result2 = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(jo)) - .execute().body(); - System.out.println(result2); - log.info("apply_OutEmpty----返回参数{}", result2); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result2; - } - - @Override - public HttpResponse feedbackAgvStatus(String device_code, String error, String error_message) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - - JSONObject json = new JSONObject(); - json.put("device_code", device_code); - json.put("error", error); - json.put("error_message", error_message); - - AddressDto addressDto = addressService.findByCode("feedbackAgvStatus"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackAgvStatus----请求参数{}", json); - - try { - result = HttpRequest.post(url) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("feedbackAgvStatus----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } - - @Override - public HttpResponse feedbackDeviceStatus(String device_code, String code, String value) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - - JSONObject json = new JSONObject(); - json.put("device_code", device_code); - json.put("back_time", DateUtil.format(DateUtil.date(), "yyyyMMddHHmmssSSS")); - JSONArray ja = new JSONArray(); - JSONObject jo = new JSONObject(); - jo.put("code", code); - jo.put("value", value); - ja.add(jo); - json.put("data", ja); - AddressDto addressDto = addressService.findByCode("feedbackDeviceStatus"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackDeviceStatus----请求参数{}", json); - - try { - result = HttpRequest.post(url) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("feedbackDeviceStatus----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } - - @Override - public HttpResponse feedbackAgv(JSONArray from) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - - AddressDto addressDto = addressService.findByCode("feedbackAgv"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackAgv----请求参数{}", from); - - try { - result = HttpRequest.post(url) - .body(String.valueOf(from)) - .execute(); - System.out.println(result); - log.info("feedbackAgv----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } - - @Override - public HttpResponse applyOpenOrCloseDoor(String device_code, String status) { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - jo.put("status", status); - HttpResponse result = null; - log.info("applyOpenOrCloseDoor-----请求参数{}", jo.toString()); - - AddressDto addressDto = addressService.findByCode("applyOpenOrCloseDoor"); - String methods_url = addressDto.getMethods_url(); - try { - result = HttpRequest.post(wmsurl + methods_url) - .body(String.valueOf(jo)) - .execute(); - System.out.println(result); - log.info("applyOpenOrCloseDoor-----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } - - @Override - public HttpResponse queryDoorsStatus() { - String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - - HttpResponse result = null; - log.info("queryDoorStatus-----请求"); - AddressDto addressDto = addressService.findByCode("queryDoorsStatus"); - String methods_url = addressDto.getMethods_url(); - try { - result = HttpRequest.get(wmsurl + methods_url) - .body("") - .execute(); - log.info("queryDoorStatus-----输出参数{}", result.body().toString()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - - } - return result; - } - - @Override - public HttpResponse feedbackOrderStatus(JSONObject param) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + param.put("type", "3"); String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - param.put("type","3"); AddressDto addressDto = addressService.findByCode("feedbackOrderStatus"); String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackOrderStatus----请求参数{}", param); - try { - result = HttpRequest.post(url) - .body(String.valueOf(param)) - .execute(); - String type = ""; - if (result.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - - log.info("feedbackOrderStatus----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - + url = wmsUrl + methods_url; + HttpResponse result = + HttpRequest + .post(url) + .body(JSON.toJSONString(param)) + .execute(); + JSONObject jsonObject = JSONObject.parseObject(result.body()); + logServer.acsToLms("反馈工单状态", url, String.valueOf(param), jsonObject.getString("status"), jsonObject.getString("message")); + return jsonObject; + } catch (Exception e) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("status", "400"); + jsonObject.put("message", e.getMessage()); + logServer.acsToLms("反馈工单状态", url, String.valueOf(param), jsonObject.getString("status"), jsonObject.getString("message")); + return jsonObject; } - return null; } - @Override - public HttpResponse applyInCacheLineTask(JSONObject param) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - // TODO 还没向地址表中添加 applyInCacheLineTask地址 - AddressDto addressDto = addressService.findByCode("applyInCacheLineTask"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackOrderStatus----请求参数{}", param); - try { - result = HttpRequest.post(url) - .body(String.valueOf(param)) - .execute(); - String type = ""; - if (result.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - - log.info("applyInCacheLineTask----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } - return null; - } @Override - public HttpResponse applyOutCacheLineTask(JSONObject param) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + public JSONObject apply(JSONObject param) { + String url = ""; + try { String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - // TODO 还没向地址表中添加 applyOutCacheLineTask - AddressDto addressDto = addressService.findByCode("applyOutCacheLineTask"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackOrderStatus----请求参数{}", param); - try { - result = HttpRequest.post(url) - .body(String.valueOf(param)) - .execute(); - String type = ""; - if (result.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - - log.info("applyOutCacheLineTask----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } - return null; - } - - @Override - public HttpResponse apply(JSONObject param) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - // TODO 还没向地址表中添加 apply AddressDto addressDto = addressService.findByCode("apply"); String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("apply----请求参数{}", param); - try { - result = HttpRequest.post(url) - .body(String.valueOf(param)) - .execute(); - String type = ""; - if (result.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - - log.info("apply----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; + url = wmsUrl + methods_url; + HttpResponse result = + HttpRequest + .post(url) + .body(JSON.toJSONString(param)) + .execute(); + JSONObject jsonObject = JSONObject.parseObject(result.body()); + logServer.acsToLms("acs申请任务", url, String.valueOf(param), jsonObject.getString("status"), jsonObject.getString("message")); + return jsonObject; + } catch (Exception e) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("status", "400"); + jsonObject.put("message", e.getMessage()); + logServer.acsToLms("acs申请任务", url, String.valueOf(param), jsonObject.getString("status"), jsonObject.getString("message")); + return jsonObject; } - return null; } @Override - public HttpResponse orderConfirm(JSONObject param) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + public JSONObject orderConfirm(JSONObject param) { + String url = ""; + try { String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - // TODO 还没向地址表中添加 orderConfirm AddressDto addressDto = addressService.findByCode("orderConfirm"); String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("orderConfirm----请求参数{}", param); - try { - result = HttpRequest.post(url) - .body(String.valueOf(param)) - .execute(); - String type = ""; - if (result.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - - log.info("orderConfirm----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; + url = wmsUrl + methods_url; + HttpResponse result = + HttpRequest + .post(url) + .body(JSON.toJSONString(param)) + .execute(); + JSONObject jsonObject = JSONObject.parseObject(result.body()); + logServer.acsToLms("人工排产确认", url, String.valueOf(param), jsonObject.getString("status"), jsonObject.getString("message")); + return jsonObject; + } catch (Exception e) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("status", "400"); + jsonObject.put("message", e.getMessage()); + logServer.acsToLms("人工排产确认", url, String.valueOf(param), jsonObject.getString("status"), jsonObject.getString("message")); + return jsonObject; } - return null; } @Override - public HttpResponse updateBarcode(JSONObject param) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + public JSONObject updateBarcode(JSONObject param) { + String url = ""; + try { String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); - // TODO 还没向地址表中添加 orderConfirm AddressDto addressDto = addressService.findByCode("updateBarcode"); String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("orderConfirm----请求参数{}", param); - try { - result = HttpRequest.post(url) - .body(String.valueOf(param)) - .execute(); - String type = ""; - if (result.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - - log.info("orderConfirm----返回参数{}", result); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; + url = wmsUrl + methods_url; + HttpResponse result = + HttpRequest + .post(url) + .body(JSON.toJSONString(param)) + .execute(); + JSONObject jsonObject = JSONObject.parseObject(result.body()); + logServer.acsToLms("更新条码", url, String.valueOf(param), jsonObject.getString("status"), jsonObject.getString("message")); + return jsonObject; + } catch (Exception e) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("status", "400"); + jsonObject.put("message", e.getMessage()); + logServer.acsToLms("更新条码", url, String.valueOf(param), jsonObject.getString("status"), jsonObject.getString("message")); + return jsonObject; } - return null; } } 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 c1c4675..09f36cd 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 @@ -8,31 +8,26 @@ import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; -import org.nl.acs.common.IDriverService; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.dto.DeviceDto; -import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver; -import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver; -import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; import org.nl.acs.device_driver.hongfeng.hf_station.HfStationDeviceDriver; import org.nl.acs.ext.wms.service.WmsToAcsService; 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.opc.Device; import org.nl.acs.opc.DeviceAppService; -import org.nl.acs.opc.DeviceExtraManageDto; 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.acs.task.service.dto.TaskDto; -import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.system.service.ParamService; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.exception.WDKException; import org.nl.modules.wql.util.SpringContextHolder; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationContext; -import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import java.math.BigDecimal; @@ -52,9 +47,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { private final DeviceAppService deviceAppService; private final RouteLineService routeLineService; private final ProduceshiftorderService produceshiftorderService; + private final DeviceExecuteLogService logServer; @Override public Map createFromWms(String param) { + logServer.lmsToAcs("lmsToAcs", "创建任务", String.valueOf(param)); JSONArray tasks = JSONArray.parseArray(param); JSONObject resultJson = new JSONObject(); log.info("createFromWms--------------:输入参数:" + tasks.toString()); @@ -185,6 +182,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Override public Map order(String jsonObject) { + logServer.lmsToAcs("lmsToAcs", "创建工单", jsonObject); JSONArray orders = JSONArray.parseArray(jsonObject); log.info("order--------------:输入参数" + orders.toString()); for (int i = 0; i < orders.size(); i++) { @@ -238,6 +236,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Override public Map orderStatusUpdate(String jsonObject) { + logServer.lmsToAcs("lmsToAcs", "更新工单状态", jsonObject); JSONArray orders = JSONArray.parseArray(jsonObject); log.info("order--------------:输入参数" + orders.toString()); WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder"); @@ -279,6 +278,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Override public Map cancelFromWms(String param) throws Exception { + logServer.lmsToAcs("lmsToAcs", "取消任务", param); WQLObject wo = WQLObject.getWQLObject("acs_task"); JSONArray tasks = JSONArray.parseArray(param); ParamService paramService = SpringContextHolder.getBean(ParamService.class); @@ -323,6 +323,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { @Override public Map forceFinishFromWms(String param) throws Exception { + logServer.lmsToAcs("lmsToAcs", "完成任务", param); WQLObject wo = WQLObject.getWQLObject("acs_task"); JSONArray tasks = JSONArray.parseArray(param); ParamService paramService = SpringContextHolder.getBean(ParamService.class); @@ -362,156 +363,4 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { return resultJson; } - @Override - public Map updateDeviceGoodsFromWms(String param) { - JSONArray datas = JSONArray.parseArray(param); - log.info("updateDeviceGoodsFromWms--------------:输入参数" + datas.toString()); - for (int i = 0; i < datas.size(); i++) { - JSONObject data = datas.getJSONObject(i); - String device_code = data.getString("point_code"); - String has_goods = data.getString("has_goods"); - - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - jo.put("hasGoodStatus", has_goods); - deviceService.changeDeviceStatus(jo); - - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", new JSONObject()); - log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString()); - return resultJson; - } - - @Override - public Map areaControl(JSONObject form) { - String device_code = form.getString("device_code"); - String type = form.getString("type"); - - Device device = deviceAppService.findDeviceByCode(device_code); - - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", new JSONObject()); - log.info("updateDeviceGoodsFromWms--------------:输出参数" + resultJson.toString()); - return resultJson; - } - - @Override - public Map putAction(String jsonObject) throws Exception { - JSONArray datas = JSONArray.parseArray(jsonObject); - log.info("putAction--------------:输入参数" + datas.toString()); - for (int i = 0; i < datas.size(); i++) { - JSONObject data = datas.getJSONObject(i); - String device_code = data.getString("device_code"); - String code = data.getString("code"); - String value = data.getString("value"); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", new JSONObject()); - log.info("putAction--------------:输出参数" + resultJson.toString()); - return resultJson; - } - - @Override - public Map queryDevice(String jsonObject) throws Exception { - log.info("queryDevice--------------:输入参数" + jsonObject.toString()); - JSONArray backja = new JSONArray(); - JSONArray datas = JSONArray.parseArray(jsonObject); - - //空托盘叠盘位 - EmptyVehicleStackingPositionDeviceDriver emptyVehicleStackingPositionDeviceDriver; - //货梯对接线 - CargoLiftConveyorDeviceDriver cargoLiftConveyorDeviceDriver; - //货梯对接线-带扫码器 - StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver; - - if (datas.size() == 0) { - throw new BadRequestException("缺少输入参数!"); - } - - for (int i = 0; i < datas.size(); i++) { - JSONObject jo = new JSONObject(); - JSONObject data = datas.getJSONObject(i); - String device_code = data.getString("device_code"); - Device device = deviceAppService.findDeviceByCode(device_code); - if (ObjectUtil.isEmpty(device)) { - throw new Exception("未找到对应设备:" + device_code); - } - - if (device.getDeviceDriver() instanceof EmptyVehicleStackingPositionDeviceDriver) { - emptyVehicleStackingPositionDeviceDriver = (EmptyVehicleStackingPositionDeviceDriver) device.getDeviceDriver(); - jo.put("device_code", device.getDevice_code()); - jo.put("vehicle_num", emptyVehicleStackingPositionDeviceDriver.getNumber()); - } else if (device.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { - cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) device.getDeviceDriver(); - jo.put("device_code", device.getDevice_code()); - jo.put("move", cargoLiftConveyorDeviceDriver.getMove()); - jo.put("action", cargoLiftConveyorDeviceDriver.getAction()); - jo.put("error", cargoLiftConveyorDeviceDriver.getError()); - } else if (device.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) { - standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) device.getDeviceDriver(); - jo.put("device_code", device.getDevice_code()); - jo.put("move", standardCoveyorControlWithScannerDeviceDriver.getMove()); - jo.put("action", standardCoveyorControlWithScannerDeviceDriver.getAction()); - jo.put("error", standardCoveyorControlWithScannerDeviceDriver.getError()); - } else { - jo.put("device_code", device.getDevice_code()); - } - backja.add(jo); - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK.value()); - resultJson.put("message", "操作成功"); - resultJson.put("data", backja); - log.info("queryDevice--------------:输出参数" + resultJson.toString()); - return resultJson; - } - - - @Override - public Map queryDeviceDBValue(String whereJson) { - JSONArray datas = JSONArray.parseArray(whereJson); - log.info("orderStatusUpdate--------------:输入参数" + datas.toString()); - JSONObject map = new JSONObject(); - if (datas.size() > 0) { - for (int i = 0; i < datas.size(); i++) { - JSONObject jsonObject = datas.getJSONObject(i); - String device_code = jsonObject.getString("device_code"); - String dbName = jsonObject.getString("DB"); - Device device = deviceAppService.findDeviceByCode(device_code); - List extra = device.getExtra(); - for (int j = 0; j < extra.size(); j++) { - DeviceExtraManageDto deviceExtraManageDto = extra.get(j); - String deviceCode = deviceExtraManageDto.getDevice_code(); - String extra_name = deviceExtraManageDto.getExtra_name(); - if (deviceCode.equals(device_code) && extra_name.equals(dbName)) { - String extra_code = deviceExtraManageDto.getExtra_code(); - String[] split = extra_code.split("\\."); - extra_code = split[split.length - 1]; - extra_code = extra_code.substring(0, 1).toUpperCase() + extra_code.substring(1); - IDriverService driverService = applicationContext.getBean(device.getDeviceDriverDefination().getDriverCode(), IDriverService.class); - Integer dbValue = driverService.getDbValue(device, extra_code); - map.put(dbName, dbValue); - break; - } - } - } - } - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", map); - return resultJson; - } - } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 31c1ee8..29aa0e2 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -17,9 +17,6 @@ import org.nl.acs.agv.server.*; import org.nl.acs.auto.initial.ApplicationAutoInitial; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.impl.DeviceServiceImpl; -import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver; -import org.nl.acs.device_driver.basedriver.haokai_auto_conveyor.HaoKaiAutoConveyorDeviceDriver; -import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; @@ -320,62 +317,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu Device startdevice = appService.findDeviceByCode(dto.getStart_device_code()); Device nextdevice = appService.findDeviceByCode(dto.getNext_device_code()); - CargoLiftConveyorDeviceDriver cargoLiftConveyorDeviceDriver; - HaoKaiAutoConveyorDeviceDriver haoKaiAutoConveyorDeviceDriver; - StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver; - //输送线相关需要给任务字段进行赋值,通过任务来判断输送线当前执行到哪一步 - if (startdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { - cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) startdevice.getDeviceDriver(); - cargoLiftConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code())); - if (nextdevice.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) { - standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) nextdevice.getDeviceDriver(); - standardCoveyorControlWithScannerDeviceDriver.writing(1, 1); - String address = standardCoveyorControlWithScannerDeviceDriver.getExtraValue().get("address").toString(); - if (StrUtil.isEmpty(address)) { - throw new BadRequestException("设备:" + nextdevice.getDevice_code() + "未设置电气调度号!"); - } - String door = standardCoveyorControlWithScannerDeviceDriver.getExtraValue().get("door").toString(); - if (StrUtil.isEmpty(door)) { - throw new BadRequestException("设备:" + nextdevice.getDevice_code() + "未设置门!"); - } - String floor = standardCoveyorControlWithScannerDeviceDriver.getExtraValue().get("floor").toString(); - if (StrUtil.isEmpty(floor)) { - throw new BadRequestException("设备:" + nextdevice.getDevice_code() + "未设置楼层!"); - } - standardCoveyorControlWithScannerDeviceDriver.writing(2, Integer.parseInt(address)); - standardCoveyorControlWithScannerDeviceDriver.writing(3, Integer.parseInt(task_code)); - standardCoveyorControlWithScannerDeviceDriver.writing(4, Integer.parseInt(door)); - standardCoveyorControlWithScannerDeviceDriver.writing(5, Integer.parseInt(floor)); - } - } - if (startdevice.getDeviceDriver() instanceof StandardCoveyorControlWithScannerDeviceDriver) { - standardCoveyorControlWithScannerDeviceDriver = (StandardCoveyorControlWithScannerDeviceDriver) startdevice.getDeviceDriver(); - standardCoveyorControlWithScannerDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code())); - if (nextdevice.getDeviceDriver() instanceof CargoLiftConveyorDeviceDriver) { - cargoLiftConveyorDeviceDriver = (CargoLiftConveyorDeviceDriver) nextdevice.getDeviceDriver(); - cargoLiftConveyorDeviceDriver.writing(1, 1); - String address = cargoLiftConveyorDeviceDriver.getExtraValue().get("address").toString(); - if (StrUtil.isEmpty(address)) { - throw new BadRequestException("设备:" + nextdevice.getDevice_code() + "未设置电气调度号!"); - } - String door = cargoLiftConveyorDeviceDriver.getExtraValue().get("door").toString(); - if (StrUtil.isEmpty(door)) { - throw new BadRequestException("设备:" + nextdevice.getDevice_code() + "未设置门!"); - } - String floor = cargoLiftConveyorDeviceDriver.getExtraValue().get("floor").toString(); - if (StrUtil.isEmpty(floor)) { - throw new BadRequestException("设备:" + nextdevice.getDevice_code() + "未设置楼层!"); - } - cargoLiftConveyorDeviceDriver.writing(2, Integer.parseInt(address)); - cargoLiftConveyorDeviceDriver.writing(3, Integer.parseInt(task_code)); - cargoLiftConveyorDeviceDriver.writing(4, Integer.parseInt(door)); - cargoLiftConveyorDeviceDriver.writing(5, Integer.parseInt(floor)); - } - } - if (startdevice.getDeviceDriver() instanceof HaoKaiAutoConveyorDeviceDriver) { - haoKaiAutoConveyorDeviceDriver = (HaoKaiAutoConveyorDeviceDriver) startdevice.getDeviceDriver(); - haoKaiAutoConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code())); - } try { String start_device_code = task.getStart_device_code(); @@ -621,7 +562,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu Device nextdevice = appService.findDeviceByCode(dto.getNext_device_code()); StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; - StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver; if (!ObjectUtils.isEmpty(nextdevice.getExtraValue().get("link_three_lamp"))) { String lamd_device = nextdevice.getExtraValue().get("link_three_lamp").toString(); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/log/service/DeviceExecuteLogService.java b/acs/nladmin-system/src/main/java/org/nl/acs/log/service/DeviceExecuteLogService.java index 403c250..3c7b63d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/log/service/DeviceExecuteLogService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/log/service/DeviceExecuteLogService.java @@ -20,4 +20,16 @@ public interface DeviceExecuteLogService { * @param message 日志信息 */ void deviceExecuteLog(String device_code, String vehicle_code, String inst_code, String message); + + void deviceInfo(String title, String device_code, String message); + + void deviceError(String title, String device_code, String message); + + void queryTask(String title, String device_code, String message); + + void writeLog(String title, String device_code, String message); + + void acsToLms(String title, String requestUrl, String requestParam, String responseCode, String responseMessage); + + void lmsToAcs(String title, String requestType, String requestParam); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/log/service/impl/DeviceExecuteLogServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/log/service/impl/DeviceExecuteLogServiceImpl.java index 9f13ac6..1bb942d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/log/service/impl/DeviceExecuteLogServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/log/service/impl/DeviceExecuteLogServiceImpl.java @@ -3,6 +3,7 @@ package org.nl.acs.log.service.impl; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.StrUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.log.service.DeviceExecuteLogService; @@ -36,6 +37,70 @@ public class DeviceExecuteLogServiceImpl implements DeviceExecuteLogService { MDC.remove("device_code_log"); } } + + @Override + public void deviceInfo(String title, String device_code, String message) { + try { + MDC.put("device_code_log", title); + log.info("日志主题:{},设备编码:{},消息:{}", title, device_code, message); + } finally { + MDC.remove("device_code_log"); + } + } + + @Override + public void deviceError(String title, String device_code, String message) { + try { + MDC.put("device_code_log", title); + log.error("日志主题:{},设备编码:{},消息:{}", title, device_code, message); + } finally { + MDC.remove("device_code_log"); + } + } + + @Override + public void queryTask(String title, String device_code, String message) { + try { + MDC.put("device_code_log", title); + log.error("日志主题:{},设备编码:{},消息:{}", title, device_code, message); + } finally { + MDC.remove("device_code_log"); + } + } + + @Override + public void writeLog(String title, String device_code, String message) { + try { + MDC.put("device_code_log", title); + log.error("日志主题:{},设备编码:{},消息:{}", title, device_code, message); + } finally { + MDC.remove("device_code_log"); + } + } + + @Override + public void acsToLms(String title, String requestUrl, String requestParam, String responseCode, String responseMessage) { + try { + MDC.put("device_code_log", title); + if (StrUtil.equals(responseCode, "200")) { + log.info("日志标题:{},请求路径:{},请求参数:{},响应编码:{},响应消息:{}", title, requestUrl, requestParam, responseCode, responseMessage); + } else { + log.error("日志标题:{},请求路径:{},请求参数:{},响应编码:{},响应消息:{}", title, requestUrl, requestParam, responseCode, responseMessage); + } + } finally { + MDC.remove("device_code_log"); + } + } + + @Override + public void lmsToAcs(String title, String requestType, String requestParam) { + try { + MDC.put("device_code_log", title); + log.error("日志主题:{},请求类型:{},请求参数:{}", title, requestType, requestParam); + } finally { + MDC.remove("device_code_log"); + } + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java b/acs/nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java index 4f5df86..4d08718 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java @@ -83,6 +83,15 @@ public class ProduceshiftorderController { return new ResponseEntity<>(HttpStatus.CREATED); } + @PostMapping("/issued") + @Log("下发电气工单信息") + @ApiOperation("下发电气工单信息") + //@PreAuthorize("@el.check('produceshiftorder:add')") + public ResponseEntity issued(@RequestBody JSONObject param){ + produceshiftorderService.issued(param); + return new ResponseEntity<>(HttpStatus.CREATED); + } + @PostMapping("/synchron") @Log("工单同步") @ApiOperation("工单同步") diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java b/acs/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java index 571976d..10dc966 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java @@ -92,6 +92,7 @@ public interface ProduceshiftorderService { * @param param */ void finishd(JSONObject param); + void issued(JSONObject param); /** * 数据同步 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java index 14dea09..daceb87 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java @@ -137,11 +137,11 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A if (device.getDeviceDriver() instanceof HfStationDeviceDriver) { hfStationDeviceDriver = (HfStationDeviceDriver) device.getDeviceDriver(); - hfStationDeviceDriver.writing("to_order",dto.getOrder_code()); - hfStationDeviceDriver.writing("to_order_num",String.valueOf(dto.getQty())); - hfStationDeviceDriver.writing("to_product_number",dto.getMaterial_code()); + hfStationDeviceDriver.writing("to_order", dto.getOrder_code()); + hfStationDeviceDriver.writing("to_order_num", String.valueOf(dto.getQty())); + hfStationDeviceDriver.writing("to_product_number", dto.getMaterial_code()); + hfStationDeviceDriver.writing("to_command", "3"); } - JSONObject json = (JSONObject) JSONObject.toJSON(dto); wo.insert(json); order.add(dto); @@ -249,7 +249,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A String ext_order_id = param.getString("ext_order_id"); String order_code = param.getString("order_code"); if (StrUtil.isNotEmpty(ext_order_id)) { - param.put("ext_order_id",ext_order_id); + param.put("ext_order_id", ext_order_id); acsToWmsService.feedbackOrderStatus(param); } JSONObject map1 = new JSONObject(); @@ -262,9 +262,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A String device_code = param.getString("device_code"); HfStationDeviceDriver hfStationDeviceDriver; Device device = deviceAppService.findDeviceByCode(device_code); - if (device.getDeviceDriver() instanceof HfStationDeviceDriver){ + if (device.getDeviceDriver() instanceof HfStationDeviceDriver) { hfStationDeviceDriver = (HfStationDeviceDriver) device.getDeviceDriver(); - hfStationDeviceDriver.writing("to_command","5"); + hfStationDeviceDriver.writing("to_command", "5"); } Iterator iterator = order.iterator(); while (iterator.hasNext()) { @@ -275,6 +275,30 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A } } + @Override + public void issued(JSONObject param) { + param = param.getJSONObject("data"); + String order_id = param.getString("order_id"); + ProduceshiftorderDto produceshiftorderDto = this.findById(order_id); + if (ObjectUtil.isNotEmpty(produceshiftorderDto)) { + String device_code = produceshiftorderDto.getDevice_code(); + Device device = deviceAppService.findDeviceByCode(device_code); + HfStationDeviceDriver hfStationDeviceDriver; + if (device.getDeviceDriver() instanceof HfStationDeviceDriver) { + hfStationDeviceDriver = (HfStationDeviceDriver) device.getDeviceDriver(); + String order = hfStationDeviceDriver.getOrder(); + if (StrUtil.isNotEmpty(order)){ + throw new BadRequestException("该设备已下发工单信息!"); + } + hfStationDeviceDriver = (HfStationDeviceDriver) device.getDeviceDriver(); + hfStationDeviceDriver.writing("to_order", produceshiftorderDto.getOrder_code()); + hfStationDeviceDriver.writing("to_order_num", String.valueOf(produceshiftorderDto.getQty())); + hfStationDeviceDriver.writing("to_product_number", produceshiftorderDto.getMaterial_code()); + hfStationDeviceDriver.writing("to_command", "3"); + } + } + } + @Override public List findAllOrderFromCache() { return order; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskFeedbackServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskFeedbackServiceImpl.java index dd4d38a..bd58822 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskFeedbackServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskFeedbackServiceImpl.java @@ -68,7 +68,7 @@ public class TaskFeedbackServiceImpl implements TaskFeedbackService { public TaskFeedbackDto findById(String taskback_id) { WQLObject wo = WQLObject.getWQLObject("acs_task_feedback"); JSONObject json = wo.query("taskback_id ='" + taskback_id + "'").uniqueResult(0); - final TaskFeedbackDto obj = json.toJavaObject(TaskFeedbackDto.class); + final TaskFeedbackDto obj = json.toJavaObject(TaskFeedbackDto.class); return obj; } @@ -76,7 +76,7 @@ public class TaskFeedbackServiceImpl implements TaskFeedbackService { public TaskFeedbackDto findByCode(String code) { WQLObject wo = WQLObject.getWQLObject("acs_task_feedback"); JSONObject json = wo.query("task_code ='" + code + "' and is_finished='0' ").uniqueResult(0); - if (ObjectUtil.isEmpty(json)){ + if (ObjectUtil.isEmpty(json)) { return null; } final TaskFeedbackDto obj = json.toJavaObject(TaskFeedbackDto.class); @@ -96,7 +96,7 @@ public class TaskFeedbackServiceImpl implements TaskFeedbackService { dto.setCreate_time(now); WQLObject wo = WQLObject.getWQLObject("acs_task_feedback"); - JSONObject json = (JSONObject) JSONObject.toJSON(dto); + JSONObject json = (JSONObject) JSONObject.toJSON(dto); wo.insert(json); } @@ -113,7 +113,7 @@ public class TaskFeedbackServiceImpl implements TaskFeedbackService { dto.setUpdate_by(currentUsername); WQLObject wo = WQLObject.getWQLObject("acs_task_feedback"); - JSONObject json = (JSONObject) JSONObject.toJSON(dto); + JSONObject json = (JSONObject) JSONObject.toJSON(dto); wo.update(json); } @@ -171,17 +171,15 @@ public class TaskFeedbackServiceImpl implements TaskFeedbackService { feed_jo.put("task_status", entity.getTask_status()); JSONArray ja = new JSONArray(); ja.add(feed_jo); - HttpResponse body = null; String error_message = null; + JSONObject resp = new JSONObject(); try { - body = acstowmsService.feedbackTaskStatusToWms(ja); + resp = acstowmsService.feedbackTaskStatusToWms(ja); } catch (Exception e) { error_message = e.getMessage(); e.printStackTrace(); } - int status = body.getStatus(); - JSONObject jo = (JSONObject) JSONObject.toJSON(body.body()); - + int status = Integer.parseInt(resp.getString("status")); dto.setTask_status(entity.getTask_status()); if (status == 200) { dto.setIs_finished("1"); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 9811244..20514cd 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -568,10 +568,10 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { JSONArray ja = new JSONArray(); ja.add(feed_jo); String message = null; - HttpResponse body = null; boolean flag = false; + JSONObject resp = new JSONObject(); try { - body = acstowmsService.feedbackTaskStatusToWms(ja); + resp = acstowmsService.feedbackTaskStatusToWms(ja); } catch (Exception e) { flag = true; message = e.getMessage(); @@ -606,8 +606,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { taskFeedbackService.update(feefbackdto); } } else { - int status = body.getStatus(); - JSONObject jo = JSONObject.parseObject(body.body()); + int status = Integer.parseInt(resp.getString("status")); if (ObjectUtil.isEmpty(feefbackdto)) { feefbackdto = new TaskFeedbackDto(); feefbackdto.setTask_id(entity.getTask_id()); @@ -615,7 +614,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { feefbackdto.setTask_status(entity.getTask_status()); feefbackdto.setVehicle_type(entity.getVehicle_type()); feefbackdto.setVehicle_code(entity.getVehicle_code()); - feefbackdto.setError_code(String.valueOf(body.getStatus())); + feefbackdto.setError_code(String.valueOf(status)); feefbackdto.setStart_device_code(entity.getStart_device_code()); feefbackdto.setStart_point_code(entity.getNext_point_code()); feefbackdto.setNext_device_code(entity.getNext_device_code()); @@ -628,7 +627,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { } } else { feefbackdto.setIs_finished("0"); - feefbackdto.setRemark(jo.getString("message")); + feefbackdto.setRemark(resp.getString("message")); } taskFeedbackService.create(feefbackdto); } else { @@ -685,10 +684,10 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { JSONArray ja = new JSONArray(); ja.add(feed_jo); String message = null; - HttpResponse body = null; + JSONObject resp = new JSONObject(); boolean flag = false; try { - body = acstowmsService.feedbackTaskStatusToWms(ja); + resp = acstowmsService.feedbackTaskStatusToWms(ja); } catch (Exception e) { flag = true; message = e.getMessage(); @@ -723,8 +722,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { taskFeedbackService.update(feefbackdto); } } else { - int status = body.getStatus(); - JSONObject jo = JSONObject.parseObject(body.body()); + int status = Integer.parseInt(resp.getString("status")); if (ObjectUtil.isEmpty(feefbackdto)) { feefbackdto = new TaskFeedbackDto(); feefbackdto.setTask_id(entity.getTask_id()); @@ -732,7 +730,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { feefbackdto.setTask_status(entity.getTask_status()); feefbackdto.setVehicle_type(entity.getVehicle_type()); feefbackdto.setVehicle_code(entity.getVehicle_code()); - feefbackdto.setError_code(String.valueOf(body.getStatus())); + feefbackdto.setError_code(String.valueOf(status)); feefbackdto.setStart_device_code(entity.getStart_device_code()); feefbackdto.setStart_point_code(entity.getNext_point_code()); feefbackdto.setNext_device_code(entity.getNext_device_code()); @@ -745,7 +743,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { } } else { feefbackdto.setIs_finished("0"); - feefbackdto.setRemark(jo.getString("message")); + feefbackdto.setRemark(resp.getString("message")); } taskFeedbackService.create(feefbackdto); } else { @@ -758,7 +756,7 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { } } else { feefbackdto.setIs_finished("0"); - feefbackdto.setRemark(jo.getString("message")); + feefbackdto.setRemark(resp.getString("message")); } taskFeedbackService.update(feefbackdto); } diff --git a/acs/nladmin-ui/src/api/acs/order/produceshiftorder.js b/acs/nladmin-ui/src/api/acs/order/produceshiftorder.js index 1c478c4..964e611 100644 --- a/acs/nladmin-ui/src/api/acs/order/produceshiftorder.js +++ b/acs/nladmin-ui/src/api/acs/order/produceshiftorder.js @@ -32,6 +32,14 @@ export function finishd(data) { }) } +export function issued(data) { + return request({ + url: 'api/produceshiftorder/issued', + method: 'post', + data + }) +} + export function synchron() { return request({ url: 'api/produceshiftorder/synchron', @@ -39,4 +47,4 @@ export function synchron() { }) } -export default { add, edit, del, finishd, synchron } +export default { add, edit, del, finishd, issued, synchron } diff --git a/acs/nladmin-ui/src/views/acs/order/index.vue b/acs/nladmin-ui/src/views/acs/order/index.vue index b6b6ce0..3f2c69f 100644 --- a/acs/nladmin-ui/src/views/acs/order/index.vue +++ b/acs/nladmin-ui/src/views/acs/order/index.vue @@ -4,6 +4,17 @@
+ + 下发命令 + { + this.crud.notify('下发成功', CRUD.NOTIFICATION_TYPE.SUCCESS) + this.crud.toQuery() + }) + }, synchron() { crudProduceshiftorder.synchron().then(res => { this.crud.notify('同步成功', CRUD.NOTIFICATION_TYPE.SUCCESS) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 08e0822..d4f2f11 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -238,7 +238,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { map.put("realproduceend_date", now); wo.update(map, "workorder_id = '" + ext_order_id + "'"); JSONObject result = new JSONObject(); - result.put("status", HttpStatus.OK.value()); + result.put("status", "200"); result.put("message", "任务状态反馈成功!"); return result; } @@ -321,18 +321,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { //如果是的话说明困料区来的 先去库存表查询对应的条码的物料信息 并将对应的物料信息保存在redis中 if (StrUtil.equals(is_first, "true")) { JSONObject ivtJson = wo_ivt.query("vehicle_code = '" + barcode + "'").uniqueResult(0); - redisUtils.set(barcode,ivtJson.getString("material_id")); - redisUtils.set(barcode+"-ivt_qty",ivtJson.getString("ivt_qty")); + redisUtils.set(barcode, ivtJson.getString("material_id")); + redisUtils.set(barcode + "-ivt_qty", ivtJson.getString("ivt_qty")); materialbaseDto = materialbaseService.findById(ivtJson.getLong("material_id")); } String material_id = String.valueOf(redisUtils.get(barcode)); - String ivt_qty = String.valueOf(redisUtils.get(barcode+"-ivt_qty")); + String ivt_qty = String.valueOf(redisUtils.get(barcode + "-ivt_qty")); Long materialId = null; String point_status = "2"; - if (StrUtil.equals("0",barcode)){ + if (StrUtil.equals("0", barcode)) { point_status = "1"; } - if (StrUtil.isNotEmpty(material_id)){ + if (StrUtil.isNotEmpty(material_id)) { point_status = "3"; materialId = Long.valueOf(materialId); } @@ -351,21 +351,21 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { structivtService.update(structivtDto); //同时修改该工位的点位状态 JSONObject pointJson = wo.query("point_code = '" + device_code + "'").uniqueResult(0); - pointJson.put("point_status",point_status); - pointJson.put("update_time",DateUtil.now()); + pointJson.put("point_status", point_status); + pointJson.put("update_time", DateUtil.now()); wo.update(pointJson); //如果是第一个工位的条码变化 则需要更新困料区等的库存信息 因为第一个是从困料区过来的 - if (StrUtil.equals(is_first,"true")){ + if (StrUtil.equals(is_first, "true")) { //获取困料区的缓存信息 LinkedList ll = MyLinkedListService.getLinkedList(); if (ll.size() == 0) ll = structivtService.reload(); Boolean isHasGoods = false; JSONObject jsonObject = wo.query("is_used = '1' and is_delete = '0' and lock_type = '2' and region_code = '" + RegionTypeEnum.GT1.getCode() + "'").uniqueResult(0); JSONObject ivtJsonObject = new JSONObject(); - if (ObjectUtil.isNotEmpty(jsonObject)){ + if (ObjectUtil.isNotEmpty(jsonObject)) { ivtJsonObject = wo_ivt.query("point_code = '" + jsonObject.getString("point_code") + "' and (vehicle_code <> '' or vehicle_code is not null)").uniqueResult(0); - if (ObjectUtil.isNotEmpty(ivtJsonObject)){ + if (ObjectUtil.isNotEmpty(ivtJsonObject)) { isHasGoods = true; } } @@ -378,7 +378,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { if (ObjectUtil.isNotEmpty(materialbaseDto)) { map.put("material_code", materialbaseDto.getMaterial_code()); } - map.put("ivt_qty",ivtJsonObject.getString("ivt_qty")); + map.put("ivt_qty", ivtJsonObject.getString("ivt_qty")); boolean flag = klzhcwUtil.judge(ll, map); if (flag) { jsonObject.put("lock_type", "1"); @@ -417,33 +417,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public JSONObject orderConfirm(JSONObject whereJson) { JSONObject resp = new JSONObject(); - WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder"); - String device_code = whereJson.getString("device_code"); - String material_code = whereJson.getString("material_code"); - String order_code = whereJson.getString("order_code"); String ext_order_id = whereJson.getString("ext_order_id"); - DeviceDto deviceDto = deviceService.findByCode(device_code); - MaterialbaseDto materialbaseDto = materialbaseService.findByCode(material_code); - if (ObjectUtil.isEmpty(deviceDto)) { - throw new BadRequestException("设备不存在:" + device_code); - } - if (ObjectUtil.isEmpty(materialbaseDto)) { - throw new BadRequestException("物料不存在::" + material_code); - } - JSONObject jsonObject = wo.query("workorder_id = '" + ext_order_id + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(jsonObject)) { - boolean material_flag = StrUtil.equals(String.valueOf(materialbaseDto.getMaterial_id()), jsonObject.getString("material_id")); - boolean device_flag = StrUtil.equals(String.valueOf(deviceDto.getDevice_id()), jsonObject.getString("device_id")); - if (material_flag && device_flag) { - resp.put("status", "200"); - resp.put("message", "人工排产确认成功!"); - return resp; - } - } else { - throw new BadRequestException("工单不存在!" + order_code); - } - resp.put("status", "400"); - resp.put("message", "人工排产确认失败!"); + WorkorderDto dto = workordeService.findById(Long.valueOf(ext_order_id)); + dto.setOrder_status("3"); + dto.setUpdate_time(DateUtil.now()); + workordeService.update(dto); + resp.put("status", "200"); + resp.put("message", "人工排产确认成功!"); return resp; } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java index 5bead7e..d06a721 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java @@ -206,15 +206,15 @@ public class WorkorderServiceImpl implements WorkordeService { JSONArray array = new JSONArray(); JSONObject map = new JSONObject(); - map.put("ext_order_id",json.getString("workorder_id")); - map.put("order_code",json.getString("workorder_code")); - map.put("qty",json.getString("plan_qty")); - map.put("material_code",jsonObject.getString("material_code")); - map.put("device_code",json.getString("device_code")); + map.put("ext_order_id", json.getString("workorder_id")); + map.put("order_code", json.getString("workorder_code")); + map.put("qty", json.getString("plan_qty")); + map.put("material_code", jsonObject.getString("material_code")); + map.put("device_code", json.getString("device_code")); array.add(map); Map resp = wmsToAcsService.order(array); - if (StrUtil.equals(String.valueOf(resp.get("status")),"200")){ - json.put("order_status", "3"); + if (StrUtil.equals(String.valueOf(resp.get("status")), "200")) { + json.put("order_status", "2"); json.put("update_optid", currentUserId); json.put("update_optname", nickName); json.put("update_time", now); @@ -298,7 +298,7 @@ public class WorkorderServiceImpl implements WorkordeService { produceorderMap.put("update_optid", currentUserId); produceorderMap.put("update_optname", nickName); produceorderMap.put("update_time", now); - if (order_status.equals("01")){ + if (order_status.equals("01")) { produceorderMap.put("realproducestart_date", now); } wo.update(produceorderMap); @@ -321,15 +321,15 @@ public class WorkorderServiceImpl implements WorkordeService { // TODO JSONArray array = new JSONArray(); JSONObject acsObj = new JSONObject(); - acsObj.put("ext_order_id",workorder_id); - acsObj.put("is_needmove",is_needmove); - acsObj.put("order_code",produceorder_code); - acsObj.put("qty",plan_qty); - acsObj.put("material_uuid",material_id); - acsObj.put("material_code",material_code); - acsObj.put("material_name",material_name); - acsObj.put("material_spec",material_spec); - acsObj.put("device_code",device_code); + acsObj.put("ext_order_id", workorder_id); + acsObj.put("is_needmove", is_needmove); + acsObj.put("order_code", produceorder_code); + acsObj.put("qty", plan_qty); + acsObj.put("material_uuid", material_id); + acsObj.put("material_code", material_code); + acsObj.put("material_name", material_name); + acsObj.put("material_spec", material_spec); + acsObj.put("device_code", device_code); array.add(acsObj); wmsToAcsService.order(array); } else { @@ -347,8 +347,8 @@ public class WorkorderServiceImpl implements WorkordeService { // TODO JSONArray array = new JSONArray(); JSONObject map = new JSONObject(); - map.put("ext_order_id",workorder_id); - map.put("type","2"); + map.put("ext_order_id", workorder_id); + map.put("type", "2"); array.add(map); wmsToAcsService.orderStatusUpdate(array); } @@ -370,12 +370,12 @@ public class WorkorderServiceImpl implements WorkordeService { WQLObject wo = WQLObject.getWQLObject("PDM_BD_WORKORDER"); JSONObject jsonObject = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0); JSONObject produceorderMap = new JSONObject(); - produceorderMap.put("workorder_id",workorder_id); - if (row.getString("report_qty").equals("0") || StrUtil.isEmpty(row.getString("report_qty"))){ - produceorderMap.put("report_qty",report_qty); - }else { + produceorderMap.put("workorder_id", workorder_id); + if (row.getString("report_qty").equals("0") || StrUtil.isEmpty(row.getString("report_qty"))) { + produceorderMap.put("report_qty", report_qty); + } else { Integer sum = Integer.parseInt(row.getString("report_qty")) + Integer.parseInt(report_qty); - produceorderMap.put("report_qty",sum); + produceorderMap.put("report_qty", sum); } produceorderMap.put("order_status", "03"); produceorderMap.put("update_optid", currentUserId); @@ -385,20 +385,20 @@ public class WorkorderServiceImpl implements WorkordeService { //同时修改这条工单对应的记录表中最新的一条数据的报工数量 WQLObject wo_record = WQLObject.getWQLObject("MPS_BD_MacOperateRecord"); //获取最新的工单的对应记录信息 - JSONObject newRecord = wo_record.query("workorder_id = '"+workorder_id+"' and (operatetime_end is null or operatetime_end = '')").uniqueResult(0); - newRecord.put("report_qty",report_qty); - newRecord.put("finish_qty",jsonObject.getString("real_qty")); + JSONObject newRecord = wo_record.query("workorder_id = '" + workorder_id + "' and (operatetime_end is null or operatetime_end = '')").uniqueResult(0); + newRecord.put("report_qty", report_qty); + newRecord.put("finish_qty", jsonObject.getString("real_qty")); Integer finishproduct_qty = Integer.parseInt(jsonObject.getString("real_qty")) - Integer.parseInt(newRecord.getString("init_qty")); - newRecord.put("finishproduct_qty",finishproduct_qty); - newRecord.put("operatetime_end",now); + newRecord.put("finishproduct_qty", finishproduct_qty); + newRecord.put("operatetime_end", now); wo_record.update(newRecord); //wms向acs发送请求 工单暂停 // 报工的时候同时向acs发送工单暂停状态 // TODO JSONArray array = new JSONArray(); JSONObject map = new JSONObject(); - map.put("ext_order_id",workorder_id); - map.put("type","1"); + map.put("ext_order_id", workorder_id); + map.put("type", "1"); array.add(map); wmsToAcsService.orderStatusUpdate(array); } @@ -417,14 +417,14 @@ public class WorkorderServiceImpl implements WorkordeService { // TODO JSONArray array = new JSONArray(); JSONObject map = new JSONObject(); - map.put("ext_order_id",workorder_id); - map.put("type","3"); + map.put("ext_order_id", workorder_id); + map.put("type", "3"); array.add(map); Map resp = wmsToAcsService.orderStatusUpdate(array); - if (StrUtil.equals(String.valueOf(resp.get("status")),"200")){ + if (StrUtil.equals(String.valueOf(resp.get("status")), "200")) { JSONObject produceorderMap = new JSONObject(); - produceorderMap.put("workorder_id",workorder_id); - produceorderMap.put("order_status","5"); + produceorderMap.put("workorder_id", workorder_id); + produceorderMap.put("order_status", "5"); produceorderMap.put("update_optid", currentUserId); produceorderMap.put("update_optname", nickName); produceorderMap.put("update_time", now); @@ -440,11 +440,11 @@ public class WorkorderServiceImpl implements WorkordeService { JSONObject jsonProduceShiftOrder = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0); WQLObject wo_record = WQLObject.getWQLObject("MPS_BD_MacOperateRecord"); //获取最新的工单的对应记录信息 - JSONObject jsonObject = wo_record.query("workorder_id = '"+workorder_id+"' and (operatetime_end is null or operatetime_end = '')").uniqueResult(0); + JSONObject jsonObject = wo_record.query("workorder_id = '" + workorder_id + "' and (operatetime_end is null or operatetime_end = '')").uniqueResult(0); String finish_qty = jsonProduceShiftOrder.getString("real_qty"); - jsonObject.put("finish_qty",finish_qty); + jsonObject.put("finish_qty", finish_qty); Integer finishproduct_qty = Integer.parseInt(finish_qty) - Integer.parseInt(jsonObject.getString("init_qty")); - jsonObject.put("finishproduct_qty",finishproduct_qty); + jsonObject.put("finishproduct_qty", finishproduct_qty); return jsonObject; } @@ -458,8 +458,8 @@ public class WorkorderServiceImpl implements WorkordeService { public JSONArray getDtl(JSONObject param) { final String workorder_id = param.getString("workorder_id"); JSONObject map = new JSONObject(); - map.put("flag","5"); - map.put("workorder_id",workorder_id); + map.put("flag", "5"); + map.put("workorder_id", workorder_id); JSONArray resultJSONArray = WQL.getWO("MPS_PRODUCEDURE001").addParamMap(map).process().getResultJSONArray(0); return resultJSONArray; } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/wms.xls b/lms/nladmin-system/src/main/java/org/nl/wms/wms.xls index 9638c68964adc983dc303c731e86dad144310a83..26a7f0c4e0be61eea8989f2b8aea100dc5c74094 100644 GIT binary patch delta 56 zcmZp;BG7O}U_&koOQz@czncqLwli{bFfjQ0xdwQ;I=fCbWJ_(H!PY*5jS+~MfS7sv J3^tYwWdJm}5;y<= delta 58 zcmZp;BG7O}U_&ko%ZCQ3otq0;wli`vGcYQ|$LFjop6tjLJ~@C*pm_#c`wTWlAZ7w$ L=It}sSTd9WW-b#g