|
|
@@ -6,6 +6,7 @@ namespace App\Http\Controllers;
|
|
|
use App\Components\AsyncResponse;
|
|
|
use App\Region;
|
|
|
use App\Services\CarTypeService;
|
|
|
+use App\Services\common\ExportService;
|
|
|
use App\Services\LogisticService;
|
|
|
use App\Services\OwnerService;
|
|
|
use App\Services\UnitService;
|
|
|
@@ -611,22 +612,53 @@ class WaybillController extends Controller
|
|
|
return ['success'=>true];
|
|
|
}
|
|
|
|
|
|
- public function export(Request $request){
|
|
|
- if(!Gate::allows('运输管理-查询')){ return '没有权限'; }
|
|
|
- if ($request->checkAllSign){
|
|
|
- $param = $request->input();
|
|
|
- unset($param['checkAllSign']);
|
|
|
- $sql = app('waybillService')->getSql($param);
|
|
|
-
|
|
|
- }else $sql = app('waybillService')->getSql(['id'=>$request->data]);
|
|
|
- $post = Http::post(config('go.export.url'),['type'=>'waybill','sql'=>$sql]);
|
|
|
- if ($post->status() == 500){
|
|
|
- throw new Exception($post->header("Msg"));
|
|
|
- }
|
|
|
- return response($post,200, [
|
|
|
- "Content-type"=>"application/octet-stream",
|
|
|
- "Content-Disposition"=>"attachment; filename=运单列表-".date('ymdHis').'.xlsx',
|
|
|
- ]);
|
|
|
+ public function export(){
|
|
|
+ $this->gate('运输管理-查询');
|
|
|
+ if (request("checkAllSign")){
|
|
|
+ request()->offsetUnset("checkAllSign");
|
|
|
+ $waybills = app('waybillService')->get(request()->input());
|
|
|
+ }else $waybills = app('waybillService')->get(["id"=>request("id")]);
|
|
|
+ /** @var Collection $waybills */
|
|
|
+ $row = [
|
|
|
+ "运单类型", "货主", "上游单号", "wms订单号", "运单号", "运输收费",
|
|
|
+ "其他收费", "其他收费备注", "始发地", "目的地", "承运商", "承运商单号",
|
|
|
+ "仓库计抛", "承运商计抛", "仓库计重", "承运商计重", "车型", "车辆信息",
|
|
|
+ "计件", "里程数", "运费(元)", "提货费(元)", "其他费用(元)", "发货时间",
|
|
|
+ "调度备注", "创建时间"
|
|
|
+ ];
|
|
|
+ $list = [];
|
|
|
+ $waybills->each(function ($waybill)use(&$list){
|
|
|
+ $list[] = [
|
|
|
+ $waybill->type,
|
|
|
+ $waybill->order->owner->name ?? ($waybill->owner->name ?? ""),
|
|
|
+ $waybill->source_bill,
|
|
|
+ $waybill->wms_bill_number,
|
|
|
+ $waybill->waybill_number,
|
|
|
+ $waybill->waybill_number,
|
|
|
+ $waybill->charge,
|
|
|
+ $waybill->other_charge,
|
|
|
+ $waybill->other_charge_remark,
|
|
|
+ $waybill->origination,
|
|
|
+ $waybill->order->address ?? $waybill->destination,
|
|
|
+ $waybill->logistic->name ?? "",
|
|
|
+ $waybill->carrier_bill,
|
|
|
+ $waybill->warehouse_weight,
|
|
|
+ $waybill->carrier_weight,
|
|
|
+ $waybill->warehouse_weight_other,
|
|
|
+ $waybill->carrier_weight_other,
|
|
|
+ $waybill->car_type_name,
|
|
|
+ $waybill->car_owner_info,
|
|
|
+ $waybill->amount,
|
|
|
+ $waybill->mileage,
|
|
|
+ $waybill->fee,
|
|
|
+ $waybill->pick_up_fee,
|
|
|
+ $waybill->other_fee,
|
|
|
+ $waybill->deliver_at,
|
|
|
+ $waybill->dispatch_remark,
|
|
|
+ $waybill->created_at,
|
|
|
+ ];
|
|
|
+ });
|
|
|
+ return app(ExportService::class)->json($row,$list,"运输记录单");
|
|
|
}
|
|
|
|
|
|
public function deliveringExport(Request $request){
|