Browse Source

Merge remote-tracking branch 'origin/dev' into dev

training
caoyizhong 1 year ago
parent
commit
ef987d7de8
  1. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionSignforMapper.xml
  2. 48
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java
  3. 51
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  4. 289
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  5. 59
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  6. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

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

@ -543,7 +543,8 @@
SELECT SELECT
ldr.id id, ldr.id id,
ldr.consignee consignee, ldr.consignee consignee,
ldr.reservation_num reservationNum, ldr.reservation_num,
ldr.reservation_stock_list_num,
lds.driver_signing driverSigning, lds.driver_signing driverSigning,
lds.Signing_status SigningStatus, lds.Signing_status SigningStatus,
lds.loaded_number loadingNub, lds.loaded_number loadingNub,
@ -552,8 +553,9 @@
ldr.is_urgent isUrgent, ldr.is_urgent isUrgent,
ldr.remarks, ldr.remarks,
CASE WHEN lds.positioning IS NOT NULL THEN true ELSE false END AS positioning, CASE WHEN lds.positioning IS NOT NULL THEN true ELSE false END AS positioning,
(SELECT COALESCE(COUNT(*), 0) from logpm_distribution_reservation_stockarticle ldrs WHERE ldrs.reservation_id =ldr.id ) ordNub, (SELECT COALESCE(COUNT(*), 0) from logpm_distribution_reservation_stockarticle ldrs WHERE ldrs.reservation_id =ldr.id ) ordNub,
COALESCE(lds.received_quantity + lds.receivedin_quantity, 0) signNub COALESCE(lds.received_quantity + lds.receivedin_quantity, 0) signNub,
COALESCE(ldr.reservation_num + ldr.reservation_stock_list_num, 0) reservationNum
FROM FROM
logpm_distribution_signfor lds logpm_distribution_signfor lds
JOIN logpm_distribution_reservation ldr ON ldr.id = lds.reservation_id JOIN logpm_distribution_reservation ldr ON ldr.id = lds.reservation_id

48
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java

@ -389,7 +389,7 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
distributionAddvalueDetailMapper.deleteAddvalueDetail(distributionAddvalueEntity.getId()); distributionAddvalueDetailMapper.deleteAddvalueDetail(distributionAddvalueEntity.getId());
distributionAddvaluePackageMapper.deleteAddvaluePackageList(distributionAppAddvalueDTO.getReservationId(), addvalueDetailEntity.getId()); distributionAddvaluePackageMapper.deleteAddvaluePackageList(distributionAppAddvalueDTO.getReservationId(), addvalueDetailEntity.getId());
} else { } else {
// 查询出原来的包件信息 //查询出原来的包件信息
DistributionAddvalueVO addvalueVO = distributionAddvalueMapper.selectReservationAddvalue(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType()); DistributionAddvalueVO addvalueVO = distributionAddvalueMapper.selectReservationAddvalue(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType());
String packageListIds = addvalueVO.getPackageListIds(); String packageListIds = addvalueVO.getPackageListIds();
if (Func.isNotEmpty(packageListIds)) { if (Func.isNotEmpty(packageListIds)) {
@ -397,14 +397,50 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
.in(DistributionAddvaluePackageEntity::getPackageId,Func.toLongList(packageListIds)) .in(DistributionAddvaluePackageEntity::getPackageId,Func.toLongList(packageListIds))
.eq(DistributionAddvaluePackageEntity::getAddvalueDetailId,distributionAppAddvalueDTO.getAddvalueDetailId())); .eq(DistributionAddvaluePackageEntity::getAddvalueDetailId,distributionAppAddvalueDTO.getAddvalueDetailId()));
Map<Long, List<DistributionAddvaluePackageEntity>> oldPackageList = distributionAddvaluePackageEntities.stream().collect(Collectors.groupingBy(DistributionAddvaluePackageEntity::getPackageId)); Map<Long, List<DistributionAddvaluePackageEntity>> oldPackageList = distributionAddvaluePackageEntities.stream().collect(Collectors.groupingBy(DistributionAddvaluePackageEntity::getPackageId));
Map<Long, List<DistributionAddvaluePackageEntity>> newPackageList = packageEntityList.stream().collect(Collectors.groupingBy(DistributionAddvaluePackageEntity::getPackageId)); Map<Long, List<DistributionAddvaluePackageDTO>> newPackageList = packageEntityList.stream().collect(Collectors.groupingBy(DistributionAddvaluePackageEntity::getPackageId));
newPackageList.forEach((k, v) -> { newPackageList.forEach((k, v) -> {
DistributionAddvaluePackageDTO distributionAddvaluePackageEntity = v.get(0);
if (Func.isEmpty(oldPackageList.get(k))) { if (Func.isEmpty(oldPackageList.get(k))) {
//从老的包件中无法进行获取,这里进行包件的新增 //从老的包件中无法进行获取,这里进行包件的新增
DistributionAddvaluePackageEntity distributionAddvaluePackageEntity = v.get(0); DistributionAddvaluePackageEntity addvaluePackageEntity = new DistributionAddvaluePackageEntity();
distributionAddvaluePackageEntity.setAddvalueDetailId(distributionAddvaluePackageEntities.get(0).getAddvalueDetailId()); addvaluePackageEntity.setQuantity(distributionAddvaluePackageEntity.getZeroQuantity());
distributionAddvaluePackageService.save(distributionAddvaluePackageEntity); addvaluePackageEntity.setAddvalueDetailId(distributionAddvaluePackageEntity.getAddvalueDetailId());
addvaluePackageEntity.setStockArticleId(distributionAddvaluePackageEntity.getStockArticleId());
addvaluePackageEntity.setMaterialName(distributionAddvaluePackageEntity.getMaterialName());
addvaluePackageEntity.setPackageId(distributionAddvaluePackageEntity.getPackageId());
addvaluePackageEntity.setReservationId(distributionAddvaluePackageEntity.getReservationId());
if (distributionAddvaluePackageEntity.getConditions() == 3){
addvaluePackageEntity.setConditions(3);
addvaluePackageEntity.setRecordType("3");
distributionAddvaluePackageService.save(addvaluePackageEntity);
}else if (distributionAddvaluePackageEntity.getConditions() == 1){
//新增订制品
addvaluePackageEntity.setOrderPackageCode(distributionAddvaluePackageEntity.getOrderPackageCode());
addvaluePackageEntity.setRecordType("1");
addvaluePackageEntity.setConditions(1);
}else {
//新增库存品
addvaluePackageEntity.setOrderPackageCode(distributionAddvaluePackageEntity.getOrderPackageCode());
addvaluePackageEntity.setRecordType("2");
addvaluePackageEntity.setConditions(2);
}
// distributionAddvaluePackageEntity.setAddvalueDetailId(distributionAddvaluePackageEntities.get(0).getAddvalueDetailId());
distributionAddvaluePackageService.save(addvaluePackageEntity);
} else { } else {
if (distributionAddvaluePackageEntity.getConditions() == 3){
if (distributionAddvaluePackageEntity.getZeroQuantity() != 0){
if (distributionAddvaluePackageEntity.getZeroQuantity() > 0){
distributionAddvaluePackageEntity.setQuantity(distributionAddvaluePackageEntity.getZeroQuantity());
distributionAddvaluePackageService.updateById(distributionAddvaluePackageEntity);
}else {
log.error("###############零担品类录入数量有误:{}",distributionAddvaluePackageEntity.getZeroQuantity());
}
}else {
//删除对应的包件信息
distributionAddvaluePackageMapper.deleteAddvaluePackage(distributionAddvaluePackageEntity.getReservationId(),distributionAddvaluePackageEntity.getPackageId());
}
}
//存在零担需要进行比对是否发生变化
//存在不进行维护 //存在不进行维护
oldPackageList.remove(k); oldPackageList.remove(k);
} }
@ -415,7 +451,6 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
//进行删除 //进行删除
DistributionAddvaluePackageEntity distributionAddvaluePackageEntity = n.get(0); DistributionAddvaluePackageEntity distributionAddvaluePackageEntity = n.get(0);
distributionAddvaluePackageMapper.deleteAddvaluePackage(distributionAddvaluePackageEntity.getReservationId(), distributionAddvaluePackageEntity.getPackageId()); distributionAddvaluePackageMapper.deleteAddvaluePackage(distributionAddvaluePackageEntity.getReservationId(), distributionAddvaluePackageEntity.getPackageId());
}); });
} }
} }
@ -424,7 +459,6 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
} }
@Override @Override
public R editAddvalueInfo(DistributionAppAddvalueDTO distributionAppAddvalueDTO) { public R editAddvalueInfo(DistributionAppAddvalueDTO distributionAppAddvalueDTO) {
DistributionAddvalueVO addvalueVO = distributionAddvalueMapper.selectReservationAddvalue(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType()); DistributionAddvalueVO addvalueVO = distributionAddvalueMapper.selectReservationAddvalue(distributionAppAddvalueDTO.getReservationId(), distributionAppAddvalueDTO.getAddvalueType());

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

@ -85,6 +85,7 @@ import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.cache.DictBizCache; import org.springblade.system.cache.DictBizCache;
import org.springblade.system.feign.IDictBizClient; import org.springblade.system.feign.IDictBizClient;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.connection.ReactiveListCommands;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -536,7 +537,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
} else { } else {
shangpeiFlag = reservationEntityList.stream().allMatch(r -> r.getDeliveryType().equals(DistributionTypeConstant.shangpei.getValue())); shangpeiFlag = reservationEntityList.stream().allMatch(r -> r.getDeliveryType().equals(DistributionTypeConstant.shangpei.getValue()));
if (shangpeiFlag) { if (shangpeiFlag) {
List<DistributionReservationEntity> reservationEntities = reservationEntityList.stream().filter(r -> Func.isNotEmpty(r) && r.getReceivingUnit().equals(stockArticleEntity.getConsigneeUnit()) && r.getMallName().equals(stockArticleEntity.getMallName())).collect(Collectors.toList()); List<DistributionReservationEntity> reservationEntities = reservationEntityList.stream().filter(r -> r.getReceivingUnit().equals(stockArticleEntity.getConsigneeUnit()) && r.getMallName().equals(stockArticleEntity.getMallName())).collect(Collectors.toList());
//查询是否满足商配异常装车
boolean flag = reservationEntityList.stream().anyMatch(r -> r.getReceivingUnit().equals(stockArticleEntity.getConsigneeUnit()) && r.getMallName().equals(stockArticleEntity.getMallName()));
if (reservationEntities.size() == 1) { if (reservationEntities.size() == 1) {
return R.fail(5000, "异常装车"); return R.fail(5000, "异常装车");
} else { } else {
@ -3861,6 +3864,23 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
if (Func.isNotEmpty(loadscanEntity.getLoadedNub())) { if (Func.isNotEmpty(loadscanEntity.getLoadedNub())) {
distributionParcelListVO.setLoadingNub(loadscanEntity.getLoadedNub()); distributionParcelListVO.setLoadingNub(loadscanEntity.getLoadedNub());
} }
if (Func.isNotEmpty(loadscanEntity.getScanStatus())) {
switch (loadscanEntity.getScanStatus()) {
case "1":
distributionParcelListVO.setScanStatus(LoadingStatusConstant.quxiao.getName());
break;
case "2":
distributionParcelListVO.setScanStatus(LoadingStatusConstant.saomiao.getName());
break;
case "3":
distributionParcelListVO.setScanStatus(LoadingStatusConstant.quxiao.getName());
break;
case "4":
distributionParcelListVO.setScanStatus(LoadingStatusConstant.yijianzhuangche.getName());
break;
}
distributionParcelListVO.setLoadingNub(loadscanEntity.getLoadedNub());
}
} }
} }
distributionParcelListVOS.add(distributionParcelListVO); distributionParcelListVOS.add(distributionParcelListVO);
@ -3885,6 +3905,23 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
if (Func.isNotEmpty(loadscanEntity.getLoadedNub())) { if (Func.isNotEmpty(loadscanEntity.getLoadedNub())) {
parcelListVO.setLoadingNub(loadscanEntity.getLoadedNub()); parcelListVO.setLoadingNub(loadscanEntity.getLoadedNub());
} }
if (Func.isNotEmpty(loadscanEntity.getScanStatus())) {
switch (loadscanEntity.getScanStatus()) {
case "1":
parcelListVO.setScanStatus(LoadingStatusConstant.quxiao.getName());
break;
case "2":
parcelListVO.setScanStatus(LoadingStatusConstant.saomiao.getName());
break;
case "3":
parcelListVO.setScanStatus(LoadingStatusConstant.quxiao.getName());
break;
case "4":
parcelListVO.setScanStatus(LoadingStatusConstant.yijianzhuangche.getName());
break;
}
parcelListVO.setLoadingNub(loadscanEntity.getLoadedNub());
}
} }
} }
distributionParcelListVOS.add(parcelListVO); distributionParcelListVOS.add(parcelListVO);
@ -4142,11 +4179,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
.eq(DistributionLoadscaninvnEntity::getReservationId, rs.getReservationId()) .eq(DistributionLoadscaninvnEntity::getReservationId, rs.getReservationId())
.eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionDeliveryInfoDTO.getDeliveryId()) .eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionDeliveryInfoDTO.getDeliveryId())
.ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); .ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()));
rs.setLoadedinNumber(0);
if (Func.isNotEmpty(list)) { if (Func.isNotEmpty(list)) {
//存在装车记录 //存在装车记录
//取出所有的装车操作人 //取出所有的装车操作人
//所有扫描装车的用户名称 //所有扫描装车的用户名称
List<String> collect = list.stream().filter(l -> !l.getScanStatus().equals(LoadingStatusConstant.quxiao.getValue())).map(DistributionLoadscaninvnEntity::getScanUser).collect(Collectors.toList()); List<String> collect = list.stream().filter(l -> !l.getScanStatus().equals(LoadingStatusConstant.quxiao.getValue())).map(DistributionLoadscaninvnEntity::getScanUser).collect(Collectors.toList());
rs.setLoadedinNumber(list.stream().mapToInt(DistributionLoadscaninvnEntity::getLoadedNub).sum());
HashSet<String> strings = new HashSet<>(); HashSet<String> strings = new HashSet<>();
strings.addAll(collect); strings.addAll(collect);
rs.setScanUser(String.join(",", strings)); rs.setScanUser(String.join(",", strings));
@ -4394,7 +4433,17 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
if (Objects.isNull(myCurrentWarehouse)) { if (Objects.isNull(myCurrentWarehouse)) {
return Resp.scanFail("仓库信息不能为空", "仓库信息不能为空"); return Resp.scanFail("仓库信息不能为空", "仓库信息不能为空");
} }
List<DistributionLoadscanEntity> loadscanEntities = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda()
.eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId())
.eq(DistributionLoadscanEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId())
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
.eq(DistributionLoadscanEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()));
if (Func.isNotEmpty(loadscanEntities)) {
//存在装车数据了
log.error("配送计划null:{}", loadscanEntities);
return Resp.scanFail("重复扫描", "重复异常装车");
}
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId()); DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId());
if (Func.isEmpty(deliveryListEntity)) { if (Func.isEmpty(deliveryListEntity)) {
log.error("配送计划null:{}", deliveryListEntity); log.error("配送计划null:{}", deliveryListEntity);

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

@ -1176,7 +1176,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//推翻原有的 //推翻原有的
Long id = distributionReservationDTO.getId(); Long id = distributionReservationDTO.getId();
//这里需要查询出这个预约原来的订单、包件信息 //这里需要查询出这个预约原来的订单、包件信息
List<DistributionReservationStockarticleEntity> distributionReservationStockarticleEntities = distributionReservationStockarticleService.getBaseMapper().selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda().eq(DistributionReservationStockarticleEntity::getReservationId, id).ne(DistributionReservationStockarticleEntity::getStockArticleStatus,ReservationOrderStatusConstant.quxiao.getValue())); List<DistributionReservationStockarticleEntity> distributionReservationStockarticleEntities = distributionReservationStockarticleService.getBaseMapper().selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda().eq(DistributionReservationStockarticleEntity::getReservationId, id).ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue()));
Map<Long, List<DistributionReservationStockarticleEntity>> oldStockArticle = distributionReservationStockarticleEntities.stream().collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getStockArticleId)); Map<Long, List<DistributionReservationStockarticleEntity>> oldStockArticle = distributionReservationStockarticleEntities.stream().collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getStockArticleId));
List<DistributionStockArticleDTO> dtoStockArticleList = distributionReservationDTO.getStockArticleList(); List<DistributionStockArticleDTO> dtoStockArticleList = distributionReservationDTO.getStockArticleList();
Map<Long, List<DistributionStockArticleDTO>> newStockArticle = dtoStockArticleList.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getId)); Map<Long, List<DistributionStockArticleDTO>> newStockArticle = dtoStockArticleList.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getId));
@ -1192,7 +1192,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
AtomicInteger packageNum = new AtomicInteger(); AtomicInteger packageNum = new AtomicInteger();
DistributionStockArticleDTO distributionStockArticleDTO = v.get(0); DistributionStockArticleDTO distributionStockArticleDTO = v.get(0);
if (distributionStockArticleDTO.getIsZero().equals(IsOrNoConstant.no.getValue())) { if (distributionStockArticleDTO.getIsZero().equals(IsOrNoConstant.no.getValue())) {
if (Func.isNotEmpty(distributionStockArticleDTO.getPackageListInfo())){ if (Func.isNotEmpty(distributionStockArticleDTO.getPackageListInfo())) {
List<DistributionParcelListDTO> packageListInfo = distributionStockArticleDTO.getPackageListInfo(); List<DistributionParcelListDTO> packageListInfo = distributionStockArticleDTO.getPackageListInfo();
packageListInfo.forEach(p -> { packageListInfo.forEach(p -> {
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
@ -1208,7 +1208,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionParcelListService.updateById(parcelListEntity); distributionParcelListService.updateById(parcelListEntity);
distributionAsyncService.checkStockArticleReservationStatus(p); distributionAsyncService.checkStockArticleReservationStatus(p);
}); });
}else { } else {
//添加此订单可用所有包件数量 //添加此订单可用所有包件数量
//添加订单下的所有在库订单的包件 //添加订单下的所有在库订单的包件
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, distributionStockArticleDTO.getId()) List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, distributionStockArticleDTO.getId())
@ -1321,133 +1321,136 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
} else { } else {
//查询出这个订单原来在这个预约中的勾选情况 //查询出这个订单原来在这个预约中的勾选情况
DistributionStockArticleDTO distributionStockArticleDTO = v.get(0); DistributionStockArticleDTO distributionStockArticleDTO = v.get(0);
if (distributionStockArticleDTO.getIsZero().equals(IsOrNoConstant.no.getValue())) { AtomicInteger packageNum = new AtomicInteger();
if (Func.isEmpty(distributionStockArticleDTO.getPackageListInfo())) { if (distributionStockArticleDTO.getIsZero().equals(IsOrNoConstant.no.getValue())) {
List<DistributionReservationPackageEntity> packageEntityList = distributionReservationPackageMapper.selectPackageByReservationAndStockArticleId(id, k); DistributionReservationStockarticleEntity reservationStockarticleEntity = oldStockArticle.get(k).get(0);
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)); if (Func.isNotEmpty(distributionStockArticleDTO.getPackageListInfo())) {
AtomicInteger packageNum = new AtomicInteger(); List<DistributionReservationPackageEntity> packageEntityList = distributionReservationPackageMapper.selectPackageByReservationAndStockArticleId(id, k);
AtomicInteger reduceNum = new AtomicInteger(); Map<Long, List<DistributionReservationPackageEntity>> oldPackage = packageEntityList.stream().collect(Collectors.groupingBy(DistributionReservationPackageEntity::getParceListId));
newPackage.forEach((m, n) -> { Map<Long, List<DistributionParcelListEntity>> newPackage = distributionStockArticleDTO.getPackageListInfo().stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getId));
if (Func.isEmpty(oldPackage.get(m))) { // AtomicInteger reduceNum = new AtomicInteger();
DistributionParcelListEntity distributionParcelListEntity = n.get(0); newPackage.forEach((m, n) -> {
//新增 DistributionParcelListEntity distributionParcelListEntity = n.get(0);
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); if (Func.isEmpty(oldPackage.get(m))) {
reservationPackageEntity.setStockArticleId(distributionStockArticleDTO.getId()); //新增
reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue()); DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setPacketBarCode(distributionParcelListEntity.getOrderPackageCode()); reservationPackageEntity.setStockArticleId(distributionStockArticleDTO.getId());
reservationPackageEntity.setParceListId(distributionParcelListEntity.getId()); reservationPackageEntity.setPacketBarStatus(ReservationPackageStatusConstant.xinzeng.getValue());
reservationPackageEntity.setReservationId(id); reservationPackageEntity.setPacketBarCode(distributionParcelListEntity.getOrderPackageCode());
distributionReservationPackageService.save(reservationPackageEntity); reservationPackageEntity.setParceListId(distributionParcelListEntity.getId());
packageNum.getAndAdd(distributionParcelListEntity.getQuantity()); reservationPackageEntity.setReservationId(id);
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(distributionParcelListEntity.getId()); distributionReservationPackageService.save(reservationPackageEntity);
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue()); packageNum.getAndAdd(distributionParcelListEntity.getQuantity());
distributionParcelListService.updateById(parcelListEntity); DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(distributionParcelListEntity.getId());
} else { parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
//数量维护
packageNum.getAndAdd(oldStockArticle.get(k).get(0).getReservationNum());
//移除
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); 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());
oldStockArticle.remove(k);
distributionAsyncService.changeOrderReservationStatus(distributionStockArticleDTO);
}else {
//没有包件 保持原装
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 { } else {
//这里就是新增 //数量维护
DistributionReservationZeroPackageEntity zeroPackageEntity = new DistributionReservationZeroPackageEntity(); packageNum.getAndAdd(distributionParcelListEntity.getQuantity());
zeroPackageEntity.setParcelListId(p.getParcelListId()); //移除
zeroPackageEntity.setCategoryName(p.getFirsts()); oldPackage.remove(m);
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());
} }
//考虑情况:1、数量发生修改 2、数量修改为0表示取消该零担订单对应的品类 3、该零担订单新增品类
//该零担订单原有的品类信息
}); });
DistributionReservationStockarticleEntity reservationStockarticleEntity = oldStockArticle.get(k).get(0); //移除包件进行取消
reservationStockarticleEntity.setReservationNum(zeroPrderNum.get()); 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);
});
reservationStockarticleEntity.setReservationNum(packageNum.get());
distributionReservationStockarticleService.updateById(reservationStockarticleEntity); distributionReservationStockarticleService.updateById(reservationStockarticleEntity);
packTotal.getAndAdd(reservationStockarticleEntity.getReservationNum()); packTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
// oldStockArticle.remove(k);
distributionAsyncService.changeOrderReservationStatus(distributionStockArticleDTO); distributionAsyncService.changeOrderReservationStatus(distributionStockArticleDTO);
oldStockArticle.remove(k); oldStockArticle.remove(k);
} else {
//没有包件 保持原装
packTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
oldStockArticle.remove(k);
} }
warehouseNames.add(distributionStockArticleDTO.getWarehouse()); //对存在订单进行维护
mallName.add(distributionStockArticleDTO.getMallName()); // Integer reservationNum = reservationStockarticleEntity.getReservationNum();
storeName.add(distributionStockArticleDTO.getStoreName());
receivingUnit.add(distributionStockArticleDTO.getConsigneeUnit()); } 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, p.getParcelListId()));
parcelNumberEntity.setDeliveryQuantity(parcelNumberEntity.getDeliveryQuantity() + zeroPackageEntity.getQuantity());
distributionParcelNumberService.updateById(parcelNumberEntity);
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());
// 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());
// DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(distributionStockArticleDTO.getId()); // DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(distributionStockArticleDTO.getId());
// stockArticleEntity.setReservationStatus(status); // stockArticleEntity.setReservationStatus(status);
@ -1456,7 +1459,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
} }
}); });
if (Func.isNotEmpty(oldStockArticle)){ if (Func.isNotEmpty(oldStockArticle)) {
oldStockArticle.forEach((i, j) -> { oldStockArticle.forEach((i, j) -> {
//这里就是需要进行取消的订单信息 //这里就是需要进行取消的订单信息
DistributionReservationStockarticleEntity reservationStockarticleEntity = j.get(0); DistributionReservationStockarticleEntity reservationStockarticleEntity = j.get(0);
@ -1827,7 +1830,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
AtomicInteger reservationOrderNum = new AtomicInteger(); AtomicInteger reservationOrderNum = new AtomicInteger();
if (s.getIsZero().equals(IsOrNoConstant.no.getValue())) { if (s.getIsZero().equals(IsOrNoConstant.no.getValue())) {
//存在勾选包件的操作 //存在勾选包件的操作
if (Func.isNotEmpty(s.getPackageListInfo())){ if (Func.isNotEmpty(s.getPackageListInfo())) {
List<DistributionParcelListDTO> packageListInfo = s.getPackageListInfo(); List<DistributionParcelListDTO> packageListInfo = s.getPackageListInfo();
packageListInfo.forEach(p -> { packageListInfo.forEach(p -> {
reservationOrderNum.getAndAdd(p.getQuantity()); reservationOrderNum.getAndAdd(p.getQuantity());
@ -1843,7 +1846,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//这里根据包件进行订单状态的改变 //这里根据包件进行订单状态的改变
distributionAsyncService.checkStockArticleReservationStatus(p); distributionAsyncService.checkStockArticleReservationStatus(p);
}); });
}else { } else {
//没有进行包件选择 默认添加可配送的所有包件 //没有进行包件选择 默认添加可配送的所有包件
//添加订单下的所有在库订单的包件 //添加订单下的所有在库订单的包件
List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda()
@ -1851,9 +1854,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
.ne(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue()) .ne(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.yizhuangche.getValue())
.ne(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue()) .ne(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue())
.notIn(DistributionParcelListEntity::getOrderPackageStatus, new String[]{OrderPackageStatusConstant.yichuku.getValue(), OrderPackageStatusConstant.yiqianshou.getValue()})); .notIn(DistributionParcelListEntity::getOrderPackageStatus, new String[]{OrderPackageStatusConstant.yichuku.getValue(), OrderPackageStatusConstant.yiqianshou.getValue()}));
if (Func.isEmpty(distributionParcelListEntities)){ if (Func.isEmpty(distributionParcelListEntities)) {
log.error("#########################此订单下包件列表查询为空:{}",s.getOrderCode()); log.error("#########################此订单下包件列表查询为空:{}", s.getOrderCode());
throw new RuntimeException(s.getOrderCode()+"无可用包件信息..."); throw new RuntimeException(s.getOrderCode() + "无可用包件信息...");
} }
distributionParcelListEntities.forEach(dp -> { distributionParcelListEntities.forEach(dp -> {
if (!dp.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) { if (!dp.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) {
@ -1888,7 +1891,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
if (Func.isNotEmpty(parcelNumberVOS)) { if (Func.isNotEmpty(parcelNumberVOS)) {
//进行了零担订单 //进行了零担订单
parcelNumberVOS.forEach(p -> { parcelNumberVOS.forEach(p -> {
if (Func.isNotEmpty(p.getReservationNum()) && p.getReservationNum() > 0){ if (Func.isNotEmpty(p.getReservationNum()) && p.getReservationNum() > 0) {
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity(); DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity();
distributionReservationZeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.zhengchang.getValue()); distributionReservationZeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.zhengchang.getValue());
distributionReservationZeroPackageEntity.setQuantity(p.getReservationNum()); distributionReservationZeroPackageEntity.setQuantity(p.getReservationNum());
@ -1904,17 +1907,17 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
p.setDeliveryQuantity(deliveryQuantity.add(reservationNum).intValue()); p.setDeliveryQuantity(deliveryQuantity.add(reservationNum).intValue());
distributionParcelNumberService.updateById(p); distributionParcelNumberService.updateById(p);
reservationOrderNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity()); reservationOrderNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
distributionAsyncService.checkZeroStockArticleReservationStatus(Func.copy(p,DistributionParcelNumberEntity.class)); distributionAsyncService.checkZeroStockArticleReservationStatus(Func.copy(p, DistributionParcelNumberEntity.class));
} }
}); });
} else { } else {
List<DistributionParcelNumberVO> list = distributionStockArticleService.getZeroOrderDetail(s.getId()); List<DistributionParcelNumberVO> list = distributionStockArticleService.getZeroOrderDetail(s.getId());
int zeroPackageNum = list.stream().mapToInt(DistributionParcelNumberVO::getHandQuantity).sum(); int zeroPackageNum = list.stream().mapToInt(DistributionParcelNumberVO::getHandQuantity).sum();
//判断是否存在可用零担数量
if (Func.isNotEmpty(list)) { if (Func.isNotEmpty(list)) {
if (zeroPackageNum > 0){ if (zeroPackageNum > 0) {
list.forEach(l -> { list.forEach(l -> {
if (l.getHandQuantity() > 0){ if (l.getHandQuantity() > 0) {
DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity(); DistributionReservationZeroPackageEntity distributionReservationZeroPackageEntity = new DistributionReservationZeroPackageEntity();
distributionReservationZeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.zhengchang.getValue()); distributionReservationZeroPackageEntity.setZeroPackageStatus(ReservationOrderStatusConstant.zhengchang.getValue());
distributionReservationZeroPackageEntity.setQuantity(l.getHandQuantity() - l.getDeliveryQuantity() - l.getOutboundQuantity()); distributionReservationZeroPackageEntity.setQuantity(l.getHandQuantity() - l.getDeliveryQuantity() - l.getOutboundQuantity());
@ -1930,12 +1933,12 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
l.setDeliveryQuantity(deliveryQuantity.add(reservationNum).intValue()); l.setDeliveryQuantity(deliveryQuantity.add(reservationNum).intValue());
distributionParcelNumberService.updateById(l); distributionParcelNumberService.updateById(l);
reservationOrderNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity()); reservationOrderNum.getAndAdd(distributionReservationZeroPackageEntity.getQuantity());
distributionAsyncService.checkZeroStockArticleReservationStatus(Func.copy(l,DistributionParcelNumberEntity.class)); distributionAsyncService.checkZeroStockArticleReservationStatus(Func.copy(l, DistributionParcelNumberEntity.class));
} }
}); });
}else { } else {
log.error("########################此零担订单无可用数量:{}",s.getOrderCode()); log.error("########################此零担订单无可用数量:{}", s.getOrderCode());
throw new RuntimeException(s.getOrderCode()+"无可用包件数量"); throw new RuntimeException(s.getOrderCode() + "无可用包件数量");
} }
} else { } else {
log.error("###########################零担订单查询品类错误,订单ID:{}", s.getId()); log.error("###########################零担订单查询品类错误,订单ID:{}", s.getId());
@ -2047,10 +2050,10 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
}); });
distributionDeliveryListEntity.setDistributionCompany("汇通"); distributionDeliveryListEntity.setDistributionCompany("汇通");
distributionDeliveryListEntity.setKind(ServiceConstant.DELIVERLIST_KIND_SELF); distributionDeliveryListEntity.setKind(ServiceConstant.DELIVERLIST_KIND_SELF);
if (Func.isEmpty(driverNames)){ if (Func.isEmpty(driverNames)) {
throw new RuntimeException("请选择配送人员信息!!!"); throw new RuntimeException("请选择配送人员信息!!!");
} }
if (Func.isEmpty(vehicleNubs)){ if (Func.isEmpty(vehicleNubs)) {
throw new RuntimeException("请选择配送人员信息!!!"); throw new RuntimeException("请选择配送人员信息!!!");
} }
distributionDeliveryListEntity.setDriverName(driverNames.deleteCharAt(driverNames.length() - 1).toString()); distributionDeliveryListEntity.setDriverName(driverNames.deleteCharAt(driverNames.length() - 1).toString());
@ -2754,9 +2757,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
.ne(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue()) .ne(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.yiyueyue.getValue())
.eq(DistributionParcelListEntity::getConditions, 1) .eq(DistributionParcelListEntity::getConditions, 1)
.notIn(DistributionParcelListEntity::getOrderPackageStatus, new String[]{OrderPackageStatusConstant.yichuku.getValue(), OrderPackageStatusConstant.yiqianshou.getValue()})); .notIn(DistributionParcelListEntity::getOrderPackageStatus, new String[]{OrderPackageStatusConstant.yichuku.getValue(), OrderPackageStatusConstant.yiqianshou.getValue()}));
if (Func.isEmpty(distributionParcelListEntities)){ if (Func.isEmpty(distributionParcelListEntities)) {
log.error("#########################无可用包件,订单ID为‘;:{}",s.getId()); log.error("#########################无可用包件,订单ID为‘;:{}", s.getId());
throw new RuntimeException(s.getOrderCode()+"无可用包件!!!"); throw new RuntimeException(s.getOrderCode() + "无可用包件!!!");
} }
distributionParcelListEntities.forEach(dp -> { distributionParcelListEntities.forEach(dp -> {
if (!dp.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) { if (!dp.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())) {
@ -3064,7 +3067,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
.eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue()) .eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue())
.notIn(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue(), OrderPackageStatusConstant.yichuku.getValue())); .notIn(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue(), OrderPackageStatusConstant.yichuku.getValue()));
if (Func.isNotEmpty(reservationPackageEntityList)){ if (Func.isNotEmpty(reservationPackageEntityList)) {
List<Long> packageIds = reservationPackageEntityList.stream().map(DistributionReservationPackageEntity::getParceListId).collect(Collectors.toList()); List<Long> packageIds = reservationPackageEntityList.stream().map(DistributionReservationPackageEntity::getParceListId).collect(Collectors.toList());
List<DistributionParcelListEntity> reservationPackageList = distributionParcelListService.listByIds(packageIds); List<DistributionParcelListEntity> reservationPackageList = distributionParcelListService.listByIds(packageIds);
String packageListIds = reservationPackageEntityList.stream().map(DistributionReservationPackageEntity::getParceListId).map(String::valueOf).collect(Collectors.joining(",")); String packageListIds = reservationPackageEntityList.stream().map(DistributionReservationPackageEntity::getParceListId).map(String::valueOf).collect(Collectors.joining(","));
@ -3073,7 +3076,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
reservationOrderPackageVO.setReservationPackageList(parcelListVOS); reservationOrderPackageVO.setReservationPackageList(parcelListVOS);
reservationOrderPackageVO.setPackageListIds(packageListIds); reservationOrderPackageVO.setPackageListIds(packageListIds);
} }
if (Func.isNotEmpty(parcelListEntities)){ if (Func.isNotEmpty(parcelListEntities)) {
allPackageList.addAll(DistributionParcelListWrapper.build().listVO(parcelListEntities)); allPackageList.addAll(DistributionParcelListWrapper.build().listVO(parcelListEntities));
} }
if (Func.isEmpty(allPackageList)) { if (Func.isEmpty(allPackageList)) {

59
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -483,8 +483,10 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
.eq(DistributionLoadscanEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) .eq(DistributionLoadscanEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId())
.eq(DistributionLoadscanEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()) .eq(DistributionLoadscanEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode())
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()));
if (loadscanEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) { if (Func.isNotEmpty(loadscanEntity)){
return Resp.scanFail("重复操作!!", "重复操作"); if (loadscanEntity.getSignforState().equals(LoadScanSigningStatusConstant.yiqianshou.getValue())) {
return Resp.scanFail("重复操作!!", "重复操作");
}
} }
switch (reservationEntity.getDeliveryType()) { switch (reservationEntity.getDeliveryType()) {
case "1": case "1":
@ -814,8 +816,6 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionLoadscaninvnService.updateById(loadscaninvnEntity); distributionLoadscaninvnService.updateById(loadscaninvnEntity);
//维护签收数量 //维护签收数量
Integer j = distributionSignforMapper.updateSignforNum(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub()); Integer j = distributionSignforMapper.updateSignforNum(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub());
} else { } else {
//库存品未进行装车 //库存品未进行装车
//这里装车的数据需要进行补录 //这里装车的数据需要进行补录
@ -951,7 +951,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
if (Func.isNotEmpty(orderMap.get(stockArticleEntity.getId()))) { if (Func.isNotEmpty(orderMap.get(stockArticleEntity.getId()))) {
//统计装车数 //统计装车数
int loadingNum = orderMap.get(stockArticleEntity.getId()).stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum(); int loadingNum = orderMap.get(stockArticleEntity.getId()).stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum();
int signforNub = orderMap.get(stockArticleEntity.getId()).stream().filter(f -> Func.equals(f.getIsSignfor(), LoadScanSigningStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum(); int signforNub = orderMap.get(stockArticleEntity.getId()).stream().filter(f -> Func.equals(f.getSignforState(), LoadScanSigningStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum();
distributionAppStockArticleVO.setLoadingNub(loadingNum); distributionAppStockArticleVO.setLoadingNub(loadingNum);
distributionAppStockArticleVO.setSignforNub(signforNub); distributionAppStockArticleVO.setSignforNub(signforNub);
} }
@ -1075,17 +1075,39 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
//转换字典字段 //转换字典字段
for (DistributionAppDeliveryListVO distributionAppDeliveryListVO : distributionAppDeliveryListVOS) { for (DistributionAppDeliveryListVO distributionAppDeliveryListVO : distributionAppDeliveryListVOS) {
//查询包件签收件数 //查询包件签收件数
int lad = distributionLoadscanMapper.selectList(new QueryWrapper<DistributionLoadscanEntity>().lambda() List<DistributionLoadscanEntity> loadscanEntities = distributionLoadscanMapper.selectList(new QueryWrapper<DistributionLoadscanEntity>().lambda()
.eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListVO.getId()) .eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListVO.getId())
.eq(DistributionLoadscanEntity::getSignforState, 2) .eq(DistributionLoadscanEntity::getSignforState, 2)
).stream().mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum(); );
AtomicInteger signNum = new AtomicInteger();
AtomicInteger loadNum = new AtomicInteger();
if (Func.isNotEmpty(loadscanEntities)){
//统计库存品配送数和签收数
loadNum.getAndAdd(loadscanEntities.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum());
signNum.getAndAdd(loadscanEntities.stream().mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum());
}
// int lad = distributionLoadscanMapper.selectList(new QueryWrapper<DistributionLoadscanEntity>().lambda()
// .eq(DistributionLoadscanEntity::getDeliveryId, distributionAppDeliveryListVO.getId())
// .eq(DistributionLoadscanEntity::getSignforState, 2)
// ).stream().mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum();
//查询库存品签收件数 //查询库存品签收件数
Integer nad = distributionLoadscaninvnMapper.selectList(new QueryWrapper<DistributionLoadscaninvnEntity>().lambda() List<DistributionLoadscaninvnEntity> distributionLoadscaninvnEntities = distributionLoadscaninvnMapper.selectList(new QueryWrapper<DistributionLoadscaninvnEntity>().lambda()
.eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionAppDeliveryListVO.getId()) .eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionAppDeliveryListVO.getId())
.eq(DistributionLoadscaninvnEntity::getSignforState, 2) .eq(DistributionLoadscaninvnEntity::getSignforState, 2)
).stream().mapToInt(DistributionLoadscaninvnEntity::getReceivedQuantity).sum(); );
distributionAppDeliveryListVO.setSignNub(lad + nad); if (Func.isNotEmpty(distributionLoadscaninvnEntities)){
//统计库存品配送数和签收数
loadNum.getAndAdd(distributionLoadscaninvnEntities.stream().mapToInt(DistributionLoadscaninvnEntity::getLoadedNub).sum());
signNum.getAndAdd(distributionLoadscaninvnEntities.stream().mapToInt(DistributionLoadscaninvnEntity::getReceivedQuantity).sum());
}
// Integer nad = distributionLoadscaninvnMapper.selectList(new QueryWrapper<DistributionLoadscaninvnEntity>().lambda()
// .eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionAppDeliveryListVO.getId())
// .eq(DistributionLoadscaninvnEntity::getSignforState, 2)
// ).stream().mapToInt(DistributionLoadscaninvnEntity::getReceivedQuantity).sum();
distributionAppDeliveryListVO.setSignNub(signNum.get());
distributionAppDeliveryListVO.setDeliveryNumber(loadNum.get());
//查询完成客户数 //查询完成客户数
Integer cusCount = distributionDeliveryListMapper.selectCompletecusInCount(distributionAppDeliveryListVO.getId()); Integer cusCount = distributionDeliveryListMapper.selectCompletecusInCount(distributionAppDeliveryListVO.getId());
//查询完成订单数 //查询完成订单数
@ -2279,26 +2301,25 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
//存在签收数据,这里对签收的数量进行修改,修改不得超过计划数 //存在签收数据,这里对签收的数量进行修改,修改不得超过计划数
loadscanEntityList.setReceivedQuantity(signingNum.intValue()); loadscanEntityList.setReceivedQuantity(signingNum.intValue());
parcelNumberEntity.setSigninQuantity(signinQuantity.subtract(receivedQuantity).add(signingNum).intValue()); parcelNumberEntity.setSigninQuantity(signinQuantity.subtract(receivedQuantity).add(signingNum).intValue());
DistributionSignforEntity signforEntity = distributionSignforMapper.selectOne(Wrappers.<DistributionSignforEntity>query().lambda().eq(DistributionSignforEntity::getDeliveryId, loadscanEntityList.getDeliveryId()).eq(DistributionSignforEntity::getReservationId, loadscanEntityList.getReservationId()));
BigDecimal loadedNumber = new BigDecimal(signforEntity.getLoadedNumber());
BigDecimal signingNumber = new BigDecimal(signforEntity.getReceivedQuantity());
if (loadscanEntityList.getLoadedNub() < p.getSigningNum()){ if (loadscanEntityList.getLoadedNub() < p.getSigningNum()){
//这里需要同时维护装车和签收数量 //这里需要同时维护装车和签收数量
loadscanEntityList.setLoadedNub(p.getSigningNum()); // loadscanEntityList.setLoadedNub(p.getSigningNum());
loadscanEntityList.setPackageNub(p.getSigningNum()); // loadscanEntityList.setPackageNub(p.getSigningNum());
loadscanEntityList.setLoadedNub(p.getSigningNum()); // loadscanEntityList.setLoadedNub(p.getSigningNum());
loadscanEntityList.setPackageNub(p.getSigningNum()); // loadscanEntityList.setPackageNub(p.getSigningNum());
loadscanEntityList.setMsg("签收数量大于装车数"); loadscanEntityList.setMsg("签收数量大于装车数");
parcelNumberEntity.setDeliveryQuantity(newDeliveryQuantity); parcelNumberEntity.setDeliveryQuantity(newDeliveryQuantity);
parcelNumberEntity.setOutboundQuantity(newOunBoundQuantity); parcelNumberEntity.setOutboundQuantity(newOunBoundQuantity);
parcelNumberEntity.setHandQuantity(newHandQuantity); parcelNumberEntity.setHandQuantity(newHandQuantity);
signforEntity.setLoadedNumber(loadedNumber.subtract(loadedNub).add(signingNum).intValue());
} }
if (p.getSigningNum() == 0) { if (p.getSigningNum() == 0) {
//签收状态 //签收状态
loadscanEntityList.setSignforState(LoadScanSigningStatusConstant.weiqianshou.getValue()); loadscanEntityList.setSignforState(LoadScanSigningStatusConstant.weiqianshou.getValue());
} }
DistributionSignforEntity signforEntity = distributionSignforMapper.selectOne(Wrappers.<DistributionSignforEntity>query().lambda().eq(DistributionSignforEntity::getDeliveryId, loadscanEntityList.getDeliveryId()).eq(DistributionSignforEntity::getReservationId, loadscanEntityList.getReservationId()));
BigDecimal loadedNumber = new BigDecimal(signforEntity.getLoadedNumber());
BigDecimal signingNumber = new BigDecimal(signforEntity.getReceivedQuantity());
signforEntity.setLoadedNumber(loadedNumber.subtract(loadedNub).add(signingNum).intValue());
signforEntity.setReceivedQuantity(signingNumber.subtract(receivedQuantity).add(signingNum).intValue()); signforEntity.setReceivedQuantity(signingNumber.subtract(receivedQuantity).add(signingNum).intValue());
distributionSignforMapper.updateById(signforEntity); distributionSignforMapper.updateById(signforEntity);
distributionLoadscanService.updateById(loadscanEntityList); distributionLoadscanService.updateById(loadscanEntityList);

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

@ -1008,6 +1008,8 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
// log.warn("##############upShelfOrder: 库位上的托盘是库存品类型 allocationId={}",allocationId); // log.warn("##############upShelfOrder: 库位上的托盘是库存品类型 allocationId={}",allocationId);
// return R.fail(403,"库位上的托盘是库存品类型"); // return R.fail(403,"库位上的托盘是库存品类型");
// } // }
}else{
upShelfStockList = allList;
} }
BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient.getEntityByAllocationId(allocationId); BasicdataGoodsAllocationEntity goodsAllocationEntity = basicdataGoodsAllocationClient.getEntityByAllocationId(allocationId);
if(Objects.isNull(goodsAllocationEntity)){ if(Objects.isNull(goodsAllocationEntity)){

Loading…
Cancel
Save