24282 1 éve
szülő
commit
ed19dbf4bd
25 módosított fájl, 300 hozzáadás és 150 törlés
  1. 0 10
      sd-business/src/main/java/com/sd/business/controller/inventory/InventoryController.java
  2. 71 0
      sd-business/src/main/java/com/sd/business/controller/inventory/InventoryIngredientsController.java
  3. 0 5
      sd-business/src/main/java/com/sd/business/entity/in/po/InOutStorage.java
  4. 0 10
      sd-business/src/main/java/com/sd/business/entity/in/vo/InOutStorageBomVo.java
  5. 17 0
      sd-business/src/main/java/com/sd/business/entity/inventory/dto/InventoryIngredientsDto.java
  6. 17 0
      sd-business/src/main/java/com/sd/business/entity/inventory/dto/InventoryIngredientsSelectDto.java
  7. 0 5
      sd-business/src/main/java/com/sd/business/entity/inventory/dto/InventorySelectDto.java
  8. 0 15
      sd-business/src/main/java/com/sd/business/entity/inventory/dto/QuantityByDepartmentDto.java
  9. 0 6
      sd-business/src/main/java/com/sd/business/entity/inventory/dto/QuantityDto.java
  10. 0 5
      sd-business/src/main/java/com/sd/business/entity/inventory/po/Inventory.java
  11. 0 5
      sd-business/src/main/java/com/sd/business/entity/inventory/po/InventoryBackup.java
  12. 38 0
      sd-business/src/main/java/com/sd/business/entity/inventory/po/InventoryIngredients.java
  13. 0 5
      sd-business/src/main/java/com/sd/business/entity/inventory/vo/InventoryBackupVo.java
  14. 17 0
      sd-business/src/main/java/com/sd/business/entity/inventory/vo/InventoryIngredientsVo.java
  15. 0 5
      sd-business/src/main/java/com/sd/business/entity/inventory/vo/InventoryVo.java
  16. 0 10
      sd-business/src/main/java/com/sd/business/entity/inventory/vo/QuantityByDepartmentVo.java
  17. 16 0
      sd-business/src/main/java/com/sd/business/mapper/inventory/InventoryIngredientsMapper.java
  18. 1 20
      sd-business/src/main/java/com/sd/business/service/in/impl/InOutStorageBomServiceImpl.java
  19. 46 0
      sd-business/src/main/java/com/sd/business/service/inventory/InventoryIngredientsService.java
  20. 0 7
      sd-business/src/main/java/com/sd/business/service/inventory/InventoryService.java
  21. 0 4
      sd-business/src/main/java/com/sd/business/service/inventory/impl/InventoryBackupServiceImpl.java
  22. 68 0
      sd-business/src/main/java/com/sd/business/service/inventory/impl/InventoryIngredientsServiceImpl.java
  23. 4 33
      sd-business/src/main/java/com/sd/business/service/inventory/impl/InventoryServiceImpl.java
  24. 0 5
      sd-business/src/main/java/com/sd/business/service/order/impl/OrderInfoServiceImpl.java
  25. 5 0
      sd-business/src/main/resources/mapper/inventory/InventoryIngredientsMapper.xml

+ 0 - 10
sd-business/src/main/java/com/sd/business/controller/inventory/InventoryController.java

@@ -3,11 +3,9 @@ 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.InventorySelectDto;
-import com.sd.business.entity.inventory.dto.QuantityByDepartmentDto;
 import com.sd.business.entity.inventory.dto.QuantityByWarehouseDto;
 import com.sd.business.entity.inventory.dto.QuantityDto;
 import com.sd.business.entity.inventory.vo.InventoryVo;
-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;
@@ -70,12 +68,4 @@ public class InventoryController {
         return inventoryService.getQuantityByWarehouse(dto);
     }
 
-    /**
-     * 根据事业部获取库存数量
-     */
-    @PostMapping("/getQuantityByDepartment")
-    public List<QuantityByDepartmentVo> getQuantityByDepartment(@RequestBody QuantityByDepartmentDto dto) {
-        return inventoryService.getQuantityByDepartment(dto);
-    }
-
 }

+ 71 - 0
sd-business/src/main/java/com/sd/business/controller/inventory/InventoryIngredientsController.java

@@ -0,0 +1,71 @@
+package com.sd.business.controller.inventory;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.sd.business.entity.inventory.dto.InventoryIngredientsDto;
+import com.sd.business.entity.inventory.dto.InventoryIngredientsSelectDto;
+import com.sd.business.entity.inventory.vo.InventoryIngredientsVo;
+import com.sd.business.service.inventory.InventoryIngredientsService;
+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;
+
+
+/**
+ * <p>
+ * 原料库存 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2024-01-08
+ */
+@RestController
+@RequestMapping("/inventoryIngredients")
+public class InventoryIngredientsController {
+
+    @Autowired
+    private InventoryIngredientsService inventoryIngredientsService;
+
+    /**
+     * 原料库存分页
+     */
+    @PostMapping("/page")
+    public Page<InventoryIngredientsVo> page(@RequestBody InventoryIngredientsSelectDto dto) {
+        return inventoryIngredientsService.getPage(dto);
+    }
+
+    /**
+     * 原料库存明细
+     */
+    @PostMapping("/detail")
+    public InventoryIngredientsVo detail(@RequestBody BaseSelectDto dto) {
+        return inventoryIngredientsService.detail(dto.getId());
+    }
+
+    /**
+     * 原料库存新增
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody InventoryIngredientsDto dto) {
+        inventoryIngredientsService.add(dto);
+    }
+
+    /**
+     * 原料库存编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody InventoryIngredientsDto dto) {
+        inventoryIngredientsService.edit(dto);
+    }
+
+    /**
+     * 原料库存删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        inventoryIngredientsService.delete(dto.getId());
+    }
+
+}

+ 0 - 5
sd-business/src/main/java/com/sd/business/entity/in/po/InOutStorage.java

@@ -46,11 +46,6 @@ public class InOutStorage extends BasePo {
     private Long warehouseId;
 
     /**
-     * 事业部id
-     */
-    private Long departmentId;
-
-    /**
      * 申请人
      */
     private String applicant;

+ 0 - 10
sd-business/src/main/java/com/sd/business/entity/in/vo/InOutStorageBomVo.java

@@ -52,16 +52,6 @@ public class InOutStorageBomVo extends InOutStorageBom {
     private String warehouseCode;
 
     /**
-     * 事业部id
-     */
-    private Long departmentId;
-
-    /**
-     * 事业部名称
-     */
-    private String departmentName;
-
-    /**
      * 采购单号
      */
     private String purchaseCode;

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/inventory/dto/InventoryIngredientsDto.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.inventory.dto;
+
+import com.sd.business.entity.inventory.po.InventoryIngredients;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 原料库存新增编辑入参实体
+ *
+ * @author
+ * @since 2024-01-08
+ */
+@Getter
+@Setter
+public class InventoryIngredientsDto extends InventoryIngredients {
+
+}

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/inventory/dto/InventoryIngredientsSelectDto.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.inventory.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 原料库存列表查询入参实体
+ *
+ * @author
+ * @since 2024-01-08
+ */
+@Getter
+@Setter
+public class InventoryIngredientsSelectDto extends BaseSelectDto {
+
+}

+ 0 - 5
sd-business/src/main/java/com/sd/business/entity/inventory/dto/InventorySelectDto.java

@@ -63,11 +63,6 @@ public class InventorySelectDto extends BaseSelectDto {
     private Long warehouseId;
 
     /**
-     * 事业部id
-     */
-    private Long departmentId;
-
-    /**
      * 仓库id列表
      */
     private List<Long> warehouseIdList;

+ 0 - 15
sd-business/src/main/java/com/sd/business/entity/inventory/dto/QuantityByDepartmentDto.java

@@ -1,15 +0,0 @@
-package com.sd.business.entity.inventory.dto;
-
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class QuantityByDepartmentDto {
-
-    /**
-     * 仓库id
-     */
-    private Long warehouseId;
-
-}

+ 0 - 6
sd-business/src/main/java/com/sd/business/entity/inventory/dto/QuantityDto.java

@@ -12,12 +12,6 @@ import java.util.List;
 public class QuantityDto {
 
     /**
-     * 事业部id
-     */
-    @NotNull(message = "事业部id不能为空")
-    private Long departmentId;
-
-    /**
      * 仓库id
      */
     @NotNull(message = "仓库id不能为空")

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

@@ -28,11 +28,6 @@ public class Inventory extends BasePo {
     private Long warehouseId;
 
     /**
-     * 事业部id
-     */
-    private Long departmentId;
-
-    /**
      * bom规格id
      */
     private Long bomSpecId;

+ 0 - 5
sd-business/src/main/java/com/sd/business/entity/inventory/po/InventoryBackup.java

@@ -34,11 +34,6 @@ public class InventoryBackup extends BasePo {
     private Long warehouseId;
 
     /**
-     * 事业部id
-     */
-    private Long departmentId;
-
-    /**
      * bom规格id
      */
     private Long bomSpecId;

+ 38 - 0
sd-business/src/main/java/com/sd/business/entity/inventory/po/InventoryIngredients.java

@@ -0,0 +1,38 @@
+package com.sd.business.entity.inventory.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * <p>
+ * 原料库存
+ * </p>
+ *
+ * @author
+ * @since 2024-01-08
+ */
+@Getter
+@Setter
+@TableName("inventory_ingredients")
+public class InventoryIngredients extends BasePo {
+
+    /**
+     * bom规格id
+     */
+    private Long bomSpecId;
+
+    /**
+     * 数量
+     */
+    private Long quantity;
+
+    /**
+     * 米数
+     */
+    private BigDecimal meter;
+
+}

+ 0 - 5
sd-business/src/main/java/com/sd/business/entity/inventory/vo/InventoryBackupVo.java

@@ -42,11 +42,6 @@ public class InventoryBackupVo extends InventoryBackup {
     private String bomSpecCode;
 
     /**
-     * 事业部名称
-     */
-    private String departmentName;
-
-    /**
      * 总库存
      */
     @ColumnWidth(15)

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/inventory/vo/InventoryIngredientsVo.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.inventory.vo;
+
+import com.sd.business.entity.inventory.po.InventoryIngredients;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 原料库存列表查询返回值实体
+ *
+ * @author
+ * @since 2024-01-08
+ */
+@Getter
+@Setter
+public class InventoryIngredientsVo extends InventoryIngredients {
+
+}

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

@@ -42,11 +42,6 @@ public class InventoryVo extends Inventory {
     private String bomSpecCode;
 
     /**
-     * 事业部名称
-     */
-    private String departmentName;
-
-    /**
      * 总库存
      */
     @ColumnWidth(15)

+ 0 - 10
sd-business/src/main/java/com/sd/business/entity/inventory/vo/QuantityByDepartmentVo.java

@@ -14,14 +14,4 @@ public class QuantityByDepartmentVo {
      */
     private BigDecimal inventoryQuantity;
 
-    /**
-     * 事业部id
-     */
-    private Long departmentId;
-
-    /**
-     * 事业部名称
-     */
-    private String departmentName;
-
 }

+ 16 - 0
sd-business/src/main/java/com/sd/business/mapper/inventory/InventoryIngredientsMapper.java

@@ -0,0 +1,16 @@
+package com.sd.business.mapper.inventory;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sd.business.entity.inventory.po.InventoryIngredients;
+
+/**
+ * <p>
+ * 原料库存 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2024-01-08
+ */
+public interface InventoryIngredientsMapper extends BaseMapper<InventoryIngredients> {
+
+}

+ 1 - 20
sd-business/src/main/java/com/sd/business/service/in/impl/InOutStorageBomServiceImpl.java

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.core.domain.BaseIdPo;
 import com.sd.business.entity.bom.po.BomSpec;
-import com.sd.business.entity.department.po.Department;
 import com.sd.business.entity.in.dto.InOutStorageBomSelectDto;
 import com.sd.business.entity.in.emums.InDetailTypeEnum;
 import com.sd.business.entity.in.emums.InOutTypeEnum;
@@ -58,10 +57,9 @@ public class InOutStorageBomServiceImpl extends ServiceImpl<InOutStorageBomMappe
     @Override
     public Page<InOutStorageBomVo> getPage(InOutStorageBomSelectDto dto) {
 
-        Page<InOutStorageBomVo> page = Sql.create(InOutStorageBomVo.class)
+        return Sql.create(InOutStorageBomVo.class)
                 .selectAll(InOutStorageBom.class)
                 .select(InOutStorage::getInOutStorageTime,
-                        InOutStorage::getDepartmentId,
                         InOutStorage::getType,
                         InOutStorage::getDetailType,
                         InOutStorage::getCode,
@@ -72,43 +70,26 @@ public class InOutStorageBomServiceImpl extends ServiceImpl<InOutStorageBomMappe
                 .selectAs(Warehouse::getType, InOutStorageBomVo::getWarehouseType)
                 .selectAs(Warehouse::getName, InOutStorageBomVo::getWarehouseName)
                 .selectAs(Warehouse::getCode, InOutStorageBomVo::getWarehouseCode)
-                .selectAs(Department::getName, InOutStorageBomVo::getDepartmentName)
                 .selectAs(Purchase::getCode, InOutStorageBomVo::getPurchaseCode)
 
                 .from(InOutStorageBom.class)
                 .leftJoin(InOutStorage.class, InOutStorageBom::getInOutStorageId)
                 .leftJoin(BomSpec.class, InOutStorageBom::getBomSpecId)
                 .leftJoin(Warehouse.class, InOutStorage::getWarehouseId)
-                .leftJoin(Department.class, InOutStorage::getDepartmentId)
                 .leftJoin(Purchase.class, InOutStorage::getPurchaseId)
 
                 .orderByDesc(InOutStorageBom::getId)
                 .like(InOutStorage::getCode, dto.getCode())
-                .eq(InOutStorage::getDepartmentId, dto.getDepartmentId())
                 .eq(InOutStorage::getType, dto.getType())
                 .eq(InOutStorage::getDetailType, dto.getDetailType())
                 .ge(InOutStorage::getInOutStorageTime, dto.getBeginTime())
                 .le(InOutStorage::getInOutStorageTime, dto.getEndTime())
                 .like(BomSpec::getCode, dto.getBomSpecCode())
                 .like(BomSpec::getName, dto.getBomSpecName())
-                .notIn(BomSpec::getCode, "40904003", "409001", "40101010") // 筛选吊牌、不干胶、彩纸出入库记录
                 .like(Purchase::getCode, dto.getPurchaseCode())
                 .eq(Warehouse::getId, dto.getWarehouseId())
 
                 .page(dto);
-
-        List<InOutStorageBomVo> records = page.getRecords();
-        if (records.isEmpty()) {
-            return page;
-        }
-
-        records.forEach(item -> {
-            if (item.getDepartmentId() == 0L) {
-                item.setDepartmentName("胜德体育");
-            }
-        });
-
-        return page;
     }
 
     @Override

+ 46 - 0
sd-business/src/main/java/com/sd/business/service/inventory/InventoryIngredientsService.java

@@ -0,0 +1,46 @@
+package com.sd.business.service.inventory;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.service.BaseService;
+import com.sd.business.entity.inventory.dto.InventoryIngredientsDto;
+import com.sd.business.entity.inventory.dto.InventoryIngredientsSelectDto;
+import com.sd.business.entity.inventory.po.InventoryIngredients;
+import com.sd.business.entity.inventory.vo.InventoryIngredientsVo;
+
+
+/**
+ * <p>
+ * 原料库存 服务类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-08
+ */
+public interface InventoryIngredientsService extends BaseService<InventoryIngredients> {
+
+    /**
+     * 原料库存分页
+     */
+    Page<InventoryIngredientsVo> getPage(InventoryIngredientsSelectDto dto);
+
+    /**
+     * 原料库存明细
+     */
+    InventoryIngredientsVo detail(Long id);
+
+    /**
+     * 原料库存新增
+     */
+    void add(InventoryIngredientsDto dto);
+
+    /**
+     * 原料库存编辑
+     */
+    void edit(InventoryIngredientsDto dto);
+
+    /**
+     * 原料库存删除
+     */
+    void delete(Long id);
+
+}

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

@@ -4,12 +4,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.service.BaseService;
 import com.sd.business.entity.in.dto.InOutStorageDto;
 import com.sd.business.entity.inventory.dto.InventorySelectDto;
-import com.sd.business.entity.inventory.dto.QuantityByDepartmentDto;
 import com.sd.business.entity.inventory.dto.QuantityByWarehouseDto;
 import com.sd.business.entity.inventory.dto.QuantityDto;
 import com.sd.business.entity.inventory.po.Inventory;
 import com.sd.business.entity.inventory.vo.InventoryVo;
-import com.sd.business.entity.inventory.vo.QuantityByDepartmentVo;
 import com.sd.business.entity.inventory.vo.QuantityByWarehouseVo;
 
 import java.math.BigDecimal;
@@ -48,11 +46,6 @@ public interface InventoryService extends BaseService<Inventory> {
     List<QuantityByWarehouseVo> getQuantityByWarehouse(QuantityByWarehouseDto dto);
 
     /**
-     * 根据事业部获取库存数量
-     */
-    List<QuantityByDepartmentVo> getQuantityByDepartment(QuantityByDepartmentDto dto);
-
-    /**
      * 入库逻辑
      */
     void in(InOutStorageDto dto);

+ 0 - 4
sd-business/src/main/java/com/sd/business/service/inventory/impl/InventoryBackupServiceImpl.java

@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 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.inventory.dto.InventoryBackupSelectDto;
 import com.sd.business.entity.inventory.dto.InventorySelectDto;
 import com.sd.business.entity.inventory.po.Inventory;
@@ -71,17 +70,14 @@ public class InventoryBackupServiceImpl extends ServiceImpl<InventoryBackupMappe
                 .selectAs(Warehouse::getName, InventoryBackupVo::getWarehouseName)
                 .selectAs(BomSpec::getCode, InventoryBackupVo::getBomSpecCode)
                 .selectAs(BomSpec::getName, InventoryBackupVo::getBomSpecName)
-                .selectAs(Department::getName, InventoryBackupVo::getDepartmentName)
 
                 .from(Inventory.class)
                 .leftJoin(BomSpec.class, Inventory::getBomSpecId)
                 .leftJoin(Bom.class, BomSpec::getBomId)
                 .leftJoin(Warehouse.class, Inventory::getWarehouseId)
-                .leftJoin(Department.class, Inventory::getDepartmentId)
 
                 .orderByDesc(Inventory::getId)
                 .eq(InventoryBackup::getBackupDate, DateUtil.offsetDay(dto.getBackupDate(), -1))
-                .eq(Inventory::getDepartmentId, dto.getDepartmentId())
                 .eq(Inventory::getWarehouseId, dto.getWarehouseId())
                 .in(Inventory::getWarehouseId, dto.getWarehouseIdList())
                 .like(BomSpec::getName, dto.getBomSpecName())

+ 68 - 0
sd-business/src/main/java/com/sd/business/service/inventory/impl/InventoryIngredientsServiceImpl.java

@@ -0,0 +1,68 @@
+package com.sd.business.service.inventory.impl;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.sd.business.entity.inventory.dto.InventoryIngredientsDto;
+import com.sd.business.entity.inventory.dto.InventoryIngredientsSelectDto;
+import com.sd.business.entity.inventory.po.InventoryIngredients;
+import com.sd.business.entity.inventory.vo.InventoryIngredientsVo;
+import com.sd.business.mapper.inventory.InventoryIngredientsMapper;
+import com.sd.business.service.inventory.InventoryIngredientsService;
+import com.sd.framework.util.Assert;
+import com.sd.framework.util.sql.Sql;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * 原料库存 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2024-01-08
+ */
+@Service
+public class InventoryIngredientsServiceImpl extends ServiceImpl<InventoryIngredientsMapper, InventoryIngredients> implements InventoryIngredientsService {
+
+    @Override
+    public Page<InventoryIngredientsVo> getPage(InventoryIngredientsSelectDto dto) {
+
+        Page<InventoryIngredientsVo> page = Sql.create(InventoryIngredientsVo.class)
+                .selectAll(InventoryIngredients.class)
+                .from(InventoryIngredients.class)
+                .orderByDesc(InventoryIngredients::getId)
+                .page(dto);
+
+        return page;
+    }
+
+    @Override
+    public InventoryIngredientsVo detail(Long id) {
+
+        InventoryIngredientsVo vo = Sql.create(InventoryIngredientsVo.class)
+                .selectAll(InventoryIngredients.class)
+                .from(InventoryIngredients.class)
+                .eq(InventoryIngredients::getId, id)
+                .one();
+
+        Assert.notNull(vo, "未知数据");
+
+        return vo;
+    }
+
+    @Override
+    public void add(InventoryIngredientsDto dto) {
+        save(dto);
+    }
+
+    @Override
+    public void edit(InventoryIngredientsDto dto) {
+        updateById(dto);
+    }
+
+    @Override
+    public void delete(Long id) {
+        removeById(id);
+    }
+
+}

+ 4 - 33
sd-business/src/main/java/com/sd/business/service/inventory/impl/InventoryServiceImpl.java

@@ -6,17 +6,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.exception.ServiceException;
 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.po.InOutStorageBom;
 import com.sd.business.entity.inventory.bo.InOutFun;
 import com.sd.business.entity.inventory.dto.InventorySelectDto;
-import com.sd.business.entity.inventory.dto.QuantityByDepartmentDto;
 import com.sd.business.entity.inventory.dto.QuantityByWarehouseDto;
 import com.sd.business.entity.inventory.dto.QuantityDto;
 import com.sd.business.entity.inventory.po.Inventory;
 import com.sd.business.entity.inventory.vo.InventoryVo;
-import com.sd.business.entity.inventory.vo.QuantityByDepartmentVo;
 import com.sd.business.entity.inventory.vo.QuantityByWarehouseVo;
 import com.sd.business.entity.warehouse.po.Warehouse;
 import com.sd.business.mapper.inventory.InventoryMapper;
@@ -61,15 +58,12 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
                 .selectAs(Warehouse::getName, InventoryVo::getWarehouseName)
                 .selectAs(BomSpec::getCode, InventoryVo::getBomSpecCode)
                 .selectAs(BomSpec::getName, InventoryVo::getBomSpecName)
-                .selectAs(Department::getName, InventoryVo::getDepartmentName)
 
                 .from(Inventory.class)
                 .leftJoin(BomSpec.class, Inventory::getBomSpecId)
                 .leftJoin(Bom.class, BomSpec::getBomId)
                 .leftJoin(Warehouse.class, Inventory::getWarehouseId)
-                .leftJoin(Department.class, Inventory::getDepartmentId)
 
-                .eq(Inventory::getDepartmentId, dto.getDepartmentId())
                 .eq(Inventory::getWarehouseId, dto.getWarehouseId())
                 .in(Inventory::getWarehouseId, dto.getWarehouseIdList())
                 .like(BomSpec::getName, dto.getBomSpecName())
@@ -95,7 +89,6 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
     public Map<Long, BigDecimal> getQuantity(QuantityDto dto) {
         return mapKV(Inventory::getBomSpecId, Inventory::getQuantity, q -> q
                 .eq(Inventory::getWarehouseId, dto.getWarehouseId())
-                .eq(Inventory::getDepartmentId, dto.getDepartmentId())
                 .in(Inventory::getBomSpecId, dto.getBomSpecIdList()));
     }
 
@@ -110,40 +103,21 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
                 .from(Inventory.class)
                 .innerJoin(Warehouse.class, Warehouse::getId, Inventory::getId)
 
-                .eq(Inventory::getDepartmentId, dto.getDepartmentId())
                 .groupBy(Warehouse::getId)
                 .orderByAsc(Warehouse::getId)
                 .list();
     }
 
     @Override
-    public List<QuantityByDepartmentVo> getQuantityByDepartment(QuantityByDepartmentDto dto) {
-
-        return Sql.create(QuantityByDepartmentVo.class)
-                .sum(Inventory::getQuantity, QuantityByDepartmentVo::getInventoryQuantity)
-                .selectAs(Department::getId, QuantityByDepartmentVo::getDepartmentId)
-                .selectAs(Department::getName, QuantityByDepartmentVo::getDepartmentName)
-
-                .from(Inventory.class)
-                .innerJoin(Department.class, Department::getId, Inventory::getDepartmentId)
-
-                .eq(Inventory::getWarehouseId, dto.getWarehouseId())
-                .groupBy(Department::getId)
-                .orderByAsc(Department::getId)
-                .list();
-    }
-
-    @Override
     public void in(InOutStorageDto dto) {
         List<InOutStorageBom> list = dto.getInOutStorageBomList();
-        Long departmentId = dto.getDepartmentId();
         Long warehouseId = dto.getWarehouseId();
 
         List<Long> bomSpecIdList = list.stream().map(InOutFun::getBomSpecId).collect(Collectors.toList());
 
         synchronized (this) {
             // 通过事业部id和出库id获取bom规格库存
-            List<Inventory> inventoryList = getInventoryList(departmentId, warehouseId, bomSpecIdList);
+            List<Inventory> inventoryList = getInventoryList(warehouseId, bomSpecIdList);
 
             // 通过bom规格分组
             Map<Long, Inventory> map = inventoryList.stream().collect(Collectors.toMap(Inventory::getBomSpecId, Function.identity()));
@@ -153,7 +127,6 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
                 Inventory inventory = map.computeIfAbsent(inOutFun.getBomSpecId(), item -> {
                     Inventory tempInventory = new Inventory();
                     tempInventory.setWarehouseId(warehouseId);
-                    tempInventory.setDepartmentId(departmentId);
                     tempInventory.setBomSpecId(item);
                     tempInventory.setQuantity(BigDecimal.ZERO);
                     return tempInventory;
@@ -168,7 +141,6 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
     @Override
     public void out(InOutStorageDto dto) {
         List<InOutStorageBom> list = dto.getInOutStorageBomList();
-        Long departmentId = dto.getDepartmentId();
         Long warehouseId = dto.getWarehouseId();
 
         List<Long> bomSpecIdList = list.stream().map(InOutFun::getBomSpecId).collect(Collectors.toList());
@@ -176,7 +148,7 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
         synchronized (this) {
 
             // 通过事业部id和出库id获取bom规格库存
-            List<Inventory> inventoryList = getInventoryList(departmentId, warehouseId, bomSpecIdList);
+            List<Inventory> inventoryList = getInventoryList(warehouseId, bomSpecIdList);
             Map<Long, Inventory> map = inventoryList.stream().collect(Collectors.toMap(Inventory::getBomSpecId, Function.identity()));
 
             for (InOutFun inOutFun : list) {
@@ -202,11 +174,10 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
     }
 
     /**
-     * 通过事业部id和出库id获取bom规格库存
+     * 通过库id获取bom规格库存
      */
-    private List<Inventory> getInventoryList(Long departmentId, Long warehouseId, List<Long> bomSpecIdList) {
+    private List<Inventory> getInventoryList(Long warehouseId, List<Long> bomSpecIdList) {
         return list(q -> q
-                .eq(Inventory::getDepartmentId, departmentId)
                 .eq(Inventory::getWarehouseId, warehouseId)
                 .in(Inventory::getBomSpecId, bomSpecIdList)
         );

+ 0 - 5
sd-business/src/main/java/com/sd/business/service/order/impl/OrderInfoServiceImpl.java

@@ -21,7 +21,6 @@ import com.ruoyi.system.service.ISysUserService;
 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.constant.DepartmentConstant;
 import com.sd.business.entity.department.po.Department;
 import com.sd.business.entity.in.dto.InOutStorageDto;
 import com.sd.business.entity.in.emums.InDetailTypeEnum;
@@ -1120,7 +1119,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
         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.getCode()
                 + (StrUtil.isBlank(orderInfo.getWlnCode()) ? StringPool.EMPTY : "(" + orderInfo.getWlnCode() + ")")
@@ -1147,7 +1145,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
         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.getCode()
                 + (StrUtil.isBlank(orderInfo.getWlnCode()) ? StringPool.EMPTY : "(" + orderInfo.getWlnCode() + ")")
@@ -1230,7 +1227,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
             inOutStorageDto.setType(InOutTypeEnum.OUT.getKey());
             inOutStorageDto.setDetailType(OutDetailTypeEnum.PRODUCTION.getKey());
             inOutStorageDto.setWarehouseId(WarehouseConstant.PACKAGING_MATERIAL);
-            inOutStorageDto.setDepartmentId(DepartmentConstant.SD_SPORTS);
             inOutStorageDto.setApplicant(SecurityUtils.getLoginUser().getUser().getNickName());
             inOutStorageDto.setInOutStorageBomList(outStorageBomList);
             inOutStorageService.add(inOutStorageDto);
@@ -1250,7 +1246,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
             packagingMaterialInOutStorageDto.setType(InOutTypeEnum.IN.getKey());
             packagingMaterialInOutStorageDto.setDetailType(InDetailTypeEnum.RETURN_GOODS.getKey());
             packagingMaterialInOutStorageDto.setWarehouseId(WarehouseConstant.PACKAGING_MATERIAL);
-            packagingMaterialInOutStorageDto.setDepartmentId(DepartmentConstant.SD_SPORTS);
             packagingMaterialInOutStorageDto.setApplicant(SecurityUtils.getLoginUser().getUser().getNickName());
             packagingMaterialInOutStorageDto.setRemark("订单产品快递包装修改:" + dto.getCode()
                     + (StrUtil.isBlank(dto.getWlnCode()) ? StringPool.EMPTY : "(" + dto.getWlnCode() + ")")

+ 5 - 0
sd-business/src/main/resources/mapper/inventory/InventoryIngredientsMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sd.business.mapper.inventory.InventoryIngredientsMapper">
+
+</mapper>