|
@@ -488,4 +488,69 @@ class Facility extends Api
|
|
|
$list['total'] = $total[0];
|
|
$list['total'] = $total[0];
|
|
|
$this->success('成功',$list);
|
|
$this->success('成功',$list);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 检验记录
|
|
|
|
|
+ * @ApiMethod (GET)
|
|
|
|
|
+ * @param string $machine 机台编号
|
|
|
|
|
+ * @param string $workOrder 工单编号
|
|
|
|
|
+ * @param string $team 班次
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function InspectionRecord()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求失败');
|
|
|
|
|
+ }
|
|
|
|
|
+ $machine = input('machine');
|
|
|
|
|
+ $workOrder = input('Gd_gdbh');
|
|
|
|
|
+ $team = input('team');
|
|
|
|
|
+ if (empty($machine) || empty($workOrder) || empty($team)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $last_id = Db::table('制程检验_记录')->order('UniqId desc')->field('UniqId')->find();
|
|
|
|
|
+ $startId = $last_id['UniqId']-100000;
|
|
|
|
|
+ $where = [
|
|
|
|
|
+ '设备编号' => $machine,
|
|
|
|
|
+ '工单编号' => $workOrder,
|
|
|
|
|
+ '班组编号' => $team,
|
|
|
|
|
+ '类别' => ['in',['IPQC检验','机台检验']],
|
|
|
|
|
+ 'UniqId' => ['>',$startId],
|
|
|
|
|
+ ];
|
|
|
|
|
+ //检验项目筛选
|
|
|
|
|
+ $item = Db::table('制程检验_记录')->where($where)->distinct(true)->column('rtrim(检验项目)');
|
|
|
|
|
+ //检验时间
|
|
|
|
|
+ $InspectionTime = Db::table('制程检验_记录')->where($where)->distinct(true)->column('提交时间');
|
|
|
|
|
+ foreach ($InspectionTime as $k=>$v){
|
|
|
|
|
+ $InspectionTime[$k] = date('H:i',strtotime($v));
|
|
|
|
|
+ }
|
|
|
|
|
+ //检测记录详情
|
|
|
|
|
+ $field = 'rtrim(工单编号) as 工单编号,rtrim(印件号) as 印件号,rtrim(工序名称) as 工序名称';
|
|
|
|
|
+ $nameDetail = Db::table('制程检验_记录')->where($where)->field($field)->find();
|
|
|
|
|
+ $data = [];
|
|
|
|
|
+ //检测数据
|
|
|
|
|
+ foreach ($item as $key=>$value){
|
|
|
|
|
+ $SubmissionTime = Db::table('制程检验_记录')->where($where)
|
|
|
|
|
+ ->where('检验项目',$value)
|
|
|
|
|
+ ->where('检验结果','合格')
|
|
|
|
|
+ ->field('rtrim(提交时间) as 提交时间')
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ $time = [];
|
|
|
|
|
+ foreach ($SubmissionTime as $k=>$v){
|
|
|
|
|
+ $time[$k] = date('H:i',strtotime($v['提交时间']));
|
|
|
|
|
+ }
|
|
|
|
|
+ $data[$key] = [
|
|
|
|
|
+ '工单编号' => $nameDetail['工单编号'],
|
|
|
|
|
+ '印件号' => $nameDetail['印件号'],
|
|
|
|
|
+ '工序名称' => $nameDetail['工序名称'],
|
|
|
|
|
+ '检验项目' => $value,
|
|
|
|
|
+ 'inspectresult' => implode(',',$time),
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ $data['inspectiontime'] = $InspectionTime;
|
|
|
|
|
+ $this->success('成功',$data);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|