public function view_skuCategoryList() { if (!isset($_SESSION['userName'])) { header('Location:index.php?mod=login&act=index'); } require_once WEB_PATH . "lib/Tree.class.php"; //调用action层, 获取列表数据 /*$OmAvailableApiAct = new OmAvailableApiAct(); $skuTypeQcArrList = $OmAvailableApiAct->act_getCategoryInfoAll();*/ $qcCategoryListAct = new qcCategoryListAct(); $condition = isset($_GET['condition']) ? trim($_GET['condition']) : ""; if ($condition != "") { $info = "and path like '{$condition}'"; } else { $info = ""; } $where = "WHERE is_delete=0 {$info} "; $total = $qcCategoryListAct->act_getCategoryListNum($where); $num = 100; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); $where .= "ORDER BY path "; $where .= $page->limit; $qcStandard = new qcStandardAct(); $skuTypeQcArrList = $qcStandard->act_skuTypeQcList($this->where); $sampleTypeList = array(); foreach ($skuTypeQcArrList as $skuTypeQcArrListValue) { $sampleTypeList[$skuTypeQcArrListValue['id']] = $skuTypeQcArrListValue['typeName']; } $categoryList = $qcCategoryListAct->act_getCategoryList('*', $where); /*$menu = new Tree(); $menu->icon = array('', '', ''); $menu->nbsp = ' '; foreach ($categoryList as $n => $t) { $result[$n]['checked'] = '';//($this->is_checked($t, $roleid, $priv_data)) ? ' checked' : ''; $result[$n]['level'] = $t['file']; $result[$n]['parentid'] = $t['pid'] ? $t['pid'] : 0; $result[$n]['id'] = $t['id']; $result[$n]['name'] = $t['name']; $result[$n]['sampleTypeId'] = $t['sampleTypeId']; $result[$n]['sampleType'] = isset($sampleTypeList[$t['sampleTypeId']]) ? $sampleTypeList[$t['sampleTypeId']] : ''; $result[$n]['parentid_node'] = ($t['pid']) ? ' class="child-of-node-' . $t['pid'] . '"' : ''; } $str = "<tr data-tt-id='\$id' \$parentid_node> <td style='padding-left:30px;'>\$name</td> <td style='padding-left:30px;'>\$level</td> <td> ".tep_selectHTML_show($sampleTypeList, 'choiceSampleType_\$id', '\$sampleTypeId')." </td> <td style='padding-left:30px;'>\$sampleType</td> </tr>"; $str = "<tr id='node-\$id' \$parentid_node> <td style='padding-left:30px;' align='left'>\$spacer \$name</td> <td> <a class='btn' href='__URL__/add?id={\$id}' target='_blank'><i class='icon-plus'></i></a> <a class='btn' href='__URL__/edit?id={\$id}'><i class='icon-pencil'></i></a> <a class='btn' href='__URL__/delete?id={\$id}'><i class='icon-trash'></i></a> </td> </tr>"; $menu->init($result); $categoryList = $menu->get_tree(0, $str);*/ //'<i class="icon-plus"></i>' //var_dump($categoryList); if (!empty($_GET['page'])) { if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) { $n = 1; } else { $n = (intval($_GET['page']) - 1) * $num + 1; } } else { $n = 1; } if ($total > $num) { //输出分页显示 $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $show_page = $page->fpage(array(0, 2, 3)); } $this->smarty->assign('show_page', $show_page); $this->smarty->assign('sampleTypeList', $sampleTypeList); //print_r($sampleTypeList); //二级导航 $this->smarty->assign('secnev', '4'); $this->smarty->assign('module', '产品分类列表'); $this->smarty->assign('username', $_SESSION['userName']); $navarr = array("<a href='index.php?mod=nowSampleStandard&act=nowSampleType'>QC检测标准</a>", ">>", "产品分类列表"); $this->smarty->assign('navarr', $navarr); $category1 = qcCategoryListModel::getCategory1(); $this->smarty->assign("category1", $category1); $this->smarty->assign('categoryList', $categoryList); $this->smarty->display('qcCategoryList.htm'); }
function act_changeCategory() { $category1 = isset($_POST['category1']) ? trim($_POST['category1']) : ""; $category2 = isset($_POST['category2']) ? trim($_POST['category2']) : ""; $category3 = isset($_POST['category3']) ? trim($_POST['category3']) : ""; $category4 = isset($_POST['category4']) ? trim($_POST['category4']) : ""; $category = isset($_POST['category']) ? trim($_POST['category']) : ""; if ($category1 == "") { self::$errCode = 111; self::$errMsg = ""; return false; } if ($category == "") { self::$errCode = 222; self::$errMsg = ""; return false; } if ($category1 != "" && $category2 == "" && $category3 == "" && $category4 == "") { $condition = "{$category1}%"; } if ($category1 != "" && $category2 != "" && $category3 == "" && $category4 == "") { $condition = "{$category1}_{$category2}%"; } if ($category1 != "" && $category2 != "" && $category3 != "" && $category4 == "") { $condition = "{$category1}_{$category2}_{$category3}%"; } if ($category1 != "" && $category2 != "" && $category3 != "" && $category4 != "") { $condition = "{$category1}_{$category2}_{$category3}_{$category4}"; } $result = qcCategoryListModel::changeCategory($condition, $category); if ($result) { self::$errCode = 0; self::$errMsg = ""; return $condition; } else { self::$errCode = 333; self::$errMsg = ""; return false; } }
function act_getWhSkuInfo() { $sku = $_POST['sku']; /* *扫描SKU条码goods_code转换 */ if (is_numeric($sku) && $sku > 1000000) { $goods_codes = WhStandardModel::goods_codeTosku($sku); $sku = $goods_codes['sku']; } //SKU信息API接口 $OmAvailableApiAct = new OmAvailableApiAct(); $skuInfo = $OmAvailableApiAct->act_getGoodsInfoBySku($sku); if ($skuInfo['errCode'] == '201') { self::$errCode = "003"; self::$errMsg = "【{$sku}】:没有该SKU信息,请确认!"; return false; } $skuInfo = $skuInfo['data']; $reSku = $skuInfo['sku']; //接口返回SKU $reSpu = $skuInfo['spu']; //接口返回SKU $skuName = $skuInfo['goodsName']; //产品描述 $purchaseId = $skuInfo['purchaseId']; //采购人ID /* *产品分类信息ID格式 : 8-49-270 *产品分类信息name格式 : 服装及配饰-女装-T恤衫 */ $goodsCategory = $skuInfo['goodsCategory']; $goodsCategoryNameArray = explode("-", $goodsCategory); $qcCategoryListAct = new qcCategoryListAct(); $getCategoryArr = $qcCategoryListAct->act_getCategoryArr(); //获取产品类别列表信息 /* * 产品分类 对比 检测类别 path : sampleTypeId 1-15-422 -> 服装类 * 返回数组:[2] => 3C电子-功能检测 * 参数:8-49-270 */ $getSampleTypeArr = $qcCategoryListAct->act_getSampleTypeName($goodsCategory); $goodsCategoryName = array(); foreach ($goodsCategoryNameArray as $cvalue) { $goodsCategoryName[] = $getCategoryArr[$cvalue]; } $goodsCategoryNameStr = join('-', $goodsCategoryName); if (!$getSampleTypeArr) { self::$errCode = "003"; self::$errMsg = "【{$goodsCategoryNameStr}】:分类错误,请确认!"; return false; } foreach ($getSampleTypeArr as $key => $valArr) { $sampleTypeKey = $key; $sampleTypeStr = $valArr; } /* *获取仓库信息: [goods_count] => 30 [goods_location] => B0501 [cguser] => 张文辉 */ $whData = UserCacheModel::qccenterGetErpGoodscount($sku); self::$errCode = "200"; $info = array(); $info['info'] = "产品描述:【{$sku}】{$skuName} <br> 产品分类: {$goodsCategoryNameStr} <br>现有库存: " . $whData['goods_count'] . " <br>仓位信息:【" . $whData['goods_location'] . "】<br>采购信息:{$whData['cguser']} "; $info['spu'] = $reSpu; //返回图片系统SPU $info['sku'] = $reSku; //返回系统正确SKU $info['whNum'] = $whData['goods_count']; //返回比较数据:检测数不能超过实际库存数量 $info['skuName'] = $skuName; //返回产品描述 $info['sampleTypeId'] = $sampleTypeKey; //返回检测列别ID $info['sampleTypeStr'] = $sampleTypeStr; //返回检测方法 return $info; }