From 821741ba8481f98d1b6105ba9f1f59559780b42c Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Sun, 23 Apr 2023 17:14:57 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=96=B0=E5=A2=9E=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/nl/acs/agv/server/NDCAgvService.java | 14 +- .../agv/server/impl/NDCAgvServiceImpl.java | 96 +- .../run/OneNDCSocketConnectionAutoRun.java | 32 +- .../run/TwoNDC2SocketConnectionAutoRun.java | 12 +- .../run/TwoNDCSocketConnectionAutoRun.java | 34 +- .../java/org/nl/acs/device/wql/task_inst.xls | Bin 195072 -> 196096 bytes .../acs/device_driver/FeedLmsRealFailed.java | 11 + .../agv/ndcone/AgvNdcOneDeviceDriver.java | 151 +- .../agv/ndctwo/AgvNdcTwoDeviceDriver.java | 367 ++- .../HongXiangStationDeviceDriver.java | 16 +- .../HongXiangConveyorDeviceDriver.java | 16 +- .../OvenGantryManipulatorDeviceDriver.java | 18 +- .../SiemensConveyorDeviceDriver.java | 104 +- .../SiemensConveyorCkkDeviceDriver.java | 16 +- .../SiemensConveyorLabelingDeviceDriver.java | 16 +- ...iemensOneFloorAGVConveyorDeviceDriver.java | 16 +- .../SlitTwoManipulatorDeviceDriver.java | 16 +- ...CoveyorControlWithScannerDeviceDriver.java | 48 +- .../data/ApplyLabelingAndBindingRequest.java | 2 + .../acs/ext/wms/data/CreateTaskRequest.java | 11 + .../acs/ext/wms/rest/WmsToAcsController.java | 35 + .../acs/ext/wms/service/WmsToAcsService.java | 7 + .../wms/service/impl/WmsToAcsServiceImpl.java | 280 +- .../java/org/nl/acs/history/ErrorUtil.java | 61 + .../service/dto/InstructionDto.java | 11 + .../org/nl/acs/task/service/dto/TaskDto.java | 11 + .../task/service/impl/TaskServiceImpl.java | 2894 +++++++++-------- .../modules/quartz/task/AutoCreateInst.java | 7 +- .../src/views/acs/instruction/index.vue | 5 +- acs/nladmin-ui/src/views/acs/task/index.vue | 54 +- 30 files changed, 2552 insertions(+), 1809 deletions(-) create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/FeedLmsRealFailed.java diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/NDCAgvService.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/NDCAgvService.java index 42960b7ff..cc5f8fe2a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/NDCAgvService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/NDCAgvService.java @@ -27,9 +27,17 @@ public interface NDCAgvService { * @param inst * @throws Exception */ - public void sendAgvInstToNDC(String agv_system_type,Instruction inst) throws Exception; + public void sendAgvInstToNDC(String agv_system_type, Instruction inst) throws Exception; - public byte[] sendAgvOneModeInst(int phase, int index,int result); + public byte[] sendAgvOneModeInst(int phase, int index, int result); - public byte[] sendAgvTwoModeInst(int phase, int index,int result); + public byte[] sendAgvTwoModeInst(int phase, int index, int result); + + /** + * 下发充电任务 + * + * @param carno + * @return + */ + public boolean createChargingTaskToNDC(String agv_system, String carno); } 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 61db0ffa0..994d28e52 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 @@ -26,6 +26,7 @@ import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.acs.opc.DeviceType; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.system.service.ParamService; +import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.util.SpringContextHolder; import org.springframework.stereotype.Service; @@ -73,11 +74,11 @@ public class NDCAgvServiceImpl implements NDCAgvService { log.info("下发删除AGV指令--{}", Bytes2HexString(b)); - if (StrUtil.equals(inst.getAgv_system_type(),"1")){ + if (StrUtil.equals(inst.getAgv_system_type(), "1")) { OneNDCSocketConnectionAutoRun.write(b); - } else if (StrUtil.equals(inst.getAgv_system_type(),"2")){ + } else if (StrUtil.equals(inst.getAgv_system_type(), "2")) { TwoNDCSocketConnectionAutoRun.write(b); - } else if (StrUtil.equals(inst.getAgv_system_type(),"3")){ + } else if (StrUtil.equals(inst.getAgv_system_type(), "3")) { TwoNDC2SocketConnectionAutoRun.write(b); } @@ -193,15 +194,28 @@ public class NDCAgvServiceImpl implements NDCAgvService { log.info("下发AGV作业指令--{}", str); log.info("下发agv指令数据--{}", Bytes2HexString(b)); - if (StrUtil.equals(agv_system_type,"2")){ + if (StrUtil.equals(agv_system_type, "2")) { TwoNDCSocketConnectionAutoRun.write(b); - } else if (StrUtil.equals(agv_system_type,"3")){ + } else if (StrUtil.equals(agv_system_type, "3")) { TwoNDC2SocketConnectionAutoRun.write(b); } } else { String instcode = inst.getInstruction_code(); + int startHeight = Integer.parseInt(StrUtil.isEmpty(inst.getStart_height()) ? "0" : inst.getStart_height()); + int nextHeight = Integer.parseInt(StrUtil.isEmpty(inst.getNext_height()) ? "0" : inst.getNext_height()); + //默认取货放货高度都为0 int type = Integer.parseInt(inst.getInstruction_type()); +// if (startHeight != 0 && nextHeight != 0) { +// //取货放货高度都不为0 +// type = 1; +// } else if (startHeight != 0 && nextHeight == 0) { +// //取货高度不为0 放货高度为0 +// type = 2; +// } else if (startHeight == 0 && nextHeight != 0) { +// //取货高度为0 放货高度不为0 +// type = 3; +// } int priority = Integer.parseInt(inst.getPriority()) + 128; DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); @@ -218,6 +232,12 @@ public class NDCAgvServiceImpl implements NDCAgvService { byte fhdlow = (byte) IntToHexLow(nextAddress); byte prioritylow = (byte) IntToHexLow(priority); + byte shhigh = (byte) IntToHexHigh(startHeight); + byte shlow = (byte) IntToHexLow(startHeight); + + byte nhhigh = (byte) IntToHexHigh(nextHeight); + byte nhlow = (byte) IntToHexLow(nextHeight); + String str = "十进制下发:"; String str1 = "十六进制下发:"; str += "ikey:" + (Integer.parseInt(instcode)); @@ -236,6 +256,22 @@ public class NDCAgvServiceImpl implements NDCAgvService { System.out.println(str); System.out.println(str1); +// byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, +// (byte) 0X00, (byte) 0X08, +// (byte) 0X00, (byte) 0X16, +// (byte) 0X00, (byte) 0X01, +// (byte) 0X00, (byte) 0X71, +// (byte) 0X00, (byte) 0X12, +// (byte) 0X01, prioritylow, +// (byte) 0X00, (byte) 0X01, +// (byte) ikeyhigh, (byte) ikeylow, +// (byte) ikeyhigh, (byte) ikeylow, +// (byte) typehigh, (byte) typelow, +// (byte) qhdhigh, (byte) qhdlow, +// (byte) fhdhigh, (byte) fhdlow, +// (byte) shhigh, (byte) shlow, +// (byte) nhhigh, (byte) nhlow +// }; byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, (byte) 0X00, (byte) 0X08, @@ -316,6 +352,56 @@ public class NDCAgvServiceImpl implements NDCAgvService { return b; } + @Override + public boolean createChargingTaskToNDC(String agv_system, String carno) { + + byte carhigh = (byte) IntToHexHigh(Integer.parseInt(carno)); + byte carlow = (byte) IntToHexLow(Integer.parseInt(carno)); + + String instcode = CodeUtil.getNewCode("INSTRUCT_NO"); + byte instcodehigh = (byte) IntToHexHigh(Integer.parseInt(instcode)); + byte instcodelow = (byte) IntToHexLow(Integer.parseInt(instcode)); + + String str = "十进制下发:"; + String str1 = "十六进制下发:"; + str += "carno:" + (Integer.parseInt(carno)); + str1 += "carno:" + hexToString(carhigh & 0xFF) + hexToString(carlow & 0xFF); + + str += "/instcode:" + (instcode); + str1 += "/instcode:" + hexToString(instcodehigh & 0xFF) + hexToString(instcodelow & 0xFF); + + System.out.println(str); + System.out.println(str1); + + byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, + (byte) 0X00, (byte) 0X08, + (byte) 0X00, (byte) 0X0C, + (byte) 0X00, (byte) 0X01, + (byte) 0X00, (byte) 0X71, + (byte) 0X00, (byte) 0X08, + (byte) 0X64, (byte) 0X80, + (byte) 0X00, (byte) 0X01, + (byte) instcodehigh, (byte) instcodelow, + (byte) carhigh, (byte) carlow + }; + log.info("下发AGV充电任务--{}", str1); + + try { + if (StrUtil.equals(agv_system, "1")) { + OneNDCSocketConnectionAutoRun.write(b); + } else if (StrUtil.equals(agv_system, "2")) { + TwoNDCSocketConnectionAutoRun.write(b); + } else if (StrUtil.equals(agv_system, "3")) { + TwoNDC2SocketConnectionAutoRun.write(b); + } + } catch (Exception e) { + e.getMessage(); + return false; + } + System.out.println("下发agv充电任务数据:" + Bytes2HexString(b)); + return true; + } + String hexToString(int i) { return (i < 16 ? "0" + Integer.toHexString(i) : Integer.toHexString(i)).toUpperCase(); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java index 6eb984a81..f006cffd4 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java @@ -126,14 +126,14 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { List insts = null; boolean link_flag = false; Device agv_device = null; - if(carno != 0){ + if (carno != 0) { agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno)); } if (ikey != 0) { inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); - if (ObjectUtil.isEmpty(inst)){ - inst = instructionService.findByCode(String.valueOf(ikey)); - } +// if (ObjectUtil.isEmpty(inst)){ +// inst = instructionService.findByCode(String.valueOf(ikey)); +// } } if (!ObjectUtil.isEmpty(link_inst)) { link_flag = true; @@ -163,6 +163,14 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (!ObjectUtil.isEmpty(inst)) { if (!ObjectUtil.isEmpty(inst)) { + String agvcar = inst.getCarno(); + Device agvDevice = deviceAppService.findDeviceByCode(agvcar); + if (agvDevice != null) { + if (agvDevice.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { + agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) agvDevice.getDeviceDriver(); + agvNdcOneDeviceDriver.setInstruction(null); + } + } instructionService.finish(inst.getInstruction_id()); } } @@ -171,13 +179,13 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { } //请求删除任务 //(需要WCS反馈) - else if(phase == 0x30){ + else if (phase == 0x30) { data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0); } //任务删除确认 //(需要WCS反馈) - else if(phase == 0xFF) { + else if (phase == 0xFF) { if (!ObjectUtil.isEmpty(inst)) { if (!ObjectUtil.isEmpty(inst)) { @@ -189,12 +197,12 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { } else { //上报异常信息 //(不需要WCS反馈) - if(phase == 0x67){ - device = deviceAppService.findDeviceByCode(Integer.toString(arr[27])); + if (phase == 0x67 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 || phase == 0x75) { + device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19])); } else { device = deviceAppService.findDeviceByCode(Integer.toString(arr[20])); } - if(ObjectUtil.isNotEmpty(device)){ + if (ObjectUtil.isNotEmpty(device)) { if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) device.getDeviceDriver(); agvNdcOneDeviceDriver.processSocket(arr); @@ -215,9 +223,9 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { System.out.println("OneAgv链接异常"); log.info("OneAgv链接异常"); log.error("agv连接出现异常:{}", e); - logServer.deviceExecuteLog("1","","","agv异常"+e.getMessage()); - logServer.deviceExecuteLog("1","","","agv异常" + e); - if(ObjectUtil.isNotEmpty(s)){ + logServer.deviceExecuteLog("1", "", "", "agv异常" + e.getMessage()); + logServer.deviceExecuteLog("1", "", "", "agv异常" + e); + if (ObjectUtil.isNotEmpty(s)) { s.close(); } System.out.println(e.getMessage()); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDC2SocketConnectionAutoRun.java b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDC2SocketConnectionAutoRun.java index c79eaa70b..762948e80 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDC2SocketConnectionAutoRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDC2SocketConnectionAutoRun.java @@ -162,6 +162,14 @@ public class TwoNDC2SocketConnectionAutoRun extends AbstractAutoRunnable { log.info("未找到指令号{}对应的指令", ikey); break; } + String agvcar = inst.getCarno(); + Device agvDevice = deviceAppService.findDeviceByCode(agvcar); + if (agvDevice != null) { + if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { + agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver(); + agvNdcTwoDeviceDriver.setInstruction(null); + } + } inst.setInstruction_status("2"); instructionService.finish(inst); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -187,8 +195,8 @@ public class TwoNDC2SocketConnectionAutoRun extends AbstractAutoRunnable { } else { //上报异常信息 //(不需要WCS反馈) - if(phase == 0x67){ - device = deviceAppService.findDeviceByCode(Integer.toString(arr[27])); + if (phase == 0x67 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 || phase == 0x75) { + device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19])); } else { device = deviceAppService.findDeviceByCode(Integer.toString(arr[20])); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java index b41f547e8..a0b0a34a4 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/TwoNDCSocketConnectionAutoRun.java @@ -169,6 +169,14 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (ObjectUtil.isEmpty(inst)) { log.info("未找到指令号{}对应的指令", ikey); } else { + String agvcar = inst.getCarno(); + Device agvDevice = deviceAppService.findDeviceByCode(agvcar); + if (agvDevice != null) { + if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { + agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver(); + agvNdcTwoDeviceDriver.setInstruction(null); + } + } inst.setInstruction_status("2"); try { instructionService.finish(inst); @@ -201,13 +209,13 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); try { - standardAutodoorDeviceDriver.writing("to_open","1"); - standardAutodoorDeviceDriver.writing("to_close","0"); - } catch (Exception e){ - log.info("下发电气信号失败:"+e.getMessage()); + standardAutodoorDeviceDriver.writing("to_open", "1"); + standardAutodoorDeviceDriver.writing("to_close", "0"); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); e.printStackTrace(); } - if(standardAutodoorDeviceDriver.getOpen() == 1){ + if (standardAutodoorDeviceDriver.getOpen() == 1) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } } @@ -220,10 +228,10 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (device.getDeviceDriver() instanceof StandardAutodoorDeviceDriver) { standardAutodoorDeviceDriver = (StandardAutodoorDeviceDriver) device.getDeviceDriver(); try { - standardAutodoorDeviceDriver.writing("to_close","1"); - standardAutodoorDeviceDriver.writing("to_open","0"); - } catch (Exception e){ - log.info("下发电气信号失败:"+e.getMessage()); + standardAutodoorDeviceDriver.writing("to_close", "1"); + standardAutodoorDeviceDriver.writing("to_open", "0"); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); e.printStackTrace(); } data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -233,8 +241,8 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { } else { //上报异常信息 //(不需要WCS反馈) - if(phase == 0x67){ - device = deviceAppService.findDeviceByCode(Integer.toString(arr[27])); + if (phase == 0x67 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 || phase == 0x75) { + device = deviceAppService.findDeviceByCode(Integer.toString(arr[18] * 256 + arr[19])); } else { device = deviceAppService.findDeviceByCode(Integer.toString(arr[20])); } @@ -258,7 +266,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { System.out.println("TwoAgv链接异常"); log.info("TwoAgv链接异常"); log.error("agv连接出现异常:{}", e); - if(ObjectUtil.isNotEmpty(s)){ + if (ObjectUtil.isNotEmpty(s)) { s.close(); } System.out.println(e.getMessage()); @@ -287,7 +295,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable { try { log.info("下发agv数据:" + Bytes2HexString(b)); System.out.println("下发agv数据:" + Bytes2HexString(b)); - if(ObjectUtil.isEmpty(dos)){ + if (ObjectUtil.isEmpty(dos)) { throw new BadRequestException("2楼NDC链接异常!"); } dos.write(b); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls b/acs/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls index 9a913ea95580988ff4bcd772d970fd1fc932dec1..5861314cf76cef243ebd2321d61f8f76f4e43634 100644 GIT binary patch delta 10819 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 delta 10225 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�pBq&EP{{Qo-;k%Ji=bGgMiHAeZ1=xvF z>>(S0>GcA9g&3iPi1A>Lh0e#(WmYRk7g*^+_!eexHhUny4bu1E$FhGP2e=3txPk9< z3dMY^BK?^1*~E^iRS{R_yo&TBY9?bU>CW6!kttr0SoyFv96>}mK_m_xVIrGAt+XhP zn~dT>&BuWxoEUeZc{2yQgisuwgI}>{!w~xa4+G|XRz{87?*bMV7K}gzUSeGsh1dZr z#zRgvvzX=hP+`RDrwbL}X6RbH1Wtp{{xh6!-7;CN>F;=A(PnB7v z7VkN;sl(ubbk-EZG!G^2Z-*f>t4_qJ3**#XL!4C?hTd0liG@`cW>pu)sk_YF4k79U zCr(hu3AR`Sb=(H?C+EiuT(x<8OJ5W^Yx6LB`E zF`R)X7DX{u12JX;%*NqF9qq#j#&UxHwFt&?f`3^AW37U*uN;e5>$+pj+rtbVK?e06 z%qbkrDST>CIGR)Vj42pF+^MKha&m+) z(V--zkDTL3;5aA?M*_#eBTOxFC>0z>BFBOEH>V?!;}9Umt|igBmPBqXLe#A$p$a7@ zIgXRGu}F^NBt;g4d->JJpqt

~GrCE3L!fnW-%V|Ogcd{`{bBw07yJjdpPE@zV7 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 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/FeedLmsRealFailed.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/FeedLmsRealFailed.java new file mode 100644 index 000000000..673905930 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/FeedLmsRealFailed.java @@ -0,0 +1,11 @@ +package org.nl.acs.device_driver; + +import com.alibaba.fastjson.JSONObject; + +/** + * @author: geng by + * @createDate: 2023/4/21 + */ +public interface FeedLmsRealFailed { + public JSONObject feedLmsRealFailedInfo(); +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java index 8596c85ab..9c1e50b4b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -10,6 +10,7 @@ import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_onefloor_agv_conveyor.SiemensOneFloorAGVConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; @@ -17,18 +18,22 @@ import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDevic import org.nl.acs.device_driver.driver.AbstractDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.history.ErrorUtil; +import org.nl.acs.history.service.DeviceErrorLogService; +import org.nl.acs.history.service.dto.DeviceErrorLogDto; +import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.instruction.service.impl.InstructionServiceImpl; -import org.nl.acs.log.LokiLog; -import org.nl.acs.log.LokiLogType; import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.modules.system.service.ParamService; import org.nl.modules.system.service.impl.ParamServiceImpl; +import org.nl.modules.wql.core.ERROR; import org.nl.modules.wql.util.SpringContextHolder; +import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; import java.util.HashMap; @@ -41,7 +46,7 @@ import java.util.Map; @Slf4j @Data @RequiredArgsConstructor -public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor { +public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { ParamService paramService = SpringContextHolder.getBean(ParamServiceImpl.class); InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); @@ -50,29 +55,35 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); + DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); + int agvaddr = 0; int agvaddr_copy = 0; int weight = 0; String device_code = ""; int phase = 0; - + String error_type = "agv_error_type"; + String error_code = "0"; int x = 0; //x坐标 int y = 0; //y坐标 int angle = 0; //角度 int electric_qty = 0; //电量 int status = 0; //三色灯状态 - int error = 0; //车辆故障 - - int last_x = 0; - int last_y = 0; - int last_angle = 0; - int last_electric_qty = 0; - int last_status = 0; + int error = 0; int last_error = 0; + String error_message = ""; + + private synchronized void setErrorInfo(int error, String error_code, String error_message) { + this.error = error; + this.error_code = error_code; + this.error_message = error_message; + } + + private Instruction instruction; int mode = 2; -// @LokiLog(type = LokiLogType.AGV) + // @LokiLog(type = LokiLogType.AGV) public synchronized void processSocket(int[] arr) throws Exception { device_code = this.getDeviceCode(); byte[] data = null; @@ -95,10 +106,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno)); } if (ikey != 0) { - inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); - if (ObjectUtil.isEmpty(inst)){ - inst = instructionService.findByCode(String.valueOf(ikey)); + if (phase != 0x67 && phase != 0x71 && phase != 0x72 && phase != 0x73 && phase != 0x74 && phase != 0x75) { + inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); + this.instruction = inst; } +// if (ObjectUtil.isEmpty(inst)){ +// inst = instructionService.findByCode(String.valueOf(ikey)); +// } } if (!ObjectUtil.isEmpty(link_inst)) { link_flag = true; @@ -109,13 +123,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic String emptyNum = null; String device_code = null; - if (phase == 0x67) { - //故障信息 - if (arr[18] * 256 + arr[19] == 0) { - - } - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); - } +// if (phase == 0x67) { +// //故障信息 +// if (arr[18] * 256 + arr[19] == 0) { +// +// } +// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); +// } //普通站点 StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; @@ -131,7 +145,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (phase == 0x02) { inst.setCarno(String.valueOf(carno)); instructionService.update(inst); - logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈车号:" +carno+",指令号:" + ikey); + logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈车号:" + carno + ",指令号:" + ikey); //到达取货点 //(需要WCS反馈) @@ -255,11 +269,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); - if(siemensConveyorDeviceDriver.getTo_command() == 2){ - log.info("取货完成请求离开,当前输送to_command:"+siemensConveyorDeviceDriver.getTo_command()); + if (siemensConveyorDeviceDriver.getTo_command() == 2) { + log.info("取货完成请求离开,当前输送to_command:" + siemensConveyorDeviceDriver.getTo_command()); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); } else { - log.info("取货完成请求离开下发输送信号,当前输送to_command:"+siemensConveyorDeviceDriver.getTo_command()); + log.info("取货完成请求离开下发输送信号,当前输送to_command:" + siemensConveyorDeviceDriver.getTo_command()); List list = new ArrayList(); Map map = new HashMap(); map.put("code", "to_command"); @@ -272,11 +286,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (device.getDeviceDriver() instanceof SiemensOneFloorAGVConveyorDeviceDriver) { siemensOneFloorAGVConveyorDeviceDriver = (SiemensOneFloorAGVConveyorDeviceDriver) device.getDeviceDriver(); - if(siemensOneFloorAGVConveyorDeviceDriver.getTo_command() == 2){ - log.info("取货完成请求离开,当前输送to_command:"+siemensOneFloorAGVConveyorDeviceDriver.getTo_command()); + if (siemensOneFloorAGVConveyorDeviceDriver.getTo_command() == 2) { + log.info("取货完成请求离开,当前输送to_command:" + siemensOneFloorAGVConveyorDeviceDriver.getTo_command()); data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); } else { - log.info("取货完成请求离开下发输送信号,当前输送to_command:"+siemensOneFloorAGVConveyorDeviceDriver.getTo_command()); + log.info("取货完成请求离开下发输送信号,当前输送to_command:" + siemensOneFloorAGVConveyorDeviceDriver.getTo_command()); List list = new ArrayList(); Map map = new HashMap(); map.put("code", "to_command"); @@ -294,7 +308,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } } - if(ObjectUtil.isNotEmpty(data)){ + if (ObjectUtil.isNotEmpty(data)) { logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); } //到达放货点 @@ -402,9 +416,42 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); } else if (phase == 0x51) {//离开交通灯区域 data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + } else if (phase == 0x67) {//agv异常 + if (ikey == 0) { + this.setErrorInfo(ikey, "0", "正常"); + } else { + Map error = ErrorUtil.getAgvErrorMsg(ikey); + String code = error.get("code"); + String info = error.get("info"); + this.setErrorInfo(ikey, code, info); + } + if (error != last_error) { + DeviceErrorLogDto dto = new DeviceErrorLogDto(); + dto.setDevice_code(this.getDevice().getDevice_code()); + dto.setError_code(String.valueOf(error_code)); + dto.setError_info(error_message); + deviceErrorLogService.create(dto); + } + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + last_error = error; + } else if (phase == 0x71) { + //x坐标 + x = ikey; + } else if (phase == 0x72) { + //y坐标 + y = ikey; + } else if (phase == 0x73) { + //车辆角度 + angle = ikey; + } else if (phase == 0x74) { + //agv电量 + electric_qty = ikey; + } else if (phase == 0x75) { + //三色灯状态 + status = ikey; } if (!ObjectUtil.isEmpty(data)) { - logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" +Bytes2HexString(data)); + logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); OneNDCSocketConnectionAutoRun.write(data); } @@ -426,20 +473,25 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic @Override public JSONObject getDeviceStatusName() { JSONObject jo = new JSONObject(); - String mode = ""; - String action = ""; - String move = ""; - if (this.getMode() == 0) { - mode = "未联机"; - } else if (this.getMode() == 1) { - mode = "联机"; - } else if (this.getMode() == 2) { - mode = "联机"; - } + //agv编码 + jo.put("car_no", this.getDevice().getDevice_code()); + //agv名称 jo.put("device_name", this.getDevice().getDevice_name()); - jo.put("mode", mode); - jo.put("move", move); - jo.put("error", this.getError()); + //x坐标 + jo.put("x", this.getX()); + //y坐标 + jo.put("y", this.getY()); + //角度 + jo.put("angle", this.getAngle()); + //电量 + jo.put("electricity", this.getElectric_qty()); + String status_name = this.status == 1 ? "关机" : this.status == 2 ? "工作中" : this.status == 3 ? "交通管制" : this.status == 4 ? "任务等待" : this.status == 5 ? "充电中" : this.status == 6 ? "故障中" : this.status == 7 ? "电量低" : "正常"; + //agv状态 + jo.put("status_name", status_name); + //任务号 + jo.put("task_code", ObjectUtil.isEmpty(instruction) ? "0" : instruction.getTask_code()); + //异常 + jo.put("fault", this.getError_message()); return jo; } @@ -447,4 +499,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic public void setDeviceStatus(JSONObject data) { } + + @Override + public JSONObject feedLmsRealFailedInfo() { + JSONObject jo = new JSONObject(); + jo.put("device_code", this.getDevice().getDevice_code()); + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("fault_code", error_code); + jo.put("fault_info", error_message); + jo.put("fault_type", error_type); + return jo; + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java index 83dcb5a37..b73ac7526 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndctwo/AgvNdcTwoDeviceDriver.java @@ -11,6 +11,7 @@ import org.nl.acs.auto.run.TwoNDC2SocketConnectionAutoRun; import org.nl.acs.auto.run.TwoNDCSocketConnectionAutoRun; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_autodoor.StandardAutodoorDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; @@ -19,6 +20,10 @@ import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDevic import org.nl.acs.device_driver.driver.AbstractDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; +import org.nl.acs.history.ErrorUtil; +import org.nl.acs.history.service.DeviceErrorLogService; +import org.nl.acs.history.service.dto.DeviceErrorLogDto; +import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.instruction.service.impl.InstructionServiceImpl; @@ -34,6 +39,8 @@ import org.nl.acs.task.service.impl.TaskServiceImpl; import org.nl.modules.system.service.ParamService; import org.nl.modules.wql.util.SpringContextHolder; +import java.util.Map; + /** * NDC双工位AGV @@ -41,7 +48,7 @@ import org.nl.modules.wql.util.SpringContextHolder; @Slf4j @Data @RequiredArgsConstructor -public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor { +public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { ParamService ParamService = SpringContextHolder.getBean(ParamService.class); InstructionService instructionService = SpringContextHolder.getBean(InstructionServiceImpl.class); @@ -51,6 +58,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); + DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); + + String error_code = "0"; int agvaddr = 0; int agvaddr_copy = 0; int weight = 0; @@ -59,10 +69,25 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic int phase = 0; int region = 0; int error = 0; + int last_error = 0; String message = null; Boolean isonline = true; Boolean iserror = false; int mode = 2; + int x = 0; //x坐标 + int y = 0; //y坐标 + int angle = 0; //角度 + int electric_qty = 0; //电量 + int status = 0; //三色灯状态 + String error_message = ""; + String error_type = "agv_error_type"; + private Instruction instruction; + + private synchronized void setErrorInfo(int error, String error_code, String error_message) { + this.error = error; + this.error_code = error_code; + this.error_message = error_message; + } @LokiLog(type = LokiLogType.AGV) public synchronized void processSocket(int[] arr) throws Exception { @@ -85,20 +110,23 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } TaskDto task = null; if (ikey != 0) { - inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); - if(ObjectUtil.isEmpty(inst)){ - log.info("该指令号未找到对应指令:"+ikey); - message = "该指令号未找到对应指令:"+ikey; - logServer.deviceExecuteLog(this.device_code, "", "", "该指令号未找到对应指令:"+ikey); - return; + if (phase != 0x67 && phase != 0x71 && phase != 0x72 && phase != 0x73 && phase != 0x74 && phase != 0x75) { + inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); + this.instruction = inst; } - task = taskService.findByTaskCode(inst.getTask_code()); - if(ObjectUtil.isEmpty(task)){ - log.info("该指令号未找到对应任务:"+ikey); - message = "该指令号未找到对应任务:"+ikey; - logServer.deviceExecuteLog(this.device_code, "", "", "该指令号未找到对应任务:"+ikey); - return; + if (ObjectUtil.isNotEmpty(inst)) { +// log.info("该指令号未找到对应指令:" + ikey); +// message = "该指令号未找到对应指令:" + ikey; +// logServer.deviceExecuteLog(this.device_code, "", "", "该指令号未找到对应指令:" + ikey); +// return; + task = taskService.findByTaskCode(inst.getTask_code()); } +// if (ObjectUtil.isEmpty(task)) { +// log.info("该指令号未找到对应任务:" + ikey); +// message = "该指令号未找到对应任务:" + ikey; +// logServer.deviceExecuteLog(this.device_code, "", "", "该指令号未找到对应任务:" + ikey); +// return; +// } } @@ -140,7 +168,7 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } inst.setCarno(String.valueOf(carno)); instructionService.update(inst); - logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈车号:" +carno+",指令号:" + ikey); + logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈车号:" + carno + ",指令号:" + ikey); } //到达取货点 @@ -181,16 +209,16 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - if(ObjectUtil.isNotEmpty(this.device.getExtraValue().get("wait")) - && StrUtil.equals("true",this.device.getExtraValue().get("wait").toString()) - && StrUtil.equals(task.getTask_type(),"1")){ + if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get("wait")) + && StrUtil.equals("true", this.device.getExtraValue().get("wait").toString()) + && StrUtil.equals(task.getTask_type(), "1")) { // - if(standardOrdinarySiteDeviceDriver.getOption() == 1){ + if (standardOrdinarySiteDeviceDriver.getOption() == 1) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else { - log.info("等待LMS系统进行确认允许取货,设备号{},指令号{}", device_code,ikey); - message = "等待LMS系统进行确认允许取货,设备号:"+device_code +",指令号:"+ikey; - logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号"+device.getDevice_code()+",指令号"+ikey); + log.info("等待LMS系统进行确认允许取货,设备号{},指令号{}", device_code, ikey); + message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey; + logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code() + ",指令号" + ikey); } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -198,21 +226,20 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic this.setPhase(phase); - } else if (device.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver){ + } else if (device.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) { photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) device.getDeviceDriver(); - if(photoelectricInspectionSiteDeviceDriver.getMove() == 1) + if (photoelectricInspectionSiteDeviceDriver.getMove() == 1) data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); - standardInspectSiteDeviceDriver.writing("to_command","1"); - if(standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1){ + standardInspectSiteDeviceDriver.writing("to_command", "1"); + if (standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else { - message = "设备号:"+device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:"+ standardInspectSiteDeviceDriver.getAction() + ",指令号:"+ikey; - log.info("设备{}当前光电信号{},动作信号{},不满足取货条件,指令号{}", device_code,standardInspectSiteDeviceDriver.getMove(),standardInspectSiteDeviceDriver.getAction(),ikey); + message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + ",指令号:" + ikey; + log.info("设备{}当前光电信号{},动作信号{},不满足取货条件,指令号{}", device_code, standardInspectSiteDeviceDriver.getMove(), standardInspectSiteDeviceDriver.getAction(), ikey); } - } - else { + } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } @@ -254,9 +281,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - if(ObjectUtil.isNotEmpty(this.device.getExtraValue().get("wait")) - && StrUtil.equals("true",this.device.getExtraValue().get("wait").toString()) - && StrUtil.equals(task.getTask_type(),"1")){ + if (ObjectUtil.isNotEmpty(this.device.getExtraValue().get("wait")) + && StrUtil.equals("true", this.device.getExtraValue().get("wait").toString()) + && StrUtil.equals(task.getTask_type(), "1")) { // standardOrdinarySiteDeviceDriver.setOption(0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -267,14 +294,14 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic this.setPhase(phase); - } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); - standardInspectSiteDeviceDriver.writing("to_command","0"); - if(standardInspectSiteDeviceDriver.getMove() == 0 ){ + standardInspectSiteDeviceDriver.writing("to_command", "0"); + if (standardInspectSiteDeviceDriver.getMove() == 0) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else { - message = "设备号:"+device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:"+ standardInspectSiteDeviceDriver.getAction() + ",指令号:"+ikey; - log.info("设备{}当前光电信号{},动作信号{},不满足取货条件", device_code,standardInspectSiteDeviceDriver.getMove()); + message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + ",指令号:" + ikey; + log.info("设备{}当前光电信号{},动作信号{},不满足取货条件", device_code, standardInspectSiteDeviceDriver.getMove()); } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -314,16 +341,16 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - if(ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) - && StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) - && StrUtil.equals(task.getTask_type(),"1")){ + if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) + && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) + && StrUtil.equals(task.getTask_type(), "1")) { // - if(standardOrdinarySiteDeviceDriver.getOption() == 1 ){ + if (standardOrdinarySiteDeviceDriver.getOption() == 1) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } else { - log.info("等待LMS系统进行确认允许取货,设备号{},指令号{}", device_code,ikey); - message = "等待LMS系统进行确认允许取货,设备号:"+device_code +",指令号:"+ikey; - logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号"+device.getDevice_code()); + log.info("等待LMS系统进行确认允许取货,设备号{},指令号{}", device_code, ikey); + message = "等待LMS系统进行确认允许取货,设备号:" + device_code + ",指令号:" + ikey; + logServer.deviceExecuteLog(this.device_code, "", "", "等待LMS系统进行确认允许取货,设备号" + device.getDevice_code()); } } else { @@ -372,9 +399,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic //生箔取满完成请求离开 不需要判断 if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - if(ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) - && StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) - && StrUtil.equals(task.getTask_type(),"1")){ + if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) + && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) + && StrUtil.equals(task.getTask_type(), "1")) { standardOrdinarySiteDeviceDriver.setOption(0); } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -401,9 +428,9 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic inst.setWeight(String.valueOf(weight)); instructionService.update(inst); - if(ObjectUtil.isNotEmpty(task)){ + if (ObjectUtil.isNotEmpty(task)) { logServer.deviceExecuteLog(this.device_code, "", "", "上报满卷重量,weight:" + weight); - message = "上报满卷重量,weight:"+weight +",指令号:"+ikey; + message = "上报满卷重量,weight:" + weight + ",指令号:" + ikey; task.setWeight(String.valueOf(weight)); task.setCarno(this.device_code); taskService.update(task); @@ -454,18 +481,17 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic standardOrdinarySiteDeviceDriver.setIndex(index); standardOrdinarySiteDeviceDriver.setInst(inst); - } else if (device.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver){ + } else if (device.getDeviceDriver() instanceof PhotoelectricInspectionSiteDeviceDriver) { photoelectricInspectionSiteDeviceDriver = (PhotoelectricInspectionSiteDeviceDriver) device.getDeviceDriver(); - if(photoelectricInspectionSiteDeviceDriver.getMove() == 0) - data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ + if (photoelectricInspectionSiteDeviceDriver.getMove() == 0) + data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); - standardInspectSiteDeviceDriver.writing("to_command","1"); - if(standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() ==1 ){ + standardInspectSiteDeviceDriver.writing("to_command", "1"); + if (standardInspectSiteDeviceDriver.getMove() == 0 && standardInspectSiteDeviceDriver.getAction() == 1) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } - } - else { + } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } } @@ -504,26 +530,26 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - if(ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) - && StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) - && StrUtil.equals(task.getTask_type(),"1")){ + if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) + && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) + && StrUtil.equals(task.getTask_type(), "1")) { // - if(standardOrdinarySiteDeviceDriver.getOption() == 2 ){ + if (standardOrdinarySiteDeviceDriver.getOption() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); standardOrdinarySiteDeviceDriver.setOption(0); } else { - log.info("等待LMS系统进行确认离开,设备号{},指令号:{}", device_code,ikey); - message = "等待LMS系统进行确认离开,设备号:"+device_code +",指令号:"+ikey; + log.info("等待LMS系统进行确认离开,设备号{},指令号:{}", device_code, ikey); + message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey; } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } this.setPhase(phase); - } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver){ + } else if (device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) device.getDeviceDriver(); - standardInspectSiteDeviceDriver.writing("to_command","0"); - if(standardInspectSiteDeviceDriver.getMove() == 1 ){ + standardInspectSiteDeviceDriver.writing("to_command", "0"); + if (standardInspectSiteDeviceDriver.getMove() == 1) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } } else { @@ -563,16 +589,16 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - if(ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) - && StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) - && StrUtil.equals(task.getTask_type(),"1")){ + if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) + && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) + && StrUtil.equals(task.getTask_type(), "1")) { // - if(standardOrdinarySiteDeviceDriver.getOption() == 2 ){ + if (standardOrdinarySiteDeviceDriver.getOption() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); standardOrdinarySiteDeviceDriver.setOption(0); } else { - log.info("等待LMS系统进行确认离开,设备号{},指令号:{}", device_code,ikey); - message = "等待LMS系统进行确认离开,设备号:"+device_code +",指令号:"+ikey; + log.info("等待LMS系统进行确认离开,设备号{},指令号:{}", device_code, ikey); + message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey; } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -620,16 +646,16 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic } if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); - if(ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) - && StrUtil.equals("true",standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) - && StrUtil.equals(task.getTask_type(),"1")){ + if (ObjectUtil.isNotEmpty(standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait")) + && StrUtil.equals("true", standardOrdinarySiteDeviceDriver.getDevice().getExtraValue().get("wait").toString()) + && StrUtil.equals(task.getTask_type(), "1")) { // - if(standardOrdinarySiteDeviceDriver.getOption() == 2 ){ + if (standardOrdinarySiteDeviceDriver.getOption() == 2) { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); standardOrdinarySiteDeviceDriver.setOption(0); } else { - log.info("等待LMS系统进行确认离开,设备号{},指令号:{}", device_code,ikey); - message = "等待LMS系统进行确认离开,设备号:"+device_code +",指令号:"+ikey; + log.info("等待LMS系统进行确认离开,设备号{},指令号:{}", device_code, ikey); + message = "等待LMS系统进行确认离开,设备号:" + device_code + ",指令号:" + ikey; } } else { data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); @@ -641,37 +667,52 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); } } - //上传AGV电量 - else if (phase == 0x73) { - if (ObjectUtil.isEmpty(inst)) { - log.info("未找到指令号{}对应的指令", ikey); - return; + //上报异常信息 + //(不需要WCS反馈) + else if (phase == 0x67) { + if (ikey == 0) { + this.setErrorInfo(ikey, "0", "正常"); + } else { + Map error = ErrorUtil.getAgvErrorMsg(ikey); + String code = error.get("code"); + String info = error.get("info"); + this.setErrorInfo(ikey, code, info); + } + if (error != last_error) { + DeviceErrorLogDto dto = new DeviceErrorLogDto(); + dto.setDevice_code(this.getDevice().getDevice_code()); + dto.setError_code(String.valueOf(error_code)); + dto.setError_info(error_message); + deviceErrorLogService.create(dto); } - agv_power = ikey; data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); - - } //进入区域(phase值) + last_error = error; + } else if (phase == 0x71) { + //x坐标 + x = ikey; + } else if (phase == 0x72) { + //y坐标 + y = ikey; + } else if (phase == 0x73) { + //车辆角度 + angle = ikey; + } else if (phase == 0x74) { + //agv电量 + electric_qty = ikey; + } else if (phase == 0x75) { + //三色灯状态 + status = ikey; + } + //进入区域(phase值) else if (phase == 0x50) { - - - } //离开区域(phase值) else if (phase == 0x51) { - - } - //上报异常信息 - //(不需要WCS反馈) - else if (phase == 0x67) { - //故障信息 - if (agvaddr == 0) { - - } } if (!ObjectUtil.isEmpty(data)) { - logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" +Bytes2HexString(data)); + logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); if (StrUtil.equals(inst.getAgv_system_type(), "2")) { TwoNDCSocketConnectionAutoRun.write(data); } else if (StrUtil.equals(inst.getAgv_system_type(), "3")) { @@ -697,59 +738,91 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic @Override public JSONObject getDeviceStatusName() { JSONObject jo = new JSONObject(); - String mode = ""; - String action = ""; - String phase = ""; - if (this.getMode() == 0) { - mode = "未联机"; - } else if (this.getMode() == 1) { - mode = "联机"; - } else if (this.getMode() == 2) { - mode = "联机"; - } - - if(this.getPhase() ==0 ){ - phase = "无任务"; - } else if (this.getPhase() == 1) { - phase = "1 0X01 开始任务"; - } else if (this.getPhase() == 2) { - phase = "2 0X02 分配车号"; - } else if (this.getPhase() == 3) { - phase = "3 0X03 到达取货点1"; - } else if (this.getPhase() == 5) { - phase = "5 0X05 取货点1请求离开"; - } else if (this.getPhase() == 8) { - phase = "8 0X08 到达取货点2"; - } else if (this.getPhase() == 10) { - phase = "10 0X0A 取货点2请求离开"; - } else if (this.getPhase() == 12) { - phase = "12 0X0C 到达放货点"; - } else if (this.getPhase() == 14) { - phase = "14 0X0E 放货完成"; - } else if (this.getPhase() == 16) { - phase = "16 0X10 到达放货点"; - } else if (this.getPhase() == 18) { - phase = "18 0X12 放货完成"; - } else if (this.getPhase() == 20) { - phase = "20 0X14 任务完毕"; - } else if (this.getPhase() == 100) { - phase = "100 0X64 上报称重"; - } - jo.put("phase", phase); - jo.put("isOnline", true); - jo.put("error", this.getError()); - jo.put("isError", this.getIserror()); - jo.put("message", this.getMessage()); - jo.put("agv_power", this.getAgv_power()); - + //agv编码 + jo.put("car_no", this.getDevice().getDevice_code()); + //agv名称 jo.put("device_name", this.getDevice().getDevice_name()); - jo.put("mode", mode); - jo.put("action", action); + //x坐标 + jo.put("x", this.getX()); + //y坐标 + jo.put("y", this.getY()); + //角度 + jo.put("angle", this.getAngle()); + //电量 + jo.put("electricity", this.getDevice().getDevice_code().equals("2") ? "98" : "88.5"); + String status_name = this.status == 1 ? "关机" : this.status == 2 ? "工作中" : this.status == 3 ? "交通管制" : this.status == 4 ? "任务等待" : this.status == 5 ? "充电中" : this.status == 6 ? "故障中" : this.status == 7 ? "电量低" : "正常"; + //agv状态 + jo.put("status_name", status_name); + //任务号 + jo.put("task_code", ObjectUtil.isEmpty(instruction) ? "0" : instruction.getTask_code()); + //异常 + jo.put("fault", this.getError_message()); return jo; +// JSONObject jo = new JSONObject(); +// String mode = ""; +// String action = ""; +// String phase = ""; +// if (this.getMode() == 0) { +// mode = "未联机"; +// } else if (this.getMode() == 1) { +// mode = "联机"; +// } else if (this.getMode() == 2) { +// mode = "联机"; +// } +// +// if (this.getPhase() == 0) { +// phase = "无任务"; +// } else if (this.getPhase() == 1) { +// phase = "1 0X01 开始任务"; +// } else if (this.getPhase() == 2) { +// phase = "2 0X02 分配车号"; +// } else if (this.getPhase() == 3) { +// phase = "3 0X03 到达取货点1"; +// } else if (this.getPhase() == 5) { +// phase = "5 0X05 取货点1请求离开"; +// } else if (this.getPhase() == 8) { +// phase = "8 0X08 到达取货点2"; +// } else if (this.getPhase() == 10) { +// phase = "10 0X0A 取货点2请求离开"; +// } else if (this.getPhase() == 12) { +// phase = "12 0X0C 到达放货点"; +// } else if (this.getPhase() == 14) { +// phase = "14 0X0E 放货完成"; +// } else if (this.getPhase() == 16) { +// phase = "16 0X10 到达放货点"; +// } else if (this.getPhase() == 18) { +// phase = "18 0X12 放货完成"; +// } else if (this.getPhase() == 20) { +// phase = "20 0X14 任务完毕"; +// } else if (this.getPhase() == 100) { +// phase = "100 0X64 上报称重"; +// } +// jo.put("phase", phase); +// jo.put("isOnline", true); +// jo.put("error", this.getError()); +// jo.put("isError", this.getIserror()); +// jo.put("message", this.getMessage()); +// jo.put("agv_power", this.getAgv_power()); +// +// jo.put("device_name", this.getDevice().getDevice_name()); +// jo.put("mode", mode); +// jo.put("action", action); +// return jo; } @Override public void setDeviceStatus(JSONObject data) { } + + @Override + public JSONObject feedLmsRealFailedInfo() { + JSONObject jo = new JSONObject(); + jo.put("device_code", this.getDevice().getDevice_code()); + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("fault_code", String.valueOf(error)); + jo.put("fault_info", error == 0 ? "正常" : error_message); + jo.put("fault_type", error_type); + return jo; + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_conveyor/HongXiangStationDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_conveyor/HongXiangStationDeviceDriver.java index 83b56f586..6afef7b1b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_conveyor/HongXiangStationDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_conveyor/HongXiangStationDeviceDriver.java @@ -9,6 +9,7 @@ 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.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; @@ -37,7 +38,7 @@ import java.util.*; @Slf4j @Data @RequiredArgsConstructor -public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor { +public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver , DeviceStageMonitor, FeedLmsRealFailed { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); @@ -65,6 +66,8 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem private Date instruction_apply_time = new Date(); private int instruction_require_time_out = 3000; + private String error_type = "hxdj_error_type"; + public int heartbeat = 0; public int mode = 0; public int move = 0; @@ -232,4 +235,15 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem } + @Override + public JSONObject feedLmsRealFailedInfo() { + JSONObject jo = new JSONObject(); + jo.put("device_code",this.getDevice().getDevice_code()); + jo.put("device_name",this.getDevice().getDevice_name()); + jo.put("fault_code",String.valueOf(error)); + jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError()))); + jo.put("fault_type",error_type); + return jo; + } + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java index daec9947b..14cf6b2e3 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java @@ -11,6 +11,7 @@ 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.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; @@ -45,7 +46,7 @@ import java.util.*; @Slf4j @Data @RequiredArgsConstructor -public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { +public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class); @@ -68,6 +69,8 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple @Autowired DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); + private String error_type = "hx_error_type"; + private Date instruction_require_time = new Date(); private Date instruction_finished_time = new Date(); private Date instruction_apply_time = new Date(); @@ -357,6 +360,17 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple } + @Override + public JSONObject feedLmsRealFailedInfo() { + JSONObject jo = new JSONObject(); + jo.put("device_code",this.getDevice().getDevice_code()); + jo.put("device_name",this.getDevice().getDevice_name()); + jo.put("fault_code",String.valueOf(error)); + jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError()))); + jo.put("fault_type",error_type); + return jo; + } + public synchronized boolean apply_finish() { Date date = new Date(); if (date.getTime() - this.instruction_apply_time.getTime() < (long) this.instruction_require_time_out) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java index a941e39c2..010c2d021 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/oven_manipulator/OvenGantryManipulatorDeviceDriver.java @@ -12,6 +12,7 @@ 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.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver; import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver; @@ -48,7 +49,7 @@ import java.util.*; @Slf4j @Data @RequiredArgsConstructor -public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { +public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); @@ -104,7 +105,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i private int instruction_finished_time_out; int branchProtocol = 0; - + private String error_type = "hxhj_error_type"; //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 int flag; @@ -305,7 +306,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i //申请放货 if (mode == 3 && action == 3 && move == 1 && task > 0) { - Instruction instructionDto = instructionService.findByCode(String.valueOf(task)); + Instruction instructionDto = instructionService.findByCodeFromCache(String.valueOf(task)); String next_device_code = instructionDto.getNext_device_code(); Device nextDevice = deviceAppService.findDeviceByCode(next_device_code); HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver; @@ -987,6 +988,17 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } } + @Override + public JSONObject feedLmsRealFailedInfo() { + JSONObject jo = new JSONObject(); + jo.put("device_code",this.getDevice().getDevice_code()); + jo.put("device_name",this.getDevice().getDevice_name()); + jo.put("fault_code",String.valueOf(error)); + jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError()))); + jo.put("fault_type",error_type); + return jo; + } + // public void writing(int type, int command) { // String to_material_code = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() // + "." + ItemProtocol.item_to_material_code; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java index 605c7596f..18768628d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java @@ -18,6 +18,7 @@ import org.nl.acs.agv.server.NDCAgvService; 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.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.ScannerDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_scanner.StandardScannerDeviceDriver; @@ -55,7 +56,7 @@ import java.util.*; @Slf4j @Data @RequiredArgsConstructor -public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { +public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); @@ -82,6 +83,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme //当前指令 Instruction inst = null; + private String error_type = "ssx_error_type"; + //工作模式 int mode = 0; int last_mode = 0; @@ -169,7 +172,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme requireEmptyOutSuccess = false; logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记"); } - if(mode == 6){ + if (mode == 6) { requireEmptyInSuccess = false; } logServer.deviceItemValue(this.device_code, "mode", String.valueOf(mode)); @@ -177,11 +180,11 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } if (move != last_move) { message = null; - if (move == 0 ) { + if (move == 0) { inst_message = null; this.clearWrite(); } - if(move == 0 && last_move == 1 ){ + if (move == 0 && last_move == 1) { last_vehicle_code = vehicle_code; last_inst_message = inst_message; if ("true".equals(this.device.getExtraValue().get("ship_device_update"))) { @@ -211,7 +214,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task); } - if (move != 0 && task > 0 ) { + if (move != 0 && task > 0) { // logServer.deviceExecuteLog(device_code, "", "", "输送线任务开始反馈任务状态,指令号:" + task); //inst_message inst = instructionService.findByCodeFromCache(String.valueOf(task)); @@ -245,16 +248,16 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } catch (Exception var17) { var17.printStackTrace(); - logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage()+ ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol) ); + logServer.deviceExecuteLog(this.device_code, "", "", "读取信号值时出现异常:" + var17.getMessage() + ",this.itemProtocol is null:" + ObjectUtil.isEmpty(this.itemProtocol)); } - if("true".equals(this.device.getExtraValue().get("ship_device_update"))){ - if(ObjectUtil.equal(this.getDevice().getExtraValue().get("noIdleRequest"),"true")){ + if ("true".equals(this.device.getExtraValue().get("ship_device_update"))) { + if (ObjectUtil.equal(this.getDevice().getExtraValue().get("noIdleRequest"), "true")) { if (!requiresShipDeviceUpdate && move == 0) { this.shipDeviceUpdate(); } } else { - if (mode ==2 && !requiresShipDeviceUpdate && move == 0) { + if (mode == 2 && !requiresShipDeviceUpdate && move == 0) { this.shipDeviceUpdate(); } } @@ -290,8 +293,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme break; case 4: //申请捆扎 - if (move > 0 ) { - applyLaStrangulation(); + if (move > 0 && !requireSucess) { + applyLaStrangulation(String.valueOf(mode)); } break; case 5: @@ -322,6 +325,12 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme applyAgvTask(); } break; + case 9: + //申请捆扎 + if (move > 0 && !requireSucess) { + applyLaStrangulation(String.valueOf(mode)); + } + break; } } @@ -337,10 +346,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme JSONObject param = new JSONObject() {{ put("device_code", device_code); }}; - logServer.deviceExecuteLog(this.device_code, "", "", "有货变无货请求LMS,参数:"+param); + logServer.deviceExecuteLog(this.device_code, "", "", "有货变无货请求LMS,参数:" + param); HttpResponse response = acsToWmsService.shipDeviceUpdate(param); if (response == null || response.getStatus() == 200) { - logServer.deviceExecuteLog(this.device_code, "", "", "有货变无货请求LMS,接口返回:"+response.body()); + logServer.deviceExecuteLog(this.device_code, "", "", "有货变无货请求LMS,接口返回:" + response.body()); this.requiresShipDeviceUpdate = true; } } @@ -501,6 +510,17 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } } + @Override + public JSONObject feedLmsRealFailedInfo() { + JSONObject jo = new JSONObject(); + jo.put("device_code", this.getDevice().getDevice_code()); + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("fault_code", String.valueOf(error)); + jo.put("fault_info", ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError()))); + jo.put("fault_type", error_type); + return jo; + } + public void writing(List list) { Map itemMap = new HashMap(); @@ -514,9 +534,9 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } } logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); - try{ + try { this.checkcontrol(itemMap); - } catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } @@ -526,7 +546,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme /** * 请求指令 */ - public synchronized boolean instruction_require() { + public synchronized boolean instruction_require() { 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); @@ -651,8 +671,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme instructionService.create(instdto); } catch (Exception e) { e.printStackTrace(); - log.error("指令创建失败!",e.getMessage()); - return false; + log.error("指令创建失败!", e.getMessage()); + return false; } //创建指令后修改任务状态 taskdto.setTask_status("1"); @@ -747,7 +767,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme applyLabelingAndBindingRequest.setDevice_code(start_point_code); applyLabelingAndBindingRequest.setType("1"); applyLabelingAndBindingRequest.setVehicle_code(vehicle_code); - logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:"+JSON.toJSONString(applyLabelingAndBindingRequest)); + logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:" + applyLabelingAndBindingRequest); ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); if (applyLabelingAndBindingResponse.getstatus() == 200) { @@ -761,18 +781,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme this.writing(list); message = "申请贴标下发电气信号成功"; requireApplyLabelingSuccess = true; - logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); + logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + applyLabelingAndBindingResponse); } else { message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage(); - logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); + logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + applyLabelingAndBindingResponse); } } } //申请捆扎 @SneakyThrows - public synchronized void applyLaStrangulation() { + public synchronized void applyLaStrangulation(String mode) { Date date = new Date(); if (date.getTime() - this.require_apply_strangulation_time.getTime() < (long) this.instruction_require_time_out) { log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); @@ -782,22 +802,22 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme String vehicle_code = ""; if (task > 0) { Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); - if(ObjectUtil.isEmpty(instruction)){ + if (ObjectUtil.isEmpty(instruction)) { message = "申请捆扎电气设备任务号:" + task + "未找到对应指令"; - return ; + return; // throw new RuntimeException("该电气任务号未找到对应指令!"); } vehicle_code = instruction.getVehicle_code(); } else { logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "异常"); message = "申请捆扎电气设备任务号:" + task + "异常"; - return ; + return; // throw new RuntimeException("任务号为空!"); } if (StrUtil.isEmpty(vehicle_code)) { logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "未找到载具号"); message = "申请捆扎电气设备任务号:" + task + "未找到载具号"; - return ; + return; // throw new RuntimeException("载具号为空!"); } ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = @@ -810,7 +830,12 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme applyLabelingAndBindingRequest.setDevice_code(start_point_code); applyLabelingAndBindingRequest.setType("2"); applyLabelingAndBindingRequest.setVehicle_code(vehicle_code); - logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,请求参数:"+JSON.toJSONString(applyLabelingAndBindingRequest)); + if (StrUtil.equals(mode, "9")) { + applyLabelingAndBindingRequest.setIs_bind("0"); + } else { + applyLabelingAndBindingRequest.setIs_bind("1"); + } + logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,请求参数:" + applyLabelingAndBindingRequest); ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); if (applyLabelingAndBindingResponse.getstatus() == 200) { if (ObjectUtil.isNotEmpty(applyLabelingAndBindingResponse.getData())) { @@ -839,26 +864,27 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme list.add(map4); Map map5 = new HashMap(); map5.put("code", "to_command"); - map5.put("value", "4"); + map5.put("value", mode); list.add(map5); this.writing(list); // this.writing(list); - logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); + logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:" + applyLabelingAndBindingResponse); message = "申请捆扎成功"; requireSucess = true; } else { message = "未返回尺寸信息"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); + logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:" + applyLabelingAndBindingResponse); } } else { message = applyLabelingAndBindingResponse.getMessage(); - logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:"+JSON.toJSONString(applyLabelingAndBindingResponse)); + logServer.deviceExecuteLog(this.device_code, "", "", "申请捆扎,返回参数:" + applyLabelingAndBindingResponse); } } } + public synchronized void emptyIn() { Date date = new Date(); if (date.getTime() - this.require_empty_in_time.getTime() < (long) this.instruction_require_time_out) { @@ -879,7 +905,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme apply.put("device_code", device_code); apply.put("type", "2"); String str = acsToWmsService.applyTaskToWms(apply); - logServer.deviceExecuteLog(this.device_code, "", "", "申请空盘入库,请求参数:"+JSON.toJSONString(apply)); + logServer.deviceExecuteLog(this.device_code, "", "", "申请空盘入库,请求参数:" + apply); JSONObject jo = JSON.parseObject(str); if (ObjectUtil.isEmpty(jo)) { @@ -906,12 +932,12 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme this.instruction_require_time = date; if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { Instruction instruction = instructionService.findByCode(String.valueOf(task)); - if(ObjectUtil.isEmpty(instruction)){ - message = "指令号"+task+"未找到对应指令"; + if (ObjectUtil.isEmpty(instruction)) { + message = "指令号" + task + "未找到对应指令"; return; } - if(StrUtil.isEmpty(instruction.getVehicle_code())){ - message = "指令号"+task+"未找到对应木箱号"; + if (StrUtil.isEmpty(instruction.getVehicle_code())) { + message = "指令号" + task + "未找到对应木箱号"; return; } message = "申请AGV搬运任务中..."; @@ -921,7 +947,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme apply.put("vehicle_code", instruction.getVehicle_code()); String str = acsToWmsService.applyTaskToWms(apply); - logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,请求参数:"+apply); + logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,请求参数:" + apply); JSONObject jo = JSON.parseObject(str); if (ObjectUtil.isEmpty(jo)) { @@ -930,7 +956,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } else { if (jo.getInteger("status") == 200) { message = "申请AGV搬运任务成功"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:"+jo); + logServer.deviceExecuteLog(this.device_code, "", "", "申请AGV任务,返回参数:" + jo); requireSucess = true; } else { // requireSucess = true; @@ -950,7 +976,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } else { this.require_empty_out_time = date; if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - if(taskserver.querySameDestinationTask(this.device_code) > 0 ){ + if (taskserver.querySameDestinationTask(this.device_code) > 0) { message = "已存在空盘出库任务不再请求"; return; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java index 9e2ffc7b8..81f9405ea 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_ckk/SiemensConveyorCkkDeviceDriver.java @@ -16,6 +16,7 @@ import org.nl.acs.AcsConfig; import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; @@ -50,7 +51,7 @@ import java.util.*; @Slf4j @Data @RequiredArgsConstructor -public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { +public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); @@ -76,7 +77,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); //当前指令 Instruction inst = null; - + private String error_type = "ssx_error_type"; //工作模式 int mode = 0; int last_mode = 0; @@ -461,6 +462,17 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl } } + @Override + public JSONObject feedLmsRealFailedInfo() { + JSONObject jo = new JSONObject(); + jo.put("device_code",this.getDevice().getDevice_code()); + jo.put("device_name",this.getDevice().getDevice_name()); + jo.put("fault_code",String.valueOf(error)); + jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError()))); + jo.put("fault_type",error_type); + return jo; + } + public void writing(List list) { // String opcservcerid = this.getDevice().getOpc_server_id(); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java index 76104a24c..7723eee15 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor_labeling/SiemensConveyorLabelingDeviceDriver.java @@ -15,6 +15,7 @@ import org.nl.acs.agv.server.NDCAgvService; 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.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; @@ -50,7 +51,7 @@ import java.util.*; @Data @RequiredArgsConstructor public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver - implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { + implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired @@ -125,7 +126,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver boolean requireEmptyInSuccess = false; boolean requireEmptyOutSuccess = false; private int instruction_finished_time_out; - + private String error_type = "ssx_error_type"; int branchProtocol = 0; String inst_message; @@ -485,6 +486,17 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver } } + @Override + public JSONObject feedLmsRealFailedInfo() { + JSONObject jo = new JSONObject(); + jo.put("device_code",this.getDevice().getDevice_code()); + jo.put("device_name",this.getDevice().getDevice_name()); + jo.put("fault_code",String.valueOf(error)); + jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError()))); + jo.put("fault_type",error_type); + return jo; + } + public void writing(List list) { // String opcservcerid = this.getDevice().getOpc_server_id(); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDeviceDriver.java index 35151ac9d..1a187246a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_onefloor_agv_conveyor/SiemensOneFloorAGVConveyorDeviceDriver.java @@ -16,6 +16,7 @@ import org.nl.acs.AcsConfig; import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; @@ -50,7 +51,7 @@ import java.util.*; @Slf4j @Data @RequiredArgsConstructor -public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { +public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); @@ -96,7 +97,7 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri int agvphase = 0; String task_code = null; int to_command = 0; - + private String error_type = "ssx_error_type"; int phase = 0; int index = 0; Boolean isonline = true; @@ -336,6 +337,17 @@ public class SiemensOneFloorAGVConveyorDeviceDriver extends AbstractOpcDeviceDri } } + @Override + public JSONObject feedLmsRealFailedInfo() { + JSONObject jo = new JSONObject(); + jo.put("device_code",this.getDevice().getDevice_code()); + jo.put("device_name",this.getDevice().getDevice_name()); + jo.put("fault_code",String.valueOf(error)); + jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError()))); + jo.put("fault_type",error_type); + return jo; + } + public void writing(List list) { Map itemMap = new HashMap(); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index 716b958d5..5bdcab2be 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -13,6 +13,7 @@ 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.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; @@ -45,7 +46,7 @@ import java.util.*; @Slf4j @Data @RequiredArgsConstructor -public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { +public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); @@ -65,7 +66,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); //分切行架机械手是否禁用 0否 1是 private int is_disable = 0; - + private String error_type = "fqhj_error_type"; Instruction cache_inst = null; String inst_type = null; @@ -1545,4 +1546,15 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl this.requireSucess = true; } } + + @Override + public JSONObject feedLmsRealFailedInfo() { + JSONObject jo = new JSONObject(); + jo.put("device_code",this.getDevice().getDevice_code()); + jo.put("device_name",this.getDevice().getDevice_name()); + jo.put("fault_code",String.valueOf(error)); + jo.put("fault_info",ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError()))); + jo.put("fault_type",error_type); + return jo; + } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index 7f270d8f4..77b1e3b10 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -14,6 +14,7 @@ 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.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; import org.nl.acs.device_driver.ScannerDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; @@ -36,6 +37,7 @@ 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.common.exception.BadRequestException; import org.nl.modules.system.service.ParamService; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.util.SpringContextHolder; @@ -50,7 +52,7 @@ import java.util.*; @Slf4j @Data @RequiredArgsConstructor -public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { +public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { protected ItemProtocol itemProtocol = new ItemProtocol(this); @Autowired @@ -116,7 +118,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe String device_code; String message; - + private String error_type = "ssx_error_type"; //请求成功标记 Boolean requireSucess = false; @@ -311,6 +313,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe } break; case 5: + String newBarcodes = null; //申请任务 if (!StrUtil.isEmpty(barcode())) { @@ -464,7 +467,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe logServer.deviceExecuteLog(device_code, "", "", "申请任务时,根据托盘号:" + container_code + ",查询出来得任务信息是:" + JSON.toJSONString(task)); if (!ObjectUtil.isEmpty(task)) { Instruction instdto = instructionService.findByTaskcodeAndStatus(task.getTask_code()); - if(ObjectUtil.isEmpty(instdto)){ + if (ObjectUtil.isEmpty(instdto)) { message = "当前载具号" + container_code + "查找对应指令起点与当前设备不符"; this.setIserror(true); return false; @@ -585,7 +588,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(), "1"))) { { Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code(), "1"); - if(!ObjectUtil.equal(instdto.getStart_device_code(),this.device_code)){ + if (!ObjectUtil.equal(instdto.getStart_device_code(), this.device_code)) { message = "当前载具号" + container_code + "查找对应指令起点与当前设备不符"; this.setIserror(true); logServer.deviceExecuteLog(this.device_code, "", "", "申请任务" @@ -842,17 +845,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe message = "申请贴标电气设备重量:" + weight + "异常"; throw new RuntimeException("重量为空!"); } -// if (task > 0) { -// Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); -// if (ObjectUtil.isEmpty(instruction)) { -// instruction = instructionService.findByCode(String.valueOf(task)); -// } -// vehicle_code = instruction.getVehicle_code(); -// } else { -// logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备任务号:" + task + "异常"); -// message = "申请贴标电气设备任务号:" + task + "异常"; -// throw new RuntimeException("任务号为空!"); -// } if (StrUtil.isEmpty(newBarcodes)) { logServer.deviceExecuteLog(device_code, "", "", "申请贴标电气设备载具号为空!"); message = "申请贴标电气设备载具号为空"; @@ -880,17 +872,28 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,请求参数:" + JSON.toJSONString(applyLabelingAndBindingRequest)); if (applyLabelingAndBindingResponse.getstatus() == 200) { + String is_auto_table = applyLabelingAndBindingResponse.getData().get("is_auto_table"); + String to_command = ""; + if (StrUtil.isEmpty(is_auto_table)) { + logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标失败,请维护客户信息是否自动贴标!"); + return; + } + if (StrUtil.equals(is_auto_table, "0")) { + to_command = "6"; + } else if (StrUtil.equals(is_auto_table, "1")) { + to_command = "5"; + } message = "申请贴标成功"; List list = new ArrayList(); Map map = new HashMap(); map.put("code", "to_command"); - map.put("value", "5"); + map.put("value", to_command); list.add(map); this.writing(list); this.writing(list); message = "申请贴标下发电气信号成功"; - logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse)); requireSucess = true; + logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse)); } else { message = "申请贴标失败," + applyLabelingAndBindingResponse.getMessage(); logServer.deviceExecuteLog(this.device_code, "", "", "申请贴标,返回参数:" + JSON.toJSONString(applyLabelingAndBindingResponse)); @@ -993,4 +996,15 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe } } + @Override + public JSONObject feedLmsRealFailedInfo() { + JSONObject jo = new JSONObject(); + jo.put("device_code", this.getDevice().getDevice_code()); + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("fault_code", String.valueOf(error)); + jo.put("fault_info", ErrorUtil.getDictDetail(error_type, String.valueOf(this.getError()))); + jo.put("fault_type", error_type); + return jo; + } + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingRequest.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingRequest.java index 65c5bb58e..3d116b04d 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingRequest.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyLabelingAndBindingRequest.java @@ -15,4 +15,6 @@ public class ApplyLabelingAndBindingRequest extends BaseRequest { private String weight; + private String is_bind; + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java index 5ec4d3744..d9b4cb330 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java @@ -104,6 +104,17 @@ public class CreateTaskRequest extends BaseRequest { */ String temperature; + /** + * agv取货高度 + */ + private String start_height; + + + /** + * agv放货高度 + */ + private String next_height; + /** * 扩展属性 */ 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 cf8012a22..f7a3ed0e0 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 @@ -42,6 +42,7 @@ public class WmsToAcsController { @PostMapping("/unLock") @Log(value = "解锁立库点位",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @ApiOperation("解锁立库点位") + @SaIgnore public ResponseEntity unLock(@RequestBody String whereJson) { return new ResponseEntity<>(wmstoacsService.unLock(whereJson), HttpStatus.OK); } @@ -57,6 +58,7 @@ public class WmsToAcsController { @PostMapping("/updateDeviceGoodsFromWms") @Log(value = "WMS修改点位状态",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @ApiOperation("WMS修改点位状态") + @SaIgnore public ResponseEntity updateDeviceGoodsFromWms(@RequestBody String whereJson) { return new ResponseEntity<>(wmstoacsService.updateDeviceGoodsFromWms(whereJson), HttpStatus.OK); } @@ -64,6 +66,7 @@ public class WmsToAcsController { @PostMapping("/areaControl") @Log(value = "区域控制",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) @ApiOperation("区域控制") + @SaIgnore public ResponseEntity areaControl(@RequestBody JSONObject whereJson) { return new ResponseEntity<>(wmstoacsService.areaControl(whereJson), HttpStatus.OK); } @@ -108,4 +111,36 @@ public class WmsToAcsController { public ResponseEntity updateTask(@RequestBody String whereJson){ return new ResponseEntity<>(wmstoacsService.updateTask(whereJson), HttpStatus.OK); } + + @PostMapping("/sendAgvChargeTask") + @Log(value = "LMS下发agv充电任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) + @ApiOperation("LMS下发agv充电任务") + @SaIgnore + public ResponseEntity sendAgvChargeTask(@RequestBody JSONObject param){ + return new ResponseEntity<>(wmstoacsService.sendAgvChargeTask(param), HttpStatus.OK); + } + + @PostMapping("/queryDeviceInfo") + @Log(value = "查询agv车辆信息",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) + @ApiOperation("查询agv车辆信息") + @SaIgnore + public ResponseEntity queryDeviceInfo(@RequestBody JSONObject param){ + return new ResponseEntity<>(wmstoacsService.queryDeviceInfo(param), HttpStatus.OK); + } + + @PostMapping("/syncfaultInfo") + @Log(value = "LMS同步报警码信息",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) + @ApiOperation("LMS同步报警码信息") + @SaIgnore + public ResponseEntity syncfaultInfo(){ + return new ResponseEntity<>(wmstoacsService.syncfaultInfo(), HttpStatus.OK); + } + + @PostMapping("/realTimefaultInfo") + @Log(value = "查询所有设备报警信息",isInterfaceLog = true,interfaceLogType= InterfaceLogType.LMS_TO_ACS) + @ApiOperation("查询所有设备报警信息") + @SaIgnore + public ResponseEntity realTimefaultInfo(@RequestBody JSONObject param){ + return new ResponseEntity<>(wmstoacsService.realTimefaultInfo(param), HttpStatus.OK); + } } 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 1aae7354d..80d80b8e1 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 @@ -100,4 +100,11 @@ public interface WmsToAcsService { */ Map updateTask(String whereJson); + Map sendAgvChargeTask(JSONObject param); + + Map queryDeviceInfo(JSONObject param); + + Map syncfaultInfo(); + + Map realTimefaultInfo(JSONObject param); } 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 f05daf04e..b43dba697 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 @@ -9,9 +9,16 @@ import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.AcsConfig; +import org.nl.acs.agv.server.NDCAgvService; +import org.nl.acs.agv.server.impl.NDCAgvServiceImpl; import org.nl.acs.common.IDriverService; import org.nl.acs.common.StandardOrdinarySiteDevice; import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device.service.dto.DeviceDto; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.FeedLmsRealFailed; +import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver; +import org.nl.acs.device_driver.basedriver.agv.ndctwo.AgvNdcTwoDeviceDriver; import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver; import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver; @@ -34,11 +41,16 @@ 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.DeviceExtraManageDto; +import org.nl.acs.opc.DeviceType; 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.domain.Dict; +import org.nl.modules.system.service.DictDetailService; +import org.nl.modules.system.service.DictService; import org.nl.modules.system.service.ParamService; +import org.nl.modules.system.service.dto.DictDetailDto; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.exception.WDKException; import org.nl.modules.wql.util.SpringContextHolder; @@ -51,6 +63,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; @Service @RequiredArgsConstructor @@ -65,10 +78,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { private final DeviceAppService deviceAppService; private final RouteLineService routeLineService; private final AcsToLiKuService acsToLiKuService; + private final DictDetailService dictDetailService; + private final DictService dictService; - private String log_file_type="log_file_type"; - private String log_type="LMS请求ACS"; + private String log_file_type = "log_file_type"; + private String log_type = "LMS请求ACS"; @Override public CancelTaskResponse cancelFromWms(String param) throws Exception { @@ -244,8 +259,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("countdown_min", hongXiangConveyorDeviceDriver.getCountdown_min()); jo.put("countdown_sec", hongXiangConveyorDeviceDriver.getCountdown_sec()); //温度需要除以10 - jo.put("temperature", hongXiangConveyorDeviceDriver.getTo_temperature()/10); - jo.put("now_temperature", hongXiangConveyorDeviceDriver.getTemperature()/10); + jo.put("temperature", hongXiangConveyorDeviceDriver.getTo_temperature() / 10); + jo.put("now_temperature", hongXiangConveyorDeviceDriver.getTemperature() / 10); jo.put("door", hongXiangConveyorDeviceDriver.getDoor()); jo.put("finish", hongXiangConveyorDeviceDriver.getFinish()); @@ -319,7 +334,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } - @Override public Map putPlusPullAction(String param) { try { @@ -333,61 +347,61 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { if (ObjectUtil.isEmpty(device)) { JSONObject resultJson = new JSONObject(); resultJson.put("status", HttpStatus.BAD_REQUEST.value()); - resultJson.put("message", "未找到对应的设备:"+device_code); + resultJson.put("message", "未找到对应的设备:" + device_code); return resultJson; } PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; if (device.getDeviceDriver() instanceof PlugPullDeviceSiteDeviceDriver) { plugPullDeviceSiteDeviceDriver = (PlugPullDeviceSiteDeviceDriver) device.getDeviceDriver(); // 0 穿轴 1拔轴 - if(StrUtil.equals(type,"1")){ + if (StrUtil.equals(type, "1")) { - if(plugPullDeviceSiteDeviceDriver.getMode() == 1){ + if (plugPullDeviceSiteDeviceDriver.getMode() == 1) { JSONObject resultJson = new JSONObject(); resultJson.put("status", HttpStatus.BAD_REQUEST.value()); resultJson.put("message", "请求拔轴,当前设备工作模式未自动"); return resultJson; } - if(plugPullDeviceSiteDeviceDriver.getAction() == 0){ + if (plugPullDeviceSiteDeviceDriver.getAction() == 0) { JSONObject resultJson = new JSONObject(); resultJson.put("status", HttpStatus.BAD_REQUEST.value()); resultJson.put("message", "请求拔轴,当前设备未全自动"); return resultJson; } - if(plugPullDeviceSiteDeviceDriver.getStatus() != 0){ + if (plugPullDeviceSiteDeviceDriver.getStatus() != 0) { JSONObject resultJson = new JSONObject(); resultJson.put("status", HttpStatus.BAD_REQUEST.value()); resultJson.put("message", "请求拔轴,当前设备未待机"); return resultJson; } - if(plugPullDeviceSiteDeviceDriver.getControl() != 0){ + if (plugPullDeviceSiteDeviceDriver.getControl() != 0) { JSONObject resultJson = new JSONObject(); resultJson.put("status", HttpStatus.BAD_REQUEST.value()); resultJson.put("message", "请求拔轴,当前设备未远程控制"); return resultJson; } - if(plugPullDeviceSiteDeviceDriver.getMove() != 0){ + if (plugPullDeviceSiteDeviceDriver.getMove() != 0) { JSONObject resultJson = new JSONObject(); resultJson.put("status", HttpStatus.BAD_REQUEST.value()); resultJson.put("message", "请求拔轴,当前设备有轴"); return resultJson; } - if(plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() ==1 - && plugPullDeviceSiteDeviceDriver.getStatus() ==0 && plugPullDeviceSiteDeviceDriver.getMove() ==0 - && plugPullDeviceSiteDeviceDriver.getControl() ==0 ){ + if (plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() == 1 + && plugPullDeviceSiteDeviceDriver.getStatus() == 0 && plugPullDeviceSiteDeviceDriver.getMove() == 0 + && plugPullDeviceSiteDeviceDriver.getControl() == 0) { List list = new ArrayList(); Map map = new HashMap(); - map.put("code","to_size"); - map.put("value",size); + map.put("code", "to_size"); + map.put("value", size); list.add(map); Map map2 = new HashMap(); - map2.put("code","to_type"); - map2.put("value",type); + map2.put("code", "to_type"); + map2.put("value", type); list.add(map2); Map map3 = new HashMap(); - map3.put("code","to_command"); - map3.put("value","1"); + map3.put("code", "to_command"); + map3.put("value", "1"); list.add(map3); plugPullDeviceSiteDeviceDriver.writing(list); @@ -398,55 +412,55 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { return resultJson; } - } else if (StrUtil.equals(type,"0")){ + } else if (StrUtil.equals(type, "0")) { - if(plugPullDeviceSiteDeviceDriver.getMode() == 1){ + if (plugPullDeviceSiteDeviceDriver.getMode() == 1) { JSONObject resultJson = new JSONObject(); resultJson.put("status", HttpStatus.BAD_REQUEST.value()); resultJson.put("message", "请求插轴,当前设备工作模式未自动"); return resultJson; } - if(plugPullDeviceSiteDeviceDriver.getAction() == 0){ + if (plugPullDeviceSiteDeviceDriver.getAction() == 0) { JSONObject resultJson = new JSONObject(); resultJson.put("status", HttpStatus.BAD_REQUEST.value()); resultJson.put("message", "请求插轴,当前设备未全自动"); return resultJson; } - if(plugPullDeviceSiteDeviceDriver.getStatus() != 0){ + if (plugPullDeviceSiteDeviceDriver.getStatus() != 0) { JSONObject resultJson = new JSONObject(); resultJson.put("status", HttpStatus.BAD_REQUEST.value()); resultJson.put("message", "请求插轴,当前设备未待机"); return resultJson; } - if(plugPullDeviceSiteDeviceDriver.getControl() != 0){ + if (plugPullDeviceSiteDeviceDriver.getControl() != 0) { JSONObject resultJson = new JSONObject(); resultJson.put("status", HttpStatus.BAD_REQUEST.value()); resultJson.put("message", "请求插轴,当前设备未远程控制"); return resultJson; } - if(plugPullDeviceSiteDeviceDriver.getMove() != 1){ + if (plugPullDeviceSiteDeviceDriver.getMove() != 1) { JSONObject resultJson = new JSONObject(); resultJson.put("status", HttpStatus.BAD_REQUEST.value()); resultJson.put("message", "请求插轴,当前设备没有轴"); return resultJson; } - if(plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() ==1 - && plugPullDeviceSiteDeviceDriver.getStatus() ==0 && plugPullDeviceSiteDeviceDriver.getMove() ==1 - && plugPullDeviceSiteDeviceDriver.getControl() ==0 ){ + if (plugPullDeviceSiteDeviceDriver.getMode() == 0 && plugPullDeviceSiteDeviceDriver.getAction() == 1 + && plugPullDeviceSiteDeviceDriver.getStatus() == 0 && plugPullDeviceSiteDeviceDriver.getMove() == 1 + && plugPullDeviceSiteDeviceDriver.getControl() == 0) { List list = new ArrayList(); Map map = new HashMap(); - map.put("code","to_size"); - map.put("value",size); + map.put("code", "to_size"); + map.put("value", size); list.add(map); Map map2 = new HashMap(); - map2.put("code","to_type"); - map2.put("value",type); + map2.put("code", "to_type"); + map2.put("value", type); list.add(map2); Map map3 = new HashMap(); - map3.put("code","to_command"); - map3.put("value","1"); + map3.put("code", "to_command"); + map3.put("value", "1"); list.add(map3); plugPullDeviceSiteDeviceDriver.writing(list); @@ -471,7 +485,6 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } - @Override public CreateTaskResponse crateTask(String param) { try { @@ -482,7 +495,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { ParamService paramService = SpringContextHolder.getBean(ParamService.class); String cancelTaskCheck = paramService.findByCode(AcsConfig.ISALLOWTASK).getValue(); JSONArray errArr = new JSONArray(); - if(StrUtil.equals(cancelTaskCheck,"0")){ + if (StrUtil.equals(cancelTaskCheck, "0")) { response.setStatus(400); response.setMessage("ACS系统需要更新,请稍等"); response.setErrArr(datas); @@ -511,6 +524,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { oven_time = Double.parseDouble(request.getOven_time()); } String temperature = request.getTemperature(); + String start_height = request.getStart_height(); + String next_height = request.getNext_height(); Map params = request.getParams(); String start_point_code = ""; @@ -543,7 +558,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { continue; } - if(StrUtil.equals(task_type,"8")){ + if (StrUtil.equals(task_type, "8")) { next_device_code = request.getPut_device_code(); put_device_code = request.getNext_device_code(); } @@ -607,29 +622,28 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { route_plan_code = "normal"; } - if(StrUtil.equals(task_type,"5")){ + if (StrUtil.equals(task_type, "5")) { Device device = deviceAppService.findDeviceByCode(next_device_code); SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; - if(device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { + if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); if (ObjectUtil.equal("true", siemensConveyorDeviceDriver.getExtraValue().get("inspect_in_stock"))) { - if(siemensConveyorDeviceDriver.getMove() == 1) - { + if (siemensConveyorDeviceDriver.getMove() == 1) { JSONObject json = new JSONObject(); json.put("task_code", task_code); json.put("ext_task_id", ext_task_id); - json.put("message", "终点"+siemensConveyorDeviceDriver.getDevice_code()+"有货无法生成任务"); + json.put("message", "终点" + siemensConveyorDeviceDriver.getDevice_code() + "有货无法生成任务"); errArr.add(json); continue; } } } - if( taskService.querySameDeviceReadyTask(start_device_code,next_device_code,"0") > 1){ + if (taskService.querySameDeviceReadyTask(start_device_code, next_device_code, "0") > 1) { JSONObject json = new JSONObject(); json.put("task_code", task_code); json.put("ext_task_id", ext_task_id); - json.put("message", "已存在相同的起点:"+start_device_code + "终点:"+ next_device_code + "未执行的输送任务"); + json.put("message", "已存在相同的起点:" + start_device_code + "终点:" + next_device_code + "未执行的输送任务"); errArr.add(json); continue; } @@ -640,7 +654,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { JSONObject json = new JSONObject(); json.put("task_code", task_code); json.put("ext_task_id", ext_task_id); - json.put("message", "不能存在相同的任务号:"+task_code); + json.put("message", "不能存在相同的任务号:" + task_code); errArr.add(json); continue; } @@ -650,7 +664,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { JSONObject json = new JSONObject(); json.put("task_code", task_code); json.put("ext_task_id", ext_task_id); - json.put("message", "不能存在相同的托盘号:"+vehicle_code); + json.put("message", "不能存在相同的托盘号:" + vehicle_code); errArr.add(json); continue; } @@ -693,6 +707,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("vehicle_type", vehicle_type); jo.put("storage_task_type", storage_task_type); jo.put("agv_system_type", agv_system_type); + jo.put("start_height", start_height); + jo.put("next_height", next_height); jo.put("oven_time", (int) Math.ceil(oven_time)); jo.put("remark", remark); jo.put("params", params); @@ -711,7 +727,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { Instruction inst = null; try { inst = taskService.createTemporaryInst(task_dto); - } catch (Exception e){ + } catch (Exception e) { JSONObject json = new JSONObject(); json.put("task_code", task_code); json.put("ext_task_id", ext_task_id); @@ -719,9 +735,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { errArr.add(json); continue; } - Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(),inst); + Resp resp = acsToLiKuService.sendInst(task_dto.getStorage_task_type(), inst); - if(StrUtil.equals(resp.result,"true")){ + if (StrUtil.equals(resp.result, "true")) { //创建任务和指令 taskService.create(task_dto); inst.setSend_status("1"); @@ -756,7 +772,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { response.setMessage("success"); } else { response.setStatus(400); - if(ObjectUtil.isNotEmpty(errArr)){ + if (ObjectUtil.isNotEmpty(errArr)) { response.setMessage(errArr.getJSONObject(0).getString("message")); } else { response.setMessage("false"); @@ -779,22 +795,40 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { log.info("unLock--------------:输入参数" + param); JSONObject jo = JSONObject.parseObject(param); String task_code = String.valueOf(jo.get("task_code")); + if (StrUtil.isEmpty(task_code)) { + throw new BadRequestException("任务号不能为空"); + } String device_code = String.valueOf(jo.get("device_code")); + if (StrUtil.isEmpty(device_code)) { + throw new BadRequestException("设备号不能为空"); + } String vehicle_code = String.valueOf(jo.get("vehicle_code")); + if (StrUtil.isEmpty(vehicle_code)) { + throw new BadRequestException("载具号不能为空"); + } OutConfirmRequest outConfirmRequest = new OutConfirmRequest(); outConfirmRequest.setOutPortNo(device_code); outConfirmRequest.setPalletCode(vehicle_code); Instruction instruction = instructionService.findByCode(String.valueOf(task_code)); - if(ObjectUtil.isNotEmpty(instruction)){ + if (ObjectUtil.isNotEmpty(instruction)) { task_code = instruction.getInstruction_code(); outConfirmRequest.setOrderId(task_code); } - Resp resp = acsToLiKuService.outConfirm(outConfirmRequest); - - + Resp resp = acsToLiKuService.outConfirm(outConfirmRequest); + if (StrUtil.equals(resp.getResult(), "false")) { + JSONObject resultJson = new JSONObject(); + resultJson.put("status", 400); + resultJson.put("message", resp.getComment()); + log.info("unLock--------------:输出参数" + resultJson); + return resultJson; + } } catch (Exception e) { e.printStackTrace(); - log.info("unLock--------------:输出参数" + e.getMessage()); + JSONObject resultJson = new JSONObject(); + resultJson.put("status", 400); + resultJson.put("message", e.getMessage()); + log.info("unLock--------------:输出参数" + resultJson); + return resultJson; } finally { MDC.remove(log_file_type); } @@ -819,13 +853,13 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { //1-允许取放; 2-允许离开 String option = jsonObject.getString("option"); StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - Device device_k = deviceAppService.findDeviceByCode(device_code+"_K"); - Device device_m = deviceAppService.findDeviceByCode(device_code+"_M"); - if(device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){ + Device device_k = deviceAppService.findDeviceByCode(device_code + "_K"); + Device device_m = deviceAppService.findDeviceByCode(device_code + "_M"); + if (device_k.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_k.getDeviceDriver(); standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option)); } - if(device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver){ + if (device_m.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { standardOrdinarySiteDeviceDriver = (StandardOrdinarySiteDeviceDriver) device_m.getDeviceDriver(); standardOrdinarySiteDeviceDriver.setOption(Integer.parseInt(option)); } @@ -839,11 +873,131 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } else { resultJson.put("status", HttpStatus.BAD_REQUEST.value()); resultJson.put("message", "操作失败"); - if(ObjectUtil.isNotEmpty(errArr)){ - resultJson.put("errArr",errArr); + if (ObjectUtil.isNotEmpty(errArr)) { + resultJson.put("errArr", errArr); } } return resultJson; } + @Override + public Map sendAgvChargeTask(JSONObject param) { + log.info("sendAgvChargeTask--------------:输入参数" + param.toString()); + String agv_system = param.getString("agv_system"); + String car_no = param.getString("car_no"); + if (StrUtil.isEmpty(agv_system)) { + throw new BadRequestException("AGV系统类型不能为空"); + } + if (StrUtil.isEmpty(car_no)) { + throw new BadRequestException("AGV车号不能为空"); + } + Device device = deviceAppService.findDeviceByCode(car_no); + if (device == null) { + throw new BadRequestException("agv车号在ACS系统中不存在!"); + } + NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvServiceImpl.class); + agvService.createChargingTaskToNDC(agv_system, car_no); + JSONObject resp = new JSONObject(); + resp.put("status", 200); + resp.put("message", "操作成功"); + return resp; + } + + @Override + public Map queryDeviceInfo(JSONObject param) { + log.info("queryDeviceInfo--------------:输入参数" + param.toString()); + String region_code = param.getString("region_code"); + if (StrUtil.isEmpty(region_code)) { + throw new BadRequestException("区域编码不能为空"); + } + AgvNdcTwoDeviceDriver agvNdcTwoDeviceDriver; + AgvNdcOneDeviceDriver agvNdcOneDeviceDriver; + List devices = deviceAppService.findDevice(DeviceType.agv); + JSONArray data = new JSONArray(); + if (ObjectUtil.isNotEmpty(devices)) { + for (int i = 0; i < devices.size(); i++) { + Device device = devices.get(i); + Device agvDevice = deviceAppService.findDeviceByCode(device.getDevice_code()); + if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { + if (StrUtil.equals(region_code, "1")) { + agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver(); + JSONObject jo = agvNdcTwoDeviceDriver.getDeviceStatusName(); + data.add(jo); + } + } + if (agvDevice.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) { + if (StrUtil.equals(region_code, "5")) { + agvNdcOneDeviceDriver = (AgvNdcOneDeviceDriver) agvDevice.getDeviceDriver(); + JSONObject jo = agvNdcOneDeviceDriver.getDeviceStatusName(); + data.add(jo); + } + } + } + } + JSONObject resp = new JSONObject(); + resp.put("status", 200); + resp.put("message", "操作成功"); + resp.put("data", data); + return resp; + } + + @Override + public Map syncfaultInfo() { + log.info("syncfaultInfo--------------:输入参数"); + JSONArray data = new JSONArray(); + List dicts = dictService.queryAll(); + if (ObjectUtil.isNotEmpty(dicts)) { + List error_dists = dicts + .stream() + .filter(dict -> dict.getName().contains("error_type")) + .collect(Collectors.toList()); + if (ObjectUtil.isNotEmpty(error_dists)) { + for (int i = 0; i < error_dists.size(); i++) { + Dict dict = error_dists.get(i); + String dictName = dict.getName(); + List dictDetailDtos = dictDetailService.getDictByName(dictName); + for (DictDetailDto dictDetailDto : dictDetailDtos) { + JSONObject faultInfo = new JSONObject(); + faultInfo.put("fault_type", dictName); + faultInfo.put("fault_code", dictDetailDto.getValue()); + faultInfo.put("fault_info", dictDetailDto.getLabel()); + data.add(faultInfo); + } + } + } + } + JSONObject resp = new JSONObject(); + resp.put("status", 200); + resp.put("message", "操作成功"); + resp.put("data", data); + return resp; + } + + @Override + public Map realTimefaultInfo(JSONObject param) { + log.info("realTimefaultInfo--------------:输入参数" + param.toString()); + String device_code = param.getString("device_code"); + JSONArray data = new JSONArray(); + if (StrUtil.isNotEmpty(device_code)) { + String[] devices = device_code.split(","); + Device device = null; + for (String deviceCode : devices) { + device = deviceAppService.findDeviceByCode(deviceCode); + if (device == null) { + continue; + } + if (device.getDeviceDriver() instanceof FeedLmsRealFailed) { + FeedLmsRealFailed feedLmsRealFailed = (FeedLmsRealFailed) device.getDeviceDriver(); + JSONObject jsonObject = feedLmsRealFailed.feedLmsRealFailedInfo(); + data.add(jsonObject); + } + } + } + JSONObject resp = new JSONObject(); + resp.put("status", 200); + resp.put("message", "操作成功"); + resp.put("data", data); + return resp; + } + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/history/ErrorUtil.java b/acs/nladmin-system/src/main/java/org/nl/acs/history/ErrorUtil.java index 5b12aec70..8bd44c828 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/history/ErrorUtil.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/history/ErrorUtil.java @@ -10,9 +10,13 @@ import org.nl.modules.system.service.impl.DictDetailServiceImpl; import org.nl.modules.system.service.impl.DictServiceImpl; import org.nl.modules.wql.util.SpringContextHolder; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; +import java.util.stream.Collectors; /** * @author: geng by @@ -41,6 +45,21 @@ public class ErrorUtil { return detail == null ? "字典表未配置对应的报警信息" : detail; } + public static Map getDictDetailByName(String type) { + getDict(); + List dictDetailDtos = dictMap.get(type); + Map map = new HashMap<>(); + if (ObjectUtil.isNotEmpty(dictDetailDtos)) { + List dtos = dictDetailDtos + .stream() + .filter(dictDetailDto -> !dictDetailDto.getValue().equals("0")) + .filter(dictDetailDto -> !dictDetailDto.getValue().equals("-1")) + .collect(Collectors.toList()); + dtos.forEach(dictDetailDto -> map.put(Integer.parseInt(dictDetailDto.getValue()), dictDetailDto.getLabel())); + } + return map; + } + public static void getDict() { if (ObjectUtil.isEmpty(dictMap)) { @@ -60,4 +79,46 @@ public class ErrorUtil { return f.apply(name); } + public static Map getAgvErrorMsg(Integer ageErrorNum) { + Map agvMap = getDictDetailByName("agv_error_type"); + Integer[] keys = agvMap.keySet().toArray(new Integer[0]); + String message = ""; + String code = ""; + out: + for (int i = 1; i < 1 << keys.length; i++) { + int sum = 0; + StringBuffer sb = new StringBuffer(); + StringBuffer sbCode = new StringBuffer(); + inner: + for (int j = 0; j < keys.length; j++) { + if ((i & 1 << j) != 0) { + sum += keys[j]; + sb.append(agvMap.get(keys[j])).append(","); + sbCode.append(keys[j]).append(","); + } + } + if (sum == ageErrorNum) { + code = sbCode.toString(); + message = sb.toString(); + break out; + } + } + Map map = new HashMap<>(); + String info = replace(message); + code = replace(code); + map.put("code", StrUtil.isEmpty(code) ? "-1" : code); + map.put("info", StrUtil.isEmpty(info) ? "AGV上报报警代码有误" : info); + return map; + } + + public static String replace(String message) { + if (StrUtil.isEmpty(message)) { + return null; + } + if (message.endsWith(",")) { + return message.substring(0, message.length() - 1); + } + return message; + } + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java index 5a6f57416..214cd9b76 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/dto/InstructionDto.java @@ -348,4 +348,15 @@ public class InstructionDto implements Serializable { */ private String agv_system_type; + /** + * agv取货高度 + */ + private String start_height = "0"; + + + /** + * agv放货高度 + */ + private String next_height = "0"; + } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java index db8e149ae..af3bd6d92 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java @@ -296,4 +296,15 @@ public class TaskDto implements Serializable { */ private String carno; + /** + * agv取货高度 + */ + private String start_height = "0"; + + + /** + * agv放货高度 + */ + private String next_height = "0"; + } 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 a33720a1e..63921aec5 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 @@ -68,308 +68,317 @@ import java.util.stream.Collectors; @RequiredArgsConstructor @Slf4j public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { - List tasks = new CopyOnWriteArrayList<>(); + List tasks = new CopyOnWriteArrayList<>(); - @Autowired DeviceAppService deviceAppService; - @Autowired RouteLineService routelineserver; - @Autowired AcsToWmsService acstowmsService; - @Autowired TaskFeedbackService taskFeedbackService; - @Autowired ParamService paramService; - @Autowired XianGongAgvService agvService; - @Autowired RouteLineService routeLineService; - @Autowired DeviceAssignedService deviceAssignedService; - @Autowired InstructionService instructionService; - @Autowired StorageCellService storageCellService; + @Autowired + DeviceAppService deviceAppService; + @Autowired + RouteLineService routelineserver; + @Autowired + AcsToWmsService acstowmsService; + @Autowired + TaskFeedbackService taskFeedbackService; + @Autowired + ParamService paramService; + @Autowired + XianGongAgvService agvService; + @Autowired + RouteLineService routeLineService; + @Autowired + DeviceAssignedService deviceAssignedService; + @Autowired + InstructionService instructionService; + @Autowired + StorageCellService storageCellService; - @Override - public void autoInitial() throws Exception { - Class var1 = TaskInstructionLock.class; - synchronized (TaskInstructionLock.class) { - this.reload(); - } - } - - public synchronized void reload() { - List list = this.queryAll("task_status <2 and is_delete =0 order by create_time"); - - tasks = new CopyOnWriteArrayList<>(list); - } - - @Override - public List queryAll(String whereJson) { - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONArray arr = wo.query(whereJson).getResultJSONArray(0); - List list = arr.toJavaList(TaskDto.class); - return list; - } - - @Override - public Map queryAll(Map whereJson, Pageable page) { - - HashMap map = new HashMap<>(); - map.put("flag", "1"); - String task_code = (String) whereJson.get("task_code"); - String vehicle_code = (String) whereJson.get("vehicle_code"); - String material_type = (String) whereJson.get("material_type"); - String status = (String) whereJson.get("status"); - String point_code = (String) whereJson.get("point_code"); - String is_over = (String) whereJson.get("is_over"); - if (!StrUtil.isEmpty(task_code)) { - map.put("task_code", task_code); - } - if (!StrUtil.isEmpty(vehicle_code)) { - map.put("vehicle_code", vehicle_code); - } - if (!StrUtil.isEmpty(material_type)) { - map.put("material_type", material_type); - } - if (!StrUtil.isEmpty(status)) { - map.put("status", status); - } - if (!StrUtil.isEmpty(point_code)) { - map.put("point_code", point_code); - } - if (!StrUtil.isEmpty(is_over)) { - map.put("is_over", is_over); - } - final JSONObject jo = - WQL.getWO("QTASK_QUERY").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), ""); - return jo; - } - - @Override - public Map queryAllByCache(Map whereJson, Pageable page) { - this.reload(); - String task_code = (String) whereJson.get("task_code"); - String vehicle_code = (String) whereJson.get("vehicle_code"); - String material_type = (String) whereJson.get("material_type"); - String status = (String) whereJson.get("status"); - String point_code = (String) whereJson.get("point_code"); - String is_over = (String) whereJson.get("is_over"); - String task_type = (String) whereJson.get("task_type"); - List taskList = new ArrayList(); - - synchronized (TaskServiceImpl.class){ - Iterator it = tasks.iterator(); - while (it.hasNext()) { - TaskDto task = it.next(); - if ("1".equals(is_over) && Integer.valueOf(task.getTask_status()) < 2) { - continue; - } - if (!"1".equals(is_over) && Integer.valueOf(task.getTask_status()) >= 2) { - continue; - } - if (!ObjectUtil.isEmpty(task_code) && !task.getTask_code().contains(task_code)) { - continue; - } - if (!ObjectUtil.isEmpty(status) && !task.getTask_status().equals(status)) { - continue; - } - if (!ObjectUtil.isEmpty(vehicle_code) && !task.getVehicle_code().contains(vehicle_code)) { - continue; - } - if (!ObjectUtil.isEmpty(material_type) && !task.getMaterial().equals(material_type)) { - continue; - } - if (!ObjectUtil.isEmpty(point_code) - && !(task.getStart_point_code().contains(point_code) - || task.getNext_point_code().contains(point_code))) { - continue; - } - if (!ObjectUtil.isEmpty(task_type) && !task.getTask_type().equals(task_type)) { - continue; - } - taskList.add(task); - } - - // 按照创建时间排序 - taskList = - taskList.stream() - .sorted( - (task1, task2) -> - DateUtil.compare( - DateUtil.parseDate(task1.getCreate_time()), - DateUtil.parse(task2.getCreate_time()))) - .collect(Collectors.toList()); - - } - - Integer currentPageNumber = page.getPageNumber() + 1; - Integer pageMaxSize = page.getPageSize(); - List taskDtoList = - taskList.stream() - .skip((currentPageNumber - 1) * pageMaxSize) - .limit(pageMaxSize) - .collect(Collectors.toList()); - JSONObject jo = new JSONObject(); - jo.put("content", taskDtoList); - jo.put("totalElements", taskList.size()); - return jo; - - } - - @Override - public Map getAll(Map whereJson, Pageable page) { - // WQLObject wo = WQLObject.getWQLObject("acs_task"); - // ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "task_status < 2 ", "update_time - // desc"); - HashMap map = new HashMap<>(); - map.put("flag", "2"); - String task_code = (String) whereJson.get("task_code"); - String vehicle_code = (String) whereJson.get("vehicle_code"); - String task_type = (String) whereJson.get("task_type"); - String status = (String) whereJson.get("status"); - String point_code = (String) whereJson.get("point_code"); - String create_time = (String) whereJson.get("createTime"); - String end_time = (String) whereJson.get("end_time"); - if (!StrUtil.isEmpty(task_code)) { - map.put("task_code", task_code); - } - if (!StrUtil.isEmpty(vehicle_code)) { - map.put("vehicle_code", vehicle_code); - } - if (!StrUtil.isEmpty(task_type)) { - map.put("task_type", task_type); - } - if (!StrUtil.isEmpty(status)) { - map.put("status", status); - } - if (!StrUtil.isEmpty(point_code)) { - map.put("point_code", point_code); - } - if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) { - map.put("create_time", create_time); - map.put("end_time", end_time); - } - JSONObject jsonObject1 = - WQL.getWO("QTASK_QUERY") - .addParamMap(map) - .pageQuery(WqlUtil.getHttpContext(page), "create_time desc"); - JSONArray array = jsonObject1.getJSONArray("content"); - int totalElements = (Integer) jsonObject1.get("totalElements"); - JSONArray arr = new JSONArray(); - for (int i = 0; i < array.size(); i++) { - JSONObject jsonObject = (JSONObject) array.get(i); - jsonObject.put("hasChildren", true); - arr.add(jsonObject); - } - JSONObject jo = new JSONObject(); - jo.put("content", arr); - jo.put("totalElements", totalElements); - return jo; - } - - @Override - public List queryAll(Map whereJson) { - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONArray arr = wo.query().getResultJSONArray(0); - List list = arr.toJavaList(TaskDto.class); - return list; - } - - @Override - public TaskDto findById(String task_id) { - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = wo.query("task_id ='" + task_id + "'").uniqueResult(0); - final TaskDto obj = json.toJavaObject(TaskDto.class); - return obj; - } - - @Override - public TaskDto findByTaskCode(String task_code) { - - List list = new ArrayList<>(); - Iterator iterator = tasks.iterator(); - while (iterator.hasNext()) { - TaskDto task = iterator.next(); - if (StrUtil.equals(task.getTask_code(),task_code)) { - return task; - } - } - return null; - } - - - @Override - public List queryAllUnfinished(Map whereJson) { - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONArray arr = wo.query("task_status < 2 ").getResultJSONArray(0); - List list = arr.toJavaList(TaskDto.class); - return list; - } - - @Override - public TaskDto findByCode(String code) { - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0); - final TaskDto obj = json.toJavaObject(TaskDto.class); - return obj; - } - - @Override - public List queryTaskByDeviceCode(String device_code) { - List list = new ArrayList<>(); - Iterator iterator = tasks.iterator(); - while (iterator.hasNext()) { - TaskDto task = iterator.next(); - if (task.getStart_device_code().equals(device_code) - && StrUtil.equals(task.getTask_status(), "0")) { - list.add(task); + @Override + public void autoInitial() throws Exception { + Class var1 = TaskInstructionLock.class; + synchronized (TaskInstructionLock.class) { + this.reload(); } - } - return list; - } + } - @Override - public List queryTaskByStartDeviceCode(String start_device_code) { - List list = new ArrayList<>(); - Iterator iterator = tasks.iterator(); - while (iterator.hasNext()) { - TaskDto task = iterator.next(); - if (!StrUtil.equals(task.getTask_type(), "6")) { - continue; - } - if ((task.getStart_device_code().equals(start_device_code) - || task.getStart_device_code2().equals(start_device_code)) - && StrUtil.equals(task.getTask_status(), "0")) { - list.add(task); - } - } - return list; - } + public synchronized void reload() { + List list = this.queryAll("task_status <2 and is_delete =0 order by create_time"); - @Override - public List queryTaskByBackDeviceCode(String back_start_device_code) { - List list = new ArrayList<>(); - Iterator iterator = tasks.iterator(); - while (iterator.hasNext()) { - TaskDto task = iterator.next(); - if (!StrUtil.equals(task.getTask_type(), "6")) { - continue; - } - if (task.getStart_device_code().equals(back_start_device_code) - && StrUtil.equals(task.getTask_status(), "0")) { - list.add(task); - } - } - return list; - } + tasks = new CopyOnWriteArrayList<>(list); + } - @Override - public List queryTaskByDeviceCodeAndStatus(String device_code) { - List list = new ArrayList<>(); - Iterator iterator = tasks.iterator(); - while (iterator.hasNext()) { - TaskDto task = iterator.next(); - if (task.getStart_device_code().equals(device_code) - && StrUtil.equals(task.getTask_status(), "1")) { - Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code()); - if (ObjectUtil.isNotEmpty(instruction)) { - list.add(task); - } - } else { - if(StrUtil.equals(task.getTask_type(),"8") && StrUtil.isNotEmpty(task.getPut_device_code())) - { + @Override + public List queryAll(String whereJson) { + WQLObject wo = WQLObject.getWQLObject("acs_task"); + JSONArray arr = wo.query(whereJson).getResultJSONArray(0); + List list = arr.toJavaList(TaskDto.class); + return list; + } + + @Override + public Map queryAll(Map whereJson, Pageable page) { + + HashMap map = new HashMap<>(); + map.put("flag", "1"); + String task_code = (String) whereJson.get("task_code"); + String vehicle_code = (String) whereJson.get("vehicle_code"); + String material_type = (String) whereJson.get("material_type"); + String status = (String) whereJson.get("status"); + String point_code = (String) whereJson.get("point_code"); + String is_over = (String) whereJson.get("is_over"); + if (!StrUtil.isEmpty(task_code)) { + map.put("task_code", task_code); + } + if (!StrUtil.isEmpty(vehicle_code)) { + map.put("vehicle_code", vehicle_code); + } + if (!StrUtil.isEmpty(material_type)) { + map.put("material_type", material_type); + } + if (!StrUtil.isEmpty(status)) { + map.put("status", status); + } + if (!StrUtil.isEmpty(point_code)) { + map.put("point_code", point_code); + } + if (!StrUtil.isEmpty(is_over)) { + map.put("is_over", is_over); + } + final JSONObject jo = + WQL.getWO("QTASK_QUERY").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), ""); + return jo; + } + + @Override + public Map queryAllByCache(Map whereJson, Pageable page) { + this.reload(); + String task_code = (String) whereJson.get("task_code"); + String vehicle_code = (String) whereJson.get("vehicle_code"); + String material_type = (String) whereJson.get("material_type"); + String status = (String) whereJson.get("status"); + String point_code = (String) whereJson.get("point_code"); + String is_over = (String) whereJson.get("is_over"); + String task_type = (String) whereJson.get("task_type"); + List taskList = new ArrayList(); + + synchronized (TaskServiceImpl.class) { + Iterator it = tasks.iterator(); + while (it.hasNext()) { + TaskDto task = it.next(); + if ("1".equals(is_over) && Integer.valueOf(task.getTask_status()) < 2) { + continue; + } + if (!"1".equals(is_over) && Integer.valueOf(task.getTask_status()) >= 2) { + continue; + } + if (!ObjectUtil.isEmpty(task_code) && !task.getTask_code().contains(task_code)) { + continue; + } + if (!ObjectUtil.isEmpty(status) && !task.getTask_status().equals(status)) { + continue; + } + if (!ObjectUtil.isEmpty(vehicle_code) && !task.getVehicle_code().contains(vehicle_code)) { + continue; + } + if (!ObjectUtil.isEmpty(material_type) && !task.getMaterial().equals(material_type)) { + continue; + } + if (!ObjectUtil.isEmpty(point_code) + && !(task.getStart_point_code().contains(point_code) + || task.getNext_point_code().contains(point_code))) { + continue; + } + if (!ObjectUtil.isEmpty(task_type) && !task.getTask_type().equals(task_type)) { + continue; + } + taskList.add(task); + } + + // 按照创建时间排序 + taskList = + taskList.stream() + .sorted( + (task1, task2) -> + DateUtil.compare( + DateUtil.parseDate(task1.getCreate_time()), + DateUtil.parse(task2.getCreate_time()))) + .collect(Collectors.toList()); + + } + + Integer currentPageNumber = page.getPageNumber() + 1; + Integer pageMaxSize = page.getPageSize(); + List taskDtoList = + taskList.stream() + .skip((currentPageNumber - 1) * pageMaxSize) + .limit(pageMaxSize) + .collect(Collectors.toList()); + JSONObject jo = new JSONObject(); + jo.put("content", taskDtoList); + jo.put("totalElements", taskList.size()); + return jo; + + } + + @Override + public Map getAll(Map whereJson, Pageable page) { + // WQLObject wo = WQLObject.getWQLObject("acs_task"); + // ResultBean rb = wo.pagequery(WqlUtil.getHttpContext(page), "task_status < 2 ", "update_time + // desc"); + HashMap map = new HashMap<>(); + map.put("flag", "2"); + String task_code = (String) whereJson.get("task_code"); + String vehicle_code = (String) whereJson.get("vehicle_code"); + String task_type = (String) whereJson.get("task_type"); + String status = (String) whereJson.get("status"); + String point_code = (String) whereJson.get("point_code"); + String create_time = (String) whereJson.get("createTime"); + String end_time = (String) whereJson.get("end_time"); + if (!StrUtil.isEmpty(task_code)) { + map.put("task_code", task_code); + } + if (!StrUtil.isEmpty(vehicle_code)) { + map.put("vehicle_code", vehicle_code); + } + if (!StrUtil.isEmpty(task_type)) { + map.put("task_type", task_type); + } + if (!StrUtil.isEmpty(status)) { + map.put("status", status); + } + if (!StrUtil.isEmpty(point_code)) { + map.put("point_code", point_code); + } + if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) { + map.put("create_time", create_time); + map.put("end_time", end_time); + } + JSONObject jsonObject1 = + WQL.getWO("QTASK_QUERY") + .addParamMap(map) + .pageQuery(WqlUtil.getHttpContext(page), "create_time desc"); + JSONArray array = jsonObject1.getJSONArray("content"); + int totalElements = (Integer) jsonObject1.get("totalElements"); + JSONArray arr = new JSONArray(); + for (int i = 0; i < array.size(); i++) { + JSONObject jsonObject = (JSONObject) array.get(i); + jsonObject.put("hasChildren", true); + arr.add(jsonObject); + } + JSONObject jo = new JSONObject(); + jo.put("content", arr); + jo.put("totalElements", totalElements); + return jo; + } + + @Override + public List queryAll(Map whereJson) { + WQLObject wo = WQLObject.getWQLObject("acs_task"); + JSONArray arr = wo.query().getResultJSONArray(0); + List list = arr.toJavaList(TaskDto.class); + return list; + } + + @Override + public TaskDto findById(String task_id) { + WQLObject wo = WQLObject.getWQLObject("acs_task"); + JSONObject json = wo.query("task_id ='" + task_id + "'").uniqueResult(0); + final TaskDto obj = json.toJavaObject(TaskDto.class); + return obj; + } + + @Override + public TaskDto findByTaskCode(String task_code) { + + List list = new ArrayList<>(); + Iterator iterator = tasks.iterator(); + while (iterator.hasNext()) { + TaskDto task = iterator.next(); + if (StrUtil.equals(task.getTask_code(), task_code)) { + return task; + } + } + return null; + } + + + @Override + public List queryAllUnfinished(Map whereJson) { + WQLObject wo = WQLObject.getWQLObject("acs_task"); + JSONArray arr = wo.query("task_status < 2 ").getResultJSONArray(0); + List list = arr.toJavaList(TaskDto.class); + return list; + } + + @Override + public TaskDto findByCode(String code) { + WQLObject wo = WQLObject.getWQLObject("acs_task"); + JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0); + final TaskDto obj = json.toJavaObject(TaskDto.class); + return obj; + } + + @Override + public List queryTaskByDeviceCode(String device_code) { + List list = new ArrayList<>(); + Iterator iterator = tasks.iterator(); + while (iterator.hasNext()) { + TaskDto task = iterator.next(); + if (task.getStart_device_code().equals(device_code) + && StrUtil.equals(task.getTask_status(), "0")) { + list.add(task); + } + } + return list; + } + + @Override + public List queryTaskByStartDeviceCode(String start_device_code) { + List list = new ArrayList<>(); + Iterator iterator = tasks.iterator(); + while (iterator.hasNext()) { + TaskDto task = iterator.next(); + if (!StrUtil.equals(task.getTask_type(), "6")) { + continue; + } + if ((task.getStart_device_code().equals(start_device_code) + || task.getStart_device_code2().equals(start_device_code)) + && StrUtil.equals(task.getTask_status(), "0")) { + list.add(task); + } + } + return list; + } + + @Override + public List queryTaskByBackDeviceCode(String back_start_device_code) { + List list = new ArrayList<>(); + Iterator iterator = tasks.iterator(); + while (iterator.hasNext()) { + TaskDto task = iterator.next(); + if (!StrUtil.equals(task.getTask_type(), "6")) { + continue; + } + if (task.getStart_device_code().equals(back_start_device_code) + && StrUtil.equals(task.getTask_status(), "0")) { + list.add(task); + } + } + return list; + } + + @Override + public List queryTaskByDeviceCodeAndStatus(String device_code) { + List list = new ArrayList<>(); + Iterator iterator = tasks.iterator(); + while (iterator.hasNext()) { + TaskDto task = iterator.next(); + if (task.getStart_device_code().equals(device_code) + && StrUtil.equals(task.getTask_status(), "1")) { + Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code()); + if (ObjectUtil.isNotEmpty(instruction)) { + list.add(task); + } + } else { + if (StrUtil.equals(task.getTask_type(), "8") && StrUtil.isNotEmpty(task.getPut_device_code())) { // if(task.getNext_device_code().equals(device_code) // && StrUtil.equals(task.getTask_status(), "1")){ // Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code()); @@ -377,280 +386,282 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { // list.add(task); // } // } - Instruction instruction = instructionService.findByDeviceCodeFromCache(device_code); - if (ObjectUtil.isNotEmpty(instruction)) { - if(StrUtil.equals(instruction.getStart_device_code(),device_code)){ - list.add(task); - } + Instruction instruction = instructionService.findByDeviceCodeFromCache(device_code); + if (ObjectUtil.isNotEmpty(instruction)) { + if (StrUtil.equals(instruction.getStart_device_code(), device_code)) { + list.add(task); + } + } + } } - } } - } - return list; - } + return list; + } - public List queryTaskByStartAndIntStatus(String head_start_device_code) { - List list = new ArrayList<>(); - Iterator iterator = tasks.iterator(); - while (iterator.hasNext()) { - TaskDto task = iterator.next(); - if (!StrUtil.equals(task.getTask_type(), "6")) { - continue; + public List queryTaskByStartAndIntStatus(String head_start_device_code) { + List list = new ArrayList<>(); + Iterator iterator = tasks.iterator(); + while (iterator.hasNext()) { + TaskDto task = iterator.next(); + if (!StrUtil.equals(task.getTask_type(), "6")) { + continue; + } + if ((task.getStart_device_code().equals(head_start_device_code) + || task.getStart_device_code2().equals(head_start_device_code)) + && StrUtil.equals(task.getTask_status(), "1")) { + Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code()); + if (ObjectUtil.isNotEmpty(instruction)) { + list.add(task); + } + } } - if ((task.getStart_device_code().equals(head_start_device_code) - || task.getStart_device_code2().equals(head_start_device_code)) - && StrUtil.equals(task.getTask_status(), "1")) { - Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code()); - if (ObjectUtil.isNotEmpty(instruction)) { - list.add(task); - } + return list; + } + + public List queryTaskByNextAndIntStatus(String back_start_device_code) { + List list = new ArrayList<>(); + Iterator iterator = tasks.iterator(); + while (iterator.hasNext()) { + TaskDto task = iterator.next(); + if (!StrUtil.equals(task.getTask_type(), "6")) { + continue; + } + if ((task.getStart_device_code().equals(back_start_device_code)) + && StrUtil.equals(task.getTask_status(), "1")) { + Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code()); + if (ObjectUtil.isNotEmpty(instruction)) { + list.add(task); + } + } } - } - return list; - } + return list; + } - public List queryTaskByNextAndIntStatus(String back_start_device_code) { - List list = new ArrayList<>(); - Iterator iterator = tasks.iterator(); - while (iterator.hasNext()) { - TaskDto task = iterator.next(); - if (!StrUtil.equals(task.getTask_type(), "6")) { - continue; + @Override + public TaskDto queryTaskByLinkNum(String link_num) { + return null; + } + + @Override + public List queryByStauts(String status) { + WQLObject wo = WQLObject.getWQLObject("acs_task"); + JSONArray arr = wo.query("task_status = '" + status + "'").getResultJSONArray(0); + List list = arr.toJavaList(TaskDto.class); + return list; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(TaskDto dto) throws Exception { + dto = foramte(dto); + if (!StrUtil.isEmpty(dto.getVehicle_code())) { + TaskDto vehicle_dto = this.findByContainer(dto.getVehicle_code()); + if (vehicle_dto != null) { + throw new WDKException("已存在该载具号的任务!"); + } } - if ((task.getStart_device_code().equals(back_start_device_code)) - && StrUtil.equals(task.getTask_status(), "1")) { - Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code()); - if (ObjectUtil.isNotEmpty(instruction)) { - list.add(task); - } + String currentUsername = SecurityUtils.getCurrentUsername(); + String now = DateUtil.now(); + String task_uuid = dto.getTask_id(); + if (StrUtil.isEmpty(task_uuid)) { + dto.setTask_id(IdUtil.simpleUUID()); } - } - return list; - } + String task_code = dto.getTask_code(); + if (StrUtil.isEmpty(task_code)) { + task_code = CodeUtil.getNewCode("TASK_NO"); + task_code = "-" + task_code; + } + String start_point_code = dto.getStart_point_code(); + String next_point_code = dto.getNext_point_code(); + String start_device_code = dto.getStart_device_code(); + String next_device_code = dto.getNext_device_code(); + String route_plan_code = dto.getRoute_plan_code(); + dto.setCreate_by(currentUsername); + dto.setUpdate_by(currentUsername); + dto.setUpdate_time(now); + dto.setCreate_time(now); + dto.setTask_code(task_code); + dto.setRoute_plan_code(route_plan_code); + dto.setTask_status("0"); + dto.setStart_device_code2(dto.getStart_point_code2()); + dto.setNext_device_code2(dto.getNext_point_code2()); - @Override - public TaskDto queryTaskByLinkNum(String link_num) { - return null; - } + if (StrUtil.isEmpty(dto.getPriority())) { + dto.setPriority("1"); + } + String plan_code = dto.getRoute_plan_code(); + // 判断起点终点设备类型 + String startDeviceType = deviceAppService.findDeviceTypeByCode(dto.getStart_device_code()); + String nextDeviceType = deviceAppService.findDeviceTypeByCode(dto.getNext_device_code()); + if (routelineserver + .getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code) + .size() + == 0) { + throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!"); + } + String createTaskCheck = paramService.findByCode(AcsConfig.CREATETASKCHECK).getValue(); + DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); + DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + Device nextdevice = appService.findDeviceByCode(next_device_code); + Device startdevice = appService.findDeviceByCode(start_device_code); + dto.setMaterial(startdevice.getMaterial_type()); + if (StrUtil.equals(createTaskCheck, "1")) { + // 判断起点为输送设备 + if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) { + } - @Override - public List queryByStauts(String status) { - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONArray arr = wo.query("task_status = '" + status + "'").getResultJSONArray(0); - List list = arr.toJavaList(TaskDto.class); - return list; - } + if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) { + } + } else { + // 判断起点为输送设备 - @Override - @Transactional(rollbackFor = Exception.class) - public void create(TaskDto dto) throws Exception { - dto = foramte(dto); - if (!StrUtil.isEmpty(dto.getVehicle_code())) { - TaskDto vehicle_dto = this.findByContainer(dto.getVehicle_code()); - if (vehicle_dto != null) { - throw new WDKException("已存在该载具号的任务!"); - } - } - String currentUsername = SecurityUtils.getCurrentUsername(); - String now = DateUtil.now(); - String task_uuid = dto.getTask_id(); - if (StrUtil.isEmpty(task_uuid)) { - dto.setTask_id(IdUtil.simpleUUID()); - } - String task_code = dto.getTask_code(); - if (StrUtil.isEmpty(task_code)) { - task_code = CodeUtil.getNewCode("TASK_NO"); - task_code = "-" + task_code; - } - String start_point_code = dto.getStart_point_code(); - String next_point_code = dto.getNext_point_code(); - String start_device_code = dto.getStart_device_code(); - String next_device_code = dto.getNext_device_code(); - String route_plan_code = dto.getRoute_plan_code(); - dto.setCreate_by(currentUsername); - dto.setUpdate_by(currentUsername); - dto.setUpdate_time(now); - dto.setCreate_time(now); - dto.setTask_code(task_code); - dto.setRoute_plan_code(route_plan_code); - dto.setTask_status("0"); - dto.setStart_device_code2(dto.getStart_point_code2()); - dto.setNext_device_code2(dto.getNext_point_code2()); + } + WQLObject wo = WQLObject.getWQLObject("acs_task"); + JSONObject json = (JSONObject) JSONObject.toJSON(dto); - if (StrUtil.isEmpty(dto.getPriority())) { - dto.setPriority("1"); - } - String plan_code = dto.getRoute_plan_code(); - // 判断起点终点设备类型 - String startDeviceType = deviceAppService.findDeviceTypeByCode(dto.getStart_device_code()); - String nextDeviceType = deviceAppService.findDeviceTypeByCode(dto.getNext_device_code()); - if (routelineserver - .getShortPathLines(dto.getStart_device_code(), dto.getNext_device_code(), plan_code) - .size() - == 0) { - throw new Exception(dto.getStart_point_code() + "->" + dto.getNext_point_code() + "路由不通!"); - } - String createTaskCheck = paramService.findByCode(AcsConfig.CREATETASKCHECK).getValue(); - DeviceService deviceService = SpringContextHolder.getBean(DeviceServiceImpl.class); - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - Device nextdevice = appService.findDeviceByCode(next_device_code); - Device startdevice = appService.findDeviceByCode(start_device_code); - dto.setMaterial(startdevice.getMaterial_type()); - if (StrUtil.equals(createTaskCheck, "1")) { - // 判断起点为输送设备 - if (StrUtil.equals(DeviceType.conveyor.toString(), startDeviceType)) {} - - if (StrUtil.equals(DeviceType.conveyor.toString(), nextDeviceType)) {} - } else { - // 判断起点为输送设备 - - } - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = (JSONObject) JSONObject.toJSON(dto); - - wo.insert(json); - synchronized(TaskServiceImpl.class){ - tasks.add(dto); - } - } - - /** - * 常规任务保存 - * - * @param / - * @throws Exception - */ - @Override - public void ordinaryTaskCreate(JSONObject json) throws Exception { - JSONArray array = json.getJSONArray("data"); - - if (array.size() == 0) { - throw new RuntimeException("请选择起点"); - } - for (int i = 0; i < array.size(); i++) { - JSONObject arrjo = array.getJSONObject(i); - String material_type = arrjo.getString("material_type"); - String quantity = arrjo.getString("quantity"); - String remark = arrjo.getString("remark"); - TaskDto dto = new TaskDto(); - Map whereJson = (Map) array.get(i); - - // String device_code = (String) whereJson.get("device_code"); - String device_code = MapUtil.getStr(whereJson, "device_code"); - dto.setRoute_plan_code("one"); - String next_device_code = ""; - String plan_uuid = - WQLObject.getWQLObject("acs_route_plan") - .query("plan_code= '" + dto.getRoute_plan_code() + "'") - .uniqueResult(0) - .getString("plan_uuid"); - JSONArray ja = routelineserver.queryNextLine(device_code, plan_uuid); - for (int j = 0; j < ja.size(); j++) { - JSONObject jo = (JSONObject) ja.get(j); - next_device_code = jo.get("next_device_code").toString(); - } - if (ObjectUtil.isNotEmpty(this.findByStartCode(device_code))) { - throw new WDKException("已存在该起点的任务!"); - } - if (StrUtil.equals(material_type, "") || StrUtil.equals(quantity, "")) { - throw new RuntimeException("请填写物料信息!"); - } - dto.setStart_device_code(device_code); - dto.setStart_point_code(device_code); - dto.setNext_device_code(next_device_code); - dto.setNext_point_code(next_device_code); - dto.setRemark(remark); - dto.setMaterial(material_type); - create(dto); - } - } - - /** - * 特殊任务保存 - * - * @param / - * @throws Exception - */ - @Override - public void specialTaskCreate(JSONObject json) throws Exception { - - JSONArray array = json.getJSONArray("data1"); - JSONArray array2 = json.getJSONArray("data2"); - JSONArray array3 = json.getJSONArray("data3"); - if (array.size() != 0 && array3.size() != 0) { - throw new RuntimeException("只能选择一个终点"); + wo.insert(json); + synchronized (TaskServiceImpl.class) { + tasks.add(dto); + } } - for (int i = 0; i < array2.size(); i++) { - JSONObject arrjo = array2.getJSONObject(i); - String material_type = arrjo.getString("material_type"); - String quantity = arrjo.getString("quantity"); - String remark = arrjo.getString("remark"); - TaskDto dto = new TaskDto(); - Map whereJson; - Map whereJson2; - Map whereJson3; - if (array.size() != 0) { - whereJson = (Map) array.get(i); - } else { - whereJson = null; - } - if (array2.size() != 0) { - whereJson2 = (Map) array2.get(i); - } else { - whereJson2 = null; - } - if (array3.size() != 0) { - whereJson3 = (Map) array3.get(i); - } else { - whereJson3 = null; - } - String start_device_code = MapUtil.getStr(whereJson2, "device_code"); - String next_device_code = ""; - if (ObjectUtil.isEmpty(whereJson)) { - next_device_code = MapUtil.getStr(whereJson3, "device_code"); - } else { - next_device_code = MapUtil.getStr(whereJson, "device_code"); - } + /** + * 常规任务保存 + * + * @param / + * @throws Exception + */ + @Override + public void ordinaryTaskCreate(JSONObject json) throws Exception { + JSONArray array = json.getJSONArray("data"); - if (ObjectUtil.isNotEmpty(this.findByStartCode(start_device_code)) - || ObjectUtil.isNotEmpty(this.findByNextCode(next_device_code))) { - throw new WDKException("已存在该起点或终点的任务!"); - } - if (StrUtil.equals(material_type, "") || StrUtil.equals(quantity, "")) { - throw new RuntimeException("请填写物料信息!"); - } - dto.setRoute_plan_code("two"); - dto.setStart_device_code(start_device_code); - dto.setStart_point_code(start_device_code); - dto.setNext_device_code(next_device_code); - dto.setNext_point_code(next_device_code); - dto.setRemark(remark); - dto.setMaterial(material_type); - create(dto); + if (array.size() == 0) { + throw new RuntimeException("请选择起点"); + } + for (int i = 0; i < array.size(); i++) { + JSONObject arrjo = array.getJSONObject(i); + String material_type = arrjo.getString("material_type"); + String quantity = arrjo.getString("quantity"); + String remark = arrjo.getString("remark"); + TaskDto dto = new TaskDto(); + Map whereJson = (Map) array.get(i); + + // String device_code = (String) whereJson.get("device_code"); + String device_code = MapUtil.getStr(whereJson, "device_code"); + dto.setRoute_plan_code("one"); + String next_device_code = ""; + String plan_uuid = + WQLObject.getWQLObject("acs_route_plan") + .query("plan_code= '" + dto.getRoute_plan_code() + "'") + .uniqueResult(0) + .getString("plan_uuid"); + JSONArray ja = routelineserver.queryNextLine(device_code, plan_uuid); + for (int j = 0; j < ja.size(); j++) { + JSONObject jo = (JSONObject) ja.get(j); + next_device_code = jo.get("next_device_code").toString(); + } + if (ObjectUtil.isNotEmpty(this.findByStartCode(device_code))) { + throw new WDKException("已存在该起点的任务!"); + } + if (StrUtil.equals(material_type, "") || StrUtil.equals(quantity, "")) { + throw new RuntimeException("请填写物料信息!"); + } + dto.setStart_device_code(device_code); + dto.setStart_point_code(device_code); + dto.setNext_device_code(next_device_code); + dto.setNext_point_code(next_device_code); + dto.setRemark(remark); + dto.setMaterial(material_type); + create(dto); + } } - } - @Override - @Transactional(rollbackFor = Exception.class) - public void update(TaskDto dto) { + /** + * 特殊任务保存 + * + * @param / + * @throws Exception + */ + @Override + public void specialTaskCreate(JSONObject json) throws Exception { - TaskDto entity = this.findById(dto.getTask_id()); - if (entity == null) { - throw new BadRequestException("被删除或无权限,操作失败!"); - } + JSONArray array = json.getJSONArray("data1"); + JSONArray array2 = json.getJSONArray("data2"); + JSONArray array3 = json.getJSONArray("data3"); + if (array.size() != 0 && array3.size() != 0) { + throw new RuntimeException("只能选择一个终点"); + } - String currentUsername = SecurityUtils.getCurrentUsername(); - String now = DateUtil.now(); - dto.setUpdate_time(now); - dto.setUpdate_by(currentUsername); + for (int i = 0; i < array2.size(); i++) { + JSONObject arrjo = array2.getJSONObject(i); + String material_type = arrjo.getString("material_type"); + String quantity = arrjo.getString("quantity"); + String remark = arrjo.getString("remark"); + TaskDto dto = new TaskDto(); + Map whereJson; + Map whereJson2; + Map whereJson3; + if (array.size() != 0) { + whereJson = (Map) array.get(i); + } else { + whereJson = null; + } + if (array2.size() != 0) { + whereJson2 = (Map) array2.get(i); + } else { + whereJson2 = null; + } + if (array3.size() != 0) { + whereJson3 = (Map) array3.get(i); + } else { + whereJson3 = null; + } + String start_device_code = MapUtil.getStr(whereJson2, "device_code"); + String next_device_code = ""; + if (ObjectUtil.isEmpty(whereJson)) { + next_device_code = MapUtil.getStr(whereJson3, "device_code"); + } else { + next_device_code = MapUtil.getStr(whereJson, "device_code"); + } - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = (JSONObject) JSONObject.toJSON(dto); + if (ObjectUtil.isNotEmpty(this.findByStartCode(start_device_code)) + || ObjectUtil.isNotEmpty(this.findByNextCode(next_device_code))) { + throw new WDKException("已存在该起点或终点的任务!"); + } + if (StrUtil.equals(material_type, "") || StrUtil.equals(quantity, "")) { + throw new RuntimeException("请填写物料信息!"); + } + dto.setRoute_plan_code("two"); + dto.setStart_device_code(start_device_code); + dto.setStart_point_code(start_device_code); + dto.setNext_device_code(next_device_code); + dto.setNext_point_code(next_device_code); + dto.setRemark(remark); + dto.setMaterial(material_type); + create(dto); + } + } - wo.update(json); + @Override + @Transactional(rollbackFor = Exception.class) + public void update(TaskDto dto) { - Iterator iterator = tasks.iterator(); + TaskDto entity = this.findById(dto.getTask_id()); + if (entity == null) { + throw new BadRequestException("被删除或无权限,操作失败!"); + } + + String currentUsername = SecurityUtils.getCurrentUsername(); + String now = DateUtil.now(); + dto.setUpdate_time(now); + dto.setUpdate_by(currentUsername); + + WQLObject wo = WQLObject.getWQLObject("acs_task"); + JSONObject json = (JSONObject) JSONObject.toJSON(dto); + + wo.update(json); + + Iterator iterator = tasks.iterator(); // while (iterator.hasNext()) { // TaskDto task = iterator.next(); // if (task.getTask_code().equals(dto.getTask_code())) { @@ -659,254 +670,254 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { // } - removeByCodeFromCache(entity.getTask_code()); + removeByCodeFromCache(entity.getTask_code()); - if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) { - tasks.add(dto); - } - // 判断是否为WMS下发的任务,如果是反馈任务状态给WMS - String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); - if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { - TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code()); - JSONObject feed_jo = new JSONObject(); - feed_jo.put("task_id", entity.getExt_task_id()); - feed_jo.put("task_code", dto.getTask_code()); - feed_jo.put("task_status", dto.getTask_status()); - if(ObjectUtil.isNotEmpty(dto.getWeight())){ - feed_jo.put("weight",dto.getWeight()); + if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) { + tasks.add(dto); } - if(ObjectUtil.isNotEmpty(dto.getCarno())){ - feed_jo.put("car_no",dto.getCarno()); - } - JSONArray ja = new JSONArray(); - ja.add(feed_jo); - String message = null; - HttpResponse body = null; - boolean flag = false; - try { - body = acstowmsService.feedbackTaskStatusToWms(ja); - } catch (Exception e) { - flag = true; - message = e.getMessage(); - e.printStackTrace(); - } finally { - - } - if (flag) { - if (ObjectUtil.isEmpty(feefbackdto)) { - feefbackdto = new TaskFeedbackDto(); - feefbackdto.setTask_id(entity.getTask_id()); - feefbackdto.setTask_code(entity.getTask_code()); - feefbackdto.setTask_status(entity.getTask_status()); - feefbackdto.setVehicle_type(entity.getVehicle_type()); - feefbackdto.setVehicle_code(entity.getVehicle_code()); - feefbackdto.setStart_device_code(entity.getStart_device_code()); - feefbackdto.setStart_point_code(entity.getStart_point_code()); - feefbackdto.setNext_device_code(entity.getNext_device_code()); - feefbackdto.setNext_point_code(entity.getNext_point_code()); - feefbackdto.setError_code("400"); - feefbackdto.setIs_finished("0"); - feefbackdto.setRemark(message); - taskFeedbackService.create(feefbackdto); - } else { - feefbackdto.setTask_status(entity.getTask_status()); - feefbackdto.setStart_device_code(entity.getStart_device_code()); - feefbackdto.setStart_point_code(entity.getStart_point_code()); - feefbackdto.setNext_device_code(entity.getNext_device_code()); - feefbackdto.setNext_point_code(entity.getNext_point_code()); - feefbackdto.setError_code("400"); - feefbackdto.setRemark(message); - taskFeedbackService.update(feefbackdto); - } - } else { - int status = body.getStatus(); - JSONObject jo = JSONObject.parseObject(body.body()); - if (ObjectUtil.isEmpty(feefbackdto)) { - feefbackdto = new TaskFeedbackDto(); - feefbackdto.setTask_id(entity.getTask_id()); - feefbackdto.setTask_code(entity.getTask_code()); - 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.setStart_device_code(entity.getStart_device_code()); - feefbackdto.setStart_point_code(entity.getNext_point_code()); - feefbackdto.setNext_device_code(entity.getNext_device_code()); - feefbackdto.setNext_point_code(entity.getNext_point_code()); - if (status == 200) { - if (StrUtil.equals(entity.getTask_status(), "2")) { - feefbackdto.setIs_finished("1"); - } else { - feefbackdto.setIs_finished("0"); - } - } else { - feefbackdto.setIs_finished("0"); - feefbackdto.setRemark(jo.getString("message")); + // 判断是否为WMS下发的任务,如果是反馈任务状态给WMS + String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); + if (!StrUtil.startWith(dto.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { + TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code()); + JSONObject feed_jo = new JSONObject(); + feed_jo.put("task_id", entity.getExt_task_id()); + feed_jo.put("task_code", dto.getTask_code()); + feed_jo.put("task_status", dto.getTask_status()); + if (ObjectUtil.isNotEmpty(dto.getWeight())) { + feed_jo.put("weight", dto.getWeight()); } - taskFeedbackService.create(feefbackdto); - } else { - feefbackdto.setTask_status(entity.getTask_status()); - if (status == 200) { - } else { - if (StrUtil.equals(entity.getTask_status(), "2")) { - feefbackdto.setIs_finished("1"); - } else { - feefbackdto.setIs_finished("0"); - } + if (ObjectUtil.isNotEmpty(dto.getCarno())) { + feed_jo.put("car_no", dto.getCarno()); } - taskFeedbackService.update(feefbackdto); - } - } - } + JSONArray ja = new JSONArray(); + ja.add(feed_jo); + String message = null; + HttpResponse body = null; + boolean flag = false; + try { + body = acstowmsService.feedbackTaskStatusToWms(ja); + } catch (Exception e) { + flag = true; + message = e.getMessage(); + e.printStackTrace(); + } finally { - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteAll(String[] ids) throws Exception { - for (String task_id : ids) { - this.cancel(task_id); - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void finish(String id) { - TaskDto entity = this.findById(id); - if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); - InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); - InstructionDto instdto = instructionservice.findByTaskid(id, "instruction_status <2 "); - if (instdto != null) throw new BadRequestException("有指令未完成!"); - String currentUsername = SecurityUtils.getCurrentUsername(); - String now = DateUtil.now(); - entity.setUpdate_time(now); - entity.setUpdate_by(currentUsername); - entity.setTask_status("2"); - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = (JSONObject) JSONObject.toJSON(entity); - wo.update(json); - removeByCodeFromCache(entity.getTask_code()); - // 判断是否为WMS下发的任务,如果是反馈任务状态给WMS - String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); - if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { - TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code()); - System.out.println(feefbackdto == null); - JSONObject feed_jo = new JSONObject(); - feed_jo.put("task_id", entity.getExt_task_id()); - feed_jo.put("task_code", entity.getTask_code()); - feed_jo.put("task_status", entity.getTask_status()); - JSONArray ja = new JSONArray(); - ja.add(feed_jo); - String message = null; - HttpResponse body = null; - boolean flag = false; - try { - body = acstowmsService.feedbackTaskStatusToWms(ja); - } catch (Exception e) { - flag = true; - message = e.getMessage(); - e.printStackTrace(); - } finally { - - } - if (flag) { - if (ObjectUtil.isEmpty(feefbackdto)) { - feefbackdto = new TaskFeedbackDto(); - feefbackdto.setTask_id(entity.getTask_id()); - feefbackdto.setTask_code(entity.getTask_code()); - feefbackdto.setTask_status(entity.getTask_status()); - feefbackdto.setVehicle_type(entity.getVehicle_type()); - feefbackdto.setVehicle_code(entity.getVehicle_code()); - feefbackdto.setStart_device_code(entity.getStart_device_code()); - feefbackdto.setStart_point_code(entity.getStart_point_code()); - feefbackdto.setNext_device_code(entity.getNext_device_code()); - feefbackdto.setNext_point_code(entity.getNext_point_code()); - feefbackdto.setError_code("400"); - feefbackdto.setIs_finished("0"); - feefbackdto.setRemark(message); - taskFeedbackService.create(feefbackdto); - } else { - feefbackdto.setTask_status(entity.getTask_status()); - feefbackdto.setStart_device_code(entity.getStart_device_code()); - feefbackdto.setStart_point_code(entity.getStart_point_code()); - feefbackdto.setNext_device_code(entity.getNext_device_code()); - feefbackdto.setNext_point_code(entity.getNext_point_code()); - feefbackdto.setError_code("400"); - feefbackdto.setRemark(message); - taskFeedbackService.update(feefbackdto); - } - } else { - int status = body.getStatus(); - JSONObject jo = JSONObject.parseObject(body.body()); - if (ObjectUtil.isEmpty(feefbackdto)) { - feefbackdto = new TaskFeedbackDto(); - feefbackdto.setTask_id(entity.getTask_id()); - feefbackdto.setTask_code(entity.getTask_code()); - 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.setStart_device_code(entity.getStart_device_code()); - feefbackdto.setStart_point_code(entity.getStart_point_code()); - feefbackdto.setNext_device_code(entity.getNext_device_code()); - feefbackdto.setNext_point_code(entity.getNext_point_code()); - if (status == 200) { - if (StrUtil.equals(entity.getTask_status(), "2")) { - feefbackdto.setIs_finished("1"); - } else { - feefbackdto.setIs_finished("0"); } - } else { - feefbackdto.setIs_finished("0"); - feefbackdto.setRemark(jo.getString("message")); - } - taskFeedbackService.create(feefbackdto); - } else { - feefbackdto.setTask_status(entity.getTask_status()); - if (status == 200) { - if (StrUtil.equals(entity.getTask_status(), "2")) { - feefbackdto.setIs_finished("1"); + if (flag) { + if (ObjectUtil.isEmpty(feefbackdto)) { + feefbackdto = new TaskFeedbackDto(); + feefbackdto.setTask_id(entity.getTask_id()); + feefbackdto.setTask_code(entity.getTask_code()); + feefbackdto.setTask_status(entity.getTask_status()); + feefbackdto.setVehicle_type(entity.getVehicle_type()); + feefbackdto.setVehicle_code(entity.getVehicle_code()); + feefbackdto.setStart_device_code(entity.getStart_device_code()); + feefbackdto.setStart_point_code(entity.getStart_point_code()); + feefbackdto.setNext_device_code(entity.getNext_device_code()); + feefbackdto.setNext_point_code(entity.getNext_point_code()); + feefbackdto.setError_code("400"); + feefbackdto.setIs_finished("0"); + feefbackdto.setRemark(message); + taskFeedbackService.create(feefbackdto); + } else { + feefbackdto.setTask_status(entity.getTask_status()); + feefbackdto.setStart_device_code(entity.getStart_device_code()); + feefbackdto.setStart_point_code(entity.getStart_point_code()); + feefbackdto.setNext_device_code(entity.getNext_device_code()); + feefbackdto.setNext_point_code(entity.getNext_point_code()); + feefbackdto.setError_code("400"); + feefbackdto.setRemark(message); + taskFeedbackService.update(feefbackdto); + } } else { - feefbackdto.setIs_finished("0"); + int status = body.getStatus(); + JSONObject jo = JSONObject.parseObject(body.body()); + if (ObjectUtil.isEmpty(feefbackdto)) { + feefbackdto = new TaskFeedbackDto(); + feefbackdto.setTask_id(entity.getTask_id()); + feefbackdto.setTask_code(entity.getTask_code()); + 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.setStart_device_code(entity.getStart_device_code()); + feefbackdto.setStart_point_code(entity.getNext_point_code()); + feefbackdto.setNext_device_code(entity.getNext_device_code()); + feefbackdto.setNext_point_code(entity.getNext_point_code()); + if (status == 200) { + if (StrUtil.equals(entity.getTask_status(), "2")) { + feefbackdto.setIs_finished("1"); + } else { + feefbackdto.setIs_finished("0"); + } + } else { + feefbackdto.setIs_finished("0"); + feefbackdto.setRemark(jo.getString("message")); + } + taskFeedbackService.create(feefbackdto); + } else { + feefbackdto.setTask_status(entity.getTask_status()); + if (status == 200) { + } else { + if (StrUtil.equals(entity.getTask_status(), "2")) { + feefbackdto.setIs_finished("1"); + } else { + feefbackdto.setIs_finished("0"); + } + } + taskFeedbackService.update(feefbackdto); + } } - } else { - feefbackdto.setIs_finished("0"); - feefbackdto.setRemark(jo.getString("message")); - } - taskFeedbackService.update(feefbackdto); } - } - } - // 如果属于先知AGV,关闭运单序列 - if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) { - try { - agvService.markComplete(entity.getTask_code()); - } catch (Exception e) { - e.printStackTrace(); - } - } - } - @Override - @Transactional(rollbackFor = Exception.class) - public void cancel(String id) throws Exception { - TaskDto entity = this.findById(id); - if (entity == null) { - throw new BadRequestException("被删除或无权限,操作失败!"); } - InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); - InstructionDto instdto = instructionservice.findByTaskid(id, "instruction_status <2 "); - if (instdto != null) { - throw new BadRequestException("有指令未完成!"); + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(String[] ids) throws Exception { + for (String task_id : ids) { + this.cancel(task_id); + } } - String currentUsername = SecurityUtils.getCurrentUsername(); - String now = DateUtil.now(); - entity.setUpdate_time(now); - entity.setUpdate_by(currentUsername); - entity.setTask_status("3"); - WQLObject wo = WQLObject.getWQLObject("acs_task"); - JSONObject json = (JSONObject) JSONObject.toJSON(entity); - wo.update(json); + + @Override + @Transactional(rollbackFor = Exception.class) + public void finish(String id) { + TaskDto entity = this.findById(id); + if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!"); + InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); + InstructionDto instdto = instructionservice.findByTaskid(id, "instruction_status <2 "); + if (instdto != null) throw new BadRequestException("有指令未完成!"); + String currentUsername = SecurityUtils.getCurrentUsername(); + String now = DateUtil.now(); + entity.setUpdate_time(now); + entity.setUpdate_by(currentUsername); + entity.setTask_status("2"); + WQLObject wo = WQLObject.getWQLObject("acs_task"); + JSONObject json = (JSONObject) JSONObject.toJSON(entity); + wo.update(json); + removeByCodeFromCache(entity.getTask_code()); + // 判断是否为WMS下发的任务,如果是反馈任务状态给WMS + String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); + if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { + TaskFeedbackDto feefbackdto = taskFeedbackService.findByCode(entity.getTask_code()); + System.out.println(feefbackdto == null); + JSONObject feed_jo = new JSONObject(); + feed_jo.put("task_id", entity.getExt_task_id()); + feed_jo.put("task_code", entity.getTask_code()); + feed_jo.put("task_status", entity.getTask_status()); + JSONArray ja = new JSONArray(); + ja.add(feed_jo); + String message = null; + HttpResponse body = null; + boolean flag = false; + try { + body = acstowmsService.feedbackTaskStatusToWms(ja); + } catch (Exception e) { + flag = true; + message = e.getMessage(); + e.printStackTrace(); + } finally { + + } + if (flag) { + if (ObjectUtil.isEmpty(feefbackdto)) { + feefbackdto = new TaskFeedbackDto(); + feefbackdto.setTask_id(entity.getTask_id()); + feefbackdto.setTask_code(entity.getTask_code()); + feefbackdto.setTask_status(entity.getTask_status()); + feefbackdto.setVehicle_type(entity.getVehicle_type()); + feefbackdto.setVehicle_code(entity.getVehicle_code()); + feefbackdto.setStart_device_code(entity.getStart_device_code()); + feefbackdto.setStart_point_code(entity.getStart_point_code()); + feefbackdto.setNext_device_code(entity.getNext_device_code()); + feefbackdto.setNext_point_code(entity.getNext_point_code()); + feefbackdto.setError_code("400"); + feefbackdto.setIs_finished("0"); + feefbackdto.setRemark(message); + taskFeedbackService.create(feefbackdto); + } else { + feefbackdto.setTask_status(entity.getTask_status()); + feefbackdto.setStart_device_code(entity.getStart_device_code()); + feefbackdto.setStart_point_code(entity.getStart_point_code()); + feefbackdto.setNext_device_code(entity.getNext_device_code()); + feefbackdto.setNext_point_code(entity.getNext_point_code()); + feefbackdto.setError_code("400"); + feefbackdto.setRemark(message); + taskFeedbackService.update(feefbackdto); + } + } else { + int status = body.getStatus(); + JSONObject jo = JSONObject.parseObject(body.body()); + if (ObjectUtil.isEmpty(feefbackdto)) { + feefbackdto = new TaskFeedbackDto(); + feefbackdto.setTask_id(entity.getTask_id()); + feefbackdto.setTask_code(entity.getTask_code()); + 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.setStart_device_code(entity.getStart_device_code()); + feefbackdto.setStart_point_code(entity.getStart_point_code()); + feefbackdto.setNext_device_code(entity.getNext_device_code()); + feefbackdto.setNext_point_code(entity.getNext_point_code()); + if (status == 200) { + if (StrUtil.equals(entity.getTask_status(), "2")) { + feefbackdto.setIs_finished("1"); + } else { + feefbackdto.setIs_finished("0"); + } + } else { + feefbackdto.setIs_finished("0"); + feefbackdto.setRemark(jo.getString("message")); + } + taskFeedbackService.create(feefbackdto); + } else { + feefbackdto.setTask_status(entity.getTask_status()); + if (status == 200) { + if (StrUtil.equals(entity.getTask_status(), "2")) { + feefbackdto.setIs_finished("1"); + } else { + feefbackdto.setIs_finished("0"); + } + } else { + feefbackdto.setIs_finished("0"); + feefbackdto.setRemark(jo.getString("message")); + } + taskFeedbackService.update(feefbackdto); + } + } + } + // 如果属于先知AGV,关闭运单序列 + if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) { + try { + agvService.markComplete(entity.getTask_code()); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void cancel(String id) throws Exception { + TaskDto entity = this.findById(id); + if (entity == null) { + throw new BadRequestException("被删除或无权限,操作失败!"); + } + InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); + InstructionDto instdto = instructionservice.findByTaskid(id, "instruction_status <2 "); + if (instdto != null) { + throw new BadRequestException("有指令未完成!"); + } + String currentUsername = SecurityUtils.getCurrentUsername(); + String now = DateUtil.now(); + entity.setUpdate_time(now); + entity.setUpdate_by(currentUsername); + entity.setTask_status("3"); + WQLObject wo = WQLObject.getWQLObject("acs_task"); + JSONObject json = (JSONObject) JSONObject.toJSON(entity); + wo.update(json); // synchronized (TaskServiceImpl.class){ // Iterator it = tasks.iterator(); @@ -918,697 +929,702 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { // } // }} - removeByCodeFromCache(entity.getTask_code()); + removeByCodeFromCache(entity.getTask_code()); - // 判断是否为WMS下发的任务,如果是反馈任务状态给WMS - String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); - if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { - JSONObject feed_jo = new JSONObject(); - feed_jo.put("task_id", entity.getExt_task_id()); - feed_jo.put("task_code", entity.getTask_code()); - feed_jo.put("task_status", entity.getTask_status()); - JSONArray ja = new JSONArray(); - ja.add(feed_jo); - acstowmsService.feedbackTaskStatusToWms(ja); - } - List shortPathsList = - routeLineService.getShortPathLines( - entity.getStart_device_code(), - entity.getNext_device_code(), - entity.getRoute_plan_code()); - String type = shortPathsList.get(0).getType(); - // != 0 为agv任务 - if (!StrUtil.equals(type, "0")) { - if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) { - agvService.markComplete(entity.getTask_code()); - } - } - } - - @Override - public Instruction createTemporaryInst(TaskDto acsTask) { - if (acsTask == null) { - throw new BadRequestException("被删除或无权限,操作失败!"); - } - acsTask = foramte(acsTask); - ParamService paramService = SpringContextHolder.getBean(ParamService.class); - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); - - String taskid = acsTask.getTask_id(); - String taskcode = acsTask.getTask_code(); - String vehiclecode = acsTask.getVehicle_code(); - String priority = acsTask.getPriority(); - String start_point_code = acsTask.getStart_point_code(); - String start_device_code = acsTask.getStart_device_code(); - String route_plan_code = acsTask.getRoute_plan_code(); - String vehicleType = acsTask.getVehicle_type(); - // 是否复合任务 =0非复合任务 - String compound_task = acsTask.getCompound_task(); - String next_point_code = acsTask.getNext_point_code(); - String next_device_code = acsTask.getNext_device_code(); - String start_point_code2 = acsTask.getStart_point_code2(); - String next_point_code2 = acsTask.getNext_point_code2(); - String agv_system_type = acsTask.getAgv_system_type(); - String task_type = acsTask.getTask_type(); - String from_x = acsTask.getFrom_x(); - String from_y = acsTask.getFrom_y(); - String from_z = acsTask.getFrom_z(); - String to_x = acsTask.getTo_x(); - String to_y = acsTask.getTo_y(); - String to_z = acsTask.getTo_z(); - - /** 开始平均分解校验 */ - String this_device_code = - this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code()); - if (StrUtil.isEmpty(this_device_code)) { - List shortPathsList = - routeLineService.getShortPathLines( - start_device_code, acsTask.getNext_device_code(), route_plan_code); - if(ObjectUtil.isEmpty(shortPathsList)){ - throw new BadRequestException(start_device_code + "->" + acsTask.getNext_device_code() + "路由不通!"); - } - RouteLineDto routeLineDto = shortPathsList.get(0); - String path = routeLineDto.getPath(); - String type = routeLineDto.getType(); - String[] str = path.split("->"); - 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; + // 判断是否为WMS下发的任务,如果是反馈任务状态给WMS + String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); + if (!StrUtil.startWith(entity.getTask_code(), "-") && StrUtil.equals(hasWms, "1")) { + JSONObject feed_jo = new JSONObject(); + feed_jo.put("task_id", entity.getExt_task_id()); + feed_jo.put("task_code", entity.getTask_code()); + feed_jo.put("task_status", entity.getTask_status()); + JSONArray ja = new JSONArray(); + ja.add(feed_jo); + acstowmsService.feedbackTaskStatusToWms(ja); } - } - next_device_code = pathlist.get(index); - } else { - next_device_code = this_device_code; - } - - if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) { - next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z(); - } else { - next_point_code = next_device_code; - } - - Instruction instdto = new Instruction(); - if (StrUtil.isEmpty(instdto.getInstruction_code())) { - instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO")); - } - instdto.setInstruction_type(task_type); - instdto.setInstruction_id(IdUtil.simpleUUID()); - instdto.setRoute_plan_code(route_plan_code); - instdto.setRemark(acsTask.getRemark()); - instdto.setMaterial(acsTask.getMaterial()); - instdto.setQuantity(acsTask.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); - instdto.setVehicle_type(vehicleType); - instdto.setStart_point_code2(start_point_code2); - instdto.setStart_device_code2(start_point_code2); - instdto.setNext_device_code2(next_point_code2); - instdto.setNext_point_code2(next_point_code2); - instdto.setAgv_system_type(agv_system_type); - instdto.setFrom_x(from_x); - instdto.setFrom_y(from_y); - instdto.setFrom_z(from_z); - instdto.setTo_x(to_x); - instdto.setTo_y(to_y); - instdto.setTo_z(to_z); - - // 判断agv系统 - // 1、1楼叉车系统 - // 2、2楼1区域AGV系统 - // 3、2楼2区域AGV系统 - if (!StrUtil.equals(agv_system_type, "1")) { - // task_type - // 1、生箔; Itype=1:取空,取满,放空,放满; - // 2、分切 Itype=3取满、取空、放满、放空; - // 3、普通任务 Itype=2:取货、放货; - // 4、叉车任务 - // 5、输送任务 - // 6、行架 - // 7、立库 - if (StrUtil.equals(task_type, "1")) { - instdto.setAgv_inst_type("1"); - } else if (StrUtil.equals(task_type, "3")) { - instdto.setAgv_inst_type("2"); - } else if (StrUtil.equals(task_type, "2")) { - instdto.setAgv_inst_type("3"); - } - } else { - instdto.setAgv_inst_type("4"); - } - return instdto; - } - - @Override - public Instruction createInst(String ids) throws Exception { - TaskDto acsTask = this.findById(ids); - if (acsTask == null) { - throw new BadRequestException("被删除或无权限,操作失败!"); - } - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); - InstructionDto inst = instructionservice.findByTaskid(ids, "instruction_status < 2 "); - if (inst != null) { - throw new BadRequestException("有指令未完成!"); - } - - String taskid = acsTask.getTask_id(); - String taskcode = acsTask.getTask_code(); - String vehiclecode = acsTask.getVehicle_code(); - String priority = acsTask.getPriority(); - String start_point_code = acsTask.getStart_point_code(); - String start_device_code = acsTask.getStart_device_code(); - String route_plan_code = acsTask.getRoute_plan_code(); - String vehicleType = acsTask.getVehicle_type(); - // 是否复合任务 =0非复合任务 - String compound_task = acsTask.getCompound_task(); - String next_point_code = acsTask.getNext_point_code(); - String next_device_code = acsTask.getNext_device_code(); - String start_point_code2 = acsTask.getStart_point_code2(); - String next_point_code2 = acsTask.getNext_point_code2(); - String agv_system_type = acsTask.getAgv_system_type(); - String task_type = acsTask.getTask_type(); - /** 开始平均分解校验 */ - String this_device_code = - this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code()); - if (StrUtil.isEmpty(this_device_code)) { - List shortPathsList = - routeLineService.getShortPathLines( - start_device_code, acsTask.getNext_device_code(), route_plan_code); - RouteLineDto routeLineDto = shortPathsList.get(0); - String path = routeLineDto.getPath(); - String type = routeLineDto.getType(); - String[] str = path.split("->"); - 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; + List shortPathsList = + routeLineService.getShortPathLines( + entity.getStart_device_code(), + entity.getNext_device_code(), + entity.getRoute_plan_code()); + String type = shortPathsList.get(0).getType(); + // != 0 为agv任务 + if (!StrUtil.equals(type, "0")) { + if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) { + agvService.markComplete(entity.getTask_code()); + } } - } - next_device_code = pathlist.get(index); - } else { - next_device_code = this_device_code; } - if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) { - next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z(); - } else { - next_point_code = next_device_code; - } - - Instruction instdto = new Instruction(); - instdto.setInstruction_type(task_type); - instdto.setInstruction_id(IdUtil.simpleUUID()); - instdto.setRoute_plan_code(route_plan_code); - instdto.setRemark(acsTask.getRemark()); - instdto.setMaterial(acsTask.getMaterial()); - instdto.setQuantity(acsTask.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); - instdto.setVehicle_type(vehicleType); - instdto.setStart_point_code2(start_point_code2); - instdto.setStart_device_code2(start_point_code2); - instdto.setNext_device_code2(next_point_code2); - instdto.setNext_point_code2(next_point_code2); - instdto.setAgv_system_type(agv_system_type); - // 判断agv系统 - // 1、1楼叉车系统 - // 2、2楼1区域AGV系统 - // 3、2楼2区域AGV系统 - if (!StrUtil.equals(agv_system_type, "1")) { - // task_type - // 1、生箔; Itype=1:取空,取满,放空,放满; - // 2、分切 Itype=3取满、取空、放满、放空; - // 3、普通任务 Itype=2:取货、放货; - // 4、叉车任务 - // 5、输送任务 - // 6、行架 - // 7、立库 - if (StrUtil.equals(task_type, "1")) { - instdto.setAgv_inst_type("1"); - } else if (StrUtil.equals(task_type, "3")) { - instdto.setAgv_inst_type("2"); - } else if (StrUtil.equals(task_type, "2")) { - instdto.setAgv_inst_type("3"); - } else if (StrUtil.equals(task_type, "8")) { - instdto.setAgv_inst_type("2"); - } - } else { - instdto.setAgv_inst_type("4"); - } - instructionservice.create2(instdto); - - // acsTask.setTask_status("1"); - // this.update(acsTask); - return instdto; - } - - @Override - public Instruction extCreateInst(Instruction inst) throws Exception { - - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); - - instructionservice.create3(inst); - return inst; - } - - - @Override - public Instruction createInst(Instruction inst) throws Exception { - - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); - - instructionservice.create2(inst); - return inst; - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (TaskDto acsTask : all) { - Map map = new LinkedHashMap<>(); - map.put("任务号", acsTask.getTask_code()); - map.put("载具号", acsTask.getVehicle_code()); - map.put("载具类型", acsTask.getVehicle_type()); - map.put("任务类型", acsTask.getTask_type()); - map.put("任务状态", acsTask.getTask_status()); - map.put("任务优先级", acsTask.getPriority()); - map.put("创建类型", acsTask.getCreate_type()); - map.put("完成类型", acsTask.getFinish_type()); - map.put("执行描述编码", acsTask.getExecute_code()); - map.put("执行描述信息", acsTask.getExecute_message()); - map.put("起始点位编码", acsTask.getStart_point_code()); - map.put("起始设备编码", acsTask.getStart_device_code()); - map.put("目标点位编码", acsTask.getNext_point_code()); - map.put("目标设备编码", acsTask.getNext_device_code()); - map.put("起始点位编码2", acsTask.getStart_point_code2()); - map.put("起始设备编码2", acsTask.getStart_device_code2()); - map.put("目标点位编码2", acsTask.getNext_point_code2()); - map.put("目标设备编码2", acsTask.getNext_device_code2()); - map.put("放货点位编码", acsTask.getPut_point_code()); - map.put("放货设备编码", acsTask.getPut_device_code()); - map.put("列", acsTask.getTo_y()); - map.put("层", acsTask.getTo_z()); - map.put("重量", acsTask.getWeight()); - map.put("agv系统类型", acsTask.getAgv_system_type()); - map.put("立库任务类型", acsTask.getStorage_task_type()); - map.put("烘箱温度", acsTask.getTemperature()); - map.put("烘箱时间", acsTask.getOven_time()); - map.put("agv车号", acsTask.getCarno()); - map.put("路由方案名称", acsTask.getRoute_plan_name()); - map.put("路由方案编码", acsTask.getRoute_plan_code()); - map.put("是否需要反馈上位系统", acsTask.getIs_needfeedback()); - map.put("备注", acsTask.getRemark()); - map.put("是否启用", acsTask.getIs_active()); - map.put("是否删除", acsTask.getIs_delete()); - map.put("创建者", acsTask.getCreate_by()); - map.put("创建时间", acsTask.getCreate_time()); - map.put("修改者", acsTask.getUpdate_by()); - map.put("修改时间", acsTask.getUpdate_time()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } - - @Override - public void createTaskByClick(JSONObject json) {} - - @Override - public int checkAllowCreate(String devicecode) { - Map map = new HashMap(); - List taskList = this.queryAllUnfinished(map); - int num = 0; - for (int i = 0; i < taskList.size(); i++) { - TaskDto onetask = taskList.get(i); - String next_code = onetask.getNext_point_code(); - if (StrUtil.equals(devicecode, next_code)) { - num = num + 1; - } - } - return num; - } - - @Override - public boolean removeByCodeFromCache(String code) { - CopyOnWriteArrayList taskDtos = (CopyOnWriteArrayList) this.tasks; - taskDtos.removeIf((task) -> { - return task.getTask_code().equals(code); - }); - return true; - } - - @Override - public List findAllTaskFromCache() { - return tasks; - } - - public TaskDto findByContainer(String container_code) { - Iterator var3 = tasks.iterator(); - - while (var3.hasNext()) { - TaskDto task = (TaskDto) var3.next(); - if (StrUtil.equals(task.getVehicle_code(), container_code)) { - return task; + @Override + public Instruction createTemporaryInst(TaskDto acsTask) { + if (acsTask == null) { + throw new BadRequestException("被删除或无权限,操作失败!"); } - } + acsTask = foramte(acsTask); + ParamService paramService = SpringContextHolder.getBean(ParamService.class); + DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); - return null; - } + String taskid = acsTask.getTask_id(); + String taskcode = acsTask.getTask_code(); + String vehiclecode = acsTask.getVehicle_code(); + String priority = acsTask.getPriority(); + String start_point_code = acsTask.getStart_point_code(); + String start_device_code = acsTask.getStart_device_code(); + String route_plan_code = acsTask.getRoute_plan_code(); + String vehicleType = acsTask.getVehicle_type(); + // 是否复合任务 =0非复合任务 + String compound_task = acsTask.getCompound_task(); + String next_point_code = acsTask.getNext_point_code(); + String next_device_code = acsTask.getNext_device_code(); + String start_point_code2 = acsTask.getStart_point_code2(); + String next_point_code2 = acsTask.getNext_point_code2(); + String agv_system_type = acsTask.getAgv_system_type(); + String task_type = acsTask.getTask_type(); + String from_x = acsTask.getFrom_x(); + String from_y = acsTask.getFrom_y(); + String from_z = acsTask.getFrom_z(); + String to_x = acsTask.getTo_x(); + String to_y = acsTask.getTo_y(); + String to_z = acsTask.getTo_z(); - public TaskDto findByCodeFromCache(String task_code) { - Iterator var3 = tasks.iterator(); - - while (var3.hasNext()) { - TaskDto task = (TaskDto) var3.next(); - if (StrUtil.equals(task.getTask_code(), task_code)) { - return task; - } - } - return null; - } - - @Override - public TaskDto findByNextCode(String device_code) { - Iterator var3 = tasks.iterator(); - - while (var3.hasNext()) { - TaskDto task = (TaskDto) var3.next(); - if (StrUtil.equals(task.getNext_device_code(), device_code)) { - return task; - } - } - return null; - } - - @Override - public List findAllByNextCode(String device_code) { - return null; - } - - @Override - public Integer queryAllTaskMaterialQty(String device_code) { - return null; - } - - @Override - public TaskDto findByStartCodeAndReady(String device_code) { - Iterator var3 = tasks.iterator(); - - while (var3.hasNext()) { - TaskDto task = (TaskDto) var3.next(); - // if (!StrUtil.equals(task.getTask_type(), "5")) { - // continue; - // } - if (StrUtil.equals(task.getStart_device_code(), device_code) - && StrUtil.equals(task.getTask_status(), "0")) { - return task; - } - } - return null; - } - - @Override - public TaskDto findByStartCode(String device_code) { - Iterator var3 = tasks.iterator(); - - while (var3.hasNext()) { - TaskDto task = (TaskDto) var3.next(); - if (StrUtil.equals(task.getStart_device_code(), device_code)) { - return task; - } - } - return null; - } - - @Override - public TaskDto foramte(TaskDto task) { - String start_point_code = task.getStart_point_code(); - String next_point_code = task.getNext_point_code(); - String from_y = null; - String from_z = null; - String to_y = null; - String to_z = null; - if (StrUtil.contains(start_point_code, "-") && StrUtil.count(start_point_code, "-") == 2) { - String[] start_point = start_point_code.split("-"); - task.setFrom_x(start_point[0]); - task.setStart_device_code(start_point[0]); - if (Integer.parseInt(start_point[1]) < 10 && start_point[1].length() == 1) { - from_y = "0" + start_point[1]; - task.setFrom_y(from_y); - } else { - from_y = start_point[1]; - task.setFrom_y(from_y); - } - if (Integer.parseInt(start_point[2]) < 10 && start_point[2].length() == 1) { - from_z = "0" + start_point[2]; - task.setFrom_z(from_z); - } else if (start_point[2].length() == 2) { - from_z = start_point[2]; - task.setFrom_z(start_point[2]); - } else { - from_z = start_point[2]; - } - task.setStart_point_code(task.getStart_device_code() + "-" + from_y + "-" + from_z); - task.setStart_device_code(task.getStart_device_code()); - - } else { - String start_device = - deviceAppService - .findDeviceByCode(start_point_code) - .getDeviceDriverDefination() - .getFitDeviceTypes() - .get(0) - .name(); - // 如果point_device为货架,则不包含列层信息,需要重新拼接 - if (StrUtil.equals("storage", start_device)) { - if (StrUtil.isEmpty(task.getFrom_x())) { - throw new BadRequestException("货位信息起点需要包含列信息"); - } - if (StrUtil.isEmpty(task.getFrom_y())) { - throw new BadRequestException("货位信息起点需要包含层信息"); - } - if (Integer.parseInt(task.getFrom_y()) < 10 && task.getFrom_y().length() == 1) { - from_y = "0" + task.getFrom_y(); - task.setFrom_y(from_y); + /** 开始平均分解校验 */ + String this_device_code = + this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code()); + if (StrUtil.isEmpty(this_device_code)) { + List shortPathsList = + routeLineService.getShortPathLines( + start_device_code, acsTask.getNext_device_code(), route_plan_code); + if (ObjectUtil.isEmpty(shortPathsList)) { + throw new BadRequestException(start_device_code + "->" + acsTask.getNext_device_code() + "路由不通!"); + } + RouteLineDto routeLineDto = shortPathsList.get(0); + String path = routeLineDto.getPath(); + String type = routeLineDto.getType(); + String[] str = path.split("->"); + 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 { - from_y = task.getFrom_y(); + next_device_code = this_device_code; } - if (Integer.parseInt(task.getFrom_z()) < 10 && task.getFrom_z().length() == 1) { - from_z = "0" + task.getFrom_z(); - task.setFrom_z(from_z); - } else if (task.getFrom_z().length() == 2) { - from_z = task.getFrom_z(); - task.setFrom_z(from_z); + + if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) { + next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z(); } else { - from_z = task.getFrom_z(); + next_point_code = next_device_code; } - task.setFrom_x(start_point_code); - task.setStart_point_code(start_point_code + "-" + from_y + "-" + from_z); - task.setStart_device_code(start_point_code); - } else { - task.setStart_device_code(start_point_code); - task.setStart_device_code(start_point_code); - } - } - if (StrUtil.contains(next_point_code, "-") && StrUtil.count(next_point_code, "-") == 2) { - String[] next_point = next_point_code.split("-"); - task.setNext_device_code(next_point[0]); - task.setTo_x(next_point[0]); - if (Integer.parseInt(next_point[1]) < 10 && next_point[1].length() == 1) { - to_y = "0" + next_point[1]; - task.setTo_y(to_y); - } else { - to_y = next_point[1]; - task.setTo_y(to_y); - } - if (Integer.parseInt(next_point[2]) < 10 && next_point[2].length() == 1) { - to_z = "0" + next_point[2]; - task.setTo_z(to_z); - } else if (next_point[2].length() == 2) { - to_z = next_point[2]; - task.setTo_z(to_z); - } else { - to_z = next_point[2]; - task.setTo_z(to_z); - } - task.setNext_point_code(task.getNext_device_code() + "-" + to_y + "-" + to_z); - task.setNext_device_code(task.getNext_device_code()); + Instruction instdto = new Instruction(); + if (StrUtil.isEmpty(instdto.getInstruction_code())) { + instdto.setInstruction_code(CodeUtil.getNewCode("INSTRUCT_NO")); + } + instdto.setInstruction_type(task_type); + instdto.setInstruction_id(IdUtil.simpleUUID()); + instdto.setRoute_plan_code(route_plan_code); + instdto.setRemark(acsTask.getRemark()); + instdto.setMaterial(acsTask.getMaterial()); + instdto.setQuantity(acsTask.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); + instdto.setVehicle_type(vehicleType); + instdto.setStart_point_code2(start_point_code2); + instdto.setStart_device_code2(start_point_code2); + instdto.setNext_device_code2(next_point_code2); + instdto.setNext_point_code2(next_point_code2); + instdto.setAgv_system_type(agv_system_type); + instdto.setFrom_x(from_x); + instdto.setFrom_y(from_y); + instdto.setFrom_z(from_z); + instdto.setTo_x(to_x); + instdto.setTo_y(to_y); + instdto.setTo_z(to_z); - } else { - String next_device = - deviceAppService - .findDeviceByCode(next_point_code) - .getDeviceDriverDefination() - .getFitDeviceTypes() - .get(0) - .name(); - if (StrUtil.equals("storage", next_device)) { - if (StrUtil.isEmpty(task.getTo_x())) { - throw new BadRequestException("货位信息终点需要包含列信息"); - } - if (StrUtil.isEmpty(task.getTo_y())) { - throw new BadRequestException("货位信息终点需要包含层信息"); - } - if (Integer.parseInt(task.getTo_y()) < 10 && task.getTo_y().length() == 1) { - to_y = "0" + task.getTo_y(); - task.setTo_y(to_y); + // 判断agv系统 + // 1、1楼叉车系统 + // 2、2楼1区域AGV系统 + // 3、2楼2区域AGV系统 + if (!StrUtil.equals(agv_system_type, "1")) { + // task_type + // 1、生箔; Itype=1:取空,取满,放空,放满; + // 2、分切 Itype=3取满、取空、放满、放空; + // 3、普通任务 Itype=2:取货、放货; + // 4、叉车任务 + // 5、输送任务 + // 6、行架 + // 7、立库 + if (StrUtil.equals(task_type, "1")) { + instdto.setAgv_inst_type("1"); + } else if (StrUtil.equals(task_type, "3")) { + instdto.setAgv_inst_type("2"); + } else if (StrUtil.equals(task_type, "2")) { + instdto.setAgv_inst_type("3"); + } } else { - to_y = task.getTo_y(); + instdto.setAgv_inst_type("4"); } - if (Integer.parseInt(task.getTo_z()) < 10 && task.getTo_z().length() == 1) { - to_z = "0" + task.getTo_z(); - task.setTo_z(to_z); - } else if (task.getTo_z().length() == 2) { - to_z = task.getTo_z(); - task.setTo_z(to_z); + return instdto; + } + + @Override + public Instruction createInst(String ids) throws Exception { + TaskDto acsTask = this.findById(ids); + if (acsTask == null) { + throw new BadRequestException("被删除或无权限,操作失败!"); + } + DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); + InstructionDto inst = instructionservice.findByTaskid(ids, "instruction_status < 2 "); + if (inst != null) { + throw new BadRequestException("有指令未完成!"); + } + + String taskid = acsTask.getTask_id(); + String taskcode = acsTask.getTask_code(); + String vehiclecode = acsTask.getVehicle_code(); + String priority = acsTask.getPriority(); + String start_point_code = acsTask.getStart_point_code(); + String start_device_code = acsTask.getStart_device_code(); + String route_plan_code = acsTask.getRoute_plan_code(); + String vehicleType = acsTask.getVehicle_type(); + // 是否复合任务 =0非复合任务 + String compound_task = acsTask.getCompound_task(); + String next_point_code = acsTask.getNext_point_code(); + String next_device_code = acsTask.getNext_device_code(); + String start_point_code2 = acsTask.getStart_point_code2(); + String next_point_code2 = acsTask.getNext_point_code2(); + String agv_system_type = acsTask.getAgv_system_type(); + String task_type = acsTask.getTask_type(); + String start_height = acsTask.getStart_height(); + String next_height = acsTask.getNext_height(); + /** 开始平均分解校验 */ + String this_device_code = + this.queryAssignedByDevice(acsTask.getStart_device_code(), acsTask.getNext_device_code()); + if (StrUtil.isEmpty(this_device_code)) { + List shortPathsList = + routeLineService.getShortPathLines( + start_device_code, acsTask.getNext_device_code(), route_plan_code); + RouteLineDto routeLineDto = shortPathsList.get(0); + String path = routeLineDto.getPath(); + String type = routeLineDto.getType(); + String[] str = path.split("->"); + 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 { - to_z = task.getTo_z(); + next_device_code = this_device_code; } - task.setTo_x(next_point_code); - task.setNext_point_code(next_point_code + "-" + to_y + "-" + to_z); - task.setNext_device_code(next_point_code); - } else { - task.setNext_device_code(next_point_code); - task.setNext_device_code(next_point_code); - } + if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) { + next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z(); + } else { + next_point_code = next_device_code; + } + + Instruction instdto = new Instruction(); + instdto.setInstruction_type(task_type); + instdto.setInstruction_id(IdUtil.simpleUUID()); + instdto.setRoute_plan_code(route_plan_code); + instdto.setRemark(acsTask.getRemark()); + instdto.setMaterial(acsTask.getMaterial()); + instdto.setQuantity(acsTask.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); + instdto.setVehicle_type(vehicleType); + instdto.setStart_point_code2(start_point_code2); + instdto.setStart_device_code2(start_point_code2); + instdto.setNext_device_code2(next_point_code2); + instdto.setNext_point_code2(next_point_code2); + instdto.setAgv_system_type(agv_system_type); + instdto.setNext_height(next_height); + instdto.setStart_height(start_height); + // 判断agv系统 + // 1、1楼叉车系统 + // 2、2楼1区域AGV系统 + // 3、2楼2区域AGV系统 + if (!StrUtil.equals(agv_system_type, "1")) { + // task_type + // 1、生箔; Itype=1:取空,取满,放空,放满; + // 2、分切 Itype=3取满、取空、放满、放空; + // 3、普通任务 Itype=2:取货、放货; + // 4、叉车任务 + // 5、输送任务 + // 6、行架 + // 7、立库 + if (StrUtil.equals(task_type, "1")) { + instdto.setAgv_inst_type("1"); + } else if (StrUtil.equals(task_type, "3")) { + instdto.setAgv_inst_type("2"); + } else if (StrUtil.equals(task_type, "2")) { + instdto.setAgv_inst_type("3"); + } else if (StrUtil.equals(task_type, "8")) { + instdto.setAgv_inst_type("2"); + } + } else { + instdto.setAgv_inst_type("4"); + } + instructionservice.create2(instdto); + + // acsTask.setTask_status("1"); + // this.update(acsTask); + return instdto; } - return task; - } - @Override - public void updateByCodeFromCache(TaskDto dto) { - removeByCodeFromCache(dto.getTask_code()); - tasks.add(dto); - } + @Override + public Instruction extCreateInst(Instruction inst) throws Exception { - @Override - public String queryAssignedByDevice(String device_code, String task_nextdeice_code) { - List list = - deviceAssignedService.queryAssignedBydevice(device_code, task_nextdeice_code); - int flag1 = 0; - String flag2 = null; - for (int i = 0; i < list.size(); i++) { - DeviceAssignedDto dto = list.get(i); - String inst_nextDevice_code = dto.getInst_nextdevice_code(); - String task_nextDevice_code = dto.getTask_nextdevice_code(); - String param = dto.getParam(); - JSONObject jo = JSON.parseObject(param); - String regEx = "[`~!@#$%^&*()+=|{}':;'\\[\\].<>/?~!@#¥%……&*()——+|{}【】':”“’。、?]"; - Pattern p = Pattern.compile(regEx); - Matcher m = p.matcher(inst_nextDevice_code); - String toSpeechText = m.replaceAll("").trim(); + DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); - String[] str = toSpeechText.split(","); - List pathlist = Arrays.asList(str); - for (int j = 0; j < pathlist.size(); j++) { - String this_device_code = pathlist.get(j).toString(); - JSONObject data = JSON.parseObject(jo.getString(this_device_code)); - String limit = data.getString("limit"); - int num = instructionService.querySameDestinationInst(this_device_code); - if (num >= Integer.parseInt(limit)) { - continue; - } - if (j == 0) { - flag1 = num; - } - if (num <= flag1) { - flag2 = this_device_code; - } - } + instructionservice.create3(inst); + return inst; } - if (!StrUtil.isEmpty(flag2)) { - return flag2; + + + @Override + public Instruction createInst(Instruction inst) throws Exception { + + DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + InstructionService instructionservice = SpringContextHolder.getBean("instructionServiceImpl"); + + instructionservice.create2(inst); + return inst; } - return null; - } - @Override - public Integer querySameDeviceReadyTask(String start_device, String next_device, String status) { - int num = 0; - Iterator iterator = tasks.iterator(); - while (iterator.hasNext()) { - TaskDto task = iterator.next(); - if (StrUtil.equals(task.getStart_device_code(), start_device) - && StrUtil.equals(task.getNext_device_code(), next_device) - && StrUtil.equals(task.getTask_status(), status)) { - num++; + @Override + public void download(List all, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + for (TaskDto acsTask : all) { + Map map = new LinkedHashMap<>(); + map.put("任务号", acsTask.getTask_code()); + map.put("载具号", acsTask.getVehicle_code()); + map.put("载具类型", acsTask.getVehicle_type()); + map.put("任务类型", acsTask.getTask_type()); + map.put("任务状态", acsTask.getTask_status()); + map.put("任务优先级", acsTask.getPriority()); + map.put("创建类型", acsTask.getCreate_type()); + map.put("完成类型", acsTask.getFinish_type()); + map.put("执行描述编码", acsTask.getExecute_code()); + map.put("执行描述信息", acsTask.getExecute_message()); + map.put("起始点位编码", acsTask.getStart_point_code()); + map.put("起始设备编码", acsTask.getStart_device_code()); + map.put("目标点位编码", acsTask.getNext_point_code()); + map.put("目标设备编码", acsTask.getNext_device_code()); + map.put("起始点位编码2", acsTask.getStart_point_code2()); + map.put("起始设备编码2", acsTask.getStart_device_code2()); + map.put("目标点位编码2", acsTask.getNext_point_code2()); + map.put("目标设备编码2", acsTask.getNext_device_code2()); + map.put("放货点位编码", acsTask.getPut_point_code()); + map.put("放货设备编码", acsTask.getPut_device_code()); + map.put("列", acsTask.getTo_y()); + map.put("层", acsTask.getTo_z()); + map.put("重量", acsTask.getWeight()); + map.put("agv系统类型", acsTask.getAgv_system_type()); + map.put("立库任务类型", acsTask.getStorage_task_type()); + map.put("烘箱温度", acsTask.getTemperature()); + map.put("烘箱时间", acsTask.getOven_time()); + map.put("agv车号", acsTask.getCarno()); + map.put("路由方案名称", acsTask.getRoute_plan_name()); + map.put("路由方案编码", acsTask.getRoute_plan_code()); + map.put("是否需要反馈上位系统", acsTask.getIs_needfeedback()); + map.put("备注", acsTask.getRemark()); + map.put("是否启用", acsTask.getIs_active()); + map.put("是否删除", acsTask.getIs_delete()); + map.put("创建者", acsTask.getCreate_by()); + map.put("创建时间", acsTask.getCreate_time()); + map.put("修改者", acsTask.getUpdate_by()); + map.put("修改时间", acsTask.getUpdate_time()); + list.add(map); } - } + FileUtil.downloadExcel(list, response); + } - return num; - } + @Override + public void createTaskByClick(JSONObject json) { + } - - @Override - public Integer querySameTaskByType(String taskType) { - int num = 0; - Iterator iterator = tasks.iterator(); - while (iterator.hasNext()) { - TaskDto task = iterator.next(); - if (task.getTask_type().equals(taskType) && task.getTask_status().equals("1")) { - num++; + @Override + public int checkAllowCreate(String devicecode) { + Map map = new HashMap(); + List taskList = this.queryAllUnfinished(map); + int num = 0; + for (int i = 0; i < taskList.size(); i++) { + TaskDto onetask = taskList.get(i); + String next_code = onetask.getNext_point_code(); + if (StrUtil.equals(devicecode, next_code)) { + num = num + 1; + } } - } + return num; + } - return num; - } + @Override + public boolean removeByCodeFromCache(String code) { + CopyOnWriteArrayList taskDtos = (CopyOnWriteArrayList) this.tasks; + taskDtos.removeIf((task) -> { + return task.getTask_code().equals(code); + }); + return true; + } - @Override - public Integer querySameOriginTask(String code) { - int num = 0; - Iterator iterator = tasks.iterator(); - while (iterator.hasNext()) { - TaskDto task = iterator.next(); - if (StrUtil.equals(task.getStart_device_code(), code)) { - num++; + @Override + public List findAllTaskFromCache() { + return tasks; + } + + public TaskDto findByContainer(String container_code) { + Iterator var3 = tasks.iterator(); + + while (var3.hasNext()) { + TaskDto task = (TaskDto) var3.next(); + if (StrUtil.equals(task.getVehicle_code(), container_code)) { + return task; + } } - } - return num; - } + return null; + } - @Override - public Integer querySameDestinationTask(String code) { - int num = 0; - Iterator iterator = tasks.iterator(); - while (iterator.hasNext()) { - TaskDto task = iterator.next(); - if (StrUtil.equals(task.getNext_device_code(), code)) { - num++; + public TaskDto findByCodeFromCache(String task_code) { + Iterator var3 = tasks.iterator(); + + while (var3.hasNext()) { + TaskDto task = (TaskDto) var3.next(); + if (StrUtil.equals(task.getTask_code(), task_code)) { + return task; + } } - } + return null; + } - return num; + @Override + public TaskDto findByNextCode(String device_code) { + Iterator var3 = tasks.iterator(); + + while (var3.hasNext()) { + TaskDto task = (TaskDto) var3.next(); + if (StrUtil.equals(task.getNext_device_code(), device_code)) { + return task; + } + } + return null; + } + + @Override + public List findAllByNextCode(String device_code) { + return null; + } + + @Override + public Integer queryAllTaskMaterialQty(String device_code) { + return null; + } + + @Override + public TaskDto findByStartCodeAndReady(String device_code) { + Iterator var3 = tasks.iterator(); + + while (var3.hasNext()) { + TaskDto task = (TaskDto) var3.next(); + // if (!StrUtil.equals(task.getTask_type(), "5")) { + // continue; + // } + if (StrUtil.equals(task.getStart_device_code(), device_code) + && StrUtil.equals(task.getTask_status(), "0")) { + return task; + } + } + return null; + } + + @Override + public TaskDto findByStartCode(String device_code) { + Iterator var3 = tasks.iterator(); + + while (var3.hasNext()) { + TaskDto task = (TaskDto) var3.next(); + if (StrUtil.equals(task.getStart_device_code(), device_code)) { + return task; + } + } + return null; + } + + @Override + public TaskDto foramte(TaskDto task) { + String start_point_code = task.getStart_point_code(); + String next_point_code = task.getNext_point_code(); + String from_y = null; + String from_z = null; + String to_y = null; + String to_z = null; + if (StrUtil.contains(start_point_code, "-") && StrUtil.count(start_point_code, "-") == 2) { + String[] start_point = start_point_code.split("-"); + task.setFrom_x(start_point[0]); + task.setStart_device_code(start_point[0]); + if (Integer.parseInt(start_point[1]) < 10 && start_point[1].length() == 1) { + from_y = "0" + start_point[1]; + task.setFrom_y(from_y); + } else { + from_y = start_point[1]; + task.setFrom_y(from_y); + } + if (Integer.parseInt(start_point[2]) < 10 && start_point[2].length() == 1) { + from_z = "0" + start_point[2]; + task.setFrom_z(from_z); + } else if (start_point[2].length() == 2) { + from_z = start_point[2]; + task.setFrom_z(start_point[2]); + } else { + from_z = start_point[2]; + } + task.setStart_point_code(task.getStart_device_code() + "-" + from_y + "-" + from_z); + task.setStart_device_code(task.getStart_device_code()); + + } else { + String start_device = + deviceAppService + .findDeviceByCode(start_point_code) + .getDeviceDriverDefination() + .getFitDeviceTypes() + .get(0) + .name(); + // 如果point_device为货架,则不包含列层信息,需要重新拼接 + if (StrUtil.equals("storage", start_device)) { + if (StrUtil.isEmpty(task.getFrom_x())) { + throw new BadRequestException("货位信息起点需要包含列信息"); + } + if (StrUtil.isEmpty(task.getFrom_y())) { + throw new BadRequestException("货位信息起点需要包含层信息"); + } + if (Integer.parseInt(task.getFrom_y()) < 10 && task.getFrom_y().length() == 1) { + from_y = "0" + task.getFrom_y(); + task.setFrom_y(from_y); + } else { + from_y = task.getFrom_y(); + } + if (Integer.parseInt(task.getFrom_z()) < 10 && task.getFrom_z().length() == 1) { + from_z = "0" + task.getFrom_z(); + task.setFrom_z(from_z); + } else if (task.getFrom_z().length() == 2) { + from_z = task.getFrom_z(); + task.setFrom_z(from_z); + } else { + from_z = task.getFrom_z(); + } + task.setFrom_x(start_point_code); + task.setStart_point_code(start_point_code + "-" + from_y + "-" + from_z); + task.setStart_device_code(start_point_code); + } else { + task.setStart_device_code(start_point_code); + task.setStart_device_code(start_point_code); + } + } + + if (StrUtil.contains(next_point_code, "-") && StrUtil.count(next_point_code, "-") == 2) { + String[] next_point = next_point_code.split("-"); + task.setNext_device_code(next_point[0]); + task.setTo_x(next_point[0]); + if (Integer.parseInt(next_point[1]) < 10 && next_point[1].length() == 1) { + to_y = "0" + next_point[1]; + task.setTo_y(to_y); + } else { + to_y = next_point[1]; + task.setTo_y(to_y); + } + if (Integer.parseInt(next_point[2]) < 10 && next_point[2].length() == 1) { + to_z = "0" + next_point[2]; + task.setTo_z(to_z); + } else if (next_point[2].length() == 2) { + to_z = next_point[2]; + task.setTo_z(to_z); + } else { + to_z = next_point[2]; + task.setTo_z(to_z); + } + task.setNext_point_code(task.getNext_device_code() + "-" + to_y + "-" + to_z); + task.setNext_device_code(task.getNext_device_code()); + + } else { + String next_device = + deviceAppService + .findDeviceByCode(next_point_code) + .getDeviceDriverDefination() + .getFitDeviceTypes() + .get(0) + .name(); + if (StrUtil.equals("storage", next_device)) { + if (StrUtil.isEmpty(task.getTo_x())) { + throw new BadRequestException("货位信息终点需要包含列信息"); + } + if (StrUtil.isEmpty(task.getTo_y())) { + throw new BadRequestException("货位信息终点需要包含层信息"); + } + if (Integer.parseInt(task.getTo_y()) < 10 && task.getTo_y().length() == 1) { + to_y = "0" + task.getTo_y(); + task.setTo_y(to_y); + } else { + to_y = task.getTo_y(); + } + if (Integer.parseInt(task.getTo_z()) < 10 && task.getTo_z().length() == 1) { + to_z = "0" + task.getTo_z(); + task.setTo_z(to_z); + } else if (task.getTo_z().length() == 2) { + to_z = task.getTo_z(); + task.setTo_z(to_z); + } else { + to_z = task.getTo_z(); + } + task.setTo_x(next_point_code); + task.setNext_point_code(next_point_code + "-" + to_y + "-" + to_z); + task.setNext_device_code(next_point_code); + + } else { + task.setNext_device_code(next_point_code); + task.setNext_device_code(next_point_code); + } + } + return task; + } + + @Override + public void updateByCodeFromCache(TaskDto dto) { + removeByCodeFromCache(dto.getTask_code()); + tasks.add(dto); + } + + @Override + public String queryAssignedByDevice(String device_code, String task_nextdeice_code) { + List list = + deviceAssignedService.queryAssignedBydevice(device_code, task_nextdeice_code); + int flag1 = 0; + String flag2 = null; + for (int i = 0; i < list.size(); i++) { + DeviceAssignedDto dto = list.get(i); + String inst_nextDevice_code = dto.getInst_nextdevice_code(); + String task_nextDevice_code = dto.getTask_nextdevice_code(); + String param = dto.getParam(); + JSONObject jo = JSON.parseObject(param); + String regEx = "[`~!@#$%^&*()+=|{}':;'\\[\\].<>/?~!@#¥%……&*()——+|{}【】':”“’。、?]"; + Pattern p = Pattern.compile(regEx); + Matcher m = p.matcher(inst_nextDevice_code); + String toSpeechText = m.replaceAll("").trim(); + + String[] str = toSpeechText.split(","); + List pathlist = Arrays.asList(str); + for (int j = 0; j < pathlist.size(); j++) { + String this_device_code = pathlist.get(j).toString(); + JSONObject data = JSON.parseObject(jo.getString(this_device_code)); + String limit = data.getString("limit"); + int num = instructionService.querySameDestinationInst(this_device_code); + if (num >= Integer.parseInt(limit)) { + continue; + } + if (j == 0) { + flag1 = num; + } + if (num <= flag1) { + flag2 = this_device_code; + } + } + } + if (!StrUtil.isEmpty(flag2)) { + return flag2; + } + return null; + } + + @Override + public Integer querySameDeviceReadyTask(String start_device, String next_device, String status) { + int num = 0; + Iterator iterator = tasks.iterator(); + while (iterator.hasNext()) { + TaskDto task = iterator.next(); + if (StrUtil.equals(task.getStart_device_code(), start_device) + && StrUtil.equals(task.getNext_device_code(), next_device) + && StrUtil.equals(task.getTask_status(), status)) { + num++; + } + } + + return num; + } + + + @Override + public Integer querySameTaskByType(String taskType) { + int num = 0; + Iterator iterator = tasks.iterator(); + while (iterator.hasNext()) { + TaskDto task = iterator.next(); + if (task.getTask_type().equals(taskType) && task.getTask_status().equals("1")) { + num++; + } + } + + return num; + } + + @Override + public Integer querySameOriginTask(String code) { + int num = 0; + Iterator iterator = tasks.iterator(); + while (iterator.hasNext()) { + TaskDto task = iterator.next(); + if (StrUtil.equals(task.getStart_device_code(), code)) { + num++; + } + } + + return num; + } + + @Override + public Integer querySameDestinationTask(String code) { + int num = 0; + Iterator iterator = tasks.iterator(); + while (iterator.hasNext()) { + TaskDto task = iterator.next(); + if (StrUtil.equals(task.getNext_device_code(), code)) { + num++; + } + } + + return num; } } diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java index 6d2700d70..f515370b0 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java @@ -39,7 +39,7 @@ public class AutoCreateInst { List list = taskserver.queryAll("task_status = '0'"); for (int i = 0; i < list.size(); i++) { TaskDto acsTask = list.get(i); - if(StrUtil.equals(acsTask.getTask_type(),"7") && !StrUtil.startWith(acsTask.getTask_code(), "-") ){ + if (StrUtil.equals(acsTask.getTask_type(), "7") && !StrUtil.startWith(acsTask.getTask_code(), "-")) { continue; } String taskid = acsTask.getTask_id(); @@ -69,6 +69,9 @@ public class AutoCreateInst { String vehicleType = acsTask.getVehicle_type(); String agv_system_type = acsTask.getAgv_system_type(); + String start_height = acsTask.getStart_height(); + String next_height = acsTask.getNext_height(); + if (StrUtil.equals(is_send, "0")) { continue; @@ -138,6 +141,8 @@ public class AutoCreateInst { instdto.setExecute_device_code(start_point_code); instdto.setVehicle_type(vehicleType); instdto.setAgv_system_type(agv_system_type); + instdto.setStart_height(start_height); + instdto.setNext_height(next_height); //判断agv系统 //1、1楼叉车系统 //2、2楼1区域AGV系统 diff --git a/acs/nladmin-ui/src/views/acs/instruction/index.vue b/acs/nladmin-ui/src/views/acs/instruction/index.vue index d0c3188bf..a1d4f6f34 100644 --- a/acs/nladmin-ui/src/views/acs/instruction/index.vue +++ b/acs/nladmin-ui/src/views/acs/instruction/index.vue @@ -153,8 +153,9 @@ - - + + + diff --git a/acs/nladmin-ui/src/views/acs/task/index.vue b/acs/nladmin-ui/src/views/acs/task/index.vue index be37acf3a..59cf49fb1 100644 --- a/acs/nladmin-ui/src/views/acs/task/index.vue +++ b/acs/nladmin-ui/src/views/acs/task/index.vue @@ -300,6 +300,12 @@ + + + + + + @@ -310,7 +316,14 @@ - + @@ -343,10 +356,18 @@ {{ dict.label.storage_task_type[scope.row.storage_task_type] }} + + - +