From 712de30133f921b5ac1f1ae2a1b77fff8b709c20 Mon Sep 17 00:00:00 2001
From: song.jun <lion0756@qq.com>
Date: 星期一, 13 四月 2026 12:49:16 +0800
Subject: [PATCH] 修正代码评审发现的 Critical 问题(a3f4e4f 后续修复)

---
 sbcLabSystem.Service/QC/QCService.cs |   63 ++++++++++++++++++++++++++++---
 1 files changed, 57 insertions(+), 6 deletions(-)

diff --git a/sbcLabSystem.Service/QC/QCService.cs b/sbcLabSystem.Service/QC/QCService.cs
index 47a7a0b..5e4acdb 100644
--- a/sbcLabSystem.Service/QC/QCService.cs
+++ b/sbcLabSystem.Service/QC/QCService.cs
@@ -169,13 +169,13 @@
             ws.Cells["M28"].Value = Identity2["Score"].ToString();
             ws.Cells["M29"].Value = Identity3["Score"].ToString();
             ws.Cells["N27"].Value = Patient1X["Score"].ToString();
-            ws.Cells["N28"].Value = Patient1Y["Score"].ToString();
-            ws.Cells["N29"].Value = Patient1Z["Score"].ToString();
-            ws.Cells["O27"].Value = Patient2X["Score"].ToString();
+            ws.Cells["N28"].Value = Patient2X["Score"].ToString();
+            ws.Cells["N29"].Value = Patient3X["Score"].ToString();
+            ws.Cells["O27"].Value = Patient1X["Score"].ToString();
             ws.Cells["O28"].Value = Patient2Y["Score"].ToString();
-            ws.Cells["O29"].Value = Patient2Z["Score"].ToString();
-            ws.Cells["P27"].Value = Patient3X["Score"].ToString();
-            ws.Cells["P28"].Value = Patient3Y["Score"].ToString();
+            ws.Cells["O29"].Value = Patient3Y["Score"].ToString();
+            ws.Cells["P27"].Value = Patient1Z["Score"].ToString();
+            ws.Cells["P28"].Value = Patient2Z["Score"].ToString();
             ws.Cells["P29"].Value = Patient3Z["Score"].ToString();
             ws.Cells["Q27"].Value = ZhiKang1["Score"].ToString();
             ws.Cells["Q28"].Value = ZhiKang2["Score"].ToString();
@@ -208,6 +208,15 @@
             ws.Cells["X10"].Value = RH1["RealValue"].ToString();
             ws.Cells["X14"].Value = RH2["RealValue"].ToString();
             ws.Cells["X18"].Value = RH3["RealValue"].ToString();
+
+            ws.Cells["Y10"].Value = ZhiKang1["RealValue"].ToString();
+            ws.Cells["Y14"].Value = ZhiKang2["RealValue"].ToString();
+            ws.Cells["Y18"].Value = ZhiKang3["RealValue"].ToString();
+
+            ws.Cells["Y11"].Value = ZhiKang1["StandValue"].ToString();
+            ws.Cells["Y15"].Value = ZhiKang2["StandValue"].ToString();
+            ws.Cells["Y19"].Value = ZhiKang3["StandValue"].ToString(); 
+
 
             double Page3_1 = 0;
             double Page3_2 = 0;
@@ -1025,6 +1034,23 @@
             LogHelper.Debug("准备保存对象:" + qcDistributionRegister.AnswerJSON);
             if (qcDistributionRegister.Id == 0)
             {
+                var existing = _qcDistributionRegisters.Table.FirstOrDefault(
+                    p => p.QCDistributionId == qcDistributionRegister.QCDistributionId
+                      && p.LabId == qcDistributionRegister.LabId
+                      && p.ProjectId == qcDistributionRegister.ProjectId);
+                if (existing != null)
+                {
+                    MergeRegisterInfo(existing, qcDistributionRegister);
+                    _qcDistributionRegisters.Update(existing);
+                    qcDistributionRegister.Id = existing.Id;
+                    LogHelper.Error(string.Format(
+                        "SaveQcDistributionRegister 命中已有行 Id={0}(入参 Id=0),已重定向 UPDATE:QCDist={1}, Lab={2}, Project={3}。上层必定漏做查重或前端提交了脏 Id,必须排查根因。",
+                        existing.Id,
+                        qcDistributionRegister.QCDistributionId,
+                        qcDistributionRegister.LabId,
+                        qcDistributionRegister.ProjectId));
+                    return;
+                }
                 _qcDistributionRegisters.Insert(qcDistributionRegister);
             }
             else
@@ -1032,6 +1058,31 @@
                 _qcDistributionRegisters.Update(qcDistributionRegister);
             }
         }
+
+        private static void MergeRegisterInfo(QCDistributionRegisterInfo target, QCDistributionRegisterInfo source)
+        {
+            if (!string.IsNullOrEmpty(source.LetterNo)) target.LetterNo = source.LetterNo;
+            if (!string.IsNullOrEmpty(source.ChargeRemark)) target.ChargeRemark = source.ChargeRemark;
+            if (!string.IsNullOrEmpty(source.SampleNo)) target.SampleNo = source.SampleNo;
+            if (!string.IsNullOrEmpty(source.EMSNo)) target.EMSNo = source.EMSNo;
+            if (!string.IsNullOrEmpty(source.PacketContent)) target.PacketContent = source.PacketContent;
+            if (!string.IsNullOrEmpty(source.Remark)) target.Remark = source.Remark;
+            if (!string.IsNullOrEmpty(source.ModifyUser)) target.ModifyUser = source.ModifyUser;
+            if (!string.IsNullOrEmpty(source.AnswerJSON)) target.AnswerJSON = source.AnswerJSON;
+            if (!string.IsNullOrEmpty(source.SubmitUserNo)) target.SubmitUserNo = source.SubmitUserNo;
+            if (!string.IsNullOrEmpty(source.Score_Detail)) target.Score_Detail = source.Score_Detail;
+            if (source.ChargeTime.HasValue) target.ChargeTime = source.ChargeTime;
+            if (source.SendEMSTime.HasValue) target.SendEMSTime = source.SendEMSTime;
+            if (source.SubmitTime.HasValue) target.SubmitTime = source.SubmitTime;
+            if (source.FirstTimeSubmitTime.HasValue) target.FirstTimeSubmitTime = source.FirstTimeSubmitTime;
+            if (source.LastPageModifyTime.HasValue) target.LastPageModifyTime = source.LastPageModifyTime;
+            if (source.ModifyTime != default(DateTime)) target.ModifyTime = source.ModifyTime;
+            if (source.IsCharged) target.IsCharged = true;
+            if (source.IsSendEMS) target.IsSendEMS = true;
+            if (source.IsSubmit) target.IsSubmit = true;
+            if (source.IsModified) target.IsModified = true;
+            if (source.IsEnding) target.IsEnding = true;
+        }
         public QCDistributionRegisterInfo GetNextOneQCDistRegInfo(QCDistributionRegisterInfo prevRegInfo)
         {
             var results = this.GetQcDistributionRegisters()

--
Gitblit v1.8.0