demand: 定时扫描运单组批次,漏组批次管理页面
committer: heyu
This commit is contained in:
parent
381ea61971
commit
a50f333e4c
@ -85,6 +85,9 @@ public class EmisCommonController extends EmisBaseController
|
||||
@Autowired
|
||||
private EmisBaseService emisBaseService;
|
||||
|
||||
@Autowired
|
||||
private IEmisTmsSiteBatchMissService emisTmsSiteBatchMissService;
|
||||
|
||||
@Autowired
|
||||
private IEmisPrintTplService emisPrintTplService;
|
||||
|
||||
@ -756,6 +759,32 @@ public class EmisCommonController extends EmisBaseController
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 定时扫描运单货物组批次是否正确录入
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/autoScanSiteBatch")
|
||||
public AjaxResult autoScanSiteBatch(){
|
||||
String lockKey="autoScanSiteBatch";
|
||||
log.info("autoScanSiteBatch start");
|
||||
|
||||
// 加锁查询
|
||||
redissonService.lock(lockKey,300);
|
||||
try{
|
||||
emisTmsSiteBatchMissService.autoScanSiteBatch();
|
||||
}catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
log.error("autoScanSiteBatch exception:"+ex.getMessage());
|
||||
}
|
||||
log.info("autoScanSiteBatch end");
|
||||
|
||||
redissonService.unlock(lockKey);
|
||||
return AjaxResult.success("发送成功");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 单独出账
|
||||
* @return
|
||||
|
||||
@ -0,0 +1,101 @@
|
||||
package com.xdadan.erp.web.emis;
|
||||
|
||||
import java.util.List;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.xdadan.erp.common.annotation.Log;
|
||||
import com.xdadan.erp.common.core.controller.BaseController;
|
||||
import com.xdadan.erp.common.core.domain.AjaxResult;
|
||||
import com.xdadan.erp.common.enums.BusinessType;
|
||||
import com.xdadan.erp.emis.domain.EmisTmsSiteBatchMiss;
|
||||
import com.xdadan.erp.emis.service.IEmisTmsSiteBatchMissService;
|
||||
import com.xdadan.erp.common.utils.poi.ExcelUtil;
|
||||
import com.xdadan.erp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* TMS漏组批次信息Controller
|
||||
*
|
||||
* @author heyu
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/emis/emisTmsSiteBatchMiss")
|
||||
public class EmisTmsSiteBatchMissController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IEmisTmsSiteBatchMissService emisTmsSiteBatchMissService;
|
||||
|
||||
/**
|
||||
* 查询TMS漏组批次信息列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('emis:tms:site:batch:miss:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss) {
|
||||
startPage();
|
||||
setPrivParams(emisTmsSiteBatchMiss);
|
||||
List<EmisTmsSiteBatchMiss> list = emisTmsSiteBatchMissService
|
||||
.selectEmisTmsSiteBatchMissList(emisTmsSiteBatchMiss);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出TMS漏组批次信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:tms:site:batch:miss:export')")
|
||||
@Log(title = "TMS漏组批次信息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss) {
|
||||
List<EmisTmsSiteBatchMiss> list = emisTmsSiteBatchMissService
|
||||
.selectEmisTmsSiteBatchMissList(emisTmsSiteBatchMiss);
|
||||
ExcelUtil<EmisTmsSiteBatchMiss> util = new ExcelUtil<EmisTmsSiteBatchMiss>(EmisTmsSiteBatchMiss.class);
|
||||
return util.exportExcel(list, "TMS漏组批次信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取TMS漏组批次信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:tms:site:batch:miss:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(emisTmsSiteBatchMissService.selectEmisTmsSiteBatchMissById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增TMS漏组批次信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:tms:site:batch:miss:add')")
|
||||
@Log(title = "TMS漏组批次信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmisTmsSiteBatchMiss emisTmsSiteBatchMiss) {
|
||||
return toAjax(emisTmsSiteBatchMissService.insertEmisTmsSiteBatchMiss(emisTmsSiteBatchMiss));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改TMS漏组批次信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:tms:site:batch:miss:edit')")
|
||||
@Log(title = "TMS漏组批次信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EmisTmsSiteBatchMiss emisTmsSiteBatchMiss) {
|
||||
return toAjax(emisTmsSiteBatchMissService.updateEmisTmsSiteBatchMiss(emisTmsSiteBatchMiss));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除TMS漏组批次信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:tms:site:batch:miss:remove')")
|
||||
@Log(title = "TMS漏组批次信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(emisTmsSiteBatchMissService.deleteEmisTmsSiteBatchMissByIds(ids));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package com.xdadan.erp.emis.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xdadan.erp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName EmisTmsSiteBatchMiss
|
||||
* @Description TMS漏组批次信息
|
||||
* @author heyu
|
||||
* @date 2025-04-29 04:52:26
|
||||
*/
|
||||
@Data
|
||||
public class EmisTmsSiteBatchMiss extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/* id */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
/* 线路规则id */
|
||||
private Long transPlanRuleId;
|
||||
/* 运单号 */
|
||||
private String billCode;
|
||||
/* 线路负责人 */
|
||||
private String manager;
|
||||
/* 寄件网点编码 */
|
||||
private String sendSiteCode;
|
||||
/* 寄件网点名称 */
|
||||
private String sendSiteName;
|
||||
/* 寄件国家编码 */
|
||||
private String sendCountry;
|
||||
/* 寄件国家名称 */
|
||||
private String sendCountryName;
|
||||
/* 目的网点编码 */
|
||||
private String destinationCode;
|
||||
/* 目的网点名称 */
|
||||
private String destinationName;
|
||||
/* 目的国家编码 */
|
||||
private String receiveCountry;
|
||||
/* 目的国家名称 */
|
||||
private String receiveCountryName;
|
||||
/* 寄件日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date sendDate;
|
||||
/* 签收状态 */
|
||||
private String blSign;
|
||||
/* 签收时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date signDate;
|
||||
/* 所属线路编码 */
|
||||
private String transLineType;
|
||||
/* 所属线路名称 */
|
||||
private String transLineTypeName;
|
||||
/* 产品类型编码 */
|
||||
private String productType;
|
||||
/* 产品类型名称 */
|
||||
private String productTypeName;
|
||||
/* 支付方式 : 现金或月结 */
|
||||
private String paymentType;
|
||||
/* 件数 */
|
||||
private Integer parcelQty;
|
||||
/* 实际重量 */
|
||||
private BigDecimal billWeight;
|
||||
/* 体积 */
|
||||
private BigDecimal totalVolume;
|
||||
/* 体积重量 */
|
||||
private BigDecimal volumeWeight;
|
||||
/* 结算重量 */
|
||||
private BigDecimal settlementWeight;
|
||||
/* 运费 */
|
||||
private BigDecimal freight;
|
||||
/* 录单备注 */
|
||||
private String waybillRemark;
|
||||
/* 费用备注 */
|
||||
private String feeRemark;
|
||||
/* 漏组原因 */
|
||||
private String missReason;
|
||||
}
|
||||
@ -51,6 +51,9 @@ public class EmisTransPlanRule extends BaseEntity {
|
||||
/** 下一网点名称 */
|
||||
private String nextSiteName;
|
||||
|
||||
/** 线路负责人 */
|
||||
private String manager;
|
||||
|
||||
/** 供应商编码 */
|
||||
private String supplierCode;
|
||||
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisWaybillBatchStatus.java
|
||||
* @author linfso
|
||||
* @date 2024-04-27 15:14:06
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @Description: <p> 运单组批次状态 实体类 </p>
|
||||
*/
|
||||
|
||||
package com.xdadan.erp.emis.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xdadan.erp.common.annotation.audit.DataAuditField;
|
||||
import com.xdadan.erp.common.annotation.audit.DataAuditTable;
|
||||
import com.xdadan.erp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName EmisWaybillBatchStatus
|
||||
* @Description 运单组批次状态
|
||||
* @author heyu
|
||||
* @date 2025-05-08 15:14:06
|
||||
*/
|
||||
@Data
|
||||
@TableName("emis_waybill_batch_status")
|
||||
@DataAuditTable(tableName = "emis_waybill_batch_status", tableComment = "运单组批次状态表")
|
||||
public class EmisWaybillBatchStatus extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/* id */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/* 运单号 */
|
||||
@DataAuditField(fieldComment = "运单号")
|
||||
private String billCode;
|
||||
|
||||
/* 批次状态 */
|
||||
@DataAuditField(fieldComment = "批次状态,1:组批次成功")
|
||||
private String siteBatchStatus;
|
||||
|
||||
/* 备注 */
|
||||
@DataAuditField(fieldComment = "备注")
|
||||
private String remark;
|
||||
}
|
||||
@ -14,6 +14,7 @@ import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xdadan.erp.emis.domain.EmisTmsSiteBatch;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @ClassName EmisTmsSiteBatchMapper
|
||||
@ -91,4 +92,12 @@ public interface EmisTmsSiteBatchMapper extends BaseMapper<EmisTmsSiteBatch>
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEnteringStatus(String batchNo);
|
||||
|
||||
/**
|
||||
* 根据运单号列表查询组批次信息
|
||||
*
|
||||
* @param billCodes 运单号列表
|
||||
* @return 组批次信息列表
|
||||
*/
|
||||
List<EmisTmsSiteBatch> selectEmisTmsSiteBatchListByBillCodes(@Param("billCodes") List<String> billCodes);
|
||||
}
|
||||
|
||||
@ -0,0 +1,69 @@
|
||||
package com.xdadan.erp.emis.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisTmsSiteBatchMiss;
|
||||
|
||||
/**
|
||||
* TMS漏组批次信息Mapper接口
|
||||
*
|
||||
* @author heyu
|
||||
*/
|
||||
public interface EmisTmsSiteBatchMissMapper {
|
||||
/**
|
||||
* 查询TMS漏组批次信息
|
||||
*
|
||||
* @param id TMS漏组批次信息主键
|
||||
* @return TMS漏组批次信息
|
||||
*/
|
||||
public EmisTmsSiteBatchMiss selectEmisTmsSiteBatchMissById(Long id);
|
||||
|
||||
/**
|
||||
* 查询TMS漏组批次信息列表
|
||||
*
|
||||
* @param emisTmsSiteBatchMiss TMS漏组批次信息
|
||||
* @return TMS漏组批次信息集合
|
||||
*/
|
||||
public List<EmisTmsSiteBatchMiss> selectEmisTmsSiteBatchMissList(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss);
|
||||
|
||||
/**
|
||||
* 新增TMS漏组批次信息
|
||||
*
|
||||
* @param emisTmsSiteBatchMiss TMS漏组批次信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmisTmsSiteBatchMiss(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss);
|
||||
|
||||
/**
|
||||
* 修改TMS漏组批次信息
|
||||
*
|
||||
* @param emisTmsSiteBatchMiss TMS漏组批次信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmisTmsSiteBatchMiss(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss);
|
||||
|
||||
/**
|
||||
* 删除TMS漏组批次信息
|
||||
*
|
||||
* @param id TMS漏组批次信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisTmsSiteBatchMissById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除TMS漏组批次信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisTmsSiteBatchMissByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 批量插入TMS漏组批次信息
|
||||
*
|
||||
* @param list TMS漏组批次信息列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertEmisTmsSiteBatchMiss(List<EmisTmsSiteBatchMiss> list);
|
||||
|
||||
void deleteAll();
|
||||
}
|
||||
@ -115,4 +115,12 @@ public interface EmisTransPlanRuleMapper {
|
||||
* @return map
|
||||
*/
|
||||
List<Map<String, String>> selectProductTypeInfoByCodes(List<String> productTypes);
|
||||
|
||||
/**
|
||||
* 根据线路编码查询运输计划规则
|
||||
*
|
||||
* @param lineCode 线路编码
|
||||
* @return 运输计划规则列表
|
||||
*/
|
||||
List<EmisTransPlanRule> selectTransPlanRuleByLineCode(@Param("lineCode") String lineCode);
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.xdadan.erp.emis.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybillBatchStatus;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运单组批次状态Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface EmisWaybillBatchStatusMapper extends BaseMapper<EmisWaybillBatchStatus> {
|
||||
|
||||
/**
|
||||
* 批量插入运单组批次状态记录
|
||||
*
|
||||
* @param batchStatusList 批次状态列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchInsertEmisWaybillBatchStatus(List<EmisWaybillBatchStatus> batchStatusList);
|
||||
}
|
||||
@ -281,5 +281,11 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
|
||||
public int setBindSalesmenDefault(@Param("customerCode") String customerCode,@Param("empCode") String empCode);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param offset 起始位置
|
||||
* @param pageSize 每页大小
|
||||
* @return 运单列表
|
||||
*/
|
||||
List<EmisWaybill> selectWaybillListBySiteBatchStatus(@Param("offset") int offset, @Param("pageSize") int pageSize);
|
||||
}
|
||||
|
||||
@ -0,0 +1,65 @@
|
||||
package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisTmsSiteBatchMiss;
|
||||
|
||||
/**
|
||||
* TMS漏组批次信息Service接口
|
||||
*
|
||||
* @author heyu
|
||||
*/
|
||||
public interface IEmisTmsSiteBatchMissService {
|
||||
/**
|
||||
* 查询TMS漏组批次信息
|
||||
*
|
||||
* @param id TMS漏组批次信息主键
|
||||
* @return TMS漏组批次信息
|
||||
*/
|
||||
public EmisTmsSiteBatchMiss selectEmisTmsSiteBatchMissById(Long id);
|
||||
|
||||
/**
|
||||
* 查询TMS漏组批次信息列表
|
||||
*
|
||||
* @param emisTmsSiteBatchMiss TMS漏组批次信息
|
||||
* @return TMS漏组批次信息集合
|
||||
*/
|
||||
public List<EmisTmsSiteBatchMiss> selectEmisTmsSiteBatchMissList(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss);
|
||||
|
||||
/**
|
||||
* 新增TMS漏组批次信息
|
||||
*
|
||||
* @param emisTmsSiteBatchMiss TMS漏组批次信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmisTmsSiteBatchMiss(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss);
|
||||
|
||||
/**
|
||||
* 修改TMS漏组批次信息
|
||||
*
|
||||
* @param emisTmsSiteBatchMiss TMS漏组批次信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmisTmsSiteBatchMiss(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss);
|
||||
|
||||
/**
|
||||
* 批量删除TMS漏组批次信息
|
||||
*
|
||||
* @param ids 需要删除的TMS漏组批次信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisTmsSiteBatchMissByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除TMS漏组批次信息信息
|
||||
*
|
||||
* @param id TMS漏组批次信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisTmsSiteBatchMissById(Long id);
|
||||
|
||||
/**
|
||||
* 定时扫描运单货物组批次是否正确录入
|
||||
*
|
||||
*/
|
||||
void autoScanSiteBatch();
|
||||
}
|
||||
@ -0,0 +1,750 @@
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.xdadan.erp.common.utils.SecurityUtils;
|
||||
import com.xdadan.erp.emis.domain.*;
|
||||
import com.xdadan.erp.emis.mapper.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xdadan.erp.emis.service.IEmisTmsSiteBatchMissService;
|
||||
|
||||
import static com.xdadan.erp.common.utils.SecurityUtils.getLoginUser;
|
||||
|
||||
/**
|
||||
* TMS漏组批次信息Service业务层处理
|
||||
*
|
||||
* @author heyu
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class EmisTmsSiteBatchMissServiceImpl implements IEmisTmsSiteBatchMissService {
|
||||
|
||||
@Autowired
|
||||
private EmisTmsSiteBatchMissMapper emisTmsSiteBatchMissMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisTransLineMapper emisTransLineMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisTransPlanRuleMapper emisTransPlanRuleMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisWaybillBatchStatusMapper emisWaybillBatchStatusMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisWaybillMapper emisWaybillMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisTmsSiteBatchMapper emisTmsSiteBatchMapper;
|
||||
|
||||
private int totalBatchStatusRecords = 0;
|
||||
private int totalMissRecords = 0;
|
||||
|
||||
/**
|
||||
* 查询TMS漏组批次信息
|
||||
*
|
||||
* @param id TMS漏组批次信息主键
|
||||
* @return TMS漏组批次信息
|
||||
*/
|
||||
@Override
|
||||
public EmisTmsSiteBatchMiss selectEmisTmsSiteBatchMissById(Long id) {
|
||||
log.info("Selecting TMS site batch miss by id: {}", id);
|
||||
return emisTmsSiteBatchMissMapper.selectEmisTmsSiteBatchMissById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询TMS漏组批次信息列表
|
||||
*
|
||||
* @param emisTmsSiteBatchMiss TMS漏组批次信息
|
||||
* @return TMS漏组批次信息
|
||||
*/
|
||||
@Override
|
||||
public List<EmisTmsSiteBatchMiss> selectEmisTmsSiteBatchMissList(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss) {
|
||||
log.info("Selecting TMS site batch miss list with params: {}", emisTmsSiteBatchMiss);
|
||||
return emisTmsSiteBatchMissMapper.selectEmisTmsSiteBatchMissList(emisTmsSiteBatchMiss);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增TMS漏组批次信息
|
||||
*
|
||||
* @param emisTmsSiteBatchMiss TMS漏组批次信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEmisTmsSiteBatchMiss(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss) {
|
||||
log.info("Inserting new TMS site batch miss: {}", emisTmsSiteBatchMiss);
|
||||
return emisTmsSiteBatchMissMapper.insertEmisTmsSiteBatchMiss(emisTmsSiteBatchMiss);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改TMS漏组批次信息
|
||||
*
|
||||
* @param emisTmsSiteBatchMiss TMS漏组批次信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEmisTmsSiteBatchMiss(EmisTmsSiteBatchMiss emisTmsSiteBatchMiss) {
|
||||
log.info("Updating TMS site batch miss: {}", emisTmsSiteBatchMiss);
|
||||
return emisTmsSiteBatchMissMapper.updateEmisTmsSiteBatchMiss(emisTmsSiteBatchMiss);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除TMS漏组批次信息
|
||||
*
|
||||
* @param ids 需要删除的TMS漏组批次信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmisTmsSiteBatchMissByIds(Long[] ids) {
|
||||
log.info("Deleting TMS site batch miss by ids: {}", ids);
|
||||
return emisTmsSiteBatchMissMapper.deleteEmisTmsSiteBatchMissByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除TMS漏组批次信息信息
|
||||
*
|
||||
* @param id TMS漏组批次信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmisTmsSiteBatchMissById(Long id) {
|
||||
log.info("Deleting TMS site batch miss by id: {}", id);
|
||||
return emisTmsSiteBatchMissMapper.deleteEmisTmsSiteBatchMissById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void autoScanSiteBatch() {
|
||||
try {
|
||||
emisTmsSiteBatchMissMapper.deleteAll();
|
||||
long startTime = System.currentTimeMillis();
|
||||
int pageSize = 1000;
|
||||
int offset = 0;
|
||||
int totalProcessed = 0;
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
List<String> failedBillCodes = new ArrayList<>();
|
||||
|
||||
// 获取所有线路规划
|
||||
List<EmisTransPlanRule> treeRules = this.selectEmisTransPlanRuleTree();
|
||||
if (treeRules.isEmpty()) {
|
||||
log.info("No trans plan rules found, skip auto scan");
|
||||
return;
|
||||
}
|
||||
|
||||
// 按线路编码分组
|
||||
Map<String, EmisTransPlanRule> transPlanRulesByLineCode = new HashMap<>();
|
||||
treeRules.stream().filter(Objects::nonNull).forEach(i -> {
|
||||
transPlanRulesByLineCode.put(i.getLineCode(), i);
|
||||
});
|
||||
|
||||
// 创建线程池
|
||||
int processors = Runtime.getRuntime().availableProcessors();
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(processors);
|
||||
List<Future<List<EmisWaybill>>> futures = new ArrayList<>();
|
||||
|
||||
// 先查询所有数据
|
||||
while (true) {
|
||||
List<EmisWaybill> waybills = emisWaybillMapper.selectWaybillListBySiteBatchStatus(offset, pageSize);
|
||||
if (waybills.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
futures.add(executorService.submit(() -> waybills));
|
||||
offset += pageSize;
|
||||
}
|
||||
|
||||
// 等待所有查询完成并收集结果
|
||||
List<EmisWaybill> allWaybills = new ArrayList<>();
|
||||
for (Future<List<EmisWaybill>> future : futures) {
|
||||
try {
|
||||
List<EmisWaybill> waybills = future.get();
|
||||
allWaybills.addAll(waybills);
|
||||
totalProcessed += waybills.size();
|
||||
} catch (Exception e) {
|
||||
log.error("Error getting waybill results", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭线程池
|
||||
executorService.shutdown();
|
||||
|
||||
// 按1000条数据分组处理
|
||||
List<List<EmisWaybill>> batches = new ArrayList<>();
|
||||
for (int i = 0; i < allWaybills.size(); i += pageSize) {
|
||||
int end = Math.min(i + pageSize, allWaybills.size());
|
||||
batches.add(allWaybills.subList(i, end));
|
||||
}
|
||||
|
||||
// 创建新的线程池处理数据
|
||||
executorService = Executors.newFixedThreadPool(processors);
|
||||
List<Future<ProcessResult>> processFutures = new ArrayList<>();
|
||||
|
||||
for (List<EmisWaybill> batch : batches) {
|
||||
processFutures.add(executorService.submit(() -> processWaybillBatch(batch, transPlanRulesByLineCode)));
|
||||
}
|
||||
|
||||
// 收集处理结果
|
||||
for (Future<ProcessResult> future : processFutures) {
|
||||
try {
|
||||
ProcessResult result = future.get();
|
||||
successCount += result.getSuccessCount();
|
||||
failCount += result.getFailCount();
|
||||
failedBillCodes.addAll(result.getFailedBillCodes());
|
||||
|
||||
// 批量插入运单组批次状态记录
|
||||
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) {
|
||||
log.error("Error processing batch", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 关闭线程池
|
||||
executorService.shutdown();
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
log.info(
|
||||
"Auto scan completed. Total processed: {}, Success: {}, Failed: {}, Time taken: {}ms, Batch status records: {}, Miss records: {}",
|
||||
totalProcessed, successCount, failCount, (endTime - startTime),
|
||||
totalBatchStatusRecords, totalMissRecords);
|
||||
if (CollectionUtil.isNotEmpty(failedBillCodes)) {
|
||||
log.warn("Failed bill codes: {}", failedBillCodes);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Error in autoScanSiteBatch", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ProcessResult {
|
||||
private final int successCount;
|
||||
private final int failCount;
|
||||
private final List<String> failedBillCodes;
|
||||
private final List<EmisWaybillBatchStatus> batchStatusList;
|
||||
private final List<EmisTmsSiteBatchMiss> missRecords;
|
||||
|
||||
public ProcessResult(int successCount, int failCount, List<String> failedBillCodes,
|
||||
List<EmisWaybillBatchStatus> batchStatusList, List<EmisTmsSiteBatchMiss> missRecords) {
|
||||
this.successCount = successCount;
|
||||
this.failCount = failCount;
|
||||
this.failedBillCodes = failedBillCodes;
|
||||
this.batchStatusList = batchStatusList;
|
||||
this.missRecords = missRecords;
|
||||
}
|
||||
|
||||
public int getSuccessCount() {
|
||||
return successCount;
|
||||
}
|
||||
|
||||
public int getFailCount() {
|
||||
return failCount;
|
||||
}
|
||||
|
||||
public List<String> getFailedBillCodes() {
|
||||
return failedBillCodes;
|
||||
}
|
||||
|
||||
public List<EmisWaybillBatchStatus> getBatchStatusList() {
|
||||
return batchStatusList;
|
||||
}
|
||||
|
||||
public List<EmisTmsSiteBatchMiss> getMissRecords() {
|
||||
return missRecords;
|
||||
}
|
||||
}
|
||||
|
||||
private ProcessResult processWaybillBatch(List<EmisWaybill> waybills,
|
||||
Map<String, EmisTransPlanRule> transPlanRulesByLineCode) {
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
List<String> failedBillCodes = new ArrayList<>();
|
||||
List<EmisTmsSiteBatchMiss> missRecords = new ArrayList<>();
|
||||
List<EmisWaybillBatchStatus> batchStatusList = new ArrayList<>();
|
||||
|
||||
// 获取所有运单号
|
||||
List<String> billCodes = waybills.stream()
|
||||
.map(EmisWaybill::getBillCode)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 一次性查询所有运单对应的组批次信息
|
||||
List<EmisTmsSiteBatch> siteBatches = emisTmsSiteBatchMapper
|
||||
.selectEmisTmsSiteBatchListByBillCodes(billCodes);
|
||||
|
||||
// 按运单号分组
|
||||
Map<String, List<EmisTmsSiteBatch>> siteBatchesByBillCode = new HashMap<>();
|
||||
for (EmisTmsSiteBatch batch : siteBatches) {
|
||||
if (batch.getBatchDtlList() != null) {
|
||||
for (EmisTmsSiteBatchDtl dtl : batch.getBatchDtlList()) {
|
||||
siteBatchesByBillCode.computeIfAbsent(dtl.getBillCode(), k -> new ArrayList<>()).add(batch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (EmisWaybill waybill : waybills) {
|
||||
try {
|
||||
// 获取运单对应的线路规划
|
||||
EmisTransPlanRule emisTransPlanRule = transPlanRulesByLineCode.get(waybill.getTransLineType());
|
||||
if (Objects.isNull(emisTransPlanRule)) {
|
||||
// 创建漏组记录
|
||||
EmisTmsSiteBatchMiss miss = createMissRecord(waybill);
|
||||
miss.setMissReason("当前线路没有创建对应的线路规划");
|
||||
missRecords.add(miss);
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// 获取运单对应的组批次信息
|
||||
List<EmisTmsSiteBatch> waybillBatches = siteBatchesByBillCode.get(waybill.getBillCode());
|
||||
if (CollectionUtil.isEmpty(waybillBatches)) {
|
||||
// 创建漏组记录
|
||||
EmisTmsSiteBatchMiss miss = createMissRecord(waybill);
|
||||
miss.setMissReason("当前运单没有组批次");
|
||||
miss.setTransPlanRuleId(emisTransPlanRule.getId());
|
||||
missRecords.add(miss);
|
||||
successCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// 合并相同起始网点和下一网点的批次
|
||||
Map<String, EmisTmsSiteBatch> mergedBatches = new HashMap<>();
|
||||
for (EmisTmsSiteBatch batch : waybillBatches) {
|
||||
String key = batch.getStartSiteCode() + "_" + batch.getNextSiteCode();
|
||||
if (mergedBatches.containsKey(key)) {
|
||||
EmisTmsSiteBatch existingBatch = mergedBatches.get(key);
|
||||
String existingSupplier = existingBatch.getSupplierCode();
|
||||
String newSupplier = batch.getSupplierCode();
|
||||
if (!existingSupplier.equals(newSupplier)) {
|
||||
existingBatch.setSupplierCode(existingSupplier + "," + newSupplier);
|
||||
}
|
||||
} else {
|
||||
mergedBatches.put(key, batch);
|
||||
}
|
||||
}
|
||||
waybillBatches = new ArrayList<>(mergedBatches.values());
|
||||
|
||||
// 检查运单是否匹配线路规划树
|
||||
boolean isAnyBranchMatched = checkBranchMatch(emisTransPlanRule, waybillBatches, waybill,
|
||||
missRecords);
|
||||
|
||||
if (isAnyBranchMatched) {
|
||||
// 创建批次状态记录
|
||||
EmisWaybillBatchStatus batchStatus = new EmisWaybillBatchStatus();
|
||||
batchStatus.setBillCode(waybill.getBillCode());
|
||||
batchStatus.setSiteBatchStatus("1"); // 1表示匹配成功
|
||||
Date now = new Date();
|
||||
batchStatus.setCreateBy("system");
|
||||
batchStatus.setCreateTime(now);
|
||||
batchStatusList.add(batchStatus);
|
||||
}
|
||||
successCount++;
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to process waybill: {}", waybill.getBillCode(), e);
|
||||
failCount++;
|
||||
failedBillCodes.add(waybill.getBillCode());
|
||||
}
|
||||
}
|
||||
|
||||
return new ProcessResult(successCount, failCount, failedBillCodes, batchStatusList, missRecords);
|
||||
}
|
||||
|
||||
public List<EmisTransPlanRule> selectEmisTransPlanRuleTree() {
|
||||
log.info("Start querying supplier route plan tree");
|
||||
List<EmisTransPlanRule> list = emisTransPlanRuleMapper.getEmisTransPlanRuleList(new EmisTransPlanRule());
|
||||
setName(list);
|
||||
List<EmisTransPlanRule> tree = buildTree(list);
|
||||
log.info("Queried supplier route plan tree, node count={}", tree != null ? tree.size() : 0);
|
||||
return tree;
|
||||
}
|
||||
|
||||
private void setName(List<EmisTransPlanRule> list) {
|
||||
setSupplierNames(list);
|
||||
setProductTypeNames(list);
|
||||
setLineName(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置供应商名称
|
||||
*/
|
||||
private void setSupplierNames(List<EmisTransPlanRule> rules) {
|
||||
if (rules == null || rules.isEmpty()) {
|
||||
log.info("Setting supplier names: rules list is empty");
|
||||
return;
|
||||
}
|
||||
// 收集所有需要查询的供应商编码
|
||||
List<String> supplierCodes = rules.stream()
|
||||
.map(EmisTransPlanRule::getSupplierCode)
|
||||
.filter(org.springframework.util.StringUtils::hasText)
|
||||
.flatMap(code -> Arrays.stream(code.split(",")))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
log.info("Setting supplier names: code count={}, codes={}", supplierCodes.size(), supplierCodes);
|
||||
|
||||
if (!supplierCodes.isEmpty()) {
|
||||
// 批量查询供应商信息
|
||||
List<Map<String, String>> supplierInfos = emisTransPlanRuleMapper.selectSupplierInfoByCodes(supplierCodes);
|
||||
log.info("Setting supplier names: found supplier info count={}",
|
||||
supplierInfos != null ? supplierInfos.size() : 0);
|
||||
|
||||
if (supplierInfos != null && !supplierInfos.isEmpty()) {
|
||||
// 创建供应商编码到名称的映射
|
||||
Map<String, String> supplierCodeToNameMap = supplierInfos.stream()
|
||||
.collect(Collectors.toMap(
|
||||
info -> info.get("code"),
|
||||
info -> info.get("name"),
|
||||
(existing, replacement) -> existing));
|
||||
|
||||
log.info("Setting supplier names: code to name mapping count={}", supplierCodeToNameMap.size());
|
||||
|
||||
// 设置供应商名称
|
||||
rules.forEach(rule -> {
|
||||
if (org.springframework.util.StringUtils.hasText(rule.getSupplierCode())) {
|
||||
String names = Arrays.stream(rule.getSupplierCode().split(","))
|
||||
.map(code -> supplierCodeToNameMap.getOrDefault(code, ""))
|
||||
.filter(org.springframework.util.StringUtils::hasText)
|
||||
.collect(Collectors.joining(","));
|
||||
rule.setSupplierName(names);
|
||||
log.debug("Setting supplier name: id={}, supplierCode={}, supplierName={}",
|
||||
rule.getId(), rule.getSupplierCode(), names);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置产品类型名称
|
||||
*/
|
||||
private void setProductTypeNames(List<EmisTransPlanRule> rules) {
|
||||
if (rules == null || rules.isEmpty()) {
|
||||
log.info("Setting product type names: rules list is empty");
|
||||
return;
|
||||
}
|
||||
// 收集所有需要查询的产品类型编码
|
||||
List<String> productTypes = rules.stream()
|
||||
.map(EmisTransPlanRule::getProductType)
|
||||
.filter(org.springframework.util.StringUtils::hasText)
|
||||
.flatMap(type -> Arrays.stream(type.split(",")))
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
log.info("Setting product type names: code count={}, codes={}", productTypes.size(), productTypes);
|
||||
|
||||
if (!productTypes.isEmpty()) {
|
||||
// 批量查询产品类型信息
|
||||
List<Map<String, String>> productTypeInfos = emisTransPlanRuleMapper
|
||||
.selectProductTypeInfoByCodes(productTypes);
|
||||
log.info("Setting product type names: found product type info count={}",
|
||||
productTypeInfos != null ? productTypeInfos.size() : 0);
|
||||
|
||||
if (productTypeInfos != null && !productTypeInfos.isEmpty()) {
|
||||
// 创建产品类型编码到名称的映射
|
||||
Map<String, String> productTypeToNameMap = productTypeInfos.stream()
|
||||
.collect(Collectors.toMap(
|
||||
info -> info.get("code"),
|
||||
info -> info.get("name"),
|
||||
(existing, replacement) -> existing));
|
||||
|
||||
log.info("Setting product type names: code to name mapping count={}", productTypeToNameMap.size());
|
||||
|
||||
// 设置产品类型名称
|
||||
rules.forEach(rule -> {
|
||||
if (org.springframework.util.StringUtils.hasText(rule.getProductType())) {
|
||||
String names = Arrays.stream(rule.getProductType().split(","))
|
||||
.map(code -> productTypeToNameMap.getOrDefault(code, ""))
|
||||
.filter(org.springframework.util.StringUtils::hasText)
|
||||
.collect(Collectors.joining(","));
|
||||
rule.setProductTypeName(names);
|
||||
log.debug("Setting product type name: id={}, productType={}, productTypeName={}",
|
||||
rule.getId(), rule.getProductType(), names);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置线路名称
|
||||
*/
|
||||
private void setLineName(List<EmisTransPlanRule> rules) {
|
||||
if (rules == null || rules.isEmpty()) {
|
||||
log.info("Setting line names: rules list is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
// 收集所有需要查询的线路编码
|
||||
List<String> lineCodes = rules.stream()
|
||||
.map(EmisTransPlanRule::getLineCode)
|
||||
.filter(org.springframework.util.StringUtils::hasText)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
log.info("Setting line names: code count={}, codes={}", lineCodes.size(), lineCodes);
|
||||
|
||||
if (!lineCodes.isEmpty()) {
|
||||
// 批量查询线路信息
|
||||
List<EmisTransLine> lines = emisTransLineMapper.selectEmisTransLineList(
|
||||
new EmisTransLine() {
|
||||
{
|
||||
setLineCode(String.join(",", lineCodes));
|
||||
}
|
||||
});
|
||||
|
||||
log.info("Setting line names: found line info count={}", lines != null ? lines.size() : 0);
|
||||
|
||||
if (lines != null && !lines.isEmpty()) {
|
||||
// 创建线路编码到线路名称的映射
|
||||
Map<String, String> lineCodeToNameMap = lines.stream()
|
||||
.collect(Collectors.toMap(
|
||||
EmisTransLine::getLineCode,
|
||||
EmisTransLine::getLineName,
|
||||
(existing, replacement) -> existing));
|
||||
|
||||
log.info("Setting line names: code to name mapping count={}", lineCodeToNameMap.size());
|
||||
|
||||
// 设置线路名称
|
||||
rules.forEach(rule -> {
|
||||
if (org.springframework.util.StringUtils.hasText(rule.getLineCode())) {
|
||||
String name = lineCodeToNameMap.get(rule.getLineCode());
|
||||
rule.setLineName(name);
|
||||
log.debug("Setting line name: id={}, lineCode={}, lineName={}",
|
||||
rule.getId(), rule.getLineCode(), name);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建树形结构
|
||||
*/
|
||||
private List<EmisTransPlanRule> buildTree(List<EmisTransPlanRule> allRules) {
|
||||
log.debug("Start building tree structure, node count={}", allRules != null ? allRules.size() : 0);
|
||||
if (allRules == null || allRules.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 使用 Map 存储 ID 到节点的映射,方便查找父节点
|
||||
Map<Long, EmisTransPlanRule> map = allRules.stream()
|
||||
.collect(Collectors.toMap(EmisTransPlanRule::getId, rule -> rule));
|
||||
|
||||
List<EmisTransPlanRule> tree = new ArrayList<>();
|
||||
for (EmisTransPlanRule rule : allRules) {
|
||||
EmisTransPlanRule parent = map.get(rule.getParentId());
|
||||
// 如果 parent 不为 null 且在当前查询结果中,则添加到父节点的 children 列表
|
||||
if (parent != null) {
|
||||
if (parent.getChildren() == null) {
|
||||
parent.setChildren(new ArrayList<>());
|
||||
}
|
||||
parent.getChildren().add(rule);
|
||||
log.debug("Adding child node, parentId={}, childId={}", parent.getId(), rule.getId());
|
||||
}
|
||||
// 否则,如果 parentId 为 0 或者父节点不在当前查询结果中,则认为是根节点
|
||||
else if (rule.getParentId() == null || rule.getParentId() == 0L || !map.containsKey(rule.getParentId())) {
|
||||
tree.add(rule);
|
||||
log.debug("Adding root node, ID={}", rule.getId());
|
||||
}
|
||||
}
|
||||
log.debug("Built tree structure, root node count={}", tree.size());
|
||||
return tree;
|
||||
}
|
||||
|
||||
private EmisTmsSiteBatchMiss createMissRecord(EmisWaybill waybill) {
|
||||
EmisTmsSiteBatchMiss miss = new EmisTmsSiteBatchMiss();
|
||||
miss.setBillCode(waybill.getBillCode());
|
||||
Date now = new Date();
|
||||
miss.setCreateBy("system");
|
||||
miss.setCreateTime(now);
|
||||
return miss;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查一个分支是否完全匹配
|
||||
*
|
||||
* @param waybillBatches 运单批次列表
|
||||
* @param waybill
|
||||
* @param missRecords
|
||||
* @return 是否匹配
|
||||
*/
|
||||
private boolean checkBranchMatch(EmisTransPlanRule emisTransPlanRule, List<EmisTmsSiteBatch> waybillBatches,
|
||||
EmisWaybill waybill, List<EmisTmsSiteBatchMiss> missRecords) {
|
||||
// 检查当前节点是否匹配
|
||||
boolean allNodeMatched = false;
|
||||
List<EmisTransPlanRule> children1 = emisTransPlanRule.getChildren();
|
||||
if (children1.isEmpty()) {
|
||||
// 创建漏组记录
|
||||
EmisTmsSiteBatchMiss miss = createMissRecord(waybill);
|
||||
miss.setMissReason("当前线路没有创建对应的线路规划");
|
||||
missRecords.add(miss);
|
||||
return false;
|
||||
}
|
||||
List<EmisTransPlanRule> children2 = children1.stream()
|
||||
.filter(i -> StringUtils.isNotBlank(i.getProductType())
|
||||
&& i.getProductType().contains(waybill.getProductType()))
|
||||
.collect(Collectors.toList());
|
||||
if (children2.isEmpty() || children2.get(0) == null || children2.get(0).getChildren().isEmpty()) {
|
||||
// 创建漏组记录
|
||||
EmisTmsSiteBatchMiss miss = createMissRecord(waybill);
|
||||
miss.setMissReason("当前线路没有创建对应的线路规划");
|
||||
missRecords.add(miss);
|
||||
return false;
|
||||
}
|
||||
List<EmisTransPlanRule> rules = children2.get(0).getChildren();
|
||||
List<EmisTransPlanRule> filterRules = Lists.newArrayList();
|
||||
for (EmisTransPlanRule rule : rules) {
|
||||
List<EmisTransPlanRule> list = Lists.newArrayList();
|
||||
if (checkRule(rule, waybillBatches, list)) {
|
||||
allNodeMatched = true;
|
||||
break;
|
||||
}
|
||||
if (list.size() > filterRules.size()) {
|
||||
filterRules = list;
|
||||
}
|
||||
}
|
||||
if (allNodeMatched) {
|
||||
return allNodeMatched;
|
||||
}
|
||||
if (CollectionUtil.isEmpty(filterRules)) {
|
||||
// 创建漏组记录
|
||||
EmisTmsSiteBatchMiss miss = createMissRecord(waybill);
|
||||
miss.setMissReason("该运单所有组批次信息都不匹配,请仔细核对");
|
||||
missRecords.add(miss);
|
||||
return false;
|
||||
}
|
||||
EmisTransPlanRule filterRule = filterRules.get(0);
|
||||
String[] ancestors = filterRule.getAncestors().split(",");
|
||||
Long ancestor;
|
||||
if (ancestors.length > 3) {
|
||||
ancestor = Long.valueOf(ancestors[3]);
|
||||
} else {
|
||||
ancestor = filterRule.getId();
|
||||
}
|
||||
|
||||
List<EmisTransPlanRule> ruleList = rules.stream().filter(i -> i.getId().equals(ancestor))
|
||||
.collect(Collectors.toList());
|
||||
EmisTransPlanRule rule = ruleList.get(0);
|
||||
setMissRecords(missRecords, rule, filterRules, waybill);
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean checkRule(EmisTransPlanRule rule, List<EmisTmsSiteBatch> waybillBatches,
|
||||
List<EmisTransPlanRule> list) {
|
||||
// 检查当前节点是否匹配
|
||||
boolean currentMatch = false;
|
||||
for (EmisTmsSiteBatch batch : waybillBatches) {
|
||||
if (rule.getStartSiteCode().equals(batch.getStartSiteCode()) &&
|
||||
rule.getNextSiteCode().equals(batch.getNextSiteCode()) &&
|
||||
rule.getSupplierCode().equals(batch.getSupplierCode())) {
|
||||
currentMatch = true;
|
||||
list.add(rule);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果是叶子节点,直接返回当前节点是否匹配
|
||||
if (CollectionUtil.isEmpty(rule.getChildren())) {
|
||||
return currentMatch;
|
||||
}
|
||||
|
||||
// 检查所有子节点,只要有一条路径匹配就返回true
|
||||
for (EmisTransPlanRule childRule : rule.getChildren()) {
|
||||
if (checkRule(childRule, waybillBatches, list)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果当前节点不匹配,或者所有子节点都不匹配,返回false
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setMissRecords(List<EmisTmsSiteBatchMiss> missRecords, EmisTransPlanRule rule,
|
||||
List<EmisTransPlanRule> filterRules, EmisWaybill waybill) {
|
||||
// 检查当前节点是否在filterRules中
|
||||
boolean isMatched = filterRules.stream()
|
||||
.anyMatch(filterRule -> filterRule.getStartSiteCode().equals(rule.getStartSiteCode()) &&
|
||||
filterRule.getNextSiteCode().equals(rule.getNextSiteCode()) &&
|
||||
filterRule.getSupplierCode().equals(rule.getSupplierCode()));
|
||||
|
||||
if (!isMatched) {
|
||||
// 创建漏组记录
|
||||
EmisTmsSiteBatchMiss miss = createMissRecord(waybill);
|
||||
miss.setMissReason(String.format("组批次有遗漏/错误,请根据推荐路线排查,推荐路线: %s-%s-%s",
|
||||
rule.getStartSiteName(),
|
||||
rule.getNextSiteName(),
|
||||
rule.getSupplierName()));
|
||||
miss.setTransPlanRuleId(rule.getId());
|
||||
missRecords.add(miss);
|
||||
}
|
||||
|
||||
List<EmisTransPlanRule> childrens = rule.getChildren();
|
||||
if (CollectionUtil.isEmpty(childrens)) {
|
||||
return;
|
||||
}
|
||||
// 递归处理子节点
|
||||
checkChildrens(missRecords, childrens, filterRules, waybill);
|
||||
}
|
||||
|
||||
private void checkChildrens(List<EmisTmsSiteBatchMiss> missRecords, List<EmisTransPlanRule> childrens,
|
||||
List<EmisTransPlanRule> filterRules, EmisWaybill waybill) {
|
||||
// 检查子节点是否至少有一个匹配
|
||||
boolean hasMatchedChild = childrens.stream()
|
||||
.anyMatch(childRule -> filterRules.stream()
|
||||
.anyMatch(
|
||||
filterRule -> filterRule.getStartSiteCode().equals(childRule.getStartSiteCode()) &&
|
||||
filterRule.getNextSiteCode().equals(childRule.getNextSiteCode()) &&
|
||||
filterRule.getSupplierCode().equals(childRule.getSupplierCode())));
|
||||
|
||||
if (!hasMatchedChild) {
|
||||
// 如果所有子节点都不匹配,为每个子节点创建漏组记录
|
||||
StringBuilder missReason = new StringBuilder("组批次有遗漏/错误,请根据推荐路线排查,推荐路线: ");
|
||||
for (int i = 0; i < childrens.size(); i++) {
|
||||
EmisTransPlanRule childRule = childrens.get(i);
|
||||
if (i > 0) {
|
||||
missReason.append(" 或 ");
|
||||
}
|
||||
missReason.append(String.format("%s-%s-%s",
|
||||
childRule.getStartSiteName(),
|
||||
childRule.getNextSiteName(),
|
||||
childRule.getSupplierName()));
|
||||
}
|
||||
|
||||
// 创建漏组记录
|
||||
EmisTmsSiteBatchMiss miss = createMissRecord(waybill);
|
||||
miss.setMissReason(missReason.toString());
|
||||
miss.setTransPlanRuleId(childrens.get(0).getId());
|
||||
missRecords.add(miss);
|
||||
}
|
||||
|
||||
// 递归处理所有子节点
|
||||
for (EmisTransPlanRule child : childrens) {
|
||||
List<EmisTransPlanRule> childList = child.getChildren();
|
||||
if (!CollectionUtil.isEmpty(childList)) {
|
||||
checkChildrens(missRecords, childList, filterRules, waybill);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -178,4 +178,12 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据批次号查询批次明细 -->
|
||||
<select id="selectEmisTmsSiteBatchDtlByBatchNo" parameterType="String" resultMap="EmisTmsSiteBatchDtlResult">
|
||||
select id, bill_code, batch_no, scan_date, scan_status, group_status, scan_man, scan_site, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_tms_site_batch_dtl
|
||||
where batch_no = #{batchNo}
|
||||
and del_flag = '0'
|
||||
</select>
|
||||
</mapper>
|
||||
@ -46,7 +46,18 @@
|
||||
<association property="startSiteName" column="start_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
|
||||
<association property="nextSiteName" column="next_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
|
||||
|
||||
|
||||
<!-- 批次明细列表 -->
|
||||
<collection property="batchDtlList" ofType="EmisTmsSiteBatchDtl" select="com.xdadan.erp.emis.mapper.EmisTmsSiteBatchDtlMapper.selectEmisTmsSiteBatchDtlByBatchNo" column="batch_no">
|
||||
<result property="id" column="id"/>
|
||||
<result property="billCode" column="bill_code"/>
|
||||
<result property="batchNo" column="batch_no"/>
|
||||
<result property="scanDate" column="scan_date"/>
|
||||
<result property="scanStatus" column="scan_status"/>
|
||||
<result property="groupStatus" column="group_status"/>
|
||||
<result property="scanMan" column="scan_man"/>
|
||||
<result property="scanSite" column="scan_site"/>
|
||||
<association property="waybillDetail" column="bill_code" select="com.xdadan.erp.emis.mapper.EmisWaybillMapper.selectWaybillBaseInfoByBillCode"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisTmsSiteBatchVo">
|
||||
@ -351,4 +362,17 @@
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据运单号列表查询组批次信息 -->
|
||||
<select id="selectEmisTmsSiteBatchListByBillCodes" resultMap="EmisTmsSiteBatchResult">
|
||||
select distinct b.*
|
||||
from emis_tms_site_batch b
|
||||
inner join emis_tms_site_batch_dtl d on b.batch_no = d.batch_no
|
||||
where d.bill_code in
|
||||
<foreach collection="billCodes" item="billCode" open="(" separator="," close=")">
|
||||
#{billCode}
|
||||
</foreach>
|
||||
and b.del_flag = '0'
|
||||
and d.del_flag = '0'
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xdadan.erp.emis.mapper.EmisTmsSiteBatchMissMapper">
|
||||
|
||||
<resultMap type="EmisTmsSiteBatchMiss" id="EmisTmsSiteBatchMissResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="billCode" column="bill_code"/>
|
||||
<result property="manager" column="manager"/>
|
||||
<result property="missReason" column="miss_reason"/>
|
||||
<result property="sendSiteCode" column="send_site_code"/>
|
||||
<result property="sendSiteName" column="send_site_name"/>
|
||||
<result property="sendCountry" column="send_country"/>
|
||||
<result property="sendCountryName" column="send_country_name"/>
|
||||
<result property="destinationCode" column="destination_code"/>
|
||||
<result property="destinationName" column="destination_name"/>
|
||||
<result property="receiveCountry" column="receive_country"/>
|
||||
<result property="receiveCountryName" column="receive_country_name"/>
|
||||
<result property="sendDate" column="send_date"/>
|
||||
<result property="blSign" column="bl_sign"/>
|
||||
<result property="signDate" column="sign_date"/>
|
||||
<result property="transLineType" column="trans_line_type"/>
|
||||
<result property="transLineTypeName" column="trans_line_type_name"/>
|
||||
<result property="productType" column="product_type"/>
|
||||
<result property="productTypeName" column="product_type_name"/>
|
||||
<result property="paymentType" column="payment_type"/>
|
||||
<result property="parcelQty" column="parcel_qty"/>
|
||||
<result property="billWeight" column="bill_weight"/>
|
||||
<result property="totalVolume" column="total_volume"/>
|
||||
<result property="volumeWeight" column="volume_weight"/>
|
||||
<result property="settlementWeight" column="settlement_weight"/>
|
||||
<result property="freight" column="freight"/>
|
||||
<result property="waybillRemark" column="waybill_remark"/>
|
||||
<result property="feeRemark" column="fee_remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisTmsSiteBatchMissVo">
|
||||
select
|
||||
m.id, m.bill_code, m.miss_reason, m.create_by, m.create_time, m.update_by, m.update_time, m.remark, m.del_flag,
|
||||
w.send_site_code, s.site_name as send_site_name, w.send_country, c1.name as send_country_name, w.destination_code, n.dest_name as destination_name,
|
||||
w.receive_country, c2.name as receive_country_name, w.send_date, w.bl_sign, w.sign_date, w.trans_line_type, k.line_name as trans_line_type_name,
|
||||
w.product_type, j.prod_name as product_type_name, w.payment_type, w.parcel_qty, w.bill_weight, w.total_volume, w.volume_weight,
|
||||
w.settlement_weight, w.freight, w.remark as waybill_remark, w.fee_remark, r.manager
|
||||
from emis_tms_site_batch_miss m
|
||||
left join emis_waybill w on m.bill_code = w.bill_code and w.del_flag='0'
|
||||
left join emis_site s on w.send_site_code=s.site_code and s.del_flag=0
|
||||
left join emis_country c1 on w.send_country=c1.code and c1.del_flag='0'
|
||||
left join emis_country c2 on w.receive_country=c2.code and c2.del_flag='0'
|
||||
left join emis_destination n on w.destination_code=n.dest_code and n.del_flag='0'
|
||||
left join emis_trans_line k on w.trans_line_type=k.line_code and k.del_flag='0'
|
||||
left join emis_trans_product j on w.product_type=j.prod_code and j.del_flag='0'
|
||||
left join emis_trans_plan_rule r on m.trans_plan_rule_id=r.id and r.del_flag='0'
|
||||
</sql>
|
||||
|
||||
<select id="selectEmisTmsSiteBatchMissList" parameterType="EmisTmsSiteBatchMiss" resultMap="EmisTmsSiteBatchMissResult">
|
||||
<include refid="selectEmisTmsSiteBatchMissVo"/>
|
||||
<where>
|
||||
m.del_flag = '0'
|
||||
<if test="billCode != null and billCode != ''">
|
||||
AND m.bill_code = #{billCode}
|
||||
</if>
|
||||
<if test="missReason != null and missReason != ''">
|
||||
AND m.miss_reason like concat('%', #{missReason}, '%')
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND r.manager like concat('%', #{manager}, '%')
|
||||
</if>
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and r.manager=#{params.privEmpName}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEmisTmsSiteBatchMissById" parameterType="Long" resultMap="EmisTmsSiteBatchMissResult">
|
||||
<include refid="selectEmisTmsSiteBatchMissVo"/>
|
||||
where m.id = #{id} and m.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertEmisTmsSiteBatchMiss" parameterType="EmisTmsSiteBatchMiss" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into emis_tms_site_batch_miss
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="billCode != null">bill_code,</if>
|
||||
<if test="missReason != null">miss_reason,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="billCode != null">#{billCode},</if>
|
||||
<if test="missReason != null">#{missReason},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEmisTmsSiteBatchMiss" parameterType="EmisTmsSiteBatchMiss">
|
||||
update emis_tms_site_batch_miss
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="billCode != null">bill_code = #{billCode},</if>
|
||||
<if test="missReason != null">miss_reason = #{missReason},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteEmisTmsSiteBatchMissById" parameterType="Long">
|
||||
update emis_tms_site_batch_miss set del_flag = '1' where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteEmisTmsSiteBatchMissByIds" parameterType="String">
|
||||
update emis_tms_site_batch_miss set del_flag = '1' where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="deleteAll">
|
||||
update emis_tms_site_batch_miss set del_flag = '1'
|
||||
</update>
|
||||
|
||||
<insert id="batchInsertEmisTmsSiteBatchMiss" parameterType="java.util.List">
|
||||
insert into emis_tms_site_batch_miss
|
||||
(trans_plan_rule_id,bill_code, create_by, create_time,
|
||||
update_by, update_time, remark,miss_reason)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.transPlanRuleId},#{item.billCode}, #{item.createBy}, #{item.createTime},
|
||||
#{item.updateBy}, #{item.updateTime}, #{item.remark}, #{item.missReason})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
@ -16,13 +16,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="startSiteName" column="start_site_name" />
|
||||
<result property="nextSiteCode" column="next_site_code" />
|
||||
<result property="nextSiteName" column="next_site_name" />
|
||||
<result property="manager" column="manager" />
|
||||
<result property="supplierCode" column="supplier_code" />
|
||||
<result property="status" column="status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisTransPlanRuleVo">
|
||||
select r.id, r.parent_id, r.ancestors, r.line_code, r.trans_type, r.product_type, r.start_site_code,
|
||||
s1.site_name as start_site_name, r.next_site_code, s2.site_name as next_site_name, r.supplier_code,
|
||||
s1.site_name as start_site_name, r.next_site_code, s2.site_name as next_site_name, r.manager, r.supplier_code,
|
||||
r.status, r.remark, r.del_flag, r.create_by, r.create_time, r.update_by, r.update_time, r.create_site, r.update_site
|
||||
from emis_trans_plan_rule r
|
||||
left join emis_site s1 on r.start_site_code = s1.site_code and s1.del_flag=0
|
||||
@ -39,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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="status != null and status != ''"> and r.status = #{status}</if>
|
||||
and r.del_flag = '0'
|
||||
@ -57,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<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="status != null and status != ''"> and r.status = #{status}</if>
|
||||
and r.del_flag = '0'
|
||||
@ -101,6 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="productType != null">product_type,</if>
|
||||
<if test="startSiteCode != null">start_site_code,</if>
|
||||
<if test="nextSiteCode != null">next_site_code,</if>
|
||||
<if test="manager != null">manager,</if>
|
||||
<if test="supplierCode != null">supplier_code,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
@ -120,6 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="productType != null">#{productType},</if>
|
||||
<if test="startSiteCode != null">#{startSiteCode},</if>
|
||||
<if test="nextSiteCode != null">#{nextSiteCode},</if>
|
||||
<if test="manager != null">#{manager},</if>
|
||||
<if test="supplierCode != null">#{supplierCode},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
@ -143,6 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="productType != null">product_type = #{productType},</if>
|
||||
<if test="startSiteCode != null">start_site_code = #{startSiteCode},</if>
|
||||
<if test="nextSiteCode != null">next_site_code = #{nextSiteCode},</if>
|
||||
<if test="manager != null">manager = #{manager},</if>
|
||||
<if test="supplierCode != null">supplier_code = #{supplierCode},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
@ -188,4 +194,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- 根据线路编码查询运输计划规则 -->
|
||||
<select id="selectTransPlanRuleByLineCode" resultMap="EmisTransPlanRuleResult">
|
||||
select *
|
||||
from emis_trans_plan_rule
|
||||
where line_code = #{lineCode}
|
||||
and del_flag = '0'
|
||||
order by order_num asc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -3164,4 +3164,43 @@
|
||||
<insert id="insertBindSalesmen" parameterType="String" >
|
||||
insert into sys_oms_user_bind_emp(customer_code,emp_code) values(#{customerCode}, #{empCode})
|
||||
</insert>
|
||||
|
||||
<select id="selectWaybillListBySiteBatchStatus" resultMap="EmisWaybillResult">
|
||||
select a.id,a.order_sn, a.cust_order_id, a.bill_code, a.order_status, a.waybill_status,
|
||||
a.order_type, a.order_date, a.user_id, a.customer_code, a.customer_name, a.open_id, a.receive_name,
|
||||
a.receive_company, a.receive_mobile, a.receive_tel, a.receive_country, a.receive_province, a.receive_city,
|
||||
a.receive_county, a.receive_town, a.receive_address, a.receive_postcode, a.receive_pcd, a.send_name, a.send_company,
|
||||
a.send_mobile, a.send_tel, a.send_country, a.send_province, a.send_city, a.send_county, a.send_town, a.send_address,
|
||||
a.send_postcode, a.send_pcd, a.payment_type, a.calc_fee_type, a.cust_no, a.cust_name, a.trans_line_type, a.product_type,
|
||||
a.time_type, a.meter_type, a.carry_type, a.customs_clear, a.customs_eclaration, a.estimate_date, a.pack_type, a.dispatch_method,
|
||||
a.pickup_method, a.pick_start_date, a.pick_finish_date, a.pick_fail_reason, a.into_warehouse_code,
|
||||
a.into_warehouse_name, a.into_warehouse_address, a.into_warehouse_contact, a.into_warehouse_phone,
|
||||
a.into_warehouse_bill_code, a.warehouse_in_no, a.customer_delivery_begin_time, a.customer_delivery_end_time,
|
||||
a.goods_type, a.goods_info, a.goods_pics, a.bl_prepare_in_freight, a.prepare_in_est_fee,
|
||||
a.prepare_in_real_fee, a.prepare_in_express, a.prepare_in_bill_code, a.prepare_in_remark,
|
||||
a.prepare_in_supplier, a.total_weight, a.total_volume, a.parcel_qty, a.bill_weight, a.volume_weight, a.currency,
|
||||
a.settlement_weight, a.scan_weight, a.fee_weight, a.freight, a.real_payment_type, a.real_fee, a.bl_special_quote,
|
||||
a.bl_over_long, a.bl_bill, a.bl_bill_text, a.bl_over_weight, a.over_weight_number, a.fee_remark, a.third_code,
|
||||
a.real_value, a.bl_insure, a.insure_value, a.insure_value_currency, a.insure_fee_currency, a.insure_fee, a.insure_remark,
|
||||
a.insure_site_code, a.insure_date, a.bl_print, a.print_man_code, a.print_site, a.print_date, a.print_count, a.bl_disp_fd,
|
||||
a.transfer_code, a.transfer_billcode, a.disp_fd_date, a.disp_fd_reason, a.current_site_code, a.next_site_code, a.last_site_code,
|
||||
a.register_site_code, a.register_date, a.register_man_code, a.take_piece_employee_code, a.send_site_code, a.send_center_code,
|
||||
a.send_date, a.dispatch_man_code, a.dispatch_date, a.dispatch_site_code, a.produce_bill_date, a.produce_bill_site_code,
|
||||
a.produce_bill_man_code, a.destination_code, a.destination_province, a.destination_city, a.destination_county,
|
||||
a.dispatch_underling_site_code, a.destination_center_code, a.market_man_code, a.payee, a.salesmen, a.operate_employee_code,
|
||||
a.bl_is_question, a.problem_type, a.problem_cause, a.problem_delay_days, a.bl_message, a.bl_accept_message, a.bl_gen_subbill,
|
||||
a.bl_sign, a.sign_man, a.sign_man_code, a.sign_site_code, a.sign_date, a.bill_pic_send_rmk, a.bill_pic_dispatch_rmk, a.timezone_offset,
|
||||
a.payment_status, a.payment_date, a.payment_remark, a.order_remark, a.data_from, a.bl_special_goods,a.ext_info,
|
||||
a.remark, a.del_flag, a.create_by,
|
||||
a.create_time, a.update_by, a.update_time, a.create_site, a.update_site,
|
||||
a.cod_fee_desc, a.lading_bill_code, a.company_code, a.departure_port, a.destination_port, a.box_quantity
|
||||
from emis_waybill a
|
||||
left join emis_waybill_batch_status b on a.bill_code = b.bill_code
|
||||
where a.bl_sign = '1'
|
||||
and a.del_flag = '0'
|
||||
-- and a.bill_code="T7080300382673"
|
||||
and (b.site_batch_status is null or b.site_batch_status != '1')
|
||||
order by a.create_time desc
|
||||
limit #{offset}, #{pageSize}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xdadan.erp.emis.mapper.EmisWaybillBatchStatusMapper">
|
||||
|
||||
<resultMap type="com.xdadan.erp.emis.domain.EmisWaybillBatchStatus" id="EmisWaybillBatchStatusResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="billCode" column="bill_code"/>
|
||||
<result property="siteBatchStatus" column="site_batch_status"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisWaybillBatchStatusVo">
|
||||
select id, bill_code, site_batch_status, remark,
|
||||
create_by, create_time, update_by, update_time
|
||||
from emis_waybill_batch_status
|
||||
</sql>
|
||||
|
||||
<insert id="batchInsertEmisWaybillBatchStatus" parameterType="java.util.List">
|
||||
insert into emis_waybill_batch_status (
|
||||
bill_code, site_batch_status, remark,
|
||||
create_by, create_time, update_by, update_time
|
||||
) values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.billCode}, #{item.siteBatchStatus}, #{item.remark},
|
||||
#{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user