Эх сурвалжийг харах

Merge branch 'waybill_ZD'

# Conflicts:
#	app/User.php
#	public/js/app.js
#	resources/views/maintenance/user/create.blade.php
#	resources/views/weigh/menu.blade.php
LD 6 жил өмнө
parent
commit
c101cd94ed
69 өөрчлөгдсөн 3162 нэмэгдсэн , 516 устгасан
  1. 41 0
      app/Events/WeightEvent.php
  2. 2 1
      app/Http/Controllers/Auth/LoginController.php
  3. 5 1
      app/Http/Controllers/Auth/RegisterController.php
  4. 48 29
      app/Http/Controllers/MeasureMonitorController.php
  5. 105 11
      app/Http/Controllers/PackageController.php
  6. 28 0
      app/Http/Controllers/PaperBoxController.php
  7. 13 3
      app/Http/Controllers/UserController.php
  8. 119 0
      app/Http/Controllers/WeighExceptedController.php
  9. 135 0
      app/Http/Controllers/api-speech/AipSpeech.php
  10. 1 0
      app/Http/Controllers/api-speech/lib/2d7933431e76f4dd9eeb4e604e68bcb5
  11. 367 0
      app/Http/Controllers/api-speech/lib/AipBCEUtil.php
  12. 343 0
      app/Http/Controllers/api-speech/lib/AipBase.php
  13. 192 0
      app/Http/Controllers/api-speech/lib/AipHttpClient.php
  14. 36 0
      app/Http/Controllers/api-speech/lib/AipImageUtil.php
  15. 107 0
      app/Http/Controllers/api/WxController.php
  16. 27 0
      app/Http/Controllers/api/WxLoginController.php
  17. 130 0
      app/Imports/PaperBoxesImport.php
  18. 8 8
      app/Imports/WaybillPriceModelsImport.php
  19. 28 4
      app/Package.php
  20. 6 1
      app/User.php
  21. 1 1
      app/WaybillPriceModel.php
  22. 245 35
      composer.lock
  23. 1 1
      config/broadcasting.php
  24. 1 1
      database/migrations/2019_11_22_094024_create_waybills_table.php
  25. 33 0
      database/migrations/2020_01_08_103927_create_carrier_user_table.php
  26. 32 0
      database/migrations/2020_01_08_152729_change_user_filed.php
  27. 31 0
      database/migrations/2020_02_09_080123_add_weigh_excepted_authority.php
  28. 48 0
      database/migrations/2020_02_10_103905_change_package_column.php
  29. 1 1
      laravel-echo-server.lock
  30. 29 29
      package-lock.json
  31. 1 1
      package.json
  32. BIN
      public/audio.mp3
  33. 0 0
      public/images/measuringMachine/off.png
  34. 0 0
      public/images/measuringMachine/on.png
  35. 6 0
      public/js/singles/rejectedIndex.js
  36. 5 2
      public/mix-manifest.json
  37. BIN
      public/off.png
  38. BIN
      public/on.png
  39. BIN
      public/sound/ding.mp3
  40. BIN
      public/sound/warning_otherBarcode.mp3
  41. BIN
      resources/audio.mp3
  42. 1 1
      resources/js/bootstrap.js
  43. 2 2
      resources/views/layouts/menu.blade.php
  44. 1 1
      resources/views/maintenance/paperBox/create.blade.php
  45. 1 1
      resources/views/maintenance/paperBox/edit.blade.php
  46. 57 0
      resources/views/maintenance/paperBox/import.blade.php
  47. 5 1
      resources/views/maintenance/paperBox/menu.blade.php
  48. 119 67
      resources/views/maintenance/user/create.blade.php
  49. 60 2
      resources/views/maintenance/user/edit.blade.php
  50. 8 1
      resources/views/maintenance/user/index.blade.php
  51. 1 1
      resources/views/maintenance/waybillPriceModel/index.blade.php
  52. 0 6
      resources/views/weigh/index.blade.php
  53. 0 103
      resources/views/weigh/measureMonitor/index.blade.php
  54. 0 20
      resources/views/weigh/menu.blade.php
  55. 0 169
      resources/views/weigh/package/index.blade.php
  56. 165 0
      resources/views/weight/measureMonitor/index.blade.php
  57. 26 0
      resources/views/weight/menu.blade.php
  58. 1 1
      resources/views/weight/menuWeight.blade.php
  59. 85 0
      resources/views/weight/package/create.blade.php
  60. 235 0
      resources/views/weight/package/index.blade.php
  61. 1 1
      resources/views/weight/package/menu.blade.php
  62. 180 0
      resources/views/weight/weightExcepted/index.blade.php
  63. 14 0
      resources/views/weight/weightExcepted/menu.blade.php
  64. 9 0
      routes/api.php
  65. 12 6
      routes/web.php
  66. 2 2
      tests/Unit/MeasureMonitorTest.php
  67. 2 2
      tests/Unit/PackageTest.php
  68. 0 0
      tests/codeCoverage/.js/d3.min.js
  69. 0 0
      tests/codeCoverage/.js/jquery.min.js

+ 41 - 0
app/Events/WeightEvent.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace App\Events;
+
+use App\Package;
+use Illuminate\Broadcasting\Channel;
+use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
+use Illuminate\Queue\SerializesModels;
+use Illuminate\Broadcasting\PrivateChannel;
+
+class WeightEvent implements ShouldBroadcast
+{
+    use  SerializesModels;
+
+    public $package;
+
+    /**
+     * Create a new event instance.
+     *
+     * @return void
+     */
+    public function __construct(Package $package)
+    {
+        $this->package=$package;
+    }
+
+    /**
+     * Get the channels the event should broadcast on.
+     *
+     * @return \Illuminate\Broadcasting\Channel|array
+     */
+    public function broadcastOn()
+    {
+        return new Channel('package');
+    }
+
+    public function broadcastAs(){
+        return "weight";
+    }
+
+}

+ 2 - 1
app/Http/Controllers/Auth/LoginController.php

@@ -3,12 +3,14 @@
 namespace App\Http\Controllers\Auth;
 
 use App\Http\Controllers\Controller;
+use App\User;
 use Illuminate\Foundation\Auth\AuthenticatesUsers;
 use Illuminate\Http\JsonResponse;
 use Illuminate\Http\RedirectResponse;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Hash;
 use Illuminate\Validation\ValidationException;
 
 class LoginController extends Controller
@@ -57,7 +59,6 @@ class LoginController extends Controller
      */
     public function login(Request $request)
     {
-        $this->validateLogin($request);
 
         if (method_exists($this, 'hasTooManyLoginAttempts') &&
             $this->hasTooManyLoginAttempts($request)) {

+ 5 - 1
app/Http/Controllers/Auth/RegisterController.php

@@ -76,6 +76,7 @@ class RegisterController extends Controller
     }
     public function register(Request $request)
     {
+
         $headTo=$request->input('headTo')??'';
         $this->validator($request->all())->validate();
 
@@ -87,7 +88,10 @@ class RegisterController extends Controller
             $user->roles()->sync($roleIdArr);
         }
 //        $this->guard()->login($user);
-
+        $carrier_id=$request->input('carrier_id')??'';
+        if ($carrier_id){
+            $user->carriers()->sync($carrier_id);
+        }
         $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),$user['id']);
         if($headTo){return redirect(url($headTo))->with('successTip',"录入用户 {$user->name} 成功");}
         return $this->registered($request, $user)

+ 48 - 29
app/Http/Controllers/MeasureMonitorController.php

@@ -2,14 +2,20 @@
 
 namespace App\Http\Controllers;
 
+use App\Events\News;
+use App\Events\WeightEvent;
 use App\MeasuringMachine;
 use App\Package;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
-
+require_once 'api-speech/AipSpeech.php';
 class MeasureMonitorController extends Controller
 {
+
+    const APP_ID='18433903';
+    const API_KEY='3pfojF55BI9LFfXdaI8wRyV2';
+    const SECRET_KEY='ZRSZWUPNgRNrdm4gBQ5Gf0c1oANN4mnd';
     /**
      * Display a listing of the resource.
      *
@@ -18,39 +24,52 @@ class MeasureMonitorController extends Controller
     public function index(Request $request)
     {
         if(!Gate::allows('包裹信息-查询')){ return redirect(url('/'));  }
-        /*$sql='SELECT a.* FROM packages a WHERE id = (SELECT MAX(id) FROM packages WHERE measuring_machine_id = a.measuring_machine_id) ORDER BY a.id';
-        $packages=DB::table(DB::raw("($sql) as t"))->get();*/
-        $measuring_machine_id=[];
-        /*        for ($i=0;$i<count($measuringMachine);$i++){
-            $measuring_machine_id[$i]=$measuringMachine[$i]->id;
-        }
-        dd($measuring_machine_id);*/
-        $measuring_machine_id=$request->input('id');
         $measuringMachines=MeasuringMachine::select('id','name','code')->get();
-        if (empty($measuringMachines)){
-            dd($measuringMachines);
-            if (!$measuring_machine_id){
-                $package=Package::with('owner','paperBox','measuringMachine')->where('measuring_machine_id',$measuringMachines[0]->id)->orderBy('id','DESC')->first();
-            }else{
-                $package=Package::with('owner','paperBox','measuringMachine')->where('measuring_machine_id',$measuring_machine_id)->orderBy('id','DESC')->first();
-                if (!$package){
-                    $measuringMachine=MeasuringMachine::where('id',$measuring_machine_id)->first();
-                    $package=new Package();
-                    if ($measuringMachine)$package->measuringMachine=$measuringMachine;
-                }
+        return view('weight.measureMonitor.index',['measuringMachines'=>$measuringMachines]);
+    }
+
+    public function data(Request $request){
+        $measuring_machine_id=$request->input('id');
+        if ($measuring_machine_id){
+            /*$package=Package::with('owner','paperBox','measuringMachine')->where('measuring_machine_id',$measuringMachines[0]->id)->orderBy('id','DESC')->first();*/
+            $package=Package::with('owner','paperBox','measuringMachine')->where('measuring_machine_id',$measuring_machine_id)->orderBy('id','DESC')->first();
+            if (!$package){
+                $measuringMachine=MeasuringMachine::where('id',$measuring_machine_id)->first();
+                $package=new Package();
+                if ($measuringMachine)$package->measuringMachine=$measuringMachine;
             }
+            return $package;
         }
-        return view('weigh.measureMonitor.index',['package'=>isset($package)?$package:null,'measuringMachines'=>$measuringMachines]);
+        /*else{
+            $package=Package::with('owner','paperBox','measuringMachine')->where('measuring_machine_id',$measuring_machine_id)->orderBy('id','DESC')->first();
+            if (!$package){
+                $measuringMachine=MeasuringMachine::where('id',$measuring_machine_id)->first();
+                $package=new Package();
+                if ($measuringMachine)$package->measuringMachine=$measuringMachine;
+            }*/
+
+        return '';
     }
 
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        //
+
+    public function speech(Request $request){
+        $logistic=$request->input('logistic');
+        if (!$logistic)return '';
+        if (file_exists("storage/".$logistic.'.mp3')){
+            return "/storage/".$logistic.'.mp3';
+        }
+        $client=new \AipSpeech(self::APP_ID,self::API_KEY,self::SECRET_KEY);
+        $client->setConnectionTimeoutInMillis('180000');
+        $client->setSocketTimeoutInMillis('180000');
+
+        $result = $client->synthesis($logistic, 'zh', 1, array(
+            'vol' => 10,
+        ));
+        // 识别正确返回语音二进制 错误则返回json 参照下面错误码
+        if(!is_array($result)){
+            file_put_contents('storage/'.$logistic.'.mp3', $result);
+        }
+        return "/storage/".$logistic.'.mp3';
     }
 
     /**

+ 105 - 11
app/Http/Controllers/PackageController.php

@@ -2,10 +2,17 @@
 
 namespace App\Http\Controllers;
 
+use App\Events\News;
+use App\Events\WeightEvent;
+use App\Exports\WaybillExport;
 use App\Owner;
 use App\Package;
+use App\PaperBox;
+use Carbon\Carbon;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Validator;
+use Maatwebsite\Excel\Facades\Excel;
 
 class PackageController extends Controller
 {
@@ -18,26 +25,30 @@ class PackageController extends Controller
     {
         if(!Gate::allows('包裹信息-查询')){ return redirect(url('/'));  }
         if ($request->input()){
-            $packages=Package::with('owner','paperBox','measuringMachine')->orderBy('id','DESC');
+            $packages=Package::orderBy('id','DESC');
+            $today=Carbon::now()->subDays(15);
             if ($request->input('logistic_number')){
-                $packages=$packages->where('logistic_number',$request->input('logistic_number'));
+                $packages=$packages->where('logistic_number','like','%'.$request->input('logistic_number').'%')->where('created_at','>',$today->format('Y-m-d'));
             }
-            if ($request->input('type')){
-                $packages=$packages->where('type',$request->input('type'));
+            if ($request->input('delivery_number')){
+                $packages=$packages->where('delivery_number','like','%'.$request->input('delivery_number').'%')->where('created_at','>',$today->format('Y-m-d'));
             }
-            if ($request->input('status')){
-                $packages=$packages->where('status',$request->input('status'));
+            if ($request->input('created_at_start')){
+                $packages=$packages->where('created_at','>=',$request->input('created_at_start'));
+            }
+            if ($request->input('created_at_end')){
+                $packages=$packages->where('created_at','<=',$request->input('created_at_end'));
             }
             if ($request->input('owner_id')){
                 $packages=$packages->where('owner_id',$request->input('owner_id'));
             }
             $packages=$packages->paginate($request->input('paginate')?$request->input('paginate'):50);
             $owners=Owner::select('id','name')->get();
-            return view('weigh.package.index',['packages'=>$packages,'owners'=>$owners]);
+            return view('weight.package.index',['packages'=>$packages,'owners'=>$owners]);
         }
-        $packages=Package::with('owner','paperBox','measuringMachine')->orderBy('id','DESC')->paginate(50);
+        $packages=Package::orderBy('id','DESC')->paginate(50);
         $owners=Owner::select('id','name')->get();
-        return view('weigh.package.index',['packages'=>$packages,'owners'=>$owners]);
+        return view('weight.package.index',['packages'=>$packages,'owners'=>$owners]);
     }
 
     /**
@@ -47,7 +58,9 @@ class PackageController extends Controller
      */
     public function create()
     {
-        //
+        if(!Gate::allows('包裹信息-录入')){ return redirect(url('/'));  }
+        $paperBoxes=PaperBox::select('id','model')->get();
+        return view('weight.package.create',['paperBoxes'=>$paperBoxes]);
     }
 
     /**
@@ -58,7 +71,19 @@ class PackageController extends Controller
      */
     public function store(Request $request)
     {
-        //
+        if(!Gate::allows('包裹信息-录入')){ return redirect(url('/'));  }
+        $this->validator($request)->validate();
+        $logistic_number=$request->input('logistic_number');
+        $weight=$request->input('weight');
+        $paper_box_id=$request->input('paper_box_id');
+        $package=new Package([
+            'logistic_number'=>$logistic_number,
+            'weight'=>$weight,
+            'paper_box_id'=>$paper_box_id
+        ]);
+        $package->save();
+        event(new WeightEvent($package));
+        return redirect('weight/package/create')->with('successTip','新记录“'.$logistic_number.'”录入成功');
     }
 
     /**
@@ -105,4 +130,73 @@ class PackageController extends Controller
     {
         //
     }
+
+    public function export($id){
+        $id = explode( ',',$id);
+        $row=[[
+            'id'=>'ID',
+            'owner_name'=>'货主',
+            'logistic_number'=>'快递单号',
+            'delivery_number'=>'发货单号',
+            'batch_number'=>'波次号',
+            'batch_rule'=>'波次规则',
+            'created_at'=>'操作时间',
+            'recipient'=>'收件人',
+            'recipient_mobile'=>'收件人电话',
+            'logistic_name'=>'承运商',
+            'measuringMachine_name'=>'设备',
+            'weight'=>'重量(KG)',
+            'length'=>'长(CM)',
+            'width'=>'宽(CM)',
+            'height'=>'高(CM)',
+            'bulk'=>'体积(CM³)',
+            'paperBox_name'=>'纸箱',
+            'status'=>'状态',
+        ]];
+        $list=[];
+        for ($i=0; $i<count($id);$i++){
+            $package=Package::find($id[$i]);
+            $w=[
+                'id'=>isset($package->id)?$package->id:'',
+                'owner_name'=>isset($package->owner_name)?$package->owner_name:'',
+                'logistic_number'=>isset($package->logistic_number)?$package->logistic_number:'',
+                'delivery_number'=>isset($package->delivery_number)?$package->delivery_number:'',
+                'batch_number'=>isset($package->batch_number)?$package->batch_number:'',
+                'batch_rule'=>isset($package->batch_rule)?$package->batch_rule:'',
+                'created_at'=>isset($package->created_at)?$package->created_at:'',
+                'recipient'=>isset($package->recipient)?$package->recipient:'',
+                'recipient_mobile'=>isset($package->recipient_mobile)?$package->recipient_mobile:'',
+                'logistic_name'=>isset($package->logistic_name)?$package->logistic_name:'',
+                'measuringMachine_name'=>isset($package->measuringMachine_name)?$package->measuringMachine_name:'',
+                'weight'=>isset($package->weight)?$package->weight:'',
+                'length'=>isset($package->length)?$package->length:'',
+                'width'=>isset($package->width)?$package->width:'',
+                'height'=>isset($package->height)?$package->height:'',
+                'bulk'=>isset($package->bulk)?$package->bulk:'',
+                'paperBox_name'=>isset($package->paperBox_name)?$package->paperBox_name:'',
+                'status'=>isset($package->status)?$package->status:''
+            ];
+            $list[$i]=$w;
+        }
+        return Excel::download(new WaybillExport($row,$list),date('YmdHis', time()).'-称重记录单.xls');
+    }
+    protected function validator(Request $request){
+        $validator=Validator::make($request->input(),[
+            'logistic_number'=>['required','max:50','unique:packages,logistic_number'],
+            'weight'=>'required|min:0|max:999999|numeric',
+            'paper_box_id'=>'required|integer',
+        ],[
+            'required'=>':attribute 为必填项',
+            'max'=>':attribute 字符过多或输入值过大',
+            'integer'=>':attribute 选择有误',
+            'min'=>':attribute 不得为负',
+            'numeric'=>':attribute 应为数字',
+            'unique'=>':attribute 已存在',
+        ],[
+            'logistic_number'=>'快递单号',
+            'weight'=>'重量',
+            'paper_box_id'=>'纸箱',
+        ]);
+        return $validator;
+    }
 }

+ 28 - 0
app/Http/Controllers/PaperBoxController.php

@@ -3,12 +3,15 @@
 namespace App\Http\Controllers;
 
 
+use App\Imports\PaperBoxesImport;
 use App\Owner;
 use App\PaperBox;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Validator;
+use Maatwebsite\Excel\Facades\Excel;
 
 class PaperBoxController extends Controller
 {
@@ -154,6 +157,31 @@ class PaperBoxController extends Controller
         }
     }
 
+    public function import(Request $request){
+        if(!Gate::allows('纸箱-录入')){ return redirect(url('/'));  }
+        $fileSuffix=$request->file('file')->getClientOriginalExtension();
+        if ($fileSuffix=='xlsx'||$fileSuffix=='xlsm'||$fileSuffix=='xltx'||$fileSuffix=='xltm'||$fileSuffix=='xls'||$fileSuffix=='xlt'||$fileSuffix=='ods'||$fileSuffix=='ots'||$fileSuffix=='slk'
+            ||$fileSuffix=='xml'||$fileSuffix=='gnumeric'||$fileSuffix=='htm'||$fileSuffix=='html'||$fileSuffix=='csv'||$fileSuffix=='tsv'){
+            $isOverride = $request->input('isOverride');
+            ini_set('max_execution_time',2100);
+            ini_set('memory_limit','512M');
+            $extension=$request->file()['file']->getClientOriginalExtension();
+            $extension[0] = strtoupper($extension[0]);
+            Excel::import(new PaperBoxesImport($isOverride),$request->file()['file']->path(),null,$extension);
+            if (Cache::has('error')){
+                return '<h1 class="text-danger">导入Excel失败<br><p style="color: red">'.Cache::pull('error').'</p></h1>';
+            }else{
+                $exception=Cache::get('exception');
+                $a='';
+                for ($i=0;$i<count($exception);$i++){$a.=implode(',',$exception[$i]).'&#10'; };
+                $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
+                return '<h1 class="text-danger">导入Excel成功<br><textarea style="width: 50%;height: 50%">'.$a.'</textarea></h1>';
+            }
+        }else{
+            return '<h1 class="text-danger">失败<br><p style="color: red">不支持该文件类型</p></h1>';
+        }
+    }
+
     public function validator(Request $request,$id){
         if ($id){$model=$id;}
         $validator=Validator::make($request->input(),[

+ 13 - 3
app/Http/Controllers/UserController.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Carrier;
 use App\Exports\UserExport;
 use App\Role;
 use App\User;
@@ -23,7 +24,7 @@ class UserController extends Controller
     public function index()
     {
         if(!Gate::allows('用户-查询')){ return redirect(url('/'));  }
-        $users=User::with('roles')->orderBy('id','desc')->paginate(35);
+        $users=User::with(['roles','carriers'])->orderBy('id','desc')->paginate(35);
         $users->each(function (User $user){
             $user['isSuperAdmin']=$user->isSuperAdmin();
         });
@@ -39,7 +40,8 @@ class UserController extends Controller
     {
         if(!Gate::allows('用户-录入')){ return redirect(url('/'));  }
         $roles=Role::all();
-        return view('maintenance.user.create',['rolesAll'=>$roles]);
+        $carriers=Carrier::select('id','name')->get();
+        return view('maintenance.user.create',['rolesAll'=>$roles,'carriers'=>$carriers]);
     }
 
 
@@ -78,7 +80,9 @@ class UserController extends Controller
         if(!Gate::allows('用户-编辑')){ return redirect(url('/'));  }
         $rolesAll=Role::all();
         $roles=$user->roles()->get();
-        return view('maintenance.user.edit',compact('user','rolesAll','roles'));
+        $carriers=Carrier::select('id','name')->get();
+        $carrierUser=$user->carriers()->get();
+        return view('maintenance.user.edit',compact('user','rolesAll','roles','carriers','carrierUser'));
     }
 
     /**
@@ -101,6 +105,12 @@ class UserController extends Controller
         }else{
             $user->roles()->sync([]);
         }
+        $carrier_id=$request->input('carrier_id')??'';
+        if($carrier_id){
+            $user->carriers()->sync($carrier_id);
+        }else{
+            $user->carriers()->sync([]);
+        }
         $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
         return redirect('maintenance/user/')->with('successTip',"成功修改用户“{$user['name']}”!");
     }

+ 119 - 0
app/Http/Controllers/WeighExceptedController.php

@@ -0,0 +1,119 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Exports\WaybillExport;
+use App\Package;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Gate;
+use Maatwebsite\Excel\Facades\Excel;
+
+class WeighExceptedController extends Controller
+{
+    /**
+     * Display a listing of the resource.
+     *
+     * @return \Illuminate\Http\Response
+     */
+    public function indexCreate(Request $request)
+    {
+        $paginate=$request->input('paginate');
+        if ($paginate){
+            $weightExcepteds=Package::select('id','logistic_number','logistic_id','measuring_machine_id','created_at','weight','length','width','height','bulk','paper_box_id')->
+            where('status','上传异常')->orderBy('created_at','DESC')->paginate($paginate);
+        }else{
+            $weightExcepteds=Package::select('id','logistic_number','logistic_id','measuring_machine_id','created_at','weight','length','width','height','bulk','paper_box_id')->
+            where('status','上传异常')->orderBy('created_at','DESC')->paginate(50);
+        };
+        return view('weight.weightExcepted.index',['weightExcepteds'=>$weightExcepteds,'view'=>'indexCreate']);
+    }
+
+    public function indexIssued(Request $request)
+    {
+        $paginate=$request->input('paginate');
+        if ($paginate){
+            $weightExcepteds=Package::select('id','owner_id','logistic_number','created_at','delivery_number','batch_number','batch_rule','recipient','recipient_mobile','logistic_id')->
+            where('status','下发异常')->orderBy('created_at','DESC')->paginate($paginate);
+        }else{
+            $weightExcepteds=Package::select('id','owner_id','logistic_number','created_at','delivery_number','batch_number','batch_rule','recipient','recipient_mobile','logistic_id')->
+            where('status','下发异常')->orderBy('created_at','DESC')->paginate(50);
+        };
+        return view('weight.weightExcepted.index',['weightExcepteds'=>$weightExcepteds,'view'=>'indexIssued']);
+    }
+
+   public function export($id){
+       $id = explode( ',',$id);
+       $weighExcepted=Package::find($id[0]);
+       if ($weighExcepted->status=="上传异常"){
+           $row=[[
+               'id'=>'ID',
+               'logistic_number'=>'快递单号',
+               'logistic_name'=>'承运商',
+               'measuringMachine_name'=>'设备',
+               'weigh_time'=>'称重时间',
+               'weight'=>'重(KG)',
+               'length'=>'长(CM)',
+               'width'=>'宽(CM)',
+               'height'=>'高(CM)',
+               'bulk'=>'体积(CM³)',
+               'paperBox_name'=>'纸箱',
+               'genre'=>'异常类型',
+               'created_at'=>'称重时间',
+               'status'=>'异常类型',
+           ]];
+           $list=[];
+           for ($i=0; $i<count($id);$i++){
+               $weighExcepted=Package::find($id[$i]);
+               $w=[
+                   'id'=>isset($weighExcepted->id)?$weighExcepted->id:'',
+                   'logistic_number'=>isset($weighExcepted->logistic_number)?$weighExcepted->logistic_number:'',
+                   'logistic_name'=>isset($weighExcepted->logistic_name)?$weighExcepted->logistic_name:'',
+                   'measuringMachine_name'=>isset($weighExcepted->measuringMachine_name)?$weighExcepted->measuringMachine_name:'',
+                   'weigh_time'=>isset($weighExcepted->weigh_time)?$weighExcepted->weigh_time:'',
+                   'weight'=>isset($weighExcepted->weight)?$weighExcepted->weight:'',
+                   'length'=>isset($weighExcepted->length)?$weighExcepted->length:'',
+                   'width'=>isset($weighExcepted->width)?$weighExcepted->width:'',
+                   'bulk'=>isset($weighExcepted->bulk)?$weighExcepted->bulk:'',
+                   'height'=>isset($weighExcepted->height)?$weighExcepted->height:'',
+                   'paperBox_name'=>isset($weighExcepted->paperBox_name)?$weighExcepted->paperBox_name:'',
+                   'genre'=>isset($weighExcepted->genre)?$weighExcepted->genre:'',
+                   'created_at'=>isset($weighExcepted->created_at)?$weighExcepted->created_at:'',
+                   'status'=>isset($weighExcepted->status)?$weighExcepted->status:''
+               ];
+               $list[$i]=$w;
+           }
+       }else{
+           $row=[[
+               'id'=>'ID',
+               'logistic_number'=>'快递单号',
+               'created_at'=>'下发时间',
+               'delivery_number'=>'发货单号',
+               'batch_number'=>'波次号',
+               'batch_rule'=>'波次规则',
+               'recipient'=>'收件人',
+               'recipient_mobile'=>'收件人电话',
+               'logistic_name'=>'承运商',
+               'status'=>'异常类型',
+           ]];
+           $list=[];
+           for ($i=0; $i<count($id);$i++){
+               $weighExcepted=Package::find($id[$i]);
+               $w=[
+                   'id'=>isset($weighExcepted->id)?$weighExcepted->id:'',
+                   'logistic_number'=>isset($weighExcepted->logistic_number)?$weighExcepted->logistic_number:'',
+                   'logistic_name'=>isset($weighExcepted->logistic_name)?$weighExcepted->logistic_name:'',
+                   'created_at'=>isset($weighExcepted->created_at)?$weighExcepted->created_at:'',
+                   'delivery_number'=>isset($weighExcepted->delivery_number)?$weighExcepted->delivery_number:'',
+                   'batch_number'=>isset($weighExcepted->batch_number)?$weighExcepted->batch_number:'',
+                   'batch_rule'=>isset($weighExcepted->batch_rule)?$weighExcepted->batch_rule:'',
+                   'recipient'=>isset($weighExcepted->recipient)?$weighExcepted->recipient:'',
+                   'recipient_mobile'=>isset($weighExcepted->recipient_mobile)?$weighExcepted->recipient_mobile:'',
+                   'status'=>isset($weighExcepted->status)?$weighExcepted->status:'',
+               ];
+               $list[$i]=$w;
+           }
+       }
+       return Excel::download(new WaybillExport($row,$list), date('YmdHis', time()). '称重异常单.xls');
+   }
+}

+ 135 - 0
app/Http/Controllers/api-speech/AipSpeech.php

@@ -0,0 +1,135 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+require_once 'lib/AipBase.php';
+
+/**
+ * 百度语音
+ */
+class AipSpeech extends AipBase{
+
+    /**
+     * url
+     * @var string
+     */
+    public $asrUrl = 'http://vop.baidu.com/server_api';
+
+    /**
+     * url
+     * @var string
+     */
+    public $ttsUrl = 'http://tsn.baidu.com/text2audio';
+
+    /**
+     * 判断认证是否有权限
+     * @param  array   $authObj 
+     * @return boolean          
+     */
+    protected function isPermission($authObj)
+    {
+        return true;
+    }
+
+    /**
+     * 处理请求参数
+     * @param string $url
+     * @param array $params
+     * @param array $data
+     * @param array $headers
+     */
+    protected function proccessRequest($url, &$params, &$data, $headers){
+
+        $token = isset($params['access_token']) ? $params['access_token'] : '';
+        $data['cuid'] = md5($token);
+
+        if($url === $this->asrUrl){
+            $data['token'] = $token;
+            $data = json_encode($data);
+        }else{
+            $data['tok'] = $token;
+        }
+
+        unset($params['access_token']);
+    }
+
+    /**
+     * 格式化结果
+     * @param $content string
+     * @return mixed
+     */
+    protected function proccessResult($content){
+        $obj = json_decode($content, true);
+
+        if($obj === null){
+            $obj = array(
+                'content' => $content
+            );
+        }
+
+        return $obj;
+    }
+
+    /**
+     * @param  string $speech
+     * @param  string $format
+     * @param  int $rate
+     * @param  array $options
+     * @return array
+     */
+    public function asr($speech, $format, $rate, $options=array()){
+        $data = array();
+
+        if(!empty($speech)){
+            $data['speech'] = base64_encode($speech);
+            $data['len'] = strlen($speech);
+        }
+
+        $data['format'] = $format;
+        $data['rate'] = $rate;
+        $data['channel'] = 1;
+
+        $data = array_merge($data, $options);  
+
+        return $this->request($this->asrUrl, $data, array());
+    }
+
+    /**
+     * @param  string $text
+     * @param  string $lang
+     * @param  int $ctp
+     * @param  array $options
+     * @return array
+     */
+    public function synthesis($text, $lang='zh', $ctp=1, $options=array()){
+        $data = array();
+
+        $data['tex'] = $text;
+        $data['lan'] = $lang;
+        $data['ctp'] = $ctp;
+
+        $data = array_merge($data, $options);  
+
+        $result = $this->request($this->ttsUrl, $data, array());
+
+        if(!isset($result['err_no'])){
+            return $result['content'];
+        }
+
+        return $result;
+    }
+
+}

+ 1 - 0
app/Http/Controllers/api-speech/lib/2d7933431e76f4dd9eeb4e604e68bcb5

@@ -0,0 +1 @@
+{"refresh_token":"25.eeec2920c4570672b5576afb09b84541.315360000.1896687196.282335-18433903","expires_in":2592000,"session_key":"9mzdX+7jU7Gg2Qa0kT2WcY262oXOdCHJK1JJ6xc358dRvTEgzYmlSy8MY2J7k8i6SzILlbrddNB7oR9CWKJEQNk8lo1d4w==","access_token":"24.d42d9fbc247dee820fc92347acb080e5.2592000.1583919196.282335-18433903","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 fake_face_detect_\u5f00\u653eScope vis-ocr_\u865a\u62df\u4eba\u7269\u52a9\u7406 idl-video_\u865a\u62df\u4eba\u7269\u52a9\u7406","session_secret":"ffead248a50db54cc23adb7b48e9fa21","time":1581327194,"is_cloud_user":false}

+ 367 - 0
app/Http/Controllers/api-speech/lib/AipBCEUtil.php

@@ -0,0 +1,367 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+/**
+ * BCE Util
+ */
+class AipHttpUtil
+{
+    // 根据RFC 3986,除了:
+    //   1.大小写英文字符
+    //   2.阿拉伯数字
+    //   3.点'.'、波浪线'~'、减号'-'以及下划线'_'
+    // 以外都要编码
+    public static $PERCENT_ENCODED_STRINGS;
+
+    //填充编码数组
+    public static function __init()
+    {
+        AipHttpUtil::$PERCENT_ENCODED_STRINGS = array();
+        for ($i = 0; $i < 256; ++$i) {
+            AipHttpUtil::$PERCENT_ENCODED_STRINGS[$i] = sprintf("%%%02X", $i);
+        }
+
+        //a-z不编码
+        foreach (range('a', 'z') as $ch) {
+            AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord($ch)] = $ch;
+        }
+
+        //A-Z不编码
+        foreach (range('A', 'Z') as $ch) {
+            AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord($ch)] = $ch;
+        }
+
+        //0-9不编码
+        foreach (range('0', '9') as $ch) {
+            AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord($ch)] = $ch;
+        }
+
+        //以下4个字符不编码
+        AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord('-')] = '-';
+        AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord('.')] = '.';
+        AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord('_')] = '_';
+        AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord('~')] = '~';
+    }
+
+    /**
+     * 在uri编码中不能对'/'编码
+     * @param  string $path
+     * @return string
+     */
+    public static function urlEncodeExceptSlash($path)
+    {
+        return str_replace("%2F", "/", AipHttpUtil::urlEncode($path));
+    }
+
+    /**
+     * 使用编码数组编码
+     * @param  string $path
+     * @return string
+     */
+    public static function urlEncode($value)
+    {
+        $result = '';
+        for ($i = 0; $i < strlen($value); ++$i) {
+            $result .= AipHttpUtil::$PERCENT_ENCODED_STRINGS[ord($value[$i])];
+        }
+        return $result;
+    }
+
+    /**
+     * 生成标准化QueryString
+     * @param  array $parameters
+     * @return array
+     */
+    public static function getCanonicalQueryString(array $parameters)
+    {
+        //没有参数,直接返回空串
+        if (count($parameters) == 0) {
+            return '';
+        }
+
+        $parameterStrings = array();
+        foreach ($parameters as $k => $v) {
+            //跳过Authorization字段
+            if (strcasecmp('Authorization', $k) == 0) {
+                continue;
+            }
+            if (!isset($k)) {
+                throw new \InvalidArgumentException(
+                    "parameter key should not be null"
+                );
+            }
+            if (isset($v)) {
+                //对于有值的,编码后放在=号两边
+                $parameterStrings[] = AipHttpUtil::urlEncode($k)
+                    . '=' . AipHttpUtil::urlEncode((string) $v);
+            } else {
+                //对于没有值的,只将key编码后放在=号的左边,右边留空
+                $parameterStrings[] = AipHttpUtil::urlEncode($k) . '=';
+            }
+        }
+        //按照字典序排序
+        sort($parameterStrings);
+
+        //使用'&'符号连接它们
+        return implode('&', $parameterStrings);
+    }
+
+    /**
+     * 生成标准化uri
+     * @param  string $path
+     * @return string
+     */
+    public static function getCanonicalURIPath($path)
+    {
+        //空路径设置为'/'
+        if (empty($path)) {
+            return '/';
+        } else {
+            //所有的uri必须以'/'开头
+            if ($path[0] == '/') {
+                return AipHttpUtil::urlEncodeExceptSlash($path);
+            } else {
+                return '/' . AipHttpUtil::urlEncodeExceptSlash($path);
+            }
+        }
+    }
+
+    /**
+     * 生成标准化http请求头串
+     * @param  array $headers
+     * @return array
+     */
+    public static function getCanonicalHeaders($headers)
+    {
+        //如果没有headers,则返回空串
+        if (count($headers) == 0) {
+            return '';
+        }
+
+        $headerStrings = array();
+        foreach ($headers as $k => $v) {
+            //跳过key为null的
+            if ($k === null) {
+                continue;
+            }
+            //如果value为null,则赋值为空串
+            if ($v === null) {
+                $v = '';
+            }
+            //trim后再encode,之后使用':'号连接起来
+            $headerStrings[] = AipHttpUtil::urlEncode(strtolower(trim($k))) . ':' . AipHttpUtil::urlEncode(trim($v));
+        }
+        //字典序排序
+        sort($headerStrings);
+
+        //用'\n'把它们连接起来
+        return implode("\n", $headerStrings);
+    }
+}
+AipHttpUtil::__init();
+
+
+class AipSignOption
+{
+    const EXPIRATION_IN_SECONDS = 'expirationInSeconds';
+
+    const HEADERS_TO_SIGN = 'headersToSign';
+
+    const TIMESTAMP = 'timestamp';
+
+    const DEFAULT_EXPIRATION_IN_SECONDS = 1800;
+
+    const MIN_EXPIRATION_IN_SECONDS = 300;
+
+    const MAX_EXPIRATION_IN_SECONDS = 129600;
+}
+
+
+class AipSampleSigner
+{
+
+    const BCE_AUTH_VERSION = "bce-auth-v1";
+    const BCE_PREFIX = 'x-bce-';
+
+    //不指定headersToSign情况下,默认签名http头,包括:
+    //    1.host
+    //    2.content-length
+    //    3.content-type
+    //    4.content-md5
+    public static $defaultHeadersToSign;
+
+    public static function  __init()
+    {
+        AipSampleSigner::$defaultHeadersToSign = array(
+            "host",
+            "content-length",
+            "content-type",
+            "content-md5",
+        );
+    }
+
+    /**
+     * 签名
+     * @param  array $credentials
+     * @param  string $httpMethod
+     * @param  string $path
+     * @param  array  $headers
+     * @param  string $params
+     * @param  array  $options
+     * @return string
+     */
+    public static function sign(
+        array $credentials,
+        $httpMethod,
+        $path,
+        $headers,
+        $params,
+        $options = array()
+    ) {
+        //设定签名有效时间
+        if (!isset($options[AipSignOption::EXPIRATION_IN_SECONDS])) {
+            //默认值1800秒
+            $expirationInSeconds = AipSignOption::DEFAULT_EXPIRATION_IN_SECONDS;
+        } else {
+            $expirationInSeconds = $options[AipSignOption::EXPIRATION_IN_SECONDS];
+        }
+
+        //解析ak sk
+        $accessKeyId = $credentials['ak'];
+        $secretAccessKey = $credentials['sk'];
+
+        //设定时间戳,注意:如果自行指定时间戳需要为UTC时间
+        if (!isset($options[AipSignOption::TIMESTAMP])) {
+            //默认值当前时间
+            $timestamp = gmdate('Y-m-d\TH:i:s\Z');
+        } else {
+            $timestamp = $options[AipSignOption::TIMESTAMP];
+        }
+
+        //生成authString
+        $authString = AipSampleSigner::BCE_AUTH_VERSION . '/' . $accessKeyId . '/'
+            . $timestamp . '/' . $expirationInSeconds;
+
+        //使用sk和authString生成signKey
+        $signingKey = hash_hmac('sha256', $authString, $secretAccessKey);
+
+        //生成标准化URI
+        $canonicalURI = AipHttpUtil::getCanonicalURIPath($path);
+
+        //生成标准化QueryString
+        $canonicalQueryString = AipHttpUtil::getCanonicalQueryString($params);
+
+        //填充headersToSign,也就是指明哪些header参与签名
+        $headersToSign = null;
+        if (isset($options[AipSignOption::HEADERS_TO_SIGN])) {
+            $headersToSign = $options[AipSignOption::HEADERS_TO_SIGN];
+        }
+
+        //生成标准化header
+        $canonicalHeader = AipHttpUtil::getCanonicalHeaders(
+            AipSampleSigner::getHeadersToSign($headers, $headersToSign)
+        );
+
+        //整理headersToSign,以';'号连接
+        $signedHeaders = '';
+        if ($headersToSign !== null) {
+            $signedHeaders = strtolower(
+                trim(implode(";", $headersToSign))
+            );
+        }
+
+        //组成标准请求串
+        $canonicalRequest = "$httpMethod\n$canonicalURI\n"
+            . "$canonicalQueryString\n$canonicalHeader";
+
+        //使用signKey和标准请求串完成签名
+        $signature = hash_hmac('sha256', $canonicalRequest, $signingKey);
+
+        //组成最终签名串
+        $authorizationHeader = "$authString/$signedHeaders/$signature";
+
+        return $authorizationHeader;
+    }
+
+    /**
+     * 根据headsToSign过滤应该参与签名的header
+     * @param  array $headers
+     * @param  array $headersToSign
+     * @return array
+     */
+    public static function getHeadersToSign($headers, $headersToSign)
+    {
+
+        //value被trim后为空串的header不参与签名
+        $filter_empty = function($v) {
+            return trim((string) $v) !== '';
+        };
+        $headers = array_filter($headers, $filter_empty);
+
+        //处理headers的key:去掉前后的空白并转化成小写
+        $trim_and_lower = function($str){
+            return strtolower(trim($str));
+        };
+        $temp = array();
+        $process_keys = function($k, $v) use(&$temp, $trim_and_lower) {
+            $temp[$trim_and_lower($k)] = $v;
+        };
+        array_map($process_keys, array_keys($headers), $headers);
+        $headers = $temp;
+
+        //取出headers的key以备用
+        $header_keys = array_keys($headers);
+
+        $filtered_keys = null;
+        if ($headersToSign !== null) {
+            //如果有headersToSign,则根据headersToSign过滤
+
+            //预处理headersToSign:去掉前后的空白并转化成小写
+            $headersToSign = array_map($trim_and_lower, $headersToSign);
+
+            //只选取在headersToSign里面的header
+            $filtered_keys = array_intersect_key($header_keys, $headersToSign);
+
+        } else {
+            //如果没有headersToSign,则根据默认规则来选取headers
+            $filter_by_default = function($k) {
+                return AipSampleSigner::isDefaultHeaderToSign($k);
+            };
+            $filtered_keys = array_filter($header_keys, $filter_by_default);
+        }
+
+        //返回需要参与签名的header
+        return array_intersect_key($headers, array_flip($filtered_keys));
+    }
+
+    /**
+     * 检查header是不是默认参加签名的:
+     * 1.是host、content-type、content-md5、content-length之一
+     * 2.以x-bce开头
+     * @param  array $header
+     * @return boolean
+     */
+    public static function isDefaultHeaderToSign($header)
+    {
+        $header = strtolower(trim($header));
+        if (in_array($header, AipSampleSigner::$defaultHeadersToSign)) {
+            return true;
+        }
+        return substr_compare($header, AipSampleSigner::BCE_PREFIX, 0, strlen(AipSampleSigner::BCE_PREFIX)) == 0;
+    }
+}
+AipSampleSigner::__init();

+ 343 - 0
app/Http/Controllers/api-speech/lib/AipBase.php

@@ -0,0 +1,343 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+require_once 'AipHttpClient.php';
+require_once 'AipBCEUtil.php';
+require_once 'AipImageUtil.php';
+
+/**
+ * Aip Base 基类
+ */
+class AipBase {
+
+    /**
+     * 获取access token url
+     * @var string
+     */
+    protected $accessTokenUrl = 'https://aip.baidubce.com/oauth/2.0/token';
+
+    /**
+     * appId
+     * @var string
+     */
+    protected $appId = '';
+
+    /**
+     * apiKey
+     * @var string
+     */
+    protected $apiKey = '';
+    
+    /**
+     * secretKey
+     * @var string
+     */
+    protected $secretKey = '';
+
+    /**
+     * 权限
+     * @var array
+     */
+    protected $scope = 'brain_all_scope';
+
+    /**
+     * @param string $appId 
+     * @param string $apiKey
+     * @param string $secretKey
+     */
+    public function __construct($appId, $apiKey, $secretKey){
+        $this->appId = trim($appId);
+        $this->apiKey = trim($apiKey);
+        $this->secretKey = trim($secretKey);
+        $this->isCloudUser = null;
+        $this->client = new AipHttpClient();
+        $this->version = '1_6_0';
+    }
+
+    /**
+     * 连接超时
+     * @param int $ms 毫秒
+     */
+    public function setConnectionTimeoutInMillis($ms){
+        $this->client->setConnectionTimeoutInMillis($ms);
+    }
+
+    /**
+     * 响应超时
+     * @param int $ms 毫秒
+     */
+    public function setSocketTimeoutInMillis($ms){
+        $this->client->setSocketTimeoutInMillis($ms);
+    }
+
+    /**
+     * 处理请求参数
+     * @param  string $url
+     * @param array $params
+     * @param array $data
+     * @param array $headers
+     */
+    protected function proccessRequest($url, &$params, &$data, $headers){
+        $params['aipSdk'] = 'php';
+        $params['aipSdkVersion'] = $this->version;
+    }
+
+    /**
+     * Api 请求
+     * @param  string $url
+     * @param  mixed $data
+     * @return mixed
+     */
+    protected function request($url, $data, $headers=array()){
+        try{
+            $result = $this->validate($url, $data);
+            if($result !== true){
+                return $result;
+            }
+
+            $params = array();
+            $authObj = $this->auth();
+
+            if($this->isCloudUser === false){
+                $params['access_token'] = $authObj['access_token'];
+            }
+
+            // 特殊处理
+            $this->proccessRequest($url, $params, $data, $headers);
+ 
+            $headers = $this->getAuthHeaders('POST', $url, $params, $headers);
+            $response = $this->client->post($url, $data, $params, $headers);
+ 
+            $obj = $this->proccessResult($response['content']);
+
+            if(!$this->isCloudUser && isset($obj['error_code']) && $obj['error_code'] == 110){
+                $authObj = $this->auth(true);
+                $params['access_token'] = $authObj['access_token'];
+                $response = $this->client->post($url, $data, $params, $headers);
+                $obj = $this->proccessResult($response['content']);
+            }
+
+            if(empty($obj) || !isset($obj['error_code'])){
+                $this->writeAuthObj($authObj);
+            }
+        }catch(Exception $e){
+            return array(
+                'error_code' => 'SDK108',
+                'error_msg' => 'connection or read data timeout',
+            );
+        }
+
+        return $obj;
+    }
+
+    /**
+     * Api 多个并发请求
+     * @param  string $url
+     * @param  mixed $data
+     * @return mixed
+     */
+    protected function multi_request($url, $data){
+        try{
+            $params = array();
+            $authObj = $this->auth();
+            $headers = $this->getAuthHeaders('POST', $url);
+
+            if($this->isCloudUser === false){
+                $params['access_token'] = $authObj['access_token'];
+            }
+
+            $responses = $this->client->multi_post($url, $data, $params, $headers);
+
+            $is_success = false;
+            foreach($responses as $response){
+                $obj = $this->proccessResult($response['content']);
+
+                if(empty($obj) || !isset($obj['error_code'])){
+                    $is_success = true;
+                }
+
+                if(!$this->isCloudUser && isset($obj['error_code']) && $obj['error_code'] == 110){
+                    $authObj = $this->auth(true);
+                    $params['access_token'] = $authObj['access_token'];
+                    $responses = $this->client->post($url, $data, $params, $headers);
+                    break;
+                }
+            }
+
+            if($is_success){
+                $this->writeAuthObj($authObj);
+            }
+
+            $objs = array();
+            foreach($responses as $response){
+                $objs[] = $this->proccessResult($response['content']);
+            }
+
+        }catch(Exception $e){
+            return array(
+                'error_code' => 'SDK108',
+                'error_msg' => 'connection or read data timeout',
+            );
+        }
+
+        return $objs;
+    }
+
+    /**
+     * 格式检查
+     * @param  string $url
+     * @param  array $data
+     * @return mix
+     */
+    protected function validate($url, &$data){
+        return true;
+    }
+
+    /**
+     * 格式化结果
+     * @param $content string
+     * @return mixed
+     */
+    protected function proccessResult($content){
+        return json_decode($content, true);
+    }
+
+    /**
+     * 返回 access token 路径
+     * @return string
+     */
+    private function getAuthFilePath(){
+        return dirname(__FILE__) . DIRECTORY_SEPARATOR . md5($this->apiKey);
+    }
+
+    /**
+     * 写入本地文件
+     * @param  array $obj
+     * @return void
+     */
+    private function writeAuthObj($obj){
+        if($obj === null || (isset($obj['is_read']) && $obj['is_read'] === true)){
+            return;
+        }
+
+        $obj['time'] = time();
+        $obj['is_cloud_user'] = $this->isCloudUser;
+        @file_put_contents($this->getAuthFilePath(), json_encode($obj));
+    }
+
+    /**
+     * 读取本地缓存
+     * @return array
+     */
+    private function readAuthObj(){
+        $content = @file_get_contents($this->getAuthFilePath());
+        if($content !== false){
+            $obj = json_decode($content, true);
+            $this->isCloudUser = $obj['is_cloud_user'];
+            $obj['is_read'] = true;
+            if($this->isCloudUser || $obj['time'] + $obj['expires_in'] - 30 > time()){
+                return $obj;
+            }
+        }
+
+        return null;
+    }
+
+    /**
+     * 认证
+     * @param bool $refresh 是否刷新
+     * @return array
+     */
+    private function auth($refresh=false){
+
+        //非过期刷新
+        if(!$refresh){
+            $obj = $this->readAuthObj();
+            if(!empty($obj)){
+                return $obj;
+            }
+        }
+
+        $response = $this->client->get($this->accessTokenUrl, array(
+            'grant_type' => 'client_credentials',
+            'client_id' => $this->apiKey,
+            'client_secret' => $this->secretKey,
+        ));
+
+        $obj = json_decode($response['content'], true);
+
+        $this->isCloudUser = !$this->isPermission($obj);
+        return $obj;
+    }
+
+    /**
+     * 判断认证是否有权限
+     * @param  array   $authObj 
+     * @return boolean          
+     */
+    protected function isPermission($authObj)
+    {
+        if(empty($authObj) || !isset($authObj['scope'])){
+            return false;
+        }
+
+        $scopes = explode(' ', $authObj['scope']);
+
+        return in_array($this->scope, $scopes);
+    }
+
+    /**
+     * @param  string $method HTTP method
+     * @param  string $url
+     * @param  array $param 参数
+     * @return array
+     */
+    private function getAuthHeaders($method, $url, $params=array(), $headers=array()){
+        
+        //不是云的老用户则不用在header中签名 认证
+        if($this->isCloudUser === false){
+            return $headers;
+        }
+
+        $obj = parse_url($url);
+        if(!empty($obj['query'])){        
+            foreach(explode('&', $obj['query']) as $kv){
+                if(!empty($kv)){
+                    list($k, $v) = explode('=', $kv, 2);
+                    $params[$k] = $v;
+                }
+            }
+        }
+
+        //UTC 时间戳
+        $timestamp = gmdate('Y-m-d\TH:i:s\Z');
+        $headers['Host'] = isset($obj['port']) ? sprintf('%s:%s', $obj['host'], $obj['port']) : $obj['host'];
+        $headers['x-bce-date'] = $timestamp;
+
+        //签名
+        $headers['authorization'] = AipSampleSigner::sign(array(
+            'ak' => $this->apiKey,
+            'sk' => $this->secretKey,
+        ), $method, $obj['path'], $headers, $params, array(
+            'timestamp' => $timestamp,
+            'headersToSign' => array_keys($headers),
+        ));
+
+        return $headers;
+    }
+
+}

+ 192 - 0
app/Http/Controllers/api-speech/lib/AipHttpClient.php

@@ -0,0 +1,192 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+/**
+ * Http Client
+ */
+class AipHttpClient{
+
+    /**
+     * HttpClient
+     * @param array $headers HTTP header
+     */
+    public function __construct($headers=array()){
+        $this->headers = $this->buildHeaders($headers);
+        $this->connectTimeout = 60000;
+        $this->socketTimeout = 60000;
+    }
+
+    /**
+     * 连接超时
+     * @param int $ms 毫秒
+     */
+    public function setConnectionTimeoutInMillis($ms){
+        $this->connectTimeout = $ms;
+    }
+
+    /**
+     * 响应超时
+     * @param int $ms 毫秒
+     */
+    public function setSocketTimeoutInMillis($ms){
+        $this->socketTimeout = $ms;
+    }    
+
+    /**
+     * @param  string $url
+     * @param  array $data HTTP POST BODY
+     * @param  array $param HTTP URL
+     * @param  array $headers HTTP header
+     * @return array
+     */
+    public function post($url, $data=array(), $params=array(), $headers=array()){
+        $url = $this->buildUrl($url, $params);
+        $headers = array_merge($this->headers, $this->buildHeaders($headers));
+
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_POST, 1);
+        curl_setopt($ch, CURLOPT_HEADER, false);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, is_array($data) ? http_build_query($data) : $data);
+        curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->socketTimeout);
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout);
+        $content = curl_exec($ch);
+        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+
+        if($code === 0){
+            throw new Exception(curl_error($ch));
+        }
+
+        curl_close($ch);
+        return array(
+            'code' => $code,
+            'content' => $content,
+        );
+    }
+
+    /**
+     * @param  string $url
+     * @param  array $datas HTTP POST BODY
+     * @param  array $param HTTP URL
+     * @param  array $headers HTTP header
+     * @return array
+     */
+    public function multi_post($url, $datas=array(), $params=array(), $headers=array()){
+        $url = $this->buildUrl($url, $params);
+        $headers = array_merge($this->headers, $this->buildHeaders($headers));
+
+        $chs = array();
+        $result = array();
+        $mh = curl_multi_init();
+        foreach($datas as $data){        
+            $ch = curl_init();
+            $chs[] = $ch;
+            curl_setopt($ch, CURLOPT_URL, $url);
+            curl_setopt($ch, CURLOPT_POST, 1);
+            curl_setopt($ch, CURLOPT_HEADER, false);
+            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+            curl_setopt($ch, CURLOPT_POSTFIELDS, is_array($data) ? http_build_query($data) : $data);
+            curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->socketTimeout);
+            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout);
+            curl_multi_add_handle($mh, $ch);
+        }
+
+        $running = null;
+        do{
+            curl_multi_exec($mh, $running);
+            usleep(100);
+        }while($running);
+
+        foreach($chs as $ch){        
+            $content = curl_multi_getcontent($ch);
+            $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+            $result[] = array(
+                'code' => $code,
+                'content' => $content,
+            );
+            curl_multi_remove_handle($mh, $ch);
+        }
+        curl_multi_close($mh);
+        
+        return $result;
+    }
+
+    /**
+     * @param  string $url
+     * @param  array $param HTTP URL
+     * @param  array $headers HTTP header
+     * @return array
+     */
+    public function get($url, $params=array(), $headers=array()){
+        $url = $this->buildUrl($url, $params);
+        $headers = array_merge($this->headers, $this->buildHeaders($headers));
+
+        $ch = curl_init();
+        curl_setopt($ch, CURLOPT_URL, $url);
+        curl_setopt($ch, CURLOPT_HEADER, false);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+        curl_setopt($ch, CURLOPT_TIMEOUT_MS, $this->socketTimeout);
+        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->connectTimeout);
+        $content = curl_exec($ch);
+        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+
+        if($code === 0){
+            throw new Exception(curl_error($ch));
+        }
+        
+        curl_close($ch);
+        return array(
+            'code' => $code,
+            'content' => $content,
+        );
+    }
+
+    /**
+     * 构造 header
+     * @param  array $headers
+     * @return array
+     */
+    private function buildHeaders($headers){
+        $result = array();
+        foreach($headers as $k => $v){
+            $result[] = sprintf('%s:%s', $k, $v);
+        }
+        return $result;
+    }
+
+    /**
+     * 
+     * @param  string $url
+     * @param  array $params 参数
+     * @return string
+     */
+    private function buildUrl($url, $params){
+        if(!empty($params)){
+            $str = http_build_query($params);
+            return $url . (strpos($url, '?') === false ? '?' : '&') . $str;
+        }else{
+            return $url;
+        }
+    }
+}

+ 36 - 0
app/Http/Controllers/api-speech/lib/AipImageUtil.php

@@ -0,0 +1,36 @@
+<?php
+/*
+* Copyright (c) 2017 Baidu.com, Inc. All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License. You may obtain a copy of
+* the License at
+*
+* Http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations under
+* the License.
+*/
+
+class AipImageUtil{
+
+    /**
+     * 获取图片信息
+     * @param  $content string
+     * @return array
+     */
+    public static function getImageInfo($content){
+        $info = getimagesizefromstring($content);
+
+        return array(
+            'mime' => $info['mime'],
+            'width' => $info[0],
+            'height' => $info[1],
+        );
+    }
+}
+
+// var_dump(AipUtil::getImageInfo(file_get_contents('../test/general.png')));

+ 107 - 0
app/Http/Controllers/api/WxController.php

@@ -0,0 +1,107 @@
+<?php
+
+namespace App\Http\Controllers\Api;
+
+use App\Unit;
+use App\User;
+use App\Waybill;
+use Illuminate\Http\Request;
+use App\Http\Controllers\Controller;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Hash;
+use Illuminate\Support\Facades\Validator;
+
+class WxController extends Controller
+{
+    public function index(Request $request){
+        $carrierArr=[];
+        $carriersName=[];
+        $api_token=$request->input('api_token');
+        $user=User::with('carriers')->where('api_token',$api_token)->first();
+        if ($user){
+            foreach ($user->carriers as $carrier){
+                array_push($carrierArr, $carrier->id);
+                array_push($carriersName, $carrier->name);
+            }
+            $count=Waybill::select('id')->whereIn('carrier_id',$carrierArr)->whereDate('created_at',date("Y-m-d "))->count();
+            $waybill=Waybill::orderBy('created_at','DESC')->select('created_at','waybill_number','wms_bill_number','carrier_bill')
+                ->whereIn('carrier_id',$carrierArr)->where('status','!=','已完结')->where('status','!=','无模型')->get();
+            return ['waybill'=>$waybill,'carriersName'=>$carriersName,'count'=>$count];
+        }
+        return ['exception'=>'出错了!'];
+    }
+
+    public function show(Request $request){
+        $units_name=[];
+        $waybill_number=$request->input('waybill_number');
+        $waybill=Waybill::select('id','waybill_number','wms_bill_number','owner_id','origination','destination','recipient','recipient_mobile',
+                'carrier_weight','carrier_weight_unit_id','carrier_weight_other','carrier_weight_unit_id_other','pick_up_fee','carrier_bill')
+            ->where('waybill_number',$waybill_number)->first();
+        $units=Unit::select('name')->get();
+        foreach ($units as $unit){
+            array_push($units_name, $unit->name);
+        }
+        return ['waybill'=>$waybill,'units_name'=>$units_name];
+    }
+
+    public function update(Request $request){
+        $id=$request->input('id');
+        $validator=Validator::make($request->input(),[
+            'carrier_bill'=>"required|max:50|unique:waybills,carrier_bill,$id",
+            'pick_up_fee'=>'nullable|min:0|numeric|max:999999',
+            'carrier_weight'=>'required|min:0|numeric|max:999999',
+            'carrier_weight_unit_name'=>'required_with:carrier_weight',
+            'carrier_weight_other'=>'nullable|min:0|numeric|max:999999',
+            'carrier_weight_unit_other_name'=>'required_with:carrier_weight_other',
+        ],[
+            'required'=>':attribute 为必填项',
+            'alpha_num'=>':attribute 应为字母或数字',
+            'max'=>':attribute 字符过多或输入值过大',
+            'min'=>':attribute 不得为负',
+            'numeric'=>':attribute 应为数字',
+            'unique'=>':attribute 已存在',
+            'required_with'=>':attribute 未填',
+        ],[
+            'carrier_bill'=>'承运商单号',
+            'pick_up_fee'=>'提货费',
+            'carrier_weight'=>'计数一',
+            'carrier_weight_unit_id'=>'计数单位一',
+            'carrier_weight_other'=>'计数二',
+            'carrier_weight_unit_other_name'=>'计数单位二',
+        ]);
+        if ($validator->fails()) {
+            //将返回错误循环组装成字符串
+            $arr = [];
+            foreach ($validator->getMessageBag()->toArray() as $k=>$error){
+                array_push($arr, $error[0]);
+            }
+            return [
+                'success' => false,
+                'errors' => $arr
+            ];
+        }
+        $unit=Unit::where('name',$request->input('carrier_weight_unit_name'))->first();
+        $unit_other=Unit::where('name',$request->input('carrier_weight_unit_other_name'))->first();
+        $waybill=Waybill::find($id);
+        $carrier_bill=$request->input('carrier_bill');
+        $pick_up_fee=$request->input('pick_up_fee');
+        $carrier_weight=$request->input('carrier_weight');
+        $carrier_weight_unit_id=$unit->id;
+        $carrier_weight_other=$request->input('carrier_weight_other');
+        if ($unit_other){
+            $carrier_weight_unit_id_other=$unit_other->id;
+            $waybill->carrier_weight_unit_id_other=$carrier_weight_unit_id_other;
+        }
+        $waybill->carrier_bill=$carrier_bill;
+        if($pick_up_fee)$waybill->pick_up_fee=$pick_up_fee;
+        $waybill->carrier_weight=$carrier_weight;
+        $waybill->carrier_weight_unit_id=$carrier_weight_unit_id;
+        $waybill->carrier_weight_other=$carrier_weight_other;
+
+        if ($waybill->save()){
+            $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
+            return ['success'=>true];
+        }
+        else return ['success'=>false];
+    }
+}

+ 27 - 0
app/Http/Controllers/api/WxLoginController.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace App\Http\Controllers\Api;
+
+use App\User;
+use Illuminate\Http\Request;
+use App\Http\Controllers\Controller;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Hash;
+
+class WxLoginController extends Controller
+{
+    public function login(Request $request){
+        $name = $request->input('name');
+        $pwd = $request->input('password');
+        $user = User::where('name', $name)->first();
+        if ($user){
+            $isRight=Hash::check($pwd,$user['password']);
+            if ($isRight){
+                $this->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),$user->id);
+                return ['api_token'=>$user->api_token];
+            }
+            else return ['api_token'=>''];
+        }
+        return ['api_token'=>''];
+    }
+}

+ 130 - 0
app/Imports/PaperBoxesImport.php

@@ -0,0 +1,130 @@
+<?php
+
+namespace App\Imports;
+
+use App\Owner;
+use App\PaperBox;
+use App\WaybillPriceModel;
+use App\Carrier;
+use App\City;
+use App\Events\WaybillPriceModelEvent;
+use App\Province;
+use App\Unit;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Cache;
+use Maatwebsite\Excel\Concerns\ToCollection;
+use Maatwebsite\Excel\Concerns\WithHeadingRow;
+use Maatwebsite\Excel\Imports\HeadingRowFormatter;
+
+HeadingRowFormatter::default('none');
+class PaperBoxesImport implements ToCollection,WithHeadingRow
+{
+    protected $isOverride;
+    public function __construct($isOverride)
+    {
+        if ($isOverride==1){
+            $this->isOverride=true;
+        }
+    }
+
+
+    /**
+     * @param Collection $collection
+     */
+    public function Collection(Collection $collection)
+    {
+        $endIs=false;
+        $cityIs=true;
+        if (isset($collection->toArray()[0]['货主'])&&isset($collection->toArray()[0]['纸箱名称'])&&isset($collection->toArray()[0]['长'])
+            &&isset($collection->toArray()[0]['宽'])&&isset($collection->toArray()[0]['高'])){
+                $endIs=true;
+        }else{
+                Cache::put('error','请检查您第一行标题是否存在货主,纸箱名称,长,宽,高',86400);
+                $endIs=false;
+        }
+        $exception=[];
+        $sum=2;
+        if ($endIs) {
+            foreach ($collection as $row) {
+                if (!$row['货主']) {
+                    array_push($exception, ['第' . $sum . '行数据货主为空!']);
+                    $sum++;
+                    continue;
+                }
+                if (!$row['纸箱名称']) {
+                    array_push($exception, ['第' . $sum . '行数据纸箱名称为空!']);
+                    $sum++;
+                    continue;
+                }
+                if (!$row['长'] || preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $row['长']) == 0) {
+                    array_push($exception, ['第' . $sum . '行数据长为空或不为数字!']);
+                    $sum++;
+                    continue;
+                }
+                if (!$row['宽'] || preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $row['宽']) == 0) {
+                    array_push($exception, ['第' . $sum . '行数据宽为空或不为数字!']);
+                    $sum++;
+                    continue;
+                }
+                if (!$row['高'] || preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $row['高']) == 0) {
+                    array_push($exception, ['第' . $sum . '行数据高为空或不为数字!']);
+                    $sum++;
+                    continue;
+                }
+                $owner = Owner::where("name", $row['货主'])->first();
+                if (!$owner) {
+                    array_push($exception, ['第' . $sum . '行数据货主在系统中未找到!']);
+                    $sum++;
+                    continue;
+                }
+                $length = $row['长'];
+                $width = $row['宽'];
+                $height = $row['高'];
+                $max = ($length >= ($width >= $height ? $width : $height) ? $length : ($width >= $height ? $width : $height));
+                if ($max == $length) {
+                    $centre = $width >= $height ? $width : $height;
+                    $min = $width < $height ? $width : $height;
+                } elseif ($max == $width) {
+                    $centre = $length >= $height ? $length : $height;
+                    $min = $length < $height ? $length : $height;
+                } else {
+                    $centre = $width >= $length ? $width : $length;
+                    $min = $width < $length ? $width : $length;
+                }
+                $paperBox = PaperBox::with('owners')->where('model', $row['纸箱名称'])->first();
+                if ($paperBox) {
+                    if ($this->isOverride) {
+                        $paperBox->length = $max;
+                        $paperBox->width = $centre;
+                        $paperBox->height = $min;
+                        $paperBox->save();
+                        array_push($exception, ['第' . $sum . '行数据已覆盖!']);
+                    } else {
+                        array_push($exception, ['第' . $sum . '行数据已存在!']);
+                    }
+                    if ($paperBox->owners){
+                        $isOwner = true;
+                        foreach ($paperBox->owners as $o){
+                            if ($o->id == $owner->id){
+                                $isOwner = false;
+                                break;
+                            }
+                        }
+                        if ($isOwner) $paperBox->owners()->syncWithoutDetaching($owner->id);
+                    }
+                } else {
+                    $paperBox = new PaperBox([
+                        'model' => $row['纸箱名称'],
+                        'length' => $max,
+                        'width' => $centre,
+                        'height' => $min,
+                    ]);
+                    $paperBox->save();
+                    $paperBox->owners()->sync($owner->id);
+                }
+                $sum++;
+            }
+            Cache::put('exception', $exception, 86400);
+        }
+    }
+}

+ 8 - 8
app/Imports/WaybillPriceModelsImport.php

@@ -83,8 +83,8 @@ class WaybillPriceModelsImport implements ToCollection,WithHeadingRow
                                 $waybillPriceModel = ['carrier_id' => $carrier->id, 'unit_id' => $unit->id, 'province_id' => $province->id, 'unit_price' => $row['单价']];
                                 if ($row['计数区间']) {
                                     $str = explode('-', $row['计数区间']);
-                                    if (preg_match('/^([0-9]\d*(\.\d*[1-9])?)|(0\.\d*[1-9])$/', $str[0]) >= 0
-                                        && preg_match('/^([0-9]\d*(\.\d*[1-9])?)|(0\.\d*[1-9])$/', $str[1]) > 0
+                                    if (preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $str[0]) >= 0
+                                        && preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $str[1]) > 0
                                         && $str[0] < $str[1] && count($str) == 2
                                     ) {
                                         $waybillPriceModel = array_merge($waybillPriceModel, ['range_min' => $str[0], 'range_max' => $str[1]]);
@@ -97,13 +97,13 @@ class WaybillPriceModelsImport implements ToCollection,WithHeadingRow
                                         $waybillPriceModel = array_merge($waybillPriceModel, ['city_id' => $city->id]);
                                     }
                                 }
-                                if ($row['起步费'] && preg_match('/^([0-9]\d*(\.\d*[1-9])?)|(0\.\d*[1-9])$/', $row['起步费']) > 0) {
+                                if ($row['起步费'] && preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $row['起步费']) > 0) {
                                     $waybillPriceModel = array_merge($waybillPriceModel, ['base_fee' => $row['起步费']]);
                                 } else {
                                     $waybillPriceModel = array_merge($waybillPriceModel, ['base_fee' => 0]);
                                     array_push($exception, ['第' . $sum . '行数据起步费为空,或为负,已默认设为0']);
                                 }
-                                if ($row['最低计数'] && preg_match('/^([0-9]\d*(\.\d*[1-9])?)|(0\.\d*[1-9])$/', $row['最低计数']) > 0) {
+                                if ($row['最低计数'] && preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $row['最低计数']) > 0) {
                                     $waybillPriceModel = array_merge($waybillPriceModel, ['initial_weight' => $row['最低计数']]);
                                 } else {
                                     $waybillPriceModel = array_merge($waybillPriceModel, ['initial_weight' => 0]);
@@ -117,8 +117,8 @@ class WaybillPriceModelsImport implements ToCollection,WithHeadingRow
                                 $waybillPriceModel = ['carrier_id' => $carrier->id, 'unit_id' => $unit->id, 'province_id' => $province->id, 'unit_price' => $row['单价']];
                                 if ($row['计数区间']&& !strstr($row['计数区间'], '∞')) {
                                     $str = explode('-', $row['计数区间']);
-                                    if (preg_match('/^([0-9]\d*(\.\d*[1-9])?)|(0\.\d*[1-9])$/', $str[0]) > 0
-                                        && preg_match('/^([0-9]\d*(\.\d*[1-9])?)|(0\.\d*[1-9])$/', $str[1]) > 0
+                                    if (preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $str[0]) > 0
+                                        && preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $str[1]) > 0
                                         && $str[0] < $str[1] && count($str) == 2
                                     ) {
                                         $waybillPriceModel = array_merge($waybillPriceModel, ['range_min' => $str[0], 'range_max' => $str[1]]);
@@ -131,13 +131,13 @@ class WaybillPriceModelsImport implements ToCollection,WithHeadingRow
                                         $waybillPriceModel = array_merge($waybillPriceModel, ['city_id' => $city->id]);
                                     }
                                 }
-                                if ($row['起步费'] && preg_match('/^([0-9]\d*(\.\d*[1-9])?)|(0\.\d*[1-9])$/', $row['起步费']) > 0) {
+                                if ($row['起步费'] && preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $row['起步费']) > 0) {
                                     $waybillPriceModel = array_merge($waybillPriceModel, ['base_fee' => $row['起步费']]);
                                 } else {
                                     $waybillPriceModel = array_merge($waybillPriceModel, ['base_fee' => 0]);
                                     array_push($exception, ['第' . $sum . '行数据起步费为空,或为负,已默认设为0']);
                                 }
-                                if ($row['最低计数'] && preg_match('/^([0-9]\d*(\.\d*[1-9])?)|(0\.\d*[1-9])$/', $row['最低计数']) > 0) {
+                                if ($row['最低计数'] && preg_match('/^[1-9]\d*\,\d*|[1-9]\d*$/', $row['最低计数']) > 0) {
                                     $waybillPriceModel = array_merge($waybillPriceModel, ['initial_weight' => $row['最低计数']]);
                                 } else {
                                     $waybillPriceModel = array_merge($waybillPriceModel, ['initial_weight' => 0]);

+ 28 - 4
app/Package.php

@@ -7,19 +7,43 @@ use Illuminate\Database\Eloquent\Model;
 class Package extends Model
 {
     protected $fillable=[
-        'logistic_number','type','weight','length','width','height','owner_id','paper_box_id',
-        'measuring_machine_id','recipient','status'
+        'owner_id','logistic_number','delivery_number','batch_number','batch_rule','recipient','recipient_mobile','logistics_id',
+        'measuring_machine_id','weight','length','width','height','bulk','paper_box_id','status'
+    ];
+    protected $appends=[
+        'owner_name',
+        'logistic_name',
+        'measuringMachine_name',
+        'paperBox_name'
     ];
 
     public function owner(){
         return $this->belongsTo('App\Owner','owner_id','id');
     }
 
+    public function logistic(){
+        return $this->belongsTo('App\Logistic','logistic_id','id');
+    }
+
+    public function measuringMachine(){
+        return $this->belongsTo('App\MeasuringMachine','measuring_machine_id','id');
+    }
+
     public function paperBox(){
         return $this->belongsTo('App\paperBox','paper_box_id','id');
     }
 
-    public function measuringMachine(){
-        return $this->belongsTo('App\measuringMachine','measuring_machine_id','id');
+    public function getOwnerNameAttribute()
+    {
+        return $this['owner']? $this['owner']['name']:null;
+    }
+    public function getLogisticNameAttribute(){
+        return $this['logistic']? $this['logistic']['name']:null;
+    }
+    public function getMeasuringMachineNameAttribute(){
+        return $this['measuringMachine']? $this['measuringMachine']['name']:null;
+    }
+    public function getPaperBoxNameAttribute(){
+        return $this['paperBox']? $this['paperBox']['model']:null;
     }
 }

+ 6 - 1
app/User.php

@@ -10,7 +10,7 @@ use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Gate;
-use Illuminate\Support\Facades\Hash;
+use Illuminate\Database\Eloquent\SoftDeletes;
 
 class User extends Authenticatable
 {
@@ -72,6 +72,11 @@ class User extends Authenticatable
     function roles(){
         return $this->belongsToMany('App\Role','user_role','id_user','id_role');
     }
+
+    function carriers(){
+        return $this->belongsToMany('App\Carrier','carrier_user','user_id','carrier_id');
+    }
+
     function authorities(){
         $authorities = new Collection([]);
         $this->roles()->each(function ($role)use(&$authorities){

+ 1 - 1
app/WaybillPriceModel.php

@@ -12,7 +12,7 @@ class WaybillPriceModel extends Model
     ];
 
     protected $appends=[
-        'carrier_name',
+        'logistic_name',
         'province_name',
         'city_name',
         'unit_name',

+ 245 - 35
composer.lock

@@ -4538,7 +4538,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/18208d64897ab732f6c04a19b319fe8f1d57a9c0",
                 "reference": "18208d64897ab732f6c04a19b319fe8f1d57a9c0",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "illuminate/routing": "^5.5|^6",
@@ -4606,7 +4612,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/beyondcode/laravel-dump-server/zipball/fcc88fa66895f8c1ff83f6145a5eff5fa2a0739a",
                 "reference": "fcc88fa66895f8c1ff83f6145a5eff5fa2a0739a",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "illuminate/console": "5.6.*|5.7.*|5.8.*|^6.0",
@@ -4667,7 +4679,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a",
                 "reference": "a2c590166b2133a4633738648b6b064edae0814a",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.1"
@@ -4723,7 +4741,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/filp/whoops/zipball/cde50e6720a39fdacb240159d3eea6865d51fd96",
                 "reference": "cde50e6720a39fdacb240159d3eea6865d51fd96",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^5.5.9 || ^7.0",
@@ -4784,7 +4808,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/f72816b43e74063c8b10357394b6bba8cb1c10de",
                 "reference": "f72816b43e74063c8b10357394b6bba8cb1c10de",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^5.3.3 || ^7.0"
@@ -4834,7 +4864,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/776503d3a8e85d4f9a1148614f95b7a608b046ad",
                 "reference": "776503d3a8e85d4f9a1148614f95b7a608b046ad",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^5.3|^7.0"
@@ -4882,7 +4918,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/6c4277f6117e4864966c9cb58fb835cee8c74a1e",
                 "reference": "6c4277f6117e4864966c9cb58fb835cee8c74a1e",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": ">=5.6",
@@ -4943,7 +4985,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/mockery/mockery/zipball/b3453f75fd23d9fd41685f2148f4abeacabc6405",
                 "reference": "b3453f75fd23d9fd41685f2148f4abeacabc6405",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "hamcrest/hamcrest-php": "~2.0",
@@ -5008,7 +5056,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea",
                 "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.1"
@@ -5056,7 +5110,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/nunomaduro/collision/zipball/af42d339fe2742295a54f6fdd42aaa6f8c4aca68",
                 "reference": "af42d339fe2742295a54f6fdd42aaa6f8c4aca68",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "filp/whoops": "^2.1.4",
@@ -5120,7 +5180,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4",
                 "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "ext-dom": "*",
@@ -5175,7 +5241,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6",
                 "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^5.6 || ^7.0"
@@ -5222,7 +5294,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a",
                 "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": ">=7.1"
@@ -5274,7 +5352,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e",
                 "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.0",
@@ -5325,7 +5409,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
                 "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.1",
@@ -5372,7 +5462,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203",
                 "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "doctrine/instantiator": "^1.0.2",
@@ -5435,7 +5531,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d",
                 "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "ext-dom": "*",
@@ -5498,7 +5600,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946",
                 "reference": "050bedf145a257b1ff02746c31894800e5122946",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.1"
@@ -5548,7 +5656,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
                 "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": ">=5.3.3"
@@ -5589,7 +5703,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e",
                 "reference": "1038454804406b0b5f5f520358e78c1c2f71501e",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.1"
@@ -5638,7 +5758,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff",
                 "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "ext-tokenizer": "*",
@@ -5687,7 +5813,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/316afa6888d2562e04aeb67ea7f2017a0eb41661",
                 "reference": "316afa6888d2562e04aeb67ea7f2017a0eb41661",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "doctrine/instantiator": "^1.1",
@@ -5771,7 +5903,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
                 "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^5.6 || ^7.0"
@@ -5816,7 +5954,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da",
                 "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.1",
@@ -5880,7 +6024,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29",
                 "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.1"
@@ -5936,7 +6086,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404",
                 "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.1"
@@ -5989,7 +6145,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e",
                 "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.0",
@@ -6056,7 +6218,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4",
                 "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.0"
@@ -6107,7 +6275,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5",
                 "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.0",
@@ -6154,7 +6328,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be",
                 "reference": "773f97c67f28de00d397be301821b06708fca0be",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.0"
@@ -6199,7 +6379,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8",
                 "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.0"
@@ -6252,7 +6438,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9",
                 "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^7.1"
@@ -6294,7 +6486,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019",
                 "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": ">=5.6"
@@ -6337,7 +6535,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9",
                 "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "ext-dom": "*",
@@ -6377,7 +6581,13 @@
                 "type": "zip",
                 "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4",
                 "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4",
-                "shasum": ""
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
             },
             "require": {
                 "php": "^5.3.3 || ^7.0",

+ 1 - 1
config/broadcasting.php

@@ -15,7 +15,7 @@ return [
     |
     */
 
-    'default' => env('BROADCAST_DRIVER', 'pusher'),
+    'default' => env('BROADCAST_DRIVER', 'redis'),
 
     /*
     |--------------------------------------------------------------------------

+ 1 - 1
database/migrations/2019_11_22_094024_create_waybills_table.php

@@ -29,7 +29,7 @@ class CreateWaybillsTable extends Migration
             $table->decimal('collect_fee')->nullable()->comment('到付金额');
             $table->text('ordering_remark')->nullable()->comment('下单备注');
             $table->bigInteger('carrier_id')->nullable()->index()->comment('承运商');
-            $table->string('carrier_bill')->nullable()->comment('承运商单号');
+            $table->string('carrier_bill')->nullable()->unique()->comment('承运商单号');
             $table->bigInteger('origination_city_id')->nullable()->index()->comment('始发市');
             $table->bigInteger('destination_city_id')->nullable()->index()->comment('目的市');
             $table->decimal('warehouse_weight')->nullable()->comment('仓库计重(抛)');

+ 33 - 0
database/migrations/2020_01_08_103927_create_carrier_user_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateCarrierUserTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('carrier_user', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('carrier_id')->comment('承运商表');
+            $table->bigInteger('user_id')->comment('用户表');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('carrier_user');
+    }
+}

+ 32 - 0
database/migrations/2020_01_08_152729_change_user_filed.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class ChangeUserFiled extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('users', function (Blueprint $table) {
+            $table->softDeletes();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('users', function (Blueprint $table) {
+            $table->dropColumn('deleted_at');
+        });
+    }
+}

+ 31 - 0
database/migrations/2020_02_09_080123_add_weigh_excepted_authority.php

@@ -0,0 +1,31 @@
+<?php
+
+use App\Authority;
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddWeighExceptedAuthority extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        (new Authority(['name'=>'包裹信息-查看异常','alias_name'=>'包裹信息-查看异常']))->save();
+        (new Authority(['name'=>'包裹信息-录入','alias_name'=>'包裹信息-查看异常']))->save();
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Authority::where('name','包裹信息-查看异常')->delete();
+        Authority::where('name','包裹信息-录入')->delete();
+    }
+}

+ 48 - 0
database/migrations/2020_02_10_103905_change_package_column.php

@@ -0,0 +1,48 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class ChangePackageColumn extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::dropIfExists('packages');
+        Schema::create('packages', function (Blueprint $table) {
+            $table->bigIncrements('id');
+            $table->bigInteger('owner_id')->nullable()->index()->comment('外键货主');
+            $table->string('logistic_number')->unique()->comment('快递单号');
+            $table->string('delivery_number')->nullable()->unique()->comment('发货单号');
+            $table->string('batch_number')->nullable()->comment('波次号');
+            $table->string('batch_rule')->nullable()->comment('波次规则');
+            $table->string('recipient')->nullable()->comment('收件人');
+            $table->string('recipient_mobile')->nullable()->comment('收件人电话');
+            $table->bigInteger('logistics_id')->nullable()->index()->comment('外键物流公司');
+            $table->bigInteger('measuring_machine_id')->nullable()->index()->comment('外键设备');
+            $table->decimal('weight')->nullable()->comment('重KG');
+            $table->decimal('length')->nullable()->index()->comment('长(cm)');
+            $table->decimal('width')->nullable()->index()->comment('宽(cm)');
+            $table->decimal('height')->nullable()->index()->comment('高(cm)');
+            $table->decimal('bulk')->nullable()->comment('体积(cm³)');
+            $table->bigInteger('paper_box_id')->nullable()->index()->comment('外键纸箱');
+            $table->enum('status',['无','未上传','已上传','未测量','已测量','上传异常','下发异常'])->default('无')->comment('包裹信息状态');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('packages');
+    }
+}

+ 1 - 1
laravel-echo-server.lock

@@ -1,3 +1,3 @@
 {
-	"process": 13592
+	"process": 8288
 }

+ 29 - 29
package-lock.json

@@ -1322,8 +1322,8 @@
         },
         "arraybuffer.slice": {
             "version": "0.0.7",
-            "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz",
-            "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog=="
+            "resolved": "https://registry.npm.taobao.org/arraybuffer.slice/download/arraybuffer.slice-0.0.7.tgz",
+            "integrity": "sha1-O7xCdd1YTMGxCAm4nU6LY6aednU="
         },
         "arrify": {
             "version": "1.0.1",
@@ -1398,8 +1398,8 @@
         },
         "async-limiter": {
             "version": "1.0.1",
-            "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz",
-            "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ=="
+            "resolved": "https://registry.npm.taobao.org/async-limiter/download/async-limiter-1.0.1.tgz?cache=0&sync_timestamp=1574272018408&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fasync-limiter%2Fdownload%2Fasync-limiter-1.0.1.tgz",
+            "integrity": "sha1-3TeelPDbgxCwgpH51kwyCXZmF/0="
         },
         "atob": {
             "version": "2.1.2",
@@ -1613,8 +1613,8 @@
         },
         "blob": {
             "version": "0.0.5",
-            "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz",
-            "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig=="
+            "resolved": "https://registry.npm.taobao.org/blob/download/blob-0.0.5.tgz",
+            "integrity": "sha1-1oDu7yX4zZGtUz9bAe7UjmTK9oM="
         },
         "bluebird": {
             "version": "3.5.5",
@@ -3115,8 +3115,8 @@
         },
         "engine.io-client": {
             "version": "3.4.0",
-            "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.0.tgz",
-            "integrity": "sha512-a4J5QO2k99CM2a0b12IznnyQndoEvtA4UAldhGzKqnHf42I3Qs2W5SPnDvatZRcMaNZs4IevVicBPayxYt6FwA==",
+            "resolved": "https://registry.npm.taobao.org/engine.io-client/download/engine.io-client-3.4.0.tgz",
+            "integrity": "sha1-gqZCtChiqbP3oYj0F3ay3qtkNwA=",
             "requires": {
                 "component-emitter": "1.2.1",
                 "component-inherit": "0.0.3",
@@ -3138,23 +3138,23 @@
                 },
                 "debug": {
                     "version": "4.1.1",
-                    "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
-                    "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
+                    "resolved": "https://registry.npm.taobao.org/debug/download/debug-4.1.1.tgz",
+                    "integrity": "sha1-O3ImAlUQnGtYnO4FDx1RYTlmR5E=",
                     "requires": {
                         "ms": "^2.1.1"
                     }
                 },
                 "ms": {
                     "version": "2.1.2",
-                    "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
-                    "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
+                    "resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz",
+                    "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk="
                 }
             }
         },
         "engine.io-parser": {
             "version": "2.2.0",
-            "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.0.tgz",
-            "integrity": "sha512-6I3qD9iUxotsC5HEMuuGsKA0cXerGz+4uGcXQEkfBidgKf0amsjrrtwcbwK/nzpZBxclXlV7gGl9dgWvu4LF6w==",
+            "resolved": "https://registry.npm.taobao.org/engine.io-parser/download/engine.io-parser-2.2.0.tgz",
+            "integrity": "sha1-MSxIlPV9UqArQgho2ntcHISvgO0=",
             "requires": {
                 "after": "0.8.2",
                 "arraybuffer.slice": "~0.0.7",
@@ -4577,8 +4577,8 @@
         },
         "has-binary2": {
             "version": "1.0.3",
-            "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz",
-            "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==",
+            "resolved": "https://registry.npm.taobao.org/has-binary2/download/has-binary2-1.0.3.tgz",
+            "integrity": "sha1-d3asYn8+p3JQz8My2rfd9eT10R0=",
             "requires": {
                 "isarray": "2.0.1"
             },
@@ -5448,9 +5448,9 @@
             "dev": true
         },
         "laravel-echo": {
-            "version": "1.6.0",
-            "resolved": "https://registry.npmjs.org/laravel-echo/-/laravel-echo-1.6.0.tgz",
-            "integrity": "sha512-LYteXGJHMCrUuRV0BW0v7XX4Oxk4sfxKhh4OV14u4dSW+VJ5z285C6DKOTHuAg0u7Vysh/Qqs095zZDLxHw/nw=="
+            "version": "1.6.1",
+            "resolved": "https://registry.npm.taobao.org/laravel-echo/download/laravel-echo-1.6.1.tgz",
+            "integrity": "sha1-c2Ckh4L2BqzQ5s9v1CmQW1lgauY="
         },
         "laravel-mix": {
             "version": "4.1.2",
@@ -8334,8 +8334,8 @@
         },
         "socket.io-client": {
             "version": "2.3.0",
-            "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.3.0.tgz",
-            "integrity": "sha512-cEQQf24gET3rfhxZ2jJ5xzAOo/xhZwK+mOqtGRg5IowZsMgwvHwnf/mCRapAAkadhM26y+iydgwsXGObBB5ZdA==",
+            "resolved": "https://registry.npm.taobao.org/socket.io-client/download/socket.io-client-2.3.0.tgz",
+            "integrity": "sha1-FNW6LgC5vNFFrkQ6uWs/hsvMG7Q=",
             "requires": {
                 "backo2": "1.0.2",
                 "base64-arraybuffer": "0.1.5",
@@ -8360,23 +8360,23 @@
                 },
                 "debug": {
                     "version": "4.1.1",
-                    "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
-                    "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
+                    "resolved": "https://registry.npm.taobao.org/debug/download/debug-4.1.1.tgz",
+                    "integrity": "sha1-O3ImAlUQnGtYnO4FDx1RYTlmR5E=",
                     "requires": {
                         "ms": "^2.1.1"
                     }
                 },
                 "ms": {
                     "version": "2.1.2",
-                    "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
-                    "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
+                    "resolved": "https://registry.npm.taobao.org/ms/download/ms-2.1.2.tgz",
+                    "integrity": "sha1-0J0fNXtEP0kzgqjrPM0YOHKuYAk="
                 }
             }
         },
         "socket.io-parser": {
             "version": "3.3.0",
-            "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.0.tgz",
-            "integrity": "sha512-hczmV6bDgdaEbVqhAeVMM/jfUfzuEZHsQg6eOmLgJht6G3mPKMxYm75w2+qhAQZ+4X+1+ATZ+QFKeOZD5riHng==",
+            "resolved": "https://registry.npm.taobao.org/socket.io-parser/download/socket.io-parser-3.3.0.tgz",
+            "integrity": "sha1-K1KpalCf3zFEC6QP7WCUx9TxJi8=",
             "requires": {
                 "component-emitter": "1.2.1",
                 "debug": "~3.1.0",
@@ -9742,8 +9742,8 @@
         },
         "ws": {
             "version": "6.1.4",
-            "resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz",
-            "integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==",
+            "resolved": "https://registry.npm.taobao.org/ws/download/ws-6.1.4.tgz?cache=0&sync_timestamp=1576314828024&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fws%2Fdownload%2Fws-6.1.4.tgz",
+            "integrity": "sha1-W1yIAK+rkl6UzLKdFTyNAsF3bvk=",
             "requires": {
                 "async-limiter": "~1.0.0"
             }

+ 1 - 1
package.json

@@ -26,7 +26,7 @@
   "dependencies": {
     "font-awesome": "^4.7.0",
     "js-cookie": "^2.2.0",
-    "laravel-echo": "^1.6.0",
+    "laravel-echo": "^1.6.1",
     "pusher-js": "^5.0.2",
     "socket.io-client": "^2.3.0"
   },

BIN
public/audio.mp3


+ 0 - 0
public/icon/off.png → public/images/measuringMachine/off.png


+ 0 - 0
public/icon/on.png → public/images/measuringMachine/on.png


+ 6 - 0
public/js/singles/rejectedIndex.js

@@ -272,6 +272,12 @@ var vueList = new Vue({
         this.filterRun();
       }
     },
+    logistic_numberEntering: function logistic_numberEntering(e) {
+      if (e.key === 'Enter') {
+        this.filterParams.logistic_number = e.target.value;
+        this.filterRun();
+      }
+    },
     cancelCheckConfirmAll: function cancelCheckConfirmAll() {
       $('#checkConfirmingAll').tooltip('hide');
       setTimeout(function () {

+ 5 - 2
public/mix-manifest.json

@@ -1,6 +1,9 @@
 {
     "/js/app.js": "/js/app.js",
     "/css/app.css": "/css/app.css",
-    "/js/singles/rejectedIndex.js": "/js/singles/rejectedIndex.js",
-    "/favicon.ico": "/favicon.ico"
+    "/favicon.ico": "/favicon.ico",
+    "/off.png": "/off.png",
+    "/on.png": "/on.png",
+    "/audio.mp3": "/audio.mp3"
+    "/js/singles/rejectedIndex200212.js": "/js/singles/rejectedIndex200212.js",
 }

BIN
public/off.png


BIN
public/on.png


BIN
public/sound/ding.mp3


BIN
public/sound/warning_otherBarcode.mp3


BIN
resources/audio.mp3


+ 1 - 1
resources/js/bootstrap.js

@@ -51,7 +51,7 @@ window.initEcho=function(){
     window.Echo = new Echo({
         broadcaster: 'socket.io',
         host: window.location.hostname + ':6001',
-        // broadcaster: 'pusher',
+        //broadcaster: 'pusher',
         // key: process.env.MIX_PUSHER_APP_KEY,
         // key: 'bo20alg-1',
         // authEndpoint: '/custom/endpoint/auth',

+ 2 - 2
resources/views/layouts/menu.blade.php

@@ -8,8 +8,8 @@
             <li class="nav-item"><a href="{{url("waybill/index")}}" class="nav-link"
                                     :class="{active:isActive('waybill',1)}">运输管理</a></li> @endcan
         @can('称重管理')
-            <li class="nav-item"><a href="{{url("weigh")}}" class="nav-link"
-                                    :class="{active:isActive('weigh',1)}">称重管理</a></li> @endcan
+            <li class="nav-item"><a href="{{url("weight/package")}}" class="nav-link"
+                                    :class="{active:isActive('weight',1)}">称重管理</a></li> @endcan
         @can('基础设置')
         <li class="nav-item"><a href="{{url("maintenance/")}}" class="nav-link"
                                 :class="{active:isActive('maintenance',1)}">基础设置</a></li> @endcan

+ 1 - 1
resources/views/maintenance/paperBox/create.blade.php

@@ -77,7 +77,7 @@
                             </div>
                         </div>
                         <div class="col-5">
-                            <div style="max-height: 130px;overflow-y: scroll;border: solid 1px #ddd;border-radius:5px;text-align: center;" v-if="owners.length>0">
+                            <div style="max-height: 130px;overflow-y: scroll;border: solid 1px #ddd;border-radius:5px;text-align: center;" v-if="selectedOwners.length>0">
                                 <ul class="list-group">
                                     <li v-for="selectedOwner in selectedOwners" title="双击删除货主"  @dblclick="owner(selectedOwner)" style="list-style: none">
                                         <a>@{{ selectedOwner.name }}</a>

+ 1 - 1
resources/views/maintenance/paperBox/edit.blade.php

@@ -82,7 +82,7 @@
                             </div>
                         </div>
                         <div class="col-5">
-                            <div style="max-height: 130px;overflow-y: scroll;border: solid 1px #ddd;border-radius:5px;text-align: center;" v-if="owners.length>0">
+                            <div style="max-height: 130px;overflow-y: scroll;border: solid 1px #ddd;border-radius:5px;text-align: center;" v-if="selectedOwners.length>0">
                                 <ul class="list-group ">
                                     <li v-for="selectedOwner in selectedOwners" class="tooltipTarget" @dblclick="owner(selectedOwner)" title="双击删除货主"  style="list-style: none">
                                         <a>@{{ selectedOwner.name }}</a>

+ 57 - 0
resources/views/maintenance/paperBox/import.blade.php

@@ -0,0 +1,57 @@
+@extends('layouts.app')
+
+@section('content')
+    <div id="nav2">
+        @component('maintenance.menu')@endcomponent
+        @component('maintenance.paperBox.menu')@endcomponent
+    </div>
+    <div class="container mt-3">
+        <div class="card col-md-8 offset-md-2">
+            <div class="card-body">
+                <form method="POST" action="{{ url('maintenance/paperBox/excel/import') }}" enctype="multipart/form-data" target="_blank">
+                    @csrf
+                    <div class="form-group row text-center">
+                        <div class="col-12 text-danger">
+
+                            注意:请保证表第一行有以下对应的字段名<br>(可不按顺序):<br>
+                            货主,纸箱名称,长,宽,高<br>
+                        </div>
+                        <div class="col-12 text-info ">
+                            导入时间随文件大小可能达数十分钟以上,请耐心等候
+                            <hr>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="sku" class="col-2 col-form-label text-right">选择EXCEL</label>
+                        <div class="col-8">
+                            <div class="form-control">
+                                <input type="file" class="form-control-file @error('file') is-invalid @enderror"
+                                       name="file" value="{{ old('file') }}" required>
+                                @error('file')
+                                <span class="invalid-feedback" role="alert">
+                                <strong>{{ $message }}</strong>
+                            </span>
+                                @enderror
+                            </div>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="sku" class="col-2 col-form-label text-right">是否覆盖</label>
+                        <div class="col-8">
+                            <select name="isOverride" id="isOverride" class="form-control" >
+                                <option value="0">仅新增</option>
+                                <option value="1">新增且覆盖</option>
+                            </select>
+                            <p class="text-muted">覆盖会以货主,纸箱名称为依据,覆盖其余字段</p>
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <div class="col-8 offset-2">
+                            <input type="submit" class="btn btn-success form-control" value="执行导入">
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+@endsection

+ 5 - 1
resources/views/maintenance/paperBox/menu.blade.php

@@ -9,7 +9,11 @@
             @can('纸箱-录入')
                 <li class="nav-item">
                     <a class="nav-link" href="{{url('maintenance/paperBox/create')}}" :class="{active:isActive('create',3)}">录入</a>
-                </li> @endcan
+                </li>
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('maintenance/paperBox/excel/goImport')}}" :class="{active:isActive('goImport',4)}">导入</a>
+                </li>
+            @endcan
             {{$slot}}
         </ul>
     </div>

+ 119 - 67
resources/views/maintenance/user/create.blade.php

@@ -5,107 +5,130 @@
         @component('maintenance.menu')@endcomponent
         @component('maintenance.user.menu')@endcomponent
     </div>
-    <div class="container-fluid mt-3" id="editPanel">
-        <div class="card">
+    <div class="container mt-3" id="editPanel">
+        <div class="row justify-content-center">
             @if(Session::has('successTip'))
                 <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
             @endif
-            <div class="row">
-                <div class="col">
-                    <div class="card">
-                        <div class="card-header">录入用户</div>
+            <div class="col-md-8">
+                <div class="card">
+                    <div class="card-header">录入用户</div>
 
-                        <div class="card-body">
-                            <form method="POST" action="{{ route('register') }}">
-                                @csrf
+                    <div class="card-body">
+                        <form method="POST" action="{{ route('register') }}">
+                            @csrf
 
-                                <div class="form-group row">
-                                    <label for="name" class="col-md-3 col-form-label text-md-right">姓名</label>
+                            <div class="form-group row">
+                                <label for="name" class="col-md-3 col-form-label text-md-right">姓名</label>
 
-                                    <div class="col-md-7">
-                                        <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
+                                <div class="col-md-7">
+                                    <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
 
-                                        @error('name')
-                                        <span class="invalid-feedback" role="alert">
+                                    @error('name')
+                                    <span class="invalid-feedback" role="alert">
                                         <strong>{{ $message }}</strong>
                                     </span>
-                                        @enderror
-                                    </div>
+                                    @enderror
                                 </div>
+                            </div>
 
-                                <div class="form-group row">
-                                    <label for="email" class="col-md-3 col-form-label text-md-right">Email地址</label>
+                            <div class="form-group row">
+                                <label for="email" class="col-md-3 col-form-label text-md-right">Email地址</label>
 
-                                    <div class="col-md-7">
-                                        <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
+                                <div class="col-md-7">
+                                    <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
 
-                                        @error('email')
-                                        <span class="invalid-feedback" role="alert">
+                                    @error('email')
+                                    <span class="invalid-feedback" role="alert">
                                         <strong>{{ $message }}</strong>
                                     </span>
-                                        @enderror
-                                    </div>
+                                    @enderror
                                 </div>
+                            </div>
 
-                                <div class="form-group row">
-                                    <label for="password" class="col-md-3 col-form-label text-md-right">密码</label>
+                            <div class="form-group row">
+                                <label for="password" class="col-md-3 col-form-label text-md-right">密码</label>
 
-                                    <div class="col-md-7">
-                                        <input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
+                                <div class="col-md-7">
+                                    <input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
 
-                                        @error('password')
-                                        <span class="invalid-feedback" role="alert">
+                                    @error('password')
+                                    <span class="invalid-feedback" role="alert">
                                         <strong>{{ $message }}</strong>
                                     </span>
-                                        @enderror
-                                    </div>
+                                    @enderror
                                 </div>
+                            </div>
 
-                                <div class="form-group row">
-                                    <label for="password-confirm" class="col-md-3 col-form-label text-md-right">重输密码</label>
+                            <div class="form-group row">
+                                <label for="password-confirm" class="col-md-3 col-form-label text-md-right">重输密码</label>
 
-                                    <div class="col-md-7">
-                                        <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
-                                    </div>
+                                <div class="col-md-7">
+                                    <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
                                 </div>
+                            </div>
 
-                                <div class="form-group row">
-                                    <label for="role" class="col-md-3 col-form-label text-md-right">角色</label>
+                            <div class="form-group row">
+                                <label for="role" class="col-md-3 col-form-label text-md-right">角色</label>
 
-                                    <div class="col-md-7">
-                                        <input name="role" type="hidden" v-model="rolesStr" required>
-                                        <div class="input-group">
-                                            <select id="roleAddingItem" class="form-control">
-                                                <option :value="role.id" v-for="role in rolesAll">@{{ role.name }}</option>
-                                            </select>
-                                            <span class="input-group-append">
+                                <div class="col-md-7">
+                                    <input name="role" type="hidden" v-model="rolesStr" required>
+                                    <div class="input-group">
+                                        <select id="roleAddingItem" class="form-control">
+                                            <option :value="role.id" v-for="role in rolesAll">@{{ role.name }}</option>
+                                        </select>
+                                        <span class="input-group-append">
                                             <span class="input-group-text btn-outline-info" style="cursor: pointer;" @click="addRole">
                                                 添加左边的角色
                                             </span>
                                         </span>
-                                        </div>
-                                        <select size="8" class="form-control @error('role') is-invalid @enderror "
-                                                :class="rolesStr?'tooltipTarget':''" title="两次点击移除目标">
-                                            <option :value="role.id" v-for="role in roles" @click="clickingRoleOption">@{{ role.name }}</option>
-                                        </select>
-                                        @error('role')
-                                        <span class="invalid-feedback" role="alert">
+                                    </div>
+                                    <select size="8" class="form-control @error('role') is-invalid @enderror "
+                                            :class="rolesStr?'tooltipTarget':''" title="两次点击移除目标">
+                                        <option :value="role.id" v-for="role in roles" @click="clickingRoleOption">@{{ role.name }}</option>
+                                    </select>
+                                    @error('role')
+                                    <span class="invalid-feedback" role="alert">
                                         <strong>{{ $message }}</strong>
                                     </span>
-                                        @enderror
-                                    </div>
+                                    @enderror
                                 </div>
-
-                                <input type="hidden" name="headTo" value="{{url('maintenance/user/create')}}">
-                                <div class="form-group row mb-0">
-                                    <div class="col-md-7 offset-md-3">
-                                        <button type="submit" class="btn btn-primary form-control">
-                                            录入
-                                        </button>
+                            </div>
+                            <div class="form-group row">
+                                <label for="role" class="col-md-3 col-form-label text-md-right">承运商</label>
+
+                                <div class="col-md-7">
+                                    <div class="input-group">
+                                        <select id="carrierAddingItem" class="form-control">
+                                            <option :value="carrier.id" v-for="carrier in carrierAll">@{{ carrier.name }}</option>
+                                        </select>
+                                        <span class="input-group-append">
+                                            <span class="input-group-text btn-outline-info" style="cursor: pointer;" @click="addCarrier">
+                                                添加左边的承运商
+                                            </span>
+                                        </span>
+                                    </div>
+                                    <select size="8" class="form-control "
+                                            title="两次点击移除目标">
+                                        <option :value="carrier.id" v-for="carrier in carriers" @dblclick="clickingCarrierOption">
+                                            @{{ carrier.name }}
+                                        </option>
+                                    </select>
+                                    <div hidden v-for="carrier in carriers">
+                                        <input hidden name="carrier_id[]" :value="carrier.id">
                                     </div>
                                 </div>
-                            </form>
-                        </div>
+                            </div>
+
+                            <input type="hidden" name="headTo" value="{{url('maintenance/user/create')}}">
+                            <div class="form-group row mb-0">
+                                <div class="col-md-7 offset-md-4">
+                                    <button type="submit" class="btn btn-primary">
+                                        录入
+                                    </button>
+                                </div>
+                            </div>
+                        </form>
                     </div>
                 </div>
             </div>
@@ -124,7 +147,13 @@
                     @endforeach
                 ],
                 roles:[],
-                rolesStr:'{{ old('role') }}'
+                rolesStr:'{{ old('role') }}',
+                carrierAll:[
+                    @foreach($carriers as $carrier)
+                    {id:'{{$carrier->id}}',name:'{{$carrier->name}}'},
+                    @endforeach
+                ],
+                carriers:[],
             },
             mounted:function(){
                 $(".tooltipTarget").tooltip({'trigger':'hover'});
@@ -176,7 +205,30 @@
                     setTimeout(function(){
                         $(".tooltipTarget").tooltip({'trigger':'hover'});
                     },20);
-                }
+                },
+                addCarrier:function () {
+                    let $carrierAddingItem = $('#carrierAddingItem');
+                    let val=$carrierAddingItem.val();
+                    let carrierName = $carrierAddingItem.find("option:selected").text();
+                    let isLackOf=this.carriers.every(function(carrier){
+                        return carrier.id !== val;
+                    });
+                    if(isLackOf){
+                        this.carriers.push({id:val,name: carrierName})
+                    }else{
+                        tempTip.setDuration(1500);
+                        tempTip.show('已添加'+carrierName)
+                    }
+                },
+                clickingCarrierOption:function(e){
+                    let target = $(e.target);
+                    for (let i=0;i<this.carriers.length;i++){
+                        if(this.carriers[i].id===target.val()){
+                            this.carriers.splice(i,1);
+                            break;
+                        }
+                    }
+                },
             },
         });
 

+ 60 - 2
resources/views/maintenance/user/edit.blade.php

@@ -69,6 +69,31 @@
                             @enderror
                         </div>
                     </div>
+                    <div class="form-group row">
+                        <label for="role" class="col-2 col-form-label text-md-right">承运商</label>
+
+                        <div class="col-md-8">
+                            <div class="input-group">
+                                <select id="carrierAddingItem" class="form-control">
+                                    <option :value="carrier.id" v-for="carrier in carrierAll">@{{ carrier.name }}</option>
+                                </select>
+                                <span class="input-group-append">
+                                            <span class="input-group-text btn-outline-info" style="cursor: pointer;" @click="addCarrier">
+                                                添加左边的承运商
+                                            </span>
+                                        </span>
+                            </div>
+                            <select size="8" class="form-control "
+                                    title="两次点击移除目标">
+                                <option :value="carrier.id" v-for="carrier in carriers" @dblclick="clickingCarrierOption">
+                                    @{{ carrier.name }}
+                                </option>
+                            </select>
+                            <div hidden v-for="carrier in carriers">
+                                <input hidden name="carrier_id[]" :value="carrier.id">
+                            </div>
+                        </div>
+                    </div>
                     <div class="form-group row">
                         <div class="col-8 offset-2">
                             <input type="submit" class="btn btn-outline-dark form-control">
@@ -96,7 +121,17 @@
                     {id:'{{$role->id}}',name:'{{$role->name}}',},
                     @endforeach
                 ],
-                rolesStr:'{{ old('role') }}'
+                rolesStr:'{{ old('role') }}',
+                carrierAll:[
+                        @foreach($carriers as $carrier)
+                    {id:'{{$carrier->id}}',name:'{{$carrier->name}}'},
+                    @endforeach
+                ],
+                carriers:[
+                    @foreach($carrierUser as $carrier)
+                    {id:'{{$carrier->id}}',name:'{{$carrier->name}}'},
+                    @endforeach
+                ],
             },
             mounted:function(){
                 $(".tooltipTarget").tooltip({'trigger':'hover'});
@@ -149,7 +184,30 @@
                     setTimeout(function(){
                         $(".tooltipTarget").tooltip({'trigger':'hover'});
                     },20);
-                }
+                },
+                addCarrier:function () {
+                    let $carrierAddingItem = $('#carrierAddingItem');
+                    let val=$carrierAddingItem.val();
+                    let carrierName = $carrierAddingItem.find("option:selected").text();
+                    let isLackOf=this.carriers.every(function(carrier){
+                        return carrier.id !== val;
+                    });
+                    if(isLackOf){
+                        this.carriers.push({id:val,name: carrierName})
+                    }else{
+                        tempTip.setDuration(1500);
+                        tempTip.show('已添加'+carrierName)
+                    }
+                },
+                clickingCarrierOption:function(e){
+                    let target = $(e.target);
+                    for (let i=0;i<this.carriers.length;i++){
+                        if(this.carriers[i].id===target.val()){
+                            this.carriers.splice(i,1);
+                            break;
+                        }
+                    }
+                },
             },
         });
 

+ 8 - 1
resources/views/maintenance/user/index.blade.php

@@ -16,6 +16,7 @@
                         <th>ID</th>
                         <th>用户名</th>
                         <th>角色</th>
+                        <th>配置承运商</th>
                         <th>邮件地址</th>
                         <th>创建时间</th>
                         <th>操作</th>
@@ -28,6 +29,12 @@
                             <ul v-if="user.roles.length>0" class="list-group">
                                 <li v-for="role in user.roles" style="list-style: none">@{{ role.name }}</li>
                             </ul>
+                        </td>
+                        <td>
+                            <ul v-if="user.carriers.length>0" class="list-group">
+                                <li v-for="carrier in user.carriers" style="list-style: none">@{{ carrier.name }}</li>
+                            </ul>
+                        </td>
                         <td>@{{user.email}}</td>
                         <td class="text-muted">@{{user.created_at}}</td>
                         <td>
@@ -53,7 +60,7 @@
                     @foreach( $users as $user )
                     {id:'{{$user->id}}',name:'{{$user->name}}',email:'{{$user->email}}',
                         isSuperAdmin:'{{$user->isSuperAdmin}}',
-                        roles:{!! $user->roles !!},created_at:'{{$user->created_at}}'},
+                        roles:{!! $user->roles !!},carriers:{!! $user->carriers !!},created_at:'{{$user->created_at}}'},
                     @endforeach
                 ],
             },

+ 1 - 1
resources/views/maintenance/waybillPriceModel/index.blade.php

@@ -89,7 +89,7 @@
             data:{
                 waybillPriceModels:[
                     @foreach( $waybillPriceModels as $waybillPriceModel )
-                        {id:'{{$waybillPriceModel->id}}',carrier:'{{$waybillPriceModel->carrier_name}}',
+                        {id:'{{$waybillPriceModel->id}}',carrier:'{{$waybillPriceModel->logistic_name}}',
                         province:'{{$waybillPriceModel->province_name}}',city:'{{$waybillPriceModel->city_name}}',
                         unit:'{{$waybillPriceModel->unit_name}}',range_min:'{{$waybillPriceModel->range_min}}',range_max:'{{$waybillPriceModel->range_max}}',
                         unit_price:'{{$waybillPriceModel->unit_price}}',base_fee:'{{$waybillPriceModel->base_fee}}',initial_weight:'{{$waybillPriceModel->initial_weight}}',

+ 0 - 6
resources/views/weigh/index.blade.php

@@ -1,6 +0,0 @@
-@extends('layouts.app')
-
-@section('content')
-    @component('weigh.menu')@endcomponent
-@endsection
-

+ 0 - 103
resources/views/weigh/measureMonitor/index.blade.php

@@ -1,103 +0,0 @@
-@extends('layouts.app')
-
-@section('content')
-    @component('weigh.menu')@endcomponent
-    <div class="page-holder w-100 d-flex flex-wrap" id="list">
-        <div class="container-fluid px-xl-5">
-            <section class="py-5">
-                <div class="row">
-                    <div class="col-lg-12 mb-4">
-                        <div class="card">
-                            <div class="card-header">
-                                <div class="form-inline">
-                                <img src="@if($package&&$package->measuringMachine->status=='在线'){{asset('icon/on.png')}}@else{{asset('icon/off.png')}}@endif"/>
-                                <h6 class="text-uppercase mb-0 dropdown-toggle" data-toggle="dropdown">@{{package.measuringMachine}}</h6>
-                                    <div class="dropdown-menu" id="selected">
-                                        <a class="dropdown-item" v-for="measuringMachine in measuringMachines" @click="selectedMachine(measuringMachine.id)">@{{measuringMachine.name}}</a>
-                                    </div>
-                                </div>
-
-                            </div>
-                            <div class="card-body">
-                                <table class="table card-text">
-                                    <tr>
-                                        <th scope="row">快递单号</th>
-                                        <td >@{{package.logistic_number}}</td>
-                                    </tr>
-                                    <tr>
-                                        <th scope="row">类型</th>
-                                        <td>@{{package.type}}</td>
-                                    </tr>
-                                    <tr>
-                                        <th scope="row">重(KG)</th>
-                                        <td>@{{package.weight}}</td>
-                                    </tr>
-                                    <tr>
-                                        <th scope="row">长(CM)</th>
-                                        <td>@{{package.length}}</td>
-                                    </tr>
-                                    <tr>
-                                        <th scope="row">宽(CM)</th>
-                                        <td>@{{package.width}}</td>
-                                    </tr>
-                                    <tr>
-                                        <th scope="row">高(CM)</th>
-                                        <td>@{{package.height}}</td>
-                                    </tr>
-                                    <tr>
-                                        <th scope="row">货主</th>
-                                        <td>@{{package.owner}}</td>
-                                    </tr>
-                                    <tr>
-                                        <th scope="row">纸箱</th>
-                                        <td>@{{package.paperBox}}</td>
-                                    </tr>
-                                    <tr>
-                                        <th scope="row">状态</th>
-                                        <td>@{{package.status}}</td>
-                                    </tr>
-                                    <tr>
-                                        <th scope="row">称重时间</th>
-                                        <td>@{{package.created_at}}</td>
-                                    </tr>
-                                </table>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-            </section>
-        </div>
-    </div>
-@endsection
-
-@section('lastScript')
-    <style>
-        #selected a:hover{background-color: #4aa0e6;display: block;cursor:pointer}
-    </style>
-    <script>
-        let vue=new Vue({
-            el:'#list',
-            data:{
-                package:
-                    {@if($package)id:'{{$package->id}}',logistic_number:'{{$package->logistic_number}}',type:'{{$package->type}}',
-                    weight:'{{$package->weight}}',length:'{{$package->length}}',width:'{{$package->width}}',
-                    height:'{{$package->height}}',owner:'{{$package->owner?$package->owner->name:''}}',paperBox:'{{$package->paperBox?$package->paperBox->model:''}}',
-                    measuringMachine:'{{$package->measuringMachine?$package->measuringMachine->name:''}}',recipient:'{{$package->recipient}}',
-                    status:'{{$package->status}}',created_at:'{{$package->created_at}}'@endif},
-                measuringMachines:[
-                    @foreach($measuringMachines as $measuringMachine)
-                        @if($package&&$measuringMachine->name!=$package->measuringMachine->name)
-                            {id:'{{$measuringMachine->id}}',name:'{{$measuringMachine->name}}',code:'{{$measuringMachine->code}}'},
-                        @endif
-                    @endforeach
-                ]
-            },
-            methods:{
-                selectedMachine(id){
-                    let url='{{url('weigh/measureMonitor')}}';
-                    location.href=url+'?id='+id;
-                },
-            },
-        });
-    </script>
-@endsection

+ 0 - 20
resources/views/weigh/menu.blade.php

@@ -1,20 +0,0 @@
-
-<div class="container-fluid mt-3" id="nav2">
-    <div class="card">
-        <ul class="nav nav-pills">
-            @can('测量机监视界面-查询')
-                <li class="nav-item">
-                    <a class="nav-link" href="{{url('weigh/measureMonitor')}}" :class="{active:isActive('measureMonitor',2)}">测量机监视界面</a>
-                </li> @endcan
-            @can('测量记录管理-查询')
-                <li class="nav-item">
-                    <a class="nav-link" href="{{url('weigh/package')}}" :class="{active:isActive('package',2)}">测量记录管理</a>
-                </li>
-                <li class="nav-item">
-                    <a class="nav-link text-dark" href="{{url('weigh/relating')}}" :class="{active:isActive('relating',2)}">相关设置</a>
-                </li>
-                @endcan
-
-        </ul>
-    </div>
-</div>

+ 0 - 169
resources/views/weigh/package/index.blade.php

@@ -1,169 +0,0 @@
-
-@extends('layouts.app')
-
-@section('content')
-    <span id="nav2">
-        @component('weigh.menu')@endcomponent
-        @component('weigh.package.menu')@endcomponent
-    </span>
-    <div id="list">
-        <div class="container mt-3">
-            <div class="card">
-                <div>
-                    <form  method="GET" action="{{url('weigh/package')}}" style="margin-top: 1%" id="optionSubmit">
-                        <table class="table  table-sm table-bordered table-hover text-nowrap ">
-                            <tr>
-                                <td colspan="4"><div class="col" v-if="isBeingFilterConditions" style="padding:0">
-                                        <a  href="{{url('weigh/package')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
-                                    </div></td>
-                            </tr>
-                            <tr>
-                                <td  style="width:200px;"> <label style="margin-left: 2%" class="form-inline">页显示条数:
-                                    <select name="paginate" v-model="filterData.paginate" class="form-control" @change="setPaginate">
-                                        <option value="50">50行</option>
-                                        <option value="100">100行</option>
-                                        <option value="200">200行</option>
-                                        <option value="500">500行</option>
-                                        <option value="1000">1000行</option>
-                                    </select></label></td>
-                                <td style="width:300px;"> <label class="form-inline" style="margin-left: 2%">快递单号:
-                                        <input type="text" name="logistic_number" class="form-control  " v-model="filterData.logistic_number" style="vertical-align: middle"></label></td>
-                                <td style="width:200px;"> <label class="form-inline" style="margin-left: 2%">波次类型:
-                                    <select name="type" v-model="filterData.type" class="form-control"  @change="setType">
-                                        <option >    </option>
-                                        <option value="普通波次">普通波次</option>
-                                        <option value="活动波次">活动波次</option>
-
-                                    </select></label></td>
-                                <td style="width:200px;"><label class="form-inline" style="margin-left: 2%">状态:
-                                    <select name="status" v-model="filterData.status" class="form-control" @change="setStatus">
-                                        <option>  </option>
-                                        <option value="无">无</option>
-                                        <option value="未上传">未上传</option>
-                                        <option value="已上传">已上传</option>
-                                        <option value="异常">异常</option>
-                                    </select></label></td>
-                                <td style="width:200px;"> <label class="form-inline" style="margin-left: 2%">货主:
-                                        <select name="owner_id" v-model="filterData.owner_id" class="form-control"  @change="setOwner">
-                                            <option >    </option>
-                                            @foreach($owners as $owner)
-                                                <option value="{{$owner->id}}">{{$owner->name}}</option>
-                                            @endforeach
-                                        </select></label><input hidden type="submit" value="kk"></td>
-                                <td></td>
-                            </tr>
-                        </table>
-                    </form>
-                </div>
-            <div class="card-body">
-                <table class="table table-striped table-sm">
-                    <tr>
-                        <th>ID</th>
-                        <th>快递单号</th>
-                        <th>波次类型</th>
-                        <th>当前状态</th>
-                        <th>重(KG)</th>
-                        <th>长(CM)</th>
-                        <th>宽(CM)</th>
-                        <th>高(CM)</th>
-                        <th>货主</th>
-                        <th>纸箱</th>
-                        <th>设备</th>
-                        <th>收件人</th>
-                        <th>称重时间</th>
-                    </tr>
-                    <tr v-for="package in packages">
-                        <td class="text-muted">@{{package.id}}</td>
-                        <td>@{{package.logistic_number}}</td>
-                        <td>@{{package.type}}</td>
-                        <td>@{{package.status}}</td>
-                        <td>@{{package.weight}}</td>
-                        <td>@{{package.length}}</td>
-                        <td>@{{package.width}}</td>
-                        <td>@{{package.height}}</td>
-                        <td>@{{package.owner}}</td>
-                        <td>@{{package.paperBox}}</td>
-                        <td>@{{package.measuringMachine}}</td>
-                        <td>@{{package.recipient}}</td>
-                        <td class="text-muted">@{{package.created_at}}</td>
-                    </tr>
-                </table>
-                {{$packages->links()}}
-            </div>
-        </div>
-    </div>
-    </div>
-@endsection
-
-@section('lastScript')
-    <script>
-        new Vue({
-            el:"#list",
-            data:{
-                packages:[
-                    @foreach($packages as $package)
-                        {id:'{{$package->id}}',logistic_number:'{{$package->logistic_number}}',type:'{{$package->type}}',
-                        weight:'{{$package->weight}}', length:'{{$package->length}}',width:'{{$package->width}}',height:'{{$package->height}}',
-                        owner:'{{$package->owner?$package->owner->name:''}}',paperBox:'{{$package->paperBox?$package->paperBox->name:''}}',
-                        measuringMachine:'{{$package->measuringMachine?$package->measuringMachine->name:''}}',recipient:'{{$package->recipient}}',
-                        status:'{{$package->status}}',created_at:'{{$package->created_at}}'},
-                    @endforeach
-                ],
-                filterData:
-                    {paginate:'50',logistic_number:'',type: '',status: '',owner_id: ''},
-            },
-            mounted:function(){
-                this.initInputs();
-            },
-            computed:{
-                isBeingFilterConditions:function(){
-
-                    for(let key in this.filterData){
-                        if(this.filterData[key]){
-                            if(key==='paginate')continue;
-                            return true
-                        }
-                    }
-                    return false;
-                },
-
-            },
-            methods:{
-                initInputs:function(){
-                    let data=this;
-                    let uriParts =decodeURI(location.href).split("?");
-                    if(uriParts.length>1){
-                        let params = uriParts[1].split('&');
-                        params.forEach(function(paramPair){
-                            let pair=paramPair.split('=');
-                            let key = pair[0], val = pair[1];
-                            $('input[name="'+key+'"]').val(val);
-                            $('select[name="'+key+'"]').val(val);
-                            decodeURI(data.filterData[key]=val);
-                        });
-                    }
-                },
-                setPaginate:function(e){
-                    this.filterData.paginate=e.target.value;
-                    var form = document.getElementById("optionSubmit");
-                    form.submit();
-                },
-                setType:function (e){
-                    this.filterData.type=e.target.value;
-                    var form = document.getElementById("optionSubmit");
-                    form.submit();
-                },
-                setStatus:function (e){
-                    this.filterData.status=e.target.value;
-                    var form = document.getElementById("optionSubmit");
-                    form.submit();
-                },
-                setOwner:function (e){
-                    this.filterData.owner_id=e.target.value;
-                    var form = document.getElementById("optionSubmit");
-                    form.submit();
-                },
-            }
-        });
-    </script>
-@endsection

+ 165 - 0
resources/views/weight/measureMonitor/index.blade.php

@@ -0,0 +1,165 @@
+@extends('layouts.app')
+
+@section('content')
+    @component('weight.menu')@endcomponent
+    <div class="page-holder w-100 d-flex flex-wrap" id="list">
+        <div class="container-fluid px-xl-5">
+            <section class="py-5">
+                <div class="row">
+                    <div class="col-lg-12 mb-4">
+                        <audio id="audio" src="" autoplay></audio>
+                        <div class="card">
+                            <div class="card-header">
+                            <div class="form-inline">
+                                <h5>
+                                <ul class="nav nav-pills">
+                                        <li v-for="measuringMachine in measuringMachines" @click="clickMeasuringMachine(measuringMachine.id)" :class="[measuringMachine.name==package.measuringMachine ?  selectedMachine : otherMachine] " style="padding: 10px">
+                                            <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>
+                                </ul>
+                                </h5>
+                            </div>
+                            <div class="card-body" v-if="package.id">
+                                <h1>
+
+                                <table class="table card-text dashboard" :class="[package.measuringMachine_status=='在线'?'on':'off']" style="height: 800px">
+                                    <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>
+                                        <td>@{{package.weight}}</td>
+                                    </tr>
+                                    <tr>
+                                        <th class="tag" scope="row" scope="row">发货单号</th>
+                                        <td style="border-right:thick double #aaaaaa;">@{{package.delivery_number}}</td>
+                                        <th class="tag" scope="row" scope="row">收件人</th>
+                                        <td>@{{package.recipient}}</td>
+                                    </tr>
+                                    <tr>
+                                        <th class="tag" scope="row" scope="row">承运商</th>
+                                        <td style="border-right:thick double #aaaaaa;">@{{package.logistic}}</td>
+                                        <th class="tag" scope="row" scope="row">快递单号</th>
+                                        <td>@{{package.logistic_number}}</td>
+                                    </tr>
+                                    <tr>
+                                        <th class="tag" scope="row" scope="row">纸箱名称</th>
+                                        <td style="border-right:thick double #aaaaaa;">@{{package.paperBox}}</td>
+                                        <th class="tag" scope="row" scope="row">体积(CM³)</th>
+                                        <td>@{{package.bulk}}</td>
+                                    </tr>
+                                    <tr>
+                                        <th  class="tag" scope="row" scope="row">状态</th>
+                                        <td style="border-right:thick double #aaaaaa;">@{{package.status}}</td>
+                                        <th  class="tag" scope="row" scope="row">操作时间</th>
+                                        <td>@{{package.created_at}}</td>
+                                    </tr>
+                                </table>
+                                </h1>
+                            </div>
+                        </div>
+                    </div>
+                    </div>
+                </div>
+            </section>
+        </div>
+    </div>
+@endsection
+@section('lastScript')
+    <style>
+        #selected a:hover{background-color: #4aa0e6;display: block;cursor:pointer}
+        .dashboard.off .tag {color:red;}
+        .dashboard.on .tag {color:green;}
+    </style>
+    <script>
+        let vue=new Vue({
+            el:'#list',
+            data:{
+                package:
+                    {id:'',logistic_number:'',delivery_number:'',
+                    weight:'',owner:'',paperBox:'',
+                    measuringMachine:'',recipient:'',measuringMachine_status:'',
+                    status:'',created_at:'',bulk:'',logistic:''},
+                measuringMachines:[
+                    @foreach($measuringMachines as $measuringMachine)
+                    {id:'{{$measuringMachine->id}}',name:'{{$measuringMachine->name}}',code:'{{$measuringMachine->code}}',status:'{{$measuringMachine->status}}'},
+                    @endforeach
+                ],
+                on:'fa fa-circle text-danger',
+                off:'fa fa-circle text-success',
+                selectedMachine:'nav-item btn btn-primary',
+                otherMachine:'nav-item',
+                onColor:{color:'green'},
+                offColor:{color:'red'},
+            },
+            mounted(){
+                initEcho();
+                Echo.channel('bswas_database_package').listen('.weight',(e)=>{
+                    let package=e.package;
+                    let _this=this;
+                    let audio=document.getElementById('audio');
+                    if (package){
+                        if (package.id===_this.package.id){
+                            tempTip.setDuration(4000);
+                            tempTip.showSuccess('暂无新数据');
+                        }else {
+                            _this.updateData(_this,package);
+                            axios.post('/weight/measureMonitor/speech',{logistic:package.logistic_name})
+                                .then(function (response) {
+                                    if (response.data){
+                                        audio.src=response.data;
+                                        audio.play();
+                                    }else {
+                                        tempTip.setDuration(4000);
+                                        tempTip.showSuccess('文件名不规范!');
+                                    }
+                                })
+                                .catch(function (err) {
+                                    tempTip.setDuration(4000);
+                                    tempTip.showSuccess('语音合成发生错误:'+err);
+                                });
+                            tempTip.setDuration(4000);
+                            tempTip.showSuccess('刷新成功!');
+                        }
+                    }
+                });
+/*                if(this.timer){
+                    clearInterval(this.timer);
+                }else {
+                    this.timer=setInterval(()=>{this.flushData();},18000);
+                }*/
+            },
+           methods:{
+               clickMeasuringMachine(e){
+                   let _this=this;
+                   axios.post('/weight/measureMonitor/data',{id:e})
+                       .then(function (response) {
+                           if (response.data.id){
+                               let package=response.data;
+                                _this.updateData(_this,package);
+                           }else {
+                               tempTip.setDuration(4000);
+                               tempTip.showSuccess('暂无数据!');
+                           }
+                       })
+                       .catch(function (err) {
+                           tempTip.setDuration(4000);
+                           tempTip.showSuccess('切换设备错误:'+err);
+                       });
+               },
+               updateData(_this,package){
+                   _this.package.id=package.id;
+                   _this.package.logistic_number=package.logistic_number;_this.package.delivery_number=package.delivery_number;
+                   _this.package.weight=package.weight;_this.package.owner=package.owner_name;
+                   _this.package.paperBox=package.paperBox_name;_this.package.measuringMachine=package.measuringMachine_name;
+                   _this.package.recipient=package.recipient;_this.package.status=package.status;
+                   _this.package.created_at=package.created_at;_this.package.bulk=package.bulk;
+                   _this.package.logistic=package.logistic_name;
+                   if (package.measuringMachine){
+                       _this.package.measuringMachine_status=package.measuringMachine.status;
+                   }
+               }
+            },
+        });
+    </script>
+@endsection

+ 26 - 0
resources/views/weight/menu.blade.php

@@ -0,0 +1,26 @@
+
+<div class="container mt-3" id="nav2">
+    <div class="card">
+        <ul class="nav nav-pills">
+            @can('测量机监视界面-查询')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('weight/package/index')}}" :class="{active:isActive('index',3)}">记录</a>
+                </li> @endcan
+            @can('测量记录管理-查询')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('weight/measureMonitor')}}" :class="{active:isActive('measureMonitor',2)}">设备</a>
+                </li>
+                <li class="nav-item">
+                    <a class="nav-link text-dark" href="{{url('weight/package/create')}}" :class="{active:isActive('create',3)}">手动录入</a>
+                </li>
+                <li class="nav-item">
+                    <a class="nav-link text-dark" href="{{url('weight/weightExcepted/indexCreate')}}" :class="{active:isActive('weightExcepted',2)}">异常记录</a>
+                </li>
+                <li class="nav-item">
+                    <a class="nav-link text-dark" href="{{url('weight/relating')}}" :class="{active:isActive('relating',2)}">相关设置</a>
+                </li>
+                @endcan
+
+        </ul>
+    </div>
+</div>

+ 1 - 1
resources/views/weigh/menuWeigh.blade.php → resources/views/weight/menuWeight.blade.php

@@ -2,7 +2,7 @@
 
 @section('content')
     <div id="nav2">
-        @component('weigh.menu')
+        @component('weight.menu')
         @endcomponent
         <div class="container-fluid">
             <div class="card menu-third" style="background: #f9f0f0;transform: scale(0.95)">

+ 85 - 0
resources/views/weight/package/create.blade.php

@@ -0,0 +1,85 @@
+@extends('layouts.app')
+
+@section('content')
+    <div id="nav2">
+        @component('weight.menu')@endcomponent
+    </div>
+    <div class="container mt-3" id="package">
+        <div class="card col-md-8 offset-md-2">
+            <div class="card-body">
+                <form method="POST" action="{{ url('weight/package') }}">
+                    @csrf
+                    @if(Session::has('successTip'))
+                        <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+                    @endif
+                    <div class="form-group row">
+                        <label for="name" class="col-2 col-form-label text-right">快递单号</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('logistic_number') is-invalid @enderror"
+                                   name="logistic_number" autocomplete="off" value="{{ old('logistic_number')}}" required>
+                            @error('logistic_number')
+                            <span class="invalid-feedback" role="alert">
+                                    <strong>{{ $errors->first('logistic_number') }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="weight" class="col-2 col-form-label text-right">重量</label>
+                        <div class="col-8">
+                            <input type="text" class="form-control @error('weight') is-invalid @enderror"
+                                   name="weight" autocomplete="off" value="{{ old('weight')}}" required>
+                            @error('weight')
+                            <span class="invalid-feedback" role="alert">
+                                    <strong>{{ $errors->first('weight') }}</strong>
+                            </span>
+                            @enderror
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <label for="paper_box_id" class="col-2 col-form-label text-right">纸箱</label>
+                        <div class="col-8 form-inline">
+                            <select name="paper_box_id" class="form-control @error('paper_box_id') is-invalid @enderror" v-model="paperBox_id" style="width: 30%;">
+                                <option v-for="paperBox in paperBoxes" :value="paperBox.id">@{{paperBox.model}}</option>
+                            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                            <input class="form-control-sm" style="width: 150px" placeholder="搜索定位" @input="paperBox_seek">&nbsp;&nbsp;&nbsp;
+                        </div>
+                    </div>
+                    <div class="form-group row">
+                        <div class="col-8 offset-2">
+                            <input type="submit" class="btn btn-success form-control">
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+@endsection
+@section('lastScript')
+    <script>
+        let vue=new Vue({
+            el:"#package",
+            data:{
+                paperBoxes:[
+                    @foreach($paperBoxes as $paperBox)
+                    {id:'{{$paperBox->id}}',model:'{{$paperBox->model}}'},
+                    @endforeach
+                ],
+                paperBox_id:'',
+            },
+            methods:{
+                paperBox_seek:function (e) {
+                    let _this=this;
+                    let $val=e.target.value;
+                    if($val==='')_this.paperBox_id='';
+                    else
+                        _this.paperBoxes.forEach(function (paperBox) {
+                            if (paperBox.model.includes($val)){
+                                _this.paperBox_id=paperBox.id;
+                            }
+                        });
+                },
+            },
+        });
+    </script>
+@endsection

+ 235 - 0
resources/views/weight/package/index.blade.php

@@ -0,0 +1,235 @@
+
+@extends('layouts.app')
+
+@section('content')
+    <span id="nav2">
+        @component('weight.menu')@endcomponent
+        @component('weight.package.menu')@endcomponent
+    </span>
+    <div id="list">
+        <div class="container mt-3">
+            <div class="card" style="width: 1300px;">
+                <div>
+                    <form  method="GET" action="{{url('weight/package')}}" style="margin-top: 1%" id="optionSubmit">
+                        <table class="table  table-sm table-bordered table-hover text-nowrap ">
+                            <tr>
+                                <td colspan="10"><div class="col" v-if="isBeingFilterConditions" style="padding:0">
+                                        <a  href="{{url('weight/package')}}"><span class="btn btn-warning text-dark">清除过滤条件</span></a>
+                                    </div></td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <span class="text-muted">每页显示记录:</span>
+                                </td>
+                                <td  colspan="9">
+                                    <select name="paginate" v-model="filterData.paginate" class="tooltipTarget form-control-sm" style="vertical-align: middle" @change="setPaginate">
+                                        <option value="50">50行</option>
+                                        <option value="100">100行</option>
+                                        <option value="200">200行</option>
+                                        <option value="500">500行</option>
+                                        <option value="1000">1000行</option>
+                                    </select></td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <span class="text-muted">根据条件过滤:</span>
+                                </td>
+                                <td >
+                                    <label class="form-inline" style="width: 350px">时间:
+                                        <input style="width: 150px" name="created_at_start" type="date" v-model="filterData.created_at_start" class="form-control-sm">
+                                        <input style="width: 150px" type="date" name="created_at_end" v-model="filterData.created_at_end" class="form-control-sm">
+                                    </label>
+                                </td>
+                                <td > <label class="form-inline" style="width:200px;margin-left: 2%">货主:
+                                        <input class="form-control-sm" style="width: 80px" placeholder="搜索定位" @input="owner_seek">&nbsp;&nbsp;&nbsp;
+                                        <select name="owner_id" v-model="filterData.owner_id" class="form-control-sm"  @change="setOwner">
+                                            <option >    </option>
+                                            @foreach($owners as $owner)
+                                                <option value="{{$owner->id}}">{{$owner->name}}</option>
+                                            @endforeach
+                                        </select></label><input hidden type="submit" value="kk"></td>
+                                <td > <label class="form-inline" style="width:250px;margin-left: 2%">快递单号:
+                                        <input type="text" name="logistic_number" class="form-control-sm  " v-model="filterData.logistic_number" style="vertical-align: middle"></label></td>
+                                <td > <label  class="form-inline" style="width:250px;margin-left: 2%">发货单号:
+                                        <input type="text" name="delivery_number" class="form-control-sm  " v-model="filterData.delivery_number" style="vertical-align: middle"></label></td>
+                                <td colspan="5"></td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <span class="text-muted">操作选定记录:</span>
+                                </td>
+                                <td colspan="9">
+                                    <span class="btn btn-sm" @click="packageExport" style="cursor: pointer"
+                                          :class="[checkData>0?'btn-dark':'btn-outline-dark']">导出Excel</span>
+                                    <input hidden type="submit" value="kk">
+                                </td>
+                            </tr>
+                        </table>
+                    </form>
+                </div>
+            <div class="card-body">
+                <table class="table table-striped table-sm text-nowrap">
+                    <tr>
+                        <th>
+                            <label for="all">
+                                <input id="all" type="checkbox" @click="checkAll($event)">全选
+                            </label>
+                        </th>
+                        <th>ID</th>
+                        <th>货主</th>
+                        <th>快递单号</th>
+                        <th>发货单号</th>
+                        <th>波次号</th>
+                        <th>波次规则</th>
+                        <th>操作时间</th>
+                        <th>收件人</th>
+                        <th>收件人电话</th>
+                        <th>物流公司</th>
+                        <th>设备</th>
+                        <th>重(KG)</th>
+                        <th>长*宽*高(cm)</th>
+                        <th>体积(cm³)</th>
+                        <th>纸箱</th>
+                        <th>状态</th>
+                    </tr>
+                    <tr v-for="package in packages">
+                        <td>
+                            <input class="checkItem" type="checkbox" :value="package.id" v-model="checkData">
+                        </td>
+                        <td class="text-muted">@{{package.id}}</td>
+                        <td>@{{package.ownerName}}</td>
+                        <td>@{{package.logisticNumber}}</td>
+                        <td>@{{package.wmsNumber}}</td>
+                        <td>@{{package.batchNumber}}</td>
+                        <td>@{{package.batchRule}}</td>
+                        <td class="text-muted">@{{package.created_at}}</td>
+                        <td>@{{package.recipient}}</td>
+                        <td>@{{package.recipientMobile}}</td>
+                        <td>@{{package.logisticName}}</td>
+                        <td>@{{package.measuringMachineName}}</td>
+                        <td>@{{package.weight}}</td>
+                        <td>@{{package.length}}<a v-if="package.length" class="text-primary">*</a>@{{package.width}}<a class="text-primary" v-if="package.width">*</a>@{{package.height}}</td>
+                        <td>@{{package.bulk}}</td>
+                        <td>@{{package.paperBoxName}}</td>
+                        <td>@{{package.status}}</td>
+                    </tr>
+                </table>
+                {{$packages->links()}}
+            </div>
+        </div>
+    </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        new Vue({
+            el:"#list",
+            data:{
+                packages:[
+                    @foreach($packages as $package)
+                        {id:'{{$package->id}}',ownerName:'{{$package->owner_name}}',logisticNumber:'{{$package->logistic_number}}'
+                        ,wmsNumber:'{{$package->delivery_number}}',batchNumber:'{{$package->batch_number}}',batchRule:'{{$package->batch_rule}}'
+                        ,recipient:'{{$package->recipient}}',recipientMobile:'{{$package->recipient_mobile}}',logisticName:'{{$package->logistic_name}}'
+                        ,measuringMachineName:'{{$package->measuringMachine_name}}',
+                        weight:'{{$package->weight}}', length:'{{$package->length}}',width:'{{$package->width}}',height:'{{$package->height}}',
+                        bulk:'{{$package->bulk}}',paperBoxName:'{{$package->paperBox_name}}',
+                        status:'{{$package->status}}',created_at:'{{$package->created_at}}'},
+                    @endforeach
+                ],
+                owners:[
+                    @foreach($owners as $owner)
+                        {id:'{{$owner->id}}',name:'{{$owner->name}}'},
+                    @endforeach
+                ],
+                filterData:
+                    {paginate:'50',created_at_start:'',created_at_end:'',logistic_number:'',delivery_number:'',owner_id: ''},
+                checkData:[]
+            },
+            mounted:function(){
+                this.initInputs();
+            },
+            watch:{
+                checkData:{
+                    handler(){
+                        if (this.checkData.length === this.packages.length){
+                            document.querySelector('#all').checked = true;
+                        }else {
+                            document.querySelector('#all').checked = false;
+                        }
+                    },
+                    deep:true
+                }
+            },
+            computed:{
+                isBeingFilterConditions:function(){
+
+                    for(let key in this.filterData){
+                        if(this.filterData[key]){
+                            if(key==='paginate')continue;
+                            return true
+                        }
+                    }
+                    return false;
+                },
+
+            },
+            methods:{
+                initInputs:function(){
+                    let data=this;
+                    let uriParts =decodeURI(location.href).split("?");
+                    if(uriParts.length>1){
+                        let params = uriParts[1].split('&');
+                        params.forEach(function(paramPair){
+                            let pair=paramPair.split('=');
+                            let key = pair[0], val = pair[1];
+                            $('input[name="'+key+'"]').val(val);
+                            $('select[name="'+key+'"]').val(val);
+                            decodeURI(data.filterData[key]=val);
+                        });
+                    }
+                },
+                setPaginate:function(e){
+                    this.filterData.paginate=e.target.value;
+                    var form = document.getElementById("optionSubmit");
+                    form.submit();
+                },
+                setOwner:function (e){
+                    this.filterData.owner_id=e.target.value;
+                    var form = document.getElementById("optionSubmit");
+                    form.submit();
+                },
+                checkAll(e){
+                    if (e.target.checked){
+                        this.packages.forEach((el,i)=>{
+                            if (this.checkData.indexOf(el.id) == '-1'){
+                                this.checkData.push(el.id);
+                            }
+                        });
+                    }else {
+                        this.checkData = [];
+                    }
+                },
+                packageExport(){
+                    if (this.checkData&&this.checkData.length<=0){
+                        tempTip.setDuration(4000);
+                        tempTip.showSuccess('没有勾选任何记录');
+                    }else{
+                        location.href="{{url('weight/package/export').'/'}}"+this.checkData;
+                    }
+                },
+                owner_seek:function (e) {
+                    let _this=this;
+                    let $val=e.target.value;
+                    if($val==='')_this.filterData.owner_id='';
+                    else
+                        _this.owners.forEach(function (owner) {
+                            if (owner.name.includes($val)){
+                                _this.filterData.owner_id=owner.id;
+                            }
+                        });
+                },
+            }
+        });
+    </script>
+@endsection

+ 1 - 1
resources/views/weigh/package/menu.blade.php → resources/views/weight/package/menu.blade.php

@@ -3,7 +3,7 @@
         <ul class="nav nav-pills">
             @can('包裹信息-查询')
                 <li class="nav-item">
-                    <a class="nav-link" href="{{url('weigh/package')}}" :class="{active:isActive('',3)}">查询</a>
+                    <a class="nav-link" href="{{url('weight/package/index')}}" :class="{active:isActive('index',3)}">查询</a>
                 </li> @endcan
         </ul>
     </div>

+ 180 - 0
resources/views/weight/weightExcepted/index.blade.php

@@ -0,0 +1,180 @@
+
+@extends('layouts.app')
+
+@section('content')
+    <span id="nav2">
+        @component('weight.menu')@endcomponent
+        @component('weight.weightExcepted.menu')@endcomponent
+    </span>
+    <div id="list">
+        <div class="container mt-3">
+            <div class="card">
+                <div>
+                    <form  method="GET" action="{{url('weight/weightExcepted/'.$view)}}" style="margin-top: 1%" id="optionSubmit">
+                        <table class="table  table-sm table-bordered table-hover text-nowrap ">
+                            <tr>
+                                <td  style="width:200px;"> <label style="margin-left: 2%" class="form-inline">页显示条数:
+                                    <select name="paginate" v-model="filterData.paginate" class="form-control" @change="setPaginate">
+                                        <option value="50">50行</option>
+                                        <option value="100">100行</option>
+                                        <option value="200">200行</option>
+                                        <option value="500">500行</option>
+                                        <option value="1000">1000行</option>
+                                    </select></label></td>
+                                <td colspan="5">
+                                    <label style="margin-left: 5px"> 操作选定记录:</label>
+                                    <span class="btn btn-sm" @click="weightExport" style="cursor: pointer"
+                                          :class="[checkData>0?'btn-dark':'btn-outline-dark']">导出Excel</span>
+                                    <input hidden type="submit" value="kk">
+                                </td>
+                            </tr>
+                        </table>
+                    </form>
+                </div>
+            <div class="card-body">
+                <table class="table table-striped table-sm">
+                    <tr style="color: red">
+                        <th>
+                            <label for="all">
+                                <input id="all" type="checkbox" @click="checkAll($event)">全选
+                            </label>
+                        </th>
+                        <th>ID</th>
+                        <th>快递单号</th>
+                        <th>物流公司</th>
+                        @if($view=="indexIssued")
+                            <th>货主</th>
+                            <th>发货单号</th>
+                            <th>下发时间</th>
+                            <th>波次号</th>
+                            <th>波次规则</th>
+                            <th>收件人</th>
+                            <th>收件人电话</th>
+                        @else
+                            <th>设备</th>
+                            <th>称重时间</th>
+                            <th>重(KG)</th>
+                            <th>长(CM)</th>
+                            <th>宽(CM)</th>
+                            <th>高(CM)</th>
+                            <th>体积(CM³)</th>
+                            <th>纸箱</th>
+                        @endif
+                    </tr>
+                    <tr v-for="weightExcepted in weightExcepteds">
+                        <td>
+                            <input class="checkItem" type="checkbox" :value="weightExcepted.id" v-model="checkData">
+                        </td>
+                        <td class="text-muted">@{{weightExcepted.id}}</td>
+                        <td>@{{weightExcepted.logisticNumber}}</td>
+                        <td>@{{weightExcepted.carrierName}}</td>
+                        @if($view=="indexIssued")
+                            <td>@{{weightExcepted.ownerName}}</td>
+                            <td>@{{weightExcepted.deliveryNumber}}</td>
+                            <td class="text-muted">@{{weightExcepted.createdAt}}</td>
+                            <td>@{{weightExcepted.batchNumber}}</td>
+                            <td>@{{weightExcepted.batchRule}}</td>
+                            <td>@{{weightExcepted.recipient}}</td>
+                            <td>@{{weightExcepted.recipientMobile}}</td>
+                        @else
+                            <td>@{{weightExcepted.measuringMachineName}}</td>
+                            <td class="text-muted">@{{weightExcepted.createdAt}}</td>
+                            <td>@{{weightExcepted.weight}}</td>
+                            <td>@{{weightExcepted.length}}</td>
+                            <td>@{{weightExcepted.width}}</td>
+                            <td>@{{weightExcepted.height}}</td>
+                            <td>@{{weightExcepted.bulk}}</td>
+                            <td>@{{weightExcepted.paperBoxName}}</td>
+                        @endif
+                    </tr>
+                </table>
+                {{$weightExcepteds->links()}}
+            </div>
+        </div>
+    </div>
+    </div>
+@endsection
+
+@section('lastScript')
+    <script>
+        new Vue({
+            el:"#list",
+            data:{
+
+
+                weightExcepteds:[
+                    @foreach($weightExcepteds as $weightExcepted)
+                        @if($view=="indexIssued")
+                            {id:'{{$weightExcepted->id}}',ownerName:'{{$weightExcepted->owner_name}}',logisticNumber:'{{$weightExcepted->logistic_number}}',
+                            deliveryNumber:'{{$weightExcepted->delivery_number}}',createdAt:'{{$weightExcepted->created_at}}',
+                            batchNumber:'{{$weightExcepted->batch_number}}', batchRule:'{{$weightExcepted->batch_rule}}',recipient:'{{$weightExcepted->recipient}}',
+                            recipientMobile:'{{$weightExcepted->recipient_mobile}}',carrierName:'{{$weightExcepted->logistic_name}}'},
+                        @else
+                            {id:'{{$weightExcepted->id}}',logisticNumber:'{{$weightExcepted->logistic_number}}',carrierName:'{{$weightExcepted->logistic_name}}',
+                            measuringMachineName:'{{$weightExcepted->measuringMachine_name}}',createdAt:'{{$weightExcepted->created_at}}',
+                            weight:'{{$weightExcepted->weight}}', length:'{{$weightExcepted->length}}',width:'{{$weightExcepted->width}}',height:'{{$weightExcepted->height}}',
+                            bulk:'{{$weightExcepted->bulk}}',paperBoxName:'{{$weightExcepted->paperBox_name}}',},
+                        @endif
+                    @endforeach
+                ],
+                filterData:{paginate:50},
+                checkData:[]
+            },
+           mounted:function(){
+                this.initInputs();
+            },
+            watch:{
+                checkData:{
+                    handler(){
+                        if (this.checkData.length === this.weightExcepteds.length){
+                            document.querySelector('#all').checked = true;
+                        }else {
+                            document.querySelector('#all').checked = false;
+                        }
+                    },
+                    deep:true
+                }
+            },
+            methods:{
+                initInputs:function(){
+                    let data=this;
+                    let uriParts =decodeURI(location.href).split("?");
+                    if(uriParts.length>1){
+                        let params = uriParts[1].split('&');
+                        params.forEach(function(paramPair){
+                            let pair=paramPair.split('=');
+                            let key = pair[0], val = pair[1];
+                            $('input[name="'+key+'"]').val(val);
+                            $('select[name="'+key+'"]').val(val);
+                            decodeURI(data.filterData[key]=val);
+                        });
+                    }
+                },
+                setPaginate:function(e){
+                    this.filterData.paginate=e.target.value;
+                    var form = document.getElementById("optionSubmit");
+                    form.submit();
+                },
+                checkAll(e){
+                    if (e.target.checked){
+                        this.weightExcepteds.forEach((el,i)=>{
+                            if (this.checkData.indexOf(el.id) == '-1'){
+                                this.checkData.push(el.id);
+                            }
+                        });
+                    }else {
+                        this.checkData = [];
+                    }
+                },
+                weightExport(){
+                    if (this.checkData.length<=0){
+                        tempTip.setDuration(4000);
+                        tempTip.showSuccess('没有勾选任何记录');
+                    }else{
+                        location.href="{{url('weight/weightExcepted/export').'/'}}"+this.checkData;
+                    }
+                }
+            }
+        });
+    </script>
+@endsection

+ 14 - 0
resources/views/weight/weightExcepted/menu.blade.php

@@ -0,0 +1,14 @@
+<div class="container">
+    <div class="card menu-third" style="background: #f9f0f0;transform: scale(0.95)">
+        <ul class="nav nav-pills">
+            @can('包裹信息-查看异常')
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('weight/weightExcepted/indexCreate')}}" :class="{active:isActive('indexCreate',3)}">录入异常</a>
+                </li>
+                <li class="nav-item">
+                    <a class="nav-link" href="{{url('weight/weightExcepted/indexIssued')}}" :class="{active:isActive('indexIssued',3)}">下发异常</a>
+                </li>
+            @endcan
+        </ul>
+    </div>
+</div>

+ 9 - 0
routes/api.php

@@ -17,3 +17,12 @@ Route::prefix('log')->group(function(){ //日志记录
     Route::post('rejected/jianshang/send', "Api\jianshang\RejectedController@fakingReceiveSend");//faking rejected发给笕尚的退货信息
 });
 Route::post('rejected/jianshang/send', "Api\jianshang\RejectedController@fakingReceiveSend");//faking rejected发给笕尚的退货信息
+
+Route::any('wx/login', "Api\WxLoginController@login");//微信小程序登录验证
+
+
+Route::group(['middleware'=>'auth:api'],function(){
+    Route::get('wx/waybill', "Api\WxController@index");//微信小程序数据返回
+    Route::post('wx/waybill/show', "Api\WxController@show");//微信小程序数据返回
+    Route::post('wx/waybill/update', "Api\WxController@update");//微信小程序数据修改
+});

+ 12 - 6
routes/web.php

@@ -40,7 +40,9 @@ Route::resource('maintenance/measuringMachine', 'MeasuringMachineController');
 
 Route::get('maintenance/paperBox/index/model', 'PaperBoxController@indexModel');
 Route::get('maintenance/paperBox/index/owner', 'PaperBoxController@indexOwner');
+Route::post('maintenance/paperBox/excel/import','PaperBoxController@import');
 Route::resource('maintenance/paperBox', 'PaperBoxController');
+Route::get('maintenance/paperBox/excel/goImport',function (){return view('maintenance.paperBox.import');});
 
 Route::get('waybill/relating',function (){return view('waybill.menuWaybill');});
 Route::resource('maintenance/waybillPriceModel','WaybillPriceModelsController');
@@ -73,10 +75,6 @@ Route::any('waybillFinancialSnapshot/export/{id}','WaybillFinancialSnapshotsCont
 Route::post('waybillPriceModel/excel/import','WaybillPriceModelsController@import');
 
 
-Route::resource('weigh/measureMonitor','MeasureMonitorController');
-Route::resource('weigh/package','PackageController');
-Route::get('weigh/relating', function () {return view('weigh.menuWeigh');});
-
 Route::post('rejectedBill/{rejectedBill}/edit', 'RejectedBillController@edit');
 Route::resource('rejectedBill', 'RejectedBillController');
 Route::get('rejected/import', 'RejectedController@import');
@@ -91,6 +89,14 @@ Route::post('rejected/exportExcelOnFilterParams', 'RejectedController@exportExce
 Route::resource('rejected', 'RejectedController');
 
 Route::get('maintenance/', function () {return view('maintenance.index');});
-Route::get('weigh/', function () {return view('weigh.index');});
-
+Route::any('weight/measureMonitor/speech','MeasureMonitorController@speech');
+Route::post('weight/measureMonitor/data','MeasureMonitorController@data');
+Route::resource('weight/measureMonitor','MeasureMonitorController');
+Route::get('weight/package/index','PackageController@index');
+Route::resource('weight/package','PackageController');
+Route::get('weight/package/export/{id}','PackageController@export');
+Route::get('weight/relating', function () {return view('weight.menuWeight');});
+Route::get('weight/weightExcepted/indexCreate','WeighExceptedController@indexCreate');
+Route::get('weight/weightExcepted/indexIssued','WeighExceptedController@indexIssued');
+Route::get('weight/weightExcepted/export/{id}','WeighExceptedController@export');
 

+ 2 - 2
tests/Unit/MeasureMonitorTest.php

@@ -45,9 +45,9 @@ class MeasureMonitorTest extends TestCase
      * @depends testUser
      */
     public function testIndex(User $userMark,User $user){
-        $response=$this->actingAs($user)->get('weigh/measureMonitor');
+        $response=$this->actingAs($user)->get('weight/measureMonitor');
         $response->assertOk();
-        $response=$this->actingAs($userMark)->get('weigh/measureMonitor');
+        $response=$this->actingAs($userMark)->get('weight/measureMonitor');
         $response->assertStatus(302)->assertRedirect('/');
     }
 }

+ 2 - 2
tests/Unit/PackageTest.php

@@ -65,9 +65,9 @@ class PackageTest extends TestCase
      * @depends testAddPackage
      */
     public function testIndex(User $user,User $userMark,Package $package){
-        $response=$this->actingAs($user)->get('weigh/package');
+        $response=$this->actingAs($user)->get('weight/package');
         $response->assertOk()->assertSee('Test浏览量');
-        $response=$this->actingAs($userMark)->get('weigh/package');
+        $response=$this->actingAs($userMark)->get('weight/package');
         $response->assertStatus(302)->assertRedirect('/');
     }
 

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
tests/codeCoverage/.js/d3.min.js


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
tests/codeCoverage/.js/jquery.min.js


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно