Browse Source

工单资料修改

qiuenguang 1 year ago
parent
commit
a06c956e1a
1 changed files with 13 additions and 14 deletions
  1. 13 14
      application/api/controller/WorkOrder.php

+ 13 - 14
application/api/controller/WorkOrder.php

@@ -423,24 +423,23 @@ class WorkOrder extends Api
         $printCode = \db('工单_印件资料')
             ->where('Uniqid',$param['printID'])
             ->value('yj_Yjno');
-        if (empty($printCode)){
-            $this->success('未找到该工单印件资料');
-        }
-        //修改工单工艺计划产量
-        $result = $this->PlannedProcessYield($param['gdbh'],$printCode,0,$param['jhtl']);
-        if ($result === false){
-            $this->success('分配工序计划产量失败');
+        if (!empty($printCode)){
+            //修改工单工艺计划产量
+            $result = $this->PlannedProcessYield($param['gdbh'],$printCode,0,$param['jhtl']);
+            if ($result === false){
+                $this->success('分配工序计划产量失败');
+            }
+            //修改印件信息
+            $printSql = \db('工单_印件资料')
+                ->where('Uniqid',$param['printID'])
+                ->fetchSql(true)
+                ->update(['Yj_Gdbh'=>$param['gdbh'],'yj_yjmc'=>$param['yjmc'],'yj_Yjdh'=>$param['yjdh'],'yj_平张投料'=>$param['jhtl']]);
+            $printRes = Db::query($printSql);
         }
         //修改工单信息
         $sql = \db('工单_基本资料')->where('Uniqid',$param['Uniqid'])->fetchSql(true)->update($row);
         $res = Db::query($sql);
-        //修改印件信息
-        $printSql = \db('工单_印件资料')
-            ->where('Uniqid',$param['printID'])
-            ->fetchSql(true)
-            ->update(['yj_yjmc'=>$param['yjmc'],'yj_Yjdh'=>$param['yjdh'],'yj_平张投料'=>$param['jhtl']]);
-        $printRes = Db::query($printSql);
-        if ($res !== false && $printRes !== false){
+        if ($res !== false){
             $this->success('成功');
         }else{
             $this->error('失败');