This commit is contained in:
linfso 2024-06-24 10:53:01 +08:00
parent 61bfbad2d3
commit 3a3f5ead9f
4 changed files with 53 additions and 1 deletions

View File

@ -10,9 +10,13 @@
*/ */
package com.xdadan.erp.emis.mapper; package com.xdadan.erp.emis.mapper;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xdadan.erp.emis.domain.EmisSpecialCalcWeight; import com.xdadan.erp.emis.domain.EmisSpecialCalcWeight;
import org.apache.ibatis.annotations.Param;
/** /**
* @ClassName EmisSpecialCalcWeightMapper * @ClassName EmisSpecialCalcWeightMapper
* @Description <p> 特殊取重 Mapper 接口 </p> * @Description <p> 特殊取重 Mapper 接口 </p>
@ -70,4 +74,8 @@ public interface EmisSpecialCalcWeightMapper extends BaseMapper<EmisSpecialCalcW
* @return 结果 * @return 结果
*/ */
public int deleteEmisSpecialCalcWeightByIds(Long[] ids); public int deleteEmisSpecialCalcWeightByIds(Long[] ids);
public EmisSpecialCalcWeight getValidSpecialCalcWeight(@Param("prodCode") String prodCode, @Param("sendDate") Date sendDate, @Param("weight") BigDecimal weight);
} }

View File

@ -54,6 +54,7 @@ package com.xdadan.erp.emis.service;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -158,6 +159,13 @@ public class EmisBaseService {
@Autowired @Autowired
private EmisTmsPackMapper emisTmsPackMapper; private EmisTmsPackMapper emisTmsPackMapper;
@Autowired
private EmisSpecialCalcWeightMapper emisSpecialCalcWeightMapper;
@Autowired @Autowired
RedissonService redissonService; RedissonService redissonService;
@ -1783,6 +1791,20 @@ public class EmisBaseService {
} }
/**
* 获取产品有效特殊取重
* @param prodCode
* @param sendDate
* @param weight
* @return
*/
public EmisSpecialCalcWeight getValidSpecialCalcWeight(String prodCode, Date sendDate, BigDecimal weight) {
return emisSpecialCalcWeightMapper.getValidSpecialCalcWeight(prodCode, sendDate, weight);
}
/** /**
* 通过名称获取产品 线路下的产品 * 通过名称获取产品 线路下的产品
* @param lineCode * @param lineCode

View File

@ -843,7 +843,7 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
if("1".equals(emisWaybillSave.getBlGenSubbill()) ){ if("1".equals(emisWaybillSave.getBlGenSubbill()) ){
// 子单号拼接 // 子单号拼接
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for(int i=1;i<emisWaybillSave.getParcelQty().intValue() && i<15;i++){ for(int i=1;i<=emisWaybillSave.getParcelQty().intValue() && i<15;i++){
sb.append(emisWaybillSave.getBillCode()+ StringUtils.leftPad(String.valueOf(i),4,"0")+","); sb.append(emisWaybillSave.getBillCode()+ StringUtils.leftPad(String.valueOf(i),4,"0")+",");
} }
emisWaybillSave.setBillCodeSub(sb.toString()); emisWaybillSave.setBillCodeSub(sb.toString());
@ -1350,11 +1350,23 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
// 获取产品信息 // 获取产品信息
EmisTransProduct emisTransProduct = getTransProductByCode(emisWaybill.getProductType()); EmisTransProduct emisTransProduct = getTransProductByCode(emisWaybill.getProductType());
if(emisTransProduct==null){
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR1, "产品不存在");
}
// 两者取大 // 两者取大
double maxWeight = Math.max(billWeight,volumeWeight); double maxWeight = Math.max(billWeight,volumeWeight);
// 取重方式 // 取重方式
String carryType=emisTransProduct.getCarryType(); String carryType=emisTransProduct.getCarryType();
// 获取特殊取重
EmisSpecialCalcWeight emisSpecialCalcWeight=getValidSpecialCalcWeight(emisTransProduct.getProdCode(),new Date(),BigDecimal.valueOf(maxWeight));
if(emisSpecialCalcWeight!=null){
carryType=emisSpecialCalcWeight.getCarryType();
}
double setteldWeight = WaybillHelper.calcSettledWeight(maxWeight,carryType); double setteldWeight = WaybillHelper.calcSettledWeight(maxWeight,carryType);
emisWaybill.setSettlementWeight(BigDecimal.valueOf(setteldWeight)); emisWaybill.setSettlementWeight(BigDecimal.valueOf(setteldWeight));
} }

View File

@ -167,4 +167,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
limit 1 limit 1
</select> </select>
<select id="getValidSpecialCalcWeight" resultMap="EmisSpecialCalcWeightResult">
select id, prod_code, prod_name, country, trans_line_code, status, carry_type, begin_weight, end_weight, begin_date, end_date, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
where del_flag='0'
and prod_code = #{prodCode}
and ( begin_weight <![CDATA[< ]]> #{weight} and #{weight} <![CDATA[<= ]]> end_weight )
and ( begin_date <![CDATA[< ]]> #{sendDate} and #{sendDate} <![CDATA[<= ]]> end_date )
limit 1
</select>
</mapper> </mapper>