Browse Source

Merge remote-tracking branch 'origin/dev' into pre-production

master
zhenghaoyu 3 days ago
parent
commit
ec66b5ef0f
  1. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionSplitOrderTaskController.java
  2. 3
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionSplitOrderTaskService.java
  3. 139
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSplitOrderTaskServiceImpl.java
  4. 11
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderAllTaskVO.java
  5. 11
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/vo/DistributionSplitOrderTaskVO.java
  6. 67
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

3
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<IPage<DistributionSplitOrderAllTaskEntity>> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) {
public R<IPage<DistributionSplitOrderAllTaskVO>> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) {
return distributionSplitOrderTaskService.allTaskList(query, distributionSplitAllTaskSearchDTO);
}

3
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<Distribu
* @param distributionSplitAllTaskSearchDTO
* @return
*/
R<IPage<DistributionSplitOrderAllTaskEntity>> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO);
R<IPage<DistributionSplitOrderAllTaskVO>> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO);
/**
* 创建任务

139
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 BaseServiceImpl<Distr
private final IDistributionSplitOrderDetailService distributionSplitOrderDetailService;
private final IDistributionSplitOrderLogService distributionSplitOrderLogService;
private final RedisLockClient redisLockClient;
private final IUserClient iUserClient;
@Override
@ -112,23 +116,22 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
return R.fail("订单"+ distributionStockArticle.getOrderCode() +"不允许拆单");
}
long packageAllowCount = distributionParcelListService.count(
Wrappers.<DistributionParcelListEntity>lambdaQuery()
.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.<DistributionParcelListEntity>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.<DistributionSplitOrderTaskEntity>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<Distr
return R.fail("提交包件包含不属于当前拆单订单的包件");
}
int addNumber = packageCodes.size();
try {
List<DistributionSplitOrderDetailEntity> existsList = distributionSplitOrderDetailService.list(Wrappers.<DistributionSplitOrderDetailEntity>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<Distr
log.error("添加包件系统错误", e);
throw new CustomerException("系统错误");
}
return R.success("success");
return Resp.scanSuccess("操作成功", addNumber == 0 ? "重复扫描" : task.getNumber() + "件");
}
@Deprecated
@ -723,6 +726,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
* @param taskId
* @return
*/
@Transactional
@Override
public R<String> cancelTask(Long taskId) {
DistributionSplitOrderTaskEntity task = getById(taskId);
@ -735,12 +739,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
}
try {
task.setState(OrderSplitStateConstant.cancel.getValue());
updateById(task);
distributionSplitOrderLogService.record(task, "撤消拆单任务", AuthUtil.getUser().getUserName());
cancelTask(task);
} catch (Exception e) {
if (e instanceof CustomerException) {
throw new CustomerException(e.getMessage());
@ -752,11 +751,29 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
return R.success("操作成功");
}
public void cancelTask(DistributionSplitOrderTaskEntity task){
task.setState(OrderSplitStateConstant.cancel.getValue());
updateById(task);
distributionSplitOrderDetailService.update(
Wrappers.<DistributionSplitOrderDetailEntity>lambdaUpdate()
.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<String> cancelAllTask(Long allTaskId) {
DistributionSplitOrderAllTaskEntity allTask = distributionSplitOrderAllTaskService.getById(allTaskId);
if (!allTask.getState().equals(OrderSplitAllTaskStateConstant.finish.getValue())) {
return R.fail("拆单总任务已完成,无法操作");
return R.fail("拆单总任务完成,无法操作");
}
if (!list(Wrappers.<DistributionSplitOrderTaskEntity>lambdaQuery()
@ -766,8 +783,19 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
return R.fail("拆单总任务中存在已完成拆单任务,无法操作");
}
List<DistributionSplitOrderTaskEntity> list = list(
Wrappers.<DistributionSplitOrderTaskEntity>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 BaseServiceImpl<Distr
return R.fail("拆单总任务已完成或已取消,无法操作");
}
DistributionSplitOrderTaskEntity existsInProgress = getOne(Wrappers.<DistributionSplitOrderTaskEntity>lambdaQuery()
boolean existsInProgress = exists(Wrappers.<DistributionSplitOrderTaskEntity>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<Distr
}
@Override
public R<IPage<DistributionSplitOrderAllTaskEntity>> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) {
public R<IPage<DistributionSplitOrderAllTaskVO>> allTaskList(Query query, DistributionSplitAllTaskSearchDTO distributionSplitAllTaskSearchDTO) {
IPage<DistributionSplitOrderAllTaskEntity> page = Condition.getPage(query);
IPage<DistributionSplitOrderAllTaskVO> pageResult = Condition.getPage(query);
LambdaQueryWrapper<DistributionSplitOrderAllTaskEntity> queryWrapper = Wrappers.lambdaQuery();
@ -878,16 +907,29 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
}
if (splitOrderAllTaskId == 0) {
return R.data(page);
return R.data(pageResult);
}
queryWrapper.eq(DistributionSplitOrderAllTaskEntity::getId, splitOrderAllTaskId);
}
List<DistributionSplitOrderAllTaskEntity> list = distributionSplitOrderAllTaskService.list(page, queryWrapper);
page.setRecords(list);
return R.data(page);
String createUserIds = list.stream().map((d) -> d.getCreateUser() + "").collect(Collectors.joining(","));
List<User> users = iUserClient.userInfoByIds(AuthUtil.getTenantId(), String.join(",", createUserIds)).getData();
Map<Long, User> userMap = users.stream().collect(Collectors.toMap(User::getId, u -> u));
List<DistributionSplitOrderAllTaskVO> 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 BaseServiceImpl<Distr
return R.data(res);
}
public long getSplitOrderAllowCount(Long stockArticleId) {
return distributionParcelListService.count(
Wrappers.<DistributionParcelListEntity>lambdaQuery()
.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<String> checkOrderCode(String orderCode) {
DistributionSplitOrderAllTaskEntity exists = distributionSplitOrderAllTaskService.getOne(
Wrappers.<DistributionSplitOrderAllTaskEntity>lambdaQuery()
.eq(DistributionSplitOrderAllTaskEntity::getOrderCode, orderCode)
public long getSplitOrderAllCount(Long stockArticleId) {
return distributionParcelListService.count(
Wrappers.<DistributionParcelListEntity>lambdaQuery()
.in(DistributionParcelListEntity::getStockArticleId, stockArticleId)
);
}
return R.success(exists == null ? "" : exists.getNo());
@Override
public R<String> checkOrderCode(String orderCode) {
DistributionStockArticleEntity distributionStockArticle = distributionStockArticleService.getOne(Wrappers.<DistributionStockArticleEntity>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

11
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;
}

11
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;
}

67
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

@ -57,7 +57,6 @@ import org.springblade.common.constant.*;
import org.springblade.common.constant.broadcast.FanoutConstants;
import org.springblade.common.constant.carsload.CarsLoadLogTypeConstant;
import org.springblade.common.enums.BizOperationEnums;
import org.springblade.common.enums.PackageTypeEnums;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.model.NodeFanoutMsg;
import org.springblade.common.model.PackageData;
@ -9768,22 +9767,22 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
// carsLoadAsyncService.sendReportPackageSignData(AuthUtil.getNickName(),AuthUtil.getUserId(),warehouseId,warehouseName,carsLoadEntity,scanCodes);
FindParamterDTO findParamterDTO = new FindParamterDTO();
findParamterDTO.setOrderPackageCodeList(scanCodes);
findParamterDTO.setWarehouseId(warehouseId);
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO);
parcelListEntityList.forEach(parcelListEntity -> {
PackageData packageData = new PackageData();
packageData.setWaybillNumber(parcelListEntity.getWaybillNumber());
packageData.setBrand(parcelListEntity.getBrandName());
packageData.setPackageCode(parcelListEntity.getOrderPackageCode());
packageData.setMaterialCode(parcelListEntity.getMaterialCode());
packageData.setMaterialName(parcelListEntity.getMaterialName());
packageData.setNumber(1);
packageData.setOrderCode(parcelListEntity.getOrderCode());
packageData.setPackageType(PackageTypeEnums.CMP);
packageDataList.add(packageData);
});
// FindParamterDTO findParamterDTO = new FindParamterDTO();
// findParamterDTO.setOrderPackageCodeList(scanCodes);
// findParamterDTO.setWarehouseId(warehouseId);
// List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(findParamterDTO);
// parcelListEntityList.forEach(parcelListEntity -> {
// PackageData packageData = new PackageData();
// packageData.setWaybillNumber(parcelListEntity.getWaybillNumber());
// packageData.setBrand(parcelListEntity.getBrandName());
// packageData.setPackageCode(parcelListEntity.getOrderPackageCode());
// packageData.setMaterialCode(parcelListEntity.getMaterialCode());
// packageData.setMaterialName(parcelListEntity.getMaterialName());
// packageData.setNumber(1);
// packageData.setOrderCode(parcelListEntity.getOrderCode());
// packageData.setPackageType(PackageTypeEnums.CMP);
// packageDataList.add(packageData);
// });
}else{
@ -9803,19 +9802,19 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
TrunklineScanZeroDetailEntity entity = new TrunklineScanZeroDetailEntity();
BeanUtil.copy(zeroDetailVO, entity);
zeroDetailList.add(entity);
Long packageId = zeroDetailVO.getPackageId();
DistributionParcelListEntity parcelList = parcelListMap.get(packageId);
if(!Objects.isNull(parcelList)){
PackageData packageData = new PackageData();
packageData.setWaybillNumber(parcelList.getWaybillNumber());
packageData.setBrand(parcelList.getBrandName());
packageData.setProductId(zeroDetailVO.getGoodsId());
packageData.setProductName(zeroDetailVO.getGoodsName());
packageData.setNumber(zeroDetailVO.getUnloadNum());
packageData.setOrderCode(parcelList.getOrderCode());
packageData.setPackageType(PackageTypeEnums.LTL);
packageDataList.add(packageData);
}
// Long packageId = zeroDetailVO.getPackageId();
// DistributionParcelListEntity parcelList = parcelListMap.get(packageId);
// if(!Objects.isNull(parcelList)){
// PackageData packageData = new PackageData();
// packageData.setWaybillNumber(parcelList.getWaybillNumber());
// packageData.setBrand(parcelList.getBrandName());
// packageData.setProductId(zeroDetailVO.getGoodsId());
// packageData.setProductName(zeroDetailVO.getGoodsName());
// packageData.setNumber(zeroDetailVO.getUnloadNum());
// packageData.setOrderCode(parcelList.getOrderCode());
// packageData.setPackageType(PackageTypeEnums.LTL);
// packageDataList.add(packageData);
// }
});
@ -9830,10 +9829,10 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
}
});
NodeFanoutMsg<TripartiteVO> tripartiteVONodeFanoutMsg = buildNodeFanoutMessage(carsLoadEntity, packageDataList, warehouseId);
if(!Objects.isNull(tripartiteVONodeFanoutMsg)){
rabbitTemplate.convertAndSend(FanoutConstants.trunkline.tripartite.EXCHANGE, null, com.alibaba.fastjson.JSONObject.toJSONString(tripartiteVONodeFanoutMsg));
}
// NodeFanoutMsg<TripartiteVO> tripartiteVONodeFanoutMsg = buildNodeFanoutMessage(carsLoadEntity, packageDataList, warehouseId);
// if(!Objects.isNull(tripartiteVONodeFanoutMsg)){
// rabbitTemplate.convertAndSend(FanoutConstants.trunkline.tripartite.EXCHANGE, null, com.alibaba.fastjson.JSONObject.toJSONString(tripartiteVONodeFanoutMsg));
// }
return R.success("签收成功");
}

Loading…
Cancel
Save