Commit fe0ef350 authored by zhengyi's avatar zhengyi

强制到仓后自编号在卸柜/到仓箱标缺失的情况下提交完成卸柜审批的校验逻辑修改,一但未完全卸柜/到仓的订单强制到仓后,整个订单就算是已经卸柜/到仓完成,允许提交审批

parent ecb7b3fa
...@@ -7,7 +7,7 @@ import java.util.Date; ...@@ -7,7 +7,7 @@ import java.util.Date;
/** /**
* 审批校验 Event * 强制到仓 Event
* *
* @author zhengYi * @author zhengYi
*/ */
......
package cn.iocoder.yudao.framework.apollo.core.event.box;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.Date;
/**
* 撤销到仓 Event
*
* @author zhengYi
*/
@Data
@AllArgsConstructor
public class BoxOrderRevokeWarehouseCheckEvent {
/**
* 订单ID
*/
private Long orderId;
}
...@@ -176,6 +176,7 @@ public class OrderWarehouseCheckServiceImpl ...@@ -176,6 +176,7 @@ public class OrderWarehouseCheckServiceImpl
// 清空到仓信息 // 清空到仓信息
abstractMapper.delete(wrapper.eq(OrderWarehouseCheckDO::getOrderId, orderId)); abstractMapper.delete(wrapper.eq(OrderWarehouseCheckDO::getOrderId, orderId));
orderBusinessService.revokeToWarehouse(orderId); orderBusinessService.revokeToWarehouse(orderId);
} }
@Override @Override
......
...@@ -5,11 +5,13 @@ import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderApprovalEve ...@@ -5,11 +5,13 @@ import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderApprovalEve
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxOrderForceWarehouseCheckEvent; import cn.iocoder.yudao.framework.apollo.core.event.box.BoxOrderForceWarehouseCheckEvent;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxApprovalDO; import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxApprovalDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO; import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxLoadInfoDO;
import cn.iocoder.yudao.module.shipment.enums.BoxApprovalTypeEnum; import cn.iocoder.yudao.module.shipment.enums.BoxApprovalTypeEnum;
import cn.iocoder.yudao.module.shipment.service.box.BoxService; import cn.iocoder.yudao.module.shipment.service.box.BoxService;
import cn.iocoder.yudao.module.shipment.service.boxApproval.BoxApprovalService; import cn.iocoder.yudao.module.shipment.service.boxApproval.BoxApprovalService;
import cn.iocoder.yudao.module.shipment.service.boxLoadInfo.BoxLoadInfoService; import cn.iocoder.yudao.module.shipment.service.boxLoadInfo.BoxLoadInfoService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener; import org.springframework.context.event.EventListener;
...@@ -49,6 +51,10 @@ public class BoxOrderForceWarehouseCheckListener { ...@@ -49,6 +51,10 @@ public class BoxOrderForceWarehouseCheckListener {
if (boxDO == null) { if (boxDO == null) {
throw exception(BOX_NOT_EXISTS); throw exception(BOX_NOT_EXISTS);
} }
// 跟新到仓时间到卸柜/到仓箱标数据表
boxLoadInfoService.update(new LambdaUpdateWrapper<BoxLoadInfoDO>()
.set(BoxLoadInfoDO::getUnloadTime, event.getUnloadTime())
.eq(BoxLoadInfoDO::getOrderId, event.getOrderId()));
if (event.getTransportId() == 1){ if (event.getTransportId() == 1){
// 海运 // 海运
boxLoadInfoService.updateOrderStatus(Arrays.asList(event.getOrderId()), event.getUnloadTime(), boxDO); boxLoadInfoService.updateOrderStatus(Arrays.asList(event.getOrderId()), event.getUnloadTime(), boxDO);
......
package cn.iocoder.yudao.module.shipment.listener;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxOrderForceWarehouseCheckEvent;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxOrderRevokeWarehouseCheckEvent;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxLoadInfoDO;
import cn.iocoder.yudao.module.shipment.service.box.BoxService;
import cn.iocoder.yudao.module.shipment.service.boxLoadInfo.BoxLoadInfoService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.BOX_NOT_EXISTS;
/**
* 订单撤销到仓业务执行
*
* @author zhengYi
*/
@Component("BoxOrderRevokeWarehouseCheckListener")
@AllArgsConstructor
@Slf4j
public class BoxOrderRevokeWarehouseCheckListener {
private final BoxLoadInfoService boxLoadInfoService;
private final BoxService boxService;
/**
* 订单强撤销到仓业务执行
*
* @param event 订单信息
*/
@EventListener(BoxOrderRevokeWarehouseCheckEvent.class)
public void orderForceWarehouseCheck(BoxOrderRevokeWarehouseCheckEvent event) {
// 跟新卸柜/到仓箱标数据表未真实卸柜的箱标到仓时间为null
boxLoadInfoService.update(new LambdaUpdateWrapper<BoxLoadInfoDO>()
.set(BoxLoadInfoDO::getUnloadTime, null)
.eq(BoxLoadInfoDO::getIsUnload, 0)
.eq(BoxLoadInfoDO::getOrderId, event.getOrderId()));
}
}
...@@ -2120,7 +2120,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements ...@@ -2120,7 +2120,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
boxLoadInfoQueryVO.setShipmentId(shipmentId); boxLoadInfoQueryVO.setShipmentId(shipmentId);
List<BoxLoadInfoDO> loadInfoList = boxLoadInfoService.getBoxLoadInfoList(boxLoadInfoQueryVO); List<BoxLoadInfoDO> loadInfoList = boxLoadInfoService.getBoxLoadInfoList(boxLoadInfoQueryVO);
long unloadNum = loadInfoList.stream() long unloadNum = loadInfoList.stream()
.filter(t -> t.getIsUnload() == 1) .filter(t -> Objects.nonNull(t.getUnloadTime()))
.count(); .count();
if (unloadNum != loadInfoList.size()) { if (unloadNum != loadInfoList.size()) {
BoxDO boxDO = getBox(shipmentId); BoxDO boxDO = getBox(shipmentId);
......
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