mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
分堆打包管理Sonar代码检查问题修改
This commit is contained in:
-48
@@ -1,48 +0,0 @@
|
|||||||
package com.cf.imes.module.executor.controller.admin.plate.vo;
|
|
||||||
|
|
||||||
import com.cf.imes.module.executor.controller.admin.plan.dto.*;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Beal
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class PlateDetailVO implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 5934179383701994502L;
|
|
||||||
|
|
||||||
@Schema(description = "生产单id")
|
|
||||||
private Long orderId;
|
|
||||||
|
|
||||||
@Schema(description = "点详情列表")
|
|
||||||
private List<PointDetail> pointDetailList;
|
|
||||||
|
|
||||||
@Schema(description = "孔详情列表")
|
|
||||||
private List<HoleDetail> holeDetailList;
|
|
||||||
|
|
||||||
@Schema(description = "造型列表")
|
|
||||||
private List<ModelDetail> modelDetailList;
|
|
||||||
|
|
||||||
@Schema(description = "偏移量")
|
|
||||||
private OffSet offSet;
|
|
||||||
|
|
||||||
@Schema(description = "是否新版本")
|
|
||||||
private Boolean newVersion;
|
|
||||||
|
|
||||||
@Schema(description = "原始点详情列表")
|
|
||||||
private List<OldPointDetail> oldPointDetailList;
|
|
||||||
|
|
||||||
@Schema(description = "开料尺寸")
|
|
||||||
private KaiLiaoSize kaiLiaoSize;
|
|
||||||
|
|
||||||
@Schema(description = "边模型详情列表")
|
|
||||||
private List<SideModelDetail> sideModelDetails;
|
|
||||||
|
|
||||||
@Schema(description = "边孔详情")
|
|
||||||
private List<SideHoleDetail> sideHoleDetailList;
|
|
||||||
|
|
||||||
}
|
|
||||||
+138
-122
@@ -36,6 +36,7 @@ import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
|||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.springframework.aop.framework.AopContext;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@@ -47,7 +48,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static com.cf.imes.framework.common.util.string.SearchUtil.insertSeparator;
|
import static com.cf.imes.framework.common.util.string.SearchUtil.insertSeparator;
|
||||||
@@ -56,7 +56,6 @@ import static com.cf.imes.module.system.enums.ErrorCodeConstants.*;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Validated
|
@Validated
|
||||||
@Transactional
|
|
||||||
public class PackServiceImpl implements PackService {
|
public class PackServiceImpl implements PackService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
@@ -101,104 +100,21 @@ public class PackServiceImpl implements PackService {
|
|||||||
List<Long> orderIds = new ArrayList<>();
|
List<Long> orderIds = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
IPage<PackRespVO> packRespVOS = new PageDTO<>();
|
|
||||||
|
|
||||||
|
|
||||||
if (pageReqVO.getIsUp() != null) {
|
if (pageReqVO.getIsUp() != null) {
|
||||||
|
|
||||||
OrderDO order = ordersMapper.selectById(pageReqVO.getOrderId());
|
return handleIsUpCase(pageReqVO, orderIds,pageReqVO.getIsUp());
|
||||||
|
|
||||||
// 判断是否为空
|
|
||||||
AssertUtils.notEmpty(order,ORDER_DATE_ERROR);
|
|
||||||
|
|
||||||
List<PackRespVO> packRespVOList = pageReqVO.getIsUp() ?
|
|
||||||
ordersMapper.selectOrderIds(order.getCreateTime().toString(), getUserOrganId(), order.getId()) :
|
|
||||||
|
|
||||||
ordersMapper.selectOrderIdsFalse(order.getCreateTime().toString(), getUserOrganId(), order.getId());
|
|
||||||
|
|
||||||
if (packRespVOList.isEmpty()) {
|
|
||||||
throw exception(NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE, pageReqVO.getIsUp() ? "第" : "最后");
|
|
||||||
}
|
|
||||||
|
|
||||||
packRespVOS.setRecords(packRespVOList);
|
|
||||||
|
|
||||||
packRespVOS.setTotal(1);
|
|
||||||
|
|
||||||
orderIds.addAll(packRespVOS.getRecords().stream().map(PackRespVO::getId).toList());
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
pageReqVO.setCustomer(insertSeparator(pageReqVO.getCustomer()));
|
return handleNormalCase(pageReqVO, orderIds, page);
|
||||||
pageReqVO.setCustomOrderNo(insertSeparator(pageReqVO.getCustomOrderNo()));
|
|
||||||
pageReqVO.setAddress(insertSeparator(pageReqVO.getAddress()));
|
|
||||||
|
|
||||||
|
|
||||||
// 查询查询分页
|
|
||||||
packRespVOS = ordersMapper.selectOrderIdList(page, pageReqVO, getUserOrganId());
|
|
||||||
|
|
||||||
if (CollUtil.isEmpty(packRespVOS.getRecords())) {
|
|
||||||
return new PageResult<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
orderIds.addAll(packRespVOS.getRecords().stream().map(PackRespVO::getId).toList());
|
|
||||||
|
|
||||||
if (orderIds.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 查询板材的总量
|
|
||||||
List<PackRespVO> packRespVOList = orderPlateMapper.selectPlateNum(orderIds, getUserOrganId());
|
|
||||||
|
|
||||||
AssertUtils.notEmpty(packRespVOList, ErrorCodeConstants.ORDER_PLATE_ERROR);
|
|
||||||
|
|
||||||
for (PackRespVO packRespVO : packRespVOList) {
|
|
||||||
packRespVO.setTotalPieceCount((long) packRespVO.getPlateIdList().size());
|
|
||||||
packRespVO.setPlateIdList(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 查询当前生产的包裹数量
|
|
||||||
List<PackRespVO> respVOS = orderPackageMapper.selectPackPage(orderIds, getUserOrganId());
|
|
||||||
|
|
||||||
|
|
||||||
for (PackRespVO packRespVO : respVOS) {
|
|
||||||
packRespVO.setPackCount((long) packRespVO.getPackIdList().size());
|
|
||||||
packRespVO.setPackIdList(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 查询当前生产单已经打包的板材数量
|
|
||||||
List<PackRespVO> plateNum = orderPackageMapper.selectPackPieceCount(orderIds, getUserOrganId());
|
|
||||||
|
|
||||||
for (PackRespVO packRespVO : plateNum) {
|
|
||||||
packRespVO.setPackPieceCount((long) packRespVO.getPlateIdList().size());
|
|
||||||
packRespVO.setPlateIdList(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (PackRespVO record : packRespVOS.getRecords()) {
|
|
||||||
|
|
||||||
// 板材总数
|
|
||||||
record.setTotalPieceCount(packRespVOList.stream().filter(f -> Objects.equals(f.getId(), record.getId())).mapToLong(PackRespVO::getTotalPieceCount).sum());
|
|
||||||
// 已打包数
|
|
||||||
record.setPackCount(respVOS.stream().filter(f -> Objects.equals(f.getId(), record.getId())).mapToLong(PackRespVO::getPackCount).sum());
|
|
||||||
// 已打包片数
|
|
||||||
record.setPackPieceCount(plateNum.stream().filter(f -> Objects.equals(f.getId(), record.getId())).mapToLong(PackRespVO::getPackPieceCount).sum());
|
|
||||||
// 待处理量
|
|
||||||
record.setPendingNum(record.getTotalPieceCount() - record.getPackPieceCount());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return new PageResult<>(packRespVOS.getRecords(), packRespVOS.getTotal());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 查看生产订单对应的板材信息
|
// 查看生产订单对应的板材信息
|
||||||
@Override
|
@Override
|
||||||
public List<PlateDetailsRespVO> getOrderPlateList(Long orderId) {
|
public List<PlateDetailsRespVO> getOrderPlateList(Long orderId) {
|
||||||
@@ -207,20 +123,20 @@ public class PackServiceImpl implements PackService {
|
|||||||
List<PlateDetailsRespVO> plateDetailsRespVOS = orderPlateMapper.selectOrderNoPackPlateList(orderId, getUserOrganId());
|
List<PlateDetailsRespVO> plateDetailsRespVOS = orderPlateMapper.selectOrderNoPackPlateList(orderId, getUserOrganId());
|
||||||
|
|
||||||
if(plateDetailsRespVOS.isEmpty()){
|
if(plateDetailsRespVOS.isEmpty()){
|
||||||
return null;
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (PlateDetailsRespVO plateDetailsRespVO : plateDetailsRespVOS) {
|
for (PlateDetailsRespVO plateDetailsRespVO : plateDetailsRespVOS) {
|
||||||
String name = "";
|
StringBuilder name = new StringBuilder();
|
||||||
if (!plateDetailsRespVO.getProcessGroupNameList().isEmpty()) {
|
if (!plateDetailsRespVO.getProcessGroupNameList().isEmpty()) {
|
||||||
for (GroupNameList groupNameList : plateDetailsRespVO.getProcessGroupNameList()) {
|
for (GroupNameList groupNameList : plateDetailsRespVO.getProcessGroupNameList()) {
|
||||||
// 去除最后的逗号
|
// 去除最后的逗号
|
||||||
name += groupNameList.getName() + ",";
|
name.append(groupNameList.getName()).append(",");
|
||||||
|
|
||||||
}
|
}
|
||||||
name = name.substring(0, name.length() - 1);
|
name = new StringBuilder(name.substring(0, name.length() - 1));
|
||||||
}
|
}
|
||||||
plateDetailsRespVO.setProcessGroup(name);
|
plateDetailsRespVO.setProcessGroup(name.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
return plateDetailsRespVOS;
|
return plateDetailsRespVOS;
|
||||||
@@ -238,7 +154,7 @@ public class PackServiceImpl implements PackService {
|
|||||||
|
|
||||||
if (plateDetailsRespVOS.isEmpty()) {
|
if (plateDetailsRespVOS.isEmpty()) {
|
||||||
|
|
||||||
return null;
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Long> packageIds = plateDetailsRespVOS.stream().map(PlateDetailsRespVO::getPackageId).distinct().toList();
|
List<Long> packageIds = plateDetailsRespVOS.stream().map(PlateDetailsRespVO::getPackageId).distinct().toList();
|
||||||
@@ -249,15 +165,15 @@ public class PackServiceImpl implements PackService {
|
|||||||
|
|
||||||
|
|
||||||
for (PlateDetailsRespVO plateDetailsRespVO : plateDetailsRespVOS) {
|
for (PlateDetailsRespVO plateDetailsRespVO : plateDetailsRespVOS) {
|
||||||
String name = "";
|
StringBuilder name = new StringBuilder();
|
||||||
if (!plateDetailsRespVO.getProcessGroupNameList().isEmpty()) {
|
if (!plateDetailsRespVO.getProcessGroupNameList().isEmpty()) {
|
||||||
for (GroupNameList groupNameList : plateDetailsRespVO.getProcessGroupNameList()) {
|
for (GroupNameList groupNameList : plateDetailsRespVO.getProcessGroupNameList()) {
|
||||||
// 去除最后的逗号
|
// 去除最后的逗号
|
||||||
name += groupNameList.getName() + ",";
|
name.append(groupNameList.getName()).append(",");
|
||||||
}
|
}
|
||||||
name = name.substring(0, name.length() - 1);
|
name = new StringBuilder(name.substring(0, name.length() - 1));
|
||||||
}
|
}
|
||||||
plateDetailsRespVO.setProcessGroup(name);
|
plateDetailsRespVO.setProcessGroup(name.toString());
|
||||||
|
|
||||||
plateDetailsRespVO.setPackageNo(orderPackageDOS.stream()
|
plateDetailsRespVO.setPackageNo(orderPackageDOS.stream()
|
||||||
.filter(m -> m.getId().equals(plateDetailsRespVO.getPackageId()))
|
.filter(m -> m.getId().equals(plateDetailsRespVO.getPackageId()))
|
||||||
@@ -284,18 +200,18 @@ public class PackServiceImpl implements PackService {
|
|||||||
|
|
||||||
OrderDO orderDO = ordersMapper.selectById(reqVO.getOrderId());
|
OrderDO orderDO = ordersMapper.selectById(reqVO.getOrderId());
|
||||||
|
|
||||||
// AssertUtils.notEmpty(orderPackageVOS,orderDO,ORDER_PLATE_ERROR);
|
AssertUtils.notEmpty(orderDO,ORDER_DATE_ERROR);
|
||||||
|
|
||||||
|
orderPackageVOS.forEach(m -> {
|
||||||
|
|
||||||
return orderPackageVOS.stream().peek(m -> {
|
|
||||||
m.setCustomOrderNo(orderDO.getCustomOrderNo());
|
m.setCustomOrderNo(orderDO.getCustomOrderNo());
|
||||||
m.setCustomer(orderDO.getCustomer());
|
m.setCustomer(orderDO.getCustomer());
|
||||||
m.setAddress(orderDO.getAddress());
|
m.setAddress(orderDO.getAddress());
|
||||||
m.setDealer(orderDO.getDealer());
|
m.setDealer(orderDO.getDealer());
|
||||||
m.setOrderRemark(orderDO.getRemark());
|
m.setOrderRemark(orderDO.getRemark());
|
||||||
}
|
}
|
||||||
).toList();
|
);
|
||||||
|
|
||||||
|
return orderPackageVOS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,20 +269,7 @@ public class PackServiceImpl implements PackService {
|
|||||||
public List<OrderPartsRespVO> getPartsList(OrderPartsReqVO reqVO) {
|
public List<OrderPartsRespVO> getPartsList(OrderPartsReqVO reqVO) {
|
||||||
|
|
||||||
|
|
||||||
List<OrderPartsRespVO> orderPartsRespVOS = orderPartsMapper.selectPartsList(reqVO.getOrderId(), getUserOrganId());
|
return orderPartsMapper.selectPartsList(reqVO.getOrderId(), getUserOrganId());
|
||||||
|
|
||||||
|
|
||||||
return orderPartsRespVOS;
|
|
||||||
|
|
||||||
// PageDTO<OrderPartsRespVO> page = new PageDTO<>(reqVO.getPageNo(), reqVO.getPageSize());
|
|
||||||
//
|
|
||||||
// IPage<OrderPartsRespVO> orderPartsRespVOS = orderPartsMapper.selectPartsList(page,reqVO.getOrderId(),getUserOrganId());
|
|
||||||
//
|
|
||||||
// if (CollectionUtil.isEmpty(orderPartsRespVOS.getRecords())) {
|
|
||||||
// return new PageResult<>();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return new PageResult<>(orderPartsRespVOS.getRecords(), orderPartsRespVOS.getTotal());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,7 +298,8 @@ public class PackServiceImpl implements PackService {
|
|||||||
// 判断当前生产单的板材和配件是否已全部打包且当前生产单的包裹已全部封包
|
// 判断当前生产单的板材和配件是否已全部打包且当前生产单的包裹已全部封包
|
||||||
if (validateOrderPack(reqVO.getOrderId())) {
|
if (validateOrderPack(reqVO.getOrderId())) {
|
||||||
|
|
||||||
updateOrderStatus(reqVO.getOrderId());
|
PackServiceImpl p = (PackServiceImpl)AopContext.currentProxy();
|
||||||
|
p.updateOrderStatus(reqVO.getOrderId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +353,8 @@ public class PackServiceImpl implements PackService {
|
|||||||
// 判断当前生产单的板材和配件是否已全部打包且当前生产单的包裹已全部封包
|
// 判断当前生产单的板材和配件是否已全部打包且当前生产单的包裹已全部封包
|
||||||
if (validateOrderPack(reqVO.getOrderId())) {
|
if (validateOrderPack(reqVO.getOrderId())) {
|
||||||
|
|
||||||
updateOrderStatus(reqVO.getOrderId());
|
PackServiceImpl p = (PackServiceImpl)AopContext.currentProxy();
|
||||||
|
p.updateOrderStatus(reqVO.getOrderId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,7 +416,9 @@ public class PackServiceImpl implements PackService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (validateOrderPack(packageVO.getOrderId())) {
|
if (validateOrderPack(packageVO.getOrderId())) {
|
||||||
updateOrderStatus(packageVO.getOrderId());
|
|
||||||
|
PackServiceImpl p = (PackServiceImpl)AopContext.currentProxy();
|
||||||
|
p.updateOrderStatus(packageVO.getOrderId());
|
||||||
}
|
}
|
||||||
|
|
||||||
return typeConversion(orderPackageDO);
|
return typeConversion(orderPackageDO);
|
||||||
@@ -565,7 +472,8 @@ public class PackServiceImpl implements PackService {
|
|||||||
if (validateOrderPack(packageVO.getOrderId())) {
|
if (validateOrderPack(packageVO.getOrderId())) {
|
||||||
|
|
||||||
// 修改生产单的打包状态
|
// 修改生产单的打包状态
|
||||||
updateOrderStatus(packageVO.getOrderId());
|
PackServiceImpl p = (PackServiceImpl)AopContext.currentProxy();
|
||||||
|
p.updateOrderStatus(packageVO.getOrderId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -620,7 +528,7 @@ public class PackServiceImpl implements PackService {
|
|||||||
|
|
||||||
List<OrderPackageDO> orderPackageDOS = orderPackageMapper.selectPackStatus(orderId, getUserOrganId());
|
List<OrderPackageDO> orderPackageDOS = orderPackageMapper.selectPackStatus(orderId, getUserOrganId());
|
||||||
|
|
||||||
return orderPackageDOS.stream().map(this::typeConversion).collect(Collectors.toList());
|
return orderPackageDOS.stream().map(this::typeConversion).toList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1004,4 +912,112 @@ public class PackServiceImpl implements PackService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 打包翻页查询
|
||||||
|
private PageResult<PackRespVO> handleIsUpCase(PackPageReqVO pageReqVO, List<Long> orderIds,Boolean isUp) {
|
||||||
|
|
||||||
|
IPage<PackRespVO> packRespVOS = new PageDTO<>();
|
||||||
|
|
||||||
|
OrderDO order = ordersMapper.selectById(pageReqVO.getOrderId());
|
||||||
|
AssertUtils.notEmpty(order, ORDER_DATE_ERROR);
|
||||||
|
|
||||||
|
List<PackRespVO> packRespVOList = Boolean.TRUE.equals(isUp) ?
|
||||||
|
ordersMapper.selectOrderIds(order.getCreateTime().toString(), getUserOrganId(), order.getId()) :
|
||||||
|
ordersMapper.selectOrderIdsFalse(order.getCreateTime().toString(), getUserOrganId(), order.getId());
|
||||||
|
|
||||||
|
if (packRespVOList.isEmpty()) {
|
||||||
|
throw exception(NO_PRODUCTION_ORDER_INFORMATION_AVAILABLE, Boolean.TRUE.equals(isUp) ? "第" : "最后");
|
||||||
|
}
|
||||||
|
packRespVOS.setRecords(packRespVOList);
|
||||||
|
|
||||||
|
packRespVOS.setTotal(1);
|
||||||
|
|
||||||
|
orderIds.addAll(packRespVOS.getRecords().stream().map(PackRespVO::getId).toList());
|
||||||
|
|
||||||
|
return buildPageResult(orderIds,packRespVOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 打包分页查询
|
||||||
|
private PageResult<PackRespVO> handleNormalCase(PackPageReqVO pageReqVO, List<Long> orderIds, PageDTO<PackRespVO> page) {
|
||||||
|
|
||||||
|
pageReqVO.setCustomer(insertSeparator(pageReqVO.getCustomer()));
|
||||||
|
pageReqVO.setCustomOrderNo(insertSeparator(pageReqVO.getCustomOrderNo()));
|
||||||
|
pageReqVO.setAddress(insertSeparator(pageReqVO.getAddress()));
|
||||||
|
|
||||||
|
|
||||||
|
// 查询查询分页
|
||||||
|
IPage<PackRespVO> packRespVOS = ordersMapper.selectOrderIdList(page, pageReqVO, getUserOrganId());
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(packRespVOS.getRecords())) {
|
||||||
|
return new PageResult<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
orderIds.addAll(packRespVOS.getRecords().stream().map(PackRespVO::getId).toList());
|
||||||
|
|
||||||
|
return buildPageResult(orderIds, packRespVOS);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 打包分页页面显示数据查询
|
||||||
|
private PageResult<PackRespVO> buildPageResult(List<Long> orderIds,IPage<PackRespVO> packRespVOS){
|
||||||
|
|
||||||
|
if(orderIds.isEmpty()){
|
||||||
|
return new PageResult<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 查询板材的总量
|
||||||
|
List<PackRespVO> packRespVOList = orderPlateMapper.selectPlateNum(orderIds, getUserOrganId());
|
||||||
|
|
||||||
|
AssertUtils.notEmpty(packRespVOList, ErrorCodeConstants.ORDER_PLATE_ERROR);
|
||||||
|
|
||||||
|
for (PackRespVO packRespVO : packRespVOList) {
|
||||||
|
packRespVO.setTotalPieceCount((long) packRespVO.getPlateIdList().size());
|
||||||
|
packRespVO.setPlateIdList(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 查询当前生产的包裹数量
|
||||||
|
List<PackRespVO> respVOS = orderPackageMapper.selectPackPage(orderIds, getUserOrganId());
|
||||||
|
|
||||||
|
|
||||||
|
for (PackRespVO packRespVO : respVOS) {
|
||||||
|
packRespVO.setPackCount((long) packRespVO.getPackIdList().size());
|
||||||
|
packRespVO.setPackIdList(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 查询当前生产单已经打包的板材数量
|
||||||
|
List<PackRespVO> plateNum = orderPackageMapper.selectPackPieceCount(orderIds, getUserOrganId());
|
||||||
|
|
||||||
|
for (PackRespVO packRespVO : plateNum) {
|
||||||
|
packRespVO.setPackPieceCount((long) packRespVO.getPlateIdList().size());
|
||||||
|
packRespVO.setPlateIdList(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (PackRespVO vosRecords : packRespVOS.getRecords()) {
|
||||||
|
|
||||||
|
// 板材总数
|
||||||
|
vosRecords.setTotalPieceCount(packRespVOList.stream().filter(f -> Objects.equals(f.getId(), vosRecords.getId())).mapToLong(PackRespVO::getTotalPieceCount).sum());
|
||||||
|
// 已打包数
|
||||||
|
vosRecords.setPackCount(respVOS.stream().filter(f -> Objects.equals(f.getId(), vosRecords.getId())).mapToLong(PackRespVO::getPackCount).sum());
|
||||||
|
// 已打包片数
|
||||||
|
vosRecords.setPackPieceCount(plateNum.stream().filter(f -> Objects.equals(f.getId(), vosRecords.getId())).mapToLong(PackRespVO::getPackPieceCount).sum());
|
||||||
|
// 待处理量
|
||||||
|
vosRecords.setPendingNum(vosRecords.getTotalPieceCount() - vosRecords.getPackPieceCount());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return new PageResult<>(packRespVOS.getRecords(), packRespVOS.getTotal());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user