|
|
@@ -3,9 +3,9 @@
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
-use App\Services\CarrierService;
|
|
|
use App\Services\CarTypeService;
|
|
|
use App\Services\CityService;
|
|
|
+use App\Services\LogisticService;
|
|
|
use App\Services\OwnerService;
|
|
|
use App\Services\UnitService;
|
|
|
use App\Services\WaybillPayoffService;
|
|
|
@@ -24,6 +24,8 @@ use App\WaybillFinancialExcepted;
|
|
|
use App\WaybillFinancialSnapshot;
|
|
|
use Carbon\Carbon;
|
|
|
use Exception;
|
|
|
+use Illuminate\Database\Eloquent\Builder;
|
|
|
+use Illuminate\Database\Eloquent\Collection;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
@@ -43,17 +45,17 @@ class WaybillController extends Controller
|
|
|
/**
|
|
|
* @param Request $request
|
|
|
* @param OwnerService $ownerService
|
|
|
- * @param CarrierService $carrierService
|
|
|
+ * @param LogisticService $logisticService
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function index(Request $request,OwnerService $ownerService,CarrierService $carrierService)
|
|
|
+ public function index(Request $request,OwnerService $ownerService,LogisticService $logisticService)
|
|
|
{
|
|
|
if(!Gate::allows('运输管理-查询')){ return view("waybill.authorityMenu"); }
|
|
|
$paginateParams = $request->input();
|
|
|
$waybills=app('waybillService')->paginate($request->input());
|
|
|
return view('waybill.index', [
|
|
|
'waybills' => $waybills,
|
|
|
- 'carriers' => $carrierService->getSelection(),
|
|
|
+ 'logistics' => $logisticService->getSelection(["id","name"],"logistic"),
|
|
|
'owners' => $ownerService->getSelection(),
|
|
|
'paginateParams'=>$paginateParams,
|
|
|
'uriType'=>$request->uriType??'']);
|
|
|
@@ -80,7 +82,7 @@ class WaybillController extends Controller
|
|
|
return redirect('waybill/index')->with('successTip','新运单“'.$waybill->waybill_number.'”录入成功');
|
|
|
}
|
|
|
|
|
|
- public function edit($id,CarrierService $carrierService,CarTypeService $carTypeService,
|
|
|
+ public function edit($id,LogisticService $logisticService,CarTypeService $carTypeService,
|
|
|
CityService $cityService,UnitService $unitService)
|
|
|
{
|
|
|
if(!Gate::allows('运输管理-编辑')){ return redirect(url('/')); }
|
|
|
@@ -93,11 +95,11 @@ class WaybillController extends Controller
|
|
|
$cities=$cityService->getSelection();
|
|
|
$units=$unitService->getSelection();
|
|
|
$carTypes=$carTypeService->getSelection();
|
|
|
- return view('waybill/edit',['waybill'=>$waybill,'carriers'=>$carrierService->getSelection(),'cities'=>$cities,'units'=>$units,'carTypes'=>$carTypes]);
|
|
|
+ return view('waybill/edit',['waybill'=>$waybill,'logistics'=>$logisticService->getSelection(["id","name"],"logistic"),'cities'=>$cities,'units'=>$units,'carTypes'=>$carTypes]);
|
|
|
}
|
|
|
|
|
|
public function update(Request $request, $id,WaybillPriceModelService $waybillPriceModelService,
|
|
|
- CarrierService $carrierService,WaybillPayoffService $waybillPayoffService)
|
|
|
+ LogisticService $logisticService,WaybillPayoffService $waybillPayoffService)
|
|
|
{
|
|
|
if(!Gate::allows('运输管理-调度')){ return redirect(url('/')); }
|
|
|
if (!$request->warehouse_weight && $request->warehouse_weight_unit_id){
|
|
|
@@ -126,11 +128,11 @@ class WaybillController extends Controller
|
|
|
if ($waybillPriceModel_id){
|
|
|
$carrier_weight=$request->input('carrier_weight');
|
|
|
$waybillPriceModel=$waybillPriceModelService->find($waybillPriceModel_id);
|
|
|
- $carrier=$carrierService->find($waybill->carrier_id);
|
|
|
+ $logistic=$logisticService->find($waybill->logistic_id);
|
|
|
if ($carrier_weight<$waybillPriceModel->initial_weight){
|
|
|
- $fee=(($waybillPriceModel->unit_price)*($waybillPriceModel->initial_weight))+$carrier->delivery_fee;
|
|
|
+ $fee=(($waybillPriceModel->unit_price)*($waybillPriceModel->initial_weight))+$logistic->delivery_fee;
|
|
|
}else{
|
|
|
- $fee=(($waybillPriceModel->unit_price)*$carrier_weight)+$carrier->delivery_fee;
|
|
|
+ $fee=(($waybillPriceModel->unit_price)*$carrier_weight)+$logistic->delivery_fee;
|
|
|
}
|
|
|
if ($waybillPriceModel->base_fee&&$fee<$waybillPriceModel->base_fee){
|
|
|
$fee=$waybillPriceModel->base_fee;
|
|
|
@@ -155,19 +157,19 @@ class WaybillController extends Controller
|
|
|
return redirect('waybill/index')->with('successTip','运单“'.$waybill->waybill_number.'”调度成功');
|
|
|
}
|
|
|
|
|
|
- public function checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id){
|
|
|
+ public function checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id){
|
|
|
//确保承运商计数与计数单位为一个数组且长度2
|
|
|
- if(!$carrier_id)return false;
|
|
|
+ if(!$logistic_id)return false;
|
|
|
if(!$destination_city_id)return false;
|
|
|
if(!$carrier_weight)return false;
|
|
|
if(!$carrier_weight_unit_id)return false;
|
|
|
//多个计数标准,计算价格,取最贵
|
|
|
if ($carrier_weight[0]&&$carrier_weight[1]&&$carrier_weight_unit_id[0]&&$carrier_weight_unit_id[1]){
|
|
|
//城市价格区间不为空
|
|
|
- $waybillPriceModelOne=WaybillPriceModel::query()->where('carrier_id',$carrier_id)->where('city_id',$destination_city_id)
|
|
|
+ $waybillPriceModelOne=WaybillPriceModel::query()->where('logistic_id',$logistic_id)->where('city_id',$destination_city_id)
|
|
|
->where('range_min','<',$carrier_weight[0])->where('range_max','>=',$carrier_weight[0])
|
|
|
->where('unit_id',$carrier_weight_unit_id[0])->first();
|
|
|
- $waybillPriceModelTwo=WaybillPriceModel::query()->where('carrier_id',$carrier_id)->where('city_id',$destination_city_id)
|
|
|
+ $waybillPriceModelTwo=WaybillPriceModel::query()->where('logistic_id',$logistic_id)->where('city_id',$destination_city_id)
|
|
|
->where('range_min','<',$carrier_weight[1])->where('range_max','>=',$carrier_weight[1])
|
|
|
->where('unit_id',$carrier_weight_unit_id[1])->first();
|
|
|
if ($waybillPriceModelOne&&$waybillPriceModelTwo){
|
|
|
@@ -181,8 +183,8 @@ class WaybillController extends Controller
|
|
|
if ($waybillPriceModelTwo)return $waybillPriceModelTwo->id;
|
|
|
|
|
|
//价格区间为空
|
|
|
- $waybillPriceModelRangeOne=WaybillPriceModel::query()->whereRaw('carrier_id = ? AND city_id = ? AND unit_id = ? AND range_max IS NULL',[$carrier_id,$destination_city_id,$carrier_weight_unit_id[0]])->first();
|
|
|
- $waybillPriceModelRangeTwo=WaybillPriceModel::query()->whereRaw('carrier_id = ? AND city_id = ? AND unit_id = ? AND range_max IS NULL',[$carrier_id,$destination_city_id,$carrier_weight_unit_id[1]])->first();
|
|
|
+ $waybillPriceModelRangeOne=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND city_id = ? AND unit_id = ? AND range_max IS NULL',[$logistic_id,$destination_city_id,$carrier_weight_unit_id[0]])->first();
|
|
|
+ $waybillPriceModelRangeTwo=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND city_id = ? AND unit_id = ? AND range_max IS NULL',[$logistic_id,$destination_city_id,$carrier_weight_unit_id[1]])->first();
|
|
|
if ($waybillPriceModelRangeOne&&$waybillPriceModelRangeTwo){
|
|
|
if ($waybillPriceModelRangeOne->unit_price*$carrier_weight[0]>=$waybillPriceModelRangeTwo->unit_price*$carrier_weight[1]){
|
|
|
return $waybillPriceModelRangeOne->id;
|
|
|
@@ -195,10 +197,10 @@ class WaybillController extends Controller
|
|
|
|
|
|
//城市为空
|
|
|
$city=City::query()->where('id',$destination_city_id)->select('province_id')->first();
|
|
|
- $waybillPriceModelProvinceOne=WaybillPriceModel::query()->whereRaw('carrier_id = ? AND province_id = ? AND unit_id = ? AND range_max >= ? AND range_min < ? AND city_id IS NULL',
|
|
|
- [$carrier_id,$city->province_id,$carrier_weight_unit_id[0],$carrier_weight[0],$carrier_weight[0]])->first();
|
|
|
- $waybillPriceModelProvinceTwo=WaybillPriceModel::query()->whereRaw('carrier_id = ? AND province_id = ? AND unit_id = ? AND range_max >= ? AND range_min < ? AND city_id IS NULL',
|
|
|
- [$carrier_id,$city->province_id,$carrier_weight_unit_id[1],$carrier_weight[1],$carrier_weight[1]])->first();
|
|
|
+ $waybillPriceModelProvinceOne=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND unit_id = ? AND range_max >= ? AND range_min < ? AND city_id IS NULL',
|
|
|
+ [$logistic_id,$city->province_id,$carrier_weight_unit_id[0],$carrier_weight[0],$carrier_weight[0]])->first();
|
|
|
+ $waybillPriceModelProvinceTwo=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND unit_id = ? AND range_max >= ? AND range_min < ? AND city_id IS NULL',
|
|
|
+ [$logistic_id,$city->province_id,$carrier_weight_unit_id[1],$carrier_weight[1],$carrier_weight[1]])->first();
|
|
|
if ($waybillPriceModelProvinceOne&&$waybillPriceModelProvinceTwo){
|
|
|
if ($waybillPriceModelProvinceOne->unit_price*$carrier_weight[0]>=$waybillPriceModelProvinceTwo->unit_price*$carrier_weight[1]){
|
|
|
return $waybillPriceModelProvinceOne->id;
|
|
|
@@ -210,10 +212,10 @@ class WaybillController extends Controller
|
|
|
if ($waybillPriceModelProvinceTwo)return $waybillPriceModelProvinceTwo->id;
|
|
|
|
|
|
//城市价格区间都为空
|
|
|
- $waybillPriceModelProvinceRangeOne=WaybillPriceModel::query()->whereRaw('carrier_id = ? AND province_id = ? AND unit_id = ? AND range_max IS NULL AND city_id IS NULL',
|
|
|
- [$carrier_id,$city->province_id,$carrier_weight_unit_id[0]])->first();
|
|
|
- $waybillPriceModelProvinceRangeTwo=WaybillPriceModel::query()->whereRaw('carrier_id = ? AND province_id = ? AND unit_id = ? AND range_max IS NULL AND city_id IS NULL',
|
|
|
- [$carrier_id,$city->province_id,$carrier_weight_unit_id[1]])->first();
|
|
|
+ $waybillPriceModelProvinceRangeOne=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND unit_id = ? AND range_max IS NULL AND city_id IS NULL',
|
|
|
+ [$logistic_id,$city->province_id,$carrier_weight_unit_id[0]])->first();
|
|
|
+ $waybillPriceModelProvinceRangeTwo=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND unit_id = ? AND range_max IS NULL AND city_id IS NULL',
|
|
|
+ [$logistic_id,$city->province_id,$carrier_weight_unit_id[1]])->first();
|
|
|
if ($waybillPriceModelProvinceRangeOne&&$waybillPriceModelProvinceRangeTwo){
|
|
|
if ($waybillPriceModelProvinceRangeOne->unit_price*$carrier_weight[0]>=$waybillPriceModelProvinceRangeTwo->unit_price*$carrier_weight[1]){
|
|
|
return $waybillPriceModelProvinceRangeOne->id;
|
|
|
@@ -227,24 +229,24 @@ class WaybillController extends Controller
|
|
|
for ($i=0;$i<count($carrier_weight);$i++){
|
|
|
if ($carrier_weight[$i]&&$carrier_weight_unit_id[$i]){
|
|
|
//城市价格区间不为空
|
|
|
- $waybillPriceModel=WaybillPriceModel::query()->where('carrier_id',$carrier_id)->where('city_id',$destination_city_id)
|
|
|
+ $waybillPriceModel=WaybillPriceModel::query()->where('logistic_id',$logistic_id)->where('city_id',$destination_city_id)
|
|
|
->where('range_min','<',$carrier_weight[$i])->where('range_max','>=',$carrier_weight[$i])
|
|
|
->where('unit_id',$carrier_weight_unit_id[$i])->first();
|
|
|
if($waybillPriceModel)return $waybillPriceModel->id;
|
|
|
|
|
|
//价格区间为空
|
|
|
- $waybillPriceModelRange=WaybillPriceModel::query()->whereRaw('carrier_id = ? AND city_id = ? AND unit_id = ? AND range_max IS NULL',[$carrier_id,$destination_city_id,$carrier_weight_unit_id[$i]])->first();
|
|
|
+ $waybillPriceModelRange=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND city_id = ? AND unit_id = ? AND range_max IS NULL',[$logistic_id,$destination_city_id,$carrier_weight_unit_id[$i]])->first();
|
|
|
if ($waybillPriceModelRange){ return $waybillPriceModelRange->id;}
|
|
|
|
|
|
//城市为空
|
|
|
$city=City::where('id',$destination_city_id)->select('province_id')->first();
|
|
|
- $waybillPriceModelProvince=WaybillPriceModel::query()->whereRaw('carrier_id = ? AND province_id = ? AND unit_id = ? AND range_max >= ? AND range_min < ? AND city_id IS NULL',
|
|
|
- [$carrier_id,$city->province_id,$carrier_weight_unit_id[$i],$carrier_weight[$i],$carrier_weight[$i]])->first();
|
|
|
+ $waybillPriceModelProvince=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND unit_id = ? AND range_max >= ? AND range_min < ? AND city_id IS NULL',
|
|
|
+ [$logistic_id,$city->province_id,$carrier_weight_unit_id[$i],$carrier_weight[$i],$carrier_weight[$i]])->first();
|
|
|
if ($waybillPriceModelProvince){return $waybillPriceModelProvince->id;}
|
|
|
|
|
|
//城市价格区间都为空
|
|
|
- $waybillPriceModelProvinceRange=WaybillPriceModel::query()->whereRaw('carrier_id = ? AND province_id = ? AND unit_id = ? AND range_max IS NULL AND city_id IS NULL',
|
|
|
- [$carrier_id,$city->province_id,$carrier_weight_unit_id[$i]])->first();
|
|
|
+ $waybillPriceModelProvinceRange=WaybillPriceModel::query()->whereRaw('logistic_id = ? AND province_id = ? AND unit_id = ? AND range_max IS NULL AND city_id IS NULL',
|
|
|
+ [$logistic_id,$city->province_id,$carrier_weight_unit_id[$i]])->first();
|
|
|
if ($waybillPriceModelProvinceRange){return $waybillPriceModelProvinceRange->id;}
|
|
|
}
|
|
|
}
|
|
|
@@ -259,15 +261,15 @@ class WaybillController extends Controller
|
|
|
* 城市价格区间不为空,城市价格区间都为空,城市为空,价格区间为空
|
|
|
* */
|
|
|
public function isWaybillPriceModel(Request $request){
|
|
|
- $carrier_id=$request->input('carrier_id');
|
|
|
+ $logistic_id=$request->input('logistic_id');
|
|
|
$destination_city_id=$request->input('destination_city_id');
|
|
|
$carrier_weight=$request->input('carrier_weight');
|
|
|
$carrier_weight_unit_id=$request->input('carrier_weight_unit_id');
|
|
|
- $validatorData=["carrier_id"=>$carrier_id,"destination_city_id"=>$destination_city_id,
|
|
|
+ $validatorData=["logistic_id"=>$logistic_id,"destination_city_id"=>$destination_city_id,
|
|
|
'carrier_weight'=>$carrier_weight[0],"carrier_weight_unit_id"=>$carrier_weight_unit_id[0],
|
|
|
"carrier_weight_other"=>$carrier_weight[1],"carrier_weight_unit_id_other"=>$carrier_weight_unit_id[1]];
|
|
|
$errors=Validator::make($validatorData,[
|
|
|
- 'carrier_id'=>'required|integer',
|
|
|
+ 'logistic_id'=>'required|integer',
|
|
|
'destination_city_id'=>'required|integer',
|
|
|
'carrier_weight'=>'nullable|min:0|numeric|max:999999',
|
|
|
'carrier_weight_unit_id'=>'required_with:carrier_weight',
|
|
|
@@ -283,14 +285,14 @@ class WaybillController extends Controller
|
|
|
'integer'=>':attribute 必须为数字',
|
|
|
],[
|
|
|
'carrier_weight'=>'承运商计数(抛)',
|
|
|
- 'carrier_id'=>'承运商',
|
|
|
+ 'logistic_id'=>'承运商',
|
|
|
'destination_city_id'=>'目的市',
|
|
|
'carrier_weight_unit_id'=>'承运商计数单位',
|
|
|
'carrier_weight_other'=>'承运商计数二',
|
|
|
'carrier_weight_unit_id_other'=>'承运商计数单位二',
|
|
|
])->errors();
|
|
|
if (count($errors)>0)return ['error'=>$errors];
|
|
|
- $result=$this->checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
|
|
|
+ $result=$this->checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
|
|
|
if (!$result){
|
|
|
//单位为kg,T时
|
|
|
$unitKG=Unit::query()->where('name','kg')->first();
|
|
|
@@ -298,25 +300,25 @@ class WaybillController extends Controller
|
|
|
if ($carrier_weight_unit_id[0]==$unitKG->id){
|
|
|
$carrier_weight_unit_id[0]=$unitT->id;
|
|
|
$carrier_weight[0]=$carrier_weight[0]/1000;
|
|
|
- $result=$this->checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
|
|
|
+ $result=$this->checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
|
|
|
if ($result)return ['success'=>$result];
|
|
|
}
|
|
|
if ($carrier_weight_unit_id[1]==$unitKG->id){
|
|
|
$carrier_weight_unit_id[1]=$unitT->id;
|
|
|
$carrier_weight[1]=$carrier_weight[1]/1000;
|
|
|
- $result=$this->checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
|
|
|
+ $result=$this->checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
|
|
|
if ($result)return ['success'=>$result];
|
|
|
}
|
|
|
if ($carrier_weight_unit_id[0]==$unitT->id){
|
|
|
$carrier_weight_unit_id[0]=$unitKG->id;
|
|
|
$carrier_weight[0]=$carrier_weight[0]*1000;
|
|
|
- $result=$this->checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
|
|
|
+ $result=$this->checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
|
|
|
if ($result)return ['success'=>$result];
|
|
|
}
|
|
|
if ($carrier_weight_unit_id[1]==$unitT->id){
|
|
|
$carrier_weight_unit_id[1]=$unitKG->id;
|
|
|
$carrier_weight[1]=$carrier_weight[1]*1000;
|
|
|
- $result=$this->checkWaybillPriceModel($carrier_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
|
|
|
+ $result=$this->checkWaybillPriceModel($logistic_id,$destination_city_id,$carrier_weight,$carrier_weight_unit_id);
|
|
|
if ($result)return ['success'=>$result];
|
|
|
}
|
|
|
}
|
|
|
@@ -376,7 +378,7 @@ class WaybillController extends Controller
|
|
|
public function waybillEndAudit(Request $request){
|
|
|
if(!Gate::allows('运输管理-调度审核')){ return redirect(url('/')); }
|
|
|
$id=$request->input('id');
|
|
|
- $waybill=Waybill::query()->with(["owner","carrier","originationCity","destinationCity","carType",'priceModel',"amountUnit",
|
|
|
+ $waybill=Waybill::query()->with(["owner","logistic","originationCity","destinationCity","carType",'priceModel',"amountUnit",
|
|
|
"warehouseWeightUnit","carrierWeightUnit","warehouseWeightUnitOther","carrierWeightUnitOther"])->find($id);
|
|
|
if (!$waybill->charge&&!$waybill->collect_fee)return ['exception'=>'收费或到付费用未填!'];
|
|
|
if ($waybill->charge==0&&$waybill->collect_fee==0)return ['exception'=>'收费与到付费用都为0!'];
|
|
|
@@ -435,7 +437,7 @@ class WaybillController extends Controller
|
|
|
"charge"=>$waybill->charge,
|
|
|
"collect_fee"=>$waybill->collect_fee,
|
|
|
"ordering_remark"=>$waybill->ordering_remark,
|
|
|
- "carrier_name"=>$waybill->carrier ? $waybill->carrier->name : null,
|
|
|
+ "carrier_name"=>$waybill->logistic ? $waybill->logistic->name : null,
|
|
|
"carrier_bill"=>$waybill->carrier_bill,
|
|
|
"origination_city_name"=>$waybill->originationCity ? $waybill->originationCity->name : null,
|
|
|
"destination_city_name"=>$waybill->destinationCity ? $waybill->destinationCity->name : null,
|
|
|
@@ -578,8 +580,8 @@ class WaybillController extends Controller
|
|
|
$waybills= app('waybillService')->paginate($request->input());
|
|
|
if (!Auth::user()->isSuperAdmin()){
|
|
|
$carriersUsers=DB::table('carrier_user')->where('user_id',Auth::id())->get();
|
|
|
- $carrierIds=array_column($carriersUsers->toArray(),'carrier_id');
|
|
|
- $waybills=$waybills->whereIn("carrier_id",$carrierIds);
|
|
|
+ $carrierIds=array_column($carriersUsers->toArray(),'logistic_id');
|
|
|
+ $waybills=$waybills->whereIn("logistic_id",$carrierIds);
|
|
|
}
|
|
|
return view('waybill.delivering',compact('waybills'));
|
|
|
}
|
|
|
@@ -646,7 +648,7 @@ class WaybillController extends Controller
|
|
|
}
|
|
|
protected function validatorWaybillDispatch(Request $request,$id){
|
|
|
$rule=[
|
|
|
- 'carrier_id'=>'required|integer',
|
|
|
+ 'logistic_id'=>'required|integer',
|
|
|
'carrier_bill'=>"sometimes|nullable|max:50|unique:waybills,carrier_bill,$id",
|
|
|
'fee'=>'sometimes|nullable|min:0|numeric|max:999999',
|
|
|
'other_fee'=>'sometimes|nullable|min:0|numeric|max:999999',
|
|
|
@@ -680,7 +682,7 @@ class WaybillController extends Controller
|
|
|
'required_with'=>':attribute 未填',
|
|
|
'integer'=>':attribute 必须为数字',
|
|
|
],[
|
|
|
- 'carrier_id'=>'承运商',
|
|
|
+ 'logistic_id'=>'承运商',
|
|
|
'carrier_bill'=>'承运商单号',
|
|
|
'fee'=>'运费',
|
|
|
'other_fee'=>'其他费用',
|
|
|
@@ -735,8 +737,10 @@ class WaybillController extends Controller
|
|
|
public function recycle(Request $request){
|
|
|
if(!Gate::allows('运输管理-删除')){return redirect('/');}
|
|
|
$paginate = $request->input('paginate')??50;
|
|
|
- $waybills = Waybill::with(['owner','carrier','amountUnit','warehouseWeightUnit','carrierWeightUnit',
|
|
|
+ /** @var Collection $waybills */
|
|
|
+ $waybills = Waybill::query()->with(['owner','logistic','amountUnit','warehouseWeightUnit','carrierWeightUnit',
|
|
|
'warehouseWeightUnitOther','carrierWeightUnitOther','carType','waybillAuditLogs' => function ($query) {
|
|
|
+ /** @var Builder $query */
|
|
|
$query->with('user');
|
|
|
}])->orderBy('deleted_at', 'DESC')->withTrashed()->whereNotNull('deleted_at')->paginate(50);
|
|
|
$total = $waybills->count();
|