unknown hace 1 día
padre
commit
4ca57e87fe

+ 10 - 32
application/api/controller/Manufacture.php

@@ -362,44 +362,22 @@ class Manufacture extends Api
      * @throws \think\Exception
      * @throws \think\Exception
      * @throws \think\exception\PDOException
      * @throws \think\exception\PDOException
      */
      */
-    public function StatusEdit()
+     public function StatusEdit()
     {
     {
-        if ($this->request->isPost() === false) {
+        if (Request::instance()->isPost() === false){
             $this->error('请求错误');
             $this->error('请求错误');
         }
         }
-        $param = $this->request->param();
-        $workOrder = $param['workOrder'] ?? input('workOrder');
-        $status = $param['status'] ?? input('status');
-        if (empty($workOrder) || empty($status)) {
+        $workOrder = input('workOrder');
+        $status = input('status');
+        if (empty($workOrder) || empty($status)){
             $this->error('参数错误');
             $this->error('参数错误');
         }
         }
-        $oldStatus = \db('工单_基本资料')->where('Gd_gdbh', $workOrder)->value('gd_statu');
-        $modifyUser = $param['sys_id'] ?? $param['Sys_id'] ?? '';
-        Db::startTrans();
-        try {
-            $res = \db('工单_基本资料')->where('Gd_gdbh', $workOrder)->update([
-                'gd_statu' => $status,
-                'Mod_rq'   => date('Y-m-d H:i:s')
-            ]);
-            if ($res === false) {
-                throw new \Exception('更新工单状态失败');
-            }
-            \db('系统操作日志表')->insert([
-                'Gd_gdbh'      => $workOrder,
-                'ModifyUser'   => $modifyUser,
-                'ModifyTime'   => date('Y-m-d H:i:s'),
-                'FieldName'    => 'gd_statu',
-                'OldValue'     => $oldStatus,
-                'NewValue'     => $status,
-                'ModifySource' => '工单状态变更'
-            ]);
-            Db::commit();
+        $sql = \db('工单_基本资料')->where('Gd_gdbh',$workOrder)->fetchSql(true)->update(['gd_statu'=>$status,'Mod_rq'=>date('Y-m-d H:i:s',time())]);
+        $res = Db::query($sql);
+        if ($res !== false){
             $this->success('成功');
             $this->success('成功');
-        } catch (\think\exception\HttpResponseException $e) {
-            throw $e;
-        } catch (\Exception $e) {
-            Db::rollback();
-            $this->error($e->getMessage() ?: '失败');
+        }else{
+            $this->error('失败');
         }
         }
     }
     }
 
 

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

@@ -1383,7 +1383,7 @@ class Product extends Api
         // $updateResult = Db::name('产品_工艺资料')
         // $updateResult = Db::name('产品_工艺资料')
         //     ->where('UniqID', $uniqId)
         //     ->where('UniqID', $uniqId)
         //     ->update($updateData);
         //     ->update($updateData);
- 
+
         $sql = \db('产品_工艺资料')->where('UniqID',$uniqId)->fetchSql(true)->update($params);
         $sql = \db('产品_工艺资料')->where('UniqID',$uniqId)->fetchSql(true)->update($params);
         $updateResult = Db::query($sql);
         $updateResult = Db::query($sql);