Exemple #1
0
        public UserControl.Messages CollectExcute(string filePath, string encoding)
        {
            object[]      objs       = null;
            AOIFileParser fileParser = new AOIFileParser(_domainDataProvider);

            try
            {
                fileParser.FormatName = "AOIData";
                fileParser.ConfigFile = "AOIDataFileParser.xml";

                objs = fileParser.Parse(filePath);
            }
            catch {}
            finally
            {
                fileParser.CloseFile();
            }

            #region ForTest
            //			if(objs != null && objs.Length > 0)
            //			{
            //				foreach(object obj in objs)
            //				{
            //					AOIData aoiData = obj as AOIData;
            //					string error = aoiData.ERRORCODES;
            //
            //				}
            //			}
            #endregion

            parserObjs = objs;

            UserControl.Messages returnMsg = new Messages();

            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.AutoCloseConnection = false;
            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.OpenConnection();

            UserControl.Messages goodMsg = this.GoodCollect(parserObjs);
            UserControl.Messages ngMsg   = this.NGCollect(parserObjs);


            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.CloseConnection();
            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.AutoCloseConnection = true;

            if (goodMsg != null)
            {
                returnMsg.AddMessages(goodMsg);
            }
            if (ngMsg != null)
            {
                returnMsg.AddMessages(ngMsg);
            }
            return(returnMsg);
        }
Exemple #2
0
        //处理用户请求并返回结果
        public override void CycleResponse()
        {
            if (stack.CurrentDirect == FlowDirect.WaitingOutput)
            {
                try
                {
                    //获取当前的Action
                    BaseDCTAction action = stack.GetNextAction();

                    //获取默认ACtion
                    if (action == null)
                    {
                        ActionHelper  actionHelper  = new ActionHelper();
                        BaseDCTAction endNodeAction = actionHelper.GetEndNodeAction(client);
                        stack.ResetActionStack(endNodeAction);

                        if (endNodeAction != null)
                        {
                            this._LastCommand = actionHelper.GetCommandByAction(endNodeAction);
                        }

                        return;
                    }

                    //确保需要登录的Action在登录之后才可以执行
                    if (action.NeedAuthorized && !client.Authorized)
                    {
                        this.AddActionIdle(MessageType.Error);
                        return;
                    }

                    if (!action.NeedAuthorized || client.Authorized)
                    {
                        // 执行Action
                        UserControl.Messages msgs = action.Do(client);

                        if (stack.CancelActionOutput)
                        {
                            stack.CancelActionOutput = false;
                        }
                        else
                        {
                            this.SendMessage(client, msgs);
                        }
                    }
                }
                catch (Exception ex)
                {
                    DealExcepion(ex);
                }
            }
        }
Exemple #3
0
        public UserControl.Messages CollectExcute(string filePath, string encoding)
        {
            object[]      objs   = null;
            ICTFileParser parser = new ICTFileParser();

            try
            {
                objs = parser.Parse(filePath);
            }
            catch {}

            #region ForTest
            //			if(objs != null && objs.Length > 0)
            //			{
            //				foreach(object obj in objs)
            //				{
            //					ICTData ictdata = obj as ICTData;
            //					string error = ictdata.ERRORCODES;
            //
            //					object[] tst =  GetErrorInfor( ictdata);
            //					string ss ="";
            //				}
            //			}
            #endregion

            parserObjs = objs;

            UserControl.Messages returnMsg = new Messages();

            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.AutoCloseConnection = false;
            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.OpenConnection();

            UserControl.Messages checkMsg = this.CheckData(parserObjs);
            UserControl.Messages goodMsg  = this.GoodCollect(parserObjs);
            UserControl.Messages ngMsg    = this.NGCollect(parserObjs);

            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.CloseConnection();
            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.AutoCloseConnection = true;
            if (checkMsg != null)
            {
                returnMsg.AddMessages(checkMsg);
            }
            if (goodMsg != null)
            {
                returnMsg.AddMessages(goodMsg);
            }
            if (ngMsg != null)
            {
                returnMsg.AddMessages(ngMsg);
            }
            return(returnMsg);
        }
Exemple #4
0
        private void DealExcepion(Exception ex)
        {
            UserControl.FileLog.FileLogOut("DCTControlPanel.log", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ex.StackTrace);

            UserControl.Messages msgs = new UserControl.Messages();
            msgs.Add(new UserControl.Message(ex));

            if (ex.GetType().FullName != "System.Net.Sockets.SocketException" &&
                ex.GetType().FullName != "System.Threading.ThreadAbortException")
            {
                this.SendMessage(client, msgs);
            }
        }
        public UserControl.Messages Print(string printer, string templatePath, List <System.Collections.Specialized.StringDictionary> valueLists)
        {
            UserControl.Messages messages = new UserControl.Messages();
            //Add By Leo @2013-12-31 for 多标签打印支持
            var templates = templatePath.Split('#');

            try
            {
                PrePrint();
                if (templates.Length > 1)                 //多张标签打印
                {
                    try
                    {
                        foreach (var item in templates)
                        {
                            _CodeSoftFacade.OpenTemplate(printer, item.Trim().TrimEnd('#'));
                            _CodeSoftFacade.PrintWithOutReleaseCom(valueLists);
                        }
                    }
                    catch (Exception ex)
                    {
                        messages.Add(new UserControl.Message(MessageType.Error, ex.Message));
                    }
                    finally
                    {
                        //释放端口
                        _CodeSoftFacade.ReleaseCom();
                    }
                }
                else
                {
                    _CodeSoftFacade.OpenTemplate(printer, templatePath);
                    _CodeSoftFacade.Print(valueLists);
                }

                messages.Add(new UserControl.Message(UserControl.MessageType.Success, "$Success_Print_Label"));
            }
            catch (System.Exception ex)
            {
                messages.Add(new UserControl.Message(UserControl.MessageType.Error, ex.Message));
                return(messages);
            }
            finally
            {
                _CodeSoftFacade.ReleaseCom();
            }

            return(messages);
        }
Exemple #6
0
        public UserControl.Messages CollectExcute(string filePath, string encoding)
        {
            object[]         objs       = null;
            PIDAOIFileParser fileParser = new PIDAOIFileParser(_domainDataProvider);

            try
            {
                fileParser.FormatName = "PIDAOIData";
                fileParser.ConfigFile = "PIDAOIDataFileParser.xml";

                objs = fileParser.Parse(filePath);
            }
            catch {}
            finally
            {
                fileParser.CloseFile();
            }

            #region ForTest
            //			if(objs != null && objs.Length > 0)
            //			{
            //				foreach(object obj in objs)
            //				{
            //					AOIData aoiData = obj as AOIData;
            //					string error = aoiData.ERRORCODES;
            //
            //				}
            //			}
            #endregion

            parserObjs = objs;

            UserControl.Messages returnMsg = new Messages();
            UserControl.Messages goodMsg   = this.GoodCollect(parserObjs);
            UserControl.Messages ngMsg     = this.NGCollect(parserObjs);

            if (goodMsg != null)
            {
                returnMsg.AddMessages(goodMsg);
            }
            if (ngMsg != null)
            {
                returnMsg.AddMessages(ngMsg);
            }
            return(returnMsg);
        }
Exemple #7
0
 public override void RCardRun()
 {
     base.RCardRun();
     try
     {
         string   strRCard = currentRunningCard;
         DateTime dtStart  = DateTime.Now;
         actionForm.ucLabEditInputID.Value = strRCard;
         actionForm.ucLabEditInputID_TxtboxKeyPress(actionForm.ucLabEditInputID, new KeyPressEventArgs('\r'));
         f.LogCostTime(dtStart, strRCard);
     }
     catch (Exception ex)
     {
         UserControl.Messages msg = new UserControl.Messages();
         msg.Add(new UserControl.Message(ex));
         ApplicationRun.GetInfoForm().Add(msg);
     }
 }
Exemple #8
0
 private void f_CollectTick(object sender, EventArgs e)
 {
     if (bExecuteing == true)
     {
         return;
     }
     bExecuteing = true;
     try
     {
         BeforeRCardRun();
         RCardRun();
         AfterRCardRun();
     }
     catch (Exception ex)
     {
         UserControl.Messages msg = new UserControl.Messages();
         msg.Add(new UserControl.Message(ex));
         ApplicationRun.GetInfoForm().Add(msg);
     }
     finally
     {
         bExecuteing = false;
     }
 }
Exemple #9
0
 protected void ShowMessage(UserControl.Messages messages)
 {
     ApplicationRun.GetInfoForm().Add(messages);
 }
        // 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);
        }
Exemple #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;
            }

            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;
            }
        }
        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);
        }
        // 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);
        }
        //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);
        }
Exemple #15
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);
        }
Exemple #16
0
 public void Add(UserControl.Message message)
 {
     UserControl.Messages messages = new UserControl.Messages();
     messages.Add(message);
     this.Add(messages);
 }
Exemple #17
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);
            }
        }
Exemple #18
0
 public void Add(UserControl.Messages messages)
 {
     memInfor.Add(messages);
 }
Exemple #19
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);
        }
Exemple #20
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);
        }
Exemple #21
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);
 }
Exemple #22
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);
        }