Commit 83d3f890 by 孙龙

up

parent c6a09efc
...@@ -99,6 +99,16 @@ class BomApiController extends Controller{ ...@@ -99,6 +99,16 @@ class BomApiController extends Controller{
return $this->ajaxReturn($res['errcode'],$res['errmsg'],$res['data']); 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
...@@ -7,6 +7,10 @@ use App\Map\PcbOrderInvoiceMap; ...@@ -7,6 +7,10 @@ use App\Map\PcbOrderInvoiceMap;
use App\Map\PcbOrderMap; use App\Map\PcbOrderMap;
use App\Map\PcbOrderShippingMap; use App\Map\PcbOrderShippingMap;
use App\Map\PcbPurchaseMap; 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\PaymentDaysModel;
use App\Model\Pcb\PcbOrderModel; use App\Model\Pcb\PcbOrderModel;
use App\Model\Pcb\PcbPublicModel; use App\Model\Pcb\PcbPublicModel;
...@@ -339,6 +343,12 @@ class WebController extends Controller ...@@ -339,6 +343,12 @@ class WebController extends Controller
{ {
$data['title'] = 'BOM单详情'; $data['title'] = 'BOM单详情';
$data["bom_id"] = $request->input("bom_id",0); $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); return view('web', $data);
} }
...@@ -350,4 +360,12 @@ class WebController extends Controller ...@@ -350,4 +360,12 @@ class WebController extends Controller
return view('web', $data); return view('web', $data);
} }
//bom源文件管理
public function BomUploadFile($request, $data, $id)
{
$data['title'] = 'bom源文件管理';
return view('web', $data);
}
} }
...@@ -117,8 +117,22 @@ class BomItemMatchModel extends BomItemMatchBaseModel{ ...@@ -117,8 +117,22 @@ class BomItemMatchModel extends BomItemMatchBaseModel{
return $amount; 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
...@@ -87,7 +87,13 @@ class BomItemModel extends BomItemMatchBaseModel{ ...@@ -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");
}
......
...@@ -826,4 +826,17 @@ class BomService { ...@@ -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
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
<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>--}}
...@@ -22,6 +22,52 @@ ...@@ -22,6 +22,52 @@
-webkit-border-radius: 6px; -webkit-border-radius: 6px;
} }
</style> </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"> <table class="layui-table" lay-filter="bomView" id="layui_table_bomView">
<thead> <thead>
<tr> <tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment