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
ff292939
authored
Mar 05, 2021
by
hcy001
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1
parent
d7438df8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
22 deletions
app/Http/Controllers/ApiController.php
app/Model/InquiryItemsModel.php
app/Model/InquiryModel.php
app/Http/Controllers/ApiController.php
View file @
ff292939
...
...
@@ -110,16 +110,16 @@ class ApiController extends Controller
}
//添加询价
private
function
ApiAddInquiry
(
$
reques
t
,
$id
){
(
new
CommonModel
())
->
UserList
(
$request
->
input
(
'k'
));
private
function
ApiAddInquiry
(
$
inpu
t
,
$id
){
Export
((
new
InquiryModel
())
->
addInquiry
(
$input
));
}
//生成报价/销售 询价单
private
function
ApiAddInquiryReport
(
$request
,
$id
){
(
new
InquiryItemsReportModel
())
->
addOffer
();
}
//
清空
询价列表
private
function
ApiDeleteInquiryItems
(
$
reques
t
,
$id
){
Export
((
new
InquiryItemsModel
())
->
DeleteInquiryItems
(
$
request
->
input
(
'inquiry_id'
),
$this
->
user_id
));
//
删除
询价列表
private
function
ApiDeleteInquiryItems
(
$
inpu
t
,
$id
){
Export
((
new
InquiryItemsModel
())
->
DeleteInquiryItems
(
$
input
));
}
//导出询价
...
...
app/Model/InquiryItemsModel.php
View file @
ff292939
...
...
@@ -126,14 +126,14 @@ class InquiryItemsModel extends Model
}
//清空列表
public
function
DeleteInquiryItems
(
$inquiry_id
,
$create_uid
){
$check
=
(
new
InquiryModel
())
->
where
([
"inquiry_id"
=>
$inquiry_id
,
"create_uid"
=>
$create_uid
])
->
first
();
if
(
!
$check
){
return
[
1001
,
"不存在数据"
];
}
else
{
$del
=
$this
->
where
([
"inquiry_id"
=>
$inquiry_id
])
->
delete
();
return
[
0
,
"删除成功"
];
public
function
DeleteInquiryItems
(
$input
){
if
(
@
$input
[
"inquiry_id"
]){
$del
=
$this
->
where
([
"inquiry_id"
=>
$input
[
"inquiry_id"
]])
->
delete
();
}
if
(
@
$input
[
"inquiry_items_id"
]){
$del
=
$this
->
where
([
"id"
=>
$input
[
"inquiry_items_id"
]])
->
delete
();
}
return
[
0
,
"删除成功"
];
}
/*
...
...
@@ -254,21 +254,18 @@ class InquiryItemsModel extends Model
*/
public
function
updateItems
(
$b
){
$inquiry_items_id
=
@
$b
[
"inquiry_items_id"
]
?
$b
[
"inquiry_items_id"
]
:
""
;
if
(
$inquiry_items_id
){
if
(
!
$inquiry_items_id
){
return
[
1001
,
"修改明细ID不得为空"
];
}
try
{
$con
=
DB
::
connection
(
'rfq'
);
$con
->
beginTransaction
();
$InquiryItemsAssignModel
=
(
new
InquiryItemsAssignModel
());
#更新明细
$assignInsert
=
[];
#指定领取人
$brandInfo
=
json_decode
(
$b
[
"brand_s"
]);
$brandInfo
=
json_decode
(
$b
[
"brand_s"
],
true
);
$b
[
"brand_id"
]
=
$brandInfo
[
0
][
"brand_id"
];
$b
[
"brand_name"
]
=
$brandInfo
[
0
][
"brand_name"
];
$purArr
=
json_decode
(
$b
[
"pur_s"
]);
#指定采购
$updateArr
=
[
"goods_name"
=>@
$b
[
"goods_name"
]
?
$b
[
"goods_name"
]
:
""
,
"brand_id"
=>@
$b
[
"brand_id"
]
?
$b
[
"brand_id"
]
:
0
,
...
...
@@ -290,7 +287,9 @@ class InquiryItemsModel extends Model
$InquiryItemsAssignModel
->
where
(
"inquiry_items_id"
,
$inquiry_items_id
)
->
delete
();
#插入采购
if
(
count
(
$purArr
)
>
0
){
if
(
@
$b
[
"pur_s"
]
!=
""
){
$purArr
=
json_decode
(
$b
[
"pur_s"
],
true
);
#指定采购
$assignInsert
=
[];
#指定领取人
foreach
(
$purArr
as
$b
=>
$c
){
array_push
(
$assignInsert
,[
"inquiry_items_id"
=>
$inquiry_items_id
,
...
...
@@ -299,10 +298,9 @@ class InquiryItemsModel extends Model
"create_time"
=>
time
(),
]);
}
}
if
(
count
(
$assignInsert
)
>
0
){
#插入指定人
$InquiryItemsAssignModel
->
insert
(
$assignInsert
);
if
(
count
(
$assignInsert
)
>
0
){
#插入指定人
$InquiryItemsAssignModel
->
insert
(
$assignInsert
);
}
}
$con
->
commit
();
...
...
app/Model/InquiryModel.php
View file @
ff292939
...
...
@@ -304,6 +304,24 @@ class InquiryModel extends Model
}
}
//从草稿生成正式询价单
public
function
addInquiry
(
$input
){
if
(
empty
(
$input
[
"inquiry_id"
]))
return
[
1001
,
"缺少询价单号"
];
if
(
empty
(
$input
[
"customer_name"
]))
return
[
1001
,
"请选择询价客户名称"
];
if
(
empty
(
$input
[
"delivery_place"
]))
return
[
1002
,
"请选择交货地"
];
$data
=
[
"status"
=>
1
,
#启用
"delivery_place"
=>
$input
[
"delivery_place"
],
"customer_uid"
=>
$input
[
"customer_uid"
],
"customer_name"
=>
$input
[
"customer_name"
],
"create_time"
=>
time
(),
"update_time"
=>
time
(),
];
$check
=
$inqueryId
=
$this
->
where
(
"id"
,
$input
[
"inquiry_id"
])
->
update
(
$data
);
return
[
0
,
"新增询价成功"
];
}
}
\ No newline at end of file
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