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
1d59400f
Commit
1d59400f
authored
Feb 18, 2021
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重新计算付款天数
parent
fa80dcd0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
12 deletions
+40
-12
dc_base_order_data_source.cs
AutoTurnOver.Models/dc_base_order_data_source.cs
+6
-1
AverageTargetBackgrounService.cs
...r.Purchase.AverageTarget/AverageTargetBackgrounService.cs
+1
-1
Program.cs
AutoTurnOver.Purchase.AverageTarget/Program.cs
+1
-1
PurchaseAverageTargetServices.cs
AutoTurnOver.Services/PurchaseAverageTargetServices.cs
+32
-9
No files found.
AutoTurnOver.Models/dc_base_order_data_source.cs
View file @
1d59400f
...
...
@@ -27,6 +27,11 @@ namespace AutoTurnOver.Models
public
DateTime
?
shipping_time
{
get
;
set
;
}
public
DateTime
?
create_date
{
get
;
set
;
}
/// <summary>
/// 付款天数
/// </summary>
public
int
?
pay_days
{
get
;
set
;
}
}
...
...
@@ -60,7 +65,7 @@ namespace AutoTurnOver.Models
{
public
int
order_type
{
get
;
set
;
}
public
string
order_type_str
{
get
{
if
(
order_type
==
11
)
if
(
order_type
==
11
||
order_type
==
14
)
{
return
"采购单-签收天数计算"
;
}
...
...
AutoTurnOver.Purchase.AverageTarget/AverageTargetBackgrounService.cs
View file @
1d59400f
...
...
@@ -37,7 +37,7 @@ namespace AutoTurnOver.Purchase.AverageTarget
try
{
Console
.
WriteLine
(
$"开始 init2 ,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
//
PurchaseAverageTargetServices.Calculation(days:360);
PurchaseAverageTargetServices
.
Calculation
(
days
:
360
);
Console
.
WriteLine
(
$"结束 init2,线程Id:
{
Thread
.
CurrentThread
.
ManagedThreadId
}
,
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
"
);
}
catch
(
Exception
ex
)
...
...
AutoTurnOver.Purchase.AverageTarget/Program.cs
View file @
1d59400f
...
...
@@ -31,7 +31,7 @@ namespace AutoTurnOver.Purchase.AverageTarget
//PurchaseAverageTargetServices.CalculationTransfer();
//report.ResetTransExpectArrivaltime();
//dc_auto_return_goods_config_dao.NewCalculation();
//PurchaseAverageTargetServices.Calculation("94
2517
901", days: 360);
//PurchaseAverageTargetServices.Calculation("94
6590
901", days: 360);
//PurchaseAverageTargetServices.CalculationTransfer("942517901", 360);
}
catch
(
Exception
ex
)
...
...
AutoTurnOver.Services/PurchaseAverageTargetServices.cs
View file @
1d59400f
...
...
@@ -142,22 +142,27 @@ where t1.bailun_sku=@bailun_sku and t1.warehouse_code=@warehouse_code and t1.isp
// 计算平均到货天数
// 计算总交期
int
delivery_days
=
0
;
int
sum_pay_days
=
0
;
int
sum_pay_day_count
=
0
;
foreach
(
var
itemArrivalList
in
purchaseList
.
GroupBy
(
s
=>
s
.
purchase_id
))
{
var
tempPurchase
=
purchaseList
.
SingleOrDefault
(
s
=>
s
.
purchase_id
==
itemArrivalList
.
Key
);
var
temp_s_delivery_days
=
0
;
var
pay_days
=
0
;
if
(
tempPurchase
.
pay_type
==
1
)
{
temp_s_delivery_days
=
(
int
)
Math
.
Ceiling
((
itemArrivalList
.
Min
(
s
=>
s
.
last_signtime
)
-
tempPurchase
.
pay_time
).
Value
.
TotalHours
/
24
);
pay_days
=
(
int
)
Math
.
Ceiling
((
tempPurchase
.
pay_time
-
tempPurchase
.
create_time
).
Value
.
TotalHours
/
24
);
sum_pay_day_count
++;
}
else
{
temp_s_delivery_days
=
(
int
)
Math
.
Ceiling
((
itemArrivalList
.
Min
(
s
=>
s
.
last_signtime
)
-
tempPurchase
.
confirm_time
).
Value
.
TotalHours
/
24
);
}
delivery_days
+=
temp_s_delivery_days
;
sum_pay_days
+=
pay_days
;
conn
.
Insert
(
new
dc_base_order_data_source
{
...
...
@@ -177,7 +182,8 @@ where t1.bailun_sku=@bailun_sku and t1.warehouse_code=@warehouse_code and t1.isp
pay_time
=
tempPurchase
.
pay_time
,
pay_type
=
(
tempPurchase
.
pay_type
==
1
?
"先款后货"
:
"先货后款"
),
sign_time
=
itemArrivalList
.
Min
(
s
=>
s
.
last_signtime
),
put_time
=
(
inboundList
.
OrderByDescending
(
s
=>
s
.
update_time
).
FirstOrDefault
(
s
=>
s
.
purchase_id
==
itemArrivalList
.
Key
)
??
new
Models
.
dc_base_purchase
.
dc_base_purchase_inbound_dto
()).
update_time
put_time
=
(
inboundList
.
OrderByDescending
(
s
=>
s
.
update_time
).
FirstOrDefault
(
s
=>
s
.
purchase_id
==
itemArrivalList
.
Key
)
??
new
Models
.
dc_base_purchase
.
dc_base_purchase_inbound_dto
()).
update_time
,
pay_days
=
pay_days
});
}
...
...
@@ -185,6 +191,7 @@ where t1.bailun_sku=@bailun_sku and t1.warehouse_code=@warehouse_code and t1.isp
// 平均采购交期
var
temp_delivery_days
=
delivery_days
/
purchaseList
.
Count
;
data
.
delivery_days
=
temp_delivery_days
;
data
.
payment_type
=
sum_pay_days
/
sum_pay_day_count
;
data
.
virtual_delivery_days
=
temp_delivery_days
;
data
.
payment_type
=
purchaseList
.
Any
(
s
=>
s
.
pay_type
==
1
)
?
1
:
2
;
...
...
@@ -211,16 +218,18 @@ where t1.bailun_sku=@bailun_sku and t1.warehouse_code=@warehouse_code and t1.isp
}
else
{
if
(
has_jit
)
{
data
.
payment_type
=
2
;
// 先货后款
}
// 不够3个单,不该有平均数
// 不够5个单不算这个值
var
sku_sign_days
=
WriteConfig
(
conn
,
skuItem
,
has_jit
);
var
sku_sign_days
=
WriteConfig
(
conn
,
skuItem
,
data
.
payment_type
,
has_jit
);
data
.
delivery_days
=
(
int
)
sku_sign_days
;
data
.
supplier_name
=
""
;
if
(
has_jit
)
{
data
.
payment_type
=
2
;
// 先货后款
}
AveragePurchase
.
Save
(
data
,
conn
);
}
...
...
@@ -243,8 +252,21 @@ where t1.bailun_sku=@bailun_sku and t1.warehouse_code=@warehouse_code and t1.isp
public
string
no
{
get
;
set
;
}
}
public
static
decimal
WriteConfig
(
MyMySqlConnection
conn
,
temp_sku_dto
skuItem
,
bool
has_jit
)
/// <summary>
///
/// </summary>
/// <param name="conn"></param>
/// <param name="skuItem"></param>
/// <param name="pay_type">付款方式 1= 先款后货 2 = 先货后款</param>
/// <param name="has_jit"></param>
/// <returns></returns>
public
static
decimal
WriteConfig
(
MyMySqlConnection
conn
,
temp_sku_dto
skuItem
,
int
pay_type
,
bool
has_jit
)
{
var
pay_days
=
0
;
if
(
pay_type
==
1
)
{
pay_days
=
1
;
}
var
sku_sign_days
=
0
M
;
if
(
has_jit
)
{
...
...
@@ -279,7 +301,8 @@ where t1.bailun_sku=@bailun_sku and t1.warehouse_code=@warehouse_code and t1.isp
order_type
=
"采购单-签收天数计算"
,
put_days
=
0
,
sign_days
=
sku_sign_days
,
transport_type
=
""
transport_type
=
""
,
pay_days
=
pay_days
});
return
sku_sign_days
;
...
...
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