gate("入库管理-手持入库-收货"); /** @var HandInStorageService $handInStorageService */ $handInStorageService=app('HandInStorageService'); $asnno= $request->input('asnno'); $asns =$handInStorageService->selectAsn($asnno); if (count($asns)>0){ foreach ($asns as $asn){ $asn->asnDetails=array(); } $this->success($asns); }else{ $this->error('无有效的ASN的订单'); } } public function checkAsnOperation(Request $request) { $this->gate("入库管理-手持入库-收货"); /** @var HandInStorageService $handInStorageService */ $handInStorageService=app('HandInStorageService'); $info= $request->input('info'); $res=$handInStorageService->checkAsnOperation($info); if ($res===1)$this->error('无有效的ASN的订单'); elseif ($res===2)$this->error('该asn无预约,暂不可收货'); else $this->success($res); } /** * @param $asnno * 跳转到收货明细页面 */ public function receiveDetailPage($asnno,$customerid) { $this->gate("入库管理-手持入库-收货"); /** @var HandInStorageService $handInStorageService */ $handInStorageService=app('HandInStorageService'); if (!$customerid||$customerid=='undefined') $customerid=OracleDOCASNHeader::query()->where('asnno',$asnno)->value('customerid'); $qualityStatus=$handInStorageService->getQualityStatus(); $attributeLocations=$handInStorageService->getAttributeLocation(); return view('store.handInStorage.receiveDetailPage') ->with(['asnno'=>$asnno,'customerid'=>$customerid,'qualityStatus'=>$qualityStatus,'attributeLocations'=>$attributeLocations]); } /** * @param Request $request * 查询富勒asn_detail(集合) */ public function selectAsnDetails(Request $request) { $this->gate("入库管理-手持入库-收货"); $asnno= $request->input('asnno'); $asnDetails =app('HandInStorageService')->selectAsnDetails($asnno); if (count($asnDetails)>0)$this->success($asnDetails); else $this->error('未查询到相应的asn明细'); } /** * @param Request $request * 查询富勒bas_sku 并关联 bas_lotid */ public function getBasSkuWithLot(Request $request): array { $customerid= $request->input('customerid'); $skuOrBarcode= $request->input('sku'); $asnno= $request->input('asnno'); $asnDetail=app('HandInStorageService')->getAsnDetail($asnno,$skuOrBarcode); if (!$asnDetail)$this->error('无效条码'); $basSku =app('HandInStorageService')->getBasSkuLotId($customerid,$asnDetail->sku); if (isset($basSku)&&isset($asnDetail))return ['success'=>true,'basSku'=>$basSku,'asnDetail'=>$asnDetail]; else $this->error('无效条码'); } /** * @throws \Throwable * 收货 */ public function fluxHandIn(Request $request) { $this->gate("入库管理-手持入库-收货"); $info=$request->input('info'); if (!$info['customerid']||!$info['sku']||!$info['asnno']) $this->error('参数错误'); if ($info['amount']+$info['receivedqty']>$info['expectedqty'])$this->error('收货数大于预期数'); // if ($info['location']){ // $location=OracleBasLocation::query() // ->where('locationid',$info['location']) // ->where('status','OK') // ->first(); // if (!$location)$this->error('目标库位不存在'); // } /** @var HandInStorageService $handInStorageService */ $handInStorageService=app('HandInStorageService'); try { $result = $handInStorageService->fluxHandIn($info); if ($result)$this->success("收货成功"); else $this->error("收货失败"); } catch (\Exception $e) { app('LogService')->log(__METHOD__,'error_'.__FUNCTION__,json_encode($info).'|catch:'.$e->getMessage()); } } /** * @param Request $request * 根据商品条码和跟踪号 获取要上架的任务列表 */ public function getTsk(Request $request) { $this->gate("入库管理-手持入库-上架"); $barCode=$request->input('barCode'); $trackNumber=$request->input('trackNumber'); if(!$barCode)$this->error('条码不能为空'); if(!$trackNumber)$this->error('容器号不能为空'); /** @var HandInStorageService $handInStorageService */ $handInStorageService=app('HandInStorageService'); $tasks=$handInStorageService->getTsk($trackNumber,$barCode); if (count($tasks)>0)$this->success($tasks); else $this->error("该商品暂无上架任务"); } /** * @throws \Throwable * 上架 */ public function handFluxPa(Request $request) { $this->gate("入库管理-手持入库-上架"); $info=$request->input('info'); if (!$info['location']||!$info['amount']||!$info['trackNumber']||!$info['barCode']) $this->error('参数错误'); if (count($request->input('checkData'))==0) $this->error('请勾选要上架任务'); $checkData=$request->input('checkData')[0]; $location=OracleBasLocation::query() ->where('locationid',$info['location']) ->where('status','OK') ->first(); if (!$location)$this->error('目标库位不存在'); /** @var HandInStorageService $handInStorageService */ $handInStorageService=app('HandInStorageService'); try { $result = $handInStorageService->fluxHandPa($info, $checkData); if ($result)$this->success("上架成功"); else $this->error("上架失败"); } catch (\Exception $e) { app('LogService')->log(__METHOD__,'error_'.__FUNCTION__,json_encode($info).'|catch:'.$e->getMessage()); } } }