Exemple #1
0
        private void FFirstOnline_Load(object sender, System.EventArgs e)
        {
            _firstMsg = UserControl.MutiLanguages.ParserMessage("$Error_FirstOn_Time");            //{0}{1}产线首件上线时间是:{2};
            this.ucRCard.TextFocus(false, true);
            Messages msg = new Messages();

            _facade = new FirstOnlineFacade(this.DataProvider);

            //取产线
            BenQGuru.eMES.BaseSetting.BaseModelFacade _baseFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
            Resource res = (Resource)_baseFacade.GetResource(ApplicationService.Current().ResourceCode);

            if (res != null && res.StepSequenceCode != null)
            {
                this.ucSSName.Value = res.StepSequenceCode;
            }
            else
            {
                msg.Add(new UserControl.Message(MessageType.Error, this.ucSSName.Caption + "$Error_Input_Empty"));
                ApplicationRun.GetInfoForm().Add(msg);
                return;
            }

            int i = this._facade.BindShiftTime(this.cbxShiftTime.ComboBoxData.Items, res);

            if (i >= 0)
            {
                this.cbxShiftTime.ComboBoxData.SelectedIndex = i;
                this.dtpBegin.Text = this.cbxShiftTime.ComboBoxData.SelectedItem.ToString();
            }

            this.ucRCard.InnerTextBox.Multiline = false;

            DoSSCodeChange();
        }
Exemple #2
0
        private void FFirstOffline_Load(object sender, System.EventArgs e)
        {
            _firstMsg = UserControl.MutiLanguages.ParserMessage("$Error_FirstOn_Time");           //{0}{1}产线首件上线时间是:{2};
            _offMsg   = UserControl.MutiLanguages.ParserMessage("$Error_FirstOff_Time");          //{0}{1}产线首件下线线时间是:{2},总共时间为{3}小时{4}分种

            this.ucRCard.TextFocus(false, true);
            Messages msg = new Messages();

            _facade = new FirstOnlineFacade(this.DataProvider);
            //取产线
            BenQGuru.eMES.BaseSetting.BaseModelFacade _baseFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
            Resource res = (Resource)_baseFacade.GetResource(ApplicationService.Current().ResourceCode);

            if (res != null && res.StepSequenceCode != null)
            {
                this.ucSSName.Value = res.StepSequenceCode;
            }
            else
            {
                msg.Add(new UserControl.Message(MessageType.Error, this.ucSSName.Caption + "$Error_Input_Empty"));
                ApplicationRun.GetInfoForm().Add(msg);
                return;
            }
            this.ucRCard.InnerTextBox.Multiline = false;
        }
Exemple #3
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();
            }
        }