|
|
@@ -311,23 +311,27 @@ class Manufacture extends Api
|
|
|
$this->error('请求错误');
|
|
|
}
|
|
|
$data = [];
|
|
|
- $department = \db('设备_基本资料')->distinct(true)->cache(true)->column('使用部门');
|
|
|
+ $department = \db('设备_基本资料')
|
|
|
+ ->distinct(true)
|
|
|
+ ->where('使用部门','<>','研发中心')
|
|
|
+ ->where('设备编组','<>','')
|
|
|
+ ->order('设备编组')
|
|
|
+ ->column('使用部门');
|
|
|
if (empty($department)){
|
|
|
$this->error('为获取到机台数据');
|
|
|
}
|
|
|
foreach ($department as $value){
|
|
|
- if (rtrim($value) !== '研发中心'){
|
|
|
- $benchClass = \db('设备_基本资料')->where('使用部门',$value)->distinct(true)->cache(true)->column('设备编组');
|
|
|
- foreach ($benchClass as $v){
|
|
|
- if (rtrim($v) !== ''){
|
|
|
- $machine = \db('设备_基本资料')->where('使用部门',$value)->where('设备编组',$v)->field('rtrim(设备编号) as 设备编号,rtrim(设备名称) as 设备名称')->cache(true)->select();
|
|
|
- foreach ($machine as $kk=>$vv){
|
|
|
- $data[rtrim($value)][rtrim($v)][$kk] = $vv['设备编号'].'-->'.$vv['设备名称'];
|
|
|
- }
|
|
|
+ $benchClass = \db('设备_基本资料')->where('使用部门',$value)->distinct(true)->order('设备编组')->cache(true)->column('设备编组');
|
|
|
+ foreach ($benchClass as $v){
|
|
|
+ if (rtrim($v) !== ''){
|
|
|
+ $machine = \db('设备_基本资料')->where('使用部门',$value)->where('设备编组',$v)->field('rtrim(设备编号) as 设备编号,rtrim(设备名称) as 设备名称')->cache(true)->select();
|
|
|
+ foreach ($machine as $kk=>$vv){
|
|
|
+ $data[rtrim($value)][rtrim($v)][$kk] = $vv['设备编号'].'-->'.$vv['设备名称'];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
$this->success('成功',$data);
|
|
|
}
|
|
|
|