UpdateWarehouseInventoryResponse.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  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\stock;
  9. class UpdateWarehouseInventoryResponse {
  10. static $_TSPEC;
  11. public $success_data = null;
  12. public $fail_data = null;
  13. public function __construct($vals=null){
  14. if (!isset(self::$_TSPEC)){
  15. self::$_TSPEC = array(
  16. 1 => array(
  17. 'var' => 'success_data'
  18. ),
  19. 2 => array(
  20. 'var' => 'fail_data'
  21. ),
  22. );
  23. }
  24. if (is_array($vals)){
  25. if (isset($vals['success_data'])){
  26. $this->success_data = $vals['success_data'];
  27. }
  28. if (isset($vals['fail_data'])){
  29. $this->fail_data = $vals['fail_data'];
  30. }
  31. }
  32. }
  33. public function getName(){
  34. return 'UpdateWarehouseInventoryResponse';
  35. }
  36. public function read($input){
  37. $input->readStructBegin();
  38. while(true){
  39. $schemeField = $input->readFieldBegin();
  40. if ($schemeField == null) break;
  41. $needSkip = true;
  42. if ("success_data" == $schemeField){
  43. $needSkip = false;
  44. $this->success_data = array();
  45. $_size1 = 0;
  46. $input->readListBegin();
  47. while(true){
  48. try{
  49. $elem1 = null;
  50. $elem1 = new \vipapis\stock\UpdateWarehouseInventoryResult();
  51. $elem1->read($input);
  52. $this->success_data[$_size1++] = $elem1;
  53. }
  54. catch(\Exception $e){
  55. break;
  56. }
  57. }
  58. $input->readListEnd();
  59. }
  60. if ("fail_data" == $schemeField){
  61. $needSkip = false;
  62. $this->fail_data = array();
  63. $_size2 = 0;
  64. $input->readListBegin();
  65. while(true){
  66. try{
  67. $elem2 = null;
  68. $elem2 = new \vipapis\stock\UpdateWarehouseInventoryResult();
  69. $elem2->read($input);
  70. $this->fail_data[$_size2++] = $elem2;
  71. }
  72. catch(\Exception $e){
  73. break;
  74. }
  75. }
  76. $input->readListEnd();
  77. }
  78. if($needSkip){
  79. \Osp\Protocol\ProtocolUtil::skip($input);
  80. }
  81. $input->readFieldEnd();
  82. }
  83. $input->readStructEnd();
  84. }
  85. public function write($output){
  86. $xfer = 0;
  87. $xfer += $output->writeStructBegin();
  88. if($this->success_data !== null) {
  89. $xfer += $output->writeFieldBegin('success_data');
  90. if (!is_array($this->success_data)){
  91. throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
  92. }
  93. $output->writeListBegin();
  94. foreach ($this->success_data as $iter0){
  95. if (!is_object($iter0)) {
  96. throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
  97. }
  98. $xfer += $iter0->write($output);
  99. }
  100. $output->writeListEnd();
  101. $xfer += $output->writeFieldEnd();
  102. }
  103. if($this->fail_data !== null) {
  104. $xfer += $output->writeFieldBegin('fail_data');
  105. if (!is_array($this->fail_data)){
  106. throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
  107. }
  108. $output->writeListBegin();
  109. foreach ($this->fail_data as $iter0){
  110. if (!is_object($iter0)) {
  111. throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
  112. }
  113. $xfer += $iter0->write($output);
  114. }
  115. $output->writeListEnd();
  116. $xfer += $output->writeFieldEnd();
  117. }
  118. $xfer += $output->writeFieldStop();
  119. $xfer += $output->writeStructEnd();
  120. return $xfer;
  121. }
  122. }
  123. ?>