From d6cc926b4bf627ce5a24ea2a16a86a842b760f75 Mon Sep 17 00:00:00 2001
From: song.jun <lion0756@qq.com>
Date: 星期一, 13 四月 2026 14:23:19 +0800
Subject: [PATCH] CLAUDE.md 红线章节补充 Excel 导出数组对齐陷阱
---
sbcLabSystem/Controllers/BackstageController.cs | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/sbcLabSystem/Controllers/BackstageController.cs b/sbcLabSystem/Controllers/BackstageController.cs
index 29dd20f..294ed2d 100644
--- a/sbcLabSystem/Controllers/BackstageController.cs
+++ b/sbcLabSystem/Controllers/BackstageController.cs
@@ -263,15 +263,27 @@
[HttpPost]
public ActionResult ImportLabs(int oriDistId, int TargetDistId)
{
+ if (oriDistId == TargetDistId)
+ {
+ return Json(new QCDistributionPageViewModel(TargetDistId, 1, 20));
+ }
QCDistribution qcDistInfo = _qcService.GetQcDistributions()
.FirstOrDefault(p => p.Id == TargetDistId);
+ if (qcDistInfo == null)
+ {
+ return Json(new QCDistributionPageViewModel(TargetDistId, 1, 20));
+ }
var delList = _qcService.GetQcDistributionRegisters().Where(p => p.QCDistributionId == TargetDistId).ToList();
for (int i = 0; i < delList.Count; i++)
{
_qcService.DeleteQcDistributionRegister(delList[i]);
}
_qcService.GetQcDistributionRegisters().Where(p => p.QCDistributionId == oriDistId
- && p.LabInfo.State == 1).ToList().ForEach(x =>
+ && p.LabInfo.State == 1).ToList()
+ .GroupBy(x => new { x.LabId, x.ProjectId })
+ .Select(g => g.First())
+ .ToList()
+ .ForEach(x =>
{
var newEntityInfo = new QCDistributionRegisterInfo();
newEntityInfo.QCDistributionId = TargetDistId;
@@ -999,7 +1011,7 @@
List<UserRequestInfo> UserRequestInfoList = m_AccountService.GetUserRequestInfo().Where(p => p.State == 1 && p.UpdateTime > Date1 && p.UpdateTime < Date2).OrderBy(p => p.LabCode).ToList();
DataTable dt = ExcelUtil.ConvertToDataTable(UserRequestInfoList);
string TableName = DateTime.Now.ToString("yyMMddHHmmssfff") + "实验室.xls";
- string[] headers = { "实验室编号", "用户名", "单位名称", "实验室名称", "地址", "城市", "参加项目代号", "负责人", "固话", "传真", "手机号码", "邮箱", "操作人", "固话", "传真", "手机号码", "邮箱", "申请时间", "审核时间" };
+ string[] headers = { "实验室编号", "用户名", "单位名称", "实验室名称", "地址", "省份", "参加项目代号", "负责人", "固话", "传真", "手机号码", "邮箱", "操作人", "固话", "传真", "手机号码", "邮箱", "申请时间", "审核时间" };
string[] cellKes = { "LabCode", "LabLoginName", "CompanyName", "LabName", "Address", "Province", "ProjectId", "ManagerName", "ManagerPhone", "ManagerFax", "ManagerMobile", "ManagerEmail", "OperatorName", "OperatorPhone", "OperatorFax", "OperatorMobile", "OperatorEmail", "RequestTime", "UpdateTime" };
ExcelUtil.ExportByWeb(dt, "实验室列表", headers, cellKes, TableName);
return View("LabAdmin");
@@ -1010,7 +1022,7 @@
List<UserRequestInfo> UserRequestInfoList = m_AccountService.GetUserRequestInfo().Where(p => p.State == 1).OrderBy(p => p.LabCode).ToList();
DataTable dt = ExcelUtil.ConvertToDataTable(UserRequestInfoList);
string TableName = DateTime.Now.ToString("yyMMddHHmmssfff") + "实验室.xls";
- string[] headers = { "实验室编号", "用户名", "单位名称", "实验室名称", "邮编", "地址", "城市", "参加项目代号", "负责人", "固话", "传真", "手机号码", "邮箱", "操作人", "固话", "传真", "手机号码", "邮箱", "申请时间", "审核时间" };
+ string[] headers = { "实验室编号", "用户名", "单位名称", "实验室名称", "邮编", "地址", "省份", "参加项目代号", "负责人", "固话", "传真", "手机号码", "邮箱", "操作人", "固话", "传真", "手机号码", "邮箱", "申请时间", "审核时间" };
string[] cellKes = { "LabCode", "LabLoginName", "CompanyName", "LabName", "PostCode", "Address", "Province", "ProjectId", "ManagerName", "ManagerPhone", "ManagerFax", "ManagerMobile", "ManagerEmail", "OperatorName", "OperatorPhone", "OperatorFax", "OperatorMobile", "OperatorEmail", "RequestTime", "UpdateTime" };
ExcelUtil.ExportByWeb(dt, "实验室列表", headers, cellKes, TableName);
return View("LabAdmin");
@@ -1215,9 +1227,9 @@
}
string TableName = distName + "参与实验室.xls";
string[] headers = { "实验室编号", "实验室名称","是否收费", "单位名称", "省份", "质评项目",
- "地址", "邮编","Email","管理员","手机号","操作员姓名","操作员Email","操作员手机号","是否收费" };
+ "地址", "邮编","Email","管理员","手机号","操作员姓名","操作员Email","操作员手机号" };
string[] cellKes = { "labCode", "labName","isCharged", "companyName", "province", "projectClass","address","postcode","email","manager","managerMobile",
- "operatorName","operatorEmail","operatorMobile","isCharged"};
+ "operatorName","operatorEmail","operatorMobile"};
ExcelUtil.ExportByWeb(dt, distName + "参与实验室列表", headers, cellKes, TableName);
return View("QCDistributionLabs");
}
--
Gitblit v1.8.0