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()); log.info("Found {} unique line codes, starting batch processing", lineCodeSet.size());
// 循环调用,最后一个才清除状态 // 循环调用
int index = 0;
int totalSize = lineCodeSet.size();
for (String code : lineCodeSet) { for (String code : lineCodeSet) {
try { try {
index++; emisTmsSiteBatchMissService.autoScanSiteBatch(code);
// 最后一个lineCode才清除状态 log.info("autoScanSiteBatch processed for lineCode: {}", code);
boolean clearStatus = (index == totalSize);
emisTmsSiteBatchMissService.autoScanSiteBatch(code, clearStatus);
log.info("autoScanSiteBatch processed for lineCode: {} ({}/{})", code, index, totalSize);
} catch (Exception e) { } catch (Exception e) {
log.error("autoScanSiteBatch failed for lineCode: {}, error: {}", code, e.getMessage()); 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); void autoScanSiteBatch(String lineCode);
/**
* 定时扫描运单货物组批次是否正确录入
*
* @param lineCode 线路代码
* @param clearStatus 是否清除状态,true-清除,false-不清除
*/
void autoScanSiteBatch(String lineCode, boolean clearStatus);
/** /**
* 根据bill_code出现次数查询TMS漏组批次信息 * 根据bill_code出现次数查询TMS漏组批次信息
* *

View File

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