Commit b85aa03e by guanzhenshan

调整成品仓每日进销存服务

parent 2b1b2f1d
...@@ -7,31 +7,31 @@ namespace Bailun.DC.DailyPurchaseSellStock ...@@ -7,31 +7,31 @@ 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-07-31"); // var start = DateTime.Parse("2020-08-03");
_services.Init(start); // //_services.Init(start);
//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);
//} // }
} //}
} }
} }
...@@ -67,13 +67,13 @@ namespace Bailun.DC.DailyPurchaseSellStock ...@@ -67,13 +67,13 @@ namespace Bailun.DC.DailyPurchaseSellStock
} }
var page = 1; var page = 1;
var pagesize = 3000; var pagesize = 5000;
//昨日库存 //昨日库存
sql = $@"select t1.bailun_sku,t1.warehouse_code,t2.warehouse_name,sum(t1.usable_stock+t1.occupy_stock) count,sum((t1.usable_stock+t1.occupy_stock)*t1.unit_price) as amount from dc_daily_stock t1 sql = $@"select t1.bailun_sku,t1.warehouse_code,t2.warehouse_name,(t1.usable_stock+t1.occupy_stock) count,((t1.usable_stock+t1.occupy_stock)*t1.unit_price) as amount from dc_daily_stock t1
left join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code left join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code
where t1.record_time='{day.AddDays(-1).ToString("yyyy-MM-dd")}' group by t1.bailun_sku,t1.warehouse_code"; where t1.record_time='{day.AddDays(-1).ToString("yyyy-MM-dd")}'";
var temp = cn.Query<mStock>(sql + " limit " + (page - 1) * pagesize + "," + pagesize, null, null, true, 2 * 60); var temp = cn.Query<mStock>(sql + " limit " + (page - 1) * pagesize + "," + pagesize, null, null, true, 2 * 60);
while (temp.Count() > 0) while (temp.Count() > 0)
{ {
...@@ -85,11 +85,11 @@ namespace Bailun.DC.DailyPurchaseSellStock ...@@ -85,11 +85,11 @@ namespace Bailun.DC.DailyPurchaseSellStock
//在库库存 //在库库存
page = 1; page = 1;
pagesize = 3000; pagesize = 5000;
sql = $@"select t1.bailun_sku,t1.warehouse_code,t2.warehouse_name,sum(t1.usable_stock+t1.occupy_stock) count,sum((t1.usable_stock+t1.occupy_stock)*t1.unit_price) as amount from dc_daily_stock t1 sql = $@"select t1.bailun_sku,t1.warehouse_code,t2.warehouse_name,(t1.usable_stock+t1.occupy_stock) count,((t1.usable_stock+t1.occupy_stock)*t1.unit_price) as amount from dc_daily_stock t1
left join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code left join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code
where t1.record_time='{day.ToString("yyyy-MM-dd")}' group by t1.bailun_sku,t1.warehouse_code"; where t1.record_time='{day.ToString("yyyy-MM-dd")}'";
temp = cn.Query<mStock>(sql + " limit " + (page - 1) * pagesize + "," + pagesize, null, null, true, 2 * 60); temp = cn.Query<mStock>(sql + " limit " + (page - 1) * pagesize + "," + pagesize, null, null, true, 2 * 60);
while (temp.Count() > 0) while (temp.Count() > 0)
{ {
......
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