Commit 2e744739 authored by hangjun83's avatar hangjun83

财务开票模块更新

parent dbfc71d1
...@@ -232,25 +232,12 @@ class InvoiceService ...@@ -232,25 +232,12 @@ class InvoiceService
'invoice_number' => $result['invoice_number'], 'invoice_number' => $result['invoice_number'],
'invoice_status' => 0 'invoice_status' => 0
]); ]);
return true;
} }
}catch(\Throwable $exception){ }catch(\Throwable $exception){
$update = []; $update = [];
$update['invoice_number'] = $result['invoice_number']; $update['invoice_number'] = $result['invoice_number'];
$update['api_response'] = $exception->getMessage(); $update['api_response'] = $exception->getMessage();
$this->saveInvoiceRecord($update); $this->saveInvoiceRecord($update);
/*switch($invoiceParams['invoice_platform']){
case 'rhawn' :
$updateResult = $this->rhawnInvoiceRepository->updateInvoiceById($invoiceParams['platform_invoice_id'], [
'soi_api_status' => 2,
'soi_no' => mb_substr($exception->getMessage(),0,250,'utf-8')
]);break;
case 'bhua' :
$updateResult = $this->bhuaInvoiceRepository->updateInvoiceById($invoiceParams['platform_invoice_id'], [
'soi_api_status' => 2,
'soi_no' => mb_substr($exception->getMessage(),0,250,'utf-8')
]);break;
}*/
} }
} }
...@@ -664,7 +651,8 @@ class InvoiceService ...@@ -664,7 +651,8 @@ class InvoiceService
if(!Storage::exists($path)){ if(!Storage::exists($path)){
if(empty($pdfUrl)){ if(empty($pdfUrl)){
throw new \Exception('pdf下载地址为空'); SimpleLogs::writeLog('pdf下载地址为空',__CLASS__.':'.__FUNCTION__,'error');
return false;
} }
$pdf = $this->apiService->clientRequest('get',$pdfUrl,[]); $pdf = $this->apiService->clientRequest('get',$pdfUrl,[]);
if($pdf){ if($pdf){
...@@ -722,25 +710,23 @@ class InvoiceService ...@@ -722,25 +710,23 @@ class InvoiceService
public function resetApplyInvoice($invoiceNumber) public function resetApplyInvoice($invoiceNumber)
{ {
$invoice = $this->invoiceRecordRepository->getInvoiceRecordByNumber($invoiceNumber);
if(!$invoice){
throw new \Exception('该发票流水号不存在',502);
}
$invoice = current($invoice);
try{ try{
$invoice = $this->invoiceRecordRepository->getInvoiceRecordByNumber($invoiceNumber); //设置发票平台
if($invoice){ $this->apiService->setInvoicePlatform($invoice['invoice_platform']);
$invoice = current($invoice);
//设置发票平台 $values = $this->apiService->getPlatformDataEntries('invoice_apply_'.$invoiceNumber,'data_values');
$this->apiService->setInvoicePlatform($invoice['invoice_platform']); $this->apiService->applyElecInvoice($values);
$values = $this->apiService->getPlatformDataEntries('invoice_apply_'.$invoiceNumber,'data_values');
$response = $this->apiService->applyElecInvoice($values);
if($response){
return true;
}
}
}catch(\Throwable $exception){ }catch(\Throwable $exception){
$update = []; $update = [];
$update['invoice_number'] = $invoice['invoice_number']; $update['invoice_number'] = $invoice['invoice_number'];
$update['api_response'] = $exception->getMessage(); $update['api_response'] = $exception->getMessage();
$this->saveInvoiceRecord($update); $this->saveInvoiceRecord($update);
SimpleLogs::writeLog($exception->getMessage(),__CLASS__.':'.__FUNCTION__,'error'); //SimpleLogs::writeLog($exception->getMessage(),__CLASS__.':'.__FUNCTION__,'error');
//var_dump($exception->getMessage()); //var_dump($exception->getMessage());
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment