From f7b16b2d3c9113f93c4e707b94fb1a735aa2c911 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周二, 27 8月 2024 11:24:27 +0800 Subject: [PATCH] //修复下 op35 同一个件 下线时间跟下一个上线时间一模一样的问题 【Editby shaocx,2024-08-27】 --- DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs | 69 ++++++++++++++++++++-------------- 1 files changed, 41 insertions(+), 28 deletions(-) diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs index 5183090..efac1e6 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs @@ -214,40 +214,53 @@ info.WorkingProcedureCurrent = loginfo.WorkingProcedure; info.Remarks = info.Remarks ?? "" + $"{info.WorkingProcedureCurrent}宸ヤ欢涓婄嚎"; + //淇涓� op35 鍚屼竴涓欢 涓嬬嚎鏃堕棿璺熶笅涓�涓笂绾挎椂闂翠竴妯′竴鏍风殑闂 銆怑ditby shaocx,2024-08-27銆� + var isNeedAddNewProcess = true; var pro = db.WorkPieceProcess.Where(o => o.WorkPieceID == loginfo.WorkPieceID && !o.OperationType.Equals("SPC") && (o.EndTime == null || o.EndTime <= DateTime.MinValue)).OrderByDescending(o => o.StartTime).FirstOrDefault(); if (pro != null && pro.WorkPieceID.Length > 1) { - pro.EndTime = DateTimeHelper.GetDateTime(); - pro.UpdatedUserName = loginfo.MonitoringPoint; - pro.UpdatedTime = DateTimeHelper.GetDateTime(); - pro.Remarks = (pro.Remarks ?? "") + "鍙堜竴娆′笂绾匡紝鏇存柊缁撴潫鏃堕棿"; + if (pro.WorkingProcedureCurrent == loginfo.WorkingProcedure) + {//琛ㄧず宸ュ簭鐩稿悓 + isNeedAddNewProcess = false; + pro.Remarks = (pro.Remarks ?? "") + "鍙堜竴娆′笂绾匡紝鏇存柊缁撴潫鏃堕棿"; + } + else + { + pro.EndTime = DateTimeHelper.GetDateTime(); + pro.UpdatedUserName = loginfo.MonitoringPoint; + pro.UpdatedTime = DateTimeHelper.GetDateTime(); + pro.Remarks = (pro.Remarks ?? "") + "鍙堜竴娆′笂绾匡紝鏇存柊缁撴潫鏃堕棿"; + } } - //姣忔鎵弿涓婄嚎閮芥彃鍏ヨ拷婧〃 - WorkPieceProcess process = new WorkPieceProcess(); - process = EntityPropHelper.Mapper<WorkPieceProcess, WorkPieceInfo>(info); - process.StartTime = DateTimeHelper.GetDateTime(); - - //涓嶅啀榛樿璧嬪�间负鍚堟牸 銆怑ditby shaocx,2024-08-16銆� - //process.QualityState = info.QualityState.HasValue ? info.QualityState.Value : (int)QualityState.OK;//榛樿鍚堟牸锛屽凡澶勭悊 - process.QualityState = GetQualityStateValue(info.QualityState); - - if (process.WorkingProcedureCurrent == WorkingProcedureForHMI.OP70.ToString()) - { //鐗规畩澶勭悊OP70锛屽洜涓篛P70娌℃湁娴嬮噺锛岄粯璁ゅ悎鏍� [Editby shaocx,2024-07-03] - process.QualityState = (int)QualityState.OK;//榛樿鍚堟牸锛孫P70榛樿鏄悎鏍� - } - - process.Id = Yitter.IdGenerator.YitIdHelper.NextId(); - process.CreatedUserName = loginfo.MonitoringPoint; - process.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local); - process.UpdatedUserName = loginfo.MonitoringPoint; - process.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local); - process.OperationType = OperationType.鐢熶骇.ToString(); - process.Remarks = ""; - if (loginfo.WorkingProcedure.Equals("OP05")) + if (isNeedAddNewProcess) { - process.EndTime = process.StartTime; + //姣忔鎵弿涓婄嚎閮芥彃鍏ヨ拷婧〃 + WorkPieceProcess new_process = new WorkPieceProcess(); + new_process = EntityPropHelper.Mapper<WorkPieceProcess, WorkPieceInfo>(info); + new_process.StartTime = DateTimeHelper.GetDateTime(); + + //涓嶅啀榛樿璧嬪�间负鍚堟牸 銆怑ditby shaocx,2024-08-16銆� + //process.QualityState = info.QualityState.HasValue ? info.QualityState.Value : (int)QualityState.OK;//榛樿鍚堟牸锛屽凡澶勭悊 + new_process.QualityState = GetQualityStateValue(info.QualityState); + + if (new_process.WorkingProcedureCurrent == WorkingProcedureForHMI.OP70.ToString()) + { //鐗规畩澶勭悊OP70锛屽洜涓篛P70娌℃湁娴嬮噺锛岄粯璁ゅ悎鏍� [Editby shaocx,2024-07-03] + new_process.QualityState = (int)QualityState.OK;//榛樿鍚堟牸锛孫P70榛樿鏄悎鏍� + } + + new_process.Id = Yitter.IdGenerator.YitIdHelper.NextId(); + new_process.CreatedUserName = loginfo.MonitoringPoint; + new_process.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local); + new_process.UpdatedUserName = loginfo.MonitoringPoint; + new_process.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local); + new_process.OperationType = OperationType.鐢熶骇.ToString(); + new_process.Remarks = ""; + if (loginfo.WorkingProcedure.Equals("OP05")) + { + new_process.EndTime = new_process.StartTime; + } + db.WorkPieceProcess.Add(new_process); } - db.WorkPieceProcess.Add(process); //db.Database.AutoTransactionsEnabled = false;// 鍚屼竴涓猄aveChanges榛樿浜嬪姟锛� 鍏抽棴榛樿浜嬪姟锛�... 濂藉儚涓嶈兘鐢ㄥ晩锛屽悗闈㈠啀鐮旂┒鍚� if (isAddWorkPieceInfo) -- Gitblit v1.9.3