|
@@ -3,7 +3,7 @@ declare (strict_types = 1);
|
|
|
|
|
|
namespace app\command;
|
|
|
|
|
|
-use app\admin\model\CgdCaixiao;use app\admin\model\Platform;use app\admin\model\SaleCaixiao;use think\console\Command;use think\console\Input;use think\console\Output;use think\facade\Cache;use think\facade\Db;
|
|
|
+use app\admin\model\CgdCaixiao;use app\admin\model\GoodTax;use app\admin\model\Platform;use app\admin\model\SaleCaixiao;use app\model\TaxRelation;use think\console\Command;use think\console\Input;use think\console\Output;use think\facade\Cache;use think\facade\Db;
|
|
|
|
|
|
class caixiao extends Command
|
|
|
{
|
|
@@ -21,6 +21,7 @@ class caixiao extends Command
|
|
|
$unique = md5($item->cgdNo.$item->updatetime);
|
|
|
$temp=['order_type'=>2,'uniqkey'=>$unique,'status'=>1,'addtime'=>date('Y-m:d H:i:s')];
|
|
|
if($this->isInCfp($unique)){
|
|
|
+ $item['inv_cat_info'] = $this->spuCat($item->spuCode,$item->orderScource,2);
|
|
|
$item['cat_name'] = json_decode($item->cat_name);
|
|
|
$temp['data']= json_encode($item,JSON_UNESCAPED_UNICODE);
|
|
|
$cgdArr[]=$temp;
|
|
@@ -63,9 +64,11 @@ class caixiao extends Command
|
|
|
$qrd=[];
|
|
|
foreach ($list as $item){
|
|
|
$unique = md5($item->orderCode.$item->updatetime);
|
|
|
+
|
|
|
echo date('Y-m:d H:i:s').'|'.$item->orderCode."\r\n";
|
|
|
$temp=["order_type"=>1,"uniqkey"=>$unique,"status"=>1,"addtime"=>date('Y-m:d H:i:s')];
|
|
|
if($this->isInCfp($unique)){
|
|
|
+ $item['inv_cat_info'] = $this->spuCat($item->good_code,$item->order_source,1);
|
|
|
$item['cat_name'] = json_decode($item->cat_name);
|
|
|
$temp["data"]= json_encode($item,JSON_UNESCAPED_UNICODE);
|
|
|
$qrd[]=$temp;
|
|
@@ -78,4 +81,22 @@ class caixiao extends Command
|
|
|
$ist = $this->contect->name("caixiao_data")->where("uniqkey",$unique)->findOrEmpty();
|
|
|
return empty($ist);
|
|
|
}
|
|
|
+
|
|
|
+ protected function SpuCat($spuCode,$orderScource,$type=1){
|
|
|
+ $spuCat= GoodTax::with(['tax'])->where("spuCode",$spuCode)->findOrEmpty();
|
|
|
+ $result=["cat_code"=>"","tax"=>"","inv_good_name"=>""];
|
|
|
+ if($spuCat->isEmpty()) return $result;
|
|
|
+ if($type==2 && $orderScource!=8){
|
|
|
+ $result["cat_code"]=$spuCat->merge_code;
|
|
|
+ $result["tax"]=$spuCat->tax;
|
|
|
+ $result["inv_good_name"]=$spuCat->inv_good_name;
|
|
|
+ }else{
|
|
|
+ $taxRelation= TaxRelation::with(['outputInfo'])->where(["income_tax_id"=>$spuCat->tax_id,"companyNo"=>$spuCat->companyNo])->findOrEmpty();
|
|
|
+ if($taxRelation->isEmpty()) return $result;
|
|
|
+ $result["cat_code"]=$taxRelation->merge_code;
|
|
|
+ $result["tax"]=$taxRelation->output_bind_tax;
|
|
|
+ $result["inv_good_name"]=$spuCat->inv_good_name;
|
|
|
+ }
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
}
|