SalesOrderDetail.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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\finance;
  9. class SalesOrderDetail {
  10. static $_TSPEC;
  11. public $order_id = null;
  12. public $barcode = null;
  13. public $amount = null;
  14. public $price = null;
  15. public $brand_name = null;
  16. public $product_name = null;
  17. public $brand_id = null;
  18. public $date = null;
  19. public $order_type = null;
  20. public function __construct($vals=null){
  21. if (!isset(self::$_TSPEC)){
  22. self::$_TSPEC = array(
  23. 1 => array(
  24. 'var' => 'order_id'
  25. ),
  26. 2 => array(
  27. 'var' => 'barcode'
  28. ),
  29. 3 => array(
  30. 'var' => 'amount'
  31. ),
  32. 4 => array(
  33. 'var' => 'price'
  34. ),
  35. 5 => array(
  36. 'var' => 'brand_name'
  37. ),
  38. 6 => array(
  39. 'var' => 'product_name'
  40. ),
  41. 7 => array(
  42. 'var' => 'brand_id'
  43. ),
  44. 8 => array(
  45. 'var' => 'date'
  46. ),
  47. 9 => array(
  48. 'var' => 'order_type'
  49. ),
  50. );
  51. }
  52. if (is_array($vals)){
  53. if (isset($vals['order_id'])){
  54. $this->order_id = $vals['order_id'];
  55. }
  56. if (isset($vals['barcode'])){
  57. $this->barcode = $vals['barcode'];
  58. }
  59. if (isset($vals['amount'])){
  60. $this->amount = $vals['amount'];
  61. }
  62. if (isset($vals['price'])){
  63. $this->price = $vals['price'];
  64. }
  65. if (isset($vals['brand_name'])){
  66. $this->brand_name = $vals['brand_name'];
  67. }
  68. if (isset($vals['product_name'])){
  69. $this->product_name = $vals['product_name'];
  70. }
  71. if (isset($vals['brand_id'])){
  72. $this->brand_id = $vals['brand_id'];
  73. }
  74. if (isset($vals['date'])){
  75. $this->date = $vals['date'];
  76. }
  77. if (isset($vals['order_type'])){
  78. $this->order_type = $vals['order_type'];
  79. }
  80. }
  81. }
  82. public function getName(){
  83. return 'SalesOrderDetail';
  84. }
  85. public function read($input){
  86. $input->readStructBegin();
  87. while(true){
  88. $schemeField = $input->readFieldBegin();
  89. if ($schemeField == null) break;
  90. $needSkip = true;
  91. if ("order_id" == $schemeField){
  92. $needSkip = false;
  93. $input->readString($this->order_id);
  94. }
  95. if ("barcode" == $schemeField){
  96. $needSkip = false;
  97. $input->readString($this->barcode);
  98. }
  99. if ("amount" == $schemeField){
  100. $needSkip = false;
  101. $input->readI32($this->amount);
  102. }
  103. if ("price" == $schemeField){
  104. $needSkip = false;
  105. $input->readDouble($this->price);
  106. }
  107. if ("brand_name" == $schemeField){
  108. $needSkip = false;
  109. $input->readString($this->brand_name);
  110. }
  111. if ("product_name" == $schemeField){
  112. $needSkip = false;
  113. $input->readString($this->product_name);
  114. }
  115. if ("brand_id" == $schemeField){
  116. $needSkip = false;
  117. $input->readString($this->brand_id);
  118. }
  119. if ("date" == $schemeField){
  120. $needSkip = false;
  121. $input->readString($this->date);
  122. }
  123. if ("order_type" == $schemeField){
  124. $needSkip = false;
  125. $input->readI32($this->order_type);
  126. }
  127. if($needSkip){
  128. \Osp\Protocol\ProtocolUtil::skip($input);
  129. }
  130. $input->readFieldEnd();
  131. }
  132. $input->readStructEnd();
  133. }
  134. public function write($output){
  135. $xfer = 0;
  136. $xfer += $output->writeStructBegin();
  137. if($this->order_id !== null) {
  138. $xfer += $output->writeFieldBegin('order_id');
  139. $xfer += $output->writeString($this->order_id);
  140. $xfer += $output->writeFieldEnd();
  141. }
  142. if($this->barcode !== null) {
  143. $xfer += $output->writeFieldBegin('barcode');
  144. $xfer += $output->writeString($this->barcode);
  145. $xfer += $output->writeFieldEnd();
  146. }
  147. if($this->amount !== null) {
  148. $xfer += $output->writeFieldBegin('amount');
  149. $xfer += $output->writeI32($this->amount);
  150. $xfer += $output->writeFieldEnd();
  151. }
  152. if($this->price !== null) {
  153. $xfer += $output->writeFieldBegin('price');
  154. $xfer += $output->writeDouble($this->price);
  155. $xfer += $output->writeFieldEnd();
  156. }
  157. if($this->brand_name !== null) {
  158. $xfer += $output->writeFieldBegin('brand_name');
  159. $xfer += $output->writeString($this->brand_name);
  160. $xfer += $output->writeFieldEnd();
  161. }
  162. if($this->product_name !== null) {
  163. $xfer += $output->writeFieldBegin('product_name');
  164. $xfer += $output->writeString($this->product_name);
  165. $xfer += $output->writeFieldEnd();
  166. }
  167. if($this->brand_id !== null) {
  168. $xfer += $output->writeFieldBegin('brand_id');
  169. $xfer += $output->writeString($this->brand_id);
  170. $xfer += $output->writeFieldEnd();
  171. }
  172. if($this->date !== null) {
  173. $xfer += $output->writeFieldBegin('date');
  174. $xfer += $output->writeString($this->date);
  175. $xfer += $output->writeFieldEnd();
  176. }
  177. if($this->order_type !== null) {
  178. $xfer += $output->writeFieldBegin('order_type');
  179. $xfer += $output->writeI32($this->order_type);
  180. $xfer += $output->writeFieldEnd();
  181. }
  182. $xfer += $output->writeFieldStop();
  183. $xfer += $output->writeStructEnd();
  184. return $xfer;
  185. }
  186. }
  187. ?>