///更新商品期別主檔 //依傳入的明細資料集參數,將正常品資料回寫生效中(enable=1)的商品屬性檔(VDS_ITM_PERIOD_PROFILE)的下列欄位 //(update VDS_ITM_PERIOD_PROFILE where enable=1 and item=[@品號] and period=[@期別]) //(0)Item //(1)Period //(2)1包裝數package_unit //(3)單品重量s_weight //(4)單品長度s_length //(5)單品寬度s_width //(6)單品高度s_height //(7)包裝重量p_weight //(8)包裝長度p_length //(9)包裝寬度p_width //(10)包裝高度p_height //(11)驗收日期accept_date //(12)到貨數accept_qty //(13)有效日期 validDate(string) //(14)允收日期 AllowAccept_Date(string) //()可允收天數accept_days=[@有效日期]-[@允收日期]+1 ([@有效日期]及[@允收日期]<>null時更新此欄位) //()可出貨天數的計算方式如下:([@有效日期]及[@允收日期]<>null時更新此欄位) //*若[可允收天數]>212,則[可出貨天數]=29 //*若212>=[可允收天數]>121,則[可出貨天數]=19 //*若121>=[可允收天數]>50,則[可出貨天數]=9 //*若50>=[可允收天數]>24,則[可出貨天數]=4 //*若[可允收天數]<=24,則[可出貨天數]=0 public void UpdateItmPeriodProfile(string UserID, string UpdateDate, ArrayList ParameterList, DbTransaction RootDBT, out int accept_days, out int out_days) { DBO.MaintainAcceptDBO dbo = new DBO.MaintainAcceptDBO(ref USEDB); string ValidDate = ParameterList[13].ToString(); string AllowAccept_Date = ParameterList[14].ToString(); accept_days = -1; out_days = -1; if (ValidDate != string.Empty && AllowAccept_Date != string.Empty) { DateTime dtValid = DateTime.ParseExact(ValidDate, "yyyy/MM/dd", null); DateTime dtAllow = DateTime.ParseExact(AllowAccept_Date, "yyyy/MM/dd", null); // 計算差異天數 TimeSpan tsDay = dtValid - dtAllow; accept_days = (int)tsDay.TotalDays + 1; out_days = GetOutDays(accept_days); } bool IsRootTranscation = false; 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 ArrayList SQLParameters = new ArrayList(); SQLParameters.Clear(); SQLParameters.Add(UserID); //0 string SQLParameters.Add(UpdateDate); //1 string SQLParameters.Add(ParameterList[0]); //2 string SQLParameters.Add(ParameterList[1]); //3 string SQLParameters.Add(ParameterList[2]); //4 int 一包裝數 SQLParameters.Add(ParameterList[3]); //5 double 3-10 共八個都是 double (SIZE) SQLParameters.Add(ParameterList[4]); //6 double SQLParameters.Add(ParameterList[5]); //7 double SQLParameters.Add(ParameterList[6]); //8 double SQLParameters.Add(ParameterList[7]); //9 double SQLParameters.Add(ParameterList[8]); //10 double SQLParameters.Add(ParameterList[9]); //11 double SQLParameters.Add(ParameterList[10]); //12 double SQLParameters.Add(ParameterList[11]); //13 string SQLParameters.Add(ParameterList[12]); //14 int SQLParameters.Add(accept_days); //15 int SQLParameters.Add(out_days); //16 int int Res = dbo.UpdateItmPeriodProfile(SQLParameters, DBT); } catch (Exception ex) { #region 交易失敗 if (IsRootTranscation) { //獨立呼叫Transcation失敗 DBT.Rollback(); } #endregion throw ex; } }