123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- <?php
- $info = '';
- $store_goods_id = Dever::input('search_option_store_goods_id');
- if ($store_goods_id) {
- $store_goods = Dever::db('scm_servicer/store_goods')->find($store_goods_id);
- if ($store_goods) {
- $store = Dever::db('scm_servicer/store')->find($store_goods['servicer_store_id']);
- $servicer = Dever::db('scm_servicer/info')->find($store['servicer_id']);
- $goods_info = Dever::load('scm_product/lib/info')->getBaseInfo($store_goods['goods_id'], $store_goods['sku_id']);
- $info = '<blockquote class="layui-elem-quote">';
- $info .= $servicer['name'] . '.' . $store['name'];
- $info .= ' -> ';
- $info .= '<b>' . $goods_info['aname'] . '('.$goods_info['code'].')</b>';
- $info .= '<br />';
- $info .= '入库均价:' . '<b>' . $store_goods['cash'] . '</b>';
- $info .= ' 入库总库存:' . '<b>' . $store_goods['in_num'] . '</b>';
- $info .= ' 出库总库存:' . '<b>' . $store_goods['out_num'] . '</b>';
- $info .= '</blockquote>';
- }
- }
- $config = array
- (
- # 表名
- 'name' => 'store_goods_list',
- # 显示给用户看的名称
- 'lang' => '商品价格设置',
- 'order' => 200,
- 'menu' => false,
- 'info' => $info,
- # 数据结构 不同的字段放这里
- 'struct' => array
- (
- 'id' => array
- (
- 'type' => 'int-11',
- 'name' => 'ID',
- 'default' => '',
- 'desc' => '',
- 'match' => 'is_numeric',
- //'list' => true,
- ),
- 'servicer_store_id' => array
- (
- 'type' => 'int-11',
- 'name' => '所属配送商',
- 'default' => '',
- 'desc' => '所属配送商',
- 'match' => 'is_numeric',
- 'update' => 'hidden',
- 'search' => 'hidden',
- 'value' => Dever::input('search_option_servicer_store_id'),
- //'list' => 'Dever::load("scm_servicer/store-one#name", {servicer_store_id})',
- ),
- 'store_goods_id' => array
- (
- 'type' => 'int-11',
- 'name' => '商品id',
- 'default' => '',
- 'desc' => '商品id',
- 'match' => 'is_numeric',
- ),
- 'batch' => array
- (
- 'type' => 'varchar-800',
- 'name' => '入库批次号',
- 'default' => '',
- 'desc' => '入库批次号',
- 'match' => 'option',
- 'search' => 'fulltext',
- 'list' => true,
- ),
- 'sdate' => array
- (
- 'type' => 'int-11',
- 'name' => '生产日期',
- 'default' => '',
- 'desc' => '生产日期',
- 'match' => 'option',
- 'update' => 'day',
- 'callback' => 'maketime',
- 'search' => 'day',
- 'list' => '{sdate} ? date("Y-m-d H:i:s", {sdate}) : "-"',
- ),
- 'cash' => array
- (
- 'type' => 'decimal-11,2',
- 'name' => '入库单价',
- 'default' => '',
- 'desc' => '入库单价',
- 'match' => 'option',
- 'search' => 'fulltext',
- 'list' => true,
- ),
- 'in_num' => array
- (
- 'type' => 'decimal-11,2',
- 'name' => '入库库存',
- 'default' => '0',
- 'desc' => '入库库存',
- 'match' => 'is_numeric',
- 'list' => true,
- ),
- 'out_num' => array
- (
- 'type' => 'decimal-11,2',
- 'name' => '出库库存',
- 'default' => '0',
- 'desc' => '出库库存',
- 'match' => 'option',
- 'list' => true,
- ),
- 'state' => array
- (
- 'type' => 'tinyint-1',
- 'name' => '数据状态',
- 'default' => '1',
- 'desc' => '请选择状态',
- 'match' => 'is_numeric',
- ),
- 'cdate' => array
- (
- 'type' => 'int-11',
- 'name' => '发布时间',
- 'match' => array('is_numeric', time()),
- 'desc' => '',
- # 只有insert时才生效
- 'insert' => true,
- //'search' => 'date',
- //'list' => 'date("Y-m-d H:i:s", {cdate})',
- ),
- ),
- 'manage' => array
- (
- 'insert' => false,
- 'edit' => false,
- 'delete' => false,
- //'excel' => array(array('导出门店库存', '门店库存', '')),
- 'page_list_table' => 'sku',
- ),
- # request 请求接口定义
- 'request' => array
- (
- # 列表 先入先出
- 'getList' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'servicer_store_id' => 'yes',
- 'goods_id' => 'yes',
- 'sku_id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'all',
- 'order' => array('sdate' => 'asc', 'batch' => 'asc', 'id' => 'asc'),
- 'col' => '*,in_num-out_num as total',
- ),
- # 获取某个仓库商品下的数据
- 'getOneByStore' => array
- (
- # 匹配的正则或函数 选填项
- 'option' => array
- (
- 'store_goods_id' => 'yes',
- 'state' => 1,
- ),
- 'type' => 'all',
- 'group' => 'store_goods_id',
- 'col' => 'id,sum(in_num) as in_num, sum(out_num) as out_num,AVG(cash) as cash',
- ),
- # 更新入库库存
- 'inUpdate' => array
- (
- 'type' => 'update',
- 'where' => array
- (
- 'id' => 'yes',
- ),
- 'set' => array
- (
- 'in_num' => array('yes', '+='),
- ),
- ),
- # 更新出库库存
- 'outUpdate' => array
- (
- 'type' => 'update',
- 'where' => array
- (
- 'id' => 'yes',
- ),
- 'set' => array
- (
- 'out_num' => array('yes', '+='),
- ),
- ),
- # 更新入库在途库存
- 'onInUpdate' => array
- (
- 'type' => 'update',
- 'where' => array
- (
- 'id' => 'yes',
- ),
- 'set' => array
- (
- 'on_in_num' => array('yes', '+='),
- ),
- ),
- # 更新出库在途库存
- 'onOutUpdate' => array
- (
- 'type' => 'update',
- 'where' => array
- (
- 'id' => 'yes',
- ),
- 'set' => array
- (
- 'on_out_num' => array('yes', '+='),
- ),
- ),
- ),
- );
- return $config;
|