From 4730e7dc2bf26ddec23224f54169748ae796d683 Mon Sep 17 00:00:00 2001 From: "xiaowei.song" Date: Mon, 20 Nov 2023 08:50:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E4=BA=A7=E5=B7=A5=E5=8D=95=E6=8E=92?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mes/pro/ProWorkorderController.cs | 32 ++++++++----------- .../mes/pro/IService/IProWorkorderService.cs | 2 ++ ZR.Service/mes/pro/ProWorkorderService.cs | 7 ++++ 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderController.cs b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderController.cs index 14206145..f03faaf9 100644 --- a/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/pro/ProWorkorderController.cs @@ -1,4 +1,5 @@ -using JinianNet.JNTemplate; +using Infrastructure.Extensions; +using JinianNet.JNTemplate; using Microsoft.AspNetCore.Mvc; using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; @@ -99,29 +100,24 @@ namespace ZR.Admin.WebApi.Controllers.MES.pro } /// - /// + /// 对当前的,排产工单排序 /// - /// + /// 列表参数,一个是工单ID,一个是排序号 /// [HttpPost("sortschedule")] public IActionResult SortSchedule([FromBody] List parameter) { + int sum = 0; + foreach (ProWorkorderSortDTO item in parameter) + { + if(!string.IsNullOrEmpty(item.id)) + { + int data = proWorkorderService.SortWorkorderSchedule(item.id, item.order); + sum += data; + } + } - //JsonElement t = (JsonElement)parameter; - //JsonElement. - //parameter.Adapt(t); - //string t = parameter["listKeyValue"]; - //Dictionary KV_ID_Sort = new Dictionary(); - - - //JArray ja = (JArray)JsonConvert.DeserializeObject(t); - //foreach (JToken item in ja.ToList()) - //{ - // KV_ID_Sort.Add(item["id"].ToString(), item["value"].ToString()); - //} - - - return ToResponse(new ApiResult(200, "success", 1)); + return ToResponse(new ApiResult(200, "success", sum)); } } } diff --git a/ZR.Service/mes/pro/IService/IProWorkorderService.cs b/ZR.Service/mes/pro/IService/IProWorkorderService.cs index 489dcf9d..0d06f69e 100644 --- a/ZR.Service/mes/pro/IService/IProWorkorderService.cs +++ b/ZR.Service/mes/pro/IService/IProWorkorderService.cs @@ -16,5 +16,7 @@ namespace ZR.Service.mes.pro.IService public int SetWorkorderSechedule(string id, DateTime arrange_starttime, DateTime arrange_endtime); public int ResetWorkorderSechedule(string id); + + public int SortWorkorderSchedule(string id, int sort); } } diff --git a/ZR.Service/mes/pro/ProWorkorderService.cs b/ZR.Service/mes/pro/ProWorkorderService.cs index 68887ddb..df50854f 100644 --- a/ZR.Service/mes/pro/ProWorkorderService.cs +++ b/ZR.Service/mes/pro/ProWorkorderService.cs @@ -49,5 +49,12 @@ namespace ZR.Service.mes.pro .ExecuteCommand(); } + public int SortWorkorderSchedule(string id, int order) + { + return Context.Updateable() + .SetColumns(it => it.Order == order) + .Where(it => it.Id.Equals(id)) + .ExecuteCommand(); + } } }