demand: TMS系统 - 运单管理 - 转件管理 - 转件登记新增判断,若运单号已登记 面单删除、出口虚拟单、返货虚拟单,以上三个问题件类型任意一种问题件类型都不允许登记转件

This commit is contained in:
aike 2026-01-13 10:18:10 +08:00
parent 6114b40029
commit e1e2e966dd

View File

@ -46,7 +46,9 @@ import com.xdadan.erp.common.enums.BusinessType;
import com.xdadan.erp.common.utils.poi.ExcelUtil; import com.xdadan.erp.common.utils.poi.ExcelUtil;
import com.xdadan.erp.emis.domain.EmisWaybillTransfer; 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.IEmisWaybillTransferService;
import com.xdadan.erp.emis.service.IEmisWaybillProblemInfoService;
/** /**
* 运单转件表Controller * 运单转件表Controller
@ -67,6 +69,9 @@ public class EmisWaybillTransferController extends EmisBaseController
@Autowired @Autowired
private EmisBaseService emisBaseService; private EmisBaseService emisBaseService;
@Autowired
private IEmisWaybillProblemInfoService emisWaybillProblemInfoService;
/** /**
@ -151,6 +156,57 @@ public class EmisWaybillTransferController extends EmisBaseController
return AjaxResult.error(" 运单号,转件单号,转件时间,目的城市,转件公司必填!"); 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<EmisWaybillProblemInfo> 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<EmisWaybillProblemInfo> 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位 // 校验转单号格式:只允许英文和数字,长度6-32位
String transferBillCode = emisWaybillTransfer.getTransferBillCode(); String transferBillCode = emisWaybillTransfer.getTransferBillCode();
if (StringUtils.isNotEmpty(transferBillCode)) { if (StringUtils.isNotEmpty(transferBillCode)) {