From cbf3ae9704347a9e81ebd20b27f2943a7e33974d Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Thu, 23 Nov 2023 16:25:02 +0800 Subject: [PATCH] =?UTF-8?q?rev=20=E8=87=AA=E5=AE=9A=E4=B9=89=E7=AD=96?= =?UTF-8?q?=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/server/impl/NDCAgvServiceImpl.java | 27 +- .../CustomerStragetyCacheService.java | 24 + .../DequeCustomerDeviceStrategy.java | 44 + .../DequeDefaultDeviceStrategy.java | 62 + .../DeviceCustomerDequeStrategyConfig.java | 13 + .../nl/acs/custompolicy/DeviceStrategy.java | 16 + .../custompolicy/PersistenceValueManage.java | 35 + .../acs/custompolicy/StackerInstruction.java | 61 + .../acs/custompolicy/StackerStrategyDto.java | 37 + .../StockinFirstDeviceStrategy.java | 24 + .../StockoutFirstDeviceStrategy.java | 24 + .../custompolicy/WaitingInstructionDeque.java | 88 ++ .../server/CustomPolicyService.java | 4 + .../server/impl/CustomPolicyServiceImpl.java | 39 + .../CargoLiftConveyorDefination.java | 60 - .../HongXiangStationDeviceDriver.java | 23 - .../HongXiangConveyorDeviceDriver.java | 25 - .../lnsh_station/LnshStationDeviceDriver.java | 676 +++++------ .../StandardCoveyorControlDeviceDriver.java | 6 + .../StandardInspectSiteDeviceDriver.java | 38 +- .../acs/ext/wms/rest/AcsToWmsController.java | 72 +- .../acs/ext/wms/service/AcsToWmsService.java | 38 - .../wms/service/impl/AcsToWmsServiceImpl.java | 1016 +---------------- .../org/nl/acs/instruction/ComparatorAsc.java | 13 + .../org/nl/acs/instruction/ComparatorEx.java | 76 ++ .../org/nl/acs/instruction/CompareOrder.java | 7 + .../instruction/CompareOrderComparator.java | 29 + .../instruction/InstructionComparator.java | 75 ++ .../org/nl/acs/instruction/OperateType.java | 22 + .../org/nl/acs/instruction/OptionType.java | 5 + .../service/InstructionService.java | 5 + .../nl/acs/instruction/service/SortUtlEx.java | 19 + .../service/impl/InstructionServiceImpl.java | 194 +++- .../main/resources/config/application-dev.yml | 2 +- .../src/views/acs/device/config.vue | 9 +- 35 files changed, 1244 insertions(+), 1664 deletions(-) create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/CustomerStragetyCacheService.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DequeCustomerDeviceStrategy.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DequeDefaultDeviceStrategy.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DeviceCustomerDequeStrategyConfig.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DeviceStrategy.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/PersistenceValueManage.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StackerInstruction.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StackerStrategyDto.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StockinFirstDeviceStrategy.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StockoutFirstDeviceStrategy.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/WaitingInstructionDeque.java delete mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDefination.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/ComparatorAsc.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/ComparatorEx.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/CompareOrder.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/CompareOrderComparator.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/InstructionComparator.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/OperateType.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/OptionType.java create mode 100644 acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/SortUtlEx.java diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index 50839c1..7159f25 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -194,31 +194,8 @@ public class NDCAgvServiceImpl implements NDCAgvService { } @Override - public byte[] sendAgvTwoModeInst(int phase, int index, int result) { - - if (phase < 0 || index < 0) - return null; - byte indexhigh = (byte) IntToHexHigh(index); - byte indexlow = (byte) IntToHexLow(index); - byte phasehigh = (byte) IntToHexHigh(phase); - byte phaselow = (byte) IntToHexLow(phase); - - byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, - (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0A, - (byte) 0X00, (byte) 0X01, - (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X06, - (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X10, - (byte) phasehigh, (byte) phaselow - }; - - - log.info("反馈agv动作数据--index:" + hexToString(indexhigh & 0xFF) + hexToString(indexlow & 0xFF) + ",phase:" + hexToString(phasehigh & 0xFF) + hexToString(phaselow & 0xFF)); - - System.out.println("反馈agv动作数据:" + Bytes2HexString(b)); - return b; + public byte[] sendAgvOneModeInst(int phase, int index, int result) { + return new byte[0]; } @Override diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/CustomerStragetyCacheService.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/CustomerStragetyCacheService.java new file mode 100644 index 0000000..fd61b20 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/CustomerStragetyCacheService.java @@ -0,0 +1,24 @@ +package org.nl.acs.custompolicy; + +import java.util.HashMap; +import java.util.Map; + +public class CustomerStragetyCacheService { + private Map strategyCache = new HashMap(); + + public CustomerStragetyCacheService() { + } + + public synchronized void cleanStragety(String deiviceCode) { + this.strategyCache.remove(deiviceCode); + } + + public synchronized StackerStrategyDto getStragety(String deiviceCode) { + StackerStrategyDto stackerStrategyDto = (StackerStrategyDto)this.strategyCache.get(deiviceCode); + return stackerStrategyDto; + } + + public synchronized void setStragety(String deiviceCode, StackerStrategyDto strategy) { + this.strategyCache.put(deiviceCode, strategy); + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DequeCustomerDeviceStrategy.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DequeCustomerDeviceStrategy.java new file mode 100644 index 0000000..6723a36 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DequeCustomerDeviceStrategy.java @@ -0,0 +1,44 @@ +package org.nl.acs.custompolicy; + +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; +import org.nl.acs.custompolicy.server.CustomPolicyService; +import org.nl.acs.custompolicy.server.dto.CustomPolicyDTO; +import org.nl.acs.custompolicy.server.mapper.CustomPolicyMapper; +import org.nl.acs.device.service.mapper.DeviceMapper; +import org.nl.acs.instruction.domain.Instruction; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.storage_cell.domain.StorageCell; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.*; + +public class DequeCustomerDeviceStrategy implements DeviceStrategy { + @Autowired + InstructionService instructionService; + @Autowired + CustomPolicyService customPolicyService; + CustomerStragetyCacheService customerStragetyCacheService; + + CustomPolicyMapper customPolicyMapper; + + public DequeCustomerDeviceStrategy() { + } + + public String getCode() { + return DequeCustomerDeviceStrategy.class.getSimpleName(); + } + + public String getName() { + return "自定义队列策略"; + } + + private String getType(String type, String from, String to) { + return null; + } + + public WaitingInstructionDeque strategy(List instructions, String device_code) { + WaitingInstructionDeque deque = this.instructionService.findWaitingInstructionDequeByDeviceCode(device_code); + StackerStrategyDto cacheStragety = this.customerStragetyCacheService.getStragety(device_code); + return deque; + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DequeDefaultDeviceStrategy.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DequeDefaultDeviceStrategy.java new file mode 100644 index 0000000..68c9f86 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DequeDefaultDeviceStrategy.java @@ -0,0 +1,62 @@ +package org.nl.acs.custompolicy; + +import org.nl.acs.instruction.domain.Instruction; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.SortUtlEx; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.*; + +@Component +public class DequeDefaultDeviceStrategy implements DeviceStrategy { + + @Autowired + InstructionService instructionService; + + public DequeDefaultDeviceStrategy() { + } + + public String getCode() { + return DequeDefaultDeviceStrategy.class.getSimpleName(); + } + + public String getName() { + return "默认队列策略"; + } + + public WaitingInstructionDeque strategy(List instructions, String device_code) { + WaitingInstructionDeque deque = this.instructionService.findWaitingInstructionDequeByDeviceCode(device_code); + Map> factory = new HashMap(); + + Instruction instruction; + Object list; + for(Iterator var5 = instructions.iterator(); var5.hasNext(); ((List)list).add(instruction)) { + instruction = (Instruction)var5.next(); + String type = instruction.getInstruction_type(); + list = (List)factory.get(type); + if (list == null) { + list = new ArrayList(); + factory.put(instruction.getInstruction_type(), (List) list); + } + } + + Set keys = factory.keySet(); + List sort_keys = new LinkedList(); + sort_keys.addAll(keys); + Collections.sort(sort_keys); +// SortUtlEx.sort(sort_keys, this.comparator); + Iterator var12 = sort_keys.iterator(); + + while(var12.hasNext()) { + String string = (String)var12.next(); + List list2 = (List)factory.get(string); + if (list2 != null && list2.size() > 0) { + deque.offerIfNotExists((Instruction)list2.get(0)); + } + } + + return deque; + } + +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DeviceCustomerDequeStrategyConfig.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DeviceCustomerDequeStrategyConfig.java new file mode 100644 index 0000000..e5528c5 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DeviceCustomerDequeStrategyConfig.java @@ -0,0 +1,13 @@ +package org.nl.acs.custompolicy; + +public class DeviceCustomerDequeStrategyConfig { + public static String unit_key = "deviceCustomerDequeStrategy"; + public static String stock_in = "上架"; + public static String stock_out = "下架"; + public static String stock_change = "移库"; + public static String stock_move = "摆渡"; + public static String transport = "移动"; + + public DeviceCustomerDequeStrategyConfig() { + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DeviceStrategy.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DeviceStrategy.java new file mode 100644 index 0000000..825aae0 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/DeviceStrategy.java @@ -0,0 +1,16 @@ +package org.nl.acs.custompolicy; + +import org.nl.acs.instruction.domain.Instruction; + +import java.util.List; + +public interface DeviceStrategy { + String getName(); + + String getCode(); + + default WaitingInstructionDeque strategy(List instructions, String device_code) { + throw new RuntimeException("未实现"); + } + +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/PersistenceValueManage.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/PersistenceValueManage.java new file mode 100644 index 0000000..9fce8b8 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/PersistenceValueManage.java @@ -0,0 +1,35 @@ +package org.nl.acs.custompolicy; + +public class PersistenceValueManage { + private static final long serialVersionUID = 1L; + private String unit_code; + private String key_code; + private String key_value; + + public PersistenceValueManage() { + } + + public String getUnit_code() { + return this.unit_code; + } + + public void setUnit_code(String unit_code) { + this.unit_code = unit_code; + } + + public String getKey_code() { + return this.key_code; + } + + public void setKey_code(String key_code) { + this.key_code = key_code; + } + + public String getKey_value() { + return this.key_value; + } + + public void setKey_value(String key_value) { + this.key_value = key_value; + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StackerInstruction.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StackerInstruction.java new file mode 100644 index 0000000..dbbf4ab --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StackerInstruction.java @@ -0,0 +1,61 @@ +package org.nl.acs.custompolicy; + +public class StackerInstruction { + private String procedure; + private String type; + private String from; + private String to; + private int quantity = 1; + private int sort; + + public StackerInstruction() { + } + + public String getProcedure() { + return this.procedure; + } + + public void setProcedure(String procedure) { + this.procedure = procedure; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + } + + public String getFrom() { + return this.from; + } + + public void setFrom(String from) { + this.from = from; + } + + public String getTo() { + return this.to; + } + + public void setTo(String to) { + this.to = to; + } + + public int getQuantity() { + return this.quantity; + } + + public void setQuantity(int quantity) { + this.quantity = quantity; + } + + public int getSort() { + return this.sort; + } + + public void setSort(int sort) { + this.sort = sort; + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StackerStrategyDto.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StackerStrategyDto.java new file mode 100644 index 0000000..7e90de4 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StackerStrategyDto.java @@ -0,0 +1,37 @@ +package org.nl.acs.custompolicy; + +import java.util.ArrayList; +import java.util.List; + +public class StackerStrategyDto { + private String deviceCode; + private List plan = new ArrayList(); + private List forbid = new ArrayList(); + + public StackerStrategyDto() { + } + + public String getDeviceCode() { + return this.deviceCode; + } + + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode; + } + + public List getPlan() { + return this.plan; + } + + public void setPlan(List plan) { + this.plan = plan; + } + + public List getForbid() { + return this.forbid; + } + + public void setForbid(List forbid) { + this.forbid = forbid; + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StockinFirstDeviceStrategy.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StockinFirstDeviceStrategy.java new file mode 100644 index 0000000..1932900 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StockinFirstDeviceStrategy.java @@ -0,0 +1,24 @@ +package org.nl.acs.custompolicy; + +import org.nl.acs.instruction.domain.Instruction; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +public class StockinFirstDeviceStrategy implements DeviceStrategy { + + public StockinFirstDeviceStrategy() { + } + + public String getCode() { + return StockinFirstDeviceStrategy.class.getSimpleName(); + } + + public String getName() { + return "入库优先策略"; + } + + public WaitingInstructionDeque strategy(List instructions, String device_code) { + return null; + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StockoutFirstDeviceStrategy.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StockoutFirstDeviceStrategy.java new file mode 100644 index 0000000..a2ecdb0 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/StockoutFirstDeviceStrategy.java @@ -0,0 +1,24 @@ +package org.nl.acs.custompolicy; + +import org.nl.acs.instruction.domain.Instruction; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +public class StockoutFirstDeviceStrategy implements DeviceStrategy { + + public StockoutFirstDeviceStrategy() { + } + + public String getCode() { + return StockoutFirstDeviceStrategy.class.getSimpleName(); + } + + public String getName() { + return "出库优先策略"; + } + + public WaitingInstructionDeque strategy(List instructions, String device_code) { + return null; + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/WaitingInstructionDeque.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/WaitingInstructionDeque.java new file mode 100644 index 0000000..3a86f5b --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/WaitingInstructionDeque.java @@ -0,0 +1,88 @@ +package org.nl.acs.custompolicy; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import org.nl.acs.instruction.domain.Instruction; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.opc.ObjectUtl; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.route.service.impl.RouteLineServiceImpl; +import org.nl.config.SpringContextHolder; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Iterator; +import java.util.LinkedList; + +public class WaitingInstructionDeque { + LinkedList deque = new LinkedList(); + LinkedList lastDeque = new LinkedList(); + + public WaitingInstructionDeque() { + } + + public LinkedList getQueue() { + return this.deque; + } + + public void setQueue(LinkedList deque) { + this.deque = deque; + } + + public void offerIfNotExists(Instruction instruction) { + if (!this.deque.contains(instruction)) { + this.deque.offer(instruction); + } + + } + + public Instruction peek() { + return (Instruction)this.deque.peek(); + } + + public Instruction poll() { + return (Instruction)this.deque.poll(); + } + + public void offer(Instruction instruction) { + this.deque.offer(instruction); + } + + public boolean contains(Instruction instruction) { + return this.deque.contains(instruction); + } + + public void flushDeue() { + InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); + LinkedList dequeTemp = new LinkedList(); + Iterator var3 = this.deque.iterator(); + + while(var3.hasNext()) { + Instruction instruction = (Instruction)var3.next(); + Instruction findByCode = instructionService.findByCode(instruction.getInstruction_code()); + if (findByCode != null && StrUtil.equals(findByCode.getInstruction_status(),"0") && !dequeTemp.contains(findByCode)) { + dequeTemp.offer(findByCode); + } + } + + this.setQueue(dequeTemp); + } + + public void lastDequeDeal() { + InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class); + Iterator var2 = this.lastDeque.iterator(); + + while(var2.hasNext()) { + Instruction instruction = (Instruction)var2.next(); + Instruction findByCode = instructionService.findByCode(instruction.getInstruction_code()); + if (findByCode != null && StrUtil.equals(findByCode.getInstruction_status(),"0")) { + this.offerIfNotExists(findByCode); + } + } + + } + + public void lastDequeTag() { + this.lastDeque = (LinkedList) ObjectUtil.clone(this.deque); + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/server/CustomPolicyService.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/server/CustomPolicyService.java index b310fe4..1231061 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/server/CustomPolicyService.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/server/CustomPolicyService.java @@ -2,6 +2,7 @@ package org.nl.acs.custompolicy.server; import org.nl.acs.common.base.CommonService; import org.nl.acs.common.base.PageInfo; +import org.nl.acs.custompolicy.DeviceStrategy; import org.nl.acs.custompolicy.domain.CustomPolicy; import org.nl.acs.custompolicy.server.dto.CustomPolicyDTO; import org.nl.acs.custompolicy.server.vo.CustomPolicyPlantVO; @@ -29,4 +30,7 @@ public interface CustomPolicyService extends CommonService { CustomPolicyPlantVO plantList(Long id); void updateOn(Long id,Integer is_on); + + DeviceStrategy findByCode(String var1); + } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/server/impl/CustomPolicyServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/server/impl/CustomPolicyServiceImpl.java index c4f1ff1..924527f 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/server/impl/CustomPolicyServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/custompolicy/server/impl/CustomPolicyServiceImpl.java @@ -10,6 +10,7 @@ import lombok.AllArgsConstructor; import org.nl.acs.common.base.PageInfo; import org.nl.acs.common.base.impl.CommonServiceImpl; +import org.nl.acs.custompolicy.DeviceStrategy; import org.nl.acs.custompolicy.domain.CustomPolicy; import org.nl.acs.custompolicy.server.CustomPolicyService; import org.nl.acs.custompolicy.server.dto.CustomPolicyDTO; @@ -36,8 +37,16 @@ import java.util.stream.Collectors; @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) public class CustomPolicyServiceImpl extends CommonServiceImpl implements CustomPolicyService { + List strategys = Collections.synchronizedList(new LinkedList()); + + List instructionStrategys; + private final CustomPolicyMapper customPolicyMapper; + public List findAllDeviceStrategy() { + return (List)(this.instructionStrategys != null && this.instructionStrategys.size() > 0 ? this.instructionStrategys : new LinkedList()); + } + @Override public PageInfo queryAll(Map whereJson, Pageable page) { IPage queryPage = PageUtil.toMybatisPage(page); @@ -102,4 +111,34 @@ public class CustomPolicyServiceImpl extends CommonServiceImpl strategys = this.findAllDeviceStrategy(); + Iterator var3 = strategys.iterator(); + + DeviceStrategy i; + do { + if (!var3.hasNext()) { + return null; + } + + i = (DeviceStrategy)var3.next(); + } while(!i.getCode().equals(code)); + + return i; + } + + public Map findDeviceStrategyOption() { + List strategys = this.findAllDeviceStrategy(); + Map map = new HashMap(); + Iterator var3 = strategys.iterator(); + + while(var3.hasNext()) { + DeviceStrategy strategy = (DeviceStrategy)var3.next(); + map.put(strategy.getCode(), strategy.getName()); + } + + return map; + } } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDefination.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDefination.java deleted file mode 100644 index 4cb1d47..0000000 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/cargo_lift_conveyor/CargoLiftConveyorDefination.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.nl.acs.device_driver.basedriver.cargo_lift_conveyor; - -import org.nl.acs.device.device_driver.standard_inspect.ItemDto; -import org.nl.acs.device.domain.Device; -import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; -import org.nl.acs.device.enums.DeviceType; -import org.springframework.stereotype.Service; - -import java.util.LinkedList; -import java.util.List; - -/** - * 货梯对接线 - */ -@Service -public class CargoLiftConveyorDefination implements OpcDeviceDriverDefination { - @Override - public String getDriverCode() { - return "cargo_lift_conveyor"; - } - - @Override - public String getDriverName() { - return "货梯对接线"; - } - - @Override - public String getDriverDescription() { - return "货梯对接线"; - } - - @Override - public DeviceDriver getDriverInstance(Device device) { - return (new CargoLiftConveyorDeviceDriver()).setDevice(device).setDriverDefination(this); - } - - @Override - public Class getDeviceDriverType() { - return CargoLiftConveyorDeviceDriver.class; - } - - @Override - public List getFitDeviceTypes() { - List types = new LinkedList(); - types.add(DeviceType.conveyor); - return types; - } - - @Override - public List getReadableItemDtos() { - return ItemProtocol.getReadableItemDtos(); - } - - @Override - public List getWriteableItemDtos() { - return ItemProtocol.getWriteableItemDtos(); - } - -} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_conveyor/HongXiangStationDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_conveyor/HongXiangStationDeviceDriver.java index 71f1fea..cbf7b35 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_conveyor/HongXiangStationDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_conveyor/HongXiangStationDeviceDriver.java @@ -179,30 +179,7 @@ public class HongXiangStationDeviceDriver extends AbstractOpcDeviceDriver implem this.control(itemMap); } - public void writing(int type, int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_task; - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (type == 1) { - itemMap.put(to_command, command); - log.info("设备:" + device_code + ",下发PLC信号" + to_command + ",value:" + command); - } else if (type == 2) { - itemMap.put(to_target, command); - log.info("设备:" + device_code + ",下发PLC信号" + to_target + ",value:" + command); - } else if (type == 3) { - itemMap.put(to_task, command); - log.info("设备:" + device_code + ",下发PLC信号" + to_task + ",value:" + command); - } - - this.control(itemMap); - } @Override public JSONObject getDeviceStatusName() { diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java index 02f1700..4b9a345 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/hongxiang_device/HongXiangConveyorDeviceDriver.java @@ -261,31 +261,6 @@ public class HongXiangConveyorDeviceDriver extends AbstractOpcDeviceDriver imple } - public void writing(int type, int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_command; - String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_target; - String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.ItemProtocol.item_to_task; - //String opcservcerid = this.getDevice().getOpc_server_id(); -//Server server = ReadUtil.getServer(opcservcerid); - Map itemMap = new HashMap(); - if (type == 1) { - itemMap.put(to_command, command); - log.info("设备:" + device_code + ",下发PLC信号" + to_command + ",value:" + command); - } else if (type == 2) { - itemMap.put(to_target, command); - log.info("设备:" + device_code + ",下发PLC信号" + to_target + ",value:" + command); - - } else if (type == 3) { - itemMap.put(to_task, command); - log.info("设备:" + device_code + ",下发PLC信号" + to_task + ",value:" + command); - } - - this.control(itemMap); - } - @Override public JSONObject getDeviceStatusName() { JSONObject jo = new JSONObject(); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/lnsh_station/LnshStationDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/lnsh_station/LnshStationDeviceDriver.java index 306ce90..e1cd063 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/lnsh_station/LnshStationDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/lnsh_station/LnshStationDeviceDriver.java @@ -163,16 +163,16 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements request.setRequest_medthod_code(RequestMethodEnum.real_time_set_point.getCode()); request.setRequest_medthod_name(RequestMethodEnum.real_time_set_point.getName()); request.setMove(String.valueOf(move)); - ApplySignalStatusResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)), ApplySignalStatusResponse.class); +// ApplySignalStatusResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)), ApplySignalStatusResponse.class); message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求LMS..."; //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); - if (resp.getCode() == 200) { - message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求成功" + resp.getMessage(); - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(request))); - } else { - message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求失败" + resp.getMessage();; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(request))); - } +// if (resp.getCode() == 200) { +// message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求成功" + resp.getMessage(); +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(request))); +// } else { +// message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求失败" + resp.getMessage();; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(request))); +// } } } if (error != last_error) { @@ -192,24 +192,24 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements logServer.deviceExecuteLog(this.device_code, "", "", "信号action:" + last_action + " -> " + action); lucene.deviceItemValue(this.device_code, "action", String.valueOf(action)); //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "信号action:" + last_action + " -> " + action)); - if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) { - ApplySignalStatusRequest request = new ApplySignalStatusRequest(); - request.setDevice_code(this.getDevice_code()); - request.setRequest_medthod_code(RequestMethodEnum.real_time_set_point.getCode()); - request.setRequest_medthod_name(RequestMethodEnum.real_time_set_point.getName()); - request.setAction(String.valueOf(action)); - ApplySignalStatusResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)), ApplySignalStatusResponse.class); - message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); - - if (resp.getCode() == 200) { - message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求成功" + resp.getMessage();; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(request))); - } else { - message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求失败" + resp.getMessage();; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(request))); - } - } +// if ("true".equals(this.device.getExtraValue().get("sendDeviceStatus"))) { +// ApplySignalStatusRequest request = new ApplySignalStatusRequest(); +// request.setDevice_code(this.getDevice_code()); +// request.setRequest_medthod_code(RequestMethodEnum.real_time_set_point.getCode()); +// request.setRequest_medthod_name(RequestMethodEnum.real_time_set_point.getName()); +// request.setAction(String.valueOf(action)); +// ApplySignalStatusResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)), ApplySignalStatusResponse.class); +// message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); +// +// if (resp.getCode() == 200) { +// message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求成功" + resp.getMessage();; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(request))); +// } else { +// message = RequestMethodEnum.getName("real_time_set_point") + "real_time_set_point 接口请求失败" + resp.getMessage();; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(request))); +// } +// } } if (io_action != last_ioaction) { logServer.deviceItemValue(this.device_code, "io_action", String.valueOf(io_action)); @@ -473,75 +473,75 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements * * @param */ - public synchronized boolean apply_put_full_vehicle() { - if(move == 0) { - ApplyTaskRequest request = new ApplyTaskRequest(); - request.setDevice_code(this.getDevice_code()); - request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); - request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); - request.setWeight(String.valueOf(weight)); - request.setVehicle_code(String.valueOf(barcode)); - message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 接口请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); - ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); - if (resp.getCode() == 200) { - Map map = new LinkedHashMap<>(); - map.put("to_command",200); - this.writing(map); - this.setRequireSucess(true); - } else { - Map map = new LinkedHashMap<>(); - map.put("to_command",400); - this.writing(map); - message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 接口请求失败" + resp.getMessage();; - } - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); - return true; - } else { - message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 设备有货未请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); - return false; - } - } +// public synchronized boolean apply_put_full_vehicle() { +// if(move == 0) { +// ApplyTaskRequest request = new ApplyTaskRequest(); +// request.setDevice_code(this.getDevice_code()); +// request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); +// request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); +// request.setWeight(String.valueOf(weight)); +// request.setVehicle_code(String.valueOf(barcode)); +// message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 接口请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); +// ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); +// if (resp.getCode() == 200) { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",200); +// this.writing(map); +// this.setRequireSucess(true); +// } else { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",400); +// this.writing(map); +// message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 接口请求失败" + resp.getMessage();; +// } +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); +// return true; +// } else { +// message = RequestMethodEnum.getName("apply_put_full_vehicle") + "apply_put_full_vehicle 设备有货未请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); +// return false; +// } +// } /** * 申请补空料盅托盘 * * @param */ - public synchronized boolean apply_put_empty_vehicle() { - if(move == 0) { - ApplyTaskRequest request = new ApplyTaskRequest(); - request.setDevice_code(this.getDevice_code()); - request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); - request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); - request.setWeight(String.valueOf(weight)); - request.setVehicle_code(String.valueOf(barcode)); - ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); - message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); - - if (resp.getCode() == 200) { - Map map = new LinkedHashMap<>(); - map.put("to_command",200); - this.writing(map); - this.setRequireSucess(true); - message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求成功" + resp.getMessage(); - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp))); - } else { - Map map = new LinkedHashMap<>(); - map.put("to_command",400); - this.writing(map); - message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求失败" + resp.getMessage(); - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp))); - } - return true; - } else { - message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 设备有货未请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); - return false; - } - } +// public synchronized boolean apply_put_empty_vehicle() { +// if(move == 0) { +// ApplyTaskRequest request = new ApplyTaskRequest(); +// request.setDevice_code(this.getDevice_code()); +// request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); +// request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); +// request.setWeight(String.valueOf(weight)); +// request.setVehicle_code(String.valueOf(barcode)); +// ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); +// message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); +// +// if (resp.getCode() == 200) { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",200); +// this.writing(map); +// this.setRequireSucess(true); +// message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求成功" + resp.getMessage(); +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp))); +// } else { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",400); +// this.writing(map); +// message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 接口请求失败" + resp.getMessage(); +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp))); +// } +// return true; +// } else { +// message = RequestMethodEnum.getName("apply_put_empty_vehicle") + "apply_put_empty_vehicle 设备有货未请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); +// return false; +// } +// } /** * 申请取走空料盅托盘 @@ -549,34 +549,34 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements * @param */ public synchronized boolean apply_take_empty_vehicle() { - if(move == 1) { - ApplyTaskRequest request = new ApplyTaskRequest(); - request.setDevice_code(this.getDevice_code()); - request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); - request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); - request.setWeight(String.valueOf(weight)); - request.setVehicle_code(String.valueOf(barcode)); - ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); - message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 接口请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); - - if (resp.getCode() == 200) { - Map map = new LinkedHashMap<>(); - map.put("to_command",200); - this.writing(map); - this.setRequireSucess(true); - } else { - Map map = new LinkedHashMap<>(); - map.put("to_command",400); - this.writing(map); - message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 接口请求失败" + resp.getMessage();; - } - return true; - } else { +// if(move == 1) { +// ApplyTaskRequest request = new ApplyTaskRequest(); +// request.setDevice_code(this.getDevice_code()); +// request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); +// request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); +// request.setWeight(String.valueOf(weight)); +// request.setVehicle_code(String.valueOf(barcode)); +// ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); +// message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 接口请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); +// +// if (resp.getCode() == 200) { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",200); +// this.writing(map); +// this.setRequireSucess(true); +// } else { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",400); +// this.writing(map); +// message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 接口请求失败" + resp.getMessage();; +// } +// return true; +// } else { message = RequestMethodEnum.getName("apply_take_empty_vehicle") + "apply_take_empty_vehicle 设备无货未请求LMS..."; //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); return false; - } +// } } @@ -585,261 +585,261 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements * * @param */ - public synchronized boolean apply_take_full_vehicle() { - if(move > 0&& barcode>0) { - ApplyTaskRequest request = new ApplyTaskRequest(); - request.setDevice_code(this.getDevice_code()); - request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); - request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); - request.setMaterial_code(material); - request.setWeight(String.valueOf(weight)); - request.setVehicle_code(String.valueOf(barcode)); - if(ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))){ - Device device = deviceAppService.findDeviceByCode(this.getDevice().getExtraValue().get("link_device_code").toString()); - } - ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); - message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); - - if (resp.getCode() == 200) { - Map map = new LinkedHashMap<>(); - map.put("to_command",200); - this.writing(map); - this.setRequireSucess(true); - message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求成功" + resp.getMessage(); - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp))); - } else { - Map map = new LinkedHashMap<>(); - map.put("to_command",400); - this.writing(map); - message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求失败" + resp.getMessage(); - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp))); - } - return true; - } else if(move==0) { - message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 设备无货未请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); - }else if(barcode<=0){ - message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 设备条码不正确未请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); - } - return false; - } +// public synchronized boolean apply_take_full_vehicle() { +// if(move > 0&& barcode>0) { +// ApplyTaskRequest request = new ApplyTaskRequest(); +// request.setDevice_code(this.getDevice_code()); +// request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); +// request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); +// request.setMaterial_code(material); +// request.setWeight(String.valueOf(weight)); +// request.setVehicle_code(String.valueOf(barcode)); +// if(ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))){ +// Device device = deviceAppService.findDeviceByCode(this.getDevice().getExtraValue().get("link_device_code").toString()); +// } +// ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); +// message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); +// +// if (resp.getCode() == 200) { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",200); +// this.writing(map); +// this.setRequireSucess(true); +// message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求成功" + resp.getMessage(); +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp))); +// } else { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",400); +// this.writing(map); +// message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 接口请求失败" + resp.getMessage(); +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp))); +// } +// return true; +// } else if(move==0) { +// message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 设备无货未请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); +// }else if(barcode<=0){ +// message = RequestMethodEnum.getName("apply_take_full_vehicle") + "apply_take_full_vehicle 设备条码不正确未请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); +// } +// return false; +// } /** * 申请强制取走满料盅托盘 * * @param */ - public synchronized boolean apply_force_take_full_vehicle() { - if(move > 0) { - ApplyTaskRequest request = new ApplyTaskRequest(); - request.setDevice_code(this.getDevice_code()); - request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); - request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); - request.setWeight(String.valueOf(weight)); - request.setVehicle_code(String.valueOf(barcode)); - ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); - message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 接口请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); - - if (resp.getCode() == 200) { - Map map = new LinkedHashMap<>(); - map.put("to_command",200); - this.writing(map); - this.setRequireSucess(true); - } else { - Map map = new LinkedHashMap<>(); - map.put("to_command",400); - this.writing(map); - message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 接口请求失败" + resp.getMessage();; - } - return true; - } else { - message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 设备无货未请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); - return false; - } - } +// public synchronized boolean apply_force_take_full_vehicle() { +// if(move > 0) { +// ApplyTaskRequest request = new ApplyTaskRequest(); +// request.setDevice_code(this.getDevice_code()); +// request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); +// request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); +// request.setWeight(String.valueOf(weight)); +// request.setVehicle_code(String.valueOf(barcode)); +// ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); +// message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 接口请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); +// +// if (resp.getCode() == 200) { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",200); +// this.writing(map); +// this.setRequireSucess(true); +// } else { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",400); +// this.writing(map); +// message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 接口请求失败" + resp.getMessage();; +// } +// return true; +// } else { +// message = RequestMethodEnum.getName("apply_force_take_full_vehicle") + "apply_force_take_full_vehicle 设备无货未请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); +// return false; +// } +// } /** * 申请强制满托入缓存 * * @param */ - public synchronized boolean apply_force_take_full_vehicle_in_storage() { - if(move > 0) { - ApplyTaskRequest request = new ApplyTaskRequest(); - request.setDevice_code(this.getDevice_code()); - request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); - request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); - request.setWeight(String.valueOf(weight)); - request.setVehicle_code(String.valueOf(barcode)); - ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); - message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 接口请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); - - if (resp.getCode() == 200) { - Map map = new LinkedHashMap<>(); - map.put("to_command",200); - this.writing(map); - this.setRequireSucess(true); - } else { - Map map = new LinkedHashMap<>(); - map.put("to_command",400); - this.writing(map); - message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 接口请求失败" + resp.getMessage();; - } - return true; - } else { - message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 设备无货未请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); - return false; - } - } +// public synchronized boolean apply_force_take_full_vehicle_in_storage() { +// if(move > 0) { +// ApplyTaskRequest request = new ApplyTaskRequest(); +// request.setDevice_code(this.getDevice_code()); +// request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); +// request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); +// request.setWeight(String.valueOf(weight)); +// request.setVehicle_code(String.valueOf(barcode)); +// ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); +// message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 接口请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); +// +// if (resp.getCode() == 200) { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",200); +// this.writing(map); +// this.setRequireSucess(true); +// } else { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",400); +// this.writing(map); +// message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 接口请求失败" + resp.getMessage();; +// } +// return true; +// } else { +// message = RequestMethodEnum.getName("apply_force_take_full_vehicle_in_storage") + "apply_force_take_full_vehicle_in_storage 设备无货未请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); +// return false; +// } +// } /** * 扫码成功申请 * * @param */ - public synchronized boolean barcode_success_apply() { - if(move > 0) { - ApplyTaskRequest request = new ApplyTaskRequest(); - request.setDevice_code(this.getDevice_code()); - request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); - request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); - request.setWeight(String.valueOf(weight)); - request.setVehicle_code(String.valueOf(barcode)); - ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); - message = RequestMethodEnum.getName("barcode_success_apply") + "barcode_success_apply 接口请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); - - if (resp.getCode() == 200) { - Map map = new LinkedHashMap<>(); - map.put("to_command",200); - this.writing(map); - this.setRequireSucess(true); - message = RequestMethodEnum.getName("barcode_success_apply") + "barcode_success_apply 接口请求成功" + resp.getMessage(); - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp))); - } else { - Map map = new LinkedHashMap<>(); - map.put("to_command",400); - this.writing(map); - message = RequestMethodEnum.getName("barcode_success_apply") + "barcode_success_apply 接口请求失败" + resp.getMessage(); - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp))); - } - return true; - } else { - message = RequestMethodEnum.getName("barcode_success_apply") + "barcode_success_apply 设备无货未请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); - return false; - } - } +// public synchronized boolean barcode_success_apply() { +// if(move > 0) { +// ApplyTaskRequest request = new ApplyTaskRequest(); +// request.setDevice_code(this.getDevice_code()); +// request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); +// request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); +// request.setWeight(String.valueOf(weight)); +// request.setVehicle_code(String.valueOf(barcode)); +// ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); +// message = RequestMethodEnum.getName("barcode_success_apply") + "barcode_success_apply 接口请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); +// +// if (resp.getCode() == 200) { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",200); +// this.writing(map); +// this.setRequireSucess(true); +// message = RequestMethodEnum.getName("barcode_success_apply") + "barcode_success_apply 接口请求成功" + resp.getMessage(); +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp))); +// } else { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",400); +// this.writing(map); +// message = RequestMethodEnum.getName("barcode_success_apply") + "barcode_success_apply 接口请求失败" + resp.getMessage(); +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "返回参数:" + JSON.toJSONString(resp))); +// } +// return true; +// } else { +// message = RequestMethodEnum.getName("barcode_success_apply") + "barcode_success_apply 设备无货未请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); +// return false; +// } +// } /** * 获取组盘信息 * * @param */ - public synchronized boolean get_vehicle_info() { - if(move > 0) { - ApplyTaskRequest request = new ApplyTaskRequest(); - request.setDevice_code(this.getDevice_code()); - request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); - request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); - request.setWeight(String.valueOf(weight)); - request.setVehicle_code(String.valueOf(barcode)); - ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); - message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 接口请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); - - if (resp.getCode() == 200) { - Map map = new LinkedHashMap<>(); - map.put("to_command",200); - this.writing(map); - this.setRequireSucess(true); - } else { - Map map = new LinkedHashMap<>(); - map.put("to_command",400); - this.writing(map); - message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 接口请求失败" + resp.getMessage();; - } - return true; - } else { - message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 设备无货未请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); - return false; - } - - } +// public synchronized boolean get_vehicle_info() { +// if(move > 0) { +// ApplyTaskRequest request = new ApplyTaskRequest(); +// request.setDevice_code(this.getDevice_code()); +// request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); +// request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); +// request.setWeight(String.valueOf(weight)); +// request.setVehicle_code(String.valueOf(barcode)); +// ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); +// message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 接口请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); +// +// if (resp.getCode() == 200) { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",200); +// this.writing(map); +// this.setRequireSucess(true); +// } else { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",400); +// this.writing(map); +// message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 接口请求失败" + resp.getMessage();; +// } +// return true; +// } else { +// message = RequestMethodEnum.getName("get_vehicle_info") + "get_vehicle_info 设备无货未请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); +// return false; +// } +// +// } /** * 强制去包装-不包装 */ - public synchronized boolean force_no_package() { - if(move > 0) { - ApplyTaskRequest request = new ApplyTaskRequest(); - request.setDevice_code(this.getDevice_code()); - request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); - request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); - request.setWeight(String.valueOf(weight)); - request.setVehicle_code(String.valueOf(barcode)); - ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); - message = RequestMethodEnum.getName("force_no_package") + "force_no_package 接口请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); - - if (resp.getCode() == 200) { - Map map = new LinkedHashMap<>(); - map.put("to_command",200); - this.writing(map); - this.setRequireSucess(true); - } else { - Map map = new LinkedHashMap<>(); - map.put("to_command",400); - this.writing(map); - message = RequestMethodEnum.getName("force_no_package") + "force_no_package 接口请求失败" + resp.getMessage();; - } - return true; - } else { - message = RequestMethodEnum.getName("force_no_package") + "force_no_package 设备无货未请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); - return false; - } - } +// public synchronized boolean force_no_package() { +// if(move > 0) { +// ApplyTaskRequest request = new ApplyTaskRequest(); +// request.setDevice_code(this.getDevice_code()); +// request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); +// request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); +// request.setWeight(String.valueOf(weight)); +// request.setVehicle_code(String.valueOf(barcode)); +// ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); +// message = RequestMethodEnum.getName("force_no_package") + "force_no_package 接口请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); +// +// if (resp.getCode() == 200) { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",200); +// this.writing(map); +// this.setRequireSucess(true); +// } else { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",400); +// this.writing(map); +// message = RequestMethodEnum.getName("force_no_package") + "force_no_package 接口请求失败" + resp.getMessage();; +// } +// return true; +// } else { +// message = RequestMethodEnum.getName("force_no_package") + "force_no_package 设备无货未请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); +// return false; +// } +// } /** * 申请贴标 */ - public synchronized boolean apply_labelling() { - if(move > 0) { - ApplyTaskRequest request = new ApplyTaskRequest(); - request.setDevice_code(this.getDevice_code()); - request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); - request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); - request.setWeight(String.valueOf(weight)); - request.setVehicle_code(String.valueOf(barcode)); - ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); - message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 接口请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); - - if (resp.getCode() == 200) { - Map map = new LinkedHashMap<>(); - map.put("to_command",200); - this.writing(map); - this.setRequireSucess(true); - } else { - Map map = new LinkedHashMap<>(); - map.put("to_command",400); - this.writing(map); - message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 接口请求失败" + resp.getMessage();; - } - return true; - } else { - message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 设备无货未请求LMS..."; - //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); - return false; - } - } +// public synchronized boolean apply_labelling() { +// if(move > 0) { +// ApplyTaskRequest request = new ApplyTaskRequest(); +// request.setDevice_code(this.getDevice_code()); +// request.setRequest_medthod_code(Thread.currentThread().getStackTrace()[1].getMethodName()); +// request.setRequest_medthod_name(RequestMethodEnum.getName(Thread.currentThread().getStackTrace()[1].getMethodName())); +// request.setWeight(String.valueOf(weight)); +// request.setVehicle_code(String.valueOf(barcode)); +// ApplyTaskResponse resp = JSON.toJavaObject(JSONObject.parseObject(acsToWmsService.applyTask(request)),ApplyTaskResponse.class); +// message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 接口请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message + "参数:" + JSON.toJSONString(request))); +// +// if (resp.getCode() == 200) { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",200); +// this.writing(map); +// this.setRequireSucess(true); +// } else { +// Map map = new LinkedHashMap<>(); +// map.put("to_command",400); +// this.writing(map); +// message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 接口请求失败" + resp.getMessage();; +// } +// return true; +// } else { +// message = RequestMethodEnum.getName("apply_labelling") + "apply_labelling 设备无货未请求LMS..."; +// //lucene.deviceExecuteLog(new LuceneLogDto(this.device_code, message)); +// return false; +// } +// } } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java index 6343e16..63053aa 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.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.custompolicy.server.CustomPolicyService; import org.nl.acs.device.domain.Device; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; @@ -62,6 +63,11 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); @Autowired ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class); + + @Autowired + CustomPolicyService customPolicyService = SpringContextHolder.getBean(CustomPolicyService.class); + + @Autowired TaskMapper taskMapper; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java index 2458386..b3cccb5 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java @@ -435,42 +435,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp * @param */ public synchronized boolean apply(Integer type) { - Date date = new Date(); - if (date.getTime() - this.time.getTime() < (long) this.instruction_require_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.time); - return false; - } else { - this.time = date; - FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest(); - request.setDevice_code(devicecode); - request.setMaterial_type(String.valueOf(material_type)); - request.setVehicle_code(String.valueOf(barcode)); - if (devicecode.startsWith("TBX")&&type==5&&barcode>0) { - //满架下料 - request.setRequest_medthod_code(RequestMethodEnum.apply_mjxl.getCode()); - request.setRequest_medthod_name(RequestMethodEnum.apply_mjxl.getName()); - }else if (devicecode.startsWith("TBX")&&type==6) { - //补空架 - request.setRequest_medthod_code(RequestMethodEnum.apply_tbxbkj.getCode()); - request.setRequest_medthod_name(RequestMethodEnum.apply_tbxbkj.getName()); - }else if (type==7) { - //空托盘出库,包片机和销售出库空位都可以 - request.setRequest_medthod_code(RequestMethodEnum.apply_kghjrk.getCode()); - request.setRequest_medthod_name(RequestMethodEnum.apply_kghjrk.getName()); - }else if(devicecode.startsWith("BP")&&material_type>0){ - request.setRequest_medthod_code(RequestMethodEnum.apply_bpsl.getCode()); - request.setRequest_medthod_name(RequestMethodEnum.apply_bpsl.getName()); - } - String resp = acsToWmsService.applyTask(request); - JSONObject res_jo = JSONObject.parseObject(resp); - if (StrUtil.equals(res_jo.getString("code"), "200")) { - this.writing(type); - this.setRequireSucess(true); - log.info("acs申请任务", this.devicecode, "满盅入库任务申请成功!"); - }else{ - this.writing(99); - } - return true; - } + return false; } } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java index ffc0c17..e03dfeb 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java @@ -31,61 +31,13 @@ import java.util.Map; public class AcsToWmsController { private final AcsToWmsService acstowmsService; - @PostMapping("/applyTask") - @Log("向WMS申请任务") - @ApiOperation("向WMS申请任务") - public ResponseEntity applyTaskToWms(@RequestBody String device_code, String container_code, int height, int weight) { - return new ResponseEntity<>(acstowmsService.applyTaskToWms(device_code, container_code, height, weight), HttpStatus.OK); - } +// @PostMapping("/applyTask") +// @Log("向WMS申请任务") +// @ApiOperation("向WMS申请任务") +// public ResponseEntity applyTaskToWms(@RequestBody String device_code, String container_code, int height, int weight) { +// return new ResponseEntity<>(acstowmsService.applyTaskToWms(device_code, container_code, height, weight), HttpStatus.OK); +// } - @PostMapping("/applyTaskManipulator") - @Log("向WMS申请机械手任务") - @ApiOperation("向WMS申请机械手任务") - public ResponseEntity applyTaskManipulatorToWms(@RequestBody JSONObject json) { - return new ResponseEntity<>(acstowmsService.applyTaskManipulatorToWms(json), HttpStatus.OK); - } - - @PostMapping("/getVehicle") - @Log("获取托盘信息") - @ApiOperation("获取托盘信息") - public ResponseEntity getVehicle(@RequestBody JSONObject json) { - return new ResponseEntity<>(acstowmsService.getVehicle(json), HttpStatus.OK); - } - - @PostMapping("/getVehicleTokiln") - @Log("获取入窑托盘信息") - @ApiOperation("获取入窑托盘信息") - public ResponseEntity getVehicleTokiln(@RequestBody JSONObject json) { - return new ResponseEntity<>(acstowmsService.getVehicleTokiln(json), HttpStatus.OK); - } - - @PostMapping("/outKiln") - @Log("出窑请求") - @ApiOperation("出窑请求") - public ResponseEntity outKiln(@RequestBody JSONObject json) { - return new ResponseEntity<>(acstowmsService.outKiln(json), HttpStatus.OK); - } - - @PostMapping("/enterOrder") - @Log("排产单确认") - @ApiOperation("排产单确认") - public ResponseEntity enterOrder(@RequestBody JSONObject json) { - return new ResponseEntity<>(acstowmsService.enterOrder(json), HttpStatus.OK); - } - - @PostMapping("/getVehicleCode") - @Log("获取托盘号") - @ApiOperation("获取托盘号") - public ResponseEntity getVehicleCode(@RequestBody String device_code) { - return new ResponseEntity<>(acstowmsService.getVehicleCode(device_code), HttpStatus.OK); - } - - @PostMapping("/getVehiclePoint") - @Log("获取托盘点位") - @ApiOperation("获取托盘点位") - public ResponseEntity getVehiclePoint(@RequestBody String vehicle_code) { - return new ResponseEntity<>(acstowmsService.getVehiclePoint(vehicle_code), HttpStatus.OK); - } @PostMapping("/taskStatusFeedback") @Log("向WMS反馈任务状态") @@ -95,12 +47,6 @@ public class AcsToWmsController { return new ResponseEntity<>(acstowmsService.feedbackTaskStatusToWms(data), HttpStatus.OK); } - @PostMapping("/pointStatusFeedback") - @Log("向WMS反馈点位状态") - @ApiOperation("向WMS反馈点位状态") - public ResponseEntity feedbackPointStatusToWms(@RequestBody Map whereJson) { - return new ResponseEntity<>(acstowmsService.feedbackPointStatusToWms(whereJson), HttpStatus.OK); - } @PostMapping("/feedbackAgvStatus") @Log("反馈AGV设备状态") @@ -116,10 +62,4 @@ public class AcsToWmsController { return new ResponseEntity<>(acstowmsService.feedbackAgv(from), HttpStatus.OK); } - @PostMapping("/feedbackDeviceStatus") - @Log("反馈设备状态") - @ApiOperation("反馈设备状态") - public ResponseEntity feedbackDeviceStatus(@RequestBody String device_code, String code, String value) { - return new ResponseEntity<>(acstowmsService.feedbackDeviceStatus(device_code, code, value), HttpStatus.OK); - } } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index b01351c..1318ddf 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -32,14 +32,6 @@ public interface AcsToWmsService { */ HttpResponse feedbackAgvStatus(String device_code, String error, String error_message); - /** - * 反馈AGV设备状态 - * - * @param device_code - * @return - */ - HttpResponse feedbackDeviceStatus(String device_code, String state); - /** * 反馈AGV设备信息 * @@ -66,29 +58,7 @@ public interface AcsToWmsService { HttpResponse queryDoorsStatus(); - /** - * 反馈工单状态 - * - * @param param - * @return - */ - HttpResponse feedbackOrderStatus(JSONObject param); - /** - * ACS申请缓存线入库任务 - * - * @param param - * @return - */ - HttpResponse applyInCacheLineTask(JSONObject param); - - /** - * ACS系统申请出库任务 - * - * @param param - * @return - */ - HttpResponse applyOutCacheLineTask(JSONObject param); /** * 申请捆扎、贴标 @@ -98,10 +68,6 @@ public interface AcsToWmsService { */ ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param); - LiKuApplyTakResponse liKuApplyTaskRequest(LiKuApplyTaskRequest liKuApplyTaskRequest); - - UpdateLKTaskResponse updateLKTaskRequest(UpdateLKTaskRequest updateLKTaskRequest); - // 输送线有货变成无货时向lms请求 HttpResponse shipDeviceUpdate(JSONObject param); @@ -128,8 +94,4 @@ public interface AcsToWmsService { */ String notify(BaseRequest request); - /** - * 任务阶段反馈最新点位 - */ - String feedbackState(BaseRequest request); } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 777da4e..c0bc76a 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -16,7 +16,8 @@ import org.nl.acs.address.service.AddressService; import org.nl.acs.address.service.dto.AddressDto; import org.nl.acs.device.service.DeviceService; import org.nl.acs.ext.wms.LmsUtil; -import org.nl.acs.ext.wms.data.BaseRequest; +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.data.one.*; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.log.service.DeviceExecuteLogService; @@ -56,1027 +57,70 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { private String log_file_type="log_file_type"; private String log_type="ACS请求LMS"; - @Override - public String applyTaskToWms(String device_code, String container_code, int height, int weight) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyTaskToWms"); - String url = wmsurl + addressDto.getMethods_url(); - - JSONObject param = new JSONObject(); - param.put("height", height); - param.put("weight", weight); - String parent_device_code = ""; - JSONObject jo = new JSONObject(); - JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + device_code + "'").uniqueResult(0); - if (!device_json.isEmpty()) { - parent_device_code = (String) device_json.get("parent_storage_cell") == null ? device_code : (String) device_json.get("parent_storage_cell"); - } - jo.put("device_code", parent_device_code); - jo.put("container_code", container_code); - jo.put("param", param); - log.info("applyTaskToWms - 请求参数 {}", jo.toString()); - HttpResponse result2 = null; - try { - //{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"} - result2 = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(jo)) - .execute(); - System.out.println(result2); - log.info("applyTaskToWms - 返回参数 {}", result2.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - String type = ""; - if (result2.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } -// logServer.log("", "applyTaskToWms", type, jo.toString(), result2.body(), String.valueOf(result2.getStatus()), url, container_code); - return result2.body(); - } finally { - MDC.remove(log_file_type); - } - - } @Override - public HttpResponse applyTaskManipulatorToWms(JSONObject json) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyTaskManipulatorToWms"); - String url = wmsurl + addressDto.getMethods_url(); - - String device_code = json.getString("device_code"); - - String parent_device_code = ""; - JSONObject jo = new JSONObject(); -// JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + device_code + "'").uniqueResult(0); -// if (!device_json.isEmpty()) { -// parent_device_code = (String) device_json.get("parent_storage_cell") == null ? device_code : (String) device_json.get("parent_storage_cell"); -// } -// jo.put("device_code", parent_device_code); - - log.info("applyTaskManipulatorToWms - 请求参数 {}", json.toString()); - HttpResponse result2 = null; - try { - //{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"} - result2 = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(json)) - .execute(); - System.out.println(result2); - log.info("applyTaskManipulatorToWms - 返回参数 {}", result2.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result2; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public HttpResponse applyOuttoKiln(JSONObject json) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("ispackage"); - String url = wmsurl + addressDto.getMethods_url(); - - String device_code = json.getString("device_code"); - - String parent_device_code = ""; - JSONObject jo = new JSONObject(); - JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + device_code + "'").uniqueResult(0); - if (!device_json.isEmpty()) { - parent_device_code = (String) device_json.get("parent_storage_cell") == null ? device_code : (String) device_json.get("parent_storage_cell"); - } - jo.put("device_code", parent_device_code); - jo.putAll(json); - - log.info("applyOuttoKiln - 请求参数 {}", jo.toString()); - HttpResponse result2 = null; - try { - //{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"} - result2 = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(jo)) - .execute(); - System.out.println(result2); - log.info("applyOuttoKiln - 返回参数 {}", result2.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result2; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public HttpResponse applyIntoKiln(JSONObject json) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("applyIntoKiln"); - String url = wmsurl + addressDto.getMethods_url(); - - String device_code = json.getString("device_code"); - - String parent_device_code = ""; - JSONObject jo = new JSONObject(); - JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + device_code + "'").uniqueResult(0); - if (!device_json.isEmpty()) { - parent_device_code = (String) device_json.get("parent_storage_cell") == null ? device_code : (String) device_json.get("parent_storage_cell"); - } - jo.put("device_code", parent_device_code); - jo.putAll(json); - - log.info("lnshApplyTaskToWms - 请求参数 {}", jo.toString()); - HttpResponse result2 = null; - try { - //{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"} - result2 = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(jo)) - .execute(); - System.out.println(result2); - log.info("lnshApplyTaskToWms - 返回参数 {}", result2.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result2; - } finally { - MDC.remove(log_file_type); - } - - } - - - @Override - public HttpResponse applyBarcode(JSONObject json) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("getVehicleInfoBycode"); - String url = wmsurl + addressDto.getMethods_url(); - - String device_code = json.getString("device_code"); - - String parent_device_code = ""; - JSONObject jo = new JSONObject(); - JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + device_code + "'").uniqueResult(0); - if (!device_json.isEmpty()) { - parent_device_code = (String) device_json.get("parent_storage_cell") == null ? device_code : (String) device_json.get("parent_storage_cell"); - } - jo.put("device_code", parent_device_code); - jo.putAll(json); - - log.info("lnshApplyTaskToWms - 请求参数 {}", jo.toString()); - HttpResponse result2 = null; - try { - //{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"} - result2 = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(jo)) - .execute(); - System.out.println(result2); - log.info("lnshApplyTaskToWms - 返回参数 {}", result2.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result2; - } finally { - MDC.remove(log_file_type); - } - - } - - - - @Override - public String applyTask(BaseRequest requestParam) { - try { - MDC.put(log_file_type, log_type); - String api = addressService.findByCode("lnshApplyTaskToWms").getMethods_url(); - log.info("lnshApplyTaskToWms-----输入参数{}", JSON.toJSONString(requestParam, SerializerFeature.DisableCircularReferenceDetect)); - String result = LmsUtil.notifyAcs(api, requestParam); - log.info("lnshApplyTaskToWms-----输出参数{}", result); - return result; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public HttpResponse lnshApplyTaskToWms(JSONObject json) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("lnshApplyTaskToWms"); - String url = wmsurl + addressDto.getMethods_url(); - - String device_code = json.getString("device_code"); - - String parent_device_code = ""; - JSONObject jo = new JSONObject(); - JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + device_code + "'").uniqueResult(0); - if (!device_json.isEmpty()) { - parent_device_code = (String) device_json.get("parent_storage_cell") == null ? device_code : (String) device_json.get("parent_storage_cell"); - } - jo.put("device_code", parent_device_code); - jo.putAll(json); - - log.info("lnshApplyTaskToWms - 请求参数 {}", jo.toString()); - HttpResponse result2 = null; - try { - //{"status":400,"timestamp":"2021-10-22 16:32:22","message":"业务类型不正确!"} - result2 = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(jo)) - .execute(); - System.out.println(result2); - log.info("lnshApplyTaskToWms - 返回参数 {}", result2.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result2; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public HttpResponse getVehicle(JSONObject json) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("getVehicle"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - - log.info("getVehicle - 请求参数 {}", json.toString()); - HttpResponse result = null; - try { - result = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("getVehicle - 返回参数 {}", result.body()); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - - return result; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public JSONObject getVehicleTokiln(JSONObject json) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("getVehicleTokiln"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - - log.info("getVehicleTokiln - 请求参数 {}", json.toString()); - HttpResponse result = null; - try { - result = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("getVehicleTokiln - 返回参数 {}", result.body()); - return JSONObject.parseObject(result.body()); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - return null; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public HttpResponse inKiln(JSONObject json) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("inKiln"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - - log.info("inKiln - 请求参数 {}", json.toString()); - HttpResponse result = null; - try { - result = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("inKiln - 返回参数 {}", result.body()); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - return result; - - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public HttpResponse outKiln(JSONObject json) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("outKiln"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - - - log.info("outKiln - 请求参数 {}", json.toString()); - HttpResponse result = null; - try { - result = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("outKiln - 返回参数 {}", result.body()); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - return result; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public HttpResponse enterOrder(JSONObject json) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("enterOrder"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - - log.info("enterOrder - 请求参数 {}", json.toString()); - HttpResponse result = null; - try { - result = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("enterOrder - 返回参数 {}", result.body()); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - return result; - - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public JSONObject getVehicleCode(String device_code) { - try { - MDC.put(log_file_type, log_type); - - } finally { - MDC.remove(log_file_type); - } - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("getVehicleCode"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - - JSONObject json = new JSONObject(); - json.put("device_code", device_code); - - log.info("getVehicleCode - 请求参数 {}", json.toString()); - HttpResponse result = null; - try { - result = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("getVehicleCode - 返回参数 {}", result.body()); - return JSONObject.parseObject(result.body()); - } catch (Exception e) { - System.out.println(e.getMessage()); - } + public String applyTaskToWms(JSONObject jo) { return null; } @Override - public JSONObject getVehiclePoint(String vehicle_code) { - try { - MDC.put(log_file_type, log_type); - - } finally { - MDC.remove(log_file_type); - } - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("getVehiclePoint"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - - JSONObject json = new JSONObject(); - json.put("vehicle_code", vehicle_code); - - log.info("getVehiclePoint - 请求参数 {}", json.toString()); - HttpResponse result = null; - try { - result = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("getVehiclePoint - 返回参数 {}", result.body()); - return JSONObject.parseObject(result.body()); - } catch (Exception e) { - System.out.println(e.getMessage()); - } + public HttpResponse feedbackTaskStatusToWms(JSONArray arr) { return null; } - @Override - public HttpResponse feedbackTaskStatusToWms(JSONArray data) { - try { - MDC.put(log_file_type, log_type); - - } finally { - MDC.remove(log_file_type); - } - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - - String task_code = ""; - for (int i = 0; i < data.size(); i++) { - JSONObject json = (JSONObject) data.get(i); - task_code = json.getString("task_code"); - } - - HttpResponse result2 = null; - log.info("feedbackTaskStatusToWms - 请求参数 {}", data.toString()); - - AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms"); - String methods_url = addressDto.getMethods_url(); - try { - result2 = HttpRequest.post(wmsurl + methods_url) - .header("Authorization", token).body(String.valueOf(data)) - .execute(); - System.out.println(result2); - log.info("feedbackTaskStatusToWms - 返回参数 {}", result2.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - - String type = ""; - if (result2.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - -// logServer.log(task_code, "feedbackTaskStatusToWms", type, data.toString(), result2.body(), String.valueOf(result2.getStatus()), wmsurl + methods_url, vehicle_code); - - return result2; - } - - @Override - public Map feedbackPointStatusToWms(Map jsonObject) { - try { - MDC.put(log_file_type, log_type); - AddressDto addressDto = addressService.findByCode("feedbackPointStatusToWms"); - String methods_url = addressDto.getMethods_url(); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - String url = wmsurl + methods_url; - - JSONObject json = new JSONObject(); - json.put("task_uuid", jsonObject.get("device_code")); - json.put("task_code", jsonObject.get("point_status")); - json.put("task_status", jsonObject.get("point_mode")); - json.put("point_error", jsonObject.get("point_error")); - log.info("feedbackPointStatusToWms - 请求参数 {}", json.toString()); - try { - String result2 = HttpRequest.post(url) - .body(String.valueOf(json)) - .execute().body(); - System.out.println(result2); - log.info("feedbackPointStatusToWms - 返回参数 {}", result2); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - - } - - JSONObject resultJson = new JSONObject(); - resultJson.put("status", HttpStatus.OK); - resultJson.put("message", "操作成功"); - resultJson.put("data", new JSONArray()); - return resultJson; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public JSONArray getDeviceStatusToWms() { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("getDeviceStatusToWms"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - String result = ""; - try { - result = HttpRequest.get(url) - .execute().body(); - System.out.println(result); - log.info("getTaskStatusToWms - 返回参数 {}", result); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - JSONArray jsonArray = JSONArray.parseArray(result); - return jsonArray; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public HttpResponse requestSignalInteraction(String device_code, String vehicle_code, String action) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - JSONObject json = new JSONObject(); - json.put("device_code", device_code); - json.put("vehicle_code", vehicle_code); - json.put("action", action); - - AddressDto addressDto = addressService.findByCode("requestSignalInteraction"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - HttpResponse result = null; - log.info("requestSignalInteraction - 请求参数 {}", json.toString()); - try { - result = HttpRequest.post(url) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("requestSignalInteraction - 返回参数 {}", result.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - - } - return result; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override public String requestTaskAgain(String address, String task_id, String vehicle_code) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - String device_code = deviceService.queryDeviceCodeByAddress(Integer.parseInt(address)); - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - jo.put("task_id", task_id); - jo.put("vehicle_code", vehicle_code); - String result2 = null; - - AddressDto addressDto = addressService.findByCode("requestTaskAgain"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - log.info("requestTaskAgain - 请求参数 {}", jo); - - try { - result2 = HttpRequest.post(url) - .body(String.valueOf(jo)) - .execute().body(); - System.out.println(result2); - log.info("requestTaskAgain - 返回参数 {}", result2); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result2; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public String apply_InEmpty(String device_code, String type, String quantity, String container_code) { - try { - MDC.put(log_file_type, log_type); - if (StrUtil.isEmpty(container_code)) { - log.info("apply_InEmpty - 空盘入库申请校验失败,{}{}", device_code, "设备条码为空"); - throw new BadRequestException("地址对应设备未找到"); - } - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - jo.put("type", type); - jo.put("quantity", quantity); - jo.put("container_code", container_code); - - String result2 = ""; - - AddressDto addressDto = addressService.findByCode("apply_InEmpty"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - log.info("requestTaskAgain - 请求参数 {}", jo); - - try { - result2 = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(jo)) - .execute().body(); - System.out.println(result2); - log.info("requestTaskAgain - 返回参数 {}", result2); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result2; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public String apply_OutEmpty(String device_code) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - String result2 = ""; - - AddressDto addressDto = addressService.findByCode("apply_OutEmpty"); - String methods_url = addressDto.getMethods_url(); - String url = wmsurl + methods_url; - log.info("apply_OutEmpty - 请求参数 {}", jo); - try { - result2 = HttpRequest.post(url) - .header("Authorization", token) - .body(String.valueOf(jo)) - .execute().body(); - System.out.println(result2); - log.info("apply_OutEmpty - 返回参数 {}", result2); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result2; - } finally { - MDC.remove(log_file_type); - } - + return null; } @Override public HttpResponse feedbackAgvStatus(String device_code, String error, String error_message) { - try { - MDC.put(log_file_type, log_type); - String wmsUrl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - - JSONObject json = new JSONObject(); - json.put("device_code", device_code); - json.put("error", error); - json.put("error_message", error_message); - - AddressDto addressDto = addressService.findByCode("feedbackAgvStatus"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackAgvStatus - 请求参数 {}", json); - - try { - result = HttpRequest.post(url) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("feedbackAgvStatus - 返回参数 {}", result.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } finally { - MDC.remove(log_file_type); - } - - } - - @Override - public HttpResponse feedbackDeviceStatus(String device_code, String code, String value) { - try { - MDC.put(log_file_type, log_type); - String wmsUrl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - - JSONObject json = new JSONObject(); - json.put("device_code", device_code); - json.put("back_time", DateUtil.getStringAllDate()); - JSONArray ja = new JSONArray(); - JSONObject jo = new JSONObject(); - jo.put("code", code); - jo.put("value", value); - ja.add(jo); - json.put("data", ja); - AddressDto addressDto = addressService.findByCode("feedbackDeviceStatus"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackDeviceStatus - 请求参数 {}", json); - - try { - result = HttpRequest.post(url) - .body(String.valueOf(json)) - .execute(); - System.out.println(result); - log.info("feedbackDeviceStatus - 返回参数 {}", result.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } finally { - MDC.remove(log_file_type); - } - + return null; } @Override public HttpResponse feedbackAgv(JSONArray from) { - try { - MDC.put(log_file_type, log_type); - String wmsUrl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - AddressDto addressDto = addressService.findByCode("feedbackAgv"); - String methods_url = addressDto.getMethods_url(); - String url = wmsUrl + methods_url; - HttpResponse result = null; - log.info("feedbackAgv - 请求参数 {}", from); - - try { - result = HttpRequest.post(url) - .body(String.valueOf(from)) - .execute(); - System.out.println(result); - log.info("feedbackAgv - 返回参数 {}", result.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } finally { - MDC.remove(log_file_type); - } - + return null; } @Override public HttpResponse applyOpenOrCloseDoor(String device_code, String status) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - JSONObject jo = new JSONObject(); - jo.put("device_code", device_code); - jo.put("status", status); - HttpResponse result = null; - log.info("applyOpenOrCloseDoor - 请求参数 {}", jo.toString()); - - AddressDto addressDto = addressService.findByCode("applyOpenOrCloseDoor"); - String methods_url = addressDto.getMethods_url(); - try { - result = HttpRequest.post(wmsurl + methods_url) - .body(String.valueOf(jo)) - .execute(); - System.out.println(result); - log.info("applyOpenOrCloseDoor - 返回参数 {}", result.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } finally { - MDC.remove(log_file_type); - } - + return null; } @Override public HttpResponse queryDoorsStatus() { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - - HttpResponse result = null; - log.info("queryDoorStatus - 请求"); - AddressDto addressDto = addressService.findByCode("queryDoorsStatus"); - String methods_url = addressDto.getMethods_url(); - try { - result = HttpRequest.get(wmsurl + methods_url) - .body("") - .execute(); - log.info("queryDoorStatus - 返回参数 {}", result.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - - } - return result; - } finally { - MDC.remove(log_file_type); - } + return null; } @Override - public HttpResponse feedbackActionStatusToWms(JSONArray data) { - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - - String task_code = ""; - for (int i = 0; i < data.size(); i++) { - JSONObject json = (JSONObject) data.get(i); - task_code = json.getString("task_code"); - } - TaskDto taskDto = taskService.findByCode(task_code); - String vehicle_code = taskDto.getVehicle_code(); - - HttpResponse result2 = null; - log.info("feedbackActionStatusToWms - 请求参数 {}", data.toString()); - AddressDto addressDto = addressService.findByCode("feedbackActionStatusToWms"); - String methods_url = addressDto.getMethods_url(); - try { - result2 = HttpRequest.post(wmsurl + methods_url) -// .header("Authorization", token) - .body(String.valueOf(data)) - .execute(); - JSONObject jo = (JSONObject) JSON.toJSON(result2.body()); - log.info("feedbackActionStatusToWms - 返回参数 {}", jo.toString()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - log.info("feedbackActionStatusToWms - 异常返回参数 {}", msg); - } - - String type = ""; - if (!ObjectUtil.isEmpty(result2)) { - if (result2.getStatus() == 200) { - type = "info"; - } else { - type = "error"; - } - } else { - type = "error"; - } - - - return result2; - } - - - /** - * 入窑位扫码后向lms反馈 - * - * @param param - * @return - */ - @Override - public HttpResponse reverseGroup(JSONObject param) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - - HttpResponse result = null; - log.info("reverseGroup - 请求"); - AddressDto addressDto = addressService.findByCode("reverseGroup"); - String methods_url = addressDto.getMethods_url(); - try { - result = HttpRequest.post(wmsurl + methods_url) - .body(param.toJSONString()) - .execute(); - log.info("reverseGroup - 返回参数 {}", result.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } finally { - MDC.remove(log_file_type); - } + public ApplyLabelingAndBindingResponse applyLabelingAndBindingRequest(ApplyLabelingAndBindingRequest param) { + return null; } @Override - public HttpResponse feedbackVehicleType(JSONObject param) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); - - HttpResponse result = null; - log.info("feedbackVehicleType - 请求参数 {}", param); - AddressDto addressDto = addressService.findByCode("feedbackVehicleType"); - String methods_url = addressDto.getMethods_url(); - try { - result = HttpRequest.post(wmsurl + methods_url) - .body(param.toJSONString()) - .execute(); - log.info("feedbackVehicleType - 返回参数 {}", result.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } finally { - MDC.remove(log_file_type); - } + public HttpResponse shipDeviceUpdate(JSONObject param) { + return null; } @Override - public HttpResponse mark(JSONObject param) { - try { - MDC.put(log_file_type, log_type); - String wmsurl = acsConfigService.findByCode(AcsConfig.WMSURL).getValue(); + public HttpResponse feedAgvTaskStatus(JSONArray from) { + return null; + } - HttpResponse result = null; - log.info("mark - 请求参数 {}", param); - AddressDto addressDto = addressService.findByCode("mark"); - String methods_url = addressDto.getMethods_url(); - try { - result = HttpRequest - .post(wmsurl + methods_url) - .body(param.toJSONString()) - .execute(); - log.info("mark - 返回参数 {}", result.body()); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 - System.out.println(msg); - } - return result; - } finally { - MDC.remove(log_file_type); - } + @Override + public String applyTask(BaseRequest request) { + return null; + } + + + @Override + public String feedTaskStatus(BaseRequest request) { + return null; + } + + @Override + public String notify(BaseRequest request) { + return null; } } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/ComparatorAsc.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/ComparatorAsc.java new file mode 100644 index 0000000..96ab8dc --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/ComparatorAsc.java @@ -0,0 +1,13 @@ +package org.nl.acs.instruction; + +public interface ComparatorAsc { + boolean small(T var1, T var2); + + boolean big(T var1, T var2); + + boolean hasNoCompare(T var1, T var2); + + boolean onlyFirstNotCompare(T var1, T var2); + + boolean onlySecondNotCompare(T var1, T var2); +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/ComparatorEx.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/ComparatorEx.java new file mode 100644 index 0000000..b18a62c --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/ComparatorEx.java @@ -0,0 +1,76 @@ +package org.nl.acs.instruction; + +import java.util.Comparator; + +public abstract class ComparatorEx implements Comparator { + private ComparatorAsc ces; + private boolean smallFirst = true; + private boolean nullFirst = false; + private boolean notCompareFirst = false; + + public boolean getNotCompareFirst() { + return this.notCompareFirst; + } + + public void setNotCompareFirst(boolean notCompareFirst) { + this.notCompareFirst = notCompareFirst; + } + + public boolean getNullFirst() { + return this.nullFirst; + } + + public void setNullFirst(boolean nullFirst) { + this.nullFirst = nullFirst; + } + + public boolean getSmallFirst() { + return this.smallFirst; + } + + public void setSmallFirst(boolean smallFirst) { + this.smallFirst = smallFirst; + } + + public ComparatorEx(ComparatorAsc ces) { + this.ces = ces; + } + + private int nullFirst(T o1, T o2, boolean tag) { + if (o1 == null) { + return tag ? -1 : 1; + } else if (o2 == null) { + return tag ? 1 : -1; + } else { + return 0; + } + } + + private int notCompareFirst(T o1, T o2, boolean tag) { + if (this.ces.onlyFirstNotCompare(o1, o2)) { + return tag ? -1 : 1; + } else if (this.ces.onlySecondNotCompare(o1, o2)) { + return tag ? 1 : -1; + } else { + return 0; + } + } + + private int smallFirst(T o1, T o2, boolean tag) { + if (this.ces.small(o1, o2)) { + return tag ? -1 : 1; + } else if (this.ces.big(o1, o2)) { + return tag ? 1 : -1; + } else { + return 0; + } + } + + public int compare(T o1, T o2) { + if (o1 != null && o2 != null) { + return this.ces.hasNoCompare(o1, o2) ? this.notCompareFirst(o1, o2, this.notCompareFirst) : this.smallFirst(o1, o2, this.smallFirst); + } else { + return this.nullFirst(o1, o2, this.nullFirst); + } + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/CompareOrder.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/CompareOrder.java new file mode 100644 index 0000000..9d314cb --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/CompareOrder.java @@ -0,0 +1,7 @@ +package org.nl.acs.instruction; + +public interface CompareOrder { + default int getOrder() { + return 0; + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/CompareOrderComparator.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/CompareOrderComparator.java new file mode 100644 index 0000000..782e8b1 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/CompareOrderComparator.java @@ -0,0 +1,29 @@ +package org.nl.acs.instruction; + +public class CompareOrderComparator extends ComparatorEx { + private static ComparatorAsc ces = new ComparatorAsc() { + public boolean small(Object o1, Object o2) { + return ((CompareOrder)o1).getOrder() < ((CompareOrder)o2).getOrder(); + } + + public boolean big(Object o1, Object o2) { + return ((CompareOrder)o1).getOrder() > ((CompareOrder)o2).getOrder(); + } + + public boolean hasNoCompare(Object o1, Object o2) { + return !(o1 instanceof CompareOrder) || !(o2 instanceof CompareOrder); + } + + public boolean onlyFirstNotCompare(Object o1, Object o2) { + return !(o1 instanceof CompareOrder) && o2 instanceof CompareOrder; + } + + public boolean onlySecondNotCompare(Object o1, Object o2) { + return !(o2 instanceof CompareOrder) && o1 instanceof CompareOrder; + } + }; + + public CompareOrderComparator() { + super(ces); + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/InstructionComparator.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/InstructionComparator.java new file mode 100644 index 0000000..78b8f57 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/InstructionComparator.java @@ -0,0 +1,75 @@ +package org.nl.acs.instruction; + +import org.nl.acs.instruction.domain.Instruction; + +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; + +public class InstructionComparator extends ComparatorEx { + private static CompareOrderComparator compare = new CompareOrderComparator(); + private static ComparatorAsc ces = new ComparatorAsc() { + public boolean small(Instruction o1, Instruction o2) + { + Integer level = Integer.parseInt(o1.getPriority()); + Integer level2 = Integer.parseInt(o2.getPriority()); + if (level != null && level2 != null) { + if (level < level2) { + return true; + } + + try{ + if (level == level2 && o1.getCreate_time() != null && o2.getCreate_time() != null && + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(o1.getCreate_time()).getTime() + < new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(o2.getCreate_time()).getTime() ) { + return true; + } + + } catch (Exception e){ + e.printStackTrace(); + } + } + return false; + } + + + public boolean big(Instruction o1, Instruction o2) { + Integer level = Integer.parseInt(o1.getPriority()); + Integer level2 = Integer.parseInt(o2.getPriority()); + if (level != null && level2 != null) { + if (level > level2) { + return true; + } + + try{ + if (level == level2 && o1.getCreate_time() != null && o2.getCreate_time() != null && + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(o1.getCreate_time()).getTime() + > new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(o2.getCreate_time()).getTime() ) { + return true; + } + + } catch (Exception e){ + e.printStackTrace(); + } + return false; + } + return false; + } + + public boolean hasNoCompare(Instruction o1, Instruction o2) { + return false; + } + + public boolean onlyFirstNotCompare(Instruction o1, Instruction o2) { + return false; + } + + public boolean onlySecondNotCompare(Instruction o1, Instruction o2) { + return false; + } + }; + + public InstructionComparator() { + super(ces); + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/OperateType.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/OperateType.java new file mode 100644 index 0000000..a2409c2 --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/OperateType.java @@ -0,0 +1,22 @@ +package org.nl.acs.instruction; + +public enum OperateType implements OptionType { + manual("人工", 2), + auto("自动", 1); + + private String description; + private int order; + + private OperateType(String name, int order) { + this.description = name; + this.order = order; + } + + public String description() { + return this.description; + } + + public int getOrder() { + return this.order; + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/OptionType.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/OptionType.java new file mode 100644 index 0000000..1d7340e --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/OptionType.java @@ -0,0 +1,5 @@ +package org.nl.acs.instruction; + +public interface OptionType extends CompareOrder { + String description(); +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java index a62717d..2eb2108 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/InstructionService.java @@ -1,5 +1,6 @@ package org.nl.acs.instruction.service; +import org.nl.acs.custompolicy.WaitingInstructionDeque; import org.nl.acs.instruction.domain.InstructionMybatis; import org.nl.acs.instruction.service.dto.InstructionDto; import org.nl.acs.instruction.service.dto.InstructionQueryParam; @@ -315,4 +316,8 @@ public interface InstructionService extends CommonService { void init(String id); + + WaitingInstructionDeque findByStategy(String device_code, String strategy_code); + + WaitingInstructionDeque findWaitingInstructionDequeByDeviceCode(String device_code); } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/SortUtlEx.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/SortUtlEx.java new file mode 100644 index 0000000..73c0ddc --- /dev/null +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/SortUtlEx.java @@ -0,0 +1,19 @@ +package org.nl.acs.instruction.service; + +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class SortUtlEx { + public SortUtlEx() { + } + + public static void sort(List list, Comparator c) { + try { + Collections.sort(list, c); + } catch (Exception var3) { + var3.printStackTrace(); + } + + } +} diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 32d0498..08c97ff 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -19,6 +19,9 @@ import org.nl.acs.agv.server.MagicAgvService; import org.nl.acs.agv.server.NDCAgvService; import org.nl.acs.agv.server.XianGongAgvService; import org.nl.acs.auto.initial.ApplicationAutoInitial; +import org.nl.acs.custompolicy.DeviceStrategy; +import org.nl.acs.custompolicy.WaitingInstructionDeque; +import org.nl.acs.custompolicy.server.CustomPolicyService; import org.nl.acs.device.domain.Device; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.impl.DeviceServiceImpl; @@ -29,7 +32,9 @@ import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanne import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.ext.wms.liKuData.*; import org.nl.acs.ext.wms.service.AcsToLiKuService; +import org.nl.acs.instruction.InstructionComparator; import org.nl.acs.instruction.domain.InstructionMybatis; +import org.nl.acs.instruction.service.SortUtlEx; import org.nl.acs.instruction.service.dto.InstructionDto; import org.nl.acs.instruction.service.dto.InstructionQueryParam; import org.nl.acs.opc.DeviceAppService; @@ -88,7 +93,7 @@ public class InstructionServiceImpl extends CommonServiceImpl instructions = new CopyOnWriteArrayList(); -// List instructions_mybatis = new CopyOnWriteArrayList(); + // List instructions_mybatis = new CopyOnWriteArrayList(); @Autowired DeviceAppService deviceAppService; @Autowired @@ -101,6 +106,14 @@ public class InstructionServiceImpl extends CommonServiceImpl deques; + + private InstructionComparator instructionComparator = new InstructionComparator(); + @Override public PageInfo queryAll(InstructionQueryParam query, Pageable pageable) { @@ -110,7 +123,7 @@ public class InstructionServiceImpl extends CommonServiceImpl queryAll(InstructionQueryParam query){ + public List queryAll(InstructionQueryParam query) { return ConvertUtil.convertList(instructionMapper.selectList(QueryHelpMybatisPlus.getPredicate(query)), InstructionDto.class); } @@ -127,7 +140,7 @@ public class InstructionServiceImpl extends CommonServiceImpl ids){ + public int removeByIds(Set ids) { // delCaches(ids); return instructionMapper.deleteBatchIds(ids); } @Override @Transactional(rollbackFor = Exception.class) - public int removeById(String id){ + public int removeById(String id) { Set set = new HashSet<>(1); set.add(id); return this.removeByIds(set); @@ -175,7 +188,7 @@ public class InstructionServiceImpl extends CommonServiceImpl(ConvertUtil.convertList(list,Instruction.class)); + this.instructions = new CopyOnWriteArrayList<>(ConvertUtil.convertList(list, Instruction.class)); } @Override @@ -191,20 +204,20 @@ public class InstructionServiceImpl extends CommonServiceImpl queryPage = PageUtil.toMybatisPage(page); LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); // wrapper.eq(InstructionMybatis::getIs_delete,0); - wrapper.and(StringUtils.isNotBlank(code), instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code,code).or().like(InstructionMybatis::getTask_code,code)); - wrapper.like(StringUtils.isNotBlank(vehicle_code),InstructionMybatis::getVehicle_code,vehicle_code); - wrapper.eq(StringUtils.isNotBlank(material_type),InstructionMybatis::getMaterial,material_type); - wrapper.eq(StringUtils.isNotBlank(status),InstructionMybatis::getInstruction_status,status); - wrapper.and(StringUtils.isNotBlank(point_code),instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code,point_code).or().like(InstructionMybatis::getNext_point_code,point_code)); - wrapper.eq(StringUtils.isNotBlank(instruction_type),InstructionMybatis::getInstruction_type,instruction_type); + wrapper.and(StringUtils.isNotBlank(code), instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code, code).or().like(InstructionMybatis::getTask_code, code)); + wrapper.like(StringUtils.isNotBlank(vehicle_code), InstructionMybatis::getVehicle_code, vehicle_code); + wrapper.eq(StringUtils.isNotBlank(material_type), InstructionMybatis::getMaterial, material_type); + wrapper.eq(StringUtils.isNotBlank(status), InstructionMybatis::getInstruction_status, status); + wrapper.and(StringUtils.isNotBlank(point_code), instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code, point_code).or().like(InstructionMybatis::getNext_point_code, point_code)); + wrapper.eq(StringUtils.isNotBlank(instruction_type), InstructionMybatis::getInstruction_type, instruction_type); if (!StrUtil.isEmpty(is_over)) { - if (StrUtil.equals(is_over,"1")){ - wrapper.ge(InstructionMybatis::getInstruction_status,2); - }else{ - wrapper.lt(InstructionMybatis::getInstruction_status,2); + if (StrUtil.equals(is_over, "1")) { + wrapper.ge(InstructionMybatis::getInstruction_status, 2); + } else { + wrapper.lt(InstructionMybatis::getInstruction_status, 2); } } - IPage insPage = instructionMapper.selectPage(queryPage,wrapper); + IPage insPage = instructionMapper.selectPage(queryPage, wrapper); final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class)); return json; } @@ -223,31 +236,31 @@ public class InstructionServiceImpl extends CommonServiceImpl wrapper = new LambdaQueryWrapper<>(); // wrapper.eq(InstructionMybatis::getIs_delete,"0"); if (!StrUtil.isEmpty(code)) { - wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code,code).or().like(InstructionMybatis::getTask_code,code)); + wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getInstruction_code, code).or().like(InstructionMybatis::getTask_code, code)); } if (!StrUtil.isEmpty(vehicle_code)) { - wrapper.like(InstructionMybatis::getVehicle_code,vehicle_code); + wrapper.like(InstructionMybatis::getVehicle_code, vehicle_code); } if (!StrUtil.isEmpty(material_type)) { - wrapper.eq(InstructionMybatis::getMaterial,material_type); + wrapper.eq(InstructionMybatis::getMaterial, material_type); } if (!StrUtil.isEmpty(status)) { - wrapper.eq(InstructionMybatis::getInstruction_status,status); + wrapper.eq(InstructionMybatis::getInstruction_status, status); } if (!StrUtil.isEmpty(point_code)) { - wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code,point_code).or().like(InstructionMybatis::getNext_point_code,point_code)); + wrapper.and(instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code, point_code).or().like(InstructionMybatis::getNext_point_code, point_code)); } if (!StrUtil.isEmpty(create_time) && !StrUtil.isEmpty(end_time)) { - wrapper.between(InstructionMybatis::getCreate_time,create_time,end_time); + wrapper.between(InstructionMybatis::getCreate_time, create_time, end_time); } - IPage insPage = instructionMapper.selectPage(queryPage,wrapper); + IPage insPage = instructionMapper.selectPage(queryPage, wrapper); final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class)); return json; } @Override public Map getByTaskId(String id) { - List insList= new LambdaQueryChainWrapper<>(instructionMapper) + List insList = new LambdaQueryChainWrapper<>(instructionMapper) .eq(InstructionMybatis::getTask_id, id) .list(); JSONObject jsonObject = new JSONObject(); @@ -273,9 +286,9 @@ public class InstructionServiceImpl extends CommonServiceImpl queryAll(Map whereJson) { - List insList= new LambdaQueryChainWrapper<>(instructionMapper) + List insList = new LambdaQueryChainWrapper<>(instructionMapper) .list(); - return ConvertUtil.convertList(insList,Instruction.class); + return ConvertUtil.convertList(insList, Instruction.class); } @Override @@ -283,10 +296,10 @@ public class InstructionServiceImpl extends CommonServiceImpl list = arr.toJavaList(Instruction.class); - List insList= new LambdaQueryChainWrapper<>(instructionMapper) + List insList = new LambdaQueryChainWrapper<>(instructionMapper) .lt(InstructionMybatis::getInstruction_status, "2") .list(); - return ConvertUtil.convertList(insList,Instruction.class); + return ConvertUtil.convertList(insList, Instruction.class); } @@ -300,13 +313,13 @@ public class InstructionServiceImpl extends CommonServiceImpl(instructionMapper) + InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper) .eq(InstructionMybatis::getInstruction_code, code) .one(); - if(ObjectUtil.isEmpty(ins)){ + if (ObjectUtil.isEmpty(ins)) { return null; } - return ConvertUtil.convert(ins,Instruction.class); + return ConvertUtil.convert(ins, Instruction.class); } @Override @@ -315,13 +328,13 @@ public class InstructionServiceImpl extends CommonServiceImpl(instructionMapper) + InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper) .eq(InstructionMybatis::getTask_code, code) .one(); - if(ObjectUtil.isEmpty(ins)){ + if (ObjectUtil.isEmpty(ins)) { return null; } - return ConvertUtil.convert(ins,Instruction.class); + return ConvertUtil.convert(ins, Instruction.class); } @Override @@ -350,11 +363,11 @@ public class InstructionServiceImpl extends CommonServiceImpl wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(InstructionMybatis::getTask_id,id); - wrapper.apply(StringUtils.isNotBlank(wherecaluse),wherecaluse); + wrapper.eq(InstructionMybatis::getTask_id, id); + wrapper.apply(StringUtils.isNotBlank(wherecaluse), wherecaluse); InstructionMybatis ins = instructionMapper.selectOne(wrapper); if (ObjectUtil.isNotEmpty(ins)) { - return ConvertUtil.convert(ins,Instruction.class); + return ConvertUtil.convert(ins, Instruction.class); } return null; } @@ -386,7 +399,7 @@ public class InstructionServiceImpl extends CommonServiceImpl(instructionMapper) + InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper) .lt(InstructionMybatis::getInstruction_status, 3) - .eq(InstructionMybatis::getNext_point_code,dto.getNext_point_code()) - .eq(InstructionMybatis::getStart_point_code,dto.getStart_point_code()) - .eq(InstructionMybatis::getTask_id,dto.getTask_id()) + .eq(InstructionMybatis::getNext_point_code, dto.getNext_point_code()) + .eq(InstructionMybatis::getStart_point_code, dto.getStart_point_code()) + .eq(InstructionMybatis::getTask_id, dto.getTask_id()) .one(); @@ -801,7 +808,7 @@ public class InstructionServiceImpl extends CommonServiceImpl(taskMapper) - .eq(Task::getTask_id,insttaskid) + .eq(Task::getTask_id, insttaskid) .one(); // =0 则不用再次请求 if (StrUtil.equals(task.getRequest_again(), "0")) { @@ -836,7 +843,7 @@ public class InstructionServiceImpl extends CommonServiceImpl(taskMapper) - .eq(Task::getTask_id,insttaskid) + .eq(Task::getTask_id, insttaskid) .one(); // =0 则不用再次请求 if (StrUtil.equals(task.getRequest_again(), "0")) { @@ -890,7 +897,7 @@ public class InstructionServiceImpl extends CommonServiceImpl(taskMapper) - .eq(Task::getTask_id,dto.getTask_id()) + .eq(Task::getTask_id, dto.getTask_id()) .one(); RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineServiceImpl.class); @@ -988,7 +995,7 @@ public class InstructionServiceImpl extends CommonServiceImpl findAllWithSort() { + List list = this.findAllInstFromCache(); + SortUtlEx.sort(list, this.instructionComparator); + return list; + } + + + @Override + public WaitingInstructionDeque findByStategy(String device_code, String strategy_code) { + DeviceStrategy strategy = customPolicyService.findByCode(strategy_code); + if (strategy == null) { + throw new RuntimeException("设备 " + device_code+ "策略" + strategy_code + "不存在"); + } else { + ArrayList instructions = new ArrayList(); + ArrayList instructions_level_up = new ArrayList(); + Iterator var6 = this.findAllWithSort().iterator(); + + while(true) { + while(true) { + Instruction instruction; + do { + do { + if (!var6.hasNext()) { + WaitingInstructionDeque deque = strategy.strategy(instructions, device_code); + ArrayList instructions_level_up2 = new ArrayList(); + Iterator var13 = instructions_level_up.iterator(); + + while(var13.hasNext()) { + Instruction is2 = (Instruction)var13.next(); + if (!deque.contains(is2)) { + instructions_level_up2.add(is2); + } + } + + if (instructions_level_up2.size() > 0) { + deque.getQueue().addAll(0, instructions_level_up2); + } + + return deque; + } + + instruction = (Instruction)var6.next(); + } while(!StrUtil.equals(instruction.getExecute_device_code(), device_code)); + } while(StrUtil.equals(instruction.getStart_device_code(), device_code)); + + if (Integer.parseInt(instruction.getPriority()) > 0) { + instructions_level_up.add(instruction); + } else if (Integer.parseInt(instruction.getInstruction_status()) == 0) { + instructions.add(instruction); + } + } + } + } + } + +} \ No newline at end of file diff --git a/acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index 4950662..e632780 100644 --- a/acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/acs/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -10,7 +10,7 @@ spring: url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true username: ${DB_USER:root} # password: ${DB_PWD:Root.123456} - password: ${DB_PWD:root} + password: ${DB_PWD:123456} # 初始连接数 initial-size: 5 # 最小连接数 diff --git a/acs/nladmin-ui/src/views/acs/device/config.vue b/acs/nladmin-ui/src/views/acs/device/config.vue index 85219e7..a70d3f6 100644 --- a/acs/nladmin-ui/src/views/acs/device/config.vue +++ b/acs/nladmin-ui/src/views/acs/device/config.vue @@ -84,8 +84,6 @@ import standard_conveyor_monitor from '@/views/acs/device/driver/standard_convey 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 xg_agv from '@/views/acs/device/driver/agv/xg_agv' -import standard_station from '@/views/acs/device/driver/standard_station' - export default { name: 'DeviceConfig', @@ -98,14 +96,9 @@ export default { standard_conveyor_control_with_scanner, standard_conveyor_control, standard_conveyor_monitor, - hailiang_smart_plc_test, - paint_conveyor, - cargo_lift_conveyor, - empty_vehicle_stacking_position, agv_ndc_two, agv_ndc_one, - xg_agv, - standard_station + xg_agv }, dicts: ['device_type'], mixins: [crud],