创建指令任务报错、状态基引入
This commit is contained in:
@@ -10,6 +10,7 @@ import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.impl.InstructionServiceImpl;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
@@ -153,7 +154,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
//开始任务/上报订单号
|
||||
if (phase == 0x01) {
|
||||
if (!ObjectUtil.isEmpty(inst)) {
|
||||
inst.setInstruction_status("1");
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst.setAgv_jobno(String.valueOf(index));
|
||||
inst.setSend_status("1");
|
||||
instructionService.update(inst);
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.acs.custompolicy;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.opc.ObjectUtl;
|
||||
@@ -60,7 +61,7 @@ public class WaitingInstructionDeque {
|
||||
while(var3.hasNext()) {
|
||||
Instruction instruction = (Instruction)var3.next();
|
||||
Instruction findByCode = instructionService.findByCode(instruction.getInstruction_code());
|
||||
if (findByCode != null && StrUtil.equals(findByCode.getInstruction_status(),"0") && !dequeTemp.contains(findByCode)) {
|
||||
if (findByCode != null && StrUtil.equals(findByCode.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && !dequeTemp.contains(findByCode)) {
|
||||
dequeTemp.offer(findByCode);
|
||||
}
|
||||
}
|
||||
@@ -75,7 +76,7 @@ public class WaitingInstructionDeque {
|
||||
while(var2.hasNext()) {
|
||||
Instruction instruction = (Instruction)var2.next();
|
||||
Instruction findByCode = instructionService.findByCode(instruction.getInstruction_code());
|
||||
if (findByCode != null && StrUtil.equals(findByCode.getInstruction_status(),"0")) {
|
||||
if (findByCode != null && StrUtil.equals(findByCode.getInstruction_status(),InstructionStatusEnum.READY.getIndex())) {
|
||||
this.offerIfNotExists(findByCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ public class CustomPolicy implements Serializable {
|
||||
@ApiModelProperty(value = "设备号")
|
||||
private String key_code;
|
||||
|
||||
@ApiModelProperty(value = "策略名称")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "策略编号")
|
||||
private String unit_code;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "创建用户名")
|
||||
|
||||
@@ -34,9 +34,9 @@ public class CustomPolicyDTO implements Serializable {
|
||||
@NotBlank
|
||||
private String key_code;
|
||||
|
||||
@ApiModelProperty(value = "策略名称")
|
||||
@NotBlank
|
||||
private String name;
|
||||
@ApiModelProperty(value = "策略编号")
|
||||
private String unit_code;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "创建用户名")
|
||||
|
||||
@@ -10,6 +10,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.utils.ReadUtil;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
@@ -270,26 +271,26 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device
|
||||
|
||||
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
|
||||
//指令状态就绪
|
||||
if (StrUtil.equals("0", inst.getInstruction_status())) {
|
||||
if (StrUtil.equals(InstructionStatusEnum.READY.getIndex(), inst.getInstruction_status())) {
|
||||
log.info("下发指令号{},起点{}", inst.getInstruction_code(), start_device);
|
||||
//判断指令起点与任务起点是否相同
|
||||
feedAgvTaskStatus(inst, "1");
|
||||
}
|
||||
|
||||
//取货完成请求离开
|
||||
if (StrUtil.equals("1", inst.getInstruction_status()) && address == 5 && stop == 1 && StrUtil.equals(inst.getExecute_status(),"1")) {
|
||||
if (StrUtil.equals(InstructionStatusEnum.BUSY.getIndex(), inst.getInstruction_status()) && address == 5 && stop == 1 && StrUtil.equals(inst.getExecute_status(),"1")) {
|
||||
//请求wms是否允许从取货点离开
|
||||
feedAgvTaskStatus(inst, "2");
|
||||
}
|
||||
|
||||
//请求放货
|
||||
if (StrUtil.equals("1", inst.getInstruction_status()) && address == 2 && stop == 1 && StrUtil.equals(inst.getExecute_status(),"2")) {
|
||||
if (StrUtil.equals(InstructionStatusEnum.BUSY.getIndex(), inst.getInstruction_status()) && address == 2 && stop == 1 && StrUtil.equals(inst.getExecute_status(),"2")) {
|
||||
//请求wms是否允许进入放货
|
||||
feedAgvTaskStatus(inst, "3");
|
||||
|
||||
}
|
||||
//放货完成 完成任务回休息点
|
||||
if (StrUtil.equals("1", inst.getInstruction_status()) && address == 1 && stop == 1 && StrUtil.equals(inst.getExecute_status(),"3")) {
|
||||
if (StrUtil.equals(InstructionStatusEnum.BUSY.getIndex(), inst.getInstruction_status()) && address == 1 && stop == 1 && StrUtil.equals(inst.getExecute_status(),"3")) {
|
||||
feedAgvTaskStatus(inst, "4");
|
||||
}
|
||||
|
||||
@@ -398,7 +399,7 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device
|
||||
|
||||
if (resp.getStatus() ==200) {
|
||||
|
||||
inst.setInstruction_status("1");
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst.setExecute_status("1");
|
||||
instructionService.update(inst);
|
||||
writing("to_line", 1);
|
||||
@@ -438,7 +439,7 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device
|
||||
luceneExecuteLogService.deviceExecuteLog(resplogDto);
|
||||
if (resp.getStatus() ==200) {
|
||||
|
||||
inst.setInstruction_status("1");
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst.setExecute_status("2");
|
||||
instructionService.update(inst);
|
||||
} else {
|
||||
@@ -474,7 +475,7 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(resplogDto);
|
||||
if (resp.getStatus() ==200) {
|
||||
inst.setInstruction_status("1");
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst.setExecute_status("3");
|
||||
instructionService.update(inst);
|
||||
} else {
|
||||
@@ -510,7 +511,7 @@ public class XgagvDeviceDriver extends AbstractOpcDeviceDriver implements Device
|
||||
luceneExecuteLogService.deviceExecuteLog(resplogDto);
|
||||
if (resp.getStatus() ==200) {
|
||||
writing("to_line", 2);
|
||||
inst.setInstruction_status("2");
|
||||
inst.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
||||
inst.setExecute_status("4");
|
||||
instructionService.finish(inst);
|
||||
} else {
|
||||
|
||||
@@ -17,12 +17,14 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
@@ -157,8 +159,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
//inst_message
|
||||
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst1 != null) {
|
||||
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
||||
inst1.setInstruction_status("1");
|
||||
if (StrUtil.equals(inst1.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||
inst1.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst1.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst1);
|
||||
// TaskDto tas未反馈电气信号原因kDto = taskserver.findByCodeFromCache(inst1.getTask_code());
|
||||
@@ -342,7 +344,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (mode == 3 && action == 4 && move == 0 && task > 0) {
|
||||
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst2 != null) {
|
||||
if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
|
||||
if (StrUtil.equals(inst2.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
|
||||
try {
|
||||
finish_instruction(inst2);
|
||||
} catch (Exception e) {
|
||||
@@ -508,7 +510,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
if (isCloseDoor) {
|
||||
return false;
|
||||
}
|
||||
instruction.setInstruction_status("1");
|
||||
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
instruction.setUpdate_time(DateUtil.now());
|
||||
instructionService.update(instruction);
|
||||
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
|
||||
@@ -567,7 +569,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
|
||||
//判断关联的同一列烘箱设备是否都关门 都关门返回false,有一个不关门就返回true
|
||||
@@ -585,7 +587,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
return false;
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
task.setTask_status("1");
|
||||
task.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
task.setUpdate_time(DateUtil.now());
|
||||
taskserver.update(task);
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingRequest;
|
||||
import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
@@ -33,6 +34,7 @@ import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.storage_cell.domain.StorageCell;
|
||||
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
@@ -198,13 +200,13 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
||||
vehicle_code = inst.getVehicle_code();
|
||||
task_code = inst.getTask_code();
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status("1");
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task);
|
||||
}
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1")) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
|
||||
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
vehicle_code = inst.getVehicle_code();
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
@@ -651,7 +653,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
@@ -661,7 +663,7 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
return false;
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
taskdto.setTask_status("1");
|
||||
taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskserver.update(taskdto);
|
||||
requireSucess = true;
|
||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingRequest;
|
||||
import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
@@ -33,6 +34,7 @@ import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.storage_cell.domain.StorageCell;
|
||||
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
@@ -188,13 +190,13 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
inst_message = "当前指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
||||
vehicle_code = inst.getVehicle_code();
|
||||
task_code = inst.getTask_code();
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status("1");
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task);
|
||||
}
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1")) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
|
||||
if (!StrUtil.equals(inst.getExecute_code(), this.device_code)) {
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
@@ -221,7 +223,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
message = "未联机";
|
||||
|
||||
|
||||
} else {
|
||||
this.setIsonline(true);
|
||||
this.setIserror(false);
|
||||
@@ -483,7 +485,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
message ="任务号:"+task +"未找到对应立库指令,请检查";
|
||||
return false;
|
||||
}
|
||||
if(StrUtil.equals(instruction.getInstruction_status(),"1")){
|
||||
if(StrUtil.equals(instruction.getInstruction_status(),InstructionStatusEnum.BUSY.getIndex())){
|
||||
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
vehicle_code = inst.getVehicle_code();
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
@@ -613,7 +615,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
@@ -623,7 +625,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
return false;
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
taskdto.setTask_status("1");
|
||||
taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskserver.update(taskdto);
|
||||
requireSucess = true;
|
||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingRequest;
|
||||
import org.nl.acs.ext.wms.data.one.ApplyLabelingAndBindingResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
@@ -31,6 +32,7 @@ import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.storage_cell.domain.StorageCell;
|
||||
import org.nl.acs.storage_cell.service.mapper.StorageCellMapper;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
@@ -195,14 +197,14 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
+ inst.getNext_point_code()
|
||||
+ " 载具号:"
|
||||
+ inst.getVehicle_code();
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1")
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())
|
||||
&& StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
vehicle_code = inst.getVehicle_code();
|
||||
finish_instruction();
|
||||
logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈完成状态,反馈成功,指令号:" + task);
|
||||
} else if (StrUtil.equals(inst.getInstruction_status(), "0")
|
||||
} else if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex())
|
||||
&& StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status("1");
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
instructionService.update(inst);
|
||||
logServer.deviceExecuteLog(device_code, "", "", "入库输送线任务开始反馈执行中状态,反馈成功,指令号:" + task);
|
||||
} else {
|
||||
@@ -621,7 +623,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
@@ -631,7 +633,7 @@ public class SiemensConveyorLabelingDeviceDriver extends AbstractOpcDeviceDriver
|
||||
return false;
|
||||
}
|
||||
// 创建指令后修改任务状态
|
||||
taskdto.setTask_status("1");
|
||||
taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskserver.update(taskdto);
|
||||
requireSucess = true;
|
||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||
|
||||
@@ -18,12 +18,14 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
@@ -208,9 +210,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
if (task1 > 0 && type == 1) {
|
||||
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
|
||||
if (inst1 != null) {
|
||||
if (StrUtil.equals(inst1.getInstruction_status(), "0")) {
|
||||
if (StrUtil.equals(inst1.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||
//当前执行步骤为更新任务状态
|
||||
inst1.setInstruction_status("1");
|
||||
inst1.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst1.setExecute_device_code(this.getDevice_code());
|
||||
instructionService.update(inst1);
|
||||
// TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
|
||||
@@ -235,10 +237,10 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
//inst_message
|
||||
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
|
||||
if (inst2 != null) {
|
||||
if (StrUtil.equals(inst2.getInstruction_status(), "0")) {
|
||||
if (StrUtil.equals(inst2.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||
//当前指令更新状态
|
||||
now_steps_type2 = 1;
|
||||
inst2.setInstruction_status("1");
|
||||
inst2.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst2.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst2);
|
||||
// TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
|
||||
@@ -263,9 +265,9 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
//inst_message
|
||||
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task1));
|
||||
if (inst2 != null) {
|
||||
if (StrUtil.equals(inst2.getInstruction_status(), "0")) {
|
||||
if (StrUtil.equals(inst2.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||
//当前指令更新状态
|
||||
inst2.setInstruction_status("1");
|
||||
inst2.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst2.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst2);
|
||||
// TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
|
||||
@@ -448,7 +450,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
//inst_message
|
||||
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
|
||||
if (inst2 != null) {
|
||||
if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
|
||||
if (StrUtil.equals(inst2.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
|
||||
finish_instruction(inst2);
|
||||
TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code());
|
||||
if (!ObjectUtil.isEmpty(taskDto)) {
|
||||
@@ -578,7 +580,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
//inst_message
|
||||
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
|
||||
if (inst1 != null) {
|
||||
if (StrUtil.equals(inst1.getInstruction_status(), "1")) {
|
||||
if (StrUtil.equals(inst1.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
|
||||
this.finish_instruction(inst1);
|
||||
TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
|
||||
if (!ObjectUtil.isEmpty(taskDto)) {
|
||||
@@ -624,7 +626,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
//inst_message
|
||||
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
|
||||
if (inst1 != null) {
|
||||
if (StrUtil.equals(inst1.getInstruction_status(), "1")) {
|
||||
if (StrUtil.equals(inst1.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())) {
|
||||
this.finish_instruction(inst1);
|
||||
TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code());
|
||||
if (!ObjectUtil.isEmpty(taskDto)) {
|
||||
@@ -964,7 +966,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
|
||||
//修改指令状态
|
||||
instructionDto.setInstruction_status("1");
|
||||
instructionDto.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
instructionDto.setUpdate_time(DateUtil.now());
|
||||
try {
|
||||
instructionService.update(instructionDto);
|
||||
@@ -1068,7 +1070,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setStart_device_code2(start_device_code2);
|
||||
instdto.setStart_point_code2(start_point_code2);
|
||||
@@ -1087,7 +1089,7 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
|
||||
//创建指令后修改任务状态
|
||||
taskDto.setTask_status("1");
|
||||
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskDto.setUpdate_time(DateUtil.now());
|
||||
taskserver.update(taskDto);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
@@ -24,6 +25,7 @@ import org.nl.acs.opc.WcsConfig;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||
@@ -178,11 +180,11 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst != null) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
finish_instruction();
|
||||
}
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status("1");
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
instructionService.update(inst);
|
||||
}
|
||||
}
|
||||
@@ -413,7 +415,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver
|
||||
|
||||
String taskcode = CodeUtil.getNewCode("TASK_NO");
|
||||
dto.setTask_code("-" + taskcode);
|
||||
dto.setTask_status("0");
|
||||
dto.setTask_status(TaskStatusEnum.READY.getIndex());
|
||||
dto.setPriority("101");
|
||||
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
|
||||
String next_device_codecode = jo.getNext_device_code();
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
@@ -26,6 +27,7 @@ import org.nl.acs.opc.WcsConfig;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||
@@ -181,11 +183,11 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst != null) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status("1");
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
instructionService.update(inst);
|
||||
}
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
finish_instruction();
|
||||
}
|
||||
}
|
||||
@@ -632,7 +634,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
|
||||
this.instruction_apply_time = date;
|
||||
//container_code
|
||||
TaskDto task = taskserver.findByContainer(container_code);
|
||||
if (!ObjectUtil.isEmpty(task) && StrUtil.equals(task.getTask_status(), "0")) {
|
||||
if (!ObjectUtil.isEmpty(task) && StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())) {
|
||||
String taskid = task.getTask_id();
|
||||
String taskcode = task.getTask_code();
|
||||
String vehiclecode = task.getVehicle_code();
|
||||
@@ -699,7 +701,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
@@ -710,7 +712,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
// WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||
task.setTask_status("1");
|
||||
task.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
task.setRemark(null);
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(task);
|
||||
// taskwo.update(json);
|
||||
@@ -742,7 +744,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
|
||||
this.instruction_require_time = date;
|
||||
//container_code
|
||||
TaskDto task = taskserver.findByContainer(container_code);
|
||||
if (!ObjectUtil.isEmpty(task) && StrUtil.equals(task.getTask_status(), "0")) {
|
||||
if (!ObjectUtil.isEmpty(task) && StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())) {
|
||||
String taskid = task.getTask_id();
|
||||
String taskcode = task.getTask_code();
|
||||
String vehiclecode = task.getVehicle_code();
|
||||
@@ -809,7 +811,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
@@ -820,7 +822,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
// WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||
task.setTask_status("1");
|
||||
task.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
task.setRemark(null);
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(task);
|
||||
// taskwo.update(json);
|
||||
|
||||
@@ -20,6 +20,7 @@ import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
@@ -27,6 +28,7 @@ import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.WcsConfig;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
@@ -227,12 +229,12 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
inst = instructionService.findByCodeFromCache(String.valueOf(task));
|
||||
if (inst != null) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code() + " 载具号:" + inst.getVehicle_code();
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "1") && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
finish_instruction();
|
||||
}
|
||||
if (StrUtil.equals(inst.getInstruction_status(), "0") && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status("1");
|
||||
if (StrUtil.equals(inst.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && StrUtil.equals(this.getDeviceCode(), inst.getStart_device_code())) {
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
}
|
||||
@@ -650,7 +652,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
@@ -660,7 +662,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe
|
||||
return false;
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
taskdto.setTask_status("1");
|
||||
taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskserver.update(taskdto);
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.nl.acs.opc.WcsConfig;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.domain.Task;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.acs.task.service.mapper.TaskMapper;
|
||||
@@ -364,7 +365,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
|
||||
|
||||
String taskcode = CodeUtil.getNewCode("TASK_NO");
|
||||
dto.setTask_code("-" + taskcode);
|
||||
dto.setTask_status("0");
|
||||
dto.setTask_status(TaskStatusEnum.READY.getIndex());
|
||||
dto.setPriority("101");
|
||||
RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code());
|
||||
String next_device_codecode = jo.getNext_device_code();
|
||||
|
||||
@@ -16,9 +16,11 @@ import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.LiKuToAcsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
@@ -84,14 +86,14 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
}
|
||||
// 1 已接收 2 开始执行 3执行完成 4 5 取消
|
||||
if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){
|
||||
task.setTask_status("1");
|
||||
task.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskService.update(task);
|
||||
inst.setInstruction_status("1");
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst.setExecute_device_code(carNo);
|
||||
inst.setCarno(carNo);
|
||||
instructionService.update(inst);
|
||||
} else if(StrUtil.equals(status,"3")){
|
||||
inst.setInstruction_status("2");
|
||||
inst.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
||||
instructionService.finish(inst.getInstruction_id());
|
||||
} else if(StrUtil.equals(status,"4")) {
|
||||
|
||||
@@ -146,9 +148,9 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
}
|
||||
// 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞
|
||||
if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){
|
||||
task.setTask_status("1");
|
||||
task.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskService.update(task);
|
||||
inst.setInstruction_status("1");
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst.setExecute_device_code(carNo);
|
||||
inst.setCarno(carNo);
|
||||
instructionService.update(inst);
|
||||
@@ -157,7 +159,7 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
// instructionService.finish(inst.getInstruction_id());
|
||||
|
||||
if(StrUtil.equals(task.getTask_type(),"7") && StrUtil.equals(task.getStorage_task_type(),"4")){
|
||||
inst.setInstruction_status("2");
|
||||
inst.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
||||
instructionService.finish(inst.getInstruction_id());
|
||||
} else {
|
||||
inst.setRemark("立库已反馈完成,待输送上报任务号");
|
||||
@@ -223,15 +225,15 @@ public class LiKuToAcsServiceImpl implements LiKuToAcsService {
|
||||
return RespUtil.getResp(result.toString(), new MoveStoreReportResponse());
|
||||
} // 1 已接收 2 开始执行 3执行完成 4 阻挡 5 空洞
|
||||
if(StrUtil.equals(status,"1") || StrUtil.equals(status,"2") ){
|
||||
task.setTask_status("1");
|
||||
task.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskService.update(task);
|
||||
inst.setInstruction_status("1");
|
||||
inst.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
inst.setExecute_device_code(carNo);
|
||||
inst.setCarno(carNo);
|
||||
instructionService.update(inst);
|
||||
|
||||
} else if(StrUtil.equals(status,"3")){
|
||||
inst.setInstruction_status("2");
|
||||
inst.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
||||
instructionService.finish(inst.getInstruction_id());
|
||||
} else if(StrUtil.equals(status,"4")){
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.nl.acs.instruction.enums;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 李帅
|
||||
*/
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum InstructionStatusEnum {
|
||||
READY("0", "READY", "就绪"),
|
||||
BUSY("1", "BUSY", "执行中"),
|
||||
FINISHED("2", "FINISHED", "完成"),
|
||||
|
||||
CANCEL("3", "CANCEL", "取消"),
|
||||
|
||||
ERROR("99", "CANCEL", "异常");
|
||||
|
||||
//索引
|
||||
private String index;
|
||||
//编码
|
||||
private String code;
|
||||
//名字
|
||||
private String name;
|
||||
//描述
|
||||
private String desc;
|
||||
|
||||
// 构造方法
|
||||
InstructionStatusEnum(String index, String code, String name) {
|
||||
this.index = index;
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
|
||||
}
|
||||
|
||||
public static JSONArray getList() {
|
||||
JSONArray arr = new JSONArray();
|
||||
JSONObject json = new JSONObject();
|
||||
for (InstructionStatusEnum em : InstructionStatusEnum.values()) {
|
||||
json.put("code", em.getCode());
|
||||
json.put("name", em.getName());
|
||||
arr.add(json);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public static String getName(String code) {
|
||||
for (InstructionStatusEnum c : InstructionStatusEnum.values()) {
|
||||
if (c.code == code) {
|
||||
return c.name;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -63,6 +63,17 @@ public class InstructionDto implements Serializable {
|
||||
*/
|
||||
private String instruction_type = "1";
|
||||
|
||||
/**
|
||||
* agv取货高度
|
||||
*/
|
||||
private String start_height = "0";
|
||||
|
||||
|
||||
/**
|
||||
* agv放货高度
|
||||
*/
|
||||
private String next_height = "0";
|
||||
|
||||
/**
|
||||
* 指令状态
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.instruction.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -23,6 +24,7 @@ import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.DeviceDriverDefination;
|
||||
import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_conveyor_control_with_scanner.StandardCoveyorControlWithScannerDeviceDriver;
|
||||
@@ -30,6 +32,8 @@ import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspect
|
||||
import org.nl.acs.ext.wms.liKuData.*;
|
||||
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||
import org.nl.acs.instruction.domain.InstructionMybatis;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.SortUtlEx;
|
||||
import org.nl.acs.instruction.service.dto.InstructionDto;
|
||||
import org.nl.acs.instruction.service.dto.InstructionQueryParam;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
@@ -171,7 +175,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
@Override
|
||||
public synchronized void reload() {
|
||||
List<InstructionMybatis> list = new LambdaQueryChainWrapper<InstructionMybatis>(instructionMapper)
|
||||
.lt(InstructionMybatis::getInstruction_status, "2")
|
||||
.lt(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex())
|
||||
.eq(InstructionMybatis::getIs_delete, "0")
|
||||
.list();
|
||||
// List list = this.queryAll("instruction_status <2 and is_delete =0");
|
||||
@@ -198,10 +202,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
wrapper.and(StringUtils.isNotBlank(point_code),instructionMybatis -> instructionMybatis.like(InstructionMybatis::getStart_point_code,point_code).or().like(InstructionMybatis::getNext_point_code,point_code));
|
||||
wrapper.eq(StringUtils.isNotBlank(instruction_type),InstructionMybatis::getInstruction_type,instruction_type);
|
||||
if (!StrUtil.isEmpty(is_over)) {
|
||||
if (StrUtil.equals(is_over,"1")){
|
||||
wrapper.ge(InstructionMybatis::getInstruction_status,2);
|
||||
}else{
|
||||
wrapper.lt(InstructionMybatis::getInstruction_status,2);
|
||||
if (StrUtil.equals(is_over, "1")) {
|
||||
wrapper.ge(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex());
|
||||
} else {
|
||||
wrapper.lt(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex());
|
||||
}
|
||||
}
|
||||
IPage<InstructionMybatis> insPage = instructionMapper.selectPage(queryPage,wrapper);
|
||||
@@ -283,8 +287,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONArray arr = wo.query(whereJson, "create_time").getResultJSONArray(0);
|
||||
// List<Instruction> list = arr.toJavaList(Instruction.class);
|
||||
List<InstructionMybatis> insList= new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.lt(InstructionMybatis::getInstruction_status, "2")
|
||||
List<InstructionMybatis> insList = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.lt(InstructionMybatis::getInstruction_status, InstructionStatusEnum.FINISHED.getIndex())
|
||||
.list();
|
||||
return ConvertUtil.convertList(insList,Instruction.class);
|
||||
}
|
||||
@@ -330,7 +334,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
while (var3.hasNext()) {
|
||||
Instruction instruction = (Instruction) var3.next();
|
||||
if (StrUtil.equals(instruction.getTask_code(), code)
|
||||
&& StrUtil.equals(instruction.getInstruction_status(), "0")) {
|
||||
&& StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex())) {
|
||||
return instruction;
|
||||
}
|
||||
}
|
||||
@@ -507,9 +511,12 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
dto.setCompound_inst_data(task.getCompound_task_data());
|
||||
}
|
||||
}
|
||||
|
||||
dto.setCreate_by(currentUsername);
|
||||
dto.setUpdate_by(currentUsername);
|
||||
if (StringUtils.isNotBlank(currentUsername)) {
|
||||
dto.setCreate_by(currentUsername);
|
||||
}
|
||||
if (StringUtils.isNotBlank(currentUsername)) {
|
||||
dto.setUpdate_by(currentUsername);
|
||||
}
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
dto.setStart_parent_code(task.getStart_parent_code());
|
||||
@@ -602,11 +609,11 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
// + dto.getTask_id()
|
||||
// + "'")
|
||||
// .uniqueResult(0);
|
||||
InstructionMybatis ins= new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.lt(InstructionMybatis::getInstruction_status, 3)
|
||||
.eq(InstructionMybatis::getNext_point_code,dto.getNext_point_code())
|
||||
.eq(InstructionMybatis::getStart_point_code,dto.getStart_point_code())
|
||||
.eq(InstructionMybatis::getTask_id,dto.getTask_id())
|
||||
InstructionMybatis ins = new LambdaQueryChainWrapper<>(instructionMapper)
|
||||
.lt(InstructionMybatis::getInstruction_status, InstructionStatusEnum.CANCEL.getIndex())
|
||||
.eq(InstructionMybatis::getNext_point_code, dto.getNext_point_code())
|
||||
.eq(InstructionMybatis::getStart_point_code, dto.getStart_point_code())
|
||||
.eq(InstructionMybatis::getTask_id, dto.getTask_id())
|
||||
.one();
|
||||
|
||||
|
||||
@@ -735,7 +742,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setInstruction_status("2");
|
||||
entity.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
||||
String instnextdevice = entity.getNext_device_code();
|
||||
String insttaskid = entity.getTask_id();
|
||||
// WQLObject taskwo = WQLObject.getWQLObject("acs_task");
|
||||
@@ -820,7 +827,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void finish(Instruction dto) {
|
||||
String now = DateUtil.now();
|
||||
dto.setInstruction_status("2");
|
||||
dto.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(dto);
|
||||
//
|
||||
@@ -955,7 +962,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(acsTask.getPriority());
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(dto.getNext_device_code());
|
||||
try {
|
||||
this.create(instdto);
|
||||
@@ -1030,7 +1037,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setInstruction_status("3");
|
||||
entity.setInstruction_status(InstructionStatusEnum.CANCEL.getIndex());
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
// wo.update(json);
|
||||
@@ -1090,7 +1097,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setInstruction_status("3");
|
||||
entity.setInstruction_status(InstructionStatusEnum.CANCEL.getIndex());
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
// wo.update(json);
|
||||
@@ -1147,7 +1154,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setInstruction_status("3");
|
||||
entity.setInstruction_status(InstructionStatusEnum.CANCEL.getIndex());
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_instruction");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
// wo.update(json);
|
||||
@@ -1291,21 +1298,22 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
inst.setFrom_y(start_point[1]);
|
||||
inst.setFrom_z(start_point[2]);
|
||||
} else {
|
||||
String start_device =
|
||||
deviceAppService
|
||||
.findDeviceByCode(start_device_code)
|
||||
.getDeviceDriverDefination()
|
||||
.getFitDeviceTypes()
|
||||
.get(0)
|
||||
.name();
|
||||
if (StrUtil.equals("storage", start_device)) {
|
||||
String[] start_point = start_point_code.split("-");
|
||||
inst.setFrom_x(start_point[0]);
|
||||
inst.setStart_device_code(start_point[0]);
|
||||
inst.setFrom_y(start_point[1]);
|
||||
inst.setFrom_z(start_point[2]);
|
||||
} else {
|
||||
inst.setStart_device_code(start_device_code);
|
||||
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(start_point_code).getDeviceDriverDefination();
|
||||
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
|
||||
String start_device =
|
||||
deviceDriverDefination
|
||||
.getFitDeviceTypes()
|
||||
.get(0)
|
||||
.name();
|
||||
if (StrUtil.equals("storage", start_device)) {
|
||||
String[] start_point = start_point_code.split("-");
|
||||
inst.setFrom_x(start_point[0]);
|
||||
inst.setStart_device_code(start_point[0]);
|
||||
inst.setFrom_y(start_point[1]);
|
||||
inst.setFrom_z(start_point[2]);
|
||||
} else {
|
||||
inst.setStart_device_code(start_device_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1316,22 +1324,22 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
inst.setTo_y(next_point[1]);
|
||||
inst.setTo_z(next_point[2]);
|
||||
} else {
|
||||
|
||||
String next_device =
|
||||
deviceAppService
|
||||
.findDeviceByCode(next_device_code)
|
||||
.getDeviceDriverDefination()
|
||||
.getFitDeviceTypes()
|
||||
.get(0)
|
||||
.name();
|
||||
if (StrUtil.equals("storage", next_device)) {
|
||||
String[] next_point = start_point_code.split("-");
|
||||
inst.setTo_x(next_point[0]);
|
||||
inst.setNext_device_code(next_point[0]);
|
||||
inst.setTo_y(next_point[1]);
|
||||
inst.setTo_z(next_point[2]);
|
||||
} else {
|
||||
inst.setNext_device_code(next_device_code);
|
||||
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(next_device_code).getDeviceDriverDefination();
|
||||
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
|
||||
String next_device =
|
||||
deviceDriverDefination
|
||||
.getFitDeviceTypes()
|
||||
.get(0)
|
||||
.name();
|
||||
if (StrUtil.equals("storage", next_device)) {
|
||||
String[] next_point = start_point_code.split("-");
|
||||
inst.setTo_x(next_point[0]);
|
||||
inst.setNext_device_code(next_point[0]);
|
||||
inst.setTo_y(next_point[1]);
|
||||
inst.setTo_z(next_point[2]);
|
||||
} else {
|
||||
inst.setNext_device_code(next_device_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
return inst;
|
||||
@@ -1352,7 +1360,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
while (it.hasNext()) {
|
||||
Instruction inst = it.next();
|
||||
if (StrUtil.equals(devicecode, inst.getStart_device_code())
|
||||
&& inst.getInstruction_status().equals("0")) {
|
||||
&& inst.getInstruction_status().equals(InstructionStatusEnum.READY.getIndex())) {
|
||||
return inst;
|
||||
}
|
||||
}
|
||||
@@ -1529,7 +1537,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (inst == null) {
|
||||
throw new BadRequestException("指令不存在或已删除");
|
||||
}
|
||||
if ("2".equals(inst.getInstruction_status())) {
|
||||
if (InstructionStatusEnum.FINISHED.getIndex().equals(inst.getInstruction_status())) {
|
||||
throw new BadRequestException("指令已经完成");
|
||||
}
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ public class DeviceAppServiceImpl implements DeviceAppService, ApplicationAutoIn
|
||||
|
||||
while (var3.hasNext()) {
|
||||
Device device = (Device) var3.next();
|
||||
if (ObjectUtil.equal(device.getDevice_code(), deviceCode)) {
|
||||
if (ObjectUtil.equal(device.getDevice_code(), deviceCode)&&BeanUtil.isNotEmpty(device.getDeviceDriverDefination())) {
|
||||
return device.getDeviceDriverDefination().getFitDeviceTypes().get(0).name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,18 +3,22 @@ package org.nl.acs.task.enums;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum TaskStatusEnum {
|
||||
READY(1, "READY", "就绪"),
|
||||
BUSY(2, "BUSY", "执行中"),
|
||||
FINISHED(3, "FINISHED", "完成"),
|
||||
READY("0", "READY", "就绪"),
|
||||
BUSY("1", "BUSY", "执行中"),
|
||||
FINISHED("2", "FINISHED", "完成"),
|
||||
|
||||
CANCEL(4, "CANCEL", "取消"),
|
||||
CANCEL("3", "CANCEL", "取消"),
|
||||
|
||||
ERROR(4, "CANCEL", "异常");
|
||||
ERROR("99", "CANCEL", "异常");
|
||||
|
||||
//索引
|
||||
private int index;
|
||||
private String index;
|
||||
//编码
|
||||
private String code;
|
||||
//名字
|
||||
@@ -23,7 +27,7 @@ public enum TaskStatusEnum {
|
||||
private String desc;
|
||||
|
||||
// 构造方法
|
||||
TaskStatusEnum(int index, String code, String name) {
|
||||
TaskStatusEnum(String index, String code, String name) {
|
||||
this.index = index;
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
@@ -41,30 +45,6 @@ public enum TaskStatusEnum {
|
||||
return arr;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static String getName(String code) {
|
||||
for (TaskStatusEnum c : TaskStatusEnum.values()) {
|
||||
if (c.code == code) {
|
||||
@@ -74,11 +54,4 @@ public enum TaskStatusEnum {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,6 +98,10 @@ public interface TaskService extends CommonService<Task> {
|
||||
List<TaskDto> queryAll(String whereJson);
|
||||
|
||||
|
||||
|
||||
List<TaskDto> queryAllByStatus(String task_status);
|
||||
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
*
|
||||
|
||||
@@ -125,6 +125,17 @@ public class TaskDto implements Serializable {
|
||||
*/
|
||||
private String put_device_code;
|
||||
|
||||
/**
|
||||
* agv取货高度
|
||||
*/
|
||||
private String start_height = "0";
|
||||
|
||||
|
||||
/**
|
||||
* agv放货高度
|
||||
*/
|
||||
private String next_height = "0";
|
||||
|
||||
/**
|
||||
* 起始点位编码
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.task.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
@@ -21,10 +22,12 @@ import org.nl.acs.device.service.DeviceAssignedService;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.dto.DeviceAssignedDto;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.device_driver.DeviceDriverDefination;
|
||||
import org.nl.acs.device_driver.RequestMethodEnum;
|
||||
import org.nl.acs.ext.wms.data.one.feedBackTaskStatus.FeedBackTaskStatusRequest;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.service.dto.InstructionDto;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
@@ -35,6 +38,7 @@ import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.route.service.mapper.RoutePlanMapper;
|
||||
import org.nl.acs.storage_cell.service.StorageCellService;
|
||||
import org.nl.acs.task.TaskInstructionLock;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskFeedbackService;
|
||||
import org.nl.acs.task.service.dto.TaskFeedbackDto;
|
||||
import org.nl.acs.common.base.PageInfo;
|
||||
@@ -268,13 +272,22 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
@Override
|
||||
public List queryAll(String whereJson) {
|
||||
List<Task> taskList= new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.lt(Task::getTask_status, "2")
|
||||
.lt(Task::getTask_status, TaskStatusEnum.FINISHED.getIndex())
|
||||
.eq(Task::getIs_delete,"0")
|
||||
.orderByDesc(Task::getCreate_time)
|
||||
.list();
|
||||
return ConvertUtil.convertList(taskList,TaskDto.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskDto> queryAllByStatus(String task_status) {
|
||||
List<Task> taskList= new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.eq(Task::getTask_status, task_status)
|
||||
.eq(Task::getIs_delete,"0")
|
||||
.list();
|
||||
return ConvertUtil.convertList(taskList,TaskDto.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
|
||||
@@ -304,9 +317,9 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
}
|
||||
if (!StrUtil.isEmpty(is_over)) {
|
||||
if (StrUtil.equals(is_over,"1")){
|
||||
wrapper.ge(Task::getTask_status,2);
|
||||
wrapper.ge(Task::getTask_status,TaskStatusEnum.FINISHED.getIndex());
|
||||
}else{
|
||||
wrapper.lt(Task::getTask_status,2);
|
||||
wrapper.lt(Task::getTask_status,TaskStatusEnum.FINISHED.getIndex());
|
||||
}
|
||||
}
|
||||
IPage<Task> taskPage = taskMapper.selectPage(queryPage,wrapper);
|
||||
@@ -455,7 +468,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
// List<TaskDto> list = arr.toJavaList(TaskDto.class);
|
||||
// return list;
|
||||
List<Task> taskList= new LambdaQueryChainWrapper<>(taskMapper)
|
||||
.lt(Task::getTask_status,"2")
|
||||
.lt(Task::getTask_status,TaskStatusEnum.FINISHED.getIndex())
|
||||
.list();
|
||||
return ConvertUtil.convertList(taskList,TaskDto.class);
|
||||
}
|
||||
@@ -479,7 +492,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (task.getStart_device_code().equals(device_code)
|
||||
&& StrUtil.equals(task.getTask_status(), "0")) {
|
||||
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())) {
|
||||
list.add(task);
|
||||
}
|
||||
}
|
||||
@@ -497,7 +510,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
}
|
||||
if ((task.getStart_device_code().equals(start_device_code)
|
||||
|| task.getStart_device_code2().equals(start_device_code))
|
||||
&& StrUtil.equals(task.getTask_status(), "0")) {
|
||||
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())) {
|
||||
list.add(task);
|
||||
}
|
||||
}
|
||||
@@ -514,7 +527,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
continue;
|
||||
}
|
||||
if (task.getStart_device_code().equals(back_start_device_code)
|
||||
&& StrUtil.equals(task.getTask_status(), "0")) {
|
||||
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())) {
|
||||
list.add(task);
|
||||
}
|
||||
}
|
||||
@@ -528,7 +541,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (task.getStart_device_code().equals(device_code)
|
||||
&& StrUtil.equals(task.getTask_status(), "1")) {
|
||||
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex())) {
|
||||
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||
list.add(task);
|
||||
@@ -548,7 +561,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
}
|
||||
if ((task.getStart_device_code().equals(head_start_device_code)
|
||||
|| task.getStart_device_code2().equals(head_start_device_code))
|
||||
&& StrUtil.equals(task.getTask_status(), "1")) {
|
||||
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex())) {
|
||||
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||
list.add(task);
|
||||
@@ -567,7 +580,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
continue;
|
||||
}
|
||||
if ((task.getStart_device_code().equals(back_start_device_code))
|
||||
&& StrUtil.equals(task.getTask_status(), "1")) {
|
||||
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.BUSY.getIndex())) {
|
||||
Instruction instruction = instructionService.findByTaskcodeAndStatus(task.getTask_code());
|
||||
if (ObjectUtil.isNotEmpty(instruction)) {
|
||||
list.add(task);
|
||||
@@ -626,7 +639,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
dto.setCreate_time(now);
|
||||
dto.setTask_code(task_code);
|
||||
dto.setRoute_plan_code(route_plan_code);
|
||||
dto.setTask_status("0");
|
||||
dto.setTask_status(TaskStatusEnum.READY.getIndex());
|
||||
dto.setStart_device_code2(dto.getStart_point_code2());
|
||||
dto.setNext_device_code2(dto.getNext_point_code2());
|
||||
|
||||
@@ -859,7 +872,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
|
||||
removeByCodeFromCache(entity.getTask_code());
|
||||
|
||||
if (StrUtil.equals(dto.getTask_status(), "0") || StrUtil.equals(dto.getTask_status(), "1")) {
|
||||
if (StrUtil.equals(dto.getTask_status(), TaskStatusEnum.READY.getIndex()) || StrUtil.equals(dto.getTask_status(), TaskStatusEnum.BUSY.getIndex())) {
|
||||
tasks.add(dto);
|
||||
}
|
||||
// 判断是否为WMS下发的任务,如果是反馈任务状态给WMS
|
||||
@@ -905,7 +918,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setTask_status("2");
|
||||
entity.setTask_status(TaskStatusEnum.FINISHED.getIndex());
|
||||
|
||||
Task task = ConvertUtil.convert(entity, Task.class);
|
||||
taskMapper.updateById(task);
|
||||
@@ -959,7 +972,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setTask_status("3");
|
||||
entity.setTask_status(TaskStatusEnum.CANCEL.getIndex());
|
||||
|
||||
Task task = ConvertUtil.convert(entity, Task.class);
|
||||
taskMapper.updateById(task);
|
||||
@@ -1028,7 +1041,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
String now = DateUtil.now();
|
||||
entity.setUpdate_time(now);
|
||||
entity.setUpdate_by(currentUsername);
|
||||
entity.setTask_status("3");
|
||||
entity.setTask_status(TaskStatusEnum.CANCEL.getIndex());
|
||||
// WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
// JSONObject json = (JSONObject) JSONObject.toJSON(entity);
|
||||
// wo.update(json);
|
||||
@@ -1151,7 +1164,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setVehicle_type(vehicleType);
|
||||
instdto.setStart_point_code2(start_point_code2);
|
||||
@@ -1269,7 +1282,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setVehicle_type(vehicleType);
|
||||
instdto.setStart_point_code2(start_point_code2);
|
||||
@@ -1426,7 +1439,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
// continue;
|
||||
// }
|
||||
if (StrUtil.equals(task.getStart_device_code(), device_code)
|
||||
&& StrUtil.equals(task.getTask_status(), "0")) {
|
||||
&& StrUtil.equals(task.getTask_status(), TaskStatusEnum.READY.getIndex())) {
|
||||
return task;
|
||||
}
|
||||
}
|
||||
@@ -1478,45 +1491,46 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
task.setStart_device_code(task.getStart_device_code());
|
||||
|
||||
} else {
|
||||
String start_device =
|
||||
deviceAppService
|
||||
.findDeviceByCode(start_point_code)
|
||||
.getDeviceDriverDefination()
|
||||
.getFitDeviceTypes()
|
||||
.get(0)
|
||||
.name();
|
||||
// 如果point_device为货架,则不包含列层信息,需要重新拼接
|
||||
if (StrUtil.equals("storage", start_device)) {
|
||||
if (StrUtil.isEmpty(task.getFrom_x())) {
|
||||
throw new BadRequestException("货位信息起点需要包含列信息");
|
||||
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(start_point_code).getDeviceDriverDefination();
|
||||
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
|
||||
String start_device=
|
||||
deviceDriverDefination
|
||||
.getFitDeviceTypes()
|
||||
.get(0)
|
||||
.name();
|
||||
// 如果point_device为货架,则不包含列层信息,需要重新拼接
|
||||
if (StrUtil.equals("storage", start_device)) {
|
||||
if (StrUtil.isEmpty(task.getFrom_x())) {
|
||||
throw new BadRequestException("货位信息起点需要包含列信息");
|
||||
}
|
||||
if (StrUtil.isEmpty(task.getFrom_y())) {
|
||||
throw new BadRequestException("货位信息起点需要包含层信息");
|
||||
}
|
||||
if (Integer.parseInt(task.getFrom_y()) < 10 && task.getFrom_y().length() == 1) {
|
||||
from_y = "0" + task.getFrom_y();
|
||||
task.setFrom_y(from_y);
|
||||
} else {
|
||||
from_y = task.getFrom_y();
|
||||
}
|
||||
if (Integer.parseInt(task.getFrom_z()) < 10 && task.getFrom_z().length() == 1) {
|
||||
from_z = "0" + task.getFrom_z();
|
||||
task.setFrom_z(from_z);
|
||||
} else if (task.getFrom_z().length() == 2) {
|
||||
from_z = task.getFrom_z();
|
||||
task.setFrom_z(from_z);
|
||||
} else {
|
||||
from_z = task.getFrom_z();
|
||||
}
|
||||
task.setFrom_x(start_point_code);
|
||||
task.setStart_point_code(start_point_code + "-" + from_y + "-" + from_z);
|
||||
task.setStart_device_code(start_point_code);
|
||||
}
|
||||
if (StrUtil.isEmpty(task.getFrom_y())) {
|
||||
throw new BadRequestException("货位信息起点需要包含层信息");
|
||||
}
|
||||
if (Integer.parseInt(task.getFrom_y()) < 10 && task.getFrom_y().length() == 1) {
|
||||
from_y = "0" + task.getFrom_y();
|
||||
task.setFrom_y(from_y);
|
||||
} else {
|
||||
from_y = task.getFrom_y();
|
||||
}
|
||||
if (Integer.parseInt(task.getFrom_z()) < 10 && task.getFrom_z().length() == 1) {
|
||||
from_z = "0" + task.getFrom_z();
|
||||
task.setFrom_z(from_z);
|
||||
} else if (task.getFrom_z().length() == 2) {
|
||||
from_z = task.getFrom_z();
|
||||
task.setFrom_z(from_z);
|
||||
} else {
|
||||
from_z = task.getFrom_z();
|
||||
}
|
||||
task.setFrom_x(start_point_code);
|
||||
task.setStart_point_code(start_point_code + "-" + from_y + "-" + from_z);
|
||||
task.setStart_device_code(start_point_code);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
task.setStart_device_code(start_point_code);
|
||||
task.setStart_device_code(start_point_code);
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.contains(next_point_code, "-") && StrUtil.count(next_point_code, "-") == 2) {
|
||||
String[] next_point = next_point_code.split("-");
|
||||
task.setNext_device_code(next_point[0]);
|
||||
@@ -1542,10 +1556,10 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
task.setNext_device_code(task.getNext_device_code());
|
||||
|
||||
} else {
|
||||
DeviceDriverDefination deviceDriverDefination = deviceAppService.findDeviceByCode(next_point_code).getDeviceDriverDefination();
|
||||
if (BeanUtil.isNotEmpty(deviceDriverDefination)) {
|
||||
String next_device =
|
||||
deviceAppService
|
||||
.findDeviceByCode(next_point_code)
|
||||
.getDeviceDriverDefination()
|
||||
deviceDriverDefination
|
||||
.getFitDeviceTypes()
|
||||
.get(0)
|
||||
.name();
|
||||
@@ -1574,7 +1588,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
task.setTo_x(next_point_code);
|
||||
task.setNext_point_code(next_point_code + "-" + to_y + "-" + to_z);
|
||||
task.setNext_device_code(next_point_code);
|
||||
|
||||
}
|
||||
} else {
|
||||
task.setNext_device_code(next_point_code);
|
||||
task.setNext_device_code(next_point_code);
|
||||
@@ -1653,7 +1667,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
Iterator<TaskDto> iterator = tasks.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TaskDto task = iterator.next();
|
||||
if (task.getTask_type().equals(taskType) && task.getTask_status().equals("1")) {
|
||||
if (task.getTask_type().equals(taskType) && task.getTask_status().equals(TaskStatusEnum.BUSY.getIndex())) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,13 @@ import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver;
|
||||
import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
@@ -321,7 +323,7 @@ public class AutoCreateInst {
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
instdto.setCompound_inst_data(compound_task_data);
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status("0");
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setVehicle_type(vehicleType);
|
||||
try {
|
||||
@@ -333,7 +335,7 @@ public class AutoCreateInst {
|
||||
}
|
||||
log.info("任务 [" + taskcode + "] 指令成功生成!");
|
||||
//创建指令后修改任务状态
|
||||
acsTask.setTask_status("1");
|
||||
acsTask.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskserver.update(acsTask);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
package org.nl.system.service.quartz.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.acs.instruction.enums.InstructionStatusEnum;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 自动创建指令
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AutoCreateInst {
|
||||
|
||||
/**
|
||||
* 根据任务状态创建指令、生成下一条指令
|
||||
* 创建指令前需要判断是否条件具备:起始位置是否有货、目标位置是否有货
|
||||
*/
|
||||
public void run() throws Exception {
|
||||
TaskService taskserver = SpringContextHolder.getBean(TaskService.class);
|
||||
InstructionService instructionService = SpringContextHolder.getBean(InstructionService.class);
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
|
||||
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
List<TaskDto> list = taskserver.queryAllByStatus("0");
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
TaskDto acsTask = list.get(i);
|
||||
if (StrUtil.equals(acsTask.getTask_type(), "7") && !StrUtil.startWith(acsTask.getTask_code(), "-")) {
|
||||
continue;
|
||||
}
|
||||
String taskid = acsTask.getTask_id();
|
||||
String taskcode = acsTask.getTask_code();
|
||||
String task_type = acsTask.getTask_type();
|
||||
String vehiclecode = acsTask.getVehicle_code();
|
||||
String storage_task_type = acsTask.getStorage_task_type();
|
||||
String priority = acsTask.getPriority();
|
||||
String is_send = acsTask.getIs_send();
|
||||
|
||||
String start_device_code = acsTask.getStart_device_code();
|
||||
String start_point_code = acsTask.getStart_point_code();
|
||||
|
||||
String put_device_code = acsTask.getPut_device_code();
|
||||
String put_point_code = acsTask.getPut_point_code();
|
||||
|
||||
String next_device_code = acsTask.getNext_device_code();
|
||||
String next_point_code = acsTask.getNext_point_code();
|
||||
|
||||
String start_point_code2 = acsTask.getStart_point_code2();
|
||||
String start_device_code2 = acsTask.getStart_device_code2();
|
||||
|
||||
String next_point_code2 = acsTask.getNext_point_code2();
|
||||
String next_device_code2 = acsTask.getNext_device_code2();
|
||||
|
||||
String route_plan_code = acsTask.getRoute_plan_code();
|
||||
String vehicleType = acsTask.getVehicle_type();
|
||||
String agv_system_type = acsTask.getAgv_system_type();
|
||||
|
||||
String start_height = acsTask.getStart_height();
|
||||
String next_height = acsTask.getNext_height();
|
||||
|
||||
|
||||
if (StrUtil.equals(is_send, "0")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//校验路由关系
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
acsTask.setRemark("路由不通无法生成指令");
|
||||
taskserver.updateByCodeFromCache(acsTask);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!StrUtil.equals(shortPathsList.get(0).getType(), "1")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||
String path = routeLineDto.getPath();
|
||||
String type = routeLineDto.getType();
|
||||
String[] str = path.split("->");
|
||||
List<String> pathlist = Arrays.asList(str);
|
||||
int index = 0;
|
||||
for (int m = 0; m < pathlist.size(); m++) {
|
||||
if (pathlist.get(m).equals(start_device_code)) {
|
||||
index = m + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
next_device_code = pathlist.get(index);
|
||||
|
||||
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
|
||||
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
|
||||
} else {
|
||||
next_point_code = next_device_code;
|
||||
}
|
||||
|
||||
|
||||
Instruction instdto = new Instruction();
|
||||
instdto.setInstruction_type(task_type);
|
||||
instdto.setInstruction_id(IdUtil.simpleUUID());
|
||||
instdto.setRoute_plan_code(route_plan_code);
|
||||
instdto.setRemark(acsTask.getRemark());
|
||||
instdto.setMaterial(acsTask.getMaterial());
|
||||
instdto.setQuantity(acsTask.getQuantity());
|
||||
instdto.setTask_id(taskid);
|
||||
instdto.setTask_code(taskcode);
|
||||
instdto.setVehicle_code(vehiclecode);
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by("auto");
|
||||
|
||||
instdto.setStart_device_code(start_device_code);
|
||||
instdto.setStart_point_code(start_point_code);
|
||||
instdto.setPut_device_code(put_device_code);
|
||||
instdto.setPut_point_code(put_point_code);
|
||||
instdto.setNext_device_code(next_device_code);
|
||||
instdto.setNext_point_code(next_point_code);
|
||||
|
||||
instdto.setStart_point_code2(start_point_code2);
|
||||
instdto.setStart_device_code2(start_device_code2);
|
||||
instdto.setNext_point_code2(next_point_code2);
|
||||
instdto.setNext_device_code2(next_device_code2);
|
||||
|
||||
instdto.setPriority(priority);
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_point_code);
|
||||
instdto.setVehicle_type(vehicleType);
|
||||
instdto.setAgv_system_type(agv_system_type);
|
||||
instdto.setStart_height(start_height);
|
||||
instdto.setNext_height(next_height);
|
||||
//判断agv系统
|
||||
//1、1楼叉车系统
|
||||
//2、2楼1区域AGV系统
|
||||
//3、2楼2区域AGV系统 -已废弃
|
||||
if (!StrUtil.equals(agv_system_type, "1")) {
|
||||
// task_type
|
||||
//1、生箔; Itype=1:取空,取满,放空,放满;
|
||||
//2、分切 Itype=3取满、取空、放满、放空;
|
||||
//3、普通任务 Itype=2:取货、放货;
|
||||
//4、叉车任务
|
||||
//5、输送任务
|
||||
//6、行架
|
||||
//7、立库
|
||||
if (StrUtil.equals(task_type, "1")) {
|
||||
instdto.setAgv_inst_type("1");
|
||||
} else if (StrUtil.equals(task_type, "3")) {
|
||||
instdto.setAgv_inst_type("2");
|
||||
} else if (StrUtil.equals(task_type, "2")) {
|
||||
instdto.setAgv_inst_type("3");
|
||||
} else if (StrUtil.equals(task_type, "8")) {
|
||||
instdto.setAgv_inst_type("2");
|
||||
} else {
|
||||
log.info("未找到对应的AGV指令类型,任务号:" + acsTask.getTask_code() + ",task_type:" + acsTask.getTask_type()) ;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
instdto.setAgv_inst_type("4");
|
||||
}
|
||||
try {
|
||||
instructionService.create(instdto);
|
||||
} catch (Exception e) {
|
||||
acsTask.setRemark(e.getMessage());
|
||||
taskserver.updateByCodeFromCache(acsTask);
|
||||
continue;
|
||||
}
|
||||
//创建指令后修改任务状态
|
||||
acsTask.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskserver.update(acsTask);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user