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 +++++++++++++---------
DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_01.cs | 64 ++++++++++----------
2 files changed, 73 insertions(+), 60 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)
diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_01.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_01.cs
index 1d09c90..024a265 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_01.cs
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_01.cs
@@ -47,44 +47,44 @@
{
if (SystemValue.isStartedImitateModel)
{
- var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
+ //var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
- WorkPieceLog wplog = new WorkPieceLog();
- wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
- wplog.WorkingProcedure = WorkingProcedure;
- wplog.EquipmentID = WorkingProcedure;
- wplog.Remarks = WorkingProcedure;
- wplog.MonitoringPoint = DataCapturePointCode;
- wplog.CreatedTime = DateTimeHelper.GetDateTime();
- wplog.CreatedUserName = DataCapturePointCode;
- wplog.IsDeleted = false;
- //var valuecol = plcService.ReadValuePoint("2050", "28", 25, typeof(string));
+ //WorkPieceLog wplog = new WorkPieceLog();
+ //wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
+ //wplog.WorkingProcedure = WorkingProcedure;
+ //wplog.EquipmentID = WorkingProcedure;
+ //wplog.Remarks = WorkingProcedure;
+ //wplog.MonitoringPoint = DataCapturePointCode;
+ //wplog.CreatedTime = DateTimeHelper.GetDateTime();
+ //wplog.CreatedUserName = DataCapturePointCode;
+ //wplog.IsDeleted = false;
+ ////var valuecol = plcService.ReadValuePoint("2050", "28", 25, typeof(string));
- wplog.EquipmentID = _dataCaptureConfig.EquipmentID;
- wplog.WorkPieceID = WorkPieceID;
- wplog.UpdatedTime = DateTimeHelper.GetDateTime();
- wplog.UpdatedUserName = DataCapturePointCode;
- wplog.OnlineTime = DateTimeHelper.GetDateTime();//缁欎笂绾挎椂闂寸敤
+ //wplog.EquipmentID = _dataCaptureConfig.EquipmentID;
+ //wplog.WorkPieceID = WorkPieceID;
+ //wplog.UpdatedTime = DateTimeHelper.GetDateTime();
+ //wplog.UpdatedUserName = DataCapturePointCode;
+ //wplog.OnlineTime = DateTimeHelper.GetDateTime();//缁欎笂绾挎椂闂寸敤
- //var valueid = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, _dataCaptureConfig.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
- //wplog.WorkPieceID = PLCManger.GetWorkPieceIDForPLC(_dataCaptureConfig, plcService);
- if (wplog.WorkPieceID.Length != 22)
- {//鑾峰彇鍒扮殑宸ヤ欢鍙峰紓甯�
- return;
- }
- else
- {//鑾峰彇鍏朵粬閰嶇疆鐨勫緟閲囬泦椤�
+ ////var valueid = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, _dataCaptureConfig.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
+ ////wplog.WorkPieceID = PLCManger.GetWorkPieceIDForPLC(_dataCaptureConfig, plcService);
+ //if (wplog.WorkPieceID.Length != 22)
+ //{//鑾峰彇鍒扮殑宸ヤ欢鍙峰紓甯�
+ // return;
+ //}
+ //else
+ //{//鑾峰彇鍏朵粬閰嶇疆鐨勫緟閲囬泦椤�
- //foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
- //{
- // var valuecol = plcService.ReadValuePoint(col.DbNumber, col.Offset, col.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(col.DataCaptureColumnType));
- // wplog.GetType().GetProperty(col.DataCaptureColumnTabelName).SetValue(wplog, valuecol);//缁欏姩鎬佸瓧娈佃祴鍊�
+ // //foreach (var col in colConfig.Where(o => o.DataCapturePointCode == DataCapturePointCode))
+ // //{
+ // // var valuecol = plcService.ReadValuePoint(col.DbNumber, col.Offset, col.DataCaptureColumnLength.Value, PLCManger.GetTypeForString(col.DataCaptureColumnType));
+ // // wplog.GetType().GetProperty(col.DataCaptureColumnTabelName).SetValue(wplog, valuecol);//缁欏姩鎬佸瓧娈佃祴鍊�
- //}
- }
- //璇诲彇浜岀淮鐮佸悗鏇存柊鏁版嵁搴�
- WorkPieceInfoManager.ReadQRcode(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), plcService, _dataCaptureConfig.IsFeedback);
+ // //}
+ //}
+ ////璇诲彇浜岀淮鐮佸悗鏇存柊鏁版嵁搴�
+ //WorkPieceInfoManager.ReadQRcode(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), plcService, _dataCaptureConfig.IsFeedback);
return;
--
Gitblit v1.9.3