fix: 添加堆垛机,下发信号日志

This commit is contained in:
yanps
2025-02-05 16:13:31 +08:00
parent bd646840ea
commit ae085f825a
7 changed files with 40 additions and 34 deletions

View File

@@ -184,22 +184,24 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
if (ObjectUtil.isEmpty(inst)) { if (ObjectUtil.isEmpty(inst)) {
log.info("未找到指令号{}对应的指令", ikey); log.info("未找到指令号{}对应的指令", ikey);
} else { } else {
String agvcar = inst.getCarno(); if("1".equals(inst.getInstruction_type()) || "2".equals(inst.getInstruction_type()) || "3".equals(inst.getInstruction_type())) {
Device agvDevice = deviceAppService.findDeviceByCode(agvcar); String agvcar = inst.getCarno();
if (agvDevice != null) { Device agvDevice = deviceAppService.findDeviceByCode(agvcar);
if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) { if (agvDevice != null) {
agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver(); if (agvDevice.getDeviceDriver() instanceof AgvNdcTwoDeviceDriver) {
agvNdcTwoDeviceDriver.setInstruction(null); agvNdcTwoDeviceDriver = (AgvNdcTwoDeviceDriver) agvDevice.getDeviceDriver();
agvNdcTwoDeviceDriver.setInstruction(null);
}
} }
inst.setInstruction_status("2");
try {
instructionService.finish(inst);
} catch (Exception e) {
e.printStackTrace();
}
// ndc会向A1和A2都上报反馈任务完成
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} }
inst.setInstruction_status("2");
try {
instructionService.finish(inst);
} catch (Exception e) {
e.printStackTrace();
}
// ndc会向A1和A2都上报反馈任务完成
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} }
} }
//请求删除任务 //请求删除任务

View File

@@ -11,7 +11,7 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
/** /**
* 油漆线 * 纸管库
*/ */
@Service @Service
public class PaperTubeConveyor2Defination implements OpcDeviceDriverDefination { public class PaperTubeConveyor2Defination implements OpcDeviceDriverDefination {

View File

@@ -320,7 +320,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
} }
break; break;
case 3: case 3:
log.info("运行中"); log.info(this.device_code + ",运行中");
break; break;
case 4: case 4:
//申请出货 //申请出货

View File

@@ -39,8 +39,8 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
public void checkcontrol(Map<String, Object> itemValues) throws Exception { public void checkcontrol(Map<String, Object> itemValues) throws Exception {
Group group; Group group;
try { try {
group = opcServerService.getServer(this.getOpcServer()); group = opcServerService.getServer(this.getOpcServer());
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
group = opcServerService.getServer(this.getOpcServer()); group = opcServerService.getServer(this.getOpcServer());
} }
@@ -125,7 +125,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
} }
if (i >= 2) { if (i >= 2) {
log.info("写入次数超过3次而失败"); log.info(itemValues + "写入次数超过3次而失败");
throw new RuntimeException("写入次数超过3次而失败"); throw new RuntimeException("写入次数超过3次而失败");
} }
++i; ++i;

View File

@@ -183,7 +183,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
private int instruction_require_time_out = 3000; private int instruction_require_time_out = 3000;
private int require_apply_mxrk_time_out = 4000; private int require_apply_mxrk_time_out = 4000;
private int require_apply_tprk_time_out = 4000; private int require_apply_tprk_time_out = 4000;
private int require_apply_zjrk_time_out = 4000; private int require_apply_zjrk_time_out = 4000;
private int require_apply_thrk_time_out = 4000; private int require_apply_thrk_time_out = 4000;
//行架机械手申请任务成功标识 //行架机械手申请任务成功标识
boolean requireSucess = false; boolean requireSucess = false;
@@ -349,20 +349,20 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
//申请空托盘入库 //申请空托盘入库
if (mode == 9 && move == 1 && !requireSucess) { if (mode == 9 && move == 1 && !requireSucess) {
if (container_type == 0 || StrUtil.isEmpty(barcode)) { if (container_type == 0 || StrUtil.isEmpty(barcode)) {
message = "托盘类型为空"; message = "托盘类型为空";
} else { } else {
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode);
} }
} }
//申请退货入库 //申请退货入库
if (mode == 18 && move == 1 && !requireSucess) { if (mode == 18 && move == 1 && !requireSucess) {
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) { if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "托盘条码为空或者木箱号为空"; message = "托盘条码为空或者木箱号为空";
} else { } else {
applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode); applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode);
} }
} }
//申请高度 //申请高度
@@ -410,6 +410,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
} }
} catch (Exception e) { } catch (Exception e) {
this.iserror = true; this.iserror = true;
log.error("空指针:{}", e);
String extracted = DeviceErrorUtil.extracted(e); String extracted = DeviceErrorUtil.extracted(e);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
@@ -729,7 +730,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
String body = httpResponse.body(); String body = httpResponse.body();
jsonObject = JSONObject.parseObject(body); jsonObject = JSONObject.parseObject(body);
} }
log.info("wms反馈结果:{}",jsonObject); log.info("wms反馈结果:{}", jsonObject);
message = "木箱、子卷入库申请入库任务,返回参数:" + jsonObject; message = "木箱、子卷入库申请入库任务,返回参数:" + jsonObject;
LuceneLogDto logDto3 = LuceneLogDto.builder() LuceneLogDto logDto3 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
@@ -749,7 +750,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
map.put("code", "to_command"); map.put("code", "to_command");
map.put("value", mode); map.put("value", mode);
list1.add(map); list1.add(map);
log.error("下发电气--------:{}",map); log.error("下发电气--------:{}", map);
this.writing(list1); this.writing(list1);
requireSucess = true; requireSucess = true;
} else { } else {
@@ -799,7 +800,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
String body = httpResponse.body(); String body = httpResponse.body();
jsonObject = JSONObject.parseObject(body); jsonObject = JSONObject.parseObject(body);
} }
log.info("wms反馈结果:{}",jsonObject); log.info("wms反馈结果:{}", jsonObject);
message = "木箱、子卷入库申请入库任务,返回参数:" + jsonObject; message = "木箱、子卷入库申请入库任务,返回参数:" + jsonObject;
LuceneLogDto logDto3 = LuceneLogDto.builder() LuceneLogDto logDto3 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)
@@ -819,7 +820,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
map.put("code", "to_command"); map.put("code", "to_command");
map.put("value", mode); map.put("value", mode);
list1.add(map); list1.add(map);
log.error("下发电气--------:{}",map); log.error("下发电气--------:{}", map);
this.writing(list1); this.writing(list1);
requireSucess = true; requireSucess = true;
} else { } else {

View File

@@ -229,6 +229,7 @@ public class ReturnGoodManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
} catch (Exception e) { } catch (Exception e) {
this.iserror = true; this.iserror = true;
log.error("空指针:{}",e);
String extracted = DeviceErrorUtil.extracted(e); String extracted = DeviceErrorUtil.extracted(e);
LuceneLogDto logDto = LuceneLogDto.builder() LuceneLogDto logDto = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)

View File

@@ -1046,7 +1046,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
"有货或未联机,无法下发指令!指令号:" + inst.getInstruction_code(); "有货或未联机,无法下发指令!指令号:" + inst.getInstruction_code();
return false; return false;
} }
log.info(next_device_code + "设备mode:" + beltConveyorDeviceDriver.getMode() + ",move:" + beltConveyorDeviceDriver.getMove());
} }
List list = new ArrayList(); List list = new ArrayList();
pakageCommand(list, inst.getInstruction_code()); pakageCommand(list, inst.getInstruction_code());
packagePlcCoordinate(startDevice, list, "1"); packagePlcCoordinate(startDevice, list, "1");