From d4afabe6cb07b4129f995c82641189b2256b15a7 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 16 三月 2026 14:50:51 +0800
Subject: [PATCH] 1.耗材模块 2.出入库磅单
---
src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInventoryServiceImpl.java | 92 ++++++++++++++++++++++++++-------------------
1 files changed, 53 insertions(+), 39 deletions(-)
diff --git a/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInventoryServiceImpl.java b/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInventoryServiceImpl.java
index 6f30282..95001f1 100644
--- a/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInventoryServiceImpl.java
@@ -19,8 +19,10 @@
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.sales.mapper.SalesLedgerProductMapper;
import com.ruoyi.sales.pojo.SalesLedgerProduct;
+import com.ruoyi.stock.dto.StockInRecordDto;
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;
@@ -43,14 +45,15 @@
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class ConsumablesInventoryServiceImpl extends ServiceImpl<ConsumablesInventoryMapper, ConsumablesInventory> implements ConsumablesInventoryService {
- private final ConsumablesInventoryMapper ConsumablesInventoryMapper;
- private final ConsumablesInRecordService ConsumablesInRecordService;
- private final ConsumablesOutRecordService ConsumablesOutRecordService;
+ private final ConsumablesInventoryMapper consumablesInventoryMapper;
+ private final ConsumablesInRecordService consumablesInRecordService;
+ private final ConsumablesOutRecordService consumablesOutRecordService;
private final SalesLedgerProductMapper salesLedgerProductMapper;
+ private final WeighbridgeDocGenerator weighbridgeDocGenerator;
@Override
- public IPage<ConsumablesInventoryDto> pageConsumablesInventory(Page page, ConsumablesInventoryDto ConsumablesInventoryDto) {
- return ConsumablesInventoryMapper.pageConsumablesInventory(page, ConsumablesInventoryDto);
+ public IPage<ConsumablesInventoryDto> pageConsumablesInventory(Page page, ConsumablesInventoryDto consumablesInventoryDto) {
+ return consumablesInventoryMapper.pageConsumablesInventory(page, consumablesInventoryDto);
}
//鍏ュ簱璋冪敤
@@ -61,7 +64,7 @@
ConsumablesInRecordDto consumablesInRecordDto = new ConsumablesInRecordDto();
consumablesInRecordDto.setRecordId(consumablesInventoryDto.getRecordId());
consumablesInRecordDto.setRecordType(consumablesInventoryDto.getRecordType());
- consumablesInRecordDto.setConsumablesInNum(consumablesInventoryDto.getNetWeight());
+ consumablesInRecordDto.setStockInNum(consumablesInventoryDto.getNetWeight());
consumablesInRecordDto.setWeighingDate(consumablesInventoryDto.getWeighingDate());
consumablesInRecordDto.setNetWeight(consumablesInventoryDto.getNetWeight());
consumablesInRecordDto.setGrossWeight(consumablesInventoryDto.getGrossWeight());
@@ -71,10 +74,15 @@
consumablesInRecordDto.setProductModelId(consumablesInventoryDto.getProductModelId());
consumablesInRecordDto.setProductId(consumablesInventoryDto.getProductId());
consumablesInRecordDto.setType("0");
- ConsumablesInRecordService.add(consumablesInRecordDto);
+ //鐢熸垚纾呭崟
+ StockInRecordDto stockInRecordDto = new StockInRecordDto();
+ BeanUtils.copyProperties(consumablesInventoryDto, stockInRecordDto);
+ String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto);
+ consumablesInRecordDto.setWeighbridgeDocPath(absoluteDocPath);
+ consumablesInRecordService.add(consumablesInRecordDto);
//鍐嶈繘琛屾柊澧炲簱瀛樻暟閲忓簱瀛�
//鍏堟煡璇㈠簱瀛樿〃涓殑浜у搧鏄惁瀛樺湪锛屼笉瀛樺湪鏂板锛屽瓨鍦ㄦ洿鏂�
- ConsumablesInventory oldConsumablesInventory = ConsumablesInventoryMapper.selectOne(new QueryWrapper<ConsumablesInventory>().lambda().eq(ConsumablesInventory::getProductModelId, consumablesInventoryDto.getProductModelId()));
+ ConsumablesInventory oldConsumablesInventory = consumablesInventoryMapper.selectOne(new QueryWrapper<ConsumablesInventory>().lambda().eq(ConsumablesInventory::getProductModelId, consumablesInventoryDto.getProductModelId()));
if (ObjectUtils.isEmpty(oldConsumablesInventory)) {
ConsumablesInventory newConsumablesInventory = new ConsumablesInventory();
newConsumablesInventory.setProductModelId(consumablesInventoryDto.getProductModelId());
@@ -83,10 +91,11 @@
newConsumablesInventory.setRemark(consumablesInventoryDto.getRemark());
newConsumablesInventory.setLockedQuantity(consumablesInventoryDto.getLockedQuantity());
newConsumablesInventory.setWarnNum(consumablesInventoryDto.getWarnNum());
- ConsumablesInventoryMapper.insert(newConsumablesInventory);
+ newConsumablesInventory.setProductId(consumablesInventoryDto.getProductId());
+ consumablesInventoryMapper.insert(newConsumablesInventory);
} else {
consumablesInventoryDto.setQualitity(consumablesInventoryDto.getNetWeight());
- ConsumablesInventoryMapper.updateAddConsumablesInventory(consumablesInventoryDto);
+ consumablesInventoryMapper.updateAddConsumablesInventory(consumablesInventoryDto);
}
return true;
}
@@ -100,7 +109,7 @@
consumablesOutRecordDto.setRecordId(consumablesInventoryDto.getRecordId());
consumablesOutRecordDto.setRecordType(consumablesInventoryDto.getRecordType());
consumablesOutRecordDto.setWeighingDate(consumablesInventoryDto.getWeighingDate());
- consumablesOutRecordDto.setConsumablesOutNum(consumablesInventoryDto.getNetWeight());
+ consumablesOutRecordDto.setStockOutNum(consumablesInventoryDto.getNetWeight());
consumablesOutRecordDto.setNetWeight(consumablesInventoryDto.getNetWeight());
consumablesOutRecordDto.setGrossWeight(consumablesInventoryDto.getGrossWeight());
consumablesOutRecordDto.setTareWeight(consumablesInventoryDto.getTareWeight());
@@ -109,8 +118,13 @@
consumablesOutRecordDto.setLicensePlateNo(consumablesInventoryDto.getLicensePlateNo());
consumablesOutRecordDto.setProductId(consumablesInventoryDto.getProductId());
consumablesOutRecordDto.setType("0");
- ConsumablesOutRecordService.add(consumablesOutRecordDto);
- ConsumablesInventory oldConsumablesInventory = ConsumablesInventoryMapper.selectOne(new QueryWrapper<ConsumablesInventory>().lambda().eq(ConsumablesInventory::getProductModelId, consumablesInventoryDto.getProductModelId()));
+ //鐢熸垚纾呭崟
+ StockInRecordDto stockInRecordDto = new StockInRecordDto();
+ BeanUtils.copyProperties(consumablesInventoryDto, stockInRecordDto);
+ String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto);
+ consumablesOutRecordDto.setWeighbridgeDocPath(absoluteDocPath);
+ consumablesOutRecordService.add(consumablesOutRecordDto);
+ ConsumablesInventory oldConsumablesInventory = consumablesInventoryMapper.selectOne(new QueryWrapper<ConsumablesInventory>().lambda().eq(ConsumablesInventory::getProductModelId, consumablesInventoryDto.getProductModelId()));
if (ObjectUtils.isEmpty(oldConsumablesInventory)) {
throw new RuntimeException("浜у搧搴撳瓨涓嶅瓨鍦�");
}
@@ -122,7 +136,7 @@
throw new RuntimeException("搴撳瓨涓嶈冻鏃犳硶鍑哄簱");
}
- ConsumablesInventoryMapper.updateSubtractConsumablesInventory(consumablesInventoryDto);
+ consumablesInventoryMapper.updateSubtractConsumablesInventory(consumablesInventoryDto);
return true;
}
@@ -143,18 +157,18 @@
for (SalesLedgerProduct item : salesLedgerProducts) {
if (item.getProductCategory().equals(dto.getProductName()) &&
item.getSpecificationModel().equals(dto.getModel())) {
- ConsumablesInventoryDto ConsumablesInventoryDto = new ConsumablesInventoryDto();
- ConsumablesInventoryDto.setRecordId(0L);
- ConsumablesInventoryDto.setRecordType(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode());
- ConsumablesInventoryDto.setQualitity(dto.getQualitity());
- ConsumablesInventoryDto.setRemark(dto.getRemark());
- ConsumablesInventoryDto.setWarnNum(dto.getWarnNum());
+ ConsumablesInventoryDto consumablesInventoryDto = new ConsumablesInventoryDto();
+ consumablesInventoryDto.setRecordId(0L);
+ consumablesInventoryDto.setRecordType(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode());
+ consumablesInventoryDto.setQualitity(dto.getQualitity());
+ consumablesInventoryDto.setRemark(dto.getRemark());
+ consumablesInventoryDto.setWarnNum(dto.getWarnNum());
if (ObjectUtils.isNotEmpty(dto.getLockedQuantity()) && dto.getLockedQuantity().compareTo(dto.getQualitity()) > 0) {
throw new RuntimeException("鍐荤粨鏁伴噺涓嶈兘瓒呰繃鏈瀵煎叆鐨勫簱瀛樻暟閲�");
}
- ConsumablesInventoryDto.setLockedQuantity(dto.getLockedQuantity());
- ConsumablesInventoryDto.setProductModelId(item.getProductModelId());
- this.addConsumablesInventory(ConsumablesInventoryDto);
+ consumablesInventoryDto.setLockedQuantity(dto.getLockedQuantity());
+ consumablesInventoryDto.setProductModelId(item.getProductModelId());
+ this.addConsumablesInventory(consumablesInventoryDto);
matched = true;
break; // 鎵惧埌鍖归厤椤瑰悗璺冲嚭寰幆
}
@@ -184,44 +198,44 @@
@Override
- public void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto ConsumablesInventoryDto) {
+ public void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto consumablesInventoryDto) {
- List<ConsumablesInventoryExportData> list = ConsumablesInventoryMapper.listConsumablesInventoryExportData(ConsumablesInventoryDto);
+ List<ConsumablesInventoryExportData> list = consumablesInventoryMapper.listConsumablesInventoryExportData(consumablesInventoryDto);
ExcelUtil<ConsumablesInventoryExportData> util = new ExcelUtil<>(ConsumablesInventoryExportData.class);
util.exportExcel(response, list, "搴撳瓨淇℃伅");
}
@Override
public IPage<ConsumablesInRecordDto> consumablesInventoryPage(ConsumablesInventoryDto consumablesInventoryDto, Page page) {
- return ConsumablesInventoryMapper.ConsumablesInventoryPage(consumablesInventoryDto, page);
+ return consumablesInventoryMapper.consumablesInventoryPage(consumablesInventoryDto, page);
}
@Override
public IPage<ConsumablesInventoryDto> consumablesInAndOutRecord(ConsumablesInventoryDto consumablesInventoryDto, Page page) {
- return ConsumablesInventoryMapper.ConsumablesInAndOutRecord(consumablesInventoryDto, page);
+ return consumablesInventoryMapper.consumablesInAndOutRecord(consumablesInventoryDto, page);
}
@Override
- public Boolean frozenConsumables(ConsumablesInventoryDto ConsumablesInventoryDto) {
- ConsumablesInventory ConsumablesInventory = ConsumablesInventoryMapper.selectById(ConsumablesInventoryDto.getId());
- if (ConsumablesInventory.getQualitity().compareTo(ConsumablesInventoryDto.getLockedQuantity()) < 0) {
+ public Boolean frozenConsumables(ConsumablesInventoryDto consumablesInventoryDto) {
+ ConsumablesInventory consumablesInventory = consumablesInventoryMapper.selectById(consumablesInventoryDto.getId());
+ if (consumablesInventory.getQualitity().compareTo(consumablesInventoryDto.getLockedQuantity()) < 0) {
throw new RuntimeException("鍐荤粨鏁伴噺涓嶈兘瓒呰繃搴撳瓨鏁伴噺");
}
- if (ObjectUtils.isEmpty(ConsumablesInventory.getLockedQuantity())) {
- ConsumablesInventory.setLockedQuantity(ConsumablesInventoryDto.getLockedQuantity());
+ if (ObjectUtils.isEmpty(consumablesInventory.getLockedQuantity())) {
+ consumablesInventory.setLockedQuantity(consumablesInventoryDto.getLockedQuantity());
} else {
- ConsumablesInventory.setLockedQuantity(ConsumablesInventory.getLockedQuantity().add(ConsumablesInventoryDto.getLockedQuantity()));
+ consumablesInventory.setLockedQuantity(consumablesInventory.getLockedQuantity().add(consumablesInventoryDto.getLockedQuantity()));
}
- return this.updateById(ConsumablesInventory);
+ return this.updateById(consumablesInventory);
}
@Override
- public Boolean thawConsumables(ConsumablesInventoryDto ConsumablesInventoryDto) {
- ConsumablesInventory ConsumablesInventory = ConsumablesInventoryMapper.selectById(ConsumablesInventoryDto.getId());
- if (ConsumablesInventory.getLockedQuantity().compareTo(ConsumablesInventoryDto.getLockedQuantity()) < 0) {
+ public Boolean thawConsumables(ConsumablesInventoryDto consumablesInventoryDto) {
+ ConsumablesInventory consumablesInventory = consumablesInventoryMapper.selectById(consumablesInventoryDto.getId());
+ if (consumablesInventory.getLockedQuantity().compareTo(consumablesInventoryDto.getLockedQuantity()) < 0) {
throw new RuntimeException("瑙e喕鏁伴噺涓嶈兘瓒呰繃鍐荤粨鏁伴噺");
}
- ConsumablesInventory.setLockedQuantity(ConsumablesInventory.getLockedQuantity().subtract(ConsumablesInventoryDto.getLockedQuantity()));
- return this.updateById(ConsumablesInventory);
+ consumablesInventory.setLockedQuantity(consumablesInventory.getLockedQuantity().subtract(consumablesInventoryDto.getLockedQuantity()));
+ return this.updateById(consumablesInventory);
}
}
--
Gitblit v1.9.3