Browse Source

Merge remote-tracking branch 'origin/dev' into dev

lazhaoqian 4 years ago
parent
commit
b5925f7179
39 changed files with 1226 additions and 274 deletions
  1. 3 3
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/agreement/TWarehouseAgreementController.java
  2. 18 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TWarehouseWebcamController.java
  3. 32 32
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWarehousebillsitemsSummaryController.java
  4. 15 6
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWhgenlegController.java
  5. 8 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/warehouseBusiness/TStorageFeeCalculationController.java
  6. 415 0
      ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/DrawExcel.java
  7. 1 0
      ruoyi-system/src/main/resources/mapper/system/TWarehouseUserMapper.xml
  8. 10 1
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TCorpsMapper.java
  9. 1 1
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TWarehouseMapper.java
  10. 2 2
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TWarehouseWebcamMapper.java
  11. 8 1
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITCorpsService.java
  12. 18 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITWarehouseWebcamService.java
  13. 24 2
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TCorpsServiceImpl.java
  14. 6 2
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseUserServiceImpl.java
  15. 124 17
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseWebcamServiceImpl.java
  16. 14 0
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/domain/TWhgenleg.java
  17. 10 19
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/mapper/TWhgenlegMapper.java
  18. 13 13
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/ITWhgenlegService.java
  19. 80 34
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java
  20. 13 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseAgreement.java
  21. 44 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseBills.java
  22. 15 1
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehousebillsitems.java
  23. 14 8
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/excel/StorageDetail.java
  24. 6 2
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseAgreementMapper.java
  25. 1 1
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java
  26. 7 2
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsitemsMapper.java
  27. 2 2
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseAgreementService.java
  28. 7 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java
  29. 2 2
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehousebillsitemsService.java
  30. 22 7
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseAgreementServiceImpl.java
  31. 22 4
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java
  32. 16 4
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehousebillsitemsServiceImpl.java
  33. 19 5
      ruoyi-warehouse/src/main/resources/mapper/basicData/TCorpsMapper.xml
  34. 7 0
      ruoyi-warehouse/src/main/resources/mapper/basicData/TWarehouseMapper.xml
  35. 5 4
      ruoyi-warehouse/src/main/resources/mapper/basicData/TWarehouseWebcamMapper.xml
  36. 57 56
      ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml
  37. 11 6
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehouseAgreementMapper.xml
  38. 115 32
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml
  39. 39 4
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsitemsMapper.xml

+ 3 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/agreement/TWarehouseAgreementController.java

@@ -27,10 +27,10 @@ public class TWarehouseAgreementController extends BaseController {
     /**
      * 查询协议提醒列表
      */
-    @GetMapping("/list")
-    public TableDataInfo list(TWarehouseAgreement tWarehouseAgreement) {
+    @GetMapping("/remindList")
+    public TableDataInfo remindList(TWarehouseAgreement tWarehouseAgreement) {
         startPage();
-        List<Map<String, Object>> list = tWarehouseAgreementService.selectTWarehouseAgreementList1(tWarehouseAgreement);
+        List<Map<String, Object>> list = tWarehouseAgreementService.agreementRemind(tWarehouseAgreement);
         return getDataTable(list);
     }
 

+ 18 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TWarehouseWebcamController.java

@@ -64,6 +64,24 @@ public class TWarehouseWebcamController extends BaseController {
     }
 
     /**
+     * 获取摄像头流地址
+     */
+    @GetMapping("/getWebcamUrlList")
+    public AjaxResult getWebcamUrlList(Long fWarehouseId) {
+        return AjaxResult.success(tWarehouseWebcamService.getWebcamUrlList(fWarehouseId));
+    }
+
+    /**
+     * 批量修改仓库摄像头
+     */
+    @Log(title = "仓库摄像头", businessType = BusinessType.UPDATE)
+    @PostMapping("/appEdit")
+    @RepeatSubmit
+    public AjaxResult edit(@RequestBody List<TWarehouseWebcam> webcamList) {
+        return tWarehouseWebcamService.updateTWarehouseWebcamList(webcamList);
+    }
+
+    /**
      * 导出仓库摄像头列表
      */
     @PreAuthorize("@ss.hasPermi('warehouse:webcam:export')")
@@ -101,7 +119,6 @@ public class TWarehouseWebcamController extends BaseController {
     /**
      * 修改仓库摄像头
      */
-    @PreAuthorize("@ss.hasPermi('warehouse:webcam:edit')")
     @Log(title = "仓库摄像头", businessType = BusinessType.UPDATE)
     @PutMapping
     @RepeatSubmit

+ 32 - 32
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWarehousebillsitemsSummaryController.java

@@ -118,110 +118,110 @@ public class TWarehousebillsitemsSummaryController extends BaseController {
     }
 
     /**
+     * bi大屏客户列表
+     */
+    @GetMapping("/biCustomerList")
+    public AjaxResult biCustomerList() {
+        return AjaxResult.success(itCorpsService.biCustomerList());
+    }
+
+    /**
      * bi大屏客户数量
      */
     @GetMapping("/biCustomerCount")
-    public AjaxResult biCustomerCount(Long warehouseId) {
-        return AjaxResult.success(itCorpsService.biCustomerCount(warehouseId));
+    public AjaxResult biCustomerCount(Long warehouseId, Long customerId) {
+        return AjaxResult.success(itCorpsService.biCustomerCount(warehouseId, customerId));
     }
 
     /**
      * bi大屏客户概况
      */
     @GetMapping("/biCustomerInfo")
-    public AjaxResult biCustomerInfo(Long warehouseId) {
-        return AjaxResult.success(itWhgenlegService.biCustomerInfo(warehouseId));
+    public AjaxResult biCustomerInfo(Long warehouseId, Long customerId) {
+        return AjaxResult.success(itWhgenlegService.biCustomerInfo(warehouseId, customerId));
     }
 
     /**
      * bi当日入库量
      */
     @GetMapping("/biTodayInStockCount")
-    public AjaxResult biTodayInStockCount(Long warehouseId) {
-        return AjaxResult.success(itWarehousebillsitemsService.biTodayInAndOutStockCount("SJRK", warehouseId));
+    public AjaxResult biTodayInStockCount(Long warehouseId, Long customerId) {
+        return AjaxResult.success(itWarehousebillsitemsService.biTodayInAndOutStockCount("SJRK", warehouseId, customerId));
     }
 
     /**
      * bi当日出库量
      */
     @GetMapping("/biTodayOutStockCount")
-    public AjaxResult biTodayOutStockCount(Long warehouseId) {
-        return AjaxResult.success(itWarehousebillsitemsService.biTodayInAndOutStockCount("SJCK", warehouseId));
+    public AjaxResult biTodayOutStockCount(Long warehouseId, Long customerId) {
+        return AjaxResult.success(itWarehousebillsitemsService.biTodayInAndOutStockCount("SJCK", warehouseId, customerId));
     }
 
     /**
      * bi库存数量
      */
     @GetMapping("/biStockCount")
-    public AjaxResult biStockCount(Long warehouseId) {
-        return AjaxResult.success(itWhgenlegService.biStockCount(warehouseId));
+    public AjaxResult biStockCount(Long warehouseId, Long customerId) {
+        return AjaxResult.success(itWhgenlegService.biStockCount(warehouseId, customerId));
     }
 
     /**
      * bi大屏协议数量
      */
     @GetMapping("/biContractCount")
-    public AjaxResult biContractCount() {
-        return AjaxResult.success(itWarehouseAgreementService.biContractCount());
-    }
-
-    /**
-     * bi大屏商品概况
-     */
-    @GetMapping("/biGoodsInfo")
-    public AjaxResult biGoodsInfo(Long warehouseId) {
-        return AjaxResult.success(itWhgenlegService.biGoodsInfo(warehouseId));
+    public AjaxResult biContractCount(Long customerId) {
+        return AjaxResult.success(itWarehouseAgreementService.biContractCount(customerId));
     }
 
     /**
      * bi大屏毛重概况
      */
     @GetMapping("/biWeightInfo")
-    public AjaxResult biWeightInfo(Long warehouseId) {
-        return AjaxResult.success(itWhgenlegService.biWeightInfo(warehouseId));
+    public AjaxResult biWeightInfo(Long warehouseId, Long customerId, String mode) {
+        return AjaxResult.success(itWhgenlegService.biWeightInfo(warehouseId, customerId, mode));
     }
 
     /**
      * bi大屏最大库龄
      */
     @GetMapping("/biMaxStockDays")
-    public AjaxResult biMaxStockDays(Long warehouseId) {
-        return AjaxResult.success(itWhgenlegService.biMaxStockDays(warehouseId));
+    public AjaxResult biMaxStockDays(Long warehouseId, Long customerId) {
+        return AjaxResult.success(itWhgenlegService.biMaxStockDays(warehouseId, customerId));
     }
 
     /**
      * bi大屏库龄概况
      */
     @GetMapping("/biStockDaysInfo")
-    public AjaxResult biStockDaysInfo(Long warehouseId) {
-        return AjaxResult.success(itWhgenlegService.biStockDaysInfo(warehouseId));
+    public AjaxResult biStockDaysInfo(Long warehouseId, Long customerId) {
+        return AjaxResult.success(itWhgenlegService.biStockDaysInfo(warehouseId, customerId));
     }
 
     /**
      * bi大屏入库列表
      */
     @GetMapping("/biInStockList")
-    public TableDataInfo biInStockList(Long warehouseId) {
+    public TableDataInfo biInStockList(Long warehouseId, Long customerId) {
         startPage();
-        return getDataTable(itWarehousebillsitemsService.biInAndOutStockList("SJRK", warehouseId));
+        return getDataTable(itWarehousebillsitemsService.biInAndOutStockList("SJRK", warehouseId, customerId));
     }
 
     /**
      * bi大屏出库列表
      */
     @GetMapping("/biOutStockList")
-    public TableDataInfo biOutStockList(Long warehouseId) {
+    public TableDataInfo biOutStockList(Long warehouseId, Long customerId) {
         startPage();
-        return getDataTable(itWarehousebillsitemsService.biInAndOutStockList("SJCK", warehouseId));
+        return getDataTable(itWarehousebillsitemsService.biInAndOutStockList("SJCK", warehouseId, customerId));
     }
 
     /**
      * bi大屏仓储协议列表
      */
     @GetMapping("/biContractList")
-    public TableDataInfo biContractList() {
+    public TableDataInfo biContractList(Long customerId) {
         startPage();
-        return getDataTable(itWarehouseAgreementService.biContractList());
+        return getDataTable(itWarehouseAgreementService.biContractList(customerId));
     }
 
 }

+ 15 - 6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWhgenlegController.java

@@ -37,7 +37,6 @@ public class TWhgenlegController extends BaseController {
     /**
      * 出库、调拨、货转查询库存总账列表
      */
-    @DataScope(deptAlias = "d", userAlias = "u")
     @GetMapping("/list")
     public TableDataInfo list(TWhgenleg tWhgenleg) {
         startPage();
@@ -81,12 +80,23 @@ public class TWhgenlegController extends BaseController {
     }
 
     /**
+     * 根据提单号获取客户
+     */
+    @GetMapping("/getCorpsByfMblno")
+    public AjaxResult getCorpsByfMblno(String fMblno) {
+        return AjaxResult.success(tWhgenlegService.getCorpsByfMblno(fMblno));
+    }
+
+    /**
      * 获取单票分析信息
      */
     @GetMapping(value = "/singleAnalysis")
     public AjaxResult singleAnalysis(SingleAnalysisExcel singleAnalysisExcel) {
-        if (StringUtils.isNull(singleAnalysisExcel.getfCorpid()) || StringUtils.isEmpty(singleAnalysisExcel.getfMblno())) {
-            return AjaxResult.error("未找到查询条件");
+        if (StringUtils.isNull(singleAnalysisExcel.getfCorpid())) {
+            return AjaxResult.error("请选择货主");
+        }
+        if (StringUtils.isEmpty(singleAnalysisExcel.getfMblno())) {
+            return AjaxResult.error("请输入提单号");
         }
         List<SingleAnalysisFeesExcel> feesList = tWhgenlegService.selectSingleAnalysisFees(singleAnalysisExcel);
         List<SingleAnalysisExcel> singleAnalysisExcels = tWhgenlegService.selectSingleAnalysis(singleAnalysisExcel);
@@ -242,9 +252,8 @@ public class TWhgenlegController extends BaseController {
      */
     @DataScope(deptAlias = "d", userAlias = "u")
     @GetMapping("/whgenlegList")
-    public TableDataInfo websiteWhGenLegList(TWhgenleg tWhgenleg) {
-        startPage();
-        List<Map<String, Object>> list = tWhgenlegService.selectInventoryMapList(tWhgenleg);
+    public TableDataInfo websiteWhGenLegList(TWhgenleg tWhgenleg, Integer pageNum, Integer pageSize) {
+        List<Map<String, Object>> list = tWhgenlegService.selectInventoryMapList(tWhgenleg, pageNum, pageSize);
         return getDataTable(list);
     }
 

+ 8 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/warehouseBusiness/TStorageFeeCalculationController.java

@@ -190,4 +190,12 @@ public class TStorageFeeCalculationController extends BaseController {
         return util.exportExcel(list, "仓储费明细");
     }
 
+    /**
+     * 导出仓储费账单
+     */
+    @GetMapping("/exportStorageBill")
+    public AjaxResult exportStorageBill() {
+        return AjaxResult.success(itWarehouseBillsService.exportStorageBill());
+    }
+
 }

+ 415 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/DrawExcel.java

@@ -0,0 +1,415 @@
+package com.ruoyi.common.utils.poi;
+
+import com.ruoyi.common.config.RuoYiConfig;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * @author sun
+ */
+public class DrawExcel {
+
+    /**
+     * 读取对象
+     */
+    private XSSFWorkbook readWorkbook;
+
+    /**
+     * 写入对象
+     */
+    private Workbook writeWorkbook;
+
+    /**
+     * 提交行数,默认:100
+     */
+    private int commitNum = 100;
+
+    /**
+     * 输入路径
+     */
+    private String inPath = "";
+
+    /**
+     * 输出路径
+     */
+    private String outPath = "";
+
+    /**
+     * 输入流
+     */
+    private FileInputStream fis;
+
+    /**
+     * 输出流
+     */
+    private FileOutputStream fos;
+
+    /**
+     * 当前操作Sheet
+     */
+    private Sheet sheet;
+
+    /**
+     * 当前操作行
+     */
+    private Row row;
+
+    /**
+     * 构造方法一:输入路径 + 输出路径
+     *
+     * @param inPath  输入路径
+     * @param outPath 输出路径
+     */
+    public DrawExcel(String inPath, String outPath) {
+        try {
+            this.inPath = inPath;
+            this.outPath = outPath;
+            fis = new FileInputStream(inPath);
+            fos = new FileOutputStream(outPath);
+            readWorkbook = new XSSFWorkbook(fis);
+            writeWorkbook = new SXSSFWorkbook(readWorkbook, commitNum);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 构造方法二:输入路径 + 输出路径
+     *
+     * @param inPath    输入路径
+     * @param outPath   输出路径
+     * @param commitNum 提交数
+     */
+    public DrawExcel(String inPath, String outPath, int commitNum) {
+        try {
+            this.inPath = inPath;
+            this.outPath = outPath;
+            this.commitNum = commitNum;
+            fis = new FileInputStream(inPath);
+            fos = new FileOutputStream(outPath);
+            readWorkbook = new XSSFWorkbook(fis);
+            writeWorkbook = new SXSSFWorkbook(readWorkbook, commitNum);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 构造方法三:输出路径
+     *
+     * @param outPath 输出路径
+     */
+    public DrawExcel(String outPath) {
+        try {
+            this.outPath = outPath;
+            fos = new FileOutputStream(outPath);
+            writeWorkbook = new SXSSFWorkbook(commitNum);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 构造方法四:输出路径
+     *
+     * @param outPath   输出路径
+     * @param commitNum 提交数
+     */
+    public DrawExcel(String outPath, int commitNum) {
+        try {
+            this.outPath = outPath;
+            this.commitNum = commitNum;
+            fos = new FileOutputStream(outPath);
+            writeWorkbook = new SXSSFWorkbook(commitNum);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 获取Sheet
+     */
+    public Sheet getSheet(int index) {
+        try {
+            sheet = writeWorkbook.getSheetAt(index);
+        } catch (Exception e) {
+            e.printStackTrace();
+            sheet = writeWorkbook.createSheet();
+        }
+
+        return sheet;
+    }
+
+    /**
+     * 创建Sheet
+     */
+    public void createSheet() {
+        sheet = writeWorkbook.createSheet();
+    }
+
+    /**
+     * 创建列的宽度
+     */
+    public void setColumnWidth(int column, int width) {
+        sheet.setColumnWidth(column, width);
+    }
+
+    /**
+     * 创建行高
+     */
+    public void setHeightInPoints(int height) {
+        row.setHeightInPoints(height);
+    }
+
+    public void setCellStr(int cellIdx, String cellStr) {
+        Cell cell = row.createCell(cellIdx);
+        cell.setCellValue(cellStr);
+    }
+
+    /**
+     * 创建行
+     *
+     * @param rowNum 行号
+     */
+    public Row createRow(int rowNum) {
+        row = sheet.createRow(rowNum);
+        return row;
+    }
+
+    /**
+     * 创建数据
+     *
+     * @param cellNum 列号
+     * @param cellVal 数值
+     */
+    public void createCell(int cellNum, String cellVal) {
+        row.createCell(cellNum).setCellValue(cellVal);
+    }
+
+    /**
+     * 写文件
+     */
+    public void write() {
+        try {
+            writeWorkbook.write(fos);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 获取读取对象
+     */
+    public XSSFWorkbook getReadWorkbook() {
+        return readWorkbook;
+    }
+
+    /**
+     * 设置读取对象
+     */
+    public void setReadWorkbook(XSSFWorkbook readWorkbook) {
+        this.readWorkbook = readWorkbook;
+    }
+
+    /**
+     * 获取写入对象
+     */
+    public Workbook getWriteWorkbook() {
+        return writeWorkbook;
+    }
+
+    /**
+     * 设置写入对象
+     */
+    public void setWriteWorkbook(Workbook writeWorkbook) {
+        this.writeWorkbook = writeWorkbook;
+    }
+
+    /**
+     * 获取提交数量
+     */
+    public int getCommitNum() {
+        return commitNum;
+    }
+
+    /**
+     * 设置提交数量
+     */
+    public void setCommitNum(int commitNum) {
+        this.commitNum = commitNum;
+    }
+
+    /**
+     * 获取输入路径
+     */
+    public String getInPath() {
+        return inPath;
+    }
+
+    /**
+     * 设置输入路径
+     */
+    public void setInPath(String inPath) {
+        this.inPath = inPath;
+    }
+
+    /**
+     * 获取输出路径
+     */
+    public String getOutPath() {
+        return outPath;
+    }
+
+    /**
+     * 设置输出路径
+     */
+    public void setOutPath(String outPath) {
+        this.outPath = outPath;
+    }
+
+    /**
+     * 获取输入流
+     */
+    public FileInputStream getFileInputStream() {
+        return fis;
+    }
+
+    /**
+     * 设置输入流
+     */
+    public void setFileInputStream(FileInputStream fis) {
+        this.fis = fis;
+    }
+
+    /**
+     * 获取输出流
+     */
+    public FileOutputStream getFileOutputStream() {
+        return fos;
+    }
+
+    /**
+     * 设置输出流
+     */
+    public void setFileOutputStream(FileOutputStream fos) {
+        this.fos = fos;
+    }
+
+    /**
+     * 获取Sheet
+     */
+    public Sheet getSheet() {
+        return sheet;
+    }
+
+    /**
+     * 设置Sheet
+     */
+    public void setSheet(Sheet sheet) {
+        this.sheet = sheet;
+    }
+
+    /**
+     * 获取当前行
+     */
+    public Row getRow() {
+        return row;
+    }
+
+    /**
+     * 设置当前行
+     */
+    public void setRow(Row row) {
+        this.row = row;
+    }
+
+    /**
+     * 释放方法
+     */
+    public void free() {
+        try {
+            if (fis != null) {
+                fis.close();
+            }
+            if (fos != null) {
+                fos.close();
+            }
+            System.gc();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 获取下载路径
+     *
+     * @param filename 文件名称
+     */
+    public static String getAbsoluteFile(String filename) {
+        String downloadPath = RuoYiConfig.getDownloadPath() + filename;
+        File file = new File(downloadPath);
+        if (!file.getParentFile().exists()) {
+            file.getParentFile().mkdirs();
+        }
+        return downloadPath;
+    }
+
+    private void example() {
+        DrawExcel ioExcel = new DrawExcel(getAbsoluteFile("案例.xlsx"));
+        // 获取sheet
+        ioExcel.createSheet();
+        Sheet sheet = ioExcel.getSheet(0);
+
+        // 设置第一行为标题 和基本格式 具体不清楚
+        Row firstRow = ioExcel.createRow(0);
+        ioExcel.setCellStr(0, "测试");
+        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 11));
+        firstRow.setHeightInPoints(25);
+        Workbook wk = ioExcel.getWriteWorkbook();
+        CellStyle cellStyle = wk.createCellStyle();
+        Font font = wk.createFont();
+        // 加粗
+        font.setBold(true);
+        font.setFontHeightInPoints((short) 20);
+
+        cellStyle.setFont(font);
+        // 设置字体水平居中
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+        // 设置字体垂直居中
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+
+        firstRow.setHeightInPoints(51F);
+        firstRow.getCell(0).setCellStyle(cellStyle);
+        // 设置字段宽度 高度
+        ioExcel.createRow(1).setHeightInPoints(25);
+        for (int titleArrCount = 0; titleArrCount < 11; titleArrCount++) {
+            ioExcel.setCellStr(titleArrCount, "12");
+        }
+
+        for (int i = 0; i < 12; i++) {
+            sheet.setColumnWidth(i, 7500);
+            sheet.getColumnStyle(0).setAlignment(HorizontalAlignment.CENTER);
+        }
+
+        int cowNum = 2;
+        // //创建行
+
+        // //这部分是测试放入数据
+        for (int cellNum = 0; cellNum < 12; cellNum++) {
+            ioExcel.createRow(cowNum);
+            ioExcel.createCell(cellNum, "++++++");
+            cowNum++;
+        }
+
+        ioExcel.write();
+        ioExcel.free();
+    }
+
+}

+ 1 - 0
ruoyi-system/src/main/resources/mapper/system/TWarehouseUserMapper.xml

@@ -85,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             warehouse_name as warehouseName
         from t_warehouse_user
         where user_id = #{userId}
+        order by convert(warehouse_name using gbk)
     </select>
 
 </mapper>

+ 10 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TCorpsMapper.java

@@ -160,6 +160,15 @@ public interface TCorpsMapper extends BaseMapper<TCorps> {
      *
      * @return
      */
-    public Map<String, Object> biCustomerCount(Long warehouseId);
+    public Map<String, Object> biCustomerCount(@Param("external") String external,
+                                               @Param("warehouseId") Long warehouseId,
+                                               @Param("customerId") Long customerId);
+
+    /**
+     * bi大屏客户列表
+     *
+     * @return 客户集合
+     */
+    public List<Map<String, Object>> biCustomerList(@Param("external") String external);
 
 }

+ 1 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TWarehouseMapper.java

@@ -177,6 +177,6 @@ public interface TWarehouseMapper {
      *
      * @return 仓库集合
      */
-    public List<Map<String, Object>> biWarehouseList();
+    public List<Map<String, Object>> biWarehouseList(@Param("external") String external);
 
 }

+ 2 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TWarehouseWebcamMapper.java

@@ -72,8 +72,8 @@ public interface TWarehouseWebcamMapper {
      * APP查询仓库摄像头列表
      *
      * @param fWarehouseId 仓库ID
-     * @param corpId 客户ID
+     * @param external 客户名
      * @return 仓库摄像头集合
      */
-    public List<TWarehouseWebcam> selectAppTWarehouseWebcamList(@Param("fWarehouseId") Long fWarehouseId, @Param("corpId") Long corpId);
+    public List<TWarehouseWebcam> selectAppTWarehouseWebcamList(@Param("fWarehouseId") Long fWarehouseId, @Param("external") String external);
 }

+ 8 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITCorpsService.java

@@ -119,6 +119,13 @@ public interface ITCorpsService {
      *
      * @return
      */
-    public Map<String, Object> biCustomerCount(Long warehouseId);
+    public Map<String, Object> biCustomerCount(Long warehouseId, Long customerId);
+
+    /**
+     * bi大屏客户列表
+     *
+     * @return 客户集合
+     */
+    public List<Map<String, Object>> biCustomerList();
 
 }

+ 18 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITWarehouseWebcamService.java

@@ -1,8 +1,10 @@
 package com.ruoyi.basicData.service;
 
 import java.util.List;
+import java.util.Map;
 
 import com.ruoyi.basicData.domain.TWarehouseWebcam;
+import com.ruoyi.common.core.domain.AjaxResult;
 
 /**
  * 仓库摄像头Service接口
@@ -60,6 +62,14 @@ public interface ITWarehouseWebcamService {
     public int updateTWarehouseWebcam(TWarehouseWebcam tWarehouseWebcam);
 
     /**
+     * 批量修改仓库摄像头
+     *
+     * @param webcamList 仓库摄像头列表
+     * @return 结果
+     */
+    public AjaxResult updateTWarehouseWebcamList(List<TWarehouseWebcam> webcamList);
+
+    /**
      * 批量删除仓库摄像头
      *
      * @param fIds 需要删除的仓库摄像头ID
@@ -74,4 +84,12 @@ public interface ITWarehouseWebcamService {
      * @return 结果
      */
     public int deleteTWarehouseWebcamById(Long fId);
+
+    /**
+     * 获取摄像头流地址
+     *
+     * @param fWarehouseId 仓库ID
+     * @return 摄像头流地址集合
+     */
+    public List<Map<String, Object>> getWebcamUrlList(Long fWarehouseId);
 }

+ 24 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TCorpsServiceImpl.java

@@ -383,8 +383,30 @@ public class TCorpsServiceImpl implements ITCorpsService {
      * @return
      */
     @Override
-    public Map<String, Object> biCustomerCount(Long warehouseId) {
-        return tCorpsMapper.biCustomerCount(warehouseId);
+    public Map<String, Object> biCustomerCount(Long warehouseId, Long customerId) {
+        String external = null;
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            external = user.getUserName();
+        }
+
+        return tCorpsMapper.biCustomerCount(external, warehouseId, customerId);
+    }
+
+    /**
+     * bi大屏客户列表
+     *
+     * @return 客户集合
+     */
+    @Override
+    public List<Map<String, Object>> biCustomerList() {
+        String external = null;
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            external = user.getUserName();
+        }
+
+        return tCorpsMapper.biCustomerList(external);
     }
 
 }

+ 6 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseUserServiceImpl.java

@@ -112,14 +112,18 @@ public class TWarehouseUserServiceImpl implements ITWarehouseUserService {
     public List<Map<String, Object>> biWarehouseList() {
         SysUser user = SecurityUtils.getLoginUser().getUser();
         if (user.isAdmin()) {
-            return tWarehouseMapper.biWarehouseList();
+            return tWarehouseMapper.biWarehouseList(null);
+        }
+
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            return tWarehouseMapper.biWarehouseList(user.getUserName());
         }
 
         List<Map<String, Object>> warehouseList = tWarehouseUserMapper.biWarehouseList(user.getUserId());
         if (warehouseList.size() == 1) {
             Long warehouseId = (Long) warehouseList.get(0).get("warehouseId");
             if (warehouseId == 0) {
-                return tWarehouseMapper.biWarehouseList();
+                return tWarehouseMapper.biWarehouseList(null);
             }
         }
 

+ 124 - 17
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseWebcamServiceImpl.java

@@ -1,19 +1,27 @@
 package com.ruoyi.basicData.service.impl;
 
-import java.util.List;
-
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.ruoyi.basicData.domain.TCustomerContact;
-import com.ruoyi.basicData.mapper.TCustomerContactMapper;
+import cn.hutool.http.HttpRequest;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.basicData.domain.TWarehouseWebcam;
+import com.ruoyi.basicData.mapper.TWarehouseWebcamMapper;
+import com.ruoyi.basicData.service.ITWarehouseWebcamService;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.exception.BaseException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.mapper.SysConfigMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.ruoyi.basicData.mapper.TWarehouseWebcamMapper;
-import com.ruoyi.basicData.domain.TWarehouseWebcam;
-import com.ruoyi.basicData.service.ITWarehouseWebcamService;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 仓库摄像头Service业务层处理
@@ -27,7 +35,7 @@ public class TWarehouseWebcamServiceImpl implements ITWarehouseWebcamService {
     private TWarehouseWebcamMapper tWarehouseWebcamMapper;
 
     @Autowired
-    private TCustomerContactMapper customerContactMapper;
+    private SysConfigMapper sysConfigMapper;
 
     /**
      * 查询仓库摄像头
@@ -74,18 +82,13 @@ public class TWarehouseWebcamServiceImpl implements ITWarehouseWebcamService {
             return tWarehouseWebcamMapper.selectAppTWarehouseWebcamList(tWarehouseWebcam.getfWarehouseId(), null);
         }
 
-        TCustomerContact customerContact = new TCustomerContact();
+        String external = null;
         SysUser user = SecurityUtils.getLoginUser().getUser();
-        Long corpId = null;
         if ("外部用户".equals(user.getDept().getDeptName())) {
-            customerContact.setfTel(SecurityUtils.getLoginUser().getUser().getUserName());
-            List<TCustomerContact> tCustomerContacts = customerContactMapper.selectTCustomerContactList(customerContact);
-            if (CollectionUtils.isNotEmpty(tCustomerContacts)) {
-                corpId = tCustomerContacts.get(0).getfPid();
-            }
+            external = user.getUserName();
         }
 
-        return tWarehouseWebcamMapper.selectAppTWarehouseWebcamList(null, corpId);
+        return tWarehouseWebcamMapper.selectAppTWarehouseWebcamList(null, external);
     }
 
     /**
@@ -96,6 +99,7 @@ public class TWarehouseWebcamServiceImpl implements ITWarehouseWebcamService {
      */
     @Override
     public int insertTWarehouseWebcam(TWarehouseWebcam tWarehouseWebcam) {
+        tWarehouseWebcam.setCreateBy(SecurityUtils.getUsername());
         tWarehouseWebcam.setCreateTime(DateUtils.getNowDate());
         return tWarehouseWebcamMapper.insertTWarehouseWebcam(tWarehouseWebcam);
     }
@@ -113,6 +117,23 @@ public class TWarehouseWebcamServiceImpl implements ITWarehouseWebcamService {
     }
 
     /**
+     * 修改仓库摄像头
+     *
+     * @param webcamList 仓库摄像头列表
+     * @return 结果
+     */
+    @Override
+    @Transactional
+    public AjaxResult updateTWarehouseWebcamList(List<TWarehouseWebcam> webcamList) {
+        for (TWarehouseWebcam tWarehouseWebcam : webcamList) {
+            tWarehouseWebcam.setUpdateBy(SecurityUtils.getUsername());
+            tWarehouseWebcam.setUpdateTime(DateUtils.getNowDate());
+            tWarehouseWebcamMapper.updateTWarehouseWebcam(tWarehouseWebcam);
+        }
+        return AjaxResult.success();
+    }
+
+    /**
      * 批量删除仓库摄像头
      *
      * @param fIds 需要删除的仓库摄像头ID
@@ -133,4 +154,90 @@ public class TWarehouseWebcamServiceImpl implements ITWarehouseWebcamService {
     public int deleteTWarehouseWebcamById(Long fId) {
         return tWarehouseWebcamMapper.deleteTWarehouseWebcamById(fId);
     }
+
+    /**
+     * 获取摄像头流地址
+     *
+     * @param warehouseId 仓库ID
+     * @return 摄像头流地址集合
+     */
+    @Override
+    public List<Map<String, Object>> getWebcamUrlList(Long fWarehouseId) {
+        String external = null;
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            external = user.getUserName();
+        }
+
+        List<Map<String, Object>> data = new ArrayList<>();
+        Map<String, Object> temp;
+
+        List<TWarehouseWebcam> tWarehouseWebcams = tWarehouseWebcamMapper.selectAppTWarehouseWebcamList(fWarehouseId, external);
+        if (tWarehouseWebcams.size() > 0) {
+            // 获取摄像头token
+            String token = getToken();
+            for (TWarehouseWebcam tWarehouseWebcam : tWarehouseWebcams) {
+                String projectId = tWarehouseWebcam.getProjectId();
+                String deviceSerial = tWarehouseWebcam.getDeviceSerial();
+                String streamUrl = getWebcamUrl(token, projectId, deviceSerial);
+                temp = new HashMap<>();
+                temp.put("warehouseName", tWarehouseWebcam.getfWarehouseName());
+                temp.put("deviceName", tWarehouseWebcam.getDeviceName());
+                temp.put("streamUrl", streamUrl);
+                data.add(temp);
+            }
+        }
+        return data;
+    }
+
+    private String getConfigValue(String key) {
+        SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique(key);
+        if (StringUtils.isNull(sysConfig)) {
+            throw new BaseException("系统参数异常,未找到" + key + "参数");
+        }
+        return sysConfig.getConfigValue();
+    }
+
+    private String getToken() {
+        // 从参数里获取请求地址、参数
+        String tokenUrl = getConfigValue("warehouse.webcam.tokenUrl");
+
+        JSONObject values = new JSONObject();
+        values.put("accessKey", getConfigValue("warehouse.webcam.accessKey"));
+        values.put("secretKey", getConfigValue("warehouse.webcam.secretKey"));
+        values.put("productCode", getConfigValue("warehouse.webcam.productCode"));
+
+        String response = HttpRequest.post(tokenUrl)
+                .body(values.toString())
+                .execute().body();
+        JSONObject json = JSON.parseObject(response);
+        if ("200".equals(json.getString("code"))) {
+            throw new BaseException(json.getString("msg"));
+        }
+        JSONObject data = JSON.parseObject(json.getString("data"));
+        return data.getString("access_token");
+    }
+
+    private String getWebcamUrl(String token, String projectId, String deviceSerial) {
+        // 从参数里获取请求地址、参数
+        String streamUrl = getConfigValue("warehouse.webcam.streamUrl");
+
+        JSONObject values = new JSONObject();
+        values.put("projectId", projectId);
+        values.put("deviceSerial", deviceSerial);
+        values.put("protocol", 3);
+        values.put("supportH265", 1);
+
+        String response = HttpRequest.post(streamUrl)
+                .header("access_token", token)
+                .body(values.toString())
+                .execute().body();
+        JSONObject json = JSON.parseObject(response);
+        if ("200".equals(json.getString("code"))) {
+            throw new BaseException(json.getString("msg"));
+        }
+        JSONObject data = JSON.parseObject(json.getString("data"));
+        return data.getString("url");
+    }
+
 }

+ 14 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/domain/TWhgenleg.java

@@ -40,6 +40,11 @@ public class TWhgenleg extends BaseEntity {
     private Long fCorpid;
 
     /**
+     * 发货方
+     */
+    private String fShipper;
+
+    /**
      * 提单号
      */
     private String fMblno;
@@ -315,6 +320,14 @@ public class TWhgenleg extends BaseEntity {
         this.fCorpid = fCorpid;
     }
 
+    public String getfShipper() {
+        return fShipper;
+    }
+
+    public void setfShipper(String fShipper) {
+        this.fShipper = fShipper;
+    }
+
     public String getfMblno() {
         return fMblno;
     }
@@ -602,6 +615,7 @@ public class TWhgenleg extends BaseEntity {
                 ", fAccyear=" + fAccyear +
                 ", fAccmonth=" + fAccmonth +
                 ", fCorpid=" + fCorpid +
+                ", fShipper=" + fShipper +
                 ", fMblno='" + fMblno + '\'' +
                 ", fOriginalbillno='" + fOriginalbillno + '\'' +
                 ", fWarehouseLocationid=" + fWarehouseLocationid +

+ 10 - 19
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/mapper/TWhgenlegMapper.java

@@ -102,6 +102,8 @@ public interface TWhgenlegMapper {
 
     List<Map<String, Object>> selectDateFQtyblcListList(@Param("map") Map<String, Object> map);
 
+    List<Map<String, Object>> getCorpsByfMblno(String fMblno);
+
     /**
      * 查询库存总账计算仓储费
      *
@@ -176,14 +178,17 @@ public interface TWhgenlegMapper {
     public Map<String, Object> stockStatistics(@Param("beginDate") String beginDate,
                                                @Param("endDate") String endDate,
                                                @Param("external") String external,
-                                               @Param("warehouseId") Long warehouseId);
+                                               @Param("warehouseId") Long warehouseId,
+                                               @Param("customerId") Long customerId);
 
     /**
      * 库龄
      * @param external 外部用户
      * @return
      */
-    public Map<String, Object> stockDays(@Param("external") String external, @Param("warehouseId") Long warehouseId);
+    public Map<String, Object> stockDays(@Param("external") String external,
+                                         @Param("warehouseId") Long warehouseId,
+                                         @Param("customerId") Long customerId);
 
     /**
      * 库龄超过60天的库存列表
@@ -197,22 +202,8 @@ public interface TWhgenlegMapper {
      *
      * @return
      */
-    public List<Map<String, Object>> biCustomerInfo(Long warehouseId);
-
-    /**
-     * bi大屏商品概况
-     *
-     * @return
-     */
-    public List<Map<String, Object>> biGoodsInfo(Long warehouseId);
-
-    /**
-     * bi大屏毛重概况
-     *
-     * @return
-     */
-    public Map<String, Object> biWeightInfo(@Param("beginDate") String beginDate,
-                                                  @Param("endDate") String endDate,
-                                                  @Param("warehouseId") Long warehouseId);
+    public List<Map<String, Object>> biCustomerInfo(@Param("external") String external,
+                                                    @Param("warehouseId") Long warehouseId,
+                                                    @Param("customerId") Long customerId);
 
 }

+ 13 - 13
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/ITWhgenlegService.java

@@ -49,7 +49,7 @@ public interface ITWhgenlegService {
      * @param tWhgenleg 库存总账
      * @return 库存总账集合
      */
-    List<Map<String, Object>> selectInventoryMapList(TWhgenleg tWhgenleg);
+    List<Map<String, Object>> selectInventoryMapList(TWhgenleg tWhgenleg, Integer pageNum, Integer pageSize);
 
     /**
      * 新增库存总账
@@ -107,6 +107,13 @@ public interface ITWhgenlegService {
     Map<String, Object> selectCorpsList(Long fId);
 
     /**
+     * 根据提单号获取客户
+     *
+     * @return
+     */
+    List<Map<String, Object>> getCorpsByfMblno(String fMblno);
+
+    /**
      * 一周库存总量
      *
      * @return
@@ -171,41 +178,34 @@ public interface ITWhgenlegService {
      *
      * @return
      */
-    public List<Map<String, Object>> biCustomerInfo(Long warehouseId);
+    public List<Map<String, Object>> biCustomerInfo(Long warehouseId, Long customerId);
 
     /**
      * bi库存数量
      *
      * @return
      */
-    public Map<String, Object> biStockCount(Long warehouseId);
-
-    /**
-     * bi大屏商品概况
-     *
-     * @return
-     */
-    public List<Map<String, Object>> biGoodsInfo(Long warehouseId);
+    public Map<String, Object> biStockCount(Long warehouseId, Long customerId);
 
     /**
      * bi大屏毛重概况
      *
      * @return
      */
-    public Map<String, Object> biWeightInfo(Long warehouseId);
+    public Map<String, Object> biWeightInfo(Long warehouseId, Long customerId, String mode);
 
     /**
      * bi大屏最大库龄
      *
      * @return
      */
-    public Map<String, Object> biMaxStockDays(Long warehouseId);
+    public Map<String, Object> biMaxStockDays(Long warehouseId, Long customerId);
 
     /**
      * bi大屏库龄概况
      *
      * @return
      */
-    public List<Map<String, Object>> biStockDaysInfo(Long warehouseId);
+    public List<Map<String, Object>> biStockDaysInfo(Long warehouseId, Long customerId);
 
 }

+ 80 - 34
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java

@@ -25,6 +25,7 @@ import com.ruoyi.reportManagement.service.ITWhgenlegService;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.domain.enums.WarehouseTypeEnum;
 import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
+import com.ruoyi.warehouseBusiness.mapper.TWarehousebillsitemsMapper;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -50,9 +51,13 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
 
     @Autowired
     private TWarehouseMapper tWarehouseMapper;
+
     @Autowired
     private TCustomerContactMapper customerContactMapper;
 
+    @Autowired
+    private TWarehousebillsitemsMapper tWarehousebillsitemsMapper;
+
     /**
      * 查询库存总账
      *
@@ -163,7 +168,7 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
      * @return 库存总账集合
      */
     @Override
-    public List<Map<String, Object>> selectInventoryMapList(TWhgenleg tWhgenleg) {
+    public List<Map<String, Object>> selectInventoryMapList(TWhgenleg tWhgenleg, Integer pageNum, Integer pageSize) {
         if (StringUtils.isNotNull(tWhgenleg.getfWarehouseLocationid())) {
             // 获取仓库信息
             TWarehouse tWarehouse = tWarehouseMapper.selectTWarehouseById(tWhgenleg.getfWarehouseLocationid());
@@ -173,6 +178,10 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
                 tWhgenleg.setfLocation(0L);
             }
         }
+
+        if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
+            PageHelper.startPage(pageNum, pageSize);
+        }
         return tWhgenlegMapper.selectInventoryMapList(tWhgenleg);
     }
 
@@ -409,6 +418,11 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
     }
 
     @Override
+    public List<Map<String, Object>> getCorpsByfMblno(String fMblno) {
+        return tWhgenlegMapper.getCorpsByfMblno(fMblno);
+    }
+
+    @Override
     public List<Map<String, Object>> selectDateFQtyblcListList() {
         // 当天往前推 一周
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd ");
@@ -637,8 +651,14 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
      * @return
      */
     @Override
-    public List<Map<String, Object>> biCustomerInfo(Long warehouseId) {
-        return tWhgenlegMapper.biCustomerInfo(warehouseId);
+    public List<Map<String, Object>> biCustomerInfo(Long warehouseId, Long customerId) {
+        String external = null;
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            external = user.getUserName();
+        }
+
+        return tWhgenlegMapper.biCustomerInfo(external, warehouseId, customerId);
     }
 
     /**
@@ -647,18 +667,14 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
      * @return
      */
     @Override
-    public Map<String, Object> biStockCount(Long warehouseId) {
-        return tWhgenlegMapper.stockStatistics(null, null, null, warehouseId);
-    }
+    public Map<String, Object> biStockCount(Long warehouseId, Long customerId) {
+        String external = null;
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            external = user.getUserName();
+        }
 
-    /**
-     * bi大屏商品概况
-     *
-     * @return
-     */
-    @Override
-    public List<Map<String, Object>> biGoodsInfo(Long warehouseId) {
-        return tWhgenlegMapper.biGoodsInfo(warehouseId);
+        return tWhgenlegMapper.stockStatistics(null, null, external, warehouseId, customerId);
     }
 
     /**
@@ -667,32 +683,50 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
      * @return
      */
     @Override
-    public Map<String, Object> biWeightInfo(Long warehouseId) {
+    public Map<String, Object> biWeightInfo(Long warehouseId, Long customerId, String mode) {
+        String external = null;
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            external = user.getUserName();
+        }
+
+        List<String> names = new ArrayList<>();
+        if ("3".equals(mode)) {
+            Collections.addAll(names, "入库尺码", "出库尺码");
+        } else if ("2".equals(mode)) {
+            Collections.addAll(names, "入库重量", "出库重量");
+        } else {
+            mode = "1";
+            Collections.addAll(names, "入库件数", "出库件数");
+        }
+
         Map<String, Object> data = new HashMap<>();
         List<Map<String, Object>> series = new ArrayList<>();
         Map<String, Object> seriesMap;
 
         List<String> categories = new ArrayList<>();
         List<Object> quantityInList = new ArrayList<>();
-        List<Object> quantityList = new ArrayList<>();
+        List<Object> quantityOutList = new ArrayList<>();
         Map<String, Object> weightMap;
 
-        for (int i = -6; i < 0; i++) {
+        for (int i = -5; i <= 0; i++) {
             categories.add(DateUtils.offsetOnlyMonth(i) + "月");
 
-            weightMap = tWhgenlegMapper.biWeightInfo(DateUtils.beginOfOffsetMonth(i) + " 00:00:00",
-                    DateUtils.endOfOffsetMonth(i) + " 23:59:59", warehouseId);
-            quantityInList.add(weightMap.get("quantityIn"));
-            quantityList.add(weightMap.get("quantity"));
+            weightMap = tWarehousebillsitemsMapper.inAndOutStockStatistics("SJRK", DateUtils.beginOfOffsetMonth(i) + " 00:00:00",
+                    DateUtils.endOfOffsetMonth(i) + " 23:59:59", external, warehouseId, customerId, mode);
+            quantityInList.add(weightMap.get("total"));
+            weightMap = tWarehousebillsitemsMapper.inAndOutStockStatistics("SJCK", DateUtils.beginOfOffsetMonth(i) + " 00:00:00",
+                    DateUtils.endOfOffsetMonth(i) + " 23:59:59", external, warehouseId, customerId, mode);
+            quantityOutList.add(weightMap.get("total"));
         }
 
         seriesMap = new HashMap<>();
-        seriesMap.put("name", "入库毛重");
+        seriesMap.put("name", names.get(0));
         seriesMap.put("data", quantityInList);
         series.add(seriesMap);
         seriesMap = new HashMap<>();
-        seriesMap.put("name", "库存毛重");
-        seriesMap.put("data", quantityList);
+        seriesMap.put("name", names.get(1));
+        seriesMap.put("data", quantityOutList);
         series.add(seriesMap);
 
         data.put("categories", categories);
@@ -706,8 +740,14 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
      * @return
      */
     @Override
-    public Map<String, Object> biMaxStockDays(Long warehouseId) {
-        return tWhgenlegMapper.stockDays(null, warehouseId);
+    public Map<String, Object> biMaxStockDays(Long warehouseId, Long customerId) {
+        String external = null;
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            external = user.getUserName();
+        }
+
+        return tWhgenlegMapper.stockDays(external, warehouseId, customerId);
     }
 
     /**
@@ -716,42 +756,48 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
      * @return
      */
     @Override
-    public List<Map<String, Object>> biStockDaysInfo(Long warehouseId) {
+    public List<Map<String, Object>> biStockDaysInfo(Long warehouseId, Long customerId) {
+        String external = null;
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            external = user.getUserName();
+        }
+
         List<Map<String, Object>> data = new ArrayList<>();
         Map<String, Object> item;
 
         item = tWhgenlegMapper.stockStatistics(DateUtils.offsetDate(-6) + " 00:00:00",
-                null, null, warehouseId);
+                null, external, warehouseId, customerId);
         item.put("name", "7天以内");
         data.add(item);
 
         item = tWhgenlegMapper.stockStatistics(DateUtils.offsetDate(-14) + " 00:00:00",
-                DateUtils.offsetDate(-6) + " 00:00:00", null, warehouseId);
+                DateUtils.offsetDate(-6) + " 00:00:00", external, warehouseId, customerId);
         item.put("name", "7~15天");
         data.add(item);
 
         item = tWhgenlegMapper.stockStatistics(DateUtils.offsetDate(-29) + " 00:00:00",
-                DateUtils.offsetDate(-14) + " 00:00:00", null, warehouseId);
+                DateUtils.offsetDate(-14) + " 00:00:00", external, warehouseId, customerId);
         item.put("name", "15~30天");
         data.add(item);
 
         item = tWhgenlegMapper.stockStatistics(DateUtils.offsetDate(-59) + " 00:00:00",
-                DateUtils.offsetDate(-29) + " 00:00:00", null, warehouseId);
+                DateUtils.offsetDate(-29) + " 00:00:00", external, warehouseId, customerId);
         item.put("name", "30~60天");
         data.add(item);
 
         item = tWhgenlegMapper.stockStatistics(DateUtils.offsetDate(-89) + " 00:00:00",
-                DateUtils.offsetDate(-59) + " 00:00:00", null, warehouseId);
+                DateUtils.offsetDate(-59) + " 00:00:00", external, warehouseId, customerId);
         item.put("name", "60~90天");
         data.add(item);
 
         item = tWhgenlegMapper.stockStatistics(DateUtils.offsetDate(-179) + " 00:00:00",
-                DateUtils.offsetDate(-89) + " 00:00:00", null, warehouseId);
+                DateUtils.offsetDate(-89) + " 00:00:00", external, warehouseId, customerId);
         item.put("name", "90~180天");
         data.add(item);
 
         item = tWhgenlegMapper.stockStatistics(null,
-                DateUtils.offsetDate(-179) + " 00:00:00", null, warehouseId);
+                DateUtils.offsetDate(-179) + " 00:00:00", external, warehouseId, customerId);
         item.put("name", "超过180天");
         data.add(item);
 

+ 13 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseAgreement.java

@@ -143,6 +143,11 @@ public class TWarehouseAgreement extends BaseEntity {
     @Excel(name = "仓库")
     private String fWarehouseid;
 
+    /**
+     * 提醒天数
+     */
+    private Long remindDays;
+
     public String getfWarehouseid() {
         return fWarehouseid;
     }
@@ -311,6 +316,14 @@ public class TWarehouseAgreement extends BaseEntity {
         this.fDc = fDc;
     }
 
+    public Long getRemindDays() {
+        return remindDays;
+    }
+
+    public void setRemindDays(Long remindDays) {
+        this.remindDays = remindDays;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

+ 44 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseBills.java

@@ -86,6 +86,12 @@ public class TWarehouseBills extends BaseEntity {
     private Long fCorpid;
 
     /**
+     * 发货方
+     */
+    @Excel(name = "发货方")
+    private String fShipper;
+
+    /**
      * 货转客户名称,t_corps 中的no或 name,模糊查找选择后,存储id,显示name,自有在货权转移是该字段有效
      */
     @Excel(name = "货转客户名称,t_corps 中的no或 name,模糊查找选择后,存储id,显示name,自有在货权转移是该字段有效")
@@ -209,6 +215,18 @@ public class TWarehouseBills extends BaseEntity {
     private String fMblno;
 
     /**
+     * 提单号
+     */
+    @Excel(name = "出口单号")
+    private String fEmblno;
+
+    /**
+     * 所属公司-打印抬头
+     */
+    @Excel(name = "所属公司")
+    private Long fCompany;
+
+    /**
      * 船名航次,CMA/A0001
      */
     @Excel(name = "船名航次,CMA/A0001")
@@ -1369,6 +1387,14 @@ public class TWarehouseBills extends BaseEntity {
         return fCorpid;
     }
 
+    public void setfShipper(String fShipper) {
+        this.fShipper = fShipper;
+    }
+
+    public String getfShipper() {
+        return fShipper;
+    }
+
     public void setfTocorpid(Long fTocorpid) {
         this.fTocorpid = fTocorpid;
     }
@@ -1529,6 +1555,22 @@ public class TWarehouseBills extends BaseEntity {
         return fMblno;
     }
 
+    public String getfEmblno() {
+        return fEmblno;
+    }
+
+    public void setfEmblno(String fEmblno) {
+        this.fEmblno = fEmblno;
+    }
+
+    public Long getfCompany() {
+        return fCompany;
+    }
+
+    public void setfCompany(Long fCompany) {
+        this.fCompany = fCompany;
+    }
+
     public void setfVslvoy(String fVslvoy) {
         this.fVslvoy = fVslvoy;
     }
@@ -1886,6 +1928,7 @@ public class TWarehouseBills extends BaseEntity {
                 ", fContacts='" + fContacts + '\'' +
                 ", fTel='" + fTel + '\'' +
                 ", fCorpid=" + fCorpid +
+                ", fShipper=" + fShipper +
                 ", fTocorpid=" + fTocorpid +
                 ", fStltypeid=" + fStltypeid +
                 ", fBscorpno='" + fBscorpno + '\'' +
@@ -1906,6 +1949,7 @@ public class TWarehouseBills extends BaseEntity {
                 ", fFeetunit='" + fFeetunit + '\'' +
                 ", fProductName='" + fProductName + '\'' +
                 ", fMblno='" + fMblno + '\'' +
+                ", fEmblno='" + fEmblno + '\'' +
                 ", fVslvoy='" + fVslvoy + '\'' +
                 ", fMarks='" + fMarks + '\'' +
                 ", fEta=" + fEta +

+ 15 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehousebillsitems.java

@@ -56,6 +56,12 @@ public class TWarehousebillsitems extends BaseEntity {
     private String fBillno;
 
     /**
+     * 发货方
+     */
+    @Excel(name = "发货方")
+    private String fShipper;
+
+    /**
      * 提单号
      */
     @Excel(name = "提单号")
@@ -538,6 +544,14 @@ public class TWarehousebillsitems extends BaseEntity {
         return fBillno;
     }
 
+    public void setfShipper(String fShipper) {
+        this.fShipper = fShipper;
+    }
+
+    public String getfShipper() {
+        return fShipper;
+    }
+
     public void setfMblno(String fMblno) {
         this.fMblno = fMblno;
     }
@@ -979,4 +993,4 @@ public class TWarehousebillsitems extends BaseEntity {
                 ", fCartypeId='" + fCartypeId + '\'' +
                 '}';
     }
-}
+}

+ 14 - 8
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/excel/StorageDetail.java

@@ -54,7 +54,7 @@ public class StorageDetail {
      * 入库重量
      */
     @Excel(name = "重量", isStatistics = true)
-    private Float fGrossweightD;
+    private BigDecimal fGrossweightD;
 
     /**
      * 出库日期
@@ -78,7 +78,19 @@ public class StorageDetail {
      * 出库重量
      */
     @Excel(name = "重量", isStatistics = true)
-    private Float fGrossweightC;
+    private BigDecimal fGrossweightC;
+
+    /**
+     * 计费单位
+     */
+    @Excel(name = "计费单位")
+    private String fBillingway;
+
+    /**
+     * 计费数量
+     */
+    @Excel(name = "计费数量", isStatistics = true)
+    private BigDecimal fBillingQty;
 
     /**
      * 堆存天数
@@ -92,10 +104,4 @@ public class StorageDetail {
     @Excel(name = "出库堆存费", isStatistics = true)
     private BigDecimal fAmount;
 
-    /**
-     * 结余
-     */
-    @Excel(name = "结余", isStatistics = true)
-    private BigDecimal surplus;
-
 }

+ 6 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseAgreementMapper.java

@@ -84,13 +84,17 @@ public interface TWarehouseAgreementMapper {
      *
      * @return
      */
-    public Map<String, Object> biContractCount(@Param("beginDate") String beginDate, @Param("endDate") String endDate);
+    public Map<String, Object> biContractCount(@Param("beginDate") String beginDate,
+                                               @Param("endDate") String endDate,
+                                               @Param("external") String external,
+                                               @Param("customerId") Long customerId);
 
     /**
      * 仓储协议列表
      *
      * @return 仓储费集合
      */
-    public List<Map<String, Object>> biContractList();
+    public List<Map<String, Object>> biContractList(@Param("external") String external,
+                                                    @Param("customerId") Long customerId);
 
 }

+ 1 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java

@@ -129,7 +129,7 @@ public interface TWarehouseBillsMapper extends BaseMapper<TWarehouseBills> {
     /**
      * 查询入库信息
      */
-    public List<StorageDetail> selectInStockDetail(@Param("fId") Long fId);
+    public List<StorageDetail> selectInStockDetail(@Param("fId") Long fId, @Param("billType") String billType);
 
     /**
      * 查询非入库信息

+ 7 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsitemsMapper.java

@@ -299,7 +299,9 @@ public interface TWarehousebillsitemsMapper extends BaseMapper<TWarehousebillsit
                                                        @Param("beginDate") String beginDate,
                                                        @Param("endDate") String endDate,
                                                        @Param("external") String external,
-                                                       @Param("warehouseId") Long warehouseId);
+                                                       @Param("warehouseId") Long warehouseId,
+                                                       @Param("customerId") Long customerId,
+                                                       @Param("mode") String mode);
 
     /**
      * bi出入库列表
@@ -307,6 +309,9 @@ public interface TWarehousebillsitemsMapper extends BaseMapper<TWarehousebillsit
      * @param billType 单据类型
      * @return
      */
-    public List<Map<String,Object>> biInAndOutStockList(@Param("billType") String billType, @Param("warehouseId") Long warehouseId);
+    public List<Map<String,Object>> biInAndOutStockList(@Param("billType") String billType,
+                                                        @Param("external") String external,
+                                                        @Param("warehouseId") Long warehouseId,
+                                                        @Param("customerId") Long customerId);
 
 }

+ 2 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseAgreementService.java

@@ -85,13 +85,13 @@ public interface ITWarehouseAgreementService {
      *
      * @return
      */
-    public Map<String, Object> biContractCount();
+    public Map<String, Object> biContractCount(Long customerId);
 
     /**
      * 仓储协议列表
      *
      * @return 仓储费集合
      */
-    public List<Map<String, Object>> biContractList();
+    public List<Map<String, Object>> biContractList(Long customerId);
 
 }

+ 7 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java

@@ -301,6 +301,13 @@ public interface ITWarehouseBillsService {
     public List<StorageDetail> selectStorageDetail(Long fId);
 
     /**
+     * 导出仓储费账单
+     *
+     * @return 文件名
+     */
+    public String exportStorageBill();
+
+    /**
      * 查询出入库汇总列表
      *
      * @param tWarehouseBills 仓储主表

+ 2 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehousebillsitemsService.java

@@ -90,7 +90,7 @@ public interface ITWarehousebillsitemsService {
      * @param billType 单据类型
      * @return
      */
-    public Map<String,Object> biTodayInAndOutStockCount(String billType, Long warehouseId);
+    public Map<String,Object> biTodayInAndOutStockCount(String billType, Long warehouseId, Long customerId);
 
     /**
      * bi出入库列表
@@ -98,6 +98,6 @@ public interface ITWarehousebillsitemsService {
      * @param billType 单据类型
      * @return
      */
-    public List<Map<String,Object>> biInAndOutStockList(String billType, Long warehouseId);
+    public List<Map<String,Object>> biInAndOutStockList(String billType, Long warehouseId, Long customerId);
 
 }

+ 22 - 7
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseAgreementServiceImpl.java

@@ -11,10 +11,12 @@ import com.ruoyi.basicData.domain.TFees;
 import com.ruoyi.basicData.mapper.TCorpsMapper;
 import com.ruoyi.basicData.mapper.TFeesMapper;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.exception.BaseException;
 import com.ruoyi.common.exception.WarehouseException;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.SysConfig;
 import com.ruoyi.system.mapper.SysConfigMapper;
@@ -685,11 +687,12 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
     @Override
     public List<Map<String, Object>> agreementRemind(TWarehouseAgreement tWarehouseAgreement) {
         // 从参数里获取通知时间
-        SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique("data_print_title");
+        SysConfig sysConfig = sysConfigMapper.checkConfigKeyUnique("agreement.remind");
         if (StringUtils.isNull(sysConfig)) {
             throw new BaseException("系统参数异常,未找到协议到期提醒时间");
         }
-        String days = sysConfig.getConfigValue();
+        Long remindDays = Long.parseLong(sysConfig.getConfigValue());
+        tWarehouseAgreement.setRemindDays(remindDays);
         return tWarehouseAgreementMapper.agreementRemind(tWarehouseAgreement);
     }
 
@@ -699,11 +702,17 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
      * @return
      */
     @Override
-    public Map<String, Object> biContractCount() {
+    public Map<String, Object> biContractCount(Long customerId) {
         String beginDate = DateUtils.today() + " 00:00:00";
-        String endDate = DateUtils.offsetMonth(2) + "23:59:59";
+        String endDate = DateUtils.offsetMonth(2) + " 23:59:59";
 
-        return tWarehouseAgreementMapper.biContractCount(beginDate, endDate);
+        String external = null;
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            external = user.getUserName();
+        }
+
+        return tWarehouseAgreementMapper.biContractCount(beginDate, endDate, external, customerId);
     }
 
     /**
@@ -712,8 +721,14 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
      * @return 仓储费集合
      */
     @Override
-    public List<Map<String, Object>> biContractList() {
-        return tWarehouseAgreementMapper.biContractList();
+    public List<Map<String, Object>> biContractList(Long customerId) {
+        String external = null;
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            external = user.getUserName();
+        }
+
+        return tWarehouseAgreementMapper.biContractList(external, customerId);
     }
 
 }

+ 22 - 4
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -25,6 +25,7 @@ import com.ruoyi.common.utils.DictUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.ip.AddressUtils;
+import com.ruoyi.common.utils.poi.DrawExcel;
 import com.ruoyi.common.utils.poi.ExcelUtils;
 import com.ruoyi.quotation.domain.TSeaprice;
 import com.ruoyi.quotation.mapper.TSeapriceMapper;
@@ -546,6 +547,9 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             if (StringUtils.isNotEmpty(warehouseBills.getRemark())) {
                 tWhgenleg.setRemark(warehouseBills.getRemark());
             }
+            if (StringUtils.isNotEmpty(warehouseBills.getfShipper())) {
+                tWhgenleg.setfShipper(warehouseBills.getfShipper());
+            }
         }
         if (WarehouseTypeEnum.HQZY.getType().equals(warehouseBills.getfBilltype()) || WarehouseTypeEnum.CKDB.getType().equals(warehouseBills.getfBilltype()) ||
                 WarehouseTypeEnum.HWTG.getType().equals(warehouseBills.getfBilltype())) {
@@ -1552,13 +1556,27 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     @Override
     public List<StorageDetail> selectStorageDetail(Long fId) {
         List<StorageDetail> storageDetails = new ArrayList<>();
-        storageDetails.addAll(tWarehouseBillsMapper.selectInStockDetail(fId));
+        storageDetails.addAll(tWarehouseBillsMapper.selectInStockDetail(fId, "SJRK"));
+        storageDetails.addAll(tWarehouseBillsMapper.selectInStockDetail(fId, "CKDB"));
         storageDetails.addAll(tWarehouseBillsMapper.selectNotInStockDetail(fId, "HQZY"));
         storageDetails.addAll(tWarehouseBillsMapper.selectNotInStockDetail(fId, "SJCK"));
         storageDetails.addAll(tWarehouseBillsMapper.selectInventoryDetail(fId));
         return storageDetails;
     }
 
+    /**
+     * 导出仓储费账单
+     *
+     * @return 文件名
+     */
+    @Override
+    public String exportStorageBill() {
+        // TODO 仓储费账单导出
+        String filename = "仓储费账单.xlsx";
+        DrawExcel ioExcel = new DrawExcel(DrawExcel.getAbsoluteFile(filename));
+        return null;
+    }
+
     @Override
     public List<Map<String, Object>> selectInventoryList(TWarehouseBills tWarehouseBills) {
         if (StringUtils.isNotNull(tWarehouseBills.getfWarehouseid())) {
@@ -7752,7 +7770,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 
         Map<String, String> data = new HashMap<>();
         // 库龄
-        data.put("stockDays", String.valueOf(tWhgenlegMapper.stockDays(external, null).get("stockDays")));
+        data.put("stockDays", String.valueOf(tWhgenlegMapper.stockDays(external, null, null).get("stockDays")));
         // 7天
         data.put("stockTotalA", stockStatistics(DateUtils.offsetDate(-6), null, external));
         // 15天
@@ -7773,7 +7791,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     private String inAndOutStockStatistics(String billType, String beginDate, String endDate, String external) {
         beginDate += " 00:00:00";
         endDate += " 23:59:59";
-        Map<String, Object> statistics = tWarehousebillsitemsMapper.inAndOutStockStatistics(billType, beginDate, endDate, external, null);
+        Map<String, Object> statistics = tWarehousebillsitemsMapper.inAndOutStockStatistics(billType, beginDate, endDate, external, null, null, null);
         return String.valueOf(statistics.get("total"));
     }
 
@@ -7784,7 +7802,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         if (StringUtils.isNotEmpty(endDate)) {
             endDate += " 00:00:00";
         }
-        Map<String, Object> statistics = tWhgenlegMapper.stockStatistics(beginDate, endDate, external, null);
+        Map<String, Object> statistics = tWhgenlegMapper.stockStatistics(beginDate, endDate, external, null, null);
         return String.valueOf(statistics.get("quantity"));
     }
 

+ 16 - 4
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehousebillsitemsServiceImpl.java

@@ -238,11 +238,17 @@ public class TWarehousebillsitemsServiceImpl implements ITWarehousebillsitemsSer
      * @return
      */
     @Override
-    public Map<String,Object> biTodayInAndOutStockCount(String billType, Long warehouseId){
+    public Map<String,Object> biTodayInAndOutStockCount(String billType, Long warehouseId, Long customerId){
         String beginDate = DateUtils.today() + " 00:00:00";
         String endDate = DateUtils.today() + " 23:59:59";
 
-        return tWarehousebillsitemsMapper.inAndOutStockStatistics(billType, beginDate, endDate, null, warehouseId);
+        String external = null;
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            external = user.getUserName();
+        }
+
+        return tWarehousebillsitemsMapper.inAndOutStockStatistics(billType, beginDate, endDate, external, warehouseId, customerId, null);
     }
 
     /**
@@ -252,8 +258,14 @@ public class TWarehousebillsitemsServiceImpl implements ITWarehousebillsitemsSer
      * @return
      */
     @Override
-    public List<Map<String,Object>> biInAndOutStockList(String billType, Long warehouseId) {
-        return tWarehousebillsitemsMapper.biInAndOutStockList(billType, warehouseId);
+    public List<Map<String,Object>> biInAndOutStockList(String billType, Long warehouseId, Long customerId) {
+        String external = null;
+        SysUser user = SecurityUtils.getLoginUser().getUser();
+        if ("外部用户".equals(user.getDept().getDeptName())) {
+            external = user.getUserName();
+        }
+
+        return tWarehousebillsitemsMapper.biInAndOutStockList(billType, external, warehouseId, customerId);
     }
 
 }

+ 19 - 5
ruoyi-warehouse/src/main/resources/mapper/basicData/TCorpsMapper.xml

@@ -458,13 +458,27 @@
             </foreach>
     </select>
 
-    <select id="biCustomerCount" parameterType="long" resultType="map">
+    <select id="biCustomerCount" resultType="map">
         select count(f_id) as customerCount
         from t_corps
-        where f_id in (
-            select distinct f_corpid from t_whgenleg where f_qtyD != 0 and f_qtyblc != 0
-                <if test="warehouseId != null"> and f_warehouseid = #{warehouseId}</if>
-        );
+        where
+            f_id in (
+                select distinct f_corpid from t_whgenleg where f_qtyD != 0 and f_qtyblc != 0
+                    <if test="warehouseId != null">and f_warehouseid = #{warehouseId}</if>
+                    <if test="external != null">and f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})</if>
+                    <if test="customerId != null">and f_corpid = #{customerId}</if>
+            )
+    </select>
+
+    <select id="biCustomerList" resultType="map">
+        select f_id as customerId,
+            f_name as customerName
+        from t_corps
+        where f_typename like '%客户%'
+        <if test="external != null and external != ''">
+            and f_id = (select f_corpid from t_customer_contact where f_tel = #{external})
+        </if>
+        order by convert(f_name using gbk)
     </select>
 
 </mapper>

+ 7 - 0
ruoyi-warehouse/src/main/resources/mapper/basicData/TWarehouseMapper.xml

@@ -326,5 +326,12 @@
             f_name as warehouseName
         from t_warehouse
         where parent_id = 100
+        <if test="external != null and external != ''">
+            and f_id in (
+                select distinct f_warehouseid
+                from t_customer_contact t1 left join t_whgenleg t2 on t1.f_pid = t2.f_corpid
+                where f_tel = #{external})
+        </if>
+        order by convert(f_name using gbk)
     </select>
 </mapper>

+ 5 - 4
ruoyi-warehouse/src/main/resources/mapper/basicData/TWarehouseWebcamMapper.xml

@@ -136,10 +136,11 @@
         <include refid="selectTWarehouseWebcamVo"/>
         <where>
             <if test="fWarehouseId != null ">and f_warehouse_id = #{fWarehouseId}</if>
-            <if test="corpId != null">
-                and f_warehouse_id in (select f_id from t_warehouse where parent_id = 100 and f_id in (
-                    select distinct f_warehouseid from t_whgenleg where f_corpid = #{corpId})
-                )
+            <if test="external != null and external != ''">
+                and f_warehouse_id in (
+                    select distinct f_warehouseid
+                    from t_customer_contact t1 left join t_whgenleg t2 on t1.f_pid = t2.f_corpid
+                    where f_tel = #{external})
             </if>
         </where>
     </select>

+ 57 - 56
ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml

@@ -9,6 +9,7 @@
         <result property="fAccyear" column="f_accyear"/>
         <result property="fAccmonth" column="f_accmonth"/>
         <result property="fCorpid" column="f_corpid"/>
+        <result property="fShipper" column="f_shipper"/>
         <result property="fMblno" column="f_mblno"/>
         <result property="fOriginalbillno" column="f_originalbillno"/>
         <result property="fWarehouseLocationid" column="f_warehouse_locationid"/>
@@ -88,7 +89,7 @@
     </resultMap>
 
     <sql id="selectTWhgenlegVo">
-        select f_id, f_accyear, f_accmonth, f_corpid, f_mblno, f_originalbillno, f_warehouse_locationid, f_goodsid, f_trademodeid, f_preqty,
+        select f_id, f_accyear, f_accmonth, f_corpid, f_shipper, f_mblno, f_originalbillno, f_warehouse_locationid, f_goodsid, f_trademodeid, f_preqty,
          f_pregrossweight, f_warehouseid, f_prenetweight, f_bsdate, f_chargedate, f_volumnD, f_qtyD, f_billingway, f_grossweightD, f_netweightD, f_volumnC,
           f_qtyC, f_grossweightC, f_qtyblc, f_grossweightblc, f_netweightC, f_netweightblc, f_cntrno, f_status, del_flag, f_marks, create_by,
            create_time, update_by, f_volumnblc, update_time, remark, f_business_type, f_originalbilldate, f_localcntrno,f_customno from t_whgenleg
@@ -116,6 +117,7 @@
             <if test="fNetweightd != null ">and f_netweightD = #{fNetweightd}</if>
             <if test="fVolumnc != null ">and f_volumnC = #{fVolumnc}</if>
             <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fBusinessType != null "> and f_business_type = #{fBusinessType}</if>
             <if test="fQtyc != null ">and f_qtyC = #{fQtyc}</if>
             <if test="fGrossweightc != null ">and f_grossweightC = #{fGrossweightc}</if>
@@ -136,6 +138,7 @@
         <include refid="selectTWhgenlegVo"/>
         <where>
             <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null ">and f_shipper = #{fShipper}</if>
             <if test="fMblno != null ">and f_mblno = #{fMblno}</if>
             <if test="fCntrno != null ">and f_cntrno = #{fCntrno}</if>
             <if test="fBusinessType != null ">and f_business_type = #{fBusinessType}</if>
@@ -176,6 +179,7 @@
             <if test="fAccyear != null">f_accyear,</if>
             <if test="fAccmonth != null">f_accmonth,</if>
             <if test="fCorpid != null">f_corpid,</if>
+            <if test="fShipper != null">f_shipper,</if>
             <if test="fMblno != null">f_mblno,</if>
             <if test="fOriginalbillno != null">f_originalbillno,</if>
             <if test="fWarehouseLocationid != null">f_warehouse_locationid,</if>
@@ -217,6 +221,7 @@
             <if test="fAccyear != null">#{fAccyear},</if>
             <if test="fAccmonth != null">#{fAccmonth},</if>
             <if test="fCorpid != null">#{fCorpid},</if>
+            <if test="fShipper != null">#{fShipper},</if>
             <if test="fMblno != null">#{fMblno},</if>
             <if test="fOriginalbillno != null">#{fOriginalbillno},</if>
             <if test="fWarehouseLocationid != null">#{fWarehouseLocationid},</if>
@@ -262,6 +267,7 @@
             <if test="fAccyear != null">f_accyear = #{fAccyear},</if>
             <if test="fAccmonth != null">f_accmonth = #{fAccmonth},</if>
             <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
+            <if test="fShipper != null">f_shipper = #{fShipper},</if>
             <if test="fMblno != null">f_mblno = #{fMblno},</if>
             <if test="fOriginalbillno != null">f_originalbillno = #{fOriginalbillno},</if>
             <if test="fWarehouseLocationid != null">f_warehouse_locationid = #{fWarehouseLocationid},</if>
@@ -561,6 +567,17 @@
             t.f_originalbilldate
     </select>
 
+    <select id="getCorpsByfMblno" parameterType="string" resultType="Map">
+        select
+            tc.f_id as fId,
+            tc.f_name as fName
+        from t_whgenleg tw left join t_corps tc on tw.f_corpid = tc.f_id
+        <where>
+            <if test="fId != null and fId != ''">and tw.f_mblno like concat('%',#{fMblno},'%')</if>
+        </where>
+        group by tc.f_id, tc.f_name
+    </select>
+
     <select id="selectStorageFeeItemList" parameterType="com.ruoyi.warehouseBusiness.domain.TWarehouseBills" resultType="Map">
         SELECT
             wh.f_id AS fId,
@@ -640,6 +657,7 @@
             leg.f_corpid AS fCorpIds,
             leg.f_bsdate AS fBsdate,
             corp.f_name AS fCorpid,
+            leg.f_shipper AS fShipper,
             ware.f_warehouse_information AS fWarehouseids,
             area.f_name AS fWarehouseLocationids,
             leg.f_originalbillno AS fOriginalbillno,
@@ -691,6 +709,7 @@
             <if test="fOriginalbillno != null  and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
             <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
             <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test='orgStorageDate != null and orgStorageDate[0] != null and orgStorageDate[0]!= ""'>
                 and leg.f_originalbilldate &gt;= #{orgStorageDate[0]}
             </if>
@@ -725,7 +744,6 @@
                 and ware.ancestors  LIKE  concat('%', #{fWarehouseLocationid}, '%')
             </if>
         </where>
-        ${params.dataScope}
     </select>
 
     <select id="selectInventoryMapList" parameterType="TWhgenleg" resultType="Map">
@@ -734,7 +752,9 @@
             leg.f_id AS fId,
             leg.f_corpid AS fCorpIds,
             corp.f_name AS fCorpid,
-            ware.f_warehouse_information AS fWarehouseids,
+            leg.f_shipper AS fShipper,
+            <if test="isCntrno != null and isCntrno != 2 ">ware.f_warehouse_information AS fWarehouseids,</if>
+            <if test="isCntrno != null and isCntrno == 2 ">ware.f_name AS fWarehouseids,</if>
             area.f_name AS fWarehouseLocationids,
             leg.f_originalbillno AS fOriginalbillno,
             leg.f_warehouse_locationid AS fWarehouseLocationid,
@@ -773,7 +793,8 @@
             LEFT JOIN t_corps corp ON corp.f_id = leg.f_corpid
             LEFT JOIN t_customer_contact tc ON tc.f_pid = corp.f_id
             LEFT JOIN t_goods goods ON goods.f_id = leg.f_goodsid
-            LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid
+            <if test="isCntrno != null and isCntrno != 2 ">LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouse_locationid</if>
+            <if test="isCntrno != null and isCntrno == 2 ">LEFT JOIN t_warehouse ware ON ware.f_id = leg.f_warehouseid</if>
             LEFT JOIN sys_dict_data dict ON dict.dict_value = leg.f_business_type
             LEFT JOIN t_warehouse_area area ON area.f_id = leg.f_warehouse_locationid
             LEFT JOIN sys_dict_data dict1 ON dict1.dict_value = leg.f_trademodeid
@@ -781,19 +802,21 @@
             dict.status = '0'
             AND dict1.status = '0'
             AND leg.f_qtyD != 0
+            <if test="isMblno != null and isMblno == 0 ">
+                AND leg.f_qtyblc != 0
+                AND leg.f_grossweightblc != 0
+                AND leg.f_netweightblc != 0
+            </if>
             AND dict.dict_type = 'storage_type'
             AND dict1.dict_type = 'data_trademodes'
             <if test="fOriginalbillno != null  and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
             <if test="fTel != null  and fTel != ''">and tc.f_tel = #{fTel}</if>
             <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
             <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fMblno != null ">and leg.f_mblno LIKE  concat('%', #{fMblno}, '%') </if>
-            <if test='orgStorageDate != null and orgStorageDate[0] != null and orgStorageDate[0]!= ""'>
-                and leg.f_originalbilldate &gt;= #{orgStorageDate[0]}
-            </if>
-            <if test='orgStorageDate != null and orgStorageDate[1] != null and orgStorageDate[1]!= ""'>
-                and leg.f_originalbilldate &lt;= #{orgStorageDate[1]}
-            </if>
+            <if test='orgStorageDate != null and orgStorageDate[0] != null and orgStorageDate[0]!= ""'>and leg.f_originalbilldate &gt;= #{orgStorageDate[0]}</if>
+            <if test='orgStorageDate != null and orgStorageDate[1] != null and orgStorageDate[1]!= ""'>and leg.f_originalbilldate &lt;= #{orgStorageDate[1]}</if>
             <if test="fPregrossweight != null ">and leg.f_pregrossweight = #{fPregrossweight}</if>
             <if test="fPrenetweight != null ">and leg.f_prenetweight = #{fPrenetweight}</if>
             <if test="fQtyd != null ">and leg.f_qtyD = #{fQtyd}</if>
@@ -813,25 +836,17 @@
             <if test="fNetweightblc != null ">and leg.f_netweightblc = #{fNetweightblc}</if>
             <if test="fStatus != null  and fStatus != ''">and leg.f_status = #{fStatus}</if>
             <if test="fWarehouseid != null ">and leg.f_warehouseid = #{fWarehouseid} </if>
-            <if test="fLocation != null and fLocation ==1 ">
-                and leg.f_warehouse_locationid = #{fWarehouseLocationid}
-            </if>
-            <if test="fCntrno != null  and fCntrno != ''">
-                and leg.f_cntrno  LIKE  concat('%', #{fCntrno}, '%')
+            <if test="fLocation != null and fLocation ==1 ">and leg.f_warehouse_locationid = #{fWarehouseLocationid}</if>
+            <if test="fCntrno != null  and fCntrno != ''">and leg.f_cntrno  LIKE  concat('%', #{fCntrno}, '%')</if>
+            <if test="fLocalcntrno != null  and fLocalcntrno != ''">and leg.f_localcntrno  LIKE  concat('%', #{fLocalcntrno}, '%')</if>
+            <if test="fLocation != null  and fLocation ==0 ">and ware.ancestors  LIKE  concat('%', #{fWarehouseLocationid}, '%')</if>
+            <if test="isCntrno == null">
+                GROUP BY leg.f_corpid, leg.f_originalbillno, leg.f_originalbilldate, leg.f_warehouse_locationid, leg.f_goodsid, leg.f_trademodeid
             </if>
-            <if test="fLocalcntrno != null  and fLocalcntrno != ''">
-                and leg.f_localcntrno  LIKE  concat('%', #{fLocalcntrno}, '%')
-            </if>
-            <if test="fLocation != null  and fLocation ==0 ">
-                and ware.ancestors  LIKE  concat('%', #{fWarehouseLocationid}, '%')
-            </if>
-            GROUP BY leg.f_corpid,leg.f_originalbillno, leg.f_originalbilldate, leg.f_warehouse_locationid, leg.f_goodsid, leg.f_trademodeid
-            <if test="isCntrno != null and isCntrno == 0 ">
-                ,leg.f_cntrno
-            </if>
-            <if test="isMblno != null and isMblno == 0 ">
-                ,leg.f_mblno
+            <if test="isCntrno != null and isCntrno == 1 ">
+                GROUP BY leg.f_corpid, leg.f_originalbillno, leg.f_originalbilldate, leg.f_warehouse_locationid, leg.f_goodsid, leg.f_trademodeid,leg.f_cntrno
             </if>
+            <if test="isCntrno != null and isCntrno == 2 ">GROUP BY leg.f_corpid, leg.f_mblno, leg.f_goodsid, leg.f_warehouseid</if>
         </where>
         ${params.dataScope}
         order by leg.f_bsdate desc
@@ -843,6 +858,7 @@
         leg.f_id AS fId,
         leg.f_corpid AS fCorpIds,
         corp.f_name AS fCorpid,
+        leg.f_shipper AS fShipper,
         ware.f_warehouse_information AS fWarehouseids,
         area.f_name AS fWarehouseLocationids,
         leg.f_originalbillno AS fOriginalbillno,
@@ -896,6 +912,7 @@
             <if test="fTel != null  and fTel != ''">and tc.f_tel = #{fTel}</if>
             <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
             <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fMblno != null ">and leg.f_mblno LIKE  concat('%', #{fMblno}, '%') </if>
             <if test='orgStorageDate != null and orgStorageDate[0] != null and orgStorageDate[0]!= ""'>
                 and leg.f_originalbilldate &gt;= #{orgStorageDate[0]}
@@ -952,6 +969,7 @@
         leg.f_id AS fId,
         leg.f_corpid AS fCorpIds,
         corp.f_name AS fCorpid,
+        leg.f_shipper AS fShipper,
         ware.f_warehouse_information AS fWarehouseids,
         area.f_name AS fWarehouseLocationids,
         leg.f_originalbillno AS fOriginalbillno,
@@ -1003,6 +1021,7 @@
             <if test="fOriginalbillno != null  and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
             <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
             <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test='orgStorageDate != null and orgStorageDate[0] != null and orgStorageDate[0]!= ""'>
                 and leg.f_originalbilldate &gt;= #{orgStorageDate[0]}
             </if>
@@ -1045,6 +1064,7 @@
             DISTINCT
             leg.f_id AS fId,
             corp.f_name AS fCorpid,
+            leg.f_shipper AS fShipper,
             DATE_FORMAT( leg.f_originalbilldate, '%Y-%m-%d' ) AS fOriginalbilldate,
             ware.f_warehouse_information AS fWarehouseids,
             leg.f_mblno AS fMblno,
@@ -1067,6 +1087,7 @@
             <if test="fOriginalbillno != null  and fOriginalbillno != ''">and leg.f_originalbillno = #{fOriginalbillno}</if>
             <if test="fPreqty != null ">and leg.f_preqty = #{fPreqty}</if>
             <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fMblno != null ">and leg.f_mblno LIKE  concat('%', #{fMblno}, '%') </if>
             <if test='timeStartBsdate != null'>
                 and leg.f_originalbilldate &gt;= #{timeStartBsdate}
@@ -1181,6 +1202,7 @@
                 and f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
             </if>
             <if test="warehouseId != null"> and f_warehouseid = #{warehouseId}</if>
+            <if test="customerId != null"> and f_corpid = #{customerId}</if>
         </where>
     </select>
 
@@ -1194,6 +1216,7 @@
                 and f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
             </if>
             <if test="warehouseId != null"> and f_warehouseid = #{warehouseId}</if>
+            <if test="customerId != null"> and f_corpid = #{customerId}</if>
     </select>
 
     <select id="stockAfterMonthList" resultType="map">
@@ -1218,41 +1241,19 @@
 
     <select id="biCustomerInfo" resultType="map">
         select
-            tc.f_cname as customerName,
-            round(sum(tw.f_grossweightblc) / 1000, 2) as quantity
+            ifnull(ifnull(tw.f_shipper, tc.f_cname), tc.f_name) as customerName,
+            round(ifnull(sum(tw.f_grossweightblc), 0) / 1000) as quantity
         from t_whgenleg tw left join t_corps tc on tw.f_corpid = tc.f_id
         where
             tw.f_qtyD != 0
             and tw.f_qtyblc != 0
-            <if test="warehouseId != null"> and f_warehouseid = #{warehouseId}</if>
-        group by tc.f_name
-        order by quantity desc limit 10
-    </select>
-
-    <select id="biGoodsInfo" parameterType="long" resultType="map">
-        select
-            tg.f_name as goodsName,
-            round(sum(tw.f_grossweightblc) / 1000, 2) as quantity
-        from t_whgenleg tw left join t_goods tg on tw.f_goodsid = tg.f_id
-        where
-            tw.f_qtyD != 0
-            and tw.f_qtyblc != 0
             <if test="warehouseId != null"> and tw.f_warehouseid = #{warehouseId}</if>
-        group by tg.f_name
+            <if test="external != null and external != ''">
+                and tw.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
+            </if>
+            <if test="customerId != null"> and tw.f_corpid = #{customerId}</if>
+        group by customerName
         order by quantity desc limit 10
     </select>
 
-    <select id="biWeightInfo" resultType="map">
-        select
-            round(sum(f_grossweightD) / 1000, 2) as quantityIn,
-            round(sum(f_grossweightblc) / 1000, 2) as quantity
-        from t_whgenleg
-        where
-            f_qtyD != 0
-            and f_qtyblc != 0
-            <if test="warehouseId != null and warehouseId != ''">and f_warehouseid = #{warehouseId}</if>
-            <if test="beginDate != null and beginDate != ''">and f_bsdate &gt;= #{beginDate}</if>
-            <if test="endDate != null and endDate != ''">and f_bsdate &lt;= #{endDate}</if>
-    </select>
-
 </mapper>

+ 11 - 6
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehouseAgreementMapper.xml

@@ -265,10 +265,7 @@
         left join t_corps corp on corp.f_id = agre.f_corpid
         where
             agre.f_status = '0'
-            and datediff(date_format(agre.f_enddate, '%Y-%m-%d'), date_format(now(), '%Y-%m-%d')) &lt;= 60
-            <if test="value != null  and value != ''">
-                and datediff(date_format(agre.f_enddate, '%Y-%m-%d'), date_format(now(), '%Y-%m-%d')) &lt;= #{value}
-            </if>
+            and datediff(date_format(agre.f_enddate, '%Y-%m-%d'), date_format(now(), '%Y-%m-%d')) &lt;= #{remindDays}
             <if test="fCorpid != null ">and agre.f_corpid = #{fCorpid}</if>
             <if test="fContractno != null  and fContractno != ''">and agre.f_contractno = #{fContractno}</if>
             <if test="fBegindate != null ">and agre.f_begindate = #{fBegindate}</if>
@@ -281,15 +278,23 @@
         where f_feetypeid = 0
             <if test="beginDate != null and beginDate != ''">and f_enddate &gt;= #{beginDate}</if>
             <if test="endDate != null and endDate != ''">and f_enddate &lt; #{endDate}</if>
+            <if test="external != null and external != ''">
+                and f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
+            </if>
+            <if test="customerId != null">and f_corpid = #{customerId}</if>
     </select>
 
     <select id="biContractList" resultType="map">
         select
             ifnull(tc.f_cname, tc.f_name) as customerName,
-            ta.f_begindate AS beginDate,
-            ta.f_enddate AS endDate
+            ta.f_begindate as beginDate,
+            ta.f_enddate as endDate
         from t_warehouse_agreement ta left join t_corps tc on tc.f_id = ta.f_corpid
         where ta.f_feetypeid = 0
+            <if test="external != null and external != ''">
+                and ta.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
+            </if>
+            <if test="customerId != null">and ta.f_corpid = #{customerId}</if>
         order by ta.create_time desc
     </select>
 

+ 115 - 32
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -14,6 +14,7 @@
         <result property="fContacts"    column="f_contacts"    />
         <result property="fTel"    column="f_tel"    />
         <result property="fCorpid"    column="f_corpid"    />
+        <result property="fShipper"    column="f_shipper"    />
         <result property="fTocorpid"    column="f_tocorpid"    />
         <result property="fStltypeid"    column="f_stltypeid"    />
         <result property="fBscorpno"    column="f_bscorpno"    />
@@ -34,6 +35,8 @@
         <result property="fSbu"    column="f_sbu"    />
         <result property="fFeetunit"    column="f_feetunit"    />
         <result property="fMblno"    column="f_mblno"    />
+        <result property="fEmblno"    column="f_emblno"    />
+        <result property="fCompany"    column="f_company"    />
         <result property="fVslvoy"    column="f_vslvoy"    />
         <result property="fEta"    column="f_eta"    />
         <result property="fMarks"    column="f_marks"    />
@@ -134,9 +137,9 @@
     </resultMap>
 
     <sql id="selectTWarehousebillsVo">
-        select f_id, f_billno, f_customsdeclartion, f_originalbillno, f_deptid, f_bsdeptid, f_contacts, f_tel, f_corpid, f_tocorpid, f_stltypeid, f_bscorpno,
+        select f_id, f_billno, f_customsdeclartion, f_originalbillno, f_deptid, f_bsdeptid, f_contacts, f_tel, f_corpid, f_shipper, f_tocorpid, f_stltypeid, f_bscorpno,
         f_warehouseid, f_storekeeper, f_chargedate, f_bsdate, f_planqty, f_plangrossweight, f_plannetweight, f_planvolumn, f_qty, f_grossweight, f_netweight,
-        f_volumn, f_billingway, f_trademodeid, f_sbu, f_feetunit, f_mblno, f_marks, f_vslvoy, f_eta, f_customno, f_ifweigh, f_ifpledge, f_ifdamage, f_bankcorpid,
+        f_volumn, f_billingway, f_trademodeid, f_sbu, f_feetunit, f_mblno, f_emblno, f_company, f_marks, f_vslvoy, f_eta, f_customno, f_ifweigh, f_ifpledge, f_ifdamage, f_bankcorpid,
         f_billtype, f_billstatus, f_items_status, del_flag, create_by, create_time, update_by, update_time, remark, f_billing_deadline, f_product_name, f_review_date,
         f_truckno, f_driver_name, f_driver_tel, f_driver_id_car, f_business_type, f_labour, f_fleet, f_inwarehouseid, f_bstime, f_cartype, f_goodsid, f_new_trademodeid,
         f_loadportid, f_destportid, f_serviceitems, f_invoceobj, f_sign, f_detentioncargo, f_booksmarks, f_shippername, f_shipperattn, f_shippertel, f_consigneername,
@@ -167,6 +170,7 @@
             <if test="fContacts != null  and fContacts != ''">and f_contacts = #{fContacts}</if>
             <if test="fTel != null  and fTel != ''">and f_tel = #{fTel}</if>
             <if test="fCorpid != null ">and f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fTocorpid != null ">and f_tocorpid = #{fTocorpid}</if>
             <if test="fChargedate != null ">and f_chargedate = #{fChargedate}</if>
             <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
@@ -197,6 +201,7 @@
             <if test="fSbu != null ">and f_sbu = #{fSbu}</if>
             <if test="fFeetunit != null  and fFeetunit != ''">and f_feetunit = #{fFeetunit}</if>
             <if test="fMblno != null  and fMblno != ''">and f_mblno = #{fMblno}</if>
+            <if test="fEmblno != null  and fEmblno != ''">and f_emblno = #{fEmblno}</if>
             <if test="fVslvoy != null  and fVslvoy != ''">and f_vslvoy = #{fVslvoy}</if>
             <if test="fEta != null ">and f_eta = #{fEta}</if>
             <if test="fCustomno != null  and fCustomno != ''">and f_customno = #{fCustomno}</if>
@@ -218,7 +223,10 @@
             bill.f_id AS fId,
             corp.f_name AS fCorpid,
             corpTo.f_name AS fTocorpid,
+            bill.f_shipper AS fShipper,
             bill.f_mblno AS fMblno,
+            bill.f_emblno AS fEmblno,
+            bill.f_company AS fCompany,
             corpSub.f_name AS fSbu,
             bill.f_marks AS fMarks,
             bill.remark AS remark,
@@ -358,6 +366,7 @@
             <if test="fContacts != null  and fContacts != ''">and bill.f_contacts = #{fContacts}</if>
             <if test="fTel != null  and fTel != ''">and bill.f_tel = #{fTel}</if>
             <if test="fCorpid != null ">and bill.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and bill.f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fBillingDeadline != null ">and bill.f_billing_deadline = #{fBillingDeadline}</if>
             <if test="fTocorpid != null ">and bill.f_tocorpid = #{fTocorpid}</if>
             <if test="fMarks != null  and fMarks != ''">and bill.f_marks like concat('%', #{fMarks}, '%')</if>
@@ -380,6 +389,7 @@
             <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
             <if test="fFeetunit != null  and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
             <if test="fMblno != null  and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
+            <if test="fEmblno != null  and fEmblno != ''">and bill.f_emblno like concat('%', #{fEmblno}, '%')</if>
             <if test="fVslvoy != null  and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
             <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
             <if test="fCustomno != null  and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
@@ -414,7 +424,7 @@
             <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
         </where>
         ${params.dataScope}
-        ORDER BY bill.create_time DESC, bill.f_bsdate DESC, bill.f_bstime DESC,bill.f_id DESC,bill.f_billstatus
+        ORDER BY bill.f_bsdate DESC, bill.f_bstime DESC,bill.f_id DESC,bill.f_billstatus
     </select>
 
     <select id="selectWarehouseBusinessList1" parameterType="TWarehousebills" resultType="Map">
@@ -423,7 +433,10 @@
             bill.f_id AS fId,
             corp.f_name AS fCorpid,
             corpTo.f_name AS fTocorpid,
+            bill.f_shipper AS fShipper,
             bill.f_mblno AS fMblno,
+            bill.f_emblno AS fEmblno,
+            bill.f_company AS fCompany,
             corpSub.f_name AS fSbu,
             bill.f_marks AS fMarks,
             bill.remark AS remark,
@@ -536,6 +549,7 @@
             <if test="fContacts != null  and fContacts != ''">and bill.f_contacts = #{fContacts}</if>
             <if test="fTel != null  and fTel != ''">and bill.f_tel = #{fTel}</if>
             <if test="fCorpid != null ">and bill.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and bill.f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fBillingDeadline != null ">and bill.f_billing_deadline = #{fBillingDeadline}</if>
             <if test='timeInterval2 != null and timeInterval2[0] != null and timeInterval2[0]!= ""'><!-- 仓储费增加计费截止日期区间查询 -->
                 and bill.f_billing_deadline &gt;= #{timeInterval2[0]}
@@ -564,6 +578,7 @@
             <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
             <if test="fFeetunit != null  and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
             <if test="fMblno != null  and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
+            <if test="fEmblno != null  and fEmblno != ''">and bill.f_emblno like concat('%', #{fEmblno}, '%')</if>
             <if test="fVslvoy != null  and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
             <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
             <if test="fCustomno != null  and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
@@ -580,7 +595,7 @@
             <if test="fNewTrademodeid != null ">and bill.f_new_trademodeid = #{fNewTrademodeid}</if>
         </where>
         ${params.dataScope}
-        ORDER BY bill.create_time DESC, bill.f_bsdate DESC, bill.f_bstime DESC,bill.f_id DESC,bill.f_billstatus
+        ORDER BY bill.f_bsdate DESC, bill.f_bstime DESC,bill.f_id DESC,bill.f_billstatus
     </select>
 
     <select id="selectTWarehousebillsById" parameterType="Long" resultMap="TWarehousebillsResult">
@@ -638,14 +653,39 @@
         wi.f_qty AS fQtyD,
         wi.f_grossweight AS fGrossweightD
         FROM t_warehousebillsitems wi
+        LEFT JOIN t_warehousebills w ON wi.f_pid =  w.f_id
         LEFT JOIN t_goods tg ON wi.f_goodsid = tg.f_id
-        LEFT JOIN sys_dict_data dict ON wi.f_business_type = dict.dict_value
+        LEFT JOIN sys_dict_data dict ON w.f_business_type = dict.dict_value
         WHERE
-        wi.f_billtype = 'SJRK'
-        AND dict.dict_type = 'st_in_type'
-        AND dict.status = 0
-        AND wi.f_billstatus = 40
-        <if test="fId != null and fId!= ''">AND wi.f_mblno = (select f_mblno from t_warehousebills where f_id = #{fId})</if>
+            wi.f_billstatus = 40
+            AND dict.status = 0
+            <if test="billType != null and billType!= '' and billType== 'SJRK'">
+                AND wi.f_billtype = 'SJRK'
+                AND dict.dict_type = 'st_in_type'
+                <if test="fId != null and fId!= ''">
+                    AND wi.f_mblno = (select distinct f_mblno from t_warehousebills where f_id = #{fId})
+                    AND wi.f_warehouselocid in (
+                        select distinct wi.f_warehouselocid
+                        from t_warehousebillsitems wi left join t_warehousebillsfees wf on wf.src_id = wi.f_id
+                        where wf.f_pid = #{fId}
+                    )
+                </if>
+            </if>
+            <if test="billType != null and billType!= '' and billType== 'CKDB'">
+                AND wi.f_billtype = 'CKDB'
+                AND dict.dict_type = 'st_trans_type'
+                <if test="fId != null and fId!= ''">
+                    AND wi.f_mblno = (select distinct f_mblno from t_warehousebills where f_id = #{fId})
+                    AND wi.f_transfer_warehouselocid in (
+                        select distinct wi.f_warehouselocid
+                        from t_warehousebillsitems wi left join t_warehousebillsfees wf on wf.src_id = wi.f_id
+                        where wf.f_pid = #{fId}
+                    )
+                </if>
+            </if>
+            <if test="fId != null and fId!= ''">
+                AND wi.f_bsdate &gt;= (select min(f_chargedate) from t_warehousebillsfees where f_pid = #{fId})
+            </if>
     </select>
 
     <select id="selectNotInStockDetail" resultType="com.ruoyi.warehouseBusiness.excel.StorageDetail">
@@ -657,25 +697,30 @@
         wf.f_chargedate       AS inStockDate,
         wf.f_billing_deadline AS outStockDate,
         wi.f_truckno          AS fTruckno,
-        wf.f_billing_qty      AS fQtyC,
+        wi.f_qty              AS fQtyC,
         wi.f_grossweight      AS fGrossweightC,
+        dictF.dict_label      AS fBillingway,
+        wf.f_billing_qty      AS fBillingQty,
         wf.f_billing_days     AS fBillingDays,
         wf.f_amount           AS fAmount
-        FROM t_warehousebills w
-        LEFT JOIN t_warehousebillsfees wf ON w.f_id = wf.f_pid
+        FROM t_warehousebillsfees wf
         LEFT JOIN t_warehousebillsitems wi ON wi.f_id = wf.src_id
-        LEFT JOIN sys_dict_data dict ON wi.f_business_type = dict.dict_value
-        WHERE w.f_id = #{fId}
-        AND w.f_typeid IS NULL
-        AND dict.status = '0'
-        <if test="billType != null and billType!= '' and billType== 'SJCK'">
-          AND wf.f_billtype = 'SJCK'
-          AND dict.dict_type = 'st_out_type'
-        </if>
-        <if test="billType != null and billType!= '' and billType== 'HQZY'">
-            AND wf.f_billtype = 'HQZY'
-            AND dict.dict_type = 'st_goodstf_type'
-        </if>
+        LEFT JOIN t_warehousebills w ON w.f_id = wi.f_pid
+        LEFT JOIN sys_dict_data dict ON w.f_business_type = dict.dict_value
+        LEFT JOIN sys_dict_data dictF ON wf.f_billingway = dictF.dict_value
+        WHERE w.f_typeid IS NULL
+            AND dict.status = '0'
+            AND dictF.status = '0'
+            AND dictF.dict_type = 'data_unitfees'
+            <if test="fId != null and fId!= ''">AND wf.f_pid = #{fId}</if>
+            <if test="billType != null and billType!= '' and billType== 'SJCK'">
+                AND wf.f_billtype = 'SJCK'
+                AND dict.dict_type = 'st_out_type'
+            </if>
+            <if test="billType != null and billType!= '' and billType== 'HQZY'">
+                AND wf.f_billtype = 'HQZY'
+                AND dict.dict_type = 'st_goodstf_type'
+            </if>
     </select>
 
     <select id="selectInventoryDetail" resultType="com.ruoyi.warehouseBusiness.excel.StorageDetail">
@@ -685,19 +730,25 @@
         wi.f_packagespecs     AS fPackagespecs,
         '在库'                 AS fBusinessType,
         wf.f_bsdate           AS inStockDate,
-        wf.f_amount           AS fAmount,
-        wf.f_billing_qty      AS surplus
-        FROM t_warehousebills w
-        LEFT JOIN t_warehousebillsfees wf ON w.f_id = wf.f_pid
+        dictF.dict_label      AS fBillingway,
+        wf.f_billing_qty      AS fBillingQty,
+        wf.f_billing_days     AS fBillingDays,
+        wf.f_amount           AS fAmount
+        FROM t_warehousebillsfees wf
         LEFT JOIN t_warehousebillsitems wi ON wi.f_id = wf.src_id
-        WHERE w.f_id = #{fId}
-        AND w.f_typeid IS NULL
-        AND wf.f_billtype = 'KCZZ'
+        LEFT JOIN t_warehousebills w ON w.f_id = wi.f_pid
+        LEFT JOIN sys_dict_data dictF ON wf.f_billingway = dictF.dict_value
+        WHERE w.f_typeid IS NULL
+            AND dictF.status = '0'
+            AND dictF.dict_type = 'data_unitfees'
+            AND wf.f_billtype = 'KCZZ'
+            <if test="fId != null and fId!= ''">AND wf.f_pid = #{fId}</if>
     </select>
 
     <select id="selectInventorySJRKList" parameterType="TWarehousebills" resultType="java.util.Map">
         SELECT
         co.f_name AS fName,
+        leg.f_shipper AS fShipper,
         it.f_bsdate AS fBsdate,
         leg.f_mblno AS fMblno,
         it.f_business_type AS fBusinessType,
@@ -740,7 +791,9 @@
             <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
             <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
             <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fMblno != null ">and it.f_mblno like concat('%',#{fMblno},'%')</if>
+            <if test="fEmblno != null ">and it.f_emblno like concat('%',#{fEmblno},'%')</if>
             <if test="fLocation != null  and fLocation ==1 ">
                 and it.f_warehouselocid = #{fWarehouseid}
             </if>
@@ -760,6 +813,7 @@
     <select id="selectInventorySJCKList" parameterType="TWarehousebills"  resultType="java.util.Map">
         SELECT
             co.f_name AS fName,
+            leg.f_shipper AS fShipper,
             it.f_bsdate AS fBsdate,
             leg.f_mblno AS fMblno,
             it.f_business_type AS fBusinessType,
@@ -810,7 +864,9 @@
             <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
             <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
             <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fMblno != null ">and it.f_mblno like concat('%',#{fMblno},'%')</if>
+            <if test="fEmblno != null ">and it.f_emblno like concat('%',#{fEmblno},'%')</if>
             <if test="fLocation != null  and fLocation ==1 ">
                 and it.f_warehouselocid = #{fWarehouseid}
             </if>
@@ -832,6 +888,7 @@
         SELECT
         ( @ii := @ii + 1 ) AS fId,
         co.f_name AS fCorpid,
+        leg.f_shipper AS fShipper,
         it.f_bsdate AS fBsdate,
         leg.f_mblno AS fMblno,
         dict.dict_label AS fBusinessType,
@@ -868,7 +925,9 @@
         <if test="fTrademodeid != null ">and leg.f_trademodeid = #{fTrademodeid}</if>
         <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
         <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
+        <if test="fShipper != null and fShipper != ''">and leg.f_shipper like concat('%', #{fShipper}, '%')</if>
         <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
+        <if test="fEmblno != null ">and leg.f_emblno = #{fEmblno}</if>
         <if test="fLocation != null  and fLocation ==1 ">
             and it.f_warehouselocid = #{fWarehouseid}
         </if>
@@ -905,6 +964,7 @@
             <if test="fContacts != null">f_contacts,</if>
             <if test="fTel != null">f_tel,</if>
             <if test="fCorpid != null">f_corpid,</if>
+            <if test="fShipper != null">f_shipper,</if>
             <if test="fTocorpid != null">f_tocorpid,</if>
             <if test="fStltypeid != null">f_stltypeid,</if>
             <if test="fBscorpno != null">f_bscorpno,</if>
@@ -925,6 +985,8 @@
             <if test="fSbu != null">f_sbu,</if>
             <if test="fFeetunit != null">f_feetunit,</if>
             <if test="fMblno != null">f_mblno,</if>
+            <if test="fEmblno != null">f_emblno,</if>
+            <if test="fCompany != null">f_company,</if>
             <if test="fVslvoy != null">f_vslvoy,</if>
             <if test="fEta != null">f_eta,</if>
             <if test="fMarks != null">f_marks,</if>
@@ -1021,6 +1083,7 @@
             <if test="fContacts != null">#{fContacts},</if>
             <if test="fTel != null">#{fTel},</if>
             <if test="fCorpid != null">#{fCorpid},</if>
+            <if test="fShipper != null">#{fShipper},</if>
             <if test="fTocorpid != null">#{fTocorpid},</if>
             <if test="fStltypeid != null">#{fStltypeid},</if>
             <if test="fBscorpno != null">#{fBscorpno},</if>
@@ -1041,6 +1104,8 @@
             <if test="fSbu != null">#{fSbu},</if>
             <if test="fFeetunit != null">#{fFeetunit},</if>
             <if test="fMblno != null">#{fMblno},</if>
+            <if test="fEmblno != null">#{fEmblno},</if>
+            <if test="fCompany != null">#{fCompany},</if>
             <if test="fVslvoy != null">#{fVslvoy},</if>
             <if test="fEta != null">#{fEta},</if>
             <if test="fMarks != null">#{fMarks},</if>
@@ -1141,6 +1206,7 @@
             <if test="fContacts != null">f_contacts = #{fContacts},</if>
             <if test="fTel != null">f_tel = #{fTel},</if>
             <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
+            <if test="fShipper != null">f_shipper = #{fShipper},</if>
             <if test="fTocorpid != null">f_tocorpid = #{fTocorpid},</if>
             <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
             <if test="fBscorpno != null">f_bscorpno = #{fBscorpno},</if>
@@ -1161,6 +1227,8 @@
             <if test="fSbu != null">f_sbu = #{fSbu},</if>
             <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
             <if test="fMblno != null">f_mblno = #{fMblno},</if>
+            <if test="fEmblno != null">f_emblno = #{fEmblno},</if>
+            <if test="fCompany != null">f_company = #{fCompany},</if>
             <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
             <if test="fEta != null">f_eta = #{fEta},</if>
             <if test="fMarks != null">f_marks = #{fMarks},</if>
@@ -1262,6 +1330,7 @@
             <if test="fContacts != null">f_contacts = #{fContacts},</if>
             <if test="fTel != null">f_tel = #{fTel},</if>
             <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
+            <if test="fShipper != null">f_shipper = #{fShipper},</if>
             <if test="fTocorpid != null">f_tocorpid = #{fTocorpid},</if>
             <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
             <if test="fBscorpno != null and fBscorpno != ''">f_bscorpno = #{fBscorpno},</if>
@@ -1282,6 +1351,8 @@
             <if test="fSbu != null">f_sbu = #{fSbu},</if>
             <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
             <if test="fMblno != null">f_mblno = #{fMblno},</if>
+            <if test="fEmblno != null">f_emblno = #{fEmblno},</if>
+            <if test="fCompany != null">f_company = #{fCompany},</if>
             <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
             <if test="fMarks != null and fMarks != ''">f_marks = #{fMarks},</if>
             <if test="fEta != null">f_eta = #{fEta},</if>
@@ -1436,6 +1507,7 @@
             t.f_id AS fId,
             item.f_id AS fItemsId,
             C.f_name AS fcorpid,
+            t.f_shipper AS fShipper,
             t.f_mblno AS fMblno,
             g.f_name AS fGoodsid,
             dict.dict_label AS fBusinessType,
@@ -1549,6 +1621,7 @@
             tw.f_contacts,
             tw.f_tel,
             tw.f_corpid,
+            tw.f_shipper,
             tc.f_name corpName,
             tw.f_tocorpid,
             tw.f_stltypeid,
@@ -1673,6 +1746,7 @@
             <if test="fContacts != null  and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
             <if test="fTel != null  and fTel != ''">and tw.f_tel = #{fTel}</if>
             <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
             <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
             <if test="fBscorpno != null  and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
@@ -1772,6 +1846,7 @@
         tw.f_id fId,
         tw.f_billno fBillno,
         tw.f_originalbillno fOriginalbillno,
+        tw.f_shipper fShipper,
         tw.f_mblno fMblno,
         sd.dict_label fServiceitems,
         tw.f_consigneername fConsigneername,
@@ -1921,6 +1996,7 @@
             <if test="fContacts != null  and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
             <if test="fTel != null  and fTel != ''">and tw.f_tel = #{fTel}</if>
             <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
             <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
             <if test="fBscorpno != null  and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
@@ -2055,6 +2131,7 @@
         tw.f_id fId,
         tw.f_billno fBillno,
         tw.f_originalbillno fOriginalbillno,
+        tw.f_shipper fShipper,
         tw.f_mblno fMblno,
         sd.dict_label fServiceitems,
         tw.f_consigneername fConsigneername,
@@ -2193,6 +2270,7 @@
             <if test="fContacts != null  and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
             <if test="fTel != null  and fTel != ''">and tw.f_tel = #{fTel}</if>
             <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
+            <if test="fShipper != null and fShipper != ''">and tw.f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
             <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
             <if test="fBscorpno != null  and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
@@ -2324,6 +2402,7 @@
                tw.f_bsdeptid,
                tw.f_contacts,
                tw.f_tel,
+               tw.f_shipper,
                tw.f_corpid,
                tc.f_name      corpName,
                tw.f_tocorpid,
@@ -2458,6 +2537,7 @@
             w.f_id fId,
             w.f_corpid fCorpid,
             c.f_name corpName,
+            w.f_shipper fShipper,
             w.f_bsdate fBsdate,
             g.f_name goodsName,
             w.f_mblno fMblno,
@@ -2540,6 +2620,7 @@
         <if test="fItemsStatus == null and timeInterval == null and fMblno == null">
             and IF( w.f_planqty IS NOT NULL, w.f_planqty != w.f_qty, w.f_id != '')
         </if>
+        <if test="fShipper != null and fShipper != ''">and w.f_shipper like concat('%', #{fShipper}, '%')</if>
         <if test="fMblno != null ">and w.f_mblno like concat('%', #{fMblno}, '%')</if>
         <if test="fItemsStatus != null ">and w.f_items_status = #{fItemsStatus}</if>
         <if test="fBillstatus != null ">and w.f_billstatus = #{fBillstatus}</if>
@@ -2560,11 +2641,13 @@
         SELECT
             t.f_id fId,
             t.f_pid fPid,
+            w.f_shipper fShipper,
             c.f_name corpName,
             t.f_bsdate fBsdate,
             g.f_name goodsName,
             t.f_mblno fMblno,
             t.f_warehouse_information fWarehouseInformation,
+            t.f_forkliftman fForkliftman,
             t.f_truckno fTruckno,
             t.f_cntrno fCntrno,
             cntr.f_name cntrtypes,

+ 39 - 4
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsitemsMapper.xml

@@ -10,6 +10,7 @@
         <result property="fSrcid" column="f_srcid"/>
         <result property="fLineno" column="f_lineno"/>
         <result property="fBillno" column="f_billno"/>
+        <result property="fShipper" column="f_shipper"/>
         <result property="fGoodsid" column="f_goodsid"/>
         <result property="fSrcBsdate" column="f_src_bsdate"/>
         <result property="fMblno" column="f_mblno"/>
@@ -106,7 +107,7 @@
     </resultMap>
 
     <sql id="selectTWarehousebillsitemsVo">
-        select f_id, f_pid, f_srcid, f_lineno, f_billno, f_goodsid, f_mblno, f_src_bsdate, f_originalbillno, f_transfer_warehouselocid, f_warehouselocid,
+        select f_id, f_pid, f_srcid, f_lineno, f_billno, f_shipper, f_goodsid, f_mblno, f_src_bsdate, f_originalbillno, f_transfer_warehouselocid, f_warehouselocid,
          f_originalbilldate, f_bsdate, f_billingway, f_chargedate, f_boxno, f_goodsval, f_cntqty, f_packagespecs, f_cntrtype, f_planvolumn,
           f_planqty, f_plangrossweight, f_plannetweight, f_volumn, f_qty, f_grossweight, f_netweight, f_cntrno, f_truckno, f_marks, f_actual_weight, f_billstatus,
            del_flag, create_by, create_time, update_by, update_time, remark, f_inventory_days, f_storage_fee_deadline, f_amt, f_billing_days,
@@ -124,6 +125,7 @@
             <if test="fGoodsid != null ">and f_goodsid = #{fGoodsid}</if>
             <if test="fMblno != null  and fMblno != ''">and f_mblno = #{fMblno}</if>
             <if test="fBillno != null  and fBillno != ''">and f_billno = #{fBillno}</if>
+            <if test="fShipper != null and fShipper != ''">and f_shipper like concat('%', #{fShipper}, '%')</if>
             <if test="fSrcBsdate != null ">and f_src_bsdate = #{fSrcBsdate}</if>
             <if test="fWarehouselocid != null ">and f_warehouselocid = #{fWarehouselocid}</if>
             <if test="fBsdate != null ">and f_bsdate = #{fBsdate}</if>
@@ -178,6 +180,7 @@
             item.f_srcid AS fSrcid,
             item.f_lineno AS fLineno,
             item.f_billno AS fBillno,
+            item.f_shipper AS fShipper,
             item.f_goodsid AS fGoodsid,
             goods.f_name AS fGoodsids,
             goods.if_cntrno AS ifCntrno,
@@ -262,6 +265,7 @@
             <if test="fSrcid != null">f_srcid,</if>
             <if test="fLineno != null">f_lineno,</if>
             <if test="fBillno != null">f_billno,</if>
+            <if test="fShipper != null">f_shipper,</if>
             <if test="fGoodsid != null">f_goodsid,</if>
             <if test="fMblno != null">f_mblno,</if>
             <if test="fSrcBsdate != null">f_src_bsdate,</if>
@@ -331,6 +335,7 @@
             <if test="fSrcid != null">#{fSrcid},</if>
             <if test="fLineno != null">#{fLineno},</if>
             <if test="fBillno != null">#{fBillno},</if>
+            <if test="fShipper != null">#{fShipper},</if>
             <if test="fGoodsid != null">#{fGoodsid},</if>
             <if test="fMblno != null">#{fMblno},</if>
             <if test="fSrcBsdate != null">#{fSrcBsdate},</if>
@@ -403,6 +408,7 @@
             <if test="fSrcid != null">f_srcid = #{fSrcid},</if>
             <if test="fLineno != null">f_lineno = #{fLineno},</if>
             <if test="fBillno != null">f_billno = #{fBillno},</if>
+            <if test="fShipper != null">f_shipper = #{fShipper},</if>
             <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
             <if test="fMblno != null">f_mblno = #{fMblno},</if>
             <if test="fSrcBsdate != null">f_src_bsdate = #{fSrcBsdate},</if>
@@ -499,6 +505,7 @@
             ware.f_warehouseid AS warehouse,
             item.f_id AS fId,
             item.f_billno AS fBillno,
+            item.f_shipper AS fShipper,
             item.f_goodsid AS fGoodsid,
             item.f_bsdate AS fBsdate,
             item.f_billingway AS fBillingway,
@@ -534,6 +541,7 @@
             <if test="warehouse.fGoodsid != null and warehouse.fGoodsid != ''">and item.f_goodsid = #{warehouse.fGoodsid}</if>
             <if test="warehouse.fWarehouseid != null and warehouse.fWarehouseid != ''">and ware.f_warehouseid = #{warehouse.fWarehouseid}</if>
             <if test="warehouse.fMblno != null and warehouse.fMblno != ''">and item.f_mblno like concat('%',#{warehouse.fMblno},'%')</if>
+            <if test="warehouse.fShipper != null and warehouse.fShipper != ''">and item.f_shipper like concat('%',#{warehouse.fShipper},'%')</if>
         </where>
     </select>
 
@@ -542,6 +550,7 @@
             ware.f_warehouseid,
             item.f_id,
             item.f_billno,
+            item.f_shipper,
             item.f_goodsid,
             item.f_bsdate,
             item.f_billingway,
@@ -576,6 +585,7 @@
             <if test="warehouse.fGoodsid != null and warehouse.fGoodsid != ''">and item.f_goodsid = #{warehouse.fGoodsid}</if>
             <if test="warehouse.fWarehouseid != null and warehouse.fWarehouseid != ''">and ware.f_warehouseid = #{warehouse.fWarehouseid}</if>
             <if test="warehouse.fMblno != null and warehouse.fMblno != ''">and item.f_mblno like concat('%',#{warehouse.fMblno},'%')</if>
+            <if test="warehouse.fShipper != null and warehouse.fShipper != ''">and item.f_shipper like concat('%',#{warehouse.fShipper},'%')</if>
         </where>
     </select>
 
@@ -716,6 +726,7 @@
         SELECT
             t.f_id fId,
             t.f_pid fPid,
+            t.f_shipper fShipper,
             t.f_bsdate bsdate,
             corp.f_name corpName,
             t.f_mblno fMblno,
@@ -726,6 +737,7 @@
             fleet.f_name fleetName,
             t.f_warehouse_information warehouseInformation,
             t.f_warehouselocid fWarehouselocid,
+            t.f_forkliftman fForkliftman,
             t.f_truckno truckno,
             cntr.f_name cntrtypes,
             t.f_cntrtype cntrtype,
@@ -924,7 +936,7 @@
     </select>
 
     <select id="selectListByCorpId" resultMap="TWarehousebillsitemsResult">
-        select t.f_tocorpid, item.f_id, item.f_goodsid, item.f_mblno, item.f_originalbillno, item.f_transfer_warehouselocid,
+        select t.f_tocorpid, item.f_id, item.f_shipper, item.f_goodsid, item.f_mblno, item.f_originalbillno, item.f_transfer_warehouselocid,
             item.f_warehouselocid, item.f_originalbilldate, item.f_bsdate, item.f_billingway, item.f_chargedate, item.f_boxno, item.f_goodsval,
             item.f_cntqty, item.f_volumn, item.f_qty, item.f_grossweight, item.f_netweight, item.f_cntrno, item.f_marks, item.f_billtype
         from t_warehousebills t LEFT JOIN t_warehousebillsitems item ON item.f_pid = t.f_id
@@ -953,7 +965,20 @@
     </update>
 
     <select id="inAndOutStockStatistics" resultType="map">
-        select round(ifnull(sum(ts.f_grossweight) / 1000, 0)) as total
+        select
+            <if test="mode == null or mode == ''">round(ifnull(sum(ts.f_grossweight) / 1000, 0)) as total</if>
+            <if test="mode != null and mode != ''">
+                case #{mode}
+                    when '3' then round(ifnull(sum(ts.f_volumn), 0))
+                    when '2' then round(ifnull(sum(
+                        case tb.f_billingway
+                            when 3 then ts.f_netweight
+                            else ts.f_grossweight
+                        end
+                    ) / 1000, 0))
+                    else ifnull(sum(ts.f_qty), 0)
+                end as total
+            </if>
         from t_warehousebillsitems ts
         left join t_warehousebills tb on ts.f_mblno = tb.f_mblno and ts.f_billno = tb.f_billno
         where
@@ -965,14 +990,20 @@
                 and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
             </if>
             <if test="warehouseId != null"> and tb.f_warehouseid = #{warehouseId}</if>
+            <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
     </select>
 
     <select id="biInAndOutStockList" resultType="map">
         select
             ifnull(tc.f_cname, tc.f_name) as customerName,
+            ifnull(ifnull(ts.f_shipper, tc.f_cname), tc.f_name) as shipper,
             ts.f_warehouse_information as warehouseName,
             tg.f_name as goodsName,
-            round(ts.f_grossweight / 1000, 2) as quantity,
+            concat(ts.f_qty, '/',
+                case tb.f_billingway
+                    when 3 then round(ts.f_netweight / 1000)
+                    else round(ts.f_grossweight / 1000)
+                end, '/', round(ifnull(ts.f_volumn, 0))) as quantity,
             date_format(ts.f_bsdate, '%Y-%m-%d') as businessTime
         from t_warehousebillsitems ts
         left join t_warehousebills tb on ts.f_pid = tb.f_id
@@ -981,7 +1012,11 @@
         where
             ts.f_billstatus = '40'
             <if test="billType != null and billType != ''">and ts.f_billtype = #{billType}</if>
+            <if test="external != null and external != ''">
+                and tb.f_corpid = (select f_pid from t_customer_contact where f_tel = #{external})
+            </if>
             <if test="warehouseId != null"> and tb.f_warehouseid = #{warehouseId}</if>
+            <if test="customerId != null">and tb.f_corpid = #{customerId}</if>
         order by ts.f_bsdate desc
     </select>