|
@@ -1131,21 +1131,52 @@ class Facility extends Api
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
$data = [];
|
|
$data = [];
|
|
|
|
|
+ $machineDetail = \db('设备_产量采集')
|
|
|
|
|
+ ->alias('a')
|
|
|
|
|
+ ->join('设备_基本资料 b','a.设备编号 = b.设备编号')
|
|
|
|
|
+ ->join('工单_工艺资料 c','a.工单编号 = c.Gy0_gdbh AND a.设备编号 = c.Gy0_sbbh')
|
|
|
|
|
+ ->join('工单_基本资料 d','a.工单编号 = d.Gd_gdbh')
|
|
|
|
|
+ ->field([
|
|
|
|
|
+ 'rtrim(a.开工时间)' => '开工时间',
|
|
|
|
|
+ 'rtrim(a.设备编号)' => '设备编号',
|
|
|
|
|
+ 'rtrim(a.工单编号)' => '工单编号',
|
|
|
|
|
+ 'rtrim(b.设备名称)' => '设备名称',
|
|
|
|
|
+ 'rtrim(c.Gy0_gxh)' => '工序号',
|
|
|
|
|
+ 'rtrim(c.Gy0_gxmc)' => '工序名称',
|
|
|
|
|
+ 'rtrim(d.Gd_cpmc)' => '产品名称'
|
|
|
|
|
+ ])
|
|
|
|
|
+ ->where('a.设备编号', $param['machine'])
|
|
|
|
|
+ ->order('a.UniqId desc')
|
|
|
|
|
+ ->find();
|
|
|
|
|
+ $data['machine'] = [
|
|
|
|
|
+ '日期' => $machineDetail['开工时间'],
|
|
|
|
|
+ '设备' => $machineDetail['设备编号'].'-->'.$machineDetail['设备名称'],
|
|
|
|
|
+ '工单' => $machineDetail['工单编号'].'-->'.$machineDetail['产品名称'],
|
|
|
|
|
+ '工艺' => ($machineDetail['工序号']<10?'0'.$machineDetail['工序号']:$machineDetail['工序号']).'--'.$machineDetail['工序名称']
|
|
|
|
|
+ ];
|
|
|
//机台状态时间
|
|
//机台状态时间
|
|
|
$startTime = \db('设备_产量采集')
|
|
$startTime = \db('设备_产量采集')
|
|
|
->where('设备编号',$param['machine'])
|
|
->where('设备编号',$param['machine'])
|
|
|
->where('开工时间',$param['start'])
|
|
->where('开工时间',$param['start'])
|
|
|
->field('rtrim(时间) as 时间,当班产量,rtrim(当前状态) as 状态,MAX(时间) as 最大时间,MAX(当班产量) as 最大产量')
|
|
->field('rtrim(时间) as 时间,当班产量,rtrim(当前状态) as 状态,MAX(时间) as 最大时间,MAX(当班产量) as 最大产量')
|
|
|
- ->order('UniqId')
|
|
|
|
|
->group('当前状态')
|
|
->group('当前状态')
|
|
|
- ->find();
|
|
|
|
|
|
|
+ ->select();
|
|
|
if (!empty($startTime)){
|
|
if (!empty($startTime)){
|
|
|
- $timeDifference = round((strtotime($startTime['最大时间'])-strtotime($startTime['时间']))/3600,2);
|
|
|
|
|
- $data['timeDifference'] = $timeDifference;
|
|
|
|
|
- $data['field'] = $startTime['最大产量']-$startTime['当班产量'];
|
|
|
|
|
|
|
+ foreach ($startTime as $key=>$value){
|
|
|
|
|
+ $data['timeDifference'][$key] = [
|
|
|
|
|
+ '时间' => round((strtotime($value['最大时间'])-strtotime($value['时间']))/3600,2),
|
|
|
|
|
+ '状态' => $value['状态'] = null?'待单':$value['状态'],
|
|
|
|
|
+ ];
|
|
|
|
|
+ if ($value['状态'] === '生产'){
|
|
|
|
|
+ $data['当班产量'] = $value['最大产量']-$value['当班产量'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}else{
|
|
}else{
|
|
|
- $data['timeDifference'] = 0;
|
|
|
|
|
- $data['field'] = 0;
|
|
|
|
|
|
|
+ $data['timeDifference'][0] = [
|
|
|
|
|
+ '时间' => 0,
|
|
|
|
|
+ '状态' => '待单'
|
|
|
|
|
+ ];
|
|
|
|
|
+ $data['当班产量'] = 0;
|
|
|
}
|
|
}
|
|
|
//机台产能/时间明细
|
|
//机台产能/时间明细
|
|
|
$row = \db('设备_产量采集')
|
|
$row = \db('设备_产量采集')
|
|
@@ -1154,7 +1185,7 @@ class Facility extends Api
|
|
|
->field('rtrim(时间) as 时间,rtrim(当班产量) as 产量,rtrim(当前状态) as 状态')
|
|
->field('rtrim(时间) as 时间,rtrim(当班产量) as 产量,rtrim(当前状态) as 状态')
|
|
|
->select();
|
|
->select();
|
|
|
if (empty($row)){
|
|
if (empty($row)){
|
|
|
- $data['row'] = '';
|
|
|
|
|
|
|
+ $data['row'] = [];
|
|
|
}
|
|
}
|
|
|
foreach ($row as $key=>$value){
|
|
foreach ($row as $key=>$value){
|
|
|
$data['row'][$key]['时间'] = date('Y-m-d H:i',strtotime($value['时间']));
|
|
$data['row'][$key]['时间'] = date('Y-m-d H:i',strtotime($value['时间']));
|
|
@@ -1180,23 +1211,26 @@ class Facility extends Api
|
|
|
->field('rtrim(类别) as 类别,提交时间')
|
|
->field('rtrim(类别) as 类别,提交时间')
|
|
|
->select();
|
|
->select();
|
|
|
$data['首件'] = $data['自检'] = $data['IPQC'] = [];
|
|
$data['首件'] = $data['自检'] = $data['IPQC'] = [];
|
|
|
- if (empty($list)){
|
|
|
|
|
- $this->success('未找到检验记录');
|
|
|
|
|
- }
|
|
|
|
|
- foreach ($list as $key=>$value){
|
|
|
|
|
- if ($value['类别'] == '现场巡查记录'){
|
|
|
|
|
- array_push($data['首件'],$value['提交时间']);
|
|
|
|
|
- }
|
|
|
|
|
- if ($value['类别'] == '机台自检'){
|
|
|
|
|
- array_push($data['自检'],$value['提交时间']);
|
|
|
|
|
- }
|
|
|
|
|
- if ($value['类别'] == 'IPQC检验'){
|
|
|
|
|
- array_push($data['IPQC'],$value['提交时间']);
|
|
|
|
|
|
|
+ if (!empty($list)){
|
|
|
|
|
+ foreach ($list as $key=>$value){
|
|
|
|
|
+ if ($value['类别'] == '现场巡查记录'){
|
|
|
|
|
+ array_push($data['首件'],$value['提交时间']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($value['类别'] == '机台自检'){
|
|
|
|
|
+ array_push($data['自检'],$value['提交时间']);
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($value['类别'] == 'IPQC检验'){
|
|
|
|
|
+ array_push($data['IPQC'],$value['提交时间']);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ $data['首件'] = array_values(array_unique($data['首件']));
|
|
|
|
|
+ $data['自检'] = array_values(array_unique($data['自检']));
|
|
|
|
|
+ $data['IPQC'] = array_values(array_unique($data['IPQC']));
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $data['首件'] = [];
|
|
|
|
|
+ $data['自检'] = [];
|
|
|
|
|
+ $data['IPQC'] = [];
|
|
|
}
|
|
}
|
|
|
- $data['首件'] = array_values(array_unique($data['首件']));
|
|
|
|
|
- $data['自检'] = array_values(array_unique($data['自检']));
|
|
|
|
|
- $data['IPQC'] = array_values(array_unique($data['IPQC']));
|
|
|
|
|
$this->success('成功',$data);
|
|
$this->success('成功',$data);
|
|
|
}
|
|
}
|
|
|
|
|
|