diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillTransferController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillTransferController.java index 34353fc5e..a7f494880 100644 --- a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillTransferController.java +++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillTransferController.java @@ -46,7 +46,9 @@ import com.xdadan.erp.common.enums.BusinessType; import com.xdadan.erp.common.utils.poi.ExcelUtil; import com.xdadan.erp.emis.domain.EmisWaybillTransfer; +import com.xdadan.erp.emis.domain.EmisWaybillProblemInfo; import com.xdadan.erp.emis.service.IEmisWaybillTransferService; +import com.xdadan.erp.emis.service.IEmisWaybillProblemInfoService; /** * 运单转件表Controller @@ -67,6 +69,9 @@ public class EmisWaybillTransferController extends EmisBaseController @Autowired private EmisBaseService emisBaseService; + @Autowired + private IEmisWaybillProblemInfoService emisWaybillProblemInfoService; + /** @@ -151,6 +156,57 @@ public class EmisWaybillTransferController extends EmisBaseController return AjaxResult.error(" 运单号,转件单号,转件时间,目的城市,转件公司必填!"); } + // 校验运单的问题件类型:面单删除(151)、出口虚拟单(173)、返货虚拟单(170)不允许转件 + if(StringUtils.isNotEmpty(emisWaybillTransfer.getBillCode())){ + String billCode = emisWaybillTransfer.getBillCode(); + // 获取主单号 + String mainBillCode = emisBaseService.getMainBillCode(billCode); + + // 检查主单号的问题件(问题件通常关联到主单号) + EmisWaybillProblemInfo queryProblem = new EmisWaybillProblemInfo(); + queryProblem.setBillCode(mainBillCode); + List problemList = emisWaybillProblemInfoService.selectEmisWaybillProblemInfoList(queryProblem); + if(!CollectionUtils.isEmpty(problemList)){ + for(EmisWaybillProblemInfo problemInfo : problemList){ + Integer problemType = problemInfo.getProblemType(); + if(problemType != null && (problemType == 151 || problemType == 170 || problemType == 173)){ + String problemTypeName = ""; + if(problemType == 151){ + problemTypeName = "面单删除"; + } else if(problemType == 170){ + problemTypeName = "返货虚拟单"; + } else if(problemType == 173){ + problemTypeName = "出口虚拟单"; + } + return AjaxResult.error("运单已登记问题件类型为" + problemTypeName + ",不允许转件!"); + } + } + } + + // 如果传入的是子单号,也检查子单号的问题件 + if(!billCode.equals(mainBillCode)){ + EmisWaybillProblemInfo querySubProblem = new EmisWaybillProblemInfo(); + querySubProblem.setBillCode(billCode); + List subProblemList = emisWaybillProblemInfoService.selectEmisWaybillProblemInfoList(querySubProblem); + if(!CollectionUtils.isEmpty(subProblemList)){ + for(EmisWaybillProblemInfo problemInfo : subProblemList){ + Integer problemType = problemInfo.getProblemType(); + if(problemType != null && (problemType == 151 || problemType == 170 || problemType == 173)){ + String problemTypeName = ""; + if(problemType == 151){ + problemTypeName = "面单删除"; + } else if(problemType == 170){ + problemTypeName = "返货虚拟单"; + } else if(problemType == 173){ + problemTypeName = "出口虚拟单"; + } + return AjaxResult.error("运单已登记问题件类型为" + problemTypeName + ",不允许转件!"); + } + } + } + } + } + // 校验转单号格式:只允许英文和数字,长度6-32位 String transferBillCode = emisWaybillTransfer.getTransferBillCode(); if (StringUtils.isNotEmpty(transferBillCode)) {