Esempio n. 1
0
 protected override void DeleteDomainObjects(ArrayList domainObjects)
 {
     if(_facade==null)
     {
         _facade = new ShiftModelFacadeFactory(base.DataProvider).Create() ;
     }
     this._facade.DeleteTimePeriod( (TimePeriod[])domainObjects.ToArray( typeof(TimePeriod) ) );
 }
Esempio n. 2
0
        private BenQGuru.eMES.BaseSetting.ShiftModelFacade _facade = null ; //new ShiftModelFacadeFactory().Create();

        protected override void AddDomainObject(object domainObject)
        {
            if(_facade==null)
            {
                _facade = new ShiftModelFacadeFactory(base.DataProvider).Create() ;
            }
            this._facade.AddTimePeriod( (TimePeriod)domainObject );
        }
Esempio n. 3
0
 protected override int GetRowCount()
 {
     if(_facade==null)
     {
         _facade = new ShiftModelFacadeFactory(base.DataProvider).Create() ;
     }
     return this._facade.QueryTimePeriodCount(
         FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtTimePeriodCodeQuery.Text)),
         FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtShiftCodeQuery.Text)));
 }
Esempio n. 4
0
 protected override object[] LoadDataSource(int inclusive, int exclusive)
 {
     if(_facade==null)
     {
         _facade = new ShiftModelFacadeFactory(base.DataProvider).Create() ;
     }
     return this._facade.QueryTimePeriod(
         FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtTimePeriodCodeQuery.Text)),
         FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtShiftCodeQuery.Text)),
         inclusive, exclusive );
 }
Esempio n. 5
0
        protected void drpShiftCodeEdit_Load(object sender, System.EventArgs e)
        {
            if ( !IsPostBack )
            {
                DropDownListBuilder builder = new DropDownListBuilder(this.drpShiftCodeEdit);
                if(_facade==null)
                {
                    _facade = new ShiftModelFacadeFactory(base.DataProvider).Create() ;
                }
                builder.HandleGetObjectList = new BenQGuru.eMES.Web.Helper.GetObjectListDelegate(this._facade.GetAllShift);

                builder.Build("ShiftDescription", "ShiftCode");
            }

            this.drpShiftCodeEdit_SelectedIndexChanged(sender,e);
        }
Esempio n. 6
0
 protected override object GetEditObject(GridRecord row)
 {
     if (_facade == null)
     {
         _facade = new ShiftModelFacadeFactory(base.DataProvider).Create();
     }
     string strCode = string.Empty;
     object objCode = row.Items.FindItemByKey("TimePeriodCode").Value;
     if (objCode != null)
     {
         strCode = objCode.ToString();
     }
     object obj = _facade.GetTimePeriod(strCode);
     if (obj != null)
     {
         return (TimePeriod)obj;
     }
     return null;
 }
Esempio n. 7
0
        protected void drpShiftCodeEdit_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if(_facade==null)
            {
                _facade = new ShiftModelFacadeFactory(base.DataProvider).Create() ;
            }
            object obj = this._facade.GetShift(this.drpShiftCodeEdit.SelectedValue);

            if ( obj == null )
            {
                this.txtShiftTypeCodeEdit.Text = "";
                this.txtShiftBeginTime.Text = "";
                this.txtShiftEndTime.Text = "";

                return;
            }

            this.txtShiftTypeCodeEdit.Text = ((Shift)obj).ShiftTypeCode;
            //			this.txtShiftBeginTime.Text = FormatHelper.ToTimeString( ((Shift)obj).ShiftBeginTime );
            //			this.txtShiftEndTime.Text = FormatHelper.ToTimeString( ((Shift)obj).ShiftEndTime );
        }
Esempio n. 8
0
        protected override object GetEditObject()
        {
            if(_facade==null)
            {
                _facade = new ShiftModelFacadeFactory(base.DataProvider).Create() ;
            }
            TimePeriod timePeriod = this._facade.CreateNewTimePeriod();

            timePeriod.TimePeriodBeginTime		= FormatHelper.TOTimeInt(this.timeTimePeriodBeginTimeEdit.Text);
            timePeriod.TimePeriodEndTime		= FormatHelper.TOTimeInt(this.timeTimePeriodEndTimeEdit.Text);
            timePeriod.IsOverDate				= FormatHelper.BooleanToString(this.chbIsOverDateEdit.Checked);
            timePeriod.TimePeriodCode			= FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtTimePeriodCodeEdit.Text, 40));
            timePeriod.TimePeriodDescription	= FormatHelper.CleanString(this.txtTimePeriodDescriptionEdit.Text, 100);
            timePeriod.TimePeriodType			= this.drpTimePeriodTypeEdit.SelectedValue;
            timePeriod.ShiftCode				= this.drpShiftCodeEdit.SelectedValue;
            timePeriod.ShiftTypeCode			= FormatHelper.CleanString(this.txtShiftTypeCodeEdit.Text, 40);
            timePeriod.TimePeriodSequence		= System.Int32.Parse( this.txtTimePeriodSequenceEdit.Text );
            timePeriod.MaintainUser				= this.GetUserCode();

            return timePeriod;
        }
Esempio n. 9
0
        private void DoAction()
        {
            try
            {
                this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
                Messages msg = new Messages();

                UIFirstOnline ufo = this.cbxBeginTime.ComboBoxData.SelectedItem as UIFirstOnline;
                if (ufo == null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "请选择上班时间"));
                    ApplicationRun.GetInfoForm().Add(msg);
                    return;
                }

                //取得班次信息
                BenQGuru.eMES.BaseSetting.ShiftModelFacade bf    = new BenQGuru.eMES.BaseSetting.ShiftModelFacade(this.DataProvider);
                BenQGuru.eMES.Domain.BaseSetting.Shift     shift = bf.GetShift(ufo._first.ShiftCode) as BenQGuru.eMES.Domain.BaseSetting.Shift;
                if (shift == null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "班次不存在"));
                    ApplicationRun.GetInfoForm().Add(msg);
                    return;
                }

                string itemcode = ufo._first.ItemCode;

                //2006/11/17,Laws Lu add get DateTime from db Server
                DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                DateTime dtNow = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime);

                //DateTime dtNow = DateTime.Now;
                _facade = new FirstOnlineFacade(this.DataProvider);

                DateTime dtShiftDay = dtNow;

                /////如是跨天的班次,并且是处在第二天,则用前一天做为上线日期
                if (shift.IsOverDate == FormatHelper.TRUE_STRING)
                {
                    if (FormatHelper.TOTimeInt(dtShiftDay) < shift.ShiftEndTime)
                    {
                        dtShiftDay = dtShiftDay.AddDays(-1);
                    }
                }

                //object obj_on = _facade.GetFirstOnline(this.ucSSName.Value,FormatHelper.TODateInt(dtShiftDay),itemcode,ul._first.ShiftCode,FormatHelper.TOTimeInt(this.dtpBegin.Text));

                BenQGuru.eMES.Domain.Alert.FirstOnline first_on = ufo._first;                 //= obj_on as BenQGuru.eMES.Domain.Alert.FirstOnline;
//				if(first_on == null)
//				{
//					msg.Add(new UserControl.Message(MessageType.Error,"今天这个上班时间,此产线上此产品还没有首件上线"));//,"$Error_FirstOn_None")); //今天这个班次,此产线上此产品还没有首件上线
//					ApplicationRun.GetInfoForm().Add(msg);
//					return;
//				}

                if (first_on.ActionType == LineActionType.OFF)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "今天这个上班时间,此产线上此产品已经有一个下线首件"));                   //"$Error_FirstOff_Repeat")); //今天这个班次,此产线上此产品已经有一个下线首件
                    ApplicationRun.GetInfoForm().Add(msg);
                    return;
                }

                try
                {
                    first_on.OfflineRuningCard = this.ucRCard.InnerTextBox.Text.Trim();
                    first_on.ActionType        = LineActionType.OFF;
                    first_on.OffLineTime       = FormatHelper.TOTimeInt(dtNow);

                    this.DataProvider.BeginTransaction();

                    this.DataProvider.Update(first_on);

                    TimeSpan it = DateTime.Parse(FormatHelper.ToTimeString(first_on.OffLineTime)) - DateTime.Parse(FormatHelper.ToTimeString(first_on.OnLineTime));

                    //如果跨天,并且是在第二天
                    if (shift.IsOverDate == FormatHelper.TRUE_STRING && FormatHelper.TOTimeInt(dtShiftDay) < shift.ShiftEndTime)
                    {
                        it = DateTime.Parse(FormatHelper.ToTimeString(first_on.OffLineTime)).AddDays(1) - DateTime.Parse(FormatHelper.ToTimeString(first_on.OnLineTime));
                    }


                    ucMessage.Add(new UserControl.Message("上班时间" + FormatHelper.ToTimeString(first_on.ShiftTime) + "," +
                                                          String.Format(_firstMsg,
                                                                        (DateTime.Parse((FormatHelper.ToDateString(first_on.MaintainDate)))).ToLongDateString(),
                                                                        first_on.SSCode,
                                                                        first_on.ItemCode,
                                                                        FormatHelper.ToTimeString(first_on.OnLineTime)
                                                                        )
                                                          )
                                  );

                    ucMessageOff.Add(new UserControl.Message("上班时间" + FormatHelper.ToTimeString(first_on.ShiftTime) + "," +
                                                             String.Format(_offMsg,
                                                                           (DateTime.Parse((FormatHelper.ToDateString(first_on.MaintainDate)))).ToLongDateString(),
                                                                           first_on.SSCode,
                                                                           first_on.ItemCode,
                                                                           FormatHelper.ToTimeString(first_on.OffLineTime),
                                                                           it.Hours,
                                                                           it.Minutes
                                                                           )
                                                             )
                                     );

                    this.DataProvider.CommitTransaction();
                    msg.Add(new UserControl.Message(MessageType.Success, "$Error_FirstOff_Sucess"));                    //首件下线成功
                    ApplicationRun.GetInfoForm().Add(msg);
                    this.cbxBeginTime.ComboBoxData.Items.Clear();
                }
                catch (System.Exception ex)
                {
                    this.DataProvider.RollbackTransaction();
                    msg.Add(new UserControl.Message(MessageType.Error, ex.Message));
                    ApplicationRun.GetInfoForm().Add(msg);
                }
            }
            finally
            {
                this.Cursor        = System.Windows.Forms.Cursors.Arrow;
                this.ucRCard.Value = string.Empty;
                this.ucRCard.TextFocus(false, true);
                CloseConnection();
            }
        }