From 25184cadd4011856d95e76f1d79b37ce51a3e548 Mon Sep 17 00:00:00 2001 From: chengsc <Demo@DESKTOP-CPA90BF> Date: 星期三, 30 十月 2024 11:34:12 +0800 Subject: [PATCH] 修改问题 --- Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs | 59 +++++++++++++++++++++++++++++------------------------------ 1 files changed, 29 insertions(+), 30 deletions(-) diff --git a/Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs b/Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs index 2033a79..82a8859 100644 --- a/Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs +++ b/Admin.NET/WCS.Application/Service/WcsCheckTask/WcsCheckTaskService.cs @@ -224,16 +224,41 @@ } /// <summary> - /// 浠诲姟缁撴壒 + /// 浠诲姟寮哄埗缁撴壒 /// </summary> /// <param name="input"></param> /// <returns></returns> [HttpPost] [ApiDescriptionSettings(Name = "CloseTaskForPLC")] - [DisplayName("浠诲姟缁撴壒")] + [DisplayName("浠诲姟寮哄埗缁撴壒")] public async Task CloseTaskForPLC(CloseTaskPLCInput input) { - //鍒嗘嫞浠诲姟淇℃伅 + if (PLCTaskAction.boDemo) + { + //婕旂ず妯″紡 + var checkTaskList2 = await _wcsCheckTaskRep.Context.Queryable<WcsCheckTask>().FirstAsync(w => w.Port == "208"); + + var deviceInfo = await _wcsDeviceRep.Context.Queryable<WcsDevice>().FirstAsync(w => w.StationNum == "208"); + if (deviceInfo == null) + { + throw Oops.Bah($"鎵句笉鍒板伐浣嶅彿锛�208鐨勭爜鍨涘伐浣嶄俊鎭�"); + } + var modPlc = await _wcsDeviceRep.Context.Queryable<WcsPlc>().FirstAsync(s => s.Id == deviceInfo.PlcId); + if (modPlc == null) + { + throw Oops.Bah($"鎵句笉鍒板伐浣嶅彿锛�208鐨勮澶囦俊鎭�"); + } + PLCUtil modUtil = new PLCUtil(modPlc); + + var ret = modUtil.SetPlcDBValue(checkTaskList2.PosTypeLot, checkTaskList2.DbNumber, checkTaskList2.PosLot, "1"); + return; + } + + // 姝e父妯″紡 + if (string.IsNullOrWhiteSpace(input.lotNo)) + { + throw Oops.Bah($"璇ュ伐浣嶆湭缁戝畾浠诲姟锛�"); + } var checkTaskList = _wcsCheckTaskRep.Context.Queryable<WcsCheckTask>().Where(w => w.LotNo == input.lotNo && w.Status == "1").ToList(); if (checkTaskList.Count <= 0) { @@ -281,33 +306,7 @@ { throw Oops.Bah("PCL鏈繛鎺ワ紝缁撴壒澶辫触锛�"); } - - - //Service.WcsDevice.Dto.WcsDeviceTaskOrderDto order= await _wcsDeviceRep.Context.Queryable<WcsDevice>() - // .InnerJoin<WcsPlc>((device, plc) => device.PlcId == plc.Id) - // .LeftJoin<WcsCheckTask>((device, plc, task) => device.StationNum == task.Port) - // .Where((device, plc, task) => device.PlcId == 1000 && task.Port=="") - // .Select((device, plc, task) => new Service.WcsDevice.Dto.WcsDeviceTaskOrderDto() - // { - // Id = device.Id, - // Text = device.Text, - // TaskNo = task.TaskNo, - // OrderNo = task.OrderNo, - // LotNo = task.LotNo, - // SkuNo = task.SkuNo, - // SkuName = task.SkuName, - // LineNo = task.LineNo, - // Status = task.Status, - // PZNo = task.PZNo, - // Qty = task.Qty, - - // Type = plc.Type - // }) - // .FirstAsync(); - ////涓嬪彂鍒嗘嫞浠诲姟 - //HubUtil.PublicCheckTask(order.Adapt<Service.WcsDevice.Dto.WcsDeviceTaskOrderDto>()); - #endregion - } + } } } -- Gitblit v1.8.0