Merge pull request 'develop' (#60) from develop into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/60
This commit is contained in:
commit
cbae1cc19a
@ -751,6 +751,30 @@ public class EmisCommonController extends EmisBaseController
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理历史虚拟单
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/handleHistoryVirtualWaybill")
|
||||
public AjaxResult handleHistoryVirtualWaybill(){
|
||||
String lockKey="handleHistoryVirtualWaybill";
|
||||
log.info("handleHistoryVirtualWaybill start");
|
||||
|
||||
// 加锁查询
|
||||
redissonService.lock(lockKey,300);
|
||||
try{
|
||||
emisWaybillService.handleHistoryVirtualWaybill();
|
||||
}catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
log.error("handleHistoryVirtualWaybill exception:"+ex.getMessage());
|
||||
}
|
||||
log.info("handleHistoryVirtualWaybill end");
|
||||
|
||||
redissonService.unlock(lockKey);
|
||||
return AjaxResult.success("发送成功");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动出账触发
|
||||
* @return
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
|
||||
package com.xdadan.erp.web.emis;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@ -152,4 +153,8 @@ public class EmisCountryController extends EmisBaseController
|
||||
{
|
||||
return toAjax(emisCountryService.deleteEmisCountryByIds(ids));
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<Integer> list = new ArrayList<Integer>();
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -171,14 +171,24 @@ public class EmisTmsSiteBatchController extends EmisBaseController
|
||||
return toAjax(emisTmsSiteBatchService.insertEmisTmsSiteBatch(emisTmsSiteBatch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增一级网点TMS组批次
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatch:addAll')")
|
||||
@Log(title = "一级网点TMS组批次", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addAll")
|
||||
public AjaxResult addAll(@RequestBody EmisTmsSiteBatch emisTmsSiteBatch) throws EmisBizError {
|
||||
return toAjax(emisTmsSiteBatchService.addAll(emisTmsSiteBatch));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改一级网点TMS组批次
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatch:edit')")
|
||||
@Log(title = "一级网点TMS组批次", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EmisTmsSiteBatch emisTmsSiteBatch)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody EmisTmsSiteBatch emisTmsSiteBatch) throws EmisBizError {
|
||||
return toAjax(emisTmsSiteBatchService.updateEmisTmsSiteBatch(emisTmsSiteBatch));
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,11 @@ package com.xdadan.erp.web.emis;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -93,8 +97,7 @@ public class EmisTmsSiteBatchDtlController extends EmisBaseController
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatchDtl:add')")
|
||||
@Log(title = "一级网点TMS组批次明细", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmisTmsSiteBatchDtl emisTmsSiteBatchDtl)
|
||||
{
|
||||
public AjaxResult add(@RequestBody EmisTmsSiteBatchDtl emisTmsSiteBatchDtl) throws EmisBizError {
|
||||
return toAjax(emisTmsSiteBatchDtlService.insertEmisTmsSiteBatchDtl(emisTmsSiteBatchDtl));
|
||||
}
|
||||
|
||||
|
||||
@ -35,10 +35,10 @@ public class EmisTransPlanRuleController extends EmisBaseController {
|
||||
private IEmisTransPlanRuleService emisTransPlanRuleService;
|
||||
|
||||
@GetMapping("/listSimple")
|
||||
@JacksonFilter(include = {
|
||||
"transType", "productTypeName", "supplierCode", "supplierName"
|
||||
}, value = EmisTransPlanRule.class, type = JacksonFilter.JscksonFilterType.RESPONSE)
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTransPlanRule:listSimple')")
|
||||
// @JacksonFilter(include = {
|
||||
// "transType", "productTypeName", "supplierCode", "supplierName"
|
||||
// }, value = EmisTransPlanRule.class, type = JacksonFilter.JscksonFilterType.RESPONSE)
|
||||
// @PreAuthorize("@ss.hasPermi('emis:emisTransPlanRule:listSimple')")
|
||||
public TableDataInfo listSimple(EmisTransPlanRule emisTransPlanRule) {
|
||||
startPage();
|
||||
List<EmisTransPlanRule> list = emisTransPlanRuleService.selectSupplierInfoByConditions(emisTransPlanRule);
|
||||
|
||||
@ -108,6 +108,17 @@ public class EmisWaybillController extends EmisBaseController
|
||||
return AjaxResult.success("操作成功", emisBaseService.checkWaybillIsExists(billCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询主单号列表
|
||||
*/
|
||||
@GetMapping(value = "/getMasterEmisWaybills")
|
||||
public TableDataInfo getMasterEmisWaybills(EmisWaybill emisWaybill){
|
||||
startPage();
|
||||
emisWaybill.getParams().put("privSiteCode", getLoginUser().getUser().getOwnerSiteCode());
|
||||
List<EmisWaybill> list = emisWaybillService.selectMasterEmisWaybills(emisWaybill);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取运单信息
|
||||
*/
|
||||
|
||||
@ -114,6 +114,7 @@ public class EmisTmsSiteBatch extends BaseEntity
|
||||
private String blEntering;
|
||||
|
||||
private List<EmisTmsSiteBatchDtl> batchDtlList;
|
||||
private List<EmisTmsSiteBatchLoading> loadingList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -312,8 +312,12 @@ public class EmisWaybill extends BaseEntity
|
||||
|
||||
/* 是否超长 */
|
||||
private String blOverLong;
|
||||
/* 是否虚拟单 */
|
||||
/* 是否虚拟单.0:否,1:是 */
|
||||
private String blVirtual;
|
||||
/* 主单号 */
|
||||
private String masterBillCode;
|
||||
/* 虚拟单备注 */
|
||||
private String virtualRemark;
|
||||
|
||||
/* 是否付款 */
|
||||
private String blBill;
|
||||
@ -404,6 +408,10 @@ public class EmisWaybill extends BaseEntity
|
||||
private String takePieceEmployeeCode;
|
||||
/* 发件网点代码 */
|
||||
private String sendSiteCode;
|
||||
/* 始发网点代码 */
|
||||
private String startSiteCode;
|
||||
/* 始发网点名称 */
|
||||
private String startSiteName;
|
||||
/* 发件财务中心代码 */
|
||||
private String sendCenterCode;
|
||||
/* 发货时间 - 取本地时间 */
|
||||
|
||||
@ -46,6 +46,8 @@ public class EmisWaybillAjustApply extends BaseEntity
|
||||
private String applyManCode;
|
||||
/* 申请站点代码 */
|
||||
private String applySiteCode;
|
||||
/* 始发网点代码 */
|
||||
private String startSiteCode;
|
||||
/* 申请财务中心编码 */
|
||||
private String applyFinanceCenterCode;
|
||||
/* 申请时间 */
|
||||
|
||||
@ -212,6 +212,10 @@ public class WaybillOrder implements Serializable {
|
||||
|
||||
/* 发件网点代码 */
|
||||
private String sendSiteCode;
|
||||
/* 始发网点代码 */
|
||||
private String startSiteCode;
|
||||
/* 始发网点名称 */
|
||||
private String startSiteName;
|
||||
|
||||
/* 派件人代码 */
|
||||
private String dispatchManCode;
|
||||
@ -389,6 +393,12 @@ public class WaybillOrder implements Serializable {
|
||||
|
||||
/* 箱量 */
|
||||
private String boxQuantity;
|
||||
/* 是否虚拟单 0:否,1:是,默认为0 */
|
||||
private String blVirtual;
|
||||
/* 主单号 */
|
||||
private String masterBillCode;
|
||||
/* 虚拟单备注 */
|
||||
private String virtualRemark;
|
||||
|
||||
// 销售,回款
|
||||
// private String salesmenName;
|
||||
@ -446,6 +456,8 @@ public class WaybillOrder implements Serializable {
|
||||
|
||||
voItem.setDeclareGoodsList(declareGoodsCvt.cvtToVoList(dbDecareGoodsList));
|
||||
voItem.setDeclareAttachmentList(declareAttachmentCvt.cvtToVoList(dbDeclareAttachmentList));
|
||||
voItem.setStartSiteCode(dbWaybill.getStartSiteCode());
|
||||
voItem.setStartSiteName(dbWaybill.getStartSiteName());
|
||||
|
||||
// 收件人
|
||||
Reciever reciever = new Reciever();
|
||||
@ -516,6 +528,10 @@ public class WaybillOrder implements Serializable {
|
||||
voItem.setPrintManName(dbWaybill.getPrintManName());
|
||||
voItem.setPrintSiteName(dbWaybill.getPrintSiteName());
|
||||
|
||||
voItem.setBlVirtual(dbWaybill.getBlVirtual());
|
||||
voItem.setMasterBillCode(dbWaybill.getMasterBillCode());
|
||||
voItem.setVirtualRemark(dbWaybill.getVirtualRemark());
|
||||
|
||||
|
||||
voItem.setOpenId(dbWaybill.getOpenId());
|
||||
|
||||
@ -732,6 +748,11 @@ public class WaybillOrder implements Serializable {
|
||||
dbWaybill.setUserId(this.getUserId());
|
||||
dbWaybill.setCustomerCode(this.getCustomerCode());
|
||||
|
||||
// 虚拟单
|
||||
dbWaybill.setBlVirtual(this.getBlVirtual());
|
||||
dbWaybill.setMasterBillCode(this.getMasterBillCode());
|
||||
dbWaybill.setVirtualRemark(this.getVirtualRemark());
|
||||
|
||||
// dbWaybill.setCustomerName(this.getCustomerName());
|
||||
// dbWaybill.setReceiveCustomerCode(this.getReceiveCustomerCode());
|
||||
// dbWaybill.setReceiveCustomerName(this.getReceiveCustomerName());
|
||||
@ -867,6 +888,8 @@ public class WaybillOrder implements Serializable {
|
||||
// dbWaybill.setRegisterManCode(this.getRegisterManCode());
|
||||
dbWaybill.setTakePieceEmployeeCode(this.getTakePieceEmployeeCode());
|
||||
dbWaybill.setSendSiteCode(this.getSendSiteCode());
|
||||
dbWaybill.setStartSiteCode(this.getStartSiteCode());
|
||||
dbWaybill.setStartSiteName(this.getStartSiteName());
|
||||
dbWaybill.setSendDate(this.getSendDate());
|
||||
|
||||
dbWaybill.setSendSiteName(this.getSendSiteName());
|
||||
|
||||
@ -104,10 +104,11 @@ public interface EmisTransPlanRuleMapper {
|
||||
* 根据产品类型名称查询产品类型信息
|
||||
*
|
||||
* @param productTypeNames 产品类型名称列表
|
||||
* @param code 线路编码
|
||||
* @param code 线路编码
|
||||
* @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
|
||||
*/
|
||||
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);
|
||||
}
|
||||
@ -32,6 +32,8 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
|
||||
public EmisWaybill selectEmisWaybillByBillCode(@Param("billCode")String billCode);
|
||||
|
||||
public EmisWaybill selectMasterWaybillByBillCode(@Param("billCode")String billCode);
|
||||
|
||||
public List<Map> selectWaybillStatByEmpCode(@Param("empCode")String empCode,@Param("waybillStatus")String waybillStatus);
|
||||
|
||||
public List<Map> selectCommissionStatData(EmisWaybill emisWaybill);
|
||||
@ -104,6 +106,8 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
@DataAuditLog(operateType= OperateType.UPDATE,serviceClass=EmisWaybillServiceImpl.class)
|
||||
public int updateEmisWaybill(EmisWaybill emisWaybill);
|
||||
|
||||
public int updateVirtualWaybill(EmisWaybill emisWaybill);
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
@ -304,4 +308,20 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
EmisWaybill selectCustEmisWaybillByBillCode(EmisWaybill queryWaybill);
|
||||
|
||||
EmisWaybill selectEmisWaybillByCustOrderId(String custOrderId);
|
||||
|
||||
/**
|
||||
* 查询主单号列表
|
||||
*
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
*/
|
||||
List<EmisWaybill> selectMasterEmisWaybills(EmisWaybill emisWaybill);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param offset
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
List<EmisWaybill> selectHistoryVirtualWaybill(@Param("offset")int offset, @Param("pageSize")int pageSize);
|
||||
}
|
||||
|
||||
@ -80,4 +80,27 @@ public interface EmisWaybillProblemInfoMapper extends BaseMapper<EmisWaybillProb
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisWaybillProblemInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据运单号删除
|
||||
*
|
||||
* @param billCode
|
||||
*/
|
||||
public int deleteByBillCode(@Param("billCode") String billCode);
|
||||
|
||||
/**
|
||||
* 根据运单号查
|
||||
*
|
||||
* @param billCode
|
||||
* @return
|
||||
*/
|
||||
EmisWaybillProblemInfo selectEmisWaybillProblemInfoByBillCode(@Param("billCode") String billCode);
|
||||
|
||||
/**
|
||||
* 根据运单号查
|
||||
*
|
||||
* @param billCodes
|
||||
* @return
|
||||
*/
|
||||
List<EmisWaybillProblemInfo> selectEmisWaybillProblemInfoByBillCodes(@Param("billCodes") List<String> billCodes);
|
||||
}
|
||||
|
||||
@ -21,6 +21,7 @@ package com.xdadan.erp.emis.service;
|
||||
import com.xdadan.erp.emis.domain.enumtype.*;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.domain.stat.ScanStatInfoDtl;
|
||||
import com.xdadan.erp.emis.domain.vo.scan.ScanInfo;
|
||||
import com.xdadan.erp.emis.mapper.*;
|
||||
import com.xdadan.erp.emis.service.sms.AliyunSMSService;
|
||||
import com.xdadan.erp.emis.service.sms.Sms253Service;
|
||||
@ -84,6 +85,9 @@ public class EmisBaseService {
|
||||
@Autowired
|
||||
protected EmisWaybillMapper emisWaybillMapper;
|
||||
|
||||
@Autowired
|
||||
private IEmisCommissionProfitService emisCommissionProfitService;
|
||||
|
||||
@Autowired
|
||||
protected EmisWaybillFeeitemMapper emisWaybillFeeitemMapper;
|
||||
|
||||
@ -131,6 +135,8 @@ public class EmisBaseService {
|
||||
|
||||
@Autowired
|
||||
private EmisWaybillProblemInfoMapper emisWaybillProblemInfoMapper;
|
||||
@Autowired
|
||||
private IEmisWaybillProblemInfoService emisWaybillProblemInfoService;
|
||||
|
||||
|
||||
@Autowired
|
||||
@ -181,12 +187,12 @@ public class EmisBaseService {
|
||||
@Autowired
|
||||
private EmisWaybillBatchStatusMapper emisWaybillBatchStatusMapper;
|
||||
|
||||
@Autowired
|
||||
private IEmisTmsScanRecordService emisTmsScanRecordService;
|
||||
|
||||
@Autowired
|
||||
private EmisTmsSiteBatchMissRecordMapper emisTmsSiteBatchMissRecordMapper;
|
||||
|
||||
private int totalBatchStatusRecords = 0;
|
||||
private int totalMissRecords = 0;
|
||||
|
||||
private static SysUser emptySysUser = new SysUser();
|
||||
|
||||
static {
|
||||
@ -2838,6 +2844,19 @@ public class EmisBaseService {
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtil.isNotBlank(waybill.getVirtualRemark())) {
|
||||
// 取每个虚拟单号的后六位,用逗号拼接
|
||||
String[] codes = waybill.getVirtualRemark().split(",");
|
||||
String shortCodes = Arrays.stream(codes)
|
||||
.filter(s -> s != null && s.length() >= 6)
|
||||
.map(s -> s.substring(s.length() - 6))
|
||||
.collect(Collectors.joining(","));
|
||||
remark = remark + " " + "该运单为主单,对应虚拟单为" + shortCodes;
|
||||
}
|
||||
// if (StringUtil.isNotBlank(waybill.getMasterBillCode())) {
|
||||
// remark = remark + " " + "该运单为虚拟单,对应主单为" + waybill.getMasterBillCode();
|
||||
// }
|
||||
|
||||
order.put("remark",remark);
|
||||
// 备注拆分为多行
|
||||
List<String> remarkList=WaybillHelper.wrap(remark,40);
|
||||
@ -3824,6 +3843,36 @@ public class EmisBaseService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否已确认账单
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
*/
|
||||
public boolean isConfirm(EmisWaybill emisWaybill) {
|
||||
|
||||
// 财务已确认账单不允许修改
|
||||
List<EmisSettleSubBill> emisSettleSubBillList = getSettleSubBillListByBillCode(emisWaybill.getBillCode());
|
||||
if (CollectionUtil.isEmpty(emisSettleSubBillList)) {
|
||||
return false;
|
||||
}
|
||||
EmisSettleSubBill emisSettleSubBill = emisSettleSubBillList.get(0);
|
||||
if ("1".equals(emisSettleSubBill.getBlConfirmCenter())) {
|
||||
// 财务确认出账明细锁账
|
||||
emisWaybill.setLockReason("财务已确认,不允许修改");
|
||||
return true;
|
||||
}
|
||||
|
||||
// 财务或业务确认不出账不允许修改
|
||||
if ("2".equals(emisSettleSubBill.getBlConfirmCenter())
|
||||
|| "2".equals(emisSettleSubBill.getBlConfirmSite())
|
||||
) {
|
||||
// 财务确认出账明细锁账
|
||||
emisWaybill.setLockReason("已确认不出账,不允许修改");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算预估到达时间,根据产品时效来计算
|
||||
* @param sendDate 开单时间
|
||||
@ -4066,31 +4115,75 @@ public class EmisBaseService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 深度复制节点及其子节点
|
||||
*
|
||||
* @param source 源节点
|
||||
* @return 复制后的新节点
|
||||
*/
|
||||
private EmisTransPlanRule deepCopyNode(EmisTransPlanRule source) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 深度复制节点及其子节点
|
||||
*
|
||||
* @param source 源节点
|
||||
* @return 复制后的新节点
|
||||
*/
|
||||
private EmisTransPlanRule deepCopyNode(EmisTransPlanRule source) {
|
||||
return deepCopyNode(source, new HashSet<>(), new ArrayList<>());
|
||||
}
|
||||
|
||||
EmisTransPlanRule copy = new EmisTransPlanRule();
|
||||
BeanUtils.copyProperties(source, copy);
|
||||
/**
|
||||
* 深度复制节点及其子节点(带循环引用检测)
|
||||
*
|
||||
* @param source 源节点
|
||||
* @param visitedIds 已访问的节点ID集合
|
||||
* @param visitPath 访问路径,用于记录循环引用的路径
|
||||
* @return 复制后的新节点
|
||||
*/
|
||||
private EmisTransPlanRule deepCopyNode(EmisTransPlanRule source, Set<Long> visitedIds, List<Long> visitPath) {
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 递归复制子节点
|
||||
if (source.getChildren() != null) {
|
||||
List<EmisTransPlanRule> copiedChildren = new ArrayList<>();
|
||||
for (EmisTransPlanRule child : source.getChildren()) {
|
||||
copiedChildren.add(deepCopyNode(child));
|
||||
}
|
||||
copy.setChildren(copiedChildren);
|
||||
}
|
||||
// 检查循环引用
|
||||
if (visitedIds.contains(source.getId())) {
|
||||
// 找到循环引用的起始位置
|
||||
int cycleStartIndex = visitPath.indexOf(source.getId());
|
||||
if (cycleStartIndex != -1) {
|
||||
// 构建循环路径
|
||||
List<Long> cyclePath = visitPath.subList(cycleStartIndex, visitPath.size());
|
||||
cyclePath.add(source.getId());
|
||||
|
||||
return copy;
|
||||
}
|
||||
// 构建详细的错误信息
|
||||
StringBuilder errorMsg = new StringBuilder();
|
||||
errorMsg.append("检测到循环引用!循环路径:");
|
||||
for (int i = 0; i < cyclePath.size(); i++) {
|
||||
if (i > 0) {
|
||||
errorMsg.append(" -> ");
|
||||
}
|
||||
errorMsg.append("节点ID:").append(cyclePath.get(i));
|
||||
}
|
||||
errorMsg.append("\n循环引用发生在节点ID:").append(source.getId());
|
||||
errorMsg.append(",该节点在路径中重复出现");
|
||||
|
||||
throw new RuntimeException(errorMsg.toString());
|
||||
}
|
||||
}
|
||||
|
||||
// 添加到已访问集合和路径中
|
||||
visitedIds.add(source.getId());
|
||||
visitPath.add(source.getId());
|
||||
|
||||
EmisTransPlanRule copy = new EmisTransPlanRule();
|
||||
BeanUtils.copyProperties(source, copy);
|
||||
|
||||
// 递归复制子节点
|
||||
if (source.getChildren() != null) {
|
||||
List<EmisTransPlanRule> copiedChildren = new ArrayList<>();
|
||||
for (EmisTransPlanRule child : source.getChildren()) {
|
||||
copiedChildren.add(deepCopyNode(child, visitedIds, visitPath));
|
||||
}
|
||||
copy.setChildren(copiedChildren);
|
||||
}
|
||||
|
||||
// 从路径中移除当前节点(回溯)
|
||||
visitPath.remove(visitPath.size() - 1);
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查月结客户首次签约日期,首次签约之前开的不允许修改
|
||||
@ -4145,9 +4238,11 @@ public class EmisBaseService {
|
||||
}
|
||||
emisTmsSiteBatchMissMapper.deleteByBillCodes(billCodes);
|
||||
long startTime = System.currentTimeMillis();
|
||||
int totalProcessed = 0;
|
||||
int totalProcessed = emisWaybills.size();
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
int totalBatchStatusRecords = 0;
|
||||
int totalMissRecords = 0;
|
||||
List<String> failedBillCodes = new ArrayList<>();
|
||||
|
||||
// 获取所有线路规划
|
||||
@ -4169,7 +4264,7 @@ public class EmisBaseService {
|
||||
|
||||
// 批量插入运单组批次状态记录
|
||||
if (!result.getBatchStatusList().isEmpty()) {
|
||||
// emisWaybillBatchStatusMapper.batchInsertEmisWaybillBatchStatus(result.getBatchStatusList());
|
||||
emisWaybillBatchStatusMapper.batchInsertEmisWaybillBatchStatus(result.getBatchStatusList());
|
||||
totalBatchStatusRecords += result.getBatchStatusList().size();
|
||||
}
|
||||
|
||||
@ -4190,7 +4285,7 @@ public class EmisBaseService {
|
||||
long processTime = endTime - startTime;
|
||||
|
||||
// 保存扫描记录
|
||||
saveRecord(totalProcessed, successCount, failCount, processTime, failedBillCodes);
|
||||
saveRecord(totalProcessed, successCount, failCount, processTime, failedBillCodes,totalBatchStatusRecords,totalMissRecords);
|
||||
|
||||
log.info(
|
||||
"Auto scan completed. Total processed: {}, Success: {}, Failed: {}, Time taken: {}ms, Batch status records: {}, Miss records: {}",
|
||||
@ -4205,7 +4300,7 @@ public class EmisBaseService {
|
||||
}
|
||||
|
||||
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();
|
||||
record.setTotalProcessed(totalProcessed);
|
||||
record.setSuccessCount(successCount);
|
||||
@ -4692,6 +4787,139 @@ public class EmisBaseService {
|
||||
}
|
||||
}
|
||||
|
||||
public void handleVirtual(EmisWaybill emisWaybillSave,EmisWaybill emisWaybillOld) throws EmisBizError {
|
||||
if (!"1".equals(emisWaybillSave.getBlVirtual())) {
|
||||
return;
|
||||
}
|
||||
updateMasterWaybill(emisWaybillSave,emisWaybillOld);
|
||||
// 做问题件录入
|
||||
scanProblemInfo(emisWaybillSave,emisWaybillOld);
|
||||
}
|
||||
|
||||
public void scanProblemInfo(EmisWaybill emisWaybillSave, EmisWaybill emisWaybillOld) {
|
||||
String dispatchOrSendManCode = "";
|
||||
if ("1".equals(emisWaybillSave.getPickupMethod())) {
|
||||
dispatchOrSendManCode = emisWaybillSave.getOperateEmployeeCode();
|
||||
} else if ("2".equals(emisWaybillSave.getPickupMethod())) {
|
||||
dispatchOrSendManCode = emisWaybillSave.getTakePieceEmployeeCode();
|
||||
}
|
||||
ScanInfo scanInfoProm = new ScanInfo();
|
||||
List<Map<String, Object>> scanDataPromList = new ArrayList<>();
|
||||
scanInfoProm.setOpType(2);
|
||||
scanInfoProm.setScanType(ScanType.ISSUE.opCode);
|
||||
|
||||
Map<String, Object> scanDatePromItem = new HashMap<>();
|
||||
scanDatePromItem.put("billCode", emisWaybillSave.getBillCode());
|
||||
if ("002".equals(emisWaybillSave.getTransLineType())) {
|
||||
scanDatePromItem.put("problemType", "173");
|
||||
scanDatePromItem.put("remark", "出口虚拟面单");
|
||||
} else {
|
||||
scanDatePromItem.put("problemType", "170");
|
||||
scanDatePromItem.put("remark", "返货虚拟面单");
|
||||
}
|
||||
scanDatePromItem.put("notifySite", emisWaybillSave.getSendSiteCode());
|
||||
if (null == emisWaybillOld) {
|
||||
scanDatePromItem.put("scanDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, emisWaybillSave.getSendDate()));
|
||||
} else {
|
||||
scanDatePromItem.put("scanDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getNowDate()));
|
||||
}
|
||||
scanDatePromItem.put("scanWeight", "0.0");
|
||||
scanDataPromList.add(scanDatePromItem);
|
||||
scanInfoProm.setScanData(scanDataPromList);
|
||||
emisTmsScanRecordService.scan(scanInfoProm, dispatchOrSendManCode, emisWaybillSave.getSendSiteCode());
|
||||
}
|
||||
|
||||
public void updateMasterWaybill(EmisWaybill emisWaybillSave,EmisWaybill emisWaybillOld) throws EmisBizError {
|
||||
EmisWaybill masterWaybill = checkVirtualParam(emisWaybillSave, emisWaybillOld);
|
||||
String virtualRemark = masterWaybill.getVirtualRemark();
|
||||
String virtualBillCode = emisWaybillSave.getBillCode();
|
||||
String virtualBillCodeLastSix = virtualBillCode.substring(virtualBillCode.length() - 6);
|
||||
if (StringUtil.isNotBlank(virtualRemark)) {
|
||||
Set<String> virtualBillSet = new LinkedHashSet<>();
|
||||
String[] codes = virtualRemark.split(",");
|
||||
virtualBillSet.addAll(Arrays.asList(codes));
|
||||
virtualBillSet.add(virtualBillCodeLastSix);
|
||||
virtualRemark = String.join(",", virtualBillSet);
|
||||
} else {
|
||||
virtualRemark = virtualBillCodeLastSix;
|
||||
}
|
||||
EmisWaybill emisWaybill = new EmisWaybill();
|
||||
emisWaybill.setVirtualRemark(virtualRemark);
|
||||
emisWaybill.setId(masterWaybill.getId());
|
||||
emisWaybillMapper.updateEmisWaybill(emisWaybill);
|
||||
}
|
||||
|
||||
public EmisWaybill checkVirtualParam(EmisWaybill emisWaybillSave, EmisWaybill emisWaybillOld) throws EmisBizError {
|
||||
if (StringUtil.isBlank(emisWaybillSave.getMasterBillCode())) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不能为空");
|
||||
}
|
||||
if(StringUtil.isNotBlank(emisWaybillOld.getVirtualRemark())){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单不能改虚拟单");
|
||||
}
|
||||
if (emisWaybillSave.getParcelQty() != 1) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "虚拟单件数只能为1");
|
||||
}
|
||||
if (emisWaybillSave.getMasterBillCode().equals(emisWaybillSave.getBillCode())) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "运单号主单号不能相同");
|
||||
}
|
||||
if (!"002".equals(emisWaybillSave.getTransLineType()) && !"012".equals(emisWaybillSave.getTransLineType())
|
||||
&& !"014".equals(emisWaybillSave.getTransLineType())) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "虚拟单只支持线路为缅甸快递/缅甸快递进口/柬埔寨快递进口");
|
||||
}
|
||||
EmisWaybill masterWaybill = emisWaybillMapper
|
||||
.selectMasterWaybillByBillCode(emisWaybillSave.getMasterBillCode());
|
||||
if (Objects.isNull(masterWaybill)) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不存在");
|
||||
}
|
||||
if (!emisWaybillSave.getReceiveCountry().equals(masterWaybill.getReceiveCountry())
|
||||
|| !emisWaybillSave.getTransLineType().equals(masterWaybill.getTransLineType())
|
||||
|| !emisWaybillSave.getProductType().equals(masterWaybill.getProductType())) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单和虚拟单线路不一致");
|
||||
}
|
||||
if ("1".equals(masterWaybill.getBlVirtual())) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "虚拟单不能作为主单");
|
||||
}
|
||||
if (!emisWaybillSave.getMasterBillCode().equals(emisWaybillOld.getMasterBillCode())) {
|
||||
String virtualRemark = masterWaybill.getVirtualRemark() == null ? "" : masterWaybill.getVirtualRemark();
|
||||
long count = Arrays.stream(virtualRemark.split(","))
|
||||
.filter(s -> s != null && !s.trim().isEmpty())
|
||||
.count();
|
||||
if (count >= masterWaybill.getParcelQty()) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,
|
||||
emisWaybillSave.getMasterBillCode() + "最多只能绑定" + masterWaybill.getParcelQty() + "个虚拟单");
|
||||
}
|
||||
}
|
||||
|
||||
List<EmisTmsSiteBatch> batchList = emisTmsSiteBatchMapper.selectEmisTmsSiteBatchListByBillCodes(
|
||||
Lists.newArrayList(Collections.singleton(emisWaybillSave.getMasterBillCode())));
|
||||
if (CollectionUtil.isNotEmpty(batchList)) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "该单号已经录入批次,请先在组批次中剔除该运单");
|
||||
}
|
||||
return masterWaybill;
|
||||
}
|
||||
|
||||
public void handleVirtualForUpdate(EmisWaybill emisWaybillSave, EmisWaybill emisWaybillOld) throws EmisBizError {
|
||||
if (!StringUtils.isEmpty(emisWaybillSave.getBlVirtual()) && "1".equals(emisWaybillSave.getBlVirtual())) {
|
||||
handleVirtual(emisWaybillSave, emisWaybillOld);
|
||||
} else {
|
||||
String masterBillCode = emisWaybillOld.getMasterBillCode();
|
||||
if (StringUtil.isNotBlank(masterBillCode)) {
|
||||
String virtualBillCodeLastSix = emisWaybillSave.getBillCode()
|
||||
.substring(emisWaybillSave.getBillCode().length() - 6);
|
||||
EmisWaybill masterWaybill = emisWaybillMapper
|
||||
.selectEmisWaybillByBillCode(masterBillCode);
|
||||
List<String> filterVirtualRemark = Arrays.stream(masterWaybill.getVirtualRemark().split(","))
|
||||
.filter(i -> !i.equals(virtualBillCodeLastSix)).collect(Collectors.toList());
|
||||
String virtualRemark = String.join(",", filterVirtualRemark);
|
||||
masterWaybill.setVirtualRemark(virtualRemark);
|
||||
emisWaybillMapper.updateEmisWaybill(masterWaybill);
|
||||
emisWaybillProblemInfoService.deleteEmisWaybillProblemInfoByBillCode(emisWaybillSave.getBillCode());
|
||||
// 重新计算提成
|
||||
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws ParseException {
|
||||
// Date startDate = new Date("202");
|
||||
Date startDate= new SimpleDateFormat("yyyy-MM-dd").parse("2025-05-11");
|
||||
|
||||
@ -11,8 +11,9 @@ package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisTmsSiteBatchDtl;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @ClassName EmisTmsSiteBatchDtlService
|
||||
* @Description 一级网点TMS组批次明细
|
||||
* @author linfso
|
||||
@ -41,7 +42,7 @@ public interface IEmisTmsSiteBatchDtlService
|
||||
* @param emisTmsSiteBatchDtl 一级网点TMS组批次明细
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmisTmsSiteBatchDtl(EmisTmsSiteBatchDtl emisTmsSiteBatchDtl);
|
||||
public int insertEmisTmsSiteBatchDtl(EmisTmsSiteBatchDtl emisTmsSiteBatchDtl) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 修改一级网点TMS组批次明细
|
||||
|
||||
@ -11,8 +11,10 @@ package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisTmsSiteBatch;
|
||||
import com.xdadan.erp.emis.domain.EmisTmsSiteBatchDtl;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @ClassName EmisTmsSiteBatchService
|
||||
* @Description 一级网点TMS组批次
|
||||
* @author linfso
|
||||
@ -57,7 +59,14 @@ public interface IEmisTmsSiteBatchService
|
||||
* @param emisTmsSiteBatch 一级网点TMS组批次
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmisTmsSiteBatch(EmisTmsSiteBatch emisTmsSiteBatch);
|
||||
public int insertEmisTmsSiteBatch(EmisTmsSiteBatch emisTmsSiteBatch) ;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param oldSiteBatch
|
||||
* @param billCode
|
||||
*/
|
||||
public void checkSiteBatch(EmisTmsSiteBatch oldSiteBatch, String billCode) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 修改一级网点TMS组批次
|
||||
@ -65,7 +74,7 @@ public interface IEmisTmsSiteBatchService
|
||||
* @param emisTmsSiteBatch 一级网点TMS组批次
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmisTmsSiteBatch(EmisTmsSiteBatch emisTmsSiteBatch);
|
||||
public int updateEmisTmsSiteBatch(EmisTmsSiteBatch emisTmsSiteBatch) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 批量删除一级网点TMS组批次
|
||||
@ -89,4 +98,11 @@ public interface IEmisTmsSiteBatchService
|
||||
* @param batchNo
|
||||
*/
|
||||
void scanSiteBatch(String batchNo);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param emisTmsSiteBatch
|
||||
* @return
|
||||
*/
|
||||
int addAll(EmisTmsSiteBatch emisTmsSiteBatch) throws EmisBizError;
|
||||
}
|
||||
|
||||
@ -67,4 +67,12 @@ public interface IEmisWaybillProblemInfoService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisWaybillProblemInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 删除问题件信息
|
||||
*
|
||||
* @param billCode
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteEmisWaybillProblemInfoByBillCode(String billCode);
|
||||
}
|
||||
|
||||
@ -289,4 +289,17 @@ public interface IEmisWaybillService extends IDataAuditService
|
||||
* @throws EmisBizError 业务异常
|
||||
*/
|
||||
void updateWaybillInfo(JSONObject orderData, String appId) throws EmisBizError;
|
||||
|
||||
/**
|
||||
* 查询主单号
|
||||
*
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
*/
|
||||
List<EmisWaybill> selectMasterEmisWaybills(EmisWaybill emisWaybill);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void handleHistoryVirtualWaybill();
|
||||
}
|
||||
|
||||
@ -11,6 +11,17 @@
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.xdadan.erp.emis.domain.EmisTmsSiteBatch;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.mapper.EmisTmsSiteBatchMapper;
|
||||
import com.xdadan.erp.emis.mapper.EmisWaybillMapper;
|
||||
import com.xdadan.erp.emis.service.IEmisTmsSiteBatchService;
|
||||
import jodd.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xdadan.erp.emis.domain.EmisTmsSiteBatchDtl;
|
||||
@ -29,6 +40,15 @@ public class EmisTmsSiteBatchDtlServiceImpl implements IEmisTmsSiteBatchDtlServi
|
||||
@Autowired
|
||||
private EmisTmsSiteBatchDtlMapper emisTmsSiteBatchDtlMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisWaybillMapper emisWaybillMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisTmsSiteBatchMapper emisTmsSiteBatchMapper;
|
||||
|
||||
@Autowired
|
||||
private IEmisTmsSiteBatchService emisTmsSiteBatchService;
|
||||
|
||||
/**
|
||||
* 查询一级网点TMS组批次明细
|
||||
*
|
||||
@ -60,8 +80,9 @@ public class EmisTmsSiteBatchDtlServiceImpl implements IEmisTmsSiteBatchDtlServi
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEmisTmsSiteBatchDtl(EmisTmsSiteBatchDtl emisTmsSiteBatchDtl)
|
||||
{
|
||||
public int insertEmisTmsSiteBatchDtl(EmisTmsSiteBatchDtl emisTmsSiteBatchDtl) throws EmisBizError {
|
||||
EmisTmsSiteBatch oldSiteBatch = emisTmsSiteBatchMapper.selectTmsSiteBatchByBatchNo(emisTmsSiteBatchDtl.getBatchNo());
|
||||
emisTmsSiteBatchService.checkSiteBatch(oldSiteBatch, emisTmsSiteBatchDtl.getBillCode());
|
||||
return emisTmsSiteBatchDtlMapper.insertEmisTmsSiteBatchDtl(emisTmsSiteBatchDtl);
|
||||
}
|
||||
|
||||
|
||||
@ -48,9 +48,6 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
@Autowired
|
||||
private EmisTmsSiteBatchMissRecordMapper emisTmsSiteBatchMissRecordMapper;
|
||||
|
||||
private int totalBatchStatusRecords = 0;
|
||||
private int totalMissRecords = 0;
|
||||
|
||||
/**
|
||||
* 查询TMS漏组批次信息
|
||||
*
|
||||
@ -142,6 +139,8 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
int totalProcessed = 0;
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
int totalBatchStatusRecords = 0;
|
||||
int totalMissRecords = 0;
|
||||
List<String> failedBillCodes = new ArrayList<>();
|
||||
|
||||
// 获取所有线路规划
|
||||
@ -162,7 +161,8 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
|
||||
// 先查询所有数据
|
||||
while (true) {
|
||||
List<EmisWaybill> waybills = emisWaybillMapper.selectWaybillListBySiteBatchStatus(offset, pageSize,lineCode);
|
||||
List<EmisWaybill> waybills = emisWaybillMapper.selectWaybillListBySiteBatchStatus(offset, pageSize,
|
||||
lineCode);
|
||||
if (waybills.isEmpty()) {
|
||||
break;
|
||||
}
|
||||
@ -192,6 +192,10 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
batches.add(allWaybills.subList(i, end));
|
||||
}
|
||||
|
||||
if (CollectionUtil.isEmpty(batches)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 创建新的线程池处理数据
|
||||
executorService = Executors.newFixedThreadPool(processors);
|
||||
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) {
|
||||
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();
|
||||
}
|
||||
allBatchStatus.addAll(result.getBatchStatusList());
|
||||
allMissRecords.addAll(result.getMissRecords());
|
||||
} catch (Exception 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 processTime = endTime - startTime;
|
||||
|
||||
// 保存扫描记录
|
||||
saveRecord(totalProcessed, successCount, failCount, processTime, failedBillCodes);
|
||||
saveRecord(totalProcessed, successCount, failCount, processTime, failedBillCodes, totalBatchStatusRecords,
|
||||
totalMissRecords);
|
||||
|
||||
log.info(
|
||||
"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,
|
||||
List<String> failedBillCodes) {
|
||||
List<String> failedBillCodes, int totalBatchStatusRecords, int totalMissRecords) {
|
||||
EmisTmsSiteBatchMissRecord record = new EmisTmsSiteBatchMissRecord();
|
||||
record.setTotalProcessed(totalProcessed);
|
||||
record.setSuccessCount(successCount);
|
||||
@ -385,6 +397,10 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
// 合并相同起始网点和下一网点的批次
|
||||
Map<String, EmisTmsSiteBatch> mergedBatches = new HashMap<>();
|
||||
for (EmisTmsSiteBatch batch : waybillBatches) {
|
||||
if (StringUtils.isAnyBlank(batch.getStartSiteCode(), batch.getNextSiteCode(),
|
||||
batch.getSupplierCode())) {
|
||||
continue;
|
||||
}
|
||||
String key = batch.getStartSiteCode() + "_" + batch.getNextSiteCode();
|
||||
if (mergedBatches.containsKey(key)) {
|
||||
EmisTmsSiteBatch existingBatch = mergedBatches.get(key);
|
||||
@ -426,11 +442,33 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
}
|
||||
|
||||
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.setLineCode(lineCode);
|
||||
List<EmisTransPlanRule> list = emisTransPlanRuleMapper.selectEmisTransPlanRuleList(emisTransPlanRule);
|
||||
List<EmisTransPlanRule> tree = buildTree(list);
|
||||
int pageSize = 100;
|
||||
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);
|
||||
return tree;
|
||||
}
|
||||
@ -518,7 +556,7 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
}
|
||||
|
||||
private boolean checkRule(EmisTransPlanRule rule, List<EmisTmsSiteBatch> waybillBatches,
|
||||
List<EmisTransPlanRule> list) {
|
||||
List<EmisTransPlanRule> list) {
|
||||
// 检查当前节点是否匹配
|
||||
boolean currentMatch = false;
|
||||
for (EmisTmsSiteBatch batch : waybillBatches) {
|
||||
@ -617,7 +655,7 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
* 递归检查下一级节点
|
||||
*/
|
||||
private boolean checkNextLevel(Set<EmisTransPlanRule> currentLevelRules,
|
||||
List<EmisTmsSiteBatch> waybillBatches, List<EmisTransPlanRule> list) {
|
||||
List<EmisTmsSiteBatch> waybillBatches, List<EmisTransPlanRule> list) {
|
||||
// 如果当前级为空,说明已经到底了,返回true
|
||||
if (currentLevelRules.isEmpty()) {
|
||||
return true;
|
||||
@ -708,7 +746,8 @@ public class EmisTmsSiteBatchMissServiceImpl extends EmisBaseService implements
|
||||
.anyMatch(
|
||||
filterRule -> filterRule.getStartSiteCode().equals(childRule.getStartSiteCode()) &&
|
||||
filterRule.getNextSiteCode().equals(childRule.getNextSiteCode()) &&
|
||||
compareSupplierCodes(filterRule.getSupplierCode(), childRule.getSupplierCode())));
|
||||
compareSupplierCodes(filterRule.getSupplierCode(),
|
||||
childRule.getSupplierCode())));
|
||||
|
||||
if (!hasMatchedChild) {
|
||||
// 如果所有子节点都不匹配,为每个子节点创建漏组记录
|
||||
|
||||
@ -12,15 +12,17 @@ package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.xdadan.erp.common.core.redis.RedissonService;
|
||||
import com.xdadan.erp.common.utils.DateUtils;
|
||||
import com.xdadan.erp.common.utils.SecurityUtils;
|
||||
import com.xdadan.erp.emis.domain.EmisSite;
|
||||
import com.xdadan.erp.emis.domain.EmisTmsSiteBatchDtl;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybill;
|
||||
import com.xdadan.erp.emis.domain.*;
|
||||
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.mapper.EmisTmsSiteBatchDtlMapper;
|
||||
import com.xdadan.erp.emis.mapper.EmisTmsSiteBatchLoadingMapper;
|
||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||
import jodd.util.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -28,7 +30,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xdadan.erp.emis.domain.EmisTmsSiteBatch;
|
||||
import com.xdadan.erp.emis.mapper.EmisTmsSiteBatchMapper;
|
||||
import com.xdadan.erp.emis.service.IEmisTmsSiteBatchService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -50,6 +51,9 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
|
||||
@Autowired
|
||||
private EmisTmsSiteBatchDtlMapper emisTmsSiteBatchDtlMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisTmsSiteBatchLoadingMapper emisTmsSiteBatchLoadingMapper;
|
||||
|
||||
@Autowired
|
||||
RedissonService redissonService;
|
||||
|
||||
@ -124,6 +128,26 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void checkSiteBatch(EmisTmsSiteBatch oldSiteBatch, String billCode) throws EmisBizError {
|
||||
EmisWaybill emisWaybill = emisWaybillMapper.selectEmisWaybillByBillCode(billCode);
|
||||
if (Objects.nonNull(emisWaybill) && StringUtil.isNotBlank(emisWaybill.getVirtualRemark())) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, billCode + "已绑定虚拟单,无法录入批次");
|
||||
}
|
||||
checkUnique(oldSiteBatch, billCode);
|
||||
}
|
||||
|
||||
private void checkUnique(EmisTmsSiteBatch oldSiteBatch, String billCode) throws EmisBizError {
|
||||
EmisTmsSiteBatch emisTmsSiteBatch = new EmisTmsSiteBatch();
|
||||
emisTmsSiteBatch.setStartSiteCode(oldSiteBatch.getStartSiteCode());
|
||||
emisTmsSiteBatch.setNextSiteCode(oldSiteBatch.getNextSiteCode());
|
||||
emisTmsSiteBatch.setSupplierCode(oldSiteBatch.getSupplierCode());
|
||||
emisTmsSiteBatch.getParams().put("billCode", billCode);
|
||||
List<EmisTmsSiteBatch> batchList = emisTmsSiteBatchMapper.selectEmisTmsSiteBatchList(emisTmsSiteBatch);
|
||||
if (CollectionUtil.isNotEmpty(batchList)) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, billCode + "已组批次,不要重复组");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改一级网点TMS组批次
|
||||
*
|
||||
@ -131,8 +155,11 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEmisTmsSiteBatch(EmisTmsSiteBatch emisTmsSiteBatch)
|
||||
{
|
||||
public int updateEmisTmsSiteBatch(EmisTmsSiteBatch emisTmsSiteBatch) throws EmisBizError {
|
||||
List<EmisWaybill> emisWaybills = emisTmsSiteBatchDtlMapper.selectEmisWayBillByBatchNo(emisTmsSiteBatch.getBatchNo());
|
||||
for (EmisWaybill emisWaybill : emisWaybills) {
|
||||
checkUnique(emisTmsSiteBatch, emisWaybill.getBillCode());
|
||||
}
|
||||
return emisTmsSiteBatchMapper.updateEmisTmsSiteBatch(emisTmsSiteBatch);
|
||||
}
|
||||
|
||||
@ -174,4 +201,28 @@ public class EmisTmsSiteBatchServiceImpl extends EmisBaseService implements IEmi
|
||||
scanSiteBatchByWaybills(waybills);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int addAll(EmisTmsSiteBatch emisTmsSiteBatch) throws EmisBizError {
|
||||
// 插入明细数据
|
||||
if (!CollectionUtils.isEmpty(emisTmsSiteBatch.getBatchDtlList())) {
|
||||
for (EmisTmsSiteBatchDtl itemDtl : emisTmsSiteBatch.getBatchDtlList()) {
|
||||
checkSiteBatch(emisTmsSiteBatch, itemDtl.getBillCode());
|
||||
itemDtl.setBatchNo(emisTmsSiteBatch.getBatchNo());
|
||||
emisTmsSiteBatchDtlMapper.insertEmisTmsSiteBatchDtl(itemDtl);
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(emisTmsSiteBatch.getLoadingList())) {
|
||||
for (EmisTmsSiteBatchLoading batchLoading : emisTmsSiteBatch.getLoadingList()) {
|
||||
batchLoading.setBatchNo(emisTmsSiteBatch.getBatchNo());
|
||||
emisTmsSiteBatchLoadingMapper.insertEmisTmsSiteBatchLoading(batchLoading);
|
||||
}
|
||||
}
|
||||
|
||||
// 插入主批次数据
|
||||
emisTmsSiteBatchMapper.insertEmisTmsSiteBatch(emisTmsSiteBatch);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -210,6 +210,15 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
|
||||
if (existingRules != null && !existingRules.isEmpty()) {
|
||||
throw new EmisBizError(EmisBizErrorType.EXISTS, "已存在相同的规则配置");
|
||||
}
|
||||
EmisTransPlanRule emisTransPlanRule1 = new EmisTransPlanRule();
|
||||
emisTransPlanRule1.setLineCode(emisTransPlanRule.getLineCode());
|
||||
emisTransPlanRule1.setProductType(emisTransPlanRule.getProductType());
|
||||
emisTransPlanRule1.setStartSiteCode(emisTransPlanRule.getNextSiteCode());
|
||||
emisTransPlanRule1.setNextSiteCode(emisTransPlanRule.getStartSiteCode());
|
||||
List<EmisTransPlanRule> existingRules1 = emisTransPlanRuleMapper.checkDuplicate(emisTransPlanRule);
|
||||
if (existingRules1 != null && !existingRules1.isEmpty()) {
|
||||
throw new EmisBizError(EmisBizErrorType.EXISTS, "已存在相同的规则配置");
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkName(EmisTransPlanRule emisTransPlanRule) throws EmisBizError {
|
||||
@ -233,6 +242,9 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
|
||||
if (StringUtil.isBlank(emisTransPlanRule.getSupplierName())) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "供应商名称不能为空");
|
||||
}
|
||||
if(emisTransPlanRule.getStartSiteName().equals(emisTransPlanRule.getNextSiteName())){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "同一产品类型下起始网点、下一网点不能相同");
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkCode(EmisTransPlanRule emisTransPlanRule) throws EmisBizError {
|
||||
@ -254,6 +266,9 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
|
||||
if (StringUtil.isBlank(emisTransPlanRule.getSupplierCode())) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "供应商名称不能为空");
|
||||
}
|
||||
if(emisTransPlanRule.getStartSiteCode().equals(emisTransPlanRule.getNextSiteCode())){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "同一产品类型下起始网点、下一网点不能相同");
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkDate(EmisTransPlanRule emisTransPlanRule) throws EmisBizError {
|
||||
|
||||
@ -12,6 +12,7 @@ package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xdadan.erp.common.core.domain.entity.SysUser;
|
||||
@ -139,6 +140,11 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
checkUseQuotaCredit(emisWaybillOld, getEmisWaybillNewFromJson(emisWaybillAjustApply));
|
||||
}
|
||||
|
||||
// 校验虚拟单逻辑
|
||||
if ("1".equals(getEmisWaybillNewFromJson(emisWaybillAjustApply).getBlVirtual())) {
|
||||
checkVirtualParam(getEmisWaybillNewFromJson(emisWaybillAjustApply),emisWaybillOld);
|
||||
}
|
||||
|
||||
// 插入数据
|
||||
emisWaybillAjustApply.setApplyDate(new Date());
|
||||
emisWaybillAjustApplyMapper.insertEmisWaybillAjustApply(emisWaybillAjustApply);
|
||||
@ -236,8 +242,11 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
emisWaybillAjustApply.setDestConfirmNote(inputObj.getDestConfirmNote());
|
||||
emisWaybillAjustApply.setDestConfirmManCode(getCurrentUser().getEmpCode());
|
||||
|
||||
|
||||
emisWaybillAjustApplyMapper.auditDestNoPass(emisWaybillAjustApply);
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -353,6 +362,9 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"单号不存在!");
|
||||
}
|
||||
|
||||
// 处理虚拟件逻辑
|
||||
handleVirtualForUpdate(emisWaybillSave, emisWaybillOld);
|
||||
|
||||
recordWaybillOperLog(
|
||||
emisWaybillAjustApply.getBillCode(),
|
||||
WaybillOperLogType.SITE_MODIFY_APPLY,
|
||||
|
||||
@ -152,6 +152,38 @@ public class EmisWaybillProblemInfoServiceImpl extends EmisBaseService implement
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除问题件
|
||||
*
|
||||
* @param billCode
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public void deleteEmisWaybillProblemInfoByBillCode(String billCode) {
|
||||
EmisWaybillProblemInfo emisWaybillProblemInfo = emisWaybillProblemInfoMapper.selectEmisWaybillProblemInfoByBillCode(billCode);
|
||||
if (emisWaybillProblemInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 删除该问题件的扫描轨迹
|
||||
emisTmsScanRecordMapper.deletePromScanRecord(emisWaybillProblemInfo.getId().toString(), emisWaybillProblemInfo.getMainBillCode());
|
||||
|
||||
// 删除问题件
|
||||
emisWaybillProblemInfoMapper.deleteEmisWaybillProblemInfoById(emisWaybillProblemInfo.getId());
|
||||
|
||||
// 获取运单信息
|
||||
EmisWaybill waybill = getWaybillByBillCode(emisWaybillProblemInfo.getBillCode());
|
||||
if (!"6".equals(waybill.getPaymentType())) {
|
||||
// 重新计算提成
|
||||
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillProblemInfo.getBillCode());
|
||||
}
|
||||
|
||||
// 删除运单的问题件记录
|
||||
EmisWaybill emisWaybill = new EmisWaybill();
|
||||
emisWaybill.setBillCode(emisWaybillProblemInfo.getMainBillCode());
|
||||
emisWaybillMapper.cancelProblemRegister(emisWaybill);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除问题件信息
|
||||
*
|
||||
|
||||
@ -64,10 +64,10 @@ package com.xdadan.erp.emis.service.impl;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -135,6 +135,15 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
@Autowired
|
||||
private EmisCustomerSignMapper emisCustomerSignMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisTmsSiteBatchMapper emisTmsSiteBatchMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisWaybillProblemInfoMapper emisWaybillProblemInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisSettleSubBillMapper emisSettleSubBillMapper;
|
||||
|
||||
/**
|
||||
* 获取稽核数据
|
||||
* @param id
|
||||
@ -862,6 +871,16 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
// throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "货值必填");
|
||||
}
|
||||
|
||||
// 始发网点
|
||||
if(StringUtil.isBlank(emisWaybillSave.getStartSiteName())){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "始发网点不能为空");
|
||||
}
|
||||
EmisSite site = getSiteByName(emisWaybillSave.getStartSiteName());
|
||||
if(site==null){
|
||||
throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "始发网点不正确");
|
||||
}
|
||||
emisWaybillSave.setStartSiteCode(site.getSiteCode());
|
||||
|
||||
// 线路转换
|
||||
EmisTransLine transLine=getTransLineByName(emisWaybillSave.getTransLineType());
|
||||
if(transLine==null){
|
||||
@ -1480,6 +1499,12 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
// 检查月结客户首次签约日期,首次签约之前开的不允许修改
|
||||
checkFirstSigningDay(emisWaybillOld, emisWaybillSave);
|
||||
|
||||
// // 校验账单确认状态
|
||||
// checkSettleSubBill(emisWaybillSave);
|
||||
|
||||
// 处理虚拟件逻辑
|
||||
handleVirtualForUpdate(emisWaybillSave, emisWaybillOld);
|
||||
|
||||
// 修改运单
|
||||
reUpdateWayBill(emisWaybillOld, emisWaybillSave,true,false);
|
||||
|
||||
@ -1500,6 +1525,16 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
return 1;
|
||||
}
|
||||
|
||||
private void checkSettleSubBill(EmisWaybill emisWaybillSave) throws EmisBizError {
|
||||
List<EmisSettleSubBill> emisSettleSubBillList = emisSettleSubBillMapper.selectSettleSubBillListByBillCode(emisWaybillSave.getBillCode());
|
||||
if (CollectionUtil.isEmpty(emisSettleSubBillList) || Objects.isNull(emisSettleSubBillList.get(0))) {
|
||||
return;
|
||||
}
|
||||
if ("1".equals(emisSettleSubBillList.get(0).getBlConfirmCenter()) || "1".equals(emisSettleSubBillList.get(0).getBlConfirmSite())) {
|
||||
throw new EmisBizError(EmisBizErrorType.BILL_LOCK, "账单已确认,无法修改,需要先取消确认才能修改");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下单接口Oms
|
||||
* @param emisWaybillSave
|
||||
@ -3091,6 +3126,11 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
// 检查信用额度
|
||||
checkUseQuotaCredit(null,emisWaybillSave);
|
||||
|
||||
// 虚拟件逻辑
|
||||
if ("1".equals(emisWaybillSave.getBlVirtual())) {
|
||||
updateMasterWaybill(emisWaybillSave,new EmisWaybill());
|
||||
}
|
||||
|
||||
//插入新单
|
||||
emisWaybillMapper.insertEmisWaybill(emisWaybillSave);
|
||||
|
||||
@ -3194,30 +3234,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 是否是虚拟问题件
|
||||
try {
|
||||
if (!StringUtils.isEmpty(emisWaybillSave.getBlVirtual())) {
|
||||
if ("1".equals(emisWaybillSave.getBlVirtual())) {
|
||||
// 做问题件录入
|
||||
ScanInfo scanInfoProm = new ScanInfo();
|
||||
List<Map<String,Object>> scanDataPromList = new ArrayList<>();
|
||||
scanInfoProm.setOpType(2);
|
||||
scanInfoProm.setScanType(ScanType.ISSUE.opCode);
|
||||
|
||||
Map<String,Object> scanDatePromItem = new HashMap<>();
|
||||
scanDatePromItem.put("billCode",emisWaybillSave.getBillCode());
|
||||
scanDatePromItem.put("problemType","173");
|
||||
scanDatePromItem.put("notifySite",emisWaybillSave.getSendSiteCode());
|
||||
scanDatePromItem.put("scanDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,emisWaybillSave.getSendDate()));
|
||||
scanDatePromItem.put("scanWeight", "0.0");
|
||||
scanDatePromItem.put("remark", "出口虚拟面单");
|
||||
scanDataPromList.add(scanDatePromItem);
|
||||
scanInfoProm.setScanData(scanDataPromList);
|
||||
emisTmsScanRecordService.scan(scanInfoProm,dispatchOrSendManCode,emisWaybillSave.getSendSiteCode());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
// 问题件逻辑
|
||||
if ("1".equals(emisWaybillSave.getBlVirtual())) {
|
||||
scanProblemInfo(emisWaybillSave, null);
|
||||
}
|
||||
|
||||
// 运单立即重新出账
|
||||
@ -3229,7 +3248,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
// reCalcUseQuotaCredit(null, emisWaybillSave);
|
||||
|
||||
// 重新计算提成
|
||||
if (!"6".equals(emisWaybillSave.getPaymentType())) {
|
||||
if (!"6".equals(emisWaybillSave.getPaymentType()) && !"1".equals(emisWaybillSave.getBlVirtual())) {
|
||||
emisCommissionProfitService.reCalcProfitByBillCode(emisWaybillSave.getBillCode());
|
||||
}
|
||||
|
||||
@ -5811,8 +5830,263 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
reUpdateWayBillByOms(oldWaybill, waybillUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EmisWaybill> selectMasterEmisWaybills(EmisWaybill emisWaybill) {
|
||||
|
||||
return emisWaybillMapper.selectMasterEmisWaybills(emisWaybill);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void handleHistoryVirtualWaybill() {
|
||||
try {
|
||||
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<EmisWaybill> failedBills = new ArrayList<>();
|
||||
List<String> filterForProblemCodes = new ArrayList<>();
|
||||
|
||||
// 创建线程池
|
||||
int processors = Runtime.getRuntime().availableProcessors();
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(processors);
|
||||
List<Future<List<EmisWaybill>>> futures = new ArrayList<>();
|
||||
|
||||
// 先查询所有数据
|
||||
while (true) {
|
||||
List<EmisWaybill> waybills = emisWaybillMapper.selectHistoryVirtualWaybill(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));
|
||||
}
|
||||
|
||||
// 处理每个批次
|
||||
for (List<EmisWaybill> batch : batches) {
|
||||
for (EmisWaybill waybill : batch) {
|
||||
try {
|
||||
String remark = waybill.getRemark();
|
||||
if (StringUtils.isNotEmpty(remark)) {
|
||||
String masterBillCode = extractMasterBillCode(remark);
|
||||
if (StringUtil.isBlank(masterBillCode)) {
|
||||
masterBillCode = extractMasterBillCode(waybill.getFeeRemark());
|
||||
}
|
||||
if (StringUtil.isBlank(masterBillCode)) {
|
||||
failedBillCodes.add(waybill.getBillCode());
|
||||
failedBills.add(waybill);
|
||||
log.error("masterBillCode is null,billCode:{}", waybill.getBillCode());
|
||||
failCount++;
|
||||
continue;
|
||||
}
|
||||
waybill.setMasterBillCode(masterBillCode);
|
||||
// 更新运单信息
|
||||
updateWaybill(waybill);
|
||||
successCount++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("处理运单失败,运单号:{},错误:{}", waybill.getBillCode(), e.getMessage());
|
||||
failCount++;
|
||||
failedBillCodes.add(waybill.getBillCode());
|
||||
failedBills.add(waybill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 修正:handleProblem返回统计结果
|
||||
ProblemHandleResult problemResult = handleProblem(failedBillCodes, filterForProblemCodes, failedBills,
|
||||
successCount, failCount);
|
||||
if (problemResult != null) {
|
||||
successCount = problemResult.successCount;
|
||||
failCount = problemResult.failCount;
|
||||
filterForProblemCodes = problemResult.filterForProblemCodes;
|
||||
}
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
long processTime = endTime - startTime;
|
||||
|
||||
log.debug("处理完成,总处理数:{},成功数:{},失败数:{},耗时:{}ms", totalProcessed, successCount, failCount, processTime);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(failedBillCodes)) {
|
||||
log.debug("Failed bill codes ({}): {}", failedBillCodes.size(), failedBillCodes);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(filterForProblemCodes)) {
|
||||
log.debug("Failed for problemCodes ({}): {}", filterForProblemCodes.size(), filterForProblemCodes);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Error in autoScanSiteBatch", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 新增内部类用于返回统计结果
|
||||
private static class ProblemHandleResult {
|
||||
int successCount;
|
||||
int failCount;
|
||||
List<String> filterForProblemCodes;
|
||||
|
||||
ProblemHandleResult(int successCount, int failCount, List<String> filterForProblemCodes) {
|
||||
this.successCount = successCount;
|
||||
this.failCount = failCount;
|
||||
this.filterForProblemCodes = filterForProblemCodes;
|
||||
}
|
||||
}
|
||||
|
||||
// 修改handleProblem返回统计结果
|
||||
private ProblemHandleResult handleProblem(List<String> failedBillCodes, List<String> filterForProblemCodes,
|
||||
List<EmisWaybill> failedBills, int successCount, int failCount) {
|
||||
if (CollectionUtil.isEmpty(failedBillCodes)) {
|
||||
return new ProblemHandleResult(successCount, failCount, filterForProblemCodes);
|
||||
}
|
||||
List<EmisWaybillProblemInfo> emisWaybillProblemInfos = emisWaybillProblemInfoMapper
|
||||
.selectEmisWaybillProblemInfoByBillCodes(failedBillCodes);
|
||||
if (emisWaybillProblemInfos == null) {
|
||||
log.error("emisWaybillProblemInfos is null");
|
||||
return new ProblemHandleResult(successCount, failCount, filterForProblemCodes);
|
||||
}
|
||||
for (EmisWaybillProblemInfo emisWaybillProblemInfo : emisWaybillProblemInfos) {
|
||||
try {
|
||||
String remark = emisWaybillProblemInfo.getProblemCause();
|
||||
if (StringUtil.isBlank(remark)) {
|
||||
filterForProblemCodes.add(emisWaybillProblemInfo.getBillCode());
|
||||
continue;
|
||||
}
|
||||
String masterBillCode = extractMasterBillCode(remark);
|
||||
if (StringUtil.isBlank(masterBillCode)) {
|
||||
filterForProblemCodes.add(emisWaybillProblemInfo.getBillCode());
|
||||
continue;
|
||||
}
|
||||
List<EmisWaybill> fiterBills = failedBills.stream()
|
||||
.filter(i -> i.getBillCode().equals(emisWaybillProblemInfo.getBillCode()))
|
||||
.collect(Collectors.toList());
|
||||
EmisWaybill waybill = new EmisWaybill();
|
||||
waybill.setMasterBillCode(masterBillCode);
|
||||
waybill.setId(fiterBills.get(0).getId());
|
||||
waybill.setBillCode(emisWaybillProblemInfo.getBillCode());
|
||||
// 更新运单信息
|
||||
updateWaybill(waybill);
|
||||
successCount++;
|
||||
failCount--;
|
||||
} catch (Exception e) {
|
||||
log.error("处理问题件失败,运单号:{},错误:{}", emisWaybillProblemInfo.getBillCode(), e.getMessage());
|
||||
filterForProblemCodes.add(emisWaybillProblemInfo.getBillCode());
|
||||
}
|
||||
}
|
||||
return new ProblemHandleResult(successCount, failCount, filterForProblemCodes);
|
||||
}
|
||||
|
||||
private void updateWaybill(EmisWaybill virtualWaybill) {
|
||||
EmisWaybill masterWaybill = emisWaybillMapper
|
||||
.selectMasterWaybillByBillCode(virtualWaybill.getMasterBillCode());
|
||||
String virtualRemark = masterWaybill.getVirtualRemark();
|
||||
String virtualBillCode = virtualWaybill.getBillCode();
|
||||
if (StringUtil.isNotBlank(virtualRemark)) {
|
||||
Set<String> virtualBillSet = new LinkedHashSet<>();
|
||||
String[] codes = virtualRemark.split(",");
|
||||
virtualBillSet.addAll(Arrays.asList(codes));
|
||||
virtualBillSet.add(virtualBillCode);
|
||||
virtualRemark = String.join(",", virtualBillSet);
|
||||
} else {
|
||||
virtualRemark = virtualBillCode;
|
||||
}
|
||||
EmisWaybill updateMasterWaybill = new EmisWaybill();
|
||||
updateMasterWaybill.setVirtualRemark(virtualRemark);
|
||||
updateMasterWaybill.setId(masterWaybill.getId());
|
||||
emisWaybillMapper.updateVirtualWaybill(updateMasterWaybill);
|
||||
|
||||
EmisWaybill updateVirtualWaybill = new EmisWaybill();
|
||||
updateVirtualWaybill.setMasterBillCode(virtualWaybill.getMasterBillCode());
|
||||
updateVirtualWaybill.setId(virtualWaybill.getId());
|
||||
updateVirtualWaybill.setBlVirtual("1");
|
||||
emisWaybillMapper.updateVirtualWaybill(updateVirtualWaybill);
|
||||
}
|
||||
|
||||
private String extractMasterBillCode(String remark) {
|
||||
if (StringUtils.isEmpty(remark)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 原有规则:查找T7080开头的主单号
|
||||
int startIndex = remark.indexOf("T7080");
|
||||
if (startIndex != -1) {
|
||||
String subStr = remark.substring(startIndex);
|
||||
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("T7080\\d+");
|
||||
java.util.regex.Matcher matcher = pattern.matcher(subStr);
|
||||
if (matcher.find()) {
|
||||
return matcher.group();
|
||||
}
|
||||
}
|
||||
|
||||
// 新规则:查找主单相关关键词后的内容,直到最后一位数字为止,且不能包含汉字
|
||||
String[] keywords = { "主单为", "主单是", "主单位", "主单号", "主单", "真实单号" };
|
||||
for (String keyword : keywords) {
|
||||
int idx = remark.indexOf(keyword);
|
||||
if (idx != -1) {
|
||||
int start = idx + keyword.length();
|
||||
// 从关键词后开始,提取到最后一个数字为止
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean hasDigit = false;
|
||||
for (int i = start; i < remark.length(); i++) {
|
||||
char c = remark.charAt(i);
|
||||
// 如果遇到汉字则停止
|
||||
if (Character.toString(c).matches("[\u4e00-\u9fa5]")) {
|
||||
break;
|
||||
}
|
||||
// 允许字母、数字、-、_等常见单号字符
|
||||
if (Character.isLetterOrDigit(c) || c == '-' || c == '_' || c == '/') {
|
||||
sb.append(c);
|
||||
if (Character.isDigit(c)) {
|
||||
hasDigit = true;
|
||||
}
|
||||
} else if (sb.length() > 0) {
|
||||
// 如果已经开始提取,遇到其他字符则停止
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 去除首尾空格
|
||||
String candidate = sb.toString().trim();
|
||||
// 必须包含数字,且不能包含汉字
|
||||
if (hasDigit && !candidate.matches(".*[\u4e00-\u9fa5].*")) {
|
||||
// 只保留最后一位是数字的部分
|
||||
int lastDigitIdx = -1;
|
||||
for (int i = candidate.length() - 1; i >= 0; i--) {
|
||||
if (Character.isDigit(candidate.charAt(i))) {
|
||||
lastDigitIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lastDigitIdx != -1) {
|
||||
return candidate.substring(0, lastDigitIdx + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
@ -175,6 +175,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and a.trans_line_type=c.line_code
|
||||
and a.payee=#{salesmen}
|
||||
and FIND_IN_SET(c.trans_type,#{transType})
|
||||
and FIND_IN_SET(a.payment_status,'0,2')
|
||||
and a.send_date <![CDATA[ > ]]> #{startDate} and a.send_date <![CDATA[ <= ]]> #{endDate}
|
||||
</select>
|
||||
|
||||
|
||||
@ -191,5 +191,6 @@
|
||||
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}
|
||||
and a.del_flag = '0'
|
||||
and a.send_date <![CDATA[ > ]]> '2025-01-01 00:00:00'
|
||||
</select>
|
||||
</mapper>
|
||||
@ -43,12 +43,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="freight" column="freight"/>
|
||||
<result property="waybillRemark" column="waybill_remark"/>
|
||||
<result property="feeRemark" column="fee_remark"/>
|
||||
<result property="missType" column="miss_type"/>
|
||||
</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,
|
||||
m.line_code, m.product_type, m.start_site_code, m.next_site_code, m.supplier_code, m.start_date, m.end_date,
|
||||
m.line_code, m.product_type, m.start_site_code, m.next_site_code, m.supplier_code, m.start_date, m.end_date,m.miss_type,
|
||||
w.send_site_code, s1.site_name as send_site_name,s2.site_name as start_site_name,s3.site_name as next_site_name, w.send_country, c1.name as send_country_name, w.destination_code, n.dest_name as destination_name,w.bl_is_question,
|
||||
l.line_name as line_name,
|
||||
w.receive_country, c2.name as receive_country_name, w.send_date, w.bl_sign, w.sign_date,
|
||||
@ -148,11 +149,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
GROUP BY bill_code
|
||||
HAVING COUNT(*) = #{missCount}
|
||||
)
|
||||
AND m.miss_type = 0
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="billCode != null and billCode != ''">
|
||||
AND m.bill_code = #{billCode}
|
||||
AND m.bill_code REGEXP REPLACE(#{billCode}, '\n', '|')
|
||||
</if>
|
||||
<if test="missReason != null and missReason != ''">
|
||||
AND m.miss_reason like concat('%', #{missReason}, '%')
|
||||
@ -197,6 +199,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
and w.send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
||||
</if>
|
||||
</where>
|
||||
order by m.bill_code desc
|
||||
</select>
|
||||
|
||||
<select id="selectEmisTmsSiteBatchMissById" parameterType="Long" resultMap="EmisTmsSiteBatchMissResult">
|
||||
|
||||
@ -61,8 +61,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by id desc
|
||||
</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">
|
||||
<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>
|
||||
r.del_flag = '0'
|
||||
AND r.line_code in
|
||||
@ -242,4 +280,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND del_flag = '0'
|
||||
</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>
|
||||
@ -12,6 +12,8 @@
|
||||
<result property="billCodeSub" column="bill_code_sub" />
|
||||
<result property="orderStatus" column="order_status" />
|
||||
<result property="waybillStatus" column="waybill_status" />
|
||||
<result property="startSiteCode" column="start_site_code" />
|
||||
<result property="startSiteName" column="start_site_name" />
|
||||
<result property="orderType" column="order_type" />
|
||||
<result property="orderDate" column="order_date" />
|
||||
<result property="userId" column="user_id" />
|
||||
@ -225,6 +227,10 @@
|
||||
<result property="customerNickName" column="customer_nick_name" />
|
||||
<result property="customerAvatar" column="customer_avatar" />
|
||||
|
||||
<result property="blVirtual" column="bl_virtual" />
|
||||
<result property="masterBillCode" column="master_bill_code" />
|
||||
<result property="virtualRemark" column="virtual_remark" />
|
||||
|
||||
<result property="transType" column="trans_type" />
|
||||
|
||||
|
||||
@ -288,7 +294,7 @@
|
||||
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.receive_county, a.receive_town, a.receive_address, a.receive_postcode, a.receive_pcd, a.send_name, a.send_company,a.start_site_code,
|
||||
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,
|
||||
@ -298,7 +304,7 @@
|
||||
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.settlement_weight, a.scan_weight, a.fee_weight, a.freight, a.real_payment_type, a.real_fee, a.bl_special_quote,a.bl_virtual,a.master_bill_code,a.virtual_remark,
|
||||
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,
|
||||
@ -337,6 +343,7 @@
|
||||
w.site_name as current_site_name,
|
||||
x.site_name as next_site_name,
|
||||
y.site_name as last_site_name,
|
||||
start.site_name as start_site_name,
|
||||
z.type_name as problem_type_name,
|
||||
|
||||
k.trans_type as trans_type
|
||||
@ -374,6 +381,7 @@
|
||||
|
||||
left join emis_site a1 on a.send_center_code=a1.site_code and a1.del_flag='0'
|
||||
left join emis_site a2 on a.destination_center_code=a2.site_code and a2.del_flag='0'
|
||||
left join emis_site start on a.start_site_code=start.site_code and start.del_flag='0'
|
||||
left join emis_customer_user a3 on a.customer_code=a3.customer_code and a3.del_flag='0'
|
||||
left join emis_site seaway1 on a.departure_port=seaway1.site_code and seaway1.del_flag='0'
|
||||
left join emis_site seaway2 on a.destination_port=seaway2.site_code and seaway2.del_flag='0'
|
||||
@ -384,7 +392,7 @@
|
||||
<!-- 单个对象可以返回子单数据 -->
|
||||
<sql id="selectEmisWaybillDetailVo">
|
||||
select
|
||||
a.id,a.order_sn, a.cust_order_id, a.bill_code,a.bill_code_sub, a.order_status, a.waybill_status,
|
||||
a.id,a.order_sn, a.cust_order_id, a.bill_code,a.bill_code_sub, a.order_status, a.waybill_status,a.bl_virtual,a.master_bill_code,a.virtual_remark,a.start_site_code,
|
||||
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,
|
||||
@ -437,6 +445,7 @@
|
||||
x.site_name as next_site_name,
|
||||
y.site_name as last_site_name,
|
||||
z.type_name as problem_type_name,
|
||||
start.site_name as start_site_name,
|
||||
|
||||
k.trans_type as trans_type
|
||||
|
||||
@ -477,6 +486,7 @@
|
||||
left join emis_customer_user a3 on a.customer_code=a3.customer_code and a3.del_flag='0'
|
||||
left join emis_site seaway1 on a.departure_port=seaway1.site_code and seaway1.del_flag='0'
|
||||
left join emis_site seaway2 on a.destination_port=seaway2.site_code and seaway2.del_flag='0'
|
||||
left join emis_site start on a.start_site_code=start.site_code and start.del_flag='0'
|
||||
|
||||
</sql>
|
||||
|
||||
@ -490,6 +500,16 @@
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<!--根据运单号获取运单信息 or FIND_IN_SET(#{billCode},bill_code_sub)-->
|
||||
<select id="selectMasterWaybillByBillCode" parameterType="String" resultMap="EmisWaybillResult">
|
||||
select
|
||||
a.* FROM emis_waybill a
|
||||
<where>
|
||||
a.bill_code = #{billCode}
|
||||
</where>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<!-- 提供给扫描记录 查询使用,简化的,不包含扫描记录-->
|
||||
<select id="selectWaybillBaseInfoByBillCode" parameterType="String" resultMap="BaseEmisWaybillResult">
|
||||
<include refid="selectEmisWaybillVo"/>
|
||||
@ -547,6 +567,34 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectMasterEmisWaybills" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
|
||||
<include refid="selectEmisWaybillVo"/>
|
||||
where a.del_flag = '0'
|
||||
-- and a.send_date >= date_sub(curdate(), interval 3 day)
|
||||
<if test="transLineType != null and transLineType != ''">
|
||||
and a.trans_line_type = #{transLineType}
|
||||
</if>
|
||||
<if test="productType != null and productType != ''">
|
||||
and a.product_type=#{productType}
|
||||
</if>
|
||||
<if test="sendSiteCode != null and sendSiteCode != ''">
|
||||
and a.send_site_code=#{sendSiteCode}
|
||||
</if>
|
||||
and (a.bl_virtual is null or a.bl_virtual != '1')
|
||||
<if test="billCode != null and billCode != ''">
|
||||
and a.bill_code like concat('%', #{billCode}, '%')
|
||||
</if>
|
||||
and a.order_status != '0'
|
||||
and a.order_status != '2'
|
||||
<!-- <if test="params.privSiteCode != null and params.privSiteCode != '88888'">-->
|
||||
<!-- and (-->
|
||||
<!-- a.send_site_code=#{params.privSiteCode}-->
|
||||
<!-- or a.dispatch_underling_site_code=#{params.privSiteCode}-->
|
||||
<!-- )-->
|
||||
<!-- </if>-->
|
||||
order by a.send_date desc
|
||||
limit 10
|
||||
</select>
|
||||
|
||||
<select id="selectWaitGotOrderList" parameterType="EmisWaybill" resultMap="EmisWaybillResult">
|
||||
<include refid="selectEmisWaybillVo"/>
|
||||
@ -1136,6 +1184,7 @@
|
||||
<if test="sendCity != null and sendCity != ''"> and send_city=#{sendCity}</if>
|
||||
<if test="sendCounty != null and sendCounty != ''"> and send_county=#{sendCounty}</if>
|
||||
<if test="sendTown != null and sendTown != ''"> and send_town=#{sendTown}</if>
|
||||
<if test="blVirtual ==1"> and bl_virtual=#{blVirtual}</if>
|
||||
<if test="sendAddress != null and sendAddress != ''"> and send_address like concat('%', #{sendAddress}, '%')</if>
|
||||
<if test="sendPostcode != null and sendPostcode != ''"> and send_postcode like concat('%', #{sendPostcode}, '%')</if>
|
||||
<if test="paymentType != null and paymentType != ''"> and FIND_IN_SET(payment_type,#{paymentType})</if>
|
||||
@ -2672,6 +2721,7 @@
|
||||
<if test="billCodeSub != null and billCodeSub != ''">bill_code_sub,</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">order_status,</if>
|
||||
<if test="waybillStatus != null and waybillStatus != ''">waybill_status,</if>
|
||||
<if test="startSiteCode != null and startSiteCode != ''">start_site_code,</if>
|
||||
<if test="orderType != null and orderType != ''">order_type,</if>
|
||||
<if test="orderDate != null">order_date,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
@ -2755,6 +2805,7 @@
|
||||
<if test="blSensitive != null and blSensitive != ''">bl_sensitive,</if>
|
||||
<if test="blOverLong != null and blOverLong != ''">bl_over_long,</if>
|
||||
<if test="blVirtual != null and blVirtual != ''">bl_virtual,</if>
|
||||
<if test="masterBillCode != null and masterBillCode != ''">master_bill_code,</if>
|
||||
<if test="blBill != null and blBill != ''">bl_bill,</if>
|
||||
<if test="blBillText != null and blBillText != ''">bl_bill_text,</if>
|
||||
<if test="blProfit != null and blProfit != ''">bl_profit,</if>
|
||||
@ -2856,6 +2907,7 @@
|
||||
<if test="billCodeSub != null and billCodeSub != ''">#{billCodeSub},</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">#{orderStatus},</if>
|
||||
<if test="waybillStatus != null and waybillStatus != ''">#{waybillStatus},</if>
|
||||
<if test="startSiteCode != null and startSiteCode != ''">#{startSiteCode},</if>
|
||||
<if test="orderType != null and orderType != ''">#{orderType},</if>
|
||||
<if test="orderDate != null">#{orderDate},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
@ -2939,6 +2991,7 @@
|
||||
<if test="blSensitive != null and blSensitive != ''">#{blSensitive},</if>
|
||||
<if test="blOverLong != null and blOverLong != ''">#{blOverLong},</if>
|
||||
<if test="blVirtual != null and blVirtual != ''">#{blVirtual},</if>
|
||||
<if test="masterBillCode != null and masterBillCode != ''">#{masterBillCode},</if>
|
||||
<if test="blBill != null and blBill != ''">#{blBill},</if>
|
||||
<if test="blBillText != null and blBillText != ''">#{blBillText},</if>
|
||||
<if test="blProfit != null and blProfit != ''">#{blProfit},</if>
|
||||
@ -3042,6 +3095,7 @@
|
||||
<if test="billCodeSub != null and billCodeSub != ''">bill_code_sub = #{billCodeSub},</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">order_status = #{orderStatus},</if>
|
||||
<if test="waybillStatus != null and waybillStatus != ''">waybill_status = #{waybillStatus},</if>
|
||||
<if test="startSiteCode != null and startSiteCode != ''">start_site_code = #{startSiteCode},</if>
|
||||
<if test="orderType != null and orderType != ''">order_type = #{orderType},</if>
|
||||
<if test="orderDate != null">order_date = #{orderDate},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
@ -3125,6 +3179,197 @@
|
||||
<if test="blSensitive != null and blSensitive != ''">bl_sensitive = #{blSensitive},</if>
|
||||
<if test="blOverLong != null and blOverLong != ''">bl_over_long = #{blOverLong},</if>
|
||||
<if test="blVirtual != null and blVirtual != ''">bl_virtual = #{blVirtual},</if>
|
||||
master_bill_code= #{masterBillCode},
|
||||
virtual_remark= #{virtualRemark},
|
||||
<if test="blBill != null and blBill != ''">bl_bill = #{blBill},</if>
|
||||
<if test="blBillText != null and blBillText != ''">bl_bill_text = #{blBillText},</if>
|
||||
<if test="blProfit != null and blProfit != ''">bl_profit = #{blProfit},</if>
|
||||
<if test="blOverWeight != null and blOverWeight != ''">bl_over_weight = #{blOverWeight},</if>
|
||||
<if test="overWeightNumber != null and overWeightNumber != ''">over_weight_number = #{overWeightNumber},</if>
|
||||
<if test="feeRemark != null and feeRemark != ''">fee_remark = #{feeRemark},</if>
|
||||
<if test="thirdCode != null and thirdCode != ''">third_code = #{thirdCode},</if>
|
||||
<if test="realValue != null and realValue != ''">real_value = #{realValue},</if>
|
||||
<if test="blInsure != null and blInsure != ''">bl_insure = #{blInsure},</if>
|
||||
<if test="insureValue != null and insureValue != ''">insure_value = #{insureValue},</if>
|
||||
<if test="insureValueCurrency != null and insureValueCurrency != ''">insure_value_currency = #{insureValueCurrency},</if>
|
||||
<if test="insureFeeCurrency != null and insureFeeCurrency != ''">insure_fee_currency = #{insureFeeCurrency},</if>
|
||||
<if test="insureFee != null">insure_fee = #{insureFee},</if>
|
||||
<if test="insureRemark != null and insureRemark != ''">insure_remark = #{insureRemark},</if>
|
||||
<if test="insureSiteCode != null and insureSiteCode != ''">insure_site_code = #{insureSiteCode},</if>
|
||||
<if test="insureDate != null and insureDate != ''">insure_date = #{insureDate},</if>
|
||||
<if test="blCod != null and blCod != ''">bl_cod = #{blCod},</if>
|
||||
<if test="codFee != null">cod_fee = #{codFee},</if>
|
||||
<if test="codFeeCurrency != null and codFeeCurrency != ''">cod_fee_currency = #{codFeeCurrency},</if>
|
||||
<if test="codFeeDesc != null and codFeeDesc != ''">cod_fee_desc = #{codFeeDesc},</if>
|
||||
<if test="blPrint != null and blPrint != ''">bl_print = #{blPrint},</if>
|
||||
<if test="printManCode != null and printManCode != ''">print_man_code = #{printManCode},</if>
|
||||
<if test="printSite != null and printSite != ''">print_site = #{printSite},</if>
|
||||
<if test="printDate != null and printDate != ''">print_date = #{printDate},</if>
|
||||
<if test="printCount != null">print_count = #{printCount},</if>
|
||||
<if test="blDispFd != null and blDispFd != ''">bl_disp_fd = #{blDispFd},</if>
|
||||
<if test="transferCode != null and transferCode != ''">transfer_code = #{transferCode},</if>
|
||||
<if test="transferBillcode != null and transferBillcode != ''">transfer_billcode = #{transferBillcode},</if>
|
||||
<if test="dispFdDate != null">disp_fd_date = #{dispFdDate},</if>
|
||||
<if test="dispFdReason != null and dispFdReason != ''">disp_fd_reason = #{dispFdReason},</if>
|
||||
<if test="currentSiteCode != null and currentSiteCode != ''">current_site_code = #{currentSiteCode},</if>
|
||||
<if test="nextSiteCode != null and nextSiteCode != ''">next_site_code = #{nextSiteCode},</if>
|
||||
<if test="lastSiteCode != null and lastSiteCode != ''">last_site_code = #{lastSiteCode},</if>
|
||||
<if test="registerSiteCode != null and registerSiteCode != ''">register_site_code = #{registerSiteCode},</if>
|
||||
<if test="registerDate != null">register_date = #{registerDate},</if>
|
||||
<if test="registerManCode != null and registerManCode != ''">register_man_code = #{registerManCode},</if>
|
||||
<if test="takePieceEmployeeCode != null and takePieceEmployeeCode != ''">take_piece_employee_code = #{takePieceEmployeeCode},</if>
|
||||
<if test="sendSiteCode != null and sendSiteCode != ''">send_site_code = #{sendSiteCode},</if>
|
||||
<if test="sendCenterCode != null and sendCenterCode != ''">send_center_code = #{sendCenterCode},</if>
|
||||
<if test="sendDate != null">send_date = #{sendDate},</if>
|
||||
<if test="dispatchManCode != null and dispatchManCode != ''">dispatch_man_code = #{dispatchManCode},</if>
|
||||
<if test="dispatchDate != null">dispatch_date = #{dispatchDate},</if>
|
||||
<if test="dispatchSiteCode != null and dispatchSiteCode != ''">dispatch_site_code = #{dispatchSiteCode},</if>
|
||||
<if test="produceBillDate != null">produce_bill_date = #{produceBillDate},</if>
|
||||
<if test="produceBillSiteCode != null and produceBillSiteCode != ''">produce_bill_site_code = #{produceBillSiteCode},</if>
|
||||
<if test="produceBillManCode != null and produceBillManCode != ''">produce_bill_man_code = #{produceBillManCode},</if>
|
||||
<if test="destinationCode != null and destinationCode != ''">destination_code = #{destinationCode},</if>
|
||||
<if test="destinationProvince != null and destinationProvince != ''">destination_province = #{destinationProvince},</if>
|
||||
<if test="destinationCity != null and destinationCity != ''">destination_city = #{destinationCity},</if>
|
||||
<if test="destinationCounty != null and destinationCounty != ''">destination_county = #{destinationCounty},</if>
|
||||
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''">dispatch_underling_site_code = #{dispatchUnderlingSiteCode},</if>
|
||||
<if test="destinationCenterCode != null and destinationCenterCode != ''">destination_center_code = #{destinationCenterCode},</if>
|
||||
<if test="marketManCode != null and marketManCode != ''">market_man_code = #{marketManCode},</if>
|
||||
<if test="payee != null and payee != ''">payee = #{payee},</if>
|
||||
<if test="salesmen != null and salesmen != ''">salesmen = #{salesmen},</if>
|
||||
<if test="operateEmployeeCode != null and operateEmployeeCode != ''">operate_employee_code = #{operateEmployeeCode},</if>
|
||||
<if test="blIsQuestion != null and blIsQuestion != ''">bl_is_question = #{blIsQuestion},</if>
|
||||
<if test="problemType != null">problem_type = #{problemType},</if>
|
||||
<if test="problemCause != null and problemCause != ''">problem_cause = #{problemCause},</if>
|
||||
<if test="problemDelayDays != null">problem_delay_days = #{problemDelayDays},</if>
|
||||
<if test="blMessage != null and blMessage != ''">bl_message = #{blMessage},</if>
|
||||
<if test="blAcceptMessage != null and blAcceptMessage != ''">bl_accept_message = #{blAcceptMessage},</if>
|
||||
<if test="blGenSubbill != null and blGenSubbill != ''">bl_gen_subbill = #{blGenSubbill},</if>
|
||||
<if test="blSign != null and blSign != ''">bl_sign = #{blSign},</if>
|
||||
<if test="signMan != null and signMan != ''">sign_man = #{signMan},</if>
|
||||
<if test="signManCode != null and signManCode != ''">sign_man_code = #{signManCode},</if>
|
||||
<if test="signSiteCode != null and signSiteCode != ''">sign_site_code = #{signSiteCode},</if>
|
||||
<if test="signDate != null">sign_date = #{signDate},</if>
|
||||
<if test="billPicSendRmk != null and billPicSendRmk != ''">bill_pic_send_rmk = #{billPicSendRmk},</if>
|
||||
<if test="billPicDispatchRmk != null and billPicDispatchRmk != ''">bill_pic_dispatch_rmk = #{billPicDispatchRmk},</if>
|
||||
<if test="timezoneOffset != null and timezoneOffset != ''">timezone_offset = #{timezoneOffset},</if>
|
||||
<if test="paymentStatus != null and paymentStatus != ''">payment_status = #{paymentStatus},</if>
|
||||
<if test="paymentDate != null">payment_date = #{paymentDate},</if>
|
||||
<if test="paymentRemark != null and paymentRemark != ''">payment_remark = #{paymentRemark},</if>
|
||||
<if test="orderRemark != null and orderRemark != ''">order_remark = #{orderRemark},</if>
|
||||
<if test="cancelCause != null and cancelCause != ''">cancel_cause = #{cancelCause},</if>
|
||||
<if test="dataFrom != null and dataFrom != ''">data_from = #{dataFrom},</if>
|
||||
<if test="blSpecialGoods != null and blSpecialGoods != ''">bl_special_goods = #{blSpecialGoods},</if>
|
||||
<if test="extInfo != null and extInfo != ''">ext_info = #{extInfo},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
|
||||
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
|
||||
<if test="ladingBillCode != null and ladingBillCode != ''">lading_bill_code = #{ladingBillCode},</if>
|
||||
<if test="companyCode != null and companyCode != ''">company_code = #{companyCode},</if>
|
||||
<if test="departurePort != null and departurePort != ''">departure_port = #{departurePort},</if>
|
||||
<if test="destinationPort != null and destinationPort != ''">destination_port = #{destinationPort},</if>
|
||||
<if test="boxQuantity != null and boxQuantity != ''">box_quantity = #{boxQuantity},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateVirtualWaybill" parameterType="EmisWaybill">
|
||||
update emis_waybill
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="custOrderId != null and custOrderId != ''">cust_order_id = #{custOrderId},</if>
|
||||
<if test="billCodeSub != null and billCodeSub != ''">bill_code_sub = #{billCodeSub},</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">order_status = #{orderStatus},</if>
|
||||
<if test="waybillStatus != null and waybillStatus != ''">waybill_status = #{waybillStatus},</if>
|
||||
<if test="orderType != null and orderType != ''">order_type = #{orderType},</if>
|
||||
<if test="orderDate != null">order_date = #{orderDate},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
|
||||
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
|
||||
<if test="openId != null and openId != ''">open_id = #{openId},</if>
|
||||
<if test="receiveName != null and receiveName != ''">receive_name = #{receiveName},</if>
|
||||
<if test="receiveCompany != null and receiveCompany != ''">receive_company = #{receiveCompany},</if>
|
||||
<if test="receiveMobile != null and receiveMobile != ''">receive_mobile = #{receiveMobile},</if>
|
||||
<if test="receiveTel != null and receiveTel != ''">receive_tel = #{receiveTel},</if>
|
||||
<if test="receiveCountry != null and receiveCountry != ''">receive_country = #{receiveCountry},</if>
|
||||
<if test="receiveProvince != null and receiveProvince != ''">receive_province = #{receiveProvince},</if>
|
||||
<if test="receiveCity != null and receiveCity != ''">receive_city = #{receiveCity},</if>
|
||||
<if test="receiveCounty != null and receiveCounty != ''">receive_county = #{receiveCounty},</if>
|
||||
<if test="receiveTown != null and receiveTown != ''">receive_town = #{receiveTown},</if>
|
||||
<if test="receiveAddress != null and receiveAddress != ''">receive_address = #{receiveAddress},</if>
|
||||
<if test="receivePostcode != null and receivePostcode != ''">receive_postcode = #{receivePostcode},</if>
|
||||
<if test="receivePcd != null and receivePcd != ''">receive_pcd = #{receivePcd},</if>
|
||||
<if test="sendName != null and sendName != ''">send_name = #{sendName},</if>
|
||||
<if test="sendCompany != null and sendCompany != ''">send_company = #{sendCompany},</if>
|
||||
<if test="sendMobile != null and sendMobile != ''">send_mobile = #{sendMobile},</if>
|
||||
<if test="sendTel != null and sendTel != ''">send_tel = #{sendTel},</if>
|
||||
<if test="sendCountry != null and sendCountry != ''">send_country = #{sendCountry},</if>
|
||||
<if test="sendProvince != null and sendProvince != ''">send_province = #{sendProvince},</if>
|
||||
<if test="sendCity != null and sendCity != ''">send_city = #{sendCity},</if>
|
||||
<if test="sendCounty != null and sendCounty != ''">send_county = #{sendCounty},</if>
|
||||
<if test="sendTown != null and sendTown != ''">send_town = #{sendTown},</if>
|
||||
<if test="sendAddress != null and sendAddress != ''">send_address = #{sendAddress},</if>
|
||||
<if test="sendPostcode != null and sendPostcode != ''">send_postcode = #{sendPostcode},</if>
|
||||
<if test="sendPcd != null and sendPcd != ''">send_pcd = #{sendPcd},</if>
|
||||
<if test="paymentType != null and paymentType != ''">payment_type = #{paymentType},</if>
|
||||
<if test="calcFeeType != null and calcFeeType != ''">calc_fee_type = #{calcFeeType},</if>
|
||||
<if test="custNo != null and custNo != ''">cust_no = #{custNo},</if>
|
||||
<if test="custName != null and custName != ''">cust_name = #{custName},</if>
|
||||
<if test="transLineType != null and transLineType != ''">trans_line_type = #{transLineType},</if>
|
||||
<if test="productType != null and productType != ''">product_type = #{productType},</if>
|
||||
<if test="timeType != null and timeType != ''">time_type = #{timeType},</if>
|
||||
<if test="meterType != null and meterType != ''">meter_type = #{meterType},</if>
|
||||
<if test="carryType != null and carryType != ''">carry_type = #{carryType},</if>
|
||||
<if test="customsClear != null and customsClear != ''">customs_clear = #{customsClear},</if>
|
||||
<if test="customsEclaration != null and customsEclaration != ''">customs_eclaration = #{customsEclaration},</if>
|
||||
<if test="estimateDate != null">estimate_date = #{estimateDate},</if>
|
||||
<if test="packType != null and packType != ''">pack_type = #{packType},</if>
|
||||
<if test="dispatchMethod != null and dispatchMethod != ''">dispatch_method = #{dispatchMethod},</if>
|
||||
<if test="pickupMethod != null and pickupMethod != ''">pickup_method = #{pickupMethod},</if>
|
||||
<if test="pickStartDate != null">pick_start_date = #{pickStartDate},</if>
|
||||
<if test="pickFinishDate != null">pick_finish_date = #{pickFinishDate},</if>
|
||||
<if test="pickFailReason != null and pickFailReason != ''">pick_fail_reason = #{pickFailReason},</if>
|
||||
<if test="intoWarehouseCode != null and intoWarehouseCode != ''">into_warehouse_code = #{intoWarehouseCode},</if>
|
||||
<if test="intoWarehouseName != null and intoWarehouseName != ''">into_warehouse_name = #{intoWarehouseName},</if>
|
||||
<if test="intoWarehouseAddress != null and intoWarehouseAddress != ''">into_warehouse_address = #{intoWarehouseAddress},</if>
|
||||
<if test="intoWarehouseContact != null and intoWarehouseContact != ''">into_warehouse_contact = #{intoWarehouseContact},</if>
|
||||
<if test="intoWarehousePhone != null and intoWarehousePhone != ''">into_warehouse_phone = #{intoWarehousePhone},</if>
|
||||
<if test="intoWarehouseBillCode != null and intoWarehouseBillCode != ''">into_warehouse_bill_code = #{intoWarehouseBillCode},</if>
|
||||
<if test="warehouseInNo != null and warehouseInNo != ''">warehouse_in_no = #{warehouseInNo},</if>
|
||||
<if test="customerDeliveryBeginTime != null and customerDeliveryBeginTime != ''">customer_delivery_begin_time = #{customerDeliveryBeginTime},</if>
|
||||
<if test="customerDeliveryEndTime != null and customerDeliveryEndTime != ''">customer_delivery_end_time = #{customerDeliveryEndTime},</if>
|
||||
<if test="goodsType != null and goodsType != ''">goods_type = #{goodsType},</if>
|
||||
<if test="goodsInfo != null and goodsInfo != ''">goods_info = #{goodsInfo},</if>
|
||||
<if test="goodsPics != null and goodsPics != ''">goods_pics = #{goodsPics},</if>
|
||||
<if test="blPrepareInFreight != null and blPrepareInFreight != ''">bl_prepare_in_freight = #{blPrepareInFreight},</if>
|
||||
<if test="prepareInEstFee != null">prepare_in_est_fee = #{prepareInEstFee},</if>
|
||||
<if test="prepareInRealFee != null">prepare_in_real_fee = #{prepareInRealFee},</if>
|
||||
<if test="prepareInExpress != null and prepareInExpress != ''">prepare_in_express = #{prepareInExpress},</if>
|
||||
<if test="prepareInBillCode != null and prepareInBillCode != ''">prepare_in_bill_code = #{prepareInBillCode},</if>
|
||||
<if test="prepareInRemark != null and prepareInRemark != ''">prepare_in_remark = #{prepareInRemark},</if>
|
||||
<if test="prepareInSupplier != null and prepareInSupplier != ''">prepare_in_supplier = #{prepareInSupplier},</if>
|
||||
<if test="totalWeight != null">total_weight = #{totalWeight},</if>
|
||||
<if test="totalVolume != null">total_volume = #{totalVolume},</if>
|
||||
<if test="parcelQty != null">parcel_qty = #{parcelQty},</if>
|
||||
<if test="billWeight != null">bill_weight = #{billWeight},</if>
|
||||
<if test="volumeWeight != null">volume_weight = #{volumeWeight},</if>
|
||||
<if test="currency != null and currency != ''">currency = #{currency},</if>
|
||||
<if test="settlementWeight != null">settlement_weight = #{settlementWeight},</if>
|
||||
<if test="scanWeight != null">scan_weight = #{scanWeight},</if>
|
||||
<if test="feeWeight != null">fee_weight = #{feeWeight},</if>
|
||||
<if test="freight != null">freight = #{freight},</if>
|
||||
<if test="realPaymentType != null and realPaymentType != ''">real_payment_type = #{realPaymentType},</if>
|
||||
<if test="realFee != null">real_fee = #{realFee},</if>
|
||||
<if test="blSpecialQuote != null and blSpecialQuote != ''">bl_special_quote = #{blSpecialQuote},</if>
|
||||
<if test="blSensitive != null and blSensitive != ''">bl_sensitive = #{blSensitive},</if>
|
||||
<if test="blOverLong != null and blOverLong != ''">bl_over_long = #{blOverLong},</if>
|
||||
<if test="blVirtual != null and blVirtual != ''">bl_virtual = #{blVirtual},</if>
|
||||
master_bill_code= #{masterBillCode},
|
||||
virtual_remark= #{virtualRemark},
|
||||
<if test="blBill != null and blBill != ''">bl_bill = #{blBill},</if>
|
||||
<if test="blBillText != null and blBillText != ''">bl_bill_text = #{blBillText},</if>
|
||||
<if test="blProfit != null and blProfit != ''">bl_profit = #{blProfit},</if>
|
||||
@ -3540,8 +3785,21 @@
|
||||
<if test="lineCode != null and lineCode != ''">
|
||||
and a.trans_line_type = #{lineCode}
|
||||
</if>
|
||||
and a.send_date <![CDATA[ > ]]> '2025-01-01 00:00:00'
|
||||
and (a.virtual_remark is null or virtual_remark = '')
|
||||
order by a.create_time desc
|
||||
limit #{offset}, #{pageSize}
|
||||
limit #{offset}, #{pageSize}
|
||||
</select>
|
||||
|
||||
<select id="selectHistoryVirtualWaybill" resultMap="EmisWaybillResult">
|
||||
select a.id, a.bill_code,a.master_bill_code,a.problem_type, a.remark,a.fee_remark
|
||||
from emis_waybill a
|
||||
where a.del_flag = '0' and
|
||||
a.problem_type in (173,170)
|
||||
and (master_bill_code is null or master_bill_code='')
|
||||
-- and a.bill_code ='T708030039025903'
|
||||
order by a.create_time desc
|
||||
limit #{offset}, #{pageSize}
|
||||
</select>
|
||||
|
||||
<select id="selectCustEmisWaybillById" parameterType="Long" resultMap="EmisWaybillResult">
|
||||
|
||||
@ -127,6 +127,21 @@
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectEmisWaybillProblemInfoByBillCode" parameterType="String" resultMap="EmisWaybillProblemInfoResult">
|
||||
select id, bill_code, main_bill_code, bl_sub_bill, problem_type, problem_title, problem_cause, send_site, send_site_code, register_man_code, register_man_dept, register_site_code, register_date, register_save_date, data_from, status, is_send_site_register, bl_reversion, reversion_str, reversion_man, reversion_man_code, reversion_site_code, reversion_date, bl_checkok, deal_result, bl_see, file_path, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
|
||||
from emis_waybill_problem_info a
|
||||
where a.bill_code = #{billCode}
|
||||
</select>
|
||||
|
||||
<select id="selectEmisWaybillProblemInfoByBillCodes" parameterType="list" resultMap="EmisWaybillProblemInfoResult">
|
||||
select distinct bill_code,id, problem_type, problem_cause
|
||||
from emis_waybill_problem_info
|
||||
where bill_code in
|
||||
<foreach item="billCode" collection="billCodes" open="(" separator="," close=")">
|
||||
#{billCode}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<insert id="insertEmisWaybillProblemInfo" parameterType="EmisWaybillProblemInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into emis_waybill_problem_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@ -250,6 +265,13 @@
|
||||
update emis_waybill_problem_info set del_flag='1' where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByBillCode" parameterType="string">
|
||||
update emis_waybill_problem_info
|
||||
set del_flag='1'
|
||||
where bill_code = #{billCode}
|
||||
and (problem_type = '170' or problem_type = '173')
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmisWaybillProblemInfoByIds" parameterType="String">
|
||||
update emis_waybill_problem_info set del_flag='1' where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user