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
64479bb8
authored
Mar 26, 2021
by
hcy001
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1
parent
f919c11d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
30 deletions
app/Model/InquiryItemsModel.php
app/Model/InquiryItemsReportModel.php
app/Model/InquiryModel.php
app/Model/QuoteModel.php
app/Model/InquiryItemsModel.php
View file @
64479bb8
...
@@ -356,6 +356,7 @@ class InquiryItemsModel extends Model
...
@@ -356,6 +356,7 @@ class InquiryItemsModel extends Model
$con
->
beginTransaction
();
$con
->
beginTransaction
();
$assignInsert
=
[];
#指定领取人
$assignInsert
=
[];
#指定领取人
$c
=
0
;
#重复
foreach
(
$goodsData
[
1
]
as
$k
=>&
$b
){
foreach
(
$goodsData
[
1
]
as
$k
=>&
$b
){
$insertArr
=
[
$insertArr
=
[
...
@@ -377,7 +378,13 @@ class InquiryItemsModel extends Model
...
@@ -377,7 +378,13 @@ class InquiryItemsModel extends Model
#判断是否已经存在此品牌+型号
#判断是否已经存在此品牌+型号
$check
=
$this
->
where
([
"inquiry_id"
=>
$inquiry_id
,
"goods_name"
=>
$b
[
"goods_name"
],
"brand_name"
=>
$b
[
"brand_name"
]])
->
count
();
$check
=
$this
->
where
([
"inquiry_id"
=>
$inquiry_id
,
"goods_name"
=>
$b
[
"goods_name"
],
"brand_name"
=>
$b
[
"brand_name"
]])
->
count
();
if
(
$check
>
0
){
if
(
$check
>
0
){
throw
new
Exception
(
"型号:"
.
$b
[
"goods_name"
]
.
" 品牌:"
.
$b
[
"brand_name"
]
.
"不得重复上传"
);
$c
++
;
continue
;
#throw new Exception("型号:".$b["goods_name"]." 品牌:".$b["brand_name"]."不得重复上传");
}
if
(
count
(
$goodsData
[
1
])
==
$c
){
throw
new
Exception
(
"所有数据都存在重复!"
);
}
}
...
@@ -470,8 +477,9 @@ class InquiryItemsModel extends Model
...
@@ -470,8 +477,9 @@ class InquiryItemsModel extends Model
$b2
[
"inquiry_id"
]
=
$inquiry_id
;
$b2
[
"inquiry_id"
]
=
$inquiry_id
;
$hang
=
$a2
+
2
;
#对应excel第几行
$hang
=
$a2
+
2
;
#对应excel第几行
$lie
=
0
;
foreach
(
$b2
as
$key
=>
$val
)
{
foreach
(
$b2
as
$key
=>
$val
)
{
$lie
=
$
key
+
1
;
$lie
=
$
lie
+
1
;
$str_msg
=
'第'
.
$hang
.
'行'
.
$lie
.
'列:'
;
$str_msg
=
'第'
.
$hang
.
'行'
.
$lie
.
'列:'
;
if
(
in_array
(
$key
,
$filer_need
)
&&
empty
(
$val
))
{
if
(
in_array
(
$key
,
$filer_need
)
&&
empty
(
$val
))
{
$err
[]
=
$str_msg
.
'数据不得为空'
;
$err
[]
=
$str_msg
.
'数据不得为空'
;
...
...
app/Model/InquiryItemsReportModel.php
View file @
64479bb8
...
@@ -112,18 +112,19 @@ class InquiryItemsReportModel extends Model
...
@@ -112,18 +112,19 @@ class InquiryItemsReportModel extends Model
}
}
/*
/*
* 选中或者确定报价
* 选中或者确定
报价
*/
*/
public
function
OpQuote
(
$data
){
public
function
OpQuote
(
$data
){
$inquiry_items_id
=
$data
[
"inquiry_items_id"
];
#询价明细id
$inquiry_items_id
=
$data
[
"inquiry_items_id"
];
#询价明细id
$quote_id
=
$data
[
"quote_id"
];
#报价id
$quote_id
=
$data
[
"quote_id"
];
#报价id
$status
=
$data
[
"status"
];
#状态: 2 选中 3 确定
$price
=
@
$data
[
"price"
]
?
$data
[
"price"
]
:
0
;
#销售报价
if
(
$inquiry_items_id
<=
0
)
return
[
1001
,
"询价明细ID不得为空"
];
if
(
$inquiry_items_id
<=
0
)
return
[
1001
,
"询价明细ID不得为空"
];
if
(
$quote_id
<=
0
)
return
[
1001
,
"报价ID不得为空"
];
if
(
$quote_id
<=
0
)
return
[
1001
,
"报价ID不得为空"
];
$price
=
@
$data
[
"price"
]
?
$data
[
"price"
]
:
0
;
#销售报价
$QuoteModel
=
new
QuoteModel
();
$QuoteModel
=
new
QuoteModel
();
$InquiryItemsModel
=
new
InquiryItemsModel
();
$quoteItem
=
$QuoteModel
->
where
(
"id"
,
$quote_id
)
->
first
()
->
toArray
();
$quoteItem
=
$QuoteModel
->
where
(
"id"
,
$quote_id
)
->
first
()
->
toArray
();
$currency
=
$quoteItem
[
"currency"
];
#报价币种
$currency
=
$quoteItem
[
"currency"
];
#报价币种
...
@@ -131,6 +132,19 @@ class InquiryItemsReportModel extends Model
...
@@ -131,6 +132,19 @@ class InquiryItemsReportModel extends Model
$mainCurrency
=
$inquiry
[
"currency"
];
#询价主单币种
$mainCurrency
=
$inquiry
[
"currency"
];
#询价主单币种
$rate
=
(
new
CommonModel
())
->
getRate
(
"美元"
);
#获取美元汇率
$rate
=
(
new
CommonModel
())
->
getRate
(
"美元"
);
#获取美元汇率
$itemInfo
=
$InquiryItemsModel
->
select
(
"status"
)
->
where
(
"id"
,
$inquiry_items_id
)
->
first
()
->
toArray
();
#询价明细
if
(
$status
==
1
){
#撤销
$InquiryItemsModel
->
where
(
"id"
,
$inquiry_items_id
)
->
update
([
"status"
=>
1
]);
#更新报价待报价
#更新关联除了当前询价单 此询价明细的报价单状态
$QuoteModel
->
where
(
"inquiry_items_id"
,
$inquiry_items_id
)
->
update
([
"status"
=>
1
]);
#重启其他所有状态为 已报价
return
[
0
,
"撤销成功"
];
}
if
(
$status
==
2
&&
$itemInfo
[
"status"
]
==
5
){
#选中之前判断有没有确定的报价
return
[
1007
,
"请先撤销已确认的报价"
];
}
$price_rmb
=
$price_origin
=
""
;
$price_rmb
=
$price_origin
=
""
;
if
(
$mainCurrency
==
1
){
#询价币种人民币
if
(
$mainCurrency
==
1
){
#询价币种人民币
$price_rmb
=
$currency
!=
$mainCurrency
?
round
(
$price
*
$rate
,
6
)
:
$price
;
$price_rmb
=
$currency
!=
$mainCurrency
?
round
(
$price
*
$rate
,
6
)
:
$price
;
...
@@ -157,10 +171,12 @@ class InquiryItemsReportModel extends Model
...
@@ -157,10 +171,12 @@ class InquiryItemsReportModel extends Model
#更新报价报表
#更新报价报表
(
new
InquiryItemsReportModel
())
->
where
(
"inquiry_items_id"
,
$inquiry_items_id
)
->
update
(
$temp
);
(
new
InquiryItemsReportModel
())
->
where
(
"inquiry_items_id"
,
$inquiry_items_id
)
->
update
(
$temp
);
#更新报价单
#更新当前报价单状态
(
new
QuoteModel
())
->
where
(
"id"
,
$data
[
"quote_id"
])
->
update
([
"status"
=>
$data
[
"status"
]]);
#更新报价选中
$QuoteModel
->
where
(
"id"
,
$data
[
"quote_id"
])
->
update
([
"status"
=>
$status
]);
#更新报价选中
#更新关联除了当前询价单 此询价明细的报价单状态
$QuoteModel
->
where
(
"inquiry_items_id"
,
$inquiry_items_id
)
->
whereNotIn
(
"id"
,[
$quote_id
])
->
update
([
"status"
=>
1
]);
#重启其他所有状态为 已报价
#更新询价明细表状态
#更新询价明细表状态
(
new
InquiryItemsModel
())
->
where
(
"id"
,
$inquiry_items_id
)
->
update
([
"status"
=>
$
data
[
"status"
]
==
2
?
3
:
5
]);
(
new
InquiryItemsModel
())
->
where
(
"id"
,
$inquiry_items_id
)
->
update
([
"status"
=>
$
status
==
2
?
3
:
5
]);
return
[
0
,
"成功"
];
return
[
0
,
"成功"
];
}
}
...
...
app/Model/InquiryModel.php
View file @
64479bb8
...
@@ -135,7 +135,7 @@ class InquiryModel extends Model
...
@@ -135,7 +135,7 @@ class InquiryModel extends Model
$currency_sign
=
$v
[
'currency'
]
==
1
?
'¥'
:
'$'
;
$currency_sign
=
$v
[
'currency'
]
==
1
?
'¥'
:
'$'
;
$v
[
'target_price'
]
=
$currency_sign
.
$v
[
'target_price'
];
// 客户目标报价
$v
[
'target_price'
]
=
$currency_sign
.
$v
[
'target_price'
]
.
"
\t
"
;
// 客户目标报价
#查询所有报价
#查询所有报价
$v
[
'quote_price'
]
=
"--"
;
$v
[
'quote_price'
]
=
"--"
;
...
...
app/Model/QuoteModel.php
View file @
64479bb8
...
@@ -700,37 +700,28 @@ class QuoteModel extends Model
...
@@ -700,37 +700,28 @@ class QuoteModel extends Model
->
count
();
->
count
();
}
}
//询价:
选中 撤销 确认 -》
报价
//询价:
撤销
报价
public
function
updateStatus
(
$input
)
public
function
updateStatus
(
$input
)
{
{
$id
=
$input
[
'id'
];
$
quote_
id
=
$input
[
'id'
];
$status
=
$input
[
'status'
];
$status
=
$input
[
'status'
];
if
(
!
$id
)
return
[
-
1
,
'参数缺失'
];
if
(
!
$
quote_
id
)
return
[
-
1
,
'参数缺失'
];
try
{
try
{
$QuoteModel
=
new
QuoteModel
();
$InquiryItemsModel
=
new
InquiryItemsModel
();
$rqpConn
=
DB
::
connection
(
'rfq'
);
$info
=
$QuoteModel
->
select
(
"inquiry_items_id"
)
->
where
(
"id"
,
$quote_id
)
->
first
()
->
toArray
();
$res
=
$this
->
where
(
'id'
,
$id
)
->
update
([
'status'
=>
$status
,
'update_time'
=>
time
()]);
$inquiry_items_id
=
$info
[
"inquiry_items_id"
];
$quote_info
=
$this
->
find
(
$id
);
#更新询价明细表状态
#更新询价明细表状态
$inquiry_items_id
=
$quote_info
[
"inquiry_items_id"
];
$InquiryItemsModel
->
where
(
"id"
,
$inquiry_items_id
)
->
update
([
"status"
=>
1
,
'update_time'
=>
time
()]);
#更新报价待报价
$sql
=
"select status from lie_quote where inquiry_items_id=
$inquiry_items_id
and status in (1,2,3) and id not in (
$id
)"
;
#更新
$has
=
$rqpConn
->
select
(
$sql
);
$QuoteModel
->
where
(
"inquiry_items_id"
,
$inquiry_items_id
)
->
update
([
"status"
=>
2
,
'update_time'
=>
time
()]);
#重启其他所有状态为 已报价
$check
=
1
;
if
(
$has
){
$check
=
0
;
}
if
(
$check
){
(
new
InquiryItemsModel
())
->
where
(
"id"
,
$quote_info
[
"inquiry_items_id"
])
->
update
([
"status"
=>
$status
]);
}
$data
=
[];
$data
=
[];
$data
[
'types'
]
=
1
;
$data
[
'types'
]
=
1
;
$data
[
'relation_id'
]
=
$id
;
$data
[
'relation_id'
]
=
$inquiry_items_id
;
$data
[
'relation_sn'
]
=
$quote_info
[
'quote_sn'
];
$data
[
'content'
]
=
'撤销报价:'
.
QuoteMap
::
$status
[
$status
];
$data
[
'content'
]
=
'询价操作报价:'
.
QuoteMap
::
$status
[
$status
];
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_uid'
]
=
$input
[
'user_id'
];
$data
[
'create_name'
]
=
$input
[
"user_name"
];
$data
[
'create_name'
]
=
$input
[
"user_name"
];
...
...
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