/// <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); }
private Messages SetRCardReflowByErrorCode(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); string routeCode = ""; string opCode = ""; System.Collections.Generic.List <string> listErrorCode = new System.Collections.Generic.List <string>(); if (((TSActionEventArgs)actionEventArgs).ErrorCodes != null) { ErrorCodeGroup2ErrorCode[] error = new ErrorCodeGroup2ErrorCode[((TSActionEventArgs)actionEventArgs).ErrorCodes.Length]; ((TSActionEventArgs)actionEventArgs).ErrorCodes.CopyTo(error, 0); for (int i = 0; i < error.Length; i++) { if (error[i].ErrorCode != "" && listErrorCode.Contains(error[i].ErrorCode) == false) { listErrorCode.Add(error[i].ErrorCode); } } } if (listErrorCode.Count == 0) { return(messages); } // 查询不良代码和产品对应的返工途程 TSModel.TSModelFacade tsmodelFacade = new BenQGuru.eMES.TSModel.TSModelFacade(this.DataProvider); object objErrorCode2OPRework = tsmodelFacade.GetErrorCode2OPRework(actionEventArgs.ProductInfo.NowSimulation.OPCode, listErrorCode[0], GlobalVariables.CurrentOrganizations.First().OrganizationID); object tempOPRework; ErrorCode2OPRework tempErrorCode2OPRework; if (objErrorCode2OPRework == null) { for (int i = 1; i < listErrorCode.Count; i++) { tempOPRework = tsmodelFacade.GetErrorCode2OPRework(actionEventArgs.ProductInfo.NowSimulation.OPCode, listErrorCode[i], GlobalVariables.CurrentOrganizations.First().OrganizationID); if (tempOPRework != null) { messages.Add(new Message(MessageType.Error, "$Error_ErrorCodeHaveMoreThanOneRoute")); return(messages); } } return(messages); } else { ErrorCode2OPRework firstErrorCode2OPRework = objErrorCode2OPRework as ErrorCode2OPRework; for (int i = 1; i < listErrorCode.Count; i++) { tempOPRework = tsmodelFacade.GetErrorCode2OPRework(actionEventArgs.ProductInfo.NowSimulation.OPCode, listErrorCode[i], GlobalVariables.CurrentOrganizations.First().OrganizationID); if (tempOPRework == null) { messages.Add(new Message(MessageType.Error, "$Error_ErrorCodeHaveMoreThanOneRoute")); return(messages); } else { tempErrorCode2OPRework = tempOPRework as ErrorCode2OPRework; if (tempErrorCode2OPRework.RouteCode != firstErrorCode2OPRework.RouteCode || tempErrorCode2OPRework.ToOPCode != firstErrorCode2OPRework.ToOPCode) { messages.Add(new Message(MessageType.Error, "$Error_ErrorCodeHaveMoreThanOneRoute")); return(messages); } } } opCode = firstErrorCode2OPRework.ToOPCode; routeCode = firstErrorCode2OPRework.RouteCode; if (string.Compare(opCode, "TS", true) == 0) { return(messages); } } if (routeCode.Trim().Length == 0) // 如果途程等于空,则将当前序列号的途程作为返工途程 { routeCode = actionEventArgs.ProductInfo.NowSimulation.RouteCode; } // 检查产品与途程的对应 ItemFacade itemFacade = new ItemFacade(this.DataProvider); ItemRoute2OP op = (ItemRoute2OP)itemFacade.GetItemRoute2Operation(actionEventArgs.ProductInfo.NowSimulation.ItemCode, routeCode, opCode); if (op == null) { messages.Add(new Message(MessageType.Error, "$Error_ReworkRouteNotBelongToItem [" + routeCode + "]")); return(messages); } // 将TS的状态改成维修中 TSFacade tsFacade = new TSFacade(this.DataProvider); object obj = tsFacade.GetCardLastTSRecord(actionEventArgs.LotCode); if (obj != null) { Domain.TS.TS ts = (Domain.TS.TS)obj; ts.ConfirmResourceCode = actionEventArgs.ResourceCode; ts.ConfirmUser = actionEventArgs.UserCode; ts.ConfirmDate = actionEventArgs.ProductInfo.NowSimulation.BeginDate; ts.ConfirmTime = actionEventArgs.ProductInfo.NowSimulation.BeginTime; ts.TSStatus = TSStatus.TSStatus_TS; tsFacade.UpdateTS(ts); } else { return(messages); } // 开始设置回流 ActionFactory actionFactory = new ActionFactory(this.DataProvider); IAction actionTSComplete = actionFactory.CreateAction(ActionType.DataCollectAction_TSComplete); TSActionEventArgs tsactionEventArgs = new TSActionEventArgs( ActionType.DataCollectAction_TSComplete, actionEventArgs.LotCode, actionEventArgs.UserCode, actionEventArgs.ResourceCode, TSStatus.TSStatus_Reflow, actionEventArgs.ProductInfo.NowSimulation.MOCode, actionEventArgs.ProductInfo.NowSimulation.ItemCode, routeCode, op.OPCode, actionEventArgs.UserCode, null); tsactionEventArgs.RouteCode = routeCode; tsactionEventArgs.IgnoreResourceInOPTS = true; messages.AddMessages(actionTSComplete.Execute(tsactionEventArgs)); return(messages); }
private Messages DropLoadedParts(string rcard) { Messages msg = new Messages(); ActionOnLineHelper onLine = new ActionOnLineHelper(DataProvider); MaterialFacade materialFacade = new MaterialFacade(this.DataProvider); ItemFacade itemFacade = new ItemFacade(this.DataProvider); DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); TSFacade tsFacade = new TSFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(rcard.Trim().ToUpper(), string.Empty); ProductInfo product = GetProduct(sourceRCard); if (product == null || product.LastSimulation == null) { msg.Add(new UserControl.Message(MessageType.Error, "$NoSimulation")); return(msg); } // Marked By HI1/Venus.Feng on 20081013 for Hisense Version : GOOD can do drop /* * if (product.LastSimulation.ProductStatus != ProductStatus.NG) * { * msg.Add(new UserControl.Message(MessageType.Error, "$DropMaterial_Need_NG")); * return msg; * } */ // End Marked msg.Add(new UserControl.Message(rcard)); //获取所有需要拆解或者替换的Parts ArrayList partsToUnload = new ArrayList(); for (int i = 0; i < this.ultraGridLoadedPart.Rows.Count; i++) { if (ultraGridLoadedPart.Rows[i].Cells[0].Text.ToLower() == "true") { InnoObject innoObject = new InnoObject(); innoObject.LineIndex = i; innoObject.MCard = ultraGridLoadedPart.Rows[i].Cells["PackedNo"].Text; innoObject.MCardType = ultraGridLoadedPart.Rows[i].Cells["MCardType"].Text; innoObject.ItemIndex = partsToUnload.Count + 1; innoObject.MItemCode = ultraGridLoadedPart.Rows[i].Cells["ItemCode"].Text; innoObject.MOCode = ultraGridLoadedPart.Rows[i].Cells["MOCode"].Text; innoObject.Qty = 1; innoObject.NewBarcode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(ultraGridLoadedPart.Rows[i].Cells["NewBarcode"].Text.Trim())); partsToUnload.Add(innoObject); } } //对于需要替换的Parts,需要做类似上料中的解析和检查 for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; if (innoObject.NewBarcode.Trim().Length > 0) { //抓取物料的设定 Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterial(innoObject.MItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (material == null) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_NotFound")); return(msg); } string barcode = innoObject.NewBarcode.Trim(); //模拟一个OPBOMDetail OPBOMDetail detailTemp = new OPBOMDetail(); detailTemp.OPBOMItemControlType = material.MaterialControlType; detailTemp.OPBOMParseType = material.MaterialParseType; detailTemp.OPBOMCheckType = material.MaterialCheckType; detailTemp.CheckStatus = material.CheckStatus; detailTemp.SerialNoLength = material.SerialNoLength; detailTemp.NeedVendor = material.NeedVendor; detailTemp.OPBOMSourceItemCode = innoObject.MItemCode; detailTemp.OPBOMItemCode = innoObject.MItemCode; detailTemp.OPBOMItemQty = 1; MINNO newMINNO = new MINNO(); newMINNO.MOCode = innoObject.MOCode.Trim(); newMINNO.MItemCode = material.MaterialCode.Trim(); Messages collectMessage = dataCollectFacade.GetMINNOByBarcode(detailTemp, barcode, newMINNO.MOCode, null, false, false, out newMINNO); if (collectMessage.IsSuccess()) { innoObject.NewLotNo = newMINNO.LotNO; innoObject.NewPCBA = newMINNO.PCBA; innoObject.NewBIOS = newMINNO.BIOS; innoObject.NewVersion = newMINNO.Version; innoObject.NewVendorItemCode = newMINNO.VendorItemCode; innoObject.NewVendorCode = newMINNO.VendorCode; innoObject.NewDateCode = newMINNO.DateCode; } else { msg.AddMessages(collectMessage); return(msg); } } } try { this.DataProvider.BeginTransaction(); //更新试流单 //下料中处理tbltry,tbltry2rcard for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; TryEventArgs tryEventArgs = new TryEventArgs( ActionType.DataCollectAction_TryNew, ApplicationService.Current().UserCode, product.LastSimulation.OPCode, ApplicationService.Current().ResourceCode, product.LastSimulation.ItemCode, sourceRCard, innoObject.MItemCode, innoObject.MCard, string.Empty, false, false); msg.AddMessages(onLine.ActionWithTransaction(tryEventArgs)); if (!msg.IsSuccess()) { DataProvider.RollbackTransaction(); return(msg); } } //更新试流单 //上料中处理tbltry,tbltry2rcard for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; if (innoObject.NewBarcode.Trim().Length > 0) { TryEventArgs tryEventArgs = new TryEventArgs( ActionType.DataCollectAction_TryNew, ApplicationService.Current().UserCode, product.LastSimulation.OPCode, ApplicationService.Current().ResourceCode, product.LastSimulation.ItemCode, sourceRCard, innoObject.MItemCode, innoObject.NewBarcode, string.Empty, true, true); msg.AddMessages(onLine.ActionWithTransaction(tryEventArgs)); if (!msg.IsSuccess()) { DataProvider.RollbackTransaction(); return(msg); } } } //检查新上料是否在TS中而不可用 for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; if (innoObject.NewBarcode.Trim().Length > 0) { if (!tsFacade.RunningCardCanBeClollected(innoObject.NewBarcode.Trim(), CardType.CardType_Part)) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_InTSOrScrapped $SERIAL_NO=" + innoObject.NewBarcode.Trim())); DataProvider.RollbackTransaction(); return(msg); } } } //拆解或者替换处理tblonwipitem,tblsimulationreport DropMaterialEventArgs dropMaterialEventArgs = new DropMaterialEventArgs(ActionType.DataCollectAction_DropMaterial, product.LastSimulation.RunningCard, ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode, product); dropMaterialEventArgs.OnwipItems = partsToUnload.ToArray(); msg.AddMessages(onLine.ActionWithTransaction(dropMaterialEventArgs)); if (!msg.IsSuccess()) { DataProvider.RollbackTransaction(); return(msg); } //针对拆解下的物料,做TS相关的动作 for (int i = 0; i < partsToUnload.Count; i++) { InnoObject innoObject = (InnoObject)partsToUnload[i]; if (_TSList[innoObject.LineIndex] != null) { if (_TSErrorCodeList[innoObject.LineIndex] == null) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_Please_Select_ErrorCode")); DataProvider.RollbackTransaction(); return(msg); } Domain.TS.TS oldTS = (Domain.TS.TS)tsFacade.QueryLastTSByRunningCard(innoObject.MCard); if (oldTS != null) { if (oldTS.TSStatus == TSStatus.TSStatus_New || oldTS.TSStatus == TSStatus.TSStatus_Confirm || oldTS.TSStatus == TSStatus.TSStatus_TS) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_InTS")); DataProvider.RollbackTransaction(); return(msg); } else if (oldTS.TSStatus != TSStatus.TSStatus_Reflow && oldTS.TSStatus != TSStatus.TSStatus_Split && oldTS.TSStatus != TSStatus.TSStatus_Complete && oldTS.TSStatus != TSStatus.TSStatus_Scrap) { msg.Add(new UserControl.Message(MessageType.Error, "$Error_Material_WrongTSStatus")); DataProvider.RollbackTransaction(); return(msg); } } Domain.TS.TS newTS = (Domain.TS.TS)_TSList[innoObject.LineIndex]; tsFacade.AddTS(newTS); foreach (TSErrorCode tsErrorCode in (TSErrorCode[])_TSErrorCodeList[innoObject.LineIndex]) { tsErrorCode.RunningCard = newTS.RunningCard; tsErrorCode.RunningCardSequence = newTS.RunningCardSequence; tsErrorCode.ItemCode = newTS.ItemCode; tsErrorCode.ModelCode = newTS.ModelCode; tsErrorCode.MOCode = newTS.MOCode; tsErrorCode.MOSeq = newTS.MOSeq; tsErrorCode.MaintainUser = newTS.MaintainUser; tsErrorCode.MaintainDate = newTS.MaintainDate; tsErrorCode.MaintainTime = newTS.MaintainTime; tsFacade.AddTSErrorCode(tsErrorCode); } } } if (!msg.IsSuccess()) { DataProvider.RollbackTransaction(); return(msg); } if (msg.IsSuccess()) { DataProvider.CommitTransaction(); } else { DataProvider.RollbackTransaction(); } } catch (Exception e) { this.DataProvider.RollbackTransaction(); msg.Add(new UserControl.Message(e)); } return(msg); }
private Domain.TS.TS GetNewTS(string runningCard, string partItemCode, string partRunningCard, string userCode) { SystemSettingFacade systemSettingFacade = new SystemSettingFacade(this.DataProvider); ShiftModelFacade shiftModelFacade = new ShiftModelFacade(this.DataProvider); ModelFacade modelFacade = new ModelFacade(this.DataProvider); TSFacade tsFacade = new TSFacade(this.DataProvider); DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(runningCard.Trim().ToUpper(), string.Empty); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); SimulationReport lastSimulation = dataCollectFacade.GetLastSimulationReport(sourceRCard); if (lastSimulation == null) { return(null); } Domain.TS.TS newTS = tsFacade.CreateNewTS(); newTS.TSId = Guid.NewGuid().ToString(); newTS.RunningCard = partRunningCard; newTS.RunningCardSequence = dataCollectFacade.GetMaxRCardSequenceFromTS(partRunningCard) + 100; newTS.TranslateCard = partRunningCard; newTS.TranslateCardSequence = newTS.RunningCardSequence; newTS.SourceCard = partRunningCard; newTS.SourceCardSequence = newTS.RunningCardSequence; newTS.CardType = CardType.CardType_Part; newTS.ReplacedRunningCard = " "; newTS.ItemCode = partItemCode; Model model = (Model)modelFacade.GetModelByItemCode(partItemCode); if (model == null) { Parameter parameter = (Parameter)systemSettingFacade.GetParameter("PING", "DEFAULT_MODEL_CODE"); if (parameter != null) { newTS.ModelCode = parameter.ParameterAlias.Trim().ToUpper(); } } else { newTS.ModelCode = model.ModelCode; } newTS.MOCode = lastSimulation.MOCode; newTS.FromRouteCode = lastSimulation.RouteCode; newTS.FromOPCode = lastSimulation.OPCode; newTS.FromResourceCode = lastSimulation.ResourceCode; newTS.FromSegmentCode = lastSimulation.SegmentCode; newTS.FromStepSequenceCode = lastSimulation.StepSequenceCode; newTS.FromShiftTypeCode = lastSimulation.ShiftTypeCode; newTS.MOSeq = lastSimulation.MOSeq; TimePeriod tp = (TimePeriod)shiftModelFacade.GetTimePeriod(newTS.FromShiftTypeCode, dbDateTime.DBTime); if (tp != null) { newTS.FromTimePeriodCode = tp.TimePeriodCode; newTS.FromShiftCode = tp.ShiftCode; newTS.FromShiftDay = shiftModelFacade.GetShiftDay(tp, dbDateTime.DateTime); } newTS.FromUser = userCode; newTS.FromDate = dbDateTime.DBDate; newTS.FormTime = dbDateTime.DBTime; newTS.MaintainUser = userCode; newTS.MaintainDate = dbDateTime.DBDate; newTS.MaintainTime = dbDateTime.DBTime; newTS.TSTimes = tsFacade.GetMaxTSTimes(partRunningCard) + 1; newTS.FromInputType = TSSource.TSSource_TS; newTS.TSStatus = TSStatus.TSStatus_New; newTS.TransactionStatus = TransactionStatus.TransactionStatus_NO; return(newTS); }
private BenQGuru.eMES.Domain.TS.TSErrorCode GetTSErrorCode(RMADetial rmadetial, Domain.TS.TS ts) { if (_TSModelFacade == null) { _TSModelFacade = new TSModelFacade(this.DataProvider); } object objEcg = _TSModelFacade.GetErrorCodeGroup2ErrorCodeByecCode(rmadetial.Errorcode); Domain.TS.TSErrorCode tsErrorCode = new Domain.TS.TSErrorCode(); tsErrorCode.ErrorCode = rmadetial.Errorcode; if (objEcg != null) { tsErrorCode.ErrorCodeGroup = (objEcg as Domain.TSModel.ErrorCodeGroup2ErrorCode).ErrorCodeGroup; } else { tsErrorCode.ErrorCodeGroup = " "; } tsErrorCode.ItemCode = rmadetial.Itemcode; tsErrorCode.TSId = ts.TSId; tsErrorCode.RunningCard = rmadetial.Rcard; tsErrorCode.RunningCardSequence = ts.RunningCardSequence; tsErrorCode.ModelCode = ts.ModelCode; tsErrorCode.MOCode = ""; tsErrorCode.MaintainUser = this.GetUserCode(); tsErrorCode.MaintainDate = FormatHelper.TODateInt(DateTime.Now); tsErrorCode.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); return(tsErrorCode); }
private void ultraGridLoadedPart_CellChange(object sender, CellEventArgs e) { if (e.Cell.Column.Key == "Check" && !bool.Parse(e.Cell.Text)) { ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["TSCheck"].Value = false; ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["ErrorCode"].Value = string.Empty; ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["NewBarcode"].Value = string.Empty; RemoveHashtableItem(e.Cell.Row.Index); } if (e.Cell.Column.Key == "TSCheck") { if (ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["MCardType"].Text == MCardType.MCardType_Keyparts) { if (bool.Parse(e.Cell.Text)) { Domain.TS.TS newTS = GetNewTS( _CurrentRunningCard, ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["ItemCode"].Text, ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["PackedNo"].Text, ApplicationService.Current().UserCode); FTSErrorEdit form = new FTSErrorEdit(); form.RunningCardTitle = "Material"; form.AddTSErrorCodeWhenSave = false; form.CurrentTS = newTS; form.ShowDialog(); TSErrorCode[] selectedTSErrorCodeList = form.SelectedTSErrorCode; if (selectedTSErrorCodeList == null) { e.Cell.Value = false; } else { string codeList = string.Empty; for (int i = 0; i < selectedTSErrorCodeList.Length; i++) { if (codeList.Trim().Length > 0) { codeList += "; "; } codeList += selectedTSErrorCodeList[i].ErrorCodeGroup + ":" + selectedTSErrorCodeList[i].ErrorCode; } ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["ErrorCode"].Value = codeList; _TSList.Add(e.Cell.Row.Index, newTS); _TSErrorCodeList.Add(e.Cell.Row.Index, selectedTSErrorCodeList); ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["Check"].Value = true; } } else { ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["ErrorCode"].Value = string.Empty; RemoveHashtableItem(e.Cell.Row.Index); } } else { e.Cell.Value = false; } } if (e.Cell.Column.Key == "NewBarcode" && e.Cell.Text.Trim().Length > 0 && !bool.Parse(ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["Check"].Text)) { ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["Check"].Value = true; } if (e.Cell.Column.Key == "NewBarcode" && e.Cell.Text.Trim().Length <= 0 && bool.Parse(ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["Check"].Text)) { ultraGridLoadedPart.Rows[e.Cell.Row.Index].Cells["Check"].Value = false; } }
public Messages Execute(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect"); dataCollectDebug.WhenFunctionIn(messages); try { ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //填写SIMULATION 检查工单、ID、途程、操作 messages.AddMessages(dataCollect.CheckID(actionEventArgs)); //检查是否完工 if (actionEventArgs.ProductInfo.LastSimulation.IsComplete == "1") { messages.Add(new UserControl.Message(MessageType.Error, "$CS_PRODUCT_ALREADY_COMPLETE $CS_Param_OPCode =" + actionEventArgs.ProductInfo.LastSimulation.OPCode)); } if (messages.IsSuccess()) { //Laws Lu,2005/08/15,新增 完工逻辑,在其他Check都通过的情况下,所有的RunningCard应该是GOOD状态 //暂时不考虑线外工序 actionEventArgs.ProductInfo.NowSimulation.IsComplete = "1"; actionEventArgs.ProductInfo.NowSimulation.EAttribute1 = ProductStatus.OffMo; actionEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.OffMo; //End Laws Lu messages.AddMessages(dataCollect.Execute(actionEventArgs)); if (messages.IsSuccess()) { //更新维修记录 if (actionEventArgs.ProductInfo.LastTS != null) { //2006/02/08 修改 修改维修记录状态 Domain.TS.TS ts = actionEventArgs.ProductInfo.LastTS; TS.TSFacade tsFAC = new BenQGuru.eMES.TS.TSFacade(DataProvider); // if(ts.TSStatus == TSStatus.TSStatus_New) // { // tsFAC.DeleteTS(ts); // } // else // { tsFAC.UpdateTSStatus(ts.TSId, TSStatus.TSStatus_OffMo, actionEventArgs.UserCode); // } // ts.TSId = FormatHelper.GetUniqueID(actionEventArgs.ProductInfo.NowSimulation.MOCode // ,ts.RunningCard,ts.RunningCardSequence.ToString()); // // ts.MaintainUser = actionEventArgs.UserCode; // ts.MaintainDate = FormatHelper.TODateInt(DateTime.Now); // ts.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); // // ts.TSStatus = TSStatus.TSStatus_OffMo; // // // tsFAC.AddTS(ts); } ///下料扣库存 /// //Laws Lu,2005/10/20,新增 使用配置文件来控制物料模块是否使用 if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1") { BenQGuru.eMES.Material.CastDownHelper castHelper = new BenQGuru.eMES.Material.CastDownHelper(DataProvider); ArrayList arRcard = new ArrayList(); castHelper.GetAllRCardByMo(ref arRcard, actionEventArgs.ProductInfo.NowSimulation.RunningCard, actionEventArgs.ProductInfo.NowSimulation.MOCode); if (arRcard.Count == 0) { arRcard.Add(actionEventArgs.RunningCard); } string runningCards = "('" + String.Join("','", (string[])arRcard.ToArray(typeof(string))) + "')"; //下料并归还库房 BenQGuru.eMES.Material.WarehouseFacade wfacade = new BenQGuru.eMES.Material.WarehouseFacade(this.DataProvider); wfacade.DropMaterialStock(runningCards , actionEventArgs.ProductInfo.NowSimulation.MOCode, actionEventArgs.ProductInfo.NowSimulation.OPCode); } //填写测试报表 TODO //ReportHelper reportCollect= new ReportHelper(this.DataProvider); //messages.AddMessages(reportCollect.ReportLineQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo)); //messages.AddMessages(reportCollect.ReportResQuanMaster(this.DataProvider,actionEventArgs.ActionType,actionEventArgs.ProductInfo)); //填写脱离工单表 MOFacade moFAC = new MOFacade(DataProvider); OffMoCard offCard = new OffMoCard(); offCard.PK = System.Guid.NewGuid().ToString(); offCard.MoCode = actionEventArgs.ProductInfo.NowSimulation.MOCode; offCard.RCARD = actionEventArgs.RunningCard; offCard.MoType = (actionEventArgs as OffMoEventArgs).MOType; offCard.MUSER = actionEventArgs.UserCode; offCard.MDATE = actionEventArgs.ProductInfo.NowSimulation.MaintainDate; offCard.MTIME = actionEventArgs.ProductInfo.NowSimulation.MaintainTime; moFAC.AddOffMoCard(offCard); } } } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }
protected void cmdDistribution_ServerClick(object sender, EventArgs e) { /* 下发的时候需要 */ if (_facade == null) { _facade = new BenQGuru.eMES.MOModel.RMAFacade(base.DataProvider); } ArrayList array = this.gridHelper.GetCheckedRows(); if (array.Count > 0) { ArrayList items = new ArrayList(array.Count); foreach (GridRecord row in array) { RMABill rmaBill = (RMABill)this.GetEditObject(row); if (rmaBill != null) { if (rmaBill.Status != RMABillStatus.Initial) { WebInfoPublish.PublishInfo(this, "$BS_RMABillStatus_CannotOpened $RMABillCode:" + rmaBill.RMABillCode, this.languageComponent1); return; } object[] objs = _facade.QueryRMADetail(rmaBill.RMABillCode); if (objs == null || objs.Length == 0) { WebInfoPublish.PublishInfo(this, "$BS_RMABillDetail_NOT_EXIST $RMABillCode:" + rmaBill.RMABillCode, this.languageComponent1); return; } items.Add(rmaBill); } } if (_TSFacade == null) { _TSFacade = new TSFacade(this.DataProvider); } //放在事务中处理 this.DataProvider.BeginTransaction(); foreach (RMABill rmabill in items) { // Update RMA Status rmabill.Status = RMABillStatus.Opened; _facade.UpdateRMABill(rmabill); object[] objs = _facade.QueryRMADetail(rmabill.RMABillCode); if (objs != null || objs.Length != 0) { foreach (RMADetial detial in objs) { //如果该序列号的处理方式为维修的,需要往TBLTS和TBLTSERRORCODE插入数据 if (detial.Handelcode == "ts") { //Insert TS Domain.TS.TS ts = this.GetTS(detial); _TSFacade.AddTS(ts); Domain.TS.TSErrorCode tsErrorCode = this.GetTSErrorCode(detial, ts); _TSFacade.AddTSErrorCode(tsErrorCode); } } } } this.DataProvider.CommitTransaction(); } //InitViewPanel(); this.RequestData(); }
/// <summary> /// ** 功能描述: 确认流程卡序列号的维修 /// ** 作 者: crystal chu /// ** 日 期: 2005/07/26/ /// ** 修 改: /// ** 日 期: /// ** nunit /// </summary> /// <param name="actionEventArgs"> </param> /// <returns></returns> public Messages Execute(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect"); dataCollectDebug.WhenFunctionIn(messages); try { ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //检查res在不在OPTS中 messages.AddMessages(dataCollect.CheckResourceInOperationTS(actionEventArgs)); //Laws Lu,2006/11/13 uniform system collect date DBDateTime dbDateTime; //Laws Lu,2006/11/13 uniform system collect date if (actionEventArgs.ProductInfo != null && actionEventArgs.ProductInfo.WorkDateTime != null) { dbDateTime = actionEventArgs.ProductInfo.WorkDateTime; } else { dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); if (actionEventArgs.ProductInfo != null) { actionEventArgs.ProductInfo.WorkDateTime = dbDateTime; } } DateTime dtNow = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime); if (messages.IsSuccess()) { //Laws Lu,2005/09/16,修改 整理逻辑 TSFacade tsFacade = new TSFacade(this.DataProvider); // if( !tsFacade.IsCardInTS(actionEventArgs.RunningCard)) // { // messages.Add(new Message(MessageType.Error,"$CSError_Card_Not_In_TS")); // } //Laws Lu,2005/10/16,在订单1中的已经拆解的产品序列号, //现在系统中可以实现将该产品序列号重新归属到另外一个订单2, //但是该产品序列号在工单2采集完不良后, //作送修作业时,系统提出报错信息: //该产品状态为“拆解”状态。导致该产品序列号无法进行维修。 object obj = tsFacade.GetCardLastTSRecordInNewStatus(actionEventArgs.RunningCard); if (obj == null) { //Laws Lu,2006,07/05 Support RMA Repair // if(actionEventArgs.IsRMA) // { MOFacade moFAC = new MOFacade(DataProvider); object objRMA = moFAC.GetRepairRMARCARDByRcard(actionEventArgs.RunningCard); if (objRMA != null) { #region 新增维修信息 RMARCARD rma = objRMA as RMARCARD; Domain.TS.TS tS = tsFacade.CreateNewTS(); tS.TSId = FormatHelper.GetUniqueID((rma.REWORKMOCODE == String.Empty?rma.RMABILLNO:rma.REWORKMOCODE) , actionEventArgs.RunningCard, ActionOnLineHelper.StartSeq.ToString()); tS.CardType = CardType.CardType_Product;; tS.FormTime = rma.MTIME; tS.FromDate = rma.MDATE; tS.FromInputType = TSFacade.TSSource_RMA; tS.FromUser = rma.MUSER; tS.FromMemo = rma.EATTRIBUTE1; //Laws Lu,2006/07/05 add support RMA tS.RMABillCode = rma.RMABILLNO; //工作时间和工业布局信息 //Laws Lu,2005/11/09,新增 记录ShiftDay BaseSetting.BaseModelFacade dataModel = new BaseSetting.BaseModelFacade(this.DataProvider); Domain.BaseSetting.Resource res = (Domain.BaseSetting.Resource)dataModel.GetResource(actionEventArgs.ResourceCode); //onwip.SegmentCode = productInfo.NowSimulationReport.SegmentCode; //2006/11/17,Laws Lu add get DateTime from db Server BaseSetting.ShiftModelFacade shiftModel = new BaseSetting.ShiftModelFacade(this.DataProvider); Domain.BaseSetting.TimePeriod period = (Domain.BaseSetting.TimePeriod)shiftModel.GetTimePeriod(res.ShiftTypeCode, Web.Helper.FormatHelper.TOTimeInt(dtNow)); if (period == null) { throw new Exception("$OutOfPerid"); } if (period.IsOverDate == Web.Helper.FormatHelper.TRUE_STRING) { if (period.TimePeriodBeginTime < period.TimePeriodEndTime) { tS.FromShiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1)); } else if (Web.Helper.FormatHelper.TOTimeInt(dtNow) < period.TimePeriodBeginTime) { tS.FromShiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1)); } else { tS.FromShiftDay = FormatHelper.TODateInt(dtNow); } } else { tS.FromShiftDay = FormatHelper.TODateInt(dtNow); } tS.FromOPCode = "TS"; tS.FromResourceCode = actionEventArgs.ResourceCode; tS.FromRouteCode = String.Empty; tS.FromSegmentCode = res.SegmentCode; tS.FromShiftCode = period.ShiftCode; /*Laws Lu,2006/03/11 修正班次填写有误*/ tS.FromShiftTypeCode = period.ShiftTypeCode; tS.FromStepSequenceCode = res.StepSequenceCode; tS.FromTimePeriodCode = period.TimePeriodCode; tS.ItemCode = rma.ITEMCODE; tS.MaintainDate = FormatHelper.TODateInt(dtNow); tS.MaintainTime = FormatHelper.TOTimeInt(dtNow); tS.MaintainUser = actionEventArgs.MaintainUser; tS.MOCode = (rma.REWORKMOCODE == String.Empty?rma.RMABILLNO:rma.REWORKMOCODE); tS.ModelCode = rma.MODELCODE; tS.RunningCard = actionEventArgs.RunningCard; tS.RunningCardSequence = ActionOnLineHelper.StartSeq; tS.SourceCard = actionEventArgs.RunningCard; tS.SourceCardSequence = ActionOnLineHelper.StartSeq; tS.TransactionStatus = TSFacade.TransactionStatus_None; tS.TranslateCard = actionEventArgs.RunningCard; tS.TranslateCardSequence = ActionOnLineHelper.StartSeq; //tS.TSStatus = TSStatus.TSStatus_New; tS.Week = (new ReportHelper(DataProvider)).WeekOfYear(tS.FromShiftDay.ToString()); tS.Month = int.Parse(tS.FromShiftDay.ToString().Substring(4, 2)); tS.TSTimes = ActionOnLineHelper.StartNGTimes; tS.ConfirmUser = actionEventArgs.UserCode; tS.ConfirmDate = FormatHelper.TODateInt(dtNow); tS.ConfirmTime = FormatHelper.TOTimeInt(dtNow); tS.ConfirmOPCode = "TS"; tS.ConfirmResourceCode = actionEventArgs.ResourceCode; tS.TSStatus = TSStatus.TSStatus_Confirm; // Added by Icyer 2007/07/03 MO mo = (MO)moFAC.GetMO(tS.MOCode); if (mo != null) { tS.MOSeq = mo.MOSeq; } // Added end tsFacade.AddTS(tS); //Laws Lu,2006/07/07 add ,Success release than delete rma moFAC.DeleteRMARCARD(rma); #endregion } else { messages.Add(new Message(MessageType.Error, "$CSError_Card_Not_In_TS_OR_Status_Error")); } // } // else // { // messages.Add(new Message(MessageType.Error,"$CSError_Card_Not_In_TS_OR_Status_Error")); // } } else { BenQGuru.eMES.Domain.TS.TS ts = (BenQGuru.eMES.Domain.TS.TS)obj; if (ts.TSStatus == TSStatus.TSStatus_New) { ts.ConfirmUser = actionEventArgs.UserCode; ts.ConfirmDate = FormatHelper.TODateInt(dtNow); ts.ConfirmTime = FormatHelper.TOTimeInt(dtNow); ts.ConfirmOPCode = "TS"; ts.ConfirmResourceCode = actionEventArgs.ResourceCode; ts.TSStatus = TSStatus.TSStatus_Confirm; //added by jessie lee, 2005/11/24, ts.MaintainUser = actionEventArgs.MaintainUser; ts.MaintainDate = FormatHelper.TODateInt(dtNow); ts.MaintainTime = FormatHelper.TOTimeInt(dtNow); tsFacade.UpdateTSConfirmStatus(ts); } else { messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_Error $Current_Status $" + ts.TSStatus)); } } } } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }
private void QueryPicsNG() { Messages msg = new Messages(); this.imageListPicsNG.Images.Clear(); this.listPicsNG.Items.Clear(); if (_tsFacade == null) { _tsFacade = new TSFacade(this.DataProvider); } if (string.IsNullOrEmpty(this.txtRcard.Text)) { return; } object obj = _tsFacade.QueryLastTSByRunningCard(this.txtRcard.Text); int imgnum = 0; if (obj != null) { Domain.TS.TS ts = (Domain.TS.TS)obj; if (ts.TSStatus == TSStatus.TSStatus_Complete) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_TS_Completed")); ApplicationRun.GetInfoForm().Add(msg); } else { EsopPicsNGFacade m_EsopPicsNGFacade = new EsopPicsNGFacade(this.DataProvider); object[] objPicsNG = m_EsopPicsNGFacade.QueryEsopPicsNG(this.txtRcard.Text, ts.TSId); if (objPicsNG != null && objPicsNG.Length > 0) { string filaPath = ""; if (_facade == null) { _facade = new SystemSettingFacade(this.DataProvider); } object parameter = _facade.GetParameter("PUBLISHESOPPICSDIRPATH", "PUBLISHEOPSPICSDIRPATHGROUP"); if (parameter != null) { //服务器目录路径 filaPath = ((Domain.BaseSetting.Parameter)parameter).ParameterAlias; } foreach (Esoppicsng picNG in objPicsNG) { string fileName = filaPath + "TS/" + picNG.Picsname + ".jpg"; try { WebClient wc = new WebClient(); wc.Credentials = CredentialCache.DefaultCredentials; // wc.DownloadData(fileName); Stream fs = wc.OpenRead(fileName); this.imageListPicsNG.Images.Add(Image.FromStream(fs)); ListViewItem lvi = new ListViewItem(); // lvi.Text = pic.Picfullname; //图片名称 lvi.ImageIndex = imgnum; //这里是Listview每项显示的图片 lvi.Tag = picNG; //这里绑定不显示的数据 this.listPicsNG.Items.Add(lvi); fs.Flush(); fs.Close(); imgnum++; } catch (Exception ex) { } } if (this.imageListPicsNG.Images.Count > 0) { this.imageListPicsNG.ColorDepth = ColorDepth.Depth32Bit; Size size = new Size(); size.Width = 100; size.Height = 82; this.imageListPicsNG.ImageSize = size; this.listPicsNG.LargeImageList = this.imageListPicsNG; this.listPicsNG.MultiSelect = false; } } else { msg.Add(new UserControl.Message(MessageType.Success, "$File_Not_Exist")); ApplicationRun.GetInfoForm().Add(msg); } } } else { msg.Add(new UserControl.Message(MessageType.Error, "$CS_TS_Not_Exist")); ApplicationRun.GetInfoForm().Add(msg); } }
/// <summary> /// 维修完成 /// </summary> /// <param name="actionEventArgs"></param> /// <returns></returns> public Messages Execute(ActionEventArgs actionEventArgs) { Messages messages = new Messages(); DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect"); dataCollectDebug.WhenFunctionIn(messages); try { ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider); //检查res在不在OPTS中 // Modified By Hi1/Venus.Feng on 20080711 for Hisense Version : 对于自动作Reflow的动作来讲,不再Check Resource是否在回流的工序中 if (((TSActionEventArgs)actionEventArgs).IgnoreResourceInOPTS != true) { messages.AddMessages(dataCollect.CheckResourceInOperationTS(actionEventArgs)); } // End Modified if (messages.IsSuccess()) { TSFacade tsFacade = new TSFacade(this.DataProvider); // if( !tsFacade.IsCardInTS(actionEventArgs.RunningCard)) // { // messages.Add(new Message(MessageType.Error,"$CSError_Card_Not_In_TS")); // } // if(messages.IsSuccess()) // { //Laws Lu,2005/09/16,修改 逻辑调整P4.8 object obj = tsFacade.GetCardLastTSRecord(actionEventArgs.RunningCard); if (obj == null) { messages.Add(new Message(MessageType.Error, "$CSError_Card_Not_In_TS")); //messages.Add(new Message(MessageType.Error,"$CSError_Card_TSStatus_IsNot_TS")); } else { Domain.TS.TS ts = (Domain.TS.TS)obj; if (ts.TSStatus == TSStatus.TSStatus_Scrap || ts.TSStatus == TSStatus.TSStatus_Split || ts.TSStatus == TSStatus.TSStatus_Reflow || ts.TSStatus == TSStatus.TSStatus_Confirm) { messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus)); } if (messages.IsSuccess()) { //2006/11/17,Laws Lu add get DateTime from db Server DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); DateTime dtNow = FormatHelper.ToDateTime(dbDateTime.DBDate, dbDateTime.DBTime); //修改 Karron Qiu,2005-9-26 if (ts.FromInputType == TS.TSFacade.TSSource_OnWIP)//线上.必须是回流或者报废 { if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Complete) { messages.Add(new Message(MessageType.Error, "$CSError_Please_Select_Reflow_OR_Scrap"));//请选择回流或者报废 } } else if (ts.FromInputType == TS.TSFacade.TSSource_TS)//离线. 不能回流 { if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Reflow) { messages.Add(new Message(MessageType.Error, "$CSError_Offline_Cannot_Reflow"));//离线不能回流 } } else if (ts.FromInputType == TS.TSFacade.TSSource_RMA)//RMA. 不能回流 { if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Reflow) { messages.Add(new Message(MessageType.Error, "$CSError_RMATS_Cannot_Reflow"));//RMA不能回流 } } //Laws Lu,2005/11/09,新增 记录ShiftDay BaseSetting.BaseModelFacade dataModel = new BaseSetting.BaseModelFacade(this.DataProvider); Domain.BaseSetting.Resource res = (Domain.BaseSetting.Resource)dataModel.GetResource(actionEventArgs.ResourceCode); //onwip.SegmentCode = productInfo.NowSimulationReport.SegmentCode; BaseSetting.ShiftModelFacade shiftModel = new BaseSetting.ShiftModelFacade(this.DataProvider); Domain.BaseSetting.TimePeriod period = (Domain.BaseSetting.TimePeriod)shiftModel.GetTimePeriod(res.ShiftTypeCode, Web.Helper.FormatHelper.TOTimeInt(dtNow)); int shiftDay = 0; if (period == null) { throw new Exception("$OutOfPerid"); } if (period.IsOverDate == Web.Helper.FormatHelper.TRUE_STRING) { if (period.TimePeriodBeginTime < period.TimePeriodEndTime) { shiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1)); } else if (Web.Helper.FormatHelper.TOTimeInt(dtNow) < period.TimePeriodBeginTime) { shiftDay = FormatHelper.TODateInt(dtNow.AddDays(-1)); } else { shiftDay = FormatHelper.TODateInt(dtNow); } } else { shiftDay = FormatHelper.TODateInt(dtNow); } #region 报废 if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Scrap) { if (ts.TSStatus == TSStatus.TSStatus_TS || ts.TSStatus == TSStatus.TSStatus_Confirm) { ts.TSStatus = TSStatus.TSStatus_Scrap; ts.TSResourceCode = actionEventArgs.ResourceCode; ts.TSUser = actionEventArgs.UserCode; ts.TSDate = shiftDay; ts.TSTime = FormatHelper.TOTimeInt(dtNow); //added by jessie lee, 2005/11/24, //新增报废原因 ts.ScrapCause = (actionEventArgs as TSActionEventArgs).ScrapCause; ts.MaintainUser = (actionEventArgs as TSActionEventArgs).MaintainUser; ts.MaintainDate = ts.TSDate; ts.MaintainTime = ts.TSTime; //TODO:Laws Lu,2005/11/09,需要优化 tsFacade.UpdateTS(ts); //added by alex,2010/11/09 BenQGuru.eMES.OQC.OQCFacade oqcFacade = new BenQGuru.eMES.OQC.OQCFacade(this.DataProvider); OQCLot2Card oqcLot2Card = oqcFacade.GetLastOQCLot2CardByRCard(actionEventArgs.RunningCard) as OQCLot2Card; if (oqcLot2Card != null) { oqcLot2Card.Status = "SCRAP"; oqcFacade.UpdateOQCLot2Card(oqcLot2Card); } MOFacade moFAC = new MOFacade(this._domainDataProvider); if (ts.FromInputType == TSFacade.TSSource_OnWIP) { //Laws Lu,2005/08/19,新增 //Laws Lu,2005/08/25,修改 处理报废时,更新工单的报废数量 doAction(actionEventArgs); } } else { messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS_OR_Confirm")); } } #endregion #region 完成 if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Complete) { if (ts.TSStatus == TSStatus.TSStatus_TS) { ts.TSStatus = TSStatus.TSStatus_Complete; ts.TSTimes = 1; //added by jessie lee, 2005/11/24, ts.MaintainUser = (actionEventArgs as TSActionEventArgs).MaintainUser; ts.TSUser = actionEventArgs.UserCode; ts.MaintainDate = FormatHelper.TODateInt(dtNow); ts.MaintainTime = FormatHelper.TOTimeInt(dtNow); //Laws Lu,2006/04/28 add 添加维修shiftday和维修resourcecode ts.TSDate = shiftDay; ts.TSTime = FormatHelper.TOTimeInt(dtNow); ts.TSResourceCode = actionEventArgs.ResourceCode; tsFacade.UpdateTS(ts); // Added by Icyer 2006/11/07, KeyPart维修完成 if (ts.CardType == CardType.CardType_Part && ts.FromInputType == TSFacade.TSSource_TS) { DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); SimulationReport simRpt = dataCollectFacade.GetLastSimulationReport(ts.RunningCard); if (simRpt != null && simRpt.Status == ProductStatus.NG) { simRpt.Status = ProductStatus.GOOD; dataCollectFacade.UpdateSimulationReport(simRpt); } } // Added end } else { messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus)); } } #endregion #region 回流 if (((TSActionEventArgs)actionEventArgs).TSStatus == TSStatus.TSStatus_Reflow) { if (ts.TSStatus == TSStatus.TSStatus_TS) { ts.TSStatus = TSStatus.TSStatus_Reflow; ts.ReflowMOCode = ((TSActionEventArgs)actionEventArgs).MOCode; //ts.ReflowResourceCode = ((TSActionEventArgs)actionEventArgs).ItemCode ; ts.ReflowRouteCode = ((TSActionEventArgs)actionEventArgs).RouteCode; ts.ReflowOPCode = ((TSActionEventArgs)actionEventArgs).OPCode; //added by jessie lee, 2005/11/24, //added by jessie lee, 2005/11/24, ts.MaintainUser = (actionEventArgs as TSActionEventArgs).MaintainUser; ts.TSUser = actionEventArgs.UserCode; ts.MaintainDate = FormatHelper.TODateInt(dtNow); ts.MaintainTime = FormatHelper.TOTimeInt(dtNow); //Laws Lu,2006/04/28 add 添加维修shiftday和维修resourcecode ts.TSDate = shiftDay; ts.TSTime = FormatHelper.TOTimeInt(dtNow); ts.TSResourceCode = actionEventArgs.ResourceCode; tsFacade.UpdateTSReflowStatus(ts); } else { messages.Add(new Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus)); } } #endregion } } } } catch (Exception e) { messages.Add(new Message(e)); } dataCollectDebug.WhenFunctionOut(messages); return(messages); }
private void rCardEditor_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == '\r') { Messages messages = new Messages(); if (rCardEditor.Text.Trim() == String.Empty) { messages.Add(new UserControl.Message(MessageType.Error, "$CSError_RCard_CanNot_Empty")); ApplicationRun.GetInfoForm().Add(messages); return; } DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(rCardEditor.Text.Trim().ToUpper(), string.Empty); //Laws Lu,2005/08/25,新增 检查当前资源是否为TS站 ActionOnLineHelper dataCollect = new ActionOnLineHelper(this._domainDataProvider); ActionEventArgs actionEventArgs = new ActionEventArgs( ActionType.DataCollectAction_TSConfirm, FormatHelper.PKCapitalFormat(FormatHelper.CleanString(sourceRCard)), ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode); messages.AddMessages(dataCollect.CheckResourceInOperationTS(actionEventArgs)); //End Laws LU if (!messages.IsSuccess()) { ApplicationRun.GetInfoForm().Add(messages); return; } // TSFacade tsFacade = new TSFacade(this.DataProvider); // if(!tsFacade.IsCardInTS(rCardEditor.Text.ToUpper().Trim())) // { // messages.Add(new UserControl.Message (MessageType.Error,"$CSError_Card_Not_In_TS")); // ApplicationRun.GetInfoForm().Add(messages); // return; // } // // object obj = tsFacade.GetCardLastTSRecordInTSStatus(rCardEditor.Text.ToUpper().Trim()); // if(obj == null) // { // messages.Add(new UserControl. Message(MessageType.Error,"$CSError_Card_TSStatus_IsNot_TS $Current_Status $"+ts.TSStatus)); // ApplicationRun.GetInfoForm().Add(messages); // return; // } // BenQGuru.eMES.Domain.TS.TS ts = (BenQGuru.eMES.Domain.TS.TS)obj; TSFacade tsFacade = new TSFacade(this.DataProvider); //Laws Lu,2005/09/16,修改 逻辑调整P4.8 object obj = tsFacade.GetCardLastTSRecord(actionEventArgs.RunningCard); Domain.TS.TS ts = null; if (obj == null) { messages.Add(new UserControl.Message(MessageType.Error, "$CSError_Card_Not_In_TS")); ApplicationRun.GetInfoForm().Add(messages); return; } else { ts = (Domain.TS.TS)obj; if (ts.TSStatus == TSStatus.TSStatus_Scrap || ts.TSStatus == TSStatus.TSStatus_Split || ts.TSStatus == TSStatus.TSStatus_Reflow || ts.TSStatus == TSStatus.TSStatus_Confirm) { messages.Add(new UserControl.Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus)); ApplicationRun.GetInfoForm().Add(messages); return; } if (ts.TSStatus != TSStatus.TSStatus_TS) { messages.Add(new UserControl.Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus)); ApplicationRun.GetInfoForm().Add(messages); return; } } if (ts.FromInputType == TSFacade.TSSource_TS) { ultraCheckEditor1.Enabled = false; } else { ultraCheckEditor1.Enabled = true; } } }
private void ucButton2_Click(object sender, EventArgs e) { Messages messages = new Messages(); if (rCardEditor.Text.Trim() == String.Empty) { messages.Add(new UserControl.Message(MessageType.Error, "$CSError_RCard_CanNot_Empty")); ApplicationRun.GetInfoForm().Add(messages); return; } DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(rCardEditor.Text.Trim().ToUpper(), string.Empty); string tsStatus; //Laws Lu,2005/11/22,新增 添加代理录入人员 //modified by jessie lee, 2005/11/24 string userCode = ApplicationService.Current().UserCode; if (txtAgentUser.Checked == true && txtAgentUser.Value.Trim().Length == 0) { messages.Add(new UserControl.Message(MessageType.Error, "$CS_Error_Vicegerent_CanNot_Empty")); ApplicationRun.GetInfoForm().Add(messages); return; } else if (txtAgentUser.Checked == true && txtAgentUser.Value != String.Empty) { if ((new BenQGuru.eMES.Security.SecurityFacade(this.DataProvider)).CheckResourceRight(txtAgentUser.Value.Trim().ToUpper() , ApplicationService.Current().ResourceCode)) { userCode = txtAgentUser.Value; } else { messages.Add(new UserControl.Message(MessageType.Error, "$CS_Error_Vicegerent_Is_Wrong")); ApplicationRun.GetInfoForm().Add(messages); return; } } if (ultraCheckEditor1.Checked == true) { tsStatus = TSStatus.TSStatus_Reflow; //勾选回流,然后不工位栏位未选资料也可允许通过。在业务上回流是一定有确定的工位的。 //系统要检查此时保存,工位是否为空。 if (ucLabComboxOPCode.SelectedItemText == string.Empty) { messages.Add(new UserControl.Message(MessageType.Error, "$CS_Error_ReflowOPCode_CanNot_Empty")); ApplicationRun.GetInfoForm().Add(messages); ucLabComboxOPCode.Focus(); return; } } else if (ultraCheckEditorScrap.Checked == true) { tsStatus = TSStatus.TSStatus_Scrap; } else { tsStatus = TSStatus.TSStatus_Complete; // //修改,Karron Qiu 2005-9-23 // //线上采集的不良品,修复后则“回流”;修不好则“报废”。而不选“回流”或“报废”代表该产品要入了良品库, // //线上的不良品修好后是直接回产线回流,不需要入良品库的 // messages.Add(new UserControl.Message(MessageType.Error,"$CSError_Please_Select_Reflow_OR_Scrap"));//请选择回流或者报废 // ApplicationRun.GetInfoForm().Add(messages); // return; } ActionFactory actionFactory = new ActionFactory(this.DataProvider); IAction actionTSComplete = actionFactory.CreateAction(ActionType.DataCollectAction_TSComplete); TSActionEventArgs actionEventArgs = new TSActionEventArgs( ActionType.DataCollectAction_TSComplete, FormatHelper.PKCapitalFormat(FormatHelper.CleanString(sourceRCard)), userCode, ApplicationService.Current().ResourceCode, tsStatus, this.ucLabEditMOCode.Value, this.ucLabEditItemCode.Value, this.ucLabEditRoute.Value, this.ucLabComboxOPCode.SelectedItemText, ApplicationService.Current().UserCode, FormatHelper.CleanString(this.txtScrapCause.Text, 100)); //修改 Karron Qiu 2005-9-26 //在做维修完成处理时,依然按照之前的检查逻辑 //(不良品是否“已选不良零件”或“已选不良位置”有信息),如果没有,则弹出提示信息, //比如:“该不良品无“不良零件”或“不良位置”信息,是否要维修完成”, //点击“确认”即维修完成,点击“取消”则维修完成失败 TSFacade tsFacade = new TSFacade(this.DataProvider); object obj = tsFacade.GetCardLastTSRecord(actionEventArgs.RunningCard); if (obj == null) { messages.Add(new UserControl.Message(MessageType.Error, "$CSError_Card_Not_In_TS")); ApplicationRun.GetInfoForm().Add(messages); return; } else { Domain.TS.TS ts = (Domain.TS.TS)obj; if (tsFacade.CheckErrorCodeCountAndErrorSolutionForTSComplete(actionEventArgs.RunningCard)) { if (!tsFacade.CheckErrorPartAndErrorLocationForTSComplete(actionEventArgs.RunningCard)) { if (System.Windows.Forms.MessageBox.Show(null, MutiLanguages.ParserString("$CS_No_ErrorPartAndLoc_Is_Com"), "", System.Windows.Forms.MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.Cancel) { return; } } } else { messages.Add(new UserControl.Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus)); ApplicationRun.GetInfoForm().Add(messages); return; } } //karron qiu ,2005/9/16 ,增加try catch,在catch中添加rollback操作 DataProvider.BeginTransaction(); try { messages.AddMessages(actionTSComplete.Execute(actionEventArgs)); if (!messages.IsSuccess()) { this.DataProvider.RollbackTransaction(); ApplicationRun.GetInfoForm().Add(messages); } else { this.DataProvider.CommitTransaction(); ApplicationRun.GetInfoForm().Add(new UserControl.Message(MessageType.Success, "$CS_TSScrap_SUCCESS")); } } catch { this.DataProvider.RollbackTransaction(); throw; } finally { (DataProvider as SQLDomainDataProvider).PersistBroker.CloseConnection(); } }
private void ultraCheckEditor1_CheckedValueChanged(object sender, EventArgs e) { if (ultraCheckEditor1.Checked == true) { if (ultraCheckEditorScrap.Checked == true) { ultraCheckEditorScrap.Checked = false; } Messages messages = new Messages(); if (rCardEditor.Text.Trim() == String.Empty) { messages.Add(new UserControl.Message(MessageType.Error, "$CSError_RCard_CanNot_Empty")); this.ultraCheckEditor1.Checked = false; ApplicationRun.GetInfoForm().Add(messages); return; } //Laws Lu,2005/09/16,修改 逻辑调整P4.8 TSFacade tsFacade = new TSFacade(this.DataProvider); object obj = tsFacade.GetCardLastTSRecord(rCardEditor.Value.ToString().Trim().ToUpper()); if (obj == null) { messages.Add(new UserControl.Message(MessageType.Error, "$CSError_Card_Not_In_TS")); ApplicationRun.GetInfoForm().Add(messages); return; } else { Domain.TS.TS ts = (Domain.TS.TS)obj; if (ts.TSStatus == TSStatus.TSStatus_Scrap || ts.TSStatus == TSStatus.TSStatus_Split || ts.TSStatus == TSStatus.TSStatus_Reflow || ts.TSStatus == TSStatus.TSStatus_Confirm) { messages.Add(new UserControl.Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus)); ApplicationRun.GetInfoForm().Add(messages); return; } if (ts.TSStatus != TSStatus.TSStatus_TS) { messages.Add(new UserControl.Message(MessageType.Error, "$CSError_Card_TSStatus_IsNot_TS $Current_Status $" + ts.TSStatus)); this.ultraCheckEditor1.Checked = false; ApplicationRun.GetInfoForm().Add(messages); return; } else { SetRaflowPanel(obj); } } // object obj = tsFacade.GetCardLastTSRecordInTSStatus(rCardEditor.Text.ToUpper().Trim()); // if(obj == null) // { // messages.Add(new UserControl. Message(MessageType.Error,"$CSError_Card_TSStatus_IsNot_TS")); // this.ultraCheckEditor1.Checked = false ; // ApplicationRun.GetInfoForm().Add(messages); // return; // } // else // { // SetRaflowPanel(obj); // } } else { ClearReflowPanel(); } }
private void btnSave_Click(object sender, EventArgs e) { if (pbEsopIMG.Image == null) { return; } Messages msg = new Messages(); if (_tsFacade == null) { _tsFacade = new TSFacade(this.DataProvider); } if (string.IsNullOrEmpty(this.txtRcard.Text)) { return; } object obj = _tsFacade.QueryLastTSByRunningCard(this.txtRcard.Text); if (obj != null) { Domain.TS.TS ts = (Domain.TS.TS)obj; if (ts.TSStatus == TSStatus.TSStatus_Complete) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_TS_Completed")); ApplicationRun.GetInfoForm().Add(msg); } else { DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); EsopPicsNGFacade m_EsopPicsNGFacade = new EsopPicsNGFacade(this.DataProvider); if (this.listPicsNG.SelectedItems.Count == 0) { Esoppicsng picNG = m_EsopPicsNGFacade.CreateNewEsoppicsng(); picNG.Serial = ((Esoppicsng)m_EsopPicsNGFacade.GetEsoppicNGNextSerial()[0]).Serial; picNG.Rcard = FormatHelper.CleanString(this.txtRcard.Text, 40); picNG.Ngpicmemo = FormatHelper.CleanString(this.txtNGPicMemo.Text, 500); picNG.Tsid = ts.TSId; picNG.Picsname = "NG" + picNG.Rcard + picNG.Tsid + dbDateTime.DateTime.ToString("yyyyMMddHHmmss"); picNG.Muser = ApplicationService.Current().LoginInfo.UserCode; picNG.Mdate = dbDateTime.DBDate; picNG.Mtime = dbDateTime.DBTime; AddDomainObject(picNG); } else { Esoppicsng picNG = (Esoppicsng)this.listPicsNG.SelectedItems[0].Tag; picNG.Muser = ApplicationService.Current().LoginInfo.UserCode; picNG.Ngpicmemo = FormatHelper.CleanString(this.txtNGPicMemo.Text, 500); picNG.Mdate = dbDateTime.DBDate; picNG.Mtime = dbDateTime.DBTime; UpdateDomainObject(picNG); } Init(this.txtRcard.Text); this.pbEsopIMG.Image = null; this.txtNGPicMemo.Text = string.Empty; imageListCache.Clear(); } } else { msg.Add(new UserControl.Message(MessageType.Error, "$CS_TS_Not_Exist")); ApplicationRun.GetInfoForm().Add(msg); } }