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/controller/ConsumablesInRecordController.java       |    8 
 src/main/java/com/ruoyi/consumables/controller/ConsumablesUnInventoryController.java    |    4 
 src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java                                  |    3 
 src/main/java/com/ruoyi/consumables/controller/ConsumablesInventoryController.java      |   40 +-
 src/main/java/com/ruoyi/consumables/pojo/ConsumablesOutRecord.java                      |    5 
 src/main/java/com/ruoyi/consumables/service/ConsumablesUnInventoryService.java          |   12 
 src/main/resources/mapper/consumables/ConsumablesUninventoryMapper.xml                  |    2 
 src/main/java/com/ruoyi/stock/word/WeighbridgeDocGenerator.java                         |  244 ++++++++++++++++++---
 src/main/java/com/ruoyi/consumables/mapper/ConsumablesInventoryMapper.java              |    4 
 src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInRecordServiceImpl.java    |    4 
 src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInventoryServiceImpl.java   |   92 ++++---
 src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java               |   11 
 src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml                    |   27 +-
 src/main/resources/mapper/stock/StockOutRecordMapper.xml                                |    1 
 src/main/resources/mapper/consumables/ConsumablesInRecordMapper.xml                     |    1 
 src/main/resources/mapper/stock/StockInventoryMapper.xml                                |    7 
 src/main/java/com/ruoyi/consumables/service/impl/ConsumablesOutRecordServiceImpl.java   |   31 +-
 src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java               |    5 
 src/main/java/com/ruoyi/consumables/pojo/ConsumablesInRecord.java                       |    2 
 src/main/resources/mapper/stock/StockInRecordMapper.xml                                 |    1 
 src/main/java/com/ruoyi/consumables/mapper/ConsumablesUnInventoryMapper.java            |    8 
 src/main/java/com/ruoyi/consumables/controller/ConsumablesOutRecordController.java      |   16 
 src/main/java/com/ruoyi/consumables/service/ConsumablesOutRecordService.java            |    8 
 src/main/java/com/ruoyi/consumables/service/impl/ConsumablesUnInventoryServiceImpl.java |   82 +++---
 src/main/resources/mapper/consumables/ConsumablesOutRecordMapper.xml                    |    7 
 25 files changed, 413 insertions(+), 212 deletions(-)

diff --git a/src/main/java/com/ruoyi/consumables/controller/ConsumablesInRecordController.java b/src/main/java/com/ruoyi/consumables/controller/ConsumablesInRecordController.java
index a7d9921..2b11e0d 100644
--- a/src/main/java/com/ruoyi/consumables/controller/ConsumablesInRecordController.java
+++ b/src/main/java/com/ruoyi/consumables/controller/ConsumablesInRecordController.java
@@ -26,8 +26,8 @@
     @GetMapping("/listPage")
     @Log(title = "鐢熶骇鍏ュ簱-鍏ュ簱绠$悊-鍒楄〃", businessType = BusinessType.OTHER)
     @ApiOperation(value = "鍏ュ簱绠$悊鍒楄〃")
-    public AjaxResult listPage(Page page, ConsumablesInRecordDto ConsumablesInRecordDto) {
-        IPage<ConsumablesInRecordDto> result = consumablesInRecordService.listPage(page, ConsumablesInRecordDto);
+    public AjaxResult listPage(Page page, ConsumablesInRecordDto consumablesInRecordDto) {
+        IPage<ConsumablesInRecordDto> result = consumablesInRecordService.listPage(page, consumablesInRecordDto);
         return AjaxResult.success(result);
     }
 
@@ -44,8 +44,8 @@
 
     @PostMapping("/exportConsumablesInRecord")
     @ApiOperation("瀵煎嚭鍏ュ簱璁板綍")
-    public void exportConsumablesInRecord(HttpServletResponse response, ConsumablesInRecordDto ConsumablesInRecordDto) {
-        consumablesInRecordService.exportConsumablesInRecord(response,ConsumablesInRecordDto);
+    public void exportConsumablesInRecord(HttpServletResponse response, ConsumablesInRecordDto consumablesInRecordDto) {
+        consumablesInRecordService.exportConsumablesInRecord(response,consumablesInRecordDto);
     }
 
 }
diff --git a/src/main/java/com/ruoyi/consumables/controller/ConsumablesInventoryController.java b/src/main/java/com/ruoyi/consumables/controller/ConsumablesInventoryController.java
index 8687fa2..fbede68 100644
--- a/src/main/java/com/ruoyi/consumables/controller/ConsumablesInventoryController.java
+++ b/src/main/java/com/ruoyi/consumables/controller/ConsumablesInventoryController.java
@@ -35,37 +35,37 @@
 public class ConsumablesInventoryController {
 
     @Autowired
-    private ConsumablesInventoryService ConsumablesInventoryService;
+    private ConsumablesInventoryService consumablesInventoryService;
 
     @GetMapping("/pageConsumablesInventory")
     @ApiOperation("鍒嗛〉鏌ヨ搴撳瓨")
-    public R pageConsumablesInventory(Page page, ConsumablesInventoryDto ConsumablesInventoryDto) {
-        IPage<ConsumablesInventoryDto> ConsumablesInventoryDtoIPage = ConsumablesInventoryService.pageConsumablesInventory(page, ConsumablesInventoryDto);
+    public R pageConsumablesInventory(Page page, ConsumablesInventoryDto consumablesInventoryDto) {
+        IPage<ConsumablesInventoryDto> ConsumablesInventoryDtoIPage = consumablesInventoryService.pageConsumablesInventory(page, consumablesInventoryDto);
         return R.ok(ConsumablesInventoryDtoIPage);
     }
 
     @PostMapping("/addConsumablesInventory")
     @ApiOperation("鏂板搴撳瓨")
-    public R addConsumablesInventory(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) {
-        ConsumablesInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode()));
-        ConsumablesInventoryDto.setRecordId(0L);
-        return R.ok(ConsumablesInventoryService.addConsumablesInventory(ConsumablesInventoryDto));
+    public R addConsumablesInventory(@RequestBody ConsumablesInventoryDto consumablesInventoryDto) {
+        consumablesInventoryDto.setRecordType(String.valueOf(StockInQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_IN.getCode()));
+        consumablesInventoryDto.setRecordId(0L);
+        return R.ok(consumablesInventoryService.addConsumablesInventory(consumablesInventoryDto));
     }
 
 
     @PostMapping("/subtractConsumablesInventory")
     @ApiOperation("鎵e噺搴撳瓨")
-    public R subtractConsumablesInventory(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) {
-        ConsumablesInventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_OUT.getCode()));
-        ConsumablesInventoryDto.setRecordId(0L);
-        return R.ok(ConsumablesInventoryService.subtractConsumablesInventory(ConsumablesInventoryDto));
+    public R subtractConsumablesInventory(@RequestBody ConsumablesInventoryDto consumablesInventoryDto) {
+        consumablesInventoryDto.setRecordType(String.valueOf(StockOutQualifiedRecordTypeEnum.CUSTOMIZATION_STOCK_OUT.getCode()));
+        consumablesInventoryDto.setRecordId(0L);
+        return R.ok(consumablesInventoryService.subtractConsumablesInventory(consumablesInventoryDto));
     }
 
 
     @PostMapping("importConsumablesInventory")
     @ApiOperation("瀵煎叆搴撳瓨")
     public R importConsumablesInventory(MultipartFile file) {
-        return ConsumablesInventoryService.importConsumablesInventory(file);
+        return consumablesInventoryService.importConsumablesInventory(file);
     }
 
     @Log(title = "涓嬭浇搴撳瓨瀵煎叆妯℃澘", businessType = BusinessType.EXPORT)
@@ -78,31 +78,31 @@
 
     @PostMapping("/exportConsumablesInventory")
     @ApiOperation("瀵煎嚭搴撳瓨")
-    public void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto ConsumablesInventoryDto) {
-        ConsumablesInventoryService.exportConsumablesInventory(response, ConsumablesInventoryDto);
+    public void exportConsumablesInventory(HttpServletResponse response, ConsumablesInventoryDto consumablesInventoryDto) {
+        consumablesInventoryService.exportConsumablesInventory(response, consumablesInventoryDto);
     }
 
     @GetMapping("ConsumablesInventoryPage")
     @ApiOperation("搴撳瓨鎶ヨ〃鏌ヨ")
     public R ConsumablesInventoryPage(Page page, ConsumablesInventoryDto consumablesInventoryDto) {
-        return R.ok(ConsumablesInventoryService.consumablesInventoryPage(consumablesInventoryDto,page));
+        return R.ok(consumablesInventoryService.consumablesInventoryPage(consumablesInventoryDto,page));
     }
 
     @GetMapping("ConsumablesInAndOutRecord")
     @ApiOperation("缁熻鍚勪釜浜у搧鐨勫叆搴撳拰鍑哄簱璁板綍")
     public R ConsumablesInAndOutRecord(ConsumablesInventoryDto consumablesInventoryDto, Page page) {
-        return R.ok(ConsumablesInventoryService.consumablesInAndOutRecord(consumablesInventoryDto,page));
+        return R.ok(consumablesInventoryService.consumablesInAndOutRecord(consumablesInventoryDto,page));
     }
 
     @PostMapping("/frozenConsumables")
     @ApiOperation("鍐荤粨搴撳瓨")
-    public R frozenConsumables(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) {
-        return R.ok(ConsumablesInventoryService.frozenConsumables(ConsumablesInventoryDto));
+    public R frozenConsumables(@RequestBody ConsumablesInventoryDto consumablesInventoryDto) {
+        return R.ok(consumablesInventoryService.frozenConsumables(consumablesInventoryDto));
     }
 
     @PostMapping("/thawConsumables")
     @ApiOperation("瑙e喕搴撳瓨")
-    public R thawConsumables(@RequestBody ConsumablesInventoryDto ConsumablesInventoryDto) {
-        return R.ok(ConsumablesInventoryService.thawConsumables(ConsumablesInventoryDto));
+    public R thawConsumables(@RequestBody ConsumablesInventoryDto consumablesInventoryDto) {
+        return R.ok(consumablesInventoryService.thawConsumables(consumablesInventoryDto));
     }
 }
diff --git a/src/main/java/com/ruoyi/consumables/controller/ConsumablesOutRecordController.java b/src/main/java/com/ruoyi/consumables/controller/ConsumablesOutRecordController.java
index efc98b7..419bd1f 100644
--- a/src/main/java/com/ruoyi/consumables/controller/ConsumablesOutRecordController.java
+++ b/src/main/java/com/ruoyi/consumables/controller/ConsumablesOutRecordController.java
@@ -34,21 +34,21 @@
     @GetMapping("/listPage")
     @Log(title = "鐢熶骇鍑哄簱-鍑哄簱绠$悊-鍒楄〃", businessType = BusinessType.OTHER)
     @ApiOperation(value = "鍑哄簱绠$悊鍒楄〃")
-    public AjaxResult listPage(Page page, ConsumablesOutRecordDto ConsumablesOutRecordDto) {
-        IPage<ConsumablesOutRecordDto> result = consumablesUnInventoryDto.listPage(page, ConsumablesOutRecordDto);
+    public AjaxResult listPage(Page page, ConsumablesOutRecordDto consumablesOutRecordDto) {
+        IPage<ConsumablesOutRecordDto> result = consumablesUnInventoryDto.listPage(page, consumablesOutRecordDto);
         return AjaxResult.success(result);
     }
 
     @PostMapping("")
     @Log(title = "鍑哄簱绠$悊-鏂板鍑哄簱", businessType = BusinessType.INSERT)
-    public AjaxResult add(@RequestBody ConsumablesOutRecordDto ConsumablesOutRecordDto) {
-        return AjaxResult.success(consumablesUnInventoryDto.add(ConsumablesOutRecordDto));
+    public AjaxResult add(@RequestBody ConsumablesOutRecordDto consumablesOutRecordDto) {
+        return AjaxResult.success(consumablesUnInventoryDto.add(consumablesOutRecordDto));
     }
 
     @PutMapping("/{id}")
     @Log(title = "鍑哄簱绠$悊-鏇存柊鍑哄簱", businessType = BusinessType.UPDATE)
-    public AjaxResult update(@PathVariable("id") Long id, @RequestBody ConsumablesOutRecordDto ConsumablesOutRecordDto) {
-        return AjaxResult.success(consumablesUnInventoryDto.update(id, ConsumablesOutRecordDto));
+    public AjaxResult update(@PathVariable("id") Long id, @RequestBody ConsumablesOutRecordDto consumablesOutRecordDto) {
+        return AjaxResult.success(consumablesUnInventoryDto.update(id, consumablesOutRecordDto));
     }
 
     @DeleteMapping("")
@@ -62,8 +62,8 @@
 
     @PostMapping("/exportConsumablesOutRecord")
     @ApiOperation("瀵煎嚭鍑哄簱璁板綍")
-    public void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto ConsumablesOutRecordDto) {
-        consumablesUnInventoryDto.exportConsumablesOutRecord(response,ConsumablesOutRecordDto);
+    public void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto consumablesOutRecordDto) {
+        consumablesUnInventoryDto.exportConsumablesOutRecord(response,consumablesOutRecordDto);
     }
 
 }
diff --git a/src/main/java/com/ruoyi/consumables/controller/ConsumablesUnInventoryController.java b/src/main/java/com/ruoyi/consumables/controller/ConsumablesUnInventoryController.java
index 3beb689..89c8481 100644
--- a/src/main/java/com/ruoyi/consumables/controller/ConsumablesUnInventoryController.java
+++ b/src/main/java/com/ruoyi/consumables/controller/ConsumablesUnInventoryController.java
@@ -33,8 +33,8 @@
     @GetMapping("/pageConsumablesUnInventory")
     @ApiOperation("鍒嗛〉鏌ヨ搴撳瓨")
     public R pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto consumablesUnInventoryDto) {
-        IPage<ConsumablesUnInventoryDto> ConsumablesUnInventoryDtoIPage = consumablesUnInventoryService.pageConsumablesUnInventory(page, consumablesUnInventoryDto);
-        return R.ok(ConsumablesUnInventoryDtoIPage);
+        IPage<ConsumablesUnInventoryDto> consumablesUnInventoryDtoIPage = consumablesUnInventoryService.pageConsumablesUnInventory(page, consumablesUnInventoryDto);
+        return R.ok(consumablesUnInventoryDtoIPage);
     }
 
     @PostMapping("/addConsumablesUnInventory")
diff --git a/src/main/java/com/ruoyi/consumables/mapper/ConsumablesInventoryMapper.java b/src/main/java/com/ruoyi/consumables/mapper/ConsumablesInventoryMapper.java
index 880af3a..fc242fc 100644
--- a/src/main/java/com/ruoyi/consumables/mapper/ConsumablesInventoryMapper.java
+++ b/src/main/java/com/ruoyi/consumables/mapper/ConsumablesInventoryMapper.java
@@ -36,9 +36,9 @@
 
     List<ConsumablesInventoryExportData> listConsumablesInventoryExportData(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto);
 
-    IPage<ConsumablesInRecordDto> ConsumablesInventoryPage(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto, Page page);
+    IPage<ConsumablesInRecordDto> consumablesInventoryPage(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto, Page page);
 
-    IPage<ConsumablesInventoryDto> ConsumablesInAndOutRecord(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto, Page page);
+    IPage<ConsumablesInventoryDto> consumablesInAndOutRecord(@Param("ew") ConsumablesInventoryDto ConsumablesInventoryDto, Page page);
 
     BigDecimal selectTotal();
 
diff --git a/src/main/java/com/ruoyi/consumables/mapper/ConsumablesUnInventoryMapper.java b/src/main/java/com/ruoyi/consumables/mapper/ConsumablesUnInventoryMapper.java
index 96dc9a7..74abc9e 100644
--- a/src/main/java/com/ruoyi/consumables/mapper/ConsumablesUnInventoryMapper.java
+++ b/src/main/java/com/ruoyi/consumables/mapper/ConsumablesUnInventoryMapper.java
@@ -22,11 +22,11 @@
 @Mapper
 public interface ConsumablesUnInventoryMapper extends BaseMapper<ConsumablesUnInventory> {
 
-    IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, @Param("ew") ConsumablesUnInventoryDto ConsumablesUnInventoryDto);
+    IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, @Param("ew") ConsumablesUnInventoryDto consumablesUnInventoryDto);
 
-    int updateSubtractConsumablesUnInventory(@Param("ew") ConsumablesUnInventoryDto ConsumablesUnInventoryDto);
+    int updateSubtractConsumablesUnInventory(@Param("ew") ConsumablesUnInventoryDto consumablesUnInventoryDto);
 
-    int updateAddConsumablesUnInventory(@Param("ew") ConsumablesUnInventoryDto ConsumablesUnInventoryDto);
+    int updateAddConsumablesUnInventory(@Param("ew") ConsumablesUnInventoryDto consumablesUnInventoryDto);
 
-    List<ConsumablesUnInventoryExportData> listConsumablesInventoryExportData(@Param("ew") ConsumablesUnInventoryDto ConsumablesUnInventoryDto);
+    List<ConsumablesUnInventoryExportData> listConsumablesInventoryExportData(@Param("ew") ConsumablesUnInventoryDto consumablesUnInventoryDto);
 }
diff --git a/src/main/java/com/ruoyi/consumables/pojo/ConsumablesInRecord.java b/src/main/java/com/ruoyi/consumables/pojo/ConsumablesInRecord.java
index 352c3f3..d970419 100644
--- a/src/main/java/com/ruoyi/consumables/pojo/ConsumablesInRecord.java
+++ b/src/main/java/com/ruoyi/consumables/pojo/ConsumablesInRecord.java
@@ -27,7 +27,7 @@
     private String inboundBatches;
 
     @ApiModelProperty(value = "鍏ュ簱鏁伴噺")
-    private BigDecimal consumablesInNum;
+    private BigDecimal stockInNum;
 
     @ApiModelProperty(value = "璁板綍绫诲瀷  鏋氫妇")
     private String recordType;
diff --git a/src/main/java/com/ruoyi/consumables/pojo/ConsumablesOutRecord.java b/src/main/java/com/ruoyi/consumables/pojo/ConsumablesOutRecord.java
index c34e169..b3711ee 100644
--- a/src/main/java/com/ruoyi/consumables/pojo/ConsumablesOutRecord.java
+++ b/src/main/java/com/ruoyi/consumables/pojo/ConsumablesOutRecord.java
@@ -35,7 +35,7 @@
     private String outboundBatches;
 
     @ApiModelProperty("鍏ュ簱鏁伴噺")
-    private BigDecimal consumablesOutNum;
+    private BigDecimal stockOutNum;
 
     @ApiModelProperty("鍏ュ簱鏉ユ簮id")
     private Long recordId;
@@ -94,4 +94,7 @@
 
     @ApiModelProperty("浜у搧id")
     private Long productId;
+
+    @ApiModelProperty("纾呭崟鏂囦欢璺緞")
+    private String weighbridgeDocPath;
 }
diff --git a/src/main/java/com/ruoyi/consumables/service/ConsumablesOutRecordService.java b/src/main/java/com/ruoyi/consumables/service/ConsumablesOutRecordService.java
index 0b5412c..98aaf08 100644
--- a/src/main/java/com/ruoyi/consumables/service/ConsumablesOutRecordService.java
+++ b/src/main/java/com/ruoyi/consumables/service/ConsumablesOutRecordService.java
@@ -18,13 +18,13 @@
  * @since 2026-01-21 05:27:04
  */
 public interface ConsumablesOutRecordService extends IService<ConsumablesOutRecord> {
-    IPage<ConsumablesOutRecordDto> listPage(Page page, ConsumablesOutRecordDto ConsumablesOutRecordDto);
+    IPage<ConsumablesOutRecordDto> listPage(Page page, ConsumablesOutRecordDto consumablesOutRecordDto);
 
-    int add(ConsumablesOutRecordDto ConsumablesOutRecordDto);
+    int add(ConsumablesOutRecordDto consumablesOutRecordDto);
 
-    int update(Long id, ConsumablesOutRecordDto ConsumablesOutRecordDto);
+    int update(Long id, ConsumablesOutRecordDto consumablesOutRecordDto);
 
     int batchDelete(List<Long> ids);
 
-    void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto ConsumablesOutRecordDto);
+    void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto consumablesOutRecordDto);
 }
diff --git a/src/main/java/com/ruoyi/consumables/service/ConsumablesUnInventoryService.java b/src/main/java/com/ruoyi/consumables/service/ConsumablesUnInventoryService.java
index 645236b..89d3c45 100644
--- a/src/main/java/com/ruoyi/consumables/service/ConsumablesUnInventoryService.java
+++ b/src/main/java/com/ruoyi/consumables/service/ConsumablesUnInventoryService.java
@@ -19,15 +19,15 @@
  */
 public interface ConsumablesUnInventoryService extends IService<ConsumablesUnInventory> {
 
-    IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto ConsumablesUnInventoryDto);
+    IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto consumablesUnInventoryDto);
 
-    Integer addConsumablesUnInventory(ConsumablesUnInventoryDto ConsumablesUnInventoryDto);
+    Integer addConsumablesUnInventory(ConsumablesUnInventoryDto consumablesUnInventoryDto);
 
-    Integer subtractConsumablesUnInventory(ConsumablesUnInventoryDto ConsumablesUnInventoryDto);
+    Integer subtractConsumablesUnInventory(ConsumablesUnInventoryDto consumablesUnInventoryDto);
 
-    void exportConsumablesUnInventory(HttpServletResponse response, ConsumablesUnInventoryDto ConsumablesUnInventoryDto);
+    void exportConsumablesUnInventory(HttpServletResponse response, ConsumablesUnInventoryDto consumablesUnInventoryDto);
 
-    Boolean frozenConsumables(ConsumablesInventoryDto ConsumablesInventoryDto);
+    Boolean frozenConsumables(ConsumablesInventoryDto consumablesInventoryDto);
 
-    Boolean thawConsumables(ConsumablesInventoryDto ConsumablesInventoryDto);
+    Boolean thawConsumables(ConsumablesInventoryDto consumablesInventoryDto);
 }
diff --git a/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInRecordServiceImpl.java b/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInRecordServiceImpl.java
index a5f3d21..0424b5f 100644
--- a/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesInRecordServiceImpl.java
@@ -79,7 +79,7 @@
                 }else {
                     ConsumablesInventoryDto consumablesInRecordDto = new ConsumablesInventoryDto();
                     consumablesInRecordDto.setProductModelId(consumablesInventory.getProductModelId());
-                    consumablesInRecordDto.setQualitity(consumablesInRecord.getConsumablesInNum());
+                    consumablesInRecordDto.setQualitity(consumablesInRecord.getStockInNum());
                     consumablesInventoryMapper.updateSubtractConsumablesInventory(consumablesInRecordDto);
                 }
             }else if (consumablesInRecord.getType().equals("1")) {
@@ -89,7 +89,7 @@
                 }else {
                     ConsumablesUnInventoryDto consumablesUnInventoryDto = new ConsumablesUnInventoryDto();
                     consumablesUnInventoryDto.setProductModelId(consumablesUnInventory.getProductModelId());
-                    consumablesUnInventoryDto.setQualitity(consumablesInRecord.getConsumablesInNum());
+                    consumablesUnInventoryDto.setQualitity(consumablesInRecord.getStockInNum());
                     consumablesUnInventoryMapper.updateSubtractConsumablesUnInventory(consumablesUnInventoryDto);
                 }
             }
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);
     }
 }
diff --git a/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesOutRecordServiceImpl.java b/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesOutRecordServiceImpl.java
index e4c9238..521c6dc 100644
--- a/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesOutRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesOutRecordServiceImpl.java
@@ -18,7 +18,6 @@
 import com.ruoyi.consumables.mapper.ConsumablesInventoryMapper;
 import com.ruoyi.consumables.mapper.ConsumablesOutRecordMapper;
 import com.ruoyi.consumables.mapper.ConsumablesUnInventoryMapper;
-import com.ruoyi.consumables.pojo.ConsumablesInRecord;
 import com.ruoyi.consumables.pojo.ConsumablesInventory;
 import com.ruoyi.consumables.pojo.ConsumablesOutRecord;
 import com.ruoyi.consumables.pojo.ConsumablesUnInventory;
@@ -45,30 +44,28 @@
     private ConsumablesUnInventoryMapper consumablesUnInventoryMapper;
 
     @Override
-    public IPage<ConsumablesOutRecordDto> listPage(Page page, ConsumablesOutRecordDto ConsumablesOutRecordDto) {
-        return consumablesOutRecordMapper.listPage(page, ConsumablesOutRecordDto);
+    public IPage<ConsumablesOutRecordDto> listPage(Page page, ConsumablesOutRecordDto consumablesOutRecordDto) {
+        return consumablesOutRecordMapper.listPage(page, consumablesOutRecordDto);
     }
 
     @Override
-    public int add(ConsumablesOutRecordDto ConsumablesOutRecordDto) {
+    public int add(ConsumablesOutRecordDto consumablesOutRecordDto) {
         String no = OrderUtils.countTodayByCreateTime(consumablesOutRecordMapper, "CK");
-        ConsumablesOutRecordDto.setOutboundBatches(no);
-        ConsumablesInRecord ConsumablesInRecord = new ConsumablesInRecord();
-        BeanUtils.copyProperties(ConsumablesOutRecordDto, ConsumablesInRecord);
-        return consumablesOutRecordMapper.insert(ConsumablesOutRecordDto);
+        consumablesOutRecordDto.setOutboundBatches(no);
+        return consumablesOutRecordMapper.insert(consumablesOutRecordDto);
     }
 
     @Override
-    public int update(Long id, ConsumablesOutRecordDto ConsumablesOutRecordDto) {
+    public int update(Long id, ConsumablesOutRecordDto consumablesOutRecordDto) {
         // 鍒ゆ柇瀵硅薄鏄惁瀛樺湪
-        ConsumablesOutRecord ConsumablesOutRecord = consumablesOutRecordMapper.selectById(id);
-        if (ConsumablesOutRecord == null){
+        ConsumablesOutRecord consumablesOutRecord = consumablesOutRecordMapper.selectById(id);
+        if (consumablesOutRecord == null){
             throw new BaseException("璇ュ嚭搴撹褰曚笉瀛樺湪,鏃犳硶鏇存柊!!!");
         }
 
         String[] ignoreProperties = {"id", "outbound_batches"};//鎺掗櫎id灞炴��
-        BeanUtils.copyProperties(ConsumablesOutRecordDto, ConsumablesOutRecord, ignoreProperties);
-        return consumablesOutRecordMapper.updateById(ConsumablesOutRecord);
+        BeanUtils.copyProperties(consumablesOutRecordDto, consumablesOutRecord, ignoreProperties);
+        return consumablesOutRecordMapper.updateById(consumablesOutRecord);
     }
 
     @Override
@@ -82,7 +79,7 @@
                 }else {
                     ConsumablesInventoryDto consumablesInRecordDto = new ConsumablesInventoryDto();
                     consumablesInRecordDto.setProductModelId(consumablesInventory.getProductModelId());
-                    consumablesInRecordDto.setQualitity(consumablesOutRecord.getConsumablesOutNum());
+                    consumablesInRecordDto.setQualitity(consumablesOutRecord.getStockOutNum());
                     consumablesInventoryMapper.updateAddConsumablesInventory(consumablesInRecordDto);
                 }
             }else if (consumablesOutRecord.getType().equals("1")) {
@@ -92,7 +89,7 @@
                 }else {
                     ConsumablesUnInventoryDto consumablesUnInventoryDto = new ConsumablesUnInventoryDto();
                     consumablesUnInventoryDto.setProductModelId(consumablesUnInventory.getProductModelId());
-                    consumablesUnInventoryDto.setQualitity(consumablesOutRecord.getConsumablesOutNum());
+                    consumablesUnInventoryDto.setQualitity(consumablesOutRecord.getStockOutNum());
                     consumablesUnInventoryMapper.updateAddConsumablesUnInventory(consumablesUnInventoryDto);
                 }
             }
@@ -101,8 +98,8 @@
     }
 
     @Override
-    public void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto ConsumablesOutRecordDto) {
-        List<ConsumablesOutRecordExportData> list = consumablesOutRecordMapper.listConsumablesOutRecordExportData(ConsumablesOutRecordDto);
+    public void exportConsumablesOutRecord(HttpServletResponse response, ConsumablesOutRecordDto consumablesOutRecordDto) {
+        List<ConsumablesOutRecordExportData> list = consumablesOutRecordMapper.listConsumablesOutRecordExportData(consumablesOutRecordDto);
         for (ConsumablesOutRecordExportData consumablesInRecordExportData : list) {
             if (consumablesInRecordExportData.getType().equals("0")) {
                 consumablesInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(consumablesInRecordExportData.getRecordType())).getValue());
diff --git a/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesUnInventoryServiceImpl.java b/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesUnInventoryServiceImpl.java
index a504657..48217d6 100644
--- a/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesUnInventoryServiceImpl.java
+++ b/src/main/java/com/ruoyi/consumables/service/impl/ConsumablesUnInventoryServiceImpl.java
@@ -35,91 +35,91 @@
 @AllArgsConstructor
 public class ConsumablesUnInventoryServiceImpl extends ServiceImpl<ConsumablesUnInventoryMapper, ConsumablesUnInventory> implements ConsumablesUnInventoryService {
 
-    private ConsumablesUnInventoryMapper ConsumablesUnInventoryMapper;
+    private ConsumablesUnInventoryMapper consumablesUnInventoryMapper;
     private ConsumablesOutRecordService ConsumablesOutRecordService;
     private ConsumablesInRecordService ConsumablesInRecordService;
 
     @Override
-    public IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto ConsumablesUnInventoryDto) {
-        return ConsumablesUnInventoryMapper.pageConsumablesUnInventory(page, ConsumablesUnInventoryDto);
+    public IPage<ConsumablesUnInventoryDto> pageConsumablesUnInventory(Page page, ConsumablesUnInventoryDto consumablesUnInventoryDto) {
+        return consumablesUnInventoryMapper.pageConsumablesUnInventory(page, consumablesUnInventoryDto);
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Integer addConsumablesUnInventory(ConsumablesUnInventoryDto ConsumablesUnInventoryDto) {
+    public Integer addConsumablesUnInventory(ConsumablesUnInventoryDto consumablesUnInventoryDto) {
         //鏂板鍏ュ簱璁板綍鍐嶆坊鍔犲簱瀛�
-        ConsumablesInRecordDto ConsumablesInRecordDto = new ConsumablesInRecordDto();
-        ConsumablesInRecordDto.setRecordId(ConsumablesUnInventoryDto.getRecordId());
-        ConsumablesInRecordDto.setRecordType(ConsumablesUnInventoryDto.getRecordType());
-        ConsumablesInRecordDto.setConsumablesInNum(ConsumablesUnInventoryDto.getQualitity());
-        ConsumablesInRecordDto.setProductModelId(ConsumablesUnInventoryDto.getProductModelId());
-        ConsumablesInRecordDto.setType("1");
-        ConsumablesInRecordService.add(ConsumablesInRecordDto);
+        ConsumablesInRecordDto consumablesInRecordDto = new ConsumablesInRecordDto();
+        consumablesInRecordDto.setRecordId(consumablesUnInventoryDto.getRecordId());
+        consumablesInRecordDto.setRecordType(consumablesUnInventoryDto.getRecordType());
+        consumablesInRecordDto.setStockInNum(consumablesUnInventoryDto.getQualitity());
+        consumablesInRecordDto.setProductModelId(consumablesUnInventoryDto.getProductModelId());
+        consumablesInRecordDto.setType("1");
+        ConsumablesInRecordService.add(consumablesInRecordDto);
         //鍐嶈繘琛屾柊澧炲簱瀛樻暟閲忓簱瀛�
         //鍏堟煡璇㈠簱瀛樿〃涓殑浜у搧鏄惁瀛樺湪锛屼笉瀛樺湪鏂板锛屽瓨鍦ㄦ洿鏂�
-        ConsumablesUnInventory oldConsumablesUnInventory = ConsumablesUnInventoryMapper.selectOne(new QueryWrapper<ConsumablesUnInventory>().lambda().eq(ConsumablesUnInventory::getProductModelId, ConsumablesUnInventoryDto.getProductModelId()));
+        ConsumablesUnInventory oldConsumablesUnInventory = consumablesUnInventoryMapper.selectOne(new QueryWrapper<ConsumablesUnInventory>().lambda().eq(ConsumablesUnInventory::getProductModelId, consumablesUnInventoryDto.getProductModelId()));
         if (ObjectUtils.isEmpty(oldConsumablesUnInventory)) {
             ConsumablesUnInventory newConsumablesUnInventory = new ConsumablesUnInventory();
-            newConsumablesUnInventory.setProductModelId(ConsumablesUnInventoryDto.getProductModelId());
-            newConsumablesUnInventory.setQualitity(ConsumablesUnInventoryDto.getQualitity());
+            newConsumablesUnInventory.setProductModelId(consumablesUnInventoryDto.getProductModelId());
+            newConsumablesUnInventory.setQualitity(consumablesUnInventoryDto.getQualitity());
             newConsumablesUnInventory.setVersion(1);
-            newConsumablesUnInventory.setRemark(ConsumablesUnInventoryDto.getRemark());
-            ConsumablesUnInventoryMapper.insert(newConsumablesUnInventory);
+            newConsumablesUnInventory.setRemark(consumablesUnInventoryDto.getRemark());
+            consumablesUnInventoryMapper.insert(newConsumablesUnInventory);
         }else {
-            ConsumablesUnInventoryMapper.updateAddConsumablesUnInventory(ConsumablesUnInventoryDto);
+            consumablesUnInventoryMapper.updateAddConsumablesUnInventory(consumablesUnInventoryDto);
         }
         return 1;
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Integer subtractConsumablesUnInventory(ConsumablesUnInventoryDto ConsumablesUnInventoryDto) {
+    public Integer subtractConsumablesUnInventory(ConsumablesUnInventoryDto consumablesUnInventoryDto) {
 
         //  鏂板鍑哄簱璁板綍
-        ConsumablesOutRecordDto ConsumablesOutRecordDto = new ConsumablesOutRecordDto();
-        ConsumablesOutRecordDto.setRecordId(ConsumablesUnInventoryDto.getRecordId());
-        ConsumablesOutRecordDto.setRecordType(ConsumablesUnInventoryDto.getRecordType());
-        ConsumablesOutRecordDto.setConsumablesOutNum(ConsumablesUnInventoryDto.getQualitity());
-        ConsumablesOutRecordDto.setProductModelId(ConsumablesUnInventoryDto.getProductModelId());
-        ConsumablesOutRecordDto.setType("1");
-        ConsumablesOutRecordService.add(ConsumablesOutRecordDto);
-        ConsumablesUnInventory oldConsumablesInventory = ConsumablesUnInventoryMapper.selectOne(new QueryWrapper<ConsumablesUnInventory>().lambda().eq(ConsumablesUnInventory::getProductModelId, ConsumablesUnInventoryDto.getProductModelId()));
+        ConsumablesOutRecordDto consumablesOutRecordDto = new ConsumablesOutRecordDto();
+        consumablesOutRecordDto.setRecordId(consumablesUnInventoryDto.getRecordId());
+        consumablesOutRecordDto.setRecordType(consumablesUnInventoryDto.getRecordType());
+        consumablesOutRecordDto.setStockOutNum(consumablesUnInventoryDto.getQualitity());
+        consumablesOutRecordDto.setProductModelId(consumablesUnInventoryDto.getProductModelId());
+        consumablesOutRecordDto.setType("1");
+        ConsumablesOutRecordService.add(consumablesOutRecordDto);
+        ConsumablesUnInventory oldConsumablesInventory = consumablesUnInventoryMapper.selectOne(new QueryWrapper<ConsumablesUnInventory>().lambda().eq(ConsumablesUnInventory::getProductModelId, consumablesUnInventoryDto.getProductModelId()));
         if (ObjectUtils.isEmpty(oldConsumablesInventory)) {
             throw new RuntimeException("浜у搧搴撳瓨涓嶅瓨鍦�");
         }else {
-            ConsumablesUnInventoryMapper.updateSubtractConsumablesUnInventory(ConsumablesUnInventoryDto);
+            consumablesUnInventoryMapper.updateSubtractConsumablesUnInventory(consumablesUnInventoryDto);
         }
         return 1;
     }
 
     @Override
-    public void exportConsumablesUnInventory(HttpServletResponse response, ConsumablesUnInventoryDto ConsumablesUnInventoryDto) {
-        List<ConsumablesUnInventoryExportData> list = ConsumablesUnInventoryMapper.listConsumablesInventoryExportData(ConsumablesUnInventoryDto);
+    public void exportConsumablesUnInventory(HttpServletResponse response, ConsumablesUnInventoryDto consumablesUnInventoryDto) {
+        List<ConsumablesUnInventoryExportData> list = consumablesUnInventoryMapper.listConsumablesInventoryExportData(consumablesUnInventoryDto);
         ExcelUtil<ConsumablesUnInventoryExportData> util = new ExcelUtil<>(ConsumablesUnInventoryExportData.class);
         util.exportExcel(response,list, "涓嶅悎鏍煎簱瀛樹俊鎭�");
     }
 
     @Override
-    public Boolean frozenConsumables(ConsumablesInventoryDto ConsumablesInventoryDto) {
-        ConsumablesUnInventory ConsumablesUnInventory = ConsumablesUnInventoryMapper.selectById(ConsumablesInventoryDto.getId());
-        if (ConsumablesUnInventory.getQualitity().compareTo(ConsumablesInventoryDto.getLockedQuantity())<0) {
+    public Boolean frozenConsumables(ConsumablesInventoryDto consumablesInventoryDto) {
+        ConsumablesUnInventory consumablesUnInventory = consumablesUnInventoryMapper.selectById(consumablesInventoryDto.getId());
+        if (consumablesUnInventory.getQualitity().compareTo(consumablesInventoryDto.getLockedQuantity())<0) {
             throw new RuntimeException("鍐荤粨鏁伴噺涓嶈兘瓒呰繃搴撳瓨鏁伴噺");
         }
-        if (ObjectUtils.isEmpty(ConsumablesUnInventory.getLockedQuantity())) {
-            ConsumablesUnInventory.setLockedQuantity(ConsumablesInventoryDto.getLockedQuantity());
+        if (ObjectUtils.isEmpty(consumablesUnInventory.getLockedQuantity())) {
+            consumablesUnInventory.setLockedQuantity(consumablesInventoryDto.getLockedQuantity());
         }else {
-            ConsumablesUnInventory.setLockedQuantity(ConsumablesUnInventory.getLockedQuantity().add(ConsumablesInventoryDto.getLockedQuantity()));
+            consumablesUnInventory.setLockedQuantity(consumablesUnInventory.getLockedQuantity().add(consumablesInventoryDto.getLockedQuantity()));
         }
-        return this.updateById(ConsumablesUnInventory);
+        return this.updateById(consumablesUnInventory);
     }
 
     @Override
-    public Boolean thawConsumables(ConsumablesInventoryDto ConsumablesInventoryDto) {
-        ConsumablesUnInventory ConsumablesUnInventory = ConsumablesUnInventoryMapper.selectById(ConsumablesInventoryDto.getId());
-        if (ConsumablesUnInventory.getLockedQuantity().compareTo(ConsumablesInventoryDto.getLockedQuantity())<0) {
+    public Boolean thawConsumables(ConsumablesInventoryDto consumablesInventoryDto) {
+        ConsumablesUnInventory consumablesUnInventory = consumablesUnInventoryMapper.selectById(consumablesInventoryDto.getId());
+        if (consumablesUnInventory.getLockedQuantity().compareTo(consumablesInventoryDto.getLockedQuantity())<0) {
             throw new RuntimeException("瑙e喕鏁伴噺涓嶈兘瓒呰繃鍐荤粨鏁伴噺");
         }
-        ConsumablesUnInventory.setLockedQuantity(ConsumablesUnInventory.getLockedQuantity().subtract(ConsumablesInventoryDto.getLockedQuantity()));
-        return this.updateById(ConsumablesUnInventory);
+        consumablesUnInventory.setLockedQuantity(consumablesUnInventory.getLockedQuantity().subtract(consumablesInventoryDto.getLockedQuantity()));
+        return this.updateById(consumablesUnInventory);
     }
 }
diff --git a/src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java b/src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java
index 12cbf81..5eb0764 100644
--- a/src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java
+++ b/src/main/java/com/ruoyi/stock/pojo/StockOutRecord.java
@@ -94,4 +94,7 @@
 
     @ApiModelProperty("浜у搧id")
     private Long productId;
+
+    @ApiModelProperty("纾呭崟鏂囦欢璺緞")
+    private String weighbridgeDocPath;
 }
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..ce432d5 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;
@@ -71,6 +72,7 @@
         stockInRecordDto.setWeighingOperator(stockInventoryDto.getWeighingOperator());
         stockInRecordDto.setProductModelId(stockInventoryDto.getProductModelId());
         stockInRecordDto.setProductId(stockInventoryDto.getProductId());
+        stockInRecordDto.setRemark(stockInventoryDto.getRemark());
         stockInRecordDto.setType("0");
         //鐢熸垚纾呭崟
         String absoluteDocPath = weighbridgeDocGenerator.generateWeighbridgeDoc(stockInRecordDto);
@@ -87,6 +89,7 @@
             newStockInventory.setRemark(stockInventoryDto.getRemark());
             newStockInventory.setLockedQuantity(stockInventoryDto.getLockedQuantity());
             newStockInventory.setWarnNum(stockInventoryDto.getWarnNum());
+            newStockInventory.setProductId(stockInventoryDto.getProductId());
             stockInventoryMapper.insert(newStockInventory);
         } else {
             stockInventoryDto.setQualitity(stockInventoryDto.getNetWeight());
@@ -103,7 +106,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 +115,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)) {
diff --git a/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java b/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
index e01fe5d..cc299f1 100644
--- a/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
+++ b/src/main/java/com/ruoyi/stock/service/impl/StockOutRecordServiceImpl.java
@@ -4,8 +4,8 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
 import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum;
+import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum;
 import com.ruoyi.common.exception.base.BaseException;
 import com.ruoyi.common.utils.EnumUtil;
 import com.ruoyi.common.utils.OrderUtils;
@@ -18,7 +18,6 @@
 import com.ruoyi.stock.mapper.StockInventoryMapper;
 import com.ruoyi.stock.mapper.StockOutRecordMapper;
 import com.ruoyi.stock.mapper.StockUninventoryMapper;
-import com.ruoyi.stock.pojo.StockInRecord;
 import com.ruoyi.stock.pojo.StockInventory;
 import com.ruoyi.stock.pojo.StockOutRecord;
 import com.ruoyi.stock.pojo.StockUninventory;
@@ -53,8 +52,6 @@
     public int add(StockOutRecordDto stockOutRecordDto) {
         String no = OrderUtils.countTodayByCreateTime(stockOutRecordMapper, "CK");
         stockOutRecordDto.setOutboundBatches(no);
-        StockInRecord stockInRecord = new StockInRecord();
-        BeanUtils.copyProperties(stockOutRecordDto, stockInRecord);
         return stockOutRecordMapper.insert(stockOutRecordDto);
     }
 
diff --git a/src/main/java/com/ruoyi/stock/word/WeighbridgeDocGenerator.java b/src/main/java/com/ruoyi/stock/word/WeighbridgeDocGenerator.java
index feafdd0..f13a3d5 100644
--- a/src/main/java/com/ruoyi/stock/word/WeighbridgeDocGenerator.java
+++ b/src/main/java/com/ruoyi/stock/word/WeighbridgeDocGenerator.java
@@ -5,6 +5,7 @@
 import com.ruoyi.stock.dto.StockInRecordDto;
 import org.apache.poi.xwpf.usermodel.*;
 import org.apache.poi.xwpf.usermodel.XWPFTable.XWPFBorderType;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
@@ -13,6 +14,7 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 
@@ -61,7 +63,7 @@
             document.write(out);
             out.flush();
 
-            // 杩斿洖缁濆璺緞锛堢敤浜庢暟鎹簱瀛樺偍锛�
+            // 杩斿洖缁濆璺緞
             return absolutePath;
 
         } catch (Exception e) {
@@ -84,9 +86,22 @@
 
     /**
      * 鏋勫缓鏂囨。鍐呭
+     * @param document Word鏂囨。瀵硅薄
+     * @param dto 鍏ュ簱璁板綍DTO
      */
     private void buildDocumentContent(XWPFDocument document, StockInRecordDto dto) {
-        // 1. 娣诲姞鏍囬 "纾呯爜鍗�" - 浣跨敤榛戜綋
+
+        // 璁剧疆绾稿紶澶у皬涓篈5妯悜
+        CTSectPr sectPr = document.getDocument().getBody().isSetSectPr()
+                ? document.getDocument().getBody().getSectPr()
+                : document.getDocument().getBody().addNewSectPr();
+
+        CTPageSz pageSize = sectPr.isSetPgSz() ? sectPr.getPgSz() : sectPr.addNewPgSz();
+        pageSize.setW(BigInteger.valueOf(11906));  // A5妯悜瀹藉害 210mm
+        pageSize.setH(BigInteger.valueOf(8392));   // A5妯悜楂樺害 148mm
+        pageSize.setOrient(STPageOrientation.LANDSCAPE);
+
+        // 鏍囬 "纾呯爜鍗�"
         XWPFParagraph titlePara = document.createParagraph();
         titlePara.setAlignment(ParagraphAlignment.CENTER);
         titlePara.setSpacingAfter(200);
@@ -97,22 +112,71 @@
         titleRun.setFontSize(28);
         titleRun.setFontFamily("榛戜綋");
 
-        // 2. 绌轰竴琛�
-        document.createParagraph();
+        // 瀹氫箟缁熶竴鐨勯〉闈㈠搴﹀�硷紙鎵�鏈夎〃鏍间娇鐢ㄧ浉鍚岀殑鎬诲搴︼級
+        int pageWidth = 9000; // 缁熶竴鐨勯〉闈㈠搴﹀��
 
-        // 3. 澶撮儴淇℃伅锛堝勾鏈堟棩鍜岃閲忓崟浣嶅悎骞跺湪涓�琛岋級- 浣跨敤瀹嬩綋
-        XWPFParagraph headerPara = document.createParagraph();
-        headerPara.setSpacingAfter(200);
-        XWPFRun headerRun = headerPara.createRun();
+        // 鍒涘缓涓�琛屼袱鍒楄〃鏍兼潵鏀剧疆鏃ユ湡鍜岃閲忓崟浣�
+        XWPFTable headerTable = document.createTable(1, 2);
+        headerTable.setWidth("100%");
 
-        // 鏍煎紡鍖栨棩鏈熶负 yyyy-MM-dd
+        // 璁剧疆琛ㄦ牸鏃犺竟妗�
+        headerTable.setInsideHBorder(XWPFBorderType.NONE, 0, 0, "000000");
+        headerTable.setInsideVBorder(XWPFBorderType.NONE, 0, 0, "000000");
+        headerTable.setTopBorder(XWPFBorderType.NONE, 0, 0, "000000");
+        headerTable.setBottomBorder(XWPFBorderType.NONE, 0, 0, "000000");
+        headerTable.setLeftBorder(XWPFBorderType.NONE, 0, 0, "000000");
+        headerTable.setRightBorder(XWPFBorderType.NONE, 0, 0, "000000");
+
+        // 璁剧疆琛ㄥご琛ㄦ牸鍒楀锛氭棩鏈熷垪50%锛岃閲忓崟浣嶅垪50%
+        CTTbl headerTbl = headerTable.getCTTbl();
+        CTTblGrid headerTblGrid = headerTbl.addNewTblGrid();
+
+        // 浣跨敤缁熶竴鐨勯〉闈㈠搴�
+        int headerColWidth = pageWidth / 2; // 4500
+
+        CTTblGridCol col1 = headerTblGrid.addNewGridCol();
+        col1.setW(BigInteger.valueOf(headerColWidth));
+
+        CTTblGridCol col2 = headerTblGrid.addNewGridCol();
+        col2.setW(BigInteger.valueOf(headerColWidth));
+
+        // 璁剧疆琛岄珮
+        headerTable.getRow(0).setHeight(300);
+
+        // 涓鸿〃澶磋〃鏍肩殑姣忎釜鍗曞厓鏍艰缃搴�
+        for (int colIndex = 0; colIndex < 2; colIndex++) {
+            XWPFTableCell cell = headerTable.getRow(0).getCell(colIndex);
+            CTTcPr tcPr = cell.getCTTc().addNewTcPr();
+            CTTblWidth cellWidth = tcPr.addNewTcW();
+            cellWidth.setType(STTblWidth.DXA);
+            cellWidth.setW(BigInteger.valueOf(headerColWidth));
+        }
+
+        // 宸︿晶鍗曞厓鏍硷細鏃ユ湡锛堝乏瀵归綈锛�
+        XWPFTableCell dateCell = headerTable.getRow(0).getCell(0);
+        dateCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
+
+        // 娓呴櫎鍗曞厓鏍间腑鍙兘瀛樺湪鐨勯粯璁ゆ钀�
+        for (int i = dateCell.getParagraphs().size() - 1; i > 0; i--) {
+            dateCell.removeParagraph(i);
+        }
+
+        XWPFParagraph datePara = dateCell.getParagraphs().get(0);
+        datePara.setAlignment(ParagraphAlignment.LEFT);
+
+        // 娓呴櫎娈佃惤涓彲鑳藉瓨鍦ㄧ殑榛樿Run
+        for (int i = datePara.getRuns().size() - 1; i > 0; i--) {
+            datePara.removeRun(i);
+        }
+
+        XWPFRun dateRun = datePara.createRun();
+
+        // 鏍煎紡鍖栨棩鏈�
         String weighDate = "";
         if (dto.getWeighingDate() != null) {
             try {
-                // 鍋囪 weighingDate 鏄� LocalDateTime 绫诲瀷
                 weighDate = dto.getWeighingDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
             } catch (Exception e) {
-                // 濡傛灉鏄瓧绗︿覆绫诲瀷锛屽皾璇曡浆鎹�
                 weighDate = dto.getWeighingDate().toString();
                 if (weighDate.length() > 10) {
                     weighDate = weighDate.substring(0, 10);
@@ -120,17 +184,37 @@
             }
         }
 
-        headerRun.setText("骞存湀鏃ワ細" + weighDate + "    璁¢噺鍗曚綅锛氾紙鍚級");
-        headerRun.setFontSize(12);
-        headerRun.setFontFamily("瀹嬩綋");
+        dateRun.setText("鏃� 鏈燂細" + weighDate);
+        dateRun.setFontSize(12);
+        dateRun.setFontFamily("瀹嬩綋");
 
-        // 4. 鍒涘缓涓昏〃鏍� - 4琛�6鍒楋紙琛ㄥご1琛�+鏁版嵁1琛�+鍚堣1琛�+绌鸿1琛岋級
-        XWPFTable table = document.createTable(4, 6);
+        // 璁¢噺鍗曚綅锛堝彸瀵归綈锛�
+        XWPFTableCell unitCell = headerTable.getRow(0).getCell(1);
+        unitCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
+
+        for (int i = unitCell.getParagraphs().size() - 1; i > 0; i--) {
+            unitCell.removeParagraph(i);
+        }
+
+        XWPFParagraph unitPara = unitCell.getParagraphs().get(0);
+        unitPara.setAlignment(ParagraphAlignment.RIGHT);
+
+        for (int i = unitPara.getRuns().size() - 1; i > 0; i--) {
+            unitPara.removeRun(i);
+        }
+
+        XWPFRun unitRun = unitPara.createRun();
+        unitRun.setText("璁¢噺鍗曚綅锛氾紙鍚級");
+        unitRun.setFontSize(12);
+        unitRun.setFontFamily("瀹嬩綋");
+
+        // 鍒涘缓涓昏〃鏍� - 3琛�6鍒�
+        XWPFTable table = document.createTable(3, 6);
 
         // 璁剧疆琛ㄦ牸瀹藉害
         table.setWidth("100%");
 
-        // 璁剧疆琛ㄦ牸杈规鍔犵矖锛堣竟妗嗗搴﹁涓�2锛�
+        // 璁剧疆琛ㄦ牸杈规鍔犵矖
         table.setInsideHBorder(XWPFBorderType.SINGLE, 2, 0, "000000");
         table.setInsideVBorder(XWPFBorderType.SINGLE, 2, 0, "000000");
         table.setTopBorder(XWPFBorderType.SINGLE, 2, 0, "000000");
@@ -142,7 +226,47 @@
         table.getRow(0).setHeight(400);
         table.getRow(1).setHeight(400);
         table.getRow(2).setHeight(400);
-        table.getRow(3).setHeight(400);
+
+        // 璁剧疆涓昏〃鏍煎垪瀹界綉鏍� - 浣跨敤鐩稿悓鐨勬�诲搴� pageWidth
+        CTTbl mainTbl = table.getCTTbl();
+        CTTblGrid mainTblGrid = mainTbl.addNewTblGrid();
+
+        // 鍒楀姣斾緥
+        int[] colWidths = {
+                (int)(pageWidth * 0.20),
+                (int)(pageWidth * 0.24),
+                (int)(pageWidth * 0.14),
+                (int)(pageWidth * 0.14),
+                (int)(pageWidth * 0.14),
+                (int)(pageWidth * 0.14)
+        };
+
+        // 纭繚鎬诲拰绛変簬pageWidth
+        int sum = 0;
+        for (int width : colWidths) {
+            sum += width;
+        }
+        // 濡傛灉鏈夎宸紝璋冩暣鏈�鍚庝竴鍒�
+        if (sum != pageWidth) {
+            colWidths[5] += (pageWidth - sum);
+        }
+
+        for (int width : colWidths) {
+            CTTblGridCol col = mainTblGrid.addNewGridCol();
+            col.setW(BigInteger.valueOf(width));
+        }
+
+        // 涓烘瘡涓�琛岀殑姣忎釜鍗曞厓鏍艰缃叿浣撶殑瀹藉害
+        for (int rowIndex = 0; rowIndex < 3; rowIndex++) {
+            XWPFTableRow row = table.getRow(rowIndex);
+            for (int colIndex = 0; colIndex < 6; colIndex++) {
+                XWPFTableCell cell = row.getCell(colIndex);
+                CTTcPr tcPr = cell.getCTTc().addNewTcPr();
+                CTTblWidth cellWidth = tcPr.addNewTcW();
+                cellWidth.setType(STTblWidth.DXA);
+                cellWidth.setW(BigInteger.valueOf(colWidths[colIndex]));
+            }
+        }
 
         // 璁剧疆琛ㄥご - 浣跨敤榛戜綋鍔犵矖
         String[] headers = {"杞﹀彿", "鍝佸悕", "姣涢噸", "鐨噸", "鍑�閲�", "澶囨敞"};
@@ -152,8 +276,18 @@
             cell.setText(headers[i]);
             cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
 
+            // 娓呴櫎鍙兘瀛樺湪鐨勫浣欐钀�
+            while (cell.getParagraphs().size() > 1) {
+                cell.removeParagraph(1);
+            }
+
             XWPFParagraph cellPara = cell.getParagraphs().get(0);
             cellPara.setAlignment(ParagraphAlignment.CENTER);
+
+            while (cellPara.getRuns().size() > 1) {
+                cellPara.removeRun(1);
+            }
+
             XWPFRun cellRun = cellPara.getRuns().get(0);
             cellRun.setBold(true);
             cellRun.setFontSize(12);
@@ -180,8 +314,17 @@
             cell.setText(data[i]);
             cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
 
+            while (cell.getParagraphs().size() > 1) {
+                cell.removeParagraph(1);
+            }
+
             XWPFParagraph cellPara = cell.getParagraphs().get(0);
             cellPara.setAlignment(ParagraphAlignment.CENTER);
+
+            while (cellPara.getRuns().size() > 1) {
+                cellPara.removeRun(1);
+            }
+
             XWPFRun cellRun = cellPara.getRuns().get(0);
             cellRun.setFontSize(12);
             cellRun.setFontFamily("瀹嬩綋");
@@ -194,43 +337,68 @@
         XWPFTableCell totalLabelCell = totalRow.getCell(0);
         totalLabelCell.setText("鍚堣锛堝ぇ鍐欙級");
         totalLabelCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
+
+        // 娓呴櫎鍙兘瀛樺湪鐨勫浣欐钀�
+        while (totalLabelCell.getParagraphs().size() > 1) {
+            totalLabelCell.removeParagraph(1);
+        }
+
         XWPFParagraph totalLabelPara = totalLabelCell.getParagraphs().get(0);
         totalLabelPara.setAlignment(ParagraphAlignment.CENTER);
+
+        // 娓呴櫎鍙兘瀛樺湪鐨勫浣橰un
+        while (totalLabelPara.getRuns().size() > 1) {
+            totalLabelPara.removeRun(1);
+        }
+
         XWPFRun totalLabelRun = totalLabelPara.getRuns().get(0);
         totalLabelRun.setBold(true);
         totalLabelRun.setFontSize(12);
-        totalLabelRun.setFontFamily("瀹嬩綋");
+        totalLabelRun.setFontFamily("榛戜綋");
 
-
-        XWPFTableCell contentCell = totalRow.getCell(1);
+        // 灏嗗噣閲嶈浆鎹负澶у啓
         String netWeightChinese = ChineseNumberUtil.numberToChinese(
                 dto.getNetWeight() != null ? dto.getNetWeight() : BigDecimal.ZERO
         );
-        contentCell.setText(netWeightChinese + "鍚�");
-        contentCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
-        XWPFParagraph contentPara = contentCell.getParagraphs().get(0);
-        contentPara.setAlignment(ParagraphAlignment.LEFT);
-        XWPFRun contentRun = contentPara.getRuns().get(0);
-        contentRun.setFontSize(12);
-        contentRun.setFontFamily("瀹嬩綋");
 
-        // 鍚堝苟绗�3-6鍒楀埌绗�2鍒�
-        for (int i = 2; i < 6; i++) {
-            XWPFTableCell cell = totalRow.getCell(i);
-            // 璁剧疆杩欎簺鍗曞厓鏍间负鍚堝苟鐘舵�侊紙缁ф壙鑷2鍒楋級
-            cell.getCTTc().addNewTcPr().addNewHMerge().setVal(org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge.CONTINUE);
+        XWPFTableCell startCell = totalRow.getCell(1);
+        startCell.setText(netWeightChinese + "鍚�");
+        startCell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER);
+
+        while (startCell.getParagraphs().size() > 1) {
+            startCell.removeParagraph(1);
         }
 
-        // 6. 鍒涘缓杩囩鍛樿锛堝崟鐙竴琛岋紝宸﹀榻愶級
+        XWPFParagraph startPara = startCell.getParagraphs().get(0);
+        startPara.setAlignment(ParagraphAlignment.CENTER);
+
+        while (startPara.getRuns().size() > 1) {
+            startPara.removeRun(1);
+        }
+
+        XWPFRun startRun = startPara.getRuns().get(0);
+        startRun.setFontSize(12);
+        startRun.setFontFamily("瀹嬩綋");
+
+        // 鏍囪绗�2鍒椾负鍚堝苟璧峰
+        startCell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.RESTART);
+
+        // 绗�3-6鍒楀悎骞�
+        for (int i = 2; i < 6; i++) {
+            XWPFTableCell cell = totalRow.getCell(i);
+            cell.setText("");
+            cell.getCTTc().addNewTcPr().addNewHMerge().setVal(STMerge.CONTINUE);
+        }
+
+        // 鍒涘缓杩囩鍛樿锛堝崟鐙竴琛岋紝宸﹀榻愶級
         XWPFParagraph operatorPara = document.createParagraph();
         operatorPara.setSpacingAfter(100);
         operatorPara.setAlignment(ParagraphAlignment.LEFT);
         XWPFRun operatorRun = operatorPara.createRun();
         String operator = dto.getWeighingOperator() != null ? dto.getWeighingOperator() : "";
         operatorRun.setText("杩囩鍛橈細" + operator);
-        operatorRun.setFontSize(8);
+        operatorRun.setFontSize(12);
         operatorRun.setFontFamily("瀹嬩綋");
-
     }
 
     /**
@@ -242,10 +410,10 @@
         String month = String.format("%02d", now.getMonthValue());
         String day = String.format("%02d", now.getDayOfMonth());
 
-        // 鏂囦欢鍚嶆牸寮忥細纾呭崟_杞︾墝鍙穇骞存湀鏃ユ椂鍒嗙.docx
+        // 鏂囦欢鍚嶆牸寮忥細纾呭崟_杞︾墝鍙穇骞存湀鏃�.docx
         String fileName = String.format("纾呭崟_%s_%s.docx",
                 dto.getLicensePlateNo() != null ? dto.getLicensePlateNo() : "鏈煡杞︾墝",
-                now.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")));
+                now.format(DateTimeFormatter.ofPattern("yyyyMMdd")));
 
         return uploadDir + File.separator + year + File.separator + month + File.separator + day + File.separator + fileName;
     }
diff --git a/src/main/resources/mapper/consumables/ConsumablesInRecordMapper.xml b/src/main/resources/mapper/consumables/ConsumablesInRecordMapper.xml
index 695e611..3c6ff81 100644
--- a/src/main/resources/mapper/consumables/ConsumablesInRecordMapper.xml
+++ b/src/main/resources/mapper/consumables/ConsumablesInRecordMapper.xml
@@ -8,6 +8,7 @@
         p.product_name as product_name,
         pm.model,
         pm.unit,
+        sir.weighbridge_doc_path,
         u.nick_name as createBy
         FROM consumables_in_record as sir
         LEFT JOIN product_model as pm on sir.product_model_id = pm.id
diff --git a/src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml b/src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml
index 2940d56..da58179 100644
--- a/src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml
+++ b/src/main/resources/mapper/consumables/ConsumablesInventoryMapper.xml
@@ -14,8 +14,11 @@
         <result column="warn_num" property="warnNum"/>
     </resultMap>
     <update id="updateAddConsumablesInventory">
-        update Consumables_inventory
+        update consumables_inventory
         <set>
+            <if test="ew.productId != null">
+                product_id = #{ew.productId},
+            </if>
             <if test="ew.qualitity != null">
                 qualitity = qualitity + #{ew.qualitity},
             </if>
@@ -37,7 +40,7 @@
         where product_model_id = #{ew.productModelId}
     </update>
     <update id="updateSubtractConsumablesInventory">
-        update Consumables_inventory
+        update consumables_inventory
         <set>
             <if test="ew.netWeight != null">
                 qualitity = qualitity - #{ew.netWeight},
@@ -71,9 +74,9 @@
         pm.unit,
         p.product_name,
         p1.product_name as parent_name,
-        p1.id as parent_id
-
-        from Consumables_inventory si
+        p1.id as parent_id,
+        si.product_id as productId
+        from consumables_inventory si
         left join product_model pm on si.product_model_id = pm.id
         left join product p on pm.product_id = p.id
         left join product p1 on p.parent_id = p1.id
@@ -114,7 +117,7 @@
         coalesce(si.locked_quantity, 0) as locked_quantity,
         si.remark,
         si.update_time
-        from Consumables_inventory si
+        from consumables_inventory si
         left join product_model pm on si.product_model_id = pm.id
         left join product p on pm.product_id = p.id
         where 1 = 1
@@ -123,10 +126,10 @@
         </if>
     </select>
 
-    <select id="ConsumablesInventoryPage" resultType="com.ruoyi.consumables.dto.ConsumablesInRecordDto">
+    <select id="consumablesInventoryPage" resultType="com.ruoyi.consumables.dto.ConsumablesInRecordDto">
         select
         sir.*,
-        si.qualitity as current_Consumables,
+        si.qualitity as current_consumables,
         pm.model,
         pm.unit,
         p.product_name,
@@ -137,7 +140,7 @@
 
         from Consumables_in_record sir
 
-        left join Consumables_inventory si
+        left join consumables_inventory si
         on sir.product_model_id = si.product_model_id
 
         left join product_model pm
@@ -183,12 +186,12 @@
         </where>
     </select>
 
-    <select id="ConsumablesInAndOutRecord" resultType="com.ruoyi.consumables.dto.ConsumablesInventoryDto">
+    <select id="consumablesInAndOutRecord" resultType="com.ruoyi.consumables.dto.ConsumablesInventoryDto">
         SELECT
         pm.model,
         pm.unit,
         p.product_name,
-        MAX(current_inventory) as current_Consumables,
+        MAX(current_inventory) as current_consumables,
         SUM(CASE WHEN record_type = 'in' THEN amount ELSE 0 END) as total_Consumables_in,
         SUM(CASE WHEN record_type = 'out' THEN amount ELSE 0 END) as total_Consumables_out
         FROM (
@@ -197,7 +200,7 @@
         SUM(qualitity) as current_inventory,
         0 as amount,
         '' as record_type
-        FROM Consumables_inventory
+        FROM consumables_inventory
         GROUP BY product_model_id
 
         UNION ALL
diff --git a/src/main/resources/mapper/consumables/ConsumablesOutRecordMapper.xml b/src/main/resources/mapper/consumables/ConsumablesOutRecordMapper.xml
index cb70944..71648cd 100644
--- a/src/main/resources/mapper/consumables/ConsumablesOutRecordMapper.xml
+++ b/src/main/resources/mapper/consumables/ConsumablesOutRecordMapper.xml
@@ -6,7 +6,7 @@
     <resultMap id="BaseResultMap" type="com.ruoyi.consumables.pojo.ConsumablesOutRecord">
         <id column="id" property="id" />
         <result column="outbound_batches" property="outboundBatches" />
-        <result column="Consumables_out_num" property="consumablesOutNum" />
+        <result column="stock_out_num" property="stockOutNum" />
         <result column="record_id" property="recordId" />
         <result column="record_type" property="recordType" />
         <result column="product_model_id" property="productModelId" />
@@ -24,8 +24,9 @@
         p.product_name as productName,
         pm.model,
         pm.unit,
+        sor.weighbridge_doc_path,
         u.nick_name as createBy
-        FROM Consumables_out_record as sor
+        FROM consumables_out_record as sor
         LEFT JOIN product_model as pm on sor.product_model_id = pm.id
         LEFT JOIN product as p on pm.product_id = p.id
         LEFT JOIN sys_user as u on sor.create_user = u.user_id
@@ -52,7 +53,7 @@
         pm.model,
         pm.unit,
         u.nick_name as createBy
-        FROM Consumables_out_record as sor
+        FROM consumables_out_record as sor
         LEFT JOIN product_model as pm on sor.product_model_id = pm.id
         LEFT JOIN product as p on pm.product_id = p.id
         LEFT JOIN sys_user as u on sor.create_user = u.user_id
diff --git a/src/main/resources/mapper/consumables/ConsumablesUninventoryMapper.xml b/src/main/resources/mapper/consumables/ConsumablesUninventoryMapper.xml
index 727c7da..8bc1405 100644
--- a/src/main/resources/mapper/consumables/ConsumablesUninventoryMapper.xml
+++ b/src/main/resources/mapper/consumables/ConsumablesUninventoryMapper.xml
@@ -43,7 +43,7 @@
         </set>
         where product_model_id = #{ew.productModelId}
     </update>
-    <select id="pageConsumablesUninventory" resultType="com.ruoyi.consumables.dto.ConsumablesUnInventoryDto">
+    <select id="pageConsumablesUnInventory" resultType="com.ruoyi.consumables.dto.ConsumablesUnInventoryDto">
         select su.id,
         su.qualitity,
         COALESCE(su.locked_quantity, 0) as locked_quantity,
diff --git a/src/main/resources/mapper/stock/StockInRecordMapper.xml b/src/main/resources/mapper/stock/StockInRecordMapper.xml
index d5c3f38..cabdb25 100644
--- a/src/main/resources/mapper/stock/StockInRecordMapper.xml
+++ b/src/main/resources/mapper/stock/StockInRecordMapper.xml
@@ -8,6 +8,7 @@
         p.product_name as product_name,
         pm.model,
         pm.unit,
+        sir.weighbridge_doc_path,
         u.nick_name as createBy
         FROM stock_in_record as sir
         LEFT JOIN product_model as pm on sir.product_model_id = pm.id
diff --git a/src/main/resources/mapper/stock/StockInventoryMapper.xml b/src/main/resources/mapper/stock/StockInventoryMapper.xml
index 0cde0e3c..8704a51 100644
--- a/src/main/resources/mapper/stock/StockInventoryMapper.xml
+++ b/src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -16,6 +16,9 @@
     <update id="updateAddStockInventory">
         update stock_inventory
         <set>
+            <if test="ew.productId != null">
+                product_id = #{ew.productId},
+            </if>
             <if test="ew.qualitity != null">
                 qualitity = qualitity + #{ew.qualitity},
             </if>
@@ -71,8 +74,8 @@
         pm.unit,
         p.product_name,
         p1.product_name as parent_name,
-        p1.id as parent_id
-
+        p1.id as parent_id,
+        si.product_id as productId
         from stock_inventory si
         left join product_model pm on si.product_model_id = pm.id
         left join product p on pm.product_id = p.id
diff --git a/src/main/resources/mapper/stock/StockOutRecordMapper.xml b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
index 4a21e30..10a60c2 100644
--- a/src/main/resources/mapper/stock/StockOutRecordMapper.xml
+++ b/src/main/resources/mapper/stock/StockOutRecordMapper.xml
@@ -24,6 +24,7 @@
         p.product_name as productName,
         pm.model,
         pm.unit,
+        sor.weighbridge_doc_path,
         u.nick_name as createBy
         FROM stock_out_record as sor
         LEFT JOIN product_model as pm on sor.product_model_id = pm.id

--
Gitblit v1.9.3