Browse Source

完善账单明细->重新完善导出分项接口

nzf 3 years ago
parent
commit
826494492f

+ 1 - 14
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/warehouseBusiness/TWarehousebillsfeesController.java

@@ -141,19 +141,6 @@ public class TWarehousebillsfeesController extends BaseController {
      */
     @GetMapping("/exportBillSubItemDetails")
     public AjaxResult exportBillSubItemDetails(TWarehousebillsfees tWarehousebillsfees){
-        List<QueryMenu> list = tWarehousebillsfeesService.selectQueryMenuList(tWarehousebillsfees);
-        if (list.size()<1) {
-            return AjaxResult.error("当前选择无数据,无法导出");
-        }
-        if (tWarehousebillsfees.getfCorpid() == null) {
-            return AjaxResult.error("请选择客户名称");
-        } else if (tWarehousebillsfees.getDateRange()==null) {
-            return AjaxResult.error("请选择业务日期");
-        } else {
-            BillDetailsSubItem billDetailsSubItem = new BillDetailsSubItem();
-            billDetailsSubItem.setfCorpid(tWarehousebillsfees.getfCorpid());
-            billDetailsSubItem.setDateRange(tWarehousebillsfees.getDateRange());
-            return tWarehousebillsfeesService.exportBillSubItemDetails(billDetailsSubItem);
-        }
+        return tWarehousebillsfeesService.exportBillSubItemDetails(tWarehousebillsfees);
     }
 }

+ 42 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/domain/TWareHouseItemsExcel.java

@@ -70,6 +70,48 @@ public class TWareHouseItemsExcel {
     @Excel(name = "净重")
     private BigDecimal fNetweight;
 
+    /**
+     * 司机
+     */
+    @Excel(name = "司机")
+    private String fDrivername;
+
+    /**
+     * 车号
+     */
+    @Excel(name = "车号")
+    private String fTruckno;
+
+    /**
+     * 司机身份证
+     */
+    @Excel(name = "司机身份证")
+    private String fDriverIdCar;
+
+    public String getfDrivername() {
+        return fDrivername;
+    }
+
+    public void setfDrivername(String fDrivername) {
+        this.fDrivername = fDrivername;
+    }
+
+    public String getfTruckno() {
+        return fTruckno;
+    }
+
+    public void setfTruckno(String fTruckno) {
+        this.fTruckno = fTruckno;
+    }
+
+    public String getfDriverIdCar() {
+        return fDriverIdCar;
+    }
+
+    public void setfDriverIdCar(String fDriverIdCar) {
+        this.fDriverIdCar = fDriverIdCar;
+    }
+
     public String getfId() {
         return fId;
     }

+ 157 - 39
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/excel/BillDetailsSubItem.java

@@ -1,74 +1,144 @@
 package com.ruoyi.warehouseBusiness.excel;
 
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * 账单明细分项实体
  */
 public class BillDetailsSubItem {
-    // 业务类型
+
+    /**
+     * fId
+     */
+    private Long fId;
+
+    /**
+     * 业务类型
+     */
     private String fBilltype;
 
-    // 作业类型
+    /**
+     * 作业类型
+     */
     private String twlfBusinesstype;
 
-    // 客户名称
+    /**
+     * 客户名称
+     */
     private Long fCorpid;
 
-    // 提单号
-    private String fStatementno;
+    /**
+     * 提单号
+     */
+    private String fMblno;
+
+    /**
+     * 业务日期--出库时间
+     */
+    private String fBsdate;
 
-    // 货名
+    /**
+     * 审核日期
+     */
+    private Date fReviewDate;
+
+    /**
+     * 收、付,D:收 C:付
+     */
+    private String fDc;
+
+    /**
+     * 费用状态
+     */
+    private String fBillstatusName;
+
+    /**
+     * 费用名称
+     */
+    private String fFeeid;
+
+    /**
+     * 结算方式
+     */
+    private Long fStltypeid;
+
+    /**
+     * 货名
+     */
     private String tgfName;
 
-    // 客户
+    /**
+     * 客户
+     */
     private String tcfName;
 
-    // 件数
+    /**
+     * 件数
+     */
     private BigDecimal fQty;
 
-    // 重量
+    /**
+     * 重量
+     */
     private BigDecimal fNetweight;
 
-    // 体积
+    /**
+     * 体积
+     */
     private BigDecimal fVolumn;
 
-    // 入库时间
+    /**
+     * 入库时间
+     */
     private String fOriginalbilldate;
 
-    // 出库时间
-    private String fBsdate;
-
-    // 计费天数
+    /**
+     * 计费天数
+     */
     private int fBillingdays;
 
-    // 金额
+    /**
+     * 金额
+     */
     private BigDecimal fAmount;
 
-    // 计划员
+    /**
+     * 计划员
+     */
     private String createBy;
 
-    // 计费时间
+    /**
+     * 计费时间
+     */
     private String fChargedate;
 
-    // 结费时间
+    /**
+     * 结费时间
+     */
     private String fStlamountdate;
 
-    // 仓库
+    /**
+     * 仓库
+     */
     private String fhName;
 
-    // 备注
+    /**
+     * 备注
+     */
     private String remark;
 
-    // 统计范围
-    private String dateRange;
+    /**
+     * 发货方
+     */
+    private String fShipper;
 
-    public String getDateRange() {
-        return dateRange;
+    public Long getfId() {
+        return fId;
     }
 
-    public void setDateRange(String dateRange) {
-        this.dateRange = dateRange;
+    public void setfId(Long fId) {
+        this.fId = fId;
     }
 
     public String getfBilltype() {
@@ -95,12 +165,60 @@ public class BillDetailsSubItem {
         this.fCorpid = fCorpid;
     }
 
-    public String getfStatementno() {
-        return fStatementno;
+    public String getfMblno() {
+        return fMblno;
+    }
+
+    public void setfMblno(String fMblno) {
+        this.fMblno = fMblno;
+    }
+
+    public String getfBsdate() {
+        return fBsdate;
+    }
+
+    public void setfBsdate(String fBsdate) {
+        this.fBsdate = fBsdate;
+    }
+
+    public Date getfReviewDate() {
+        return fReviewDate;
+    }
+
+    public void setfReviewDate(Date fReviewDate) {
+        this.fReviewDate = fReviewDate;
+    }
+
+    public String getfDc() {
+        return fDc;
+    }
+
+    public void setfDc(String fDc) {
+        this.fDc = fDc;
+    }
+
+    public String getfBillstatusName() {
+        return fBillstatusName;
+    }
+
+    public void setfBillstatusName(String fBillstatusName) {
+        this.fBillstatusName = fBillstatusName;
+    }
+
+    public String getfFeeid() {
+        return fFeeid;
+    }
+
+    public void setfFeeid(String fFeeid) {
+        this.fFeeid = fFeeid;
     }
 
-    public void setfStatementno(String fStatementno) {
-        this.fStatementno = fStatementno;
+    public Long getfStltypeid() {
+        return fStltypeid;
+    }
+
+    public void setfStltypeid(Long fStltypeid) {
+        this.fStltypeid = fStltypeid;
     }
 
     public String getTgfName() {
@@ -151,14 +269,6 @@ public class BillDetailsSubItem {
         this.fOriginalbilldate = fOriginalbilldate;
     }
 
-    public String getfBsdate() {
-        return fBsdate;
-    }
-
-    public void setfBsdate(String fBsdate) {
-        this.fBsdate = fBsdate;
-    }
-
     public int getfBillingdays() {
         return fBillingdays;
     }
@@ -214,4 +324,12 @@ public class BillDetailsSubItem {
     public void setRemark(String remark) {
         this.remark = remark;
     }
+
+    public String getfShipper() {
+        return fShipper;
+    }
+
+    public void setfShipper(String fShipper) {
+        this.fShipper = fShipper;
+    }
 }

+ 29 - 16
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsfeesMapper.java

@@ -71,20 +71,20 @@ public interface TWarehousebillsfeesMapper extends BaseMapper<TWarehousebillsfee
     int deleteByFPid(Long fId);
 
     /**
-     *  根据主表id 更新库存费用表对应状态
+     * 根据主表id 更新库存费用表对应状态
      *
      * @param fettle 对应状态
-     * @param fPid 主表id
-     * @return  结果
+     * @param fPid   主表id
+     * @return 结果
      */
     int warehouseFeesFollowUpdate(@Param("fPid") Long fPid, @Param("fettle") Long fettle, @Param("auditItem") Date auditItem);
 
     /**
-     *  根据费用表id 更新库存费用表对应状态
+     * 根据费用表id 更新库存费用表对应状态
      *
      * @param fettle 对应状态
-     * @param fPid 主表id
-     * @return  结果
+     * @param fPid   主表id
+     * @return 结果
      */
     int warehouseFeesFollowUpdateById(@Param("fPid") Long fPid, @Param("fettle") Long fettle, @Param("auditItem") Date auditItem);
 
@@ -92,10 +92,10 @@ public interface TWarehousebillsfeesMapper extends BaseMapper<TWarehousebillsfee
     public int updateTWarehousebillsfee(@Param("map") Map<String, Object> map);
 
     /**
-     *  根据主表id 查询库存费用表数据
+     * 根据主表id 查询库存费用表数据
      *
      * @param fPid 主表id
-     * @return  结果
+     * @return 结果
      */
     List<TWarehousebillsfees> selectTWarehousebillsfeesByPId(Long fPid);
 
@@ -111,37 +111,45 @@ public interface TWarehousebillsfeesMapper extends BaseMapper<TWarehousebillsfee
 
     public List<Map<String, Object>> voyageFeeDetails(@Param("fPid") Long fPid, @Param("fDc") String fDc);
 
+    List<Map<String, Object>> selectSubItemsFeeDetails(@Param("fPid") Long fPid,@Param("fDc") String fDc);
+
     int deleteFessByFPid(@Param("fPid") Long fPid, @Param("fDc") String fDc);
 
     /**
-     *  查询总账统计报表
+     * 查询总账统计报表
+     *
      * @param tWarehousebillsfees
      * @return
      */
     public List<FleetExcel> selectFleetExcelList(TWarehousebillsfees tWarehousebillsfees);
 
     /**
-     *  查询总账统计报表月份总数
+     * 查询总账统计报表月份总数
+     *
      * @param tWarehousebillsfees
      * @return
      */
-    public FleetExcel  selectFleetExcelMonthList(TWarehousebillsfees tWarehousebillsfees);
+    public FleetExcel selectFleetExcelMonthList(TWarehousebillsfees tWarehousebillsfees);
 
     /**
      * 网页版对账查询
+     *
      * @param tAccount
      * @return
      */
-    public List<Map<String,Object>> webVersionReconciliation(TAccount tAccount);
+    public List<Map<String, Object>> webVersionReconciliation(TAccount tAccount);
+
     /**
      * 网页版对账查询明细
+     *
      * @param tAccount
      * @return
      */
-    public List<Map<String,Object>> webVersionDetail(TAccount tAccount);
+    public List<Map<String, Object>> webVersionDetail(TAccount tAccount);
 
     /**
      * 查询来源id
+     *
      * @param fId
      * @return
      */
@@ -149,12 +157,14 @@ public interface TWarehousebillsfeesMapper extends BaseMapper<TWarehousebillsfee
 
     /**
      * 首页应收款排名
+     *
      * @return
      */
-    public List<Map<String,Object>> accountsDue();
+    public List<Map<String, Object>> accountsDue();
 
     /**
      * 获取查询菜单数据
+     *
      * @param tWarehousebillsfees
      * @return
      */
@@ -162,8 +172,11 @@ public interface TWarehousebillsfeesMapper extends BaseMapper<TWarehousebillsfee
 
     /**
      * 查询账单明细导出分项所需数据
-     * @param billDetailsSubItem
+     *
+     * @param tWarehousebillsfees
      * @return
      */
-    List<BillDetailsSubItem> selectBillDetailsSubItem(BillDetailsSubItem billDetailsSubItem);
+    List<Map<String, Object>> selectBillDetailsSubItemNew(TWarehousebillsfees tWarehousebillsfees);
+
+    List<Map<String, Object>> selectFeesBymblnoAndFname(@Param("fMblno") String fMblno,@Param("fName") String fName);
 }

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

@@ -93,8 +93,8 @@ public interface ITWarehousebillsfeesService {
 
     /**
      * 导出账单明细分项数据
-     * @param billDetailsSubItem
+     * @param tWarehousebillsfees
      * @return
      */
-    AjaxResult exportBillSubItemDetails(BillDetailsSubItem billDetailsSubItem);
+    AjaxResult exportBillSubItemDetails(TWarehousebillsfees tWarehousebillsfees);
 }

+ 130 - 67
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehousebillsfeesServiceImpl.java

@@ -24,10 +24,7 @@ import org.springframework.stereotype.Service;
 
 import java.io.*;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 仓库费用明细Service业务层处理
@@ -208,20 +205,20 @@ public class TWarehousebillsfeesServiceImpl implements ITWarehousebillsfeesServi
     }
 
     @Override
-    public AjaxResult exportBillSubItemDetails(BillDetailsSubItem billDetailsSubItem) {
+    public AjaxResult exportBillSubItemDetails(TWarehousebillsfees tWarehousebillsfees) {
         // 创建 workbook,对应一个 excel 文件
         HSSFWorkbook wb = new HSSFWorkbook();
         // 在 workbook 中添加一个sheet,对应 excel 文档中的 sheet
         HSSFSheet sheet = wb.createSheet("分项明细");
         // 获取 cell 样式
-        HSSFCellStyle cellTitleStyle = getCellStyle(wb,"center",true);
-        HSSFCellStyle cellContentStyle = getCellStyle(wb,"center",true);
+        HSSFCellStyle cellTitleStyle = getCellStyle(wb, "center", true);
+        HSSFCellStyle cellContentStyle = getCellStyle(wb, "center", true);
         // 创建标题,合并标题单元格
         // 行号
-        int rowNum = 2;
+        int rowNum = 0;
         // 第一行
         HSSFRow first = sheet.createRow(rowNum++);
-        String[] left = {"序号", "业务类型", "作业类型", "提单号", "货名", "客户", "件数", "重量", "体积", "入库时间","出库时间", "计算天数", "货物堆存费"};
+        String[] left = {"序号", "业务类型", "作业类型", "客户", "提单号", "货名", "件数", "重量", "体积", "入库时间", "出库时间", "计算天数"};
         List<String> middle = tFeesMapper.selectTFeesNameList();
         String[] right = {"金额", "计划员", "计费时间", "结费时间", "仓库", "备注"};
 
@@ -230,39 +227,49 @@ public class TWarehousebillsfeesServiceImpl implements ITWarehousebillsfeesServi
         all.addAll(middle);
         Collections.addAll(all, right);
 
-        // 创建并获取大标题样式
-        /*HSSFCellStyle cellBigTitleStyle = getCellStyle(wb,"center",false);
-        CellRangeAddress cBigTitle = new CellRangeAddress(0,0,0,all.size()/4);
-        setBigTitle("青岛大木仓配物流有限公司现场收费统计表(仓储业务)",0,sheet,cellBigTitleStyle,cBigTitle);
-        setFont(cellBigTitleStyle,wb,"宋体",11,true);*/
-
-        // 创建并获取统计范围时间样式
-        HSSFCellStyle cellRangeTimeStyle = getCellStyle(wb,"center",false);
-        CellRangeAddress cRangeTimeTitle = new CellRangeAddress(1,1,0,all.size()/9);
-        setBigTitle("统计范围:" + billDetailsSubItem.getDateRange(),1,sheet,cellRangeTimeStyle,cRangeTimeTitle);
-        setFont(cellRangeTimeStyle,wb,"宋体",11,false);
-
         int size = all.size();
         for (int i = 0; i < size; i++) {
             HSSFCell tempCell = first.createCell(i);
-            if (i > 12 && i < size - 6) {
-                tempCell.setCellValue(all.get(i) + "单价");
+            if (i > 11 && i < size - 6) {
+                tempCell.setCellValue(all.get(i));
             } else {
                 tempCell.setCellValue(all.get(i));
             }
             tempCell.setCellStyle(cellTitleStyle);
-            // 设置第三行标题栏字体
-            setFont(cellTitleStyle,wb,"宋体",11,true);
         }
-
         // 根据客户名称,发货方查询清单数据
-        List<BillDetailsSubItem> list = tWarehousebillsfeesMapper.selectBillDetailsSubItem(billDetailsSubItem);
+        List<Map<String, Object>> list = tWarehousebillsfeesMapper.selectBillDetailsSubItemNew(tWarehousebillsfees);
         if (list.size() < 1) {
             return AjaxResult.error("无数据,导出Excel失败");
         }
 
         int index = 1;
-        for (BillDetailsSubItem bd : list) {
+        for (Map<String, Object> map : list) {
+            // 根据 提单号+客户名称,获取费用数据
+            String fMblno = StringUtils.objToStr(map.get("fMblno"));
+            String fName = StringUtils.objToStr(map.get("tcfName"));
+            List<Map<String, Object>> fees;
+            if (StringUtils.isNotEmpty(fMblno)) {
+                fees = tWarehousebillsfeesMapper.selectFeesBymblnoAndFname(fMblno, fName);
+            } else {
+                fees = new ArrayList<>();
+            }
+            // 初始化金额
+            BigDecimal allAmount = BigDecimal.ZERO;
+            Map<Integer, String> feeMap = new HashMap<>();
+            for (Map<String, Object> fee : fees) {
+                // 获取费用名称
+                String feeName = StringUtils.objToStr(fee.get("feeName"));
+                // 三元表达式校验金额是否为空,为空则为字符串 0,不为空则返回单价字符串
+                String fAmount = fee.get("fAmount") == null ? "0" : String.valueOf(fee.get("fAmount"));
+                // 金额
+                allAmount = allAmount.add(new BigDecimal(fee.get("fAmount") == null ? "0" : String.valueOf(fee.get("fAmount"))));
+                // 根据费用名称中间部分的数组下标
+                int j = middle.indexOf(feeName);
+                if (j >= 0) { // 根据下标,对费用名称下的数据进行传值
+                    feeMap.put(12 + j, fAmount);
+                }
+            }
             HSSFRow tempRow = sheet.createRow(rowNum++);
             // 循环单元格填入数据
             for (int i = 0; i < size; i++) {
@@ -273,65 +280,75 @@ public class TWarehousebillsfeesServiceImpl implements ITWarehousebillsfeesServi
                     cellValue = StringUtils.objToStr(index++);
                 } else if (i == 1) {
                     // 业务类型
-                    cellValue = StringUtils.objToStr(bd.getfBilltype());
+                    cellValue = StringUtils.objToStr(map.get("fBilltype"));
                 } else if (i == 2) {
                     // 作业类型
-                    cellValue = StringUtils.objToStr(bd.getTwlfBusinesstype());
+                    cellValue = StringUtils.objToStr(map.get("fBusinesstype"));
                 } else if (i == 3) {
-                    // 提单号
-                    cellValue = StringUtils.objToStr(bd.getfStatementno());
+                    // 客户
+                    cellValue = StringUtils.objToStr(map.get("tcfName"));
                 } else if (i == 4) {
-                    // 货名
-                    cellValue = StringUtils.objToStr(bd.getTgfName());
+                    // 提单号
+                    cellValue = StringUtils.objToStr(map.get("fMblno"));
                 } else if (i == 5) {
-                    // 客户
-                    cellValue = StringUtils.objToStr(bd.getTcfName());
+                    // 货名
+                    cellValue = StringUtils.objToStr(map.get("tgfName"));
                 } else if (i == 6) {
                     // 件数
-                    cellValue = StringUtils.objToStr(bd.getfQty());
+                    cellValue = StringUtils.objToStr(map.get("fQty"));
                 } else if (i == 7) {
                     // 重量
-                    cellValue = StringUtils.objToStr(bd.getfNetweight());
+                    cellValue = StringUtils.objToStr(map.get("fNetweight"));
                 } else if (i == 8) {
                     // 体积
-                    cellValue = StringUtils.objToStr(bd.getfVolumn());
+                    cellValue = StringUtils.objToStr(map.get("fVolumn"));
                 } else if (i == 9) {
                     // 入库时间
-                    cellValue = StringUtils.objToStr(bd.getfOriginalbilldate());
+                    cellValue = StringUtils.objToStr(map.get("fOriginalbilldate"));
                 } else if (i == 10) {
                     // 出库时间
-                    cellValue = StringUtils.objToStr(bd.getfBsdate());
+                    cellValue = StringUtils.objToStr(map.get("fBsdate"));
                 } else if (i == 11) {
                     // 计费天数
-                    cellValue = StringUtils.objToStr(bd.getfBillingdays());
+                    cellValue = StringUtils.objToStr(map.get("fBillingdays"));
                 } else if (i == size - 6) {
                     // 金额
-                    cellValue = StringUtils.objToStr(bd.getfAmount());
+                    cellValue = allAmount.toString();
                 } else if (i == size - 5) {
                     // 计划员
-                    cellValue = StringUtils.objToStr(bd.getCreateBy());
+                    cellValue = StringUtils.objToStr(map.get("createBy"));
                 } else if (i == size - 4) {
                     // 计费时间
-                    cellValue = StringUtils.objToStr(bd.getfChargedate());
+                    cellValue = StringUtils.objToStr(map.get("fChargedate"));
                 } else if (i == size - 3) {
                     // 结费时间
-                    cellValue = StringUtils.objToStr(bd.getfStlamountdate());
+                    cellValue = StringUtils.objToStr(map.get("fStlamountdate"));
                 } else if (i == size - 2) {
                     // 仓库
-                    cellValue = StringUtils.objToStr(bd.getFhName());
+                    cellValue = StringUtils.objToStr(map.get("fhName"));
                 } else if (i == size - 1) {
                     // 备注
-                    cellValue = StringUtils.objToStr(bd.getRemark());
+                    cellValue = StringUtils.objToStr(map.get("remark"));
+                }
+                if (i <= 5 || i >= 9 && i <= 11 || i >= -5 && i <= -1) {
+                    temCell.setCellStyle(cellContentStyle);
+                    temCell.setCellValue(cellValue);
+                } else {
+                    // 将 excel 中的数字 String 转换成 原本类型
+                    switchExcelStringToOther(wb,cellValue,cellContentStyle,temCell);
                 }
-                temCell.setCellValue(cellValue);
-                temCell.setCellStyle(cellContentStyle);
-                setFont(cellContentStyle,wb,"宋体",12,false);
             }
+
+            feeMap.forEach((kev, value) -> {
+                //tempRow.getCell(kev).setCellValue(value);
+                // 对金额进行字符串转数字
+                switchExcelStringToOther(wb,value,cellContentStyle,tempRow.getCell(kev));
+            });
         }
 
         for (int i = 0; i < size; i++) {
             sheet.autoSizeColumn(i);
-            sheet.setColumnWidth(i,sheet.getColumnWidth(i)*17/10);
+            sheet.setColumnWidth(i, sheet.getColumnWidth(i) * 17 / 10);
         }
 
         // 导出 excel
@@ -359,14 +376,57 @@ public class TWarehousebillsfeesServiceImpl implements ITWarehousebillsfeesServi
     }
 
     /**
+     * 将 excel 表格中的金额型数字型字符串转换成原本类型
+     * @param wb 工作簿
+     * @param cellValue 值
+     * @param cellContentStyle 样式
+     * @param temCell cell
+     */
+    public void switchExcelStringToOther(HSSFWorkbook wb,String cellValue,HSSFCellStyle cellContentStyle,HSSFCell temCell){
+        // 数据是否是数值型
+        boolean isNum = false;
+        // 数据是否是整数
+        boolean isInteger = false;
+        // 是否为百分数
+        boolean isPercent = false;
+        if (cellValue != null) {
+            // 判断结果为数值型
+            isNum = cellValue.matches("^(-?\\d+)(\\.\\d+)?$");
+            // 判断结果是否为正数(小数部分是否为0)
+            isInteger = cellValue.matches("^[-\\+]?[\\d]*$");
+            // 判断结果是否为百分数
+            isPercent = cellValue.contains("%");
+        }
+        if (isNum && !isPercent) {
+            // 设置数据格式
+            HSSFDataFormat df = wb.createDataFormat();
+            if (isInteger) {
+                // 只显示整数
+                cellContentStyle.setDataFormat(df.getFormat("#0"));
+            } else {
+                // 小数
+                cellContentStyle.setDataFormat(df.getFormat("##0.00"));
+            }
+            // 单元格格式
+            temCell.setCellStyle(cellContentStyle);
+            // 设置单元格内容为 double
+            temCell.setCellValue(Double.parseDouble(cellValue));
+        } else {
+            temCell.setCellStyle(cellContentStyle);
+            temCell.setCellValue(cellValue);
+        }
+    }
+
+    /**
      * 封装大标题实现复用
-     * @param title 标题
-     * @param row 所在行
-     * @param sheet sheet
-     * @param cellStyle 样式
+     *
+     * @param title         标题
+     * @param row           所在行
+     * @param sheet         sheet
+     * @param cellStyle     样式
      * @param cellAddresses 合并行参数
      */
-    public void setBigTitle(String title,int row,HSSFSheet sheet,HSSFCellStyle cellStyle,CellRangeAddress cellAddresses){
+    public void setBigTitle(String title, int row, HSSFSheet sheet, HSSFCellStyle cellStyle, CellRangeAddress cellAddresses) {
         // 合并参数
         sheet.addMergedRegion(cellAddresses);
         // 大标题部分
@@ -378,13 +438,14 @@ public class TWarehousebillsfeesServiceImpl implements ITWarehousebillsfeesServi
 
     /**
      * 设置 excel 内内容字体
-     * @param style 传入的已设置的 excel 样式
+     *
+     * @param style    传入的已设置的 excel 样式
      * @param workbook 工作簿
      * @param fontName 字体名称,例如: "宋体"
      * @param fontSize 字体大小
-     * @param isBold 是否加粗,true:加粗,false:不加粗
+     * @param isBold   是否加粗,true:加粗,false:不加粗
      */
-    public void setFont(HSSFCellStyle style,HSSFWorkbook workbook,String fontName,int fontSize,boolean isBold){
+    public void setFont(HSSFCellStyle style, HSSFWorkbook workbook, String fontName, int fontSize, boolean isBold) {
         HSSFFont font = workbook.createFont();
         // 设置字体
         font.setFontName(fontName);
@@ -398,27 +459,29 @@ public class TWarehousebillsfeesServiceImpl implements ITWarehousebillsfeesServi
 
     /**
      * 获取并设置工作表 excel 样式
-     * @param workbook 工作簿
-     * @param position 位置参数:left-居左,right-居右,center-居中
+     *
+     * @param workbook  工作簿
+     * @param position  位置参数:left-居左,right-居右,center-居中
      * @param showFrame 是否显示边框,true:显示,false:不显示
      * @return 已设置的 excel 样式
      */
-    public HSSFCellStyle getCellStyle(HSSFWorkbook workbook,String position,boolean showFrame){
+    public HSSFCellStyle getCellStyle(HSSFWorkbook workbook, String position, boolean showFrame) {
         // 创建标题的显示样式
         HSSFCellStyle headerStyle = workbook.createCellStyle();
         // 设置水平垂直居中+上下左右边框+边框是否显示
-        setHeaderStyle(headerStyle,position,showFrame);
+        setHeaderStyle(headerStyle, position, showFrame);
         // 返回
         return headerStyle;
     }
 
     /**
      * 封装边框以及水平+垂直居中+边框是否显示
+     *
      * @param headerStyle 样式
-     * @param position 位置参数:left-居左,right-居右,center-居中
-     * @param showFrame 是否显示边框,true:显示,false:不显示
+     * @param position    位置参数:left-居左,right-居右,center-居中
+     * @param showFrame   是否显示边框,true:显示,false:不显示
      */
-    public void setHeaderStyle(HSSFCellStyle headerStyle,String position,boolean showFrame){
+    public void setHeaderStyle(HSSFCellStyle headerStyle, String position, boolean showFrame) {
         // 水平位置摆放
         switch (position) {
             case "left": // 居左

+ 12 - 3
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -757,7 +757,7 @@
             <if test="fId != null and fId!= ''">AND wf.f_pid = #{fId}</if>
     </select>
 
-    <select id="selectInventorySJRKList" parameterType="TWarehousebills" resultType="java.util.Map">
+    <select id="selectInventorySJRKList" parameterType="TWarehousebills" resultType="Map">
         SELECT
         co.f_name AS fName,
         leg.f_shipper AS fShipper,
@@ -772,6 +772,9 @@
         it.f_qty AS fQty,
         it.f_grossweight AS fGrossweight,
         it.f_netweight AS fNetweight,
+        it.f_driver_name AS fDriverName,
+        it.f_truckno AS fTruckno,
+        it.f_driver_id_car AS fDriverIdCar,
         CASE
         it.f_billtype
         WHEN 'SJRK' THEN
@@ -823,7 +826,7 @@
         ${params.dataScope}
     </select>
 
-    <select id="selectInventorySJCKList" parameterType="TWarehousebills"  resultType="java.util.Map">
+    <select id="selectInventorySJCKList" parameterType="TWarehousebills"  resultType="Map">
         SELECT
             co.f_name AS fName,
             leg.f_shipper AS fShipper,
@@ -837,6 +840,9 @@
             it.f_qty AS fQty,
             it.f_grossweight AS fGrossweight,
             it.f_netweight AS fNetweight,
+            it.f_driver_name AS fDriverName,
+            it.f_truckno AS fTruckno,
+            it.f_driver_id_car AS fDriverIdCar,
             CASE
             it.f_billtype
             WHEN 'SJRK' THEN
@@ -912,7 +918,10 @@
         dicttr.dict_label AS fTrademodeid,
         it.f_qty AS fQty,
         it.f_grossweight AS fGrossweight,
-        it.f_netweight AS fNetweight
+        it.f_netweight AS fNetweight,
+        it.f_driver_name AS fDrivername,
+        it.f_truckno AS fTruckno,
+        it.f_driver_id_car AS fDriverIdCar
         FROM
         t_warehousebills leg
         LEFT JOIN t_warehousebillsitems it ON leg.f_id = it.f_pid

+ 385 - 272
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

@@ -172,8 +172,8 @@
     <select id="selectTWarehousebillsfeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
         select f_id, f_pid, f_billing_deadline, src_bill_no
         from t_warehousebillsfees
-            where f_pid = #{fId}
-                and f_billtype = 'SJCK'
+        where f_pid = #{fId}
+          and f_billtype = 'SJCK'
     </select>
 
     <select id="selectWarehousebillsfeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
@@ -205,24 +205,25 @@
           AND f.f_billtype = 'FF'
     </select>
 
-    <select id="selectFleetExcelMonthList" parameterType="TWarehousebillsfees" resultType="com.ruoyi.finance.excel.FleetExcel">
+    <select id="selectFleetExcelMonthList" parameterType="TWarehousebillsfees"
+            resultType="com.ruoyi.finance.excel.FleetExcel">
         SELECT
-            CONCAT( MONTH ( s.f_bsdate ), '月份小计:' ) feelMonthName,
-            CONCAT(
-                YEAR ( s.f_bsdate ),
-                '-',
-            MONTH ( s.f_bsdate )) feelMonth,
-            sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
-            sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
-            sum( s.f_amount ) totalAmount,
-            sum( s.f_invamount ) invamount,
-            ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
+        CONCAT( MONTH ( s.f_bsdate ), '月份小计:' ) feelMonthName,
+        CONCAT(
+        YEAR ( s.f_bsdate ),
+        '-',
+        MONTH ( s.f_bsdate )) feelMonth,
+        sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
+        sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
+        sum( s.f_amount ) totalAmount,
+        sum( s.f_invamount ) invamount,
+        ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
         FROM
-            t_warehousebillsfees s
-            LEFT JOIN t_corps c ON s.f_corpid = c.f_id
-            LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
+        t_warehousebillsfees s
+        LEFT JOIN t_corps c ON s.f_corpid = c.f_id
+        LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
         WHERE
-            s.f_dc = 'D'
+        s.f_dc = 'D'
         <if test='fMonth != null and fMonth[0] != null and fMonth[0]!= ""'>
             and s.f_bsdate &gt;= #{fMonth[0]}
         </if>
@@ -230,40 +231,41 @@
             and s.f_bsdate &lt;= #{fMonth[1]}
         </if>
         GROUP BY
-            CONCAT(
-                YEAR ( f_bsdate ),
-            '-',
-            MONTH ( f_bsdate ))
+        CONCAT(
+        YEAR ( f_bsdate ),
+        '-',
+        MONTH ( f_bsdate ))
     </select>
 
-    <select id="selectFleetExcelList" parameterType="TWarehousebillsfees" resultType="com.ruoyi.finance.excel.FleetExcel">
+    <select id="selectFleetExcelList" parameterType="TWarehousebillsfees"
+            resultType="com.ruoyi.finance.excel.FleetExcel">
         SELECT
-            #{createBy} userName,
-            CONCAT(
-            YEAR ( s.f_bsdate ),
-            '-',
-            MONTH ( s.f_bsdate )) feelMonth,
-            c.f_name corpName,
-            sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
-            sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
-            sum( s.f_amount ) totalAmount,
-            IF
-            ( f_invamount = 0, 'F', 'T' ) isInvoice,
-            sum( s.f_invamount ) invamount,
-            ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
+        #{createBy} userName,
+        CONCAT(
+        YEAR ( s.f_bsdate ),
+        '-',
+        MONTH ( s.f_bsdate )) feelMonth,
+        c.f_name corpName,
+        sum( CASE WHEN s.f_feeid = 27 THEN s.f_amount ELSE 0 END ) ccf,
+        sum( CASE WHEN s.f_feeid != 27 THEN s.f_amount ELSE 0 END ) fAmount,
+        sum( s.f_amount ) totalAmount,
+        IF
+        ( f_invamount = 0, 'F', 'T' ) isInvoice,
+        sum( s.f_invamount ) invamount,
+        ROUND( sum( t.f_grossweightblc / 1000 ), 2 ) stock
         FROM
-            t_warehousebillsfees s
-            LEFT JOIN t_corps c ON s.f_corpid = c.f_id
-            LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
+        t_warehousebillsfees s
+        LEFT JOIN t_corps c ON s.f_corpid = c.f_id
+        LEFT JOIN t_whgenleg t ON t.f_corpid = s.f_corpid
         WHERE
-            s.f_dc = 'D'
+        s.f_dc = 'D'
         <if test='fMonth != null and fMonth[0] != null and fMonth[0]!= ""'>
             and s.f_bsdate &gt;= #{fMonth[0]}
         </if>
         <if test='fMonth != null and fMonth[1] != null and fMonth[1]!= ""'>
             and s.f_bsdate &lt;= #{fMonth[1]}
         </if>
-            GROUP BY CONCAT( YEAR ( f_bsdate ), '-', MONTH ( f_bsdate )), s.f_corpid, c.f_name
+        GROUP BY CONCAT( YEAR ( f_bsdate ), '-', MONTH ( f_bsdate )), s.f_corpid, c.f_name
     </select>
 
     <insert id="insertTWarehousebillsfees" parameterType="TWarehousebillsfees" useGeneratedKeys="true"
@@ -547,96 +549,107 @@
 
     <select id="selectFeesByPId" parameterType="Long" resultMap="TWarehousebillsfeesResult">
         SELECT
-            tw.f_id,
-            tw.f_pid,
-            tw.f_lineno,
-            tw.f_corpid,
-            tc.f_name corpName,
-            tw.f_feeid,
-            tf.f_name feeName,
-            tw.f_feeUnitid,
-            tw.f_qty,
-            tw.f_unitprice,
-            tw.f_amount,
-            tw.f_currency,
-            tw.f_exrate,
-            tw.f_taxrate,
-            tw.f_dc,
-            tw.f_billstatus,
-            CASE
-            WHEN tw.f_billstatus = '1' THEN
-            '新建'
-            WHEN tw.f_billstatus = '2' THEN
-            '暂存'
-            WHEN tw.f_billstatus = '3' THEN
-            '驳回'
-            WHEN tw.f_billstatus = '4' THEN
-            '提交'
-            WHEN tw.f_billstatus = '5' THEN
-            '审批中'
-            WHEN tw.f_billstatus = '6' THEN
-            '审批通过'
-            END AS fBillstatusName,
-            tw.f_review_date,
-            tw.f_statement_no,
-            tw.f_accamount,
-            tw.f_stlamount,
-            tw.f_accamount_date,
-            tw.f_invnos,
-            tw.f_invamount,
-            tw.f_stlamount_no,
-            tw.f_askamount,
-            tw.f_status,
-            tw.f_stlamount_date,
-            tw.del_flag,
-            tw.create_by,
-            tw.create_time,
-            tw.update_by,
-            tw.update_time,
-            tw.remark,
-            tw.src_id,
-            tw.src_bill_no,
-            tw.f_mblno,
-            tw.f_product_name,
-            tw.f_marks,
-            tw.price_date_remarks,
-            tw.f_chargedate,
-            tw.f_billing_deadline,
-            tw.f_inventory_days,
-            tw.f_amt,
-            tw.f_billing_days,
-            tw.f_billing_qty,
-            tw.f_billtype,
-            tw.f_billingway,
-            tw.f_bsdate,
-            tw.f_originalbilldate,
-            tw.f_stltypeid,
-            tw.f_business_type,
-            tw.f_src_type_id
+        tw.f_id,
+        tw.f_pid,
+        tw.f_lineno,
+        tw.f_corpid,
+        tc.f_name corpName,
+        tw.f_feeid,
+        tf.f_name feeName,
+        tw.f_feeUnitid,
+        tw.f_qty,
+        tw.f_unitprice,
+        tw.f_amount,
+        tw.f_currency,
+        tw.f_exrate,
+        tw.f_taxrate,
+        tw.f_dc,
+        tw.f_billstatus,
+        CASE
+        WHEN tw.f_billstatus = '1' THEN
+        '新建'
+        WHEN tw.f_billstatus = '2' THEN
+        '暂存'
+        WHEN tw.f_billstatus = '3' THEN
+        '驳回'
+        WHEN tw.f_billstatus = '4' THEN
+        '提交'
+        WHEN tw.f_billstatus = '5' THEN
+        '审批中'
+        WHEN tw.f_billstatus = '6' THEN
+        '审批通过'
+        END AS fBillstatusName,
+        tw.f_review_date,
+        tw.f_statement_no,
+        tw.f_accamount,
+        tw.f_stlamount,
+        tw.f_accamount_date,
+        tw.f_invnos,
+        tw.f_invamount,
+        tw.f_stlamount_no,
+        tw.f_askamount,
+        tw.f_status,
+        tw.f_stlamount_date,
+        tw.del_flag,
+        tw.create_by,
+        tw.create_time,
+        tw.update_by,
+        tw.update_time,
+        tw.remark,
+        tw.src_id,
+        tw.src_bill_no,
+        tw.f_mblno,
+        tw.f_product_name,
+        tw.f_marks,
+        tw.price_date_remarks,
+        tw.f_chargedate,
+        tw.f_billing_deadline,
+        tw.f_inventory_days,
+        tw.f_amt,
+        tw.f_billing_days,
+        tw.f_billing_qty,
+        tw.f_billtype,
+        tw.f_billingway,
+        tw.f_bsdate,
+        tw.f_originalbilldate,
+        tw.f_stltypeid,
+        tw.f_business_type,
+        tw.f_src_type_id
         FROM
-            t_warehousebillsfees tw
-            LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
-            LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
+        t_warehousebillsfees tw
+        LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
+        LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
         where tw.f_pid = #{fPid}
-            and tw.f_billtype = 'KHDD'
+        and tw.f_billtype = 'KHDD'
         <if test="fDc != null  and fDc != ''">and tw.f_dc = #{fDc}</if>
     </select>
 
     <select id="voyageFeeDetails" resultType="map">
         SELECT
-            tf.f_name feeName,
-            SUM(tw.f_unitprice) fUnitprice,
-            SUM(tw.f_amount) fAmount
+        tf.f_name feeName,
+        SUM(tw.f_unitprice) fUnitprice,
+        SUM(tw.f_amount) fAmount
         FROM
-            t_warehousebillsfees tw
-                LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
+        t_warehousebillsfees tw
+        LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
         WHERE
-            tw.f_pid = #{fPid}
-            AND tw.f_billtype = 'KHDD'
-            <if test="fDc != null and fDc != ''">AND tw.f_dc = #{fDc}</if>
+        tw.f_pid = #{fPid}
+        AND tw.f_billtype = 'KHDD'
+        <if test="fDc != null and fDc != ''">AND tw.f_dc = #{fDc}</if>
         GROUP BY feeName;
     </select>
 
+    <select id="selectSubItemsFeeDetails" resultType="map">
+        select tf.f_name feeName,
+        tw.f_unitprice fUnitprice,
+        tw.f_amount fAmount
+        from t_warehousebillsfees tw
+        LEFT JOIN t_fees tf on tw.f_feeid = tf.f_id
+        where
+        <if test="fPid != null and fPid != ''">tw.f_pid = #{fPid}</if>
+        <if test="fDc != null and fDc != ''">and tw.f_dc = #{fDc}</if>
+    </select>
+
     <delete id="deleteFessByFPid" parameterType="object">
         delete
         from t_warehousebillsfees
@@ -646,97 +659,104 @@
     <!--网页版查询对账-->
     <select id="webVersionReconciliation" parameterType="TAccount" resultType="map">
         SELECT
-            tb.f_billno AS fBillno,
-            /**运单号*/
-            tv.f_name AS vesselName,
-            /**船名*/
-            ty.f_no AS voyageName,
-            /**航次*/
-            tc.f_name AS invoice,
-            /**收费单位*/
-            tc.f_name AS drawee,
-            /**受票单位*/
-            tp.f_name AS corpName,
-            /**货权方*/
-            pro.dict_label AS fPaymode,
-            /**付款方式*/
-            te.f_name AS payment,
-            /**费用名称*/
-            ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmtdr,
-            /**原始金额*/
-            ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmt,
-            /**本次金额*/
-            ta.f_name AS fLoadportidName,
-            /**始发港*/
-            tr.f_name AS fDestportidName,
-            /**目的港*/
-            pr.dict_label AS fServiceitems,
-            /**运输条款*/
-            tg.f_name AS goodName,
-            /**货名*/
-            tn.f_name AS transit,
-            /**箱型*/
-            items.f_cntrcount AS fCntrcount,
-            /**箱量*/
-            tb.f_shippername AS fShippername,
-            /**发货人*/
-            tb.f_consigneername AS fConsigneername,
-            /**收货人*/
-            tf.f_id AS fSrcid,
-            tf.f_pid AS fSrcpid,
-            tf.create_by AS createBy,
-            tf.create_time AS createTime,
-            tf.update_by AS updateBy,
-            tf.update_time AS updateTime,
-            tf.remark AS remark,
-            tf.f_mblno AS fMblno,
-            tf.f_corpid AS fCorpid,
-            tf.f_feeid AS fFeeid
+        tb.f_billno AS fBillno,
+        /**运单号*/
+        tv.f_name AS vesselName,
+        /**船名*/
+        ty.f_no AS voyageName,
+        /**航次*/
+        tc.f_name AS invoice,
+        /**收费单位*/
+        tc.f_name AS drawee,
+        /**受票单位*/
+        tp.f_name AS corpName,
+        /**货权方*/
+        pro.dict_label AS fPaymode,
+        /**付款方式*/
+        te.f_name AS payment,
+        /**费用名称*/
+        ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmtdr,
+        /**原始金额*/
+        ifnull( tf.f_amount, 0 ) - ifnull( tf.f_accamount, 0 ) AS fAmt,
+        /**本次金额*/
+        ta.f_name AS fLoadportidName,
+        /**始发港*/
+        tr.f_name AS fDestportidName,
+        /**目的港*/
+        pr.dict_label AS fServiceitems,
+        /**运输条款*/
+        tg.f_name AS goodName,
+        /**货名*/
+        tn.f_name AS transit,
+        /**箱型*/
+        items.f_cntrcount AS fCntrcount,
+        /**箱量*/
+        tb.f_shippername AS fShippername,
+        /**发货人*/
+        tb.f_consigneername AS fConsigneername,
+        /**收货人*/
+        tf.f_id AS fSrcid,
+        tf.f_pid AS fSrcpid,
+        tf.create_by AS createBy,
+        tf.create_time AS createTime,
+        tf.update_by AS updateBy,
+        tf.update_time AS updateTime,
+        tf.remark AS remark,
+        tf.f_mblno AS fMblno,
+        tf.f_corpid AS fCorpid,
+        tf.f_feeid AS fFeeid
         FROM
-            t_warehousebillsfees tf
-            LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
-            LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
-            LEFT JOIN t_warehousebills tb ON tb.f_id = tf.f_pid
-            LEFT JOIN t_vessel tv ON tv.f_id = tb.f_vslid
-            LEFT JOIN t_voyage ty ON ty.f_id = tb.f_voyid
-            LEFT JOIN t_address ta ON ta.f_id = tb.f_loadportid
-            LEFT JOIN t_address tr ON tr.f_id = tb.f_destportid
-            LEFT JOIN sys_dict_data pro ON pro.dict_value = tb.f_paymode
-            AND pro.dict_type = 'data_settlement_type'
-            LEFT JOIN sys_dict_data pr ON pr.dict_value = tb.f_serviceitems
-            AND pr.dict_type = 'f_serviceitems'
-            LEFT JOIN ( SELECT f_pid, MAX( f_goodsid ) f_goodsid FROM t_warehousebills_cntr GROUP BY f_pid ) w ON w.f_pid = tb.f_id
-            LEFT JOIN t_goods tg ON tg.f_id = w.f_goodsid
-            LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items ON items.f_pid = tb.f_id
-            LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON twc.f_pid = tb.f_id
-            LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
-            LEFT JOIN t_corps tp ON tp.f_id = tb.f_corpid
+        t_warehousebillsfees tf
+        LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
+        LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
+        LEFT JOIN t_warehousebills tb ON tb.f_id = tf.f_pid
+        LEFT JOIN t_vessel tv ON tv.f_id = tb.f_vslid
+        LEFT JOIN t_voyage ty ON ty.f_id = tb.f_voyid
+        LEFT JOIN t_address ta ON ta.f_id = tb.f_loadportid
+        LEFT JOIN t_address tr ON tr.f_id = tb.f_destportid
+        LEFT JOIN sys_dict_data pro ON pro.dict_value = tb.f_paymode
+        AND pro.dict_type = 'data_settlement_type'
+        LEFT JOIN sys_dict_data pr ON pr.dict_value = tb.f_serviceitems
+        AND pr.dict_type = 'f_serviceitems'
+        LEFT JOIN ( SELECT f_pid, MAX( f_goodsid ) f_goodsid FROM t_warehousebills_cntr GROUP BY f_pid ) w ON w.f_pid =
+        tb.f_id
+        LEFT JOIN t_goods tg ON tg.f_id = w.f_goodsid
+        LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items
+        ON items.f_pid = tb.f_id
+        LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON
+        twc.f_pid = tb.f_id
+        LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
+        LEFT JOIN t_corps tp ON tp.f_id = tb.f_corpid
         WHERE
-            tf.f_billstatus = 6
-            AND tf.f_dc = 'D'
-            AND tb.f_typeid = 1
-            and tb.f_review_date IS NOT NULL
-            and ifnull(tf.f_amount, 0) - ifnull(tf.f_accamount, 0) > 0
-            <if test="fLoadportid != null">and tb.f_loadportid = #{fLoadportid}</if>
-            <if test="fDestportid != null">and tb.f_destportid = #{fDestportid}</if>
-            <if test="fInvoceobj != null  and fInvoceobj != ''">and tb.f_invoceobj like concat('%', #{fInvoceobj}, '%') </if>
-            <if test="fShippername != null  and fShippername != ''">and tb.f_shippername like concat('%', #{fShippername}, '%') </if>
-            <if test="fConsigneername != null  and fConsigneername != ''">and tb.f_consigneername like concat('%', #{fConsigneername}, '%') </if>
-            <if test="fMblno != null  and fMblno != ''">and tb.f_mblno like concat('%', #{fMblno}, '%')  </if>
-            <if test="fBillno != null  and fBillno != ''">and tb.f_billno like concat('%', #{fBillno}, '%')  </if>
-            <if test="fVslid != null">and tb.f_vslid = #{fVslid}</if>
-            <if test="fVoyid != null">and tb.f_voyid = #{fVoyid}</if>
-            <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
-            <if test="fPaymodeid != null">and tb.f_paymode = #{fPaymodeid}</if>
-            <if test='sailTime != null and sailTime[0] != null and sailTime[0]!= ""'>
-                and tf.create_time &gt;= #{sailTime[0]}
-            </if>
-            <if test='sailTime != null and sailTime[1] != null and sailTime[1]!= ""'>
-                and tf.create_time &lt;= #{sailTime[1]}
-            </if>
-            <if test="fDocmentdate != null  and fDocmentdate != ''">and tb.f_docmentdate = #{fDocmentdate}</if>
-            <if test="createBy != null  and createBy != ''">and tb.create_by = #{createBy}</if>
-            <if test="goodName != null  and goodName != ''">and tg.f_name like concat('%', #{goodName}, '%')</if>
+        tf.f_billstatus = 6
+        AND tf.f_dc = 'D'
+        AND tb.f_typeid = 1
+        and tb.f_review_date IS NOT NULL
+        and ifnull(tf.f_amount, 0) - ifnull(tf.f_accamount, 0) > 0
+        <if test="fLoadportid != null">and tb.f_loadportid = #{fLoadportid}</if>
+        <if test="fDestportid != null">and tb.f_destportid = #{fDestportid}</if>
+        <if test="fInvoceobj != null  and fInvoceobj != ''">and tb.f_invoceobj like concat('%', #{fInvoceobj}, '%')</if>
+        <if test="fShippername != null  and fShippername != ''">and tb.f_shippername like concat('%', #{fShippername},
+            '%')
+        </if>
+        <if test="fConsigneername != null  and fConsigneername != ''">and tb.f_consigneername like concat('%',
+            #{fConsigneername}, '%')
+        </if>
+        <if test="fMblno != null  and fMblno != ''">and tb.f_mblno like concat('%', #{fMblno}, '%')</if>
+        <if test="fBillno != null  and fBillno != ''">and tb.f_billno like concat('%', #{fBillno}, '%')</if>
+        <if test="fVslid != null">and tb.f_vslid = #{fVslid}</if>
+        <if test="fVoyid != null">and tb.f_voyid = #{fVoyid}</if>
+        <if test="fCorpid != null">and tf.f_corpid = #{fCorpid}</if>
+        <if test="fPaymodeid != null">and tb.f_paymode = #{fPaymodeid}</if>
+        <if test='sailTime != null and sailTime[0] != null and sailTime[0]!= ""'>
+            and tf.create_time &gt;= #{sailTime[0]}
+        </if>
+        <if test='sailTime != null and sailTime[1] != null and sailTime[1]!= ""'>
+            and tf.create_time &lt;= #{sailTime[1]}
+        </if>
+        <if test="fDocmentdate != null  and fDocmentdate != ''">and tb.f_docmentdate = #{fDocmentdate}</if>
+        <if test="createBy != null  and createBy != ''">and tb.create_by = #{createBy}</if>
+        <if test="goodName != null  and goodName != ''">and tg.f_name like concat('%', #{goodName}, '%')</if>
         ORDER BY tf.f_id desc
     </select>
     <!--网页版查询对账明细-->
@@ -800,17 +820,23 @@
         LEFT JOIN sys_dict_data pr ON pr.dict_value = tw.f_serviceitems
         AND pr.dict_type = 'f_serviceitems'
         LEFT JOIN t_fees ts ON ts.f_id = tf.f_feeid
-        LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items ON items.f_pid = tw.f_id
-        LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON twc.f_pid = tw.f_id
+        LEFT JOIN ( SELECT f_pid, SUM( f_cntrcount ) f_cntrcount FROM t_warehousebills_cntritems GROUP BY f_pid ) items
+        ON items.f_pid = tw.f_id
+        LEFT JOIN ( SELECT f_pid, MAX( f_cntrid ) f_cntrid FROM t_warehousebills_cntritems GROUP BY f_pid ) twc ON
+        twc.f_pid = tw.f_id
         LEFT JOIN t_cntr tn ON tn.f_id = twc.f_cntrid
         LEFT JOIN t_corps tp ON tp.f_id = te.f_corpid
         WHERE
         te.f_billtype = 'KHDZ'
         <if test="fLoadportid != null">and tw.f_loadportid = #{fLoadportid}</if>
         <if test="fDestportid != null">and tw.f_destportid = #{fDestportid}</if>
-        <if test="fInvoceobj != null  and fInvoceobj != ''">and tw.f_invoceobj like concat('%', #{fInvoceobj}, '%') </if>
-        <if test="fShippername != null  and fShippername != ''">and tw.f_shippername like concat('%', #{fShippername}, '%') </if>
-        <if test="fConsigneername != null  and fConsigneername != ''">and tw.f_consigneername like concat('%', #{fConsigneername}, '%') </if>
+        <if test="fInvoceobj != null  and fInvoceobj != ''">and tw.f_invoceobj like concat('%', #{fInvoceobj}, '%')</if>
+        <if test="fShippername != null  and fShippername != ''">and tw.f_shippername like concat('%', #{fShippername},
+            '%')
+        </if>
+        <if test="fConsigneername != null  and fConsigneername != ''">and tw.f_consigneername like concat('%',
+            #{fConsigneername}, '%')
+        </if>
         <if test="fMblno != null  and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
         <if test="fVslid != null">and tw.f_vslid = #{fVslid}</if>
         <if test="fId != null">and tf.f_id = #{fId}</if>
@@ -830,25 +856,45 @@
     </select>
     <select id="selectTWarehousebillsfeesSrcId" parameterType="Long" resultType="long">
         select src_id
-        FROM
-            t_warehousebillsfees
+        FROM t_warehousebillsfees
         where f_pid = #{fId}
           AND src_id IS NOT NULL
     </select>
     <select id="accountsDue" resultType="map">
-        SELECT
-             CASE MONTH(tf.create_time) WHEN '1' THEN SUM(tf.f_amount) ELSE 0 END AS January,
-             CASE MONTH(tf.create_time) WHEN '2' THEN SUM(tf.f_amount) ELSE 0 END AS February,
-             CASE MONTH(tf.create_time) WHEN '3' THEN SUM(tf.f_amount) ELSE 0 END AS March,
-             CASE MONTH(tf.create_time) WHEN '4' THEN SUM(tf.f_amount) ELSE 0 END AS April,
-             CASE MONTH(tf.create_time) WHEN '5' THEN SUM(tf.f_amount) ELSE 0 END AS May,
-             CASE MONTH(tf.create_time) WHEN '6' THEN SUM(tf.f_amount) ELSE 0 END AS June,
-             CASE MONTH(tf.create_time) WHEN '7' THEN SUM(tf.f_amount) ELSE 0 END AS July,
-             CASE MONTH(tf.create_time) WHEN '8' THEN SUM(tf.f_amount) ELSE 0 END AS August,
-             CASE MONTH(tf.create_time) WHEN '9' THEN SUM(tf.f_amount) ELSE 0 END AS September,
-             CASE MONTH(tf.create_time) WHEN '10' THEN SUM(tf.f_amount) ELSE 0 END AS October,
-             CASE MONTH(tf.create_time) WHEN '11' THEN SUM(tf.f_amount) ELSE 0 END AS November,
-             CASE MONTH(tf.create_time) WHEN '12' THEN SUM(tf.f_amount) ELSE 0 END AS December,
+        SELECT CASE MONTH (tf.create_time) WHEN '1' THEN SUM(tf.f_amount) ELSE 0 END AS January,
+             CASE MONTH(tf.create_time) WHEN '2' THEN SUM(tf.f_amount) ELSE 0
+        END
+        AS February,
+             CASE MONTH(tf.create_time) WHEN '3' THEN SUM(tf.f_amount) ELSE 0
+        END
+        AS March,
+             CASE MONTH(tf.create_time) WHEN '4' THEN SUM(tf.f_amount) ELSE 0
+        END
+        AS April,
+             CASE MONTH(tf.create_time) WHEN '5' THEN SUM(tf.f_amount) ELSE 0
+        END
+        AS May,
+             CASE MONTH(tf.create_time) WHEN '6' THEN SUM(tf.f_amount) ELSE 0
+        END
+        AS June,
+             CASE MONTH(tf.create_time) WHEN '7' THEN SUM(tf.f_amount) ELSE 0
+        END
+        AS July,
+             CASE MONTH(tf.create_time) WHEN '8' THEN SUM(tf.f_amount) ELSE 0
+        END
+        AS August,
+             CASE MONTH(tf.create_time) WHEN '9' THEN SUM(tf.f_amount) ELSE 0
+        END
+        AS September,
+             CASE MONTH(tf.create_time) WHEN '10' THEN SUM(tf.f_amount) ELSE 0
+        END
+        AS October,
+             CASE MONTH(tf.create_time) WHEN '11' THEN SUM(tf.f_amount) ELSE 0
+        END
+        AS November,
+             CASE MONTH(tf.create_time) WHEN '12' THEN SUM(tf.f_amount) ELSE 0
+        END
+        AS December,
              tc.f_name corpName
         FROM
             t_warehousebillsfees tf
@@ -860,39 +906,40 @@
             LIMIT 10
     </select>
 
-    <select id="selectQueryMenuList" parameterType="TWarehousebillsfees" resultType="com.ruoyi.warehouseBusiness.excel.QueryMenu">
+    <select id="selectQueryMenuList" parameterType="TWarehousebillsfees"
+            resultType="com.ruoyi.warehouseBusiness.excel.QueryMenu">
         SELECT
-            tc.f_name AS corpName,
-            tf.f_mblno AS fMblno,
-            tf.f_bsdate AS fBsdate,
-            tf.f_review_date AS fReviewDate,
-            te.f_name AS feeName,
-            tf.f_dc AS fDc,
-            tf.f_amount AS fAmount,
-            tf.f_stlamount_no AS fStlamountNo,
-            tw.f_shipper AS fShipper,
-            tf.f_stlamount AS fStlamount,
-            tf.f_stlamount_date AS fStlamountDate,
-            tf.f_invamount AS fInvamount,
-            tf.f_invnos AS fInvnos,
-            tf.f_accamount AS fAccamount,
-            tf.f_accamount_date AS fAccamountDate,
-            tf.f_statement_no AS fStatementNo,
-            tf.f_feeUnitid AS fFeeUnitid,
-            tf.f_qty AS fQty,
-            tf.f_unitprice AS fUnitprice,
-            tf.f_billtype AS fBilltype,
-            tf.f_product_name AS fProductName,
-            tf.f_stltypeid AS fStltypeid,
-            tf.remark AS remark,
-            CASE
-                WHEN tf.f_billstatus = '1' THEN '录入'
-                WHEN tf.f_billstatus = '2' THEN '暂存'
-                WHEN tf.f_billstatus = '3' THEN '审批驳回'
-                WHEN tf.f_billstatus = '4' THEN '提交审核'
-                WHEN tf.f_billstatus = '5' THEN '审核中'
-                WHEN tf.f_billstatus = '6' THEN '审核通过'
-            END AS fBillstatusName
+        tc.f_name AS corpName,
+        tf.f_mblno AS fMblno,
+        tf.f_bsdate AS fBsdate,
+        tf.f_review_date AS fReviewDate,
+        te.f_name AS feeName,
+        tf.f_dc AS fDc,
+        tf.f_amount AS fAmount,
+        tf.f_stlamount_no AS fStlamountNo,
+        tw.f_shipper AS fShipper,
+        tf.f_stlamount AS fStlamount,
+        tf.f_stlamount_date AS fStlamountDate,
+        tf.f_invamount AS fInvamount,
+        tf.f_invnos AS fInvnos,
+        tf.f_accamount AS fAccamount,
+        tf.f_accamount_date AS fAccamountDate,
+        tf.f_statement_no AS fStatementNo,
+        tf.f_feeUnitid AS fFeeUnitid,
+        tf.f_qty AS fQty,
+        tf.f_unitprice AS fUnitprice,
+        tf.f_billtype AS fBilltype,
+        tf.f_product_name AS fProductName,
+        tf.f_stltypeid AS fStltypeid,
+        tf.remark AS remark,
+        CASE
+        WHEN tf.f_billstatus = '1' THEN '录入'
+        WHEN tf.f_billstatus = '2' THEN '暂存'
+        WHEN tf.f_billstatus = '3' THEN '审批驳回'
+        WHEN tf.f_billstatus = '4' THEN '提交审核'
+        WHEN tf.f_billstatus = '5' THEN '审核中'
+        WHEN tf.f_billstatus = '6' THEN '审核通过'
+        END AS fBillstatusName
         FROM t_warehousebillsfees tf
         LEFT JOIN t_corps tc ON tc.f_id = tf.f_corpid
         LEFT JOIN t_fees te ON te.f_id = tf.f_feeid
@@ -903,7 +950,9 @@
             <if test="fMblno != null  and fMblno != ''">and tf.f_mblno like concat('%', #{fMblno}, '%')</if>
             <if test="fStalmountStatus == 1">and tf.f_stlamount_no is not null and tf.f_stlamount!=0</if>
             <if test="fStalmountStatus == 2">and tf.f_stlamount_no is null</if>
-            <if test="feesStatus == 1">and tf.f_statement_no is not null and tf.f_accamount &gt;= 0 and tf.f_accamount != 0</if>
+            <if test="feesStatus == 1">and tf.f_statement_no is not null and tf.f_accamount &gt;= 0 and tf.f_accamount
+                != 0
+            </if>
             <if test="feesStatus == 2">and tf.f_statement_no is null</if>
             <if test="fInvnosStatus == 1">and tf.f_invnos is not null and tf.f_invamount != 0</if>
             <if test="fInvnosStatus == 2">and tf.f_invnos is null</if>
@@ -932,26 +981,29 @@
         ORDER BY tf.f_bsdate desc
     </select>
 
-    <select id="selectBillDetailsSubItem" resultType="com.ruoyi.warehouseBusiness.excel.BillDetailsSubItem">
+    <select id="selectBillDetailsSubItemNew" parameterType="TWarehousebillsfees" resultType="map">
         select
+        twf.f_pid as fId,
+        twf.f_mblno as fMblno,
+        dict.dict_label as fBusinesstype,
         CASE
-        WHEN tw.f_billtype = 'SJRK' THEN '入库'
-        WHEN tw.f_billtype = 'SJCK' THEN '实际出库'
-        WHEN tw.f_billtype = 'CKDB' THEN '调拨'
-        WHEN tw.f_billtype = 'HQZY' THEN '货权转移'
-        WHEN tw.f_billtype = 'CDZZ' THEN '场地直装'
+        WHEN twf.f_billtype = 'SJRK' THEN '入库'
+        WHEN twf.f_billtype = 'SJCK' THEN '实际出库'
+        WHEN twf.f_billtype = 'CKDB' THEN '调拨'
+        WHEN twf.f_billtype = 'HQZY' THEN '货权转移'
+        WHEN twf.f_billtype = 'CDZZ' THEN '场地直装'
         END as fBilltype,
-        twl.f_business_type as twlfBusinesstype,
         twf.f_corpid as fCorpid,
         twf.f_statement_no as fStatementno,
-        tg.f_name as tgfName,
+        twf.f_product_name as tgfName,
         tc.f_name as tcfName,
         twf.f_qty as fQty,
-        twb.f_netweight as fNetweight,
-        twb.f_volumn as fVolumn,
+        tw.f_netweight as fNetweight,
+        tw.f_volumn as fVolumn,
         date_format(twf.f_originalbilldate, '%Y-%m-%d') fOriginalbilldate,
         date_format(twf.f_bsdate, '%Y-%m-%d') fBsdate,
         twf.f_billing_days as fBillingdays,
+        twf.f_amt as fAmt,
         twf.f_amount as fAmount,
         twf.create_by as createBy,
         date_format(twf.f_chargedate, '%Y-%m-%d') fChargedate,
@@ -960,13 +1012,74 @@
         twf.remark as remark
         from t_warehousebillsfees twf
         LEFT JOIN t_warehousebills tw on twf.f_pid = tw.f_id
-        LEFT JOIN t_warehousebillsitems twb on twb.f_pid = twf.f_id
-        LEFT JOIN t_warehousebillsfees_logger twl on twl.f_pid = twf.f_id
         LEFT JOIN t_goods tg on tw.f_goodsid = tg.f_id
         LEFT JOIN t_corps tc on twf.f_corpid = tc.f_id
         LEFT JOIN t_warehouse th on tw.f_warehouseid = th.f_id
+        LEFT JOIN (
+        SELECT
+        *
+        FROM
+        sys_dict_data dictIn
+        WHERE
+        dictIn.dict_label =
+            IF((
+            (dictIn.dict_type = 'st_in_type' AND dictIn.`status` = '0') OR
+            (dictIn.dict_type = 'st_out_type'AND dictIn.status = '0') OR
+            (dictIn.dict_type = 'st_trans_type' AND dictIn.status = '0')
+            ),dictIn.dict_label,NULL)
+        ) dict ON dict.dict_value = twf.f_business_type
         <where>
             <if test="fCorpid != null  and fCorpid != ''">and twf.f_corpid = #{fCorpid}</if>
+            <if test="fMblno != null  and fMblno != ''">and twf.f_mblno like concat('%', #{fMblno}, '%')</if>
+            <if test='fBsdateList != null and fBsdateList[0] != null and fBsdateList[0]!= ""'>
+                and twf.f_bsdate &gt;= #{fBsdateList[0]}
+            </if>
+            <if test='fBsdateList != null and fBsdateList[1] != null and fBsdateList[1]!= ""'>
+                and twf.f_bsdate &lt;= #{fBsdateList[1]}
+            </if>
+            <if test='fReviewDateList != null and fReviewDateList[0] != null and fReviewDateList[0]!= ""'>
+                and twf.f_review_date &gt;= #{fReviewDateList[0]}
+            </if>
+            <if test='fReviewDateList != null and fReviewDateList[1] != null and fReviewDateList[1]!= ""'>
+                and twf.f_review_date &lt;= #{fReviewDateList[1]}
+            </if>
+            <if test="fStalmountStatus == 1">and twf.f_stlamount_no is not null and twf.f_stlamount!=0</if>
+            <if test="fStalmountStatus == 2">and twf.f_stlamount_no is null</if>
+            <if test="feesStatus == 1">and twf.f_statement_no is not null and twf.f_accamount &gt;= 0 and
+                twf.f_accamount != 0
+            </if>
+            <if test="feesStatus == 2">and twf.f_statement_no is null</if>
+            <if test="fInvnosStatus == 1">and twf.f_invnos is not null and twf.f_invamount != 0</if>
+            <if test="fInvnosStatus == 2">and twf.f_invnos is null</if>
+            <if test="fDc != null  and fDc != ''">and twf.f_dc = #{fDc}</if>
+            <if test='fFeeids != null'>
+                and twf.f_feeid in
+                <foreach item="fFeeid" collection="fFeeids" open="(" separator="," close=")">
+                    #{fFeeid}
+                </foreach>
+            </if>
+            <if test="fBillstatus != null  and fBillstatus != ''">and twf.f_billstatus = #{fBillstatus}</if>
+            <if test="fShipper != null  and fShipper != ''">and tw.f_shipper like concat('%',#{fShipper},'%')</if>
         </where>
+        GROUP BY
+        twf.f_mblno,tc.f_name
+        ORDER BY twf.f_bsdate desc
+    </select>
+
+    <select id="selectFeesBymblnoAndFname" resultType="map">
+        SELECT
+            tf.f_name as feeName,
+            SUM(twf.f_unitprice) as fUnitprice,
+            SUM(twf.f_amount) as fAmount
+        FROM
+            t_fees tf
+                LEFT JOIN t_warehousebillsfees twf on tf.f_id = twf.f_feeid
+                LEFT JOIN t_corps tc on twf.f_corpid = tc.f_id
+        <where>
+            <if test="fMblno != null  and fMblno != ''">and twf.f_mblno = #{fMblno}</if>
+            <if test="fName != null  and fName != ''">and tc.f_name = #{fName}</if>
+        </where>
+        GROUP BY
+            feeName
     </select>
 </mapper>