Browse Source

Merge branch 'dev' into pre-production

single_db
pref_mail@163.com 1 year ago
parent
commit
d2db03c769
  1. 33
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DisStockListDetailServiceImpl.java
  2. 135
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java
  3. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryInfoServiceImpl.java
  4. 50
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  5. 112
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  6. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java
  7. 22
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java
  8. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseUpdownTypeClient.java

33
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DisStockListDetailServiceImpl.java

@ -34,12 +34,11 @@ import com.logpm.distribution.mapper.DistrilbutionBillStockMapper;
import com.logpm.distribution.service.*; import com.logpm.distribution.service.*;
import com.logpm.distribution.vo.DisStockListDetailVO; import com.logpm.distribution.vo.DisStockListDetailVO;
import com.logpm.distribution.vo.DisStockListVO; import com.logpm.distribution.vo.DisStockListVO;
import com.logpm.distribution.vo.DistributionStockArticleQRCodeVO;
import com.logpm.distribution.vo.OrderPackgeCodeDataVO; import com.logpm.distribution.vo.OrderPackgeCodeDataVO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.jetbrains.annotations.NotNull;
import org.springblade.common.constant.DistributionTypeConstant; import org.springblade.common.constant.DistributionTypeConstant;
import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant; import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant;
import org.springblade.common.constant.stockup.StockupStatusConstant;
import org.springblade.common.utils.QRCodeUtil; import org.springblade.common.utils.QRCodeUtil;
import org.springblade.common.utils.TemplateUtil; import org.springblade.common.utils.TemplateUtil;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
@ -160,7 +159,7 @@ public class DisStockListDetailServiceImpl extends BaseServiceImpl<DisStockListD
List<DistrilbutionBillStockEntity> list = distrilbutionBillStockService.selectList(Wrappers.<DistrilbutionBillStockEntity>query().lambda() List<DistrilbutionBillStockEntity> list = distrilbutionBillStockService.selectList(Wrappers.<DistrilbutionBillStockEntity>query().lambda()
.eq(DistrilbutionBillStockEntity::getBillLadingId, reservationId) .eq(DistrilbutionBillStockEntity::getBillLadingId, reservationId)
); );
if(list.size() > 0){ if(!list.isEmpty()){
DistributionStockArticleEntity byId = distributionStockArticleService.getById(list.get(0).getStockArticleId()); DistributionStockArticleEntity byId = distributionStockArticleService.getById(list.get(0).getStockArticleId());
disStockListDetail.put("userName",byId.getConsigneePerson()); disStockListDetail.put("userName",byId.getConsigneePerson());
disStockListDetail.put("userNameDetail",byId.getCustomerAddress()); disStockListDetail.put("userNameDetail",byId.getCustomerAddress());
@ -257,16 +256,7 @@ public class DisStockListDetailServiceImpl extends BaseServiceImpl<DisStockListD
public Map<String, Object> fuzhi(String id){ public Map<String, Object> fuzhi(String id){
DisStockListDetailEntity dis = baseMapper.selectById(id); DisStockListDetailEntity dis = baseMapper.selectById(id);
DistributionStockListEntity byId = distributionStockListService.getById(dis.getStockListId()); DistributionStockListEntity byId = distributionStockListService.getById(dis.getStockListId());
DisStockListVO disStockListVO = new DisStockListVO(); DisStockListVO disStockListVO = getDisStockListVO(dis, byId);
disStockListVO.setId(dis.getId());
disStockListVO.setStockPackageCode(dis.getStockPackageCode());
disStockListVO.setSku(byId.getSku());
disStockListVO.setCargoUnit(byId.getCargoUnit());
disStockListVO.setOrderCode(byId.getOrderCode());
disStockListVO.setDescriptionGoods(byId.getDescriptionGoods());
disStockListVO.setBrandName(byId.getBrandName());
disStockListVO.setStockListId(disStockListVO.getStockListId());
disStockListVO.setReservationId(disStockListVO.getReservationId());
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(disStockListVO), Map.class); Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(disStockListVO), Map.class);
String fileTypeName = QRCodeUtil.createCodeToFile(dis.getStockPackageCode()); String fileTypeName = QRCodeUtil.createCodeToFile(dis.getStockPackageCode());
@ -279,7 +269,7 @@ public class DisStockListDetailServiceImpl extends BaseServiceImpl<DisStockListD
List<DistrilbutionBillStockEntity> list = distrilbutionBillStockService.selectList(Wrappers.<DistrilbutionBillStockEntity>query().lambda() List<DistrilbutionBillStockEntity> list = distrilbutionBillStockService.selectList(Wrappers.<DistrilbutionBillStockEntity>query().lambda()
.eq(DistrilbutionBillStockEntity::getBillLadingId, dis.getReservationId()) .eq(DistrilbutionBillStockEntity::getBillLadingId, dis.getReservationId())
); );
if(list.size() > 0){ if(!list.isEmpty()){
DistributionStockArticleEntity byIds = distributionStockArticleService.getById(list.get(0).getStockArticleId()); DistributionStockArticleEntity byIds = distributionStockArticleService.getById(list.get(0).getStockArticleId());
map.put("userName",byIds.getConsigneePerson()); map.put("userName",byIds.getConsigneePerson());
map.put("userNameDetail",byIds.getCustomerAddress()); map.put("userNameDetail",byIds.getCustomerAddress());
@ -293,4 +283,19 @@ public class DisStockListDetailServiceImpl extends BaseServiceImpl<DisStockListD
return map; return map;
} }
@NotNull
private static DisStockListVO getDisStockListVO(DisStockListDetailEntity dis, DistributionStockListEntity byId) {
DisStockListVO disStockListVO = new DisStockListVO();
disStockListVO.setId(dis.getId());
disStockListVO.setStockPackageCode(dis.getStockPackageCode());
disStockListVO.setSku(byId.getSku());
disStockListVO.setCargoUnit(byId.getCargoUnit());
disStockListVO.setOrderCode(byId.getOrderCode());
disStockListVO.setDescriptionGoods(byId.getDescriptionGoods());
disStockListVO.setBrandName(byId.getBrandName());
disStockListVO.setStockListId(disStockListVO.getStockListId());
disStockListVO.setReservationId(disStockListVO.getReservationId());
return disStockListVO;
}
} }

135
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java

@ -22,14 +22,12 @@ import com.logpm.factory.mt.dto.MtReceiveImagesDTO;
import com.logpm.factory.mt.feign.IMtOrderMainClinet; import com.logpm.factory.mt.feign.IMtOrderMainClinet;
import com.logpm.factory.oupai.feign.IOuPaiFactoryClinet; import com.logpm.factory.oupai.feign.IOuPaiFactoryClinet;
import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient; import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient;
import com.sun.xml.bind.v2.TODO;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springblade.common.constant.DistributionTypeConstant; import org.springblade.common.constant.DistributionTypeConstant;
import org.springblade.common.constant.Inventory.InventoryLoadingStatusConstant; import org.springblade.common.constant.Inventory.InventoryLoadingStatusConstant;
import org.springblade.common.constant.Inventory.InventoryPackageStatusConstant; import org.springblade.common.constant.Inventory.InventoryPackageStatusConstant;
import org.springblade.common.constant.Inventory.InventorySigningStatusConstant; import org.springblade.common.constant.Inventory.InventorySigningStatusConstant;
import org.springblade.common.constant.billLading.BillLadingStatusConstant;
import org.springblade.common.constant.common.IsOrNoConstant; import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.delivery.DeliveryLoadingStatusConstant; import org.springblade.common.constant.delivery.DeliveryLoadingStatusConstant;
import org.springblade.common.constant.delivery.DeliveryStatusConstant; import org.springblade.common.constant.delivery.DeliveryStatusConstant;
@ -47,10 +45,7 @@ import org.springblade.common.constant.stockup.StockupStatusConstant;
import org.springblade.common.constant.stockup.StockupTypeConstant; import org.springblade.common.constant.stockup.StockupTypeConstant;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
@ -88,7 +83,6 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
private final DistributionReservationStocklistMapper distributionReservationStocklistMapper; private final DistributionReservationStocklistMapper distributionReservationStocklistMapper;
private final IDistributionReservationStocklistService distributionReservationStocklistService; private final IDistributionReservationStocklistService distributionReservationStocklistService;
private final DistributionBillLadingScanMapper distributionBillLadingScanMapper; private final DistributionBillLadingScanMapper distributionBillLadingScanMapper;
private final DistrilbutionBillStockMapper distrilbutionBillStockMapper;
private final DistrilbutionBillLadingMapper distrilbutionBillLadingMapper; private final DistrilbutionBillLadingMapper distrilbutionBillLadingMapper;
private final DistributionDeliveryDetailsMapper distributionDeliveryDetailsMapper; private final DistributionDeliveryDetailsMapper distributionDeliveryDetailsMapper;
private final DistributionParcelListMapper distributionParcelListMapper; private final DistributionParcelListMapper distributionParcelListMapper;
@ -97,14 +91,12 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
private final IBasicdataWarehouseClient warehouseClient; private final IBasicdataWarehouseClient warehouseClient;
private final IDistributionReservationZeroPackageService reservationZeroPackageService; private final IDistributionReservationZeroPackageService reservationZeroPackageService;
private final IDistributionParcelNumberService distributionParcelNumberService; private final IDistributionParcelNumberService distributionParcelNumberService;
// private final IDistributionParcelNumberService distributionParcelNumberService;
private final IMtOrderMainClinet orderMainClinet; private final IMtOrderMainClinet orderMainClinet;
private final IOuPaiFactoryClinet ouPaiFactoryClinet; private final IOuPaiFactoryClinet ouPaiFactoryClinet;
private final IDistrilbutionBillPackageService billPackageService; private final IDistrilbutionBillPackageService billPackageService;
private final IDistributionReservationZeroPackageService zeroPackageService; private final IDistributionReservationZeroPackageService zeroPackageService;
// private DistributionReservationMapper reservationService;
private final DistributionSignforMapper distributionSignforService; private final DistributionSignforMapper distributionSignforService;
@Override @Override
@ -116,10 +108,6 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
List<DistributionLoadscanEntity> distributionLoadscanEntities = distributionLoadscanMapper.selectList(new QueryWrapper<DistributionLoadscanEntity>().lambda() List<DistributionLoadscanEntity> distributionLoadscanEntities = distributionLoadscanMapper.selectList(new QueryWrapper<DistributionLoadscanEntity>().lambda()
.eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()) .eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId())
); );
if (distributionLoadscanEntities.size() < 0) {
log.info("[makeSureByPackage]包条无数据");
return;
}
// 使用流式操作和映射,提取包条Id并创建新的列表 // 使用流式操作和映射,提取包条Id并创建新的列表
// List<Long> packageIdList = distributionLoadscanEntities.stream().map(DistributionLoadscanEntity::getPackageId).collect(Collectors.toList()); // List<Long> packageIdList = distributionLoadscanEntities.stream().map(DistributionLoadscanEntity::getPackageId).collect(Collectors.toList());
// for (Long aLong : packageIdList) { // for (Long aLong : packageIdList) {
@ -264,7 +252,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
@Override @Override
public void updateParcelListReservation(List<Long> ids) { public void updateParcelListReservation(List<Long> ids) {
log.debug("####修改包件预约状态"); log.debug("####修改包件预约状态");
ids.stream().forEach(i -> { ids.forEach(i -> {
DistributionParcelListEntity distributionParcelListEntity = new DistributionParcelListEntity(); DistributionParcelListEntity distributionParcelListEntity = new DistributionParcelListEntity();
distributionParcelListEntity.setId(i); distributionParcelListEntity.setId(i);
distributionParcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue()); distributionParcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
@ -436,7 +424,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue()); parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yiqianshou.getValue());
//修改包件状态 //修改包件状态
distributionParcelListService.updateById(parcelListEntity); distributionParcelListService.updateById(parcelListEntity);
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper.selectOne(Wrappers.<DistributionDeliveryListEntity>query().lambda().eq(DistributionDeliveryListEntity::getId, deliveryId)); // DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper.selectOne(Wrappers.<DistributionDeliveryListEntity>query().lambda().eq(DistributionDeliveryListEntity::getId, deliveryId));
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, parcelListEntity.getStockArticleId())); List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, parcelListEntity.getStockArticleId()));
boolean packageLoadingFlag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); boolean packageLoadingFlag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue()));
boolean packageSigningFlag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())); boolean packageSigningFlag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue()));
@ -524,7 +512,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
); );
if (Func.isNotEmpty(loadscanEntityList)) { if (Func.isNotEmpty(loadscanEntityList)) {
loadingNum += loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum(); loadingNum += loadscanEntityList.stream().mapToInt(DistributionLoadscanEntity::getLoadedNub).sum();
signNum += loadscanEntityList.stream().filter(l -> l.getSignforState().equals(SignforStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum(); signNum += loadscanEntityList.stream().filter(l -> l.getSignforState().equals(Integer.parseInt(SignforStatusConstant.yiqianshou.getValue()))).mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum();
} }
List<DistributionLoadscaninvnEntity> loadscaninvnEntityList = distributionLoadscaninvnMapper.selectList(Wrappers.<DistributionLoadscaninvnEntity>query().lambda() List<DistributionLoadscaninvnEntity> loadscaninvnEntityList = distributionLoadscaninvnMapper.selectList(Wrappers.<DistributionLoadscaninvnEntity>query().lambda()
@ -533,7 +521,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
); );
if (Func.isNotEmpty(loadscanEntityList)) { if (Func.isNotEmpty(loadscanEntityList)) {
loadingNum += loadscaninvnEntityList.stream().mapToInt(DistributionLoadscaninvnEntity::getLoadedNub).sum(); loadingNum += loadscaninvnEntityList.stream().mapToInt(DistributionLoadscaninvnEntity::getLoadedNub).sum();
signNum += loadscaninvnEntityList.stream().filter(l -> l.getSignforState().equals(SignforStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscaninvnEntity::getReceivedQuantity).sum(); signNum += loadscaninvnEntityList.stream().filter(l -> l.getSignforState().equals(Integer.parseInt(SignforStatusConstant.yiqianshou.getValue()))).mapToInt(DistributionLoadscaninvnEntity::getReceivedQuantity).sum();
} }
if (loadingNum == reservationTotal) { if (loadingNum == reservationTotal) {
@ -595,7 +583,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
.ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) .ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
); );
if (Func.isNotEmpty(loadscanEntityList)) { if (Func.isNotEmpty(loadscanEntityList)) {
deliverySigningNum += loadscanEntityList.stream().filter(l -> l.getSignforState().equals(SignforStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum(); deliverySigningNum += loadscanEntityList.stream().filter(l -> l.getSignforState().equals(Integer.parseInt(SignforStatusConstant.yiqianshou.getValue()))).mapToInt(DistributionLoadscanEntity::getReceivedQuantity).sum();
} }
List<DistributionLoadscaninvnEntity> loadscaninvnEntityList = distributionLoadscaninvnMapper.selectList(Wrappers.<DistributionLoadscaninvnEntity>query().lambda() List<DistributionLoadscaninvnEntity> loadscaninvnEntityList = distributionLoadscaninvnMapper.selectList(Wrappers.<DistributionLoadscaninvnEntity>query().lambda()
@ -603,10 +591,10 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
.ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) .ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())
); );
if (Func.isNotEmpty(loadscanEntityList)) { if (Func.isNotEmpty(loadscanEntityList)) {
deliverySigningNum += loadscaninvnEntityList.stream().filter(l -> l.getSignforState().equals(SignforStatusConstant.yiqianshou.getValue())).mapToInt(DistributionLoadscaninvnEntity::getReceivedQuantity).sum(); deliverySigningNum += loadscaninvnEntityList.stream().filter(l -> l.getSignforState().equals(Integer.parseInt(SignforStatusConstant.yiqianshou.getValue()))).mapToInt(DistributionLoadscaninvnEntity::getReceivedQuantity).sum();
} }
if (deliverySigningNum == delivertTotal) { if (deliverySigningNum.equals(delivertTotal)) {
deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.yiwancheng.getValue()); deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.yiwancheng.getValue());
} else { } else {
deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.peisongzhong.getValue()); deliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.peisongzhong.getValue());
@ -889,7 +877,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
distributionDeliveryListMapper.updateById(deliveryListEntity); distributionDeliveryListMapper.updateById(deliveryListEntity);
} }
List<DistributionReservationEntity> reservationEntityList = distributionDeliveryListMapper.selectReservationByDeliveryListId(deliveryId); List<DistributionReservationEntity> reservationEntityList = distributionDeliveryListMapper.selectReservationByDeliveryListId(deliveryId);
if (Func.isNotEmpty(reservationEntityList) && reservationEntityList.size() > 0) { if (Func.isNotEmpty(reservationEntityList) && !reservationEntityList.isEmpty()) {
for (DistributionReservationEntity reservationEntity : reservationEntityList) { for (DistributionReservationEntity reservationEntity : reservationEntityList) {
List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(reservationEntity.getId()); List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(reservationEntity.getId());
Map<Long, List<DistributionParcelListEntity>> order = parcelListEntities.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getStockArticleId)); Map<Long, List<DistributionParcelListEntity>> order = parcelListEntities.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getStockArticleId));
@ -937,7 +925,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(orderId); DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(orderId);
Integer orderLoadingNum = distributionLoadscanMapper.selectOrderLoadingNum(stockArticleEntity.getId()); Integer orderLoadingNum = distributionLoadscanMapper.selectOrderLoadingNum(stockArticleEntity.getId());
if (Func.isNotEmpty(orderLoadingNum) && orderLoadingNum > 0) { if (Func.isNotEmpty(orderLoadingNum) && orderLoadingNum > 0) {
if (stockArticleEntity.getTotalNumber() == orderLoadingNum) { if (stockArticleEntity.getTotalNumber().equals(orderLoadingNum)) {
stockArticleEntity.setOrderStatus(OrderStatusConstant.chuku.getValue()); stockArticleEntity.setOrderStatus(OrderStatusConstant.chuku.getValue());
} else { } else {
stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenchuku.getValue()); stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenchuku.getValue());
@ -986,7 +974,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
if (Func.isNotEmpty(parcelNumberEntityList)) { if (Func.isNotEmpty(parcelNumberEntityList)) {
parcelNumberEntityList.forEach(p -> { parcelNumberEntityList.forEach(p -> {
DistributionParcelListEntity zeroParcelListEntity = distributionParcelListService.getById(p.getParcelListId()); DistributionParcelListEntity zeroParcelListEntity = distributionParcelListService.getById(p.getParcelListId());
if (p.getOutboundQuantity() == p.getQuantity() && p.getOutboundQuantity() > 0) { if (p.getOutboundQuantity() .equals(p.getQuantity()) && p.getOutboundQuantity() > 0) {
//出库数量和总数量一致,此时包件处于装车状态 //出库数量和总数量一致,此时包件处于装车状态
zeroParcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); zeroParcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
} }
@ -1036,19 +1024,19 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
log.debug("修改备货数据》》》", stockupDTO); log.info("修改备货数据》》》 {}", stockupDTO);
QueryWrapper<DistributionReservationZeroPackageEntity> queryWrapper = new QueryWrapper(); QueryWrapper<DistributionReservationZeroPackageEntity> queryWrapper = new QueryWrapper();
if (ObjectUtils.isNotNull(stockupDTO.getStockArticleId())) { if (ObjectUtils.isNotNull(stockupDTO.getStockArticleId())) {
queryWrapper.eq("stock_article_id", stockupDTO.getStockArticleId()); queryWrapper.eq("stock_article_id", stockupDTO.getStockArticleId());
} }
if (stockupDTO.getStockArticleIdList() != null && !stockupDTO.getStockArticleIdList().equals(null)) { if (stockupDTO.getStockArticleIdList() != null && ObjectUtils.isNotNull(stockupDTO.getStockArticleIdList())) {
queryWrapper.in("stock_article_id", stockupDTO.getStockArticleIdList()); queryWrapper.in("stock_article_id", stockupDTO.getStockArticleIdList());
} }
queryWrapper.eq("reservation_id", stockupDTO.getReservationId()); queryWrapper.eq("reservation_id", stockupDTO.getReservationId());
List<DistributionReservationZeroPackageEntity> list = reservationZeroPackageService.list(queryWrapper); List<DistributionReservationZeroPackageEntity> list = reservationZeroPackageService.list(queryWrapper);
AtomicBoolean pian = new AtomicBoolean(true); AtomicBoolean pian = new AtomicBoolean(true);
DistributionStockupEntity stockupEntity = new DistributionStockupEntity(); DistributionStockupEntity stockupEntity = new DistributionStockupEntity();
list.stream().forEach(i -> { list.forEach(i -> {
if (!i.getQuantity().equals(i.getRealityQuantity())) { if (!i.getQuantity().equals(i.getRealityQuantity())) {
//不同 不能修改为完成 //不同 不能修改为完成
pian.set(false); pian.set(false);
@ -1234,7 +1222,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
} }
parcelNumberEntities.forEach(p -> { parcelNumberEntities.forEach(p -> {
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(p.getParcelListId()); DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(p.getParcelListId());
if (p.getOutboundQuantity() == p.getQuantity()) { if (Objects.equals(p.getOutboundQuantity(), p.getQuantity())) {
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
} else { } else {
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.weizhuancghe.getValue()); parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.weizhuancghe.getValue());
@ -1448,7 +1436,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
@Override @Override
@Async @Async
public void sendFactory(DistributionParcelListEntity distributionParcelListEntity, String signingTime, Long reservationId, String reservationCode, String warehouseName,String userName) { public void sendFactory(DistributionParcelListEntity distributionParcelListEntity, String signingTime, Long reservationId, String reservationCode, String warehouseName, String userName) {
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(distributionParcelListEntity.getStockArticleId()); DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(distributionParcelListEntity.getStockArticleId());
log.info(">>>>>>>>>>> 签收推送 对象 {}", distributionParcelListEntity); log.info(">>>>>>>>>>> 签收推送 对象 {}", distributionParcelListEntity);
if (Func.isNotEmpty(stockArticleEntity)) { if (Func.isNotEmpty(stockArticleEntity)) {
@ -1465,8 +1453,8 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
case "欧派": case "欧派":
//推送到欧派 //推送到欧派
try { try {
// ouPaiFactoryClinet.newSystemHandleStatusDataSignforOne("7",distributionParcelListEntity.getOrderPackageCode(), signingTime, userName );//*签收人*// // ouPaiFactoryClinet.newSystemHandleStatusDataSignforOne("7",distributionParcelListEntity.getOrderPackageCode(), signingTime, userName );//*签收人*//
// log.info(">>>>>>>>>>>>>>>>>>>>>>>> 签收推送 欧派:{} {} {} {}", "7",distributionParcelListEntity.getOrderPackageCode(), signingTime, userName ); // log.info(">>>>>>>>>>>>>>>>>>>>>>>> 签收推送 欧派:{} {} {} {}", "7",distributionParcelListEntity.getOrderPackageCode(), signingTime, userName );
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -1482,7 +1470,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
@Async @Async
public void sendReviewFactory(Long signingId, String warehouseName, Long warehouseId) { public void sendReviewFactory(Long signingId, String warehouseName, Long warehouseId) {
String brands = "梦天,欧派";//可追加 String brands = "梦天,欧派";//可追加
log.info(">>>>>>>>>>> 签收推送 对象 {}", "signingId:="+signingId+"warehouseName:="+warehouseName+"warehouseId:="+warehouseId); log.info(">>>>>>>>>>> 签收推送 对象 {}", "signingId:=" + signingId + "warehouseName:=" + warehouseName + "warehouseId:=" + warehouseId);
//查询签收信息 //查询签收信息
DistributionSignforEntity distributionSignforEntity = distributionSignforMapper.selectById(signingId); DistributionSignforEntity distributionSignforEntity = distributionSignforMapper.selectById(signingId);
if (Func.isNotEmpty(distributionSignforEntity)) { if (Func.isNotEmpty(distributionSignforEntity)) {
@ -1498,29 +1486,28 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
Map<String, List<MtReceiveContentDTO>> brand = null; Map<String, List<MtReceiveContentDTO>> brand = null;
log.info(">>>brand {} ",brand);
List<DistributionReservationStockarticleEntity> distributionReservationStockarticleEntities = distributionReservationMapper.selectStockArticleByReservationId(distributionReservationEntity.getId()); List<DistributionReservationStockarticleEntity> distributionReservationStockarticleEntities = distributionReservationMapper.selectStockArticleByReservationId(distributionReservationEntity.getId());
log.info(">>>brand distributionReservationStockarticleEntities 长度 {} ",distributionReservationStockarticleEntities.size()); log.info(">>>brand distributionReservationStockarticleEntities 长度 {} ", distributionReservationStockarticleEntities.size());
if (Func.isNotEmpty(distributionReservationStockarticleEntities)) { if (Func.isNotEmpty(distributionReservationStockarticleEntities)) {
log.info(">>>brand 进入 长度 {} ",distributionReservationStockarticleEntities); log.info(">>>brand 进入 长度 {} ", distributionReservationStockarticleEntities);
//存在订单 //存在订单
List<Long> orderIds = distributionReservationStockarticleEntities.stream().filter(f -> f.getIsZero().equals(IsOrNoConstant.no.getValue())).map(DistributionReservationStockarticleEntity::getStockArticleId).collect(Collectors.toList()); List<Long> orderIds = distributionReservationStockarticleEntities.stream().filter(f -> f.getIsZero().equals(IsOrNoConstant.no.getValue())).map(DistributionReservationStockarticleEntity::getStockArticleId).collect(Collectors.toList());
log.info(">>>brand 进入 orderIds {} ",orderIds); log.info(">>>brand 进入 orderIds {} ", orderIds);
List<DistributionStockArticleEntity> distributionStockArticleEntities = distributionStockArticleService.listByIds(orderIds); List<DistributionStockArticleEntity> distributionStockArticleEntities = distributionStockArticleService.listByIds(orderIds);
log.info(">>>brand 进入 distributionStockArticleEntities {} ",distributionStockArticleEntities); log.info(">>>brand 进入 distributionStockArticleEntities {} ", distributionStockArticleEntities);
if (Func.isNotEmpty(distributionStockArticleEntities)) { if (Func.isNotEmpty(distributionStockArticleEntities)) {
String[] split = Func.split(brands, ","); String[] split = Func.split(brands, ",");
log.info(">>>brand 进入 split {} ",split); log.info(">>>brand 进入 split {} ", (Object) split);
//包件信息列表 //包件信息列表
brand = handkeBrandsPackageList(split, distributionStockArticleEntities, warehouseName, distributionReservationEntity.getId(), distributionDeliveryListEntity.getOrderCode(), warehouseId); brand = handkeBrandsPackageList(split, distributionStockArticleEntities, warehouseName, distributionReservationEntity.getId(), distributionDeliveryListEntity.getOrderCode(), warehouseId);
} }
log.info(">>>brand 进入 {} ",brand); log.info(">>>brand 进入 {} ", brand);
} }
@ -1541,7 +1528,8 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
log.info(">>>>>>>>>>>>>>> 文员复核推送 品牌 {} ", brand); log.info(">>>>>>>>>>>>>>> 文员复核推送 品牌 {} ", brand);
if (Func.isNotEmpty(brand.get("梦天"))) { assert brand != null;
if (Func.isNotEmpty(brand.get("梦天"))) {
mtReceiveDTO.setReceiveContentList(brand.get("梦天")); mtReceiveDTO.setReceiveContentList(brand.get("梦天"));
orderMainClinet.sendReceiveInfoByNewSystem(mtReceiveDTO); orderMainClinet.sendReceiveInfoByNewSystem(mtReceiveDTO);
} }
@ -1557,26 +1545,23 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
for (DistributionParcelListEntity distributionParcelListEntity : distributionParcelListEntities) { for (DistributionParcelListEntity distributionParcelListEntity : distributionParcelListEntities) {
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>distributionParcelListEntities: {}",distributionParcelListEntities); log.info(">>>>>>>>>>>>>>>>>>>>>>>>>distributionParcelListEntities: {}", distributionParcelListEntities);
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>distributionParcelListEntity: {}",distributionParcelListEntity); log.info(">>>>>>>>>>>>>>>>>>>>>>>>>distributionParcelListEntity: {}", distributionParcelListEntity);
// todo 查询签收信息 // todo 查询签收信息
DistributionSignforEntity distributionSignfor = distributionSignforService.getByReservationId(distributionReservationStockarticleEntity.getReservationId()); DistributionSignforEntity distributionSignfor = distributionSignforService.getByReservationId(distributionReservationStockarticleEntity.getReservationId());
OrderStatusDTO orderStatusDTO = new OrderStatusDTO(); OrderStatusDTO orderStatusDTO = new OrderStatusDTO();
orderStatusDTO.setUnitNo(distributionParcelListEntity.getOrderPackageCode()); //单号 orderStatusDTO.setUnitNo(distributionParcelListEntity.getOrderPackageCode()); //单号
orderStatusDTO.setUsername(distributionSignfor.getSigneeName()); //操作人名称 orderStatusDTO.setUsername(distributionSignfor.getSigneeName()); //操作人名称
orderStatusDTO.setStatus("7"); orderStatusDTO.setStatus("7");
orderStatusDTO.setOperationTime(distributionSignfor.getSigningTime()); //时间 orderStatusDTO.setOperationTime(distributionSignfor.getSigningTime()); //时间
ouPaiFactoryClinet.newSystemHandleStatusData(orderStatusDTO); ouPaiFactoryClinet.newSystemHandleStatusData(orderStatusDTO);
log.info(">>>>>>>>>>>>>>>>>进入newSystemHandleStatusData orderStatusDTO值 :{}",orderStatusDTO); log.info(">>>>>>>>>>>>>>>>>进入newSystemHandleStatusData orderStatusDTO值 :{}", orderStatusDTO);
} }
} }
// orderMainClinet.sendReceiveInfoByNewSystem(mtReceiveDTO); // orderMainClinet.sendReceiveInfoByNewSystem(mtReceiveDTO);
} }
@ -1589,11 +1574,13 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
} }
//TODO 需要测试 //TODO 需要测试
/** /**
* 根据预约单查询预约单下面的订单下面的包件 * 根据预约单查询预约单下面的订单下面的包件
* 并且状态为已签收的包件 * 并且状态为已签收的包件
*
* @param distributionReservationStockarticleEntity * @param distributionReservationStockarticleEntity
* @return List<DistributionParcelListEntity> * @return List<DistributionParcelListEntity>
*/ */
private List<DistributionParcelListEntity> buildOpByReservationId(DistributionReservationStockarticleEntity distributionReservationStockarticleEntity) { private List<DistributionParcelListEntity> buildOpByReservationId(DistributionReservationStockarticleEntity distributionReservationStockarticleEntity) {
Long stockArticleId = distributionReservationStockarticleEntity.getStockArticleId();//订单id Long stockArticleId = distributionReservationStockarticleEntity.getStockArticleId();//订单id
@ -1635,14 +1622,14 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
.distinct().collect(Collectors.joining(",")); .distinct().collect(Collectors.joining(","));
distributionStockArticleService.maintenanceOrderInfo(orderCodes, warehouseId); distributionStockArticleService.maintenanceOrderInfo(orderCodes, warehouseId);
log.info(">>>>>> updatePackageDeliveryStatus,{}, {}",reservationId,packageIds); log.info(">>>>>> updatePackageDeliveryStatus,{}, {}", reservationId, packageIds);
//完成对该客户下此包件任务的取消 //完成对该客户下此包件任务的取消
int row = distributionReservationMapper.updatePackageDeliveryStatus(reservationId, packageIds); int row = distributionReservationMapper.updatePackageDeliveryStatus(reservationId, packageIds);
//TODO 欠缺零担的资源释放 //TODO 欠缺零担的资源释放
//维护预约订单状态 //维护预约订单状态
distributionReservationStockarticleService.maintenanceReservationStockArticle(reservationId,warehouseId); distributionReservationStockarticleService.maintenanceReservationStockArticle(reservationId, warehouseId);
} }
//存在库存品信息 //存在库存品信息
@ -1677,37 +1664,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
} }
private Map<String,List<MtReceiveContentDTO>> handkeBrandsPackageList(String[] split, List<DistributionStockArticleEntity> distributionStockArticleEntities, Long warehouseId,Long reservationId,String deliveryCode) {
Map<String,List<MtReceiveContentDTO>> packageList = new HashMap<>();
Map<String, List<DistributionStockArticleEntity>> orderMap = distributionStockArticleEntities.stream().collect(Collectors.groupingBy(DistributionStockArticleEntity::getBrand));
for (String s : split) {
orderMap.forEach((k,v)->{
if (k.equals(s)){
List<MtReceiveContentDTO> mtReceiveContentDTOS = new ArrayList<>();
for (DistributionStockArticleEntity distributionStockArticleEntity : v) {
List<DistributionParcelListEntity> distributionParcelListEntities = distributionReservationMapper.selectPackageByReservationAndStockArticle(reservationId, distributionStockArticleEntity.getId(),warehouseId);
for (DistributionParcelListEntity distributionParcelListEntity : distributionParcelListEntities) {
if (distributionParcelListEntity.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue())){
String signingTime = distributionLoadscanMapper.selectPackageSigningTime(distributionParcelListEntity.getId());
MtReceiveContentDTO mtReceiveContentDTO = new MtReceiveContentDTO();
//查询签收时间
mtReceiveContentDTO.setWarehouse(warehouseId.toString());//仓库Id
mtReceiveContentDTO.setOrderCode(distributionStockArticleEntity.getOrderCode());//仓库Id
mtReceiveContentDTO.setUnitNo(distributionParcelListEntity.getOrderPackageCode());//仓库Id
mtReceiveContentDTO.setOperateDate(signingTime);//操作时间
mtReceiveContentDTO.setInvoiceOrderCode(deliveryCode);//发货编号
mtReceiveContentDTOS.add(mtReceiveContentDTO);
}
}
}
packageList.put(s,mtReceiveContentDTOS);
}
});
}
return packageList;
}
/** /**
* 定制品 修改备货时间 * 定制品 修改备货时间
@ -1723,7 +1680,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
Long stockupId = stockupDTO.getStockupId(); Long stockupId = stockupDTO.getStockupId();
//修改包件备货状态 //修改包件备货状态
DistributionParcelListEntity one = distributionParcelListService.getOne(Wrappers.<DistributionParcelListEntity>query().lambda() DistributionParcelListEntity one = distributionParcelListService.getOne(Wrappers.<DistributionParcelListEntity>query().lambda()
.eq(DistributionParcelListEntity::getOrderPackageCode, stockupDTO.getPacketBarCode()) .eq(DistributionParcelListEntity::getOrderPackageCode, stockupDTO.getPacketBarCode())
); );
//修改包件备货状态 //修改包件备货状态
DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity();
@ -2096,7 +2053,7 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
} }
boolean apj = false; boolean apj = false;
if (list.size() > 0) { if (!list.isEmpty()) {
//查询包件数量 //查询包件数量
// list.forEach(i -> { // list.forEach(i -> {
// List<DistributionParcelListEntity> list1 = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda() // List<DistributionParcelListEntity> list1 = distributionParcelListService.list(Wrappers.<DistributionParcelListEntity>query().lambda()
@ -2312,16 +2269,13 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, id)); List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, id));
boolean flag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageReservationStatus().equals(OrderPackageReservationStatusConstant.yiyueyue.getValue())); boolean flag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageReservationStatus().equals(OrderPackageReservationStatusConstant.yiyueyue.getValue()));
if (flag && stockArticleEntity.getTotalNumber() == parcelListEntityList.size()) { if (flag && stockArticleEntity.getTotalNumber() == parcelListEntityList.size()) {
assert stockArticleEntity != null; stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
} else { } else {
flag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageReservationStatus().equals(OrderPackageReservationStatusConstant.daiyuyue.getValue())); flag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageReservationStatus().equals(OrderPackageReservationStatusConstant.daiyuyue.getValue()));
if (flag) { if (flag) {
assert stockArticleEntity != null; stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.daiyuyue.getValue());
stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.daiyuyue.getValue());
} else { } else {
assert stockArticleEntity != null; stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.bufenyuyue.getValue());
stockArticleEntity.setReservationStatus(OrderReservationStatusConstant.bufenyuyue.getValue());
} }
} }
} else { } else {
@ -2618,14 +2572,13 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
//修改 //修改
} }
} else { } else {
if (i == 0) { distributionStockup.setId(stockupDTO.getStockupId());
if (i == 0) {
//修改备货状态 //修改备货状态
distributionStockup.setId(stockupDTO.getStockupId()); distributionStockup.setStockupStatus(StockupStatusConstant.yibeihuo.getValue());
distributionStockup.setStockupStatus(StockupStatusConstant.yibeihuo.getValue());
} else { } else {
//修改备货状态 //修改备货状态
distributionStockup.setId(stockupDTO.getStockupId()); distributionStockup.setStockupStatus(StockupStatusConstant.beihuozhong.getValue());
distributionStockup.setStockupStatus(StockupStatusConstant.beihuozhong.getValue());
} }
} }

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

@ -32,22 +32,17 @@ import com.logpm.distribution.vo.app.DistributionAppParcelListVO;
import com.logpm.distribution.vo.app.DistributionAppStockArticleVO; import com.logpm.distribution.vo.app.DistributionAppStockArticleVO;
import com.logpm.distribution.wrapper.DistributionDisStockListWrapper; import com.logpm.distribution.wrapper.DistributionDisStockListWrapper;
import com.logpm.distribution.wrapper.DistributionParcelListWrapper; import com.logpm.distribution.wrapper.DistributionParcelListWrapper;
import com.logpm.distribution.wrapper.DistributionStockArticleWrapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.common.IsOrNoConstant; import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.loading.LoadingStatusConstant; import org.springblade.common.constant.loading.LoadingStatusConstant;
import org.springblade.common.constant.order.OrderStatusConstant; import org.springblade.common.constant.order.OrderStatusConstant;
import org.springblade.common.constant.orderpackage.OrderPackageLoadingStatusConstant; import org.springblade.common.constant.orderpackage.OrderPackageLoadingStatusConstant;
import org.springblade.common.constant.reservation.ReservationOrderStatusConstant;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.common.serviceConstant.ServiceConstant;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -117,7 +112,6 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl<Distrib
} }
List<DistributionParcelListEntity> parcelListEntityList = baseMapper.selectDistributionDeliverywrapInfoPage(page, reservationPackageDTO); List<DistributionParcelListEntity> parcelListEntityList = baseMapper.selectDistributionDeliverywrapInfoPage(page, reservationPackageDTO);
List<DistributionParcelListVO> parcelListVOS = DistributionParcelListWrapper.build().listVO(parcelListEntityList); List<DistributionParcelListVO> parcelListVOS = DistributionParcelListWrapper.build().listVO(parcelListEntityList);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
parcelListVOS.forEach(p -> { parcelListVOS.forEach(p -> {
//查询扫描表, //查询扫描表,
DistributionLoadscanEntity loadscanEntity = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getPackageId, p.getId()).eq(DistributionLoadscanEntity::getOrderPackageCode, p.getOrderPackageCode())); DistributionLoadscanEntity loadscanEntity = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getPackageId, p.getId()).eq(DistributionLoadscanEntity::getOrderPackageCode, p.getOrderPackageCode()));
@ -334,7 +328,7 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl<Distrib
if (Func.isNotEmpty(loadingPackage.get(parcelNumberVO.getParcelListId()))) { if (Func.isNotEmpty(loadingPackage.get(parcelNumberVO.getParcelListId()))) {
DistributionLoadscanEntity loadscanEntity = loadingPackage.get(parcelNumberVO.getParcelListId()); DistributionLoadscanEntity loadscanEntity = loadingPackage.get(parcelNumberVO.getParcelListId());
appParcelListVO.setLoadingNum(loadscanEntity.getLoadedNub()); appParcelListVO.setLoadingNum(loadscanEntity.getLoadedNub());
if (loadscanEntity.getLoadedNub() == parcelNumberVO.getReservationNum()) { if (Objects.equals(loadscanEntity.getLoadedNub(), parcelNumberVO.getReservationNum())) {
//装车数量和计划数量一致,标识该零担订单完成装车 //装车数量和计划数量一致,标识该零担订单完成装车
appParcelListVO.setScanStatus(2); appParcelListVO.setScanStatus(2);
appParcelListVO.setIsScan("齐套"); appParcelListVO.setIsScan("齐套");
@ -400,12 +394,14 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl<Distrib
for (DistributionLoadscanEntity loadscanEntity : v) { for (DistributionLoadscanEntity loadscanEntity : v) {
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(loadscanEntity.getPackageId()); DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(loadscanEntity.getPackageId());
DistributionAppParcelListVO parcelListVO = Func.copy(parcelListEntity, DistributionAppParcelListVO.class); DistributionAppParcelListVO parcelListVO = Func.copy(parcelListEntity, DistributionAppParcelListVO.class);
parcelListVO.setScanStatus(3); assert parcelListVO != null;
parcelListVO.setScanStatus(3);
parcelListVO.setIsScan("异常"); parcelListVO.setIsScan("异常");
loadingNum.getAndAdd(parcelListEntity.getQuantity()); loadingNum.getAndAdd(parcelListEntity.getQuantity());
distributionAppParcelListVOS.add(parcelListVO); distributionAppParcelListVOS.add(parcelListVO);
} }
appStockArticleVO.setIsZero(stockArticleEntity.getIsZero()); assert appStockArticleVO != null;
appStockArticleVO.setIsZero(stockArticleEntity.getIsZero());
appStockArticleVO.setLoadingNub(loadingNum.get()); appStockArticleVO.setLoadingNub(loadingNum.get());
appStockArticleVO.setIsHaveAbnormalPackage(2); appStockArticleVO.setIsHaveAbnormalPackage(2);
appStockArticleVO.setIsHaveAbnormalPackageName("整单异常"); appStockArticleVO.setIsHaveAbnormalPackageName("整单异常");
@ -483,7 +479,7 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl<Distrib
List<DistributionStockListEntity> distributionStockListEntities = distributionStockListService.listByIds(stockListIds); List<DistributionStockListEntity> distributionStockListEntities = distributionStockListService.listByIds(stockListIds);
Map<Long, DistributionStockListEntity> stockListMap = distributionStockListEntities.stream().collect(Collectors.toMap(DistributionStockListEntity::getId, Function.identity(), (k1, k2) -> k2)); Map<Long, DistributionStockListEntity> stockListMap = distributionStockListEntities.stream().collect(Collectors.toMap(DistributionStockListEntity::getId, Function.identity(), (k1, k2) -> k2));
List<DisStockListDetailVO> disStockListDetailVOS = DistributionDisStockListWrapper.build().listVO(inventoryList); List<DisStockListDetailVO> disStockListDetailVOS = DistributionDisStockListWrapper.build().listVO(inventoryList);
disStockListDetailVOS.stream().forEach(sd -> { disStockListDetailVOS.forEach(sd -> {
//查询一次装车 如果装车了那么 //查询一次装车 如果装车了那么
DistributionLoadscaninvnEntity serviceOne = distributionLoadscaninvnService.getOne(Wrappers.<DistributionLoadscaninvnEntity>query().lambda() DistributionLoadscaninvnEntity serviceOne = distributionLoadscaninvnService.getOne(Wrappers.<DistributionLoadscaninvnEntity>query().lambda()
.eq(DistributionLoadscaninvnEntity::getReservationId, distributionAppDeliveryListDTO.getReservationId()) .eq(DistributionLoadscaninvnEntity::getReservationId, distributionAppDeliveryListDTO.getReservationId())

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

@ -758,7 +758,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()).ne(DistributionLoadscanEntity::getScanStatus, 1).eq(DistributionLoadscanEntity::getTrayNo, distrilbutionloadingscanDTO.getBarcode())); List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()).ne(DistributionLoadscanEntity::getScanStatus, 1).eq(DistributionLoadscanEntity::getTrayNo, distrilbutionloadingscanDTO.getBarcode()));
boolean trayLoadingStatus = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); boolean trayLoadingStatus = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue()));
log.info("#########!!!!!!!!!!!!!!!!!--------- 333333333 trayLoadingStatus={} loadscanEntityList={}", trayLoadingStatus, loadscanEntityList); log.info("#########!!!!!!!!!!!!!!!!!--------- 333333333 trayLoadingStatus={} loadscanEntityList={}", trayLoadingStatus, loadscanEntityList);
if (Func.isNotEmpty(loadscanEntityList) && loadscanEntityList.size() > 0 && trayLoadingStatus) { if (Func.isNotEmpty(loadscanEntityList) && !loadscanEntityList.isEmpty() && trayLoadingStatus) {
return Resp.scanFail("重复扫描", "重复扫描"); return Resp.scanFail("重复扫描", "重复扫描");
} }
log.info("#########!!!!!!!!!!!!!!!!!--------- 444444444 parcelListEntities={}", parcelListEntities); log.info("#########!!!!!!!!!!!!!!!!!--------- 444444444 parcelListEntities={}", parcelListEntities);
@ -869,9 +869,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
// String str = getLoadingMsg(distrilbutionloadingscanDTO); // String str = getLoadingMsg(distrilbutionloadingscanDTO);
Integer carLaodNum = getCarLaodNum(distrilbutionloadingscanDTO.getDeliveryId()); Integer carLaodNum = getCarLaodNum(distrilbutionloadingscanDTO.getDeliveryId());
StringBuilder str = new StringBuilder(); return Resp.scanSuccessWithData("装车成功", "装车" + carLaodNum + "件", carLaodNum);
str.append("装车").append(carLaodNum + "件");
return Resp.scanSuccessWithData("装车成功", str.toString(), carLaodNum);
} }
private void extracteOrderPackageStatus(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO, DistributionParcelListEntity parcelListEntity, BasicdataWarehouseEntity myCurrentWarehouse, DistributionReservationEntity reservationEntity) { private void extracteOrderPackageStatus(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO, DistributionParcelListEntity parcelListEntity, BasicdataWarehouseEntity myCurrentWarehouse, DistributionReservationEntity reservationEntity) {
@ -1051,9 +1049,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
@NotNull @NotNull
private String getLoadingMsg(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { private String getLoadingMsg(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) {
StringBuilder str = new StringBuilder(); return "装车" + getCarLaodNum(distrilbutionloadingscanDTO.getDeliveryId()) + "件";
str.append("装车").append(getCarLaodNum(distrilbutionloadingscanDTO.getDeliveryId()) + "件");
return str.toString();
} }
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@ -1706,7 +1702,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
BigDecimal outboundQuantity = new BigDecimal(parcelNumberVO.getOutboundQuantity()); BigDecimal outboundQuantity = new BigDecimal(parcelNumberVO.getOutboundQuantity());
BigDecimal deliveryQuantity = new BigDecimal(parcelNumberVO.getDeliveryQuantity()); BigDecimal deliveryQuantity = new BigDecimal(parcelNumberVO.getDeliveryQuantity());
int handNum = handQuantity.subtract(reservationNum).intValue(); int handNum = handQuantity.subtract(reservationNum).intValue();
parcelNumberEntity.setHandQuantity(handNum); assert parcelNumberEntity != null;
parcelNumberEntity.setHandQuantity(handNum);
int outboundNum = outboundQuantity.add(reservationNum).intValue(); int outboundNum = outboundQuantity.add(reservationNum).intValue();
parcelNumberEntity.setOutboundQuantity(outboundNum); parcelNumberEntity.setOutboundQuantity(outboundNum);
parcelNumberEntity.setDeliveryQuantity(deliveryQuantity.subtract(reservationNum).intValue()); parcelNumberEntity.setDeliveryQuantity(deliveryQuantity.subtract(reservationNum).intValue());
@ -2401,7 +2398,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionStockArticleVOS.add(distributionStockArticleVO); distributionStockArticleVOS.add(distributionStockArticleVO);
}); });
} }
deliveryListVO.setStockArticleList(distributionStockArticleVOS); assert deliveryListVO != null;
deliveryListVO.setStockArticleList(distributionStockArticleVOS);
} else { } else {
log.error("##############配送任务查询异常,查询ID为:{}", id); log.error("##############配送任务查询异常,查询ID为:{}", id);
return null; return null;
@ -4067,11 +4065,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//配送任务重新设置司机名称 //配送任务重新设置司机名称
deliveryListEntity.setKind(ServiceConstant.DELIVERLIST_KIND_SELF); deliveryListEntity.setKind(ServiceConstant.DELIVERLIST_KIND_SELF);
if (Func.isEmpty(driverNames)) { if (Func.isEmpty(driverNames)) {
log.error("###################司机为空:()", driverNames); log.error("###################司机为空:{}", driverNames);
throw new RuntimeException("请选择司机!!"); throw new RuntimeException("请选择司机!!");
} }
if (Func.isEmpty(driverNames)) { if (Func.isEmpty(driverNames)) {
log.error("###################车辆为空:()", vehicleNubs); log.error("###################车辆为空:{}", vehicleNubs);
throw new RuntimeException("请选择车辆!!"); throw new RuntimeException("请选择车辆!!");
} }
deliveryListEntity.setDriverName(driverNames.deleteCharAt(driverNames.length() - 1).toString()); deliveryListEntity.setDriverName(driverNames.deleteCharAt(driverNames.length() - 1).toString());
@ -4133,7 +4131,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
if (Func.isNotEmpty(loadscanEntities)) { if (Func.isNotEmpty(loadscanEntities)) {
loadingDataMap = loadscanEntities.stream().collect(Collectors.toMap(DistributionLoadscanEntity::getPackageId, Function.identity(), (k1, k2) -> k2)); loadingDataMap = loadscanEntities.stream().collect(Collectors.toMap(DistributionLoadscanEntity::getPackageId, Function.identity(), (k1, k2) -> k2));
} }
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
ArrayList<DistributionParcelListVO> distributionParcelListVOS = new ArrayList<>(); ArrayList<DistributionParcelListVO> distributionParcelListVOS = new ArrayList<>();
if (Func.isNotEmpty(reservationStockarticleEntityList)) { if (Func.isNotEmpty(reservationStockarticleEntityList)) {
List<Long> orderIds = reservationStockarticleEntityList.stream().filter(order -> order.getIsZero().equals(IsOrNoConstant.no.getValue())).map(DistributionReservationStockarticleEntity::getStockArticleId).collect(Collectors.toList()); List<Long> orderIds = reservationStockarticleEntityList.stream().filter(order -> order.getIsZero().equals(IsOrNoConstant.no.getValue())).map(DistributionReservationStockarticleEntity::getStockArticleId).collect(Collectors.toList());
@ -4359,7 +4356,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
@Override @Override
public IPage<DistributionStockArticleVO> selectDiscussStockArticleInfoList(Map<String, Object> params, Query query, Long deliveryListId) { public IPage<DistributionStockArticleVO> selectDiscussStockArticleInfoList(Map<String, Object> params, Query query, Long deliveryListId) {
IPage<DistributionStockArticleVO> page = Condition.getPage(query);
//这里还需要查询出该配送任务下的订单信息,在进行编辑的时候进行回显 //这里还需要查询出该配送任务下的订单信息,在进行编辑的时候进行回显
// String deliveryId = (String) params.get("deliveryId"); // String deliveryId = (String) params.get("deliveryId");
//查询出配送任务下的订单 //查询出配送任务下的订单
@ -5862,14 +5858,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
if (Func.isNotEmpty(zeroLoadscanEntity)) { if (Func.isNotEmpty(zeroLoadscanEntity)) {
//存在装车数据 //存在装车数据
int num = zeroLoadscanEntity.getLoadedNub() - retentionQuantity; int num = zeroLoadscanEntity.getLoadedNub() - retentionQuantity;
if (num > 0) { zeroLoadscanEntity.setLoadedNub(0);
zeroLoadscanEntity.setLoadedNub(0); zeroLoadscanEntity.setPackageNub(0);
zeroLoadscanEntity.setPackageNub(0); if (num <= 0) {
} else { zeroLoadscanEntity.setScanStatus(LoadingStatusConstant.quxiao.getValue());
zeroLoadscanEntity.setLoadedNub(0); }
zeroLoadscanEntity.setPackageNub(0);
zeroLoadscanEntity.setScanStatus(LoadingStatusConstant.quxiao.getValue());
}
distributionLoadscanService.updateById(zeroLoadscanEntity); distributionLoadscanService.updateById(zeroLoadscanEntity);
//扣减装车数量 //扣减装车数量
int a = distributionSignforMapper.deductionLoadingPacjageNum(zeroLoadscanEntity.getReservationId(), zeroLoadscanEntity.getDeliveryId(), retentionQuantity); int a = distributionSignforMapper.deductionLoadingPacjageNum(zeroLoadscanEntity.getReservationId(), zeroLoadscanEntity.getDeliveryId(), retentionQuantity);
@ -6304,7 +6297,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
// 通过预约单查询预约下面的订单 --1 或者 库存品 --2 // 通过预约单查询预约下面的订单 --1 或者 库存品 --2
List<Map<String, Object>> spaclStockList = buildSpaclOrders(distributionReservationEntity, 2); List<Map<String, Object>> spaclStockList = buildSpaclOrders(distributionReservationEntity, 2);
if (spaclStockList.size() > 0 && !spaclStockList.isEmpty()) { if (!spaclStockList.isEmpty() ) {
map.put("库存品集合", spaclStockList); map.put("库存品集合", spaclStockList);
Integer spaclStockNum = 0; Integer spaclStockNum = 0;
for (Map<String, Object> m : spaclStockList) { for (Map<String, Object> m : spaclStockList) {
@ -6640,13 +6633,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
} else { } else {
n = String.valueOf(anInt + 1); n = String.valueOf(anInt + 1);
} }
bladeRedis.set(s, n); }
return n;
} else { return n;
bladeRedis.set(s, n); }
return n;
}
}
/** /**
* 工单查询配送数据 * 工单查询配送数据
@ -6755,6 +6745,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
if (loadingNum == 0) { if (loadingNum == 0) {
deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.weizhuangche.getValue()); deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.weizhuangche.getValue());
} }
} else { } else {
log.error(method + "查询配送无计划数量,deliveryId:{}", deliveryId); log.error(method + "查询配送无计划数量,deliveryId:{}", deliveryId);
} }

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

@ -44,8 +44,6 @@ import com.logpm.distribution.wrapper.DistributionDisStockListWrapper;
import com.logpm.distribution.wrapper.DistributionParcelListAppWrapper; import com.logpm.distribution.wrapper.DistributionParcelListAppWrapper;
import com.logpm.distribution.wrapper.DistributionParcelListWrapper; import com.logpm.distribution.wrapper.DistributionParcelListWrapper;
import com.logpm.distribution.wrapper.DistributionStockArticleWrapper; import com.logpm.distribution.wrapper.DistributionStockArticleWrapper;
import com.logpm.factory.comfac.dto.OrderStatusDTO;
import com.logpm.factory.oupai.feign.IOuPaiFactoryClinet;
import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient; import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@ -54,7 +52,6 @@ import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.DistributionTypeConstant; import org.springblade.common.constant.DistributionTypeConstant;
import org.springblade.common.constant.Inventory.InventoryLoadingStatusConstant; import org.springblade.common.constant.Inventory.InventoryLoadingStatusConstant;
import org.springblade.common.constant.Inventory.InventorySigningStatusConstant; import org.springblade.common.constant.Inventory.InventorySigningStatusConstant;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.common.constant.RabbitConstant; import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.constant.common.IsOrNoConstant; import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.delivery.DeliveryStatusConstant; import org.springblade.common.constant.delivery.DeliveryStatusConstant;
@ -72,7 +69,6 @@ import org.springblade.common.utils.CommonUtil;
import org.springblade.common.utils.FileUtil; import org.springblade.common.utils.FileUtil;
import org.springblade.common.utils.GaoDeApiUtil; import org.springblade.common.utils.GaoDeApiUtil;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -80,8 +76,6 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil; 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.amqp.AmqpException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -102,8 +96,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static net.sf.jsqlparser.util.validation.metadata.NamedObject.user;
/** /**
* 签收管理 服务实现类 * 签收管理 服务实现类
* *
@ -360,7 +352,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
if (Func.isNotEmpty(disStockListDetailEntities)) { if (Func.isNotEmpty(disStockListDetailEntities)) {
List<DistributionNumberDetailDTO> inventoryNumberDetail = deliverySigningInventoryNumberDetail(disStockListDetailEntities); List<DistributionNumberDetailDTO> inventoryNumberDetail = deliverySigningInventoryNumberDetail(disStockListDetailEntities);
if (Func.isNotEmpty(inventoryNumberDetail)) { if (Func.isNotEmpty(inventoryNumberDetail)) {
detailDTOS.addAll(inventoryNumberDetail); assert inventoryNumberDetail != null;
detailDTOS.addAll(inventoryNumberDetail);
} }
} }
//签收数量 //签收数量
@ -1861,12 +1854,11 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionLoadscanEntity.setSigningUserId(AuthUtil.getUser().getUserId()); distributionLoadscanEntity.setSigningUserId(AuthUtil.getUser().getUserId());
if (Func.isEmpty(loadscanEntity)){ if (Func.isEmpty(loadscanEntity)){
distributionLoadscanService.save(distributionLoadscanEntity); distributionLoadscanService.save(distributionLoadscanEntity);
Integer j = distributionSignforMapper.updateSignforNum(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); }else {
}else {
distributionLoadscanService.updateById(distributionLoadscanEntity); distributionLoadscanService.updateById(distributionLoadscanEntity);
Integer j = distributionSignforMapper.updateSignforNum(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); }
} Integer j = distributionSignforMapper.updateSignforNum(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub());
//进行签收数量的修改 //进行签收数量的修改
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
//修改包件装车、签收状态 //修改包件装车、签收状态
} else { } else {
@ -2226,7 +2218,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
// distributionAsyncService.checkSignStatus(null, distributionLoadscaninvnEntity.getReservationId(),distributionLoadscaninvnEntity.getDeliveryId()); // distributionAsyncService.checkSignStatus(null, distributionLoadscaninvnEntity.getReservationId(),distributionLoadscaninvnEntity.getDeliveryId());
} }
} else if (inventory.size() == 0) { } else if (inventory.isEmpty()) {
//这里就需要查询整个配送计划是否存在该码值的库存品包件 //这里就需要查询整个配送计划是否存在该码值的库存品包件
List<DisStockListDetailEntity> listDetailEntities = distributionDeliveryListMapper.selectInventoryListByDeliveryListId(distrilbutionloadingscanDTO.getReservationId()); List<DisStockListDetailEntity> listDetailEntities = distributionDeliveryListMapper.selectInventoryListByDeliveryListId(distrilbutionloadingscanDTO.getReservationId());
List<DisStockListDetailEntity> deliveryInventory = listDetailEntities.stream().filter(inv -> inv.getStockPackageCode().equals(distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList()); List<DisStockListDetailEntity> deliveryInventory = listDetailEntities.stream().filter(inv -> inv.getStockPackageCode().equals(distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList());
@ -2887,7 +2879,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
} }
} }
} else { } else {
log.error("################库存品未进行备货操作+{}" + detailEntities); log.error("################库存品未进行备货操作+{}" , detailEntities);
return R.fail("库存品未进行备货操作"); return R.fail("库存品未进行备货操作");
} }
} }
@ -3507,34 +3499,12 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
reservationStockarticleEntity.setReservationNum(reservationStockarticleEntity.getReservationNum() + distributionLoadscanAbnormalEntity.getLoadingQuantity()); reservationStockarticleEntity.setReservationNum(reservationStockarticleEntity.getReservationNum() + distributionLoadscanAbnormalEntity.getLoadingQuantity());
distributionReservationStockarticleService.updateById(reservationStockarticleEntity); distributionReservationStockarticleService.updateById(reservationStockarticleEntity);
} else { } else {
//不存在该订单 extracted(distributionLoadscanAbnormalEntity, reservationEntity);
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity();
reservationStockarticleEntity.setReservationNum(distributionLoadscanAbnormalEntity.getLoadingQuantity());
reservationStockarticleEntity.setStockArticleId(distributionLoadscanAbnormalEntity.getStockArticleId());
reservationStockarticleEntity.setReservationId(distributionLoadscanAbnormalEntity.getReservationId());
reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.zengjia.getValue());
distributionReservationStockarticleService.save(reservationStockarticleEntity);
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(reservationStockarticleEntity.getStockArticleId());
reservationEntity.setStockArticleId(reservationEntity.getStockArticleId() + stockArticleEntity.getOrderCode());
} }
//构建新包件信息 //构建新包件信息
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); extractedBuildNewPackage(reservationEntity, distributionLoadscanAbnormalEntity);
reservationPackageEntity.setReservationId(reservationEntity.getId());
reservationPackageEntity.setPacketBarStatus(ReservationOrderStatusConstant.zengjia.getValue());
reservationPackageEntity.setParceListId(distributionLoadscanAbnormalEntity.getPackageId());
reservationPackageEntity.setPacketBarCode(distributionLoadscanAbnormalEntity.getPackageCode());
reservationPackageEntity.setStockArticleId(distributionLoadscanAbnormalEntity.getStockArticleId());
distributionReservationPackageService.save(reservationPackageEntity);
//维护包件的预约状态
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(distributionLoadscanAbnormalEntity.getPackageId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(parcelListEntity);
distributionLoadscanAbnormalEntity.setAuditingStatus(2);
distributionLoadscanAbnormalEntity.setAuditingTime(new Date());
distributionLoadscanAbnormalEntity.setAuditingUser(AuthUtil.getUser().getNickName());
distributionLoadscanAbnormalService.updateById(distributionLoadscanAbnormalEntity);
reservationEntity.setReservationNum(reservationEntity.getReservationNum() + distributionLoadscanAbnormalEntity.getLoadingQuantity());
distributionReservationMapper.updateById(reservationEntity);
DistributionLoadscanEntity loadscanEntity = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda() DistributionLoadscanEntity loadscanEntity = distributionLoadscanService.getOne(Wrappers.<DistributionLoadscanEntity>query().lambda()
.eq(DistributionLoadscanEntity::getReservationId, distributionLoadscanAbnormalEntity.getReservationId()) .eq(DistributionLoadscanEntity::getReservationId, distributionLoadscanAbnormalEntity.getReservationId())
.eq(DistributionLoadscanEntity::getDeliveryId, distributionLoadscanAbnormalEntity.getDeliveryListId()) .eq(DistributionLoadscanEntity::getDeliveryId, distributionLoadscanAbnormalEntity.getDeliveryListId())
@ -3553,7 +3523,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
} else { } else {
//过滤出未审核的异常包件 //过滤出未审核的异常包件
List<DistributionLoadscanAbnormalEntity> loadscanAbnormalEntities = distributionLoadscanAbnormalEntities.stream().filter(a -> a.getAuditingStatus().equals(1)).collect(Collectors.toList()); List<DistributionLoadscanAbnormalEntity> loadscanAbnormalEntities = distributionLoadscanAbnormalEntities.stream().filter(a -> a.getAuditingStatus().equals(1)).collect(Collectors.toList());
if (loadscanAbnormalEntities.size() > 0) { if (!loadscanAbnormalEntities.isEmpty()) {
//存在有未审批的异常包件 //存在有未审批的异常包件
loadscanAbnormalEntities.forEach(a -> { loadscanAbnormalEntities.forEach(a -> {
DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(a.getReservationId()); DistributionReservationEntity reservationEntity = distributionReservationMapper.selectById(a.getReservationId());
@ -3592,23 +3562,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
} }
distributionLoadscanService.updateById(loadscanEntity); distributionLoadscanService.updateById(loadscanEntity);
//构建新包件信息 //构建新包件信息
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity(); extractedBuildNewPackage(reservationEntity, a);
reservationPackageEntity.setReservationId(reservationEntity.getId());
reservationPackageEntity.setPacketBarStatus(ReservationOrderStatusConstant.zengjia.getValue());
reservationPackageEntity.setParceListId(a.getPackageId());
reservationPackageEntity.setPacketBarCode(a.getPackageCode());
reservationPackageEntity.setStockArticleId(a.getStockArticleId());
distributionReservationPackageService.save(reservationPackageEntity);
//维护包件的预约状态
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(a.getPackageId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(parcelListEntity);
a.setAuditingStatus(2);
a.setAuditingTime(new Date());
a.setAuditingUser(AuthUtil.getUser().getNickName());
distributionLoadscanAbnormalService.updateById(a);
reservationEntity.setReservationNum(reservationEntity.getReservationNum() + a.getLoadingQuantity());
distributionReservationMapper.updateById(reservationEntity);
}); });
} else { } else {
return R.fail(3000, "无需审批"); return R.fail(3000, "无需审批");
@ -3634,6 +3588,44 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
return R.success("操作成功"); return R.success("操作成功");
} }
private void extractedBuildNewPackage(DistributionReservationEntity reservationEntity, DistributionLoadscanAbnormalEntity distributionLoadscanAbnormalEntity) {
DistributionReservationPackageEntity reservationPackageEntity = getDistributionReservationPackageEntity(reservationEntity, distributionLoadscanAbnormalEntity);
distributionReservationPackageService.save(reservationPackageEntity);
//维护包件的预约状态
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(distributionLoadscanAbnormalEntity.getPackageId());
parcelListEntity.setOrderPackageReservationStatus(OrderPackageReservationStatusConstant.yiyueyue.getValue());
distributionParcelListService.updateById(parcelListEntity);
distributionLoadscanAbnormalEntity.setAuditingStatus(2);
distributionLoadscanAbnormalEntity.setAuditingTime(new Date());
distributionLoadscanAbnormalEntity.setAuditingUser(AuthUtil.getUser().getNickName());
distributionLoadscanAbnormalService.updateById(distributionLoadscanAbnormalEntity);
reservationEntity.setReservationNum(reservationEntity.getReservationNum() + distributionLoadscanAbnormalEntity.getLoadingQuantity());
distributionReservationMapper.updateById(reservationEntity);
}
@NotNull
private static DistributionReservationPackageEntity getDistributionReservationPackageEntity(DistributionReservationEntity reservationEntity, DistributionLoadscanAbnormalEntity distributionLoadscanAbnormalEntity) {
DistributionReservationPackageEntity reservationPackageEntity = new DistributionReservationPackageEntity();
reservationPackageEntity.setReservationId(reservationEntity.getId());
reservationPackageEntity.setPacketBarStatus(ReservationOrderStatusConstant.zengjia.getValue());
reservationPackageEntity.setParceListId(distributionLoadscanAbnormalEntity.getPackageId());
reservationPackageEntity.setPacketBarCode(distributionLoadscanAbnormalEntity.getPackageCode());
reservationPackageEntity.setStockArticleId(distributionLoadscanAbnormalEntity.getStockArticleId());
return reservationPackageEntity;
}
private void extracted(DistributionLoadscanAbnormalEntity distributionLoadscanAbnormalEntity, DistributionReservationEntity reservationEntity) {
//不存在该订单
DistributionReservationStockarticleEntity reservationStockarticleEntity = new DistributionReservationStockarticleEntity();
reservationStockarticleEntity.setReservationNum(distributionLoadscanAbnormalEntity.getLoadingQuantity());
reservationStockarticleEntity.setStockArticleId(distributionLoadscanAbnormalEntity.getStockArticleId());
reservationStockarticleEntity.setReservationId(distributionLoadscanAbnormalEntity.getReservationId());
reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.zengjia.getValue());
distributionReservationStockarticleService.save(reservationStockarticleEntity);
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(reservationStockarticleEntity.getStockArticleId());
reservationEntity.setStockArticleId(reservationEntity.getStockArticleId() + stockArticleEntity.getOrderCode());
}
@Override @Override
public Map<String, List<DistributionSignPrintEntity>> prices(DistributionSignforDTO distributionSignfor) { public Map<String, List<DistributionSignPrintEntity>> prices(DistributionSignforDTO distributionSignfor) {
log.info("==========回显图片的值:{}", distributionSignfor); log.info("==========回显图片的值:{}", distributionSignfor);

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

@ -65,7 +65,6 @@ import org.springblade.common.constant.stocklist.StockStatusConstant;
import org.springblade.common.constant.stockup.StockAssignStatusConstant; import org.springblade.common.constant.stockup.StockAssignStatusConstant;
import org.springblade.common.constant.stockup.StockupStatusConstant; import org.springblade.common.constant.stockup.StockupStatusConstant;
import org.springblade.common.constant.stockup.StockupTypeConstant; import org.springblade.common.constant.stockup.StockupTypeConstant;
import org.springblade.common.constant.stockup.StockupTypeStatusConstant;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
@ -144,8 +143,6 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
@Autowired @Autowired
private IDistributionStockListService distributionStockListService; private IDistributionStockListService distributionStockListService;
@Autowired
private IDistributionStockupScanService distributionStockupScanService;
@Autowired @Autowired
private IDistrilbutionBillStockService distrilbutionBillStockService; private IDistrilbutionBillStockService distrilbutionBillStockService;

22
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

@ -328,7 +328,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
.eq(DistributionParcelListEntity::getStockArticleId, i.getStockArticleId())); .eq(DistributionParcelListEntity::getStockArticleId, i.getStockArticleId()));
int sum = list1.stream().filter(ii -> ii.getOrderPackageReservationStatus().equals(OrderPackageReservationStatusConstant.daiyuyue.getValue())).collect(Collectors.toList()).stream().mapToInt(DistributionParcelListEntity::getQuantity).sum(); int sum = list1.stream().filter(ii -> ii.getOrderPackageReservationStatus().equals(OrderPackageReservationStatusConstant.daiyuyue.getValue())).collect(Collectors.toList()).stream().mapToInt(DistributionParcelListEntity::getQuantity).sum();
if(sum == 0){ if(sum == 0){
log.debug("####{}当前订单备货包件为空,无法创建任务!"+byId.getOrderCode()); log.debug("####{}当前订单备货包件为空,无法创建任务!",byId.getOrderCode());
throw new ServiceException(byId.getOrderCode()+"当前订单备货包件为空,无法创建任务!"); throw new ServiceException(byId.getOrderCode()+"当前订单备货包件为空,无法创建任务!");
} }
} }
@ -413,7 +413,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
} }
// int i1 = byId.getHandQuantity() + byId.getSigninQuantity(); //总数 // int i1 = byId.getHandQuantity() + byId.getSigninQuantity(); //总数
if(byId.getCompleteSet().equals("2")){ if(byId.getCompleteSet()==2){
//全部 //全部
distributionStockArticle.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue()); distributionStockArticle.setReservationStatus(OrderReservationStatusConstant.yiyueyue.getValue());
@ -513,7 +513,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
.apply("packet_bar_status in ( 1 , 3 )") .apply("packet_bar_status in ( 1 , 3 )")
); );
if(!list1.isEmpty()){ if(!list1.isEmpty()){
list1.stream().forEach(ss ->{ list1.forEach(ss ->{
Optional<DistrilbutionBillPackageEntity> first1 = list.stream().filter(q -> q.getParceListId().equals(ss.getId())).findFirst(); Optional<DistrilbutionBillPackageEntity> first1 = list.stream().filter(q -> q.getParceListId().equals(ss.getId())).findFirst();
if(!first1.isPresent()){ if(!first1.isPresent()){
DistrilbutionBillPackageEntity billPackageEntity = new DistrilbutionBillPackageEntity(); DistrilbutionBillPackageEntity billPackageEntity = new DistrilbutionBillPackageEntity();
@ -654,7 +654,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}else if(i1 < 0){ }else if(i1 < 0){
//增加了 //增加了
distributionParcelNumberService.updateBillNum(i.getParcelListId(),i1,2); distributionParcelNumberService.updateBillNum(i.getParcelListId(),i1,2);
}else if(i1 == 0){ }else {
//不做操作! //不做操作!
continue; continue;
} }
@ -1302,7 +1302,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
public IPage<DistrilbutionBillLadingOwnVO> getInventoryOwn(IPage<Object> page, long id) { public IPage<DistrilbutionBillLadingOwnVO> getInventoryOwn(IPage<Object> page, long id) {
IPage<DistrilbutionBillLadingOwnVO> l = new Page<>(); IPage<DistrilbutionBillLadingOwnVO> l = new Page<>();
IPage<DistrilbutionBillLadingOwnVO> inventoryOwn = baseMapper.getInventoryOwn(page, id); IPage<DistrilbutionBillLadingOwnVO> inventoryOwn = baseMapper.getInventoryOwn(page, id);
if (inventoryOwn.getRecords().size() > 0) { if (!inventoryOwn.getRecords().isEmpty()) {
//查询库存品 //查询库存品
inventoryOwn.getRecords().forEach(i -> { inventoryOwn.getRecords().forEach(i -> {
//是否备货 //是否备货
@ -1311,15 +1311,15 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
.eq(DistributionStockupScanEntity::getStockListId, i.getId()) .eq(DistributionStockupScanEntity::getStockListId, i.getId())
); );
String s = ""; String s = "";
if (list.size() > 0 && i.getQuantity() > list.size()) { if (!list.isEmpty() && i.getQuantity() > list.size()) {
s = "备货中"; s = "备货中";
} else if (list.size() > 0 && i.getQuantity() == list.size()) { } else if (!list.isEmpty() && i.getQuantity() == list.size()) {
s = "备货完成"; s = "备货完成";
} else { } else {
s = "未备货"; s = "未备货";
} }
i.setStockUp(s); i.setStockUp(s);
i.setNumber(list.size() > 0 ? list.size() : 0); i.setNumber(Math.max(list.size(), 0));
}); });
return inventoryOwn; return inventoryOwn;
} else { } else {
@ -1357,7 +1357,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
List<DistributionDeliveryChargeEntity> list4 = distributionDeliveryChargeService.list(Wrappers.<DistributionDeliveryChargeEntity>query().lambda() List<DistributionDeliveryChargeEntity> list4 = distributionDeliveryChargeService.list(Wrappers.<DistributionDeliveryChargeEntity>query().lambda()
.eq(DistributionDeliveryChargeEntity::getBillLading, distrilbutionBillLadingEntity.getId()) .eq(DistributionDeliveryChargeEntity::getBillLading, distrilbutionBillLadingEntity.getId())
); );
detailOne.setChargeList(list4.size() > 0 ? list4 : null); detailOne.setChargeList(!list4.isEmpty() ? list4 : null);
//查询提货信息 //查询提货信息
List<DistrilbutionBillStockEntity> list = distrilbutionBillStockService.list(Wrappers.<DistrilbutionBillStockEntity>query().lambda() List<DistrilbutionBillStockEntity> list = distrilbutionBillStockService.list(Wrappers.<DistrilbutionBillStockEntity>query().lambda()
.eq(DistrilbutionBillStockEntity::getBillLadingId, distrilbutionBillLadingEntity.getId()) .eq(DistrilbutionBillStockEntity::getBillLadingId, distrilbutionBillLadingEntity.getId())
@ -1366,7 +1366,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
); );
list.forEach(i -> { list.forEach(i -> {
List<DistributionStockArticleEntity> list2 = distributionStockArticleService.list(Wrappers.<DistributionStockArticleEntity>query().lambda().eq(DistributionStockArticleEntity::getId, i.getStockArticleId())); List<DistributionStockArticleEntity> list2 = distributionStockArticleService.list(Wrappers.<DistributionStockArticleEntity>query().lambda().eq(DistributionStockArticleEntity::getId, i.getStockArticleId()));
if (list2.size() > 0) { if (!list2.isEmpty()) {
list1.addAll(DistributionStockArticleWrapper.build().listVO(list2)); list1.addAll(DistributionStockArticleWrapper.build().listVO(list2));
} }
@ -1871,7 +1871,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
List<DistributionParcelNumberEntity> parcelNumberEntityList = new ArrayList<>(); List<DistributionParcelNumberEntity> parcelNumberEntityList = new ArrayList<>();
AtomicInteger nu = new AtomicInteger(); AtomicInteger nu = new AtomicInteger();
//是 添加物料信息 //是 添加物料信息
list.stream().forEach(i -> { list.forEach(i -> {
if(i.getQuantity() != 0){ if(i.getQuantity() != 0){
DistributionReservationZeroPackageEntity zeroPackageEntity = new DistributionReservationZeroPackageEntity(); DistributionReservationZeroPackageEntity zeroPackageEntity = new DistributionReservationZeroPackageEntity();
zeroPackageEntity.setQuantity(i.getQuantity()); zeroPackageEntity.setQuantity(i.getQuantity());

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseUpdownTypeClient.java

@ -87,7 +87,7 @@ public class WarehouseUpdownTypeClient implements IWarehouseUpdownTypeClient {
dto.setOrderPackageCode(orderPackageCode); dto.setOrderPackageCode(orderPackageCode);
upShelfPackageList.add(dto); upShelfPackageList.add(dto);
} }
if(upShelfPackageList.size() > 0){ if(!upShelfPackageList.isEmpty()){
return warehouseUpdownTypeService.downPackageOrDelTray(upShelfPackageList,warehouseId); return warehouseUpdownTypeService.downPackageOrDelTray(upShelfPackageList,warehouseId);
}else{ }else{
return R.fail(403,"处理失败"); return R.fail(403,"处理失败");

Loading…
Cancel
Save