|
|
@@ -53,10 +53,10 @@ class WaybillController extends Controller
|
|
|
*/
|
|
|
public function index(Request $request,OwnerService $ownerService,LogisticService $logisticService)
|
|
|
{
|
|
|
- if(!Gate::allows('运输管理-查询')){ return view("waybill.authorityMenu"); }
|
|
|
+ if(!Gate::allows('运输管理-运单-查询')){ return view("transport.waybill.authorityMenu"); }
|
|
|
$paginateParams = $request->input();
|
|
|
$waybills=app('waybillService')->paginate($request->input());
|
|
|
- return view('waybill.index', [
|
|
|
+ return view('transport.waybill.index', [
|
|
|
'waybills' => $waybills,
|
|
|
'logistics' => $logisticService->getSelection(["id","name"],"物流"),
|
|
|
'owners' => $ownerService->getIntersectPermitting(),
|
|
|
@@ -67,20 +67,20 @@ class WaybillController extends Controller
|
|
|
|
|
|
public function create(Request $request,OwnerService $ownerService)
|
|
|
{
|
|
|
- if(!Gate::allows('运输管理-录入')){ return redirect(url('/')); }
|
|
|
+ if(!Gate::allows('运输管理-运单-录入')){ return redirect(url('/')); }
|
|
|
$type=$request->type ?? "";
|
|
|
if ($type==='ZF')$type='直发车';
|
|
|
if ($type==='ZX')$type='专线';
|
|
|
- return view('waybill.create',['owners'=>$ownerService->getIntersectPermitting(),'type'=>$type]);
|
|
|
+ return view('transport.waybill.create',['owners'=>$ownerService->getIntersectPermitting(),'type'=>$type]);
|
|
|
}
|
|
|
|
|
|
public function store(Request $request)
|
|
|
{
|
|
|
- if(!Gate::allows('运输管理-录入')){ return redirect(url('/')); }
|
|
|
+ if(!Gate::allows('运输管理-运单-录入')){ return redirect(url('/')); }
|
|
|
$this->validatorWaybill($request,false)->validate();
|
|
|
/** @var WaybillService */
|
|
|
$waybill=app('waybillService')->store($request);
|
|
|
- return redirect('waybill/index')->with('successTip','新运单“'.$waybill->waybill_number.'”录入成功');
|
|
|
+ return redirect('transport/waybill/index')->with('successTip','新运单“'.$waybill->waybill_number.'”录入成功');
|
|
|
}
|
|
|
|
|
|
public function edit($id,LogisticService $logisticService,CarTypeService $carTypeService,UnitService $unitService)
|
|
|
@@ -104,13 +104,13 @@ class WaybillController extends Controller
|
|
|
$cities=app("RegionService")->getSelection(2);
|
|
|
$units=$unitService->getSelection();
|
|
|
$carTypes=$carTypeService->getSelection();
|
|
|
- return view('waybill/edit',['waybill'=>$waybill,'logistics'=>$logisticService->getSelection(["id","name"],"物流"),'cities'=>$cities,'units'=>$units,'carTypes'=>$carTypes]);
|
|
|
+ return view('transport.waybill.edit',['waybill'=>$waybill,'logistics'=>$logisticService->getSelection(["id","name"],"物流"),'cities'=>$cities,'units'=>$units,'carTypes'=>$carTypes]);
|
|
|
}
|
|
|
|
|
|
public function update(Request $request, $id,WaybillPriceModelService $waybillPriceModelService,
|
|
|
LogisticService $logisticService,WaybillPayoffService $waybillPayoffService)
|
|
|
{
|
|
|
- if(!Gate::allows('运输管理-调度')){ return redirect(url('/')); }
|
|
|
+ if(!Gate::allows('运输管理-运单-调度')){ return redirect(url('/')); }
|
|
|
if (!$request->warehouse_weight && $request->warehouse_weight_unit_id){
|
|
|
$request->offsetUnset('warehouse_weight_unit_id');
|
|
|
}
|
|
|
@@ -163,7 +163,7 @@ class WaybillController extends Controller
|
|
|
$waybillPayoffService->updateOrCreate($waybillPayoffParam);
|
|
|
}
|
|
|
app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
|
|
|
- return redirect('waybill/index')->with('successTip','运单“'.$waybill->waybill_number.'”调度成功');
|
|
|
+ return redirect('transport/waybill/index')->with('successTip','运单“'.$waybill->waybill_number.'”调度成功');
|
|
|
}
|
|
|
|
|
|
public function checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id){
|
|
|
@@ -343,12 +343,12 @@ class WaybillController extends Controller
|
|
|
$waybill->fill($data);
|
|
|
if ($waybill->save()){
|
|
|
app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($waybill),Auth::user()['id']);
|
|
|
- return redirect('waybill/index')->with('successTip','运单“'.$waybill->waybill_number.'”修改成功');
|
|
|
+ return redirect('transport/waybill/index')->with('successTip','运单“'.$waybill->waybill_number.'”修改成功');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public function waybillAudit(Request $request){
|
|
|
- if(!Gate::allows('运输管理-运单审核')){ return redirect(url('/')); }
|
|
|
+ if(!Gate::allows('运输管理-运单-运单审核')){ return redirect(url('/')); }
|
|
|
$id=$request->input('id');
|
|
|
$waybill=app('waybillService')->find($id);
|
|
|
$isAudit=WaybillAuditLog::whereRaw('waybill_id = ? and audit_stage = ?',[$id,"运单阶段"])->first();
|
|
|
@@ -372,10 +372,10 @@ class WaybillController extends Controller
|
|
|
if(!Gate::allows('运输管理-编辑')){ return redirect(url('/')); }
|
|
|
$waybill=app('waybillService')->find($id);
|
|
|
$owners=app("OwnerService")->getIntersectPermitting();
|
|
|
- return view('waybill.waybillEdit',['waybill'=>$waybill,'owners'=>$owners]);
|
|
|
+ return view('transport.waybill.waybillEdit',['waybill'=>$waybill,'owners'=>$owners]);
|
|
|
}
|
|
|
public function waybillRetreatAudit(Request $request){
|
|
|
- if(!Gate::allows('运输管理-调度')){ return redirect(url('/')); }
|
|
|
+ if(!Gate::allows('运输管理-运单-调度')){ return redirect(url('/')); }
|
|
|
$id=$request->input('id');
|
|
|
$waybill=app('waybillService')->find($id);
|
|
|
WaybillAuditLog::query()->whereRaw('waybill_id = ? and audit_stage = ?',[$id,"运单阶段"])->delete();
|
|
|
@@ -385,7 +385,7 @@ class WaybillController extends Controller
|
|
|
return ['success'=>$result,'status'=>$waybill->status];
|
|
|
}
|
|
|
public function waybillEndAudit(Request $request){
|
|
|
- if(!Gate::allows('运输管理-调度审核')){ return redirect(url('/')); }
|
|
|
+ if(!Gate::allows('运输管理-运单-调度审核')){ return redirect(url('/')); }
|
|
|
$id=$request->input('id');
|
|
|
$waybill=Waybill::query()->with(["owner","logistic","originationCity","destinationCity","carType",'priceModel',"amountUnit",
|
|
|
"warehouseWeightUnit","carrierWeightUnit","warehouseWeightUnitOther","carrierWeightUnitOther"])->find($id);
|
|
|
@@ -485,7 +485,7 @@ class WaybillController extends Controller
|
|
|
}
|
|
|
|
|
|
public function upload(Request $request){
|
|
|
- if(!Gate::allows('运输管理-图片上传')){ return '没有权限'; }
|
|
|
+ if(!Gate::allows('运输管理-运单-图片上传')){ return '没有权限'; }
|
|
|
$file=$request->file('file');
|
|
|
$waybill_number=$request->input('waybill_number');
|
|
|
$waybill=Waybill::query()->where('waybill_number',$waybill_number)->first();
|
|
|
@@ -535,7 +535,7 @@ class WaybillController extends Controller
|
|
|
//批量上传图片
|
|
|
public function batchUploadImages()
|
|
|
{
|
|
|
- $this->gate("运输管理-图片上传");
|
|
|
+ $this->gate("运输管理-运单-图片上传");
|
|
|
ini_set('max_execution_time',1000);
|
|
|
ini_set('memory_limit','100M');
|
|
|
$images = request("images");
|
|
|
@@ -596,7 +596,7 @@ class WaybillController extends Controller
|
|
|
|
|
|
//删除照片
|
|
|
public function deleteImg(Request $request){
|
|
|
- if(!Gate::allows('运输管理-图片删除')){ return '没有权限'; }
|
|
|
+ if(!Gate::allows('运输管理-运单-图片删除')){ return '没有权限'; }
|
|
|
$ids=$request->input('ids');
|
|
|
$uploadFiles=UploadFile::where('table_name','waybills')->whereIn('table_id',$ids)->get();
|
|
|
foreach ($uploadFiles as $uploadFile){
|
|
|
@@ -613,7 +613,7 @@ class WaybillController extends Controller
|
|
|
}
|
|
|
|
|
|
public function export(){
|
|
|
- $this->gate('运输管理-查询');
|
|
|
+ $this->gate('运输管理-运单-查询');
|
|
|
if (request("checkAllSign")){
|
|
|
request()->offsetUnset("checkAllSign");
|
|
|
$waybills = app('waybillService')->get(request()->input());
|
|
|
@@ -687,7 +687,7 @@ class WaybillController extends Controller
|
|
|
$carrierIds=array_column($carriersUsers->toArray(),'logistic_id');
|
|
|
$waybills=$waybills->whereIn("logistic_id",$carrierIds);
|
|
|
}
|
|
|
- return view('waybill.delivering',compact('waybills'));
|
|
|
+ return view('transport.waybill.delivering',compact('waybills'));
|
|
|
}
|
|
|
//承运商提交
|
|
|
public function storeCarrierBill(Request $request){
|
|
|
@@ -819,7 +819,7 @@ class WaybillController extends Controller
|
|
|
|
|
|
// 运单删除 软删除
|
|
|
public function destroy(int $id){
|
|
|
- if(!GAte::allows('运输管理-删除')){return['success'=>0,'status'=>'没有权限'];}
|
|
|
+ if(!GAte::allows('运输管理-运单-删除')){return['success'=>0,'status'=>'没有权限'];}
|
|
|
if(is_null($id)){return ['success'=>'0','status'=>'传入id为空'];}
|
|
|
$result = Waybill::where('id',$id)->delete();
|
|
|
return ['success'=>$result,'status'=>$result];
|
|
|
@@ -827,7 +827,7 @@ class WaybillController extends Controller
|
|
|
|
|
|
// 回收站
|
|
|
public function recycle(Request $request){
|
|
|
- if(!Gate::allows('运输管理-删除')){return redirect('/');}
|
|
|
+ if(!Gate::allows('运输管理-运单-删除')){return redirect('/');}
|
|
|
$paginate = $request->input('paginate')??50;
|
|
|
/** @var Collection $waybills */
|
|
|
$waybills = Waybill::query()->with(['owner','order.owner','logistic','amountUnit','warehouseWeightUnit','carrierWeightUnit',
|
|
|
@@ -838,12 +838,12 @@ class WaybillController extends Controller
|
|
|
$total = $waybills->count();
|
|
|
$paginateParams = [];
|
|
|
$paginateParams['paginate'] = $paginate;
|
|
|
- return view('waybill.recycle',compact('waybills','total','paginateParams'));
|
|
|
+ return view('transport.waybill.recycle',compact('waybills','total','paginateParams'));
|
|
|
}
|
|
|
|
|
|
// 软删除恢复
|
|
|
public function apiRestoreSelected(Request $request){
|
|
|
- if(!Gate::allows('运输管理-删除')){return ['success'=>'false','fail_info'=>'没有权限'];}
|
|
|
+ if(!Gate::allows('运输管理-运单-删除')){return ['success'=>'false','fail_info'=>'没有权限'];}
|
|
|
$ids = $request->input('ids')??'';
|
|
|
if($ids == ''){return ['success'=>'false','fail_info'=>'没有可恢复对象'];}
|
|
|
$waybills = Waybill::withTrashed()->whereIn('id',$ids)->get();
|
|
|
@@ -855,7 +855,7 @@ class WaybillController extends Controller
|
|
|
}
|
|
|
// 修改运费
|
|
|
public function changeFee(Request $request){
|
|
|
- if(!Gate::allows('运输管理-运费')){return ['success'=>'false','fail_info'=>'没有权限'];}
|
|
|
+ if(!Gate::allows('运输管理-运单-运费')){return ['success'=>'false','fail_info'=>'没有权限'];}
|
|
|
$wayBillId = $request->input('id');
|
|
|
$waybillFee = $request->input('fee');
|
|
|
if(is_null($wayBillId) or is_null($waybillFee)){
|
|
|
@@ -867,7 +867,7 @@ class WaybillController extends Controller
|
|
|
}
|
|
|
// 修改运输收费
|
|
|
public function changeCharge(Request $request){
|
|
|
- if(!Gate::allows('运输管理-运单编辑')){return ['success'=>'false','fail_info'=>'没有权限'];}
|
|
|
+ if(!Gate::allows('运输管理-运单-运单编辑')){return ['success'=>'false','fail_info'=>'没有权限'];}
|
|
|
$wayBillId = $request->id;
|
|
|
$waybillCharge = $request->input('charge');
|
|
|
if(is_null($wayBillId) or is_null($waybillCharge)){
|
|
|
@@ -881,7 +881,7 @@ class WaybillController extends Controller
|
|
|
public function waybillOnTop(Request $request){
|
|
|
$id = $request->input('id');
|
|
|
$detail = $request->input('detail');
|
|
|
- if(!Gate::allows('运输管理-置顶')){return ['success'=>'false','fail_info'=>'没有权限'];}
|
|
|
+ if(!Gate::allows('运输管理-运单-置顶')){return ['success'=>'false','fail_info'=>'没有权限'];}
|
|
|
if(is_null($id)){
|
|
|
return ['success'=>'false','fail_info'=>'传参错误'];
|
|
|
}
|
|
|
@@ -897,7 +897,7 @@ class WaybillController extends Controller
|
|
|
// 取消置顶
|
|
|
public function cancelOnTop(Request $request){
|
|
|
$id = $request->input('id');
|
|
|
- if(!Gate::allows('运输管理-置顶')){return ['success'=>'false','fail_info'=>'没有权限'];}
|
|
|
+ if(!Gate::allows('运输管理-运单-置顶')){return ['success'=>'false','fail_info'=>'没有权限'];}
|
|
|
if(is_null($id)){
|
|
|
return ['success'=>'false','fail_info'=>'传参错误'];
|
|
|
}
|