rev:三楼CTU
This commit is contained in:
@@ -6,6 +6,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.util.concurrent.Uninterruptibles;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -32,6 +33,8 @@ import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.task.enums.AgvSystemTypeEnum;
|
||||
import org.nl.acs.task.enums.InstTypeEnum;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.enums.TaskTypeEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
@@ -46,6 +49,7 @@ import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
@@ -241,8 +245,14 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
this.currentDeviceCode = this.getDevice().getDevice_code();
|
||||
this.loadAssignData(currentDeviceCode, ItemProtocol.class);
|
||||
try {
|
||||
this.currentDeviceCode = this.getDevice().getDevice_code();
|
||||
this.loadAssignData(currentDeviceCode, ItemProtocol.class);
|
||||
} catch (Exception e) {
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "当前设备执行逻辑报错,错误信息: " + e.getMessage()));
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "当前设备执行逻辑报错,错误堆栈信息: " + Arrays.toString(e.getStackTrace())));
|
||||
Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
private void executeLogicBefore() {
|
||||
@@ -253,7 +263,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
if (this.mode != this.lastMode) {
|
||||
this.requireSuccess = false;
|
||||
}
|
||||
if (!StrUtil.equals(this.barcode,this.lastBarcode) && this.isWithStationRequireSuccess()){
|
||||
if (!StrUtil.equals(this.barcode, this.lastBarcode) && this.isWithStationRequireSuccess()) {
|
||||
this.requireSuccess = false;
|
||||
this.withStationRequireSuccess = false;
|
||||
}
|
||||
@@ -296,9 +306,9 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
}
|
||||
|
||||
//CTU取货申请满足条件
|
||||
if (this.mode == 2 && this.status == 1 && this.move == 1 && this.action == 1 && this.reqTakeRequireSuccess && ObjectUtil.isNotEmpty(this.reqTakeInstCode) ){
|
||||
if (this.mode == 2 && this.status == 1 && this.move == 1 && this.action == 1 && this.reqTakeRequireSuccess && ObjectUtil.isNotEmpty(this.reqTakeInstCode)) {
|
||||
Instruction instruction = instructionService.findByCodeFromCache(this.reqTakeInstCode);
|
||||
if (ObjectUtil.isNotEmpty(instruction) && StrUtil.equals(instruction.getStart_device_code(),this.currentDeviceCode)){
|
||||
if (ObjectUtil.isNotEmpty(instruction) && StrUtil.equals(instruction.getStart_device_code(), this.currentDeviceCode)) {
|
||||
//调用CTU的取货申请通过接口
|
||||
BoxApplyPassReq bapReq = BoxApplyPassReq.builder()
|
||||
.taskCode(this.reqTakeInstCode)
|
||||
@@ -308,16 +318,16 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
// .data(bapReq)
|
||||
// .build();
|
||||
UnifiedResponse<String> unifiedResponse = acsToHkService.boxApplyPass(bapReq, String.class);
|
||||
if (unifiedResponse.isSuccess()){
|
||||
if (unifiedResponse.isSuccess()) {
|
||||
this.reqTakeRequireSuccess = false;
|
||||
this.reqTakeInstCode = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
//CTU放货申请满足条件
|
||||
if (this.mode == 2 && this.status == 1 && this.move == 0 && this.action == 1 && this.reqPutRequireSuccess && ObjectUtil.isNotEmpty(this.reqPutInstCode) ){
|
||||
if (this.mode == 2 && this.status == 1 && this.move == 0 && this.action == 1 && this.reqPutRequireSuccess && ObjectUtil.isNotEmpty(this.reqPutInstCode)) {
|
||||
Instruction instruction = instructionService.findByCodeFromCache(this.reqPutInstCode);
|
||||
if (ObjectUtil.isNotEmpty(instruction) && StrUtil.equals(instruction.getNext_device_code(),this.currentDeviceCode)){
|
||||
if (ObjectUtil.isNotEmpty(instruction) && StrUtil.equals(instruction.getNext_device_code(), this.currentDeviceCode)) {
|
||||
//调用CTU的放货申请通过接口
|
||||
BoxApplyPassReq bapReq = BoxApplyPassReq.builder()
|
||||
.taskCode(this.reqPutInstCode)
|
||||
@@ -327,7 +337,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
// .data(bapReq)
|
||||
// .build();
|
||||
UnifiedResponse<String> unifiedResponse = acsToHkService.boxApplyPass(bapReq, String.class);
|
||||
if (unifiedResponse.isSuccess()){
|
||||
if (unifiedResponse.isSuccess()) {
|
||||
this.reqPutRequireSuccess = false;
|
||||
this.reqPutInstCode = null;
|
||||
}
|
||||
@@ -527,7 +537,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
this.unExecutedMessage = "任务起点与当前设备号不一致,查找入库任务结束";
|
||||
return;
|
||||
}
|
||||
if (StrUtil.equals(taskDto.getTask_type(), TaskTypeEnum.AGV_TASK.getCode()) || StrUtil.equals(taskDto.getTask_type(), TaskTypeEnum.CTU_TASK.getCode())){
|
||||
if (StrUtil.equals(taskDto.getTask_type(), TaskTypeEnum.AGV_TASK.getCode()) || StrUtil.equals(taskDto.getTask_type(), TaskTypeEnum.CTU_TASK.getCode())) {
|
||||
this.unExecutedMessage = "查询到当前任务类型是AGV任务或CTU任务,查找入库任务结束";
|
||||
return;
|
||||
}
|
||||
@@ -567,7 +577,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
break;
|
||||
} else {
|
||||
Device start_device = deviceAppService.findDeviceByCode(inst.getStart_device_code());
|
||||
if (start_device != null && start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver){
|
||||
if (start_device != null && start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) {
|
||||
assignedDto = deviceAssignedDto;
|
||||
break;
|
||||
}
|
||||
@@ -576,7 +586,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
} else {
|
||||
assignedDto = assignedDtos.get(0);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(assignedDto)){
|
||||
if (ObjectUtil.isEmpty(assignedDto)) {
|
||||
this.unExecutedMessage = "未查询到可用平均分配, 查找入库任务结束";
|
||||
}
|
||||
start_device_code = assignedDto.getDevice_code();
|
||||
@@ -696,7 +706,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
TaskDto taskDto = taskService.findReadyTaskByNextDeviceCode(deviceCode, checkoutStartDeviceCode);
|
||||
Instruction instDto = instructionService.findReadyInstByEnd(deviceCode);
|
||||
if (ObjectUtil.isNotEmpty(taskDto) && ObjectUtil.isEmpty(instDto)) {
|
||||
if (StrUtil.equals(taskDto.getTask_type(), TaskTypeEnum.AGV_TASK.getCode()) || StrUtil.equals(taskDto.getTask_type(), TaskTypeEnum.CTU_TASK.getCode())){
|
||||
if (StrUtil.equals(taskDto.getTask_type(), TaskTypeEnum.AGV_TASK.getCode()) || StrUtil.equals(taskDto.getTask_type(), TaskTypeEnum.CTU_TASK.getCode())) {
|
||||
this.unExecutedMessage = "查询到当前任务类型是AGV任务或CTU任务,查找出库任务结束";
|
||||
return;
|
||||
}
|
||||
@@ -944,6 +954,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1054,6 +1065,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
instdto.setTask_id(taskDto.getTask_id());
|
||||
instdto.setTask_code(taskDto.getTask_code());
|
||||
instdto.setVehicle_code(taskDto.getVehicle_code());
|
||||
instdto.setVehicle_type(taskDto.getVehicle_type());
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
|
||||
@@ -1065,6 +1077,10 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_device_code);
|
||||
instdto.setInstruction_type(taskDto.getTask_type());
|
||||
if (StrUtil.equals(next_device_code, "3101")) {
|
||||
instdto.setInstruction_type(InstTypeEnum.CTU_OUT_TASK.getCode());
|
||||
instdto.setAgv_system_type(AgvSystemTypeEnum.HK_SYSTEM_TYPE.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
private void setInstruction(Instruction instdto, TaskDto taskDto, String start_device_code, String start_point_code, String next_device_code, String next_point_code) {
|
||||
@@ -1077,6 +1093,7 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
instdto.setTask_id(taskDto.getTask_id());
|
||||
instdto.setTask_code(taskDto.getTask_code());
|
||||
instdto.setVehicle_code(taskDto.getVehicle_code());
|
||||
instdto.setVehicle_type(taskDto.getVehicle_type());
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
|
||||
@@ -1088,6 +1105,10 @@ public class AppearanceInspectionScannerConveyorDeviceDriver extends AbstractOpc
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(start_device_code);
|
||||
instdto.setInstruction_type(taskDto.getTask_type());
|
||||
if (StrUtil.equals(next_device_code, "3101")) {
|
||||
instdto.setInstruction_type(InstTypeEnum.CTU_OUT_TASK.getCode());
|
||||
instdto.setAgv_system_type(AgvSystemTypeEnum.HK_SYSTEM_TYPE.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.util.concurrent.Uninterruptibles;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@@ -37,6 +38,7 @@ import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -398,8 +400,14 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
this.currentDeviceCode = this.getDevice().getDevice_code();
|
||||
this.loadAssignData(currentDeviceCode, ItemProtocol.class);
|
||||
try {
|
||||
this.currentDeviceCode = this.getDevice().getDevice_code();
|
||||
this.loadAssignData(currentDeviceCode, ItemProtocol.class);
|
||||
} catch (Exception e) {
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "当前设备执行逻辑报错,错误信息: " + e.getMessage()));
|
||||
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "当前设备执行逻辑报错,错误堆栈信息: " + Arrays.toString(e.getStackTrace())));
|
||||
Uninterruptibles.sleepUninterruptibly(10, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isTimeValid(long currentTimeMillis) {
|
||||
@@ -486,7 +494,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
}
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void executeLogic() {
|
||||
if (this.front_task != 0 && this.back_task != 0) {
|
||||
@@ -599,7 +606,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
if (ObjectUtil.isEmpty(frontInst) && ObjectUtil.isEmpty(backInst)) {
|
||||
if (this.to_command != 0) {
|
||||
this.writing(ItemProtocol.TO_COMMAND.getKey(), 0);
|
||||
Thread.sleep(1000);
|
||||
Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
|
||||
}
|
||||
if (this.stopReceiveTask) {
|
||||
this.unExecutedMessage = "堆垛机设置为停止接收任务";
|
||||
@@ -884,11 +891,16 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
// List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList");
|
||||
List<String> specialGetDevice = this.getExtraDeviceCodes("specialGetDevice");
|
||||
List<String> specialPutDevice = this.getExtraDeviceCodes("specialPutDevice");
|
||||
backInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getBackDeviceCodeList, specialGetDevice, specialPutDevice, front_start_device_code);
|
||||
if (ObjectUtil.isNotEmpty(backInst)) {
|
||||
String back_start_device_code = backInst.getStart_device_code();
|
||||
Device back_start_device = deviceAppService.findDeviceByCode(back_start_device_code);
|
||||
this.backWrite(back_start_device, backInst);
|
||||
String getLinkDeviceCode = Optional.ofNullable(front_start_device.getExtraValue().get("getLinkDeviceCode")).map(Object::toString).orElse(null);
|
||||
if (StrUtil.isNotEmpty(getLinkDeviceCode)){
|
||||
backInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getBackDeviceCodeList, specialGetDevice, specialPutDevice, front_start_device_code, getLinkDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(backInst)) {
|
||||
String back_start_device_code = backInst.getStart_device_code();
|
||||
Device back_start_device = deviceAppService.findDeviceByCode(back_start_device_code);
|
||||
this.backWrite(back_start_device, backInst);
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, backInst);
|
||||
}
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, backInst);
|
||||
}
|
||||
@@ -976,15 +988,20 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
this.sendPutInfoToPlc(frontInst, backInst);
|
||||
}
|
||||
} else if (instanceAppearance(back_start_device) && instanceAppearance(back_next_device)) {
|
||||
if (ObjectUtil.isEmpty(backInst)) {
|
||||
if (ObjectUtil.isEmpty(frontInst)) {
|
||||
//List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList");
|
||||
List<String> specialGetDevice = this.getExtraDeviceCodes("specialGetDevice");
|
||||
List<String> specialPutDevice = this.getExtraDeviceCodes("specialPutDevice");
|
||||
frontInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getFrontDeviceCodeList, specialGetDevice, specialPutDevice, back_start_device_code);
|
||||
if (ObjectUtil.isNotEmpty(frontInst)) {
|
||||
String front_start_device_code = frontInst.getStart_device_code();
|
||||
Device front_start_device = deviceAppService.findDeviceByCode(front_start_device_code);
|
||||
this.frontWrite(front_start_device, frontInst);
|
||||
String getLinkDeviceCode = Optional.ofNullable(back_start_device.getExtraValue().get("getLinkDeviceCode")).map(Object::toString).orElse(null);
|
||||
if (StrUtil.isNotEmpty(getLinkDeviceCode)){
|
||||
frontInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getFrontDeviceCodeList, specialGetDevice, specialPutDevice, back_start_device_code, getLinkDeviceCode);
|
||||
if (ObjectUtil.isNotEmpty(frontInst)) {
|
||||
String front_start_device_code = frontInst.getStart_device_code();
|
||||
Device front_start_device = deviceAppService.findDeviceByCode(front_start_device_code);
|
||||
this.frontWrite(front_start_device, frontInst);
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, backInst);
|
||||
}
|
||||
} else {
|
||||
this.sendPutInfoToPlc(frontInst, backInst);
|
||||
}
|
||||
@@ -1250,7 +1267,10 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
if (front_start_device == null) {
|
||||
return false;
|
||||
}
|
||||
backInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getBackDeviceCodeList, specialGetDevice, specialPutDevice, start_device_code);
|
||||
String getLinkDeviceCode = Optional.ofNullable(front_start_device.getExtraValue().get("getLinkDeviceCode")).map(Object::toString).orElse(null);
|
||||
if (StrUtil.isNotEmpty(getLinkDeviceCode)){
|
||||
backInst = instructionService.findReadyInstBySpecialDeviceAndStartDeviceCode(getBackDeviceCodeList, specialGetDevice, specialPutDevice, start_device_code,getLinkDeviceCode);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List<Instruction> backInsts = instructionService.findReadyInstBySpecialDevice(getBackDeviceCodeList, specialGetDevice, specialPutDevice);
|
||||
|
||||
@@ -52,6 +52,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
|
||||
String reqCode = requestParam.getString("reqCode");
|
||||
// String reqTime = requestParam.getString("reqTime");
|
||||
String currentPositionCode = requestParam.getString("currentPositionCode");
|
||||
String stgBinCode = requestParam.getString("stgBinCode");
|
||||
String robotCode = requestParam.getString("robotCode");
|
||||
String taskCode = requestParam.getString("taskCode");
|
||||
String method = requestParam.getString("method");
|
||||
@@ -68,7 +69,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
|
||||
//修改指令状态执行中并修改CTU车号
|
||||
instruction.setCarno(robotCode);
|
||||
instruction.setInstruction_status(InstructionStatusEnum.BUSY.getIndex());
|
||||
instruction.setExecute_device_code(currentPositionCode);
|
||||
instruction.setExecute_device_code(stgBinCode);
|
||||
instruction.setUpdate_time(now);
|
||||
instructionService.update(instruction);
|
||||
}
|
||||
@@ -76,13 +77,13 @@ public class HkToAcsServiceImpl implements HkToAcsService {
|
||||
else if (StrUtil.equals(method, "end")) {
|
||||
Device device = deviceAppService.findDeviceByCode(instruction.getNext_device_code());
|
||||
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver;
|
||||
if (StrUtil.equals(instruction.getNext_device_code(), currentPositionCode) && device != null && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
if (StrUtil.equals(instruction.getNext_device_code(), stgBinCode) && device != null && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
|
||||
appearanceInspectionScannerConveyorDeviceDriver.writing(ItemProtocol.TO_COMMAND.getKey(), CommandEnum.COMMAND_5.getValue());
|
||||
}
|
||||
//修改指令状态完成
|
||||
instruction.setInstruction_status(InstructionStatusEnum.FINISHED.getIndex());
|
||||
instruction.setExecute_device_code(currentPositionCode);
|
||||
instruction.setExecute_device_code(stgBinCode);
|
||||
instruction.setUpdate_time(now);
|
||||
instructionService.finish(instruction);
|
||||
}
|
||||
@@ -95,7 +96,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
|
||||
}
|
||||
//method 回调4、CTU取料箱申请inApply
|
||||
else if (StrUtil.equals(method, "inApply")) {
|
||||
Device device = deviceAppService.findDeviceByCode(currentPositionCode);
|
||||
Device device = deviceAppService.findDeviceByCode(stgBinCode);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
resp.put("code", "1");
|
||||
resp.put("message", "请求失败,请求位置编号不存在!");
|
||||
@@ -105,7 +106,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
|
||||
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver;
|
||||
//CTU取放货申请
|
||||
//如果请求位置编号与指令起点一致并且是输送线则是取货申请
|
||||
if (StrUtil.equals(instruction.getStart_device_code(), currentPositionCode) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
if (StrUtil.equals(instruction.getStart_device_code(), stgBinCode) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
String ctuWaitTime = Optional.ofNullable(sysParamService.findByCode("ctuWaitTime").getValue()).map(Object::toString).orElse("60");
|
||||
GenPreScheduleTaskReq gpsReq = GenPreScheduleTaskReq.builder()
|
||||
.positionCode(instruction.getStart_device_code())
|
||||
@@ -120,7 +121,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
|
||||
}
|
||||
//method 回调5、CTU放料箱申请outApply
|
||||
else if (StrUtil.equals(method, "outApply")) {
|
||||
Device device = deviceAppService.findDeviceByCode(currentPositionCode);
|
||||
Device device = deviceAppService.findDeviceByCode(stgBinCode);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
resp.put("code", "1");
|
||||
resp.put("message", "请求失败,请求位置编号不存在!");
|
||||
@@ -129,7 +130,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
|
||||
}
|
||||
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver;
|
||||
//如果请求位置编号与指令终点一致并且是输送线则是放货申请
|
||||
if (StrUtil.equals(instruction.getNext_device_code(), currentPositionCode) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
if (StrUtil.equals(instruction.getNext_device_code(), stgBinCode) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
|
||||
if (!appearanceInspectionScannerConveyorDeviceDriver.getReqPutRequireSuccess() && appearanceInspectionScannerConveyorDeviceDriver.getReqPutInstCode() == null) {
|
||||
appearanceInspectionScannerConveyorDeviceDriver.setReqPutRequireSuccess(true);
|
||||
@@ -139,7 +140,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
|
||||
}
|
||||
//method 回调6、CTU取货完成通知
|
||||
else if (StrUtil.equals(method, "inApplyOK")) {
|
||||
Device device = deviceAppService.findDeviceByCode(currentPositionCode);
|
||||
Device device = deviceAppService.findDeviceByCode(stgBinCode);
|
||||
if (ObjectUtil.isEmpty(device)) {
|
||||
resp.put("code", "1");
|
||||
resp.put("message", "请求失败,请求位置编号不存在!");
|
||||
@@ -147,7 +148,7 @@ public class HkToAcsServiceImpl implements HkToAcsService {
|
||||
return resp;
|
||||
}
|
||||
AppearanceInspectionScannerConveyorDeviceDriver appearanceInspectionScannerConveyorDeviceDriver;
|
||||
if (StrUtil.equals(instruction.getStart_device_code(), currentPositionCode) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
if (StrUtil.equals(instruction.getStart_device_code(), stgBinCode) && device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) {
|
||||
appearanceInspectionScannerConveyorDeviceDriver = (AppearanceInspectionScannerConveyorDeviceDriver) device.getDeviceDriver();
|
||||
appearanceInspectionScannerConveyorDeviceDriver.writing(ItemProtocol.TO_COMMAND.getKey(), CommandEnum.COMMAND_3.getValue());
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
|
||||
List<Instruction> findReadyInstBySpecialDevice(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice);
|
||||
|
||||
Instruction findReadyInstBySpecialDeviceAndStartDeviceCode(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice, String front_start_device_code);
|
||||
Instruction findReadyInstBySpecialDeviceAndStartDeviceCode(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice, String front_start_device_code, String getLinkDeviceCode);
|
||||
|
||||
void cancelInstAndTaskNoSendWms(String instruction_id);
|
||||
|
||||
|
||||
@@ -1020,6 +1020,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
instdto.setTask_id(acsTask.getTask_id());
|
||||
instdto.setTask_code(acsTask.getTask_code());
|
||||
instdto.setVehicle_code(acsTask.getVehicle_code());
|
||||
instdto.setVehicle_type(acsTask.getVehicle_type());
|
||||
String now = DateUtil.now();
|
||||
instdto.setCreate_time(now);
|
||||
instdto.setCreate_by(SecurityUtils.getCurrentNickName());
|
||||
@@ -1030,6 +1031,10 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
instdto.setPriority(acsTask.getPriority());
|
||||
instdto.setInstruction_status(InstructionStatusEnum.READY.getIndex());
|
||||
instdto.setExecute_device_code(dto.getNext_device_code());
|
||||
if (StrUtil.equals(instdto.getStart_device_code(),"3204")){
|
||||
instdto.setInstruction_type(InstTypeEnum.CTU_IN_TASK.getCode());
|
||||
instdto.setAgv_system_type(AgvSystemTypeEnum.HK_SYSTEM_TYPE.getCode());
|
||||
}
|
||||
try {
|
||||
this.create(instdto);
|
||||
} catch (Exception e) {
|
||||
@@ -1584,14 +1589,69 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void init(String id) {
|
||||
InstructionDto inst = this.findById(id);
|
||||
Instruction inst = Optional.ofNullable(this.instructions).orElse(new CopyOnWriteArrayList<>())
|
||||
.stream()
|
||||
.filter(instruction -> instruction.getInstruction_id().equals(id))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (inst == null) {
|
||||
throw new BadRequestException("指令不存在或已删除");
|
||||
throw new BadRequestException("指令不存在");
|
||||
}
|
||||
if (InstructionStatusEnum.FINISHED.getIndex().equals(inst.getInstruction_status())) {
|
||||
throw new BadRequestException("指令已经完成");
|
||||
if (!StrUtil.equals(inst.getSend_status(),"2")){
|
||||
throw new BadRequestException("该指令已成功执行,重新下发失败!");
|
||||
}
|
||||
if (StrUtil.equals(inst.getAgv_system_type(),AgvSystemTypeEnum.XG_SYSTEM_TYPE.getCode())){
|
||||
UnifiedResponse<JSONObject> resp = xiangGongAgvService.sendOrderSequencesToXZ(inst);
|
||||
if (!resp.isSuccess()) {
|
||||
inst.setRemark(resp.getMessage());
|
||||
inst.setSend_status("2");
|
||||
} else {
|
||||
inst.setSend_status("1");
|
||||
}
|
||||
} else if (StrUtil.equals(inst.getAgv_system_type(),AgvSystemTypeEnum.HK_SYSTEM_TYPE.getCode())){
|
||||
List<Map<String, String>> positionCodePath = new ArrayList<>();
|
||||
if (StrUtil.equals(InstTypeEnum.CTU_IN_TASK.getCode(), inst.getInstruction_type())) {
|
||||
StorageCell storageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, inst.getNext_point_code()));
|
||||
if (ObjectUtil.isEmpty(storageCell)) {
|
||||
throw new BadRequestException("货位表不存在该点位信息:" + inst.getNext_point_code());
|
||||
}
|
||||
positionCodePath = Arrays.asList(MapOf.of("positionCode", inst.getStart_point_code(), "type", "05"), MapOf.of("positionCode", storageCell.getParent_storage_code(), "type", "05"));
|
||||
} else if (StrUtil.equals(InstTypeEnum.CTU_OUT_TASK.getCode(), inst.getInstruction_type())) {
|
||||
StorageCell storageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, inst.getStart_point_code()));
|
||||
if (ObjectUtil.isEmpty(storageCell)) {
|
||||
throw new BadRequestException("货位表不存在该点位信息:" + inst.getStart_point_code());
|
||||
}
|
||||
positionCodePath = Arrays.asList(MapOf.of("positionCode", storageCell.getParent_storage_code(), "type", "05"), MapOf.of("positionCode", inst.getNext_point_code(), "type", "05"));
|
||||
} else if (StrUtil.equals(InstTypeEnum.CTU_MOVE_TASK.getCode(), inst.getInstruction_type())) {
|
||||
StorageCell startStorageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, inst.getStart_point_code()));
|
||||
if (ObjectUtil.isEmpty(startStorageCell)) {
|
||||
throw new BadRequestException("货位表不存在该点位信息:" + inst.getStart_point_code());
|
||||
}
|
||||
StorageCell nextStorageCell = storageCellService.getOne(new LambdaQueryWrapper<StorageCell>().eq(StorageCell::getStorage_code, inst.getNext_point_code()));
|
||||
if (ObjectUtil.isEmpty(nextStorageCell)) {
|
||||
throw new BadRequestException("货位表不存在该点位信息:" + inst.getNext_point_code());
|
||||
}
|
||||
positionCodePath = Arrays.asList(MapOf.of("positionCode", startStorageCell.getParent_storage_code(), "type", "05"), MapOf.of("positionCode", nextStorageCell.getParent_storage_code(), "type", "05"));
|
||||
}
|
||||
GenAgvSchedulingTaskReq gasReq = GenAgvSchedulingTaskReq
|
||||
.builder()
|
||||
.taskTyp(inst.getInstruction_type())
|
||||
.ctnrTyp(inst.getVehicle_type())
|
||||
.positionCodePath(positionCodePath)
|
||||
.priority(inst.getPriority())
|
||||
.taskCode(inst.getInstruction_code())
|
||||
.build();
|
||||
UnifiedResponse<String> resp = acsToHkService.genAgvSchedulingTask(gasReq, String.class);
|
||||
if (!resp.isSuccess()) {
|
||||
inst.setRemark(resp.getMessage());
|
||||
inst.setSend_status("2");
|
||||
} else {
|
||||
inst.setSend_status("1");
|
||||
}
|
||||
}
|
||||
this.update(inst);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2278,7 +2338,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findReadyInstBySpecialDeviceAndStartDeviceCode(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice, String start_device_code) {
|
||||
public Instruction findReadyInstBySpecialDeviceAndStartDeviceCode(List<String> getDeviceCodeList, List<String> specialGetDevice, List<String> specialPutDevice, String start_device_code, String getLinkDeviceCode) {
|
||||
if (getDeviceCodeList != null && specialGetDevice != null && specialPutDevice != null) {
|
||||
return Optional.ofNullable(this.instructions)
|
||||
.orElse(new CopyOnWriteArrayList<>())
|
||||
@@ -2287,6 +2347,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
.filter(inst -> !inst.getStart_device_code().equals(start_device_code))
|
||||
.filter(inst -> getDeviceCodeList.contains(inst.getStart_device_code()) && specialGetDevice.contains(inst.getStart_device_code()))
|
||||
.filter(inst -> getDeviceCodeList.contains(inst.getNext_device_code()) && specialPutDevice.contains(inst.getNext_device_code()))
|
||||
.filter(inst -> inst.getStart_device_code().equals(getLinkDeviceCode))
|
||||
.sorted(Comparator.comparing(Instruction::getPriority)
|
||||
.thenComparing(inst -> LocalDateTime.parse(inst.getCreate_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))))
|
||||
.findFirst().orElse(null);
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.nl.acs.route.domain.RoutePlan;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.dto.RouteLineDto;
|
||||
import org.nl.acs.route.service.mapper.RoutePlanMapper;
|
||||
import org.nl.acs.task.enums.AgvSystemTypeEnum;
|
||||
import org.nl.acs.task.enums.InstTypeEnum;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.enums.TaskTypeEnum;
|
||||
@@ -739,9 +740,12 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
instdto.setStart_device_code2(start_point_code2);
|
||||
instdto.setNext_device_code2(next_point_code2);
|
||||
instdto.setNext_point_code2(next_point_code2);
|
||||
instdto.setAgv_system_type(agv_system_type);
|
||||
instdto.setAgv_inst_type(CommonFinalParam.ONE);
|
||||
|
||||
instdto.setAgv_system_type(agv_system_type);
|
||||
if (StrUtil.equals(instdto.getNext_device_code(),"3101")){
|
||||
instdto.setAgv_system_type(AgvSystemTypeEnum.HK_SYSTEM_TYPE.getCode());
|
||||
instdto.setInstruction_type(InstTypeEnum.CTU_OUT_TASK.getCode());
|
||||
}
|
||||
instructionservice.create(instdto);
|
||||
|
||||
acsTask.setTask_status(CommonFinalParam.ONE);
|
||||
@@ -1336,7 +1340,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
String type = shortPathsList.get(0).getType();
|
||||
// != 0 为agv任务
|
||||
if (!StrUtil.equals(type, "0")) {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGV_TYPE).getValue(), "3")) {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGV_TYPE).getValue(), "3") && StrUtil.equals(taskDto.getAgv_system_type(),AgvSystemTypeEnum.XG_SYSTEM_TYPE.getCode())) {
|
||||
try {
|
||||
JSONObject reqParam = new JSONObject();
|
||||
reqParam.put("id", taskDto.getTask_code());
|
||||
|
||||
@@ -2,6 +2,6 @@ ENV = 'production'
|
||||
|
||||
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置
|
||||
# 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http
|
||||
VUE_APP_BASE_API = 'http://192.168.1.218:8011'
|
||||
VUE_APP_BASE_API = 'http://192.168.18.218:8011'
|
||||
# 如果接口是 http 形式, wss 需要改为 ws
|
||||
VUE_APP_WS_API = 'http://192.168.1.218:8011'
|
||||
VUE_APP_WS_API = 'http://192.168.18.218:8011'
|
||||
|
||||
@@ -3,7 +3,7 @@ window.g = {
|
||||
VUE_APP_BASE_API: 'http://127.0.0.1:8011'
|
||||
},
|
||||
prod: {
|
||||
VUE_APP_BASE_API: 'http://192.168.1.218:8011'
|
||||
VUE_APP_BASE_API: 'http://192.168.18.218:8011'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export default {
|
||||
'Confirm': '确认',
|
||||
'Cancel': '取消',
|
||||
'Forced_cancellation': '强制取消',
|
||||
'Initialize': '初始化',
|
||||
'Initialize': '重新下发',
|
||||
'Operate': '操作',
|
||||
'Refresh': '刷新',
|
||||
'Closes': '关闭',
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
style="width: 200px"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option v-for="item in dict.task_type" :key="item.id" :label="item.label" :value="item.value" />
|
||||
<el-option v-for="item in dict.instruction_type" :key="item.id" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('task.txt_box.start_or_end')">
|
||||
|
||||
@@ -301,6 +301,9 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('task.select.Description')" prop="description">
|
||||
<el-input v-model="form.remark" style="width: 370px;" type="textarea" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div class="grid-content bg-purple-light" />
|
||||
@@ -405,14 +408,29 @@
|
||||
<el-form-item :label="$t('task.txt_box.Vehicle_number')">
|
||||
<el-input v-model="form.vehicle_code" style="width: 370px;" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
<el-form-item label="载具类型">
|
||||
<el-select
|
||||
v-model="form.vehicle_type"
|
||||
style="width: 370px;"
|
||||
filterable
|
||||
clearable
|
||||
:placeholder="$t('task.select.Placeholder')"
|
||||
@change="isDisabled=false"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.vehicle_type"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<!-- <el-input v-model="form.vehicle_type" style="width: 370px;" @change="isDisabled=false" />-->
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('task.txt_box.extension_field')">
|
||||
<div>
|
||||
<el-button @click="openDialog">{{ $t('task.select.Placeholder') }}</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('task.select.Description')" prop="description">
|
||||
<el-input v-model="form.remark" style="width: 370px;" type="textarea" @change="isDisabled=false" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
@@ -585,7 +603,7 @@ import i18n from '@/i18n'
|
||||
export default {
|
||||
name: 'Task',
|
||||
components: { pagination, crudOperation, rrOperation },
|
||||
dicts: ['task_status', 'task_type', 'agv_system_type', 'storage_task_type', 'kezhuan'],
|
||||
dicts: ['task_status', 'task_type', 'agv_system_type', 'storage_task_type', 'kezhuan', 'vehicle_type'],
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({ title: i18n.t('task.txt_box.Task'), url: 'api/task', idField: 'task_id', sort: 'task_id,desc',
|
||||
|
||||
Reference in New Issue
Block a user