fix : 行架对接位,强制放行自动流程
This commit is contained in:
@@ -250,10 +250,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
}
|
||||
|
||||
if (move != 0 && task > 0) {
|
||||
if (null != inst) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||
vehicle_code2 = inst.getVehicle_code2();
|
||||
}
|
||||
CompletableFuture.runAsync(() -> {
|
||||
// 异步更新指令状态
|
||||
try {
|
||||
@@ -262,6 +258,10 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
if (null != inst) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||
vehicle_code2 = inst.getVehicle_code2();
|
||||
}
|
||||
}
|
||||
//申请空托盘出库
|
||||
if (mode == 8 && !requireSucess) {
|
||||
@@ -684,7 +684,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
private boolean updateTask(TaskDto taskdto, Device nextdevice, Instruction instdto) {
|
||||
taskdto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskserver.update(taskdto);
|
||||
requireSucess = true;
|
||||
String next_addr = nextdevice.getExtraValue().get("address").toString();
|
||||
String interactionJson = taskdto.getInteraction_json();
|
||||
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
|
||||
|
||||
@@ -192,10 +192,10 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
|
||||
if (move != 0 && task > 0) {
|
||||
update_instruction_status();
|
||||
if (null != inst) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||
}
|
||||
update_instruction_status();
|
||||
}
|
||||
if (move != last_move && move == 0 && last_move == 1 && mode > 0) {
|
||||
requireSucess = false;
|
||||
|
||||
@@ -194,11 +194,11 @@ public class BoxSubvolumesConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
requireSucess = false;
|
||||
}
|
||||
if (move != 0 && task > 0) {
|
||||
update_instruction_status();
|
||||
if (null != inst) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||
vehicle_code2 = inst.getVehicle_code2();
|
||||
}
|
||||
update_instruction_status();
|
||||
}
|
||||
|
||||
if (move != last_move && move == 0 && last_move == 1 && mode > 0) {
|
||||
|
||||
@@ -325,8 +325,8 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
|
||||
//申请退货入库
|
||||
if (mode == 18 && move == 1 && !requireSucess) {
|
||||
if (StrUtil.isEmpty(barcode)) {
|
||||
message = "托盘条码为空";
|
||||
if (StrUtil.isEmpty(barcode)|| StrUtil.isEmpty(material_barcode)) {
|
||||
message = "托盘条码为空或者木箱号为空";
|
||||
} else {
|
||||
applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode);
|
||||
}
|
||||
@@ -335,7 +335,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
//申请高度
|
||||
if (mode == 23 && !requireSucess) {
|
||||
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
|
||||
message = "条码为空";
|
||||
message = "托盘条码为空或者木箱号为空";
|
||||
} else {
|
||||
applyErrorHeight();
|
||||
}
|
||||
@@ -737,10 +737,6 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
* 更新指令状态
|
||||
*/
|
||||
public synchronized void update_instruction_status() throws Exception {
|
||||
if (null != inst) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||
vehicle_code2 = inst.getVehicle_code2();
|
||||
}
|
||||
Date date = new Date();
|
||||
if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) {
|
||||
log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out);
|
||||
|
||||
@@ -189,10 +189,10 @@ public class BoxPackageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
// 更新指令状态
|
||||
if (mode == 3 && task > 0) {
|
||||
updateInstrction();
|
||||
if (null!=inst) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||
}
|
||||
updateInstrction();
|
||||
}
|
||||
if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
|
||||
@@ -159,10 +159,10 @@ public class BoxStorageManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
}
|
||||
// 更新指令状态
|
||||
if (mode == 3 && task > 0 && !requireActionSucess) {
|
||||
updateInstructionStatus();
|
||||
if (null!=inst) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||
}
|
||||
updateInstructionStatus();
|
||||
}
|
||||
if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
|
||||
@@ -172,10 +172,10 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
// 更新指令状态
|
||||
if (mode == 3 && task > 0) {
|
||||
updateInstructionStatus();
|
||||
if (null!=inst) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||
}
|
||||
updateInstructionStatus();
|
||||
}
|
||||
if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
@@ -273,17 +273,17 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
|
||||
//放货完成
|
||||
if (action == 4 && move == 0) {
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 5);
|
||||
list.add(map1);
|
||||
this.writing(list);
|
||||
message = "universal_message1";
|
||||
if (inst != null) {
|
||||
try {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "放货完成");
|
||||
finish_instruction(inst);
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
List list = new ArrayList();
|
||||
map1.put("code", "to_command");
|
||||
map1.put("value", 5);
|
||||
list.add(map1);
|
||||
this.writing(list);
|
||||
message = "universal_message1";
|
||||
} catch (Exception e) {
|
||||
message = "universal_message2";
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -19,6 +19,8 @@ import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.conveyor.belt_conveyor.BeltConveyorDeviceDriver;
|
||||
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.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
import org.nl.acs.history.service.DeviceErrorLogService;
|
||||
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
|
||||
@@ -31,7 +33,6 @@ import org.nl.acs.opc.DeviceAppServiceImpl;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.route.service.impl.RouteLineServiceImpl;
|
||||
import org.nl.acs.task.enums.TaskStatusEnum;
|
||||
import org.nl.acs.task.enums.TaskTypeEnum;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.acs.task.service.dto.TaskDto;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
@@ -43,7 +44,6 @@ import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 捆扎智能行架
|
||||
@@ -70,6 +70,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
|
||||
DeviceErrorLogService errorLogServer = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
|
||||
int mode = 0;
|
||||
int last_mode = 0;
|
||||
@@ -166,10 +167,10 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
|
||||
}
|
||||
// 更新指令状态
|
||||
if (mode == 3 && task > 0) {
|
||||
updateInstructionStatus();
|
||||
if (null != inst) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||
}
|
||||
updateInstructionStatus();
|
||||
}
|
||||
if (mode == 0) {
|
||||
this.setIsonline(false);
|
||||
@@ -409,6 +410,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
taskDto = dto;
|
||||
}else {
|
||||
forceMove(nextDevice);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("当前任务号:" + dto.getTask_code() + " " + next_device_code + "当前move值为:" + beltConveyorDeviceDriverEnd.getMove() + ",当前mode值为:"+beltConveyorDeviceDriverEnd.getMode())
|
||||
@@ -465,7 +467,6 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
|
||||
//创建指令后修改任务状态
|
||||
taskDto.setTask_status(TaskStatusEnum.BUSY.getIndex());
|
||||
taskserver.update(taskDto);
|
||||
requireSucess = true;
|
||||
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
@@ -487,6 +488,7 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
|
||||
.build();
|
||||
logDto.setLog_level(2);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
return false;
|
||||
}
|
||||
this.setRequireSucess(true);
|
||||
return true;
|
||||
@@ -498,6 +500,47 @@ public class TrappedManipulatorManipulatorDeviceDriver extends AbstractOpcDevice
|
||||
}
|
||||
}
|
||||
|
||||
private void forceMove( Device nextDevice) {
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriverNext;
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriverLink;
|
||||
beltConveyorDeviceDriverNext = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
if (beltConveyorDeviceDriverNext.getMode() == 3) {
|
||||
List<String> deviceCodes = beltConveyorDeviceDriverNext.getExtraDeviceCodes("link_device_code");
|
||||
if (ObjectUtil.isNotEmpty(deviceCodes)) {
|
||||
Device linkDevice = deviceAppService.findDeviceByCode(deviceCodes.get(0));
|
||||
if (linkDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
beltConveyorDeviceDriverLink = (BeltConveyorDeviceDriver) linkDevice.getDeviceDriver();
|
||||
if (beltConveyorDeviceDriverLink.getMove() == 1 && beltConveyorDeviceDriverLink.getMode() == 2) {
|
||||
//查看是否存在到2022的行架任务
|
||||
Instruction byStartCodeAndReadyAndRun = instructionService.findByNextCodeAndReadyAndRun(deviceCodes.get(0));
|
||||
//申请上位强制离开
|
||||
if (ObjectUtil.isEmpty(byStartCodeAndReadyAndRun)) {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("deviceCode", deviceCodes.get(0));
|
||||
String response = acsToWmsService.forceMove(param);
|
||||
JSONObject jo = JSON.parseObject(response);
|
||||
if (jo.getInteger("code") == 200) {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("强行离开,参数,接口返回:" + jo)
|
||||
.build();
|
||||
logDto2.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto2);
|
||||
}
|
||||
}else {
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("无法强制离开,存在到CK2022的行架任务"+byStartCodeAndReadyAndRun.getInstruction_code())
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void pushPLC(Map<String, Object> map1, Map<String, Object> map2, String next_addr, Map<String, Object> map3, String start_addr, Map<String, Object> map4, String task, InteractionJsonDTO interactionJsonDTO, Map<String, Object> map5, Map<String, Object> map6, Map<String, Object> map7, Map<String, Object> map8, Map<String, Object> map9, Map<String, Object> map10, Map<String, Object> map11, String vehicleCode) {
|
||||
|
||||
|
||||
@@ -194,10 +194,10 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
||||
}
|
||||
// 更新指令状态
|
||||
if (mode == 3 && task > 0) {
|
||||
updateInstructionStatus();
|
||||
if (null!=inst) {
|
||||
inst_message = "指令号:" + inst.getInstruction_code() + " " + inst.getStart_point_code() + "->" + inst.getNext_point_code();
|
||||
}
|
||||
updateInstructionStatus();
|
||||
}
|
||||
//四个点行架任务,满轴放货完成后调lms生成rgv任务
|
||||
if (action == 6 && task > 0 && !actionRequireSucess ){
|
||||
|
||||
@@ -216,4 +216,6 @@ public interface AcsToWmsService {
|
||||
* @param jsonObject
|
||||
*/
|
||||
void actionFinishRequest2(JSONObject jsonObject);
|
||||
|
||||
String forceMove(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -747,6 +747,48 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String forceMove(JSONObject param) {
|
||||
try {
|
||||
MDC.put(log_file_type, log_type);
|
||||
log.info("forceMove-----输入参数{}", param);
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("forceMove");
|
||||
String url = wmsurl + addressDto.getMethods_url();
|
||||
HttpResponse result2 = null;
|
||||
try {
|
||||
result2 = HttpRequest.post(url)
|
||||
.addInterceptor(tLogHutoolhttpInterceptor)
|
||||
.header(Header.USER_AGENT, "Hutool http")
|
||||
.header("Authorization", token)
|
||||
.body(String.valueOf(param))
|
||||
.execute();
|
||||
} catch (Exception e) {
|
||||
String msg = e.getMessage();
|
||||
log.info("forceMove-----输出参数{}", msg);
|
||||
//网络不通
|
||||
}
|
||||
if(ObjectUtil.isEmpty(result2)){
|
||||
log.info("forceMove-----输出参数{}", "返回结果为空");
|
||||
return null;
|
||||
}
|
||||
String type = "";
|
||||
if (result2.getStatus() == 200) {
|
||||
type = "info";
|
||||
} else {
|
||||
type = "error";
|
||||
}
|
||||
log.info("forceMove-----输出参数{}", result2.body());
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(4,"forceMove", String.valueOf(result2.getStatus()),
|
||||
JSON.toJSONString(param), String.valueOf(result2.body()), "追加诺宝动作块");
|
||||
luceneLogService.interfaceExecuteLog(luceneLogDto);
|
||||
return result2.body();
|
||||
|
||||
} finally {
|
||||
MDC.remove(log_file_type);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void actionFinishRequest2(JSONObject jsonObject) {
|
||||
HttpResponse execute = null;
|
||||
|
||||
@@ -772,6 +772,9 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
//拆叠盘位
|
||||
FoldDiscSiteDeviceDriver foldDiscSiteDeviceDriver;
|
||||
|
||||
//标准版输送线
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
||||
|
||||
//气胀轴缓存库
|
||||
InflatableShaftLibraryDeviceDriver inflatableShaftLibraryDeviceDriver;
|
||||
|
||||
@@ -932,7 +935,12 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||
jo.put("qty", inflatableShaftLibraryDeviceDriver.getQty());
|
||||
jo.put("error", inflatableShaftLibraryDeviceDriver.getError());
|
||||
jo.put("type", inflatableShaftLibraryDeviceDriver.getError());
|
||||
} else {
|
||||
} else if (device.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) device.getDeviceDriver();
|
||||
jo.put("move", beltConveyorDeviceDriver.getMove());
|
||||
jo.put("mode", beltConveyorDeviceDriver.getMode());
|
||||
jo.put("device_code", parent_device_code);
|
||||
}else {
|
||||
jo.put("device_code", parent_device_code);
|
||||
}
|
||||
backja.add(jo);
|
||||
|
||||
@@ -334,6 +334,12 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
*/
|
||||
Instruction findByDeviceCodeFromCache(String devicecode);
|
||||
|
||||
/**
|
||||
* 查找起点是否有就绪或者执行中的指令
|
||||
*/
|
||||
|
||||
Instruction findByNextCodeAndReadyAndRun(String device_code);
|
||||
|
||||
/**
|
||||
* 根据起点设备编号查询当前是否有就绪指令
|
||||
*
|
||||
|
||||
@@ -1874,6 +1874,15 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
return optionalInstruction.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findByNextCodeAndReadyAndRun(String device_code) {
|
||||
Optional<Instruction> optionalInstruction = instructions.stream()
|
||||
.filter(instruction -> StrUtil.equals(instruction.getNext_device_code(), device_code)
|
||||
&& (StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) || StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.BUSY.getIndex())))
|
||||
.findFirst();
|
||||
return optionalInstruction.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Instruction findByEndCodeAndReady(String device_code) {
|
||||
Optional<Instruction> optionalInstruction = instructions.stream()
|
||||
|
||||
Reference in New Issue
Block a user