Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-center-auto
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bltdc
data-center-auto
Commits
72a5f208
Commit
72a5f208
authored
Aug 05, 2020
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
4e49cea4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
4 deletions
+63
-4
daily.cs
AutoTurnOver.DB/daily.cs
+8
-2
report.cs
AutoTurnOver.DB/report.cs
+33
-0
dc_base_stock.cs
AutoTurnOver.Models/dc_base_stock.cs
+8
-0
DailyServices.cs
AutoTurnOver.Services/DailyServices.cs
+3
-1
CaseFlowBackgrounService.cs
ResetOutofstock/CaseFlowBackgrounService.cs
+10
-0
Program.cs
ResetOutofstock/Program.cs
+1
-1
No files found.
AutoTurnOver.DB/daily.cs
View file @
72a5f208
...
@@ -287,12 +287,15 @@ sum(t4.quantity_purchase) as 'realtime_quantity_purchase',
...
@@ -287,12 +287,15 @@ sum(t4.quantity_purchase) as 'realtime_quantity_purchase',
sum(t4.quantity_transfer) as 'realtime_quantity_transfer',
sum(t4.quantity_transfer) as 'realtime_quantity_transfer',
sum(t4.quantity_out_stock) as 'quantity_out_stock',
sum(t4.quantity_out_stock) as 'quantity_out_stock',
sum((t1.usable_stock * ifnull(t3.unit_price,0))) as 'usable_stock_amount',
sum((t1.usable_stock * ifnull(t3.unit_price,0))) as 'usable_stock_amount',
sum((ifnull(t4.quantity_purchase,0) + ifnull(t4.quantity_transfer,0)) * ifnull(t3.unit_price,0)) as 'on_the_way_stock_amount'
sum((ifnull(t4.quantity_purchase,0) + ifnull(t4.quantity_transfer,0)) * ifnull(t3.unit_price,0)) as 'on_the_way_stock_amount',
sum(ifnull(t9.sales,0)) as 'lastweek_sales',
sum(ifnull(t9.sales_amount,0)) as 'lastweek_sales_amount'
from
from
dc_base_stock as t1
dc_base_stock as t1
left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code
left join dc_base_warehouse as dbw on t1.warehouse_code = dbw.warehouse_code
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
left join dc_mid_transit as t4 on t1.bailun_sku = t4.bailun_sku and t1.warehouse_code = t4.warehouse_code
left join dc_mid_transit as t4 on t1.bailun_sku = t4.bailun_sku and t1.warehouse_code = t4.warehouse_code
left join dc_base_lastweek_data as t9 on t1.bailun_sku=t9.bailun_sku and t1.warehouse_code = t9.warehouse_code
"
;
"
;
if
(
has_tort
!=
null
)
if
(
has_tort
!=
null
)
{
{
...
@@ -332,7 +335,9 @@ t3.length as 'pack_length',
...
@@ -332,7 +335,9 @@ t3.length as 'pack_length',
t3.width as 'pack_width',
t3.width as 'pack_width',
t3.height as 'pack_height',
t3.height as 'pack_height',
LEAST(ifnull(t6.quantity_safe_inventory,0),t1.usable_stock) as 'real_quantity_safe_inventory',
LEAST(ifnull(t6.quantity_safe_inventory,0),t1.usable_stock) as 'real_quantity_safe_inventory',
t_storage.storage_quantity
t_storage.storage_quantity,
ifnull(t9.sales,0) as 'lastweek_sales',
ifnull(t9.sales_amount,0) as 'lastweek_sales_amount'
from
from
dc_base_stock as t1
dc_base_stock as t1
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
...
@@ -342,6 +347,7 @@ left join dc_base_tort as t5 on t1.bailun_sku = t5.bailun_sku
...
@@ -342,6 +347,7 @@ left join dc_base_tort as t5 on t1.bailun_sku = t5.bailun_sku
left join dc_auto_turnover as t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code
left join dc_auto_turnover as t6 on t1.bailun_sku = t6.bailun_sku and t1.warehouse_code = t6.warehouse_code
left join dc_auto_config_sku_warehouse as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
left join dc_auto_config_sku_warehouse as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
left join dc_auto_sales as t8 on t1.bailun_sku=t8.bailun_sku and t1.warehouse_code = t8.warehouse_code
left join dc_auto_sales as t8 on t1.bailun_sku=t8.bailun_sku and t1.warehouse_code = t8.warehouse_code
left join dc_base_lastweek_data as t9 on t1.bailun_sku=t9.bailun_sku and t1.warehouse_code = t9.warehouse_code
"
;
"
;
...
...
AutoTurnOver.DB/report.cs
View file @
72a5f208
...
@@ -1789,6 +1789,7 @@ where t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code;
...
@@ -1789,6 +1789,7 @@ where t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code;
"
,
commandTimeout
:
0
);
"
,
commandTimeout
:
0
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -1804,6 +1805,38 @@ where t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code;
...
@@ -1804,6 +1805,38 @@ where t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code;
}
}
//刷新上周的数据
public
static
void
ResetLastweekData
()
{
_connection
.
Execute
(
@" -- 刷新 sku 上周销量
set session transaction isolation level read uncommitted;
start transaction;
-- 清空视图表的数据
Truncate table dc_base_lastweek_data_temp;
insert into dc_base_lastweek_data_temp(`bailun_sku`, `warehouse_code`, `sales`,`sales_amount`)
select t1.bailun_sku,t1.warehouse_code,
sum(t1.bailun_sku_quantity_ordered) as 'sales',
sum(t1.bailun_sku_quantity_ordered * t1.amount_sales * t1.order_to_usd_exchange_rate) as 'sales_amount'
from dc_base_oms_sku t1
join dc_base_oms_order t2 on t1.bailun_order_id=t2.bailun_order_id and t2.has_scalp=0 and t2.has_innersale=0
left join dc_base_oms_pick t3 on t1.bailun_order_id=t3.bailun_order_id and t1.bailun_sku=t3.bailun_sku and t3.has_delete=0
left join dc_base_sku t4 on t1.bailun_sku=t4.bailun_sku
left join dc_base_sku_source t5 on t4.source = t5.source
join dc_base_warehouse t6 on t3.warehouse_code=t6.warehouse_code and t6.hq_type!='国内仓'
where t1.has_delete=0 and t1.company_id=1 and t2.bailun_order_status!='Canceled'
and (t1.platform_type!='FBA' and t1.bailun_order_status!='CantHandle')
and t2.paid_time>=@btime and t2.paid_time<@etime
GROUP BY t1.bailun_sku,t1.warehouse_code;
alter table dc_base_lastweek_data rename dc_base_lastweek_dataTemp;
alter table dc_base_lastweek_data_temp rename dc_base_lastweek_data;
alter table dc_base_lastweek_dataTemp rename dc_base_lastweek_data_temp;
truncate table dc_base_lastweek_data_temp; "
,
new
{
btime
=
DateTime
.
Now
.
AddDays
(-
7
).
GetWeekFirstDayMon
().
ToDayHome
(),
etime
=
DateTime
.
Now
.
AddDays
(-
7
).
GetWeekLastDaySun
().
ToDayEnd
()
},
commandTimeout
:
0
);
}
public
static
void
ResetCashFlowData
()
public
static
void
ResetCashFlowData
()
{
{
//现金流汇总报表,9点之前还在跑数据,不用刷新
//现金流汇总报表,9点之前还在跑数据,不用刷新
...
...
AutoTurnOver.Models/dc_base_stock.cs
View file @
72a5f208
...
@@ -170,6 +170,14 @@ namespace AutoTurnOver.Models
...
@@ -170,6 +170,14 @@ namespace AutoTurnOver.Models
/// </summary>
/// </summary>
public
decimal
storage_quantity
{
get
;
set
;
}
public
decimal
storage_quantity
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 上周销售金额
/// </summary>
public
decimal
lastweek_sales_amount
{
get
;
set
;
}
/// <summary>
/// 上周销售量
/// </summary>
public
decimal
lastweek_sales
{
get
;
set
;
}
/// <summary>
/// 安全库存
/// 安全库存
/// </summary>
/// </summary>
public
decimal
real_quantity_safe_inventory
{
get
;
set
;
}
public
decimal
real_quantity_safe_inventory
{
get
;
set
;
}
...
...
AutoTurnOver.Services/DailyServices.cs
View file @
72a5f208
...
@@ -164,7 +164,7 @@ namespace AutoTurnOver.Services
...
@@ -164,7 +164,7 @@ namespace AutoTurnOver.Services
,
"待上架"
,
"可配库存"
,
"入库数量"
,
"可配库存金额"
,
"销售可用库存(聚合)"
,
"销售可用库存(私有)"
,
"销售可用库存(共享)"
,
"在仓库存(共享)"
,
"在仓库存(私有)"
,
"在仓库存(聚合)"
,
"仓库占用(共享)"
,
"待上架"
,
"可配库存"
,
"入库数量"
,
"可配库存金额"
,
"销售可用库存(聚合)"
,
"销售可用库存(私有)"
,
"销售可用库存(共享)"
,
"在仓库存(共享)"
,
"在仓库存(私有)"
,
"在仓库存(聚合)"
,
"仓库占用(共享)"
,
"仓库占用(私有)"
,
"仓库占用(聚合)"
,
"活动占用"
,
"单占用(私有)"
,
"订单占用(共享)"
,
"订单占用(聚合)"
,
"环球更新时间"
,
"供应商"
,
"采购员"
,
"重量"
,
"单价"
,
"已发货库存"
,
"实时缺货"
,
"是否侵权"
,
,
"仓库占用(私有)"
,
"仓库占用(聚合)"
,
"活动占用"
,
"单占用(私有)"
,
"订单占用(共享)"
,
"订单占用(聚合)"
,
"环球更新时间"
,
"供应商"
,
"采购员"
,
"重量"
,
"单价"
,
"已发货库存"
,
"实时缺货"
,
"是否侵权"
,
"过去7日日均销量"
,
"过去14日日均销量"
,
"过去30日日均销量"
,
"过去7日Eaby日均销量"
,
"过去14日Eaby日均销量"
,
"过去30日Eaby日均销量"
,
"过去7日速卖通日均销量"
,
"过去14日速卖通日均销量"
,
"过去30日速卖通日均销量"
,
"过去7日日均销量"
,
"过去14日日均销量"
,
"过去30日日均销量"
,
"过去7日Eaby日均销量"
,
"过去14日Eaby日均销量"
,
"过去30日Eaby日均销量"
,
"过去7日速卖通日均销量"
,
"过去14日速卖通日均销量"
,
"过去30日速卖通日均销量"
,
"监控状态"
,
"开发时间"
,
"昨日销量"
,
"停售状态"
,
"amazon最近7天日均销量"
,
"amazon最近14天日均销量"
,
"amazon最近30天日均销量"
,
"moq"
,
"品牌"
,
"标签"
,
"类型"
,
"产品尺寸"
,
"包装尺寸"
,
"安全库存"
"监控状态"
,
"开发时间"
,
"昨日销量"
,
"停售状态"
,
"amazon最近7天日均销量"
,
"amazon最近14天日均销量"
,
"amazon最近30天日均销量"
,
"moq"
,
"品牌"
,
"标签"
,
"类型"
,
"产品尺寸"
,
"包装尺寸"
,
"安全库存"
,
"上周销量"
,
"上周销售额"
};
};
foreach
(
var
item
in
cols
)
foreach
(
var
item
in
cols
)
{
{
...
@@ -247,6 +247,8 @@ namespace AutoTurnOver.Services
...
@@ -247,6 +247,8 @@ namespace AutoTurnOver.Services
row
[
"包装尺寸"
]
=
$"
{
itemData
.
pack_length
}
-
{
itemData
.
pack_width
}
-
{
itemData
.
pack_height
}
"
;
row
[
"包装尺寸"
]
=
$"
{
itemData
.
pack_length
}
-
{
itemData
.
pack_width
}
-
{
itemData
.
pack_height
}
"
;
row
[
"安全库存"
]
=
itemData
.
real_quantity_safe_inventory
;
row
[
"安全库存"
]
=
itemData
.
real_quantity_safe_inventory
;
row
[
"上周销量"
]
=
itemData
.
lastweek_sales
;
row
[
"上周销售额"
]
=
itemData
.
lastweek_sales_amount
;
table
.
Rows
.
Add
(
row
);
table
.
Rows
.
Add
(
row
);
}
}
...
...
ResetOutofstock/CaseFlowBackgrounService.cs
View file @
72a5f208
...
@@ -21,6 +21,7 @@ namespace ResetOutofstock
...
@@ -21,6 +21,7 @@ namespace ResetOutofstock
private
void
DoWork
(
object
state
)
private
void
DoWork
(
object
state
)
{
{
var
now
=
DateTime
.
Now
;
var
now
=
DateTime
.
Now
;
if
(
now
.
Hour
==
0
&&
now
.
Minute
==
23
)
if
(
now
.
Hour
==
0
&&
now
.
Minute
==
23
)
{
{
Console
.
WriteLine
(
$"开始 刷新现金流 订单数据 (销售),线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"开始 刷新现金流 订单数据 (销售),线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
...
@@ -51,6 +52,15 @@ namespace ResetOutofstock
...
@@ -51,6 +52,15 @@ namespace ResetOutofstock
report_cash_flow_dao
.
CalculationOrderCostLogistics
(
now
.
AddMonths
(-
3
),
DateTime
.
Parse
(
now
.
AddDays
(-
1
).
ToString
(
"yyyy-MM-dd 23:59:59"
)));
report_cash_flow_dao
.
CalculationOrderCostLogistics
(
now
.
AddMonths
(-
3
),
DateTime
.
Parse
(
now
.
AddDays
(-
1
).
ToString
(
"yyyy-MM-dd 23:59:59"
)));
Console
.
WriteLine
(
$"结束 刷新订单尾程费 退款数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"结束 刷新订单尾程费 退款数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
}
if
(
now
.
Hour
==
2
&&
now
.
Minute
==
23
)
{
if
(
now
.
DayOfWeek
==
DayOfWeek
.
Monday
)
{
Console
.
WriteLine
(
$"开始 刷新上周数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
report
.
ResetLastweekData
();
Console
.
WriteLine
(
$"结束 刷新上周数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
}
if
(
now
.
Hour
==
9
&&
now
.
Minute
==
01
)
if
(
now
.
Hour
==
9
&&
now
.
Minute
==
01
)
{
{
Console
.
WriteLine
(
$"开始刷新 现金流 sku 报表 数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
Console
.
WriteLine
(
$"开始刷新 现金流 sku 报表 数据,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
...
...
ResetOutofstock/Program.cs
View file @
72a5f208
...
@@ -25,7 +25,7 @@ namespace ResetOutofstock
...
@@ -25,7 +25,7 @@ namespace ResetOutofstock
//}
//}
//report.ResetCashFlowData();
//report.ResetCashFlowData();
report
.
ResetLastweekData
();
var
builder
=
new
HostBuilder
().
ConfigureServices
((
hostContext
,
services
)
=>
var
builder
=
new
HostBuilder
().
ConfigureServices
((
hostContext
,
services
)
=>
{
{
services
.
AddHostedService
<
ResetOutofstockBackgrounService
>();
services
.
AddHostedService
<
ResetOutofstockBackgrounService
>();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment