col_prefix.'node_type']; $channel_type = $row[$this->col_prefix.'channel_type']; $node_id = $row[$this->col_prefix.'node_id']; $channel_id = $row[$this->col_prefix.'channel_id']; $channel_name = $row[$this->col_prefix.'channel_name']; $config = unserialize($row[$this->col_prefix . 'config']); $adapter = kernel::single('wmsmgr_func')->getAdapterByChannelId($channel_id); $edit_btn = '编辑'; //初始化物流公司 $logi_btn = ''; $certi_id = base_certificate::get('certificate_id'); $api_url = kernel::base_url(true).kernel::url_prefix().'/api'; $sess_id = kernel::single('base_session')->sess_id(); $callback_url = urlencode(kernel::openapi_url('openapi.wmsmgr','bindCallback',array('channel_id'=>$channel_id, 'sess_id'=>$sess_id))); $app_id = "ome"; $api_url = urlencode($api_url); if (in_array($adapter,array('matrixwms'))) { switch ($config['node_type']) { case 'bim': case 'bms': case 'yph': $bind_btn .= $node_id ? sprintf(' | 取消绑定',$channel_id) : sprintf(' | 申请绑定',$channel_id,$finder_id); break; case 'yjdf': if($node_id){ //$bind_btn .= sprintf(' | 取消绑定',$channel_id); $bind_btn .= ' | 取消绑定'; //初始化物流公司 $relationObj = app::get('wmsmgr')->model('express_relation'); $relationCount = $relationObj->count(array('wms_id'=>$channel_id)); if($relationCount < 20){ $logi_btn = ' | 初始化物流公司'; } }else{ $bind_btn .= sprintf(' | 申请绑定',$channel_id,$finder_id); } break; case 'other': default: $bind_btn .= empty($node_id) ? ' | 申请绑定' : ' | 已绑定'; break; } //京东一件代发 if($node_id && $node_type=='yjdf'){ //初始化物流公司按钮 $relationObj = app::get('wmsmgr')->model('express_relation'); $relationCount = $relationObj->count(array('wms_id'=>$channel_id)); if($relationCount < 20 && empty($logi_btn)){ $logi_btn = ' | 初始化物流公司'; } } } if ($extend_button){ $extend_button = ' | '.implode(' | ',$extend_button); }else{ $extend_button = ''; } if($node_id && $row[$this->col_prefix.'node_type'] == 'jd_wms_cloud') { $bind_btn .= ' | 初始化'; } if(in_array($adapter,array('matrixwms','mixturewms'))){ return $edit_btn.$bind_btn.$extend_button.$expressBtn. $logi_btn; }else{ return $edit_btn.$extend_button.$expressBtn; } } var $detail_company = '物流公司编码配置'; function detail_company($wms_id){ $render = app::get('wmsmgr')->render(); $express_relation_mdl = app::get('wmsmgr')->model('express_relation'); if($_POST){ $express_relation_mdl->delete(['wms_id'=>$wms_id]); $wms_express_bn = $_POST['wms_express_bn']; foreach($wms_express_bn as $k=>$v){ if ($k && $v) { $sdata = array('wms_id'=>$wms_id,'logi_id'=>$k,'sys_express_bn'=>trim($_POST['sys_express_bn'][$k]),'wms_express_bn'=>trim($v)); $rs = $express_relation_mdl->save($sdata); } } } $dly_corp_mdl = app::get('ome')->model('dly_corp'); $sys_express_corp = $dly_corp_mdl->getlist('*'); $wms = $express_relation_mdl->getlist('*',array('wms_id'=>$wms_id)); foreach($wms as $v){ $wmsBn[$v['logi_id']] = $v['wms_express_bn']; } $render->pagedata['sys_express_corp'] = $sys_express_corp; $render->pagedata['wms_id'] = $wms_id; $render->pagedata['wmsBn'] = $wmsBn; return $render->fetch("exitExpress.html"); } var $detail_shop = '店铺售达方编号'; function detail_shop($wms_id){ $render = app::get('wmsmgr')->render(); if($_POST){ $shop_config = $_POST['shop_config']; app::get('finance')->setConf('shop_config_'.$wms_id,$shop_config); } $shop_config = app::get('finance')->getConf('shop_config_'.$wms_id); $shopMdl = app::get('ome')->model('shop'); $shop_list = $shopMdl->getlist('*'); foreach($shop_list as $k=>&$v){ $v['wms_code'] = isset($shop_config[$v['shop_bn']]) ? $shop_config[$v['shop_bn']] : $v['shop_bn']; } $render->pagedata['shop_list'] = $shop_list; return $render->fetch("shop_config.html"); } var $detail_branch = '仓库编码配置'; function detail_branch($wms_id){ $render = app::get('wmsmgr')->render(); $oBranch_relation = app::get('wmsmgr')->model('branch_relation'); $oBranch = app::get('ome')->model('branch'); if($_POST){ $wms_branch_bn = $_POST['wms_branch_bn']; $oBranch_relation->delete(['wms_id'=>$wms_id]); foreach($wms_branch_bn as $k=>$v){ $sdata = array( 'wms_id'=>$wms_id, 'sys_branch_bn'=>$k, 'wms_branch_bn'=>$v, 'positive'=>$_POST['positive'][$k] ? '1' : '2', 'negative'=>(int)$_POST['negative'][$k], ); $rs = $oBranch_relation->insert($sdata); } } $branch_list = $oBranch->getlist('*',array('wms_id'=>$wms_id)); $render->pagedata['branch_list'] = $branch_list; unset($branch_list); $branch_relation_list = $oBranch_relation->getlist('*',array('wms_id'=>$wms_id)); $wms_branch = array(); foreach ($branch_relation_list as $branch ) { $wms_branch[$branch['sys_branch_bn']] = $branch; } $render->pagedata['wms_branch'] = $wms_branch; unset($wms_branch,$branch_relation_list); return $render->fetch("branch_config.html"); } var $detail_monthaccount = '月结号'; /** * Short description. * @param type $varname description * @return type description * @access public * @author cyyr24@sina.cn */ function detail_monthaccount ($wms_id) { $render = app::get('wmsmgr')->render(); if($_POST){ $monthaccount = $_POST['monthaccount']; app::get('wmsmgr')->setConf('monthaccount_'.$wms_id,$monthaccount); $department_no = trim($_POST['department_no']); $isv_source = trim($_POST['isv_source']); $owner_user_id = trim($_POST['owner_user_id']); app::get('wmsmgr')->setConf('department_no_'.$wms_id,$department_no); app::get('wmsmgr')->setConf('isv_source_'.$wms_id,$isv_source); app::get('wmsmgr')->setConf('owner_user_id_'.$wms_id,$owner_user_id); } $monthaccount = app::get('wmsmgr')->getConf('monthaccount_'.$wms_id); $department_no = app::get('wmsmgr')->getConf('department_no_'.$wms_id); $isv_source = app::get('wmsmgr')->getConf('isv_source_'.$wms_id); $owner_user_id = app::get('wmsmgr')->getConf('owner_user_id_'.$wms_id); $render->pagedata['monthaccount'] = $monthaccount; $render->pagedata['department_no'] = $department_no; $render->pagedata['isv_source'] = $isv_source; $render->pagedata['owner_user_id'] = $owner_user_id; $render->pagedata['wms_id'] = $wms_id; return $render->fetch("monthaccount.html"); } public $detail_basic = '基础配置'; /** * detail_basic * @param mixed $wms_id ID * @return mixed 返回值 */ public function detail_basic($wms_id) { $render = app::get('wmsmgr')->render(); $wmsMdl = app::get('wmsmgr')->model('wms'); $dlyObj = app::get('ome')->model('dly_corp'); //物流公司 $corpList = $dlyObj->getlist('corp_id,type,name', array()); $render->pagedata['corpList'] = $corpList; //WMS仓储信息 $wms = $wmsMdl->dump($wms_id, 'channel_id,crop_config,node_type'); if ($_POST && $wms_id) { $wms['channel_id'] = $wms_id; $wms['crop_config'] = array_merge((array)$wms['crop_config'],$_POST); $wmsMdl->save($wms); } // 配送拦截,默认为“是” if (!isset($wms['crop_config']['saleorder_callback'])) { $wms['crop_config']['saleorder_callback'] = '1'; } $invoice = $wms['crop_config']['invoice']; unset($wms['crop_config']['invoice']); $render->pagedata['node_type'] = $wms['node_type']; $render->pagedata['invoice'] = $invoice; $render->pagedata['crop_config'] = $wms['crop_config']; $render->pagedata['node_type'] = $wms['node_type']; return $render->fetch("basic.html"); } public $detail_supplier = '供应商编码配置'; /** * detail_supplier * @param mixed $wms_id ID * @return mixed 返回值 */ public function detail_supplier($wms_id) { $render = app::get('wmsmgr')->render(); $supplierRelationModel = app::get('wmsmgr')->model('supplier_relation'); $oSupplier = app::get('purchase')->model('supplier'); if($_POST['wms']){ foreach($_POST['wms'] as $k=>$v){ $sdata = array('wms_id'=>$wms_id,'supplier_id'=>$k,'wms_supplier_bn'=>trim($v['supplier_bn'])); $supplierRelationModel->db_save($sdata); } } $supplierList = array(); $rows = $oSupplier->getlist('supplier_id,name',array()); foreach ($rows as $key => $value) { $supplierList[$value['supplier_id']] = $value; } $rows = $supplierRelationModel->getlist('*',array('wms_id'=>$wms_id)); foreach ($rows as $key => $value) { $supplierList[$value['supplier_id']]['wms'] = $value; } $render->pagedata['supplier_list'] = $supplierList; $render->pagedata['wms_id'] = $wms_id; return $render->fetch("supplier_config.html"); } }