From 3b3e3bcf1345197670c82988ceb3e8d34be3b5f1 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周一, 02 9月 2024 18:24:58 +0800
Subject: [PATCH] 界面战士
---
DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs | 163 ++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 116 insertions(+), 47 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 ec6d983..8c6f1a0 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs
@@ -1,4 +1,5 @@
-锘縰sing iWare_SCADA_BusinessLogical.Utils;
+锘縰sing HslCommunication.BasicFramework;
+using iWare_SCADA_BusinessLogical.Utils;
using iWare_SCADA_Model;
using iWare_SCADA_Model.MiddleModel;
using iWare_SCADA_Model.TableModel;
@@ -7,6 +8,7 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
+using System.Data.Entity.Validation;
using System.Diagnostics;
//using System.Data.Entity.Infrastructure;
using System.Linq;
@@ -21,32 +23,32 @@
{
public class WorkPieceInfoManager
{
- public static WorkPieceInfo GetWorkPieceInfo(string WorkPieceID)
- {
- using (DbModel db = new DbModel())
- {
- //鏌ヨ鎵�鏈�
- var query = db.WorkPieceInfo.Where(o => o.WorkPieceID == WorkPieceID).FirstOrDefault();
- return query;
- }
- }
+ //public static WorkPieceInfo GetWorkPieceInfo(string WorkPieceID)
+ //{
+ // using (DbModel db = new DbModel())
+ // {
+ // //鏌ヨ鎵�鏈�
+ // var query = db.WorkPieceInfo.Where(o => o.WorkPieceID == WorkPieceID).FirstOrDefault();
+ // return query;
+ // }
+ //}
- public static long InsertWorkPieceInfo(WorkPieceInfo workPiece)
- {
- using (DbModel db = new DbModel())
- {
- db.WorkPieceInfo.Add(workPiece);
- db.SaveChanges();
- return workPiece.Id;
- }
- }
+ //public static long InsertWorkPieceInfo(WorkPieceInfo workPiece)
+ //{
+ // using (DbModel db = new DbModel())
+ // {
+ // db.WorkPieceInfo.Add(workPiece);
+ // db.SaveChanges();
+ // return workPiece.Id;
+ // }
+ //}
- public static WorkPieceLogMiddle GetAddWorkPieceLog(WorkPieceLogMiddle loginfo)
- {
- loginfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
- return loginfo;
- }
+ //public static WorkPieceLogMiddle GetAddWorkPieceLog(WorkPieceLogMiddle loginfo)
+ //{
+ // loginfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
+ // return loginfo;
+ //}
/// <summary>
/// 缁橶orkPieceLog涓婚敭绛夊叕鍏辩殑鐨勫睘鎬ц祴鍊�
@@ -149,7 +151,7 @@
}
catch (Exception ex)
{
- loginfo.Remarks = (loginfo.Remarks ?? "") + $"{loginfo.WorkPieceID ?? "绌�"}鍒�鍏峰鍛芥洿鏂版暟鎹紓甯竰ex.Message}";
+ loginfo.Remarks = $"{loginfo.WorkPieceID ?? "绌�"}鍒�鍏峰鍛芥洿鏂版暟鎹紓甯竰ex.Message}";
}
}
@@ -188,6 +190,7 @@
info.WorkPieceinitOnlineTime = DateTimeHelper.GetDateTime();
info.WorkingProcedurePlan = ConfigHelper.GetConfigString("WorkingProcedureAllStr") ?? "OP05OP10OP20OP30OP35OP40OP50OP60OP70OP80";
info.CreatedUserName = loginfo.MonitoringPoint;
+ SystemBussinessHelper.SetWorkPieceInfoMiddleForCreatedUserName(ref info, loginfo.DataCapturePointCname);
info.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
info = ParseQRCode(info);
isAddWorkPieceInfo = true;
@@ -196,7 +199,7 @@
{
if (info.WorkingProcedureCurrent.Equals("OP05"))
{
- loginfo.Remarks = (loginfo.Remarks ?? "") + $"璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"} OP05宸ュ簭閲嶅璇诲彇浜�";
+ loginfo.Remarks = $"璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"} OP05宸ュ簭閲嶅璇诲彇浜�";
return;
}
}
@@ -208,11 +211,12 @@
info.QualityStateUpdateTime = loginfo.UpdatedTime.Value.LocalDateTime;
info.QualityStateUpdateMode = QualityStateUpdateMode.Auto.ToString();
info.UpdatedUserName = loginfo.MonitoringPoint;
+ SystemBussinessHelper.SetWorkPieceInfoMiddleForUpdateDataCapturePointCname(ref info, loginfo.DataCapturePointCname);
info.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
info.WorkPieceCurrentPosition = loginfo.WorkingProcedure;
info.WorkPieceCurrentPositionOrder = info.WorkingProcedurePlan.IndexOf(loginfo.WorkingProcedure) / 2;
info.WorkingProcedureCurrent = loginfo.WorkingProcedure;
- info.Remarks = info.Remarks ?? "" + $"{info.WorkingProcedureCurrent}宸ヤ欢涓婄嚎";
+ info.Remarks = $"{info.WorkingProcedureCurrent}宸ヤ欢涓婄嚎";
//淇涓� op35 鍚屼竴涓欢 涓嬬嚎鏃堕棿璺熶笅涓�涓笂绾挎椂闂翠竴妯′竴鏍风殑闂 銆怑ditby shaocx,2024-08-27銆�
var isNeedAddNewProcess = true;
@@ -222,14 +226,15 @@
if (pro.WorkingProcedureCurrent == loginfo.WorkingProcedure)
{//琛ㄧず宸ュ簭鐩稿悓
isNeedAddNewProcess = false;
- pro.Remarks = (pro.Remarks ?? "") + "鍙堜竴娆′笂绾匡紝鏇存柊缁撴潫鏃堕棿";
+ pro.Remarks = "鍙堜竴娆′笂绾匡紝鏇存柊缁撴潫鏃堕棿";
}
else
{
pro.EndTime = DateTimeHelper.GetDateTime();
pro.UpdatedUserName = loginfo.MonitoringPoint;
+ pro.UpdateDataCapturePointCname = loginfo.DataCapturePointCname;
pro.UpdatedTime = DateTimeHelper.GetDateTime();
- pro.Remarks = (pro.Remarks ?? "") + "鍙堜竴娆′笂绾匡紝鏇存柊缁撴潫鏃堕棿";
+ pro.Remarks = "鍙堜竴娆′笂绾匡紝鏇存柊缁撴潫鏃堕棿";
}
}
if (isNeedAddNewProcess)
@@ -237,6 +242,7 @@
//姣忔鎵弿涓婄嚎閮芥彃鍏ヨ拷婧〃
WorkPieceProcess new_process = new WorkPieceProcess();
new_process = EntityPropHelper.Mapper<WorkPieceProcess, WorkPieceInfo>(info);
+ QualityStateHelper.ResetQualityNoOkForNewProcess(ref new_process);
new_process.StartTime = DateTimeHelper.GetDateTime();
//涓嶅啀榛樿璧嬪�间负鍚堟牸 銆怑ditby shaocx,2024-08-16銆�
@@ -250,8 +256,10 @@
new_process.Id = Yitter.IdGenerator.YitIdHelper.NextId();
new_process.CreatedUserName = loginfo.MonitoringPoint;
+ new_process.DataCapturePointCname = loginfo.DataCapturePointCname;
new_process.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
new_process.UpdatedUserName = loginfo.MonitoringPoint;
+ new_process.UpdateDataCapturePointCname = loginfo.DataCapturePointCname;
new_process.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
new_process.OperationType = OperationType.鐢熶骇.ToString();
new_process.Remarks = "";
@@ -363,20 +371,46 @@
}
else
{
- loginfo.Remarks = (loginfo.Remarks ?? "") + $"涓婄嚎瀹屾垚璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}寮傚父";
+ loginfo.Remarks = $"涓婄嚎瀹屾垚璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}寮傚父";
Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}涓婄嚎鐩戞帶璇荤爜鏍囪 璇诲彇宸ヤ欢鐮佹暟鎹甗{loginfo.WorkPieceID ?? "绌�"}]鏃跺紓甯革細");
}
}
catch (Exception e)
{
- loginfo.Remarks = (loginfo.Remarks ?? "") + $"璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}鏇存柊鏁版嵁寮傚父{e.Message}";
+ loginfo.Remarks = $"璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}鏇存柊鏁版嵁寮傚父{e.Message}";
+ Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}涓婄嚎鐩戞帶璇荤爜鏍囪 璇诲彇宸ヤ欢鐮佹暟鎹甗{loginfo.WorkPieceID ?? "绌�"}]鏃跺紓甯革細", e);
}
finally
{
loginfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
db.WorkPieceLog.Add(loginfo);
- db.SaveChanges();
+
+ //淇濆瓨鏁版嵁搴撶殑寮傚父鎹曟崏 [Editby shaocx,2024-08-29]
+ try
+ {
+ db.SaveChanges();
+ }
+ catch (DbEntityValidationException exception)
+ {
+ var errorMessages =
+ exception.EntityValidationErrors
+ .SelectMany(validationResult => validationResult.ValidationErrors)
+ .Select(m => m.ErrorMessage);
+ var fullErrorMessage = string.Join(", ", errorMessages);
+ var exceptionMessage = string.Concat(exception.Message, " 楠岃瘉寮傚父娑堟伅鏄細", fullErrorMessage);
+
+ Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}涓婄嚎鐩戞帶璇荤爜鏍囪 璇诲彇宸ヤ欢鐮佹暟鎹甗{loginfo.WorkPieceID ?? "绌�"}],淇濆瓨鏁版嵁搴撴椂寮傚父锛�" + exceptionMessage, exception);
+
+ throw new DbEntityValidationException(exceptionMessage, exception.EntityValidationErrors);
+ }
+ catch (Exception)
+ {
+
+ throw;
+ }
+
+
}
@@ -521,6 +555,7 @@
pieceInfo.WorkPieceinitOnlineTime = DateTimeHelper.GetDateTime();
pieceInfo.WorkingProcedurePlan = ConfigHelper.GetConfigString("WorkingProcedureAllStr") ?? "OP05OP10OP20OP30OP35OP40OP50OP60OP70OP80";
pieceInfo.CreatedUserName = ResetUpdatedUserName(logMiddle);
+ SystemBussinessHelper.SetWorkPieceInfoMiddleForCreatedUserName(ref pieceInfo, logMiddle.DataCapturePointCname);
pieceInfo.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
pieceInfo.WorkingProcedureStartTime = DateTimeHelper.GetDateTime();//
pieceInfo.WorkingProcedureEndTime = null;
@@ -531,7 +566,7 @@
}
else
{
- loginfo2.Remarks = loginfo2.Remarks ?? "" + $"|宸ヤ欢{logMiddle.WorkPieceID} 璐ㄩ噺妫�娴嬪畬鎴愬伐搴弡logMiddle.MonitoringPoint} 娌℃湁鑾峰彇鍒板伐浠朵俊鎭笉鍋氭洿鏂�";
+ loginfo2.Remarks = $"|宸ヤ欢{logMiddle.WorkPieceID} 璐ㄩ噺妫�娴嬪畬鎴愬伐搴弡logMiddle.MonitoringPoint} 娌℃湁鑾峰彇鍒板伐浠朵俊鎭笉鍋氭洿鏂�";
Log4NetHelper.WriteErrorLog(type, $"宸ヤ欢{logMiddle.WorkPieceID} 璐ㄩ噺妫�娴嬪畬鎴愬伐搴弡logMiddle.MonitoringPoint} 娌℃湁鑾峰彇鍒板伐浠朵俊鎭笉鍋氭洿鏂�");
return;
}
@@ -582,8 +617,9 @@
pieceInfo.QualityStateUpdateUser = logMiddle.UpdatedUserName;
pieceInfo.QualityStateUpdateTime = logMiddle.UpdatedTime.Value.LocalDateTime;
pieceInfo.QualityStateUpdateMode = QualityStateUpdateMode.Auto.ToString();
- pieceInfo.Remarks = pieceInfo.Remarks ?? "" + $"{logMiddle.WorkingProcedure}璐ㄩ噺妫�娴嬪畬鎴愪慨鏀�";
+ pieceInfo.Remarks = $"{logMiddle.WorkingProcedure}璐ㄩ噺妫�娴嬪畬鎴愪慨鏀�";
pieceInfo.UpdatedUserName = ResetUpdatedUserName(logMiddle);
+ SystemBussinessHelper.SetWorkPieceInfoMiddleForUpdateDataCapturePointCname(ref pieceInfo, logMiddle.DataCapturePointCname);
pieceInfo.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
if (!(pieceInfo.WorkingProcedureStartTime.HasValue && pieceInfo.WorkingProcedureStartTime > DateTime.Parse("1900/01/01")))
{//宸ュ簭寮�濮嬫椂闂存病鏈夊垯璧嬪��
@@ -734,10 +770,17 @@
var pro = db.WorkPieceProcess.Where(o => o.WorkPieceID == logMiddle.WorkPieceID && o.WorkingProcedureCurrent == pieceInfo.WorkingProcedureCurrent && o.OperationType == OperationType.鐢熶骇.ToString()).OrderByDescending(o => o.StartTime).FirstOrDefault();
if (pro == null || pro.WorkPieceID.Length < 1 || logMiddle.MonitoringPoint.Equals("OP1002") || logMiddle.MonitoringPoint.Equals("OP1003") || logMiddle.MonitoringPoint.Contains("OP2002"))
{// OP10 娌℃湁涓婄嚎鎵爜鏋紝绾﹀畾鐢ㄦ祴閲忓畬鎴愪俊鍙峰綋涓婄嚎鏍囪锛屾墍浠ヤ笂绾块渶瑕佷慨鏀圭殑瀛楁鏀捐繖閲�
- //涓婄嚎鏄瘡娆¢兘鎻掑叆
+ //涓婄嚎鏄瘡娆¢兘鎻掑叆
+
+ WorkPieceProcess process_05 = WorkPieceProcessHelper.CreateWorkPieceProcessForOP05(logMiddle, db, pieceInfo);
+ if (process_05 != null)
+ {//鍒涘缓OP05宸ュ簭锛屽綋娌℃湁05宸ュ簭鏃�,鎵嶅垱寤� 銆怑ditby shaocx,2024-08-29銆�
+ db.WorkPieceProcess.Add(process_05);
+ }
WorkPieceProcess process = new WorkPieceProcess();
process = EntityPropHelper.Mapper<WorkPieceProcess, WorkPieceInfo>(pieceInfo);
+ QualityStateHelper.ResetQualityNoOkForNewProcess(ref process);
process.StartTime = DateTimeHelper.GetDateTime();
//涓嶅啀榛樿璧嬪�间负鍚堟牸 銆怑ditby shaocx,2024-08-16銆�
@@ -751,8 +794,10 @@
process.Id = Yitter.IdGenerator.YitIdHelper.NextId();
process.CreatedUserName = ResetUpdatedUserName(logMiddle);
+ process.DataCapturePointCname = logMiddle.DataCapturePointCname;
process.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
process.UpdatedUserName = ResetUpdatedUserName(logMiddle);
+ process.UpdateDataCapturePointCname = logMiddle.DataCapturePointCname;
process.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
process.OperationType = OperationType.鐢熶骇.ToString();
process.QualityDataInfoID = qualityData.Id;
@@ -763,6 +808,7 @@
{//鍏朵粬鐨勯兘鍙槸淇敼
pro.QualityDataInfoID = qualityData.Id;
pro.UpdatedUserName = ResetUpdatedUserName(logMiddle);
+ pro.UpdateDataCapturePointCname = logMiddle.DataCapturePointCname;
pro.UpdatedTime = DateTimeHelper.GetDateTime();
//涓嶅啀榛樿璧嬪�间负鍚堟牸 銆怑ditby shaocx,2024-08-16銆�
@@ -776,7 +822,7 @@
if (logMiddle.WorkingProcedure == "OP60")
{
pro.CreatedUserName = ResetUpdatedUserName(logMiddle);
-
+ pro.DataCapturePointCname = logMiddle.DataCapturePointCname;
}
}
@@ -800,19 +846,19 @@
}
else
{
- loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"璐ㄩ噺妫�娴嬪畬鎴愯鍙栦簩缁寸爜{logMiddle.WorkPieceID ?? "绌�"}寮傚父";
+ loginfo2.Remarks = $"璐ㄩ噺妫�娴嬪畬鎴愯鍙栦簩缁寸爜{logMiddle.WorkPieceID ?? "绌�"}寮傚父";
Log4NetHelper.WriteErrorLog(type, $" {logMiddle.WorkingProcedure}宸ュ簭鐩戞帶璇荤爜鏍囪 璇诲彇宸ヤ欢鐮佹暟鎹甗{logMiddle.WorkPieceID ?? "绌�"}]鏃跺紓甯革細");
}
}
catch (Exception ex)
{
- loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"璐ㄩ噺妫�娴嬪畬鎴恵logMiddle.WorkPieceID ?? "绌�"}鏇存柊鏁版嵁寮傚父{ex.Message}++{ex.StackTrace}";
+ loginfo2.Remarks = $"璐ㄩ噺妫�娴嬪畬鎴恵logMiddle.WorkPieceID ?? "绌�"}鏇存柊鏁版嵁寮傚父{ex.Message}++{ex.StackTrace}";
Log4NetHelper.WriteErrorLog(type, $" {logMiddle.WorkingProcedure}宸ュ簭鐩戞帶璇荤爜鏍囪 璇诲彇宸ヤ欢鐮佹暟鎹甗{logMiddle.WorkPieceID ?? "绌�"}]鏃跺紓甯革細");
}
finally
{
- loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"璐ㄩ噺锛歿logMiddle.QualityStateStr ?? "绌�"}";
+ loginfo2.Remarks = $"璐ㄩ噺锛歿logMiddle.QualityStateStr ?? "绌�"}";
db.WorkPieceLog.Add(GetAddWorkPieceLog(loginfo2));//鎻掑叆宸ヤ欢閲囬泦鏃ュ織琛�
db.SaveChanges();
}
@@ -954,8 +1000,10 @@
}
cur_db_info.WorkPieceState = (int)WorkPieceState.NOOKPush;
cur_db_info.UpdatedUserName = loginfo.MonitoringPoint;
+ SystemBussinessHelper.SetWorkPieceInfoMiddleForUpdateDataCapturePointCname(ref cur_db_info, loginfo.DataCapturePointCname);
cur_db_info.UpdatedTime = DateTime.Now;
cur_db_info.Remarks = "宸ヤ欢NOOK鎺ㄥ嚭";
+ loginfo2.Remarks = cur_db_info.Remarks;
if (!(cur_db_info.WorkingProcedureStartTime.HasValue && cur_db_info.WorkingProcedureStartTime > DateTime.Parse("1900/01/01")))
{
cur_db_info.WorkingProcedureStartTime = DateTimeHelper.GetDateTime();
@@ -968,7 +1016,7 @@
qualityData = db.QualityDataInfo.Where(o => o.WorkPieceID == loginfo.WorkPieceID).FirstOrDefault();
if (loginfo.WorkingProcedure.Equals("OP35"))
{//涓轰簡瑙e喅OP35鐨勯噰闆嗗埌鐨勮川閲忎俊鎭槸OK杩楴OOK鐨勬儏鍐碉紝OP35 NOOK鏃舵洿鏂拌川閲忎俊鎭�
- loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"OP35NOOK鍘熻川閲忎俊鎭瘂(cur_db_info.QualityState.HasValue ? cur_db_info.QualityState.Value.ToString() : "绌�")}";
+ loginfo2.Remarks = $"OP35NOOK鍘熻川閲忎俊鎭瘂(cur_db_info.QualityState.HasValue ? cur_db_info.QualityState.Value.ToString() : "绌�")}";
cur_db_info.QualityState = (int)QualityState.NG;
if (!cur_db_info.QualityState.Equals(((int)QualityState.OK).ToString()))
{
@@ -995,6 +1043,7 @@
pro.EndTime = DateTimeHelper.GetDateTime();
pro.Remarks = (pro.Remarks ?? "") + "NOOK缁撴潫";
pro.UpdatedUserName = loginfo.MonitoringPoint;
+ pro.UpdateDataCapturePointCname = loginfo.DataCapturePointCname;
pro.UpdatedTime = DateTimeHelper.GetDateTime();
}
@@ -1005,13 +1054,13 @@
}
else
{
- loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"宸ヤ欢NOOK鎺ㄥ嚭璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}寮傚父";
+ loginfo2.Remarks = $"宸ヤ欢NOOK鎺ㄥ嚭璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}寮傚父";
Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}宸ヤ欢NOOK鎺ㄥ嚭璇荤爜鏍囪 璇诲彇宸ヤ欢鐮佹暟鎹甗{loginfo.WorkPieceID ?? "绌�"}]鏃跺紓甯革細");
}
}
catch (Exception e)
{
- loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}鏇存柊鏁版嵁寮傚父{e.Message}";
+ loginfo2.Remarks = $"璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}鏇存柊鏁版嵁寮傚父{e.Message}";
}
@@ -1072,6 +1121,7 @@
}
cur_db_info.WorkPieceState = (int)WorkPieceState.SPCPush;
cur_db_info.UpdatedUserName = loginfo.MonitoringPoint;
+ SystemBussinessHelper.SetWorkPieceInfoMiddleForUpdateDataCapturePointCname(ref cur_db_info, loginfo.DataCapturePointCname);
cur_db_info.UpdatedTime = DateTime.Now;
cur_db_info.WorkingProcedureEndTime = DateTimeHelper.GetDateTime();
if (!(cur_db_info.WorkingProcedureStartTime.HasValue && cur_db_info.WorkingProcedureStartTime > DateTime.Parse("1900/01/01")))
@@ -1084,6 +1134,7 @@
cur_db_info.WorkPieceCurrentPositionOrder = cur_db_info.WorkingProcedurePlan.IndexOf(loginfo.WorkingProcedure) / 2;
}
cur_db_info.Remarks = "宸ヤ欢SPC鎶芥鎺ㄥ嚭";
+ loginfo2.Remarks = cur_db_info.Remarks;
//鏇存柊涓婁竴宸ュ簭鐨勭粨鏉熸椂闂�
var pro = db.WorkPieceProcess.Where(o => o.WorkPieceID == loginfo.WorkPieceID && o.WorkingProcedureCurrent == loginfo.WorkingProcedure
@@ -1093,18 +1144,22 @@
pro.EndTime = DateTimeHelper.GetDateTime();
pro.Remarks = (pro.Remarks ?? "") + "SPC鎶芥缁撴潫";
pro.UpdatedUserName = loginfo.MonitoringPoint;
+ pro.UpdateDataCapturePointCname = loginfo.DataCapturePointCname;
pro.UpdatedTime = DateTimeHelper.GetDateTime();
}
//姣忔SPC 閮芥彃鍏ヨ拷婧〃
WorkPieceProcess process = new WorkPieceProcess();
process = EntityPropHelper.Mapper<WorkPieceProcess, WorkPieceInfo>(cur_db_info);
+ QualityStateHelper.ResetQualityNoOkForNewProcess(ref process);
process.StartTime = DateTimeHelper.GetDateTime();
process.OperationType = OperationType.SPC.ToString();
process.QualityState = (int)QualityState.Suspected;
process.Id = Yitter.IdGenerator.YitIdHelper.NextId();
process.CreatedUserName = loginfo.MonitoringPoint;
+ process.DataCapturePointCname = loginfo.DataCapturePointCname;
process.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
process.UpdatedUserName = loginfo.MonitoringPoint;
+ process.UpdateDataCapturePointCname = loginfo.DataCapturePointCname;
process.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
process.Remarks = "宸ヤ欢SPC鎶芥鎺ㄥ嚭";
db.WorkPieceProcess.Add(process);
@@ -1114,13 +1169,13 @@
}
else
{
- loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"宸ヤ欢SPC鎶芥鎺ㄥ嚭璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}寮傚父";
+ loginfo2.Remarks = $"宸ヤ欢SPC鎶芥鎺ㄥ嚭璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}寮傚父";
Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}宸ヤ欢SPC鎶芥鎺ㄥ嚭璇荤爜鏍囪 璇诲彇宸ヤ欢鐮佹暟鎹甗{loginfo.WorkPieceID ?? "绌�"}]鏃跺紓甯革細");
}
}
catch (Exception e)
{
- loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}鏇存柊鏁版嵁寮傚父{e.Message}";
+ loginfo2.Remarks = $"璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}鏇存柊鏁版嵁寮傚父{e.Message}";
}
finally
{
@@ -1210,6 +1265,7 @@
info.WorkPieceinitOnlineTime = DateTimeHelper.GetDateTime();//WorkPieceInitOnlineTime
info.WorkingProcedurePlan = ConfigHelper.GetConfigString("WorkingProcedureAllStr") ?? "OP05OP10OP20OP30OP35OP40OP50OP60OP70OP80";
info.CreatedUserName = logMiddle.MonitoringPoint;
+ SystemBussinessHelper.SetWorkPieceInfoMiddleForCreatedUserName(ref info, logMiddle.DataCapturePointCname);
info.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
info.WorkingProcedureCurrent = logMiddle.WorkingProcedure;
info.WorkingProcedureEndTime = null;
@@ -1223,6 +1279,7 @@
logMiddle.WorkingProcedure = info.WorkingProcedureCurrent; //瑙e喅OP10锛孫P40鍚屼竴涓殑闂
}
info.UpdatedUserName = logMiddle.MonitoringPoint;
+ SystemBussinessHelper.SetWorkPieceInfoMiddleForUpdateDataCapturePointCname(ref info, logMiddle.DataCapturePointCname);
info.UpdatedTime = DateTimeHelper.GetDateTime();
info.WorkingProcedureCompleted = info.WorkingProcedureCompleted + logMiddle.WorkingProcedure;//宸插畬鎴愬伐搴�
if (!(info.WorkingProcedureStartTime.HasValue && info.WorkingProcedureStartTime > DateTime.Parse("1900/01/01")))
@@ -1249,6 +1306,7 @@
info.QualityStateUpdateTime = loginfo.UpdatedTime.Value.LocalDateTime;
info.QualityStateUpdateMode = QualityStateUpdateMode.Auto.ToString();
//*/
+
var qualityData = db.QualityDataInfo.Where(o => o.WorkPieceID == logMiddle.WorkPieceID).FirstOrDefault();
if (qualityData == null || qualityData.WorkPieceID.Length < 1 || qualityData.WorkingProcedure.Length < 1)
@@ -1330,11 +1388,14 @@
{
WorkPieceProcess process = new WorkPieceProcess();
process = EntityPropHelper.Mapper<WorkPieceProcess, WorkPieceInfo>(info);
+ QualityStateHelper.ResetQualityNoOkForNewProcess(ref process);
process.Id = Yitter.IdGenerator.YitIdHelper.NextId();
process.StartTime = DateTimeHelper.GetDateTime();
process.EndTime = DateTimeHelper.GetDateTime();
if (logMiddle.WorkingProcedure.Equals("OP80"))
{//OP80鐨勮川閲忔暟鎹槸鍚庢潵鑾峰彇鏂囦欢鎼炵殑
+ //璐ㄦ鏁版嵁锛屽啀鑰冭檻 鍙﹀涓ょ鐘舵�� 銆怑ditby shaocx,2024-08-27銆�
+ QualityStateHelper.SetQualityStateForOP80(logMiddle, ref info, ref process);
}
else
{
@@ -1343,8 +1404,10 @@
process.QualityState = WorkPieceInfoManager.GetQualityStateValue(logMiddle.QualityState);
}
process.CreatedUserName = logMiddle.MonitoringPoint;
+ process.DataCapturePointCname = logMiddle.DataCapturePointCname;
process.CreatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
process.UpdatedUserName = logMiddle.MonitoringPoint;
+ process.UpdateDataCapturePointCname = logMiddle.DataCapturePointCname;
process.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
process.OperationType = OperationType.鐢熶骇.ToString();
process.Remarks = "";
@@ -1360,12 +1423,18 @@
}
else
{
+ if (logMiddle.WorkingProcedure.Equals("OP80"))
+ {//OP80鐨勮川閲忔暟鎹槸鍚庢潵鑾峰彇鏂囦欢鎼炵殑
+ //璐ㄦ鏁版嵁锛屽啀鑰冭檻 鍙﹀涓ょ鐘舵�� 銆怑ditby shaocx,2024-08-27銆�
+ QualityStateHelper.SetQualityStateForOP80(logMiddle, ref info, ref pro);
+ }
if (op80id > 0)
{
pro.QualityDataInfoID = op80id;
}
pro.EndTime = DateTimeHelper.GetDateTime();
pro.UpdatedUserName = logMiddle.MonitoringPoint;
+ pro.UpdateDataCapturePointCname = logMiddle.DataCapturePointCname;
pro.UpdatedTime = DateTimeHelper.GetDateTime();
if (logMiddle.WorkingProcedure.Equals("OP80"))
{
@@ -1385,14 +1454,14 @@
}
else
{
- loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"涓嬬嚎瀹屾垚璇诲彇浜岀淮鐮亄logMiddle.WorkPieceID ?? "绌�"}寮傚父";
+ loginfo2.Remarks = $"涓嬬嚎瀹屾垚璇诲彇浜岀淮鐮亄logMiddle.WorkPieceID ?? "绌�"}寮傚父";
Log4NetHelper.WriteErrorLog(type, $" {logMiddle.WorkingProcedure}宸ュ簭涓嬬嚎 璇诲彇宸ヤ欢鐮佹暟鎹甗{logMiddle.WorkPieceID ?? "绌�"}]鏃跺紓甯革細");
}
}
catch (Exception e)
{
- loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"璇诲彇浜岀淮鐮亄logMiddle.WorkPieceID ?? "绌�"}鏇存柊鏁版嵁寮傚父{e.Message}";
+ loginfo2.Remarks = $"璇诲彇浜岀淮鐮亄logMiddle.WorkPieceID ?? "绌�"}鏇存柊鏁版嵁寮傚父{e.Message}";
}
db.WorkPieceLog.Add(GetAddWorkPieceLog(loginfo2));//鎻掑叆宸ヤ欢閲囬泦鏃ュ織琛�
db.SaveChanges();
@@ -1999,7 +2068,7 @@
}
catch (Exception e)
{
- loginfo2.Remarks = (loginfo2.Remarks ?? "") + $"{loginfo2.MonitoringPoint}璁惧鐩戞帶鏇存柊鏁版嵁寮傚父{e.Message}.{e.StackTrace}";
+ loginfo2.Remarks = $"{loginfo2.MonitoringPoint}璁惧鐩戞帶鏇存柊鏁版嵁寮傚父{e.Message}.{e.StackTrace}";
Log4NetHelper.WriteErrorLog(type, $"{loginfo2.MonitoringPoint}璁惧鐩戞帶鏇存柊鏁版嵁寮傚父{e.Message}.{e.StackTrace}");
}
--
Gitblit v1.9.3