demand: TMS-缅甸虚拟单调整
committer: heyu
This commit is contained in:
parent
424cc100d1
commit
81aa722733
@ -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,9 +97,27 @@ public class EmisTmsSiteBatchDtlController extends EmisBaseController
|
||||
@PreAuthorize("@ss.hasPermi('emis:emisTmsSiteBatchDtl:add')")
|
||||
@Log(title = "一级网点TMS组批次明细", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmisTmsSiteBatchDtl emisTmsSiteBatchDtl)
|
||||
{
|
||||
return toAjax(emisTmsSiteBatchDtlService.insertEmisTmsSiteBatchDtl(emisTmsSiteBatchDtl));
|
||||
public AjaxResult add(@RequestBody EmisTmsSiteBatchDtl emisTmsSiteBatchDtl) throws EmisBizError {
|
||||
JSONObject jObjOut = new JSONObject();
|
||||
String result = "success";
|
||||
String msg = "提交成功";
|
||||
try {
|
||||
emisTmsSiteBatchDtlService.insertEmisTmsSiteBatchDtl(emisTmsSiteBatchDtl);
|
||||
} catch (EmisBizError ex) {
|
||||
ex.printStackTrace();
|
||||
result = "fail";
|
||||
msg = ex.getErrorCode() + ":" + ex.getMessage();
|
||||
} catch (Exception ex) {
|
||||
result = "fail";
|
||||
ex.printStackTrace();
|
||||
msg = "系统异常:" + ex.getMessage();
|
||||
if (ex instanceof EmisBizError) {
|
||||
msg = ((EmisBizError) ex).getErrorCode() + ":" + ex.getMessage();
|
||||
}
|
||||
}
|
||||
jObjOut.put("result", result);
|
||||
jObjOut.put("msg", msg);
|
||||
return AjaxResult.success("成功", jObjOut);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -111,11 +111,11 @@ public class EmisWaybillController extends EmisBaseController
|
||||
/**
|
||||
* 查询主单号列表
|
||||
*/
|
||||
@GetMapping(value = "/getMasterBillCodes")
|
||||
public TableDataInfo getMasterBillCodes(EmisWaybill emisWaybill){
|
||||
@GetMapping(value = "/getMasterEmisWaybills")
|
||||
public TableDataInfo getMasterEmisWaybills(EmisWaybill emisWaybill){
|
||||
startPage();
|
||||
emisWaybill.getParams().put("privSiteCode", getLoginUser().getUser().getOwnerSiteCode());
|
||||
List<String> list = emisWaybillService.selectMasterBillCodes(emisWaybill);
|
||||
List<EmisWaybill> list = emisWaybillService.selectMasterEmisWaybills(emisWaybill);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
@ -312,7 +312,7 @@ public class EmisWaybill extends BaseEntity
|
||||
|
||||
/* 是否超长 */
|
||||
private String blOverLong;
|
||||
/* 是否虚拟单 */
|
||||
/* 是否虚拟单.0:否,1:是 */
|
||||
private String blVirtual;
|
||||
/* 主单号 */
|
||||
private String masterBillCode;
|
||||
|
||||
@ -311,5 +311,5 @@ public interface EmisWaybillMapper extends BaseMapper<EmisWaybill>
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
*/
|
||||
List<String> selectMasterBillCodes(EmisWaybill emisWaybill);
|
||||
List<EmisWaybill> selectMasterEmisWaybills(EmisWaybill emisWaybill);
|
||||
}
|
||||
|
||||
@ -80,4 +80,19 @@ 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);
|
||||
}
|
||||
|
||||
@ -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,6 +187,9 @@ public class EmisBaseService {
|
||||
@Autowired
|
||||
private EmisWaybillBatchStatusMapper emisWaybillBatchStatusMapper;
|
||||
|
||||
@Autowired
|
||||
private IEmisTmsScanRecordService emisTmsScanRecordService;
|
||||
|
||||
@Autowired
|
||||
private EmisTmsSiteBatchMissRecordMapper emisTmsSiteBatchMissRecordMapper;
|
||||
|
||||
@ -2826,6 +2835,9 @@ public class EmisBaseService {
|
||||
if("3".equals(waybill.getPaymentType()) || "4".equals(waybill.getPaymentType()) ){
|
||||
remark = WaybillHelper.removeUnSeeChar(waybill.getRemark());
|
||||
remark = remark + " " + WaybillHelper.removeUnSeeChar(waybill.getFeeRemark());
|
||||
if (StringUtil.isNotBlank(waybill.getVirtualRemark())) {
|
||||
remark = remark + " " + "该运单为主单,对应虚拟单为" + waybill.getVirtualRemark();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3815,6 +3827,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 开单时间
|
||||
@ -4683,6 +4725,105 @@ public class EmisBaseService {
|
||||
}
|
||||
}
|
||||
|
||||
public void handleVirtual(EmisWaybill emisWaybillSave) throws EmisBizError {
|
||||
if (!"1".equals(emisWaybillSave.getBlVirtual())) {
|
||||
return;
|
||||
}
|
||||
updateMasterWaybill(emisWaybillSave);
|
||||
// 做问题件录入
|
||||
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());
|
||||
scanDatePromItem.put("scanDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, emisWaybillSave.getSendDate()));
|
||||
scanDatePromItem.put("scanWeight", "0.0");
|
||||
scanDataPromList.add(scanDatePromItem);
|
||||
scanInfoProm.setScanData(scanDataPromList);
|
||||
emisTmsScanRecordService.scan(scanInfoProm, dispatchOrSendManCode, emisWaybillSave.getSendSiteCode());
|
||||
}
|
||||
|
||||
private void updateMasterWaybill(EmisWaybill emisWaybillSave) throws EmisBizError {
|
||||
EmisWaybill masterWaybill = checkVirtualParam(emisWaybillSave);
|
||||
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) throws EmisBizError {
|
||||
if (StringUtil.isBlank(emisWaybillSave.getMasterBillCode())) {
|
||||
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
|
||||
.selectEmisWaybillByBillCode(emisWaybillSave.getMasterBillCode());
|
||||
if (Objects.isNull(masterWaybill)) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不存在");
|
||||
}
|
||||
if (!emisWaybillSave.getReceiveCountry().equals(masterWaybill.getReceiveCountry())
|
||||
|| !emisWaybillSave.getTransLineType().equals(masterWaybill.getTransLineType())) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单和虚拟单线路不一致");
|
||||
}
|
||||
|
||||
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);
|
||||
} 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组批次明细
|
||||
|
||||
@ -67,4 +67,12 @@ public interface IEmisWaybillProblemInfoService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisWaybillProblemInfoById(Long id);
|
||||
|
||||
/**
|
||||
* 删除问题件信息
|
||||
*
|
||||
* @param billCode
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteEmisWaybillProblemInfoByBillCode(String billCode);
|
||||
}
|
||||
|
||||
@ -296,5 +296,5 @@ public interface IEmisWaybillService extends IDataAuditService
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
*/
|
||||
List<String> selectMasterBillCodes(EmisWaybill emisWaybill);
|
||||
List<EmisWaybill> selectMasterEmisWaybills(EmisWaybill emisWaybill);
|
||||
}
|
||||
|
||||
@ -11,6 +11,13 @@
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
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.EmisWaybillMapper;
|
||||
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 +36,9 @@ public class EmisTmsSiteBatchDtlServiceImpl implements IEmisTmsSiteBatchDtlServi
|
||||
@Autowired
|
||||
private EmisTmsSiteBatchDtlMapper emisTmsSiteBatchDtlMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisWaybillMapper emisWaybillMapper;
|
||||
|
||||
/**
|
||||
* 查询一级网点TMS组批次明细
|
||||
*
|
||||
@ -60,8 +70,11 @@ public class EmisTmsSiteBatchDtlServiceImpl implements IEmisTmsSiteBatchDtlServi
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEmisTmsSiteBatchDtl(EmisTmsSiteBatchDtl emisTmsSiteBatchDtl)
|
||||
{
|
||||
public int insertEmisTmsSiteBatchDtl(EmisTmsSiteBatchDtl emisTmsSiteBatchDtl) throws EmisBizError {
|
||||
EmisWaybill emisWaybill = emisWaybillMapper.selectEmisWaybillByBillCode(emisTmsSiteBatchDtl.getBillCode());
|
||||
if (Objects.nonNull(emisWaybill) && StringUtil.isNotBlank(emisWaybill.getVirtualRemark())) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, emisTmsSiteBatchDtl.getBillCode() + "已绑定虚拟单,无法录入批次");
|
||||
}
|
||||
return emisTmsSiteBatchDtlMapper.insertEmisTmsSiteBatchDtl(emisTmsSiteBatchDtl);
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -115,11 +116,22 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"有申请单审核中,待审核后再提交!");
|
||||
}
|
||||
|
||||
EmisWaybill newWayBill = getEmisWaybillNewFromJson(emisWaybillAjustApply);
|
||||
// 检查月结客户首次签约日期,首次签约之前开的不允许修改
|
||||
checkFirstSigningDay(emisWaybillOld, getEmisWaybillNewFromJson(emisWaybillAjustApply));
|
||||
checkFirstSigningDay(emisWaybillOld, newWayBill);
|
||||
|
||||
// 检查月结/现金客户额度
|
||||
checkUseQuotaCredit(emisWaybillOld, getEmisWaybillNewFromJson(emisWaybillAjustApply));
|
||||
checkUseQuotaCredit(emisWaybillOld, newWayBill);
|
||||
|
||||
// // 检查账单是否确认
|
||||
// if (isConfirm(newWayBill)) {
|
||||
// throw new EmisBizError(EmisBizErrorType.BILL_LOCK, "已锁账:" + newWayBill.getLockReason());
|
||||
// }
|
||||
//
|
||||
// // 校验虚拟单参数
|
||||
// if (Objects.nonNull(newWayBill) && "1".equals(newWayBill.getBlVirtual())) {
|
||||
// checkVirtualParam(newWayBill);
|
||||
// }
|
||||
|
||||
// 插入数据
|
||||
emisWaybillAjustApplyMapper.insertEmisWaybillAjustApply(emisWaybillAjustApply);
|
||||
@ -328,6 +340,9 @@ public class EmisWaybillAjustApplyServiceImpl extends EmisBaseService implements
|
||||
emisCommissionDtlMapper.deleteEmisCommissionDtlByBillCode(emisWaybillSave.getBillCode());
|
||||
}
|
||||
|
||||
// 处理虚拟件逻辑
|
||||
handleVirtualForUpdate(emisWaybillSave, emisWaybillOld);
|
||||
|
||||
// 审核通过
|
||||
return emisWaybillAjustApplyMapper.auditCenterPass(emisWaybillAjustApply);
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除问题件信息
|
||||
*
|
||||
|
||||
@ -14,7 +14,6 @@ package com.xdadan.erp.emis.service.impl;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.beust.jcommander.internal.Lists;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import com.deepoove.poi.config.Configure;
|
||||
import com.deepoove.poi.data.PictureType;
|
||||
@ -65,9 +64,6 @@ 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.stream.Collectors;
|
||||
|
||||
@ -139,6 +135,12 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
@Autowired
|
||||
private EmisTmsSiteBatchMapper emisTmsSiteBatchMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisWaybillProblemInfoMapper emisWaybillProblemInfoMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisSettleSubBillMapper emisSettleSubBillMapper;
|
||||
|
||||
/**
|
||||
* 获取稽核数据
|
||||
* @param id
|
||||
@ -1484,6 +1486,12 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
// 检查月结客户首次签约日期,首次签约之前开的不允许修改
|
||||
checkFirstSigningDay(emisWaybillOld, emisWaybillSave);
|
||||
|
||||
// // 校验账单确认状态
|
||||
// checkSettleSubBill(emisWaybillSave);
|
||||
|
||||
// 处理虚拟件逻辑
|
||||
handleVirtualForUpdate(emisWaybillSave, emisWaybillOld);
|
||||
|
||||
// 修改运单
|
||||
reUpdateWayBill(emisWaybillOld, emisWaybillSave,true);
|
||||
|
||||
@ -1504,6 +1512,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
|
||||
@ -3079,13 +3097,6 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
|
||||
}
|
||||
|
||||
// 是否是虚拟问题件
|
||||
if (!StringUtils.isEmpty(emisWaybillSave.getBlVirtual())) {
|
||||
if ("1".equals(emisWaybillSave.getBlVirtual())) {
|
||||
checkVirtual(emisWaybillSave);
|
||||
}
|
||||
}
|
||||
|
||||
// 设定为业务开单
|
||||
emisWaybillSave.setOrderType("1");
|
||||
emisWaybillSave.setOrderDate(new Date());
|
||||
@ -3207,31 +3218,8 @@ 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();
|
||||
}
|
||||
// 处理虚拟件逻辑
|
||||
handleVirtual(emisWaybillSave);
|
||||
|
||||
// 运单立即重新出账
|
||||
try {
|
||||
@ -3242,7 +3230,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());
|
||||
}
|
||||
|
||||
@ -3251,43 +3239,6 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
}
|
||||
}
|
||||
|
||||
private void checkVirtual(EmisWaybill emisWaybillSave) throws EmisBizError {
|
||||
if (StringUtil.isBlank(emisWaybillSave.getMasterBillCode())) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不能为空");
|
||||
}
|
||||
EmisWaybill masterWaybill = emisWaybillMapper
|
||||
.selectEmisWaybillByBillCode(emisWaybillSave.getMasterBillCode());
|
||||
if (Objects.isNull(masterWaybill)) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单号不存在");
|
||||
}
|
||||
if (!emisWaybillSave.getReceiveCountry().equals(masterWaybill.getReceiveCountry())
|
||||
|| !emisWaybillSave.getTransLineType().equals(masterWaybill.getTransLineType())) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "主单和虚拟单线路不一致");
|
||||
}
|
||||
|
||||
List<EmisTmsSiteBatch> batchList = emisTmsSiteBatchMapper.selectEmisTmsSiteBatchListByBillCodes(
|
||||
Lists.newArrayList(Collections.singleton(emisWaybillSave.getMasterBillCode())));
|
||||
if (CollectionUtil.isNotEmpty(batchList)) {
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "该单号已经录入批次,请先在组批次中剔除该运单");
|
||||
}
|
||||
String virtualRemark = masterWaybill.getVirtualRemark();
|
||||
String virtualBillCode = emisWaybillSave.getBillCode();
|
||||
String virtualBillCodeLastSix = emisWaybillSave.getBillCode().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);
|
||||
}
|
||||
|
||||
private void checkCountry(EmisWaybill emisWaybillSave) throws EmisBizError {
|
||||
EmisTransLine emisTransLine = new EmisTransLine();
|
||||
emisTransLine.setLineCode(emisWaybillSave.getTransLineType());
|
||||
@ -5862,9 +5813,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> selectMasterBillCodes(EmisWaybill emisWaybill) {
|
||||
public List<EmisWaybill> selectMasterEmisWaybills(EmisWaybill emisWaybill) {
|
||||
|
||||
return emisWaybillMapper.selectMasterBillCodes(emisWaybill);
|
||||
return emisWaybillMapper.selectMasterEmisWaybills(emisWaybill);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@ -551,15 +551,14 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectMasterBillCodes" parameterType="EmisWaybill" resultType="string">
|
||||
select bill_code
|
||||
from emis_waybill
|
||||
where del_flag = '0'
|
||||
and send_date >= date_sub(curdate(), interval 3 day)
|
||||
and trans_line_type = #{transLineType}
|
||||
and (bl_virtual is null or bl_virtual != '1')
|
||||
<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)
|
||||
and a.trans_line_type = #{transLineType}
|
||||
and (a.bl_virtual is null or a.bl_virtual != '1')
|
||||
<if test="billCode != null and billCode != ''">
|
||||
and bill_code like concat('%', #{billCode}, '%')
|
||||
and a.bill_code like concat('%', #{billCode}, '%')
|
||||
</if>
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and (
|
||||
@ -3147,8 +3146,8 @@
|
||||
<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>
|
||||
<if test="masterBillCode != null and masterBillCode != ''">master_bill_code= #{masterBillCode},</if>
|
||||
<if test="virtualRemark != null and virtualRemark != ''">virtual_remark= #{virtualRemark},</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>
|
||||
|
||||
@ -127,6 +127,12 @@
|
||||
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>
|
||||
|
||||
<insert id="insertEmisWaybillProblemInfo" parameterType="EmisWaybillProblemInfo" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into emis_waybill_problem_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@ -250,6 +256,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