HandInStorageController.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Components\AsyncResponse;
  4. use App\OracleDOCASNHeader;
  5. use App\Services\HandInStorageService;
  6. use Illuminate\Http\Request;
  7. class HandInStorageController extends Controller
  8. {
  9. use AsyncResponse;
  10. /**
  11. * 搜索查詢asn
  12. */
  13. public function selectAsn(Request $request)
  14. {
  15. /** @var HandInStorageService $handInStorageService */
  16. $handInStorageService=app('HandInStorageService');
  17. $asnno= $request->input('asnno');
  18. $asns =$handInStorageService->selectAsn($asnno);
  19. if ($asns->count()>0){
  20. $this->success($asns);
  21. }else{
  22. $this->error('未搜索到ASN单');
  23. }
  24. }
  25. /**
  26. * @param $asnno
  27. * 跳转到收货明细页面
  28. */
  29. public function receiveDetailPage($asnno,$customerid)
  30. {
  31. /** @var HandInStorageService $handInStorageService */
  32. $handInStorageService=app('HandInStorageService');
  33. if (!$customerid||$customerid=='undefined')
  34. $customerid=OracleDOCASNHeader::query()->where('asnno',$asnno)->value('customerid');
  35. $qualityStatus=$handInStorageService->getQualityStatus();
  36. $attributeLocations=$handInStorageService->getAttributeLocation();
  37. return view('store.handInStorage.receiveDetailPage')
  38. ->with(['asnno'=>$asnno,'customerid'=>$customerid,'qualityStatus'=>$qualityStatus,'attributeLocations'=>$attributeLocations]);
  39. }
  40. /**
  41. * @param Request $request
  42. * 查询富勒asn_detail(集合)
  43. */
  44. public function selectAsnDetails(Request $request)
  45. {
  46. $asnno= $request->input('asnno');
  47. $asnDetails =app('HandInStorageService')->selectAsnDetails($asnno);
  48. if ($asnDetails->count()>0)$this->success($asnDetails);
  49. else $this->error('未搜索到ASN详情单');
  50. }
  51. /**
  52. * @param Request $request
  53. * 查询富勒bas_sku 并关联 bas_lotid
  54. */
  55. public function getBasSkuWithLot(Request $request): array
  56. {
  57. $customerid= $request->input('customerid');
  58. $sku= $request->input('sku');
  59. $asnno= $request->input('asnno');
  60. $asnDetail=app('HandInStorageService')->getAsnDetail($asnno,$sku);
  61. $basSku =app('HandInStorageService')->getBasSkuLotId($customerid,$sku);
  62. if (isset($basSku)&&isset($asnDetail))return ['success'=>true,'basSku'=>$basSku,'asnDetail'=>$asnDetail];
  63. else $this->error('无效条码');
  64. }
  65. public function fluxHandIn(Request $request)
  66. {
  67. $info=$request->input('info');
  68. // dd($info);
  69. if (!$info['customerid']||!$info['sku']||!$info['asnno']) $this->error('参数错误');
  70. if ($info['amount']+$info['receivedqty']>$info['expectedqty'])$this->error('收货数大于预期数');
  71. /** @var HandInStorageService $handInStorageService */
  72. $handInStorageService=app('HandInStorageService');
  73. $handInStorageService->fluxHandIn($info);
  74. // dd($result,"111");
  75. }
  76. }