Commit f0b10e29 by lcx

单元格原始值错误提示修改

parent ed9bf788
...@@ -38,7 +38,7 @@ public class OriginalController : Controller ...@@ -38,7 +38,7 @@ public class OriginalController : Controller
public ApiResponse FactorEdit([FromBody] OriginalRequest request) public ApiResponse FactorEdit([FromBody] OriginalRequest request)
{ {
if (request.Cell.Id <= 0) if (request.Cell.Id <= 0)
return new ApiResponse(ResponseType.Fail, "暂不支持修改"); return new ApiResponse(ResponseType.Fail, "当前列费用无效,无法修改");
var result = originalService.EditFactorData(claim.GetUserId(), request); var result = originalService.EditFactorData(claim.GetUserId(), request);
return result ? new ApiResponse(ResponseType.OK, "修改成功") : new ApiResponse(ResponseType.Fail, "修改失败"); return result ? new ApiResponse(ResponseType.OK, "修改成功") : new ApiResponse(ResponseType.Fail, "修改失败");
......
...@@ -254,8 +254,10 @@ public bool DeleteClinic(im_employee_clinic request) ...@@ -254,8 +254,10 @@ public bool DeleteClinic(im_employee_clinic request)
public bool Audit(int allotId) public bool Audit(int allotId)
{ {
var allot = perforPerallotRepository.GetEntity(t => t.ID == allotId); var allot = perforPerallotRepository.GetEntity(t => t.ID == allotId);
if (allot == null || !new List<int> { (int)AllotStates.GenerateSucceed, (int)AllotStates.Archive }.Contains(allot.States)) if (allot == null || !new List<int> { (int)AllotStates.GenerateSucceed, (int)AllotStates.GenerateAccomplish }.Contains(allot.States))
throw new PerformanceException("绩效信息错误"); throw new PerformanceException("绩效信息错误");
if ((int)AllotStates.Archive == allot.States)
throw new PerformanceException("绩效已归档,暂不支持修改");
allot.Generate = (int)AllotGenerate.PersonnelOffice; allot.Generate = (int)AllotGenerate.PersonnelOffice;
return perforPerallotRepository.Update(allot); return perforPerallotRepository.Update(allot);
......
...@@ -109,6 +109,10 @@ public bool EditSheetData(int userId, OriginalRequest request) ...@@ -109,6 +109,10 @@ public bool EditSheetData(int userId, OriginalRequest request)
break; break;
} }
} }
catch (NotSupportedException ex)
{
throw new PerformanceException("提交参数不合规范");
}
catch (InvalidCastException ex) catch (InvalidCastException ex)
{ {
throw new PerformanceException("提交参数不合规范"); throw new PerformanceException("提交参数不合规范");
...@@ -170,18 +174,18 @@ private void SetValue<TEntity>(TEntity entity, CellRequest cell) ...@@ -170,18 +174,18 @@ private void SetValue<TEntity>(TEntity entity, CellRequest cell)
var property = typeof(TEntity).GetProperty(cell.FieldName); var property = typeof(TEntity).GetProperty(cell.FieldName);
if (value.ToString().IndexOf("%") > -1) if (value.ToString().IndexOf("%") > -1)
value = ConvertHelper.To<decimal>(value.ToString().Replace("%", "")) / 100; value = ConvertHelper.To<decimal>(value.ToString().Replace("%", "")) / 100;
else if (cell.FieldName == "FitPeople") //else if (cell.FieldName == "FitPeople")
{ //{
var fit = EnumHelper.GetItems<PerforType>(); // var fit = EnumHelper.GetItems<PerforType>();
if (!fit.Select(t => t.Description).Contains(cell.CellValue.ToString())) // if (!fit.Select(t => t.Description).Contains(cell.CellValue.ToString()))
throw new PerformanceException("'绩效基数核算参考对象'提交值无效"); // throw new PerformanceException("'绩效基数核算参考对象'提交值无效");
} //}
else if (cell.FieldName == "UnitType") //else if (cell.FieldName == "UnitType")
{ //{
var fit = EnumHelper.GetItems<UnitType>(); // var fit = EnumHelper.GetItems<UnitType>();
if (!fit.Select(t => t.Description).Contains(cell.CellValue.ToString())) // if (!fit.Select(t => t.Description).Contains(cell.CellValue.ToString()))
throw new PerformanceException("'核算单元分类'提交值无效"); // throw new PerformanceException("'核算单元分类'提交值无效");
} //}
else else
{ {
if (property == null) if (property == null)
...@@ -189,6 +193,8 @@ private void SetValue<TEntity>(TEntity entity, CellRequest cell) ...@@ -189,6 +193,8 @@ private void SetValue<TEntity>(TEntity entity, CellRequest cell)
if (value != null && value.ToString() != "") if (value != null && value.ToString() != "")
{ {
try
{
string type = property.PropertyType.FullName.ToLower(); string type = property.PropertyType.FullName.ToLower();
if (type.IndexOf("int") > -1) if (type.IndexOf("int") > -1)
value = Convert.ToInt32(value); value = Convert.ToInt32(value);
...@@ -201,6 +207,11 @@ private void SetValue<TEntity>(TEntity entity, CellRequest cell) ...@@ -201,6 +207,11 @@ private void SetValue<TEntity>(TEntity entity, CellRequest cell)
else if (type.IndexOf("string") > -1) else if (type.IndexOf("string") > -1)
value = cell.CellValue.ToString(); value = cell.CellValue.ToString();
} }
catch (Exception ex)
{
throw new PerformanceException("提交参数不合规范");
}
}
else else
value = null; value = null;
} }
......
...@@ -482,6 +482,8 @@ private void SupplyHeaderByWorkItem(UseTempRequest request, SecondResponse resul ...@@ -482,6 +482,8 @@ private void SupplyHeaderByWorkItem(UseTempRequest request, SecondResponse resul
{ {
var headItem = (HeadItem)headers[i].Clone(); var headItem = (HeadItem)headers[i].Clone();
headItem.FiledName = (i % 2 == 0) ? item.TypeName : item.TypeName.Replace("占比", "金额"); headItem.FiledName = (i % 2 == 0) ? item.TypeName : item.TypeName.Replace("占比", "金额");
if (i % 2 != 0 && !headItem.FiledName.EndsWith("金额"))
headItem.FiledName += "金额";
headItem.FiledId += item.Id; headItem.FiledId += item.Id;
headItem.Sort = maxSortValue + sortindex; headItem.Sort = maxSortValue + sortindex;
headItem.WorkType = item.Id; headItem.WorkType = item.Id;
...@@ -491,13 +493,21 @@ private void SupplyHeaderByWorkItem(UseTempRequest request, SecondResponse resul ...@@ -491,13 +493,21 @@ private void SupplyHeaderByWorkItem(UseTempRequest request, SecondResponse resul
} }
var defauleHeader = new List<ag_workload_type> var defauleHeader = new List<ag_workload_type>
{ {
new ag_workload_type { Id = 2, TypeName = "工作量绩效占比" }, new ag_workload_type { Id = 2, TypeName = "工作量绩效占比", },
new ag_workload_type { Id = 2, TypeName = "工作量分配绩效金额" }, new ag_workload_type { Id = 2, TypeName = "工作量分配绩效金额" },
}; };
foreach (var item in defauleHeader) foreach (var item in defauleHeader)
{ {
result.HeadItems.Where(t => t.FiledName == item.TypeName).ToList()?.ForEach(t => t.WorkType = item.Id); result.HeadItems.Where(t => t.FiledName == item.TypeName).ToList()?.ForEach(t =>
result.BodyItems.Where(t => t.FiledName == item.TypeName).ToList()?.ForEach(t => t.WorkType = item.Id); {
t.WorkType = item.Id;
t.SpecialAttr = item.TypeName.IndexOf("占比") > -1 ? 1 : 2;
});
result.BodyItems.Where(t => t.FiledName == item.TypeName).ToList()?.ForEach(t =>
{
t.WorkType = item.Id;
t.SpecialAttr = item.TypeName.IndexOf("占比") > -1 ? 1 : 2;
});
} }
var rownumber = result.BodyItems.Any(t => t.RowNumber == -1) ? -1 : 0; var rownumber = result.BodyItems.Any(t => t.RowNumber == -1) ? -1 : 0;
......
...@@ -132,18 +132,18 @@ private void CommonExport(int sheetID, SheetExportResponse response) ...@@ -132,18 +132,18 @@ private void CommonExport(int sheetID, SheetExportResponse response)
var factorhead = new Row(0); var factorhead = new Row(0);
if (sheet.SheetType == (int)SheetType.Workload) if (sheet.SheetType == (int)SheetType.Workload)
{ {
factorhead.Data.Add(new Cell(0, "单元工作量绩效标准:", 1, 2, false, false, cellType: "factor")); factorhead.Data.Add(new Cell(0, "单元工作量绩效标准:", 1, 2, false, false, cellType: "header"));
response = AddFactor(response, factorhead, headList.ToList(), dataList); response = AddFactor(response, factorhead, headList.ToList(), dataList);
} }
else if (sheet.SheetType == (int)SheetType.OtherIncome || sheet.SheetType == (int)SheetType.Income || sheet.SheetType == (int)SheetType.Expend) else if (sheet.SheetType == (int)SheetType.OtherIncome || sheet.SheetType == (int)SheetType.Income || sheet.SheetType == (int)SheetType.Expend)
{ {
factorhead.Data.Add(new Cell(0, "护理组分割比例", 1, merge, false, false, cellType: "factor")); factorhead.Data.Add(new Cell(0, "护理组分割比例", 1, merge, false, false, cellType: "header"));
response = AddFactor(response, factorhead, headList.ToList(), dataList, UnitType.护理组); response = AddFactor(response, factorhead, headList.ToList(), dataList, UnitType.护理组);
var factorhead1 = new Row(1); var factorhead1 = new Row(1);
factorhead1.Data.Add(new Cell(0, "医生组分割比例", 1, merge, false, false, cellType: "factor")); factorhead1.Data.Add(new Cell(0, "医生组分割比例", 1, merge, false, false, cellType: "header"));
response = AddFactor(response, factorhead1, headList.ToList(), dataList, UnitType.医生组); response = AddFactor(response, factorhead1, headList.ToList(), dataList, UnitType.医生组);
var factorhead2 = new Row(2); var factorhead2 = new Row(2);
factorhead2.Data.Add(new Cell(0, "医技组分割比例", 1, merge, false, false, cellType: "factor")); factorhead2.Data.Add(new Cell(0, "医技组分割比例", 1, merge, false, false, cellType: "header"));
response = AddFactor(response, factorhead2, headList.ToList(), dataList, UnitType.医技组); response = AddFactor(response, factorhead2, headList.ToList(), dataList, UnitType.医技组);
} }
......
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