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 | 46 +++++++++++++++++++++++++++++++---------------
1 files changed, 31 insertions(+), 15 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 ce432d5..cdb75a1 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -59,32 +59,46 @@
@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());
@@ -92,7 +106,9 @@
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;
--
Gitblit v1.9.3