From b5e11636ffae04a9d76ebe9e7fd06cc38bad5e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Mon, 3 Apr 2023 10:57:01 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=A5=BD=E5=A4=9A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LnshLaminatingMachineDeviceDriver.java | 2 +- .../lnsh/lnsh_rgv/LnshRGVDeviceDriver.java | 47 ++-- .../LnshSplitManipulatorDeviceDriver.java | 239 +++++++++--------- .../lnsh_station/LnshStationDeviceDriver.java | 14 +- ...agePalletSplitManipulatorDeviceDriver.java | 1 + .../service/InstructionService.java | 1 + .../service/impl/InstructionServiceImpl.java | 13 +- .../auto/run/NDCSocketConnectionAutoRun.java | 9 +- .../acs/service/impl/AcsToWmsServiceImpl.java | 8 + 9 files changed, 185 insertions(+), 149 deletions(-) diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java index ec4360e..7cf20f5 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java @@ -309,7 +309,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i return false; } else { this.instruction_require_time = date; - Instruction inst = instructionService.findByCode(String.valueOf(task)); + Instruction inst = instructionService.findByCodeFromCache(String.valueOf(task)); JSONObject json = new JSONObject(); json.put("device_code",this.device_code); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java index 979fc59..24dadb8 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java @@ -243,11 +243,11 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi } if (move_1 == 0 && task1 == 0) { this.setRequireSucess1(false); - logServer.deviceExecuteLog(this.device_code, "", "", "前工位无货且无任务,复位前工位请求标记requireSucess1:"+requireSucess1); + logServer.deviceExecuteLog(this.device_code, "", "", "前工位无货且无任务,复位前工位请求标记requireSucess1:" + requireSucess1); } if (move_2 == 0 && task2 == 0) { this.setRequireSucess2(false); - logServer.deviceExecuteLog(this.device_code, "", "", "后工位无货且无任务,复位后工位请求标记requireSucess2:"+requireSucess1); + logServer.deviceExecuteLog(this.device_code, "", "", "后工位无货且无任务,复位后工位请求标记requireSucess2:" + requireSucess1); } @@ -274,14 +274,17 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi //inst_message inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); if (inst1 != null) { - if (StrUtil.equals(inst1.getInstruction_status(), "1")) { + try { finish_instruction(inst1); - writing("to_command1", "0"); - writing("to_onset1", "0"); - writing("to_target1", "0"); - writing("to_task1", "0"); - + } catch (Exception e) { + logServer.deviceExecuteLog(this.device_code, "", "", "前工位指令" + task1 + "完成失败,请手动完成。"); } + writing("to_command1", "0"); + writing("to_onset1", "0"); + writing("to_target1", "0"); + writing("to_task1", "0"); + + } this.requireSucess1 = false; } @@ -303,14 +306,16 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi //inst_message inst2 = instructionService.findByCodeFromCache(String.valueOf(task2)); if (inst2 != null) { - if (StrUtil.equals(inst2.getInstruction_status(), "1")) { + try { finish_instruction(inst2); - writing("to_command2", "0"); - writing("to_onset2", "0"); - writing("to_target2", "0"); - writing("to_task2", "0"); - + } catch (Exception e) { + logServer.deviceExecuteLog(this.device_code, "", "", "后工位指令" + task2 + "完成失败,请手动完成。"); } + writing("to_command2", "0"); + writing("to_onset2", "0"); + writing("to_target2", "0"); + writing("to_task2", "0"); + } this.requireSucess2 = false; } @@ -498,7 +503,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi writing("to_onset1", start_addr); writing("to_target1", next_addr); writing("to_task1", instdto.getInstruction_code()); - logServer.deviceExecuteLog(this.device_code, "", "", "申请前工位满料任务成功,requireSucess1"+requireSucess1+",指令号:"+instdto.getInstruction_code()); + logServer.deviceExecuteLog(this.device_code, "", "", "申请前工位满料任务成功,requireSucess1" + requireSucess1 + ",指令号:" + instdto.getInstruction_code()); } } return true; @@ -579,7 +584,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi writing("to_target2", next_addr); writing("to_task2", instdto.getInstruction_code()); - logServer.deviceExecuteLog(this.device_code, "", "", "申请后工位空盘任务成功,requireSucess2"+requireSucess2+",指令号:"+instdto.getInstruction_code()); + logServer.deviceExecuteLog(this.device_code, "", "", "申请后工位空盘任务成功,requireSucess2" + requireSucess2 + ",指令号:" + instdto.getInstruction_code()); } } @@ -599,7 +604,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - + Map itemMap = new HashMap(); itemMap.put(to_param, value); @@ -617,7 +622,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi public void executing(int command, Instruction instruction, String appendMessage) { - + Map itemMap = new HashMap(); this.control(itemMap); @@ -638,7 +643,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_command1; - + Map itemMap = new HashMap(); itemMap.put(to_command1, command); this.control(itemMap); @@ -649,7 +654,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi String to_command2 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_command2; - + Map itemMap = new HashMap(); itemMap.put(to_command2, command); this.control(itemMap); @@ -657,7 +662,7 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi } public void writing(int type, int command) { - + Map itemMap = new HashMap(); this.control(itemMap); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java index abe90d6..a91b6b3 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java @@ -920,141 +920,146 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im String demoArray[] = demosub.split(","); List demoList = Arrays.asList(demoArray); json.put("device_code",demoList.get(getStation-1).replace("\"","")); - JSONObject jo = acsToWmsService.getVehicle(json); + HttpResponse result = acsToWmsService.queryCribbingInfo(json); - if (ObjectUtil.isNotEmpty(jo)) { - if (jo.getInteger("status") == 200) { - JSONObject content = jo.getJSONObject("content"); + if (result.getStatus() == 200) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + JSONObject content = jsonObject.getJSONObject("content"); + if (ObjectUtil.isEmpty(content)) { + this.writing(20); + this.setRequireSucess(true); + return true; + } else { String qty = content.getString("qty"); String material_code = content.getString("material_code"); String material_name = content.getString("material_name"); String product_code = content.getString("product_code"); - String AlongSide = content.getString("AlongSide"); - String BshortSide = content.getString("BshortSide"); - String Htrapezoidal = content.getString("Htrapezoidal"); - String Wthickness = content.getString("Wthickness"); + String AlongSide = content.getString("alongside"); + String BshortSide = content.getString("bshortside"); + String Htrapezoidal = content.getString("htrapezoidal"); + String Wthickness = content.getString("wthickness"); String tray_qty = content.getString("tray_qty"); String tray_high = content.getString("tray_high"); String crib_category = content.getString("crib_category"); - String palletX1_line = content.getString("palletX1_line"); - String palletY1_row = content.getString("palletY1_row"); - String palletA1_angle = content.getString("palletA1_angle"); - String palletX2_line = content.getString("palletX2_line"); - String palletY2_row = content.getString("palletY2_row"); - String palletA2_angle = content.getString("palletA2_angle"); - String palletX3_line = content.getString("palletX3_line"); - String palletY3_row = content.getString("palletY3_row"); - String palletA3_angle = content.getString("palletA3_angle"); - String pressCribX1_line = content.getString("pressCribX1_line"); - String pressCribY1_row = content.getString("pressCribY1_row"); - String pressCribA1_angle = content.getString("pressCribA1_angle"); - String pressCribX2_line = content.getString("pressCribX2_line"); - String pressCribY2_row = content.getString("pressCribY2_row"); - String pressCribA2_angle = content.getString("pressCribA2_angle"); - String pressCribX3_line = content.getString("pressCribX3_line"); - String pressCribY3_row = content.getString("pressCribY3_row"); - String pressCribA3_angle = content.getString("pressCribA3_angle"); - String Zoffset = content.getString("Zoffset"); - String pallet_layerQty = content.getString("pallet_layerQty"); - String pressCrib_layerQty = content.getString("pressCrib_layerQty"); - String codeLayerX1_interval = content.getString("codeLayerX1_interval"); - String codeLayerY1_interval = content.getString("codeLayerY1_interval"); - String codeLayerX2_interval = content.getString("codeLayerX2_interval"); - String codeLayerY2_interval = content.getString("codeLayerY2_interval"); - String codeLayerX3_interval = content.getString("codeLayerX3_interval"); - String codeLayerY3_interval = content.getString("codeLayerY3_interval"); - String codeLayerX1_offset = content.getString("codeLayerX1_offset"); - String codeLayerY1_offset = content.getString("codeLayerY1_offset"); - String codeLayerX2_offset = content.getString("codeLayerX2_offset"); - String codeLayerY2_offset = content.getString("codeLayerY2_offset"); - String codeLayerX3_offset = content.getString("codeLayerX3_offset"); - String codeLayerY3_offset = content.getString("codeLayerY3_offset"); - String pressLayerX1_interval = content.getString("pressLayerX1_interval"); - String pressLayerY1_interval = content.getString("pressLayerY1_interval"); - String pressLayerX2_interval = content.getString("pressLayerX2_interval"); - String pressLayerY2_interval = content.getString("pressLayerY2_interval"); - String pressLayerX3_interval = content.getString("pressLayerX3_interval"); - String pressLayerY3_interval = content.getString("pressLayerY3_interval"); - String pressLayerX1_offset = content.getString("pressLayerX1_offset"); - String pressLayerY1_offset = content.getString("pressLayerY1_offset"); - String pressLayerX2_offset = content.getString("pressLayerX2_offset"); - String pressLayerY2_offset = content.getString("pressLayerY2_offset"); - String pressLayerX3_offset = content.getString("pressLayerX3_offset"); - String pressLayerY3_offset = content.getString("pressLayerY3_offset"); - String one_cribTotal = content.getString("one_cribTotal"); - String two_cribTotal = content.getString("two_cribTotal"); + String palletX1_line = content.getString("palletx1_line"); + String palletY1_row = content.getString("pallety1_row"); + String palletA1_angle = content.getString("palleta1_angle"); + String palletX2_line = content.getString("palletx2_line"); + String palletY2_row = content.getString("pallety2_row"); + String palletA2_angle = content.getString("palleta2_angle"); + String palletX3_line = content.getString("palletx3_line"); + String palletY3_row = content.getString("pallety3_row"); + String palletA3_angle = content.getString("palleta3_angle"); + String pressCribX1_line = content.getString("presscribx1_line"); + String pressCribY1_row = content.getString("presscriby1_row"); + String pressCribA1_angle = content.getString("presscriba1_angle"); + String pressCribX2_line = content.getString("presscribx2_line"); + String pressCribY2_row = content.getString("presscriby2_row"); + String pressCribA2_angle = content.getString("presscriba2_angle"); + String pressCribX3_line = content.getString("presscribx3_line"); + String pressCribY3_row = content.getString("presscriby3_row"); + String pressCribA3_angle = content.getString("presscriba3_angle"); + String Zoffset = content.getString("zoffset"); + String pallet_layerQty = content.getString("pallet_layerqty"); + String pressCrib_layerQty = content.getString("presscrib_layerqty"); + String codeLayerX1_interval = content.getString("codelayerx1_interval"); + String codeLayerY1_interval = content.getString("codelayery1_interval"); + String codeLayerX2_interval = content.getString("codelayerx2_interval"); + String codeLayerY2_interval = content.getString("codelayery2_interval"); + String codeLayerX3_interval = content.getString("codelayerx3_interval"); + String codeLayerY3_interval = content.getString("codelayery3_interval"); + String codeLayerX1_offset = content.getString("codelayerx1_offset"); + String codeLayerY1_offset = content.getString("codelayery1_offset"); + String codeLayerX2_offset = content.getString("codelayerx2_offset"); + String codeLayerY2_offset = content.getString("codelayery2_offset"); + String codeLayerX3_offset = content.getString("codelayerx3_offset"); + String codeLayerY3_offset = content.getString("codelayery3_offset"); + String pressLayerX1_interval = content.getString("presslayerx1_interval"); + String pressLayerY1_interval = content.getString("presslayery1_interval"); + String pressLayerX2_interval = content.getString("presslayerx2_interval"); + String pressLayerY2_interval = content.getString("presslayery2_interval"); + String pressLayerX3_interval = content.getString("presslayerx3_interval"); + String pressLayerY3_interval = content.getString("presslayery3_interval"); + String pressLayerX1_offset = content.getString("presslayerx1_offset"); + String pressLayerY1_offset = content.getString("presslayery1_offset"); + String pressLayerX2_offset = content.getString("presslayerx2_offset"); + String pressLayerY2_offset = content.getString("presslayery2_offset"); + String pressLayerX3_offset = content.getString("presslayerx3_offset"); + String pressLayerY3_offset = content.getString("presslayery3_offset"); + String one_cribTotal = content.getString("one_cribtotal"); + String two_cribTotal = content.getString("two_cribtotal"); String one_qty = content.getString("one_qty"); String two_qty = content.getString("two_qty"); String tool_coordinate = content.getString("tool_coordinate"); - - this.writing("to_product_code",product_code); - this.writing("to_material_code",material_code); - this.writing("to_AlongSide",AlongSide); - this.writing("to_BshortSide",BshortSide); - this.writing("to_Htrapezoidal",Htrapezoidal); - this.writing("to_Wthickness",Wthickness); - //当前托盘砖数量 - this.writing("to_tray_qty",qty); - this.writing("to_tray_high",tray_high); - this.writing("to_crib_category",crib_category); - this.writing("to_palletX1_line",palletX1_line); - this.writing("to_palletY1_row",palletY1_row); - this.writing("to_palletA1_angle",palletA1_angle); - this.writing("to_palletX2_line",palletX2_line); - this.writing("to_palletY2_row",palletY2_row); - this.writing("to_palletA2_angle",palletA2_angle); - this.writing("to_palletX3_line",palletX3_line); - this.writing("to_palletY3_row",palletY3_row); - this.writing("to_palletA3_angle",palletA3_angle); - this.writing("to_pressCribX1_line",pressCribX1_line); - this.writing("to_pressCribY1_row",pressCribY1_row); - this.writing("to_pressCribA1_angle",pressCribA1_angle); - this.writing("to_pressCribX2_line",pressCribX2_line); - this.writing("to_pressCribY2_row",pressCribY2_row); - this.writing("to_pressCribA2_angle",pressCribA2_angle); - this.writing("to_pressCribX3_line",pressCribX3_line); - this.writing("to_pressCribY3_row",pressCribY3_row); - this.writing("to_pressCribA3_angle",pressCribA3_angle); - this.writing("to_Zoffset",Zoffset); - this.writing("to_pallet_layerQty",pallet_layerQty); - this.writing("to_pressCrib_layerQty",pressCrib_layerQty); - this.writing("to_codeLayerX1_interval",codeLayerX1_interval); - this.writing("to_codeLayerY1_interval",codeLayerY1_interval); - this.writing("to_codeLayerX2_interval",codeLayerX2_interval); - this.writing("to_codeLayerY2_interval",codeLayerY2_interval); - this.writing("to_codeLayerX3_interval",codeLayerX3_interval); - this.writing("to_codeLayerY3_interval",codeLayerY3_interval); - this.writing("to_codeLayerX1_offset",codeLayerX1_offset); - this.writing("to_codeLayerY1_offset",codeLayerY1_offset); - this.writing("to_codeLayerX2_offset",codeLayerX2_offset); - this.writing("to_codeLayerY2_offset",codeLayerY2_offset); - this.writing("to_codeLayerX3_offset",codeLayerX3_offset); - this.writing("to_codeLayerY3_offset",codeLayerY3_offset); - this.writing("to_pressLayerX1_interval",pressLayerX1_interval); - this.writing("to_pressLayerY1_interval",pressLayerY1_interval); - this.writing("to_pressLayerX2_interval",pressLayerX2_interval); - this.writing("to_pressLayerY2_interval",pressLayerY2_interval); - this.writing("to_pressLayerX3_interval",pressLayerX3_interval); - this.writing("to_pressLayerY3_interval",pressLayerY3_interval); - this.writing("to_pressLayerX1_offset",pressLayerX1_offset); - this.writing("to_pressLayerY1_offset",pressLayerY1_offset); - this.writing("to_pressLayerX2_offset",pressLayerX2_offset); - this.writing("to_pressLayerY2_offset",pressLayerY2_offset); - this.writing("to_pressLayerX3_offset",pressLayerX3_offset); - this.writing("to_pressLayerY3_offset",pressLayerY3_offset); - this.writing("to_one_cribTotal",one_cribTotal); - this.writing("to_two_cribTotal",two_cribTotal); - this.writing("to_one_qty",one_qty); - this.writing("to_two_qty",two_qty); - this.writing("to_tool_coordinate",tool_coordinate); +// this.writing("to_material_qty", StrUtil.isBlank(qty) ? "0" : qty); + this.writing("to_material_code", StrUtil.isBlank(material_code) ? "0" : material_code); + this.writing("to_product_code", StrUtil.isBlank(product_code) ? "0" : product_code); + this.writing("to_AlongSide", StrUtil.isBlank(AlongSide) ? "0" : AlongSide); + this.writing("to_BshortSide", StrUtil.isBlank(BshortSide) ? "0" : BshortSide); + this.writing("to_Htrapezoidal", StrUtil.isBlank(Htrapezoidal) ? "0" : Htrapezoidal); + this.writing("to_Wthickness", StrUtil.isBlank(Wthickness) ? "0" : Wthickness); + this.writing("to_tray_qty", StrUtil.isBlank(qty) ? "0" : qty); + this.writing("to_tray_high", StrUtil.isBlank(tray_high) ? "0" : tray_high); + this.writing("to_crib_category", StrUtil.isBlank(crib_category) ? "0" : crib_category); + this.writing("to_palletX1_line", StrUtil.isBlank(palletX1_line) ? "0" : palletX1_line); + this.writing("to_palletY1_row", StrUtil.isBlank(palletY1_row) ? "0" : palletY1_row); + this.writing("to_palletA1_angle", StrUtil.isBlank(palletA1_angle) ? "0" : palletA1_angle); + this.writing("to_palletX2_line", StrUtil.isBlank(palletX2_line) ? "0" : palletX2_line); + this.writing("to_palletY2_row", StrUtil.isBlank(palletY2_row) ? "0" : palletY2_row); + this.writing("to_palletA2_angle", StrUtil.isBlank(palletA2_angle) ? "0" : palletA2_angle); + this.writing("to_palletX3_line", StrUtil.isBlank(palletX3_line) ? "0" : palletX3_line); + this.writing("to_palletY3_row", StrUtil.isBlank(palletY3_row) ? "0" : palletY3_row); + this.writing("to_palletA3_angle", StrUtil.isBlank(palletA3_angle) ? "0" : palletA3_angle); + this.writing("to_pressCribX1_line", StrUtil.isBlank(pressCribX1_line) ? "0" : pressCribX1_line); + this.writing("to_pressCribY1_row", StrUtil.isBlank(pressCribY1_row) ? "0" : pressCribY1_row); + this.writing("to_pressCribA1_angle", StrUtil.isBlank(pressCribA1_angle) ? "0" : pressCribA1_angle); + this.writing("to_pressCribX2_line", StrUtil.isBlank(pressCribX2_line) ? "0" : pressCribX2_line); + this.writing("to_pressCribY2_row", StrUtil.isBlank(pressCribY2_row) ? "0" : pressCribY2_row); + this.writing("to_pressCribA2_angle", StrUtil.isBlank(pressCribA2_angle) ? "0" : pressCribA2_angle); + this.writing("to_pressCribX3_line", StrUtil.isBlank(pressCribX3_line) ? "0" : pressCribX3_line); + this.writing("to_pressCribY3_row", StrUtil.isBlank(pressCribY3_row) ? "0" : pressCribY3_row); + this.writing("to_pressCribA3_angle", StrUtil.isBlank(pressCribA3_angle) ? "0" : pressCribA3_angle); + this.writing("to_Zoffset", StrUtil.isBlank(Zoffset) ? "0" : Zoffset); + this.writing("to_pallet_layerQty", StrUtil.isBlank(pallet_layerQty) ? "0" : pallet_layerQty); + this.writing("to_pressCrib_layerQty", StrUtil.isBlank(pressCrib_layerQty) ? "0" : pressCrib_layerQty); + this.writing("to_codeLayerX1_interval", StrUtil.isBlank(codeLayerX1_interval) ? "0" : codeLayerX1_interval); + this.writing("to_codeLayerY1_interval", StrUtil.isBlank(codeLayerY1_interval) ? "0" : codeLayerY1_interval); + this.writing("to_codeLayerX2_interval", StrUtil.isBlank(codeLayerX2_interval) ? "0" : codeLayerX2_interval); + this.writing("to_codeLayerY2_interval", StrUtil.isBlank(codeLayerY2_interval) ? "0" : codeLayerY2_interval); + this.writing("to_codeLayerX3_interval", StrUtil.isBlank(codeLayerX3_interval) ? "0" : codeLayerX3_interval); + this.writing("to_codeLayerY3_interval", StrUtil.isBlank(codeLayerY3_interval) ? "0" : codeLayerY3_interval); + this.writing("to_codeLayerX1_offset", StrUtil.isBlank(codeLayerX1_offset) ? "0" : codeLayerX1_offset); + this.writing("to_codeLayerY1_offset", StrUtil.isBlank(codeLayerY1_offset) ? "0" : codeLayerY1_offset); + this.writing("to_codeLayerX2_offset", StrUtil.isBlank(codeLayerX2_offset) ? "0" : codeLayerX2_offset); + this.writing("to_codeLayerY2_offset", StrUtil.isBlank(codeLayerY2_offset) ? "0" : codeLayerY2_offset); + this.writing("to_codeLayerX3_offset", StrUtil.isBlank(codeLayerX3_offset) ? "0" : codeLayerX3_offset); + this.writing("to_codeLayerY3_offset", StrUtil.isBlank(codeLayerY3_offset) ? "0" : codeLayerY3_offset); + this.writing("to_pressLayerX1_interval", StrUtil.isBlank(pressLayerX1_interval) ? "0" : pressLayerX1_interval); + this.writing("to_pressLayerY1_interval", StrUtil.isBlank(pressLayerY1_interval) ? "0" : pressLayerY1_interval); + this.writing("to_pressLayerX2_interval", StrUtil.isBlank(pressLayerX2_interval) ? "0" : pressLayerX2_interval); + this.writing("to_pressLayerY2_interval", StrUtil.isBlank(pressLayerY2_interval) ? "0" : pressLayerY2_interval); + this.writing("to_pressLayerX3_interval", StrUtil.isBlank(pressLayerX3_interval) ? "0" : pressLayerX3_interval); + this.writing("to_pressLayerY3_interval", StrUtil.isBlank(pressLayerY3_interval) ? "0" : pressLayerY3_interval); + this.writing("to_pressLayerX1_offset", StrUtil.isBlank(pressLayerX1_offset) ? "0" : pressLayerX1_offset); + this.writing("to_pressLayerY1_offset", StrUtil.isBlank(pressLayerY1_offset) ? "0" : pressLayerY1_offset); + this.writing("to_pressLayerX2_offset", StrUtil.isBlank(pressLayerX2_offset) ? "0" : pressLayerX2_offset); + this.writing("to_pressLayerY2_offset", StrUtil.isBlank(pressLayerY2_offset) ? "0" : pressLayerY2_offset); + this.writing("to_pressLayerX3_offset", StrUtil.isBlank(pressLayerX3_offset) ? "0" : pressLayerX3_offset); + this.writing("to_pressLayerY3_offset", StrUtil.isBlank(pressLayerY3_offset) ? "0" : pressLayerY3_offset); + this.writing("to_one_cribTotal", StrUtil.isBlank(one_cribTotal) ? "0" : one_cribTotal); + this.writing("to_two_cribTotal", StrUtil.isBlank(two_cribTotal) ? "0" : two_cribTotal); + this.writing("to_one_qty", StrUtil.isBlank(one_qty) ? "0" : one_qty); + this.writing("to_two_qty", StrUtil.isBlank(two_qty) ? "0" : two_qty); + this.writing("to_tool_coordinate", StrUtil.isBlank(tool_coordinate) ? "0" : tool_coordinate); Thread.sleep(1000); - this.writing(this.mode); this.setRequireSucess(true); } } + + result.close(); return true; } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java index 59eecdb..83fb0b1 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java @@ -375,7 +375,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements return false; } else { this.instruction_require_time = date; - Instruction inst = instructionService.findByCode(String.valueOf(task)); + Instruction inst = instructionService.findByCodeCreateTimeDESC(String.valueOf(task)); JSONObject json = new JSONObject(); json.put("device_code",this.device_code); @@ -715,4 +715,16 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements public void setDeviceStatus(JSONObject data) { } + + public void writing(String param, String value) { + + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + param; + + Map itemMap = new HashMap(); + itemMap.put(to_param,value); + + this.control(itemMap); + logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value); + } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java index 5fdbb74..4098074 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java @@ -1277,6 +1277,7 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe this.setRequireSucess(true); } } + result.close(); return true; } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java index d836023..06f3e1a 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/InstructionService.java @@ -259,4 +259,5 @@ public interface InstructionService { boolean removeByCodeFromCache(String code); + Instruction findByCodeCreateTimeDESC(String code); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 5d6c374..fa65b22 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -43,6 +43,7 @@ import org.nl.utils.SpringContextHolder; import org.nl.wql.WQL; import org.nl.wql.core.bean.WQLObject; import org.nl.wql.util.WqlUtil; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -68,7 +69,8 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu private final AcsConfigService acsConfigService; private final RouteLineService routeLineService; - private final TaskService taskService; + @Autowired + private TaskService taskService; @Override @@ -202,7 +204,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu @Override public Instruction findByCode(String code) { WQLObject wo = WQLObject.getWQLObject("acs_instruction"); - JSONObject json = wo.query("instruction_code ='" + code + "'").uniqueResult(0); + JSONObject json = wo.query("instruction_code ='" + code + "'", "create_time DESC").uniqueResult(0); final Instruction obj = json.toJavaObject(Instruction.class); return obj; } @@ -1187,4 +1189,11 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); return pattern.matcher(str).matches(); } + + @Override + public Instruction findByCodeCreateTimeDESC(String code) { + WQLObject wo = WQLObject.getWQLObject("acs_instruction"); + JSONObject json = wo.query("instruction_code ='" + code + "'", "create_time DESC").uniqueResult(0); + return json.toJavaObject(Instruction.class); + } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java b/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java index 87ae4cf..d6db5f1 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java @@ -401,12 +401,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (lnshLaminatingMachineDeviceDriver.getMode() != 0 && lnshLaminatingMachineDeviceDriver.getMode() != 6) { inst.setExecute_status("9"); instructionService.update(inst); - lnshLaminatingMachineDeviceDriver.writing(3,Integer.parseInt(inst.getInstruction_code())); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } + lnshLaminatingMachineDeviceDriver.writing("to_task", inst.getInstruction_code()); lnshLaminatingMachineDeviceDriver.writing(1); } //如果组盘绑定条码成功,就允许agv离开 @@ -462,7 +457,7 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { inst.setExecute_status("3"); instructionService.update(inst); lnshStationDeviceDriver.writing(6); - lnshStationDeviceDriver.writing(3,Integer.parseInt(inst.getInstruction_code())); + lnshStationDeviceDriver.writing("to_task",inst.getInstruction_code()); data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index a09e636..624f29e 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -908,6 +908,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { WQLObject group_table = WQLObject.getWQLObject("st_buss_vehiclegroup"); //从组盘表里面去获取组盘信息 JSONObject result = group_table.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(result)) { + String product_code = WQLObject + .getWQLObject("md_me_cribbinginfo") + .query("material_id = " + result.getString("material_id")) + .uniqueResult(0) + .getString("product_code"); + result.put("product_code", product_code); + } JSONObject resultJSON = new JSONObject(); resultJSON.put("content", result); resultJSON.put("status", HttpStatus.OK.value());