Commit 20c13a21 authored by zhengyi's avatar zhengyi

订单的关联单-有异常,或者未入仓,或者有进行中的不能预装的审批类型,不返回到待预装列表

parent 9cba5aa9
......@@ -197,23 +197,23 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.eq(BoxPreloadGoodsDO::getIsRemove, 0)
);
OrderDO orderDO = orderService.getById(orderId);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6,11,13,14,22,23) , false);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
// 2024-11-5 注意:此处要关注关联订单,关联订单也是一并修改成不受费用申请和特价影响
if (StringUtils.isNotBlank(orderDO.getGuanLianOrderStatus())){
if (StringUtils.isNotBlank(orderDO.getGuanLianOrderStatus())) {
List<GuanLianOrderStatusVO> guanLianOrderStatusVOList = JSONObject.parseArray(orderDO.getGuanLianOrderStatus(), GuanLianOrderStatusVO.class);
if (CollectionUtil.isNotEmpty(guanLianOrderStatusVOList) && guanLianOrderStatusVOList.size() > 0){
if (CollectionUtil.isNotEmpty(guanLianOrderStatusVOList) && guanLianOrderStatusVOList.size() > 0) {
List<GuanLianOrderStatusVO> approvalGuanLianOrderList = guanLianOrderStatusVOList.stream().filter(vo -> vo.getType() == 2).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(approvalGuanLianOrderList)){
if (CollectionUtil.isNotEmpty(approvalGuanLianOrderList)) {
String orderNoStr = approvalGuanLianOrderList.stream().filter(o -> {
OrderApprovalTypeCheckEvent guanLianApprovalTypeCheckEvent = new OrderApprovalTypeCheckEvent(o.getOrderId(), null, null, Arrays.asList(6,11,13,14,22,23) , false);
OrderApprovalTypeCheckEvent guanLianApprovalTypeCheckEvent = new OrderApprovalTypeCheckEvent(o.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(guanLianApprovalTypeCheckEvent);
return guanLianApprovalTypeCheckEvent.getResult();
}).map(GuanLianOrderStatusVO::getOrderNo).collect(Collectors.joining(StrUtil.COMMA));
if (StringUtils.isNotBlank(orderNoStr)){
if (StringUtils.isNotBlank(orderNoStr)) {
throw exception(GUAN_LIAN_ORDER_IS_APPROVAL_IN_PROCESS, orderNoStr);
}
}
......@@ -782,7 +782,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
OrderDO orderDO,
List<Long> orderItemIdList) {
//订单校验是否在审核中
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6,11,13,14,22,23) , false);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
......@@ -919,7 +919,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BigDecimal volumeSum = boxGoodsStatistics.getVolume();
BigDecimal weightSum = boxGoodsStatistics.getWeight();
if(orderDO!=null) {
if (orderDO != null) {
if (orderDO.getSumNum() != null) {
numSum += orderDO.getSumNum();
boxGoodsStatistics.setNum(numSum);
......@@ -1428,7 +1428,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
));
Iterator<Long> orderIdIt = orderMap.keySet().iterator();
for (Integer num : missList) {
if(orderIdIt.hasNext()) {
if (orderIdIt.hasNext()) {
Long orderId = orderIdIt.next();
List<BoxPreloadGoodsDO> orderGoodList = orderMap.get(orderId);
setTidanNum(orderGoodList, num, selfNo, updateOrder);
......@@ -1439,7 +1439,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List<BoxPreloadGoodsDO> resultList = orderMap.values().stream()
.flatMap(Collection::stream)
.collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(resultList)) {
if (CollectionUtil.isNotEmpty(resultList)) {
setTidanNum(resultList, orderNum, selfNo, updateOrder);
}
}
......@@ -1447,13 +1447,13 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
}
if(updateOrder) {
if (updateOrder) {
Set<Long> orderIdSet = preloadGoodsList.stream()
.map(BoxPreloadGoodsDO::getOrderId)
.collect(Collectors.toSet());
Map<Long, Integer> tidanNumMap = preloadGoodsList.stream()
.collect(Collectors.toMap(BoxPreloadGoodsDO::getOrderId, BoxPreloadGoodsDO::getTidanNum, (v1, v2)->v2));
.collect(Collectors.toMap(BoxPreloadGoodsDO::getOrderId, BoxPreloadGoodsDO::getTidanNum, (v1, v2) -> v2));
for (Long orderId : orderIdSet) {
Integer orderNum = tidanNumMap.get(orderId);
String ladingBillNo = selfNo + "-" + orderNum;
......@@ -1464,6 +1464,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 找出有间隔的订单
*
* @param list 预装商品项
* @return
*/
......@@ -1525,6 +1526,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 根据订单生成提单号
*
* @param orderId 订单ID
* @return
*/
......@@ -1603,8 +1605,8 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxDO boxDO = boxService.getBox(shipmentId);
Integer prStatus = boxDO.getPrStatus();
Set<Long> orderIdSet = getShipOrderIdList(shipmentId);
if(CollectionUtil.isEmpty(orderIdSet)) {
if(prStatus == PrStatusEnum.PRELOAD_ING.getPrStatus() ||
if (CollectionUtil.isEmpty(orderIdSet)) {
if (prStatus == PrStatusEnum.PRELOAD_ING.getPrStatus() ||
prStatus == PrStatusEnum.PRELOAD_APPROVAL_FAIL.getPrStatus()
) {
//修改为已订舱,待预装
......@@ -1613,7 +1615,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
} else {
//修改为预装中
if(prStatus == PrStatusEnum.NO_PRELOAD.getPrStatus() ||
if (prStatus == PrStatusEnum.NO_PRELOAD.getPrStatus() ||
prStatus == PrStatusEnum.PRELOAD_APPROVAL_FAIL.getPrStatus()
) {
//未预装和预装审核失败的情况才修改为预装中
......@@ -1626,6 +1628,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 把订单从出货单中删除
*
* @param shipmentId 出货单ID
* @param orderIdCollection 订单列表
* @param type 1 预装移除 2 理货移除 3 装柜移除
......@@ -1633,7 +1636,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
*/
@Override
public void deleteOrderList(Long shipmentId, Collection<Long> orderIdCollection, Integer type, boolean hasExit) {
if(CollectionUtil.isNotEmpty(orderIdCollection)) {
if (CollectionUtil.isNotEmpty(orderIdCollection)) {
//删除装柜商品
boxPreloadGoodsMapper.delete(new LambdaQueryWrapperX<BoxPreloadGoodsDO>()
.in(BoxPreloadGoodsDO::getOrderId, orderIdCollection)
......@@ -1652,8 +1655,8 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//删除该订单在理货这合包时的装箱数据
boxOrderCheckInfoService.remove(new LambdaQueryWrapperX<BoxOrderCheckInfoDO>()
.eq(BoxOrderCheckInfoDO::getShipmentId,shipmentId)
.in(BoxOrderCheckInfoDO::getOrderId,orderIdCollection)
.eq(BoxOrderCheckInfoDO::getShipmentId, shipmentId)
.in(BoxOrderCheckInfoDO::getOrderId, orderIdCollection)
);
//删除已经理货的数据
......@@ -1921,7 +1924,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//查询订单的报关费用
List<BoxLoadOrderVO> orderVOList = detailBackVO.getSectionOrderList();
if(CollectionUtil.isNotEmpty(orderVOList)) {
if (CollectionUtil.isNotEmpty(orderVOList)) {
List<Long> orderIdList = orderVOList.stream()
.map(BoxLoadOrderVO::getOrderId)
.collect(Collectors.toList());
......@@ -1935,16 +1938,16 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
detailBackVO.setAbnormalList(BoxAbnormalConvert.INSTANCE.convertList(abnormalList));
String dealOrderIds = null;
BoxAbnormalDO boxAbnormalDO = null;
if(CollectionUtil.isNotEmpty(abnormalList)) {
if (CollectionUtil.isNotEmpty(abnormalList)) {
boxAbnormalDO = abnormalList.get(0);
dealOrderIds = boxAbnormalDO.getDealOrderIds();
}
if(StringUtils.isEmpty(dealOrderIds)) {
if (StringUtils.isEmpty(dealOrderIds)) {
dealOrderIds = "";
}
for (BoxLoadOrderVO orderVO : orderVOList) {
orderVO.setCustomsFee(orderFeeMap.get(orderVO.getOrderId()));
if(boxAbnormalDO == null) {
if (boxAbnormalDO == null) {
orderVO.setAbnormalDealStatus(1);
} else {
boolean isDeal = dealOrderIds.contains(orderVO.getOrderId().toString());
......@@ -2164,7 +2167,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List<Long> approvalIdList = new ArrayList<>();
for (Long orderId : oIdList) {
OrderDO orderDO = orderService.getById(orderId);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6,11,13,14,22,23) , false);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
approvalIdList.add(orderId);
......@@ -2305,18 +2308,18 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
OrderConsigneeDO filterConsigneeDO = getFilterOrderConsigneeDO(boxDO, loadList);
OrderDO orderDO = orderService.getById(orderId);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6,11,13,14,22,23) , false);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
if(filterConsigneeDO != null) {
if (filterConsigneeDO != null) {
//校验收货人是否是同一个人
OrderConsigneeDO consigneeDO = boxService.getOrderConsignee(orderDO);
//校验是否是用一个人 ,通过手机号
if(consigneeDO != null && !consigneeDO.getPhone().equals(filterConsigneeDO.getPhone())) {
if (consigneeDO != null && !consigneeDO.getPhone().equals(filterConsigneeDO.getPhone())) {
throw new ServiceException(500, "当前自编号是客户+自清,收货人必须是手机号相同才可以进行分拣");
}
}
......@@ -2324,7 +2327,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//如果都符合,下面展示互斥和关联订单的弹窗
Integer relationStatus = createReqVO.getRelationStatus();
//校验是否是互斥订单
if(relationStatus == null || relationStatus == 2) {
if (relationStatus == null || relationStatus == 2) {
//校验互斥订单
checkMutualOrder(loadList, orderDO);
}
......@@ -2335,7 +2338,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
boolean hasRelationOrder = CollectionUtil.isNotEmpty(orderRelationList);
if(hasRelationOrder) {
if (hasRelationOrder) {
Set<Long> orderIdSet = orderRelationList.stream()
.flatMap(o -> Stream.of(o.getOrderId(), o.getRelateOrderId()))
.collect(Collectors.toSet());
......@@ -2411,7 +2414,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//过滤了入仓为0的数据
List<OrderItemBackVO> orderItemList = orderItemService.getOrderItemBackByOrderId(orderIdList);
if(CollectionUtil.isEmpty(orderItemList)) {
if (CollectionUtil.isEmpty(orderItemList)) {
throw new ServiceException(500, "订单项不存在");
}
......@@ -2725,7 +2728,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List<Long> approvalIdList = new ArrayList<>();
for (Long orderId : oIdList) {
OrderDO orderDO = orderService.getById(orderId);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6,11,13,14,22,23) , false);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
approvalIdList.add(orderId);
......@@ -2824,15 +2827,32 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Iterator<OrderPreloadVO> it = orderPreloadList.iterator();
while (it.hasNext()) {
OrderPreloadVO orderPreloadVO = it.next();
String guanlianOrderStatus = orderPreloadVO.getGuanLianOrderStatus();
if (StringUtils.isEmpty(guanlianOrderStatus)) continue;
JSONArray jsonArray = JSONArray.parseArray(guanlianOrderStatus);
if (jsonArray.size() > 0) {
if (StringUtils.isNotBlank(orderPreloadVO.getGuanLianOrderStatus())) {
List<GuanLianOrderStatusVO> guanLianOrderStatusVOList = JSONObject.parseArray(orderPreloadVO.getGuanLianOrderStatus(), GuanLianOrderStatusVO.class);
if (CollectionUtil.isNotEmpty(guanLianOrderStatusVOList) && guanLianOrderStatusVOList.size() > 0) {
List<GuanLianOrderStatusVO> approvalGuanLianOrderList = guanLianOrderStatusVOList.stream().filter(vo -> vo.getType() == 2).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(approvalGuanLianOrderList)) {
boolean isApproval = approvalGuanLianOrderList.stream().anyMatch(o -> {
if (o.getType() == 2) {
// 关联单进行中的审批类型校验
OrderApprovalTypeCheckEvent guanLianApprovalTypeCheckEvent = new OrderApprovalTypeCheckEvent(o.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(guanLianApprovalTypeCheckEvent);
return guanLianApprovalTypeCheckEvent.getResult();
}else {
// 关联单有异常或未完成入仓
return true;
}
});
if (isApproval) {
//表示该订单的关联单-有异常或者在审核中或者未入仓
it.remove();
}
}
}
}
}
}
private String getSectionText(Long secId, List<BoxPreloadSectionDO> boxSectionList) {
Integer lang = I18nMessage.getLang();
......@@ -3079,7 +3099,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//添加参数,解决合包箱数据为空时不计算预装箱数的BUG
calculateBoxMergeSum(shipmentMergeMap.get(shipmentId),
boxGoodsStatistics,shipmentId);
boxGoodsStatistics, shipmentId);
shipmentStatisticsMap.put(shipmentId, boxGoodsStatistics);
}
......
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