瀏覽代碼

Merge branch 'zzd' of ssh://was.baoshi56.com:10022/var/git/bswas

LD 5 年之前
父節點
當前提交
d120b49d7e

+ 3 - 1
app/Events/DeliveryAppointmentEvent.php

@@ -29,7 +29,7 @@ class DeliveryAppointmentEvent implements ShouldBroadcastNow
             $query->withCount("cars");
         }]);
 
-        $owner = $car->deliveryAppointment->owner->name ?? "";
+        $owner = $delivery->deliveryAppointment->owner->name ?? "";
         $len = mb_strlen($owner);
         $ownerName = "";
         for($i=0;$i<$len-1;$i++)$ownerName .= "*";
@@ -45,6 +45,8 @@ class DeliveryAppointmentEvent implements ShouldBroadcastNow
         $delivery->type = DeliveryAppointment::TYPE[$delivery->deliveryAppointment->type_mark] ?? '';
         $delivery->period = isset($delivery->deliveryAppointment->date_period) ? ($delivery->deliveryAppointment->date_period==0 ? '上午' : '下午') : '';
         $delivery->delivery_time = $delivery->delivery_time ? substr($delivery->delivery_time,11,5) : '';
+
+        $delivery->morrow = $delivery->deliveryAppointment->appointment_date == date('Y-m-d',strtotime("+1 day"));
         $this->delivery = $delivery->withoutRelations();
     }
 

+ 6 - 1
app/Feature.php

@@ -19,7 +19,7 @@ class Feature extends Model
     const TYPE = [
         0 => "商品名称",  //二级
         1 => "订单类型",
-        2 => "承运商",
+        2 => "承运商名称",
         3 => "店铺类型",
         4 => "波次类型",
         5 => "商品备注",  //二级
@@ -27,6 +27,8 @@ class Feature extends Model
         7 => "订单备注",
         10=> "订单商品数",//二级
         11=> "属性仓",
+        12=> "订单商品数",
+        13=> "承运商英文名",
     ];
     //额外定义 8:商品数量 9:商品
     const TYPE_NODE = [0,5,6,8,9,10]; //标注二级类型
@@ -41,6 +43,7 @@ class Feature extends Model
             9 => "store_items.commodity",
             10=> "store_items.total",
             11=> "warehouse.name",
+            12=> "total",
         ],
         "order" => [
             0 => "packages.commodities.commodity.name",
@@ -54,6 +57,8 @@ class Feature extends Model
             8 => 'packages.commodities.amount',
             9 => 'packages.commodities.commodity',
             10=> 'packages.commodities.total',
+            12=> "total",
+            13=> "logistic.english_name",
         ]
     ];
 }

+ 15 - 0
app/Http/Controllers/DeliveryAppointmentController.php

@@ -188,6 +188,11 @@ class DeliveryAppointmentController extends Controller
             DeliveryAppointmentCar::query()->insert($insert);
         });
         dispatch(new DeliveryAppointmentCheck($appointment->id))->delay(Carbon::parse($appointment->appointment_date." ".(explode("-",DeliveryAppointment::PERIOD[$appointment->date_period])[1]).":00:01"));
+        //当日或次日预约单广播
+        if (strtotime(date('Y-m-d',strtotime("+2 day")))>strtotime($appointment->appointment_date." 00:00:00")){
+            $appointment->load("cars");
+            event(new DeliveryAppointmentEvent($appointment->cars[0]));
+        }
         //md5加密在密文第五位后插入
         $md5 = substr_replace(md5(date("m-d")),$appointment->id,5,0);
         $this->success(["key"=>$md5]);
@@ -234,6 +239,16 @@ class DeliveryAppointmentController extends Controller
             ]);
         });
         dispatch(new DeliveryAppointmentCheck($appointment->id))->delay(Carbon::parse($selectDate["date"]." ".(explode("-",DeliveryAppointment::PERIOD[$selectDate["time"]])[1]).":00:01"));
+        //当日或次日预约单广播
+        $old = $appointment->appointment_date == date('Y-m-d') ? 0 : ($appointment->appointment_date == date('Y-m-d',strtotime('+1 day') ? 1 : 2));
+        $new = $selectDate["date"] == date('Y-m-d') ? 0 : ($selectDate["date"] == date('Y-m-d',strtotime('+1 day') ? 1 : 2));
+        if ($old==2 && $new==2)$this->success(); //超过广播区间不推送
+        if (($old-$new)!=0 || $appointment->date_period!=$selectDate["time"]){
+            $appointment->cars[0]->change = true;
+            $appointment->cars[0]->old = $old;
+            $appointment->cars[0]->new = $new;
+            event(new DeliveryAppointmentEvent($appointment->cars[0]));
+        }
         $this->success();
     }
 

+ 9 - 0
app/Http/Controllers/TestController.php

@@ -180,6 +180,15 @@ class TestController extends Controller
     }
     public function test()
     {
+        Owner::query()->where("id",360)->update([
+            "relevance" => [0,1],
+        ]);
+        $customers = DB::connection("oracle")->select(DB::raw("select * from BAS_CUSTOMER where CUSTOMER_TYPE = 'CA'"));
+        foreach ($customers as $customer){
+            $l = Logistic::query()->where("code",$customer->customerid)->orWhere("name",$customer->descr_c)->first();
+            if ($l)$l->update(["english_name"=>$customer->descr_e]);
+        }
+        dd("OK");
         $asnno = "ASN2105141388";
         $query = DB::raw("SELECT b.ALTERNATE_SKU1,h.WAREHOUSEID,h.asnno,d.ASNLINENO,d.SKUDESCRC,h.CUSTOMERID,d.SKU,d.PACKID,d.RECEIVEDQTY_EACH,d.EXPECTEDQTY_EACH,d.LOTATT01,d.LOTATT02,d.lotatt04,".
             "d.lotatt05,d.lotatt08,d.USERDEFINE1,d.USERDEFINE2,d.USERDEFINE3,d.USERDEFINE4,d.USERDEFINE5,d.RECEIVINGLOCATION FROM DOC_ASN_DETAILS d ".

+ 2 - 0
app/Http/Kernel.php

@@ -2,6 +2,7 @@
 
 namespace App\Http;
 
+use App\Http\Middleware\CheckCsrfToken;
 use App\Http\Middleware\LogPostRequest;
 use Illuminate\Foundation\Http\Kernel as HttpKernel;
 
@@ -75,6 +76,7 @@ class Kernel extends HttpKernel
         'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
         'auth.api' => \App\Http\Middleware\ApiAuth::class,
         'procurement.auth.api' => \App\Http\Middleware\ProcurementApiAuth::class,
+        'check.token' => CheckCsrfToken::class,
     ];
 
     /**

+ 1 - 0
app/Http/Middleware/Authenticate.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Middleware;
 
+use Closure;
 use Illuminate\Auth\Middleware\Authenticate as Middleware;
 
 class Authenticate extends Middleware

+ 21 - 0
app/Http/Middleware/CheckCsrfToken.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Closure;
+
+class CheckCsrfToken
+{
+    /**
+     * Handle an incoming request.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \Closure  $next
+     * @return mixed
+     */
+    public function handle($request, Closure $next)
+    {
+        if (!$request->cookie("XSRF-TOKEN"))return redirect("login");
+        return $next($request);
+    }
+}

+ 1 - 0
app/Http/Middleware/VerifyCsrfToken.php

@@ -20,5 +20,6 @@ class VerifyCsrfToken extends Middleware
      */
     protected $except = [
         'store/deliveryAppointment/delivery',
+        'package/weigh/measureMonitor/speech',
     ];
 }

+ 1 - 1
app/Logistic.php

@@ -17,7 +17,7 @@ class Logistic extends Model
     use ModelLogChanging;
     use SoftDeletes;
     use ModelTimeFormat;
-    protected $fillable = ['name','code',"type","mobile","remark","delivery_fee","is_bunched"];
+    protected $fillable = ['name','code',"type","mobile","remark","delivery_fee","is_bunched","english_name"];
 
 
     static function nameById($id){

+ 0 - 3
app/Providers/AuthServiceProvider.php

@@ -7,11 +7,8 @@ use App\CustomerLog;
 use App\CustomerLogStatus;
 use App\Policies\CustomerLogPolice;
 use App\Policies\CustomerLogStatusesPolice;
-use App\Services\AuthorityService;
 use App\Services\CacheService;
 use App\Services\UserService;
-use App\User;
-use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;

+ 10 - 2
app/Services/OwnerPriceOperationService.php

@@ -328,10 +328,18 @@ class OwnerPriceOperationService
         $money = null;
         $taxFee = null;
 
-        if ($type == '出库')$total = app("OrderService")->getOrderQuantity($ownerId)+1;//获取该货主本月C端单量
-        else {
+        if ($type == '出库'){
+            $total = app("OrderService")->getOrderQuantity($ownerId)+1;//获取该货主本月C端单量
+            $matchObject->packages->each(function ($package)use(&$orderTotal){
+                $package->commodities->each(function ($commodity)use(&$orderTotal){
+                    $orderTotal += (int)$commodity->amount;
+                });
+            });
+            $matchObject[$columnMapping[12]] = $orderTotal;
+        }else {
             $total = 0;
             if ($matchObject->storeItems)foreach ($matchObject->storeItems as $item)$total += $item->amount;
+            $matchObject[$columnMapping[12]] = $total;
             $total += app("StoreService")->getStoreAmount($ownerId);//获取该货主本月入库件数
         }
         foreach ($rules as $rule){

+ 1 - 1
app/library/baidu-api-speech/lib/2a7552bdd1b678c303ad53645baeafce

@@ -1 +1 @@
-{"refresh_token":"25.4d53cf00633b3d4a1aac4042f9eece5b.315360000.1899260149.282335-18688250","expires_in":2592000,"session_key":"9mzdCKZyPT8dnHgqKTa2IKAbjeiTI6dKyllds7VEsgOWDGIjY2BEgLmOazFfJmWYYTC0\/RVFMWlS0krsTPpuSdMxopSCHw==","access_token":"24.3bc112d85964e45cab8f8b33c75ac42d.2592000.1586492149.282335-18688250","scope":"audio_voice_assistant_get brain_enhanced_asr audio_tts_post public brain_all_scope picchain_test_picchain_api_scope wise_adapt lebo_resource_base lightservice_public hetu_basic lightcms_map_poi kaidian_kaidian ApsMisTest_Test\u6743\u9650 vis-classify_flower lpq_\u5f00\u653e cop_helloScope ApsMis_fangdi_permission smartapp_snsapi_base iop_autocar oauth_tp_app smartapp_smart_game_openapi oauth_sessionkey smartapp_swanid_verify smartapp_opensource_openapi smartapp_opensource_recapi qatest_scope1 fake_face_detect_\u5f00\u653eScope vis-ocr_\u865a\u62df\u4eba\u7269\u52a9\u7406 idl-video_\u865a\u62df\u4eba\u7269\u52a9\u7406","session_secret":"7ed83fac7de4c020d1f1627700b9ab71","time":1583900148,"is_cloud_user":false}
+{"refresh_token":"25.7e4748217e997c84c2402b9b24adb134.315360000.1936752238.282335-18688250","expires_in":2592000,"session_key":"9mzdCPblW0XXeNGCMqTv\/JHlyb1R+CCFsPtDR+I+pkvO3Wt6R95mYM6B\/czx+j6XbwA+xuH79EnEt1k9LyvlecbmLoyo3A==","access_token":"24.32855024de5bed138fec0c12a1dd166d.2592000.1623984238.282335-18688250","scope":"brain_asr_async brain_speech_realtime audio_voice_assistant_get brain_enhanced_asr audio_tts_post public brain_all_scope picchain_test_picchain_api_scope wise_adapt lebo_resource_base lightservice_public hetu_basic lightcms_map_poi kaidian_kaidian ApsMisTest_Test\u6743\u9650 vis-classify_flower lpq_\u5f00\u653e cop_helloScope ApsMis_fangdi_permission smartapp_snsapi_base smartapp_mapp_dev_manage iop_autocar oauth_tp_app smartapp_smart_game_openapi oauth_sessionkey smartapp_swanid_verify smartapp_opensource_openapi smartapp_opensource_recapi fake_face_detect_\u5f00\u653eScope vis-ocr_\u865a\u62df\u4eba\u7269\u52a9\u7406 idl-video_\u865a\u62df\u4eba\u7269\u52a9\u7406 smartapp_component smartapp_search_plugin avatar_video_test","session_secret":"a8e2a31ba3a17b7c3f30efa29600b809","time":1621392238,"is_cloud_user":false}

+ 32 - 0
database/migrations/2021_05_19_154807_change_logistics_table_add_english_name_column.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeLogisticsTableAddEnglishNameColumn extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('logistics', function (Blueprint $table) {
+            $table->string("english_name")->nullable()->comment("英文名称");
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('logistics', function (Blueprint $table) {
+            $table->dropColumn("english_name");
+        });
+    }
+}

+ 10 - 3
resources/views/customer/project/create.blade.php

@@ -551,12 +551,14 @@
                 //重载作业费
                 _overrideOperation(operation){
                     if (operation.discount_count){
-                        if (operation.discount_count) operation.discount_count = operation.discount_count.split(",");
-                        if (operation.total_discount_price) operation.total_discount_price = operation.total_discount_price.split(",");
                         operation.isDiscount = true;
-                    }
+                        operation.discount_count = operation.discount_count.split(",");
+                    } else operation.discount_count = [];
+                    if (operation.total_discount_price) operation.total_discount_price = operation.total_discount_price.split(",");
+                    else operation.total_discount_price = [];
                     operation.items.forEach((item,j)=>{
                         if (item.discount_price) operation.items[j].discount_price = item.discount_price.split(",");
+                        else operation.items[j].discount_price = [];
                     });
                     if (operation.total_price)operation.isSingle = true;
                     if (operation.type_mark===0 || operation.type_mark==='0')operation.isRejected = true;
@@ -1910,6 +1912,11 @@
                     this.model.operation.total_discount_price.push("");
                     arr.push('');
                 },
+                //开启满减
+                onDiscount(type){
+                  if (!type)return;
+                  if (this.model.operation.discount_count.length===0) this.model.operation.discount_count = [""];
+                },
                 //删除阶梯满减阈值
                 delDiscount(index){
                     this.model.operation.items.forEach((item,i)=>{

+ 2 - 1
resources/views/customer/project/part/_operation.blade.php

@@ -40,7 +40,7 @@
 <div class="row mt-3">
     <label class="col-2" for="isDiscount">是否满减</label>
     <div class="col-2">
-        <input type="checkbox" id="isDiscount" class="rounded mt-1" v-model="model.operation.isDiscount">
+        <input type="checkbox" id="isDiscount" class="rounded mt-1" v-model="model.operation.isDiscount" @change="onDiscount(model.operation.isDiscount)">
     </div>
     <div class="col-8 row" v-if="model.operation.isDiscount">
         <div class="col-1 cursor-pointer"><span class="fa fa-plus" @click="addDiscount(model.operation.discount_count)"></span></div>
@@ -175,6 +175,7 @@
     <input id="surcharge" type="number" step="0.01" min="0" class="form-control col-3" :class="errors.surcharge ? 'is-invalid' : ''" v-model="model.operation.surcharge">
     <label for="surcharge_unit_id" class="col-2 text-right">单位</label>
     <select id="surcharge_unit_id" v-model="model.operation.surcharge_unit_id" class="form-control col-2" :class="errors.surcharge_unit_id ? 'is-invalid' : ''">
+        <option> </option>
         <option v-for="unit in pool.units" :value="unit.id" v-if="unit.name=='件' || unit.name=='单'">@{{ unit.name }}</option>
     </select>
 </div>

+ 7 - 0
resources/views/maintenance/logistic/create.blade.php

@@ -41,6 +41,13 @@
                             @enderror
                         </div>
                     </div>
+                    <div class="form-group row">
+                        <label for="english_name" class="col-2 col-form-label text-right">承运商英文名称</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control" id="english_name"
+                                   name="english_name" autocomplete="off" value="{{ old('name') }}">
+                        </div>
+                    </div>
                     <div class="form-group row">
                         <label for="code" class="col-2 col-form-label text-right">承运商代码 <b class="text-danger">*</b></label>
                         <div class="col-8">

+ 9 - 2
resources/views/maintenance/logistic/edit.blade.php

@@ -36,7 +36,7 @@
                         </div>
                     </div>
                     <div class="form-group row">
-                        <label for="name" class="col-2 col-form-label text-right">物流公司名称 <b class="text-danger">*</b></label>
+                        <label for="name" class="col-2 col-form-label text-right">承运商名称 <b class="text-danger">*</b></label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('name') is-invalid @enderror"
                                    name="name" autocomplete="off" value="@if(old('name')){{old('name')}}@else{{$logistic->name}}@endif" required>
@@ -48,7 +48,14 @@
                         </div>
                     </div>
                     <div class="form-group row">
-                        <label for="code" class="col-2 col-form-label text-right">物流公司代码 <b class="text-danger">*</b></label>
+                        <label for="english_name" class="col-2 col-form-label text-right">承运商英文名称</label>
+                        <div class="col-8">
+                            <input id="english_name" type="text" class="form-control"
+                                   name="english_name" autocomplete="off" value="@if(old('name')){{old('name')}}@else{{$logistic->name}}@endif" >
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="code" class="col-2 col-form-label text-right">承运商代码 <b class="text-danger">*</b></label>
                         <div class="col-8">
                             <input type="text" class="form-control @error('code') is-invalid @enderror"
                                    name="code" autocomplete="off" value="@if(old('code')){{old('code')}}@else{{$logistic->code}}@endif" required>

+ 2 - 0
resources/views/maintenance/logistic/index.blade.php

@@ -16,6 +16,7 @@
                     <tr>
                         <th>ID</th>
                         <th>承运商名称</th>
+                        <th>承运商英文名称</th>
                         <th>承运商代码</th>
                         <th>承运商联系方式</th>
                         <th>承运商类型</th>
@@ -27,6 +28,7 @@
                     <tr v-for="(logistic,i) in logistics" @click="selectTr===i+1?selectTr=0:selectTr=i+1" :class="selectTr===i+1?'focusing' : ''">
                         <td class="text-muted">@{{logistic.id}}</td>
                         <td>@{{logistic.name}}&nbsp;<span class="badge badge-success" v-if="logistic.is_bunched=='Y'">子母单</span></td>
+                        <td>@{{logistic.english_name}}</td>
                         <td>@{{logistic.code}}</td>
                         <td>@{{logistic.mobile}}</td>
                         <td>@{{logistic.type}}</td>

+ 17 - 22
resources/views/package/measureMonitor/index.blade.php

@@ -18,7 +18,6 @@
                                         <ul class="nav nav-pills">
                                             <b style="padding: 10px">请选择设备:</b>
                                             <li v-for="measuringMachine in measuringMachines" @click="clickMeasuringMachine(measuringMachine.id)" :class="[measuringMachine.name==package.measuringMachine ?  selectedMachine : otherMachine] " style="padding: 10px">
-                                                {{--<span v-if="package.measuringMachine==measuringMachine.name" :class="[package.measuringMachine_status=='离线' ?  off : on] " style="font-size:12px;"></span>--}}
                                                 <span :class="[measuringMachine.status=='离线' ?  off : on] " style="font-size:12px;"></span>
                                                 <a style="text-decoration:none;cursor:pointer" class="text-dark"  >@{{measuringMachine.name}}</a>
                                             </li>
@@ -32,31 +31,31 @@
                                             <tr>
                                                 <th class="tag" scope="row">货主</th>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.owner}}</td>
-                                                <th class="tag" scope="row" scope="row">重量(KG)</th>
+                                                <th class="tag" scope="row">重量(KG)</th>
                                                 <td>@{{package.weight}}</td>
                                             </tr>
                                             <tr>
-                                                <th class="tag" scope="row" scope="row">订单编号</th>
+                                                <th class="tag" scope="row">订单编号</th>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.orderno}}</td>
-                                                <th class="tag" scope="row" scope="row">收件人</th>
+                                                <th class="tag" scope="row">收件人</th>
                                                 <td>@{{package.recipient}}</td>
                                             </tr>
                                             <tr>
-                                                <th class="tag" scope="row" scope="row">承运商</th>
+                                                <th class="tag" scope="row">承运商</th>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.logistic_name}}</td>
-                                                <th class="tag" scope="row" scope="row">快递单号</th>
+                                                <th class="tag" scope="row">快递单号</th>
                                                 <td>@{{package.logistic_number}}</td>
                                             </tr>
                                             <tr>
-                                                <th class="tag" scope="row" scope="row">纸箱名称</th>
+                                                <th class="tag" scope="row">纸箱名称</th>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.paperBox}}</td>
-                                                <th class="tag" scope="row" scope="row">体积(CM³)</th>
+                                                <th class="tag" scope="row">体积(CM³)</th>
                                                 <td>@{{package.bulk}}</td>
                                             </tr>
                                             <tr>
-                                                <th  class="tag" scope="row" scope="row">状态</th>
+                                                <th  class="tag" scope="row">状态</th>
                                                 <td style="border-right:thick double #aaaaaa;">@{{package.status}}</td>
-                                                <th  class="tag" scope="row" scope="row">操作时间</th>
+                                                <th  class="tag" scope="row">操作时间</th>
                                                 <td>@{{package.weighed_at}}</td>
                                             </tr>
                                         </table>
@@ -136,31 +135,27 @@
                             audio.src=_this.logisticAudioURL[logistic_name];
                             audio.play();
                         }else {
-                            axios.post('/package/measureMonitor/speech',{logistic:logistic_name})
+                            window.tempTip.setDuration(3000);
+                            window.axios.post('/package/measureMonitor/speech',{logistic:logistic_name})
                                 .then(function (response) {
                                     if (response.data){
                                         _this.logisticAudioURL[logistic_name]=response.data;
                                         audio.src=response.data;
                                         audio.play();
-                                    }else {
-                                        tempTip.setDuration(4000);
-                                        tempTip.show('没有对应快递名称!');
-                                    }
-                                })
-                                .catch(function (err) {
-                                    tempTip.setDuration(4000);
-                                    tempTip.show('语音合成发生错误:'+err);
+                                    }else window.tempTip.show('没有对应快递名称!');
+                                }).catch(function (err) {
+                                    window.tempTip.show('语音合成发生错误:'+err);
                                 });
                         }
-                        tempTip.setDuration(1000);
-                        tempTip.showSuccess('刷新成功!');
+                        window.tempTip.setDuration(1000);
+                        window.tempTip.showSuccess('刷新成功!');
                     }
                 });
             },
             methods:{
                 clickMeasuringMachine(e){
                     let _this=this;
-                    axios.post('{{url('package/measureMonitor/data')}}',{id:e})
+                    window.axios.post('{{url('package/measureMonitor/data')}}',{id:e})
                         .then(function (response) {
                             if (response.data.id){
                                 let orderPackage=response.data;

+ 57 - 16
resources/views/store/deliveryAppointment/exhibition.blade.php

@@ -309,13 +309,67 @@
                         break;
                 }
             },
+            _formatObj(res){
+                return {
+                    "id"                    : res.id,
+                    "license_plate_number"  : res.license_plate_number,
+                    "driver_name"           : res.driver_name,
+                    "driver_phone"          : res.driver_phone,
+                    "cubic_meter"           : res.cubic_meter,
+                    "tonne"                 : res.tonne,
+                    "owner_name"            : res.owner_name,
+                    "type"                  : res.type,
+                    "period"                : res.period,
+                    "delivery_time"         : res.delivery_time,
+                    "status"                : res.status,
+                };
+            },
             _sortData(res){
                 if (res.warehouse!=warehouse)return;
+                if (res.change){
+                    let continueMark = true;
+                    switch (Number(res.old)) {
+                        case 0:
+                            switch (Number(res.new)) {
+                                case 0:
+                                    continueMark = false;
+                                    break;
+                                default:
+                                    this.list.some((data,i)=>{
+                                        if (data.id==res.id){
+                                            this.$delete(this.list,i);
+                                            return true;
+                                        }
+                                    });
+                                    if (Number(res.old)===1) continueMark = false;
+                                    break;
+                            }
+                            break;
+                        case 1:
+                            this.nextList.some((data,i)=>{
+                                if (data.id==res.id){
+                                    if (res.new!=1)this.$delete(this.nextList,i);
+                                    else this.$set(this.nextList,i,this._formatObj(res));
+                                    return true;
+                                }
+                            });
+                            if (res.new==0) continueMark = false;
+                            break;
+                        case 2:
+                            continueMark = false;
+                            break;
+                    }
+                    if (continueMark) return;
+                }
+                if (res.morrow){
+                    if (this.nextList.length>=10) this.nextList = this.nextList.splice(0,9);
+                    this.nextList.push(this._formatObj(res));
+                    return;
+                }
                 if (this.list.every((data,i)=>{
                     if (data.id === res.id){
                         this._countChange(data.status,res.status);
-                        //this.$set(this.list[i],"is_delivery",true);
-                        data.status = res.status;
+                        data = this._formatObj(res);
                         this.list.splice(i,1);
                         if (data.status=='1'){
                             if (this.list.every((car,j)=>{
@@ -332,20 +386,7 @@
                 })){
                     this._countChange(null,res.status);
                     if (this.list.length>=10) this.list = this.list.splice(0,9);
-                    let obj = {
-                        "id"                    : res.id,
-                        "license_plate_number"  : res.license_plate_number,
-                        "driver_name"           : res.driver_name,
-                        "driver_phone"          : res.driver_phone,
-                        "cubic_meter"           : res.cubic_meter,
-                        "tonne"                 : res.tonne,
-                        "owner_name"            : res.owner_name,
-                        "type"                  : res.type,
-                        "period"                : res.period,
-                        "delivery_time"         : res.delivery_time,
-                        "status"                : res.status,
-                        /*"is_delivery"           : true,*/
-                    };
+                    let obj = this._formatObj(res);
                     if (res.status=='1'){
                         if (this.list.every((car,j)=>{
                             if (car.status!=res.status){

+ 3 - 6
routes/web.php

@@ -20,6 +20,9 @@ Route::get('/', function () {
 
 Route::any('test/{method}', 'TestController@method'); //测试
 
+/** 称重广播 */
+Route::post('package/weigh/measureMonitor/speech','MeasureMonitorController@speech')->middleware("check.token");
+
 Auth::routes();
 
 Route::get('/home', 'HomeController@index')->name('home');
@@ -357,11 +360,6 @@ Route::resource('rejected', 'RejectedController');
 
 /** 包裹 */
 Route::group(['prefix'=>'package'],function(){
-    /** 设备 */
-    Route::group(['prefix'=>'measureMonitor'],function(){
-        Route::any('speech','MeasureMonitorController@speech');
-        Route::post('data','MeasureMonitorController@data');
-    });
     /** 统计 */
     Route::group(['prefix'=>'statistics'],function(){
         Route::any('export','WeighController@statisticsExport');
@@ -383,7 +381,6 @@ Route::group(['prefix'=>'package'],function(){
         Route::get('statistics','WeighController@statistics');
         /** 设备 */
         Route::group(['prefix'=>'measureMonitor'],function(){
-            Route::any('speech','MeasureMonitorController@speech');
             Route::post('data','MeasureMonitorController@data');
         });
         /** 统计 */