store_goods_list.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <?php
  2. $info = '';
  3. $store_goods_id = Dever::input('search_option_store_goods_id');
  4. if ($store_goods_id) {
  5. $store_goods = Dever::db('scm_servicer/store_goods')->find($store_goods_id);
  6. if ($store_goods) {
  7. $store = Dever::db('scm_servicer/store')->find($store_goods['servicer_store_id']);
  8. $servicer = Dever::db('scm_servicer/info')->find($store['servicer_id']);
  9. $goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($store_goods['goods_id'], $store_goods['sku_id']);
  10. $info = '<blockquote class="layui-elem-quote">';
  11. $info .= $servicer['name'] . '.' . $store['name'];
  12. $info .= ' -> ';
  13. $info .= '<b>' . $goods_info['aname'] . '('.$goods_info['code'].')</b>';
  14. $info .= '<br />';
  15. $info .= '入库均价:' . '<b>' . $store_goods['cash'] . '</b>';
  16. $info .= ' 入库总库存:' . '<b>' . $store_goods['in_num'] . '</b>';
  17. $info .= ' 出库总库存:' . '<b>' . $store_goods['out_num'] . '</b>';
  18. $info .= '</blockquote>';
  19. }
  20. }
  21. $config = array
  22. (
  23. # 表名
  24. 'name' => 'store_goods_list',
  25. # 显示给用户看的名称
  26. 'lang' => '商品价格设置',
  27. 'order' => 200,
  28. 'menu' => false,
  29. 'info' => $info,
  30. # 数据结构 不同的字段放这里
  31. 'struct' => array
  32. (
  33. 'id' => array
  34. (
  35. 'type' => 'int-11',
  36. 'name' => 'ID',
  37. 'default' => '',
  38. 'desc' => '',
  39. 'match' => 'is_numeric',
  40. //'list' => true,
  41. ),
  42. 'servicer_store_id' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => '所属配送商',
  46. 'default' => '',
  47. 'desc' => '所属配送商',
  48. 'match' => 'is_numeric',
  49. 'update' => 'hidden',
  50. 'search' => 'hidden',
  51. 'value' => Dever::input('search_option_servicer_store_id'),
  52. //'list' => 'Dever::load("scm_servicer/store-one#name", {servicer_store_id})',
  53. ),
  54. 'store_goods_id' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => '商品id',
  58. 'default' => '',
  59. 'desc' => '商品id',
  60. 'match' => 'is_numeric',
  61. ),
  62. 'batch' => array
  63. (
  64. 'type' => 'varchar-800',
  65. 'name' => '入库批次号',
  66. 'default' => '',
  67. 'desc' => '入库批次号',
  68. 'match' => 'option',
  69. 'search' => 'fulltext',
  70. 'list' => true,
  71. ),
  72. 'sdate' => array
  73. (
  74. 'type' => 'int-11',
  75. 'name' => '生产日期',
  76. 'default' => '',
  77. 'desc' => '生产日期',
  78. 'match' => 'option',
  79. 'update' => 'day',
  80. 'callback' => 'maketime',
  81. 'search' => 'day',
  82. 'list' => '{sdate} ? date("Y-m-d H:i:s", {sdate}) : "-"',
  83. ),
  84. 'cash' => array
  85. (
  86. 'type' => 'decimal-11,2',
  87. 'name' => '入库单价',
  88. 'default' => '',
  89. 'desc' => '入库单价',
  90. 'match' => 'option',
  91. 'search' => 'fulltext',
  92. 'list' => true,
  93. ),
  94. 'in_num' => array
  95. (
  96. 'type' => 'decimal-11,2',
  97. 'name' => '入库库存',
  98. 'default' => '0',
  99. 'desc' => '入库库存',
  100. 'match' => 'is_numeric',
  101. 'list' => true,
  102. ),
  103. 'out_num' => array
  104. (
  105. 'type' => 'decimal-11,2',
  106. 'name' => '出库库存',
  107. 'default' => '0',
  108. 'desc' => '出库库存',
  109. 'match' => 'option',
  110. 'list' => true,
  111. ),
  112. 'state' => array
  113. (
  114. 'type' => 'tinyint-1',
  115. 'name' => '数据状态',
  116. 'default' => '1',
  117. 'desc' => '请选择状态',
  118. 'match' => 'is_numeric',
  119. ),
  120. 'cdate' => array
  121. (
  122. 'type' => 'int-11',
  123. 'name' => '发布时间',
  124. 'match' => array('is_numeric', time()),
  125. 'desc' => '',
  126. # 只有insert时才生效
  127. 'insert' => true,
  128. //'search' => 'date',
  129. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  130. ),
  131. ),
  132. 'manage' => array
  133. (
  134. 'insert' => false,
  135. 'edit' => false,
  136. 'delete' => false,
  137. //'excel' => array(array('导出门店库存', '门店库存', '')),
  138. 'page_list_table' => 'sku',
  139. ),
  140. # request 请求接口定义
  141. 'request' => array
  142. (
  143. # 列表 先入先出
  144. 'getList' => array
  145. (
  146. # 匹配的正则或函数 选填项
  147. 'option' => array
  148. (
  149. 'servicer_store_id' => 'yes',
  150. 'goods_id' => 'yes',
  151. 'sku_id' => 'yes',
  152. 'state' => 1,
  153. ),
  154. 'type' => 'all',
  155. 'order' => array('sdate' => 'asc', 'batch' => 'asc', 'id' => 'asc'),
  156. 'col' => '*,in_num-out_num as total',
  157. ),
  158. # 获取某个仓库商品下的数据
  159. 'getOneByStore' => array
  160. (
  161. # 匹配的正则或函数 选填项
  162. 'option' => array
  163. (
  164. 'store_goods_id' => 'yes',
  165. 'state' => 1,
  166. ),
  167. 'type' => 'all',
  168. 'group' => 'store_goods_id',
  169. 'col' => 'id,sum(in_num) as in_num, sum(out_num) as out_num,AVG(cash) as cash',
  170. ),
  171. # 更新入库库存
  172. 'inUpdate' => array
  173. (
  174. 'type' => 'update',
  175. 'where' => array
  176. (
  177. 'id' => 'yes',
  178. ),
  179. 'set' => array
  180. (
  181. 'in_num' => array('yes', '+='),
  182. ),
  183. ),
  184. # 更新出库库存
  185. 'outUpdate' => array
  186. (
  187. 'type' => 'update',
  188. 'where' => array
  189. (
  190. 'id' => 'yes',
  191. ),
  192. 'set' => array
  193. (
  194. 'out_num' => array('yes', '+='),
  195. ),
  196. ),
  197. # 更新入库在途库存
  198. 'onInUpdate' => array
  199. (
  200. 'type' => 'update',
  201. 'where' => array
  202. (
  203. 'id' => 'yes',
  204. ),
  205. 'set' => array
  206. (
  207. 'on_in_num' => array('yes', '+='),
  208. ),
  209. ),
  210. # 更新出库在途库存
  211. 'onOutUpdate' => array
  212. (
  213. 'type' => 'update',
  214. 'where' => array
  215. (
  216. 'id' => 'yes',
  217. ),
  218. 'set' => array
  219. (
  220. 'on_out_num' => array('yes', '+='),
  221. ),
  222. ),
  223. ),
  224. );
  225. return $config;