Commit 35631822 by 钟博

提取数据完成后可以选择上传

parent f7c5bf9d
...@@ -168,6 +168,52 @@ public ApiResponse Import([FromForm] IFormCollection form) ...@@ -168,6 +168,52 @@ public ApiResponse Import([FromForm] IFormCollection form)
return new ApiResponse(ResponseType.OK); return new ApiResponse(ResponseType.OK);
} }
/// <summary>
/// 上传文件
/// </summary>
/// <param name="form"></param>
/// <returns></returns>
[Route("ImportExtraction/{allotId}")]
[HttpPost]
public ApiResponse ImportExtraction(int allotId)
{
var allot = _allotService.GetAllot(allotId);
if (allot == null)
return new ApiResponse(ResponseType.Fail, "allotid不存在");
var fileName = allot.ExtractPath.Split("\\").Last().Replace(@"\d", "");
//var file = ((FormFileCollection)allot.ExtractPath).FirstOrDefault();
//if (file == null)
// return new ApiResponse(ResponseType.Fail, "参数错误", "文件无效");
var name = FileHelper.GetFileNameNoExtension(fileName) + DateTime.Now.ToString("yyyyMMddHHmmssfff");
var ext = FileHelper.GetExtension(fileName);
var dpath = Path.Combine(_evn.ContentRootPath, "Files", $"{allot.HospitalId}", $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}");
FileHelper.CreateDirectory(dpath);
var path = Path.Combine(dpath, $"{name}{ext}");
using (var stream = System.IO.File.OpenRead(allot.ExtractPath))
{
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
if (!FileHelper.CreateFile(path, bytes))
return new ApiResponse(ResponseType.Fail, $"上传失败");
allot.Path = path;
allot.States = (int)AllotStates.FileUploaded;
allot.Remark = EnumHelper.GetDescription(AllotStates.FileUploaded);
allot.UploadDate = DateTime.Now;
allot.Generate = (int)AllotGenerate.Init;
if (!_allotService.Update(allot))
return new ApiResponse(ResponseType.Fail, $"上传成功,修改状态失败");
_configService.Clear(allot.ID);
}
return new ApiResponse(ResponseType.OK);
}
/// <summary> /// <summary>
/// 绩效生成 /// 绩效生成
/// </summary> /// </summary>
......
...@@ -766,15 +766,15 @@ private void UnitFit(List<HandsonRowData> rowDatas, List<HandsonCellData> cellDa ...@@ -766,15 +766,15 @@ private void UnitFit(List<HandsonRowData> rowDatas, List<HandsonCellData> cellDa
exists = true; exists = true;
} }
if (cellData.Name == "核算单元分类" && cellData.Value?.ToString() == cell.Value) if (cellData.Name == "核算单元分类" && cellData.Value == cell.Value)
{ {
exists2 = true; exists2 = true;
} }
else if (cellData.Name == "核算组别" && cellData.Value?.ToString() == cell.Value) else if (cellData.Name == "核算组别" && cellData.Value == cell.Value)
{ {
exists2 = true; exists2 = true;
} }
else if (cellData.Name == "核算单元类型" && cellData.Value?.ToString() == cell.Value) else if (cellData.Name == "核算单元类型" && cellData.Value == cell.Value)
{ {
exists2 = true; exists2 = true;
} }
......
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