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>
[Post("/jingke/api/canteen/InputCredit")]
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")
{
await SetHainingMealSupplementAsync(item);
var isChunneng = item.Factory == "501";
await SetHainingMealSupplementAsync(isChunneng, item);
}
else
{
@@ -205,18 +206,27 @@ public class MealSupplementHandlerJob : BaseJob
}
}
private async Task SetHainingMealSupplementAsync(MealSupplementRecordEntity mealSupplement)
private async Task SetHainingMealSupplementAsync(bool isChuneng, MealSupplementRecordEntity mealSupplement)
{
await DbContext.Client.Ado.BeginTranAsync();
try
{
var hnResponse = await _hainingMealSupplementApi.AddMealSupplementAsync(new AddHainingMealSupplementRequest
var hnResponse = isChuneng
? await _hainingMealSupplementApi.AddHsChuNengMealSupplementAsync(new AddHainingMealSupplementRequest
{
Code = mealSupplement.Code,
Amount = mealSupplement.Amount,
Date = mealSupplement.Date.Date,
Remark = mealSupplement.Remark,
UniqueId = mealSupplement.UniqueId,
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);