duyongjia
2024-12-29 9a0acba23c5b5095be2a89b8ca190fe5202c2ea6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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
{
    /// <summary>
    /// WebService1 的摘要说明
    /// </summary>
    [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
    {
 
       
        /// <summary>
        /// 上游WMS系统调用立库WMS接口
        /// </summary>
        /// <returns></returns>
        [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<freezeByCustomerResponse>(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<InventoryQueryResponse>(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<ReturnInventoryResponse>(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 "不支持该请求";
            }
 
        }
 
    }
}