rev 策略内存
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
package org.nl.acs.custompolicy;
|
||||
|
||||
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class CustomerStragetyCacheService {
|
||||
public class CustomerStragetyCacheService implements ApplicationAutoInitial {
|
||||
private Map<String, StackerStrategyDto> strategyCache = new HashMap();
|
||||
|
||||
|
||||
public CustomerStragetyCacheService() {
|
||||
}
|
||||
|
||||
@@ -21,4 +24,9 @@ public class CustomerStragetyCacheService {
|
||||
public synchronized void setStragety(String deiviceCode, StackerStrategyDto strategy) {
|
||||
this.strategyCache.put(deiviceCode, strategy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoInitial() throws Exception {
|
||||
// 策略缓存
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import java.util.List;
|
||||
|
||||
public class StackerStrategyDto {
|
||||
private String deviceCode;
|
||||
//策略
|
||||
private List<StackerInstruction> plan = new ArrayList();
|
||||
//禁止策略 暂时未开发
|
||||
private List<StackerInstruction> forbid = new ArrayList();
|
||||
|
||||
public StackerStrategyDto() {
|
||||
|
||||
@@ -16,7 +16,6 @@ import java.util.Map;
|
||||
*/
|
||||
public interface CustomPolicyService extends CommonService<CustomPolicy> {
|
||||
|
||||
|
||||
PageInfo<CustomPolicyDTO> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
void create(CustomPolicyDTO dto);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import jodd.util.StringUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import org.nl.acs.auto.initial.ApplicationAutoInitial;
|
||||
import org.nl.acs.common.base.PageInfo;
|
||||
import org.nl.acs.common.base.impl.CommonServiceImpl;
|
||||
import org.nl.acs.custompolicy.DeviceStrategy;
|
||||
@@ -17,6 +18,7 @@ import org.nl.acs.custompolicy.server.dto.CustomPolicyDTO;
|
||||
import org.nl.acs.custompolicy.server.dto.CustomPolicyPlantDTO;
|
||||
import org.nl.acs.custompolicy.server.mapper.CustomPolicyMapper;
|
||||
import org.nl.acs.custompolicy.server.vo.CustomPolicyPlantVO;
|
||||
import org.nl.acs.task.TaskInstructionLock;
|
||||
import org.nl.acs.utils.ConvertUtil;
|
||||
import org.nl.acs.utils.PageUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -35,7 +37,7 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class CustomPolicyServiceImpl extends CommonServiceImpl<CustomPolicyMapper, CustomPolicy> implements CustomPolicyService {
|
||||
public class CustomPolicyServiceImpl extends CommonServiceImpl<CustomPolicyMapper, CustomPolicy> implements CustomPolicyService, ApplicationAutoInitial {
|
||||
|
||||
List<DeviceStrategy> strategys = Collections.synchronizedList(new LinkedList());
|
||||
|
||||
@@ -43,6 +45,13 @@ public class CustomPolicyServiceImpl extends CommonServiceImpl<CustomPolicyMappe
|
||||
|
||||
private final CustomPolicyMapper customPolicyMapper;
|
||||
|
||||
@Override
|
||||
public void autoInitial() throws Exception {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public List<DeviceStrategy> findAllDeviceStrategy() {
|
||||
return (List)(this.instructionStrategys != null && this.instructionStrategys.size() > 0 ? this.instructionStrategys : new LinkedList());
|
||||
}
|
||||
|
||||
@@ -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.WaitingInstructionDeque;
|
||||
import org.nl.acs.custompolicy.server.CustomPolicyService;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
@@ -187,6 +188,10 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
||||
}
|
||||
}
|
||||
}
|
||||
WaitingInstructionDeque deque = null;
|
||||
deque = instructionService.findByStategy(this.getDeviceCode(), "deviceCustomerDequeStrategy");
|
||||
|
||||
|
||||
} catch (Exception var17) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user