Merge pull request 'demand: 定时扫描运单货物组批次支持按线路扫描,查询漏组批次列表支持按运单寄件日期查' (#55) from develop into master

Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/55
This commit is contained in:
heyu 2025-06-12 14:21:13 +08:00
commit 68dbc5f8fb
7 changed files with 34 additions and 14 deletions

View File

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

View File

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

View File

@ -10,7 +10,6 @@
*/
package com.xdadan.erp.emis.mapper;
import java.util.Date;
import java.util.List;
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.DataAuditLog;
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.service.impl.EmisWaybillServiceImpl;
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);
/**
*
* @param offset 起始位置
* @param pageSize 每页大小
* @param lineCode
* @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漏组批次信息

View File

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

View File

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

View File

@ -3537,6 +3537,9 @@
where a.bl_sign = '1'
and a.del_flag = '0'
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
limit #{offset}, #{pageSize}
</select>