Пример #1
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);
        }
Пример #2
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;
            }

            try
            {
                //为改善性能
                ((SQLDomainDataProvider)domainProvider).PersistBroker.AutoCloseConnection = false;
                ((SQLDomainDataProvider)domainProvider).PersistBroker.OpenConnection();

                ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);

                // 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];
                    moCode   = moWillGo.MOCode;
                    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_CollectINNO,
                                                    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_CollectINNO,
                                                runningCard,
                                                ((IDCTClient)act).LoginedUser,
                                                ((IDCTClient)act).ResourceCode,
                                                product, null, null));
                }
                if (msgMo.IsSuccess() == false)
                {
                    return(msgMo);
                }
                // Added end

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

                IDCTClient  client       = act as IDCTClient;
                OPBOMFacade opBOMFacade  = new OPBOMFacade(domainProvider);
                MOFacade    moFacade     = new MOFacade(domainProvider);
                object[]    objBomDetail = null;
                Messages    messages1    = new Messages();
                if (moWillGo == null)
                {
                    // 检查途程
                    messages1 = _helper.CheckID(
                        new CKeypartsActionEventArgs(
                            ActionType.DataCollectAction_CollectINNO,
                            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);

                    //Miodified by Scott
                    MO moNew = (MO)moFacade.GetMO(product.NowSimulation.MOCode);

                    objBomDetail = opBOMFacade.QueryOPBOMDetail(product.NowSimulation.ItemCode, string.Empty, string.Empty, moNew.BOMVersion,
                                                                product.NowSimulation.RouteCode, product.NowSimulation.OPCode, (int)MaterialType.CollectMaterial,
                                                                int.MinValue, int.MaxValue, moNew.OrganizationID, true);

                    if (objBomDetail == null)
                    {
                        messages1.Add(new UserControl.Message(MessageType.Error, "$CS_OPBOM_NotFound"));
                    }
                }
                else
                {
                    return(messages1);
                }

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

                //OPBomKeyparts opBomKeyparts = new OPBomKeyparts(objBomDetail, Convert.ToInt32(((MO)mo).IDMergeRule), domainProvider);
                // 查询OPBOM
                if (objBomDetail == null)
                {
                    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.filterOpBomDetail(ref objBomDetail);

                    if (objBomDetail == null || objBomDetail.Length <= 0)
                    {
                        msgProduct.Add(new Message(MessageType.Error, "$CS_OPBOM_NotFound"));
                        return(msgProduct);
                    }

                    for (int i = 0; i < objBomDetail.Length; i++)
                    {
                        if (((OPBOMDetail)objBomDetail[i]).OPBOMItemControlType == "item_control_lot")
                        {
                            opBomDetailCount += 1;
                        }
                        else
                        {
                            opBomDetailCount += Convert.ToInt32(((OPBOMDetail)objBomDetail[i]).OPBOMItemQty);
                        }
                    }
                    for (int i = 0; i < objBomDetail.Length; i++)
                    {
                        if (((OPBOMDetail)objBomDetail[i]).OPBOMItemControlType == "item_control_lot")
                        {
                            opBomDetailList.Add(objBomDetail[i]);
                        }
                        else
                        {
                            int number = Convert.ToInt32(((OPBOMDetail)objBomDetail[i]).OPBOMItemQty);
                            for (int j = 0; j < number; j++)
                            {
                                opBomDetailList.Add(objBomDetail[i]);
                            }
                        }
                    }

                    if (((OPBOMDetail)objBomDetail[0]).OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_LOT)
                    {
                        msgProduct.Add(new UserControl.Message(MessageType.Normal, ">>$DCT_PLEASE_INPUT_Lot " + ((OPBOMDetail)objBomDetail[0]).OPBOMSourceItemCode));
                    }
                    else
                    {
                        msgProduct.Add(new UserControl.Message(MessageType.Normal, ">>$DCT_PLEASE_INPUT_Keyparts " + ((OPBOMDetail)objBomDetail[0]).OPBOMSourceItemCode));
                    }
                    // keypartsHT.Add("KeypartsInfo", opBomKeyparts);
                    keypartsHT.Add("Opbomdetail", objBomDetail);
                }
                return(msgProduct);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                ((SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection();
                ((SQLDomainDataProvider)domainProvider).PersistBroker.AutoCloseConnection = true;
            }
        }
Пример #3
0
        //bighai.wang 2009/03/03 发料物料标签打印

        public UserControl.Messages PrintMaterialLot(string printer, List <string> materialLot)
        {
            UserControl.Messages messages = new UserControl.Messages();
            string varName      = string.Empty;
            string templatePath = string.Empty;
            string fileName     = string.Empty;

            try
            {
                try
                {
                    SystemSettingFacade parameter = new SystemSettingFacade();
                    fileName = parameter.GetGetParameterFileName("TemplateFileName", "MATERIALTYPE");
                    //templatePath = System.Environment.CurrentDirectory+"\\" + fileName;
                    varName = parameter.GetGetParameterFileName("VarName", "MATERIALTYPE");

                    this.PrePrint();
                    _CodeSoftFacade.OpenTemplateMaterialLot(printer, fileName, varName);
                }
                catch (System.Exception ex)
                {
                    messages.Add(new UserControl.Message(UserControl.MessageType.Error, ex.Message));
                    return(messages);
                }

                //批量打印前生成文本文件
                string strBatchDataFile = string.Empty;
                if (_IsBatchPrint)
                {
                    strBatchDataFile = CreateFile();
                }

                for (int i = 0; i < materialLot.Count; i++)
                {
                    LabelPrintVars labelPrintVars = new LabelPrintVars();

                    string[] vars = new string[0];

                    if (messages.IsSuccess())
                    {
                        try
                        {
                            //要传给Codesoft的数组,字段顺序不能修改
                            vars = this.GetPrintVarsMaterialLot(materialLot[i]);

                            //批量打印前的写文件
                            if (_IsBatchPrint)
                            {
                                string[] printVars = ProcessVars(vars, labelPrintVars);
                                WriteFile(strBatchDataFile, printVars);
                            }
                            //直接打印
                            //else
                            //{
                            _CodeSoftFacade.LabelPrintVars = labelPrintVars;
                            _CodeSoftFacade.Print(vars, varName, fileName);
                            //}
                        }
                        catch (System.Exception ex)
                        {
                            messages.Add(new UserControl.Message(UserControl.MessageType.Error, ex.Message));
                            return(messages);
                        }
                    }
                }

                //messages.Add(new UserControl.Message(UserControl.MessageType.Success, "$Success_Print_Label"));
            }
            finally
            {
            }

            return(messages);
        }
Пример #4
0
        public UserControl.Messages Print(string printer, string templatePath, MKeyPart mKeyPart, List <MKeyPartDetail> mKeyPartDetailList, List <string> reserveInfo)
        {
            UserControl.Messages messages = new UserControl.Messages();

            try
            {
                try
                {
                    this.PrePrint();
                    _CodeSoftFacade.OpenTemplate(printer, templatePath);
                }
                catch (System.Exception ex)
                {
                    messages.Add(new UserControl.Message(UserControl.MessageType.Error, ex.Message));
                    return(messages);
                }

                //批量打印前生成文本文件
                string strBatchDataFile = string.Empty;
                if (_IsBatchPrint)
                {
                    strBatchDataFile = CreateFile();
                }

                for (int i = 0; i < mKeyPartDetailList.Count; i++)
                {
                    LabelPrintVars labelPrintVars = new LabelPrintVars();

                    string[] vars = new string[0];

                    if (messages.IsSuccess())
                    {
                        try
                        {
                            //要传给Codesoft的数组,字段顺序不能修改
                            vars = this.GetPrintVars(mKeyPart, mKeyPartDetailList[i], reserveInfo);

                            //批量打印前的写文件
                            if (_IsBatchPrint)
                            {
                                string[] printVars = ProcessVars(vars, labelPrintVars);
                                WriteFile(strBatchDataFile, printVars);
                            }
                            //直接打印
                            else
                            {
                                _CodeSoftFacade.LabelPrintVars = labelPrintVars;
                                _CodeSoftFacade.Print(vars);
                            }
                        }
                        catch (System.Exception ex)
                        {
                            messages.Add(new UserControl.Message(UserControl.MessageType.Error, ex.Message));
                            return(messages);
                        }
                    }
                }

                //批量打印
                if (_IsBatchPrint)
                {
                    try
                    {
                        _CodeSoftFacade.Print(strBatchDataFile, GetDataDescPath(_DataDescFileName));
                    }
                    catch (System.Exception ex)
                    {
                        messages.Add(new UserControl.Message(UserControl.MessageType.Error, ex.Message));
                        return(messages);
                    }
                }

                messages.Add(new UserControl.Message(UserControl.MessageType.Success, "$Success_Print_Label"));
            }
            finally
            {
            }

            return(messages);
        }
Пример #5
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);
        }
Пример #6
0
        public UserControl.Messages GoodCollect(object[] parserObjs)
        {
            UserControl.Messages returnMsg = new UserControl.Messages();
            try
            {
                foreach (object obj in parserObjs)
                {
                    PIDAOIData aoiData = obj as PIDAOIData;

                    if (aoiData.RESULT == "PASS")
                    {
                        ActionOnLineHelper onLine   = new ActionOnLineHelper(this._domainDataProvider);
                        Messages           messages = onLine.GetIDInfo(aoiData.RCARD.Trim().ToUpper());
                        try
                        {
                            ProductInfo product = (ProductInfo)messages.GetData().Values[0];
                            this._domainDataProvider.BeginTransaction();
//							//归属工单采集
//							IAction dataCollectMO = new ActionFactory(this._domainDataProvider).CreateAction(ActionType.DataCollectAction_GoMO);
//							messages.AddMessages(((IActionWithStatus)dataCollectMO).Execute(
//								new GoToMOActionEventArgs(ActionType.DataCollectAction_GoMO,
//								aoiData.RCARD.Trim().ToUpper(),
//								aoiData.USER.Trim().ToUpper(),
//								AgentHelp.getResCode(aoiData.RESOURCE.Trim().ToUpper()),
//								product,this.getMOCode(aoiData.RCARD.Trim().ToUpper()))));
//
                            string goodResult = string.Empty;
//							if(messages.IsSuccess())
//							{
//								returnMsg.Add( new UserControl.Message(UserControl.MessageType.Succes,string.Format("{0} $CS_GOMO_CollectSuccess",aoiData.RCARD.ToUpper())) );
//							}
//							else
//							{
//								returnMsg.Add( new UserControl.Message(UserControl.MessageType.Error,AgentHelp.GetErrorMessage(messages)));
//							}
//							messages.ClearMessages();

                            //GOOD采集
                            messages = onLine.GetIDInfo(aoiData.RCARD.Trim().ToUpper());
                            product  = (ProductInfo)messages.GetData().Values[0];
                            BenQGuru.eMES.DataCollect.DataCollectFacade dcFacade = new BenQGuru.eMES.DataCollect.DataCollectFacade(this._domainDataProvider);
                            goodResult = dcFacade.ActionCollectGood(aoiData.RCARD.ToUpper(), aoiData.USER.ToUpper(), AgentHelp.getResCode(aoiData.RESOURCE.ToUpper()));
                            if (goodResult == "OK")
                            {
                                this._domainDataProvider.CommitTransaction();

                                returnMsg.Add(new UserControl.Message(UserControl.MessageType.Success, string.Format("{0} $CS_GOOD_CollectSuccess", aoiData.RCARD.ToUpper())));
                                returnMsg.Add(new UserControl.Message(" "));
                                BenQGuru.eMES.Common.Log.Info(string.Format("{0} $CS_GOOD_CollectSuccess: {1}", aoiData.RCARD.Trim().ToUpper(), "OK"));
                                messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOODSUCCESS,$CS_Param_ID:{0}", aoiData.RCARD.ToUpper())));
                            }
                            else
                            {
                                this._domainDataProvider.RollbackTransaction();

                                string errorMsg = string.Format("{0} $CS_GOOD_CollectFail : {1}", aoiData.RCARD.Trim().ToUpper(), goodResult);
                                returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, errorMsg));
                                returnMsg.Add(new UserControl.Message(" "));
                                BenQGuru.eMES.Common.Log.Info(errorMsg);
                            }
                        }
                        catch (Exception ex)
                        {
                            this._domainDataProvider.RollbackTransaction();
                            BenQGuru.eMES.Common.Log.Info(AgentHelp.GetErrorMessage(messages), ex);
                        }
                        finally
                        {
                            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.CloseConnection();
                        }
                    }
                }
            }
            catch
            {}
            return(returnMsg);
        }
Пример #7
0
 public void AddEx(string function, string inputContent, UserControl.Message message, bool recordWorkingError)
 {
     UserControl.Messages messages = new UserControl.Messages();
     messages.Add(message);
     AddEx(function, inputContent, messages, recordWorkingError);
 }
Пример #8
0
 public void Add(UserControl.Message message)
 {
     UserControl.Messages messages = new UserControl.Messages();
     messages.Add(message);
     this.Add(messages);
 }
Пример #9
0
        private void txtRCard_TxtboxKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                UserControl.Messages msg = new UserControl.Messages();

                string rcard = Web.Helper.FormatHelper.CleanString(txtRCard.Value.Trim().ToUpper());
                //检查产品序列号格式
                msg.AddMessages(MatchMo(rcard, CurrentSequence - 1));
                if (!msg.IsSuccess())
                {
                    ucMessage.Add(msg);
                    this.txtMoCode.TextFocus(false, true);
                    return;
                }
                else
                {
                    #region 业务处理
                    //如果为最后一次,则提交更新
                    if (CurrentSequence == dsMo.MultiMo.Rows.Count)
                    {
                        //更新RunningCard
                        UpdateListRCard(CurrentSequence - 1);

                        ActionOnLineHelper _helper = new ActionOnLineHelper(this.DataProvider);

                        DataProvider.BeginTransaction();
                        try
                        {
                            #region 循环完成归属工单
                            foreach (DataRow dr in dsMo.MultiMo)
                            {
                                string runningCard = Convert.ToString(dr["产品序列号"]);
                                string moCode      = Convert.ToString(dr["工单"]);

                                msg.AddMessages(_helper.GetIDInfo(runningCard));

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

                                    GoToMOActionEventArgs args = new GoToMOActionEventArgs(
                                        ActionType.DataCollectAction_GoMO,
                                        runningCard,
                                        ApplicationService.Current().UserCode,
                                        ApplicationService.Current().ResourceCode,
                                        product,
                                        moCode);

                                    IAction action = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_GoMO);

                                    msg.AddMessages(action.Execute(args));
                                }


                                if (msg.IsSuccess())
                                {
                                    this.DataProvider.CommitTransaction();

                                    UpdateCollectQty();

                                    msg.Add(new UserControl.Message(MessageType.Success, "$CS_GOMO_CollectSuccess $CS_GONEXT_BILL"));
                                }
                                else
                                {
                                    ClearListRCard();
                                    this.DataProvider.RollbackTransaction();
                                    break;
                                }
                            }
                            #endregion
                        }
                        catch (Exception E)
                        {
                            ClearListRCard();
                            this.DataProvider.RollbackTransaction();

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

                            ucMessage.Add(msg);

                            if (MoCodes != null && MoCodes.Length > 0)
                            {
                                UpdateList(MoCodes);
                            }
                            //CurrentSequence = 1;
                            //dsMo.MultiMo.AcceptChanges();
                        }
                    }
                    else
                    {
                        //更新RunningCard
                        UpdateListRCard(CurrentSequence - 1);

                        CurrentSequence++;
                    }
                    #endregion
                }
                //提示用户继续输入产品序列号

                ucMessage.Add(">>$CS_Please_Input_RunningCard " + CurrentSequence.ToString() + "/" + dsMo.MultiMo.Rows.Count.ToString());
                txtRCard.Value = "";
                txtRCard.TextFocus(false, true);
            }
        }
Пример #10
0
        public UserControl.Messages GoodCollect(object[] parserObjs)
        {
            UserControl.Messages returnMsg = new UserControl.Messages();
            try
            {
                foreach (object obj in parserObjs)
                {
                    ICTData ictData = obj as ICTData;

                    if (ictData.RESULT.Trim().ToUpper() == "PASS")
                    {
                        ActionOnLineHelper onLine = new ActionOnLineHelper(this._domainDataProvider);

                        ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.AutoCloseConnection = false;
                        ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.OpenConnection();
                        Messages messages = onLine.GetIDInfo(ictData.RCARD.Trim().ToUpper());
                        try
                        {
                            ProductInfo product = (ProductInfo)messages.GetData().Values[0];
                            this._domainDataProvider.BeginTransaction();

                            if (AgentInfo.AllowGoToMO == true)
                            {
                                string moCode = this.getMOCode(ictData.RCARD.Trim().ToUpper());

                                if (System.Configuration.ConfigurationSettings.AppSettings["MOPREFIXSTRING"] != null)
                                {
                                    string moPrefix = System.Configuration.ConfigurationSettings.AppSettings["MOPREFIXSTRING"].Trim();
                                    //首字符串检查
                                    if (moCode.Length < moPrefix.Length || moCode.Substring(0, moPrefix.Length) != moPrefix)
                                    {
                                        returnMsg.Add(new UserControl.Message(MessageType.Error
                                                                              , "$CS_Before_Card_FLetter_NotCompare $CS_Param_ID: " + ictData.RCARD.Trim().ToUpper()));
                                    }
                                }
                                if (System.Configuration.ConfigurationSettings.AppSettings["SNLENGTH"] != null)
                                {
                                    try
                                    {
                                        int snLength = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["SNLENGTH"].Trim());
                                        //长度检查
                                        if (ictData.RCARD.Trim().ToUpper().Length != snLength)
                                        {
                                            returnMsg.Add(new UserControl.Message(MessageType.Error,
                                                                                  "$CS_Before_Card_Length_FLetter_NotCompare $CS_Param_ID: " + ictData.RCARD.Trim().ToUpper()));
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        returnMsg.Add(new UserControl.Message(ex));
                                    }
                                }

                                if (returnMsg.IsSuccess())
                                {
                                    IAction dataCollectMO = new ActionFactory(this._domainDataProvider).CreateAction(ActionType.DataCollectAction_GoMO);
                                    messages.AddMessages(((IActionWithStatus)dataCollectMO).Execute(
                                                             new GoToMOActionEventArgs(ActionType.DataCollectAction_GoMO,
                                                                                       ictData.RCARD.Trim().ToUpper(),
                                                                                       ictData.USER.Trim().ToUpper(),
                                                                                       AgentHelp.getResCode(ictData.RESOURCE.Trim().ToUpper()),
                                                                                       product, moCode)));


                                    if (messages.IsSuccess())
                                    {
                                        returnMsg.Add(new UserControl.Message(UserControl.MessageType.Success, string.Format("{0} $CS_GOMO_CollectSuccess", ictData.RCARD.ToUpper())));
                                    }
                                    else
                                    {
                                        returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, AgentHelp.GetErrorMessage(messages)));
                                    }
                                }

                                messages.ClearMessages();
                            }

                            string goodResult = string.Empty;
                            //GOOD采集
                            messages = onLine.GetIDInfo(ictData.RCARD.Trim().ToUpper());
                            product  = (ProductInfo)messages.GetData().Values[0];
                            BenQGuru.eMES.DataCollect.DataCollectFacade dcFacade = new BenQGuru.eMES.DataCollect.DataCollectFacade(this._domainDataProvider);
                            goodResult = dcFacade.ActionCollectGood(ictData.RCARD.ToUpper(), ictData.USER.ToUpper(), AgentHelp.getResCode(ictData.RESOURCE.ToUpper()));
                            if (goodResult == "OK")
                            {
                                this._domainDataProvider.CommitTransaction();

                                returnMsg.Add(new UserControl.Message(UserControl.MessageType.Success, string.Format("{0} $CS_GOOD_CollectSuccess", ictData.RCARD.ToUpper())));
                                returnMsg.Add(new UserControl.Message(" "));
                                BenQGuru.eMES.Common.Log.Info(string.Format("{0} $CS_GOOD_CollectSuccess: {1}", ictData.RCARD.Trim().ToUpper(), "OK"));
                                messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOODSUCCESS,$CS_Param_ID:{0}", ictData.RCARD.ToUpper())));
                            }
                            else
                            {
                                this._domainDataProvider.RollbackTransaction();

                                string errorMsg = string.Format("{0} $CS_GOOD_CollectFail : {1}", ictData.RCARD.Trim().ToUpper(), goodResult);
                                returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, errorMsg));
                                returnMsg.Add(new UserControl.Message(" "));
                                BenQGuru.eMES.Common.Log.Info(errorMsg);
                            }
                        }
                        catch (Exception ex)
                        {
                            this._domainDataProvider.RollbackTransaction();
                            BenQGuru.eMES.Common.Log.Info(AgentHelp.GetErrorMessage(messages), ex);
                        }
                        finally
                        {
//							((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.CloseConnection();
//							((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.AutoCloseConnection = true;
                        }
                    }
                }
            }
            catch
            {}

            return(returnMsg);
        }
Пример #11
0
        public UserControl.Messages GoodCollect(object[] parserObjs)
        {
            UserControl.Messages returnMsg = new UserControl.Messages();
            try
            {
                foreach (object obj in parserObjs)
                {
                    AOIData aoiData    = obj as AOIData;
                    int     errorCount = 0;
                    try
                    {
                        errorCount = int.Parse(aoiData.ERRORCOUNT);
                    }
                    catch
                    {}
                    if (errorCount == 0)
                    {
                        ActionOnLineHelper onLine = new ActionOnLineHelper(this._domainDataProvider);

//						((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.AutoCloseConnection = false;
//						((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.OpenConnection();
                        Messages messages = onLine.GetIDInfo(aoiData.RCARD.Trim().ToUpper());
                        try
                        {
                            ProductInfo product = (ProductInfo)messages.GetData().Values[0];
                            // Added by Icyer 2006/08/03
                            // 只有当Simulation中没有数据时,才认为是第一次经过AOI站,才执行SMT上料
                            bool bExecuteSMTLoadItem = (product.LastSimulation == null);
                            // Added end
                            this._domainDataProvider.BeginTransaction();
                            string goodResult = string.Empty;
                            //归属工单采集
                            //Laws Lu,2006/08/10 归属工单时需要检查是否符合首字符串和长度检查

                            string moCode = this.getMOCode(aoiData.RCARD.Trim().ToUpper());

                            if (System.Configuration.ConfigurationSettings.AppSettings["MOPREFIXSTRING"] != null)
                            {
                                string moPrefix = System.Configuration.ConfigurationSettings.AppSettings["MOPREFIXSTRING"].Trim();
                                //首字符串检查
                                if (moCode.Length < moPrefix.Length || moCode.Substring(0, moPrefix.Length) != moPrefix)
                                {
                                    returnMsg.Add(new UserControl.Message(MessageType.Error
                                                                          , "$CS_Before_Card_FLetter_NotCompare $CS_Param_ID: " + aoiData.RCARD.Trim().ToUpper()));
                                }
                            }
                            if (System.Configuration.ConfigurationSettings.AppSettings["SNLENGTH"] != null)
                            {
                                try
                                {
                                    int snLength = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["SNLENGTH"].Trim());
                                    //长度检查
                                    if (aoiData.RCARD.Trim().ToUpper().Length != snLength)
                                    {
                                        returnMsg.Add(new UserControl.Message(MessageType.Error,
                                                                              "$CS_Before_Card_Length_FLetter_NotCompare $CS_Param_ID: " + aoiData.RCARD.Trim().ToUpper()));
                                    }
                                }
                                catch (Exception ex)
                                {
                                    returnMsg.Add(new UserControl.Message(ex));
                                }
                            }

                            if (returnMsg.IsSuccess())
                            {
                                IAction dataCollectMO = new ActionFactory(this._domainDataProvider).CreateAction(ActionType.DataCollectAction_GoMO);
                                messages.AddMessages(((IActionWithStatus)dataCollectMO).Execute(
                                                         new GoToMOActionEventArgs(ActionType.DataCollectAction_GoMO,
                                                                                   aoiData.RCARD.Trim().ToUpper(),
                                                                                   aoiData.USER.Trim().ToUpper(),
                                                                                   AgentHelp.getResCode(aoiData.RESOURCE.Trim().ToUpper()),
                                                                                   product, moCode)));


                                if (messages.IsSuccess())
                                {
                                    returnMsg.Add(new UserControl.Message(UserControl.MessageType.Success, string.Format("{0} $CS_GOMO_CollectSuccess", aoiData.RCARD.ToUpper())));
                                }
                                else
                                {
                                    returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, AgentHelp.GetErrorMessage(messages)));
                                }
                            }
                            messages.ClearMessages();


                            //GOOD采集
                            messages = onLine.GetIDInfo(aoiData.RCARD.Trim().ToUpper());
                            product  = (ProductInfo)messages.GetData().Values[0];
                            BenQGuru.eMES.DataCollect.DataCollectFacade dcFacade = new BenQGuru.eMES.DataCollect.DataCollectFacade(this._domainDataProvider);
                            goodResult = dcFacade.ActionCollectGood(aoiData.RCARD.ToUpper(), aoiData.USER.ToUpper(), AgentHelp.getResCode(aoiData.RESOURCE.ToUpper()));
                            // Added by Icyer 2006/08/03
                            // SMT上料
                            if (returnMsg.IsSuccess() == true && bExecuteSMTLoadItem == true)
                            {
                                returnMsg.AddMessages(this.SMTLoadItem(aoiData.RCARD.ToUpper(), AgentHelp.getResCode(aoiData.RESOURCE.ToUpper()), aoiData.USER.ToUpper()));
                            }
                            // Added end
                            if (goodResult == "OK")
                            {
                                this._domainDataProvider.CommitTransaction();

                                returnMsg.Add(new UserControl.Message(UserControl.MessageType.Success, string.Format("{0} $CS_GOOD_CollectSuccess", aoiData.RCARD.ToUpper())));
                                returnMsg.Add(new UserControl.Message(" "));
                                BenQGuru.eMES.Common.Log.Info(string.Format("{0} $CS_GOOD_CollectSuccess: {1}", aoiData.RCARD.Trim().ToUpper(), "OK"));
                                messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOODSUCCESS,$CS_Param_ID:{0}", aoiData.RCARD.ToUpper())));
                            }
                            else
                            {
                                this._domainDataProvider.RollbackTransaction();

                                string errorMsg = string.Format("{0} $CS_GOOD_CollectFail : {1}", aoiData.RCARD.Trim().ToUpper(), goodResult);
                                returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, errorMsg));
                                returnMsg.Add(new UserControl.Message(" "));
                                BenQGuru.eMES.Common.Log.Info(errorMsg);
                            }
                        }
                        catch (Exception ex)
                        {
                            this._domainDataProvider.RollbackTransaction();
                            BenQGuru.eMES.Common.Log.Info(AgentHelp.GetErrorMessage(messages), ex);
                        }
                        finally
                        {
//							((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.CloseConnection();
//							((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.AutoCloseConnection = true;
                        }
                    }
                }
            }
            catch
            {}
            return(returnMsg);
        }