Example #1
0
        //protected override void gridWebGrid_ItemCommand(GridRecord row, string commandName)
        //{
        //    if (commandName == "Edit")
        //    {
        //        object obj = this.GetEditObject(row);
        //        if (obj != null)
        //        {
        //            this.SetEditObject(obj);
        //            this.buttonHelper.PageActionStatusHandle(PageActionType.Update);
        //        }
        //    }
        //    else if (commandName == "LinkDetail")
        //    {
        //        string pickNo = row.Items.FindItemByKey("PickNo").Text.Trim();
        //        //string storageOut = row.Items.FindItemByKey("StorageOut").Text.Trim();
        //        Response.Redirect(this.MakeRedirectUrl("FCreatePickLineMP.aspx", new string[] { "ACT", "PickNo" }, new string[] { "LinkDetail", pickNo }));
        //    }
        //}



        protected override void cmdExport_Click(object sender, EventArgs e)
        {
            BenQGuru.eMES.Material.WarehouseFacade _WarehouseFacade = new BenQGuru.eMES.Material.WarehouseFacade(base.DataProvider);

            List <string> ca = new List <string>();

            XlsPackage xls  = new XlsPackage();
            IFont      font = xls.Black;

            font.FontHeightInPoints = 10;
            ICellStyle style = xls.Normal;

            style.SetFont(font);



            xls.CreateSheet("IQC执行情况-BUYER ");
            xls.NewRow(0);
            xls.Cell(0, "鼎桥物料编码", style);
            xls.Cell(1, "鼎桥物料描述", style);
            xls.Cell(2, "供应商代码", style);
            xls.Cell(3, "供应商名称", style);
            xls.Cell(4, "来料数量", style);
            xls.Cell(5, "样本数量", style);
            xls.Cell(6, "缺陷品数", style);
            xls.Cell(7, "缺陷率", style);
            xls.Cell(8, "退换货数量", style);
            xls.Cell(9, "现场整改数量", style);
            xls.Cell(10, "让步接收数量", style);
            xls.Cell(11, "特采放行数量", style);
            int rowNum = 1;

            IQCExecSummaryBuyer[] rs = _WarehouseFacade.GetIQCExecBuyerSummary(
                FormatHelper.TODateInt(dateInDateFromQuery.Text),
                FormatHelper.TODateInt(dateInDateToQuery.Text),
                txtDQMCodeQuery.Text,
                txtDQMDESCQuery.Text,
                txtVendorCodeQuery.Text,
                txtVendorNameQuery.Text);
            for (int i = 0; i < rs.Length; i++)
            {
                xls.NewRow(rowNum);
                string DQMCODE = rs[i].DQMCODE;
                xls.Cell(0, DQMCODE, style);
                string MDESC = rs[i].MDESC;
                xls.Cell(1, MDESC, style);
                string VENDORCODE = rs[i].VENDORCODE;
                xls.Cell(2, VENDORCODE, style);


                string VENDORNAME = rs[i].VENDORNAME;
                xls.Cell(3, VENDORNAME, style);

                string QTY = rs[i].QTY.ToString();
                xls.Cell(4, QTY, style);


                string SAMPLESIZE = rs[i].SAMPLESIZE.ToString();
                xls.Cell(5, SAMPLESIZE, style);


                string NGQTY = rs[i].NGQTY.ToString();
                xls.Cell(6, NGQTY, style);


                string NGPER = rs[i].NGPER;
                xls.Cell(7, NGPER, style);

                string ReturnQTY = rs[i].ReturnQTY.ToString();
                xls.Cell(8, ReturnQTY, style);


                string ReformQTY = rs[i].ReformQTY.ToString();
                xls.Cell(9, ReformQTY, style);

                string GiveQTY = rs[i].GiveQTY.ToString();
                xls.Cell(10, GiveQTY, style);

                string AcceptQTY = rs[i].AcceptQTY.ToString();
                xls.Cell(11, AcceptQTY, style);
                rowNum++;
            }



            string filename = string.Format("Export_{0}_{1}.{2}", FormatHelper.TODateInt(System.DateTime.Now).ToString(), FormatHelper.TOTimeInt(System.DateTime.Now).ToString(), "xls");
            string filepath = string.Format(@"{0}{1}", this.DownloadPhysicalPath, filename);



            FileStream file = new FileStream(filepath, FileMode.Create, FileAccess.ReadWrite);

            xls.Save(file);
            file.Close();

            DownLoadFile1(filename);
        }