|
|
|
@ -45,8 +45,11 @@ import lombok.AllArgsConstructor;
|
|
|
|
|
import lombok.extern.log4j.Log4j2; |
|
|
|
|
import org.apache.commons.lang.StringUtils; |
|
|
|
|
import org.springblade.common.constant.DistributionTypeConstant; |
|
|
|
|
import org.springblade.common.constant.Inventory.InventoryLoadingStatusConstant; |
|
|
|
|
import org.springblade.common.constant.Inventory.InventoryPackageStatusConstant; |
|
|
|
|
import org.springblade.common.constant.delivery.DeliveryLoadingStatusConstant; |
|
|
|
|
import org.springblade.common.constant.delivery.DeliveryStatusConstant; |
|
|
|
|
import org.springblade.common.constant.loading.LoadingIsInsertConstant; |
|
|
|
|
import org.springblade.common.constant.loading.LoadingStatusConstant; |
|
|
|
|
import org.springblade.common.constant.order.OrderStatusConstant; |
|
|
|
|
import org.springblade.common.constant.orderpackage.OrderPackageLoadingStatusConstant; |
|
|
|
@ -120,6 +123,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
private final IBasicdataDriverArteryClient iBasicdataDriverArteryClient; |
|
|
|
|
private final IBasicdataWarehouseClient warehouseClient; |
|
|
|
|
private final IDisStockListDetailService disStockListDetailService; |
|
|
|
|
private final DistributionStockListMapper distributionStockListMapper; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionDeliveryListEntity> selectDistributionDeliveryListPage(IPage<DistributionDeliveryListEntity> page, DistributionDeliveryListDTO distributionDeliveryList) { |
|
|
|
@ -167,10 +171,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// if (detail.getSource() == 1) {
|
|
|
|
|
//查询客户信息
|
|
|
|
|
List<DistributionDeliveryInfoVO> customList = distributionDeliveryInfoMapper.selectcustomList(detail.getId()); |
|
|
|
|
if (Func.isNotEmpty(customList) || customList.size()>=1){ |
|
|
|
|
customList.forEach(c->{ |
|
|
|
|
if (Func.isNotEmpty(c.getLoadingStatus())){ |
|
|
|
|
switch (c.getLoadingStatus()){ |
|
|
|
|
if (Func.isNotEmpty(customList) || customList.size() >= 1) { |
|
|
|
|
customList.forEach(c -> { |
|
|
|
|
if (Func.isNotEmpty(c.getLoadingStatus())) { |
|
|
|
|
switch (c.getLoadingStatus()) { |
|
|
|
|
case "10": |
|
|
|
|
c.setLoadingStatus(ReservationLoadingStatusConstant.daizhuangche.getName()); |
|
|
|
|
break; |
|
|
|
@ -182,8 +186,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(c.getReservationSigningStatus())){ |
|
|
|
|
switch (c.getReservationSigningStatus()){ |
|
|
|
|
if (Func.isNotEmpty(c.getReservationSigningStatus())) { |
|
|
|
|
switch (c.getReservationSigningStatus()) { |
|
|
|
|
case "10": |
|
|
|
|
c.setReservationSigningStatus(ReservationSigningStatusConstant.daiqianshou.getName()); |
|
|
|
|
break; |
|
|
|
@ -200,46 +204,40 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
|
|
|
|
|
distributionDeliveryListVO.setReservationList(customList); |
|
|
|
|
//查询备货信息
|
|
|
|
|
// DistributionStockupVO deliveryStockupInfo = distributionStockupMapper.getDeliveryStockupInfo(detail.getId());
|
|
|
|
|
if (Func.equals(distributionDeliveryListVO.getType(),DistributionTypeConstant.shipie.getValue())){ |
|
|
|
|
if (Func.equals(distributionDeliveryListVO.getType(), DistributionTypeConstant.shipie.getValue())) { |
|
|
|
|
List<DistributionStockupVO> distributionStockupVOList = distributionStockupMapper.getMarketDeliveryStockupInfo(detail.getId()); |
|
|
|
|
// Optional<DistributionStockupVO> max = distributionStockupVOList.stream().max(Comparator.comparing(DistributionStockupVO::getOutboundDate));
|
|
|
|
|
// Optional<DistributionStockupVO> min = distributionStockupVOList.stream().min(Comparator.comparing(DistributionStockupVO::getOutboundDate));
|
|
|
|
|
// String s1 = distributionStockupVOList.stream().min(Comparator.comparing(DistributionStockupVO::getOutboundDate)).toString();
|
|
|
|
|
Date outboundDate = distributionStockupVOList.stream().filter(o -> o.getOutboundDate() != null).max(Comparator.comparing(DistributionStockupVO::getOutboundDate)).get().getOutboundDate(); |
|
|
|
|
//这里需要处理一下
|
|
|
|
|
if (distributionStockupVOList.size()>1){ |
|
|
|
|
if (distributionStockupVOList.size() > 1) { |
|
|
|
|
Date outboundDate = distributionStockupVOList.stream().filter(o -> o.getOutboundDate() != null).max(Comparator.comparing(DistributionStockupVO::getOutboundDate)).get().getOutboundDate(); |
|
|
|
|
HashSet<String> forkliftName = new HashSet<>(); |
|
|
|
|
HashSet<String> loaderName = new HashSet<>(); |
|
|
|
|
HashSet<String> stockUser = new HashSet<>(); |
|
|
|
|
HashSet<String> goodsArea = new HashSet<>(); |
|
|
|
|
distributionStockupVOList.forEach(s->{ |
|
|
|
|
if (Func.isNotEmpty(s.getForkliftName())){ |
|
|
|
|
distributionStockupVOList.forEach(s -> { |
|
|
|
|
if (Func.isNotEmpty(s.getForkliftName())) { |
|
|
|
|
forkliftName.add(s.getForkliftName()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(s.getLoaderName())){ |
|
|
|
|
if (Func.isNotEmpty(s.getLoaderName())) { |
|
|
|
|
loaderName.add(s.getLoaderName()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(s.getStockupUser())){ |
|
|
|
|
if (Func.isNotEmpty(s.getStockupUser())) { |
|
|
|
|
stockUser.add(s.getStockupUser()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(s.getStockupArea())){ |
|
|
|
|
if (Func.isNotEmpty(s.getStockupArea())) { |
|
|
|
|
goodsArea.add(s.getStockupArea()); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
DistributionStockupVO distributionStockupVO = new DistributionStockupVO(); |
|
|
|
|
distributionStockupVO.setForkliftName(String.join(",",forkliftName)); |
|
|
|
|
distributionStockupVO.setStockupArea(String.join(",",goodsArea)); |
|
|
|
|
distributionStockupVO.setStockupUser(String.join(",",stockUser)); |
|
|
|
|
// distributionStockupVO.setLoaderName(String.join(",",loaderName));
|
|
|
|
|
distributionStockupVO.setForkliftName(String.join(",", forkliftName)); |
|
|
|
|
distributionStockupVO.setStockupArea(String.join(",", goodsArea)); |
|
|
|
|
distributionStockupVO.setStockupUser(String.join(",", stockUser)); |
|
|
|
|
distributionStockupVO.setOutboundDate(outboundDate); |
|
|
|
|
// distributionStockupVO.setTeamResponsibility(distributionStockupVOList.get(0).getTeamResponsibility());
|
|
|
|
|
distributionDeliveryListVO.setStockupInfo(distributionStockupVO); |
|
|
|
|
|
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
distributionDeliveryListVO.setStockupInfo(distributionStockupVOList.get(0)); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
DistributionStockupVO deliveryStockupInfo = distributionStockupMapper.getDeliveryStockupInfo(detail.getId()); |
|
|
|
|
distributionDeliveryListVO.setStockupInfo(deliveryStockupInfo); |
|
|
|
|
|
|
|
|
@ -388,7 +386,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class) |
|
|
|
|
// synchronized
|
|
|
|
|
public Resp loadingscan(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { |
|
|
|
|
public Resp loadingscan(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { |
|
|
|
|
|
|
|
|
|
//获取当前用户司机
|
|
|
|
|
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
@ -741,9 +739,9 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
String barcode = distrilbutionloadingscanDTO.getBarcode(); |
|
|
|
|
DistributionDeliveryListEntity deliveryListEntity = distributionDeliveryListMapper.selectOne(Wrappers.<DistributionDeliveryListEntity>query().lambda().eq(DistributionDeliveryListEntity::getId, deliveryId)); |
|
|
|
|
//判断配送计划是否需要进行库存品状态的变更
|
|
|
|
|
if (deliveryListEntity.getType().equals(DistributionTypeConstant.shangpei.getValue())){ |
|
|
|
|
if (deliveryListEntity.getType().equals(DistributionTypeConstant.shangpei.getValue())) { |
|
|
|
|
distributionAsyncService.changeDiscussDeliveryListStatus(barcode, deliveryId); |
|
|
|
|
}else if (deliveryListEntity.getType().equals(DistributionTypeConstant.shipie.getValue())){ |
|
|
|
|
} else if (deliveryListEntity.getType().equals(DistributionTypeConstant.shipie.getValue())) { |
|
|
|
|
//需要判断是否依据库存品进行变更
|
|
|
|
|
distributionAsyncService.changeMarketDeliveryListStatus(barcode, deliveryId); |
|
|
|
|
|
|
|
|
@ -755,25 +753,25 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Transactional(isolation = Isolation.READ_UNCOMMITTED, rollbackFor = Exception.class) |
|
|
|
|
public void changeDeliveryListStatuss(String barcode,Long deliveryId) { |
|
|
|
|
public void changeDeliveryListStatuss(String barcode, Long deliveryId) { |
|
|
|
|
//这里需要查询出该包件
|
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionDeliveryListMapper.getLoadingPackageDetails(barcode,deliveryId); |
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionDeliveryListMapper.getLoadingPackageDetails(barcode, deliveryId); |
|
|
|
|
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); |
|
|
|
|
parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yichuku.getValue()); |
|
|
|
|
//修改包件状态
|
|
|
|
|
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())); |
|
|
|
|
boolean flag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); |
|
|
|
|
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleService.getById(parcelListEntity.getStockArticleId()); |
|
|
|
|
//维护包件、订单扫描装车状态
|
|
|
|
|
if (flag){ |
|
|
|
|
if (flag) { |
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.chuku.getValue()); |
|
|
|
|
}else { |
|
|
|
|
flag = parcelListEntityList.stream().allMatch(p->p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())); |
|
|
|
|
if (flag){ |
|
|
|
|
} else { |
|
|
|
|
flag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())); |
|
|
|
|
if (flag) { |
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.ruku.getValue()); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
stockArticleEntity.setOrderStatus(OrderStatusConstant.bufenchuku.getValue()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -782,29 +780,29 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
//查询出配送任务下的所有包件
|
|
|
|
|
List<DistributionParcelListEntity> deliveryParcelListEntityList = distributionDeliveryListMapper.selectPackageListByDeliveryListId(deliveryId); |
|
|
|
|
boolean deliveryLoadingFlag = deliveryParcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); |
|
|
|
|
if (deliveryLoadingFlag){ |
|
|
|
|
if (deliveryLoadingFlag) { |
|
|
|
|
deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.yizhuangche.getValue()); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
deliveryLoadingFlag = deliveryParcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())); |
|
|
|
|
if (deliveryLoadingFlag){ |
|
|
|
|
if (deliveryLoadingFlag) { |
|
|
|
|
deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.weizhuangche.getValue()); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
deliveryListEntity.setDeliveryListLoadingStatus(DeliveryLoadingStatusConstant.bunfenzhuangche.getValue()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
distributionDeliveryListMapper.updateById(deliveryListEntity); |
|
|
|
|
List<DistributionReservationEntity> reservationEntityList = distributionDeliveryListMapper.selectReservationByDeliveryListId(deliveryId); |
|
|
|
|
reservationEntityList.forEach(r->{ |
|
|
|
|
reservationEntityList.forEach(r -> { |
|
|
|
|
//查询预约下的所有包件信息
|
|
|
|
|
List<DistributionParcelListEntity> parcelListEntities = distributionReservationMapper.selectPackageListByReservationId(r.getId()); |
|
|
|
|
boolean reservationLoadingFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); |
|
|
|
|
if (reservationLoadingFlag){ |
|
|
|
|
r.setLoadingStatus(ReservationLoadingStatusConstant.yizhuangche.getValue()); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
reservationLoadingFlag = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())); |
|
|
|
|
if (reservationLoadingFlag){ |
|
|
|
|
if (reservationLoadingFlag) { |
|
|
|
|
r.setLoadingStatus(ReservationLoadingStatusConstant.daizhuangche.getValue()); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
r.setLoadingStatus(ReservationLoadingStatusConstant.bufenzhuangche.getValue()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -860,12 +858,18 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
#5.3 更新预约单关联库存品的数量 |
|
|
|
|
*/ |
|
|
|
|
//获取当前用户司机
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ----------------------------2023-09-06 PDA一键装车调整----------------------------------------
|
|
|
|
|
//1、查询该客户下是否还存在需要装车的包件和库存品
|
|
|
|
|
|
|
|
|
|
//查询配送任务配车司机信息
|
|
|
|
|
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
DistributionDeliverySelfEntity distributionDeliverySelfEntity = null; |
|
|
|
|
if (StringUtils.isBlank(distrilbutionloadingscanDTO.getLoadingId())) { |
|
|
|
|
if (distributionDeliveryListEntity.getKind().equals("1")) { |
|
|
|
|
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectOne(new QueryWrapper<DistributionDeliverySelfEntity>().lambda() |
|
|
|
|
.eq(DistributionDeliverySelfEntity::getIsMaster, 2) |
|
|
|
|
.eq(DistributionDeliverySelfEntity::getIsMaster, ServiceConstant.IS_MASTER_YES) |
|
|
|
|
.eq(DistributionDeliverySelfEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()) |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
@ -884,69 +888,253 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//先查询有数据的
|
|
|
|
|
List<DistributionLoadscanEntity> distributionLoadscanEntities = baseMapper.selectdeliverOne(distrilbutionloadingscanDTO.getReservationId(), distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
//无数据的
|
|
|
|
|
// List<DistributionLoadscanEntity> distributionLoadscanEntitiesno = baseMapper.selectdeliverOneNo(distrilbutionloadingscanDTO.getReservationId(), distrilbutionloadingscanDTO.getDeliveryId());
|
|
|
|
|
//查询所有的库存品(无拆包)
|
|
|
|
|
//List<DistributionLoadscaninvnEntity> distributionLoadscanvnEntities = baseMapper.selectdeliverOnevn(distrilbutionloadingscanDTO.getReservationId(), distrilbutionloadingscanDTO.getDeliveryId());
|
|
|
|
|
//查询所有的库存品(拆包)
|
|
|
|
|
List<DistributionLoadscaninvnEntity> distributionLoadscanvnEntitiesopen = baseMapper.selectdeliverOnevnopen(distrilbutionloadingscanDTO.getReservationId(), distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
//将该客户所有的物品上该车辆
|
|
|
|
|
Integer flag = 0; |
|
|
|
|
Integer flag2 = 0; |
|
|
|
|
if (distributionLoadscanEntities.size() > 0) { |
|
|
|
|
for (DistributionLoadscanEntity distributionLoadscanEntity : distributionLoadscanEntities) { |
|
|
|
|
//查询是否重复扫码
|
|
|
|
|
List<DistributionLoadscanEntity> distributionLoadscanEntitiesflag = distributionLoadscanMapper.selectList(new QueryWrapper<DistributionLoadscanEntity>().lambda() |
|
|
|
|
.eq(DistributionLoadscanEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId()) |
|
|
|
|
.eq(DistributionLoadscanEntity::getOrderPackageCode, distributionLoadscanEntity.getOrderPackageCode()) |
|
|
|
|
.ne(DistributionLoadscanEntity::getScanStatus, 1) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (distributionLoadscanEntitiesflag.size() > 0) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
flag += 1; |
|
|
|
|
//依次插入该装车记录,设置车辆
|
|
|
|
|
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverId())) { |
|
|
|
|
distributionLoadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); |
|
|
|
|
} |
|
|
|
|
distributionLoadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); |
|
|
|
|
distributionLoadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); |
|
|
|
|
distributionLoadscanEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue()); |
|
|
|
|
distributionLoadscanEntity.setOneClick(2); |
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
distributionLoadscanEntity.setScanUser(user.getNickName()); |
|
|
|
|
distributionLoadscanEntity.setScanTime(new Date()); |
|
|
|
|
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverPhone())) { |
|
|
|
|
distributionLoadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); |
|
|
|
|
//查询该客户下还未进行装车的包件
|
|
|
|
|
List<DistributionReservationPackageEntity> reservationPackageEntityList = distributionReservationPackageMapper.selectList(Wrappers.<DistributionReservationPackageEntity>query().lambda() |
|
|
|
|
.eq(DistributionReservationPackageEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) |
|
|
|
|
.ne(DistributionReservationPackageEntity::getPacketBarStatus, ReservationPackageStatusConstant.quxiao.getValue())); |
|
|
|
|
List<Long> list = reservationPackageEntityList.stream().map(DistributionReservationPackageEntity::getParceListId).collect(Collectors.toList()); |
|
|
|
|
List<DistributionParcelListEntity> distributionParcelListEntityList = distributionParcelListService.list(new QueryWrapper<DistributionParcelListEntity>().lambda().in(DistributionParcelListEntity::getId, list)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distrilbutionloadingscanDTO.getReservationId()); |
|
|
|
|
boolean packageLoadingFlag = parcelListEntityList.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue())); |
|
|
|
|
List<DisStockListDetailEntity> stockListDetailEntityList = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda() |
|
|
|
|
.eq(DisStockListDetailEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) |
|
|
|
|
.ne(DisStockListDetailEntity::getStockPackageStatus, ReservationInventoryStatusConstant.quxiao.getValue())); |
|
|
|
|
boolean inventoryLoadingFlag = stockListDetailEntityList.stream().allMatch(i -> i.getStockPackageStatus().equals(InventoryLoadingStatusConstant.yizhuangche.getValue())); |
|
|
|
|
//判断库存品是否进行了备货任务,如果未进行备货任务无法进行一件装车
|
|
|
|
|
boolean inventoryStockUpFlag = stockListDetailEntityList.stream().anyMatch(l -> Func.isEmpty(l.getStockPackageCode())); |
|
|
|
|
if (inventoryStockUpFlag) { |
|
|
|
|
return R.fail("该客户存在库存品暂未备货 一键装车失败!!!"); |
|
|
|
|
} |
|
|
|
|
if (packageLoadingFlag && inventoryLoadingFlag) { |
|
|
|
|
//此时包件和库存品均已完成装车,这里不需要进行装车;需要进行进行提示
|
|
|
|
|
//这里需要对包件、库存品包件进行库位信息的解绑
|
|
|
|
|
} else { |
|
|
|
|
if (!packageLoadingFlag) { |
|
|
|
|
//存在包件还未进行装车
|
|
|
|
|
for (DistributionParcelListEntity parcelListEntity : parcelListEntityList) { |
|
|
|
|
if (parcelListEntity.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())) { |
|
|
|
|
DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity(); |
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
loadscanEntity.setScanUser(user.getUserName()); |
|
|
|
|
loadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); |
|
|
|
|
loadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); |
|
|
|
|
loadscanEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue()); |
|
|
|
|
loadscanEntity.setOneClick(2); |
|
|
|
|
loadscanEntity.setScanUser(user.getUserName()); |
|
|
|
|
loadscanEntity.setScanTime(new Date()); |
|
|
|
|
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverPhone())) { |
|
|
|
|
loadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getVehicleId())) { |
|
|
|
|
loadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverId())) { |
|
|
|
|
loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverId())) { |
|
|
|
|
loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(parcelListEntity.getQuantity())) { |
|
|
|
|
loadscanEntity.setPackageNub(parcelListEntity.getQuantity()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(distrilbutionloadingscanDTO.getReservationId())) { |
|
|
|
|
loadscanEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(distrilbutionloadingscanDTO.getDeliveryId())) { |
|
|
|
|
loadscanEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(parcelListEntity.getOrderPackageCode())) { |
|
|
|
|
loadscanEntity.setOrderPackageCode(parcelListEntity.getOrderPackageCode()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(parcelListEntity.getId())) { |
|
|
|
|
loadscanEntity.setPackageId(parcelListEntity.getId()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(parcelListEntity.getId())) { |
|
|
|
|
loadscanEntity.setPackageId(parcelListEntity.getId()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(parcelListEntity.getStockArticleId())) { |
|
|
|
|
loadscanEntity.setOrderId(parcelListEntity.getStockArticleId()); |
|
|
|
|
} |
|
|
|
|
distributionLoadscanService.save(loadscanEntity); |
|
|
|
|
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub()); |
|
|
|
|
//异步修改包件状态
|
|
|
|
|
distributionAsyncService.changeMarketDeliveryListStatus(loadscanEntity.getOrderPackageCode(), loadscanEntity.getDeliveryId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getVehicleId())) { |
|
|
|
|
distributionLoadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); |
|
|
|
|
} |
|
|
|
|
if (!inventoryLoadingFlag) { |
|
|
|
|
//存在库存品海为进行装车
|
|
|
|
|
for (DisStockListDetailEntity disStockListDetailEntity : stockListDetailEntityList) { |
|
|
|
|
if (disStockListDetailEntity.getStockLockingStatus().equals(InventoryLoadingStatusConstant.weizhuangche.getValue())) { |
|
|
|
|
DistributionLoadscaninvnEntity loadscaninvnEntity = new DistributionLoadscaninvnEntity(); |
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
loadscaninvnEntity.setScanUser(user.getUserName()); |
|
|
|
|
loadscaninvnEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); |
|
|
|
|
loadscaninvnEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); |
|
|
|
|
loadscaninvnEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue()); |
|
|
|
|
loadscaninvnEntity.setOneClick(2); |
|
|
|
|
loadscaninvnEntity.setScanUser(user.getUserName()); |
|
|
|
|
loadscaninvnEntity.setScanTime(new Date()); |
|
|
|
|
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverPhone())) { |
|
|
|
|
loadscaninvnEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getVehicleId())) { |
|
|
|
|
loadscaninvnEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverId())) { |
|
|
|
|
loadscaninvnEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(disStockListDetailEntity.getNum())) { |
|
|
|
|
loadscaninvnEntity.setPackageNub(disStockListDetailEntity.getNum()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(distrilbutionloadingscanDTO.getReservationId())) { |
|
|
|
|
loadscaninvnEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(distrilbutionloadingscanDTO.getDeliveryId())) { |
|
|
|
|
loadscaninvnEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(disStockListDetailEntity.getStockPackageCode())) { |
|
|
|
|
loadscaninvnEntity.setOrderPackageCode(disStockListDetailEntity.getStockPackageCode()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(disStockListDetailEntity.getStockListId())) { |
|
|
|
|
loadscaninvnEntity.setInventoryId(disStockListDetailEntity.getStockListId()); |
|
|
|
|
} |
|
|
|
|
distributionLoadscaninvnService.save(loadscaninvnEntity); |
|
|
|
|
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
Integer j = distributionSignforMapper.updateloadByinvn(loadscaninvnEntity.getDeliveryId(), loadscaninvnEntity.getReservationId(), loadscaninvnEntity.getPackageNub()); |
|
|
|
|
//异步修改包件状态 //对于存在库存品的这里还需要将库存品从对应的信息中进行扣除
|
|
|
|
|
distributionAsyncService.changeMarketDeliveryListStatus(loadscaninvnEntity.getOrderPackageCode(), loadscaninvnEntity.getDeliveryId()); |
|
|
|
|
DistributionStockListEntity stockListEntity = distributionStockListMapper.selectOne(Wrappers.<DistributionStockListEntity>query().lambda().eq(DistributionStockListEntity::getId, loadscaninvnEntity.getInventoryId())); |
|
|
|
|
stockListEntity.setQuantityStock(stockListEntity.getQuantityStock() - loadscaninvnEntity.getPackageNub()); |
|
|
|
|
stockListEntity.setQuantityOccupied(stockListEntity.getQuantityOccupied() - loadscaninvnEntity.getPackageNub()); |
|
|
|
|
stockListEntity.setOutboundQuantity(stockListEntity.getOutboundQuantity() + loadscaninvnEntity.getPackageNub()); |
|
|
|
|
distributionStockListMapper.updateById(stockListEntity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
distributionLoadscanEntity.setLoadingId(distrilbutionloadingscanDTO.getLoadingId()); |
|
|
|
|
//查询本车次是否第一次扫码,没有则更新上车时间
|
|
|
|
|
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
//更新签收表的装车数量
|
|
|
|
|
Integer j = distributionSignforMapper.updateloadByReservationId(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); |
|
|
|
|
distributionLoadscanService.save(distributionLoadscanEntity); |
|
|
|
|
Long packageId = distributionLoadscanEntity.getPackageId(); |
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(packageId); |
|
|
|
|
//TODO 这里一件装车需要进行判断
|
|
|
|
|
distributionAsyncService.changeDiscussDeliveryListStatus(parcelListEntity.getOrderPackageCode(),distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
} |
|
|
|
|
// distributionLoadscanService.saveBatch(distributionLoadscanEntities);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//库存品装车
|
|
|
|
|
// if (distributionLoadscanvnEntities.size() > 0) {
|
|
|
|
|
// for (DistributionLoadscaninvnEntity distributionLoadscanEntity : distributionLoadscanvnEntities) {
|
|
|
|
|
return R.success("成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//2、查询该客户下是否存在库存品
|
|
|
|
|
// 存在 --> 查询库存品是否均完成备货
|
|
|
|
|
// 是 ---> 执行库存品一键装车
|
|
|
|
|
// 否 ---> 提示库存品没有进行备货
|
|
|
|
|
// 不存在 --> 直接进入包件的判断
|
|
|
|
|
//3、数据构建 一件装车需要查询出该客户下的所有包件信息、库存品包件信息。
|
|
|
|
|
//4、维护包件、订单、预约、库存品、装车字段
|
|
|
|
|
//5、检查包件、订单是否和库位信息解除绑定,如果没有则进行解绑
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //先查询有数据的
|
|
|
|
|
// List<DistributionLoadscanEntity> distributionLoadscanEntities = baseMapper.selectdeliverOne(distrilbutionloadingscanDTO.getReservationId(), distrilbutionloadingscanDTO.getDeliveryId());
|
|
|
|
|
// //无数据的
|
|
|
|
|
// // List<DistributionLoadscanEntity> distributionLoadscanEntitiesno = baseMapper.selectdeliverOneNo(distrilbutionloadingscanDTO.getReservationId(), distrilbutionloadingscanDTO.getDeliveryId());
|
|
|
|
|
// //查询所有的库存品(无拆包)
|
|
|
|
|
// //List<DistributionLoadscaninvnEntity> distributionLoadscanvnEntities = baseMapper.selectdeliverOnevn(distrilbutionloadingscanDTO.getReservationId(), distrilbutionloadingscanDTO.getDeliveryId());
|
|
|
|
|
// //查询所有的库存品(拆包)
|
|
|
|
|
// List<DistributionLoadscaninvnEntity> distributionLoadscanvnEntitiesopen = baseMapper.selectdeliverOnevnopen(distrilbutionloadingscanDTO.getReservationId(), distrilbutionloadingscanDTO.getDeliveryId());
|
|
|
|
|
// //将该客户所有的物品上该车辆
|
|
|
|
|
// Integer flag = 0;
|
|
|
|
|
// Integer flag2 = 0;
|
|
|
|
|
// if (distributionLoadscanEntities.size() > 0) {
|
|
|
|
|
// for (DistributionLoadscanEntity distributionLoadscanEntity : distributionLoadscanEntities) {
|
|
|
|
|
// //查询是否重复扫码
|
|
|
|
|
// List<DistributionLoadscanEntity> distributionLoadscanEntitiesflag = distributionLoadscanMapper.selectList(new QueryWrapper<DistributionLoadscanEntity>().lambda()
|
|
|
|
|
// .eq(DistributionLoadscanEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId())
|
|
|
|
|
// .eq(DistributionLoadscanEntity::getOrderPackageCode, distributionLoadscanEntity.getOrderPackageCode())
|
|
|
|
|
// .ne(DistributionLoadscanEntity::getScanStatus, 1)
|
|
|
|
|
// );
|
|
|
|
|
//
|
|
|
|
|
// if (distributionLoadscanEntitiesflag.size() > 0) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// flag += 1;
|
|
|
|
|
// //依次插入该装车记录,设置车辆
|
|
|
|
|
// if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverId())) {
|
|
|
|
|
// distributionLoadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
|
|
|
|
|
// }
|
|
|
|
|
// distributionLoadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
|
|
|
|
|
// distributionLoadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
|
|
|
|
|
// distributionLoadscanEntity.setScanStatus(LoadingStatusConstant.yijianzhuangche.getValue());
|
|
|
|
|
// distributionLoadscanEntity.setOneClick(2);
|
|
|
|
|
// BladeUser user = AuthUtil.getUser();
|
|
|
|
|
// distributionLoadscanEntity.setScanUser(user.getNickName());
|
|
|
|
|
// distributionLoadscanEntity.setScanTime(new Date());
|
|
|
|
|
// if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverPhone())) {
|
|
|
|
|
// distributionLoadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone());
|
|
|
|
|
// }
|
|
|
|
|
// if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getVehicleId())) {
|
|
|
|
|
// distributionLoadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
|
|
|
|
|
// }
|
|
|
|
|
// distributionLoadscanEntity.setLoadingId(distrilbutionloadingscanDTO.getLoadingId());
|
|
|
|
|
// //查询本车次是否第一次扫码,没有则更新上车时间
|
|
|
|
|
// Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
|
|
|
|
|
// //更新签收表的装车数量
|
|
|
|
|
// Integer j = distributionSignforMapper.updateloadByReservationId(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub());
|
|
|
|
|
// distributionLoadscanService.save(distributionLoadscanEntity);
|
|
|
|
|
// Long packageId = distributionLoadscanEntity.getPackageId();
|
|
|
|
|
// DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(packageId);
|
|
|
|
|
// //TODO 这里一件装车需要进行判断
|
|
|
|
|
// distributionAsyncService.changeDiscussDeliveryListStatus(parcelListEntity.getOrderPackageCode(),distrilbutionloadingscanDTO.getDeliveryId());
|
|
|
|
|
// }
|
|
|
|
|
//// distributionLoadscanService.saveBatch(distributionLoadscanEntities);
|
|
|
|
|
// }
|
|
|
|
|
// //库存品装车
|
|
|
|
|
//// if (distributionLoadscanvnEntities.size() > 0) {
|
|
|
|
|
//// for (DistributionLoadscaninvnEntity distributionLoadscanEntity : distributionLoadscanvnEntities) {
|
|
|
|
|
//// //依次插入该装车记录,设置车辆
|
|
|
|
|
//// if (null != distributionDeliverySelfEntity.getDriverId()) {
|
|
|
|
|
//// distributionLoadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
|
|
|
|
|
//// }
|
|
|
|
|
//// distributionLoadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
|
|
|
|
|
//// distributionLoadscanEntity.setScanStatus(2);
|
|
|
|
|
//// distributionLoadscanEntity.setScanType("1");
|
|
|
|
|
//// distributionLoadscanEntity.setScanTime(new Date());
|
|
|
|
|
//// if (null == distributionLoadscanEntity.getPackageNub()) {
|
|
|
|
|
//// distributionLoadscanEntity.setPackageNub(1);
|
|
|
|
|
//// }
|
|
|
|
|
//// distributionLoadscanEntity.setLoadingId(distrilbutionloadingscanDTO.getLoadingId());
|
|
|
|
|
//// distributionLoadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
|
|
|
|
|
//// if (null != distributionDeliverySelfEntity.getDriverPhone()) {
|
|
|
|
|
//// distributionLoadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone());
|
|
|
|
|
//// }
|
|
|
|
|
//// if (null != distributionDeliverySelfEntity.getVehicleId()) {
|
|
|
|
|
//// distributionLoadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
|
|
|
|
|
//// }
|
|
|
|
|
//// //查询本车次是否第一次扫码,没有则更新上车时间
|
|
|
|
|
//// Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
|
|
|
|
|
//// //更新签收表的装车数量
|
|
|
|
|
//// Integer j = distributionSignforMapper.updateloadByinvn(distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub());
|
|
|
|
|
//// }
|
|
|
|
|
//// distributionLoadscaninvnService.saveBatch(distributionLoadscanvnEntities);
|
|
|
|
|
//// }
|
|
|
|
|
// if (distributionLoadscanvnEntitiesopen.size() > 0) {
|
|
|
|
|
// for (DistributionLoadscaninvnEntity distributionLoadscanEntity : distributionLoadscanvnEntitiesopen) {
|
|
|
|
|
// //查询是否重复扫码
|
|
|
|
|
// List<DistributionLoadscaninvnEntity> distributionLoadscanEntitiesflag = distributionLoadscaninvnMapper.selectList(new QueryWrapper<DistributionLoadscaninvnEntity>().lambda()
|
|
|
|
|
// .eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId())
|
|
|
|
|
// .eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distributionLoadscanEntity.getOrderPackageCode())
|
|
|
|
|
// .ne(DistributionLoadscaninvnEntity::getScanStatus, 1)
|
|
|
|
|
// );
|
|
|
|
|
//
|
|
|
|
|
// if (distributionLoadscanEntitiesflag.size() > 0) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// flag2 += 1;
|
|
|
|
|
// //依次插入该装车记录,设置车辆
|
|
|
|
|
// if (null != distributionDeliverySelfEntity.getDriverId()) {
|
|
|
|
|
// distributionLoadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
|
|
|
|
|
// }
|
|
|
|
|
// distributionLoadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
|
|
|
|
|
// distributionLoadscanEntity.setScanStatus(2);
|
|
|
|
|
// distributionLoadscanEntity.setScanStatus(LoadingStatusConstant.saomiao.getValue());
|
|
|
|
|
// distributionLoadscanEntity.setScanType("1");
|
|
|
|
|
// distributionLoadscanEntity.setScanTime(new Date());
|
|
|
|
|
// if (null == distributionLoadscanEntity.getPackageNub()) {
|
|
|
|
@ -963,52 +1151,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// //查询本车次是否第一次扫码,没有则更新上车时间
|
|
|
|
|
// Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
|
|
|
|
|
// //更新签收表的装车数量
|
|
|
|
|
// Integer j = distributionSignforMapper.updateloadByinvn(distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub());
|
|
|
|
|
// Integer j = distributionSignforMapper.updateloadByinvn(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub());
|
|
|
|
|
// }
|
|
|
|
|
// distributionLoadscaninvnService.saveBatch(distributionLoadscanvnEntities);
|
|
|
|
|
// distributionLoadscaninvnService.saveBatch(distributionLoadscanvnEntitiesopen);
|
|
|
|
|
// }
|
|
|
|
|
// if (flag == 0 && flag2 == 0) {
|
|
|
|
|
// return R.fail(4002, "无数据进行装车");
|
|
|
|
|
// }
|
|
|
|
|
if (distributionLoadscanvnEntitiesopen.size() > 0) { |
|
|
|
|
for (DistributionLoadscaninvnEntity distributionLoadscanEntity : distributionLoadscanvnEntitiesopen) { |
|
|
|
|
//查询是否重复扫码
|
|
|
|
|
List<DistributionLoadscaninvnEntity> distributionLoadscanEntitiesflag = distributionLoadscaninvnMapper.selectList(new QueryWrapper<DistributionLoadscaninvnEntity>().lambda() |
|
|
|
|
.eq(DistributionLoadscaninvnEntity::getDeliveryId, distributionLoadscanEntity.getDeliveryId()) |
|
|
|
|
.eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distributionLoadscanEntity.getOrderPackageCode()) |
|
|
|
|
.ne(DistributionLoadscaninvnEntity::getScanStatus, 1) |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (distributionLoadscanEntitiesflag.size() > 0) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
flag2 += 1; |
|
|
|
|
//依次插入该装车记录,设置车辆
|
|
|
|
|
if (null != distributionDeliverySelfEntity.getDriverId()) { |
|
|
|
|
distributionLoadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); |
|
|
|
|
} |
|
|
|
|
distributionLoadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); |
|
|
|
|
distributionLoadscanEntity.setScanStatus(LoadingStatusConstant.saomiao.getValue()); |
|
|
|
|
distributionLoadscanEntity.setScanType("1"); |
|
|
|
|
distributionLoadscanEntity.setScanTime(new Date()); |
|
|
|
|
if (null == distributionLoadscanEntity.getPackageNub()) { |
|
|
|
|
distributionLoadscanEntity.setPackageNub(1); |
|
|
|
|
} |
|
|
|
|
distributionLoadscanEntity.setLoadingId(distrilbutionloadingscanDTO.getLoadingId()); |
|
|
|
|
distributionLoadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); |
|
|
|
|
if (null != distributionDeliverySelfEntity.getDriverPhone()) { |
|
|
|
|
distributionLoadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); |
|
|
|
|
} |
|
|
|
|
if (null != distributionDeliverySelfEntity.getVehicleId()) { |
|
|
|
|
distributionLoadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); |
|
|
|
|
} |
|
|
|
|
//查询本车次是否第一次扫码,没有则更新上车时间
|
|
|
|
|
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
//更新签收表的装车数量
|
|
|
|
|
Integer j = distributionSignforMapper.updateloadByinvn(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getReservationId(), distributionLoadscanEntity.getPackageNub()); |
|
|
|
|
} |
|
|
|
|
distributionLoadscaninvnService.saveBatch(distributionLoadscanvnEntitiesopen); |
|
|
|
|
} |
|
|
|
|
if (flag == 0 && flag2 == 0) { |
|
|
|
|
return R.fail(4002, "无数据进行装车"); |
|
|
|
|
} |
|
|
|
|
// if (distributionLoadscanEntitiesno.size() > 0) {
|
|
|
|
|
// for (DistributionLoadscanEntity distributionLoadscanEntity : distributionLoadscanEntitiesno) {
|
|
|
|
|
// //查询是否重复扫码
|
|
|
|
@ -1043,8 +1192,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// }
|
|
|
|
|
// distributionLoadscanService.saveBatch(distributionLoadscanEntities);
|
|
|
|
|
// }
|
|
|
|
|
return R.success("成功"); |
|
|
|
|
} |
|
|
|
|
// return R.success("成功");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class) |
|
|
|
@ -1164,9 +1313,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return R.success("成功"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R loadinginventory(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { |
|
|
|
|
@Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class) |
|
|
|
|
public Resp loadinginventory(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { |
|
|
|
|
//库存品
|
|
|
|
|
//获取当前用户司机
|
|
|
|
|
try { |
|
|
|
@ -1185,23 +1336,86 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
String barcode = distrilbutionloadingscanDTO.getBarcode(); |
|
|
|
|
//查询是否重复扫描
|
|
|
|
|
List<DistributionLoadscaninvnEntity> distributionLoadscaninvnEntities = distributionLoadscaninvnMapper.selectList(Wrappers.<DistributionLoadscaninvnEntity>query().lambda() |
|
|
|
|
.eq(DistributionLoadscaninvnEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()) |
|
|
|
|
.ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue())); |
|
|
|
|
if (distributionLoadscaninvnEntities.size()>0 ){ |
|
|
|
|
return R.fail("重复扫描"); |
|
|
|
|
.eq(DistributionLoadscaninvnEntity::getOrderPackageCode, barcode) |
|
|
|
|
.ne(DistributionLoadscaninvnEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()) |
|
|
|
|
.eq(DistributionLoadscaninvnEntity::getDeliveryId,distrilbutionloadingscanDTO.getDeliveryId())); |
|
|
|
|
int size = distributionLoadscaninvnEntities.size(); |
|
|
|
|
if (size == 1 ){ |
|
|
|
|
//这里就是存在有该库存品的扫描
|
|
|
|
|
return Resp.scanFail("重复扫码","接口出错请联系曹义忠"); |
|
|
|
|
}else { |
|
|
|
|
//判断该计划中是否存在该包件码的数据
|
|
|
|
|
|
|
|
|
|
//这里进行扫描数据的插入和库存品包件信息出库数量维护,状态维护
|
|
|
|
|
List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda() |
|
|
|
|
.eq(DisStockListDetailEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) |
|
|
|
|
.ne(DisStockListDetailEntity::getStockPackageStatus,ReservationInventoryStatusConstant.quxiao.getValue())); |
|
|
|
|
List<DisStockListDetailEntity> detailEntities = list.stream().filter(l -> Func.isNotEmpty(l.getStockPackageCode())).collect(Collectors.toList()); |
|
|
|
|
if (detailEntities.size() <= 0 ){ |
|
|
|
|
return Resp.scanFail("库存品还未进行备货","库存品还未进行备货"); |
|
|
|
|
}else { |
|
|
|
|
List<DisStockListDetailEntity> disStockListDetailEntities = detailEntities.stream().filter(d -> d.getStockPackageCode().equals(barcode)).collect(Collectors.toList()); |
|
|
|
|
if (disStockListDetailEntities.size() == 1){ |
|
|
|
|
DistributionLoadscaninvnEntity distributionLoadscaninvnEntity = new DistributionLoadscaninvnEntity(); |
|
|
|
|
BladeUser user = AuthUtil.getUser(); |
|
|
|
|
if (null != distributionDeliverySelfEntity.getDriverId()) { |
|
|
|
|
distributionLoadscaninvnEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); |
|
|
|
|
} |
|
|
|
|
if (null != distributionDeliverySelfEntity.getDriverName()) { |
|
|
|
|
distributionLoadscaninvnEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); |
|
|
|
|
} |
|
|
|
|
if (null != distributionDeliverySelfEntity.getVehicleId()) { |
|
|
|
|
distributionLoadscaninvnEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); |
|
|
|
|
} |
|
|
|
|
if (null != distributionDeliverySelfEntity.getVehicleNub()) { |
|
|
|
|
distributionLoadscaninvnEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); |
|
|
|
|
} |
|
|
|
|
distributionLoadscaninvnEntity.setScanStatus(LoadingStatusConstant.saomiao.getValue()); |
|
|
|
|
distributionLoadscaninvnEntity.setScanType("1"); |
|
|
|
|
distributionLoadscaninvnEntity.setScanUser(user.getUserName()); |
|
|
|
|
distributionLoadscaninvnEntity.setScanTime(new Date()); |
|
|
|
|
distributionLoadscaninvnEntity.setOrderPackageCode(disStockListDetailEntities.get(0).getStockPackageCode()); |
|
|
|
|
distributionLoadscaninvnEntity.setInventoryId(disStockListDetailEntities.get(0).getStockListId()); |
|
|
|
|
distributionLoadscaninvnEntity.setReservationId(disStockListDetailEntities.get(0).getReservationId()); |
|
|
|
|
distributionLoadscaninvnEntity.setOneClick(1); |
|
|
|
|
distributionLoadscaninvnEntity.setLoadedNub(disStockListDetailEntities.get(0).getNum()); |
|
|
|
|
distributionLoadscaninvnEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
distributionLoadscaninvnEntity.setIsInsert(LoadingIsInsertConstant.zhengchang.getValue()); |
|
|
|
|
distributionLoadscaninvnEntity.setScanSynchronous(1); |
|
|
|
|
distributionLoadscaninvnService.save(distributionLoadscaninvnEntity); |
|
|
|
|
//查询本车次是否第一次扫码,没有则更新上车时间
|
|
|
|
|
Integer a = distributionDeliveryListMapper.updateloadingTimeById(distributionLoadscaninvnEntity.getDeliveryId()); |
|
|
|
|
//更新签收表的装车数量
|
|
|
|
|
Integer j = distributionSignforMapper.updateloadByinvn(distributionLoadscaninvnEntity.getDeliveryId(), distributionLoadscaninvnEntity.getReservationId(), distributionLoadscaninvnEntity.getPackageNub()); |
|
|
|
|
//异步处理状态信息
|
|
|
|
|
distributionAsyncService.changeMarketDeliveryListStatus(distributionLoadscaninvnEntity.getOrderPackageCode(),distributionLoadscaninvnEntity.getDeliveryId()); |
|
|
|
|
//处理出库问题
|
|
|
|
|
DistributionStockListEntity distributionStockListEntity = distributionStockListMapper.selectOne(Wrappers.<DistributionStockListEntity>query().lambda().eq(DistributionStockListEntity::getId, distributionLoadscaninvnEntity.getInventoryId())); |
|
|
|
|
distributionStockListEntity.setQuantityStock(distributionStockListEntity.getQuantityStock() - distributionLoadscaninvnEntity.getPackageNub()); |
|
|
|
|
distributionStockListEntity.setQuantityOccupied(distributionStockListEntity.getQuantityStock() - distributionLoadscaninvnEntity.getPackageNub()); |
|
|
|
|
distributionStockListEntity.setOutboundQuantity(distributionStockListEntity.getQuantityStock() + distributionLoadscaninvnEntity.getPackageNub()); |
|
|
|
|
distributionStockListMapper.updateById(distributionStockListEntity); |
|
|
|
|
}else { |
|
|
|
|
return Resp.scanFail("窜货","窜货"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// if (distributionLoadscaninvnEntities.size() == 1) {
|
|
|
|
|
// return R.fail("重复扫描");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//这里就需要将此库存品和计划中的进行校验,如果此时无法从
|
|
|
|
|
//查询出该客户下的所有库存品包件信息
|
|
|
|
|
List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda().eq(DisStockListDetailEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId())); |
|
|
|
|
if ( list.size() < 0 ){ |
|
|
|
|
return R.fail("无效包条!!"); |
|
|
|
|
} |
|
|
|
|
// List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda().eq(DisStockListDetailEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()));
|
|
|
|
|
// if (list.size() < 0) {
|
|
|
|
|
// return R.fail("无效包条!!");
|
|
|
|
|
// }
|
|
|
|
|
//1、不存在这个客户的库存品列表中,串货
|
|
|
|
|
List<DisStockListDetailEntity> disStockListDetailEntities = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda() |
|
|
|
|
.eq(DisStockListDetailEntity::getReservationId, distrilbutionloadingscanDTO.getReservationId()) |
|
|
|
|
.eq(DisStockListDetailEntity::getStockPackageCode, distrilbutionloadingscanDTO.getBarcode())); |
|
|
|
|
if (disStockListDetailEntities.size() == 1){ |
|
|
|
|
if (disStockListDetailEntities.size() == 1) { |
|
|
|
|
//这里就需要插入库存品扫描信息
|
|
|
|
|
ArrayList<DistributionLoadscaninvnEntity> distributionLoadscaninvnEntityArrayList = new ArrayList<>(); |
|
|
|
|
for (int i = 0; i < disStockListDetailEntities.size(); i++) { |
|
|
|
@ -1228,34 +1442,25 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
if (null != distributionDeliverySelfEntity.getVehicleId()) { |
|
|
|
|
distributionLoadscaninvnEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); |
|
|
|
|
} |
|
|
|
|
//查询本车次是否第一次扫码,没有则更新上车时间
|
|
|
|
|
Integer a = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
//更新签收表的装车数量
|
|
|
|
|
Integer j = distributionSignforMapper.updateloadByinvn(distrilbutionloadingscanDTO.getDeliveryId(), distrilbutionloadingscanDTO.getReservationId(), distributionLoadscaninvnEntity.getPackageNub()); |
|
|
|
|
|
|
|
|
|
distributionLoadscaninvnEntityArrayList.add(distributionLoadscaninvnEntity); |
|
|
|
|
} |
|
|
|
|
b = distributionLoadscaninvnService.saveBatch(distributionLoadscaninvnEntityArrayList); |
|
|
|
|
b = distributionLoadscaninvnService.saveBatch(distributionLoadscaninvnEntityArrayList); |
|
|
|
|
|
|
|
|
|
}else { |
|
|
|
|
return R.fail("重复包条码!!"); |
|
|
|
|
} else { |
|
|
|
|
return Resp.scanFail("重复包条码!!","4564"); |
|
|
|
|
} |
|
|
|
|
//2、不存在这个车次中无效包条码
|
|
|
|
|
//3、重复扫码
|
|
|
|
|
distributionAsyncService.changeMarketDeliveryListStatus(distrilbutionloadingscanDTO.getBarcode(),distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
return R.status(b); |
|
|
|
|
distributionAsyncService.changeMarketDeliveryListStatus(distrilbutionloadingscanDTO.getBarcode(), distrilbutionloadingscanDTO.getDeliveryId()); |
|
|
|
|
// return Resp.scanFail(b);
|
|
|
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// // if (distrilbutionloadingscanDTO.getInventorytype() == 3) {
|
|
|
|
|
// //无拆包
|
|
|
|
|
// List<DistributionLoadscaninvnEntity> distributionLoadscanvnEntities = new ArrayList<>();
|
|
|
|
@ -1308,7 +1513,6 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public IPage<DistributionDeliveryListPrintReponseVO> customListPage(IPage<DistributionDeliveryListPrintReponseVO> page, QueryWrapper<DistributionDeliveryListPrintRequestVO> queryWrapper) { |
|
|
|
|
|
|
|
|
@ -1594,7 +1798,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
return R.fail("服务器正忙!!"); |
|
|
|
|
} |
|
|
|
|
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); |
|
|
|
|
if (Func.isEmpty(myCurrentWarehouse)){ |
|
|
|
|
if (Func.isEmpty(myCurrentWarehouse)) { |
|
|
|
|
return R.fail("无仓库信息!!!"); |
|
|
|
|
} |
|
|
|
|
//首先对配送任务进行修改
|
|
|
|
@ -2054,11 +2258,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
if (Func.isNotEmpty(deliveryListDTO.getRemarks())) { |
|
|
|
|
deliveryListEntity.setRemarks(deliveryListDTO.getRemarks()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(stockupInfo.getUnloaderName()) && Func.isNotEmpty(stockupInfo.getUnloaderId())){ |
|
|
|
|
if (Func.isNotEmpty(stockupInfo.getUnloaderName()) && Func.isNotEmpty(stockupInfo.getUnloaderId())) { |
|
|
|
|
deliveryListEntity.setUnloadingTeamId(stockupInfo.getUnloaderId()); |
|
|
|
|
deliveryListEntity.setUnloadingTeamName(stockupInfo.getUnloaderName()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(stockupInfo.getLoaderId()) && Func.isNotEmpty(stockupInfo.getLoaderName())){ |
|
|
|
|
if (Func.isNotEmpty(stockupInfo.getLoaderId()) && Func.isNotEmpty(stockupInfo.getLoaderName())) { |
|
|
|
|
deliveryListEntity.setUnloadingTeamId(stockupInfo.getLoaderId()); |
|
|
|
|
deliveryListEntity.setUnloadingTeamName(stockupInfo.getLoaderName()); |
|
|
|
|
} |
|
|
|
@ -2608,11 +2812,11 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
if (Func.isNotEmpty(deliveryListDTO.getRemarks())) { |
|
|
|
|
deliveryListEntity.setRemarks(deliveryListDTO.getRemarks()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(stockupInfo.getUnloaderName()) && Func.isNotEmpty(stockupInfo.getUnloaderId())){ |
|
|
|
|
if (Func.isNotEmpty(stockupInfo.getUnloaderName()) && Func.isNotEmpty(stockupInfo.getUnloaderId())) { |
|
|
|
|
deliveryListEntity.setUnloadingTeamId(stockupInfo.getUnloaderId()); |
|
|
|
|
deliveryListEntity.setUnloadingTeamName(stockupInfo.getUnloaderName()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(stockupInfo.getLoaderId()) && Func.isNotEmpty(stockupInfo.getLoaderName())){ |
|
|
|
|
if (Func.isNotEmpty(stockupInfo.getLoaderId()) && Func.isNotEmpty(stockupInfo.getLoaderName())) { |
|
|
|
|
deliveryListEntity.setUnloadingTeamId(stockupInfo.getLoaderId()); |
|
|
|
|
deliveryListEntity.setUnloadingTeamName(stockupInfo.getLoaderName()); |
|
|
|
|
} |
|
|
|
@ -2646,13 +2850,13 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
|
|
|
|
|
p.setScanStatus(LoadingStatusConstant.yijianzhuangche.getName()); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(distributionLoadscanEntity.getSigningTime())){ |
|
|
|
|
if (Func.isNotEmpty(distributionLoadscanEntity.getSigningTime())) { |
|
|
|
|
p.setSigningTime(distributionLoadscanEntity.getSigningTime()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(distributionLoadscanEntity.getScanUser())){ |
|
|
|
|
if (Func.isNotEmpty(distributionLoadscanEntity.getScanUser())) { |
|
|
|
|
p.setScanUser(distributionLoadscanEntity.getScanUser()); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(distributionLoadscanEntity.getDriverName())){ |
|
|
|
|
if (Func.isNotEmpty(distributionLoadscanEntity.getDriverName())) { |
|
|
|
|
p.setDriverName(distributionLoadscanEntity.getDriverName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|