md
This commit is contained in:
parent
fd7ca488ca
commit
8244768002
@ -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){
|
||||
|
||||
@ -36,6 +36,8 @@ public interface EmisSiteMapper extends BaseMapper<EmisSite>
|
||||
|
||||
public EmisSite getEmisSiteByCode(String siteCode);
|
||||
|
||||
public EmisSite getEmisSiteByName(String siteName);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
|
||||
@ -2543,6 +2543,10 @@ public class EmisBaseService {
|
||||
return emisSiteMapper.getEmisSiteByCode(siteCode);
|
||||
}
|
||||
|
||||
public EmisSite getSiteByName(String siteName){
|
||||
return emisSiteMapper.getEmisSiteByName(siteName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取快递员 by empCode
|
||||
* @param empCode
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -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
|
||||
<if test="searchValue != null and searchValue != ''">
|
||||
and site_name like concat('%', #{searchValue}, '%')
|
||||
</if>
|
||||
@ -330,6 +330,12 @@
|
||||
where a.del_flag='0' and a.site_code = #{siteCode}
|
||||
</select>
|
||||
|
||||
<select id="getEmisSiteByName" parameterType="String" resultMap="EmisSiteResult">
|
||||
select id, site_code, site_name, site_name_en, parent_site_code, default_currency, cut_off_time, superior_finance_center_code, site_type, scope_type, default_destination_name_code, default_send_place, country_code, province, city, county, town, area_code, area_name, range_name, phone, principal, manager, manager_phone, sale_phone, exigence_phone, fax, site_levels, site_desc, dispatch_range, not_dispatch_range, public_remark, private_remark, order_num, financial_account, tb_ser_name, tb_ser_tel, tb_ser_ww, car_start_time, car_end_time, bl_web, join_time, maps_coordinate, specservice_range, qq, email, service_quality, sales_quality, levels, warehouse_name, site_limite, jy_mobile, jy_pwd, bl_not_input, stop_date, bl_allow_agent_money, bl_allow_topayment, goods_payment_limited, topayment_limited, bl_rec, bl_disp, bl_come, bl_open_taobao, bl_arbitration_department, bl_allow_agent_sign, bl_message, bl_provide, bl_projectclient, bl_vip_site, bl_dispatch_zt, bl_billto_account, account_code, address, disp_delivery_mode, trans_type_id, trans_type_name, org_id, org_name, data_from, site_area, bl_allow_disp_agent_money, disp_goods_payment_limited, disp_delivery_site, disp_delivery_site_code, vendor_name, credit_code, bl_cargo_service, bl_handling_service, pickup_center_site_code, bl_disp_good, bl_push_jd, push_date, reason, site_pos, distribute_code, bl_push_site, logo_type, size_code2, size_code3, audit_status, audit_date, audit_man_code, audit_site_code, bl_class, bl_material, soon_piece_type, province_area, second_area, second_area_code, province_area_code, bl_disp_good_name, bl_not_rec, bl_not_disp, bl_not_cash_out, status, increment_service, bl_warehouse_in, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_site a
|
||||
where a.del_flag='0 and a.site_name = #{siteName}
|
||||
</select>
|
||||
|
||||
<insert id="insertEmisSite" parameterType="EmisSite">
|
||||
insert into emis_site
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user