fix .
This commit is contained in:
@@ -93,7 +93,7 @@ public class MealSupplementRecordService : IMealSupplementRecordService
|
||||
var data = await _dbContext.Queryable<BalanceRecordEntity>()
|
||||
.Where(x => x.CostDateTime >= request.SearchDateTimePeriod.Start && x.CostDateTime <= request.SearchDateTimePeriod.End)
|
||||
.Where(x => x.Status == BalanceRecordStatusEnumType.Valid)
|
||||
.Where(x => x.ApplicationType == CanteenApplicationTypeEnumType.MealSupplement)
|
||||
.Where(x => x.ApplicationType == CanteenApplicationTypeEnumType.MealSupplement || x.ApplicationType == CanteenApplicationTypeEnumType.Manually)
|
||||
.Where(x => x.UserCode == code)
|
||||
.OrderBy(x => x.CostDateTime)
|
||||
.Select(x => new MealSupplementRecordItemResponse
|
||||
|
||||
@@ -9,6 +9,7 @@ using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.Canteen.Order.Controllers;
|
||||
|
||||
@@ -216,10 +217,14 @@ public class BalancesController : ControllerBase
|
||||
using (var scope = _serviceProvider.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetService<IDbContext>();
|
||||
var codes = await db.Queryable<MealSupplementRecordEntity>().Where(x => x.Amount < 0 && x.Workplace == "5").Select(x => x.Code).Distinct().ToListAsync();
|
||||
foreach (var code in codes)
|
||||
var middleService = scope.ServiceProvider.GetService<IMiddleService>();
|
||||
var others = await db.Queryable<BalanceRecordEntity>().AS("LocalBalanceRecordEntity")
|
||||
.Where(x => SqlFunc.Subqueryable<BalanceRecordEntity>().Where(p => p.No == x.No).NotAny())
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var item in others)
|
||||
{
|
||||
await _balanceService.ReCalcAsync(code);
|
||||
await middleService.MiddleUploadAsync(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,11 @@ public class OrderAddRequest : IValidatableObject
|
||||
|
||||
CostDateTime ??= DateTime.Now;
|
||||
|
||||
if (!IsOffline)
|
||||
{
|
||||
(CostDateTime.Value.AddMinutes(5) < DateTime.Now).ThrowIfTrue("非法请求,时差超出允许范围");
|
||||
}
|
||||
|
||||
if (DeviceUniqueNo.IsEmpty())
|
||||
{
|
||||
yield return new ValidationResult("设备号不能为空", new[] { nameof(DeviceUniqueNo) });
|
||||
|
||||
@@ -1,164 +1,164 @@
|
||||
using Dlhis.Canteen.Api;
|
||||
using Dlhis.Canteen.Api.Request;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Dlhis.ScheduledTask.Attributes;
|
||||
using Dlhis.ScheduledTask.Common.Request;
|
||||
using Dlhis.ScheduledTask.Common.Services;
|
||||
using Hangfire;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.ScheduledTask.Jobs;
|
||||
|
||||
/// <summary>
|
||||
/// 餐补核算
|
||||
/// </summary>
|
||||
[RecurringJob(nameof(MealChunengSupplementHandlerJob), "0 0/30 * * * ?", Name = "储能餐补核算")]
|
||||
public class MealChunengSupplementHandlerJob : BaseJob
|
||||
{
|
||||
private readonly IHainingMealSupplementApi _hainingMealSupplementApi;
|
||||
private readonly IJinkoJIPService _jinkoJIPService;
|
||||
|
||||
public MealChunengSupplementHandlerJob(IServiceProvider serviceProvider,
|
||||
IHainingMealSupplementApi hainingMealSupplementApi,
|
||||
IJinkoJIPService jinkoJIPService) : base(serviceProvider)
|
||||
{
|
||||
_hainingMealSupplementApi = hainingMealSupplementApi;
|
||||
_jinkoJIPService = jinkoJIPService;
|
||||
}
|
||||
|
||||
protected override async Task RunAsync(IServiceProvider serviceProvider)
|
||||
{
|
||||
//查询待处理餐补
|
||||
var mealSupplements = await DbContext.Queryable<MealSupplementRecordEntity>()
|
||||
.Where(x => x.Status == MealSupplementStatusEnumtype.Wait || x.Status == MealSupplementStatusEnumtype.Error)
|
||||
.Where(x => x.Workplace == "5" && x.Factory == "501")//储能
|
||||
.Where(x => !x.Sync)
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var item in mealSupplements)
|
||||
{
|
||||
var gainfo = await DbContext.Queryable<GainfoEntity>().Where(x => x.Code == item.Code).SingleAsync();
|
||||
if (gainfo == null)
|
||||
{
|
||||
gainfo = await DbContext.Queryable<GainfoEntity>().AS("GainfoLeave").Where(x => x.Code == item.Code).SingleAsync();
|
||||
|
||||
if (gainfo == null)
|
||||
{
|
||||
await DbContext.Updateable<MealSupplementRecordEntity>()
|
||||
.SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error)
|
||||
.SetColumns(x => x.Result == "人员档案不存在")
|
||||
.SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||
.Where(x => x.UniqueId == item.UniqueId)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
//后台任务获取人员
|
||||
BackgroundJob.Enqueue<IGainfoUpdateService>(x => x.TodoByCodeAsync(item.Code));
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (gainfo.ResignationDate < item.Date)
|
||||
{
|
||||
try
|
||||
{
|
||||
var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
|
||||
{
|
||||
new()
|
||||
{
|
||||
UniqueId = item.UniqueId,
|
||||
Status = "FAIL",
|
||||
Msg = "人员离职"
|
||||
}
|
||||
});
|
||||
|
||||
await DbContext.Updateable<MealSupplementRecordEntity>()
|
||||
.SetColumns(x => x.Result == r)
|
||||
.SetColumns(x => x.Status == MealSupplementStatusEnumtype.Success)
|
||||
.SetColumns(x => x.Sync == true)
|
||||
.SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||
.Where(x => x.UniqueId == item.UniqueId)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//创建余额数据
|
||||
var mealUser = await DbContext.Queryable<GainfoMealEntity>().Where(x => x.UserCode == gainfo.Code).SingleAsync();
|
||||
if (mealUser == null)
|
||||
{
|
||||
mealUser = new GainfoMealEntity
|
||||
{
|
||||
Balance = 0,
|
||||
BalanceOfRecharge = 0,
|
||||
BalanceOfSubsidies = 0,
|
||||
UserCode = gainfo.Code,
|
||||
Version = 0,
|
||||
};
|
||||
|
||||
await DbContext.InsertAsync(mealUser);
|
||||
}
|
||||
|
||||
await SetHainingMealSupplementAsync(item);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SetHainingMealSupplementAsync(MealSupplementRecordEntity mealSupplement)
|
||||
{
|
||||
await DbContext.Client.Ado.BeginTranAsync();
|
||||
try
|
||||
{
|
||||
var hnResponse = await _hainingMealSupplementApi.AddHsChuNengMealSupplementAsync(new AddHainingMealSupplementRequest
|
||||
{
|
||||
Code = mealSupplement.Code,
|
||||
Amount = mealSupplement.Amount,
|
||||
Date = mealSupplement.Date.Date,
|
||||
Remark = mealSupplement.Remark,
|
||||
UniqueId = mealSupplement.UniqueId
|
||||
});
|
||||
|
||||
(hnResponse == null || hnResponse.Code != 200).ThrowIfTrue("海宁餐补写入失败:" + hnResponse?.Message);
|
||||
|
||||
var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
|
||||
{
|
||||
new()
|
||||
{
|
||||
UniqueId = mealSupplement.UniqueId,
|
||||
Status = "SUCCESS",
|
||||
Msg = "操作成功"
|
||||
}
|
||||
});
|
||||
|
||||
//更新餐补信息为成功(同步成功)
|
||||
await DbContext.Updateable<MealSupplementRecordEntity>()
|
||||
.SetColumns(x => x.Result == r)
|
||||
.SetColumns(x => x.Status == MealSupplementStatusEnumtype.Success)
|
||||
.SetColumns(x => x.Sync == true)
|
||||
.SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||
.Where(x => x.UniqueId == mealSupplement.UniqueId)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
await DbContext.Client.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await DbContext.Client.Ado.RollbackTranAsync();
|
||||
|
||||
await DbContext.Updateable<MealSupplementRecordEntity>()
|
||||
.SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error)
|
||||
.SetColumns(x => x.Result == ex.Message + " " + ex.StackTrace)
|
||||
.SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||
.Where(x => x.UniqueId == mealSupplement.UniqueId)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
// using Dlhis.Canteen.Api;
|
||||
// using Dlhis.Canteen.Api.Request;
|
||||
// using Dlhis.Entity.Basic.Entity;
|
||||
// using Dlhis.Entity.Basic.Enums;
|
||||
// using Dlhis.Entity.Canteen.Entities;
|
||||
// using Dlhis.Entity.Canteen.Enums;
|
||||
// using Dlhis.ScheduledTask.Attributes;
|
||||
// using Dlhis.ScheduledTask.Common.Request;
|
||||
// using Dlhis.ScheduledTask.Common.Services;
|
||||
// using Hangfire;
|
||||
// using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
// using Kurisu.AspNetCore.Utils;
|
||||
// using Kurisu.AspNetCore.Utils.Extensions;
|
||||
//
|
||||
// namespace Dlhis.ScheduledTask.Jobs;
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 餐补核算
|
||||
// /// </summary>
|
||||
// [RecurringJob(nameof(MealChunengSupplementHandlerJob), "0 0/30 * * * ?", Name = "储能餐补核算")]
|
||||
// public class MealChunengSupplementHandlerJob : BaseJob
|
||||
// {
|
||||
// private readonly IHainingMealSupplementApi _hainingMealSupplementApi;
|
||||
// private readonly IJinkoJIPService _jinkoJIPService;
|
||||
//
|
||||
// public MealChunengSupplementHandlerJob(IServiceProvider serviceProvider,
|
||||
// IHainingMealSupplementApi hainingMealSupplementApi,
|
||||
// IJinkoJIPService jinkoJIPService) : base(serviceProvider)
|
||||
// {
|
||||
// _hainingMealSupplementApi = hainingMealSupplementApi;
|
||||
// _jinkoJIPService = jinkoJIPService;
|
||||
// }
|
||||
//
|
||||
// protected override async Task RunAsync(IServiceProvider serviceProvider)
|
||||
// {
|
||||
// //查询待处理餐补
|
||||
// var mealSupplements = await DbContext.Queryable<MealSupplementRecordEntity>()
|
||||
// .Where(x => x.Status == MealSupplementStatusEnumtype.Wait || x.Status == MealSupplementStatusEnumtype.Error)
|
||||
// .Where(x => x.Workplace == "5" && x.Factory == "501")//储能
|
||||
// .Where(x => !x.Sync)
|
||||
// .ToListAsync();
|
||||
//
|
||||
// foreach (var item in mealSupplements)
|
||||
// {
|
||||
// var gainfo = await DbContext.Queryable<GainfoEntity>().Where(x => x.Code == item.Code).SingleAsync();
|
||||
// if (gainfo == null)
|
||||
// {
|
||||
// gainfo = await DbContext.Queryable<GainfoEntity>().AS("GainfoLeave").Where(x => x.Code == item.Code).SingleAsync();
|
||||
//
|
||||
// if (gainfo == null)
|
||||
// {
|
||||
// await DbContext.Updateable<MealSupplementRecordEntity>()
|
||||
// .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error)
|
||||
// .SetColumns(x => x.Result == "人员档案不存在")
|
||||
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||
// .Where(x => x.UniqueId == item.UniqueId)
|
||||
// .ExecuteCommandAsync();
|
||||
//
|
||||
// //后台任务获取人员
|
||||
// BackgroundJob.Enqueue<IGainfoUpdateService>(x => x.TodoByCodeAsync(item.Code));
|
||||
//
|
||||
// continue;
|
||||
// }
|
||||
// else if (gainfo.ResignationDate < item.Date)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
|
||||
// {
|
||||
// new()
|
||||
// {
|
||||
// UniqueId = item.UniqueId,
|
||||
// Status = "FAIL",
|
||||
// Msg = "人员离职"
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// await DbContext.Updateable<MealSupplementRecordEntity>()
|
||||
// .SetColumns(x => x.Result == r)
|
||||
// .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Success)
|
||||
// .SetColumns(x => x.Sync == true)
|
||||
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||
// .Where(x => x.UniqueId == item.UniqueId)
|
||||
// .ExecuteCommandAsync();
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //创建余额数据
|
||||
// var mealUser = await DbContext.Queryable<GainfoMealEntity>().Where(x => x.UserCode == gainfo.Code).SingleAsync();
|
||||
// if (mealUser == null)
|
||||
// {
|
||||
// mealUser = new GainfoMealEntity
|
||||
// {
|
||||
// Balance = 0,
|
||||
// BalanceOfRecharge = 0,
|
||||
// BalanceOfSubsidies = 0,
|
||||
// UserCode = gainfo.Code,
|
||||
// Version = 0,
|
||||
// };
|
||||
//
|
||||
// await DbContext.InsertAsync(mealUser);
|
||||
// }
|
||||
//
|
||||
// await SetHainingMealSupplementAsync(item);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private async Task SetHainingMealSupplementAsync(MealSupplementRecordEntity mealSupplement)
|
||||
// {
|
||||
// await DbContext.Client.Ado.BeginTranAsync();
|
||||
// try
|
||||
// {
|
||||
// var hnResponse = await _hainingMealSupplementApi.AddHsChuNengMealSupplementAsync(new AddHainingMealSupplementRequest
|
||||
// {
|
||||
// Code = mealSupplement.Code,
|
||||
// Amount = mealSupplement.Amount,
|
||||
// Date = mealSupplement.Date.Date,
|
||||
// Remark = mealSupplement.Remark,
|
||||
// UniqueId = mealSupplement.UniqueId
|
||||
// });
|
||||
//
|
||||
// (hnResponse == null || hnResponse.Code != 200).ThrowIfTrue("海宁餐补写入失败:" + hnResponse?.Message);
|
||||
//
|
||||
// var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
|
||||
// {
|
||||
// new()
|
||||
// {
|
||||
// UniqueId = mealSupplement.UniqueId,
|
||||
// Status = "SUCCESS",
|
||||
// Msg = "操作成功"
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// //更新餐补信息为成功(同步成功)
|
||||
// await DbContext.Updateable<MealSupplementRecordEntity>()
|
||||
// .SetColumns(x => x.Result == r)
|
||||
// .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Success)
|
||||
// .SetColumns(x => x.Sync == true)
|
||||
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||
// .Where(x => x.UniqueId == mealSupplement.UniqueId)
|
||||
// .ExecuteCommandAsync();
|
||||
//
|
||||
// await DbContext.Client.Ado.CommitTranAsync();
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// await DbContext.Client.Ado.RollbackTranAsync();
|
||||
//
|
||||
// await DbContext.Updateable<MealSupplementRecordEntity>()
|
||||
// .SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error)
|
||||
// .SetColumns(x => x.Result == ex.Message + " " + ex.StackTrace)
|
||||
// .SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||
// .Where(x => x.UniqueId == mealSupplement.UniqueId)
|
||||
// .ExecuteCommandAsync();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -61,7 +61,8 @@ public class MealHainingSupplementHandlerJob : BaseJob
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (gainfo.ResignationDate < item.Date)
|
||||
|
||||
if (gainfo.ResignationDate < item.Date)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Dlhis.Canteen.Api;
|
||||
using Dlhis.Canteen.Api.Request;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
@@ -10,7 +8,6 @@ using Dlhis.ScheduledTask.Common.Services;
|
||||
using Hangfire;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
|
||||
namespace Dlhis.ScheduledTask.Jobs;
|
||||
|
||||
@@ -20,23 +17,22 @@ namespace Dlhis.ScheduledTask.Jobs;
|
||||
[RecurringJob(nameof(MealSupplementHandlerJob), "0 0/30 * * * ?", Name = "餐补核算")]
|
||||
public class MealSupplementHandlerJob : BaseJob
|
||||
{
|
||||
private readonly IHainingMealSupplementApi _hainingMealSupplementApi;
|
||||
private readonly IJinkoJIPService _jinkoJIPService;
|
||||
|
||||
public MealSupplementHandlerJob(IServiceProvider serviceProvider,
|
||||
IHainingMealSupplementApi hainingMealSupplementApi,
|
||||
IJinkoJIPService jinkoJIPService) : base(serviceProvider)
|
||||
{
|
||||
_hainingMealSupplementApi = hainingMealSupplementApi;
|
||||
_jinkoJIPService = jinkoJIPService;
|
||||
}
|
||||
|
||||
protected override async Task RunAsync(IServiceProvider serviceProvider)
|
||||
{
|
||||
var others = new[] { "502", "503", "504", "505" };
|
||||
|
||||
//查询待处理餐补
|
||||
var mealSupplements = await DbContext.Queryable<MealSupplementRecordEntity>()
|
||||
.Where(x => x.Status == MealSupplementStatusEnumtype.Wait || x.Status == MealSupplementStatusEnumtype.Error)
|
||||
.Where(x => x.Workplace != "5")
|
||||
.Where(x => !others.Contains(x.Factory))
|
||||
.Where(x => !x.Sync)
|
||||
.ToListAsync();
|
||||
|
||||
@@ -61,7 +57,8 @@ public class MealSupplementHandlerJob : BaseJob
|
||||
|
||||
continue;
|
||||
}
|
||||
else if (gainfo.ResignationDate < item.Date)
|
||||
|
||||
if (gainfo.ResignationDate < item.Date)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -108,16 +105,9 @@ public class MealSupplementHandlerJob : BaseJob
|
||||
await DbContext.InsertAsync(mealUser);
|
||||
}
|
||||
|
||||
if (item.Workplace == "5")
|
||||
{
|
||||
await SetHainingMealSupplementAsync(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
await SetMealSupplementAsync(gainfo, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SetMealSupplementAsync(GainfoEntity gainfo, MealSupplementRecordEntity mealSupplement)
|
||||
{
|
||||
@@ -198,63 +188,4 @@ public class MealSupplementHandlerJob : BaseJob
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SetHainingMealSupplementAsync(MealSupplementRecordEntity mealSupplement)
|
||||
{
|
||||
await DbContext.Client.Ado.BeginTranAsync();
|
||||
try
|
||||
{
|
||||
var hnResponse = mealSupplement.Factory == "501"
|
||||
? await _hainingMealSupplementApi.AddHsChuNengMealSupplementAsync(new AddHainingMealSupplementRequest
|
||||
{
|
||||
Code = mealSupplement.Code,
|
||||
Amount = mealSupplement.Amount,
|
||||
Date = mealSupplement.Date.Date,
|
||||
Remark = mealSupplement.Remark,
|
||||
UniqueId = mealSupplement.UniqueId
|
||||
})
|
||||
: await _hainingMealSupplementApi.AddMealSupplementAsync(new AddHainingMealSupplementRequest
|
||||
{
|
||||
Code = mealSupplement.Code,
|
||||
Amount = mealSupplement.Amount,
|
||||
Date = mealSupplement.Date.Date,
|
||||
Remark = mealSupplement.Remark,
|
||||
UniqueId = mealSupplement.UniqueId
|
||||
});
|
||||
|
||||
(hnResponse == null || hnResponse.Code != 200).ThrowIfTrue("海宁餐补写入失败:" + hnResponse?.Message);
|
||||
|
||||
var r = await _jinkoJIPService.SyncMealSupplementRecordsAsync(new List<SyncMealSupplementRecordRequest>
|
||||
{
|
||||
new()
|
||||
{
|
||||
UniqueId = mealSupplement.UniqueId,
|
||||
Status = "SUCCESS",
|
||||
Msg = "操作成功"
|
||||
}
|
||||
});
|
||||
|
||||
//更新餐补信息为成功(同步成功)
|
||||
await DbContext.Updateable<MealSupplementRecordEntity>()
|
||||
.SetColumns(x => x.Result == r)
|
||||
.SetColumns(x => x.Status == MealSupplementStatusEnumtype.Success)
|
||||
.SetColumns(x => x.Sync == true)
|
||||
.SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||
.Where(x => x.UniqueId == mealSupplement.UniqueId)
|
||||
.ExecuteCommandAsync();
|
||||
|
||||
await DbContext.Client.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await DbContext.Client.Ado.RollbackTranAsync();
|
||||
|
||||
await DbContext.Updateable<MealSupplementRecordEntity>()
|
||||
.SetColumns(x => x.Status == MealSupplementStatusEnumtype.Error)
|
||||
.SetColumns(x => x.Result == ex.Message + " " + ex.StackTrace)
|
||||
.SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||
.Where(x => x.UniqueId == mealSupplement.UniqueId)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user