From 9bae33c85d698987a6c9cf8ba8edbe9497b101dc Mon Sep 17 00:00:00 2001 From: wankeda <Administrator@DESKTOP-HAU3ST3> Date: 星期二, 15 四月 2025 17:05:56 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhuHaiChuangZhi/GanFengLiYeNew --- 代码管理/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 42 insertions(+), 3 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs" index 342bfba..f07c233 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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,9 +32,12 @@ 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) @@ -86,7 +90,7 @@ WebResponseContent response = new WebResponseContent(); try { - var czTask = BaseDal.QueryFirst(x => x.TaskTaskID == dto.TaskId); + var czTask = BaseDal.QueryFirst(x => x.TaskTaskID == dto.TaskId && x.TaskStatus == TaskInStatusEnum.InNew.ToString()); if (czTask == null) { response.Error("浠诲姟涓嶅瓨鍦紒"); @@ -109,6 +113,39 @@ { 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("鍙傛暟閿欒锛丗inishNum 蹇呴』涓� 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("鍙傛暟閿欒锛佽妫�鏌ャ�怓inishNum銆戯紒") + //}; + + //typeof(CZTaskBarCodeDto).GetProperty(property)?.SetValue(detail, dto.MaterialBarcode); + + //czTask.DtCZTaskDetails = JsonSerializer.Serialize(detail); + var isTrue = BaseDal.UpdateData(czTask); if (isTrue) { @@ -125,6 +162,7 @@ } return Task.FromResult(response); } + /// <summary> /// 杈撻�佺嚎鍥炴祦 /// </summary> @@ -137,7 +175,7 @@ { string Saddress = saveModel.MainData["sourceAddress"].ToString(); string Taddress = saveModel.MainData["targetAddress"].ToString(); - + string Exception = saveModel.MainData["Exception"].ToString(); Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == Saddress && x.TaskState == (int)TaskInStatusEnum.InPending && x.TargetAddress == "WaitBind"); if (task == null) { @@ -145,6 +183,7 @@ return Task.FromResult(webResponseContent); } task.TargetAddress = Taddress; + task.ExceptionMessage = Exception; task.TaskState = (int)TaskInStatusEnum.InNew; var isTrue = _taskRepository.UpdateData(task); if (isTrue) -- Gitblit v1.9.3