opt:任务数优化

This commit is contained in:
2025-09-16 16:27:19 +08:00
parent 038b5ba0da
commit c29cbbbaef
6 changed files with 27 additions and 10 deletions

View File

@@ -436,6 +436,11 @@
<artifactId>poi-ooxml-schemas</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>com.reader</groupId>
<artifactId>reader</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
@@ -463,6 +468,7 @@
<configuration>
<mainClass>org.nl.AppRun</mainClass>
<fork>true</fork> <!-- 如果没有该配置devtools不会生效 -->
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>

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;
//子卷条码
String material_barcode = null;
@@ -329,12 +329,14 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
// 1. 查询设备
Device device = deviceAppService.findDeviceByCode(device_code);
Integer result = updateOutboundTaskNum(-1,true);
// 2. 更新任务数
device.setOutbound_task_num(device.getOutbound_task_num() - 1);
device.setOutbound_task_num(result);
// 3. 保存更新(假设需要显式保存)
deviceservice.update(new UpdateWrapper<Device>()
.set("outbound_task_num",device.getOutbound_task_num())
.set("outbound_task_num",result)
.eq("device_code",device.getDevice_code()));
// 更新task的出库完成数
@@ -350,7 +352,7 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
list1.add(map);
Map map2 = new HashMap();
map2.put("code", "to_taskNum");//下发出库数
map2.put("value", device.getOutbound_task_num());
map2.put("value", result);
this.writing(list1);
// 5. 只有成功后才设置标记
@@ -431,7 +433,6 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
// luceneExecuteLogService.deviceExecuteLog(logDto);
// }
/**
* 申请任务
*/
@@ -549,6 +550,15 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
return true;
}
public synchronized Integer updateOutboundTaskNum(Integer num,Boolean addFlag) throws Exception {
if(addFlag) {
this.outbound_task_num = this.outbound_task_num + num;
} else{
this.outbound_task_num = num;
}
return this.outbound_task_num;
}
@Override
public JSONObject getDeviceStatusName() {
JSONObject jo = new JSONObject();

View File

@@ -1929,8 +1929,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
public int queryInstructionCount(String deviceCode) {
List<Instruction> instructionsList = instructions.stream()
.filter(item -> StrUtil.equals(item.getNext_device_code(), deviceCode)
&& StrUtil.equals(item.getInstruction_status(), TaskStatusEnum.READY.getIndex())
&& StrUtil.equals(item.getInstruction_status(), TaskStatusEnum.BUSY.getIndex())).collect(Collectors.toList());
&& (StrUtil.equals(item.getInstruction_status(), TaskStatusEnum.READY.getIndex())
|| StrUtil.equals(item.getInstruction_status(), TaskStatusEnum.BUSY.getIndex()))).collect(Collectors.toList());
return instructionsList.size();
}

View File

@@ -198,6 +198,7 @@ public class AutoCreateInst {
if (beltConveyorDeviceDriver.getType() == 2) {
//因为已经创建成功,因此这个时候可以+1了
int count = instructionService.queryInstructionCount(next_device_code);
beltConveyorDeviceDriver.updateOutboundTaskNum(count,false);
beltConveyorDeviceDriver.writing("to_taskNum", count + "");
nextdevice.setOutbound_task_num(count);
}

View File

@@ -2,6 +2,6 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl需要将 https 改为 http
VUE_APP_BASE_API = 'http://192.168.229.70:8011'
VUE_APP_BASE_API = 'http://172.19.10.71:8011'
# 如果接口是 http 形式, wss 需要改为 ws
VUE_APP_WS_API = 'ws://192.168.229.70:8011'
VUE_APP_WS_API = 'ws://172.19.10.71:8011'

View File

@@ -3,7 +3,7 @@ window.g = {
VUE_APP_BASE_API: 'http://127.0.0.1:8011'
},
prod: {
VUE_APP_BASE_API: 'http://192.168.229.70:8011'
VUE_APP_BASE_API: 'http://172.19.10.71:8011'
}
}