示例#1
0
        protected override object GetEditObject(GridRecord row)
        {
            if (_facade == null)
            {
                _facade = new BaseModelFacadeFactory(base.DataProvider).Create();
            }
            string strCode = string.Empty;
            object objCode = row.Items.FindItemByKey("ResourceCode").Value;

            if (objCode != null)
            {
                strCode = objCode.ToString();
            }
            object obj = _facade.GetResource(strCode);

            if (obj != null)
            {
                return((Resource)obj);
            }
            return(null);
        }
示例#2
0
        public Messages CheckIn(ActionEventArgs actionEventArgs)
        {
            ((GoToMOActionEventArgs)actionEventArgs).PassCheck = true;

            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "GetIDInfo");

            dataCollectDebug.WhenFunctionIn(messages);

            try
            {
                DataCollectFacade   dataCollectFacade = new DataCollectFacade(this.DataProvider);
                MOFacade            moFacade          = new MOFacade(this.DataProvider);
                MOLotFacade         moLotFacade       = new MOLotFacade(this.DataProvider);
                BaseModelFacade     dataModel         = new BaseModelFacade(this.DataProvider);
                ModelFacade         mf           = new ModelFacade(this.DataProvider);
                SystemSettingFacade systemFacade = new SystemSettingFacade(this.DataProvider);

                //AMOI  MARK  START  20050803 序号默认为初始,FOR 重工序列号重复
                actionEventArgs.ProductInfo.NowSimulation.LotSeq = ActionOnLineHelper.StartSeq;
                //AMOI  MARK  END

                if (((GoToMOActionEventArgs)actionEventArgs).MOCode == null || ((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim() == string.Empty)
                {
                    throw new Exception("$CS_Sys_GoToMO_Lost_MOParam");
                }


                #region 检查途程
                MO mo = null;
                if (actionEventArgs.CurrentMO != null)
                {
                    mo = actionEventArgs.CurrentMO;
                }
                else
                {
                    mo = (MO)moFacade.GetMO(((GoToMOActionEventArgs)actionEventArgs).MOCode);
                    actionEventArgs.CurrentMO = mo;
                }
                if (mo == null)
                {
                    throw new Exception("$CS_MO_Not_Exit");
                }

                MO2Route route = (MO2Route)moFacade.GetMONormalRouteByMOCode(mo.MOCode);
                if (route == null)
                {
                    throw new Exception("$CS_MOnotNormalRoute");
                }

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

                if (dataModel.GetOperation2Resource(op.OPCode, actionEventArgs.ResourceCode) == null)
                {
                    throw new Exception("$CS_Route_Failed_FirstOP $Domain_MO =" + mo.MOCode);
                }
                #endregion

                #region 检查工单

                //工单状态检查
                if (!dataCollectFacade.CheckMO(mo))
                {
                    throw new Exception("$CS_MO_Status_Error $CS_Param_MOStatus=$" + mo.MOStatus);
                }

                /*1.Simulation 没有记录
                 *	    a. MO Running Card 没有重复		OK
                 *     b. MO Running Card 有重复		Exception
                 *
                 * 2. Simulation 有记录
                 *		a.  Simulation 工单 和 当前工单 一样			OK
                 *		b.  Simulation 工单 和 当前工单 不一样
                 *			 b1.  当前工单 是重工工单
                 *					b11.  MO Running Card 没有重复		OK
                 *					b12.  MO Running Card 有重复			Exception
                 *			 b2.  当前工单不是重工工单						Exception
                 *
                 */

                Parameter parameter = (Parameter)systemFacade.GetParameter(mo.MOType, BenQGuru.eMES.Web.Helper.MOType.GroupType);

                if (parameter == null)
                {
                    throw new Exception("$CS_MOType_Lost");
                }
                mo.MOType = parameter.ParameterValue;

                if (actionEventArgs.ProductInfo.LastSimulation != null)
                {
                    //归属工单和归属工序相同也不允许
                    if ((mo.MOCode == actionEventArgs.ProductInfo.LastSimulation.MOCode))
                    {
                        ((GoToMOActionEventArgs)actionEventArgs).PassCheck = false;
                        return(messages);
                    }
                    //Laws Lu,2005/10/20,修改	Lucky的需求	CS112
                    //建议返工工单归属采集时增加判断条件,也就是说只有没有在制记录的或者已经拆解的产品序列号才能归属返工工单
                    if (actionEventArgs.ProductInfo.LastSimulation.IsComplete == "0")
                    {
                        throw new Exception("$CS_PRODUCT_STILL_INLINE_NOT_BELONG_MO ,$CS_Param_ID=" + actionEventArgs.LotCode);
                    }
                }

                // 投入量检查
                if (mo.IsControlInput == "1")   // 客户在工单中勾选了“限制投入量”则检查工单可投入量,否则不检查
                {
                    if (mo.MOPlanQty - mo.MOInputQty + mo.MOScrapQty + mo.MOOffQty - mo.IDMergeRule < 0)
                    {
                        throw new Exception("$CS_MOInputOut $Domain_MO =" + mo.MOCode);
                    }
                }
                #endregion

                #region 检查库房状态
                if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"] != null &&
                    System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                {
                    Material.WarehouseFacade wFAC = new BenQGuru.eMES.Material.WarehouseFacade(DataProvider);
                    //读资源对应的产线
                    BenQGuru.eMES.BaseSetting.BaseModelFacade facade = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                    object objResource = facade.GetResource(actionEventArgs.ResourceCode);

                    string strSSCode = ((BenQGuru.eMES.Domain.BaseSetting.Resource)objResource).StepSequenceCode;
                    object obj       = wFAC.GetWarehouseByMoSS(mo.MOCode, strSSCode);
                    if (obj != null)
                    {
                        Domain.Warehouse.Warehouse wh = obj as Domain.Warehouse.Warehouse;
                        //Laws Lu,2006/02/20,修改/无需工段代码
                        string strStatus = wFAC.GetWarehouseStatus(wh.WarehouseCode, wh.FactoryCode);
                        if (strStatus == Domain.Warehouse.Warehouse.WarehouseStatus_Cycle)
                        {
                            throw new Exception("$CS_LINE_IS_HOLD");
                        }
                    }
                }
                #endregion

                #region 填写新SIMULATION 归属工单 批次数量从tblmo2lotlink 中获取

                Domain.MOModel.MO2LotLink mo2lotlink = moLotFacade.GetMO2LotLink(actionEventArgs.LotCode, mo.MOCode) as Domain.MOModel.MO2LotLink;
                if (mo2lotlink != null)
                {
                    if (mo2lotlink.LotStatus != LotStatusForMO2LotLink.LOTSTATUS_STOP)
                    {
                        mo2lotlink.LotStatus = LotStatusForMO2LotLink.LOTSTATUS_USE;
                        moLotFacade.UpdateMO2LotLink(mo2lotlink);

                        actionEventArgs.ProductInfo.NowSimulation.LotQty  = mo2lotlink.LotQty;
                        actionEventArgs.ProductInfo.NowSimulation.GoodQty = mo2lotlink.LotQty;
                        actionEventArgs.ProductInfo.NowSimulation.NGQty   = 0;
                    }
                    else
                    {
                        throw new Exception("$CS_Mo2LotLink_Error_Status");
                    }
                }
                else
                {
                    throw new Exception("$CS_Mo2LotLink_Not_Exist");
                }


                //messages.AddMessages( dataCollectFacade.WriteSimulation(id,actionType,resourceCode,userCode,product));
                actionEventArgs.ProductInfo.NowSimulation.RouteCode  = route.RouteCode;
                actionEventArgs.ProductInfo.NowSimulation.OPCode     = op.OPCode;
                actionEventArgs.ProductInfo.NowSimulation.LotStatus  = LotStatusForMO2LotLink.LOTSTATUS_USE;
                actionEventArgs.ProductInfo.NowSimulation.LastAction = ActionType.DataCollectAction_GoMO;
                actionEventArgs.ProductInfo.NowSimulation.ActionList = ";" + ActionType.DataCollectAction_GoMO + ";";
                actionEventArgs.ProductInfo.NowSimulation.LotCode    = actionEventArgs.LotCode;
                actionEventArgs.ProductInfo.NowSimulation.MOCode     = mo.MOCode;
                actionEventArgs.ProductInfo.NowSimulation.ItemCode   = mo.ItemCode;
                Model model = mf.GetModelByItemCode(mo.ItemCode);
                if (model == null)
                {
                    throw new Exception("$CS_Model_Lost $CS_Param_ItemCode=" + mo.ItemCode);
                }
                actionEventArgs.ProductInfo.NowSimulation.ModelCode     = model.ModelCode;
                actionEventArgs.ProductInfo.NowSimulation.IsComplete    = ProductComplete.NoComplete;
                actionEventArgs.ProductInfo.NowSimulation.CollectStatus = CollectStatus.CollectStatus_BEGIN;
                actionEventArgs.ProductInfo.NowSimulation.ResCode       = actionEventArgs.ResourceCode;
                actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.GOOD;
                actionEventArgs.ProductInfo.NowSimulation.FromOP        = ActionOnLineHelper.StringNull;
                actionEventArgs.ProductInfo.NowSimulation.FromRoute     = ActionOnLineHelper.StringNull;
                actionEventArgs.ProductInfo.NowSimulation.CartonCode    = ActionOnLineHelper.StringNull;
                actionEventArgs.ProductInfo.NowSimulation.LotNo         = ActionOnLineHelper.StringNull;
                actionEventArgs.ProductInfo.NowSimulation.PalletCode    = ActionOnLineHelper.StringNull;
                actionEventArgs.ProductInfo.NowSimulation.NGTimes       = ActionOnLineHelper.StartNGTimes;
                actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.GOOD;
                actionEventArgs.ProductInfo.NowSimulation.LotStatus     = LotStatusForMO2LotLink.LOTSTATUS_USE;
                actionEventArgs.ProductInfo.NowSimulation.IsHold        = 0;
                actionEventArgs.ProductInfo.NowSimulation.MOSeq         = (int)mo.MOSeq; // Added by Icyer 2007/07/03
                //update by andy.xin rmaBillCode
                //actionEventArgs.ProductInfo.NowSimulation.RMABillCode = rmaBillCode; //mo.RMABillCode;

                #endregion
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }

            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
示例#3
0
        // Added end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

                            num += 1;
                        }

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

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

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

                        #region Check if key part was used

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

                        #endregion

                        #region check NeedVendor


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

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

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

                        #endregion

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

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

                            opBomdetailRealCollectList.Add((object)newMINNO);
                        }

                        ++opBomDetailCollectNum;
Label2:

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

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

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


                domainProvider.BeginTransaction();
                try
                {
                    BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider);
                    Resource resource = (Resource)dataModel.GetResource(args.ResourceCode);

                    _helper = new ActionOnLineHelper(domainProvider);
                    ActionCheckStatus actionCheckStatus = new ActionCheckStatus();
                    actionCheckStatus.ProductInfo          = product;
                    actionCheckStatus.ProductInfo.Resource = resource;
                    ExtendSimulation lastSimulation = actionCheckStatus.ProductInfo.LastSimulation;

                    BenQGuru.eMES.Material.WarehouseFacade wfacade = null;
                    if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                    {
                        wfacade = new WarehouseFacade(domainProvider);
                    }

                    IDCTClient client = act as IDCTClient;

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

                    #region Check if key part was used

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

                    #endregion

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

                        string strRCard = product.NowSimulation.RunningCard;



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


                    #region 物料过账

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

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

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

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

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

                    #endregion

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

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

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

                            product = actionCheckStatus.ProductInfo;

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

                    if (msg.IsSuccess())
                    {
                        domainProvider.CommitTransaction();
                        msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_CollectSuccess")));
                    }
                    else
                    {
                        domainProvider.RollbackTransaction();
                    }
                }
                catch (Exception ex)
                {
                    domainProvider.RollbackTransaction();

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

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

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

            ProcessBeforeReturn(this.Status, msg);
            return(msg);
        }
示例#4
0
文件: FBurn.cs 项目: windygu/.net-wms
        private void CheckAndRunOnWip()
        {
            if (txtRunningCard.Value.Trim() == string.Empty)
            {
                if (!this.txtGOMO.Checked)
                {
                    txtMO.Value               = String.Empty;
                    txtItem.Value             = String.Empty;
                    labelItemDescription.Text = "";
                }

                ApplicationRun.GetInfoForm().AddEx("$CS_Please_Input_RunningCard");

                //将焦点移到产品序列号输入框
                txtRunningCard.TextFocus(false, true);
                return;
            }
            else
            {
                DBDateTime        dbDateTime        = FormatHelper.GetNowDBDateTime(this.DataProvider);
                BurnFacade        burnFacade        = new BurnFacade(this.DataProvider);
                DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                string            sourceCard        = dataCollectFacade.GetSourceCard(this.txtRunningCard.Value.Trim().ToUpper(), string.Empty);

                if (this.txtGOMO.Checked && this.txtGOMO.Value.Trim().Length == 0)
                {
                    ApplicationRun.GetInfoForm().AddEx("$CS_CMPleaseInputMO");
                    this.txtGOMO.Checked = true;
                    this.txtGOMO.TextFocus(false, true);
                    return;
                }

                if (this.txtGOMO.Checked && this.txtGOMO.InnerTextBox.Enabled)
                {
                    ApplicationRun.GetInfoForm().AddEx("$CS_PleasePressEnterOnGOMO");
                    this.txtGOMO.Checked = true;
                    this.txtGOMO.TextFocus(false, true);
                    return;
                }
                // End Added
                //Add by sandy on 20140528
                if (rdoBurnIn.Checked && rdoNG.Checked)
                {
                    UserControl.Message message = new UserControl.Message(MessageType.Error, "$CS_BurnIn_Can_Not_NG");
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ": " + this.txtRunningCard.Value, message, true);
                    txtRunningCard.TextFocus(false, true);
                    return;
                }
                //end
                if (txtRunningCard.Value.Trim().ToUpper() == ng_collect)
                {
                    rdoNG.Checked      = true;
                    rdoBurnOut.Checked = true;
                    txtRunningCard.TextFocus(false, true);
                    return;
                }

                //Jarvis 20130125 支持GOOD指令
                if (txtRunningCard.Value.Trim().ToUpper() == good_collect)
                {
                    rdoGood.Checked = true;
                    txtRunningCard.TextFocus(false, true);
                    return;
                }
                //Add by sandy on 20140528
                if (txtRunningCard.Value.Trim().ToUpper() == ActionType.DataCollectAction_BurnIn)
                {
                    rdoGood.Checked   = true;
                    rdoBurnIn.Checked = true;
                    txtRunningCard.TextFocus(false, true);
                    return;
                }

                if (txtRunningCard.Value.Trim().ToUpper() == ActionType.DataCollectAction_BurnOutGood)
                {
                    rdoGood.Checked    = true;
                    rdoBurnOut.Checked = true;
                    txtRunningCard.TextFocus(false, true);
                    return;
                }

                if (txtRunningCard.Value.Trim().ToUpper() == ActionType.DataCollectAction_BurnOutNG)
                {
                    rdoNG.Checked      = true;
                    rdoBurnOut.Checked = true;
                    txtRunningCard.TextFocus(false, true);
                    return;
                }

                //End

                //add by hiro.chen 08/11/18 TocheckIsDown
                Messages msg = new Messages();
                msg.AddMessages(dataCollectFacade.CheckISDown(sourceCard.Trim().ToUpper()));
                if (!msg.IsSuccess())
                {
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ":" + this.txtRunningCard.Value, msg, true);
                    txtRunningCard.TextFocus(false, true);
                    return;
                }
                //end

                //报废不能返工
                msg.AddMessages(dataCollectFacade.CheckReworkRcardIsScarp(sourceCard.Trim().ToUpper(), ApplicationService.Current().ResourceCode));
                if (!msg.IsSuccess())
                {
                    ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ":" + this.txtRunningCard.Value, msg, true);
                    txtRunningCard.TextFocus(false, true);
                    return;
                }
                //end

                //Laws Lu,2005/10/19,新增	缓解性能问题
                //Laws Lu,2006/12/25 修改	减少Open/Close的次数
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = false;
                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();

                //Laws Lu,2005/08/16,修改	把msg换成globeMSG
                globeMSG = CheckProduct();

                // Added by Icyer 2005/10/28
                if (Resource == null)
                {
                    BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                    Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode);
                }
                actionCheckStatus             = new ActionCheckStatus();
                actionCheckStatus.ProductInfo = product;

                if (actionCheckStatus.ProductInfo != null)
                {
                    actionCheckStatus.ProductInfo.Resource = Resource;
                }

                string strMoCode = String.Empty;
                if (product != null && product.LastSimulation != null)
                {
                    strMoCode = product.LastSimulation.MOCode;
                }

                if (strMoCode != String.Empty)
                {
                    if (listActionCheckStatus.ContainsKey(strMoCode))
                    {
                        actionCheckStatus             = (ActionCheckStatus)listActionCheckStatus[strMoCode];
                        actionCheckStatus.ProductInfo = product;
                        actionCheckStatus.ActionList  = new ArrayList();
                    }
                    else
                    {
                        listActionCheckStatus.Add(strMoCode, actionCheckStatus);
                    }
                }
                //Amoi,Laws Lu,2005/08/02,修改

                if (txtGOMO.Checked == true)
                {
                    globeMSG.AddMessages(RunGOMO(actionCheckStatus));

                    if (!globeMSG.IsSuccess())
                    {
                        listActionCheckStatus.Clear();
                    }
                }
                else
                {
                    if (product != null && product.LastSimulation != null)
                    {
                        this.txtMO.Value               = product.LastSimulation.MOCode;
                        this.txtItem.Value             = product.LastSimulation.ItemCode;
                        this.labelItemDescription.Text = this.GetItemDescription(product.LastSimulation.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID);
                    }
                    else
                    {
                        this.txtMO.Value               = "";
                        this.txtItem.Value             = "";
                        this.labelItemDescription.Text = "";
                    }
                }
                //EndAmoi

                //老化进和老化出工序不能同时勾选
                BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider);
                ItemFacade      itemFacade      = new ItemFacade(this.DataProvider);
                object          objOP           = baseModelFacade.GetOperationByResource(ApplicationService.Current().ResourceCode);
                if (product != null && product.LastSimulation != null && objOP != null)
                {
                    object objOp = itemFacade.GetItemRoute2Operation(this.txtItem.Value, product.LastSimulation.RouteCode,
                                                                     ((Operation2Resource)objOP).OPCode);
                    if (objOp != null)
                    {
                        opControl = ((ItemRoute2OP)objOp).OPControl;
                        if (opControl[(int)OperationList.BurnIn] == isSelected && opControl[(int)OperationList.BurnOut] == isSelected)
                        {
                            globeMSG.Add(new UserControl.Message(MessageType.Error, "$CS_BurnInOut_Can_Not_Choose_Together"));
                        }
                    }
                }
                //老化未达到预计时间且不是强制老化时不可做老化出良品采集
                if (!isForce && globeMSG.IsSuccess() && rdoBurnOut.Checked && rdoGood.Checked && product.LastSimulation != null)
                {
                    object  objBurnWip = burnFacade.GetBurnWip(sourceCard.Trim().ToUpper(), product.LastSimulation.MOCode);
                    BurnWip burnWip    = objBurnWip as BurnWip;
                    if (objBurnWip != null && burnWip.Status == BurnType.BurnIn)
                    {
                        DateTime dtForecast = FormatHelper.ToDateTime(burnWip.ForecastOutDate, burnWip.ForecastOutTime);
                        if (dbDateTime.DateTime < dtForecast)
                        {
                            globeMSG.Add(new UserControl.Message(MessageType.Error, "$CS_Burn_Time_Not_Enough"));
                        }
                    }
                }

                if (globeMSG.IsSuccess())
                {
                    this.RunOnWip();
                }
            }
            //刷新grid
            this.BindGrid();
            //Laws Lu,2005/10/19,新增	缓解性能问题
            //Laws Lu,2006/12/25 修改	减少Open/Close的次数
            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = true;

            //将焦点移到产品序列号输入框
            ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ": " + this.txtRunningCard.Value, globeMSG, true);

            //Application.DoEvents();
            txtRunningCard.TextFocus(false, true);

            globeMSG.ClearMessages();
        }
示例#5
0
        private Messages SetReworkInformation(Messages messages, object[] Simulations, OQCRejectEventArgs actionEventArgs, ActionOnLineHelper dataCollect, ReworkFacade reworkFacade)
        {
            Messages newMessages = new Messages();

            BenQGuru.eMES.TS.TSFacade tsFacade = new BenQGuru.eMES.TS.TSFacade(this.DataProvider);
            DataCollectFacade         dcf      = new DataCollectFacade(this._domainDataProvider);
            //ProductInfo preProduct =null;
            int i = 0;

            ActionCheckStatus actionCheckStatus = new ActionCheckStatus();

            if (Resource == null)
            {
                BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(actionEventArgs.ResourceCode);
            }

            while (i < Simulations.Length)
            {
                try
                {
                    #region 保存WIP
                    ProductInfo productionInf = dataCollect.GetIDInfoBySimulation((Simulation)Simulations[i]);

                    if (actionEventArgs.listActionCheckStatus.ContainsKey(productionInf.LastSimulation.MOCode))
                    {
                        actionCheckStatus = (ActionCheckStatus)actionEventArgs.listActionCheckStatus[productionInf.LastSimulation.MOCode];

                        actionCheckStatus.ProductInfo = productionInf;

                        actionCheckStatus.ProductInfo.Resource = Resource;

                        //					lastSimulation =  productionInf.LastSimulation;
                        actionCheckStatus.ActionList = new ArrayList();
                    }
                    else
                    {
                        //actionCheckStatus.NeedUpdateSimulation = false;
                        //actionCheckStatus.NeedFillReport = true;
                        actionEventArgs.listActionCheckStatus.Add(productionInf.LastSimulation.MOCode, actionCheckStatus);
                    }

                    OQCRejectEventArgs oqcRejectEventArgs = new OQCRejectEventArgs(
                        ActionType.DataCollectAction_OQCReject, ((Simulation)Simulations[i]).RunningCard,
                        actionEventArgs.UserCode, actionEventArgs.ResourceCode, actionEventArgs.OQCLotNO, productionInf);

                    newMessages.AddMessages(dataCollect.CheckID(oqcRejectEventArgs, actionCheckStatus));
                    //					if (preProduct != null)
                    //					{
                    //						if (dataCollect.CompareSimulationCheck(preProduct.LastSimulation,oqcRejectEventArgs.ProductInfo.LastSimulation))
                    //						{
                    //							dataCollect.CopyProduct(preProduct,oqcRejectEventArgs.ProductInfo);
                    //							dcf.WriteSimulationCheckOnlineOP(oqcRejectEventArgs.RunningCard,oqcRejectEventArgs.ActionType,oqcRejectEventArgs.ResourceCode,
                    //								oqcRejectEventArgs.UserCode,oqcRejectEventArgs.ProductInfo);
                    //							needCheck=false;
                    //						}
                    //					}
                    //					if (needCheck)
                    //						newMessages.AddMessages(dataCollect.CheckID(oqcRejectEventArgs));
                    if (!newMessages.IsSuccess())
                    {
                        return(newMessages);
                    }
                    #region TS
                    //Laws Lu,需要修改	曾经走过TS处理,没有考虑多次TS的情况,MOCode和Sequence也应该作为关键参数,
                    BenQGuru.eMES.Domain.TS.TS ts = (BenQGuru.eMES.Domain.TS.TS)tsFacade.GetCardLastTSRecord(oqcRejectEventArgs.RunningCard);
                    if (ActionType.DataCollectAction_OQCReject == oqcRejectEventArgs.ActionType &&
                        ts != null &&
                        ts.FromInputType == TS.TSFacade.TSSource_OnWIP
                        )
                    {
                        //Laws Lu,2006/07/07 修复在OQC前工序NG回流后,SN后仍然留在PK站
                        dcf.AdjustRouteOPOnline(oqcRejectEventArgs.RunningCard
                                                , ActionType.DataCollectAction_OQCReject
                                                , oqcRejectEventArgs.ResourceCode
                                                , oqcRejectEventArgs.UserCode
                                                , oqcRejectEventArgs.ProductInfo);


                        //oqcRejectEventArgs.ProductInfo.NowSimulation.OPCode = op.OPCode;

                        dcf.WriteSimulation(
                            oqcRejectEventArgs.RunningCard
                            , ActionType.DataCollectAction_OQCReject
                            , oqcRejectEventArgs.ResourceCode
                            , oqcRejectEventArgs.UserCode
                            , oqcRejectEventArgs.ProductInfo);
                    }
                    #endregion
                    //Laws Lu,2006/07/07 fix op
                    if (oqcRejectEventArgs.ProductInfo.CurrentItemRoute2OP != null)
                    {
                        oqcRejectEventArgs.ProductInfo.NowSimulation.OPCode = oqcRejectEventArgs.ProductInfo.CurrentItemRoute2OP.OPCode;
                    }
                    else
                    {
                        object objNextOP = (new BaseModelFacade(DataProvider)).GetNextOperationOfRoute(oqcRejectEventArgs.ProductInfo.LastSimulation.RouteCode, oqcRejectEventArgs.ProductInfo.LastSimulation.OPCode);
                        if (objNextOP != null)
                        {
                            oqcRejectEventArgs.ProductInfo.NowSimulation.OPCode = (objNextOP as Operation).OPCode;
                        }
                    }

                    oqcRejectEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.Reject;
                    if (actionCheckStatus.NeedUpdateSimulation == true)
                    {
                        //把资源暂时替换成onwip需要正确资源
                        string resCode = oqcRejectEventArgs.ResourceCode;
                        oqcRejectEventArgs.ResourceCode = actionEventArgs.rightResource;
                        newMessages.AddMessages(dataCollect.Execute(oqcRejectEventArgs));
                        //转换回原来的资源
                        oqcRejectEventArgs.ResourceCode = resCode;
                    }
                    #endregion
                    if (newMessages.IsSuccess())
                    {
                        if (oqcRejectEventArgs.ProductInfo.NowSimulation == null)
                        {
                            throw new Exception("$System_Error");
                        }


                        #region reject
                        Reject reject = reworkFacade.CreateNewReject();
                        reject.ItemCode              = oqcRejectEventArgs.ProductInfo.NowSimulation.ItemCode;
                        reject.LOTNO                 = oqcRejectEventArgs.OQCLotNO;
                        reject.MaintainUser          = oqcRejectEventArgs.UserCode;
                        reject.MOCode                = oqcRejectEventArgs.ProductInfo.NowSimulation.MOCode;
                        reject.ModelCode             = oqcRejectEventArgs.ProductInfo.NowSimulation.ModelCode;
                        reject.OPCode                = oqcRejectEventArgs.ProductInfo.NowSimulation.OPCode;
                        reject.RejectDate            = oqcRejectEventArgs.ProductInfo.NowSimulation.MaintainDate;
                        reject.RejectStatus          = RejectStatus.Reject;
                        reject.RejectTime            = oqcRejectEventArgs.ProductInfo.NowSimulation.MaintainTime;
                        reject.RejectUser            = oqcRejectEventArgs.UserCode;
                        reject.ResourceCode          = oqcRejectEventArgs.ResourceCode;
                        reject.RouteCode             = oqcRejectEventArgs.ProductInfo.NowSimulation.RouteCode;
                        reject.RunningCard           = oqcRejectEventArgs.RunningCard;
                        reject.RunningCardSequence   = oqcRejectEventArgs.ProductInfo.NowSimulation.RunningCardSequence;
                        reject.SegmentCode           = oqcRejectEventArgs.ProductInfo.NowSimulationReport.SegmentCode;
                        reject.SourceCard            = oqcRejectEventArgs.ProductInfo.NowSimulation.SourceCard;
                        reject.SourceCardSequence    = oqcRejectEventArgs.ProductInfo.NowSimulation.SourceCardSequence;
                        reject.StepSequenceCode      = oqcRejectEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode;
                        reject.TranslateCard         = oqcRejectEventArgs.ProductInfo.NowSimulation.TranslateCard;
                        reject.TranslateCardSequence = oqcRejectEventArgs.ProductInfo.NowSimulation.TranslateCardSequence;
                        reject.MOSeq                 = oqcRejectEventArgs.ProductInfo.NowSimulation.MOSeq; // Added by Icyer 2007/07/02
                        reworkFacade.AddReject(reject);
                        #endregion
                    }

                    //Laws Lu,2005/08/25,新增
                    //样本如果有若干个已经经过“送修确认”转为“待修”状态(或者在维修中),那么批退不可以继续
                    //TSFacade tsFacade = new TSFacade(this._domainDataProvider);
                    //Laws Lu,2005/08/25,新增	删除TS中的记录
                    //Laws Lu,2005/08/31,修改	只有FQC工序送修才能够被删除
                    if (oqcRejectEventArgs.ActionType == ActionType.DataCollectAction_OQCReject &&
                        ts != null &&
                        ts.FromInputType == TS.TSFacade.TSSource_OnWIP &&
                        ts.TSStatus == BenQGuru.eMES.Web.Helper.TSStatus.TSStatus_New)
                    {
                        if (ts.FromRouteCode == oqcRejectEventArgs.ProductInfo.LastSimulation.RouteCode &&
                            ts.FromOPCode == oqcRejectEventArgs.ProductInfo.LastSimulation.OPCode &&
                            ts.MOCode == oqcRejectEventArgs.ProductInfo.LastSimulation.MOCode &&
                            ts.RunningCardSequence == oqcRejectEventArgs.ProductInfo.LastSimulation.RunningCardSequence &&
                            ts.RunningCard == oqcRejectEventArgs.ProductInfo.LastSimulation.RunningCard)
                        {
                            tsFacade.DeleteCardInTS(
                                oqcRejectEventArgs.ProductInfo.LastSimulation.MOCode
                                , oqcRejectEventArgs.ProductInfo.LastSimulation.RunningCard
                                , oqcRejectEventArgs.ProductInfo.LastSimulation.RunningCardSequence.ToString());
                        }
                    }
                }
                catch (Exception ex)
                {
                    newMessages.Add(new Message(ex));
                }

                //preProduct=oqcRejectEventArgs.ProductInfo;
                i = i + 1;
            }

            //Laws Lu,2006/03/20 填写资源报表
            //Laws Lu,2006/03/21 支持混单
            Hashtable htOutput = new Hashtable();

            foreach (Simulation sim in Simulations)
            {
                Simulation tmpSim = null;
                foreach (Simulation x in htOutput.Keys)
                {
                    if (sim.MOCode == x.MOCode)
                    {
                        tmpSim = x;
                        break;
                    }
                }
                if (tmpSim != null)
                {
                    htOutput[tmpSim] = Convert.ToInt32(htOutput[tmpSim]) + 1;
                }
                else
                {
                    htOutput.Add(sim, 1);
                }
            }


            foreach (Simulation sim in htOutput.Keys)
            {
                ProductInfo product = null;

                Messages msgs = dataCollect.GetIDInfo(sim.RunningCard);
                if (msgs.IsSuccess())
                {
                    product = msgs.GetData().Values[0] as ProductInfo;
                }
                DBDateTime dbDateTime;

                dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                //				dcf.AdjustRouteOPOnline(
                //					product.LastSimulation.RunningCard,
                //					actionEventArgs.ActionType,
                //					actionEventArgs.ResourceCode,
                //					actionEventArgs.UserCode,
                //					product);

                product.NowSimulation.MaintainUser  = actionEventArgs.UserCode;
                product.NowSimulation.MaintainDate  = dbDateTime.DBDate;
                product.NowSimulation.MaintainTime  = dbDateTime.DBTime;
                product.NowSimulation.LastAction    = actionEventArgs.ActionType;
                product.NowSimulation.ProductStatus = ProductStatus.GOOD;
                product.NowSimulation.ResourceCode  = Resource.ResourceCode;

                (new DataCollectFacade(DataProvider)).WriteSimulation(
                    product.LastSimulation.RunningCard
                    , ActionType.DataCollectAction_OQCPass
                    , actionEventArgs.ResourceCode
                    , actionEventArgs.UserCode
                    , product);


                product.NowSimulation.RouteCode = product.LastSimulation.RouteCode;
                product.NowSimulation.OPCode    = product.LastSimulation.OPCode;;

                product.NowSimulationReport = dataCollect.FillSimulationReport(product);
                //dataCollect.FillOnWip(pro);

                //newMessages.AddMessages((new ReportHelper(DataProvider)).SetReportResQuanMaster(
                //    DataProvider
                //    , actionEventArgs.ActionType
                //    , product
                //    , 0
                //    , Convert.ToInt32(htOutput[sim])
                //    , Convert.ToInt32(htOutput[sim])));
            }

            return(newMessages);
        }