From 79ad6097cbe4b4d6cee66dd8ad9c3c1c8f2b5243 Mon Sep 17 00:00:00 2001 From: IPC-610 <IPC-610@DESKTOP-6LEOOS3> Date: 星期二, 15 十月 2024 16:42:49 +0800 Subject: [PATCH] Merge branch 'master' of http://47.95.120.53:8083/r/WCSNet6 --- Admin.NET/WCS.Application/Service/WcsTask/WcsTaskService.cs | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 103 insertions(+), 1 deletions(-) diff --git a/Admin.NET/WCS.Application/Service/WcsTask/WcsTaskService.cs b/Admin.NET/WCS.Application/Service/WcsTask/WcsTaskService.cs index 8820828..da996a9 100644 --- a/Admin.NET/WCS.Application/Service/WcsTask/WcsTaskService.cs +++ b/Admin.NET/WCS.Application/Service/WcsTask/WcsTaskService.cs @@ -2,10 +2,12 @@ using AngleSharp.Dom; using COSXML.Network; using DocumentFormat.OpenXml.Drawing.Charts; +using DocumentFormat.OpenXml.Math; using Elastic.Clients.Elasticsearch.Tasks; using Furion.DatabaseAccessor; using Furion.Logging; using Microsoft.AspNetCore.SignalR; +using NewLife; using WCS.Application.Entity; using WCS.Application.Service.WcsTask.Dto; @@ -53,7 +55,7 @@ .WhereIF(!string.IsNullOrWhiteSpace(input.PalletNo), u => u.PalletNo.Contains(input.PalletNo.Trim())) .WhereIF(!string.IsNullOrWhiteSpace(input.Origin), u => u.Origin.Contains(input.Origin.Trim())) .Select<WcsTaskOutput>(); - return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize); + return await query.OrderBy(o=>o.Levels).OrderByDescending(o=>o.CreateTime).ToPagedListAsync(input.Page, input.PageSize); } /// <summary> @@ -196,6 +198,7 @@ modTask.CancelDate = DateTime.Now;//鍙栨秷鏃堕棿 } modTask.Status = input.Status; + modTask.Levels = 999; await _wcsTaskRep.Context.Updateable(modTask).UpdateColumns(s => new { s.Status, s.IsSuccess, s.FinishDate, s.CancelDate, s.UpdateTime, s.UpdateUserId, s.UpdateUserName }).ExecuteCommandAsync(); //鍐欏叆浠诲姟鏄庣粏琛� WcsTaskMonitor modTaskMonitor = new WcsTaskMonitor() @@ -293,6 +296,105 @@ //涓嬪彂浠诲姟鏃ュ織 HubUtil.PublicTaskMonitor(modTaskMonitor.Adapt<WcsTaskMonitorOutput>()); } + /// <summary> + /// 浠诲姟缃《 + /// </summary> + /// <param name="input"></param> + /// <returns></returns> + [HttpPost] + [ApiDescriptionSettings(Name = "TopUpTask")] + [DisplayName("浠诲姟缃《")] + public async Task TopUpTask(UpdateWcsTaskInput input) + { + var modTask = await _wcsTaskRep.GetByIdAsync(input.Id); + if (modTask.Status != TaskStatusEnum.Wait) + { + throw Oops.Oh("鍙湁绛夊緟鎵ц鐨勪换鍔℃墠鑳界疆椤讹紒"); + } + int editNum = 1; + List<string> _editTaskNoList = new List<string>(); + //鍌ㄤ綅娣卞害 + string locatDepth = ""; + if (modTask.TaskType == TaskTypeEnum.Out || modTask.TaskType == TaskTypeEnum.Move)//鍑哄簱浠诲姟鎴栧叆搴撲换鍔� + { + locatDepth = modTask.StartLocate.Substring(modTask.StartLocate.Length - 1, 1);//璧峰鍌ㄤ綅娣卞害 + if (locatDepth == "2")//鍒ゆ柇褰撳墠鍌ㄤ綅鏄惁娣卞害涓�2锛屽唴渚у偍浣� + { + string locatString = modTask.StartLocate.Substring(0, modTask.StartLocate.Length - 1) + "1";//鑾峰彇澶栦晶鍌ㄤ綅鍦板潃 + //鍒ゆ柇澶栦晶鍌ㄤ綅鏄惁鏈夌瓑寰呮墽琛岀殑浠诲姟锛屾湁灏变紭鍏堟墽琛� + var modTask2 = _db.Queryable<WcsTask>().First(w => w.IsDelete == false && w.Status == TaskStatusEnum.Wait && w.StartLocate == locatString); + if (modTask2 != null) + { + modTask2.Levels = 1; + await _wcsTaskRep.Context.Updateable(modTask2).UpdateColumns(s => new { s.Levels }).ExecuteCommandAsync(); + _editTaskNoList.Add(modTask2.TaskNo); + + modTask.Levels = 2; + await _wcsTaskRep.Context.Updateable(modTask).UpdateColumns(s => new { s.Levels }).ExecuteCommandAsync(); + _editTaskNoList.Add(modTask.TaskNo); + + editNum = 2; + } + else + { + modTask.Levels = 1; + await _wcsTaskRep.Context.Updateable(modTask).UpdateColumns(s => new { s.Levels }).ExecuteCommandAsync(); + _editTaskNoList.Add(modTask.TaskNo); + } + } + else + { + modTask.Levels = 1; + await _wcsTaskRep.Context.Updateable(modTask).UpdateColumns(s => new { s.Levels }).ExecuteCommandAsync(); + _editTaskNoList.Add(modTask.TaskNo); + } + } + if (modTask.TaskType == TaskTypeEnum.In)//鍏ュ簱浠诲姟 + { + if (string.IsNullOrEmpty(modTask.EndLocate)) + { + throw Oops.Oh("璇ュ叆搴撲换鍔¤繕鏈垎閰嶅偍浣嶏紝缃《澶辫触锛�"); + } + locatDepth = modTask.EndLocate.Substring(modTask.EndLocate.Length - 1, 1);//鐩爣鍌ㄤ綅娣卞害 + if (locatDepth == "1")//鍒ゆ柇褰撳墠鍌ㄤ綅鏄惁娣卞害涓�1锛屽渚у偍浣� + { + string locatString = modTask.EndLocate.Substring(0, modTask.EndLocate.Length - 1) + "2";//鑾峰彇鍐呬晶鍌ㄤ綅鍦板潃 + //鍒ゆ柇鍐呬晶鍌ㄤ綅鏄惁鏈夌瓑寰呮墽琛岀殑浠诲姟锛屾湁灏变紭鍏堟墽琛� + var modTask2 = _db.Queryable<WcsTask>().First(w => w.IsDelete == false && w.Status == TaskStatusEnum.Wait && (w.StartLocate == locatString || w.EndLocate == locatString)); + if (modTask2 != null) + { + modTask2.Levels = 1; + await _wcsTaskRep.Context.Updateable(modTask2).UpdateColumns(s => new { s.Levels }).ExecuteCommandAsync(); + _editTaskNoList.Add(modTask2.TaskNo); + + modTask.Levels = 2; + await _wcsTaskRep.Context.Updateable(modTask).UpdateColumns(s => new { s.Levels }).ExecuteCommandAsync(); + _editTaskNoList.Add(modTask.TaskNo); + + editNum = 2; + } + else + { + modTask.Levels = 1; + await _wcsTaskRep.Context.Updateable(modTask).UpdateColumns(s => new { s.Levels }).ExecuteCommandAsync(); + _editTaskNoList.Add(modTask.TaskNo); + } + } + else + { + modTask.Levels = 1; + await _wcsTaskRep.Context.Updateable(modTask).UpdateColumns(s => new { s.Levels }).ExecuteCommandAsync(); + _editTaskNoList.Add(modTask.TaskNo); + } + } + //椤哄欢鍏朵粬缃《浠诲姟 + var modTaskList = _db.Queryable<WcsTask>().Where(w => w.IsDelete == false && w.Status == TaskStatusEnum.Wait && w.Levels != 999 && !_editTaskNoList.Contains(w.TaskNo)).ToList(); + foreach (var item in modTaskList) + { + item.Levels += editNum; + } + await _wcsTaskRep.Context.Updateable(modTaskList).UpdateColumns(s => new { s.Levels }).ExecuteCommandAsync(); + } /// <summary> /// 鑷姩鐢熸垚浠诲姟鍙� -- Gitblit v1.8.0