This commit is contained in:
linfso 2024-05-26 00:45:35 +08:00
parent 81d0882447
commit 62b01cdfbc
2 changed files with 52 additions and 37 deletions

View File

@ -135,7 +135,7 @@ public class EmisWaybillController extends BaseController
// @PreAuthorize("@ss.hasPermi('emis:emisWaybill:add')")
@Log(title = "运单实时下单", businessType = BusinessType.INSERT)
@PostMapping(value = "/realSubmitOrder")
public AjaxResult realSubmitOrder(@Valid @RequestBody WaybillOrder waybillOrder)
public AjaxResult realSubmitOrder(@Valid @RequestBody WaybillOrder waybillOrder,Integer isModify)
{
try {
@ -290,8 +290,6 @@ public class EmisWaybillController extends BaseController
startPage();
log.debug("====>isTopSite:"+getLoginUser().getUser().isTopSite());
log.debug("====>ownerSiteCode:"+getLoginUser().getUser().getOwnerSiteCode());
if(!(getLoginUser().getUser().isTopSite())){
emisWaybill.getParams().put("innerQuery","1");
emisWaybill.getParams().put("currentSiteCode",getLoginUser().getUser().getOwnerSiteCode());

View File

@ -291,14 +291,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
}
/**
* 新增下单
* @param emisWaybillSave
*/
private void addWayBill(EmisWaybill emisWaybillSave) throws EmisBizError {
//补齐数据
emisWaybillSave.preInsert();
private void calcWayBillCommonInfo(EmisWaybill emisWaybillSave) throws EmisBizError {
String orderSn = WaybillHelper.genOrderSn();
@ -310,9 +303,16 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
emisWaybillSave.setRegisterManCode(getCurrentUser().getEmpCode());
emisWaybillSave.setRegisterDate(new Date());
// 发件网点
emisWaybillSave.setSendSiteCode(getCurrentUser().getOwnerSiteCode());
emisWaybillSave.setSendSiteName(getCurrentUser().getOwnerSiteName());
String sendSiteCode=emisWaybillSave.getSendSiteCode();
if(StringUtils.isEmpty(sendSiteCode)){
sendSiteCode = getCurrentUser().getOwnerSiteCode();
}
EmisSite sendSite = getSiteByCode(sendSiteCode);
emisWaybillSave.setSendSiteCode(sendSite.getSiteCode());
emisWaybillSave.setSendSiteName(sendSite.getSiteName());
// 派件网点
emisWaybillSave.setDispatchSiteCode(emisWaybillSave.getDispatchUnderlingSiteCode());
@ -322,6 +322,8 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
emisWaybillSave.setWaybillStatus("0");
// 目的网点3段码
String destSite3Code = "";
EmisSite destSite=getSiteByCode(emisWaybillSave.getDispatchUnderlingSiteCode());
if(destSite!=null){
@ -335,7 +337,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
destName=destination.getDestName();
}
String thirdCode="["+getCurrentUser().getOwnerSiteName()+'-'+destName+"]["+destSite3Code+"]";
String thirdCode="["+emisWaybillSave.getSendSiteName()+'-'+destName+"]["+destSite3Code+"]";
emisWaybillSave.setThirdCode(thirdCode);
// 下单时间
@ -383,8 +385,8 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// 月结客户直接根据月结编号获取客户编码和名称
if(
"2".equals(emisWaybillSave.getPaymentType())
|| "4".equals(emisWaybillSave.getPaymentType())
|| "5".equals(emisWaybillSave.getPaymentType())
|| "4".equals(emisWaybillSave.getPaymentType())
|| "5".equals(emisWaybillSave.getPaymentType())
){
EmisCustomerUser emisCustomerUser=getCustomerUserByMonthlyPayCode(emisWaybillSave.getCustNo());
@ -404,28 +406,28 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
customerName=emisCustomerUser.getCustomerName();
}else{
// 先创建客户
EmisCustomerUser newEmisCustomerUser = new EmisCustomerUser();
EmisCustomerUser newEmisCustomerUser = new EmisCustomerUser();
newEmisCustomerUser.setCustomerName(recieveAddress.getName());
newEmisCustomerUser.setCountry(recieveAddress.getCountry());
newEmisCustomerUser.setPhone(recieveAddress.getPhone());
newEmisCustomerUser.setProvince(recieveAddress.getProvince());
newEmisCustomerUser.setCity(recieveAddress.getCity());
newEmisCustomerUser.setCounty(recieveAddress.getCounty());
newEmisCustomerUser.setTown(recieveAddress.getTown());
newEmisCustomerUser.setEmail(recieveAddress.getEmail());
newEmisCustomerUser.setAddress(recieveAddress.getAddress());
newEmisCustomerUser.setCompany(recieveAddress.getCompany());
newEmisCustomerUser.setCustomerType("1");
newEmisCustomerUser.setSettledType("1");
newEmisCustomerUser.setUserType("1");
newEmisCustomerUser.setCustomerName(recieveAddress.getName());
newEmisCustomerUser.setCountry(recieveAddress.getCountry());
newEmisCustomerUser.setPhone(recieveAddress.getPhone());
newEmisCustomerUser.setProvince(recieveAddress.getProvince());
newEmisCustomerUser.setCity(recieveAddress.getCity());
newEmisCustomerUser.setCounty(recieveAddress.getCounty());
newEmisCustomerUser.setTown(recieveAddress.getTown());
newEmisCustomerUser.setEmail(recieveAddress.getEmail());
newEmisCustomerUser.setAddress(recieveAddress.getAddress());
newEmisCustomerUser.setCompany(recieveAddress.getCompany());
newEmisCustomerUser.setCustomerType("1");
newEmisCustomerUser.setSettledType("1");
newEmisCustomerUser.setUserType("1");
// 预置主归属网点
newEmisCustomerUser.setOwnerSite(emisWaybillSave.getSendSiteCode());
EmisCustomerUser newUser=createCustomerUser(newEmisCustomerUser);
// 预置主归属网点
newEmisCustomerUser.setOwnerSite(emisWaybillSave.getSendSiteCode());
EmisCustomerUser newUser=createCustomerUser(newEmisCustomerUser);
customerCode = newUser.getCustomerCode();
customerName = newUser.getCustomerName();
customerCode = newUser.getCustomerCode();
customerName = newUser.getCustomerName();
}
@ -503,6 +505,18 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
emisWaybillSave.setBillCodeSub(sb.toString());
}
}
/**
* 新增下单
* @param emisWaybillSave
*/
private void addWayBill(EmisWaybill emisWaybillSave) throws EmisBizError {
// 公共计算部分
calcWayBillCommonInfo(emisWaybillSave);
//补齐数据
emisWaybillSave.preInsert();
emisWaybillMapper.insertEmisWaybill(emisWaybillSave);
@ -536,9 +550,12 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
}
private void updateWayBill(EmisWaybill emisWaybillSave){
emisWaybillSave.preUpdate();
private void updateWayBill(EmisWaybill emisWaybillSave) throws EmisBizError {
// 公共计算部分
calcWayBillCommonInfo(emisWaybillSave);
emisWaybillSave.preUpdate();
// 基础信息更新
emisWaybillMapper.updateEmisWaybill(emisWaybillSave);