Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DataCenter_Core2.1_20190520
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
DataCenter_Core2.1_20190520
Commits
d03d4726
Commit
d03d4726
authored
Sep 14, 2020
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
逻辑仓库服务增加可用天数的数据更新
parent
5a653f91
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
0 deletions
+57
-0
Program.cs
Bailun.DC.LogicWareHouse/Program.cs
+2
-0
Services.cs
Bailun.DC.LogicWareHouse/Services.cs
+55
-0
No files found.
Bailun.DC.LogicWareHouse/Program.cs
View file @
d03d4726
...
@@ -38,6 +38,8 @@ namespace Bailun.DC.LogicWareHouse
...
@@ -38,6 +38,8 @@ namespace Bailun.DC.LogicWareHouse
// //new Services().UpdateLogicWareHouseSemiSale();
// //new Services().UpdateLogicWareHouseSemiSale();
// //new Services().SaleWHDailySnaps();
// //new Services().SaleWHDailySnaps();
// new Services().UpdateAvailableDays();
//}
//}
}
}
}
}
Bailun.DC.LogicWareHouse/Services.cs
View file @
d03d4726
...
@@ -120,6 +120,9 @@ namespace Bailun.DC.LogicWareHouse
...
@@ -120,6 +120,9 @@ namespace Bailun.DC.LogicWareHouse
//更新30天现金流
//更新30天现金流
UpdateCash30Days
();
UpdateCash30Days
();
//更新逻辑仓的可用天数
UpdateAvailableDays
();
//保存每日数据快照
//保存每日数据快照
SaleWHDailySnaps
();
SaleWHDailySnaps
();
...
@@ -411,6 +414,56 @@ namespace Bailun.DC.LogicWareHouse
...
@@ -411,6 +414,56 @@ namespace Bailun.DC.LogicWareHouse
}
}
/// <summary>
/// <summary>
/// 更新逻辑仓库表的可用天数
/// </summary>
public
void
UpdateAvailableDays
()
{
Console
.
WriteLine
(
"【启动】更新逻辑仓库表的可用天数服务 "
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
try
{
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
var
sql
=
"TRUNCATE dc_mid_logicwh_availabledays;"
;
cn
.
Execute
(
sql
);
//半成品的可用天数
sql
=
@"insert into dc_mid_logicwh_availabledays (bailun_sku,warehouse_code,hq_type,available_days)
select sku as bailun_sku,warehouse_id as warehouse_code,'半成品仓' as hq_type,available_days from dc_semi_stock_sales_shipping where available_days>0;"
;
cn
.
Execute
(
sql
,
null
,
null
,
6
*
60
);
//成品的可用天数
sql
=
@"insert into dc_mid_logicwh_availabledays (bailun_sku,warehouse_code,hq_type,available_days)
select bailun_sku,t1.warehouse_code,t2.hq_type,available_days from dc_base_stock t1
left join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code
where available_days>0;"
;
cn
.
Execute
(
sql
,
null
,
null
,
6
*
60
);
//更新逻辑仓的可用天数
sql
=
@"update dc_skuwarehouse_stock_sales t1
join dc_mid_logicwh_availabledays t2 on t1.bailun_sku=t2.bailun_sku and t1.warehouse_code=t2.warehouse_code
set t1.available_days=t2.available_days"
;
cn
.
Execute
(
sql
,
null
,
null
,
6
*
60
);
}
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
"更新逻辑仓库表的可用天数服务失败,异常信息:"
+
ex
.
Message
);
UpdateAvailableDays
();
}
Console
.
WriteLine
(
"【完成】更新逻辑仓库表的可用天数服务 "
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
}
/// <summary>
/// 保存每日数据快照
/// 保存每日数据快照
/// </summary>
/// </summary>
public
void
SaleWHDailySnaps
()
public
void
SaleWHDailySnaps
()
...
@@ -451,5 +504,7 @@ select DATE_SUB(curdate(),INTERVAL 1 DAY) as day,t1.* from (select t1.hq_type,t1
...
@@ -451,5 +504,7 @@ select DATE_SUB(curdate(),INTERVAL 1 DAY) as day,t1.* from (select t1.hq_type,t1
}
}
}
}
}
}
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