| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Http\ApiControllers;
- use App\Components\ApiResponse;
- use App\Http\Requests\AndroidGateRequest;
- use App\InventoryAccount;
- class InventoryController
- {
- use ApiResponse;
- /**
- * @api {get} /inventory/inventoryTasks 获取盘点任务数据
- * @apiName inventoryTasks
- * @apiGroup inventory
- *
- * @apiParam {int} page 页数
- * @apiParam {int} paginate 每页多少
- *
- * @apiSuccess {string} message 响应描述
- * @apiSuccess {int} status_code HTTP响应码
- * @apiSuccess {array} data 数据列表
- *
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * "message": "请求成功",
- * "status_code": "200"
- * "data":[
- * {
- * "id"=>"宝时单号",
- * "created_at" =>"任务创建时间",
- * "end_at" =>"库位最后操作时间",
- * "owner_name"=>"货主名",
- * "type"=>"任务类型",
- * "total"=>"盘点任务数",
- * "processed"=>"盘点数",
- * }
- * ]
- * }
- */
- public function inventoryTasks(AndroidGateRequest $request)
- {
- $page = $request->input("page",1);
- $paginate = $request->input("paginate",20);
- $ownerIds=app('OwnerService')->getSelection();
- $inventories=InventoryAccount::query()->with('owner')
- ->orderBy('id','desc')
- ->whereIn('status',['待盘点','盘点中','复盘中'])
- ->whereIn('owner_id',$ownerIds)
- ->paginate($paginate,'*', 'page',$page)
- ->append(["owner_name"]);
- $this->response(['inventories'=>$inventories]);
- }
- }
|