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
e954e034
Commit
e954e034
authored
Dec 14, 2022
by
lizefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
投资回报分析的 单位头程费取值,由最近2个月,改成最近5单
parent
522d955f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
15 deletions
+22
-15
report_invest_return_dao.cs
AutoTurnOver.DB/report_invest_return_dao.cs
+21
-14
Program.cs
ResetOutofstock/Program.cs
+1
-1
No files found.
AutoTurnOver.DB/report_invest_return_dao.cs
View file @
e954e034
...
...
@@ -300,7 +300,7 @@ namespace AutoTurnOver.DB
}
//计算单位运费
ana
.
freight_unit_price
=
CalculationFreight
(
ana
.
sku
,
ana
.
warehouse_code
,
day30Btime
.
AddDays
(-
30
*
5
),
dayEtime
);
ana
.
freight_unit_price
=
CalculationFreight
(
ana
.
sku
,
ana
.
warehouse_code
);
//预估运费,库存 * 单位运费
ana
.
estimated_freight
=
ana
.
freight_unit_price
*
ana
.
stock
;
...
...
@@ -422,7 +422,7 @@ namespace AutoTurnOver.DB
/// <summary>
/// 计算单位运费
/// </summary>
public
static
decimal
CalculationFreight
(
string
bailun_sku
,
string
warehouse_code
,
DateTime
btime
,
DateTime
etime
)
public
static
decimal
CalculationFreight
(
string
bailun_sku
,
string
warehouse_code
)
{
// 清理运费计算日志
_connection
.
Execute
(
" delete from dc_base_transfer_freight_new_order where main_bailun_sku=@bailun_sku and warehouse_code=@warehouse_code "
,
new
...
...
@@ -430,7 +430,16 @@ namespace AutoTurnOver.DB
bailun_sku
=
bailun_sku
,
warehouse_code
=
warehouse_code
});
var
top5DataIds
=
_connection
.
Query
<
string
>(
$@" select dataid from dc_base_transfer_info where
dataid in ( select dataid from dc_base_transfer_info_skus where sku=@sku )
and isdeleted=0
and isexception = 0
and estimatedcost>0
and targetwareno=@warehouse_code
order by creationtime desc limit 5 "
,
new
{
sku
=
bailun_sku
,
warehouse_code
=
warehouse_code
}).
ToList
();
if
(
top5DataIds
!=
null
&&
top5DataIds
.
Count
>=
1
)
{
// 查询这个sku 时间范围内所有的调拨单明细
var
tempDatas
=
_connection
.
Query
<
CalculationFreightDto
>(
$@"select t2.sku ,
t1.`code`,
...
...
@@ -442,17 +451,9 @@ from dc_base_transfer_info as t1
left join dc_base_transfer_info_skus as t2 on t1.dataid = t2.dataid
left join ( select dataid,sum(deliverycount) as 'deliverycount' from dc_base_transfer_info_skus GROUP BY dataid ) as t3 on t1.dataid = t3.dataid
left join dc_base_sku as t4 on t2.sku = t4.bailun_sku
where t1.isdeleted=0
and t1.isexception = 0
and t1.creationtime >=@btime and t1.creationtime <=@etime
and t1.targetwareno=@warehouse_code
and t1.estimatedcost>0
and t1.dataid in ( select dataid from dc_base_transfer_info_skus where sku=@sku)"
,
new
{
btime
=
btime
,
etime
=
etime
,
warehouse_code
=
warehouse_code
,
sku
=
bailun_sku
where t1.dataid in @dataIds"
,
new
{
dataIds
=
top5DataIds
},
commandTimeout
:
0
).
ToList
();
if
(
tempDatas
!=
null
&&
tempDatas
.
Count
>=
1
)
...
...
@@ -485,7 +486,7 @@ and t1.dataid in ( select dataid from dc_base_transfer_info_skus where sku=@sku
groupOrders
.
Add
(
new_order
);
}
var
cha
=
(
sumCost
-
groupOrders
.
Sum
(
s
=>
s
.
sku_cost
));
if
(
cha
>
0
)
if
(
cha
>
0
)
{
var
topSkuOrder
=
groupOrders
.
OrderByDescending
(
s
=>
s
.
order_cost
).
FirstOrDefault
();
...
...
@@ -532,6 +533,12 @@ and t1.dataid in ( select dataid from dc_base_transfer_info_skus where sku=@sku
return
0
;
}
}
else
{
return
0
;
}
}
public
class
CalculationFreightDto
{
...
...
ResetOutofstock/Program.cs
View file @
e954e034
...
...
@@ -48,7 +48,7 @@ namespace ResetOutofstock
// report_invest_return_dao.SynchBtmAdFees();
//report_invest_return_dao.ShareAdFee();
//report_invest_return_dao.SynchBtmOrderRefund();
//
report_invest_return_dao.CalculationStockScore();
report_invest_return_dao
.
CalculationStockScore
();
}
catch
(
Exception
ex
)
{
...
...
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