Exemple #1
0
        public override Messages Action(object act)
        {
            Messages msg = new Messages();

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

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


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

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

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

            if (msg.IsSuccess())
            {
                //关键逻辑,将ActionEventArgs对象传递到下一个Action

                args.Passwod = data;

                object[] objUserGroup = null;
                User     user         = null;
                try
                {
                    user = new Security.SecurityFacade(domainProvider)
                           .LoginCheck(args.UserCode, args.Passwod, out objUserGroup);
                }
                catch (Exception ex)
                {
                    if (ex.Message == "$Error_User_Not_Exist")
                    {
                        base.Action(act);
                        ActionUser acUser = new ActionUser();
                        this.NextAction = acUser;
                    }
                    else
                    {
                        throw ex;
                    }
                }

                args.UserGroup = objUserGroup;
                ObjectState    = args;

                // 用户名不存在
                if (user == null)
                {
                    msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$Error_User_Not_Exist"));

                    base.Action(act);
                    ActionUser acUser = new ActionUser();
                    this.NextAction = acUser;
                }

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

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

                ActionResource acRes = new ActionResource();

                //acRes.LastAction = this;

                acRes.ObjectState = ObjectState;
                this.NextAction   = acRes;
            }
            else
            {
                base.Action(act);

                ActionUser acUser = new ActionUser();

                //acRes.LastAction = this;

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



            return(msg);
        }
Exemple #2
0
        public override Messages Action(object act)
        {
            Messages msg = new Messages();

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


            DataCollect.Action.ActionEventArgs args = null;
            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())
            {
                //关键逻辑,将ActionEventArgs对象传递到下一个Action

                args.Passwod = data;

                object[] objUserGroup = null;
                User     user         =
                    new Security.SecurityFacade(Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider())
                    .LoginCheck(args.UserCode, args.Passwod, out objUserGroup);

                args.UserGroup = objUserGroup;
                ObjectState    = args;

                // 用户名不存在
                if (user == null)
                {
                    msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$Error_User_Not_Exist"));
                }

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

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

                ActionResource acRes = new ActionResource();

                //acRes.LastAction = this;

                acRes.ObjectState = ObjectState;
                NextAction        = acRes;
            }



            return(msg);
        }
Exemple #3
0
        /*	Removed by Icyer 2007/08/22
         * // 移动到GOOD采集
         * //melo zheng,2007.8.20,SMT上料
         * private Messages SMTLoadItem(string rcard, string resourceCode, string userCode,BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider)
         * {
         *  Messages msg = new Messages();
         *  BenQGuru.eMES.SMT.SMTFacade smtFacade = new BenQGuru.eMES.SMT.SMTFacade(domainProvider);
         *  msg = smtFacade.LoadMaterialForRCard(rcard, resourceCode, userCode);
         *  return msg;
         * }
         */

        // Added by Icyer 2007/08/22
        public Messages CheckSNFormat(DataCollect.Action.ActionEventArgs args)
        {
            Messages msg = new Messages();

            return(msg);

            //melo zheng,2007.8.20,检验序列号格式
            //产品序列号长度检查:产品序列号11位=工单号7位+流水号4位
            int len = 11;

            try
            {
                if (args.RunningCard.Length != len)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Length_FLetter_NotCompare2"));
                    return(msg);
                }
                else
                {
                    /*
                     *          产品序列号首字符串检查:
                     *          第1位:G(为了避免首字符为阿拉伯数字“0”)
                     *          第2位和第3位:年2码(2007年的工单则显示“07”)
                     *          第4位:月一码(从1到C, A代表10月,B代表11月,C代表12月)
                     *          第5位和第六位:日两码
                     *          第7位:流水号(考虑到生产规模,每天下发工单的数量不会超出9个,此栏位显示数字范围是从“1”到“9”)
                     *          在工单的编码(如上述,共含7位)的基础上,后边增加4位流水号(从0001到9999)
                     */
                    //第1位是G
                    if (args.RunningCard.Substring(0, 1) != "G")
                    {
                        msg.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_FLetter_NotCompare_First2"));
                        return(msg);
                    }
                    //第2-3位是年
                    if (!isInt(args.RunningCard.Substring(1, 2)))
                    {
                        msg.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_FLetter_NotCompare_First2"));
                        return(msg);
                    }
                    //第4位是月:1-9,A,B,C
                    if (isInt(args.RunningCard.Substring(3, 1)))
                    {
                        if (args.RunningCard.Substring(3, 1) == "0")
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_FLetter_NotCompare_First2"));
                            return(msg);
                        }
                    }
                    else if (args.RunningCard.Substring(3, 1) != "A" && args.RunningCard.Substring(3, 1) != "B" &&
                             args.RunningCard.Substring(3, 1) != "C")
                    {
                        msg.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_FLetter_NotCompare_First2"));
                        return(msg);
                    }
                    //第5-6位是日
                    if (!isInt(args.RunningCard.Substring(4, 2)) || Convert.ToInt16(args.RunningCard.Substring(4, 2)) == 0 ||
                        Convert.ToInt16(args.RunningCard.Substring(4, 2)) > 31)
                    {
                        msg.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_FLetter_NotCompare_First2"));
                        return(msg);
                    }
                    //第7位是流水号:1-9
                    if (!isInt(args.RunningCard.Substring(6, 1)) || args.RunningCard.Substring(6, 1) == "0")
                    {
                        msg.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_FLetter_NotCompare_First2"));
                        return(msg);
                    }
                    //后4位是流水号:0001-9999
                    if (!isInt(args.RunningCard.Substring(7, 4)) || args.RunningCard.Substring(7, 4) == "0000")
                    {
                        msg.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_FLetter_NotCompare_First2"));
                        return(msg);
                    }
                }
            }
            catch
            {
            }
            return(msg);
        }