select(array('servicer_id' => $id)); if ($data) { $status = Dever::db('scm_servicer/store')->config['status']; foreach ($data as $k => $v) { $status_name = ''; if ($v['status'] == 2) { $status_name = '(已禁用)'; } $oper = '仓库明细'; $table['body'][$k][] = $v['name'] . $status_name; $table['body'][$k][] = $v['code']; $table['body'][$k][] = $oper; } } $body[''] = array ( 'type' => 'table', 'content' => $table, ); if ($table['body']) { return Dever::show('', $body); } else { return '暂无'; } } public function getGoods($id) { $table = array(); $table['head'] = array('名称', '单价', '数量', '状态'); $table['body'] = array(); $data = Dever::db('scm_servicer/in_order_goods')->select(array('order_id' => $id)); if ($data) { $status = Dever::db('scm_servicer/in_order_goods')->config['status']; foreach ($data as $k => $v) { $status_name = Dever::status($status, $v['status']); $table['body'][$k][] = $v['goods']; $table['body'][$k][] = $v['cash']; $table['body'][$k][] = $v['num']; $table['body'][$k][] = $status_name; } } $body[''] = array ( 'type' => 'table', 'content' => $table, ); if ($table['body']) { return Dever::show('', $body); } else { return '暂无'; } } public function updateGoods($id, $name, $data) { $table = Dever::input('table'); $goods = Dever::param('goods', $data); if ($goods) { $info = Dever::db('scm_servicer/' . $table . '_goods')->find($id); if ($info) { $order = Dever::db('scm_servicer/' . $table)->find($info['order_id']); $update['where_id'] = $info['order_id']; $update['order_num'] = $this->getOrderId($table); Dever::db('scm_servicer/' . $table)->update($update); $temp = explode('-', $goods); $update = array(); $update['where_id'] = $id; $update['goods_id'] = $temp[0]; $update['sku_id'] = $temp[1]; $update['cash'] = $temp[2]; Dever::db('scm_servicer/' . $table . '_goods')->update($update); Dever::config('base')->hook = false; } } } # 生成订单号 public function getOrderId($table) { $first = ucfirst(substr($table, 0, 1)); $where['order_num'] = Dever::order('C' . $first); $state = Dever::db('scm_servicer/' . $table)->one($where); if (!$state) { return $where['order_num']; } else { return $this->getOrderId($table); } } }