demand: TMS-缅甸虚拟单调整
committer: heyu
This commit is contained in:
parent
c847446e44
commit
3c4dbf0311
@ -15,6 +15,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
import com.xdadan.erp.emis.utils.WaybillHelper;
|
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|||||||
@ -107,7 +107,8 @@ public interface EmisTransPlanRuleMapper {
|
|||||||
* @param code 线路编码
|
* @param code 线路编码
|
||||||
* @return 产品类型信息列表
|
* @return 产品类型信息列表
|
||||||
*/
|
*/
|
||||||
public List<Map<String, String>> selectProductTypeInfoByNamesAndLineCode(@Param("productTypeNames") List<String> productTypeNames, @Param("lineCode") String code);
|
public List<Map<String, String>> selectProductTypeInfoByNamesAndLineCode(
|
||||||
|
@Param("productTypeNames") List<String> productTypeNames, @Param("lineCode") String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据网点名称查询网点信息
|
* 根据网点名称查询网点信息
|
||||||
@ -139,4 +140,30 @@ public interface EmisTransPlanRuleMapper {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<EmisTransPlanRule> selectEmisTransPlanRuleByLineCodes(@Param("lineCodes") List<String> lineCodes);
|
List<EmisTransPlanRule> selectEmisTransPlanRuleByLineCodes(@Param("lineCodes") List<String> lineCodes);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param emisTransPlanRule
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<EmisTransPlanRule> selectRulesForAllScan(EmisTransPlanRule emisTransPlanRule);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询供应商线路规划(多线程用)
|
||||||
|
*
|
||||||
|
* @param emisTransPlanRule 查询条件
|
||||||
|
* @param offset 偏移量
|
||||||
|
* @param limit 每页数量
|
||||||
|
* @return 供应商线路规划集合
|
||||||
|
*/
|
||||||
|
List<EmisTransPlanRule> selectRulesForAllScanPaged(@Param("emisTransPlanRule") EmisTransPlanRule emisTransPlanRule,
|
||||||
|
@Param("offset") int offset, @Param("limit") int limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询总数(多线程分页用)
|
||||||
|
*
|
||||||
|
* @param emisTransPlanRule 查询条件
|
||||||
|
* @return 总数
|
||||||
|
*/
|
||||||
|
int countForAllScan(EmisTransPlanRule emisTransPlanRule);
|
||||||
}
|
}
|
||||||
@ -4788,6 +4788,10 @@ public class EmisBaseService {
|
|||||||
}
|
}
|
||||||
updateMasterWaybill(emisWaybillSave);
|
updateMasterWaybill(emisWaybillSave);
|
||||||
// 做问题件录入
|
// 做问题件录入
|
||||||
|
scanProblemInfo(emisWaybillSave);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void scanProblemInfo(EmisWaybill emisWaybillSave) {
|
||||||
String dispatchOrSendManCode = "";
|
String dispatchOrSendManCode = "";
|
||||||
if ("1".equals(emisWaybillSave.getPickupMethod())) {
|
if ("1".equals(emisWaybillSave.getPickupMethod())) {
|
||||||
dispatchOrSendManCode = emisWaybillSave.getOperateEmployeeCode();
|
dispatchOrSendManCode = emisWaybillSave.getOperateEmployeeCode();
|
||||||
@ -4816,7 +4820,7 @@ public class EmisBaseService {
|
|||||||
emisTmsScanRecordService.scan(scanInfoProm, dispatchOrSendManCode, emisWaybillSave.getSendSiteCode());
|
emisTmsScanRecordService.scan(scanInfoProm, dispatchOrSendManCode, emisWaybillSave.getSendSiteCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMasterWaybill(EmisWaybill emisWaybillSave) throws EmisBizError {
|
public void updateMasterWaybill(EmisWaybill emisWaybillSave) throws EmisBizError {
|
||||||
EmisWaybill masterWaybill = checkVirtualParam(emisWaybillSave);
|
EmisWaybill masterWaybill = checkVirtualParam(emisWaybillSave);
|
||||||
String virtualRemark = masterWaybill.getVirtualRemark();
|
String virtualRemark = masterWaybill.getVirtualRemark();
|
||||||
String virtualBillCode = emisWaybillSave.getBillCode();
|
String virtualBillCode = emisWaybillSave.getBillCode();
|
||||||
@ -4849,9 +4853,12 @@ public class EmisBaseService {
|
|||||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不存在");
|
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不存在");
|
||||||
}
|
}
|
||||||
if (!emisWaybillSave.getReceiveCountry().equals(masterWaybill.getReceiveCountry())
|
if (!emisWaybillSave.getReceiveCountry().equals(masterWaybill.getReceiveCountry())
|
||||||
|| !emisWaybillSave.getTransLineType().equals(masterWaybill.getTransLineType())) {
|
|| !emisWaybillSave.getTransLineType().equals(masterWaybill.getTransLineType()) || !emisWaybillSave.getProductType().equals(masterWaybill.getProductType())) {
|
||||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单和虚拟单线路不一致");
|
throw new EmisBizError(EmisBizErrorType.FAIL, "主单和虚拟单线路不一致");
|
||||||
}
|
}
|
||||||
|
if ("1".equals(masterWaybill.getBlVirtual())) {
|
||||||
|
throw new EmisBizError(EmisBizErrorType.FAIL, "虚拟单不能作为主单");
|
||||||
|
}
|
||||||
|
|
||||||
List<EmisTmsSiteBatch> batchList = emisTmsSiteBatchMapper.selectEmisTmsSiteBatchListByBillCodes(
|
List<EmisTmsSiteBatch> batchList = emisTmsSiteBatchMapper.selectEmisTmsSiteBatchListByBillCodes(
|
||||||
Lists.newArrayList(Collections.singleton(emisWaybillSave.getMasterBillCode())));
|
Lists.newArrayList(Collections.singleton(emisWaybillSave.getMasterBillCode())));
|
||||||
|
|||||||
@ -48,9 +48,6 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
|||||||
@Autowired
|
@Autowired
|
||||||
private EmisTmsSiteBatchMissRecordMapper emisTmsSiteBatchMissRecordMapper;
|
private EmisTmsSiteBatchMissRecordMapper emisTmsSiteBatchMissRecordMapper;
|
||||||
|
|
||||||
private int totalBatchStatusRecords = 0;
|
|
||||||
private int totalMissRecords = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询TMS漏组批次信息
|
* 查询TMS漏组批次信息
|
||||||
*
|
*
|
||||||
@ -142,6 +139,8 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
|||||||
int totalProcessed = 0;
|
int totalProcessed = 0;
|
||||||
int successCount = 0;
|
int successCount = 0;
|
||||||
int failCount = 0;
|
int failCount = 0;
|
||||||
|
int totalBatchStatusRecords = 0;
|
||||||
|
int totalMissRecords = 0;
|
||||||
List<String> failedBillCodes = new ArrayList<>();
|
List<String> failedBillCodes = new ArrayList<>();
|
||||||
|
|
||||||
// 获取所有线路规划
|
// 获取所有线路规划
|
||||||
@ -162,7 +161,8 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
|||||||
|
|
||||||
// 先查询所有数据
|
// 先查询所有数据
|
||||||
while (true) {
|
while (true) {
|
||||||
List<EmisWaybill> waybills = emisWaybillMapper.selectWaybillListBySiteBatchStatus(offset, pageSize,lineCode);
|
List<EmisWaybill> waybills = emisWaybillMapper.selectWaybillListBySiteBatchStatus(offset, pageSize,
|
||||||
|
lineCode);
|
||||||
if (waybills.isEmpty()) {
|
if (waybills.isEmpty()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -192,6 +192,10 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
|||||||
batches.add(allWaybills.subList(i, end));
|
batches.add(allWaybills.subList(i, end));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CollectionUtil.isEmpty(batches)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 创建新的线程池处理数据
|
// 创建新的线程池处理数据
|
||||||
executorService = Executors.newFixedThreadPool(processors);
|
executorService = Executors.newFixedThreadPool(processors);
|
||||||
List<Future<ProcessResult>> processFutures = new ArrayList<>();
|
List<Future<ProcessResult>> processFutures = new ArrayList<>();
|
||||||
@ -201,44 +205,52 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 收集处理结果
|
// 收集处理结果
|
||||||
|
List<EmisWaybillBatchStatus> allBatchStatus = new ArrayList<>();
|
||||||
|
List<EmisTmsSiteBatchMiss> allMissRecords = new ArrayList<>();
|
||||||
for (Future<ProcessResult> future : processFutures) {
|
for (Future<ProcessResult> future : processFutures) {
|
||||||
try {
|
try {
|
||||||
ProcessResult result = future.get();
|
ProcessResult result = future.get();
|
||||||
successCount += result.getSuccessCount();
|
successCount += result.getSuccessCount();
|
||||||
failCount += result.getFailCount();
|
failCount += result.getFailCount();
|
||||||
failedBillCodes.addAll(result.getFailedBillCodes());
|
failedBillCodes.addAll(result.getFailedBillCodes());
|
||||||
|
allBatchStatus.addAll(result.getBatchStatusList());
|
||||||
// 批量插入运单组批次状态记录
|
allMissRecords.addAll(result.getMissRecords());
|
||||||
if (!result.getBatchStatusList().isEmpty()) {
|
|
||||||
emisWaybillBatchStatusMapper.batchInsertEmisWaybillBatchStatus(result.getBatchStatusList());
|
|
||||||
totalBatchStatusRecords += result.getBatchStatusList().size();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 批量保存漏组记录
|
|
||||||
if (!result.getMissRecords().isEmpty()) {
|
|
||||||
List<EmisTmsSiteBatchMiss> filteredRecords = result.getMissRecords().stream()
|
|
||||||
.collect(Collectors.collectingAndThen(
|
|
||||||
Collectors.toMap(
|
|
||||||
record -> record.getBillCode() + "_" + record.getMissReason(),
|
|
||||||
record -> record,
|
|
||||||
(existing, replacement) -> existing),
|
|
||||||
map -> new ArrayList<>(map.values())));
|
|
||||||
emisTmsSiteBatchMissMapper.batchInsertEmisTmsSiteBatchMiss(filteredRecords);
|
|
||||||
totalMissRecords += filteredRecords.size();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error processing batch", e);
|
log.error("Error processing batch", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关闭线程池
|
// 全局去重
|
||||||
executorService.shutdown();
|
Map<String, EmisWaybillBatchStatus> batchStatusMap = allBatchStatus.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
EmisWaybillBatchStatus::getBillCode,
|
||||||
|
v -> v,
|
||||||
|
(existing, replacement) -> existing));
|
||||||
|
List<EmisWaybillBatchStatus> uniqueBatchStatus = new ArrayList<>(batchStatusMap.values());
|
||||||
|
|
||||||
|
Map<String, EmisTmsSiteBatchMiss> missMap = allMissRecords.stream()
|
||||||
|
.collect(Collectors.toMap(
|
||||||
|
r -> r.getBillCode() + "_" + r.getMissReason(),
|
||||||
|
v -> v,
|
||||||
|
(existing, replacement) -> existing));
|
||||||
|
List<EmisTmsSiteBatchMiss> uniqueMissRecords = new ArrayList<>(missMap.values());
|
||||||
|
|
||||||
|
// 批量插入
|
||||||
|
if (!uniqueBatchStatus.isEmpty()) {
|
||||||
|
emisWaybillBatchStatusMapper.batchInsertEmisWaybillBatchStatus(uniqueBatchStatus);
|
||||||
|
totalBatchStatusRecords += uniqueBatchStatus.size();
|
||||||
|
}
|
||||||
|
if (!uniqueMissRecords.isEmpty()) {
|
||||||
|
emisTmsSiteBatchMissMapper.batchInsertEmisTmsSiteBatchMiss(uniqueMissRecords);
|
||||||
|
totalMissRecords += uniqueMissRecords.size();
|
||||||
|
}
|
||||||
|
|
||||||
long endTime = System.currentTimeMillis();
|
long endTime = System.currentTimeMillis();
|
||||||
long processTime = endTime - startTime;
|
long processTime = endTime - startTime;
|
||||||
|
|
||||||
// 保存扫描记录
|
// 保存扫描记录
|
||||||
saveRecord(totalProcessed, successCount, failCount, processTime, failedBillCodes);
|
saveRecord(totalProcessed, successCount, failCount, processTime, failedBillCodes, totalBatchStatusRecords,
|
||||||
|
totalMissRecords);
|
||||||
|
|
||||||
log.info(
|
log.info(
|
||||||
"Auto scan completed. Total processed: {}, Success: {}, Failed: {}, Time taken: {}ms, Batch status records: {}, Miss records: {}",
|
"Auto scan completed. Total processed: {}, Success: {}, Failed: {}, Time taken: {}ms, Batch status records: {}, Miss records: {}",
|
||||||
@ -253,7 +265,7 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveRecord(int totalProcessed, int successCount, int failCount, long processTime,
|
private void saveRecord(int totalProcessed, int successCount, int failCount, long processTime,
|
||||||
List<String> failedBillCodes) {
|
List<String> failedBillCodes, int totalBatchStatusRecords, int totalMissRecords) {
|
||||||
EmisTmsSiteBatchMissRecord record = new EmisTmsSiteBatchMissRecord();
|
EmisTmsSiteBatchMissRecord record = new EmisTmsSiteBatchMissRecord();
|
||||||
record.setTotalProcessed(totalProcessed);
|
record.setTotalProcessed(totalProcessed);
|
||||||
record.setSuccessCount(successCount);
|
record.setSuccessCount(successCount);
|
||||||
@ -385,6 +397,10 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
|||||||
// 合并相同起始网点和下一网点的批次
|
// 合并相同起始网点和下一网点的批次
|
||||||
Map<String, EmisTmsSiteBatch> mergedBatches = new HashMap<>();
|
Map<String, EmisTmsSiteBatch> mergedBatches = new HashMap<>();
|
||||||
for (EmisTmsSiteBatch batch : waybillBatches) {
|
for (EmisTmsSiteBatch batch : waybillBatches) {
|
||||||
|
if (StringUtils.isAnyBlank(batch.getStartSiteCode(), batch.getNextSiteCode(),
|
||||||
|
batch.getSupplierCode())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String key = batch.getStartSiteCode() + "_" + batch.getNextSiteCode();
|
String key = batch.getStartSiteCode() + "_" + batch.getNextSiteCode();
|
||||||
if (mergedBatches.containsKey(key)) {
|
if (mergedBatches.containsKey(key)) {
|
||||||
EmisTmsSiteBatch existingBatch = mergedBatches.get(key);
|
EmisTmsSiteBatch existingBatch = mergedBatches.get(key);
|
||||||
@ -426,11 +442,33 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<EmisTransPlanRule> selectEmisTransPlanRuleTree(String lineCode) {
|
public List<EmisTransPlanRule> selectEmisTransPlanRuleTree(String lineCode) {
|
||||||
log.info("Start querying supplier route plan tree");
|
log.info("Start querying supplier route plan tree (multi-threaded)");
|
||||||
EmisTransPlanRule emisTransPlanRule = new EmisTransPlanRule();
|
EmisTransPlanRule emisTransPlanRule = new EmisTransPlanRule();
|
||||||
emisTransPlanRule.setLineCode(lineCode);
|
emisTransPlanRule.setLineCode(lineCode);
|
||||||
List<EmisTransPlanRule> list = emisTransPlanRuleMapper.selectEmisTransPlanRuleList(emisTransPlanRule);
|
int pageSize = 100;
|
||||||
List<EmisTransPlanRule> tree = buildTree(list);
|
int total = emisTransPlanRuleMapper.countForAllScan(emisTransPlanRule);
|
||||||
|
int pageCount = (total + pageSize - 1) / pageSize;
|
||||||
|
int processors = Runtime.getRuntime().availableProcessors();
|
||||||
|
ExecutorService executor = Executors.newFixedThreadPool(processors);
|
||||||
|
List<Future<List<EmisTransPlanRule>>> futures = new ArrayList<>();
|
||||||
|
for (int i = 0; i < pageCount; i++) {
|
||||||
|
int offset = i * pageSize;
|
||||||
|
futures.add(executor.submit(
|
||||||
|
() -> emisTransPlanRuleMapper.selectRulesForAllScanPaged(emisTransPlanRule, offset, pageSize)));
|
||||||
|
}
|
||||||
|
List<EmisTransPlanRule> allRules = new ArrayList<>();
|
||||||
|
for (Future<List<EmisTransPlanRule>> future : futures) {
|
||||||
|
try {
|
||||||
|
List<EmisTransPlanRule> rules = future.get();
|
||||||
|
if (rules != null) {
|
||||||
|
allRules.addAll(rules);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Error getting trans plan rule results", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
executor.shutdown();
|
||||||
|
List<EmisTransPlanRule> tree = buildTree(allRules);
|
||||||
log.info("Queried supplier route plan tree, node count={}", tree != null ? tree.size() : 0);
|
log.info("Queried supplier route plan tree, node count={}", tree != null ? tree.size() : 0);
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
@ -708,7 +746,8 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
|||||||
.anyMatch(
|
.anyMatch(
|
||||||
filterRule -> filterRule.getStartSiteCode().equals(childRule.getStartSiteCode()) &&
|
filterRule -> filterRule.getStartSiteCode().equals(childRule.getStartSiteCode()) &&
|
||||||
filterRule.getNextSiteCode().equals(childRule.getNextSiteCode()) &&
|
filterRule.getNextSiteCode().equals(childRule.getNextSiteCode()) &&
|
||||||
compareSupplierCodes(filterRule.getSupplierCode(), childRule.getSupplierCode())));
|
compareSupplierCodes(filterRule.getSupplierCode(),
|
||||||
|
childRule.getSupplierCode())));
|
||||||
|
|
||||||
if (!hasMatchedChild) {
|
if (!hasMatchedChild) {
|
||||||
// 如果所有子节点都不匹配,为每个子节点创建漏组记录
|
// 如果所有子节点都不匹配,为每个子节点创建漏组记录
|
||||||
|
|||||||
@ -140,6 +140,9 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
|||||||
checkUseQuotaCredit(emisWaybillOld, getEmisWaybillNewFromJson(emisWaybillAjustApply));
|
checkUseQuotaCredit(emisWaybillOld, getEmisWaybillNewFromJson(emisWaybillAjustApply));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 校验虚拟单逻辑
|
||||||
|
checkVirtualParam(getEmisWaybillNewFromJson(emisWaybillAjustApply));
|
||||||
|
|
||||||
// 插入数据
|
// 插入数据
|
||||||
emisWaybillAjustApplyMapper.insertEmisWaybillAjustApply(emisWaybillAjustApply);
|
emisWaybillAjustApplyMapper.insertEmisWaybillAjustApply(emisWaybillAjustApply);
|
||||||
|
|
||||||
|
|||||||
@ -3116,6 +3116,11 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
|||||||
// 检查信用额度
|
// 检查信用额度
|
||||||
checkUseQuotaCredit(null,emisWaybillSave);
|
checkUseQuotaCredit(null,emisWaybillSave);
|
||||||
|
|
||||||
|
// 虚拟件逻辑
|
||||||
|
if ("1".equals(emisWaybillSave.getBlVirtual())) {
|
||||||
|
updateMasterWaybill(emisWaybillSave);
|
||||||
|
}
|
||||||
|
|
||||||
//插入新单
|
//插入新单
|
||||||
emisWaybillMapper.insertEmisWaybill(emisWaybillSave);
|
emisWaybillMapper.insertEmisWaybill(emisWaybillSave);
|
||||||
|
|
||||||
@ -3220,7 +3225,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理虚拟件逻辑
|
// 处理虚拟件逻辑
|
||||||
handleVirtual(emisWaybillSave);
|
scanProblemInfo(emisWaybillSave);
|
||||||
|
|
||||||
// 运单立即重新出账
|
// 运单立即重新出账
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -191,5 +191,6 @@
|
|||||||
left join emis_tms_site_batch_dtl b on a.bill_code = b.bill_code and b.del_flag = '0'
|
left join emis_tms_site_batch_dtl b on a.bill_code = b.bill_code and b.del_flag = '0'
|
||||||
where b.batch_no = #{batchNo}
|
where b.batch_no = #{batchNo}
|
||||||
and a.del_flag = '0'
|
and a.del_flag = '0'
|
||||||
|
and a.send_date <![CDATA[ > ]]> '2025-01-01 00:00:00'
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -154,7 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</choose>
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
<if test="billCode != null and billCode != ''">
|
<if test="billCode != null and billCode != ''">
|
||||||
AND m.bill_code = #{billCode}
|
AND m.bill_code REGEXP REPLACE(#{billCode}, '\n', '|')
|
||||||
</if>
|
</if>
|
||||||
<if test="missReason != null and missReason != ''">
|
<if test="missReason != null and missReason != ''">
|
||||||
AND m.miss_reason like concat('%', #{missReason}, '%')
|
AND m.miss_reason like concat('%', #{missReason}, '%')
|
||||||
|
|||||||
@ -61,8 +61,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
order by id desc
|
order by id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRulesForAllScan" parameterType="EmisTransPlanRule" resultMap="EmisTransPlanRuleResult">
|
||||||
|
select r.id, r.line_code, r.product_type, r.start_site_code,r.next_site_code, s1.site_name as start_site_name,
|
||||||
|
s2.site_name as next_site_name,
|
||||||
|
r.manager, r.supplier_code, r.start_date, r.end_date, (SELECT GROUP_CONCAT(s.name)
|
||||||
|
FROM emis_supplier s
|
||||||
|
WHERE FIND_IN_SET(s.code, r.supplier_code)
|
||||||
|
AND s.del_flag = '0') as supplier_name
|
||||||
|
from emis_trans_plan_rule r
|
||||||
|
left join emis_site s1 on r.start_site_code = s1.site_code and s1.del_flag='0'
|
||||||
|
left join emis_site s2 on r.next_site_code = s2.site_code and s2.del_flag='0'
|
||||||
|
<where>
|
||||||
|
r.del_flag = '0'
|
||||||
|
<if test="lineCode != null and lineCode != ''">and r.line_code = #{lineCode}</if>
|
||||||
|
<if test="productType != null and productType != ''">and ( FIND_IN_SET(#{productType},r.product_type) )
|
||||||
|
</if>
|
||||||
|
<if test="startSiteCode != null and startSiteCode != ''">and r.start_site_code = #{startSiteCode}</if>
|
||||||
|
<if test="nextSiteCode != null and nextSiteCode != ''">and r.next_site_code = #{nextSiteCode}</if>
|
||||||
|
<if test="manager != null and manager != ''">and r.manager = #{manager}</if>
|
||||||
|
<if test="supplierCode != null and supplierCode != ''">and ( FIND_IN_SET(#{supplierCode},r.supplier_code)
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="startDate != null">and r.start_date = #{startDate}</if>
|
||||||
|
<if test="endDate != null">and r.end_date = #{endDate}</if>
|
||||||
|
<if test="transManager != null and transManager != ''">
|
||||||
|
AND l.trans_manager like concat('%', #{transManager}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectEmisTransPlanRuleByLineCodes" parameterType="list" resultMap="EmisTransPlanRuleResult">
|
<select id="selectEmisTransPlanRuleByLineCodes" parameterType="list" resultMap="EmisTransPlanRuleResult">
|
||||||
<include refid="selectEmisTransPlanRuleVo"/>
|
select r.id, r.line_code, r.product_type, r.start_site_code,r.next_site_code, s1.site_name as start_site_name,
|
||||||
|
s2.site_name as next_site_name,
|
||||||
|
r.manager, r.supplier_code, r.start_date, r.end_date, (SELECT GROUP_CONCAT(s.name)
|
||||||
|
FROM emis_supplier s
|
||||||
|
WHERE FIND_IN_SET(s.code, r.supplier_code)
|
||||||
|
AND s.del_flag = '0') as supplier_name
|
||||||
|
from emis_trans_plan_rule r
|
||||||
|
left join emis_site s1 on r.start_site_code = s1.site_code and s1.del_flag='0'
|
||||||
|
left join emis_site s2 on r.next_site_code = s2.site_code and s2.del_flag='0'
|
||||||
<where>
|
<where>
|
||||||
r.del_flag = '0'
|
r.del_flag = '0'
|
||||||
AND r.line_code in
|
AND r.line_code in
|
||||||
@ -242,4 +280,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
AND del_flag = '0'
|
AND del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectRulesForAllScanPaged" resultMap="EmisTransPlanRuleResult">
|
||||||
|
select r.id, r.line_code, r.product_type, r.start_site_code, r.next_site_code, s1.site_name as start_site_name,
|
||||||
|
s2.site_name as next_site_name,
|
||||||
|
r.manager, r.supplier_code, r.start_date, r.end_date, (SELECT GROUP_CONCAT(s.name)
|
||||||
|
FROM emis_supplier s
|
||||||
|
WHERE FIND_IN_SET(s.code, r.supplier_code)
|
||||||
|
AND s.del_flag = '0') as supplier_name
|
||||||
|
from emis_trans_plan_rule r
|
||||||
|
left join emis_site s1 on r.start_site_code = s1.site_code and s1.del_flag='0'
|
||||||
|
left join emis_site s2 on r.next_site_code = s2.site_code and s2.del_flag='0'
|
||||||
|
<where>
|
||||||
|
r.del_flag = '0'
|
||||||
|
<if test="emisTransPlanRule.lineCode != null and emisTransPlanRule.lineCode != ''">and r.line_code = #{emisTransPlanRule.lineCode}</if>
|
||||||
|
<if test="emisTransPlanRule.productType != null and emisTransPlanRule.productType != ''">and ( FIND_IN_SET(#{emisTransPlanRule.productType},r.product_type) )</if>
|
||||||
|
<if test="emisTransPlanRule.startSiteCode != null and emisTransPlanRule.startSiteCode != ''">and r.start_site_code = #{emisTransPlanRule.startSiteCode}</if>
|
||||||
|
<if test="emisTransPlanRule.nextSiteCode != null and emisTransPlanRule.nextSiteCode != ''">and r.next_site_code = #{emisTransPlanRule.nextSiteCode}</if>
|
||||||
|
<if test="emisTransPlanRule.manager != null and emisTransPlanRule.manager != ''">and r.manager = #{emisTransPlanRule.manager}</if>
|
||||||
|
<if test="emisTransPlanRule.supplierCode != null and emisTransPlanRule.supplierCode != ''">and ( FIND_IN_SET(#{emisTransPlanRule.supplierCode},r.supplier_code) )</if>
|
||||||
|
<if test="emisTransPlanRule.startDate != null">and r.start_date = #{emisTransPlanRule.startDate}</if>
|
||||||
|
<if test="emisTransPlanRule.endDate != null">and r.end_date = #{emisTransPlanRule.endDate}</if>
|
||||||
|
</where>
|
||||||
|
order by id desc
|
||||||
|
limit #{limit} offset #{offset}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="countForAllScan" resultType="int">
|
||||||
|
select count(1)
|
||||||
|
from emis_trans_plan_rule r
|
||||||
|
<where>
|
||||||
|
r.del_flag = '0'
|
||||||
|
<if test="lineCode != null and lineCode != ''">and r.line_code = #{lineCode}</if>
|
||||||
|
<if test="productType != null and productType != ''">and ( FIND_IN_SET(#{productType},r.product_type) )</if>
|
||||||
|
<if test="startSiteCode != null and startSiteCode != ''">and r.start_site_code = #{startSiteCode}</if>
|
||||||
|
<if test="nextSiteCode != null and nextSiteCode != ''">and r.next_site_code = #{nextSiteCode}</if>
|
||||||
|
<if test="manager != null and manager != ''">and r.manager = #{manager}</if>
|
||||||
|
<if test="supplierCode != null and supplierCode != ''">and ( FIND_IN_SET(#{supplierCode},r.supplier_code) )</if>
|
||||||
|
<if test="startDate != null">and r.start_date = #{startDate}</if>
|
||||||
|
<if test="endDate != null">and r.end_date = #{endDate}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -3763,6 +3763,7 @@
|
|||||||
<if test="lineCode != null and lineCode != ''">
|
<if test="lineCode != null and lineCode != ''">
|
||||||
and a.trans_line_type = #{lineCode}
|
and a.trans_line_type = #{lineCode}
|
||||||
</if>
|
</if>
|
||||||
|
and a.send_date <![CDATA[ > ]]> '2025-01-01 00:00:00'
|
||||||
and (a.virtual_remark is null or virtual_remark = '')
|
and (a.virtual_remark is null or virtual_remark = '')
|
||||||
order by a.create_time desc
|
order by a.create_time desc
|
||||||
limit #{offset}, #{pageSize}
|
limit #{offset}, #{pageSize}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user