예제 #1
0
 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');
 }
예제 #2
0
 function act_getSkuInfo()
 {
     global $memc_obj;
     $sku_name = '';
     $cate = '';
     $sku = $_POST['sku'];
     if (is_numeric($sku) && $sku > 1000000) {
         //此sku为goods_code
         $goods_codes = WhStandardModel::goods_codeTosku($sku);
         $sku = $goods_codes['sku'];
     }
     //读取数据库
     $categoryStr = "";
     //$time1 = time();
     //SKU信息API接口
     $OmAvailableApiAct = new OmAvailableApiAct();
     $skuInfo = $OmAvailableApiAct->act_getGoodsInfoBySku($sku);
     $skuInfo = $skuInfo['data'];
     //$skuInfo       = $memc_obj->get_extral('pc_goods_'.$sku);
     $reSku = $skuInfo['sku'];
     //接口返回SKU
     $reSpu = $skuInfo['spu'];
     //接口返回SKU
     $skuName = $skuInfo['goodsName'];
     //产品描述
     $purchaseId = $skuInfo['purchaseId'];
     //采购人ID
     $goodsCategory = $skuInfo['goodsCategory'];
     //SKU分类path
     $qcCategoryListAct = new qcCategoryListAct();
     $where = 'WHERE is_delete=0 and path= "' . $goodsCategory . '"';
     $categoryList = $qcCategoryListAct->act_getCategoryList('*', $where);
     $getCategoryArr = $qcCategoryListAct->act_getCategoryArr();
     //获取产品类别列表信息
     $sampleTypeListId = empty($categoryList) ? 1 : $categoryList[0]['sampleTypeId'];
     $qcStandard = new qcStandardAct();
     $skuTypeQcArrList = $qcStandard->act_skuTypeQcList('');
     $sampleTypeList = array();
     $categoryInfo_ids = array();
     $categoryInfo = array();
     foreach ($skuTypeQcArrList as $skuTypeQcArrListValue) {
         $categoryInfo[$skuTypeQcArrListValue['id']] = $skuTypeQcArrListValue['typeName'];
         $sampleTypeList[$skuTypeQcArrListValue['id']] = $skuTypeQcArrListValue['typeName'] . "  " . $skuTypeQcArrListValue['describe'];
     }
     $goodsCategoryNameArray = explode("-", $goodsCategory);
     $goodsCategoryName = array();
     foreach ($goodsCategoryNameArray as $cvalue) {
         $goodsCategoryName[] = $getCategoryArr[$cvalue];
     }
     $goodsCategoryNameStr = join('-', $goodsCategoryName);
     //$categoryInfo_ids = array_keys($categoryInfo_ids);
     //$categoryStr = $sampleTypeList[$sampleTypeListId];
     //$img_return = $OmAvailableApiAct->act_getAllPic($reSpu, 'F');//图片接口
     //var_dump($img_return); exit;
     $data = UserCacheModel::qccenterGetErpGoodscount($sku);
     $goods_count = $data['goods_count'];
     /*$goods_location = $data['goods_location'];
     		$cguser = $data['cguser'];*/
     //$categoryL     = explode('-',$goodsCategory);
     /*foreach($category as $c_key=>$categoryArr){
     			if(in_array($categoryL[0],$categoryArr)){
     				if($c_key == '1'){
     					//SKU分类信息API接口
     					$cate			  = 1;
     					$goodsCategorySt  = $memc_obj->get_extral('pc_goods_category_'.$goodsCategory);
     					$categoryStr      = "{$goodsCategorySt['name']}:功能检测";	
     					break;
     				}else if($c_key == '2'){
     					//SKU分类信息API接口
     					$cate			  = 2;
     					$goodsCategorySt  = $memc_obj->get_extral('pc_goods_category_'.$goodsCategory);
     					$categoryStr    = "{$goodsCategorySt['name']}:尺寸质量检测";
     					break;
     				}else if($c_key == '3'){
     					//SKU分类信息API接口
     					$cate			  = 3;
     					$goodsCategorySt  = $memc_obj->get_extral('pc_goods_category_'.$goodsCategory);
     					$categoryStr    = "{$goodsCategorySt['name']}:对图检测";
     					break;
     				}
     			}else{
     				continue;	
     			}
     		}*/
     $where = "where sku='{$sku}' and is_delete=0 and sellerId=1 and getUserId='{$_SESSION['sysUserId']}' and detectStatus=1 order by getTime asc limit 1";
     $list = WhStandardModel::getNowWhList("*", $where);
     $num = $list[0]['num'];
     $infoid = $list[0]['id'];
     $goods_location = $list[0]['location'];
     $cguser = UserModel::getUsernameById($list[0]['purchaseId']);
     //$goods_count     = 'TEST';
     $where2 = "where sampleTypeId='{$sampleTypeListId}' and minimumLimit<='{$num}' and maximumLimit>='{$num}' limit 1";
     $list2 = DetectStandardModel::getNowStandardList("*", $where2);
     //如果是正常回测,获取待定回测信息备注
     $pendingInfo = PendingProductsModel::getPendingProductsList('backNote', ' WHERE infoId=' . $infoid);
     if ($pendingInfo) {
         $backNote = $pendingInfo[0]['backNote'];
     }
     //$time2 = time();
     //echo ($time2-$time1);
     if ($list) {
         self::$errCode = "200";
         $info = array();
         $info['info'] = "{$reSku} {$skuName} <br> 产品分类: {$goodsCategoryNameStr} <br>【 来货 {$num} 个,现有库存 " . $goods_count . " 个,仓位:" . $goods_location . ",采购:{$cguser} 】";
         $info['category'] = $sampleTypeListId;
         $info['categoryInfo'] = $categoryInfo;
         $info['sku'] = $reSku;
         $info['spu'] = $reSpu;
         $info['num'] = $num;
         $info['infoid'] = $infoid;
         $info['cate'] = $list2;
         $info['images'] = $img_return['data']['Description'][0];
         $info['backNote'] = !empty($backNote) ? $backNote : '';
         return $info;
     } else {
         self::$errCode = "003";
         self::$errMsg = "未找到该料号[{$sku}]对于的{$_SESSION['userName']}领取记录!";
         return false;
     }
 }