/// <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); }
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); }
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); }
/// <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); }
/// <summary> /// /// </summary> /// <param name="oqcGoodEventArgs"> </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); OQCGoodEventArgs oqcGoodEventArgs = actionEventArgs as OQCGoodEventArgs; //added by hiro.chen 08/11/18 :判断是否已下地 DataCollectFacade dcFacade = new DataCollectFacade(this.DataProvider); messages.AddMessages(dcFacade.CheckISDown(actionEventArgs.RunningCard)); if (!messages.IsSuccess()) { return(messages); } //end try { ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); ActionOQCHelper oqcHelper = new ActionOQCHelper(this.DataProvider); OQCFacade oqcFacade = new OQCFacade(this.DataProvider); // Added By Hi1/Venus.feng on 20080720 for Hisense Version : Change OQC Flow DBDateTime currentDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); // Some Check #region CheckOQCLotStatus /* * object objOQClot = oqcFacade.GetOQCLot(oqcGoodEventArgs.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_Reject) || ((((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Pass))) * { * throw new Exception("$Error_OQCLotNO_HasComplete"); * } */ #endregion // Update tbloqc.status #region 修改OQCLot状态 OQCLot oqcLot = new OQCLot(); oqcLot.LOTNO = oqcGoodEventArgs.OQCLotNO; oqcLot.LotSequence = OQCFacade.Lot_Sequence_Default; oqcLot.LOTStatus = Web.Helper.OQCLotStatus.OQCLotStatus_Examing; oqcFacade.UpdateOQCLotStatus(oqcLot); #endregion // Update tbloqccardlotcklist //Maybe need check???? #region OQCLOTCardCheckList if (oqcGoodEventArgs.OQCLOTCardCheckLists != null) { OQCLOTCardCheckList oqcLotCardCheckList; for (int i = 0; i < oqcGoodEventArgs.OQCLOTCardCheckLists.Length; i++) { if (oqcGoodEventArgs.OQCLOTCardCheckLists[i] != null) { oqcLotCardCheckList = oqcGoodEventArgs.OQCLOTCardCheckLists[i] as OQCLOTCardCheckList; oqcLotCardCheckList.MaintainDate = currentDateTime.DBDate; oqcLotCardCheckList.MaintainTime = currentDateTime.DBTime; oqcFacade.AddOQCLOTCardCheckList(oqcLotCardCheckList); } } } #endregion // Update tbloqclotcklist #region OQCLOTCheckList object obj = oqcFacade.GetOQCLOTCheckList(oqcGoodEventArgs.OQCLotNO, OQCFacade.Lot_Sequence_Default); if (obj == null) { OQCLOTCheckList oqcCheckList = oqcFacade.CreateNewOQCLOTCheckList(); oqcCheckList.AGradeTimes = OQCFacade.Decimal_Default_value; oqcCheckList.BGradeTimes = OQCFacade.Decimal_Default_value; oqcCheckList.CGradeTimes = OQCFacade.Decimal_Default_value; oqcCheckList.ZGradeTimes = OQCFacade.Decimal_Default_value; oqcCheckList.LOTNO = oqcGoodEventArgs.OQCLotNO; oqcCheckList.LotSequence = OQCFacade.Lot_Sequence_Default; oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode; oqcCheckList.MaintainDate = currentDateTime.DBDate; oqcCheckList.MaintainTime = currentDateTime.DBTime; oqcCheckList.Result = OQCLotStatus.OQCLotStatus_Examing; oqcFacade.AddOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists, oqcCheckList)); } else { OQCLOTCheckList oqcCheckList = obj as OQCLOTCheckList; oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode; oqcFacade.UpdateOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists, oqcCheckList)); } #endregion // Update tbllot2cardcheck #region OQCLot2CardCheck OQCLot2CardCheck oqcLot2CardCheck = oqcFacade.CreateNewOQCLot2CardCheck(); oqcLot2CardCheck.ItemCode = oqcGoodEventArgs.ProductInfo.LastSimulation.ItemCode; oqcLot2CardCheck.LOTNO = oqcGoodEventArgs.OQCLotNO; oqcLot2CardCheck.MaintainUser = oqcGoodEventArgs.UserCode; oqcLot2CardCheck.MOCode = oqcGoodEventArgs.ProductInfo.LastSimulation.MOCode; oqcLot2CardCheck.ModelCode = oqcGoodEventArgs.ProductInfo.LastSimulation.ModelCode; oqcLot2CardCheck.OPCode = oqcGoodEventArgs.ProductInfo.LastSimulation.OPCode; oqcLot2CardCheck.ResourceCode = oqcGoodEventArgs.ResourceCode; oqcLot2CardCheck.RouteCode = oqcGoodEventArgs.ProductInfo.LastSimulation.RouteCode; oqcLot2CardCheck.RunningCard = oqcGoodEventArgs.ProductInfo.LastSimulation.RunningCard; oqcLot2CardCheck.RunningCardSequence = oqcGoodEventArgs.ProductInfo.LastSimulation.RunningCardSequence; BaseModelFacade dataModel = new BaseModelFacade(this.DataProvider); Resource resource = (Resource)dataModel.GetResource(oqcGoodEventArgs.ResourceCode); oqcLot2CardCheck.SegmnetCode = resource.SegmentCode; TimePeriod period = oqcGoodEventArgs.ProductInfo.TimePeriod; if (period == null) { ShiftModelFacade shiftModel = new ShiftModelFacade(this.DataProvider); period = (TimePeriod)shiftModel.GetTimePeriod(resource.ShiftTypeCode, currentDateTime.DBTime); if (period == null) { throw new Exception("$OutOfPerid"); } } oqcLot2CardCheck.ShiftCode = period.ShiftCode; oqcLot2CardCheck.ShiftTypeCode = resource.ShiftTypeCode; oqcLot2CardCheck.Status = ProductStatus.GOOD; oqcLot2CardCheck.StepSequenceCode = resource.StepSequenceCode; oqcLot2CardCheck.TimePeriodCode = period.TimePeriodCode; oqcLot2CardCheck.IsDataLink = oqcGoodEventArgs.IsDataLink; oqcLot2CardCheck.MaintainDate = currentDateTime.DBDate; oqcLot2CardCheck.MaintainTime = currentDateTime.DBTime; oqcLot2CardCheck.CheckSequence = oqcGoodEventArgs.CheckSequence; oqcLot2CardCheck.EAttribute1 = oqcGoodEventArgs.Memo; oqcFacade.AddOQCLot2CardCheck(oqcLot2CardCheck); #endregion // Good don't need update lot2errorcode or lotcard2errorcode ////// Update tbloqclot2errorcode ////// Update tbloqclotcard2errorcode messages.Add(new Message(MessageType.Success, "$CS_SampleConfirmOK")); // End Added #region Marked By Hi1/Venus.Feng on 20080720 for Hisense Version : Change OQC Flow /* * //填写SIMULATION 检查工单、ID、途程、操作 * messages.AddMessages( dataCollect.CheckID(oqcGoodEventArgs)); * if (messages.IsSuccess()) * { * // * if(oqcGoodEventArgs.ProductInfo.NowSimulation == null) * { * throw new Exception("$System_Error"); * } * //check oqclotstatus #region CheckOQCLotStatus * // object objOQClot = oqcFacade.GetOQCLot(oqcGoodEventArgs.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_Reject)||((((OQCLot)objOQClot).LOTStatus == OQCLotStatus.OQCLotStatus_Pass) ) ) * // { * // throw new Exception("$Error_OQCLotNO_HasComplete"); * // } #endregion * * * messages.AddMessages( dataCollect.Execute(oqcGoodEventArgs)); * if (messages.IsSuccess()) * { * //判断是否第一笔,如果是修改oqclot #region 修改OQCLot状态 * // object[] objs = oqcFacade.ExtraQueryOQCLot2CardCheck(string.Empty,string.Empty,oqcGoodEventArgs.ProductInfo.NowSimulation.MOCode,oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default.ToString()); * // if(objs == null) * // { * //object objLot = oqcFacade.GetOQCLot(oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default); * OQCLot oqcLot = new OQCLot(); * oqcLot.LOTNO = oqcGoodEventArgs.OQCLotNO; * oqcLot.LotSequence = OQCFacade.Lot_Sequence_Default; * oqcLot.LOTStatus = Web.Helper.OQCLotStatus.OQCLotStatus_Examing; * oqcFacade.UpdateOQCLotStatus(oqcLot); * // } #endregion * * //add recrod to OQCLot2CardCheck #region OQCLot2CardCheck * OQCLot2CardCheck oqcLot2CardCheck = oqcFacade.CreateNewOQCLot2CardCheck(); * oqcLot2CardCheck.ItemCode = oqcGoodEventArgs.ProductInfo.NowSimulation.ItemCode; * oqcLot2CardCheck.LOTNO = oqcGoodEventArgs.OQCLotNO; * oqcLot2CardCheck.MaintainUser = oqcGoodEventArgs.UserCode; * oqcLot2CardCheck.MOCode = oqcGoodEventArgs.ProductInfo.NowSimulation.MOCode; * oqcLot2CardCheck.ModelCode = oqcGoodEventArgs.ProductInfo.NowSimulation.ModelCode; * oqcLot2CardCheck.OPCode = oqcGoodEventArgs.ProductInfo.NowSimulation.OPCode; * oqcLot2CardCheck.ResourceCode = oqcGoodEventArgs.ProductInfo.NowSimulation.ResourceCode; * oqcLot2CardCheck.RouteCode = oqcGoodEventArgs.ProductInfo.NowSimulation.RouteCode; * oqcLot2CardCheck.RunningCard = oqcGoodEventArgs.ProductInfo.NowSimulation.RunningCard; * oqcLot2CardCheck.RunningCardSequence = oqcGoodEventArgs.ProductInfo.NowSimulation.RunningCardSequence; * oqcLot2CardCheck.SegmnetCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.SegmentCode; * oqcLot2CardCheck.ShiftCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.ShiftCode; * oqcLot2CardCheck.ShiftTypeCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.ShiftTypeCode; * oqcLot2CardCheck.Status = ProductStatus.GOOD; * oqcLot2CardCheck.StepSequenceCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode; * oqcLot2CardCheck.TimePeriodCode = oqcGoodEventArgs.ProductInfo.NowSimulationReport.TimePeriodCode; * * oqcLot2CardCheck.IsDataLink = oqcGoodEventArgs.IsDataLink; //标识样本是不是来自数据连线 joe song 2006-06-08 * oqcLot2CardCheck.EAttribute1 = (oqcGoodEventArgs as OQCGoodEventArgs).Memo;//Laws Lu,2006/07/12 add memo field * * DBDateTime dbDateTime; * //Laws Lu,2006/11/13 uniform system collect date * if(actionEventArgs.ProductInfo.WorkDateTime != null) * { * dbDateTime = actionEventArgs.ProductInfo.WorkDateTime; * * } * else * { * dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); * actionEventArgs.ProductInfo.WorkDateTime = dbDateTime; * } * * oqcLot2CardCheck.MaintainDate = dbDateTime.DBDate; * oqcLot2CardCheck.MaintainTime = dbDateTime.DBTime; * oqcFacade.AddOQCLot2CardCheck(oqcLot2CardCheck); #endregion * * //OQCLOTCardCheckList * #region OQCLOTCardCheckList * if( oqcGoodEventArgs.OQCLOTCardCheckLists != null) * { * for(int i=0;i<oqcGoodEventArgs.OQCLOTCardCheckLists.Length;i++) * { * if( oqcGoodEventArgs.OQCLOTCardCheckLists[i] != null) * { * OQCLOTCardCheckList objCardCheck = oqcGoodEventArgs.OQCLOTCardCheckLists[i] as OQCLOTCardCheckList; * objCardCheck.RunningCardSequence = oqcGoodEventArgs.ProductInfo.NowSimulation.RunningCardSequence; * oqcFacade.AddOQCLOTCardCheckList(objCardCheck); * } * } * } #endregion * * //OQCLOTCheckList 统计 #region OQCLOTCheckList * * * object obj = oqcFacade.GetOQCLOTCheckList(oqcGoodEventArgs.OQCLotNO,OQCFacade.Lot_Sequence_Default); * if(obj == null) * { * OQCLOTCheckList oqcCheckList = oqcFacade.CreateNewOQCLOTCheckList(); * oqcCheckList.AGradeTimes = OQCFacade.Decimal_Default_value; * oqcCheckList.BGradeTimes = OQCFacade.Decimal_Default_value; * oqcCheckList.CGradeTimes = OQCFacade.Decimal_Default_value; * oqcCheckList.LOTNO = oqcGoodEventArgs.OQCLotNO; * oqcCheckList.LotSequence = OQCFacade.Lot_Sequence_Default; * oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode; * oqcCheckList.MaintainDate = dbDateTime.DBDate; * oqcCheckList.MaintainTime = dbDateTime.DBTime; * oqcCheckList.Result = OQCLotStatus.OQCLotStatus_Examing; * * oqcFacade.AddOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists,oqcCheckList)); * } * else * { * OQCLOTCheckList oqcCheckList = obj as OQCLOTCheckList; * oqcCheckList.MaintainUser = oqcGoodEventArgs.UserCode; * * oqcFacade.UpdateOQCLOTCheckList(GetDefectStatic(oqcGoodEventArgs.OQCLOTCardCheckLists,oqcCheckList)); * } #endregion * * // #region this is for report add by crystal chu 2005/07/25 * // ReportHelper reportCollect= new ReportHelper(this.DataProvider); * // messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,oqcGoodEventArgs.ActionType,oqcGoodEventArgs.ProductInfo)); * // #endregion * * * } * } */ #endregion } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }