wugg 4 månader sedan
förälder
incheckning
40d59a8948

+ 6 - 3
app/admin/command/CheckInvoice.php

@@ -131,10 +131,11 @@ class CheckInvoice extends Command
         $inv_fee=($pay->winv_fee <= $save['total'])?$pay->winv_fee:$save['total'];
         $pay->winv_fee = $pay->winv_fee - $inv_fee;
         $pay->inv_fee = $pay->inv_fee+$inv_fee;
-        $pay->save();
+       $up=$pay->save();
+       if($up==false) throw new \Exception("对账单更新失败");
         $buyerCode=CompanyInfo::getRegisterCode($pay->companyNo);
         $sellerCode=SupplierInfo::getRegisterCode($pay->supplierNo);
-        PayInvoice::where(["hpNo"=>$invoice['hpNo'],"status"=>1])->update([
+       $sa= PayInvoice::where(["hpNo"=>$invoice['hpNo'],"status"=>[1,9]])->update([
             "status"=>$pay->pay_type==1?11:2,
             "invStatus"=>$this->taxStatus[$data['zfbz']]??0,
             "check_remark"=>'',
@@ -145,7 +146,9 @@ class CheckInvoice extends Command
             "inv_subtotal_amount"=>$save['subtotal_amount'],
             "updatetime"=>date("Y-m-d H:i:s")
         ]);
-        InvoiceInfo::create($save);
+        if($sa==false) throw new \Exception("{$invoice['hpNo']}验票数据更新失败");
+        $cres=InvoiceInfo::create($save);
+        if($cres==false) throw new \Exception("{$invoice['hpNo']}验票数据写入失败");
     }
 
     protected function checkItem($detail){

+ 3 - 2
app/admin/command/CheckTicket.php

@@ -110,8 +110,9 @@ class CheckTicket extends Command
             'updatetime'=>$this->dateTime,
             ]);
         }
-        InvoicePool::where(['invNo'=>$info['invNo']])->save(["status"=>4,"updatetime"=>$this->dateTime]);
-         \app\admin\model\Assoc::subOrder($info['invNo']);
+        $info=InvoicePool::where(['invNo'=>$info['invNo']])->save(["status"=>4,"updatetime"=>$this->dateTime]);
+        if($info==false) throw new \Exception("更新发票状态失败");
+        \app\admin\model\Assoc::subOrder($info['invNo']);
           if($info->is_comon==1)event('comonOrder',['invNo'=>$info['invNo'],'type'=>'inv']);
     }
     protected function itemFiled($detail){

+ 0 - 1
app/admin/controller/ComonOrder.php

@@ -548,7 +548,6 @@ class ComonOrder extends Base
         $platform = array_column($qrdinfo,'platform_type');
         if(count(array_unique($platform))!=1){
         	$this->error('订单平台类型不一致');
-//            return error_show(1004,'订单平台类型不一致');
         }
         foreach ($param['orderArr'] as $i=>$item){
         	if($valide->check($item)==false) $this->error($valide->getError());

+ 8 - 0
app/admin/controller/Export.php

@@ -240,7 +240,9 @@ class Export extends Base
 
         $list = Db::name('trade')
             ->alias('a')
+            ->leftJoin("trade_lib e","a.tradNo=e.tradNo")
             ->field('a.companyNo 收款方公司编码,
+            a.pcCode 资金批次号 
             a.trade_in 收款单位名称,
             a.trade_account 付款银行单位账号,
             a.trade_out 付款银行单位名称,
@@ -253,9 +255,15 @@ class Export extends Base
             b.total_fee 已认领金额,
             b.logNo 资金认领编号,
             b.customerNo 认领企业,
+            if(a.trade_type=0,"自营","平台") as 资金回款类型, 
+            e.palt_po  平台采购PO,
+            b.relaNo 关联资金认领编号,
+            if(b.tag_type=0,"手动创建","自动创建") as 操作类型,
+            if(b.is_comon=1,"通用订单","自营订单") as 订单业务类型,
             c.orderCode 订单编号,
             d.cxCode 销售主单号,
             d.poCode 平台编号,
+            d.goodNo  商品SKU,
             d.goodName 产品名称,
             d.ownerName 资金创建人,
             c.apply_name 认领创建人,

+ 4 - 3
app/admin/listener/ComonQrd.php

@@ -37,13 +37,13 @@ class ComonQrd
     public function InvToPay($data,$bool=True){
                 $invinfo =InvoicePool::with(["poolInfo"])->where(['invNo'=>$data['invNo']])->findOrEmpty();
             	if($invinfo->isEmpty())return;
-            	if($invinfo->buyer_code !=='911100006337468570')return;
+            	if($invinfo->buyer_code !='911100006337468570')return;
             	if($bool){
             		if($invinfo->status!=4 ||$invinfo->is_comon!=1 )return;
             		$assoc_status=2;
             	}else{
             		$assoc_status=3;
-            		if(in_array($invinfo->status,[5,6,7,8,9])||$invinfo->is_comon!=1 )return;
+            		if(!in_array($invinfo->status,[5,6,7,8,9])||$invinfo->is_comon!=1 )return;
             	}
 
             	$assoc = Assoc::where(["viceCode"=>$data['invNo'],"status"=>$assoc_status,"is_del"=>0,"type"=>1])->select();
@@ -90,7 +90,8 @@ class ComonQrd
                         $tag_fee = ($item->pay_tag_fee>$payArr[$item->sequenceNo])?$payArr[$item->sequenceNo]:$item->pay_tag_fee;
                         $qrd['pay_tag_fee']=$item->pay_tag_fee-$tag_fee;
                         $qrd['wpay_fee'] = $item->wpay_fee+$tag_fee;
-                        $qrd['pay_status'] = ($qrd['wpay_fee']==0  &&$item->pay_fee==0) ? 3:($qrd['apay_fee']==0?2:1);
+                        $qrd['pay_status'] = ($qrd['apay_fee']==0  &&$item->pay_fee==0) ? 1:2;
+                        if($qrd['pay_tag_fee']==0) $qrd['pay_tag']=0;
 		            }
 		            $qrdSave[]=$qrd;
 		            $tag[]=$tag_temp;