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

Merge branch 'master-fix'

# Conflicts:
#	yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/orderWarehouseIn/OrderWarehouseInServiceImpl.java
parents 284a3cb9 14e7e9f8
-- 增加订单产品项最后单价变更时间
alter table ecw_order_item
add COLUMN `last_freight_charge_price_time` datetime DEFAULT NULL COMMENT '运费最后单价变更时间';
alter table ecw_order_item
add COLUMN `last_clearance_charge_price_time` datetime DEFAULT NULL COMMENT '清关费最后单价变更时间';
-- 批量更新订单产品项的最后单价变更时间
update ecw_order_item set `last_freight_charge_price_time` = update_time where last_freight_charge_price_time is null;
update ecw_order_item set `last_clearance_charge_price_time` = update_time where last_clearance_charge_price_time is null;
\ No newline at end of file
package cn.iocoder.yudao.framework.apollo.core.event.box;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* 重置订单的提单 Event
*
* @author zhengYi
*/
@Data
@AllArgsConstructor
public class BoxCheckOrderRemoveLadingBillEvent {
/**
* 订单ID
*/
private Long orderId;
}
package cn.iocoder.yudao.framework.apollo.core.event.warehouseIn;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* 入仓订单检查订单入仓异常 Event
*
* @author zhengYi
*/
@Data
@AllArgsConstructor
public class WarehouseInOrderCheckExceptionEvent {
/**
* 订单id
*/
private Long orderId;
}
...@@ -15,6 +15,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -15,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
...@@ -447,6 +448,12 @@ public class OrderItemDO extends BaseDO { ...@@ -447,6 +448,12 @@ public class OrderItemDO extends BaseDO {
@ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性") @ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性")
private Integer checkBrandType; private Integer checkBrandType;
@ApiModelProperty(value = "最后运费单价变更时间")
private Date lastFreightChargePriceTime;
@ApiModelProperty(value = "最后清关费单价变更时间")
private Date lastClearanceChargePriceTime;
/** /**
* 到仓信息json * 到仓信息json
*/ */
......
package cn.iocoder.yudao.module.order.listener;
import cn.iocoder.yudao.framework.apollo.core.event.warehouseIn.WarehouseInOrderCheckExceptionEvent;
import cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService;
import lombok.AllArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
/**
* 入仓订单检查订单入仓异常监听
*
* @author zhengYi
*/
@Component("WarehouseInOrderCheckExceptionListener")
@AllArgsConstructor
public class WarehouseInOrderCheckExceptionListener {
private final OrderWarehouseInService orderWarehouseInService;
/**
* 入仓订单检查订单入仓异常更新业务
*
* @param event 订单id
*/
@EventListener(WarehouseInOrderCheckExceptionEvent.class)
public void warehouseInOrderCheckExceptionEvent(WarehouseInOrderCheckExceptionEvent event) {
orderWarehouseInService.finishWarehouseInWhenCheckException(event.getOrderId());
}
}
...@@ -3723,8 +3723,13 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3723,8 +3723,13 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
for (OrderItemDO orderItemDO : orderItemDOList) { for (OrderItemDO orderItemDO : orderItemDOList) {
for (ProdCostDto prodCostDto : resultDto.getProdCostDtoList()) { for (ProdCostDto prodCostDto : resultDto.getProdCostDtoList()) {
if (Objects.equals(prodCostDto.getItemId(), orderItemDO.getOrderItemId())) { if (Objects.equals(prodCostDto.getItemId(), orderItemDO.getOrderItemId())) {
boolean isFreightChargePrice = false;
orderItemDO.setOriginalSeaFreight(prodCostDto.getOrgFreightPrice()); orderItemDO.setOriginalSeaFreight(prodCostDto.getOrgFreightPrice());
if ((Objects.isNull(prodCostDto.getOneFreight()) && Objects.nonNull(orderItemDO.getOneSeaFreight())) ||
(Objects.nonNull(prodCostDto.getOneFreight()) && Objects.isNull(orderItemDO.getOneSeaFreight())) ||
(Objects.nonNull(prodCostDto.getOneFreight()) && Objects.nonNull(orderItemDO.getOneSeaFreight()) && orderItemDO.getOneSeaFreight().compareTo(prodCostDto.getOneFreight()) != 0)){
isFreightChargePrice = true;
}
orderItemDO.setOneSeaFreight(prodCostDto.getOneFreight()); orderItemDO.setOneSeaFreight(prodCostDto.getOneFreight());
orderItemDO.setDiscountFreightPrice(prodCostDto.getDiscountFreightPrice()); orderItemDO.setDiscountFreightPrice(prodCostDto.getDiscountFreightPrice());
orderItemDO.setDiscountFreightTotalPrice(prodCostDto.getDiscountFreightTotalPrice()); orderItemDO.setDiscountFreightTotalPrice(prodCostDto.getDiscountFreightTotalPrice());
...@@ -3771,6 +3776,12 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3771,6 +3776,12 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
orderItemDO.setMinMeteringWeight(prodCostDto.getMinMeteringWeight()); orderItemDO.setMinMeteringWeight(prodCostDto.getMinMeteringWeight());
orderItemDO.setOriginalClearanceFreight(prodCostDto.getOrgClearanceFeePrice()); orderItemDO.setOriginalClearanceFreight(prodCostDto.getOrgClearanceFeePrice());
boolean isClearanceChargePrice = false;
if ((Objects.isNull(prodCostDto.getOneClearanceFee()) && Objects.nonNull(orderItemDO.getOneClearanceFreight())) ||
(Objects.nonNull(prodCostDto.getOneClearanceFee()) && Objects.isNull(orderItemDO.getOneClearanceFreight())) ||
(Objects.nonNull(prodCostDto.getOneClearanceFee()) && Objects.nonNull(orderItemDO.getOneClearanceFreight()) && orderItemDO.getOneClearanceFreight().compareTo(prodCostDto.getOneClearanceFee()) != 0)){
isClearanceChargePrice = true;
}
orderItemDO.setOneClearanceFreight(prodCostDto.getOneClearanceFee()); orderItemDO.setOneClearanceFreight(prodCostDto.getOneClearanceFee());
orderItemDO.setDiscountClearanceFeePrice(prodCostDto.getDiscountClearanceFeePrice()); orderItemDO.setDiscountClearanceFeePrice(prodCostDto.getDiscountClearanceFeePrice());
orderItemDO.setDiscountClearanceFeeTotalPrice(prodCostDto.getDiscountClearanceFeeTotalPrice()); orderItemDO.setDiscountClearanceFeeTotalPrice(prodCostDto.getDiscountClearanceFeeTotalPrice());
...@@ -3807,6 +3818,12 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order ...@@ -3807,6 +3818,12 @@ public class OrderBusinessServiceImpl extends AbstractService<OrderMapper, Order
} }
orderItemDO.setCharging(prodCostDto.getCharging()); orderItemDO.setCharging(prodCostDto.getCharging());
orderItemDO.setIsPayAdvance(prodCostDto.getIsPayAdvance()); orderItemDO.setIsPayAdvance(prodCostDto.getIsPayAdvance());
if (isFreightChargePrice){
orderItemDO.setLastFreightChargePriceTime(new Date());
}
if (isClearanceChargePrice){
orderItemDO.setLastClearanceChargePriceTime(new Date());
}
} }
} }
if (Objects.isNull(orderItemDO.getItemStatus()) || if (Objects.isNull(orderItemDO.getItemStatus()) ||
......
...@@ -9,9 +9,11 @@ import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiType ...@@ -9,9 +9,11 @@ import cn.iocoder.yudao.framework.apollo.core.event.Order.CalculateOrderYeJiType
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent; import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderAssociationOfferInfoEvent; import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderAssociationOfferInfoEvent;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderApprovalEvent; import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderApprovalEvent;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderRemoveLadingBillEvent;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxOrderDynamicEstTimeEvent; import cn.iocoder.yudao.framework.apollo.core.event.box.BoxOrderDynamicEstTimeEvent;
import cn.iocoder.yudao.framework.apollo.core.event.warehouseIn.WarehouseInOrderChangeChannelEvent; import cn.iocoder.yudao.framework.apollo.core.event.warehouseIn.WarehouseInOrderChangeChannelEvent;
import cn.iocoder.yudao.framework.apollo.core.event.warehouseIn.WarehouseInOrderChangeTransportEvent; import cn.iocoder.yudao.framework.apollo.core.event.warehouseIn.WarehouseInOrderChangeTransportEvent;
import cn.iocoder.yudao.framework.apollo.core.event.warehouseIn.WarehouseInOrderCheckExceptionEvent;
import cn.iocoder.yudao.framework.common.util.spring.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.util.spring.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.util.bigDecimal.BigDecimalUtils; import cn.iocoder.yudao.framework.common.util.bigDecimal.BigDecimalUtils;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO; import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
...@@ -2197,12 +2199,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -2197,12 +2199,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
throw exception(ORDER_UPDATE_APPROVAL_MUST_BE_WAREHOUSE_IN); throw exception(ORDER_UPDATE_APPROVAL_MUST_BE_WAREHOUSE_IN);
} }
} }
if (isShipment) { // if (isShipment) {
// 出货阶段的修改,需要将当前订单状态值标出,放首位 // // 出货阶段的修改,需要将当前订单状态值标出,放首位
ApplyInfoVO applyInfoVO = new ApplyInfoVO(); // ApplyInfoVO applyInfoVO = new ApplyInfoVO();
applyInfoVO.setName(statusName); // applyInfoVO.setName(statusName);
applyInfoList.addFirst(applyInfoVO); // applyInfoList.addFirst(applyInfoVO);
} // }
// 订单有修改则执行修改审批任务 // 订单有修改则执行修改审批任务
vo.setApplyInfoList(applyInfoList); vo.setApplyInfoList(applyInfoList);
orderApprovalDO = new OrderApprovalDO(); orderApprovalDO = new OrderApprovalDO();
...@@ -4407,7 +4409,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -4407,7 +4409,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
currentOrderDO.setAuditResult(auditResult); currentOrderDO.setAuditResult(auditResult);
if (StringUtils.isNotBlank(auditResult)) { if (StringUtils.isNotBlank(auditResult)) {
// 获取固定中文说明描述 // 获取固定中文说明描述
msg = I18nMessage.getZhMessage(auditResult); // 这里针对订单修改审批业务需要补充,当订单在出货阶段进行编辑审批时,需要
msg = (((Objects.equals(auditResult,order_update_processing.getDesc())
|| Objects.equals(auditResult,order_update_pass.getDesc())
|| Objects.equals(auditResult,order_update_reject.getDesc())
|| Objects.equals(auditResult,order_update_cancel.getDesc()))
&& currentOrderDO.getShipmentState() > 0) ? OrderStatusEnum.valueOf(currentOrderDO.getStatus()).getNameZh().concat("-"): "").concat(I18nMessage.getZhMessage(auditResult));
} }
if (auditType == 0) { if (auditType == 0) {
this.checkOrderProcessingApprovalType(currentOrderDO, auditType, auditResult); this.checkOrderProcessingApprovalType(currentOrderDO, auditType, auditResult);
...@@ -6015,6 +6022,10 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -6015,6 +6022,10 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderDO.setContainerNumber(null); orderDO.setContainerNumber(null);
orderDO.setTidanNo(null); orderDO.setTidanNo(null);
orderMapper.updateById(orderDO); orderMapper.updateById(orderDO);
// 检查入仓异常信息自动处理
applicationContext.publishEvent(
new WarehouseInOrderCheckExceptionEvent(orderDO.getOrderId()));
// 处理控货信息 // 处理控货信息
handleOrderCargoControl(consignorDO, orderDO); handleOrderCargoControl(consignorDO, orderDO);
// 重新计价 // 重新计价
...@@ -6120,11 +6131,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl ...@@ -6120,11 +6131,13 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (isDisassociation) { if (isDisassociation) {
orderGuanlianService.deleteRelationByOrderId(orderDO.getOrderId()); orderGuanlianService.deleteRelationByOrderId(orderDO.getOrderId());
} }
// TODO 当运输方式出现变更时需要重置入仓业务 // 当运输方式出现变更时需要重置入仓业务
if (orderBackVO.getIsTransport()) { if (orderBackVO.getIsTransport()) {
applicationContext.publishEvent( applicationContext.publishEvent(
new WarehouseInOrderChangeTransportEvent(orderDO.getOrderId())); new WarehouseInOrderChangeTransportEvent(orderDO.getOrderId()));
} }
// 订单信息修改后需要重置提单信息
applicationContext.publishEvent(new BoxCheckOrderRemoveLadingBillEvent(orderDO.getOrderId()));
} }
......
...@@ -64,6 +64,14 @@ public interface OrderWarehouseInService extends IService<OrderWarehouseInDO> { ...@@ -64,6 +64,14 @@ public interface OrderWarehouseInService extends IService<OrderWarehouseInDO> {
*/ */
boolean finishWarehouseInWhenChangeTransportType(Long orderId); boolean finishWarehouseInWhenChangeTransportType(Long orderId);
/**
* 订单信息修改后需要检查订单入仓异常情况
*
* @param orderId
*/
void finishWarehouseInWhenCheckException(Long orderId);
/** /**
* 订单储位接口 * 订单储位接口
* *
...@@ -150,7 +158,6 @@ public interface OrderWarehouseInService extends IService<OrderWarehouseInDO> { ...@@ -150,7 +158,6 @@ public interface OrderWarehouseInService extends IService<OrderWarehouseInDO> {
String updateOrUpdateApply(@Valid OrderWarehouseInUpdateApplyReqVO updateReqVO); String updateOrUpdateApply(@Valid OrderWarehouseInUpdateApplyReqVO updateReqVO);
/** /**
* 出货阶段-追加申请 * 出货阶段-追加申请
* *
...@@ -264,11 +271,9 @@ public interface OrderWarehouseInService extends IService<OrderWarehouseInDO> { ...@@ -264,11 +271,9 @@ public interface OrderWarehouseInService extends IService<OrderWarehouseInDO> {
WarehouseInInfoVO getStatisticsFirstFinishedAfterPacked(Long orderId); WarehouseInInfoVO getStatisticsFirstFinishedAfterPacked(Long orderId);
List<OrderWarehouseInWithAttrVO> getOrderWarehouseInCommonAttrList(Long orderId, Long excludeOrderWarehouseInId); List<OrderWarehouseInWithAttrVO> getOrderWarehouseInCommonAttrList(Long orderId, Long excludeOrderWarehouseInId);
/** /**
* 有订单,但客户类型不正确。故这里通过客户订单来修改客户状态 * 有订单,但客户类型不正确。故这里通过客户订单来修改客户状态
*/ */
......
...@@ -1097,6 +1097,27 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1097,6 +1097,27 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
return this.finishWarehouseIn(finishReqVO); return this.finishWarehouseIn(finishReqVO);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void finishWarehouseInWhenCheckException(Long orderId) {
OrderWarehouseInFinishReqVO finishReqVO = new OrderWarehouseInFinishReqVO();
finishReqVO.setOrderId(orderId);
//不需要更新影像
finishReqVO.setUpdateWarehouseInUrl(false);
//不需要更新标签
finishReqVO.setUpdateLabel(false);
//不需要更新用户的 状态 和下一次掉入公海时间
finishReqVO.setUpdateCustomer(false);
//不需要给客户发送入仓短信
finishReqVO.setSendMsg(false);
//不需要纪录操作日志
finishReqVO.setIsAddOrderOperateLog(false);
// 仅重置入仓异常信息
finishReqVO.setIsOnlyResetException(true);
this.finishWarehouseIn(finishReqVO);
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean finishWarehouseIn(OrderWarehouseInFinishReqVO finishReqVO) { public boolean finishWarehouseIn(OrderWarehouseInFinishReqVO finishReqVO) {
...@@ -1139,7 +1160,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1139,7 +1160,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 退场入仓不校验这些、拆单入仓不校验 // 退场入仓不校验这些、拆单入仓不校验
boolean isNotRollbackIn = boolean isNotRollbackIn =
Boolean.FALSE.equals(finishReqVO.getIsRollbackIn()); Boolean.FALSE.equals(finishReqVO.getIsRollbackIn());
if (isNotRollbackIn && !finishReqVO.getIsSplitIn()) { if (isNotRollbackIn && !finishReqVO.getIsSplitIn() && !finishReqVO.getIsOnlyResetException()) {
// 订单排单校验 // 订单排单校验
applicationContext.publishEvent( applicationContext.publishEvent(
new BoxCheckOrderSchedulingEvent(orderId)); new BoxCheckOrderSchedulingEvent(orderId));
...@@ -1318,19 +1339,20 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1318,19 +1339,20 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 处理发货人异常 // 处理发货人异常
//需要到仓确认,需要自动生成发货人异常信息 //需要到仓确认,需要自动生成发货人异常信息
processConsignorException(finishReqVO, orderId, orderDO); processConsignorException(finishReqVO.getIsUpdateCallback(), orderId, orderDO);
// 重新调用计算订单价格, 订单信息和订单项信息需要重新查询, // 重新调用计算订单价格, 订单信息和订单项信息需要重新查询,
// 可能创建异常和修改订单已经对订单信息造成改变 // 可能创建异常和修改订单已经对订单信息造成改变
boolean firstRucang = orderDO.getRucangTime() == null; boolean firstRucang = orderDO.getRucangTime() == null;
if (!finishReqVO.getIsOnlyResetException()) {
if (firstRucang) { // 默认执行计价业务,可以手动确认不执行计价业务
//在下面的函数中完成费用计算 if (firstRucang) {
orderService.finishOrderWarehouseIn(orderDO.getOrderId()); //在下面的函数中完成费用计算
} else { orderService.finishOrderWarehouseIn(orderDO.getOrderId());
orderService.finishOrderWarehouseInUpdate(orderDO.getOrderId()); } else {
orderService.finishOrderWarehouseInUpdate(orderDO.getOrderId());
}
} }
} }
// 更新订单状态 // 更新订单状态
...@@ -1688,9 +1710,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1688,9 +1710,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
return false; return false;
} }
private void processConsignorException(OrderWarehouseInFinishReqVO finishReqVO, Long orderId, OrderDO orderDO) { private void processConsignorException(Boolean isUpdateCallback, Long orderId, OrderDO orderDO) {
//入仓修改回调的入仓不需要生成单证异常和发货人异常 //入仓修改回调的入仓不需要生成单证异常和发货人异常
if (!Boolean.TRUE.equals(finishReqVO.getIsUpdateCallback())) { if (!Boolean.TRUE.equals(isUpdateCallback)) {
// 海运要发货人异常,空运不要发货人异常 // 海运要发货人异常,空运不要发货人异常
if (orderDO.getTransportId() != 3 && orderDO.getTransportId() != 4) { if (orderDO.getTransportId() != 3 && orderDO.getTransportId() != 4) {
// 1.12.发货人异常(客户档案设置了到仓确认,此类客户的货是通知装柜才可装) // 1.12.发货人异常(客户档案设置了到仓确认,此类客户的货是通知装柜才可装)
...@@ -1725,6 +1747,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1725,6 +1747,9 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
if (CollectionUtil.isEmpty(listOrderException)) { if (CollectionUtil.isEmpty(listOrderException)) {
orderExceptionService.createOrderException(orderExceptionCreateReqVO); orderExceptionService.createOrderException(orderExceptionCreateReqVO);
} }
} else {
orderExceptionService.autoProcessException(orderId, null, OrderExceptionEnum.ORDER_CONSIGNOR_EXCEPTION,
"系统自动处理为已处理", OrderExceptionResult.ORDER_CONSIGNOR_EXCEPTION_RESULT.CONFIRM_CHECK);
} }
} }
} }
...@@ -1771,7 +1796,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -1771,7 +1796,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
} else { } else {
if (isUpdateCallback) { if (isUpdateCallback) {
// v2.2 当入仓纪录修改审批后,订单非重货且当前存在重货异常未处理,系统自动处理异常,处理结果设置为普货 // v2.2 当入仓纪录修改审批后,订单非重货且当前存在重货异常未处理,系统自动处理异常,处理结果设置为普货
orderExceptionService.autoProcessException(orderId, null, OrderExceptionEnum.ORDER_HEAVY_CARGO_EXCEPTION, "订单入仓纪录修改,订单非重货,系统自动处理为已处理", OrderExceptionResult.ORDER_HEAVY_CARGO_EXCEPTION_RESULT.GENERAL_CARGO); orderExceptionService.autoProcessException(orderId, null, OrderExceptionEnum.ORDER_HEAVY_CARGO_EXCEPTION, "订单入仓纪录修改,订单非重货,系统自动处理为已处理", OrderExceptionResult.ORDER_HEAVY_CARGO_EXCEPTION_RESULT.GENERAL_CARGO);
// 更新订单为普货 // 更新订单为普货
orderService.updateOrderType(orderId, 1); orderService.updateOrderType(orderId, 1);
} else { } else {
...@@ -6027,6 +6052,64 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI ...@@ -6027,6 +6052,64 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
} }
public void processExceptionWhenOrderUpdate(Long orderId) {
OrderDO orderDO = orderService.getById(orderId);
if (orderDO == null) {
throw ServiceExceptionUtil.exception(
ErrorCodeConstants.ORDER_NOT_EXISTS);
}
// 重置重泡货优惠
resetSpecialVWeightAndWeightUnit(orderId, orderDO,
false, // finishReqVO.getIsSumWeightNoChange(),
false //finishReqVO.getIsSumVolumeNoChange()
);
List<OrderWarehouseInDO> orderWarehouseInDOList =
orderWarehouseInMapper.selectList(OrderWarehouseInDO::getOrderId,
orderDO.getOrderId());
if (CollUtil.isNotEmpty(orderWarehouseInDOList)) {
processChannelPackagingOverWeightException(orderDO);
}
// 重泡货配置
ZhongPaoBestVO zhongPaoBest = getZhongPaoBest(orderDO);
BigDecimal weightSum =
orderWarehouseInDOList.stream().map(OrderWarehouseInDO::getWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal volumeSum =
orderWarehouseInDOList.stream().map(OrderWarehouseInDO::getVolume).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
// 处理重泡货异常
processZhongPaoException(orderId, orderDO, zhongPaoBest, weightSum, volumeSum,
true, // finishReqVO.getIsUpdateCallback(),
false, // finishReqVO.getIsSumVolumeNoChange(),
false, // finishReqVO.getIsSumWeightNoChange(),
orderDO.getAirShipment() == 4 //finishStocked
);
// 处理发货人异常
processConsignorException(false, orderId, orderDO);
// 查询订单异常数量
List<OrderExceptionDO> orderUnProcessExceptionList =
orderExceptionService.getPendingOrderExceptionByOrderIdAndOrderItemIdAndExceptionKey(orderId, null, null);
// 重置异常状态
int exceptionNum = orderUnProcessExceptionList.size();
if (exceptionNum == 0) {
orderService.updateStatus(orderId, orderDO.getOrderNo(), null, 0, null, null, null, null, false);
} else if (exceptionNum == 1) {
// 由多个异常变成1个异常时,需要更新
OrderExceptionDO orderExceptionDO = orderUnProcessExceptionList.get(0);
orderService.updateStatus(orderId, orderDO.getOrderNo(),
null, OrderAbnormalStateEnum.keyOf(orderExceptionDO.getOrderExceptionType()).getValue(), null, null, null, null, false);
}
}
private OrderDO updateOrderSumPrevPacked(Long orderId) { private OrderDO updateOrderSumPrevPacked(Long orderId) {
orderService.updateSumDataPrevPacked(orderId); orderService.updateSumDataPrevPacked(orderId);
return orderService.getById(orderId); return orderService.getById(orderId);
......
...@@ -470,6 +470,12 @@ public class OrderItemBackVO { ...@@ -470,6 +470,12 @@ public class OrderItemBackVO {
@ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性") @ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性")
private Integer checkBrandType; private Integer checkBrandType;
@ApiModelProperty(value = "最后运费单价变更时间")
private Date lastFreightChargePriceTime;
@ApiModelProperty(value = "最后清关费单价变更时间")
private Date lastClearanceChargePriceTime;
/** /**
* 到仓信息json * 到仓信息json
*/ */
......
...@@ -106,4 +106,9 @@ public class OrderWarehouseInFinishReqVO { ...@@ -106,4 +106,9 @@ public class OrderWarehouseInFinishReqVO {
@Transient @Transient
private Boolean isAddOrderOperateLog = true; private Boolean isAddOrderOperateLog = true;
//是否只单独重置异常
@Transient
private Boolean isOnlyResetException = false;
} }
package cn.iocoder.yudao.module.shipment.listener;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderRemoveLadingBillEvent;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderSchedulingEvent;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO;
import cn.iocoder.yudao.module.shipment.service.box.BoxService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import java.util.Collections;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.WAREHOUSE_IN_BOX_EXCEPTION;
/**
* 当订单修改审批通过后,需要对已制作的提单进行重置
*
* @author zhengYi
*/
@Component("BoxOrderUpdateRemoveLadingBillListener")
@AllArgsConstructor
@Slf4j
public class BoxOrderUpdateRemoveLadingBillListener {
private final BoxService boxService;
/**
* 当订单修改审批通过后,需要对已制作的提单进行重置
*
* @param event 订单id
*/
@EventListener(BoxCheckOrderRemoveLadingBillEvent.class)
public void removeLadingBill(BoxCheckOrderRemoveLadingBillEvent event) {
Long orderId = event.getOrderId();
log.info("重置提单订单 orderId={}", orderId);
boxService.removeLadingBill(Collections.singleton(orderId));
}
}
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