From 426ea165d182158227484dbea63e5c5cafaf6dac Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期二, 17 三月 2026 17:18:19 +0800
Subject: [PATCH] 1.库存(展示非半成品) 2.入库记录展示非半成品以及过磅单 3.报工直接入库
---
src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java | 57 +++++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 41 insertions(+), 16 deletions(-)
diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
index bc2eb2e..cdb75a1 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -21,6 +21,7 @@
import com.ruoyi.stock.service.StockOutRecordService;
import com.ruoyi.stock.word.WeighbridgeDocGenerator;
import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -58,38 +59,56 @@
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean addstockInventory(StockInventoryDto stockInventoryDto) {
- //鏂板鍏ュ簱璁板綍鍐嶆坊鍔犲簱瀛�
+ // 1. 鍒涘缓鍏ュ簱璁板綍
StockInRecordDto stockInRecordDto = new StockInRecordDto();
stockInRecordDto.setRecordId(stockInventoryDto.getRecordId());
stockInRecordDto.setRecordType(stockInventoryDto.getRecordType());
- stockInRecordDto.setStockInNum(stockInventoryDto.getNetWeight());
- stockInRecordDto.setWeighingDate(stockInventoryDto.getWeighingDate());
- stockInRecordDto.setNetWeight(stockInventoryDto.getNetWeight());
- stockInRecordDto.setGrossWeight(stockInventoryDto.getGrossWeight());
- stockInRecordDto.setTareWeight(stockInventoryDto.getTareWeight());
- stockInRecordDto.setLicensePlateNo(stockInventoryDto.getLicensePlateNo());
stockInRecordDto.setWeighingOperator(stockInventoryDto.getWeighingOperator());
stockInRecordDto.setProductModelId(stockInventoryDto.getProductModelId());
stockInRecordDto.setProductId(stockInventoryDto.getProductId());
+ stockInRecordDto.setRemark(stockInventoryDto.getRemark());
stockInRecordDto.setType("0");
- //鐢熸垚纾呭崟
- String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto);
- stockInRecordDto.setWeighbridgeDocPath(absoluteDocPath);
+
+ // 鏍规嵁浜у搧绫诲瀷璁剧疆涓嶅悓鐨勯噸閲忓瓧娈�
+ if (stockInventoryDto.getProductType() != null && stockInventoryDto.getProductType() == 0) {
+ stockInRecordDto.setStockInNum(stockInventoryDto.getNetWeight());
+ stockInRecordDto.setWeighingDate(stockInventoryDto.getWeighingDate());
+ stockInRecordDto.setNetWeight(stockInventoryDto.getNetWeight());
+ stockInRecordDto.setGrossWeight(stockInventoryDto.getGrossWeight());
+ stockInRecordDto.setTareWeight(stockInventoryDto.getTareWeight());
+ stockInRecordDto.setLicensePlateNo(stockInventoryDto.getLicensePlateNo());
+ // 鐢熸垚纾呭崟
+ String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto);
+ stockInRecordDto.setWeighbridgeDocPath(absoluteDocPath);
+ } else {
+ stockInRecordDto.setStockInNum(stockInventoryDto.getQualitity());
+ stockInRecordDto.setNetWeight(stockInventoryDto.getQualitity());
+ }
+
+ // 淇濆瓨鍏ュ簱璁板綍
stockInRecordService.add(stockInRecordDto);
- //鍐嶈繘琛屾柊澧炲簱瀛樻暟閲忓簱瀛�
- //鍏堟煡璇㈠簱瀛樿〃涓殑浜у搧鏄惁瀛樺湪锛屼笉瀛樺湪鏂板锛屽瓨鍦ㄦ洿鏂�
- StockInventory oldStockInventory = stockInventoryMapper.selectOne(new QueryWrapper<StockInventory>().lambda().eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId()));
+
+ // 2. 鏇存柊搴撳瓨
+ StockInventory oldStockInventory = stockInventoryMapper.selectOne(
+ new QueryWrapper<StockInventory>().lambda()
+ .eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId())
+ );
if (ObjectUtils.isEmpty(oldStockInventory)) {
+ // 鏂板搴撳瓨
StockInventory newStockInventory = new StockInventory();
newStockInventory.setProductModelId(stockInventoryDto.getProductModelId());
- newStockInventory.setQualitity(stockInventoryDto.getNetWeight());
+ newStockInventory.setQualitity(stockInventoryDto.getProductType() == 0 ?
+ stockInventoryDto.getNetWeight() : stockInventoryDto.getQualitity());
newStockInventory.setVersion(1);
newStockInventory.setRemark(stockInventoryDto.getRemark());
newStockInventory.setLockedQuantity(stockInventoryDto.getLockedQuantity());
newStockInventory.setWarnNum(stockInventoryDto.getWarnNum());
+ newStockInventory.setProductId(stockInventoryDto.getProductId());
stockInventoryMapper.insert(newStockInventory);
} else {
- stockInventoryDto.setQualitity(stockInventoryDto.getNetWeight());
+ // 鏇存柊搴撳瓨
+ stockInventoryDto.setQualitity(stockInventoryDto.getProductType() != null && stockInventoryDto.getProductType() == 0 ?
+ stockInventoryDto.getNetWeight() : stockInventoryDto.getQualitity());
stockInventoryMapper.updateAddStockInventory(stockInventoryDto);
}
return true;
@@ -103,7 +122,7 @@
StockOutRecordDto stockOutRecordDto = new StockOutRecordDto();
stockOutRecordDto.setRecordId(stockInventoryDto.getRecordId());
stockOutRecordDto.setRecordType(stockInventoryDto.getRecordType());
- stockInventoryDto.setWeighingDate(stockInventoryDto.getWeighingDate());
+ stockOutRecordDto.setWeighingDate(stockInventoryDto.getWeighingDate());
stockOutRecordDto.setStockOutNum(stockInventoryDto.getNetWeight());
stockOutRecordDto.setNetWeight(stockInventoryDto.getNetWeight());
stockOutRecordDto.setGrossWeight(stockInventoryDto.getGrossWeight());
@@ -112,7 +131,13 @@
stockOutRecordDto.setProductModelId(stockInventoryDto.getProductModelId());
stockOutRecordDto.setLicensePlateNo(stockInventoryDto.getLicensePlateNo());
stockOutRecordDto.setProductId(stockInventoryDto.getProductId());
+ stockOutRecordDto.setRemark(stockInventoryDto.getRemark());
stockOutRecordDto.setType("0");
+ //鐢熸垚纾呭崟
+ StockInRecordDto stockInRecordDto = new StockInRecordDto();
+ BeanUtils.copyProperties(stockOutRecordDto, stockInRecordDto);
+ String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto);
+ stockOutRecordDto.setWeighbridgeDocPath(absoluteDocPath);
stockOutRecordService.add(stockOutRecordDto);
StockInventory oldStockInventory = stockInventoryMapper.selectOne(new QueryWrapper<StockInventory>().lambda().eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId()));
if (ObjectUtils.isEmpty(oldStockInventory)) {
--
Gitblit v1.9.3