Merge branch 'develop'
This commit is contained in:
@@ -38,7 +38,7 @@ class StockOrdersController extends BaseController
|
||||
if (isset($data['id'])) {
|
||||
$appro = new \app\common\utils\approval\service\ApprovalFlowService();
|
||||
$appro = $appro->getBriefStatusByBiz($data['id'], null, 'name');
|
||||
$map = ['processing'=>'审批中','pending'=>'审批中','approved'=>'已通过','rejected'=>'已拒绝','revoked'=>'已撤回'];
|
||||
$map = ['processing'=>'审批中','pending'=>'审批中','approved'=>'已通过','rejected'=>'已拒绝','revoked'=>'已撤回','voided'=>'已作废'];
|
||||
if ($appro) {
|
||||
$data['appro_status'] = [
|
||||
'status' => $appro['status'],
|
||||
@@ -182,6 +182,32 @@ class StockOrdersController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function approvalNullify(Request $request)
|
||||
{
|
||||
try {
|
||||
$raw = $this->service->serviceApprovalNullify($request);
|
||||
$data = $this->transformData($raw, method_exists($this, 'approvalFormat')
|
||||
? [$this, 'approvalFormat']
|
||||
: null);
|
||||
return $this->success($data);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function approvalRevoke(Request $request)
|
||||
{
|
||||
try {
|
||||
$raw = $this->service->serviceApprovalRevoke($request);
|
||||
$data = $this->transformData($raw, method_exists($this, 'approvalFormat')
|
||||
? [$this, 'approvalFormat']
|
||||
: null);
|
||||
return $this->success($data);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 最终审批
|
||||
*/
|
||||
|
||||
@@ -72,11 +72,21 @@ class StockOrdersService extends \app\common\service\StockOrdersService
|
||||
{
|
||||
$config = $this->buildQueryConfig($request, 'detail');
|
||||
$item = $this->logicShow($config);
|
||||
|
||||
// 检查是否至少有一个车辆填写了vin
|
||||
$hasVin = false;
|
||||
foreach ($item->items as $k => $v) {
|
||||
if ($v->vin === '') {
|
||||
throw new BusinessException('存在未填写vin的车辆,无法完成提交审核');
|
||||
if ($v->vin !== '') {
|
||||
$hasVin = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果没有任何车辆填写vin,则抛出异常
|
||||
if (!$hasVin) {
|
||||
throw new BusinessException('至少需要为一辆车辆填写vin,才能提交审核');
|
||||
}
|
||||
|
||||
$this->logicUpdateBy($config, [
|
||||
'approval_status' => 1
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user