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 = '
'; $info .= $servicer['name'] . '.' . $store['name']; $info .= ' -> '; $info .= '' . $goods_info['aname'] . '('.$goods_info['code'].')'; $info .= ''; } } $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;
'; $info .= '入库均价:' . '' . $store_goods['cash'] . ''; $info .= ' 入库总库存:' . '' . $store_goods['in_num'] . ''; $info .= ' 出库总库存:' . '' . $store_goods['out_num'] . ''; $info .= '