//IVM157.aspx /// <summary> /// 手開揀貨單 /// </summary> /// <param name="ParameterList">UserID、BDISNo、EDISNo、AcceptDate、ApprovedDate、RootNo、PMA</param> /// <param name="RootDBT"></param> /// <param name="OK"></param> /// <param name="PickNo"></param> /// <returns></returns> public bool CreateByCRMOrder(ArrayList ParameterList, out string PickNo,out string MSG, out int N_OK, DbTransaction RootDBT) { bool IsRootTranscation = false; MSG = ""; try { DBO.VDS_IVM15_DBO IVMDBO = new VDS_IVM15_DBO(ref USEDB); IsRootTranscation = (RootDBT == null) ? true : false; #region 啟動交易或指定RootTranscation if (IsRootTranscation) { //獨立呼叫啟動Transcation Conn = USEDB.CreateConnection(); Conn.Open(); DBT = Conn.BeginTransaction(); } else { DBT = RootDBT; } #endregion IVMDBO.CreateByCRMOrder(ParameterList, out PickNo,out MSG, out N_OK, DBT); #region 交易成功 if (IsRootTranscation) { //獨立呼叫Transcation成立 DBT.Commit(); } return true; #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 } }