wanshenmean
2025-04-15 21cd52c5592aad3687be74599a932012d9dd77a4
´úÂë¹ÜÀí/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs
@@ -18,6 +18,7 @@
#endregion << ç‰ˆ æœ¬ æ³¨ é‡Š >>
using OfficeOpenXml.FormulaParsing.Excel.Functions.Logical;
using System.Text.Json;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseServices;
@@ -31,6 +32,7 @@
    public class TaskCZService : ServiceBase<DtCZTask, ITaskCZRepository>, ITaskCZService
    {
        private readonly ITaskRepository _taskRepository;
        public TaskCZService(ITaskCZRepository BaseDal, ITaskRepository taskRepository) : base(BaseDal)
        {
            _taskRepository = taskRepository;
@@ -109,6 +111,28 @@
                {
                    czTask.TaskStatus = TaskInStatusEnum.Line_InExecuting.ToString();
                }
                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)
                {
@@ -125,6 +149,7 @@
            }
            return Task.FromResult(response);
        }
        /// <summary>
        /// è¾“送线回流
        /// </summary>