Przeglądaj źródła

修改线上数据

Zhouzhendong 5 lat temu
rodzic
commit
0718f03948

+ 24 - 1
app/Http/Controllers/TestController.php

@@ -24,6 +24,7 @@ use App\UserWorkgroup;
 use App\Waybill;
 use App\OraccleBasCustomer;
 use App\WMSReflectReceive;
+use App\WMSWaybillOrder;
 use Carbon\Carbon;
 use Endroid\QrCode\QrCode;
 use Endroid\QrCode\Response\QrCodeResponse;
@@ -141,7 +142,29 @@ class TestController extends Controller
         });
     }
     public function test1(){
-        Owner::update([["id"=>18,"code"=>"test1"],["id"=>17,"code"=>"test2"]]);
+        $waybills=Waybill::select('id','wms_bill_number')->get();
+        foreach ($waybills as $waybill){
+            $orders=WMSWaybillOrder::where('OrderNo',$waybill->wms_bill_number)->get();
+            if (count($orders)>0){
+                $warehouseWeight=0;
+                $sign=false;
+                foreach ($orders as $order){
+                    $warehouseWeight+=$order->Cubic;
+                    if ($order->Cubic==0)$sign=true;
+                }
+                if ($sign)unset($warehouseWeight);
+            }
+            $waybill=Waybill::find($waybill->id);
+            if (isset($warehouseWeight)){
+                if ($waybill){
+                    $waybill->warehouse_weight=$warehouseWeight;
+                }
+            }else{
+                $waybill->warehouse_weight=null;
+                $waybill->warehouse_weight_unit_id=null;
+            }
+            $waybill->update();
+        }
     }
     public function test3()
     {

+ 4 - 4
resources/views/waybill/index.blade.php

@@ -215,10 +215,10 @@
                     <td class="td-transit"><span v-if="waybill.type=='专线'">@{{waybill.carrier_bill}}</span>
                         <span v-if="waybill.type=='直发车'">
                             <span v-if="waybill.carType">@{{ waybill.carType.name }}<i v-if="waybill.carType.length">(@{{waybill.carType.length}}米)</i></span></span></td>
-                    <td class="td-transit">@{{waybill.warehouse_weight}}  @{{waybill.warehouse_weight_unit}}</td>
-                    <td class="td-transit">@{{waybill.carrier_weight}}  @{{waybill.carrier_weight_unit}}</td>
-                    <td class="td-transit">@{{waybill.warehouse_weight_other}}  @{{waybill.warehouse_weight_unit_other}}</td>
-                    <td class="td-transit">@{{waybill.carrier_weight_other}}  @{{waybill.carrier_weight_unit_other}}</td>
+                    <td class="td-transit"><span v-if="waybill.warehouse_weight">@{{waybill.warehouse_weight}}  @{{waybill.warehouse_weight_unit}}</span></td>
+                    <td class="td-transit"><span v-if="waybill.carrier_weight">@{{waybill.carrier_weight}}  @{{waybill.carrier_weight_unit}}</span></td>
+                    <td class="td-transit"><span v-if="waybill.warehouse_weight_other">@{{waybill.warehouse_weight_other}}  @{{waybill.warehouse_weight_unit_other}}</span></td>
+                    <td class="td-transit"><span v-if="waybill.carrier_weight_other">@{{waybill.carrier_weight_other}}  @{{waybill.carrier_weight_unit_other}}</span></td>
                     <td class="td-transit">@{{waybill.amount}} </td>
                     <td class="td-transit">@{{waybill.mileage|km}} </td>
                     @can('运输管理-可见费用项')