|
|
@ -1,4 +1,12 @@ |
|
|
|
using TaskManager.Entity.Entitys; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
using Microsoft.EntityFrameworkCore.Storage; |
|
|
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
|
|
|
using Org.BouncyCastle.Bcpg.Sig; |
|
|
|
using SkiaSharp; |
|
|
|
using System.Xml; |
|
|
|
using TaskManager.Entity; |
|
|
|
using TaskManager.Entity.Entitys; |
|
|
|
using TaskManager.EntityFramework; |
|
|
|
|
|
|
|
namespace TaskManager.Controllers |
|
|
@ -8,5 +16,62 @@ namespace TaskManager.Controllers |
|
|
|
public CherySupplierConMmrpService(HttpClient httpClient, JobDbContext jobDbContext, LogController log, IRepository<SUPPLIER_CON_MMRP> repository) : base(httpClient, jobDbContext, log, repository) |
|
|
|
{ |
|
|
|
} |
|
|
|
/// <summary>
|
|
|
|
/// 审批通过
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="entites"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
public async Task<ActionResult> Confirm([FromBody] List<SUPPLIER_CON_MMRP> entites) |
|
|
|
{ |
|
|
|
|
|
|
|
var taskId = Guid.NewGuid(); |
|
|
|
var task = new TaskSub(); |
|
|
|
task.TaskId = taskId; |
|
|
|
task.TaskName = TaskName; |
|
|
|
task.Subscriber = Client; |
|
|
|
task.TableName = "SUPPLIER_CON_MMRP"; |
|
|
|
task.DataCount = entites.Count; |
|
|
|
task.Domain = "1"; |
|
|
|
task.Site = "1"; |
|
|
|
task.FailedCount = 0; |
|
|
|
task.CreateTime = DateTime.Now; |
|
|
|
task.CreateUser = "admin"; |
|
|
|
task.CreationTime = DateTime.Now; |
|
|
|
task.SyncedPageCount = 0; |
|
|
|
|
|
|
|
entites.ForEach(p => |
|
|
|
{ |
|
|
|
p.ReadState = true; |
|
|
|
p.TaskId = taskId; |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
using (var transaction = await _jobDbContext.Database.BeginTransactionAsync()) |
|
|
|
{ |
|
|
|
var tran = transaction.GetDbTransaction(); |
|
|
|
try |
|
|
|
{ |
|
|
|
await _jobDbContext.BulkUpdateAsync(entites, options => { options.Transaction = tran; }); |
|
|
|
await _jobDbContext.AddAsync(task); |
|
|
|
_jobDbContext.SaveChanges(); |
|
|
|
|
|
|
|
// 提交事务
|
|
|
|
await transaction.CommitAsync(); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
await transaction.RollbackAsync(); |
|
|
|
new JsonResult(new { Code = 400, Message = ex.Message }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return new JsonResult(new { Code = 200, Message = "修改成功!" }); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|