demand: 定时扫描运单货物组批次支持按线路扫描,查询漏组批次列表支持按运单寄件日期查

committer: heyu
This commit is contained in:
aike 2025-06-12 14:19:58 +08:00
parent aade7c0bf0
commit 26cb46e443
7 changed files with 34 additions and 14 deletions

View File

@ -852,14 +852,14 @@ public class EmisCommonController extends EmisBaseController
* @return * @return
*/ */
@GetMapping("/autoScanSiteBatch") @GetMapping("/autoScanSiteBatch")
public AjaxResult autoScanSiteBatch(){ public AjaxResult autoScanSiteBatch(String lineCode){
String lockKey="autoScanSiteBatch"; String lockKey="autoScanSiteBatch";
log.info("autoScanSiteBatch start"); log.info("autoScanSiteBatch start");
// 加锁查询 // 加锁查询
redissonService.lock(lockKey,300); redissonService.lock(lockKey,300);
try{ try{
emisTmsSiteBatchMissService.autoScanSiteBatch(); emisTmsSiteBatchMissService.autoScanSiteBatch(lineCode);
}catch(Exception ex){ }catch(Exception ex){
ex.printStackTrace(); ex.printStackTrace();
log.error("autoScanSiteBatch exception:"+ex.getMessage()); log.error("autoScanSiteBatch exception:"+ex.getMessage());

View File

@ -65,7 +65,7 @@ public interface EmisTmsSiteBatchMissMapper {
*/ */
public int batchInsertEmisTmsSiteBatchMiss(List<EmisTmsSiteBatchMiss> list); public int batchInsertEmisTmsSiteBatchMiss(List<EmisTmsSiteBatchMiss> list);
void deleteAll(); void deleteAll(String lineCode);
/** /**
* 根据bill_code出现次数查询TMS漏组批次信息 * 根据bill_code出现次数查询TMS漏组批次信息

View File

@ -10,7 +10,6 @@
*/ */
package com.xdadan.erp.emis.mapper; package com.xdadan.erp.emis.mapper;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -18,7 +17,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//import com.xdadan.erp.common.annotation.audit.DataAuditFilter; //import com.xdadan.erp.common.annotation.audit.DataAuditFilter;
import com.xdadan.erp.common.annotation.audit.DataAuditLog; import com.xdadan.erp.common.annotation.audit.DataAuditLog;
import com.xdadan.erp.common.annotation.audit.OperateType; import com.xdadan.erp.common.annotation.audit.OperateType;
import com.xdadan.erp.emis.domain.EmisSettleSubBill;
import com.xdadan.erp.emis.domain.EmisWaybill; import com.xdadan.erp.emis.domain.EmisWaybill;
import com.xdadan.erp.emis.service.impl.EmisWaybillServiceImpl; import com.xdadan.erp.emis.service.impl.EmisWaybillServiceImpl;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -290,12 +288,12 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
public int setBindSalesmenDefault(@Param("customerCode") String customerCode,@Param("empCode") String empCode); public int setBindSalesmenDefault(@Param("customerCode") String customerCode,@Param("empCode") String empCode);
/** /**
*
* @param offset 起始位置 * @param offset 起始位置
* @param pageSize 每页大小 * @param pageSize 每页大小
* @param lineCode
* @return 运单列表 * @return 运单列表
*/ */
List<EmisWaybill> selectWaybillListBySiteBatchStatus(@Param("offset") int offset, @Param("pageSize") int pageSize); List<EmisWaybill> selectWaybillListBySiteBatchStatus(@Param("offset") int offset, @Param("pageSize") int pageSize, @Param("lineCode") String lineCode);
/** /**
* 查询客户运单信息 * 查询客户运单信息

View File

@ -61,7 +61,7 @@ public interface IEmisTmsSiteBatchMissService {
* 定时扫描运单货物组批次是否正确录入 * 定时扫描运单货物组批次是否正确录入
* *
*/ */
void autoScanSiteBatch(); void autoScanSiteBatch(String lineCode);
/** /**
* 根据bill_code出现次数查询TMS漏组批次信息 * 根据bill_code出现次数查询TMS漏组批次信息

View File

@ -133,9 +133,9 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
@Async @Async
@Override @Override
public void autoScanSiteBatch() { public void autoScanSiteBatch(String lineCode) {
try { try {
emisTmsSiteBatchMissMapper.deleteAll(); emisTmsSiteBatchMissMapper.deleteAll(lineCode);
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
int pageSize = 1000; int pageSize = 1000;
int offset = 0; int offset = 0;
@ -145,7 +145,7 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
List<String> failedBillCodes = new ArrayList<>(); List<String> failedBillCodes = new ArrayList<>();
// 获取所有线路规划 // 获取所有线路规划
List<EmisTransPlanRule> treeRules = this.selectEmisTransPlanRuleTree(); List<EmisTransPlanRule> treeRules = this.selectEmisTransPlanRuleTree(lineCode);
if (treeRules.isEmpty()) { if (treeRules.isEmpty()) {
log.info("No trans plan rules found, skip auto scan"); log.info("No trans plan rules found, skip auto scan");
return; return;
@ -162,7 +162,7 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
// 先查询所有数据 // 先查询所有数据
while (true) { while (true) {
List<EmisWaybill> waybills = emisWaybillMapper.selectWaybillListBySiteBatchStatus(offset, pageSize); List<EmisWaybill> waybills = emisWaybillMapper.selectWaybillListBySiteBatchStatus(offset, pageSize,lineCode);
if (waybills.isEmpty()) { if (waybills.isEmpty()) {
break; break;
} }
@ -344,6 +344,8 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
EmisTmsSiteBatchMiss miss = createMissRecord(waybill); EmisTmsSiteBatchMiss miss = createMissRecord(waybill);
miss.setMissReason("当前线路没有创建对应的线路规划"); miss.setMissReason("当前线路没有创建对应的线路规划");
miss.setMissType("1"); miss.setMissType("1");
miss.setLineCode(waybill.getTransLineType());
miss.setProductType(waybill.getProductType());
missRecords.add(miss); missRecords.add(miss);
successCount++; successCount++;
continue; continue;
@ -359,6 +361,8 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
EmisTmsSiteBatchMiss miss = createMissRecord(waybill); EmisTmsSiteBatchMiss miss = createMissRecord(waybill);
miss.setMissReason("当前线路没有创建对应的产品类型"); miss.setMissReason("当前线路没有创建对应的产品类型");
miss.setMissType("1"); miss.setMissType("1");
miss.setLineCode(waybill.getTransLineType());
miss.setProductType(waybill.getProductType());
missRecords.add(miss); missRecords.add(miss);
successCount++; successCount++;
continue; continue;
@ -371,6 +375,8 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
EmisTmsSiteBatchMiss miss = createMissRecord(waybill); EmisTmsSiteBatchMiss miss = createMissRecord(waybill);
miss.setMissReason("当前运单没有组批次"); miss.setMissReason("当前运单没有组批次");
miss.setMissType("2"); miss.setMissType("2");
miss.setLineCode(waybill.getTransLineType());
miss.setProductType(waybill.getProductType());
missRecords.add(miss); missRecords.add(miss);
successCount++; successCount++;
continue; continue;
@ -419,9 +425,11 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
return new ProcessResult(successCount, failCount, failedBillCodes, batchStatusList, missRecords); return new ProcessResult(successCount, failCount, failedBillCodes, batchStatusList, missRecords);
} }
public List<EmisTransPlanRule> selectEmisTransPlanRuleTree() { public List<EmisTransPlanRule> selectEmisTransPlanRuleTree(String lineCode) {
log.info("Start querying supplier route plan tree"); log.info("Start querying supplier route plan tree");
List<EmisTransPlanRule> list = emisTransPlanRuleMapper.selectEmisTransPlanRuleList(new EmisTransPlanRule()); EmisTransPlanRule emisTransPlanRule = new EmisTransPlanRule();
emisTransPlanRule.setLineCode(lineCode);
List<EmisTransPlanRule> list = emisTransPlanRuleMapper.selectEmisTransPlanRuleList(emisTransPlanRule);
List<EmisTransPlanRule> tree = buildTree(list); List<EmisTransPlanRule> tree = buildTree(list);
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;
@ -468,6 +476,8 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
EmisTmsSiteBatchMiss miss = createMissRecord(waybill); EmisTmsSiteBatchMiss miss = createMissRecord(waybill);
miss.setMissReason("该运单所有组批次信息都不匹配,请仔细核对"); miss.setMissReason("该运单所有组批次信息都不匹配,请仔细核对");
miss.setMissType("3"); miss.setMissType("3");
miss.setLineCode(waybill.getTransLineType());
miss.setProductType(waybill.getProductType());
missRecords.add(miss); missRecords.add(miss);
return false; return false;
} }

View File

@ -183,6 +183,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="blIsQuestion != null and blIsQuestion != ''"> <if test="blIsQuestion != null and blIsQuestion != ''">
AND w.bl_is_question = #{blIsQuestion} AND w.bl_is_question = #{blIsQuestion}
</if> </if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and w.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and w.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
</where> </where>
</select> </select>
@ -238,6 +244,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="deleteAll"> <update id="deleteAll">
update emis_tms_site_batch_miss set del_flag = '1' update emis_tms_site_batch_miss set del_flag = '1'
<if test="lineCode != null and lineCode != ''">
where line_code = #{lineCode}
</if>
</update> </update>
<insert id="batchInsertEmisTmsSiteBatchMiss" parameterType="java.util.List"> <insert id="batchInsertEmisTmsSiteBatchMiss" parameterType="java.util.List">

View File

@ -3537,6 +3537,9 @@
where a.bl_sign = '1' where a.bl_sign = '1'
and a.del_flag = '0' and a.del_flag = '0'
and (b.site_batch_status is null or b.site_batch_status != '1') and (b.site_batch_status is null or b.site_batch_status != '1')
<if test="lineCode != null and lineCode != ''">
and a.trans_line_type = #{lineCode}
</if>
order by a.create_time desc order by a.create_time desc
limit #{offset}, #{pageSize} limit #{offset}, #{pageSize}
</select> </select>