private void _helper_DomainObjectToExportRow(object sender, EventArgs e) { if ((e as DomainObjectToExportRowEventArgsNew).DomainObject != null) { BenQGuru.eMES.Domain.TS.TS obj = (e as DomainObjectToExportRowEventArgsNew).DomainObject as BenQGuru.eMES.Domain.TS.TS; (e as DomainObjectToExportRowEventArgsNew).ExportRow = new string[] { obj.MOCode, obj.ItemCode, obj.RunningCard, obj.FromOPCode, obj.FromStepSequenceCode, obj.FromResourceCode, obj.MaintainUser, FormatHelper.ToDateString(obj.MaintainDate), FormatHelper.ToTimeString(obj.MaintainTime), this.languageComponent1.GetString(obj.TSStatus) }; } }
private void _helper_DomainObjectToGridRow(object sender, EventArgs e) { if ((e as DomainObjectToGridRowEventArgsNew).DomainObject != null) { BenQGuru.eMES.Domain.TS.TS obj = (e as DomainObjectToGridRowEventArgsNew).DomainObject as BenQGuru.eMES.Domain.TS.TS; DataRow row = DtSource.NewRow(); row["MOCode"] = obj.MOCode; row["ItemCode"] = obj.ItemCode; row["RunningCard"] = obj.RunningCard; row["CollectionOperationCode"] = obj.FromOPCode; row["CollectionStepSequenceCode"] = obj.FromStepSequenceCode; row["CollectionResourceCode"] = obj.FromResourceCode; row["EmployeeNo"] = obj.MaintainUser; row["CollectionDate"] = FormatHelper.ToDateString(obj.MaintainDate); row["CollectionTime"] = FormatHelper.ToTimeString(obj.MaintainTime); row["TSStatus"] = this.languageComponent1.GetString(obj.TSStatus); row["NGDetails"] = ""; (e as DomainObjectToGridRowEventArgsNew).GridRow = row; } }
private Messages CollectKeyPartTS(ProductInfo Product) { Messages msg = new Messages(); // 根据联美兰达的需求,不良品如果到TS,则自动将KeyPart采到TS BenQGuru.eMES.TS.TSFacade tsFacade = new BenQGuru.eMES.TS.TSFacade(this.DataProvider); BenQGuru.eMES.Domain.TS.TS ts = (BenQGuru.eMES.Domain.TS.TS)tsFacade.GetCardLastTSRecord(Product.LastSimulation.RunningCard); if (ts != null && (ts.TSStatus == TSStatus.TSStatus_New || ts.TSStatus == TSStatus.TSStatus_Confirm || ts.TSStatus == TSStatus.TSStatus_TS)) { } else { return(msg); } if (this.LastRCardOnWIPItem == null || this.LastRCardOnWIPItem.Length == 0) { return(msg); } Domain.TS.TSErrorCode2Location[] errorInfo = null; MaterialFacade mfacade = new MaterialFacade(this.DataProvider); ActionDropMaterial actionDrop = new ActionDropMaterial(this.DataProvider); for (int i = 0; i < this.LastRCardOnWIPItem.Length; i++) { msg.AddMessages(actionDrop.CollectKeyPartNG(this.LastRCardOnWIPItem[i].MCARD, errorInfo, _usercode, _rescode)); if (msg.IsSuccess() == true) { msg.Add(new UserControl.Message(MessageType.Success, "$KeyPart_NG_Collect_Success")); } msg.Add(new UserControl.Message(MessageType.Normal, "$PageControl_Keyparts: " + this.LastRCardOnWIPItem[i].MCARD)); } return(msg); }
/// <summary> /// 采集KeyPart不良 /// </summary> public Messages CollectKeyPartNG(string keyPartNo, TSErrorCode2Location[] errorInfo, string userCode, string resourceCode) { Messages msg = new Messages(); string strSql = "SELECT * FROM tblOnWIPItem WHERE MCard='" + keyPartNo + "' ORDER BY MDate DESC,MTime DESC "; object[] objs = this._domainDataProvider.CustomQuery(typeof(BenQGuru.eMES.Domain.DataCollect.OnWIPItem), new SQLCondition(strSql)); if (objs == null || objs.Length == 0) { msg.Add(new Message(MessageType.Error, "$KeyPart_NG_ErrorKeyPart")); return(msg); } BenQGuru.eMES.Domain.DataCollect.OnWIPItem item = (BenQGuru.eMES.Domain.DataCollect.OnWIPItem)objs[0]; TS.TSFacade tsFacade = new BenQGuru.eMES.TS.TSFacade(this.DataProvider); BenQGuru.eMES.Domain.TS.TS itemTs = new BenQGuru.eMES.Domain.TS.TS(); object objTs = tsFacade.GetCardLastTSRecord(keyPartNo); if (objTs != null) { Domain.TS.TS ts = (Domain.TS.TS)objTs; if (ts.TSStatus == TSStatus.TSStatus_New || ts.TSStatus == TSStatus.TSStatus_Confirm || ts.TSStatus == TSStatus.TSStatus_TS) { msg.Add(new Message(MessageType.Error, "$KeyPart_NG_In_TS")); return(msg); } } #region ItemTS DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); itemTs.MOCode = item.MOCode; itemTs.RunningCard = keyPartNo; itemTs.RunningCardSequence = tsFacade.GetUniqueTSRunningCardSequence(keyPartNo); itemTs.TSId = FormatHelper.GetUniqueID(item.MOCode, itemTs.RunningCard, itemTs.RunningCardSequence.ToString()); itemTs.TranslateCard = item.RunningCard; itemTs.TranslateCardSequence = item.RunningCardSequence; itemTs.CardType = CardType.CardType_Part; itemTs.TSStatus = TSStatus.TSStatus_New; itemTs.MaintainUser = userCode; itemTs.MaintainDate = dbDateTime.DBDate; itemTs.MaintainTime = dbDateTime.DBTime; itemTs.TSDate = itemTs.ConfirmDate; itemTs.TSTime = itemTs.ConfirmTime; itemTs.FromInputType = BenQGuru.eMES.TS.TSFacade.TSSource_TS; itemTs.FromUser = userCode; itemTs.FromDate = itemTs.MaintainDate; itemTs.FormTime = itemTs.MaintainTime; itemTs.FromOPCode = "TS"; itemTs.FromResourceCode = resourceCode; itemTs.FromRouteCode = item.RouteCode; itemTs.FromSegmentCode = item.SegmentCode; itemTs.FromShiftCode = item.ShiftCode; itemTs.FromShiftDay = item.MaintainDate; itemTs.FromShiftTypeCode = item.ShiftTypeCode; itemTs.FromStepSequenceCode = item.StepSequenceCode; itemTs.FromTimePeriodCode = item.TimePeriodCode; itemTs.ItemCode = item.MItemCode; itemTs.ModelCode = item.ModelCode; itemTs.TransactionStatus = TransactionStatus.TransactionStatus_NO; itemTs.TSDate = 0; itemTs.TSTime = 0; itemTs.MOSeq = item.MOSeq; itemTs.TSTimes = 1; tsFacade.AddTS(itemTs); #endregion #region Error Info for (int i = 0; errorInfo != null && i < errorInfo.Length; i++) { TSErrorCode tsErrorCode = new TSErrorCode(); TSErrorCode2Location tsErrorCode2Location = new TSErrorCode2Location(); int j = tsFacade.QueryTSErrorCodeCount(((TSErrorCode2Location)errorInfo[i]).ErrorCodeGroup, ((TSErrorCode2Location)errorInfo[i]).ErrorCode, itemTs.TSId); if (j == 0) { tsErrorCode.ErrorCode = ((TSErrorCode2Location)errorInfo[i]).ErrorCode; tsErrorCode.ErrorCodeGroup = ((TSErrorCode2Location)errorInfo[i]).ErrorCodeGroup; tsErrorCode.ItemCode = itemTs.ItemCode; tsErrorCode.MaintainDate = itemTs.MaintainDate; tsErrorCode.MaintainTime = itemTs.MaintainTime; tsErrorCode.MaintainUser = itemTs.MaintainUser; tsErrorCode.MOCode = itemTs.MOCode; tsErrorCode.ModelCode = itemTs.ModelCode; tsErrorCode.RunningCard = itemTs.RunningCard; tsErrorCode.RunningCardSequence = itemTs.RunningCardSequence; tsErrorCode.TSId = itemTs.TSId; tsErrorCode.MOSeq = itemTs.MOSeq; tsFacade.AddTSErrorCode(tsErrorCode); } if (((TSErrorCode2Location)errorInfo[i]).ErrorLocation.Trim() != string.Empty) { tsErrorCode2Location.AB = ((TSErrorCode2Location)errorInfo[i]).AB; tsErrorCode2Location.ErrorLocation = ((TSErrorCode2Location)errorInfo[i]).ErrorLocation; tsErrorCode2Location.ErrorCode = ((TSErrorCode2Location)errorInfo[i]).ErrorCode; tsErrorCode2Location.ErrorCodeGroup = ((TSErrorCode2Location)errorInfo[i]).ErrorCodeGroup; tsErrorCode2Location.ItemCode = tsErrorCode.ItemCode; tsErrorCode2Location.MaintainDate = tsErrorCode.MaintainDate; tsErrorCode2Location.MaintainTime = tsErrorCode.MaintainTime; tsErrorCode2Location.MaintainUser = tsErrorCode.MaintainUser; tsErrorCode2Location.MEMO = ""; tsErrorCode2Location.MOCode = tsErrorCode.MOCode; tsErrorCode2Location.ModelCode = tsErrorCode.ModelCode; tsErrorCode2Location.RunningCard = tsErrorCode.RunningCard; tsErrorCode2Location.RunningCardSequence = tsErrorCode.RunningCardSequence; if (tsErrorCode2Location.ErrorLocation.IndexOf(".") < 0) { tsErrorCode2Location.SubErrorLocation = tsErrorCode2Location.ErrorLocation; } else { tsErrorCode2Location.SubErrorLocation = tsErrorCode2Location.ErrorLocation.Substring( 0, tsErrorCode2Location.ErrorLocation.IndexOf(".")); } tsErrorCode2Location.TSId = tsErrorCode.TSId; tsErrorCode2Location.ShiftDay = tsErrorCode2Location.MaintainDate; tsErrorCode2Location.MOSeq = tsErrorCode.MOSeq; tsFacade.AddTSErrorCode2Location(tsErrorCode2Location); } } #endregion return(msg); }