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(); $asnQty=$handInStorageService->getAsnQty($asnno); return view('store.handInStorage.receiveDetailPage') ->with(['asn_expectedqty'=>$asnQty->expectedqty,'asn_receivedqty'=>$asnQty->receivedqty, '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 { $start=microtime(true); $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); $end=microtime(true); if(($end-$start)>1)Log::warning('手持条码获取详情超时',$request->all()); if (isset($basSku)&&isset($asnDetail))return ['success'=>true,'basSku'=>$basSku,'asnDetail'=>$asnDetail]; else $this->error('无效条码'); } /** * @throws \Throwable * 收货 */ public function fluxHandIn(Request $request) { $start=microtime(true); $this->gate("入库管理-手持入库-收货"); $info=$request->input('info'); if ($info['lotatt02']&&Carbon::now()->gt($info['lotatt02']))$this->error('失效日期超过入库效期'); if (!$info['customerid']||!$info['sku']||!$info['asnno']) $this->error('参数错误'); if ($info['amount']+$info['receivedqty']>$info['expectedqty'])$this->error('收货数大于预期数'); /** @var HandInStorageService $handInStorageService */ $handInStorageService=app('HandInStorageService'); if ($info['customerid']=='ONKYO'||$info['customerid']=='ANMEILAI'||$info['customerid']=='FEIHE'){ $res=$handInStorageService->checkWidthHeight($info); if ($res===1)$this->error('需要维护产品档案'); if ($res===2)$this->error('需要维护该产品档案中的长宽高'); } if ($info['customerid']=='TANGENBEI'||$info['customerid']=='ANMEILAI'){ $result=$handInStorageService->checkCubicWeight($info); if ($result===1)$this->error('需要维护产品档案'); if ($result===2)$this->error('需要维护该产品档案中的重量体积'); } if ($info['customerid']=='JIANSHANG'&&$handInStorageService->checkForwardingLoc($info)===1)$this->error('请维护拣货位'); try { $resultIn = $handInStorageService->fluxHandIn($info); if ($resultIn===1)$this->error("超收"); if ($resultIn){ $asnQty=$handInStorageService->getAsnQty($info['asnno']); $end=microtime(true); if(($end-$start)>2)Log::warning('手持收货超时',$request->all()); $this->success($asnQty); } 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'); /** @var HandInStorageService $handInStorageService */ $handInStorageService=app('HandInStorageService'); $tasks=$handInStorageService->getTsk($trackNumber,$barCode); if (count($tasks)>0){ $invLots=$handInStorageService->getInvotlocid($barCode); $collect= collect(); foreach ($invLots as $invLot){ if ($invLot->locationid=='STAGEWH01'||$invLot->locationid=='STAGEWH02')continue; $collect->push($invLot); } return json_encode(["success"=>true,'data'=>$tasks,'inv'=>$collect]); } else $this->error("该商品暂无上架任务"); } /** * @param Request $request * 根据customerid,asnno,跟踪号 或空扫 获取待上架任务 */ public function getPaTaskByTraceInOrCustomerOrAsnOrNull(Request $request) { $this->gate("入库管理-手持入库-上架"); $trackNumber=$request->input('trackNumber'); $barCode=$request->input('barCode'); /** @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['barCode']) $this->error('参数错误'); if (count($request->input('checkData'))==0) $this->error('请勾选要上架任务'); $checkData=$request->input('checkData')[0]; /** @var HandInStorageService $handInStorageService */ $handInStorageService=app('HandInStorageService'); //判断当前库位是否能放该商品 $res=$handInStorageService->checkLocation($info,$checkData); if ($res===1)$this->error('库位不存在'); if ($res===2)$this->error('库位:产品和批次不可混放'); if ($res===3)$this->error('库位:不能混放批次'); if ($res===4)$this->error('库位:产品不能混放'); try { $result = $handInStorageService->fluxHandPa($info, $checkData); if ($result===true)$this->success("上架成功"); if ($result===false) $this->error("上架失败"); if ($result===1)$this->error("拣货区找到效期更新的同样货品,不能上架至存储区"); } catch (\Exception $e) { $this->error($e->getMessage()); app('LogService')->log(__METHOD__,'error_'.__FUNCTION__,json_encode($info).'|catch:'.$e->getMessage()); } } public function getInventoryInfos(Request $request) { $this->gate("入库管理-手持入库-库存查询"); $param=$request->input('location'); /** @var HandInStorageService $handInStorageService */ $handInStorageService=app('HandInStorageService'); $invs=$handInStorageService->getInventoryInfos($param); if (count($invs)>0)$this->success($invs); else $this->error('未查询到库存信息'); } }