opt:富佳项目优化

This commit is contained in:
2025-10-21 17:42:55 +08:00
parent 06b231328c
commit 6405c8492d
4 changed files with 34 additions and 20 deletions

View File

@@ -488,10 +488,6 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
map3.put("code", "to_task");
map3.put("value", inst.getInstruction_code());
list.add(map3);
Map map4 = new HashMap();
map4.put("code", "to_barcode");
map4.put("value", inst.getVehicle_code());
list.add(map4);
beltConveyorDeviceDriver.writing(list);
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
} else {

View File

@@ -169,7 +169,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
String to_taskNum = null;
String last_to_taskNum = null;
Integer outbound_task_num = null;
Integer outbound_task_num = 0;
//子卷条码
String material_barcode = null;
@@ -322,7 +322,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
break;
case 6:
// 更新出库任务数
if (move == 1 && !requireSucess) {
if (move == 0 && !requireSucess) {
synchronized(this) { // 添加同步锁
if (!requireSucess) { // 双重检查锁定
try {
@@ -331,12 +331,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
updateAndSyncOutboundTaskNum(-1, true, true);
Integer result = this.outbound_task_num;
// 更新task的出库完成数
TaskDto taskDto = new TaskDto();
taskDto.setTask_id(instruction.getTask_id());
taskDto.setOutbound_complete_flag(true);
taskserver.updateById(taskDto);
List list1 = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
@@ -349,7 +343,11 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
Map map3 = new HashMap();
map3.put("code", "to_target");//下发出库楼层
map3.put("value", "0");
list1.add(map);
list1.add(map3);
Map map4 = new HashMap();
map4.put("code", "to_task");//下发出库楼层
map4.put("value", "0");
list1.add(map4);
this.writing(list1);
// 只有成功后才设置标记
@@ -549,10 +547,13 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
return true;
}
public synchronized Integer updateOutboundTaskNum(Integer num,Boolean addFlag) throws Exception {
if(addFlag) {
public synchronized Integer updateOutboundTaskNum(Integer num, Boolean addFlag) throws Exception {
if (addFlag) {
this.outbound_task_num = this.outbound_task_num + num;
} else{
if (this.outbound_task_num < 0) {
return 0;
}
} else {
this.outbound_task_num = num;
}
return this.outbound_task_num;

View File

@@ -459,10 +459,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
dto.setInstruction_type(task.getTask_type());
}
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
try {
/*String start_device_code = dto.getStart_device_code();*/
String next_device_code = dto.getNext_device_code();
@@ -520,6 +518,16 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
}
}
if (startdevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startdevice.getDeviceDriver();
List list1 = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
map.put("value", 5);
list1.add(map);
beltConveyorDeviceDriver.writing(list1);
}
}
@@ -623,7 +631,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
// dto.setInstruction_type(task.getTask_type());
// }
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
Device startdevice = appService.findDeviceByCode(dto.getStart_device_code());
@@ -709,6 +717,15 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
}
}
}
if (startdevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) startdevice.getDeviceDriver();
List list1 = new ArrayList();
Map map = new HashMap();
map.put("code", "to_command");
map.put("value", 5);
list1.add(map);
beltConveyorDeviceDriver.writing(list1);
}
}
@Override

View File

@@ -212,7 +212,7 @@ public class BmVehicleRfidServiceImpl extends ServiceImpl<BmVehicleRfidMapper, B
}
}
}
else if(!"heart_beat".equals(params.getEvent_type())) {
else if("heart_beat".equals(params.getEvent_type())) {
update(new UpdateWrapper<BmVehicleRfid>().set("rfid", null).eq("device_code", params.getReader_name()));
}
return true;