diff --git a/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java b/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java index 6a041b053..13a14e86a 100644 --- a/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java +++ b/blade-biz-common/src/main/java/org/springblade/common/constant/broadcast/FanoutConstants.java @@ -142,6 +142,21 @@ public abstract class FanoutConstants { } + /** + * 备货节点 + * + * @see org.springblade.common.model.StockUpVO + **/ + interface tripartite { + + String EXCHANGE = "fanout.trunkline.tripartite" + ModuleNameConstant.DEVAUTH; + + interface QUEUE { + String SIGN = "fanout.trunkline.tripartite.sign" + ModuleNameConstant.DEVAUTH; + } + } + + } diff --git a/blade-biz-common/src/main/java/org/springblade/common/model/TripartiteVO.java b/blade-biz-common/src/main/java/org/springblade/common/model/TripartiteVO.java new file mode 100644 index 000000000..8d5eb0584 --- /dev/null +++ b/blade-biz-common/src/main/java/org/springblade/common/model/TripartiteVO.java @@ -0,0 +1,50 @@ +package org.springblade.common.model; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +@Data +public class TripartiteVO implements Serializable { + + /** 发车批次号 */ + private String carsNo ; + + /** 司机id */ + private Long driverId ; + /** 司机名称 */ + private String driverName ; + /** 司机电话 */ + private String driverMobile ; + /** 副驾id */ + private Long assistantId ; + /** 副驾i名称 */ + private String assistantName ; + /** 副驾i电话 */ + private String assistantMobile ; + + /** 车辆id */ + private Long carId ; + + /** 送货方式:1=自提,2=送货 */ + private String deliveryType ; + + /** 客户类型:1=商场,2=C端客户[多选] */ + private String customerType ; + + /** 承运商id */ + private Long carrierId ; + /** 承运商名称 */ + private String carrierName ; + /** 承运单号 */ + private String carrierOrderCode ; + /** 承运时间 */ + private Date carrierTime ; + /** 车牌号 */ + private String carNumber ; + + private List packageDataList; + +} diff --git a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/vo/OpFactoryPackageDataVO.java b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/vo/OpFactoryPackageDataVO.java index 4fb5d9d11..4c7c2d99a 100644 --- a/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/vo/OpFactoryPackageDataVO.java +++ b/blade-service-api/logpm-factory-api/src/main/java/com/logpm/factory/oupai/vo/OpFactoryPackageDataVO.java @@ -41,6 +41,15 @@ public class OpFactoryPackageDataVO implements Serializable { */ private String pushStatus; + /** + * 业务员模式 + * + * 经销商 + * + * 干仓配 不进行数据回传 + */ + private String businessModel; + diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java index 666606365..dae73affd 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesAbnormalRecordServiceImpl.java @@ -339,6 +339,16 @@ public class AftersalesAbnormalRecordServiceImpl extends BaseServiceImpl updateScanZeroDetailEntityList = new ArrayList<>(); List addParcelNumberEntityList = new ArrayList<>(); List updateRecordZeroDetailList = new ArrayList<>(); diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java index eabf84f66..92d184845 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java @@ -6,6 +6,7 @@ import com.logpm.distribution.dto.splitOrder.*; import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity; import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity; import com.logpm.distribution.service.IDistributionSplitOrderTaskService; +import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO; import com.logpm.distribution.vo.SplitPackageOrderVO; import lombok.AllArgsConstructor; import org.slf4j.Logger; @@ -30,7 +31,7 @@ public class DistributionSplitOrderTaskController { } @GetMapping("/all-task-list") - public R> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) { + public R> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) { return distributionSplitOrderTaskService.allTaskList(query, distributionSplitAllTaskSearchDTO); } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java index 6c950d0e8..1901109be 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java @@ -38,6 +38,7 @@ import org.springblade.common.exception.CustomerException; 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.redis.cache.BladeRedis; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; @@ -59,8 +60,9 @@ public class DistributionStockArticleClient implements IDistributionStockArticle private final IDistributionStockArticleService distributionStockArticleService; private final IDistributionParcelListService distributionParcelListService; + private final BladeRedis bladeRedis; - @Override + @Override @GetMapping(TOP) public BladePage top(Integer current, Integer size) { Query query = new Query(); @@ -73,11 +75,35 @@ public class DistributionStockArticleClient implements IDistributionStockArticle @Override @PostMapping(API_PREFIX + "/addData") public Long addData(DistributionStockArticleEntity distributionStockArticleEntity) { - boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity); - if(saveFlag){ - return distributionStockArticleEntity.getId(); + + String orderCode = distributionStockArticleEntity.getOrderCode(); + Long warehouseId = distributionStockArticleEntity.getWarehouseId(); + + String key = orderCode + warehouseId; + + Boolean exists = bladeRedis.exists(key); + if(exists){ + String idStr = bladeRedis.get(key); + if("1".equals(idStr)){ + return 1L; + }else{ + return Long.valueOf(idStr); + } }else{ - return 0L; + bladeRedis.setEx(key,"1",30L); + DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.findStockArticleByOrderCodeAndWarehouseId(orderCode, warehouseId); + if(ObjectUtils.isNotEmpty(distributionStockArticle)){ + bladeRedis.setEx(key,distributionStockArticle.getId(),30L); + return distributionStockArticle.getId(); + }else{ + boolean saveFlag = distributionStockArticleService.save(distributionStockArticleEntity); + if(saveFlag){ + bladeRedis.setEx(key,distributionStockArticleEntity.getId(),30L); + return distributionStockArticleEntity.getId(); + }else{ + return 0L; + } + } } } diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java index 7de3e8547..07710ab16 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java @@ -6,6 +6,7 @@ import com.logpm.distribution.dto.splitOrder.DistributionSplitAllTaskSearchDTO; import com.logpm.distribution.dto.splitOrder.DistributionSplitTaskSearchDTO; import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity; import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity; +import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO; import com.logpm.distribution.vo.SplitPackageOrderVO; import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.support.Query; @@ -32,7 +33,7 @@ public interface IDistributionSplitOrderTaskService extends BaseService> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO); + R> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO); /** * 创建任务 diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java index 22175185e..6cee439d7 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java @@ -1,11 +1,13 @@ package com.logpm.distribution.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.SerializationUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.support.SFunction; +import com.logpm.distribution.bean.Resp; import com.logpm.distribution.dto.splitOrder.DistributionSplitAllTaskSearchDTO; import com.logpm.distribution.dto.splitOrder.DistributionSplitTaskSearchDTO; import com.logpm.distribution.entity.DistributionParcelListEntity; @@ -21,6 +23,7 @@ import com.logpm.distribution.service.IDistributionSplitOrderDetailService; import com.logpm.distribution.service.IDistributionSplitOrderLogService; import com.logpm.distribution.service.IDistributionSplitOrderTaskService; import com.logpm.distribution.service.IDistributionStockArticleService; +import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO; import com.logpm.distribution.vo.SplitPackageOrderVO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -37,15 +40,15 @@ import org.springblade.core.redis.lock.LockType; import org.springblade.core.redis.lock.RedisLockClient; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; +import org.springblade.system.entity.User; +import org.springblade.system.feign.IUserClient; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; +import java.util.stream.Stream; @Service @AllArgsConstructor @@ -58,6 +61,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpllambdaQuery() - .in(DistributionParcelListEntity::getStockArticleId, stockArticleId) - .ne(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue()) - .eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue()) - .eq(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) - .eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue()) - .eq(DistributionParcelListEntity::getIsTransfer, 0) - ); - long packageAllCount = distributionParcelListService.count( - Wrappers.lambdaQuery() - .in(DistributionParcelListEntity::getStockArticleId, stockArticleId) - ); + long packageAllowCount = getSplitOrderAllowCount(stockArticleId); + long packageAllCount = getSplitOrderAllCount(stockArticleId); + if (packageAllowCount == 0 || packageAllCount == 1) { return R.fail("订单"+ distributionStockArticle.getOrderCode() +"包件数量不足,不允许拆单"); } + boolean exists = exists( + Wrappers.lambdaQuery() + .eq(DistributionSplitOrderTaskEntity::getStockArticleId, stockArticleId) + .eq(DistributionSplitOrderTaskEntity::getState, OrderSplitStateConstant.InProgress.getValue()) + ); + if (exists) { + return R.fail("订单"+ distributionStockArticle.getOrderCode() +"正在拆单中,不允许重复拆单"); + } + taskLock(stockArticleId, () -> { String allTaskNo = getAllTaskNo(); DistributionSplitOrderAllTaskEntity allTask = new DistributionSplitOrderAllTaskEntity(); @@ -254,12 +257,12 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl existsList = distributionSplitOrderDetailService.list(Wrappers.lambdaQuery() .in(DistributionSplitOrderDetailEntity::getOrderPackageCode, packageCodes) ); - int addNumber = packageCodes.size(); if (!existsList.isEmpty()) { if (existsList.stream().anyMatch(detail -> !detail.getSplitOrderTaskId().equals(taskId) && detail.getState().equals(OrderPackageSplitStateConstant.finish.getValue()))) { return R.fail("提交包件包含其他拆单任务的包件"); @@ -318,7 +321,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl cancelTask(Long taskId) { DistributionSplitOrderTaskEntity task = getById(taskId); @@ -735,12 +739,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpllambdaUpdate() + .eq(DistributionSplitOrderDetailEntity::getSplitOrderTaskId, task.getId()) + .set(DistributionSplitOrderDetailEntity::getState, OrderPackageSplitStateConstant.cancel.getValue()) + .set(DistributionSplitOrderDetailEntity::getCancelUser, AuthUtil.getUser().getUserId()) + .set(DistributionSplitOrderDetailEntity::getCancelUsername, AuthUtil.getUser().getUserName()) + ); + + distributionSplitOrderLogService.record(task, "撤消拆单任务", AuthUtil.getUser().getUserName()); + + } + + @Transactional @Override public R cancelAllTask(Long allTaskId) { DistributionSplitOrderAllTaskEntity allTask = distributionSplitOrderAllTaskService.getById(allTaskId); if (!allTask.getState().equals(OrderSplitAllTaskStateConstant.finish.getValue())) { - return R.fail("拆单总任务已完成,无法操作"); + return R.fail("拆单总任务未完成,无法操作"); } if (!list(Wrappers.lambdaQuery() @@ -766,8 +783,19 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl list = list( + Wrappers.lambdaQuery() + .eq(DistributionSplitOrderTaskEntity::getSplitOrderAllTaskId, allTaskId) + ); + + long finishCount = list.stream().filter(task -> task.getState().equals(OrderSplitStateConstant.finish.getValue())).count(); + if (finishCount > 0) { + return R.fail("拆单任务中存在已完成拆单任务,无法操作"); + } + allTask.setState(OrderSplitAllTaskStateConstant.cancel.getValue()); distributionSplitOrderAllTaskService.updateById(allTask); + list.forEach(this::cancelTask); return R.success("success"); } @@ -780,11 +808,11 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpllambdaQuery() + boolean existsInProgress = exists(Wrappers.lambdaQuery() .eq(DistributionSplitOrderTaskEntity::getSplitOrderAllTaskId, allTaskId) .eq(DistributionSplitOrderTaskEntity::getState, OrderSplitStateConstant.InProgress.getValue()) ); - if (existsInProgress != null) { + if (existsInProgress) { return R.fail("拆单总任务中存在未完成拆单任务,无法操作"); } @@ -836,8 +864,9 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) { + public R> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) { IPage page = Condition.getPage(query); + IPage pageResult = Condition.getPage(query); LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); @@ -878,16 +907,29 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl list = distributionSplitOrderAllTaskService.list(page, queryWrapper); - page.setRecords(list); - return R.data(page); + String createUserIds = list.stream().map((d) -> d.getCreateUser() + "").collect(Collectors.joining(",")); + List users = iUserClient.userInfoByIds(AuthUtil.getTenantId(), String.join(",", createUserIds)).getData(); + Map userMap = users.stream().collect(Collectors.toMap(User::getId, u -> u)); + List listVo = list.stream().map(d -> { + DistributionSplitOrderAllTaskVO vo = new DistributionSplitOrderAllTaskVO(); + BeanUtil.copyProperties(d, vo); + vo.setCreateUserName(userMap.get(d.getCreateUser()).getName()); + return vo; + }).collect(Collectors.toList()); + + pageResult.setRecords(listVo); + pageResult.setPages(page.getPages()); + pageResult.setTotal(page.getTotal()); + + return R.data(pageResult); } @Override @@ -906,16 +948,35 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpllambdaQuery() + .in(DistributionParcelListEntity::getStockArticleId, stockArticleId) + .ne(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiqianshou.getValue()) + .eq(DistributionParcelListEntity::getOrderPackageReservationStatus, OrderPackageReservationStatusConstant.daiyuyue.getValue()) + .eq(DistributionParcelListEntity::getOrderPackageLoadingStatus, OrderPackageLoadingStatusConstant.weizhuancghe.getValue()) + .eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue()) + .eq(DistributionParcelListEntity::getIsTransfer, 0) + ); + } - @Override - public R checkOrderCode(String orderCode) { - - DistributionSplitOrderAllTaskEntity exists = distributionSplitOrderAllTaskService.getOne( - Wrappers.lambdaQuery() - .eq(DistributionSplitOrderAllTaskEntity::getOrderCode, orderCode) + public long getSplitOrderAllCount(Long stockArticleId) { + return distributionParcelListService.count( + Wrappers.lambdaQuery() + .in(DistributionParcelListEntity::getStockArticleId, stockArticleId) ); + } - return R.success(exists == null ? "" : exists.getNo()); + @Override + public R checkOrderCode(String orderCode) { + DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.getOne(Wrappers.lambdaQuery() + .eq(DistributionStockArticleEntity::getOrderCode, orderCode)); + long splitOrderAllCount = getSplitOrderAllCount(distributionStockArticle.getId()); + long splitOrderAllowCount = getSplitOrderAllowCount(distributionStockArticle.getId()); + if (splitOrderAllowCount == 0 || splitOrderAllCount == 1) { + return R.success("该订单无法拆单"); + } + return R.success(""); } @Override diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderAllTaskVO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderAllTaskVO.java new file mode 100644 index 000000000..88844757c --- /dev/null +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderAllTaskVO.java @@ -0,0 +1,11 @@ +package com.logpm.distribution.vo; + +import com.logpm.distribution.entity.DistributionSplitOrderAllTaskEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class DistributionSplitOrderAllTaskVO extends DistributionSplitOrderAllTaskEntity { + private String createUserName; +} diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderTaskVO.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderTaskVO.java new file mode 100644 index 000000000..35eb05339 --- /dev/null +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderTaskVO.java @@ -0,0 +1,11 @@ +package com.logpm.distribution.vo; + +import com.logpm.distribution.entity.DistributionSplitOrderTaskEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@EqualsAndHashCode(callSuper = true) +@Data +public class DistributionSplitOrderTaskVO extends DistributionSplitOrderTaskEntity { + private String createUserName; +} diff --git a/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/job/AdvanceJob.java b/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/job/AdvanceJob.java index db0de1e07..3b35b6c88 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/job/AdvanceJob.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/job/AdvanceJob.java @@ -1,9 +1,10 @@ package com.logpm.factorydata.jinpai.job; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.logpm.factorydata.base.feign.IFactoryDataBaseClient; -import com.logpm.factorydata.feign.IFactoryDataClient; import com.logpm.factorydata.jinpai.entity.DeliveryNoteEntity; import com.logpm.factorydata.jinpai.entity.OrderInfoEntity; import com.logpm.factorydata.jinpai.entity.PackageInfoEntity; @@ -14,9 +15,9 @@ import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.annotation.XxlJob; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springblade.common.annotations.LogpmAsync; import org.springframework.stereotype.Component; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -62,21 +63,78 @@ public class AdvanceJob { // 将数据封装到packageInfoEntityMap中 其中omsExtOrderNo为key packageInfoEntityMap.computeIfAbsent(entity.getOmsExtOrderNo(), k -> new ArrayList<>()).add(entity); } - // 根据订单数据查询出所有订单明细和包件信息 - List deliveryNoteEntities = deliveryNoteService.list(Wrappers.lambdaQuery().in(DeliveryNoteEntity::getOrderId, deliveryNoteSet)); - if (CollUtil.isNotEmpty(deliveryNoteEntities)) { - for (DeliveryNoteEntity entity : deliveryNoteEntities) { - deliveryNoteEntityMap.put(entity.getOrderId(), entity); - } + } + List orders = orderInfoService.list(Wrappers.lambdaQuery().eq(OrderInfoEntity::getReserve1, "0")); + if (CollUtil.isNotEmpty(orders)) { + for (OrderInfoEntity order : orders) { + orderInfoSet.add(order.getOmsExtOrderNo()); + } + } + List orderInfoEntities = orderInfoService.list(Wrappers.lambdaQuery().in(OrderInfoEntity::getOmsExtOrderNo, orderInfoSet)); + if (CollUtil.isNotEmpty(orderInfoEntities)) { + for (OrderInfoEntity entity : orderInfoEntities) { + String omsExtOrderNo = entity.getOmsExtOrderNo(); + orderInfoEntityMap.put(omsExtOrderNo, entity); + deliveryNoteSet.add(entity.getOrderId()); } - List orderInfoEntities = orderInfoService.list(Wrappers.lambdaQuery().in(OrderInfoEntity::getOmsExtOrderNo, orderInfoSet)); - if (CollUtil.isNotEmpty(orderInfoEntities)) { - for (OrderInfoEntity entity : orderInfoEntities) { - orderInfoEntityMap.put(entity.getOmsExtOrderNo(), entity); + } + // 根据订单数据查询出所有订单明细和包件信息 + List deliveryNoteEntities = deliveryNoteService.list(Wrappers.lambdaQuery().in(DeliveryNoteEntity::getOrderId, deliveryNoteSet)); + if (CollUtil.isNotEmpty(deliveryNoteEntities)) { + for (DeliveryNoteEntity entity : deliveryNoteEntities) { + deliveryNoteEntityMap.put(entity.getOrderId(), entity); + } + } + // 处理无包条的情况 + if (CollUtil.isNotEmpty(orderInfoEntities)) { + for (OrderInfoEntity entity : orderInfoEntities) { + String omsExtOrderNo = entity.getOmsExtOrderNo(); + String goodsNumber = entity.getGoodsNumber(); + if (!packageInfoEntityMap.containsKey(omsExtOrderNo)) { + // 订单没有包件,生成包件 + if (StrUtil.isNotEmpty(goodsNumber)) { + Integer anInt = Convert.toInt(goodsNumber); + if (anInt > 0) { + // 创建包件 + List packageInfoEntities = new ArrayList<>(); + for (int i = 0; i < anInt; i++) { + PackageInfoEntity packageInfoEntity = new PackageInfoEntity(); + packageInfoEntity.setOrderId(entity.getOrderId()); + packageInfoEntity.setOmsExtOrderNo(omsExtOrderNo); + packageInfoEntity.setGoodsNum(entity.getGoodsNumber()); + packageInfoEntity.setBoxType1(entity.getGoodsType()); + packageInfoEntity.setBoxType2(entity.getGoodsType()); + packageInfoEntity.setBoxType3(entity.getGoodsType()); + packageInfoEntity.setExtBoxCode(deliveryNoteEntityMap.get(entity.getOrderId()).getOmsExtYsId() + omsExtOrderNo + "-" + i); + String goodsVolume = entity.getGoodsVolume(); + if (StrUtil.isNotEmpty(goodsVolume)) { + BigDecimal div = NumberUtil.div(Convert.toBigDecimal(goodsVolume), Convert.toBigDecimal(anInt), 4); + packageInfoEntity.setGoodsVolume(Convert.toStr(div)); + } + packageInfoEntities.add(packageInfoEntity); + } + packageInfoEntityMap.put(omsExtOrderNo, packageInfoEntities); + } + } } } - // 组装数据,然后生成暂存单 - deliveryNoteService.buildAdvancePull(packageInfoEntityMap, deliveryNoteEntityMap, orderInfoEntityMap); + } + // 组装数据,然后生成暂存单 + deliveryNoteService.buildAdvancePull(packageInfoEntityMap, deliveryNoteEntityMap, orderInfoEntityMap); + if (CollUtil.isNotEmpty(orderInfoEntities)) { + // 修改包件的发送状态 TODO 后面修改为暂存单消费完成之后回调更新状态 + List updatePackageList = new ArrayList<>(); + for (OrderInfoEntity entity : orderInfoEntities) { + OrderInfoEntity updateEntity = new OrderInfoEntity(); + updateEntity.setReserve1("1"); + updateEntity.setId(entity.getId()); + updatePackageList.add(updateEntity); + } + if (CollUtil.isNotEmpty(updatePackageList)) { + orderInfoService.updateBatchById(updatePackageList); + } + } + if (CollUtil.isNotEmpty(list)) { // 修改包件的发送状态 TODO 后面修改为暂存单消费完成之后回调更新状态 List updatePackageList = new ArrayList<>(); for (PackageInfoEntity entity : list) { diff --git a/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/service/impl/MqWorkerServiceImpl.java b/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/service/impl/MqWorkerServiceImpl.java index 135a76c19..af2edbd34 100644 --- a/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/service/impl/MqWorkerServiceImpl.java +++ b/blade-service/logpm-factory-data/logpm-factory-data-jinpai/src/main/java/com/logpm/factorydata/jinpai/service/impl/MqWorkerServiceImpl.java @@ -307,6 +307,8 @@ public class MqWorkerServiceImpl implements MqWorkerService { OrderInfoEntity deliveryNoteEntity = new OrderInfoEntity(); BeanUtil.copyProperties(vo, deliveryNoteEntity); deliveryNoteEntity.setLogId(ObjectUtil.isNotEmpty(logEntity.getId()) ? logEntity.getId().toString() : null); + // 是否推送 + deliveryNoteEntity.setReserve1("0"); entities.add(deliveryNoteEntity); } if (CollUtil.isNotEmpty(entities)) { diff --git a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryPackageMapper.xml b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryPackageMapper.xml index 4f24799f4..d98e09a84 100644 --- a/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryPackageMapper.xml +++ b/blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/mapper/FactoryPackageMapper.xml @@ -22,7 +22,8 @@ ofp.first_class_name, ofp.second_class_name, ofp.third_class_name, - ofp.push_status + ofp.push_status, + ofo.business_model FROM op_factory_package ofp LEFT JOIN op_factory_order ofo ON ofo.id = ofp.order_id diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportIncomingMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportIncomingMapper.xml index 5aea8e6a4..927d2b628 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportIncomingMapper.xml +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/ReportIncomingMapper.xml @@ -958,6 +958,12 @@ and lww.settlement_status = #{param.settlementStatus} + + and lww.document_making_time >= #{param.startTime} + + + and lww.document_making_time <= #{param.endTime} + GROUP BY lww.id order by lww.create_time desc @@ -1251,6 +1257,12 @@ and lww.settlement_status = #{param.settlementStatus} + + and lww.document_making_time >= #{param.startTime} + + + and lww.document_making_time <= #{param.endTime} + GROUP BY lww.id order by lww.create_time desc diff --git a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/TrunklinePickupMapper.xml b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/TrunklinePickupMapper.xml index 7f3d9352d..82dceb980 100644 --- a/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/TrunklinePickupMapper.xml +++ b/blade-service/logpm-report/src/main/java/com/logpm/report/mapper/TrunklinePickupMapper.xml @@ -248,7 +248,7 @@