protected object[] LoadDataSourceBurnIn(int inclusive, int exclusive) { ShelfFacade shelfFacade = new ShelfFacade(base.DataProvider); string shelfpk = this.gridHelper.Grid.Rows[0].Cells.FromKey("ShelfPK").Value.ToString(); object[] objs = null; object obj = shelfFacade.GetShelfActionList(shelfpk); if (obj != null) { objs = new object[] { obj }; } return(objs); }
public void ucbBurnOut_Click(object sender, EventArgs e) { /* 检查车号 */ string shelfno = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.uclShelfNO.Value)); if (shelfno.Length == 0) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_ShelfNO")); Application.DoEvents(); uclShelfNO.TextFocus(true, true); //System.Windows.Forms.SendKeys.Send("+{TAB}"); return; } bool expired = false; for (int i = 0; i < this.ultraDataSource2.Rows.Count; i++) { if (string.Compare(shelfno, this.ultraDataSource2.Rows[i]["ShelfNO2"].ToString()) == 0) { expired = true; break; } } if (!expired) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_Shelf_Not_Expired")); Application.DoEvents(); uclShelfNO.TextFocus(true, true); //System.Windows.Forms.SendKeys.Send("+{TAB}"); return; } Messages messages = new Messages(); if (_shelfFacade == null) { _shelfFacade = new ShelfFacade(this.DataProvider); } ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection(); DataProvider.BeginTransaction(); try { /* step1: 改变shelf的状态 */ object shelf = _shelfFacade.GetShelfAndLockit(shelfno); if (shelf == null) { messages.Add(new UserControl.Message(MessageType.Error, "$CS_Shelf_Not_Exist")); ApplicationRun.GetInfoForm().Add(messages); //RefreshPanel() ; // this.DataProvider.RollbackTransaction(); // Added by Icyer 2006/06/13 @Darfon } if (messages.IsSuccess()) { if ((shelf as Shelf).Status == ShelfStatus.BurnOut) { messages.Add(new UserControl.Message(MessageType.Error, "$CS_Shelf_Has_Burn_Out")); ApplicationRun.GetInfoForm().Add(messages); //RefreshPanel() ; // this.DataProvider.RollbackTransaction(); // Added by Icyer 2006/06/13 @Darfon } } object shelfActionList = null; if (messages.IsSuccess()) { (shelf as Shelf).Status = ShelfStatus.BurnOut; (shelf as Shelf).MaintainUser = ApplicationService.Current().UserCode; /* step2: 记录shelf */ DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); shelfActionList = _shelfFacade.GetShelfActionList(shelfno, ShelfStatus.BurnIn); (shelfActionList as ShelfActionList).Status = ShelfStatus.BurnOut; // (shelfActionList as ShelfActionList).BurnOutDate = FormatHelper.TODateInt( DateTime.Now ); // (shelfActionList as ShelfActionList).BurnOutTIme = FormatHelper.TOTimeInt( DateTime.Now ); (shelfActionList as ShelfActionList).BurnOutDate = dbDateTime.DBDate; (shelfActionList as ShelfActionList).BurnOutTIme = dbDateTime.DBTime;; (shelfActionList as ShelfActionList).BurnOutUser = ApplicationService.Current().UserCode; (shelfActionList as ShelfActionList).MaintainUser = ApplicationService.Current().UserCode; /* step3: 车位计数,减1 */ /* step4: rcard burn Out */ string[] rcards = _shelfFacade.GetShelf2RCard((shelfActionList as ShelfActionList).PKID); if (rcards != null && rcards.Length > 0) { for (int i = 0; i < rcards.Length; i++) { messages.AddMessages(RunBurnOut(rcards[i], (shelfActionList as ShelfActionList).PKID)); if (!messages.IsSuccess()) { break; } } } } if (messages.IsSuccess()) { //Laws Lu,2006/11/31 change update database sequence _shelfFacade.UpdateShelf(shelf as Shelf); //Laws Lu,2006/11/31 update detail data _shelfFacade.UpdateShelfActionList(shelfActionList as ShelfActionList); //Laws Lu,2006/11/31 车位计数 _shelfFacade.UpdateBurnInOutVolumnBySqlMinus(ApplicationService.Current().UserCode); ApplicationRun.GetInfoForm().Add(messages); DataProvider.CommitTransaction(); //RefreshPanel() ; } else { DataProvider.RollbackTransaction(); ApplicationRun.GetInfoForm().Add(messages); //RefreshPanel() ; } } catch (Exception ex) { DataProvider.RollbackTransaction(); if (ex.Message.IndexOf("ORA-00054") >= 0) { messages.Add(new UserControl.Message(MessageType.Error, "$ERR_CURRENT_SHELF_BE_LOCKED")); } else { messages.Add(new UserControl.Message(ex)); } ApplicationRun.GetInfoForm().Add(messages); //RefreshPanel() ; } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); RefreshPanel(); } }