Example #1
0
        /// <summary>
        /// 检查出TS是否允许,并填写部分SIMULATION
        /// </summary>
        /// <param name="iD"></param>
        /// <param name="actionType"></param>
        /// <param name="resourceCode"></param>
        /// <param name="userCode"></param>
        /// <param name="product"></param>
        /// <returns></returns>
//		public Messages CheckID(string iD,string actionType,string resourceCode,string userCode, ProductInfo product)
//		{
//			Messages messages=new Messages();
//			DataCollectDebug dataCollectDebug =new DataCollectDebug(this.GetType().ToString()+"CheckID");
//			dataCollectDebug.WhenFunctionIn(messages);
//			try
//			{
//				MOFacade moFacade=new MOFacade(this.DataProvider);
//				BaseModelFacade dataModel=new BaseModelFacade(this.DataProvider);
//				DataCollectFacade dataCollectFacade=new DataCollectFacade(this.DataProvider);
//				//IDataCollectModule dataCollect=new DataCollectOnLine();
//				ReworkFacade reworkFacade=new ReworkFacade(this.DataProvider);
//
//				#region 检查工单
//				MO mo=(MO)moFacade.GetMO(product.LastSimulation.MOCode);
//				//工单状态检查
//				if (!dataCollectFacade.CheckMO(mo))
//				{
//					throw new Exception("$MOStatus_Error"+mo.MOStatus);
//				}
//				#endregion
//				#region 检查ID状态
//				//根据TS中ID状态决定 TODO
//				Reject reject=(Reject)reworkFacade.GetReject(product.LastSimulation.RunningCard,
//					product.LastSimulation.RunningCardSequence);
//				if (reject==null)
//					throw new Exception("$CS_SystemError_LostRejectInfo $CS_Param_ID="+product.LastSimulation.RunningCard
//						+" $CS_Param_RunSeq="+product.LastSimulation.RunningCardSequence);
//				ItemRoute2OP op ;
//				if (reject.RejectStatus ==RejectStatus.UnReject)
//				{
//					//按正常走
//                    dataCollectDebug.DebugPoint(messages,"取消判退");
//					#region 检查途程
//					if ((actionType ==ActionType.DataCollectAction_OutLineGood )
//						||(actionType ==ActionType.DataCollectAction_OutLineNG )
//						)
//					{
//						dataCollectDebug.DebugPoint(messages,"线外站采集");
//						//线外站不需要检查Route,请自己填写SIMULATION信息
//						dataCollectDebug.WhenFunctionOut(messages);
//						return messages;
//					}
//					else
//					{
//						//当前站重复采集
//						if (dataModel.GetOperation2Resource(product.LastSimulation.OPCode,resourceCode)==null)
//						{
//							dataCollectDebug.DebugPoint(messages,"下一站采集");
//							op=dataCollectFacade.GetMORouteNextOP(product.LastSimulation.MOCode,product.LastSimulation.RouteCode,product.LastSimulation.OPCode);
//							if (op==null)
//								throw new Exception("$CS_Route_Failed_GetNotNextOP");
//							if (dataModel.GetOperation2Resource(op.OPCode,resourceCode)==null)
//							{
//								throw new Exception("$CS_Route_Failed $CS_Param_OPCode"+op.OPCode);
//							}
//						}
//						else
//						{
//							dataCollectDebug.DebugPoint(messages,"当前站重复采集");
//							//检查是否重复采集
//							dataCollectFacade.CheckRepeatCollect(product.LastSimulation.ActionList,actionType);
//							op=dataCollectFacade.GetMORouteOP(product.LastSimulation.ItemCode,product.LastSimulation.MOCode,
//								product.LastSimulation.RouteCode,product.LastSimulation.OPCode);
//						}
//					}
//					#endregion
//				}
//				else
//				if (reject.RejectStatus ==RejectStatus.Confirm)
//				{
//					ReworkSheet rework=(ReworkSheet) reworkFacade.GetReworkSheet( reject.ReworkCode );
//					if (rework.Status ==ReworkStatus.REWORKSTATUS_OPEN)
//					{
//						op=dataCollectFacade.GetMORouteFirstOP(product.LastSimulation.MOCode
//							,rework.NewRouteCode);
//					}
//					else
//					{
//						throw new Exception("$CS_IDisReject");
//					}
//				}
//				else
//				  throw new Exception("$CS_IDisReject");
//				#endregion
//				#region 检查ACTION
//				if (dataCollectFacade.CheckAction(product,op,actionType))
//				{
//				}
//				#endregion
//				#region 填写新SIMULATION
//				messages.AddMessages( dataCollectFacade.WriteSimulation(iD,actionType,resourceCode,userCode,product));
//				if (messages.IsSuccess())
//				{
//					//修改
//					product.NowSimulation.RouteCode =product.LastSimulation.RouteCode;
//					product.NowSimulation.OPCode =op.OPCode;
//					product.NowSimulation.ResourceCode=resourceCode;
//
//					product.NowSimulation.ActionList =";"+actionType+";";
//				}
//				#endregion
//			}
//			catch (Exception e)
//			{
//				messages.Add(new Message(e));
//			}
//			dataCollectDebug.WhenFunctionOut(messages);
//			return messages;
//		}
        public Messages CheckIDIn(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "CheckIDIn");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                messages.AddMessages(dataCollect.CheckID(actionEventArgs));
                if (messages.IsSuccess())
                {
                    dataCollectDebug.DebugPoint(messages, "推途程成功");
                    //补充SIMULATION 不良信息
                    actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.Reject;
                    actionEventArgs.ProductInfo.NowSimulation.NGTimes       = actionEventArgs.ProductInfo.NowSimulation.NGTimes + 1;
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #2
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);
        }
Example #3
0
        public Messages CheckIDIn(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "GetIDInfo");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                DataCollectFacade dataCollect = new DataCollectFacade(this.DataProvider);
                if (((PackActionEventArgs)actionEventArgs).IDDatas == null)
                {
                    throw new Exception("$CS_Sys_Pack_LostOPParam");
                }

                string LotCode = ((PackActionEventArgs)actionEventArgs).IDDatas[0].ToString();

                messages.AddMessages(dataCollect.CheckID(actionEventArgs.RunningCard, actionEventArgs.RunningCard, actionEventArgs.ResourceCode, actionEventArgs.UserCode, actionEventArgs.ProductInfo));
                //能否包装的其他检查  TODO

                //
                actionEventArgs.ProductInfo.NowSimulation.LOTNO       = LotCode;
                actionEventArgs.ProductInfo.NowSimulationReport.LOTNO = LotCode;
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #4
0
        public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(dataCollect.CheckID(actionEventArgs, actionCheckStatus));

                if (messages.IsSuccess())
                {
                    //Laws Lu,2005/08/15,新增	完工逻辑,在其他Check都通过的情况下,所有的RunningCard应该是GOOD状态
                    //暂时不考虑线外工序
                    DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                    if (actionEventArgs.ProductInfo.NowSimulation.RouteCode != "" && dataCollectFacade.OPIsMORouteLastOP(
                            actionEventArgs.ProductInfo.NowSimulation.MOCode
                            , actionEventArgs.ProductInfo.NowSimulation.RouteCode
                            , actionEventArgs.ProductInfo.NowSimulation.OPCode))
                    {
                        actionEventArgs.ProductInfo.NowSimulation.IsComplete  = "1";
                        actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = "GOOD";
                        //完工自动入库
                        dataCollectFacade.AutoInventory(actionEventArgs.ProductInfo.NowSimulation, actionEventArgs.UserCode);
                    }

                    actionEventArgs.ProductInfo.NowSimulation.ShelfNO = "";
                    //End Laws Lu
                    if (actionCheckStatus.NeedUpdateSimulation == true)
                    {
                        messages.AddMessages(dataCollect.Execute(actionEventArgs));
                    }
                    else
                    {
                        messages.AddMessages(dataCollect.Execute(actionEventArgs, actionCheckStatus));
                    }
                    if (messages.IsSuccess())
                    {
                        //填写测试报表 TODO
                        //if (actionCheckStatus.NeedFillReport == true)
                        //{
                        //    ReportHelper reportCollect= new ReportHelper(this.DataProvider);
                        //    messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo, actionCheckStatus));
                        //    messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo, actionCheckStatus));
                        //}

                        //将Action加入列表
                        actionCheckStatus.ActionList.Add(actionEventArgs);
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #5
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
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(this.CheckIDIn(actionEventArgs));
                if (messages.IsSuccess())
                {
                    //
                    messages.AddMessages(dataCollect.Execute(actionEventArgs));
                    if (messages.IsSuccess())
                    {
                        //填写包装报表 TODO
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #6
0
        // Added by Icyer 2006/11/08
        /// <summary>
        /// 做Undo
        /// </summary>
        public Messages  UndoExecute(SplitIDActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                if (((SplitIDActionEventArgs)actionEventArgs).SplitedIDs == null || ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length == 0)
                {
                    throw new Exception("$CS_System_Params_Losted");
                }

                DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                object[]          oldSimulation     = dataCollectFacade.GetSimulationFromTCard(actionEventArgs.RunningCard);
                if (oldSimulation == null || oldSimulation.Length == 0)
                {
                    throw new Exception("$CS_System_Params_Losted");
                }
                if (oldSimulation.Length != actionEventArgs.SplitedIDs.Length)
                {
                    throw new Exception("$CS_System_Params_Losted");
                }

                ActionOnLineHelper  helper     = new ActionOnLineHelper(this.DataProvider);
                MORunningCardFacade cardFacade = new MORunningCardFacade(this.DataProvider);
                // 依次操作每个序列号更改
                for (int i = 0; i < actionEventArgs.SplitedIDs.Length; i++)
                {
                    // 更新Simulation
                    Simulation s           = (Simulation)oldSimulation[i];
                    string     oldRCard    = s.RunningCard;
                    decimal    oldRCardSeq = s.RunningCardSequence;
                    string     strNewRCard = actionEventArgs.SplitedIDs[i].ToString();
                    string     strSql      = "UPDATE tblSimulation SET RCard='" + strNewRCard + "' WHERE RCard='" + oldRCard + "' AND RCardSeq=" + oldRCardSeq.ToString();
                    this.DataProvider.CustomExecute(new SQLCondition(strSql));
                    // 更新SimulationReport
                    strSql = "UPDATE tblSimulationReport SET RCard='" + strNewRCard + "' WHERE RCard='" + oldRCard + "' AND RCardSeq=" + oldRCardSeq.ToString();
                    this.DataProvider.CustomExecute(new SQLCondition(strSql));
                    // 更新OnWIP
                    strSql = "UPDATE tblOnWIP SET RCard='" + strNewRCard + "' WHERE RCard='" + oldRCard + "' AND RCardSeq=" + oldRCardSeq.ToString();
                    this.DataProvider.CustomExecute(new SQLCondition(strSql));
                    // 更新OnWIPTrans
                    strSql = "UPDATE tblOnWIPCardTrans SET RCard='" + strNewRCard + "' WHERE RCard='" + oldRCard + "' AND RCardSeq=" + oldRCardSeq.ToString();
                    this.DataProvider.CustomExecute(new SQLCondition(strSql));
                    // 更新MOCard
                    strSql = "UPDATE tblmorcard SET MORCardStart='" + strNewRCard + "',MORCardEnd='" + strNewRCard + "' WHERE MORCardStart='" + oldRCard + "' AND MOCode='" + s.MOCode + "' ";
                    this.DataProvider.CustomExecute(new SQLCondition(strSql));
                    // 报表不用更新
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #7
0
        //Laws Lu,2006/01/04,此方法已经放弃使用
        public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(dataCollect.CheckID(actionEventArgs));
                if (messages.IsSuccess())
                {
                    messages.AddMessages(dataCollect.Execute(actionEventArgs));
                    if (messages.IsSuccess())
                    {
                        //填写测试报表
                        //ReportHelper reportCollect = new ReportHelper(this.DataProvider);
                        //messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo));
                        //messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo));

                        //Laws Lu,2005/10/20,新增	使用配置文件来控制物料模块是否使用
                        if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                        {
                            BenQGuru.eMES.Material.CastDownHelper castHelper = new BenQGuru.eMES.Material.CastDownHelper(DataProvider);
                            ArrayList arRcard = new ArrayList();


                            castHelper.GetAllRCardByMo(ref arRcard, actionEventArgs.ProductInfo.NowSimulation.RunningCard, actionEventArgs.ProductInfo.NowSimulation.MOCode);
                            if (arRcard.Count == 0)
                            {
                                arRcard.Add(actionEventArgs.RunningCard);
                            }
                            string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')";

                            object[] objs = (actionEventArgs as DropMaterialEventArgs).OnwipItems;
                            //下料并归还库房
                            BenQGuru.eMES.Material.WarehouseFacade wfacade = new BenQGuru.eMES.Material.WarehouseFacade(this.DataProvider);
                            wfacade.RemoveWarehouse(
                                objs
                                , runningCards
                                , actionEventArgs.ProductInfo.NowSimulation.MOCode
                                , actionEventArgs.UserCode
                                , actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode
                                , actionEventArgs.ProductInfo.NowSimulation.OPCode);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #8
0
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            Messages msgAutoGoMO = new Messages();              // Added by Icyer 2007/03/09

            try
            {
                // Added by Icyer 2007/03/09
                // 检测自动归属工单
                ActionGoToMO actionGoToMO = new ActionGoToMO(this.DataProvider);
                msgAutoGoMO = actionGoToMO.AutoGoMO(actionEventArgs);
                // Added end

                // Added end
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(dataCollect.CheckID(actionEventArgs));
                if (messages.IsSuccess())
                {
                    messages.AddMessages(dataCollect.Execute(actionEventArgs));
                    if (messages.IsSuccess())
                    {
                        //// 自动产生送检批
                        //messages.AddMessages(this.GenerateLot(actionEventArgs));
                        //if (messages.IsSuccess())
                        //{
                        //    //填写测试报表 TODO
                        //    ReportHelper reportCollect = new ReportHelper(this.DataProvider);
                        //    messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo));
                        //    messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo));
                        //}
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            //return messages;
            if (msgAutoGoMO.Count() < 1 || (msgAutoGoMO.IsSuccess() == true && messages.IsSuccess() == false))
            {
                return(messages);
            }
            else
            {
                msgAutoGoMO.IgnoreError();
                msgAutoGoMO.AddMessages(messages);
                return(msgAutoGoMO);
            }
        }
Example #9
0
/// <summary>
///
/// </summary>
/// <param name="iD"></param>
/// <param name="actionType"></param>
/// <param name="resourceCode"></param>
/// <param name="userCode"></param>
/// <param name="product"></param>
/// <returns></returns>
        public Messages CheckID(string iD, string actionType, string resourceCode, string userCode, ProductInfo product)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "CheckID");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                //Laws Lu,2005/09/06,新增
                DataCollectFacade dataCollect = new DataCollectFacade(this._domainDataProvider);
                messages.AddMessages(dataCollect.CheckID(iD, actionType, resourceCode, userCode, product));
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actionEventArgs"> </param> params (0,lotno)
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                ActionOQCHelper    oqcHelper   = new ActionOQCHelper(this.DataProvider);

                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(dataCollect.CheckID(actionEventArgs));
                if (messages.IsSuccess())
                {
                    //
                    if (actionEventArgs.ProductInfo.NowSimulation == null)
                    {
                        throw new Exception("$System_Error");
                    }
                    //check oqclotstatus
                    if (oqcHelper.IsOQCLotComplete(actionEventArgs.Params[0].ToString()))
                    {
                        throw new Exception("$Error_OQCLotNOHasComplete");
                    }
                    //检查在批中检查的产品的最后一笔信息全部为Good

                    messages.AddMessages(dataCollect.Execute(actionEventArgs));
                    if (messages.IsSuccess())
                    {
                        //修改批状态
                        //批退修改每个板子的最后一笔状态为reject
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #11
0
        public Messages UndoExecute(ConvertCardActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                if (((ConvertCardActionEventArgs)actionEventArgs).ConvertToCard.Length < 0)
                {
                    throw new Exception("$CS_System_Params_Losted");
                }

                DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                object[]          oldSimulation     = dataCollectFacade.GetSimulationFromTCard(actionEventArgs.RunningCard);
                if (oldSimulation == null || oldSimulation.Length == 0)
                {
                    throw new Exception("$CS_System_Params_Losted");
                }

                ActionOnLineHelper  helper     = new ActionOnLineHelper(this.DataProvider);
                MORunningCardFacade cardFacade = new MORunningCardFacade(this.DataProvider);

                // 更新Simulation
                Simulation s           = (Simulation)oldSimulation[0];
                string     oldRCard    = s.TranslateCard;
                decimal    oldRCardSeq = s.RunningCardSequence;
                string     strNewRCard = actionEventArgs.ConvertToCard.ToString();
                string     strSql      = "";

                // 更新OnWIPTrans
                strSql = "UPDATE tblOnWIPCardTrans SET RCard='" + strNewRCard + "' WHERE TCard='" + oldRCard + "'";
                this.DataProvider.CustomExecute(new SQLCondition(strSql));
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #12
0
        // Added end

        //扩展一个带ActionCheckStatus和OPBOMDetail参数的方法
        public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus, object[] OPBOMDetail)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            Messages msgAutoGoMO = new Messages();              // Added by Icyer 2007/03/09

            try
            {
                // Added by Icyer 2007/03/09
                // 检测自动归属工单
                ActionGoToMO actionGoToMO = new ActionGoToMO(this.DataProvider);
                msgAutoGoMO = actionGoToMO.AutoGoMO(actionEventArgs, actionCheckStatus);
                // Added end

                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(dataCollect.CheckID(actionEventArgs, actionCheckStatus));

                if (messages.IsSuccess())
                {
                    //上料检查  分INNO、KEYPARTS TODO
                    //if (actionEventArgs.ActionType ==ActionType.DataCollectAction_CollectINNO)


                    if (actionCheckStatus.NeedUpdateSimulation == true)
                    {
                        messages.AddMessages(dataCollect.Execute(actionEventArgs));
                    }
                    else
                    {
                        messages.AddMessages(dataCollect.Execute(actionEventArgs, actionCheckStatus));
                    }

                    BenQGuru.eMES.Material.WarehouseFacade wfacade = null;
                    if (messages.IsSuccess())
                    {
                        DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                        #region 填写上料信息表  分INNO、KEYPARTS
                        if (actionEventArgs.ActionType == ActionType.DataCollectAction_CollectINNO)
                        {
                            if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                            {
                                wfacade = ((CINNOActionEventArgs)actionEventArgs).Warehouse;
                            }

                            messages.AddMessages(InsertLotOnWipItem(actionEventArgs, dataCollectFacade, OPBOMDetail));
                            if (!messages.IsSuccess())
                            {
                                return(messages);
                            }
                        }

                        #endregion
                    }
                    // Added by Icyer 2005/08/16
                    // 上料扣库存
                    // 暂时屏蔽 FOR 夏新P3版本 MARK LEE 2005/08/22
                    // 取消屏蔽 Icyer 2005/08/23
                    //Laws Lu,2005/10/20,新增	使用配置文件来控制物料模块是否使用
                    if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                    {
                        //BenQGuru.eMES.Material.WarehouseFacade wfacade = new WarehouseFacade(this.DataProvider);
                        if (wfacade != null)
                        {
                            wfacade.CollectMaterialStock(actionEventArgs.ProductInfo.NowSimulation.LotCode, actionEventArgs.ProductInfo.NowSimulation.LotSeq.ToString(), actionEventArgs.ProductInfo.NowSimulation.MOCode);
                        }
                    }
                    // Added end


                    //将Action加入列表
                    actionCheckStatus.ActionList.Add(actionEventArgs);
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            //return messages;
            if (msgAutoGoMO.Count() < 1 || (msgAutoGoMO.IsSuccess() == true && messages.IsSuccess() == false))
            {
                return(messages);
            }
            else
            {
                msgAutoGoMO.IgnoreError();
                msgAutoGoMO.AddMessages(messages);
                return(msgAutoGoMO);
            }
        }
Example #13
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">转换后的ID组</param>
        /// <param name="datas2">NULL</param>
        /// <returns></returns>
        public Messages  Execute(ActionEventArgs actionEventArgs)
        {
            // Added by Icyer 2006/10/08
            if (((SplitIDActionEventArgs)actionEventArgs).IsUndo == true)
            {
                return(this.UndoExecute((SplitIDActionEventArgs)actionEventArgs));
            }
            // Added end

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

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                if (((SplitIDActionEventArgs)actionEventArgs).SplitedIDs == null || ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length == 0)
                {
                    throw new Exception("$CS_System_Params_Losted");
                }

                ActionOnLineHelper helper = new ActionOnLineHelper(this.DataProvider);

                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(helper.CheckID(actionEventArgs));
                if (messages.IsSuccess())
                {
                    //
                    actionEventArgs.ProductInfo.NowSimulation.IDMergeRule           = 1;           //actionEventArgs.ProductInfo.NowSimulation.IDMergeRule/((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length;
                    actionEventArgs.ProductInfo.NowSimulation.TranslateCard         = actionEventArgs.ProductInfo.LastSimulation.RunningCard;
                    actionEventArgs.ProductInfo.NowSimulation.TranslateCardSequence = actionEventArgs.ProductInfo.LastSimulation.RunningCardSequence;
                    actionEventArgs.ProductInfo.NowSimulation.NGTimes = actionEventArgs.ProductInfo.LastSimulation.NGTimes;

                    DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);

                    for (int i = 0; i < ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length; i++)
                    {
                        //修改SIMULATION
                        //Laws Lu,2005/08/15,新增	完工逻辑,在其他Check都通过的情况下,所有的RunningCard应该是GOOD状态
                        //暂时不考虑线外工序
                        if (actionEventArgs.ProductInfo.NowSimulation.RouteCode != "" && dataCollectFacade.OPIsMORouteLastOP(
                                actionEventArgs.ProductInfo.NowSimulation.MOCode
                                , actionEventArgs.ProductInfo.NowSimulation.RouteCode
                                , actionEventArgs.ProductInfo.NowSimulation.OPCode))
                        {
                            actionEventArgs.ProductInfo.NowSimulation.IsComplete  = "1";
                            actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = "GOOD";
                        }
                        //End Laws Lu
                        actionEventArgs.ProductInfo.NowSimulation.RunningCard = ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs[i].ToString();
                        /* added by jessie lee,如果是 序列号转换 */
                        if (string.Compare((actionEventArgs as SplitIDActionEventArgs).IDMergeType, IDMergeType.IDMERGETYPE_IDMERGE, true) == 0)
                        {
                            /* 转换到同一张工单 */
                            if ((actionEventArgs as SplitIDActionEventArgs).UpdateSimulation)
                            {
                                actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence
                                    = (actionEventArgs as SplitIDActionEventArgs).ExistIMEISeq + 10;
                            }
                            else
                            {
                                actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence = ActionOnLineHelper.StartSeq;
                            }
                        }
                        else
                        {
                            /* 不是 序列号转换 */
                            actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence = ActionOnLineHelper.StartSeq;
                        }
                        actionEventArgs.ProductInfo.NowSimulation.MOSeq = actionEventArgs.ProductInfo.LastSimulation.MOSeq;     // Added by Icyer 2007/07/03

                        messages.AddMessages(helper.Execute(actionEventArgs));

                        if (messages.IsSuccess())
                        {
                            //填写ID转换报表
                            OnWIPCardTransfer transf = dataCollectFacade.CreateNewOnWIPCardTransfer();

                            transf.RunningCard           = ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs[i].ToString().Trim().ToUpper();
                            transf.RunningCardSequence   = actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence;
                            transf.IDMergeType           = ((SplitIDActionEventArgs)actionEventArgs).IDMergeType;
                            transf.TranslateCard         = actionEventArgs.ProductInfo.LastSimulation.RunningCard;
                            transf.TranslateCardSequence = actionEventArgs.ProductInfo.LastSimulation.RunningCardSequence;
                            transf.SourceCard            = actionEventArgs.ProductInfo.NowSimulation.SourceCard;
                            transf.ModelCode             = actionEventArgs.ProductInfo.NowSimulation.ModelCode;
                            transf.MOCode             = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                            transf.ItemCode           = actionEventArgs.ProductInfo.NowSimulation.ItemCode;
                            transf.ResourceCode       = actionEventArgs.ResourceCode;
                            transf.OPCode             = actionEventArgs.ProductInfo.NowSimulation.OPCode;
                            transf.SourceCardSequence = actionEventArgs.ProductInfo.NowSimulation.SourceCardSequence;
                            transf.RouteCode          = actionEventArgs.ProductInfo.NowSimulation.RouteCode;
                            transf.StepSequenceCode   = actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode;
                            transf.SegmnetCode        = actionEventArgs.ProductInfo.NowSimulationReport.SegmentCode;
                            transf.TimePeriodCode     = actionEventArgs.ProductInfo.NowSimulationReport.TimePeriodCode;
                            transf.ShiftCode          = actionEventArgs.ProductInfo.NowSimulationReport.ShiftCode;
                            transf.ShiftTypeCode      = actionEventArgs.ProductInfo.NowSimulationReport.ShiftTypeCode;
                            transf.MaintainUser       = actionEventArgs.UserCode;
                            transf.MOSeq = actionEventArgs.ProductInfo.NowSimulationReport.MOSeq;

                            dataCollectFacade.AddOnWIPCardTransfer(transf);

                            // 将ID添加到MO范围表内
                            MORunningCardFacade cardFacade = new MORunningCardFacade(this.DataProvider);
                            MORunningCard       card       = cardFacade.CreateNewMORunningCard();

                            card.MOCode             = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                            card.MORunningCardStart = ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs[i].ToString().Trim().ToUpper();
                            card.MORunningCardEnd   = card.MORunningCardStart;
                            card.MaintainUser       = actionEventArgs.UserCode;
                            card.MOSeq = actionEventArgs.ProductInfo.NowSimulation.MOSeq;

                            cardFacade.AddMORunningCard(card);
                            //AMOI  MARK  START  20050806 增加按资源统计产量和完工统计
                            #region 填写统计报表 按资源统计
                            // Added by Icyer 2006/06/05
                            //if (actionEventArgs.NeedUpdateReport == true)
                            //{
                            //    ReportHelper reportCollect= new ReportHelper(this.DataProvider);
                            //    messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,
                            //        actionEventArgs.ActionType,actionEventArgs.ProductInfo));
                            //    messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider
                            //        ,actionEventArgs.ActionType,actionEventArgs.ProductInfo));
                            //}
                            #endregion
                            //AMOI  MARK  END
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #14
0
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            Messages msgAutoGoMO = new Messages();              // Added by Icyer 2007/03/09

            try
            {
                // Added by Icyer 2007/03/09
                // 检测自动归属工单
                ActionGoToMO actionGoToMO = new ActionGoToMO(this.DataProvider);
                msgAutoGoMO = actionGoToMO.AutoGoMO(actionEventArgs);
                // Added end

                // Added by Icyer 2006/12/03
                // 自动做Undo
                messages.AddMessages((new ActionUndoNG(this.DataProvider)).UndoNG(actionEventArgs));
                // Added end
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(dataCollect.CheckID(actionEventArgs));
                if (messages.IsSuccess())
                {
                    //Laws Lu,2005/08/15,新增	完工逻辑,在其他Check都通过的情况下,所有的RunningCard应该是GOOD状态
                    //暂时不考虑线外工序
                    DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                    if (actionEventArgs.ProductInfo.NowSimulation.RouteCode != "" && dataCollectFacade.OPIsMORouteLastOP(
                            actionEventArgs.ProductInfo.NowSimulation.MOCode
                            , actionEventArgs.ProductInfo.NowSimulation.RouteCode
                            , actionEventArgs.ProductInfo.NowSimulation.OPCode))
                    {
                        actionEventArgs.ProductInfo.NowSimulation.IsComplete  = "1";
                        actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = "GOOD";
                        //完工自动入库
                        dataCollectFacade.AutoInventory(actionEventArgs.ProductInfo.NowSimulation, actionEventArgs.UserCode);
                    }
                    //End Laws Lu
                    messages.AddMessages(dataCollect.Execute(actionEventArgs));
                    if (messages.IsSuccess())
                    {
                        // 自动产生送检批
                        messages.AddMessages(this.GenerateLot(actionEventArgs));
                        //if (messages.IsSuccess())
                        //{
                        //    //填写测试报表 TODO
                        //    ReportHelper reportCollect = new ReportHelper(this.DataProvider);
                        //    messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo));
                        //    messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo));
                        //}
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            //return messages;
            if (msgAutoGoMO.Count() < 1 || (msgAutoGoMO.IsSuccess() == true && messages.IsSuccess() == false))
            {
                return(messages);
            }
            else
            {
                msgAutoGoMO.IgnoreError();
                msgAutoGoMO.AddMessages(messages);
                return(msgAutoGoMO);
            }
        }
Example #15
0
        public Messages GenerateLot(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);

            try
            {
                string itemCode = actionEventArgs.ProductInfo.NowSimulation.ItemCode;
                string rCard    = actionEventArgs.ProductInfo.NowSimulation.RunningCard;
                string moCode   = actionEventArgs.ProductInfo.NowSimulation.MOCode;

                ItemFacade      itemFacade      = new ItemFacade(this.DataProvider);
                BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider);
                OQCFacade       oqcFacade       = new OQCFacade(this.DataProvider);

                object item = itemFacade.GetItem(itemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID);
                if (item == null)
                {
                    messages.Add(new Message(MessageType.Error, "$Error_ItemCode_NotExist $Domain_ItemCode=" + itemCode));
                    return(messages);
                }
                //if (((Item)item).CheckItemOP == null || ((Item)item).CheckItemOP.Trim().Length == 0)
                //{
                //    messages.Add(new Message(MessageType.Error, "$Error_NoItemGenerateLotOPCode $Domain_ItemCode=" + itemCode));
                //    return messages;
                //}

                DBDateTime currentDBDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                OQCLot     lot;

                // Resource auto generate lotno for ReworkSheet
                Resource res = actionEventArgs.ProductInfo.Resource;
                if (res == null)
                {
                    res = (Resource)baseModelFacade.GetResource(actionEventArgs.ResourceCode);
                    actionEventArgs.ProductInfo.Resource = res;
                }

                ReworkFacade reworkFacade = new ReworkFacade(this.DataProvider);
                ReworkRange  reworkRange  = null;
                OQCLot       currentLot   = (OQCLot)oqcFacade.GetLatestOQCLot(actionEventArgs.RunningCard);
                if (currentLot != null && currentLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject)
                {
                    reworkRange = (ReworkRange)reworkFacade.GetLatestReworkRange(actionEventArgs.RunningCard);
                }

                //产生新批的情况有两种
                //情况一:返工Res(Res.ReworkRouteCode不为空),RCard有当前的返工需求单,且此返工需求单要求自动产生新批(ReworkSheet.AutoLot等于Y)
                //情况二:其他情况,当前工序为Item的产生批工序(当前工序等于Item.CheckItemOP)
                //
                if (res != null && res.ReworkRouteCode != null && res.ReworkRouteCode.Trim().Length > 0 &&
                    reworkRange != null && reworkRange.ReworkCode != null && reworkRange.ReworkCode.Trim().Length > 0)
                {
                    object      reworkSheet = reworkFacade.GetReworkSheet(reworkRange.ReworkCode);
                    ReworkSheet rs          = reworkSheet as ReworkSheet;

                    if (rs.AutoLot != null && string.Compare(rs.AutoLot, "Y", true) == 0 &&
                        rs.LotList != null && rs.LotList.Trim().Length > 0)
                    {
                        //Get rework lot by oldlotno (reworkcode=oldlotno=lotlist)
                        object rLot = oqcFacade.GetOQCLotByOldLotNo(rs.LotList);
                        if (rLot == null)
                        {
                            lot = this.CreateNewLot(actionEventArgs, (Item)item, currentDBDateTime, true, rs.LotList);
                        }
                        else
                        {
                            lot = rLot as OQCLot;
                        }
                    }
                    else
                    {
                        return(messages);
                    }
                }
                else
                {
                    if (string.Compare(((Item)item).CheckItemOP, actionEventArgs.ProductInfo.NowSimulation.OPCode, true) != 0)
                    {
                        return(messages);
                    }

                    // GetLot2Card By RCard+LotStatus
                    if (oqcFacade.IsCardUsedByAnyLot(rCard, moCode, itemCode))
                    {
                        return(messages);
                    }
                    else
                    {
                        lot = this.CreateNewLot(actionEventArgs, (Item)item, currentDBDateTime, false, "");
                    }
                }

                object oldLot2Card = oqcFacade.GetOQCLot2Card(actionEventArgs.ProductInfo.NowSimulation.RunningCard,
                                                              actionEventArgs.ProductInfo.NowSimulation.MOCode, lot.LOTNO, lot.LotSequence);
                if (oldLot2Card != null)
                {
                    //messages.Add(new Message(MessageType.Error, "$Error_IDHasExistedInOtherOQCLotNO $CS_LotNo=" + lot.LOTNO));
                    return(messages);
                }

                actionEventArgs.ProductInfo.NowSimulation.LOTNO       = lot.LOTNO;
                actionEventArgs.ProductInfo.NowSimulationReport.LOTNO = lot.LOTNO;
                DataCollectFacade dataCollect = new DataCollectFacade(this.DataProvider);
                dataCollect.UpdateSimulation(actionEventArgs.ProductInfo.NowSimulation);
                dataCollect.UpdateSimulationReport(actionEventArgs.ProductInfo.NowSimulationReport);

                OQCLot2Card oqcLot2Card = oqcFacade.CreateNewOQCLot2Card();
                oqcLot2Card.ItemCode            = actionEventArgs.ProductInfo.NowSimulation.ItemCode;
                oqcLot2Card.CollectType         = "pcs";
                oqcLot2Card.LOTNO               = lot.LOTNO;
                oqcLot2Card.LotSequence         = OQCFacade.Lot_Sequence_Default;
                oqcLot2Card.MaintainUser        = actionEventArgs.UserCode;
                oqcLot2Card.MaintainDate        = currentDBDateTime.DBDate;
                oqcLot2Card.MaintainTime        = currentDBDateTime.DBTime;
                oqcLot2Card.MOCode              = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                oqcLot2Card.ModelCode           = actionEventArgs.ProductInfo.NowSimulation.ModelCode;
                oqcLot2Card.OPCode              = actionEventArgs.ProductInfo.NowSimulation.OPCode;
                oqcLot2Card.ResourceCode        = actionEventArgs.ProductInfo.NowSimulation.ResourceCode;
                oqcLot2Card.RouteCode           = actionEventArgs.ProductInfo.NowSimulation.RouteCode;
                oqcLot2Card.RunningCard         = actionEventArgs.ProductInfo.NowSimulation.RunningCard;
                oqcLot2Card.RunningCardSequence = actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence;
                oqcLot2Card.SegmnetCode         = actionEventArgs.ProductInfo.NowSimulationReport.SegmentCode;
                oqcLot2Card.ShiftCode           = actionEventArgs.ProductInfo.NowSimulationReport.ShiftCode;
                oqcLot2Card.ShiftTypeCode       = actionEventArgs.ProductInfo.NowSimulationReport.ShiftTypeCode;
                oqcLot2Card.Status              = actionEventArgs.ProductInfo.NowSimulationReport.Status;
                oqcLot2Card.StepSequenceCode    = actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode;
                oqcLot2Card.TimePeriodCode      = actionEventArgs.ProductInfo.NowSimulationReport.TimePeriodCode;
                //oqcLot2Card.EAttribute1 = actionEventArgs.ProductInfo.NowSimulation.CartonCode;
                oqcLot2Card.EAttribute1 = ""; //现在这里只能是空,后面Carton包装时候会更新为CartonCode
                oqcLot2Card.MOSeq       = actionEventArgs.ProductInfo.NowSimulation.MOSeq;

                oqcFacade.AddOQCLot2Card(oqcLot2Card);

                // Added By Hi1/Venus.Feng on 20081027 for Hisense Version : Add Frozen by lot logic
                if (lot.FrozenStatus == FrozenStatus.STATUS_FRONZEN)
                {
                    Frozen frozen = new Frozen();
                    frozen.RCard        = actionEventArgs.ProductInfo.NowSimulation.RunningCard;
                    frozen.EAttribute1  = "";
                    frozen.FrozenBy     = lot.FrozenBy;
                    frozen.FrozenDate   = lot.FrozenDate;
                    frozen.FrozenReason = lot.FrozenReason;

                    int      seq            = 0;
                    object[] oldFrozenRCard = oqcFacade.QueryFrozen(frozen.RCard, frozen.RCard,
                                                                    string.Empty, string.Empty, string.Empty, string.Empty,
                                                                    -1, -1, -1, -1, int.MinValue, int.MaxValue);

                    if (oldFrozenRCard != null)
                    {
                        foreach (Frozen f in oldFrozenRCard)
                        {
                            seq = Math.Max(seq, f.FrozenSequence);
                        }
                    }

                    frozen.FrozenSequence = seq + 1;
                    frozen.FrozenStatus   = FrozenStatus.STATUS_FRONZEN;
                    frozen.FrozenTime     = lot.FrozenTime;
                    frozen.ItemCode       = actionEventArgs.ProductInfo.NowSimulation.ItemCode;
                    frozen.LotNo          = lot.LOTNO;
                    frozen.LotSequence    = Convert.ToInt32(lot.LotSequence);
                    frozen.MaintainDate   = currentDBDateTime.DBDate;
                    frozen.MaintainTime   = currentDBDateTime.DBTime;
                    frozen.MaintainUser   = actionEventArgs.UserCode;
                    frozen.MOCode         = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                    frozen.ModelCode      = actionEventArgs.ProductInfo.NowSimulation.ModelCode;
                    frozen.UnfrozenBy     = "";
                    frozen.UnfrozenDate   = 0;
                    frozen.UnfrozenReason = "";
                    frozen.UnfrozenTime   = 0;

                    oqcFacade.AddFrozen(frozen);
                }
                // End Added

                //Update tbloqclot.lotsize++
                lot.LotSize = 1;
                oqcFacade.UpdateOQCLotSize(lot);
            }
            catch (Exception ex)
            {
                messages.Add(new Message(ex));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #16
0
        public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                if (((OutLineActionEventArgs)actionEventArgs).OPCode == string.Empty)
                {
                    throw new Exception("$CS_Sys_OutLine_LostOPParam");
                }

                string opCode = ((OutLineActionEventArgs)actionEventArgs).OPCode;
                //检查ErrorCode,ErrorGroup是否正确 TODO
                //如果CS能确保ErrorCode,ErrorGroup是正确的,此处逻辑可以去掉
                if (actionEventArgs.ActionType == ActionType.DataCollectAction_OutLineNG)
                {
                }
                messages.AddMessages(this.CheckIDIn(actionEventArgs));
                if (messages.IsSuccess())
                {
                    ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                    //补充SIMULATION 不良信息
                    if (actionEventArgs.ActionType == ActionType.DataCollectAction_OutLineNG)
                    {
                        actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.NG;
                        actionEventArgs.ProductInfo.NowSimulation.NGTimes       = actionEventArgs.ProductInfo.NowSimulation.NGTimes + 1;
                    }

                    if (actionEventArgs.ActionType == ActionType.DataCollectAction_OutLineGood)
                    {
                        actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.GOOD;
                        //Laws Lu,2005/08/15,新增	完工逻辑,在其他Check都通过的情况下,所有的RunningCard应该是GOOD状态
                        //暂时不考虑线外工序
                        //						DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                        //						if (actionEventArgs.ProductInfo.NowSimulation.RouteCode == "" && dataCollectFacade.OPIsMORouteLastOP(
                        //							actionEventArgs.ProductInfo.NowSimulation.MOCode
                        //							,actionEventArgs.ProductInfo.NowSimulation.FromRoute
                        //							,actionEventArgs.ProductInfo.NowSimulation.FromOP))
                        //						{
                        //							actionEventArgs.ProductInfo.NowSimulation.IsComplete = "1";
                        //							actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = "GOOD";
                        //						}
                        //End Laws Lu
                    }
                    if (actionCheckStatus.NeedUpdateSimulation == true)
                    {
                        messages.AddMessages(dataCollect.Execute(actionEventArgs));
                    }
                    else
                    {
                        messages.AddMessages(dataCollect.Execute(actionEventArgs, actionCheckStatus));
                    }
                    if (messages.IsSuccess())
                    {
                        if (actionCheckStatus.NeedFillReport == true)
                        {
                            //							//填写测试报表 TODO
                            //ReportHelper reportCollect= new ReportHelper(this.DataProvider);
                            //messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo));
                            //messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo));

                            if (actionEventArgs.ActionType == ActionType.DataCollectAction_OutLineNG)
                            {
                                messages.AddMessages(dataCollect.CollectErrorInformation(this.DataProvider, actionEventArgs.ActionType,
                                                                                         actionEventArgs.ProductInfo,
                                                                                         ((OutLineActionEventArgs)actionEventArgs).ErrorCodes, null,
                                                                                         ((OutLineActionEventArgs)actionEventArgs).Memo));

                                //messages.AddMessages(reportCollect.ReportLineECOQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo,((OutLineActionEventArgs)actionEventArgs).ErrorCodes));
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #17
0
        /// <summary>
        /// 维修完成
        /// </summary>
        /// <param name="actionEventArgs"></param>
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //检查res在不在OPTS中
                // Modified By Hi1/Venus.Feng on 20080711 for Hisense Version : 对于自动作Reflow的动作来讲,不再Check Resource是否在回流的工序中
                if (((TSActionEventArgs)actionEventArgs).IgnoreResourceInOPTS != true)
                {
                    messages.AddMessages(dataCollect.CheckResourceInOperationTS(actionEventArgs));
                }
                // End Modified

                if (messages.IsSuccess())
                {
                    TSFacade tsFacade = new TSFacade(this.DataProvider);
                    //					if( !tsFacade.IsCardInTS(actionEventArgs.RunningCard))
                    //					{
                    //						messages.Add(new Message(MessageType.Error,"$CSError_Card_Not_In_TS"));
                    //					}
                    //					if(messages.IsSuccess())
                    //					{

                    //Laws Lu,2005/09/16,修改	逻辑调整P4.8
                    object obj = tsFacade.GetCardLastTSRecord(actionEventArgs.RunningCard);



                    if (obj == null)
                    {
                        messages.Add(new Message(MessageType.Error, "$CSError_Card_Not_In_TS"));
                        //messages.Add(new Message(MessageType.Error,"$CSError_Card_TSStatus_IsNot_TS"));
                    }
                    else
                    {
                        Domain.TS.TS ts = (Domain.TS.TS)obj;



                        if (ts.TSStatus == TSStatus.TSStatus_Scrap ||
                            ts.TSStatus == TSStatus.TSStatus_Split ||
                            ts.TSStatus == TSStatus.TSStatus_Reflow ||
                            ts.TSStatus == TSStatus.TSStatus_Confirm)
                        {
                            messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus));
                        }


                        if (messages.IsSuccess())
                        {
                            //2006/11/17,Laws Lu add get DateTime from db Server
                            DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                            DateTime dtNow = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime);

                            //修改 Karron Qiu,2005-9-26
                            if (ts.FromInputType == TS.TSFacade.TSSource_OnWIP)//线上.必须是回流或者报废
                            {
                                if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Complete)
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Please_Select_Reflow_OR_Scrap"));//请选择回流或者报废
                                }
                            }
                            else if (ts.FromInputType == TS.TSFacade.TSSource_TS)//离线. 不能回流
                            {
                                if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Reflow)
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Offline_Cannot_Reflow"));//离线不能回流
                                }
                            }
                            else if (ts.FromInputType == TS.TSFacade.TSSource_RMA)//RMA. 不能回流
                            {
                                if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Reflow)
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_RMATS_Cannot_Reflow"));//RMA不能回流
                                }
                            }



                            //Laws Lu,2005/11/09,新增	记录ShiftDay
                            BaseSetting.BaseModelFacade dataModel = new BaseSetting.BaseModelFacade(this.DataProvider);
                            Domain.BaseSetting.Resource res       = (Domain.BaseSetting.Resource)dataModel.GetResource(actionEventArgs.ResourceCode);
                            //onwip.SegmentCode				= productInfo.NowSimulationReport.SegmentCode;

                            BaseSetting.ShiftModelFacade  shiftModel = new BaseSetting.ShiftModelFacade(this.DataProvider);
                            Domain.BaseSetting.TimePeriod period     = (Domain.BaseSetting.TimePeriod)shiftModel.GetTimePeriod(res.ShiftTypeCode, Web.Helper.FormatHelper.TOTimeInt(dtNow));

                            int shiftDay = 0;
                            if (period == null)
                            {
                                throw new Exception("$OutOfPerid");
                            }

                            if (period.IsOverDate == Web.Helper.FormatHelper.TRUE_STRING)
                            {
                                if (period.TimePeriodBeginTime < period.TimePeriodEndTime)
                                {
                                    shiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1));
                                }
                                else if (Web.Helper.FormatHelper.TOTimeInt(dtNow) < period.TimePeriodBeginTime)
                                {
                                    shiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1));
                                }
                                else
                                {
                                    shiftDay = FormatHelper.TODateInt(dtNow);
                                }
                            }
                            else
                            {
                                shiftDay = FormatHelper.TODateInt(dtNow);
                            }

                            #region 报废
                            if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Scrap)
                            {
                                if (ts.TSStatus == TSStatus.TSStatus_TS || ts.TSStatus == TSStatus.TSStatus_Confirm)
                                {
                                    ts.TSStatus       = TSStatus.TSStatus_Scrap;
                                    ts.TSResourceCode = actionEventArgs.ResourceCode;
                                    ts.TSUser         = actionEventArgs.UserCode;

                                    ts.TSDate = shiftDay;
                                    ts.TSTime = FormatHelper.TOTimeInt(dtNow);

                                    //added by jessie lee, 2005/11/24,
                                    //新增报废原因
                                    ts.ScrapCause   = (actionEventArgs as TSActionEventArgs).ScrapCause;
                                    ts.MaintainUser = (actionEventArgs as TSActionEventArgs).MaintainUser;
                                    ts.MaintainDate = ts.TSDate;
                                    ts.MaintainTime = ts.TSTime;

                                    //TODO:Laws Lu,2005/11/09,需要优化
                                    tsFacade.UpdateTS(ts);

                                    //added by alex,2010/11/09
                                    BenQGuru.eMES.OQC.OQCFacade oqcFacade = new BenQGuru.eMES.OQC.OQCFacade(this.DataProvider);
                                    OQCLot2Card oqcLot2Card = oqcFacade.GetLastOQCLot2CardByRCard(actionEventArgs.RunningCard) as OQCLot2Card;
                                    if (oqcLot2Card != null)
                                    {
                                        oqcLot2Card.Status = "SCRAP";
                                        oqcFacade.UpdateOQCLot2Card(oqcLot2Card);
                                    }

                                    MOFacade moFAC = new MOFacade(this._domainDataProvider);

                                    if (ts.FromInputType == TSFacade.TSSource_OnWIP)
                                    {
                                        //Laws Lu,2005/08/19,新增
                                        //Laws Lu,2005/08/25,修改	处理报废时,更新工单的报废数量
                                        doAction(actionEventArgs);
                                    }
                                }
                                else
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS_OR_Confirm"));
                                }
                            }
                            #endregion

                            #region 完成
                            if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Complete)
                            {
                                if (ts.TSStatus == TSStatus.TSStatus_TS)
                                {
                                    ts.TSStatus = TSStatus.TSStatus_Complete;

                                    ts.TSTimes = 1;

                                    //added by jessie lee, 2005/11/24,
                                    ts.MaintainUser = (actionEventArgs as TSActionEventArgs).MaintainUser;
                                    ts.TSUser       = actionEventArgs.UserCode;
                                    ts.MaintainDate = FormatHelper.TODateInt(dtNow);
                                    ts.MaintainTime = FormatHelper.TOTimeInt(dtNow);
                                    //Laws Lu,2006/04/28 add 添加维修shiftday和维修resourcecode
                                    ts.TSDate         = shiftDay;
                                    ts.TSTime         = FormatHelper.TOTimeInt(dtNow);
                                    ts.TSResourceCode = actionEventArgs.ResourceCode;


                                    tsFacade.UpdateTS(ts);

                                    // Added by Icyer 2006/11/07, KeyPart维修完成
                                    if (ts.CardType == CardType.CardType_Part && ts.FromInputType == TSFacade.TSSource_TS)
                                    {
                                        DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                                        SimulationReport  simRpt            = dataCollectFacade.GetLastSimulationReport(ts.RunningCard);
                                        if (simRpt != null && simRpt.Status == ProductStatus.NG)
                                        {
                                            simRpt.Status = ProductStatus.GOOD;
                                            dataCollectFacade.UpdateSimulationReport(simRpt);
                                        }
                                    }
                                    // Added end
                                }
                                else
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus));
                                }
                            }
                            #endregion

                            #region 回流
                            if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Reflow)
                            {
                                if (ts.TSStatus == TSStatus.TSStatus_TS)
                                {
                                    ts.TSStatus     = TSStatus.TSStatus_Reflow;
                                    ts.ReflowMOCode = ((TSActionEventArgs)actionEventArgs).MOCode;
                                    //ts.ReflowResourceCode = ((TSActionEventArgs)actionEventArgs).ItemCode ;
                                    ts.ReflowRouteCode = ((TSActionEventArgs)actionEventArgs).RouteCode;
                                    ts.ReflowOPCode    = ((TSActionEventArgs)actionEventArgs).OPCode;

                                    //added by jessie lee, 2005/11/24,
                                    //added by jessie lee, 2005/11/24,
                                    ts.MaintainUser = (actionEventArgs as TSActionEventArgs).MaintainUser;
                                    ts.TSUser       = actionEventArgs.UserCode;
                                    ts.MaintainDate = FormatHelper.TODateInt(dtNow);
                                    ts.MaintainTime = FormatHelper.TOTimeInt(dtNow);

                                    //Laws Lu,2006/04/28 add 添加维修shiftday和维修resourcecode
                                    ts.TSDate         = shiftDay;
                                    ts.TSTime         = FormatHelper.TOTimeInt(dtNow);
                                    ts.TSResourceCode = actionEventArgs.ResourceCode;

                                    tsFacade.UpdateTSReflowStatus(ts);
                                }
                                else
                                {
                                    messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus));
                                }
                            }
                            #endregion
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #18
0
        public Messages Execute(ActionEventArgs oqcLotRemoveIDEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);

            try
            {
                ActionOnLineHelper dataCollect     = new ActionOnLineHelper(this.DataProvider);
                ActionOQCHelper    actionOQCHelper = new ActionOQCHelper(this.DataProvider);
                OQCFacade          oqcFacade       = new OQCFacade(this.DataProvider);

                //检查批的状态
                if (!actionOQCHelper.IsOQCLotInitial(((OQCLotRemoveIDEventArgs)oqcLotRemoveIDEventArgs).OQCLotNO))
                {
                    throw new Exception("$Error_OQCLotNOIsNotInitial");
                }
                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(dataCollect.CheckID(oqcLotRemoveIDEventArgs));
                if (messages.IsSuccess())
                {
                    #region update FQCLotSize,Laws Lu,2005/10/24,修改
                    object obj = oqcFacade.GetOQCLot(((OQCLotRemoveIDEventArgs)oqcLotRemoveIDEventArgs).OQCLotNO, OQCFacade.Lot_Sequence_Default);
                    if (obj == null)
                    {
                        throw new Exception("$Error_OQCLotNotExisted");
                    }
                    OQCLot oqcLot = obj as OQCLot;
                    oqcLot.LotSize = -1;                    //oqcFacade.GetOQCLotSizeFromOQCLot2Card( ((OQCLotRemoveIDEventArgs)oqcLotRemoveIDEventArgs).OQCLotNO);
                    oqcFacade.UpdateOQCLotSize(oqcLot);
                    #endregion

                    #region OQCADDID 自身的检查

                    //检查批的状态
                    if (actionOQCHelper.IsOQCLotComplete(((OQCLotRemoveIDEventArgs)oqcLotRemoveIDEventArgs).OQCLotNO))
                    {
                        throw new Exception("$Error_OQCLotNOHasComplete");
                    }
                    #endregion

                    //把nowsimulation 的actionlist的OqcAdd,oQCDelete,replace为空
                    oqcLotRemoveIDEventArgs.ProductInfo.NowSimulation.ActionList = oqcLotRemoveIDEventArgs.ProductInfo.NowSimulation.ActionList.Replace(ActionType.DataCollectAction_OQCLotAddID, "");
                    oqcLotRemoveIDEventArgs.ProductInfo.NowSimulation.ActionList = oqcLotRemoveIDEventArgs.ProductInfo.NowSimulation.ActionList.Replace(ActionType.DataCollectAction_OQCLotRemoveID, "");


                    oqcLotRemoveIDEventArgs.ProductInfo.NowSimulation.LOTNO = String.Empty;

                    /* added by jessie lee, 2006/6/20
                     * Power0063:包装时,如果从抽检批中删除一个产品,应该从包装箱中删除此产品。 */
                    string cartoncode = string.Empty;
                    if (oqcLotRemoveIDEventArgs.ProductInfo.NowSimulation.CartonCode != null &&
                        oqcLotRemoveIDEventArgs.ProductInfo.NowSimulation.CartonCode.Length > 0)
                    {
                        cartoncode = oqcLotRemoveIDEventArgs.ProductInfo.NowSimulation.CartonCode;
                        oqcLotRemoveIDEventArgs.ProductInfo.NowSimulation.CartonCode = string.Empty;
                    }

                    messages.AddMessages(dataCollect.Execute(oqcLotRemoveIDEventArgs));

                    if (messages.IsSuccess())
                    {
                        //删除对应OQCLot2Card,如果是最后一个则删除对应OQCLot
                        #region OQC
                        object objLot2Card = oqcFacade.GetOQCLot2Card(oqcLotRemoveIDEventArgs.ProductInfo.NowSimulation.RunningCard, oqcLotRemoveIDEventArgs.ProductInfo.NowSimulation.MOCode, ((OQCLotRemoveIDEventArgs)oqcLotRemoveIDEventArgs).OQCLotNO, OQCFacade.Lot_Sequence_Default);
                        if (objLot2Card == null)
                        {
                            throw new Exception("$Error_OQClot2CardNotExisted");
                        }
                        oqcFacade.DeleteOQCLot2Card((OQCLot2Card)objLot2Card);
                        object[] objs = oqcFacade.ExactQueryOQCLot2Card(((OQCLotRemoveIDEventArgs)oqcLotRemoveIDEventArgs).OQCLotNO, OQCFacade.Lot_Sequence_Default);
                        if (objs == null)
                        {
                            //删除OQCLot2ErrorCode
                            oqcFacade.DeleteOQCLot2ErrorCode(((OQCLotRemoveIDEventArgs)oqcLotRemoveIDEventArgs).OQCLotNO, OQCFacade.Lot_Sequence_Default.ToString());
                            //删除OQCLOTCheckList
                            obj = oqcFacade.GetOQCLOTCheckList(((OQCLotRemoveIDEventArgs)oqcLotRemoveIDEventArgs).OQCLotNO, OQCFacade.Lot_Sequence_Default);
                            if (obj != null)
                            {
                                oqcFacade.DeleteOQCLOTCheckList((OQCLOTCheckList)obj);
                            }

                            //删除OQCLot
                            obj = oqcFacade.GetOQCLot(((OQCLotRemoveIDEventArgs)oqcLotRemoveIDEventArgs).OQCLotNO, OQCFacade.Lot_Sequence_Default);
                            if (obj == null)
                            {
                                throw new Exception("$Error_OQClotNotExisted");
                            }
                            oqcFacade.DeleteOQCLot((OQCLot)obj);
                        }

                        #endregion

                        /* added by jessie lee, 2006/6/20
                         * Power0063:包装时,如果从抽检批中删除一个产品,应该从包装箱中删除此产品。 */
                        #region Carton
                        if (cartoncode.Length > 0)
                        {
                            Package.PackageFacade pf = new BenQGuru.eMES.Package.PackageFacade(DataProvider);
                            object objCarton         = pf.GetCARTONINFO(cartoncode);

                            if (objCarton != null)
                            {
                                BenQGuru.eMES.Domain.Package.CARTONINFO carton = objCarton as BenQGuru.eMES.Domain.Package.CARTONINFO;
                                pf.SubtractCollected((carton as BenQGuru.eMES.Domain.Package.CARTONINFO).CARTONNO);
                            }
                        }
                        #endregion
                        //AMOI  MARK  START  20050806 增加按资源统计产量
                        #region 填写统计报表 按资源统计
                        //ReportHelper reportCollect= new ReportHelper(this.DataProvider);
                        //messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider
                        //    ,oqcLotRemoveIDEventArgs.ActionType,oqcLotRemoveIDEventArgs.ProductInfo));
                        #endregion
                        //AMOI  MARK  END
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actionEventArgs"> </param> params (0,lotno)
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            OQCRejectEventArgs oqcRejectEventArgs = actionEventArgs as OQCRejectEventArgs;

            try
            {
                ActionOnLineHelper dataCollect  = new ActionOnLineHelper(this.DataProvider);
                ActionOQCHelper    oqcHelper    = new ActionOQCHelper(this.DataProvider);
                OQCFacade          oqcFacade    = new OQCFacade(this.DataProvider);
                ReworkFacade       reworkFacade = new ReworkFacade(this.DataProvider);
                TSFacade           tsFacade     = new TSFacade(this.DataProvider);

                //check oqcStatus
                #region CheckOQCLotStatus
                //				object objOQClot = oqcFacade.GetOQCLot(oqcRejectEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default);
                //				if(objOQClot == null)
                //				{
                //					throw new Exception("$Error_OQCLotNotExisted");
                //				}
                //				if( ((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Initial)
                //				{
                //					throw new Exception("$Error_OQCLotNO_Cannot_Initial");
                //				}
                //				if( ((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_NoExame)
                //				{
                //					throw new Exception("$Error_OQCLotNO_Cannot_NoExame");
                //				}
                //				if( (((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Reject)||((((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Pass)  ))
                //				{
                //					throw new Exception("$Error_OQCLotNO_HasComplete");
                //				}
                #endregion

                if (!oqcRejectEventArgs.IsForceReject)
                {
                    //必须要有NG而且在送修状态的板子
                    if (tsFacade.HaveNewStatusCardInOQCLot(oqcRejectEventArgs.OQCLotNO, String.Empty))
                    {
                        throw new Exception("$Error_OQCLotNo_HasNoTS");
                    }
                }

                object objLot = null;
                if (oqcRejectEventArgs.Lot == null)
                {
                    objLot = oqcFacade.GetExamingOQCLot(oqcRejectEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default);
                }
                else
                {
                    objLot = oqcRejectEventArgs.Lot;
                }

                //update each running card reject
                #region 取得每个板子进行批退,填充reject,Reject2ErrorCode信息
                //reject
                object[] RCards = null;

                if (oqcRejectEventArgs.CardOfLot != null)
                {
                    RCards = oqcRejectEventArgs.CardOfLot;
                }
                else
                {
                    RCards = oqcHelper.QueryCardOfLot(oqcRejectEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default);
                }

                if (!oqcRejectEventArgs.IsForceReject)
                {
                    int iNGCount = 0;
                    for (int j = 0; j < RCards.Length; j++)
                    {
                        if (((Simulation)RCards[j]).ProductStatus == ProductStatus.NG)
                        {
                            iNGCount = 1;
                            break;
                        }
                    }
                    int funcNGCount = 0;
                    funcNGCount = oqcFacade.QueryFuncTesCount(oqcRejectEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default.ToString(), ProductStatus.NG);
                    if (iNGCount == 0 && funcNGCount == 0)
                    {
                        throw new Exception("$CS_LOT_NOT_EXIST_NG");
                    }
                }

                #region reject errorCodes
                object[]         objs             = oqcFacade.ExtraQueryOQCLotCard2ErrorCode(oqcRejectEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default.ToString());
                Reject2ErrorCode reject2ErrorCode = reworkFacade.CreateNewReject2ErrorCode();
                //Reject2ErrorCode
                if (objs != null)
                {
                    for (int i = 0; i < objs.Length; i++)
                    {
                        bool needInsert = false;
                        foreach (Simulation sim in RCards)
                        {
                            if (sim.RunningCard == ((OQCLotCard2ErrorCode)objs[i]).RunningCard &&
                                sim.RunningCardSequence == ((OQCLotCard2ErrorCode)objs[i]).RunningCardSequence)
                            {
                                needInsert = true;
                            }
                        }
                        if (needInsert)
                        {
                            reject2ErrorCode.ErrorCode           = ((OQCLotCard2ErrorCode)objs[i]).ErrorCode;
                            reject2ErrorCode.ErrorCodeGroup      = ((OQCLotCard2ErrorCode)objs[i]).ErrorCodeGroup;
                            reject2ErrorCode.MaintainUser        = actionEventArgs.UserCode;
                            reject2ErrorCode.RunningCard         = ((OQCLotCard2ErrorCode)objs[i]).RunningCard;
                            reject2ErrorCode.RunningCardSequence = ((OQCLotCard2ErrorCode)objs[i]).RunningCardSequence + 1;
                            reject2ErrorCode.MOCode = ((OQCLotCard2ErrorCode)objs[i]).MOCode;
                            reject2ErrorCode.LotNo  = ((OQCRejectEventArgs)actionEventArgs).OQCLotNO;
                            reject2ErrorCode.MOSeq  = ((OQCLotCard2ErrorCode)objs[i]).MOSeq;        // Added by Icyer 2007/07/03

                            if (reworkFacade.GetReject2ErrorCode(reject2ErrorCode.ErrorCode, reject2ErrorCode.RunningCard, reject2ErrorCode.RunningCardSequence, reject2ErrorCode.ErrorCodeGroup) == null)
                            {
                                reworkFacade.AddReject2ErrorCode(reject2ErrorCode);
                            }
                        }
                    }
                }
                #endregion

                #endregion

                #region OQCLotCheckList
                object objLotCheckList = oqcFacade.GetOQCLOTCheckList(oqcRejectEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default);
                if (objLotCheckList != null)
                {
                    OQCLOTCheckList oqcLotCheckList = objLotCheckList as OQCLOTCheckList;
                    oqcLotCheckList.Result = OQCLotStatus.OQCLotStatus_Reject;
                    oqcFacade.UpdateOQCLOTCheckList(oqcLotCheckList);
                }
                #endregion

                //把整个lot中的ID全变成reject
                #region 整个lot中的ID全变成reject
                object[] objsInTS = oqcFacade.GetOQCLot2CardInTS(string.Empty, string.Empty, string.Empty, string.Empty, oqcRejectEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default.ToString());
                if (objsInTS == null)
                {
                    oqcFacade.UpdateOQCLot2CardByOQCResult(oqcRejectEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default.ToString(), string.Empty, string.Empty, ProductStatus.Reject, true);
                }
                else
                {
                    string tmpString = string.Empty;
                    for (int i = 0; i < objsInTS.Length; i++)
                    {
                        tmpString += ": " + ((OQCLot2Card)objsInTS[i]).RunningCard;
                    }
                    throw new Exception(String.Format("$Error_RunningCardInTS: {0}", tmpString));
                }
                #endregion

                messages.AddMessages(SetReworkInformation(messages, RCards, oqcRejectEventArgs, dataCollect, reworkFacade));

                #region updateOQCLot

                DBDateTime dbDateTime;

                dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                OQCLot oqcLot = objLot as OQCLot;
                oqcLot.LOTStatus = OQCLotStatus.OQCLotStatus_Reject;
                oqcLot.DealDate  = dbDateTime.DBDate;
                oqcLot.DealTime  = dbDateTime.DBTime;
                oqcLot.DealUser  = actionEventArgs.UserCode;
                oqcLot.Memo      = oqcRejectEventArgs.Memo;
                oqcFacade.UpdateOQCLotStatus(oqcLot);
                #endregion

                if (oqcRejectEventArgs.IsAutoGenerateReworkSheet)
                {
                    //ReworkSheet reworkSheet = reworkFacade.GetMaxReworkSheet(dbDateTime.DBDate);
                    //reworkSheet.ReworkCode = reworkSheet.ReworkCode.Substring(0, 9) + Convert.ToString(int.Parse(reworkSheet.ReworkCode.Substring(9, 3)) + 1).PadLeft(3, '0');
                    ReworkSheet reworkSheet = new ReworkSheet();
                    reworkSheet.ReworkCode       = oqcLot.LOTNO;
                    reworkSheet.CreateDate       = dbDateTime.DBDate;
                    reworkSheet.CreateTime       = dbDateTime.DBTime;
                    reworkSheet.CreateUser       = actionEventArgs.UserCode;
                    reworkSheet.Department       = "";
                    reworkSheet.EAttribute1      = "";
                    reworkSheet.ItemCode         = (RCards[0] as Simulation).ItemCode;
                    reworkSheet.LotList          = oqcRejectEventArgs.OQCLotNO;
                    reworkSheet.MaintainDate     = dbDateTime.DBDate;
                    reworkSheet.MaintainTime     = dbDateTime.DBTime;
                    reworkSheet.MaintainUser     = actionEventArgs.UserCode;
                    reworkSheet.MOCode           = "";
                    reworkSheet.NeedCheck        = "N";
                    reworkSheet.NewMOCode        = "";
                    reworkSheet.NewOPBOMCode     = "";
                    reworkSheet.NewOPBOMVersion  = "";
                    reworkSheet.NewOPCode        = "";
                    reworkSheet.NewRouteCode     = "";
                    reworkSheet.ReasonAnalyse    = "";
                    reworkSheet.ReworkContent    = "";
                    reworkSheet.ReworkDate       = 0;
                    reworkSheet.ReworkHC         = 0;
                    reworkSheet.ReworkMaxQty     = 0;
                    reworkSheet.ReworkQty        = RCards.Length;
                    reworkSheet.ReworkRealQty    = 0;
                    reworkSheet.ReworkReason     = oqcRejectEventArgs.Memo;
                    reworkSheet.ReworkSourceCode = " ";
                    reworkSheet.ReworkTime       = 0;
                    reworkSheet.ReworkType       = ReworkType.REWORKTYPE_ONLINE;
                    reworkSheet.Soluation        = "";
                    reworkSheet.Status           = ReworkStatus.REWORKSTATUS_RELEASE;
                    reworkSheet.AutoLot          = oqcRejectEventArgs.IsCreateNewLot ? "Y" : "";

                    reworkFacade.AddReworkSheetWithOutTrans(reworkSheet);
                }

                //add by roger.xue 2008/10/27
                if (oqcRejectEventArgs.IsUnFrozen)
                {
                    oqcFacade.UpdateUnFrozenOnLot(oqcRejectEventArgs.OQCLotNO, oqcRejectEventArgs.UnFrozenReason,
                                                  dbDateTime.DBDate, dbDateTime.DBTime, oqcRejectEventArgs.UserCode, OQCFacade.Lot_Sequence_Default);

                    oqcFacade.UnFreezeFrozen(oqcRejectEventArgs.OQCLotNO, oqcRejectEventArgs.UnFrozenReason,
                                             dbDateTime.DBDate, dbDateTime.DBTime, oqcRejectEventArgs.UserCode, OQCFacade.Lot_Sequence_Default);
                }
                //end add

                AlertFacade alertFacade = new AlertFacade(this.DataProvider);
                alertFacade.AlertOQCReject(oqcLot.ItemCode, oqcLot.SSCode, oqcLot.LOTNO, oqcLot.Memo);
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #20
0
        // Added by Icyer 2005/10/28
        //扩展一个带ActionCheckStatus参数的方法
        public Messages Execute(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus)
        {
            ((GoToMOActionEventArgs)actionEventArgs).MOCode       = ((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim().ToUpper();
            actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = (actionEventArgs as GoToMOActionEventArgs).Memo;
            //actionEventArgs.ProductInfo.NowSimulation.RMABillCode = (actionEventArgs as GoToMOActionEventArgs).ProductInfo.CurrentMO.mor;

            actionEventArgs.LotCode = actionEventArgs.LotCode.Trim().ToUpper();

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

            dataCollectDebug.WhenFunctionIn(messages);

            if (((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim() == String.Empty)
            {
                messages.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_MOCode"));
            }

            if (((GoToMOActionEventArgs)actionEventArgs).LotCode.Trim() == String.Empty)
            {
                messages.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_RunningCard"));
            }

            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
            MOFacade          moFacade          = new MOFacade(this.DataProvider);

            try
            {
                if (messages.IsSuccess())
                {
                    //调用含有ActionCheckStatus参数的CheckIn方法
                    messages.AddMessages(this.CheckIn(actionEventArgs, actionCheckStatus));
                    // Added by Icyer 2006/12/05
                    TakeDownCarton(actionEventArgs);
                    // Added end

                    if (!((GoToMOActionEventArgs)actionEventArgs).PassCheck)
                    {
                        throw new Exception("$CS_ID_Has_Already_Belong_To_This_MO $CS_Param_ID="
                                            + actionEventArgs.LotCode + " $Domain_MO=" + ((GoToMOActionEventArgs)actionEventArgs).MOCode);
                    }

                    if (messages.IsSuccess())
                    {
                        // 拆箱和拆Pallet

                        actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = (actionEventArgs as GoToMOActionEventArgs).Memo;

                        if (actionCheckStatus.NeedUpdateSimulation)
                        {
                            ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                            messages.AddMessages(dataCollect.Execute(actionEventArgs));
                        }
                        else
                        {
                            ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                            messages.AddMessages(dataCollect.Execute(actionEventArgs, actionCheckStatus));
                        }

                        if (messages.IsSuccess())
                        {
                            moFacade.UpdateMOInPutQty(actionEventArgs.ProductInfo.NowSimulation.MOCode, actionEventArgs.CurrentMO, (int)actionEventArgs.ProductInfo.NowSimulation.LotQty);
                            //是否执行过updateItem2Route操作
                            if (actionCheckStatus.IsUpdateRefItem2Route == false)
                            {
                                this.updateItem2Route(actionEventArgs.ProductInfo.NowSimulation.ItemCode, actionEventArgs.ProductInfo.NowSimulation.RouteCode, actionEventArgs.UserCode);
                                actionCheckStatus.IsUpdateRefItem2Route = true;
                            }

                            MORunningCardFacade cardFacade = new MORunningCardFacade(this.DataProvider);
                            MORunningCard       card       = cardFacade.CreateNewMORunningCard();

                            card.MOCode             = ((GoToMOActionEventArgs)actionEventArgs).MOCode.ToString();
                            card.MORunningCardStart = actionEventArgs.LotCode;
                            card.MORunningCardEnd   = actionEventArgs.LotCode;
                            card.MaintainUser       = actionEventArgs.UserCode;

                            DBDateTime dbDateTime;
                            //Laws Lu,2006/11/13 uniform system collect date
                            //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;
                            }

                            card.MaintainDate = dbDateTime.DBDate;
                            card.MaintainTime = dbDateTime.DBTime;
                            // Added by Icyer 2007/07/02
                            MO mo = (MO)moFacade.GetMO(card.MOCode);
                            card.MOSeq = mo.MOSeq;
                            // Added end

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

            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #21
0
        /// <summary>
        /// ** 功能描述:	确认流程卡序列号的维修
        /// ** 作 者:		crystal chu
        /// ** 日 期:		2005/07/26/
        /// ** 修 改:
        /// ** 日 期:
        /// ** nunit
        /// </summary>
        /// <param name="actionEventArgs"> </param>
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //检查res在不在OPTS中
                messages.AddMessages(dataCollect.CheckResourceInOperationTS(actionEventArgs));

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

                DateTime dtNow = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime);
                if (messages.IsSuccess())
                {
                    //Laws Lu,2005/09/16,修改	整理逻辑
                    TSFacade tsFacade = new TSFacade(this.DataProvider);
                    //					if( !tsFacade.IsCardInTS(actionEventArgs.RunningCard))
                    //					{
                    //						messages.Add(new Message(MessageType.Error,"$CSError_Card_Not_In_TS"));
                    //					}
                    //Laws Lu,2005/10/16,在订单1中的已经拆解的产品序列号,
                    //现在系统中可以实现将该产品序列号重新归属到另外一个订单2,
                    //但是该产品序列号在工单2采集完不良后,
                    //作送修作业时,系统提出报错信息:
                    //该产品状态为“拆解”状态。导致该产品序列号无法进行维修。
                    object obj = tsFacade.GetCardLastTSRecordInNewStatus(actionEventArgs.RunningCard);

                    if (obj == null)
                    {
                        //Laws Lu,2006,07/05 Support RMA Repair
                        //						if(actionEventArgs.IsRMA)
                        //						{
                        MOFacade moFAC  = new MOFacade(DataProvider);
                        object   objRMA = moFAC.GetRepairRMARCARDByRcard(actionEventArgs.RunningCard);
                        if (objRMA != null)
                        {
                            #region 新增维修信息

                            RMARCARD     rma = objRMA as RMARCARD;
                            Domain.TS.TS tS  = tsFacade.CreateNewTS();
                            tS.TSId = FormatHelper.GetUniqueID((rma.REWORKMOCODE == String.Empty?rma.RMABILLNO:rma.REWORKMOCODE)
                                                               , actionEventArgs.RunningCard, ActionOnLineHelper.StartSeq.ToString());

                            tS.CardType      = CardType.CardType_Product;;
                            tS.FormTime      = rma.MTIME;
                            tS.FromDate      = rma.MDATE;
                            tS.FromInputType = TSFacade.TSSource_RMA;
                            tS.FromUser      = rma.MUSER;
                            tS.FromMemo      = rma.EATTRIBUTE1;
                            //Laws Lu,2006/07/05 add support RMA
                            tS.RMABillCode = rma.RMABILLNO;
                            //工作时间和工业布局信息

                            //Laws Lu,2005/11/09,新增	记录ShiftDay
                            BaseSetting.BaseModelFacade dataModel = new BaseSetting.BaseModelFacade(this.DataProvider);
                            Domain.BaseSetting.Resource res       = (Domain.BaseSetting.Resource)dataModel.GetResource(actionEventArgs.ResourceCode);
                            //onwip.SegmentCode				= productInfo.NowSimulationReport.SegmentCode;
                            //2006/11/17,Laws Lu add get DateTime from db Server

                            BaseSetting.ShiftModelFacade  shiftModel = new BaseSetting.ShiftModelFacade(this.DataProvider);
                            Domain.BaseSetting.TimePeriod period     = (Domain.BaseSetting.TimePeriod)shiftModel.GetTimePeriod(res.ShiftTypeCode, Web.Helper.FormatHelper.TOTimeInt(dtNow));
                            if (period == null)
                            {
                                throw new Exception("$OutOfPerid");
                            }

                            if (period.IsOverDate == Web.Helper.FormatHelper.TRUE_STRING)
                            {
                                if (period.TimePeriodBeginTime < period.TimePeriodEndTime)
                                {
                                    tS.FromShiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1));
                                }
                                else if (Web.Helper.FormatHelper.TOTimeInt(dtNow) < period.TimePeriodBeginTime)
                                {
                                    tS.FromShiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1));
                                }
                                else
                                {
                                    tS.FromShiftDay = FormatHelper.TODateInt(dtNow);
                                }
                            }
                            else
                            {
                                tS.FromShiftDay = FormatHelper.TODateInt(dtNow);
                            }

                            tS.FromOPCode           = "TS";
                            tS.FromResourceCode     = actionEventArgs.ResourceCode;
                            tS.FromRouteCode        = String.Empty;
                            tS.FromSegmentCode      = res.SegmentCode;
                            tS.FromShiftCode        = period.ShiftCode;                     /*Laws Lu,2006/03/11 修正班次填写有误*/
                            tS.FromShiftTypeCode    = period.ShiftTypeCode;
                            tS.FromStepSequenceCode = res.StepSequenceCode;
                            tS.FromTimePeriodCode   = period.TimePeriodCode;

                            tS.ItemCode     = rma.ITEMCODE;
                            tS.MaintainDate = FormatHelper.TODateInt(dtNow);
                            tS.MaintainTime = FormatHelper.TOTimeInt(dtNow);
                            tS.MaintainUser = actionEventArgs.MaintainUser;

                            tS.MOCode              = (rma.REWORKMOCODE == String.Empty?rma.RMABILLNO:rma.REWORKMOCODE);
                            tS.ModelCode           = rma.MODELCODE;
                            tS.RunningCard         = actionEventArgs.RunningCard;
                            tS.RunningCardSequence = ActionOnLineHelper.StartSeq;
                            tS.SourceCard          = actionEventArgs.RunningCard;
                            tS.SourceCardSequence  = ActionOnLineHelper.StartSeq;
                            tS.TransactionStatus   = TSFacade.TransactionStatus_None;

                            tS.TranslateCard         = actionEventArgs.RunningCard;
                            tS.TranslateCardSequence = ActionOnLineHelper.StartSeq;
                            //tS.TSStatus = TSStatus.TSStatus_New;

                            tS.Week    = (new ReportHelper(DataProvider)).WeekOfYear(tS.FromShiftDay.ToString());
                            tS.Month   = int.Parse(tS.FromShiftDay.ToString().Substring(4, 2));
                            tS.TSTimes = ActionOnLineHelper.StartNGTimes;

                            tS.ConfirmUser         = actionEventArgs.UserCode;
                            tS.ConfirmDate         = FormatHelper.TODateInt(dtNow);
                            tS.ConfirmTime         = FormatHelper.TOTimeInt(dtNow);
                            tS.ConfirmOPCode       = "TS";
                            tS.ConfirmResourceCode = actionEventArgs.ResourceCode;
                            tS.TSStatus            = TSStatus.TSStatus_Confirm;
                            // Added by Icyer 2007/07/03
                            MO mo = (MO)moFAC.GetMO(tS.MOCode);
                            if (mo != null)
                            {
                                tS.MOSeq = mo.MOSeq;
                            }
                            // Added end

                            tsFacade.AddTS(tS);
                            //Laws Lu,2006/07/07 add ,Success release than delete rma
                            moFAC.DeleteRMARCARD(rma);
                            #endregion
                        }
                        else
                        {
                            messages.Add(new Message(MessageType.Error, "$CSError_Card_Not_In_TS_OR_Status_Error"));
                        }
                        //						}
                        //						else
                        //						{
                        //							messages.Add(new Message(MessageType.Error,"$CSError_Card_Not_In_TS_OR_Status_Error"));
                        //						}
                    }
                    else
                    {
                        BenQGuru.eMES.Domain.TS.TS ts = (BenQGuru.eMES.Domain.TS.TS)obj;

                        if (ts.TSStatus == TSStatus.TSStatus_New)
                        {
                            ts.ConfirmUser         = actionEventArgs.UserCode;
                            ts.ConfirmDate         = FormatHelper.TODateInt(dtNow);
                            ts.ConfirmTime         = FormatHelper.TOTimeInt(dtNow);
                            ts.ConfirmOPCode       = "TS";
                            ts.ConfirmResourceCode = actionEventArgs.ResourceCode;
                            ts.TSStatus            = TSStatus.TSStatus_Confirm;

                            //added by jessie lee, 2005/11/24,
                            ts.MaintainUser = actionEventArgs.MaintainUser;
                            ts.MaintainDate = FormatHelper.TODateInt(dtNow);
                            ts.MaintainTime = FormatHelper.TOTimeInt(dtNow);

                            tsFacade.UpdateTSConfirmStatus(ts);
                        }
                        else
                        {
                            messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_Error $Current_Status $" + ts.TSStatus));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #22
0
        public Messages Execute(ActionEventArgs oqcLotAddIDEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);

            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                ActionOQCHelper    oqcHelper   = new ActionOQCHelper(this.DataProvider);
                OQCFacade          oqcFacade   = new OQCFacade(this.DataProvider);
                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(dataCollect.CheckID(oqcLotAddIDEventArgs));

                if (messages.IsSuccess())
                {
                    if (((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation == null)
                    {
                        throw new Exception("$System_Error");
                    }

                    #region update FQCLotSize
                    object obj = oqcFacade.GetOQCLot(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO, OQCFacade.Lot_Sequence_Default);
                    if (obj == null)
                    {
                        throw new Exception("$Error_OQCLotNotExisted");
                    }
                    OQCLot oqcLot = obj as OQCLot;
                    oqcLot.LotSize = 1;                    //oqcFacade.GetOQCLotSizeFromOQCLot2Card( ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO);
                    //TODO:Laws Lu,2005/10/17,需要修改	更新数量

                    oqcFacade.UpdateOQCLotSize(oqcLot);
                    #endregion

                    #region OQCADDID 自身的检查
                    #region 只是forcase工具使用,真实的情况是从前台已经产生
                    object objOQCLot = oqcFacade.GetOQCLot(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO, OQCFacade.Lot_Sequence_Default);
                    if (objOQCLot == null)
                    {
                        OQCLot newOQCLot = oqcFacade.CreateNewOQCLot();
                        newOQCLot.LOTNO        = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO));
                        newOQCLot.AcceptSize   = 0;
                        newOQCLot.AcceptSize1  = 0;
                        newOQCLot.AcceptSize2  = 0;
                        newOQCLot.AQL          = 0;
                        newOQCLot.AQL1         = 0;
                        newOQCLot.AQL2         = 0;
                        newOQCLot.LotSequence  = OQCFacade.Lot_Sequence_Default;
                        newOQCLot.OQCLotType   = "oqclottype_normal";
                        newOQCLot.LotSize      = 0;
                        newOQCLot.LOTStatus    = OQCLotStatus.OQCLotStatus_Initial;
                        newOQCLot.LOTTimes     = 0;
                        newOQCLot.MaintainUser = oqcLotAddIDEventArgs.UserCode;
                        newOQCLot.RejectSize   = 0;
                        newOQCLot.RejectSize1  = 0;
                        newOQCLot.RejectSize2  = 0;
                        newOQCLot.SampleSize   = 0;
                        oqcFacade.AddOQCLot(newOQCLot);
                    }
                    #endregion


                    //检查批的状态
                    if (!oqcHelper.IsOQCLotComplete(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO))
                    {
                        //Write off by Laws Lu/2006/05/25
//						//是否同一ItemCode
//						if( oqcHelper.IsRemixItemCode( ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.ItemCode,((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO))
//						{
//							throw new Exception("$Error_RemixItemCode");
//						}
                        //End Write off

                        //是否混单
                        if (!((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).IsRemixMO)
                        {
                            //如除了正准备的工单号外,还有其他的工单存在则报错
                            if (oqcHelper.IsRemixMOCode(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO, ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.MOCode))
                            {
                                throw new Exception("$Error_RemixMO");
                            }
                        }
                        //一个ID只能属于一个批(reject,pass状态除外)
                        if (!(oqcHelper.IsIDHasOnlyOQCLotNo(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).RunningCard, ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.MOCode, ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO)))
                        {
                            throw new Exception("$Error_IDHasExistedInOtherOQCLotNO");
                        }
                        //检查完工数量
                        if (((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).IsCheckOQCLotMaxSize)
                        {
                            if (oqcHelper.GetIDCountInOQCLotNo(((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO) >= ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotMaxSize)
                            {
                                throw new Exception("$Error_OQClotQtyExceedMaxQty");
                            }
                        }
                    }
                    else
                    {
                        throw new Exception("$Error_OQCLotNOHasComplete");
                    }
                    #endregion
                    string cartonno = (oqcLotAddIDEventArgs as OQCLotAddIDEventArgs).CartonNo;

                    oqcLotAddIDEventArgs.ProductInfo.NowSimulation.LOTNO = (oqcLotAddIDEventArgs as OQCLotAddIDEventArgs).OQCLotNO;

                    //oqcLotAddIDEventArgs.ProductInfo.NowSimulation.CartonCode = (oqcLotAddIDEventArgs as OQCLotAddIDEventArgs).CartonNo;
                    // Added by Icyer 2006/06/07
                    string oldCartonNo = oqcLotAddIDEventArgs.ProductInfo.NowSimulation.CartonCode;
                    if (cartonno != string.Empty)
                    {
                        oqcLotAddIDEventArgs.ProductInfo.NowSimulation.CartonCode = (oqcLotAddIDEventArgs as OQCLotAddIDEventArgs).CartonNo;
                    }
                    // Added end
                    //是否该产品是否属于wip的其他站
                    messages.AddMessages(dataCollect.Execute(oqcLotAddIDEventArgs));

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

                    if (messages.IsSuccess())
                    {
                        if (cartonno != string.Empty && cartonno != oldCartonNo)
                        {
                            //Laws Lu,2006/05/27	包装到Carton
                            Package.PackageFacade pf = new BenQGuru.eMES.Package.PackageFacade(DataProvider);

                            object objCarton = pf.GetCARTONINFO(cartonno);

                            if (objCarton != null)
                            {
                                BenQGuru.eMES.Domain.Package.CARTONINFO carton = objCarton as BenQGuru.eMES.Domain.Package.CARTONINFO;

                                /* added by jessie lee, 20006/6/20
                                 * Power0086:达到最大包装数量时及时提示 */
                                if (carton.CAPACITY == carton.COLLECTED + 1)
                                {
                                    messages.Add(new UserControl.Message(MessageType.Normal, "$CARTON_ALREADY_FULL_PlEASE_CHANGE"));
                                }
                                //Laws Lu,2006/06/22 modify cancle exception and use message
                                if (carton.CAPACITY <= carton.COLLECTED)
                                {
                                    messages.Add(new UserControl.Message(MessageType.Error, "$CARTON_ALREADY_FILL_OUT"));
                                }
                                else
                                {
                                    pf.UpdateCollected((carton as BenQGuru.eMES.Domain.Package.CARTONINFO).CARTONNO);
                                }
                            }
                            else if (cartonno != String.Empty)
                            {
                                //Laws Lu,2006/06/22	modify check if carton exist
                                object objExistCTN = pf.GetExistCARTONINFO(cartonno);

                                if (objExistCTN != null)
                                {
                                    messages.Add(new UserControl.Message(MessageType.Error, "$CARTON_ALREADY_FULL_PlEASE_CHANGE"));
                                }
                                else
                                {
                                    BenQGuru.eMES.Domain.Package.CARTONINFO carton = new BenQGuru.eMES.Domain.Package.CARTONINFO();

                                    carton.CAPACITY   = ((new ItemFacade(DataProvider)).GetItem(oqcLotAddIDEventArgs.ProductInfo.NowSimulation.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID) as Item).ItemCartonQty;
                                    carton.COLLECTED  = 1 /** oqcLotAddIDEventArgs.ProductInfo.NowSimulation.IDMergeRule*/;
                                    carton.PKCARTONID = System.Guid.NewGuid().ToString().ToUpper();
                                    carton.CARTONNO   = cartonno;
                                    carton.MUSER      = oqcLotAddIDEventArgs.UserCode;



                                    carton.MDATE = dbDateTime.DBDate;
                                    carton.MTIME = dbDateTime.DBTime;
                                    //carton.

                                    //joe song 20060630 Carton Memo
                                    carton.EATTRIBUTE1 = (oqcLotAddIDEventArgs as OQCLotAddIDEventArgs).CartonMemo;

                                    if (carton.CAPACITY == 0)                                   //Get carton capacity by item
                                    {
                                        messages.Add(new UserControl.Message(MessageType.Error
                                                                             , "$CS_PLEASE_MAINTEIN_ITEMCARTON $CS_Param_ID =" + oqcLotAddIDEventArgs.RunningCard));
                                    }
                                    else
                                    {
                                        pf.AddCARTONINFO(carton);
                                    }
                                }
                            }
                            //End
                        }
                    }

                    if (messages.IsSuccess())
                    {
                        //填写对应的runningcard 到OQCLotNO
                        #region add OQCLot2Card
                        OQCLot2Card oqcLot2Card = oqcFacade.CreateNewOQCLot2Card();
                        oqcLot2Card.ItemCode            = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.ItemCode;
                        oqcLot2Card.CollectType         = oqcLotAddIDEventArgs.CollectType;
                        oqcLot2Card.LOTNO               = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).OQCLotNO;
                        oqcLot2Card.LotSequence         = OQCFacade.Lot_Sequence_Default;
                        oqcLot2Card.MaintainUser        = oqcLotAddIDEventArgs.UserCode;
                        oqcLot2Card.MaintainDate        = dbDateTime.DBDate;
                        oqcLot2Card.MaintainTime        = dbDateTime.DBTime;
                        oqcLot2Card.MOCode              = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.MOCode;
                        oqcLot2Card.ModelCode           = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.ModelCode;
                        oqcLot2Card.OPCode              = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.OPCode;
                        oqcLot2Card.ResourceCode        = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.ResourceCode;
                        oqcLot2Card.RouteCode           = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.RouteCode;
                        oqcLot2Card.RunningCard         = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.RunningCard;
                        oqcLot2Card.RunningCardSequence = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.RunningCardSequence;
                        oqcLot2Card.SegmnetCode         = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulationReport.SegmentCode;
                        oqcLot2Card.ShiftCode           = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulationReport.ShiftCode;
                        oqcLot2Card.ShiftTypeCode       = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulationReport.ShiftTypeCode;
                        oqcLot2Card.Status              = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulationReport.Status;
                        oqcLot2Card.StepSequenceCode    = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulationReport.StepSequenceCode;
                        oqcLot2Card.TimePeriodCode      = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulationReport.TimePeriodCode;
                        //oqcLot2Card.EAttribute1 =  (oqcLotAddIDEventArgs as OQCLotAddIDEventArgs).CartonNo;
                        oqcLot2Card.EAttribute1 = oqcLotAddIDEventArgs.ProductInfo.NowSimulation.CartonCode;                    // Added by Icyer 2006/06/08
                        oqcLot2Card.MOSeq       = ((OQCLotAddIDEventArgs)oqcLotAddIDEventArgs).ProductInfo.NowSimulation.MOSeq; // Added by Icyer 2007/07/02    增加 MOSeq 栏位

                        oqcFacade.AddOQCLot2Card(oqcLot2Card);
                        #endregion
                        //AMOI  MARK  START  20050806 增加按资源统计产量
                        #region 填写统计报表 按资源统计
                        //ReportHelper reportCollect= new ReportHelper(this.DataProvider);
                        //messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider
                        //    ,oqcLotAddIDEventArgs.ActionType,oqcLotAddIDEventArgs.ProductInfo));
                        #endregion
                        //AMOI  MARK  END
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #23
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);
        }
Example #24
0
        /// <summary>
        /// 检查出TS是否允许,并填写部分SIMULATION
        /// </summary>
        /// <param name="iD"></param>
        /// <param name="actionType"></param>
        /// <param name="resourceCode"></param>
        /// <param name="userCode"></param>
        /// <param name="product"></param>
        /// <returns></returns>
//		public Messages CheckID(ActionEventArgs actionEventArgs)
//		{
//
//			Messages messages=new Messages();
//			DataCollectDebug dataCollectDebug =new DataCollectDebug(this.GetType().ToString()+"CheckID");
//			dataCollectDebug.WhenFunctionIn(messages);
//			try
//			{
//				if (actionEventArgs.ActionType ==ActionType.DataCollectAction_OutLineNG)
//				{
//					//线外不良品,到TS检查
//					ActionTS ts= new ActionTS(this.DataProvider);
//					messages.AddMessages( ts.CheckID(actionEventArgs));
//				}
//				else
//				{
//					MOFacade moFacade=new MOFacade(this.DataProvider);
//					BaseModelFacade dataModel=new BaseModelFacade(this.DataProvider);
//					DataCollectFacade dataCollectFacade=new DataCollectFacade(this.DataProvider);
//
//					#region 检查工单
//					MO mo=(MO)moFacade.GetMO(actionEventArgs.ProductInfo.LastSimulation.MOCode);
//					//工单状态检查
//					if (!dataCollectFacade.CheckMO(mo))
//					{
//						throw new Exception("$MOStatus_Error"+mo.MOStatus);
//					}
//					#endregion
//					#region 检查ID状态
//					if (actionEventArgs.ProductInfo.LastSimulation.ProductStatus !=ProductStatus.GOOD)
//					{
//						throw new Exception("$CS_ProductStatusError $CS_Param_ProductStatus="+ actionEventArgs.ProductInfo.LastSimulation.ProductStatus);
//					}
//					#endregion
//					#region 检查途程
//					//根据FROM ROUTE 和OP推途程
//					//检查重复采集
//					ItemRoute2OP op=new ItemRoute2OP();
//					dataCollectDebug.DebugPoint(messages,"下一站采集");
//					op=dataCollectFacade.GetMORouteNextOP(actionEventArgs.ProductInfo.LastSimulation.MOCode,
//						                            actionEventArgs.ProductInfo.LastSimulation.FromRoute,
//						                            actionEventArgs.ProductInfo.LastSimulation.FromOP);
//					if (op==null)
//						throw new Exception("$CS_Route_Failed_GetNotNextOP");
//					if (dataModel.GetOperation2Resource(op.OPCode, actionEventArgs.ResourceCode)==null)
//					{
//						throw new Exception("$CS_Route_Failed $CS_Param_OPCode"+op.OPCode);
//					}
//					#endregion
//					#region 检查ACTION
//					if (dataCollectFacade.CheckAction(actionEventArgs.ProductInfo, op, actionEventArgs.ActionType))
//					{
//					}
//					#endregion
//					#region 填写新SIMULATION
//					messages.AddMessages( dataCollectFacade.WriteSimulation(actionEventArgs.RunningCard ,actionEventArgs.ActionType ,actionEventArgs.ResourceCode ,actionEventArgs.UserCode ,actionEventArgs.ProductInfo));
//					if (messages.IsSuccess())
//					{
//						//修改
//						actionEventArgs.ProductInfo.NowSimulation.FromOP=			ActionOnLineHelper.StringNull;
//						actionEventArgs.ProductInfo.NowSimulation.FromRoute=		ActionOnLineHelper.StringNull;
//						actionEventArgs.ProductInfo.NowSimulation.RouteCode =	op.RouteCode;
//						actionEventArgs.ProductInfo.NowSimulation.OPCode =		op.OPCode;
//						actionEventArgs.ProductInfo.NowSimulation.ResourceCode=	 actionEventArgs.ResourceCode;
//						actionEventArgs.ProductInfo.NowSimulation.ActionList =";"+actionEventArgs.ActionType+";";
//					}
//					#endregion
//				}
//			}
//			catch (Exception e)
//			{
//				messages.Add(new Message(e));
//			}
//			dataCollectDebug.WhenFunctionOut(messages);
//			return messages;
//		}
        public Messages CheckIDIn(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "GetIDInfo");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                if (((OutLineActionEventArgs)actionEventArgs).OPCode == null)
                {
                    throw new Exception("$CS_Sys_OutLine_LostOPParam");
                }

                if (((OutLineActionEventArgs)actionEventArgs).OPCode.Length < 1)
                {
                    throw new Exception("$CS_Sys_OutLine_LostOPParamLengthError");
                }

                ActionOnLineHelper helper = new ActionOnLineHelper(this.DataProvider);
                messages.AddMessages(helper.CheckIDOutline(actionEventArgs));
                #region code not to use
                //string opCode= ((OutLineActionEventArgs)actionEventArgs).OPCode;
                //DataCollectFacade dataCollectFacade=new DataCollectFacade(this.DataProvider);
                //dataCollectFacade.CheckIDOutline(actionEventArgs.RunningCard, actionEventArgs.ActionType, actionEventArgs.ResourceCode, ((OutLineActionEventArgs)actionEventArgs).OPCode, actionEventArgs.UserCode, actionEventArgs.ProductInfo);
//				MOFacade moFacade=new MOFacade(this.DataProvider);
//
//				//填写SIMULATION 检查工单、ID、途程、操作
//				//messages.AddMessages( dataCollect.CheckID(iD,actionType,resourceCode,userCode,product));
//
//				#region 检查工单
//				MO mo=(MO)moFacade.GetMO(actionEventArgs.ProductInfo.LastSimulation.MOCode);
//
//				//工单状态检查
//				if (!dataCollectFacade.CheckMO(mo))
//				{
//					throw new Exception("$CS_MOStatus_Error $CS_Param_MOStatus="+mo.MOStatus);
//				}
//				#endregion
//				#region 检查ID状态
//				if (actionEventArgs.ProductInfo.LastSimulation.ProductStatus !=ProductStatus.GOOD)
//				{
//					throw new Exception("$CS_ProductStatusError $CS_Param_ProductStatus="+actionEventArgs.ProductInfo.LastSimulation.ProductStatus);
//				}
//				#endregion
//				#region Action检查
//				dataCollectFacade.CheckRepeatCollect(actionEventArgs.ProductInfo.LastSimulation.ActionList,actionEventArgs.ActionType);
//				#endregion
//				#region 检查途程
//
//				#endregion
//				#region 填写新SIMULATION
//				messages.AddMessages( dataCollectFacade.WriteSimulation(actionEventArgs.RunningCard,actionEventArgs.ActionType,actionEventArgs.ResourceCode,actionEventArgs.UserCode,actionEventArgs.ProductInfo));
//				//线外站已经做过良品采集
//				if (actionEventArgs.ProductInfo.LastSimulation.LastAction ==ActionType.DataCollectAction_OutLineGood)
//				{
//					dataCollectDebug.DebugPoint(messages,"线外站已经做过良品采集");
//					actionEventArgs.ProductInfo.NowSimulation.ActionList=actionEventArgs.ProductInfo.LastSimulation.ActionList +actionEventArgs.ActionType+";";
//					actionEventArgs.ProductInfo.NowSimulation.FromOP =actionEventArgs.ProductInfo.LastSimulation.FromOP;
//					actionEventArgs.ProductInfo.NowSimulation.FromRoute =actionEventArgs.ProductInfo.LastSimulation.FromRoute;
//				}
//				else
//				{
//					dataCollectDebug.DebugPoint(messages,"进入线外站");
//					actionEventArgs.ProductInfo.NowSimulation.ActionList=";"+actionEventArgs.ActionType+";";
//					actionEventArgs.ProductInfo.NowSimulation.FromOP =actionEventArgs.ProductInfo.LastSimulation.OPCode;
//					actionEventArgs.ProductInfo.NowSimulation.FromRoute =actionEventArgs.ProductInfo.LastSimulation.RouteCode;
//				}
//				actionEventArgs.ProductInfo.NowSimulation.MOCode=actionEventArgs.ProductInfo.LastSimulation.MOCode;
//				actionEventArgs.ProductInfo.NowSimulation.ItemCode=actionEventArgs.ProductInfo.LastSimulation.ItemCode;				;
//				actionEventArgs.ProductInfo.NowSimulation.ModelCode=actionEventArgs.ProductInfo.LastSimulation.ModelCode;
//				actionEventArgs.ProductInfo.NowSimulation.IDMergeRule =actionEventArgs.ProductInfo.LastSimulation.IDMergeRule;
//
//				actionEventArgs.ProductInfo.NowSimulation.RunningCard=actionEventArgs.RunningCard;
//				actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence =actionEventArgs.ProductInfo.LastSimulation.RunningCardSequence+1;
//				actionEventArgs.ProductInfo.NowSimulation.TranslateCard=actionEventArgs.ProductInfo.LastSimulation.TranslateCard;
//				actionEventArgs.ProductInfo.NowSimulation.TranslateCardSequence=actionEventArgs.ProductInfo.LastSimulation.TranslateCardSequence;
//				actionEventArgs.ProductInfo.NowSimulation.SourceCard=actionEventArgs.ProductInfo.LastSimulation.SourceCard;
//				actionEventArgs.ProductInfo.NowSimulation.SourceCardSequence=actionEventArgs.ProductInfo.LastSimulation.SourceCardSequence;
//
//				actionEventArgs.ProductInfo.NowSimulation.RouteCode =	ActionOnLineHelper.StringNull;
//				actionEventArgs.ProductInfo.NowSimulation.OPCode =opCode;
//				actionEventArgs.ProductInfo.NowSimulation.ResourceCode=actionEventArgs.ResourceCode;
//
//
//				actionEventArgs.ProductInfo.NowSimulation.LastAction =actionEventArgs.ActionType;
//
//				actionEventArgs.ProductInfo.NowSimulation.IsComplete =ProductComplete.NoComplete;
//
//				actionEventArgs.ProductInfo.NowSimulation.CartonCode =actionEventArgs.ProductInfo.LastSimulation.CartonCode;
//				actionEventArgs.ProductInfo.NowSimulation.LOTNO =actionEventArgs.ProductInfo.LastSimulation.LOTNO;
//				actionEventArgs.ProductInfo.NowSimulation.PalletCode =actionEventArgs.ProductInfo.LastSimulation.PalletCode;
//				if (actionEventArgs.ActionType ==ActionType.DataCollectAction_OutLineNG)
//				{
//					actionEventArgs.ProductInfo.NowSimulation.NGTimes =actionEventArgs.ProductInfo.LastSimulation.NGTimes+1;
//					dataCollectDebug.DebugPoint(messages,"NG+1="+actionEventArgs.ProductInfo.NowSimulation.NGTimes.ToString());
//					actionEventArgs.ProductInfo.NowSimulation.ProductStatus =ProductStatus.NG;
//				}
//				else
//				{
//					dataCollectDebug.DebugPoint(messages,"GOOD");
//					actionEventArgs.ProductInfo.NowSimulation.ProductStatus=ProductStatus.GOOD;
//				}
//				#endregion
                #endregion
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #25
0
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            ((GoToMOActionEventArgs)actionEventArgs).MOCode = ((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim().ToUpper();
            actionEventArgs.LotCode = actionEventArgs.LotCode.Trim().ToUpper();

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

            dataCollectDebug.WhenFunctionIn(messages);

            if (((GoToMOActionEventArgs)actionEventArgs).MOCode.Trim() == String.Empty)
            {
                messages.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_MOCode"));
            }

            if (((GoToMOActionEventArgs)actionEventArgs).LotCode.Trim() == String.Empty)
            {
                messages.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Input_RunningCard"));
            }
            //add by hiro.chen 08/11/18 checkISDown
            DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);

            //messages.AddMessages(dataCollectFacade.CheckISDown(((GoToMOActionEventArgs)actionEventArgs).LotCode.Trim()));
            //end

            try
            {
                if (messages.IsSuccess())
                {
                    actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = (actionEventArgs as GoToMOActionEventArgs).Memo;
                    //actionEventArgs.ProductInfo.NowSimulation.RMABillCode = (actionEventArgs as GoToMOActionEventArgs).ProductInfo.CurrentMO.MOCode;

                    messages.AddMessages(this.CheckIn(actionEventArgs));
                    // Added by Icyer 2006/12/05
                    TakeDownCarton(actionEventArgs);
                    // Added end

                    //Laws Lu,2006/07/05 add support RMA
                    if (actionEventArgs.CurrentMO != null)
                    {
                        actionEventArgs.ProductInfo.NowSimulation.RMABillCode = actionEventArgs.CurrentMO.RMABillCode;
                    }

                    if (!((GoToMOActionEventArgs)actionEventArgs).PassCheck)
                    {
                        throw new Exception("$CS_ID_Has_Already_Belong_To_This_MO $CS_Param_ID="
                                            + actionEventArgs.LotCode + " $Domain_MO=" + ((GoToMOActionEventArgs)actionEventArgs).MOCode);
                    }

                    if (messages.IsSuccess())
                    {
                        ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                        //actionEventArgs.ProductInfo.NowSimulation.Eattribute1 = (actionEventArgs as GoToMOActionEventArgs).Memo;

                        // Added By Hi1/Venus Feng on 20081114 for Hisense Version : remove pallet and carton
                        // 拆箱和拆Pallet
                        DataCollectFacade dcf = new DataCollectFacade(this.DataProvider);


                        // End Added

                        messages.AddMessages(dataCollect.Execute(actionEventArgs));

                        if (messages.IsSuccess())
                        {
                            //Laws Lu,2005/10/24,注释
                            // Added by Jane Shu	Date:2005/06/02
                            //							if ( actionEventArgs.ProductInfo.NowSimulation != null )
                            //							{
                            //this.updateMOQty(actionEventArgs.ProductInfo.NowSimulation.MOCode, actionEventArgs.UserCode);
                            this.updateItem2Route(actionEventArgs.ProductInfo.NowSimulation.ItemCode, actionEventArgs.ProductInfo.NowSimulation.RouteCode, actionEventArgs.UserCode);
                            //							}

                            // 将ID添加到MO范围表内		Added by Jane Shu	Date:2005/06/03
                            MORunningCardFacade cardFacade = new MORunningCardFacade(this.DataProvider);
                            MORunningCard       card       = cardFacade.CreateNewMORunningCard();

                            DBDateTime dbDateTime;
                            //Laws Lu,2006/11/13 uniform system collect date
                            //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;
                            }

                            card.MOCode             = ((GoToMOActionEventArgs)actionEventArgs).MOCode.ToString();
                            card.MORunningCardStart = actionEventArgs.LotCode;
                            card.MORunningCardEnd   = actionEventArgs.LotCode;
                            card.MaintainUser       = actionEventArgs.UserCode;

                            card.MaintainDate = dbDateTime.DBDate;
                            card.MaintainTime = dbDateTime.DBTime;

                            card.EAttribute1 = (actionEventArgs as GoToMOActionEventArgs).Memo;
                            // Added by Icyer 2007/07/02
                            MOFacade moFacade = new MOFacade(this.DataProvider);
                            MO       mo       = (MO)moFacade.GetMO(card.MOCode);
                            card.MOSeq = mo.MOSeq;
                            // Added end

                            cardFacade.AddMORunningCard(card);


                            //ReportHelper reportCollect = new ReportHelper(this.DataProvider);
                            //messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }

            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #26
0
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            TryEventArgs tryEventArgs = actionEventArgs as TryEventArgs;
            DBDateTime   dbDateTime   = FormatHelper.GetNowDBDateTime(this.DataProvider);
            int          date         = dbDateTime.DBDate;
            int          time         = dbDateTime.DBTime;
            string       userCode     = tryEventArgs.UserCode;

            string tryCode   = tryEventArgs.TryCode.Trim().ToUpper();
            string mItemCode = tryEventArgs.MItemCode.Trim().ToUpper();
            string mCard     = tryEventArgs.MRunningCard.Trim().ToUpper();
            string itemCode  = tryEventArgs.ItemCode.Trim().ToUpper();
            string rCard     = tryEventArgs.RunningCard.Trim().ToUpper();

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                TryFacade tryFacade = new TryFacade(this.DataProvider);

                //用于上料或者carton采集
                if (tryEventArgs.ForCollect)
                {
                    if (string.IsNullOrEmpty(tryEventArgs.MRunningCard))
                    {
                        List <string> TryCodeList = new List <string>();
                        if (tryEventArgs.TryCode.Trim().Length > 0)
                        {
                            if (tryEventArgs.TryCode.IndexOf(",") >= 0)
                            {
                                string[] TryCode = tryEventArgs.TryCode.Split(',');
                                for (int i = 0; i < TryCode.Length; i++)
                                {
                                    TryCodeList.Add(TryCode[i]);
                                }
                            }
                            else
                            {
                                TryCodeList.Add(tryEventArgs.TryCode.Trim());
                            }

                            for (int i = 0; i < TryCodeList.Count; i++)
                            {
                                string TryCode = TryCodeList[i].ToString().Trim().ToUpper();

                                Try2RCard try2RCard = (Try2RCard)tryFacade.GetTry2RCard(TryCode, tryEventArgs.RunningCard, tryEventArgs.ItemCode);
                                if (try2RCard == null)
                                {
                                    try2RCard = tryFacade.CreateNewTry2RCard();

                                    try2RCard.TryCode      = TryCode;
                                    try2RCard.RCard        = tryEventArgs.RunningCard;
                                    try2RCard.ItemCode     = tryEventArgs.ItemCode;
                                    try2RCard.OPCode       = tryEventArgs.OPCode;
                                    try2RCard.MaintainDate = date;
                                    try2RCard.MaintainTime = time;
                                    try2RCard.MaintainUser = userCode;
                                    try2RCard.EAttribute1  = " ";

                                    tryFacade.AddTry2RCard(try2RCard);

                                    object objectTry = tryFacade.GetTry(TryCode);
                                    if (objectTry != null)
                                    {
                                        ((Try)objectTry).ActualQty   += 1;
                                        ((Try)objectTry).Status       = TryStatus.STATUS_PRODUCE;
                                        ((Try)objectTry).MaintainDate = date;
                                        ((Try)objectTry).MaintainTime = time;
                                        ((Try)objectTry).MaintainUser = userCode;
                                        if (tryEventArgs.ForLinkLot)
                                        {
                                            ((Try)objectTry).LinkLot = "Y";
                                        }
                                        else
                                        {
                                            if (((Try)objectTry).LinkLot != "Y")
                                            {
                                                ((Try)objectTry).LinkLot = "N";
                                            }
                                        }

                                        if (string.IsNullOrEmpty(((Try)objectTry).LinkLot))
                                        {
                                            ((Try)objectTry).LinkLot = "N";
                                        }

                                        tryFacade.UpdateTry((Try)objectTry);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        object[] try2RCardList = tryFacade.QueryTry2RCard(tryCode, mCard, mItemCode);
                        if (try2RCardList != null)
                        {
                            foreach (Try2RCard try2RCard in try2RCardList)
                            {
                                Try2RCard try2RCardParent = (Try2RCard)tryFacade.GetTry2RCard(try2RCard.TryCode, rCard, itemCode);
                                if (try2RCardParent == null)
                                {
                                    try2RCardParent = tryFacade.CreateNewTry2RCard();

                                    try2RCardParent.TryCode      = try2RCard.TryCode;
                                    try2RCardParent.RCard        = rCard;
                                    try2RCardParent.ItemCode     = itemCode;
                                    try2RCardParent.OPCode       = tryEventArgs.OPCode;
                                    try2RCardParent.MaintainDate = date;
                                    try2RCardParent.MaintainTime = time;
                                    try2RCardParent.MaintainUser = userCode;
                                    try2RCardParent.EAttribute1  = " ";

                                    tryFacade.AddTry2RCard(try2RCardParent);

                                    object objectTry = tryFacade.GetTry(try2RCard.TryCode);
                                    if (objectTry != null)
                                    {
                                        //((Try)objectTry).ActualQty += 1;
                                        ////((Try)objectTry).Status = TryStatus.STATUS_PRODUCE;
                                        //((Try)objectTry).MaintainDate = date;
                                        //((Try)objectTry).MaintainTime = time;
                                        //((Try)objectTry).MaintainUser = userCode;
                                        ////隐形的LINKLOT不改变 changed by hiro 2009/01/19
                                        ////if (tryEventArgs.ForLinkLot)
                                        ////{
                                        ////    ((Try)objectTry).LinkLot = "Y";
                                        ////}
                                        ////else
                                        ////{
                                        ////    if (((Try)objectTry).LinkLot != "Y")
                                        ////    {
                                        ////        ((Try)objectTry).LinkLot = "N";
                                        ////    }
                                        ////}

                                        ////if (string.IsNullOrEmpty(((Try)objectTry).LinkLot))
                                        ////{
                                        ////    ((Try)objectTry).LinkLot = "N";
                                        ////}
                                        //tryFacade.UpdateTry((Try)objectTry);
                                    }
                                }
                            }
                        }
                    }
                }
                //用于拆解
                else
                {
                    object[] try2RCardList = tryFacade.QueryTry2RCard(tryCode, mCard, mItemCode);

                    if (try2RCardList != null)
                    {
                        foreach (Try2RCard try2RCard in try2RCardList)
                        {
                            Try2RCard try2RCardParent = (Try2RCard)tryFacade.GetTry2RCard(try2RCard.TryCode, rCard, itemCode);

                            if (try2RCardParent != null)
                            {
                                Try objectTry = (Try)tryFacade.GetTry(try2RCard.TryCode);
                                if (objectTry != null)
                                {
                                    objectTry.ActualQty   -= 1;
                                    objectTry.MaintainDate = date;
                                    objectTry.MaintainTime = time;
                                    objectTry.MaintainUser = userCode;

                                    tryFacade.UpdateTry(objectTry);
                                }

                                tryFacade.DeleteTry2RCard(try2RCardParent);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }

            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #27
0
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //填写SIMULATION 检查工单、ID、途程、操作
                // 联美兰达的下料不检查途程
                //messages.AddMessages( dataCollect.CheckID(actionEventArgs));
                if (messages.IsSuccess())
                {
                    // 联美兰达下料不更新Simulation
                    //messages.AddMessages( dataCollect.Execute(actionEventArgs));
                    if (messages.IsSuccess())
                    {
                        /*	由于界面上会自动调用GOOD采集,因此不用写报表
                         * //填写测试报表
                         * ReportHelper reportCollect= new ReportHelper(this.DataProvider);
                         * messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo));
                         * messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo));
                         */

                        //Laws Lu,2005/10/20,新增	使用配置文件来控制物料模块是否使用
                        if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                        {
                            BenQGuru.eMES.Material.CastDownHelper castHelper = new BenQGuru.eMES.Material.CastDownHelper(DataProvider);
                            ArrayList arRcard = new ArrayList();


                            castHelper.GetAllRCardByMo(ref arRcard, actionEventArgs.ProductInfo.NowSimulation.RunningCard, actionEventArgs.ProductInfo.NowSimulation.MOCode);
                            if (arRcard.Count == 0)
                            {
                                arRcard.Add(actionEventArgs.RunningCard);
                            }
                            string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')";

                            object[] objs = (actionEventArgs as DropMaterialEventArgs).OnwipItems;
                            //下料并归还库房
                            BenQGuru.eMES.Material.WarehouseFacade wfacade = new BenQGuru.eMES.Material.WarehouseFacade(this.DataProvider);
                            wfacade.RemoveWarehouse(
                                objs
                                , runningCards
                                , actionEventArgs.ProductInfo.NowSimulation.MOCode
                                , actionEventArgs.UserCode
                                , actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode
                                , actionEventArgs.ProductInfo.NowSimulation.OPCode);
                        }
                        else    // Added by Icyer 2006/11/16
                        {
                            DropMaterialEventArgs arg = (DropMaterialEventArgs)actionEventArgs;
                            if (arg.OnwipItems != null)
                            {
                                // 查询需要管控的KeyPart
                                ArrayList listKeyPart    = new ArrayList();
                                ArrayList listAllKeyPart = new ArrayList();

                                //ArrayList partsToUnload = new ArrayList();
                                //ArrayList partsToReplace = new ArrayList();

                                //for (int i = 0; i < arg.OnwipItems.Length; i++)
                                //{
                                //    BenQGuru.eMES.Material.InnoObject io = (BenQGuru.eMES.Material.InnoObject)arg.OnwipItems[i];

                                //    if (io.NewBarcode.Trim().Length > 0)
                                //        partsToReplace.Add(io);
                                //    else
                                //        partsToUnload.Add(io);
                                //}

                                string            sql               = string.Empty;
                                CastDownHelper    castDownHelper    = new CastDownHelper(DataProvider);
                                BaseModelFacade   baseModelFacade   = new BaseModelFacade(this.DataProvider);
                                DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                                ShiftModelFacade  shiftModelFacade  = new ShiftModelFacade(this.DataProvider);

                                DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                                foreach (InnoObject io in arg.OnwipItems)
                                {
                                    //获取arRcard
                                    ArrayList arRcard = new ArrayList();
                                    castDownHelper.GetAllRCard(ref arRcard, actionEventArgs.ProductInfo.NowSimulation.RunningCard);
                                    if (arRcard.Count == 0)
                                    {
                                        arRcard.Add(actionEventArgs.RunningCard);
                                    }

                                    //获取dropop
                                    Operation2Resource objOP  = baseModelFacade.GetOperationByResource(arg.ResourceCode);
                                    string             dropop = string.Empty;
                                    if (objOP != null)
                                    {
                                        dropop = objOP.OPCode;
                                    }

                                    #region 针对旧料所作的动作

                                    string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')";
                                    sql = string.Format("update TBLONWIPITEM set TRANSSTATUS='{0}',ActionType=" + (int)MaterialType.DropMaterial +
                                                        ",DropOP = '" + dropop + "'" +
                                                        ",DropUser='******'" +
                                                        ",DropDate=" + dbDateTime.DBDate +
                                                        ",DropTime=" + dbDateTime.DBTime +
                                                        " where RCARD in {1} and ActionType='{2}'" +
                                                        " and MCARD in ('" + io.MCard.Trim().ToUpper() + "')"
                                                        , TransactionStatus.TransactionStatus_YES
                                                        , runningCards
                                                        , (int)Web.Helper.MaterialType.CollectMaterial);
                                    this.DataProvider.CustomExecute(new SQLCondition(sql));

                                    if (io.MCardType == MCardType.MCardType_Keyparts)
                                    {
                                        sql = "update TBLSIMULATIONREPORT set IsLoadedPart='0',LoadedRCard='' " +
                                              " where RCARD in ('" + io.MCard.Trim().ToUpper() + "')";
                                        this.DataProvider.CustomExecute(new SQLCondition(sql));

                                        sql = "update TBLITEMLOTDETAIL set SERIALSTATUS='STORAGE' " +
                                              " where SERIALNO in ('" + io.MCard.Trim().ToUpper() + "')";
                                        this.DataProvider.CustomExecute(new SQLCondition(sql));
                                    }

                                    #endregion

                                    #region 针对新料所做的动作

                                    if (io.NewBarcode.Trim().Length > 0)
                                    {
                                        object[] oldOnWIPItemList = dataCollectFacade.QueryOnWIPItem(io.MCard, runningCards, ((int)Web.Helper.MaterialType.DropMaterial).ToString());

                                        if (oldOnWIPItemList != null && oldOnWIPItemList.Length > 0)
                                        {
                                            OnWIPItem oldOnWIPItem = (OnWIPItem)oldOnWIPItemList[0];
                                            OnWIPItem newOnWIPItem = dataCollectFacade.CreateNewOnWIPItem();

                                            newOnWIPItem.RunningCard      = oldOnWIPItem.RunningCard;
                                            newOnWIPItem.MSequence        = oldOnWIPItem.MSequence;
                                            newOnWIPItem.MOCode           = oldOnWIPItem.MOCode;
                                            newOnWIPItem.ModelCode        = oldOnWIPItem.ModelCode;
                                            newOnWIPItem.ItemCode         = oldOnWIPItem.ItemCode;
                                            newOnWIPItem.MItemCode        = oldOnWIPItem.MItemCode;
                                            newOnWIPItem.MCardType        = oldOnWIPItem.MCardType;
                                            newOnWIPItem.Qty              = oldOnWIPItem.Qty;
                                            newOnWIPItem.RouteCode        = oldOnWIPItem.RouteCode;
                                            newOnWIPItem.OPCode           = oldOnWIPItem.OPCode;
                                            newOnWIPItem.ResourceCode     = oldOnWIPItem.ResourceCode;
                                            newOnWIPItem.SegmentCode      = oldOnWIPItem.SegmentCode;
                                            newOnWIPItem.StepSequenceCode = oldOnWIPItem.StepSequenceCode;
                                            newOnWIPItem.EAttribute1      = oldOnWIPItem.EAttribute1;
                                            newOnWIPItem.MOSeq            = oldOnWIPItem.MOSeq;

                                            newOnWIPItem.MCARD          = io.NewBarcode;
                                            newOnWIPItem.LotNO          = io.NewLotNo;
                                            newOnWIPItem.PCBA           = io.NewPCBA;
                                            newOnWIPItem.BIOS           = io.NewBIOS;
                                            newOnWIPItem.Version        = io.NewVersion;
                                            newOnWIPItem.VendorItemCode = io.NewVendorItemCode;
                                            newOnWIPItem.VendorCode     = io.NewVendorCode;
                                            newOnWIPItem.DateCode       = io.NewDateCode;

                                            newOnWIPItem.TransactionStatus = TransactionStatus.TransactionStatus_NO;
                                            newOnWIPItem.ActionType        = (int)Web.Helper.MaterialType.CollectMaterial;
                                            newOnWIPItem.MaintainUser      = actionEventArgs.UserCode;
                                            newOnWIPItem.MaintainDate      = dbDateTime.DBDate;
                                            newOnWIPItem.MaintainTime      = dbDateTime.DBTime;

                                            //RunningCardSequence取当前RCard的最小再减一
                                            newOnWIPItem.RunningCardSequence = dataCollectFacade.GetMinRCardSequenceFromOnWipItem(runningCards);

                                            //重新抓取ShiftTypeCode、ShiftCode、TimePeriodCode
                                            StepSequence stepSequence = (StepSequence)baseModelFacade.GetStepSequence(newOnWIPItem.StepSequenceCode);
                                            if (stepSequence == null)
                                            {
                                                newOnWIPItem.ShiftTypeCode = stepSequence.ShiftTypeCode;
                                            }
                                            else
                                            {
                                                newOnWIPItem.ShiftTypeCode = oldOnWIPItem.ShiftTypeCode;
                                            }

                                            TimePeriod timePeriod = (TimePeriod)shiftModelFacade.GetTimePeriod(newOnWIPItem.ShiftTypeCode, dbDateTime.DBTime);
                                            if (timePeriod != null)
                                            {
                                                newOnWIPItem.TimePeriodCode = timePeriod.TimePeriodCode;
                                                newOnWIPItem.ShiftCode      = timePeriod.ShiftCode;
                                            }

                                            dataCollectFacade.AddOnWIPItem(newOnWIPItem);
                                        }

                                        if (io.MCardType == MCardType.MCardType_Keyparts)
                                        {
                                            sql = "update TBLSIMULATIONREPORT set IsLoadedPart='1',LoadedRCard='" + String.Join(",", (string[])arRcard.ToArray(typeof(string))) + "' " +
                                                  " where RCARD in ('" + io.NewBarcode.Trim().ToUpper() + "')";
                                            this.DataProvider.CustomExecute(new SQLCondition(sql));

                                            sql = "update TBLITEMLOTDETAIL set SERIALSTATUS='UNSTORAGE' " +
                                                  " where SERIALNO in ('" + io.NewBarcode.Trim().ToUpper() + "')";
                                            this.DataProvider.CustomExecute(new SQLCondition(sql));
                                        }

                                        // Added By Hi1/Venus.feng on 20081114 for Hisense Version : Add Remove Pallet and Carton
                                        // 拆箱和拆Pallet
                                        DataCollectFacade dcf = new DataCollectFacade(this.DataProvider);

                                        if (messages.IsSuccess())
                                        {
                                            messages.AddMessages(dcf.RemoveFromPallet(io.NewBarcode.Trim().ToUpper(), actionEventArgs.UserCode, true));
                                            if (messages.IsSuccess())
                                            {
                                                messages.ClearMessages();
                                            }
                                        }

                                        if (messages.IsSuccess())
                                        {
                                            messages.AddMessages(dcf.RemoveFromCarton(io.NewBarcode.Trim().ToUpper(), actionEventArgs.UserCode));
                                            if (messages.IsSuccess())
                                            {
                                                messages.ClearMessages();
                                            }
                                        }
                                        // End Added
                                    }

                                    #endregion
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #28
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">转换后的ID组</param>
        /// <param name="datas2">NULL</param>
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            // Added by Icyer 2006/10/08
            if (((SplitIDActionEventArgs)actionEventArgs).IsUndo == true)
            {
                return(this.UndoExecute((SplitIDActionEventArgs)actionEventArgs));
            }
            // Added end

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

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                if (((SplitIDActionEventArgs)actionEventArgs).SplitedIDs == null || ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length == 0)
                {
                    throw new Exception("$CS_System_Params_Losted");
                }

                ActionOnLineHelper helper            = new ActionOnLineHelper(this.DataProvider);
                DataCollectFacade  dataCollectFacade = new DataCollectFacade(this.DataProvider);

                //laura:  GetLastSimulation into NowSimulation
                string sourcCard = actionEventArgs.ProductInfo.LastSimulation.RunningCard.ToUpper();

                //GetLastSimulation 是获取当前open工单中的一笔,GetSimulation 是获取所有simulation中mdate 最晚的一笔。
                Simulation objSimulation = dataCollectFacade.GetSimulation(sourcCard) as Simulation;
                if (objSimulation == null)
                {
                    throw new Exception("rcard in simulation not existed!");
                }
                actionEventArgs.ProductInfo.NowSimulation = objSimulation;

                //laura:  GetLastSimulationReport into NowSimulationReport
                SimulationReport objSimulationReport = dataCollectFacade.GetLastSimulationReport(sourcCard) as SimulationReport;
                if (objSimulationReport == null)
                {
                    throw new Exception("rcard in simulationreport not existed!");
                }
                actionEventArgs.ProductInfo.NowSimulationReport = objSimulationReport;

                //laura:  如果需要,补充 ProductInfo 信息
                //to-do...

                //
                actionEventArgs.ProductInfo.NowSimulation.IDMergeRule           = 1; //actionEventArgs.ProductInfo.NowSimulation.IDMergeRule/((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length;
                actionEventArgs.ProductInfo.NowSimulation.TranslateCard         = actionEventArgs.ProductInfo.LastSimulation.RunningCard;
                actionEventArgs.ProductInfo.NowSimulation.TranslateCardSequence = actionEventArgs.ProductInfo.LastSimulation.RunningCardSequence;
                actionEventArgs.ProductInfo.NowSimulation.NGTimes = actionEventArgs.ProductInfo.LastSimulation.NGTimes;

                for (int i = 0; i < ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs.Length; i++)
                {
                    //修改SIMULATION
                    //Laws Lu,2005/08/15,新增	完工逻辑,在其他Check都通过的情况下,所有的RunningCard应该是GOOD状态
                    //暂时不考虑线外工序
                    if (actionEventArgs.ProductInfo.NowSimulation.RouteCode != "" && dataCollectFacade.OPIsMORouteLastOP(
                            actionEventArgs.ProductInfo.NowSimulation.MOCode
                            , actionEventArgs.ProductInfo.NowSimulation.RouteCode
                            , actionEventArgs.ProductInfo.NowSimulation.OPCode))
                    {
                        actionEventArgs.ProductInfo.NowSimulation.IsComplete  = "1";
                        actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = "GOOD";
                    }
                    //End Laws Lu
                    actionEventArgs.ProductInfo.NowSimulation.RunningCard = ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs[i].ToString();
                    /* added by jessie lee,如果是 序列号转换 */
                    if (string.Compare((actionEventArgs as SplitIDActionEventArgs).IDMergeType, IDMergeType.IDMERGETYPE_IDMERGE, true) == 0)
                    {
                        /* 转换到同一张工单 */
                        if ((actionEventArgs as SplitIDActionEventArgs).UpdateSimulation)
                        {
                            actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence
                                = (actionEventArgs as SplitIDActionEventArgs).ExistIMEISeq + 10;
                        }
                        else
                        {
                            actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence = ActionOnLineHelper.StartSeq;
                        }
                    }
                    else
                    {
                        /* 不是 序列号转换 */
                        actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence = ActionOnLineHelper.StartSeq;
                    }
                    actionEventArgs.ProductInfo.NowSimulation.MOSeq = actionEventArgs.ProductInfo.LastSimulation.MOSeq;     // Added by Icyer 2007/07/03

                    //messages.AddMessages(helper.Execute(actionEventArgs));
                    //messages.AddMessages(helper.Execute(actionEventArgs, true,false));  //线外工序,不用 insert tblonwip。

                    if (messages.IsSuccess())
                    {
                        //#region 将ID添加到MO2RCARDLINK范围表内
                        DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider);
                        //MOFacade _MOFacade = new MOFacade(this.DataProvider);
                        //MO2RCARDLINK mo2cardlink = new MO2RCARDLINK();
                        //mo2cardlink.MOCode = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                        //mo2cardlink.RCard = ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs[i].ToString().Trim().ToUpper();
                        //mo2cardlink.MDate = dbDateTime.DBDate;
                        //mo2cardlink.MUser = actionEventArgs.UserCode;
                        //mo2cardlink.MTime = dbDateTime.DBTime;
                        //mo2cardlink.PrintTimes = 0;
                        //mo2cardlink.LastPrintUSER = "";
                        //mo2cardlink.LastPrintDate = 0;
                        //mo2cardlink.LastPrintTime = 0;
                        //_MOFacade.AddMO2RCardLink(mo2cardlink);
                        //#endregion

                        #region 将ID添加到SplitBoard
                        SplitBoard splitBorad = new SplitBoard();
                        splitBorad.Seq           = actionEventArgs.ProductInfo.NowSimulation.RunningCardSequence;
                        splitBorad.Mocode        = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                        splitBorad.Rcard         = ((SplitIDActionEventArgs)actionEventArgs).SplitedIDs[i].ToString().Trim().ToUpper();
                        splitBorad.Modelcode     = actionEventArgs.ProductInfo.NowSimulation.ModelCode;
                        splitBorad.Itemcode      = actionEventArgs.ProductInfo.NowSimulation.ItemCode;
                        splitBorad.Opcode        = actionEventArgs.ProductInfo.NowSimulation.OPCode;
                        splitBorad.Rescode       = actionEventArgs.ResourceCode;
                        splitBorad.Routecode     = actionEventArgs.ProductInfo.NowSimulation.RouteCode;
                        splitBorad.Scard         = actionEventArgs.ProductInfo.NowSimulation.SourceCard;
                        splitBorad.Segcode       = actionEventArgs.ProductInfo.NowSimulationReport.SegmentCode;
                        splitBorad.Shiftcode     = actionEventArgs.ProductInfo.NowSimulationReport.ShiftCode;
                        splitBorad.Shifttypecode = actionEventArgs.ProductInfo.NowSimulationReport.ShiftTypeCode;
                        splitBorad.Sscode        = actionEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode;
                        splitBorad.Tpcode        = actionEventArgs.ProductInfo.NowSimulationReport.TimePeriodCode;
                        splitBorad.Muser         = actionEventArgs.UserCode;
                        splitBorad.Mdate         = dbDateTime.DBDate;
                        splitBorad.Mtime         = dbDateTime.DBTime;
                        dataCollectFacade.AddSplitBoard(splitBorad);
                        #endregion
                    }
                }
                //}
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }
Example #29
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"></param>
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            Messages msgAutoGoMO = new Messages();              // Added by Icyer 2007/03/09

            try
            {
                // Added by Icyer 2007/03/09
                // 检测自动归属工单
                ActionGoToMO actionGoToMO = new ActionGoToMO(this.DataProvider);
                msgAutoGoMO = actionGoToMO.AutoGoMO(actionEventArgs);
                // Added end

                // Added by Icyer 2006/12/03
                // 自动做Undo
                //messages.AddMessages((new ActionUndoNG(this.DataProvider)).UndoNG(actionEventArgs));
                // Added end
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(dataCollect.CheckID(actionEventArgs));
                if (messages.IsSuccess())
                {
                    //补充SIMULATION 不良信息
                    actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.NG;
                    actionEventArgs.ProductInfo.NowSimulation.NGTimes       = actionEventArgs.ProductInfo.NowSimulation.NGTimes + 1;
                    actionEventArgs.ProductInfo.NowSimulation.GoodQty       = 0;
                    actionEventArgs.ProductInfo.NowSimulation.NGQty         = actionEventArgs.ProductInfo.NowSimulation.LotQty;
                    if (actionEventArgs.CurrentMO != null)
                    {
                        actionEventArgs.ProductInfo.NowSimulation.RMABillCode = actionEventArgs.CurrentMO.RMABillCode;
                    }
                    else
                    {
                        MO mo = (new MOFacade(DataProvider)).GetMO(actionEventArgs.ProductInfo.NowSimulation.MOCode) as MO;
                        actionEventArgs.CurrentMO = mo;
                        actionEventArgs.ProductInfo.NowSimulation.RMABillCode = mo.RMABillCode;
                    }

                    messages.AddMessages(dataCollect.Execute(actionEventArgs, null, false, false));
                    if (messages.IsSuccess())
                    {
                        //Laws Lu,2005/12/19,新增	获取ErrorGroup2ErrorCode
                        if (actionEventArgs.ActionType == ActionType.DataCollectAction_NG)
                        {
                            actionEventArgs.ProductInfo.ECG2ErrCodes = ParseECGECQty(((TSActionEventArgs)actionEventArgs).ErrorCodes, actionEventArgs.ActionType);
                        }
                        else
                        {
                            actionEventArgs.ProductInfo.ECG2ErrCodes = ParseECGECQty(((TSActionEventArgs)actionEventArgs).ErrorInfor, actionEventArgs.ActionType);
                        }

                        //填写测试不良数据
                        messages.AddMessages(dataCollect.CollectErrorInformation(this.DataProvider, actionEventArgs.ActionType, actionEventArgs.ProductInfo, ((TSActionEventArgs)actionEventArgs).ErrorCodes, null, ((TSActionEventArgs)actionEventArgs).Memo));

                        // Added By Hi1/Venus.Feng on 20080711 for Hisense Version : Auto Set RCard Reflow Route and OP by ErrorCode
                        //if (messages.IsSuccess() == true)
                        //{
                        //    messages.AddMessages(this.SetRCardReflowByErrorCode(actionEventArgs));
                        //}
                    }

                    if (messages.IsSuccess())
                    {
                        DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);
                        //dataCollectFacade.TryToDeleteRCardFromLot(actionEventArgs.LotCode);
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            //return messages;
            if (msgAutoGoMO.Count() < 1 || (msgAutoGoMO.IsSuccess() == true && messages.IsSuccess() == false))
            {
                return(messages);
            }
            else
            {
                msgAutoGoMO.IgnoreError();
                msgAutoGoMO.AddMessages(messages);
                return(msgAutoGoMO);
            }
        }
Example #30
0
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            try
            {
                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(dataCollect.CheckID(actionEventArgs));

                //检查是否完工
                if (actionEventArgs.ProductInfo.LastSimulation.IsComplete == "1")
                {
                    messages.Add(new UserControl.Message(MessageType.Error, "$CS_PRODUCT_ALREADY_COMPLETE $CS_Param_OPCode  =" + actionEventArgs.ProductInfo.LastSimulation.OPCode));
                }
                if (messages.IsSuccess())
                {
                    //Laws Lu,2005/08/15,新增	完工逻辑,在其他Check都通过的情况下,所有的RunningCard应该是GOOD状态
                    //暂时不考虑线外工序
                    actionEventArgs.ProductInfo.NowSimulation.IsComplete    = "1";
                    actionEventArgs.ProductInfo.NowSimulation.EAttribute1   = ProductStatus.OffMo;
                    actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.OffMo;


                    //End Laws Lu
                    messages.AddMessages(dataCollect.Execute(actionEventArgs));
                    if (messages.IsSuccess())
                    {
                        //更新维修记录
                        if (actionEventArgs.ProductInfo.LastTS != null)
                        {
                            //2006/02/08	修改	修改维修记录状态
                            Domain.TS.TS ts = actionEventArgs.ProductInfo.LastTS;

                            TS.TSFacade tsFAC = new BenQGuru.eMES.TS.TSFacade(DataProvider);

//							if(ts.TSStatus == TSStatus.TSStatus_New)
//							{
//								tsFAC.DeleteTS(ts);
//							}
//							else
//							{
                            tsFAC.UpdateTSStatus(ts.TSId, TSStatus.TSStatus_OffMo, actionEventArgs.UserCode);
//							}

//							ts.TSId = FormatHelper.GetUniqueID(actionEventArgs.ProductInfo.NowSimulation.MOCode
//								,ts.RunningCard,ts.RunningCardSequence.ToString());
//
//							ts.MaintainUser = actionEventArgs.UserCode;
//							ts.MaintainDate = FormatHelper.TODateInt(DateTime.Now);
//							ts.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now);
//
//							ts.TSStatus = TSStatus.TSStatus_OffMo;
//
//
//							tsFAC.AddTS(ts);
                        }

                        ///下料扣库存
                        ///
                        //Laws Lu,2005/10/20,新增	使用配置文件来控制物料模块是否使用
                        if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                        {
                            BenQGuru.eMES.Material.CastDownHelper castHelper = new BenQGuru.eMES.Material.CastDownHelper(DataProvider);
                            ArrayList arRcard = new ArrayList();

                            castHelper.GetAllRCardByMo(ref arRcard, actionEventArgs.ProductInfo.NowSimulation.RunningCard, actionEventArgs.ProductInfo.NowSimulation.MOCode);

                            if (arRcard.Count == 0)
                            {
                                arRcard.Add(actionEventArgs.RunningCard);
                            }

                            string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')";
                            //下料并归还库房
                            BenQGuru.eMES.Material.WarehouseFacade wfacade = new BenQGuru.eMES.Material.WarehouseFacade(this.DataProvider);
                            wfacade.DropMaterialStock(runningCards
                                                      , actionEventArgs.ProductInfo.NowSimulation.MOCode, actionEventArgs.ProductInfo.NowSimulation.OPCode);
                        }

                        //填写测试报表 TODO
                        //ReportHelper reportCollect= new ReportHelper(this.DataProvider);
                        //messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo));
                        //messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo));

                        //填写脱离工单表
                        MOFacade moFAC = new MOFacade(DataProvider);

                        OffMoCard offCard = new OffMoCard();
                        offCard.PK     = System.Guid.NewGuid().ToString();
                        offCard.MoCode = actionEventArgs.ProductInfo.NowSimulation.MOCode;
                        offCard.RCARD  = actionEventArgs.RunningCard;
                        offCard.MoType = (actionEventArgs as OffMoEventArgs).MOType;
                        offCard.MUSER  = actionEventArgs.UserCode;
                        offCard.MDATE  = actionEventArgs.ProductInfo.NowSimulation.MaintainDate;
                        offCard.MTIME  = actionEventArgs.ProductInfo.NowSimulation.MaintainTime;


                        moFAC.AddOffMoCard(offCard);
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            return(messages);
        }