Browse Source

代码优化

曹鹤洋 1 year ago
parent
commit
98fa26beec

+ 2 - 2
application/api/controller/FinishedProductWarehousing.php

@@ -39,11 +39,11 @@ class FinishedProductWarehousing extends Api
             ->select();
 
         $num = db('成品入仓')
-            ->where('sys_rq','>=',$rows[49]['date'])
+            ->where('sys_rq','>=',$rows[count($rows)-1]['date'])
             ->count();
         $arr = db('成品入仓')
             ->field('LEFT(sys_rq, 10) as date, rtrim(sys_id) as sys_id, COUNT(sys_id) as count')
-            ->where('sys_rq','>=',$rows[49]['date'])
+            ->where('sys_rq','>=',$rows[count($rows)-1]['date'])
             ->group('date, sys_id')
             ->limit($num)
             ->select();

+ 2 - 2
application/api/controller/Inspect.php

@@ -38,11 +38,11 @@ class Inspect extends Api
             ->limit(30)
             ->select();
         $num = db('db_手工检验')
-            ->where('sys_rq','>=',$rows[29]['date'])
+            ->where('sys_rq','>=',$rows[count($rows)-1]['date'])
             ->count();
         $arr = db('db_手工检验')
             ->field('LEFT(sys_rq, 10) as date, rtrim(sys_id) as sys_id, COUNT(sys_id) as count')
-            ->where('sys_rq','>=',$rows[29]['date'])
+            ->where('sys_rq','>=',$rows[count($rows)-1]['date'])
             ->group('date, sys_id')
             ->limit($num)
             ->select();

+ 3 - 2
application/api/controller/MachineProductionReport.php

@@ -110,11 +110,12 @@ class MachineProductionReport extends Api
             $this->error('请求方式错误');
         }
 
+        $date = date('Y-m-d',strtotime("-1 year"));
         $sql = 'SELECT t1.`sczl_gdbh`,t2.`yj_yjmc`
         FROM (
-            SELECT DISTINCT `sczl_gdbh`, sczl_yjno FROM `db_sczl`
+            SELECT DISTINCT `sczl_gdbh`, sczl_yjno FROM `db_sczl` where sys_rq >"'.$date.'"
             UNION
-            SELECT  DISTINCT `sczl_gdbh`, sczl_yjno FROM `设备_产量计酬` where sys_rq >"2023-01-01"
+            SELECT  DISTINCT `sczl_gdbh`, sczl_yjno FROM `设备_产量计酬` where sys_rq >"'.$date.'"
         ) AS t1
         JOIN `工单_印件资料` AS t2 ON t1.`sczl_gdbh` = t2.`Yj_Gdbh`
         WHERE t1.sczl_yjno = t2.yj_Yjno

+ 1 - 1
application/api/controller/MachineProductionReportAdd.php

@@ -41,7 +41,7 @@ class MachineProductionReportAdd extends Api
 
         $arr = db('db_sczladd')
             ->field('LEFT(sys_rq, 10) as date, rtrim(sys_id) as sys_id, COUNT(sys_id) as count')
-            ->where('sys_rq','>=',$rows[59]['date'])
+            ->where('sys_rq','>=',$rows[count($rows)-1]['date'])
             ->group('date, sys_id')
             ->select();
 

+ 1 - 1
application/api/controller/PackagingCountDocument.php

@@ -42,7 +42,7 @@ class PackagingCountDocument extends Api
 
         $arr = db()->table('db_包装计件')->cache(true,300)
             ->field('LEFT(sys_rq, 10) as date, rtrim(sys_id) as sys_id, COUNT(sys_id) as count')
-            ->where('sys_rq','>=',$rows[29]['date'])
+            ->where('sys_rq','>=',$rows[count($rows)-1]['date'])
             ->group('date, sys_id')
             ->select();
 

+ 1 - 1
application/api/controller/PackagingProcessOutput.php

@@ -40,7 +40,7 @@ class PackagingProcessOutput extends Api
 
         $arr = db()->table('db_包装产量预报')
             ->field('LEFT(sys_rq, 10) as date, rtrim(sys_id) as sys_id, COUNT(sys_id) as count')
-            ->where('sys_rq','>=',$rows[29]['date'])
+            ->where('sys_rq','>=',$rows[count($rows)-1]['date'])
             ->group('date, sys_id')
             ->select();
 

+ 1 - 1
application/api/controller/WorkOrderSpotCheck.php

@@ -40,7 +40,7 @@ class WorkOrderSpotCheck extends Api
 
         $arr = db()->table('db_抽检记录')
             ->field('LEFT(Sys_rq, 10) as date, rtrim(Sys_id) as Sys_id, COUNT(Sys_id) as count')
-            ->where('Sys_rq','>=',$rows[44]['date'])
+            ->where('Sys_rq','>=',$rows[count($rows)-1]['date'])
             ->group('date, Sys_id')
             ->order('UniqId desc')
             ->select();

+ 1 - 1
application/api/controller/WorkOrderVerification.php

@@ -44,7 +44,7 @@ class WorkOrderVerification extends Api
 
             $arr = db()->table('db_qczl')
                 ->field('LEFT(sys_rq, 10) as date, rtrim(sys_id) as sys_id, COUNT(sys_id) as count')
-                ->where('sys_rq','>=',$rows[29]['date'])
+                ->where('sys_rq','>=',$rows[count($rows)-1]['date'])
                 ->group('date, sys_id')
                 ->select();