Commit b887be0c authored by 332784038@qq.com's avatar 332784038@qq.com

空运预约入仓上限计价判断逻辑补充

parent cd87d1a3
...@@ -2988,6 +2988,25 @@ public interface OrderMapper extends AbstractMapper<OrderDO> { ...@@ -2988,6 +2988,25 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
}) })
BigDecimal getOrderTotalVolumeByDeliveryDate(@Param("deliveryDate") Date deliveryDate, @Param("prodId") Long prodId, @Param("orderItemId") Long orderItemId); BigDecimal getOrderTotalVolumeByDeliveryDate(@Param("deliveryDate") Date deliveryDate, @Param("prodId") Long prodId, @Param("orderItemId") Long orderItemId);
@ResultType(BigDecimal.class)
@Select({
"<script>",
"SELECT",
"IFNULL(sum(oi.weight),0)",
"FROM",
"ecw_order_item oi ",
"LEFT JOIN ecw_order o ",
"on o.order_id = oi.order_id ",
"WHERE",
"o.delivery_date = #{deliveryDate}",
"AND oi.prod_id = #{prodId}",
"<when test = 'orderItemId != null '>",
"AND oi.order_item_id != #{orderItemId}",
"</when>",
"</script>"
})
BigDecimal getOrderTotalWeightByDeliveryDate(@Param("deliveryDate") Date deliveryDate, @Param("prodId") Long prodId, @Param("orderItemId") Long orderItemId);
@ResultType(OrderDO.class) @ResultType(OrderDO.class)
@Select({ @Select({
"<script>", "<script>",
......
...@@ -3529,8 +3529,14 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3529,8 +3529,14 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
} }
if (Objects.equals(orderDO.getStatus(), OrderStatusEnum.ORDER_PLACED.getValue()) || Objects.equals(orderDO.getStatus(), OrderStatusEnum.DRAFT.getValue())) { if (Objects.equals(orderDO.getStatus(), OrderStatusEnum.ORDER_PLACED.getValue()) || Objects.equals(orderDO.getStatus(), OrderStatusEnum.DRAFT.getValue())) {
BigDecimal alreadyExistsTotalVolume = orderMapper.getOrderTotalVolumeByDeliveryDate(orderDO.getDeliveryDate(), orderItemDO.getProdId(), orderItemDO.getOrderItemId()); if (orderDO.getTransportId() == 1) {
param.setAlreadyExistsTotalVolume(Objects.isNull(alreadyExistsTotalVolume) ? BigDecimal.ZERO : alreadyExistsTotalVolume); BigDecimal alreadyExistsTotalVolume = orderMapper.getOrderTotalVolumeByDeliveryDate(orderDO.getDeliveryDate(), orderItemDO.getProdId(), orderItemDO.getOrderItemId());
param.setAlreadyExistsTotalVolume(Objects.isNull(alreadyExistsTotalVolume) ? BigDecimal.ZERO : alreadyExistsTotalVolume);
}
if (orderDO.getTransportId() == 3) {
BigDecimal alreadyExistsTotalWeight = orderMapper.getOrderTotalWeightByDeliveryDate(orderDO.getDeliveryDate(), orderItemDO.getProdId(), orderItemDO.getOrderItemId());
param.setAlreadyExistsTotalWeight(Objects.isNull(alreadyExistsTotalWeight) ? BigDecimal.ZERO : alreadyExistsTotalWeight);
}
} }
if (null != orderItemDO.getOneSeaFreight() && if (null != orderItemDO.getOneSeaFreight() &&
......
...@@ -740,10 +740,26 @@ public class ProdCostCalculation { ...@@ -740,10 +740,26 @@ public class ProdCostCalculation {
} }
if (productPriceDO.getNeedBook() == 1) { if (productPriceDO.getNeedBook() == 1) {
// 预约入仓,控制上限
if (productPriceDO.getDayLimit().subtract(prodParam.getAlreadyExistsTotalVolume().add(prodParam.getVolume())).compareTo(BigDecimal.ZERO) < 0) { if (transportId == 1) {
throw exception(PROD_VOLUME_BEYOND_DAY_UPPER_LIMIT, I18nMessage.getLang() == 0 ? prodParam.getProdTitleZh() : prodParam.getProdTitleEn()); if (Objects.isNull(productPriceDO.getDayLimit())){
throw exception(PROD_VOLUME_BEYOND_DAY_UPPER_LIMIT);
}
// 海运预约入仓,控制上限
if (productPriceDO.getDayLimit().subtract(prodParam.getAlreadyExistsTotalVolume().add(prodParam.getVolume())).compareTo(BigDecimal.ZERO) < 0) {
throw exception(PROD_VOLUME_BEYOND_DAY_UPPER_LIMIT, I18nMessage.getLang() == 0 ? prodParam.getProdTitleZh() : prodParam.getProdTitleEn());
}
}
if (transportId == 3) {
if (Objects.isNull(productPriceDO.getWeightLimit())){
throw exception(PROD_VOLUME_BEYOND_DAY_UPPER_LIMIT);
}
// 空运预约入仓,控制上限
if (productPriceDO.getWeightLimit().subtract(prodParam.getAlreadyExistsTotalWeight().add(prodParam.getWeight())).compareTo(BigDecimal.ZERO) < 0) {
throw exception(PROD_WEIGHT_BEYOND_DAY_UPPER_LIMIT, I18nMessage.getLang() == 0 ? prodParam.getProdTitleZh() : prodParam.getProdTitleEn());
}
} }
} }
// 线路价格的单询状态 // 线路价格的单询状态
prodParam.setNeedOrderInquiry(productPriceDO.getNeedOrderInquiry()); prodParam.setNeedOrderInquiry(productPriceDO.getNeedOrderInquiry());
......
...@@ -91,5 +91,8 @@ public interface ErrorCodeConstants { ...@@ -91,5 +91,8 @@ public interface ErrorCodeConstants {
ErrorCode PRODUCT_BRANK_ENGLISH_NAME_EXISTS = new ErrorCode(1004001067, "product.brand.english.name.exist"); ErrorCode PRODUCT_BRANK_ENGLISH_NAME_EXISTS = new ErrorCode(1004001067, "product.brand.english.name.exist");
ErrorCode PROD_WEIGHT_BEYOND_DAY_UPPER_LIMIT = new ErrorCode(1004001068, "prod.weight.beyond.day.upper.limit");
} }
...@@ -170,6 +170,10 @@ public class ProdConditionParam { ...@@ -170,6 +170,10 @@ public class ProdConditionParam {
* 已存在订单商品的同一天送货总方数 * 已存在订单商品的同一天送货总方数
*/ */
private BigDecimal alreadyExistsTotalVolume = BigDecimal.ZERO; private BigDecimal alreadyExistsTotalVolume = BigDecimal.ZERO;
/**
* 已存在订单商品的同一天送货总重量
*/
private BigDecimal alreadyExistsTotalWeight = BigDecimal.ZERO;
@ApiModelProperty(value = "是否特价") @ApiModelProperty(value = "是否特价")
private Boolean specialPriceType = false; private Boolean specialPriceType = false;
......
...@@ -303,6 +303,7 @@ order.label.overlap=order label is overlap ...@@ -303,6 +303,7 @@ order.label.overlap=order label is overlap
transfer.goods.order.not.null=The goods transfer order cannot be empty transfer.goods.order.not.null=The goods transfer order cannot be empty
file.format.is.excel=The file format only supports excel file.format.is.excel=The file format only supports excel
prod.volume.beyond.day.upper.limit=Quantity of {} commodity exceeds the upper limit of acceptance of the warehouse on the current day prod.volume.beyond.day.upper.limit=Quantity of {} commodity exceeds the upper limit of acceptance of the warehouse on the current day
prod.weight.beyond.day.upper.limit=The weight of the product {} exceeds the warehouse's daily acceptance limit
coupon.full.reduce.value.gt.payment.value=The full impairment of preferential activities cannot be greater than the original value coupon.full.reduce.value.gt.payment.value=The full impairment of preferential activities cannot be greater than the original value
coupon.full.net.value.gt.payment.value=The full price of the promotional activities cannot be greater than the original price coupon.full.net.value.gt.payment.value=The full price of the promotional activities cannot be greater than the original price
coupon.currency.or.unit.not.null=The currency unit or measurement unit of preferential activity conditions cannot be blank coupon.currency.or.unit.not.null=The currency unit or measurement unit of preferential activity conditions cannot be blank
......
...@@ -300,6 +300,7 @@ order.label.overlap=\u6807\u7B7E\u53F7\u672C\u8EAB\u5B58\u5728\u91CD\u53E0 ...@@ -300,6 +300,7 @@ order.label.overlap=\u6807\u7B7E\u53F7\u672C\u8EAB\u5B58\u5728\u91CD\u53E0
transfer.goods.order.not.null=\u8C03\u8D27\u8BA2\u5355\u4E0D\u80FD\u4E3A\u7A7A transfer.goods.order.not.null=\u8C03\u8D27\u8BA2\u5355\u4E0D\u80FD\u4E3A\u7A7A
file.format.is.excel=\u6587\u4EF6\u683C\u5F0F\u53EA\u652F\u6301excel file.format.is.excel=\u6587\u4EF6\u683C\u5F0F\u53EA\u652F\u6301excel
prod.volume.beyond.day.upper.limit=\u5546\u54C1{}\u65B9\u6570\u8D85\u51FA\u4ED3\u5E93\u5F53\u65E5\u63A5\u53D7\u4E0A\u9650 prod.volume.beyond.day.upper.limit=\u5546\u54C1{}\u65B9\u6570\u8D85\u51FA\u4ED3\u5E93\u5F53\u65E5\u63A5\u53D7\u4E0A\u9650
prod.weight.beyond.day.upper.limit=\u5546\u54c1{}\u91cd\u91cf\u8d85\u51fa\u4ed3\u5e93\u5f53\u65e5\u63a5\u53d7\u4e0a\u9650
coupon.full.reduce.value.gt.payment.value=\u4F18\u60E0\u6D3B\u52A8\u6EE1\u51CF\u503C\u4E0D\u80FD\u5927\u4E8E\u539F\u503C coupon.full.reduce.value.gt.payment.value=\u4F18\u60E0\u6D3B\u52A8\u6EE1\u51CF\u503C\u4E0D\u80FD\u5927\u4E8E\u539F\u503C
coupon.full.net.value.gt.payment.value=\u4F18\u60E0\u6D3B\u52A8\u7684\u6EE1\u6536\u4EF7\u4E0D\u80FD\u5927\u4E8E\u539F\u4EF7 coupon.full.net.value.gt.payment.value=\u4F18\u60E0\u6D3B\u52A8\u7684\u6EE1\u6536\u4EF7\u4E0D\u80FD\u5927\u4E8E\u539F\u4EF7
coupon.currency.or.unit.not.null=\u4F18\u60E0\u6D3B\u52A8\u6761\u4EF6\u8D27\u5E01\u5355\u4F4D\u6216\u8BA1\u91CF\u5355\u4F4D\u4E0D\u80FD\u4E3A\u7A7A coupon.currency.or.unit.not.null=\u4F18\u60E0\u6D3B\u52A8\u6761\u4EF6\u8D27\u5E01\u5355\u4F4D\u6216\u8BA1\u91CF\u5355\u4F4D\u4E0D\u80FD\u4E3A\u7A7A
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment