| | |
| | | #endregion << ç æ¬ 注 é >> |
| | | |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical; |
| | | using System.Text.Json; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | |
| | | public class TaskCZService : ServiceBase<DtCZTask, ITaskCZRepository>, ITaskCZService |
| | | { |
| | | private readonly ITaskRepository _taskRepository; |
| | | public TaskCZService(ITaskCZRepository BaseDal, ITaskRepository taskRepository) : base(BaseDal) |
| | | private readonly ITaskCZDetailsRepository _detailsRepository; |
| | | |
| | | public TaskCZService(ITaskCZRepository BaseDal, ITaskRepository taskRepository, ITaskCZDetailsRepository detailsRepository) : base(BaseDal) |
| | | { |
| | | _taskRepository = taskRepository; |
| | | _detailsRepository = detailsRepository; |
| | | } |
| | | |
| | | public Task<WebResponseContent> AddTaskCZAsync(CZTaskDto dto) |
| | |
| | | { |
| | | 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, |
| | | }; |
| | | _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) |
| | | { |
| | |
| | | } |
| | | return Task.FromResult(response); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è¾éçº¿åæµ |
| | | /// </summary> |