From 5f3129c47cc8d3aa9ddffb2c468d908f2416e544 Mon Sep 17 00:00:00 2001 From: chengsc <Demo@DESKTOP-CPA90BF> Date: 星期二, 27 八月 2024 11:02:12 +0800 Subject: [PATCH] 修改MES接口问题 --- Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs | 55 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 46 insertions(+), 9 deletions(-) diff --git a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs index fa13375..5020166 100644 --- a/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs +++ b/Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs @@ -17,6 +17,7 @@ using WMS.Entity.Context; using WMS.Entity.SysEntity; using WMS.IBLL.IBllAsnServer; +using WMS.BLL.SysServer; namespace WMS.BLL.BllAsnServer { @@ -869,11 +870,11 @@ /// </summary> /// <param name="model"></param> /// <returns></returns> - public ErpModel CreateAsn(AsnInfo model) + public HttpReturnModel HttpCreateAsn(AsnInfo model) { try { - var resultModel = new ErpModel() { Success = -1, Message = "" }; + var resultModel = new HttpReturnModel() { Success = "-1", Message = "" }; if (string.IsNullOrEmpty(model.AsnType)) { resultModel.Message = "鍗曟嵁绫诲瀷涓嶅彲涓虹┖!"; @@ -972,7 +973,7 @@ Db.Insertable(detailModels).ExecuteCommand(); Db.CommitTran(); - resultModel.Success = 0; + resultModel.Success = "0"; resultModel.Message = "鎴愬姛"; return resultModel; } @@ -984,7 +985,7 @@ } //璁㈠崟鍥炰紶涓婃父绯荤粺 - public bool FinishAsn(int id, string erpUrl, string mesUrl, int userId) + public bool FinishAsn(int id, string erpUrl, string mesUrl,string mesTokenUrl, int userId) { try { @@ -1019,7 +1020,7 @@ }; list.Add(item); } - var soInfo = new AsnInfo() + var asnInfo = new AsnInfo() { OrderCode = notice.OrderCode, AsnDetails = list @@ -1027,18 +1028,31 @@ #region 閫氳繃鎺ュ彛鍙戦�佽嚦erp 鎴� mes //绯荤粺瀵规帴鍚庢斁寮� - var jsonData = JsonConvert.SerializeObject(soInfo); + var jsonData = JsonConvert.SerializeObject(asnInfo); var mesList = new List<string>() { "0", "4" }; //0 鎴愬搧鍏ュ簱 4浣欐枡閫�鍥炲叆搴� var erpList = new List<string>() { "1", "2", "3" }; //1 閲囪喘鍏ュ簱 2涓棿鍝佸叆搴� 3 閫�璐у叆搴� if (mesList.Contains(notice.Type)) // mes { - var response = HttpHelper.DoPost(mesUrl, jsonData, "鍏ュ簱鍗曞畬鎴愪笂浼�", "MES"); + //鑾峰彇浠ょ墝 + var token = new Token().GetMesToken(mesTokenUrl); + Dictionary<string, string> mesDic = new Dictionary<string, string>() + { + {"Authorization",token } + }; + var mesData = new FinishAsnModel() + { + no = asnInfo.OrderCode, + qty = asnInfo.AsnDetails.Sum(m=>m.Qty) + }; + jsonData = JsonConvert.SerializeObject(mesData); + //璋冪敤鎺ュ彛 + var response = HttpHelper.DoPost(mesUrl, jsonData, "鍏ュ簱鍗曞畬鎴愪笂浼�", "MES", mesDic); var obj = JsonConvert.DeserializeObject<MesModel>(response);//瑙f瀽杩斿洖鏁版嵁 - if (obj.Success != 0) + if (obj.status != "0") { - throw new Exception("涓婁紶澶辫触" + obj.Message); + throw new Exception("涓婁紶澶辫触" + obj.message); } } else if (erpList.Contains(notice.Type)) //erp @@ -1069,6 +1083,29 @@ } } + public void UpLocate(string wareNo,string locatNo) + { + try + { + if (string.IsNullOrWhiteSpace(wareNo) || string.IsNullOrWhiteSpace(locatNo)) + { + throw new Exception("浠撳簱鎴栧偍浣嶄笉鑳戒负绌�"); + } + var locate = Db.Queryable<SysStorageLocat>().First(m=>m.IsDel == "0" && m.LocatNo == locatNo && m.WareHouseNo == wareNo); + if (locate == null) + { + throw new Exception("鏈煡璇㈠埌鍌ㄤ綅淇℃伅"); + } + locate.Status = "0";//鍌ㄤ綅鐘舵�佸彉鏇寸┖鍌ㄤ綅 + Db.Updateable(locate).ExecuteCommand(); + + } + catch (Exception e) + { + throw new Exception(e.Message); + } + } + #endregion } -- Gitblit v1.8.0