Zhouzhendong 6 lat temu
rodzic
commit
f7daa829fe

+ 2 - 2
app/Http/Controllers/MeasureMonitorController.php

@@ -22,13 +22,13 @@ class MeasureMonitorController extends Controller
      */
     public function index(Request $request)
     {
-        if(!Gate::allows('称重信息-查询')){ return redirect(url('/'));  }
+        if(!Gate::allows('称重管理-查询')){ return redirect(url('/'));  }
         $measuringMachines=MeasuringMachine::select('id','name','code','status')->get();
         return view('weight.measureMonitor.index',['measuringMachines'=>$measuringMachines]);
     }
 
     public function data(Request $request){
-        if(!Gate::allows('称重信息-查询')){ return redirect(url('/'));  }
+        if(!Gate::allows('称重管理-查询')){ return redirect(url('/'));  }
         $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();*/

+ 28 - 5
app/Http/Controllers/PackageController.php

@@ -22,7 +22,7 @@ class PackageController extends Controller
      */
     public function index(Request $request)
     {
-        if(!Gate::allows('称重信息-查询')){ return redirect(url('/'));  }
+        if(!Gate::allows('称重管理-查询')){ return redirect(url('/'));  }
         if ($request->input()){
             $packages=Package::orderBy('id','DESC');
             $today=Carbon::now()->subDays(15);
@@ -60,7 +60,7 @@ class PackageController extends Controller
      */
     public function create()
     {
-        if(!Gate::allows('称重信息-录入')){ return redirect(url('/'));  }
+        if(!Gate::allows('称重管理-录入')){ return redirect(url('/'));  }
         $paperBoxes=PaperBox::select('id','model')->get();
         return view('weight.package.create',['paperBoxes'=>$paperBoxes]);
     }
@@ -73,7 +73,7 @@ class PackageController extends Controller
      */
     public function store(Request $request)
     {
-        if(!Gate::allows('称重信息-录入')){ return redirect(url('/'));  }
+        if(!Gate::allows('称重管理-录入')){ return redirect(url('/'));  }
         $this->validator($request)->validate();
         $logistic_number=$request->input('logistic_number');
         $weight=$request->input('weight');
@@ -133,10 +133,33 @@ class PackageController extends Controller
         //
     }
 
-    public function export($id){
+    public function export($id,Request $request){
+        if(!Gate::allows('称重管理-查询')){ return '没有权限';  }
         if ($id==-1){
             $id=[];
-            $packages=Package::select('id')->get();
+            $today=Carbon::now()->subDays(15);
+            ini_set('max_execution_time',2500);
+            ini_set('memory_limit','1526M');
+            $packages=Package::select('id');
+            if ($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('delivery_number')){
+                $packages=$packages->where('delivery_number','like','%'.$request->input('delivery_number').'%')->where('created_at','>',$today->format('Y-m-d'));
+            }
+            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'));
+            }
+            if ($request->input('batch_number')){
+                $packages=$packages->where('batch_number','like','%'.$request->input('batch_number').'%')->where('created_at','>',$today->format('Y-m-d'));
+            }
+            $packages=$packages->get();
             foreach ($packages as $package){
                 array_push($id,$package->id);
             }

+ 13 - 2
app/Http/Controllers/WaybillFinancialSnapshotsController.php

@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
 
 use App\Exports\WaybillExport;
 use App\WaybillFinancialSnapshot;
+use Carbon\Carbon;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Gate;
@@ -53,10 +54,20 @@ class WaybillFinancialSnapshotsController extends Controller
         return view('waybill.waybillFinancialSnapshot.index',['waybillFinancialSnapshots'=>$waybillFinancialSnapshots,'filterData'=>$request->input(),'type'=>'ZX']);
     }
 
-    public function export($id){
+    public function export($id,Request $request){
+        if(!Gate::allows('财务报表-查询')){ return '没有权限';  }
         if ($id==-1){
             $id=[];
-            $waybillFinancialSnapshots=WaybillFinancialSnapshot::select('id')->get();
+            ini_set('max_execution_time',2500);
+            ini_set('memory_limit','1526M');
+            $waybillFinancialSnapshots=WaybillFinancialSnapshot::select('id');
+            if ($request->input('created_at_start')){
+                $waybillFinancialSnapshots=$waybillFinancialSnapshots->where('created_at','>=',$request->input('created_at_start'));
+            }
+            if ($request->input('created_at_end')){
+                $waybillFinancialSnapshots=$waybillFinancialSnapshots->where('created_at','<=',$request->input('created_at_end'));
+            }
+            $waybillFinancialSnapshots=$waybillFinancialSnapshots->get();
             foreach ($waybillFinancialSnapshots as $waybillFinancialSnapshot){
                 array_push($id,$waybillFinancialSnapshot->id);
             }

+ 31 - 2
app/Http/Controllers/WaybillsController.php

@@ -562,10 +562,39 @@ class WaybillsController extends Controller
         return ['exception'=>'请勿重复审核!'];
     }
 
-    public function waybillExport($id){
+    public function waybillExport($id,Request $request){
+        if(!Gate::allows('运输管理-查询')){ return '没有权限';  }
         if ($id==-1){
             $id=[];
-            $waybills = Waybill::select('id')->get();
+            $today=Carbon::now()->subDays(15);
+            ini_set('max_execution_time',2500);
+            ini_set('memory_limit','1526M');
+            $waybills=Waybill::select('id');
+            if ($request->input('waybill_number')){
+                $waybills =$waybills->where('waybill_number','like','%'.$request->input('waybill_number').'%')->where('created_at','>',$today->format('Y-m-d'));
+            }
+            if ($request->input('carrier_bill')){
+                $waybills=$waybills->where('carrier_bill','like','%'.$request->input('carrier_bill').'%')->where('created_at','>',$today->format('Y-m-d'));
+            }
+            if ($request->input('carrier_id')){
+                $waybills=$waybills->where('carrier_id','=',$request->input('carrier_id'));
+            }
+            if ($request->input('owner_id')){
+                $waybills=$waybills->where('owner_id','=',$request->input('owner_id'));
+            }
+            if ($request->input('wms_bill_number')){
+                $waybills=$waybills->where('wms_bill_number','like','$'.$request->input('wms_bill_number').'%')->where('created_at','>',$today->format('Y-m-d'));
+            }
+            if ($request->input('created_at_start')){
+                $waybills=$waybills->where('created_at','>',$request->input('created_at_start'));
+            }
+            if ($request->input('created_at_end')){
+                $waybills=$waybills->where('created_at','<',$request->input('created_at_end'));
+            }
+            if ($request->input('status')){
+                $waybills=$waybills->where('status',$request->input('status'));
+            }
+            $waybills=$waybills->get();
             foreach ($waybills as $waybill){
                 array_push($id,$waybill->id);
             }

+ 7 - 4
app/Http/Controllers/WeighExceptedController.php

@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
 
 use App\Exports\WaybillExport;
 use App\Package;
+use Carbon\Carbon;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Gate;
@@ -18,7 +19,7 @@ class WeighExceptedController extends Controller
      */
     public function indexCreate(Request $request)
     {
-        if(!Gate::allows('称重信息-查看异常')){ return redirect(url('/'));  }
+        if(!Gate::allows('称重管理-查看异常')){ return redirect(url('/'));  }
         $paginate=$request->input('paginate');
         if ($paginate){
             $weightExcepteds=Package::select('id','status','logistic_number','logistic_id','measuring_machine_id','created_at','weight','length','width','height','bulk','paper_box_id')->
@@ -32,7 +33,7 @@ class WeighExceptedController extends Controller
 
     public function indexIssued(Request $request)
     {
-        if(!Gate::allows('称重信息-查看异常')){ return redirect(url('/'));  }
+        if(!Gate::allows('称重管理-查看异常')){ return redirect(url('/'));  }
         $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')->
@@ -45,10 +46,12 @@ class WeighExceptedController extends Controller
     }
 
    public function export($id){
-       if(!Gate::allows('称重信息-查看异常')){ return redirect(url('/'));  }
+       if(!Gate::allows('称重管理-查看异常')){ return '没有权限';  }
        if ($id==-1){
            $id=[];
-           $packages=Package::where('status','上传异常')->orWhere('status','测量异常')->orWhere('status','记录异常')->orWhere('status','已上传异常')->orWhere('status','下发异常')->select('id')->get();
+           ini_set('max_execution_time',2500);
+           ini_set('memory_limit','1526M');
+           $packages=Package::select('id')->get();
            foreach ($packages as $package){
                array_push($id,$package->id);
            }

+ 8 - 7
database/migrations/2020_03_05_080123_add_weigh_excepted_authority.php

@@ -14,10 +14,10 @@ class AddWeighExceptedAuthority extends Migration
      */
     public function up()
     {
-
-        if(!Authority::where('name','称重信息-查看异常')->first())(new Authority(['name'=>'称重信息-查看异常','alias_name'=>'称重信息-查看异常']))->save();
-        if(!Authority::where('name','称重信息-录入')->first())(new Authority(['name'=>'称重信息-录入','alias_name'=>'称重信息-录入']))->save();
-        if(!Authority::where('name','称重信息-查询')->first())(new Authority(['name'=>'称重信息-录入','alias_name'=>'称重信息-查询']))->save();
+        if(!Authority::where('name','称重管理')->first())(new Authority(['name'=>'称重管理','alias_name'=>'称重管理']))->save();
+        if(!Authority::where('name','称重管理-查看异常')->first())(new Authority(['name'=>'称重管理-查看异常','alias_name'=>'称重管理-查看异常']))->save();
+        if(!Authority::where('name','称重管理-录入')->first())(new Authority(['name'=>'称重管理-录入','alias_name'=>'称重管理-录入']))->save();
+        if(!Authority::where('name','称重管理-查询')->first())(new Authority(['name'=>'称重管理-录入','alias_name'=>'称重管理-查询']))->save();
     }
 
     /**
@@ -27,9 +27,10 @@ class AddWeighExceptedAuthority extends Migration
      */
     public function down()
     {
-        Authority::where('name','称重信息-查看异常')->delete();
-        Authority::where('name','称重信息-录入')->delete();
-        Authority::where('name','称重信息-查询')->delete();
+        Authority::where('name','称重管理')->delete();
+        Authority::where('name','称重管理-录入')->delete();
+        Authority::where('name','称重管理-查询')->delete();
+        Authority::where('name','称重管理-查询')->delete();
 
     }
 }

+ 8 - 1
resources/views/waybill/index.blade.php

@@ -434,6 +434,7 @@
                 },
                 waybillExport(e){
                     let val=e.target.value;
+                    let data=this.filterData;
                     if (val===1) {
                         if (this.checkData.length <= 0) {
                             tempTip.setDuration(4000);
@@ -442,7 +443,13 @@
                             location.href = "{{url('waybillExport')}}/" + this.checkData;
                         }
                     }else {
-                        location.href = "{{url('waybillExport/-1')}}";
+                        location.href = "{{url('waybillExport/-1?waybill_number=')}}"+
+                        data.waybill_number+"&carrier_bill="+data.carrier_bill+
+                        "&carrier_id="+data.carrier_id+"&owner_id="+data.owner_id+
+                        "&wms_bill_number="+data.wms_bill_number+"&created_at_start="+
+                        data.created_at_start+"&created_at_end="+data.created_at_end+
+                        "&type="+data.type+"&status="+data.status+"&origination="+data.origination+
+                        "&destination="+data.destination;
                     }
                 }
             },

+ 3 - 1
resources/views/waybill/waybillFinancialSnapshot/index.blade.php

@@ -222,6 +222,7 @@
             },
             waybillExport(e){
                 let val=e.target.value;
+                let data=this.filterData;
                 if (val===1) {
                     if (this.checkData.length <= 0) {
                         tempTip.setDuration(4000);
@@ -230,7 +231,8 @@
                         location.href = "{{url('waybillFinancialSnapshot/export')}}/" + this.checkData;
                     }
                 }else {
-                    location.href = "{{url('waybillFinancialSnapshot/export/-1')}}";
+                    location.href = "{{url('waybillFinancialSnapshot/export/-1?created_at_start=')}}"+
+                        data.created_at_start+"&created_at_end="+data.created_at_end;
                 }
             },
         }

+ 4 - 4
resources/views/weight/menu.blade.php

@@ -2,22 +2,22 @@
 <div class="container-fluid mt-3" id="nav2">
     <div class="card">
         <ul class="nav nav-pills">
-                @can('称重信息-查询')
+                @can('称重管理-查询')
                 <li class="nav-item">
                     <a class="nav-link" href="{{url('package/')}}" :class="{active:isActive('',2)}">记录</a>
                 </li>
                 <li class="nav-item">
                     <a class="nav-link" href="{{url('package/measureMonitor')}}" :class="{active:isActive('measureMonitor',2)}">设备</a>
                 </li>@endcan
-                @can('称重信息-录入')
+                @can('称重管理-录入')
                 <li class="nav-item">
                     <a class="nav-link text-dark" href="{{url('package/create')}}" :class="{active:isActive('create',2)}">手动录入</a>
                 </li>@endcan
-                @can('称重信息-查询')
+                @can('称重管理-查询')
                 <li class="nav-item">
                     <a class="nav-link text-dark" href="{{url('package/weightExcepted/indexCreate')}}" :class="{active:isActive('weightExcepted',2)}">异常记录</a>
                 </li>@endcan
-                @can('称重信息-查看异常')
+                @can('称重管理-查看异常')
                 <li class="nav-item">
                     <a class="nav-link text-dark" href="{{url('package/relating')}}" :class="{active:isActive('relating',2)}">相关设置</a>
                 </li>@endcan

+ 5 - 1
resources/views/weight/package/index.blade.php

@@ -238,6 +238,7 @@
                 },
                 packageExport(e){
                     let val=e.target.value;
+                    let data=this.filterData;
                     if (val===1){
                         if (this.checkData&&this.checkData.length<=0){
                             tempTip.setDuration(4000);
@@ -246,7 +247,10 @@
                             location.href="{{url('package/export').'/'}}"+this.checkData;
                         }
                     } else {
-                        location.href="{{url('package/export/-1')}}";
+                        location.href="{{url('package/export/-1?created_at_start=')}}"+
+                            data.created_at_start+"&created_at_end="+data.created_at_end+"&logistic_number="+
+                            data.logistic_number+"&delivery_number="+data.delivery_number+"&owner_id="+data.owner_id+
+                            "&batch_number="+data.batch_number;
                     }
                 },
                 owner_seek:function (e) {

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

@@ -1,7 +1,7 @@
 <div class="container-fluid">
     <div class="card menu-third" style="background: #f9f0f0;transform: scale(0.95)">
         <ul class="nav nav-pills">
-            @can('称重信息-查询')
+            @can('称重管理-查询')
                 <li class="nav-item">
                     <a class="nav-link" href="{{url('package/')}}" :class="{active:isActive('',2)}">查询</a>
                 </li> @endcan

+ 1 - 1
resources/views/weight/weightExcepted/menu.blade.php

@@ -1,7 +1,7 @@
 <div class="container-fluid">
     <div class="card menu-third" style="background: #f9f0f0;transform: scale(0.95)">
         <ul class="nav nav-pills">
-            @can('称重信息-查看异常')
+            @can('称重管理-查看异常')
                 <li class="nav-item">
                     <a class="nav-link" href="{{url('package/weightExcepted/indexCreate')}}" :class="{active:isActive('indexCreate',3)}">录入异常</a>
                 </li>