Example #1
0
 private static Response Process(string input, string[] args)
 {
     try
     {
         switch (args[0])
         {
             case "compile":
                 return Compiler.Compile(JsonConvert.DeserializeObject<CompileRequest>(input));
             case "nunit":
                 return NUnitTester.Test(JsonConvert.DeserializeObject<TestRequest>(input));
             case "nugetpack":
                 return NuGetter.Pack(JsonConvert.DeserializeObject<NuGetPackRequest>(input));
             case "nugetpush":
                 return NuGetter.Push(JsonConvert.DeserializeObject<NuGetPushRequest>(input));
             case "nugetrestore":
                 return NuGetter.Restore(JsonConvert.DeserializeObject<NuGetRestoreRequest>(input));
             default:
                 throw new ApplicationException("Unsupported type '" + args[0] + "'");
         }
     }
     catch (Exception e)
     {
         var messages = new Messages();
         messages.Add(Message.CreateError(e.ToString()));
         return new Response(messages);
     }
 }
        public async Task ConnectAsync()
        {
            _subscriptionSource = new CancellationTokenSource();
            var messages = (await _chatService.GetChannelMessagesAsync(_channel.Id))
                           .Select(message => new MessageViewModel(message));

            if (Messages == null)
            {
                Messages = new ObservableCollection <MessageViewModel>(messages);
            }
            else
            {
                foreach (var message in messages.Where(m => !Messages.Any(x => x.Id == m.Id)))
                {
                    Messages.Add(message);
                }
            }

            var subscription = await _chatService.SubscribeToChannelMessagesAsync(_channel.Id, _subscriptionSource.Token);

            _messagesSubscription = subscription
                                    .Subscribe(x =>
            {
                // Make sure that this is run in the UI thread. Could use ObserveOn instead
                _dispatcher.Invoke(() =>
                {
                    if (!Messages.Any(m => m.Id == x.Id))
                    {
                        Messages?.Add(new MessageViewModel(x));
                    }
                });
            });
        }
Example #3
0
        public ServerViewModel(IWCFHostService hostService, IUnitOfWork db, ISettingsService settingsService, IDialogService dialogService)
        {
            this.hostService     = hostService;
            this.db              = db;
            this.settingsService = settingsService;
            this.dialogService   = dialogService;

            Client = new ChatWCFService.Client(settingsService.Name);
            Port   = settingsService.Port;
            hostService.ClientConnected += (s, e) =>
            {
                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                {
                    ConnectedClients.Add(e.Client);
                    Notifications.Add(new Notification($"Client {e.Client.Name} connected", DateTime.Now, NotificationType.ClientConnected));
                });
            };
            hostService.ClientDisconneced += (s, e) =>
            {
                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                {
                    var client = ConnectedClients.Where(c => c.Name == e.Client.Name).FirstOrDefault();
                    ConnectedClients.Remove(client);
                    Notifications.Add(new Notification($"Client {e.Client.Name} disconnected", DateTime.Now, NotificationType.ClientDisconnected));
                });
            };
            hostService.MessageReceived += (s, e) =>
            {
                DispatcherHelper.CheckBeginInvokeOnUI(() => {
                    Messages?.Add(new Model.Message(e.Message));
                });
            };

            DispatcherHelper.RunAsync(async() =>
            {
                var messages = (await db.Messages.GetAll()).Select(m => new Model.Message(m));
                foreach (var message in messages)
                {
                    Messages.Add(message);
                }
            });
            Messenger.Default.Register <NotificationMessage>(this, (m) => {
                switch (m.Notification)
                {
                case "ServerWindowClosed": StopServer(); break;
                }
            });
        }
Example #4
0
        /// <summary>
        /// Writes the line.
        /// </summary>
        /// <param name="message">The message.</param>
        public static void WriteLine(string message)
        {
            lastTraceMessage = message;

            string timedMessage = GetTimedMessage(string.Empty, message);

            if (LogToTrace)
            {
                Trace.WriteLine(timedMessage);
            }

            if (LogToConsole)
            {
                Console.WriteLine(timedMessage);
            }

            if (LogToFile)
            {
                WriteMessageToLogFile(timedMessage);
            }

            Messages?.Add(timedMessage);
        }
Example #5
0
 public QuantityExceeded(int exceededBy)
 {
     Messages.Add($"Maximum item quantity exceeded by {exceededBy}.");
 }
Example #6
0
 private void SkipMessage(string msg)
 {
     Messages.Add(msg);
     Logger.WriteLine(msg);
 }
Example #7
0
 /// <summary>
 /// Handles new incoming chat message.
 /// </summary>
 private void ChatService_NewMessageReceived(object sender, ChatMessage e)
 {
     Dispatcher.RequestMainThreadAction(() => Messages.Add(e));
 }
Example #8
0
 private void OnMessageReceived(string message)
 {
     Messages.Add(message);
 }
Example #9
0
 public MissingConsoleCommandResult()
 {
     Messages.Add(new ConsoleMessage("Command not found", ConsoleResultStatus.Error, false));
 }
Example #10
0
        public override Messages Action(object act)
        {
            Messages msg = new Messages();

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

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

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

            DataCollect.Action.ActionEventArgs args;
            if (ObjectState == null)
            {
                args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
            }
            else
            {
                args = ObjectState as DataCollect.Action.ActionEventArgs;
            }

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

            //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 (msg.IsSuccess())
            {
                //检查序列号

                ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);
                msg = _helper.GetIDInfo(args.RunningCard);

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

                    TSModelFacade tsmodelFacade = new TSModelFacade(domainProvider);

                    if (msg.IsSuccess())
                    {
                        SystemSettingFacade systemSettingFacade = new SystemSettingFacade(domainProvider);
                        object parameter = systemSettingFacade.GetParameter("DEFAULTERRORCODE", "NGCOLLECTDEFAULTERRORCODE");
                        if (parameter == null)
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$Error_NoDefaultErrorCode"));
                            msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"));
                            this.Status     = ActionStatus.PrepareData;
                            this.FlowDirect = FlowDirect.WaitingInput;
                            //base.Action(act);
                            return(msg);
                        }
                        Parameter errorCodeParameter = parameter as Parameter;
                        object    errorCode          = tsmodelFacade.GetErrorCode(errorCodeParameter.ParameterAlias);
                        if (errorCode == null)
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$ErrorCode_Not_Exist"));
                            msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"));
                            this.Status     = ActionStatus.PrepareData;
                            this.FlowDirect = FlowDirect.WaitingInput;
                            return(msg);
                        }

                        object[] ecgObjects = tsmodelFacade.GetErrorCodeGroupByErrorCodeCode(((ErrorCodeA)errorCode).ErrorCode);
                        if (ecgObjects == null || ecgObjects.Length == 0)
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$Error_ErrorCodeNoErrorGroup"));
                            msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"));
                            this.Status     = ActionStatus.PrepareData;
                            this.FlowDirect = FlowDirect.WaitingInput;
                            return(msg);
                        }

                        ErrorCodeGroup2ErrorCode ecg2ec = (ErrorCodeGroup2ErrorCode)tsmodelFacade.GetErrorCodeGroup2ErrorCodeByecCode(((ErrorCodeA)errorCode).ErrorCode);

                        object[] errorcodes = new object[] { ecg2ec };
                        //if (msg.IsSuccess())
                        //{
                        //    string strModelCode = this.GetModelCodeFromProduct(product, this.moWillGo, domainProvider);
                        //    if (strModelCode != "")
                        //    {
                        //        errorcodes = tsmodelFacade.QueryECG2ECByECAndModelCode(new string[] { ((ErrorCodeA)errorCode).ErrorCode }, strModelCode);
                        //    }

                        //    if (errorcodes == null || errorcodes.Length == 0)
                        //    {
                        //        msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$ErrorCode_Not_BelongTo_ModelCode"));
                        //        base.Action(act);
                        //        ActionRCard actRcard = new ActionRCard();
                        //        this.NextAction = actRcard;
                        //        return msg;
                        //    }
                        //}

                        if (msg.IsSuccess())
                        {
                            IAction dataCollectModule
                                = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_NG);
                            domainProvider.BeginTransaction();
                            try
                            {
                                IDCTClient client = act as IDCTClient;

                                msg.AddMessages(((IActionWithStatus)dataCollectModule).Execute(
                                                    new TSActionEventArgs(ActionType.DataCollectAction_NG,
                                                                          args.RunningCard,
                                                                          client.LoginedUser,
                                                                          client.ResourceCode,
                                                                          product,
                                                                          errorcodes,
                                                                          null,
                                                                          "")));

                                if (msg.IsSuccess())
                                {
                                    domainProvider.CommitTransaction();
                                    base.Action(act);
                                    msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_NGSUCCESS")));
                                    return(msg);
                                }
                                else
                                {
                                    domainProvider.RollbackTransaction();
                                }
                            }
                            catch (Exception ex)
                            {
                                domainProvider.RollbackTransaction();
                                msg.Add(new UserControl.Message(ex));
                            }
                            finally
                            {
                                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection();
                            }
                        }
                    }
                }
            }
            if (msg.IsSuccess())
            {
                base.Action(act);
            }
            else
            {
                msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"));
                this.FlowDirect = FlowDirect.WaitingInput;
            }
            return(msg);
        }
Example #11
0
 public void AddMessage(Message message, object parameters)
 {
     Messages.Add(new ResponseFilterMessage(message, parameters));
 }
Example #12
0
 public void AddMessage(Message <object> message)
 {
     Messages.Add(message);
     Parent?.AddMessage(message);
 }
Example #13
0
        public Messages CheckProduct(string rcard, object act)
        {
            currentProductInfo = null;
            moWillGo           = null;
            Messages msg = new Messages();

            BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null;
            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;
            }
            ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);

            msg = _helper.GetIDInfo(rcard);
            if (msg.IsSuccess())
            {
                IDCTClient  client       = (IDCTClient)act;
                ProductInfo product      = (ProductInfo)msg.GetData().Values[0];
                bool        bNeedCheckMO = false;
                if (product == null || product.LastSimulation == null)
                {
                    /*	需要再检查是否归属工单
                     * msg.Add(new UserControl.Message(UserControl.MessageType.Error,"$NoSimulation"));
                     * return msg;
                     */
                    bNeedCheckMO = true;
                }
                else
                {
                    // 如果完工,并且当前资源不属于Simulation的当前工序,则需要检查归属工单
                    if (product.LastSimulation.IsComplete == "1")
                    {
                        BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider);
                        if (dataModel.GetOperation2Resource(product.LastSimulation.OPCode, client.ResourceCode) == null)
                        {
                            bNeedCheckMO = true;
                        }
                    }
                }
                Messages msgChkErr = new Messages();
                if (bNeedCheckMO == true)
                {
                    ActionGoToMO actionGoMO = new ActionGoToMO(domainProvider);
                    Messages     msgMo      = actionGoMO.GetItemCodeFromGoMoRCard(client.ResourceCode, rcard);
                    if (msgMo.IsSuccess() == false)             // 如果有错误,表示需要归属工单,但是解析工单或查询工单发生错误
                    {
                        msgChkErr.AddMessages(msgMo);
                    }
                    else        // 返回成功,有两种情况:需要归属工单并且返回正确的工单信息;不需要归属工单
                    {
                        UserControl.Message msgMoData = msgMo.GetData();
                        if (msgMoData != null && msgMoData.Values.Length > 0)           // 有DATA数据,表示需要归属工单
                        {
                            this.moWillGo = (MO)msgMoData.Values[0];
                        }
                        else            // 如果没有DATA数据,表示不需要归属工单,则调用以前的代码:如果LastSimulation为空,则报没有序列号
                        {
                            if (product.LastSimulation == null)
                            {
                                msgChkErr.Add(new UserControl.Message(UserControl.MessageType.Error, "$NoSimulation"));
                            }
                        }
                    }
                }
                if (msgChkErr.IsSuccess() == false)
                {
                    return(msgChkErr);
                }

                if (product.LastSimulation != null)             // 只有在序列号存在的情况下才检查途程
                {
                    msg = _helper.CheckID(new TSActionEventArgs(ActionType.DataCollectAction_NG,
                                                                rcard,
                                                                client.LoginedUser,
                                                                client.ResourceCode,
                                                                product,
                                                                new object[] { },
                                                                null,
                                                                ""));
                }
                if (product.LastSimulation == null || msg.IsSuccess() == true)
                {
                    currentProductInfo = product;
                }
                else if (product.LastSimulation.LastAction == ActionType.DataCollectAction_GOOD ||
                         product.LastSimulation.LastAction == ActionType.DataCollectAction_NG ||
                         product.LastSimulation.LastAction == ActionType.DataCollectAction_OutLineGood ||
                         product.LastSimulation.LastAction == ActionType.DataCollectAction_OutLineNG)   // 允许测试站重复采集
                {
                    BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider);
                    if (dataModel.GetOperation2Resource(product.LastSimulation.OPCode, (act as IDCTClient).ResourceCode) != null)
                    {
                        msg.ClearMessages();
                        currentProductInfo = product;
                    }
                }
            }
            return(msg);
        }
Example #14
0
 public void OnMessageReceived(object sender, MessageReceiveEventArgs messageReceiveEventArgs)
 {
     System.Windows.Application.Current.Dispatcher
     .Invoke(() => Messages.Add(messageReceiveEventArgs.Message));
 }
Example #15
0
        public override Messages Action(object act)
        {
            Messages msg = new Messages();

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

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

            IDCTClient client = act as IDCTClient;

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

            DataCollect.Action.ActionEventArgs args;
            if (ObjectState == null)
            {
                args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
            }
            else
            {
                args = ObjectState as DataCollect.Action.ActionEventArgs;
            }

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

            //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;
            }


            if (string.Compare(data, BaseDCTDriver.FINERROR, true) != 0)           //结束的标志
            {
                msg = CheckData(data, domainProvider);

                if (msg.IsSuccess())
                {
                    if (_currInputStep.StepType == InputStepType.ErrorCode)  //一次完整的ErrorCode 与 Error Location的输入完成
                    {
                        if (errorCodesHT == null)
                        {
                            errorCodesHT = new Hashtable();
                        }

                        string key = _currInputStep.ErrorCode + "&" + _currInputStep.ErrorLoc;

                        bool bExist = false;
                        if (!errorCodesHT.ContainsKey(key))
                        {
                            errorCodesHT.Add(key, key);
                        }
                        else
                        {
                            bExist = true;
                        }


                        if (bExist == false)
                        {
                            //msg.Add(new UserControl.Message(MessageType.Succes,data));	// Removed by Icyer 2007/01/09	避免重复输出
                        }
                        else
                        {
                            msg.Add(new UserControl.Message(MessageType.Success, "$ErrorCodeCollected"));
                        }
                        this.Status = ActionStatus.PrepareData;
                        return(msg);
                    }
                    else
                    {
                        this.Status = ActionStatus.PrepareData;
                        return(msg);
                    }
                }
                else
                {
                    this.Status = ActionStatus.PrepareData;
                    return(msg);
                }
            }

            if (msg.IsSuccess())
            {
                //检查序列号

                ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);

                msg = _helper.GetIDInfo(args.RunningCard);

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

                    TSModelFacade tsmodelFacade = new TSModelFacade(domainProvider);

                    if (errorCodesHT == null)
                    {
                        msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$ErrorCode_Not_Exist"));
                    }

                    if (msg.IsSuccess())
                    {
                        #region 得到用户输入的 Error Code和Error Location

                        BenQGuru.eMES.Domain.TS.TSErrorCode2Location[] errorInfo = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location[errorCodesHT.Count];
                        TSModel.TSModelFacade tsFacade = new TSModelFacade(domainProvider);
                        int i = 0;
                        foreach (DictionaryEntry dic in errorCodesHT)
                        {
                            string[] keys = dic.Key.ToString().Split('&');
                            if (keys.Length > 1)
                            {
                                //没有Location
                                if (keys[1].Contains(NoLoc))
                                {
                                    object[] objs = tsFacade.GetErrorCodeGroupByErrorCodeCode(keys[0]);
                                    errorInfo[i] = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location();
                                    if (objs != null && objs.Length > 0)
                                    {
                                        ErrorCodeGroupA errorgroup = (ErrorCodeGroupA)objs[0];
                                        errorInfo[i].ErrorCode      = keys[0];
                                        errorInfo[i].ErrorCodeGroup = errorgroup.ErrorCodeGroup;
                                        errorInfo[i].ErrorLocation  = string.Empty;
                                        errorInfo[i].AB             = ItemLocationSide.ItemLocationSide_AB;
                                    }
                                }
                                else //有location
                                {
                                    object[] objs = tsFacade.GetErrorCodeGroupByErrorCodeCode(keys[0]);
                                    errorInfo[i] = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location();
                                    if (objs != null && objs.Length > 0)
                                    {
                                        ErrorCodeGroupA errorgroup = (ErrorCodeGroupA)objs[0];
                                        errorInfo[i].ErrorCode      = keys[0];
                                        errorInfo[i].ErrorCodeGroup = errorgroup.ErrorCodeGroup;
                                        errorInfo[i].ErrorLocation  = keys[1];
                                        errorInfo[i].AB             = ItemLocationSide.ItemLocationSide_AB;
                                    }
                                }
                            }
                            else //没有Location
                            {
                                object[] objs = tsFacade.GetErrorCodeGroupByErrorCodeCode(keys[0]);
                                errorInfo[i] = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location();
                                if (objs != null && objs.Length > 0)
                                {
                                    ErrorCodeGroupA errorgroup = (ErrorCodeGroupA)objs[0];
                                    errorInfo[i].ErrorCode      = keys[0];
                                    errorInfo[i].ErrorCodeGroup = errorgroup.ErrorCodeGroup;
                                    errorInfo[i].ErrorLocation  = string.Empty;
                                    errorInfo[i].AB             = ItemLocationSide.ItemLocationSide_AB;
                                }
                            }

                            i++;
                        }

                        #endregion

                        /*
                         * string[] errorcs = new string[errorCodesHT.Count];
                         *                      int i=0;
                         *                      foreach( DictionaryEntry dic in errorCodesHT )
                         *                      {
                         *                              errorcs[i] = dic.Key.ToString();
                         *                              i++;
                         *                      }
                         * */
                        /*	Removed by Icyer 2007/03/15		允许自动归属工单
                         * //Laws Lu,2006/06/22 modify fix the bug that system alert object not set an instance when the product.LastSimulation is null
                         * if(product.LastSimulation == null)
                         * {
                         *      msg.Add(new UserControl.Message(UserControl.MessageType.Error,"$NoSimulation"));
                         * }
                         */
                        /*
                         *                      object[] errorcodes = null;
                         *                      if(msg.IsSuccess())
                         *                      {
                         *                              //errorcodes = tsmodelFacade.QueryECG2ECByECAndModelCode(errorcs, product.LastSimulation.ModelCode);
                         *                              string strModelCode = this.GetModelCodeFromProduct(product, this.moWillGo, domainProvider);
                         *                              if (strModelCode != "")
                         *                              {
                         *                                      errorcodes = tsmodelFacade.QueryECG2ECByECAndModelCode(errorcs, strModelCode);
                         *                              }
                         *
                         *                              if( errorcodes==null || errorcodes.Length==0 )
                         *                              {
                         *                                      msg.Add(new UserControl.Message(UserControl.MessageType.Error,"$ErrorCode_Not_BelongTo_ModelCode"));
                         *                                      base.Action (act);
                         *                                      ActionCollectSMTNG actionCollectNG = this;
                         *                                      actionCollectNG.IsTopAction = false;
                         *                                      this.NextAction = actionCollectNG;
                         *                                      this.Status = ActionStatus.PrepareData;
                         *                                      return msg;
                         *                              }
                         *                      }
                         */
                        if (msg.IsSuccess())
                        {
                            IAction dataCollectModule
                                = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_NG);

                            //((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.OpenConnection();
                            domainProvider.BeginTransaction();
                            try
                            {
                                //IDCTClient client = act as IDCTClient;
                                ActionCheckStatus actionCheckStatus = new ActionCheckStatus();

                                msg.AddMessages(((IActionWithStatus)dataCollectModule).Execute(
                                                    new TSActionEventArgs(ActionType.DataCollectAction_SMTNG,
                                                                          args.RunningCard,
                                                                          client.LoginedUser,
                                                                          client.ResourceCode,
                                                                          product,
                                                                          errorInfo,
                                                                          ""), actionCheckStatus));

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

                                msg.Add(new UserControl.Message(ex));
                            }
                            finally
                            {
                                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection();
                            }
                        }
                    }
                }
            }

            //if((act as IDCTClient).CachedAction is ActionCollectSMTNG)
            //{
            //    if(this.Status == BenQGuru.eMES.Common.DCT.Core.ActionStatus.Working)
            //    {
            //        this.ObjectState = null;
            //        if(this.errorCodesHT != null)
            //        {
            //            this.errorCodesHT.Clear();
            //        }
            //    }
            //    this.Status = BenQGuru.eMES.Common.DCT.Core.ActionStatus.PrepareData;
            //    (act as IDCTClient).CachedAction = this;
            //}
            if (this.errorCodesHT == null)
            {
                msg.ClearMessages();
            }
            if (msg.IsSuccess() || this.errorCodesHT == null)
            {
                base.Action(act);
            }
            else
            {
                msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"));
                this.Status     = ActionStatus.PrepareData;
                this.FlowDirect = FlowDirect.WaitingInput;
            }
            currentProductInfo = null;
            moWillGo           = null;
            this.ObjectState   = null;
            if (this.errorCodesHT != null)
            {
                this.errorCodesHT.Clear();
            }
            return(msg);
        }
Example #16
0
 public void CancelOperation(EventMessage cancelationMessage)
 {
     Cancel = true;
     cancelationMessage.IsDefaultEventMessage = true;
     Messages.Add(cancelationMessage);
 }
Example #17
0
 /// <summary>
 /// Writes the text representation of the specified array of objects to the
 /// console output using the specified format information.
 /// </summary>
 /// <param name="format">A composite format string</param>
 /// <param name="arg">An array of objects to write using format.</param>
 public void Write(string format, params object[] arg)
 {
     Messages.Add(string.Format(format, arg));
 }
Example #18
0
 private void HandlePlayerKilled(object sender, PlayerKilledEventArgs eventArgs)
 {
     Messages.Add("You were killed");
     Messages.Add($"This was death number: {eventArgs.NumberOfDeaths}");
 }
Example #19
0
 public void AddMessage(Message message)
 {
     Messages.Add(new ResponseFilterMessage(message));
 }
Example #20
0
        private AuthenticationContext GetOAuthContext(IKeyValueSettings settings,
                                                      ClaimsIdentity identity,
                                                      out string serviceApplicationId,
                                                      out ClientCredential credential)
        {
            // Check the information.
            var messages = new Messages();

            if (null == settings)
            {
                throw new AppException(new Message(ServiceModel.MessageCategory.Technical,
                                                   MessageType.Error,
                                                   "Settings parameter cannot be null."));
            }

            // Retrieve information from the OAuth section.
            var oauthSettingsName = settings.Values.ContainsKey("OAuthSettingsReader") ? settings.Values["OAuthSettingsReader"] : "OAuth";

            if (Container.TryResolve <IKeyValueSettings>(oauthSettingsName, out var oauthSettings))
            {
                // Valdate arguments.
                if (!oauthSettings.Values.ContainsKey(TokenKeys.AuthorityKey))
                {
                    messages.Add(new Message(ServiceModel.MessageCategory.Technical, MessageType.Error, "Authority is missing. Cannot process the request."));
                }
                if (!oauthSettings.Values.ContainsKey(TokenKeys.ServiceApplicationIdKey))
                {
                    messages.Add(new Message(ServiceModel.MessageCategory.Technical, MessageType.Error, "ApplicationId is missing. Cannot process the request."));
                }
                if (!oauthSettings.Values.ContainsKey(TokenKeys.ApplicationKey))
                {
                    messages.Add(new Message(ServiceModel.MessageCategory.Technical, MessageType.Error, "ApplicationKey is missing. Cannot process the request."));
                }

                messages.LogAndThrowIfNecessary(this);
                messages.Clear();


                Logger.Technical().From(typeof(AdalOboTokenProvider)).Debug($"Creating an authentication context for the request.").Log();
                serviceApplicationId = settings.Values[TokenKeys.ServiceApplicationIdKey];
                var authority = oauthSettings.Values[TokenKeys.AuthorityKey];

                Logger.Technical().From(typeof(AdalOboTokenProvider)).Debug($"ServiceApplicationId = {serviceApplicationId}.").Log();
                Logger.Technical().From(typeof(AdalOboTokenProvider)).Debug($"Authority = {authority}.").Log();

                if (!oauthSettings.Values.TryGetValue(TokenKeys.ClientIdKey, out var clientId)) // ClientId exists only for AzureAD.
                {
                    clientId = oauthSettings.Values[TokenKeys.ServiceApplicationIdKey];
                }

                if (oauthSettings.Values.TryGetValue(TokenKeys.ApplicationKey, out var applicationKey))
                {
                    credential = new ClientCredential(clientId, applicationKey);
                }
                else
                {
                    messages.Add(new Message(ServiceModel.MessageCategory.Technical, MessageType.Error, "No application key is defined to identify the application in the STS."));
                    credential = null;
                }

                var userObjectId = oAuthConfig.UserClaimIdentifier(identity);
                if (String.IsNullOrWhiteSpace(userObjectId))
                {
                    messages.Add(new Message(ServiceModel.MessageCategory.Technical, MessageType.Error, "No user object identifier is found in the claims collection to identify the user."));
                }

                messages.LogAndThrowIfNecessary(this);

                var authContext = CreateAuthenticationContext(authority, serviceApplicationId + identity.AuthenticationType + userObjectId);
                Logger.Technical().From(typeof(AdalOboTokenProvider)).Debug("Created the authentication context.").Log();

                return(authContext);
            }

            messages.Add(new Message(ServiceModel.MessageCategory.Technical, MessageType.Error, $"No OAuth Settings file found: {oauthSettingsName}."));
            messages.LogAndThrowIfNecessary(this);

            serviceApplicationId = string.Empty;
            credential           = null;

            return(null);
        }
Example #21
0
        public override Messages Action(object act)
        {
            base.Action(act);

            Messages msg = new Messages();

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

            DataCollect.Action.ActionEventArgs args;
            if (ObjectState == null)
            {
                args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
            }
            else
            {
                args = ObjectState as DataCollect.Action.ActionEventArgs;
            }

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

            //msg = CheckData(data);
            if (msg.IsSuccess())
            {
                #region Key logic,Push next action and fill it with data
                args.RunningCard = data;

                ObjectState = args;

                Web.Helper.ActionType acttype = new Web.Helper.ActionType();
                acttype.Items.Add(BaseDCTDriver.NEXTOP);

                ActionRCard acRcard = new ActionRCard();

                if ((act as IDCTClient).CachedAction != null && !acttype.Items.Contains(args.RunningCard))//如果存在缓存的Action则利用缓存的Action
                {
                    BaseDCTAction action = (act as IDCTClient).CachedAction;

                    if (!(action is ActionCollectNG) &&
                        !(action is ActionCollectSMTNG) &&
                        !(action is ActionCollectOutlineNG) &&
                        !(action is ActionCollectKeyparts) &&
                        !(action is ActionBatchWithKeypaerts) &&
                        !(action is ActionCollectMix))
                    {
                        action.ObjectState = ObjectState;
                    }

                    this.NextAction = action;
                }
                else if ((act as IDCTClient).CachedAction == null && !acttype.Items.Contains(args.RunningCard))
                {
                    ActionFactory acFac = new ActionFactory();

                    acFac.ObjectState = ObjectState;
                    this.NextAction   = acFac;
                }
                else if (acttype.Items.Contains(args.RunningCard))
                {
                    //ActionRCard acRcard = new ActionRCard();

                    //acRcard.ObjectState = ObjectState;
                    this.NextAction = acRcard;
                }

                bool bIsAction = true;
                if (acttype.Items.Contains(args.RunningCard))
                {
                    switch (args.RunningCard)
                    {
                    //归属工单
                    case ActionType.DataCollectAction_GoMO:
                        ActionGotoMO actionGotoMO = new ActionGotoMO();
                        //actionGotoMO.ObjectState = acRcrd.ObjectState;
                        acRcard.NextAction  = actionGotoMO;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_MOCode");

                        (act as IDCTClient).CachedAction = actionGotoMO;
                        break;

                    //采集GOOD, added by jessie lee
                    case ActionType.DataCollectAction_GOOD:
                        ActionCollectGood actionCollectGood = new ActionCollectGood();
                        //actionCollectGood.ObjectState = ObjectState;
                        acRcard.NextAction  = actionCollectGood;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_GOOD_Please_Input_GOOD_SN");

                        // Added by Icyer 2007/08/22
                        // 做良品采集时做归属工单
                        //changed by hiro 2008/08/27
                        //if ((act as IDCTClient).CachedAction is Action.ActionGotoMO)
                        //{
                        //    if (((Action.ActionGotoMO)(act as IDCTClient).CachedAction).moCode != string.Empty)
                        //    {
                        //        actionCollectGood.NeedGoMO = true;
                        //        actionCollectGood.NeedGoMOCode = ((Action.ActionGotoMO)(act as IDCTClient).CachedAction).moCode;
                        //    }
                        //}
                        // Added end

                        (act as IDCTClient).CachedAction = actionCollectGood;
                        break;

                    //采集NG, added by jessie lee, 10/05/2006
                    case ActionType.DataCollectAction_NG:
                        ActionCollectNG actionCollectNG = new ActionCollectNG();
                        //actionCollectNG.ObjectState = acRcard.ObjectState;
                        acRcard.NextAction  = actionCollectNG;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN");

                        (act as IDCTClient).CachedAction = actionCollectNG;
                        break;

                    //采集SMTNG, added by jessie lee, 10/05/2006
                    case ActionType.DataCollectAction_SMTNG:
                        ActionCollectSMTNG actionCollectSMTNG = new ActionCollectSMTNG();
                        //actionCollectSMTNG.ObjectState = acRcard.ObjectState;
                        acRcard.NextAction  = actionCollectSMTNG;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN");

                        (act as IDCTClient).CachedAction = actionCollectSMTNG;
                        break;

                    //采集OutlineGOOD, added by jessie lee, 2006/8/21
                    case ActionType.DataCollectAction_OutLineGood:
                        ActionCollectOutlineGood actionCollectOutlineGood = new ActionCollectOutlineGood();
                        //actionCollectGood.ObjectState = ObjectState;
                        acRcard.NextAction = actionCollectOutlineGood;

                        (act as IDCTClient).CachedAction = actionCollectOutlineGood;
                        break;

                    //采集OutlineNG, added by jessie lee, 2006/8/21
                    case ActionType.DataCollectAction_OutLineNG:
                        ActionCollectOutlineNG actionCollectOutlineNG = new ActionCollectOutlineNG();
                        //actionCollectNG.ObjectState = acRcard.ObjectState;
                        acRcard.NextAction = actionCollectOutlineNG;

                        (act as IDCTClient).CachedAction = actionCollectOutlineNG;
                        break;

                    //Keyparts上料, added by jessie lee, 10/05/2006
                    case ActionType.DataCollectAction_CollectKeyParts:
                        ActionCollectKeyparts actionCollectKeyparts = new ActionCollectKeyparts();
                        //actionCollectKeyparts.ObjectState = acRcard.ObjectState;
                        acRcard.NextAction  = actionCollectKeyparts;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard");

                        // 如果上个采集是集成上料,则做KeyPart时同时做集成上料
                        if ((act as IDCTClient).CachedAction is Action.ActionCollectINNO)
                        {
                            if (((Action.ActionCollectINNO)(act as IDCTClient).CachedAction).INNOCode != string.Empty)
                            {
                                actionCollectKeyparts.NeedCollectINNO = true;
                                actionCollectKeyparts.INNOCode        = ((Action.ActionCollectINNO)(act as IDCTClient).CachedAction).INNOCode;
                            }
                        }
                        else if ((act as IDCTClient).CachedAction is Action.ActionCollectKeyparts)
                        {
                            actionCollectKeyparts.NeedCollectINNO = ((Action.ActionCollectKeyparts)(act as IDCTClient).CachedAction).NeedCollectINNO;
                            actionCollectKeyparts.INNOCode        = ((Action.ActionCollectKeyparts)(act as IDCTClient).CachedAction).INNOCode;
                        }
                        // Added end
                        (act as IDCTClient).CachedAction = actionCollectKeyparts;
                        break;

                    case ActionType.DataCollectAction_Split:
                        ActionCollectIDMerge actionCollectIDMerge = new ActionCollectIDMerge();
                        acRcard.NextAction  = actionCollectIDMerge;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_SN_For_Merge");

                        (act as IDCTClient).CachedAction = actionCollectIDMerge;
                        break;

                    case ActionType.DataCollectAction_CollectINNO:
                        ActionCollectINNO actionCollectINNO = new ActionCollectINNO();
                        acRcard.NextAction  = actionCollectINNO;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_CMPleaseInputINNOinEdt");

                        (act as IDCTClient).CachedAction = actionCollectINNO;
                        break;

                    case BaseDCTDriver.NEXTOP:
                        ActionNextOP actionNextOP = new ActionNextOP();
                        acRcard.NextAction = actionNextOP;
                        (act as IDCTClient).CachedAction = actionNextOP;
                        break;

                    case ActionType.DataCollectAction_CompareAppendix:
                        ActionCompareApp actionCartonCompare = new ActionCompareApp();
                        acRcard.NextAction  = actionCartonCompare;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_CARTONNO");
                        (act as IDCTClient).CachedAction = actionCartonCompare;
                        break;

                    case ActionType.DataCollectAction_Mix:
                        ActionCollectMix actionCollectMix = new ActionCollectMix();
                        acRcard.NextAction  = actionCollectMix;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard");
                        break;

                    case ActionType.DataCollectAction_KBatch:
                        ActionBatchWithKeypaerts actionBatchWithKeypaerts = new ActionBatchWithKeypaerts();
                        acRcard.NextAction  = actionBatchWithKeypaerts;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard");
                        break;

                    case ActionType.DataCollectAction_CompareProductCode:
                        ActionCompareProductCode actionCompareProductCode = new ActionCompareProductCode();
                        acRcard.NextAction  = actionCompareProductCode;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_CARTONNO");
                        (act as IDCTClient).CachedAction = actionCompareProductCode;
                        break;

                    case ActionType.DataCollectAction_CompareTwo:
                        ActionCompareAppAndProductCode actionCompareAppAndProductCode = new ActionCompareAppAndProductCode();
                        acRcard.NextAction  = actionCompareAppAndProductCode;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_CARTONNO");
                        (act as IDCTClient).CachedAction = actionCompareAppAndProductCode;
                        break;

                    case ActionType.DataCollectAction_AutoNG:
                        ActionAutoNG actionAutoNG = new ActionAutoNG();
                        acRcard.NextAction  = actionAutoNG;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN");
                        (act as IDCTClient).CachedAction = actionAutoNG;
                        break;

                    case ActionType.DataCollectAction_FGPacking:
                        ActionFGPacking actionFGPacking = new ActionFGPacking();
                        acRcard.NextAction  = actionFGPacking;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard");
                        (act as IDCTClient).CachedAction = actionFGPacking;
                        break;

                    case ActionType.DataCollectAction_MACID:
                        ActionCollectMACID actionCollectMACID = new ActionCollectMACID();
                        acRcard.NextAction  = actionCollectMACID;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard");
                        (act as IDCTClient).CachedAction = actionCollectMACID;
                        break;

                    case ActionType.DataCollectAction_MACALL:
                        ActionCollectMACALL actionCollectMACALL = new ActionCollectMACALL();
                        acRcard.NextAction  = actionCollectMACALL;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard");
                        (act as IDCTClient).CachedAction = actionCollectMACALL;
                        break;

                    case ActionType.DataCollectAction_ONPost:
                        ActionCollectONPost actionCollectONPost = new ActionCollectONPost();
                        acRcard.NextAction  = actionCollectONPost;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_UserCode");
                        (act as IDCTClient).CachedAction = actionCollectONPost;
                        break;

                    case ActionType.DataCollectAction_OffPost:
                        ActionCollectOffPost actionCollectOffPost = new ActionCollectOffPost();
                        acRcard.NextAction  = actionCollectOffPost;
                        acRcard.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_UserCode");
                        (act as IDCTClient).CachedAction = actionCollectOffPost;
                        break;

                    default:
                        bIsAction = false;
                        break;
                    }
                }
                else
                {
                    bIsAction = false;
                }
                if (NeedInputActionCommand == true)
                {
                    if (bIsAction == false)
                    {
                        msg.Add(new Message(MessageType.Error, "$CS_SystemError_CheckIDNotSupportAction"));
                        ActionRCard actRcard = new ActionRCard();
                        actRcard.OutMesssage            = new Message(MessageType.Normal, "$DCT_PLEASE_ACTION");
                        actRcard.NeedInputActionCommand = true;
                        this.NextAction = actRcard;
                    }
                    else
                    {
                        NeedInputActionCommand = false;
                    }
                }
                #endregion



                msg.Add(new Message(MessageType.Data, "", new object[] { args }));
            }

            return(msg);
        }
Example #22
0
 public void Warning(string warning)
 {
     Messages.Add("WARNING:\t" + warning);
 }
Example #23
0
 private void MessageReceived_EventHandler(string username, string text)
 {
     Messages.Add(new Message(username, text));
 }
Example #24
0
 public void Error(string error)
 {
     Messages.Add("ERROR:\t" + error);
 }
Example #25
0
        /// 序列号转换采集,不支持分板
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            // Added by Icyer 2006/10/08
            if (((ConvertCardActionEventArgs)actionEventArgs).IsUndo == true)
            {
                return(this.UndoExecute((ConvertCardActionEventArgs)actionEventArgs));
            }
            // Added end

            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                if (((ConvertCardActionEventArgs)actionEventArgs).ConvertToCard.Length <= 0)
                {
                    throw new Exception("$CS_System_Params_Losted");
                }

                ActionOnLineHelper helper = new ActionOnLineHelper(this.DataProvider);


                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(helper.CheckID(actionEventArgs));

                if (messages.IsSuccess())
                {
                    actionEventArgs.ProductInfo.NowSimulation.IDMergeRule           = 1; //actionEventArgs.ProductInfo.NowSimulation.IDMergeRule/((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length;
                    actionEventArgs.ProductInfo.NowSimulation.TranslateCard         = ((ConvertCardActionEventArgs)actionEventArgs).TransFromCard;
                    actionEventArgs.ProductInfo.NowSimulation.TranslateCardSequence = actionEventArgs.ProductInfo.LastSimulation.RunningCardSequence;
                    actionEventArgs.ProductInfo.NowSimulation.NGTimes = actionEventArgs.ProductInfo.LastSimulation.NGTimes;

                    DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);

                    //修改SIMULATION
                    //Laws Lu,2005/08/15,新增	完工逻辑,在其他Check都通过的情况下,所有的RunningCard应该是GOOD状态
                    //暂时不考虑线外工序
                    if (actionEventArgs.ProductInfo.NowSimulation.RouteCode != "" && dataCollectFacade.OPIsMORouteLastOP(
                            actionEventArgs.ProductInfo.NowSimulation.MOCode
                            , actionEventArgs.ProductInfo.NowSimulation.RouteCode
                            , actionEventArgs.ProductInfo.NowSimulation.OPCode))
                    {
                        actionEventArgs.ProductInfo.NowSimulation.IsComplete  = "1";
                        actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = "GOOD";
                        //完工自动入库
                        dataCollectFacade.AutoInventory(actionEventArgs.ProductInfo.NowSimulation, actionEventArgs.UserCode);
                    }
                    //End Laws Lu
                    actionEventArgs.ProductInfo.NowSimulation.MOSeq = actionEventArgs.ProductInfo.LastSimulation.MOSeq;
                    // hiro.chen 2009.08.28     对tblsimulation,tblonwip,tblsimulationreport中Rcard转换操作
                    actionEventArgs.ProductInfo.LastSimulation.TranslateCard = (actionEventArgs as ConvertCardActionEventArgs).TransFromCard;
                    actionEventArgs.ProductInfo.NowSimulation.TranslateCard  = (actionEventArgs as ConvertCardActionEventArgs).TransFromCard;
                    actionEventArgs.ProductInfo.LastSimulation.RunningCard   = actionEventArgs.ProductInfo.NowSimulation.SourceCard;
                    actionEventArgs.ProductInfo.NowSimulation.RunningCard    = actionEventArgs.ProductInfo.NowSimulation.SourceCard;

                    messages.AddMessages(helper.Execute(actionEventArgs));

                    if (messages.IsSuccess())
                    {
                        //填写ID转换报表
                        OnWIPCardTransfer transf = dataCollectFacade.CreateNewOnWIPCardTransfer();

                        transf.RunningCard           = ((ConvertCardActionEventArgs)actionEventArgs).ConvertToCard.Trim().ToUpper();
                        transf.RunningCardSequence   = actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence;
                        transf.IDMergeType           = ((ConvertCardActionEventArgs)actionEventArgs).IDMergeType;
                        transf.TranslateCard         = ((ConvertCardActionEventArgs)actionEventArgs).TransFromCard;
                        transf.TranslateCardSequence = actionEventArgs.ProductInfo.LastSimulation.RunningCardSequence;
                        transf.SourceCard            = actionEventArgs.ProductInfo.NowSimulation.SourceCard;
                        transf.ModelCode             = actionEventArgs.ProductInfo.NowSimulation.ModelCode;
                        transf.MOCode             = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                        transf.ItemCode           = actionEventArgs.ProductInfo.NowSimulation.ItemCode;
                        transf.ResourceCode       = actionEventArgs.ResourceCode;
                        transf.OPCode             = actionEventArgs.ProductInfo.NowSimulation.OPCode;
                        transf.SourceCardSequence = actionEventArgs.ProductInfo.NowSimulation.SourceCardSequence;
                        transf.RouteCode          = actionEventArgs.ProductInfo.NowSimulation.RouteCode;
                        transf.StepSequenceCode   = actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode;
                        transf.SegmnetCode        = actionEventArgs.ProductInfo.NowSimulationReport.SegmentCode;
                        transf.TimePeriodCode     = actionEventArgs.ProductInfo.NowSimulationReport.TimePeriodCode;
                        transf.ShiftCode          = actionEventArgs.ProductInfo.NowSimulationReport.ShiftCode;
                        transf.ShiftTypeCode      = actionEventArgs.ProductInfo.NowSimulationReport.ShiftTypeCode;
                        transf.MaintainUser       = actionEventArgs.UserCode;
                        transf.MOSeq = actionEventArgs.ProductInfo.NowSimulationReport.MOSeq;

                        dataCollectFacade.AddOnWIPCardTransfer(transf);
                        //AMOI  MARK  START  20050806 增加按资源统计产量和完工统计
                        #region 填写统计报表 按资源统计
                        // Added by Icyer 2006/06/05
                        //if (actionEventArgs.NeedUpdateReport == true)
                        //{
                        //    ReportHelper reportCollect = new ReportHelper(this.DataProvider);
                        //    messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,
                        //        actionEventArgs.ActionType, actionEventArgs.ProductInfo));
                        //    messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider
                        //        , actionEventArgs.ActionType, actionEventArgs.ProductInfo));
                        //}
                        #endregion
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #26
0
File: Sms.cs Project: enrio/skg-pro
        /// <summary>
        /// Parse messages
        /// </summary>
        /// <param name="input">Data input</param>
        /// <returns></returns>
        public Messages ParseMsg(string input)
        {
            var messages = new Messages();
            try
            {
                var r = new Regex(@"\+CMGL: (\d+),""(.+)"",""(.+)"",(.*),""(.+)""\r\n(.+)\r\n");
                var m = r.Match(input);

                while (m.Success)
                {
                    var msg = new Message
                    {
                        Index = m.Groups[1].Value,
                        Status = m.Groups[2].Value,
                        Sender = m.Groups[3].Value,
                        Alphabet = m.Groups[4].Value,
                        Sent = m.Groups[5].Value,
                        Content = m.Groups[6].Value
                    };

                    messages.Add(msg);
                    m = m.NextMatch();
                }
            }
            catch (Exception ex) { throw ex; }

            return messages;
        }
 public void AddMessage(SignalMessage _signalMessage) => Messages?.Add(_signalMessage);
 public void Three(MessageB message)
 {
     Messages.Add(message);
 }
Example #29
0
 public void Info(string info)
 {
     Messages.Add("INFO:\t" + info);
 }
Example #30
0
 public BusinessRuleException(string code, string message, params string[] args)
     : base(string.Format(Resources.Exceptions.Base.Messages.BusinessRuleException, message), args)
 {
     Code = code;
     Messages.Add(message);
 }
        private void SetupCommands()
        {
            this.Open = new RelayCommand(async() => {
                this.IsOpening = true;
                this.Partitions.Clear();
                this.Messages.Clear();

                _partitionSubscription = _service.PartitionFound.Subscribe((p) =>
                {
                    App.Current.Dispatcher.BeginInvoke(new Action(() => {
                        this.TotalMessageCount = _service.MessageCount;
                        Partitions.Add(new PartitionViewModel(p));
                    }), null);
                },
                                                                           () => {
                    App.Current.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        this.IsOpening = false;
                    }));
                });
                await _service.OpenEventHubAsync(EventHubConnectionString, HubName);
                UpdateCommands();
            });

            this.ReadAll = new RelayCommand(() =>
            {
                ResetReading();
                switch (CheckPoint)
                {
                case CheckPointTypes.Start:
                    _service.ReadAllAsync(DateTime.MinValue);
                    break;

                case CheckPointTypes.Now:
                    _service.ReadAllAsync(DateTime.Now);
                    break;

                case CheckPointTypes.PastMinutes:
                    _service.ReadAllAsync(TimeSpan.FromMinutes(this.PastMinutes));
                    break;

                case CheckPointTypes.PastMessages:
                    _service.ReadAllAsync(this.PastMessages);
                    break;

                default:
                    break;
                }
                IsReading = true;
                UpdateCommands();
            }, () => {
                return(!_service.IsReading && _service.IsOpen);
            });

            this.Read = new RelayCommand <PartitionViewModel>((p) => {
                ResetReading();
                switch (CheckPoint)
                {
                case CheckPointTypes.Start:
                    _service.ReadAsync(p.PartitionId, DateTime.MinValue);
                    break;

                case CheckPointTypes.Now:
                    _service.ReadAsync(p.PartitionId, DateTime.Now);
                    break;

                case CheckPointTypes.PastMinutes:
                    break;

                case CheckPointTypes.PastMessages:
                    break;

                default:
                    break;
                }
                IsReading = true;
                UpdateCommands();
            }
                                                              );

            this.FilterByPublisher = new RelayCommand <string>((publisher) =>
            {
                if (string.IsNullOrWhiteSpace(publisher))
                {
                    return;
                }

                var found = (from m in Messages where m.Publisher == publisher select m).ToList();
                Messages.Clear();
                foreach (var f in found)
                {
                    Messages.Add(f);
                }
            });

            this.Stop = new RelayCommand(() =>
            {
                StopReading();
            }, () => { return(_service.IsReading); });
        }
 public void EOne(string message)
 {
     Messages.Add(message);
 }