Beispiel #1
0
        /// <summary>
        /// IVM27_1報表(區域彙總表)
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <returns>回傳查詢結果</returns>
        public DataTable IVM27_1(ArrayList ParameterList,
                                   string ReportOutputFormat,
                                   ref ReportList.ExcelOtherType EOT
                                  )
        {
            #region
            IVMModel.VDS_IVM27_BCO bco = new IVMModel.VDS_IVM27_BCO(ConntionDB);
            DataTable Dt = new DataTable();
            Dt = bco.PrintPickBatchList(ParameterList);

            if (Dt == null || Dt.Rows.Count == 0)
            {
                throw new Exception("查無資料");
            }
            else
            {
                return Dt;
            }
            #endregion
        }
Beispiel #2
0
        /// <summary>
        /// IVM27_2報表(單店理貨清單)
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <returns>回傳查詢結果</returns>
        public DataTable IVM27_2(ArrayList ParameterList,
                                   string ReportOutputFormat,
                                   ref ReportList.ExcelOtherType EOT
                                  )
        {
            #region
            IVMModel.VDS_IVM27_BCO bco = new IVMModel.VDS_IVM27_BCO(ConntionDB);
            DataTable Dt = new DataTable();
            Dt = bco.PrintStorePickList(ParameterList);

            if (Dt == null || Dt.Rows.Count == 0)
            {
                throw new Exception("查無資料");
            }
            else
            {
                DataView dv = new DataView(Dt);
                dv.Sort = "BLocateSection,ITEM,PERIOD";
                return dv.ToTable();
            }
            #endregion
        }
Beispiel #3
0
    /// <summary>
    /// 壓縮檔型態-2
    /// </summary>
    private void ExportPickList_Zip2()
    {
        #region
        try
        {

            #region 各項變數
            string s_ZipFileName = txt_PickNo.Text;
            s_ZipFileName = Server.UrlEncode(s_ZipFileName);

            DataTable dtTemp = null;
            ArrayList ParameterList = new ArrayList();
            string[] strAryPickBatchNo = GetPICK_BATCHNOChecked().Split(",".ToCharArray());
            string s_FilePath = Server.MapPath("..\\") + System.Configuration.ConfigurationManager.AppSettings["DownLoadPath"] + "IVM\\" + DateTime.Now.ToString("yyyyMMdd") + "\\";
            Int32 k = 0;//用來統計是否所有理貨批次皆查無資料
            #endregion

            IVMModel.VDS_IVM27_BCO BCO = new IVMModel.VDS_IVM27_BCO(ConnectionDB);

            for (Int32 i = 0; i <= strAryPickBatchNo.GetUpperBound(0); i++)
            {

                #region 從資料庫取得資料

                ParameterList.Clear();
                ParameterList.Add(strAryPickBatchNo[i]);
                dtTemp = BCO.ExportPickList(ParameterList);

                if (dtTemp == null || dtTemp.Rows.Count == 0)
                {
                    k++;
                    
                    if (k == strAryPickBatchNo.Length)
                    {
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "IVM27", "alert('查無資料');", true);
                        return;
                    }
                }
                else
                {
                    //產檔
                    MakeTxt(dtTemp, s_FilePath, strAryPickBatchNo[i]);
                }

                #endregion

            }

            //壓縮
            string zipFileName = ExportZip2(s_FilePath, strAryPickBatchNo, s_ZipFileName);

            #region
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AddHeader("content-disposition", "attachment;filename=" + Path.GetFileName(zipFileName));
            Response.ContentType = "application/octet-stream";
            Response.WriteFile(zipFileName);
            Response.Flush();
            Response.Close();
            #endregion
        }
        catch (Exception ex)
        {
            throw ex;
        }

        #endregion
    }
Beispiel #4
0
    /// <summary>
    /// 壓縮檔型態
    /// </summary>
    private void ExportPickList_Zip()
    {
        #region
        try
        {
            #region 從資料庫取得資料

            DataTable dtTemp = null;
            IVMModel.VDS_IVM27_BCO BCO = new IVMModel.VDS_IVM27_BCO(ConnectionDB);

            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(GetPICK_BATCHNOChecked());
            dtTemp = BCO.ExportPickList(ParameterList);

            if (dtTemp == null || dtTemp.Rows.Count == 0)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "IVM27", "alert('查無資料');", true);
                return;
            }

            #endregion

            #region 取得檔名
            string s_FileName = txt_PickNo.Text;
            s_FileName = Server.UrlEncode(s_FileName);

            #endregion

            #region 產檔、壓縮
            string s_FilePath = Server.MapPath("..\\") + System.Configuration.ConfigurationManager.AppSettings["DownLoadPath"] + "IVM\\";
            string zipFileName = ExportZip(dtTemp, s_FilePath, s_FileName);
            #endregion

            #region
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AddHeader("content-disposition", "attachment;filename=" + Path.GetFileName(zipFileName));
            Response.ContentType = "application/octet-stream";
            Response.WriteFile(zipFileName);
            Response.Flush();
            Response.Close();
            #endregion
        }
        catch (Exception ex)
        {
            throw ex;
        }

        #endregion
    }
Beispiel #5
0
    /// <summary>
    /// 理貨檔匯出
    /// </summary>
    private void ExportPickList()
    {
        #region
        try
        {
            #region 從資料庫取得資料

            DataTable dtTemp = null;
            IVMModel.VDS_IVM27_BCO BCO = new IVMModel.VDS_IVM27_BCO(ConnectionDB);

            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(GetPICK_BATCHNOChecked());
            dtTemp = BCO.ExportPickList(ParameterList);

            if (dtTemp == null || dtTemp.Rows.Count == 0)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "IVM27", "alert('查無資料');", true);
                return;
            }

            #endregion

            #region 將資料寫入文字檔
            string s_FileName = txt_PickNo.Text;

            if (s_FileName.ToLower().IndexOf(".txt") < 0)
            {
                s_FileName = s_FileName + ".txt";
            }

            System.Text.StringBuilder sb_Out_String = new System.Text.StringBuilder();
            Response.Clear();
            Response.Buffer = true;
            Response.Charset = "BIG5";
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(s_FileName));
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("BIG5");
            Response.ContentType = "application/ms-txt";
            this.EnableViewState = false;

            System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter oHtmlTextWriter = new HtmlTextWriter(oStringWriter);

            #region 內容
            string s_ItemName = "";

            foreach (DataRow dRow in dtTemp.Rows)
            {
                sb_Out_String.Remove(0, sb_Out_String.Length);
                //20100225  100224X001  025PA00225002421       471770221121900旋風管家 10.	                                     出版商  商品種類0001PA00225002421 000100000000000950000000 0000000 0000000 0000000 收件代碼                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   不指定  

                //1~10
                sb_Out_String.Append(dRow["ST_ACCEPT_DATE"].ToString().PadRight(10, Char.Parse(" ")));
                sb_Out_String.Append(dRow["PICK_BATCHNO"].ToString().PadRight(12, Char.Parse(" ")));
                sb_Out_String.Append(dRow["PICK_LOCATENO"].ToString().PadRight(3, Char.Parse(" ")));
                sb_Out_String.Append(dRow["ST_ACCEPT_NO"].ToString().PadRight(20, Char.Parse(" ")));
                sb_Out_String.Append(dRow["BARCODE"].ToString().PadRight(15, Char.Parse(" ")));

                //設定商品名稱長度
                s_ItemName = "";
                s_ItemName = dRow["ITEM_NAME"].ToString().Trim() +
                              s_ItemName.PadRight(50 - GetStringLen(dRow["ITEM_NAME"].ToString().Trim()), Char.Parse(" "));
                sb_Out_String.Append(s_ItemName);

                //總位元數+中文字數-中文字位元數
                sb_Out_String.Append("出版商".PadRight(8 + 3 - GetStringLen("出版商"), Char.Parse(" ")));
                sb_Out_String.Append("商品種類".PadRight(8 + 4 - GetStringLen("商品種類"), Char.Parse(" ")));
                sb_Out_String.Append(dRow["DIS_QTY"].ToString().PadLeft(4, Char.Parse("0")));
                sb_Out_String.Append(dRow["ST_ACCEPT_NO"].ToString().PadRight(14, Char.Parse(" ")));

                //11~20
                sb_Out_String.Append(dRow["DIS_QTY"].ToString().PadLeft(4, Char.Parse("0")));
                sb_Out_String.Append("0");
                sb_Out_String.Append("0000");
                sb_Out_String.Append(dRow["SUBTOTAL"].ToString().PadLeft(8, Char.Parse("0")));
                sb_Out_String.Append("0000000 ");
                sb_Out_String.Append("0000000 ");
                sb_Out_String.Append("0000000 ");
                sb_Out_String.Append("0000000 ");
                sb_Out_String.Append("收件代碼".PadRight(50 + 4 - GetStringLen("收件代碼"), Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(50, Char.Parse(" ")));

                //21~30
                sb_Out_String.Append("".PadRight(5, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(80, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(20, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(16, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(10, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(1, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(50, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(80, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(8, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(8, Char.Parse(" ")));

                //31~40
                sb_Out_String.Append("".PadRight(6, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(6, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(20, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(9, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(16, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(8, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(6, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(80, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(80, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(10, Char.Parse(" ")));

                //41~45
                sb_Out_String.Append("不指定".PadRight(10 + 3 - GetStringLen("不指定"), Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(10, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(8, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(10, Char.Parse(" ")));
                sb_Out_String.Append("".PadRight(20, Char.Parse(" ")));

                Response.Write(sb_Out_String.ToString());
                Response.Write(oHtmlTextWriter.NewLine);
            }

            #endregion

            Response.End();

            #endregion
        }
        catch (Exception ex)
        {
            throw ex;
        }

        #endregion
    }
Beispiel #6
0
    /// <summary>
    /// 標籤檔匯出
    /// </summary>
    private void ExportPickTicket()
    {
        #region

        string s_ErrStoreName = "";

        try
        {
            #region 從資料庫取得資料

            DataTable dtTemp = null;
            IVMModel.VDS_IVM27_BCO BCO = new IVMModel.VDS_IVM27_BCO(ConnectionDB);

            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(GetPICK_BATCHNOChecked());
            ParameterList.Add(SLP_Store1.Text.Trim());
            ParameterList.Add(txt_PoSourceNo.Text.Trim());
            dtTemp = BCO.ExportPickTicket(ParameterList);

            if (dtTemp == null || dtTemp.Rows.Count == 0)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "IVM27", "alert('查無資料');", true);
                return;
            }

            #endregion

            #region 將資料寫入文字檔
            string s_FileName = txt_PickNo.Text;

            if (s_FileName.ToLower().IndexOf(".non") < 0)
            {
                s_FileName = s_FileName + ".non";
            }


            #region 內容
            #region 將 DB 的資料轉換並存入 ArrayList
            System.Text.StringBuilder sb_Out_String = new System.Text.StringBuilder();
            string s_StoreName = "";
            ArrayList al_Out_String = new ArrayList();
            foreach (DataRow dRow in dtTemp.Rows)
            {
                sb_Out_String.Remove(0, sb_Out_String.Length);

                //店號,門市進貨日,路線,路順,店號,店名,理貨批次,理貨儲位,PO單號,1
                //741216,2010/02/25,VK3,013,741216,南崁星光,PK1234451,025,A00201,1,
                sb_Out_String.Append(dRow["STORE"].ToString().PadRight(6, Char.Parse(" ")) + ",");
                sb_Out_String.Append(DateTime.Parse(dRow["ST_ACCEPT_DATE"].ToString()).ToString("yyyy/MM/dd").PadRight(10, Char.Parse(" ")) + ",");
                sb_Out_String.Append(dRow["ROUTE"].ToString().PadRight(3, Char.Parse(" ")) + ",");
                sb_Out_String.Append(dRow["STEP"].ToString().PadRight(3, Char.Parse(" ")) + ",");
                sb_Out_String.Append(dRow["STORE"].ToString().PadRight(6, Char.Parse(" ")) + ",");
                //設定門市名稱長度
                s_StoreName = "";
                s_ErrStoreName = dRow["STORE_NAME"].ToString().Trim();
                s_StoreName = dRow["STORE_NAME"].ToString().Trim() +
                              s_StoreName.PadRight(10 - GetStringLen(dRow["STORE_NAME"].ToString().Trim()), Char.Parse(" "));//VDS_STM_STORE_UNIQUE.STORE_NAME長度為10
                sb_Out_String.Append(s_StoreName + ",");

                sb_Out_String.Append(dRow["pick_batchno"].ToString().PadRight(14, Char.Parse(" ")) + ",");
                sb_Out_String.Append(dRow["pick_locateno"].ToString().PadRight(3, Char.Parse(" ")) + ",");
                sb_Out_String.Append(dRow["po_source_no"].ToString() + ",");
                sb_Out_String.Append("1,");
                al_Out_String.Add(sb_Out_String.ToString());
            }
            #endregion
            #region 開始輸出資料到文字檔案
            Response.Clear();
            Response.Buffer = true;
            Response.Charset = "BIG5";
            Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(s_FileName));
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("BIG5");
            Response.ContentType = "application/ms-txt";
            this.EnableViewState = false;

            System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter oHtmlTextWriter = new HtmlTextWriter(oStringWriter);
            foreach (string s in al_Out_String)
            {
                Response.Write(s);
                Response.Write(oHtmlTextWriter.NewLine);
            }

            Response.End();
            ErrorMsgLabel.Text ="";
            #endregion
            #endregion
            #endregion
        }
        catch (ArgumentOutOfRangeException ex)
        {
            throw new Exception("門市:" + s_ErrStoreName + ",長度超過限制");
        }
        catch (Exception ex)
        {
            throw new Exception("門市:" + s_ErrStoreName + ",發生錯誤,訊息:" + ex.Message);
        }

        #endregion
    }
Beispiel #7
0
    private void QueryData()
    {
        #region
        try
        {
            #region
            string SessionIDName = string.Format("{0}_{1}", strPrefixed, PageTimeStamp.Value);

            DataTable dt = new DataTable();
            IVMModel.VDS_IVM27_BCO BCO = new IVMModel.VDS_IVM27_BCO(ConnectionDB);

            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(txt_PickNo.Text.Trim());
            dt = BCO.QUERY_PICKBATCH(ParameterList);

            bAfterQueryDataBinding = true;

            if (!dt.Columns.Contains("CHECKED"))//增加欄位以方便判別是否可
                dt.Columns.Add("CHECKED");

            if (!dt.Columns.Contains("ROWID"))//增加欄位以判別勾選與否
                dt.Columns.Add("ROWID");


            hidden_RowID_MaxID.Value = dt == null ? "-1" : (dt.Rows.Count - 1).ToString();//記錄最大ROWID
            hidden_RowID_Selected.Value = "";//清空已選ROWID
            hiddenPickBatchNo.Value = "";//清空已選PickBatchNo
            hiddenPickBatchNoAll.Value = "";//清空PickBatchNoAll

            Session[SessionIDName] = dt;

            //StoreCheckBoxChecked(null, true);//預設全勾選

            SetRowIDToDataTable(true);//設定ROWID

            GridView1.DataSource = dt;
            GridView1.PageIndex = 0;
            GridView1.DataBind();
            GridView1.SelectedIndex = -1;

            bAfterQueryDataBinding = false;

            if (dt == null || (dt != null && dt.Rows.Count <= 0))
            {
                ErrorMsgLabel.Text = "查無資料";
                Panel_QueryResult.Visible = false;
            }
            else 
            {
                Panel_QueryResult.Visible = true;
            }
            #endregion
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            UpdatePanel1.Update();
        }

        #endregion
    }