|
|
@@ -30,12 +30,12 @@ class DischargeTaskController extends Controller
|
|
|
return redirect(url('/'));
|
|
|
}
|
|
|
|
|
|
- $dischargeTasks = DischargeTask::query()->with(['facilitator', 'owner','warehouse'])->filter($filters)->orderByDesc('id')->paginate($request['paginate'] ?? 50);
|
|
|
+ $dischargeTasks = DischargeTask::query()->with(['facilitator', 'owner', 'warehouse'])->filter($filters)->orderByDesc('id')->paginate($request['paginate'] ?? 50);
|
|
|
$owners = app(OwnerService::class)->getAuthorizedOwners();
|
|
|
- $warehouses = Warehouse::query()->select('id','name')->get();
|
|
|
+ $warehouses = Warehouse::query()->select('id', 'name')->get();
|
|
|
$facilitators = Facilitator::query()->select('name', 'id')->get();
|
|
|
|
|
|
- return view('personnel.discharge.task.index', compact('dischargeTasks', 'owners', 'facilitators','warehouses'));
|
|
|
+ return view('personnel.discharge.task.index', compact('dischargeTasks', 'owners', 'facilitators', 'warehouses'));
|
|
|
}
|
|
|
|
|
|
// 结算报表
|
|
|
@@ -132,34 +132,36 @@ class DischargeTaskController extends Controller
|
|
|
{
|
|
|
$this->gate('人事管理-卸货-结算报表-查询');
|
|
|
|
|
|
- $dischargeTasks = DischargeTask::query()->with(['facilitator', 'owner','warehouse'])->filter($filters)->orderByDesc('id')->get();
|
|
|
+ $dischargeTasks = DischargeTask::query()->with(['facilitator', 'owner', 'warehouse'])->filter($filters)->orderByDesc('id')->get();
|
|
|
|
|
|
- $row = ['日期', '客户名称','仓库', '作业名称', '入库单号', '数量', '单位', '收入单价', '收入合计', '装卸队', '数量', '单位', '支出单价', '支出合计', '状态', '收入备注', '支出备注'];
|
|
|
+ $row = ['日期', '客户名称', '仓库', '作业名称', '入库单号', '数量', '单位', '收入单价', '收入合计', '装卸队', '数量', '单位', '支出单价', '支出合计', '状态', '收入备注', '支出备注'];
|
|
|
$json = app('DischargeTaskService')->getStatementsJson($dischargeTasks);
|
|
|
|
|
|
return app(ExportService::class)->json($row, $json, "卸货结算报表");
|
|
|
}
|
|
|
|
|
|
- // 回执单
|
|
|
public function receipt(Request $request)
|
|
|
{
|
|
|
- $task = DischargeTask::query()->with(['facilitator', 'owner','warehouse'])->where('id' , $request['id'])->first();
|
|
|
+ $task = DischargeTask::query()->with(['facilitator', 'owner', 'warehouse'])->where('id', $request['id'])->first();
|
|
|
$task->type = DischargeTask::types[$task->type];
|
|
|
- return view('personnel.discharge.task.receipt',compact('task'));
|
|
|
+ return view('personnel.discharge.task.receipt', compact('task'));
|
|
|
}
|
|
|
|
|
|
public function importApi(Request $request): array
|
|
|
{
|
|
|
- $extension=$request->file()['file']->getClientOriginalExtension();
|
|
|
+ $this->gate('人事管理-卸货-创建');
|
|
|
+
|
|
|
+ $extension = $request->file()['file']->getClientOriginalExtension();
|
|
|
+ if (in_array($extension, ['xlsx', 'xlsm', 'xltx', 'xltm', 'xls', 'xlt', 'ods', 'ots', 'slk', 'xml', 'gnumeric', 'htm', 'html', 'csv', 'tsv']))
|
|
|
+ return ['success' => false,'请检查导入文件是否符合要求'];
|
|
|
$extension[0] = strtoupper($extension[0]);
|
|
|
try {
|
|
|
Excel::import(new DischargeTaskImport(), $request->file()['file']->path(), null, $extension);
|
|
|
} catch (\Exception $e) {
|
|
|
- dd($e->getMessage());
|
|
|
- return ['success'=>false,'message' => ['请检查导入文件是否符合要求']];
|
|
|
+ return ['success' => false, 'message' => ['请检查导入文件是否符合要求']];
|
|
|
}
|
|
|
- if(Cache::has('exception')){
|
|
|
- return ['success' => false,'errors' => Cache::get('exception')];
|
|
|
+ if (Cache::has('exception')) {
|
|
|
+ return ['success' => false, 'errors' => Cache::get('exception')];
|
|
|
}
|
|
|
return ['success' => true];
|
|
|
}
|
|
|
@@ -168,18 +170,23 @@ class DischargeTaskController extends Controller
|
|
|
public function show(DischargeTask $dischargeTask)
|
|
|
{
|
|
|
}
|
|
|
+
|
|
|
public function edit(DischargeTask $dischargeTask)
|
|
|
{
|
|
|
}
|
|
|
+
|
|
|
public function update(Request $request, DischargeTask $dischargeTask)
|
|
|
{
|
|
|
}
|
|
|
+
|
|
|
public function store(Request $request)
|
|
|
{
|
|
|
}
|
|
|
+
|
|
|
public function create()
|
|
|
{
|
|
|
}
|
|
|
+
|
|
|
public function destroy(DischargeTask $dischargeTask)
|
|
|
{
|
|
|
|