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
4297beb5
Commit
4297beb5
authored
Aug 07, 2019
by
lizefeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
计算采购平均值的时候,如果是美甲jit的产品,交期定死3天,入库定死1天
parent
4e758eff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
AveragePurchase.cs
AutoTurnOver.DB/AveragePurchase.cs
+4
-1
PurchaseAverageTargetServices.cs
AutoTurnOver.Services/PurchaseAverageTargetServices.cs
+20
-4
No files found.
AutoTurnOver.DB/AveragePurchase.cs
View file @
4297beb5
...
@@ -24,8 +24,9 @@ namespace AutoTurnOver.DB
...
@@ -24,8 +24,9 @@ namespace AutoTurnOver.DB
{
{
DynamicParameters
parameters
=
new
DynamicParameters
();
DynamicParameters
parameters
=
new
DynamicParameters
();
parameters
.
Add
(
"time"
,
DateTime
.
Now
.
AddDays
(
0
-
day
).
ToString
(
"yyyy-MM-dd 00:00:00"
));
parameters
.
Add
(
"time"
,
DateTime
.
Now
.
AddDays
(
0
-
day
).
ToString
(
"yyyy-MM-dd 00:00:00"
));
return
_connection
.
Query
<
temp_sku_dto
>(
@"select t2.hq_type,t1.bailun_sku,t1.warehouse_code,t1.supplier_id from dc_base_purchase as t1
return
_connection
.
Query
<
temp_sku_dto
>(
@"select t2.hq_type,t1.bailun_sku,t1.warehouse_code,t1.supplier_id
,t3.buyer_name
from dc_base_purchase as t1
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
where t1.supplier_id>0 and buy_status=4
where t1.supplier_id>0 and buy_status=4
-- and EXISTS ( select * from dc_base_stock as t2 where t1.bailun_sku =t2.bailun_sku and t1.warehouse_code = t2.warehouse_code)
-- and EXISTS ( select * from dc_base_stock as t2 where t1.bailun_sku =t2.bailun_sku and t1.warehouse_code = t2.warehouse_code)
-- and t1.bailun_sku='366628401' and t1.warehouse_code='GZBLWH'
-- and t1.bailun_sku='366628401' and t1.warehouse_code='GZBLWH'
...
@@ -273,5 +274,7 @@ and t_w.hq_type!='国内仓'
...
@@ -273,5 +274,7 @@ and t_w.hq_type!='国内仓'
public
int
?
supplier_id
{
get
;
set
;
}
public
int
?
supplier_id
{
get
;
set
;
}
public
string
hq_type
{
get
;
set
;
}
public
string
hq_type
{
get
;
set
;
}
public
string
buyer_name
{
get
;
set
;
}
}
}
}
}
...
...
AutoTurnOver.Services/PurchaseAverageTargetServices.cs
View file @
4297beb5
...
@@ -40,6 +40,9 @@ namespace AutoTurnOver.Services
...
@@ -40,6 +40,9 @@ namespace AutoTurnOver.Services
var
chageSkuList
=
AveragePurchase
.
GetChangeSku
(
30
);
var
chageSkuList
=
AveragePurchase
.
GetChangeSku
(
30
);
foreach
(
var
skuItem
in
chageSkuList
)
foreach
(
var
skuItem
in
chageSkuList
)
{
{
// 判断是否jit
var
has_jit
=
((
skuItem
.
buyer_name
==
"张莹霞"
||
skuItem
.
buyer_name
==
"张莹霞1"
)
&&
skuItem
.
warehouse_code
==
"GZBLWH"
);
dc_average_purchase
data
=
new
dc_average_purchase
()
dc_average_purchase
data
=
new
dc_average_purchase
()
{
{
bailun_sku
=
skuItem
.
bailun_sku
,
bailun_sku
=
skuItem
.
bailun_sku
,
...
@@ -99,10 +102,13 @@ namespace AutoTurnOver.Services
...
@@ -99,10 +102,13 @@ namespace AutoTurnOver.Services
data
.
virtual_delivery_days
=
temp_delivery_days
;
data
.
virtual_delivery_days
=
temp_delivery_days
;
data
.
payment_type
=
purchaseList
.
Any
(
s
=>
s
.
pay_type
==
1
)
?
1
:
2
;
data
.
payment_type
=
purchaseList
.
Any
(
s
=>
s
.
pay_type
==
1
)
?
1
:
2
;
if
(
has_jit
)
{
data
.
delivery_days
=
3
;
data
.
payment_type
=
2
;
// 先货后款
}
//写入数据库
//写入数据库
AveragePurchase
.
Save
(
data
,
conn
);
AveragePurchase
.
Save
(
data
,
conn
);
task_log
.
Count
++;
task_log
.
Count
++;
...
@@ -111,7 +117,13 @@ namespace AutoTurnOver.Services
...
@@ -111,7 +117,13 @@ namespace AutoTurnOver.Services
{
{
// 不够3个单,不该有平均数
// 不够3个单,不该有平均数
data
.
delivery_days
=
-
1
;
data
.
delivery_days
=
-
1
;
data
.
supplier_name
=
""
;
data
.
supplier_name
=
""
;
if
(
has_jit
)
{
data
.
delivery_days
=
3
;
data
.
payment_type
=
2
;
// 先货后款
}
AveragePurchase
.
Save
(
data
,
conn
);
AveragePurchase
.
Save
(
data
,
conn
);
}
}
...
@@ -163,6 +175,10 @@ namespace AutoTurnOver.Services
...
@@ -163,6 +175,10 @@ namespace AutoTurnOver.Services
dataWarehouse
.
abroad_inbound_delivery
=
(
decimal
)
transport3List
.
Sum
(
s
=>
(
s
.
inbound_time
-
s
.
arrival_time
).
TotalDays
)
/
transport3List
.
Count
();
dataWarehouse
.
abroad_inbound_delivery
=
(
decimal
)
transport3List
.
Sum
(
s
=>
(
s
.
inbound_time
-
s
.
arrival_time
).
TotalDays
)
/
transport3List
.
Count
();
}
}
if
(
has_jit
)
{
dataWarehouse
.
inbound_days
=
1
;
}
AveragePurchase
.
Save
(
dataWarehouse
,
conn
);
AveragePurchase
.
Save
(
dataWarehouse
,
conn
);
}
}
...
...
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