예제 #1
0
        public string BuildQuerySQL(string type)
        {
            string filed        = MatchField(type);
            string table        = FromTable(type);
            string factoryfield = FactoryField(type);
            long   seq          = 0;

            if (string.Compare(type, "Model2Item", true) == 0)
            {
                return(string.Format("SELECT {0} FROM {1} where {2}='{3}' and imodl <> ' '", filed, table, factoryfield, this.Factory));
            }
            if (string.Compare(type, "ERPBOM", true) == 0)
            {
                BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider mesDomainDataProvider =
                    BenQGuru.eMES.Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()
                    as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;

                try
                {
                    seq = mesDomainDataProvider.GetCount(new BenQGuru.eMES.Common.Domain.SQLCondition("select max(SEQUENCE)  from tblerpbom"));
                }
                catch {}

                return(string.Format("SELECT {0} FROM {1} where {2}='{3}' and serialno > {4}", filed, table, factoryfield, this.Factory, seq));
                //return string.Format("SELECT {0} FROM {1} where {2}='{3}' and serialno > 1846699", filed, table, factoryfield, this.Factory,seq);
            }

            return(string.Format("SELECT {0} FROM {1} where {2}='{3}'", filed, table, factoryfield, this.Factory));
        }
예제 #2
0
        protected override int GetRowCount()
        {
            BenQGuru.eMES.Common.Domain.IDomainDataProvider provider = null;
            try
            {
                provider = base.DataProvider;
                BenQGuru.eMES.Material.InventoryFacade facade = new InventoryFacade(provider);
                string no        = this.Session["FInvRCardQP_No"].ToString();
                string seq       = this.Session["FInvRCardQP_Seq"].ToString();
                string status    = this.Session["FInvRCardQP_Status"].ToString();
                string rcardfrom = this.Session["FInvRCardQP_From"].ToString();
                string rcardto   = this.Session["FInvRCardQP_To"].ToString();
                string datefrom  = this.Session["FInvRCardQP_DateFrom"].ToString();
                string dateto    = this.Session["FInvRCardQP_DateTo"].ToString();

                if (_type == "ship")
                {
                    return(facade.QueryInvShipRCardWebCount(no, seq, datefrom, dateto, rcardfrom, rcardto));
                }
                else
                {
                    return(facade.QueryInvRCardWebCount(no, seq, status, datefrom, dateto, rcardfrom, rcardto));
                }
            }
            finally
            {
                if (provider != null)
                {
                    BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider p = provider as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
                    BenQGuru.eMES.Common.PersistBroker.OLEDBPersistBroker         b = p.PersistBroker as BenQGuru.eMES.Common.PersistBroker.OLEDBPersistBroker;
                    //b.CloseConnection();
                }
                //((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)provider).PersistBroker.CloseConnection();
            }
        }
예제 #3
0
        private Messages CheckINNO(object act)
        {
            Messages msg = new Messages();

            BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null;
            if ((act as IDCTClient).DBConnection != null)
            {
                domainProvider = (act as IDCTClient).DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
            }
            else
            {
                domainProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()
                                 as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
                (act as IDCTClient).DBConnection = domainProvider;
            }
            string         strInno  = act.ToString().ToUpper();
            MaterialFacade material = new MaterialFacade(domainProvider);

            object[] objsInno = material.GetLastMINNOs(strInno);
            if (objsInno == null)
            {
                msg.Add(new Message(MessageType.Error, "$CS_INNO_NOT_EXIST"));
                return(msg);
            }
            return(msg);
        }
예제 #4
0
        // Added by Icyer 2006/12/15
        // 检查工单
        private Messages CheckMO(object act)
        {
            Messages msgs = new Messages();

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

            MOFacade moFacade = new MOFacade(domainProvider);
            MO       mo       = (MO)moFacade.GetMO(act.ToString().ToUpper());

            if (mo == null)
            {
                msgs.Add(new UserControl.Message(MessageType.Error, "$CS_MO_NOT_EXIST"));
                ProcessBeforeReturn(this.Status, msgs);
                return(msgs);
            }
            if (mo.MOStatus != BenQGuru.eMES.Web.Helper.MOManufactureStatus.MOSTATUS_RELEASE &&
                mo.MOStatus != BenQGuru.eMES.Web.Helper.MOManufactureStatus.MOSTATUS_OPEN)
            {
                msgs.Add(new UserControl.Message(MessageType.Error, "$Error_CS_MO_Should_be_Release_or_Open"));
                ProcessBeforeReturn(this.Status, msgs);
                return(msgs);
            }

            MO2Route route = (MO2Route)moFacade.GetMONormalRouteByMOCode(mo.MOCode);

            if (route == null)
            {
                msgs.Add(new UserControl.Message(MessageType.Error, "$CS_MOnotNormalRoute"));
                ProcessBeforeReturn(this.Status, msgs);
                return(msgs);
            }

            DataCollectFacade dataCollectFacade = new DataCollectFacade(domainProvider);
            ItemRoute2OP      op = dataCollectFacade.GetMORouteFirstOP(mo.MOCode, route.RouteCode);

            BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider);
            if (dataModel.GetOperation2Resource(op.OPCode, (act as IDCTClient).ResourceCode) == null)
            {
                msgs.Add(new UserControl.Message(MessageType.Error, "$CS_Route_Failed_FirstOP $Domain_MO =" + mo.MOCode));
                ProcessBeforeReturn(this.Status, msgs);
                return(msgs);
            }

            ProcessBeforeReturn(this.Status, msgs);

            return(msgs);
        }
예제 #5
0
        public override Messages PreAction(object act)
        {
            Messages msg = new Messages();

            if (checkCycle)
            {
                strCarton = act.ToString().ToUpper();

                if (strCarton == string.Empty)
                {
                    msg.Add(new UserControl.Message(MessageType.Normal, "$CS_CARTON_ISNULL"));
                    ProcessBeforeReturn(this.Status, msg);
                    return(msg);
                }

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

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

                object obj = (new Package.PackageFacade(domainProvider)).GetExistCARTONINFO(strCarton);

                if (obj == null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$CS_CARTON_NOT_EXIST"));
                    ProcessBeforeReturn(this.Status, msg);
                    return(msg);
                }
                else
                {
                    checkCycle = false;
                    base.PreAction(act);
                    msg.Add(new UserControl.Message(MessageType.Normal, "$CS_CARTON_NO [" + strCarton + "]"));
                    msg.Add(new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_WRAPPER"));
                    return(msg);
                }
            }
            else
            {
                base.PreAction(act);
                return(msg);
            }
        }
예제 #6
0
        public void Close()
        {
            if (socket != null)
            {
                socket.Shutdown(SocketShutdown.Both);
                socket.Close();
            }

            //Add by vivan.sun 2011-6-3
            if (this.DBConnection != null)
            {
                BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = this.DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
                domainProvider.PersistBroker.CloseConnection();
            }
            //end add
        }
예제 #7
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);
        }
예제 #8
0
        /// <summary>
        /// 查询产品别代码:如果mo不为null,则通过工单号查询产品别,否则通过product中的序列号查询
        /// </summary>
        /// <returns></returns>
        private string GetModelCodeFromProduct(ProductInfo product, MO mo, BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider)
        {
            string strModelCode = string.Empty;

            if (mo != null)
            {
                BenQGuru.eMES.MOModel.ModelFacade modelFacade = new ModelFacade(domainProvider);
                object[] objsModel = modelFacade.GetModel2ItemByItemCode(mo.ItemCode);
                if (objsModel != null && objsModel.Length > 0)
                {
                    Model2Item modelItem = (Model2Item)objsModel[0];
                    strModelCode = modelItem.ModelCode;
                }
            }
            else if (product.LastSimulation != null)
            {
                strModelCode = product.LastSimulation.ModelCode;
            }
            return(strModelCode);
        }
예제 #9
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);
        }
예제 #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();
            }
            else
            {
                args = ObjectState as DataCollect.Action.ActionEventArgs;
            }

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

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

            msg = CheckData(data, domainProvider);

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

                args.ResourceCode = data;

                //ActionPassword acPwd = new ActionPassword();

                //			acPwd.ObjectState = ObjectState;
                //			this.NextAction = acPwd;

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

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


                ObjectState = args;

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

                // Added By Scott Gu for Hisense Version : Add Org ID
                object obj = new BaseModelFacade(domainProvider).GetResource(args.ResourceCode);
                object org = (new BaseModelFacade(domainProvider)).GetOrg(((Resource)obj).OrganizationID);
                if (org != null)
                {
                    GlobalVariables.CurrentOrganizations.Clear();
                    GlobalVariables.CurrentOrganizations.Add((Organization)org);
                }
                else
                {
                    msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$Error_NoOrganizationOfTheResource"));
                }
            }

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

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

                ActionRCard actRcard = new ActionRCard();
                actRcard.OutMesssage            = new Message(MessageType.Normal, "$DCT_PLEASE_ACTION");
                actRcard.NeedInputActionCommand = true;

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

            return(msg);
        }
예제 #11
0
        // Added by Icyer 2006/12/15
        // 检查产品
        private Messages CheckProduct(object act, string runningCard)
        {
            // 查询产品信息
            BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null;
            if ((act as IDCTClient).DBConnection != null)
            {
                domainProvider = (act as IDCTClient).DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
            }
            else
            {
                domainProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()
                                 as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
                (act as IDCTClient).DBConnection = domainProvider;
            }

            ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);

            UserControl.Messages msgProduct = _helper.GetIDInfo(runningCard);
            ProductInfo          product    = (ProductInfo)msgProduct.GetData().Values[0];

            if (product == null || product.LastSimulation == null)
            {
                msgProduct.ClearMessages();
                msgProduct.Add(new UserControl.Message(MessageType.Error, "$NoSimulation"));
                return(msgProduct);
            }
            mergeList = new Hashtable();
            mergeList.Add("ProdcutInfo", msgProduct);

            // 转换比例
            //this.IDMergeRule = Convert.ToInt32(product.LastSimulation.IDMergeRule);	// 转换比例从工序中读

            IDCTClient  client      = act as IDCTClient;
            OPBOMFacade opBOMFacade = new OPBOMFacade(domainProvider);
            // 检查途程
            Messages messages1 = _helper.CheckID(
                new CKeypartsActionEventArgs(
                    ActionType.DataCollectAction_Split,
                    product.LastSimulation.RunningCard,
                    client.LoginedUser,
                    client.ResourceCode,
                    product,
                    null,
                    null));

            if (messages1.IsSuccess() == true)
            {
                object op = new ItemFacade(domainProvider).GetItemRoute2Operation(
                    product.NowSimulation.ItemCode,
                    product.NowSimulation.RouteCode,
                    product.NowSimulation.OPCode);
                if (op == null)
                {
                    messages1.Add(new UserControl.Message(MessageType.Error, "$Error_CS_Current_OP_Not_Exist"));
                    return(messages1);
                }
                if (((ItemRoute2OP)op).OPControl[(int)BenQGuru.eMES.BaseSetting.OperationList.IDTranslation] != '1')
                {
                    messages1.Add(new UserControl.Message(MessageType.Error, "$CS_OP_Not_SplitOP"));                            //当前工序不是序号转换工序
                    return(messages1);
                }
                // 转换比例
                this.IDMergeRule = 1;
                if (((ItemRoute2OP)op).IDMergeType == IDMergeType.IDMERGETYPE_ROUTER)
                {
                    this.IDMergeRule = (int)((ItemRoute2OP)op).IDMergeRule;
                }
                // 序号转换类型
                mergeIdType = ((ItemRoute2OP)op).IDMergeType;
                ArrayList listId = new ArrayList();
                mergeList.Add("MergeIdList", listId);
            }
            else
            {
                return(messages1);
            }

            return(msgProduct);
        }
예제 #12
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);
        }
예제 #13
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);
        }
예제 #14
0
        public override Messages PreAction(object act)
        {
            Messages msg = new Messages();

            BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null;
            if (act == null)
            {
                return(msg);
            }
            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;
            }

            _face = new DataCollectFacade(domainProvider);
            ItemFacade itemFacade = new ItemFacade(domainProvider);

            if (checkCycle)
            {
                strRcard = act.ToString().Trim().ToUpper();

                if (strRcard == string.Empty)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$CS_IDisNull"));
                    ProcessBeforeReturn(this.Status, msg);
                    return(msg);
                }

                _objSimulation = _face.GetSimulation(strRcard);
                if (_objSimulation == null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$NoProductInfo"));
                    ProcessBeforeReturn(this.Status, msg);
                    return(msg);
                }

                _item = itemFacade.GetItem((_objSimulation as Simulation).ItemCode.ToUpper().Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID);
                if (_item == null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$Error_ItemCode_NotExist $Domain_Item=" + (_objSimulation as Simulation).ItemCode));
                    ProcessBeforeReturn(this.Status, msg);
                    return(msg);
                }

                checkCycle = false;
                base.PreAction(act);

                msg.Add(new UserControl.Message(MessageType.Normal, "$CS_Param_ID [" + strRcard + "]"));
                msg.Add(new UserControl.Message(MessageType.Success, "$CS_PLEASE_INPUT_CARTONNO"));
                m_FlowControl++;
                return(msg);
            }
            else
            {
                base.PreAction(act);
                return(msg);
            }
        }
예제 #15
0
        public override Messages Action(object act)
        {
            Messages msg = new Messages();

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


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

            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 db = new DataCollectFacade(domainProvider);

            object[] objSimulation = db.GetSimulationFromCarton(strCarton);


            if (checkCompare)
            {
                if (objSimulation == null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$CS_COMPAREAPPENDIX_NOTSUCCESS"));
                    msg.Add(new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_WRAPPER"));
                    this.Status = ActionStatus.PrepareData;
                    return(msg);
                }
                else
                {
                    object objSimulationRcrd = objSimulation[0];
                    //if (((Simulation)objSimulationRcrd).ItemCode.ToString().ToUpper() != act.ToString().ToUpper())
                    if (((Simulation)objSimulationRcrd).RunningCard.ToUpper().IndexOf(act.ToString().ToUpper()) != 0)
                    {
                        msg.Add(new UserControl.Message(MessageType.Error, "$CS_COMPAREAPPENDIX_NOTSUCCESS"));
                        msg.Add(new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_WRAPPER"));
                        this.Status = ActionStatus.PrepareData;
                        return(msg);
                    }
                    else
                    {
                        msg.Add(new UserControl.Message(MessageType.Success, "$CS_COMPAREAPPENDIX_SUCCESS"));
                        msg.Add(new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_COMMODITY"));
                        DBDateTime dbDateTime;
                        dbDateTime = FormatHelper.GetNowDBDateTime(domainProvider);
                        PackageFacade _Packfacade     = new PackageFacade(domainProvider);
                        PACKINGCHK    newPackingCheck = _Packfacade.CreateNewPACKINGCHK();
                        newPackingCheck.Rcard            = ((Simulation)objSimulationRcrd).RunningCard.ToString().ToUpper();
                        newPackingCheck.CheckAccessory   = FormatHelper.TRUE_STRING;
                        newPackingCheck.CheckProductCode = FormatHelper.FALSE_STRING;
                        newPackingCheck.MUSER            = (act as IDCTClient).LoginedUser;
                        newPackingCheck.MDATE            = dbDateTime.DBDate;
                        newPackingCheck.MTIME            = dbDateTime.DBTime;
                        newPackingCheck.EATTRIBUTE1      = " ";
                        object objGet = _Packfacade.GetPACKINGCHK(((Simulation)objSimulationRcrd).RunningCard.ToString().ToUpper());
                        if (objGet != null)
                        {
                            newPackingCheck.CheckProductCode = ((PACKINGCHK)objGet).CheckProductCode.Trim();
                            newPackingCheck.EATTRIBUTE1      = ((PACKINGCHK)objGet).EATTRIBUTE1;
                            _Packfacade.DeletePACKINGCHK((PACKINGCHK)objGet);
                            _Packfacade.AddPACKINGCHK(newPackingCheck);
                        }
                        else
                        {
                            _Packfacade.AddPACKINGCHK(newPackingCheck);
                        }
                        this.Status  = ActionStatus.PrepareData;
                        checkCompare = false;
                        return(msg);
                    }
                }
            }
            else
            {
                if (objSimulation == null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$CS_COMPARECOMMODITY_ISWRONG"));
                    msg.Add(new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_COMMODITY"));
                    this.Status = ActionStatus.PrepareData;
                    return(msg);
                }
                else
                {
                    object     objSimulationRcrd = objSimulation[0];
                    ItemFacade itemfacade        = new ItemFacade(domainProvider);
                    object     objitem           = itemfacade.GetItem(((Simulation)objSimulation[0]).ItemCode.Trim().ToUpper(), GlobalVariables.CurrentOrganizations.First().OrganizationID);
                    if (objitem == null)
                    {
                        msg.Add(new UserControl.Message(MessageType.Error, "$CS_COMPARECOMMODITY_ISWRONG"));
                        msg.Add(new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_COMMODITY"));
                        this.Status = ActionStatus.PrepareData;
                        return(msg);
                    }
                    else
                    {
                        if (((Item)objitem).ItemProductCode.ToUpper().Trim() == act.ToString().ToUpper())
                        {
                            base.Action(act);
                            msg.Add(new UserControl.Message(MessageType.Success, "$CS_COMPARECOMMODITY_ISSUCCESS"));
                            DBDateTime dbDateTime;
                            dbDateTime = FormatHelper.GetNowDBDateTime(domainProvider);
                            PackageFacade _Packfacade     = new PackageFacade(domainProvider);
                            PACKINGCHK    newPackingCheck = _Packfacade.CreateNewPACKINGCHK();
                            newPackingCheck.Rcard            = ((Simulation)objSimulationRcrd).RunningCard.ToString().ToUpper();
                            newPackingCheck.CheckAccessory   = FormatHelper.TRUE_STRING;
                            newPackingCheck.CheckProductCode = FormatHelper.TRUE_STRING;
                            newPackingCheck.MUSER            = (act as IDCTClient).LoginedUser;
                            newPackingCheck.MDATE            = dbDateTime.DBDate;
                            newPackingCheck.MTIME            = dbDateTime.DBTime;
                            newPackingCheck.EATTRIBUTE1      = " ";
                            object objGet = _Packfacade.GetPACKINGCHK(((Simulation)objSimulationRcrd).RunningCard.ToString().ToUpper());
                            if (objGet != null)
                            {
                                newPackingCheck.EATTRIBUTE1 = ((PACKINGCHK)objGet).EATTRIBUTE1;
                                _Packfacade.DeletePACKINGCHK((PACKINGCHK)objGet);
                                _Packfacade.AddPACKINGCHK(newPackingCheck);
                            }
                            else
                            {
                                _Packfacade.AddPACKINGCHK(newPackingCheck);
                            }
                            this.ObjectState = null;
                            //this.Status = ActionStatus.PrepareData;
                            strCarton    = string.Empty;
                            checkCompare = true;
                            checkCycle   = true;
                            return(msg);
                        }
                        else
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$CS_COMPARECOMMODITY_ISWRONG"));
                            msg.Add(new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_COMMODITY"));
                            this.Status = ActionStatus.PrepareData;
                            return(msg);
                        }
                    }
                }
            }
        }
예제 #16
0
        public override Messages Action(object act)
        {
            Messages msg = new Messages();

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


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

            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 db = new DataCollectFacade(domainProvider);

            object[] objSimulation = db.GetSimulationFromCarton(strCarton);

            if (objSimulation == null)
            {
                msg.Add(new UserControl.Message(MessageType.Error, "$CS_COMPAREAPPENDIX_NOTSUCCESS"));
                ProcessBeforeReturn(this.Status, msg);
                return(msg);
            }
            else
            {
                object objSimulationRcrd = objSimulation[0];
                //if (((Simulation)objSimulationRcrd).ItemCode.ToString().ToUpper() != act.ToString().ToUpper())
                if (((Simulation)objSimulationRcrd).RunningCard.ToUpper().IndexOf(act.ToString().ToUpper()) != 0)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$CS_COMPAREAPPENDIX_NOTSUCCESS"));
                    ProcessBeforeReturn(this.Status, msg);
                    return(msg);
                }
                else
                {
                    msg.Add(new UserControl.Message(MessageType.Success, "$CS_COMPAREAPPENDIX_SUCCESS"));
                    DBDateTime dbDateTime;
                    dbDateTime = FormatHelper.GetNowDBDateTime(domainProvider);
                    PackageFacade _Packfacade     = new PackageFacade(domainProvider);
                    PACKINGCHK    newPackingCheck = _Packfacade.CreateNewPACKINGCHK();
                    newPackingCheck.Rcard            = ((Simulation)objSimulationRcrd).RunningCard.ToString().ToUpper();
                    newPackingCheck.CheckAccessory   = FormatHelper.TRUE_STRING;
                    newPackingCheck.CheckProductCode = FormatHelper.FALSE_STRING;
                    newPackingCheck.MUSER            = (act as IDCTClient).LoginedUser;
                    newPackingCheck.MDATE            = dbDateTime.DBDate;
                    newPackingCheck.MTIME            = dbDateTime.DBTime;
                    newPackingCheck.EATTRIBUTE1      = " ";
                    object objGet = _Packfacade.GetPACKINGCHK(((Simulation)objSimulationRcrd).RunningCard.ToString().ToUpper());
                    if (objGet != null)
                    {
                        newPackingCheck.CheckProductCode = ((PACKINGCHK)objGet).CheckProductCode.Trim();
                        newPackingCheck.EATTRIBUTE1      = ((PACKINGCHK)objGet).EATTRIBUTE1;
                        _Packfacade.DeletePACKINGCHK((PACKINGCHK)objGet);
                        _Packfacade.AddPACKINGCHK(newPackingCheck);
                    }
                    else
                    {
                        _Packfacade.AddPACKINGCHK(newPackingCheck);
                    }
                    base.Action(act);
                    this.ObjectState = null;
                    strCarton        = string.Empty;
                    return(msg);
                }
            }
        }
예제 #17
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);
        }
예제 #18
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);
        }
예제 #19
0
        public override Messages Action(object act)
        {
            Messages msg = new Messages();

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


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

            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 db = new DataCollectFacade(domainProvider);

            object[] objSimulation = db.GetSimulationFromCarton(strCarton);

            if (objSimulation == null)
            {
                msg.Add(new UserControl.Message(MessageType.Error, "$CS_Product_CompareItemFailed"));
                msg.Add(new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_CARTONNO"));

                base.Action(act);
                this.Status = ActionStatus.PrepareData;
                strCarton   = string.Empty;


                return(msg);
            }
            else
            {
                object objSimulationRcrd = objSimulation[0];
                if (((Simulation)objSimulationRcrd).RunningCard.ToString().ToUpper() != act.ToString().ToUpper())
                {
                    msg.Add(new UserControl.Message(MessageType.Succes, "$CS_Product_CompareItemFailed"));
                    msg.Add(new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_CARTONNO"));

                    base.Action(act);
                    this.Status = ActionStatus.PrepareData;
                    strCarton   = string.Empty;

                    return(msg);
                }
                else
                {
                    msg.Add(new UserControl.Message(MessageType.Succes, "$CS_Add_Success"));
                    msg.Add(new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_CARTONNO"));
                }
            }

            base.Action(act);
            this.Status = ActionStatus.PrepareData;
            strCarton   = string.Empty;

            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 ((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 (m_FlowControl == 1)
            {
                string itemCode = ((Item)_item).ItemCode.ToString();
                strCarton = act.ToString().Trim().ToUpper();

                if (((Item)_item).NeedCheckCarton == FormatHelper.TRUE_STRING)
                {
                    if (strRcard.StartsWith(itemCode, StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (string.Compare(strRcard, strCarton, true) == 0)
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$Error_CartonNotMatchTheRule"));
                            msg.Add(new UserControl.Message(MessageType.Success, "$CS_PLEASE_INPUT_CARTONNO"));

                            this.Status = ActionStatus.PrepareData;
                            return(msg);
                        }
                        else
                        {
                            if (string.Compare(strRcard.Replace(" ", ""), strCarton.Replace(" ", ""), true) != 0)
                            {
                                msg.Add(new UserControl.Message(MessageType.Error, "$Error_CartonCheckFailed"));
                                msg.Add(new UserControl.Message(MessageType.Success, "$CS_PLEASE_INPUT_CARTONNO"));
                                this.Status = ActionStatus.PrepareData;
                                return(msg);
                            }
                            else
                            {
                                msg.Add(new UserControl.Message(MessageType.Success, "$CARTON_COMPARE_ISSUCCESS"));
                            }
                        }
                    }
                    else
                    {
                        if (string.Compare(strRcard, strCarton, true) == 0)
                        {
                            msg.Add(new UserControl.Message(MessageType.Success, "$CARTON_COMPARE_ISSUCCESS"));
                        }
                        else
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$Error_CartonCheckFailed"));
                            msg.Add(new UserControl.Message(MessageType.Success, "$CS_PLEASE_INPUT_CARTONNO"));
                            this.Status = ActionStatus.PrepareData;
                            return(msg);
                        }
                    }
                }

                object obj = (new Package.PackageFacade(domainProvider)).GetCARTONINFO(act.ToString().Trim().ToUpper());
                if (obj != null && ((CARTONINFO)obj).CAPACITY.ToString() == ((CARTONINFO)obj).COLLECTED.ToString())
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$CARTON_ALREADY_FILL_OUT"));
                    msg.Add(new UserControl.Message(MessageType.Success, "$CS_PLEASE_INPUT_CARTONNO"));
                    this.Status = ActionStatus.PrepareData;
                    return(msg);
                }
                else
                {
                    m_FlowControl++;
                    msg.Add(new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_WRAPPER"));
                    this.Status = ActionStatus.PrepareData;
                    return(msg);
                }
            }
            else
            {
                //if (((Simulation)_objSimulation).ItemCode.ToUpper().Trim() == act.ToString().ToUpper())
                if (((Simulation)_objSimulation).RunningCard.ToUpper().IndexOf(act.ToString().ToUpper()) == 0)
                {
                    ActionOnLineHelper actionOnLineHelper = new ActionOnLineHelper(domainProvider);
                    BenQGuru.eMES.DataCollect.Action.ActionFactory actionFactory = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider);
                    IAction actionCartonPack = actionFactory.CreateAction(ActionType.DataCollectAction_Carton);
                    //((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.OpenConnection();
                    msg = actionOnLineHelper.GetIDInfo(strRcard);
                    string     cartonno = FormatHelper.CleanString(strCarton);
                    IDCTClient client   = act as IDCTClient;

                    //add by hiro 08/09/28
                    DBDateTime dbDateTime;
                    dbDateTime = FormatHelper.GetNowDBDateTime(domainProvider);
                    PackageFacade _Packfacade     = new PackageFacade(domainProvider);
                    PACKINGCHK    newPackingCheck = _Packfacade.CreateNewPACKINGCHK();
                    newPackingCheck.Rcard            = ((Simulation)_objSimulation).RunningCard.ToString().ToUpper();
                    newPackingCheck.CheckAccessory   = FormatHelper.TRUE_STRING;
                    newPackingCheck.CheckProductCode = FormatHelper.FALSE_STRING;
                    newPackingCheck.MUSER            = (act as IDCTClient).LoginedUser;
                    newPackingCheck.MDATE            = dbDateTime.DBDate;
                    newPackingCheck.MTIME            = dbDateTime.DBTime;
                    newPackingCheck.EATTRIBUTE1      = " ";
                    object objGet = _Packfacade.GetPACKINGCHK(((Simulation)_objSimulation).RunningCard.ToString().ToUpper());
                    if (objGet != null)
                    {
                        _Packfacade.DeletePACKINGCHK((PACKINGCHK)objGet);
                        _Packfacade.AddPACKINGCHK(newPackingCheck);
                    }
                    else
                    {
                        _Packfacade.AddPACKINGCHK(newPackingCheck);
                    }
                    //end by hiro

                    Messages msgTwo = new Messages();
                    domainProvider.BeginTransaction();
                    try
                    {
                        if (msg.IsSuccess())
                        {
                            ProductInfo product = (ProductInfo)msg.GetData().Values[0];
                            if (product.LastSimulation == null)
                            {
                                base.Action(act);
                                msgTwo.Add(new UserControl.Message(new Exception("$Error_LastSimulation_IsNull!")));
                                this.ObjectState = null;
                                return(msgTwo);
                            }

                            CartonPackEventArgs cartonPackEventArgs = new CartonPackEventArgs(ActionType.DataCollectAction_Carton,
                                                                                              strRcard, client.LoginedUser,
                                                                                              client.ResourceCode,
                                                                                              "",
                                                                                              cartonno,
                                                                                              product);

                            msgTwo.AddMessages(actionCartonPack.Execute(cartonPackEventArgs));
                        }
                        if (msgTwo.IsSuccess())
                        {
                            domainProvider.CommitTransaction();
                        }
                        else
                        {
                            domainProvider.RollbackTransaction();
                            msgTwo.Add(new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard"));
                            this.Status      = ActionStatus.PrepareData;
                            this.FlowDirect  = FlowDirect.WaitingInput;
                            this.ObjectState = null;
                            this.clearValue();
                            return(msgTwo);
                        }
                    }
                    catch (Exception ex)
                    {
                        domainProvider.RollbackTransaction();
                        msg.Add(new UserControl.Message(ex));
                        msg.Add(new UserControl.Message(MessageType.Normal, "$CS_Please_Input_RunningCard"));
                        this.Status      = ActionStatus.PrepareData;
                        this.FlowDirect  = FlowDirect.WaitingInput;
                        this.ObjectState = null;
                        this.clearValue();
                        return(msg);
                    }
                    finally
                    {
                        ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection();
                    }

                    base.Action(act);
                    msg.Add(new UserControl.Message(MessageType.Success, "$CS_COMPAREAPPENDIX_SUCCESS"));
                    msg.Add(new UserControl.Message(MessageType.Success, "$CS_RCARD_CARTON_SUCCESS [" + strCarton + "]"));
                    this.ObjectState = null;
                    this.clearValue();
                    return(msg);
                }
                else
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$CS_COMPAREAPPENDIX_NOTSUCCESS"));
                    msg.Add(new UserControl.Message(MessageType.Normal, "$CS_PLEASE_INPUT_WRAPPER"));
                    this.Status = ActionStatus.PrepareData;
                    return(msg);
                }
            }
        }
예제 #21
0
        public Messages CheckProduct(string rcard, object act)
        {
            currentProductInfo = null;
            moWillGo           = null;
            Messages msg = new Messages();

            BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null;
            if ((act as IDCTClient).DBConnection != null)
            {
                domainProvider = (act as IDCTClient).DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
            }
            else
            {
                domainProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()
                                 as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
                (act as IDCTClient).DBConnection = domainProvider;
            }
            ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);

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

                if (product.LastSimulation != null)                             // 只有在序列号存在的情况下才检查途程
                {
                    msg = _helper.CheckID(new TSActionEventArgs(ActionType.DataCollectAction_NG,
                                                                rcard,
                                                                client.LoginedUser,
                                                                client.ResourceCode,
                                                                product,
                                                                new object[] {},
                                                                null,
                                                                ""));
                }
                if (product.LastSimulation == null || msg.IsSuccess() == true)
                {
                    currentProductInfo = product;
                }
                else if (product.LastSimulation.LastAction == ActionType.DataCollectAction_GOOD ||
                         product.LastSimulation.LastAction == ActionType.DataCollectAction_NG ||
                         product.LastSimulation.LastAction == ActionType.DataCollectAction_OutLineGood ||
                         product.LastSimulation.LastAction == ActionType.DataCollectAction_OutLineNG)                           // 允许测试站重复采集
                {
                    BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider);
                    if (dataModel.GetOperation2Resource(product.LastSimulation.OPCode, (act as IDCTClient).ResourceCode) != null)
                    {
                        msg.ClearMessages();
                        currentProductInfo = product;
                    }
                }
            }
            return(msg);
        }
예제 #22
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);
        }
예제 #23
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);
        }
예제 #24
0
        // Added by Icyer 2006/12/15
        // 检查产品
        private Messages CheckProduct(object act, string runningCard)
        {
            // 查询产品信息
            BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null;
            if ((act as IDCTClient).DBConnection != null)
            {
                domainProvider = (act as IDCTClient).DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
            }
            else
            {
                domainProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()
                                 as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
                (act as IDCTClient).DBConnection = domainProvider;
            }

            ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);

            /*	Removed by Icyer 2007/03/16
             * UserControl.Messages msgProduct =  _helper.GetIDInfo( runningCard ) ;
             * ProductInfo product= (ProductInfo)msgProduct.GetData().Values[0];
             * if (product == null || product.LastSimulation == null)
             * {
             *      msgProduct.ClearMessages();
             *      msgProduct.Add(new UserControl.Message(MessageType.Error, "$NoSimulation"));
             *      return msgProduct;
             * }
             */

            // Added by Icyer 2007/03/16	如果归属工单,则做归属工单检查,否则做序列号途程检查
            UserControl.Messages msgProduct = _helper.GetIDInfo(runningCard);
            ProductInfo          product    = (ProductInfo)msgProduct.GetData().Values[0];
            MO           moWillGo           = null;
            ActionGoToMO actionGoMO         = new ActionGoToMO(domainProvider);
            Messages     msgMo = actionGoMO.GetItemCodeFromGoMoRCard(((IDCTClient)act).ResourceCode, runningCard);

            if (msgMo.IsSuccess() == false)                     // 如果有错误,表示需要归属工单,但是解析工单或查询工单发生错误
            {
                return(msgMo);
            }
            if (msgMo.GetData() != null)                // 需要归属工单,做归属工单检查
            {
                product.NowSimulation = new BenQGuru.eMES.Domain.DataCollect.Simulation();
                UserControl.Message msgMoData = msgMo.GetData();
                moWillGo = (MO)msgMoData.Values[0];
                ActionGoToMO          goToMO            = new ActionGoToMO(domainProvider);
                GoToMOActionEventArgs MOActionEventArgs = new GoToMOActionEventArgs(
                    ActionType.DataCollectAction_GoMO,
                    runningCard,
                    ((IDCTClient)act).LoginedUser,
                    ((IDCTClient)act).ResourceCode,
                    product,
                    moWillGo.MOCode);
                msgMo = goToMO.CheckIn(MOActionEventArgs);
                if (!MOActionEventArgs.PassCheck)
                {
                    msgMo = _helper.CheckID(new CKeypartsActionEventArgs(
                                                ActionType.DataCollectAction_CollectKeyParts,
                                                runningCard,
                                                ((IDCTClient)act).LoginedUser,
                                                ((IDCTClient)act).ResourceCode,
                                                product, null, null));
                }
            }
            else                // 不需要归属工单,检查序列号途程
            {
                if (product == null || product.LastSimulation == null)
                {
                    msgProduct.ClearMessages();
                    msgProduct.Add(new UserControl.Message(MessageType.Error, "$NoSimulation"));
                    return(msgProduct);
                }
                msgMo = _helper.CheckID(new CKeypartsActionEventArgs(
                                            ActionType.DataCollectAction_CollectKeyParts,
                                            runningCard,
                                            ((IDCTClient)act).LoginedUser,
                                            ((IDCTClient)act).ResourceCode,
                                            product, null, null));
            }
            if (msgMo.IsSuccess() == false)
            {
                return(msgMo);
            }
            // Added end

            keypartsHT = new Hashtable();
            keypartsHT.Add("ProdcutInfo", msgProduct);
            keypartsHT.Add("MOWillGo", moWillGo);

            IDCTClient  client      = act as IDCTClient;
            OPBOMFacade opBOMFacade = new OPBOMFacade(domainProvider);

            object[] objBomDetail = null;
            Messages messages1    = new Messages();

            if (moWillGo == null)
            {
                // 检查途程
                messages1 = _helper.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
            {
                return(messages1);
            }

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

            if (moWillGo == null)
            {
                mo = moFacade.GetMO(product.LastSimulation.MOCode);
            }

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

            if (opBomKeyparts.Count == 0)
            {
                msgProduct.Add(new Message(MessageType.Error, "$CS_NOOPBomInfo $CS_Param_MOCode=" + product.NowSimulation.MOCode
                                           + " $CS_Param_RouteCode=" + product.NowSimulation.RouteCode
                                           + " $CS_Param_OPCode =" + product.NowSimulation.OPCode));
                return(msgProduct);
            }
            else
            {
                this.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_Keyparts " + (opBomKeyparts.GetbomKeypartCount() + 1).ToString() + "/" + opBomKeyparts.Count.ToString());
                keypartsHT.Add("KeypartsInfo", opBomKeyparts);
            }
            return(msgProduct);
        }
예제 #25
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);
        }
예제 #26
0
        public override Messages Action(object act)
        {
            Messages msg = new Messages();

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


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

            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 db = new DataCollectFacade(domainProvider);

            object[] objSimulation = db.GetSimulationFromCarton(_CartonCode);

            if (objSimulation == null)
            {
                msg.Add(new UserControl.Message(MessageType.Error, "$CS_COMPARECOMMODITY_ISWRONG "));
                ProcessBeforeReturn(this.Status, msg);
                return(msg);
            }
            else
            {
                object objSimulationRcrd = objSimulation[0];

                ItemFacade itemfacade = new ItemFacade(domainProvider);
                object     objitem    = itemfacade.GetItem(((Simulation)objSimulation[0]).ItemCode.Trim().ToUpper(), GlobalVariables.CurrentOrganizations.First().OrganizationID);
                if (objitem == null)
                {
                    msg.Add(new UserControl.Message(MessageType.Error, "$CS_COMPARECOMMODITY_ISWRONG "));
                    ProcessBeforeReturn(this.Status, msg);
                    return(msg);
                }
                else
                {
                    if (((Item)objitem).ItemProductCode.ToUpper().Trim() == act.ToString().ToUpper())
                    {
                        //add by hiro 08/10/06
                        DBDateTime dbDateTime;
                        dbDateTime = FormatHelper.GetNowDBDateTime(domainProvider);
                        PackageFacade _Packfacade     = new PackageFacade(domainProvider);
                        PACKINGCHK    newPackingCheck = _Packfacade.CreateNewPACKINGCHK();
                        newPackingCheck.Rcard            = ((Simulation)objSimulationRcrd).RunningCard.ToString().ToUpper();
                        newPackingCheck.CheckAccessory   = FormatHelper.FALSE_STRING;
                        newPackingCheck.CheckProductCode = FormatHelper.TRUE_STRING;
                        newPackingCheck.MUSER            = (act as IDCTClient).LoginedUser;
                        newPackingCheck.MDATE            = dbDateTime.DBDate;
                        newPackingCheck.MTIME            = dbDateTime.DBTime;
                        newPackingCheck.EATTRIBUTE1      = " ";
                        object objGet = _Packfacade.GetPACKINGCHK(((Simulation)objSimulationRcrd).RunningCard.ToString().ToUpper());
                        if (objGet != null)
                        {
                            newPackingCheck.CheckAccessory = ((PACKINGCHK)objGet).CheckAccessory.Trim();
                            newPackingCheck.EATTRIBUTE1    = ((PACKINGCHK)objGet).EATTRIBUTE1;
                            _Packfacade.DeletePACKINGCHK((PACKINGCHK)objGet);
                            _Packfacade.AddPACKINGCHK(newPackingCheck);
                        }
                        else
                        {
                            _Packfacade.AddPACKINGCHK(newPackingCheck);
                        }
                        //end by hiro
                        base.Action(act);
                        msg.Add(new UserControl.Message(MessageType.Success, "$CS_COMPARECOMMODITY_ISSUCCESS "));
                        _CartonCode = string.Empty;
                        return(msg);
                    }
                    else
                    {
                        msg.Add(new UserControl.Message(MessageType.Error, "$CS_COMPARECOMMODITY_ISWRONG "));
                        ProcessBeforeReturn(this.Status, msg);
                        return(msg);
                    }
                }
            }
        }
예제 #27
0
        public override Messages Action(object act)
        {
            Messages msg = new Messages();

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

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


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

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

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

            msg = CheckData(data);

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

                args.Passwod = data;

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

                args.UserGroup = objUserGroup;
                ObjectState    = args;

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

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

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

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

                ActionResource acRes = new ActionResource();

                //acRes.LastAction = this;

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

                ActionUser acUser = new ActionUser();

                //acRes.LastAction = this;

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



            return(msg);
        }
예제 #28
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);
        }