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
a9cbebe2
authored
Mar 29, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整美元报价,换算汇率
parent
89582261
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
app/Model/QuoteModel.php
app/Model/QuoteModel.php
View file @
a9cbebe2
...
@@ -12,6 +12,7 @@ use App\Model\UserModel;
...
@@ -12,6 +12,7 @@ use App\Model\UserModel;
use
App\Model\InquiryItemsModel
;
use
App\Model\InquiryItemsModel
;
use
App\Model\InquiryItemsAssignModel
;
use
App\Model\InquiryItemsAssignModel
;
use
App\Model\SearchModel
;
use
App\Model\SearchModel
;
use
App\Model\CommonModel
;
use
App\Http\Controllers\PermController
;
use
App\Http\Controllers\PermController
;
use
App\Http\Controllers\ApiController
;
use
App\Http\Controllers\ApiController
;
use
RedisDB
;
use
RedisDB
;
...
@@ -259,6 +260,9 @@ class QuoteModel extends Model
...
@@ -259,6 +260,9 @@ class QuoteModel extends Model
}
}
$classArr
=
(
new
SearchModel
())
->
getClassName
(
\GuzzleHttp\json_encode
(
$param
));
$classArr
=
(
new
SearchModel
())
->
getClassName
(
\GuzzleHttp\json_encode
(
$param
));
$CommonModel
=
new
CommonModel
;
$rate
=
$CommonModel
->
getRate
();
#拼接批量插入明细
#拼接批量插入明细
foreach
(
$input
as
$k
=>&
$v
){
foreach
(
$input
as
$k
=>&
$v
){
if
(
$classArr
!==
false
){
if
(
$classArr
!==
false
){
...
@@ -270,6 +274,10 @@ class QuoteModel extends Model
...
@@ -270,6 +274,10 @@ class QuoteModel extends Model
}
}
}
}
if
(
$v
[
'currency'
]
==
2
)
{
// 美元需计算汇率(排序用)
$v
[
'price_rmb'
]
=
$rate
?
number_format
(
$v
[
'price_origin'
]
*
$rate
,
6
)
:
0
;
}
$quote_sn
=
$this
->
where
([
"inquiry_items_id"
=>
$inquiry_items_id
,
"raw_goods_sn"
=>
$v
[
"raw_goods_sn"
]])
->
value
(
"quote_sn"
);
$quote_sn
=
$this
->
where
([
"inquiry_items_id"
=>
$inquiry_items_id
,
"raw_goods_sn"
=>
$v
[
"raw_goods_sn"
]])
->
value
(
"quote_sn"
);
if
(
$quote_sn
){
#存在更新
if
(
$quote_sn
){
#存在更新
$v
[
"create_time"
]
=
time
();
$v
[
"create_time"
]
=
time
();
...
@@ -329,8 +337,10 @@ class QuoteModel extends Model
...
@@ -329,8 +337,10 @@ class QuoteModel extends Model
$quote_info
[
'brand_name'
]
=
$brand
[
0
][
'brand_name'
];
$quote_info
[
'brand_name'
]
=
$brand
[
0
][
'brand_name'
];
unset
(
$quote_info
[
'brand_s'
]);
unset
(
$quote_info
[
'brand_s'
]);
if
(
$quote_info
[
'currency'
]
==
2
)
{
// 美元时,含税单价为0
if
(
$quote_info
[
'currency'
]
==
2
)
{
$quote_info
[
'price_rmb'
]
=
0
;
$CommonModel
=
new
CommonModel
;
$rate
=
$CommonModel
->
getRate
();
$quote_info
[
'price_rmb'
]
=
$rate
?
number_format
(
$quote_info
[
'price_origin'
]
*
$rate
,
6
)
:
0
;
}
}
$params
=
[];
$params
=
[];
...
@@ -417,13 +427,16 @@ class QuoteModel extends Model
...
@@ -417,13 +427,16 @@ class QuoteModel extends Model
// 插入到报价表 -- 状态:草稿
// 插入到报价表 -- 状态:草稿
try
{
try
{
$ApiController
=
new
ApiController
;
$ApiController
=
new
ApiController
;
$CommonModel
=
new
CommonModel
;
$rate
=
$CommonModel
->
getRate
();
// 获取汇率
foreach
(
$excel
as
&
$v
)
{
foreach
(
$excel
as
&
$v
)
{
if
(
$v
[
'currency'
]
==
'RMB'
)
{
if
(
$v
[
'currency'
]
==
'RMB'
)
{
$v
[
'currency'
]
=
1
;
$v
[
'currency'
]
=
1
;
}
else
{
}
else
{
$v
[
'currency'
]
=
2
;
$v
[
'currency'
]
=
2
;
$v
[
'price_rmb'
]
=
0
;
// 美元时,含税单价为0
$v
[
'price_rmb'
]
=
$rate
?
number_format
(
$v
[
'price_origin'
]
*
$rate
,
6
)
:
0
;
}
}
$v
[
'quote_sn'
]
=
$ApiController
->
createSn
(
$this
,
'quote_sn'
,
'B'
);
$v
[
'quote_sn'
]
=
$ApiController
->
createSn
(
$this
,
'quote_sn'
,
'B'
);
...
@@ -640,6 +653,12 @@ class QuoteModel extends Model
...
@@ -640,6 +653,12 @@ class QuoteModel extends Model
$quote_info
=
$input
[
'quote_info'
];
$quote_info
=
$input
[
'quote_info'
];
if
(
$quote_info
[
'currency'
]
==
2
)
{
$CommonModel
=
new
CommonModel
;
$rate
=
$CommonModel
->
getRate
();
$quote_info
[
'price_rmb'
]
=
$rate
?
number_format
(
$quote_info
[
'price_origin'
]
*
$rate
,
6
)
:
0
;
}
$brand
=
json_decode
(
$quote_info
[
'brand_s'
],
true
);
$brand
=
json_decode
(
$quote_info
[
'brand_s'
],
true
);
$quote_info
[
'brand_id'
]
=
$brand
[
0
][
'brand_id'
];
$quote_info
[
'brand_id'
]
=
$brand
[
0
][
'brand_id'
];
...
...
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