From 45af8ccd9a38f403b686431faefad5733f900209 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期一, 08 九月 2025 18:07:58 +0800
Subject: [PATCH] 供应商erp

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java |   52 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java
index 2dde23d..5d68c0a 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TErpSupplierWarehousingServiceImpl.java
@@ -3,21 +3,24 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ruoyi.common.basic.PageInfo;
 import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.system.dto.WarehousingGoodsDto;
+import com.ruoyi.system.dto.WarehousingGoodsNextDto;
 import com.ruoyi.system.mapper.*;
 import com.ruoyi.system.model.*;
 import com.ruoyi.system.query.TErpGoodsQuery;
 import com.ruoyi.system.query.TErpGoodsWarehouseQuery;
+import com.ruoyi.system.query.ValidityPeriodWarningQuery;
 import com.ruoyi.system.service.TErpSupplierWarehousingService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.system.vo.TErpGoodsVO;
-import com.ruoyi.system.vo.TErpGoodsWarehouseLastVO;
-import com.ruoyi.system.vo.TErpGoodsWarehouseRecordLastVO;
-import com.ruoyi.system.vo.TErpGoodsWarehouseVO;
+import com.ruoyi.system.vo.*;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -182,4 +185,45 @@
         pageInfo.setRecords( list);
         return pageInfo;
     }
+
+    @Override
+    public void warehousingGoods(List<WarehousingGoodsDto> dtos, SysUser user) {
+        for (WarehousingGoodsDto dto : dtos) {
+            TErpSupplierWarehousing tErpSupplierWarehousing = new TErpSupplierWarehousing();
+            // 当前年月日时分秒
+            String time = DateUtils.dateTimeNow();
+            tErpSupplierWarehousing.setWarehousingNo("G"+time);
+            tErpSupplierWarehousing.setSupplierId(user.getUserId().toString());
+            tErpSupplierWarehousing.setWarehouseId(dto.getWarehouseId());
+            tErpSupplierWarehousing.setGoodsId(dto.getGoodsId());
+            TErpGoods goods = erpGoodsMapper.selectById(dto.getGoodsId());
+            tErpSupplierWarehousing.setGoodsName(goods.getGoodsName());
+            tErpSupplierWarehousing.setGoodsCount(tErpSupplierWarehousing.getGoodsCount());
+            tErpSupplierWarehousing.setUnitAmount(tErpSupplierWarehousing.getUnitAmount());
+            tErpSupplierWarehousing.setTotalPrice(tErpSupplierWarehousing.getTotalPrice());
+            erpSupplierWarehousingMapper.insert(tErpSupplierWarehousing);
+            List<WarehousingGoodsNextDto> warehousingGoodsNextDtos = dto.getWarehousingGoodsNextDtos();
+            for (WarehousingGoodsNextDto warehousingGoodsNextDto : warehousingGoodsNextDtos) {
+                TErpSupplierWarehousingBatch tErpSupplierWarehousingBatch = new TErpSupplierWarehousingBatch();
+                tErpSupplierWarehousingBatch.setWarehousingId(tErpSupplierWarehousing.getId());
+                tErpSupplierWarehousingBatch.setWarehousingNumber(warehousingGoodsNextDto.getWarehousingNum());
+                tErpSupplierWarehousingBatch.setBatchNumber(warehousingGoodsNextDto.getBatchNumber());
+                tErpSupplierWarehousingBatch.setProductionDate(warehousingGoodsNextDto.getProductionDate().atStartOfDay());
+                tErpSupplierWarehousingBatch.setExpiryDate(warehousingGoodsNextDto.getExpiryDate().atStartOfDay());
+                erpSupplierWarehousingBatchMapper.insert(tErpSupplierWarehousingBatch);
+            }
+        }
+
+    }
+
+    @Override
+    public PageInfo<ValidityPeriodWarningVo> validityPeriodWarning(ValidityPeriodWarningQuery query, SysUser user) {
+        // 获取当前时间后9个月的时间
+        LocalDateTime nineMonthLater = LocalDateTime.now().plusMonths(9);
+
+        PageInfo<ValidityPeriodWarningVo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
+        return this.baseMapper.validityPeriodWarning(pageInfo,query,user,nineMonthLater);
+
+
+    }
 }

--
Gitblit v1.7.1