|
|
|
@ -7,6 +7,8 @@ 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.basicdata.feign.IBasicdataCategoryClient; |
|
|
|
|
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; |
|
|
|
|
import com.logpm.distribution.bean.Resp; |
|
|
|
|
import com.logpm.distribution.dto.splitOrder.DistributionSplitAllTaskSearchDTO; |
|
|
|
|
import com.logpm.distribution.dto.splitOrder.DistributionSplitTaskSearchDTO; |
|
|
|
@ -26,6 +28,7 @@ import com.logpm.distribution.service.IDistributionStockArticleService;
|
|
|
|
|
import com.logpm.distribution.vo.DistributionSplitOrderAllTaskVO; |
|
|
|
|
import com.logpm.distribution.vo.DistributionSplitOrderTaskVO; |
|
|
|
|
import com.logpm.distribution.vo.SplitPackageOrderVO; |
|
|
|
|
import com.logpm.oldproject.feign.IWarehouseClient; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.common.constant.order.*; |
|
|
|
@ -40,6 +43,7 @@ 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.beans.factory.annotation.Qualifier; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
@ -60,6 +64,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
private final IDistributionSplitOrderLogService distributionSplitOrderLogService; |
|
|
|
|
private final RedisLockClient redisLockClient; |
|
|
|
|
private final IUserClient iUserClient; |
|
|
|
|
private final IBasicdataWarehouseClient iWarehouseClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@ -90,11 +95,16 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
List<DistributionSplitOrderTaskVO> listVo = new ArrayList<>(); |
|
|
|
|
if (list != null && !list.isEmpty()) { |
|
|
|
|
Map<Long, String> userIdNameMap = getUserIdNameMap(list.stream().map(DistributionSplitOrderTaskEntity::getCreateUser).collect(Collectors.toList())); |
|
|
|
|
List<Long> allTaskInfo = list.stream().map(DistributionSplitOrderTaskEntity::getSplitOrderAllTaskId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
List<DistributionSplitOrderAllTaskEntity> allTaskList = distributionSplitOrderAllTaskService.listByIds(allTaskInfo); |
|
|
|
|
Map<Long, DistributionSplitOrderAllTaskEntity> allTaskListById = allTaskList.stream().collect(Collectors.toMap(DistributionSplitOrderAllTaskEntity::getId, u -> u)); |
|
|
|
|
|
|
|
|
|
listVo = list.stream().map(item -> { |
|
|
|
|
DistributionSplitOrderTaskVO distributionSplitOrderTaskVO = new DistributionSplitOrderTaskVO(); |
|
|
|
|
BeanUtil.copyProperties(item, distributionSplitOrderTaskVO); |
|
|
|
|
distributionSplitOrderTaskVO.setCreateUserName(userIdNameMap.get(item.getCreateUser())); |
|
|
|
|
distributionSplitOrderTaskVO.setAllTaskStatus(allTaskListById.get(item.getSplitOrderAllTaskId()).getState()); |
|
|
|
|
return distributionSplitOrderTaskVO; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
@ -264,7 +274,7 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 预约、签收状态的不允许拆单
|
|
|
|
|
long count = distributionParcelListService.count( |
|
|
|
|
List<DistributionParcelListEntity> packageList = distributionParcelListService.list( |
|
|
|
|
Wrappers.<DistributionParcelListEntity>lambdaQuery() |
|
|
|
|
.in(DistributionParcelListEntity::getOrderPackageCode, packageCodes) |
|
|
|
|
.eq(DistributionParcelListEntity::getOrderPackageStatus, OrderPackageStatusConstant.yiruku.getValue()) |
|
|
|
@ -273,8 +283,11 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
.eq(DistributionParcelListEntity::getOrderPackageFreezeStatus, OrderPackageFreezeStatusConstant.weidongjie.getValue()) |
|
|
|
|
.eq(DistributionParcelListEntity::getIsTransfer, 0) |
|
|
|
|
); |
|
|
|
|
if (count != packageCodes.size()) { |
|
|
|
|
return R.fail("提交包件包含预约、签收状态的包件"); |
|
|
|
|
if (packageList.size() != packageCodes.size()) { |
|
|
|
|
return R.fail("提交包件包含预约、签收状态的包件或包件不存在"); |
|
|
|
|
} |
|
|
|
|
if (!packageList.get(0).getWarehouseId().equals(iWarehouseClient.getMyCurrentWarehouse().getId())) { |
|
|
|
|
return R.fail("提交包件包含不属于当前仓库的包件"); |
|
|
|
|
} |
|
|
|
|
long currentOrderCount = distributionParcelListService.count( |
|
|
|
|
Wrappers.<DistributionParcelListEntity>lambdaQuery() |
|
|
|
@ -917,6 +930,8 @@ public class DistributionSplitOrderTaskServiceImpl extends BaseServiceImpl<Distr
|
|
|
|
|
queryWrapper.eq(DistributionSplitOrderAllTaskEntity::getId, splitOrderAllTaskId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
queryWrapper.orderByDesc(DistributionSplitOrderAllTaskEntity::getCreateTime); |
|
|
|
|
|
|
|
|
|
List<DistributionSplitOrderAllTaskEntity> list = distributionSplitOrderAllTaskService.list(page, queryWrapper); |
|
|
|
|
List<DistributionSplitOrderAllTaskVO> listVo = new ArrayList<>(); |
|
|
|
|
if (list != null && !list.isEmpty()) { |
|
|
|
|