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