unknown 22 часов назад
Родитель
Сommit
e53093f857
1 измененных файлов с 22 добавлено и 36 удалено
  1. 22 36
      application/api/controller/MachineProductionReport.php

+ 22 - 36
application/api/controller/MachineProductionReport.php

@@ -874,31 +874,24 @@ class MachineProductionReport extends Api
             'sczl_rate6','sczl_rate7','sczl_rate8','sczl_rate9','sczl_rate10'
             'sczl_rate6','sczl_rate7','sczl_rate8','sczl_rate9','sczl_rate10'
         ];
         ];
         $data = [];
         $data = [];
-        $process = db('工单_工艺资料')
-            ->where([
-                'Gy0_gdbh' => $req['sczl_gdbh'],
-                'Gy0_yjno' => $req['sczl_yjno'],
-            ])
-            ->field("CONCAT(
-                LPAD(CAST(TRIM(Gy0_gxh) AS UNSIGNED), 2, '0'), 
-                '-', 
-                TRIM(Gy0_gxmc)
-            ) as Gy0_gxmc,Gy0_gxh")
-            ->select();
         foreach ($arr as $key => $value){
         foreach ($arr as $key => $value){
             if (!(isset($req[$value]))){
             if (!(isset($req[$value]))){
                 $this->error('参数错误',$value,$key+1);
                 $this->error('参数错误',$value,$key+1);
             }
             }
             $data[$value] = $req[$value];
             $data[$value] = $req[$value];
         }
         }
-        $i = 0;
-        foreach ($process as $key => $value){
-            if ($data['sczl_gxh'] === $value['Gy0_gxh'] && $data['sczl_gxmc'] !== $value['Gy0_gxmc']){
-                $i++;
-            }
+        $process = db('工单_工艺资料')
+            ->where([
+                'Gy0_gdbh' => $req['sczl_gdbh'],
+                'Gy0_yjno' => $req['sczl_yjno'],
+                'Gy0_gxh' => $req['sczl_gxh'],
+            ])
+            ->value('Gy0_gxmc');           
+        if(empty($process)){
+            $this->error('工单没有该工序,请调整之后再提交');
         }
         }
-        if ($i !== 0){
-            $this->error('工序编号错误,请调整之后再提交');
+        if($process !== $data['sczl_type']){
+            $this->error('工序名称和工单工艺不匹配,请调整之后再提交');
         }
         }
         $data['sys_rq'] = date('Y-m-d H:i:s');
         $data['sys_rq'] = date('Y-m-d H:i:s');
 
 
@@ -950,31 +943,24 @@ class MachineProductionReport extends Api
             'sczl_rate6','sczl_rate7','sczl_rate8','sczl_rate9','sczl_rate10'
             'sczl_rate6','sczl_rate7','sczl_rate8','sczl_rate9','sczl_rate10'
         ];
         ];
         $data = [];
         $data = [];
-        $process = db('工单_工艺资料')
-            ->where([
-                'Gy0_gdbh' => $req['sczl_gdbh'],
-                'Gy0_yjno' => $req['sczl_yjno'],
-            ])
-            ->field("CONCAT(
-                LPAD(CAST(TRIM(Gy0_gxh) AS UNSIGNED), 2, '0'), 
-                '-', 
-                TRIM(Gy0_gxmc)
-            ) as Gy0_gxmc,Gy0_gxh")
-            ->select();
         foreach ($arr as $key => $value){
         foreach ($arr as $key => $value){
             if (!(isset($req[$value]))){
             if (!(isset($req[$value]))){
                 $this->error('参数错误',$value,$key+1);
                 $this->error('参数错误',$value,$key+1);
             }
             }
             $data[$value] = $req[$value];
             $data[$value] = $req[$value];
         }
         }
-        $i = 0;
-        foreach ($process as $key => $value){
-            if ($data['sczl_gxh'] === $value['Gy0_gxh'] && $data['sczl_gxmc'] !== $value['Gy0_gxmc']){
-                $i++;
-            }
+        $process = db('工单_工艺资料')
+            ->where([
+                'Gy0_gdbh' => $req['sczl_gdbh'],
+                'Gy0_yjno' => $req['sczl_yjno'],
+                'Gy0_gxh' => $req['sczl_gxh'],
+            ])
+            ->value('Gy0_gxmc');           
+        if(empty($process)){
+            $this->error('工单没有该工序,请调整之后再提交');
         }
         }
-        if ($i !== 0){
-            $this->error('工序编号错误,请调整之后再提交');
+        if($process !== $data['sczl_type']){
+            $this->error('工序名称和工单工艺不匹配,请调整之后再提交');
         }
         }
         $data['mod_rq'] = date('Y-m-d H:i:s');
         $data['mod_rq'] = date('Y-m-d H:i:s');