Beispiel #1
0
 public function actiondeletecpname()
 {
     $cateid = $_GET['ID'];
     $model = DealerCpname::model()->findByPk($cateid)->delete();
     echo json_decode($model);
 }
Beispiel #2
0
     if ($k == 1) {
         $makecar .= TransportMake::getMake($car['makeCode']) . ' ' . TransportCar::getCar($car['carCode']);
     } else {
         $makecar .= ',' . TransportMake::getMake($car['makeCode']) . ' ' . TransportCar::getCar($car['carCode']);
     }
     $k++;
 }
 echo F::msubstr($makecar);
 $makecar = '';
 ?>
                                 </td>
                                 <td>
                                 <?php 
 if (!empty($model['userID'])) {
     // $cpnames = DealerCpname::model()->findAll("OrganID = " . $dealer['userID']);
     $cpnames = DealerCpname::model()->findAll("OrganID = " . $model['userID']);
     //var_dump($cpnames);
     $k = 1;
     foreach ($cpnames as $cpname) {
         if ($k == 1) {
             $cp .= $cpname['BigName'] . ' ' . $cpname['SubName'] . ' ' . $cpname['CpName'];
         } else {
             $cp .= ',' . $cpname['BigName'] . ' ' . $cpname['SubName'] . ' ' . $cpname['CpName'];
         }
         $k++;
     }
     echo F::msubstr($cp);
     $cp = '';
 }
 ?>
                                 </td>
Beispiel #3
0
 /**
  * 生产商最新版本的所有产品
  * @param unknown $manufacturer_ID
  * @return unknown
  * @params goodsprice 商品价格
  * @params marketprice 市场指导价
  */
 public static function getGoodsByMDID($manufacturer_ID, $userID, $params, $page, $limit)
 {
     //授权品牌
     $organID = Commonmodel::getOrganID();
     $identity = Commonmodel::getIdentity(Yii::app()->user->id);
     $brands = MakePromitBrand::model()->find('DealerID=' . $organID . ' and OrganID=' . $manufacturer_ID);
     //查询销售价格
     $criteria = new CDbCriteria();
     //找到授权经销商的客户类别
     //折扣率
     //  $priceratio=  MakePromitPrice::model()->find('OrganID='.$manufacturer_ID);
     // $ratio=isset($priceratio['Level'.$brands['Level']])?$priceratio['Level'.$brands['Level']].'%':'100%';
     //                 $sql2='select distinct a.id as goodsID,b.goods_oe as OE,b.goods_brand as brandid,b.version_name as verion_name,b.goods_no as goodsno,b.goods_name as goodsname,'
     //                       .' b.goods_category as categoryid,b.standard_id'
     //                       . " from  tbl_make_goods a ,tbl_make_goods_version b,tbl_make_goods_vehicle c"
     //                       . '  where a.id=b.goods_id and a.NewVersion=b.version_name'
     //                       . "  and a.ISdelete='0' and b.ISdelete=0"
     //                       . "  and a.organID='$manufacturer_ID' ";
     $sql2 = "select distinct a.id as goodsID ,b.goods_category as category_id,b.goods_oe as OE,b.goods_brand as brand,b.organID,\n                          a.NewVersion as version_name,b.goods_no as goodsno,b.goods_name as goodsname,\n                           b.benchmarking_brand,b.benchmarking_sn,a.create_time,";
     if ($identity['identity'] == 2) {
         $sql2 .= 'd.Price,';
     }
     $sql2 .= " b.inventory as inventory,b.senddays,b.description,a.IsSale,b.standard_id" . " from  tbl_make_goods a ,tbl_make_goods_version b ";
     if (!empty($params['goodsvehicle'])) {
         $sql2 .= ",tbl_make_goods_vehicle c";
     }
     if ($identity['identity'] == 2) {
         $sql2 .= ',tbl_make_price_relation d';
     }
     $sql2 .= '  where a.id=b.goods_id and a.NewVersion=b.version_name' . "  and a.ISdelete='0' and b.ISdelete=0" . "  and a.organID='{$manufacturer_ID}' ";
     if ($identity['identity'] == 2 && $brands['CustomerType']) {
         $sql2 .= "and d.TypeID= {$brands['CustomerType']} and d.GoodsID=a.id and d.Price is not null";
         $sql2 .= " and a.IsSale=0";
     }
     if ($params && is_array($params)) {
         if ($brands['BrandName']) {
             $sql2 .= " and  b.goods_brand in (0" . $brands['BrandName'] . "0)";
         }
         //商品类别搜索
         if (!empty($params['goodscategory'])) {
             $sql2 .= ' and b.goods_category=' . $params['goodscategory'];
         }
         //商品名称搜索
         if (!empty($params['goodsname'])) {
             $sql2 .= " and b.goods_name like '%{$params['goodsname']}%'";
         }
         //商品编号搜索
         if (!empty($params['goodsno'])) {
             $sql2 .= " and b.goods_no like '%{$params['goodsno']}%'";
         }
         //商品OE号搜索
         if (!empty($params['oe'])) {
             $sql2 .= " and b.goods_oe like '%{$params['oe']}%'";
         }
         //商品品牌搜索
         if (!empty($params['goodsbrand'])) {
             $sql2 .= " and b.goods_brand ='{$params['goodsbrand']}'";
         }
         //适用车型搜索
         if (!empty($params['goodsvehicle'])) {
             $sql2 .= " and c.Name  like '%{$params['goodsvehicle']}%' and a.id=c.GoodsID and a.NewVersion=c.VersionName";
         }
         //             //是否上架查询
         if (is_numeric($params['issale'])) {
             $sql2 .= " && a.IsSale='{$params['issale']}'";
         }
         //配件品类
         if (!empty($params['standardid'])) {
             $sql2 .= ' and b.standard_id=' . $params['standardid'];
         } else {
             //经营品类
             $standmodel = DealerCpname::model()->findAll("OrganID=:organID", array(':organID' => $manufacturer_ID));
             $standids = '';
             $standarr = array();
             foreach ($standmodel as $m) {
                 $standarr[] = $m['CpNameID'];
             }
             $standids = implode(',', $standarr);
             if (!$standids) {
                 $standids = '0';
             }
             $sql2 .= ' and b.standard_id in (' . $standids . ')';
         }
         //高级筛选
         //此处 key : 查询属性 between,normall; $val['name']: 模板名称;$val["value"]:值 eg:value / value,value2
         if (is_array($params["more"])) {
             foreach ($params["more"] as $key => $val) {
                 $sql2 .= " and exists(\n\t           \t\t   \t\tSELECT DISTINCT(f.goods_id) FROM `tbl_make_goods_values` f,`tbl_make_goods_template` g where\n\t           \t\t   \t\tg.id=f.template_id and a.id=f.goods_id\n\t           \t\t   \t\tand g.organID='{$manufacturer_ID}' and g.standard_id='{$params['standardid']}'";
                 //判断查询属性
                 if ($val["type"] == "between") {
                     //区间查询方式: $val["value"] = value,value2;
                     $valArr = explode(',', $val["value"]);
                     $sql2 .= "and (g.name='" . $val["name"] . "' and f.value between {$valArr['0']} and {$valArr['1']})) ";
                 } else {
                     if ($val["type"] == "normall") {
                         $sql2 .= "and (g.name='" . $val["name"] . "' and f.value= '" . $val["value"] . "')) ";
                     }
                 }
             }
         }
     }
     //把make_goods里面上架的查询出来(0/1/上架/下架)  不写则全部查询
     $sql2 .= " group by a.id order by a.id desc";
     $result = Yii::app()->db->createCommand($sql2)->queryAll();
     if ($page && $limit) {
         $count = count($result);
         $pages = new CPagination($count);
         //设置分页页数
         $pages->setPageSize($limit);
         $pages->applyLimit($criteria);
         $result = Yii::app()->db->createCommand($sql2 . " LIMIT :offset,:limit");
         //绑定分页参数
         $offset = $pages->currentPage * $pages->pageSize;
         $size = $pages->pageSize;
         $result->bindValue(':offset', $pages->currentPage * $pages->pageSize);
         $result->bindValue(':limit', (int) $limit);
         $result = $result->queryAll();
     }
     $res = array();
     foreach ($result as $key => $val) {
         $res[$key] = $val;
         $OEArr = explode(',', $val['OE']);
         $res[$key]["car"] = self::getVehicleByOEArr($OEArr);
         //查询品牌名称
         $brandmodel = MakeGoodsBrand::model()->findByPK($val['brand']);
         // $res[$key]['brand']=$brandmodel['BrandName'];
         $res[$key]['brandname'] = $brandmodel['BrandName'];
         //查询类别名称
         $categorymodel = MakeGoodsCategory::model()->findByPk($val['category_id']);
         $res[$key]['category'] = $categorymodel['name'];
         //查询标准名称
         $standardmodel = Gcategory::model()->findByPk($val['standard_id']);
         $res[$key]['cp_name'] = $standardmodel['name'];
         //查询车型
         $cmodel = MakeGoodsVehicle::model()->find('GoodsID=' . $val['goodsID'] . ' and VersionName="' . $val['version_name'] . '"');
         if ($cmodel) {
             $res[$key]['carmodel'] = $cmodel->Name;
         }
         if ($val['Price']) {
             $res[$key]['marketprice'] = $val['Price'];
         }
         //根据客户类别获取商品价格
         //                        if($brands['CustomerType'])
         //                        {
         //                        $sql_price="select * from tbl_make_price_relation where TypeID= {$brands['CustomerType']} and GoodsID= $val[goodsID]";
         //                        $price=DBUtil::query($sql_price);
         //                        $res[$key]['marketprice']=$price['Price'];
         //                        }
         //查询标准名称对应的参数名称
         //                       $temname= MakeGoodsTemplate::model()->findAll("organID=:organID and standard_id=:stand and ISdelete='N'",array(
         //                        			':organID'=>$manufacturer_ID,':stand'=>$val['standard_id']));
         //查询商品品与标准名称参数名称对应的参数值
         $paramssql = 'SELECT a.id,a.name,b.value FROM `tbl_make_goods_template` a,`tbl_make_goods_values` b where a.id=b.template_id and b.goods_id=' . $val['goodsID'] . ' and b.version_name="' . $val['version_name'] . '"';
         $paramsvalue = Yii::app()->db->createCommand($paramssql)->queryAll();
         $res[$key]['params'] = '';
         foreach ($paramsvalue as $p) {
             $res[$key]['params'] .= $p['name'] . ':' . $p['value'] . ';';
         }
         $res[$key]['OE'] = $val['OE'];
         $res[$key]['Brand'] = $val['brand'];
         $res[$key]['version_name'] = $val['version_name'];
         $res[$key]['GoodsNo'] = $val['goodsno'];
         $res[$key]['GoodsName'] = $val['goodsname'];
         $res[$key]['BenchBrand'] = $val['benchmarking_brand'];
         $res[$key]['BenchNo'] = $val['benchmarking_sn'];
         $res[$key]['benchmarking_brand'] = $val['benchmarking_brand'];
         $res[$key]['benchmarking_sn'] = $val['benchmarking_sn'];
         $res[$key]['GoodsBrand'] = $val['brand'];
         $res[$key]['BrandName'] = $val['brandname'];
         $res[$key]['GoodsCategory'] = $val['category_id'];
         //                    $datas[$key]['CategoryName']=$val['category'];
         $res[$key]['inventory'] = $val['inventory'];
         $res[$key]['Days'] = $val['senddays'];
         $res[$key]['Desc'] = $val['description'];
         //b.maincategory,b.subcategory,b.standard_id
         $res[$key]['standard_id'] = $val['standard_id'];
         $res[$key]['create_time'] = date('Y-m-d H:i:s', $val['create_time']);
         //获取标准名称参数值
         if (!empty($val['standard_id'])) {
             $params = MakeGoodsValues::model()->findAll('standard_id=' . $val['standard_id'] . ' and goods_id=' . $val['goodsID'] . ' and version_name="' . $val['version_name'] . '"');
             $value = array();
             foreach ($params as $param) {
                 $k = $param['template_id'];
                 $value[$k] = $param['value'];
                 $res[$key][$k] = $param['value'];
             }
             $res[$key]['paramsvalue'] = $value;
         }
         if ($val['IsSale'] == 0) {
             $res[$key]['IsSale'] = '已上架';
         } else {
             $res[$key]['IsSale'] = '已下架';
         }
     }
     if ($page && $count) {
         return array('rows' => $res, 'total' => $count);
     }
     return $res;
 }
Beispiel #4
0
 public static function GetStand($makerID)
 {
     //$organID= self::getOrganID();
     //获取主营品类
     $model = DealerCpname::model()->findAll("OrganID=:organID", array(':organID' => $makerID));
     //默认取第一个配件品类
     $firstcpname;
     $cpnames = array();
     if ($model) {
         foreach ($model as $key => $val) {
             $data[$key]['CpNameID'] = $val['CpNameID'];
             $data[$key]['CgName'] = $val['BigName'] . '-' . $val['SubName'] . '-' . $val['CpName'];
         }
         $firstcpname = $model[0]['CpNameID'];
         $cpnames = CHtml::listData($data, 'CpNameID', 'CgName');
     }
     return array('firstcpname' => $firstcpname, 'cpnames' => $cpnames);
 }
Beispiel #5
0
 /**
  * 批量上传商品
  */
 public function actionUploadgoods()
 {
     $this->pageTitle = Yii::app()->name . '-' . "商品管理";
     //文件模板为product
     $template = "makergoods";
     $userID = Yii::app()->user->id;
     $organID = Commonmodel::getOrganID();
     //上传文件
     if ($_POST['leadExcel'] == "true") {
         $filename = rand(1000, 10000) . Yii::app()->user->id . strrchr($_FILES['inputExcel']['name'], '.');
         //            $filename = iconv("utf-8", "gb2312", $_FILES['inputExcel']['name']);
         $tmp_name = $_FILES['inputExcel']['tmp_name'];
         //$filePath = dirname(Yii::app()->BasePath) . "/themes/default/uploadsfile/dealer/execl/";
         $filePath = Yii::app()->params['uploadPath'] . 'maker/excel/' . $organID . '/';
         $upload_result = UploadsFile::uploadFile($filename, $tmp_name, $filePath);
         //如果上传成,则解析Excel文件
         if ($upload_result['success']) {
             //解析Excel文件,返回结果为错误消息,如果不为空则表明发生错误
             $uploadfile = $upload_result['uploadfile'];
             $dataImport = new MakeGoodsImport();
             $dataImport->GoodsHeadArr(Yii::app()->request->getParam('importCategory'));
             $createtime = time();
             $data = array('OrganID' => $organID, 'UserID' => $userID, 'CreateTime' => $createtime);
             $result = $dataImport->parse($uploadfile, $template, $data);
             //如果不成功则返回错误结果
             if ($result['success'] == false) {
                 echo json_encode(array('message' => $result['error'], 'success' => false));
                 Yii::app()->end();
             }
             $templaterRows = $result['templaterRows'];
             $Sdata = $result['Sdata'];
             //                $bool = false;
             $message = array();
             if ($Sdata && $templaterRows) {
                 $Cpname = DealerCpname::model()->find("OrganID=:organID and CpNameID=:CpNameID", array(':organID' => $organID, ":CpNameID" => Yii::app()->request->getParam('importCategory')));
                 $com = 0;
                 $errkey = 0;
                 //调用商品编号验证唯一性
                 $res = $this->checkgoodno();
                 $version_sql = "insert into  tbl_make_goods_version (\n                        version_name, organID,userID,goods_oe,\n                        goods_brand,goods_id,goods_no,goods_name,benchmarking_brand,benchmarking_sn,\n                        standard_id,inventory,senddays,description\n                        )  values";
                 $value_sql = "insert into tbl_make_goods_values (organID,userID,standard_id,value,version_name,goods_id,template_id)\n                        values";
                 $excel_no = array();
                 foreach ($Sdata as $key => $dval) {
                     $makegoods = new MakeGoods();
                     $makegoodsvesion = new MakeGoodsVersion();
                     $vesionAtt = $makegoodsvesion->attributes;
                     $arr = array();
                     $continue = false;
                     $k = 0;
                     $dval[$k] = ltrim($dval[$k]);
                     if (in_array($dval[$k], $res)) {
                         $message[$errkey] = "第" . ($com + 1) . "条数据导入失败 原因:商品编号已存在";
                         $errkey++;
                         $continue = true;
                     }
                     if (!empty($excel_no) && in_array($dval[$k], $excel_no)) {
                         $message[$errkey] = "第" . ($com + 1) . "条数据导入失败 原因:Excel表格中有重复的商品编号";
                         $errkey++;
                         $continue = true;
                     }
                     if (empty($dval[$k]) && $dval[$k] != 0) {
                         $message[$errkey] = "第" . ($com + 1) . "条数据导入失败 原因:商品编号为空";
                         $errkey++;
                         $continue = true;
                     }
                     foreach ($templaterRows as $pkey => $pval) {
                         //                             if ($pval == 'goods_no') {
                         //                                 $dval[$k] = ltrim($dval[$k]);
                         //                                 if (empty($dval[$k])) {
                         //                                     $message[$errkey] = "第" . ($com + 1) . "条数据导入失败 原因:商品编号为空";
                         //                                     $errkey++;
                         //                                     $continue = true;
                         //                                 } else {
                         //                                 	if(in_array($dval[$k],$res))
                         //                                 	{
                         //                                 		$message[$errkey] = "第" . ($com + 1) . "条数据导入失败 原因:商品编号已存在";
                         //                                 		$errkey++;
                         //                                 	    $continue = true;
                         //                                 	}
                         //                                    // $ifcontinue = MakeGoodsVersion::model()->find("goods_no=:NO and ISdelete=0 and organID=:organID", array(":NO" => $dval[$k],':organID'=>$organID));
                         //                                 }
                         //                             }
                         //                             if (!empty($ifcontinue)) {
                         //                                 $message[$errkey] = "第" . ($com + 1) . "条数据导入失败 原因:商品编号已存在";
                         //                                 $errkey++;
                         //                                 $continue = true;
                         //                             }
                         //                             $ifcontinue = "";
                         if ($pval == 'goods_name') {
                             $dval[$k] = ltrim($dval[$k]);
                             if (empty($dval[$k]) && $dval[$k] != 0) {
                                 $message[$errkey] = "第" . ($com + 1) . "条数据导入失败 原因:商品名称为空";
                                 $errkey++;
                                 $continue = true;
                             }
                         }
                         if ($pval == 'goods_oe') {
                             $dval[$k] = ltrim($dval[$k]);
                             $dval[$k] = str_replace(",", ",", $dval[$k]);
                             if (empty($dval[$k]) && $dval[$k] != 0) {
                                 $message[$errkey] = "第" . ($com + 1) . "条数据导入失败 原因:商品OE号为空";
                                 $errkey++;
                                 $continue = true;
                             }
                         }
                         if (substr($pval, 0, 1) == '_') {
                             $pval = substr($pval, 1);
                             $arr[$k]['value'] = $dval[$k];
                             $arr[$k]['template_id'] = $pval;
                         } else {
                             if ($pval == 'brand') {
                                 $vesionAtt["goods_brand"] = $this->getBrandID($dval[$k]);
                             } elseif ($pval == 'inventory') {
                                 if ($dval[$k] == '有') {
                                     $vesionAtt[$pval] = 1;
                                 } else {
                                     $vesionAtt[$pval] = 0;
                                 }
                             } else {
                                 $vesionAtt[$pval] = $dval[$k];
                             }
                         }
                         $k++;
                     }
                     $com++;
                     if ($continue) {
                         continue;
                     }
                     $excel_no[$k] = $dval[$k];
                     //$makegoodsvesion->attributes = $vesionAtt;
                     $time = time();
                     $goods_sql = "insert into tbl_make_goods (create_time,updatetime,organID,userID,NewVersion)\n\t\t\t\t\t\t\t\tvalue ({$time},{$time},{$organID},{$userID},'V1.0.0')";
                     $goods_res = DBUtil::execute($goods_sql);
                     $a = 1;
                     $lastGoodsID = Yii::app()->db->getLastInsertID();
                     if ($goods_res) {
                         $a = 2;
                         //执行版本表
                         $version_sql .= " ('V1.0.0',{$organID},{$userID},'{$vesionAtt['goods_oe']}','{$vesionAtt['goods_brand']}',{$lastGoodsID},\n\t\t\t\t\t\t\t\t'{$vesionAtt['goods_no']}','{$vesionAtt['goods_name']}','{$vesionAtt['benchmarking_brand']}',\n                        \t   '{$vesionAtt['benchmarking_sn']}',{$Cpname->CpNameID},'{$vesionAtt['inventory']}','{$vesionAtt['senddays']}'\n                        \t   ,'{$vesionAtt['description']}'),";
                         //生产参数值sql
                         foreach ($arr as $kv => $vval) {
                             $value_sql .= " ({$organID},{$userID},'{$Cpname->CpNameID}','{$vval['value']}','V1.0.0','{$lastGoodsID}','{$vval['template_id']}'),";
                         }
                         //插入适用车型
                         if ($vesionAtt[carmodel] || $vesionAtt[carmodel] == 0) {
                             $pinyin = F::pinyin1($vesionAtt[carmodel]);
                             $carmodel_sql = "insert into tbl_make_goods_vehicle (CreateTime,UpdateTime,OrganID,UserID,VersionName,GoodsID,`Name`,PinYin)\n                                                                    value ({$time},{$time},{$organID},{$userID},'V1.0.0',{$lastGoodsID},'{$vesionAtt['carmodel']}','{$pinyin}')";
                             $carmodel_res = DBUtil::execute($carmodel_sql);
                         }
                     }
                 }
             }
             if ($a == 2) {
                 $version_sql = rtrim($version_sql, ",");
                 $version_sql = preg_replace('/\\\\/', '/', $version_sql);
                 $version_res = DBUtil::execute($version_sql . ';');
                 $value_sql = rtrim($value_sql, ",");
                 $value_sql = preg_replace('/\\\\/', '/', $value_sql);
                 $value_res = DBUtil::execute($value_sql . ';');
             }
             //                $insert_sql = $result['sql'];
             //
             //                $sql_result = DBUtil::execute($insert_sql);
             //如果SQL执行不成功则返回错误结果
             if (!empty($message)) {
                 //                    foreach ($message as $key => $val) {
                 //                        $resDa.="<span class='errcolor'>$val</span><br>";
                 //
                 //                    }
                 echo json_encode(array('success' => false, 'message' => $message));
                 Yii::app()->end();
             } else {
                 // 上传成功,则把上传成功的数据展示出来
                 echo json_encode(array('success' => true, 'message' => '导入商品成功'));
                 Yii::app()->end();
             }
         } else {
             $message = $upload_result['error'];
             echo json_encode(array('success' => false, 'message' => $message));
             Yii::app()->end();
         }
     }
 }
Beispiel #6
0
 /**
  * 通过配件大类过去标准名称
  */
 public function actionGetcpnamebybigp()
 {
     if ($_GET["bigcode"]) {
         $subparts = DealerSubparts::model()->find("BigCode=:BigCode", array(":BigCode" => $_GET["bigcode"]));
         //   $subparts = DealerSubparts::model()->findAll('BigCode='.$_GET["bigcode"]]);
         //  foreach ($subparts as $ci) {
         $data = DealerCpname::model()->findAll("SubCode=:SubCode", array(":SubCode" => $subparts['SubCode']));
         $data = CHtml::listData($data, "ID", "CpName");
         //       break;
         //  }
         echo json_encode($data);
     }
 }
Beispiel #7
0
 public function actionDetail()
 {
     $model = Dealer::model()->find("userID=:userID", array(":userID" => $_GET['dealer']));
     // 机构照片
     $organphotoSql = "select id, photoName from tbl_dealer_organphoto where dealerID = " . $_GET['dealer'];
     $organphotos = DBUtil::queryAll($organphotoSql);
     $brands = DealerBrand::model()->findAll("OrganID = {$_GET['dealer']}");
     $data = array();
     foreach ($brands as $key => $brand) {
         $data[$key]['brandname'] = $brand['BrandName'];
     }
     //主营车系
     $dealerv = DealerVehicle::model()->findAll("userID=:userID", array(":userID" => $_GET['dealer']));
     //主营品类
     $cpnames = DealerCpname::model()->findAll("OrganID=:userID", array(":userID" => $_GET['dealer']));
     $this->render("detail", array('model' => $model, 'organphotos' => $organphotos, 'dealerv' => $dealerv, 'cpnames' => $cpnames, 'data' => $data));
 }
Beispiel #8
0
 /**
  * 获取配件大类的ID
  */
 public static function getCpNameID($cpname)
 {
     $cpnameID = DealerCpname::model()->find("CpName like '%{$cpname}%'");
     return $cpnameID['ID'];
 }
Beispiel #9
0
 public function actionCheckdel()
 {
     $cateid = $_GET['cateid'];
     $organID = Commonmodel::getOrganID();
     $Cpid = DealerCpname::model()->findByPk($cateid);
     if (!empty($Cpid->CpNameID)) {
         $template = MakeGoodsTemplate::model()->find("organID=:organID and standard_id=:cpid and ISdelete='N'", array(":organID" => $organID, ":cpid" => $Cpid->CpNameID));
         if (!empty($template)) {
             echo json_encode("此品类中已有参数模版,不可删除!");
         } else {
             $goods = MakeGoodsVersion::model()->findAll("organID=:organID and goods_category=:cpid and ISdelete=0", array(":organID" => $organID, ":cpid" => $Cpid->CpNameID));
             if (!empty($goods)) {
                 echo json_encode("此品类中已有商品,不可删除!");
             } else {
                 echo json_encode("OK");
             }
         }
     } else {
         echo json_encode("false");
     }
 }