Explorar o código

订单备料数量修正
库存导出

24282 hai 1 ano
pai
achega
c2a97d545b

+ 12 - 4
sd-business/src/main/java/com/sd/business/controller/inventory/InventoryController.java

@@ -1,6 +1,7 @@
 package com.sd.business.controller.inventory;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.annotation.NonInterception;
 import com.sd.business.entity.inventory.dto.GetQuantityDto;
 import com.sd.business.entity.inventory.dto.InventorySelectDto;
 import com.sd.business.entity.inventory.dto.QuantityByWarehouseDto;
@@ -9,10 +10,7 @@ import com.sd.business.entity.inventory.vo.QuantityByDepartmentVo;
 import com.sd.business.entity.inventory.vo.QuantityByWarehouseVo;
 import com.sd.business.service.inventory.InventoryService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -67,4 +65,14 @@ public class InventoryController {
         return inventoryService.getQuantity(dto);
     }
 
+    /**
+     * 库存导出
+     */
+    @NonInterception
+    @GetMapping("/exportExcel")
+    public void exportExcel(@RequestBody InventorySelectDto dto) {
+        inventoryService.exportExcel(dto);
+    }
+
+
 }

+ 3 - 0
sd-business/src/main/java/com/sd/business/entity/inventory/po/Inventory.java

@@ -1,5 +1,6 @@
 package com.sd.business.entity.inventory.po;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
@@ -38,11 +39,13 @@ public class Inventory extends BasePo {
     /**
      * 数量
      */
+    @ExcelProperty(value = "库存", index = 5)
     private BigDecimal quantity;
 
     /**
      * 结存单价
      */
+    @ExcelProperty(value = "结存单价", index = 4)
     private BigDecimal balanceUnitPrice;
 
 }

+ 12 - 0
sd-business/src/main/java/com/sd/business/entity/inventory/vo/InventoryVo.java

@@ -1,9 +1,12 @@
 package com.sd.business.entity.inventory.vo;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.sd.business.entity.inventory.po.Inventory;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
+
 /**
  * 库存列表查询返回值实体
  *
@@ -17,16 +20,19 @@ public class InventoryVo extends Inventory {
     /**
      * 仓库名称
      */
+    @ExcelProperty(value = "仓库", index = 1)
     private String warehouseName;
 
     /**
      * 品名
      */
+    @ExcelProperty(value = "品名", index = 2)
     private String bomSpecName;
 
     /**
      * 品号
      */
+    @ExcelProperty(value = "品号", index = 3)
     private String bomSpecCode;
 
     /**
@@ -34,4 +40,10 @@ public class InventoryVo extends Inventory {
      */
     private String departmentName;
 
+    /**
+     * 结存总价
+     */
+    @ExcelProperty(value = "结存总价", index = 6)
+    private BigDecimal totalPrice;
+
 }

+ 6 - 0
sd-business/src/main/java/com/sd/business/mapper/inventory/InventoryMapper.java

@@ -53,4 +53,10 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
      * 根据bomSpecId获取结存数量
      */
     BigDecimal getQuantityByBomSpecId(@Param("bomSpecId") Long bomSpecId, @Param("warehouseId") Long warehouseId);
+
+    /**
+     * 库存列表
+     */
+    List<InventoryVo> getList(@Param("ew") IWrapper<Inventory> wrapper);
+
 }

+ 5 - 0
sd-business/src/main/java/com/sd/business/service/inventory/InventoryService.java

@@ -64,4 +64,9 @@ public interface InventoryService extends BaseService<Inventory> {
      */
     Map<Long, BigDecimal> getQuantity(GetQuantityDto dto);
 
+    /**
+     * 导出
+     */
+    void exportExcel(InventorySelectDto dto);
+
 }

+ 49 - 25
sd-business/src/main/java/com/sd/business/service/inventory/impl/InventoryServiceImpl.java

@@ -20,10 +20,12 @@ import com.sd.business.mapper.inventory.InventoryMapper;
 import com.sd.business.service.bom.BomSpecService;
 import com.sd.business.service.in.InOutStorageDetailsService;
 import com.sd.business.service.inventory.InventoryService;
+import com.sd.framework.util.excel.util.ExcelUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.Collection;
@@ -46,7 +48,8 @@ import java.util.stream.Collectors;
 @Service
 public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory> implements InventoryService {
 
-    private final static BigDecimal tempUnitPrice = BigDecimal.TEN;
+    @Autowired
+    private HttpServletResponse response;
 
     @Autowired
     private BomSpecService bomSpecService;
@@ -56,24 +59,7 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
 
     @Override
     public Page<InventoryVo> getPage(InventorySelectDto dto, String tableName) {
-        IWrapper<Inventory> wrapper = getWrapper();
-
-        wrapper.orderByDesc("i", Inventory::getId);
-        wrapper.eq("b", Bom::getBomClassifyId, dto.getBomClassifyId());
-        wrapper.like("bs", BomSpec::getName, dto.getBomSpecName());
-        wrapper.like("bs", BomSpec::getCode, dto.getBomSpecCode());
-        wrapper.eq("b", Bom::getSpecies, dto.getBomSpecies());
-        wrapper.eq("b", Bom::getChromatophore, dto.getBomChromatophore());
-        wrapper.eq("b", Bom::getEmbossingProcess, dto.getBomEmbossingProcess());
-        wrapper.eq("b", Bom::getFrontGrain, dto.getBomFrontGrain());
-        wrapper.eq("b", Bom::getReverseGrain, dto.getBomReverseGrain());
-        wrapper.like("bs", BomSpec::getColour, dto.getBomSpecColour());
-        wrapper.like("bs", BomSpec::getLength, dto.getBomSpecLength());
-        wrapper.like("bs", BomSpec::getWidth, dto.getBomSpecWidth());
-        wrapper.eq("i", Inventory::getWarehouseId, dto.getWarehouseId());
-        wrapper.eq("i", Inventory::getDepartmentId, dto.getDepartmentId());
-        wrapper.eq("i", InventoryBackup::getBackupDate, dto.getBackupDate());
-
+        IWrapper<Inventory> wrapper = getDtoWrapper(dto);
         return this.baseMapper.getPage(dto.getPage(), wrapper, tableName);
     }
 
@@ -93,26 +79,32 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
 
         synchronized (this) {
 
+            // 通过事业部id和出库id获取bom规格库存
+            List<Inventory> inventoryList = getInventoryList(departmentId, warehouseId, bomSpecIdList);
+
+            // 通过bom规格分组
+            Map<Long, Inventory> map = inventoryList.stream().collect(Collectors.toMap(Inventory::getBomSpecId, Function.identity()));
+
             // 保存结存单价批次
             List<InOutStorageDetails> inOutStorageDetailsList = list.stream().map(item -> {
+
+                // todo 获取临时结存单价
+                Inventory inventory = map.get(item.getBomSpecId());
+                BigDecimal inUnitPrice = inventory == null ? BigDecimal.ZERO : inventory.getBalanceUnitPrice();
+
                 InOutStorageDetails inOutStorageDetails = new InOutStorageDetails();
                 inOutStorageDetails.setDepartmentId(departmentId);
                 inOutStorageDetails.setWarehouseId(warehouseId);
                 inOutStorageDetails.setBomSpecId(item.getBomSpecId());
-                inOutStorageDetails.setInUnitPrice(tempUnitPrice);
+                inOutStorageDetails.setInUnitPrice(inUnitPrice);
                 inOutStorageDetails.setQuantity(item.getQuantity());
                 return inOutStorageDetails;
             }).collect(Collectors.toList());
             inOutStorageDetailsService.saveBatch(inOutStorageDetailsList);
 
-            // 通过事业部id和出库id获取bom规格库存
-            List<Inventory> inventoryList = getInventoryList(departmentId, warehouseId, bomSpecIdList);
-
             // 通过出库id获取bom规格结存列表
             Map<Long, List<InOutStorageDetails>> inOutStorageDetailsMap = getInOutStorageDetailsMap(warehouseId, bomSpecIdList);
 
-            // 通过bom规格分组
-            Map<Long, Inventory> map = inventoryList.stream().collect(Collectors.toMap(Inventory::getBomSpecId, Function.identity()));
 
             for (InOutFun inOutFun : list) {
 
@@ -194,6 +186,13 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
 
     }
 
+    @Override
+    public void exportExcel(InventorySelectDto dto) {
+        IWrapper<Inventory> wrapper = getDtoWrapper(dto);
+        List<InventoryVo> list = baseMapper.getList(wrapper);
+        ExcelUtil.export(response, list, InventoryVo.class);
+    }
+
     /**
      * 通过事业部id和出库id获取bom规格库存
      */
@@ -285,4 +284,29 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
         return getBalanceUnitPrice(inOutStorageDetailsMap, inOutFun);
     }
 
+    /**
+     * 获取查询条件
+     */
+    private IWrapper<Inventory> getDtoWrapper(InventorySelectDto dto) {
+        IWrapper<Inventory> wrapper = getWrapper();
+
+        wrapper.orderByDesc("i", Inventory::getId);
+        wrapper.eq("b", Bom::getBomClassifyId, dto.getBomClassifyId());
+        wrapper.like("bs", BomSpec::getName, dto.getBomSpecName());
+        wrapper.like("bs", BomSpec::getCode, dto.getBomSpecCode());
+        wrapper.eq("b", Bom::getSpecies, dto.getBomSpecies());
+        wrapper.eq("b", Bom::getChromatophore, dto.getBomChromatophore());
+        wrapper.eq("b", Bom::getEmbossingProcess, dto.getBomEmbossingProcess());
+        wrapper.eq("b", Bom::getFrontGrain, dto.getBomFrontGrain());
+        wrapper.eq("b", Bom::getReverseGrain, dto.getBomReverseGrain());
+        wrapper.like("bs", BomSpec::getColour, dto.getBomSpecColour());
+        wrapper.like("bs", BomSpec::getLength, dto.getBomSpecLength());
+        wrapper.like("bs", BomSpec::getWidth, dto.getBomSpecWidth());
+        wrapper.eq("i", Inventory::getWarehouseId, dto.getWarehouseId());
+        wrapper.eq("i", Inventory::getDepartmentId, dto.getDepartmentId());
+        wrapper.eq("i", InventoryBackup::getBackupDate, dto.getBackupDate());
+
+        return wrapper;
+    }
+
 }

+ 81 - 8
sd-business/src/main/java/com/sd/business/service/order/impl/OrderServiceImpl.java

@@ -14,12 +14,14 @@ import com.ruoyi.common.core.domain.BaseSelectDto;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.bom.bo.BomSpecBo;
 import com.sd.business.entity.bom.po.Bom;
 import com.sd.business.entity.bom.po.BomSpec;
 import com.sd.business.entity.department.po.Department;
 import com.sd.business.entity.in.dto.InOutStorageDto;
 import com.sd.business.entity.in.emums.InDetailTypeEnum;
 import com.sd.business.entity.in.emums.InOutTypeEnum;
+import com.sd.business.entity.in.po.InOutStorageBom;
 import com.sd.business.entity.order.dto.OrderInfoDto;
 import com.sd.business.entity.order.dto.OrderSelectDto;
 import com.sd.business.entity.order.dto.OrderSkuDto;
@@ -34,6 +36,7 @@ import com.sd.business.entity.order.vo.SkuSpecPriceVo;
 import com.sd.business.entity.price.po.PriceBillingStandard;
 import com.sd.business.entity.price.po.PriceBillingStandardDetail;
 import com.sd.business.entity.sku.po.SkuSpec;
+import com.sd.business.entity.warehouse.constant.WarehouseConstant;
 import com.sd.business.mapper.order.OrderMapper;
 import com.sd.business.service.bom.BomService;
 import com.sd.business.service.bom.BomSpecService;
@@ -50,6 +53,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -443,14 +447,83 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
             return;
         }
 
-        InOutStorageDto inOutStorageDto = new InOutStorageDto();
-        inOutStorageDto.setDepartmentId(orderInfo.getOutDepartmentId());
-        // inOutStorageDto.setWarehouseId(dto.getInWarehouseId());
-        inOutStorageDto.setType(InOutTypeEnum.IN.getKey());
-        inOutStorageDto.setDetailType(InDetailTypeEnum.RETURN_GOODS.getKey());
-        inOutStorageDto.setApplicant(SecurityUtils.getLoginUser().getUser().getNickName());
-        inOutStorageDto.setRemark("删除订单:" + orderInfo.getWlnCode() + " 退货入库");
-        inOutStorageService.add(inOutStorageDto);
+        // 获取订单商品主材和包材
+        List<OrderSku> orderSkuList = orderSkuService.list(q -> q.eq(OrderSku::getOrderId, id));
+        List<OrderSkuBom> orderSkuBomList = orderSkuBomService.list(q -> q.eq(OrderSkuBom::getOrderId, id));
+
+        Map<Long, OrderSku> orderSkuMap = orderSkuList.stream().collect(Collectors.toMap(BaseIdPo::getId, Function.identity()));
+
+        // 合并主材和包材
+        List<InOutStorageBom> inOutStorageBomList = orderSkuList.stream().map(item -> {
+            InOutStorageBom inOutStorageBom = new InOutStorageBom();
+            inOutStorageBom.setBomSpecId(item.getBomSpecId());
+            inOutStorageBom.setQuantity(item.getQuantity());
+            return inOutStorageBom;
+        }).collect(Collectors.toList());
+
+        for (OrderSkuBom orderSkuBom : orderSkuBomList) {
+            OrderSku orderSku = orderSkuMap.get(orderSkuBom.getOrderSkuId());
+            InOutStorageBom inOutStorageBom = new InOutStorageBom();
+            inOutStorageBom.setBomSpecId(orderSkuBom.getBomSpecId());
+            inOutStorageBom.setQuantity(orderSkuBom.getQuantity().multiply(orderSku.getQuantity()));
+            inOutStorageBomList.add(inOutStorageBom);
+        }
+
+        // 合并数量
+        Map<Long, InOutStorageBom> map = inOutStorageBomList.stream().collect(Collectors.toMap(
+                InOutStorageBom::getBomSpecId,
+                Function.identity(),
+                (v1, v2) -> {
+                    v1.setQuantity(v1.getQuantity().add(v2.getQuantity()));
+                    return v1;
+                }
+        ));
+        inOutStorageBomList = new ArrayList<>(map.values());
+
+        // 区分半成品仓和包材仓库
+        Map<Long, BomSpecBo> bomSpecBoMap = skuSpecService.getBomSpecBoByIdList(map.keySet());
+
+        // 主材从半成品仓入库
+        List<InOutStorageBom> semiFinishedProductInOutStorageBomList = inOutStorageBomList
+                .stream()
+                .filter(item -> {
+                    BomSpecBo tempBomSpecBo = bomSpecBoMap.get(item.getBomSpecId());
+                    if (tempBomSpecBo == null) {
+                        return false;
+                    }
+                    return ObjectUtil.equal(tempBomSpecBo.getClassifyParentId(), 1L);
+                })
+                .collect(Collectors.toList());
+        InOutStorageDto semiFinishedProductInOutStorageDto = new InOutStorageDto();
+        semiFinishedProductInOutStorageDto.setType(InOutTypeEnum.IN.getKey());
+        semiFinishedProductInOutStorageDto.setDetailType(InDetailTypeEnum.RETURN_GOODS.getKey());
+        semiFinishedProductInOutStorageDto.setWarehouseId(WarehouseConstant.SEMI_FINISHED_PRODUCT);
+        semiFinishedProductInOutStorageDto.setDepartmentId(orderInfo.getOutDepartmentId());
+        semiFinishedProductInOutStorageDto.setApplicant(SecurityUtils.getLoginUser().getUser().getNickName());
+        semiFinishedProductInOutStorageDto.setRemark("删除订单:" + orderInfo.getWlnCode() + " 主材退货入库");
+        semiFinishedProductInOutStorageDto.setInOutStorageBomList(semiFinishedProductInOutStorageBomList);
+        inOutStorageService.add(semiFinishedProductInOutStorageDto);
+
+        // 包材从包材仓出库
+        List<InOutStorageBom> packagingMaterialInOutStorageBomList = inOutStorageBomList
+                .stream()
+                .filter(item -> {
+                    BomSpecBo tempBomSpecBo = bomSpecBoMap.get(item.getBomSpecId());
+                    if (tempBomSpecBo == null) {
+                        return true;
+                    }
+                    return ObjectUtil.notEqual(tempBomSpecBo.getClassifyParentId(), 1L);
+                })
+                .collect(Collectors.toList());
+        InOutStorageDto packagingMaterialInOutStorageDto = new InOutStorageDto();
+        packagingMaterialInOutStorageDto.setType(InOutTypeEnum.IN.getKey());
+        packagingMaterialInOutStorageDto.setDetailType(InDetailTypeEnum.RETURN_GOODS.getKey());
+        packagingMaterialInOutStorageDto.setWarehouseId(WarehouseConstant.PACKAGING_MATERIAL);
+        packagingMaterialInOutStorageDto.setDepartmentId(orderInfo.getOutDepartmentId());
+        packagingMaterialInOutStorageDto.setApplicant(SecurityUtils.getLoginUser().getUser().getNickName());
+        packagingMaterialInOutStorageDto.setRemark("删除订单:" + orderInfo.getWlnCode() + " 包材退货入库");
+        packagingMaterialInOutStorageDto.setInOutStorageBomList(packagingMaterialInOutStorageBomList);
+        inOutStorageService.add(packagingMaterialInOutStorageDto);
 
     }
 

+ 11 - 2
sd-business/src/main/java/com/sd/business/service/production/impl/StockPreparationServiceImpl.java

@@ -263,6 +263,9 @@ public class StockPreparationServiceImpl implements StockPreparationService {
             return Collections.emptyList();
         }
 
+        Map<Long, StockPreparationVo> stockPreparationVoMap =
+                stockPreparationVoList.stream().collect(Collectors.toMap(StockPreparationVo::getOrderSkuId, Function.identity()));
+
         // 订单sku包材列表
         List<Long> orderSkuIdList = stockPreparationVoList.stream().map(StockPreparationVo::getOrderSkuId).collect(Collectors.toList());
         List<OrderSkuBom> orderSkuBomList = orderSkuBomService.list(q -> q.in(OrderSkuBom::getOrderSkuId, orderSkuIdList));
@@ -276,9 +279,10 @@ public class StockPreparationServiceImpl implements StockPreparationService {
         }).collect(Collectors.toList());
 
         for (OrderSkuBom orderSkuBom : orderSkuBomList) {
+            StockPreparationVo stockPreparationVo = stockPreparationVoMap.get(orderSkuBom.getOrderSkuId());
             OutBomVo outBomVo = new OutBomVo();
             outBomVo.setBomSpecId(orderSkuBom.getBomSpecId());
-            outBomVo.setOutQuantity(orderSkuBom.getQuantity());
+            outBomVo.setOutQuantity(orderSkuBom.getQuantity().multiply(stockPreparationVo.getQuantity()));
             outBomVoList.add(outBomVo);
         }
 
@@ -452,6 +456,9 @@ public class StockPreparationServiceImpl implements StockPreparationService {
 
         List<OrderSkuBom> orderSkuBomList = orderSkuBomService.list(q -> q.in(OrderSkuBom::getOrderId, orderIdList));
 
+        Map<Long, StockPreparationVo> stockPreparationVoMap =
+                stockPreparationVoList.stream().collect(Collectors.toMap(StockPreparationVo::getOrderSkuId, Function.identity()));
+
         // 合并sku主材和包材
         List<InOutStorageBom> list = new ArrayList<>(
                 Stream.concat(
@@ -462,9 +469,11 @@ public class StockPreparationServiceImpl implements StockPreparationService {
                                     return inOutStorageBom;
                                 }),
                                 orderSkuBomList.stream().map(item -> {
+                                    StockPreparationVo stockPreparationVo = stockPreparationVoMap.get(item.getOrderSkuId());
+
                                     InOutStorageBom inOutStorageBom = new InOutStorageBom();
                                     inOutStorageBom.setBomSpecId(item.getBomSpecId());
-                                    inOutStorageBom.setQuantity(item.getQuantity());
+                                    inOutStorageBom.setQuantity(item.getQuantity().multiply(stockPreparationVo.getQuantity()));
                                     return inOutStorageBom;
                                 })
                         )

+ 12 - 12
sd-business/src/main/java/com/sd/business/service/sku/impl/SkuServiceImpl.java

@@ -303,29 +303,29 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements SkuSe
                 String bomSpecCode = bomSpecBo.getBomSpecCode();
 
                 if (Objects.equals(classifyId, 1682221201491058690L)) {
-                    record.setColouredPaper(record.getColouredPaper() == null ? bomSpecCode : "," + bomSpecCode);
+                    record.setColouredPaper(record.getColouredPaper() == null ? bomSpecCode : record.getColouredPaper() + "," + bomSpecCode);
                 } else if (Objects.equals(classifyId, 1682221249268375554L)) {
-                    record.setOppMembrane(record.getOppMembrane() == null ? bomSpecCode : "," + bomSpecCode);
+                    record.setOppMembrane(record.getOppMembrane() == null ? bomSpecCode : record.getOppMembrane() + "," + bomSpecCode);
                 } else if (Objects.equals(classifyId, 1682221303530086402L)) {
-                    record.setPeBag(record.getPeBag() == null ? bomSpecCode : "," + bomSpecCode);
+                    record.setPeBag(record.getPeBag() == null ? bomSpecCode : record.getPeBag() + "," + bomSpecCode);
                 } else if (Objects.equals(classifyId, 1682221356147630081L)) {
-                    record.setMeshBag(record.getMeshBag() == null ? bomSpecCode : "," + bomSpecCode);
+                    record.setMeshBag(record.getMeshBag() == null ? bomSpecCode : record.getMeshBag() + "," + bomSpecCode);
                 } else if (Objects.equals(classifyId, 1682221409847304194L)) {
-                    record.setPaperBox(record.getPaperBox() == null ? bomSpecCode : "," + bomSpecCode);
+                    record.setPaperBox(record.getPaperBox() == null ? bomSpecCode : record.getPaperBox() + "," + bomSpecCode);
                 } else if (Objects.equals(classifyId, 1682221453145104386L)) {
-                    record.setBubblePack(record.getBubblePack() == null ? bomSpecCode : "," + bomSpecCode);
+                    record.setBubblePack(record.getBubblePack() == null ? bomSpecCode : record.getBubblePack() + "," + bomSpecCode);
                 } else if (Objects.equals(classifyId, 1682221528948760578L)) {
-                    record.setLogisticsPackagingMaterial(record.getLogisticsPackagingMaterial() == null ? bomSpecCode : "," + bomSpecCode);
+                    record.setLogisticsPackagingMaterial(record.getLogisticsPackagingMaterial() == null ? bomSpecCode : record.getLogisticsPackagingMaterial() + "," + bomSpecCode);
                 } else if (Objects.equals(classifyId, 1682221581453058049L)) {
-                    record.setOtherPackingMaterial(record.getOtherPackingMaterial() == null ? bomSpecCode : "," + bomSpecCode);
+                    record.setOtherPackingMaterial(record.getOtherPackingMaterial() == null ? bomSpecCode : record.getOtherPackingMaterial() + "," + bomSpecCode);
                 } else if (Objects.equals(classifyId, 1697442459841290241L)) {
-                    record.setSelfAdhesiveSticker(record.getSelfAdhesiveSticker() == null ? bomSpecCode : "," + bomSpecCode);
+                    record.setSelfAdhesiveSticker(record.getSelfAdhesiveSticker() == null ? bomSpecCode : record.getSelfAdhesiveSticker() + "," + bomSpecCode);
                 } else if (Objects.equals(classifyId, 1697442971286331393L)) {
-                    record.setDrop(record.getDrop() == null ? bomSpecCode : "," + bomSpecCode);
+                    record.setDrop(record.getDrop() == null ? bomSpecCode : record.getDrop() + "," + bomSpecCode);
                 } else if (Objects.equals(classifyId, 1682221651040755714L)) {
-                    record.setSuspenders(record.getSuspenders() == null ? bomSpecCode : "," + bomSpecCode);
+                    record.setSuspenders(record.getSuspenders() == null ? bomSpecCode : record.getSuspenders() + "," + bomSpecCode);
                 } else if (Objects.equals(classifyId, 1682221712801882114L)) {
-                    record.setAccessory(record.getAccessory() == null ? bomSpecCode : "," + bomSpecCode);
+                    record.setAccessory(record.getAccessory() == null ? bomSpecCode : record.getAccessory() + "," + bomSpecCode);
                 }
 
             }

+ 20 - 0
sd-business/src/main/resources/mapper/inventory/InventoryMapper.xml

@@ -74,5 +74,25 @@
           AND del_flag = 0
     </select>
 
+    <select id="getList" resultType="com.sd.business.entity.inventory.vo.InventoryVo">
+        select i.id,
+               i.warehouse_id,
+               i.bom_spec_id,
+               i.balance_unit_price,
+               i.quantity,
+               i.department_id,
+               w.name                            warehouseName,
+               bs.name                           bomSpecName,
+               bs.code                           bomSpecCode,
+               d.name                            departmentName,
+               i.quantity * i.balance_unit_price totalPrice
+        from inventory i
+                 left join bom_spec bs on i.bom_spec_id = bs.id
+                 left join bom b on bs.bom_id = b.id
+                 left join warehouse w on i.warehouse_id = w.id
+                 left join department d on i.department_id = d.id
+            ${ew.customSqlSegment}
+    </select>
+
 
 </mapper>