demand: 漏组批次相关需求

committer: heyu
This commit is contained in:
aike 2025-11-27 13:36:41 +08:00
parent 0ddf1b729d
commit b2a54a420b
3 changed files with 10 additions and 42 deletions

View File

@ -981,28 +981,14 @@ public class EmisCommonController extends EmisBaseController
log.info("Found {} unique line codes, starting batch processing", lineCodeSet.size());
// 循环调用,最后一个才清除状态
int index = 0;
int totalSize = lineCodeSet.size();
// 循环调用
for (String code : lineCodeSet) {
try {
index++;
// 最后一个lineCode才清除状态
boolean clearStatus = (index == totalSize);
emisTmsSiteBatchMissService.autoScanSiteBatch(code, clearStatus);
log.info("autoScanSiteBatch processed for lineCode: {} ({}/{})", code, index, totalSize);
emisTmsSiteBatchMissService.autoScanSiteBatch(code);
log.info("autoScanSiteBatch processed for lineCode: {}", code);
} catch (Exception e) {
log.error("autoScanSiteBatch failed for lineCode: {}, error: {}", code, e.getMessage());
// 继续处理下一个,不中断整个流程
// 如果最后一个失败,需要清除状态
if (index == totalSize) {
try {
redissonService.setStr(statusKey, "", 0);
log.info("autoScanSiteBatch status cleared after last task failed");
} catch (Exception ex) {
log.error("Failed to clear status after last task failed", ex);
}
}
}
}

View File

@ -73,14 +73,6 @@ public interface IEmisTmsSiteBatchMissService {
*/
void autoScanSiteBatch(String lineCode);
/**
* 定时扫描运单货物组批次是否正确录入
*
* @param lineCode 线路代码
* @param clearStatus 是否清除状态,true-清除,false-不清除
*/
void autoScanSiteBatch(String lineCode, boolean clearStatus);
/**
* 根据bill_code出现次数查询TMS漏组批次信息
*

View File

@ -303,12 +303,6 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
@Async
@Override
public void autoScanSiteBatch(String lineCode) {
autoScanSiteBatch(lineCode, true);
}
@Async
@Override
public void autoScanSiteBatch(String lineCode, boolean clearStatus) {
ExecutorService executorService = null;
try {
emisTmsSiteBatchMissMapper.deleteReally(lineCode);
@ -486,17 +480,13 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
Thread.currentThread().interrupt();
}
}
// 清除任务状态(根据参数决定是否清除)
if (clearStatus) {
try {
String statusKey = "autoScanSiteBatch_status";
redissonService.setStr(statusKey, "", 0);
log.info("autoScanSiteBatch task status cleared");
} catch (Exception e) {
log.error("Failed to clear autoScanSiteBatch status", e);
}
} else {
log.info("autoScanSiteBatch task completed, status not cleared (will be cleared after all tasks)");
// 清除任务状态
try {
String statusKey = "autoScanSiteBatch_status";
redissonService.setStr(statusKey, "", 0);
log.info("autoScanSiteBatch task status cleared");
} catch (Exception e) {
log.error("Failed to clear autoScanSiteBatch status", e);
}
}
}