|
@@ -23,10 +23,7 @@ import com.sd.business.entity.order.po.OrderSku;
|
|
|
import com.sd.business.entity.order.po.OrderSkuBom;
|
|
|
import com.sd.business.entity.production.dto.StockPreparationDto;
|
|
|
import com.sd.business.entity.production.po.ProductionWorkOrder;
|
|
|
-import com.sd.business.entity.production.vo.OutBomVo;
|
|
|
-import com.sd.business.entity.production.vo.PackageBomVo;
|
|
|
-import com.sd.business.entity.production.vo.StockPreparationVo;
|
|
|
-import com.sd.business.entity.production.vo.UncompletedVo;
|
|
|
+import com.sd.business.entity.production.vo.*;
|
|
|
import com.sd.business.entity.sku.po.SkuSpec;
|
|
|
import com.sd.business.entity.statement.dto.StatementOfAccountDto;
|
|
|
import com.sd.business.entity.warehouse.constant.WarehouseConstant;
|
|
@@ -126,10 +123,6 @@ public class StockPreparationServiceImpl implements StockPreparationService {
|
|
|
uncompletedVo.setBomSpecCode(item.getBomSpecCode());
|
|
|
uncompletedVo.setBomSpecName(item.getBomSpecName());
|
|
|
uncompletedVo.setTotalQuantity(item.getQuantity());
|
|
|
- uncompletedVo.setLength(item.getLength());
|
|
|
- uncompletedVo.setWidth(item.getWidth());
|
|
|
- uncompletedVo.setHeight(item.getHeight());
|
|
|
- uncompletedVo.setColour(item.getColour());
|
|
|
|
|
|
UncompletedVo.SkuInfo skuInfo = new UncompletedVo.SkuInfo();
|
|
|
skuInfo.setSkuSpecId(item.getSkuSpecId());
|
|
@@ -172,6 +165,99 @@ public class StockPreparationServiceImpl implements StockPreparationService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public List<PrintUncompletedVo> printUncompletedList(StockPreparationDto dto) {
|
|
|
+
|
|
|
+ IWrapper<StockPreparationVo> wrapper = getWrapper(dto);
|
|
|
+ List<StockPreparationVo> stockPreparationVoList = stockPreparationMapper.uncompletedList(wrapper);
|
|
|
+
|
|
|
+ if (ObjectUtil.isEmpty(stockPreparationVoList)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询出委外订单,委外订单不出库主材
|
|
|
+ List<Long> orderIds = stockPreparationVoList.stream().map(StockPreparationVo::getOrderId).collect(Collectors.toList());
|
|
|
+ List<Long> outsourceOrderIds = orderService.list(q -> q
|
|
|
+ .in(BaseIdPo::getId, orderIds)
|
|
|
+ .eq(OrderInfo::getType, 2)
|
|
|
+ .select(BaseIdPo::getId))
|
|
|
+ .stream().map(BaseIdPo::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 根据规格分组后再根据颜色分组
|
|
|
+ Map<String, Map<String, List<StockPreparationVo>>> map = stockPreparationVoList.stream()
|
|
|
+ .collect(
|
|
|
+ Collectors.groupingBy(
|
|
|
+ item -> item.getLength() + "*" + item.getWidth() + "*" + item.getHeight(),
|
|
|
+ Collectors.groupingBy(StockPreparationVo::getColour)
|
|
|
+ ));
|
|
|
+
|
|
|
+ List<PrintUncompletedVo> list = new ArrayList<>();
|
|
|
+ for (String spec : map.keySet()) {
|
|
|
+ Map<String, List<StockPreparationVo>> specListMap = map.get(spec);
|
|
|
+ List<PrintUncompletedVo.ColourGroupingInfo> groupingInfoList = new ArrayList<>();
|
|
|
+ for (String colour : specListMap.keySet()) {
|
|
|
+ PrintUncompletedVo.ColourGroupingInfo colourGroupingInfo = new PrintUncompletedVo.ColourGroupingInfo();
|
|
|
+ colourGroupingInfo.setColour(colour);
|
|
|
+ colourGroupingInfo.setUncompletedVoList(specListMap.get(colour).stream()
|
|
|
+ .filter(item -> outsourceOrderIds.isEmpty() || !outsourceOrderIds.contains(item.getOrderId()))
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ StockPreparationVo::getBomSpecId,
|
|
|
+ item -> {
|
|
|
+ UncompletedVo uncompletedVo = new UncompletedVo();
|
|
|
+ uncompletedVo.setBomSpecId(item.getBomSpecId());
|
|
|
+ uncompletedVo.setBomSpecCode(item.getBomSpecCode());
|
|
|
+ uncompletedVo.setBomSpecName(item.getBomSpecName());
|
|
|
+ uncompletedVo.setTotalQuantity(item.getQuantity());
|
|
|
+
|
|
|
+ UncompletedVo.SkuInfo skuInfo = new UncompletedVo.SkuInfo();
|
|
|
+ skuInfo.setSkuSpecId(item.getSkuSpecId());
|
|
|
+ skuInfo.setSkuSpecCode(item.getSkuSpecCode());
|
|
|
+ skuInfo.setSkuSpecName(item.getSkuSpecName());
|
|
|
+ skuInfo.setQuantity(item.getQuantity());
|
|
|
+ skuInfo.setMachinedPanel(item.getMachinedPanel());
|
|
|
+ skuInfo.setArtworkName(item.getArtworkName());
|
|
|
+
|
|
|
+ List<UncompletedVo.SkuInfo> skuInfoList = new ArrayList<>();
|
|
|
+ skuInfoList.add(skuInfo);
|
|
|
+
|
|
|
+ uncompletedVo.setSkuInfoList(skuInfoList);
|
|
|
+
|
|
|
+ return uncompletedVo;
|
|
|
+ },
|
|
|
+ (v1, v2) -> {
|
|
|
+ v1.setTotalQuantity(v1.getTotalQuantity().add(v2.getTotalQuantity()));
|
|
|
+ UncompletedVo.SkuInfo skuInfo = v2.getSkuInfoList().get(0);
|
|
|
+ boolean flag = true;
|
|
|
+ for (UncompletedVo.SkuInfo temp : v1.getSkuInfoList()) {
|
|
|
+ if (Objects.equals(temp.getSkuSpecId(), skuInfo.getSkuSpecId())) {
|
|
|
+ temp.setQuantity(temp.getQuantity().add(skuInfo.getQuantity()));
|
|
|
+ flag = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (flag) {
|
|
|
+ v1.getSkuInfoList().add(skuInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ return v1;
|
|
|
+ }
|
|
|
+ ))
|
|
|
+ .values()
|
|
|
+ .stream()
|
|
|
+ .sorted(Comparator.comparing(UncompletedVo::getBomSpecCode))
|
|
|
+ .collect(Collectors.toList()));
|
|
|
+ groupingInfoList.add(colourGroupingInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ PrintUncompletedVo printUncompletedVo = new PrintUncompletedVo();
|
|
|
+ printUncompletedVo.setSpec(spec);
|
|
|
+ printUncompletedVo.setColourGroupingInfoList(groupingInfoList);
|
|
|
+ list.add(printUncompletedVo);
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public Page<StockPreparationVo> completedPage(StockPreparationDto dto) {
|
|
|
IWrapper<StockPreparationVo> wrapper = IWrapper.getWrapper();
|
|
|
wrapper.eq("oi", OrderInfo::getCode, dto.getOrderCode());
|
|
@@ -263,9 +349,6 @@ public class StockPreparationServiceImpl implements StockPreparationService {
|
|
|
|
|
|
// 生产入库
|
|
|
inventoryFinishedService.productionWarehousing(orderIds);
|
|
|
-
|
|
|
- // 库存销售出库
|
|
|
- inventoryFinishedService.saleOutOfWarehouse(orderIds);
|
|
|
}
|
|
|
|
|
|
// 把生产工单发送到mq
|