private void MakeUPDPP(ArrayList parameterList, string filePath)
        {
            CAM07DBO dbo = new CAM07DBO(ref USEDB);
            DataTable dt = dbo.MakeUPDPP(parameterList);

            if (!Directory.Exists(filePath))
            {
                Directory.CreateDirectory(filePath);
            }
            File.Delete(filePath + "\\UPDPP.TXT");
            using (StreamWriter sw = new StreamWriter(filePath + "\\UPDPP.TXT"))
            {
                StringBuilder sb = null;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb = new StringBuilder();
                    string chanSourceNo = dt.Rows[i].IsNull("CHAN_SOURCE_NO") ? " " : dt.Rows[i]["CHAN_SOURCE_NO"].ToString();
                    sb.Append("B").Append(chanSourceNo.PadRight(11, ' '));
                    sb.Append("71163".PadLeft(5, ' '));
                    sb.Append(dt.Rows[i]["STORE"].ToString().Substring(0, 3)).Append(" ");
                    sb.Append(dt.Rows[i]["PURCHASE_DATE"].ToString().PadLeft(7, '0')).Append(" ");
                    sb.Append("0".PadLeft(7, ' ')).Append(" "); //預送日
                    sb.Append("0".PadLeft(7, ' ')).Append(" "); //到貨日
                    sb.Append("0".PadLeft(7, ' ')).Append(" "); //核單日
                    sb.Append("0".PadLeft(7, ' ')).Append(" "); //進貨日
                    sb.Append("0".PadLeft(7, ' ')).Append(" "); //出貨日
                    sb.Append("0".PadLeft(7, ' ')).Append("20").Append(" "); //結款日
                    sb.Append(dt.Rows[i]["TOT_QTY"].ToString().PadLeft(7, ' ')).Append("  ").Append(dt.Rows[i]["TOT_PRICE"].ToString().PadLeft(8, ' ')).Append("  ");
                    sb.Append(dt.Rows[i]["TOT_COST_DIS"].ToString().PadLeft(8, ' ')).Append(" ").Append("0".PadLeft(7, ' ')).Append("  "); //驗收總量
                    sb.Append("0".PadLeft(8, ' ')).Append("  "); //驗收總定價
                    sb.Append("0".PadLeft(8, ' ')).Append(" "); //驗收總成本


                    //2010/06/04:kevin:對應金石堂銷售訂單格式修改要改成
                    sb.Append("1.0000");
                    //sb.Append(dt.Rows[i]["TAX_RATE"].ToString()).Append(" ").Append(dt.Rows[i]["KIND_NUM"].ToString().PadLeft(5, ' '));

                    if (i != dt.Rows.Count - 1)
                    {
                        sb.Append(Environment.NewLine);
                    }
                    sw.Write(sb.ToString());
                }
                sw.Close();
            }
        }
Esempio n. 2
0
        public void CheckTempX_CA(DbTransaction RootDBT, ArrayList ParameterList)
        {
            try
            {
                CAM07DBO dbo = new CAM07DBO(ref USEDB);
                if (RootDBT == null)
                {
                    //獨立呼叫啟動Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                }
                else
                {
                    DBT = RootDBT;
                }

                dbo.doCheckTempX_CA(DBT, ParameterList);

                if (RootDBT == null)
                    DBT.Commit();
            }
            catch (Exception ex)
            {
                #region 交易失敗

                if (RootDBT == null)
                    DBT.Rollback();

                #endregion

                throw ex;
            }
            finally
            {
                #region 判斷是否關閉交易連線

                if (RootDBT == null)        //獨立呼叫Transcation,關閉連線                           
                    if (Conn.State == ConnectionState.Connecting)
                        Conn.Close();
                #endregion
            }

        }
        public string ExportDDD_02(ArrayList parameterList, string filePath)
        {
            CAM07DBO dbo = new CAM07DBO(ref USEDB);
            DataTable dt = dbo.GetCBData(parameterList);

            //下載檔名及路徑 誠品文字檔資料主檔名須為大寫.副檔名須小寫
            string time = DateTime.Now.ToString("yyyyMMddhhmmss");
            string fileName = filePath + "\\AUTOPO_" + time + ".txt";
            string okFile = filePath + "\\AUTOPO_" + time + ".ok";

            using (StreamWriter sw = new StreamWriter(fileName))
            {
                StringBuilder sb = null;
                int seq = 0;
                string v_chanSourceNo = null;
                string ean = null;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    //誠品二段碼超過2碼不上傳
                    if (dt.Rows[i]["PERIOD_BARCODE"].ToString().Length > 2)
                    {
                        ean = dt.Rows[i]["BARCODE"].ToString();
                    }
                    else
                    {
                        ean = dt.Rows[i]["BARCODE"].ToString() + dt.Rows[i]["PERIOD_BARCODE"].ToString();
                    }

                    sb = new StringBuilder();
                    string chanSourceNo = dt.Rows[i].IsNull("CHAN_SOURCE_NO") ? " " : dt.Rows[i]["CHAN_SOURCE_NO"].ToString();
                    string coverPrice = dt.Rows[i]["COVER_PRICE"].ToString();
                    coverPrice = string.Format("{0:##########.00}", decimal.Parse(coverPrice));
                    string price = dt.Rows[i]["PRICE"].ToString();
                    price = string.Format("{0:##########.00}", decimal.Parse(price));
                    string salePrice = dt.Rows[i]["SALE_PRICE"].ToString();
                    salePrice = string.Format("{0:##########.00}", decimal.Parse(salePrice));

                    if ((v_chanSourceNo == null ? "*" : v_chanSourceNo) != (dt.Rows[i].IsNull("CHAN_SOURCE_NO") ? null : dt.Rows[i]["CHAN_SOURCE_NO"].ToString()))
                    {
                        seq = 1;
                    }
                    else
                    {
                        seq = seq + 1;
                    }

                    sb.Append(chanSourceNo.PadRight(10, ' '));
                    sb.Append(seq.ToString().PadLeft(5, ' '));
                    sb.Append(dt.Rows[i]["VENDOR"].ToString().PadRight(10, ' '));
                    sb.Append(dt.Rows[i]["STORE"].ToString().PadRight(4, ' '));
                    sb.Append(dt.Rows[i]["CHAN_ITEM"].ToString().PadRight(18, ' '));
                    sb.Append(dt.Rows[i]["ST_ACCEPT_QTY"].ToString().PadLeft(13, ' '));
                    sb.Append(dt.Rows[i]["ST_ACCEPT_DATE"].ToString().PadRight(8, ' '));
                    sb.Append(dt.Rows[i]["ITEM"].ToString().PadRight(35, ' '));
                    sb.Append(ean.PadRight(18, ' '));
                    sb.Append(coverPrice.PadLeft(14, ' '));
                    sb.Append(price.PadLeft(14, ' '));
                    sb.Append(salePrice.PadLeft(14, ' '));

                    if (i != dt.Rows.Count - 1)
                    {
                        sb.Append(Environment.NewLine);
                    }
                    sw.Write(sb.ToString());

                    v_chanSourceNo = dt.Rows[i].IsNull("CHAN_SOURCE_NO") ? null : dt.Rows[i]["CHAN_SOURCE_NO"].ToString();

                }
                sw.Close();

                using (StreamWriter swOK = new StreamWriter(okFile))
                {
                    swOK.Close();
                }

                MakeBatFile(filePath, time);

                string zipName = filePath + "\\AUTOPO_" + time + ".zip";
                ZipFile z = ZipFile.Create(zipName);
                Environment.CurrentDirectory = filePath + "\\";
                z.BeginUpdate();
                z.Add("AUTOPO_" + time + ".txt");
                z.Add("AUTOPO_" + time + ".ok");
                z.Add("AUTOPO_" + time + ".bat");
                z.CommitUpdate();
                z.Close();

                return zipName;
            }
        }
        private void MakeUPDSP(ArrayList parameterList, string filePath)
        {
            CAM07DBO dbo = new CAM07DBO(ref USEDB);
            DataTable dt = dbo.MakeUPDSP(parameterList);
            File.Delete(filePath + "\\UPDSP.TXT");
            using (StreamWriter sw = new StreamWriter(filePath + "\\UPDSP.TXT"))
            {
                StringBuilder sb = null;
                int seq = 0;
                string v_chanSourceNo = null;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb = new StringBuilder();
                    string chanSourceNo = dt.Rows[i].IsNull("CHAN_SOURCE_NO") ? " " : dt.Rows[i]["CHAN_SOURCE_NO"].ToString();
                    string costDis = dt.Rows[i]["TOT_COST_DIS"].ToString();
                    costDis = Math.Round(decimal.Parse(costDis)).ToString();
                    string orderNo = dt.Rows[i]["ORDER_NO"].ToString();
                    orderNo = orderNo.Substring(orderNo.Length - 10, 10);
                    string price = dt.Rows[i]["TOT_PRICE"].ToString();
                    price = string.Format("{0:######.00}", Math.Round(decimal.Parse(price), 2));

                    if ((v_chanSourceNo == null ? "*" : v_chanSourceNo) != (dt.Rows[i].IsNull("CHAN_SOURCE_NO") ? null : dt.Rows[i]["CHAN_SOURCE_NO"].ToString()))
                    {
                        seq = 1;
                    }
                    else
                    {
                        seq = seq + 1;
                    }

                    sb.Append("B").Append(chanSourceNo.PadRight(11, ' ')).Append(" ");
                    sb.Append(seq.ToString().PadLeft(5, ' '));
                    sb.Append(dt.Rows[i]["STORE"].ToString().Substring(0, 3)).Append(dt.Rows[i]["ITEM_MAP"].ToString().PadRight(13, ' ')).Append(" ");
                    sb.Append(dt.Rows[i]["PURCHASE_QTY"].ToString().PadLeft(5, ' ')).Append(" ");
                    sb.Append(costDis.PadLeft(7, ' ')).Append("  "); //採購成本
                    sb.Append("0".PadLeft(4, ' ')).Append("  "); //驗收量
                    sb.Append(".00".PadLeft(9, ' ')).Append("  "); //驗收成本
                    sb.Append(".00".PadLeft(9, ' ')).Append(" "); //驗收定價
                    sb.Append("B").Append(orderNo).Append(" ");
                    sb.Append(dt.Rows[i]["ORDER_DATE"].ToString().PadLeft(7, '0')).Append("  ");
                    sb.Append(dt.Rows[i]["QTY"].ToString().PadLeft(4, ' ')).Append("K").Append("  "); //原訂量
                    sb.Append(price.PadLeft(9, ' ')).Append(" ").Append("N"); //採購定價

                    if (i != dt.Rows.Count - 1)
                    {
                        sb.Append(Environment.NewLine);
                    }
                    sw.Write(sb.ToString());

                    v_chanSourceNo = dt.Rows[i].IsNull("CHAN_SOURCE_NO") ? null : dt.Rows[i]["CHAN_SOURCE_NO"].ToString();
                }
                sw.Close();
            }
        }
        private void MakeUPDDP(ArrayList parameterList, string filePath)
        {
            CAM07DBO dbo = new CAM07DBO(ref USEDB);
            DataTable dt = dbo.MakeUPDDP(parameterList);
            File.Delete(filePath + "\\UPDDP.TXT");
            using (StreamWriter sw = new StreamWriter(filePath + "\\UPDDP.TXT"))
            {
                StringBuilder sb = null;
                int seq = 0;
                string v_chanSourceNo = null;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    sb = new StringBuilder();
                    string chanSourceNo = dt.Rows[i].IsNull("CHAN_SOURCE_NO") ? " " : dt.Rows[i]["CHAN_SOURCE_NO"].ToString();
                    string itemMap = dt.Rows[i].IsNull("ITEM_MAP") ? " " : dt.Rows[i]["ITEM_MAP"].ToString();

                    //2010/06/04:kevin:對應金石堂銷售訂單格式修改要改成
                    //string discount = ".7300";
                    string discount = dt.Rows[i].IsNull("DISCOUNT") ? ".7300" : dt.Rows[i]["DISCOUNT"].ToString();

                    discount = string.Format("{0:.0000}", decimal.Parse(discount));
                    string price = dt.Rows[i]["TOT_PRICE"].ToString();
                    price = string.Format("{0:#######.00}", decimal.Parse(price));
                    string costDis = dt.Rows[i]["TOT_COST_DIS"].ToString();
                    costDis = string.Format("{0:#######.00}", decimal.Parse(costDis));
                    if ((v_chanSourceNo == null ? "*" : v_chanSourceNo) != (dt.Rows[i].IsNull("CHAN_SOURCE_NO") ? null : dt.Rows[i]["CHAN_SOURCE_NO"].ToString()))
                    {
                        seq = 1;
                    }
                    else
                    {
                        seq = seq + 1;
                    }

                    sb.Append("B").Append(chanSourceNo.PadRight(11, ' ')).Append(" ");
                    sb.Append(seq.ToString().PadLeft(5, ' '));
                    sb.Append(itemMap.PadRight(13, ' '));
                    sb.Append(dt.Rows[i]["ITEM"].ToString().PadRight(10, ' ')).Append("  ");
                    sb.Append(dt.Rows[i]["PRICE"].ToString().PadLeft(6, ' ')).Append(" ");
                    sb.Append(discount.PadLeft(6, ' ')); //折扣
                    sb.Append(" ".PadLeft(12, ' ')).Append("  ");
                    sb.Append(dt.Rows[i]["PURCHASE_QTY"].ToString().PadLeft(6, ' ')).Append("  "); //採購量
                    sb.Append("0".PadLeft(6, ' ')).Append(" "); //驗收量
                    sb.Append("0.00".PadLeft(10, ' ')).Append(" "); //商品驗收定價
                    sb.Append("0.00".PadLeft(10, ' ')).Append(" "); //商品驗收成本
                    sb.Append("Y").Append("71163").Append("   ").Append("1").Append("N").Append(" ");
                    sb.Append(dt.Rows[i]["QTY"].ToString().PadLeft(5, ' ')).Append("     ").Append("K").Append(" ");
                    sb.Append(price.PadLeft(10, ' ')).Append(" ");
                    sb.Append(costDis.PadLeft(10, ' ')).Append(" ").Append("N");

                    if (i != dt.Rows.Count - 1)
                    {
                        sb.Append(Environment.NewLine);
                    }
                    sw.Write(sb.ToString());

                    v_chanSourceNo = dt.Rows[i].IsNull("CHAN_SOURCE_NO") ? null : dt.Rows[i]["CHAN_SOURCE_NO"].ToString();
                }
                sw.Close();
            }
        }
Esempio n. 6
0
 public void LoadDataToTempTableX(DbTransaction transaction, ArrayList ParameterList)
 {
     CAM07DBO dbo = new CAM07DBO(ref USEDB);
     dbo.LoadDataToTempTableX(transaction, ParameterList);
 }
Esempio n. 7
0
 public void LoadDataToTempTable(DbTransaction transaction, string data, int intID)
 {
     CAM07DBO dbo = new CAM07DBO(ref USEDB);
     dbo.LoadDataToTempTable(transaction, data, intID);
 }
Esempio n. 8
0
        public DataTable Query_VDS_CAM_CHAN_LOG_BK(ArrayList ParameterList)
        {
            try
            {
                CAM07DBO DBO = new CAM07DBO(ref USEDB);

                return DBO.doQuery_VDS_CAM_CHAN_LOG_BK(ParameterList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 9
0
        public DataTable QueryErrorByFind(ArrayList ParameterList)
        {
            try
            {
                CAM07DBO DBO = new CAM07DBO(ref USEDB);

                return DBO.doQueryErrorByFind(ParameterList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 10
0
        public string[] LoadPOSX(ArrayList ParameterList)
        {
            try
            {
                CAM07DBO DBO = new CAM07DBO(ref USEDB);

                return DBO.DoLoadPOSX(ParameterList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 11
0
      /// <summary>
      /// 取得CA期別
      /// </summary>
      /// <param name="ParameterList"></param>
      /// <returns></returns>
        public void Get_CA_Period(ArrayList ParameterList,out string strNewItem,out string strNewPeriod)
        {
            try
            {
                CAM07DBO DBO = new CAM07DBO(ref USEDB);

                DBO.DoGet_CA_Period(ParameterList, out strNewItem, out strNewPeriod);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 12
0
 public void ClearTempTablesX(ArrayList ParameterList)
 {
     CAM07DBO dbo = new CAM07DBO(ref USEDB);
     dbo.ClearTempTablesX(ParameterList);
 }
Esempio n. 13
0
 public void ClearTempTables()
 {
     CAM07DBO dbo = new CAM07DBO(ref USEDB);
     dbo.ClearTempTables();
 }