diff --git a/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridScheduleService.cs b/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridScheduleService.cs index 1965b546..a229ba97 100644 --- a/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridScheduleService.cs +++ b/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridScheduleService.cs @@ -142,41 +142,41 @@ public class WorkGridScheduleService : IWorkGridScheduleService await _dbContext.InsertAsync(toInserts); await _operateLog.LogAsync(OperateLogType.WorkGrid, $"新增网格({workGrid.Name}){request.Date.ToString("yyyy-M-d")}的{request.PeriodType.GetDescription()}人员:{request.UserCodes.Join(",")}"); - //推送到SAP - var items = toInserts.Select(x => new SyncWorkShiftDayItem - { - UserCode = x.UserCode, - Begin = x.Date.ToString("yyyyMMdd"), - End = x.Date.ToString("yyyyMMdd"), - Plan = request.PeriodType == WorkGridTimePeriodEnumType.Day ? "JK03" : "JK04", - Operate = "INS" - }).ToList(); - - var response = await _jinkoJipApi.SyncWorkShiftAsync(new SyncWorkShiftRequest { Items = items }); - response.Message.IsPresent().ThrowIfTrue("JIP接口返回错误:" + response.Message); - if (response == null || response.Items == null || response.Items.Count == 0) - { - throw new UserFriendlyException("JIP接口返回数据异常,请联系管理员"); - } - - if (response.Items.Any(x => x.Result != "S")) - { - var errorMessages = response.Items.Where(x => x.Result != "S") - .Select(x => $"{x.UserCode}排班新增失败:{x.Message}").Join("\r\n"); - throw new UserFriendlyException(errorMessages); - } - - foreach (var workGridSchedule in toInserts) - { - var msg = response.Items.FirstOrDefault(x => x.UserCode == workGridSchedule.UserCode)?.Message; - await _dbContext.Updateable() - .SetColumns(x => x.SyncResult == msg) - .Where(x => x.WorkGridCode == workGrid.Code) - .Where(x => x.UserCode == workGridSchedule.UserCode) - .Where(x => x.Date == workGridSchedule.Date) - .Where(x => x.PeriodType == workGridSchedule.PeriodType) - .ExecuteCommandAsync(); - } + // //推送到SAP + // var items = toInserts.Select(x => new SyncWorkShiftDayItem + // { + // UserCode = x.UserCode, + // Begin = x.Date.ToString("yyyyMMdd"), + // End = x.Date.ToString("yyyyMMdd"), + // Plan = request.PeriodType == WorkGridTimePeriodEnumType.Day ? "JK03" : "JK04", + // Operate = "INS" + // }).ToList(); + // + // var response = await _jinkoJipApi.SyncWorkShiftAsync(new SyncWorkShiftRequest { Items = items }); + // response.Message.IsPresent().ThrowIfTrue("JIP接口返回错误:" + response.Message); + // if (response == null || response.Items == null || response.Items.Count == 0) + // { + // throw new UserFriendlyException("JIP接口返回数据异常,请联系管理员"); + // } + // + // if (response.Items.Any(x => x.Result != "S")) + // { + // var errorMessages = response.Items.Where(x => x.Result != "S") + // .Select(x => $"{x.UserCode}排班新增失败:{x.Message}").Join("\r\n"); + // throw new UserFriendlyException(errorMessages); + // } + // + // foreach (var workGridSchedule in toInserts) + // { + // var msg = response.Items.FirstOrDefault(x => x.UserCode == workGridSchedule.UserCode)?.Message; + // await _dbContext.Updateable() + // .SetColumns(x => x.SyncResult == msg) + // .Where(x => x.WorkGridCode == workGrid.Code) + // .Where(x => x.UserCode == workGridSchedule.UserCode) + // .Where(x => x.Date == workGridSchedule.Date) + // .Where(x => x.PeriodType == workGridSchedule.PeriodType) + // .ExecuteCommandAsync(); + // } //todo sub pub //推送排班通知 @@ -243,34 +243,34 @@ public class WorkGridScheduleService : IWorkGridScheduleService if (data.Any()) { - //推送到SAP - var items = data.Select(x => new SyncWorkShiftDayItem - { - UserCode = x.UserCode, - Begin = x.Date.ToString("yyyyMMdd"), - End = x.Date.ToString("yyyyMMdd"), - Plan = request.PeriodType == WorkGridTimePeriodEnumType.Day ? "JK03" : "JK04", - Operate = "DEL" - }).ToList(); - - var response = await _jinkoJipApi.SyncWorkShiftAsync(new SyncWorkShiftRequest { Items = items }); - response.Message.IsPresent().ThrowIfTrue("JIP接口返回错误:" + response.Message); - if (response == null || response.Items == null || response.Items.Count == 0) - { - throw new UserFriendlyException("JIP接口返回数据异常,请联系管理员"); - } - - if (response.Items.Any(x => x.Result != "S")) - { - var errorMessages = response.Items.Where(x => x.Result != "S") - .Select(x => $"{x.UserCode}排班删除失败:{x.Message}").Join("\r\n"); - throw new UserFriendlyException(errorMessages); - } - - foreach (var workGridSchedule in data) - { - workGridSchedule.SyncResult = response.Items.FirstOrDefault(x => x.UserCode == workGridSchedule.UserCode)?.Message; - } + // //推送到SAP + // var items = data.Select(x => new SyncWorkShiftDayItem + // { + // UserCode = x.UserCode, + // Begin = x.Date.ToString("yyyyMMdd"), + // End = x.Date.ToString("yyyyMMdd"), + // Plan = request.PeriodType == WorkGridTimePeriodEnumType.Day ? "JK03" : "JK04", + // Operate = "DEL" + // }).ToList(); + // + // var response = await _jinkoJipApi.SyncWorkShiftAsync(new SyncWorkShiftRequest { Items = items }); + // response.Message.IsPresent().ThrowIfTrue("JIP接口返回错误:" + response.Message); + // if (response == null || response.Items == null || response.Items.Count == 0) + // { + // throw new UserFriendlyException("JIP接口返回数据异常,请联系管理员"); + // } + // + // if (response.Items.Any(x => x.Result != "S")) + // { + // var errorMessages = response.Items.Where(x => x.Result != "S") + // .Select(x => $"{x.UserCode}排班删除失败:{x.Message}").Join("\r\n"); + // throw new UserFriendlyException(errorMessages); + // } + // + // foreach (var workGridSchedule in data) + // { + // workGridSchedule.SyncResult = response.Items.FirstOrDefault(x => x.UserCode == workGridSchedule.UserCode)?.Message; + // } await _dbContext.UpdateAsync(data); await _dbContext.DeleteAsync(data);