Esempio n. 1
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;
        }
Esempio n. 2
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();
        }
Esempio n. 3
0
        /// <summary>
        /// RCard Burn Out
        /// </summary>
        /// <returns></returns>
        private Messages RunBurnOut(string rcard, string shelfpk)
        {
            if (Resource == null)
            {
                BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode);
            }

            Messages messages = new Messages();

            try
            {
                messages = GetProduct(rcard);
                if (messages.IsSuccess())
                {
                    product                       = (ProductInfo)messages.GetData().Values[0];
                    actionCheckStatus             = new ActionCheckStatus();
                    actionCheckStatus.ProductInfo = product;
                    if (actionCheckStatus.ProductInfo != null)
                    {
                        actionCheckStatus.ProductInfo.Resource = Resource;
                    }

                    IAction         dataCollectModule = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_BurnOutGood);
                    ActionEventArgs actionEventArgs   = new ActionEventArgs(
                        ActionType.DataCollectAction_BurnOutGood,
                        rcard,
                        ApplicationService.Current().UserCode,
                        ApplicationService.Current().ResourceCode,
                        shelfpk,
                        product);
                    messages.AddMessages(((IActionWithStatus)dataCollectModule).Execute(
                                             actionEventArgs,
                                             actionCheckStatus));
                }

                if (messages.IsSuccess())
                {
                    messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_BurnOutSUCCESS,$CS_Param_ID:{0}", rcard)));
                }
                return(messages);
            }
            catch (Exception e)
            {
                messages.Add(new UserControl.Message(e));
                return(messages);
            }
        }
Esempio n. 4
0
        private void ucLabelRcard_TxtboxKeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                if (this.ucLabelSoftVersion.Value.Trim().Length == 0)
                {
                    this.ucLabelSoftVersion.TextFocus(false, true);
                    ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_PleaseChooseSoftVersion"));
                    return;
                }

                if (this.ucLabelRcard.Value == string.Empty)
                {
                    this.ucLabelRcard.TextFocus(false, true);
                    return;
                }
                string   newVersion = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.ucLabelSoftVersion.Value));
                string   rcard      = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.ucLabelRcard.Value));
                Messages msg        = new Messages();
                ((SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = false;
                ((SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();

                try
                {
                    DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                    string            sourceRCard       = dataCollectFacade.GetSourceCard(rcard.Trim().ToUpper(), string.Empty);

                    // 获取要升级的产品序列号信息
                    OnWipSoftVer4Upgrade oldVersion = dataCollectFacade.GetOldSoftVersion(sourceRCard);

                    if (oldVersion == null)
                    {
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Error_Rcard_Or_NOSoftInfo"));
                        this.ucLabelRcard.TextFocus(false, true);
                        return;
                    }
                    // 判断软件版本是否相同,相同就不需要升级了
                    if (string.Compare(oldVersion.SoftwareVersion, newVersion, true) == 0)
                    {
                        ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Normal, "$CS_AlreadyUpgraded"));
                        this.ucLabelRcard.TextFocus(false, true);
                        return;
                    }

                    BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                    Resource resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode);

                    string userCode = ApplicationService.Current().UserCode;

                    // 升级
                    msg.AddMessages(dataCollectFacade.UpgradeNewSoftVer(oldVersion, resource, userCode, newVersion));

                    if (!msg.IsSuccess())
                    {
                        ApplicationRun.GetInfoForm().Add(msg);
                        this.ucLabelRcard.TextFocus(false, true);
                        return;
                    }

                    dtSoftWareVersion.Rows.Add(new object[] { oldVersion.RunningCard, oldVersion.ItemDescription,
                                                              oldVersion.SoftwareVersion, newVersion });
                    dtSoftWareVersion.AcceptChanges();
                    this.ucLabelEditCount.Value = this.dtSoftWareVersion.Rows.Count.ToString();

                    this.ucLabelRcard.TextFocus(false, true);
                }
                catch (Exception ex)
                {
                    ApplicationRun.GetInfoForm().Add(ex.Message);
                    this.ucLabelRcard.TextFocus(false, true);
                }
                finally
                {
                    ((SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
                    ((SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = true;
                }
            }
        }
Esempio n. 5
0
        // Added end

        public override Messages Action(object act)
        {
            Messages           msg     = new Messages();
            ActionOnLineHelper _helper = null;

            BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null;

            if (act == null)
            {
                return(msg);
            }

            DataCollect.Action.ActionEventArgs args;
            if (ObjectState == null)
            {
                args             = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
                args.RunningCard = act.ToString().ToUpper().Trim();
            }
            else
            {
                args = ObjectState as DataCollect.Action.ActionEventArgs;
            }

            string data = act.ToString().ToUpper().Trim();            //Keyparts

            //Laws Lu,2006/06/03	添加	获取已有连接
            if ((act as IDCTClient).DBConnection != null)
            {
                domainProvider = (act as IDCTClient).DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
            }
            else
            {
                domainProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()
                                 as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
                (act as IDCTClient).DBConnection = domainProvider;
            }


            msg = CheckData(data, domainProvider);

            if (keypartsHT == null)
            {
                // 按照逻辑,走到这个分支应该是错误的
                string strFile = @"C:\DCT_EmptyMessage.txt";
                string strLine = DateTime.Now.ToString("yyyy-MM-dd HH:mi:ss") + "\t" + "ActionCollectKeyParts" + "\t" + "Missing Product In Action, RunningCard:" + args.RunningCard + ",Input:" + data;
                System.IO.StreamWriter writer = new System.IO.StreamWriter(strFile, true);
                writer.WriteLine(strLine);
                writer.Close();
                //
                if (msg.IsSuccess() &&
                    (keypartsHT == null || keypartsHT.ContainsKey("ProdcutInfo") == false))
                {
                    //检查序列号
                    _helper = new ActionOnLineHelper(domainProvider);
                    msg     = _helper.GetIDInfo(args.RunningCard);
                    // Added by Icyer 2006/12/14
                    // 检查序列号
                    ProductInfo product = (ProductInfo)msg.GetData().Values[0];
                    if (product == null || product.LastSimulation == null)
                    {
                        msg.ClearMessages();
                        msg.Add(new Message(MessageType.Error, "$NoSimulation"));
                    }
//					base.Action (act);
//					ActionCollectKeyparts actionCollectKeyparts = this;
//					this.NextAction = actionCollectKeyparts;
//					this.Status = ActionStatus.PrepareData;
//					return msg;
                    // Added end
                }

                if (msg.IsSuccess() &&
                    (keypartsHT == null || keypartsHT.ContainsKey("KeypartsInfo") == false))
                {
                    try
                    {
                        keypartsHT = new Hashtable();
                        keypartsHT.Add("ProdcutInfo", msg);

                        ProductInfo product = (ProductInfo)msg.GetData().Values[0];

                        /*	Removed by Icyer 2006/12/14
                         * 如果序列号已在本上料工序,则GetMORouteNextOperation会取下一个工序,导致找不到OPBOM
                         * 改变推导OPBOM的逻辑
                         * ItemFacade itemFacade = new ItemFacade(domainProvider);
                         * object op = itemFacade.GetMORouteNextOperation(
                         *      product.LastSimulation.MOCode,
                         *      product.LastSimulation.RouteCode,
                         *      product.LastSimulation.OPCode);
                         *
                         * OPBOMFacade opBOMFacade=new OPBOMFacade( domainProvider);
                         * object[] objBomDetail = opBOMFacade.GetOPBOMDetails(
                         *      product.LastSimulation.MOCode,
                         *      product.LastSimulation.RouteCode,
                         *      (op as ItemRoute2OP).OPCode);
                         */
                        // Added by Icyer 2006/12/14
                        IDCTClient  client       = act as IDCTClient;
                        OPBOMFacade opBOMFacade  = new OPBOMFacade(domainProvider);
                        object[]    objBomDetail = null;
                        DataCollect.ActionOnLineHelper onLine = new ActionOnLineHelper(domainProvider);
                        Messages messages1 = onLine.CheckID(
                            new CKeypartsActionEventArgs(
                                ActionType.DataCollectAction_CollectKeyParts,
                                product.LastSimulation.RunningCard,
                                client.LoginedUser,
                                client.ResourceCode,
                                product,
                                null,
                                null));
                        if (messages1.IsSuccess() == true)
                        {
                            objBomDetail = opBOMFacade.GetOPBOMDetails(
                                product.NowSimulation.MOCode,
                                product.NowSimulation.RouteCode,
                                product.NowSimulation.OPCode);
                        }
                        else
                        {
                            throw new Exception(messages1.OutPut());
                        }
                        // Added end

                        MOFacade moFacade = new MOFacade(domainProvider);
                        object   mo       = moFacade.GetMO(product.LastSimulation.MOCode);

                        OPBomKeyparts opBomKeyparts = new OPBomKeyparts(objBomDetail, Convert.ToInt32(((MO)mo).IDMergeRule), domainProvider);

                        if (opBomKeyparts.Count == 0)
                        {
                            /*	Removed by Icyer 2006/12/27 @ YHI
                             * msg.Add(new Message(MessageType.Error, "$CS_NOOPBomInfo $CS_Param_MOCode="+product.LastSimulation.MOCode
                             +" $CS_Param_RouteCode="+product.LastSimulation.RouteCode
                             +" $CS_Param_OPCode ="+product.LastSimulation.OPCode));
                             * throw new Exception(msg.OutPut());
                             */
                            throw new Exception("$CS_NOOPBomInfo");
                        }
                        else
                        {
                            //opBomKeyparts.AddKeyparts(data, product.LastSimulation.MOCode);	// Removed by Icyer 2006/12/14

                            keypartsHT.Add("KeypartsInfo", opBomKeyparts);
                        }
                    }
                    catch (Exception ex)
                    {
                        /*	Removed by Icyer 2006/12/27 @ YHI
                         * keypartsHT = null;
                         * this.NeedCancel = true;
                         * throw ex;
                         */
                        // Added by Icyer 2006/12/27 @ YHI
                        base.Action(act);
                        ActionCollectKeyparts actionCollectKeyparts = this;
                        this.NextAction = actionCollectKeyparts;
                        this.Status     = ActionStatus.PrepareData;
                        msg.ClearMessages();
                        msg.Add(new UserControl.Message(MessageType.Error, ex.Message));
                        msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_Keyparts"));
                        return(msg);
                        // Added end
                    }
                }
            }

            if (msg.IsSuccess())
            {
                OPBomKeyparts opBomKeyparts = (OPBomKeyparts)keypartsHT["KeypartsInfo"];
                msg = keypartsHT["ProdcutInfo"] as Messages;
                MO moWillGo = (MO)keypartsHT["MOWillGo"];

                ProductInfo product = (ProductInfo)msg.GetData().Values[0];

                Messages msgResult = new Messages();
                if (opBomKeyparts.Count > opBomKeyparts.GetbomKeypartCount())
                {
                    try
                    {
                        //opBomKeyparts.AddKeyparts(data, product.LastSimulation.MOCode);
                        if (moWillGo == null)
                        {
                            msgResult.AddMessages(opBomKeyparts.AddKeyparts(data, product.LastSimulation.MOCode));
                        }
                        else
                        {
                            msgResult.AddMessages(opBomKeyparts.AddKeyparts(data, moWillGo.MOCode));
                        }
                    }
                    catch (Exception ex)
                    {
                        msgResult.Add(new UserControl.Message(MessageType.Error, ex.Message));
                    }

                    keypartsHT["KeypartsInfo"] = opBomKeyparts;
                }

                if (msgResult.IsSuccess() == false || opBomKeyparts.Count > opBomKeyparts.GetbomKeypartCount())
                {
                    base.Action(act);
                    ActionCollectKeyparts actionCollectKeyparts = this;
                    this.NextAction = actionCollectKeyparts;

                    this.Status = ActionStatus.PrepareData;

                    this.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_Keyparts " + (opBomKeyparts.GetbomKeypartCount() + 1).ToString() + "/" + opBomKeyparts.Count.ToString());
                    if (msgResult.IsSuccess() == false)
                    {
                        //msgResult.Add(new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_Keyparts"));
                        return(msgResult);
                    }
                    else
                    {
                        return(msg);
                    }
                }

                //((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.OpenConnection();
                domainProvider.BeginTransaction();
                try
                {
                    BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider);
                    Resource resource = (Resource)dataModel.GetResource(args.ResourceCode);

                    _helper = new ActionOnLineHelper(domainProvider);
                    DataCollectFacade dataCollect       = new DataCollect.DataCollectFacade(domainProvider);
                    ActionCheckStatus actionCheckStatus = new ActionCheckStatus();
                    actionCheckStatus.ProductInfo          = product;
                    actionCheckStatus.ProductInfo.Resource = resource;
                    ExtendSimulation lastSimulation = actionCheckStatus.ProductInfo.LastSimulation;

                    BenQGuru.eMES.Material.WarehouseFacade wfacade = null;
                    if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                    {
                        wfacade = new WarehouseFacade(domainProvider);
                    }

                    IDCTClient client = act as IDCTClient;

                    msg.AddMessages(_helper.ActionWithTransaction(
                                        new CKeypartsActionEventArgs(
                                            ActionType.DataCollectAction_CollectKeyParts,
                                            product.NowSimulation.RunningCard,
                                            client.LoginedUser,
                                            client.ResourceCode,
                                            product,
                                            opBomKeyparts,
                                            wfacade), actionCheckStatus));

                    // Added by Icyer 2006/12/28 @ YHI	采集集成上料
                    bool bLoadedINNO = false;
                    if (this.NeedCollectINNO == true && msg.IsSuccess() == true)
                    {
                        string strRCard = product.NowSimulation.RunningCard;
                        UserControl.Messages msgProduct = _helper.GetIDInfo(strRCard);
                        product = (ProductInfo)msgProduct.GetData().Values[0];
                        CINNOActionEventArgs argsInno = new CINNOActionEventArgs(
                            ActionType.DataCollectAction_CollectINNO,
                            strRCard,
                            client.LoginedUser,
                            client.ResourceCode,
                            product,
                            INNOCode,
                            wfacade
                            );
                        IAction action = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_CollectINNO);
                        msg.AddMessages(action.Execute(argsInno));
                        if (msg.IsSuccess() == true)
                        {
                            bLoadedINNO = true;
                            msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_INNO_CollectSuccess[" + this.INNOCode + "] $CS_Keyparts_CollectSuccess")));
                        }
                    }
                    // Added end
                    if (msg.IsSuccess())
                    {
                        if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                        {
                            if (wfacade != null)
                            {
                                wfacade.ExecCacheSQL();
                            }
                        }

                        domainProvider.CommitTransaction();
                        if (bLoadedINNO == false)
                        {
                            msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_Keyparts_CollectSuccess")));
                        }
                    }
                    else
                    {
                        domainProvider.RollbackTransaction();
                    }
                }
                catch (Exception ex)
                {
                    domainProvider.RollbackTransaction();

                    msg.Add(new UserControl.Message(ex));
                }
                finally
                {
                    ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection();
                }
                base.Action(act);
                ActionRCard actRcard1 = new ActionRCard();
                actRcard1.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard");
                this.NextAction       = actRcard1;
                this.ObjectState      = null;
                this.keypartsHT       = null;
                this.Status           = ActionStatus.PrepareData;
                return(msg);
            }

            base.Action(act);

            //Web.Helper.ActionType acttype = new Web.Helper.ActionType();
//			if(acttype.Items.Contains(args.RunningCard))
//			{
//				(act as IDCTClient).CachedAction = null;
//			}

            ActionRCard actRcard = new ActionRCard();

            actRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard");
            this.NextAction      = actRcard;
            // Added by Icyer 2006/12/14
            this.ObjectState = null;
            this.keypartsHT  = null;
            this.Status      = ActionStatus.PrepareData;
            // Added end

            return(msg);
        }
Esempio n. 6
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();
            }
        }
Esempio n. 7
0
        private void ucBtnOK_Click(object sender, System.EventArgs e)
        {
            if (this.ucLEMOCode.Value.Trim() == string.Empty)
            {
                this.ucMessage.Add(">>$CS_Please_Input_MOCode");

                ucLEMOCode.TextFocus(false, true);
                return;
            }

            if (this.ucLERunningCard.Value.Trim() == string.Empty)
            {
                this.ucMessage.Add(">>$CS_Please_Input_RunningCard");


                return;
            }

            if (this._moCode == string.Empty)
            {
                if (!this.displayMOInfo())
                {
                    return;
                }
            }

            string runningCard = this.ucLERunningCard.Value.Trim().ToUpper();

            this.ucMessage.Add("<< " + runningCard);

            Messages messages = this._helper.GetIDInfo(runningCard);

            if (messages.IsSuccess())
            {
                ProductInfo product = (ProductInfo)messages.GetData().Values[0];

                // Added by Icyer 2005/10/28
                if (Resource == null)
                {
                    BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                    Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode);
                }
                // Added end

                ActionCheckStatus actionCheckStatus = new ActionCheckStatus();

                if (listActionCheckStatus.ContainsKey(_moCode))
                {
                    actionCheckStatus             = (ActionCheckStatus)listActionCheckStatus[_moCode];
                    actionCheckStatus.ProductInfo = null;
                    actionCheckStatus.ActionList  = new ArrayList();
                }
                else
                {
                    listActionCheckStatus.Add(_moCode, actionCheckStatus);
                }

                GoToMOActionEventArgs args = new GoToMOActionEventArgs(
                    ActionType.DataCollectAction_GoMO,
                    runningCard,
                    ApplicationService.Current().UserCode,
                    ApplicationService.Current().ResourceCode,
                    product,
                    this._moCode);

                IAction action = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_GoMO);

                //Laws Lu,2005/10/19,新增	缓解性能问题
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();
                DataProvider.BeginTransaction();
                try
                {
                    messages.AddMessages(((IActionWithStatus)action).Execute(args, actionCheckStatus));

                    if (messages.IsSuccess())
                    {
                        this.DataProvider.CommitTransaction();
                        messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOMO_CollectSuccess $MOCode={0}", this._moCode)));

                        actionCheckStatus.MO.MOInputQty += actionCheckStatus.MO.IDMergeRule;


                        this.displayMOInfo();
                    }
                    else
                    {
                        this.DataProvider.RollbackTransaction();
                    }
                }
                catch (Exception ex)
                {
                    this.DataProvider.RollbackTransaction();

                    messages.Add(new UserControl.Message(ex));
                }
                finally
                {
                    //Laws Lu,2005/10/19,新增	缓解性能问题
                    ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
                }
            }

            this.ucMessage.Add(messages);
            this.ucMessage.Add(">>$CS_Please_Input_RunningCard");

            this.ucLERunningCard.Value = "";
            this.ucLERunningCard.TextFocus(false, true);
        }