|
@@ -1094,4 +1094,64 @@ class CostAccounting extends Api
|
|
|
];
|
|
];
|
|
|
$this->success('成功', $data);
|
|
$this->success('成功', $data);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按工序归结人工费统计表
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function getCompletionWorkOrderCostDetail()
|
|
|
|
|
+ {
|
|
|
|
|
+ // 1. 请求方法验证
|
|
|
|
|
+ if (!$this->request->isGet()) {
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 参数获取和验证
|
|
|
|
|
+ $year = $this->request->param('year');
|
|
|
|
|
+ if (empty($year)) {
|
|
|
|
|
+ $this->error('缺少必要参数:year');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 3. 定义常量数据
|
|
|
|
|
+ $processList = [
|
|
|
|
|
+ '胶印', '卷凹', '圆烫', '圆切', '单凹',
|
|
|
|
|
+ '丝印', '喷码', '覆膜', '裁切', '切废',
|
|
|
|
|
+ '烫金', '模切', '机检', '手检'
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ // 4. 批量查询并组装数据
|
|
|
|
|
+ $result = [];
|
|
|
|
|
+ foreach ($processList as $process) {
|
|
|
|
|
+ // 查询当前工序的数据
|
|
|
|
|
+ $processData = db('绩效工资汇总')
|
|
|
|
|
+ ->where('sys_ny', 'like', $year . '%')
|
|
|
|
|
+ ->where('sczl_type', 'like', '%' . $process . '%')
|
|
|
|
|
+ ->field('
|
|
|
|
|
+ SUM(班组车头产量) as 车头产量,
|
|
|
|
|
+ SUM(班组换算产量) as 补产产量,
|
|
|
|
|
+ SUM(个人计件工资) as 计件工资,
|
|
|
|
|
+ SUM(个人加班工资) as 加班工资,
|
|
|
|
|
+ sys_ny as 年月
|
|
|
|
|
+ ')
|
|
|
|
|
+ ->group('sys_ny')
|
|
|
|
|
+ ->select();
|
|
|
|
|
+
|
|
|
|
|
+ // 处理查询结果
|
|
|
|
|
+ if (!empty($processData)) {
|
|
|
|
|
+ foreach ($processData as &$item) {
|
|
|
|
|
+ $item['核算产量'] = $item['车头产量'] + $item['补产产量'];
|
|
|
|
|
+ $item['产量工资合计'] = $item['计件工资'] + $item['加班工资'];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $result[$process] = $processData;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 5. 返回结果(开发调试用)
|
|
|
|
|
+ $this->success('成功', $result);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|