private Messages LoadLotInfo() { Messages msg = new Messages(); string lotNo = this.ucLabelEditLotNo.Value.Trim().ToUpper(); if (lotNo.Length > 0) { try { OQCFacade oqcFacade = new OQCFacade(DataProvider); object obj = oqcFacade.GetOQCLot(FormatHelper.PKCapitalFormat(lotNo), OQCFacade.Lot_Sequence_Default); if (obj == null) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_LOT_NOT_EXIST")); this.ucLabelEditLotNo.TextFocus(false, true); return(msg); } object[] objs = oqcFacade.GetOQCLot2CardByLotNoAndSeq(FormatHelper.PKCapitalFormat(lotNo), OQCFacade.Lot_Sequence_Default); if (objs == null || objs.Length == 0) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_LotNoRCard")); ucLabelEditLotNo.TextFocus(false, true); return(msg); } OQCLot lot = obj as OQCLot; string itemCode = (objs[0] as OQCLot2Card).ItemCode; ItemFacade itemFacade = new ItemFacade(this.DataProvider); object item = itemFacade.GetItem(itemCode, lot.OrganizationID); if (item == null) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_ItemCode_NotExist $ItemCode=" + itemCode)); ucLabelEditLotNo.TextFocus(false, true); return(msg); } this.ucLabelEditItemCode.Value = (item as Item).ItemCode; this.labelItemDescription.Text = (item as Item).ItemDescription; this.ucLabelEditSizeAndCapacity.Value = lot.LotSize.ToString();// +"/" + lot.LotCapacity.ToString(); } catch (Exception ex) { msg.Add(new UserControl.Message(ex)); ucLabelEditLotNo.TextFocus(false, true); } } else { msg.Add(new UserControl.Message(MessageType.Error, "$CS_FQCLOT_NOT_NULL")); this.ucLabelEditLotNo.TextFocus(false, true); } return(msg); }
protected void cmdSave_ServerClick(object sender, System.EventArgs e) { if (!ValidateInput()) { return; } if (_OQCFacade == null) { _OQCFacade = new OQCFacade(base.DataProvider); } int frozenRCardCount = _OQCFacade.QueryOQCLotFrozenCount(this.gridWebGrid.Rows[0].Cells[1].ToString()); if (frozenRCardCount > 0) { WebInfoPublish.Publish(this, "$Message_LotIsFrozen", languageComponent1); this.buttonHelper.PageActionStatusHandle(PageActionType.Save); return; } OQCLot lot = (OQCLot)this.GetEditObject(this.gridWebGrid.Rows[0]); if (lot != null) { try { ((SQLDomainDataProvider)this.DataProvider).PersistBroker.AutoCloseConnection = false; ((SQLDomainDataProvider)this.DataProvider).PersistBroker.OpenConnection(); this.DataProvider.BeginTransaction(); _OQCFacade.FreezeLot(lot, this.txtFrozenCauseEdit.Text.Trim().ToUpper(), this.chkFrozenLotEdit.Checked, this.GetUserCode()); this.DataProvider.CommitTransaction(); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); throw ex; } finally { ((SQLDomainDataProvider)this.DataProvider).PersistBroker.CloseConnection(); ((SQLDomainDataProvider)this.DataProvider).PersistBroker.AutoCloseConnection = true; } cmdQuery_ServerClick(sender, e); } }
//Process Running Card private void ProcessRCard(string rcard) { //根据当前序列号获取最新序列号 DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); OQCFacade _OQCFacade = new OQCFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(rcard.Trim().ToUpper(), string.Empty); object objSimulationReport = dataCollectFacade.GetLastSimulationReport(sourceRCard); if (objSimulationReport != null) { // Added By hi1/venus.Feng on 20081127 for Hisense Version : 如果没有Carton信息,则不能进行移转 if (string.IsNullOrEmpty((objSimulationReport as Domain.DataCollect.SimulationReport).CartonCode)) { ClearRCardInfo(); ucMessage.Add(new UserControl.Message(MessageType.Error , "$Error_RCardNoCartonInfo $CS_Param_ID =" + rcard)); txtRCard.TextFocus(true, true); } else { //add by andy xin 判断包装转移判断RCARD是否在TBLLOT2CARD中有 object lot2Card = _OQCFacade.GetOQCLot2Card((objSimulationReport as Domain.DataCollect.SimulationReport).RunningCard, (objSimulationReport as Domain.DataCollect.SimulationReport).MOCode, "", ""); if (lot2Card != null) { OQCLot oqcLot = _OQCFacade.GetOQCLot((lot2Card as OQCLot2Card).LOTNO, OQCFacade.Lot_Sequence_Default) as OQCLot; if (!(oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Rejecting || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Pass || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Passing)) { ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_RCARD_In_OQC")); this.txtRCard.TextFocus(true, true); return; } } DisplayRCardInfo(objSimulationReport as Domain.DataCollect.SimulationReport); } // End Added } else { ClearRCardInfo(); ucMessage.Add(new UserControl.Message(MessageType.Error , "$NoSimulation $CS_Param_ID =" + rcard)); txtRCard.TextFocus(true, true); } }
//检查抽检批是否合法,如果存在但状态为(pass,reject)就出错 public bool IsOQCLotCompleteByLot(Domain.OQC.OQCLot obj) { // OQCFacade oqcFacade = new OQCFacade(this.DataProvider); // object obj = oqcFacade.GetOQCLot(OQCLot,OQCFacade.Lot_Sequence_Default); if (obj == null) { throw new Exception("Error_OQCLot_NotExisted,OQCLot='" + obj.LOTNO + "'"); } OQCLot oqcLot = obj as OQCLot; if ((oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Pass) || (oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject)) { return(true); } else { return(false); } }
private object GetEditObject() { if (this.ValidateInput()) { if (_OQCFacade == null) { _OQCFacade = new OQCFacade(base.DataProvider); } OQCLot lot = this._OQCFacade.CreateNewOQCLot(); lot.LotFrozen = chkFrozenLotEdit.Checked ? "Y" : "N"; return(lot); } else { return(null); } }
public bool IsOQCLotInitial(string OQCLot) { OQCFacade oqcFacade = new OQCFacade(this.DataProvider); object obj = oqcFacade.GetOQCLot(OQCLot, OQCFacade.Lot_Sequence_Default); if (obj == null) { throw new Exception("Error_OQCLot_NotExisted,OQCLot='" + OQCLot + "'"); } OQCLot oqcLot = obj as OQCLot; if (oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Initial) { return(true); } else { return(false); } }
private bool CheckLotStatus(string lotno) { OQCFacade oqcFacade = new OQCFacade(DataProvider); OQCLot oqcLot = oqcFacade.GetOQCLot(lotno, OQCFacade.Lot_Sequence_Default) as OQCLot; //判断批状态,为以下4种状态的继续 if (oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Initial || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Examing || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_NoExame || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_SendExame) { this.ucLabelEditLotNo.Value = lotno; } else if (oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Rejecting) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_Lot_Has_Reject")); return(false); } else if (oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Pass || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Passing) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_Lot_Has_Pass")); return(false); } return(true); }
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); }
private OQCLot CreateNewLot(ActionEventArgs actionEventArgs, Item item, DBDateTime currentDBDateTime, bool forRework, string oldLotNo) { string lotNoMarkCode = forRework ? "R" : "L"; string lotType = forRework ? OQCLotType.OQCLotType_ReDO : OQCLotType.OQCLotType_Normal; string productionType = ""; decimal lotSize = 0; OQCFacade oqcFacade = new OQCFacade(DataProvider); TryFacade tryFacade = new TryFacade(this.DataProvider); OQCLot newOQCLot = null; OQCLot objLot = null; DateTime currentDateTime = FormatHelper.ToDateTime(currentDBDateTime.DBDate, currentDBDateTime.DBTime); object[] tryListOfRCard = null; object[] tryListOfOldLot = null; if (forRework) { OQCLot oldLot = oqcFacade.GetOQCLot(oldLotNo, OQCFacade.Lot_Sequence_Default) as OQCLot; productionType = oldLot.ProductionType; if (productionType == ProductionType.ProductionType_Try) { tryListOfRCard = tryFacade.GetTryListOfRCard(actionEventArgs.ProductInfo.NowSimulation.RunningCard, item.ItemCode); } //Lot Size lotSize = oldLot.LotCapacity; tryListOfOldLot = tryFacade.GetTryListOfLotNo(oldLot.LOTNO); } else { #region 先获取产品序列号对应的工单的productionType(来自于tblmo.momemo) // 先获取产品序列号对应的工单的productionType(来自于tblmo.momemo) MO mo = (new MOFacade(DataProvider)).GetMO(actionEventArgs.ProductInfo.NowSimulation.MOCode) as MO; SystemSettingFacade ssf = new SystemSettingFacade(this.DataProvider); Parameter param; param = ssf.GetParameter(mo.MOType, BenQGuru.eMES.Web.Helper.MOType.GroupType) as Parameter; if (param != null) { if (string.Compare(param.ParameterValue, BenQGuru.eMES.Web.Helper.MOType.MOTYPE_RMAREWORKMOTYPE, true) == 0) { productionType = ProductionType.ProductionType_Claim; } else { if (string.IsNullOrEmpty(mo.MOMemo)) { productionType = ProductionType.ProductionType_Mass; mo.MOMemo = MOProductType.MO_Product_Type_Mass.ToUpper(); } // 根据Memo获取ProductionType param = ssf.GetParameter(mo.MOMemo, MOProductType.GroupType) as Parameter; //changed by hiro 08/11/10 判断param不空进行比较 if (param != null) { if (string.Compare(param.ParameterValue, MOProductType.MO_Product_Type_New, true) == 0) { productionType = ProductionType.ProductionType_New; } else if (string.Compare(param.ParameterValue, MOProductType.MO_Product_Type_Mass, true) == 0) { productionType = ProductionType.ProductionType_Mass; } else { throw new Exception("$Error_MOMemoNotConfig $Domain_Parameter=" + mo.MOMemo); } tryListOfRCard = tryFacade.GetTryListOfRCard(actionEventArgs.ProductInfo.NowSimulation.RunningCard, item.ItemCode); if (tryListOfRCard != null && tryListOfRCard.Length > 0) { productionType = ProductionType.ProductionType_Try; } } else { throw new Exception("$CS_System_Params_Losted $Domain_ParameterGroup='" + MOProductType.GroupType + "' $Domain_Parameter=" + mo.MOMemo); } } } else { throw new Exception("$CS_System_Params_Losted $Domain_ParameterGroup='" + BenQGuru.eMES.Web.Helper.MOType.GroupType + "' $Domain_Parameter=" + mo.MOType); } #endregion } #region 获取ShiftDay和ShiftCode BaseSetting.BaseModelFacade dataModel = new BaseSetting.BaseModelFacade(this.DataProvider); Domain.BaseSetting.Resource res = (Domain.BaseSetting.Resource)dataModel.GetResource(actionEventArgs.ResourceCode); int shiftDay = 0; string shiftCode = string.Empty; BaseSetting.ShiftModelFacade shiftModel = new BaseSetting.ShiftModelFacade(this.DataProvider); Domain.BaseSetting.TimePeriod period = (Domain.BaseSetting.TimePeriod)shiftModel.GetTimePeriod(res.ShiftTypeCode, currentDBDateTime.DBTime); if (period == null) { throw new Exception("$OutOfPerid"); } shiftCode = period.ShiftCode; if (period.IsOverDate == Web.Helper.FormatHelper.TRUE_STRING) { if (period.TimePeriodBeginTime < period.TimePeriodEndTime) { shiftDay = FormatHelper.TODateInt(currentDateTime.AddDays(-1)); } else if (Web.Helper.FormatHelper.TOTimeInt(currentDateTime) < period.TimePeriodBeginTime) { shiftDay = FormatHelper.TODateInt(currentDateTime.AddDays(-1)); } else { shiftDay = FormatHelper.TODateInt(currentDateTime); } } else { shiftDay = FormatHelper.TODateInt(currentDateTime); } #endregion bool needCreateNewLot = false; bool needAddLotTryCode = false; // 获取Lot的主逻辑 if (productionType == ProductionType.ProductionType_Try) //试流批 { object[] lotList = oqcFacade.GetLotList4TryCase(item.ItemCode, res.StepSequenceCode, lotType, productionType, lotNoMarkCode); if (lotList == null || lotList.Length == 0) // 找不到对应的任何试流批,则新建试流批 { needCreateNewLot = true; needAddLotTryCode = true; } else // 找到多个,则遍历每一个,找其中试流批与RCard完全一致的批,若没有则新建试流批 { object[] tryListOfLot; foreach (OQCLot lotTemp in lotList) { tryListOfLot = tryFacade.GetTryListOfLotNo(lotTemp.LOTNO); if (tryListOfRCard != null && tryListOfRCard.Length != 0 && tryListOfLot != null && tryListOfLot.Length != 0 && this.CompareTryCodeList(tryListOfRCard, tryListOfLot) == true) { newOQCLot = oqcFacade.GetOQCLot(lotTemp.LOTNO, lotTemp.LotSequence) as OQCLot; break; } } if (newOQCLot == null) { needCreateNewLot = true; needAddLotTryCode = true; } } } else //新品批或量产批或理赔批 { objLot = oqcFacade.GetMaxLot4NormalCase(item.ItemCode, res.StepSequenceCode, lotType, productionType, lotNoMarkCode); if (objLot == null || objLot.LOTNO == null || objLot.LOTNO == string.Empty) { needCreateNewLot = true; needAddLotTryCode = false; } else { newOQCLot = oqcFacade.GetOQCLot(objLot.LOTNO, OQCFacade.Lot_Sequence_Default) as OQCLot; } } // Added By Hi1/Venus.Feng on 20081128 for Hisense Version // 增加了ForRework的这个条件 // 如果是Rework,都应该产生新的批,因为调用该函数之前,就已经by老的lot获取新的lot了,但是没有获取到 // 才会跑到该函数中,所以在该函数中对于Rework的Case,都应该产生新的批 // End Added if (needCreateNewLot || forRework) { newOQCLot = oqcFacade.CreateNewOQCLot(); objLot = oqcFacade.GetMaxLot(res.StepSequenceCode, shiftDay, lotNoMarkCode); if (objLot == null || objLot.LOTNO == null || objLot.LOTNO == string.Empty) { newOQCLot.LOTNO = res.StepSequenceCode + shiftDay.ToString() + lotNoMarkCode + "001"; } else { string oldLotNO = objLot.LOTNO; string newSequence = Convert.ToString((int.Parse(oldLotNO.Substring(oldLotNO.Length - 3, 3)) + 1)); newOQCLot.LOTNO = oldLotNO.Substring(0, oldLotNO.Length - 3) + newSequence.PadLeft(3, '0'); } // Create New OQC Lot if (forRework) { newOQCLot = oqcFacade.CreateNewOQCLot(newOQCLot.LOTNO, actionEventArgs.UserCode, currentDBDateTime, res.OrganizationID, lotSize, res.StepSequenceCode, item.ItemCode, oldLotNo, lotType, productionType, res.ResourceCode, shiftDay, shiftCode); } else { newOQCLot = oqcFacade.CreateNewOQCLot(newOQCLot.LOTNO, actionEventArgs.UserCode, currentDBDateTime, res.OrganizationID, item.LotSize, res.StepSequenceCode, item.ItemCode, oldLotNo, lotType, productionType, res.ResourceCode, shiftDay, shiftCode); } oqcFacade.AddOQCLot(newOQCLot); if (needAddLotTryCode || forRework) { Try2Lot try2Lot = null; if (forRework) { if (tryListOfOldLot != null && tryListOfOldLot.Length > 0) { foreach (Try tempTry in tryListOfOldLot) { try2Lot = tryFacade.CreateNewTry2Lot(); try2Lot.EAttribute1 = ""; try2Lot.LotNo = newOQCLot.LOTNO; try2Lot.MaintainDate = currentDBDateTime.DBDate; try2Lot.MaintainTime = currentDBDateTime.DBTime; try2Lot.MaintainUser = actionEventArgs.UserCode; try2Lot.TryCode = tempTry.TryCode; tryFacade.AddTry2Lot(try2Lot); } } } else { foreach (Try tempTry in tryListOfRCard) { try2Lot = tryFacade.CreateNewTry2Lot(); try2Lot.EAttribute1 = ""; try2Lot.LotNo = newOQCLot.LOTNO; try2Lot.MaintainDate = currentDBDateTime.DBDate; try2Lot.MaintainTime = currentDBDateTime.DBTime; try2Lot.MaintainUser = actionEventArgs.UserCode; try2Lot.TryCode = tempTry.TryCode; tryFacade.AddTry2Lot(try2Lot); } } } } return(newOQCLot); }
//实际批量/标准批量, 产品, 产品描述, 备注值 private Messages RequesData() { Messages msg = new Messages(); //判断该产品序列号的批号存不存在 string oqcLotNo = FormatHelper.CleanString(this.ucLabelEditLotNo.Value); if (oqcLotNo.Length == 0) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_FQCLOT_NOT_NULL")); this.ucLSizeAndCapacityMore.Value = ""; this.ucLabelEditItemCode.Value = ""; this.labelItemDescription.Text = ""; this.ucLESeparateMemo.Value = ""; return(msg); } //不允许自动关闭连接 ((SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = false; ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection(); try { OQCFacade oqcFacade = new OQCFacade(DataProvider); ActionOnLineHelper actionOnLineHelper = new ActionOnLineHelper(this.DataProvider); //判断批是否存在 object obj = oqcFacade.GetOQCLot(FormatHelper.PKCapitalFormat(oqcLotNo), OQCFacade.Lot_Sequence_Default); if (obj == null) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_LOT_NOT_EXIST")); this.ucLSizeAndCapacityMore.Value = ""; this.ucLabelEditItemCode.Value = ""; this.labelItemDescription.Text = ""; this.ucLESeparateMemo.Value = ""; return(msg); } //判断批是否存在tbllot2card object[] objs = oqcFacade.GetOQCLot2CardByLotNoAndSeq(FormatHelper.PKCapitalFormat(oqcLotNo), OQCFacade.Lot_Sequence_Default); if (objs == null || objs.Length == 0) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_LotNoRCard")); this.ucLSizeAndCapacityMore.Value = ""; this.ucLabelEditItemCode.Value = ""; this.labelItemDescription.Text = ""; this.ucLESeparateMemo.Value = ""; return(msg); } //判断有没有通过第一站 ProductInfo productionInfo = (ProductInfo)actionOnLineHelper.GetIDInfo(((OQCLot2Card)objs[0]).RunningCard).GetData().Values[0]; if (productionInfo.LastSimulation == null) { msg.Add(new UserControl.Message(MessageType.Error, "$NoSimulationInfo")); this.ucLSizeAndCapacityMore.Value = ""; this.ucLabelEditItemCode.Value = ""; this.labelItemDescription.Text = ""; this.ucLESeparateMemo.Value = ""; return(msg); } OQCLot lot = obj as OQCLot; string itemCode = (objs[0] as OQCLot2Card).ItemCode; ItemFacade itemFacade = new ItemFacade(this.DataProvider); object item = itemFacade.GetItem(itemCode, lot.OrganizationID); if (item == null) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_ItemCode_NotExist $ItemCode=" + itemCode)); this.ucLSizeAndCapacityMore.Value = ""; this.ucLabelEditItemCode.Value = ""; this.labelItemDescription.Text = ""; this.ucLESeparateMemo.Value = ""; return(msg); } this.ucLSizeAndCapacityMore.Value = lot.LotSize.ToString() + "/" + lot.LotCapacity.ToString(); this.ucLabelEditItemCode.Value = (item as Item).ItemCode; this.labelItemDescription.Text = (item as Item).ItemDescription; this.ucLESeparateMemo.Value = lot.FrozenReason; } catch (Exception ex) { msg.Add(new UserControl.Message(ex)); } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); ((SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = true; } return(msg); }
//check for carton capacity if overload private bool CheckTargetCarton(string tagCarton) { bool bResult = true; m_NeedAddNewCarton = false; object obj = (new Package.PackageFacade(DataProvider)).GetCARTONINFO(tagCarton); if (tagCarton == txtCurrentCarton.Value.ToUpper().Trim()) { ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_TAG_CARTON_EQUAL_CUR_CARTON $CS_CARTON_NO =" + tagCarton)); bResult = false; } #region OQC检验 //Added by lisa@2012-8-29 //检查目标小箱是否已经在OQC处理过程中 OQCFacade _OQCFacade = new OQCFacade(this.DataProvider); Lot2Carton lot2carton = _OQCFacade.GetLot2CartonByCartonNo(tagCarton) as Lot2Carton; OQCLot oqcCartonLot = null; if (lot2carton != null) { oqcCartonLot = _OQCFacade.GetOQCLot(lot2carton.OQCLot, OQCFacade.Lot_Sequence_Default) as OQCLot; if (oqcCartonLot != null && !(oqcCartonLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject || oqcCartonLot.LOTStatus == OQCLotStatus.OQCLotStatus_Rejecting || oqcCartonLot.LOTStatus == OQCLotStatus.OQCLotStatus_Pass || oqcCartonLot.LOTStatus == OQCLotStatus.OQCLotStatus_Passing)) { ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_RCARD_In_OQC")); this.txtRCard.TextFocus(false, true); return(false); } } //检查当前Rcard所在箱和目标箱的OQC状态是否一致,或者都不在OQC中,或者都是OQC判过,或者都是OQC判退 DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(txtRCard.Value.Trim().ToUpper(), string.Empty); object objSimulationReport = dataCollectFacade.GetLastSimulationReport(sourceRCard); string currentlotno = (objSimulationReport as Domain.DataCollect.SimulationReport).LOTNO; OQCLot oqcRcardLot = null; if (!string.IsNullOrEmpty(currentlotno)) { oqcRcardLot = _OQCFacade.GetOQCLot(currentlotno.Trim(), OQCFacade.Lot_Sequence_Default) as OQCLot; } if (!(oqcCartonLot == null && oqcRcardLot == null)) { if (oqcCartonLot == null) { ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_RCARD_CARTON_OQC_NOT_SAME")); this.txtRCard.TextFocus(false, true); return(false); } if (oqcRcardLot == null) { ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_RCARD_CARTON_OQC_NOT_SAME")); this.txtRCard.TextFocus(false, true); return(false); } if (oqcCartonLot.LOTStatus != oqcRcardLot.LOTStatus) { ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_RCARD_CARTON_OQC_NOT_SAME")); this.txtRCard.TextFocus(false, true); return(false); } } #endregion if (obj == null) { //ucMessage.Add(new UserControl.Message(MessageType.Error,"$CS_CARTON_NOT_EXIST $CS_CARTON_NO =" + tagCarton)); bResult = false; m_NeedAddNewCarton = true; } else { Domain.Package.CARTONINFO carton = obj as Domain.Package.CARTONINFO; if (carton.COLLECTED >= carton.CAPACITY) { ucMessage.Add(new UserControl.Message(MessageType.Error, "$CARTON_ALREADY_FILL_OUT $CS_CARTON_NO =" + tagCarton)); bResult = false; } } return(bResult); }
private bool CartonPack() { if (this.ucLabelRCardForCarton.Value.Trim() == "") { this.SetInputMessageByFlowControl(); return(false); } string rcard = FormatHelper.CleanString(this.ucLabelRCardForCarton.Value.Trim().ToUpper()); //转换成起始序列号 if (_face == null) { _face = new DataCollectFacade(this.DataProvider); } string sourceCard = _face.GetSourceCard(rcard, string.Empty); //end if (this.ucLabelCartonNo.Value.Trim() == "") { m_FlowControl = 1; this.SetInputMessageByFlowControl(); return(false); } #region RCard Length Check if (chkCardLen.Checked && chkCardLen.Value.Trim().Length > 0) { if (rcard.Length != Convert.ToInt32(chkCardLen.Value.Replace("-", ""))) { ucMessage.AddEx(this._FunctionName, "$CS_RCARD: " + this.ucLabelRCardForCarton.Value, new UserControl.Message(MessageType.Error, "$CS_CARD_NO_LEN_CHECK_FAIL"), false); this.m_FlowControl = 3; this.SetInputMessageByFlowControl(); return(false); } } #endregion #region RCard First Char Check if (chkCardFChar.Checked && chkCardFChar.Value.Trim().Length > 0) { if (rcard.IndexOf(chkCardFChar.Value.Trim()) != 0) { ucMessage.AddEx(this._FunctionName, "$CS_RCARD: " + this.ucLabelRCardForCarton.Value, new UserControl.Message(MessageType.Error, "$CS_CARD_NO_FCHAR_CHECK_FAIL"), false); this.m_FlowControl = 3; this.SetInputMessageByFlowControl(); return(false); } } #endregion ucMessage.AddWithoutEnter("<<"); ucMessage.AddBoldText(ucLabelRCardForCarton.Value.Trim()); if (!checkRcard(rcard, sourceCard)) { this.m_FlowControl = 3; this.SetInputMessageByFlowControl(); return(false); } Simulation objSimulation = _face.GetSimulation(sourceCard.Trim().ToUpper()) as Simulation; string lastAction = objSimulation.LastAction.Trim(); ItemFacade itemFacade = new ItemFacade(DataProvider); Item item = itemFacade.GetItem((objSimulation as Simulation).ItemCode.ToUpper().Trim(), GlobalVariables.CurrentOrganizations.First().OrganizationID) as Item; string newMOCode = objSimulation.MOCode.Trim().ToUpper(); PackageFacade pf = new PackageFacade(DataProvider); //check产品序列号是否重复包装 //object rcardobj = pf.GetCarton2RCARD("", sourceCard.Trim().ToUpper()); object rcardobj = pf.GetCarton2RcardByRcard(sourceCard.Trim().ToUpper()); if (rcardobj != null) { ucMessage.AddEx(this._FunctionName, "$CS_CARTON_NO: " + ((Carton2RCARD)rcardobj).CartonCode, new UserControl.Message(MessageType.Error, "$CS_CARD_HAS_PACKED"), false); this.m_FlowControl = 3; this.SetInputMessageByFlowControl(); return(false); } string cartonNo = FormatHelper.CleanString(ucLabelCartonNo.Value.Trim().ToUpper()); #region OQC检查 //modified by lisa@2012-8-29 //1,序列号是维修回流过来的,即属于未判定的LOT并且不属于任何小箱,应该装在之前的箱中。 OQCFacade _OQCFacade = new OQCFacade(this.DataProvider); object lot2Card = _OQCFacade.GetOQCLot2Card(sourceCard.Trim().ToUpper(), newMOCode, "", ""); Boolean blnCheckCarton = true; if (lot2Card != null) { OQCLot oqcLot = _OQCFacade.GetOQCLot((lot2Card as OQCLot2Card).LOTNO, OQCFacade.Lot_Sequence_Default) as OQCLot; if (!(oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Reject || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Rejecting || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Pass || oqcLot.LOTStatus == OQCLotStatus.OQCLotStatus_Passing)) { if ((!String.IsNullOrEmpty(((OQCLot2Card)lot2Card).EAttribute1)) && cartonNo != ((OQCLot2Card)lot2Card).EAttribute1.ToString()) { ucMessage.AddEx(this._FunctionName, " ", new UserControl.Message(MessageType.Error, "$RCard:" + sourceCard + "$ShouedPackInCarton:" + ((OQCLot2Card)lot2Card).EAttribute1.ToString()), false); this.m_FlowControl = 3; this.SetInputMessageByFlowControl(); return(false); } if ((!String.IsNullOrEmpty(((OQCLot2Card)lot2Card).EAttribute1)) && cartonNo == ((OQCLot2Card)lot2Card).EAttribute1.ToString()) { blnCheckCarton = false; } } } //2,产品序列号是新的,或者是返工回来的,则不能放入已归属了Lot的小箱 if (blnCheckCarton) { object objLot2Carton = _OQCFacade.GetLot2CartonByCartonNo(cartonNo); if (objLot2Carton != null) { ucMessage.AddEx(this._FunctionName, "$CS_CARTON_NO: " + this.ucLabelCartonNo.Value, new UserControl.Message(MessageType.Error, "$CARTON_ALREADY_OQC"), false); this.m_FlowControl = 1; this.SetInputMessageByFlowControl(); return(false); } } #endregion #region check箱 if (!checkCarton(cartonNo)) { return(false); } //check一个箱子只能放一个类型的产品,并且只能放一个工单的产品 object[] objects = pf.GetCarton2RCARDByCartonNO(cartonNo); if (objects != null) { string oldMOCode = ((Carton2RCARD)objects[0]).MOCode.Trim().ToUpper(); if (newMOCode != oldMOCode) { ucMessage.AddEx(this._FunctionName, "", new UserControl.Message(MessageType.Error, "$OneCarton_OneMoCode"), true); this.m_FlowControl = 3; this.SetInputMessageByFlowControl(); return(false); } object obj = pf.GetItemCodeByMOCode(oldMOCode); if (obj != null) { if (item.ItemCode != ((CartonCollection)obj).ItemCode) { ucMessage.AddEx(this._FunctionName, "", new UserControl.Message(MessageType.Error, "$OneCarton_OneProduct"), true); this.m_FlowControl = 3; this.SetInputMessageByFlowControl(); return(false); } } } #endregion // 包装动作 this.AfterToSave(); return(true); }
/// <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); }
//对批通过和批判退的处理 private void LotOPerate(string lotStatus, bool isForce) { Messages msg = new Messages(); bool isFrozen = false; string oqcLotNo = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.ucLabelEditLotNo.Value)); ActionFactory actionFactory = new ActionFactory(this.DataProvider); OQCFacade oqcFacade = new OQCFacade(this.DataProvider); //获取OQCLot以及逻辑检查 object obj = null; msg.AddMessages(GetOQCLotToOperate(oqcFacade, oqcLotNo, out obj)); if (!msg.IsSuccess()) { ApplicationRun.GetInfoForm().Add(msg); this.ucLabelEditLotNo.TextFocus(false, true); return; } //其他检查 if (lotStatus == OQCLotStatus.OQCLotStatus_Reject) { if (this.ucLabelEditStatusMemo.Value.Trim().Length == 0) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_PleaseInputMemo")); ApplicationRun.GetInfoForm().Add(msg); this.ucLabelEditStatusMemo.TextFocus(false, true); return; } } string msgInfo = String.Empty; if (lotStatus == OQCLotStatus.OQCLotStatus_Pass) { if (isForce) { msgInfo = UserControl.MutiLanguages.ParserMessage("$CS_CONFIRM_ForcePassLot"); } else { msgInfo = UserControl.MutiLanguages.ParserMessage("$CS_CONFIRM_LOT_PASS"); } } else { if (isForce) { msgInfo = UserControl.MutiLanguages.ParserMessage("$CS_CONFIRM_ForceRejectLot"); } else { msgInfo = UserControl.MutiLanguages.ParserMessage("$CS_CONFIRM_LOT_RJECT"); } } frmDialog dialog = new frmDialog(); dialog.Text = this.Text; dialog.DialogMessage = msgInfo; if (DialogResult.OK != dialog.ShowDialog(this)) { return; } //add by roger xue 2008/10/27 OQCLot objFrozen = obj as OQCLot; if (objFrozen.FrozenStatus == FrozenStatus.STATUS_FRONZEN) { isFrozen = true; FFrozenReason frozenReason = new FFrozenReason(); string reason = this.ucLabelEditStatusMemo.Value.Trim(); if (reason.Length == 0) { if (lotStatus == OQCLotStatus.OQCLotStatus_Reject) { reason = "批判退"; } else { reason = "批判过"; } } frozenReason.Reason = reason; frozenReason.Event += new ParentChildRelateEventHandler <ParentChildRelateEventArgs <string> >(Form_Event); if (DialogResult.Cancel == frozenReason.ShowDialog(this)) { return; } } //end add // 输入用户名、密码确认 add by alex.hu 2010/11/19 if (isForce) { string strMsg = UserControl.MutiLanguages.ParserString("$SMT_UnLoadAll_Confirm_UserCode"); FDialogInput finput = new FDialogInput(strMsg); DialogResult dialogResult = finput.ShowDialog(); if (dialogResult != DialogResult.OK) { return; } string strUserCode = finput.InputText.Trim().ToUpper(); strMsg = UserControl.MutiLanguages.ParserString("$Please_Input_Password"); finput = new FDialogInput(strMsg); finput.InputPasswordChar = '*'; dialogResult = finput.ShowDialog(); if (dialogResult != DialogResult.OK) { return; } string strPassword = finput.InputText.Trim().ToUpper(); finput.Close(); BenQGuru.eMES.Security.SecurityFacade security = new BenQGuru.eMES.Security.SecurityFacade(this.DataProvider); try { object objSec = security.PasswordCheck(strUserCode, strPassword); if (lotStatus == OQCLotStatus.OQCLotStatus_Pass && !security.IsBelongToAdminGroup(strUserCode) && !security.CheckAccessRight(strUserCode, "OQCFORCEPASS")) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(UserControl.MessageType.Error, "$Error_No_Access_Right")); return; } if (lotStatus == OQCLotStatus.OQCLotStatus_Reject && !security.IsBelongToAdminGroup(strUserCode) && !security.CheckAccessRight(strUserCode, "OQCFORCEREJECT")) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(UserControl.MessageType.Error, "$Error_No_Access_Right")); return; } } catch (Exception ex) { Messages msgErr = new Messages(); msgErr.Add(new UserControl.Message(ex)); ApplicationRun.GetInfoForm().Add(msgErr); Application.DoEvents(); return; } } //end add //把lotcapacity更新成lotsise一样大小,防止此时有产品在产生工序进入批而产生批判定时整个批无法全部完工的并发问题 by hiro Decimal reallyLotCapacity = ((OQCLot)obj).LotCapacity; this.DataProvider.BeginTransaction(); try { //lock该lot,防止同时对该lot操作产生死锁 oqcFacade.LockOQCLotByLotNO(oqcLotNo); //end oqcFacade.UpdateOQCLotCapacity(((OQCLot)obj).LOTNO, ((OQCLot)obj).LotSize); this.DataProvider.CommitTransaction(); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); msg.Add(new UserControl.Message(ex)); ApplicationRun.GetInfoForm().Add(msg); } if (!msg.IsSuccess()) { return; } //end add //缓解性能问题 ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = false; ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection(); DataProvider.BeginTransaction(); try { //lock该lot,防止同时对该lot操作产生死锁 oqcFacade.LockOQCLotByLotNO(oqcLotNo); // msg.AddMessages(GetOQCLotToOperate(oqcFacade, oqcLotNo, out obj)); if (!msg.IsSuccess()) { return; } #region 业务逻辑 ActionOnLineHelper actinOnlineHelper = new ActionOnLineHelper(this.DataProvider); object[] objs = (new ActionOQCHelper(this.DataProvider)).QueryCardOfLot(FormatHelper.PKCapitalFormat(oqcLotNo), OQCFacade.Lot_Sequence_Default); if (objs == null) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_LOT_NOT_EXIST")); return; } // Added By Hi1/Venus.Feng on 20081111 for Hisense : 根据产生批的资源获取该资源对应的大线的最后一个工序的资源(取一个) //string rightResource = (new BaseModelFacade(this.DataProvider)).GetRightResourceForOQCOperate(objFrozen.ResourceCode, // (objs[0] as Simulation).ItemCode, (objs[0] as Simulation).RouteCode); //if (string.IsNullOrEmpty(rightResource)) //{ // msg.Add(new UserControl.Message(MessageType.Error, "$Error_NoBigLineFQCResource")); // return; //} string rightResource = ApplicationService.Current().ResourceCode; // End Added //对批通过的处理 if (lotStatus == OQCLotStatus.OQCLotStatus_Pass) { IAction actionPass = actionFactory.CreateAction(ActionType.DataCollectAction_OQCPass); OQCPASSEventArgs actionEventArgs = new OQCPASSEventArgs(ActionType.DataCollectAction_OQCPass, ((Domain.DataCollect.Simulation)objs[0]).RunningCard, ApplicationService.Current(). UserCode, rightResource, oqcLotNo, null); actionEventArgs.Lot = obj; actionEventArgs.CardOfLot = objs; actionEventArgs.IsForcePass = isForce; actionEventArgs.Memo = FormatHelper.CleanString(this.ucLabelEditStatusMemo.Value.Trim(), 100); //frozen operate actionEventArgs.IsUnFrozen = isFrozen; actionEventArgs.UnFrozenReason = this.frozenReason; msg.AddMessages(actionPass.Execute(actionEventArgs)); if (msg.IsSuccess()) { msg.Add(new UserControl.Message(MessageType.Success, "$CS_OQCPASSSUCCESS")); } } //对批判退的处理 if (lotStatus == OQCLotStatus.OQCLotStatus_Reject) { IAction actionReject = actionFactory.CreateAction(ActionType.DataCollectAction_OQCReject); OQCRejectEventArgs actionEventArgs = new OQCRejectEventArgs(ActionType.DataCollectAction_OQCReject, ((Domain.DataCollect.Simulation)objs[0]).RunningCard, ApplicationService.Current(). UserCode, ApplicationService.Current().ResourceCode, oqcLotNo, null); actionEventArgs.Lot = obj; actionEventArgs.CardOfLot = objs; actionEventArgs.IsForceReject = isForce; actionEventArgs.IsAutoGenerateReworkSheet = this.chkBoxAutoGenerate.Checked; actionEventArgs.IsCreateNewLot = this.checkBoxAutoLot.Checked; actionEventArgs.Memo = FormatHelper.CleanString(this.ucLabelEditStatusMemo.Value.Trim(), 100); //frozen operate actionEventArgs.IsUnFrozen = isFrozen; actionEventArgs.UnFrozenReason = frozenReason; actionEventArgs.rightResource = rightResource; msg.AddMessages(actionReject.Execute(actionEventArgs)); if (msg.IsSuccess()) { msg.Add(new UserControl.Message(MessageType.Success, "$CS_OQCREJECTSUCCESS")); } } #endregion } catch (Exception ex) { this.DataProvider.RollbackTransaction(); msg.Add(new UserControl.Message(ex)); } finally { ApplicationRun.GetInfoForm().Add(msg); if (!msg.IsSuccess()) { this.DataProvider.RollbackTransaction(); this.DataProvider.BeginTransaction(); } obj = oqcFacade.GetOQCLot(((OQCLot)obj).LOTNO, ((OQCLot)obj).LotSequence); if (obj != null) { oqcFacade.UpdateOQCLotCapacity(((OQCLot)obj).LOTNO, reallyLotCapacity); } this.DataProvider.CommitTransaction(); this.ucLabelEditLotNo.TextFocus(false, true); //缓解性能问题 ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = false; } }
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 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); }
private void btnSave_Click(object sender, EventArgs e) { if (this.ucLabelEditLotNo.Value.Trim() == string.Empty) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Please_Input_Lot_No")); this.ucLabelEditLotNo.TextFocus(true, true); return; } if (_OQCFacade == null) { _OQCFacade = new OQCFacade(this.DataProvider); } int frozenRCardCount = _OQCFacade.QueryFrozenRCardCount(this.ucLabelEditLotNo.Value.ToString().Trim()); if (frozenRCardCount > 0) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$Message_LotIsFrozen")); return; } if (this.ucLESeparateMemo.Value.Trim() == string.Empty) { ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Error, "$CS_CMPleaseInputFROZEN")); this.ucLESeparateMemo.TextFocus(true, true); return; } OQCLot lot = (OQCLot)this.GetEditObject(this.ucLabelEditLotNo.Value.ToString().Trim()); if (lot != null) { try { ((SQLDomainDataProvider)this.DataProvider).PersistBroker.AutoCloseConnection = false; ((SQLDomainDataProvider)this.DataProvider).PersistBroker.OpenConnection(); this.DataProvider.BeginTransaction(); _OQCFacade.FreezeLot(lot, this.ucLESeparateMemo.Value, this.chkBoxForbid.Checked, ApplicationService.Current().UserCode); this.DataProvider.CommitTransaction(); ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Success, "$CS_Save_Success")); this.ucLabelEditLotNo.Value = ""; this.ucLabelEditItemCode.Value = ""; this.ucLESeparateMemo.Value = ""; this.labelItemDescription.Text = ""; this.ucLSizeAndCapacityMore.Value = ""; this.ucLabelEditRcard.TextFocus(false, true); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); throw ex; } finally { ((SQLDomainDataProvider)this.DataProvider).PersistBroker.CloseConnection(); ((SQLDomainDataProvider)this.DataProvider).PersistBroker.AutoCloseConnection = true; } } }
protected void cmdSave_ServerClick(object sender, System.EventArgs e) { ArrayList array = this.gridHelper.GetCheckedRows(); if (array == null || array.Count <= 0) { return; } if (!ValidateInput()) { return; } string unfrozenReason = this.txtUnfrozenCauseEdit.Text.Trim(); string userCode = this.GetUserCode(); try { ((SQLDomainDataProvider)this.DataProvider).PersistBroker.AutoCloseConnection = false; ((SQLDomainDataProvider)this.DataProvider).PersistBroker.OpenConnection(); this.DataProvider.BeginTransaction(); if (_OQCFacade == null) { _OQCFacade = new OQCFacade(this.DataProvider); } DBDateTime currentDBDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); foreach (GridRecord row in array) { OQCLot OQClot = (OQCLot)this.GetEditObject(row); if (OQClot != null) { //更新Lot _OQCFacade.UpdateUnFrozenOnLot(((OQCLot)OQClot).LOTNO, unfrozenReason, currentDBDateTime.DBDate, currentDBDateTime.DBTime, userCode, OQCFacade.Lot_Sequence_Default); // 更新frozen _OQCFacade.UnFreezeFrozen(((OQCLot)OQClot).LOTNO, unfrozenReason, currentDBDateTime.DBDate, currentDBDateTime.DBTime, userCode, OQCFacade.Lot_Sequence_Default); } } this.DataProvider.CommitTransaction(); this.txtUnfrozenCauseEdit.Text = string.Empty; } catch (Exception ex) { this.DataProvider.RollbackTransaction(); throw ex; } finally { ((SQLDomainDataProvider)this.DataProvider).PersistBroker.CloseConnection(); ((SQLDomainDataProvider)this.DataProvider).PersistBroker.AutoCloseConnection = true; } this.gridHelper.RequestData(); }
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()) { // 0. 检查OQC Lot // 1. OQCFuncTestValue // 2. OQCFuncTestValueDetail // 3. OQCFuncTestValueEleDetail OQCFuncTestActionEventArgs args = (OQCFuncTestActionEventArgs)actionEventArgs; Simulation sim = args.ProductInfo.LastSimulation; OQCFacade oqcFacade = new OQCFacade(this.DataProvider); OQCLot oqcLot = (OQCLot)oqcFacade.GetOQCLot(sim.LOTNO, OQCFacade.Lot_Sequence_Default); if (oqcLot.LOTStatus != OQCLotStatus.OQCLotStatus_Examing && oqcLot.LOTStatus != OQCLotStatus.OQCLotStatus_NoExame) { messages.Add(new Message(MessageType.Error, "$OQCLot_Status_Must_Be_Examing")); } if (messages.IsSuccess()) { BenQGuru.eMES.BaseSetting.BaseModelFacade baseFacade = new BaseModelFacade(this.DataProvider); Resource resource = (Resource)baseFacade.GetResource(args.ResourceCode); Operation operation = (Operation)baseFacade.GetOperationByRouteAndResource(sim.RouteCode, resource.ResourceCode); if (operation == null) { operation = new Operation(); } // 1. OQCFuncTestValue OQCFuncTestValue testValue = new OQCFuncTestValue(); testValue.RunningCard = args.RunningCard; testValue.RunningCardSequence = sim.RunningCardSequence; testValue.ModelCode = sim.ModelCode; testValue.ItemCode = sim.ItemCode; testValue.MOCode = sim.MOCode; testValue.LotNO = sim.LOTNO; testValue.LotSequence = oqcLot.LotSequence; testValue.FuncTestGroupCount = args.oqcFuncTest.FuncTestGroupCount; testValue.MinDutyRatoMin = args.oqcFuncTest.MinDutyRatoMin; testValue.MinDutyRatoMax = args.oqcFuncTest.MinDutyRatoMax; testValue.MinDutyRatoValue = args.minDutyRatoValue; testValue.BurstMdFreMin = args.oqcFuncTest.BurstMdFreMin; testValue.BurstMdFreMax = args.oqcFuncTest.BurstMdFreMax; testValue.BurstMdFreValue = args.burstMdFreValue; testValue.ElectricTestCount = args.oqcFuncTest.ElectricTestCount; testValue.OPCode = operation.OPCode; testValue.StepSequenceCode = resource.StepSequenceCode; testValue.SegmentCode = resource.SegmentCode; testValue.ResourceCode = args.ResourceCode; if (args.Result == true) { testValue.ProductStatus = ProductStatus.GOOD; } else { testValue.ProductStatus = ProductStatus.NG; } testValue.MaintainUser = args.UserCode; DBDateTime dbDateTime; //Laws Lu,2006/11/13 uniform system collect date if (actionEventArgs.ProductInfo.WorkDateTime != null) { dbDateTime = actionEventArgs.ProductInfo.WorkDateTime; } else { dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); actionEventArgs.ProductInfo.WorkDateTime = dbDateTime; } testValue.MaintainDate = dbDateTime.DBDate; testValue.MaintainTime = dbDateTime.DBTime; /* modified by jessie lee, 2006/8/10 */ object obj = oqcFacade.GetOQCFuncTestValue(args.RunningCard, sim.RunningCardSequence); if (obj == null) { oqcFacade.AddOQCFuncTestValue(testValue); } else { oqcFacade.UpdateOQCFuncTestValue(testValue); //// Added by Icyer 2007/01/12 如果是重复测试,则需要先删除原来的数据 //OQCFuncTestValue testValueTmp = (OQCFuncTestValue)obj; //BenQGuru.eMES.SPCDataCenter.DataHandler deleteHandler = new BenQGuru.eMES.SPCDataCenter.DataHandler(this.DataProvider); //deleteHandler.DeleteData(SPCObjectList.OQC_FT_FREQUENCY, testValueTmp.ItemCode, testValueTmp.MOCode, testValueTmp.RunningCard, testValueTmp.RunningCardSequence, testValueTmp.MaintainDate); //// Added end } //// Added by Icyer 2006-08-11 //BenQGuru.eMES.SPCDataCenter.DataEntry dataEntry = new BenQGuru.eMES.SPCDataCenter.DataEntry(); //dataEntry.ModelCode = sim.ModelCode; //dataEntry.ItemCode = sim.ItemCode; //dataEntry.MOCode = sim.MOCode; //dataEntry.RunningCard = sim.RunningCard; //dataEntry.RunningCardSequence = sim.RunningCardSequence; //dataEntry.SegmentCode = resource.SegmentCode; //dataEntry.LineCode = resource.StepSequenceCode; //dataEntry.ResourceCode = resource.ResourceCode; //dataEntry.OPCode = sim.OPCode; //dataEntry.LotNo = sim.LOTNO; //dataEntry.TestDate = testValue.MaintainDate; //dataEntry.TestTime = testValue.MaintainTime; //if (args.Result == true) // dataEntry.TestResult = "P"; //else // dataEntry.TestResult = "F"; //dataEntry.TestUser = args.UserCode; //dataEntry.AddTestData(SPCObjectList.OQC_DUTY_RATO, args.minDutyRatoValue); //dataEntry.AddTestData(SPCObjectList.OQC_BURST_MD, args.burstMdFreValue); //for (int i = 0; i < args.oqcFuncTest.FuncTestGroupCount; i++) //{ // dataEntry.AddTestData(SPCObjectList.OQC_FT_FREQUENCY, i + 1, Convert.ToDecimal(args.listTestValueFre[i])); // Hashtable ht = (Hashtable)args.listTestValueEle[i]; // decimal[] dataEle = new decimal[Convert.ToInt32(args.oqcFuncTest.ElectricTestCount)]; // for (int n = 0; n < args.oqcFuncTest.ElectricTestCount; n++) // { // dataEle[n] = Convert.ToDecimal(ht[(n + 1).ToString()]); // } // dataEntry.AddTestData(SPCObjectList.OQC_FT_ELECTRIC, i + 1, dataEle); //} //BenQGuru.eMES.SPCDataCenter.DataHandler handler = new BenQGuru.eMES.SPCDataCenter.DataHandler(this.DataProvider); //messages.AddMessages(handler.CollectData(dataEntry)); //// Added end } } } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }