public DataTable QueryTransDetl(ArrayList ParameterList)
 {
     VDS_IVM14_DBO dbo = new VDS_IVM14_DBO(ref USEDB);
     DataTable dtResult;
     try
     {
         dtResult = dbo.QueryTransDetl(ParameterList);
         return dtResult;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public void GetExceptionData(out string strChanNo, out string strStore, out string strSupplier)
        {
            strChanNo = string.Empty;
            strStore = string.Empty;
            strSupplier = string.Empty;

            try
            {
                VDS_IVM14_DBO dbo = new VDS_IVM14_DBO(ref USEDB);
                dbo.GetExceptionData(out strChanNo, out strStore, out strSupplier);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public void CheckTransOutItem(ArrayList ParameterList, out string strErr_No, out string strType, out string strItem_Map, out double List_Price, out string strMsg)
 {
     strErr_No = string.Empty;
     strType = string.Empty;
     strItem_Map = string.Empty;
     strMsg = string.Empty;
     List_Price = 0;
     try
     {
         VDS_IVM14_DBO dbo = new VDS_IVM14_DBO(ref USEDB);
         dbo.CheckTransOutItem(ParameterList, out strErr_No, out strType, out strItem_Map, out List_Price, out strMsg);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public void DeleteTransData(ArrayList ParameterList, DbTransaction RootDBT, out string strResult)
        {
            bool IsRootTranscation = false;

            VDS_IVM14_DBO dbo = new VDS_IVM14_DBO(ref USEDB);
            try
            {
                //判斷是否有傳入Root Transcation 
                IsRootTranscation = (RootDBT == null) ? true : false;

                #region 啟動交易或指定RootTranscation

                if (IsRootTranscation)
                {
                    //獨立呼叫啟動Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                }
                else
                {
                    DBT = RootDBT;
                }

                #endregion

                dbo.DeleteTransData(ParameterList, DBT, out strResult);

                #region 交易成功

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }

                #endregion

            }
            catch (Exception ex)
            {
                #region 交易失敗

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

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

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion

            }

        }
        public void CreateTransIn(ArrayList parameterList, DbTransaction RootDBT,out int intID,out string strTransNo,out string strMsg,out string strResult)
        {
            bool IsRootTranscation = false;

            DBO.VDS_IVM14_DBO IVMM = new VDS_IVM14_DBO(ref USEDB);

            try
            {
                //判斷是否有傳入Root Transcation 
                IsRootTranscation = (RootDBT == null) ? true : false;

                #region 啟動交易或指定RootTranscation

                if (IsRootTranscation)
                {
                    //獨立呼叫啟動Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                }
                else
                {
                    DBT = RootDBT;
                }

                #endregion

                IVMM.CreateTransIn(parameterList, DBT, out intID, out strTransNo, out strMsg, out strResult);

                if (strResult == "0")
                {
                    throw new Exception(strMsg);
                }

                #region 交易成功

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }

                #endregion
            }
            catch (Exception ex)
            {
                #region 交易失敗

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

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

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion

            }
        }
        public void CreateTransferOut(ArrayList parameterList, DataTable Dt_Detail, DbTransaction RootDBT,out string strTrans_No)
        {
            bool IsRootTranscation = false;

            DBO.VDS_IVM14_DBO IVMM = new VDS_IVM14_DBO(ref USEDB);

            try
            {
                //判斷是否有傳入Root Transcation 
                IsRootTranscation = (RootDBT == null) ? true : false;

                #region 啟動交易或指定RootTranscation

                if (IsRootTranscation)
                {
                    //獨立呼叫啟動Transcation
                    Conn = USEDB.CreateConnection();
                    Conn.Open();
                    DBT = Conn.BeginTransaction();
                }
                else
                {
                    DBT = RootDBT;
                }

                #endregion

                int intID = 0;
                string strMsg = string.Empty;
                string strResult = string.Empty;

                ArrayList alDetail = new ArrayList();

                strTrans_No = string.Empty;

                //新增主檔
                IVMM.CreateTransOutMain(parameterList, DBT, out intID, out strTrans_No);

                for (int i = 0; i < Dt_Detail.Rows.Count; i++)
                {
                    alDetail.Clear();

                    alDetail.Add(intID); //0 N_PID
                    alDetail.Add(parameterList[0]); //1 V_SUPPLIER
                    alDetail.Add(parameterList[1]); //2 V_CHAN_NO
                    alDetail.Add(parameterList[2]); //3 V_STORE 
                    alDetail.Add(Dt_Detail.Rows[i]["ITEM"].ToString()); //4 V_ITEM
                    alDetail.Add(Dt_Detail.Rows[i]["PERIOD"].ToString()); //5 V_PERIOD
                    alDetail.Add(Dt_Detail.Rows[i]["TRANS_QTY"].ToString()); //6 N_TRANS_QTY
                    alDetail.Add(parameterList[5]); //7 V_CREATEUID
                    alDetail.Add(parameterList[6]); //8 D_CREATEDATE
                    alDetail.Add(parameterList[7]); //9 V_UPDATEUID
                    alDetail.Add(parameterList[8]); //10 D_UPDATEDATE

                    //新增明細檔
                    IVMM.CreateTransOutDetl(alDetail, DBT, out strMsg, out strResult);

                    if (strResult == "0")
                    {
                        throw new Exception(strMsg);
                    }
                }

                alDetail.Clear();
                alDetail.Add(parameterList[0]);//SUPPLIER
                alDetail.Add(strTrans_No);
                alDetail.Add(parameterList[4]);//LOCATE_SECTION
                alDetail.Add(parameterList[5]);//CREATEUID

                IVMM.GenDocByTransOutNO(alDetail, DBT, out strMsg, out strResult);

                if (strResult == "0")
                {
                    throw new Exception(strMsg);
                }

                #region 交易成功

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation成立
                    DBT.Commit();
                }

                #endregion
            }
            catch (Exception ex)
            {
                #region 交易失敗

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation失敗
                    DBT.Rollback();
                }

                #endregion

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

                if (IsRootTranscation)
                {
                    //獨立呼叫Transcation,關閉連線
                    if (Conn.State == ConnectionState.Connecting)
                    {
                        Conn.Close();
                    }
                }

                #endregion

            }
        }
 public DataTable GetItemByBarCode(ArrayList ParameterList)
 {
     VDS_IVM14_DBO dbo = new VDS_IVM14_DBO(ref USEDB);
     DataTable dtResult;
     try
     {
         dtResult = dbo.GetItemByBarCode(ParameterList);
         return dtResult;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public DataTable GetSourceData(ArrayList ParameterList, out int intTotal_Cnt, out int intNomal_Cnt, out int intErr_Cnt, out int intTotal_Trans_Qty)
 {
     VDS_IVM14_DBO dbo = new VDS_IVM14_DBO(ref USEDB);
     DataTable dtResult;
     try
     {
         dtResult = dbo.GetSourceData(ParameterList,out  intTotal_Cnt,out intNomal_Cnt,out intErr_Cnt,out intTotal_Trans_Qty);
         return dtResult;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }