AppSession.cs
4.47 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
using HHECS.Model.Entities;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Net.Http;
namespace HHECS.Bll
{
public class AppSession
{
public static void Init()
{
//默认是支持sqlserver,这里更改为mysql
Dapper.SimpleCRUD.SetDialect(Dapper.SimpleCRUD.Dialect.MySQL);
//赋值
AppSession.WarehouseId = int.Parse(ConfigurationManager.AppSettings["WarehouseId"]);
AppSession.WarehouseCode = ConfigurationManager.AppSettings["WarehouseCode"];
AppSession.ConnectionString = ConfigurationManager.AppSettings["ConnectionStr"];
AppSession.WmsUser = ConfigurationManager.AppSettings["WmsUser"];
AppSession.WmsPassword = ConfigurationManager.AppSettings["WmsPassword"];
AppSession.PrinterName = ConfigurationManager.AppSettings["printerName"];
AppSession.Report = ConfigurationManager.AppSettings["printerReport"];
AppSession.Interval = Convert.ToDouble(ConfigurationManager.AppSettings["interval"]);
AppSession.Bll = new DefaultBll(ConnectionString);
AppSession.LEDExcute = new LEDExcute();
AppSession.Client = AppSession.InitHttpClient();
}
public static User User { get; set; }
public static string ConnectionString { get; set; }
public static BaseBll Bll { get; set; }
public static LEDExcute LEDExcute { get; set; }
public static int WarehouseId { get; set; } = 1;
public static string WarehouseCode { get; set; }
public static string WmsUser { get; set; }
public static string WmsPassword { get; set; }
public static List<MenuOperation> MenuOperations { get; set; }
public static String PrinterName { get; set; }
public static String Report { get; set; }
/// <summary>
/// 时钟间隔
/// </summary>
public static double Interval { get; set; }
public static HttpClient Client { get; set; }
public static HttpClient InitHttpClient()
{
Uri uri = new Uri(ConfigurationManager.AppSettings["ServerUrl"]);
HttpClientHandler handler = new HttpClientHandler() { UseCookies = true };
HttpClient client = new HttpClient(handler) { BaseAddress = uri };
return client;
}
public static List<DictDetail> Urls = new List<DictDetail>()
{
// 完成任务
{ new DictDetail{ Code = "TaskComplete", Value ="wms/task/task/complete"} },
// 下发任务
{new DictDetail{ Code = "TaskExecute", Value ="wms/task/task/execute" }},
// 登陆
{new DictDetail{ Code = "Login", Value ="wms/login" }},
// wms心跳连接
{new DictDetail{ Code = "Heartbeat", Value ="wms/mobile/heartbeat" }},
// 空出处理
{new DictDetail{ Code = "HandleEmptyOut", Value ="wms/task/task/handleEmptyOut" }},
// 设置库位
{new DictDetail{ Code = "GetLocation", Value ="wms/task/task/setLocationCode" }},
//todo:完善取货错误处理接口路径
{new DictDetail{ Code = "HandleForkError", Value ="wms/task/task/createTransfer" } },
// 全自动出库
{new DictDetail{ Code = "AutoShipment", Value ="wms/shipment/shippingCombination/autoShipment" } },
// 电梯口入库
{new DictDetail{ Code = "AutoReceipCache", Value ="wms/receipt/receiving/autoReceipCache" } },
// 分拣线入库
{new DictDetail{ Code = "AutoReceipTray", Value ="wms/receipt/receiving/autoReceipTray" } },
// 分拣线入库
{new DictDetail{ Code = "Produced", Value ="wms/receipt/receiving/produced" } },
// 入空托盘
{new DictDetail{ Code = "ReceiptAirflare", Value ="wms/receipt/receiving/receiptAirflare" } },
};
//public static void SendLED(Equipment station, TaskEntity task)
//{
// switch (station.Code)
// {
// case "InStation1":
// LEDExcute.LeftInfoQueue.Enqueue(AppSession.Bll.GetTaskDetailsForLED(task));
// break;
// case "OutStation1":
// LEDExcute.RightInfoQueue.Enqueue(AppSession.Bll.GetTaskDetailsForLED(task));
// break;
// default:
// break;
// }
//}
}
}