Browse Source

出标机 box_out

cqpCow 11 months ago
parent
commit
78120b9e19
1 changed files with 10 additions and 5 deletions
  1. 10 5
      app/Service/LabelDealService.php

+ 10 - 5
app/Service/LabelDealService.php

@@ -19,12 +19,17 @@ class LabelDealService extends Service
         if( empty($data['lead_out']) || empty($data['lead_out']['brand_out_stock_list'])) return;
 
         foreach ($data['lead_out']['brand_out_stock_list'] as $value){
-            $tmp = $value['brand_out_stock_dtl'][0] ?? [];
-            $return[$value['send_box_code']] = [
-                'fake_qty' => $tmp['fake_qty'],
-                'detail' => explode(',',$tmp['brand_qr_code_list'])
-            ];
             $box_list[] = $value['send_box_code'];
+            foreach ($value['brand_out_stock_dtl'] as $tmp){
+                if(! isset($return[$value['send_box_code']])){
+                    $return[$value['send_box_code']] = [
+                        'fake_qty' => 0,
+                        'detail' => [],
+                    ];
+                }
+                $return[$value['send_box_code']]['fake_qty'] += $tmp['fake_qty'];
+                $return[$value['send_box_code']]['detail'] = array_merge($return[$value['send_box_code']]['detail'], explode(',',$tmp['brand_qr_code_list']));
+            }
         }
     }