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
0a708dd8
Commit
0a708dd8
authored
Nov 25, 2020
by
泽锋 李
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
切换了头程渠道到采购建议,单独下单
parent
acfe36cc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
108 additions
and
35 deletions
+108
-35
purchase_advise.cs
AutoTurnOver.DB/purchase_advise.cs
+14
-2
mPlanToPurchaseDto.cs
AutoTurnOver.Models/ApiDto/mPlanToPurchaseDto.cs
+5
-0
dc_auto_purchase_advise.cs
AutoTurnOver.Models/dc_auto_purchase_advise.cs
+6
-0
PurchaseAdviseServices.cs
AutoTurnOver.Services/PurchaseAdviseServices.cs
+76
-29
PurchaseAdviseController.cs
AutoTurnOver/Controllers/PurchaseAdviseController.cs
+7
-4
No files found.
AutoTurnOver.DB/purchase_advise.cs
View file @
0a708dd8
...
...
@@ -172,7 +172,7 @@ INSERT into dc_auto_purchase_advise_detailed(`bailun_sku`,`source_warehouse_code
`product_inner_code`,`goods_quantity_init_advise`,`goods_moq`,`good_sku_codes`,`goods_history_fourteenday_sales`,`history_fourteenday_sales`,
`quantity_actual`,`main_id`,
`forecast_formula`,`fit_forecast_formula`,`turnover_days`,`supplier_delivery`,`inspection_delivery`,`transfer_delivery`,`sales_upper_limit`,`ispush`,`type`
,`suppliers_id`,`quantity_out_stock`,`purchase_type_jit`,`auto_replace_logistics_task_id`,`logistics_code`)
,`suppliers_id`,`quantity_out_stock`,`purchase_type_jit`,`auto_replace_logistics_task_id`,`logistics_code`
,`task_transport_type`
)
(
select * from (
select
...
...
@@ -221,7 +221,8 @@ select
end
) as 'purchase_type_jit',
t1.auto_replace_logistics_task_id,
tr_task.logistics_code
tr_task.logistics_code,
tr_task.transport_type as 'task_transport_type'
from dc_auto_turnover as t1
left join dc_auto_sales as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
...
...
@@ -1267,6 +1268,17 @@ select * from view_purchase_advise_supplier_price as t_price where t_price.main_
sql
+=
" and t1.purchase_type_jit =@purchase_type_jit "
;
parameters
.
Add
(
"purchase_type_jit"
,
m
.
purchase_type_jit
);
}
if
(
m
.
is_replace_logistics
!=
null
)
{
if
(
m
.
is_replace_logistics
==
1
)
{
sql
+=
" and t1.auto_replace_logistics_task_id >0 "
;
}
else
if
(
m
.
is_replace_logistics
==
0
)
{
sql
+=
" and ( t1.auto_replace_logistics_task_id <=0 or t1.auto_replace_logistics_task_id is null ) "
;
}
}
if
(
m
.
is_multiple_warehouse
)
{
...
...
AutoTurnOver.Models/ApiDto/mPlanToPurchaseDto.cs
View file @
0a708dd8
...
...
@@ -32,6 +32,11 @@ namespace AutoTurnOver.Models.ApiDto
public
int
bp_sendtype
{
get
;
set
;
}
/// <summary>
/// 头程渠道
/// </summary>
public
string
logistics_code
{
get
;
set
;
}
/// <summary>
/// 采购单类型
/// 1 = 预计缺货
/// 2 = 实际缺货
...
...
AutoTurnOver.Models/dc_auto_purchase_advise.cs
View file @
0a708dd8
...
...
@@ -186,6 +186,11 @@ namespace AutoTurnOver.Models
/// </summary>
public
string
logistics_code
{
get
;
set
;
}
/// <summary>
/// 推荐发送的运输方式
/// </summary>
public
string
task_transport_type
{
get
;
set
;
}
}
...
...
@@ -372,6 +377,7 @@ namespace AutoTurnOver.Models
/// 是否是同区多仓的sku
/// </summary>
public
bool
is_multiple_warehouse
{
get
;
set
;
}
public
int
?
is_replace_logistics
{
get
;
set
;
}
public
decimal
?
quantity_final_advise_price_min
{
get
;
set
;
}
...
...
AutoTurnOver.Services/PurchaseAdviseServices.cs
View file @
0a708dd8
...
...
@@ -106,24 +106,41 @@ namespace AutoTurnOver.Services
private
static
object
_push_lock
=
new
object
();
/// <summary>
///
把最新一批的采购单推送到采购系统
///
/// </summary>
/// <param name="type">1= 正常推送 2= 改渠道推送</param>
/// <param name="datas"></param>
/// <param name="user"></param>
/// <param name="is_skip_error">是否跳过异常</param>
public
static
void
PushBuySys
(
List
<
dc_auto_purchase_advise_detailed_dto
>
original_datas
,
UserData
user
,
bool
is_skip_error
,
string
remarks
=
""
)
public
static
void
PushBuySys
(
int
type
,
List
<
dc_auto_purchase_advise_detailed_dto
>
original_datas
,
UserData
user
,
bool
is_skip_error
,
string
remarks
=
""
)
{
lock
(
_push_lock
)
{
try
{
//查询最近一个采购建议
if
(
original_datas
==
null
)
if
(
original_datas
==
null
||
original_datas
.
Count
<=
0
)
{
return
;
}
var
json_datas
=
original_datas
.
ToJson
().
ToObject
<
List
<
dc_auto_purchase_advise_detailed_dto
>>();
var
datas
=
json_datas
;
var
datas
=
new
List
<
dc_auto_purchase_advise_detailed_dto
>();
if
(
type
==
1
)
{
var
new_remarks
=
((
remarks
??
""
)
+
"系统切换更快的头程渠道:需要审核"
);
PushBuySys
(
2
,
original_datas
,
user
,
is_skip_error
,
new_remarks
);
datas
=
json_datas
.
Where
(
s
=>
s
.
auto_replace_logistics_task_id
==
null
||
s
.
auto_replace_logistics_task_id
<=
0
).
ToList
();
}
else
if
(
type
==
2
){
datas
=
json_datas
.
Where
(
s
=>
s
.
auto_replace_logistics_task_id
>
0
).
ToList
();
}
if
(
datas
==
null
||
datas
.
Count
<=
0
)
{
return
;
}
List
<
string
>
planNos
=
new
List
<
string
>();
DateTime
now
=
DateTime
.
Now
;
// 查询未推送成功的采购建议的明细
...
...
@@ -138,33 +155,63 @@ namespace AutoTurnOver.Services
bp_sendtoCode
=
item
.
Key
.
warehouse_type
!=
"国内仓"
?
item
.
Key
.
warehouse_code
:
null
,
sys_source
=
item
.
Any
(
s
=>
s
.
type
==
2
)
?
2
:
item
.
Any
(
s
=>
s
.
type
==
1
)
?
1
:
3
,
bi_buyplandetail
=
new
List
<
bi_buyplandetail
>(),
bp_remark
=
$"用户
{
user
.
UserName
}
在 aims 操作推送-"
+
remarks
bp_remark
=
$"用户
{
user
.
UserName
}
在 aims 操作推送-"
+
remarks
,
logistics_code
=
item
.
Min
(
v
=>
v
.
logistics_code
)
};
data
.
bp_sendtype
=
data
.
bp_send
==
1
?
4
:
-
1
;
if
(
"FBA仓"
.
Equals
(
item
.
Key
.
warehouse_type
,
StringComparison
.
OrdinalIgnoreCase
)
)
if
(
type
==
1
)
{
if
(
"美国"
.
Equals
(
item
.
Key
.
area_name
,
StringComparison
.
OrdinalIgnoreCase
))
// 走旧的运输方式逻辑
data
.
bp_sendtype
=
data
.
bp_send
==
1
?
4
:
-
1
;
if
(
"FBA仓"
.
Equals
(
item
.
Key
.
warehouse_type
,
StringComparison
.
OrdinalIgnoreCase
))
{
data
.
bp_sendtype
=
2
;
}
else
if
(
"英国"
.
Equals
(
item
.
Key
.
area_name
,
StringComparison
.
OrdinalIgnoreCase
)
||
"法国"
.
Equals
(
item
.
Key
.
area_name
,
StringComparison
.
OrdinalIgnoreCase
)
||
"德国"
.
Equals
(
item
.
Key
.
area_name
,
StringComparison
.
OrdinalIgnoreCase
)
||
"意大利"
.
Equals
(
item
.
Key
.
area_name
,
StringComparison
.
OrdinalIgnoreCase
)
||
"西班牙"
.
Equals
(
item
.
Key
.
area_name
,
StringComparison
.
OrdinalIgnoreCase
)
)
if
(
"美国"
.
Equals
(
item
.
Key
.
area_name
,
StringComparison
.
OrdinalIgnoreCase
))
{
data
.
bp_sendtype
=
2
;
}
else
if
(
"英国"
.
Equals
(
item
.
Key
.
area_name
,
StringComparison
.
OrdinalIgnoreCase
)
||
"法国"
.
Equals
(
item
.
Key
.
area_name
,
StringComparison
.
OrdinalIgnoreCase
)
||
"德国"
.
Equals
(
item
.
Key
.
area_name
,
StringComparison
.
OrdinalIgnoreCase
)
||
"意大利"
.
Equals
(
item
.
Key
.
area_name
,
StringComparison
.
OrdinalIgnoreCase
)
||
"西班牙"
.
Equals
(
item
.
Key
.
area_name
,
StringComparison
.
OrdinalIgnoreCase
)
)
{
data
.
bp_sendtype
=
4
;
}
}
else
if
(
"第三方仓库"
.
Equals
(
item
.
Key
.
warehouse_type
,
StringComparison
.
OrdinalIgnoreCase
))
{
data
.
bp_sendtype
=
4
;
data
.
bp_sendtype
=
3
;
}
}
else
if
(
"第三方仓库"
.
Equals
(
item
.
Key
.
warehouse_type
,
StringComparison
.
OrdinalIgnoreCase
))
{
data
.
bp_sendtype
=
3
;
}
var
sendtype
=
item
.
Max
(
s
=>
s
.
sendtype
);
if
(
sendtype
>
0
)
var
sendtype
=
item
.
Max
(
s
=>
s
.
sendtype
);
if
(
sendtype
>
0
)
{
data
.
bp_sendtype
=
sendtype
.
Value
;
}
}
else
if
(
type
==
2
)
{
data
.
bp_sendtype
=
sendtype
.
Value
;
var
task_transport_type
=
item
.
Min
(
v
=>
v
.
task_transport_type
);
if
(
string
.
IsNullOrWhiteSpace
(
task_transport_type
))
{
throw
new
Exception
(
"命中只能切换物流的规则,未查询到运输方式"
);
}
if
(
task_transport_type
==
"海运"
)
{
data
.
bp_sendtype
=
2
;
}
else
if
(
task_transport_type
==
"空运"
)
{
data
.
bp_sendtype
=
3
;
}
else
if
(
task_transport_type
==
"陆运"
)
{
data
.
bp_sendtype
=
1
;
}
else
if
(
task_transport_type
==
"铁路运输"
)
{
data
.
bp_sendtype
=
4
;
}
}
data
.
bi_buyplandetail
=
item
.
GroupBy
(
s
=>
s
.
bailun_sku
).
Select
(
s
=>
new
bi_buyplandetail
{
...
...
@@ -264,15 +311,15 @@ namespace AutoTurnOver.Services
if
(
amazon_datas
!=
null
&&
amazon_datas
.
Count
>
0
)
{
PushBuySys
(
amazon_datas
,
user
,
is_skip_error
,
"亚马逊"
);
PushBuySys
(
1
,
amazon_datas
,
user
,
is_skip_error
,
"亚马逊"
);
}
if
(
ali_datas
!=
null
&&
ali_datas
.
Count
>
0
)
{
PushBuySys
(
ali_datas
,
user
,
is_skip_error
,
"速卖通"
);
PushBuySys
(
1
,
ali_datas
,
user
,
is_skip_error
,
"速卖通"
);
}
if
(
other_datas
!=
null
&&
other_datas
.
Count
>
0
)
{
PushBuySys
(
other_datas
,
user
,
is_skip_error
,
"其他"
);
PushBuySys
(
1
,
other_datas
,
user
,
is_skip_error
,
"其他"
);
}
}
...
...
@@ -294,11 +341,11 @@ namespace AutoTurnOver.Services
if
(
alone_datas
!=
null
&&
alone_datas
.
Count
>
0
)
{
PushBuySys
(
alone_datas
,
user
,
is_skip_error
,
"ebay+wish"
);
PushBuySys
(
1
,
alone_datas
,
user
,
is_skip_error
,
"ebay+wish"
);
}
if
(
other_datas
!=
null
&&
other_datas
.
Count
>
0
)
{
PushBuySys
(
other_datas
,
user
,
is_skip_error
,
"其他"
);
PushBuySys
(
1
,
other_datas
,
user
,
is_skip_error
,
"其他"
);
}
}
...
...
@@ -351,7 +398,7 @@ namespace AutoTurnOver.Services
}
else
{
PurchaseAdviseServices
.
PushBuySys
(
datas
,
new
UserData
{
UserName
=
"admin"
},
true
);
PurchaseAdviseServices
.
PushBuySys
(
1
,
datas
,
new
UserData
{
UserName
=
"admin"
},
true
);
}
}
...
...
AutoTurnOver/Controllers/PurchaseAdviseController.cs
View file @
0a708dd8
...
...
@@ -62,7 +62,7 @@ namespace AutoTurnOver.Controllers
[
HttpGet
]
public
string
DetailList
(
int
limit
,
int
offset
,
int
main_id
,
string
sort
,
string
sku
,
string
warehousecode
,
DateTime
?
end_date
,
DateTime
?
start_date
,
string
warehousetype
,
int
?
warehousearea
,
string
order
,
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
?
is_multiple_warehouse
=
false
,
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
?
is_multiple_warehouse
=
false
,
int
?
is_replace_logistics
=
null
,
decimal
?
quantity_final_advise_price_max
=
null
,
decimal
?
quantity_final_advise_price_min
=
null
,
int
?
purchase_type_jit
=
null
)
{
var
m
=
new
dc_auto_purchase_advise_detailed_search_dto
...
...
@@ -80,6 +80,7 @@ namespace AutoTurnOver.Controllers
purchase_user
=
purchase_user
,
product_inner_code
=
product_inner_code
,
is_multiple_warehouse
=
is_multiple_warehouse
.
Value
,
is_replace_logistics
=
is_replace_logistics
,
quantity_final_advise_price_max
=
quantity_final_advise_price_max
,
quantity_final_advise_price_min
=
quantity_final_advise_price_min
,
purchase_type_jit
=
purchase_type_jit
...
...
@@ -109,7 +110,7 @@ namespace AutoTurnOver.Controllers
[
BrowseLog
(
"Bailun_aims"
,
"访问【百伦自动周转系统】->【自动下单管理】->【采购建议列表】->【搜索】页面"
,
0
)]
public
JsonResult
DetailListSumFooter
(
int
limit
,
int
offset
,
int
main_id
,
string
sort
,
string
sku
,
string
warehousecode
,
DateTime
?
end_date
,
DateTime
?
start_date
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
is_multiple_warehouse
=
false
,
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
is_multiple_warehouse
=
false
,
int
?
is_replace_logistics
=
null
,
decimal
?
quantity_final_advise_price_max
=
null
,
decimal
?
quantity_final_advise_price_min
=
null
,
int
?
purchase_type_jit
=
null
)
{
...
...
@@ -129,6 +130,7 @@ namespace AutoTurnOver.Controllers
product_inner_code
=
product_inner_code
,
isSum
=
true
,
is_multiple_warehouse
=
is_multiple_warehouse
,
is_replace_logistics
=
is_replace_logistics
,
quantity_final_advise_price_max
=
quantity_final_advise_price_max
,
quantity_final_advise_price_min
=
quantity_final_advise_price_min
,
purchase_type_jit
=
purchase_type_jit
...
...
@@ -148,7 +150,7 @@ namespace AutoTurnOver.Controllers
/// <returns></returns>
public
FileResult
Export
(
int
limit
,
int
offset
,
int
main_id
,
string
sort
,
string
sku
,
string
warehousecode
,
DateTime
?
end_date
,
DateTime
?
start_date
,
string
warehousetype
,
int
?
warehousearea
,
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
is_multiple_warehouse
=
false
,
bool
?
ispush
=
null
,
int
?
type
=
null
,
string
supplier_name
=
null
,
string
purchase_user
=
null
,
string
product_inner_code
=
null
,
bool
is_multiple_warehouse
=
false
,
int
?
is_replace_logistics
=
null
,
decimal
?
quantity_final_advise_price_max
=
null
,
decimal
?
quantity_final_advise_price_min
=
null
,
int
?
purchase_type_jit
=
null
)
{
...
...
@@ -168,6 +170,7 @@ namespace AutoTurnOver.Controllers
product_inner_code
=
product_inner_code
,
isSum
=
false
,
is_multiple_warehouse
=
is_multiple_warehouse
,
is_replace_logistics
=
is_replace_logistics
,
quantity_final_advise_price_max
=
quantity_final_advise_price_max
,
quantity_final_advise_price_min
=
quantity_final_advise_price_min
,
purchase_type_jit
=
purchase_type_jit
...
...
@@ -326,7 +329,7 @@ namespace AutoTurnOver.Controllers
var
total
=
0
;
var
list
=
PurchaseAdviseServices
.
DetailList
(
m
,
0
,
int
.
MaxValue
,
ref
total
);
PurchaseAdviseServices
.
PushBuySys
(
list
,
AutoUtility
.
GetUser
(),
false
);
PurchaseAdviseServices
.
PushBuySys
(
1
,
list
,
AutoUtility
.
GetUser
(),
false
);
return
new
JsonResult
(
new
...
...
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