md
This commit is contained in:
parent
599ed32dd5
commit
6722c529fe
@ -61,11 +61,22 @@
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:2.5.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.3.16" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.9.7" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.5.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.5.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.16" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid-spring-boot-starter:1.2.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.alibaba:druid:1.2.8" level="project" />
|
||||
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.36" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.5.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-amqp:2.5.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.amqp:spring-rabbit:2.3.14" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.amqp:spring-amqp:2.3.14" level="project" />
|
||||
@ -77,6 +88,7 @@
|
||||
<orderEntry type="library" name="Maven: com.github.oshi:oshi-core:6.1.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.java.dev.jna:jna:5.10.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.java.dev.jna:jna-platform:5.10.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
|
||||
<orderEntry type="module" module-name="emis-biz" />
|
||||
<orderEntry type="library" name="Maven: com.xdadan:emis-common:1.0.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.3.16" level="project" />
|
||||
@ -85,14 +97,6 @@
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.5.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-crypto:5.5.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.security:spring-security-web:5.5.5" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.5.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.4.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.2.0" level="project" />
|
||||
@ -102,7 +106,6 @@
|
||||
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.2.2.Final" level="project" />
|
||||
<orderEntry type="library" name="Maven: jakarta.validation:jakarta.validation-api:2.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.12.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.12.6" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.12.6" level="project" />
|
||||
@ -212,9 +215,6 @@
|
||||
<orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-metadata:2.0.0.RELEASE" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.xiaoymin:knife4j-spring-ui:3.0.2" level="project" />
|
||||
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.7.22" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.5.10" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:4.0.3" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.3.16" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-core:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-lang:1.8.0" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.shiro:shiro-cache:1.8.0" level="project" />
|
||||
|
||||
@ -35,7 +35,6 @@
|
||||
<groupId>com.xdadan</groupId>
|
||||
<artifactId>emis-biz</artifactId>
|
||||
<version>1.0.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@ -92,8 +92,16 @@ public interface IEmisWaybillService
|
||||
public int realSubmitOrder(EmisWaybill emisWaybill) throws EmisBizError;
|
||||
|
||||
|
||||
/**
|
||||
* OMS下单
|
||||
* @param emisWaybill
|
||||
* @return
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
public int realSubmitOrderByOms(EmisWaybill emisWaybill) throws EmisBizError;
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param oldEmisWaybill
|
||||
* @param emisWaybillSave
|
||||
|
||||
@ -580,6 +580,52 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下单接口Oms
|
||||
* @param emisWaybillSave
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int realSubmitOrderByOms(EmisWaybill emisWaybillSave) throws EmisBizError {
|
||||
|
||||
boolean isNew = true;
|
||||
EmisWaybill emisWaybillOld = null;
|
||||
|
||||
if( !StringUtils.isEmpty(emisWaybillSave.getBillCode()) ){
|
||||
emisWaybillOld = this.selectEmisWaybillByBillCode(emisWaybillSave.getBillCode());
|
||||
if(emisWaybillOld!=null){
|
||||
isNew=false;
|
||||
}
|
||||
}else{
|
||||
if( !StringUtils.isEmpty(emisWaybillSave.getOrderSn()) ){
|
||||
emisWaybillOld = this.selectEmisWaybillByOrderSn(emisWaybillSave.getOrderSn());
|
||||
if(emisWaybillOld!=null){
|
||||
isNew=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 新开单
|
||||
if(isNew){
|
||||
addNewWaybillByOms(emisWaybillSave);
|
||||
}
|
||||
// 运单修改
|
||||
else{
|
||||
// // 检查是否已锁单
|
||||
// checkDBBillIsLock(emisWaybillOld);
|
||||
//
|
||||
// emisWaybillSave.setId(emisWaybillOld.getId());
|
||||
// // 把历史发货日期带过来用于重新计算预估到到时间
|
||||
// emisWaybillSave.setSendDate(emisWaybillOld.getSendDate());
|
||||
//
|
||||
// reUpdateWayBill(emisWaybillOld,emisWaybillSave);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -658,6 +704,284 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
return emisWaybillMapper.assignTakeMan(emisWaybill);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算运单公共信息 OMS
|
||||
* @param emisWaybillSave
|
||||
* @param isNew
|
||||
* @throws EmisBizError
|
||||
*/
|
||||
private void calcWayBillCommonInfoByOms(EmisWaybill emisWaybillSave,boolean isNew) throws EmisBizError {
|
||||
|
||||
String orderSn = WaybillHelper.genOrderSn();
|
||||
emisWaybillSave.setBlGenSubbill("1");
|
||||
// 订单号
|
||||
if(isNew) {
|
||||
emisWaybillSave.setOrderSn(orderSn);
|
||||
}
|
||||
|
||||
// 登记网点
|
||||
if(isNew) {
|
||||
if(!StringUtils.isEmpty(emisWaybillSave.getSendSiteCode())) {
|
||||
emisWaybillSave.setRegisterSiteCode(emisWaybillSave.getSendSiteCode());
|
||||
}else{
|
||||
// 没有寄件网点则登记网点放到总部
|
||||
emisWaybillSave.setRegisterSiteCode("88888");
|
||||
}
|
||||
|
||||
// emisWaybillSave.setRegisterManCode(getCurrentUser().getEmpCode());
|
||||
emisWaybillSave.setRegisterDate(new Date());
|
||||
}
|
||||
|
||||
if(isNew) {
|
||||
emisWaybillSave.setDataFrom(WaybillHelper.getDataFrom());
|
||||
}
|
||||
|
||||
if(emisWaybillSave.getFreight().floatValue()<=0.0f){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"运费必须大于0");
|
||||
}
|
||||
|
||||
if(
|
||||
emisWaybillSave.getTotalVolume().floatValue() <=0.0f
|
||||
|| emisWaybillSave.getBillWeight().floatValue() <=0.0f
|
||||
){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"体积,实重必须大于0");
|
||||
}
|
||||
|
||||
if(StringUtils.isAnyEmpty(
|
||||
emisWaybillSave.getPickupMethod(),
|
||||
emisWaybillSave.getDispatchMethod(),
|
||||
emisWaybillSave.getCustomsEclaration(),
|
||||
emisWaybillSave.getCustomsClear()
|
||||
)
|
||||
){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"取件方式,派送方式,报关方式,清关方式必填");
|
||||
}
|
||||
|
||||
// 默认按重量计费
|
||||
emisWaybillSave.setCalcFeeType("1");
|
||||
// if(StringUtils.isEmpty(emisWaybillSave.getCalcFeeType())){
|
||||
// throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"计费方式必填");
|
||||
// }
|
||||
|
||||
|
||||
// 发件网点
|
||||
if(StringUtils.isEmpty(emisWaybillSave.getSendSiteCode())){
|
||||
// throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"寄件网点必填");
|
||||
emisWaybillSave.setSendSiteCode("88888");
|
||||
}else{
|
||||
// 寄件网点财务中心
|
||||
EmisSite sendSite = getSiteByCode(emisWaybillSave.getSendSiteCode());
|
||||
if(sendSite!=null) {
|
||||
emisWaybillSave.setSendCenterCode(sendSite.getParentSiteCode());
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtils.isEmpty(emisWaybillSave.getPackType())){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"包装类型必填");
|
||||
}
|
||||
|
||||
// 目的网点
|
||||
if(StringUtils.isEmpty(emisWaybillSave.getDispatchUnderlingSiteCode())){
|
||||
// throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"目的网点必填");
|
||||
}
|
||||
|
||||
// 计算单据归属
|
||||
String customerCode = emisWaybillSave.getCustomerCode();
|
||||
String customerName = emisWaybillSave.getCustomerName();
|
||||
|
||||
// 订单运单初始状态 订单为已接单,运单未初始,待揽收
|
||||
emisWaybillSave.setOrderStatus("0");
|
||||
emisWaybillSave.setWaybillStatus("0");
|
||||
|
||||
// 计算三段码 目的网点2字码+目的地名称
|
||||
String destSite3Code = "";
|
||||
EmisSite destSite=getSiteByCode(emisWaybillSave.getDispatchUnderlingSiteCode());
|
||||
if(destSite!=null){
|
||||
destSite3Code=destSite.getSizeCode2();
|
||||
// 目的网点财务中心
|
||||
emisWaybillSave.setDestinationCenterCode(destSite.getParentSiteCode());
|
||||
}
|
||||
|
||||
// 初始 派件网点=目的网点
|
||||
emisWaybillSave.setDispatchSiteCode(emisWaybillSave.getDispatchUnderlingSiteName());
|
||||
|
||||
// 目的地名称
|
||||
EmisDestination destination=getDestinationByCode(emisWaybillSave.getDestinationCode());
|
||||
String destName="";
|
||||
if(destination!=null){
|
||||
destName=destination.getDestName();
|
||||
}
|
||||
String thirdCode="["+emisWaybillSave.getSendSiteName()+'-'+destName+"]["+destSite3Code+"]";
|
||||
emisWaybillSave.setThirdCode(thirdCode);
|
||||
// 下单时间
|
||||
emisWaybillSave.setOrderDate(emisWaybillSave.getSendDate());
|
||||
|
||||
// 订单类型 0-客户下单
|
||||
emisWaybillSave.setOrderType("0");
|
||||
|
||||
// 寄件地址
|
||||
if(StringUtils.isAnyEmpty(
|
||||
emisWaybillSave.getSendCountry(),
|
||||
emisWaybillSave.getSendName(),
|
||||
emisWaybillSave.getSendMobile(),
|
||||
emisWaybillSave.getSendProvince(),
|
||||
emisWaybillSave.getSendAddress()
|
||||
)
|
||||
){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"寄件人信息不完整,名称, 电话,国家,省份,地址必填");
|
||||
}
|
||||
|
||||
EmisCustomerAddress sendAddress = new EmisCustomerAddress();
|
||||
sendAddress.setCountry(emisWaybillSave.getSendCountry());
|
||||
sendAddress.setName(emisWaybillSave.getSendName());
|
||||
sendAddress.setPhone(emisWaybillSave.getSendMobile());
|
||||
sendAddress.setProvince(emisWaybillSave.getSendProvince());
|
||||
sendAddress.setCity(emisWaybillSave.getSendCity());
|
||||
sendAddress.setCounty(emisWaybillSave.getSendCounty());
|
||||
sendAddress.setTown(emisWaybillSave.getSendTown());
|
||||
// recieveAddress.setEmail(emisWaybillSave);
|
||||
sendAddress.setAddress(emisWaybillSave.getSendAddress());
|
||||
sendAddress.setCompany(emisWaybillSave.getSendCompany());
|
||||
|
||||
sendAddress.setUseSiteCode(emisWaybillSave.getSendSiteCode());
|
||||
sendAddress.setAddressType("1");
|
||||
|
||||
// 收件地址
|
||||
if(StringUtils.isAnyEmpty(
|
||||
emisWaybillSave.getReceiveCountry(),
|
||||
emisWaybillSave.getReceiveName(),
|
||||
emisWaybillSave.getReceiveMobile(),
|
||||
emisWaybillSave.getReceiveProvince(),
|
||||
emisWaybillSave.getReceiveAddress()
|
||||
)
|
||||
|
||||
){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"收件人信息不完整,名称, 电话,国家,省份,地址必填");
|
||||
}
|
||||
|
||||
EmisCustomerAddress recieveAddress = new EmisCustomerAddress();
|
||||
recieveAddress.setCountry(emisWaybillSave.getReceiveCountry());
|
||||
recieveAddress.setName(emisWaybillSave.getReceiveName());
|
||||
recieveAddress.setPhone(emisWaybillSave.getReceiveMobile());
|
||||
recieveAddress.setProvince(emisWaybillSave.getReceiveProvince());
|
||||
recieveAddress.setCity(emisWaybillSave.getReceiveCity());
|
||||
recieveAddress.setCounty(emisWaybillSave.getReceiveCounty());
|
||||
recieveAddress.setTown(emisWaybillSave.getReceiveTown());
|
||||
// recieveAddress.setEmail(emisWaybillSave);
|
||||
recieveAddress.setAddress(emisWaybillSave.getReceiveAddress());
|
||||
recieveAddress.setCompany(emisWaybillSave.getReceiveCompany());
|
||||
recieveAddress.setUseSiteCode(emisWaybillSave.getSendSiteCode());
|
||||
recieveAddress.setAddressType("2");
|
||||
|
||||
if( emisWaybillSave.getPaymentType()==null) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"支付方式必填");
|
||||
}
|
||||
|
||||
// 月结客户直接根据月结编号获取客户编码和名称
|
||||
if(
|
||||
"2".equals(emisWaybillSave.getPaymentType())
|
||||
|| "4".equals(emisWaybillSave.getPaymentType())
|
||||
|| "5".equals(emisWaybillSave.getPaymentType())
|
||||
|
||||
){
|
||||
EmisCustomerUser emisCustomerUser=getCustomerUserByMonthlyPayCode(emisWaybillSave.getCustNo());
|
||||
if(emisCustomerUser==null){
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL,"月结客户不存在");
|
||||
}
|
||||
emisWaybillSave.setSalesmen(emisCustomerUser.getSalesmen());
|
||||
emisWaybillSave.setPayee(emisCustomerUser.getPayee());
|
||||
}
|
||||
// 到付
|
||||
else if( "3".equals(emisWaybillSave.getPaymentType()) ) {
|
||||
|
||||
}
|
||||
// 寄付和其他
|
||||
else{
|
||||
|
||||
}
|
||||
|
||||
// 保存客户收件、寄件地址
|
||||
sendAddress.setCustomerCode(customerCode);
|
||||
recieveAddress.setCustomerCode(customerCode);
|
||||
createCustomerAddress(sendAddress);
|
||||
createCustomerAddress(recieveAddress);
|
||||
|
||||
emisWaybillSave.setCustomerCode(customerCode);
|
||||
emisWaybillSave.setCustomerName(customerName);
|
||||
|
||||
if( StringUtils.isAnyEmpty(
|
||||
emisWaybillSave.getTransLineType(),
|
||||
emisWaybillSave.getProductType()
|
||||
)
|
||||
) {
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"线路、产品必填");
|
||||
}
|
||||
|
||||
// 获取泡重比
|
||||
EmisTransLine emisTransLine = getTransLineByCode(emisWaybillSave.getTransLineType());
|
||||
emisWaybillSave.setMeterType(emisTransLine.getMeterRate());
|
||||
|
||||
// 时效
|
||||
EmisTransProduct emisTransProduct = getTransProductByCode(emisWaybillSave.getProductType());
|
||||
emisWaybillSave.setTimeType(emisTransProduct.getAgingDesc());
|
||||
|
||||
if(emisWaybillSave.getSendDate()==null){
|
||||
emisWaybillSave.setSendDate(new Date());
|
||||
}
|
||||
|
||||
// // 计算目的地
|
||||
// EmisDestination destination=calcDestSiteByBase(emisWaybillSave.getReceiveCountry(),emisWaybillSave.getTransLineType(),
|
||||
// emisWaybillSave.getReceiveProvince(),emisWaybillSave.getReceiveCity(),
|
||||
// emisWaybillSave.getReceiveCounty(),
|
||||
// emisWaybillSave.getReceiveAddress());
|
||||
// if(destination==null){
|
||||
// throw new EmisBizError(EmisBizErrorType.NOT_EXISTS, "找不到目的地");
|
||||
// }
|
||||
//
|
||||
// emisWaybillSave.setDestinationCode(destination.getDestCode());
|
||||
// emisWaybillSave.setDispatchUnderlingSiteCode(destination.getSiteCode());
|
||||
|
||||
try {
|
||||
// 计算体积重量
|
||||
calcVolumeWeight(emisWaybillSave);
|
||||
// 计算结算重量
|
||||
calcSettledWeight(emisWaybillSave);
|
||||
// 计算应收费
|
||||
calcWaybillFee(emisWaybillSave);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
log.error("===OMS下单模式,计费错误:",ex.getMessage());
|
||||
}
|
||||
|
||||
|
||||
if(isNew) {
|
||||
if( emisWaybillSave.getSendDate()==null ){
|
||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1,"发件日期必填");
|
||||
}
|
||||
}
|
||||
// 开单当天不算时效
|
||||
Date estDate = getEstimateDate(
|
||||
emisWaybillSave.getSendDate(),emisWaybillSave.getProductType(),
|
||||
emisWaybillSave.getSendCountry(),
|
||||
emisWaybillSave.getReceiveCountry(),0);
|
||||
|
||||
// 预计到达时间
|
||||
log.info("预估到达时间==>"+ DateUtils.dateTime(estDate));
|
||||
emisWaybillSave.setEstimateDate(estDate);
|
||||
|
||||
// 子单号
|
||||
if("1".equals(emisWaybillSave.getBlGenSubbill()) ){
|
||||
// 子单号拼接
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(int i=1;i<=emisWaybillSave.getParcelQty().intValue();i++){
|
||||
sb.append(emisWaybillSave.getBillCode()+ StringUtils.leftPad(String.valueOf(i),4,"0")+",");
|
||||
}
|
||||
emisWaybillSave.setBillCodeSub(sb.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算运单公共信息
|
||||
* @param emisWaybillSave
|
||||
@ -1097,6 +1421,123 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Oms 新开单
|
||||
* @param emisWaybillSave
|
||||
*/
|
||||
private void addNewWaybillByOms(EmisWaybill emisWaybillSave) throws EmisBizError {
|
||||
|
||||
// 子单号做扣减
|
||||
// if("1".equals(emisWaybillSave.getBlGenSubbill())) {
|
||||
// int subBillCount = emisElectronicSitePagService.getTotalAvailablePagCount(emisWaybillSave.getSendSiteCode(), "T7080", "1002");
|
||||
// if(subBillCount<=0){
|
||||
// throw new EmisBizError(EmisBizErrorType.FAIL,"子单数量不足");
|
||||
// }
|
||||
// }
|
||||
|
||||
// 判断网点余额-运单金额 是否足够,如果不够则不允许下单
|
||||
// EmisSiteAccount emisSiteAccount=getSiteAccountBySiteCode(emisWaybillSave.getSendSiteCode());
|
||||
// if(emisSiteAccount==null){
|
||||
// throw new EmisBizError(EmisBizErrorType.FAIL,"网点结算账户不存在,请先开结算账户");
|
||||
// }
|
||||
//
|
||||
// BigDecimal curMoney=emisSiteAccount.getCurMoney();
|
||||
// BigDecimal closeMoney=emisSiteAccount.getCloseMoney();
|
||||
//
|
||||
// BigDecimal newCurMoney=curMoney.subtract(emisWaybillSave.getFreight());
|
||||
// if(newCurMoney.compareTo(closeMoney)==-1){
|
||||
// throw new EmisBizError(EmisBizErrorType.FAIL,"网点余额不足,请充值");
|
||||
// }
|
||||
|
||||
// 公共计算部分
|
||||
calcWayBillCommonInfoByOms(emisWaybillSave,true);
|
||||
|
||||
//补齐数据
|
||||
emisWaybillMapper.insertEmisWaybill(emisWaybillSave);
|
||||
|
||||
// 扣减子单
|
||||
emisElectronicSitePagService.realMatchSubBill(emisWaybillSave.getSendSiteCode(),"T7080",emisWaybillSave.getParcelQty());
|
||||
|
||||
// 产生主键插入其他数据
|
||||
// 插入费用
|
||||
List<EmisWaybillFeeitem> feeitemList=emisWaybillSave.getFeeitemList();
|
||||
if(!CollectionUtils.isEmpty(feeitemList)){
|
||||
for (EmisWaybillFeeitem feeItem:feeitemList) {
|
||||
feeItem.setWaybillId(emisWaybillSave.getId());
|
||||
emisWaybillFeeitemMapper.insertEmisWaybillFeeitem(feeItem);
|
||||
}
|
||||
}
|
||||
|
||||
// 插入商品信息
|
||||
if(!CollectionUtil.isEmpty(emisWaybillSave.getCargoList() )){
|
||||
List<EmisWaybillCargo> cargoList=emisWaybillSave.getCargoList();
|
||||
for (EmisWaybillCargo cargoItem:cargoList) {
|
||||
cargoItem.setWaybillId(emisWaybillSave.getId());
|
||||
emisWaybillCargoMapper.insertEmisWaybillCargo(cargoItem);
|
||||
}
|
||||
}
|
||||
|
||||
// 保存货物图片
|
||||
if(!StringUtils.isEmpty(emisWaybillSave.getGoodsPics())){
|
||||
if(CollectionUtil.isEmpty(emisWaybillSave.getAttachmentList() )){
|
||||
List<EmisWaybillAttachment> attachmentList = new ArrayList<EmisWaybillAttachment>();
|
||||
EmisWaybillAttachment goodsPicAttachment = new EmisWaybillAttachment();
|
||||
goodsPicAttachment.setAttachType(WaybillAttachType.GOODS_PIC.typeCode);
|
||||
goodsPicAttachment.setBillCode(emisWaybillSave.getBillCode());
|
||||
goodsPicAttachment.setFileUrl(emisWaybillSave.getGoodsPics());
|
||||
attachmentList.add(goodsPicAttachment);
|
||||
emisWaybillSave.setAttachmentList(attachmentList);
|
||||
}
|
||||
}
|
||||
|
||||
// 插入附件信息
|
||||
if(!CollectionUtil.isEmpty(emisWaybillSave.getAttachmentList() )){
|
||||
// 商品附件图片插入到附件
|
||||
List<EmisWaybillAttachment> attachmentList=emisWaybillSave.getAttachmentList();
|
||||
for (EmisWaybillAttachment attachmentItem:attachmentList) {
|
||||
attachmentItem.setWaybillId(emisWaybillSave.getId());
|
||||
attachmentItem.setBillCode(emisWaybillSave.getBillCode());
|
||||
emisWaybillAttachmentMapper.insertEmisWaybillAttachment(attachmentItem);
|
||||
}
|
||||
}
|
||||
|
||||
// 占用进仓单号
|
||||
// if(!StringUtils.isEmpty(emisWaybillSave.getWarehouseInNo())) {
|
||||
// String warehouseInNo = WaybillHelper.formatQueryValue(emisWaybillSave.getWarehouseInNo());
|
||||
//// useWarehouseInNo(emisWaybillSave.getBillCode(),null,warehouseInNo);
|
||||
// useWarehouseInNo(emisWaybillSave.getBillCode(),null,warehouseInNo);
|
||||
// }
|
||||
|
||||
// 插入揽收记录
|
||||
// ScanInfo scanInfo = new ScanInfo();
|
||||
// List<Map<String,Object>> scanDataList = new ArrayList<>();
|
||||
// scanInfo.setOpType(2);
|
||||
// scanInfo.setScanType(ScanType.GOT.opCode);
|
||||
//
|
||||
// String dispatchOrSendManCode="";
|
||||
// if("1".equals(emisWaybillSave.getPickupMethod())){
|
||||
// dispatchOrSendManCode=emisWaybillSave.getOperateEmployeeCode();
|
||||
// }
|
||||
// else if("2".equals(emisWaybillSave.getPickupMethod())){
|
||||
// dispatchOrSendManCode=emisWaybillSave.getTakePieceEmployeeCode();
|
||||
// }
|
||||
//
|
||||
// Map<String,Object> scanDateItem = new HashMap<>();
|
||||
// scanDateItem.put("billCode",emisWaybillSave.getBillCode());
|
||||
// scanDateItem.put("dispatchOrSendManCode",dispatchOrSendManCode);
|
||||
// scanDateItem.put("scanDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,emisWaybillSave.getSendDate()));
|
||||
// scanDateItem.put("scanWeight", "0.0");
|
||||
// scanDataList.add(scanDateItem);
|
||||
// scanInfo.setScanData(scanDataList);
|
||||
//
|
||||
// try {
|
||||
// emisTmsScanRecordService.scan(scanInfo);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 运单修改更新
|
||||
* @param emisWaybillSave
|
||||
|
||||
Loading…
Reference in New Issue
Block a user