GetSkuPriceRequest.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <?php
  2. /*
  3. * Copyright (c) 2008-2016 vip.com, All Rights Reserved.
  4. *
  5. * Powered by com.vip.osp.osp-idlc-2.5.11.
  6. *
  7. */
  8. namespace vipapis\delivery;
  9. class GetSkuPriceRequest {
  10. static $_TSPEC;
  11. public $vendor_id = null;
  12. public $po_no = null;
  13. public $barcodes = null;
  14. public $effective_time = null;
  15. public $schedule_id = null;
  16. public function __construct($vals=null){
  17. if (!isset(self::$_TSPEC)){
  18. self::$_TSPEC = array(
  19. 1 => array(
  20. 'var' => 'vendor_id'
  21. ),
  22. 2 => array(
  23. 'var' => 'po_no'
  24. ),
  25. 3 => array(
  26. 'var' => 'barcodes'
  27. ),
  28. 4 => array(
  29. 'var' => 'effective_time'
  30. ),
  31. 5 => array(
  32. 'var' => 'schedule_id'
  33. ),
  34. );
  35. }
  36. if (is_array($vals)){
  37. if (isset($vals['vendor_id'])){
  38. $this->vendor_id = $vals['vendor_id'];
  39. }
  40. if (isset($vals['po_no'])){
  41. $this->po_no = $vals['po_no'];
  42. }
  43. if (isset($vals['barcodes'])){
  44. $this->barcodes = $vals['barcodes'];
  45. }
  46. if (isset($vals['effective_time'])){
  47. $this->effective_time = $vals['effective_time'];
  48. }
  49. if (isset($vals['schedule_id'])){
  50. $this->schedule_id = $vals['schedule_id'];
  51. }
  52. }
  53. }
  54. public function getName(){
  55. return 'GetSkuPriceRequest';
  56. }
  57. public function read($input){
  58. $input->readStructBegin();
  59. while(true){
  60. $schemeField = $input->readFieldBegin();
  61. if ($schemeField == null) break;
  62. $needSkip = true;
  63. if ("vendor_id" == $schemeField){
  64. $needSkip = false;
  65. $input->readI32($this->vendor_id);
  66. }
  67. if ("po_no" == $schemeField){
  68. $needSkip = false;
  69. $input->readString($this->po_no);
  70. }
  71. if ("barcodes" == $schemeField){
  72. $needSkip = false;
  73. $this->barcodes = array();
  74. $_size0 = 0;
  75. $input->readListBegin();
  76. while(true){
  77. try{
  78. $elem0 = null;
  79. $input->readString($elem0);
  80. $this->barcodes[$_size0++] = $elem0;
  81. }
  82. catch(\Exception $e){
  83. break;
  84. }
  85. }
  86. $input->readListEnd();
  87. }
  88. if ("effective_time" == $schemeField){
  89. $needSkip = false;
  90. $input->readString($this->effective_time);
  91. }
  92. if ("schedule_id" == $schemeField){
  93. $needSkip = false;
  94. $input->readI64($this->schedule_id);
  95. }
  96. if($needSkip){
  97. \Osp\Protocol\ProtocolUtil::skip($input);
  98. }
  99. $input->readFieldEnd();
  100. }
  101. $input->readStructEnd();
  102. }
  103. public function write($output){
  104. $xfer = 0;
  105. $xfer += $output->writeStructBegin();
  106. $xfer += $output->writeFieldBegin('vendor_id');
  107. $xfer += $output->writeI32($this->vendor_id);
  108. $xfer += $output->writeFieldEnd();
  109. $xfer += $output->writeFieldBegin('po_no');
  110. $xfer += $output->writeString($this->po_no);
  111. $xfer += $output->writeFieldEnd();
  112. $xfer += $output->writeFieldBegin('barcodes');
  113. if (!is_array($this->barcodes)){
  114. throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
  115. }
  116. $output->writeListBegin();
  117. foreach ($this->barcodes as $iter0){
  118. $xfer += $output->writeString($iter0);
  119. }
  120. $output->writeListEnd();
  121. $xfer += $output->writeFieldEnd();
  122. if($this->effective_time !== null) {
  123. $xfer += $output->writeFieldBegin('effective_time');
  124. $xfer += $output->writeString($this->effective_time);
  125. $xfer += $output->writeFieldEnd();
  126. }
  127. if($this->schedule_id !== null) {
  128. $xfer += $output->writeFieldBegin('schedule_id');
  129. $xfer += $output->writeI64($this->schedule_id);
  130. $xfer += $output->writeFieldEnd();
  131. }
  132. $xfer += $output->writeFieldStop();
  133. $xfer += $output->writeStructEnd();
  134. return $xfer;
  135. }
  136. }
  137. ?>