private void CheckAndRunOnWip() { if (txtRunningCard.Value.Trim() == string.Empty) { if (!this.txtGOMO.Checked) { txtMO.Value = String.Empty; txtItem.Value = String.Empty; labelItemDescription.Text = ""; } ApplicationRun.GetInfoForm().AddEx("$CS_Please_Input_RunningCard"); //将焦点移到产品序列号输入框 txtRunningCard.TextFocus(false, true); return; } else { DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); BurnFacade burnFacade = new BurnFacade(this.DataProvider); DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceCard = dataCollectFacade.GetSourceCard(this.txtRunningCard.Value.Trim().ToUpper(), string.Empty); if (this.txtGOMO.Checked && this.txtGOMO.Value.Trim().Length == 0) { ApplicationRun.GetInfoForm().AddEx("$CS_CMPleaseInputMO"); this.txtGOMO.Checked = true; this.txtGOMO.TextFocus(false, true); return; } if (this.txtGOMO.Checked && this.txtGOMO.InnerTextBox.Enabled) { ApplicationRun.GetInfoForm().AddEx("$CS_PleasePressEnterOnGOMO"); this.txtGOMO.Checked = true; this.txtGOMO.TextFocus(false, true); return; } // End Added //Add by sandy on 20140528 if (rdoBurnIn.Checked && rdoNG.Checked) { UserControl.Message message = new UserControl.Message(MessageType.Error, "$CS_BurnIn_Can_Not_NG"); ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ": " + this.txtRunningCard.Value, message, true); txtRunningCard.TextFocus(false, true); return; } //end if (txtRunningCard.Value.Trim().ToUpper() == ng_collect) { rdoNG.Checked = true; rdoBurnOut.Checked = true; txtRunningCard.TextFocus(false, true); return; } //Jarvis 20130125 支持GOOD指令 if (txtRunningCard.Value.Trim().ToUpper() == good_collect) { rdoGood.Checked = true; txtRunningCard.TextFocus(false, true); return; } //Add by sandy on 20140528 if (txtRunningCard.Value.Trim().ToUpper() == ActionType.DataCollectAction_BurnIn) { rdoGood.Checked = true; rdoBurnIn.Checked = true; txtRunningCard.TextFocus(false, true); return; } if (txtRunningCard.Value.Trim().ToUpper() == ActionType.DataCollectAction_BurnOutGood) { rdoGood.Checked = true; rdoBurnOut.Checked = true; txtRunningCard.TextFocus(false, true); return; } if (txtRunningCard.Value.Trim().ToUpper() == ActionType.DataCollectAction_BurnOutNG) { rdoNG.Checked = true; rdoBurnOut.Checked = true; txtRunningCard.TextFocus(false, true); return; } //End //add by hiro.chen 08/11/18 TocheckIsDown Messages msg = new Messages(); msg.AddMessages(dataCollectFacade.CheckISDown(sourceCard.Trim().ToUpper())); if (!msg.IsSuccess()) { ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ":" + this.txtRunningCard.Value, msg, true); txtRunningCard.TextFocus(false, true); return; } //end //报废不能返工 msg.AddMessages(dataCollectFacade.CheckReworkRcardIsScarp(sourceCard.Trim().ToUpper(), ApplicationService.Current().ResourceCode)); if (!msg.IsSuccess()) { ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ":" + this.txtRunningCard.Value, msg, true); txtRunningCard.TextFocus(false, true); return; } //end //Laws Lu,2005/10/19,新增 缓解性能问题 //Laws Lu,2006/12/25 修改 减少Open/Close的次数 ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = false; ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection(); //Laws Lu,2005/08/16,修改 把msg换成globeMSG globeMSG = CheckProduct(); // Added by Icyer 2005/10/28 if (Resource == null) { BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider); Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode); } actionCheckStatus = new ActionCheckStatus(); actionCheckStatus.ProductInfo = product; if (actionCheckStatus.ProductInfo != null) { actionCheckStatus.ProductInfo.Resource = Resource; } string strMoCode = String.Empty; if (product != null && product.LastSimulation != null) { strMoCode = product.LastSimulation.MOCode; } if (strMoCode != String.Empty) { if (listActionCheckStatus.ContainsKey(strMoCode)) { actionCheckStatus = (ActionCheckStatus)listActionCheckStatus[strMoCode]; actionCheckStatus.ProductInfo = product; actionCheckStatus.ActionList = new ArrayList(); } else { listActionCheckStatus.Add(strMoCode, actionCheckStatus); } } //Amoi,Laws Lu,2005/08/02,修改 if (txtGOMO.Checked == true) { globeMSG.AddMessages(RunGOMO(actionCheckStatus)); if (!globeMSG.IsSuccess()) { listActionCheckStatus.Clear(); } } else { if (product != null && product.LastSimulation != null) { this.txtMO.Value = product.LastSimulation.MOCode; this.txtItem.Value = product.LastSimulation.ItemCode; this.labelItemDescription.Text = this.GetItemDescription(product.LastSimulation.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID); } else { this.txtMO.Value = ""; this.txtItem.Value = ""; this.labelItemDescription.Text = ""; } } //EndAmoi //老化进和老化出工序不能同时勾选 BaseModelFacade baseModelFacade = new BaseModelFacade(this.DataProvider); ItemFacade itemFacade = new ItemFacade(this.DataProvider); object objOP = baseModelFacade.GetOperationByResource(ApplicationService.Current().ResourceCode); if (product != null && product.LastSimulation != null && objOP != null) { object objOp = itemFacade.GetItemRoute2Operation(this.txtItem.Value, product.LastSimulation.RouteCode, ((Operation2Resource)objOP).OPCode); if (objOp != null) { opControl = ((ItemRoute2OP)objOp).OPControl; if (opControl[(int)OperationList.BurnIn] == isSelected && opControl[(int)OperationList.BurnOut] == isSelected) { globeMSG.Add(new UserControl.Message(MessageType.Error, "$CS_BurnInOut_Can_Not_Choose_Together")); } } } //老化未达到预计时间且不是强制老化时不可做老化出良品采集 if (!isForce && globeMSG.IsSuccess() && rdoBurnOut.Checked && rdoGood.Checked && product.LastSimulation != null) { object objBurnWip = burnFacade.GetBurnWip(sourceCard.Trim().ToUpper(), product.LastSimulation.MOCode); BurnWip burnWip = objBurnWip as BurnWip; if (objBurnWip != null && burnWip.Status == BurnType.BurnIn) { DateTime dtForecast = FormatHelper.ToDateTime(burnWip.ForecastOutDate, burnWip.ForecastOutTime); if (dbDateTime.DateTime < dtForecast) { globeMSG.Add(new UserControl.Message(MessageType.Error, "$CS_Burn_Time_Not_Enough")); } } } if (globeMSG.IsSuccess()) { this.RunOnWip(); } } //刷新grid this.BindGrid(); //Laws Lu,2005/10/19,新增 缓解性能问题 //Laws Lu,2006/12/25 修改 减少Open/Close的次数 ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = true; //将焦点移到产品序列号输入框 ApplicationRun.GetInfoForm().AddEx(this._FunctionName, this.txtRunningCard.Caption + ": " + this.txtRunningCard.Value, globeMSG, true); //Application.DoEvents(); txtRunningCard.TextFocus(false, true); globeMSG.ClearMessages(); }
/// <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); }