Esempio n. 1
0
        private void RefreshSample()
        {
            //预警样例
            string currsample = null;

            if (this.lbxSample.SelectedItem != null)
            {
                currsample = this.lbxSample.SelectedItem.ToString();
            }

            this.lbxSample.Items.Clear();
            BenQGuru.eMES.AlertModel.AlertFacade facade = new BenQGuru.eMES.AlertModel.AlertFacade(DataProvider);
            object[] objs = facade.QueryAlertSample();
            if (objs == null)
            {
                return;
            }
            foreach (object obj in objs)
            {
                BenQGuru.eMES.Domain.Alert.AlertSample sample = obj as BenQGuru.eMES.Domain.Alert.AlertSample;
                if (sample != null)
                {
                    this.lbxSample.Items.Add(sample.SampleDesc);
                }
            }

            if (currsample != null && currsample != string.Empty)
            {
                this.lbxSample.SelectedItem = currsample;
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                // 初始化页面语言
                this.InitPageLanguage(this.languageComponent1, false);
            }

            _facade     = new BenQGuru.eMES.AlertModel.AlertFacade(DataProvider);
            _alertConst = new AlertConst(this.languageComponent1);
            try
            {
                _alertID = int.Parse(Request.QueryString["alertid"]);
            }
            catch
            {
                _alertID = 0;
            }
        }
Esempio n. 3
0
        private void btnConfirm_Click(object sender, System.EventArgs e)
        {
            try
            {
                this.Cursor = System.Windows.Forms.Cursors.WaitCursor;

                Messages msg = new Messages();
                if (this.txtAlertMsg.InnerTextBox.Text.Trim() == string.Empty)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, this.txtAlertMsg.Caption + " $Error_Input_Empty"));
                    ApplicationRun.GetInfoForm().Add(msg);
                    return;
                }

                if (this.txtMOCode.InnerTextBox.Text.Trim() == string.Empty)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, this.txtMOCode.Caption + " $Error_Input_Empty"));
                    ApplicationRun.GetInfoForm().Add(msg);
                    this.txtMOCode.TextFocus(false, true);
                    return;
                }

                //根据工单得到产品代码
                BenQGuru.eMES.MOModel.MOFacade  moFacade = new MOFacade(this.DataProvider);
                BenQGuru.eMES.Domain.MOModel.MO mo       = moFacade.GetMO(this.txtMOCode.InnerTextBox.Text.Trim()) as BenQGuru.eMES.Domain.MOModel.MO;
                string productcode;
                if (mo != null)
                {
                    productcode = mo.ItemCode;
                }
                else
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$ManualAlert_MOCode_Error"));                    //工单号码输入错误
                    ApplicationRun.GetInfoForm().Add(msg);
                    this.txtMOCode.TextFocus(false, true);
                    return;
                }
                try
                {
                    DataProvider.BeginTransaction();

                    BenQGuru.eMES.AlertModel.AlertFacade facade = new BenQGuru.eMES.AlertModel.AlertFacade(DataProvider);
                    BenQGuru.eMES.Domain.Alert.Alert     alert  = facade.CreateNewAlert();

                    alert.ItemCode    = string.Empty;
                    alert.AlertItem   = string.Empty;
                    alert.AlertStatus = BenQGuru.eMES.AlertModel.AlertStatus_Old.Unhandled;
                    alert.AlertType   = BenQGuru.eMES.AlertModel.AlertType_Old.Manual;

                    //Laws Lu,2006/11/13 uniform system collect date
                    DBDateTime dbDateTime;

                    dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);


                    alert.MaintainDate = dbDateTime.DBDate;
                    alert.MaintainUser = ApplicationService.Current().UserCode;
                    alert.MaintainTime = dbDateTime.DBTime;

                    alert.AlertLevel  = this._levelDict[this.cbAlertLevel.ComboBoxData.SelectedItem.ToString()];
                    alert.AlertMsg    = ApplicationService.Current().ResourceCode + ":" + this.txtAlertMsg.InnerTextBox.Text;
                    alert.Description = string.Empty;
                    alert.MailNotify  = "N";
                    alert.AlertValue  = 0;

                    alert.ProductCode = productcode;
                    //单得到产线代码
                    BenQGuru.eMES.BaseSetting.BaseModelFacade baseFacade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                    Resource res = baseFacade.GetResource(ApplicationService.Current().ResourceCode) as Resource;
                    if (res != null)
                    {
                        alert.SSCode = res.StepSequenceCode;
                    }

                    alert.AlertMsg = this.txtAlertMsg.InnerTextBox.Text + "," +
                                     "产品: " +
                                     alert.ProductCode +
                                     ", 资源: " + ApplicationService.Current().ResourceCode;
                    facade.AddAlert(alert);

                    DataProvider.CommitTransaction();

                    msg.Add(new UserControl.Message(MessageType.Success, "$ManualAlert_Add_Success"));
                    ApplicationRun.GetInfoForm().Add(msg);
                    this.txtAlertMsg.InnerTextBox.Text = string.Empty;

                    //刷新Sample
                    //RefreshSample();
                }
                catch (System.Exception ex)
                {
                    DataProvider.RollbackTransaction();
                    msg.Add(new UserControl.Message(MessageType.Error, ex.Message));
                    ApplicationRun.GetInfoForm().Add(msg);
                }
            }
            finally
            {
                this.Cursor = System.Windows.Forms.Cursors.Default;
                this.CloseConnection();
            }
        }