Zhouzhendong 5 лет назад
Родитель
Сommit
64d47604aa
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      app/Http/Controllers/api/thirdPart/flux/WaybillController.php

+ 6 - 2
app/Http/Controllers/api/thirdPart/flux/WaybillController.php

@@ -38,11 +38,13 @@ class WaybillController extends Controller
                     .json_encode($receiveInputting),'resultInfo'=>'']]])
                     ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
             }
-            if(isset($receiveInputting['order_list'])&&$receiveInputting['order_list'])
+            if(isset($receiveInputting['order_list'])&&$receiveInputting['order_list']){
                 $warehouseWeight=0;
                 $warehouseWeightOther=0;
+                $sign=false;
                 foreach ($receiveInputting['order_list'] as $orderInputting){
                     if ($orderInputting['Cubic'])$warehouseWeight += $orderInputting['Cubic'];
+                    if ($orderInputting['Cubic']==0)$sign=true;
                     if ($orderInputting['GrossWeight'])$warehouseWeightOther +=$orderInputting['GrossWeight'];
                     if (!$orderInputting['GrossWeight'] && $orderInputting['NetWeight']) $warehouseWeightOther +=$orderInputting['NetWeight'];
                     $orderInputting['OrderNo']=$receiveInputting['OrderNo'];
@@ -53,6 +55,8 @@ class WaybillController extends Controller
                             ->setEncodingOptions(JSON_UNESCAPED_UNICODE);
                     }
                 }
+                if ($sign)$warehouseWeight=0;
+            }
             $owner=Owner::where('code',$receiveInputting['CustomerID'])->first();
             if (!$owner){$owner=new Owner(['name'=>$receiveInputting['CustomerID'],'code'=>$receiveInputting['CustomerID']]);$owner->save();}
             $city=City::where('name',$receiveInputting['C_City'])->first();
@@ -78,7 +82,7 @@ class WaybillController extends Controller
                 'source_bill'=>$receiveInputting['ReservedField01']??'',
                 'destination_city_id'=>$city['id'],
             ]);
-            if (isset($warehouseWeight)){
+            if (isset($warehouseWeight)&&$warehouseWeight){
                 $waybill->warehouse_weight=$warehouseWeight;
                 $unit=Unit::where('name','m³')->first();
                 if ($unit)$waybill->warehouse_weight_unit_id=$unit->id;