|
@@ -630,4 +630,64 @@ class GluChronographSheet extends Api
|
|
|
|
|
|
|
|
return $employeeFields;
|
|
return $employeeFields;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 糊盒报工数据详情
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function getGluingReportClockDataDetail()
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!$this->request->isGet()) {
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $params = $this->request->param();
|
|
|
|
|
+ if (!isset($params['id']) || empty($params['id'])) {
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $detail = \db('糊盒班组计时')
|
|
|
|
|
+ ->where('id', $params['id'])
|
|
|
|
|
+ ->find();
|
|
|
|
|
+
|
|
|
|
|
+ if (empty($detail)) {
|
|
|
|
|
+ $this->error('未找到报工数据');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $employeeIds = [];
|
|
|
|
|
+ for ($i = 1; $i <= 20; $i++) {
|
|
|
|
|
+ $bh = isset($detail['bh' . $i]) ? trim($detail['bh' . $i]) : '';
|
|
|
|
|
+ if ($bh !== '' && $bh !== '000000') {
|
|
|
|
|
+ $employeeIds[$bh] = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $employeeNames = [];
|
|
|
|
|
+ if (!empty($employeeIds)) {
|
|
|
|
|
+ $employees = \db('人事_基本资料')
|
|
|
|
|
+ ->whereIn('员工编号', array_keys($employeeIds))
|
|
|
|
|
+ ->field('员工编号, rtrim(员工姓名) as 姓名')
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ foreach ($employees as $employee) {
|
|
|
|
|
+ $employeeNames[$employee['员工编号']] = $employee['姓名'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $detail['class'] = [];
|
|
|
|
|
+ for ($i = 1; $i <= 20; $i++) {
|
|
|
|
|
+ $bh = isset($detail['bh' . $i]) ? trim($detail['bh' . $i]) : '';
|
|
|
|
|
+ if ($bh !== '' && $bh !== '000000') {
|
|
|
|
|
+ $detail['class'][] = [
|
|
|
|
|
+ '编号' => $bh,
|
|
|
|
|
+ '姓名' => $employeeNames[$bh] ?? '',
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $this->success('获取成功', $detail);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|