store_goods.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <?php
  2. return array
  3. (
  4. # 表名
  5. 'name' => 'store_goods',
  6. # 显示给用户看的名称
  7. 'lang' => '仓库商品列表',
  8. 'order' => 10,
  9. 'menu' => false,
  10. # 数据结构
  11. 'struct' => array
  12. (
  13. 'id' => array
  14. (
  15. 'type' => 'int-11',
  16. 'name' => 'ID',
  17. 'default' => '',
  18. 'desc' => '',
  19. 'match' => 'is_numeric',
  20. 'search' => 'order',
  21. 'update' => 'hidden',
  22. //'list' => true,
  23. ),
  24. 'servicer_store_id' => array
  25. (
  26. 'type' => 'int-11',
  27. 'name' => '配送商仓库',
  28. 'default' => '',
  29. 'desc' => '配送商仓库',
  30. 'match' => 'is_numeric',
  31. 'update' => 'hidden',
  32. 'search' => 'hidden',
  33. 'value' => Dever::input('search_option_servicer_store_id'),
  34. 'list' => 'Dever::load("scm_servicer/store-one#name", {servicer_store_id})',
  35. ),
  36. 'scm_product-info_sku-code'=> array
  37. (
  38. 'name' => '商品编码',
  39. 'default' => '',
  40. 'desc' => '商品编码',
  41. 'match' => 'option',
  42. # 读取另外表的关联方式
  43. 'sync' => array('sku_id', 'id', 'goods_id', 'info_id', 'key'),
  44. 'search' => array
  45. (
  46. 'api' => 'scm_product/info_sku-all',
  47. 'col' => 'code',
  48. 'result' => 'id',
  49. 'search' => 'sku_id',
  50. ),
  51. 'list' => true,
  52. ),
  53. 'goods_id' => array
  54. (
  55. 'type' => 'int-11',
  56. 'name' => '商品名称',
  57. 'default' => '',
  58. 'desc' => '商品名称',
  59. 'match' => 'is_numeric',
  60. 'search' => array
  61. (
  62. 'api' => 'scm_product/info-all',
  63. 'col' => 'name',
  64. 'result' => 'id',
  65. 'search' => 'goods_id',
  66. ),
  67. 'update' => 'select',
  68. 'update_search' => 'scm_product/lib/manage.search',
  69. 'list' => 'Dever::load("scm_product/lib/info.getBaseInfo#aname", "{goods_id}", "{sku_id}")',
  70. ),
  71. 'sku_id' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '规格型号',
  75. 'default' => '-1',
  76. 'desc' => '规格型号',
  77. 'match' => 'is_numeric',
  78. ),
  79. 'unit_id' => array
  80. (
  81. 'type' => 'int-11',
  82. 'name' => '基本单位',
  83. 'default' => '',
  84. 'desc' => '基本单位',
  85. 'match' => 'is_numeric',
  86. 'list' => 'Dever::load("scm/unit-one#name", {unit_id})',
  87. ),
  88. 'cash' => array
  89. (
  90. 'type' => 'decimal-11,2',
  91. 'name' => '入库均价',
  92. 'default' => '',
  93. 'desc' => '入库均价',
  94. 'match' => 'option',
  95. 'list' => true,
  96. ),
  97. 'in_num' => array
  98. (
  99. 'type' => 'decimal-11,2',
  100. 'name' => '入库总库存',
  101. 'default' => '0',
  102. 'desc' => '入库总库存',
  103. 'match' => 'is_numeric',
  104. 'list' => true,
  105. ),
  106. 'out_num' => array
  107. (
  108. 'type' => 'decimal-11,2',
  109. 'name' => '出库总库存',
  110. 'default' => '0',
  111. 'desc' => '出库总库存',
  112. 'match' => 'option',
  113. 'list' => true,
  114. ),
  115. 'state' => array
  116. (
  117. 'type' => 'tinyint-1',
  118. 'name' => '状态',
  119. 'default' => '1',
  120. 'desc' => '请选择状态',
  121. 'match' => 'is_numeric',
  122. ),
  123. 'cdate' => array
  124. (
  125. 'type' => 'int-11',
  126. 'name' => '创建时间',
  127. 'match' => array('is_numeric', time()),
  128. 'desc' => '',
  129. # 只有insert时才生效
  130. 'insert' => true,
  131. //'search' => 'date',
  132. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  133. ),
  134. ),
  135. 'manage' => array
  136. (
  137. 'insert' => false,
  138. 'edit' => false,
  139. 'delete' => false,
  140. 'list_button' => array
  141. (
  142. 'list' => array('查看详情', '"store_goods_list&oper_table=store_goods&top_table=info&search_option_store_goods_id={id}"'),
  143. ),
  144. ),
  145. 'request' => array
  146. (
  147. # 后台搜索用到,也可以不加,自动生成
  148. 'search' => array
  149. (
  150. # 匹配的正则或函数 选填项
  151. 'option' => array
  152. (
  153. 'name' => array('yes-t_2.name', 'like'),
  154. 'servicer_store_id' => array('yes-t_1.servicer_store_id'),
  155. 'status' => 'yes-t_2.status-1',
  156. 'state' => 'yes-t_2.state-1',
  157. 'state_1' => 'yes-t_1.state-1',
  158. ),
  159. # 联表
  160. 'join' => array
  161. (
  162. array
  163. (
  164. 'table' => 'scm_product/info',
  165. 'type' => 'left join',
  166. 'on' => array('goods_id','id'),
  167. 'col' => 'goods_id',
  168. ),
  169. ),
  170. 'type' => 'all',
  171. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  172. 'page' => array(10, 'list'),
  173. 'col' => '*, t_2.*,t_2.id as value, "" as selected, "" as disabled',
  174. ),
  175. 'getData' => array
  176. (
  177. # 匹配的正则或函数 选填项
  178. 'option' => array
  179. (
  180. 'servicer_store_id' => array('yes-t_1.servicer_store_id'),
  181. 'sell_type' => array('yes-t_2.sell_type'),
  182. 'name' => array('yes-t_2.name', 'like'),
  183. 'category' => array('yes-t_2.category', 'like'),
  184. 'top_category_id' => array('yes-t_2.top_category_id'),
  185. 'second_category_id' => array('yes-t_2.second_category_id'),
  186. 'category_id' => array('yes-t_2.category_id'),
  187. 'status' => 'yes-t_2.status-1',
  188. 'state' => 'yes-t_2.state-1',
  189. 'state_1' => 'yes-t_1.state-1',
  190. ),
  191. # 联表
  192. 'join' => array
  193. (
  194. array
  195. (
  196. 'table' => 'scm_product/info',
  197. 'type' => 'left join',
  198. 'on' => array('goods_id','id'),
  199. 'col' => 'goods_id',
  200. ),
  201. ),
  202. 'type' => 'all',
  203. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  204. 'col' => 'id,name,category,pic,content,video,type,unit,spec_type,goods,commission,pay_money,money_id,score_id,sell_type,buy_type,udate,cdate',
  205. ),
  206. 'getDataPage' => array
  207. (
  208. # 匹配的正则或函数 选填项
  209. 'option' => array
  210. (
  211. 'servicer_store_id' => array('yes-t_1.servicer_store_id'),
  212. 'sell_type' => array('yes-t_2.sell_type'),
  213. 'name' => array('yes-t_2.name', 'like'),
  214. 'category' => array('yes-t_2.category', 'like'),
  215. 'top_category_id' => array('yes-t_2.top_category_id'),
  216. 'second_category_id' => array('yes-t_2.second_category_id'),
  217. 'category_id' => array('yes-t_2.category_id'),
  218. 'status' => 'yes-t_2.status-1',
  219. 'state' => 'yes-t_2.state-1',
  220. 'state_1' => 'yes-t_1.state-1',
  221. ),
  222. # 联表
  223. 'join' => array
  224. (
  225. array
  226. (
  227. 'table' => 'scm_product/info',
  228. 'type' => 'left join',
  229. 'on' => array('goods_id','id'),
  230. 'col' => 'goods_id',
  231. ),
  232. ),
  233. 'type' => 'all',
  234. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  235. 'page' => array(10, 'list'),
  236. 'col' => 'id,name,category,pic,content,video,type,unit,spec_type,goods,commission,pay_money,money_id,score_id,sell_type,buy_type,udate,t_1.cdate,t_1.id as id',
  237. ),
  238. # 获取某个sku的单条数据
  239. 'getOne' => array
  240. (
  241. # 匹配的正则或函数 选填项
  242. 'option' => array
  243. (
  244. 'servicer_store_id' => 'yes',
  245. 'goods_id' => 'yes',
  246. 'sku_id' => 'yes',
  247. 'state' => 1,
  248. ),
  249. 'type' => 'one',
  250. 'col' => '*,(sum(in_num)-sum(out_num)) as total,AVG(cash) as cash',
  251. ),
  252. # 获取单位下的数据
  253. 'getUnit' => array
  254. (
  255. # 匹配的正则或函数 选填项
  256. 'option' => array
  257. (
  258. 'servicer_store_id' => 'yes',
  259. 'goods_id' => 'yes',
  260. 'sku_id' => 'yes',
  261. 'state' => 1,
  262. ),
  263. 'type' => 'all',
  264. 'col' => '*,(in_num-out_num) as total|unit_id',
  265. ),
  266. ),
  267. );