java 按照部门统计TIPTOP单据数量

package com.xinpoint.erp;

import java.io.File;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DecimalFormat;

import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;

public class TiptopSlipCountUtil {
	/**
	 * Tiptop5.x 上線每日單據新舊系統差異統計
     * @author 李藝輝  2011/09/10
	 */
	public static void main(String[] args) {
		//新系統oracle資料庫各營運中心連接信息
		final String ORACLEDBDRIVER = "oracle.jdbc.driver.OracleDriver";
		final String ORACLEDBURL = "jdbc:oracle:thin:@192.168.5.102:1521:topprod";
		//按電線、資科、造粒、伸銅、菲太、臺太 順序讀取數據
		final String ORACLEDBUSER = "HZJM";
		final String ORACLEDBPASSWORD = "hzjm";
		final String[] Department = new String[]{"11401","11402","115","110","112","109","108","111","113"};
		final String[] Departname = new String[]{"注塑一部","注塑二部","总经办","仓管部","电镀部","工程部","品管部","装配部","包装部"};
		//用於Oracel讀取數據記錄的3個對象
		Connection connOracle = null;         //得到資料庫的連接
		PreparedStatement pstmOracle = null;  //執行CRUD記錄操作
		ResultSet rsOracle = null;            //保持CRUD操作后的結果集

		//創建Excel文檔,用於將統計后的數據信息自動保存至該Excel文檔中(C://TiptopSlipCount.xls)
		WritableWorkbook workbook = null;
		WritableSheet sheet = null;
		WritableSheet aimtSheet = null;
		try {
			workbook = Workbook.createWorkbook(new File("C://TiptopSlipCount.xls"));
			//迴圈,依據有多少工廠別就產生該Excel有相應數目的sheet
			for(int i=0;i<Department.length;i++){
				//創建Excel文檔中的工廠信息
				sheet = workbook.createSheet(Departname[i], i);
				Label factoryLable = new Label(0, 0, Departname[i]);
				sheet.addCell(factoryLable);
				//創建Excel文檔橫列欄位信息
				Label confirmLableNew = new Label(2, 1, "確認(新)");
				sheet.addCell(confirmLableNew);
				Label notConfirmLableNew = new Label(3, 1, "未確認(新)");
				sheet.addCell(notConfirmLableNew);
				Label notPostNew = new Label(4, 1, "未過帳(新)");
				sheet.addCell(notPostNew);
				Label voidLableNew = new Label(5, 1, "作廢(新)");
				sheet.addCell(voidLableNew);
				Label countTiptopLableNew = new Label(6, 1, "總計(新)");
				sheet.addCell(countTiptopLableNew);
				//創建Excel文檔縱列tiptop單據程式信息
				Label axmt410Lable = new Label(0, 2, "訂單(axmt410)");
				sheet.addCell(axmt410Lable);
				Label axmt410FileLable = new Label(1, 2, "oea_file");
				sheet.addCell(axmt410FileLable);
				Label axmt620Lable = new Label(0, 3, "出貨單(axmt620)");
				sheet.addCell(axmt620Lable);
				Label axmt620FileLable = new Label(1, 3, "oga_file");
				sheet.addCell(axmt620FileLable);
				Label apmt420Lable = new Label(0, 4, "請購單(apmt420)");
				sheet.addCell(apmt420Lable);
				Label apmt420FileLable = new Label(1, 4, "pmk_file");
				sheet.addCell(apmt420FileLable);
				Label apmt540Lable = new Label(0, 5, "採購單(apmt540)");
				sheet.addCell(apmt540Lable);
				Label apmt540FileLable = new Label(1, 5, "pmm_file");
				sheet.addCell(apmt540FileLable);
				Label apmt110Lable = new Label(0, 6, "收貨單(apmt110)");
				sheet.addCell(apmt110Lable);
				Label apmt110FileLable = new Label(1, 6, "rva_file");
				sheet.addCell(apmt110FileLable);
				Label aqct110Lable = new Label(0, 7, "IQC(aqct110)");
				sheet.addCell(aqct110Lable);
				Label aqct110FileLable = new Label(1, 7, "qcs_file");
				sheet.addCell(aqct110FileLable);
				Label apmt720Lable = new Label(0, 8, "入庫單(apmt720)");
				sheet.addCell(apmt720Lable);
				Label apmt720FileLable = new Label(1, 8, "rvu_file");
				sheet.addCell(apmt720FileLable);
				Label asfi301Lable = new Label(0, 10, "工單(asfi301)");
				sheet.addCell(asfi301Lable);
				Label asfi301FileLable = new Label(1, 10, "sfb_file");
				sheet.addCell(asfi301FileLable);
				Label aimt324Lable = new Label(0, 11, "調撥單(aimt324)");
				sheet.addCell(aimt324Lable);
				Label aimt324FileLable = new Label(1, 11, "imm_file");
				sheet.addCell(aimt324FileLable);
				Label asfi511Lable = new Label(0, 12, "發料單(asfi511)");
				sheet.addCell(asfi511Lable);
				Label asfi511FileLable = new Label(1, 12, "sfp_file");
				sheet.addCell(asfi511FileLable);
				Label aqct410Lable = new Label(0, 13, "FQC(aqct410)");
				sheet.addCell(aqct410Lable);
				Label aqct410FileLable = new Label(1, 13, "qcf_file");
				sheet.addCell(aqct410FileLable);
				Label asft620Lable = new Label(0, 14, "入庫單(asft620)");
				sheet.addCell(asft620Lable);
				Label asft620FileLable = new Label(1, 14, "sfu_file");
				sheet.addCell(asft620FileLable);
				Label asft300Lable = new Label(0, 15, "工單生產報工(asft300)");
				sheet.addCell(asft300Lable);
				Label asft300FileLable = new Label(1, 15, "srf_file");
				sheet.addCell(asft300FileLable);
				Label axmt700Lable = new Label(0, 17, "銷退單(axmt700)");
				sheet.addCell(axmt700Lable);
				Label axmt700FileLable = new Label(1, 17, "oha_file");
				sheet.addCell(axmt700FileLable);
				Label aimt302Lable = new Label(0, 18, "倉庫雜收單(aimt302)");
				sheet.addCell(aimt302Lable);
				Label aimt302FileLable = new Label(1, 18, "ina_file");
				sheet.addCell(aimt302FileLable);
				Label aimt312Lable = new Label(0, 19, "WIP雜收單(aimt312)");
				sheet.addCell(aimt312Lable);
				Label aimt312FileLable = new Label(1, 19, "ina_file");
				sheet.addCell(aimt312FileLable);
				Label aimt301Lable = new Label(0, 20, "倉庫雜發單(aimt301)");
				sheet.addCell(aimt301Lable);
				Label aimt301FileLable = new Label(1, 20, "ina_file")
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值