⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exportexcel.jsp

📁 运输模块代码
💻 JSP
📖 第 1 页 / 共 2 页
字号:
       wnet   = wnet   + CurPacknote.net
       ln = ln + 1
       RETURN (.T.)*/
        int rowbegin = 8;
        String PkgNO = "";
        float tcoils = 0, tgross = 0, ttare = 0, tnet = 0, tcoils1 = 0, tgross1 = 0, ttare1 = 0, tnet1 = 0, tcoils2 = 0, tgross2 = 0, ttare2 = 0, tnet2 = 0;
        ASResultSet rs1 = Sqlca.getASResultSet("SELECT DISTINCT custpo FROM shipment WHERE blno ='" + sCode + "'");
        while (rs1.next()) {
            ASResultSet rs2;
            if (rs1.getString("custpo") == null) {
                rs2 = Sqlca.getASResultSet("select distinct worksno from packnote where blno ='" + sCode + "' and custpo is null");

            } else {
                //rs2 = Sqlca.getASResultSet("select distinct worksno from packnote where blno ='" + sCode + "' and custpo='" + rs1.getString("custpo") + "'");
                rs2 = Sqlca.getASResultSet("select distinct worksno from shipment where blno ='" + sCode + "' and custpo='" + rs1.getString("custpo") + "'");
            }
            row = sheet.createRow(rowbegin++);
            cell = row.createCell((short) 0);
            cell.setEncoding((short) 1);  //编码格式设置
            cell.setCellValue("Cust PO:    " + StringUtils.nullToEmpty(custpo));
            while (rs2.next()) {
                row = sheet.createRow(rowbegin++);
                cell = row.createCell((short) 0);
                cell.setEncoding((short) 1);  //编码格式设置
                if (isimperial == 1) {
                    cell.setCellValue("Works No:" + rs2.getString("worksno") + "        Desc:" + desc);
                } else {
                    cell.setCellValue("Works No:" + rs2.getString("worksno") + "        Desc:" + desc + "  " + mt_width + "" + mt_gauge);
                }

                row = sheet.createRow(rowbegin++);
                cell = row.createCell((short) 0);
                cell.setEncoding((short) 1);  //编码格式设置
                cell.setCellValue("                     Part No:" + custprod + "              Spec:" + custspec);
                ASResultSet rsp = Sqlca.getASResultSet("select pnno, standwgt,standno, ctrwgt,ctrno,casewgt,caseno,paltno,coils,gross,tare,net from packnote where blno ='" + sCode + "' and worksno='" + rs2.getString("worksno") + "'");
                while (rsp.next()) {


                    row = sheet.createRow(rowbegin++);
                    cell = row.createCell((short) 1);
                    cell.setEncoding((short) 1);  //编码格式设置
                    cell.setCellValue(rsp.getString("pnno"));
                    cell = row.createCell((short) 2);
                    cell.setEncoding((short) 1);  //编码格式设置

                    PkgNO = "P" + rsp.getString("paltno");
                    if (rsp.getFloat("standwgt") > 0)
                        PkgNO = "S" + rsp.getString("standno");
                    if (rsp.getFloat("ctrwgt") > 0)
                        PkgNO = "C" + rsp.getString("ctrno");
                    if (rsp.getFloat("casewgt") > 0)
                        PkgNO = "W" + rsp.getString("caseno");

                    cell.setCellValue(PkgNO);
                    cell = row.createCell((short) 3);
                    cell.setEncoding((short) 1);  //编码格式设置
                    cell.setCellValue(rsp.getString("Coils"));
                    cell = row.createCell((short) 4);
                    cell.setEncoding((short) 1);  //编码格式设置
                    cell.setCellValue(rsp.getString("Gross"));
                    cell = row.createCell((short) 5);
                    cell.setEncoding((short) 1);  //编码格式设置
                    if (uaccess == 1) {
                        cell.setCellValue("");
                    } else {
                        cell.setCellValue(rsp.getString("Tare"));
                    }
                    cell = row.createCell((short) 6);
                    cell.setEncoding((short) 1);  //编码格式设置
                    cell.setCellValue(rsp.getString("Net"));
                    tcoils += rsp.getFloat("coils");
                    tgross += rsp.getFloat("gross");
                    ttare += rsp.getFloat("tare");
                    tnet += rsp.getFloat("net");

                }
                //works no tot;
                row = sheet.createRow(rowbegin++);
                cell = row.createCell((short) 0);
                cell.setEncoding((short) 1);  //编码格式设置
                cell.setCellValue("Works NO Tot:");

                cell = row.createCell((short) 3);
                cell.setEncoding((short) 1);  //编码格式设置
                cell.setCellValue(tcoils);
                cell = row.createCell((short) 4);
                cell.setEncoding((short) 1);  //编码格式设置
                cell.setCellValue(tgross);
                cell = row.createCell((short) 5);
                cell.setEncoding((short) 1);  //编码格式设置
                cell.setCellValue(ttare);
                cell = row.createCell((short) 6);
                cell.setEncoding((short) 1);  //编码格式设置
                cell.setCellValue(tnet);

                tcoils1 = tcoils1 + tcoils;
                tgross1 = tgross1 + tgross;
                ttare1 = ttare1 + ttare;
                tnet1 = tnet1 + tnet;
                //rset
                tcoils = 0f;
                tgross = 0f;
                ttare = 0f;
                tnet = 0f;
            }
            //Cust PO tot;
            row = sheet.createRow(rowbegin++);
            cell = row.createCell((short) 0);
            cell.setEncoding((short) 1);  //编码格式设置
            cell.setCellValue("Cust PO Tot:");

            cell = row.createCell((short) 3);
            cell.setEncoding((short) 1);  //编码格式设置
            cell.setCellValue(tcoils1);
            cell = row.createCell((short) 4);
            cell.setEncoding((short) 1);  //编码格式设置
            cell.setCellValue(tgross1);
            cell = row.createCell((short) 5);
            cell.setEncoding((short) 1);  //编码格式设置
            cell.setCellValue(ttare1);
            cell = row.createCell((short) 6);
            cell.setEncoding((short) 1);  //编码格式设置
            cell.setCellValue(tnet1);
            tcoils2 = tcoils2 + tcoils1;
            tgross2 = tgross2 + tgross1;
            ttare2 = ttare2 + ttare1;
            tnet2 = tnet2 + tnet1;
            //rset
            tcoils1 = 0f;
            tgross1 = 0f;
            ttare1 = 0f;
            tnet1 = 0f;
        }

        //Packing List tot;
        row = sheet.createRow(rowbegin++);
        cell = row.createCell((short) 0);
        cell.setEncoding((short) 1);  //编码格式设置
        if (uaccess == 1) {
            cell.setCellValue("Pick list Total:");
        } else {

        }
        cell.setCellValue("Packing List Total:");

        cell = row.createCell((short) 3);
        cell.setEncoding((short) 1);  //编码格式设置
        cell.setCellValue(tcoils2);
        cell = row.createCell((short) 4);
        cell.setEncoding((short) 1);  //编码格式设置
        cell.setCellValue(tgross2);
        cell = row.createCell((short) 5);
        cell.setEncoding((short) 1);  //编码格式设置
        cell.setCellValue(ttare2);
        cell = row.createCell((short) 6);
        cell.setEncoding((short) 1);  //编码格式设置
        cell.setCellValue(tnet2);
  
        response.setContentType("application/msexcel");
        response.setContentType("charset=GBK");
        //从配置文件读取文件名
        String FileName = "shippinglist.xls";
        //System.out.println(" FileName= " + FileName);
        response.setHeader("Content-disposition", "inline;filename=" + FileName);//定义Excel文件名

        book.write(response.getOutputStream());
        response.getOutputStream().flush();
        response.getOutputStream().close();
    }
%>


<%@ include file="/IncludeEnd.jsp" %>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -