|
@@ -3,11 +3,19 @@ declare (strict_types = 1);
|
|
|
|
|
|
namespace app\admin\command;
|
|
|
|
|
|
-use app\admin\model\CompanyInfo;use app\admin\model\InvoiceInfo;use app\admin\model\Pay;use app\admin\model\PayInvoice;use app\admin\model\SupplierInfo;use think\console\Command;
|
|
|
+use app\admin\model\CompanyInfo;
|
|
|
+use app\admin\model\InvoiceInfo;
|
|
|
+use app\admin\model\Pay;
|
|
|
+use app\admin\model\PayInvoice;
|
|
|
+use app\admin\model\SupplierInfo;
|
|
|
+use think\console\Command;
|
|
|
use think\console\Input;
|
|
|
use think\console\input\Argument;
|
|
|
use think\console\input\Option;
|
|
|
-use think\console\Output;use think\facade\Cache;use think\facade\Config;use think\facade\Db;
|
|
|
+use think\console\Output;
|
|
|
+use think\facade\Cache;
|
|
|
+use think\facade\Config;
|
|
|
+use think\facade\Db;
|
|
|
|
|
|
class CheckInvoice extends Command
|
|
|
{
|
|
@@ -23,7 +31,7 @@ class CheckInvoice extends Command
|
|
|
$this->setName('checkinvoice')
|
|
|
->setDescription('the checkinvoice command');
|
|
|
}
|
|
|
-
|
|
|
+ // 执行
|
|
|
protected function execute(Input $input, Output $output)
|
|
|
{
|
|
|
$this->datetime = date("Y-m-d");
|
|
@@ -40,23 +48,23 @@ class CheckInvoice extends Command
|
|
|
$list->next();
|
|
|
}
|
|
|
Cache::set('checkInvoiceP',0);
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
+ // 获取待验票列表
|
|
|
protected function getInvoice(){
|
|
|
$list = PayInvoice::where([["status","in",[1,9]],["open_time","<",$this->datetime],["updatetime","<=",date("Y-m-d H:i:s")],['is_del',"=",0]])->cursor();
|
|
|
foreach ($list as $item){
|
|
|
yield $item;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ // 验票
|
|
|
protected function checkTicket($invoice){
|
|
|
$pay = Pay::where(["payNo"=>$invoice['payNo'],"is_del"=>0,"status"=>2])->findOrEmpty();
|
|
|
if(!$pay->isEmpty()){
|
|
|
- if($pay->winv_fee<=0) return PayInvoice::where(["id"=>$invoice['id']])->update(["status"=>8,"check_remark"=>"待开票金额不足","updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
+ if($pay->winv_fee <= 0) return PayInvoice::where(["id"=>$invoice['id']])->update(["status"=>8,"check_remark"=>"待开票金额不足","updatetime"=>date("Y-m-d H:i:s")]);
|
|
|
$this->taxCheck($invoice);
|
|
|
}
|
|
|
}
|
|
|
+ // 验票
|
|
|
protected function taxCheck($invoice){
|
|
|
$invoiceConf=Config::get('invoice');
|
|
|
$iinvoicenfo = $invoiceConf['91110113MA004JNJ28'];
|
|
@@ -73,7 +81,7 @@ class CheckInvoice extends Command
|
|
|
try{
|
|
|
if(isset($result['code']) && $result['code']=='0000' && isset($result['data']) && count($result['data'])>0){
|
|
|
if($result['data']['cyjg']=='0001'){
|
|
|
- $data= $result['data'];
|
|
|
+ $data= $result['data'];
|
|
|
$this->changeFiled($data,$invoice);
|
|
|
}elseif (in_array($result['data']['cyjg'],['0002','1014'])){
|
|
|
$this->lastUpdate($invoice['id']);
|