From 0ca256d734fd466f00781c2c73858eb1a91a2a5b Mon Sep 17 00:00:00 2001 From: lishuai <1793460677@qq.com> Date: Tue, 16 Jan 2024 13:42:10 +0800 Subject: [PATCH] =?UTF-8?q?add=EF=BC=9A=20=E6=9C=A8=E7=AE=B1=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E3=80=81=E8=A3=85=E7=AE=B1=E5=85=A5=E5=BA=93=E3=80=81?= =?UTF-8?q?=E7=A9=BA=E6=9C=A8=E7=AE=B1=E5=87=BA=E5=BA=93=E9=A9=B1=E5=8A=A8?= =?UTF-8?q?=E5=BC=80=E5=8F=91=EF=BC=88=E5=90=8E=E7=AB=AF=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DeviceServiceImpl.java | 2 +- .../BoxSubvolumesConveyorDefination.java | 8 ++-- .../BoxSubvolumesConveyorDeviceDriver.java | 5 +-- .../box_subvolumes_conveyor/ItemProtocol.java | 6 +-- ...ConveyorWithScannerWeightDeviceDriver.java | 41 ++++++++++++++++++- .../BoxPackageManipulatorDeviceDriver.java | 5 +-- .../BoxStorageManipulatorDefination.java | 2 +- .../BoxStorageManipulatorDeviceDriver.java | 5 +-- .../org/nl/acs/enums/StorageTypeEnum.java | 26 +++++++++++- .../task/service/impl/TaskServiceImpl.java | 2 +- 10 files changed, 81 insertions(+), 21 deletions(-) diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index bc2c1e0..d444d99 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -1367,6 +1367,7 @@ public class DeviceServiceImpl extends CommonServiceImpl i @Override public JSONObject queryDriverConfigByDeviceId(String device_id, String driver_code) { final JSONObject extraObj = new JSONObject(); + DeviceDto dto = this.findById(device_id); if (ObjectUtil.isNull(dto)) { return new JSONObject(); @@ -1386,7 +1387,6 @@ public class DeviceServiceImpl extends CommonServiceImpl i } -// JSONArray arr = WQLObject.getWQLObject("acs_device_extra").query("filed_type ='01' and device_id = '" + device_id + "'").getResultJSONArray(0); List deviceExtraList = new LambdaQueryChainWrapper<>(deviceExtraMapper) .eq(DeviceExtra::getDevice_id, device_id) .eq(DeviceExtra::getFiled_type, "01") diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDefination.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDefination.java index 59c4dc5..a6b8444 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDefination.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDefination.java @@ -1,4 +1,4 @@ -package org.nl.acs.device_driver.one_conveyor.box_out_subvolumes_conveyor; +package org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; import org.nl.acs.device.domain.Device; @@ -16,7 +16,7 @@ import java.util.List; * */ @Service -public class BoxOutSubvolumesConveyorDefination implements OpcDeviceDriverDefination { +public class BoxSubvolumesConveyorDefination implements OpcDeviceDriverDefination { @Override public String getDriverCode() { return "box_out_subvolumes_conveyor"; @@ -34,13 +34,13 @@ public class BoxOutSubvolumesConveyorDefination implements OpcDeviceDriverDefina @Override public DeviceDriver getDriverInstance(Device device) { - return (new BoxOutSubvolumesConveyorDeviceDriver()).setDevice(device).setDriverDefination(this); + return (new BoxSubvolumesConveyorDeviceDriver()).setDevice(device).setDriverDefination(this); } @Override public Class getDeviceDriverType() { - return BoxOutSubvolumesConveyorDeviceDriver.class; + return BoxSubvolumesConveyorDeviceDriver.class; } @Override diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java index 022338b..4fcb21d 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/BoxSubvolumesConveyorDeviceDriver.java @@ -1,4 +1,4 @@ -package org.nl.acs.device_driver.one_conveyor.box_out_subvolumes_conveyor; +package org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; @@ -20,7 +20,6 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.ext.wms.service.AcsToWmsService; 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.domain.Instruction; import org.nl.acs.instruction.service.InstructionService; @@ -44,7 +43,7 @@ import java.util.concurrent.ThreadPoolExecutor; @Slf4j @Data @RequiredArgsConstructor -public class BoxOutSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { +public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll(); protected ItemProtocol itemProtocol = new ItemProtocol(this); InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/ItemProtocol.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/ItemProtocol.java index d0a1c34..56a2e5c 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/ItemProtocol.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/box_subvolumes_conveyor/ItemProtocol.java @@ -1,4 +1,4 @@ -package org.nl.acs.device_driver.one_conveyor.box_out_subvolumes_conveyor; +package org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor; import cn.hutool.core.util.StrUtil; import lombok.Data; @@ -72,14 +72,14 @@ public class ItemProtocol { - private BoxOutSubvolumesConveyorDeviceDriver driver; + private BoxSubvolumesConveyorDeviceDriver driver; public int getContainer_type() { return this.getOpcIntegerValue(item_container_type); } - public ItemProtocol(BoxOutSubvolumesConveyorDeviceDriver driver) { + public ItemProtocol(BoxSubvolumesConveyorDeviceDriver driver) { this.driver = driver; } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java index 394ff8d..4e2ae9d 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_conveyor/scanner_weight_conveyor/ConveyorWithScannerWeightDeviceDriver.java @@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpResponse; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -18,6 +19,8 @@ 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; +import org.nl.acs.enums.StorageTypeEnum; +import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; @@ -59,6 +62,8 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class); + AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsService.class); + //工作模式 int mode = 0; int last_mode = 0; @@ -224,6 +229,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv if (error != last_error) { //存在报警信号,则下发去异常处理位的任务 + applyErrorTask(); logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); logServer.deviceExecuteLog(this.device_code, "", "", "信号error:" + last_error + "->" + error); @@ -259,7 +265,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv List toInstructions; //木箱入库申请入库任务 if (mode == 6 && !requireSucess){ - + applyIn(); } //申请任务 @@ -312,6 +318,38 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv last_barcode = barcode; } + private void applyErrorTask() { + try { + JSONObject param = new JSONObject(); + param.put("device_code", device_code); + param.put("vehicle_code", barcode); + param.put("type", StorageTypeEnum.ERROR.getType()); + logServer.deviceExecuteLog(this.device_code, "", "", "木箱入库申请入库任务,参数:" + param); + HttpResponse response = acsToWmsService.shipDeviceUpdate(param); + if (response == null || response.getStatus() == 200) { + logServer.deviceExecuteLog(this.device_code, "", "", "木箱入库申请入库任务,接口返回:" + response.body()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void applyIn() { + try { + JSONObject param = new JSONObject(); + param.put("device_code", device_code); + param.put("vehicle_code", barcode); + param.put("type", StorageTypeEnum.STORAGE.getType()); + logServer.deviceExecuteLog(this.device_code, "", "", "木箱入库申请入库任务,参数:" + param); + HttpResponse response = acsToWmsService.shipDeviceUpdate(param); + if (response == null || response.getStatus() == 200) { + logServer.deviceExecuteLog(this.device_code, "", "", "木箱入库申请入库任务,接口返回:" + response.body()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + private void updateInstruct() { if (mode == 3 && task > 0) { Date date = new Date(); @@ -333,6 +371,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv } } } + } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java index cb75c1c..08a72cd 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_package_manipulator/BoxPackageManipulatorDeviceDriver.java @@ -16,10 +16,9 @@ import org.nl.acs.device.service.impl.DeviceExtraServiceImpl; 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.box_manipulator_site.BoxManipulatorSiteDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.device_driver.one_conveyor.box_out_subvolumes_conveyor.BoxOutSubvolumesConveyorDeviceDriver; +import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver; import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; @@ -369,7 +368,7 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } else { this.instruction_require_time = date; //找符合条件的任务 - BoxOutSubvolumesConveyorDeviceDriver boxOutSubvolumesConveyorDeviceDriver = new BoxOutSubvolumesConveyorDeviceDriver(); + BoxSubvolumesConveyorDeviceDriver boxOutSubvolumesConveyorDeviceDriver = new BoxSubvolumesConveyorDeviceDriver(); String deviceCode = boxOutSubvolumesConveyorDeviceDriver.getDevice_code(); TaskDto taskDto = taskserver.findByEndCodeAndReady(deviceCode, TaskTypeEnum.Box_Package.getIndex()); if (ObjectUtil.isNotEmpty(taskDto)) { diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDefination.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDefination.java index c947295..44b8be5 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDefination.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDefination.java @@ -14,7 +14,7 @@ import java.util.List; public class BoxStorageManipulatorDefination implements OpcDeviceDriverDefination { @Override public String getDriverCode() { - return "box_storage"; + return "box_storage_manipulator"; } @Override diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java index 62f00a6..b0b3293 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/one_manipulator/box_storage_manipulator/BoxStorageManipulatorDeviceDriver.java @@ -18,8 +18,7 @@ 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; -import org.nl.acs.device_driver.one_conveyor.box_out_subvolumes_conveyor.BoxOutSubvolumesConveyorDeviceDriver; -import org.nl.acs.device_driver.one_conveyor.box_storage_out_conveyor.BoxStorageOutConveyorDeviceDriver; +import org.nl.acs.device_driver.one_conveyor.box_subvolumes_conveyor.BoxSubvolumesConveyorDeviceDriver; import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.service.DeviceErrorLogService; import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; @@ -324,7 +323,7 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i } else { this.instruction_require_time = date; //找终点为入库输送线工位任务类型为行架的任务 - BoxOutSubvolumesConveyorDeviceDriver boxOutSubvolumesConveyorDeviceDriver = new BoxOutSubvolumesConveyorDeviceDriver(); + BoxSubvolumesConveyorDeviceDriver boxOutSubvolumesConveyorDeviceDriver = new BoxSubvolumesConveyorDeviceDriver(); String deviceCode = boxOutSubvolumesConveyorDeviceDriver.getDevice_code(); TaskDto taskDto = taskserver.findByEndCodeAndReady(deviceCode, TaskTypeEnum.Box_Storage.getIndex()); if (ObjectUtil.isNotEmpty(taskDto)) { diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/enums/StorageTypeEnum.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/enums/StorageTypeEnum.java index d1165cf..9700179 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/enums/StorageTypeEnum.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/enums/StorageTypeEnum.java @@ -1,2 +1,26 @@ -package org.nl.acs.enums;public enum StorageTypeEnum { +package org.nl.acs.enums; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.Getter; + + +@Getter +@AllArgsConstructor +public enum StorageTypeEnum { + STORAGE("1", "入库任务"), + + DISKS_IN("2", "空盘入库"), + + DISKS_OUT("3", "空盘出库"), + + ERROR("4", "异常处理位"); + /** + * 索引 + */ + private String type; + /** + * 编码 + */ + private String value; } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 6784b08..ee7b36e 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -490,7 +490,7 @@ public class TaskServiceImpl extends CommonServiceImpl impleme task_code = CodeUtil.getNewCode("TASK_NO"); task_code = CommonFinalParam.HYPHEN_ + task_code; } - String start_point_code = dto.getStart_point_code(); + String start_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();