wankeda
2 天以前 6cc35000a6e138cfad96e7b02f8aeddcdb4ba6bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
#region << 版 本 注 释 >>
 
/*----------------------------------------------------------------
 * 命名空间:WIDESEAWCS_TaskInfoService
 * 创建者:胡童庆
 * 创建时间:2024/8/2 16:13:36
 * 版本:V1.0.0
 * 描述:
 *
 * ----------------------------------------------------------------
 * 修改人:
 * 修改时间:
 * 版本:V1.0.1
 * 修改说明:
 *
 *----------------------------------------------------------------*/
 
#endregion << 版 本 注 释 >>
 
using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
using System.Text.Json;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_ISystemServices;
using WIDESEAWCS_ISystemRepository;
using WIDESEA_Common;
using WIDESEA_Core.Enums;
using SqlSugar.Extensions;
using System.Threading.Tasks;
using System.Reflection.Emit;
using WIDESEAWCS_Core.Enums;
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Numeric;
using WIDESEAWCS_Core.Tool;
using System.Net;
namespace WIDESEAWCS_TaskInfoService
{
    public class TaskCZService : ServiceBase<DtCZTask, ITaskCZRepository>, ITaskCZService
    {
        private readonly ITaskRepository _taskRepository;
        private readonly ITaskService _taskService;
        private readonly ITaskCZDetailsRepository _detailsRepository;
        private readonly IDt_StationinfoRepository _stationinfoRepository;
        private readonly ITaskHtyRepository _taskHtyRepository;
        private readonly ITaskHtyService _taskHtyService;
 
        public TaskCZService(ITaskCZRepository BaseDal, ITaskHtyService taskHtyService, ITaskHtyRepository taskHtyRepository, IDt_StationinfoRepository stationinfoRepository, ITaskService taskService, ITaskRepository taskRepository, ITaskCZDetailsRepository detailsRepository) : base(BaseDal)
        {
            _taskRepository = taskRepository;
            _detailsRepository = detailsRepository;
            _taskService = taskService;
            _stationinfoRepository = stationinfoRepository;
            _taskHtyRepository = taskHtyRepository;
            _taskHtyService = taskHtyService;
        }
 
        public Task<WebResponseContent> AddTaskCZAsync(CZTaskDto dto)
        {
            var response = new WebResponseContent();
            try
            {
                var task = BaseDal.QueryFirst(x => (x.TaskTaskID == dto.DTaskId) || (x.TaskEndAddress == dto.InputValue) || (x.TaskType == dto.TaskType));
                if (task != null)
                {
                    response.Error("任务已存在,请勿重复添加!");
                }
                var taskModel = new DtCZTask()
                {
                    TaskTaskID = dto.DTaskId,
                    TaskType = dto.TaskType,
                    TaskEndAddress = dto.InputValue,
                    TaskStatus = TaskInStatusEnum.InNew.ToString(),
                    CreateDate = DateTime.Now,
                    TaskStartDate = DateTime.Now,
                    TaskEndDate = DateTime.Now.AddDays(1),
                    TaskName = dto.TaskType.ToString(),
                    TaskNumber = dto.Number,
                    TaskExecutor = "CZ",
                    TaskOrderNo = dto.OrderNo,
                    TaskOwner = "KH",
                    TaskProductCode = dto.ProductCode,
                    Creater = "KH"
                };
                var isTrue = BaseDal.AddData(taskModel) > 0;
                if (isTrue)
                    response.OK("任务添加成功!");
                else
                    response.Error("任务添加失败!");
            }
            catch (System.Exception ex)
            {
                response.Error(ex.Message);
            }
            return Task.FromResult(response);
        }
 
        /// <summary>
        /// 完成任务
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public Task<WebResponseContent> FinishTask(CZTaskFinshDto dto)
        {
            WebResponseContent response = new WebResponseContent();
            try
            {
                //ConsoleHelper.WriteErrorLine($"{nameof(dto.TaskId)}");
                WriteLog.Info("任务完成").Write($"任务号{dto.TaskId}", "任务完成");
                if (dto.Floor == 1)
                {
                    var czTask = BaseDal.QueryFirst(x => x.TaskTaskID == dto.TaskId);
                    if (czTask == null)
                    {
                        response.Error("任务不存在!");
                        return Task.FromResult(response);
                    }
                    //if (dto.Tags.Contains("正极"))
                    //{
                    //    czTask.TaskZJFinishNumber += 1;
                    //}
                    //else
                    //{
                    //    czTask.TaskFJFinishNumber += 1;
                    //}
                    //if (czTask.TaskZJFinishNumber == czTask.TaskNumber || czTask.TaskFJFinishNumber == czTask.TaskNumber)
                    //{
                    //    czTask.TaskStatus = TaskInStatusEnum.InFinish.ToString();
                    //    czTask.TaskEndDate = DateTime.Now;
                    //}
                    //else
                    //{
                    czTask.TaskStatus = TaskInStatusEnum.Line_InExecuting.ToString();
                    //}
 
                    var details = new DtCZTaskDetails()
                    {
                        MaterialBarCode = dto.MaterialBarcode,
                        MaterialType = dto.ProductCode,
                        TaskDescription = "创智提交任务完成",
                        TaskEndAddress = czTask.TaskEndAddress,
                        TaskName = czTask.TaskName,
                        TaskType = czTask.TaskType,
                        TaskStatus = czTask.TaskStatus,
                        TaskTaskID = czTask.TaskTaskID,
                    };
                    _detailsRepository.AddData(details);
 
                    //if (dto.FinishNum is < 1 or > 4)
                    //    throw new ArgumentException("参数错误!FinishNum 必须为 1-4");
 
                    //var detail = dto.FinishNum == 1
                    //    ? new CZTaskBarCodeDto()
                    //    : JsonSerializer.Deserialize<CZTaskBarCodeDto>(czTask.DtCZTaskDetails) ?? new CZTaskBarCodeDto();
 
                    //var property = dto.FinishNum switch
                    //{
                    //    1 => nameof(CZTaskBarCodeDto.BarCode1),
                    //    2 => nameof(CZTaskBarCodeDto.BarCode2),
                    //    3 => nameof(CZTaskBarCodeDto.BarCode3),
                    //    4 => nameof(CZTaskBarCodeDto.BarCode4),
                    //    _ => throw new ArgumentOutOfRangeException("参数错误!请检查【FinishNum】!")
                    //};
 
                    //typeof(CZTaskBarCodeDto).GetProperty(property)?.SetValue(detail, dto.MaterialBarcode);
 
                    //czTask.DtCZTaskDetails = JsonSerializer.Serialize(detail);
 
                    var isTrue = BaseDal.UpdateData(czTask);
                    if (isTrue)
                    {
                        response.OK("任务完成成功!");
                    }
                    else
                    {
                        response.Error("任务完成失败!");
                    }
                }
                else
                {
                    Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == dto.TaskId.ObjToInt());
                    if (task == null)
                    {
                        response.Error("任务不存在!");
                        return Task.FromResult(response);
                    }
                    WriteLog.Info("1").Write($"任务号{task.TaskNum}", "1");
                    task.TaskState = TaskInStatusEnum.AGV_InFinish.ObjToInt();
                    if (task.SourceAddress.Contains("SL-0"))
                    {
                        var address = task.SourceAddress.Split("||");
                        WriteLog.Info("1").Write($"{address}", "1");
                        Dt_Stationinfo Stationinfo = _stationinfoRepository.QueryFirst(x => x.StationCode == address[0]);
                        WriteLog.Info("1").Write($"{Stationinfo.StationCode}", "1");
                        Dt_Stationinfo Stationinfo1 = _stationinfoRepository.QueryFirst(x => x.StationCode == address[1]);
                        WriteLog.Info("1").Write($"{Stationinfo.StationCode}", "1");
                        Stationinfo.Location_state = LocationStatusEnum.Free.ObjToInt();
                        _stationinfoRepository.UpdateData(Stationinfo);
                        Stationinfo1.Location_state = LocationStatusEnum.Free.ObjToInt();
                        _stationinfoRepository.UpdateData(Stationinfo1);
                    }
                    if (task.TargetAddress.Contains("SL-0"))
                    {
                        var address = task.TargetAddress.Split("||");
                        Dt_Stationinfo Stationinfo = _stationinfoRepository.QueryFirst(x => x.StationCode == address[0]);
                        WriteLog.Info("2").Write($"{Stationinfo.StationCode}", "2");
                        Dt_Stationinfo Stationinfo1 = _stationinfoRepository.QueryFirst(x => x.StationCode == address[1]);
                        WriteLog.Info("2").Write($"{Stationinfo.StationCode}", "2");
                        Stationinfo.Location_state = LocationStatusEnum.InStock.ObjToInt();
                        _stationinfoRepository.UpdateData(Stationinfo);
                        Stationinfo1.Location_state = LocationStatusEnum.InStock.ObjToInt();
                        _stationinfoRepository.UpdateData(Stationinfo1);
                    }
                    _taskHtyService.AddTask_Hty(task, OperateTypeEnum.自动完成);
                    _taskService.DeleteData(task);
                    response.OK("任务完成成功!");
                    WriteLog.Info("任务完成成功").Write($"任务号{task.TaskId}", "任务完成成功");
                }
 
            }
            catch (Exception ex)
            {
                response.Error(ex.Message);
            }
            return Task.FromResult(response);
        }
 
        /// <summary>
        /// 空托回流         AGV任务完成之后需更新缓存架状态
        /// </summary>
        /// <param name="saveModel"></param>
        /// <returns></returns>
        public Task<WebResponseContent> EmptyTask(SaveModel saveModel)
        {
            WebResponseContent webResponseContent = new WebResponseContent();
            try
            {
                //通过站点表判断缓存架是那个区域去那条输送线回流口。。。。。。。。。。。
                string Saddress = saveModel.MainData["sourceAddress"].ToString();
                string Saddress1 = saveModel.MainData["sourceAddress1"].ToString();
                string Taddress = saveModel.MainData["targetAddress"].ToString();
                if (Saddress == Saddress1)
                {
                    webResponseContent.Error("同一缓存架不能扫描两次!");
                    return Task.FromResult(webResponseContent);
                }
                Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == Saddress || x.SourceAddress == Saddress1 || x.TargetAddress == Saddress || x.TargetAddress == Saddress1);
                if (task != null)
                {
                    webResponseContent.Error("此缓存架已存在任务!");
                    return Task.FromResult(webResponseContent);
                }
                Dt_Stationinfo Stationinfo = _stationinfoRepository.QueryFirst(x => x.StationCode == Saddress && x.Enable);
                Dt_Stationinfo Stationinfo1 = _stationinfoRepository.QueryFirst(x => x.StationCode == Saddress1 && x.Enable);
                if (Stationinfo == null || Stationinfo1 == null)
                {
                    webResponseContent.Error("未找到此起点缓存架,或此缓存架已被禁用!");
                    return Task.FromResult(webResponseContent);
                }
                Stationinfo.Location_state = LocationStatusEnum.Lock.ObjToInt();
                _stationinfoRepository.UpdateData(Stationinfo);
                Stationinfo1.Location_state = LocationStatusEnum.Lock.ObjToInt();
                _stationinfoRepository.UpdateData(Stationinfo1);
                Dt_Task dt_Task = new Dt_Task();
                {
                    dt_Task.TaskNum = _taskService.GetTaskNum();
                    dt_Task.CreateDate = DateTime.Now;
                    dt_Task.Creater = "system";
                    dt_Task.CurrentAddress = Stationinfo.StationCode + "||" + Stationinfo1.StationCode;
                    dt_Task.SourceAddress = Stationinfo.StationCode + "||" + Stationinfo1.StationCode;
                    dt_Task.TaskState = (int)TaskInStatusEnum.InNew;
                    //dt_Task.TaskType = (int)TaskOutboundTypeEnum.Outbound;
                    dt_Task.Grade = 1;
                    dt_Task.PalletCode = "";
                    if (Stationinfo.Area == "A区")
                    {
                        dt_Task.TargetAddress = "ZJXL-KPHLS001";
                        dt_Task.NextAddress = "ZJXL-KPHLX001";
                        dt_Task.TaskType = 64;
                    }
                    else
                    {
                        dt_Task.TargetAddress = "FJXL-KPHLS001";
                        dt_Task.NextAddress = "FJXL-KPHLX001";
                        dt_Task.TaskType = 256;
                    }
                    dt_Task.NextAddress = dt_Task.TargetAddress;
                    dt_Task.Barcode = "";
                    dt_Task.Roadway = "AGV";
                    dt_Task.WMSId = 0;
                    dt_Task.Remark = "空托回流";
                    dt_Task.Floor = 3;
                }
                var isTrue = _taskRepository.AddData(dt_Task);
 
                Dt_Task dt_Tasks = new Dt_Task();
                {
                    dt_Tasks.TaskNum = _taskService.GetTaskNum();
                    dt_Tasks.CreateDate = DateTime.Now;
                    dt_Tasks.Creater = "system";
                    if (Stationinfo.Area == "A区")
                    {
                        dt_Tasks.CurrentAddress = "ZJXL-KPHLX001";
                    }
                    else
                    {
                        dt_Tasks.CurrentAddress = "FJXL-KPHLX001";
                    }
                    dt_Tasks.SourceAddress = dt_Tasks.CurrentAddress;
                    dt_Tasks.TaskState = (int)TaskInStatusEnum.InPending;
                    dt_Tasks.TaskType = 16;
                    dt_Tasks.Grade = 1;
                    dt_Tasks.PalletCode = "";
                    dt_Tasks.TargetAddress = Taddress;
                    dt_Tasks.NextAddress = Taddress;
                    dt_Tasks.Barcode = "";
                    dt_Tasks.Roadway = "AGV";
                    dt_Tasks.WMSId = 0;
                    dt_Tasks.Remark = "空托回流";
                    dt_Task.Floor = 3;
                }
 
                var isTrue1 = _taskRepository.AddData(dt_Tasks);
                webResponseContent.OK("任务下发成功!");
            }
            catch (Exception ex)
            {
                webResponseContent.Error(ex.Message);
            }
            return Task.FromResult(webResponseContent);
        }
        /// <summary>
        /// 烘烤出料      AGV任务完成之后需更新缓存架状态
        /// </summary>
        /// <param name="sourceAddress"></param>
        /// <returns></returns>
        public Task<WebResponseContent> OutBoundTask(SaveModel saveModel)
        {
            WebResponseContent webResponseContent = new WebResponseContent();
            try
            {
                string Saddress = saveModel.MainData["sourceAddress"].ToString();
                Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == Saddress);
                if (task != null)
                {
                    webResponseContent.Error("起点已存在任务!");
                    return Task.FromResult(webResponseContent);
                }
                //var station = _stationinfoRepository.QueryFirst(x => x.StationCode == Saddress);
                //// 查找两个可用的空缓存架
                //var freeStations = _stationinfoRepository
                //    .QueryData(x => x.Location_state == LocationStatusEnum.Free.ObjToInt() && x.Enable && x.Remark == station.Remark && x.Area == station.Area)//  && x.Stationtype == station.Stationtype
                //    .Take(2) // 只取前两个
                //    .ToList();
 
                //int floor = 0;
                //if (station.Area.Contains("A区"))
                //{
                //    floor = 32;
                //}
                //else
                //{
                //    floor = 128;
                //}
                //if (freeStations.Count < 2)
                //{
                //    webResponseContent.Error("未找到足够的空缓存架!");
                //    return Task.FromResult(webResponseContent);
                //}
                //// 检查这两个缓存架是否被任务占用
                //var stationCodes = freeStations.Select(s => s.StationCode).ToList();
                //freeStations[0].Location_state = LocationStatusEnum.Lock.ObjToInt();
                //_stationinfoRepository.UpdateData(freeStations[0]);
                //freeStations[1].Location_state = LocationStatusEnum.Lock.ObjToInt();
                //_stationinfoRepository.UpdateData(freeStations[1]);
                ////stationCodes.
                //var tasks = _taskRepository.QueryData(x => stationCodes.Contains(x.SourceAddress) || stationCodes.Contains(x.TargetAddress)).ToList();
                //if (tasks.Any())
                //{
                //    webResponseContent.Error("部分缓存架已被占用,无法使用!");
                //    return Task.FromResult(webResponseContent);
                //}
 
                Dt_Task dt_Task = new Dt_Task()
                {
                    TaskNum = _taskService.GetTaskNum(),
                    CreateDate = DateTime.Now,
                    Creater = "system",
                    CurrentAddress = Saddress,
                    SourceAddress = Saddress,
                    TaskState = (int)TaskInStatusEnum.AGV_Queue,
                    TaskType = 0,//floor
                    Grade = 1,
                    PalletCode = "",
                    Floor = 3,
                    TargetAddress = "",//string.Join("||", freeStations.Select(s => s.StationCode))
                    NextAddress = "",//string.Join("||", freeStations.Select(s => s.StationCode))
                    Barcode = "",
                    Roadway = "AGV",
                    WMSId = 0,
                    Remark = "空托回流"
                };
                var isTrue = _taskRepository.AddData(dt_Task);
                webResponseContent.OK("任务下发成功!");
            }
            catch (Exception ex)
            {
                webResponseContent.Error(ex.Message);
            }
            return Task.FromResult(webResponseContent);
        }
        /// <summary>
        /// 烘烤回炉  AGV任务完成之后需更新缓存架状态
        /// </summary>
        /// <param name="saveModel"></param>
        /// <returns></returns>
        public Task<WebResponseContent> OutBoundTasks(SaveModel saveModel)
        {
            WebResponseContent webResponseContent = new WebResponseContent();
            try
            {
                //通过站点表判断缓存架是那个区域去那条输送线回流口。。。。。。。。。。。
                string Saddress = saveModel.MainData["sourceAddress"].ToString();
                string Saddress1 = saveModel.MainData["sourceAddress1"].ToString();
                string Taddress = saveModel.MainData["targetAddress"].ToString();
                if (Saddress == Saddress1)
                {
                    webResponseContent.Error("同一缓存架不能扫描两次!");
                    return Task.FromResult(webResponseContent);
                }
                Dt_Stationinfo Stationinfo = _stationinfoRepository.QueryFirst(x => x.StationCode == Saddress && x.Enable);
                Dt_Stationinfo Stationinfo1 = _stationinfoRepository.QueryFirst(x => x.StationCode == Saddress1 && x.Enable);
                if (Stationinfo == null || Stationinfo1 == null)
                {
                    webResponseContent.Error("未找到此起点缓存架,或此缓存架已被禁用!");
                    return Task.FromResult(webResponseContent);
                }
                Stationinfo.Location_state = LocationStatusEnum.Lock.ObjToInt();
                _stationinfoRepository.UpdateData(Stationinfo);
                Stationinfo1.Location_state = LocationStatusEnum.Lock.ObjToInt();
                _stationinfoRepository.UpdateData(Stationinfo1);
                Dt_Task dt_Task = new Dt_Task();
                {
                    dt_Task.TaskNum = _taskService.GetTaskNum();
                    dt_Task.CreateDate = DateTime.Now;
                    dt_Task.Creater = "system";
                    dt_Task.CurrentAddress = Stationinfo.StationCode + "||" + Stationinfo1.StationCode;
                    dt_Task.SourceAddress = Stationinfo.StationCode + "||" + Stationinfo1.StationCode;
                    dt_Task.TaskState = (int)TaskInStatusEnum.InNew;
                    //dt_Task.TaskType = (int)TaskOutboundTypeEnum.Outbound;
                    dt_Task.Grade = 1;
                    dt_Task.PalletCode = "";
                    if (Stationinfo.Area == "A区")
                    {
                        dt_Task.TargetAddress = "ZJXL-KPHLS001";
                        dt_Task.NextAddress = "ZJXL-KPHLX001";
                        dt_Task.TaskType = 64;
                    }
                    else
                    {
                        dt_Task.TargetAddress = "FJXL-KPHLS001";
                        dt_Task.NextAddress = "FJXL-KPHLX001";
                        dt_Task.TaskType = 256;
                    }
                    dt_Task.Barcode = "";
                    dt_Task.Roadway = "AGV";
                    dt_Task.WMSId = 0;
                    dt_Task.Remark = "烘烤回炉";
                    dt_Task.Floor = 3;
                }
                var isTrue = _taskRepository.AddData(dt_Task);
 
                Dt_Task dt_Tasks = new Dt_Task();
                {
                    dt_Tasks.TaskNum = _taskService.GetTaskNum();
                    dt_Tasks.CreateDate = DateTime.Now;
                    dt_Tasks.Creater = "system";
                    if (Stationinfo.Area == "A区")
                    {
                        dt_Tasks.CurrentAddress = "ZJXL-KPHLX001";
                    }
                    else
                    {
                        dt_Tasks.CurrentAddress = "FJXL-KPHLX001";
                    }
                    dt_Tasks.SourceAddress = dt_Tasks.CurrentAddress;
                    dt_Tasks.TaskState = (int)TaskInStatusEnum.InPending;
                    dt_Tasks.TaskType = 8;
                    dt_Tasks.Grade = 1;
                    dt_Tasks.PalletCode = "";
                    dt_Tasks.TargetAddress = Taddress;
                    dt_Tasks.NextAddress = Taddress;
                    dt_Tasks.Barcode = "";
                    dt_Tasks.Roadway = "AGV";
                    dt_Tasks.WMSId = 0;
                    dt_Tasks.Remark = "烘烤回炉";
                    dt_Task.Floor = 3;
                }
                var isTrue1 = _taskRepository.AddData(dt_Tasks);
                webResponseContent.OK("任务下发成功!");
            }
            catch (Exception ex)
            {
                webResponseContent.Error(ex.Message);
            }
            return Task.FromResult(webResponseContent);
        }
    }
}