Selaa lähdekoodia

Merge branch 'waybill_ZD'

# Conflicts:
#	app/Http/Controllers/WeighExceptedController.php
#	database/migrations/2020_03_05_080123_add_weigh_excepted_authority.php
LD 6 vuotta sitten
vanhempi
commit
16bdb6d6fc

+ 25 - 2
app/Http/Controllers/PackageController.php

@@ -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);
             }

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

@@ -45,10 +45,12 @@ class WeighExceptedController extends Controller
     }
 
    public function export($id){
-       if(!Gate::allows('称重管理-查看异常')){ return redirect(url('/'));  }
+       if(!Gate::allows('称重信息-查看异常')){ return redirect(url('/'));  }
        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 - 1
resources/views/waybill/index.blade.php

@@ -435,6 +435,7 @@
                 },
                 waybillExport(e){
                     let val=e.target.value;
+                    let data=this.filterData;
                     if (val===1) {
                         if (this.checkData.length <= 0) {
                             tempTip.setDuration(4000);
@@ -443,7 +444,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

@@ -223,6 +223,7 @@
             },
             waybillExport(e){
                 let val=e.target.value;
+                let data=this.filterData;
                 if (val===1) {
                     if (this.checkData.length <= 0) {
                         tempTip.setDuration(4000);
@@ -231,7 +232,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;
                 }
             },
         }

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

@@ -237,6 +237,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);
@@ -245,7 +246,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) {