Commit 2e744739 authored by hangjun83's avatar hangjun83

财务开票模块更新

parent dbfc71d1
......@@ -232,25 +232,12 @@ class InvoiceService
'invoice_number' => $result['invoice_number'],
'invoice_status' => 0
]);
return true;
}
}catch(\Throwable $exception){
$update = [];
$update['invoice_number'] = $result['invoice_number'];
$update['api_response'] = $exception->getMessage();
$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
if(!Storage::exists($path)){
if(empty($pdfUrl)){
throw new \Exception('pdf下载地址为空');
SimpleLogs::writeLog('pdf下载地址为空',__CLASS__.':'.__FUNCTION__,'error');
return false;
}
$pdf = $this->apiService->clientRequest('get',$pdfUrl,[]);
if($pdf){
......@@ -722,25 +710,23 @@ class InvoiceService
public function resetApplyInvoice($invoiceNumber)
{
$invoice = $this->invoiceRecordRepository->getInvoiceRecordByNumber($invoiceNumber);
if(!$invoice){
throw new \Exception('该发票流水号不存在',502);
}
$invoice = current($invoice);
try{
$invoice = $this->invoiceRecordRepository->getInvoiceRecordByNumber($invoiceNumber);
if($invoice){
$invoice = current($invoice);
//设置发票平台
$this->apiService->setInvoicePlatform($invoice['invoice_platform']);
$values = $this->apiService->getPlatformDataEntries('invoice_apply_'.$invoiceNumber,'data_values');
$response = $this->apiService->applyElecInvoice($values);
if($response){
return true;
}
}
//设置发票平台
$this->apiService->setInvoicePlatform($invoice['invoice_platform']);
$values = $this->apiService->getPlatformDataEntries('invoice_apply_'.$invoiceNumber,'data_values');
$this->apiService->applyElecInvoice($values);
}catch(\Throwable $exception){
$update = [];
$update['invoice_number'] = $invoice['invoice_number'];
$update['api_response'] = $exception->getMessage();
$this->saveInvoiceRecord($update);
SimpleLogs::writeLog($exception->getMessage(),__CLASS__.':'.__FUNCTION__,'error');
//SimpleLogs::writeLog($exception->getMessage(),__CLASS__.':'.__FUNCTION__,'error');
//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