rev:控制逻辑
This commit is contained in:
@@ -22,7 +22,6 @@ import org.nl.acs.device.driver.conveyor.strip_conveyor.StripConveyorDeviceDrive
|
||||
import org.nl.acs.device.driver.storage.standard_storage.StandardStorageDeviceDriver;
|
||||
import org.nl.acs.ext.UnifiedResponse;
|
||||
import org.nl.acs.ext.hk.service.AcsToHkService;
|
||||
import org.nl.acs.ext.hk.service.data.BaseReq;
|
||||
import org.nl.acs.ext.hk.service.data.BoxApplyPassReq;
|
||||
import org.nl.acs.ext.socket.Online;
|
||||
import org.nl.acs.ext.wms.data.req.CommonRequest;
|
||||
@@ -46,8 +45,6 @@ import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -315,6 +312,19 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
.build();
|
||||
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request);
|
||||
if (!response.isSuccess()) {
|
||||
String notifyValue = Optional.ofNullable(sysParamService.findByCode("is_notify"))
|
||||
.map(notify -> notify.getValue())
|
||||
.orElse("0");
|
||||
if (notifyValue.equals("1")) {
|
||||
JSONObject dataParam = new JSONObject();
|
||||
dataParam.put("msg", "反馈拣选工位启停状态失败!请求参数: " + request + "响应信息: " + response.getMessage());
|
||||
CommonRequest<JSONObject> requestParam = CommonRequest.<JSONObject>builder()
|
||||
.service("ErrorInfo")
|
||||
.type("1")
|
||||
.data(dataParam)
|
||||
.build();
|
||||
acsToWmsService.apply(requestParam);
|
||||
}
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "反馈拣选工位启停状态失败, 原因:" + response.getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -341,9 +351,6 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
.taskCode(this.reqTakeInstCode)
|
||||
.type("1")
|
||||
.build();
|
||||
// BaseReq<BoxApplyPassReq> req = BaseReq.<BoxApplyPassReq>builder()
|
||||
// .data(bapReq)
|
||||
// .build();
|
||||
UnifiedResponse<String> unifiedResponse = acsToHkService.boxApplyPass(bapReq, String.class);
|
||||
if (unifiedResponse.isSuccess()) {
|
||||
this.reqTakeRequireSuccess = false;
|
||||
@@ -360,9 +367,6 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
.taskCode(this.reqPutInstCode)
|
||||
.type("2")
|
||||
.build();
|
||||
// BaseReq<BoxApplyPassReq> req = BaseReq.<BoxApplyPassReq>builder()
|
||||
// .data(bapReq)
|
||||
// .build();
|
||||
UnifiedResponse<String> unifiedResponse = acsToHkService.boxApplyPass(bapReq, String.class);
|
||||
if (unifiedResponse.isSuccess()) {
|
||||
this.reqPutRequireSuccess = false;
|
||||
@@ -455,6 +459,23 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
this.writing("toHeight", type);
|
||||
this.writing("toCommand", this.mode);
|
||||
this.requireSuccess = true;
|
||||
} else {
|
||||
if (isErrorTimeValid(currentTimeMillis)) {
|
||||
this.errorRequireTime = currentTimeMillis;
|
||||
String notifyValue = Optional.ofNullable(sysParamService.findByCode("is_notify"))
|
||||
.map(notify -> notify.getValue())
|
||||
.orElse("0");
|
||||
if (notifyValue.equals("1")) {
|
||||
JSONObject dataParam = new JSONObject();
|
||||
dataParam.put("msg", "申请载具类型高度失败! 请求参数: " + request + "响应信息: " + response.getMessage());
|
||||
CommonRequest<JSONObject> requestParam = CommonRequest.<JSONObject>builder()
|
||||
.service("ErrorInfo")
|
||||
.type("1")
|
||||
.data(dataParam)
|
||||
.build();
|
||||
acsToWmsService.apply(requestParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -773,7 +794,6 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) cacheDevice.getDeviceDriver();
|
||||
checkoutStartDeviceCode = appearanceInspectionScannerConveyorDeviceDriver.getExtraDeviceCodes("checkoutStartDeviceCode");
|
||||
}
|
||||
List<TaskDto> taskDtos = taskService.findReadyTasksByNextDeviceCode(deviceCode, checkoutStartDeviceCode);
|
||||
TaskDto taskDto = taskService.findReadyTaskByNextDeviceCode(deviceCode, checkoutStartDeviceCode);
|
||||
Instruction instDto = instructionService.findReadyInstByEnd(deviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDto) && ObjectUtil.isEmpty(instDto)) {
|
||||
@@ -789,8 +809,10 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
return;
|
||||
}
|
||||
DeviceAssignedDto assignedDto = null;
|
||||
//如果有多个对路由信息
|
||||
if (assignedDtos.size() > 1) {
|
||||
Map<Integer, List<DeviceAssignedDto>> tempAss = new HashMap<>();
|
||||
//遍历路由信息
|
||||
for (int i = 0; i < assignedDtos.size(); i++) {
|
||||
DeviceAssignedDto deviceAssignedDto = assignedDtos.get(i);
|
||||
String inst_nextDevice_code = deviceAssignedDto.getInst_nextDevice_code();
|
||||
@@ -802,64 +824,12 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
}
|
||||
deviceAssignedDtos.add(deviceAssignedDto);
|
||||
}
|
||||
Integer from_y = Integer.parseInt(taskDto.getFrom_y());
|
||||
if (bindTaskCode.contains(taskDto.getTask_code())) {
|
||||
for (DeviceAssignedDto dto : assignedDtos) {
|
||||
String inst_nextDevice_code = dto.getInst_nextDevice_code();
|
||||
Device inst_nextDevice = deviceAppService.findDeviceByCode(inst_nextDevice_code);
|
||||
if (inst_nextDevice != null) {
|
||||
Boolean isFront = Optional.ofNullable(inst_nextDevice.getExtraValue().get("isFront")).map(Object::toString).map(Boolean::parseBoolean).orElse(false);
|
||||
if (from_y % 4 == 1 || from_y % 4 == 2) {
|
||||
//分配后叉
|
||||
if (!isFront) {
|
||||
assignedDto = dto;
|
||||
break;
|
||||
}
|
||||
} else if (from_y % 4 == 3 || from_y % 4 == 0) {
|
||||
//分配前叉
|
||||
if (isFront) {
|
||||
assignedDto = dto;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
TaskDto bindTaskDto = this.isBind(taskDtos, taskDto, taskDto.getTask_code());
|
||||
if (bindTaskDto != null) {
|
||||
bindTaskCode.add(bindTaskDto.getTask_code());
|
||||
for (DeviceAssignedDto dto : assignedDtos) {
|
||||
String inst_nextDevice_code = dto.getInst_nextDevice_code();
|
||||
Device inst_nextDevice = deviceAppService.findDeviceByCode(inst_nextDevice_code);
|
||||
if (inst_nextDevice != null) {
|
||||
Boolean isFront = Optional.ofNullable(inst_nextDevice.getExtraValue().get("isFront")).map(Object::toString).map(Boolean::parseBoolean).orElse(false);
|
||||
if (from_y % 4 == 1 || from_y % 4 == 2) {
|
||||
//分配后叉
|
||||
if (!isFront) {
|
||||
assignedDto = dto;
|
||||
break;
|
||||
}
|
||||
} else if (from_y % 4 == 3 || from_y % 4 == 0) {
|
||||
//分配前叉
|
||||
if (isFront) {
|
||||
assignedDto = dto;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Set<Integer> keys = tempAss.keySet();
|
||||
Integer minKey = Collections.min(keys);
|
||||
Integer maxKey = Collections.max(keys);
|
||||
List<DeviceAssignedDto> minList = tempAss.get(minKey);
|
||||
List<DeviceAssignedDto> maxList = tempAss.get(maxKey);
|
||||
if (minList.size() == maxList.size()) {
|
||||
|
||||
}
|
||||
//List<DeviceAssignedDto> maxList = tempAss.get(maxKey);
|
||||
assignedDto = minList.get(0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
assignedDto = assignedDtos.get(0);
|
||||
}
|
||||
@@ -975,32 +945,6 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
}
|
||||
}
|
||||
|
||||
private TaskDto isBind(List<TaskDto> taskDtos, TaskDto link_task, String task_code) {
|
||||
String from_x = link_task.getFrom_x();
|
||||
String from_y = link_task.getFrom_y();
|
||||
String from_z = link_task.getFrom_z();
|
||||
return taskDtos.stream()
|
||||
.filter(taskDto -> !taskDto.getTask_code().equals(task_code))
|
||||
.filter(taskDto -> taskDto.getTask_status().equals(TaskStatusEnum.READY.getIndex()))
|
||||
.filter(taskDto -> taskDto.getFrom_x().equals(from_x) && taskDto.getFrom_z().equals(from_z))
|
||||
.filter(taskDto -> {
|
||||
int frontFromY = Integer.parseInt(from_y);
|
||||
int taskDtoFromY = Integer.parseInt(taskDto.getFrom_y());
|
||||
int frontGroup = (frontFromY - 1) / 4;
|
||||
int taskDtoGroup = (taskDtoFromY - 1) / 4;
|
||||
if (frontGroup != taskDtoGroup) {
|
||||
return false;
|
||||
}
|
||||
int frontMod = frontFromY % 4;
|
||||
int taskDtoMod = taskDtoFromY % 4;
|
||||
return (frontMod + taskDtoMod == 2 || frontMod + taskDtoMod == 4);
|
||||
})
|
||||
.sorted(Comparator.comparing(TaskDto::getPriority)
|
||||
.thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下发输送线指令
|
||||
*/
|
||||
@@ -1017,14 +961,8 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
if (next_device != null && next_device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
List<String> targetDeviceCode = this.getExtraDeviceCodes("targetDeviceCode");
|
||||
if (targetDeviceCode != null && targetDeviceCode.contains(next_device_code)) {
|
||||
// if (StrUtil.equals(String.valueOf(this.task), inst.getInstruction_code())) {
|
||||
// this.writing(Arrays.asList(ItemProtocol.TO_COMMAND.getKey()), Arrays.asList(CommandEnum.COMMAND_1.getValue()));
|
||||
// this.requireSuccess = true;
|
||||
// } else {
|
||||
Integer address = Optional.ofNullable(next_device.getExtraValue().get("address")).map(Object::toString).map(Integer::parseInt).orElse(0);
|
||||
this.writing(Arrays.asList(ItemProtocol.TO_TASK.getKey(), ItemProtocol.TO_TARGET.getKey()), Arrays.asList(inst.getInstruction_code(), address));
|
||||
//this.writing(Arrays.asList(ItemProtocol.TO_TARGET.getKey()), Arrays.asList(address));
|
||||
// }
|
||||
this.requireSuccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.util.concurrent.Uninterruptibles;
|
||||
import lombok.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.nl.acs.device.device.domain.Device;
|
||||
import org.nl.acs.device.device.service.DeviceAppService;
|
||||
import org.nl.acs.device.driver.*;
|
||||
@@ -45,9 +46,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description 1、适用于单/双堆垛机;
|
||||
* 2、默认优先执行移库任务;
|
||||
* 3、其次按照堆垛机设置的策略(入库优先(含拣选出库)策略、出库优先策略、时间顺序策略、一进一出策略)执行;
|
||||
* 4、除移库任务是从任务列表中查找,其余任务都是从指令列表中查找就绪状态下的信息
|
||||
* 2、默认优先执行移库任务,其次执行换层任务,再按照堆垛机所在位置执行一进一出的出入库任务;
|
||||
* @Author Gengby
|
||||
* @Date 2024/6/26
|
||||
*/
|
||||
@@ -360,6 +359,16 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
private List<Integer> HAS_GOODS = Arrays.asList(2, 3, 6, 7, 10, 11, 14, 15, 18, 19, 22, 23, 26, 27, 30, 31);
|
||||
|
||||
|
||||
/**
|
||||
* 任务申请失败通知时间
|
||||
*/
|
||||
private long errorRequireTime = System.currentTimeMillis();
|
||||
|
||||
/**
|
||||
* 任务申请失败请求间隔时间
|
||||
*/
|
||||
private long errorRequireTimeOut = 60000L;
|
||||
|
||||
private Map<String, Map<String, List<String>>> createFloorMappingPoint() {
|
||||
List<JSONObject> floorPoint = this.getExtraListValue("floorPoint");
|
||||
Map<String, Map<String, List<String>>> floorMappingPoint = new HashMap<>();
|
||||
@@ -537,11 +546,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
if (this.back_command != this.lastBack_command || this.front_command != this.lastFront_command) {
|
||||
this.requireSuccess = false;
|
||||
}
|
||||
|
||||
if (this.front_Zerror != this.lastFront_Zerror || this.back_Zerror != this.lastBack_Zerror) {
|
||||
if (AGAIN_ERROR.contains(this.front_Zerror) || AGAIN_ERROR.contains(this.back_Zerror)) {
|
||||
this.againRequireSuccess = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.front_Zerror == ErrorEnum.MR.getCode()) {
|
||||
if (!this.againRequireSuccess) {
|
||||
this.mR(this.front_task, ForkTypeEnum.FRONT.getCode());
|
||||
@@ -551,6 +562,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
this.mR(this.back_task, ForkTypeEnum.BACK.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
if (this.front_Zerror == ErrorEnum.KC.getCode() && this.back_Zerror == ErrorEnum.KC.getCode()) {
|
||||
if (!this.againRequireSuccess) {
|
||||
this.kC(this.front_task);
|
||||
@@ -573,6 +585,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.front_Zerror == ErrorEnum.ZD.getCode() && this.back_Zerror == ErrorEnum.ZD.getCode()
|
||||
&& NO_HAS_GOODS.contains(this.front_forkCargo) && NO_HAS_GOODS.contains(this.back_forkCargo)
|
||||
) {
|
||||
@@ -686,52 +699,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
//出库
|
||||
else if (instanceStorage(back_start_device) && instanceAppearance(back_next_device)) {
|
||||
String getLinkDeviceCode = this.handExtraStringValue(back_next_device, "getLinkDeviceCode");
|
||||
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY");
|
||||
if (ObjectUtil.isEmpty(frontInst)) {
|
||||
frontInst = instructionService.findReadyInstByLinkDeviceCodeAndNextDeviceCode(getLinkDeviceCode, frontNoY, getFrontDeviceCodeList);
|
||||
if (ObjectUtil.isNotEmpty(frontInst)) {
|
||||
String qPoint = getZdPoint(frontInst.getStart_point_code());
|
||||
TaskDto taskDto = taskService.findByStartPointCode(qPoint);
|
||||
if (ObjectUtil.isNotEmpty(taskDto)) {
|
||||
String task_start_device_code = taskDto.getStart_device_code();
|
||||
String task_next_device_code = taskDto.getNext_device_code();
|
||||
Device task_start_device = deviceAppService.findDeviceByCode(task_start_device_code);
|
||||
Device task_next_devcice = deviceAppService.findDeviceByCode(task_next_device_code);
|
||||
if (task_start_device != null && task_next_devcice != null && instanceStorage(task_start_device) && instanceStorage(task_next_devcice)) {
|
||||
Instruction instruction = instructionService.findByTaskCodeFromCache(taskDto.getTask_code());
|
||||
if (ObjectUtil.isEmpty(instruction)) {
|
||||
frontInst = new Instruction();
|
||||
setInstruction(frontInst, taskDto);
|
||||
try {
|
||||
instructionService.create(frontInst);
|
||||
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskService.update(taskDto);
|
||||
} catch (Exception e) {
|
||||
this.unExecutedMessage = "后叉出库任务,取货完成后,创建前叉移库指令时出现异常,原因:" + e.getMessage();
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "后叉出库任务,取货完成后,创建前叉移库指令时出现异常,原因:" + e.getMessage()));
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
|
||||
this.sendPutInfoToPlc(null, backInst);
|
||||
return;
|
||||
}
|
||||
this.frontWrite(frontInst);
|
||||
} else {
|
||||
if (StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||
this.frontWrite(instruction);
|
||||
} else {
|
||||
this.sendPutInfoToPlc(null, backInst);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.sendPutInfoToPlc(null, backInst);
|
||||
}
|
||||
} else {
|
||||
this.frontWrite(frontInst);
|
||||
}
|
||||
} else {
|
||||
this.sendPutInfoToPlc(null, backInst);
|
||||
}
|
||||
}
|
||||
//前叉有货,后叉无货,后叉取货完成
|
||||
this.backGetFinish(back_next_device, frontInst, backInst, getFrontDeviceCodeList);
|
||||
this.requireSuccess = true;
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, backInst);
|
||||
@@ -773,52 +742,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
//出库
|
||||
else if (instanceStorage(front_start_device) && instanceAppearance(front_next_device)) {
|
||||
String getLinkDeviceCode = this.handExtraStringValue(front_next_device, "getLinkDeviceCode");
|
||||
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY");
|
||||
if (ObjectUtil.isEmpty(backInst)) {
|
||||
backInst = instructionService.findReadyInstByLinkDeviceCodeAndNextDeviceCode(getLinkDeviceCode, backNoY, getBackDeviceCodeList);
|
||||
if (ObjectUtil.isNotEmpty(backInst)) {
|
||||
String qPoint = getZdPoint(backInst.getStart_point_code());
|
||||
TaskDto taskDto = taskService.findByStartPointCode(qPoint);
|
||||
if (ObjectUtil.isNotEmpty(taskDto)) {
|
||||
String task_start_device_code = taskDto.getStart_device_code();
|
||||
String task_next_device_code = taskDto.getNext_device_code();
|
||||
Device task_start_device = deviceAppService.findDeviceByCode(task_start_device_code);
|
||||
Device task_next_devcice = deviceAppService.findDeviceByCode(task_next_device_code);
|
||||
if (task_start_device != null && task_next_devcice != null && instanceStorage(task_start_device) && instanceStorage(task_next_devcice)) {
|
||||
Instruction instruction = instructionService.findByTaskCodeFromCache(taskDto.getTask_code());
|
||||
if (ObjectUtil.isEmpty(instruction)) {
|
||||
backInst = new Instruction();
|
||||
setInstruction(backInst, taskDto);
|
||||
try {
|
||||
instructionService.create(backInst);
|
||||
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskService.update(taskDto);
|
||||
} catch (Exception e) {
|
||||
this.unExecutedMessage = "前叉出库任务,取货完成后,创建后叉移库指令时出现异常,原因:" + e.getMessage();
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "前叉出库任务,取货完成后,创建后叉移库指令时出现异常,原因:" + e.getMessage()));
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
|
||||
this.sendPutInfoToPlc(frontInst, null);
|
||||
return;
|
||||
}
|
||||
this.backWrite(backInst);
|
||||
} else {
|
||||
if (StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||
this.backWrite(instruction);
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, null);
|
||||
}
|
||||
} else {
|
||||
this.backWrite(backInst);
|
||||
}
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, null);
|
||||
}
|
||||
}
|
||||
//前叉有货,后叉无货,前叉取货完成
|
||||
this.frontGetFinish(front_next_device, frontInst, backInst, getBackDeviceCodeList);
|
||||
this.requireSuccess = true;
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, backInst);
|
||||
@@ -878,60 +803,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
//出库
|
||||
else if (instanceStorage(front_start_device) && instanceAppearance(front_next_device)) {
|
||||
String getLinkDeviceCode = this.handExtraStringValue(front_next_device, "getLinkDeviceCode");
|
||||
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY");
|
||||
if (ObjectUtil.isEmpty(backInst)) {
|
||||
backInst = instructionService.findShallowReadyInstByLinkDeviceCodeAndNextDeviceCode(getLinkDeviceCode, backNoY, getBackDeviceCodeList);
|
||||
if (ObjectUtil.isNotEmpty(backInst)) {
|
||||
this.backWrite(backInst);
|
||||
} else {
|
||||
backInst = instructionService.findDeepReadyInstByLinkDeviceCodeAndNextDeviceCode(getLinkDeviceCode, backNoY, getBackDeviceCodeList);
|
||||
if (ObjectUtil.isNotEmpty(backInst)) {
|
||||
String qPoint = getZdPoint(backInst.getStart_point_code());
|
||||
TaskDto taskDto = taskService.findByStartPointCode(qPoint);
|
||||
if (ObjectUtil.isNotEmpty(taskDto)) {
|
||||
String task_start_device_code = taskDto.getStart_device_code();
|
||||
String task_next_device_code = taskDto.getNext_device_code();
|
||||
Device task_start_device = deviceAppService.findDeviceByCode(task_start_device_code);
|
||||
Device task_next_devcice = deviceAppService.findDeviceByCode(task_next_device_code);
|
||||
if (task_start_device != null && task_next_devcice != null && instanceStorage(task_start_device) && instanceStorage(task_next_devcice)) {
|
||||
Instruction instruction = instructionService.findByTaskCodeFromCache(taskDto.getTask_code());
|
||||
if (ObjectUtil.isEmpty(instruction)) {
|
||||
backInst = new Instruction();
|
||||
setInstruction(backInst, taskDto);
|
||||
try {
|
||||
instructionService.create(backInst);
|
||||
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskService.update(taskDto);
|
||||
} catch (Exception e) {
|
||||
this.unExecutedMessage = "前叉出库任务,取货完成后,创建后叉移库指令时出现异常,原因:" + e.getMessage();
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "前叉出库任务,取货完成后,创建后叉移库指令时出现异常,原因:" + e.getMessage()));
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
|
||||
this.sendPutInfoToPlc(frontInst, null);
|
||||
return;
|
||||
}
|
||||
this.backWrite(backInst);
|
||||
} else {
|
||||
if (StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||
this.backWrite(instruction);
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, null);
|
||||
}
|
||||
} else {
|
||||
this.backWrite(backInst);
|
||||
}
|
||||
} else {
|
||||
//下发前叉放货信息
|
||||
this.sendPutInfoToPlc(frontInst, backInst);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, backInst);
|
||||
}
|
||||
//前叉取货完成
|
||||
this.frontGetFinish(front_next_device, frontInst, backInst, getBackDeviceCodeList);
|
||||
} else if (instanceAppearance(front_start_device) && instanceAppearance(front_next_device)) {
|
||||
if (ObjectUtil.isEmpty(backInst)) {
|
||||
// List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
|
||||
@@ -992,60 +865,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
//出库
|
||||
else if (instanceStorage(back_start_device) && instanceAppearance(back_next_device)) {
|
||||
String getLinkDeviceCode = this.handExtraStringValue(back_next_device, "getLinkDeviceCode");
|
||||
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY");
|
||||
if (ObjectUtil.isEmpty(frontInst)) {
|
||||
frontInst = instructionService.findShallowReadyInstByLinkDeviceCodeAndNextDeviceCode(getLinkDeviceCode, frontNoY, getFrontDeviceCodeList);
|
||||
if (ObjectUtil.isNotEmpty(frontInst)) {
|
||||
this.frontWrite(frontInst);
|
||||
} else {
|
||||
frontInst = instructionService.findDeepReadyInstByLinkDeviceCodeAndNextDeviceCode(getLinkDeviceCode, frontNoY, getFrontDeviceCodeList);
|
||||
if (ObjectUtil.isNotEmpty(frontInst)) {
|
||||
String qPoint = getZdPoint(frontInst.getStart_point_code());
|
||||
TaskDto taskDto = taskService.findByStartPointCode(qPoint);
|
||||
if (ObjectUtil.isNotEmpty(taskDto)) {
|
||||
String task_start_device_code = taskDto.getStart_device_code();
|
||||
String task_next_device_code = taskDto.getNext_device_code();
|
||||
Device task_start_device = deviceAppService.findDeviceByCode(task_start_device_code);
|
||||
Device task_next_devcice = deviceAppService.findDeviceByCode(task_next_device_code);
|
||||
if (task_start_device != null && task_next_devcice != null && instanceStorage(task_start_device) && instanceStorage(task_next_devcice)) {
|
||||
Instruction instruction = instructionService.findByTaskCodeFromCache(taskDto.getTask_code());
|
||||
if (ObjectUtil.isEmpty(instruction)) {
|
||||
frontInst = new Instruction();
|
||||
setInstruction(frontInst, taskDto);
|
||||
try {
|
||||
instructionService.create(frontInst);
|
||||
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskService.update(taskDto);
|
||||
} catch (Exception e) {
|
||||
this.unExecutedMessage = "后叉出库任务,取货完成后,创建前叉移库指令时出现异常,原因:" + e.getMessage();
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "后叉出库任务,取货完成后,创建前叉移库指令时出现异常,原因:" + e.getMessage()));
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
|
||||
this.sendPutInfoToPlc(null, backInst);
|
||||
return;
|
||||
}
|
||||
this.frontWrite(frontInst);
|
||||
} else {
|
||||
if (StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||
this.frontWrite(instruction);
|
||||
} else {
|
||||
this.sendPutInfoToPlc(null, backInst);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.sendPutInfoToPlc(null, backInst);
|
||||
}
|
||||
} else {
|
||||
this.frontWrite(frontInst);
|
||||
}
|
||||
} else {
|
||||
//下发前叉放货信息
|
||||
this.sendPutInfoToPlc(frontInst, backInst);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, backInst);
|
||||
}
|
||||
//后叉取货完成
|
||||
this.backGetFinish(back_next_device, frontInst, backInst, getFrontDeviceCodeList);
|
||||
} else if (instanceAppearance(back_start_device) && instanceAppearance(back_next_device)) {
|
||||
if (ObjectUtil.isEmpty(frontInst)) {
|
||||
//List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
|
||||
@@ -1079,9 +900,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
this.clearInfoToPlc();
|
||||
} else if (this.lastFront_command != CommandEnum.UNLOAD.getStatus() && this.front_command != CommandEnum.STANDY.getStatus()) {
|
||||
this.clearInfoToPlc();
|
||||
} else {
|
||||
this.requireSuccess = true;
|
||||
}
|
||||
this.requireSuccess = true;
|
||||
}
|
||||
//请求卸货
|
||||
else if (mode == ModeEnum.MODE_3.getNum() && this.isUnload() && !requireSuccess) {
|
||||
@@ -1274,18 +1094,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
} else {
|
||||
String strategyValue = Optional.ofNullable(this.getExtraValue().get("strategyValue")).map(Object::toString).orElse("");
|
||||
switch (strategyValue) {
|
||||
case "2":
|
||||
this.applyOutTask();
|
||||
break;
|
||||
case "3":
|
||||
this.applyTaskByTime();
|
||||
break;
|
||||
case "4":
|
||||
this.applyTaskOneInOneOut();
|
||||
break;
|
||||
default:
|
||||
this.applyInTask();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1304,7 +1115,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
|
||||
|
||||
/**
|
||||
* 拣选出库
|
||||
* 堆垛机换层任务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -1360,230 +1171,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 入库
|
||||
*/
|
||||
private void applyInTask() {
|
||||
boolean flag = this.applySpecialTask();
|
||||
if (flag) {
|
||||
this.unExecutedMessage = null;
|
||||
return;
|
||||
}
|
||||
if (!prohibitInWarehouse) {
|
||||
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
|
||||
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY");
|
||||
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
|
||||
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY");
|
||||
List<Instruction> frontInsts = instructionService.findReadyInstByStartDeviceCode(getFrontDeviceCodeList, frontNoY);
|
||||
Instruction frontInst = null;
|
||||
Instruction backInst = null;
|
||||
Device front_start_device = null;
|
||||
Device back_start_device = null;
|
||||
if (CollectionUtil.isNotEmpty(frontInsts)) {
|
||||
frontInst = frontInsts.get(0);
|
||||
if (ObjectUtil.isNotEmpty(frontInst)) {
|
||||
String front_start_device_code = frontInst.getStart_device_code();
|
||||
front_start_device = deviceAppService.findDeviceByCode(front_start_device_code);
|
||||
if (front_start_device != null) {
|
||||
String getLinkDeviceCode = this.handExtraStringValue(front_start_device, "getLinkDeviceCode");
|
||||
backInst = instructionService.findReadyInstByLinkDeviceCodeAndStartDeviceCode(getLinkDeviceCode, backNoY, getBackDeviceCodeList);
|
||||
if (ObjectUtil.isEmpty(backInst)) {
|
||||
Instruction inst = instructionService.findBusyInstByNextDeviceCode(getLinkDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(inst)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.stackerNum == 2) {
|
||||
List<Instruction> backInsts = instructionService.findReadyInstByStartDeviceCode(getBackDeviceCodeList, backNoY);
|
||||
if (CollectionUtil.isNotEmpty(backInsts)) {
|
||||
backInst = backInsts.get(0);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(backInst)) {
|
||||
String back_start_device_code = backInst.getStart_device_code();
|
||||
back_start_device = deviceAppService.findDeviceByCode(back_start_device_code);
|
||||
if (back_start_device != null) {
|
||||
String getLinkDeviceCode = this.handExtraStringValue(back_start_device, "getLinkDeviceCode");
|
||||
front_start_device = deviceAppService.findDeviceByCode(getLinkDeviceCode);
|
||||
if (front_start_device != null) {
|
||||
frontInst = instructionService.findReadyInstByLinkDeviceCodeAndStartDeviceCode(getLinkDeviceCode, frontNoY, getFrontDeviceCodeList);
|
||||
if (ObjectUtil.isEmpty(frontInst)) {
|
||||
Instruction inst = instructionService.findBusyInstByNextDeviceCode(getLinkDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(inst)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) {
|
||||
this.FBWrite(front_start_device, frontInst, backInst);
|
||||
this.unExecutedMessage = null;
|
||||
this.requireSuccess = true;
|
||||
} else if (ObjectUtil.isNotEmpty(frontInst)) {
|
||||
this.frontWrite(front_start_device, frontInst);
|
||||
this.unExecutedMessage = null;
|
||||
this.requireSuccess = true;
|
||||
} else if (ObjectUtil.isNotEmpty(backInst)) {
|
||||
this.backWrite(back_start_device, backInst);
|
||||
this.unExecutedMessage = null;
|
||||
this.requireSuccess = true;
|
||||
} else {
|
||||
String strategyValue = Optional.ofNullable(this.getExtraValue().get("strategyValue")).map(Object::toString).orElse("");
|
||||
if (ObjectUtil.equals(strategyValue, StrategyEnum.IN.getValue())) {
|
||||
this.applyOutTask();
|
||||
} else if (ObjectUtil.equals(strategyValue, StrategyEnum.OUT.getValue()) && !ObjectUtil.equals(strategyValue, StrategyEnum.TIME.getValue())) {
|
||||
this.unExecutedMessage = "堆垛机未查询到就绪状态下可执行的任务或指令信息";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.prohibitOutWarehouse) {
|
||||
this.unExecutedMessage = "堆垛机设置为禁止出库、禁止入库";
|
||||
return;
|
||||
}
|
||||
this.applyOutTask();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 出库(含拣选)
|
||||
*/
|
||||
private void applyOutTask() {
|
||||
if (!this.prohibitOutWarehouse) {
|
||||
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
|
||||
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
|
||||
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY");
|
||||
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY");
|
||||
List<Instruction> frontInsts = instructionService.findReadyInstByNextDeviceCode(getFrontDeviceCodeList, frontNoY);
|
||||
Instruction frontInst = null;
|
||||
Instruction backInst = null;
|
||||
if (CollectionUtil.isNotEmpty(frontInsts)) {
|
||||
frontInst = frontInsts.get(0);
|
||||
if (ObjectUtil.isNotEmpty(frontInst) && this.stackerNum == 2) {
|
||||
String front_next_device_code = frontInst.getNext_device_code();
|
||||
Device front_next_device = deviceAppService.findDeviceByCode(front_next_device_code);
|
||||
if (front_next_device != null) {
|
||||
String getLinkDeviceCode = this.handExtraStringValue(front_next_device, "getLinkDeviceCode");
|
||||
backInst = instructionService.findReadyInstByNextDeviceCode(frontInst, getLinkDeviceCode, backNoY);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.stackerNum == 2) {
|
||||
List<Instruction> backInsts = instructionService.findReadyInstByNextDeviceCode(getBackDeviceCodeList, backNoY);
|
||||
if (CollectionUtil.isNotEmpty(backInsts)) {
|
||||
backInst = backInsts.get(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) {
|
||||
this.FBWrite(frontInst, backInst);
|
||||
this.unExecutedMessage = null;
|
||||
this.requireSuccess = true;
|
||||
} else if (ObjectUtil.isNotEmpty(frontInst)) {
|
||||
this.frontWrite(frontInst);
|
||||
this.unExecutedMessage = null;
|
||||
this.requireSuccess = true;
|
||||
} else if (ObjectUtil.isNotEmpty(backInst)) {
|
||||
this.backWrite(backInst);
|
||||
this.unExecutedMessage = null;
|
||||
this.requireSuccess = true;
|
||||
} else {
|
||||
String strategyValue = Optional.ofNullable(this.getExtraValue().get("strategyValue")).map(Object::toString).orElse("");
|
||||
if (ObjectUtil.equals(strategyValue, StrategyEnum.OUT.getValue())) {
|
||||
this.applyInTask();
|
||||
} else if (ObjectUtil.equals(strategyValue, StrategyEnum.IN.getValue()) && !ObjectUtil.equals(strategyValue, StrategyEnum.TIME.getValue())) {
|
||||
this.unExecutedMessage = "堆垛机未查询到就绪状态下可执行的任务或指令信息";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this.prohibitInWarehouse) {
|
||||
this.unExecutedMessage = "堆垛机设置为禁止出库、禁止入库";
|
||||
return;
|
||||
}
|
||||
this.applyInTask();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间顺序策略
|
||||
*/
|
||||
private void applyTaskByTime() {
|
||||
boolean flag = this.applySpecialTask();
|
||||
if (flag) {
|
||||
this.unExecutedMessage = null;
|
||||
return;
|
||||
}
|
||||
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
|
||||
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY");
|
||||
List<Instruction> frontInsts = instructionService.findReadyInstByDeviceCode(getFrontDeviceCodeList, frontNoY);
|
||||
Instruction frontInst = null;
|
||||
if (CollectionUtil.isNotEmpty(frontInsts)) {
|
||||
frontInst = frontInsts.get(0);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(frontInst)) {
|
||||
String front_start_device_code = frontInst.getStart_device_code();
|
||||
Device front_start_device = deviceAppService.findDeviceByCode(front_start_device_code);
|
||||
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY");
|
||||
if (front_start_device != null && front_start_device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
String getLinkDeviceCode = this.handExtraStringValue(front_start_device, "getLinkDeviceCode");
|
||||
Instruction backInst = instructionService.findReadyInstByStartDeviceCode(frontInst, getLinkDeviceCode, backNoY);
|
||||
if (ObjectUtil.isNotEmpty(getLinkDeviceCode) && deviceAppService.findDeviceByCode(getLinkDeviceCode) != null && ObjectUtil.isNotEmpty(backInst)) {
|
||||
this.FBWrite(front_start_device, frontInst, backInst);
|
||||
this.unExecutedMessage = null;
|
||||
this.requireSuccess = true;
|
||||
} else {
|
||||
this.frontWrite(front_start_device, frontInst);
|
||||
this.unExecutedMessage = null;
|
||||
this.requireSuccess = true;
|
||||
}
|
||||
} else if (front_start_device != null && front_start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
String next_device_code = frontInst.getNext_device_code();
|
||||
Device next_device = deviceAppService.findDeviceByCode(next_device_code);
|
||||
if (next_device != null && next_device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
String getLinkDeviceCode = Optional.ofNullable(next_device.getExtraValue().get("getLinkDeviceCode")).map(Object::toString).orElse(null);
|
||||
Instruction backInst = instructionService.findReadyInstByNextDeviceCode(frontInst, getLinkDeviceCode, backNoY);
|
||||
if (ObjectUtil.isNotEmpty(getLinkDeviceCode) && deviceAppService.findDeviceByCode(getLinkDeviceCode) != null && ObjectUtil.isNotEmpty(backInst)) {
|
||||
this.FBWrite(frontInst, backInst);
|
||||
this.unExecutedMessage = null;
|
||||
this.requireSuccess = true;
|
||||
} else {
|
||||
this.frontWrite(frontInst);
|
||||
this.unExecutedMessage = null;
|
||||
this.requireSuccess = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
|
||||
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY");
|
||||
List<Instruction> backInsts = instructionService.findReadyInstByDeviceCode(getBackDeviceCodeList, backNoY);
|
||||
Instruction backInst = null;
|
||||
if (CollectionUtil.isNotEmpty(backInsts)) {
|
||||
backInst = backInsts.get(0);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(backInst)) {
|
||||
String back_start_device_code = backInst.getStart_device_code();
|
||||
Device back_start_device = deviceAppService.findDeviceByCode(back_start_device_code);
|
||||
if (back_start_device != null && back_start_device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
this.backWrite(back_start_device, backInst);
|
||||
this.unExecutedMessage = null;
|
||||
this.requireSuccess = true;
|
||||
} else if (back_start_device != null && back_start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
this.backWrite(backInst);
|
||||
this.unExecutedMessage = null;
|
||||
this.requireSuccess = true;
|
||||
}
|
||||
} else {
|
||||
this.unExecutedMessage = "堆垛机未查询到就绪状态下可执行的任务或指令信息";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 一进一出策略
|
||||
* 根据楼层优先级
|
||||
@@ -1884,9 +1471,34 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
|
||||
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY");
|
||||
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY");
|
||||
List<Instruction> frontInsts = instructionService.findShallowReadyInstByNextDeviceCode(getFrontDeviceCodeList, frontNoY);
|
||||
if (CollectionUtil.isNotEmpty(frontInsts)) {
|
||||
frontInst = frontInsts.get(0);
|
||||
//先根据优先级和时间顺序查看指令信息
|
||||
List<Instruction> frontInsts = instructionService.findAllInstByPriorityCreateTime(getFrontDeviceCodeList, frontNoY);
|
||||
//如果查询到的是浅货位的指令信息,则直接下发
|
||||
if (CollectionUtils.isNotEmpty(frontInsts)) {
|
||||
for (Instruction inst : frontInsts) {
|
||||
String start_device_code = inst.getStart_device_code();
|
||||
//判断当前库位是深库位还是浅库位
|
||||
int x = Integer.parseInt(getNumericPart(start_device_code));
|
||||
//如果是深库位
|
||||
if (x == 1 || x == 4) {
|
||||
//查询对应的浅货位编码
|
||||
String shallStartPointCode = getZdPoint(inst.getStart_point_code());
|
||||
//查询对应的浅库位是否存在就绪的指令信息
|
||||
Instruction shallInst = instructionService.findReadyInstByStartPointCode(shallStartPointCode);
|
||||
if (shallInst != null) {
|
||||
frontInst = shallInst;
|
||||
break;
|
||||
}
|
||||
//若不存在,则查询是否存在就绪的任务信息
|
||||
TaskDto shallTask = taskService.findReadyByStartPointCode(shallStartPointCode);
|
||||
if (shallTask != null) {
|
||||
continue;
|
||||
}
|
||||
//如果不存在就绪的指令信息和任务信息,直接结束循环
|
||||
}
|
||||
frontInst = inst;
|
||||
break;
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(frontInst) && this.stackerNum == 2) {
|
||||
String front_next_device_code = frontInst.getNext_device_code();
|
||||
Device front_next_device = deviceAppService.findDeviceByCode(front_next_device_code);
|
||||
@@ -1899,28 +1511,30 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
} else {
|
||||
if (this.stackerNum == 2) {
|
||||
List<Instruction> backInsts = instructionService.findShallowReadyInstByNextDeviceCode(getBackDeviceCodeList, backNoY);
|
||||
if (CollectionUtil.isNotEmpty(backInsts)) {
|
||||
backInst = backInsts.get(0);
|
||||
} else {
|
||||
frontInsts = instructionService.findDeepReadyInstByNextDeviceCode(getFrontDeviceCodeList, frontNoY);
|
||||
if (CollectionUtil.isNotEmpty(frontInsts)) {
|
||||
frontInst = frontInsts.get(0);
|
||||
if (ObjectUtil.isNotEmpty(frontInst) && this.stackerNum == 2) {
|
||||
String front_next_device_code = frontInst.getNext_device_code();
|
||||
Device front_next_device = deviceAppService.findDeviceByCode(front_next_device_code);
|
||||
if (front_next_device != null) {
|
||||
String getLinkDeviceCode = this.handExtraStringValue(front_next_device, "getLinkDeviceCode");
|
||||
if (StrUtil.isNotEmpty(getLinkDeviceCode)) {
|
||||
backInst = instructionService.findDeepReadyInstByNextDeviceCode(frontInst, getLinkDeviceCode, backNoY, getBackDeviceCodeList);
|
||||
List<Instruction> backInsts = instructionService.findAllInstByPriorityCreateTime(getBackDeviceCodeList, backNoY);
|
||||
if (CollectionUtils.isNotEmpty(backInsts)) {
|
||||
for (Instruction inst : backInsts) {
|
||||
String start_device_code = inst.getStart_device_code();
|
||||
//判断当前库位是深库位还是浅库位
|
||||
int x = Integer.parseInt(getNumericPart(start_device_code));
|
||||
//如果是深库位
|
||||
if (x == 1 || x == 4) {
|
||||
//查询对应的浅货位编码
|
||||
String shallStartPointCode = getZdPoint(inst.getStart_point_code());
|
||||
//查询对应的浅库位是否存在就绪的指令信息
|
||||
Instruction shallInst = instructionService.findReadyInstByStartPointCode(shallStartPointCode);
|
||||
if (shallInst != null) {
|
||||
backInst = shallInst;
|
||||
break;
|
||||
}
|
||||
//若不存在,则查询是否存在就绪的任务信息
|
||||
TaskDto shallTask = taskService.findReadyByStartPointCode(shallStartPointCode);
|
||||
if (shallTask != null) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
backInsts = instructionService.findDeepReadyInstByNextDeviceCode(getBackDeviceCodeList, backNoY);
|
||||
if (CollectionUtil.isNotEmpty(backInsts)) {
|
||||
backInst = backInsts.get(0);
|
||||
}
|
||||
backInst = inst;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2208,7 +1822,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
Device front_device = deviceAppService.findDeviceByCode(front_start_device_code);
|
||||
Device back_device = deviceAppService.findDeviceByCode(back_start_device_code);
|
||||
String back_device_code = this.handExtraStringValue(front_device, "getLinkDeviceCode");
|
||||
|
||||
if (instanceStorage(front_device) && instanceStorage(back_device)) {
|
||||
String front_from_x = frontInst.getFrom_x();
|
||||
String front_from_y = frontInst.getFrom_y();
|
||||
@@ -2334,6 +1947,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
this.requireSuccess = true;
|
||||
}
|
||||
|
||||
|
||||
private boolean isErrorTimeValid(long errorCurrentTimeMillis) {
|
||||
return errorCurrentTimeMillis - this.errorRequireTime >= this.errorRequireTimeOut;
|
||||
}
|
||||
|
||||
/**
|
||||
* 满入
|
||||
*/
|
||||
@@ -2369,6 +1987,23 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
this.againRequireSuccess = true;
|
||||
}
|
||||
} else {
|
||||
if (isErrorTimeValid(currentTimeMillis)) {
|
||||
this.errorRequireTime = currentTimeMillis;
|
||||
String notifyValue = Optional.ofNullable(sysParamService.findByCode("is_notify"))
|
||||
.map(notify -> notify.getValue())
|
||||
.orElse("0");
|
||||
if (notifyValue.equals("1")) {
|
||||
JSONObject dataParam = new JSONObject();
|
||||
dataParam.put("msg", "堆垛机满入申请重新分配库位失败! 请求参数: " + request + "响应信息: " + response.getMessage());
|
||||
CommonRequest<JSONObject> requestParam = CommonRequest.<JSONObject>builder()
|
||||
.service("ErrorInfo")
|
||||
.type("1")
|
||||
.data(dataParam)
|
||||
.build();
|
||||
acsToWmsService.apply(requestParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2400,6 +2035,23 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
instructionService.cancelInstAndTask(inst.getInstruction_id());
|
||||
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_FIVE.getSignalNum());
|
||||
this.againRequireSuccess = true;
|
||||
} else {
|
||||
if (isErrorTimeValid(currentTimeMillis)) {
|
||||
this.errorRequireTime = currentTimeMillis;
|
||||
String notifyValue = Optional.ofNullable(sysParamService.findByCode("is_notify"))
|
||||
.map(notify -> notify.getValue())
|
||||
.orElse("0");
|
||||
if (notifyValue.equals("1")) {
|
||||
JSONObject dataParam = new JSONObject();
|
||||
dataParam.put("msg", "堆垛机空出反馈WMS失败! 请求参数: " + request + "响应信息: " + response.getMessage());
|
||||
CommonRequest<JSONObject> requestParam = CommonRequest.<JSONObject>builder()
|
||||
.service("ErrorInfo")
|
||||
.type("1")
|
||||
.data(dataParam)
|
||||
.build();
|
||||
acsToWmsService.apply(requestParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2441,6 +2093,23 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_FIVE.getSignalNum());
|
||||
this.againRequireSuccess = true;
|
||||
} else {
|
||||
if (isErrorTimeValid(currentTimeMillis)) {
|
||||
this.errorRequireTime = currentTimeMillis;
|
||||
String notifyValue = Optional.ofNullable(sysParamService.findByCode("is_notify"))
|
||||
.map(notify -> notify.getValue())
|
||||
.orElse("0");
|
||||
if (notifyValue.equals("1")) {
|
||||
JSONObject dataParam = new JSONObject();
|
||||
dataParam.put("msg", "堆垛机取货时浅货位有货反馈WMS失败! 请求参数: " + request + "响应信息: " + response.getMessage());
|
||||
CommonRequest<JSONObject> requestParam = CommonRequest.<JSONObject>builder()
|
||||
.service("ErrorInfo")
|
||||
.type("1")
|
||||
.data(dataParam)
|
||||
.build();
|
||||
acsToWmsService.apply(requestParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2497,6 +2166,23 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
}
|
||||
this.againRequireSuccess = true;
|
||||
} else {
|
||||
if (isErrorTimeValid(currentTimeMillis)) {
|
||||
this.errorRequireTime = currentTimeMillis;
|
||||
String notifyValue = Optional.ofNullable(sysParamService.findByCode("is_notify"))
|
||||
.map(notify -> notify.getValue())
|
||||
.orElse("0");
|
||||
if (notifyValue.equals("1")) {
|
||||
JSONObject dataParam = new JSONObject();
|
||||
dataParam.put("msg", "堆垛机放货时浅货位有货申请重新分配库位失败! 请求参数: " + request + "响应信息: " + response.getMessage());
|
||||
CommonRequest<JSONObject> requestParam = CommonRequest.<JSONObject>builder()
|
||||
.service("ErrorInfo")
|
||||
.type("1")
|
||||
.data(dataParam)
|
||||
.build();
|
||||
acsToWmsService.apply(requestParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2603,4 +2289,178 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
instdto.setInstruction_type(taskDto.getTask_type());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 出库时,后叉取货完成,下发前叉取/后叉放货信息
|
||||
*
|
||||
* @param back_next_device
|
||||
* @param frontInst
|
||||
* @param getFrontDeviceCodeList
|
||||
*/
|
||||
private void backGetFinish(Device back_next_device, Instruction frontInst, Instruction backInst, List<String> getFrontDeviceCodeList) {
|
||||
List<String> xDeviceCodeList = this.getExtraDeviceCodes("xDeviceCodeList");
|
||||
String getLinkDeviceCode = this.handExtraStringValue(back_next_device, "getLinkDeviceCode");
|
||||
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY");
|
||||
if (ObjectUtil.isEmpty(frontInst)) {
|
||||
//前叉无货,后叉有货,前叉无指令信息,后叉有指令信息
|
||||
//根据后叉关联点位,按照优先级、创建时间去查询前叉指令信息
|
||||
List<Instruction> frontInsts = instructionService.findAllInstByPriorityCreateTime(getLinkDeviceCode, getFrontDeviceCodeList, frontNoY);
|
||||
//遍历前叉指令信息,判断前叉指令起点是深库位还是浅库位
|
||||
if (CollectionUtils.isNotEmpty(frontInsts)) {
|
||||
for (Instruction inst : frontInsts) {
|
||||
String start_device_code = inst.getStart_device_code();
|
||||
//判断当前库位是深库位还是浅库位
|
||||
int x = Integer.parseInt(getNumericPart(start_device_code));
|
||||
//如果是深库位
|
||||
if (x == 1 || x == 4) {
|
||||
//查询对应的浅货位编码
|
||||
String shallStartPointCode = getZdPoint(inst.getStart_point_code());
|
||||
//查询对应的浅库位是否存在就绪的指令信息
|
||||
Instruction shallInst = instructionService.findReadyInstByStartPointCode(shallStartPointCode);
|
||||
if (shallInst != null) {
|
||||
//判断该就绪的指令信息是否是堆垛机库内移库指令信息
|
||||
String next_device_code = shallInst.getNext_device_code();
|
||||
if (xDeviceCodeList.contains(next_device_code)) {
|
||||
Set<String> currentNoY = frontNoY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(frontNoY.split(",")));
|
||||
//如果是的话,判断终点是否前叉可达的,
|
||||
if (!currentNoY.contains(String.valueOf(Integer.parseInt(shallInst.getFrom_y())))) {
|
||||
// 如果前叉可达,则下发前叉移库指令的取货信息 break;
|
||||
this.frontWrite(shallInst);
|
||||
break;
|
||||
}
|
||||
// 否则直接下发后叉放货信息 break
|
||||
this.sendPutInfoToPlc(null, backInst);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
//若不存在,则查询是否存在就绪的任务信息
|
||||
TaskDto shallTask = taskService.findReadyByStartPointCode(shallStartPointCode);
|
||||
if (shallTask != null) {
|
||||
//判断该就绪的任务信息是否是堆垛机库内移库任务信息
|
||||
String next_device_code = shallTask.getNext_device_code();
|
||||
if (xDeviceCodeList.contains(next_device_code)) {
|
||||
Set<String> currentNoY = frontNoY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(frontNoY.split(",")));
|
||||
//如果是的话,判断终点是否前叉可达的,
|
||||
if (!currentNoY.contains(String.valueOf(Integer.parseInt(shallTask.getFrom_y())))) {
|
||||
// 如果前叉可达,则创建移库指令,并下发前叉移库指令的取货信息 break;
|
||||
frontInst = new Instruction();
|
||||
setInstruction(frontInst, shallTask);
|
||||
try {
|
||||
instructionService.create(frontInst);
|
||||
shallTask.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskService.update(shallTask);
|
||||
} catch (Exception e) {
|
||||
this.unExecutedMessage = "后叉出库任务,取货完成后,创建前叉移库指令时出现异常,原因:" + e.getMessage();
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "后叉出库任务,取货完成后,创建前叉移库指令时出现异常,原因:" + e.getMessage()));
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
|
||||
this.sendPutInfoToPlc(null, backInst);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 否则直接下发后叉放货信息 break
|
||||
this.sendPutInfoToPlc(null, backInst);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
frontInst = inst;
|
||||
this.frontWrite(frontInst);
|
||||
//直接下发前叉取货信息
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
this.sendPutInfoToPlc(null, backInst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 出库时,前叉取货完成,下发后叉取/前叉放货信息
|
||||
*
|
||||
* @param front_next_device
|
||||
* @param frontInst
|
||||
* @param backInst
|
||||
* @param getBackDeviceCodeList
|
||||
*/
|
||||
private void frontGetFinish(Device front_next_device, Instruction frontInst, Instruction backInst, List<String> getBackDeviceCodeList) {
|
||||
List<String> xDeviceCodeList = this.getExtraDeviceCodes("xDeviceCodeList");
|
||||
String getLinkDeviceCode = this.handExtraStringValue(front_next_device, "getLinkDeviceCode");
|
||||
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY");
|
||||
if (ObjectUtil.isEmpty(backInst)) {
|
||||
//根据后叉关联点位,按照优先级、创建时间去查询后叉指令信息
|
||||
List<Instruction> backInsts = instructionService.findAllInstByPriorityCreateTime(getLinkDeviceCode, getBackDeviceCodeList, backNoY);
|
||||
//遍历后叉指令信息,判断后叉指令起点是深库位还是浅库位
|
||||
if (CollectionUtils.isNotEmpty(backInsts)) {
|
||||
for (Instruction inst : backInsts) {
|
||||
String start_device_code = inst.getStart_device_code();
|
||||
//判断当前库位是深库位还是浅库位
|
||||
int x = Integer.parseInt(getNumericPart(start_device_code));
|
||||
//如果是深库位
|
||||
if (x == 1 || x == 4) {
|
||||
//查询对应的浅货位编码
|
||||
String shallStartPointCode = getZdPoint(inst.getStart_point_code());
|
||||
//查询对应的浅库位是否存在就绪的指令信息
|
||||
Instruction shallInst = instructionService.findReadyInstByStartPointCode(shallStartPointCode);
|
||||
if (shallInst != null) {
|
||||
//判断该就绪的指令信息是否是堆垛机库内移库指令信息
|
||||
String next_device_code = shallInst.getNext_device_code();
|
||||
if (xDeviceCodeList.contains(next_device_code)) {
|
||||
Set<String> currentNoY = backNoY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(backNoY.split(",")));
|
||||
//如果是的话,判断终点是否后叉可达的,
|
||||
if (!currentNoY.contains(String.valueOf(Integer.parseInt(shallInst.getFrom_y())))) {
|
||||
// 如果后叉可达,则下发后叉移库指令的取货信息 break;
|
||||
this.backWrite(shallInst);
|
||||
break;
|
||||
}
|
||||
// 否则直接下发前叉放货信息 break
|
||||
this.sendPutInfoToPlc(frontInst, null);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
//若不存在,则查询是否存在就绪的任务信息
|
||||
TaskDto shallTask = taskService.findReadyByStartPointCode(shallStartPointCode);
|
||||
if (shallTask != null) {
|
||||
//判断该就绪的任务信息是否是堆垛机库内移库任务信息
|
||||
String next_device_code = shallTask.getNext_device_code();
|
||||
if (xDeviceCodeList.contains(next_device_code)) {
|
||||
Set<String> currentNoY = backNoY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(backNoY.split(",")));
|
||||
//如果是的话,判断终点是否后叉可达的,
|
||||
if (!currentNoY.contains(String.valueOf(Integer.parseInt(shallTask.getFrom_y())))) {
|
||||
// 如果后叉可达,则创建移库指令,并下发后叉移库指令的取货信息 break;
|
||||
backInst = new Instruction();
|
||||
setInstruction(backInst, shallTask);
|
||||
try {
|
||||
instructionService.create(backInst);
|
||||
shallTask.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskService.update(shallTask);
|
||||
} catch (Exception e) {
|
||||
this.unExecutedMessage = "前叉出库任务,取货完成后,创建后叉移库指令时出现异常,原因:" + e.getMessage();
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "前叉出库任务,取货完成后,创建后叉移库指令时出现异常,原因:" + e.getMessage()));
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage()));
|
||||
this.sendPutInfoToPlc(frontInst, null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 否则直接下发前叉放货信息 break
|
||||
this.sendPutInfoToPlc(frontInst, null);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//直接下发后叉取货信息
|
||||
backInst = inst;
|
||||
this.backWrite(backInst);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -493,32 +493,6 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
* @return
|
||||
*/
|
||||
List<Instruction> findReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY);
|
||||
List<Instruction> findDeepReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY);
|
||||
List<Instruction> findShallowReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY);
|
||||
|
||||
/**
|
||||
* 用于时间顺序出入库策略
|
||||
* 查询前叉或后叉可达设备的指令信息
|
||||
*
|
||||
* @param device_code_list
|
||||
* @param noY
|
||||
* @return
|
||||
*/
|
||||
List<Instruction> findReadyInstByDeviceCode(List<String> device_code_list, String noY);
|
||||
|
||||
|
||||
/**
|
||||
* 用于优先入库策略和时间顺序策略
|
||||
* 主要是根据前叉指令排列层信息及前叉指令起点关联设备
|
||||
* 一般是入库时根据指令起点查询是否可组成双叉指令
|
||||
*
|
||||
* @param frontInst
|
||||
* @param link_device_code
|
||||
* @param noY
|
||||
* @return
|
||||
*/
|
||||
Instruction findReadyInstByStartDeviceCode(Instruction frontInst, String link_device_code, String noY);
|
||||
|
||||
|
||||
/**
|
||||
* @param linkDeviceCode
|
||||
@@ -541,10 +515,6 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
*/
|
||||
Instruction findShallowReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList);
|
||||
|
||||
Instruction findReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList);
|
||||
Instruction findDeepReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY,List<String> getDeviceCodeList);
|
||||
Instruction findShallowReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY,List<String> getDeviceCodeList);
|
||||
|
||||
/**
|
||||
* 用于优先出库策略和时间顺序策略 -出库
|
||||
* 主要是根据前叉指令的排列层、前叉指令终点的关联设备,查询后叉指令信息
|
||||
@@ -556,7 +526,8 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
* @return
|
||||
*/
|
||||
Instruction findReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY);
|
||||
Instruction findDeepReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY, List<String> getDeviceCodeList);
|
||||
|
||||
|
||||
Instruction findShallowReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY, List<String> getDeviceCodeList);
|
||||
|
||||
|
||||
@@ -572,6 +543,8 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
Instruction findReadyInstByEnd(String next_device_code);
|
||||
|
||||
Instruction findReadyInstByStartPointCode(String start_point_code);
|
||||
|
||||
int findReadyInstNumByEnd(String next_device_code);
|
||||
|
||||
Instruction findReadyInstByVehicleCode(String vehicleCode);
|
||||
@@ -590,5 +563,22 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
Instruction findByNextPointCode(String nextPointCode);
|
||||
|
||||
List<Instruction> findInstsByNextDeviceCode(String deviceCode);
|
||||
|
||||
/**
|
||||
* 根据优先级和创建时间顺序去查找前/后叉可取指令信息
|
||||
*
|
||||
* @param next_device_code_list
|
||||
* @param noY
|
||||
* @return
|
||||
*/
|
||||
List<Instruction> findAllInstByPriorityCreateTime(List<String> next_device_code_list, String noY);
|
||||
|
||||
/**
|
||||
* 根据前后叉对接位关联点位及优先级和创建时间顺序去查找前/后叉可取指令信息
|
||||
*
|
||||
* @param next_device_code_list
|
||||
* @param noY
|
||||
* @return
|
||||
*/
|
||||
List<Instruction> findAllInstByPriorityCreateTime(String link_device_code, List<String> next_device_code_list, String noY);
|
||||
}
|
||||
|
||||
@@ -1954,59 +1954,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Instruction> findDeepReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY) {
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
|
||||
.filter(inst -> next_device_code_list.contains(inst.getNext_device_code()))
|
||||
.filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
|
||||
.filter(inst -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 1 || Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 0)
|
||||
// .sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4).reversed()
|
||||
.sorted(Comparator.comparingInt((Instruction inst) -> {
|
||||
int startCode = Integer.parseInt(getNumericPart(inst.getStart_device_code()));
|
||||
if (startCode == 1 || startCode == 4) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
})
|
||||
.thenComparing(inst -> Integer.parseInt(inst.getNext_device_code()))
|
||||
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_z()) ? "0" : inst.getFrom_z()))
|
||||
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_y()) ? "0" : inst.getFrom_y()))
|
||||
.thenComparing(Comparator.comparing(Instruction::getPriority))
|
||||
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Instruction> findShallowReadyInstByNextDeviceCode(List<String> next_device_code_list, String noY) {
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
|
||||
.filter(inst -> next_device_code_list.contains(inst.getNext_device_code()))
|
||||
.filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
|
||||
.filter(inst -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 2 || Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 3 == 0)
|
||||
// .sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4).reversed()
|
||||
.sorted(Comparator.comparingInt((Instruction inst) -> {
|
||||
int startCode = Integer.parseInt(getNumericPart(inst.getStart_device_code()));
|
||||
if (startCode == 2 || startCode == 3) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
})
|
||||
.thenComparing(inst -> inst.getNext_device_code())
|
||||
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_z()) ? "0" : inst.getFrom_z()))
|
||||
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_y()) ? "0" : inst.getFrom_y()))
|
||||
.thenComparing(Comparator.comparing(Instruction::getPriority))
|
||||
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private String getNumericPart(String device_c0de) {
|
||||
Pattern pattern = Pattern.compile("\\d+");
|
||||
@@ -2017,49 +1964,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
return "0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Instruction> findReadyInstByDeviceCode(List<String> device_code_list, String noY) {
|
||||
//String currentNoY = noY == null ? "" : noY;
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
|
||||
.filter(inst -> (device_code_list.contains(inst.getStart_device_code()) && ObjectUtil.isNotEmpty(inst.getTo_y()) && !currentNoY.contains(inst.getTo_y())) || (device_code_list.contains(inst.getNext_device_code()) && ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(inst.getFrom_y())))
|
||||
.sorted(Comparator.comparing(Instruction::getPriority)
|
||||
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findReadyInstByStartDeviceCode(Instruction frontInst, String link_device_code, String noY) {
|
||||
//String currentNoY = noY == null ? "" : noY;
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
|
||||
.filter(inst -> inst.getStart_device_code().equals(link_device_code))
|
||||
.filter(inst -> ObjectUtil.isNotEmpty(inst.getTo_y()) && !currentNoY.contains(inst.getTo_y()))
|
||||
.filter(inst -> Integer.parseInt(StringUtil.handleString(inst.getTo_x())) == Integer.parseInt(StringUtil.handleString(frontInst.getTo_x())))
|
||||
// .filter(inst -> ((Integer.parseInt(frontInst.getTo_y()) - 1) / 4 == (Integer.parseInt(inst.getTo_y()) - 1) / 4) && (((Integer.parseInt(frontInst.getTo_y()) % 4) + (Integer.parseInt(inst.getTo_y()) % 4) == 2) || (Integer.parseInt(frontInst.getTo_y()) % 4) + (Integer.parseInt(inst.getTo_y()) % 4) == 4))
|
||||
.filter(inst -> {
|
||||
int frontToY = Integer.parseInt(frontInst.getTo_y());
|
||||
int instToY = Integer.parseInt(inst.getTo_y());
|
||||
int frontGroup = (frontToY - 1) / 4;
|
||||
int instGroup = (instToY - 1) / 4;
|
||||
if (frontGroup != instGroup) {
|
||||
return false;
|
||||
}
|
||||
int frontMod = frontToY % 4;
|
||||
int instMod = instToY % 4;
|
||||
return (frontMod + instMod == 2 || frontMod + instMod == 4);
|
||||
})
|
||||
.filter(inst -> Integer.parseInt(inst.getTo_z()) == Integer.parseInt(frontInst.getTo_z()))
|
||||
.sorted(Comparator.comparing(Instruction::getPriority)
|
||||
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findReadyInstByLinkDeviceCodeAndStartDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList) {
|
||||
@@ -2112,64 +2016,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList) {
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
|
||||
.filter(inst -> inst.getNext_device_code().equals(linkDeviceCode))
|
||||
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()))
|
||||
.filter(inst -> StrUtil.isNotBlank(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
|
||||
.sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4).reversed()
|
||||
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_z()) ? "0" : inst.getFrom_z()))
|
||||
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_y()) ? "0" : inst.getFrom_y()))
|
||||
.thenComparing(Comparator.comparing(Instruction::getPriority))
|
||||
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findDeepReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList) {
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
|
||||
.filter(inst -> inst.getNext_device_code().equals(linkDeviceCode))
|
||||
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()))
|
||||
.filter(inst -> StrUtil.isNotBlank(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
|
||||
.filter(inst -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 1 || Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 0)
|
||||
.sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4).reversed()
|
||||
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_z()) ? "0" : inst.getFrom_z()))
|
||||
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_y()) ? "0" : inst.getFrom_y()))
|
||||
.thenComparing(Comparator.comparing(Instruction::getPriority))
|
||||
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findShallowReadyInstByLinkDeviceCodeAndNextDeviceCode(String linkDeviceCode, String noY, List<String> getDeviceCodeList) {
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
|
||||
.filter(inst -> inst.getNext_device_code().equals(linkDeviceCode))
|
||||
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()))
|
||||
.filter(inst -> StrUtil.isNotBlank(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
|
||||
.filter(inst -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 2 || Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 3)
|
||||
.sorted(Comparator.comparingInt((Instruction inst) -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4).reversed()
|
||||
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_z()) ? "0" : inst.getFrom_z()))
|
||||
.thenComparing(inst -> Integer.parseInt(ObjectUtil.isEmpty(inst.getFrom_y()) ? "0" : inst.getFrom_y()))
|
||||
.thenComparing(Comparator.comparing(Instruction::getPriority))
|
||||
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY) {
|
||||
@@ -2202,36 +2050,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findDeepReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY, List<String> getDeviceCodeList) {
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
|
||||
.filter(inst -> inst.getNext_device_code().equals(link_device_code))
|
||||
.filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(inst.getFrom_y()))
|
||||
.filter(inst -> Integer.parseInt(StringUtil.handleString(inst.getFrom_x())) == Integer.parseInt(StringUtil.handleString(frontInst.getFrom_x())))
|
||||
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()))
|
||||
.filter(inst -> {
|
||||
int frontY = Integer.parseInt(frontInst.getFrom_y());
|
||||
int instY = Integer.parseInt(inst.getFrom_y());
|
||||
int frontGroup = (frontY - 1) / 4;
|
||||
int instGroup = (instY - 1) / 4;
|
||||
if (frontGroup != instGroup) {
|
||||
return false;
|
||||
}
|
||||
int frontMod = frontY % 4;
|
||||
int instMod = instY % 4;
|
||||
return (frontMod + instMod == 2 || frontMod + instMod == 4);
|
||||
})
|
||||
.filter(inst -> Integer.parseInt(inst.getFrom_y()) < Integer.parseInt(frontInst.getFrom_y()))
|
||||
.filter(inst -> Integer.parseInt(inst.getFrom_z()) == Integer.parseInt(frontInst.getFrom_z()))
|
||||
.filter(inst -> Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 0 || Integer.parseInt(getNumericPart(inst.getStart_device_code())) % 4 == 1)
|
||||
.sorted(Comparator.comparing(Instruction::getPriority).reversed()
|
||||
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findShallowReadyInstByNextDeviceCode(Instruction frontInst, String link_device_code, String noY, List<String> getDeviceCodeList) {
|
||||
@@ -2284,6 +2102,16 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findReadyInstByStartPointCode(String start_point_code) {
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
|
||||
.filter(inst -> inst.getStart_point_code().equals(start_point_code))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int findReadyInstNumByEnd(String next_device_code) {
|
||||
return Optional.ofNullable(this.instructions)
|
||||
@@ -2414,13 +2242,68 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Instruction> findInstsByNextDeviceCode(String deviceCode) {
|
||||
public List<Instruction> findAllInstByPriorityCreateTime(List<String> next_device_code_list, String noY) {
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(inst -> inst.getNext_device_code().equals(deviceCode))
|
||||
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
|
||||
.filter(inst -> next_device_code_list.contains(inst.getNext_device_code()))
|
||||
.filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
|
||||
.sorted(Comparator
|
||||
.comparingInt((Instruction inst) ->
|
||||
inst.getPriority() != null && !inst.getPriority().isEmpty() ?
|
||||
Integer.parseInt(inst.getPriority()) :
|
||||
1)
|
||||
.reversed()
|
||||
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
|
||||
.thenComparing(inst -> {
|
||||
String startDeviceCode = inst.getStart_device_code();
|
||||
String numericPart = getNumericPart(startDeviceCode);
|
||||
int location = Integer.parseInt(numericPart);
|
||||
if (location == 2 || location == 3) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
})
|
||||
.thenComparing(inst -> Integer.parseInt(inst.getNext_device_code()))
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Instruction> findAllInstByPriorityCreateTime(String link_device_code, List<String> next_device_code_list, String noY) {
|
||||
Set<String> currentNoY = noY == null ? Collections.emptySet() : new HashSet<>(Arrays.asList(noY.split(",")));
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(inst -> inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex()))
|
||||
.filter(inst -> inst.getNext_device_code().equals(link_device_code))
|
||||
.filter(inst -> next_device_code_list.contains(inst.getNext_device_code()))
|
||||
.filter(inst -> ObjectUtil.isNotEmpty(inst.getFrom_y()) && !currentNoY.contains(String.valueOf(Integer.parseInt(inst.getFrom_y()))))
|
||||
.sorted(Comparator
|
||||
.comparingInt((Instruction inst) ->
|
||||
inst.getPriority() != null && !inst.getPriority().isEmpty() ?
|
||||
Integer.parseInt(inst.getPriority()) :
|
||||
1)
|
||||
.reversed()
|
||||
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
|
||||
.thenComparing(inst -> {
|
||||
String startDeviceCode = inst.getStart_device_code();
|
||||
String numericPart = getNumericPart(startDeviceCode);
|
||||
int location = Integer.parseInt(numericPart);
|
||||
if (location == 2 || location == 3) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
})
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
List<TaskDto> findTasksByNextCode(String device_code);
|
||||
|
||||
TaskDto findByStartPointCode(String device_code);
|
||||
TaskDto findReadyByStartPointCode(String start_point_code);
|
||||
|
||||
|
||||
TaskDto findReadyByVehicleCode(String vehicleCode);
|
||||
@@ -331,16 +331,6 @@ public interface TaskService extends CommonService<Task> {
|
||||
*/
|
||||
String queryAssignedByDevice(String device_code, String task_nextdevice_code);
|
||||
|
||||
|
||||
/**
|
||||
* 查询相同起终任务的数量
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
Integer querySameDeviceReadyTask(String start_device, String next_device, String status);
|
||||
|
||||
|
||||
/**
|
||||
* 条件查询任务和指令
|
||||
*
|
||||
@@ -385,8 +375,6 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
TaskDto findReadyTaskByNextDeviceCode(String next_device_code, List<String> checkoutStartDeviceCode);
|
||||
|
||||
List<TaskDto> findReadyTasksByNextDeviceCode(String next_device_code, List<String> checkoutStartDeviceCode);
|
||||
|
||||
List<TaskDto> findReadyTaskByXDeviceCode(List<String> xDeviceCodeList, String noY);
|
||||
|
||||
/**
|
||||
@@ -409,6 +397,5 @@ public interface TaskService extends CommonService<Task> {
|
||||
|
||||
void cancelNoSendWms(String task_id);
|
||||
|
||||
|
||||
List<TaskDto> findInstsByNextDeviceCode(String deviceCode);
|
||||
}
|
||||
|
||||
@@ -904,13 +904,15 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TaskDto findByStartPointCode(String device_code) {
|
||||
public TaskDto findReadyByStartPointCode(String start_point_code) {
|
||||
return Optional
|
||||
.ofNullable(this.tasks)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(task -> StrUtil.equals(task.getStart_point_code(), device_code))
|
||||
.filter(task -> StrUtil.equals(task.getStart_point_code(), start_point_code))
|
||||
.filter(task -> StrUtil.equals(task.getTask_status(),TaskStatusEnum.READY.getIndex()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
@@ -1251,21 +1253,6 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Integer querySameDeviceReadyTask(String start_device, String next_device, String status) {
|
||||
int num = 0;
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (StrUtil.equals(task.getStart_device_code(), start_device)
|
||||
&& StrUtil.equals(task.getNext_device_code(), next_device)
|
||||
&& StrUtil.equals(task.getTask_status(), status)) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@@ -1361,30 +1348,29 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
.filter(taskDto -> TaskStatusEnum.READY.getIndex().equals(taskDto.getTask_status()))
|
||||
.filter(taskDto -> taskDto.getNext_device_code().equals(next_device_code))
|
||||
.filter(taskDto -> !checkoutStartDeviceCode.contains(taskDto.getStart_device_code()))
|
||||
.sorted(Comparator.comparingInt((TaskDto taskDto) -> Integer.parseInt(getNumericPart(taskDto.getStart_device_code())) % 4).reversed()
|
||||
.thenComparing(taskDto -> Integer.parseInt(ObjectUtil.isEmpty(taskDto.getFrom_y()) ? "0" : taskDto.getFrom_y()))
|
||||
.thenComparing(TaskDto::getPriority)
|
||||
.thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
|
||||
.sorted(
|
||||
Comparator
|
||||
.comparingInt((TaskDto taskDto) ->
|
||||
taskDto.getPriority() != null && !taskDto.getPriority().isEmpty() ?
|
||||
Integer.parseInt(taskDto.getPriority()) :
|
||||
1)
|
||||
.reversed()
|
||||
.thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
|
||||
.thenComparing(taskDto -> {
|
||||
String startDeviceCode = taskDto.getStart_device_code();
|
||||
String numericPart = getNumericPart(startDeviceCode);
|
||||
int location = Integer.parseInt(numericPart);
|
||||
if (location == 2 || location == 3) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
})
|
||||
)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskDto> findReadyTasksByNextDeviceCode(String next_device_code, List<String> checkoutStartDeviceCode) {
|
||||
return Optional.ofNullable(this.tasks)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(taskDto -> TaskStatusEnum.READY.getIndex().equals(taskDto.getTask_status()))
|
||||
.filter(taskDto -> taskDto.getNext_device_code().equals(next_device_code))
|
||||
.filter(taskDto -> !checkoutStartDeviceCode.contains(taskDto.getStart_device_code()))
|
||||
.sorted(Comparator.comparingInt((TaskDto taskDto) -> Integer.parseInt(getNumericPart(taskDto.getStart_device_code())) % 4).reversed()
|
||||
.thenComparing(taskDto -> Integer.parseInt(ObjectUtil.isEmpty(taskDto.getFrom_z()) ? "0" : taskDto.getFrom_z()))
|
||||
.thenComparing(taskDto -> Integer.parseInt(ObjectUtil.isEmpty(taskDto.getFrom_y()) ? "0" : taskDto.getFrom_y()))
|
||||
.thenComparing(TaskDto::getPriority)
|
||||
.thenComparing(taskDto -> LocalDateTime.parse(taskDto.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private String getNumericPart(String device_c0de) {
|
||||
Pattern pattern = Pattern.compile("\\d+");
|
||||
Matcher matcher = pattern.matcher(device_c0de);
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Order(100)
|
||||
@ConditionalOnProperty(value = "spring.profiles.active",havingValue = "dev")
|
||||
@ConditionalOnProperty(value = "spring.profiles.active",havingValue = "prod")
|
||||
public class JobRunner implements ApplicationRunner {
|
||||
private static final Logger log = LoggerFactory.getLogger(JobRunner.class);
|
||||
private final ISysQuartzJobService quartzJobService;
|
||||
|
||||
@@ -91,10 +91,6 @@ public class AutoCreateYkInst {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE) && !StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.TWO)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||
String path = routeLineDto.getPath();
|
||||
String type = routeLineDto.getType();
|
||||
|
||||
@@ -5,6 +5,7 @@ export default {
|
||||
'instruction_type': 'Instruction Type',
|
||||
'task_code': 'Task Code',
|
||||
'vehicle_code': 'Vehicle Code',
|
||||
'priority': 'priority',
|
||||
'instruction_status': 'Instruction Status',
|
||||
'send_status': 'Send Status',
|
||||
'start_point_code': 'Start Device Code',
|
||||
|
||||
@@ -5,6 +5,7 @@ export default {
|
||||
'instruction_type': 'Jenis Instruksi',
|
||||
'task_code': 'Nomor Tugas',
|
||||
'vehicle_code': 'Nomor Kendaraan',
|
||||
'priority': 'Prioritas',
|
||||
'instruction_status': 'Status Perintah',
|
||||
'send_status': 'Status Pengiriman',
|
||||
'start_point_code': 'Titik Penjemputan',
|
||||
|
||||
@@ -5,10 +5,11 @@ export default {
|
||||
'instruction_type': '指令类型',
|
||||
'task_code': '任务号',
|
||||
'vehicle_code': '载具号',
|
||||
'priority': '优先级',
|
||||
'instruction_status': '指令状态',
|
||||
'send_status': '下发状态',
|
||||
'start_point_code': '取货点',
|
||||
'next_point_code': '放货点',
|
||||
'start_point_code': '指令起点',
|
||||
'next_point_code': '指令终点',
|
||||
'start_point_code2': '取货点2',
|
||||
'next_point_code2': '放货点2',
|
||||
'put_point_code': '倒料点',
|
||||
|
||||
@@ -35,8 +35,8 @@ export default {
|
||||
'Ready': '就绪',
|
||||
'In_progress': '执行中',
|
||||
'Completed': '完成',
|
||||
'Pickup_point': '取货点',
|
||||
'Delivery_point': '放货点',
|
||||
'Pickup_point': '任务起点',
|
||||
'Delivery_point': '任务终点',
|
||||
'Remark': '备注',
|
||||
'Creator': '创建者',
|
||||
'Create_time': '创建时间',
|
||||
|
||||
@@ -32,27 +32,27 @@
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('Inst.table.material')">
|
||||
<el-select
|
||||
v-model="query.material_type"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
:placeholder="$t('Inst.table.material')"
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option v-for="item in materialList" :key="item.id" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('Inst.table.task_status')">
|
||||
<!-- <el-form-item :label="$t('Inst.table.material')">-->
|
||||
<!-- <el-select-->
|
||||
<!-- v-model="query.material_type"-->
|
||||
<!-- clearable-->
|
||||
<!-- filterable-->
|
||||
<!-- size="small"-->
|
||||
<!-- :placeholder="$t('Inst.table.material')"-->
|
||||
<!-- class="filter-item"-->
|
||||
<!-- style="width: 200px"-->
|
||||
<!-- @change="crud.toQuery"-->
|
||||
<!-- >-->
|
||||
<!-- <el-option v-for="item in materialList" :key="item.id" :label="item.label" :value="item.value" />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item :label="$t('Inst.table.instruction_status')">
|
||||
<el-select
|
||||
v-model="query.status"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
:placeholder="$t('Inst.table.task_status')"
|
||||
:placeholder="$t('Inst.table.instruction_status')"
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
@change="crud.toQuery"
|
||||
@@ -141,16 +141,16 @@
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column v-if="false" prop="instruction_id" label="指令标识" />
|
||||
<el-table-column prop="instruction_code" :label="$t('Inst.table.instruction_code')" :min-width="flexWidth('instruction_code',crud.data,$t('Inst.table.instruction_code'))" />
|
||||
<el-table-column prop="instruction_type" :label="$t('Inst.table.instruction_type')" :min-width="flexWidth('instruction_type',crud.data,$t('Inst.table.instruction_type'))">
|
||||
<el-table-column prop="instruction_type" :label="$t('Inst.table.instruction_type')" show-overflow-tooltip :min-width="flexWidth('instruction_type',crud.data,$t('Inst.table.instruction_type'))">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.instruction_type[scope.row.instruction_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="put_point_code" :label="$t('Inst.table.put_point_code')" :min-width="flexWidth('put_point_code',crud.data,$t('Inst.table.put_point_code'))" />
|
||||
<el-table-column prop="priority" :label="$t('Inst.table.priority')" :min-width="flexWidth('priority',crud.data,$t('Inst.table.priority'))" />
|
||||
<el-table-column prop="execute_device_code" :label="$t('Inst.table.execute_device_code')" :min-width="flexWidth('execute_device_code',crud.data,$t('Inst.table.execute_device_code'))" />
|
||||
<!-- <el-table-column prop="link_num" label="关联编号" />-->
|
||||
<el-table-column prop="task_code" :label="$t('Inst.table.task_code')" :min-width="flexWidth('task_code',crud.data,$t('Inst.table.task_code'))" />
|
||||
<el-table-column prop="vehicle_code" :label="$t('Inst.table.vehicle_code')" :min-width="flexWidth('vehicle_code',crud.data,$t('Inst.table.vehicle_code'))" />
|
||||
<el-table-column prop="vehicle_code" show-overflow-tooltip :label="$t('Inst.table.vehicle_code')" :min-width="flexWidth('vehicle_code',crud.data,$t('Inst.table.vehicle_code'))" />
|
||||
<el-table-column prop="instruction_status" :label="$t('Inst.table.instruction_status')" :min-width="flexWidth('instruction_status',crud.data,$t('Inst.table.instruction_status'))">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.instruction_status=='0' ">{{ $t('Inst.table.ready') }}</span>
|
||||
@@ -167,9 +167,9 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="start_point_code" :label="$t('Inst.table.start_point_code')" :min-width="flexWidth('start_point_code',crud.data,$t('Inst.table.start_point_code'))" />
|
||||
<el-table-column prop="next_point_code" :label="$t('Inst.table.next_point_code')" :min-width="flexWidth('next_point_code',crud.data,$t('Inst.table.next_point_code'))" />
|
||||
<el-table-column prop="start_point_code2" :label="$t('Inst.table.start_point_code2')" :min-width="flexWidth('start_point_code2',crud.data,$t('Inst.table.start_point_code2'))" />
|
||||
<el-table-column prop="next_point_code2" :label="$t('Inst.table.next_point_code2')" :min-width="flexWidth('next_point_code2',crud.data,$t('Inst.table.next_point_code2'))" />
|
||||
<el-table-column prop="put_point_code" :label="$t('Inst.table.put_point_code')" :min-width="flexWidth('put_point_code',crud.data,$t('Inst.table.put_point_code'))" />
|
||||
<!-- <el-table-column prop="start_point_code2" :label="$t('Inst.table.start_point_code2')" :min-width="flexWidth('start_point_code2',crud.data,$t('Inst.table.start_point_code2'))" />-->
|
||||
<!-- <el-table-column prop="next_point_code2" :label="$t('Inst.table.next_point_code2')" :min-width="flexWidth('next_point_code2',crud.data,$t('Inst.table.next_point_code2'))" />-->
|
||||
<!-- <el-table-column prop="put_point_code" :label="$t('Inst.table.put_point_code')" :min-width="flexWidth('put_point_code',crud.data,$t('Inst.table.put_point_code'))" />-->
|
||||
<el-table-column prop="execute_device_code" :label="$t('Inst.table.execute_device_code')" :min-width="flexWidth('execute_device_code',crud.data,$t('Inst.table.execute_device_code'))" />
|
||||
<el-table-column prop="carno" :label="$t('Inst.table.carno')" :min-width="flexWidth('carno',crud.data,$t('Inst.table.carno'))" />
|
||||
<el-table-column prop="remark" :label="$t('Inst.table.remark')" :min-width="flexWidth('remark',crud.data,$t('Inst.table.remark'))" />
|
||||
@@ -273,7 +273,7 @@ export default {
|
||||
crudMethod: { ...crudInstruction },
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: true,
|
||||
edit: false,
|
||||
del: true
|
||||
}
|
||||
})
|
||||
|
||||
@@ -46,20 +46,20 @@
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('task.txt_box.Material_type')">
|
||||
<el-select
|
||||
v-model="query.material_type"
|
||||
clearable
|
||||
filterable
|
||||
size="small"
|
||||
:placeholder="$t('task.txt_box.Material_type')"
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option v-for="item in materialList" :key="item.id" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item :label="$t('task.txt_box.Material_type')">-->
|
||||
<!-- <el-select-->
|
||||
<!-- v-model="query.material_type"-->
|
||||
<!-- clearable-->
|
||||
<!-- filterable-->
|
||||
<!-- size="small"-->
|
||||
<!-- :placeholder="$t('task.txt_box.Material_type')"-->
|
||||
<!-- class="filter-item"-->
|
||||
<!-- style="width: 200px"-->
|
||||
<!-- @change="crud.toQuery"-->
|
||||
<!-- >-->
|
||||
<!-- <el-option v-for="item in materialList" :key="item.id" :label="item.label" :value="item.value" />-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form-item :label="$t('task.txt_box.Task_type')">
|
||||
<el-select
|
||||
v-model="query.task_type"
|
||||
@@ -496,13 +496,14 @@
|
||||
<el-table-column type="selection" width="50" />
|
||||
<el-table-column v-if="false" prop="task_id" label="任务标识" />
|
||||
<el-table-column prop="task_code" :label="$t('task.txt_box.Task_code')" :min-width="flexWidth('task_code',crud.data,$t('task.txt_box.Task_code'))" />
|
||||
<el-table-column prop="task_type" :label="$t('task.txt_box.Task_type')" :min-width="flexWidth('task_type',crud.data,$t('task.txt_box.Task_type'))">
|
||||
<el-table-column prop="task_type" show-overflow-tooltip :label="$t('task.txt_box.Task_type')" :min-width="flexWidth('task_type',crud.data,$t('task.txt_box.Task_type'))">
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.task_type[scope.row.task_type] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="priority" :label="$t('task.txt_box.Priority')" :min-width="flexWidth('priority',crud.data,$t('task.txt_box.Priority'))" />
|
||||
<!-- <el-table-column prop="link_num" label="关联编号" />-->
|
||||
<el-table-column prop="vehicle_code" :label="$t('task.txt_box.Vehicle_number')" :min-width="flexWidth('vehicle_code',crud.data,$t('task.txt_box.Vehicle_number'))" />
|
||||
<el-table-column prop="vehicle_code" show-overflow-tooltip :label="$t('task.txt_box.Vehicle_number')" :min-width="flexWidth('vehicle_code',crud.data,$t('task.txt_box.Vehicle_number'))" />
|
||||
<el-table-column prop="task_status" :label="$t('task.txt_box.Task_status')" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.task_status==='0' ">{{ $t('task.select.Ready') }}</span>
|
||||
@@ -510,12 +511,11 @@
|
||||
<span v-if="scope.row.task_status==='2' ">{{ $t('task.select.Completed') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="priority" :label="$t('task.txt_box.Priority')" :min-width="flexWidth('priority',crud.data,$t('task.txt_box.Priority'))" />
|
||||
<el-table-column prop="start_point_code" :label="$t('task.select.Pickup_point')" :min-width="flexWidth('start_point_code',crud.data,$t('task.select.Pickup_point'))" />
|
||||
<!-- <el-table-column prop="put_point_code" label="倒料点" width="100" />-->
|
||||
<el-table-column prop="next_point_code" :label="$t('task.select.Delivery_point')" :min-width="flexWidth('next_point_code',crud.data,$t('task.select.Delivery_point'))" />
|
||||
<el-table-column prop="start_point_code2" :label="$t('task.select.Start_point2')" :min-width="flexWidth('start_point_code2',crud.data,$t('task.select.Start_point2'))" />
|
||||
<el-table-column prop="next_point_code2" :label="$t('task.select.Destination2')" :min-width="flexWidth('next_point_code2',crud.data,$t('task.select.Destination2'))" />
|
||||
<!-- <el-table-column prop="start_point_code2" :label="$t('task.select.Start_point2')" :min-width="flexWidth('start_point_code2',crud.data,$t('task.select.Start_point2'))" />-->
|
||||
<!-- <el-table-column prop="next_point_code2" :label="$t('task.select.Destination2')" :min-width="flexWidth('next_point_code2',crud.data,$t('task.select.Destination2'))" />-->
|
||||
<!-- <el-table-column prop="compound_task" label="复合任务">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <span v-if="scope.row.compound_task==='0' ">否</span>-->
|
||||
|
||||
Reference in New Issue
Block a user