Exemple #1
0
        /// <summary>
        /// 良品采集
        /// </summary>
        /// <param name="domainDataProvider"></param>
        /// <param name="iD"></param>
        /// <param name="actionType"></param>
        /// <param name="resourceCode"></param>
        /// <param name="userCode"></param>
        /// <param name="product"></param>
        /// <param name="datas1">工单</param>
        /// <param name="datas2">NULL</param>
        /// <returns></returns>
        public Messages  Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                DataCollectFacade  facade = new DataCollectFacade(this.DataProvider);
                ActionOnLineHelper helper = new ActionOnLineHelper(this.DataProvider);

                if (actionEventArgs.ProductInfo == null)
                {
                    // 获得LastSimulation
                    messages.AddMessages(helper.GetIDInfo(actionEventArgs.RunningCard));

                    if (messages.IsSuccess())
                    {
                        actionEventArgs.ProductInfo = (ProductInfo)messages.GetData().Values[0];
                    }
                }

                if (actionEventArgs.ProductInfo == null)
                {
                    throw new Exception("$NoProductInfo");
                }

                if (actionEventArgs.ProductInfo.LastSimulation == null)
                {
                    throw new Exception("$NoSimulationInfo");
                }

                if (messages.IsSuccess())
                {
                    facade.CheckMO(actionEventArgs.ProductInfo.LastSimulation.MOCode, actionEventArgs.ProductInfo);
                    facade.GetRouteOPOnline(actionEventArgs.RunningCard, actionEventArgs.ActionType, actionEventArgs.ResourceCode, actionEventArgs.UserCode, actionEventArgs.ProductInfo);

                    DBDateTime dbDateTime;

                    dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                    actionEventArgs.ProductInfo.NowSimulation.MaintainUser = actionEventArgs.UserCode;

                    actionEventArgs.ProductInfo.NowSimulation.MaintainDate = dbDateTime.DBDate;
                    actionEventArgs.ProductInfo.NowSimulation.MaintainTime = dbDateTime.DBTime;

                    // 填写NowSimulationReport
                    actionEventArgs.ProductInfo.NowSimulationReport = helper.FillSimulationReport(actionEventArgs.ProductInfo);

                    // 填写SoftwareVersion报表
                    this.WriteSoftwareInfo((SoftwareActionEventArgs)actionEventArgs, facade);
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Exemple #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);
        }
Exemple #3
0
        //Add by Icyer 2005/10/28
        //扩展一个带ActionCheckStatus参数的方法
        public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);

            try
            {
                DataCollectFacade  facade = new DataCollectFacade(this.DataProvider);
                ActionOnLineHelper helper = new ActionOnLineHelper(this.DataProvider);

                if (actionEventArgs.ProductInfo == null)
                {
                    actionEventArgs.ProductInfo = actionCheckStatus.ProductInfo;
                    if (actionEventArgs.ProductInfo == null)
                    {
                        // 获得LastSimulation
                        messages.AddMessages(helper.GetIDInfo(actionEventArgs.RunningCard));

                        if (messages.IsSuccess())
                        {
                            actionEventArgs.ProductInfo   = (ProductInfo)messages.GetData().Values[0];
                            actionCheckStatus.ProductInfo = (ProductInfo)messages.GetData().Values[0];
                        }
                    }
                }

                if (actionEventArgs.ProductInfo == null)
                {
                    throw new Exception("$NoProductInfo");
                }

                if (actionEventArgs.ProductInfo.LastSimulation == null)
                {
                    throw new Exception("$NoSimulationInfo");
                }

                if (messages.IsSuccess())
                {
                    //如果没有检查过工单
                    if (actionCheckStatus.CheckedMO == false)
                    {
                        facade.CheckMO(actionEventArgs.ProductInfo.LastSimulation.MOCode, actionEventArgs.ProductInfo);
                        actionCheckStatus.CheckedMO = true;
                    }
                    facade.GetRouteOPOnline(actionEventArgs.RunningCard, actionEventArgs.ActionType, actionEventArgs.ResourceCode, actionEventArgs.UserCode, actionEventArgs.ProductInfo, actionCheckStatus);

                    if (messages.IsSuccess())
                    {
                        actionEventArgs.ProductInfo.NowSimulation.MaintainUser = actionEventArgs.UserCode;

                        DBDateTime dbDateTime;
                        //Laws Lu,2006/11/13 uniform system collect date
                        if (actionEventArgs.ProductInfo.WorkDateTime != null)
                        {
                            dbDateTime = actionEventArgs.ProductInfo.WorkDateTime;
                        }
                        else
                        {
                            dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);
                            actionEventArgs.ProductInfo.WorkDateTime = dbDateTime;
                        }

                        actionEventArgs.ProductInfo.NowSimulation.MaintainDate = dbDateTime.DBDate;
                        actionEventArgs.ProductInfo.NowSimulation.MaintainTime = dbDateTime.DBTime;

                        actionEventArgs.ProductInfo.NowSimulationReport = helper.FillSimulationReport(actionEventArgs.ProductInfo);

                        //填写ECN\TRY报表
                        if (((EcnTryActionEventArgs)actionEventArgs).ECNNo != "")
                        {
                            this.WriteECNInfo((EcnTryActionEventArgs)actionEventArgs, facade, actionCheckStatus);
                        }

                        if (((EcnTryActionEventArgs)actionEventArgs).TryNo != "")
                        {
                            this.WriteTryInfo((EcnTryActionEventArgs)actionEventArgs, facade, actionCheckStatus);
                        }

                        //将Action加入列表
                        actionCheckStatus.ActionList.Add(actionEventArgs);
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }

            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }