fix 海宁储能餐补

This commit is contained in:
2024-06-05 15:16:59 +08:00
parent 582393e45d
commit 7a63d23706
2 changed files with 29 additions and 10 deletions

View File

@@ -17,4 +17,13 @@ public interface IHainingMealSupplementApi
/// <returns></returns> /// <returns></returns>
[Post("/jingke/api/canteen/InputCredit")] [Post("/jingke/api/canteen/InputCredit")]
Task<HainingResponse<object>> AddMealSupplementAsync(AddHainingMealSupplementRequest request); Task<HainingResponse<object>> AddMealSupplementAsync(AddHainingMealSupplementRequest request);
/// <summary>
/// 海宁储能
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[Post("/jschuneng/api/canteen/InputCredit")]
Task<HainingResponse<object>> AddHsChuNengMealSupplementAsync(AddHainingMealSupplementRequest request);
} }

View File

@@ -110,7 +110,8 @@ public class MealSupplementHandlerJob : BaseJob
if (item.Workplace == "5") if (item.Workplace == "5")
{ {
await SetHainingMealSupplementAsync(item); var isChunneng = item.Factory == "501";
await SetHainingMealSupplementAsync(isChunneng, item);
} }
else else
{ {
@@ -205,19 +206,28 @@ public class MealSupplementHandlerJob : BaseJob
} }
} }
private async Task SetHainingMealSupplementAsync(MealSupplementRecordEntity mealSupplement) private async Task SetHainingMealSupplementAsync(bool isChuneng, MealSupplementRecordEntity mealSupplement)
{ {
await DbContext.Client.Ado.BeginTranAsync(); await DbContext.Client.Ado.BeginTranAsync();
try try
{ {
var hnResponse = await _hainingMealSupplementApi.AddMealSupplementAsync(new AddHainingMealSupplementRequest var hnResponse = isChuneng
{ ? await _hainingMealSupplementApi.AddHsChuNengMealSupplementAsync(new AddHainingMealSupplementRequest
Code = mealSupplement.Code, {
Amount = mealSupplement.Amount, Code = mealSupplement.Code,
Date = mealSupplement.Date.Date, Amount = mealSupplement.Amount,
Remark = mealSupplement.Remark, Date = mealSupplement.Date.Date,
UniqueId = mealSupplement.UniqueId, 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); (hnResponse == null || hnResponse.Code != 200).ThrowIfTrue("海宁餐补写入失败:" + hnResponse?.Message);