Browse Source

市配预约订单、包件查询调整;

商配计划新增零担订单
仓库盘点商场限制取消
training
kilo 1 year ago
parent
commit
2362d03e19
  1. 61
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionReservationOrderPackageVO.java
  2. 1
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IInventoryDetailClient.java
  3. 22
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java
  4. 19
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java
  5. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java
  6. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java
  7. 23
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml
  8. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml
  9. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryInfoService.java
  10. 17
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java
  11. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java
  12. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java
  13. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryInfoServiceImpl.java
  14. 311
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  15. 418
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  16. 15
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  17. 8
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java

61
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/vo/DistributionReservationOrderPackageVO.java

@ -0,0 +1,61 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.distribution.vo;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 配送在库订单 视图实体类
*
* @author cyz
* @since 2023-06-13
*/
@Data
public class DistributionReservationOrderPackageVO {
private static final long serialVersionUID = 1L;
/**
* 使用包件信息
*/
@ApiModelProperty(value = "包件信息")
private String packageListIds;
/**
* 使用包件信息
*/
@ApiModelProperty(value = "包件信息")
private List<DistributionParcelListVO> packageList;
/**
* 使用包件信息
*/
@ApiModelProperty(value = "包件信息")
private List<DistributionParcelListVO> reservationPackageList;
}

1
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/IInventoryDetailClient.java

@ -4,6 +4,7 @@ import com.logpm.oldproject.entity.InventoryDetailEntity;
import org.springblade.common.constant.ModuleNameConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(
value = ModuleNameConstant.APPLICATION_OLDPROJECT_NAME

22
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionDeliveryListController.java

@ -116,6 +116,17 @@ public class DistributionDeliveryListController extends BladeController {
}
/**
* 查看订单
*/
@GetMapping("/getPackageListByDeliveryIdAndOrderId")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "查看订单", notes = "传入distributionDeliveryList")
public R getPackageListByDeliveryIdAndOrderId(@RequestParam Long deliveryId,@RequestParam Long orderId, Query query) {
R r = distributionDeliveryListService.getPackageListByDeliveryIdAndOrderId(Condition.getPage(query), deliveryId,orderId);
return R.data(r);
}
/**
* 查看订单
*/
@ -321,6 +332,17 @@ public class DistributionDeliveryListController extends BladeController {
return R.data(distributionStockArticle);
}
/**
* 查询配送计划下零担信息
*/
@GetMapping("/getDeliveryZeroOrderDetail")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "customArgs")
public R<List<DistributionParcelNumberVO>> getDeliveryZeroOrderDetail(@ApiIgnore @RequestParam Long deliveryId,@RequestParam Long orderId) {
List<DistributionParcelNumberVO> parcelNumberVOS = distributionDeliveryListService.getDeliveryZeroOrderDetail(deliveryId, orderId);
return R.data(parcelNumberVOS);
}
/**
* 修改市配配送计划
*/

19
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java

@ -26,9 +26,7 @@ import com.logpm.distribution.dto.DistributionReservationDTO;
import com.logpm.distribution.entity.DistributionReservationEntity;
import com.logpm.distribution.excel.DistributionReservationExcel;
import com.logpm.distribution.service.IDistributionReservationService;
import com.logpm.distribution.vo.DistributionParcelNumberVO;
import com.logpm.distribution.vo.DistributionReservationVO;
import com.logpm.distribution.vo.DistributionStockArticleVO;
import com.logpm.distribution.vo.*;
import com.logpm.distribution.wrapper.DistributionReservationWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -345,5 +343,20 @@ public class DistributionReservationController extends BladeController {
}
/**
* 预约列表 详情
*/
@GetMapping("/getReservationPackageListByOrderId")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "详情", notes = "传入distrbutionReservation")
public R getReservationPackageListByorderId(@ApiIgnore @RequestParam Long orderId, @ApiIgnore @RequestParam Long reservationId, Query query) {
R parcelListVOIPage = reservationService.getReservationPackageListByOrderId(orderId,reservationId,Condition.getPage(query));
return R.data(parcelListVOIPage);
}
}

13
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java

@ -28,6 +28,7 @@ import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.excel.DistributionStockArticleExcel;
import com.logpm.distribution.excel.DistributionStockArticleImporter;
import com.logpm.distribution.service.IDistributionStockArticleService;
import com.logpm.distribution.vo.DistributionParcelListVO;
import com.logpm.distribution.vo.DistributionParcelNumberVO;
import com.logpm.distribution.vo.DistributionStockArticleVO;
import com.logpm.distribution.vo.OrderPackgeCodeDataVO;
@ -132,6 +133,18 @@ public class DistributionStockArticleController extends BladeController {
return R.data(pages);
}
/**
* 配送在库订单 分页
*/
@GetMapping("/getPackageListByStockArticleId")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入distributionStockArticle")
public R<IPage<DistributionParcelListVO>> getPackageListByStockArticleId(@ApiIgnore @RequestParam Long orderId, Query query) {
IPage<DistributionParcelListVO> pages = distributionStockArticleService.getPackageListByStockArticleId(Condition.getPage(query), orderId);
return R.data(pages);
}
/**
* 查询零担订单详情
*/

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java

@ -402,4 +402,12 @@ public interface DistributionDeliveryListMapper extends BaseMapper<DistributionD
* @return
*/
List<DistributionReservationStockarticleEntity> getReservationStockArticleByDeliveryId(@Param("delivaryListId") Long deliveryId);
/**
* 查询配送计零担订单详情
* @param orderId
* @param deliveryId
* @return
*/
List<DistributionParcelNumberVO> selectDeliveryZeroOrderDetail(@Param("orderId") Long orderId,@Param("deliveryListId") Long deliveryId);
}

23
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml

@ -1564,5 +1564,28 @@
where
lddl.id = #{delivaryListId}
</select>
<select id="selectDeliveryZeroOrderDetail"
resultType="com.logpm.distribution.vo.DistributionParcelNumberVO">
SELECT
ldpl.firsts,
ldrzp.parcel_list_id AS parcelListId,
ldrs.stock_article_id AS stockArticleId,
ldrzp.quantity AS reservationNum ,
ldpn.quantity,
ldpn.hand_quantity,
ldpn.delivery_quantity,
ldpn.signin_quantity,
ldpn.outbound_quantity
FROM
logpm_distribution_delivery_list AS lddl
INNER JOIN logpm_distribution_signfor AS lds ON lddl.id = lds.delivery_id
INNER JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id
LEFT JOIN logpm_distribution_reservation_stockarticle AS ldrs ON ldr.id = ldrs.reservation_id
LEFT JOIN logpm_distribution_reservation_zero_package AS ldrzp ON ldrs.stock_article_id = ldrzp.stock_article_id AND ldrzp.reservation_id = ldrs.reservation_id
LEFT JOIN logpm_distribution_parcel_list AS ldpl ON ldrzp.parcel_list_id = ldpl.id AND ldpl.stock_article_id = ldrs.stock_article_id
LEFT JOIN logpm_distribution_parcel_number AS ldpn ON ldpl.id = ldpn.parcel_list_id
WHERE
ldrs.stock_article_id = #{orderId} AND lddl.id=#{deliveryListId} and ldrs.stock_article_status in ('1','3') AND ldrzp.zero_package_status IN ( '1', '3' )
</select>
</mapper>

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml

@ -571,7 +571,8 @@
</select>
<select id="getReservationPackage" resultType="com.logpm.distribution.entity.DistributionParcelListEntity">
SELECT
ldpl.*
ldpl.*,
ldpl.quantity AS reservationNum
FROM
logpm_distribution_reservation_package AS ldrp
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldrp.parce_list_id = ldpl.id

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryInfoService.java

@ -28,6 +28,7 @@ import com.logpm.distribution.vo.DistributionStockArticleVO;
import com.logpm.distribution.vo.DistributionStockListVO;
import com.logpm.distribution.vo.app.DistributionAppStockArticleVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.tool.api.R;
import java.util.List;
@ -103,4 +104,6 @@ public interface IDistributionDeliveryInfoService extends BaseService<Distributi
* @return
*/
IPage<DistributionAppStockArticleVO> selectDistributionAppDeliveryInventory(IPage<DistributionAppStockArticleVO> page, DistributionAppDeliveryListDTO distributionAppDeliveryListDTO);
}

17
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionDeliveryListService.java

@ -264,4 +264,21 @@ public interface IDistributionDeliveryListService extends BaseService<Distributi
* @return
*/
R abnormalLoading(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO);
/**
* 查询配送计划订单包件预约详情
* @param page
* @param deliveryId
* @param orderId
* @return
*/
R getPackageListByDeliveryIdAndOrderId(IPage<Object> page, Long deliveryId, Long orderId);
/**
* 查询配送计划下零担订单详情
* @param deliveryId
* @param orderId
* @return
*/
List<DistributionParcelNumberVO> getDeliveryZeroOrderDetail(Long deliveryId, Long orderId);
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java

@ -217,4 +217,12 @@ public interface IDistributionReservationService extends BaseService<Distributio
* @return
*/
List<DistributionParcelNumberVO> getReservationZeroOrderDetail(Long id,Long reservationId);
/**
* 查询预约订单的包件信息
* @param orderId
* @param reservationId
* @return
*/
R getReservationPackageListByOrderId(Long orderId, Long reservationId,IPage<DistributionReservationOrderPackageVO> page);
}

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java

@ -23,6 +23,7 @@ import com.logpm.distribution.dto.DistributionStockArticleDTO;
import com.logpm.distribution.dto.app.queryOrderDTO;
import com.logpm.distribution.entity.DistributionStockArticleEntity;
import com.logpm.distribution.excel.DistributionStockArticleExcel;
import com.logpm.distribution.vo.DistributionParcelListVO;
import com.logpm.distribution.vo.DistributionParcelNumberVO;
import com.logpm.distribution.vo.DistributionStockArticleVO;
import com.logpm.distribution.vo.OrderPackgeCodeDataVO;
@ -181,4 +182,7 @@ public interface IDistributionStockArticleService extends BaseService<Distributi
* @return
*/
List<DistributionStockArticleEntity> findStockArticleByCodeAndMarketAndWarehouseId(String code, String marketNames,Long warehouseId);
IPage<DistributionParcelListVO> getPackageListByStockArticleId(IPage<DistributionParcelListVO> page, Long orderId);
}

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryInfoServiceImpl.java

@ -43,6 +43,7 @@ import org.springblade.common.constant.loading.LoadingStatusConstant;
import org.springblade.common.constant.reservation.ReservationOrderStatusConstant;
import org.springblade.common.serviceConstant.ServiceConstant;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service;
@ -382,4 +383,6 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl<Distrib
}
}

311
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -62,11 +62,9 @@ import org.springblade.common.constant.loading.LoadScanSigningStatusConstant;
import org.springblade.common.constant.loading.LoadingAbnormalAuditingStatusConstant;
import org.springblade.common.constant.loading.LoadingIsInsertConstant;
import org.springblade.common.constant.loading.LoadingStatusConstant;
import org.springblade.common.constant.order.OrderReservationStatusConstant;
import org.springblade.common.constant.order.OrderStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageLoadingStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageReservationStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageStockupStatusConstant;
import org.springblade.common.constant.orderpackage.*;
import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant;
import org.springblade.common.constant.reservation.*;
import org.springblade.common.constant.stockup.StockAssignStatusConstant;
@ -147,6 +145,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
private final IWarehouseTrayTypeClient warehouseTrayTypeClient;
private final IDistributionLoadscanAbnormalService distributionLoadscanAbnormalService;
private final IDistributionReservationZeroPackageService distributionReservationZeroPackageService;
private final IDistributionParcelNumberService distributionParcelNumberService;
// private final BladeRedis redis;
@ -423,6 +422,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//异步确认包条扫描信息
// distributionAsyncService.changeOrderSignforStatus(distrilbutionloadingscanDTO.getBarcode());
AtomicInteger loadingNum = new AtomicInteger();
StringBuilder str = new StringBuilder();
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity();
if (distributionDeliveryListEntity.getKind().equals("1")) {
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectById(distrilbutionloadingscanDTO.getLoadingId());
@ -430,7 +431,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectById(distrilbutionloadingscanDTO.getLoadingId());
BeanUtils.copyProperties(distributionDeliveryTripartiteEntity, distributionDeliverySelfEntity);
}
if (distrilbutionloadingscanDTO.getType() == 1) {
List<DistributionParcelListEntity> distributionParcelListEntities = distributionDeliveryListMapper.selectPackageListByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId());
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListEntities.stream().filter(p -> Func.equals(p.getOrderPackageCode(), distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList());
@ -485,13 +485,15 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId());
stockArticleEntity.setHandQuantity(stockArticleEntity.getHandQuantity() - parcelListEntity.getQuantity());
distributionStockArticleService.updateById(stockArticleEntity);
distributionLoadscanService.save(loadscanEntity);
//查询本车次是否第一次扫码,没有则更新上车时间
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
//更新签收表的装车数量
Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
distributionLoadscanService.save(loadscanEntity);
//这里还需要一个维护状态的方法
//异步维护状态
str.append("包件装车");
loadingNum.getAndAdd(loadscanEntity.getPackageNub());
distributionAsyncService.checkLoadingByPackage(parcelListEntity, distrilbutionloadingscanDTO.getDeliveryId());
} else if (parcelListEntityList.size() == 0) {
//查找出该包件信息
@ -511,8 +513,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
&& r.getMallName().equals(stockArticleEntity.getMallName())).collect(Collectors.toList());
//查看是否存在满足条件的预约单
if (reservationEntities.size() == 1) {
return R.fail(5000, "abnormal");
// return Resp.scanFail("装车失败","程序出错,请联系张思雨");
return R.fail(5000, "异常装车");
// return Resp.scanFail("装车失败","程序出错,请联系彪桑");
} else {
return Resp.scanFail("装车失败", "窜货");
}
@ -602,8 +604,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
//更新签收表的装车数量
Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
loadingNum.getAndAdd(loadscanEntity.getPackageNub());
}
}
str.append("预约客户整托装车");
distributionLoadscanService.saveBatch(reservationLoadscanEntities);
//这里则进行整托装车的数据构建
} else {
@ -664,8 +668,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
//更新签收表的装车数量
Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
loadingNum.getAndAdd(loadscanEntity.getPackageNub());
}
}
str.append("配送计划整托装车");
distributionLoadscanService.saveBatch(deliveryLoadscanEntities);
//这里则进行整托装车的数据构建
} else {
@ -680,7 +686,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
}
}
return Resp.scanSuccess("装车成功", "装车成功");
return Resp.scanSuccess("装车成功", str.toString()+loadingNum.get()+"件");
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -2340,27 +2346,108 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
waybillNo.add(s.getWaybillNumber());
}
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity();
//现在前端进行订单提交必然会携带包件信息
List<DistributionParcelListDTO> packageListInfo = s.getPackageListInfo();
AtomicInteger orderPackageNum = new AtomicInteger();
if (!packageListInfo.isEmpty()) {
packageListInfo.forEach(p -> {
orderPackageNum.getAndAdd(p.getQuantity());
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.zhengchang.getValue());
reservationPackageEntity.setPacketBarCode(p.getOrderPackageCode());
reservationPackageEntity.setStockArticleId(s.getId());
reservationPackageEntity.setReservationId(reservationEntity.getId());
reservationPackageEntity.setParceListId(p.getId());
distributionReservationPackageService.save(reservationPackageEntity);
p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(p);
//这里根据包件进行订单状态的改变
distributionAsyncService.checkStockArticleReservationStatus(p);
});
} else {
log.error("订单包件参数有误+{" + packageListInfo + "}");
return;
if (s.getIsZero().equals(IsOrNoConstant.no.getValue())){
//现在前端进行订单提交必然会携带包件信息
List<DistributionParcelListDTO> packageListInfo = s.getPackageListInfo();
reservationStockarticleEntity.setIsZero(s.getIsZero());
if (Func.isEmpty(packageListInfo)) {
//添加该订单下可操作包件至计划中
//没有进行包件选择 默认添加可配送的所有包件
//添加订单下的所有在库订单的包件
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId())
.ne(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue())
.ne(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue())
.notIn(DistributionParcelListEntity::getOrderPackageStatus, new String[]{OrderPackageStatusConstant.yichuku.getValue(), OrderPackageStatusConstant.yiqianshou.getValue()}));
distributionParcelListEntities.forEach(dp -> {
if (!dp.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) {
if (!Func.equals(dp.getOrderPackageFreezeStatus(), OrderPackageFreezeStatusConstant.yidongjie.getValue()) && !Func.equals(dp.getOrderPackageReservationStatus(), OrderPackageReservationStatusConstant.yiyueyue.getValue())) {
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity();
distributionReservationPackageEntity.setReservationId(reservationEntity.getId());
distributionReservationPackageEntity.setParceListId(dp.getId());
distributionReservationPackageEntity.setStockArticleId(s.getId());
distributionReservationPackageEntity.setPacketBarCode(dp.getOrderPackageCode());
//维护订单下包件信息
distributionReservationPackageService.save(distributionReservationPackageEntity);
//此时订单下的所有包件都处于预约状态,可用数为0
orderPackageNum.getAndAdd(dp.getQuantity());
//修改订单下的包件状态
// p.setOrderPackageReservationStatus();
dp.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(dp);
distributionAsyncService.checkStockArticleReservationStatus(dp);
}
}
// stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
});
s.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
s.setAvailableQuantity(0);
distributionStockArticleService.updateById(s);
} else {
packageListInfo.forEach(p -> {
orderPackageNum.getAndAdd(p.getQuantity());
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.zhengchang.getValue());
reservationPackageEntity.setPacketBarCode(p.getOrderPackageCode());
reservationPackageEntity.setStockArticleId(s.getId());
reservationPackageEntity.setReservationId(reservationEntity.getId());
reservationPackageEntity.setParceListId(p.getId());
distributionReservationPackageService.save(reservationPackageEntity);
p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(p);
//这里根据包件进行订单状态的改变
distributionAsyncService.checkStockArticleReservationStatus(p);
});
}
}else if (s.getIsZero().equals(IsOrNoConstant.yes.getValue())){
List<DistributionParcelNumberVO> parcelNumberVOS = s.getParcelNumberVOS();
reservationStockarticleEntity.setIsZero(s.getIsZero());
if (Func.isNotEmpty(parcelNumberVOS)) {
//这里需要先进行是否满足
parcelNumberVOS.forEach(p -> {
if (p.getReservationNum() > 0){
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity();
distributionReservationZeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.zhengchang.getValue());
distributionReservationZeroPackageEntity.setQuantity(p.getReservationNum());
distributionReservationZeroPackageEntity.setStockArticleId(s.getId());
distributionReservationZeroPackageEntity.setReservationId(reservationEntity.getId());
distributionReservationZeroPackageEntity.setType(DistributionTypeConstant.shangpei.getValue());
distributionReservationZeroPackageEntity.setParcelListId(p.getParcelListId());
distributionReservationZeroPackageEntity.setCategoryName(p.getFirsts());
distributionReservationZeroPackageEntity.setRealityQuantity(0);
distributionReservationZeroPackageService.save(distributionReservationZeroPackageEntity);
p.setDeliveryQuantity(p.getDeliveryQuantity() + p.getReservationNum());
distributionParcelNumberService.updateById(p);
orderPackageNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
}
});
} else {
List<DistributionParcelNumberVO> list = distributionStockArticleService.getZeroOrderDetail(s.getId());
if (Func.isNotEmpty(list)) {
list.forEach(l -> {
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity();
distributionReservationZeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.zhengchang.getValue());
distributionReservationZeroPackageEntity.setQuantity(l.getHandQuantity() - l.getDeliveryQuantity() - l.getOutboundQuantity());
distributionReservationZeroPackageEntity.setStockArticleId(s.getId());
distributionReservationZeroPackageEntity.setReservationId(reservationEntity.getId());
distributionReservationZeroPackageEntity.setType(DistributionTypeConstant.shangpei.getValue());
distributionReservationZeroPackageEntity.setParcelListId(l.getParcelListId());
distributionReservationZeroPackageEntity.setCategoryName(l.getFirsts());
distributionReservationZeroPackageEntity.setRealityQuantity(0);
distributionReservationZeroPackageService.save(distributionReservationZeroPackageEntity);
l.setDeliveryQuantity(l.getDeliveryQuantity() + l.getReservationNum());
distributionParcelNumberService.updateById(l);
orderPackageNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
});
} else {
log.error("###########################零担订单查询品类错误,订单ID:{}", s.getId());
}
}
}else {
log.error("########################订单isZero字段错误,订单ID:{}",s.getId());
}
reservationStockarticleEntity.setReservationId(reservationEntity.getId());
reservationStockarticleEntity.setReservationNum(orderPackageNum.get());
@ -2394,7 +2481,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
deliveryWarehouseName.add(reservationEntity.getWarehouseName());
deliveryPackageTotal.getAndAdd(reservationEntity.getReservationNum());
//TODO 这里新增的客户还需要进行和配送任务、备货任务之间的绑定关系
//建立这个预约和配送任务之间的关系
DistributionSignforEntity distributionSignforEntity = new DistributionSignforEntity();
distributionSignforEntity.setDeliveryId(deliveryListEntityId);
@ -2406,7 +2492,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
stockupInfoEntity.setReservationId(reservationEntity.getId());
stockupInfoEntity.setStockupId(deliveryStockupInfo.getId());
distributionStockupInfoService.save(stockupInfoEntity);
} else {
//根据配送计划和运单号查询出该预约
// DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomer(deliveryListEntityId, k);
@ -2457,29 +2542,106 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
//此订单包件数量统计
AtomicInteger orderPackageNum = new AtomicInteger();
if (Func.isEmpty(oldOrder.get(s.getId()))) {
//新增订单
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity();
List<DistributionParcelListDTO> packageListInfo = s.getPackageListInfo();
if (packageListInfo.size() > 0) {
packageListInfo.forEach(p -> {
orderPackageNum.getAndAdd(p.getQuantity());
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.zhengchang.getValue());
reservationPackageEntity.setPacketBarCode(p.getOrderPackageCode());
reservationPackageEntity.setStockArticleId(s.getId());
reservationPackageEntity.setReservationId(reservationEntity.getId());
reservationPackageEntity.setParceListId(p.getId());
distributionReservationPackageService.save(reservationPackageEntity);
p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(p);
//这里根据包件进行订单状态的改变
distributionAsyncService.checkStockArticleReservationStatus(p);
});
} else {
log.error("订单包件参数有误+{" + packageListInfo + "}");
return;
if (s.getIsZero().equals(IsOrNoConstant.no.getValue())){
//新增订单
List<DistributionParcelListDTO> packageListInfo = s.getPackageListInfo();
if (Func.isNotEmpty(packageListInfo)) {
packageListInfo.forEach(p -> {
orderPackageNum.getAndAdd(p.getQuantity());
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.zhengchang.getValue());
reservationPackageEntity.setPacketBarCode(p.getOrderPackageCode());
reservationPackageEntity.setStockArticleId(s.getId());
reservationPackageEntity.setReservationId(reservationEntity.getId());
reservationPackageEntity.setParceListId(p.getId());
distributionReservationPackageService.save(reservationPackageEntity);
p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(p);
//这里根据包件进行订单状态的改变
distributionAsyncService.checkStockArticleReservationStatus(p);
});
} else {
//查询该订单下的所有包件信息并插入该计划中
//添加该订单下可操作包件至计划中
//没有进行包件选择 默认添加可配送的所有包件
//添加订单下的所有在库订单的包件
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId())
.ne(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue())
.ne(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue())
.notIn(DistributionParcelListEntity::getOrderPackageStatus, new String[]{OrderPackageStatusConstant.yichuku.getValue(), OrderPackageStatusConstant.yiqianshou.getValue()}));
distributionParcelListEntities.forEach(dp -> {
if (!dp.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) {
if (!Func.equals(dp.getOrderPackageFreezeStatus(), OrderPackageFreezeStatusConstant.yidongjie.getValue()) && !Func.equals(dp.getOrderPackageReservationStatus(), OrderPackageReservationStatusConstant.yiyueyue.getValue())) {
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity();
distributionReservationPackageEntity.setReservationId(reservationEntity.getId());
distributionReservationPackageEntity.setParceListId(dp.getId());
distributionReservationPackageEntity.setStockArticleId(s.getId());
distributionReservationPackageEntity.setPacketBarCode(dp.getOrderPackageCode());
//维护订单下包件信息
distributionReservationPackageService.save(distributionReservationPackageEntity);
//此时订单下的所有包件都处于预约状态,可用数为0
orderPackageNum.getAndAdd(dp.getQuantity());
//修改订单下的包件状态
// p.setOrderPackageReservationStatus();
dp.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(dp);
distributionAsyncService.checkStockArticleReservationStatus(dp);
}
}
// stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
});
s.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
s.setAvailableQuantity(0);
distributionStockArticleService.updateById(s);
}
}else {
//该客户下增加零担订单
List<DistributionParcelNumberVO> parcelNumberVOS = s.getParcelNumberVOS();
reservationStockarticleEntity.setIsZero(s.getIsZero());
if (Func.isNotEmpty(parcelNumberVOS)) {
//这里需要先进行是否满足
parcelNumberVOS.forEach(p -> {
if (p.getReservationNum()>0){
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity();
distributionReservationZeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.zhengchang.getValue());
distributionReservationZeroPackageEntity.setQuantity(p.getReservationNum());
distributionReservationZeroPackageEntity.setStockArticleId(s.getId());
distributionReservationZeroPackageEntity.setReservationId(reservationEntity.getId());
distributionReservationZeroPackageEntity.setType(DistributionTypeConstant.shangpei.getValue());
distributionReservationZeroPackageEntity.setParcelListId(p.getParcelListId());
distributionReservationZeroPackageEntity.setCategoryName(p.getFirsts());
distributionReservationZeroPackageEntity.setRealityQuantity(0);
distributionReservationZeroPackageService.save(distributionReservationZeroPackageEntity);
p.setDeliveryQuantity(p.getDeliveryQuantity() + p.getReservationNum());
distributionParcelNumberService.updateById(p);
orderPackageNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
}
});
} else {
List<DistributionParcelNumberVO> list = distributionStockArticleService.getZeroOrderDetail(s.getId());
if (Func.isNotEmpty(list)) {
list.forEach(l -> {
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity();
distributionReservationZeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.zhengchang.getValue());
distributionReservationZeroPackageEntity.setQuantity(l.getHandQuantity() - l.getDeliveryQuantity() - l.getOutboundQuantity());
distributionReservationZeroPackageEntity.setStockArticleId(s.getId());
distributionReservationZeroPackageEntity.setReservationId(reservationEntity.getId());
distributionReservationZeroPackageEntity.setType(DistributionTypeConstant.shangpei.getValue());
distributionReservationZeroPackageEntity.setParcelListId(l.getParcelListId());
distributionReservationZeroPackageEntity.setCategoryName(l.getFirsts());
distributionReservationZeroPackageEntity.setRealityQuantity(0);
distributionReservationZeroPackageService.save(distributionReservationZeroPackageEntity);
l.setDeliveryQuantity(l.getDeliveryQuantity() + l.getReservationNum());
distributionParcelNumberService.updateById(l);
orderPackageNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
});
} else {
log.error("###########################零担订单查询品类错误,订单ID:{}", s.getId());
}
}
}
reservationStockarticleEntity.setReservationId(reservationEntity.getId());
reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.zengjia.getValue());
@ -2530,6 +2692,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionReservationPackageService.updateById(reservationPackageEntity);
//取消包件的预约状态,并且进行整个订单的状态修改
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(reservationPackageEntity.getParceListId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue());
distributionAsyncService.checkStockArticleReservationStatus(parcelListEntity);
});
} else {
@ -3965,6 +4128,50 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
return Resp.scanSuccess("操作成功", "操作成功");
}
@Override
public R getPackageListByDeliveryIdAndOrderId(IPage<Object> page, Long deliveryId, Long orderId) {
List<DistributionParcelListVO> allPackageList =new ArrayList<>();
List<DistributionParcelListEntity> reservationPackageList = baseMapper.getPackageListByDeliveryId(deliveryId, orderId);
DistributionReservationOrderPackageVO reservationOrderPackageVO = new DistributionReservationOrderPackageVO();
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda()
.eq(DistributionParcelListEntity::getStockArticleId, orderId)
.eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue())
.notIn(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue(), OrderPackageStatusConstant.yichuku.getValue()));
if (Func.isNotEmpty(reservationPackageList)){
List<DistributionParcelListVO> parcelListVOS = DistributionParcelListWrapper.build().listVO(reservationPackageList);
allPackageList.addAll(DistributionParcelListWrapper.build().listVO(reservationPackageList));
String packageListIds = reservationPackageList.stream().map(DistributionParcelListEntity::getId).map(String::valueOf).collect(Collectors.joining(","));
reservationOrderPackageVO.setPackageListIds(packageListIds);
reservationOrderPackageVO.setReservationPackageList(parcelListVOS);
}
if (Func.isNotEmpty(parcelListEntities)){
allPackageList.addAll(DistributionParcelListWrapper.build().listVO(parcelListEntities));
}
if (Func.isEmpty(allPackageList)) {
log.error("###########################包件查询结果异常:{}", allPackageList);
return null;
}
reservationOrderPackageVO.setPackageList(allPackageList);
return R.data(reservationOrderPackageVO);
}
@Override
public List<DistributionParcelNumberVO> getDeliveryZeroOrderDetail(Long deliveryId, Long orderId) {
List<DistributionParcelNumberVO> zeroOrderDetail = distributionStockArticleService.getZeroOrderDetail(orderId);
List<DistributionParcelNumberVO> parcelNumberVOS = baseMapper.selectDeliveryZeroOrderDetail(orderId, deliveryId);
Map<Long, DistributionParcelNumberVO> reservationNum = parcelNumberVOS.stream().collect(Collectors.toMap(DistributionParcelNumberVO::getParcelListId, Function.identity(), (k1, k2) -> k2));
zeroOrderDetail.forEach(z -> {
if (Func.isNotEmpty(reservationNum.get(z.getParcelListId()))) {
z.setReservationNum(reservationNum.get(z.getParcelListId()).getReservationNum());
}
});
return zeroOrderDetail;
}
public Map<String, String> getDriverCar(String kind, Long deliveryListEntityId) {
Map<String, String> map = new HashMap<>();
String dirverName = null;

418
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

@ -1192,20 +1192,58 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
AtomicInteger packageNum = new AtomicInteger();
DistributionStockArticleDTO distributionStockArticleDTO = v.get(0);
if (distributionStockArticleDTO.getIsZero().equals(IsOrNoConstant.no.getValue())) {
List<DistributionParcelListDTO> packageListInfo = distributionStockArticleDTO.getPackageListInfo();
packageListInfo.forEach(p -> {
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setStockArticleId(distributionStockArticleDTO.getId());
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue());
reservationPackageEntity.setPacketBarCode(p.getOrderPackageCode());
reservationPackageEntity.setParceListId(p.getId());
reservationPackageEntity.setReservationId(id);
distributionReservationPackageService.save(reservationPackageEntity);
packageNum.getAndAdd(p.getQuantity());
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(p.getId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(parcelListEntity);
});
if (Func.isNotEmpty(distributionStockArticleDTO.getPackageListInfo())){
List<DistributionParcelListDTO> packageListInfo = distributionStockArticleDTO.getPackageListInfo();
packageListInfo.forEach(p -> {
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setStockArticleId(distributionStockArticleDTO.getId());
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue());
reservationPackageEntity.setPacketBarCode(p.getOrderPackageCode());
reservationPackageEntity.setParceListId(p.getId());
reservationPackageEntity.setReservationId(id);
distributionReservationPackageService.save(reservationPackageEntity);
packageNum.getAndAdd(p.getQuantity());
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(p.getId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(parcelListEntity);
distributionAsyncService.checkStockArticleReservationStatus(p);
});
}else {
//添加此订单可用所有包件数量
//添加订单下的所有在库订单的包件
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, distributionStockArticleDTO.getId())
.ne(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue())
.ne(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue())
.notIn(DistributionParcelListEntity::getOrderPackageStatus, new String[]{OrderPackageStatusConstant.yichuku.getValue(), OrderPackageStatusConstant.yiqianshou.getValue()}));
distributionParcelListEntities.forEach(dp -> {
if (!dp.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) {
if (!Func.equals(dp.getOrderPackageFreezeStatus(), OrderPackageFreezeStatusConstant.yidongjie.getValue()) && !Func.equals(dp.getOrderPackageReservationStatus(), OrderPackageReservationStatusConstant.yiyueyue.getValue())) {
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity();
distributionReservationPackageEntity.setReservationId(id);
distributionReservationPackageEntity.setParceListId(dp.getId());
distributionReservationPackageEntity.setStockArticleId(distributionStockArticleDTO.getId());
distributionReservationPackageEntity.setPacketBarCode(dp.getOrderPackageCode());
//维护订单下包件信息
distributionReservationPackageService.save(distributionReservationPackageEntity);
//此时订单下的所有包件都处于预约状态,可用数为0
packageNum.getAndAdd(dp.getQuantity());
//修改订单下的包件状态
// p.setOrderPackageReservationStatus();
dp.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(dp);
distributionAsyncService.checkStockArticleReservationStatus(dp);
}
}
// stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
});
distributionStockArticleDTO.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
distributionStockArticleDTO.setAvailableQuantity(0);
DistributionStockArticleEntity stockArticleEntity = Func.copy(distributionStockArticleDTO, DistributionStockArticleEntity.class);
distributionStockArticleService.updateById(stockArticleEntity);
}
} else {
//新增了零担订单
@ -1285,131 +1323,134 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
} else {
//查询出这个订单原来在这个预约中的勾选情况
DistributionStockArticleDTO distributionStockArticleDTO = v.get(0);
if (distributionStockArticleDTO.getIsZero().equals(IsOrNoConstant.no.getValue())) {
List<DistributionReservationPackageEntity> packageEntityList = distributionReservationPackageMapper.selectPackageByReservationAndStockArticleId(id, k);
Map<Long, List<DistributionReservationPackageEntity>> oldPackage = packageEntityList.stream().collect(Collectors.groupingBy(DistributionReservationPackageEntity::getParceListId));
Map<Long, List<DistributionParcelListEntity>> newPackage = distributionStockArticleDTO.getPackageListInfo().stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getId));
AtomicInteger packageNum = new AtomicInteger();
AtomicInteger reduceNum = new AtomicInteger();
newPackage.forEach((m, n) -> {
if (Func.isEmpty(oldPackage.get(m))) {
DistributionParcelListEntity distributionParcelListEntity = n.get(0);
//新增
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setStockArticleId(distributionStockArticleDTO.getId());
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue());
reservationPackageEntity.setPacketBarCode(distributionParcelListEntity.getOrderPackageCode());
reservationPackageEntity.setParceListId(distributionParcelListEntity.getId());
reservationPackageEntity.setReservationId(id);
distributionReservationPackageService.save(reservationPackageEntity);
packageNum.getAndAdd(distributionParcelListEntity.getQuantity());
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(distributionParcelListEntity.getId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
if (Func.isNotEmpty(distributionStockArticleDTO.getPackageListInfo())) {
if (distributionStockArticleDTO.getIsZero().equals(IsOrNoConstant.no.getValue())) {
List<DistributionReservationPackageEntity> packageEntityList = distributionReservationPackageMapper.selectPackageByReservationAndStockArticleId(id, k);
Map<Long, List<DistributionReservationPackageEntity>> oldPackage = packageEntityList.stream().collect(Collectors.groupingBy(DistributionReservationPackageEntity::getParceListId));
Map<Long, List<DistributionParcelListEntity>> newPackage = distributionStockArticleDTO.getPackageListInfo().stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getId));
AtomicInteger packageNum = new AtomicInteger();
AtomicInteger reduceNum = new AtomicInteger();
newPackage.forEach((m, n) -> {
if (Func.isEmpty(oldPackage.get(m))) {
DistributionParcelListEntity distributionParcelListEntity = n.get(0);
//新增
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setStockArticleId(distributionStockArticleDTO.getId());
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue());
reservationPackageEntity.setPacketBarCode(distributionParcelListEntity.getOrderPackageCode());
reservationPackageEntity.setParceListId(distributionParcelListEntity.getId());
reservationPackageEntity.setReservationId(id);
distributionReservationPackageService.save(reservationPackageEntity);
packageNum.getAndAdd(distributionParcelListEntity.getQuantity());
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(distributionParcelListEntity.getId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(parcelListEntity);
} else {
oldPackage.remove(m);
//移除
}
});
//移除包件进行取消
oldPackage.forEach((o, p) -> {
DistributionReservationPackageEntity reservationPackageEntity = p.get(0);
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue());
distributionReservationPackageService.updateById(reservationPackageEntity);
//统计减少包件数量
reduceNum.getAndAdd(distributionParcelListService.getById(reservationPackageEntity.getParceListId()).getQuantity());
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(reservationPackageEntity.getParceListId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue());
distributionParcelListService.updateById(parcelListEntity);
} else {
oldPackage.remove(m);
//移除
}
});
//移除包件进行取消
oldPackage.forEach((o, p) -> {
DistributionReservationPackageEntity reservationPackageEntity = p.get(0);
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.quxiao.getValue());
distributionReservationPackageService.updateById(reservationPackageEntity);
//统计减少包件数量
reduceNum.getAndAdd(distributionParcelListService.getById(reservationPackageEntity.getParceListId()).getQuantity());
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(reservationPackageEntity.getParceListId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue());
distributionParcelListService.updateById(parcelListEntity);
});
//对存在订单进行维护
DistributionReservationStockarticleEntity reservationStockarticleEntity = oldStockArticle.get(k).get(0);
Integer reservationNum = reservationStockarticleEntity.getReservationNum();
reservationStockarticleEntity.setReservationNum(reservationNum + packageNum.get() - reduceNum.get());
distributionReservationStockarticleService.updateById(reservationStockarticleEntity);
packTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
});
//对存在订单进行维护
DistributionReservationStockarticleEntity reservationStockarticleEntity = oldStockArticle.get(k).get(0);
Integer reservationNum = reservationStockarticleEntity.getReservationNum();
reservationStockarticleEntity.setReservationNum(reservationNum + packageNum.get() - reduceNum.get());
distributionReservationStockarticleService.updateById(reservationStockarticleEntity);
packTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
// oldStockArticle.remove(k);
distributionAsyncService.changeOrderReservationStatus(distributionStockArticleDTO);
oldStockArticle.remove(k);
} else {
//零担订单出现编辑操作,这里对于零担订单发生编辑操作一定会存在有录入数量的操作
List<DistributionParcelNumberVO> parcelNumberVOS = distributionStockArticleDTO.getParcelNumberVOS();
List<DistributionReservationZeroPackageEntity> reservationZeroPackageEntityList = distributionReservationZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda()
.eq(DistributionReservationZeroPackageEntity::getReservationId, id)
.eq(DistributionReservationZeroPackageEntity::getStockArticleId, distributionStockArticleDTO.getId())
.ne(DistributionReservationZeroPackageEntity::getZeroPackageStatus, "2"));
Map<Long, List<DistributionReservationZeroPackageEntity>> oldZeroPackage = reservationZeroPackageEntityList.stream().collect(Collectors.groupingBy(DistributionReservationZeroPackageEntity::getParcelListId));
if (Func.isEmpty(reservationZeroPackageEntityList)) {
log.error("#############零担订单预约信息数据错误:{}", distributionStockArticleDTO);
}
AtomicInteger zeroPrderNum = new AtomicInteger();
parcelNumberVOS.forEach(p -> {
List<DistributionReservationZeroPackageEntity> distributionReservationZeroPackageEntities = oldZeroPackage.get(p.getParcelListId());
if (Func.isNotEmpty(distributionReservationZeroPackageEntities)) {
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = distributionReservationZeroPackageEntities.get(0);
Integer quantity = distributionReservationZeroPackageEntity.getQuantity();
if (p.getReservationNum() == 0) {
distributionReservationZeroPackageEntity.setQuantity(0);
distributionReservationZeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.quxiao.getValue());
distributionReservationZeroPackageService.updateById(distributionReservationZeroPackageEntity);
DistributionParcelNumberEntity parcelNumberEntity = distributionParcelNumberService.getOne(Wrappers.<DistributionParcelNumberEntity>query().lambda()
.eq(DistributionParcelNumberEntity::getParcelListId, distributionReservationZeroPackageEntity.getParcelListId()));
parcelNumberEntity.setDeliveryQuantity(parcelNumberEntity.getDeliveryQuantity() - quantity);
distributionParcelNumberService.updateById(parcelNumberEntity);
} else if (p.getReservationNum() != quantity) {
distributionReservationZeroPackageEntity.setQuantity(p.getReservationNum());
distributionReservationZeroPackageService.updateById(distributionReservationZeroPackageEntity);
//进行修改操作
distributionAsyncService.changeOrderReservationStatus(distributionStockArticleDTO);
oldStockArticle.remove(k);
} else {
//零担订单出现编辑操作,这里对于零担订单发生编辑操作一定会存在有录入数量的操作
List<DistributionParcelNumberVO> parcelNumberVOS = distributionStockArticleDTO.getParcelNumberVOS();
List<DistributionReservationZeroPackageEntity> reservationZeroPackageEntityList = distributionReservationZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda()
.eq(DistributionReservationZeroPackageEntity::getReservationId, id)
.eq(DistributionReservationZeroPackageEntity::getStockArticleId, distributionStockArticleDTO.getId())
.ne(DistributionReservationZeroPackageEntity::getZeroPackageStatus, "2"));
Map<Long, List<DistributionReservationZeroPackageEntity>> oldZeroPackage = reservationZeroPackageEntityList.stream().collect(Collectors.groupingBy(DistributionReservationZeroPackageEntity::getParcelListId));
if (Func.isEmpty(reservationZeroPackageEntityList)) {
log.error("#############零担订单预约信息数据错误:{}", distributionStockArticleDTO);
}
AtomicInteger zeroPrderNum = new AtomicInteger();
parcelNumberVOS.forEach(p -> {
List<DistributionReservationZeroPackageEntity> distributionReservationZeroPackageEntities = oldZeroPackage.get(p.getParcelListId());
if (Func.isNotEmpty(distributionReservationZeroPackageEntities)) {
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = distributionReservationZeroPackageEntities.get(0);
Integer quantity = distributionReservationZeroPackageEntity.getQuantity();
if (p.getReservationNum() == 0) {
distributionReservationZeroPackageEntity.setQuantity(0);
distributionReservationZeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.quxiao.getValue());
distributionReservationZeroPackageService.updateById(distributionReservationZeroPackageEntity);
DistributionParcelNumberEntity parcelNumberEntity = distributionParcelNumberService.getOne(Wrappers.<DistributionParcelNumberEntity>query().lambda()
.eq(DistributionParcelNumberEntity::getParcelListId, distributionReservationZeroPackageEntity.getParcelListId()));
parcelNumberEntity.setDeliveryQuantity(parcelNumberEntity.getDeliveryQuantity() - quantity);
distributionParcelNumberService.updateById(parcelNumberEntity);
} else if (p.getReservationNum() != quantity) {
distributionReservationZeroPackageEntity.setQuantity(p.getReservationNum());
distributionReservationZeroPackageService.updateById(distributionReservationZeroPackageEntity);
//进行修改操作
DistributionParcelNumberEntity parcelNumberEntity = distributionParcelNumberService.getOne(Wrappers.<DistributionParcelNumberEntity>query().lambda()
.eq(DistributionParcelNumberEntity::getParcelListId, distributionReservationZeroPackageEntity.getParcelListId()));
parcelNumberEntity.setDeliveryQuantity(parcelNumberEntity.getDeliveryQuantity() - quantity + p.getReservationNum());
distributionParcelNumberService.updateById(parcelNumberEntity);
}
zeroPrderNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
} else {
//这里就是新增
DistributionReservationZeroPackageEntity zeroPackageEntity = new DistributionReservationZeroPackageEntity();
zeroPackageEntity.setParcelListId(p.getParcelListId());
zeroPackageEntity.setCategoryName(p.getFirsts());
zeroPackageEntity.setQuantity(p.getReservationNum());
zeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.zengjia.getValue());
zeroPackageEntity.setType(DistributionTypeConstant.shipie.getValue());
zeroPackageEntity.setReservationId(id);
zeroPackageEntity.setStockArticleId(distributionStockArticleDTO.getId());
distributionReservationZeroPackageService.save(zeroPackageEntity);
DistributionReservationStockarticleEntity reservationStockarticleEntity = distributionReservationStockarticleService.getOne(Wrappers.<DistributionReservationStockarticleEntity>query().lambda()
.eq(DistributionReservationStockarticleEntity::getReservationId, id)
.eq(DistributionReservationStockarticleEntity::getStockArticleId, distributionStockArticleDTO.getId())
.ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue()));
reservationStockarticleEntity.setReservationNum(reservationStockarticleEntity.getReservationNum() + zeroPackageEntity.getQuantity());
distributionReservationStockarticleService.updateById(reservationStockarticleEntity);
//维护具体的零担订单品类数量
DistributionParcelNumberEntity parcelNumberEntity = distributionParcelNumberService.getOne(Wrappers.<DistributionParcelNumberEntity>query().lambda()
.eq(DistributionParcelNumberEntity::getParcelListId, distributionReservationZeroPackageEntity.getParcelListId()));
parcelNumberEntity.setDeliveryQuantity(parcelNumberEntity.getDeliveryQuantity() - quantity + p.getReservationNum());
.eq(DistributionParcelNumberEntity::getParcelListId, p.getParcelListId()));
parcelNumberEntity.setDeliveryQuantity(parcelNumberEntity.getDeliveryQuantity() + zeroPackageEntity.getQuantity());
distributionParcelNumberService.updateById(parcelNumberEntity);
}
zeroPrderNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
} else {
//这里就是新增
DistributionReservationZeroPackageEntity zeroPackageEntity = new DistributionReservationZeroPackageEntity();
zeroPackageEntity.setParcelListId(p.getParcelListId());
zeroPackageEntity.setCategoryName(p.getFirsts());
zeroPackageEntity.setQuantity(p.getReservationNum());
zeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.zengjia.getValue());
zeroPackageEntity.setType(DistributionTypeConstant.shipie.getValue());
zeroPackageEntity.setReservationId(id);
zeroPackageEntity.setStockArticleId(distributionStockArticleDTO.getId());
distributionReservationZeroPackageService.save(zeroPackageEntity);
DistributionReservationStockarticleEntity reservationStockarticleEntity = distributionReservationStockarticleService.getOne(Wrappers.<DistributionReservationStockarticleEntity>query().lambda()
.eq(DistributionReservationStockarticleEntity::getReservationId, id)
.eq(DistributionReservationStockarticleEntity::getStockArticleId, distributionStockArticleDTO.getId())
.ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue()));
reservationStockarticleEntity.setReservationNum(reservationStockarticleEntity.getReservationNum() + zeroPackageEntity.getQuantity());
distributionReservationStockarticleService.updateById(reservationStockarticleEntity);
//维护具体的零担订单品类数量
DistributionParcelNumberEntity parcelNumberEntity = distributionParcelNumberService.getOne(Wrappers.<DistributionParcelNumberEntity>query().lambda()
.eq(DistributionParcelNumberEntity::getParcelListId, p.getParcelListId()));
parcelNumberEntity.setDeliveryQuantity(parcelNumberEntity.getDeliveryQuantity() + zeroPackageEntity.getQuantity());
distributionParcelNumberService.updateById(parcelNumberEntity);
zeroPrderNum.getAndAdd(zeroPackageEntity.getQuantity());
zeroPrderNum.getAndAdd(zeroPackageEntity.getQuantity());
}
//考虑情况:1、数量发生修改 2、数量修改为0表示取消该零担订单对应的品类 3、该零担订单新增品类
//该零担订单原有的品类信息
});
DistributionReservationStockarticleEntity reservationStockarticleEntity = oldStockArticle.get(k).get(0);
reservationStockarticleEntity.setReservationNum(zeroPrderNum.get());
distributionReservationStockarticleService.updateById(reservationStockarticleEntity);
packTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
}
//考虑情况:1、数量发生修改 2、数量修改为0表示取消该零担订单对应的品类 3、该零担订单新增品类
//该零担订单原有的品类信息
});
DistributionReservationStockarticleEntity reservationStockarticleEntity = oldStockArticle.get(k).get(0);
reservationStockarticleEntity.setReservationNum(zeroPrderNum.get());
distributionReservationStockarticleService.updateById(reservationStockarticleEntity);
packTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
// oldStockArticle.remove(k);
distributionAsyncService.changeOrderReservationStatus(distributionStockArticleDTO);
oldStockArticle.remove(k);
}
warehouseNames.add(distributionStockArticleDTO.getWarehouse());
mallName.add(distributionStockArticleDTO.getMallName());
storeName.add(distributionStockArticleDTO.getStoreName());
receivingUnit.add(distributionStockArticleDTO.getConsigneeUnit());
distributionAsyncService.changeOrderReservationStatus(distributionStockArticleDTO);
oldStockArticle.remove(k);
}
warehouseNames.add(distributionStockArticleDTO.getWarehouse());
mallName.add(distributionStockArticleDTO.getMallName());
storeName.add(distributionStockArticleDTO.getStoreName());
receivingUnit.add(distributionStockArticleDTO.getConsigneeUnit());
// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(distributionStockArticleDTO.getId());
// stockArticleEntity.setReservationStatus(status);
// distributionStockArticleService.updateById(stockArticleEntity);
}
}
});
@ -1427,7 +1468,6 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.daiyuyue.getValue());
distributionParcelListService.updateById(parcelListEntity);
});
} else {
//订单零担移除
List<DistributionReservationZeroPackageEntity> reservationZeroPackageEntities = distributionReservationZeroPackageService.list(Wrappers.<DistributionReservationZeroPackageEntity>query().lambda()
@ -1784,8 +1824,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
AtomicInteger reservationOrderNum = new AtomicInteger();
if (s.getIsZero().equals(IsOrNoConstant.no.getValue())) {
//现在前端进行订单提交必然会携带包件信息
List<DistributionParcelListDTO> packageListInfo = s.getPackageListInfo();
if (packageListInfo.size() > 0) {
if (Func.isNotEmpty(s.getPackageListInfo())){
List<DistributionParcelListDTO> packageListInfo = s.getPackageListInfo();
packageListInfo.forEach(p -> {
reservationOrderNum.getAndAdd(p.getQuantity());
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
@ -1800,11 +1840,40 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//这里根据包件进行订单状态的改变
distributionAsyncService.checkStockArticleReservationStatus(p);
});
} else {
log.error("订单包件参数有误+{" + packageListInfo + "}");
return;
}
}else {
//没有进行包件选择 默认添加可配送的所有包件
//添加订单下的所有在库订单的包件
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId())
.ne(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue())
.ne(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue())
.notIn(DistributionParcelListEntity::getOrderPackageStatus, new String[]{OrderPackageStatusConstant.yichuku.getValue(), OrderPackageStatusConstant.yiqianshou.getValue()}));
distributionParcelListEntities.forEach(dp -> {
if (!dp.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) {
if (!Func.equals(dp.getOrderPackageFreezeStatus(), OrderPackageFreezeStatusConstant.yidongjie.getValue()) && !Func.equals(dp.getOrderPackageReservationStatus(), OrderPackageReservationStatusConstant.yiyueyue.getValue())) {
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity();
distributionReservationPackageEntity.setReservationId(reservationEntity.getId());
distributionReservationPackageEntity.setParceListId(dp.getId());
distributionReservationPackageEntity.setStockArticleId(s.getId());
distributionReservationPackageEntity.setPacketBarCode(dp.getOrderPackageCode());
//维护订单下包件信息
distributionReservationPackageService.save(distributionReservationPackageEntity);
//此时订单下的所有包件都处于预约状态,可用数为0
reservationOrderNum.getAndAdd(dp.getQuantity());
//修改订单下的包件状态
// p.setOrderPackageReservationStatus();
dp.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(dp);
distributionAsyncService.checkStockArticleReservationStatus(dp);
}
}
// stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
});
s.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
s.setAvailableQuantity(0);
distributionStockArticleService.updateById(s);
}
} else {
//-----------------------------------------------------------2023-10-11--- 零担商配处理-----------------------------------------------------------------------
List<DistributionParcelNumberVO> parcelNumberVOS = s.getParcelNumberVOS();
@ -1813,7 +1882,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
parcelNumberVOS.forEach(p -> {
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity();
distributionReservationZeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.zhengchang.getValue());
distributionReservationZeroPackageEntity.setQuantity(p.getHandQuantity() - p.getDeliveryQuantity() - p.getOutboundQuantity());
distributionReservationZeroPackageEntity.setQuantity(p.getReservationNum());
distributionReservationZeroPackageEntity.setStockArticleId(s.getId());
distributionReservationZeroPackageEntity.setReservationId(reservationEntity.getId());
distributionReservationZeroPackageEntity.setType(DistributionTypeConstant.shangpei.getValue());
@ -1953,6 +2022,12 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
});
distributionDeliveryListEntity.setDistributionCompany("汇通");
distributionDeliveryListEntity.setKind(ServiceConstant.DELIVERLIST_KIND_SELF);
if (Func.isEmpty(driverNames)){
return R.fail("请选择配送人员信息!!!");
}
if (Func.isEmpty(vehicleNubs)){
return R.fail("请选择配送人员信息!!!");
}
distributionDeliveryListEntity.setDriverName(driverNames.deleteCharAt(driverNames.length() - 1).toString());
distributionDeliveryListEntity.setVehicleName(vehicleNubs.deleteCharAt(vehicleNubs.length() - 1).toString());
}
@ -2653,22 +2728,24 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
.ne(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue())
.ne(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue())
.notIn(DistributionParcelListEntity::getOrderPackageStatus, new String[]{OrderPackageStatusConstant.yichuku.getValue(), OrderPackageStatusConstant.yiqianshou.getValue()}));
distributionParcelListEntities.forEach(p -> {
if (p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) {
if (!Func.equals(p.getOrderPackageFreezeStatus(), OrderPackageFreezeStatusConstant.yidongjie.getValue()) && !Func.equals(p.getOrderPackageReservationStatus(), OrderPackageReservationStatusConstant.yiyueyue.getValue())) {
distributionParcelListEntities.forEach(dp -> {
if (!dp.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) {
if (!Func.equals(dp.getOrderPackageFreezeStatus(), OrderPackageFreezeStatusConstant.yidongjie.getValue()) && !Func.equals(dp.getOrderPackageReservationStatus(), OrderPackageReservationStatusConstant.yiyueyue.getValue())) {
DistributionReservationPackageEntity distributionReservationPackageEntity = new DistributionReservationPackageEntity();
distributionReservationPackageEntity.setReservationId(reservationId);
distributionReservationPackageEntity.setParceListId(p.getId());
distributionReservationPackageEntity.setParceListId(dp.getId());
distributionReservationPackageEntity.setStockArticleId(s.getId());
distributionReservationPackageEntity.setPacketBarCode(p.getOrderPackageCode());
distributionReservationPackageEntity.setPacketBarCode(dp.getOrderPackageCode());
//维护订单下包件信息
distributionReservationPackageService.save(distributionReservationPackageEntity);
//此时订单下的所有包件都处于预约状态,可用数为0
packageNum.getAndAdd(p.getQuantity());
packageNum.getAndAdd(dp.getQuantity());
//修改订单下的包件状态
// p.setOrderPackageReservationStatus();
p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(p);
dp.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(dp);
distributionAsyncService.checkStockArticleReservationStatus(dp);
}
}
@ -2676,6 +2753,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
});
s.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
s.setAvailableQuantity(0);
distributionStockArticleService.updateById(s);
} else {
//维护选中的包件信息
packageList.forEach(p -> {
@ -2691,6 +2770,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
p.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
// p.setBrandId(p.getBrandId());
distributionParcelListService.updateById(p);
distributionAsyncService.checkStockArticleReservationStatus(p);
}
}
});
@ -2698,17 +2779,16 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//设置订单可用数量为
// s.setAvailableQuantity(s.getHandQuantity() - s.getReservationNum());
//这里查询到当前订单下的包件信息和选中包件进行比对,如果数量一致那么说明该订单是已预约状态、否则为部分预约状态
LambdaQueryWrapper<DistributionParcelListEntity> qw = new QueryWrapper<DistributionParcelListEntity>().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId());
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.getBaseMapper().selectList(qw);
if (packageList.size() == parcelListEntities.size()) {
//这里就是表示进行了包件选取的操作,但是选取的包件数量为全部
s.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
} else {
s.setReservationStatus(OrderReservationStatusConstant.bufenyuyue.getValue());
}
// LambdaQueryWrapper<DistributionParcelListEntity> qw = new QueryWrapper<DistributionParcelListEntity>().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId());
// List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.getBaseMapper().selectList(qw);
// if (packageList.size() == parcelListEntities.size()) {
// //这里就是表示进行了包件选取的操作,但是选取的包件数量为全部
// s.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
// } else {
// s.setReservationStatus(OrderReservationStatusConstant.bufenyuyue.getValue());
// }
}
distributionReservationStockarticleEntity.setReservationNum(packageNum.get());
distributionStockArticleService.updateById(s);
Long stockArticleId = s.getId();
distributionReservationStockarticleEntity.setReservationId(reservationId);
distributionReservationStockarticleEntity.setIsZero(s.getIsZero());
@ -2943,4 +3023,34 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
});
return zeroOrderDetail;
}
@Override
public R getReservationPackageListByOrderId(Long orderId, Long reservationId, IPage<DistributionReservationOrderPackageVO> page) {
List<DistributionParcelListVO> allPackageList = new ArrayList<>();
List<DistributionReservationPackageEntity> reservationPackageEntityList = distributionReservationPackageService.list(Wrappers.<DistributionReservationPackageEntity>query().lambda().eq(DistributionReservationPackageEntity::getReservationId, reservationId).eq(DistributionReservationPackageEntity::getStockArticleId, orderId).ne(DistributionReservationPackageEntity::getPacketBarStatus, ReservationPackageStatusConstant.quxiao.getValue()));
DistributionReservationOrderPackageVO reservationOrderPackageVO = new DistributionReservationOrderPackageVO();
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, orderId)
.eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue())
.notIn(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue(), OrderPackageStatusConstant.yichuku.getValue()));
if (Func.isNotEmpty(reservationPackageEntityList)){
List<Long> packageIds = reservationPackageEntityList.stream().map(DistributionReservationPackageEntity::getParceListId).collect(Collectors.toList());
List<DistributionParcelListEntity> reservationPackageList = distributionParcelListService.listByIds(packageIds);
String packageListIds = reservationPackageEntityList.stream().map(DistributionReservationPackageEntity::getParceListId).map(String::valueOf).collect(Collectors.joining(","));
List<DistributionParcelListVO> parcelListVOS = DistributionParcelListWrapper.build().listVO(reservationPackageList);
allPackageList.addAll(parcelListVOS);
reservationOrderPackageVO.setReservationPackageList(parcelListVOS);
reservationOrderPackageVO.setPackageListIds(packageListIds);
}
if (Func.isNotEmpty(parcelListEntities)){
allPackageList.addAll(DistributionParcelListWrapper.build().listVO(parcelListEntities));
}
if (Func.isEmpty(allPackageList)) {
log.error("###########################包件查询结果异常:{}", allPackageList);
return null;
}
reservationOrderPackageVO.setPackageList(allPackageList);
return R.data(reservationOrderPackageVO);
}
}

15
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -48,6 +48,8 @@ import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.order.OrderStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageGroundingStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageReservationStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageStatusConstant;
import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant;
import org.springblade.common.utils.CommonUtil;
import org.springblade.common.utils.FileUtil;
@ -977,9 +979,9 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
List<DistributionStockArticleVO> stockArticleVOS = DistributionStockArticleWrapper.build().listVO(stockArticleEntityList.getRecords());
// List<DistributionStockArticleVO> stockArticleVOS = DistributionStockArticleWrapper.build().listVO(stockArticleEntityList);
IPage<DistributionStockArticleVO> distributionStockArticleEntityIPage = page.setRecords(stockArticleVOS);
IPage<DistributionStockArticleVO> distributionStockArticleVOIPage = this.handlePackage(distributionStockArticleEntityIPage);
// IPage<DistributionStockArticleVO> distributionStockArticleVOIPage = this.handlePackage(distributionStockArticleEntityIPage);
// distributionStockArticleVOIPage.setTotal(stockArticleEntityList.size());
return distributionStockArticleVOIPage;
return distributionStockArticleEntityIPage;
}
/**
@ -1102,6 +1104,15 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
return this.list(lambda);
}
@Override
public IPage<DistributionParcelListVO> getPackageListByStockArticleId(IPage<DistributionParcelListVO> page, Long orderId) {
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, orderId)
.eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue())
.notIn(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue(), OrderPackageStatusConstant.yichuku.getValue()));
List<DistributionParcelListVO> parcelListVOS = DistributionParcelListWrapper.build().listVO(parcelListEntityList);
return page.setRecords(parcelListVOS);
}
@Override
public DistributionStockArticleEntity findZeroByOrderCodeAndWarehouseId(String orderCode, Long warehouseId) {

8
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/TaskQuestServiceImpl.java

@ -246,7 +246,7 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
if (Func.isNotEmpty(questDetailEntities)){
Map<String, List<QuestDetailEntity>> orderMap = questDetailEntities.stream().collect(Collectors.groupingBy(QuestDetailEntity::getOrderCode));
orderMap.forEach((k,v)->{
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(k,taskSearchDTO.getWarehouseId());
// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(k,taskSearchDTO.getWarehouseId());
List<QuestDetailEntity> detailEntities = orderMap.get(k);
TaskContractVO taskContractVO = new TaskContractVO();
taskContractVO.setIsInventory(0);
@ -1436,12 +1436,14 @@ public class TaskQuestServiceImpl extends BaseServiceImpl<TaskQuestMapper, TaskQ
.eq(TaskQuestChildEntity::getRefType, 1));
List<DistributionStockArticleEntity> stockArticleEntity = null;
List<String> marketNames = null;
if (Func.isEmpty(taskQuestId)) {
if (Func.isNotEmpty(taskQuestChildEntityList)){
marketNames = taskQuestChildEntityList.stream().map(TaskQuestChildEntity::getRefName).collect(Collectors.toList());
}
if (Func.isEmpty(marketNames)) {
//全仓盘点
stockArticleEntity = distributionStockArticleClient.findStockArticleByCodeAndMarketAndWarehouseId(incomingBatch,"", taskSearchDTO.getWarehouseId());
} else {
if (Func.isNotEmpty(taskQuestChildEntityList)) {
marketNames = taskQuestChildEntityList.stream().map(TaskQuestChildEntity::getRefName).collect(Collectors.toList());
stockArticleEntity = distributionStockArticleClient.findStockArticleByCodeAndMarketAndWarehouseId(taskSearchDTO.getIncomingBatch(), String.join(",",marketNames), taskSearchDTO.getWarehouseId());
} else {
log.error("###################盘点任务查询失败");

Loading…
Cancel
Save