From 0528308468dc1ae7c09b9bfcd8115ecf2ce7ad81 Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Mon, 16 Jan 2023 11:05:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../run/OneNDCSocketConnectionAutoRun.java | 9 +- .../SiemensConveyorDeviceDriver.java | 184 ++++++++++++++---- .../slit_two_manipulator/ItemProtocol.java | 5 + .../SlitTwoManipulatorDeviceDriver.java | 152 +++++++++++++-- ...CoveyorControlWithScannerDeviceDriver.java | 99 +++++++--- .../wms/service/impl/WmsToAcsServiceImpl.java | 19 +- .../service/impl/InstructionServiceImpl.java | 1 - .../src/main/java/org/nl/acs/opc/OpcUtl.java | 1 + acs/nladmin-ui/.env.production | 4 +- acs/nladmin-ui/public/config.js | 2 +- .../acs/history/taskTreeRecord/index.vue | 2 + 11 files changed, 379 insertions(+), 99 deletions(-) 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 7b5decdcc..e8d2c827e 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 @@ -120,6 +120,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { //车号 int carno = arr[20]; Instruction link_inst = null; + Instruction inst = null; List insts = null; boolean link_flag = false; Device agv_device = null; @@ -127,7 +128,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { agv_device = deviceAppService.findDeviceByCode(String.valueOf(carno)); } if (ikey != 0) { - insts = instructionService.findByLinkNum(String.valueOf(ikey)); + inst = instructionService.findByCodeFromCache(String.valueOf(ikey)); } if (!ObjectUtil.isEmpty(link_inst)) { link_flag = true; @@ -143,7 +144,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { //开始任务/上报订单号 if (phase == 0x01) { - for (Instruction inst : insts) { + if (!ObjectUtil.isEmpty(inst)) { inst.setInstruction_status("1"); inst.setAgv_jobno(String.valueOf(index)); inst.setSend_status("1"); @@ -155,7 +156,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { //(无车id及状态) else if (phase == 0x0A) { - for (Instruction inst : insts) { + if (!ObjectUtil.isEmpty(inst)) { if (!ObjectUtil.isEmpty(inst)) { instructionService.finish(inst.getInstruction_id()); } @@ -173,7 +174,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { //(需要WCS反馈) else if(phase == 0xFF) { - for (Instruction inst : insts) { + if (!ObjectUtil.isEmpty(inst)) { if (!ObjectUtil.isEmpty(inst)) { instructionService.cancelNOSendAgv(inst.getInstruction_id()); } 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 f95bc2fa5..b472065ad 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 @@ -17,6 +17,8 @@ import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.ScannerDeviceDriver; +import org.nl.acs.device_driver.basedriver.standard_scanner.StandardScannerDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; @@ -122,6 +124,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme String device_code; + String vehicle_code; + @Override public Device getDevice() { @@ -233,6 +237,13 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme if (inst != null) { inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code(); if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { + vehicle_code = inst.getVehicle_code(); +// Device device = deviceAppservice.findDeviceByCode("BCR1"); +// StandardScannerDeviceDriver standardScannerDeviceDriver; +// if (device.getDeviceDriver() instanceof ScannerDeviceDriver) { +// standardScannerDeviceDriver = (StandardScannerDeviceDriver) device.getDeviceDriver(); +// standardScannerDeviceDriver.writeBarcode(vehicle_code); +// } finish_instruction(); } if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) { @@ -325,6 +336,12 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme emptyOut(); } break; + case 8: + //申请AGV任务 + if (move == 0 && !requireSucess) { + applyAgvTask(); + } + break; } } @@ -352,10 +369,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme map.put("code","to_target"); map.put("value","0"); list.add(map); -// Map map2 = new HashMap(); -// map2.put("code","to_task"); -// map2.put("value","0"); -// list.add(map2); + Map map2 = new HashMap(); + map2.put("code","to_task"); + map2.put("value","0"); + list.add(map2); Map map3 = new HashMap(); map3.put("code","to_command"); map3.put("value","0"); @@ -377,7 +394,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme map7.put("value","0"); list.add(map7); this.writing(list); - + message = null; + vehicle_code = null; } public boolean exe_business() { @@ -386,6 +404,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme public synchronized boolean finish_instruction() throws Exception { instructionService.finish(inst); +// requireSucess = false; return true; } @@ -436,6 +455,16 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme mode = "待机"; } else if (this.getMode() == 3) { mode = "运行中"; + } else if (this.getMode() == 4) { + mode = "申请捆扎中"; + } else if (this.getMode() == 5) { + mode = "申请贴标中"; + } else if (this.getMode() == 6) { + mode = "申请空盘入库中"; + } else if (this.getMode() == 7) { + mode = "申请空盘出库中"; + } else if (this.getMode() == 8) { + mode = "申请AGV任务中"; } if (this.getMove() == 0) { @@ -474,7 +503,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme String requestSucess = data.getString("requireSucess"); if (StrUtil.equals(requestSucess, "0")) { this.requireSucess = false; - } else { + } else if(StrUtil.equals(requestSucess, "1")) { this.requireSucess = true; } } @@ -510,26 +539,66 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } else { this.instruction_require_time = date; //container_code - TaskDto task = taskserver.findByStartCodeAndReady(device_code); - if (!ObjectUtil.isEmpty(task)) { + TaskDto taskdto = taskserver.findByStartCodeAndReady(device_code); + if (!ObjectUtil.isEmpty(taskdto)) { // if (!ObjectUtils.isEmpty(instructionService.findByBarcodeFromCache(container_code))) { // return false; // } - String taskid = task.getTask_id(); - String taskcode = task.getTask_code(); - String vehiclecode = task.getVehicle_code(); - String priority = task.getPriority(); - String start_point_code = task.getStart_point_code(); - String start_device_code = task.getStart_device_code(); - String route_plan_code = task.getRoute_plan_code(); + + Instruction inst = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()); + if(ObjectUtil.isNotEmpty(inst)){ + List list = new ArrayList(); + Map map = new HashMap(); + + if(StrUtil.isNotEmpty(taskdto.getTo_z())){ + if(StrUtil.equals(taskdto.getTo_z(),"01")){ + map.put("code","to_target"); + map.put("value","102"); + } else if(StrUtil.equals(taskdto.getTo_z(),"02")){ + map.put("code","to_target"); + map.put("value","201"); + } else if(StrUtil.equals(taskdto.getTo_z(),"03")){ + map.put("code","to_target"); + map.put("value","301"); + } + } + list.add(map); + Map map2 = new HashMap(); + map2.put("code","to_task"); + map2.put("value",inst.getInstruction_code()); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code","to_command"); + map3.put("value","1"); + list.add(map3); + this.writing(list); + if( task != Integer.parseInt(inst.getInstruction_code())){ + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); + } + message = "下发电气任务号成功"; + requireSucess = true; + return true; + } + + if(!StrUtil.equals(taskdto.getTask_type(),"5")){ + return false; + } + String taskid = taskdto.getTask_id(); + String taskcode = taskdto.getTask_code(); + String vehiclecode = taskdto.getVehicle_code(); + String priority = taskdto.getPriority(); + String start_point_code = taskdto.getStart_point_code(); + String start_device_code = taskdto.getStart_device_code(); + String route_plan_code = taskdto.getRoute_plan_code(); String next_device_code = ""; /** * 开始平均分配 */ - String this_coevice_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code()); + String this_coevice_code = taskserver.queryAssignedByDevice(device_code, taskdto.getNext_device_code()); if (StrUtil.isEmpty(this_coevice_code)) { - List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code); + List shortPathsList = routeLineService.getShortPathLines(start_device_code, taskdto.getNext_device_code(), route_plan_code); RouteLineDto routeLineDto = shortPathsList.get(0); String path = routeLineDto.getPath(); @@ -560,16 +629,16 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code); String next_point_code; if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) { - next_point_code = task.getTo_x() + "-" + task.getTo_y() + "-" + task.getTo_z(); + next_point_code = taskdto.getTo_x() + "-" + taskdto.getTo_y() + "-" + taskdto.getTo_z(); } else { next_point_code = next_device_code; } Instruction instdto = new Instruction(); instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setRoute_plan_code(route_plan_code); - instdto.setRemark(task.getRemark()); - instdto.setMaterial(task.getMaterial()); - instdto.setQuantity(task.getQuantity()); + instdto.setRemark(taskdto.getRemark()); + instdto.setMaterial(taskdto.getMaterial()); + instdto.setQuantity(taskdto.getQuantity()); instdto.setTask_id(taskid); instdto.setTask_code(taskcode); instdto.setVehicle_code(vehiclecode); @@ -585,8 +654,8 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme instdto.setExecute_device_code(start_point_code); instructionService.create(instdto); //创建指令后修改任务状态 - task.setTask_status("1"); - taskserver.update(task); + taskdto.setTask_status("1"); + taskserver.update(taskdto); requireSucess = true; String next_addr = nextdevice.getExtraValue().get("address").toString(); @@ -604,9 +673,19 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme map3.put("value","1"); list.add(map3); this.writing(list); - + if( task != Integer.parseInt(inst.getInstruction_code())){ + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); + } } else { Instruction inst = instructionService.findByDeviceCodeFromCache(this.device_code); + if(ObjectUtil.isEmpty(inst)){ + return false; + } + //当起点为行架任务的时候不需要请求下发 + if(StrUtil.equals(inst.getInstruction_type(),"6")){ + return false; + } Device nextdevice = deviceAppservice.findDeviceByCode(inst.getNext_device_code()); String next_addr = nextdevice.getExtraValue().get("address").toString(); @@ -624,7 +703,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme map3.put("value","1"); list.add(map3); this.writing(list); - + if( task != Integer.parseInt(inst.getInstruction_code())){ + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", inst.getInstruction_code() + "再次下发电气信号"); + } } return true; } @@ -665,16 +747,18 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); if(applyLabelingAndBindingResponse.getstatus() == 200){ + message ="申请贴标成功"; List list = new ArrayList(); Map map = new HashMap(); map.put("code","to_command"); map.put("value","5"); list.add(map); this.writing(list); - message ="申请贴标成功"; + this.writing(list); + message ="申请贴标下发电气信号成功"; requireApplyLabelingSuccess = true; } else { - message = applyLabelingAndBindingResponse.getMessage(); + message = "申请贴标失败,"+applyLabelingAndBindingResponse.getMessage(); } } } @@ -742,6 +826,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme map5.put("value","4"); list.add(map5); this.writing(list); + this.writing(list); message ="申请贴标成功"; requireApplyLaStrangulationSuccess = true; } else { @@ -764,20 +849,51 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme this.require_empty_in_time = date; if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - message = "申请任务中..."; + message = "申请空盘入库任务中..."; JSONObject apply = new JSONObject(); apply.put("device_code", device_code); apply.put("type","2"); String str = acsToWmsService.applyTaskToWms(apply); JSONObject jo = JSON.parseObject(str); if (ObjectUtil.isEmpty(jo)) { - message = "接口不通"; + message = "申请空盘入库接口不通"; } else { if (jo.getInteger("status") == 200) { + message = "申请空盘入库成功"; requireEmptyInSuccess = true; } else { requireEmptyInSuccess = false; - message = jo.get("message").toString(); + message = "申请空盘入库失败,"+jo.get("message").toString(); + } + } + + } + } + } + + public synchronized void applyAgvTask() { + Date date = new Date(); + if (date.getTime() - this.require_empty_out_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return; + } else { + this.require_empty_out_time = date; + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + message = "申请AGV搬运任务中..."; + JSONObject apply = new JSONObject(); + apply.put("device_code", device_code); + apply.put("type","4"); + String str = acsToWmsService.applyTaskToWms(apply); + JSONObject jo = JSON.parseObject(str); + if (ObjectUtil.isEmpty(jo)) { + message = "申请AGV搬运任务接口不通"; + } else { + if (jo.getInteger("status") == 200) { + message = "申请AGV搬运任务成功"; + requireEmptyOutSuccess = true; + } else { + requireEmptyOutSuccess = false; + message = "申请AGV搬运任务失败,"+jo.get("message").toString(); } } @@ -793,20 +909,21 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } else { this.require_empty_out_time = date; if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { - message = "申请任务中..."; + message = "申请空盘出库任务中..."; JSONObject apply = new JSONObject(); apply.put("device_code", device_code); apply.put("type","3"); String str = acsToWmsService.applyTaskToWms(apply); JSONObject jo = JSON.parseObject(str); if (ObjectUtil.isEmpty(jo)) { - message = "接口不通"; + message = "申请空盘出库接口不通"; } else { if (jo.getInteger("status") == 200) { + message = "申请空盘出库成功"; requireEmptyOutSuccess = true; } else { requireEmptyOutSuccess = false; - message = jo.get("message").toString(); + message = "申请空盘出库失败,"+jo.get("message").toString(); } } @@ -815,5 +932,4 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } - } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/ItemProtocol.java index 93caf7e29..2ca2c067a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/ItemProtocol.java @@ -174,5 +174,10 @@ public class ItemProtocol { return list; } + @Override + public String toString() { + return ""; + } + } 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 da555b082..bed1501d9 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 @@ -970,19 +970,66 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl Device nextDevice = deviceAppservice.findDeviceByCode(next_device_code); String start_addr = startDevice.getExtraValue().get("address").toString(); String next_addr = nextDevice.getExtraValue().get("address").toString(); + List list = new ArrayList(); if (StrUtil.equals(type, "1")) { - this.writing("to_onset1", start_addr); - this.writing("to_target1", next_addr); - this.writing("to_task1", dto.getInstruction_code()); - this.writing("to_command1", "1"); - this.writing("to_type", "1"); + Map map1 = new HashMap(); + map1.put("code","to_onset1"); + map1.put("value",start_addr); + list.add(map1); + Map map2 = new HashMap(); + map2.put("code","to_target1"); + map2.put("value",next_addr); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code","to_task1"); + map3.put("value",dto.getInstruction_code()); + list.add(map3); + Map map4 = new HashMap(); + map4.put("code","to_type"); + map4.put("value","1"); + list.add(map4); + Map map5 = new HashMap(); + map5.put("code","to_command1"); + map5.put("value","1"); + list.add(map5); + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发前工位任务"); + +// this.writing("to_onset1", start_addr); +// this.writing("to_target1", next_addr); +// this.writing("to_task1", dto.getInstruction_code()); +// this.writing("to_command1", "1"); +// this.writing("to_type", "1"); this.setNow_steps_type1(2); } else if (StrUtil.equals(type, "2")) { - this.writing("to_onset2", start_addr); - this.writing("to_target2", next_addr); - this.writing("to_task2", dto.getInstruction_code()); - this.writing("to_command2", "1"); - this.writing("to_type", "2"); + Map map1 = new HashMap(); + map1.put("code","to_onset2"); + map1.put("value",start_addr); + list.add(map1); + Map map2 = new HashMap(); + map2.put("code","to_target2"); + map2.put("value",next_addr); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code","to_task2"); + map3.put("value",dto.getInstruction_code()); + list.add(map3); + Map map4 = new HashMap(); + map4.put("code","to_type"); + map4.put("value","2"); + list.add(map4); + Map map5 = new HashMap(); + map5.put("code","to_command2"); + map5.put("value","1"); + list.add(map5); + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发后工位任务"); + +// this.writing("to_onset2", start_addr); +// this.writing("to_target2", next_addr); +// this.writing("to_task2", dto.getInstruction_code()); +// this.writing("to_command2", "1"); +// this.writing("to_type", "2"); this.setNow_steps_type2(2); } else if (StrUtil.equals(type, "3")) { String start_device_code2 = dto.getStart_device_code2(); @@ -991,17 +1038,65 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl Device nextDevice2 = deviceAppservice.findDeviceByCode(next_device_code2); String start_addr2 = startDevice2.getExtraValue().get("address").toString(); String next_addr2 = nextDevice2.getExtraValue().get("address").toString(); - this.writing("to_onset1", start_addr2); - this.writing("to_target1", next_addr2); - this.writing("to_task1", dto.getInstruction_code()); - this.writing("to_command1", "1"); - this.writing("to_onset2", start_addr); - this.writing("to_target2", next_addr); - this.writing("to_task2", dto.getInstruction_code()); - this.writing("to_command2", "1"); - this.writing("to_type", "3"); + + + Map map1 = new HashMap(); + map1.put("code","to_onset1"); + map1.put("value",start_addr2); + list.add(map1); + Map map2 = new HashMap(); + map2.put("code","to_target1"); + map2.put("value",next_addr2); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code","to_task1"); + map3.put("value",dto.getInstruction_code()); + list.add(map3); + Map map4 = new HashMap(); + map4.put("code","to_onset2"); + map4.put("value",start_addr); + list.add(map4); + Map map5 = new HashMap(); + map5.put("code","to_target2"); + map5.put("value",next_addr); + list.add(map5); + Map map6 = new HashMap(); + map6.put("code","to_task2"); + map6.put("value",dto.getInstruction_code()); + list.add(map6); + Map map7 = new HashMap(); + map7.put("code","to_type"); + map7.put("value","3"); + list.add(map7); + Map map8 = new HashMap(); + map8.put("code","to_command1"); + map8.put("value","1"); + list.add(map8); + Map map9 = new HashMap(); + map9.put("code","to_command2"); + map9.put("value","1"); + list.add(map9); + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "下发双工位任务"); + + +// this.writing("to_onset1", start_addr2); +// this.writing("to_target1", next_addr2); +// this.writing("to_task1", dto.getInstruction_code()); +// this.writing("to_command1", "1"); +// this.writing("to_onset2", start_addr); +// this.writing("to_target2", next_addr); +// this.writing("to_task2", dto.getInstruction_code()); +// this.writing("to_command2", "1"); +// this.writing("to_type", "3"); this.setNow_steps_type3(2); } + + if(task1 != Integer.parseInt(dto.getInstruction_code()) || task2 != Integer.parseInt(dto.getInstruction_code()) ){ + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", dto.getInstruction_code() + "再次下发电气信号"); + } + } //判断点位是否设置电气值 @@ -1093,6 +1188,25 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl ReadUtil.write(itemMap, server); } + public void writing(List list) { + + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + for (int i = 0; i < list.size(); i++) { + Object ob = list.get(i); + JSONObject json = (JSONObject) JSONObject.toJSON(ob); + if (!StrUtil.isEmpty(json.getString("value"))) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + json.getString("code"); + itemMap.put(to_param, json.getString("value")); + } + } + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); + ReadUtil.write(itemMap, server); + } + + //将扩展表中的字符串数组数据转换成集合 public List getExtraDeviceCodes(String extraName) { String extraValue = (String) this.getDevice().getExtraValue().get(extraName); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/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 8ff22d693..087162f8c 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 @@ -276,10 +276,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe map.put("code","to_target"); map.put("value","0"); list.add(map); -// Map map2 = new HashMap(); -// map2.put("code","to_task"); -// map2.put("value","0"); -// list.add(map2); + Map map2 = new HashMap(); + map2.put("code","to_task"); + map2.put("value","0"); + list.add(map2); Map map3 = new HashMap(); map3.put("code","to_command"); map3.put("value","0"); @@ -440,26 +440,63 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe } else { this.instruction_require_time = date; //container_code - TaskDto task = taskserver.findByContainer(container_code); - if (!ObjectUtil.isEmpty(task)) { - if (!ObjectUtils.isEmpty(instructionService.findByBarcodeFromCache(container_code))) { - return false; + TaskDto taskdto = taskserver.findByContainer(container_code); + if (!ObjectUtil.isEmpty(taskdto)) { + if (!ObjectUtils.isEmpty(instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()))) { + Instruction instdto = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()); + if (ObjectUtil.isNotEmpty(instdto)) { + List list = new ArrayList(); + Map map = new HashMap(); + + if (StrUtil.isNotEmpty(taskdto.getTo_z())) { + if (StrUtil.equals(taskdto.getTo_z(), "01")) { + map.put("code", "to_target"); + map.put("value", "102"); + } else if (StrUtil.equals(taskdto.getTo_z(), "02")) { + map.put("code", "to_target"); + map.put("value", "201"); + } else if (StrUtil.equals(taskdto.getTo_z(), "03")) { + map.put("code", "to_target"); + map.put("value", "301"); + } + } + list.add(map); + Map map2 = new HashMap(); + map2.put("code", "to_task"); + map2.put("value", instdto.getInstruction_code()); + list.add(map2); + Map map3 = new HashMap(); + map3.put("code", "to_command"); + map3.put("value", "1"); + list.add(map3); + this.writing(list); + message = "下发电气任务号成功"; + if(task != Integer.parseInt(instdto.getInstruction_code()) ){ + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发电气信号"); + } + requireSucess = true; + applySucess = true; + } else { + message = "任务号:" + taskdto.getTask_code() + "未找到指令"; + } + return true; } - String taskid = task.getTask_id(); - String taskcode = task.getTask_code(); - String vehiclecode = task.getVehicle_code(); - String priority = task.getPriority(); - String start_point_code = task.getStart_point_code(); - String start_device_code = task.getStart_device_code(); - String route_plan_code = task.getRoute_plan_code(); + String taskid = taskdto.getTask_id(); + String taskcode = taskdto.getTask_code(); + String vehiclecode = taskdto.getVehicle_code(); + String priority = taskdto.getPriority(); + String start_point_code = taskdto.getStart_point_code(); + String start_device_code = taskdto.getStart_device_code(); + String route_plan_code = taskdto.getRoute_plan_code(); String next_device_code = ""; /** * 开始平均分配 */ - String this_coevice_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code()); + String this_coevice_code = taskserver.queryAssignedByDevice(device_code, taskdto.getNext_device_code()); if (StrUtil.isEmpty(this_coevice_code)) { - List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code); + List shortPathsList = routeLineService.getShortPathLines(start_device_code, taskdto.getNext_device_code(), route_plan_code); RouteLineDto routeLineDto = shortPathsList.get(0); String path = routeLineDto.getPath(); @@ -490,16 +527,16 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe Device nextdevice = deviceAppservice.findDeviceByCode(next_device_code); String next_point_code; if (StrUtil.equals(deviceAppservice.findDeviceTypeByCode(next_device_code), "storage")) { - next_point_code = task.getTo_x() + "-" + task.getTo_y() + "-" + task.getTo_z(); + next_point_code = taskdto.getTo_x() + "-" + taskdto.getTo_y() + "-" + taskdto.getTo_z(); } else { next_point_code = next_device_code; } Instruction instdto = new Instruction(); instdto.setInstruction_id(IdUtil.simpleUUID()); instdto.setRoute_plan_code(route_plan_code); - instdto.setRemark(task.getRemark()); - instdto.setMaterial(task.getMaterial()); - instdto.setQuantity(task.getQuantity()); + instdto.setRemark(taskdto.getRemark()); + instdto.setMaterial(taskdto.getMaterial()); + instdto.setQuantity(taskdto.getQuantity()); instdto.setTask_id(taskid); instdto.setTask_code(taskcode); instdto.setVehicle_code(vehiclecode); @@ -515,21 +552,21 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe instdto.setExecute_device_code(start_point_code); instructionService.create(instdto); //创建指令后修改任务状态 - task.setTask_status("1"); - taskserver.update(task); + taskdto.setTask_status("1"); + taskserver.update(taskdto); List list = new ArrayList(); Map map = new HashMap(); - if(StrUtil.isNotEmpty(task.getTo_z())){ - if(StrUtil.equals(task.getTo_z(),"01")){ + if(StrUtil.isNotEmpty(taskdto.getTo_z())){ + if(StrUtil.equals(taskdto.getTo_z(),"01")){ map.put("code","to_target"); map.put("value","102"); - } else if(StrUtil.equals(task.getTo_z(),"02")){ + } else if(StrUtil.equals(taskdto.getTo_z(),"02")){ map.put("code","to_target"); map.put("value","201"); - } else if(StrUtil.equals(task.getTo_z(),"03")){ + } else if(StrUtil.equals(taskdto.getTo_z(),"03")){ map.put("code","to_target"); map.put("value","301"); } @@ -544,7 +581,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe map3.put("value","1"); list.add(map3); this.writing(list); - + if(task != Integer.parseInt(instdto.getInstruction_code()) ){ + this.writing(list); + logServer.deviceExecuteLog(device_code, "", "", instdto.getInstruction_code() + "再次下发电气信号"); + } requireSucess = true; applySucess = true; } else { @@ -624,7 +664,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe } else if (this.getMode() == 3) { mode = "运行中"; } - if (this.getAction() == 0) { action = "禁止取放"; } else if (this.getAction() == 1) { @@ -634,8 +673,6 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe } else if (this.getAction() == 3) { action = "允许取放"; } - - if (this.getMove() == 0) { move = "无货"; jo.put("hasGoods", false); 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 1032de1c8..2e1fe6208 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 @@ -231,8 +231,8 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("countdown_house", hongXiangConveyorDeviceDriver.getCountdown_house()); jo.put("countdown_min", hongXiangConveyorDeviceDriver.getCountdown_min()); jo.put("countdown_sec", hongXiangConveyorDeviceDriver.getCountdown_sec()); - //温度需要除以100 待实现 - jo.put("temperature", hongXiangConveyorDeviceDriver.getTemperature()); + //温度需要除以10 + jo.put("temperature", hongXiangConveyorDeviceDriver.getTemperature()/10); jo.put("door", hongXiangConveyorDeviceDriver.getDoor()); jo.put("finish", hongXiangConveyorDeviceDriver.getFinish()); jo.put("task", hongXiangConveyorDeviceDriver.getTask()); @@ -532,15 +532,15 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } JSONObject start_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + start_device_code2 + "'").uniqueResult(0); if (!ObjectUtil.isEmpty(start_device_json2)) { - start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_device_code2 : (String) start_device_json.get("storage_code"); + start_point_code2 = (String) start_device_json2.get("parent_storage_code") == null ? start_device_code2 : (String) start_device_json2.get("storage_code"); } JSONObject next_device_json2 = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + next_device_code2 + "'").uniqueResult(0); if (!ObjectUtil.isEmpty(next_device_json2)) { - next_point_code2 = (String) next_device_json2.get("parent_storage_code") == null ? next_device_code2 : (String) next_device_json.get("storage_code"); + next_point_code2 = (String) next_device_json2.get("parent_storage_code") == null ? next_device_code2 : (String) next_device_json2.get("storage_code"); } JSONObject put_device_json = WQLObject.getWQLObject("acs_storage_cell").query("parent_storage_code ='" + put_device_code + "'").uniqueResult(0); if (!ObjectUtil.isEmpty(put_device_json)) { - put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) next_device_json.get("storage_code"); + put_point_code = (String) put_device_json.get("parent_storage_code") == null ? put_device_code : (String) put_device_json.get("storage_code"); } if (StrUtil.isNotEmpty(start_point_code) && start_point_code.indexOf("-") > 0) { String str[] = start_point_code.split("-"); @@ -707,11 +707,16 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } if (ObjectUtil.isEmpty(errArr)) { response.setStatus(200); + response.setMessage("success"); } else { response.setStatus(400); + if(ObjectUtil.isNotEmpty(errArr)){ + response.setMessage(errArr.getJSONObject(0).getString("message")); + } else { + response.setMessage("false"); + } + response.setErrArr(errArr); } - response.setMessage("success"); - response.setErrArr(errArr); log.info("createFromWms--------------:输出参数:" + JSON.toJSONString(response)); return response; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 40eeb25ce..8be54f0b5 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -760,7 +760,6 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu } @Override - @Transactional(rollbackFor = Exception.class) public void finishAndCreateNextInst(Instruction dto) throws Exception { dto = foramte(dto); String device_code = dto.getNext_device_code(); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/opc/OpcUtl.java b/acs/nladmin-system/src/main/java/org/nl/acs/opc/OpcUtl.java index ae20e876c..4838fc4dc 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/opc/OpcUtl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/opc/OpcUtl.java @@ -50,6 +50,7 @@ public class OpcUtl { if (!is_success) { // throw new BusinessException(message.toString()); + System.out.println("下发信号失败:"+message.toString()); } } catch (JIException arg7) { // throw new BusinessException(arg7); diff --git a/acs/nladmin-ui/.env.production b/acs/nladmin-ui/.env.production index 762ac12e7..9be6cbabb 100644 --- a/acs/nladmin-ui/.env.production +++ b/acs/nladmin-ui/.env.production @@ -2,6 +2,6 @@ ENV = 'production' # 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置 # 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http -VUE_APP_BASE_API = 'http://127.0.0.1:8010' +VUE_APP_BASE_API = 'http://10.1.3.90:8011' # 如果接口是 http 形式, wss 需要改为 ws -VUE_APP_WS_API = 'ws://127.0.0.1:8010' +VUE_APP_WS_API = 'ws://10.1.3.90:8011' diff --git a/acs/nladmin-ui/public/config.js b/acs/nladmin-ui/public/config.js index c4d32ea74..9c71a3a38 100644 --- a/acs/nladmin-ui/public/config.js +++ b/acs/nladmin-ui/public/config.js @@ -3,7 +3,7 @@ window.g = { VUE_APP_BASE_API: 'http://127.0.0.1:8010' }, prod: { - VUE_APP_BASE_API: 'http://127.0.0.1:8010' + VUE_APP_BASE_API: 'http://10.1.3.90:8011' } diff --git a/acs/nladmin-ui/src/views/acs/history/taskTreeRecord/index.vue b/acs/nladmin-ui/src/views/acs/history/taskTreeRecord/index.vue index da57075a1..ac8fd5113 100644 --- a/acs/nladmin-ui/src/views/acs/history/taskTreeRecord/index.vue +++ b/acs/nladmin-ui/src/views/acs/history/taskTreeRecord/index.vue @@ -99,6 +99,8 @@ + + From 6aa282f3aed15e3144cb81e4dfb0a3e6f5a33df8 Mon Sep 17 00:00:00 2001 From: liuxy Date: Wed, 18 Jan 2023 21:59:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/wms/st/outbill/DivDialog.vue | 22 ++++++++++++++++++- .../src/views/wms/st/outbill/index.vue | 6 +++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue b/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue index bc86fc2c0..d34361475 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/DivDialog.vue @@ -40,6 +40,7 @@ { this.crud.notify('分配成功!', CRUD.NOTIFICATION_TYPE.INFO) this.queryTableDtl() + this.loadingAlldiv = false + }).catch(() => { + this.loadingAlldiv = false }) }, oneDiv() { @@ -488,10 +499,14 @@ export default { // this.crud.notify('请先选择库区!', CRUD.NOTIFICATION_TYPE.INFO) // return // } + this.loadingAutodiv = true if (this.currentRow.iostorinvdtl_id !== null) { this.mstrow.iostorinvdtl_id = this.currentRow.iostorinvdtl_id checkoutbill.allDivOne(this.mstrow).then(res => { this.queryTableDtl() + this.loadingAutodiv = false + }).catch(() => { + this.loadingAutodiv = false }) } }, @@ -563,18 +578,20 @@ export default { this.crud.notify('任务已生成!', CRUD.NOTIFICATION_TYPE.INFO) return } + this.loadingSetPoint = true if (this.currentDis.iostorinvdis_id !== null) { this.currentDis.point_code = this.form2.point_code checkoutbill.oneSetPoint2(this.currentDis).then(res => { this.queryTableDdis(this.currentDis.iostorinvdtl_id) this.crud.notify('设置成功!', CRUD.NOTIFICATION_TYPE.INFO) + this.loadingSetPoint = false }).catch(() => { this.currentDis.point_code = '' + this.loadingSetPoint = false }) } }, allSetPoint() { - debugger if (this.form2.point_code === '') { this.crud.notify('请先选择站点!', CRUD.NOTIFICATION_TYPE.INFO) return @@ -583,11 +600,14 @@ export default { this.crud.notify('请选择明细!', CRUD.NOTIFICATION_TYPE.INFO) return } + this.loadingSetAllPoint = true this.currentRow.point_code = this.form2.point_code checkoutbill.allSetPoint(this.currentRow).then(res => { this.queryTableDdis(this.currentRow.iostorinvdtl_id) this.crud.notify('设置成功!', CRUD.NOTIFICATION_TYPE.INFO) + this.loadingSetAllPoint = false }).catch(() => { + this.loadingSetAllPoint = false }) }, queryTableDtl() { diff --git a/lms/nladmin-ui/src/views/wms/st/outbill/index.vue b/lms/nladmin-ui/src/views/wms/st/outbill/index.vue index 2f0e1acd6..0b26fe32b 100644 --- a/lms/nladmin-ui/src/views/wms/st/outbill/index.vue +++ b/lms/nladmin-ui/src/views/wms/st/outbill/index.vue @@ -195,6 +195,7 @@ { this.querytable() this.crud.notify('出库成功!', CRUD.NOTIFICATION_TYPE.SUCCESS) + this.loadingConfirm = false + }).catch(() => { + this.loadingConfirm = false }) }, querytable() {