From e984b95cf315c2f1628a5ae07ac3dfaf408ecab2 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:58:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=BE=88=E5=A4=9A?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../run/OneNDCSocketConnectionAutoRun.java | 2 + .../device/device_driver/DriverTypeEnum.java | 22 +--- .../agv/ndcone/AgvNdcOneDeviceDriver.java | 102 +++++++++++------- .../wms/service/wsdl/WmsToAcsWebService.java | 4 +- .../service/wsdl/WmsToAcsWebServiceImpl.java | 4 +- .../service/impl/InstructionServiceImpl.java | 12 +-- .../org/nl/acs/test/rest/TestController.java | 5 +- .../test/service/impl/TestServiceImpl.java | 60 ++++++++++- acs/nladmin-ui/src/views/acs/task/index.vue | 12 +-- 9 files changed, 138 insertions(+), 85 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 6c652f7..d19ff62 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 @@ -159,6 +159,8 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { inst.setAgv_jobno(String.valueOf(index)); inst.setSend_status("1"); instructionService.update(inst); + } else { + log.info("phase == 0x01 , 未找到指令号为" + ikey + "的指令"); } data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index d4f54e4..6cf2662 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -23,27 +23,7 @@ public enum DriverTypeEnum { AGV_NDC_ONE(7, "agv_ndc_one", "NDC1楼AGV", "agv"), - AGV_NDC_TWO(8, "agv_ndc_two", "NDC2楼AGV", "agv"), - - HONGXIANG_DEVICE(9, "hongxiang_device", "烘箱设备点位", "conveyor"), - - OVEN_MANIPULATOR(10, "oven_manipulator", "烘箱-行架机械手", "station"), - - SLIT_TWO_MANIPULATOR(11, "slit_two_manipulator", "分切双工位-行架机械手", "station"), - - BOX_PALLETIZING_MANIPULATOR(12, "box_palletizing_manipulator", "木箱码垛-行架机械手", "station"), - - SIEMENS_CONVEYOR(13, "siemens_conveyor", "西门子-输送机驱动", "conveyor"), - - HONGXIANG_CONVEYOR(13, "hongxiang_conveyor", "烘箱对接位", "conveyor"), - - INSPECT_CONVEYOR_CONTROL_WITH_SCANNER(14, "standard_conveyor_control_with_scanner", "标准版-输送机-控制点-关联扫码", "conveyor"), - - PLUG_PULL_DEVICE_SITE(15, "plug_pull_device_site", "插拔轴站点", "conveyor"), - - SIEMENS_CONVEYOR_LABELING(16, "siemens_conveyor_labeling", "西门子-输送机驱动-贴标", "conveyor"), - - SIEMENS_CONVEYOR_CKK(17, "siemens_conveyor_ckk", "西门子-输送机驱动-出库口", "conveyor"); + AGV_NDC_TWO(8, "agv_ndc_two", "NDC2楼AGV", "agv"); //驱动索引 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 e7646bc..83adf35 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 @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.AcsConfig; import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.auto.run.OneNDCSocketConnectionAutoRun; import org.nl.acs.device.service.DeviceService; @@ -128,16 +129,22 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic inst.setCarno(String.valueOf(carno)); instructionService.update(inst); logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + "反馈:" + data); - TaskDto task = SpringContextHolder.getBean(TaskService.class).findByCodeFromCache(inst.getTask_code()); - JSONObject request = new JSONObject(); - request.put("REQCODE", task.getTask_code()); - request.put("TASKCODE", task.getTask_code()); - request.put("PODCODE", task.getVehicle_code()); - request.put("TASKTYPE", task.getTask_type()); - request.put("METHOD", "1"); - request.put("AGVCODE", this.device_code); - request.put("REQTIME", DateUtil.now()); - new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(request.toJSONString()); + + String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); + if (StrUtil.equals(hasWms, "1")) { + TaskDto task = SpringContextHolder.getBean(TaskService.class).findByCodeFromCache(inst.getTask_code()); + if (!StrUtil.startWith(task.getTask_code(), "-")) { + JSONObject request = new JSONObject(); + request.put("REQCODE", task.getTask_code()); + request.put("TASKCODE", task.getTask_code()); + request.put("PODCODE", task.getVehicle_code()); + request.put("TASKTYPE", task.getTask_type()); + request.put("METHOD", "1"); + request.put("AGVCODE", this.device_code); + request.put("REQTIME", DateUtil.now()); + new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(request.toJSONString()); + } + } //到达取货点 //(需要WCS反馈) } else if (phase == 0x03) { @@ -197,16 +204,21 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); - TaskDto task = SpringContextHolder.getBean(TaskService.class).findByCodeFromCache(inst.getTask_code()); - JSONObject request = new JSONObject(); - request.put("REQCODE", task.getTask_code()); - request.put("TASKCODE", task.getTask_code()); - request.put("PODCODE", task.getVehicle_code()); - request.put("TASKTYPE", task.getTask_type()); - request.put("METHOD", "2"); - request.put("AGVCODE", this.device_code); - request.put("REQTIME", DateUtil.now()); - new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(request.toJSONString()); + String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); + if (StrUtil.equals(hasWms, "1")) { + TaskDto task = SpringContextHolder.getBean(TaskService.class).findByCodeFromCache(inst.getTask_code()); + if (!StrUtil.startWith(task.getTask_code(), "-")) { + JSONObject request = new JSONObject(); + request.put("REQCODE", task.getTask_code()); + request.put("TASKCODE", task.getTask_code()); + request.put("PODCODE", task.getVehicle_code()); + request.put("TASKTYPE", task.getTask_type()); + request.put("METHOD", "2"); + request.put("AGVCODE", this.device_code); + request.put("REQTIME", DateUtil.now()); + new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(request.toJSONString()); + } + } //取货完毕 //(需要WCS反馈) @@ -279,16 +291,21 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); - TaskDto task = SpringContextHolder.getBean(TaskService.class).findByCodeFromCache(inst.getTask_code()); - JSONObject request = new JSONObject(); - request.put("REQCODE", task.getTask_code()); - request.put("TASKCODE", task.getTask_code()); - request.put("PODCODE", task.getVehicle_code()); - request.put("TASKTYPE", task.getTask_type()); - request.put("METHOD", "3"); - request.put("AGVCODE", this.device_code); - request.put("REQTIME", DateUtil.now()); - new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(request.toJSONString()); + String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); + if (StrUtil.equals(hasWms, "1")) { + TaskDto task = SpringContextHolder.getBean(TaskService.class).findByCodeFromCache(inst.getTask_code()); + if (!StrUtil.startWith(task.getTask_code(), "-")) { + JSONObject request = new JSONObject(); + request.put("REQCODE", task.getTask_code()); + request.put("TASKCODE", task.getTask_code()); + request.put("PODCODE", task.getVehicle_code()); + request.put("TASKTYPE", task.getTask_type()); + request.put("METHOD", "3"); + request.put("AGVCODE", this.device_code); + request.put("REQTIME", DateUtil.now()); + new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(request.toJSONString()); + } + } //到达放货点 //(需要WCS反馈) @@ -341,16 +358,21 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); - TaskDto task = SpringContextHolder.getBean(TaskService.class).findByCodeFromCache(inst.getTask_code()); - JSONObject request = new JSONObject(); - request.put("REQCODE", task.getTask_code()); - request.put("TASKCODE", task.getTask_code()); - request.put("PODCODE", task.getVehicle_code()); - request.put("TASKTYPE", task.getTask_type()); - request.put("METHOD", "4"); - request.put("AGVCODE", this.device_code); - request.put("REQTIME", DateUtil.now()); - new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(request.toJSONString()); + String hasWms = paramService.findByCode(AcsConfig.HASWMS).getValue(); + if (StrUtil.equals(hasWms, "1")) { + TaskDto task = SpringContextHolder.getBean(TaskService.class).findByCodeFromCache(inst.getTask_code()); + if (!StrUtil.startWith(task.getTask_code(), "-")) { + JSONObject request = new JSONObject(); + request.put("REQCODE", task.getTask_code()); + request.put("TASKCODE", task.getTask_code()); + request.put("PODCODE", task.getVehicle_code()); + request.put("TASKTYPE", task.getTask_type()); + request.put("METHOD", "4"); + request.put("AGVCODE", this.device_code); + request.put("REQTIME", DateUtil.now()); + new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback(request.toJSONString()); + } + } //放货完毕 //(需要WCS反馈) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WmsToAcsWebService.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WmsToAcsWebService.java index 6df952c..ff06c0a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WmsToAcsWebService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WmsToAcsWebService.java @@ -6,7 +6,7 @@ import javax.jws.WebService; @WebService(targetNamespace = "http://service.mrxu.com/") public interface WmsToAcsWebService { - String createTask(@WebParam(name = "jsonStr") String jsonStr); + String rta_genAgvSchedulingTask(@WebParam(name = "jsonStr") String jsonStr); - String cancelTask(@WebParam(name = "jsonStr") String jsonStr); + String rta_cancelTask(@WebParam(name = "jsonStr") String jsonStr); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WmsToAcsWebServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WmsToAcsWebServiceImpl.java index 319f377..3ee0b58 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WmsToAcsWebServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WmsToAcsWebServiceImpl.java @@ -23,7 +23,7 @@ public class WmsToAcsWebServiceImpl implements WmsToAcsWebService { private final WmsToAcsService wmsToAcsService; @Override - public String createTask(String jsonStr) { + public String rta_genAgvSchedulingTask(String jsonStr) { CreateTaskResponse methodResult = wmsToAcsService.crateTask(jsonStr); JSONObject response = new JSONObject(); response.put("REQCODE", methodResult.getREQCODE()); @@ -35,7 +35,7 @@ public class WmsToAcsWebServiceImpl implements WmsToAcsWebService { } @Override - public String cancelTask(String jsonStr) { + public String rta_cancelTask(String jsonStr) { JSONObject result = new JSONObject(); JSONObject json = JSONObject.parseObject(jsonStr); if (ObjectUtil.isEmpty(json)) { 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 e2aa0ac..6cd6b4f 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 @@ -344,6 +344,7 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu // hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code())); // } + WQLObject wo = WQLObject.getWQLObject("acs_instruction"); try { String start_device_code = dto.getStart_device_code(); String next_device_code = dto.getNext_device_code(); @@ -364,6 +365,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu if (ObjectUtil.isEmpty(route)) { throw new BadRequestException("未查询到相关路由!"); } + JSONObject json = (JSONObject) JSONObject.toJSON(dto); + + wo.insert(json); + instructions.add(dto); if (StrUtil.equals(shortPathsList.get(0).getType(), "1")) { // 0为输送、立库任务 1 1楼叉车系统 2 2楼1区域AGV系统 3 2楼2区域AGV系统 if (!StrUtil.equals(task.getAgv_system_type(), "0") @@ -382,15 +387,10 @@ public class InstructionServiceImpl implements InstructionService, ApplicationAu } } catch (Exception e) { dto.setSend_status("2"); + wo.update((JSONObject) JSONObject.toJSON(dto)); e.printStackTrace(); log.error(""); } - - WQLObject wo = WQLObject.getWQLObject("acs_instruction"); - JSONObject json = (JSONObject) JSONObject.toJSON(dto); - - wo.insert(json); - instructions.add(dto); } @Override diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/test/rest/TestController.java b/acs/nladmin-system/src/main/java/org/nl/acs/test/rest/TestController.java index 2213e91..0405737 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/test/rest/TestController.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/test/rest/TestController.java @@ -39,14 +39,13 @@ public class TestController { @SaIgnore //@PreAuthorize("@el.check('task:add')") public ResponseEntity test1() throws IOException { - HttpHeaders headers = new HttpHeaders(); - headers.add(HttpHeaders.CONTENT_TYPE,"text/plain;charset=UTF-8"); - return new ResponseEntity<>(testService.test1(), headers, HttpStatus.CREATED); + return new ResponseEntity<>(testService.test1(), HttpStatus.CREATED); } @Log("test2") @ApiOperation("test2") @PostMapping("/test2") + @SaIgnore //@PreAuthorize("@el.check('task:add')") public ResponseEntity test2() throws IOException { testService.test2(); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/test/service/impl/TestServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/test/service/impl/TestServiceImpl.java index bf719e1..8ba6481 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/test/service/impl/TestServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/test/service/impl/TestServiceImpl.java @@ -2,11 +2,16 @@ package org.nl.acs.test.service.impl; +import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.DriverTypeEnum; +import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device.service.dto.DeviceDto; import org.nl.acs.test.service.TestService; import org.nl.acs.wsdl.org.tempuri.RTMSAGVSERVICE; +import org.nl.modules.wql.util.SpringContextHolder; import org.springframework.stereotype.Service; import java.io.IOException; @@ -21,18 +26,63 @@ import java.util.Map; @Service @RequiredArgsConstructor @Slf4j -public class TestServiceImpl implements TestService -{ +public class TestServiceImpl implements TestService { @Override public String test1() { - String s = new RTMSAGVSERVICE().getBasicHttpBindingIRTMSAGVSERVICE().atrAgvCallback("{}"); - return new String(s.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("address", ""); + jsonObject.put("device_type", "conveyor"); + jsonObject.put("device_type_name", "固定货台-Station"); + jsonObject.put("driver_code", ""); + jsonObject.put("is_route", "FALSE"); + jsonObject.put("region", "3"); + jsonObject.put("region_name", "货柜零部件交接区"); + DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); + for (int i = 3001, j = 35; i <= 3004; i++, j++) { + jsonObject.put("device_code", String.valueOf(i)); + jsonObject.put("device_name", String.valueOf(i)); + jsonObject.put("seq_num", j); + deviceService.create(jsonObject.toJavaObject(DeviceDto.class)); + } + return "success"; } @Override public void test2() throws IOException { - + JSONObject jsonObject = new JSONObject(); + jsonObject.put("form", new JSONObject() {{ + put("address", ""); + }}); + + JSONObject parentForm = new JSONObject(); + parentForm.put("address", ""); + parentForm.put("create_by", "admin"); + parentForm.put("create_time", DateUtil.now()); + parentForm.put("driver_code", DriverTypeEnum.ORDINARY_SITE.getCode()); + parentForm.put("is_active", "1"); + parentForm.put("is_config", "FALSE"); + parentForm.put("is_delete", "0"); + parentForm.put("is_route", false); + parentForm.put("manufacturer", ""); + parentForm.put("manufacturer_phone", ""); + parentForm.put("opc_plc_id", ""); + parentForm.put("opc_server_id", ""); + parentForm.put("remark", ""); + parentForm.put("update_by", "admin"); + parentForm.put("update_time", DateUtil.now()); + jsonObject.put("parentForm", parentForm); + DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); + for (int i = 3001; i <= 3004; i++) { + DeviceDto device = deviceService.findByCode(String.valueOf(i)); + parentForm.put("region", device.getRegion()); + parentForm.put("device_code", device.getDevice_code()); + parentForm.put("device_id", device.getDevice_id()); + parentForm.put("device_name", device.getDevice_name()); + parentForm.put("device_type", device.getDevice_type()); + parentForm.put("seq_num", device.getSeq_num()); + deviceService.updateConfig(jsonObject); + } } @Override diff --git a/acs/nladmin-ui/src/views/acs/task/index.vue b/acs/nladmin-ui/src/views/acs/task/index.vue index 7b7d4dd..1863262 100644 --- a/acs/nladmin-ui/src/views/acs/task/index.vue +++ b/acs/nladmin-ui/src/views/acs/task/index.vue @@ -97,7 +97,7 @@ - + - + - + --> - - + + @@ -491,7 +491,7 @@ export default { to_x: null, to_y: null, to_z: null, - agv_system_type: '' + agv_system_type: '1' }, rules: { start_point_code: [