Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
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
83d3f890
authored
Aug 04, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
up
parent
c6a09efc
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
266 additions
and
2 deletions
app/Http/Controllers/BomApiController.php
app/Http/Controllers/WebController.php
app/Model/Bom/BomItemMatchModel.php
app/Model/Bom/BomItemModel.php
app/Services/Bom/BomService.php
public/js/web/BomUploadFile.js
resources/views/web/BomUploadFile.blade.php
resources/views/web/BomView.blade.php
app/Http/Controllers/BomApiController.php
View file @
83d3f890
...
...
@@ -99,6 +99,16 @@ class BomApiController extends Controller{
return
$this
->
ajaxReturn
(
$res
[
'errcode'
],
$res
[
'errmsg'
],
$res
[
'data'
]);
}
/*
* 下载文件
*
*/
public
function
BomUploadFile
(
$request
,
$id
){
$list
=
$this
->
bomService
->
BomUploadFile
(
$request
);
// dump($list);
return
$this
->
LayuiAjaxReturn
(
0
,
"ok"
,
$list
[
"data"
],
$list
[
"total"
]);
}
}
\ No newline at end of file
app/Http/Controllers/WebController.php
View file @
83d3f890
...
...
@@ -7,6 +7,10 @@ use App\Map\PcbOrderInvoiceMap;
use
App\Map\PcbOrderMap
;
use
App\Map\PcbOrderShippingMap
;
use
App\Map\PcbPurchaseMap
;
use
App\Model\Bom\BomItemMatchModel
;
use
App\Model\Bom\BomItemModel
;
use
App\Model\Bom\BomModel
;
use
App\Model\Bom\BomOrderModel
;
use
App\Model\PaymentDaysModel
;
use
App\Model\Pcb\PcbOrderModel
;
use
App\Model\Pcb\PcbPublicModel
;
...
...
@@ -339,6 +343,12 @@ class WebController extends Controller
{
$data
[
'title'
]
=
'BOM单详情'
;
$data
[
"bom_id"
]
=
$request
->
input
(
"bom_id"
,
0
);
$bomInfo
=
BomModel
::
where
([
"bom_id"
=>
intval
(
$data
[
"bom_id"
])])
->
first
();
$bomInfo
->
add_order_amount
=
BomOrderModel
::
where
([
"bom_id"
=>
$bomInfo
->
bom_id
])
->
sum
(
"add_order_amount"
);
$bomInfo
->
matchingOrderAmount
=
BomItemMatchModel
::
getBomitemMatchingAmount
(
$bomInfo
->
bom_id
);
$bomInfo
->
bomItemsCount
=
BomItemModel
::
getBomItemsCount
(
$data
[
"bom_id"
]);
$bomInfo
->
getBomitemMatchingSucCount
=
BomItemMatchModel
::
getBomitemMatchingSucCount
(
$bomInfo
->
bom_id
);
$data
[
"bomInfo"
]
=
$bomInfo
;
return
view
(
'web'
,
$data
);
}
...
...
@@ -350,4 +360,12 @@ class WebController extends Controller
return
view
(
'web'
,
$data
);
}
//bom源文件管理
public
function
BomUploadFile
(
$request
,
$data
,
$id
)
{
$data
[
'title'
]
=
'bom源文件管理'
;
return
view
(
'web'
,
$data
);
}
}
app/Model/Bom/BomItemMatchModel.php
View file @
83d3f890
...
...
@@ -117,8 +117,22 @@ class BomItemMatchModel extends BomItemMatchBaseModel{
return
$amount
;
}
/*
* 获取匹配成功的金额
*/
public
static
function
getBomitemMatchingAmount
(
$bom_id
=
0
){
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
$amount
=
self
::
suffix
(
$suffix
)
->
where
([
"bom_id"
=>
$bom_id
,
"status"
=>
1
])
->
selectRaw
(
"sum(price*number) as amount"
)
->
first
();
return
$amount
?
$amount
->
amount
:
0
;
}
/*
* 获取匹配完成的数量
*/
public
static
function
getBomitemMatchingSucCount
(
$bom_id
=
0
){
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
return
self
::
suffix
(
$suffix
)
->
where
([
"bom_id"
=>
$bom_id
,
"status"
=>
1
])
->
count
(
"matching_id"
);
}
}
\ No newline at end of file
app/Model/Bom/BomItemModel.php
View file @
83d3f890
...
...
@@ -87,7 +87,13 @@ class BomItemModel extends BomItemMatchBaseModel{
/*
* 获取客户总共型号数量
*/
public
static
function
getBomItemsCount
(
$bom_id
=
0
){
$suffix
=
substr
(
strrev
(
$bom_id
),
0
,
1
);
return
self
::
suffix
(
$suffix
)
->
where
([
"del_status"
=>
1
,
"bom_id"
=>
$bom_id
])
->
count
(
"bom_item_id"
);
}
...
...
app/Services/Bom/BomService.php
View file @
83d3f890
...
...
@@ -826,4 +826,17 @@ class BomService {
}
}
public
function
BomUploadFile
(
$request
){
$page
=
$request
->
input
(
"page"
,
1
);
$limit
=
$request
->
input
(
"limit"
,
10
);
$bom_name
=
$request
->
input
(
"bom_name"
,
""
);
$bom_sn
=
$request
->
input
(
"bom_sn"
,
""
);
$username
=
$request
->
input
(
"username"
,
''
);
list
(
$role_id
,
$sale_ids
)
=
$this
->
getRole
(
$request
);
$query
=
BomModel
::
where
([
"status"
=>
1
])
->
SearchByBomName
(
trim
(
$bom_name
))
->
SearchByBomSn
(
trim
(
$bom_sn
))
->
SearchByUserNameOrKefu
(
trim
(
$username
))
->
SearchByrole
(
$role_id
,
$sale_ids
)
->
select
(
"bom_id"
,
"bom_sn"
,
"bom_name"
,
"file_type"
,
"origin_file_name"
,
"upload_file_url"
)
->
orderBy
(
"bom_id"
,
"desc"
)
->
with
(
"bomExtend"
);
$list
=
$query
->
paginate
(
$limit
,[],
'page'
,
$page
);
return
$list
->
toArray
();
}
}
\ No newline at end of file
public/js/web/BomUploadFile.js
0 → 100644
View file @
83d3f890
layui
.
use
([
'form'
,
'table'
,
'laydate'
],
function
()
{
var
form
=
layui
.
form
;
var
table
=
layui
.
table
;
var
laydate
=
layui
.
laydate
;
//转换静态表格
table
.
init
(
'BomUploadFile'
,
{
limit
:
10
,
url
:
'/ajax/bom/BomUploadFile'
//数据接口
,
toolbar
:
''
//开启头部工具栏,并为其绑定左侧模板
,
defaultToolbar
:[]
,
method
:
'post'
,
cellMinWidth
:
80
//全局定义常规单元格的最小宽度
,
page
:
true
//开启分页
});
function
abc
(){
var
p
=
$
(
"#test1_form"
).
serializeArray
()
var
o
=
{}
console
.
log
(
p
)
for
(
i
in
p
){
console
.
log
(
p
[
i
].
name
)
console
.
log
(
p
[
i
].
value
)
o
[
p
[
i
].
name
]
=
p
[
i
].
value
}
return
o
}
function
renderTable
(){
table
.
init
(
'BomUploadFile'
,
{
limit
:
10
,
url
:
'/ajax/bom/BomUploadFile'
//数据接口
,
toolbar
:
'#toolbarDemo'
//开启头部工具栏,并为其绑定左侧模板
,
defaultToolbar
:[]
,
where
:
abc
()
,
method
:
'post'
,
cellMinWidth
:
80
//全局定义常规单元格的最小宽度
,
page
:
true
//开启分页
});
}
form
.
on
(
'submit(test1_button)'
,
function
(
data
)
{
renderTable
()
return
false
;
});
})
\ No newline at end of file
resources/views/web/BomUploadFile.blade.php
0 → 100644
View file @
83d3f890
<div
class=
""
style=
"padding-bottom: 15px"
>
<form
class=
"layui-form"
id=
"test1_form"
method=
"post"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
客户账号
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"username"
placeholder=
"填写客户账号"
autocomplete=
"off"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
BOM单号
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"bom_sn"
placeholder=
"填写BOM单号"
autocomplete=
"off"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
>
BOM名称
</label>
<div
class=
"layui-input-inline"
>
<input
type=
"text"
name=
"bom_name"
placeholder=
"填写BOM单号"
autocomplete=
"off"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-inline"
style=
"text-align: center;"
>
<button
id=
"test1_button"
lay-filter=
"test1_button"
lay-submit
class=
"layui-btn"
>
搜索
</button>
</div>
</div>
</form>
<table
class=
"layui-table"
lay-filter=
"BomUploadFile"
id=
"BomUploadFile_123"
>
<thead>
<tr>
<th
lay-data=
"{fixed: 'left',type:'numbers'}"
>
序号
</th>
<th
lay-data=
"{fixed: 'left',templet: '#bom_extend',width:200}"
>
客户账号
</th>
<th
lay-data=
"{field:'bom_sn', width:200}"
>
BOM单号
</th>
<th
lay-data=
"{field:'bom_name', width:200}"
>
BOM名称
</th>
<th
lay-data=
"{field:'origin_file_name'}"
>
源文件
</th>
<th
lay-data=
"{toolbar:'#action'}"
>
操作
</th>
</tr>
</thead>
</table>
</div>
<script
type=
"text/html"
id=
"action"
>
<
a
class
=
"btn btn-xs btn-outline btn-success"
href
=
"@{{ d.upload_file_url }}"
target
=
"_blank"
>
下载
<
/a>
</script>
<script
type=
"text/html"
id=
"bom_extend"
>
@{{
#
if
(
d
.
bom_extend
)
{
}}
@{{
d
.
bom_extend
.
user_name
}}
@{{
#
}
}}
</script>
{{--
<div
class=
"layui-card"
style=
""
>
--}}
{{--
<h3>
用户数据
</h3>
--}}
{{--
<hr>
--}}
{{--
<form
class=
"layui-form layui-box"
id=
"test5"
method=
"post"
>
--}}
{{--
<div
class=
"layui-form-item"
>
--}}
{{--
<div
class=
"layui-inline"
>
--}}
{{--
<label
class=
"layui-form-label"
>
创建日期:
</label>
--}}
{{--
<div
class=
"layui-input-inline"
>
--}}
{{--
<input
type=
"text"
name=
"begin_time"
value=
""
autocomplete=
"off"
placeholder=
"选择开始时间"
class=
"layui-input"
id=
"begin_time"
readonly
>
--}}
{{--
</div>
--}}
{{--
<div
class=
"layui-form-mid"
>
-
</div>
--}}
{{--
<div
class=
"layui-input-inline"
>
--}}
{{--
<input
type=
"text"
name=
"end_time"
value=
""
autocomplete=
"off"
placeholder=
"选择结束时间"
class=
"layui-input"
id=
"end_time"
readonly
>
--}}
{{--
</div>
--}}
{{--
</div>
--}}
{{--
<div
class=
"layui-inline"
>
--}}
{{--
<label
class=
"layui-form-label"
>
客服
</label>
--}}
{{--
<div
class=
"layui-input-inline"
>
--}}
{{--
<select
name=
"is_kefu"
lay-verify=
""
lay-search
>
--}}
{{--
<option
value=
"all"
>
全部
</option>
--}}
{{--
<option
value=
"1"
>
是
</option>
--}}
{{--
<option
value=
"0"
>
否
</option>
--}}
{{--
</select>
--}}
{{--
</div>
--}}
{{--
</div>
--}}
{{--
<div
class=
"layui-inline"
style=
"text-align: center;"
>
--}}
{{--
<button
class=
"layui-btn"
data-type=
"search"
>
搜索
</button>
--}}
{{--
<!-- <button type="button" class="layui-btn layui-btn-normal export">导出</button> -->
--}}
{{--
</div>
--}}
{{--
</div>
--}}
{{--
</form>
--}}
{{--
</div>
--}}
resources/views/web/BomView.blade.php
View file @
83d3f890
...
...
@@ -22,6 +22,52 @@
-webkit-border-radius
:
6px
;
}
</style>
<div
class=
"layui-card-body"
style=
"padding: 0"
>
<table
class=
"layui-table"
>
<tbody>
<tr>
<td>
BOM单号
</td>
<td>
{{$bomInfo->bom_sn}}
</td>
<td>
客户账号
</td>
<td>
{{$bomInfo->bomExtend ? $bomInfo->bomExtend->user_name : ""}}
</td>
<td>
创建时间
</td>
<td>
{{$bomInfo->add_time}}
</td>
</tr>
<tr>
<td>
BOM名称
</td>
<td>
{{$bomInfo->bom_name}}
</td>
<td>
BOM套数
</td>
<td></td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
总型号
</td>
<td>
{{$bomInfo->bomItemsCount}}
</td>
<td>
匹配成功
</td>
<td>
{{$bomInfo->getBomitemMatchingSucCount}}
</td>
<td>
匹配失败
</td>
<td>
{{$bomInfo->bomItemsCount - $bomInfo->getBomitemMatchingSucCount}}
</td>
</tr>
<tr>
<td>
BOM金额
</td>
<td>
{{ $bomInfo->matchingOrderAmount}}
</td>
<td>
已下单金额
</td>
<td>
{{$bomInfo->add_order_amount ? $bomInfo->add_order_amount : ""}}
</td>
<td></td>
<td></td>
</tr>
<tr>
<td>
源文件
</td>
<td>
{{$bomInfo->origin_file_name}} @if($bomInfo->origin_file_name)
<a
href=
"{{$bomInfo->upload_file_url}}"
>
下载
</a>
@endif
</td>
<td>
跟单员
</td>
<td>
{{$bomInfo->bomExtend ? $bomInfo->bomExtend->kefu_name : ""}}
</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<table
class=
"layui-table"
lay-filter=
"bomView"
id=
"layui_table_bomView"
>
<thead>
<tr>
...
...
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