BinLocation.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace App\Http\Controllers\api\thirdPart\syrius\producer;
  3. class BinLocation extends Controller
  4. {
  5. /**
  6. * 建立新库位
  7. *
  8. * @param string $locationId
  9. * @param \stdClass $warehouse {id:"",name:""}
  10. * @param \stdClass $attribute {id:"",layer:0,num:0}
  11. *
  12. */
  13. public function createBinLocation(string $locationId, \stdClass $warehouse, \stdClass $attribute)
  14. {
  15. $this->method = "post";
  16. $this->url = config("api.syrius.request.bin_location");
  17. $this->data = [[
  18. "binLocationId" => $locationId, //库位ID
  19. "warehouseId" => $warehouse->id, //仓库ID
  20. "warehouseName" => $warehouse->name,//仓库名
  21. "attributes" => [
  22. "shelfId" => $attribute->id, //架ID
  23. "shelfLayer" => $attribute->layer, //架层
  24. "numOfLayer" => $attribute->num, //架层数
  25. ],
  26. ]];
  27. $this->response();
  28. }
  29. /**
  30. * 获取库位
  31. *
  32. * @param string|array $locationId
  33. * @param string $warehouseId
  34. * @param int $page
  35. * @param int $paginate
  36. */
  37. public function getBinLocation($locationId, string $warehouseId, int $page = 0, int $paginate= 1)
  38. {
  39. if (!is_array($locationId))$locationId = [$locationId];
  40. $this->method = "get";
  41. $this->url = config("api.syrius.request.find_all_bin_location");
  42. $this->data = [
  43. "pageIndex" => $page, //页数
  44. "pageSize" => $paginate, //行数
  45. "warehouseId"=> $warehouseId, //仓库ID
  46. "binLocationIds"=> $locationId, //库位ID数组
  47. ];
  48. $this->response();
  49. }
  50. /**
  51. * 删除库位
  52. *
  53. * @param string|array $locationId
  54. * @param string $warehouseId
  55. */
  56. public function delBinLocation($locationId, string $warehouseId)
  57. {
  58. if (!is_array($locationId))$locationId = [$locationId];
  59. $this->method = "delete";
  60. $this->url = config("api.syrius.request.delete_bin_location");
  61. $this->data = [
  62. "warehouseId" => $warehouseId,
  63. "binLocationIds" => $locationId
  64. ];
  65. $this->response();
  66. }
  67. }