From 87054d98234d4c37fc3ba9595efe63bcfdc30b07 Mon Sep 17 00:00:00 2001
From: song.jun <lion0756@qq.com>
Date: 星期三, 20 五月 2026 11:43:46 +0800
Subject: [PATCH] 修复 EQAS 报告 PDF 直抗扣分未汇总等 6 处遗漏(QCService.ExportPDF)

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

diff --git a/sbcLabSystem.Service/QC/QCService.cs b/sbcLabSystem.Service/QC/QCService.cs
index 6076d94..0210969 100644
--- a/sbcLabSystem.Service/QC/QCService.cs
+++ b/sbcLabSystem.Service/QC/QCService.cs
@@ -223,37 +223,50 @@
             double Page3_3 = 0;
             double temp1 = 0;
             double temp2 = 0;
+            double temp3 = 0;
             int errors_ABO = 0;
             int errors_RH = 0;
+            int errors_ZhiKang = 0;
 
-            errors_ABO += ABO1["RealScore"].ToString() == "0" ? 0 : 1 +
-                ABO2["RealScore"].ToString() == "0" ? 0 : 1 +
-                ABO3["RealScore"].ToString() == "0" ? 0 : 1;
-            errors_RH += RH1["RealScore"].ToString() == "0" ? 0 : 1 +
-                RH1["RealScore"].ToString() == "0" ? 0 : 1 +
-                RH1["RealScore"].ToString() == "0" ? 0 : 1;
+            errors_ABO += (ABO1["RealScore"].ToString() == "0" ? 0 : 1)
+                + (ABO2["RealScore"].ToString() == "0" ? 0 : 1)
+                + (ABO3["RealScore"].ToString() == "0" ? 0 : 1);
+            errors_RH += (RH1["RealScore"].ToString() == "0" ? 0 : 1)
+                + (RH2["RealScore"].ToString() == "0" ? 0 : 1)
+                + (RH3["RealScore"].ToString() == "0" ? 0 : 1);
+            errors_ZhiKang += (ZhiKang1["RealScore"].ToString() == "0" ? 0 : 1)
+                + (ZhiKang2["RealScore"].ToString() == "0" ? 0 : 1)
+                + (ZhiKang3["RealScore"].ToString() == "0" ? 0 : 1);
             ws.Cells["M18"].Value = errors_ABO;
             ws.Cells["M19"].Value = errors_RH;
+            ws.Cells["M23"].Value = errors_ZhiKang;
 
             ws.Cells["N18"].Value = ABO1["Score"].ToString();
             ws.Cells["N19"].Value = RH1["Score"].ToString();
 
             ws.Cells["O18"].Value = int.Parse(ABO1["Score"].ToString()) * errors_ABO;
             ws.Cells["O19"].Value = int.Parse(RH1["Score"].ToString()) * errors_RH;
+            ws.Cells["N23"].Value = ZhiKang1["Score"].ToString();
+            ws.Cells["O23"].Value = double.Parse(ZhiKang1["RealScore"].ToString())
+                + double.Parse(ZhiKang2["RealScore"].ToString())
+                + double.Parse(ZhiKang3["RealScore"].ToString());
 
             double.TryParse(ABO1["RealScore"].ToString(), out temp1);
             double.TryParse(RH1["RealScore"].ToString(), out temp2);
-            Page3_1 = temp1 + temp2;
+            double.TryParse(ZhiKang1["RealScore"].ToString(), out temp3);
+            Page3_1 = temp1 + temp2 + temp3;
             ws.Cells["AA10"].Value = Page3_1;
 
             double.TryParse(ABO2["RealScore"].ToString(), out temp1);
             double.TryParse(RH2["RealScore"].ToString(), out temp2);
-            Page3_2 = temp1 + temp2;
+            double.TryParse(ZhiKang2["RealScore"].ToString(), out temp3);
+            Page3_2 = temp1 + temp2 + temp3;
             ws.Cells["AA14"].Value = Page3_2;
 
             double.TryParse(ABO3["RealScore"].ToString(), out temp1);
             double.TryParse(RH3["RealScore"].ToString(), out temp2);
-            Page3_3 = temp1 + temp2;
+            double.TryParse(ZhiKang3["RealScore"].ToString(), out temp3);
+            Page3_3 = temp1 + temp2 + temp3;
             ws.Cells["AA18"].Value = Page3_3;
 
             ws.Cells["Y21"].Value = double.Parse(ABO1["RealScore"].ToString()) +
@@ -402,7 +415,7 @@
             ws.Cells["M22"].Value = errors_JiaoCha;
             ws.Cells["O22"].Value = ws.Cells["AS22"].Value;
 
-            ws.Cells["M24"].Value = errors_ABO + errors_Filter + errors_Identity + errors_JiaoCha + errors_RH;
+            ws.Cells["M24"].Value = errors_ABO + errors_RH + errors_ZhiKang + errors_Filter + errors_Identity + errors_JiaoCha;
             ws.Cells["O24"].Value = double.Parse(ws.Cells["O18"].Value.ToString()) +
                 double.Parse(ws.Cells["O19"].Value.ToString()) +
                 double.Parse(ws.Cells["O20"].Value.ToString()) +
@@ -1043,8 +1056,8 @@
                     MergeRegisterInfo(existing, qcDistributionRegister);
                     _qcDistributionRegisters.Update(existing);
                     qcDistributionRegister.Id = existing.Id;
-                    LogHelper.Info(string.Format(
-                        "[WARN] SaveQcDistributionRegister 命中已有行 Id={0}(入参 Id=0),已重定向 UPDATE:QCDist={1}, Lab={2}, Project={3}。请检查上层为何未先查重。",
+                    LogHelper.Error(string.Format(
+                        "SaveQcDistributionRegister 命中已有行 Id={0}(入参 Id=0),已重定向 UPDATE:QCDist={1}, Lab={2}, Project={3}。上层必定漏做查重或前端提交了脏 Id,必须排查根因。",
                         existing.Id,
                         qcDistributionRegister.QCDistributionId,
                         qcDistributionRegister.LabId,
@@ -1061,16 +1074,16 @@
 
         private static void MergeRegisterInfo(QCDistributionRegisterInfo target, QCDistributionRegisterInfo source)
         {
-            if (source.LetterNo != null) target.LetterNo = source.LetterNo;
-            if (source.ChargeRemark != null) target.ChargeRemark = source.ChargeRemark;
-            if (source.SampleNo != null) target.SampleNo = source.SampleNo;
-            if (source.EMSNo != null) target.EMSNo = source.EMSNo;
-            if (source.PacketContent != null) target.PacketContent = source.PacketContent;
-            if (source.Remark != null) target.Remark = source.Remark;
-            if (source.ModifyUser != null) target.ModifyUser = source.ModifyUser;
-            if (source.AnswerJSON != null) target.AnswerJSON = source.AnswerJSON;
-            if (source.SubmitUserNo != null) target.SubmitUserNo = source.SubmitUserNo;
-            if (source.Score_Detail != null) target.Score_Detail = source.Score_Detail;
+            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;

--
Gitblit v1.8.0