Пример #1
0
        public override Messages PreAction(object act)
        {
            Messages msg = new Messages();

            DataCollect.Action.ActionEventArgs args;
            if (currentProductInfo == null)
            {
                args             = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
                args.RunningCard = act.ToString().ToUpper().Trim();
                msg = this.CheckProduct(args.RunningCard, act);
                if (msg.IsSuccess() == false)
                {
                    msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"));
                    this.Status     = ActionStatus.PrepareData;
                    this.FlowDirect = FlowDirect.WaitingInput;
                    return(msg);
                }
                else
                {
                    this.ObjectState = args;
                }
            }
            if (this.Status == ActionStatus.PrepareData || this.Status == ActionStatus.Working)
            {
                msg = Action(act);
            }
            else if (this.Status == ActionStatus.Pass)
            {
                msg = AftAction(act);
            }

            return(msg);
        }
Пример #2
0
        public string INNOCode      = string.Empty;     // 继承上料号

        public override Messages PreAction(object act)
        {
            // Added by Icyer 2006/12/14
            // 输入产品序列号是检查
            DataCollect.Action.ActionEventArgs args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
            if (this.ObjectState != null)
            {
                args = (DataCollect.Action.ActionEventArgs) this.ObjectState;
            }
            else
            {
                args.RunningCard = act.ToString().ToUpper();
            }

            if (this.keypartsHT == null)
            {
                Messages msgCheck = CheckProduct(act, args.RunningCard);
                if (msgCheck.IsSuccess() == false)
                {
                    /*
                     * msgCheck.Add(new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard"));
                     * keypartsHT = null;
                     * this.NeedCancel = true;
                     * this.ObjectState = null;
                     * base.PreAction (act);
                     *
                     * ActionCollectKeyparts actionCollectKeyparts = new ActionCollectKeyparts();
                     * actionCollectKeyparts.NeedCollectINNO = this.NeedCollectINNO;
                     * actionCollectKeyparts.INNOCode = this.INNOCode;
                     * this.NextAction = actionCollectKeyparts;
                     * this.ObjectState = null;
                     * this.keypartsHT = null;
                     * this.Status = ActionStatus.PrepareData;
                     */
                    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(msgCheck);
                }
            }

            this.ObjectState = args;
            // Added end

            base.PreAction(act);

            Messages msg = new Messages();

            msg.Add(this.OutMesssage);

            return(msg);
        }
Пример #3
0
        public override Messages PreAction(object act)
        {
            DataCollect.Action.ActionEventArgs args;
            if (currentProductInfo == null)
            {
                bool     finCancel = false;
                bool     bCancel   = false;
                Messages msgChk    = new Messages();
                if (act.ToString().ToUpper().Trim() == BaseDCTDriver.FINERROR && this.NextAction == null)
                {
                    finCancel = true;
                }
                else
                {
                    args             = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
                    args.RunningCard = act.ToString().ToUpper().Trim();
                    msgChk           = this.CheckProduct(args.RunningCard, act);
                    if (msgChk.IsSuccess() == false)
                    {
                        msgChk.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"));
                        bCancel = true;
                    }
                    else
                    {
                        this.ObjectState = args;
                    }
                }
                if (finCancel == true)
                {
                    base.Action(act);
                    return(msgChk);
                }
                if (bCancel == true)
                {
                    this.Status     = ActionStatus.PrepareData;
                    this.FlowDirect = FlowDirect.WaitingInput;
                    return(msgChk);
                }
            }

            base.PreAction(act);

            Messages msg = new Messages();

            if (_currInputStep.StepType == InputStepType.ErrorCode)
            {
                msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_ErrorCode"));
            }

            return(msg);
        }
Пример #4
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;
            if (ObjectState == null)
            {
                args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
            }
            else
            {
                args = ObjectState as DataCollect.Action.ActionEventArgs;
            }

            string data = act.ToString().ToUpper().Trim();              //产品序列号

            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 (msg.IsSuccess())
            {
                msg = this.DoDataCollectAction(domainProvider, (IDCTClient)act, data);
            }

            base.Action(act);

            this.ObjectState = null;
            this.Status      = ActionStatus.PrepareData;
            this.NextAction  = this;

            return(msg);
        }
Пример #5
0
        public override Messages PreAction(object act)
        {
            // Added by Icyer 2006/12/14
            // 输入产品序列号是检查
            DataCollect.Action.ActionEventArgs args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
            if (this.ObjectState != null)
            {
                args = (DataCollect.Action.ActionEventArgs) this.ObjectState;
            }
            else
            {
                args.RunningCard = act.ToString().ToUpper();
            }

            if (this.mergeList == null)
            {
                Messages msgCheck = CheckProduct(act, args.RunningCard);
                if (msgCheck.IsSuccess() == false)
                {
                    ResetData();

                    ProcessBeforeReturn(this.Status, msgCheck);
                    return(msgCheck);
                }
            }

            this.ObjectState = args;
            // Added end

            base.PreAction(act);

            int iCurrent = 1;

            if (this.mergeList != null && this.mergeList["MergeIdList"] != null)
            {
                iCurrent = ((ArrayList)this.mergeList["MergeIdList"]).Count + 1;
            }
            this.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_Merge_ID " + iCurrent.ToString() + "/" + this.IDMergeRule.ToString());
            Messages msg = new Messages();

            msg.Add(this.OutMesssage);

            ProcessBeforeReturn(this.Status, msg);
            return(msg);
        }
Пример #6
0
        public override Messages PreAction(object act)
        {
            // Added by Icyer 2006/12/14
            // 输入产品序列号是检查
            DataCollect.Action.ActionEventArgs args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
            if (this.ObjectState != null)
            {
                args = (DataCollect.Action.ActionEventArgs) this.ObjectState;
            }
            else
            {
                args.RunningCard = act.ToString().ToUpper();
            }

            Messages msg = new Messages();

            if (this.keypartsHT == null)
            {
                ID = act.ToString().ToUpper();
                Messages msgCheck = CheckProduct(act, args.RunningCard);
                if (msgCheck.IsSuccess() == false)
                {
                    this.ObjectState = null;
                    this.keypartsHT  = null;
                    opBomDetailList.Clear();
                    opBomdetailRealCollectList.Clear();
                    opBomDetailCount      = 0;
                    opBomDetailCollectNum = 0;
                    ID = string.Empty;

                    ProcessBeforeReturn(this.Status, msgCheck);
                    return(msgCheck);
                }

                msg = msgCheck;
            }

            this.ObjectState = args;
            base.PreAction(act);

            ProcessBeforeReturn(this.Status, msg);
            return(msg);
        }
Пример #7
0
        public override Messages PreAction(object act)
        {
            base.PreAction(act);

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


            Messages msg = new Messages();

            msg.Add(this.OutMesssage);

            return(msg);
        }
Пример #8
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
             *      ObjectState = args;
             *
             *      ActionPassword acPwd = new ActionPassword();
             *
             *      acPwd.LastAction = this;
             *
             *      acPwd.ObjectState = ObjectState;
             *      this.NextAction = acPwd;
             #endregion
             *
             *      args.UserCode = data;
             *
             *      msg.Add(new Message(MessageType.Data,"",new object[]{args}));
             * }
             */
            args.UserCode     = (act as IDCTClient).LoginedUser;
            args.ResourceCode = (act as IDCTClient).ResourceCode;
            switch (data)
            {
            //归属工单
            case ActionType.DataCollectAction_GoMO:
                ActionGotoMO actionGotoMO = new ActionGotoMO();
                actionGotoMO.ObjectState = args;
                this.NextAction          = actionGotoMO;

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

            //采集GOOD, added by jessie lee
            case ActionType.DataCollectAction_GOOD:
                ActionCollectGood actionCollectGood = new ActionCollectGood();
                actionCollectGood.ObjectState = args;
                this.NextAction = actionCollectGood;

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

            //采集NG, added by jessie lee, 10/05/2006
            case ActionType.DataCollectAction_NG:
                ActionCollectNG actionCollectNG = new ActionCollectNG();
                actionCollectNG.ObjectState = args;
                this.NextAction             = actionCollectNG;

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

            //采集SMTNG, added by jessie lee, 10/05/2006
            case ActionType.DataCollectAction_SMTNG:
                ActionCollectSMTNG actionCollectSMTNG = new ActionCollectSMTNG();
                actionCollectSMTNG.ObjectState = args;
                this.NextAction = actionCollectSMTNG;

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

            //采集OUTLINEGOOD, added by jessie lee, 2006/8/18
            case ActionType.DataCollectAction_OutLineGood:
                ActionCollectOutlineGood actionCollectOutlineGood = new ActionCollectOutlineGood();
                actionCollectOutlineGood.ObjectState = args;
                this.NextAction = actionCollectOutlineGood;

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

            //采集OUTLINENG, added by jessie lee, 2006/8/18
            case ActionType.DataCollectAction_OutLineNG:
                ActionCollectOutlineNG actionCollectOutlineNG = new ActionCollectOutlineNG();
                actionCollectOutlineNG.ObjectState = args;
                this.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 = args;
                this.NextAction = actionCollectKeyparts;

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

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

            case ActionType.DataCollectAction_CompareAppendix:
                ActionCompareApp actionCartonCompare = new ActionCompareApp();
                this.NextAction = actionCartonCompare;

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

            case ActionType.DataCollectAction_Mix:
                ActionCollectMix actionCollectMix = new ActionCollectMix();
                this.NextAction = actionCollectMix;

                break;

            case ActionType.DataCollectAction_KBatch:
                ActionBatchWithKeypaerts actionBatchWithKeypaerts = new ActionBatchWithKeypaerts();
                this.NextAction = actionBatchWithKeypaerts;

                break;

            case ActionType.DataCollectAction_CompareProductCode:
                ActionCompareProductCode actionCompareProductCode = new ActionCompareProductCode();
                this.NextAction = actionCompareProductCode;

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

            case ActionType.DataCollectAction_CompareTwo:
                ActionCompareAppAndProductCode actionCompareAppAndProductCode = new ActionCompareAppAndProductCode();
                this.NextAction = actionCompareAppAndProductCode;

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

            case ActionType.DataCollectAction_AutoNG:
                ActionAutoNG actionAutoNG = new ActionAutoNG();
                this.NextAction = actionAutoNG;

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

            case ActionType.DataCollectAction_FGPacking:
                ActionFGPacking actionFGPacking = new ActionFGPacking();
                this.NextAction = actionFGPacking;

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

            case ActionType.DataCollectAction_ONPost:
                ActionCollectONPost actionCollectONPost = new ActionCollectONPost();
                this.NextAction = actionCollectONPost;

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

            case ActionType.DataCollectAction_OffPost:
                ActionCollectOffPost actionCollectOffPost = new  ActionCollectOffPost();
                this.NextAction = actionCollectOffPost;

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

            default:
                ActionRCard actionRCard = new ActionRCard();
                //actionRCard.ObjectState = args;
                this.NextAction = actionRCard;
                break;
            }
            return(msg);
        }
Пример #9
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);
        }
Пример #10
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;
            if (ObjectState == null)
            {
                args             = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
                args.RunningCard = act.ToString().ToUpper().Trim();
            }
            else
            {
                args = ObjectState as DataCollect.Action.ActionEventArgs;
            }

            //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 (msg.IsSuccess())
            {
                //检查序列号
                ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);

                msg = _helper.GetIDInfo(args.RunningCard);

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

                    if (product.LastSimulation == null)
                    {
                        msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$NoSimulation"));
                    }

                    object[] oplist = null;
                    if (msg.IsSuccess())
                    {
                        oplist = GetOutLineOP(domainProvider, (act as IDCTClient).ResourceCode);

                        if (oplist == null || oplist.Length == 0)
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$CSError_Res_Cannot_Collect_OUtlineGood"));
                        }
                    }
                    string opcode = string.Empty;

                    if (msg.IsSuccess())
                    {
                        opcode = (oplist[0] as Operation).OPCode;
                        if (CheckOutlineOPInRoute(domainProvider, product.LastSimulation.RouteCode, opcode))
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$CS_OutLineOP_In_ThisRoute"));
                        }
                    }

                    if (msg.IsSuccess())
                    {
                        if (IsLastOP(domainProvider, product.LastSimulation.MOCode, product.LastSimulation.RouteCode, product.LastSimulation.OPCode))
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$CS_Op_IsLast_OutLineOP_Cannot_Collect"));
                        }
                    }
                    if (msg.IsSuccess())
                    {
                        //((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()).PersistBroker.OpenConnection();
                        domainProvider.BeginTransaction();
                        try
                        {
                            IDCTClient client = act as IDCTClient;

                            IAction dataCollectModule = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_OutLineGood);

                            msg.AddMessages((dataCollectModule).Execute(new OutLineActionEventArgs(
                                                                            ActionType.DataCollectAction_OutLineGood,
                                                                            args.RunningCard,
                                                                            client.LoginedUser,
                                                                            client.ResourceCode,
                                                                            product,
                                                                            opcode)));

                            if (msg.IsSuccess())
                            {
                                domainProvider.CommitTransaction();
                                msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOODSUCCESS")));
                            }
                            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);
//
//			Web.Helper.ActionType acttype = new Web.Helper.ActionType();
//			if(acttype.Items.Contains(args.RunningCard))
//			{
//				(act as IDCTClient).CachedAction = null;
//			}
//

            ActionRCard actRcard = new ActionRCard();

            this.NextAction = actRcard;



            return(msg);
        }
Пример #11
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;
            }


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

                if (msg.IsSuccess())
                {
                    if (errorCodesHT == null)
                    {
                        errorCodesHT = new Hashtable();
                    }

                    bool bExist = false;
                    if (!errorCodesHT.ContainsKey(data))
                    {
                        errorCodesHT.Add(data, data);
                    }
                    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);
                }
            }


            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())
                    {
                        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"));
                                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;

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

                                if (msg.IsSuccess())
                                {
                                    domainProvider.CommitTransaction();
                                    msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_NGSUCCESS")));

                                    //msg.Add( new UserControl.Message(MessageType.Succes ,string.Format("$CS_NGSUCCESS,$CS_Param_ID: {0}", args.RunningCard)));
                                }
                                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 ActionCollectNG)
            //{
            //    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);
        }
Пример #12
0
        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);
        }
Пример #13
0
        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);
        }
Пример #14
0
        public override Messages Action(object act)
        {
            Messages msgs = new Messages();

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

            SQLDomainDataProvider domainProvider = null;

            if ((act as IDCTClient).DBConnection != null)
            {
                domainProvider = (act as IDCTClient).DBConnection as SQLDomainDataProvider;
            }
            else
            {
                domainProvider = DomainDataProviderManager.DomainDataProvider() as SQLDomainDataProvider;
                (act as IDCTClient).DBConnection = domainProvider;
            }

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

            if (msgs.IsSuccess())
            {
                ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);

                msgs = _helper.GetIDInfo(args.RunningCard);

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

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

                    domainProvider.BeginTransaction();

                    try
                    {
                        IDCTClient client = act as IDCTClient;

                        // 同时做归属工单
                        if (this.NeedGoMO == true && this.NeedGoMOCode != string.Empty)
                        {
                            ActionGotoMO actionGoMO = new ActionGotoMO();
                            msgs.AddMessages(actionGoMO.CheckSNFormat(args));

                            if (msgs.IsSuccess())
                            {
                                IAction dataCollectModuleGoMO = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_GoMO);
                                msgs.AddMessages(((IActionWithStatus)dataCollectModuleGoMO).Execute(
                                                     new GoToMOActionEventArgs(
                                                         ActionType.DataCollectAction_GoMO,
                                                         args.RunningCard,
                                                         client.LoginedUser,
                                                         client.ResourceCode,
                                                         product,
                                                         this.NeedGoMOCode)));
                            }

                            // 做归属工单后,重新获取ProductInfo
                            if (msgs.IsSuccess())
                            {
                                msgs    = _helper.GetIDInfo(args.RunningCard);
                                product = (ProductInfo)msgs.GetData().Values[0];
                            }
                        }

                        //良品采集
                        if (msgs.IsSuccess())
                        {
                            msgs.AddMessages(((IActionWithStatus)dataCollectModule).Execute(
                                                 new ActionEventArgs(
                                                     ActionType.DataCollectAction_GOOD,
                                                     args.RunningCard,
                                                     client.LoginedUser,
                                                     client.ResourceCode,
                                                     product)));
                        }

                        // 做SMT物料关联
                        if (msgs.IsSuccess())
                        {
                            if (System.Configuration.ConfigurationSettings.AppSettings["PartConn"] != null &&
                                System.Configuration.ConfigurationSettings.AppSettings["PartConn"].ToUpper().Trim() == "TRUE")
                            {
                                msgs.AddMessages(this.SMTLoadItem(args.RunningCard.ToUpper().Trim(), client.ResourceCode.ToUpper(), client.LoginedUser.ToUpper(), domainProvider));
                            }
                        }

                        if (msgs.IsSuccess())
                        {
                            domainProvider.CommitTransaction();
                            msgs.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOODSUCCESS")));
                        }
                        else
                        {
                            domainProvider.RollbackTransaction();
                        }
                    }
                    catch (Exception ex)
                    {
                        domainProvider.RollbackTransaction();
                        msgs.Add(new UserControl.Message(ex));
                    }
                    finally
                    {
                        ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection();
                    }
                }
            }

            if (msgs.IsSuccess())
            {
                base.Action(act);
            }

            ProcessBeforeReturn(this.Status, msgs);
            return(msgs);
        }
Пример #15
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
             *      ObjectState = args;
             *
             *      ActionPassword acPwd = new ActionPassword();
             *
             *      acPwd.LastAction = this;
             *
             *      acPwd.ObjectState = ObjectState;
             *      next_action = acPwd;
             #endregion
             *
             *      args.UserCode = data;
             *
             *      msg.Add(new Message(MessageType.Data,"",new object[]{args}));
             * }
             */
            args.UserCode     = (act as IDCTClient).LoginedUser;
            args.ResourceCode = (act as IDCTClient).ResourceCode;
            switch (data)
            {
            case ActionType.DataCollectAction_GoMO:
                ActionGotoMO actionGotoMO = new ActionGotoMO();
                actionGotoMO.ObjectState = args;
                NextAction = actionGotoMO;
                break;

            case ActionType.DataCollectAction_GOOD:
                ActionCollectGood actionCollectGood = new ActionCollectGood();
                actionCollectGood.ObjectState = args;
                NextAction = actionCollectGood;
                break;

            default:
                break;
            }
            return(msg);
        }
Пример #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="oqcGoodEventArgs"> </param> params (0,lotno)
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            OQCGoodEventArgs oqcGoodEventArgs = actionEventArgs as OQCGoodEventArgs;

            //added by hiro.chen 08/11/18 :判断是否已下地
            DataCollectFacade dcFacade = new DataCollectFacade(this.DataProvider);

            messages.AddMessages(dcFacade.CheckISDown(actionEventArgs.RunningCard));
            if (!messages.IsSuccess())
            {
                return(messages);
            }
            //end

            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                ActionOQCHelper    oqcHelper   = new ActionOQCHelper(this.DataProvider);
                OQCFacade          oqcFacade   = new OQCFacade(this.DataProvider);

                // Added By Hi1/Venus.feng on 20080720 for Hisense Version : Change OQC Flow
                DBDateTime currentDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);

                // Some Check
                #region CheckOQCLotStatus

                /*
                 * object objOQClot = oqcFacade.GetOQCLot(oqcGoodEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default);
                 * if (objOQClot == null)
                 * {
                 *  throw new Exception("$Error_OQCLotNotExisted");
                 * }
                 * if (((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Initial)
                 * {
                 *  throw new Exception("$Error_OQCLotNO_Cannot_Initial");
                 * }
                 * if ((((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Reject) || ((((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Pass)))
                 * {
                 *  throw new Exception("$Error_OQCLotNO_HasComplete");
                 * }
                 */
                #endregion

                // Update tbloqc.status
                #region 修改OQCLot状态
                OQCLot oqcLot = new OQCLot();
                oqcLot.LOTNO       = oqcGoodEventArgs.OQCLotNO;
                oqcLot.LotSequence = OQCFacade.Lot_Sequence_Default;
                oqcLot.LOTStatus   = Web.Helper.OQCLotStatus.OQCLotStatus_Examing;
                oqcFacade.UpdateOQCLotStatus(oqcLot);
                #endregion

                // Update tbloqccardlotcklist
                //Maybe need check????
                #region OQCLOTCardCheckList
                if (oqcGoodEventArgs.OQCLOTCardCheckLists != null)
                {
                    OQCLOTCardCheckList oqcLotCardCheckList;
                    for (int i = 0; i < oqcGoodEventArgs.OQCLOTCardCheckLists.Length; i++)
                    {
                        if (oqcGoodEventArgs.OQCLOTCardCheckLists[i] != null)
                        {
                            oqcLotCardCheckList = oqcGoodEventArgs.OQCLOTCardCheckLists[i] as OQCLOTCardCheckList;
                            oqcLotCardCheckList.MaintainDate = currentDateTime.DBDate;
                            oqcLotCardCheckList.MaintainTime = currentDateTime.DBTime;
                            oqcFacade.AddOQCLOTCardCheckList(oqcLotCardCheckList);
                        }
                    }
                }
                #endregion

                // Update tbloqclotcklist
                #region OQCLOTCheckList
                object obj = oqcFacade.GetOQCLOTCheckList(oqcGoodEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default);
                if (obj == null)
                {
                    OQCLOTCheckList oqcCheckList = oqcFacade.CreateNewOQCLOTCheckList();
                    oqcCheckList.AGradeTimes  = OQCFacade.Decimal_Default_value;
                    oqcCheckList.BGradeTimes  = OQCFacade.Decimal_Default_value;
                    oqcCheckList.CGradeTimes  = OQCFacade.Decimal_Default_value;
                    oqcCheckList.ZGradeTimes  = OQCFacade.Decimal_Default_value;
                    oqcCheckList.LOTNO        = oqcGoodEventArgs.OQCLotNO;
                    oqcCheckList.LotSequence  = OQCFacade.Lot_Sequence_Default;
                    oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode;
                    oqcCheckList.MaintainDate = currentDateTime.DBDate;
                    oqcCheckList.MaintainTime = currentDateTime.DBTime;
                    oqcCheckList.Result       = OQCLotStatus.OQCLotStatus_Examing;

                    oqcFacade.AddOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists, oqcCheckList));
                }
                else
                {
                    OQCLOTCheckList oqcCheckList = obj as OQCLOTCheckList;
                    oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode;

                    oqcFacade.UpdateOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists, oqcCheckList));
                }
                #endregion

                // Update tbllot2cardcheck
                #region OQCLot2CardCheck

                OQCLot2CardCheck oqcLot2CardCheck = oqcFacade.CreateNewOQCLot2CardCheck();
                oqcLot2CardCheck.ItemCode            = oqcGoodEventArgs.ProductInfo.LastSimulation.ItemCode;
                oqcLot2CardCheck.LOTNO               = oqcGoodEventArgs.OQCLotNO;
                oqcLot2CardCheck.MaintainUser        = oqcGoodEventArgs.UserCode;
                oqcLot2CardCheck.MOCode              = oqcGoodEventArgs.ProductInfo.LastSimulation.MOCode;
                oqcLot2CardCheck.ModelCode           = oqcGoodEventArgs.ProductInfo.LastSimulation.ModelCode;
                oqcLot2CardCheck.OPCode              = oqcGoodEventArgs.ProductInfo.LastSimulation.OPCode;
                oqcLot2CardCheck.ResourceCode        = oqcGoodEventArgs.ResourceCode;
                oqcLot2CardCheck.RouteCode           = oqcGoodEventArgs.ProductInfo.LastSimulation.RouteCode;
                oqcLot2CardCheck.RunningCard         = oqcGoodEventArgs.ProductInfo.LastSimulation.RunningCard;
                oqcLot2CardCheck.RunningCardSequence = oqcGoodEventArgs.ProductInfo.LastSimulation.RunningCardSequence;

                BaseModelFacade dataModel = new BaseModelFacade(this.DataProvider);
                Resource        resource  = (Resource)dataModel.GetResource(oqcGoodEventArgs.ResourceCode);

                oqcLot2CardCheck.SegmnetCode = resource.SegmentCode;

                TimePeriod period = oqcGoodEventArgs.ProductInfo.TimePeriod;
                if (period == null)
                {
                    ShiftModelFacade shiftModel = new ShiftModelFacade(this.DataProvider);
                    period = (TimePeriod)shiftModel.GetTimePeriod(resource.ShiftTypeCode, currentDateTime.DBTime);
                    if (period == null)
                    {
                        throw new Exception("$OutOfPerid");
                    }
                }
                oqcLot2CardCheck.ShiftCode        = period.ShiftCode;
                oqcLot2CardCheck.ShiftTypeCode    = resource.ShiftTypeCode;
                oqcLot2CardCheck.Status           = ProductStatus.GOOD;
                oqcLot2CardCheck.StepSequenceCode = resource.StepSequenceCode;
                oqcLot2CardCheck.TimePeriodCode   = period.TimePeriodCode;

                oqcLot2CardCheck.IsDataLink    = oqcGoodEventArgs.IsDataLink;
                oqcLot2CardCheck.MaintainDate  = currentDateTime.DBDate;
                oqcLot2CardCheck.MaintainTime  = currentDateTime.DBTime;
                oqcLot2CardCheck.CheckSequence = oqcGoodEventArgs.CheckSequence;
                oqcLot2CardCheck.EAttribute1   = oqcGoodEventArgs.Memo;
                oqcFacade.AddOQCLot2CardCheck(oqcLot2CardCheck);

                #endregion

                // Good don't need update lot2errorcode or lotcard2errorcode
                ////// Update tbloqclot2errorcode
                ////// Update tbloqclotcard2errorcode

                messages.Add(new Message(MessageType.Success, "$CS_SampleConfirmOK"));
                // End Added

                #region Marked By Hi1/Venus.Feng on 20080720 for Hisense Version : Change OQC Flow

                /*
                 *              //填写SIMULATION 检查工单、ID、途程、操作
                 *              messages.AddMessages( dataCollect.CheckID(oqcGoodEventArgs));
                 *              if (messages.IsSuccess())
                 *              {
                 *                      //
                 *                      if(oqcGoodEventArgs.ProductInfo.NowSimulation == null)
                 *                      {
                 *                              throw new Exception("$System_Error");
                 *                      }
                 *                      //check oqclotstatus
                 #region CheckOQCLotStatus
                 * //					object objOQClot = oqcFacade.GetOQCLot(oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default);
                 * //					if(objOQClot == null)
                 * //					{
                 * //						throw new Exception("$Error_OQCLotNotExisted");
                 * //					}
                 * //					if( ((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Initial)
                 * //					{
                 * //						throw new Exception("$Error_OQCLotNO_Cannot_Initial");
                 * //					}
                 * //					if( (((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Reject)||((((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Pass) ) )
                 * //					{
                 * //						throw new Exception("$Error_OQCLotNO_HasComplete");
                 * //					}
                 #endregion
                 *
                 *
                 *                      messages.AddMessages( dataCollect.Execute(oqcGoodEventArgs));
                 *                      if (messages.IsSuccess())
                 *                      {
                 *                              //判断是否第一笔,如果是修改oqclot
                 #region 修改OQCLot状态
                 *                              //						object[] objs = oqcFacade.ExtraQueryOQCLot2CardCheck(string.Empty,string.Empty,oqcGoodEventArgs.ProductInfo.NowSimulation.MOCode,oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default.ToString());
                 *                              //						if(objs == null)
                 *                              //						{
                 *                              //object objLot = oqcFacade.GetOQCLot(oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default);
                 *                              OQCLot oqcLot = new OQCLot();
                 *                              oqcLot.LOTNO = oqcGoodEventArgs.OQCLotNO;
                 *                              oqcLot.LotSequence = OQCFacade.Lot_Sequence_Default;
                 *                              oqcLot.LOTStatus = Web.Helper.OQCLotStatus.OQCLotStatus_Examing;
                 *                              oqcFacade.UpdateOQCLotStatus(oqcLot);
                 *                              //						}
                 #endregion
                 *
                 *                              //add recrod to OQCLot2CardCheck
                 #region OQCLot2CardCheck
                 *                              OQCLot2CardCheck oqcLot2CardCheck = oqcFacade.CreateNewOQCLot2CardCheck();
                 *                              oqcLot2CardCheck.ItemCode = oqcGoodEventArgs.ProductInfo.NowSimulation.ItemCode;
                 *                              oqcLot2CardCheck.LOTNO = oqcGoodEventArgs.OQCLotNO;
                 *                              oqcLot2CardCheck.MaintainUser = oqcGoodEventArgs.UserCode;
                 *                              oqcLot2CardCheck.MOCode = oqcGoodEventArgs.ProductInfo.NowSimulation.MOCode;
                 *                              oqcLot2CardCheck.ModelCode = oqcGoodEventArgs.ProductInfo.NowSimulation.ModelCode;
                 *                              oqcLot2CardCheck.OPCode = oqcGoodEventArgs.ProductInfo.NowSimulation.OPCode;
                 *                              oqcLot2CardCheck.ResourceCode = oqcGoodEventArgs.ProductInfo.NowSimulation.ResourceCode;
                 *                              oqcLot2CardCheck.RouteCode = oqcGoodEventArgs.ProductInfo.NowSimulation.RouteCode;
                 *                              oqcLot2CardCheck.RunningCard = oqcGoodEventArgs.ProductInfo.NowSimulation.RunningCard;
                 *                              oqcLot2CardCheck.RunningCardSequence = oqcGoodEventArgs.ProductInfo.NowSimulation.RunningCardSequence;
                 *                              oqcLot2CardCheck.SegmnetCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.SegmentCode;
                 *                              oqcLot2CardCheck.ShiftCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.ShiftCode;
                 *                              oqcLot2CardCheck.ShiftTypeCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.ShiftTypeCode;
                 *                              oqcLot2CardCheck.Status =  ProductStatus.GOOD;
                 *                              oqcLot2CardCheck.StepSequenceCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode;
                 *                              oqcLot2CardCheck.TimePeriodCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.TimePeriodCode;
                 *
                 *                              oqcLot2CardCheck.IsDataLink = oqcGoodEventArgs.IsDataLink; //标识样本是不是来自数据连线 joe song 2006-06-08
                 *                              oqcLot2CardCheck.EAttribute1 = (oqcGoodEventArgs as OQCGoodEventArgs).Memo;//Laws Lu,2006/07/12 add memo field
                 *
                 *                              DBDateTime dbDateTime;
                 *                              //Laws Lu,2006/11/13 uniform system collect date
                 *                              if(actionEventArgs.ProductInfo.WorkDateTime != null)
                 *                              {
                 *                                      dbDateTime = actionEventArgs.ProductInfo.WorkDateTime;
                 *
                 *                              }
                 *                              else
                 *                              {
                 *                                      dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                 *                                      actionEventArgs.ProductInfo.WorkDateTime = dbDateTime;
                 *                              }
                 *
                 *                              oqcLot2CardCheck.MaintainDate = dbDateTime.DBDate;
                 *                              oqcLot2CardCheck.MaintainTime = dbDateTime.DBTime;
                 *                              oqcFacade.AddOQCLot2CardCheck(oqcLot2CardCheck);
                 #endregion
                 *
                 *                              //OQCLOTCardCheckList
                 *
                 #region OQCLOTCardCheckList
                 *                              if( oqcGoodEventArgs.OQCLOTCardCheckLists != null)
                 *                              {
                 *                                      for(int i=0;i<oqcGoodEventArgs.OQCLOTCardCheckLists.Length;i++)
                 *                                      {
                 *                                              if( oqcGoodEventArgs.OQCLOTCardCheckLists[i] != null)
                 *                                              {
                 *                                                      OQCLOTCardCheckList objCardCheck = oqcGoodEventArgs.OQCLOTCardCheckLists[i] as OQCLOTCardCheckList;
                 *                                                      objCardCheck.RunningCardSequence = oqcGoodEventArgs.ProductInfo.NowSimulation.RunningCardSequence;
                 *                                                      oqcFacade.AddOQCLOTCardCheckList(objCardCheck);
                 *                                              }
                 *                                      }
                 *                              }
                 #endregion
                 *
                 *                              //OQCLOTCheckList 统计
                 #region OQCLOTCheckList
                 *
                 *
                 *                              object obj = oqcFacade.GetOQCLOTCheckList(oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default);
                 *                              if(obj == null)
                 *                              {
                 *                                      OQCLOTCheckList oqcCheckList = oqcFacade.CreateNewOQCLOTCheckList();
                 *                                      oqcCheckList.AGradeTimes = OQCFacade.Decimal_Default_value;
                 *                                      oqcCheckList.BGradeTimes = OQCFacade.Decimal_Default_value;
                 *                                      oqcCheckList.CGradeTimes = OQCFacade.Decimal_Default_value;
                 *                                      oqcCheckList.LOTNO = oqcGoodEventArgs.OQCLotNO;
                 *                                      oqcCheckList.LotSequence = OQCFacade.Lot_Sequence_Default;
                 *                                      oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode;
                 *                                      oqcCheckList.MaintainDate = dbDateTime.DBDate;
                 *                                      oqcCheckList.MaintainTime = dbDateTime.DBTime;
                 *                                      oqcCheckList.Result = OQCLotStatus.OQCLotStatus_Examing;
                 *
                 *                                      oqcFacade.AddOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists,oqcCheckList));
                 *                              }
                 *                              else
                 *                              {
                 *                                      OQCLOTCheckList oqcCheckList = obj as OQCLOTCheckList;
                 *                                      oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode;
                 *
                 *                                      oqcFacade.UpdateOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists,oqcCheckList));
                 *                              }
                 #endregion
                 *
                 *                              //						#region this is for report add by crystal chu 2005/07/25
                 *                              //						ReportHelper reportCollect= new ReportHelper(this.DataProvider);
                 *                              //						messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,oqcGoodEventArgs.ActionType,oqcGoodEventArgs.ProductInfo));
                 *                              //						#endregion
                 *
                 *
                 *                      }
                 *              }
                 */

                #endregion
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Пример #17
0
        // Added end

        public override Messages Action(object act)
        {
            Messages msgs = new Messages();

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

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

            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();//产品序列号

            args.RunningCard = data;
            //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);		// Removed by Icyer 2006/12/15
            msgs = CheckSN(this._moCode, args.RunningCard, domainProvider);

            //add by hiro 08/11/05
            if (msgs.IsSuccess())
            {
                msgs = this.CheckSNContent(this._moCode, args.RunningCard, domainProvider);
            }
            //end by hiro

            if (msgs.IsSuccess())
            {
                //检查序列号
                ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);
                //msg.AddMessages(  _helper.GetIDInfo( args.RunningCard ) );
                msgs = _helper.GetIDInfoByMoCodeAndId(_moCode, args.RunningCard);

                if (msgs.IsSuccess())
                {
                    IDCTClient client = act as IDCTClient;

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

                    GoToMOActionEventArgs gotoMOArgs = new GoToMOActionEventArgs(
                        ActionType.DataCollectAction_GoMO,
                        args.RunningCard,
                        client.LoginedUser,
                        client.ResourceCode,
                        product,
                        _moCode);

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

                    //((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.OpenConnection();
                    domainProvider.BeginTransaction();
                    try
                    {
                        msgs = ((IActionWithStatus)action).Execute(gotoMOArgs);

                        if (msgs.IsSuccess())
                        {
                            domainProvider.CommitTransaction();
                            msgs.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOMO_CollectSuccess")));
                        }
                        else
                        {
                            if (msgs.OutPut().IndexOf("$CS_ID_Has_Already_Belong_To_This_MO") == 0)
                            {
                                msgs.ClearMessages();
                                msgs.Add(new UserControl.Message(UserControl.MessageType.Error, "$CS_ID_Has_Already_Belong_To_This_MO"));
                            }
                            domainProvider.RollbackTransaction();
                        }
                    }
                    catch (Exception ex)
                    {
                        domainProvider.RollbackTransaction();

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

            if (msgs.IsSuccess())
            {
                base.Action(act);
            }

            this.ObjectState = null;

            ProcessBeforeReturn(this.Status, msgs);

            return(msgs);
        }
Пример #18
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();

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

            DataCollectFacade dataCollect = new DataCollect.DataCollectFacade(domainProvider);
            TSFacade          tsFacade    = new TSFacade(domainProvider);

            if (msg.IsSuccess())
            {
                MO          moWillGo = (MO)keypartsHT["MOWillGo"];
                ProductInfo product  = (ProductInfo)keypartsHT["ProdcutInfo"];

                if (opBomDetailCount > opBomDetailCollectNum)
                {
                    try
                    {
                        object[] opBomDetailCompare = new object[opBomDetailList.Count];
                        opBomDetailList.CopyTo(opBomDetailCompare);
                        string ItemCode = string.Empty;

                        string parseTypeSetting = "," + ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).OPBOMParseType + ",";
                        string checkTypeSetting = "," + ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).OPBOMCheckType + ",";
                        bool   checkStatus      = ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).CheckStatus == BenQGuru.eMES.Web.Helper.FormatHelper.TRUE_STRING;

                        string CheckNeedVendor = string.Empty;
                        if (!string.IsNullOrEmpty(((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).NeedVendor))
                        {
                            CheckNeedVendor = ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).NeedVendor;
                        }

                        string MItemCode   = ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).OPBOMItemCode;
                        string OBSItemCode = ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).OPBOMSourceItemCode;
                        int    inputLength = ((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).SerialNoLength;

                        MaterialFacade facade   = new MaterialFacade(domainProvider);
                        MINNO          newMINNO = facade.CreateNewMINNO();
                        newMINNO.MItemCode = MItemCode;

                        Messages parseSuccess    = new Messages();
                        Messages oldParseSuccess = new Messages();

                        parseSuccess.Add(new UserControl.Message(MessageType.Error, "$CS_Error_ParseFailed:"));
                        int num = 0;


                        //勾选了料号比对,必须选择解析方式
                        if (checkTypeSetting.IndexOf("," + OPBOMDetailCheckType.CHECK_COMPAREITEM.ToLower() + ",") >= 0)
                        {
                            if (parseTypeSetting.IndexOf("," + OPBOMDetailParseType.PARSE_BARCODE.ToLower() + ",") < 0 &&
                                parseTypeSetting.IndexOf("," + OPBOMDetailParseType.PARSE_PREPARE.ToLower() + ",") < 0 &&
                                parseTypeSetting.IndexOf("," + OPBOMDetailParseType.PARSE_PRODUCT.ToLower() + ",") < 0)
                            {
                                msg.Add(new UserControl.Message(MessageType.Error, " $CS_Error_ParseFailed:$CheckCompareItem_Must_CheckOneParse"));
                                goto Label2;
                            }
                        }

                        //Parse from barcode
                        if (!parseSuccess.IsSuccess() && parseTypeSetting.IndexOf("," + OPBOMDetailParseType.PARSE_BARCODE.ToLower() + ",") >= 0)
                        {
                            OPBOMDetail opBOMDetailForItemCode = null;
                            if (checkTypeSetting.IndexOf("," + OPBOMDetailCheckType.CHECK_COMPAREITEM.ToLower() + ",") >= 0)
                            {
                                opBOMDetailForItemCode = (OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum];
                            }
                            oldParseSuccess.AddMessages(parseSuccess);
                            parseSuccess = dataCollect.ParseFromBarcode(ref newMINNO, data, opBOMDetailForItemCode, inputLength);

                            num += 1;
                        }
                        //Parse from prepare
                        if (!parseSuccess.IsSuccess() && parseTypeSetting.IndexOf("," + OPBOMDetailParseType.PARSE_PREPARE.ToLower() + ",") >= 0)
                        {
                            Simulation sim = (Simulation)dataCollect.GetSimulation(ID);
                            newMINNO.MOCode = sim.MOCode;
                            OPBOMDetail opBOMDetailForItemCode = null;
                            if (checkTypeSetting.IndexOf("," + OPBOMDetailCheckType.CHECK_COMPAREITEM.ToLower() + ",") >= 0)
                            {
                                opBOMDetailForItemCode = (OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum];
                            }
                            oldParseSuccess.AddMessages(parseSuccess);
                            parseSuccess = dataCollect.ParseFromPrepare(ref newMINNO, data, opBOMDetailForItemCode, inputLength);

                            num += 1;
                        }
                        //Parse from product
                        if (!parseSuccess.IsSuccess() && parseTypeSetting.IndexOf("," + OPBOMDetailParseType.PARSE_PRODUCT.ToLower() + ",") >= 0)
                        {
                            OPBOMDetail opBOMDetailForItemCode = null;
                            if (checkTypeSetting.IndexOf("," + OPBOMDetailCheckType.CHECK_COMPAREITEM.ToLower() + ",") >= 0)
                            {
                                opBOMDetailForItemCode = (OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum];
                            }
                            oldParseSuccess.AddMessages(parseSuccess);
                            parseSuccess = dataCollect.ParseFromProduct(ref newMINNO, checkStatus, data, opBOMDetailForItemCode, inputLength);

                            num += 1;
                        }

                        if (!parseSuccess.IsSuccess())
                        {
                            if (num > 0)
                            {
                                oldParseSuccess.AddMessages(parseSuccess);
                                msg.AddMessages(oldParseSuccess);
                                goto Label2;
                            }

                            if (num == 0)
                            {
                                if (inputLength > 0 && data.Trim().Length != inputLength)
                                {
                                    msg.Add(new UserControl.Message(MessageType.Error, "$Error_SNLength_Wrong"));
                                    goto Label2;
                                }
                            }
                        }

                        //检查新上料是否在TS中而不可用
                        if (!tsFacade.RunningCardCanBeClollected(data, CardType.CardType_Part))
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_InTSOrScrapped $SERIAL_NO=" + data));
                            goto Label2;
                        }

                        #region Check if key part was used

                        if (((OPBOMDetail)opBomDetailCompare[opBomDetailCollectNum]).OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_KEYPARTS &&
                            KeyPartUsed(domainProvider, data, newMINNO.MItemCode, true))
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$CS_Error_KeyPartUsed"));
                            goto Label2;
                        }

                        #endregion

                        #region check NeedVendor


                        //如果VendorCode为空,到tblmaterial中获取
                        if (newMINNO.VendorCode == null || newMINNO.VendorCode.Trim().Length <= 0)
                        {
                            ItemFacade itemfacade  = new ItemFacade(domainProvider);
                            object     objMaterial = itemfacade.GetMaterial(newMINNO.MItemCode.Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID);
                            if (objMaterial != null)
                            {
                                newMINNO.VendorCode = ((BenQGuru.eMES.Domain.MOModel.Material)objMaterial).VendorCode;
                            }
                        }

                        if (CheckNeedVendor == NeedVendor.NeedVendor_Y)
                        {
                            Messages checkNeedVendor = new Messages();
                            checkNeedVendor = dataCollect.CheckNeedVebdor(newMINNO);

                            if (!checkNeedVendor.IsSuccess())
                            {
                                msg.AddMessages(checkNeedVendor);
                                goto Label2;
                            }
                        }

                        #endregion

                        if (checkTypeSetting.IndexOf("," + OPBOMDetailCheckType.CHECK_LINKBARCODE.ToLower() + ",") >= 0)
                        {
                            //Link barcode
                            if (string.IsNullOrEmpty(newMINNO.MItemCode))
                            {
                                newMINNO.MItemCode = MItemCode;
                            }

                            newMINNO.MItemPackedNo = data;
                            if (((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_KEYPARTS)
                            {
                                newMINNO.EAttribute1 = MCardType.MCardType_Keyparts;
                            }
                            else if (((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_LOT)
                            {
                                newMINNO.EAttribute1 = MCardType.MCardType_INNO;
                                newMINNO.Qty         = ((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMItemQty;
                            }

                            opBomdetailRealCollectList.Add((object)newMINNO);
                        }

                        ++opBomDetailCollectNum;
Label2:

                        if (opBomDetailCount > opBomDetailCollectNum)
                        {
                            if (((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMItemControlType != null &&
                                ((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_LOT)
                            {
                                msg.Add(new UserControl.Message(MessageType.Normal, ">>$DCT_PLEASE_INPUT_Lot:" + ((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMSourceItemCode));

                                ProcessBeforeReturn(this.Status, msg);
                                return(msg);
                            }
                            else
                            {
                                msg.Add(new UserControl.Message(MessageType.Normal, ">>$CS_PleaseInputKeypart:" + ((OPBOMDetail)opBomDetailList[opBomDetailCollectNum]).OPBOMSourceItemCode));

                                ProcessBeforeReturn(this.Status, msg);
                                return(msg);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        msg.Add(new UserControl.Message(MessageType.Error, ex.Message));
                    }
                }


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

                    //检查新上料是否在TS中而不可用
                    if (opBomdetailRealCollectList != null)
                    {
                        foreach (MINNO minno in opBomdetailRealCollectList)
                        {
                            if (!tsFacade.RunningCardCanBeClollected(minno.MItemPackedNo, CardType.CardType_Part))
                            {
                                msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_InTSOrScrapped $SERIAL_NO=" + minno.MItemPackedNo));
                                break;
                            }
                        }
                    }

                    #region Check if key part was used

                    if (opBomdetailRealCollectList != null)
                    {
                        foreach (MINNO minno in opBomdetailRealCollectList)
                        {
                            if (minno.EAttribute1 == MCardType.MCardType_Keyparts)
                            {
                                if (KeyPartUsed(domainProvider, minno.MItemPackedNo, minno.MItemCode, false))
                                {
                                    msg.Add(new UserControl.Message(MessageType.Error, "$CS_Error_KeyPartUsed"));
                                    break;
                                }
                            }
                        }
                    }

                    #endregion

                    if (msg.IsSuccess())
                    {
                        object[] objOpBomdetailRealCollect = new object[opBomdetailRealCollectList.Count];
                        opBomdetailRealCollectList.CopyTo(objOpBomdetailRealCollect);

                        string strRCard = product.NowSimulation.RunningCard;



                        msg.AddMessages(_helper.ActionWithTransaction(
                                            new CINNOActionEventArgs(
                                                ActionType.DataCollectAction_CollectINNO, strRCard,
                                                client.LoginedUser,
                                                client.ResourceCode,
                                                product,
                                                string.Empty,
                                                wfacade), actionCheckStatus, objOpBomdetailRealCollect));
                    }


                    #region 物料过账

                    if (msg.IsSuccess())
                    {
                        BaseModelFacade bMfacade = new BaseModelFacade(domainProvider);
                        object          objOP    = bMfacade.GetOperationByResource(client.ResourceCode);
                        string          strRCard = product.NowSimulation.RunningCard;

                        object[] objOpBomdetailRealCollect = new object[opBomdetailRealCollectList.Count];
                        opBomdetailRealCollectList.CopyTo(objOpBomdetailRealCollect);

                        if (opBomdetailRealCollectList != null && opBomdetailRealCollectList.Count > 0)
                        {
                            Messages messagesNew = new Messages();
                            string   ItemCode    = string.Empty;

                            DataCollectFacade dataCollectFacade = new DataCollectFacade(domainProvider);
                            object            objectSimulation  = dataCollectFacade.GetSimulation(strRCard);
                            if (objectSimulation != null)
                            {
                                ItemCode = ((Simulation)objectSimulation).ItemCode;
                            }

                            foreach (MINNO minno in opBomdetailRealCollectList)
                            {
                                messagesNew.AddMessages(_helper.ActionWithTransaction(new TryEventArgs(
                                                                                          ActionType.DataCollectAction_TryNew, client.LoginedUser, ((Operation2Resource)objOP).OPCode, client.ResourceCode,
                                                                                          ItemCode, strRCard, minno.MItemCode, minno.MItemPackedNo, string.Empty, true, true)));
                            }
                            msg.AddMessages(messagesNew);
                        }
                    }

                    #endregion

                    if (msg.IsSuccess())
                    {
                        if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                        {
                            if (wfacade != null)
                            {
                                wfacade.ExecCacheSQL();
                            }
                        }

                        #region 增加良品采集
                        {
                            Resource Resource = (Resource)dataModel.GetResource(client.ResourceCode);

                            Messages messages1 = new Messages();
                            if (actionCheckStatus.ProductInfo == null)
                            {
                                messages1 = _helper.GetIDInfo(ID);
                                actionCheckStatus.ProductInfo          = (ProductInfo)messages1.GetData().Values[0];
                                actionCheckStatus.ProductInfo.Resource = Resource;
                                lastSimulation = actionCheckStatus.ProductInfo.LastSimulation;
                                msg.AddMessages(messages1);
                            }
                            else        //将上一个Action的NowSimulation设置为本Action的LastSimulation
                            {
                                if (actionCheckStatus.ActionList.Count > 0)
                                {
                                    actionCheckStatus.ProductInfo = new ProductInfo();
                                    actionCheckStatus.ProductInfo.NowSimulation = new Simulation();
                                    actionCheckStatus.ProductInfo.Resource      = Resource;
                                    //actionCheckStatus.ProductInfo.LastSimulation =
                                    //    new ExtendSimulation(((ActionEventArgs)actionCheckStatus.ActionList[actionCheckStatus.ActionList.Count - 1]).ProductInfo.NowSimulation);
                                    actionCheckStatus.ProductInfo.LastSimulation =
                                        new ExtendSimulation((Simulation)(new DataCollectFacade(domainProvider)).GetLastSimulationOrderByDateAndTime(ID));
                                }
                            }

                            product = actionCheckStatus.ProductInfo;

                            // Changed end
                            if (msg.IsSuccess())
                            {
                                messages1.AddMessages(_helper.ActionWithTransaction(new ActionEventArgs(ActionType.DataCollectAction_GOOD, ID,
                                                                                                        client.LoginedUser, client.ResourceCode,
                                                                                                        product), actionCheckStatus));
                            }
                        }
                        #endregion
                    }

                    if (msg.IsSuccess())
                    {
                        domainProvider.CommitTransaction();
                        msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_CollectSuccess")));
                    }
                    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);

                this.ObjectState = null;
                this.keypartsHT  = null;
                this.opBomDetailList.Clear();
                this.opBomDetailCount      = 0;
                this.opBomDetailCollectNum = 0;
                this.opBomdetailRealCollectList.Clear();
                ID = string.Empty;
            }

            ProcessBeforeReturn(this.Status, msg);
            return(msg);
        }
Пример #19
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;
            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 (errorCodesHT == null)
                    {
                        errorCodesHT = new Hashtable();
                    }

                    if (!errorCodesHT.ContainsKey(data))
                    {
                        errorCodesHT.Add(data, data);
                    }

                    base.Action(act);
                    ActionCollectOutlineNG actionCollectOutlineNG = this;

                    actionCollectOutlineNG.IsTopAction = false;
                    this.NextAction = actionCollectOutlineNG;
                    this.Status     = ActionStatus.PrepareData;
                    //Laws Lu,2006/07/11 write back error code
                    msg.Add(new UserControl.Message(MessageType.Success, data));

                    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())
                    {
                        string[] errorcs = new string[errorCodesHT.Count];
                        int      i       = 0;
                        foreach (DictionaryEntry dic in errorCodesHT)
                        {
                            errorcs[i] = dic.Key.ToString();
                            i++;
                        }
                        //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);

                            if (errorcodes == null || errorcodes.Length == 0)
                            {
                                msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$ErrorCode_Not_BelongTo_ModelCode"));
                            }
                        }

                        object[] oplist = null;
                        if (msg.IsSuccess())
                        {
                            oplist = GetOutLineOP(domainProvider, (act as IDCTClient).ResourceCode);

                            if (oplist == null || oplist.Length == 0)
                            {
                                msg.Add(new UserControl.Message(MessageType.Error, "$CSError_Res_Cannot_Collect_OUtlineGood"));
                            }
                        }

                        string opcode = string.Empty;
                        if (msg.IsSuccess())
                        {
                            opcode = (oplist[0] as Operation).OPCode;
                            if (CheckOutlineOPInRoute(domainProvider, product.LastSimulation.RouteCode, opcode))
                            {
                                msg.Add(new UserControl.Message(MessageType.Error, "$CS_OutLineOP_In_ThisRoute"));
                            }
                        }

                        if (msg.IsSuccess())
                        {
                            if (IsLastOP(domainProvider, product.LastSimulation.MOCode, product.LastSimulation.RouteCode, product.LastSimulation.OPCode))
                            {
                                msg.Add(new UserControl.Message(MessageType.Error, "$CS_Op_IsLast_OutLineOP_Cannot_Collect"));
                            }
                        }

                        if (msg.IsSuccess())
                        {
                            IAction dataCollectModule
                                = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_OutLineNG);

                            domainProvider.BeginTransaction();
                            try
                            {
                                IDCTClient client = act as IDCTClient;

                                msg.AddMessages((dataCollectModule).Execute(new OutLineActionEventArgs(
                                                                                ActionType.DataCollectAction_OutLineNG,
                                                                                args.RunningCard,
                                                                                client.LoginedUser,
                                                                                client.ResourceCode,
                                                                                product,
                                                                                opcode,
                                                                                errorcodes,
                                                                                "")));

                                if (msg.IsSuccess())
                                {
                                    domainProvider.CommitTransaction();
                                    msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_NGSUCCESS")));

                                    //msg.Add( new UserControl.Message(MessageType.Succes ,string.Format("$CS_NGSUCCESS,$CS_Param_ID: {0}", args.RunningCard)));
                                }
                                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 ActionCollectOutlineNG)
            {
                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;
            }

            base.Action(act);

            ActionRCard actRcard = new ActionRCard();

            this.NextAction = actRcard;


            return(msg);
        }
Пример #20
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);
        }
Пример #21
0
        public override Messages Action(object act)
        {
            Messages msgs = new Messages();

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

            SQLDomainDataProvider domainProvider = null;

            if ((act as IDCTClient).DBConnection != null)
            {
                domainProvider = (act as IDCTClient).DBConnection as SQLDomainDataProvider;
            }
            else
            {
                domainProvider = DomainDataProviderManager.DomainDataProvider() as SQLDomainDataProvider;
                (act as IDCTClient).DBConnection = domainProvider;
            }

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

            if (msgs.IsSuccess())
            {
                ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);

                msgs = _helper.GetIDInfo(args.RunningCard);

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

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

                    domainProvider.BeginTransaction();

                    try
                    {
                        IDCTClient client = act as IDCTClient;

                        //良品采集
                        if (msgs.IsSuccess())
                        {
                            msgs.AddMessages(((IActionWithStatus)dataCollectModule).Execute(
                                                 new ActionEventArgs(
                                                     ActionType.DataCollectAction_GOOD,
                                                     args.RunningCard,
                                                     client.LoginedUser,
                                                     client.ResourceCode,
                                                     product)));
                        }


                        if (msgs.IsSuccess())
                        {
                            domainProvider.CommitTransaction();
                            msgs.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOODSUCCESS")));
                        }
                        else
                        {
                            domainProvider.RollbackTransaction();
                        }
                    }
                    catch (Exception ex)
                    {
                        domainProvider.RollbackTransaction();
                        msgs.Add(new UserControl.Message(ex));
                    }
                    finally
                    {
                        ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection();
                    }
                }
            }

            if (msgs.IsSuccess())
            {
                base.Action(act);
            }

            ProcessBeforeReturn(this.Status, msgs);
            return(msgs);
        }
Пример #22
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);
        }
Пример #23
0
        // Added end

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

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

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

            if (this.mergeList == 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();              //转换后序列号

            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 (mergeList == null)
            {
                msg = this.CheckProduct(act, args.RunningCard);
            }

            msg = CheckData(data, domainProvider);
            if (msg.IsSuccess() == false)
            {
                ProcessBeforeReturn(this.Status, msg);
                return(msg);
            }

            if (msg.IsSuccess())
            {
                msg = mergeList["ProdcutInfo"] as Messages;

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

                ArrayList listId = (ArrayList)mergeList["MergeIdList"];
                if (this.IDMergeRule > listId.Count)
                {
                    listId.Add(data);

                    mergeList["MergeIdList"] = listId;
                }

                if (this.IDMergeRule > listId.Count)
                {
                    this.OutMesssage = new UserControl.Message(MessageType.Normal, "$CS_Please_Input_Merge_ID " + (listId.Count + 1).ToString() + "/" + this.IDMergeRule.ToString());

                    msg.Add(this.OutMesssage);
                    ProcessBeforeReturn(this.Status, msg);
                    return(msg);
                }

                msg = this.DoDataCollectAction(domainProvider, (IDCTClient)act, this.isSameMO, Convert.ToInt32(this.existIMEISeq), this.updateSimulation);
            }

            if (msg.IsSuccess())
            {
                base.Action(act);
                this.ObjectState = null;
                ResetData();
            }

            ProcessBeforeReturn(this.Status, msg);
            return(msg);
        }
Пример #24
0
        public override Messages Action(object act)
        {
            Messages msgs = new Messages();

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

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

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

            //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 (msgs.IsSuccess())
            {
                //检查序列号
                ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);

                msgs = _helper.GetIDInfo(args.RunningCard);

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

                    if (product == null || product.LastSimulation == null)
                    {
                        msgs.Add(new UserControl.Message(MessageType.Error, "$NoSimulation"));
                    }
                    else
                    {
                        msgs.ClearMessages();
                        if (product.LastSimulation.IsComplete == "1")
                        {
                            msgs.Add(new UserControl.Message(MessageType.Error, "$CS_ERROR_PRODUCT_ALREADY_COMPLETE"));
                        }
                        else
                        {
                            switch (product.LastSimulation.ProductStatus)
                            {
                            case ProductStatus.NG:
                                BenQGuru.eMES.Domain.TS.TS ts = (BenQGuru.eMES.Domain.TS.TS)(new TSFacade(domainProvider)).GetCardLastTSRecord(args.RunningCard);
                                if (ts != null &&
                                    (ts.TSStatus == TSStatus.TSStatus_Complete || ts.TSStatus == TSStatus.TSStatus_Reflow))
                                {
                                    msgs.AddMessages(GetRunningCardOP(product, domainProvider));
                                }
                                else
                                {
                                    msgs.Add(new UserControl.Message(MessageType.Error, "$CS_NG_PLEASE_SEND_TS"));
                                }

                                break;

                            case ProductStatus.OffMo:
                                msgs.Add(new UserControl.Message(MessageType.Error, "$CS_RCRAD_ALREADY_OFF_MO"));
                                break;

                            case ProductStatus.Scrap:
                                msgs.Add(new UserControl.Message(MessageType.Error, "$CS_Error_Product_Already_Scrap"));
                                break;

                            default:
                                msgs.AddMessages(GetRunningCardOP(product, domainProvider));
                                break;
                            }
                        }
                    }
                }
            }

            if (msgs.IsSuccess())
            {
                base.Action(act);
            }

            ProcessBeforeReturn(this.Status, msgs);

            return(msgs);
        }