liuhairui 1 week ago
parent
commit
154814688c
1 changed files with 30 additions and 5 deletions
  1. 30 5
      application/api/controller/StaffSalary.php

+ 30 - 5
application/api/controller/StaffSalary.php

@@ -13,7 +13,32 @@ class StaffSalary extends Api
     protected $noNeedLogin = ['*'];
     protected $noNeedRight = ['*'];
 
-
+//    public function GetReportingWorkMonth()
+//    {
+//        if (!$this->request->isGet()) {
+//            $this->error('请求方法错误');
+//        }
+//        $data = db('设备_工分计酬')
+//            ->where('del_rq', null)
+//            ->field('DISTINCT DATE_FORMAT(date, "%Y-%m") as month')
+//            ->order('date desc')
+//            ->select();
+//
+//        //获取员工部门
+//        $big_process = db('人员_基本资料')
+//            ->field('DISTINCT big_process')
+//            ->where('big_process','<>','')
+//            ->select();
+//        foreach ($big_process as $v) {
+//            $big_process_name[] = $v['big_process'];
+//        }
+//        $result = [];
+//        foreach ($data as $v) {
+//            $result[$v['month']] = $big_process_name;
+//        }
+//
+//        $this->success('成功', $result);
+//    }
     /**
      * 查询报工数据月份(年-年月-日期-工序-小组五级树)
      * @ApiMethod (GET)
@@ -33,7 +58,7 @@ class StaffSalary extends Api
             ->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')
+            ->order('sys_rq desc, process asc, sys_id asc')
             ->select();
 
         if (empty($rows)) {
@@ -369,7 +394,7 @@ class StaffSalary extends Api
         }
         $where = [
             'a.staff_no' => $param['staff_no'],
-            'a.date' => ['like', $param['date'] . '%'],
+            'a.sys_rq' => ['like', $param['date'] . '%'],
             'a.del_rq' => null,
         ];
         $list = db('设备_工分计酬')
@@ -381,7 +406,7 @@ class StaffSalary extends Api
             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)
-            ->order('a.date asc,a.process_code asc')
+            ->order('a.sys_rq asc,a.process_code asc')
             ->select();
         if(empty($list)){
             $this->error('没有数据');
@@ -420,7 +445,7 @@ class StaffSalary extends Api
             ->group('staff_no,staff_name')
             ->field('staff_no,staff_name,DATE_FORMAT(date, "%Y-%m-%d") as date,sum(salary) as salary')
             ->group('staff_no,DATE_FORMAT(date, "%Y-%m-%d")')
-            ->order('staff_no asc,date asc')
+            ->order('staff_no asc,sys_rq asc')
             ->select();
         if(empty($list)){
             $this->error('没有数据');