コード例 #1
0
ファイル: ActionCollectGood.cs プロジェクト: windygu/.net-wms
        public override Messages Action(object 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;
            }

            if (msg.IsSuccess())
            {
                base.Action(act);


                //检查序列号
                ActionOnLineHelper _helper = new ActionOnLineHelper(Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider());
                //msg.AddMessages(  _helper.GetIDInfo( args.RunningCard ) );
                msg = _helper.GetIDInfo(args.RunningCard);

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

                    IAction dataCollectModule = new BenQGuru.eMES.DataCollect.Action.ActionFactory(Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()).CreateAction(ActionType.DataCollectAction_GOOD);

                    ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()).PersistBroker.OpenConnection();
                    Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider().BeginTransaction();
                    try
                    {
                        //msg.AddMessages(((IActionWithStatus)action).Execute( gotoMOArgs));
                        msg.AddMessages(((IActionWithStatus)dataCollectModule).Execute(
                                            new ActionEventArgs(
                                                ActionType.DataCollectAction_GOOD,
                                                args.RunningCard,
                                                args.UserCode,
                                                args.ResourceCode,
                                                product)));

                        if (msg.IsSuccess())
                        {
                            Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider().CommitTransaction();
                            msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOODSUCCESS,$CS_Param_ID: {0}", args.RunningCard)));
                        }
                        else
                        {
                            Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider().RollbackTransaction();
                        }
                    }
                    catch (Exception ex)
                    {
                        Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider().RollbackTransaction();

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

            ActionRCard actRcard = new ActionRCard();

            NextAction = actRcard;

            return(msg);
        }
コード例 #2
0
ファイル: ActionGotoMO.cs プロジェクト: windygu/.net-wms
        public override Messages Action(object 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())
            {
                base.Action(act);


                //检查序列号
                ActionOnLineHelper _helper = new ActionOnLineHelper(Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider());
                //msg.AddMessages(  _helper.GetIDInfo( args.RunningCard ) );
                msg = _helper.GetIDInfo(args.RunningCard);

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

                    GoToMOActionEventArgs gotoMOArgs = new GoToMOActionEventArgs(
                        ActionType.DataCollectAction_GoMO,
                        args.RunningCard,
                        args.UserCode,
                        args.ResourceCode,
                        product,
                        data);

                    IAction action = new BenQGuru.eMES.DataCollect.Action.ActionFactory(Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()).CreateAction(ActionType.DataCollectAction_GoMO);

                    ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()).PersistBroker.OpenConnection();
                    Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider().BeginTransaction();
                    try
                    {
                        msg = ((IActionWithStatus)action).Execute(gotoMOArgs);

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

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

            ActionRCard actRcard = new ActionRCard();

            NextAction = actRcard;

            return(msg);
        }
コード例 #3
0
ファイル: ActionResource.cs プロジェクト: windygu/.net-wms
        public override Messages Action(object 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())
            {
                base.Action(act);
                //关键逻辑,将ActionEventArgs对象传递到下一个Action

                args.ResourceCode = data;

                //ActionPassword acPwd = new ActionPassword();

                //			acPwd.ObjectState = ObjectState;
                //			next_action = acPwd;

                object[] objUserGroup = args.UserGroup;
                bool     bIsAdmin     = false;
                if (objUserGroup != null)
                {
                    foreach (object o in objUserGroup)
                    {
                        if (((UserGroup)o).UserGroupType == "ADMIN")
                        {
                            bIsAdmin = true;
                            break;
                        }
                    }
                }

                if (!bIsAdmin)
                {
                    if (!(new Security.SecurityFacade(Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()))
                        .CheckResourceRight(args.UserCode, args.ResourceCode))
                    {
                        msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$Error_No_Resource_Right"));
                    }
                }


                ObjectState = args;

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

            if (msg.IsSuccess())
            {
                msg.Add(new UserControl.Message(UserControl.MessageType.Success, "$DCT_WELCOME"));

                if (act is IDCTClient)
                {
                    IDCTClient client = act as IDCTClient;
                    client.Authorized      = true;
                    client.LoginedUser     = args.UserCode;
                    client.LoginedPassword = args.Passwod;
                    client.ResourceCode    = args.ResourceCode;
                }

                ActionRCard actRcard = new ActionRCard();

                //actRcard.LastAction = this;
                NextAction = actRcard;
            }

            return(msg);
        }