0, * "inventoryTask" => { * "id" =>"盘点任务号", * "created_at" =>"任务创建时间", * "end_at" =>"库位最后操作时间", * "type"=>"任务类型", * "total"=>"盘点任务数", * "processed"=>"盘点数", * }, * "notStocktakingList"=> [ * { * "location" =>"库位", * "count" =>"未盘商品数", * } * ] * ] * } */ public function getInventoryTask(Request $request) { $taskId = $request->input("taskId"); /** @var AndroidInventoryService $service */ $service=app('AndroidInventoryService'); if (!$taskId) $this->response(null,410,"未获取到任务号"); $stocktakingTask = InventoryAccount::query() ->whereIn('status',['待盘点','盘点中','复盘中']) ->where('id',$taskId) ->first(); if (!$stocktakingTask) $this->response(null,410,"未查询到盘点任务"); $notStocktakingList=$service->getUnInventoryTaskList($taskId); $sameDayInventoryCount=$service->getStaffSameDayInvCount(); $this->response(['stocktakingTask' => $stocktakingTask, 'notStocktakingList' => $notStocktakingList, 'sameDayInventoryCount'=>$sameDayInventoryCount ]); } /** * @api {post} /inventory/locationInvPro 当前库位下盘点比例 * @apiName locationInvPro * @apiGroup inventory * * @apiParam {int} taskId 盘点任务号 * @apiParam {string} location 库位 * * @apiSuccess {string} message 响应描述 * @apiSuccess {int} status_code HTTP响应码 * @apiSuccess {object} data * * @apiSuccessExample {json} Success-Response: * HTTP/1.1 200 OK * { * "message": "请求成功", * "status_code": "200" * "data":{ * "total" =>"库位盘点任务总条数", * "invCount" =>"已盘条数" * } * } */ public function locationInvPro(Request $request) { $taskId = $request->input("taskId"); $location = $request->input("location"); $res=app('AndroidInventoryService')->getLocInvPro($taskId,$location); if ($res===0){ $this->response(null,410,"库位不存在!"); }else{ $this->response($res); } } /** * @api {post} /inventory/getInventoryDetail 根据盘点任务号,库位,条码 获取盘点明细 * @apiName getInventoryDetail * @apiGroup inventory * * @apiParam {int} taskId 盘点任务号 * @apiParam {string} location 库位 * @apiParam {string} barcode 条码 * * @apiSuccess {string} message 响应描述 * @apiSuccess {int} status_code HTTP响应码 * @apiSuccess {object} data * * @apiSuccessExample {json} Success-Response: * HTTP/1.1 200 OK * { * "message": "请求成功", * "status_code": "200" * "data":{ * "id" =>"盘点任务明细号", * "verified_amount" =>"已盘数量", * "produced_at"=>"生产日期", * "valid_at"=>"失效日期", * "batch_number"=>"批号", * "erp_type_position"=>"属性仓", * "quality"=>"质量状态", * } * } */ public function getInventoryDetail(Request $request) { $taskId = $request->input("taskId"); $location = $request->input("location"); $barcode = $request->input("barcode"); $inventoryDetail=app('AndroidInventoryService')->getInventoryDetail($taskId,$location,$barcode); if ($inventoryDetail) { $this->response($inventoryDetail); }else{ $this->response(null,410,'未检测到指定盘点任务'); } } /** * @api {post} /inventory/stockInventory 盘点 * @apiName stockInventory * @apiGroup inventory * * @apiParam {int} taskId 盘点任务号 * @apiParam {string} location 库位 * @apiParam {string} barcode 条码 * @apiParam {int} amount 盘点数量 * * @apiSuccess {string} message 响应描述 * @apiSuccess {int} status_code HTTP响应码 * @apiSuccess {array} data 数据列表 * @apiSuccess {bool} isDiff 是否差异 * * @apiSuccessExample {json} Success-Response: * HTTP/1.1 200 OK * { * "message": "请求成功", * "status_code": "200" * "data":[ * “isDiff”=>“是否差异", * "notStocktakingList"=>[ * { * "location"=>"库位", * "count"=>"待盘数量", * } * ] * ] * } */ public function stockInventory(Request $request) { $task_item_id = $request->input("task_item_id"); $verified_amount = $request->input("verified_amount"); /** * @var AndroidInventoryService $service *@var InventoryAccountService $stockService */ $service=app('AndroidInventoryService'); $stockService=app('InventoryAccountService'); $inventoryAccountMission=InventoryAccountMission::query()->find($task_item_id); if (!$inventoryAccountMission)$this->response(null,410,'未查询到盘点明细'); $task_id=$inventoryAccountMission->inventory_account_id; if (!$request->has('produced_at')&&!$request->has('valid_at')&&!$request->has('batch_number')){ $stockDetail=$stockService->盘点($task_id,$verified_amount,$inventoryAccountMission); }else{ $stockDetail=$stockService->盘点生产日期_失效日期_批号有改动任务($task_item_id, $verified_amount, $task_id, $request->input('produced_at')??'', $request->input('valid_at')??'', $request->input('batch_number')??''); $stockService->updateInventory($task_id); } if ($stockDetail->difference_amount==0){ $isDiff=false; }else{ $isDiff=true; } $notStocktakingList=$service->getUnInventoryTaskList($task_id); $this->response(['isDiff'=>$isDiff,'notStocktakingList'=>$notStocktakingList]); } /** * @api {post} /inventory/skipInventory 跳过盘点 * @apiName skipInventory * @apiGroup inventory * * @apiParam {int} inventoryDetailId 盘点任务明细id * * @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":[ * inventoryTaskDetails=>[ * { * "id"=>"盘点任务明细号", * "location"=>"库位", * } * ] * sameDayInventoryCount=>“当日盘点行数” * ] * } */ public function skipInventory(Request $request) { $inventoryDetailId = $request->input("inventoryDetailId"); /** @var AndroidInventoryService $service */ $service=app('AndroidInventoryService'); $inv=$service->skipInventory($inventoryDetailId); if ($inv){ $inventoryTaskDetails=$service->getUnInventoryTaskList($inv->inventory_account_id); $sameDayInventoryCount=$service->getStaffSameDayInvCount(); $this->response([ 'inventoryTaskDetails' => $inventoryTaskDetails, 'sameDayInventoryCount'=>$sameDayInventoryCount ]); }else{ $this->response(null,410,'跳过失败!'); } } }