From 9a821555c61491cec9be2f3eabc7fc646f359bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E4=BF=8A=E6=9D=B0?= <9463626+zhou-junjiezjj@user.noreply.gitee.com> Date: Thu, 1 Aug 2024 09:22:10 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E6=96=99=E4=BB=93=E7=9C=8B=E6=9D=BF?= =?UTF-8?q?=E5=92=8Clms=E4=BC=98=E5=85=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/device_driver/DriverTypeEnum.java | 4 +- .../lnsh/liao_cang/ItemProtocol.java | 255 +++++++++++++++ .../lnsh/liao_cang/LiaoCangDefination.java | 58 ++++ .../lnsh/liao_cang/LiaoCangDeviceDriver.java | 308 ++++++++++++++++++ .../nl/hand/amb/rest/HFHandController.java | 9 + .../nl/hand/amb/service/HFHandService.java | 11 + .../amb/service/impl/HFHandServiceImpl.java | 255 ++++++++++++++- .../src/views/acs/device/config.vue | 3 +- .../acs/service/impl/AcsToWmsServiceImpl.java | 25 +- .../nl/wms/sch/task_manage/AbstractTask.java | 1 + .../src/views/wms/sch/point/index.vue | 4 +- 11 files changed, 923 insertions(+), 10 deletions(-) create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/liao_cang/ItemProtocol.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/liao_cang/LiaoCangDefination.java create mode 100644 acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/liao_cang/LiaoCangDeviceDriver.java 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 039496a..4ac2c74 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 @@ -89,7 +89,9 @@ public enum DriverTypeEnum { PACKAGE_SITE(55, "package_site", "包装线工位", "station"), - LNSH_JCY(57, "lnsh_jcy", "标准-进出窑", "station"); + LNSH_JCY(57, "lnsh_jcy", "标准-进出窑", "station"), + + LIAO_CANG(58, "liao_cang", "标准-料仓", "station"); //驱动索引 private int index; //驱动编码 diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/liao_cang/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/liao_cang/ItemProtocol.java new file mode 100644 index 0000000..6e05732 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/liao_cang/ItemProtocol.java @@ -0,0 +1,255 @@ +package org.nl.acs.device_driver.lnsh.liao_cang; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device_driver.lnsh.converor_barcode.ConveyorBarcodeDeviceDriver; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Getter +@Setter +public class ItemProtocol { + + public static String item_heartbeat = "heartbeat"; + public static String item_weightA1 = "weightA1"; + public static String item_weightA2 = "weightA2"; + public static String item_weightA3 = "weightA3"; + public static String item_weightA4 = "weightA4"; + public static String item_weightA5 = "weightA5"; + public static String item_weightA6 = "weightA6"; + public static String item_weightA7 = "weightA7"; + public static String item_weightA8 = "weightA8"; + public static String item_weightA9 = "weightA9"; + public static String item_weightA10 = "weightA10"; + public static String item_weightA11 = "weightA11"; + public static String item_weightA12 = "weightA12"; + public static String item_weightA13 = "weightA13"; + public static String item_weightA14 = "weightA14"; + public static String item_weightA15 = "weightA15"; + public static String item_weightA16 = "weightA16"; + public static String item_weightB1 = "weightB1"; + public static String item_weightB2 = "weightB2"; + public static String item_weightB3 = "weightB3"; + public static String item_weightB4 = "weightB4"; + public static String item_weightB5 = "weightB5"; + public static String item_weightB6 = "weightB6"; + public static String item_weightB7 = "weightB7"; + public static String item_weightB8 = "weightB8"; + public static String item_weightB9 = "weightB9"; + public static String item_weightB10 = "weightB10"; + public static String item_weightB11 = "weightB11"; + public static String item_weightB12 = "weightB12"; + public static String item_weightB13 = "weightB13"; + public static String item_weightB14 = "weightB14"; + public static String item_weightB15 = "weightB15"; + public static String item_weightB16 = "weightB16"; + public static String item_weightC1 = "weightC1"; + public static String item_weightC2 = "weightC2"; + public static String item_weightC3 = "weightC3"; + public static String item_weightC4 = "weightC4"; + public static String item_weightC5 = "weightC5"; + public static String item_weightC6 = "weightC6"; + public static String item_weightC7 = "weightC7"; + public static String item_weightC8 = "weightC8"; + public static String item_weightC9 = "weightC9"; + public static String item_weightC10 = "weightC10"; + public static String item_weightC11 = "weightC11"; + public static String item_weightC12 = "weightC12"; + public static String item_weightC13 = "weightC13"; + public static String item_weightC14 = "weightC14"; + public static String item_weightC15 = "weightC15"; + public static String item_weightC16 = "weightC16"; + public static String item_weightZ1 = "weightZ1"; + public static String item_weightZ2 = "weightZ2"; + public static String item_weightZ3 = "weightZ3"; + public static String item_weightZ4 = "weightZ4"; + public static String item_weightZ5 = "weightZ5"; + public static String item_weightZ6 = "weightZ6"; + public static String item_weightZ7 = "weightZ7"; + public static String item_weightZ8 = "weightZ8"; + public static String item_weightZ9 = "weightZ9"; + public static String item_weightZ10 = "weightZ10"; + public static String item_weightZ11 = "weightZ11"; + public static String item_weightZ12 = "weightZ12"; + + Boolean isonline; + + private LiaoCangDeviceDriver driver; + + public ItemProtocol(LiaoCangDeviceDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + public float getWeightA1() { return this.getOpcFloatValue(item_weightA1); } + public float getWeightA2() { return this.getOpcFloatValue(item_weightA2); } + public float getWeightA3() { return this.getOpcFloatValue(item_weightA3); } + public float getWeightA4() { return this.getOpcFloatValue(item_weightA4); } + public float getWeightA5() { return this.getOpcFloatValue(item_weightA5); } + public float getWeightA6() { return this.getOpcFloatValue(item_weightA6); } + public float getWeightA7() { return this.getOpcFloatValue(item_weightA7); } + public float getWeightA8() { return this.getOpcFloatValue(item_weightA8); } + public float getWeightA9() { return this.getOpcFloatValue(item_weightA9); } + public float getWeightA10() { return this.getOpcFloatValue(item_weightA10); } + public float getWeightA11() { return this.getOpcFloatValue(item_weightA11); } + public float getWeightA12() { return this.getOpcFloatValue(item_weightA12); } + public float getWeightA13() { return this.getOpcFloatValue(item_weightA13); } + public float getWeightA14() { return this.getOpcFloatValue(item_weightA14); } + public float getWeightA15() { return this.getOpcFloatValue(item_weightA15); } + public float getWeightA16() { return this.getOpcFloatValue(item_weightA16); } + public float getWeightB1() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB2() { return this.getOpcFloatValue(item_weightB2); } + public float getWeightB3() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB4() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB5() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB6() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB7() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB8() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB9() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB10() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB11() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB12() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB13() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB14() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB15() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightB16() { return this.getOpcFloatValue(item_weightB1); } + public float getWeightC1() { return this.getOpcFloatValue(item_weightC1); } + public float getWeightC2() { return this.getOpcFloatValue(item_weightC2); } + public float getWeightC3() { return this.getOpcFloatValue(item_weightC3); } + public float getWeightC4() { return this.getOpcFloatValue(item_weightC4); } + public float getWeightC5() { return this.getOpcFloatValue(item_weightC5); } + public float getWeightC6() { return this.getOpcFloatValue(item_weightC6); } + public float getWeightC7() { return this.getOpcFloatValue(item_weightC7); } + public float getWeightC8() { return this.getOpcFloatValue(item_weightC8); } + public float getWeightC9() { return this.getOpcFloatValue(item_weightC9); } + public float getWeightC10() { return this.getOpcFloatValue(item_weightC10); } + public float getWeightC11() { return this.getOpcFloatValue(item_weightC11); } + public float getWeightC12() { return this.getOpcFloatValue(item_weightC12); } + public float getWeightC13() { return this.getOpcFloatValue(item_weightC13); } + public float getWeightC14() { return this.getOpcFloatValue(item_weightC14); } + public float getWeightC15() { return this.getOpcFloatValue(item_weightC15); } + public float getWeightC16() { return this.getOpcFloatValue(item_weightC16); } + public float getWeightZ1() { return this.getOpcFloatValue(item_weightZ1); } + public float getWeightZ2() { return this.getOpcFloatValue(item_weightZ2); } + public float getWeightZ3() { return this.getOpcFloatValue(item_weightZ3); } + public float getWeightZ4() { return this.getOpcFloatValue(item_weightZ4); } + public float getWeightZ5() { return this.getOpcFloatValue(item_weightZ5); } + public float getWeightZ6() { return this.getOpcFloatValue(item_weightZ6); } + public float getWeightZ7() { return this.getOpcFloatValue(item_weightZ7); } + public float getWeightZ8() { return this.getOpcFloatValue(item_weightZ8); } + public float getWeightZ9() { return this.getOpcFloatValue(item_weightZ9); } + public float getWeightZ10() { return this.getOpcFloatValue(item_weightZ10); } + public float getWeightZ11() { return this.getOpcFloatValue(item_weightZ11); } + public float getWeightZ12() { return this.getOpcFloatValue(item_weightZ12); } + + public Float getOpcFloatValue(String protocol) { + Float value = this.driver.getFloatValue(protocol); + if (ObjectUtil.isEmpty(value)) { +// log.error("读取错误!"); + } else { + return value; + } + return 0f; + } + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + } + public String getOpcStringValue(String protocol) { + String value = this.driver.getStringValue(protocol); + if (StrUtil.isBlank(value)) { +// log.error("读取错误!"); + } else { + return value; + } + return "0"; + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_heartbeat, "心跳", "DB51.B0")); + list.add(new ItemDto(item_weightA1, "重量A1", "DB51.B0")); + list.add(new ItemDto(item_weightA2, "重量A2", "DB51.B0")); + list.add(new ItemDto(item_weightA3, "重量A3", "DB51.B0")); + list.add(new ItemDto(item_weightA4, "重量A4", "DB51.B0")); + list.add(new ItemDto(item_weightA5, "重量A5", "DB51.B0")); + list.add(new ItemDto(item_weightA6, "重量A6", "DB51.B0")); + list.add(new ItemDto(item_weightA7, "重量A7", "DB51.B0")); + list.add(new ItemDto(item_weightA8, "重量A8", "DB51.B0")); + list.add(new ItemDto(item_weightA9, "重量A9", "DB51.B0")); + list.add(new ItemDto(item_weightA10, "重量A10", "DB51.B0")); + list.add(new ItemDto(item_weightA11, "重量A11", "DB51.B0")); + list.add(new ItemDto(item_weightA12, "重量A12", "DB51.B0")); + list.add(new ItemDto(item_weightA13, "重量A13", "DB51.B0")); + list.add(new ItemDto(item_weightA14, "重量A14", "DB51.B0")); + list.add(new ItemDto(item_weightA15, "重量A15", "DB51.B0")); + list.add(new ItemDto(item_weightA16, "重量A16", "DB51.B0")); + list.add(new ItemDto(item_weightB1, "重量B1", "DB51.B0")); + list.add(new ItemDto(item_weightB2, "重量B2", "DB51.B0")); + list.add(new ItemDto(item_weightB3, "重量B3", "DB51.B0")); + list.add(new ItemDto(item_weightB4, "重量B4", "DB51.B0")); + list.add(new ItemDto(item_weightB5, "重量B5", "DB51.B0")); + list.add(new ItemDto(item_weightB6, "重量B6", "DB51.B0")); + list.add(new ItemDto(item_weightB7, "重量B7", "DB51.B0")); + list.add(new ItemDto(item_weightB8, "重量B8", "DB51.B0")); + list.add(new ItemDto(item_weightB9, "重量B9", "DB51.B0")); + list.add(new ItemDto(item_weightB10, "重量B10", "DB51.B0")); + list.add(new ItemDto(item_weightB11, "重量B11", "DB51.B0")); + list.add(new ItemDto(item_weightB12, "重量B12", "DB51.B0")); + list.add(new ItemDto(item_weightB13, "重量B13", "DB51.B0")); + list.add(new ItemDto(item_weightB14, "重量B14", "DB51.B0")); + list.add(new ItemDto(item_weightB15, "重量B15", "DB51.B0")); + list.add(new ItemDto(item_weightB16, "重量B16", "DB51.B0")); + list.add(new ItemDto(item_weightC1, "重量C1", "DB51.B0")); + list.add(new ItemDto(item_weightC2, "重量C2", "DB51.B0")); + list.add(new ItemDto(item_weightC3, "重量C3", "DB51.B0")); + list.add(new ItemDto(item_weightC4, "重量C4", "DB51.B0")); + list.add(new ItemDto(item_weightC5, "重量C5", "DB51.B0")); + list.add(new ItemDto(item_weightC6, "重量C6", "DB51.B0")); + list.add(new ItemDto(item_weightC7, "重量C7", "DB51.B0")); + list.add(new ItemDto(item_weightC8, "重量C8", "DB51.B0")); + list.add(new ItemDto(item_weightC9, "重量C9", "DB51.B0")); + list.add(new ItemDto(item_weightC10, "重量C10", "DB51.B0")); + list.add(new ItemDto(item_weightC11, "重量C11", "DB51.B0")); + list.add(new ItemDto(item_weightC12, "重量C12", "DB51.B0")); + list.add(new ItemDto(item_weightC13, "重量C13", "DB51.B0")); + list.add(new ItemDto(item_weightC14, "重量C14", "DB51.B0")); + list.add(new ItemDto(item_weightC15, "重量C15", "DB51.B0")); + list.add(new ItemDto(item_weightC16, "重量C16", "DB51.B0")); + list.add(new ItemDto(item_weightZ1, "重量Z1", "DB51.B0")); + list.add(new ItemDto(item_weightZ2, "重量Z2", "DB51.B0")); + list.add(new ItemDto(item_weightZ3, "重量Z3", "DB51.B0")); + list.add(new ItemDto(item_weightZ4, "重量Z4", "DB51.B0")); + list.add(new ItemDto(item_weightZ5, "重量Z5", "DB51.B0")); + list.add(new ItemDto(item_weightZ6, "重量Z6", "DB51.B0")); + list.add(new ItemDto(item_weightZ7, "重量Z7", "DB51.B0")); + list.add(new ItemDto(item_weightZ8, "重量Z8", "DB51.B0")); + list.add(new ItemDto(item_weightZ9, "重量Z9", "DB51.B0")); + list.add(new ItemDto(item_weightZ10, "重量Z10", "DB51.B0")); + list.add(new ItemDto(item_weightZ11, "重量Z11", "DB51.B0")); + list.add(new ItemDto(item_weightZ12, "重量Z12", "DB51.B0")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + return list; + } + +} + diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/liao_cang/LiaoCangDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/liao_cang/LiaoCangDefination.java new file mode 100644 index 0000000..5c12422 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/liao_cang/LiaoCangDefination.java @@ -0,0 +1,58 @@ +package org.nl.acs.device_driver.lnsh.liao_cang; + +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceType; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +@Service +public class LiaoCangDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "liao_cang"; + } + + @Override + public String getDriverName() { + return "标准版-料仓"; + } + + @Override + public String getDriverDescription() { + return "标准版-料仓"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new LiaoCangDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return LiaoCangDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList(); + types.add(DeviceType.station); + return types; + } + + @Override + public List getReadableItemDtos() { + return ItemProtocol.getReadableItemDtos(); + } + + @Override + public List getWriteableItemDtos() { + return ItemProtocol.getWriteableItemDtos(); + } + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/liao_cang/LiaoCangDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/liao_cang/LiaoCangDeviceDriver.java new file mode 100644 index 0000000..1af8a15 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/liao_cang/LiaoCangDeviceDriver.java @@ -0,0 +1,308 @@ +package org.nl.acs.device_driver.lnsh.liao_cang; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; +import org.nl.acs.device.service.DeviceService; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.RequestMethodEnum; +import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.StandardRequestMethod; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.device_driver.lnsh.lnsh_mixing_mill.LnshMixingMillDeviceDriver; +import org.nl.acs.ext.wms.data.AcsToWmsData.applySignalStaus.ApplySignalStatusRequest; +import org.nl.acs.ext.wms.data.AcsToWmsData.applySignalStaus.ApplySignalStatusResponse; +import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskRequest; +import org.nl.acs.ext.wms.data.AcsToWmsData.applyTask.ApplyTaskResponse; +import org.nl.acs.ext.wms.service.AcsToWmsService; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.task.service.TaskService; +import org.nl.modules.lucene.service.LuceneExecuteLogService; +import org.nl.modules.lucene.service.dto.LuceneLogDto; +import org.nl.modules.wql.util.SpringContextHolder; +import org.openscada.opc.lib.da.Server; + +import java.lang.reflect.Method; +import java.util.*; + +@Slf4j +@Getter +@Setter +@RequiredArgsConstructor +public class LiaoCangDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, StandardRequestMethod { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + + LuceneExecuteLogService lucene = SpringContextHolder.getBean("luceneExecuteLogServiceImpl"); + + InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); + + DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); + + RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl"); + + TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); + + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + + AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); + + DeviceAppService deviceAppService = SpringContextHolder.getBean("deviceAppServiceImpl"); + + String device_code; + private Date instruction_require_time = new Date(); + private Date instruction_finished_time = new Date(); + + private int instruction_require_time_out = 3000; + float weightA1; + float weightA2; + float weightA3; + float weightA4; + float weightA5; + float weightA6; + float weightA7; + float weightA8; + float weightA9; + float weightA10; + float weightA11; + float weightA12; + float weightA13; + float weightA14; + float weightA15; + float weightA16; + float weightB1; + float weightB2; + float weightB3; + float weightB4; + float weightB5; + float weightB6; + float weightB7; + float weightB8; + float weightB9; + float weightB10; + float weightB11; + float weightB12; + float weightB13; + float weightB14; + float weightB15; + float weightB16; + float weightC1; + float weightC2; + float weightC3; + float weightC4; + float weightC5; + float weightC6; + float weightC7; + float weightC8; + float weightC9; + float weightC10; + float weightC11; + float weightC12; + float weightC13; + float weightC14; + float weightC15; + float weightC16; + float weightZ1; + float weightZ2; + float weightZ3; + float weightZ4; + float weightZ5; + float weightZ6; + float weightZ7; + float weightZ8; + float weightZ9; + float weightZ10; + float weightZ11; + float weightZ12; + String message; + @Override + public int hashCode() { + return super.hashCode(); + } + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() { + message = null; + try { + device_code = this.getDeviceCode(); + weightA1 = this.itemProtocol.getWeightA1(); + weightA2 = this.itemProtocol.getWeightA2(); + weightA3 = this.itemProtocol.getWeightA3(); + weightA4 = this.itemProtocol.getWeightA4(); + weightA5 = this.itemProtocol.getWeightA5(); + weightA6 = this.itemProtocol.getWeightA6(); + weightA7 = this.itemProtocol.getWeightA7(); + weightA8 = this.itemProtocol.getWeightA8(); + weightA9 = this.itemProtocol.getWeightA9(); + weightA10 = this.itemProtocol.getWeightA10(); + weightA11 = this.itemProtocol.getWeightA11(); + weightA12 = this.itemProtocol.getWeightA12(); + weightA13 = this.itemProtocol.getWeightA13(); + weightA14 = this.itemProtocol.getWeightA14(); + weightA15 = this.itemProtocol.getWeightA15(); + weightA16 = this.itemProtocol.getWeightA16(); + weightB1 = this.itemProtocol.getWeightB1(); + weightB2 = this.itemProtocol.getWeightB2(); + weightB3 = this.itemProtocol.getWeightB3(); + weightB4 = this.itemProtocol.getWeightB4(); + weightB5 = this.itemProtocol.getWeightB5(); + weightB6 = this.itemProtocol.getWeightB6(); + weightB7 = this.itemProtocol.getWeightB7(); + weightB8 = this.itemProtocol.getWeightB8(); + weightB9 = this.itemProtocol.getWeightB9(); + weightB10 = this.itemProtocol.getWeightB10(); + weightB11 = this.itemProtocol.getWeightB11(); + weightB12 = this.itemProtocol.getWeightB12(); + weightB13 = this.itemProtocol.getWeightB13(); + weightB14 = this.itemProtocol.getWeightB14(); + weightB15 = this.itemProtocol.getWeightB15(); + weightB16 = this.itemProtocol.getWeightB16(); + weightC1 = this.itemProtocol.getWeightC1(); + weightC2 = this.itemProtocol.getWeightC2(); + weightC3 = this.itemProtocol.getWeightC3(); + weightC4 = this.itemProtocol.getWeightC4(); + weightC5 = this.itemProtocol.getWeightC5(); + weightC6 = this.itemProtocol.getWeightC6(); + weightC7 = this.itemProtocol.getWeightC7(); + weightC8 = this.itemProtocol.getWeightC8(); + weightC9 = this.itemProtocol.getWeightC9(); + weightC10 = this.itemProtocol.getWeightC10(); + weightC11 = this.itemProtocol.getWeightC11(); + weightC12 = this.itemProtocol.getWeightC12(); + weightC13 = this.itemProtocol.getWeightC13(); + weightC14 = this.itemProtocol.getWeightC14(); + weightC15 = this.itemProtocol.getWeightC15(); + weightC16 = this.itemProtocol.getWeightC16(); + weightC16 = this.itemProtocol.getWeightC16(); + weightZ1 = this.itemProtocol.getWeightZ1(); + weightZ2 = this.itemProtocol.getWeightZ2(); + weightZ3 = this.itemProtocol.getWeightZ3(); + weightZ4 = this.itemProtocol.getWeightZ4(); + weightZ5 = this.itemProtocol.getWeightZ5(); + weightZ6 = this.itemProtocol.getWeightZ6(); + weightZ7 = this.itemProtocol.getWeightZ7(); + weightZ8 = this.itemProtocol.getWeightZ8(); + weightZ9 = this.itemProtocol.getWeightZ9(); + weightZ10 = this.itemProtocol.getWeightZ10(); + weightZ11 = this.itemProtocol.getWeightZ11(); + weightZ12 = this.itemProtocol.getWeightZ12(); + } catch (Exception var17) { + return; + } + + } + @Override + public JSONObject getDeviceStatusName() throws Exception { + return null; + } + + + public String toString() { + return ""; + } + + + + @Override + public void setDeviceStatus(JSONObject data) { + + } + + + /** + * 请求 + * + * @param + */ + public synchronized boolean applyRequest(String modethod) throws Exception { + Object obj1 = this; + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_require_time = date; + Object obj = this.getClass().getDeclaredConstructor().newInstance(); + Method method1 = this.getClass().getMethod(modethod, null); + method1.invoke(this, null); + return true; + } + } + + + 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; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + if (value instanceof String) { + itemMap.put(to_param, value); + } else { + itemMap.put(to_param, value); + } + ReadUtil.write(itemMap, server); + server.disconnect(); + logServer.deviceExecuteLog(this.device_code, "", "", param + " 写入 " + value); + } + + + /** + * 多个信号一起下发电气 + * + * @param map + */ + + public void writing(Map map) { + LuceneExecuteLogService lucene = SpringContextHolder.getBean(LuceneExecuteLogService.class); + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + Map itemMap = new LinkedHashMap<>(); + map.forEach((key, value) -> { + if (ObjectUtil.isNotEmpty(value)) { + itemMap.put(getToParam() + key, value); + } + }); + if (ObjectUtil.isNotEmpty(itemMap)) { + try { + this.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + try{ + this.checkcontrol(itemMap); + } catch (Exception e1){ + e1.printStackTrace(); + } + } + logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap); + lucene.deviceExecuteLog(new LuceneLogDto(this.getDeviceCode(), "下发多个电气信号:" + itemMap)); + } + } + /** + * 抽取统一下发电气信号前缀 + * + * @return + */ + public String getToParam() { + return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "."; + } + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java b/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java index a9fde4c..4615b14 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/rest/HFHandController.java @@ -4,6 +4,7 @@ package org.nl.hand.amb.rest; import cn.dev33.satoken.annotation.SaIgnore; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; @@ -51,6 +52,14 @@ public class HFHandController { return new ResponseEntity<>(HandService.queryPointByArea(region), HttpStatus.OK); } + @PostMapping ("/queryliaocang") + @Log("查询料仓数据") + @ApiOperation("查询料仓数据") + @SaIgnore + public ResponseEntity queryliaocang() { + return new ResponseEntity(HandService.queryliaocang(), HttpStatus.OK); + } + @PostMapping("/point/storage") @Log("查询设备扩展属性") @ApiOperation("查询设备扩展属性") diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/HFHandService.java b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/HFHandService.java index 7ad1bc1..3d511f5 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/HFHandService.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/HFHandService.java @@ -2,6 +2,9 @@ package org.nl.hand.amb.service; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + import java.util.Map; /** @@ -18,6 +21,14 @@ public interface HFHandService { * @return Map */ Map queryArea(Map whereJson); + /** + * 查询料仓数据 + * + * @param + * @return + */ + JSONArray queryliaocang(); + /** * 查询设备编号及状态 diff --git a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java index c081f7f..f8ee84a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/hand/amb/service/impl/HFHandServiceImpl.java @@ -13,13 +13,17 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.XianGongAgvService; -import org.nl.acs.agv.server.impl.NDCAgvServiceImpl; import org.nl.acs.auto.run.AutoRunService; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.dto.DeviceDto; import org.nl.acs.device.service.impl.DeviceServiceImpl; +import org.nl.acs.device_driver.DeviceDriver; import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; +import org.nl.acs.device_driver.lnsh.liao_cang.ItemProtocol; +import org.nl.acs.device_driver.lnsh.liao_cang.LiaoCangDeviceDriver; +import org.nl.acs.device_driver.lnsh.lnsh_Laminating_machine.LnshLaminatingMachineDeviceDriver; +import org.nl.acs.device_driver.lnsh.lnsh_mixing_mill.LnshMixingMillDeviceDriver; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.instruction.service.dto.InstructionDto; @@ -62,6 +66,7 @@ public class HFHandServiceImpl implements HFHandService { InstructionService instructionService = null; + @Override public Map queryArea(Map whereJson) { JSONObject jo = new JSONObject(); @@ -71,6 +76,254 @@ public class HFHandServiceImpl implements HFHandService { jo.put("result", resultJSONArray); return jo; } + @Override + public JSONArray queryliaocang() { + Device device = deviceAppService.findDeviceByCode("realTimeWeight"); + DeviceDriver deviceDriver = device.getDeviceDriver(); + LiaoCangDeviceDriver liaoCangDeviceDriver = (LiaoCangDeviceDriver) deviceDriver; + JSONArray lcsj=new JSONArray(); + JSONObject jo = new JSONObject(); + jo.put("point_name","A1"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA1())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A2"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA2())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A3"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA3())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A4"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA4())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A5"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA5())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A6"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA6())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A7"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA7())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A8"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA8())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A9"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA9())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A10"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA10())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A11"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA11())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A12"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA12())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A13"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA13())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A14"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA14())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A15"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA15())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","A16"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightA16())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B1"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB1())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B2"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB2())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B3"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB3())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B4"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB4())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B5"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB5())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B6"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB6())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B7"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB7())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B8"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB8())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B9"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB9())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B10"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB10())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B11"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB11())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B12"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB12())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B13"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB13())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B14"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB14())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B15"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB15())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","B16"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightB16())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C1"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC1())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C2"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC2())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C3"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC3())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C4"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC4())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C5"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC5())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C6"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC6())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C7"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC7())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C8"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC8())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C9"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC9())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C10"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC10())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C11"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC11())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C12"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC12())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C13"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC13())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C14"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC14())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C15"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC15())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","C16"); + jo.put("num",Math.round(liaoCangDeviceDriver.getWeightC16())); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","Z1"); + jo.put("num",liaoCangDeviceDriver.getWeightZ1()); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","Z2"); + jo.put("num",liaoCangDeviceDriver.getWeightZ2()); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","Z3"); + jo.put("num",liaoCangDeviceDriver.getWeightZ3()); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","Z4"); + jo.put("num",liaoCangDeviceDriver.getWeightZ4()); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","Z5"); + jo.put("num",liaoCangDeviceDriver.getWeightZ5()); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","Z6"); + jo.put("num",liaoCangDeviceDriver.getWeightZ6()); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","Z7"); + jo.put("num",liaoCangDeviceDriver.getWeightZ7()); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","Z8"); + jo.put("num",liaoCangDeviceDriver.getWeightZ8()); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","Z9"); + jo.put("num",liaoCangDeviceDriver.getWeightZ9()); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","Z10"); + jo.put("num",liaoCangDeviceDriver.getWeightZ10()); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","Z11"); + jo.put("num",liaoCangDeviceDriver.getWeightZ11()); + lcsj.add(jo); + jo=new JSONObject(); + jo.put("point_name","Z12"); + jo.put("num",liaoCangDeviceDriver.getWeightZ12()); + lcsj.add(jo); + return lcsj; + } @Override public Map queryPointByArea(String dict_id) { diff --git a/acs/nladmin-ui/src/views/acs/device/config.vue b/acs/nladmin-ui/src/views/acs/device/config.vue index 62b8ad1..359a2e2 100644 --- a/acs/nladmin-ui/src/views/acs/device/config.vue +++ b/acs/nladmin-ui/src/views/acs/device/config.vue @@ -105,6 +105,7 @@ import agv_ndc_one from '@/views/acs/device/driver/agv/agv_ndc_one' import agv_ndc_two from '@/views/acs/device/driver/agv/agv_ndc_two' import package_site from './driver/lnsh/package_site.vue' import lnsh_jcy from '@/views/acs/device/driver/lnsh/lnsh_jcy' +import liao_cang from '@/views/acs/device/driver/lnsh/liao_cang' export default { name: 'DeviceConfig', @@ -113,7 +114,7 @@ export default { standard_conveyor_control, standard_conveyor_monitor, lnsh_mixing_mill, lnsh_press, lnsh_palletizing_manipulator, lnsh_fold_disc_site, lnsh_kiln_lane, lnsh_kiln_truss, lnsh_package_line, lnsh_out_kiln_truss, lnsh_package_pallet_manipulator, lnsh_pallet_storage, lnsh_labeling_machine, lnsh_split_manipulator, lnsh_rgv, lnsh_station, lnsh_Laminating_machine, lnsh_package_site, lnsh_crusher, lnsh_palletizing_manipulator_site,conveyor_ssx_barcode, conveyor_press_station, - agv_ndc_one, agv_ndc_two,package_site,lnsh_jcy}, + agv_ndc_one, agv_ndc_two,package_site,lnsh_jcy,liao_cang}, dicts: ['device_type'], mixins: [crud], data() { diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 6792cd4..6e27948 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -150,6 +150,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @Override public BaseResponse acsApply(JSONObject param) { + log.info("acs请求lms方法名acsApply"); String requestNo = param.getString(RequestConstant.REQUEST_NO); String requestMethodName = param.getString(RequestConstant.REQUEST_METHOD_NAME); BaseResponse result = BaseResponse.build(requestNo); @@ -189,12 +190,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @SneakyThrows public ApplyTaskResponse applyPutFullVehicle(JSONObject param) { // 找到当前的设备 + log.info("acs请求lms方法名applyPutFullVehicle"); String deviceCode = param.getString("device_code"); String requestNo = param.getString("requestNo"); SchBasePoint basePoint = pointService.getById(deviceCode); String configCode = basePoint.getRegion_code() + "QLTask"; RLock lock = redissonClient.getLock(configCode); - boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); + boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS); try { if (tryLock) { if (ObjectUtil.isEmpty(basePoint)) { @@ -263,12 +265,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @SneakyThrows public ApplyTaskResponse applyPutEmptyVehicle(JSONObject param) { // 找到当前的设备 + log.info("acs请求lms方法名applyPutEmptyVehicle"); String deviceCode = param.getString("device_code"); String requestNo = param.getString("requestNo"); SchBasePoint basePoint = pointService.getById(deviceCode); String configCode = basePoint.getRegion_code() + "QKTask"; RLock lock = redissonClient.getLock(configCode); - boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); + boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS); try { if (tryLock) { @@ -279,6 +282,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { // 组织参数 param.put("config_code", configCode); taskService.apply(param); + }else { + throw new BadRequestException("其他设备占用锁,等待结束!"); } } finally { if (tryLock) { @@ -299,12 +304,13 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @SneakyThrows public ApplyTaskResponse applyTakeEmptyVehicle(JSONObject param) { // 找到当前的设备 + log.info("acs请求lms方法名applyTakeEmptyVehicle"); String deviceCode = param.getString("device_code"); String requestNo = param.getString("requestNo"); SchBasePoint basePoint = pointService.getById(deviceCode); String configCode = basePoint.getRegion_code() + "SKTask"; RLock lock = redissonClient.getLock(configCode); - boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); + boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS); try { if (tryLock) { if (ObjectUtil.isEmpty(basePoint)) { @@ -314,6 +320,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { param.put("config_code", configCode); taskService.apply(param); } + else { + throw new BadRequestException("其他设备占用锁,等待结束!"); + } } finally { if (tryLock) { lock.unlock(); @@ -333,13 +342,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { @SneakyThrows public ApplyTaskResponse applyTakeFullVehicle(JSONObject param) { // 找到当前的设备 + log.info("acs请求lms方法名applyTakeFullVehicle"); String deviceCode = param.getString("device_code"); String requestNo = param.getString("requestNo"); SchBasePoint basePoint = pointService.getById(deviceCode); String configCode = basePoint.getRegion_code() + "MLTask"; RLock lock = redissonClient.getLock(configCode); // 无业务:0 - boolean tryLock = lock.tryLock(0, TimeUnit.SECONDS); + boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS); try { if (tryLock) { if (ObjectUtil.isEmpty(basePoint)) { @@ -348,6 +358,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { // 组织参数 param.put("config_code", configCode); taskService.apply(param); + } else { + throw new BadRequestException("其他设备占用锁,等待结束!"); } } finally { @@ -394,7 +406,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String deviceCode = param.getString("device_code"); String requestNo = param.getString("requestNo"); RLock lock = redissonClient.getLock(deviceCode); - boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS); + boolean tryLock = lock.tryLock(10, TimeUnit.SECONDS); try { if (tryLock) { SchBasePoint basePoint = pointService.getById(deviceCode); @@ -406,6 +418,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { param.put("config_code", configCode); taskService.apply(param); } + else { + throw new BadRequestException("其他设备占用锁,等待结束!"); + } } finally { if (tryLock) { lock.unlock(); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java index 72bd753..b86458b 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/AbstractTask.java @@ -246,6 +246,7 @@ public abstract class AbstractTask { * @throws BadRequestException */ public void apply(JSONObject param) throws BadRequestException { + log.info("acs请求lms方法名apply"); // 申请任务 SchBaseTask task = new SchBaseTask(); // 任务实体 String apply_point_code = param.getString("device_code"); // 请求点 diff --git a/lms/nladmin-ui/src/views/wms/sch/point/index.vue b/lms/nladmin-ui/src/views/wms/sch/point/index.vue index c9b1a80..c3024ed 100644 --- a/lms/nladmin-ui/src/views/wms/sch/point/index.vue +++ b/lms/nladmin-ui/src/views/wms/sch/point/index.vue @@ -267,10 +267,10 @@ - +