Browse Source

凯和公司端加导出清单功能

lazhaoqian 4 years ago
parent
commit
3aeb4c39c3

+ 25 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/shipping/controller/KHUpdateOrderMessage.java

@@ -6,18 +6,24 @@ package com.ruoyi.web.controller.shipping.controller;
  * @Version 1.0
  */
 
+import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.ServletUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.utils.spring.SpringUtils;
 import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.shipping.domain.TAddress;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
  * 凯和修改订单信息
  */
@@ -56,6 +62,25 @@ public class KHUpdateOrderMessage {
 
     }
 
+    /**
+     * 凯和导出清单
+     * 船名,航次必填
+     * @param tWarehouseBills
+     * @return
+     */
+    @Log(title = "凯和导出清单", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult exportInventory(TWarehouseBills tWarehouseBills)
+    {
+        if (tWarehouseBills.getfVoyid() == null){
+            return AjaxResult.error("航次不能为空");
+        }
+        if (tWarehouseBills.getfVslid() == null){
+            return AjaxResult.error("船名不能为空");
+        }
+        return tWarehousebillsService.exportInventory(tWarehouseBills);
+    }
+
 }
 
 

+ 109 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtils.java

@@ -0,0 +1,109 @@
+package com.ruoyi.common.utils.poi;
+
+import org.apache.poi.hssf.usermodel.HSSFCellStyle;
+import org.apache.poi.hssf.usermodel.HSSFFont;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.*;
+
+/**
+ * @Author ZhaoQian La
+ * @Date 2021/7/8 17:12
+ * @Version 1.0
+ */
+public class ExcelUtils {
+    /**
+     * 创建标题样式
+     * @param wb
+     * @return
+     */
+    public static HSSFCellStyle createTitleCellStyle(HSSFWorkbook wb){
+        HSSFCellStyle cellStyle = wb.createCellStyle();
+        //水平居中
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+        //垂直对齐
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        //背景颜色
+        //cellStyle.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex());
+
+        HSSFFont headerFont1 = (HSSFFont) wb.createFont();
+        //字体加粗
+        headerFont1.setBold(true);
+        //字体类型
+        headerFont1.setFontName("黑体");
+        //字体大小
+        headerFont1.setFontHeightInPoints((short)15);
+        cellStyle.setFont(headerFont1);
+        return cellStyle;
+    }
+
+    /**
+     * 创建表头样式
+     * @param wb
+     * @return
+     */
+    public static HSSFCellStyle createHeadCellStyle(HSSFWorkbook wb){
+        HSSFCellStyle cellStyle = wb.createCellStyle();
+        //设置自动换行
+        cellStyle.setWrapText(false);
+        //设置背景颜色
+        //cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
+        //水平居中
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+        //垂直对齐
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        cellStyle.setBottomBorderColor(IndexedColors.BLACK.index);
+        //下边框
+        cellStyle.setBorderBottom(BorderStyle.THIN);
+        //左边框
+        cellStyle.setBorderLeft(BorderStyle.THIN);
+        //右边框
+        cellStyle.setBorderRight(BorderStyle.THIN);
+        //上边框
+        cellStyle.setBorderTop(BorderStyle.THIN);
+
+        //创建字体样式
+        HSSFFont headerFont = (HSSFFont)wb.createFont();
+        //字体加粗
+        headerFont.setBold(true);
+        //字体类型
+        headerFont.setFontName("黑体");
+        //字体大小
+        headerFont.setFontHeightInPoints((short)12);
+        //为标题样式添加字体样式
+        cellStyle.setFont(headerFont);
+
+        return cellStyle;
+    }
+
+    /**
+     *  设置表格内容样式
+     * @param wb
+     * @return
+     */
+    public static HSSFCellStyle createContentCellStyle(HSSFWorkbook wb){
+        HSSFCellStyle cellStyle = wb.createCellStyle();
+        //水平居中
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+        //垂直居中
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+        //设置自动换行
+        cellStyle.setWrapText(true);
+        //上边框
+        cellStyle.setBorderTop(BorderStyle.THIN);
+        //下边框
+        cellStyle.setBorderBottom(BorderStyle.THIN);
+        //左边框
+        cellStyle.setBorderLeft(BorderStyle.THIN);
+        //右边框
+        cellStyle.setBorderRight(BorderStyle.THIN);
+
+        //设置字体
+        HSSFFont font = (HSSFFont)wb.createFont();
+        font.setColor((short)8);
+        font.setFontHeightInPoints((short)12);
+
+        return cellStyle;
+    }
+}

+ 230 - 0
ruoyi-shipping/src/main/java/com/ruoyi/shipping/excel/deriveInventoryExcel.java

@@ -0,0 +1,230 @@
+package com.ruoyi.shipping.excel;
+
+/**
+ * @Author ZhaoQian La
+ * @Date 2021/7/9 14:25
+ * @Version 1.0
+ */
+
+import java.math.BigDecimal;
+
+/**
+ * 凯和导出清单Excel
+ */
+public class deriveInventoryExcel {
+    private static final long serialVersionUID = 1L;
+    /**
+     * 序号
+     */
+    private Long rankNo;
+    /**
+     * 提单号
+     */
+    private String fMblno;
+    /**
+     * 箱号
+     */
+    private String fCntrno;
+    /**
+     * 铅封号
+     */
+    private String fSealno;
+    /**
+     * 尺寸
+     */
+    private String measure;
+    /**
+     * 类型
+     */
+    private String genre;
+    /**
+     * 重量
+     */
+    private BigDecimal fCntrweight;
+    /**
+     * 箱公司
+     */
+    private String boxCompany;
+    /**
+     * 始发港
+     */
+    private String portOfDeparture;
+    /**
+     * 目的港
+     */
+    private String destinationPort;
+    /**
+     * 货名
+     */
+    private String goodName;
+    /**
+     * 运输条款
+     */
+    private String transitClause;
+    /**
+     * 订舱公司
+     */
+    private String bookingCompany;
+    /**
+     * 收货公司名称
+     */
+    private String fConsigneername;
+    /**
+     * 收货公司地址
+     */
+    private String fConsigneeattn;
+    /**
+     * 收货公司电话
+     */
+    private String fConsigneetel;
+
+    public Long getRankNo() {
+        return rankNo;
+    }
+
+    public void setRankNo(Long rankNo) {
+        this.rankNo = rankNo;
+    }
+
+    public String getfMblno() {
+        return fMblno;
+    }
+
+    public void setfMblno(String fMblno) {
+        this.fMblno = fMblno;
+    }
+
+    public String getfCntrno() {
+        return fCntrno;
+    }
+
+    public void setfCntrno(String fCntrno) {
+        this.fCntrno = fCntrno;
+    }
+
+    public String getfSealno() {
+        return fSealno;
+    }
+
+    public void setfSealno(String fSealno) {
+        this.fSealno = fSealno;
+    }
+
+    public String getMeasure() {
+        return measure;
+    }
+
+    public void setMeasure(String measure) {
+        this.measure = measure;
+    }
+
+    public String getGenre() {
+        return genre;
+    }
+
+    public void setGenre(String genre) {
+        this.genre = genre;
+    }
+
+    public BigDecimal getfCntrweight() {
+        return fCntrweight;
+    }
+
+    public void setfCntrweight(BigDecimal fCntrweight) {
+        this.fCntrweight = fCntrweight;
+    }
+
+    public String getBoxCompany() {
+        return boxCompany;
+    }
+
+    public void setBoxCompany(String boxCompany) {
+        this.boxCompany = boxCompany;
+    }
+
+    public String getPortOfDeparture() {
+        return portOfDeparture;
+    }
+
+    public void setPortOfDeparture(String portOfDeparture) {
+        this.portOfDeparture = portOfDeparture;
+    }
+
+    public String getDestinationPort() {
+        return destinationPort;
+    }
+
+    public void setDestinationPort(String destinationPort) {
+        this.destinationPort = destinationPort;
+    }
+
+    public String getGoodName() {
+        return goodName;
+    }
+
+    public void setGoodName(String goodName) {
+        this.goodName = goodName;
+    }
+
+    public String getTransitClause() {
+        return transitClause;
+    }
+
+    public void setTransitClause(String transitClause) {
+        this.transitClause = transitClause;
+    }
+
+    public String getBookingCompany() {
+        return bookingCompany;
+    }
+
+    public void setBookingCompany(String bookingCompany) {
+        this.bookingCompany = bookingCompany;
+    }
+
+    public String getfConsigneername() {
+        return fConsigneername;
+    }
+
+    public void setfConsigneername(String fConsigneername) {
+        this.fConsigneername = fConsigneername;
+    }
+
+    public String getfConsigneeattn() {
+        return fConsigneeattn;
+    }
+
+    public void setfConsigneeattn(String fConsigneeattn) {
+        this.fConsigneeattn = fConsigneeattn;
+    }
+
+    public String getfConsigneetel() {
+        return fConsigneetel;
+    }
+
+    public void setfConsigneetel(String fConsigneetel) {
+        this.fConsigneetel = fConsigneetel;
+    }
+
+    @Override
+    public String toString() {
+        return "deriveInventoryExcel{" +
+                "rankNo=" + rankNo +
+                ", fMblno='" + fMblno + '\'' +
+                ", fCntrno='" + fCntrno + '\'' +
+                ", fSealno='" + fSealno + '\'' +
+                ", measure='" + measure + '\'' +
+                ", genre='" + genre + '\'' +
+                ", fCntrweight='" + fCntrweight + '\'' +
+                ", boxCompany='" + boxCompany + '\'' +
+                ", portOfDeparture='" + portOfDeparture + '\'' +
+                ", destinationPort='" + destinationPort + '\'' +
+                ", goodName='" + goodName + '\'' +
+                ", transitClause='" + transitClause + '\'' +
+                ", bookingCompany='" + bookingCompany + '\'' +
+                ", fConsigneername='" + fConsigneername + '\'' +
+                ", fConsigneeattn='" + fConsigneeattn + '\'' +
+                ", fConsigneetel='" + fConsigneetel + '\'' +
+                '}';
+    }
+}

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

@@ -8,6 +8,7 @@ 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.shipping.excel.deriveInventoryExcel;
 import com.ruoyi.warehouseBusiness.domain.TWareHouseExcelItems;
 import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import org.apache.ibatis.annotations.Param;
@@ -194,4 +195,11 @@ public interface TWarehouseBillsMapper extends BaseMapper<TWarehouseBills> {
      * @return
      */
     public List<SingleAnalysisFeesExcel> selectSingleAnalysisFees(SingleAnalysisExcel singleAnalysisExcel);
+
+    /**
+     * 凯和根据船名航次导出清单
+     * @param tWarehouseBills
+     * @return
+     */
+    public List<deriveInventoryExcel> deriveInventory(TWarehouseBills tWarehouseBills);
 }

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

@@ -513,4 +513,11 @@ public interface ITWarehouseBillsService {
      * @return
      */
     public AjaxResult copyKhOrderMessage(Long fId);
+
+    /**
+     * 导出清单
+     * @param tWarehouseBills
+     * @return
+     */
+    public AjaxResult exportInventory(TWarehouseBills tWarehouseBills);
 }

+ 172 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -14,6 +14,7 @@ import com.ruoyi.basicData.domain.TGoods;
 import com.ruoyi.basicData.domain.TWarehouseArea;
 import com.ruoyi.basicData.mapper.*;
 import com.ruoyi.basicData.service.impl.TWarehouseServiceImpl;
+import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.entity.*;
 import com.ruoyi.common.core.domain.model.LoginUser;
@@ -21,6 +22,7 @@ import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.ip.AddressUtils;
+import com.ruoyi.common.utils.poi.ExcelUtils;
 import com.ruoyi.quotation.domain.TSeaprice;
 import com.ruoyi.quotation.mapper.TSeapriceMapper;
 import com.ruoyi.reportManagement.domain.TWareHouseItemsExcel;
@@ -28,6 +30,7 @@ import com.ruoyi.reportManagement.domain.TWhgenleg;
 import com.ruoyi.reportManagement.mapper.TWhgenlegMapper;
 import com.ruoyi.shipping.domain.*;
 import com.ruoyi.shipping.excel.TWarehousebillsCntritemsExcel;
+import com.ruoyi.shipping.excel.deriveInventoryExcel;
 import com.ruoyi.shipping.mapper.*;
 import com.ruoyi.system.domain.SysCheckCode;
 import com.ruoyi.system.domain.SysConfig;
@@ -37,7 +40,9 @@ import com.ruoyi.warehouseBusiness.excel.*;
 import com.ruoyi.warehouseBusiness.mapper.*;
 import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
 import jdk.jfr.events.ExceptionThrownEvent;
+import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellReference;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.slf4j.Logger;
@@ -49,8 +54,9 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.io.IOException;
-import java.io.InputStream;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+import java.io.*;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -162,6 +168,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     private TWarehousebillsCntritemsLoggerMapper tWarehousebillsCntritemsLoggerMapper;
     @Autowired
     private TWarehousebillsfeesLoggerMapper tWarehousebillsfeesLoggerMapper;
+    @Autowired
+    private TVesselMapper tVesselMapper;
     private static final Logger log = LoggerFactory.getLogger(AddressUtils.class);
 
 
@@ -5002,6 +5010,168 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         }
     }
 
+    @Override
+    public AjaxResult exportInventory(TWarehouseBills tWarehouseBills) {
+        //获取船名
+        TVessel tVessel = tVesselMapper.selectTVesselById(tWarehouseBills.getfVslid());
+        //获取航次
+        TVoyage tVoyage = tVoyageMapper.selectTVoyageById(tWarehouseBills.getfVoyid());
+        //1.创建一个workbook,对应一个excel文件
+        HSSFWorkbook wb = new HSSFWorkbook();
+
+        //2.在workbook中添加一个sheet,对应Excel中的sheet
+        HSSFSheet sheet = wb.createSheet("清单");
+
+        //设置每一列的列宽
+        sheet.setColumnWidth(0,256*15);
+        sheet.setColumnWidth(1,256*20);
+        sheet.setColumnWidth(2,256*20);
+        sheet.setColumnWidth(3,256*20);
+        sheet.setColumnWidth(4,256*15);
+        sheet.setColumnWidth(5,256*15);
+        sheet.setColumnWidth(6,256*15);
+        sheet.setColumnWidth(7,256*15);
+        sheet.setColumnWidth(8,256*15);
+        sheet.setColumnWidth(9,256*15);
+        sheet.setColumnWidth(10,256*15);
+        sheet.setColumnWidth(11,256*20);
+        sheet.setColumnWidth(12,256*35);
+        sheet.setColumnWidth(13,256*35);
+        sheet.setColumnWidth(14,256*25);
+        sheet.setColumnWidth(15,256*25);
+
+        //3.设置样式以及字体样式
+        HSSFCellStyle titleStyle = ExcelUtils.createTitleCellStyle(wb);
+        HSSFCellStyle headerStyle = ExcelUtils.createHeadCellStyle(wb);
+        HSSFCellStyle contentStyle = ExcelUtils.createContentCellStyle(wb);
+
+        //4.创建标题,合并标题单元格
+        //行号
+        int rowNum = 0;
+
+        //创建第一行,索引从0开始(标题行)
+        HSSFRow row0 = sheet.createRow(rowNum++);
+        row0.setHeight((short) 800);// 设置行高
+        String title = "青岛凯和志诚物流装船清单";
+        HSSFCell c00 = row0.createCell(0);
+        c00.setCellValue(title);
+        c00.setCellStyle(contentStyle);
+        // 合并单元格,参数依次为起始行,结束行,起始列,结束列 (索引0开始)
+        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 15));//标题合并单元格操作,总列数为16
+        //第三行
+        HSSFRow row1 = sheet.createRow(rowNum++);
+        row1.setHeight((short)500);
+        String string = "船名:"+tVessel.getfName()+"          "+"航次:"+tVoyage.getfNo()+"         "+"离港日期";
+        String[] row_first = {string};
+        for (int i = 0; i < row_first.length; i++) {
+            HSSFCell tempCell = row1.createCell(i);
+            tempCell.setCellValue(row_first[i]);
+            tempCell.setCellStyle(contentStyle);
+        }
+        //合并单元格
+        sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 15));
+        //第四行
+        HSSFRow row3 = sheet.createRow(rowNum++);
+        row3.setHeight((short)500);
+        String[] row_third = {"序号","提单号","箱号","铅封号","尺寸","类型","重量","箱公司","始发港","目的港","货名","运输条款","订舱公司","收货公司名称","收货人地址","收货电话"};
+        for (int i = 0; i < row_third.length; i++) {
+            HSSFCell tempCell = row3.createCell(i);
+            tempCell.setCellValue(row_third[i]);
+            tempCell.setCellStyle(contentStyle);
+        }
+
+        //根据船名航次查询清单
+        List<deriveInventoryExcel> list = tWarehouseBillsMapper.deriveInventory(tWarehouseBills);
+
+        for(int i = 0;i<list.size();i++){
+            HSSFRow tempRow = sheet.createRow(rowNum++);
+            tempRow.setHeight((short)500);
+            //循环单元格填入数据
+            for(int j=0;j<16;j++){
+                HSSFCell tempCell = tempRow.createCell(j);
+                tempCell.setCellStyle(contentStyle);
+                String cellValue = "";
+                if(j ==0){
+                    //序号
+                    cellValue = list.get(i).getRankNo().toString();
+                }else if(j == 1){
+                    //提单号
+                    cellValue = list.get(i).getfMblno();
+                }else if(j ==2){
+                    //箱号
+                    cellValue = list.get(i).getfCntrno();
+                }else if(j == 3){
+                    //铅封号
+                    cellValue = list.get(i).getfSealno();
+                }else if(j ==4){
+                    //尺寸
+                    cellValue = list.get(i).getMeasure();
+                }else if(j == 5){
+                    //类型
+                    cellValue = list.get(i).getGenre();
+                }else if(j == 6){
+                    //重量
+                    cellValue = list.get(i).getfCntrweight().toString();
+                }else if(j ==7){
+                    //箱公司
+                    cellValue = list.get(i).getfSealno();
+                }else if(j == 8){
+                    //始发港
+                    cellValue = list.get(i).getPortOfDeparture();
+                }else if(j == 9){
+                    //目的港
+                    cellValue = list.get(i).getDestinationPort();
+                }else if(j == 10){
+                    //货名
+                    cellValue = list.get(i).getGoodName();
+                }else if(j == 11){
+                    //运输条款
+                    cellValue = list.get(i).getTransitClause();
+                }else if( j == 12){
+                    //订舱公司
+                    cellValue = list.get(i).getBookingCompany();
+                }else if(j == 13){
+                    //收货公司名称
+                    cellValue = list.get(i).getfConsigneername();
+                }else if(j ==14){
+                    //收货公司地址
+                    cellValue = list.get(i).getfConsigneeattn();
+                }else if(j == 15){
+                    //收货公司电话
+                    cellValue = list.get(i).getfConsigneetel();
+                }
+                tempCell.setCellValue(cellValue);
+            }
+        }
+        //导出excel
+
+        String fileName = "清单.xls";
+        try {
+            OutputStream out = null;
+            out = new FileOutputStream(getAbsoluteFile(fileName));
+            wb.write(out);
+            if(null != wb && null != out){
+                wb.write(out);
+                wb.close();
+                out.close();
+            }
+            return AjaxResult.success(fileName);
+        }catch (Exception e){
+            e.printStackTrace();
+            return AjaxResult.error("导出Excel失败");
+        }
+    }
+
+    private String getAbsoluteFile(String fileName) {
+        String downloadPath = RuoYiConfig.getDownloadPath() + fileName;
+        File desc = new File(downloadPath);
+        if (!desc.getParentFile().exists())
+        {
+            desc.getParentFile().mkdirs();
+        }
+        return downloadPath;
+    }
+
     /**
      * 判断能否提交审批
      * @param billType

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

@@ -2462,5 +2462,64 @@
             </if>
         order by f.create_time asc
     </select>
+    <!--凯和导出清单根据船名航次-->
+    <select id="deriveInventory" parameterType="TWarehousebills" resultType="com.ruoyi.shipping.excel.deriveInventoryExcel">
+        SELECT
+            @rank:=@rank + 1 AS rankNo,
+            a.*
+        FROM
+            (
+                SELECT
+                    tw.f_mblno AS fMblno, /*提单号*/
+                    twc.f_cntrno AS fCntrno, /*箱号*/
+                    twc.f_sealno AS fSealno, /*铅封号*/
+                    substring(tr.f_no,1,2) AS measure, /*尺寸*/
+                    substring(tr.f_no,3,2) AS genre, /*类型*/
+                    twc.f_cntrweight AS fCntrweight, /*重量*/
+                    pro.dict_label AS boxCompany, /*箱公司*/
+                    td.f_name AS portOfDeparture, /*始发港*/
+                    ts.f_name AS destinationPort, /*目的港*/
+                    tg.f_name AS goodName, /*货名*/
+                    sd.dict_label AS transitClause, /*运输条款*/
+                    tc.f_name AS bookingCompany, /*订舱公司*/
+                    tw.f_consigneername AS fConsigneername, /*收货公司名称*/
+                    tw.f_consigneeattn AS fConsigneeattn, /*收货公司地址*/
+                    tw.f_consigneetel AS fConsigneetel /*收货公司电话*/
+                FROM
+                    t_warehousebills_cntritems twc
+                        LEFT JOIN t_warehousebills tw ON twc.f_pid = tw.f_id
+                        LEFT JOIN t_warehousebills_cntr tcr ON tcr.f_pid = tw.f_id
+                        LEFT JOIN t_corps tc ON tc.f_id = tw.f_corpid
+                        LEFT JOIN t_cntr tr ON tr.f_id = twc.f_cntrid
+                        LEFT JOIN t_cntrno tro ON tro.f_no = twc.f_cntrno
+                        LEFT JOIN sys_dict_data pro ON pro.dict_value = tro.f_owner AND pro.dict_type = 'f_owner'
+                        LEFT JOIN t_address td ON td.f_id = tw.f_loadportid
+                        LEFT JOIN t_address ts ON ts.f_id = tw.f_destportid
+                        LEFT JOIN t_goods tg ON tg.f_id = tcr.f_goodsid
+                        LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_serviceitems AND sd.dict_type = 'f_serviceitems'
+                <where>
+                    tw.f_typeid = '1'
+                    and tw.del_flag = '0'
+                    <if test="fBillno != null  and fBillno != ''">and tw.f_billno = #{fBillno}</if>
+                    <if test="fCntrid != null ">and tcr.f_cntrid = #{fCntrid}</if>
+                    <if test="fCntrcount != null ">and tc.f_cntrcount = #{fCntrcount}</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="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
+                    <if test="fServiceitems != null  and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
+                    <if test="fConsigneername != null  and fConsigneername != ''">and tw.f_consigneername like concat('%',
+                        #{fConsigneername}, '%')
+                    </if>
+                    <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
+                        and tw.f_bsdate &gt;= #{cLoadDate[0]}
+                    </if>
+                    <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
+                        and tw.f_bsdate &lt;= #{cLoadDate[1]}
+                    </if>
+                </where>
+                ORDER BY tw.f_mblno,twc.f_cntrno
+            )a,
+            (SELECT @rank:= 0) b
+    </select>
 
 </mapper>