ソースを参照

产量数据上报工序编号限制

unknown 12 時間 前
コミット
4fdab37d3a
1 ファイル変更41 行追加1 行削除
  1. 41 1
      application/api/controller/MachineProductionReport.php

+ 41 - 1
application/api/controller/MachineProductionReport.php

@@ -874,12 +874,32 @@ class MachineProductionReport extends Api
             'sczl_rate6','sczl_rate7','sczl_rate8','sczl_rate9','sczl_rate10'
         ];
         $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){
             if (!(isset($req[$value]))){
                 $this->error('参数错误',$value,$key+1);
             }
             $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++;
+            }
+        }
+        if ($i !== 0){
+            $this->error('工序编号错误,请调整之后再提交');
+        }
         $data['sys_rq'] = date('Y-m-d H:i:s');
 
         //查询UniqId
@@ -930,12 +950,32 @@ class MachineProductionReport extends Api
             'sczl_rate6','sczl_rate7','sczl_rate8','sczl_rate9','sczl_rate10'
         ];
         $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){
             if (!(isset($req[$value]))){
-                continue;
+                $this->error('参数错误',$value,$key+1);
             }
             $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++;
+            }
+        }
+        if ($i !== 0){
+            $this->error('工序编号错误,请调整之后再提交');
+        }
         $data['mod_rq'] = date('Y-m-d H:i:s');
 
         //开启事务