PDA
dengjunjie
2024-12-24 45af2754d00347ec86492707e15b3884557ee851
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
 
using SqlSugar;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO.BasicInfo;
 
namespace WIDESEAWCS_Server.HostedService
{
    public class WarehouseHostedService : IHostedService
    {
        public Task StartAsync(CancellationToken cancellationToken)
        {
            string connStr = AppSettings.GetValue("WMSConnectionStrings");
            if (string.IsNullOrEmpty(connStr))
            {
                throw new Exception("WMS连接字符串错误");
            }
            SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig()
            {
                ConnectionString = connStr,
                IsAutoCloseConnection = true,
                DbType = DbType.SqlServer
            });
 
            List<WarehouseDTO> warehouses = sugarClient.Queryable<WarehouseDTO>().ToList();
 
            return Task.CompletedTask;
        }
 
        public Task StopAsync(CancellationToken cancellationToken)
        {
            throw new NotImplementedException();
        }
    }
}