From 570a85557b7013df6bf82c4c324793d96a1b0dfb Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周五, 10 10月 2025 13:32:39 +0800 Subject: [PATCH] 优化提示 --- DEmon/WebWIPAPI/Controllers/MesIntegrController.cs | 75 ++++++++++++++++++++++++++++++++++++- 1 files changed, 72 insertions(+), 3 deletions(-) diff --git a/DEmon/WebWIPAPI/Controllers/MesIntegrController.cs b/DEmon/WebWIPAPI/Controllers/MesIntegrController.cs index 6aa50c6..1523a23 100644 --- a/DEmon/WebWIPAPI/Controllers/MesIntegrController.cs +++ b/DEmon/WebWIPAPI/Controllers/MesIntegrController.cs @@ -3,15 +3,18 @@ using iWareCommon.Utils; using iWareDataCore.BASE.Entity; using iWareDataCore.BASE.Service; +using iWareDataCore.TASK.Service; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Threading; +using System.Web.Hosting; using System.Web.Mvc; using WebWIPAPI.Models; using WebWIPAPI.Properties; using WebWIPAPI.Utils; +using static System.Runtime.CompilerServices.RuntimeHelpers; using LogTextHelper = WebWIPAPI.Utils.LogTextHelper; namespace WebWIPAPI.Controllers @@ -108,6 +111,17 @@ }; return ApiResponseHelper.ReturnApiResponse(responseMessage, "importInOrder", ""); } + if (importMaterials.Select(x => x.Code).Distinct().Count() != 1) + { + responseMessage = new ApiResponse<string>() + { + Code = 500, + Success = false, + Message = "鏈璇锋眰涓墿鏂欏彿涓嶈兘閲嶅", + Data = null, + }; + return ApiResponseHelper.ReturnApiResponse(responseMessage, "importOutOrder", ""); + } #endregion #region 涓氬姟澶勭悊 @@ -179,7 +193,7 @@ ///// <summary> - ///// 瀵煎叆鍑哄簱鍗�-鐗堟湰1 + ///// 瀵煎叆鍑哄簱鍗�-鐗堟湰1锛堜娇鐢ㄥ嚭搴撳崟鎹殑鐗堟湰锛� ///// </summary> ///// <param name="inputmaterials"></param> ///// <returns></returns> @@ -261,7 +275,7 @@ /// <summary> - /// 瀵煎叆鍑哄簱鍗�-鐗堟湰2 + /// 瀵煎叆鍑哄簱鍗�-鐗堟湰2锛堥�夋嫨搴撳瓨鍑哄簱鐨勭増鏈級 /// </summary> /// <param name="inputmaterials"></param> /// <returns></returns> @@ -296,12 +310,24 @@ }; return ApiResponseHelper.ReturnApiResponse(responseMessage, "importOutOrder", ""); } + if (inputmaterials.Select(x => x.Code).Distinct().Count() != 1) + { + responseMessage = new ApiResponse<string>() + { + Code = 500, + Success = false, + Message = "鏈璇锋眰涓墿鏂欏彿涓嶈兘閲嶅", + Data = null, + }; + return ApiResponseHelper.ReturnApiResponse(responseMessage, "importOutOrder", ""); + } #endregion #region 涓氬姟澶勭悊 string typeName = "鍑哄簱"; - handler_importOutOrder(typeName, inputmaterials, out msg); + handler_OutOrder(inputmaterials, out msg); + //handler_importOutOrder(typeName, inputmaterials, out msg); #endregion @@ -439,5 +465,48 @@ } } + + /// <summary> + /// 閫夋嫨搴撳瓨鍑哄簱鐨勭増鏈� + /// </summary> + /// <param name="inputmaterials"></param> + /// <param name="msg"></param> + private void handler_OutOrder(List<InputMaterialEntity> inputmaterials, out string msg) + { + msg = ""; + //鏌ユ壘搴撳瓨琛ㄤ腑鐨刬d + var qList = inputmaterials.Select(x => x.Code).ToList(); + List<int> ids = PlaceMaterialViewService.GetInstance().GetPlaceMaterialViewsByCodeList(qList, out msg); + if (!string.IsNullOrEmpty(msg)) + { + return; + } + // List<int> ids = GetSelectedDataKeyIDs(PlaceGrid); + if (ids.Count > 0) + { + int count = MainTaskService.GetInstance().SaveOutMainTask(ids, out msg); + var retMsg = msg; + if (count > 0) + { + msg = "鍑哄簱浠诲姟鐢熸垚鎴愬姛:" + retMsg; + } + else if (count == 0) + { + msg = "鍑哄簱浠诲姟宸插湪浠诲姟闃熷垪涓�:" + retMsg; + } + else + { + msg = "鍑哄簱浠诲姟鐢熸垚澶辫触锛�:" + retMsg; + } + + } + else + { + msg = "瑕佸嚭搴撶殑鐗╂枡娌℃湁鍙敤搴撳瓨"; + } + //Alert.Show(msg); + //WriteLog("搴撲綅鐗╂枡鍑哄簱" + msg, "搴撳瓨绠$悊"); + } + } } -- Gitblit v1.9.3