'盘点申请', 'use_buildin_recycle'=>false, 'use_buildin_export'=>true, 'orderBy' => 'inventory_apply_id desc', ); $this->finder('console_mdl_inventory_apply',$params); } function do_confirm($apply_id=0){ $objInAp = app::get('console')->model('inventory_apply'); $main = $objInAp->db_dump(['inventory_apply_id'=>$apply_id], '*'); $branch = app::get('ome')->model('branch')->db_dump(['branch_id'=>$main['branch_id']], 'name'); if(empty($branch)) { header("content-type:text/html; charset=utf-8"); echo ""; exit; } $main['branch_name'] = $branch['name']; $main['status'] = $objInAp->schema['columns']['status']['type'][$main['status']]; $items = app::get('console')->model('inventory_apply_items')->getList('bm_id,material_bn,wms_stores,oms_stores,diff_stores,m_type',['inventory_apply_id'=>$apply_id, 'diff_stores|noequal'=>0]); $this->pagedata['main'] = $main; $this->pagedata['items'] = $items; $this->singlepage('admin/inventory/confirm_items.html'); } function do_close($apply_id){ $inv_aObj = app::get('console')->model('inventory_apply'); $this->begin("index.php?app=console&ctl=admin_inventory_apply&act=index"); $sdf = $inv_aObj->dump($apply_id); if ($sdf['status'] == 'confirmed' || $sdf['status'] == 'closed') $this->end(false, '盘点流水已确认或取消'); $rs = $inv_aObj->update(array('status'=>'closed','process_date'=>time()),array('inventory_apply_id'=>$apply_id)); if ($rs) { app::get('ome')->model('operation_log')->write_log('inventory_apply@console',$apply_id,"关闭成功"); $this->end(true, '处理成功'); } $this->end(false, '处理失败'); } function finish_confirm(){ $this->begin($this->url); $apply_id = (int) $_POST['inventory_apply_id']; list($rs, $rsData) = kernel::single('console_inventory_apply')->confirm($apply_id); $this->end($rs, $rsData['msg']); } function do_view(){ $this->singlepage("admin/inventory/view.html"); } function do_choice($applySdf, $branch){ $this->pagedata['finder_id'] = $_GET['finder_id']; $this->pagedata['apply'] = $applySdf; $this->pagedata['branch'] = $branch; $this->singlepage("admin/inventory/choice.html"); } function finish_choice(){ if ($_POST){ $post = $_POST; if (!$post['branch']) return false; $_POST['apply_id'] = $post['inventory_apply_id']; $_POST['branch_bn'] = $post['branch']; $this->finish_confirm(); } } function view_item(){ $base_filter = array(); if ($_GET['apply_id']){ $base_filter = array('inventory_apply_id'=>$_GET['apply_id']); } $params = array( 'title'=>'盘点申请详情', 'use_buildin_recycle'=>false, 'use_buildin_selectrow'=>false, 'base_filter'=>$base_filter, ); $this->finder('console_mdl_inventory_apply_items',$params); } }