Commit 5ba21ca7 by ruyun.zhang@suvalue.com

Merge branch 'develop' of http://192.168.0.110:8880/zry/performance into develop

# Conflicts:
#	performance/Performance.Services/PerExcelService/PerExcelService.cs
parents 356f0a1e 8565ffa9
......@@ -112,7 +112,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
var file = ((FormFileCollection)form.Files).FirstOrDefault();
if (file == null)
return new ApiResponse(ResponseType.Fail, "参数错误", "allotid无效");
return new ApiResponse(ResponseType.Fail, "参数错误", "文件无效");
var allot = _allotService.GetAllot(allotid);
if (allot == null)
......@@ -136,6 +136,8 @@ public ApiResponse Import([FromForm] IFormCollection form)
allot.UploadDate = DateTime.Now;
if (!_allotService.Update(allot))
return new ApiResponse(ResponseType.Fail, $"{file.FileName}上传成功,修改状态失败");
_perExcelService.Clear(allot.ID);
_perExcelService.Copy(allot);
}
return new ApiResponse(ResponseType.OK);
......
......@@ -23,16 +23,18 @@ public class PerExcelService : IAutoInjection
private PerforImHeaderRepository _perforImHeaderRepository;
private PerforImEmployeeRepository _perforImEmployeeRepository;
private PerforImaccountbasicRepository _perforImaccountbasicRepository;
private PerforResAccountnurseRepository _perforImaccountnurseRepository;
private PerforResAccountnurseRepository _perforResAccountnurseRepository;
private PerforCofpositionRepository _perforCofpositionRepository;
private PerforCofdirectorRepository _perforCofdirectorRepository;
private PerforCofdrugpropRepository _perforCofdrugpropRepository;
private PerforCofincomeRepository _perforCofincomeRepository;
private PerforCofworkyearRepository _perforCofworkyearRepository;
private PerforResAccountdoctorRepository _perforResAccountdoctorRepository;
private PerforResAccountnurseRepository _perforResAccountnurseRepository;
private PerforResbaiscnormRepository _perforResbaiscnormRepository;
private PerforRescomputeRepository _perforRescomputeRepository;
private PerforImspecialunitRepository _perforImspecialunitRepository;
private PerforResspecialunitRepository _perforResspecialunitRepository;
private PerforPerAllotRepository _perforPerAllotRepository;
public PerExcelService(PerSheetService perSheetService,
PerHeaderService perHeaderService,
PerforPerSheetRepository perforImSheetRepository,
......@@ -40,16 +42,18 @@ public class PerExcelService : IAutoInjection
PerforImHeaderRepository perforImHeaderRepository,
PerforImEmployeeRepository perforImEmployeeRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository,
PerforResAccountnurseRepository perforImaccountnurseRepository,
PerforResAccountnurseRepository perforResAccountnurseRepository,
PerforCofpositionRepository perforCofpositionRepository,
PerforCofdirectorRepository perforCofdirectorRepository,
PerforCofdrugpropRepository perforCofdrugpropRepository,
PerforCofincomeRepository perforCofincomeRepository,
PerforResAccountdoctorRepository perforResAccountdoctorRepository,
PerforResAccountnurseRepository perforResAccountnurseRepository,
PerforResbaiscnormRepository perforResbaiscnormRepository,
PerforRescomputeRepository perforRescomputeRepository,
PerforCofworkyearRepository perforCofworkyearRepository,
PerforImspecialunitRepository perforImspecialunitRepository,
PerforResspecialunitRepository perforResspecialunitRepository)
PerforResspecialunitRepository perforResspecialunitRepository,
PerforPerAllotRepository perforPerAllotRepository)
{
_perSheetService = perSheetService;
_perHeaderService = perHeaderService;
......@@ -58,14 +62,16 @@ public class PerExcelService : IAutoInjection
_perforImHeaderRepository = perforImHeaderRepository;
_perforImEmployeeRepository = perforImEmployeeRepository;
_perforImaccountbasicRepository = perforImaccountbasicRepository;
_perforImaccountnurseRepository = perforImaccountnurseRepository;
_perforResAccountnurseRepository = perforResAccountnurseRepository;
_perforCofpositionRepository = perforCofpositionRepository;
_perforResAccountdoctorRepository = perforResAccountdoctorRepository;
_perforResAccountnurseRepository = perforResAccountnurseRepository;
_perforCofdirectorRepository = perforCofdirectorRepository;
_perforCofdrugpropRepository = perforCofdrugpropRepository;
_perforCofincomeRepository = perforCofincomeRepository;
_perforCofworkyearRepository = perforCofworkyearRepository;
_perforResbaiscnormRepository = perforResbaiscnormRepository;
_perforRescomputeRepository = perforRescomputeRepository;
_perforCofworkyearRepository = perforCofworkyearRepository;
_perforPerAllotRepository = perforPerAllotRepository;
_perforImspecialunitRepository = perforImspecialunitRepository;
_perforResspecialunitRepository = perforResspecialunitRepository;
}
......@@ -149,9 +155,23 @@ private void SendEmail(per_allot allot)
}
private void Clear(int iD)
public void Clear(int allotId)
{
var director = _perforCofdirectorRepository.GetEntities(t => t.AllotID == allotId);
if (director != null)
_perforCofdirectorRepository.RemoveRange(director.ToArray());
var durgprop = _perforCofdrugpropRepository.GetEntities(t => t.AllotID == allotId);
if (durgprop != null)
_perforCofdrugpropRepository.RemoveRange(durgprop.ToArray());
var income = _perforCofincomeRepository.GetEntities(t => t.AllotID == allotId);
if (income != null)
_perforCofincomeRepository.RemoveRange(income.ToArray());
var position = _perforCofpositionRepository.GetEntities(t => t.AllotID == allotId);
if (position != null)
_perforCofpositionRepository.RemoveRange(position.ToArray());
var workyear = _perforCofworkyearRepository.GetEntities(t => t.AllotID == allotId);
if (workyear != null)
_perforCofworkyearRepository.RemoveRange(workyear.ToArray());
}
/// <summary>
......@@ -191,9 +211,69 @@ public PerExcel Import(string path)
/// 复制报表基础配置
/// </summary>
/// <param name="iD"></param>
public void Copy(int iD)
public void Copy(per_allot allot)
{
//throw new NotImplementedException();
var list = _perforPerAllotRepository.GetEntities(t => t.HospitalId == allot.HospitalId)
.OrderByDescending(t => t.Year).ThenBy(t => t.Month).ToList();
int allotId = 0;
for (int i = 0; i < list.Count; i++)
{
if (list[i].ID == allot.ID && (i - 1) >= 0)
allotId = list[i - 1].ID;
}
if (allotId > 0)
{
var director = _perforCofdirectorRepository.GetEntities(t => t.AllotID == allotId);
if (director != null)
{
foreach (var item in director)
{
item.ID = 0;
item.AllotID = allot.ID;
_perforCofdirectorRepository.Add(item);
}
}
var durgprop = _perforCofdrugpropRepository.GetEntities(t => t.AllotID == allotId);
if (durgprop != null)
{
foreach (var item in durgprop)
{
item.ID = 0;
item.AllotID = allot.ID;
_perforCofdrugpropRepository.Add(item);
}
}
var income = _perforCofincomeRepository.GetEntities(t => t.AllotID == allotId);
if (income != null)
{
foreach (var item in income)
{
item.ID = 0;
item.AllotID = allot.ID;
_perforCofincomeRepository.Add(item);
}
}
var position = _perforCofpositionRepository.GetEntities(t => t.AllotID == allotId);
if (position != null)
{
foreach (var item in position)
{
item.ID = 0;
item.AllotID = allot.ID;
_perforCofpositionRepository.Add(item);
}
}
var workyear = _perforCofworkyearRepository.GetEntities(t => t.AllotID == allotId);
if (workyear != null)
{
foreach (var item in workyear)
{
item.ID = 0;
item.AllotID = allot.ID;
_perforCofworkyearRepository.Add(item);
}
}
}
}
/// <summary>
......@@ -279,7 +359,7 @@ public void Save(List<PerSheet> perSheets, int allotId, int source)
imdata.AllotID = allotId;
addList.Add(imdata);
}
_perforImaccountnurseRepository.AddRange(addList.ToArray());
_perforResAccountnurseRepository.AddRange(addList.ToArray());
}
else
{
......
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