Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄成意
/
php_frq_api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4e2b4e09
authored
Apr 27, 2021
by
杜文军
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
导出已领取询价单
parent
9a1ddb07
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
0 deletions
app/Http/Controllers/ApiController.php
app/Http/Controllers/ServerController.php
app/Model/ExportModel.php
app/Model/InquiryItemsModel.php
app/Model/InquiryModel.php
app/Http/Controllers/ApiController.php
View file @
4e2b4e09
...
@@ -177,6 +177,12 @@ class ApiController extends Controller
...
@@ -177,6 +177,12 @@ class ApiController extends Controller
private
function
ApiInquiryExport
(
$input
){
private
function
ApiInquiryExport
(
$input
){
(
new
ExportModel
())
->
InquiryExport
(
$input
,
$this
->
user_id
);
(
new
ExportModel
())
->
InquiryExport
(
$input
,
$this
->
user_id
);
}
}
private
function
ApiReceiveInquiryExport
(
$input
)
{
(
new
ExportModel
())
->
MyReceiveInquiryExport
(
$input
,
$this
->
user_id
);
}
//生成报价pdf
//生成报价pdf
private
function
ApiOfferPdf
(
$request
){
private
function
ApiOfferPdf
(
$request
){
(
new
CommonModel
())
->
Pdf
();
(
new
CommonModel
())
->
Pdf
();
...
...
app/Http/Controllers/ServerController.php
View file @
4e2b4e09
...
@@ -41,11 +41,55 @@ class ServerController extends Controller
...
@@ -41,11 +41,55 @@ class ServerController extends Controller
$server
->
addMethod
(
'InquiryServer'
,
$this
);
$server
->
addMethod
(
'InquiryServer'
,
$this
);
$server
->
handle
();
$server
->
handle
();
}
}
public
function
InquiryServer
(
$info
){
public
function
InquiryServer
(
$info
){
$res
=
(
new
InquiryModel
())
->
getList
(
json_decode
(
$info
,
true
),
1
);
$res
=
(
new
InquiryModel
())
->
getList
(
json_decode
(
$info
,
true
),
1
);
return
ExportLayuiReturn
(
$res
);
return
ExportLayuiReturn
(
$res
);
}
}
public
function
MyReceiveInquiryExport
()
{
$server
=
new
Hprose\Http\Service
();
$server
->
addMethod
(
'MyReceiveInquiryServer'
,
$this
);
$server
->
handle
();
}
public
function
MyReceiveInquiryServer
(
$info
){
$params
=
json_decode
(
$info
,
true
);
$inquiry_item_ids
=
explode
(
","
,
$params
[
'inquiry_item_ids'
]);
$inquiry_item_ids
=
array_values
(
array_filter
(
$inquiry_item_ids
));
$data
=
[];
$InquiryItemsModel
=
new
InquiryItemsModel
();
$inquire_item_list
=
$InquiryItemsModel
->
GetInquireItemsListByIds
(
$inquiry_item_ids
);
if
(
$inquire_item_list
&&
is_array
(
$inquire_item_list
)){
$inquiry_ids
=
array_column
(
$inquire_item_list
,
'inquiry_id'
);
$InquiryModel
=
new
InquiryModel
();
$inquire_list
=
$InquiryModel
->
GetInquiryListByIds
(
$inquiry_ids
);
$inquire_info_map
=
array_combine
(
array_column
(
$inquire_list
,
'id'
),
$inquire_list
);
foreach
(
$inquire_item_list
as
$inquire_item_info
){
$data
[]
=
[
"inquiry_item_id"
=>
(
int
)
$inquire_item_info
[
'id'
],
"goods_name"
=>
(
string
)
$inquire_item_info
[
'goods_name'
],
"brand_name"
=>
(
string
)
$inquire_item_info
[
'brand_name'
],
"inquiry_number"
=>
(
int
)
$inquire_item_info
[
'inquiry_number'
],
"target_price"
=>
$inquire_item_info
[
'target_price'
],
"delivery_place"
=>
(
int
)
$inquire_info_map
[
$inquire_item_info
[
'inquiry_id'
]][
'delivery_place'
],
"delivery_time"
=>
(
int
)
$inquire_item_info
[
'delivery_time'
],
"supplier_name"
=>
''
,
"currency"
=>
''
,
"price_origin"
=>
''
,
"price_rmb"
=>
''
,
"price_other"
=>
''
,
"batch"
=>
''
,
"quote_delivery_time"
=>
''
,
];
}
}
$res
=
[
0
,
'成功'
,
$data
,
count
(
$inquiry_item_ids
)];
return
ExportLayuiReturn
(
$res
);
}
//下载pdf文件
//下载pdf文件
private
function
DownPdf
(
$input
,
$id
){
private
function
DownPdf
(
$input
,
$id
){
$filename
=
base_path
()
.
"/public/pdf/"
.
$input
[
"file_name"
];
$filename
=
base_path
()
.
"/public/pdf/"
.
$input
[
"file_name"
];
...
...
app/Model/ExportModel.php
View file @
4e2b4e09
...
@@ -63,5 +63,24 @@ class ExportModel
...
@@ -63,5 +63,24 @@ class ExportModel
echo
self
::
push
(
$data
);
echo
self
::
push
(
$data
);
}
}
public
function
MyReceiveInquiryExport
(
$input
,
$create_uid
){
$input
[
"is_export"
]
=
1
;
#导出状态
$header
=
[
"明细id"
,
"型号"
,
"品牌"
,
"数量"
,
"目标价"
,
"交货地"
,
"交货时间"
,
"供应商"
,
"报价币种"
,
"单价"
,
"含税价格"
,
"采购费"
,
"批次"
,
"交期"
];
$file_name
=
"已领取的询价"
;
$data
=
[
"type"
=>
2
,
# 类型 1:模板调用 2: api回调
"source_items_id"
=>
config
(
"website.export_source_items_id"
),
#来源明细id,必填
"file_name"
=>
$file_name
,
"excel_suf"
=>
"csv"
,
#导出文件格式 csv,xls
"header"
=>
$header
,
"query_param"
=>
$input
,
#查询参数
"callbackurl"
=>
$this
->
frqApiUrl
.
"/server/MyReceiveInquiryExport"
,
#rpc回调网址
"callbackfuc"
=>
"InquiryServer"
,
#rpc回调函数
"create_uid"
=>
$create_uid
,
#创建人id
];
echo
self
::
push
(
$data
);
}
}
}
\ No newline at end of file
app/Model/InquiryItemsModel.php
View file @
4e2b4e09
...
@@ -25,6 +25,12 @@ class InquiryItemsModel extends Model
...
@@ -25,6 +25,12 @@ class InquiryItemsModel extends Model
return
strtotime
(
parent
::
fromDateTime
(
$value
));
return
strtotime
(
parent
::
fromDateTime
(
$value
));
}
}
public
function
GetInquireItemsListByIds
(
$ids
)
{
return
$this
->
whereIn
(
"id"
,
$ids
)
->
get
()
->
toArray
();
}
//生成报价单详情
//生成报价单详情
public
function
ItemsOfferDetail
(
$inquiry_id
)
public
function
ItemsOfferDetail
(
$inquiry_id
)
{
{
...
...
app/Model/InquiryModel.php
View file @
4e2b4e09
...
@@ -20,6 +20,12 @@ class InquiryModel extends Model
...
@@ -20,6 +20,12 @@ class InquiryModel extends Model
protected
$primaryKey
=
'id'
;
protected
$primaryKey
=
'id'
;
public
$timestamps
=
false
;
public
$timestamps
=
false
;
public
function
GetInquiryListByIds
(
$ids
)
{
return
$this
->
whereIn
(
"id"
,
$ids
)
->
get
()
->
toArray
();
}
/**
/**
* 询价列表
* 询价列表
*/
*/
...
...
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