liuhairui 8 часов назад
Родитель
Сommit
f6f8653618

+ 38 - 33
application/api/controller/Manufacture.php

@@ -1186,7 +1186,7 @@ class Manufacture extends Api
         // 设置查询条件
         // 设置查询条件
         $where = [
         $where = [
             'Mod_rq' => null,
             'Mod_rq' => null,
-            '订单编号|生产款号' => ['like', '%' . $param['search'] . '%'],
+            '订单编号|生产款号|客户编号|款式' => ['like', '%' . $param['search'] . '%'],
         ];
         ];
 
 
         $page = isset($param['page']) ? $param['page'] : 1;
         $page = isset($param['page']) ? $param['page'] : 1;
@@ -1202,21 +1202,20 @@ class Manufacture extends Api
         // 获取总记录数
         // 获取总记录数
         $count = \db('工单_基本资料')
         $count = \db('工单_基本资料')
             ->where($where)
             ->where($where)
-            ->count();  // 使用 count() 方法优化
+            ->count();
+
         $orderIds = array_column($list, '订单编号');
         $orderIds = array_column($list, '订单编号');
 
 
-        // 合并查询相关附件
+        // ========== 1. 批量查询附件数据 ==========
         $relatedOrders = \db('工单_相关附件')
         $relatedOrders = \db('工单_相关附件')
             ->whereIn('关联编号', $orderIds)
             ->whereIn('关联编号', $orderIds)
             ->whereIn('附件备注', ['技术附件', '订单资料附件'])
             ->whereIn('附件备注', ['技术附件', '订单资料附件'])
             ->column('关联编号,附件备注');
             ->column('关联编号,附件备注');
 
 
-        // 重新组织附件数据
         $groupedRelatedOrders = [
         $groupedRelatedOrders = [
             'technical' => [],
             'technical' => [],
-            'order' => []
+            'order'     => []
         ];
         ];
-
         foreach ($relatedOrders as $orderNumber => $attachmentRemark) {
         foreach ($relatedOrders as $orderNumber => $attachmentRemark) {
             if ($attachmentRemark === '技术附件') {
             if ($attachmentRemark === '技术附件') {
                 $groupedRelatedOrders['technical'][] = $orderNumber;
                 $groupedRelatedOrders['technical'][] = $orderNumber;
@@ -1225,56 +1224,62 @@ class Manufacture extends Api
             }
             }
         }
         }
 
 
+        // ========== 2. 【优化】批量查询工艺资料,只查当前页所有工单 ==========
+        $gongyiList = \db('工单_基础工艺资料')
+            ->whereIn('work_order', $orderIds)
+            ->column('work_order'); // 只取出已上传工艺的订单编号
+
+        // 定义工序对应字段
+        $processIds = [
+            2 => '裁剪完工数量',
+            3 => '车缝完工数量',
+            4 => '手工完工数量',
+            5 => '大烫完工数量',
+            6 => '总检完工数量',
+            7 => '包装完工数量'
+        ];
+
         // 遍历工单列表并设置状态
         // 遍历工单列表并设置状态
         foreach ($list as &$value) {
         foreach ($list as &$value) {
-            // 设置订单状态
-            $value['status'] = in_array($value['订单编号'], $groupedRelatedOrders['technical']) ? '' : '*';
-            $value['orderstatus'] = in_array($value['订单编号'], $groupedRelatedOrders['order']) ? '' : '*';
-
-            // 定义工序编号数组
-            $processIds = [
-                2 => '裁剪完工数量',
-                3 => '车缝完工数量',
-                4 => '手工完工数量',
-                5 => '大烫完工数量',
-                6 => '总检完工数量',
-                7 => '工单完工数量'
-            ];
+            $orderNo = $value['订单编号'];
+
+            // 技术附件标记:有数据为空,无数据标 *
+            $value['status'] = in_array($orderNo, $groupedRelatedOrders['technical']) ? '' : '*';
+            // 订单资料附件标记
+            $value['orderstatus'] = in_array($orderNo, $groupedRelatedOrders['order']) ? '' : '*';
+            // 【新增】工艺资料标记:有数据为空,无数据标 *
+            $value['gongyistatus'] = in_array($orderNo, $gongyiList) ? '' : '*';
 
 
-            // 遍历工序编号,获取对应的完工数量
+            // 工序产量统计
             foreach ($processIds as $processId => $fieldName) {
             foreach ($processIds as $processId => $fieldName) {
                 if ($processId === 2 || $processId === 3) {
                 if ($processId === 2 || $processId === 3) {
-                    // 查询所有记录
                     $records = \db('设备_产量计酬')
                     $records = \db('设备_产量计酬')
-                        ->where('订单编号', $value['订单编号'])
+                        ->where('订单编号', $orderNo)
                         ->where('工序编号', $processId)
                         ->where('工序编号', $processId)
-                        ->select();  // 获取所有匹配记录
-
-                    // 计算数量总和
+                        ->select();
                     $num_sum = 0;
                     $num_sum = 0;
                     foreach ($records as $record) {
                     foreach ($records as $record) {
-                        $num_sum += $record['数量'];  // 手动累加数量
+                        $num_sum += $record['数量'];
                     }
                     }
-
-                    $value[$fieldName] = $num_sum; // 裁剪和车缝存储数量
+                    $value[$fieldName] = $num_sum;
                 } else {
                 } else {
-                    // 其他工序是 s_num,总和计算
                     $s_num_sum = \db('设备_产量计酬')
                     $s_num_sum = \db('设备_产量计酬')
-                        ->where('订单编号', $value['订单编号'])
+                        ->where('订单编号', $orderNo)
                         ->where('工序编号', $processId)
                         ->where('工序编号', $processId)
-                        ->sum('s_num'); // 继续使用 s_num 字段
-                    $value[$fieldName] = $s_num_sum; // 其他工序存储 s_num 总和
+                        ->sum('s_num');
+                    $value[$fieldName] = $s_num_sum;
                 }
                 }
             }
             }
 
 
+            // 日期格式化
             if ($value['落货日期']) {
             if ($value['落货日期']) {
                 $value['落货日期'] = date('Y-m-d', strtotime($value['落货日期']));
                 $value['落货日期'] = date('Y-m-d', strtotime($value['落货日期']));
             }
             }
-            // 格式化接单日期,去掉时间部分
             if ($value['接单日期']) {
             if ($value['接单日期']) {
                 $value['接单日期'] = date('Y-m-d', strtotime($value['接单日期']));
                 $value['接单日期'] = date('Y-m-d', strtotime($value['接单日期']));
             }
             }
         }
         }
+        unset($value);
 
 
         // 返回数据
         // 返回数据
         $data = [
         $data = [

+ 29 - 8
application/api/controller/ReportingWork.php

@@ -508,14 +508,35 @@ class ReportingWork extends Api
         if (empty($params['machine'])) {
         if (empty($params['machine'])) {
             $this->error('机台编号不能为空');
             $this->error('机台编号不能为空');
         }
         }
-        $rows = db('设备_工分计酬')
-            ->where('del_rq', null)
-            ->where('date', 'like', $params['date'] . '%')
-            ->where('machine', $params['machine'])
-            ->field('work_order,majorprocess,part_code,process_code,process_name,staff_no,staff_name,
-            standard_hour,standard_score,money,coefficient,number,production_hour,
-            production_score,salary,machine,sys_id,sys_rq,id')
-            ->order('process_code asc,staff_no asc,sys_rq desc')
+        $rows = db('设备_工分计酬')->alias('a')
+            ->join('工单_基本资料 b', 'a.work_order = b.订单编号', 'LEFT')
+            ->where('a.del_rq', null)
+            ->where('b.Mod_rq', null)
+            ->where('a.date', 'like', $params['date'] . '%')
+            ->where('a.machine', $params['machine'])
+            ->field('
+                    a.work_order,
+                    a.majorprocess,
+                    a.part_code,
+                    a.process_code,
+                    a.process_name,
+                    a.staff_no,
+                    a.staff_name,
+                    a.standard_hour,
+                    a.standard_score,
+                    a.money,
+                    a.coefficient,
+                    a.number,
+                    a.production_hour,
+                    a.production_score,
+                    a.salary,machine,
+                    a.sys_id,
+                    a.sys_rq,
+                    a.id,
+                    b.生产款号,
+                    b.款式
+                ')
+            ->order('a.process_code asc,a.staff_no asc,a.sys_rq desc')
             ->select();
             ->select();
         $this->success('成功', $rows);
         $this->success('成功', $rows);
     }
     }

+ 264 - 37
application/api/controller/StaffSalary.php

@@ -9,13 +9,13 @@ use think\Db;
 */
 */
 class StaffSalary extends Api
 class StaffSalary extends Api
 {
 {
-   
+
     protected $noNeedLogin = ['*'];
     protected $noNeedLogin = ['*'];
     protected $noNeedRight = ['*'];
     protected $noNeedRight = ['*'];
 
 
 
 
     /**
     /**
-     * 查询报工数据月份
+     * 查询报工数据月份(年-年月-日期-工序-小组五级树)
      * @ApiMethod (GET)
      * @ApiMethod (GET)
      * @return array
      * @return array
      * @throws \think\db\exception\DataNotFoundException
      * @throws \think\db\exception\DataNotFoundException
@@ -27,28 +27,127 @@ class StaffSalary extends Api
         if (!$this->request->isGet()) {
         if (!$this->request->isGet()) {
             $this->error('请求方法错误');
             $this->error('请求方法错误');
         }
         }
-        $data = db('设备_工分计酬')
+
+        $rows = db('设备_工分计酬')
             ->where('del_rq', null)
             ->where('del_rq', null)
-            ->field('DISTINCT DATE_FORMAT(date, "%Y-%m") as month')
-            ->order('date desc')
+            ->where('sys_rq', 'not null')
+            ->field('LEFT(sys_rq, 10) as date, IF(majorprocess IS NULL OR majorprocess = "", "其他", majorprocess) as process, rtrim(sys_id) as sys_id')
+            ->group('LEFT(sys_rq, 10), process, sys_id')
+            ->order('date desc, process asc, sys_id asc')
             ->select();
             ->select();
-    
-        //获取员工部门
-        $big_process = db('人员_基本资料')
-            ->field('DISTINCT big_process')
-            ->where('big_process','<>','')
-            ->select();
-        foreach ($big_process as $v) {
-            $big_process_name[] = $v['big_process'];
+
+        if (empty($rows)) {
+            $this->success('成功', []);
         }
         }
+
+        $treeMap = [];
+        foreach ($rows as $row) {
+            $date = $row['date'];
+            if (empty($date)) {
+                continue;
+            }
+            // 拆分年、年月、日期
+            $year = substr($date, 0, 4);
+            $yearMonth = substr($date, 0, 7);
+            $process = $row['process'];
+            $sysId = $row['sys_id'] !== '' ? $row['sys_id'] : '未知';
+
+            // 构建五级结构
+            if (!isset($treeMap[$year])) {
+                $treeMap[$year] = [];
+            }
+            if (!isset($treeMap[$year][$yearMonth])) {
+                $treeMap[$year][$yearMonth] = [];
+            }
+            if (!isset($treeMap[$year][$yearMonth][$date])) {
+                $treeMap[$year][$yearMonth][$date] = [
+                    'processes' => [],
+                ];
+            }
+            if (!isset($treeMap[$year][$yearMonth][$date]['processes'][$process])) {
+                $treeMap[$year][$yearMonth][$date]['processes'][$process] = [];
+            }
+            if (!in_array($sysId, $treeMap[$year][$yearMonth][$date]['processes'][$process], true)) {
+                $treeMap[$year][$yearMonth][$date]['processes'][$process][] = $sysId;
+            }
+        }
+
+        // 工序固定排序
+        $processOrder = ['裁剪', '车缝', '手工', '大烫', '总检', '包装', '其他'];
         $result = [];
         $result = [];
-        foreach ($data as $v) {
-            $result[$v['month']] = $big_process_name;
+        krsort($treeMap);
+
+        foreach ($treeMap as $year => $yearMonths) {
+            $yearNode = [
+                'label' => (string)$year,
+                'value' => (string)$year,
+                'children' => [],
+            ];
+
+            krsort($yearMonths);
+            foreach ($yearMonths as $yearMonth => $dates) {
+                $yearMonthNode = [
+                    'label' => $yearMonth,
+                    'value' => $yearMonth,
+                    'children' => [],
+                ];
+
+                krsort($dates);
+                foreach ($dates as $dateKey => $dateData) {
+                    $processChildren = [];
+                    $sortedProcesses = $this->sortProcessList(array_keys($dateData['processes']), $processOrder);
+                    foreach ($sortedProcesses as $process) {
+                        $groups = $dateData['processes'][$process];
+                        sort($groups);
+                        $groupChildren = [];
+                        foreach ($groups as $group) {
+                            $groupChildren[] = [
+                                'label' => $group,
+                                'value' => $group,
+                            ];
+                        }
+                        $processChildren[] = [
+                            'label' => $process,
+                            'value' => $process,
+                            'children' => $groupChildren,
+                        ];
+                    }
+
+                    $dateNode = [
+                        'label' => $dateKey,
+                        'value' => $dateKey,
+                        'children' => $processChildren,
+                    ];
+                    $yearMonthNode['children'][] = $dateNode;
+                }
+
+                $yearNode['children'][] = $yearMonthNode;
+            }
+
+            $result[] = $yearNode;
         }
         }
 
 
         $this->success('成功', $result);
         $this->success('成功', $result);
     }
     }
 
 
+    /**
+     * 按指定顺序排序工序
+     * @param array $processList
+     * @param array $order
+     * @return array
+     */
+    private function sortProcessList(array $processList, array $order): array
+    {
+        $sorted = [];
+        foreach ($order as $item) {
+            if (in_array($item, $processList)) {
+                $sorted[] = $item;
+                unset($processList[array_search($item, $processList)]);
+            }
+        }
+        return array_merge($sorted, $processList);
+    }
+
 
 
     /**
     /**
      * 查询员工工资列表
      * 查询员工工资列表
@@ -64,24 +163,52 @@ class StaffSalary extends Api
             $this->error('请求方法错误');
             $this->error('请求方法错误');
         }
         }
         $param = $this->request->param();
         $param = $this->request->param();
-        if (empty($param['month'])) {
-            $this->error('请选择月份');
+
+        if (empty($param['sys_rq'])) {
+            $this->error('请选择日期(sys_rq)');
         }
         }
-        if (empty($param['big_process'])) {
-            $this->error('请选择部门');
+
+        $sysRq = $param['sys_rq'];
+        $bigProcess = !empty($param['big_process']) ? $param['big_process'] : '';
+        $group = !empty($param['group']) ? $param['group'] : '';
+
+        // ========== 第一步:连表查询员工列表(无exp、无whereRaw) ==========
+        $staffWhere = [];
+        $staffWhere['a.status'] = 1;
+
+        // 日期条件:纯LIKE匹配,兼容带时分秒的sys_rq
+        if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $sysRq)) {
+            $staffWhere['b.sys_rq'] = ['like', $sysRq . '%'];
+        } elseif (preg_match('/^\d{4}-\d{2}$/', $sysRq)) {
+            $staffWhere['b.sys_rq'] = ['like', $sysRq . '%'];
+        } elseif (preg_match('/^\d{4}$/', $sysRq)) {
+            $staffWhere['b.sys_rq'] = ['like', $sysRq . '%'];
+        } else {
+            $this->error('sys_rq 格式错误,请使用 2026 / 2026-06 / 2026-06-08 格式');
+        }
+
+        // 工序筛选(可选)
+        if (!empty($bigProcess)) {
+            $staffWhere['a.big_process'] = $bigProcess;
         }
         }
-        //获取大工序员工列表
+
+        // 小组筛选(可选)
+        if (!empty($group)) {
+            $staffWhere['b.sys_id'] = $group;
+        }
+
+        // 关键:用whereNull处理del_rq IS NULL,彻底解决EXP报错
         $staff = db('人员_基本资料')
         $staff = db('人员_基本资料')
             ->alias('a')
             ->alias('a')
             ->join('设备_工分计酬 b','a.staff_no = b.staff_no','left')
             ->join('设备_工分计酬 b','a.staff_no = b.staff_no','left')
-            ->where('a.big_process',$param['big_process'])
-            ->where('a.status',1)
-            ->where('b.date', 'like', $param['month'] . '%')
+            ->where($staffWhere)
+            ->whereNull('b.del_rq')
             ->field('a.staff_no,a.staff_name,sum(b.salary) as salary')
             ->field('a.staff_no,a.staff_name,sum(b.salary) as salary')
             ->group('a.staff_no,a.staff_name')
             ->group('a.staff_no,a.staff_name')
             ->select();
             ->select();
+
         if(empty($staff)){
         if(empty($staff)){
-            $this->error('该工序没有报工数据');
+            $this->error('当前条件下暂无工资数据');
         }
         }
 
 
         $staffMap = [];
         $staffMap = [];
@@ -91,13 +218,37 @@ class StaffSalary extends Api
             $staffNos[] = $item['staff_no'];
             $staffNos[] = $item['staff_no'];
         }
         }
 
 
+        // ========== 第二步:查询明细数据(无exp、无whereRaw) ==========
+        $detailWhere = [];
+        $detailWhere['staff_no'] = ['in', $staffNos];
+
+        // 日期条件:和上面保持一致
+        if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $sysRq)) {
+            $detailWhere['sys_rq'] = ['like', $sysRq . '%'];
+        } elseif (preg_match('/^\d{4}-\d{2}$/', $sysRq)) {
+            $detailWhere['sys_rq'] = ['like', $sysRq . '%'];
+        } elseif (preg_match('/^\d{4}$/', $sysRq)) {
+            $detailWhere['sys_rq'] = ['like', $sysRq . '%'];
+        }
+
+        // 工序筛选(可选)
+        if (!empty($bigProcess)) {
+            $detailWhere['majorprocess'] = $bigProcess;
+        }
+
+        // 小组筛选(可选)
+        if (!empty($group)) {
+            $detailWhere['sys_id'] = $group;
+        }
+
+        // 关键:用whereNull处理del_rq IS NULL
         $salaryRows = db('设备_工分计酬')
         $salaryRows = db('设备_工分计酬')
-            ->where('del_rq', null)
-            ->where('date', 'like', $param['month'] . '%')
-            ->where('staff_no', 'in', $staffNos)
-            ->field('staff_no,staff_name,DATE_FORMAT(date, "%Y-%m-%d") as date,sum(salary) as salary,sys_id')
-            ->group('staff_no,DATE_FORMAT(date, "%Y-%m-%d")')
-            ->order('staff_no asc,date asc')
+            ->where($detailWhere)
+            ->whereNull('del_rq')
+            // 新增sys_id字段,并在group里加上,确保不同小组的数据不被合并
+            ->field('staff_no,staff_name,DATE_FORMAT(sys_rq, "%Y-%m-%d") as date,sum(salary) as salary,sys_id')
+            ->group('staff_no,DATE_FORMAT(sys_rq, "%Y-%m-%d"),sys_id')
+            ->order('staff_no asc,sys_rq asc')
             ->select();
             ->select();
 
 
         $grouped = [];
         $grouped = [];
@@ -116,18 +267,93 @@ class StaffSalary extends Api
                 '员工姓名' => !empty($row['staff_name']) ? $row['staff_name'] : (isset($staffMap[$staffNo]) ? $staffMap[$staffNo] : ''),
                 '员工姓名' => !empty($row['staff_name']) ? $row['staff_name'] : (isset($staffMap[$staffNo]) ? $staffMap[$staffNo] : ''),
                 '日期' => $row['date'],
                 '日期' => $row['date'],
                 '工资' => $row['salary'],
                 '工资' => $row['salary'],
+                // 新增小组字段
+                '小组' => $row['sys_id'],
             ];
             ];
             $grouped[$staffNo]['total_salary'] += $row['salary'];
             $grouped[$staffNo]['total_salary'] += $row['salary'];
         }
         }
 
 
         $this->success('成功', array_values($grouped));
         $this->success('成功', array_values($grouped));
-            
     }
     }
-   
+
+//    /**
+//     * 查询员工工资列表
+//     * @ApiMethod (GET)
+//     * @return array
+//     * @throws \think\db\exception\DataNotFoundException
+//     * @throws \think\db\exception\ModelNotFoundException
+//     * @throws \think\exception\DbException
+//     */
+//    public function GetStaffSalaryList()
+//    {
+//        if (!$this->request->isGet()) {
+//            $this->error('请求方法错误');
+//        }
+//        $param = $this->request->param();
+//        if (empty($param['month'])) {
+//            $this->error('请选择月份');
+//        }
+//        if (empty($param['big_process'])) {
+//            $this->error('请选择部门');
+//        }
+//        //获取大工序员工列表
+//        $staff = db('人员_基本资料')
+//            ->alias('a')
+//            ->join('设备_工分计酬 b','a.staff_no = b.staff_no','left')
+//            ->where('a.big_process',$param['big_process'])
+//            ->where('a.status',1)
+//            ->where('b.date', 'like', $param['month'] . '%')
+//            ->field('a.staff_no,a.staff_name,sum(b.salary) as salary')
+//            ->group('a.staff_no,a.staff_name')
+//            ->select();
+//        if(empty($staff)){
+//            $this->error('该工序没有报工数据');
+//        }
+//
+//        $staffMap = [];
+//        $staffNos = [];
+//        foreach ($staff as $item) {
+//            $staffMap[$item['staff_no']] = $item['staff_name'];
+//            $staffNos[] = $item['staff_no'];
+//        }
+//
+//        $salaryRows = db('设备_工分计酬')
+//            ->where('del_rq', null)
+//            ->where('date', 'like', $param['month'] . '%')
+//            ->where('staff_no', 'in', $staffNos)
+//            ->field('staff_no,staff_name,DATE_FORMAT(date, "%Y-%m-%d") as date,sum(salary) as salary,sys_id')
+//            ->group('staff_no,DATE_FORMAT(date, "%Y-%m-%d")')
+//            ->order('staff_no asc,date asc')
+//            ->select();
+//
+//        $grouped = [];
+//        foreach ($salaryRows as $row) {
+//            $staffNo = $row['staff_no'];
+//            if (!isset($grouped[$staffNo])) {
+//                $name = !empty($row['staff_name']) ? $row['staff_name'] : (isset($staffMap[$staffNo]) ? $staffMap[$staffNo] : '');
+//                $grouped[$staffNo] = [
+//                    'staff' => $staffNo . '-' . $name,
+//                    'total_salary' => 0,
+//                    'children' => [],
+//                ];
+//            }
+//            $grouped[$staffNo]['children'][] = [
+//                '员工编号' => $staffNo,
+//                '员工姓名' => !empty($row['staff_name']) ? $row['staff_name'] : (isset($staffMap[$staffNo]) ? $staffMap[$staffNo] : ''),
+//                '日期' => $row['date'],
+//                '工资' => $row['salary'],
+//            ];
+//            $grouped[$staffNo]['total_salary'] += $row['salary'];
+//        }
+//
+//        $this->success('成功', array_values($grouped));
+//
+//    }
+
 
 
     /**
     /**
      * 查询员工工资详情
      * 查询员工工资详情
-     * 
+     *
      */
      */
     public function GetStaffSalaryDetail()
     public function GetStaffSalaryDetail()
     {
     {
@@ -149,10 +375,11 @@ class StaffSalary extends Api
         $list = db('设备_工分计酬')
         $list = db('设备_工分计酬')
             ->alias('a')
             ->alias('a')
             ->join('工单_部件资料 b', 'a.work_order = b.work_order and a.part_code = b.part_code', 'left')
             ->join('工单_部件资料 b', 'a.work_order = b.work_order and a.part_code = b.part_code', 'left')
+            ->join('工单_基本资料 c', 'a.work_order = c.订单编号', 'left')
             ->field('a.work_order as 订单编号,DATE_FORMAT(a.date, "%Y-%m-%d") as 日期,b.part_name as 部件名称,
             ->field('a.work_order as 订单编号,DATE_FORMAT(a.date, "%Y-%m-%d") as 日期,b.part_name as 部件名称,
             a.part_code as 部件编号,a.salary as 工资,a.number as 数量,a.production_hour as 生产工时,a.production_score as 生产分数,
             a.part_code as 部件编号,a.salary as 工资,a.number as 数量,a.production_hour as 生产工时,a.production_score as 生产分数,
-            a.machine as 设备名称,a.process_name as 工序名称,a.standard_hour as 标准工时,a.standard_score as 标准分数,
-            a.coefficient as 系数,a.sys_id as 设备编号')
+            a.machine as 设备名称,a.process_code as 工序编号,a.process_name as 工序名称,a.standard_hour as 标准工时,a.standard_score as 标准分数,
+            a.coefficient as 系数,a.sys_id as 设备编号,c.生产款号,c.款式')
             ->where($where)
             ->where($where)
             ->order('a.date asc,a.process_code asc')
             ->order('a.date asc,a.process_code asc')
             ->select();
             ->select();
@@ -197,8 +424,8 @@ class StaffSalary extends Api
             ->select();
             ->select();
         if(empty($list)){
         if(empty($list)){
             $this->error('没有数据');
             $this->error('没有数据');
-        }   
+        }
         $this->success('成功', $list);
         $this->success('成功', $list);
     }
     }
 
 
-}
+}

+ 3 - 1
application/api/controller/WorkOrderProcess.php

@@ -1820,6 +1820,7 @@ class WorkOrderProcess extends Api
             ->where('a.work_order', $params['workorder'])
             ->where('a.work_order', $params['workorder'])
             ->whereNull('a.del_rq')
             ->whereNull('a.del_rq')
             ->field('b.订单编号,b.生产款号,b.款式,a.process_code as 工序号,a.process_name as 工序名称,a.staff_name as 员工姓名,
             ->field('b.订单编号,b.生产款号,b.款式,a.process_code as 工序号,a.process_name as 工序名称,a.staff_name as 员工姓名,
+            a.sys_id as 小组,
                 SUM(a.number) as 数量,MIN(a.date) as 开工日期,MAX(a.date) as 完工日期,
                 SUM(a.number) as 数量,MIN(a.date) as 开工日期,MAX(a.date) as 完工日期,
                 SUM(a.standard_score) as 工分,SUM(a.production_score) as 工时,SUM(a.salary) as 工资')
                 SUM(a.standard_score) as 工分,SUM(a.production_score) as 工时,SUM(a.salary) as 工资')
             ->group('b.订单编号,b.生产款号,b.款式,a.process_code,a.process_name,a.staff_no,a.staff_name')
             ->group('b.订单编号,b.生产款号,b.款式,a.process_code,a.process_name,a.staff_no,a.staff_name')
@@ -1827,7 +1828,7 @@ class WorkOrderProcess extends Api
             ->select();
             ->select();
 
 
         if (empty($list)) {
         if (empty($list)) {
-            $this->error('未找到报工数据');
+            $this->error('暂无报工数据');
         }
         }
 
 
         $data = [
         $data = [
@@ -1852,6 +1853,7 @@ class WorkOrderProcess extends Api
             $endDate = !empty($row['完工日期']) ? date('Y-m-d', strtotime($row['完工日期'])) : '';
             $endDate = !empty($row['完工日期']) ? date('Y-m-d', strtotime($row['完工日期'])) : '';
             $processMap[$processKey]['staffs'][] = [
             $processMap[$processKey]['staffs'][] = [
                 '员工姓名' => $row['员工姓名'],
                 '员工姓名' => $row['员工姓名'],
+                '小组' => $row['小组'],
                 '数量' => floatval($row['数量']),
                 '数量' => floatval($row['数量']),
                 '开工日期' => $startDate,
                 '开工日期' => $startDate,
                 '完工日期' => $endDate,
                 '完工日期' => $endDate,