bug
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.VisualDev;
|
||||
@@ -19,6 +20,7 @@ using Tnb.ProductionMgr.Interfaces;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Tnb.BasicData;
|
||||
using JNPF.Common.Extension;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -43,7 +45,9 @@ namespace Tnb.ProductionMgr
|
||||
_runService = runService;
|
||||
_visualDevService = visualDevService;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
OverideFuncs.UpdateAsync = AddRecord;
|
||||
_dictionaryDataService = dictionaryDataService;
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,5 +80,39 @@ namespace Tnb.ProductionMgr
|
||||
//}
|
||||
return data!;
|
||||
}
|
||||
|
||||
private async Task<dynamic> AddRecord(string id,VisualDevModelDataUpInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
List<PrdReport> prdReports = new List<PrdReport>();
|
||||
foreach (var item in (JArray)input.data["tablefield107"])
|
||||
{
|
||||
if (item["id"] == null)
|
||||
{
|
||||
prdReports.Add(new PrdReport()
|
||||
{
|
||||
mo_task_id = input.data["mo_task_id"]?.ToString(),
|
||||
mo_task_code = input.data["mo_task_code"]?.ToString(),
|
||||
reported_qty = (int)item["reported_qty"],
|
||||
create_id = item["create_id"]?.ToString(),
|
||||
create_time = DateTime.Now,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
await db.Insertable<PrdReport>(prdReports).ExecuteCommandAsync();
|
||||
|
||||
int? sum = prdReports.Sum(x => x.reported_qty);
|
||||
await db.Updateable<PrdReportRecord>()
|
||||
.SetColumns(x => x.completed_qty == x.completed_qty + sum)
|
||||
.SetColumns(x => x.reported_work_qty == x.reported_work_qty + sum)
|
||||
.Where(x => x.id == input.data["id"].ToString()).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
|
||||
return result.IsSuccess;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user