Browse Source

商配配送计划调整维度为订单收货单位

training
kilo 1 year ago
parent
commit
e9e46d3aa4
  1. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionAddvalueAppController.java
  2. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.java
  3. 60
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionDeliveryListMapper.xml
  4. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.java
  5. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionReservationMapper.xml
  6. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvalueServiceImpl.java
  7. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAsyncServiceImpl.java
  8. 1
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryInfoServiceImpl.java
  9. 10
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  10. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  11. 17
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/appcontroller/DistributionAddvalueAppController.java

@ -78,9 +78,10 @@ public class DistributionAddvalueAppController {
@PostMapping("/getAllPackageList")
@ApiOperationSupport(order = 3)
@ApiOperation(value = "查询该客户下的所有配送包件信息", notes = "DistributionAppDeliveryListDTO")
public List<DistributionAddvaluePackageEntity> getAllPackageList(@Valid @RequestBody DistributionAppAddvalueDTO distributionAppAddvalueDTO) {
public R getAllPackageList(@Valid @RequestBody DistributionAppAddvalueDTO distributionAppAddvalueDTO) {
List<DistributionAddvaluePackageEntity> allPackageList = distributionAddvalueService.getAllPackageList(distributionAppAddvalueDTO);
return allPackageList;
return R.data(200,allPackageList,"成功");
}
/**

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

@ -369,4 +369,12 @@ public interface DistributionDeliveryListMapper extends BaseMapper<DistributionD
* @return
*/
List<DistributionReservationStocklistVO> getInventoryByDeliveryId(IPage<Object> page,@Param("deliveryListId") Long deliveryId);
/**
* 查询该配送计划下指定收货单位的预约信息
* @param deliveryListEntityId
* @param k
* @return
*/
DistributionReservationEntity selectReservationByDeliveryListIdAndCustomerUnit(@Param("deliveryListId")Long deliveryListEntityId,@Param("receivingUnit") String k);
}

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

@ -1347,5 +1347,65 @@
</if>
</where>
</select>
<select id="selectReservationByDeliveryListIdAndCustomerUnit"
resultType="com.logpm.distribution.entity.DistributionReservationEntity">
SELECT
ldr.id,
ldr.tenant_id,
ldr.create_user,
ldr.create_time,
ldr.update_user,
ldr.update_time,
ldr.status,
ldr.is_deleted,
ldr.create_dept,
ldr.stock_article_id,
ldr.mall_id,
ldr.mall_name,
ldr.store_id,
ldr.store_name,
ldr.consignee,
ldr.delivery_address,
ldr.reservation_date,
ldr.serve_type,
ldr.delivery_way,
ldr.delivery_type,
ldr.collect_fee,
ldr.other_fee,
ldr.replace_fee,
ldr.delivery_phone,
ldr.reservation_status,
ldr.order_source,
ldr.stockup_status,
ldr.goods_area_name,
ldr.goods_area_id,
ldr.reserve1,
ldr.reserve2,
ldr.reserve3,
ldr.reserve4,
ldr.reserve5,
ldr.remarks,
ldr.shopping_id,
ldr.period_of_time,
ldr.fee,
ldr.reservation_num,
ldr.reservation_stock_list_num,
ldr.reservation_code,
ldr.service_number,
ldr.cancel_reason,
ldr.is_urgent,
ldr.collection_fee
FROM
logpm_distribution_signfor AS lds
INNER JOIN logpm_distribution_reservation AS ldr ON lds.reservation_id = ldr.id
<where>
<if test="deliveryListId != '' and deliveryListId != null">
and lds.delivery_id = #{deliveryListId}
</if>
<if test="receivingUnit != '' and receivingUnit != null">
and ldr.receiving_unit = #{receivingUnit}
</if>
</where>
</select>
</mapper>

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

@ -173,14 +173,14 @@ public interface DistributionReservationMapper extends BaseMapper<DistributionRe
* @param reservationId
* @return
*/
List<DistributionAddvaluePackageEntity> selectAppInventoryListByReservation(@Param("reservationId") Long reservationId,List<Long> packageListIds);
List<DistributionAddvaluePackageEntity> selectAppInventoryListByReservation(@Param("reservationId") Long reservationId);
/**
* 查询客户下的包件信息
* @param reservationId
* @return
*/
List<DistributionAddvaluePackageEntity> selectAppPackageListByReservationId(@Param("reservationId")Long reservationId,List<Long> packageListIds);
List<DistributionAddvaluePackageEntity> selectAppPackageListByReservationId(@Param("reservationId")Long reservationId);
/**
* 查询出客户下的库存品订单维度信息

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

@ -322,6 +322,7 @@
ldr.is_urgent,
ldr.reservation_stock_list_num,
ldr.waybill_no,
ldr.receiving_unit,
ldr.waybill_id
FROM
logpm_distribution_delivery_list AS lddl
@ -722,10 +723,7 @@
INNER JOIN logpm_dis_stock_list_detail AS ldsld ON ldr.id = ldsld.reservation_id
INNER JOIN logpm_distribution_stock_list AS ldsl ON ldsl.id = ldsld.stock_list_id
WHERE
ldr.id = #{reservationId} and ldsld.stock_package_status in ('1','3') and ldsld.id not in
<foreach collection="packageListIds" item="id" open="(" close=")" index="i" separator=",">
#{id}
</foreach>
ldr.id = #{reservationId} and ldsld.stock_package_status in ('1','3')
</select>
<select id="selectAppPackageListByReservationId"
resultType="com.logpm.distribution.entity.DistributionAddvaluePackageEntity">
@ -733,6 +731,7 @@
ldpl.stock_article_id AS stockArticleId,
ldpl.order_package_code AS orderPackageCode,
ldpl.material_name AS materialName,
ldpl.order_code AS orderCode,
ldpl.quantity AS quantity,
1 AS conditions,
ldpl.create_user AS createUser,
@ -749,11 +748,7 @@
logpm_distribution_reservation_package AS ldrs
INNER JOIN logpm_distribution_parcel_list AS ldpl ON ldrs.parce_list_id = ldpl.id
WHERE
ldrs.packet_bar_status IN ('1','3') and reservation_id = #{reservationId} and ldpl.id not in
<foreach collection="packageListIds" item="id" open="(" close=")" index="i" separator=",">
#{id}
</foreach>
ldrs.packet_bar_status IN ('1','3') and reservation_id = #{reservationId}
</select>
<select id="selectStockListByReservationId"
resultType="com.logpm.distribution.entity.DistributionReservationStocklistEntity">

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

@ -16,6 +16,7 @@
*/
package com.logpm.distribution.service.impl;
import cn.hutool.db.Page;
import com.alibaba.druid.sql.visitor.functions.If;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.distribution.bean.Res;
@ -46,6 +47,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.locks.Condition;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -257,8 +259,8 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
// List<DistributionAddvaluePackageEntity> packageEntityList = distributionAppAddvalueDTO.getPackageEntityList();
List<Long> packageListIds = distributionAppAddvalueDTO.getPackageListIds();
Long reservationId = distributionAppAddvalueDTO.getReservationId();
List<DistributionAddvaluePackageEntity> parcelListEntities = distributionReservationMapper.selectAppPackageListByReservationId(reservationId,packageListIds);
List<DistributionAddvaluePackageEntity> detailEntities = distributionReservationMapper.selectAppInventoryListByReservation(reservationId,packageListIds);
List<DistributionAddvaluePackageEntity> parcelListEntities = distributionReservationMapper.selectAppPackageListByReservationId(reservationId);
List<DistributionAddvaluePackageEntity> detailEntities = distributionReservationMapper.selectAppInventoryListByReservation(reservationId);
parcelListEntities.addAll(detailEntities);
if (Func.isEmpty(parcelListEntities)) {
log.error("################该客户下包件信息:{}", parcelListEntities);
@ -280,6 +282,7 @@ public class DistributionAddvalueServiceImpl extends BaseServiceImpl<Distributio
// }
return parcelListEntities;
}

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

@ -521,8 +521,16 @@ public class DistributionAsyncServiceImpl implements IDistributionAsyncService {
if (inventorySigningFlag && reservationSigningFlag) {
r.setSigningStatus(ReservationSigningStatusConstant.yiqianshou.getValue());
} else {
r.setSigningStatus(ReservationSigningStatusConstant.bufenqianshou.getValue());
inventorySigningFlag = distributionReservationStocklistEntities.stream().allMatch(i -> !i.getSigningStatus().equals(ReservationInventorySigningStatusConstant.yiqianshou.getValue()));
reservationSigningFlag = parcelListEntities.stream().allMatch(p -> !p.getOrderPackageStatus().equals(OrderPackageStatusConstant.yiqianshou.getValue()));
if (inventorySigningFlag && reservationSigningFlag){
r.setSigningStatus(ReservationSigningStatusConstant.daiqianshou.getValue());
}else {
r.setSigningStatus(ReservationSigningStatusConstant.bufenqianshou.getValue());
}
}
distributionReservationMapper.updateById(r);
});

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

@ -129,6 +129,7 @@ public class DistributionDeliveryInfoServiceImpl extends BaseServiceImpl<Distrib
@Override
public IPage<DistributionStockArticleVO> selectDistributionDeliveryorder(IPage<DistributionStockArticleVO> page, DistributionDeliveryInfoDTO distributionDeliveryInfoDTO) {
List<DistributionStockArticleVO> distributionDeliveryInfoVOS = baseMapper.selectDistributionDeliveryOrderPage(page, distributionDeliveryInfoDTO);
for (DistributionStockArticleVO distributionDeliveryInfoVO : distributionDeliveryInfoVOS) {
//查询签收数量
//查询装车数量

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

@ -1903,10 +1903,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
List<DistributionStockArticleDTO> stockArticle = deliveryListDTO.getStockArticle();
DistributionReservationDTO reservation = deliveryListDTO.getReservation();
//根据运单号进行分组
Map<String, List<DistributionStockArticleDTO>> newClient = stockArticle.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getWaybillNumber));
Map<String, List<DistributionStockArticleDTO>> newClient = stockArticle.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getConsigneeUnit));
//查询出该配送任务下的客户,并将这些客户根据运单号进行分组
List<DistributionReservationEntity> reservationEntityList = distributionReservationMapper.getDeliveryReservation(deliveryListEntity.getId());
Map<String, List<DistributionReservationEntity>> oldClient = reservationEntityList.stream().collect(Collectors.groupingBy(DistributionReservationEntity::getWaybillNo));
Map<String, List<DistributionReservationEntity>> oldClient = reservationEntityList.stream().collect(Collectors.groupingBy(DistributionReservationEntity::getReceivingUnit));
//订单总数量
AtomicInteger orderTotal = new AtomicInteger();
//配送任务仓库名称
@ -2066,7 +2066,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
} else {
//根据配送计划和运单号查询出该预约
DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomer(deliveryListEntityId, k);
// DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomer(deliveryListEntityId, k);
DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomerUnit(deliveryListEntityId, k);
//查询出该预约下的订单信息
List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionReservationStockarticleMapper.selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda()
.eq(DistributionReservationStockarticleEntity::getReservationId, reservationEntity.getId())
@ -2208,6 +2209,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionReservationPackageService.updateById(p);
});
reservationStockarticleEntity.setStockArticleStatus(ReservationOrderStatusConstant.quxiao.getValue());
distributionReservationStockarticleMapper.updateById(reservationStockarticleEntity);
});
});
@ -2229,7 +2231,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
});
//删除预约
oldClient.forEach((f, g) -> {
DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomer(deliveryListEntity.getId(), f);
DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomerUnit(deliveryListEntity.getId(), f);
reservationEntity.setReservationStatus(ReservationStatusConstant.yiquexiao.getValue());
distributionReservationMapper.updateById(reservationEntity);
//这里还需要将减少的预约单下的所有订单、包件进行取消状态

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

@ -1384,7 +1384,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionStockupService.save(stockupEntity);
//4、维护配送表数据
DistributionDeliveryListEntity distributionDeliveryListEntity = new DistributionDeliveryListEntity();
String str = Func.random(7, RandomType.ALL) + DateUtil.today();
// String str = Func.random(7, RandomType.ALL) + DateUtil.today();
distributionDeliveryListEntity.setTrainNumber(trainNumberMa());
distributionDeliveryListEntity.setType(DistributionTypeConstant.shangpei.getValue());
distributionDeliveryListEntity.setDeliveryStatus(DeliveryStatusConstant.daipeisong.getValue());
@ -1395,7 +1395,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
List<DistributionStockArticleDTO> stockArticle = allocationDTO.getStockArticle();
//根据运单号进行分组
//TODO 这里先根据运单号进行运单信息查询,后期根据运单进行
Map<String, List<DistributionStockArticleDTO>> mallClient = stockArticle.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getWaybillNumber));
Map<String, List<DistributionStockArticleDTO>> mallClient = stockArticle.stream().collect(Collectors.groupingBy(DistributionStockArticleDTO::getConsigneeUnit));
//配送任务仓库名称
HashSet<String> deliveryWarehouseName = new HashSet<>();
//订单总数量

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

@ -233,15 +233,21 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
if (Func.isNotEmpty(distributionDeliverySelfEntity.getId())) {
distributionLoadscanEntity.setLoadingId(distributionDeliverySelfEntity.getId().toString());
}
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getDriverId())) {
distributionLoadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) {
distributionLoadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
}
if (StringUtils.isNotBlank(distributionDeliverySelfEntity.getVehicleId())) {
distributionLoadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
}
distributionLoadscanEntity.setScanTime(new Date());
distributionLoadscanEntity.setPackageId(collect.get(0).getId());
distributionLoadscanEntity.setOrderPackageCode(distrilbutionloadingscanDTO.getBarcode());
distributionLoadscanEntity.setSigningTime(simpleDateFormat.format(new Date()));
distributionLoadscanEntity.setReceivedQuantity(collect.get(0).getQuantity());
distributionLoadscanEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId());
distributionLoadscanEntity.setIsSignfor(2);
distributionLoadscanEntity.setIsInsert(2);
distributionLoadscanEntity.setSignforState(2);
distributionLoadscanEntity.setPackageNub(collect.get(0).getQuantity());
distributionLoadscanEntity.setOrderId(collect.get(0).getStockArticleId());
distributionLoadscanEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId());
@ -1342,6 +1348,10 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
@Override
public List<DistributionReservationStocklistVO> signforInventoryList(Long signforId) {
List<DistributionReservationStocklistVO> distributionReservationStocklistVOS = distributionSignforMapper.selectInventory(signforId);
boolean flag = distributionReservationStocklistVOS.stream().allMatch(i -> Func.isEmpty(i.getStocklistId()));
if (flag){
return null;
}else {
distributionReservationStocklistVOS.forEach(i->{
if (Func.isNotEmpty(i)){
List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda().eq(DisStockListDetailEntity::getReservationId, i.getReservationId()).eq(DisStockListDetailEntity::getStockListId, i.getStocklistId()));
@ -1351,7 +1361,6 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
break;
case "20":
i.setLoadingStatusName(ReservationInventoryLoadingStatusConstant.bufenzhuangche.getName());
break;
case "30":
i.setLoadingStatusName(ReservationInventoryLoadingStatusConstant.yizhuangche.getName());
@ -1369,8 +1378,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
}
i.setDetailVOS(DistributionDisStockListWrapper.build().listVO(list));
}
});
}
return distributionReservationStocklistVOS;
}

Loading…
Cancel
Save