Pārlūkot izejas kodu

大屏细节调整、出库新增出口单号字段

Sun 3 gadi atpakaļ
vecāks
revīzija
07c52a7cc0

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

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

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

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

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

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

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

@@ -209,6 +209,12 @@ public class TWarehouseBills extends BaseEntity {
     private String fMblno;
 
     /**
+     * 提单号
+     */
+    @Excel(name = "出口单号")
+    private String fEmblno;
+
+    /**
      * 船名航次,CMA/A0001
      */
     @Excel(name = "船名航次,CMA/A0001")
@@ -1505,6 +1511,14 @@ public class TWarehouseBills extends BaseEntity {
         return fMblno;
     }
 
+    public String getfEmblno() {
+        return fEmblno;
+    }
+
+    public void setfEmblno(String fEmblno) {
+        this.fEmblno = fEmblno;
+    }
+
     public void setfVslvoy(String fVslvoy) {
         this.fVslvoy = fVslvoy;
     }
@@ -1882,6 +1896,7 @@ public class TWarehouseBills extends BaseEntity {
                 ", fFeetunit='" + fFeetunit + '\'' +
                 ", fProductName='" + fProductName + '\'' +
                 ", fMblno='" + fMblno + '\'' +
+                ", fEmblno='" + fEmblno + '\'' +
                 ", fVslvoy='" + fVslvoy + '\'' +
                 ", fMarks='" + fMarks + '\'' +
                 ", fEta=" + fEta +

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

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

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

@@ -701,7 +701,7 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
     @Override
     public Map<String, Object> biContractCount() {
         String beginDate = DateUtils.today() + " 00:00:00";
-        String endDate = DateUtils.offsetMonth(2) + "23:59:59";
+        String endDate = DateUtils.offsetMonth(2) + " 23:59:59";
 
         return tWarehouseAgreementMapper.biContractCount(beginDate, endDate);
     }

+ 14 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -25,6 +25,7 @@ import com.ruoyi.common.utils.DictUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.ip.AddressUtils;
+import com.ruoyi.common.utils.poi.DrawExcel;
 import com.ruoyi.common.utils.poi.ExcelUtils;
 import com.ruoyi.quotation.domain.TSeaprice;
 import com.ruoyi.quotation.mapper.TSeapriceMapper;
@@ -1559,6 +1560,19 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         return storageDetails;
     }
 
+    /**
+     * 导出仓储费账单
+     *
+     * @return 文件名
+     */
+    @Override
+    public String exportStorageBill() {
+        // TODO 仓储费账单导出
+        String filename = "仓储费账单.xlsx";
+        DrawExcel ioExcel = new DrawExcel(DrawExcel.getAbsoluteFile(filename));
+        return null;
+    }
+
     @Override
     public List<Map<String, Object>> selectInventoryList(TWarehouseBills tWarehouseBills) {
         if (StringUtils.isNotNull(tWarehouseBills.getfWarehouseid())) {

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

@@ -326,5 +326,6 @@
             f_name as warehouseName
         from t_warehouse
         where parent_id = 100
+        order by convert(f_name using gbk)
     </select>
 </mapper>

+ 14 - 1
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -34,6 +34,7 @@
         <result property="fSbu"    column="f_sbu"    />
         <result property="fFeetunit"    column="f_feetunit"    />
         <result property="fMblno"    column="f_mblno"    />
+        <result property="fEmblno"    column="f_emblno"    />
         <result property="fVslvoy"    column="f_vslvoy"    />
         <result property="fEta"    column="f_eta"    />
         <result property="fMarks"    column="f_marks"    />
@@ -135,7 +136,7 @@
     <sql id="selectTWarehousebillsVo">
         select f_id, f_billno, f_customsdeclartion, f_originalbillno, f_deptid, f_bsdeptid, f_contacts, f_tel, f_corpid, f_tocorpid, f_stltypeid, f_bscorpno,
         f_warehouseid, f_storekeeper, f_chargedate, f_bsdate, f_planqty, f_plangrossweight, f_plannetweight, f_planvolumn, f_qty, f_grossweight, f_netweight,
-        f_volumn, f_billingway, f_trademodeid, f_sbu, f_feetunit, f_mblno, f_marks, f_vslvoy, f_eta, f_customno, f_ifweigh, f_ifpledge, f_ifdamage, f_bankcorpid,
+        f_volumn, f_billingway, f_trademodeid, f_sbu, f_feetunit, f_mblno, f_emblno, f_marks, f_vslvoy, f_eta, f_customno, f_ifweigh, f_ifpledge, f_ifdamage, f_bankcorpid,
         f_billtype, f_billstatus, f_items_status, del_flag, create_by, create_time, update_by, update_time, remark, f_billing_deadline, f_product_name, f_review_date,
         f_truckno, f_driver_name, f_driver_tel, f_driver_id_car, f_business_type, f_labour, f_fleet, f_inwarehouseid, f_bstime, f_cartype, f_goodsid, f_new_trademodeid,
         f_loadportid, f_destportid, f_serviceitems, f_invoceobj, f_sign, f_detentioncargo, f_booksmarks, f_shippername, f_shipperattn, f_shippertel, f_consigneername,
@@ -196,6 +197,7 @@
             <if test="fSbu != null ">and f_sbu = #{fSbu}</if>
             <if test="fFeetunit != null  and fFeetunit != ''">and f_feetunit = #{fFeetunit}</if>
             <if test="fMblno != null  and fMblno != ''">and f_mblno = #{fMblno}</if>
+            <if test="fEmblno != null  and fEmblno != ''">and f_emblno = #{fEmblno}</if>
             <if test="fVslvoy != null  and fVslvoy != ''">and f_vslvoy = #{fVslvoy}</if>
             <if test="fEta != null ">and f_eta = #{fEta}</if>
             <if test="fCustomno != null  and fCustomno != ''">and f_customno = #{fCustomno}</if>
@@ -218,6 +220,7 @@
             corp.f_name AS fCorpid,
             corpTo.f_name AS fTocorpid,
             bill.f_mblno AS fMblno,
+            bill.f_emblno AS fEmblno,
             corpSub.f_name AS fSbu,
             bill.f_marks AS fMarks,
             bill.remark AS remark,
@@ -379,6 +382,7 @@
             <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
             <if test="fFeetunit != null  and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
             <if test="fMblno != null  and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
+            <if test="fEmblno != null  and fEmblno != ''">and bill.f_emblno like concat('%', #{fEmblno}, '%')</if>
             <if test="fVslvoy != null  and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
             <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
             <if test="fCustomno != null  and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
@@ -423,6 +427,7 @@
             corp.f_name AS fCorpid,
             corpTo.f_name AS fTocorpid,
             bill.f_mblno AS fMblno,
+            bill.f_emblno AS fEmblno,
             corpSub.f_name AS fSbu,
             bill.f_marks AS fMarks,
             bill.remark AS remark,
@@ -563,6 +568,7 @@
             <if test="fSbu != null ">and bill.f_sbu = #{fSbu}</if>
             <if test="fFeetunit != null  and fFeetunit != ''">and bill.f_feetunit = #{fFeetunit}</if>
             <if test="fMblno != null  and fMblno != ''">and bill.f_mblno like concat('%', #{fMblno}, '%')</if>
+            <if test="fEmblno != null  and fEmblno != ''">and bill.f_emblno like concat('%', #{fEmblno}, '%')</if>
             <if test="fVslvoy != null  and fVslvoy != ''">and bill.f_vslvoy = #{fVslvoy}</if>
             <if test="fEta != null ">and bill.f_eta = #{fEta}</if>
             <if test="fCustomno != null  and fCustomno != ''">and bill.f_customno = #{fCustomno}</if>
@@ -740,6 +746,7 @@
             <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
             <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
             <if test="fMblno != null ">and it.f_mblno like concat('%',#{fMblno},'%')</if>
+            <if test="fEmblno != null ">and it.f_emblno like concat('%',#{fEmblno},'%')</if>
             <if test="fLocation != null  and fLocation ==1 ">
                 and it.f_warehouselocid = #{fWarehouseid}
             </if>
@@ -810,6 +817,7 @@
             <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
             <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
             <if test="fMblno != null ">and it.f_mblno like concat('%',#{fMblno},'%')</if>
+            <if test="fEmblno != null ">and it.f_emblno like concat('%',#{fEmblno},'%')</if>
             <if test="fLocation != null  and fLocation ==1 ">
                 and it.f_warehouselocid = #{fWarehouseid}
             </if>
@@ -868,6 +876,7 @@
         <if test="fNewTrademodeid != null ">and leg.f_new_trademodeid = #{fNewTrademodeid}</if>
         <if test="fCorpid != null ">and leg.f_corpid = #{fCorpid}</if>
         <if test="fMblno != null ">and leg.f_mblno = #{fMblno}</if>
+        <if test="fEmblno != null ">and leg.f_emblno = #{fEmblno}</if>
         <if test="fLocation != null  and fLocation ==1 ">
             and it.f_warehouselocid = #{fWarehouseid}
         </if>
@@ -924,6 +933,7 @@
             <if test="fSbu != null">f_sbu,</if>
             <if test="fFeetunit != null">f_feetunit,</if>
             <if test="fMblno != null">f_mblno,</if>
+            <if test="fEmblno != null">f_emblno,</if>
             <if test="fVslvoy != null">f_vslvoy,</if>
             <if test="fEta != null">f_eta,</if>
             <if test="fMarks != null">f_marks,</if>
@@ -1039,6 +1049,7 @@
             <if test="fSbu != null">#{fSbu},</if>
             <if test="fFeetunit != null">#{fFeetunit},</if>
             <if test="fMblno != null">#{fMblno},</if>
+            <if test="fEmblno != null">#{fEmblno},</if>
             <if test="fVslvoy != null">#{fVslvoy},</if>
             <if test="fEta != null">#{fEta},</if>
             <if test="fMarks != null">#{fMarks},</if>
@@ -1158,6 +1169,7 @@
             <if test="fSbu != null">f_sbu = #{fSbu},</if>
             <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
             <if test="fMblno != null">f_mblno = #{fMblno},</if>
+            <if test="fEmblno != null">f_emblno = #{fEmblno},</if>
             <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
             <if test="fEta != null">f_eta = #{fEta},</if>
             <if test="fMarks != null">f_marks = #{fMarks},</if>
@@ -1278,6 +1290,7 @@
             <if test="fSbu != null">f_sbu = #{fSbu},</if>
             <if test="fFeetunit != null">f_feetunit = #{fFeetunit},</if>
             <if test="fMblno != null">f_mblno = #{fMblno},</if>
+            <if test="fEmblno != null">f_emblno = #{fEmblno},</if>
             <if test="fVslvoy != null">f_vslvoy = #{fVslvoy},</if>
             <if test="fMarks != null and fMarks != ''">f_marks = #{fMarks},</if>
             <if test="fEta != null">f_eta = #{fEta},</if>