From dc1ba27d451f990ebdb3f3d56b70ebaeeeeed87e Mon Sep 17 00:00:00 2001 From: 王 垚 <1402714037@qq.com> Date: 星期二, 09 十一月 2021 15:03:38 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/SRM-WEBAPI --- WebAPI/Controllers/WebAPIController.cs | 67 ++++++++++++++++++++++++--------- 1 files changed, 48 insertions(+), 19 deletions(-) diff --git a/WebAPI/Controllers/WebAPIController.cs b/WebAPI/Controllers/WebAPIController.cs index c4b53fd..70a9d0c 100644 --- a/WebAPI/Controllers/WebAPIController.cs +++ b/WebAPI/Controllers/WebAPIController.cs @@ -1,4 +1,5 @@ 锘縰sing DAL; +using Microsoft.AspNet.SignalR; using Model; using SQLHelper; using System; @@ -17,7 +18,7 @@ { private JsonResult objJsonResult = new JsonResult(); private json objjson = new json(); - // private POInStockBillServices oclscg_poinstockbillmain = new POInStockBillServices(); + // private POInStockBillServices oclscg_poinstockbillmain = new POInStockBillServices(); public string sWhere = ""; public WebServer webserver = new WebServer(); public DataSet ds = new DataSet(); @@ -40,25 +41,25 @@ public static bool Add_Log(string WorkList, string CurUserName, string State) { - DBUtility.ClsPub.SetIPAddress(); - string IPAddress; - string ComputerName; - IPAddress = DBUtility.ClsPub.IPAddress; - ComputerName = DBUtility.ClsPub.ComputerName; - ClsCNSRM oCnLoc = new ClsCNSRM(); - try - { - oCnLoc.RunProc("Insert into System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + - "(getdate(),'" + CurUserName + "','" + ComputerName + "','" + WorkList + "','SRM绯荤粺','" + IPAddress + "','" + State + "')" - ); + DBUtility.ClsPub.SetIPAddress(); + string IPAddress; + string ComputerName; + IPAddress = DBUtility.ClsPub.IPAddress; + ComputerName = DBUtility.ClsPub.ComputerName; + ClsCNSRM oCnLoc = new ClsCNSRM(); + try + { + oCnLoc.RunProc("Insert into System_Log(GeginDate,userid,WorkstationName,WorkList,SystemName,NetUserName,State) values " + + "(getdate(),'" + CurUserName + "','" + ComputerName + "','" + WorkList + "','SRM绯荤粺','" + IPAddress + "','" + State + "')" + ); - return true; - } - catch (Exception e) - { - return false; + return true; + } + catch (Exception e) + { + return false; - } + } } /// <summary> @@ -695,6 +696,34 @@ #endregion - + /// <summary> + /// 瑙﹀彂hub鐨刟pi + /// </summary> + /// <param name="request">request</param> + /// <returns>message</returns> + [AllowAnonymous] + [Route("show/hub"), HttpGet] + public HttpResponseMessage GetMessage(HttpRequestMessage request) + { + var hub = GlobalHost.ConnectionManager.GetHubContext<MyHub>(); + //娉ㄦ剰杩欓噷鐨剆howMessage 灏辨槸瀵筊epairHub涓嬪畾涔夌殑showMessage鏂规硶璋冪敤,鍚屾牱鍓嶇涔熸槸璋冪敤杩欎釜鏂规硶 + string aa = hub.Clients.All.showMessage("杩欓噷闈㈠彲浠ユ斁鍏ヤ换鎰忓璞�,鍓嶅彴鍙互鏀跺埌姝ゅ唴瀹�"); + return request.CreateResponse(HttpStatusCode.OK, aa); + } + + [Route("Message/MsgCount")] + [HttpPost] + public object MsgCount() + { + ClsCNSRM oCn = new ClsCNSRM(); + DataSet oDs = new DataSet(); + oDs = oCn.RunProcReturn("select * from Gy_Message", "Gy_Message"); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "杩斿洖鏁版嵁"; + objJsonResult.data = oDs; + return objJsonResult; ; + } + } } -- Gitblit v1.9.1