add:優化新增需求;
This commit is contained in:
@@ -14,6 +14,10 @@ public interface AcsConfig {
|
||||
String FEISHUSENDTIME = "feiShuSendTime";
|
||||
//飞书发送频次(分钟)
|
||||
String FEISHUSENDFRE = "feiShuSendFre";
|
||||
//飞书发送报警地址1
|
||||
String FEISHUURL1 = "feiShuUrl1";
|
||||
//飞书发送报警地址2
|
||||
String FEISHUURL2 = "feiShuUrl2";
|
||||
//同一任务创建最大指令数
|
||||
String MAXINSTNUMBER = "maxInstNumber";
|
||||
//同一任务创建最大RT车指令数
|
||||
|
||||
@@ -105,6 +105,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
*/
|
||||
private volatile String feiShuSendTime = "8:00-22:00";
|
||||
private volatile String feiShuSendFre = "2";
|
||||
private volatile String feiShuUrl1 = "https://open.feishu.cn/open-apis/bot/v2/hook/c3fcb100-72e0-48e6-bdf6-e266e67858a1";
|
||||
private volatile String feiShuUrl2 = "https://open.feishu.cn/open-apis/bot/v2/hook/c3fcb100-72e0-48e6-bdf6-e266e67858a1";
|
||||
private volatile long lastParamLoadTime = 0;
|
||||
private static final long PARAM_CACHE_TIMEOUT = 600000; // 参数缓存超时时间:600秒
|
||||
private static final long FEI_SHU_ERROR_CACHE_TIMEOUT = 5 * 60 * 1000; // 飞书报警缓存过期时间:5分钟
|
||||
@@ -459,8 +461,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
post.put("zh_cn", zh_cn);
|
||||
content.put("post", post);
|
||||
requestBody.put("content", content);
|
||||
String feiShuUrl1 = "https://open.feishu.cn/open-apis/bot/v2/hook/c3fcb100-72e0-48e6-bdf6-e266e67858a1";
|
||||
String feiShuUrl2 = "https://open.feishu.cn/open-apis/bot/v2/hook/c3fcb100-72e0-48e6-bdf6-e266e67858a2";
|
||||
loadTaskCountParamsIfNeeded();
|
||||
// 5. 发送 HTTP 请求到飞书机器人(首次~第5次仅推送到feiShuUrl1,第6次起同时推送到feiShuUrl1和feiShuUrl2)
|
||||
boolean pushToBoth = record.getPushCount() >= 5;
|
||||
String response1 = HttpRequest.post(feiShuUrl1)
|
||||
@@ -506,6 +507,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
String feiShuSendTimeResult = paramService.findByCode(AcsConfig.FEISHUSENDTIME).getValue();
|
||||
String feiShuSendFreResult = paramService.findByCode(AcsConfig.FEISHUSENDFRE).getValue();
|
||||
String feiShuUrl1Result = paramService.findByCode(AcsConfig.FEISHUURL1).getValue();
|
||||
String feiShuUrl2Result = paramService.findByCode(AcsConfig.FEISHUURL2).getValue();
|
||||
// 更新缓存值
|
||||
if (StringUtils.isNotBlank(feiShuSendTimeResult)) {
|
||||
this.feiShuSendTime = feiShuSendTimeResult;
|
||||
@@ -513,6 +516,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
if (StringUtils.isNotBlank(feiShuSendFreResult)) {
|
||||
this.feiShuSendFre = feiShuSendFreResult;
|
||||
}
|
||||
if (StringUtils.isNotBlank(feiShuUrl1Result)) {
|
||||
this.feiShuUrl1 = feiShuUrl1Result;
|
||||
}
|
||||
if (StringUtils.isNotBlank(feiShuUrl2Result)) {
|
||||
this.feiShuUrl2 = feiShuUrl2Result;
|
||||
}
|
||||
this.lastParamLoadTime = System.currentTimeMillis();
|
||||
} catch (Exception e) {
|
||||
log.error("加载任务数量参数失败,使用缓存值", e);
|
||||
|
||||
@@ -1065,7 +1065,7 @@ public class TaskServiceImpl extends CommonServiceImpl<TaskMapper, Task> impleme
|
||||
// 分组指令
|
||||
for (InstructionMybatis instruction : unfinishedList) {
|
||||
String deviceCode = instruction.getStart_device_code();
|
||||
if (deviceCode != null && (deviceCode.contains("BCPRK") || deviceCode.contains("CPRK"))) {
|
||||
if (deviceCode != null && (deviceCode.contains("BCPRK") || deviceCode.contains("CPRK"))&&!instruction.getInstruction_status().equals(InstructionStatusEnum.PICKUP.getIndex())) {
|
||||
collection.add(instruction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,8 +76,12 @@ public class AutoCreateInst {
|
||||
.list();
|
||||
//2个车型各创建的任务数
|
||||
if (ObjectUtil.isNotEmpty(instructionList)) {
|
||||
rtInstNum = Math.toIntExact(instructionList.stream().filter(r -> "2".equals(r.getCar_type())).count());
|
||||
psInstNum = instructionList.size() - rtInstNum;
|
||||
//不包含入库任务的数量限制
|
||||
psInstNum = Math.toIntExact(instructionList.stream().filter(r -> "1".equals(r.getCar_type())
|
||||
&& !r.getStart_device_code().contains("BCPRK")
|
||||
&& !r.getStart_device_code().contains("CPRK")).count());
|
||||
int psInstNums = Math.toIntExact(instructionList.stream().filter(r -> "1".equals(r.getCar_type())).count());
|
||||
rtInstNum = instructionList.size() - psInstNums;
|
||||
}
|
||||
maxRtnst = Math.max(0, maxRtnst - rtInstNum);
|
||||
maxPsInst = Math.max(0, maxPsInst - psInstNum);
|
||||
@@ -118,12 +122,15 @@ public class AutoCreateInst {
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
//型上限检查
|
||||
//车型上限检查
|
||||
boolean reachLimit = false;
|
||||
if ("2".equals(car_type) && rtCreatedCount >= maxRtNum) {
|
||||
reachLimit = true;
|
||||
} else if (!"2".equals(car_type) && psCreatedCount >= maxPsNum) {
|
||||
reachLimit = true;
|
||||
//入库任务无需任务上限校验
|
||||
if (!isStartTask) {
|
||||
if ("2".equals(car_type) && rtCreatedCount >= maxRtNum) {
|
||||
reachLimit = true;
|
||||
} else if (!"2".equals(car_type) && psCreatedCount >= maxPsNum) {
|
||||
reachLimit = true;
|
||||
}
|
||||
}
|
||||
if (reachLimit) {
|
||||
iterator.remove();
|
||||
@@ -144,7 +151,7 @@ public class AutoCreateInst {
|
||||
.eq(InstructionMybatis::getIs_delete, "0")
|
||||
.list();
|
||||
//将执行中的任务也加入指令列表参与起点校验
|
||||
List<TaskDto> executingTasks = taskserver.queryAllByStatus("1");
|
||||
List<TaskDto> executingTasks = taskserver.queryAllByStatus(TaskStatusEnum.BUSY.getIndex());
|
||||
if (CollectionUtils.isNotEmpty(executingTasks)) {
|
||||
// 收集已有指令中的起始点,避免重复
|
||||
Set<String> existingStartPoints = activeInstructions.stream()
|
||||
@@ -249,7 +256,7 @@ public class AutoCreateInst {
|
||||
String code = r.getStart_device_code();
|
||||
if (code == null) return false;
|
||||
String[] parts = code.split("-", 2);
|
||||
return targetPoint.equals(parts[0]);
|
||||
return targetPoint.contains(parts[0]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user