Browse Source

Merge remote-tracking branch 'origin/dev' into fix_node_event

pre-production
pref_mail@163.com 3 months ago
parent
commit
ebefebafa4
  1. 2
      blade-biz-common/src/main/java/org/springblade/common/constant/WorkNodeEnums.java
  2. 10
      blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java
  3. 2
      blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java
  4. 89
      blade-biz-common/src/main/java/org/springblade/common/model/RetentionVO.java
  5. 14
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java
  6. 12
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionReservationClient.java
  7. 14
      blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchTrainDetailEntity.java
  8. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java
  9. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionReservationClient.java
  10. 33
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/BillPlanReportListener.java
  11. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/BillReViewReportListener.java
  12. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/BillSignforReportListener.java
  13. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java
  14. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/LoadingReportListener.java
  15. 117
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java
  16. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverAddListener.java
  17. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReViewReportListener.java
  18. 16
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReportListener.java
  19. 67
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReservationPlanReportListener.java
  20. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/SignforReportListener.java
  21. 20
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java
  22. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionNodeWorkService.java
  23. 58
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  24. 11
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java
  25. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  26. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/QualityDeliverServiceImpl.java
  27. 21
      blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java
  28. 7
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java
  29. 73
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java
  30. 68
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionScanServiceImpl.java

2
blade-biz-common/src/main/java/org/springblade/common/constant/WorkNodeEnums.java

@ -81,7 +81,7 @@ public enum WorkNodeEnums implements Serializable {
DISTRIBUTION_CAR_START(302040, "配送发车"),
DISTRIBUTION_CAR_ARRIVED(302050, "配送到达"),
DISTRIBUTION_SIGN_FOR(302060, "配送签收"),
DISTRIBUTION_RETENTION(302070, "配送滞留"),
DISTRIBUTION_RETENTION(302070, "配送回库"),
DISTRIBUTION_ABNORMAL_SIGN_FOR(302080, "异常签收"),
DISTRIBUTION_FAIL(302090, "配送失败"),

10
blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java

@ -286,6 +286,16 @@ public abstract class FanoutConstants {
}
}
interface DeliveryRetention {
String EXCHANGE = "fanout.distribution.retention" + ModuleNameConstant.DEVAUTH;
// String EXCHANGE_DELAY = "fanout.distribution.plan.delay" + ModuleNameConstant.DEVAUTH;
interface QUEUE {
String REPORT = "fanout.distribution.retention.report" + ModuleNameConstant.DEVAUTH;
}
}
/**
* 备货节点
*

2
blade-biz-common/src/main/java/org/springblade/common/model/DistributionTaskVO.java

@ -26,6 +26,8 @@ public class DistributionTaskVO implements Serializable {
private String ynWholeVehicle;
/** 三方配送价格 */
private String price;
/** 配送任务备注 */
private String remark;
/** 司机和车辆信息 */
private List<PlanDriverbindCarVO> planDriverbindCars;

89
blade-biz-common/src/main/java/org/springblade/common/model/RetentionVO.java

@ -0,0 +1,89 @@
package org.springblade.common.model;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 预约作业节点VO
*/
@Data
public class RetentionVO {
private Long id;
/**
* 预约单号
*/
private String reservationCode;
/**
* 预约时间
*/
private Date reservationDate;
/**
* 收货单位
*/
private String receivingUnit;
/**
* 收货人
*/
private String consignee;
/**
* 收件地址
*/
private String deliveryAddress;
/**
* 收件电话
*/
private String deliveryPhone;
/**
* 商场名称
*/
private String mallName;
/**
* 门店名称
*/
private String storeName;
/**
* 仓库名称
*/
private String warehouseName;
/**
* 预约库存品数量
*/
private Integer reservationStockListNum;
/**
* 预约定制品数量+预约零担数量
*/
private Integer reservationNum;
/**
* 配送类型1-商配2-市配
*/
private String deliveryType;
/**
* 预约数据列表
* 包含包件 零担 库存破
*/
private List<PackageData> packageDataList;
}

14
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/entity/QualityDeliverEntity.java

@ -374,6 +374,11 @@ public class QualityDeliverEntity extends TenantEntity {
*/
@ApiModelProperty(value = "配送公司")
private String distributionCompany;
/**
* 配送备注
*/
@ApiModelProperty(value = "配送备注")
private String deliveryRemark;
/**
* 配送是否整车计费
*/
@ -515,9 +520,9 @@ public class QualityDeliverEntity extends TenantEntity {
@ApiModelProperty(value = "到达地址")
private String arriveAddress;
/**
* 签收id
* 签收归属司机id
*/
@ApiModelProperty(value = "签收id")
@ApiModelProperty(value = "签收归属司机id")
private String signUserId;
/**
* 签收人
@ -559,6 +564,11 @@ public class QualityDeliverEntity extends TenantEntity {
*/
@ApiModelProperty(value = "签收车辆id")
private Long signCarId;
/**
* 签收归属司机
*/
@ApiModelProperty(value = "签收归属司机")
private String signDriverName;
/**
* 签收类型按件签收 批量签收 补录
*/

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

@ -20,10 +20,14 @@ import com.logpm.distribution.entity.DistributionReservationEntity;
import com.logpm.distribution.vo.DistributionRetentionScanVo;
import org.apache.ibatis.annotations.Param;
import org.springblade.common.constant.ModuleNameConstant;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.ReservationVO;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
@ -102,4 +106,12 @@ public interface IDistributionReservationClient {
*/
@GetMapping(TOP+"/maintainReservationInfo")
Boolean maintainReservationInfo(String params);
/**
* 广播
* @param nodeFanoutMsg
* @param user
*/
@PostMapping(TOP+"/planRetention")
void planRetention(@RequestBody NodeFanoutMsg<ReservationVO> nodeFanoutMsg);
}

14
blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/entity/ExpenseDispatchTrainDetailEntity.java

@ -45,6 +45,12 @@ public class ExpenseDispatchTrainDetailEntity extends TenantEntity {
@ApiModelProperty(value = "配送车辆")
@ExcelProperty("配送车辆")
private String deliveryVehicle;
/**
* 配送司机
*/
@ApiModelProperty(value = "配送司机")
@ExcelProperty("配送司机")
private String deliveryDriver;
/**
* 配送车型
*/
@ -106,11 +112,11 @@ public class ExpenseDispatchTrainDetailEntity extends TenantEntity {
@ExcelIgnore
private String carrierType;
/**
* 配送司机
* 配送备注
*/
@ApiModelProperty(value = "配送司机")
@ExcelProperty("配送司机")
private String deliveryDriver;
@ApiModelProperty(value = "配送备注")
@ExcelProperty("配送备注")
private String deliveryRemark;
/**
* 计划总件数
*/

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java

@ -137,7 +137,7 @@ public class BasicdataDriverArteryController extends BladeController {
List<BasicdataDriverWarehouseEntity> warehouseEntities = basicdataDriverWarehouseService.list(Wrappers.<BasicdataDriverWarehouseEntity>lambdaQuery().eq(BasicdataDriverWarehouseEntity::getWarehouseId, basicdataDriverArtery.get("warehouseId")));
if (CollUtil.isNotEmpty(warehouseEntities)) {
Set<Long> collect = warehouseEntities.stream().map(BasicdataDriverWarehouseEntity::getDriverId).collect(Collectors.toSet());
List<BasicdataDriverArteryEntity> list = basicdataDriverArteryService.list(Wrappers.<BasicdataDriverArteryEntity>lambdaQuery().in(BasicdataDriverArteryEntity::getId, collect));
List<BasicdataDriverArteryEntity> list = basicdataDriverArteryService.list(Wrappers.<BasicdataDriverArteryEntity>lambdaQuery().in(BasicdataDriverArteryEntity::getId, collect).isNotNull(BasicdataDriverArteryEntity::getUserId));
return R.data(list);
}
return R.data(null);

13
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionReservationClient.java

@ -20,14 +20,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.distribution.dto.DistributionCancelReservationPackageDTO;
import com.logpm.distribution.entity.DistributionReservationEntity;
import com.logpm.distribution.service.IDistributionNodeWorkService;
import com.logpm.distribution.service.IDistributionReservationService;
import com.logpm.distribution.vo.DistributionRetentionScanVo;
import lombok.AllArgsConstructor;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.ReservationVO;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@ -49,6 +51,8 @@ public class DistributionReservationClient implements IDistributionReservationCl
private final IDistributionReservationService reservationService;
private final IDistributionNodeWorkService distributionNodeWorkService;
@Override
@GetMapping(TOP)
public BladePage<DistributionReservationEntity> reservationTop(Integer current, Integer size) {
@ -117,5 +121,10 @@ public class DistributionReservationClient implements IDistributionReservationCl
return false;
}
@Override
public void planRetention(NodeFanoutMsg<ReservationVO> nodeFanoutMsg) {
distributionNodeWorkService.planRetention(nodeFanoutMsg);
}
}

33
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/BillPlanReportListener.java

@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -72,12 +73,15 @@ public class BillPlanReportListener implements ReportService {
}
cmpMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.CMP.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
ltlMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.LTL.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getCategory()) && StrUtil.isNotEmpty(item.getOrderCode()))
.collect(Collectors.groupingBy(item -> item.getCategory() + item.getOrderCode()));
invMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.INV.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getMallName()) && StrUtil.isNotEmpty(item.getMaterielCode()) && StrUtil.isNotEmpty(item.getIncomingBatch()))
.collect(Collectors.groupingBy(item -> item.getMallName() + item.getMaterielCode() + item.getIncomingBatch()));
}
}
@ -111,6 +115,10 @@ public class BillPlanReportListener implements ReportService {
qualityDeliverEntity.setId(cmpMap.get(detail.getPackageCode()).get(0).getId());
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
} else {
qualityDeliverEntity.setDeliveryCreateUserName(bean.getOperator());
qualityDeliverEntity.setDeliveryPlanTime(bean.getOperatorTime());
qualityDeliverEntity.setPlanReservationCreateTime(bean.getOperatorTime());
qualityDeliverEntity.setPlanReservationUser(bean.getOperator());
sendReport(qualityDeliverEntity, BizOperationEnums.ADD);
}
}
@ -123,6 +131,10 @@ public class BillPlanReportListener implements ReportService {
qualityDeliverEntity.setId(ltlMap.get(detail.getProductName() + detail.getOrderCode()).get(0).getId());
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
} else {
qualityDeliverEntity.setDeliveryCreateUserName(bean.getOperator());
qualityDeliverEntity.setDeliveryPlanTime(bean.getOperatorTime());
qualityDeliverEntity.setPlanReservationCreateTime(bean.getOperatorTime());
qualityDeliverEntity.setPlanReservationUser(bean.getOperator());
sendReport(qualityDeliverEntity, BizOperationEnums.ADD);
}
}
@ -143,12 +155,16 @@ public class BillPlanReportListener implements ReportService {
QualityDeliverEntity entity = new QualityDeliverEntity();
BeanUtil.copyProperties(qualityDeliverEntity, entity);
entity.setPlanNum(1);
qualityDeliverEntity.setDeliveryCreateUserName(bean.getOperator());
qualityDeliverEntity.setDeliveryPlanTime(bean.getOperatorTime());
qualityDeliverEntity.setPlanReservationCreateTime(bean.getOperatorTime());
qualityDeliverEntity.setPlanReservationUser(bean.getOperator());
sendReport(entity, BizOperationEnums.ADD);
}
for (QualityDeliverEntity deliverEntity : qualityDeliverEntities) {
qualityDeliverEntity.setId(deliverEntity.getId());
qualityDeliverEntity.setPlanNum(1);
sendReport(qualityDeliverEntity, BizOperationEnums.DELETE);
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
}
} else if (number == size) {
for (QualityDeliverEntity deliverEntity : qualityDeliverEntities) {
@ -160,16 +176,27 @@ public class BillPlanReportListener implements ReportService {
List<QualityDeliverEntity> collect = qualityDeliverEntities.stream()
.filter(item -> StrUtil.isEmpty(item.getOrderPackageCode()))
.collect(Collectors.toList());
Set<Long> delIds = new HashSet<>();
if (CollUtil.isNotEmpty(collect)) {
int i = size - number;
if (i >= collect.size()) {
for (QualityDeliverEntity entity : collect) {
sendReport(entity, BizOperationEnums.DELETE);
delIds.add(entity.getId());
}
} else {
for (int j = 0; j < i; j++) {
sendReport(collect.get(j), BizOperationEnums.DELETE);
delIds.add(collect.get(j).getId());
}
}
for (QualityDeliverEntity deliverEntity : qualityDeliverEntities) {
if(delIds.contains(deliverEntity.getId())){
continue;
}
qualityDeliverEntity.setId(deliverEntity.getId());
qualityDeliverEntity.setPlanNum(1);
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
}
}
}
@ -178,6 +205,10 @@ public class BillPlanReportListener implements ReportService {
QualityDeliverEntity entity = new QualityDeliverEntity();
BeanUtil.copyProperties(qualityDeliverEntity, entity);
entity.setPlanNum(1);
qualityDeliverEntity.setDeliveryCreateUserName(bean.getOperator());
qualityDeliverEntity.setDeliveryPlanTime(bean.getOperatorTime());
qualityDeliverEntity.setPlanReservationCreateTime(bean.getOperatorTime());
qualityDeliverEntity.setPlanReservationUser(bean.getOperator());
sendReport(entity, BizOperationEnums.ADD);
}
}

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/BillReViewReportListener.java

@ -69,12 +69,15 @@ public class BillReViewReportListener implements ReportService {
if (CollUtil.isNotEmpty(qualityDeliverEntities)) {
cmpMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.CMP.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
ltlMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.LTL.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getCategory()) && StrUtil.isNotEmpty(item.getOrderCode()))
.collect(Collectors.groupingBy(item -> item.getCategory() + item.getOrderCode()));
invMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.INV.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
}
}

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/BillSignforReportListener.java

@ -69,12 +69,15 @@ public class BillSignforReportListener implements ReportService {
if (CollUtil.isNotEmpty(qualityDeliverEntities)) {
cmpMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.CMP.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
ltlMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.LTL.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getCategory()) && StrUtil.isNotEmpty(item.getOrderCode()))
.collect(Collectors.groupingBy(item -> item.getCategory() + item.getOrderCode()));
invMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.INV.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
}
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java

@ -288,6 +288,9 @@ public class DeliverFinishReportListener implements ReportService {
if (addvaluePackageMap.containsKey(entity.getOrderPackageCode() + "1")) {
stairsNumber = Convert.toInt(addvaluePackageMap.get(entity.getOrderPackageCode() + "1"));
}
if (!NumberUtil.equals(stairsNumber, 0)) {
stairsNumber = stairsNumber - 1;
}
// 平移米数
Integer translationNumber = 0;
if (addvaluePackageMap.containsKey(entity.getOrderPackageCode() + "3")) {
@ -757,9 +760,12 @@ public class DeliverFinishReportListener implements ReportService {
}
Set<Long> longs = valueMap.keySet();
Integer dkp = 0;
if(CollUtil.isNotEmpty(allRouteMap)){
if (CollUtil.isNotEmpty(allRouteMap)) {
dkp = allRouteMap.keySet().size();
}
if (!NumberUtil.equals(dkp, 0)) {
dkp = dkp - 1;
}
for (Map.Entry<Long, QualityDeliverEntity> entityEntry : valueMap.entrySet()) {
QualityDeliverEntity value2 = entityEntry.getValue();
String siteSubsidyCost = priceVO.getSiteSubsidyCost();

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/LoadingReportListener.java

@ -69,12 +69,15 @@ public class LoadingReportListener implements ReportService {
if (CollUtil.isNotEmpty(qualityDeliverEntities)) {
cmpMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.CMP.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
ltlMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.LTL.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getCategory()) && StrUtil.isNotEmpty(item.getOrderCode()))
.collect(Collectors.groupingBy(item -> item.getCategory() + item.getOrderCode()));
invMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.INV.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
}
}

117
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/PlanReportListener.java

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -75,29 +77,55 @@ public class PlanReportListener implements ReportService {
Map<String, List<QualityDeliverEntity>> cmpMap = new HashMap<>();
Map<String, List<QualityDeliverEntity>> ltlMap = new HashMap<>();
Map<String, List<QualityDeliverEntity>> invMap = new HashMap<>();
Integer totalNum = 0;
for (ReservationVO reservationVO : reservationVOList) {
List<PackageData> details = reservationVO.getPackageDataList();
if (CollUtil.isNotEmpty(details)) {
totalNum = totalNum + details.size();
}
}
if (CollUtil.isNotEmpty(reservationCodeSet)) {
List<QualityDeliverEntity> qualityDeliverEntities = qualityDeliverService.list(Wrappers.<QualityDeliverEntity>lambdaQuery().in(QualityDeliverEntity::getPlanReservationCode, reservationCodeSet));
if (CollUtil.isNotEmpty(qualityDeliverEntities)) {
if (bizOperation.equals(BizOperationEnums.ADD)) {
if (!NumberUtil.equals(qualityDeliverEntities.size(), totalNum)) {
// 没有查询到,延迟10秒重新推送
factoryDataClient.sendMessage(SendMsg.builder()
.exchange(FanoutConstants.distribution.DeliveryAndPlan.EXCHANGE_DELAY)
.routingKey(null)
.message(msg)
.delay(10000)
.build());
return;
}
}
cmpMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.CMP.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getPlanReservationCode() + item.getOrderPackageCode()));
ltlMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.LTL.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getCategory()) && StrUtil.isNotEmpty(item.getOrderCode()))
.collect(Collectors.groupingBy(item -> item.getPlanReservationCode() + item.getCategory() + item.getOrderCode()));
invMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.INV.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getPlanReservationCode()) && StrUtil.isNotEmpty(item.getMallName()) && StrUtil.isNotEmpty(item.getMaterielCode()))
.collect(Collectors.groupingBy(item -> item.getPlanReservationCode() + item.getMallName() + item.getMaterielCode()));
} else {
// 没有查询到,延迟30秒重新推送
// 没有查询到,延迟10秒重新推送
factoryDataClient.sendMessage(SendMsg.builder()
.exchange(FanoutConstants.distribution.DeliveryAndPlan.EXCHANGE_DELAY)
.routingKey(null)
.message(msg)
.delay(30000)
.delay(10000)
.build());
return;
}
}
Set<String> cmpSet = new HashSet<>();
Set<String> ltlSet = new HashSet<>();
Set<String> invSet = new HashSet<>();
Set<Long> invedSet = new HashSet<>();
for (ReservationVO reservationVO : reservationVOList) {
String reservationCode = reservationVO.getReservationCode();
List<PackageData> details = reservationVO.getPackageDataList();
@ -106,7 +134,6 @@ public class PlanReportListener implements ReportService {
QualityDeliverEntity qualityDeliverEntity = QualityDeliverEntity.builder()
.warehouseName(bean.getWarehouse())
.warehouseId(warehouseId)
.orderPackageCode(detail.getPackageCode())
.planTrainNumber(vo.getTrainNumber())
.deliveryTime(DateUtil.parseDate(vo.getTaskTime()))
.deliveryType(vo.getType())
@ -114,11 +141,10 @@ public class PlanReportListener implements ReportService {
.vehicleName(vehicleName)
.driverName(driverName)
.distributionCompany(vo.getDistributionCompany())
.deliveryPlanTime(bean.getOperatorTime())
.deliveryCreateUserName(bean.getOperator())
.bizCode(reservationVO.getReservationCode())
.ynWholeVehicle(vo.getYnWholeVehicle())
.deliveryFee(vo.getPrice())
.deliveryRemark(vo.getRemark())
.build();
if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) {
qualityDeliverEntity.setConditions(1);
@ -127,9 +153,16 @@ public class PlanReportListener implements ReportService {
if (BizOperationEnums.DELETE.equals(bizOperation)) {
sendReport(qualityDeliverEntity, BizOperationEnums.DELETE);
} else {
if(BizOperationEnums.ADD.equals(bizOperation)){
qualityDeliverEntity.setDeliveryPlanTime(bean.getOperatorTime());
qualityDeliverEntity.setDeliveryCreateUserName(bean.getOperator());
}
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
}
}
if (StrUtil.isNotEmpty(detail.getPackageCode())) {
cmpSet.add(reservationCode + detail.getPackageCode());
}
} else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.LTL)) {
qualityDeliverEntity.setOrderCode(detail.getOrderCode());
qualityDeliverEntity.setCategory(detail.getProductName());
@ -139,9 +172,16 @@ public class PlanReportListener implements ReportService {
if (BizOperationEnums.DELETE.equals(bizOperation)) {
sendReport(qualityDeliverEntity, BizOperationEnums.DELETE);
} else {
if(BizOperationEnums.ADD.equals(bizOperation)){
qualityDeliverEntity.setDeliveryPlanTime(bean.getOperatorTime());
qualityDeliverEntity.setDeliveryCreateUserName(bean.getOperator());
}
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
}
}
if (StrUtil.isNotEmpty(detail.getProductName()) && StrUtil.isNotEmpty(detail.getOrderCode())) {
ltlSet.add(reservationCode + detail.getProductName() + detail.getOrderCode());
}
} else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) {
qualityDeliverEntity.setBizCode(reservationVO.getReservationCode());
qualityDeliverEntity.setIncomingBatch(detail.getPickupBatch());
@ -154,47 +194,52 @@ public class PlanReportListener implements ReportService {
if (CollUtil.isNotEmpty(qualityDeliverEntities)) {
if (BizOperationEnums.DELETE.equals(bizOperation)) {
for (QualityDeliverEntity deliverEntity : qualityDeliverEntities) {
qualityDeliverEntity.setId(deliverEntity.getId());
sendReport(qualityDeliverEntity, BizOperationEnums.DELETE);
if (!invedSet.contains(deliverEntity.getId())) {
qualityDeliverEntity.setId(deliverEntity.getId());
sendReport(qualityDeliverEntity, BizOperationEnums.DELETE);
}
invedSet.add(deliverEntity.getId());
}
} else {
for (QualityDeliverEntity deliverEntity : qualityDeliverEntities) {
qualityDeliverEntity.setId(deliverEntity.getId());
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
if (!invedSet.contains(deliverEntity.getId())) {
qualityDeliverEntity.setId(deliverEntity.getId());
if(BizOperationEnums.ADD.equals(bizOperation)){
qualityDeliverEntity.setDeliveryPlanTime(bean.getOperatorTime());
qualityDeliverEntity.setDeliveryCreateUserName(bean.getOperator());
}
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
}
invedSet.add(deliverEntity.getId());
}
}
}
}
if (StrUtil.isNotEmpty(detail.getMallName()) && StrUtil.isNotEmpty(detail.getMaterialCode())) {
invSet.add(reservationCode + detail.getMallName() + detail.getMaterialCode());
}
}
}
}
// 系统中有的包件在当前不存在,则删除
Set<String> cmpSet = details.stream()
.filter(item -> ObjectUtil.equals(item.getPackageType(), PackageTypeEnums.CMP))
.map(i -> reservationCode + i.getPackageCode()).collect(Collectors.toSet());
for (Map.Entry<String, List<QualityDeliverEntity>> entry : cmpMap.entrySet()) {
String key = entry.getKey();
if (!cmpSet.contains(key)) {
sendReport(entry.getValue().get(0), BizOperationEnums.DELETE);
}
}
for (Map.Entry<String, List<QualityDeliverEntity>> entry : cmpMap.entrySet()) {
String key = entry.getKey();
if (!cmpSet.contains(key)) {
sendReport(entry.getValue().get(0), BizOperationEnums.DELETE);
}
Set<String> ltlSet = details.stream().filter(item -> ObjectUtil.equals(item.getPackageType(), PackageTypeEnums.LTL))
.map(i -> reservationCode + i.getProductName() + i.getOrderCode()).collect(Collectors.toSet());
for (Map.Entry<String, List<QualityDeliverEntity>> entry : ltlMap.entrySet()) {
String key = entry.getKey();
if (!ltlSet.contains(key)) {
sendReport(entry.getValue().get(0), BizOperationEnums.DELETE);
}
}
for (Map.Entry<String, List<QualityDeliverEntity>> entry : ltlMap.entrySet()) {
String key = entry.getKey();
if (!ltlSet.contains(key)) {
sendReport(entry.getValue().get(0), BizOperationEnums.DELETE);
}
Set<String> invSet = details.stream().filter(item -> ObjectUtil.equals(item.getPackageType(), PackageTypeEnums.INV))
.map(i -> reservationCode + i.getMallName() + i.getMaterialCode()).collect(Collectors.toSet());
for (Map.Entry<String, List<QualityDeliverEntity>> entry : invMap.entrySet()) {
String key = entry.getKey();
if (!invSet.contains(key)) {
List<QualityDeliverEntity> value = entry.getValue();
for (QualityDeliverEntity entity : value) {
sendReport(entity, BizOperationEnums.DELETE);
}
}
for (Map.Entry<String, List<QualityDeliverEntity>> entry : invMap.entrySet()) {
String key = entry.getKey();
if (!invSet.contains(key)) {
List<QualityDeliverEntity> value = entry.getValue();
for (QualityDeliverEntity entity : value) {
sendReport(entity, BizOperationEnums.DELETE);
}
}
}
@ -209,10 +254,6 @@ public class PlanReportListener implements ReportService {
.build();
String exchange = ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE;
String routKey = ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY;
if (operationEnums.equals(BizOperationEnums.ADD)) {
exchange = ReportConstants.REPORT_QUALITY_DELIVER_ADD_EXCHANGE;
routKey = ReportConstants.REPORT_QUALITY_DELIVER_ADD_ROUTINGKEY;
}
factoryDataClient.sendMessage(SendMsg.builder()
.exchange(exchange)
.routingKey(routKey)

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverAddListener.java

@ -31,7 +31,6 @@ import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.Nullable;
import org.springblade.common.constant.WorkNodeEnums;
import org.springblade.common.enums.BizOperationEnums;
import org.springblade.common.enums.PackageTypeEnums;
import org.springblade.core.redis.cache.BladeRedis;
@ -98,6 +97,10 @@ public class QualityDeliverAddListener implements ReportService {
// 查询不存在时更新,存在时修改
saveOrUpdate(null, qualityDeliverEntity);
}
if (ObjectUtil.equals(bean.getOperation(), BizOperationEnums.MODIFY)) {
// 查询不存在时更新,存在时修改
qualityDeliverService.updateById(qualityDeliverEntity);
}
}
/**

3
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReViewReportListener.java

@ -68,12 +68,15 @@ public class ReViewReportListener implements ReportService {
if (CollUtil.isNotEmpty(qualityDeliverEntities)) {
cmpMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.CMP.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
ltlMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.LTL.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getCategory()) && StrUtil.isNotEmpty(item.getOrderCode()))
.collect(Collectors.groupingBy(item -> item.getCategory() + item.getOrderCode()));
invMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.INV.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
}
}

16
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReportListener.java

@ -55,6 +55,7 @@ public class ReportListener {
try {
selectReportService(BillPlanReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("自提任务生成明细报表失败: {}", e.getMessage());
}
}
@ -82,6 +83,7 @@ public class ReportListener {
try {
selectReportService(BillReViewReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("自提复核生成明细报表失败: {}", e.getMessage());
}
}
@ -109,6 +111,7 @@ public class ReportListener {
try {
selectReportService(BillSignforReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("自提签收扫描生成明细报表失败: {}", e.getMessage());
}
}
@ -136,6 +139,7 @@ public class ReportListener {
try {
selectReportService(CarStartReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("发车生成明细报表失败: {}", e.getMessage());
}
}
@ -163,6 +167,7 @@ public class ReportListener {
try {
selectReportService(ConsigneeArriveReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("配送到达生成明细报表失败: {}", e.getMessage());
}
}
@ -218,6 +223,7 @@ public class ReportListener {
try {
selectReportService(LoadingReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("装车生成明细报表失败: {}", e.getMessage());
}
}
@ -245,6 +251,7 @@ public class ReportListener {
try {
selectReportService(PlanReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("配送计划生成明细报表失败: {}", e.getMessage());
}
}
@ -274,6 +281,7 @@ public class ReportListener {
try {
selectReportService(PlanReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("配送计划生成明细报表失败: {}", e.getMessage());
}
}
@ -301,6 +309,7 @@ public class ReportListener {
try {
selectReportService(ReservationPlanReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("预约计划生成明细报表失败: {}", e.getMessage());
}
}
@ -328,6 +337,7 @@ public class ReportListener {
try {
selectReportService(ReturnWarehouseReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("回库生成明细报表失败: {}", e.getMessage());
}
}
@ -355,6 +365,7 @@ public class ReportListener {
try {
selectReportService(ReViewReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("文员复核生成明细报表失败: {}", e.getMessage());
}
}
@ -382,6 +393,7 @@ public class ReportListener {
try {
selectReportService(SignforReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("签收扫描生成明细报表失败: {}", e.getMessage());
}
}
@ -409,6 +421,7 @@ public class ReportListener {
try {
selectReportService(StockReportListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("备货生成明细报表失败: {}", e.getMessage());
}
}
@ -437,6 +450,7 @@ public class ReportListener {
try {
selectReportService(QualityDeliverListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("配送明细基础表处理失败: {}", e.getMessage());
}
}
@ -465,6 +479,7 @@ public class ReportListener {
try {
selectReportService(QualityDeliverAddListener.class).buildReport(msg);
} catch (Exception e) {
e.printStackTrace();
log.error("配送明细基础表Add失败: {}", e.getMessage());
}
}
@ -487,6 +502,7 @@ public class ReportListener {
String trainNumber = vo.getTrainNumber();
qualityDeliverService.carExpenseDispatchDetailFinal(trainNumber);
} catch (Exception e) {
e.printStackTrace();
log.error("生成车辆车次成本报表失败: {}", e.getMessage());
}

67
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/ReservationPlanReportListener.java

@ -25,8 +25,8 @@ import org.springblade.core.tool.utils.BeanUtil;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -71,13 +71,45 @@ public class ReservationPlanReportListener implements ReportService {
}
cmpMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.CMP.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
ltlMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.LTL.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getCategory()) && StrUtil.isNotEmpty(item.getOrderCode()))
.collect(Collectors.groupingBy(item -> item.getCategory() + item.getOrderCode()));
invMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.INV.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getMallName()) && StrUtil.isNotEmpty(item.getMaterielCode()) && StrUtil.isNotEmpty(item.getIncomingBatch()))
.collect(Collectors.groupingBy(item -> item.getMallName() + item.getMaterielCode() + item.getIncomingBatch()));
// 移除指定包件
if (BizOperationEnums.REMOVE.equals(bizOperation)) {
if (CollUtil.isNotEmpty(details)) {
for (PackageData detail : details) {
if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) {
if (cmpMap.containsKey(detail.getPackageCode())) {
QualityDeliverEntity qualityDeliverEntity = new QualityDeliverEntity();
qualityDeliverEntity.setId(cmpMap.get(detail.getPackageCode()).get(0).getId());
sendReport(qualityDeliverEntity, BizOperationEnums.DELETE);
}
}
if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.LTL)) {
if (ltlMap.containsKey(detail.getProductName() + detail.getOrderCode())) {
QualityDeliverEntity qualityDeliverEntity = new QualityDeliverEntity();
qualityDeliverEntity.setId(ltlMap.get(detail.getProductName() + detail.getOrderCode()).get(0).getId());
sendReport(qualityDeliverEntity, BizOperationEnums.DELETE);
}
}
if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) {
if (invMap.containsKey(detail.getMallName() + detail.getMaterialCode() + detail.getPickupBatch())) {
QualityDeliverEntity qualityDeliverEntity = new QualityDeliverEntity();
qualityDeliverEntity.setId(invMap.get(detail.getMallName() + detail.getMaterialCode() + detail.getPickupBatch()).get(0).getId());
sendReport(qualityDeliverEntity, BizOperationEnums.DELETE);
}
}
}
}
return;
}
}
}
if (CollUtil.isNotEmpty(details)) {
@ -86,11 +118,9 @@ public class ReservationPlanReportListener implements ReportService {
.warehouseName(bean.getWarehouse())
.warehouseId(warehouseId)
.orderPackageCode(detail.getPackageCode())
.planReservationCreateTime(bean.getOperatorTime())
.planReservationCode(vo.getReservationCode())
.bizCode(vo.getReservationCode())
.planReservationTime(vo.getReservationDate())
.planReservationUser(bean.getOperator())
.planNum(detail.getNumber())
.reservationConsignee(vo.getConsignee())
.reservationConsigneePhone(vo.getDeliveryPhone())
@ -104,6 +134,8 @@ public class ReservationPlanReportListener implements ReportService {
qualityDeliverEntity.setId(cmpMap.get(detail.getPackageCode()).get(0).getId());
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
} else {
qualityDeliverEntity.setPlanReservationCreateTime(bean.getOperatorTime());
qualityDeliverEntity.setPlanReservationUser(bean.getOperator());
sendReport(qualityDeliverEntity, BizOperationEnums.ADD);
}
}
@ -116,6 +148,8 @@ public class ReservationPlanReportListener implements ReportService {
qualityDeliverEntity.setId(ltlMap.get(detail.getProductName() + detail.getOrderCode()).get(0).getId());
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
} else {
qualityDeliverEntity.setPlanReservationCreateTime(bean.getOperatorTime());
qualityDeliverEntity.setPlanReservationUser(bean.getOperator());
sendReport(qualityDeliverEntity, BizOperationEnums.ADD);
}
}
@ -136,12 +170,14 @@ public class ReservationPlanReportListener implements ReportService {
QualityDeliverEntity entity = new QualityDeliverEntity();
BeanUtil.copyProperties(qualityDeliverEntity, entity);
entity.setPlanNum(1);
qualityDeliverEntity.setPlanReservationCreateTime(bean.getOperatorTime());
qualityDeliverEntity.setPlanReservationUser(bean.getOperator());
sendReport(entity, BizOperationEnums.ADD);
}
for (QualityDeliverEntity deliverEntity : qualityDeliverEntities) {
qualityDeliverEntity.setId(deliverEntity.getId());
qualityDeliverEntity.setPlanNum(1);
sendReport(qualityDeliverEntity, BizOperationEnums.DELETE);
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
}
} else if (number == size) {
for (QualityDeliverEntity deliverEntity : qualityDeliverEntities) {
@ -153,17 +189,28 @@ public class ReservationPlanReportListener implements ReportService {
List<QualityDeliverEntity> collect = qualityDeliverEntities.stream()
.filter(item -> StrUtil.isEmpty(item.getOrderPackageCode()))
.collect(Collectors.toList());
Set<Long> delIds = new HashSet<>();
if (CollUtil.isNotEmpty(collect)) {
int i = size - number;
if (i >= collect.size()) {
for (QualityDeliverEntity entity : collect) {
sendReport(entity, BizOperationEnums.DELETE);
delIds.add(entity.getId());
}
} else {
for (int j = 0; j < i; j++) {
sendReport(collect.get(j), BizOperationEnums.DELETE);
delIds.add(collect.get(j).getId());
}
}
for (QualityDeliverEntity deliverEntity : qualityDeliverEntities) {
if(delIds.contains(deliverEntity.getId())){
continue;
}
qualityDeliverEntity.setId(deliverEntity.getId());
qualityDeliverEntity.setPlanNum(1);
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
}
}
}
} else {
@ -171,6 +218,8 @@ public class ReservationPlanReportListener implements ReportService {
QualityDeliverEntity entity = new QualityDeliverEntity();
BeanUtil.copyProperties(qualityDeliverEntity, entity);
entity.setPlanNum(1);
qualityDeliverEntity.setPlanReservationCreateTime(bean.getOperatorTime());
qualityDeliverEntity.setPlanReservationUser(bean.getOperator());
sendReport(entity, BizOperationEnums.ADD);
}
}
@ -212,9 +261,15 @@ public class ReservationPlanReportListener implements ReportService {
.operation(operationEnums)
.node(WorkNodeEnums.PLANNED_RESERVATION.getValue())
.build();
String exchange = ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE;
String routingkey = ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY;
if(ObjectUtil.equals(operationEnums, BizOperationEnums.ADD)){
exchange = ReportConstants.REPORT_QUALITY_DELIVER_ADD_EXCHANGE;
routingkey = ReportConstants.REPORT_QUALITY_DELIVER_ADD_ROUTINGKEY;
}
factoryDataClient.sendMessage(SendMsg.builder()
.exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE)
.routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY)
.exchange(exchange)
.routingKey(routingkey)
.message(JSONUtil.toJsonStr(dto))
.delay(3000)
.build());

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/SignforReportListener.java

@ -70,12 +70,15 @@ public class SignforReportListener implements ReportService {
if (CollUtil.isNotEmpty(qualityDeliverEntities)) {
cmpMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.CMP.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
ltlMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.LTL.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getCategory()) && StrUtil.isNotEmpty(item.getOrderCode()))
.collect(Collectors.groupingBy(item -> item.getCategory() + item.getOrderCode()));
invMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.INV.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
}
}
@ -86,6 +89,7 @@ public class SignforReportListener implements ReportService {
.warehouseId(warehouseId)
.orderPackageCode(detail.getPackageCode())
.signUserId(vo.getDriverId())
.signDriverName(vo.getDriverName())
.signUserName(bean.getOperator())
.signTime(bean.getOperatorTime())
.signCarNumber(vo.getVehicleName())

20
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/StockReportListener.java

@ -65,12 +65,15 @@ public class StockReportListener implements ReportService {
if (CollUtil.isNotEmpty(qualityDeliverEntities)) {
cmpMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.CMP.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getOrderPackageCode()))
.collect(Collectors.groupingBy(item -> item.getOrderPackageCode()));
ltlMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.LTL.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getCategory()) && StrUtil.isNotEmpty(item.getOrderCode()))
.collect(Collectors.groupingBy(item -> item.getCategory() + item.getOrderCode()));
invMap = qualityDeliverEntities.stream()
.filter(item -> NumberUtil.equals(item.getConditions(), PackageTypeEnums.INV.getCode()))
.filter(item -> StrUtil.isNotEmpty(item.getMallName()) && StrUtil.isNotEmpty(item.getMaterielCode()))
.collect(Collectors.groupingBy(item -> item.getMallName() + item.getMaterielCode()));
}
}
@ -82,8 +85,8 @@ public class StockReportListener implements ReportService {
.orderPackageCode(detail.getPackageCode())
.stockupCode(vo.getStockupCode())
.stockupUserName(bean.getOperator())
.stockupFinishTime(vo.getStockupDate())
.stockupCreateTime(bean.getOperatorTime())
.stockupFinishTime(vo.getStockupDate())
.stockAllocation(vo.getStockupArea())
.bizCode(vo.getReferenceCode())
.build();
@ -132,11 +135,11 @@ public class StockReportListener implements ReportService {
}
} else {
List<QualityDeliverEntity> collect = qualityDeliverEntities.stream()
.filter( i -> StrUtil.isEmpty(i.getStockupCode()))
.filter(i -> StrUtil.isEmpty(i.getStockupCode()))
.collect(Collectors.toList());
if (CollUtil.isNotEmpty(collect)) {
qualityDeliverEntity.setId(collect.get(0).getId());
sendReport(qualityDeliverEntity, BizOperationEnums.MODIFY);
sendReport(qualityDeliverEntity, BizOperationEnums.ADD);
}
}
}
@ -152,11 +155,16 @@ public class StockReportListener implements ReportService {
.operation(operationEnums)
.node(WorkNodeEnums.STOCKING_OPERATION.getValue())
.build();
String exchange = ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE;
String routKey = ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY;
if (operationEnums.equals(BizOperationEnums.ADD)) {
qualityDeliverService.updateById(qualityDeliverEntity);
return;
}
factoryDataClient.sendMessage(SendMsg.builder()
.exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE)
.routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY)
.exchange(exchange)
.routingKey(routKey)
.message(JSONUtil.toJsonStr(dto))
.delay(3000)
.build());
}

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

@ -25,6 +25,13 @@ public interface IDistributionNodeWorkService {
*/
void planReservation(NodeFanoutMsg<ReservationVO> nodeFanoutMsg, BladeUser user);
/**
* 预约
* @param nodeFanoutMsg
* @param user
*/
void planRetention(NodeFanoutMsg<ReservationVO> nodeFanoutMsg);
/**
* 取消预约
* @param nodeFanoutMsg

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

@ -1247,7 +1247,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
if(byId.getConditions().equals(3)){
//标识零担
packageData.setNumber(distributionParcelListEntity.getPackageNub());
packageData.setNumber(distributionParcelListEntity.getLoadedNub());
if(Func.isNotEmpty(byId)){
packageData.setOrderCode(byId.getOrderCode());
if(Func.isEmpty(byId.getBrandName())){
@ -1265,7 +1265,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
packageData.setPackageCode(distributionParcelListEntity.getOrderPackageCode());
packageData.setPackageType(PackageTypeEnums.LTL);
packageData.setNumber(1);
// packageData.setNumber(1);
}else if(byId.getConditions().equals(1)){
// 包件
packageData.setPackageCode(distributionParcelListEntity.getOrderPackageCode());
@ -3741,7 +3741,7 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
distributionTaskVO.setPrice(Convert.toStr(distributionDeliveryListEntity.getPrice()));
}
distributionTaskVO.setTaskTime(distributionDeliveryListEntity.getTaskTime());
distributionTaskVO.setRemark(distributionDeliveryListEntity.getRemarks());
List<ReservationVO> reservationVOList = distributionDeliveryListService.getDeliveryreBroadcastData(distributionDeliveryListEntity.getId(), distributionDeliveryListEntity.getWarehouseId());
distributionTaskVO.setReservationVOList(reservationVOList);
@ -5164,6 +5164,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
//3、处理配送表和配送计划
//进行取消操作日志记录
handleCancelDistributionLog(deliveryListEntity, user, reservationList, myCurrentWarehouse);
// 增加一个取消配送计划的通知
NodeFanoutMsg<DistributionTaskVO> distributionTaskVONodeFanoutMsg = buildNodeFanoutMsgForPlan(deliveryListEntity, user, BizOperationEnums.DELETE);
distributionNodeWorkService.planDelivery(distributionTaskVONodeFanoutMsg, AuthUtil.getUser());
return R.status(true);
}
@ -6536,15 +6540,16 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
for (DistributionLoadscanEntity distributionLoadscanEntity : pushNodeList) {
Map<String, Object> broadcastDataByZeroOrderAndParcId = baseMapper.getBroadcastDataByZeroOrderAndParcId(distributionLoadscanEntity.getDeliveryId(), distributionLoadscanEntity.getWarehouseId(), distributionLoadscanEntity.getPackageId());
PackageData packageData = BeanUtil.copy(broadcastDataByZeroOrderAndParcId, PackageData.class);
assert packageData != null;
packageData.setBrand(Convert.toStr(broadcastDataByZeroOrderAndParcId.get("brandName")));
PackageTypeEnums type = PackageTypeEnums.LTL;
packageData.setPackageType(type);
packageData.setProductName(Convert.toStr(broadcastDataByZeroOrderAndParcId.get("productName")));
packageData.setNumber(distributionLoadscanEntity.getLoadedNub());
data.add(packageData);
if(ObjectUtil.isNotEmpty(broadcastDataByZeroOrderAndParcId)){
PackageData packageData = BeanUtil.copy(broadcastDataByZeroOrderAndParcId, PackageData.class);
assert packageData != null;
packageData.setBrand(Convert.toStr(broadcastDataByZeroOrderAndParcId.get("brandName")));
PackageTypeEnums type = PackageTypeEnums.LTL;
packageData.setPackageType(type);
packageData.setProductName(Convert.toStr(broadcastDataByZeroOrderAndParcId.get("productName")));
packageData.setNumber(distributionLoadscanEntity.getLoadedNub());
data.add(packageData);
}
}
distributionLoadVO.setPackageDataList(data);
@ -10708,28 +10713,27 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
throw new IllegalArgumentException("old 不能为空");
}
if (old.getDeliveryStatus() == null || old.getDeliveryListLoadingStatus() == null) {
updateById(deliveryListEntity);
return;
}
// boolean isUpdate = false;
// 判断传入的2个对象中的deliveryStatus 是否相同
// if (deliveryListEntity.getDeliveryStatus().equals(old.getDeliveryStatus())) {
// log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> deliveryStatus 相同,不更新");
// return;
// }
// //判断传入2个对象中deliveryListLoadingStatus 是否相同
// if (deliveryListEntity.getDeliveryListLoadingStatus().equals(old.getDeliveryListLoadingStatus())) {
// log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> deliveryListLoadingStatus 相同,不更新");
//
// return;
// }
updateById(deliveryListEntity);
log.info("配送信息状态已更新,deliveryId: {}", deliveryListEntity.getId());
Boolean b1=DeliveryStatusConstant.yiwancheng.getValue().equals(deliveryListEntity.getDeliveryStatus());
Boolean b2 =deliveryListEntity.getScannedNumber().equals(0);
// 推送给配送被取消的的作业节点
if (b1&& b2) {
// 发送配送取消的消息完成消息
NodeFanoutMsg<DistributionTaskVO> distributionTaskVONodeFanoutMsg = buildNodeFanoutMsgForPlan(deliveryListEntity, AuthUtil.getUser(), BizOperationEnums.DELETE);
distributionNodeWorkService.planDelivery(distributionTaskVONodeFanoutMsg, AuthUtil.getUser());
}
}

11
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionNodeWorkServiceImpl.java

@ -63,6 +63,17 @@ public class DistributionNodeWorkServiceImpl implements IDistributionNodeWorkSer
}
@Override
public void planRetention(NodeFanoutMsg<ReservationVO> nodeFanoutMsg) {
try {
if (distributionProperties.getSendFanoutMsg()) {
rabbitTemplate.convertAndSend(FanoutConstants.distribution.DeliveryRetention.EXCHANGE, null, com.alibaba.fastjson.JSONObject.toJSONString(nodeFanoutMsg));
}
} catch (AmqpException e) {
log.error(">>>>>>>>>>>>>>>>>>>>>>>>>> 消息推送失败~ 请联系管理员! ", e);
}
}
@Override
public void planDelivery(NodeFanoutMsg<DistributionTaskVO> nodeFanoutMsg, BladeUser user) {
try {

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

@ -3205,7 +3205,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionLoadVO.setVehicleId(distributionLoadscanEntity.getVehicleId());
distributionLoadVO.setTrainNumber(distributionDeliveryListEntity.getTrainNumber());
distributionLoadVO.setDriverId(Convert.toStr(distributionLoadscanEntity.getSigningUserId()));
distributionLoadVO.setDriverId(Convert.toStr(distributionLoadscanEntity.getDriverId()));
if (StringUtil.isNotBlank(distributionLoadscanEntity.getVehicleName())) {
// 获取车辆类型
@ -3275,7 +3275,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionLoadVO.setDriverName(distributionLoadscanEntity.getDriverName());
distributionLoadVO.setDriverId(Convert.toStr(distributionLoadscanEntity.getSigningUserId()));
distributionLoadVO.setDriverId(Convert.toStr(distributionLoadscanEntity.getDriverId()));
distributionLoadVO.setVehicleName(distributionLoadscanEntity.getVehicleName());
distributionLoadVO.setVehicleId(distributionLoadscanEntity.getVehicleId());
if (StringUtil.isNotBlank(distributionLoadscanEntity.getVehicleName())) {
@ -3319,6 +3319,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
packageData.setWaybillNumber(distributionParcelListEntity1.getWaybillNumber());
packageData.setProductName(distributionParcelListEntity1.getFirsts());
}
data.add(packageData);
}
@ -7184,9 +7185,9 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
DistributionLoadscanEntity distributionLoadscanEntity = pushList.get(0);
distributionLoadVO.setTrainNumber(distributionDeliveryListEntity.getTrainNumber());
distributionLoadVO.setDriverName(distributionLoadscanEntity.getDriverName());
distributionLoadVO.setDriverId(distributionLoadscanEntity.getDriverId());
distributionLoadVO.setVehicleName(distributionLoadscanEntity.getVehicleName());
distributionLoadVO.setVehicleId(distributionLoadscanEntity.getVehicleId());
distributionLoadVO.setDriverId(Convert.toStr(distributionLoadscanEntity.getSigningUserId()));
distributionLoadVO.setOperatMode(operatMode);
DistributionReservationEntity byId = distributionReservationService.getById(distributionLoadscanEntity.getReservationId());
if (!Func.isEmpty(byId)) {
@ -9348,6 +9349,8 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionLoadscanEntity.setSigningUser(user.getNickName());
distributionLoadscanEntity.setVehicleName(loadscanEntity.getVehicleName());
distributionLoadscanEntity.setSigningUserId(user.getUserId());
distributionLoadscanEntity.setDriverId(loadscanEntity.getDriverId());
distributionLoadscanEntity.setDriverName(loadscanEntity.getDriverName());
distributionLoadscanEntity.setSignforType(LoadScanSigningTypeStatusConstant.sijiqianshou.getValue());
distributionLoadscanEntity.setSignforState(LoadScanSigningStatusConstant.weiqianshou.getValue());
if (Objects.equals(loadscanEntity.getLoadedNub(), distributionLoadscanEntity.getReceivedQuantity())) {

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

@ -130,7 +130,8 @@ public class QualityDeliverServiceImpl extends BaseServiceImpl<QualityDeliverMap
trainDetailEntity.setDistributionType(deliveryType);
}
trainDetailEntity.setDestinationWarehouse(qualityDeliverEntity.getWarehouseName());
trainDetailEntity.setDeliveryDriver(qualityDeliverEntity.getSignUserName());
trainDetailEntity.setDeliveryDriver(qualityDeliverEntity.getSignDriverName());
trainDetailEntity.setDeliveryRemark(qualityDeliverEntity.getDeliveryRemark());
if (ObjectUtil.isNotEmpty(qualityDeliverEntity.getPlanNum())) {
totalPlanNumber = NumberUtil.add(totalPlanNumber, qualityDeliverEntity.getPlanNum());
}

21
blade-service/logpm-factory/src/main/java/com/logpm/factory/jobhandler/FactoryXxlJob.java

@ -61,9 +61,11 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
/**
@ -438,22 +440,13 @@ public class FactoryXxlJob {
// 走新系统入库
if (collect.size() > 0) {
List<cn.hutool.json.JSONObject> advances = new ArrayList<>();
Set<String> orderPackageSet = new HashSet<>();
collect.forEach((k, v) -> {
List<cn.hutool.json.JSONObject> packageList = new ArrayList<>();
List<StaorderPackagesEntity> staorderPackagesList = staorderPackagesService.list(Wrappers.<StaorderPackagesEntity>query().lambda()
.eq(StaorderPackagesEntity::getIdentification, "2")
.eq(StaorderPackagesEntity::getOrderId, k)
);
// 订单 order_id +包件 packagenum 重复 则剔除数据
staorderPackagesList = staorderPackagesList.stream()
.collect(Collectors.collectingAndThen(
Collectors.toMap(
sp -> sp.getOrderId() + sp.getPackagenum(), // 键
sp -> sp, // 值
(existing, replacement) -> existing // 处理重复键的情况,这里选择保留第一个
),
map -> new ArrayList<>(map.values())
));
// 查询基地名称
StationlinenumEntity stationlinenumEntity = stationlinenumService.selectNameByNumber(v.getTcWlb006());
String siteName = Objects.isNull(stationlinenumEntity) ? null : stationlinenumEntity.getLogisticsLineName();
@ -514,7 +507,11 @@ public class FactoryXxlJob {
Long finalStartWarehouseId = startWarehouseId;
String finalStartWarehouseName = startWarehouseName;
String finalTenantId = tenantId;
groupByPackages.forEach(gpd -> {
for (GroupByPackagesDTO gpd : groupByPackages) {
if(CollUtil.contains(orderPackageSet,gpd.getPackagenum())){
continue;
}
orderPackageSet.add(gpd.getPackagenum());
// 封装包件
TrunklineAdvanceDetailEntity advanceDetailEntity = new TrunklineAdvanceDetailEntity();
advanceDetailEntity.setWarehouseId(finalStartWarehouseId);
@ -553,7 +550,7 @@ public class FactoryXxlJob {
advanceDetailEntity.setIsDeleted(0);
cn.hutool.json.JSONObject entries = JSONUtil.parseObj(advanceDetailEntity);
packageList.add(entries);
});
}
// 转成json对象,然后将包件明细放到detail中
cn.hutool.json.JSONObject entries = JSONUtil.parseObj(advanceEntity);
entries.set("details", JSONUtil.toJsonStr(packageList));

7
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/controller/OpenOrderController.java

@ -999,6 +999,13 @@ public class OpenOrderController {
log.warn("#################openOrderParamVerify: 发货单位不能为空 shipper={} ", shipper);
throw new CustomerException(405, "发货单位不能为空");
}
// Long consigneeId = openOrderDTO.getConsigneeId();
// if(Objects.isNull(consigneeId)){
// log.warn("#################openOrderParamVerify: 请先维护收货单位 consigneeId={} ", consigneeId);
// throw new CustomerException(405, "请先维护收货单位");
// }
String consignee = openOrderDTO.getConsignee();
if (StringUtil.isBlank(consignee)) {
log.warn("#################openOrderParamVerify: 收货单位不能为空 consignee={} ", consignee);

73
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

@ -631,9 +631,16 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
waybillEntity.setCustomerTrain(openOrderDTO.getTrainNumber());
waybillEntity.setGoodsCode(openOrderDTO.getGoodsCode());
Long shipperId = openOrderDTO.getShipperId();
String shipper = openOrderDTO.getShipper();
if (Objects.isNull(shipperId)) {
//如果发货单位没有id值,则把发货单位信息自动添加到client中
shipperId = saveNewClient(openOrderDTO.getShipper(), openOrderDTO.getShipperName(), openOrderDTO.getShipperMobile(), openOrderDTO.getShipperAddress(), "6");
BasicdataClientEntity clientEntity = basicdataClientClient.findByName(shipper);
if(Objects.isNull(clientEntity)){
shipperId = saveNewClient(openOrderDTO.getShipper(), openOrderDTO.getShipperName(), openOrderDTO.getShipperMobile(), openOrderDTO.getShipperAddress(), "6");
}else{
shipperId = clientEntity.getId();
}
}
waybillEntity.setShipperId(shipperId);
waybillEntity.setShipper(openOrderDTO.getShipper());
@ -642,10 +649,15 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
waybillEntity.setShipperAddress(openOrderDTO.getShipperAddress());
Long consigneeId = openOrderDTO.getConsigneeId();//收货单位id
String consignee = openOrderDTO.getConsignee();
if (Objects.isNull(consigneeId)) {
//如果收货单位没有id值,则把收货单位信息自动添加到client中
consigneeId = saveNewClient(openOrderDTO.getConsignee(), openOrderDTO.getConsigneeName(), openOrderDTO.getConsigneeMobile(), openOrderDTO.getConsigneeAddress(), "2");
BasicdataClientEntity clientEntity = basicdataClientClient.findByName(consignee);
if(Objects.isNull(clientEntity)){
consigneeId = saveNewClient(openOrderDTO.getConsignee(), openOrderDTO.getConsigneeName(), openOrderDTO.getConsigneeMobile(), openOrderDTO.getConsigneeAddress(), "2");
}else{
consigneeId = clientEntity.getId();
}
}
waybillEntity.setConsigneeId(consigneeId);
waybillEntity.setConsignee(openOrderDTO.getConsignee());
@ -988,9 +1000,16 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
waybillEntity.setReplacePrice(openOrderDTO.getReplacePrice());
waybillEntity.setOrderNo(openOrderDTO.getOrderCode());
Long shipperId = openOrderDTO.getShipperId();
String shipper = openOrderDTO.getShipper();
if (Objects.isNull(shipperId)) {
//如果发货单位没有id值,则把发货单位信息自动添加到client中
shipperId = saveNewClient(openOrderDTO.getShipper(), openOrderDTO.getShipperName(), openOrderDTO.getShipperMobile(), openOrderDTO.getShipperAddress(), "6");
BasicdataClientEntity clientEntity = basicdataClientClient.findByName(shipper);
if(Objects.isNull(clientEntity)){
shipperId = saveNewClient(openOrderDTO.getShipper(), openOrderDTO.getShipperName(), openOrderDTO.getShipperMobile(), openOrderDTO.getShipperAddress(), "6");
}else{
shipperId = clientEntity.getId();
}
}
waybillEntity.setShipperId(shipperId);
waybillEntity.setShipper(openOrderDTO.getShipper());
@ -999,9 +1018,15 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
waybillEntity.setShipperAddress(openOrderDTO.getShipperAddress());
Long consigneeId = openOrderDTO.getConsigneeId();//收货单位id
String consignee = openOrderDTO.getConsignee();
if (Objects.isNull(consigneeId)) {
//如果收货单位没有id值,则把收货单位信息自动添加到client中
consigneeId = saveNewClient(openOrderDTO.getConsignee(), openOrderDTO.getConsigneeName(), openOrderDTO.getConsigneeMobile(), openOrderDTO.getConsigneeAddress(), "2");
BasicdataClientEntity clientEntity = basicdataClientClient.findByName(consignee);
if(Objects.isNull(clientEntity)){
consigneeId = saveNewClient(openOrderDTO.getConsignee(), openOrderDTO.getConsigneeName(), openOrderDTO.getConsigneeMobile(), openOrderDTO.getConsigneeAddress(), "2");
}else{
consigneeId = clientEntity.getId();
}
}
waybillEntity.setConsigneeId(consigneeId);
waybillEntity.setConsignee(openOrderDTO.getConsignee());
@ -2936,6 +2961,18 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
// 得到改单之前的收货单位
oldConsignee = waybillEntity.getConsignee();
// Long newConsigneeId = openOrderDTO.getConsigneeId();
//
// if(Objects.isNull(newConsigneeId)){
// if(waybillType == 1){
// log.warn("#############updateWaybill: 运单收货单位id为空 waybillId={} newConsigneeId={}", waybillId,newConsigneeId);
// return R.fail(405, "请先维护收货单位信息");
// }else if(waybillType == 2){
// newConsigneeId = saveNewClient(openOrderDTO.getConsignee(), openOrderDTO.getConsigneeName(), openOrderDTO.getConsigneeMobile(), openOrderDTO.getConsigneeAddress(), "2");
// openOrderDTO.setConsigneeId(newConsigneeId);
// }
// }
String updateMsg = verifyUpdateData(openOrderDTO, waybillEntity);
warehouseWaybillClient.updateEntity(waybillEntity);
@ -4862,6 +4899,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
editOrderMsgVO.setOldValue(consignee);
editOrderMsgVO.setNewValue(newConsignee);
msgList.add(editOrderMsgVO);
}else{
if (!ObjectUtil.equals(consignee, newConsignee)) {
EditOrderMsgVO editOrderMsgVO = new EditOrderMsgVO();
editOrderMsgVO.setItemName("收货单位");
editOrderMsgVO.setOldValue(consignee);
editOrderMsgVO.setNewValue(newConsignee);
msgList.add(editOrderMsgVO);
}
}
String newConsigneeName = openOrderDTO.getConsigneeName();
@ -5427,6 +5472,15 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
stringBuilder.append("发货单位:").append(shipper).append("-->").append(newShipper).append(";");
waybillEntity.setShipper(newShipper);
waybillEntity.setShipperId(newShipperId);
if(Objects.isNull(newShipperId)){
BasicdataClientEntity clientEntity = basicdataClientClient.findByName(newShipper);
if(Objects.isNull(clientEntity)){
newShipperId = saveNewClient(openOrderDTO.getShipper(), openOrderDTO.getShipperName(), openOrderDTO.getShipperMobile(), openOrderDTO.getShipperAddress(), "6");
}else{
newShipperId = clientEntity.getId();
}
waybillEntity.setConsigneeId(newShipperId);
}
}
String newShipperName = openOrderDTO.getShipperName();
String shipperName = waybillEntity.getShipperName();
@ -5459,7 +5513,14 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
waybillEntity.setConsigneeId(newConsigneeId);
if(Objects.isNull(newConsigneeId)){
waybillEntity.setServiceType(1);
warehouseWaybillClient.updateWaybillCondigneeIdToNull(waybillId);
BasicdataClientEntity clientEntity = basicdataClientClient.findByName(newConsignee);
if(Objects.isNull(clientEntity)){
newConsigneeId = saveNewClient(openOrderDTO.getConsignee(), openOrderDTO.getConsigneeName(), openOrderDTO.getConsigneeMobile(), openOrderDTO.getConsigneeAddress(), "2");
}else{
newConsigneeId = clientEntity.getId();
waybillEntity.setServiceType(clientEntity.getTypeService());
}
waybillEntity.setConsigneeId(newConsigneeId);
}else{
BasicdataClientEntity basicdataClient = basicdataClientClient.findEntityById(newConsigneeId);
if(!Objects.isNull(basicdataClient)){

68
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseRetentionScanServiceImpl.java

@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.entity.DistributionLoadscanAbnormalEntity;
import com.logpm.distribution.entity.DistributionReservationEntity;
import com.logpm.distribution.entity.DistributionRetentionScanEntity;
import com.logpm.distribution.feign.IDistributionLoadscanAbnormalClient;
import com.logpm.distribution.feign.IDistributionReservationClient;
@ -38,9 +39,15 @@ import com.logpm.warehouse.vo.WarehouseRetentionRecordVO;
import com.logpm.warehouse.excel.WarehouseRetentionRecordExcel;
import com.logpm.warehouse.vo.WarehouseRetentionScanVO;
import lombok.AllArgsConstructor;
import org.springblade.common.constant.WorkNodeEnums;
import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.loading.LoadingAbnormalAuditingStatusConstant;
import org.springblade.common.constant.loading.LoadingAbnormalTypeConstant;
import org.springblade.common.enums.BizOperationEnums;
import org.springblade.common.enums.PackageTypeEnums;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.PackageData;
import org.springblade.common.model.ReservationVO;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.BladeUser;
@ -52,10 +59,7 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -170,9 +174,65 @@ public class WarehouseRetentionScanServiceImpl extends BaseServiceImpl<Warehouse
this.save(warehouseRetentionScan);
redis.setEx(AuthUtil.getTenantId() + ":warehouse:" + warehouseRetentionScan.getWarehouseId() + ":orderPackageCode:" + warehouseRetentionScan.getOrderPackageCode()+ ":retentionSave:",warehouseRetentionScan.getTaskCode(),60L*3L);
distributionSignforClient.updateIsHaveAbnormalPackage(warehouseRetentionScan.getReservationId());
NodeFanoutMsg<ReservationVO> nodeFanoutMsg = buildNodeFanoutMsgByRestention(warehouseRetentionScan.getReservationId(),warehouseRetentionScan);
reservationClient.planRetention(nodeFanoutMsg);
return R.success("操作成功");
}
private NodeFanoutMsg<ReservationVO> buildNodeFanoutMsgByRestention(Long reservationId,WarehouseRetentionScanEntity warehouseRetentionScan) {
NodeFanoutMsg<ReservationVO> nodeFanoutMsg = new NodeFanoutMsg<>();
nodeFanoutMsg.setNode(WorkNodeEnums.DISTRIBUTION_RETENTION);
nodeFanoutMsg.setBizOperation(BizOperationEnums.ADD);
nodeFanoutMsg.setOperator(AuthUtil.getNickName());
nodeFanoutMsg.setOperatorTime(new Date());
nodeFanoutMsg.setTenantId(AuthUtil.getTenantId());
ReservationVO reservationVO = getReservationVO(reservationId,warehouseRetentionScan);
nodeFanoutMsg.setWarehouse(reservationVO.getWarehouseName());
nodeFanoutMsg.setWarehouseId(warehouseRetentionScan.getWarehouseId());
nodeFanoutMsg.setMain(reservationVO);
return nodeFanoutMsg;
}
private ReservationVO getReservationVO(Long reservationId,WarehouseRetentionScanEntity warehouseRetentionScan) {
List<DistributionReservationEntity> reservationList = reservationClient.getReservationList(reservationId + "");
DistributionReservationEntity reservationEntity = reservationList.get(0);
ReservationVO reservationVO = new ReservationVO();
reservationVO.setReservationCode(reservationEntity.getReservationCode());
reservationVO.setReservationDate(reservationEntity.getReservationDate());
reservationVO.setConsignee(reservationEntity.getConsignee());
reservationVO.setDeliveryAddress(reservationEntity.getDeliveryAddress());
reservationVO.setDeliveryPhone(reservationEntity.getDeliveryPhone());
reservationVO.setMallName(reservationEntity.getMallName());
reservationVO.setStoreName(reservationEntity.getStoreName());
reservationVO.setWarehouseName(reservationEntity.getWarehouseName());
reservationVO.setDeliveryType(reservationEntity.getDeliveryType());
reservationVO.setReservationNum(reservationEntity.getReservationNum());
reservationVO.setReceivingUnit(reservationEntity.getReceivingUnit());
reservationVO.setId(reservationEntity.getId());
reservationVO.setReservationStockListNum(reservationEntity.getReservationStockListNum());
PackageData packageData = new PackageData();
switch (warehouseRetentionScan.getConditions()){
case 1:
packageData.setPackageType(PackageTypeEnums.CMP);
packageData.setOrderCode(warehouseRetentionScan.getOrderCode());
packageData.setPackageCode(warehouseRetentionScan.getOrderPackageCode());
packageData.setWaybillNumber(warehouseRetentionScan.getWaybillNumber());
break;
case 2:
packageData.setPackageType(PackageTypeEnums.LTL);
packageData.setPackageCode(warehouseRetentionScan.getOrderPackageCode());
break;
case 3:
packageData.setPackageType(PackageTypeEnums.INV);
packageData.setPackageCode(warehouseRetentionScan.getOrderPackageCode());
break;
}
reservationVO.setPackageDataList(Arrays.asList(packageData));
return reservationVO;
}
@Override
public R selectWarehouseRetentionRecordNewPage(IPage<WarehouseRetentionScanVO> page, WarehouseRetentionScanDTO warehouseRetentionScan) {

Loading…
Cancel
Save