Browse Source

Merge remote-tracking branch 'origin/master'

王董 1 year ago
parent
commit
0814f083d6
51 changed files with 2032 additions and 11 deletions
  1. 71 0
      sd-business/src/main/java/com/sd/business/controller/in/InOutStorageBomController.java
  2. 82 0
      sd-business/src/main/java/com/sd/business/controller/in/InOutStorageController.java
  3. 60 0
      sd-business/src/main/java/com/sd/business/controller/inventory/InventoryBackupController.java
  4. 2 1
      sd-business/src/main/java/com/sd/business/controller/inventory/InventoryController.java
  5. 71 0
      sd-business/src/main/java/com/sd/business/controller/purchase/PurchaseController.java
  6. 50 0
      sd-business/src/main/java/com/sd/business/entity/in/dto/AddAllotDto.java
  7. 17 0
      sd-business/src/main/java/com/sd/business/entity/in/dto/InOutStorageBomDto.java
  8. 52 0
      sd-business/src/main/java/com/sd/business/entity/in/dto/InOutStorageBomSelectDto.java
  9. 26 0
      sd-business/src/main/java/com/sd/business/entity/in/dto/InOutStorageDto.java
  10. 45 0
      sd-business/src/main/java/com/sd/business/entity/in/dto/InOutStorageSelectDto.java
  11. 43 0
      sd-business/src/main/java/com/sd/business/entity/in/emums/InDetailTypeEnum.java
  12. 36 0
      sd-business/src/main/java/com/sd/business/entity/in/emums/InOutTypeEnum.java
  13. 43 0
      sd-business/src/main/java/com/sd/business/entity/in/emums/OutDetailTypeEnum.java
  14. 74 0
      sd-business/src/main/java/com/sd/business/entity/in/po/InOutStorage.java
  15. 44 0
      sd-business/src/main/java/com/sd/business/entity/in/po/InOutStorageBom.java
  16. 62 0
      sd-business/src/main/java/com/sd/business/entity/in/vo/InOutStorageBomVo.java
  17. 37 0
      sd-business/src/main/java/com/sd/business/entity/in/vo/InOutStorageVo.java
  18. 17 0
      sd-business/src/main/java/com/sd/business/entity/inventory/bo/InOutFun.java
  19. 17 0
      sd-business/src/main/java/com/sd/business/entity/inventory/dto/InventoryBackupDto.java
  20. 17 0
      sd-business/src/main/java/com/sd/business/entity/inventory/dto/InventoryBackupSelectDto.java
  21. 6 0
      sd-business/src/main/java/com/sd/business/entity/inventory/dto/InventorySelectDto.java
  22. 5 5
      sd-business/src/main/java/com/sd/business/entity/inventory/po/Inventory.java
  23. 59 0
      sd-business/src/main/java/com/sd/business/entity/inventory/po/InventoryBackup.java
  24. 28 0
      sd-business/src/main/java/com/sd/business/entity/inventory/vo/InventoryBackupVo.java
  25. 17 0
      sd-business/src/main/java/com/sd/business/entity/purchase/dto/PurchaseDto.java
  26. 17 0
      sd-business/src/main/java/com/sd/business/entity/purchase/dto/PurchaseSelectDto.java
  27. 174 0
      sd-business/src/main/java/com/sd/business/entity/purchase/po/Purchase.java
  28. 17 0
      sd-business/src/main/java/com/sd/business/entity/purchase/vo/PurchaseVo.java
  29. 26 0
      sd-business/src/main/java/com/sd/business/mapper/in/InOutStorageBomMapper.java
  30. 26 0
      sd-business/src/main/java/com/sd/business/mapper/in/InOutStorageMapper.java
  31. 23 0
      sd-business/src/main/java/com/sd/business/mapper/inventory/InventoryBackupMapper.java
  32. 3 1
      sd-business/src/main/java/com/sd/business/mapper/inventory/InventoryMapper.java
  33. 26 0
      sd-business/src/main/java/com/sd/business/mapper/purchase/PurchaseMapper.java
  34. 23 0
      sd-business/src/main/java/com/sd/business/scheduled/InventoryBackupTask.java
  35. 46 0
      sd-business/src/main/java/com/sd/business/service/in/InOutStorageBomService.java
  36. 52 0
      sd-business/src/main/java/com/sd/business/service/in/InOutStorageService.java
  37. 71 0
      sd-business/src/main/java/com/sd/business/service/in/impl/InOutStorageBomServiceImpl.java
  38. 124 0
      sd-business/src/main/java/com/sd/business/service/in/impl/InOutStorageServiceImpl.java
  39. 24 0
      sd-business/src/main/java/com/sd/business/service/inventory/InventoryBackupService.java
  40. 20 1
      sd-business/src/main/java/com/sd/business/service/inventory/InventoryService.java
  41. 76 0
      sd-business/src/main/java/com/sd/business/service/inventory/impl/InventoryBackupServiceImpl.java
  42. 80 2
      sd-business/src/main/java/com/sd/business/service/inventory/impl/InventoryServiceImpl.java
  43. 46 0
      sd-business/src/main/java/com/sd/business/service/purchase/PurchaseService.java
  44. 57 0
      sd-business/src/main/java/com/sd/business/service/purchase/impl/PurchaseServiceImpl.java
  45. 5 0
      sd-business/src/main/java/com/sd/business/util/CodeEnum.java
  46. 29 0
      sd-business/src/main/resources/mapper/in/InOutStorageBomMapper.xml
  47. 29 0
      sd-business/src/main/resources/mapper/in/InOutStorageMapper.xml
  48. 10 0
      sd-business/src/main/resources/mapper/inventory/InventoryBackupMapper.xml
  49. 1 1
      sd-business/src/main/resources/mapper/inventory/InventoryMapper.xml
  50. 44 0
      sd-business/src/main/resources/mapper/purchase/PurchaseMapper.xml
  51. 2 0
      sd-starter/src/main/java/com/sd/SdApplication.java

+ 71 - 0
sd-business/src/main/java/com/sd/business/controller/in/InOutStorageBomController.java

@@ -0,0 +1,71 @@
+package com.sd.business.controller.in;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.sd.business.entity.in.dto.InOutStorageBomDto;
+import com.sd.business.entity.in.dto.InOutStorageBomSelectDto;
+import com.sd.business.entity.in.vo.InOutStorageBomVo;
+import com.sd.business.service.in.InOutStorageBomService;
+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>
+ * 出入库bom 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@RestController
+@RequestMapping("/inOutStorageBom")
+public class InOutStorageBomController {
+
+    @Autowired
+    private InOutStorageBomService inOutStorageBomService;
+
+    /**
+     * 出入库bom分页
+     */
+    @PostMapping("/page")
+    public Page<InOutStorageBomVo> page(@RequestBody InOutStorageBomSelectDto dto) {
+        return inOutStorageBomService.getPage(dto);
+    }
+
+    /**
+     * 出入库bom明细
+     */
+    @PostMapping("/detail")
+    public InOutStorageBomVo detail(@RequestBody BaseSelectDto dto) {
+        return inOutStorageBomService.detail(dto.getId());
+    }
+
+    /**
+     * 出入库bom新增
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody InOutStorageBomDto inOutStorageBomDto) {
+        inOutStorageBomService.add(inOutStorageBomDto);
+    }
+
+    /**
+     * 出入库bom编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody InOutStorageBomDto inOutStorageBomDto) {
+        inOutStorageBomService.edit(inOutStorageBomDto);
+    }
+
+    /**
+     * 出入库bom删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        inOutStorageBomService.delete(dto.getId());
+    }
+
+}

+ 82 - 0
sd-business/src/main/java/com/sd/business/controller/in/InOutStorageController.java

@@ -0,0 +1,82 @@
+package com.sd.business.controller.in;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.sd.business.entity.in.dto.AddAllotDto;
+import com.sd.business.entity.in.dto.InOutStorageDto;
+import com.sd.business.entity.in.dto.InOutStorageSelectDto;
+import com.sd.business.entity.in.vo.InOutStorageVo;
+import com.sd.business.service.in.InOutStorageService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+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 2023-07-03
+ */
+@RestController
+@RequestMapping("/inOutStorage")
+public class InOutStorageController {
+
+    @Autowired
+    private InOutStorageService inOutStorageService;
+
+    /**
+     * 出入库分页
+     */
+    @PostMapping("/page")
+    public Page<InOutStorageVo> page(@Validated @RequestBody InOutStorageSelectDto dto) {
+        return inOutStorageService.getPage(dto);
+    }
+
+    /**
+     * 出入库明细
+     */
+    @PostMapping("/detail")
+    public InOutStorageVo detail(@RequestBody BaseSelectDto dto) {
+        return inOutStorageService.detail(dto.getId());
+    }
+
+    /**
+     * 出入库新增
+     */
+    @PostMapping("/add")
+    public void add(@Validated @RequestBody InOutStorageDto inOutStorageDto) {
+        inOutStorageDto.setAllotFlag(null);
+        inOutStorageService.add(inOutStorageDto);
+    }
+
+    /**
+     * 调拨入库
+     */
+    @PostMapping("/addAllot")
+    public void addAllot(@Validated @RequestBody AddAllotDto dto) {
+        inOutStorageService.addAllot(dto);
+    }
+
+    /**
+     * 出入库编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody InOutStorageDto inOutStorageDto) {
+        inOutStorageService.edit(inOutStorageDto);
+    }
+
+    /**
+     * 出入库删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        inOutStorageService.delete(dto.getId());
+    }
+
+}

+ 60 - 0
sd-business/src/main/java/com/sd/business/controller/inventory/InventoryBackupController.java

@@ -0,0 +1,60 @@
+package com.sd.business.controller.inventory;
+
+import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.exception.ServiceException;
+import com.sd.business.entity.inventory.dto.InventorySelectDto;
+import com.sd.business.entity.inventory.vo.InventoryBackupVo;
+import com.sd.business.entity.inventory.vo.InventoryVo;
+import com.sd.business.service.inventory.InventoryBackupService;
+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 java.util.Date;
+
+
+/**
+ * <p>
+ * 库存快照 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@RestController
+@RequestMapping("/inventoryBackup")
+public class InventoryBackupController {
+
+    @Autowired
+    private InventoryBackupService inventoryBackupService;
+
+    @Autowired
+    private InventoryService inventoryService;
+
+    /**
+     * 库存分页
+     */
+    @PostMapping("/page")
+    public Page<InventoryBackupVo> page(@RequestBody InventorySelectDto dto) {
+        return inventoryBackupService.getPage(dto);
+    }
+
+    /**
+     * 库存分页
+     */
+    @PostMapping("/detailPage")
+    public Page<InventoryVo> detailPage(@RequestBody InventorySelectDto dto) {
+        Date backupDate = dto.getBackupDate();
+        if (backupDate == null) {
+            throw new ServiceException("备份日期不能为空");
+        }
+
+        dto.setBackupDate(DateUtil.offsetDay(backupDate, -1));
+        return inventoryService.getPage(dto, "inventory_backup");
+    }
+
+}

+ 2 - 1
sd-business/src/main/java/com/sd/business/controller/inventory/InventoryController.java

@@ -35,7 +35,8 @@ public class InventoryController {
      */
     @PostMapping("/page")
     public Page<InventoryVo> page(@RequestBody InventorySelectDto dto) {
-        return inventoryService.getPage(dto);
+        dto.setBackupDate(null);
+        return inventoryService.getPage(dto, "inventory");
     }
 
     /**

+ 71 - 0
sd-business/src/main/java/com/sd/business/controller/purchase/PurchaseController.java

@@ -0,0 +1,71 @@
+package com.sd.business.controller.purchase;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.sd.business.entity.purchase.dto.PurchaseDto;
+import com.sd.business.entity.purchase.dto.PurchaseSelectDto;
+import com.sd.business.entity.purchase.vo.PurchaseVo;
+import com.sd.business.service.purchase.PurchaseService;
+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 2023-07-03
+ */
+@RestController
+@RequestMapping("/purchase")
+public class PurchaseController {
+
+    @Autowired
+    private PurchaseService purchaseService;
+
+    /**
+     * 采购合同分页
+     */
+    @PostMapping("/page")
+    public Page<PurchaseVo> page(@RequestBody PurchaseSelectDto dto) {
+        return purchaseService.getPage(dto);
+    }
+
+    /**
+     * 采购合同明细
+     */
+    @PostMapping("/detail")
+    public PurchaseVo detail(@RequestBody BaseSelectDto dto) {
+        return purchaseService.detail(dto.getId());
+    }
+
+    /**
+     * 采购合同新增
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody PurchaseDto purchaseDto) {
+        purchaseService.add(purchaseDto);
+    }
+
+    /**
+     * 采购合同编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody PurchaseDto purchaseDto) {
+        purchaseService.edit(purchaseDto);
+    }
+
+    /**
+     * 采购合同删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        purchaseService.delete(dto.getId());
+    }
+
+}

+ 50 - 0
sd-business/src/main/java/com/sd/business/entity/in/dto/AddAllotDto.java

@@ -0,0 +1,50 @@
+package com.sd.business.entity.in.dto;
+
+import com.sd.business.entity.in.po.InOutStorageBom;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.List;
+
+@Getter
+@Setter
+public class AddAllotDto {
+
+    /**
+     * 调入仓库id
+     */
+    @NotNull(message = "调入仓库id不能为空")
+    private Long inWarehouseId;
+
+    /**
+     * 调出仓库id
+     */
+    @NotNull(message = "调出仓库id不能为空")
+    private Long outWarehouseId;
+
+    /**
+     * 事业部id
+     */
+    @NotNull(message = "事业部id不能为空")
+    private Long departmentId;
+
+    /**
+     * 申请人
+     */
+    @NotBlank(message = "申请人不能为空")
+    private String applicant;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    @Valid
+    @NotEmpty(message = "物料信息不能为空")
+    private List<InOutStorageBom> inOutStorageBomList;
+
+}

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/in/dto/InOutStorageBomDto.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.in.dto;
+
+import com.sd.business.entity.in.po.InOutStorageBom;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 出入库bom新增编辑入参实体
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+public class InOutStorageBomDto extends InOutStorageBom {
+
+}

+ 52 - 0
sd-business/src/main/java/com/sd/business/entity/in/dto/InOutStorageBomSelectDto.java

@@ -0,0 +1,52 @@
+package com.sd.business.entity.in.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 出入库bom列表查询入参实体
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+public class InOutStorageBomSelectDto extends BaseSelectDto {
+
+    /**
+     * 出入库单号
+     */
+    private String code;
+
+    /**
+     * 采购单号
+     */
+    private String purchaseCode;
+
+    /**
+     * 产品规格品号
+     */
+    private String bomSpecCode;
+
+    /**
+     * 产品规格品名
+     */
+    private String bomSpecName;
+
+    /**
+     * 事业部id
+     */
+    private Long departmentId;
+
+    /**
+     * 仓库名称
+     */
+    private String warehouseName;
+
+    /**
+     * 出入库明细
+     */
+    private Integer detailType;
+
+}

+ 26 - 0
sd-business/src/main/java/com/sd/business/entity/in/dto/InOutStorageDto.java

@@ -0,0 +1,26 @@
+package com.sd.business.entity.in.dto;
+
+import com.sd.business.entity.in.po.InOutStorage;
+import com.sd.business.entity.in.po.InOutStorageBom;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotEmpty;
+import java.util.List;
+
+/**
+ * 出入库新增编辑入参实体
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+public class InOutStorageDto extends InOutStorage {
+
+    @Valid
+    @NotEmpty(message = "物料信息不能为空")
+    private List<InOutStorageBom> inOutStorageBomList;
+
+}

+ 45 - 0
sd-business/src/main/java/com/sd/business/entity/in/dto/InOutStorageSelectDto.java

@@ -0,0 +1,45 @@
+package com.sd.business.entity.in.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * 出入库列表查询入参实体
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+public class InOutStorageSelectDto extends BaseSelectDto {
+
+    /**
+     * 类型 1入库 0出库
+     */
+    @NotNull(message = "出入库类型不能为空")
+    private Integer type;
+
+    /**
+     * 出入库单号
+     */
+    private String code;
+
+    /**
+     * 事业部id
+     */
+    private Long departmentId;
+
+    /**
+     * 仓库名称
+     */
+    private String warehouseName;
+
+    /**
+     * 出入库明细
+     */
+    private Integer detailType;
+
+}

+ 43 - 0
sd-business/src/main/java/com/sd/business/entity/in/emums/InDetailTypeEnum.java

@@ -0,0 +1,43 @@
+package com.sd.business.entity.in.emums;
+
+import com.ruoyi.common.exception.ServiceException;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Getter
+@AllArgsConstructor
+public enum InDetailTypeEnum {
+
+    PURCHASE(1, "采购入库"),
+    PRODUCTION(2, "生产入库"),
+    RETURN_GOODS(3, "退货入库"),
+    GIVE_BACK(4, "归还入库"),
+    ALLOT(5, "调拨入库"),
+    OTHER(6, "其他入库"),
+    ABANDON(7, "废弃入库"),
+    CHECK(8, "盘点修正"),
+    ;
+
+    private static final Map<Integer, InDetailTypeEnum> map = new HashMap<>();
+
+    static {
+        for (InDetailTypeEnum inDetailTypeEnum : InDetailTypeEnum.values()) {
+            map.put(inDetailTypeEnum.getKey(), inDetailTypeEnum);
+        }
+    }
+
+    private final Integer key;
+    private final String value;
+
+    public static InDetailTypeEnum getInDetailType(Integer key) {
+        InDetailTypeEnum inDetailTypeEnum = map.get(key);
+        if (inDetailTypeEnum == null) {
+            throw new ServiceException("未知出入库类型");
+        }
+        return inDetailTypeEnum;
+    }
+
+}

+ 36 - 0
sd-business/src/main/java/com/sd/business/entity/in/emums/InOutTypeEnum.java

@@ -0,0 +1,36 @@
+package com.sd.business.entity.in.emums;
+
+import com.ruoyi.common.exception.ServiceException;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Getter
+@AllArgsConstructor
+public enum InOutTypeEnum {
+
+    IN(1, "入库"),
+    OUT(0, "出库");
+
+    private static final Map<Integer, InOutTypeEnum> map = new HashMap<>();
+
+    static {
+        for (InOutTypeEnum inOutTypeEnum : InOutTypeEnum.values()) {
+            map.put(inOutTypeEnum.getKey(), inOutTypeEnum);
+        }
+    }
+
+    private final Integer key;
+    private final String value;
+
+    public static InOutTypeEnum getInOutType(Integer key) {
+        InOutTypeEnum inOutTypeEnum = map.get(key);
+        if (inOutTypeEnum == null) {
+            throw new ServiceException("未知出入库类型");
+        }
+        return inOutTypeEnum;
+    }
+
+}

+ 43 - 0
sd-business/src/main/java/com/sd/business/entity/in/emums/OutDetailTypeEnum.java

@@ -0,0 +1,43 @@
+package com.sd.business.entity.in.emums;
+
+import com.ruoyi.common.exception.ServiceException;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Getter
+@AllArgsConstructor
+public enum OutDetailTypeEnum {
+
+    PRODUCTION(1, "生产出库"),
+    SELL(2, "销售出库"),
+    ALLOT(3, "调拨出库"),
+    INVENTORY_LOSS(4, "盘亏出库"),
+    HELP_ONESELF(5, "自用出库"),
+    OTHER(6, "其他出库"),
+    CHECK(7, "盘点修正"),
+    PURCHASE(8, "采购退货"),
+    ;
+
+    private static final Map<Integer, OutDetailTypeEnum> map = new HashMap<>();
+
+    static {
+        for (OutDetailTypeEnum outDetailTypeEnum : OutDetailTypeEnum.values()) {
+            map.put(outDetailTypeEnum.getKey(), outDetailTypeEnum);
+        }
+    }
+
+    private final Integer key;
+    private final String value;
+
+    public static OutDetailTypeEnum getOutDetailType(Integer key) {
+        OutDetailTypeEnum outDetailTypeEnum = map.get(key);
+        if (outDetailTypeEnum == null) {
+            throw new ServiceException("未知出入库类型");
+        }
+        return outDetailTypeEnum;
+    }
+
+}

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

@@ -0,0 +1,74 @@
+package com.sd.business.entity.in.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * <p>
+ * 出入库
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+@TableName("in_out_storage")
+public class InOutStorage extends BasePo {
+
+    /**
+     * 类型 1入库 0出库
+     */
+    @NotNull(message = "出入库类型不能为空")
+    private Integer type;
+
+    /**
+     * 出入库明细
+     */
+    @NotNull(message = "出入库明细类型不能为空")
+    private Integer detailType;
+
+    /**
+     * 出入库单号
+     */
+    private String code;
+
+    /**
+     * 采购合同id
+     */
+    private Long purchaseId;
+
+    /**
+     * 仓库id
+     */
+    @NotNull(message = "仓库id不能为空")
+    private Long warehouseId;
+
+    /**
+     * 事业部id
+     */
+    @NotNull(message = "事业部id不能为空")
+    private Long departmentId;
+
+    /**
+     * 申请人
+     */
+    @NotBlank(message = "申请人不能为空")
+    private String applicant;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 调仓标记
+     */
+    private Long allotFlag;
+
+}

+ 44 - 0
sd-business/src/main/java/com/sd/business/entity/in/po/InOutStorageBom.java

@@ -0,0 +1,44 @@
+package com.sd.business.entity.in.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import com.sd.business.entity.inventory.bo.InOutFun;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.DecimalMin;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+/**
+ * <p>
+ * 出入库bom
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+@TableName("in_out_storage_bom")
+public class InOutStorageBom extends BasePo implements InOutFun {
+
+    /**
+     * 出入库id
+     */
+    private Long inOutStorageId;
+
+    /**
+     * bom规格id
+     */
+    @NotNull(message = "bom规格id不能为空")
+    private Long bomSpecId;
+
+    /**
+     * 数量
+     */
+    @NotNull(message = "出入库数量不能为空")
+    @DecimalMin(value = "0.01", message = "出入库数量必须大于0")
+    private BigDecimal quantity;
+
+}

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

@@ -0,0 +1,62 @@
+package com.sd.business.entity.in.vo;
+
+import com.sd.business.entity.in.po.InOutStorageBom;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 出入库bom列表查询返回值实体
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+public class InOutStorageBomVo extends InOutStorageBom {
+
+    /**
+     * 出入库明细
+     */
+    private Integer detailType;
+
+    /**
+     * 出入库单号
+     */
+    private String code;
+
+    /**
+     * 申请人
+     */
+    private String applicant;
+
+    /**
+     * 仓库类型 字典:warehouse_type
+     */
+    private String warehouseType;
+
+    /**
+     * 仓库名称
+     */
+    private String warehouseName;
+
+    /**
+     * 事业部名称
+     */
+    private String departmentName;
+
+    /**
+     * 采购单号
+     */
+    private String purchaseCode;
+
+    /**
+     * 产品规格品号
+     */
+    private String bomSpecCode;
+
+    /**
+     * 产品规格品名
+     */
+    private String bomSpecName;
+
+}

+ 37 - 0
sd-business/src/main/java/com/sd/business/entity/in/vo/InOutStorageVo.java

@@ -0,0 +1,37 @@
+package com.sd.business.entity.in.vo;
+
+import com.sd.business.entity.in.po.InOutStorage;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 出入库列表查询返回值实体
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+public class InOutStorageVo extends InOutStorage {
+
+    /**
+     * 仓库类型 字典:warehouse_type
+     */
+    private String warehouseType;
+
+    /**
+     * 仓库名称
+     */
+    private String warehouseName;
+
+    /**
+     * 事业部名称
+     */
+    private String departmentName;
+
+    /**
+     * 采购单号
+     */
+    private String purchaseCode;
+
+}

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/inventory/bo/InOutFun.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.inventory.bo;
+
+import java.math.BigDecimal;
+
+public interface InOutFun {
+
+    /**
+     * 出入库产品规格id
+     */
+    Long getBomSpecId();
+
+    /**
+     * 出入库数量
+     */
+    BigDecimal getQuantity();
+
+}

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

@@ -0,0 +1,17 @@
+package com.sd.business.entity.inventory.dto;
+
+import com.sd.business.entity.inventory.po.InventoryBackup;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 库存快照新增编辑入参实体
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+public class InventoryBackupDto extends InventoryBackup {
+
+}

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/inventory/dto/InventoryBackupSelectDto.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 2023-07-03
+ */
+@Getter
+@Setter
+public class InventoryBackupSelectDto extends BaseSelectDto {
+
+}

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

@@ -5,6 +5,7 @@ import lombok.Getter;
 import lombok.Setter;
 
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * 库存列表查询入参实体
@@ -81,4 +82,9 @@ public class InventorySelectDto extends BaseSelectDto {
      */
     private Long departmentId;
 
+    /**
+     * 备份日期
+     */
+    private Date backupDate;
+
 }

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

@@ -31,6 +31,11 @@ public class Inventory extends BasePo {
     private Long bomSpecId;
 
     /**
+     * 事业部id
+     */
+    private Long departmentId;
+
+    /**
      * 结存单价
      */
     private BigDecimal balanceUnitPrice;
@@ -40,9 +45,4 @@ public class Inventory extends BasePo {
      */
     private BigDecimal quantity;
 
-    /**
-     * 事业部id
-     */
-    private Long departmentId;
-
 }

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

@@ -0,0 +1,59 @@
+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;
+import java.util.Date;
+
+/**
+ * <p>
+ * 库存快照
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+@TableName("inventory_backup")
+public class InventoryBackup extends BasePo {
+
+    /**
+     * 库存id
+     */
+    private Long inventoryId;
+
+    /**
+     * 仓库id
+     */
+    private Long warehouseId;
+
+    /**
+     * bom规格id
+     */
+    private Long bomSpecId;
+
+    /**
+     * 结存单价
+     */
+    private BigDecimal balanceUnitPrice;
+
+    /**
+     * 数量
+     */
+    private BigDecimal quantity;
+
+    /**
+     * 事业部id
+     */
+    private Long departmentId;
+
+    /**
+     * 备份日期
+     */
+    private Date backupDate;
+
+}

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

@@ -0,0 +1,28 @@
+package com.sd.business.entity.inventory.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * 库存快照列表查询返回值实体
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+public class InventoryBackupVo {
+
+    /**
+     * 备份日期
+     */
+    private Date backupDate;
+
+    /**
+     * 备份日期
+     */
+    private String backupDateStr;
+
+}

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/purchase/dto/PurchaseDto.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.purchase.dto;
+
+import com.sd.business.entity.purchase.po.Purchase;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 采购合同新增编辑入参实体
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+public class PurchaseDto extends Purchase {
+
+}

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/purchase/dto/PurchaseSelectDto.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.purchase.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 采购合同列表查询入参实体
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+public class PurchaseSelectDto extends BaseSelectDto {
+
+}

+ 174 - 0
sd-business/src/main/java/com/sd/business/entity/purchase/po/Purchase.java

@@ -0,0 +1,174 @@
+package com.sd.business.entity.purchase.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * <p>
+ * 采购合同
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+@TableName("purchase")
+public class Purchase extends BasePo {
+
+    /**
+     * 采购合同编号
+     */
+    private String code;
+
+    /**
+     * 申购单id
+     */
+    private Long applyBuyId;
+
+    /**
+     * 供应商id
+     */
+    private Long supplierId;
+
+    /**
+     * 省
+     */
+    private String province;
+
+    /**
+     * 市
+     */
+    private String city;
+
+    /**
+     * 详细地址
+     */
+    private String detailedAddress;
+
+    /**
+     * 联系人
+     */
+    private String contactPerson;
+
+    /**
+     * 联系人电话
+     */
+    private String contactNumber;
+
+    /**
+     * 收获类型 1供应商运输 2自取
+     */
+    private Integer receiveGoodsType;
+
+    /**
+     * 收货省
+     */
+    private String receiveProvince;
+
+    /**
+     * 收货市
+     */
+    private String receiveCity;
+
+    /**
+     * 收货详细地址
+     */
+    private String receiveDetailedAddress;
+
+    /**
+     * 收货邮编
+     */
+    private String receivePostcode;
+
+    /**
+     * 收货联系人
+     */
+    private String receiveContactPerson;
+
+    /**
+     * 收货联系人电话
+     */
+    private String receiveContactNumber;
+
+    /**
+     * 结算方式 字典:settlement_method
+     */
+    private String settlementMethod;
+
+    /**
+     * 发票类型 字典:invoice_type
+     */
+    private String invoiceType;
+
+    /**
+     * 交付日期
+     */
+    private Date deliveryDate;
+
+    /**
+     * 币种 字典:currency
+     */
+    private String currency;
+
+    /**
+     * 预付款(百分比)
+     */
+    private BigDecimal advancePayment;
+
+    /**
+     * 含税总金额
+     */
+    private BigDecimal totalAmountIncludingTax;
+
+    /**
+     * 不含税总金额
+     */
+    private BigDecimal totalAmountExcludingTax;
+
+    /**
+     * 合同模板id
+     */
+    private Long contractTemplateId;
+
+    /**
+     * 合同内容
+     */
+    private String contract;
+
+    /**
+     * 退货总金额
+     */
+    private BigDecimal returnAmount;
+
+    /**
+     * 已结清金额
+     */
+    private BigDecimal closedAccountAmount;
+
+    /**
+     * 已抵扣金额
+     */
+    private BigDecimal deductibleAmount;
+
+    /**
+     * 采购付款状态 0未结清 1已结清
+     */
+    private Integer paymentStatus;
+
+    /**
+     * 流程id
+     */
+    private Long flowId;
+
+    /**
+     * 流程状态 -1草稿  0未发起 1进行中 2已通过 3已驳回
+     */
+    private Integer flowStatus;
+
+}

+ 17 - 0
sd-business/src/main/java/com/sd/business/entity/purchase/vo/PurchaseVo.java

@@ -0,0 +1,17 @@
+package com.sd.business.entity.purchase.vo;
+
+import com.sd.business.entity.purchase.po.Purchase;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 采购合同列表查询返回值实体
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Getter
+@Setter
+public class PurchaseVo extends Purchase {
+
+}

+ 26 - 0
sd-business/src/main/java/com/sd/business/mapper/in/InOutStorageBomMapper.java

@@ -0,0 +1,26 @@
+package com.sd.business.mapper.in;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.in.po.InOutStorageBom;
+import com.sd.business.entity.in.vo.InOutStorageBomVo;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 出入库bom Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+public interface InOutStorageBomMapper extends BaseMapper<InOutStorageBom> {
+
+    /**
+     * 出入库bom分页
+     */
+    Page<InOutStorageBomVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<InOutStorageBom> wrapper);
+
+}

+ 26 - 0
sd-business/src/main/java/com/sd/business/mapper/in/InOutStorageMapper.java

@@ -0,0 +1,26 @@
+package com.sd.business.mapper.in;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.in.po.InOutStorage;
+import com.sd.business.entity.in.vo.InOutStorageVo;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 出入库 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+public interface InOutStorageMapper extends BaseMapper<InOutStorage> {
+
+    /**
+     * 出入库分页
+     */
+    Page<InOutStorageVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<InOutStorage> wrapper);
+
+}

+ 23 - 0
sd-business/src/main/java/com/sd/business/mapper/inventory/InventoryBackupMapper.java

@@ -0,0 +1,23 @@
+package com.sd.business.mapper.inventory;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.inventory.po.InventoryBackup;
+import com.sd.business.entity.inventory.vo.InventoryBackupVo;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 库存快照 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+public interface InventoryBackupMapper extends BaseMapper<InventoryBackup> {
+
+    Page<InventoryBackupVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<InventoryBackup> wrapper);
+
+}

+ 3 - 1
sd-business/src/main/java/com/sd/business/mapper/inventory/InventoryMapper.java

@@ -25,7 +25,9 @@ public interface InventoryMapper extends BaseMapper<Inventory> {
     /**
      * 库存分页
      */
-    Page<InventoryVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<Inventory> wrapper);
+    Page<InventoryVo> getPage(@Param("page") Page<Object> page,
+                              @Param("ew") IWrapper<Inventory> wrapper,
+                              @Param("tableName") String tableName);
 
     /**
      * 根据仓库获取库存数量

+ 26 - 0
sd-business/src/main/java/com/sd/business/mapper/purchase/PurchaseMapper.java

@@ -0,0 +1,26 @@
+package com.sd.business.mapper.purchase;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.purchase.po.Purchase;
+import com.sd.business.entity.purchase.vo.PurchaseVo;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 采购合同 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+public interface PurchaseMapper extends BaseMapper<Purchase> {
+
+    /**
+     * 采购合同分页
+     */
+    Page<PurchaseVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<Purchase> wrapper);
+
+}

+ 23 - 0
sd-business/src/main/java/com/sd/business/scheduled/InventoryBackupTask.java

@@ -0,0 +1,23 @@
+package com.sd.business.scheduled;
+
+
+import com.sd.business.service.inventory.InventoryBackupService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Component
+public class InventoryBackupTask {
+
+    @Autowired
+    private InventoryBackupService inventoryBackupService;
+
+    /**
+     * 每天同步库存
+     */
+    @Scheduled(cron = "0 0 0 * * ?")
+    public void syncInventory() {
+        inventoryBackupService.sync();
+    }
+
+}

+ 46 - 0
sd-business/src/main/java/com/sd/business/service/in/InOutStorageBomService.java

@@ -0,0 +1,46 @@
+package com.sd.business.service.in;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.service.BaseService;
+import com.sd.business.entity.in.dto.InOutStorageBomDto;
+import com.sd.business.entity.in.dto.InOutStorageBomSelectDto;
+import com.sd.business.entity.in.po.InOutStorageBom;
+import com.sd.business.entity.in.vo.InOutStorageBomVo;
+
+
+/**
+ * <p>
+ * 出入库bom 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+public interface InOutStorageBomService extends BaseService<InOutStorageBom> {
+
+    /**
+     * 出入库bom分页
+     */
+    Page<InOutStorageBomVo> getPage(InOutStorageBomSelectDto dto);
+
+    /**
+     * 出入库bom明细
+     */
+    InOutStorageBomVo detail(Long id);
+
+    /**
+     * 出入库bom新增
+     */
+    void add(InOutStorageBomDto inOutStorageBomDto);
+
+    /**
+     * 出入库bom编辑
+     */
+    void edit(InOutStorageBomDto inOutStorageBomDto);
+
+    /**
+     * 出入库bom删除
+     */
+    void delete(Long id);
+
+}

+ 52 - 0
sd-business/src/main/java/com/sd/business/service/in/InOutStorageService.java

@@ -0,0 +1,52 @@
+package com.sd.business.service.in;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.service.BaseService;
+import com.sd.business.entity.in.dto.AddAllotDto;
+import com.sd.business.entity.in.dto.InOutStorageDto;
+import com.sd.business.entity.in.dto.InOutStorageSelectDto;
+import com.sd.business.entity.in.po.InOutStorage;
+import com.sd.business.entity.in.vo.InOutStorageVo;
+
+
+/**
+ * <p>
+ * 出入库 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+public interface InOutStorageService extends BaseService<InOutStorage> {
+
+    /**
+     * 出入库分页
+     */
+    Page<InOutStorageVo> getPage(InOutStorageSelectDto dto);
+
+    /**
+     * 出入库明细
+     */
+    InOutStorageVo detail(Long id);
+
+    /**
+     * 出入库新增
+     */
+    void add(InOutStorageDto inOutStorageDto);
+
+    /**
+     * 出入库编辑
+     */
+    void edit(InOutStorageDto inOutStorageDto);
+
+    /**
+     * 出入库删除
+     */
+    void delete(Long id);
+
+    /**
+     * 调拨入库
+     */
+    void addAllot(AddAllotDto dto);
+
+}

+ 71 - 0
sd-business/src/main/java/com/sd/business/service/in/impl/InOutStorageBomServiceImpl.java

@@ -0,0 +1,71 @@
+package com.sd.business.service.in.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.bom.po.BomSpec;
+import com.sd.business.entity.in.dto.InOutStorageBomDto;
+import com.sd.business.entity.in.dto.InOutStorageBomSelectDto;
+import com.sd.business.entity.in.po.InOutStorage;
+import com.sd.business.entity.in.po.InOutStorageBom;
+import com.sd.business.entity.in.vo.InOutStorageBomVo;
+import com.sd.business.entity.purchase.po.Purchase;
+import com.sd.business.entity.warehouse.po.Warehouse;
+import com.sd.business.mapper.in.InOutStorageBomMapper;
+import com.sd.business.service.in.InOutStorageBomService;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * 出入库bom 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Service
+public class InOutStorageBomServiceImpl extends ServiceImpl<InOutStorageBomMapper, InOutStorageBom> implements InOutStorageBomService {
+
+    @Override
+    public Page<InOutStorageBomVo> getPage(InOutStorageBomSelectDto dto) {
+        IWrapper<InOutStorageBom> wrapper = getWrapper();
+        wrapper.orderByDesc("iosb", InOutStorageBom::getId);
+        wrapper.like("ios", InOutStorage::getCode, dto.getCode());
+        wrapper.like("p", Purchase::getCode, dto.getPurchaseCode());
+        wrapper.like("bs", BomSpec::getCode, dto.getBomSpecCode());
+        wrapper.like("bs", BomSpec::getName, dto.getBomSpecName());
+        wrapper.eq("ios", InOutStorage::getDepartmentId, dto.getDepartmentId());
+        wrapper.like("w", Warehouse::getName, dto.getWarehouseName());
+        wrapper.eq("ios", InOutStorage::getDetailType, dto.getDetailType());
+        wrapper.ge("ios", InOutStorage::getCreateTime, dto.getBeginTime());
+        wrapper.le("ios", InOutStorage::getCreateTime, dto.getEndTime());
+
+        Page<InOutStorageBomVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        return page;
+    }
+
+    @Override
+    public InOutStorageBomVo detail(Long id) {
+        InOutStorageBom InOutStorageBom = this.getById(id);
+        InOutStorageBomVo result = BeanUtil.toBean(InOutStorageBom, InOutStorageBomVo.class);
+        return result;
+    }
+
+    @Override
+    public void add(InOutStorageBomDto inOutStorageBomDto) {
+        this.save(inOutStorageBomDto);
+    }
+
+    @Override
+    public void edit(InOutStorageBomDto inOutStorageBomDto) {
+        this.updateById(inOutStorageBomDto);
+    }
+
+    @Override
+    public void delete(Long id) {
+        this.removeById(id);
+    }
+
+}

+ 124 - 0
sd-business/src/main/java/com/sd/business/service/in/impl/InOutStorageServiceImpl.java

@@ -0,0 +1,124 @@
+package com.sd.business.service.in.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.in.dto.AddAllotDto;
+import com.sd.business.entity.in.dto.InOutStorageDto;
+import com.sd.business.entity.in.dto.InOutStorageSelectDto;
+import com.sd.business.entity.in.emums.InDetailTypeEnum;
+import com.sd.business.entity.in.emums.InOutTypeEnum;
+import com.sd.business.entity.in.emums.OutDetailTypeEnum;
+import com.sd.business.entity.in.po.InOutStorage;
+import com.sd.business.entity.in.po.InOutStorageBom;
+import com.sd.business.entity.in.vo.InOutStorageVo;
+import com.sd.business.entity.warehouse.po.Warehouse;
+import com.sd.business.mapper.in.InOutStorageMapper;
+import com.sd.business.service.in.InOutStorageBomService;
+import com.sd.business.service.in.InOutStorageService;
+import com.sd.business.service.inventory.InventoryService;
+import com.sd.business.util.CodeEnum;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+
+/**
+ * <p>
+ * 出入库 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Service
+public class InOutStorageServiceImpl extends ServiceImpl<InOutStorageMapper, InOutStorage> implements InOutStorageService {
+
+    @Autowired
+    private InOutStorageBomService inOutStorageBomService;
+
+    @Autowired
+    private InventoryService inventoryService;
+
+    @Override
+    public Page<InOutStorageVo> getPage(InOutStorageSelectDto dto) {
+        IWrapper<InOutStorage> wrapper = getWrapper();
+        wrapper.orderByDesc("ios", InOutStorage::getId);
+        wrapper.eq("ios", InOutStorage::getType, dto.getType());
+        wrapper.like("ios", InOutStorage::getCode, dto.getCode());
+        wrapper.eq("ios", InOutStorage::getDepartmentId, dto.getDepartmentId());
+        wrapper.like("w", Warehouse::getName, dto.getWarehouseName());
+        wrapper.eq("ios", InOutStorage::getDetailType, dto.getDetailType());
+        wrapper.ge("ios", InOutStorage::getCreateTime, dto.getBeginTime());
+        wrapper.le("ios", InOutStorage::getCreateTime, dto.getEndTime());
+
+        Page<InOutStorageVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        return page;
+    }
+
+    @Override
+    public InOutStorageVo detail(Long id) {
+        InOutStorage InOutStorage = this.getById(id);
+        InOutStorageVo result = BeanUtil.toBean(InOutStorage, InOutStorageVo.class);
+        return result;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void add(InOutStorageDto inOutStorageDto) {
+
+        List<InOutStorageBom> inOutStorageBomList = inOutStorageDto.getInOutStorageBomList();
+
+        if (InOutTypeEnum.getInOutType(inOutStorageDto.getType()).equals(InOutTypeEnum.IN)) {
+            // 赋值入库单号
+            inOutStorageDto.setCode(CodeEnum.IN_CODE.getCode());
+            // 更新库存
+            inventoryService.in(inOutStorageDto.getDepartmentId(), inOutStorageDto.getWarehouseId(), inOutStorageBomList);
+        } else {
+            // 赋值出库单号
+            inOutStorageDto.setCode(CodeEnum.OUT_CODE.getCode());
+            // 更新库存
+            inventoryService.out(inOutStorageDto.getDepartmentId(), inOutStorageDto.getWarehouseId(), inOutStorageBomList);
+        }
+        this.save(inOutStorageDto);
+
+        inOutStorageBomList.forEach(item -> item.setInOutStorageId(inOutStorageDto.getId()));
+        inOutStorageBomService.saveBatch(inOutStorageBomList);
+
+    }
+
+    @Override
+    public void edit(InOutStorageDto inOutStorageDto) {
+        this.updateById(inOutStorageDto);
+    }
+
+    @Override
+    public void delete(Long id) {
+        this.removeById(id);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void addAllot(AddAllotDto dto) {
+        long allotFlag = IdWorker.getId();
+
+        InOutStorageDto inStorageDto = BeanUtil.toBean(dto, InOutStorageDto.class);
+        inStorageDto.setWarehouseId(dto.getInWarehouseId());
+        inStorageDto.setType(InOutTypeEnum.IN.getKey());
+        inStorageDto.setDetailType(InDetailTypeEnum.ALLOT.getKey());
+        inStorageDto.setAllotFlag(allotFlag);
+        add(inStorageDto);
+
+        InOutStorageDto outStorageDto = BeanUtil.toBean(dto, InOutStorageDto.class);
+        outStorageDto.setWarehouseId(dto.getOutWarehouseId());
+        outStorageDto.setType(InOutTypeEnum.OUT.getKey());
+        outStorageDto.setDetailType(OutDetailTypeEnum.ALLOT.getKey());
+        outStorageDto.setAllotFlag(allotFlag);
+        add(outStorageDto);
+    }
+
+}

+ 24 - 0
sd-business/src/main/java/com/sd/business/service/inventory/InventoryBackupService.java

@@ -0,0 +1,24 @@
+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.InventorySelectDto;
+import com.sd.business.entity.inventory.po.InventoryBackup;
+import com.sd.business.entity.inventory.vo.InventoryBackupVo;
+
+
+/**
+ * <p>
+ * 库存快照 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+public interface InventoryBackupService extends BaseService<InventoryBackup> {
+
+    void sync();
+
+    Page<InventoryBackupVo> getPage(InventorySelectDto dto);
+
+}

+ 20 - 1
sd-business/src/main/java/com/sd/business/service/inventory/InventoryService.java

@@ -2,6 +2,7 @@ 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.bo.InOutFun;
 import com.sd.business.entity.inventory.dto.InventorySelectDto;
 import com.sd.business.entity.inventory.po.Inventory;
 import com.sd.business.entity.inventory.vo.InventoryVo;
@@ -24,7 +25,7 @@ public interface InventoryService extends BaseService<Inventory> {
     /**
      * 库存分页
      */
-    Page<InventoryVo> getPage(InventorySelectDto dto);
+    Page<InventoryVo> getPage(InventorySelectDto dto, String tableName);
 
     /**
      * 根据仓库获取库存数量
@@ -36,4 +37,22 @@ public interface InventoryService extends BaseService<Inventory> {
      */
     List<QuantityByDepartmentVo> getQuantityByDepartment();
 
+    /**
+     * 入库逻辑
+     *
+     * @param departmentId 事业部id
+     * @param warehouseId  仓库id
+     * @param list         入库明细
+     */
+    void in(Long departmentId, Long warehouseId, List<? extends InOutFun> list);
+
+    /**
+     * 出库逻辑
+     *
+     * @param departmentId 事业部id
+     * @param warehouseId  仓库id
+     * @param list         出库明细
+     */
+    void out(Long departmentId, Long warehouseId, List<? extends InOutFun> list);
+
 }

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

@@ -0,0 +1,76 @@
+package com.sd.business.service.inventory.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.inventory.dto.InventorySelectDto;
+import com.sd.business.entity.inventory.po.Inventory;
+import com.sd.business.entity.inventory.po.InventoryBackup;
+import com.sd.business.entity.inventory.vo.InventoryBackupVo;
+import com.sd.business.mapper.inventory.InventoryBackupMapper;
+import com.sd.business.service.inventory.InventoryBackupService;
+import com.sd.business.service.inventory.InventoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+
+/**
+ * <p>
+ * 库存快照 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Service
+public class InventoryBackupServiceImpl extends ServiceImpl<InventoryBackupMapper, InventoryBackup> implements InventoryBackupService {
+
+    @Autowired
+    private InventoryService inventoryService;
+
+    @Override
+    public void sync() {
+        List<Inventory> list = inventoryService.list();
+        Date date = new Date();
+        Date backupDate = DateUtil.beginOfDay(DateUtil.offsetDay(date, -1));
+
+        List<InventoryBackup> inventoryBackupList = list.stream().map(item -> {
+            InventoryBackup inventoryBackup = BeanUtil.toBean(item, InventoryBackup.class);
+            inventoryBackup.setInventoryId(inventoryBackup.getId());
+            inventoryBackup.setBackupDate(backupDate);
+            inventoryBackup.setId(IdWorker.getId());
+            return inventoryBackup;
+        }).collect(Collectors.toList());
+
+        saveBatch(inventoryBackupList);
+    }
+
+    @Override
+    public Page<InventoryBackupVo> getPage(InventorySelectDto dto) {
+
+        IWrapper<InventoryBackup> wrapper = getWrapper();
+        wrapper.orderByDesc("ib", InventoryBackup::getId);
+        wrapper.ge("ib", InventoryBackup::getBackupDate, dto.getBeginTime());
+        wrapper.le("ib", InventoryBackup::getBackupDate, dto.getEndTime());
+
+        Page<InventoryBackupVo> page = baseMapper.getPage(dto.getPage(), wrapper);
+        List<InventoryBackupVo> records = page.getRecords();
+        if (records.size() == 0) {
+            return page;
+        }
+
+        for (InventoryBackupVo record : records) {
+            record.setBackupDate(DateUtil.offsetDay(record.getBackupDate(), 1));
+            record.setBackupDateStr(DateUtil.format(record.getBackupDate(), "yyyy-MM-dd"));
+        }
+        return page;
+    }
+
+}

+ 80 - 2
sd-business/src/main/java/com/sd/business/service/inventory/impl/InventoryServiceImpl.java

@@ -2,19 +2,29 @@ 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.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.sd.business.entity.bom.po.Bom;
 import com.sd.business.entity.bom.po.BomSpec;
+import com.sd.business.entity.inventory.bo.InOutFun;
 import com.sd.business.entity.inventory.dto.InventorySelectDto;
 import com.sd.business.entity.inventory.po.Inventory;
+import com.sd.business.entity.inventory.po.InventoryBackup;
 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.mapper.inventory.InventoryMapper;
+import com.sd.business.service.bom.BomSpecService;
 import com.sd.business.service.inventory.InventoryService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 
 /**
@@ -28,8 +38,11 @@ import java.util.List;
 @Service
 public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory> implements InventoryService {
 
+    @Autowired
+    private BomSpecService bomSpecService;
+
     @Override
-    public Page<InventoryVo> getPage(InventorySelectDto dto) {
+    public Page<InventoryVo> getPage(InventorySelectDto dto, String tableName) {
         IWrapper<Inventory> wrapper = getWrapper();
 
         wrapper.orderByDesc("i", Inventory::getId);
@@ -46,8 +59,9 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
         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());
 
-        Page<InventoryVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        Page<InventoryVo> page = this.baseMapper.getPage(dto.getPage(), wrapper, tableName);
         return page;
     }
 
@@ -61,5 +75,69 @@ public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory
         return baseMapper.getQuantityByDepartment();
     }
 
+    @Override
+    public void in(Long departmentId, Long warehouseId, List<? extends InOutFun> list) {
+        List<Long> bomSpecIdList = list.stream().map(InOutFun::getBomSpecId).collect(Collectors.toList());
+
+        synchronized (this) {
+            List<Inventory> inventoryList = getInventoryList(departmentId, warehouseId, bomSpecIdList);
+            Map<Long, Inventory> map = inventoryList.stream().collect(Collectors.toMap(Inventory::getBomSpecId, Function.identity()));
+            for (InOutFun inOutFun : list) {
+                Long bomSpecId = inOutFun.getBomSpecId();
+                BigDecimal quantity = inOutFun.getQuantity();
+                Inventory inventory = map.get(bomSpecId);
+                if (inventory != null) {
+                    inventory.setQuantity(inventory.getQuantity().add(quantity));
+                } else {
+                    inventory = new Inventory();
+                    inventory.setWarehouseId(warehouseId);
+                    inventory.setDepartmentId(departmentId);
+                    inventory.setBomSpecId(bomSpecId);
+                    inventory.setQuantity(quantity);
+                    inventoryList.add(inventory);
+                    map.put(bomSpecId, inventory);
+                }
+            }
+            saveOrUpdateBatch(inventoryList);
+        }
+
+    }
+
+    @Override
+    public void out(Long departmentId, Long warehouseId, List<? extends InOutFun> list) {
+        Map<Long, BigDecimal> map = list.stream().collect(Collectors.toMap(InOutFun::getBomSpecId, InOutFun::getQuantity));
+        List<Long> bomSpecIdList = new ArrayList<>(map.keySet());
+
+        synchronized (this) {
+            List<Inventory> inventoryList = getInventoryList(departmentId, warehouseId, bomSpecIdList);
+
+            // 查询库存中是否存在bom
+            for (Inventory inventory : inventoryList) {
+                Long bomSpecId = inventory.getBomSpecId();
+                if (!bomSpecIdList.contains(bomSpecId)) {
+                    BomSpec bomSpec = bomSpecService.getById(bomSpecId);
+                    if (bomSpec == null) {
+                        throw new ServiceException("未知bom规格id:" + bomSpecId);
+                    }
+                    throw new ServiceException("出库失败,品名为:" + bomSpec.getName() + "的bom库存不足");
+                }
+            }
+
+            for (Inventory inventory : inventoryList) {
+                inventory.setQuantity(inventory.getQuantity().subtract(map.get(inventory.getBomSpecId())));
+            }
+            updateBatchById(inventoryList);
+        }
+
+    }
+
+    private List<Inventory> getInventoryList(Long departmentId, Long warehouseId, List<Long> bomSpecIdList) {
+        return list(q -> q
+                .eq(Inventory::getDepartmentId, departmentId)
+                .eq(Inventory::getWarehouseId, warehouseId)
+                .in(Inventory::getBomSpecId, bomSpecIdList)
+        );
+    }
+
 
 }

+ 46 - 0
sd-business/src/main/java/com/sd/business/service/purchase/PurchaseService.java

@@ -0,0 +1,46 @@
+package com.sd.business.service.purchase;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.service.BaseService;
+import com.sd.business.entity.purchase.dto.PurchaseDto;
+import com.sd.business.entity.purchase.dto.PurchaseSelectDto;
+import com.sd.business.entity.purchase.po.Purchase;
+import com.sd.business.entity.purchase.vo.PurchaseVo;
+
+
+/**
+ * <p>
+ * 采购合同 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+public interface PurchaseService extends BaseService<Purchase> {
+
+    /**
+     * 采购合同分页
+     */
+    Page<PurchaseVo> getPage(PurchaseSelectDto dto);
+
+    /**
+     * 采购合同明细
+     */
+    PurchaseVo detail(Long id);
+
+    /**
+     * 采购合同新增
+     */
+    void add(PurchaseDto purchaseDto);
+
+    /**
+     * 采购合同编辑
+     */
+    void edit(PurchaseDto purchaseDto);
+
+    /**
+     * 采购合同删除
+     */
+    void delete(Long id);
+
+}

+ 57 - 0
sd-business/src/main/java/com/sd/business/service/purchase/impl/PurchaseServiceImpl.java

@@ -0,0 +1,57 @@
+package com.sd.business.service.purchase.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.sd.business.entity.purchase.dto.PurchaseDto;
+import com.sd.business.entity.purchase.dto.PurchaseSelectDto;
+import com.sd.business.entity.purchase.po.Purchase;
+import com.sd.business.entity.purchase.vo.PurchaseVo;
+import com.sd.business.mapper.purchase.PurchaseMapper;
+import com.sd.business.service.purchase.PurchaseService;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * <p>
+ * 采购合同 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-07-03
+ */
+@Service
+public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> implements PurchaseService {
+
+    @Override
+    public Page<PurchaseVo> getPage(PurchaseSelectDto dto) {
+        IWrapper<Purchase> wrapper = getWrapper();
+        wrapper.orderByDesc("p", Purchase::getId);
+        Page<PurchaseVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        return page;
+    }
+
+    @Override
+    public PurchaseVo detail(Long id) {
+        Purchase Purchase = this.getById(id);
+        PurchaseVo result = BeanUtil.toBean(Purchase, PurchaseVo.class);
+        return result;
+    }
+
+    @Override
+    public void add(PurchaseDto purchaseDto) {
+        this.save(purchaseDto);
+    }
+
+    @Override
+    public void edit(PurchaseDto purchaseDto) {
+        this.updateById(purchaseDto);
+    }
+
+    @Override
+    public void delete(Long id) {
+        this.removeById(id);
+    }
+
+}

+ 5 - 0
sd-business/src/main/java/com/sd/business/util/CodeEnum.java

@@ -8,6 +8,7 @@ import cn.hutool.extra.spring.SpringUtil;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ruoyi.common.exception.ServiceException;
 import com.sd.business.service.apply.ApplyBuyService;
+import com.sd.business.service.in.InOutStorageService;
 import com.sd.business.service.lend.LendService;
 import lombok.Getter;
 
@@ -21,6 +22,10 @@ public enum CodeEnum {
     APPLY_BUY_CODE("PA", "-yyMMdd-", "code", 6, ApplyBuyService.class),
     // 借出编号
     LEND_CODE("BL", "-yyMMdd-", "code", 6, LendService.class),
+    // 入库编号
+    IN_CODE("DTS", "-yyMMdd-", "code", 6, InOutStorageService.class),
+    // 入库编号
+    OUT_CODE("OS", "-yyMMdd-", "code", 6, InOutStorageService.class),
     ;
 
     // 编码前缀

+ 29 - 0
sd-business/src/main/resources/mapper/in/InOutStorageBomMapper.xml

@@ -0,0 +1,29 @@
+<?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.in.InOutStorageBomMapper">
+
+    <select id="getPage" resultType="com.sd.business.entity.in.vo.InOutStorageBomVo">
+        select iosb.id,
+               iosb.in_out_storage_id,
+               iosb.bom_spec_id,
+               iosb.quantity,
+               ios.create_time,
+               w.type  warehouseType,
+               w.name  warehouseName,
+               d.name  departmentName,
+               p.code  purchaseCode,
+               ios.detail_type,
+               ios.code,
+               ios.applicant,
+               bs.code bomSpecCode,
+               bs.name bomSpecName
+        from in_out_storage_bom iosb
+                 left join in_out_storage ios on iosb.in_out_storage_id = ios.id
+                 left join warehouse w on ios.warehouse_id = w.id
+                 left join department d on ios.department_id = d.id
+                 left join purchase p on ios.purchase_id = p.id
+                 left join bom_spec bs on iosb.bom_spec_id = bs.id
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 29 - 0
sd-business/src/main/resources/mapper/in/InOutStorageMapper.xml

@@ -0,0 +1,29 @@
+<?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.in.InOutStorageMapper">
+    <select id="getPage" resultType="com.sd.business.entity.in.vo.InOutStorageVo">
+        select ios.id,
+               ios.type,
+               ios.detail_type,
+               ios.code,
+               ios.purchase_id,
+               ios.warehouse_id,
+               ios.department_id,
+               ios.applicant,
+               ios.remark,
+               ios.create_user,
+               ios.create_time,
+               ios.update_user,
+               ios.update_time,
+               w.type warehouseType,
+               w.name warehouseName,
+               d.name departmentName,
+               p.code purchaseCode
+        from in_out_storage ios
+                 left join warehouse w on ios.warehouse_id = w.id
+                 left join department d on ios.department_id = d.id
+                 left join purchase p on ios.purchase_id = p.id
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 10 - 0
sd-business/src/main/resources/mapper/inventory/InventoryBackupMapper.xml

@@ -0,0 +1,10 @@
+<?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.InventoryBackupMapper">
+
+    <select id="getPage" resultType="com.sd.business.entity.inventory.vo.InventoryBackupVo">
+        select ib.backup_date
+        from inventory_backup ib ${ew.customSqlSegment}
+    </select>
+
+</mapper>

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

@@ -13,7 +13,7 @@
                bs.name bomSpecName,
                bs.code bomSpecCode,
                d.name  departmentName
-        from inventory i
+        from ${tableName} 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

+ 44 - 0
sd-business/src/main/resources/mapper/purchase/PurchaseMapper.xml

@@ -0,0 +1,44 @@
+<?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.purchase.PurchaseMapper">
+    <select id="getPage" resultType="com.sd.business.entity.purchase.vo.PurchaseVo">
+        select p.id,
+               p.code,
+               p.apply_buy_id,
+               p.supplier_id,
+               p.province,
+               p.city,
+               p.detailed_address,
+               p.contact_person,
+               p.contact_number,
+               p.receive_goods_type,
+               p.receive_province,
+               p.receive_city,
+               p.receive_detailed_address,
+               p.receive_postcode,
+               p.receive_contact_person,
+               p.receive_contact_number,
+               p.settlement_method,
+               p.invoice_type,
+               p.delivery_date,
+               p.currency,
+               p.advance_payment,
+               p.total_amount_including_tax,
+               p.total_amount_excluding_tax,
+               p.contract_template_id,
+               p.contract,
+               p.return_amount,
+               p.closed_account_amount,
+               p.deductible_amount,
+               p.payment_status,
+               p.flow_id,
+               p.flow_status,
+               p.create_user,
+               p.create_time,
+               p.update_user,
+               p.update_time
+        from purchase p
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 2 - 0
sd-starter/src/main/java/com/sd/SdApplication.java

@@ -4,8 +4,10 @@ import lombok.extern.slf4j.Slf4j;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 @Slf4j
+@EnableScheduling
 @SpringBootApplication(scanBasePackages = {"com.ruoyi.**", "com.fjhx.**", "com.sd.**"})
 @MapperScan("com.sd.**.mapper")
 public class SdApplication {