Browse Source

增加配送日志

fix-sign
汤建军 5 months ago
parent
commit
3e7e3152fd
  1. 1
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionReservationClient.java
  2. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java
  3. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java
  4. 28
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  5. 56
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  6. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockupServiceImpl.java

1
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionReservationClient.java

@ -100,5 +100,6 @@ public interface IDistributionReservationClient {
* @param params
* @return
*/
@GetMapping(TOP+"/maintainReservationInfo")
Boolean maintainReservationInfo(String params);
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionReservationController.java

@ -202,8 +202,12 @@ public class DistributionReservationController extends BladeController {
@ApiOperationSupport(order = 5)
@ApiOperation(value = "修改", notes = "传入distrbutionReservation")
public R update(@Valid @RequestBody DistributionReservationDTO distributionReservationDTO) {
R result = reservationService.updateReservation(distributionReservationDTO);
return result;
try{
R result = reservationService.updateReservation(distributionReservationDTO);
return result;
}catch (Exception e){
return R.fail(e.getMessage());
}
}
/**

9
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionReservationService.java

@ -18,6 +18,7 @@ package com.logpm.distribution.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.distribution.dto.DistributionCancelReservationPackageDTO;
import com.logpm.distribution.dto.DistributionDeliveryAllocationDTO;
import com.logpm.distribution.dto.DistributionReservationDTO;
@ -30,6 +31,7 @@ import org.springblade.common.enums.BizOperationEnums;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.ReservationVO;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import java.util.List;
@ -145,6 +147,8 @@ public interface IDistributionReservationService extends BaseService<Distributio
*/
R updateReservation(DistributionReservationDTO distributionReservationDTO);
void compareReservation(DistributionReservationEntity reservationEntity, DistributionReservationEntity oldReservation, BladeUser user, BasicdataWarehouseEntity myCurrentWarehouse);
/**
* 商配配送计划添加
* @param allocationDTO
@ -218,6 +222,11 @@ public interface IDistributionReservationService extends BaseService<Distributio
@NotNull
ReservationVO getReservationVO(DistributionReservationEntity reservationEntity);
void handleCreatedReservationPlanLog(DistributionReservationEntity reservationEntity, BladeUser user, BasicdataWarehouseEntity warehouse);
void handleCancelReservationPlanLog(DistributionReservationEntity reservationEntity, BladeUser user, BasicdataWarehouseEntity warehouse, String cancelReason);
/**
* 自提查询库存数量
* @param reservationId

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

@ -2874,6 +2874,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//查询出该配送任务下的客户,并将这些客户根据运单号进行分组
List<DistributionReservationEntity> reservationEntityList = distributionReservationMapper.getDeliveryReservation(deliveryListEntity.getId());
Map<String, List<DistributionReservationEntity>> oldClient = reservationEntityList.stream().collect(Collectors.groupingBy(DistributionReservationEntity::getReceivingUnit));
String oldReservationCode = reservationEntityList.stream().map(DistributionReservationEntity::getReservationCode).collect(Collectors.joining(","));
//订单总数量
AtomicInteger orderTotal = new AtomicInteger();
//配送任务仓库名称
@ -2885,6 +2886,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
Date reservationDate = new Date();
List<DistributionReservationPackageEntity> allPackageList = new ArrayList<>();
List<DistributionReservationZeroPackageEntity> allZeroPackageList = new ArrayList<>();
StringBuilder saa = new StringBuilder();
newClient.forEach((k, v) -> {
HashSet<String> orderNumber = new HashSet<>();
//运单号
@ -2958,6 +2960,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
reservationEntity.setStoreId(storeIds.get(0));
}
reservationEntity.setStatus(1);
saa.append(reservationEntity.getReservationCode()).append(",");
distributionReservationMapper.insert(reservationEntity);
//新增一个客户
v.forEach(s -> {
@ -3177,6 +3180,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
reservationEntity.setStoreName(String.join(",", storeName));
//预约添加订单数量
reservationEntity.setReservationNum(packageTotal.get());
distributionReservationService.handleCreatedReservationPlanLog(reservationEntity,AuthUtil.getUser(),myCurrentWarehouse);
distributionReservationMapper.updateById(reservationEntity);
//推送广播
//进行节点推送
@ -3201,10 +3205,12 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
} else {
//根据配送计划和运单号查询出该预约
DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomerUnit(deliveryListEntityId, k);
DistributionReservationEntity oldReservation = BeanUtil.copy(reservationEntity, DistributionReservationEntity.class);
DistributionSignforEntity signforEntity = distributionSignforService.getOne(Wrappers.<DistributionSignforEntity>query().lambda()
.eq(DistributionSignforEntity::getReservationId, reservationEntity.getId())
.eq(DistributionSignforEntity::getDeliveryId, deliveryListEntity.getId())
);
saa.append(reservationEntity.getReservationCode()).append(",");
//查询出该预约下的订单信息
List<DistributionReservationStockarticleEntity> reservationStockarticleEntityList = distributionReservationStockarticleMapper.selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda().eq(DistributionReservationStockarticleEntity::getReservationId, reservationEntity.getId()).ne(DistributionReservationStockarticleEntity::getStockArticleStatus, ReservationOrderStatusConstant.quxiao.getValue()));
Map<Long, List<DistributionReservationStockarticleEntity>> oldOrder = reservationStockarticleEntityList.stream().collect(Collectors.groupingBy(DistributionReservationStockarticleEntity::getStockArticleId));
@ -3672,6 +3678,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
reservationEntity.setStoreName(String.join(",", storeName));
//预约添加订单数量
reservationEntity.setReservationNum(packageTotal.get());
distributionReservationService.compareReservation(reservationEntity,oldReservation,AuthUtil.getUser(),myCurrentWarehouse);
distributionReservationMapper.updateById(reservationEntity);
deliveryPackageTotal.getAndAdd(reservationEntity.getReservationNum());
}
@ -3682,6 +3689,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
DistributionReservationEntity reservationEntity = baseMapper.selectReservationByDeliveryListIdAndCustomerUnit(deliveryListEntity.getId(), f);
reservationEntity.setReservationStatus(ReservationStatusConstant.yiquexiao.getValue());
distributionReservationMapper.updateById(reservationEntity);
distributionReservationService.handleCancelReservationPlanLog(reservationEntity,AuthUtil.getUser(),myCurrentWarehouse,"商配取消所有订单");
//这里还需要将减少的预约单下的所有订单、包件进行取消状态
List<DistributionReservationStockarticleEntity> entities = distributionReservationStockarticleMapper.selectList(Wrappers.<DistributionReservationStockarticleEntity>query().lambda().ne(DistributionReservationStockarticleEntity::getStockArticleStatus, "2").eq(DistributionReservationStockarticleEntity::getReservationId, reservationEntity.getId()));
entities.forEach(e -> {
@ -3810,7 +3818,8 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//对配送进行更改
this.updateById(deliveryListEntity);
//对修改计划下的所有包件进行维护
//进行配送日志记录
handleUpdateDistributionLog(deliveryListEntity,oldReservationCode,saa.deleteCharAt(saa.lastIndexOf(",")).toString(),myCurrentWarehouse,AuthUtil.getUser());
// 作业节点推送
// distributionNodeWorkService.planDelivery(deliveryListEntity, AuthUtil.getUser(), BizOperationEnums.MODIFY);
@ -4401,6 +4410,23 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
}
}
private void handleUpdateDistributionLog(DistributionDeliveryListEntity deliveryListEntity, String oldReservationCode, String newReservationCode, BasicdataWarehouseEntity myCurrentWarehouse,BladeUser user) {
String distributionContent = user.getNickName() + "在" + myCurrentWarehouse.getName()
+ "修改市配配送计划;车次号:" + deliveryListEntity.getTrainNumber()
+ "预约编号:[" +oldReservationCode + "]变更为-->[" + newReservationCode + "]" + "当前总件数:" + (deliveryListEntity.getDeliveryNumber());
DistributionPlanLogEntity distributionPlanLogEntity = new DistributionPlanLogEntity();
distributionPlanLogEntity.setContent(distributionContent);
distributionPlanLogEntity.setRefId(deliveryListEntity.getId());
distributionPlanLogEntity.setRefCode(deliveryListEntity.getTrainNumber());
distributionPlanLogEntity.setWarehouseId(myCurrentWarehouse.getId());
distributionPlanLogEntity.setWarehouseName(myCurrentWarehouse.getName());
distributionPlanLogEntity.setOperator(user.getNickName());
distributionPlanLogEntity.setType(3);
distributionPlanLogService.save(distributionPlanLogEntity);
}
@Override
public IPage<DistributionParcelListVO> getPackageListByDeliverylistId(IPage<DistributionParcelListEntity> page, Map<String, Object> distributionDeliveryInfoDTO) throws ParseException {
if (Func.isEmpty(distributionDeliveryInfoDTO.get("deliveryId"))) {

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

@ -145,7 +145,6 @@ import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -1546,6 +1545,21 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionPlanLogService.save(distributionPlanLogEntity);
}
private void handleCreatedDistributionLog(DistributionDeliveryListEntity distributionDeliveryListEntity, BasicdataWarehouseEntity myCurrentWarehouse, BladeUser user,String reservationCodes) {
String distributionContent = user.getNickName() + "在" + myCurrentWarehouse.getName()
+ "创建市配配送计划;车次号:" + distributionDeliveryListEntity.getTrainNumber()
+ "预约编号:[" + reservationCodes + "],总件数:" + distributionDeliveryListEntity.getDeliveryNumber();
DistributionPlanLogEntity distributionPlanLogEntity = new DistributionPlanLogEntity();
distributionPlanLogEntity.setContent(distributionContent);
distributionPlanLogEntity.setRefId(distributionDeliveryListEntity.getId());
distributionPlanLogEntity.setRefCode(distributionDeliveryListEntity.getTrainNumber());
distributionPlanLogEntity.setWarehouseId(myCurrentWarehouse.getId());
distributionPlanLogEntity.setWarehouseName(myCurrentWarehouse.getName());
distributionPlanLogEntity.setOperator(user.getNickName());
distributionPlanLogEntity.setType(3);
distributionPlanLogService.save(distributionPlanLogEntity);
}
@Override
@ -2212,7 +2226,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
* @param user
* @param myCurrentWarehouse
*/
private void compareReservation(DistributionReservationEntity reservationEntity, DistributionReservationEntity oldReservation, BladeUser user, BasicdataWarehouseEntity myCurrentWarehouse) {
@Override
public void compareReservation(DistributionReservationEntity reservationEntity, DistributionReservationEntity oldReservation, BladeUser user, BasicdataWarehouseEntity myCurrentWarehouse) {
Integer newPlanNum = reservationEntity.getReservationNum() + reservationEntity.getReservationStockListNum();
Integer oldPlanNum = oldReservation.getReservationNum() + oldReservation.getReservationStockListNum();
String planContent = user.getNickName() + "在" + myCurrentWarehouse.getName()
@ -2301,6 +2316,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
//收货单位
Date date = new Date();
List<JSONObject> aaa = new ArrayList<>();
StringBuffer saa = new StringBuffer();
mallClient.forEach((k, v) -> {
clientTotal.getAndIncrement();
DistributionReservationDTO reservation = allocationDTO.getReservation();
@ -2540,6 +2556,7 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
reservationStockarticleEntity.setStockArticleCode(s.getStockArticleCode());
reservationStockarticleEntity.setStockArticleId(s.getId());
reservationStockarticleEntity.setIsHaveData(s.getIsHaveData());
//进行日志记录
distributionReservationStockarticleService.save(reservationStockarticleEntity);
packageTotal.getAndAdd(reservationStockarticleEntity.getReservationNum());
orderTotal.getAndIncrement();
@ -2609,6 +2626,9 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
reservationEntity.setSigningStatus(ReservationSigningStatusConstant.daiqianshou.getValue());
//预约添加订单数量
reservationEntity.setReservationNum(packageTotal.get());
reservationEntity.setReservationStockListNum(0);
saa.append(reservationEntity.getReservationCode()).append(",");
handleCreatedReservationPlanLog(reservationEntity,user,myCurrentWarehouse);
this.updateById(reservationEntity);
deliveryPackageTotal.getAndAdd(reservationEntity.getReservationNum());
if (Func.isNotEmpty(reservationEntity.getReservationStockListNum())) {
@ -2718,6 +2738,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
distributionDeliveryListEntity.setIsStart(DeliveryStartStatusConstant.daifache.getValue());
distributionDeliveryListEntity.setIsAll(allocationDTO.getIsAll());
distributionDeliveryListService.updateById(distributionDeliveryListEntity);
handleCreatedDistributionLog(distributionDeliveryListEntity, myCurrentWarehouse, user,saa.deleteCharAt(saa.lastIndexOf(",")).toString());
//推送信息至运单追中日志
if (!aaa.isEmpty()) {
trunklinePackageTrackLogClient.addPackageTrackLog(aaa);
@ -2907,9 +2929,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
}
}
handleCancelReservationPlanLog(reservationEntity,AuthUtil.getUser(),myCurrentWarehouse,reservationDTO.getCancelReason());
NodeFanoutMsg<ReservationVO> nodeFanoutMsg =buildNodeFanoutMsgByReservationByCancel(reservationEntity);
distributionNodeWorkService.cancelReservation(nodeFanoutMsg,AuthUtil.getUser());
@ -3673,7 +3694,8 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
return reservationVO;
}
private void handleCreatedReservationPlanLog(DistributionReservationEntity reservationEntity, BladeUser user, BasicdataWarehouseEntity warehouse) {
@Override
public void handleCreatedReservationPlanLog(DistributionReservationEntity reservationEntity, BladeUser user, BasicdataWarehouseEntity warehouse) {
String planContent = user.getNickName() + "在" + warehouse.getName()
+ "创建预约计划;预约计划编号:" + reservationEntity.getReservationCode()
+ ";收货单位:" + reservationEntity.getReceivingUnit()
@ -3681,7 +3703,29 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
+ ",联系电话:" + reservationEntity.getDeliveryPhone()
+ ",收货地址:" + reservationEntity.getDeliveryAddress()
+ ",计划件数:" + (reservationEntity.getReservationNum() + reservationEntity.getReservationStockListNum())
+ ",配送类型:" + (reservationEntity.getDeliveryWay().equals(DistributionTypeConstant.shangpei.getValue()) ? "商配" : "市配");
+ ",配送类型:" + (reservationEntity.getDeliveryType().equals(DistributionTypeConstant.shangpei.getValue()) ? "商配" : "市配");
DistributionPlanLogEntity distributionPlanLogEntity = new DistributionPlanLogEntity();
distributionPlanLogEntity.setContent(planContent);
distributionPlanLogEntity.setRefId(reservationEntity.getId());
distributionPlanLogEntity.setRefCode(reservationEntity.getReservationCode());
distributionPlanLogEntity.setWarehouseId(warehouse.getId());
distributionPlanLogEntity.setWarehouseName(warehouse.getName());
distributionPlanLogEntity.setOperator(user.getNickName());
distributionPlanLogEntity.setType(1);
distributionPlanLogService.save(distributionPlanLogEntity);
}
@Override
public void handleCancelReservationPlanLog(DistributionReservationEntity reservationEntity, BladeUser user, BasicdataWarehouseEntity warehouse, String cancelReason) {
String planContent = user.getNickName() + "在" + warehouse.getName()
+ "取消预约计划;预约计划编号:" + reservationEntity.getReservationCode()
+ ";收货单位:" + reservationEntity.getReceivingUnit()
+ ",收货人:" + reservationEntity.getConsignee()
+ ",联系电话:" + reservationEntity.getDeliveryPhone()
+ ",收货地址:" + reservationEntity.getDeliveryAddress()
+ ",计划件数:" + (reservationEntity.getReservationNum() + reservationEntity.getReservationStockListNum())
+ ",配送类型:" + (reservationEntity.getDeliveryType().equals(DistributionTypeConstant.shangpei.getValue()) ? "商配" : "市配")
+ ",取消原因:" + cancelReason;
DistributionPlanLogEntity distributionPlanLogEntity = new DistributionPlanLogEntity();
distributionPlanLogEntity.setContent(planContent);
distributionPlanLogEntity.setRefId(reservationEntity.getId());

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

@ -402,7 +402,8 @@ public class DistributionStockupServiceImpl extends BaseServiceImpl<Distribution
// vo.setPlanNum(nu.get());
// }
//查询以扫数量
List<DistributionStockEntity> list = distributionStockService.list(Wrappers.<DistributionStockEntity>query().lambda().eq(DistributionStockEntity::getStockupId, vo.getId()));
List<DistributionStockEntity> list = distributionStockService.list(Wrappers.<DistributionStockEntity>query().lambda()
.eq(DistributionStockEntity::getStockupId, vo.getId()));
if (list.isEmpty()) {
vo.setRealNum(0);
} else {

Loading…
Cancel
Save