StockService.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. declare(strict_types=1);
  3. namespace SixShop\Wangdian\Services;
  4. use SixShop\Wangdian\Response\ApiResponse;
  5. /**
  6. * Stock service for inventory management, transfers, etc.
  7. */
  8. class StockService extends BaseService
  9. {
  10. /**
  11. * Query stock information
  12. */
  13. public function query(array $params = []): ApiResponse
  14. {
  15. return $this->call('stock_query.php', $this->filterParams($params));
  16. }
  17. /**
  18. * Push stock transfer
  19. */
  20. public function pushTransfer(array $transferData): ApiResponse
  21. {
  22. $this->validateRequired($transferData, ['transfer_info']);
  23. return $this->call('stock_transfer_push.php', [
  24. 'transfer_info' => $this->encodeIfArray($transferData['transfer_info']),
  25. ]);
  26. }
  27. /**
  28. * Query stock transfer
  29. */
  30. public function queryTransfer(array $params = []): ApiResponse
  31. {
  32. return $this->call('stock_transfer_query.php', $this->filterParams($params));
  33. }
  34. /**
  35. * Push stockin order
  36. */
  37. public function pushStockinOrder(array $orderData): ApiResponse
  38. {
  39. $this->validateRequired($orderData, ['stockin_info']);
  40. return $this->call('stockin_order_push.php', [
  41. 'stockin_info' => $this->encodeIfArray($orderData['stockin_info']),
  42. ]);
  43. }
  44. /**
  45. * Query stockin order
  46. */
  47. public function queryStockinOrder(array $params = []): ApiResponse
  48. {
  49. return $this->call('stockin_order_query.php', $this->filterParams($params));
  50. }
  51. /**
  52. * Push stockout order
  53. */
  54. public function pushStockoutOrder(array $orderData): ApiResponse
  55. {
  56. $this->validateRequired($orderData, ['stockout_info']);
  57. return $this->call('stockout_order_push.php', [
  58. 'stockout_info' => $this->encodeIfArray($orderData['stockout_info']),
  59. ]);
  60. }
  61. /**
  62. * Query stockout order
  63. */
  64. public function queryStockoutOrder(array $params = []): ApiResponse
  65. {
  66. return $this->call('stockout_order_query.php', $this->filterParams($params));
  67. }
  68. /**
  69. * Push stockin transfer
  70. */
  71. public function pushStockinTransfer(array $transferData): ApiResponse
  72. {
  73. return $this->call('stockin_transfer_push.php',
  74. $this->filterParams($transferData)
  75. );
  76. }
  77. /**
  78. * Push stockout transfer
  79. */
  80. public function pushStockoutTransfer(array $transferData): ApiResponse
  81. {
  82. return $this->call('stockout_transfer_push.php',
  83. $this->filterParams($transferData)
  84. );
  85. }
  86. /**
  87. * Sync stock by PD (盘点)
  88. */
  89. public function syncByPd(array $pdData): ApiResponse
  90. {
  91. return $this->call('stock_sync_by_pd.php',
  92. $this->filterParams($pdData)
  93. );
  94. }
  95. /**
  96. * Query stock PD order
  97. */
  98. public function queryPdOrder(array $params = []): ApiResponse
  99. {
  100. return $this->call('stock_pd_order_query.php', $this->filterParams($params));
  101. }
  102. }