|
@@ -547,19 +547,26 @@ class WorkOrderProcess extends Api
|
|
|
->whereNull('del_rq')
|
|
->whereNull('del_rq')
|
|
|
->update($data);
|
|
->update($data);
|
|
|
if ($updateResult === false) {
|
|
if ($updateResult === false) {
|
|
|
- throw new \Exception('更新工艺失败');
|
|
|
|
|
|
|
+ $dbError = Db::getError();
|
|
|
|
|
+ $detail = is_array($dbError) && !empty($dbError) ? json_encode($dbError, JSON_UNESCAPED_UNICODE) : '';
|
|
|
|
|
+ throw new \Exception('更新工艺失败' . ($detail !== '' ? ':' . $detail : ''));
|
|
|
}
|
|
}
|
|
|
if ($updateResult === 0) {
|
|
if ($updateResult === 0) {
|
|
|
throw new \Exception('未找到可更新的工艺');
|
|
throw new \Exception('未找到可更新的工艺');
|
|
|
}
|
|
}
|
|
|
$logResult = Db::name('work_order_operation_log')->insertAll($logList);
|
|
$logResult = Db::name('work_order_operation_log')->insertAll($logList);
|
|
|
- if ($logResult === false) {
|
|
|
|
|
- throw new \Exception('写入操作日志失败');
|
|
|
|
|
|
|
+ if ($logResult === false || $logResult === 0) {
|
|
|
|
|
+ $dbError = Db::getError();
|
|
|
|
|
+ $detail = is_array($dbError) && !empty($dbError) ? json_encode($dbError, JSON_UNESCAPED_UNICODE) : '';
|
|
|
|
|
+ throw new \Exception('写入操作日志失败' . ($detail !== '' ? ':' . $detail : ''));
|
|
|
}
|
|
}
|
|
|
Db::commit();
|
|
Db::commit();
|
|
|
|
|
+ } catch (\think\exception\HttpResponseException $e) {
|
|
|
|
|
+ throw $e;
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
Db::rollback();
|
|
Db::rollback();
|
|
|
- $this->error('更新失败');
|
|
|
|
|
|
|
+ $msg = trim($e->getMessage());
|
|
|
|
|
+ $this->error('更新失败:' . ($msg !== '' ? $msg : '未知错误'));
|
|
|
}
|
|
}
|
|
|
$this->success('更新成功');
|
|
$this->success('更新成功');
|
|
|
}
|
|
}
|