|
|
@@ -27,53 +27,57 @@ use Ramsey\Uuid\Uuid;
|
|
|
|
|
|
class WaybillsController extends Controller
|
|
|
{
|
|
|
+ public function conditionQuery(Request $request,$waybills){
|
|
|
+ $today=Carbon::now()->subDays(15);
|
|
|
+ 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('origination')){
|
|
|
+ $waybills=$waybills->where('origination','like','%'.$request->input('origination').'%')->where('created_at','>',$today->format('Y-m-d'));
|
|
|
+ }
|
|
|
+ if ($request->input('destination')){
|
|
|
+ $waybills=$waybills->where('destination','like','%'.$request->input('destination').'%')->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->paginate($request->input('paginate')?$request->input('paginate'):50);
|
|
|
+ if (!$waybills&&$request->input('waybill_number')){
|
|
|
+ $waybills=Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
|
|
|
+ return $query->with('user');
|
|
|
+ }])->orderBy('id','DESC')->where('type','专线')->where('waybill_number',$request->input('waybill_number'))
|
|
|
+ ->paginate($request->input('paginate')?$request->input('paginate'):50);
|
|
|
+ }
|
|
|
+ return $waybills;
|
|
|
+ }
|
|
|
|
|
|
public function index(Request $request)
|
|
|
{
|
|
|
if(!Gate::allows('运输管理-查询')){ return redirect(url('/')); }
|
|
|
$data=$request->input();
|
|
|
if ($data != null ) {
|
|
|
- $today=Carbon::now()->subDays(15);
|
|
|
$waybills=Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
|
|
|
return $query->with('user');
|
|
|
}])->orderBy('id','DESC');
|
|
|
- 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('origination')){
|
|
|
- $waybills=$waybills->where('origination','like','%'.$request->input('origination').'%')->where('created_at','>',$today->format('Y-m-d'));
|
|
|
- }
|
|
|
- if ($request->input('destination')){
|
|
|
- $waybills=$waybills->where('destination','like','%'.$request->input('destination').'%')->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->paginate($request->input('paginate')?$request->input('paginate'):50);
|
|
|
- if (!$waybills&&$request->input('waybill_number')){
|
|
|
- $waybills=Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
|
|
|
- return $query->with('user');
|
|
|
- }])->orderBy('id','DESC')->where('type','专线')->where('waybill_number',$request->input('waybill_number'))
|
|
|
- ->paginate($request->input('paginate')?$request->input('paginate'):50);
|
|
|
- }
|
|
|
+ $waybills=$this->conditionQuery($request,$waybills);
|
|
|
$carries = Carrier::get();
|
|
|
$owners = Owner::get();
|
|
|
return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'']);
|
|
|
@@ -92,41 +96,10 @@ class WaybillsController extends Controller
|
|
|
if(!Gate::allows('运输管理-查询')){ return redirect(url('/')); }
|
|
|
$data=$request->input();
|
|
|
if ($data != null ) {
|
|
|
- $today=Carbon::now()->subDays(15);
|
|
|
$waybills=Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
|
|
|
return $query->with('user');
|
|
|
}])->orderBy('id','DESC')->where('type','直发车');
|
|
|
- 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->paginate($request->input('paginate')?$request->input('paginate'):50);
|
|
|
- if (!$waybills&&$request->input('waybill_number')){
|
|
|
- $waybills=Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
|
|
|
- return $query->with('user');
|
|
|
- }])->orderBy('id','DESC')->where('type','专线')->where('waybill_number',$request->input('waybill_number'))
|
|
|
- ->paginate($request->input('paginate')?$request->input('paginate'):50);
|
|
|
- }
|
|
|
+ $waybills=$this->conditionQuery($request,$waybills);
|
|
|
$carries = Carrier::get();
|
|
|
$owners = Owner::get();
|
|
|
return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZF']);
|
|
|
@@ -145,41 +118,10 @@ class WaybillsController extends Controller
|
|
|
if(!Gate::allows('运输管理-查询')){ return redirect(url('/')); }
|
|
|
$data=$request->input();
|
|
|
if ($data != null ) {
|
|
|
- $today=Carbon::now()->subDays(15);
|
|
|
$waybills=Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
|
|
|
return $query->with('user');
|
|
|
}])->orderBy('id','DESC')->where('type','专线');
|
|
|
- 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->paginate($request->input('paginate')?$request->input('paginate'):50);
|
|
|
- if (!$waybills&&$request->input('waybill_number')){
|
|
|
- $waybills=Waybill::with(['owner', 'waybillAuditLogs' => function ($query) {
|
|
|
- return $query->with('user');
|
|
|
- }])->orderBy('id','DESC')->where('type','专线')->where('waybill_number',$request->input('waybill_number'))
|
|
|
- ->paginate($request->input('paginate')?$request->input('paginate'):50);
|
|
|
- }
|
|
|
+ $waybills=$this->conditionQuery($request,$waybills);
|
|
|
$carries = Carrier::get();
|
|
|
$owners = Owner::get();
|
|
|
return view('waybill.index', ['waybills' => $waybills, 'carriers' => $carries, 'owners' => $owners,'filterData'=>$data,'uriType'=>'ZX']);
|