Commit b4424970 by guanzhenshan

1、调整逻辑仓库的访问链接

2、更改仓库服务的部分数据库访问链接
parent e1def719
...@@ -7,34 +7,34 @@ namespace Bailun.DC.DailyPurchaseSellStock ...@@ -7,34 +7,34 @@ namespace Bailun.DC.DailyPurchaseSellStock
{ {
class Program class Program
{ {
//static async Task Main(string[] args) static async Task Main(string[] args)
//{ {
// Console.WriteLine("启动服务 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Console.WriteLine("启动服务 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
// var builder = new HostBuilder().ConfigureServices((hostContext, services) => var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
// { {
// services.AddHostedService<Services>(); services.AddHostedService<Services>();
// }); });
// await builder.RunConsoleAsync(); await builder.RunConsoleAsync();
//} }
static void Main(string[] args) //static void Main(string[] args)
{ //{
var _services = new Services(); // var _services = new Services();
var start = DateTime.Parse("2020-09-30"); // var start = DateTime.Parse("2020-09-30");
//_services.Init(start); // //_services.Init(start);
_services.Init(start); // _services.Init(start);
return; // return;
while (start.AddDays(1) < DateTime.Now) // while (start.AddDays(1) < DateTime.Now)
{ // {
////Console.WriteLine(start); // ////Console.WriteLine(start);
////_services.Init(start); // ////_services.Init(start);
////start = start.AddDays(1); // ////start = start.AddDays(1);
} // }
} //}
} }
} }
...@@ -19,7 +19,7 @@ namespace Bailun.DC.Services ...@@ -19,7 +19,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<string> ListWareHouseType() public List<string> ListWareHouseType()
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -42,7 +42,7 @@ namespace Bailun.DC.Services ...@@ -42,7 +42,7 @@ namespace Bailun.DC.Services
{ {
var param = new DynamicParameters(); var param = new DynamicParameters();
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -112,7 +112,7 @@ namespace Bailun.DC.Services ...@@ -112,7 +112,7 @@ namespace Bailun.DC.Services
} }
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -153,7 +153,7 @@ namespace Bailun.DC.Services ...@@ -153,7 +153,7 @@ namespace Bailun.DC.Services
sqlwhere += " group by warehouse_code"; sqlwhere += " group by warehouse_code";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -188,7 +188,7 @@ namespace Bailun.DC.Services ...@@ -188,7 +188,7 @@ namespace Bailun.DC.Services
sqlparam.Add("warehouse_code", warehouse); sqlparam.Add("warehouse_code", warehouse);
} }
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -322,7 +322,7 @@ namespace Bailun.DC.Services ...@@ -322,7 +322,7 @@ namespace Bailun.DC.Services
} }
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -352,7 +352,7 @@ namespace Bailun.DC.Services ...@@ -352,7 +352,7 @@ namespace Bailun.DC.Services
{ {
var param = new DynamicParameters(); var param = new DynamicParameters();
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -380,7 +380,7 @@ namespace Bailun.DC.Services ...@@ -380,7 +380,7 @@ namespace Bailun.DC.Services
{ {
var sql = "select area_id as id,area_name as name from dc_base_warehouse where area_id is not null group by area_id "; var sql = "select area_id as id,area_name as name from dc_base_warehouse where area_id is not null group by area_id ";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -401,7 +401,7 @@ namespace Bailun.DC.Services ...@@ -401,7 +401,7 @@ namespace Bailun.DC.Services
public List<string> ListGroupName() public List<string> ListGroupName()
{ {
var sql = "select groupname from dc_sku_monitor group by groupname"; var sql = "select groupname from dc_sku_monitor group by groupname";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -421,7 +421,7 @@ namespace Bailun.DC.Services ...@@ -421,7 +421,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public dc_base_warehouse GetWarehouse(string code) public dc_base_warehouse GetWarehouse(string code)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -445,7 +445,7 @@ namespace Bailun.DC.Services ...@@ -445,7 +445,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<dc_base_warehouse> ListWarehouseFromStockAndSales(string warehousetype) public List<dc_base_warehouse> ListWarehouseFromStockAndSales(string warehousetype)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -477,7 +477,7 @@ namespace Bailun.DC.Services ...@@ -477,7 +477,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<dc_mid_warehouse_redundancy> ListWarehouseRedundancy(BtTableParameter request, string warehousetype, string warehousecode,DateTime? day,ref int total) public List<dc_mid_warehouse_redundancy> ListWarehouseRedundancy(BtTableParameter request, string warehousetype, string warehousecode,DateTime? day,ref int total)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -527,7 +527,7 @@ namespace Bailun.DC.Services ...@@ -527,7 +527,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public dc_mid_warehouse_redundancy ListWarehouseRedundancyCount(string warehousetype, string warehousecode,DateTime? day) public dc_mid_warehouse_redundancy ListWarehouseRedundancyCount(string warehousetype, string warehousecode,DateTime? day)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -570,7 +570,7 @@ namespace Bailun.DC.Services ...@@ -570,7 +570,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<List<dc_mid_skuwarehouse_redundancy>> GetSkuRedundancy(string warehousecode,DateTime day) public List<List<dc_mid_skuwarehouse_redundancy>> GetSkuRedundancy(string warehousecode,DateTime day)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if(cn.State== System.Data.ConnectionState.Closed) if(cn.State== System.Data.ConnectionState.Closed)
{ {
...@@ -614,7 +614,7 @@ namespace Bailun.DC.Services ...@@ -614,7 +614,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<dc_mid_skuwarehouse_redundancy> GetSkuRedundancyByType(string warehousecode, DateTime day, int? t) public List<dc_mid_skuwarehouse_redundancy> GetSkuRedundancyByType(string warehousecode, DateTime day, int? t)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -666,7 +666,7 @@ namespace Bailun.DC.Services ...@@ -666,7 +666,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<dc_mid_warehouse_redundancy> ListOver60DaysWarehouseRedundancy(string warehousecode, DateTime start, DateTime end) public List<dc_mid_warehouse_redundancy> ListOver60DaysWarehouseRedundancy(string warehousecode, DateTime start, DateTime end)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -696,7 +696,7 @@ namespace Bailun.DC.Services ...@@ -696,7 +696,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<dc_mid_sku_profit> ListWarehouseProfit(BtTableParameter parameter, string skucategoryids, string warehousecode,ref int total) public List<dc_mid_sku_profit> ListWarehouseProfit(BtTableParameter parameter, string skucategoryids, string warehousecode,ref int total)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if(cn.State== System.Data.ConnectionState.Closed) if(cn.State== System.Data.ConnectionState.Closed)
{ {
...@@ -760,7 +760,7 @@ namespace Bailun.DC.Services ...@@ -760,7 +760,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public dc_mid_sku_profit ListWarehouseProfitCount(string skucategoryids, string warehousecode) public dc_mid_sku_profit ListWarehouseProfitCount(string skucategoryids, string warehousecode)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -816,7 +816,7 @@ namespace Bailun.DC.Services ...@@ -816,7 +816,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<dc_mid_sku_profit> ListSkuProfit(BtTableParameter parameter, string skucategoryids, string warehousecode, ref int total) public List<dc_mid_sku_profit> ListSkuProfit(BtTableParameter parameter, string skucategoryids, string warehousecode, ref int total)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -924,7 +924,7 @@ namespace Bailun.DC.Services ...@@ -924,7 +924,7 @@ namespace Bailun.DC.Services
} }
sql += " limit "+(parameter.pageIndex-1)*parameter.limit+","+parameter.limit; sql += " limit "+(parameter.pageIndex-1)*parameter.limit+","+parameter.limit;
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -974,7 +974,7 @@ namespace Bailun.DC.Services ...@@ -974,7 +974,7 @@ namespace Bailun.DC.Services
} }
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -1016,7 +1016,7 @@ namespace Bailun.DC.Services ...@@ -1016,7 +1016,7 @@ namespace Bailun.DC.Services
sql += " group by t1.day,t2.category_simple_name"; sql += " group by t1.day,t2.category_simple_name";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -1052,7 +1052,7 @@ namespace Bailun.DC.Services ...@@ -1052,7 +1052,7 @@ namespace Bailun.DC.Services
sql += " group by t1.day"; sql += " group by t1.day";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -1085,7 +1085,7 @@ namespace Bailun.DC.Services ...@@ -1085,7 +1085,7 @@ namespace Bailun.DC.Services
sql += " group by t1.warehouse_name"; sql += " group by t1.warehouse_name";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -1103,7 +1103,7 @@ namespace Bailun.DC.Services ...@@ -1103,7 +1103,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<Tuple<string, string>> ListSemiWareHouse() public List<Tuple<string, string>> ListSemiWareHouse()
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -1142,7 +1142,7 @@ namespace Bailun.DC.Services ...@@ -1142,7 +1142,7 @@ namespace Bailun.DC.Services
sql += " order by day"; sql += " order by day";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -1179,7 +1179,7 @@ namespace Bailun.DC.Services ...@@ -1179,7 +1179,7 @@ namespace Bailun.DC.Services
sql += " order by day"; sql += " order by day";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -1296,7 +1296,7 @@ namespace Bailun.DC.Services ...@@ -1296,7 +1296,7 @@ namespace Bailun.DC.Services
#endregion #endregion
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
...@@ -1322,7 +1322,7 @@ namespace Bailun.DC.Services ...@@ -1322,7 +1322,7 @@ namespace Bailun.DC.Services
/// <returns></returns> /// <returns></returns>
public List<Models.Api.mSkuStock> ListSkuStock(List<string> skus) public List<Models.Api.mSkuStock> ListSkuStock(List<string> skus)
{ {
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment