调整备货单&审批
This commit is contained in:
@@ -64,9 +64,11 @@ class StockOrdersService
|
||||
|
||||
$config['order']['id'] = 'desc';
|
||||
break;
|
||||
case 'show':
|
||||
case 'print':
|
||||
$config['where']['id'] = $p['id'];
|
||||
break;
|
||||
case 'show':
|
||||
$config['where']['id'] = $p['id'];
|
||||
|
||||
$config['with'][] = 'items';
|
||||
$config['with'][] = 'items.options';
|
||||
@@ -224,13 +226,24 @@ class StockOrdersService
|
||||
$appro = new \app\common\utils\approval\service\ApprovalFlowService();
|
||||
$result = $appro->start('stock_order_flow', 'stock_orders', $res->id, $res->toArray(), $res->salesperson_id);
|
||||
var_dump($result);
|
||||
|
||||
// 异步生成pdf文件
|
||||
\Webman\RedisQueue\Redis::send('stock-order-pdf', ['id'=>$res->id]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
public function servicePrint(Request $request)
|
||||
public function createdPdfFile($id)
|
||||
{
|
||||
$config = $this->buildQueryConfig($request, 'print');
|
||||
$config = [];
|
||||
$config['model'] = $this->modelClass;
|
||||
$config['where']['id'] = $id;
|
||||
$config['with'][] = 'items';
|
||||
$config['with'][] = 'items.options';
|
||||
$config['with'][] = 'items.moneyValues';
|
||||
$config['with'][] = 'accounts';
|
||||
$config['with'][] = 'moneyValues';
|
||||
$config['with'][] = 'salesperson';
|
||||
$item = $this->logicShow($config);
|
||||
$pdfData = $this->pdfData($item);
|
||||
|
||||
@@ -259,11 +272,35 @@ class StockOrdersService
|
||||
// 'Content-Disposition' => 'inline; filename="stock-order.pdf"',
|
||||
// ], $pdfBin);
|
||||
|
||||
$url = [
|
||||
'file_name' => $fileName,
|
||||
'file_url' => getenv('MAIN_DOMAIN').'/pdf/'.$fileName
|
||||
// $url = [
|
||||
// 'file_name' => $fileName,
|
||||
// 'file_url' => getenv('MAIN_DOMAIN').'/pdf/'.$fileName
|
||||
// ];
|
||||
|
||||
// 上传云端
|
||||
$param = [
|
||||
'path' => $dir . $fileName,
|
||||
'scene' => 'stock_orders',
|
||||
'category' => 'pdf',
|
||||
'original_name' => $fileName
|
||||
];
|
||||
return $url;
|
||||
$up = new UploadService();
|
||||
$res = $up->uploadLocalFile($param);
|
||||
|
||||
@unlink($dir . $fileName);
|
||||
|
||||
// 更新文件地址
|
||||
$item->file_url = $res['file_name'];
|
||||
$item->save();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function servicePrint(Request $request)
|
||||
{
|
||||
$config = $this->buildQueryConfig($request, 'show');
|
||||
$item = $this->logicShow($config);
|
||||
return $this->postProcess('Print', $item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user