wuggemail@foxmail.com vor 3 Monaten
Ursprung
Commit
be830f1d6f
1 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
  1. 4 4
      app/cxinv/command/MakeSeal.php

+ 4 - 4
app/cxinv/command/MakeSeal.php

@@ -53,16 +53,16 @@ class MakeSeal extends Command
         (new ProductSeal)->saveAll($this->getProductLog($item,$ist->id));
     }
 
-    public function getProductLog($item,$lastId){
+    public function getProductLog($row,$lastId){
       $pastLog= ProductOnlog::withJoin(['Product'],'left')
-       ->where([['fz_date','=',$item['fz_date']],['buyer_code','=',$item['company_code']]])
+       ->where([['fz_date','=',$row['fz_date']],['buyer_code','=',$row['company_code']]])
        ->field('type,order_item_id,product_id,skuCode,goodName,spec,unit,product_onlog.unit_price,num')->cursor();
       $list=[];
       $balance = ProductSeal::where([['fz_id','=',$lastId],['balance_num','>',0]])->column('balance_num','product_id');
       foreach ($pastLog as $item){
           if(!isset($list[$item['product_id']])){
               $list[$item['product_id']] = [
-                  'id'=>ProductSeal::where([['fz_id','=',$item['fz_id']],['product_id','=',$item['product_id']]])->value('id',null),
+                  'id'=>ProductSeal::where([['fz_id','=',$row['id']],['product_id','=',$item['product_id']]])->value('id',null),
                   'product_id'=>$item['product_id'],
                   'skuCode'=>$item['skuCode'],
                   'goodName'=>$item['goodName'],
@@ -73,7 +73,7 @@ class MakeSeal extends Command
                   'in_num'=>"0",
                   'out_num'=>"0",
                   'balance_num'=>$balance[$item['product_id']]??"0",
-                  'fz_id'=>$item['fz_id'],
+                  'fz_id'=>$row['id'],
               ];
           }
           if($item['type']==2){