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
d1f44cc9
Commit
d1f44cc9
authored
Dec 24, 2020
by
guanzhenshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整同步财务分类服务
parent
b0810d4a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
241 additions
and
151 deletions
+241
-151
dc_logistics_supplier_config.cs
...upplierTransaction/Models/dc_logistics_supplier_config.cs
+32
-0
Services.cs
Bailun.DC.DailyLogisticSupplierTransaction/Services.cs
+193
-136
Program.cs
Bailun.DC.SyncSkuFinanceCategory/Program.cs
+14
-14
Services.cs
Bailun.DC.SyncSkuFinanceCategory/Services.cs
+2
-1
No files found.
Bailun.DC.DailyLogisticSupplierTransaction/Models/dc_logistics_supplier_config.cs
0 → 100644
View file @
d1f44cc9
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Bailun.DC.DailyLogisticSupplierTransaction.Models
{
/// <summary>
/// 物流供应商往来供应商配置
/// </summary>
public
class
dc_logistics_supplier_config
{
public
int
id
{
get
;
set
;
}
public
string
suppliername
{
get
;
set
;
}
public
string
parentsuppliername
{
get
;
set
;
}
/// <summary>
/// 类型,1:需合并的,2:需删除不统计的
/// </summary>
public
int
type
{
get
;
set
;
}
public
DateTime
lastupdatetime
{
get
;
set
;
}
public
int
lastupdateuserid
{
get
;
set
;
}
public
string
lastupdateusername
{
get
;
set
;
}
public
int
delstatus
{
get
;
set
;
}
}
}
Bailun.DC.DailyLogisticSupplierTransaction/Services.cs
View file @
d1f44cc9
...
...
@@ -155,144 +155,204 @@ namespace Bailun.DC.DailyLogisticSupplierTransaction
return
;
}
var
listSupplierConfig
=
new
List
<
dc_logistics_supplier_config
>();
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString_read
))
{
if
(
cn
.
State
==
System
.
Data
.
ConnectionState
.
Closed
)
{
cn
.
Open
();
}
listSupplierConfig
=
cn
.
Query
<
dc_logistics_supplier_config
>(
"select * from dc_logistics_supplier_config where delstatus=0"
).
ToList
();
}
var
_sql
=
"insert dc_daily_logistics_supplier_transaction (day,supplierid,suppliername,amount_start,amount_happen,amount_pay,amount_receipt,amount_other,amount_end,createtime,lastupdatetime,lastupdateuserid,lastupdateusername) values "
;
var
s
=
""
;
//合并三通的数据
var
objSanTong
=
list
.
Where
(
a
=>
arrSanTong
.
Contains
(
a
.
suppliername
)).
ToList
();
var
tempSanTong
=
new
dc_daily_logistics_supplier_transaction
{
amount_happen
=
objSanTong
.
Count
>
0
?
objSanTong
.
Sum
(
a
=>
a
.
amount_happen
)
:
0
,
amount_pay
=
objSanTong
.
Count
>
0
?
objSanTong
.
Sum
(
a
=>
a
.
amount_pay
)
:
0
,
amount_receipt
=
objSanTong
.
Count
>
0
?
objSanTong
.
Sum
(
a
=>
a
.
amount_receipt
)
:
0
,
amount_other
=
objSanTong
.
Count
>
0
?
objSanTong
.
Sum
(
a
=>
a
.
amount_other
)
:
0
,
suppliername
=
"三通"
,
supplierid
=
0
,
amount_end
=
0
,
amount_start
=
0
,
createtime
=
DateTime
.
Now
,
day
=
list
.
FirstOrDefault
().
day
,
lastupdatetime
=
DateTime
.
Now
,
lastupdateuserid
=
0
,
lastupdateusername
=
"admin"
};
//合并Midland国际的数据
var
objMidland
=
list
.
Where
(
a
=>
arrMidland
.
Contains
(
a
.
suppliername
)).
ToList
();
var
tempMidland
=
new
dc_daily_logistics_supplier_transaction
{
amount_happen
=
arrMidland
.
Count
>
0
?
objMidland
.
Sum
(
a
=>
a
.
amount_happen
)
:
0
,
amount_pay
=
arrMidland
.
Count
>
0
?
objMidland
.
Sum
(
a
=>
a
.
amount_pay
)
:
0
,
amount_receipt
=
arrMidland
.
Count
>
0
?
objMidland
.
Sum
(
a
=>
a
.
amount_receipt
)
:
0
,
amount_other
=
arrMidland
.
Count
>
0
?
objMidland
.
Sum
(
a
=>
a
.
amount_other
)
:
0
,
suppliername
=
"Midlands Associates"
,
supplierid
=
0
,
amount_end
=
0
,
amount_start
=
0
,
createtime
=
DateTime
.
Now
,
day
=
list
.
FirstOrDefault
().
day
,
lastupdatetime
=
DateTime
.
Now
,
lastupdateuserid
=
0
,
lastupdateusername
=
"admin"
};
//合并华宇的数据
var
objHuaYu
=
list
.
Where
(
a
=>
arrHuaYu
.
Contains
(
a
.
suppliername
)).
ToList
();
var
tempHuaYu
=
new
dc_daily_logistics_supplier_transaction
{
amount_happen
=
objHuaYu
.
Count
>
0
?
objHuaYu
.
Sum
(
a
=>
a
.
amount_happen
)
:
0
,
amount_pay
=
objHuaYu
.
Count
>
0
?
objHuaYu
.
Sum
(
a
=>
a
.
amount_pay
)
:
0
,
amount_receipt
=
objHuaYu
.
Count
>
0
?
objHuaYu
.
Sum
(
a
=>
a
.
amount_receipt
)
:
0
,
amount_other
=
objHuaYu
.
Count
>
0
?
objHuaYu
.
Sum
(
a
=>
a
.
amount_other
)
:
0
,
suppliername
=
"江苏天地华宇物联科技有限公司"
,
supplierid
=
0
,
amount_end
=
0
,
amount_start
=
0
,
createtime
=
DateTime
.
Now
,
day
=
list
.
FirstOrDefault
().
day
,
lastupdatetime
=
DateTime
.
Now
,
lastupdateuserid
=
0
,
lastupdateusername
=
"admin"
};
var
objRongHeng
=
list
.
Where
(
a
=>
arrRongHeng
.
Contains
(
a
.
suppliername
)).
ToList
();
var
tempRongHeng
=
new
dc_daily_logistics_supplier_transaction
{
amount_happen
=
objRongHeng
.
Count
>
0
?
objRongHeng
.
Sum
(
a
=>
a
.
amount_happen
)
:
0
,
amount_pay
=
objRongHeng
.
Count
>
0
?
objRongHeng
.
Sum
(
a
=>
a
.
amount_pay
)
:
0
,
amount_receipt
=
objRongHeng
.
Count
>
0
?
objRongHeng
.
Sum
(
a
=>
a
.
amount_receipt
)
:
0
,
amount_other
=
objRongHeng
.
Count
>
0
?
objRongHeng
.
Sum
(
a
=>
a
.
amount_other
)
:
0
,
suppliername
=
"深圳荣恒国际物流有限公司"
,
supplierid
=
0
,
amount_end
=
0
,
amount_start
=
0
,
createtime
=
DateTime
.
Now
,
day
=
list
.
FirstOrDefault
().
day
,
lastupdatetime
=
DateTime
.
Now
,
lastupdateuserid
=
0
,
lastupdateusername
=
"admin"
};
//新增猩猩
var
objXingXing
=
list
.
Where
(
a
=>
arrXingXing
.
Contains
(
a
.
suppliername
)).
ToList
();
var
tempXingXing
=
new
dc_daily_logistics_supplier_transaction
////合并三通的数据
//var objSanTong = list.Where(a => arrSanTong.Contains(a.suppliername)).ToList();
//var tempSanTong = new dc_daily_logistics_supplier_transaction
//{
// amount_happen = objSanTong.Count > 0 ? objSanTong.Sum(a => a.amount_happen) : 0,
// amount_pay = objSanTong.Count > 0 ? objSanTong.Sum(a => a.amount_pay) : 0,
// amount_receipt = objSanTong.Count > 0 ? objSanTong.Sum(a => a.amount_receipt) : 0,
// amount_other = objSanTong.Count > 0 ? objSanTong.Sum(a => a.amount_other) : 0,
// suppliername = "三通",
// supplierid = 0,
// amount_end = 0,
// amount_start = 0,
// createtime = DateTime.Now,
// day = list.FirstOrDefault().day,
// lastupdatetime = DateTime.Now,
// lastupdateuserid = 0,
// lastupdateusername = "admin"
//};
////合并Midland国际的数据
//var objMidland = list.Where(a => arrMidland.Contains(a.suppliername)).ToList();
//var tempMidland = new dc_daily_logistics_supplier_transaction
//{
// amount_happen = arrMidland.Count > 0 ? objMidland.Sum(a => a.amount_happen) : 0,
// amount_pay = arrMidland.Count > 0 ? objMidland.Sum(a => a.amount_pay) : 0,
// amount_receipt = arrMidland.Count > 0 ? objMidland.Sum(a => a.amount_receipt) : 0,
// amount_other = arrMidland.Count > 0 ? objMidland.Sum(a => a.amount_other) : 0,
// suppliername = "Midlands Associates",
// supplierid = 0,
// amount_end = 0,
// amount_start = 0,
// createtime = DateTime.Now,
// day = list.FirstOrDefault().day,
// lastupdatetime = DateTime.Now,
// lastupdateuserid = 0,
// lastupdateusername = "admin"
//};
////合并华宇的数据
//var objHuaYu = list.Where(a => arrHuaYu.Contains(a.suppliername)).ToList();
//var tempHuaYu = new dc_daily_logistics_supplier_transaction
//{
// amount_happen = objHuaYu.Count > 0 ? objHuaYu.Sum(a => a.amount_happen) : 0,
// amount_pay = objHuaYu.Count > 0 ? objHuaYu.Sum(a => a.amount_pay) : 0,
// amount_receipt = objHuaYu.Count > 0 ? objHuaYu.Sum(a => a.amount_receipt) : 0,
// amount_other = objHuaYu.Count > 0 ? objHuaYu.Sum(a => a.amount_other) : 0,
// suppliername = "江苏天地华宇物联科技有限公司",
// supplierid = 0,
// amount_end = 0,
// amount_start = 0,
// createtime = DateTime.Now,
// day = list.FirstOrDefault().day,
// lastupdatetime = DateTime.Now,
// lastupdateuserid = 0,
// lastupdateusername = "admin"
//};
//var objRongHeng = list.Where(a => arrRongHeng.Contains(a.suppliername)).ToList();
//var tempRongHeng = new dc_daily_logistics_supplier_transaction
//{
// amount_happen = objRongHeng.Count > 0 ? objRongHeng.Sum(a => a.amount_happen) : 0,
// amount_pay = objRongHeng.Count > 0 ? objRongHeng.Sum(a => a.amount_pay) : 0,
// amount_receipt = objRongHeng.Count > 0 ? objRongHeng.Sum(a => a.amount_receipt) : 0,
// amount_other = objRongHeng.Count > 0 ? objRongHeng.Sum(a => a.amount_other) : 0,
// suppliername = "深圳荣恒国际物流有限公司",
// supplierid = 0,
// amount_end = 0,
// amount_start = 0,
// createtime = DateTime.Now,
// day = list.FirstOrDefault().day,
// lastupdatetime = DateTime.Now,
// lastupdateuserid = 0,
// lastupdateusername = "admin"
//};
////新增猩猩
//var objXingXing = list.Where(a => arrXingXing.Contains(a.suppliername)).ToList();
//var tempXingXing = new dc_daily_logistics_supplier_transaction
//{
// amount_happen = objXingXing.Count > 0 ? objXingXing.Sum(a => a.amount_happen) : 0,
// amount_pay = objXingXing.Count > 0 ? objXingXing.Sum(a => a.amount_pay) : 0,
// amount_receipt = objXingXing.Count > 0 ? objXingXing.Sum(a => a.amount_receipt) : 0,
// amount_other = objXingXing.Count > 0 ? objXingXing.Sum(a => a.amount_other) : 0,
// suppliername = "深圳市猩猩国际供应链科技有限公司",
// supplierid = 0,
// amount_end = 0,
// amount_start = 0,
// createtime = DateTime.Now,
// day = list.FirstOrDefault().day,
// lastupdatetime = DateTime.Now,
// lastupdateuserid = 0,
// lastupdateusername = "admin"
//};
////新增荣辉
//var objRongHui = list.Where(a => arrRongHui.Contains(a.suppliername)).ToList();
//var tempRongHui = new dc_daily_logistics_supplier_transaction
//{
// amount_happen = objRongHui.Count > 0 ? objRongHui.Sum(a => a.amount_happen) : 0,
// amount_pay = objRongHui.Count > 0 ? objRongHui.Sum(a => a.amount_pay) : 0,
// amount_receipt = objRongHui.Count > 0 ? objRongHui.Sum(a => a.amount_receipt) : 0,
// amount_other = objRongHui.Count > 0 ? objRongHui.Sum(a => a.amount_other) : 0,
// suppliername = "深圳市荣辉快运国际物流有限公司",
// supplierid = 0,
// amount_end = 0,
// amount_start = 0,
// createtime = DateTime.Now,
// day = list.FirstOrDefault().day,
// lastupdatetime = DateTime.Now,
// lastupdateuserid = 0,
// lastupdateusername = "admin"
//};
////去除三通、华宇、荣恒的子公司数据
//list = list.Where(a => !arrSanTong.Contains(a.suppliername) && !arrMidland.Contains(a.suppliername) && !arrHuaYu.Contains(a.suppliername) && !arrRongHeng.Contains(a.suppliername)
//&& !arrXingXing.Contains(a.suppliername)
//&& !arrRongHui.Contains(a.suppliername)
//).ToList();
////增加三通、华宇、荣恒数据到列表
//list.Add(tempSanTong);
//list.Add(tempMidland);
//list.Add(tempHuaYu);
//list.Add(tempRongHeng);
//list.Add(tempXingXing);
//list.Add(tempRongHui);
//增加新处理逻辑 读取配置表
var
listMerge
=
listSupplierConfig
.
Where
(
a
=>
a
.
type
==
1
).
ToList
().
GroupBy
(
a
=>
a
.
parentsuppliername
);
//需合并的
var
listDelete
=
listSupplierConfig
.
Where
(
a
=>
a
.
type
==
2
).
ToList
();
//需删除的
//合并处理数据
foreach
(
var
item
in
listMerge
)
{
amount_happen
=
objXingXing
.
Count
>
0
?
objXingXing
.
Sum
(
a
=>
a
.
amount_happen
)
:
0
,
amount_pay
=
objXingXing
.
Count
>
0
?
objXingXing
.
Sum
(
a
=>
a
.
amount_pay
)
:
0
,
amount_receipt
=
objXingXing
.
Count
>
0
?
objXingXing
.
Sum
(
a
=>
a
.
amount_receipt
)
:
0
,
amount_other
=
objXingXing
.
Count
>
0
?
objXingXing
.
Sum
(
a
=>
a
.
amount_other
)
:
0
,
suppliername
=
"深圳市猩猩国际供应链科技有限公司"
,
supplierid
=
0
,
amount_end
=
0
,
amount_start
=
0
,
createtime
=
DateTime
.
Now
,
day
=
list
.
FirstOrDefault
().
day
,
lastupdatetime
=
DateTime
.
Now
,
lastupdateuserid
=
0
,
lastupdateusername
=
"admin"
};
//新增荣辉
var
objRongHui
=
list
.
Where
(
a
=>
arrRongHui
.
Contains
(
a
.
suppliername
)).
ToList
();
var
tempRongHui
=
new
dc_daily_logistics_supplier_transaction
var
listObj
=
list
.
Where
(
a
=>
a
.
suppliername
==
item
.
Key
||
item
.
Select
(
a
=>
a
.
suppliername
).
Contains
(
a
.
suppliername
));
var
newObj
=
new
dc_daily_logistics_supplier_transaction
()
{
amount_happen
=
listObj
.
Count
()
>
0
?
listObj
.
Sum
(
a
=>
a
.
amount_happen
)
:
0
,
amount_pay
=
listObj
.
Count
()
>
0
?
listObj
.
Sum
(
a
=>
a
.
amount_pay
)
:
0
,
amount_receipt
=
listObj
.
Count
()
>
0
?
listObj
.
Sum
(
a
=>
a
.
amount_receipt
)
:
0
,
amount_other
=
listObj
.
Count
()
>
0
?
listObj
.
Sum
(
a
=>
a
.
amount_other
)
:
0
,
suppliername
=
item
.
Key
,
supplierid
=
0
,
amount_end
=
0
,
amount_start
=
0
,
createtime
=
DateTime
.
Now
,
day
=
list
.
FirstOrDefault
().
day
,
lastupdatetime
=
DateTime
.
Now
,
lastupdateuserid
=
0
,
lastupdateusername
=
"admin"
};
foreach
(
var
o
in
listObj
)
{
list
.
Remove
(
o
);
}
list
.
Add
(
newObj
);
}
//删除数据
foreach
(
var
item
in
listDelete
)
{
amount_happen
=
objRongHui
.
Count
>
0
?
objRongHui
.
Sum
(
a
=>
a
.
amount_happen
)
:
0
,
amount_pay
=
objRongHui
.
Count
>
0
?
objRongHui
.
Sum
(
a
=>
a
.
amount_pay
)
:
0
,
amount_receipt
=
objRongHui
.
Count
>
0
?
objRongHui
.
Sum
(
a
=>
a
.
amount_receipt
)
:
0
,
amount_other
=
objRongHui
.
Count
>
0
?
objRongHui
.
Sum
(
a
=>
a
.
amount_other
)
:
0
,
suppliername
=
"深圳市荣辉快运国际物流有限公司"
,
supplierid
=
0
,
amount_end
=
0
,
amount_start
=
0
,
createtime
=
DateTime
.
Now
,
day
=
list
.
FirstOrDefault
().
day
,
lastupdatetime
=
DateTime
.
Now
,
lastupdateuserid
=
0
,
lastupdateusername
=
"admin"
};
//去除三通、华宇、荣恒的子公司数据
list
=
list
.
Where
(
a
=>
!
arrSanTong
.
Contains
(
a
.
suppliername
)
&&
!
arrMidland
.
Contains
(
a
.
suppliername
)
&&
!
arrHuaYu
.
Contains
(
a
.
suppliername
)
&&
!
arrRongHeng
.
Contains
(
a
.
suppliername
)
&&
!
arrXingXing
.
Contains
(
a
.
suppliername
)
&&
!
arrRongHui
.
Contains
(
a
.
suppliername
)
).
ToList
();
//增加三通、华宇、荣恒数据到列表
list
.
Add
(
tempSanTong
);
list
.
Add
(
tempMidland
);
list
.
Add
(
tempHuaYu
);
list
.
Add
(
tempRongHeng
);
list
.
Add
(
tempXingXing
);
list
.
Add
(
tempRongHui
);
var
objList
=
list
.
Where
(
a
=>
a
.
suppliername
==
item
.
suppliername
);
foreach
(
var
o
in
objList
)
{
list
.
Remove
(
o
);
}
}
using
(
var
cn
=
new
MySqlConnection
(
Common
.
GlobalConfig
.
ConnectionString
))
...
...
@@ -305,9 +365,6 @@ namespace Bailun.DC.DailyLogisticSupplierTransaction
foreach
(
var
item
in
list
)
{
if
(
item
.
suppliername
==
"速卖通平台-线上物流商"
)
continue
;
//获取期初
var
sql
=
$"select * from dc_daily_logistics_supplier_transaction where suppliername='
{
item
.
suppliername
}
' and day<'
{
item
.
day
.
ToString
(
"yyyy-MM-dd"
)}
' order by day desc limit 1"
;
var
objStart
=
cn
.
QueryFirstOrDefault
<
dc_daily_logistics_supplier_transaction
>(
sql
);
...
...
Bailun.DC.SyncSkuFinanceCategory/Program.cs
View file @
d1f44cc9
...
...
@@ -11,23 +11,23 @@ namespace Bailun.DC.SyncSkuFinanceCategory
/// 同步sku财务分类
/// </summary>
/// <param name="args"></param>
//
static async Task Main(string[] args)
//
{
//
Console.WriteLine("启动服务 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
//
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
//
{
//
services.AddHostedService<Services>();
//
});
static
async
Task
Main
(
string
[]
args
)
{
Console
.
WriteLine
(
"启动服务 "
+
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
));
var
builder
=
new
HostBuilder
().
ConfigureServices
((
hostContext
,
services
)
=>
{
services
.
AddHostedService
<
Services
>();
});
//
await builder.RunConsoleAsync();
//
}
await
builder
.
RunConsoleAsync
();
}
static
void
Main
(
string
[]
args
)
{
//Console.WriteLine("Hello World!");
//
static void Main(string[] args)
//
{
//
//Console.WriteLine("Hello World!");
new
Services
().
Init
();
//
new Services().Init();
}
//
}
}
}
Bailun.DC.SyncSkuFinanceCategory/Services.cs
View file @
d1f44cc9
...
...
@@ -49,6 +49,7 @@ namespace Bailun.DC.SyncSkuFinanceCategory
public
void
Init
()
{
var
page
=
0
;
var
pagesize
=
1000
;
var
count
=
0
;
...
...
@@ -82,7 +83,7 @@ namespace Bailun.DC.SyncSkuFinanceCategory
foreach
(
var
item
in
list
)
{
cn
.
Execute
(
"delete from dc_base_sku_finance_category where bailuncategoryid="
+
item
.
bailunCategoryId
+
" and financecategoryid="
+
item
.
platCateoryId
);
cn
.
Execute
(
"delete from dc_base_sku_finance_category where bailuncategoryid="
+
item
.
bailunCategoryId
);
var
m
=
new
Models
.
dc_base_sku_finance_category
{
bailuncategoryid
=
item
.
bailunCategoryId
,
...
...
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