浏览代码

添加单票分析导出excel需求

阿伏兔 4 年之前
父节点
当前提交
2434059248

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

@@ -20,7 +20,7 @@ import java.util.Map;
 
 /**
  * 出入库汇总Controller
- *
+ * 总账统计
  * @author ruoyi
  * @date 2020-12-23
  */
@@ -50,7 +50,7 @@ public class TWarehousebillsitemsSummaryController extends BaseController {
     public AjaxResult export(TWarehouseBills tWarehouseBills) {
         List<TWareHouseItemsExcel> list = itWarehouseBillsService.selectTWarehousebillsItemsList(tWarehouseBills);
         ExcelUtil<TWareHouseItemsExcel> util = new ExcelUtil<TWareHouseItemsExcel>(TWareHouseItemsExcel.class);
-        return util.exportExcel(list, "出入库统计");
+        return util.statisticsExportExcel(list, "总账统计");
     }
 
 

+ 62 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWhgenlegController.java

@@ -8,6 +8,8 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.reportManagement.domain.SingleAnalysisExcel;
+import com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Whgenleg;
@@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -70,6 +73,65 @@ public class TWhgenlegController extends BaseController {
     }
 
     /**
+     * 获取单票分析信息
+     */
+    @GetMapping(value = "/singleAnalysis")
+    public AjaxResult singleAnalysis(SingleAnalysisExcel singleAnalysisExcel) {
+        if (StringUtils.isNull(singleAnalysisExcel.getfCorpid()) || StringUtils.isEmpty(singleAnalysisExcel.getfMblno())) {
+            return AjaxResult.error("未找到查询条件");
+        }
+        List<SingleAnalysisFeesExcel> feesList = tWhgenlegService.selectSingleAnalysisFees(singleAnalysisExcel);
+        List<SingleAnalysisExcel> singleAnalysisExcels = tWhgenlegService.selectSingleAnalysis(singleAnalysisExcel);
+        Map<String, Object> map = new HashMap<>();
+        map.put("singleAnalysis", singleAnalysisExcels);
+        map.put("feeList", feesList);
+        String goodsName = "";
+        if (StringUtils.isNotEmpty(singleAnalysisExcels)) {
+            goodsName = singleAnalysisExcels.get(0).getGoodsName();
+        }
+        map.put("goodsName", goodsName);
+        return AjaxResult.success(map);
+    }
+
+    /**
+     * 导出单票分析信息
+     */
+    @GetMapping(value = "/exportSingleAnalysis")
+    public AjaxResult exportSingleAnalysis(SingleAnalysisExcel singleAnalysisExcel) {
+        if (StringUtils.isNull(singleAnalysisExcel.getfCorpid()) || StringUtils.isEmpty(singleAnalysisExcel.getfMblno())) {
+            return AjaxResult.error("未找到查询条件信息");
+        }
+        List<SingleAnalysisExcel> list = tWhgenlegService.selectSingleAnalysis(singleAnalysisExcel);
+        if (StringUtils.isEmpty(list)) {
+            return AjaxResult.error("数据为空");
+        }
+        Map<String, Object> map = new HashMap<>();
+        if (StringUtils.isNotEmpty(list)) {
+            map.put("mblno", list.get(0).getfMblno());
+            map.put("corpName", list.get(0).getCorpName());
+            map.put("goodsName", list.get(0).getGoodsName());
+        }
+        ExcelUtil<SingleAnalysisExcel> util = new ExcelUtil<SingleAnalysisExcel>(SingleAnalysisExcel.class);
+        return util.singleAnalysisExportExcel(list, map, "单票分析");
+    }
+
+    /**
+     * 导出单票分析费用信息
+     */
+    @GetMapping(value = "/exportSingleAnalysisFees")
+    public AjaxResult exportSingleAnalysisFees(SingleAnalysisExcel singleAnalysisExcel) {
+        if (StringUtils.isNull(singleAnalysisExcel.getfCorpid()) || StringUtils.isEmpty(singleAnalysisExcel.getfMblno())) {
+            return AjaxResult.error("未找到查询条件信息");
+        }
+        List<SingleAnalysisFeesExcel> list = tWhgenlegService.selectSingleAnalysisFees(singleAnalysisExcel);
+        if (StringUtils.isEmpty(list)) {
+            return AjaxResult.error("数据为空");
+        }
+        ExcelUtil<SingleAnalysisFeesExcel> util = new ExcelUtil<SingleAnalysisFeesExcel>(SingleAnalysisFeesExcel.class);
+        return util.singleAnalysisFeesExportExcel(list, "单票分析费用");
+    }
+
+    /**
      * 新增库存总账
      */
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:whgenleg:add')")

+ 307 - 20
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java

@@ -18,24 +18,11 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 import java.util.stream.Collectors;
-import org.apache.poi.ss.usermodel.BorderStyle;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.CellType;
-import org.apache.poi.ss.usermodel.DataValidation;
-import org.apache.poi.ss.usermodel.DataValidationConstraint;
-import org.apache.poi.ss.usermodel.DataValidationHelper;
-import org.apache.poi.ss.usermodel.DateUtil;
-import org.apache.poi.ss.usermodel.FillPatternType;
-import org.apache.poi.ss.usermodel.Font;
-import org.apache.poi.ss.usermodel.HorizontalAlignment;
-import org.apache.poi.ss.usermodel.IndexedColors;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.VerticalAlignment;
-import org.apache.poi.ss.usermodel.Workbook;
-import org.apache.poi.ss.usermodel.WorkbookFactory;
+
+import com.alibaba.fastjson.JSONArray;
+import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddressList;
+import org.apache.poi.ss.util.CellReference;
 import org.apache.poi.xssf.streaming.SXSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFDataValidation;
 import org.slf4j.Logger;
@@ -409,6 +396,45 @@ public class ExcelUtil<T>
     }
 
     /**
+     * 总账统计导入到excel表单
+     *
+     * @param list 导出数据集合
+     * @param sheetName 工作表的名称
+     * @return 结果
+     */
+    public AjaxResult statisticsExportExcel(List<T> list, String sheetName)
+    {
+        this.init(list, sheetName, Type.EXPORT);
+        return statisticsExportExcel();
+    }
+
+    /**
+     * 单票分析导入到excel表单
+     *
+     * @param list 导出数据集合
+     * @param sheetName 工作表的名称
+     * @return 结果
+     */
+    public AjaxResult singleAnalysisExportExcel(List<T> list, Map<String, Object> map, String sheetName)
+    {
+        this.init(list, sheetName, Type.EXPORT);
+        return singleAnalysisExportExcel(map);
+    }
+
+    /**
+     * 单票分析费用导入到excel表单
+     *
+     * @param list 导出数据集合
+     * @param sheetName 工作表的名称
+     * @return 结果
+     */
+    public AjaxResult singleAnalysisFeesExportExcel(List<T> list, String sheetName)
+    {
+        this.init(list, sheetName, Type.EXPORT);
+        return singleAnalysisFeesExportExcel();
+    }
+
+    /**
      * 对list数据源将其里面的数据导入到excel表单
      * 
      * @param sheetName 工作表的名称
@@ -451,14 +477,271 @@ public class ExcelUtil<T>
                     addStatisticsRow();
                 }
             }
+            String filename = encodingFilename(sheetName);
+            out = new FileOutputStream(getAbsoluteFile(filename));
+            wb.write(out);
+            return AjaxResult.success(filename);
+        }
+        catch (Exception e)
+        {
+            log.error("导出Excel异常{}", e.getMessage());
+            throw new CustomException("导出Excel失败,请联系网站管理员!");
+        }
+        finally
+        {
+            if (wb != null)
+            {
+                try
+                {
+                    wb.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+            if (out != null)
+            {
+                try
+                {
+                    out.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+        }
+    }
+
+    /**
+     * 总账统计导入到excel表单
+     *
+     * @return 结果
+     */
+    public AjaxResult statisticsExportExcel()
+    {
+        OutputStream out = null;
+        try
+        {
+            // 取出一共有多少个sheet.
+            double sheetNo = Math.ceil(list.size() / sheetSize);
+            for (int index = 0; index <= sheetNo; index++)
+            {
+                createSheet(sheetNo, index);
+
+                // 产生一行
+                Row row = sheet.createRow(0);
+                int column = 0;
+                // 写入各个字段的列头名称
+                for (Object[] os : fields)
+                {
+                    Excel excel = (Excel) os[1];
+                    this.createCell(excel, row, column++);
+                }
+                if (Type.EXPORT.equals(type))
+                {
+                    fillExcelData(index, row);
+                    addStatisticsRow();
+                }
+            }
             Row row = sheet.createRow(list.size() + 1);
             row.createCell(1).setCellValue("全部累计");
             row.createCell(3).setCellValue("仓储费");
             row.createCell(4).setCellValue("出入库费用");
             row.createCell(5).setCellValue("合计人民币");
+            String filename = encodingFilename(sheetName);
+            out = new FileOutputStream(getAbsoluteFile(filename));
+            wb.write(out);
+            return AjaxResult.success(filename);
+        }
+        catch (Exception e)
+        {
+            log.error("导出Excel异常{}", e.getMessage());
+            throw new CustomException("导出Excel失败,请联系网站管理员!");
+        }
+        finally
+        {
+            if (wb != null)
+            {
+                try
+                {
+                    wb.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+            if (out != null)
+            {
+                try
+                {
+                    out.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+        }
+    }
 
+    /**
+     * 单票分析导入到excel表单
+     *
+     * @return 结果
+     */
+    public AjaxResult singleAnalysisExportExcel(Map<String, Object> map)
+    {
+        OutputStream out = null;
+        try
+        {
+            // 取出一共有多少个sheet.
+            double sheetNo = Math.ceil(list.size() / sheetSize);
+            for (int index = 0; index <= sheetNo; index++)
+            {
+                createSheet(sheetNo, index);
+                // 产生一行
+                Row row = sheet.createRow(0);
+                int column = 0;
+                // 写入各个字段的列头名称
+                for (Object[] os : fields)
+                {
+                    Excel excel = (Excel) os[1];
+                    this.createCell(excel, row, column++);
+                }
+                if (Type.EXPORT.equals(type))
+                {
+                    fillExcelData(index, row);
+                    addStatisticsRow();
+                }
+            }
+            Row row = sheet.createRow(list.size() + 1);
+            Cell cell;// 单元格
+            String colString;//长度转成ABC后的列
+            String sumString;//求和公式
+            Integer[] line = {4, 5, 7, 8, 9, 10};
+            cell = row.createCell(0);// 创建单元格
+            cell.setCellValue("合计:");
+            int totalRows = sheet.getPhysicalNumberOfRows();
+            for (Integer l : line) {
+                cell = row.createCell(l);// 创建单元格
+                cell.setCellStyle(styles.get("total"));// 设置单元格样式
+                colString = CellReference.convertNumToColString(l);  //长度转成ABC列
+                //求和公式 求i9至i12单元格的总和
+                if (l == 5 || l == 8) {
+                    sumString = "SUM(" + colString + "2:" + colString + (totalRows-1) + ") / 1000";
+                } else {
+                    sumString = "SUM(" + colString + "2:" + colString + (totalRows-1) + ")";
+                }
+                cell.setCellFormula(sumString);// 把公式塞入合计列
+            }
+            wb.setForceFormulaRecalculation(true);
+            String mblno  = "", corpName = "", goodsName = "";
+            if (map.containsKey("mblno")) {
+                mblno = map.get("mblno").toString();
+            }
+            if (map.containsKey("corpName")) {
+                corpName = map.get("corpName").toString();
+            }
+            if (map.containsKey("goodsName")) {
+                goodsName = map.get("goodsName").toString();
+            }
+            Row primaryRow = sheet.createRow(list.size() + 2);
+            primaryRow.createCell(1).setCellValue("货主:");
+            cell = primaryRow.createCell(2);// 创建单元格
+            cell.setCellValue(corpName);
+            primaryRow.createCell(3).setCellValue("提单号:");
+            cell = primaryRow.createCell(4);// 创建单元格
+            cell.setCellValue(mblno);
+            primaryRow.createCell(5).setCellValue("品名:");
+            cell = primaryRow.createCell(6);// 创建单元格
+            cell.setCellValue(goodsName);
+            String filename = encodingFilename(sheetName);
+            out = new FileOutputStream(getAbsoluteFile(filename));
+            wb.write(out);
+            return AjaxResult.success(filename);
+        }
+        catch (Exception e)
+        {
+            log.error("导出Excel异常{}", e.getMessage());
+            throw new CustomException("导出Excel失败,请联系网站管理员!");
+        }
+        finally
+        {
+            if (wb != null)
+            {
+                try
+                {
+                    wb.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+            if (out != null)
+            {
+                try
+                {
+                    out.close();
+                }
+                catch (IOException e1)
+                {
+                    e1.printStackTrace();
+                }
+            }
+        }
+    }
 
-
+    /**
+     * 单票分析费用导入到excel表单
+     *
+     * @return 结果
+     */
+    public AjaxResult singleAnalysisFeesExportExcel()
+    {
+        OutputStream out = null;
+        try
+        {
+            // 取出一共有多少个sheet.
+            double sheetNo = Math.ceil(list.size() / sheetSize);
+            for (int index = 0; index <= sheetNo; index++)
+            {
+                createSheet(sheetNo, index);
+                // 产生一行
+                Row row = sheet.createRow(0);
+                int column = 0;
+                // 写入各个字段的列头名称
+                for (Object[] os : fields)
+                {
+                    Excel excel = (Excel) os[1];
+                    this.createCell(excel, row, column++);
+                }
+                if (Type.EXPORT.equals(type))
+                {
+                    fillExcelData(index, row);
+                    addStatisticsRow();
+                }
+            }
+            Row row = sheet.createRow(list.size() + 1);
+            Cell cell;// 单元格
+            String colString;//长度转成ABC后的列
+            String sumString;//求和公式
+            Integer[] line = {4, 6};
+            cell = row.createCell(0);// 创建单元格
+            cell.setCellValue("合计:");
+            int totalRows = sheet.getPhysicalNumberOfRows();
+            for (Integer l : line) {
+                cell = row.createCell(l);// 创建单元格
+                cell.setCellStyle(styles.get("total"));// 设置单元格样式
+                colString = CellReference.convertNumToColString(l);  //长度转成ABC列
+                //求和公式 求i9至i12单元格的总和
+                sumString = "SUM(" + colString + "2:" + colString + (totalRows-1) + ")";
+                cell.setCellFormula(sumString);// 把公式塞入合计列
+            }
+            wb.setForceFormulaRecalculation(true);
             String filename = encodingFilename(sheetName);
             out = new FileOutputStream(getAbsoluteFile(filename));
             wb.write(out);
@@ -689,9 +972,13 @@ public class ExcelUtil<T>
                 {
                     cell.setCellValue(convertDictByExp(Convert.toStr(value), dictType, separator));
                 }
-                else if (value instanceof BigDecimal && -1 != attr.scale())
+                else if (value instanceof BigDecimal) {
+                    double doubleVal = ((BigDecimal) value).doubleValue();
+                    cell.setCellValue(doubleVal);
+                }
+                else if (value instanceof Integer && -1 != attr.sort())
                 {
-                    cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).toString());
+                    cell.setCellValue((Integer) value);
                 }
                 else
                 {

+ 220 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/domain/SingleAnalysisExcel.java

@@ -0,0 +1,220 @@
+package com.ruoyi.reportManagement.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+public class SingleAnalysisExcel {
+
+    /** 货主Id */
+    private Long fCorpid;
+
+    /** 货主 */
+    private String corpName;
+
+    /** 提单号 */
+    private String fMblno;
+
+    /** 品名 */
+    private String goodsName;
+
+    /** 序号 */
+    @Excel(name = "序号")
+    private Integer lineNo;
+
+    /** 作业类型 */
+    @Excel(name = "作业类型")
+    private String fBusinessType;
+
+    /** 箱型箱量 */
+    @Excel(name = "箱型箱量")
+    private String fCntval;
+
+    @Excel(name = "入库日期")
+    private String inBsdate;
+
+    /** 入库件数 */
+    @Excel(name = "入库件数")
+    private Integer inQty;
+
+    /** 入库毛重 */
+    @Excel(name = "入库毛重")
+    private BigDecimal inGrossweight;
+
+    @Excel(name = "出库日期")
+    private String outBsdate;
+
+    /** 入库件数 */
+    @Excel(name = "出库件数")
+    private Integer outQty;
+
+    /** 入库毛重 */
+    @Excel(name = "出库毛重")
+    private BigDecimal outGrossweight;
+
+    /** 结余件数 */
+    @Excel(name = "结余件数")
+    private Integer fQtyblc;
+
+    /** 结余毛重 */
+    @Excel(name = "结余毛重")
+    private BigDecimal fGrossweightblc;
+
+    /** 业务类型 */
+    @Excel(name = "业务类型")
+    private String fBilltype;
+
+    /** 备注 */
+    @Excel(name = "备注")
+    private String remark;
+
+    /** 日期区间 */
+    private List<String> bsdateList;
+
+    public Long getfCorpid() {
+        return fCorpid;
+    }
+
+    public void setfCorpid(Long fCorpid) {
+        this.fCorpid = fCorpid;
+    }
+
+    public String getCorpName() {
+        return corpName;
+    }
+
+    public void setCorpName(String corpName) {
+        this.corpName = corpName;
+    }
+
+    public String getfMblno() {
+        return fMblno;
+    }
+
+    public void setfMblno(String fMblno) {
+        this.fMblno = fMblno;
+    }
+
+    public String getGoodsName() {
+        return goodsName;
+    }
+
+    public void setGoodsName(String goodsName) {
+        this.goodsName = goodsName;
+    }
+
+    public Integer getLineNo() {
+        return lineNo;
+    }
+
+    public void setLineNo(Integer lineNo) {
+        this.lineNo = lineNo;
+    }
+
+    public String getfBusinessType() {
+        return fBusinessType;
+    }
+
+    public void setfBusinessType(String fBusinessType) {
+        this.fBusinessType = fBusinessType;
+    }
+
+    public String getfCntval() {
+        return fCntval;
+    }
+
+    public void setfCntval(String fCntval) {
+        this.fCntval = fCntval;
+    }
+
+    public String getInBsdate() {
+        return inBsdate;
+    }
+
+    public void setInBsdate(String inBsdate) {
+        this.inBsdate = inBsdate;
+    }
+
+    public Integer getInQty() {
+        return inQty;
+    }
+
+    public void setInQty(Integer inQty) {
+        this.inQty = inQty;
+    }
+
+    public BigDecimal getInGrossweight() {
+        return inGrossweight;
+    }
+
+    public void setInGrossweight(BigDecimal inGrossweight) {
+        this.inGrossweight = inGrossweight;
+    }
+
+    public String getOutBsdate() {
+        return outBsdate;
+    }
+
+    public void setOutBsdate(String outBsdate) {
+        this.outBsdate = outBsdate;
+    }
+
+    public Integer getOutQty() {
+        return outQty;
+    }
+
+    public void setOutQty(Integer outQty) {
+        this.outQty = outQty;
+    }
+
+    public BigDecimal getOutGrossweight() {
+        return outGrossweight;
+    }
+
+    public void setOutGrossweight(BigDecimal outGrossweight) {
+        this.outGrossweight = outGrossweight;
+    }
+
+    public Integer getfQtyblc() {
+        return fQtyblc;
+    }
+
+    public void setfQtyblc(Integer fQtyblc) {
+        this.fQtyblc = fQtyblc;
+    }
+
+    public BigDecimal getfGrossweightblc() {
+        return fGrossweightblc;
+    }
+
+    public void setfGrossweightblc(BigDecimal fGrossweightblc) {
+        this.fGrossweightblc = fGrossweightblc;
+    }
+
+    public String getfBilltype() {
+        return fBilltype;
+    }
+
+    public void setfBilltype(String fBilltype) {
+        this.fBilltype = fBilltype;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public List<String> getBsdateList() {
+        return bsdateList;
+    }
+
+    public void setBsdateList(List<String> bsdateList) {
+        this.bsdateList = bsdateList;
+    }
+}

+ 119 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/domain/SingleAnalysisFeesExcel.java

@@ -0,0 +1,119 @@
+package com.ruoyi.reportManagement.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.annotation.Excel;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class SingleAnalysisFeesExcel {
+    /** 序号 */
+    @Excel(name = "序号")
+    private Integer lineNo;
+
+    /** 日期 */
+    @Excel(name = "日期")
+    private String createTime;
+
+    /** 作业类型 */
+    @Excel(name = "作业类型")
+    private String fBusinessType;
+
+    /** 费用 */
+    @Excel(name = "费用")
+    private String fFeeid;
+
+    /** 数量 */
+    @Excel(name = "数量")
+    private Integer fQty;
+
+    /** 单价 */
+    @Excel(name = "单价")
+    private BigDecimal fUnitprice;
+
+    /** 金额 */
+    @Excel(name = "金额")
+    private BigDecimal fAmount;
+
+    /** 备注 */
+    @Excel(name = "备注")
+    private String remark;
+
+    public Integer getLineNo() {
+        return lineNo;
+    }
+
+    public void setLineNo(Integer lineNo) {
+        this.lineNo = lineNo;
+    }
+
+    public String getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(String createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getfBusinessType() {
+        return fBusinessType;
+    }
+
+    public void setfBusinessType(String fBusinessType) {
+        this.fBusinessType = fBusinessType;
+    }
+
+    public String getfFeeid() {
+        return fFeeid;
+    }
+
+    public void setfFeeid(String fFeeid) {
+        this.fFeeid = fFeeid;
+    }
+
+    public Integer getfQty() {
+        return fQty;
+    }
+
+    public void setfQty(Integer fQty) {
+        this.fQty = fQty;
+    }
+
+    public BigDecimal getfUnitprice() {
+        return fUnitprice;
+    }
+
+    public void setfUnitprice(BigDecimal fUnitprice) {
+        this.fUnitprice = fUnitprice;
+    }
+
+    public BigDecimal getfAmount() {
+        return fAmount;
+    }
+
+    public void setfAmount(BigDecimal fAmount) {
+        this.fAmount = fAmount;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    @Override
+    public String toString() {
+        return "SingleAnalysisFeesExcel{" +
+                "lineNo=" + lineNo +
+                ", createTime=" + createTime +
+                ", fBusinessType='" + fBusinessType + '\'' +
+                ", fFeeid='" + fFeeid + '\'' +
+                ", fQty=" + fQty +
+                ", fUnitprice=" + fUnitprice +
+                ", fAmount=" + fAmount +
+                ", remark='" + remark + '\'' +
+                '}';
+    }
+}

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

@@ -1,6 +1,8 @@
 package com.ruoyi.reportManagement.service;
 
 
+import com.ruoyi.reportManagement.domain.SingleAnalysisExcel;
+import com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Whgenleg;
@@ -103,4 +105,17 @@ public interface ITWhgenlegService {
 
     List<Map<String, Object>> selectdetailedList(TWarehousebill tWarehousebill);
 
+    /**
+     *  查询单票分析信息
+     * @param singleAnalysisExcel
+     * @return
+     */
+    public List<SingleAnalysisExcel> selectSingleAnalysis(SingleAnalysisExcel singleAnalysisExcel);
+
+    /**
+     *  查询单票分析费用信息
+     * @param singleAnalysisExcel
+     * @return
+     */
+    public List<SingleAnalysisFeesExcel> selectSingleAnalysisFees(SingleAnalysisExcel singleAnalysisExcel);
 }

+ 22 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java

@@ -5,6 +5,8 @@ import com.ruoyi.basicData.mapper.TWarehouseMapper;
 import com.ruoyi.common.core.domain.entity.TWarehouse;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.reportManagement.domain.SingleAnalysisExcel;
+import com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel;
 import com.ruoyi.reportManagement.domain.TWhgenleg;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Whgenleg;
@@ -369,6 +371,26 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
     }
 
     /**
+     *  查询单票分析信息
+     * @param singleAnalysisExcel 查询条件
+     * @return  结果
+     */
+    @Override
+    public List<SingleAnalysisExcel> selectSingleAnalysis(SingleAnalysisExcel singleAnalysisExcel) {
+        return tWarehouseBillsMapper.selectSingleAnalysis(singleAnalysisExcel);
+    }
+
+    /**
+     *  查询单票分析费用信息
+     * @param singleAnalysisExcel
+     * @return
+     */
+    @Override
+    public List<SingleAnalysisFeesExcel> selectSingleAnalysisFees(SingleAnalysisExcel singleAnalysisExcel) {
+        return tWarehouseBillsMapper.selectSingleAnalysisFees(singleAnalysisExcel);
+    }
+
+    /**
      *
      * @param fOriginalbilldate 根据该字段进行合并
      * @param dataList 原始数据

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

@@ -3,6 +3,8 @@ package com.ruoyi.warehouseBusiness.mapper;
 
 import com.baomidou.mybatisplus.mapper.BaseMapper;
 import com.ruoyi.common.core.domain.entity.TWarehouse;
+import com.ruoyi.reportManagement.domain.SingleAnalysisExcel;
+import com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel;
 import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems;
@@ -156,4 +158,18 @@ public interface TWarehouseBillsMapper extends BaseMapper<TWarehouseBills> {
      * @return
      */
     public List<Map<String, Object>> selectWarehouseItemListById(TWarehouseBills warehouseBills);
+
+    /**
+     *  查询单票分析信息
+     * @param singleAnalysisExcel 查询条件
+     * @return  结果
+     */
+    public List<SingleAnalysisExcel> selectSingleAnalysis(SingleAnalysisExcel singleAnalysisExcel);
+
+    /**
+     *  查询单票分析费用信息
+     * @param singleAnalysisExcel
+     * @return
+     */
+    public List<SingleAnalysisFeesExcel> selectSingleAnalysisFees(SingleAnalysisExcel singleAnalysisExcel);
 }

+ 81 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -1775,4 +1775,85 @@
             t.f_pid = #{fId}
     </select>
 
+    <select id="selectSingleAnalysis" parameterType="com.ruoyi.reportManagement.domain.SingleAnalysisExcel" resultType="com.ruoyi.reportManagement.domain.SingleAnalysisExcel">
+        SELECT
+            c.f_name corpName,
+            #{fMblno} fMblno,
+            w.f_product_name goodsName,
+            @ii := @ii + 1 lineNo,
+            d.dict_label fBusinessType,
+            w.f_cntval fCntval,
+            IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' || item.f_billtype = 'CKDB', date_format( item.f_bsdate, '%Y-%m-%d' ), NULL ) inBsdate,
+            IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' || item.f_billtype = 'CKDB' and ware.f_id = item.f_transfer_warehouselocid, item.f_qty, 0) inQty,
+            IF(item.f_billtype = 'SJRK' || item.f_billtype = 'HQZY' || item.f_billtype = 'CKDB' and ware.f_id = item.f_transfer_warehouselocid, item.f_grossweight, 0.00 ) inGrossweight,
+            IF(item.f_billtype = 'SJCK' || item.f_billtype = 'CKDB', item.f_bsdate, NULL ) outBsdate,
+            IF(item.f_billtype = 'SJCK' || item.f_billtype = 'CKDB', item.f_qty, 0 ) outQty,
+            IF(item.f_billtype = 'SJCK' || item.f_billtype = 'CKDB', item.f_grossweight, 0.00 ) outGrossweight,
+            CASE
+                WHEN item.f_billtype = 'SJRK' THEN
+                '入库'
+                WHEN item.f_billtype = 'SJCK' THEN
+                '出库'
+                WHEN item.f_billtype = 'CKDB' and ware.f_charg = 1 THEN
+                '调拨'
+                WHEN item.f_billtype = 'HQZY' THEN
+                '货权转移'
+                WHEN item.f_billtype = 'HWTG' THEN
+                '货物通关'
+            END AS fBilltype,
+            0 fQtyblc,
+            0 fGrossweightblc,
+            item.remark
+        FROM
+            t_warehousebills w
+            LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
+            LEFT JOIN t_corps c ON c.f_id = w.f_corpid
+            LEFT JOIN t_warehouse ware ON ware.f_id = item.f_warehouselocid
+            LEFT JOIN sys_dict_data d ON d.dict_value = item.f_business_type,
+            ( SELECT @ii := 0 ) AS ii
+        WHERE
+            w.f_corpid = #{fCorpid}
+            AND item.f_mblno = #{fMblno}
+            AND d.dict_type = 'st_in_type'
+            AND IF(item.f_billtype = 'CKDB' and ware.f_charg = 0, w.f_id = '', w.f_id != '')
+            <if test='bsdateList != null and bsdateList[0] != null and bsdateList[0]!= ""'>
+                AND item.f_bsdate &gt;= #{bsdateList[0]}
+            </if>
+            <if test='bsdateList != null and bsdateList[1] != null and bsdateList[1]!= ""'>
+                AND item.f_bsdate &lt;= #{bsdateList[1]}
+            </if>
+        order by item.f_bsdate desc
+    </select>
+
+    <select id="selectSingleAnalysisFees" parameterType="com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel" resultType="com.ruoyi.reportManagement.domain.SingleAnalysisFeesExcel">
+        SELECT
+            @ii := @ii + 1 lineNo,
+            date_format( f.create_time, '%Y-%m-%d' ) createTime,
+            d.dict_label fBusinessType,
+            fee.f_name fFeeid,
+            f.f_qty fQty,
+            f.f_unitprice fUnitprice,
+            f.f_amount fAmount,
+            f.remark
+        FROM
+            t_warehousebills w
+            LEFT JOIN t_warehousebillsitems item ON item.f_pid = w.f_id
+            LEFT JOIN t_warehousebillsfees f ON f.f_pid = w.f_id
+            LEFT JOIN t_fees fee ON fee.f_id = f.f_feeid
+            LEFT JOIN t_warehouse ware ON ware.f_id = item.f_warehouselocid
+            LEFT JOIN sys_dict_data d ON d.dict_value = f.f_business_type,
+            ( SELECT @ii := 0 ) AS ii
+        WHERE
+            item.f_mblno = #{fMblno}
+            AND d.dict_type = 'st_in_type'
+            AND IF(item.f_billtype = 'CKDB' and ware.f_charg = 0, w.f_id = '', w.f_id != '')
+            <if test='bsdateList != null and bsdateList[0] != null and bsdateList[0]!= ""'>
+                AND item.f_bsdate &gt;= #{bsdateList[0]}
+            </if>
+            <if test='bsdateList != null and bsdateList[1] != null and bsdateList[1]!= ""'>
+                AND item.f_bsdate &lt;= #{bsdateList[1]}
+            </if>
+        order by f.create_time desc
+    </select>
+
 </mapper>