rev 自定义策略
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.acs.custompolicy;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CustomerStragetyCacheService {
|
||||
private Map<String, StackerStrategyDto> 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);
|
||||
}
|
||||
}
|
||||
@@ -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<Instruction> instructions, String device_code) {
|
||||
WaitingInstructionDeque deque = this.instructionService.findWaitingInstructionDequeByDeviceCode(device_code);
|
||||
StackerStrategyDto cacheStragety = this.customerStragetyCacheService.getStragety(device_code);
|
||||
return deque;
|
||||
}
|
||||
}
|
||||
@@ -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<Instruction> instructions, String device_code) {
|
||||
WaitingInstructionDeque deque = this.instructionService.findWaitingInstructionDequeByDeviceCode(device_code);
|
||||
Map<String, List<Instruction>> 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<Instruction>) list);
|
||||
}
|
||||
}
|
||||
|
||||
Set<String> keys = factory.keySet();
|
||||
List<String> 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<Instruction> list2 = (List)factory.get(string);
|
||||
if (list2 != null && list2.size() > 0) {
|
||||
deque.offerIfNotExists((Instruction)list2.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
return deque;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
@@ -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<Instruction> instructions, String device_code) {
|
||||
throw new RuntimeException("未实现");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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<StackerInstruction> plan = new ArrayList();
|
||||
private List<StackerInstruction> forbid = new ArrayList();
|
||||
|
||||
public StackerStrategyDto() {
|
||||
}
|
||||
|
||||
public String getDeviceCode() {
|
||||
return this.deviceCode;
|
||||
}
|
||||
|
||||
public void setDeviceCode(String deviceCode) {
|
||||
this.deviceCode = deviceCode;
|
||||
}
|
||||
|
||||
public List<StackerInstruction> getPlan() {
|
||||
return this.plan;
|
||||
}
|
||||
|
||||
public void setPlan(List<StackerInstruction> plan) {
|
||||
this.plan = plan;
|
||||
}
|
||||
|
||||
public List<StackerInstruction> getForbid() {
|
||||
return this.forbid;
|
||||
}
|
||||
|
||||
public void setForbid(List<StackerInstruction> forbid) {
|
||||
this.forbid = forbid;
|
||||
}
|
||||
}
|
||||
@@ -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<Instruction> instructions, String device_code) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -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<Instruction> instructions, String device_code) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -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<Instruction> deque = new LinkedList();
|
||||
LinkedList<Instruction> lastDeque = new LinkedList();
|
||||
|
||||
public WaitingInstructionDeque() {
|
||||
}
|
||||
|
||||
public LinkedList<Instruction> getQueue() {
|
||||
return this.deque;
|
||||
}
|
||||
|
||||
public void setQueue(LinkedList<Instruction> 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<Instruction> 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);
|
||||
}
|
||||
}
|
||||
@@ -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<CustomPolicy> {
|
||||
CustomPolicyPlantVO plantList(Long id);
|
||||
|
||||
void updateOn(Long id,Integer is_on);
|
||||
|
||||
DeviceStrategy findByCode(String var1);
|
||||
|
||||
}
|
||||
|
||||
@@ -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<CustomPolicyMapper, CustomPolicy> implements CustomPolicyService {
|
||||
|
||||
List<DeviceStrategy> strategys = Collections.synchronizedList(new LinkedList());
|
||||
|
||||
List<DeviceStrategy> instructionStrategys;
|
||||
|
||||
private final CustomPolicyMapper customPolicyMapper;
|
||||
|
||||
public List<DeviceStrategy> findAllDeviceStrategy() {
|
||||
return (List)(this.instructionStrategys != null && this.instructionStrategys.size() > 0 ? this.instructionStrategys : new LinkedList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<CustomPolicyDTO> queryAll(Map whereJson, Pageable page) {
|
||||
IPage<CustomPolicy> queryPage = PageUtil.toMybatisPage(page);
|
||||
@@ -102,4 +111,34 @@ public class CustomPolicyServiceImpl extends CommonServiceImpl<CustomPolicyMappe
|
||||
customPolicy.setIs_on(is_on);
|
||||
customPolicyMapper.updateById(customPolicy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceStrategy findByCode(String code) {
|
||||
List<DeviceStrategy> 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<String, String> findDeviceStrategyOption() {
|
||||
List<DeviceStrategy> strategys = this.findAllDeviceStrategy();
|
||||
Map<String, String> map = new HashMap();
|
||||
Iterator var3 = strategys.iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
DeviceStrategy strategy = (DeviceStrategy)var3.next();
|
||||
map.put(strategy.getCode(), strategy.getName());
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return CargoLiftConveyorDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.conveyor);
|
||||
return types;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getReadableItemDtos() {
|
||||
return ItemProtocol.getReadableItemDtos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemDto> getWriteableItemDtos() {
|
||||
return ItemProtocol.getWriteableItemDtos();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<String, Object> itemMap = new HashMap<String, Object>();
|
||||
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() {
|
||||
|
||||
@@ -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<String, Object> itemMap = new HashMap<String, Object>();
|
||||
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();
|
||||
|
||||
@@ -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<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",200);
|
||||
this.writing(map);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
Map<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
// map.put("to_command",200);
|
||||
// this.writing(map);
|
||||
// this.setRequireSucess(true);
|
||||
// } else {
|
||||
// Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",200);
|
||||
this.writing(map);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
Map<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
// map.put("to_command",200);
|
||||
// this.writing(map);
|
||||
// this.setRequireSucess(true);
|
||||
// } else {
|
||||
// Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",200);
|
||||
this.writing(map);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
Map<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
// map.put("to_command",200);
|
||||
// this.writing(map);
|
||||
// this.setRequireSucess(true);
|
||||
// } else {
|
||||
// Map<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",200);
|
||||
this.writing(map);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
Map<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
// map.put("to_command",200);
|
||||
// this.writing(map);
|
||||
// this.setRequireSucess(true);
|
||||
// } else {
|
||||
// Map<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",200);
|
||||
this.writing(map);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
Map<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
// map.put("to_command",200);
|
||||
// this.writing(map);
|
||||
// this.setRequireSucess(true);
|
||||
// } else {
|
||||
// Map<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",200);
|
||||
this.writing(map);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
Map<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
// map.put("to_command",200);
|
||||
// this.writing(map);
|
||||
// this.setRequireSucess(true);
|
||||
// } else {
|
||||
// Map<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("to_command",200);
|
||||
this.writing(map);
|
||||
this.setRequireSucess(true);
|
||||
} else {
|
||||
Map<String, Object> 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<String, Object> map = new LinkedHashMap<>();
|
||||
// map.put("to_command",200);
|
||||
// this.writing(map);
|
||||
// this.setRequireSucess(true);
|
||||
// } else {
|
||||
// Map<String, Object> 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;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,61 +31,13 @@ import java.util.Map;
|
||||
public class AcsToWmsController {
|
||||
private final AcsToWmsService acstowmsService;
|
||||
|
||||
@PostMapping("/applyTask")
|
||||
@Log("向WMS申请任务")
|
||||
@ApiOperation("向WMS申请任务")
|
||||
public ResponseEntity<Object> 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<Object> 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<Object> applyTaskManipulatorToWms(@RequestBody JSONObject json) {
|
||||
return new ResponseEntity<>(acstowmsService.applyTaskManipulatorToWms(json), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getVehicle")
|
||||
@Log("获取托盘信息")
|
||||
@ApiOperation("获取托盘信息")
|
||||
public ResponseEntity<Object> getVehicle(@RequestBody JSONObject json) {
|
||||
return new ResponseEntity<>(acstowmsService.getVehicle(json), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getVehicleTokiln")
|
||||
@Log("获取入窑托盘信息")
|
||||
@ApiOperation("获取入窑托盘信息")
|
||||
public ResponseEntity<Object> getVehicleTokiln(@RequestBody JSONObject json) {
|
||||
return new ResponseEntity<>(acstowmsService.getVehicleTokiln(json), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/outKiln")
|
||||
@Log("出窑请求")
|
||||
@ApiOperation("出窑请求")
|
||||
public ResponseEntity<Object> outKiln(@RequestBody JSONObject json) {
|
||||
return new ResponseEntity<>(acstowmsService.outKiln(json), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/enterOrder")
|
||||
@Log("排产单确认")
|
||||
@ApiOperation("排产单确认")
|
||||
public ResponseEntity<Object> enterOrder(@RequestBody JSONObject json) {
|
||||
return new ResponseEntity<>(acstowmsService.enterOrder(json), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getVehicleCode")
|
||||
@Log("获取托盘号")
|
||||
@ApiOperation("获取托盘号")
|
||||
public ResponseEntity<Object> getVehicleCode(@RequestBody String device_code) {
|
||||
return new ResponseEntity<>(acstowmsService.getVehicleCode(device_code), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getVehiclePoint")
|
||||
@Log("获取托盘点位")
|
||||
@ApiOperation("获取托盘点位")
|
||||
public ResponseEntity<Object> 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<Object> 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<Object> feedbackDeviceStatus(@RequestBody String device_code, String code, String value) {
|
||||
return new ResponseEntity<>(acstowmsService.feedbackDeviceStatus(device_code, code, value), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
package org.nl.acs.instruction;
|
||||
|
||||
public interface ComparatorAsc<T> {
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package org.nl.acs.instruction;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
public abstract class ComparatorEx<T> implements Comparator<T> {
|
||||
private ComparatorAsc<T> 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<T> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.nl.acs.instruction;
|
||||
|
||||
public interface CompareOrder {
|
||||
default int getOrder() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.nl.acs.instruction;
|
||||
|
||||
public class CompareOrderComparator extends ComparatorEx<Object> {
|
||||
private static ComparatorAsc<Object> ces = new ComparatorAsc<Object>() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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<Instruction> {
|
||||
private static CompareOrderComparator compare = new CompareOrderComparator();
|
||||
private static ComparatorAsc<Instruction> ces = new ComparatorAsc<Instruction>() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package org.nl.acs.instruction;
|
||||
|
||||
public interface OptionType extends CompareOrder {
|
||||
String description();
|
||||
}
|
||||
@@ -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<InstructionMybatis> {
|
||||
|
||||
|
||||
void init(String id);
|
||||
|
||||
WaitingInstructionDeque findByStategy(String device_code, String strategy_code);
|
||||
|
||||
WaitingInstructionDeque findWaitingInstructionDequeByDeviceCode(String device_code);
|
||||
}
|
||||
|
||||
@@ -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 <T> void sort(List<T> list, Comparator<? super T> c) {
|
||||
try {
|
||||
Collections.sort(list, c);
|
||||
} catch (Exception var3) {
|
||||
var3.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<InstructionMapper,
|
||||
@Autowired
|
||||
TaskMapper taskMapper;
|
||||
List<Instruction> instructions = new CopyOnWriteArrayList();
|
||||
// List<InstructionMybatis> instructions_mybatis = new CopyOnWriteArrayList();
|
||||
// List<InstructionMybatis> instructions_mybatis = new CopyOnWriteArrayList();
|
||||
@Autowired
|
||||
DeviceAppService deviceAppService;
|
||||
@Autowired
|
||||
@@ -101,6 +106,14 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
TaskService taskService;
|
||||
@Autowired
|
||||
AcsToLiKuService acsToLiKuService;
|
||||
@Autowired
|
||||
CustomPolicyService customPolicyService;
|
||||
Object queues_lock;
|
||||
|
||||
Map<String, WaitingInstructionDeque> deques;
|
||||
|
||||
private InstructionComparator instructionComparator = new InstructionComparator();
|
||||
|
||||
|
||||
@Override
|
||||
public PageInfo<InstructionDto> queryAll(InstructionQueryParam query, Pageable pageable) {
|
||||
@@ -110,7 +123,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InstructionDto> queryAll(InstructionQueryParam query){
|
||||
public List<InstructionDto> queryAll(InstructionQueryParam query) {
|
||||
return ConvertUtil.convertList(instructionMapper.selectList(QueryHelpMybatisPlus.getPredicate(query)), InstructionDto.class);
|
||||
}
|
||||
|
||||
@@ -127,7 +140,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateById(InstructionDto resources){
|
||||
public int updateById(InstructionDto resources) {
|
||||
InstructionMybatis entity = ConvertUtil.convert(resources, InstructionMybatis.class);
|
||||
int ret = instructionMapper.updateById(entity);
|
||||
// delCaches(resources.id);
|
||||
@@ -136,14 +149,14 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int removeByIds(Set<String> ids){
|
||||
public int removeByIds(Set<String> ids) {
|
||||
// delCaches(ids);
|
||||
return instructionMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int removeById(String id){
|
||||
public int removeById(String id) {
|
||||
Set<String> set = new HashSet<>(1);
|
||||
set.add(id);
|
||||
return this.removeByIds(set);
|
||||
@@ -175,7 +188,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
.eq(InstructionMybatis::getIs_delete, "0")
|
||||
.list();
|
||||
// List list = this.queryAll("instruction_status <2 and is_delete =0");
|
||||
this.instructions = new CopyOnWriteArrayList<>(ConvertUtil.convertList(list,Instruction.class));
|
||||
this.instructions = new CopyOnWriteArrayList<>(ConvertUtil.convertList(list, Instruction.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -191,20 +204,20 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
IPage<InstructionMybatis> queryPage = PageUtil.toMybatisPage(page);
|
||||
LambdaQueryWrapper<InstructionMybatis> 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<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage,wrapper);
|
||||
IPage<InstructionMybatis> 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<InstructionMapper,
|
||||
LambdaQueryWrapper<InstructionMybatis> 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<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage,wrapper);
|
||||
IPage<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage, wrapper);
|
||||
final JSONObject json = (JSONObject) JSON.toJSON(ConvertUtil.convertPage(insPage, InstructionDto.class));
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getByTaskId(String id) {
|
||||
List<InstructionMybatis> insList= new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
List<InstructionMybatis> insList = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.eq(InstructionMybatis::getTask_id, id)
|
||||
.list();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
@@ -273,9 +286,9 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public List<Instruction> queryAll(Map whereJson) {
|
||||
List<InstructionMybatis> insList= new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
List<InstructionMybatis> 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<InstructionMapper,
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONArray arr = wo.query(whereJson, "create_time").getResultJSONArray(0);
|
||||
// List<Instruction> list = arr.toJavaList(Instruction.class);
|
||||
List<InstructionMybatis> insList= new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
List<InstructionMybatis> 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,
|
||||
// final Instruction obj = json.toJavaObject(Instruction.class);
|
||||
// return obj;
|
||||
|
||||
InstructionMybatis ins= new LambdaQueryChainWrapper<>(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,
|
||||
// JSONObject json = wo.query("task_code ='" + code + "'").uniqueResult(0);
|
||||
// final Instruction obj = json.toJavaObject(Instruction.class);
|
||||
// return obj;
|
||||
InstructionMybatis ins= new LambdaQueryChainWrapper<>(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<InstructionMapper,
|
||||
// return null;
|
||||
|
||||
LambdaQueryWrapper<InstructionMybatis> 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,
|
||||
dto.setIs_send(task.getLink_num());
|
||||
}
|
||||
// if (task.getTask_type().equals("1") || task.getTask_type().equals("2")) {
|
||||
dto.setInstruction_type(task.getTask_type());
|
||||
dto.setInstruction_type(task.getTask_type());
|
||||
// } else if (false) {
|
||||
//
|
||||
// } else {
|
||||
@@ -410,8 +423,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
}
|
||||
}
|
||||
|
||||
dto.setCreate_by(ObjectUtil.isNotEmpty(currentUsername)?currentUsername:"admin");
|
||||
dto.setUpdate_by(ObjectUtil.isNotEmpty(currentUsername)?currentUsername:"admin");
|
||||
dto.setCreate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
||||
dto.setUpdate_by(ObjectUtil.isNotEmpty(currentUsername) ? currentUsername : "admin");
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
dto.setStart_parent_code(task.getStart_parent_code());
|
||||
@@ -525,12 +538,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
HongXiangConveyorDeviceDriver hongXiangConveyorDeviceDriver;
|
||||
StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver;
|
||||
|
||||
if (startdevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
|
||||
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) startdevice.getDeviceDriver();
|
||||
hongXiangConveyorDeviceDriver.writing(3, Integer.valueOf(dto.getInstruction_code()));
|
||||
}
|
||||
|
||||
try {
|
||||
String start_device_code = dto.getStart_device_code();
|
||||
String next_device_code = dto.getNext_device_code();
|
||||
@@ -602,11 +609,11 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
// + dto.getTask_id()
|
||||
// + "'")
|
||||
// .uniqueResult(0);
|
||||
InstructionMybatis ins= new LambdaQueryChainWrapper<>(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<InstructionMapper,
|
||||
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
||||
|
||||
Task task = new LambdaQueryChainWrapper<>(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<InstructionMapper,
|
||||
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
|
||||
|
||||
Task task = new LambdaQueryChainWrapper<>(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<InstructionMapper,
|
||||
// JSONObject taskjson = taskwo.query("task_id ='" + dto.getTask_id() + "'").uniqueResult(0);
|
||||
// TaskDto acsTask = taskjson.toJavaObject(TaskDto.class);
|
||||
Task acsTask = new LambdaQueryChainWrapper<>(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<InstructionMapper,
|
||||
} else if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
|
||||
// NDC agv指令不当场取消指令,需要等agv上报
|
||||
if (!StrUtil.isEmpty(entity.getAgv_jobno())) {
|
||||
ndcAgvService.deleteAgvInstToNDC((Instruction)entity);
|
||||
ndcAgvService.deleteAgvInstToNDC((Instruction) entity);
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
@@ -1525,7 +1532,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public void init(String id) {
|
||||
InstructionDto inst = this.findById(id);
|
||||
InstructionDto inst = this.findById(id);
|
||||
if (inst == null) {
|
||||
throw new BadRequestException("指令不存在或已删除");
|
||||
}
|
||||
@@ -1554,4 +1561,77 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
((SiemensConveyorDeviceDriver) startDeviceDriver).writing(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaitingInstructionDeque findWaitingInstructionDequeByDeviceCode(String device_code) {
|
||||
WaitingInstructionDeque deque = (WaitingInstructionDeque) this.deques.get(device_code);
|
||||
if (deque == null) {
|
||||
synchronized (this.queues_lock) {
|
||||
deque = (WaitingInstructionDeque) this.deques.get(device_code);
|
||||
if (deque == null) {
|
||||
deque = new WaitingInstructionDeque();
|
||||
this.deques.put(device_code, deque);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return deque;
|
||||
}
|
||||
|
||||
|
||||
public List<Instruction> findAllWithSort() {
|
||||
List<Instruction> 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<Instruction> instructions = new ArrayList();
|
||||
ArrayList<Instruction> 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<Instruction> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
# 最小连接数
|
||||
|
||||
Reference in New Issue
Block a user