Commit 6680b8fa by lcx

返回列表添加状态

parent 560f4bda
...@@ -406,7 +406,7 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName) ...@@ -406,7 +406,7 @@ public HandsonTable GetCollectData(int userId, int allotId, string sheetName)
HandsonTable handson = new HandsonTable(sheet.SheetType.Value, cols, permissions); HandsonTable handson = new HandsonTable(sheet.SheetType.Value, cols, permissions);
handson.SetRowData(rowDatas, (collectdata != null)); handson.SetRowData(rowDatas, (collectdata != null));
if (collectdata != null && collectdata.Any(t => t.Status == 2)) if (collectdata != null && collectdata.Any(t => new int[] { 2, 3 }.Contains(t.Status)))
{ {
handson.Columns?.ForEach(t => t.ReadOnly = true); handson.Columns?.ForEach(t => t.ReadOnly = true);
handson.ReadOnly = true; handson.ReadOnly = true;
...@@ -941,14 +941,40 @@ public void SubmitCollectData(int allotId, string sheetName, int userId) ...@@ -941,14 +941,40 @@ public void SubmitCollectData(int allotId, string sheetName, int userId)
/// </summary> /// </summary>
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
/// <returns></returns> /// <returns></returns>
public List<per_allot> CollectDataList(int hospitalId) public object CollectDataList(int hospitalId)
{ {
var allots = perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId); var allots = perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId);
if (allots == null || !allots.Any()) if (allots == null || !allots.Any())
return new List<per_allot>(); return new List<per_allot>();
var data = perforcollectdataRepository.GetEntities(t => allots.Select(a => a.ID).Contains(t.AllotID));
allots = allots.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).ToList(); allots = allots.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).ToList();
return allots; return allots.Select(t => new
{
t.ID,
t.Year,
t.Month,
Status = GetStatus(data.Where(s => s.AllotID == t.ID))
});
}
private int GetStatus(IEnumerable<collect_data> data)
{
if (data == null || !data.Any())
return 1;
if (data.Count(t => t.Status == 3) == data.Count())
return 3;
else if (data.Any(t => t.Status == 4))
return 4;
else if (data.Any(t => t.Status == 2))
return 2;
return 1;
} }
/// <summary> /// <summary>
...@@ -1013,7 +1039,7 @@ public SheetExportResponse DepartmentTable(int allotId, int userId) ...@@ -1013,7 +1039,7 @@ public SheetExportResponse DepartmentTable(int allotId, int userId)
}; };
int index = 4; int index = 4;
var sheetnames = data.Select(t => t.SheetName).Distinct(); var sheetnames = data.Select(t => t.SheetName).Distinct().OrderBy(t => t);
foreach (var sheetname in sheetnames) foreach (var sheetname in sheetnames)
{ {
var sheetColumns = data.Where(t => t.SheetName == sheetname).Select(t => t.TypeName).Distinct().OrderBy(t => t); var sheetColumns = data.Where(t => t.SheetName == sheetname).Select(t => t.TypeName).Distinct().OrderBy(t => t);
...@@ -1103,7 +1129,7 @@ public HandsonTableBase DepartmentList(int allotId, int userId) ...@@ -1103,7 +1129,7 @@ public HandsonTableBase DepartmentList(int allotId, int userId)
#region headers columns #region headers columns
var sheets = data.Select(t => t.SheetName).Distinct(); var sheets = data.Select(t => t.SheetName).Distinct().OrderBy(t => t).ToList();
var mergeCells = new List<NestedHeader> var mergeCells = new List<NestedHeader>
{ {
new NestedHeader("", 1), new NestedHeader("", 1),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment