|
|
|
@ -35,6 +35,7 @@ import com.logpm.distribution.wrapper.DistributionParcelListWrapper;
|
|
|
|
|
import com.logpm.distribution.wrapper.DistributionReservationWrapper; |
|
|
|
|
import com.logpm.distribution.wrapper.DistributionStockArticleWrapper; |
|
|
|
|
import com.logpm.distribution.wrapper.DistributionStockListWrapper; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springblade.common.constant.DistributionTypeConstant; |
|
|
|
|
import org.springblade.common.constant.delivery.DeliveryStatusConstant; |
|
|
|
|
import org.springblade.common.constant.order.OrderReservationStatusConstant; |
|
|
|
@ -45,6 +46,7 @@ import org.springblade.common.constant.reservation.*;
|
|
|
|
|
import org.springblade.common.constant.signing.SignforStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stockup.StockAssignStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stockup.StockupStatusConstant; |
|
|
|
|
import org.springblade.common.constant.stockup.StockupTypeConstant; |
|
|
|
|
import org.springblade.common.serviceConstant.ServiceConstant; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
@ -69,6 +71,7 @@ import java.util.*;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 预约列表 服务实现类 |
|
|
|
@ -494,6 +497,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
//构建中间表信息
|
|
|
|
|
DistributionStockupInfoEntity reservationStockupEntity = new DistributionStockupInfoEntity(); |
|
|
|
|
reservationStockupEntity.setStockupId(id); |
|
|
|
|
reservationStockupEntity.setStockUpType(StockupTypeConstant.shangpei.getValue()); |
|
|
|
|
reservationStockupEntity.setReservationId(reservationEntity.getId()); |
|
|
|
|
result = distributionStockupInfoService.save(reservationStockupEntity); |
|
|
|
|
if (!result) { |
|
|
|
@ -626,6 +630,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
if (Func.equals(reservationEntity.getStockupStatus(), ReservationStockupStatusConstant.weibeihuo.getValue())) { |
|
|
|
|
//如果预约已经备货
|
|
|
|
|
DistributionStockupInfoEntity stockupInfoEntity = new DistributionStockupInfoEntity(); |
|
|
|
|
stockupInfoEntity.setStockUpType(StockupTypeConstant.shipei.getValue()); |
|
|
|
|
stockupInfoEntity.setReservationId(ids.get(i)); |
|
|
|
|
stockupInfoEntity.setStockupId(distributionStockupEntity.getId()); |
|
|
|
|
distributionStockupInfoService.save(stockupInfoEntity); |
|
|
|
@ -764,8 +769,18 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
distributionDeliveryListEntity.setOrderNumber(orderNum.get()); |
|
|
|
|
distributionDeliveryListEntity.setType(DistributionTypeConstant.shipie.getValue()); |
|
|
|
|
distributionDeliveryListEntity.setOrderCode(String.join(",", hashSet)); |
|
|
|
|
distributionDeliveryListEntity.setTaskTime(allocationDTO.getTaskTime()); |
|
|
|
|
// distributionDeliveryListEntity.setTaskTime(allocationDTO.getTaskTime());
|
|
|
|
|
distributionDeliveryListEntity.setNoteNumber(Func.random(13, RandomType.INT)); |
|
|
|
|
String taskTime = allocationDTO.getTaskTime(); |
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
Date parse = null; |
|
|
|
|
try { |
|
|
|
|
parse = format.parse(taskTime); |
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
distributionDeliveryListEntity.setTaskTime(parse); |
|
|
|
|
distributionDeliveryListEntity.setNoteNumber(Func.random(13,RandomType.INT)); |
|
|
|
|
// if (orderIds.length() > 1) {
|
|
|
|
|
// distributionDeliveryListEntity.setOrderId(orderIds.deleteCharAt(orderIds.length() - 1).toString());
|
|
|
|
|
// }
|
|
|
|
@ -790,8 +805,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
List<DistributionReservationStocklistEntity> reservationStocklistEntityList = distributionReservationStocklistService.getBaseMapper().selectList(w); |
|
|
|
|
|
|
|
|
|
//根据预约单信息查询订单信息
|
|
|
|
|
List<DistributionStockArticleVO> distrinbutionStockArticleVOS = distributionStockArticleMapper.getStockArticleByReservationId(reservationEntity.getId()); |
|
|
|
|
distrinbutionStockArticleVOS.forEach(s -> { |
|
|
|
|
List<DistributionStockArticleEntity> distrinbutionStockArticleVOS = distributionStockArticleMapper.getStockArticleByReservationId(reservationEntity.getId()); |
|
|
|
|
List<DistributionStockArticleVO> stockArticleVOS = DistributionStockArticleWrapper.build().listVO(distrinbutionStockArticleVOS); |
|
|
|
|
stockArticleVOS.forEach(s -> { |
|
|
|
|
//这里查询两个东西,一个是该订单在预约中所被选取的包件信息,以及该订单下所有的包件列表
|
|
|
|
|
List<DistributionParcelListEntity> pageVOList = distributionParcelListMapper.getPageVOList(s.getId()); |
|
|
|
|
s.setParcelListVOS(DistributionParcelListWrapper.build().listVO(pageVOList)); |
|
|
|
@ -799,7 +815,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
List<DistributionParcelListEntity> packageVOList = distributionReservationPackageMapper.selectPackageVOList(reservationEntity.getId(), s.getId()); |
|
|
|
|
s.setPackageList(DistributionParcelListWrapper.build().listVO(packageVOList)); |
|
|
|
|
}); |
|
|
|
|
reservationVO.setStockArticleList(distrinbutionStockArticleVOS); |
|
|
|
|
reservationVO.setStockArticleList(stockArticleVOS); |
|
|
|
|
List<DistributionStockListEntity> stockArticleEntityList = distributionReservationStocklistMapper.selectInventory(reservationEntity.getId()); |
|
|
|
|
reservationVO.setInventoryList(DistributionStockListWrapper.build().listVO(stockArticleEntityList)); |
|
|
|
|
return R.data(reservationVO); |
|
|
|
@ -1102,6 +1118,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
clientNum.getAndIncrement(); |
|
|
|
|
//维护预约和备货的关系
|
|
|
|
|
DistributionStockupInfoEntity stockupInfoEntity = new DistributionStockupInfoEntity(); |
|
|
|
|
stockupInfoEntity.setStockUpType(StockupTypeConstant.shangpei.getValue()); |
|
|
|
|
stockupInfoEntity.setReservationId(reservationEntity.getId()); |
|
|
|
|
stockupInfoEntity.setStockupId(stockupEntity.getId()); |
|
|
|
|
distributionStockupInfoService.save(stockupInfoEntity); |
|
|
|
@ -1249,10 +1266,19 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
distributionDeliveryListEntity.setDriverName(driverNames.deleteCharAt(driverNames.length() - 1).toString()); |
|
|
|
|
distributionDeliveryListEntity.setVehicleName(vehicleNubs.deleteCharAt(vehicleNubs.length() - 1).toString()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String taskTime = allocationDTO.getTaskTime(); |
|
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
Date parse = null; |
|
|
|
|
try { |
|
|
|
|
parse = format.parse(taskTime); |
|
|
|
|
} catch (ParseException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
distributionDeliveryListEntity.setTaskTime(parse); |
|
|
|
|
//完善配送信息
|
|
|
|
|
Date taskTime = allocationDTO.getTaskTime(); |
|
|
|
|
if (!Func.isEmpty(taskTime)) { |
|
|
|
|
distributionDeliveryListEntity.setTaskTime(taskTime); |
|
|
|
|
distributionDeliveryListEntity.setTaskTime(parse); |
|
|
|
|
} |
|
|
|
|
distributionDeliveryListEntity.setWarehouseName(String.join(",", deliveryWarehouseName)); |
|
|
|
|
distributionDeliveryListEntity.setOrderCode(String.join(",", orderNumber)); |
|
|
|
@ -1341,4 +1367,43 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
|
|
|
|
|
List<DistributionStockListEntity> stockListEntityList = baseMapper.getReservationStockListInfo(reservationId); |
|
|
|
|
return R.data(stockListEntityList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<DistributionStockArticleVO> selectUpdateAvailableStockArticle(Long reservationId) { |
|
|
|
|
|
|
|
|
|
List<DistributionStockArticleEntity> stockArticleEntityList = distributionStockArticleService.getBaseMapper().selectList(Wrappers.<DistributionStockArticleEntity>query().lambda() |
|
|
|
|
.ne(DistributionStockArticleEntity::getReservationStatus, "30") |
|
|
|
|
.eq(DistributionStockArticleEntity::getTypeService, DistributionTypeConstant.shipie.getValue())); |
|
|
|
|
List<DistributionStockArticleVO> stockArticleVOS = DistributionStockArticleWrapper.build().listVO(stockArticleEntityList); |
|
|
|
|
stockArticleVOS.forEach(s->{ |
|
|
|
|
//查询出这个订单的所有包件信息
|
|
|
|
|
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId())); |
|
|
|
|
s.setParcelListVOS(DistributionParcelListWrapper.build().listVO(parcelListEntityList)); |
|
|
|
|
}); |
|
|
|
|
//这里还需要查询出该预约单下的订单信息
|
|
|
|
|
List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionReservationStockarticleService.getBaseMapper().selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda().eq(DistributionReservationStockarticleEntity::getReservationId, reservationId)); |
|
|
|
|
List<DistributionStockArticleVO> stockArticleVOArrayList = new ArrayList<>(); |
|
|
|
|
reservationStockarticleEntityList.forEach(r->{ |
|
|
|
|
List<DistributionStockArticleEntity> stockArticleEntities = distributionStockArticleService.getBaseMapper().selectList(Wrappers.<DistributionStockArticleEntity>query().lambda().eq(DistributionStockArticleEntity::getId, r.getStockArticleId())); |
|
|
|
|
List<DistributionStockArticleVO> stockArticleVOList = DistributionStockArticleWrapper.build().listVO(stockArticleEntities); |
|
|
|
|
stockArticleVOList.forEach(s->{ |
|
|
|
|
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListService.getBaseMapper().selectList(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getStockArticleId, s.getId())); |
|
|
|
|
s.setParcelListVOS(DistributionParcelListWrapper.build().listVO(parcelListEntityList)); |
|
|
|
|
List<DistributionReservationPackageEntity> reservationPackageEntityList = distributionReservationPackageService.getBaseMapper().selectList(Wrappers.<DistributionReservationPackageEntity>query().lambda() |
|
|
|
|
.eq(DistributionReservationPackageEntity::getReservationId, reservationId) |
|
|
|
|
.eq(DistributionReservationPackageEntity::getStockArticleId, s.getId())); |
|
|
|
|
List<DistributionParcelListVO> packageList = new ArrayList<>(); |
|
|
|
|
reservationPackageEntityList.forEach(p->{ |
|
|
|
|
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getById(p.getParceListId()); |
|
|
|
|
packageList.add(DistributionParcelListWrapper.build().entityVO(parcelListEntity)); |
|
|
|
|
}); |
|
|
|
|
s.setPackageList(packageList); |
|
|
|
|
stockArticleVOArrayList.add(s); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
stockArticleVOS.addAll(stockArticleVOArrayList); |
|
|
|
|
List<DistributionStockArticleVO> stockArticleVOList = stockArticleVOS.stream().distinct().collect(Collectors.toList()); |
|
|
|
|
return stockArticleVOS; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|