store_goods_sku.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <?php
  2. $config = array
  3. (
  4. # 表名
  5. 'name' => 'store_goods_sku',
  6. # 显示给用户看的名称
  7. 'lang' => '商品价格设置',
  8. 'order' => 200,
  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. //'list' => true,
  21. ),
  22. 'servicer_store_id' => array
  23. (
  24. 'type' => 'int-11',
  25. 'name' => '所属配送商',
  26. 'default' => '',
  27. 'desc' => '所属配送商',
  28. 'match' => 'is_numeric',
  29. 'update' => 'hidden',
  30. 'search' => 'hidden',
  31. 'value' => Dever::input('search_option_servicer_store_id'),
  32. 'list' => 'Dever::load("scm_servicer/store-one#name", {servicer_store_id})',
  33. ),
  34. 'goods-info_sku-code'=> array
  35. (
  36. 'name' => '商品编码',
  37. 'default' => '',
  38. 'desc' => '商品编码',
  39. 'match' => 'option',
  40. # 读取另外表的关联方式
  41. 'sync' => array('sku_id', 'id', 'goods_id', 'info_id', 'key'),
  42. 'list' => true,
  43. 'list_order' => 4,
  44. ),
  45. 'goods_id' => array
  46. (
  47. 'type' => 'int-11',
  48. 'name' => '商品名称',
  49. 'default' => '',
  50. 'desc' => '商品名称',
  51. 'match' => 'is_numeric',
  52. 'update' => 'select',
  53. 'update_search' => 'scm_product/lib/manage.search',
  54. 'list' => 'Dever::load("scm_product/info-one#name", {goods_id})',
  55. ),
  56. 'sku_id' => array
  57. (
  58. 'type' => 'int-11',
  59. 'name' => '规格型号',
  60. 'default' => '-1',
  61. 'desc' => '规格型号',
  62. 'match' => 'is_numeric',
  63. ),
  64. 'unit_id' => array
  65. (
  66. 'type' => 'int-11',
  67. 'name' => '单位',
  68. 'default' => '',
  69. 'desc' => '单位',
  70. 'match' => 'is_numeric',
  71. //'update' => 'select',
  72. ),
  73. 'batch' => array
  74. (
  75. 'type' => 'varchar-800',
  76. 'name' => '入库批次号',
  77. 'default' => '',
  78. 'desc' => '入库批次号',
  79. 'match' => 'option',
  80. ),
  81. 'sdate' => array
  82. (
  83. 'type' => 'int-11',
  84. 'name' => '生产日期',
  85. 'default' => '',
  86. 'desc' => '生产日期',
  87. 'match' => 'option',
  88. 'update' => 'day',
  89. 'callback' => 'maketime',
  90. ),
  91. 'cash' => array
  92. (
  93. 'type' => 'decimal-11,2',
  94. 'name' => '入库单价',
  95. 'default' => '',
  96. 'desc' => '入库单价',
  97. 'match' => 'option',
  98. ),
  99. 'in_num' => array
  100. (
  101. 'type' => 'decimal-11,2',
  102. 'name' => '入库库存',
  103. 'default' => '0',
  104. 'desc' => '入库库存',
  105. 'match' => 'is_numeric',
  106. ),
  107. 'out_num' => array
  108. (
  109. 'type' => 'decimal-11,2',
  110. 'name' => '出库库存',
  111. 'default' => '0',
  112. 'desc' => '出库库存',
  113. 'match' => 'option',
  114. ),
  115. 'on_num' => array
  116. (
  117. 'type' => 'decimal-11,2',
  118. 'name' => '在途库存',
  119. 'default' => '0',
  120. 'desc' => '在途库存',
  121. 'match' => 'is_numeric',
  122. ),
  123. 'state' => array
  124. (
  125. 'type' => 'tinyint-1',
  126. 'name' => '数据状态',
  127. 'default' => '1',
  128. 'desc' => '请选择状态',
  129. 'match' => 'is_numeric',
  130. ),
  131. 'cdate' => array
  132. (
  133. 'type' => 'int-11',
  134. 'name' => '发布时间',
  135. 'match' => array('is_numeric', time()),
  136. 'desc' => '',
  137. # 只有insert时才生效
  138. 'insert' => true,
  139. //'search' => 'date',
  140. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  141. ),
  142. ),
  143. 'manage' => array
  144. (
  145. 'insert' => false,
  146. 'edit' => false,
  147. 'delete' => false,
  148. //'excel' => array(array('导出门店库存', '门店库存', '')),
  149. 'page_list_table' => 'sku',
  150. ),
  151. # request 请求接口定义
  152. 'request' => array
  153. (
  154. # 后台搜索用到,也可以不加,自动生成
  155. 'search' => array
  156. (
  157. # 匹配的正则或函数 选填项
  158. 'option' => array
  159. (
  160. 'name' => array('yes-t_2.name', 'like'),
  161. 'servicer_store_id' => array('yes-t_1.servicer_store_id'),
  162. 'status' => 'yes-t_2.status-1',
  163. 'state' => 'yes-t_2.state-1',
  164. 'state_1' => 'yes-t_1.state-1',
  165. ),
  166. # 联表
  167. 'join' => array
  168. (
  169. array
  170. (
  171. 'table' => 'scm_product/info',
  172. 'type' => 'left join',
  173. 'on' => array('goods_id','id'),
  174. 'col' => 'goods_id',
  175. ),
  176. ),
  177. 'type' => 'all',
  178. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  179. 'col' => '*,t_2.*,t_2.id as value, "" as selected, "" as disabled',
  180. ),
  181. 'getDataPage' => array
  182. (
  183. # 匹配的正则或函数 选填项
  184. 'option' => array
  185. (
  186. 'servicer_store_id' => array('yes-t_1.servicer_store_id'),
  187. 'name' => array('yes-t_2.name', 'like'),
  188. 'total' => array('yes|t_1.in_num-t_1.out_num', '<'),
  189. 'category' => array('yes-t_2.category', 'like'),
  190. 'top_category_id' => array('yes-t_2.top_category_id'),
  191. 'second_category_id' => array('yes-t_2.second_category_id'),
  192. 'category_id' => array('yes-t_2.category_id'),
  193. 'status' => array('yes-t_2.status', 1),
  194. 'state' => array('yes-t_2.state', 1),
  195. 'state_1' => array('yes-t_1.state', 1),
  196. ),
  197. # 联表
  198. 'join' => array
  199. (
  200. array
  201. (
  202. 'table' => 'scm_product/info',
  203. 'type' => 'left join',
  204. 'on' => array('goods_id','id'),
  205. 'col' => 'goods_id',
  206. ),
  207. ),
  208. 'type' => 'all',
  209. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  210. 'page' => array(30, 'list'),
  211. 'col' => '*,t_2.name,t_2.pic,t_2.video,t_2.id as id,t_1.in_num-t_1.out_num as total,t_1.out_num',
  212. ),
  213. 'getData' => array
  214. (
  215. # 匹配的正则或函数 选填项
  216. 'option' => array
  217. (
  218. 'servicer_store_id' => array('yes-t_1.servicer_store_id'),
  219. 'name' => array('yes-t_2.name', 'like'),
  220. 'total' => array('yes|t_1.in_num-t_1.out_num', '<'),
  221. 'category' => array('yes-t_2.category', 'like'),
  222. 'top_category_id' => array('yes-t_2.top_category_id'),
  223. 'second_category_id' => array('yes-t_2.second_category_id'),
  224. 'category_id' => array('yes-t_2.category_id'),
  225. 'status' => array('yes-t_2.status', 1),
  226. 'state' => array('yes-t_2.state', 1),
  227. 'state_1' => array('yes-t_1.state', 1),
  228. ),
  229. # 联表
  230. 'join' => array
  231. (
  232. array
  233. (
  234. 'table' => 'scm_product/info',
  235. 'type' => 'left join',
  236. 'on' => array('goods_id','id'),
  237. 'col' => 'goods_id',
  238. ),
  239. ),
  240. 'type' => 'all',
  241. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  242. 'col' => '*,t_2.name,t_2.pic,t_2.video,t_2.id as id,t_1.in_num-t_1.out_num as total,t_1.out_num,t_1.in_num,t_2.type,t_2.stock,t_2.commission,t_2.sell_type,t_2.buy_type',
  243. ),
  244. # 列表
  245. 'getList' => array
  246. (
  247. # 匹配的正则或函数 选填项
  248. 'option' => array
  249. (
  250. 'servicer_store_id' => 'yes',
  251. 'goods_id' => 'yes',
  252. 'sku_id' => 'yes',
  253. 'state' => 1,
  254. ),
  255. 'type' => 'all',
  256. 'order' => array('id' => 'desc'),
  257. 'col' => '*,in_num-out_num as total|sku_id',
  258. ),
  259. # 获取单条数据
  260. 'getOne' => array
  261. (
  262. # 匹配的正则或函数 选填项
  263. 'option' => array
  264. (
  265. 'servicer_store_id' => 'yes',
  266. 'goods_id' => 'yes',
  267. 'sku_id' => 'yes',
  268. 'state' => 1,
  269. ),
  270. 'type' => 'one',
  271. 'col' => '*,in_num-out_num as total',
  272. ),
  273. # 更新入库库存
  274. 'inUpdate' => array
  275. (
  276. 'type' => 'update',
  277. 'where' => array
  278. (
  279. 'id' => 'yes',
  280. ),
  281. 'set' => array
  282. (
  283. 'in_num' => array('yes', '+='),
  284. ),
  285. ),
  286. # 更新出库库存
  287. 'outUpdate' => array
  288. (
  289. 'type' => 'update',
  290. 'where' => array
  291. (
  292. 'id' => 'yes',
  293. ),
  294. 'set' => array
  295. (
  296. 'out_num' => array('yes', '+='),
  297. ),
  298. ),
  299. # 更新在途库存
  300. 'onUpdate' => array
  301. (
  302. 'type' => 'update',
  303. 'where' => array
  304. (
  305. 'id' => 'yes',
  306. ),
  307. 'set' => array
  308. (
  309. 'on_num' => array('yes', '+='),
  310. ),
  311. ),
  312. ),
  313. );
  314. return $config;