From 8244768002d633c9f7f60bd41d7be6b6477aa7c5 Mon Sep 17 00:00:00 2001 From: linfso Date: Fri, 3 Jan 2025 00:20:28 +0800 Subject: [PATCH] md --- .../erp/web/emis/EmisWaybillController.java | 2 +- .../erp/emis/mapper/EmisSiteMapper.java | 2 + .../erp/emis/service/EmisBaseService.java | 4 + .../erp/emis/service/IEmisWaybillService.java | 4 +- .../service/impl/EmisWaybillServiceImpl.java | 403 +++++++++++++----- .../main/resources/mapper/EmisSiteMapper.xml | 8 +- 6 files changed, 322 insertions(+), 101 deletions(-) diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillController.java index 63c107411..6f27eec5e 100644 --- a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillController.java +++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisWaybillController.java @@ -203,7 +203,7 @@ public class EmisWaybillController extends EmisBaseController String msg="下单成功"; try { - emisWaybillService.draftSubmitOrder(emisWaybillSave,false); + emisWaybillService.draftSubmitOrder(emisWaybillSave); jObjOut.put("billDetail", emisWaybillSave); }catch(EmisBizError ex){ diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisSiteMapper.java b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisSiteMapper.java index 28c9835ad..e4b2df28e 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisSiteMapper.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisSiteMapper.java @@ -36,6 +36,8 @@ public interface EmisSiteMapper extends BaseMapper public EmisSite getEmisSiteByCode(String siteCode); + public EmisSite getEmisSiteByName(String siteName); + /** * 查询列表 * diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java index a052aa910..890952d3c 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/EmisBaseService.java @@ -2543,6 +2543,10 @@ public class EmisBaseService { return emisSiteMapper.getEmisSiteByCode(siteCode); } + public EmisSite getSiteByName(String siteName){ + return emisSiteMapper.getEmisSiteByName(siteName); + } + /** * 获取快递员 by empCode * @param empCode diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisWaybillService.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisWaybillService.java index b27b5a546..685f63a4b 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisWaybillService.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisWaybillService.java @@ -119,9 +119,9 @@ public interface IEmisWaybillService extends IDataAuditService * @return * @throws EmisBizError */ - public int draftSubmitOrder(EmisWaybill emisWaybill,boolean isOms) throws EmisBizError; + public int draftSubmitOrder(EmisWaybill emisWaybill) throws EmisBizError; - public int draftSubmitOrderByOms(EmisWaybill emisWaybill,boolean isOms) throws EmisBizError; + public int draftSubmitOrderByOms(EmisWaybill emisWaybill) throws EmisBizError; public int realMatchOrderApi(EmisWaybill emisWaybillSave) throws EmisBizError; diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java index 926f649d4..932026b2b 100644 --- a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java +++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisWaybillServiceImpl.java @@ -348,7 +348,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb */ @Override @Transactional - public int draftSubmitOrder(EmisWaybill emisWaybillSave,boolean isOms) throws EmisBizError { + public int draftSubmitOrder(EmisWaybill emisWaybillSave) throws EmisBizError { // 如果没有单号就生成单号,如果有单号需要判断是否重复 if( !StringUtils.isEmpty(emisWaybillSave.getBillCode()) ) { @@ -363,17 +363,12 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb } // 转换草稿数据到真实数据 - cvtWaybillDraftToReal(emisWaybillSave,isOms); + cvtWaybillDraftToReal(emisWaybillSave); String sendSiteCode=null; // 生成运单 - if(!isOms){ - sendSiteCode=SecurityUtils.getLoginUser().getUser().getOwnerSiteCode(); - emisWaybillSave.setSendSiteCode(sendSiteCode); - }else{ - sendSiteCode=emisWaybillSave.getSendSiteCode(); - emisWaybillSave.setSendSiteCode(sendSiteCode); - } + sendSiteCode=SecurityUtils.getLoginUser().getUser().getOwnerSiteCode(); + emisWaybillSave.setSendSiteCode(sendSiteCode); if(StringUtils.isEmpty(sendSiteCode)){ throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "寄件地址不在网点服务区"); @@ -386,14 +381,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb } // 开始下单 - if(!isOms) { - addNewWaybill(emisWaybillSave); - - // 生成缅甸虚拟单 - - }else{ - addNewWaybillByOms(emisWaybillSave); - } + addNewWaybill(emisWaybillSave); return 1; } @@ -401,13 +389,12 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb /** * OMS 草稿方式批量下单 * @param emisWaybillSave - * @param isOms * @return * @throws EmisBizError */ @Override @Transactional - public int draftSubmitOrderByOms(EmisWaybill emisWaybillSave,boolean isOms) throws EmisBizError { + public int draftSubmitOrderByOms(EmisWaybill emisWaybillSave) throws EmisBizError { // 如果没有单号就生成单号,如果有单号需要判断是否重复 if( !StringUtils.isEmpty(emisWaybillSave.getBillCode()) ) { @@ -422,17 +409,12 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb } // 转换草稿数据到真实数据 - cvtWaybillDraftToReal(emisWaybillSave,isOms); + cvtWaybillDraftToRealByOms(emisWaybillSave); String sendSiteCode=null; // 生成运单 - if(!isOms){ - sendSiteCode=SecurityUtils.getLoginUser().getUser().getOwnerSiteCode(); - emisWaybillSave.setSendSiteCode(sendSiteCode); - }else{ - sendSiteCode=emisWaybillSave.getSendSiteCode(); - emisWaybillSave.setSendSiteCode(sendSiteCode); - } + sendSiteCode=emisWaybillSave.getSendSiteCode(); + emisWaybillSave.setSendSiteCode(sendSiteCode); if(StringUtils.isEmpty(sendSiteCode)){ throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "寄件地址不在网点服务区"); @@ -445,11 +427,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb } // 开始下单 - if(!isOms) { - addNewWaybill(emisWaybillSave); - }else{ - addNewWaybillByOms(emisWaybillSave); - } + addNewWaybillByOms(emisWaybillSave); return 1; } @@ -740,7 +718,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb * @param emisWaybillSave * @throws EmisBizError */ - private void cvtWaybillDraftToReal(EmisWaybill emisWaybillSave,Boolean isOms) throws EmisBizError { + private void cvtWaybillDraftToReal(EmisWaybill emisWaybillSave) throws EmisBizError { // 货物名称必填 if(StringUtils.isEmpty(emisWaybillSave.getGoodsInfo())){ @@ -750,9 +728,265 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb // 运费必填 if(emisWaybillSave.getFreight() == null || ( emisWaybillSave.getFreight()!=null && emisWaybillSave.getFreight().compareTo(BigDecimal.ZERO)==0 ) ){ - if(!isOms) { - throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "运费必须大于0"); + throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "运费必须大于0"); + } + + + if(emisWaybillSave.getParcelQty()==null || emisWaybillSave.getParcelQty()==0){ + throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "件数不能为0"); + } + + // 货值必填 + if(StringUtils.isEmpty(emisWaybillSave.getRealValue()) ){ +// throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "货值必填"); + } + + // 线路转换 + EmisTransLine transLine=getTransLineByName(emisWaybillSave.getTransLineType()); + if(transLine==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "线路不正确"); + } + emisWaybillSave.setTransLineType(transLine.getLineCode()); + + // 产品转换 + EmisTransProduct transProduct=getTransProductByName(transLine.getLineCode(),emisWaybillSave.getProductType()); + if(transProduct==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "产品不正确"); + } + emisWaybillSave.setProductType(transProduct.getProdCode()); + + // 收件国家省市区转换 + String receiveCountryCode=getCountryCodeByName(emisWaybillSave.getReceiveCountry()); + if(receiveCountryCode==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "收件国家不正确"); + } + + String rcvProviceCode=getChildRegionCodeByName(receiveCountryCode,null,emisWaybillSave.getReceiveProvince()); + if(rcvProviceCode==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "收件省不正确"); + } + + String rcvCityCode=null; + if(!StringUtils.isEmpty(emisWaybillSave.getReceiveCity())) { + rcvCityCode=getChildRegionCodeByName(receiveCountryCode, rcvProviceCode, emisWaybillSave.getReceiveCity()); + } + + String rcvDistrictCode=null; + if(!StringUtils.isEmpty(emisWaybillSave.getReceiveCounty())) { + rcvDistrictCode=getChildRegionCodeByName(receiveCountryCode, rcvCityCode, emisWaybillSave.getReceiveCounty()); + } + + emisWaybillSave.setReceiveCountry(receiveCountryCode); + emisWaybillSave.setReceiveProvince(rcvProviceCode); + emisWaybillSave.setReceiveCity(rcvCityCode); + emisWaybillSave.setReceiveCounty(rcvDistrictCode); + + // 寄件国家省市区 + String sendCountryCode=getCountryCodeByName(emisWaybillSave.getSendCountry()); + if(sendCountryCode==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "寄件国家不正确"); + } + String sendProviceCode=getChildRegionCodeByName(sendCountryCode,null,emisWaybillSave.getSendProvince()); + if(sendProviceCode==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "寄件省不正确"); + } + + String sendCityCode=null; + if(!StringUtils.isEmpty(emisWaybillSave.getSendCity())) { + sendCityCode=getChildRegionCodeByName(sendCountryCode, sendProviceCode, emisWaybillSave.getSendCity()); + } + String sendDistrictCode=null; + if(!StringUtils.isEmpty(emisWaybillSave.getSendCounty())) { + sendDistrictCode=getChildRegionCodeByName(sendCountryCode, sendCityCode, emisWaybillSave.getSendCounty()); + } + + emisWaybillSave.setSendCountry(sendCountryCode); + emisWaybillSave.setSendProvince(sendProviceCode); + emisWaybillSave.setSendCity(sendCityCode); + emisWaybillSave.setSendCounty(sendDistrictCode); + + + // 取件方式 + String pickupMethod=DictUtils.getDictValue("emis_qujian_fangshi",emisWaybillSave.getPickupMethod()); + if(pickupMethod==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "取件方式不正确"); + } + emisWaybillSave.setPickupMethod(pickupMethod); + + // 取件员或操作员 + if ("1".equals(pickupMethod)) { + SysUser empUser = getEmisStaffBySiteCodeAndEmpName(getCurrentUser().getOwnerSiteCode(), emisWaybillSave.getOperateEmployeeCode()); + if (empUser == null) { + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "操作员不正确"); } + emisWaybillSave.setOperateEmployeeCode(empUser.getEmpCode()); + } else if ("2".equals(pickupMethod)) { + SysUser empUser = getEmisStaffBySiteCodeAndEmpName(getCurrentUser().getOwnerSiteCode(), emisWaybillSave.getOperateEmployeeCode()); + if (empUser == null) { + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "取件员不正确"); + } + emisWaybillSave.setTakePieceEmployeeCode(empUser.getEmpCode()); + } + +// 包装类型 + String packTypeStr = emisWaybillSave.getPackType(); + if(StringUtils.isEmpty(packTypeStr)){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "包装类型不正确"); + } + + packTypeStr=WaybillHelper.formatQueryValue(packTypeStr); + + String packTypeCvtStr=""; + String [] packTypeArr = packTypeStr.split(","); + if(packTypeArr.length<=0){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "包装类型不正确"); + } + + for(String itemLabel:packTypeArr){ + if(StringUtils.isEmpty(itemLabel)){ + continue; + } + String dictValue=DictUtils.getDictValue("emis_tab_packing_type",itemLabel.trim()); + if(StringUtils.isEmpty(dictValue)){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "包装类型["+itemLabel+"]不正确"); + } + packTypeCvtStr = packTypeCvtStr + dictValue + ","; + } + + if(StringUtils.isEmpty(packTypeCvtStr)){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "包装类型不正确"); + } + String [] packTypeCvtArr=packTypeCvtStr.split(","); + if(packTypeCvtArr.length<=0){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "包装类型不正确"); + } + + emisWaybillSave.setPackType(packTypeCvtStr); + + // 派送方式 + String dispatchMethod=DictUtils.getDictValue("emis_tab_dispatch_mode",emisWaybillSave.getDispatchMethod()); + if(dispatchMethod==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "派送方式不正确"); + } + emisWaybillSave.setDispatchMethod(dispatchMethod); + + // 付款方式 + String paymentType=DictUtils.getDictValue("emis_payment_type",emisWaybillSave.getPaymentType()); + if(paymentType==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "支付方式不正确"); + } + emisWaybillSave.setPaymentType(paymentType); + + // 月结方式获取月结客户的编码和名称 + if("2".equals(paymentType) + || "4".equals(paymentType) + || "5".equals(paymentType) + ){ + EmisCustomerUser emisCustomerUser=getMonthCustomerByName(emisWaybillSave.getCustNo()); + if(emisCustomerUser==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "月结客户不存在"); + } + + emisWaybillSave.setCustomerCode(emisCustomerUser.getCustomerCode()); + emisWaybillSave.setCustomerName(emisCustomerUser.getCustomerName()); + + emisWaybillSave.setCustNo(emisCustomerUser.getMonthlyPayCode()); + emisWaybillSave.setPayee(emisCustomerUser.getPayee()); + emisWaybillSave.setSalesmen(emisCustomerUser.getSalesmen()); + + + }else{ + emisWaybillSave.setCustNo(null); + // 判断现金的回款联系人和销售联系人 + SysUser payee = getEmisStaffByEmpName(emisWaybillSave.getPayee()); + if (payee == null) { + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "回款联系人不存在"); + } + + SysUser salesmen = getEmisStaffByEmpName(emisWaybillSave.getSalesmen()); + if (salesmen == null) { + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "销售联系人不存在"); + } + } + + + // 报关方式 + String customsEclaration=DictUtils.getDictValue("emis_declare_mode",emisWaybillSave.getCustomsEclaration()); + if(customsEclaration==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "报关方式不正确"); + } + emisWaybillSave.setCustomsEclaration(customsEclaration); + + // 清关方式 + String customsClear=DictUtils.getDictValue("emis_customs_clear",emisWaybillSave.getCustomsClear()); + if(customsClear==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "清关方式不正确"); + } + emisWaybillSave.setCustomsClear(customsClear); + + if (StringUtils.isEmpty(emisWaybillSave.getBlMessage())) { + throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "发送寄件/签收短信不正确"); + } + + if ("是".equals(emisWaybillSave.getBlMessage())) { + emisWaybillSave.setBlMessage("1"); + emisWaybillSave.setBlAcceptMessage("1"); + } else { + emisWaybillSave.setBlMessage("0"); + emisWaybillSave.setBlAcceptMessage("0"); + } + + if (!StringUtils.isEmpty(emisWaybillSave.getBlVirtual())) { + if ("是".equals(emisWaybillSave.getBlVirtual())) { + emisWaybillSave.setBlVirtual("1"); + } else { + emisWaybillSave.setBlVirtual("0"); + } + } + + // 计算目的地 + EmisDestination destination=calcDestSiteByBase(receiveCountryCode,transLine.getLineCode(),rcvProviceCode,rcvCityCode,rcvDistrictCode,emisWaybillSave.getReceiveAddress()); + if(destination==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "找不到目的地"); + } + + emisWaybillSave.setDestinationCode(destination.getDestCode()); + emisWaybillSave.setDispatchUnderlingSiteCode(destination.getSiteCode()); + + emisWaybillSave.setBlGenSubbill("1"); + + + try { + // 计算体积重量 + calcVolumeWeight(emisWaybillSave); + // 计算结算重量 + calcSettledWeight(emisWaybillSave); + // 计算应收费 + calcWaybillFee(emisWaybillSave); + }catch (Exception ex){ + ex.printStackTrace(); + log.error("===草稿下单模式,计费错误:",ex.getMessage()); + } + + // 如果填写了运费则使用一口价模式 + if(emisWaybillSave.getFreight()!=null){ + // 一口价模式 + emisWaybillSave.setCalcFeeType("3"); + } + + } + + + private void cvtWaybillDraftToRealByOms(EmisWaybill emisWaybillSave) throws EmisBizError { + + // 货物名称必填 + if(StringUtils.isEmpty(emisWaybillSave.getGoodsInfo())){ + throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "货物描述不能为空"); + } + + + if(emisWaybillSave.getPickStartDate()==null){ + throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "预约时间必填"); } if(emisWaybillSave.getParcelQty()==null || emisWaybillSave.getParcelQty()==0){ @@ -829,15 +1063,13 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb emisWaybillSave.setSendCounty(sendDistrictCode); // oms 计算发件网点 - if(isOms){ - // 模拟计算发件地 - EmisDestination sendDestination=calcSendSiteByBase(sendCountryCode,transLine.getLineCode(),sendProviceCode,sendCityCode,sendDistrictCode,emisWaybillSave.getSendAddress()); - if(sendDestination==null){ - throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "寄件地址不在服务区"); - } - emisWaybillSave.setSendSiteCode(sendDestination.getSiteCode()); - emisWaybillSave.setSendSiteName(sendDestination.getSiteName()); + // 模拟计算发件地 + EmisDestination sendDestination=calcSendSiteByBase(sendCountryCode,transLine.getLineCode(),sendProviceCode,sendCityCode,sendDistrictCode,emisWaybillSave.getSendAddress()); + if(sendDestination==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "寄件地址不在服务区"); } + emisWaybillSave.setSendSiteCode(sendDestination.getSiteCode()); + emisWaybillSave.setSendSiteName(sendDestination.getSiteName()); // 取件方式 String pickupMethod=DictUtils.getDictValue("emis_qujian_fangshi",emisWaybillSave.getPickupMethod()); @@ -846,21 +1078,37 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb } emisWaybillSave.setPickupMethod(pickupMethod); - // 取件员或操作员 - if(!isOms) { - if ("1".equals(pickupMethod)) { - SysUser empUser = getEmisStaffBySiteCodeAndEmpName(getCurrentUser().getOwnerSiteCode(), emisWaybillSave.getOperateEmployeeCode()); - if (empUser == null) { - throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "操作员不正确"); - } - emisWaybillSave.setOperateEmployeeCode(empUser.getEmpCode()); - } else if ("2".equals(pickupMethod)) { - SysUser empUser = getEmisStaffBySiteCodeAndEmpName(getCurrentUser().getOwnerSiteCode(), emisWaybillSave.getOperateEmployeeCode()); - if (empUser == null) { - throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "取件员不正确"); - } - emisWaybillSave.setTakePieceEmployeeCode(empUser.getEmpCode()); + // 计算仓库信息 + if("1".equals(pickupMethod) || "3".equals(pickupMethod)){ + if(StringUtils.isEmpty(emisWaybillSave.getIntoWarehouseName())){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "仓库不存在,检查仓库名称"); } + + // 获取仓库信息 + EmisSite emisSite=getSiteByName(emisWaybillSave.getIntoWarehouseName()); + if(emisSite==null){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "仓库不存在"); + } + + if(!"1".equals(emisSite.getBlWarehouseIn())){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "仓库不支持收货"); + } + + if(!"0".equals(emisSite.getStatus())){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "仓库已停用"); + } + + if(StringUtils.isEmpty(emisWaybillSave.getSalesmen())){ + throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "销售联系人必填"); + } + + // 使用仓库作为寄件网点 + emisWaybillSave.setSendSiteCode(emisSite.getSiteCode()); + emisWaybillSave.setIntoWarehouseCode(emisSite.getSiteCode()); + emisWaybillSave.setIntoWarehouseName(emisSite.getSiteName()); + emisWaybillSave.setIntoWarehouseContact(emisSite.getPrincipal()); + emisWaybillSave.setIntoWarehousePhone(emisSite.getManagerPhone()); + emisWaybillSave.setIntoWarehouseAddress(emisSite.getAddress()); } // 包装类型 @@ -914,7 +1162,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb // 月结方式获取月结客户的编码和名称 if("2".equals(paymentType) - || "4".equals(paymentType) + || "4".equals(paymentType) || "5".equals(paymentType) ){ EmisCustomerUser emisCustomerUser=getMonthCustomerByName(emisWaybillSave.getCustNo()); @@ -923,30 +1171,12 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb } // oms 单据归属为用户 - if(!isOms) { - emisWaybillSave.setCustomerCode(emisCustomerUser.getCustomerCode()); - emisWaybillSave.setCustomerName(emisCustomerUser.getCustomerName()); - } - emisWaybillSave.setCustNo(emisCustomerUser.getMonthlyPayCode()); emisWaybillSave.setPayee(emisCustomerUser.getPayee()); emisWaybillSave.setSalesmen(emisCustomerUser.getSalesmen()); - }else{ emisWaybillSave.setCustNo(null); - if(!isOms) { - // 判断现金的回款联系人和销售联系人 - SysUser payee = getEmisStaffByEmpName(emisWaybillSave.getPayee()); - if (payee == null) { - throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "回款联系人不存在"); - } - - SysUser salesmen = getEmisStaffByEmpName(emisWaybillSave.getSalesmen()); - if (salesmen == null) { - throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "销售联系人不存在"); - } - } } @@ -964,27 +1194,6 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb } emisWaybillSave.setCustomsClear(customsClear); - if(!isOms) { - if (StringUtils.isEmpty(emisWaybillSave.getBlMessage())) { - throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "发送寄件/签收短信不正确"); - } - - if ("是".equals(emisWaybillSave.getBlMessage())) { - emisWaybillSave.setBlMessage("1"); - emisWaybillSave.setBlAcceptMessage("1"); - } else { - emisWaybillSave.setBlMessage("0"); - emisWaybillSave.setBlAcceptMessage("0"); - } - } - - if (!StringUtils.isEmpty(emisWaybillSave.getBlVirtual())) { - if ("是".equals(emisWaybillSave.getBlVirtual())) { - emisWaybillSave.setBlVirtual("1"); - } else { - emisWaybillSave.setBlVirtual("0"); - } - } // 计算目的地 EmisDestination destination=calcDestSiteByBase(receiveCountryCode,transLine.getLineCode(),rcvProviceCode,rcvCityCode,rcvDistrictCode,emisWaybillSave.getReceiveAddress()); diff --git a/emis-biz/src/main/resources/mapper/EmisSiteMapper.xml b/emis-biz/src/main/resources/mapper/EmisSiteMapper.xml index db2efe791..c1ea9ca46 100644 --- a/emis-biz/src/main/resources/mapper/EmisSiteMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisSiteMapper.xml @@ -306,7 +306,7 @@ manager_phone as tel, address as address from emis_site a - where a.del_flag='0' and bl_warehouse_in='1' + where a.del_flag='0' and bl_warehouse_in='1' and status=0 and site_name like concat('%', #{searchValue}, '%') @@ -330,6 +330,12 @@ where a.del_flag='0' and a.site_code = #{siteCode} + + insert into emis_site