orderSn.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <?php
  2. namespace common\components;
  3. use bizGhs\order\classes\OrderClass;
  4. use bizHd\purchase\classes\PurchaseClearSnClass;
  5. use biz\recharge\classes\RechargeSnClass;
  6. use bizGhs\check\classes\CheckSnClass;
  7. use bizGhs\order\classes\OrderSnClass;
  8. use bizGhs\order\classes\PurchaseSnClass;
  9. use bizHd\px\classes\PxApplySnClass;
  10. use bizMall\renew\classes\RenewSnClass;
  11. use Yii;
  12. use yii\imagine\Image;
  13. //订单号生成 shish 2021.1.19
  14. class orderSn
  15. {
  16. //供货商订单号生成 shish 2021.1.19
  17. public static function getGhsOrderSn()
  18. {
  19. $prefix = 'XSD_CS';
  20. if (getenv('YII_ENV', 'local') == 'production') {
  21. $prefix = 'XSD';
  22. }
  23. $respond = OrderSnClass::add(['id' => null]);
  24. $id = $respond['id'] ?? 0;
  25. if (empty($id)) {
  26. util::fail('订单号没有生成');
  27. }
  28. return $prefix . $id;
  29. }
  30. //零售商订单号生成 shish 2021.1.19
  31. public static function getOrderSn()
  32. {
  33. $prefix = 'KD_CS';
  34. if (getenv('YII_ENV', 'local') == 'production') {
  35. $prefix = 'KD';
  36. }
  37. $respond = \bizHd\order\classes\OrderSnClass::add(['id' => null]);
  38. $id = $respond['id'] ?? 0;
  39. if (empty($id)) {
  40. util::fail('订单号没有生成');
  41. }
  42. return $prefix . $id;
  43. }
  44. //供货商采购单号 shish 2021.1.19
  45. public static function getGhsPurchaseSn()
  46. {
  47. $prefix = 'PH_CS';
  48. if (getenv('YII_ENV', 'local') == 'production') {
  49. $prefix = 'PH';
  50. }
  51. $respond = PurchaseSnClass::add(['id' => null]);
  52. $id = $respond['id'] ?? 0;
  53. if (empty($id)) {
  54. util::fail('采购单号没有生成');
  55. }
  56. return $prefix . $id;
  57. }
  58. //供货商盘点单号 shish 2021.1.19
  59. public static function getGhsCheckSn()
  60. {
  61. $prefix = 'PD_CS';
  62. if (getenv('YII_ENV', 'local') == 'production') {
  63. $prefix = 'PD';
  64. }
  65. $respond = CheckSnClass::add(['id' => null]);
  66. $id = $respond['id'] ?? 0;
  67. if (empty($id)) {
  68. util::fail('盘点单号没有生成');
  69. }
  70. return $prefix . $id;
  71. }
  72. //零售商采购单号 shish 2021.1.19
  73. public static function getPurchaseSn()
  74. {
  75. $prefix = 'CG_CS';
  76. if (getenv('YII_ENV', 'local') == 'production') {
  77. $prefix = 'CG';
  78. }
  79. $respond = \bizHd\purchase\classes\PurchaseSnClass::add(['id' => null]);
  80. $id = $respond['id'] ?? 0;
  81. if (empty($id)) {
  82. util::fail('采购单号没有生成');
  83. }
  84. return $prefix . $id;
  85. }
  86. //零售商采购单号 shish 2021.1.19
  87. public static function getPurchaseClearSn()
  88. {
  89. $prefix = 'PC_CS';
  90. if (getenv('YII_ENV', 'local') == 'production') {
  91. $prefix = 'PC';
  92. }
  93. $respond = PurchaseClearSnClass::add(['id' => null]);
  94. $id = $respond['id'] ?? 0;
  95. if (empty($id)) {
  96. util::fail('单号没有生成');
  97. }
  98. return $prefix . $id;
  99. }
  100. //供货商入库订单号 linqh 2021.1.23
  101. public static function getGhsStockInSn()
  102. {
  103. $prefix = 'RK_CS';
  104. if (getenv('YII_ENV', 'local') == 'production') {
  105. $prefix = 'RK';
  106. }
  107. $respond = \bizGhs\order\classes\StockInSnClass::add(['id' => null]);
  108. $id = $respond['id'] ?? 0;
  109. if (empty($id)) {
  110. util::fail('入库单号没有生成');
  111. }
  112. return $prefix . $id;
  113. }
  114. //供货商出库订单号 linqh 2021.1.23
  115. public static function getGhsStockOutSn()
  116. {
  117. $prefix = 'CK_CS';
  118. if (getenv('YII_ENV', 'local') == 'production') {
  119. $prefix = 'CK';
  120. }
  121. $respond = \bizGhs\order\classes\StockOutSnClass::add(['id' => null]);
  122. $id = $respond['id'] ?? 0;
  123. if (empty($id)) {
  124. util::fail('出库单号没有生成');
  125. }
  126. return $prefix . $id;
  127. }
  128. //充值单号 shish 2021.2.20
  129. public static function getRechargeSn()
  130. {
  131. $prefix = 'CZ_CS';
  132. if (getenv('YII_ENV', 'local') == 'production') {
  133. $prefix = 'CZ';
  134. }
  135. $respond = RechargeSnClass::add(['id' => null]);
  136. $id = $respond['id'] ?? 0;
  137. if (empty($id)) {
  138. util::fail('充值单号没有生成');
  139. }
  140. return $prefix . $id;
  141. }
  142. //供货商批量结算订单号 shish 2021.3.15
  143. public static function getGhsOrderClearSn()
  144. {
  145. // BOC batchOrderClear
  146. $prefix = 'BOC_CS';
  147. if (getenv('YII_ENV', 'local') == 'production') {
  148. $prefix = 'BOC';
  149. }
  150. $respond = OrderClass::add(['id' => null]);
  151. $id = $respond['id'] ?? 0;
  152. if (empty($id)) {
  153. util::fail('订单号没有生成');
  154. }
  155. return $prefix . $id;
  156. }
  157. //培训报名订单号 shish 2021.3.17
  158. public static function getPxApplySn()
  159. {
  160. $prefix = 'PX_CS';
  161. if (getenv('YII_ENV', 'local') == 'production') {
  162. $prefix = 'PX';
  163. }
  164. $respond = PxApplySnClass::add(['id' => null]);
  165. $id = $respond['id'] ?? 0;
  166. if (empty($id)) {
  167. util::fail('订单号没有生成');
  168. }
  169. return $prefix . $id;
  170. }
  171. //获取花店续费订单号 shish 2021.3.24
  172. public static function getRenewSn()
  173. {
  174. $prefix = 'RN_CS';
  175. if (getenv('YII_ENV', 'local') == 'production') {
  176. $prefix = 'RN';
  177. }
  178. $respond = RenewSnClass::add(['id' => null]);
  179. $id = $respond['id'] ?? 0;
  180. if (empty($id)) {
  181. util::fail('订单号没有生成');
  182. }
  183. return $prefix . $id;
  184. }
  185. }