修正
This commit is contained in:
parent
1a33acc5fa
commit
3ab5b1af0b
|
|
@ -25,6 +25,6 @@ public class DataClearExecutor implements Job {
|
|||
// 删除日志数据
|
||||
wmsJobService.deleteLogsRegularly();
|
||||
// 删除记录数据
|
||||
wmsJobService.deleteRecordsRegularly();
|
||||
// wmsJobService.deleteRecordsRegularly();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -710,12 +710,12 @@ public class WmsJobServiceImplements implements IWmsJobService {
|
|||
int interval = 180;// 普通接口记录默认保留180天
|
||||
int importantInterval = 365;// 重要接口记录默认保留一年
|
||||
try {
|
||||
interval = Integer.parseInt(configMap.get(ConfigMapKeyEnum.LOG_DELETE_INTERVAL.getConfigKey()));
|
||||
interval = Integer.parseInt(configMap.get(ConfigMapKeyEnum.RECORD_DELETE_INTERVAL.getConfigKey()));
|
||||
} catch (Exception e) {
|
||||
logger.error("获取普通记录清理天数错误,使用默认值180天");
|
||||
}
|
||||
try {
|
||||
importantInterval = Integer.parseInt(configMap.get(ConfigMapKeyEnum.LOG_DELETE_INTERVAL.getConfigKey()));
|
||||
importantInterval = Integer.parseInt(configMap.get(ConfigMapKeyEnum.IMPORTANT_RECORD_DELETE_INTERVAL.getConfigKey()));
|
||||
} catch (Exception e) {
|
||||
logger.error("获取重要记录清理天数错误,使用默认值365天");
|
||||
}
|
||||
|
|
@ -938,7 +938,7 @@ public class WmsJobServiceImplements implements IWmsJobService {
|
|||
// 判断数据行是不是过多
|
||||
int rowCount = list.size();
|
||||
// 每50万行一个文件
|
||||
int rowCountPerFile = 300000;
|
||||
int rowCountPerFile = 100000;
|
||||
int fileCounts = (rowCount + rowCountPerFile - 1) / rowCountPerFile;
|
||||
for (int i = 1; i <= fileCounts; i++) {
|
||||
List<T> dividedList = list.subList((i - 1) * rowCountPerFile, Math.min(i * rowCountPerFile, rowCount));
|
||||
|
|
@ -1280,22 +1280,29 @@ public class WmsJobServiceImplements implements IWmsJobService {
|
|||
// .max(Comparator.comparingInt(Map.Entry::getValue))
|
||||
// .map(Map.Entry::getKey)
|
||||
// .orElse("");
|
||||
// new 查找已下发状态以上最少箱子的站台
|
||||
String standId = standPickCountsMap.entrySet().stream()
|
||||
.min(Comparator.comparingInt(Map.Entry::getValue))
|
||||
.map(Map.Entry::getKey)
|
||||
.orElse("");
|
||||
|
||||
// 查找这个站台未下发的料箱
|
||||
List<String> vehicleIds = standPickTasks.stream()
|
||||
.filter(pickTask -> pickTask.getPickStatus().equals(PickTaskStatusEnum.TEMP.getCode())
|
||||
&& thisStackerVehicleIds.contains(pickTask.getVehicleId()) && standId.equals(pickTask.getStandId()))
|
||||
.map(PickTask::getVehicleId)
|
||||
.distinct()
|
||||
.toList();
|
||||
if (vehicleIds.isEmpty()) {
|
||||
// 对这些站台进行排序,从少到多
|
||||
List<String> standIds = standPickCountsMap.entrySet().stream()
|
||||
.sorted(Comparator.comparingInt(Map.Entry::getValue))
|
||||
.map(Map.Entry::getKey).toList();
|
||||
List<String> minStandVehicleIds = new ArrayList<>();
|
||||
String minStandId = "";
|
||||
for (String standId : standIds) {
|
||||
// 查找这个站台未下发的料箱
|
||||
minStandVehicleIds = standPickTasks.stream()
|
||||
.filter(pickTask -> pickTask.getPickStatus().equals(PickTaskStatusEnum.TEMP.getCode())
|
||||
&& thisStackerVehicleIds.contains(pickTask.getVehicleId()) && standId.equals(pickTask.getStandId()))
|
||||
.map(PickTask::getVehicleId)
|
||||
.distinct()
|
||||
.toList();
|
||||
if (!minStandVehicleIds.isEmpty()) {
|
||||
minStandId = standId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (minStandVehicleIds.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
List<String> vehicleIds = minStandVehicleIds;
|
||||
// 生成箱子-站台数量的Map
|
||||
Map<String, Integer> vehicleStandsMap = new HashMap<>();
|
||||
standPickTasks.forEach(pickTask -> {
|
||||
|
|
@ -1342,7 +1349,7 @@ public class WmsJobServiceImplements implements IWmsJobService {
|
|||
// 添加特殊任务
|
||||
newStandStackerTask.setVehicleId(task.getVehicleId());
|
||||
newStandStackerTask.setStackerId(stacker.getEquipmentId());
|
||||
newStandStackerTask.setStandId(standId);
|
||||
newStandStackerTask.setStandId(minStandId);
|
||||
newStandStackerTask.setTaskType(2);
|
||||
newStandStackerTask.setTaskStatus(0);
|
||||
newStandStackerTask.setCreateTime(LocalDateTime.now());
|
||||
|
|
@ -1354,7 +1361,7 @@ public class WmsJobServiceImplements implements IWmsJobService {
|
|||
// 已经发送过的vehicleId
|
||||
pickVehicleIds.add(vehicleId);
|
||||
availNum--;
|
||||
standPickCountsMap.put(standId, standPickCountsMap.get(standId) + 1);
|
||||
standPickCountsMap.put(minStandId, standPickCountsMap.getOrDefault(minStandId, 0) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1364,6 +1371,7 @@ public class WmsJobServiceImplements implements IWmsJobService {
|
|||
// 没有新任务发送
|
||||
return;
|
||||
}
|
||||
// 下面这行代码模拟wcs下发成功
|
||||
// simulateSendPickOutTasks(taskGroupIds, pickVehicleIds, needAddStandStackerTasks, needRemoveStandStackerTasks);
|
||||
// 发送任务
|
||||
String url = configMap.get(ConfigMapKeyEnum.URL_WCS_TASK.getConfigKey());
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public class JobServiceImpl implements IJobService {
|
|||
jobBeans.add(new JobBean("PickOutTaskSender", PickOutTaskSender.class, "0/2 * * * * ?", 2000, JobTimerTypeEnums.SIMPLE.getType(), 1));
|
||||
// jobBeans.add(new JobBean("KateWorkExecutor", KateWorkExecutor.class, "0/20 * * * * ?", 20000, JobTimerTypeEnums.SIMPLE.getType(), 1));
|
||||
jobBeans.add(new JobBean("KateWorkExecutor", KateWorkExecutor.class, "0 0 * * * ?", 20000, JobTimerTypeEnums.SIMPLE.getType(), 1));
|
||||
jobBeans.add(new JobBean("DataClearExecutor", DataClearExecutor.class, "0 0 3 * * ?", 2000, JobTimerTypeEnums.CRON.getType(), 1));
|
||||
jobBeans.add(new JobBean("DataClearExecutor", DataClearExecutor.class, "0 0 23 * * ?", 2000, JobTimerTypeEnums.CRON.getType(), 1));
|
||||
for (JobBean jobBean : jobBeans) {
|
||||
createJob(jobBean);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user