From 7a63d237063e4633f3597f96a6228de4a4b34e17 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 5 Jun 2024 15:16:59 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=B5=B7=E5=AE=81=E5=82=A8=E8=83=BD?= =?UTF-8?q?=E9=A4=90=E8=A1=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IHainingMealSupplementApi.cs | 9 ++++++ .../Jobs/MealSupplementHandlerJob.cs | 30 ++++++++++++------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/Src/Dlhis.Canteen.Api/IHainingMealSupplementApi.cs b/Src/Dlhis.Canteen.Api/IHainingMealSupplementApi.cs index a936980a..294967fd 100644 --- a/Src/Dlhis.Canteen.Api/IHainingMealSupplementApi.cs +++ b/Src/Dlhis.Canteen.Api/IHainingMealSupplementApi.cs @@ -17,4 +17,13 @@ public interface IHainingMealSupplementApi /// [Post("/jingke/api/canteen/InputCredit")] Task> AddMealSupplementAsync(AddHainingMealSupplementRequest request); + + + /// + /// 海宁储能 + /// + /// + /// + [Post("/jschuneng/api/canteen/InputCredit")] + Task> AddHsChuNengMealSupplementAsync(AddHainingMealSupplementRequest request); } diff --git a/Src/Dlhis.ScheduledTask/Jobs/MealSupplementHandlerJob.cs b/Src/Dlhis.ScheduledTask/Jobs/MealSupplementHandlerJob.cs index be2264e2..bea803ac 100644 --- a/Src/Dlhis.ScheduledTask/Jobs/MealSupplementHandlerJob.cs +++ b/Src/Dlhis.ScheduledTask/Jobs/MealSupplementHandlerJob.cs @@ -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,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(); try { - var hnResponse = await _hainingMealSupplementApi.AddMealSupplementAsync(new AddHainingMealSupplementRequest - { - Code = mealSupplement.Code, - Amount = mealSupplement.Amount, - Date = mealSupplement.Date.Date, - Remark = mealSupplement.Remark, - UniqueId = mealSupplement.UniqueId, - }); + var hnResponse = isChuneng + ? 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);