using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Security.Policy; using System.Threading.Tasks; using System.Web; using System.Web.Services; using WebService.Log; namespace WebService { /// /// WebService1 的摘要说明 /// [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。 // [System.Web.Script.Services.ScriptService] public class LiKu : System.Web.Services.WebService { /// /// 上游WMS系统调用立库WMS接口 /// /// [WebMethod] public string AcceptWMSRequest(string funcName,string data) { new LogFactory().GetLog("接口").InfoFormat(true, funcName, "请求", $"{data}"); string url = ConfigurationManager.AppSettings["WMS"]; if (funcName == "freezeByCustomer")// 立库WMS冻结/解冻信息 { var response = HttpHelper.Post(url + "api/StockInfo/freezeByCustomer", data, "立库WMS冻结/解冻信息"); string res = JsonConvert.SerializeObject(response); new LogFactory().GetLog("接口").InfoFormat(true, funcName, "响应", $"{res}"); return res; } else if(funcName == "InventoryQuery")//库存信息 { var response = HttpHelper.Post(url + "api/StockInfo/inventoryQuery", data, "库存信息"); string res = JsonConvert.SerializeObject(response); new LogFactory().GetLog("接口").InfoFormat(true, funcName, "响应", $"{res}"); return res; } else if(funcName == "returnInventory")//余料回库信息 { var response = HttpHelper.Post(url + "api/InboundOrder/returnInventory", data, "余料回库信息"); string res = JsonConvert.SerializeObject(response); new LogFactory().GetLog("接口").InfoFormat(true, funcName, "响应", $"{res}"); return res; } else { new LogFactory().GetLog("接口").InfoFormat(true, funcName, "响应", $"不支持该请求"); return "不支持该请求"; } } } }