<?php
/**
  * @method EPC
  * @author soul
  * @copyright 2016/3/31
  */
class EpcItem extends EpcBase
{
	private function imgUrlbase()
	{
		$url = mvc::$cfg['urls']['etkPic'];
		/*switch($this->EtkId)
		{
			case 7: $url .= 'mercedes/';break;
			case 2: $url .= 'bmw/img/';break;
		}*/
		return $url;
	}
	/**
	  * @method 获取ETK的车型零件组
	  * @param  etkCodeArr ETK code
	  * @author soul
	  * @copyright 2017/4/13
	  * @return 
	  {"status":true,"data": [],"code":""}
	  {"status":false,"data":'失败原因',"code":'error'}
	  */
	public function getGroup($etkCodeArr, $mod3Id = 0)
	{
		$arr = [];
		/*取消 soul 2019/1/25
		if(!empty($mod3Id))
		{
			$YpcBase = new YpcBase();
			$res = $YpcBase->Get('temp_chapeijian', ['count(*) as count'], sprintf(" and cat_m3_id=%d", $mod3Id), true);
			if(!empty($res['data']['count']))
			{
				$arr[] = ['grp1_id'=>-1, 'grp1_name'=>'保养件', 'children'=>1, 'pmg_parent'=>'', 'grp_img'=>mvc::$cfg['urls']['b2c'].'static/images/baoyangjian.jpg'];
			}
		}*/

		$etkCodeArr = array_unique($etkCodeArr);
		if(empty($etkCodeArr)) return LibFc::ReturnData(true, $arr);

		$codeArr = [];
		foreach($etkCodeArr as $v)
		{
			$codeArr[] = sprintf("'%s'", LibFc::Escape($v));
		}
		switch($this->EtkId)
		{
			case 7:
				$where = sprintf('and val_value in (%s) order by group_id', implode(',', $codeArr));
				$res = $this->get('data_group join data_value on val_id=group_val_id', ['group_id as grp1_id', 'group_name as grp1_name, group_empty as children'], $where);
				foreach ($res['data'] as $v)
				{
					$sText3Bit = substr($v['grp1_name'], 0, 3);
					$sText4Bit = substr($v['grp1_name'], 3, 1);
					if (LibFc::Int($sText3Bit) && ('.' == $sText4Bit))
					{
						$v['grp1_name'] = sprintf(
							'<b class="bpill">%s</b>%s',
							substr($v['grp1_name'], 0, 4),
							substr($v['grp1_name'], 4)
						);
					}
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			case 11:
				$where = sprintf('and val_value in (%s) order by group_id', implode(',', $codeArr));
				$res = $this->get('data_group join data_value on val_id=group_val_id', ['group_id as grp1_id', 'group_name as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$sText3Bit = substr($v['grp1_name'], 0, 3);
					$sText4Bit = substr($v['grp1_name'], 3, 1);
					if (LibFc::Int($sText3Bit) && ('.' == $sText4Bit))
					{
						$v['grp1_name'] = sprintf(
							'<b class="bpill">%s</b>%s',
							substr($v['grp1_name'], 0, 4),
							substr($v['grp1_name'], 4)
						);
					}
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			case 2 :
				$where = sprintf('and uid_text in (%s) group by prt_code_1 order by prt_code_1', implode(',', $codeArr));
				$table = 'data_code JOIN data_links ON vpg_uid_id = uid_id
				  JOIN data_partgrp ON vpg_prt_id = prt_id
				  LEFT JOIN data_picture ON vpg_img_id= img_id';
				$res = $this->get($table, ['prt_code_1 as grp1_id', 'prt_text_1 as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = $v['grp1_id'];
					$v['grp_img'] = sprintf('%sEPC/bmw/group/group_%s-00-P.jpg', mvc::$cfg['urls']['etkPic'], $v['grp1_id']);
					$arr[] = $v;
				}
			break;
			case 1:
				$where = sprintf('and vin_text in (%s) group by prt_id order by prt_id', implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['prt_id as grp1_id', 'prt_name as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			case 5:
				$where = sprintf('and vin_name in (%s) group by prt_item_1, prt_item_2 ORDER BY prt_id', implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = prt_vin_id';
				$res = $this->get($table, ['concat(prt_item_1, "_", prt_item_2) as grp1_id', 'concat(prt_name_1, "-", prt_name_2) as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			case 12:
			case 10:
				$where = sprintf('and vin_value in (%s) GROUP BY grp_master_key ORDER BY grp_master_key', implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_master_key as grp1_id', 'grp_master_text as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = $v['grp1_id']; $v['grp_img'] = '';
					if($v['grp1_id'] == 0){
						$index0 = $v;
					}else{
						$arr[] = $v;
					}
				}
				if(!empty($index0)) $arr[] = $index0;
			break;
			case 13:
				$where = sprintf('and vin_name in (%s) group by grp_item_2 ORDER BY grp_item_2', implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_item_2 as grp1_id', 'concat(grp_item_1, "-", grp_item_2, " ", grp_name_2) as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			case 9:
				$where = sprintf('and val_value in (%s) GROUP BY grp_prt_id ORDER BY grp_prt_id', implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON val_id = grp_vin_id';
				$res = $this->get($table, ['grp_prt_id as grp1_id', 'grp_name_1 as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = $v['grp1_id']; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//丰田
			case 8:
				$where = sprintf('and val_realoem in (%s) GROUP BY grp_item_1 ORDER BY grp_item_1', implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON val_id = grp_vin_id';
				$res = $this->get($table, ['grp_item_1 as grp1_id', 'grp_name_1 as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = $v['grp1_id']; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//三菱
			case 14:
				$where = sprintf('and vin_value in (%s) GROUP BY grp_item_2 ORDER BY grp_item_2', implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_item_2 as grp1_id', 'grp_name_2 as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = $v['grp1_id']; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//马自达
			case 15:
				$where = sprintf('and val_value in (%s) GROUP BY grp_item_1 ORDER BY grp_item_1', implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON val_id = grp_val_id';
				$res = $this->get($table, ['grp_item_1 as grp1_id', 'grp_name_1 as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//奇瑞
			case 4:
				$where = sprintf('and vin_name in (%s) GROUP BY prt_item_1 ORDER BY prt_item_1', implode(',', $codeArr));
				$table = 'data_group JOIN data_links ON prt_id = ppm_pmg_id JOIN data_value ON vin_id = ppm_vin_id';
				$res = $this->get($table, ['prt_item_1 as grp1_id', 'prt_name_1 as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['childimg'] = 0;
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//名爵 荣威
			case 16:
				$where = sprintf('and vin_value in (%s) GROUP BY grp_item_1 ORDER BY grp_item_1', implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_item_1 as grp1_id', 'grp_name_1 as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//现代起亚
			case 3:
				$where = sprintf(" and vin_name in (%s) GROUP BY grp_id ORDER BY grp_order", implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_id as grp1_id', 'grp_name_1 as grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//斯巴鲁
			case 17:
				$where = sprintf(" and vin_name in (%s) GROUP BY grp_item_1 ORDER BY grp_item_1", implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_item_1 AS grp1_id,grp_name_1 AS grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//通用
			case 18:
				$where = sprintf(" and vin_value in (%s)", implode(',', $codeArr));
				$table = 'data_value JOIN data_group on vin_value = grp_item_1';
				$res = $this->get($table, ['grp_id AS grp1_id,grp_name_2 AS grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//长安
			case 19:
				$where = sprintf(" and vin_value in (%s) GROUP BY grp_name_1 ORDER BY grp_name_1", implode(',', $codeArr));
				$table = 'data_value JOIN data_group on vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_name_1 AS grp1_id,grp_name_1 AS grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//克莱斯勒
			case 20:
				$where = sprintf(" and vin_value in (%s) GROUP BY grp_name_1 ORDER BY grp_name_1+0", implode(',', $codeArr));
				$table = 'data_value JOIN data_group on vin_id = grp_vin_id left join data_picture on img_id=grp_group_img_id';
				$res = $this->get($table, ['grp_name_1 AS grp1_id,grp_name_1 AS grp1_name, img_path, img_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; 
					$v['grp_img'] = empty($v['img_name']) ? '': sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);
					unset($v['img_name']);
					$arr[] = $v;
				}
			break;
			//海马
			case 21:
				$where = sprintf(" and vin_value in (%s) GROUP BY grp_name_1 ORDER BY grp_name_1", implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_name_1 AS grp1_id,grp_name_1 AS grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			case 22:
				$where = sprintf(" and vin_value in (%s) GROUP BY grp_name_1 ORDER BY grp_order_1", implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_name_1 AS grp1_id,grp_name_1 AS grp1_name, grp_order_1 as pmg_parent'], $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			case 23:
				$where = sprintf(" and vin_value in (%s) GROUP BY grp_item_1 ORDER BY grp_item_1", implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_item_1 AS grp1_id,grp_name_1 AS grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			case 24:
				$where = sprintf(" and vin_value in (%s) GROUP BY grp_master_key ORDER BY grp_master_key", implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_master_key AS grp1_id, grp_master_text AS grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//路虎
			case 26:
				$where = sprintf(" and vin_value in (%s) GROUP BY grp_item_1_re ORDER BY grp_item_1_re", implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_item_1_re AS grp1_id, concat(grp_item_1, " ", grp_name_1) AS grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//宝沃
			case 28:
				$where = sprintf(" and vin_value in (%s) GROUP BY grp_item_1 ORDER BY grp_item_1", implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_item_1 AS grp1_id, grp_name_1 AS grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			//北汽新能源
			case 29:
				$where = sprintf(" and vin_value in (%s) GROUP BY grp_item_1 ORDER BY --grp_item_1", implode(',', $codeArr));
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_item_1 AS grp1_id, grp_name_1 AS grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
			case 32:
				$where = sprintf(" and vin_text in (%s) GROUP BY grp_id ORDER BY grp_num", implode(',', $codeArr));
				$table = 'vin JOIN data_group ON vin_id = grp_vin_id';
				$res = $this->get($table, ['grp_id AS grp1_id, grp_label AS grp1_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['pmg_parent'] = ''; $v['grp_img'] = '';
					$arr[] = $v;
				}
			break;
		}
		foreach($arr as $k=>$v)
		{
			//图片版权
			if(!$this->EPCIMGALL && stripos($v['grp_img'], 'copyright_') !== false) $v['grp_img'] = '';
			if(!isset($v['childimg'])) $arr[$k]['childimg'] = 1;
			if(!isset($v['children'])) $arr[$k]['children'] = 1;
			if(isset($v['grp1_name'])) $arr[$k]['grp1_name'] = strip_tags($v['grp1_name']);
		}
		return LibFc::ReturnData(true, $arr);
	}


	/**
	  * @method 获取ETK的车型零件组的子零件
	  * @param  grp1Id 组ID
	  * @param  etkCodeArr ETK code
	  * @author soul
	  * @copyright 2017/4/13
	  * @return 
	  {"status":true,"data": [],"code":""}
	  {"status":false,"data":'失败原因',"code":'error'}
	  */
	public function getGroupPart($grp1Id, $etkCodeArr)
	{
		$arr = [];
		$etkCodeArr = array_unique($etkCodeArr);
		if(empty($etkCodeArr) || $grp1Id == '') return LibFc::ReturnData(true, $arr);
		
		$grp1Id = LibFc::Escape($grp1Id);
		$codeArr = [];
		foreach($etkCodeArr as $v)
		{
			$codeArr[] = sprintf("'%s'", LibFc::Escape($v));
		}
		switch($this->EtkId)
		{
			case 7:
			case 11:
				$grp1Id = (int) $grp1Id;
				$table = 'data_parts join data_value on val_id=part_val_id join data_picture on part_img_id=img_id';
				$where = sprintf('and val_value in (%s) and part_group_id=%d group by part_id order by part_id', implode(',', $codeArr), $grp1Id);
				$res = $this->get($table, ['part_id as grp2_id', 'part_name as grp2_name', 'img_path', 'img_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '': sprintf('%s%s/800xX/%s', $this->imgUrlbase(), $v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 2 :
				$where = sprintf("and uid_text in (%s) and prt_code_1='%s' order by prt_code_2, prt_text_3, vpg_year_s, vpg_year_e", implode(',', $codeArr), $grp1Id);
				$table = 'data_code JOIN data_links ON vpg_uid_id = uid_id
				  JOIN data_partgrp ON vpg_prt_id = prt_id
				  LEFT JOIN data_picture ON vpg_img_id= img_id';
				$filed = ['vpg_id as grp2_id, prt_code_2 as pmg_second, prt_text_2 as pmg_diagram, prt_text_3 as grp2_name, vpg_year_s, vpg_year_e, vpg_remark, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$key = 's'.$v['pmg_second'];
					$arr[$key]['part'] = ['pmg_second'=>$v['pmg_second'], 'pmg_diagram'=>$v['pmg_diagram']];  
					unset($v['pmg_second']);unset($v['pmg_diagram']);
					$v['grp_img'] = empty($v['img_name']) ? '': sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					$v['grp2_notice'] = '';
					if(!empty($v['vpg_year_s']))
						$v['grp2_notice'] .= sprintf('%s.%s~%s.%s', substr($v['vpg_year_s'], 0, 4), substr($v['vpg_year_s'], 4, 2), substr($v['vpg_year_e'], 0, 4),substr($v['vpg_year_e'], 4, 2));
					if(!empty($v['vpg_remark']))
						$v['grp2_notice'] .= $v['vpg_remark'];

					unset($v['vpg_remark']);unset($v['vpg_year_s']);unset($v['vpg_year_e']);unset($v['img_path']);unset($v['img_name']);
					$arr[$key]['child'][] = $v;
				}
			break;
			case 1:
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id JOIN data_links ON lnk_grp_id = grp_id left JOIN data_group_image ON lnk_img_id = img_id';
				$where = sprintf("and vin_text in (%s) and prt_id='%s' group by grp_id order by grp_id", implode(',', $codeArr), $grp1Id);
				$res = $this->get($table, ['grp_id as grp2_id', 'grp_name as grp2_name', 'img_path', 'img_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 5:
				$grp1IdArr = explode('_', $grp1Id);
				$table = 'data_group_list
					JOIN data_group ON prt_id = list_prt_id
					JOIN data_value ON vin_id = prt_vin_id
					JOIN data_links ON lnk_vin_id = vin_id AND lnk_prt_id = prt_id AND lnk_list_id = list_id
					left JOIN data_picture ON img_id=lnk_img_id';
				$where = sprintf("and vin_name in (%s) and prt_item_1='%s' and prt_item_2='%s' GROUP BY list_id", implode(',', $codeArr), $grp1IdArr[0], $grp1IdArr[1]);
				$res = $this->get($table, ['list_id as grp2_id', 'prt_name_3 as grp2_notice', 'titre as grp2_name', 'img_path', 'img_name'], $where);
				foreach ($res['data'] as $v)
				{
					$key = 's01';
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr[$key]['child'][] = $v;
				}
			break;
			case 12:
			case 10:
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id left JOIN data_picture ON grp_img_id = img_id';
				$where = $this->EtkId == 10? ' and grp_id not in (select distinct dli_grp_id from data_links_ignore)': '';
				$where .= sprintf(" and vin_value in (%s) and grp_master_key='%s' group by grp_id order by grp_id", implode(',', $codeArr), $grp1Id);
				$res = $this->get($table, ['grp_id as grp2_id', 'concat(grp_slave_image, " ", grp_slave_text) as grp2_name', 'concat(grp_slave_remark, " ", grp_slave_model) grp_slave_remark', 'img_path', 'img_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['grp2_name'] = strip_tags($v['grp2_name']);
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					if(!empty($v['grp_slave_remark'])) $v['grp2_notice'] = strip_tags($v['grp_slave_remark']);
					unset($v['grp_slave_remark']);unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 13:
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id left JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf("and vin_name in (%s) and grp_item_2='%s' group by grp_id order by grp_id", implode(',', $codeArr), $grp1Id);
				$filed = ['grp_id as grp2_id, grp_item_3 as pmg_second, grp_name_3 as pmg_diagram, grp_name_4 as grp2_name, grp_remark, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$v['grp2_name'] = strip_tags($v['grp2_name']);
					$key = 's'.$v['pmg_second'];
					$arr[$key]['part'] = ['pmg_second'=>$v['pmg_second'], 'pmg_diagram'=>$v['pmg_diagram']];  
					unset($v['pmg_second']);unset($v['pmg_diagram']);
					$v['grp_img'] = empty($v['img_name']) ? '': sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					if(!empty($v['grp_remark']))
						$v['grp2_notice'] = strip_tags($v['grp_remark']);
					unset($v['grp_remark']);unset($v['img_path']);unset($v['img_name']);
					$arr[$key]['child'][] = $v;
				}
			break;
			case 9:
				$table = 'data_value JOIN data_group ON val_id = grp_vin_id left JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf("and val_value in (%s) and grp_prt_id='%s' group by grp_id order by grp_id", implode(',', $codeArr), $grp1Id);
				$res = $this->get($table, ['grp_id as grp2_id', 'grp_name_2 as grp2_name', 'img_path', 'img_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 8:
				$table = 'data_value JOIN data_group ON val_id = grp_vin_id left join data_group_remark on rem_grp_id=grp_id left JOIN data_picture ON rem_img_id = img_id';
				$where = sprintf("and val_realoem in (%s) and grp_item_1='%s' group by rem_id order by grp_item_2", implode(',', $codeArr), $grp1Id);
				$res = $this->get($table, ['rem_id as grp2_id', 'grp_name_2 as grp2_name', 'img_path', 'img_name', 'rem_remark_1', 'rem_remark_2'], $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					if(!empty($v['rem_remark_1']) || !empty($v['rem_remark_2']))
						$v['grp2_notice'] = strip_tags($v['rem_remark_1'].' '.$v['rem_remark_2']);
					unset($v['img_path']);unset($v['img_name']);unset($v['rem_remark_1']);unset($v['rem_remark_2']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 14:
				$where = sprintf("and vin_value in (%s) and grp_item_2='%s' order by grp_item_3, grp_item_4", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id
				  LEFT JOIN data_picture ON grp_img_id = img_id';
				$filed = ['grp_id as grp2_id, grp_item_3 as pmg_second, grp_name_3 as pmg_diagram, grp_name_4 as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$key = 's'.$v['pmg_second'];
					$arr[$key]['part'] = ['pmg_second'=>$v['pmg_second'], 'pmg_diagram'=>$v['pmg_diagram']];  
					unset($v['pmg_second']);unset($v['pmg_diagram']);
					$v['grp_img'] = empty($v['img_name']) ? '': sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
				    unset($v['img_path']);unset($v['img_name']);
					$arr[$key]['child'][] = $v;
				}
			break;
			case 15:
				$table = 'data_value JOIN data_group ON val_id = grp_val_id left join data_group_list on lst_grp_id=grp_id left JOIN data_picture ON lst_img_id = img_id';
				$where = sprintf("and val_value in (%s) and grp_item_1='%s' group by lst_id order by grp_item_2", implode(',', $codeArr), $grp1Id);
				$res = $this->get($table, ['lst_id as grp2_id', 'grp_name_2 as grp2_name', 'lst_note', 'img_path', 'img_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					if(!empty($v['lst_note'])) $v['grp2_notice'] = strip_tags($v['lst_note']);
					unset($v['img_path']);unset($v['img_name']);unset($v['lst_note']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 4:
				$table = 'data_group JOIN data_links ON prt_id = ppm_pmg_id JOIN data_value ON vin_id = ppm_vin_id LEFT JOIN data_picture ON prt_img_id = img_id';
				$where = sprintf("and vin_name in (%s) and prt_item_1='%s' group by prt_id order by prt_id", implode(',', $codeArr), $grp1Id);
				$res = $this->get($table, ['prt_id as grp2_id', 'prt_name_2 as grp2_name', 'img_path', 'img_name'], $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 16:
				$where = sprintf("and vin_value in (%s) and grp_item_1='%s' group by grp_id", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id
				  LEFT JOIN data_picture ON grp_img_id = img_id';
				$filed = ['grp_id as grp2_id, grp_name_2 as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 3:
				$where = sprintf("and prt_have = 1 and vin_name in (%s) and prt_grp_id='%s' group by prt_id", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id
				  JOIN data_part ON prt_grp_id=grp_id
				  LEFT JOIN data_picture ON prt_id = img_prev_id and img_tab_id = 2';
				$filed = ['prt_id as grp2_id, concat(prt_item_2, " ", prt_name_2) as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 17:
				$where = sprintf("and vin_name in (%s) and grp_item_1='%s' group by grp_id", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id
				  LEFT JOIN data_picture ON img_id = grp_img_id';
				$filed = ['grp_id as grp2_id, grp_item_2 as pmg_second, grp_name_2 as pmg_diagram, concat(illust_note, " ", tekiyo_shashu) as grp2_notice, grp_name_3 as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$key = 's'.$v['pmg_second'];
					$arr[$key]['part'] = ['pmg_second'=>'', 'pmg_diagram'=>$v['pmg_diagram']];  
					unset($v['pmg_second']);unset($v['pmg_diagram']);
					$v['grp_img'] = empty($v['img_name']) ? '': sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr[$key]['child'][] = $v;
				}
			break;
			case 18:
				$where = sprintf("and vin_value in (%s) and prt_grp_id='%d' group by prt_id", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_parts ON vin_id = prt_vin_id
				  LEFT JOIN data_picture ON img_id = prt_img_id';
				$filed = ['prt_id as grp2_id,  concat(prt_item_3, " ", prt_subject) as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 19:
				$where = sprintf("and vin_value in (%s) and grp_name_1='%s' group by grp_id", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id
				  LEFT JOIN data_picture_links ON pic_grp_id=grp_id
				  LEFT JOIN data_picture ON pic_img_id = img_id';
				$filed = ['grp_id as grp2_id, grp_name_2 as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 20:
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id left JOIN data_picture ON grp_part_img_id = img_id';
				$where = sprintf("and vin_value in (%s) and grp_name_1='%s' group by grp_id", implode(',', $codeArr), $grp1Id);
				$filed = ['grp_id as grp2_id, grp_name_2 as pmg_second, grp_name_2 as pmg_diagram, grp_name_3 as grp2_name, grp_remark, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$v['grp2_name'] = strip_tags($v['grp2_name']);
					$key = 's'.md5($v['pmg_second']);
					$arr[$key]['part'] = ['pmg_second'=>'', 'pmg_diagram'=>$v['pmg_diagram']];  
					unset($v['pmg_second']);unset($v['pmg_diagram']);
					$v['grp_img'] = empty($v['img_name']) ? '': sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					if(!empty($v['grp_remark']))
						$v['grp2_notice'] = strip_tags($v['grp_remark']);
					unset($v['grp_remark']);unset($v['img_path']);unset($v['img_name']);
					$arr[$key]['child'][] = $v;
				}
			break;
			case 21:
				$where = sprintf("and vin_value in (%s) and grp_name_1='%s' group by grp_id", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id
				  LEFT JOIN data_picture ON img_id = grp_img_id';
				$filed = ['grp_id as grp2_id, grp_name_2 as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 22:
				$where = sprintf("and vin_value in (%s) and grp_name_1='%s' group by grp_id order by grp_order_2", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id
				  LEFT JOIN data_picture ON img_data = grp_id AND img_type = 1';
				$filed = ['grp_id as grp2_id, concat(grp_order_2, grp_name_3) as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 23:
				$where = sprintf("and vin_value in (%s) and grp_item_1='%s' group by grp_id", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id
				  LEFT JOIN data_picture ON img_id = grp_img_id';
				$filed = ['grp_id as grp2_id, grp_name_2 as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 24:
				$where = sprintf("and vin_value in (%s) and grp_master_key='%s' group by grp_id", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id
				  LEFT JOIN data_picture ON img_id = grp_img_id';
				$filed = ['grp_id as grp2_id, grp_slave_text as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 26:
				$where = sprintf("and vin_value in (%s) and grp_item_1_re='%s' group by grp_id", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id
				  LEFT JOIN data_picture ON img_id = grp_img_id';
				$filed = ['grp_id as grp2_id, grp_item_2_re as pmg_second, concat(grp_item_2, " ", grp_name_2) as pmg_diagram, concat(grp_item_3, " ", grp_name_3) as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$key = 's'.$v['pmg_second'];
					$arr[$key]['part'] = ['pmg_second'=>'', 'pmg_diagram'=>$v['pmg_diagram']];  
					unset($v['pmg_second']);unset($v['pmg_diagram']);
					$v['grp_img'] = empty($v['img_name']) ? '': sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr[$key]['child'][] = $v;
				}
			break;
			case 28:
				$where = sprintf("and vin_value in (%s) and grp_item_1='%s' group by grp_id", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id
				  LEFT JOIN data_picture ON img_id = grp_img_id';
				$filed = ['grp_id as grp2_id, grp_name_2 as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 29:
				$where = sprintf("and vin_value in (%s) and grp_item_1='%s' group by grp_id", implode(',', $codeArr), $grp1Id);
				$table = 'data_value JOIN data_group ON vin_id = grp_vin_id
				  LEFT JOIN data_picture ON img_id = grp_img_id';
				$filed = ['grp_id as grp2_id, grp_name_2 as grp2_name, img_path, img_name'];
				$res = $this->get($table, $filed, $where);
				foreach ($res['data'] as $v)
				{
					$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
					unset($v['img_path']);unset($v['img_name']);
					$arr['s01']['child'][] = $v;
				}
			break;
			case 32:
				$res = $this->get('vin', ['vin_id,vin_text,vin_level'], sprintf(" and vin_text in (%s)", implode(',', $codeArr)));
				$codeInfo = $res['data'];
				if(!empty($codeInfo)){
					$level = $codeInfo[0]['vin_level'];
					$vinids = implode(',', array_column($codeInfo, 'vin_id'));
					if($level == 3){
						$where = sprintf("and grp_vin_id in (%s) and grp_id='%s' group by sub_id", $vinids, $grp1Id);
						$table = 'data_subs JOIN data_group ON sub_grp_id = grp_id
						  LEFT JOIN data_picture ON sub_id = pic_data_id and pic_type="sub"';
						$filed = ['concat('.$level.', sub_id) as grp2_id, sub_name as grp2_name, pic_path img_path, pic_name img_name'];
						$res = $this->get($table, $filed, $where);
						foreach ($res['data'] as $v)
						{
							$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
							unset($v['img_path']);unset($v['img_name']);
							$arr['s01']['child'][] = $v;
						}
					}else{
						$where = sprintf("and grp_vin_id in (%s) and grp_id='%s' group by str_id", $vinids, $grp1Id);
						$table = 'data_structure JOIN data_group ON str_grp_id = grp_id
						  LEFT JOIN data_picture ON str_id = pic_data_id and pic_type="str"';
						$filed = ['concat('.$level.', str_id) as grp2_id, str_name as grp2_name, pic_path img_path, pic_name img_name'];
						$res = $this->get($table, $filed, $where);
						foreach ($res['data'] as $v)
						{
							$v['grp_img'] = empty($v['img_name']) ? '':sprintf('%s%s/800xX/%s', $this->imgUrlbase(),$v['img_path'], $v['img_name']);
							unset($v['img_path']);unset($v['img_name']);
							$arr['s01']['child'][] = $v;
						}
					}
				}
			break;
		}
		foreach($arr as $k=>$v)
		{
			if(isset($v['child']))
			{
				foreach($v['child'] as $kk=>$vv)
				{
					//图片版权
					if(!$this->EPCIMGALL && stripos($vv['grp_img'], 'copyright_') !== false) $vv['grp_img'] = '';
					if(isset($vv['grp2_name'])) $vv['grp2_name'] = strip_tags($vv['grp2_name']);
					if(isset($vv['grp1_name'])) $vv['grp1_name'] = strip_tags($vv['grp1_name']);
					$arr[$k]['child'][$kk] = $vv;
				}
			}
		}
		return LibFc::ReturnData(true, $arr);
	}


	/**
	  * @method 搜索子零件
	  * @param  word 关键字
	  * @author soul
	  * @copyright 2017/4/13
	  * @return 
	  {"status":true,"data": [],"code":""}
	  {"status":false,"data":'失败原因',"code":'error'}
	  */
	public function searchPart($word)
	{
		$arr = [];
		$wordArr = [];
		foreach(explode(' ', $word) as $v)
		{
			$v = trim($v);
			if($v != '' && !in_array($v, $wordArr))
				$wordArr[] = trim($v);
		}
		if(empty($wordArr)) return LibFc::ReturnData(true, $arr);
		$where = '';
		switch($this->EtkId)
		{
			case 7:
			case 11:
				/*foreach($wordArr as $wv)
				{
					$where .= sprintf(" and concat(grp_item_2, grp_name_2) like '%%%s%%'", LibFc::Escape($wv));
				}
				$where .= ' group by grp_item_2, grp_name_2 limit 50';
				$res = $this->get('data_parts JOIN data_group ON group_id=part_group_id', ['grp_prt_id AS grp1_id, grp_name_1 AS grp1_name, grp_item_2 AS grp2_id, grp_name_2 AS grp2_name'], $where);
				$arr = $res['data'];*/
			break;
		}
		return LibFc::ReturnData(true, $arr);
	}


	/**
	  * @method 获取ETK的车型子零件的配件
	  * @param  grp2Id 零件ID
	  * @param  etkCodeArr ETK code
	  * @param  vindate [选填] 车架号日期  2015-05-12  2015-05
	  * @author soul
	  * @copyright 2017/4/13
	  * @return 
	  {"status":true,"data":{"part":{"grp2_name":"030: 前轮制动器","pic":"http:\/\/192.168.1.67\/EtkPicture\/EPC\/mercedes\/photo\/B_42\/B_42_030000140_130122.jpg","width":0,"wz":[["10","591,186,636,223"],["100","731,470,776,507"],["100","785,175,830,212"],["115","835,282,880,319"],["130","736,521,781,558"],["170","299,356,344,393"],["180","264,419,309,456"],["20","601,245,646,282"],["200","299,697,344,734"],["210","442,623,487,660"],["250","123,604,168,641"],["260","256,505,301,542"],["30","645,240,690,277"]],"rate":1},"item":[{"lnk_id":"1728845","pro_id":"716181","pro_realoem":"A 212 421 78 98","ppm_pos_id":"10","pro_name":"固定式制动钳","ppm_pos_name":"10","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728844","pro_id":"716182","pro_realoem":"A 212 421 79 98","ppm_pos_id":"10","pro_name":"固定式制动钳","ppm_pos_name":"10","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728847","pro_id":"608489","pro_realoem":"A 000 421 42 65","ppm_pos_id":"20","pro_name":"放泄阀","ppm_pos_name":"20","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728846","pro_id":"608439","pro_realoem":"A 000 421 17 48","ppm_pos_id":"30","pro_name":"防尘罩","ppm_pos_name":"30","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728851","pro_id":"608569","pro_realoem":"A 000 421 99 91","ppm_pos_id":"100","pro_name":"弹簧","ppm_pos_name":"100","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728848","pro_id":"744177","pro_realoem":"A 221 421 00 74","ppm_pos_id":"115","pro_name":"TS 销","ppm_pos_name":"115","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728854","pro_id":"618421","pro_realoem":"A 005 420 77 20","ppm_pos_id":"130","pro_name":"TS 制动片","ppm_pos_name":"130","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728853","pro_id":"619367","pro_realoem":"A 007 420 49 20","ppm_pos_id":"130","pro_name":"TS 制动片","ppm_pos_name":"130","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728849","pro_id":"626164","pro_realoem":"A 124 421 04 71","ppm_pos_id":"170","pro_name":"六角螺栓","ppm_pos_name":"170","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728850","pro_id":"709381","pro_realoem":"A 211 540 17 17","ppm_pos_id":"180","pro_name":"磨损传感器","ppm_pos_name":"180","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728858","pro_id":"608436","pro_realoem":"A 000 421 15 12","ppm_pos_id":"200","pro_name":"制动圆盘","ppm_pos_name":"200","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728857","pro_id":"737961","pro_realoem":"A 220 421 01 71","ppm_pos_id":"210","pro_name":"密配螺栓","ppm_pos_name":"210","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728856","pro_id":"678471","pro_realoem":"A 204 421 11 20","ppm_pos_id":"250","pro_name":"防护板","ppm_pos_name":"250","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728855","pro_id":"678474","pro_realoem":"A 204 421 12 20","ppm_pos_id":"250","pro_name":"防护板","ppm_pos_name":"250","pro_price":{"title":"销售价","price":"0.00"}},{"lnk_id":"1728852","pro_id":"737969","pro_realoem":"A 220 423 00 71","ppm_pos_id":"260","pro_name":"螺栓","ppm_pos_name":"260","pro_price":{"title":"销售价","price":"0.00"}}],"itempic":0,"etk_id":"7","epc":true},"code":0,"encry":0,"runtime":171}
	  {"status":false,"data":'失败原因',"code":'error'}
	  */
	public function getPartItem($grp2Id, $vindate = '')
	{
		$grp2Id = (int) $grp2Id;
		$arr = [];
		switch($this->EtkId)
		{
			case 7:
			case 11:
				$filed = ['group_name as grp1_name', 'part_name as grp2_name','img_path', 'img_name', 'img_json', 'img_ratio'];
				if($this->EtkId == 11){
					$filed = ['group_name as grp1_name', 'part_name as grp2_name','img_path', 'img_name', 'img_json', 'img_ratio'];
				}
				$res = $this->get('data_parts left join data_group ON group_id = part_group_id left join data_picture on part_img_id=img_id', $filed, sprintf(" and part_id=%d limit 1", $grp2Id), true);
				$arr['part'] = $res['data'];
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);

				$table = 'data_product_links left join data_product on lnk_pro_id=pro_id';
				$where = sprintf('and lnk_part_id = %d order by --lnk_code, pro_format', $grp2Id);

				
				if($this->EtkId == 11){
					$filed = ['pro_id', 'pro_realoem', 'lnk_code as ppm_pos_id', 'pro_name', 'pro_price', 'pro_price_web'];
				}else{
					$filed = ['lnk_id', 'pro_id', 'pro_realoem', 'lnk_code as ppm_pos_id', 'lnk_name as pro_name', 'lnk_footnote modelinfo', 'lnk_note remark'];
				}
				$res = $this->get($table, $filed, $where);
				$arr['item'] = $res['data'];
				if($this->EtkId == 11)
				{
					foreach($arr['item'] as $kk=>$vv)
					{
						$vv['pro_price'] = ['title'=>'销售价', 'price'=>sprintf('%.2f', $vv['pro_price'])];
						if(!empty($vv['pro_price_web']) && $vv['pro_price_web'] < $vv['pro_price']['price'])
							$vv['pro_price'] = ['title'=>'4S店价', 'price'=>sprintf('%.2f', $vv['pro_price_web'])];
						unset($vv['pro_price_web']);
						$arr['item'][$kk] = $vv;
					}
				}
				if($this->EtkId == 7){
					$arr['label'] = [
						'modelinfo'=>'型号',	
						'remark'=>'备注',	
					];
				}
			break;
			case 2 :
				$res = $this->get('data_links join data_partgrp on prt_id=vpg_prt_id left join data_picture on img_id=vpg_img_id', ['img_path,img_name,img_json,img_ratio,prt_text_1 as grp1_name,prt_text_3 as grp2_name,vpg_year_s,vpg_year_e'], sprintf(" and vpg_id=%d limit 1", $grp2Id), true);
				$arr['part'] = $res['data'];

				if(!empty($arr['part']['vpg_year_s']))
					$arr['part']['grp2_name'] .= sprintf('%s.%s~%s.%s', substr($arr['part']['vpg_year_s'], 0, 4), substr($arr['part']['vpg_year_s'], 4, 2), substr($arr['part']['vpg_year_e'], 0, 4),substr($arr['part']['vpg_year_e'], 4, 2));
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['pic'=>$arr['part']['pic'], 'img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);unset($arr['part']['vpg_year_s']);unset($arr['part']['vpg_year_e']);

				$table = 'data_code JOIN data_links ON uid_id = vpg_uid_id
					JOIN data_partgrp ON vpg_prt_id = prt_id
					JOIN data_product_content  ON vpg_id = row_vpg_id';
				$where = sprintf('and vpg_id = %d ORDER BY row_order', $grp2Id);
				$res = $this->get($table, ['row_pro_id as pro_id', 'row_td_06 as pro_realoem', 'row_td_00 as ppm_pos_id', 'concat(row_td_01, " ", row_td_02) as pro_name'], $where);
				$arr['item'] = $res['data'];
			break;
			case 1:
				$table = 'data_group left JOIN data_links ON lnk_grp_id = grp_id left JOIN data_group_image ON lnk_img_id = img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['prt_name as grp1_name', 'grp_id as grp2_id', 'grp_name as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links left join data_product ON lnk_pro_id = pro_id JOIN data_links_content ON lnc_id = lnk_lnc_id';
				$where = sprintf('and lnk_grp_id = %d order by --lnk_location', $grp2Id);
				$res = $this->get($table, ['pro_id', 'pro_number as pro_realoem', 'lnk_location as ppm_pos_id', 'desc_note as pro_name'], $where);
				$arr['item'] = $res['data'];	
			break;
			case 5:
				$table = 'data_group_list
					JOIN data_group ON prt_id = list_prt_id
					left JOIN data_links on lnk_list_id = list_id
					LEFT JOIN data_picture ON img_id=lnk_img_id';
				$res = $this->get($table, ['concat(prt_name_1, "-", prt_name_2) as grp1_name', 'list_id as grp2_id', 'concat(prt_name_3, "-", titre) as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], sprintf(" and list_id=%d limit 1", $grp2Id), true);
				$arr['part'] = $res['data'];
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$where = sprintf('and lnk_list_id = %d order by lnk_order', $grp2Id);
				$res = $this->get('data_links', ['lnk_pro_id as pro_id', 'lnk_realoem as pro_realoem', 'lnk_code as ppm_pos_id', 'lnk_name as pro_name'], $where);
				$arr['item'] = $res['data'];
			break;
			case 12:
			case 10:
				$table = 'data_group left JOIN data_links ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_master_text as grp1_name', 'grp_id as grp2_id', 'grp_slave_text as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				//不适用 fiInvalid = 1
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = $this->EtkId == 10? ' and lnk_id not in (select distinct dli_lnk_id from data_links_ignore)': '';
				$where .= sprintf(' and lnk_grp_id = %d and fiInvalid != 1 order by lnk_id, --position', $grp2Id);
				$res = $this->get($table, ['lnk_pro_id as pro_id', 'pro_number as pro_realoem', 'position AS ppm_pos_name','hotspotIds as ppm_pos_id', 'description as pro_name', 'modelInfo modelinfo', 'remark'], $where);
				foreach($res['data'] as $k=>$v)
				{
					//if($k == 0 && empty($v['pro_id'])) continue;
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
				$arr['label'] = [
					'modelinfo'=>'型号',	
					'remark'=>'备注',	
				];
			break;
			case 13:
				$table = 'data_group left JOIN data_links ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['concat(grp_item_1, "-", grp_item_2, " ", grp_name_2) as grp1_name', 'grp_id as grp2_id', 'grp_name_4 as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lnk_grp_id = %d', $grp2Id);
				$res = $this->get($table, ['pro_id', 'pro_number as pro_realoem', 'lnk_td_1 as ppm_pos_id', 'pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					//if($k == 0 && empty($v['pro_id'])) continue;
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 9:
				$table = 'data_group left JOIN data_links ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_name_1 as grp1_name', 'grp_id as grp2_id', 'grp_name_2 as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lnk_grp_id = %d', $grp2Id);
				$res = $this->get($table, ['lnk_pro_id as pro_id', 'pro_number as pro_realoem', 'nplpartref as ppm_pos_id', 'pro_name', 'xpartext', 'pro_price', 'pro_price_repair'], $where);
				foreach($res['data'] as $k=>$v)
				{
					//if($k == 0 && empty($v['pro_id'])) continue;
					$v['pro_price'] = ['title'=>'销售价', 'price'=>sprintf('%.2f', $v['pro_price'])];
					if($v['pro_price_repair'] > 0 && $v['pro_price_repair'] < $v['pro_price']['price'])
						$v['pro_price'] = ['title'=>'4S店价', 'price'=>sprintf('%.2f', $v['pro_price_repair'])];
					unset($v['pro_price_repair']);
					$v['pro_name'] = empty($v['pro_name']) ? $v['xpartext']: $v['pro_name'];
					unset($v['xpartext']);
					$arr['item'][] = $v;
				}
			break;
			case 8:
				$table = 'data_group left join data_group_remark on rem_grp_id=grp_id left JOIN data_links ON lnk_rem_id = rem_id LEFT JOIN data_picture ON rem_img_id = img_id';
				$where = sprintf("and rem_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_name_1 as grp1_name', 'rem_id as grp2_id', 'grp_name_2 as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links left join data_group_remark on lnk_rem_id=rem_id  LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and rem_id = %d group by lnk_pnc,pro_format,lnk_name order by lnk_pnc', $grp2Id);
				$res = $this->get($table, ['lnk_pro_id as pro_id', 'pro_number as pro_realoem', 'pro_format', 'lnk_pnc as ppm_pos_id', 'lnk_name as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					//if($k == 0 && empty($v['pro_id'])) continue;
					if(empty($v['ppm_pos_id']))
					{
						$v['ppm_pos_id'] = $v['pro_format'];
						$v['ppm_pos_name'] = $v['pro_realoem'];
					}
					unset($v['pro_format']);
					$arr['item'][] = $v;
				}
			break;
			case 14:
				$table = 'data_group left JOIN data_links ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_name_2 as grp1_name', 'grp_id as grp2_id', 'concat(grp_name_3,grp_name_4) as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf(' and lnk_delete = 0 and lnk_grp_id = %d', $grp2Id);
				$res = $this->get($table, ['lnk_pro_id as pro_id', 'pro_number as pro_realoem', 'lnk_code as ppm_pos_id', 'lnk_name as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					//if($k == 0 && empty($v['pro_id'])) continue;
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 15:
				$table = 'data_group left join data_group_list on lst_grp_id=grp_id left JOIN data_product_links ON lnk_lst_id = lst_id LEFT JOIN data_picture ON lst_img_id = img_id';
				$where = sprintf("and lst_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_name_1 as grp1_name', 'lst_id as grp2_id', 'grp_name_2 as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_product_links left join data_group_list on lnk_lst_id=lst_id  LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lst_id = %d', $grp2Id);
				$res = $this->get($table, ['lnk_pro_id as pro_id', 'pro_realoem','lnk_code as ppm_pos_id', 'lnk_name as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					//if($k == 0 && empty($v['pro_id'])) continue;
					$arr['item'][] = $v;
				}
			break;
			case 4:
				$table = 'data_group left JOIN data_links ON prt_id = ppm_pmg_id JOIN data_value ON vin_id = ppm_vin_id LEFT JOIN data_picture ON prt_img_id = img_id';
				$where = sprintf("and prt_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['prt_name_1 as grp1_name', 'prt_id as grp2_id', 'prt_name_2 as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				$arr['itempic'] = 1;
				$table = 'data_links JOIN data_product ON ppm_pro_id = pro_id LEFT JOIN data_product_image ON pic_pro_id = pro_id';
				$where = sprintf('and ppm_pmg_id = %d group by pro_id', $grp2Id);
				$res = $this->get($table, ['pro_id', 'pro_number as pro_realoem','ppm_pos_id', 'pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					//if($k == 0 && empty($v['pro_id'])) continue;
					$arr['item'][] = $v;
				}
			break;
			case 16:
				$table = 'data_group left JOIN data_links ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_name_1 as grp1_name', 'grp_id as grp2_id', 'grp_name_2 as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lnk_grp_id = %d', $grp2Id);
				$res = $this->get($table, ['pro_id', 'pro_realoem as pro_realoem', 'lnk_code as ppm_pos_id', 'lnk_name as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					//if($k == 0 && empty($v['pro_id'])) continue;
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 3:
				$table = 'data_part JOIN data_group ON prt_grp_id = grp_id LEFT JOIN data_picture ON prt_id = img_prev_id and img_tab_id = 2';
				$where = sprintf(" and prt_id='%s'", $grp2Id);
				$res = $this->get($table, ['grp_name_1 as grp1_name', 'prt_id as grp2_id', 'concat(prt_item_2, " ", prt_name_2) as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio', 'img_width', 'img_height'], $where);
				foreach($res['data'] as $k=>$v)
				{
					$pic = empty($v['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $v['img_path'], $v['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $v['img_json'], ['width'=>$v['img_width'], 'height'=>$v['img_height'], 'img_ratio'=>$arr['part']['img_ratio']]);
					if($k == 0)
					{
						$arr['part'] = $v;
						$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
						$arr['part']['pic'] = $pic;
						$arr['part'] = array_merge($arr['part'], $pres['data']);
						unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);unset($arr['part']['img_width']);unset($arr['part']['img_height']);
					}
					else
					{
						 $tempPic = $pres['data'];
						 $tempPic['pic'] = $pic;
						 $arr['picoth'][] = $tempPic;
					}
				}
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lnk_prt_id = %d', $grp2Id);
				$taskCode = [];
				$res = $this->get('data_part JOIN data_group ON prt_grp_id = grp_id JOIN data_value c ON grp_vin_id = vin_id', ['vin_name'], sprintf(" and prt_id=%d", $grp2Id));
				if(!empty($res['data']))
				{
					$YpcBase = new YpcBase();
					$res = $YpcBase->get('etk_product_task', ['distinct ept_etk_code'], sprintf(" and ept_etk_code_from in ('%s')", implode("','", array_column($res['data'], 'vin_name'))));
					$taskCode = array_column($res['data'], 'ept_etk_code');
				}
				$where .= empty($taskCode)? " and lnk_code_from=''": sprintf(" and lnk_code_from in ('', '%s')", implode("','", $taskCode));
				$where .= ' order by lnk_code,lnk_format';
				$res = $this->get($table, ['pro_id', 'pro_number as pro_realoem', 'lnk_code as ppm_pos_id', 'lnk_name as pro_name','lnk_year_s date_s', 'lnk_year_e date_e'], $where);
				foreach($res['data'] as $k=>$v)
				{
					if(!empty($vindate) && (!empty($v['date_s']) || !empty($v['date_e']))){
						if(strlen($vindate) > 7){
							$vintime = strtotime($vindate);
							if((!empty($v['date_s']) && $vintime < strtotime($v['date_s'])) || (!empty($v['date_e']) && $vintime > strtotime($v['date_e'])))
								continue;
						}else if(strlen($vindate) == 7){
							$vintime = date('Ym', strtotime($vindate));
							if((!empty($v['date_s']) && $vintime < date('Ym', strtotime($v['date_s']))) || (!empty($v['date_e']) && $vintime > date('Ym',strtotime($v['date_e']))))
								continue;
						}else if(strlen($vindate) == 4){
							$vintime = $vindate;
							if((!empty($v['date_s']) && $vintime < date('Y', strtotime($v['date_s']))) || (!empty($v['date_e']) && $vintime > date('Y',strtotime($v['date_e']))))
								continue;
						}
					}
					//if($k == 0 && empty($v['pro_id'])) continue;
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 17:
				$table = 'data_group LEFT JOIN data_picture ON img_id = grp_img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_name_1 as grp1_name', 'grp_id as grp2_id', 'grp_name_3 as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lnk_grp_id = %d', $grp2Id);
				$res = $this->get($table, ['pro_id', 'pro_number as pro_realoem', 'lnk_code as ppm_pos_id', 'lnk_name as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					//if($k == 0 && empty($v['pro_id'])) continue;
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 18:
				$table = 'data_parts left join data_group ON prt_grp_id = grp_id LEFT JOIN data_picture ON img_id = prt_img_id';
				$where = sprintf("and prt_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_name_2 as grp1_name', 'prt_id as grp2_id', 'concat(prt_item_3, " ", prt_subject) as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lnk_prt_id = %d group by pro_id order by lnk_code', $grp2Id);
				$res = $this->get($table, ['pro_id', 'pro_realoem', 'lnk_code as ppm_pos_id', 'lnk_name as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					//if($k == 0 && empty($v['pro_id'])) continue;
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 19:
				$table = 'data_group LEFT JOIN data_picture_links ON pic_grp_id=grp_id LEFT JOIN data_picture ON pic_img_id = img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_name_1 as grp1_name', 'grp_id as grp2_id', 'grp_name_2 as grp2_name', 'img_path', 'img_name', 'params as img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lng_grp_id = %d order by lnk_partsequence+0', $grp2Id);
				$res = $this->get($table, ['pro_id', 'pro_realoem as pro_realoem', 'lnk_partsequence as ppm_pos_id', 'lnk_partname_ch as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					//if($k == 0 && empty($v['pro_id'])) continue;
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 20:
				$table = 'data_group LEFT JOIN data_picture ON img_id = grp_part_img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_name_1 as grp1_name', 'grp_id as grp2_id', 'grp_name_3 as grp2_name', 'img_path', 'img_name', 'params as img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lnk_grp_id = %d order by --lnk_code', $grp2Id);
				$res = $this->get($table, ['pro_id', 'pro_realoem', 'lnk_code as ppm_pos_id', 'lnk_name as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 21:
				$table = 'data_group LEFT JOIN data_picture ON img_id = grp_img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_name_1 as grp1_name', 'grp_id as grp2_id', 'grp_name_2 as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lnk_grp_id = %d order by --lnk_code', $grp2Id);
				$res = $this->get($table, ['lnk_id','pro_id', 'pro_realoem', 'lnk_code as ppm_pos_id', 'lnk_name as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 22:
				$table = 'data_group LEFT JOIN data_picture ON img_data = grp_id AND img_type = 1';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_name_1 as grp1_name', 'grp_id as grp2_id', 'concat(grp_order_2, grp_name_3) as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lnk_grp_id = %d order by --lnk_code', $grp2Id);
				$res = $this->get($table, ['lnk_id','pro_id', 'pro_realoem', 'lnk_code as ppm_pos_id', 'lnk_name as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 23:
				$table = 'data_group LEFT JOIN data_picture ON img_id = grp_img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['grp_name_1 as grp1_name', 'grp_id as grp2_id', 'grp_name_2 as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lnk_grp_id = %d order by --lnk_code', $grp2Id);
				$res = $this->get($table, ['lnk_id','pro_id', 'pro_realoem', 'lnk_code as ppm_pos_id', 'lnk_name as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 24:
				$table = 'data_group LEFT JOIN data_picture ON img_id = grp_img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, [' grp_master_text as grp1_name', 'grp_id as grp2_id', 'grp_slave_text as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lnk_grp_id = %d order by --position asc', $grp2Id);
				$res = $this->get($table, ['lnk_id','pro_id', 'pro_number as pro_realoem', 'position as ppm_pos_id', 'description as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 26:
				$table = 'data_group LEFT JOIN data_picture ON img_id = grp_img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, ['concat(grp_item_1, " ", grp_name_1) as grp1_name', 'grp_id as grp2_id', 'concat(grp_item_3, " ", grp_name_3) as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and lnk_grp_id = %d order by --lnk_code asc', $grp2Id);
				$res = $this->get($table, ['lnk_id','pro_id', 'pro_number as pro_realoem', 'lnk_code as ppm_pos_id', 'lnk_name as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 28:
				$table = 'data_group LEFT JOIN data_picture ON img_id = grp_img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, [' grp_name_1 as grp1_name', 'grp_id as grp2_id', 'grp_name_2 as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf('and pro_isblack= 0 and lnk_grp_id = %d GROUP BY lnk_pro_id order by --pro_order asc', $grp2Id);
				$res = $this->get($table, ['lnk_id','pro_id', 'pro_number as pro_realoem', 'pro_order as ppm_pos_id', 'pro_PartName as pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 29:
				$table = 'data_group LEFT JOIN data_picture ON img_id = grp_img_id';
				$where = sprintf("and grp_id='%s' limit 1", $grp2Id);
				$res = $this->get($table, [' grp_name_1 as grp1_name', 'grp_id as grp2_id', 'grp_name_2 as grp2_name', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr['part'] = $res['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				$table = 'data_links as a LEFT JOIN data_product ON lnk_pro_id = pro_id';
				$where = sprintf(' and lnk_grp_id = %d GROUP BY lnk_pro_id order by pro_location asc', $grp2Id);
				$res = $this->get($table, ['lnk_id','pro_id', 'pro_number as pro_realoem', 'pro_location as ppm_pos_id', 'a.pro_name'], $where);
				foreach($res['data'] as $k=>$v)
				{
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
			break;
			case 32:
				$level = substr($grp2Id, 0, 1);
				$realGrp2Id = substr($grp2Id, 1);
				if($level == 3){
					$where = sprintf(" and sub_id='%s' limit 1", $realGrp2Id);
					$table = 'data_subs JOIN data_group ON sub_grp_id = grp_id
					  LEFT JOIN data_picture ON sub_id = pic_data_id and pic_type="sub"';
					$filed = ['grp_id as grp1_id, grp_label as grp1_name, concat('.$level.', sub_id) as grp2_id, sub_name as grp2_name, pic_path img_path, pic_name img_name,pic_point img_json,img_ratio'];
					$gres = $this->get($table, $filed, $where, true);
				}else{
					$where = sprintf(" and str_id='%s' limit 1", $realGrp2Id);
					$table = 'data_structure JOIN data_group ON str_grp_id = grp_id
					  LEFT JOIN data_picture ON str_id = pic_data_id and pic_type="str"';
					$filed = ['grp_id as grp1_id, grp_label as grp1_name, concat('.$level.', str_id) as grp2_id, str_name as grp2_name, pic_path img_path, pic_name img_name,pic_point img_json,img_ratio'];
					$gres = $this->get($table, $filed, $where, true);
				}
				$arr['part'] = $gres['data'];
				$arr['part']['grp2_name'] = strip_tags($arr['part']['grp2_name']);
				$arr['part']['pic'] = empty($arr['part']['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['part']['img_path'], $arr['part']['img_name']);
				$pres = $this->formatImgPos($this->EtkId, $arr['part']['img_json'], ['img_ratio'=>$arr['part']['img_ratio']]);
				$arr['part'] = array_merge($arr['part'], $pres['data']);
				unset($arr['part']['img_path']);unset($arr['part']['img_name']);unset($arr['part']['img_json']);
				
				if($level == 3){
					$table = 'data_part as a LEFT JOIN data_product ON prt_pro_id = pro_id';
					$where = sprintf(' and prt_type="sub" and prt_data_id = %d and prt_colorvalue=1 GROUP BY prt_pro_id order by --prt_itid,prt_id', $realGrp2Id);
				}else{
					$table = 'data_part as a LEFT JOIN data_product ON prt_pro_id = pro_id';
					$where = sprintf(' and prt_type="str" and prt_data_id = %d and prt_colorvalue=1 GROUP BY prt_pro_id order by --prt_itid,prt_id', $realGrp2Id);
				}
				$res = $this->get($table, ['prt_id lnk_id','pro_id', 'pro_number as pro_realoem', 'prt_itid as ppm_pos_id', 'prt_label pro_name', 'prt_model modelinfo', 'prt_remark remark'], $where);
				foreach($res['data'] as $k=>$v){
					$v['pro_name'] = strip_tags($v['pro_name']);
					$arr['item'][] = $v;
				}
				$arr['label'] = [
					'modelinfo'=>'型号',	
					'remark'=>'备注',	
				];
			break;
		}

		//过滤空点
		if(!empty($arr) && is_array($arr['item']))
		{
			foreach($arr['item'] as $kk=>$vv)
			{
				if(empty($vv['ppm_pos_name']))
				{
					$vv['pro_name'] = strip_tags(str_replace('<br/>', "\r\n", $vv['pro_name']));
					$vv['ppm_pos_name'] = $vv['ppm_pos_id'];
					$reArr = ['(', ')', '（', '）'];
					$vv['ppm_pos_id'] = trim(str_replace($reArr, '', $vv['ppm_pos_id']));
				}
				/*if(empty($vv['pro_price'])) 
				{
					$vv['pro_price'] = ['title'=>'销售价', 'price'=>'0.00'];
				}*/
				$vv['pro_price'] = ['title'=>'销售价', 'price'=>'0.00'];
				$arr['item'][$kk] = $vv;
			}
			
			if(!empty($arr['part']['wz']))
			{
				$hasPosId = array_unique(array_column($arr['item'], 'ppm_pos_id'));
				foreach($arr['part']['wz'] as $k=>$v)
				{
					if(!in_array($v[0], $hasPosId)) unset($arr['part']['wz'][$k]);
				}
				$arr['part']['wz'] = array_values($arr['part']['wz']);
			}
		}

		//图片版权
		if(!$this->EPCIMGALL && stripos($arr['part']['pic'], 'copyright_') !== false){
			$arr['part']['pic'] = '';
			$arr['part']['wz'] = [];
		}
		//检测哪些号码已经处理为标准数据
		if($this->EPCIMGALL){
			$nums = [];
			foreach($arr['item'] as $kk=>$vv){
				$vv['format'] = LibFc::FormatNum($vv['pro_realoem']);
				if($vv['format']) $nums[] = $vv['format'];
				$arr['item'][$kk] = $vv;
			}
			$ycnumArr = [];
			if($nums){
				$YpcBase = new YpcBase();
				$res = $YpcBase->Get('yc_number JOIN yc_part ON part_id=num_part_id', ['num_format', 'GROUP_CONCAT(DISTINCT part_name) ycnum_name'], sprintf(" and num_format in ('%s') AND num_fac_id = 12 GROUP BY num_format", implode("','", $nums)));
				$ycnumArr = array_column($res['data'], 'ycnum_name', 'num_format');
			}
			if($ycnumArr){
				$arr['ycnum_chk'] = 1;
				foreach($arr['item'] as $kk=>$vv){
					$vv['ycnum'] = $ycnumArr[$vv['format']]? 1: 0;
					$vv['ycnum_name'] = $ycnumArr[$vv['format']]? $ycnumArr[$vv['format']]: '';
					$arr['item'][$kk] = $vv;
				}
			}
		}
		if(isset($arr['grp2_name'])) $arr['grp2_name'] = strip_tags($arr['grp2_name']);
		if(isset($arr['grp1_name'])) $arr['grp1_name'] = strip_tags($arr['grp1_name']);
		if(!isset($arr['itempic'])) $arr['itempic'] = 0;
		$arr['etk_id'] = $this->EtkId;
		return LibFc::ReturnData(true, $arr);
	}



	/**
	  * @method 获取ETK的车型子零件的配件
	  * @param  grp2Id 零件ID
	  * @param  proId 配件ID
	  * @author soul
	  * @copyright 2017/4/13
	  * @return 
	  {"status":true,"data": [],"code":""}
	  {"status":false,"data":'失败原因',"code":'error'}
	  */
	public function getItem($proId, $grp2Id, $lnkId = 0)
	{
		$proId = (int) $proId;
		$grp2Id = (int) $grp2Id;
		$lnkId = (int) $lnkId;
		if($proId < 1 || $grp2Id < 1) return LibFc::ReturnData(true, $arr);
		switch($this->EtkId)
		{
			case 7:
			case 11:
				if($this->EtkId == 11){
					$filed = ['lnk_code AS weizhi, pro_id, group_name as grp1_name, part_name as grp2_name, pro_realoem AS display, pro_name, concat(lnk_attr, " ", lnk_param) as lnk_note, lnk_qty, img_path, img_name, img_json, img_ratio, pro_price, pro_price_web'];
				}else{
					$filed = ['lnk_code AS weizhi, pro_id, group_name as grp1_name, part_name as grp2_name, pro_realoem AS display, lnk_name as pro_name, lnk_note, lnk_footnote, lnk_qty, img_path, img_name, img_json, img_ratio, 0 as pro_price'];
				}
				$table = 'data_product JOIN data_product_links ON pro_id = lnk_pro_id
				JOIN data_parts ON part_id = lnk_part_id
				JOIN data_group ON group_id = part_group_id
				LEFT JOIN data_picture ON part_img_id=img_id';
				$where = $lnkId > 0 ? sprintf('and lnk_id=%d and pro_id = %d and lnk_part_id=%d limit 1', $lnkId, $proId, $grp2Id) : sprintf('and pro_id = %d and lnk_part_id=%d limit 1', $proId, $grp2Id);
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['pro_price'] = ['title'=>'销售价', 'price'=>sprintf('%.2f', $arr['pro_price'])];
					if(!empty($arr['pro_price_web']) && $arr['pro_price_web'] < $arr['pro_price']['price'])
						$arr['pro_price'] = ['title'=>'4S店价', 'price'=>sprintf('%.2f', $arr['pro_price_web'])];
					unset($arr['pro_price_web']);

					$arr['para'] = [];

					if(!empty($arr['lnk_footnote'])) $arr['para'][] = ['name'=>'型号', 'val'=>$arr['lnk_footnote'], 'unit'=>''];
					if(!empty($arr['lnk_note'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['lnk_note'], 'unit'=>''];
					if(!empty($arr['lnk_qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_qty'], 'unit'=>''];

					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_note']);unset($arr['lnk_qty']);unset($arr['lnk_footnote']);
				}
			break;
			case 2 :
				$table = 'data_product_content JOIN data_product ON row_pro_id=pro_id
					 JOIN data_links ON row_vpg_id = vpg_id
					 JOIN data_partgrp ON vpg_prt_id = prt_id
					 LEFT JOIN data_picture ON img_id = vpg_img_id';
				$where = sprintf('and row_pro_id = %d and row_vpg_id=%d limit 1', $proId, $grp2Id);
				$filed = ['row_td_00 AS weizhi,pro_id, prt_text_1 as grp1_name, prt_text_3 as grp2_name, row_td_01 AS pro_name, row_td_02, row_td_03, pro_realoem as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];

					if(!empty($arr['row_td_02'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['row_td_02'], 'unit'=>''];
					if(!empty($arr['row_td_03'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['row_td_03'], 'unit'=>''];

					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['pic'=>$arr['pic'], 'img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['row_td_02']);unset($arr['row_td_03']);
				}
			break;
			case 1 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON grp_id = lnk_grp_id
				JOIN data_links_content ON lnc_id = lnk_lnc_id
				LEFT JOIN data_group_image ON lnk_img_id = img_id';
				$where = sprintf('and pro_id = %d and lnk_grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_location AS weizhi, pro_id, desc_note AS pro_name, prt_name as grp1_name, grp_name as grp2_name, modelnote, qty, pro_number as display, img_path, img_name, img_json'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];

					if(!empty($arr['modelnote'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['modelnote'], 'unit'=>''];
					if(!empty($arr['qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['qty'], 'unit'=>''];

					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['modelnote']);unset($arr['qty']);
					
					$res = $this->get('data_product_image', ['pic_path, pic_name'], sprintf(' and pic_pro_id = %d', $proId));
					foreach($res['data'] as $imv)
					{
						$arr['othpic'][] = sprintf('%s%s/%s', $this->imgUrlbase(), $imv['pic_path'], $imv['pic_name']);
					}
				}
			break;
			case 5:
				$table = 'data_group_list
					JOIN data_group ON prt_id = list_prt_id
					JOIN data_value ON vin_id = prt_vin_id
					JOIN data_links ON lnk_vin_id = vin_id AND lnk_prt_id = prt_id AND lnk_list_id = list_id
					LEFT JOIN data_picture ON img_id=lnk_img_id';
				$where = sprintf('and lnk_pro_id = %d and list_id=%d limit 1', $proId, $grp2Id);
				$res = $this->get($table, ['lnk_realoem as display', 'lnk_code as weizhi', 'concat(prt_name_1, "-", prt_name_2) as grp1_name', 'concat(prt_name_3, "-", titre) as grp2_name', 'lnk_name as pro_name', 'lnk_qty', 'lnk_remark', 'img_path', 'img_name', 'img_json', 'img_ratio'], $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					
					//新件号
					/*$res = $this->get('data_replace', ['rep_replace as num_display, rep_new_name as num_name'], sprintf(" and rep_pro_id=%d and rep_list_id=%d order by rep_format", $proId, $grp2Id));
					$arr['pro_replace'] = $res['data'];*/

					$res = $this->get('data_replace', ['*'], sprintf(" and (rep_pro_id =%d or rep_new_id = %d) and rep_list_id=%d order by rep_format", $proId, $proId, $grp2Id));
					foreach($res['data'] as $v)
					{
						if($v['rep_new_id'] == $proId) $arr['para'][] = ['name'=>'新号', 'val'=>$v['rep_replace'], 'unit'=>''];
						if($v['rep_pro_id'] == $proId) $arr['para'][] = ['name'=>'旧号', 'val'=>$v['rep_replace'], 'unit'=>''];
					}
				
					if(!empty($arr['lnk_remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['lnk_remark'], 'unit'=>''];
					if(!empty($arr['lnk_qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_qty'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['lnk_remark']);unset($arr['lnk_qty']);unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);
				}
			break;
			case 12 :
			case 10 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf('and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['hotspotIds as weizhi, position AS weizhi_name, grp_master_text as grp1_name, grp_slave_text as grp2_name,pro_name, remark,quantity, modelInfo, pro_number as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['modelInfo'])) $arr['para'][] = ['name'=>'型号', 'val'=>$arr['modelInfo'], 'unit'=>''];
					if(!empty($arr['remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['remark'], 'unit'=>''];
					if(!empty($arr['quantity'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['quantity'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['remark']);unset($arr['modelInfo']);unset($arr['quantity']);
				}
			break;
			case 13 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf('and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_td_1 AS weizhi, concat(grp_item_1, "-", grp_item_2, " ", grp_name_2) as grp1_name, grp_name_4 as grp2_name, pro_name, lnk_td_5 as remark, lnk_td_3, pro_number as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];

					if(!empty($arr['remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['remark'], 'unit'=>''];
					if(!empty($arr['lnk_td_3'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_td_3'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['lnk_td_3']);unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['remark']);unset($arr['modelInfo']);
				}
			break;
			case 9 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf('and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['nplpartref AS weizhi, grp_name_1 as grp1_name,grp_name_2 as grp2_name,pro_name, pro_price, pro_price_repair, xpartext, xpartext, xordergun, pro_number as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					//价格
					$arr['pro_price'] = ['title'=>'销售价', 'price'=>sprintf('%.2f', $arr['pro_price'])];
					if($arr['pro_price_repair'] > 0 && $arr['pro_price_repair'] < $arr['pro_price']['price'])
						$arr['pro_price'] = ['title'=>'4S店价', 'price'=>sprintf('%.2f', $arr['pro_price_repair'])];
					unset($arr['pro_price_repair']);
					
					$arr['para'] = [];

					if(!empty($arr['xpartext'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['xpartext'], 'unit'=>''];
					if(!empty($arr['xordergun'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['xordergun'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['xpartext']);unset($arr['xordergun']);
				}
			break;
			case 8 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group_remark ON lnk_rem_id = rem_id
				JOIN data_group ON rem_grp_id = grp_id
				LEFT JOIN data_picture ON rem_img_id = img_id';
				$where = sprintf('and pro_id = %d and rem_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_pnc AS weizhi, grp_name_1 as grp1_name,grp_name_2 as grp2_name, lnk_name as pro_name, pro_number as display, pro_format, lnk_qty, lnk_remark_1, lnk_remark_2, lnk_remark_3, lnk_year_s, lnk_year_e, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					if(empty($arr['weizhi']))
					{
						$arr['weizhi'] = $arr['pro_format'];
						$arr['weizhi_name'] = $arr['display'];
					}

					$arr['para'] = [];

					//替换号
					$res = $this->get('data_replace', ['*'], sprintf(" and rep_pro_old_id =%d or rep_pro_new_id = %d", $proId, $proId));
					foreach($res['data'] as $v)
					{
						if($v['rep_pro_old_id'] == $proId) $arr['para'][] = ['name'=>'新号', 'val'=>$v['rep_new_text'], 'unit'=>''];
						if($v['rep_pro_new_id'] == $proId) $arr['para'][] = ['name'=>'旧号', 'val'=>$v['rep_old_text'], 'unit'=>''];
					}

					$remark = [];
					if(!empty($arr['lnk_remark_1'])) $remark[] = $arr['lnk_remark_1'];
					if(!empty($arr['lnk_remark_2'])) $remark[] = $arr['lnk_remark_2'];
					if(!empty($arr['lnk_remark_3'])) $remark[] = $arr['lnk_remark_3'];
					if(!empty($remark)) $arr['para'][] = ['name'=>'备注', 'val'=>implode("; ", $remark), 'unit'=>''];
					if(!empty($arr['lnk_qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_qty'], 'unit'=>''];
					if(!empty($arr['lnk_year_s']) || !empty($arr['lnk_year_e'])) $arr['para'][] = ['name'=>'车辆生产', 'val'=>$arr['lnk_year_s'].'-'.$arr['lnk_year_e'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_remark_1']);unset($arr['lnk_remark_2']);unset($arr['lnk_remark_3']);unset($arr['pro_format']);unset($arr['lnk_qty']);unset($arr['lnk_year_s']);unset($arr['lnk_year_e']);
				}
			break;
			case 14:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf('and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_code AS weizhi, grp_name_2 as grp1_name, grp_name_4 as grp2_name, lnk_name as pro_name, lnk_qty, lnk_caption, pro_number as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['lnk_qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_qty'], 'unit'=>''];
					if(!empty($arr['lnk_caption'])) $arr['para'][] = ['name'=>'属性', 'val'=>strip_tags($arr['lnk_caption']), 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_qty']);unset($arr['lnk_caption']);
				}
			break;
			case 15 :
				$table = 'data_product
				JOIN data_product_links ON lnk_pro_id = pro_id 
				JOIN data_group_list ON lnk_lst_id = lst_id
				JOIN data_group ON lst_grp_id = grp_id
				LEFT JOIN data_picture ON lst_img_id = img_id';
				$where = sprintf('and pro_id = %d and lst_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_code AS weizhi, grp_name_1 as grp1_name,grp_name_2 as grp2_name, lnk_name as pro_name, pro_realoem as display, lnk_qty, lnk_remark, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['lnk_remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['lnk_remark'], 'unit'=>''];
					if(!empty($arr['lnk_qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_qty'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_remark']);unset($arr['pro_format']);unset($arr['lnk_qty']);
				}
			break;
			case 4:
				$table = 'data_product
				JOIN data_links ON ppm_pro_id = pro_id 
				JOIN data_group ON prt_id = ppm_pmg_id
				LEFT JOIN data_picture ON prt_img_id = img_id
				LEFT JOIN data_product_image ON pic_pro_id = ppm_pro_id';
				$where = sprintf('and pro_id = %d and prt_id=%d limit 1', $proId, $grp2Id);
				$filed = ['ppm_pos_id AS weizhi, prt_name_1 as grp1_name,prt_name_2 as grp2_name, pro_name, pro_number as display, ppm_remark, pic_path, pic_name, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['ppm_remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['ppm_remark'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					if(!empty($arr['pic_path'])) $arr['othpic'][] = sprintf('%s%s/%s', $this->imgUrlbase(), $arr['pic_path'], $arr['pic_name']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['ppm_remark']);unset($arr['pic_path']);unset($arr['pic_name']);
				}
			break;
			case 16 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf('and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_code AS weizhi, grp_name_1 as grp1_name, grp_name_2 as grp2_name, pro_name, lnk_location, lnk_remark as remark, lnk_text_new,lnk_text_old, lnk_qty, pro_realoem as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['lnk_location']) || !empty($arr['remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['lnk_location'].' '.$arr['remark'], 'unit'=>''];
					if(!empty($arr['lnk_qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_qty'], 'unit'=>''];
					if(!empty($arr['lnk_text_new'])) $arr['para'][] = ['name'=>'Part级新件号', 'val'=>$arr['lnk_text_new'], 'unit'=>''];
					if(!empty($arr['lnk_text_old'])) $arr['para'][] = ['name'=>'LOU级新件号', 'val'=>$arr['lnk_text_old'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['lnk_qty']);unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['remark']);unset($arr['lnk_location']);unset($arr['lnk_text_old']);unset($arr['lnk_text_new']);
				}
			break;
			case 3 :
				//2019/8/2 data_picture_links 后无图，临时取消  2019/8/19恢复
				$table = 'data_product
					JOIN data_links ON lnk_pro_id = pro_id
					JOIN data_part ON prt_id = lnk_prt_id
					JOIN data_group ON prt_grp_id = grp_id
					LEFT JOIN data_picture_links ON lnk_id = lnp_next_id AND lnp_tab_id = 2
					LEFT JOIN data_picture ON lnp_img_id = img_id';
				/*$table = 'data_product
					JOIN data_links ON lnk_pro_id = pro_id
					JOIN data_part ON prt_id = lnk_prt_id
					JOIN data_group ON prt_grp_id = grp_id
					LEFT JOIN data_picture ON prt_id = img_prev_id AND img_tab_id = 2';*/
				$where = sprintf('and pro_id = %d and prt_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_code AS weizhi, grp_name_1 as grp1_name, concat(prt_item_2, " ", prt_name_2) as grp2_name, lnk_name AS pro_name, lnk_remark as remark, lnk_qty, lnk_year_s, lnk_year_e, pro_number as display, img_path, img_name, img_json, img_ratio', 'img_width', 'img_height'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['lnk_year_s'])) $arr['para'][] = ['name'=>'开始年份', 'val'=>$arr['lnk_year_s'], 'unit'=>''];
					if(!empty($arr['lnk_year_e'])) $arr['para'][] = ['name'=>'结束年份', 'val'=>$arr['lnk_year_e'], 'unit'=>''];
					if(!empty($arr['remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['remark'], 'unit'=>''];
					if(!empty($arr['lnk_qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_qty'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['width'=>$arr['img_width'], 'height'=>$arr['img_height'],'img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['lnk_year_s']);unset($arr['lnk_year_e']);unset($arr['lnk_qty']);unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['remark']);unset($arr['img_width']);unset($arr['img_height']);
				}
			break;
			case 17:
				//lnk_nenkai 年款 lnk_saiyou_ymd， ，lnk_haishi_ymd 时间 lnk_koyu_shogen 适用op  lnk_katashiki 应用车型 lnk_destination 备注
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = sprintf('and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_code AS weizhi, grp_name_1 as grp1_name, grp_name_3 as grp2_name, lnk_name as pro_name, lnk_quantity, lnk_koyu_shogen,lnk_katashiki, lnk_saiyou_ymd, lnk_haishi_ymd,lnk_destination,pro_number as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['lnk_quantity'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_quantity'], 'unit'=>''];
					if(!empty($arr['lnk_saiyou_ymd']) || !empty($arr['lnk_haishi_ymd'])) $arr['para'][] = ['name'=>'生产日期', 'val'=>$arr['lnk_saiyou_ymd'].'-'.$arr['lnk_haishi_ymd'], 'unit'=>''];
					if(!empty($arr['lnk_koyu_shogen'])) $arr['para'][] = ['name'=>'适用op', 'val'=>$arr['lnk_koyu_shogen'], 'unit'=>''];
					if(!empty($arr['lnk_katashiki'])) $arr['para'][] = ['name'=>'应用车型', 'val'=>$arr['lnk_katashiki'], 'unit'=>''];
					if(!empty($arr['lnk_destination'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['lnk_destination'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_quantity']);unset($arr['lnk_katashiki']);
					unset($arr['lnk_saiyou_ymd']);unset($arr['lnk_haishi_ymd']);unset($arr['lnk_koyu_shogen']);unset($arr['lnk_destination']);
				}
			break;
			case 18:
				//
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_parts ON lnk_prt_id = prt_id
				JOIN data_group ON prt_grp_id = grp_id
				LEFT JOIN data_picture ON prt_img_id = img_id';
				$where = sprintf('and pro_id = %d and prt_id=%d group by pro_id', $proId, $grp2Id);
				$filed = ['lnk_code AS weizhi, grp_name_2 as grp1_name, concat(prt_item_3, " ", prt_subject) as grp2_name, lnk_name as pro_name, lnk_location,lnk_quantity, min(lnk_first_year) lnk_first_year,max(lnk_last_year) lnk_last_year,lnk_remark,pro_realoem as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['lnk_quantity'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_quantity'], 'unit'=>''];
					if(!empty($arr['lnk_first_year']) || !empty($arr['lnk_last_year'])) $arr['para'][] = ['name'=>'年份', 'val'=>$arr['lnk_first_year'].'-'.$arr['lnk_last_year'], 'unit'=>''];
					if(!empty($arr['lnk_koyu_shogen'])) $arr['para'][] = ['name'=>'适用op', 'val'=>$arr['lnk_koyu_shogen'], 'unit'=>''];
					if(!empty($arr['lnk_location'])) $arr['para'][] = ['name'=>'位置', 'val'=>$arr['lnk_location'], 'unit'=>''];
					if(!empty($arr['lnk_remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['lnk_remark'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_quantity']);unset($arr['lnk_first_year']);
					unset($arr['lnk_last_year']);unset($arr['lnk_location']);unset($arr['lnk_koyu_shogen']);unset($arr['lnk_remark']);
				}
			break;
			case 19 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lng_grp_id = grp_id
				LEFT JOIN data_picture_links ON pic_grp_id=grp_id
				LEFT JOIN data_picture ON pic_img_id = img_id';
				$where = sprintf('and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_partsequence AS weizhi, grp_name_1 as grp1_name, grp_name_2 as grp2_name, pro_name, lnk_qty, pro_realoem as display, lnk_partcode, lnk_remark_ch, img_path, img_name, params as img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['lnk_remark_ch'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['lnk_remark_ch'], 'unit'=>''];
					if(!empty($arr['lnk_qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_qty'], 'unit'=>''];
					if(!empty($arr['lnk_partcode'])) $arr['para'][] = ['name'=>'备件编码', 'val'=>$arr['lnk_partcode'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['lnk_qty']);unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_partcode']);unset($arr['lnk_remark_ch']);
				}
			break;
			case 20:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_part_img_id = img_id';
				$where = sprintf('and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_code AS weizhi, grp_name_1 as grp1_name, grp_name_3 as grp2_name, lnk_name as pro_name, lnk_qty, lnk_text, lnk_line, lnk_engine,pro_realoem as display, img_path, img_name, params as img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['lnk_qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_qty'], 'unit'=>''];
					if(!empty($arr['lnk_line'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['lnk_line'], 'unit'=>''];
					if(!empty($arr['lnk_text'])) $arr['para'][] = ['name'=>'配件号', 'val'=>$arr['lnk_text'], 'unit'=>''];
					if(!empty($arr['lnk_engine'])) $arr['para'][] = ['name'=>'发动机', 'val'=>$arr['lnk_engine'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_qty']);unset($arr['lnk_engine']);
					unset($arr['lnk_text']);unset($arr['lnk_line']);
				}
			break;
			case 21:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = $lnkId > 0 ? sprintf('and lnk_id=%d', $lnkId): '';
				$where .= sprintf(' and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_code AS weizhi, grp_name_1 as grp1_name, grp_name_2 as grp2_name, lnk_name as pro_name, lnk_qty, lnk_remark,pro_realoem as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['lnk_qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_qty'], 'unit'=>''];
					if(!empty($arr['lnk_remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['lnk_remark'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_qty']);unset($arr['lnk_remark']);
				}
			break;
			case 22:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON img_data = lnk_grp_id and img_type = 1';
				$where = $lnkId > 0 ? sprintf('and lnk_id=%d', $lnkId): '';
				$where .= sprintf(' and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_code AS weizhi, grp_name_1 as grp1_name, concat(grp_order_2, grp_name_3) as grp2_name, lnk_name as pro_name, lnk_qty, lnk_remark,pro_realoem as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['lnk_qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_qty'], 'unit'=>''];
					if(!empty($arr['lnk_remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>$arr['lnk_remark'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_qty']);unset($arr['lnk_remark']);

					$res = $this->get('data_product JOIN data_picture ON img_data = pro_id and img_type = 2', ['img_path, img_name'], sprintf(' and pro_id = %d', $proId));
					foreach($res['data'] as $imv)
					{
						$arr['othpic'][] = sprintf('%s%s/%s', $this->imgUrlbase(), $imv['img_path'], $imv['img_name']);
					}
				}
			break;
			case 23:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = $lnkId > 0 ? sprintf('and lnk_id=%d', $lnkId): '';
				$where .= sprintf(' and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_code AS weizhi, grp_name_1 as grp1_name, grp_name_2 as grp2_name, lnk_name as pro_name, lnk_qty, lnk_year_s, lnk_year_e,pro_realoem as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['lnk_qty'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['lnk_qty'], 'unit'=>''];
					if(!empty($arr['lnk_year_s'])) $arr['para'][] = ['name'=>'开始年', 'val'=>$arr['lnk_year_s'], 'unit'=>''];
					if(!empty($arr['lnk_year_e'])) $arr['para'][] = ['name'=>'结束年', 'val'=>$arr['lnk_year_e'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_qty']);unset($arr['lnk_year_s']);unset($arr['lnk_year_e']);
				}
			break;
			case 24:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = $lnkId > 0 ? sprintf('and lnk_id=%d', $lnkId): '';
				$where .= sprintf(' and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['position AS weizhi, grp_master_text as grp1_name, grp_slave_text as grp2_name, description as pro_name, quantity ,pro_number as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['quantity'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['quantity'], 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_qty']);unset($arr['lnk_year_s']);unset($arr['lnk_year_e']);
				}
			break;
			case 26:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = $lnkId > 0 ? sprintf('and lnk_id=%d', $lnkId): '';
				$where .= sprintf(' and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['lnk_code AS weizhi, concat(grp_item_1, " ", grp_name_1) as grp1_name, concat(grp_item_3, " ", grp_name_3) as grp2_name, lnk_name as pro_name, lnk_qty as quantity, lnk_comment, lnk_restriction, pro_number as display, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['quantity'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['quantity'], 'unit'=>''];
					if(!empty($arr['lnk_comment'])) $arr['para'][] = ['name'=>'注释', 'val'=>strip_tags($arr['lnk_comment']), 'unit'=>''];
					if(!empty($arr['lnk_restriction'])) $arr['para'][] = ['name'=>'限制', 'val'=>strip_tags($arr['lnk_restriction']), 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_qty']);unset($arr['lnk_comment']);unset($arr['lnk_restriction']);
				}
			break;
			case 28:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = $lnkId > 0 ? sprintf('and lnk_id=%d', $lnkId): '';
				$where .= sprintf(' and pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['pro_order AS weizhi, grp_name_1 as grp1_name, grp_name_2 as grp2_name, pro_PartName as pro_name, pro_qty as quantity ,pro_number as display, pro_remark, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['quantity'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['quantity'], 'unit'=>''];
					if(!empty($arr['pro_remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>strip_tags($arr['pro_remark']), 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_qty']);unset($arr['lnk_year_s']);unset($arr['lnk_year_e']);
				}
			break;
			case 29:
				$table = 'data_product as a
				JOIN data_links as b ON lnk_pro_id = a.pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON grp_img_id = img_id';
				$where = $lnkId > 0 ? sprintf('and lnk_id=%d', $lnkId): '';
				$where .= sprintf(' and a.pro_id = %d and grp_id=%d limit 1', $proId, $grp2Id);
				$filed = ['pro_location AS weizhi, grp_name_1 as grp1_name, grp_name_2 as grp2_name, b.pro_name, pro_qty as quantity ,pro_number as display, pro_model, img_path, img_name, img_json, img_ratio'];
				$res = $this->get($table, $filed, $where, true);
				$arr = $res['data'];
				if(!empty($arr))
				{
					$arr['para'] = [];
					if(!empty($arr['quantity'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['quantity'], 'unit'=>''];
					if(!empty($arr['pro_model'])) $arr['para'][] = ['name'=>'适配车型', 'val'=>strip_tags($arr['pro_model']), 'unit'=>''];
					$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
					$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
					$arr = array_merge($arr, $pres['data']);
					unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['lnk_qty']);unset($arr['lnk_year_s']);unset($arr['lnk_year_e']);
				}
			break;
			case 32:
				$level = substr($grp2Id, 0, 1);
				$realGrp2Id = substr($grp2Id, 1);
				$where = $lnkId > 0 ? sprintf('and prt_id=%d', $lnkId): '';
				if($level == 3){
					$table = 'data_product
					JOIN data_part as b ON prt_pro_id = pro_id
					JOIN data_subs on prt_data_id = sub_id
					JOIN data_group ON sub_grp_id = grp_id
					LEFT JOIN data_picture ON sub_id = pic_data_id and pic_type="sub"';
					$where .= sprintf(' and prt_type="sub" and pro_id = %d and sub_id=%d limit 1', $proId, $realGrp2Id);
					$filed = ['prt_itid AS weizhi, grp_label as grp1_name, sub_name as grp2_name, prt_label pro_name, prt_quantity as quantity ,pro_number as display, prt_model pro_model, prt_remark remark, pic_path img_path, pic_name img_name,pic_point img_json, img_ratio'];
					$res = $this->get($table, $filed, $where, true);
					$arr = $res['data'];
					if(!empty($arr))
					{
						$arr['para'] = [];
						if(!empty($arr['quantity'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['quantity'], 'unit'=>''];
						if(!empty($arr['pro_model'])) $arr['para'][] = ['name'=>'车型', 'val'=>strip_tags($arr['pro_model']), 'unit'=>''];
						if(!empty($arr['pro_remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>strip_tags($arr['pro_remark']), 'unit'=>''];
						$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
						$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
						$arr = array_merge($arr, $pres['data']);
						unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['quantity']);unset($arr['pro_model']);unset($arr['remark']);
					}
				}else{
					$table = 'data_product
					JOIN data_part as b ON prt_pro_id = pro_id
					JOIN data_structure on prt_data_id = str_id
					JOIN data_group ON str_grp_id = grp_id
					LEFT JOIN data_picture ON str_id = pic_data_id and pic_type="str"';
					$where .= sprintf(' and prt_type="str" and pro_id = %d and str_id=%d limit 1', $proId, $realGrp2Id);
					$filed = ['prt_itid AS weizhi, grp_label as grp1_name, str_name as grp2_name, prt_label pro_name, prt_quantity as quantity ,pro_number as display, prt_model pro_model, prt_remark remark, pic_path img_path, pic_name img_name,pic_point img_json, img_ratio'];
					$res = $this->get($table, $filed, $where, true);
					$arr = $res['data'];
					if(!empty($arr))
					{
						$arr['para'] = [];
						if(!empty($arr['quantity'])) $arr['para'][] = ['name'=>'用量', 'val'=>$arr['quantity'], 'unit'=>''];
						if(!empty($arr['pro_model'])) $arr['para'][] = ['name'=>'车型', 'val'=>strip_tags($arr['pro_model']), 'unit'=>''];
						if(!empty($arr['pro_remark'])) $arr['para'][] = ['name'=>'备注', 'val'=>strip_tags($arr['pro_remark']), 'unit'=>''];
						$arr['pic'] = empty($arr['img_name']) ? '': sprintf('%s%s/%s', $this->imgUrlbase(), $arr['img_path'], $arr['img_name']);
						$pres = $this->formatImgPos($this->EtkId, $arr['img_json'], ['img_ratio'=>$arr['img_ratio']]);
						$arr = array_merge($arr, $pres['data']);
						unset($arr['img_path']);unset($arr['img_name']);unset($arr['img_json']);unset($arr['quantity']);unset($arr['pro_model']);unset($arr['remark']);
					}
				}
			break;
		}
		$arr['pro_id'] = $proId;
		$arr['othpic'] = empty($arr['othpic'])? []: $arr['othpic'];
		$arr['pro_price'] = ['title'=>'4S店价', 'price'=>'0.00'];
		$arr['etk_id'] = $this->EtkId;
		$arr['grp2_id'] = $grp2Id;
		if(isset($arr['pro_name'])) $arr['pro_name'] = strip_tags($arr['pro_name']);
		if(isset($arr['grp2_name'])) $arr['grp2_name'] = strip_tags($arr['grp2_name']);
		if(isset($arr['grp1_name'])) $arr['grp1_name'] = strip_tags($arr['grp1_name']);
		if(empty($arr['weizhi_name']))
		{
			$arr['weizhi_name'] = $arr['weizhi'];
			$reArr = ['(', ')', '（', '）'];
			$arr['weizhi'] = trim(str_replace($reArr, '', $arr['weizhi']));
		}
		if(!empty($arr['wz'])) 
		{
			foreach($arr['wz'] as $k=>$v)
			{
				if($arr['weizhi'] != $v[0]) unset($arr['wz'][$k]);
			}
			$arr['wz'] = array_values($arr['wz']);
		}
		$reArr = ['<br>'=>"\r\n", '<br/>'=>"\r\n", '<br />'=>"\r\n"];
		if(!empty($arr['para']))
		{
			foreach($arr['para'] as $k=>$v)
			{
				$arr['para'][$k]['val'] = strip_tags(strtr($v['val'], $reArr));
			}
		}
		//图片版权
		if(!$this->EPCIMGALL && stripos($arr['pic'], 'copyright_') !== false){
			$arr['pic'] = '';
			$arr['wz'] = [];
		}
		return LibFc::ReturnData(true, $arr);
	}



	/**
	  * @method 获取产品的适用车型ID
	  * @param  grp2Id 零件ID
	  * @param  proId 配件ID
	  * @author soul
	  * @copyright 2017/4/13
	  * @return 
	  {"status":true,"data": [11,22,333...],"code":""}
	  {"status":false,"data":'失败原因',"code":'error'}
	  */
	public function getItemMod3Id($proId, $grp2Id = 0)
	{
		$m3IdArr = [];
		$proId = (int) $proId;
		if($proId < 1) return LibFc::ReturnData(true, $m3IdArr);
		$codeType = 'etkcode';
		$modelInfo = [];
		$where = sprintf(" and lnk_pro_id=%d", $proId);
		if($grp2Id) $where .= sprintf(" and lnk_grp_id=%d", $grp2Id);
		switch($this->EtkId)
		{
			case 7:
			case 11:
				//适用车型
				$where = sprintf(" and lnk_pro_id=%d", $proId);
				if($grp2Id) $where .= sprintf(" and lnk_part_id=%d", $grp2Id);
				$res = $this->get('data_product_links JOIN data_parts ON part_id=lnk_part_id JOIN data_value ON val_id = part_val_id', ['distinct val_value'], $where);
				$codeArr = array_column($res['data'], 'val_value');
			break;
			case 2 :
				$where = sprintf(" and row_pro_id=%d", $proId);
				if($grp2Id) $where .= sprintf(" and row_vpg_id=%d", $grp2Id);
				$res = $this->get('data_product_content JOIN data_links ON row_vpg_id = vpg_id JOIN data_code ON uid_id = vpg_uid_id', ['distinct uid_text'], $where);
				$codeArr = array_column($res['data'], 'uid_text');
			break;
			case 1 :
				$res = $this->get('data_links JOIN data_value ON vin_id = lnk_vin_id', ['distinct vin_text'], $where);
				$codeArr = array_column($res['data'], 'vin_text');
			break;
			case 5:
				$where = sprintf(" and lnk_pro_id=%d", $proId);
				if($grp2Id) $where .= sprintf(" and lnk_list_id=%d", $grp2Id);
				$res = $this->get('data_links JOIN data_value ON vin_id = lnk_vin_id', ['distinct vin_name'], $where);
				$codeArr = array_column($res['data'], 'vin_name');
				$res = $this->get('data_replace', ['GROUP_CONCAT(rep_vin_list) as rep_vin_list'], sprintf(" and (rep_pro_id=%d or rep_new_id=%d) and rep_vin_list != ''", $proId, $proId), true);
				if(!empty($res['data']['rep_vin_list']))
				{
					$res = $this->get('data_value', ['distinct vin_name'], sprintf(" and vin_id in (%s)", $res['data']['rep_vin_list']));
					$codeArr = array_merge($codeArr, array_column($res['data'], 'vin_name'));
				}
			break;
			case 12 :
			case 10 :
				$where = $this->EtkId == 10? ' and lnk_id not in (select distinct dli_lnk_id from data_links_ignore)': '';
				$where .= sprintf(" and fiInvalid != 1 and lnk_pro_id=%d", $proId);
				if($grp2Id) $where .= sprintf(" and grp_id=%d", $grp2Id);
				$where .= " group by vin_value";
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['vin_value', 'modelInfo modelinfo'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
				if($this->EtkId == 10) $modelInfo = $res['data'];
			break;
			case 13 :
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct vin_name'], $where);
				$codeArr = array_column($res['data'], 'vin_name');
			break;
			case 9 :
				$res = $this->get('data_group JOIN data_value ON val_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct val_value'], $where);
				$codeArr = array_column($res['data'], 'val_value');
			break;
			case 8 :
				$where = sprintf(" and lnk_pro_id=%d", $proId);
				if($grp2Id) $where .= sprintf(" and rem_id=%d", $grp2Id);
				$res = $this->get('data_group JOIN data_value ON val_id = grp_vin_id join data_group_remark on rem_grp_id=grp_id join data_links ON lnk_rem_id = rem_id', ['distinct val_realoem'], $where);
				$codeArr = array_column($res['data'], 'val_realoem');
				$codeType = 'modcode';
			break;
			case 14:
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct vin_value'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
			break;
			case 15 :
				//适用车型
				$where = sprintf(" and lnk_pro_id=%d", $proId);
				if($grp2Id) $where .= sprintf(" and lst_id=%d", $grp2Id);
				$res = $this->get('data_group JOIN data_value ON val_id = grp_val_id join data_group_list on lst_grp_id=grp_id join data_product_links ON lnk_lst_id = lst_id', ['distinct val_value'], $where);
				$codeArr = array_column($res['data'], 'val_value');
			break;
			case 4 :
				$where = sprintf(" and ppm_pro_id=%d", $proId);
				if($grp2Id) $where .= sprintf(" and ppm_pmg_id=%d", $grp2Id);
				$res = $this->get('data_links JOIN data_value ON vin_id = ppm_vin_id', ['distinct vin_name'], $where);
				$codeArr = array_column($res['data'], 'vin_name');
			break;
			case 16 :
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct vin_value'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
			break;
			case 3 :
				$where = sprintf(" and lnk_pro_id=%d", $proId);
				if($grp2Id) $where .= sprintf(" and prt_id=%d", $grp2Id);
				$res = $this->get('data_group JOIN data_value ON VIN_ID = grp_vin_id JOIN data_part ON prt_grp_id=grp_id JOIN data_links ON lnk_prt_id=prt_id', ['distinct vin_name'], $where);
				$codeArr = array_column($res['data'], 'vin_name');
			break;
			case 17:
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct vin_name'], $where);
				$codeArr = array_column($res['data'], 'vin_name');
			break;
			case 18:
				$where = sprintf(" and lnk_pro_id=%d", $proId);
				if($grp2Id) $where .= sprintf(" and prt_id=%d", $grp2Id);
				$res = $this->get('data_parts JOIN data_value ON vin_id = prt_vin_id join data_links ON lnk_prt_id = prt_id', ['distinct vin_value'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
			break;
			case 19:
				$where = sprintf(" and lnk_pro_id=%d", $proId);
				if($grp2Id) $where .= sprintf(" and grp_id=%d", $grp2Id);
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lng_grp_id = grp_id', ['distinct vin_value'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
			break;
			case 20:
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct vin_value'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
			break;
			case 21:
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct vin_value'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
			break;
			case 22:
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct vin_value'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
			break;
			case 23:
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct vin_value'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
			break;
			case 24:
				$res = $this->get('adata_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct vin_value'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
			break;
			case 26:
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct vin_value'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
			break;
			case 28:
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct vin_value'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
			break;
			case 29:
				$res = $this->get('data_group JOIN data_value ON vin_id = grp_vin_id join data_links ON lnk_grp_id = grp_id', ['distinct vin_value'], $where);
				$codeArr = array_column($res['data'], 'vin_value');
			break;
			case 32:
				$tableArr = [
					['data_part JOIN data_structure on prt_data_id = str_id
					JOIN data_group ON str_grp_id = grp_id
					JOIN vin ON vin_id = grp_vin_id', ' and prt_type="str"', 'str_id'],
					['data_part JOIN data_subs on prt_data_id = sub_id
					JOIN data_group ON sub_grp_id = grp_id
					JOIN vin ON vin_id = grp_vin_id', ' and prt_type="sub"', 'sub_id']
				];
				foreach($tableArr as $table){
					$where = $table[1].sprintf(" and prt_pro_id=%d", $proId);
					if($grp2Id){
						if($table[2] == 'sub_id'){
							$where .= sprintf(" and sub_id=%d", $grp2Id);
						}else if($table[2] == 'str_id'){
							$where .= sprintf(" and str_id=%d", $grp2Id);
						}
					}
					$res = $this->get($table[0], ['distinct vin_text'], $where);
					$codeArr = array_column($res['data'], 'vin_text');
					if(!empty($codeArr)) break;
				}
			break;
		}
		$YpcModel = new YpcModel();
		//含车型备注的 大众系列发动机处理
		//echo microtime(true), "\n";
		if(in_array($this->EtkId, [10]) && !empty($modelInfo)){
			$YpcBase = new YpcBase();
			//var_dump($modelInfo);
			$nullInfoCodes = [];
			foreach($modelInfo as $v){
				$code = LibFc::Escape($v['vin_value']);
				$isEng = false;
				if(!empty($v['modelinfo'])){
					$infoArr = explode(',', strtr($v['modelinfo'], ['<br>'=>',', 'PR:'=>'', ':'=>',']));
					$tes = [];
					foreach($infoArr as $vv){
						if(preg_match('/[0-9a-zA-Z]{3,4}/', $vv, $match)){
							$tes[] = strlen($match[0]) > 3? substr($match[0],0,3): $match[0];
						}
					}
					if(!empty($tes)){//判断备注是否为发动机
						$tes = array_unique($tes);
						$res = $YpcModel->getModel(3, ['m3_engine'], sprintf(" and b_etk_id=%d and left(m3_engine, 3) in ('%s')", $this->EtkId, implode("','", $tes)));
						if(!empty($res['data'])) $isEng = true;
					}
				}
				if($isEng){
					$res = $YpcModel->get('yp_model3_etk_code join yp_model3 on mec_m3_id=m3_id', ['m3_id', 'm3_engine'], sprintf(" and mec_code ='%s' group by m3_id", $code));
					foreach($res['data'] as $vv){
						if(stripos($v['modelinfo'], substr($vv['m3_engine'],0,3)) !== false) $m3IdArr[] = $vv['m3_id'];
					}
				}else{
					$nullInfoCodes[] = $code;
				}
			}
			if(!empty($nullInfoCodes)){
				$res = $YpcModel->get('yp_model3_etk_code', ['mec_m3_id m3_id'], sprintf(" and mec_code in ('%s') group by mec_m3_id", implode("','", $nullInfoCodes)));
				$m3IdArr = array_merge($m3IdArr, array_column($res['data'], 'm3_id'));
			}
			//echo microtime(true), "\n";
		}else{
			$res = $YpcModel->getMod3IdByCode($codeArr, $codeType);
			$m3IdArr = $res['data'];
		}
		if(empty($m3IdArr) && $grp2Id) return $this->getItemMod3Id($proId, 0);
		return LibFc::ReturnData(true, array_values(array_unique($m3IdArr)));
	}


	/**
	  * @method 通过号码查找适用车型
	  * @param  number array  号码 ['11138616793','11 41 8 612 615']
	  * @author soul
	  * @copyright 2017/4/13
	  * @return 
	  {"status":true,"data": [],"code":""}
	  {"status":false,"data":'失败原因',"code":'error'}
	  */
	public function getNumberMod3Id($numArr)
	{
		$arr = [];
		foreach($numArr as $k=>$v){
			$v = LibFc::FormatNum($v);
			if (strlen($v) > 2){
				$numArr[$k] = $v;
			}else{
				unset($numArr[$k]);
			}
		}
		$numArr = array_unique($numArr);
		if(empty($numArr)) return LibFc::ReturnData(true, $arr);
		$res = $this->get('data_product', ['pro_id'], sprintf(" and pro_format in ('%s') group by pro_id", implode("','", $numArr)));
		foreach($res['data'] as $v){
			$res = $this->getItemMod3Id($v['pro_id']);
			$arr = array_merge($arr, $res['data']);
		}
		$arr = array_values(array_unique($arr));
		return LibFc::ReturnData(true, $arr);
	}

	
	

	/**
	  * @method 搜索号码
	  * @param  number string|array 号码
	  * @author soul
	  * @copyright 2017/4/13
	  * @return 
	  {"status":true,"data": [],"code":""}
	  {"status":false,"data":'失败原因',"code":'error'}
	  */
	public function getSearchNumber($number, $islike = true)
	{
		$arr = [];
		$formatNumArr = [];
		if(is_array($number)){
			$formatNumArr = array_unique($number);
		}else {
			$formatNum = LibFc::FormatNum($number);
			if(strlen($formatNum) > 3) $formatNumArr = LibFc::SearchNum($formatNum);
		}
		
		if(!empty($formatNumArr))
		{
			$priceFiled = [];
			$tw = [];
			if($islike){
				foreach($formatNumArr as $t){
					$tw[] = sprintf(" pro_format like '%s%%'", $t);
					$tw[] = sprintf(" pro_reformat like '%s%%'", strrev($t));
				}
			}else{
				$tw[] = sprintf(" pro_format in ('%s')", implode("','", $formatNumArr));
			}
			
			$where = sprintf(" and (%s) group by pro_id", implode(" or ", $tw));
			switch($this->EtkId)
			{
				case 7:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'lnk_part_id AS grp2_id', 'pro_realoem AS pro_number', 'lnk_name AS pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_product_links ON pro_id = lnk_pro_id JOIN data_parts ON part_id = lnk_part_id LEFT JOIN data_picture ON part_img_id=img_id';
				break;
				case 11:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'lnk_part_id AS grp2_id', 'pro_realoem AS pro_number', 'pro_name', 'img_path', 'img_name', 'pro_price', 'pro_price_web'];
					$table = 'data_product JOIN data_product_links ON pro_id = lnk_pro_id JOIN data_parts ON part_id = lnk_part_id LEFT JOIN data_picture ON part_img_id=img_id';
					$priceFiled = [
						'pro_price'=>'销售价',
						'pro_price_web'=>'4S店价'
					];
				break;
				case 2:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'row_vpg_id AS grp2_id', 'row_td_01 AS pro_name', 'pro_realoem AS pro_number', 'img_path', 'img_name'];
					$table = 'data_product_content JOIN data_product ON row_pro_id=pro_id JOIN data_links ON row_vpg_id = vpg_id LEFT JOIN data_picture ON img_id = vpg_img_id';
				break;
				case 1:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'lnk_grp_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group_image ON img_id = lnk_img_id';
				break;
				case 5:
					$tw = [];
					if($islike){
						foreach($formatNumArr as $t){
							$tw[] = sprintf(" pro_format like '%s%%'", $t);
							$tw[] = sprintf(" pro_reformat like '%s%%'", strrev($t));
							$tw[] = sprintf(" rep_format like '%s%%'", $t);
						}
					}else{
						$tw[] = sprintf(" rep_format in ('%s')", implode("','", $formatNumArr));
					}
					$where = sprintf(" and (%s) group by pro_id", implode(" or ", $tw));
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'lnk_list_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product
					JOIN data_links ON lnk_pro_id = pro_id 
					left join data_replace on rep_pro_id = pro_id
					LEFT JOIN data_picture ON img_id = lnk_img_id';
				break;
				case 12:
				case 10:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'lnk_grp_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON grp_id = lnk_grp_id LEFT JOIN data_picture ON img_id = grp_img_id';
				break;
				case 13:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'grp_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON grp_id = lnk_grp_id LEFT JOIN data_picture ON img_id = grp_img_id';
				break;
				case 9:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'lnk_grp_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name', 'pro_price', 'pro_price_repair'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON grp_id = lnk_grp_id LEFT JOIN data_picture ON img_id = grp_img_id';
					$priceFiled = [
						'pro_price'=>'销售价',
						'pro_price_repair'=>'4S店价'
					];
				break;
				case 8:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'rem_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product
					JOIN data_links ON lnk_pro_id = pro_id 
					JOIN data_group_remark ON lnk_rem_id = rem_id
					JOIN data_group ON rem_grp_id = grp_id
					LEFT JOIN data_picture ON rem_img_id = img_id';
				break;
				case 14:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'grp_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON grp_id = lnk_grp_id LEFT JOIN data_picture ON img_id = grp_img_id';
				break;
				case 15:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'lst_id AS grp2_id', 'pro_realoem as pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product
					JOIN data_product_links ON lnk_pro_id = pro_id 
					JOIN data_group_list ON lnk_lst_id = lst_id
					JOIN data_group ON lst_grp_id = grp_id
					LEFT JOIN data_picture ON lst_img_id = img_id';
				break;
				case 4:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'prt_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product
					JOIN data_links ON ppm_pro_id = pro_id 
					JOIN data_group ON prt_id = ppm_pmg_id
					LEFT JOIN data_picture ON prt_img_id = img_id';
				break;
				case 16:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'grp_id AS grp2_id', 'pro_realoem as pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON grp_id = lnk_grp_id LEFT JOIN data_picture ON img_id = grp_img_id';
				break;
				case 3:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'prt_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_part ON prt_id = lnk_prt_id LEFT JOIN data_picture ON prt_id = img_prev_id and img_tab_id = 2';
				break;
				case 17:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'grp_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_img_id = img_id';
				break;
				case 18:
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'lnk_prt_id AS grp2_id', 'pro_realoem as pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_parts ON lnk_prt_id = prt_id LEFT JOIN data_picture ON prt_img_id = img_id';
				break;
				case 19 :
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'grp_id AS grp2_id', 'pro_realoem as pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON grp_id = lng_grp_id LEFT JOIN data_picture_links ON pic_grp_id=grp_id
					LEFT JOIN data_picture ON pic_img_id = img_id';
				break;
				case 20 :
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'grp_id AS grp2_id', 'pro_realoem as pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_part_img_id = img_id';
				break;
				case 21 :
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'grp_id AS grp2_id', 'pro_realoem as pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_img_id = img_id';
				break;
				case 22 :
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'grp_id AS grp2_id', 'pro_realoem as pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON lnk_grp_id = grp_id LEFT JOIN data_picture ON img_data = grp_id AND img_type = 1';
				break;
				case 23 :
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'grp_id AS grp2_id', 'pro_realoem as pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_img_id = img_id';
				break;
				case 24 :
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'grp_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_img_id = img_id';
				break;
				case 26 :
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'grp_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_img_id = img_id';
				break;
				case 28 :
					$filed = [$this->EtkId.' as etk_id', 'pro_id', 'grp_id AS grp2_id', 'pro_number', 'pro_name', 'img_path', 'img_name'];
					$table = 'data_product JOIN data_links ON lnk_pro_id = pro_id JOIN data_group ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_img_id = img_id';
				break;
				case 29 :
					$filed = [$this->EtkId.' as etk_id', 'a.pro_id', 'grp_id AS grp2_id', 'pro_number', 'b.pro_name', 'img_path', 'img_name'];
					$table = 'data_product as a JOIN data_links as b ON lnk_pro_id = pro_id JOIN data_group ON lnk_grp_id = grp_id LEFT JOIN data_picture ON grp_img_id = img_id';
				break;
				case 32:
					$filed = ['*'];
					$table = sprintf("(SELECT 32 as etk_id, pro_id, CONCAT('3', sub_id) AS grp2_id,pro_number,pro_name,pic_path img_path, pic_name img_name FROM data_product
					JOIN data_part AS b ON prt_pro_id = pro_id
					JOIN data_subs ON prt_data_id = sub_id AND prt_type='sub'
					JOIN data_group ON sub_grp_id = grp_id
					LEFT JOIN data_picture ON sub_id = pic_data_id AND pic_type='sub' where 1 %s
					UNION ALL
					SELECT 32 as etk_id, pro_id, CONCAT('2', str_id) AS grp2_id, pro_number,pro_name,pic_path img_path, pic_name img_name FROM data_product
					JOIN data_part AS b ON prt_pro_id = pro_id
					JOIN data_structure ON prt_data_id = str_id AND prt_type='str'
					JOIN data_group ON str_grp_id = grp_id
					LEFT JOIN data_picture ON str_id = pic_data_id AND pic_type='str' where 1 %s) t", $where, $where);
					$where = '';
				break;
			}
			if($table && $filed){
				$res = $this->get($table, $filed, $where);
				foreach($res['data'] as $v)
				{
					$v['pro_price'] = ['title'=>'销售价', 'price'=>'0.00'];
					if(!empty($priceFiled))
					{
						foreach($priceFiled as $f=>$t)
						{
							if(empty($v['pro_price']['price']) || (!empty($v[$f]) && $v[$f] < $v['pro_price']['price']))
								$v['pro_price'] = ['title'=>$t, 'price'=>sprintf('%.2f', $v[$f])];
							unset($v[$f]);
						}
					}
					$v['pro_price'] = ['title'=>'销售价', 'price'=>'0.00'];
					$v['pic'] = empty($v['img_name']) ? []: [sprintf('%s%s/800xX/%s', $this->imgUrlbase(), $v['img_path'], $v['img_name'])];
					//图片版权
					if(!$this->EPCIMGALL && $v['pic'][0] && stripos($v['pic'][0], 'copyright_') !== false) $v['pic'] = [];
					$v['num'] = [['factory'=>'OE', 'display'=>$v['pro_number']]];
					unset($v['pro_number']);unset($v['img_path']);unset($v['img_name']);
					$arr[] = $v;
				}
			}
		}
		return LibFc::ReturnData(true, $arr);
	}


		/**
	  * @method 通过产品ID查询产品基本信息
	  * @param  proIdArr [必填] 产品ID数组
	  * @param  grp2Id [选填] 零件ID
	  * @author soul
	  * @copyright 2017/4/13
	  * @return 
	  {"status":true,"data": [],"code":""}
	  {"status":false,"data":'失败原因',"code":'error'}
	  */
	public function getAnyItemBase($proIdArr, $grp2Id = 0, $lnkId = 0)
	{
		$grp2IdArr = [];
		$grp2Id = is_array($grp2Id)? $grp2Id: [$grp2Id];
		foreach($grp2Id as $v)
		{
			if($v > 0) $grp2IdArr[] = (int) $v;
		}
		$grp2IdArr = array_unique($grp2IdArr);

		$lnkId = (int) $lnkId;
		$arr = [];
		if(empty($proIdArr)) return LibFc::ReturnData(true, $arr);
		//先固定排序
		foreach($proIdArr as $k=>$v)
		{
			$v = (int) $v;
			if($v > 0) $arr[$v] = [];
		}
		if(empty($arr)) return LibFc::ReturnData(true, $arr);
		$proIdArr = array_keys($arr);
		$where = sprintf(" and pro_id in (%s)", implode(',', $proIdArr));
		switch($this->EtkId)
		{
			case 7:
				$table = 'data_product JOIN data_product_links ON pro_id = lnk_pro_id
				JOIN data_parts ON part_id = lnk_part_id
				JOIN data_group ON group_id = part_group_id';
				$filed = ['lnk_code AS weizhi, pro_id, lnk_part_id AS grp2_id, group_name as grp1_name, part_name as grp2_name, pro_realoem AS display, lnk_name as pro_name, part_img_id as img_id'];
				if($lnkId > 0) $where .= sprintf(' and lnk_id=%d', $lnkId);
				if(!empty($grp2IdArr)) $where .= sprintf(' and lnk_part_id in (%s)', implode(',', $grp2IdArr));
			break;
			case 11:
				$table = 'data_product JOIN data_product_links ON pro_id = lnk_pro_id
				JOIN data_parts ON part_id = lnk_part_id
				JOIN data_group ON group_id = part_group_id';
				$filed = ['lnk_code AS weizhi, pro_id, lnk_part_id AS grp2_id, group_name as grp1_name, part_name as grp2_name, pro_realoem AS display, pro_name, concat(lnk_attr, " ", lnk_param) as lnk_note, lnk_qty, part_img_id as img_id'];
				if($lnkId > 0) $where .= sprintf(' and lnk_id=%d', $lnkId);
				if(!empty($grp2IdArr)) $where .= sprintf(' and lnk_part_id in (%s)', implode(',', $grp2IdArr));
			break;
			case 2 :
				$table = 'data_product_content JOIN data_product ON row_pro_id=pro_id
					 JOIN data_links ON row_vpg_id = vpg_id
					 JOIN data_partgrp ON vpg_prt_id = prt_id';

				if(!empty($grp2IdArr)) $where .= sprintf(' and row_vpg_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['row_td_00 AS weizhi, pro_id, row_vpg_id AS grp2_id, prt_text_1 as grp1_name, prt_text_3 as grp2_name, row_td_01 AS pro_name, pro_realoem as display, vpg_img_id as img_id'];
			break;
			case 1 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON grp_id = lnk_grp_id
				JOIN data_links_content ON lnc_id = lnk_lnc_id';
				$imgTable = 'data_group_image';
				if(!empty($grp2IdArr)) $where .= sprintf(' and lnk_grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_location AS weizhi, pro_id, lnk_grp_id AS grp2_id, desc_note AS pro_name, prt_name as grp1_name, grp_name as grp2_name, pro_number as display, lnk_img_id as img_id'];
			break;
			case 5:
				$table = 'data_product
				JOIN data_links on pro_id = lnk_pro_id
				join data_group_list on lnk_list_id = list_id
				JOIN data_group ON prt_id = list_prt_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and list_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_code as weizhi, pro_id, list_id AS grp2_id', 'concat(prt_name_1, "-", prt_name_2) as grp1_name', 'concat(prt_name_3, "-", titre) as grp2_name', 'lnk_name as pro_name', 'pro_number as display', 'lnk_img_id as img_id'];
			break;
			case 12 :
			case 10 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['hotspotIds as weizhi, position AS weizhi_name, pro_id, grp_id AS grp2_id, grp_master_text as grp1_name, grp_slave_text as grp2_name,pro_name,pro_number as display, grp_img_id as img_id'];
			break;
			case 13 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_td_1 AS weizhi, pro_id, grp_id AS grp2_id, concat(grp_item_1, "-", grp_item_2, " ", grp_name_2) as grp1_name, grp_name_4 as grp2_name, pro_name, pro_number as display, grp_img_id as img_id'];
			break;
			case 9 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['nplpartref AS weizhi, pro_id, grp_id AS grp2_id, grp_name_1 as grp1_name,grp_name_2 as grp2_name,pro_name, pro_number as display, grp_img_id as img_id'];
			break;
			case 8 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group_remark ON lnk_rem_id = rem_id
				JOIN data_group ON rem_grp_id = grp_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and rem_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_pnc AS weizhi, pro_id, rem_id AS grp2_id, grp_name_1 as grp1_name,grp_name_2 as grp2_name, lnk_name as pro_name, pro_number as display, rem_img_id as img_id'];
			break;
			case 14:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_code AS weizhi, pro_id, grp_id AS grp2_id, grp_name_2 as grp1_name, grp_name_4 as grp2_name, lnk_name as pro_name, pro_number as display, grp_img_id as img_id'];
			break;
			case 15 :
				$table = 'data_product
				JOIN data_product_links ON lnk_pro_id = pro_id 
				JOIN data_group_list ON lnk_lst_id = lst_id
				JOIN data_group ON lst_grp_id = grp_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and lst_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_code AS weizhi, pro_id, lst_id AS grp2_id, grp_name_1 as grp1_name,grp_name_2 as grp2_name, lnk_name as pro_name, pro_realoem as display, lst_img_id as img_id'];
			break;
			case 4:
				$table = 'data_product
				JOIN data_links ON ppm_pro_id = pro_id 
				JOIN data_group ON prt_id = ppm_pmg_id
				LEFT JOIN data_picture ON prt_img_id = img_id
				LEFT JOIN data_product_image ON pic_pro_id = ppm_pro_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and prt_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['ppm_pos_id AS weizhi, pro_id, prt_id AS grp2_id, prt_name_1 as grp1_name,prt_name_2 as grp2_name, pro_name, pro_number as display, img_path, img_name'];
			break;
			case 16 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_code AS weizhi, pro_id, grp_id AS grp2_id, grp_name_1 as grp1_name, grp_name_2 as grp2_name, pro_name, pro_realoem as display, grp_img_id as img_id'];
			break;
			case 3 :
				$table = 'data_product
					JOIN data_links ON lnk_pro_id = pro_id
					JOIN data_part ON prt_id = lnk_prt_id
					JOIN data_group ON prt_grp_id = grp_id
					LEFT JOIN data_picture_links ON lnk_id = lnp_next_id AND lnp_tab_id = 2
					LEFT JOIN data_picture ON lnp_img_id = img_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and prt_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_code AS weizhi, pro_id, prt_id AS grp2_id, grp_name_1 as grp1_name, concat(prt_item_2, " ", prt_name_2) as grp2_name, lnk_name AS pro_name, pro_number as display, img_path, img_name'];
			break;
			case 17:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_code AS weizhi, pro_id, grp_id AS grp2_id, grp_name_1 as grp1_name, grp_name_3 as grp2_name, lnk_name as pro_name, pro_number as display, grp_img_id as img_id'];
			break;
			case 18:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_parts ON lnk_prt_id = prt_id
				JOIN data_group ON prt_grp_id = grp_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and prt_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_code AS weizhi, pro_id, prt_id AS grp2_id, grp_name_2 as grp1_name, concat(prt_item_3, " ", prt_subject) as grp2_name, lnk_name as pro_name,pro_realoem as display, prt_img_id as img_id'];
			break;
			case 19 :
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lng_grp_id = grp_id
				LEFT JOIN data_picture_links ON pic_grp_id=grp_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_partsequence AS weizhi, pro_id, grp_id AS grp2_id, grp_name_1 as grp1_name, grp_name_2 as grp2_name, pro_name, pro_realoem as display, pic_img_id as img_id'];
			break;
			case 20:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_code AS weizhi, pro_id, grp_id AS grp2_id, grp_name_1 as grp1_name, grp_name_3 as grp2_name, lnk_name as pro_name, pro_realoem as display, grp_part_img_id as img_id'];
			break;
			case 21:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if($lnkId > 0) $where .= sprintf('and lnk_id=%d', $lnkId);
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_code AS weizhi, pro_id, grp_id AS grp2_id, grp_name_1 as grp1_name, grp_name_2 as grp2_name, lnk_name as pro_name, pro_realoem as display, grp_img_id as img_id'];
			break;
			case 22:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id
				LEFT JOIN data_picture ON img_data = lnk_grp_id and img_type = 1';
				if($lnkId > 0) $where .= sprintf(' and lnk_id=%d', $lnkId);
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_code AS weizhi, pro_id, grp_id AS grp2_id, grp_name_1 as grp1_name, concat(grp_order_2, grp_name_3) as grp2_name, lnk_name as pro_name,pro_realoem as display, img_path, img_name'];
			break;
			case 23:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if($lnkId > 0) $where .= sprintf(' and lnk_id=%d', $lnkId);
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_code AS weizhi, pro_id, grp_id AS grp2_id, grp_name_1 as grp1_name, grp_name_2 as grp2_name, lnk_name as pro_name, pro_realoem as display, grp_img_id as img_id'];
			break;
			case 24:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if($lnkId > 0) $where .= sprintf(' and lnk_id=%d', $lnkId);
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['position AS weizhi, pro_id, grp_id AS grp2_id, grp_master_text as grp1_name, grp_slave_text as grp2_name, description as pro_name, pro_number as display, grp_img_id as img_id'];
			break;
			case 26:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if($lnkId > 0) $where .= sprintf(' and lnk_id=%d', $lnkId);
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['lnk_code AS weizhi, pro_id, grp_id AS grp2_id, concat(grp_item_1, " ", grp_name_1) as grp1_name, concat(grp_item_3, " ", grp_name_3) as grp2_name, lnk_name as pro_name, pro_number as display, grp_img_id as img_id'];
			break;
			case 28:
				$table = 'data_product
				JOIN data_links ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if($lnkId > 0) $where .= sprintf(' and lnk_id=%d', $lnkId);
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['pro_order AS weizhi, pro_id, grp_id AS grp2_id, grp_name_1 as grp1_name, grp_name_2 as grp2_name, pro_PartName as pro_name, pro_number as display, grp_img_id as img_id'];
			break;
			case 29:
				$table = 'data_product as a
				JOIN data_links as b ON lnk_pro_id = pro_id 
				JOIN data_group ON lnk_grp_id = grp_id';
				if($lnkId > 0) $where .= sprintf(' and lnk_id=%d', $lnkId);
				if(!empty($grp2IdArr)) $where .= sprintf(' and grp_id in (%s)', implode(',', $grp2IdArr));
				$filed = ['pro_location AS weizhi, pro_id, grp_id AS grp2_id, grp_name_1 as grp1_name, grp_name_2 as grp2_name, b.pro_name, pro_number as display, grp_img_id as img_id'];
			break;
			case 32:
				if($lnkId > 0) $where .= sprintf(' and prt_id=%d', $lnkId);
				if(!empty($grp2IdArr)){
					$table = sprintf("(SELECT prt_itid AS weizhi, pro_id, CONCAT('3', sub_id) AS grp2_id, grp_label as grp1_name, sub_name as grp2_name, pro_name, pro_number as display, pic_path img_path, pic_name img_name
					FROM data_product
					JOIN data_part AS b ON prt_pro_id = pro_id
					JOIN data_subs ON prt_data_id = sub_id AND prt_type='sub'
					JOIN data_group ON sub_grp_id = grp_id
					LEFT JOIN data_picture ON sub_id = pic_data_id AND pic_type='sub' where 1 %s and CONCAT('3', sub_id) in (%s) group by pro_id
					UNION ALL
					SELECT prt_itid AS weizhi, pro_id, CONCAT('2', str_id) AS grp2_id, grp_label as grp1_name, str_name as grp2_name, pro_name, pro_number as display, pic_path img_path, pic_name img_name
					FROM data_product
					JOIN data_part AS b ON prt_pro_id = pro_id
					JOIN data_structure ON prt_data_id = str_id AND prt_type='str'
					JOIN data_group ON str_grp_id = grp_id
					LEFT JOIN data_picture ON str_id = pic_data_id AND pic_type='str' where 1 %s and CONCAT('2', str_id) in (%s) group by pro_id) t", $where, implode(',', $grp2IdArr), $where, implode(',', $grp2IdArr));
				}else{
					$table = sprintf("(SELECT prt_itid AS weizhi, pro_id, CONCAT('3', sub_id) AS grp2_id, grp_label as grp1_name, sub_name as grp2_name, pro_name, pro_number as display, pic_path img_path, pic_name img_name
					FROM data_product
					JOIN data_part AS b ON prt_pro_id = pro_id
					JOIN data_subs ON prt_data_id = sub_id AND prt_type='sub'
					JOIN data_group ON sub_grp_id = grp_id
					LEFT JOIN data_picture ON sub_id = pic_data_id AND pic_type='sub' where 1 %s group by pro_id
					UNION ALL
					SELECT prt_itid AS weizhi, pro_id, CONCAT('2', str_id) AS grp2_id, grp_label as grp1_name, str_name as grp2_name, pro_name, pro_number as display, pic_path img_path, pic_name img_name
					FROM data_product
					JOIN data_part AS b ON prt_pro_id = pro_id
					JOIN data_structure ON prt_data_id = str_id AND prt_type='str'
					JOIN data_group ON str_grp_id = grp_id
					LEFT JOIN data_picture ON str_id = pic_data_id AND pic_type='str' where 1 %s  group by pro_id) t", $where, $where);
				}
				$filed = ['*'];
				$itemRes = $this->get($table, $filed, '');
			break;
		}
		$where .= ' group by pro_id';
		if(!isset($itemRes)) $itemRes = $this->get($table, $filed, $where);
		
		if(empty($itemRes['data'])) return LibFc::ReturnData(true, $arr);
		
		//图片
		$allImgArr = [];
		if(isset($itemRes['data'][0]['img_id']))
		{
			$imgIdArr = [];
			foreach($itemRes['data'] as $v)
			{
				if(!empty($v['img_id'])) $imgIdArr[] = (int) $v['img_id'];
			}
			if(!empty($imgIdArr))
			{
				$imgTable = empty($imgTable)? 'data_picture': $imgTable;
				$imgFiled = empty($imgFiled)? ['img_id, img_path, img_name']: $imgFiled;
				$res = $this->get($imgTable, $imgFiled, sprintf(" and img_id in (%s)", implode(',', array_unique($imgIdArr))));
				$allImgArr = array_column($res['data'], null, 'img_id');
			}
		}
		foreach($itemRes['data'] as $v)
		{
			$v['etk_id'] = $this->EtkId;
			$v['num'] = [['factory'=>'OE', 'display'=>$v['display']]];
			if(!empty($v['img_id']) && !empty($allImgArr[$v['img_id']]))
			{
				$v['pic'] = [sprintf('%s%s/800xX/%s', $this->imgUrlbase(), $allImgArr[$v['img_id']]['img_path'], $allImgArr[$v['img_id']]['img_name'])];
			}
			else
			{
				$v['pic'] = empty($v['img_name']) ? []: [sprintf('%s%s/800xX/%s', $this->imgUrlbase(), $v['img_path'], $v['img_name'])];
			}
			//图片版权
			if(!$this->EPCIMGALL && $v['pic'][0] && stripos($v['pic'][0], 'copyright_') !== false) $v['pic'] = [];

			if(isset($v['pro_name'])) $v['pro_name'] = strip_tags($v['pro_name']);
			if(isset($v['grp2_name'])) $v['grp2_name'] = strip_tags($v['grp2_name']);
			if(isset($v['grp1_name'])) $v['grp1_name'] = strip_tags($v['grp1_name']);
			if(empty($v['weizhi_name']))
			{
				$v['weizhi_name'] = $v['weizhi'];
				$reArr = ['(', ')', '（', '）'];
				$v['weizhi'] = trim(str_replace($reArr, '', $v['weizhi']));
			}
			unset($v['img_id']);unset($v['display']);unset($v['img_path']);unset($v['img_name']);
			$arr[$v['pro_id']] = $v;
		}

		//剔除空的
		foreach($arr as $proId=>$v)
		{
			if(empty($v) || empty($v['num'])) unset($arr[$proId]);
		}
		return LibFc::ReturnData(true, array_values($arr));
	}


	/**处理图片位置信息***/
	public function formatImgPos($etkId, $string, $othArr = [])
	{
		$arr = ['width'=>0 , 'wz'=>[], 'rate'=>1];
		$temp = json_decode($string, true);
		if(!empty($temp))
		{
			switch($etkId)
			{
				//宝马
				case 2:
					//兼容旧的
					if(stripos($othArr['pic'], '/newimg/') === false && stripos($othArr['pic'], '/struct') === false) $arr['width'] = 640;
					foreach($temp as $v)
					{
						$arr['wz'][] = [(string)array_shift($v), implode(',', $v)];
					}
				break;
				//奔驰、日产  {"data-size":"95,17","data-position":"808,361","data-codeonimage":"081466162H"}
				case 7:
					foreach($temp as $v)
					{
						$a = explode(',', $v['data-position']);
						$b = explode(',', $v['data-size']);
						$arr['wz'][] = [(string)$v['data-codeonimage'], $a[0].','.$a[1].','.($a[0]+$b[0]).','.($a[1]+$b[1])];
					}
				break;
				case 11:
					foreach($temp as $v)
					{
						$arr['wz'][] = [(string)$v[0], $v[1].','.$v[2].','.($v[1]+14).','.($v[2]+15)];
					}
				break;
				//保时捷 {"hsKey":"4","hsPartNo":"4","hsGroup": [],"hsX":961,"hsY":144,"hsWidth":75,"hsHeight":86}
				//{"hsKey":"7_2","hsPartNo":"7","hsGroup":["7","7_1","7_2"],"hsX":378,"hsY":451,"hsWidth":31,"hsHeight":37}
				/*{"hsKey":"4","hsPartNo":"4","hsGroup": ["4_1"],"hsX":1139,"hsY":2146,"hsWidth":73,"hsHeight":86},
				{"hsKey":"4_1","hsPartNo":"4","hsGroup": ["4"],"hsX":1587,"hsY":3090,"hsWidth":73,"hsHeight":86},
				*/
				case 12:
				case 10:
				case 13:
				case 14:
					foreach($temp['hotspots'] as $v)
					{	
						//var_dump($v);echo '<hr>';
						$pos = $v['hsX'].','.$v['hsY'].','.($v['hsX']+$v['hsWidth']).','.($v['hsY']+$v['hsHeight']);
						if($v['hsKey'] == '2_1')
						{
							//var_dump($pos);exit;
						}
						if(!empty($v['hsPartNo']))
						{
							$arr['wz'][] = [(string)$v['hsPartNo'], $pos];
						}
						else
						{
							$arr['wz'][] = [(string)$v['hsKey'], $pos];
						}
					}
				break;
				//五菱宝骏 {"callout":"AR04-008  20151030","x":"432.45","y":"59.75"}
				case 1:
					$arr['width'] = 602;
					foreach($temp as $v)
					{
						$arr['wz'][] = [(string)$v['callout'], $v['x'].','.$v['y'].','.($v['x']+14).','.($v['y']+15)];
					}
				break;
				//标致,雪铁龙,谛艾仕 "2":["201, 148, 11","114, 245, 11","49, 231, 11","185, 355, 11","138, 208, 11"],"4":["403, 438, 11","114, 245, 11","138, 208, 11","409, 412, 11"]
				case 5:
					foreach($temp as $k=>$v)
					{
						foreach($v as $vv)
						{
							$tt = explode(',', str_replace(' ', '', $vv));
							$tt[0] = $tt[0]-1;
							$tt[1] = $tt[1]-2;
							$arr['wz'][] = [(string)$k, $tt[0].','.$tt[1].','.($tt[0]+$tt[2]).','.($tt[1]+$tt[2])];
						}
					}
				break;
				//本田{"21":[{"max_x":166,"max_y":558,"min_x":124,"min_y":528},{"max_x":521,"max_y":922,"min_x":480,"min_y":891},{"max_x":963,"max_y":922,"min_x":921,"min_y":892}]}
				case 9:
					foreach($temp as $pos=>$v)
					{	
						foreach($v as $vv)
						{
							$arr['wz'][] = [(string)$pos, $vv['min_x'].','.$vv['min_y'].','.$vv['max_x'].','.$vv['max_y']];
						}
					}
				break;
				//丰田[["09110",60,58,118,79],["09150",163,233,221,253],["81604",351,800,410,820],["09113",453,80,512,101],["51960",451,199,510,219]]
				case 8:
					foreach($temp as $pos=>$v)
					{	
						$arr['wz'][] = [(string)$v[0], $v[1].','.$v[2].','.$v[3].','.$v[4]];
					}
				break;
				//三菱 
				case 14:
					foreach($temp as $pos=>$v)
					{	
						$arr['wz'][] = [(string)$v[0], $v[1].','.$v[2].','.$v[3].','.$v[4]];
					}
				break;
				//马自达{"10108": {"327|596|381|609": ["327", "596", "381", "609"]}, "1010X": {"181|445|238|458": ["181", "445", "238", "458"]}, "10126": {"282|499|336|512": ["282", "499", "336", "512"], "548|611|602|624": ["548", "611", "602", "624"]}, "10135": {"38|338|92|351": ["38", "338", "92", "351"]}, "10138": {"38|393|92|407": ["38", "393", "92", "407"]}, "10220": {"630|123|684|136": ["630", "123", "684", "136"]}, "10227": {"736|415|791|428": ["736", "415", "791", "428"]}, "10235": {"575|547|630|560": ["575", "547", "630", "560"]}, "10250": {"88|112|143|126": ["88", "112", "143", "126"]}, "10271": {"294|1152|346|1165": ["294", "1152", "346", "1165"]}, "12111": {"469|1032|518|1045": ["469", "1032", "518", "1045"]}, "12114": {"66|706|118|719": ["66", "706", "118", "719"], "655|576|708|589": ["655", "576", "708", "589"]}, "12121": {"635|1029|687|1042": ["635", "1029", "687", "1042"]}, "23080": {"159|911|215|925": ["159", "911", "215", "925"], "648|725|704|738": ["648", "725", "704", "738"]}, "10155C": {"144|884|212|898": ["144", "884", "212", "898"]}, "10155D": {"649|685|717|698": ["649", "685", "717", "698"]}, "102521": {"90|86|152|99": ["90", "86", "152", "99"]}, "10306A": {"398|557|465|570": ["398", "557", "465", "570"]}, "10307B": {"399|606|465|620": ["399", "606", "465", "620"]}, "12112A": {"42|822|108|835": ["42", "822", "108", "835"], "654|616|720|630": ["654", "616", "720", "630"]}, "12114B": {"55|884|120|898": ["55", "884", "120", "898"], "651|645|716|658": ["651", "645", "716", "658"]}}
				case 15:
					foreach($temp as $pos=>$v)
					{	
						foreach($v as $vv)
						{
							$arr['wz'][] = [(string)$pos, $vv[0].','.$vv[1].','.$vv[2].','.$vv[3]];
						}
					}
				break;
				case 16:
				//{"1":[{"x":1258.1736345215998,"y":309.4733526875,"w":35.51754840000003,"h":41.41615624999999}],"2":[{"x":935.3427979312002,"y":1348.817710375,"w":35.51754840000003,"h":41.41615624999999},{"x":935.3427979312002,"y":1348.817710375,"w":35.51754840000003,"h":41.41615624999999}],"3":[{"x":766.8120307732,"y":1306.0289043750001,"w":35.51754840000003,"h":41.41615624999999},{"x":766.8120307732,"y":1306.0289043750001,"w":35.51754840000003,"h":41.41615624999999}],"5":[{"x":927.6354899284006,"y":443.4250351875,"w":35.51754840000003,"h":41.41615624999999}],"6":[{"x":1402.7537348752005,"y":947.5188226875,"w":35.51754840000003,"h":41.41615624999999}],"7":[{"x":794.0421512132006,"y":1585.670791375,"w":35.51754840000003,"h":41.41615624999999}],"9":[{"x":1275.7903385280001,"y":1654.5991085624999,"w":35.51754840000003,"h":41.41615624999999}],"10":[{"x":227.8805905343993,"y":1121.999172375,"w":35.51754840000003,"h":41.41615624999999}],"11":[{"x":499.83845863319925,"y":1044.4326283125,"w":35.51754840000003,"h":41.41615624999999}],"12":[{"x":248.83594409039986,"y":953.9324103125,"w":35.51754840000003,"h":41.41615624999999},{"x":248.83594409039986,"y":953.9324103125,"w":35.51754840000003,"h":41.41615624999999},{"x":248.83594409039986,"y":953.9324103125,"w":35.51754840000003,"h":41.41615624999999}],"13":[{"x":381.04409841799986,"y":1563.5900634999998,"w":35.51754840000003,"h":41.41615624999999},{"x":381.04409841799986,"y":1563.5900634999998,"w":35.51754840000003,"h":41.41615624999999},{"x":381.04409841799986,"y":1563.5900634999998,"w":35.51754840000003,"h":41.41615624999999},{"x":381.04409841799986,"y":1563.5900634999998,"w":35.51754840000003,"h":41.41615624999999},{"x":381.04409841799986,"y":1563.5900634999998,"w":35.51754840000003,"h":41.41615624999999},{"x":381.04409841799986,"y":1563.5900634999998,"w":35.51754840000003,"h":41.41615624999999}],"14":[{"x":198.04584987839988,"y":976.2853015000001,"w":35.51754840000003,"h":41.41615624999999}],"15":[{"x":478.0780406468001,"y":559.0707766249999,"w":35.51754840000003,"h":41.41615624999999},{"x":478.0780406468001,"y":559.0707766249999,"w":35.51754840000003,"h":41.41615624999999},{"x":478.0780406468001,"y":559.0707766249999,"w":35.51754840000003,"h":41.41615624999999}],"16":[{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999},{"x":265.46999592439937,"y":181.1306010624998,"w":35.51754840000003,"h":41.41615624999999}],"18":[{"x":200.62679172879973,"y":415.59337818750004,"w":35.51754840000003,"h":41.41615624999999},{"x":200.62679172879973,"y":415.59337818750004,"w":35.51754840000003,"h":41.41615624999999}],"20":[{"x":139.85626641640005,"y":861.3732176875,"w":35.51754840000003,"h":41.41615624999999},{"x":139.85626641640005,"y":861.3732176875,"w":35.51754840000003,"h":41.41615624999999}],"21":[{"x":1022.6212535327996,"y":137.8803007499998,"w":35.51754840000003,"h":41.41615624999999}],"22":[{"x":705.4021895896001,"y":940.762072625,"w":35.51754840000003,"h":41.41615624999999}]}
					foreach($temp as $k=>$v)
					{	
						foreach($v as $vv)
						{
							$arr['wz'][] = [(string)$k, $vv['x'].','.$vv['y'].','.($vv['x']+$vv['w']).','.($vv['y']+$vv['h'])];
						}
					}
				break;
				case 3:
				//{"51711": [["300", "213", "70", "25"], ["47", "37", "70", "25"]], "52752": [["548", "403", "72", "25"]], "58120": [["1261", "844", "72", "25"]], "58125": [["1009", "759", "72", "25"]], "58221": [["1125", "1057", "72", "25"]], "58222": [["1200", "712", "72", "25"]], "58230": [["1262", "562", "72", "25"]], "58232": [["1312", "1052", "72", "25"]], "58233": [["1359", "946", "72", "25"]], "58264": [["502", "1027", "72", "25"]], "58265": [["502", "1047", "72", "25"]], "58266": [["434", "1048", "72", "25"]], "58267": [["427", "861", "72", "25"]], "58268": [["472", "920", "72", "25"]], "58269": [["513", "898", "72", "25"]], "58302": [["1537", "704", "72", "25"]], "58311": [["1140", "639", "70", "25"]], "58314": [["1314", "864", "72", "25"]], "58323": [["247", "881", "72", "25"]], "59775": [["239", "1001", "72", "25"]], "1140MG": [["489", "485", "94", "25"]], "1220FS": [["768", "698", "88", "25"]], "1360JD": [["331", "236", "87", "25"], ["61", "129", "87", "25"]], "52730A": [["582", "349", "87", "25"]], "55175L": [["131", "66", "84", "25"]], "55185R": [["131", "85", "88", "25"]], "58163B": [["938", "867", "87", "25"], ["1059", "715", "87", "25"]], "58164E": [["1181", "1099", "87", "25"]], "58210A": [["1262", "582", "87", "25"]], "58235B": [["1251", "1016", "87", "25"]], "58244A": [["1504", "1081", "87", "25"], ["1578", "777", "87", "25"]], "58250D": [["442", "667", "88", "25"]], "58250R": [["442", "688", "88", "25"]], "58251A": [["352", "768", "87", "25"]], "58252A": [["352", "787", "87", "25"]], "58253A": [["599", "1128", "87", "25"]], "58254A": [["599", "1147", "87", "25"]], "58255B": [["631", "1059", "87", "25"]], "58305B": [["473", "1142", "87", "25"]], "58310A": [["1140", "660", "87", "25"]], "58322B": [["675", "985", "87", "25"]], "58411B": [["720", "443", "85", "25"]]}
					$rate = !empty($othArr['height']) ? $othArr['height']*0.68/820: 1.88;
					foreach($temp as $pos=>$v)
					{	
						foreach($v as $vv)
						{
							$vv[0] = round($vv[0]*$rate);
							$vv[1] = round($vv[1]*$rate);
							$arr['wz'][] = [(string)$pos, $vv[0].','.$vv[1].','.($vv[0]+$vv[2]).','.($vv[1]+$vv[3])];
						}
					}
				break;
				case 17:
				//{"0104S": [["957", "126", "102", "142"]], "10938": [["898", "154", "968", "170"]], "11024": [["985", "466", "105", "482"]], "11051": [["138", "479", "208", "495"]], "11093": [["1035", "304", "110", "320"]], "22326": [["407", "541", "477", "557"]], "11021A": [["210", "358", "294", "374"], ["350", "489", "434", "505"], ["671", "97", "755", "113"]], "A40606": [["1019", "173", "110", "189"]], "A70862": [["406", "49", "490", "65"]], "G78604": [["985", "527", "106", "543"]], "G78605": [["985", "558", "106", "574"]], "G93107": [["985", "496", "106", "512"]]}
					foreach($temp as $pos=>$v)
					{	
						foreach($v as $vv)
						{
							$arr['wz'][] = [(string)$pos, $vv[0].','.$vv[1].','.$vv[2].','.$vv[3]];
						}
					}
				break;
				case 18:
				//{"100":{"x":"1675","y":"775"},"101":{"x":"1480","y":"795"},"102":{"x":"1144","y":"1311"},"103":{"x":"1516","y":"888"},"104":{"x":"1476","y":"1012"},"105":{"x":"1452","y":"1115"},"106":{"x":"1721","y":"1051"},"107":{"x":"1735","y":"844"},"108":{"x":"2069","y":"781"},"109":{"x":"2131","y":"971"},"110":{"x":"1985","y":"1025"},"111":{"x":"1742","y":"1159"},"112":{"x":"2011","y":"1241"},"113":{"x":"1966","y":"1334"},"114":{"x":"1524","y":"1321"},"115":{"x":"1362","y":"1281"},"116":{"x":"1522","y":"1547"},"117":{"x":"1408","y":"1650"},"118":{"x":"1321","y":"1709"},"119":{"x":"767","y":"1854"},"120":{"x":"1315","y":"1850"},"121":{"x":"1496","y":"1935"},"122":{"x":"671","y":"2101"},"123":{"x":"1694","y":"1964"},"124":{"x":"1847","y":"1916"},"125":{"x":"1876","y":"1528"},"126":{"x":"1395","y":"2481"},"127":{"x":"1628","y":"2208"},"128":{"x":"1816","y":"2481"},"129":{"x":"882","y":"2499"},"130":{"x":"840","y":"2636"},"131":{"x":"1429","y":"2816"},"132":{"x":"1222","y":"2819"},"133":{"x":"1237","y":"2914"},"134":{"x":"1042","y":"2536"},"135":{"x":"1069","y":"2205"},"136":{"x":"1275","y":"2235"},"137":{"x":"792","y":"2323"},"138":{"x":"644","y":"2224"},"139":{"x":"733","y":"2573"},"140":{"x":"757","y":"2953"},"141":{"x":"588","y":"2539"},"142":{"x":"351","y":"2653"},"143":{"x":"906","y":"2865"},"144":{"x":"526","y":"1588"},"145":{"x":"298","y":"1662"},"146":{"x":"487","y":"1954"},"147":{"x":"2199","y":"2566"},"148":{"x":"990","y":"826"},"157":{"x":"1530","y":"2677"},"158":{"x":"1601","y":"2606"},"159":{"x":"518","y":"2691"},"160":{"x":"717","y":"1582"},"161":{"x":"812","y":"1511"},"162":{"x":"1096","y":"1815"},"163":{"x":"852","y":"1412"},"164":{"x":"956","y":"1347"},"165":{"x":"623","y":"1484"},"166":{"x":"585","y":"1351"},"167":{"x":"451","y":"1280"},"168":{"x":"661","y":"1221"},"169":{"x":"541","y":"1145"},"170":{"x":"632","y":"1066"},"171":{"x":"697","y":"934"},"172":{"x":"642","y":"800"},"173":{"x":"1718","y":"2936"},"174":{"x":"1949","y":"2451"},"175":{"x":"2007","y":"2851"},"176":{"x":"1723","y":"2659"},"177":{"x":"1468","y":"2920"},"178":{"x":"1815","y":"2902"},"179":{"x":"668","y":"663"},"180":{"x":"799","y":"758"},"181":{"x":"1280","y":"783"},"182":{"x":"1337","y":"679"},"183":{"x":"1910","y":"2874"},"098":{"x":"1693","y":"643"},"099":{"x":"2040","y":"664"}}
					foreach($temp as $pos=>$v)
					{	
						$v['x'] -= 10;
						$v['y'] -= 10;
						$width = 28*strlen($pos);
						$height = 40;
						$arr['wz'][] = [(string)$pos, $v['x'].','.$v['y'].','.($v['x']+$width).','.($v['y']+$height)];
					}
				break;
				case 19:
				case 20:
					//[["265","324","17","32","1"],["454","326","18","28","2"],["546","322","22","29","3"],["665","321","16","27","4"],["26","408","32","26","10"]]
					foreach($temp as $v)	
					{
						$arr['wz'][] = [(string)$v[4], $v[0].','.$v[1].','.($v[0]+$v[2]).','.($v[1]+$v[3])];
					}
				break;
				case 21:
					//{"1":{"152,148,21,17":"152,148,21,17"},"10":{"466,436,20,12":"466,436,20,12"},"11":{"432,415,18,16":"432,415,18,16"},"12":{"407,410,21,9":"407,410,21,9"},"13":{"376,486,26,10":"376,486,26,10"},"14":{"352,495,24,9":"352,495,24,9"},"15":{"244,487,24,11":"244,487,24,11"},"16":{"204,408,20,10":"204,408,20,10"},"17":{"204,380,21,11":"204,380,21,11"},"18":{"201,351,23,11":"201,351,23,11"},"19":{"172,385,21,11":"172,385,21,11"},"2":{"175,158,23,9":"175,158,23,9"},"20":{"149,395,25,8":"149,395,25,8"},"21":{"151,279,25,11":"151,279,25,11"},"3":{"204,97,18,7":"204,97,18,7"},"4":{"224,38,19,9":"224,38,19,9"},"5":{"259,53,19,11":"259,53,19,11"},"6":{"473,114,22,10":"473,114,22,10"},"7":{"524,41,19,9":"524,41,19,9"},"7-1":{"504,93,22,10":"504,93,22,10"},"7-2":{"545,65,29,12":"545,65,29,12"},"7-3":{"558,229,26,11":"558,229,26,11"},"8":{"592,77,20,9":"592,77,20,9"},"9":{"607,139,21,10":"607,139,21,10"}}
					foreach($temp as $pos=>$v)
					{
						foreach($v as $vv)
						{
							$vv = explode(',', $vv);
							$arr['wz'][] = [(string)$pos, $vv[0].','.$vv[1].','.($vv[0]+$vv[2]).','.($vv[1]+$vv[3])];
						}
					}
				break;
				case 22:
					//params [["252","71","14","14","1"],["221","115","14","14","2"],["316","137","14","14","3"],["414","192","14","14","4"],["140","307","14","14","5"],["164","321","14","14","6"],["196","314","14","14","7"],["228","349","14","14","8"],["275","378","14","14","9"],["303","368","14","14","10"],["352","382","14","14","11"],["375","382","14","14","12"],["398","383","14","14","13"],["410","316","14","14","14"],["426","397","14","14","15"]]
					foreach($temp as $v)
					{
						$arr['wz'][] = [(string)$v[4], $v[0].','.$v[1].','.($v[0]+$v[2]).','.($v[1]+$v[3])];
					}
					/*foreach($temp as $pos=>$v)
					{
						foreach($v as $vv)
						{
							$vv = explode(',', $vv);
							$arr['wz'][] = [(string)$pos, $vv[0].','.$vv[1].','.($vv[0]+$vv[2]).','.($vv[1]+$vv[3])];
						}
					}*/
				break;
				case 23:
					//{"HB1": [["369", "298", "402", "313"]], "HN1": [["215", "450", "248", "465"]], "2454": [["484", "516", "525", "532"]], "2455": [["52", "11", "92", "27"]], "13480": [["415", "362", "463", "377"]], "2L523": [["248", "124", "297", "139"]]}
					foreach($temp as $pos=>$v)
					{
						foreach($v as $vv)
						{
							$arr['wz'][] = [(string)$pos, $vv[0].','.$vv[1].','.$vv[2].','.$vv[3]];
						}
					}
				break;
				//{"1": [["321", "410", "20", "20"]], "2": [["236", "204", "20", "20"]], "3": [["164", "269", "20", "20"]], "4": [["191", "350", "20", "20"]], "5": [["296", "335", "20", "20"]], "6": [["151", "361", "20", "20"], ["151", "361", "20", "20"]], "7": [["226", "302", "20", "20"]], "8": [["326", "366", "20", "20"]], "9": [["307", "255", "20", "20"]], "10": [["207", "137", "20", "20"]], "11": [["159", "477", "20", "20"]]}
				case 4:
					foreach($temp as $pos=>$v)
					{
						foreach($v as $vv)
						{
							$arr['wz'][] = [(string)$pos, $vv[0].','.$vv[1].','.($vv[0]+$vv[2]).','.($vv[1]+$vv[3])];
						}
					}
				break;
				//{"hotspots": [{"hsX": 325, "hsY": 40, "hsKey": "1", "hsGroup": [], "hsWidth": 120, "hsHeight": 110, "hsPartNo": "1"}, {"hsX": 1943, "hsY": 2399, "hsKey": "2", "hsGroup": [], "hsWidth": 134, "hsHeight": 111, "hsPartNo": "2"}, {"hsX": 365, "hsY": 2741, "hsKey": "3", "hsGroup": [], "hsWidth": 137, "hsHeight": 111, "hsPartNo": "3"}, {"hsX": 124, "hsY": 2744, "hsKey": "4", "hsGroup": ["4_1"], "hsWidth": 130, "hsHeight": 108, "hsPartNo": "4"}, {"hsX": 2218, "hsY": 2396, "hsKey": "4_1", "hsGroup": ["4"], "hsWidth": 128, "hsHeight": 110, "hsPartNo": "4"}], "imageWidth": 2386, "imageFormat": "image/png", "imageHeight": 2956, "maxScaleFactor": 1}
				case 24:
					if(!empty($temp['hotspots']))
					{
						foreach($temp['hotspots'] as $k=>$v)
						{
							$arr['wz'][] = [(string)$v['hsPartNo'], $v['hsX'].','.$v['hsY'].','.($v['hsX']+$v['hsWidth']).','.($v['hsY']+$v['hsHeight'])];
						}
					}
				break;
				//[{"key": "1565", "areas": [{"top": 1735, "left": 840, "descr": null, "width": 89, "height": 44}], "masks": [], "hotspotKeyLinks": []}, {"key": "1A189A", "areas": [{"top": 818, "left": 686, "descr": null, "width": 131, "height": 44}], "masks": [], "hotspotKeyLinks": []}, {"key": "1A189B", "areas": [{"top": 888, "left": 819, "descr": null, "width": 131, "height": 44}], "masks": [], "hotspotKeyLinks": []}, {"key": "1A189C", "areas": [{"top": 1259, "left": 707, "descr": null, "width": 131, "height": 44}], "masks": [], "hotspotKeyLinks": []}, {"key": "1A189D", "areas": [{"top": 1679, "left": 903, "descr": null, "width": 131, "height": 44}], "masks": [], "hotspotKeyLinks": []}, {"key": "15K602", "areas": [{"top": 1847, "left": 77, "descr": null, "width": 131, "height": 44}], "masks": [], "hotspotKeyLinks": []}, {"key": "1A189E", "areas": [{"top": 1350, "left": 896, "descr": null, "width": 131, "height": 44}], "masks": [], "hotspotKeyLinks": []}, {"key": "HM1", "areas": [{"top": 1819, "left": 700, "descr": null, "width": 69, "height": 44}], "masks": [], "hotspotKeyLinks": []}, {"key": "1A163", "areas": [{"top": 1091, "left": 1008, "descr": null, "width": 110, "height": 44}], "masks": [], "hotspotKeyLinks": []}, {"key": "1548", "areas": [{"top": 265, "left": 686, "descr": null, "width": 89, "height": 44}], "masks": [], "hotspotKeyLinks": []}]
				case 26:
					foreach($temp as $v)
					{
						foreach($v['areas'] as $vv)
						{
							$arr['wz'][] = [(string)$v['key'], $vv['left'].','.$vv['top'].','.($vv['left']+$vv['width']).','.($vv['top']+$vv['height'])];
						}
					}
				break;
				//[{"x": "959.7734", "y": "476.5645", "callout": "A01"}, {"x": "1095.2344", "y": "426.5645", "callout": "A02"}, {"x": "1182.7188", "y": "120.5786", "callout": "A03"}, {"x": "617.9956", "y": "492.5449", "callout": "A04"}, {"x": "932.8452", "y": "551.0566", "callout": "A00"}]
				case 29:
					
					foreach($temp as $v)
					{
						$v['x'] -= 10;
						$v['y'] -= 20;
						$width = 28*strlen($v['callout']);
						$height = 35;
						$arr['wz'][] = [(string) $v['callout'], $v['x'].','.$v['y'].','.($v['x']+$width).','.($v['y']+$height)];
					}
				break;
				//[{"hsX": 622, "hsY": 204, "maxX": 642, "maxY": 224, "hsKey": "1"}, {"hsX": 182, "hsY": 273, "maxX": 202, "maxY": 293, "hsKey": "2"}, {"hsX": 349, "hsY": 346, "maxX": 369, "maxY": 366, "hsKey": "3"}, {"hsX": 63, "hsY": 351, "maxX": 83, "maxY": 371, "hsKey": "4"}, {"hsX": 469, "hsY": 195, "maxX": 489, "maxY": 215, "hsKey": "5"}, {"hsX": 215, "hsY": 404, "maxX": 235, "maxY": 424, "hsKey": "6"}, {"hsX": 652, "hsY": 183, "maxX": 672, "maxY": 203, "hsKey": "7"}, {"hsX": 384, "hsY": 257, "maxX": 404, "maxY": 277, "hsKey": "8"}, {"hsX": 7, "hsY": 19, "maxX": 27, "maxY": 39, "hsKey": "1"}, {"hsX": 108, "hsY": 15, "maxX": 128, "maxY": 35, "hsKey": "2"}, {"hsX": 212, "hsY": 10, "maxX": 232, "maxY": 30, "hsKey": "3"}, {"hsX": 308, "hsY": 10, "maxX": 328, "maxY": 30, "hsKey": "4"}, {"hsX": 358, "hsY": 461, "maxX": 378, "maxY": 481, "hsKey": "5"}, {"hsX": 455, "hsY": 470, "maxX": 475, "maxY": 490, "hsKey": "6"}, {"hsX": 555, "hsY": 471, "maxX": 575, "maxY": 491, "hsKey": "7"}, {"hsX": 646, "hsY": 473, "maxX": 666, "maxY": 493, "hsKey": "8"}]
				case 32:
					foreach($temp as $v){
						if($v['hsX'] == $v['hsY']) continue;
						$v['hsX'] += 10;
						$v['maxX'] += 10;
						$arr['wz'][] = [(string)$v['hsKey'], $v['hsX'].','.$v['hsY'].','.$v['maxX'].','.$v['maxY']];
					}
				break;
			}
		}
		//是否有缩放比例
		if(isset($othArr['img_ratio']) && $othArr['img_ratio'] > 0 && $othArr['img_ratio'] != 1){
			foreach($arr['wz'] as $k=>$v){
				$tvs = explode(',', $v[1]);
				foreach($tvs as $kk=>$vv){
					$tvs[$kk] = round($vv*$othArr['img_ratio']);
				}
				$arr['wz'][$k][1] = implode(',', $tvs);
			}
		}
		return LibFc::ReturnData(true, $arr);
	}

	

	/**
	  * @method 获取查配件的配件信息
	  * @param  mod3Id 车型ID
	  * @author soul
	  * @copyright 2017/4/13
	  * @return 
	  {"status":true,"data":[{"base":{"part_id":"163","part_name":"刹车盘前"},"items":[{"factory":"OE","display":"9053332","para":[{"name":"用量","val":"2"},{"name":"说明","val":"256X24MM"}]}]},{"base":{"part_id":"164","part_name":"刹车盘\/毂后"},"items":[{"factory":"OE","display":"96549630","para":[{"name":"用量","val":"2"},{"name":"说明","val":"258X10.5MM"}]}]},{"base":{"part_id":"166","part_name":"刹车片前"},"items":[{"factory":"OE","display":"9007094","para":[{"name":"用量","val":"1"}]}]},{"base":{"part_id":"167","part_name":"刹车片\/鼓后"},"items":[{"factory":"OE","display":"96800089","para":[{"name":"用量","val":"1"}]}]},{"base":{"part_id":"42","part_name":"空气滤清器"},"items":[{"factory":"OE","display":"93730777","para":[{"name":"用量","val":"1"}]}]},{"base":{"part_id":"63","part_name":"机油滤清器"},"items":[{"factory":"OE","display":"92099013","para":[{"name":"用量","val":"1"}]}]},{"base":{"part_id":"354","part_name":"空调滤清器"},"items":[{"factory":"OE","display":"96554378","para":[{"name":"用量","val":"1"}]}]},{"base":{"part_id":"90","part_name":"汽油滤清器"},"items":[{"factory":"OE","display":"9075810","para":[{"name":"用量","val":"1"}]}]},{"base":{"part_id":"378","part_name":"柴油滤清器"},"items":[{"factory":"OE","display":"9075810","para":[{"name":"用量","val":"1"}]}]},{"base":{"part_id":"111","part_name":"火花塞"},"items":[{"factory":"OE","display":"9015257","para":[{"name":"用量","val":"4"}]}]},{"base":{"part_id":"282","part_name":"雨刮片"},"items":[{"factory":"OE","display":"26200942","para":[{"name":"用量","val":"1"},{"name":"说明","val":"左边"}]},{"factory":"OE","display":"9013301","para":[{"name":"用量","val":"1"},{"name":"说明","val":"右边"}]}]}],"code":0}
	  {"status":false,"data":'失败原因',"code":'error'}
	  */
	public function getCPJPartItem($mod3Id)
	{
		$mod3Id = (int) $mod3Id;
		$YpcBase = new YpcBase();
		$table = 'temp_chapeijian 
		join yp_part on pa_id=cat_part_id ';
		$where = sprintf(" and cat_m3_id=%d group by cat_from, pa_id, cat_oe_format order by pa_seq, cat_from desc", $mod3Id);
		$res = $YpcBase->Get($table, ['cat_from, pa_id as part_id, pa_name as part_name, cat_oe as oe, cat_remark as remark, cat_qty as qty'], $where);
		$arr = [];
		$tmp = [];
		foreach($res['data'] as $v)
		{
			if(!empty($tmp[$v['part_id']]) && $v['cat_from'] != $tmp[$v['part_id']]) continue;
		
			$arr[$v['part_id']]['base'] = ['part_id'=>$v['part_id'], 'part_name'=>$v['part_name'], 'part_img'=>mvc::$cfg['urls']['b2c'].'static/images/epcoth/'.$v['part_id'].'.jpg'];
			$item = ['factory'=>'OE', 'display'=>$v['oe']];
			if(!empty($v['remark'])) $item['para'][] = ['name'=>'说明', 'val'=>$v['remark']];
			if(!empty($v['qty'])) $item['para'][] = ['name'=>'用量', 'val'=>$v['qty']];
			$arr[$v['part_id']]['items'][] = $item;
			$tmp[$v['part_id']] = $v['cat_from'];
		}
		$arr = array_values($arr);
		return LibFc::ReturnData(true, $arr);
	}


	/**
	  * @method 搜索ETK产品
	  * @param  params [ep_partid=>'', 'word'=>''...]
	  * @author soul
	  * @copyright 2019/6/12
	  * @return 
		{"status":true,"data":[{"weizhi":"04466","pro_id":"31348","grp2_id":"6111","grp1_name":"传动系、底盘","grp2_name":"后盘式制动器卡钳和防尘罩","pro_name":"后盘式制动摩擦片组件","etk_id":8,"num":[{"factory":"OE","display":"04466-33200"}],"pic":["http:\/\/192.168.1.67\/EtkPicture\/EPC\/toyota\/GR1\/477\/800xX\/477982A.jpg"],"weizhi_name":"04466"}],"code":0}
	  */
	public function searchEtkItem($mod3Id, $params)
	{
		$arr = [];
		if($mod3Id < 1 || (empty($params['word']) && empty($params['ep_partid']))) return LibFc::ReturnData(true, $arr);
		$maxCount = 100;

		$YpcBase = new YpcBase();
		$res = $YpcBase->get('yp_model3_etk_code', ['distinct mec_code as mec_code'], sprintf(" and mec_m3_id=%d", $mod3Id));
		$etkCodeArr = array_column($res['data'], 'mec_code');
		//宝马特殊处理取vin 4~7位 2020/3/31
		if($this->EtkId == 2)
		{
			$res = $this->get('data_code', ['uid_id'], sprintf(" and uid_text in('%s') limit 1", implode("','", $etkCodeArr)));
			if(empty($res['data']))
			{
				foreach($etkCodeArr as $k=>$v)
				{
					$etkCodeArr[$k] = strlen($v) == 17? substr($v, 3, 4): $v;
				}
			}
		}

		if($this->EtkId == 8){
			$res = $YpcBase->get('yp_model3_modcode', ['distinct mem_code as mem_code'], sprintf(" and mem_m3_id=%d", $mod3Id));
			$etkCodeArr = array_merge($etkCodeArr, array_column($res['data'], 'mem_code'));
		}
		if(empty($etkCodeArr)) return LibFc::ReturnData(true, $arr);
		$codeArr = [];
		foreach($etkCodeArr as $v)
		{
			$codeArr[] = sprintf("'%s'", LibFc::Escape($v));
		}

		$epPartIdArr = [];
		if(!empty($params['ep_partid'])) $epPartIdArr = [(int) $params['ep_partid']];
		if(!empty($params['word']))
		{
			$YpcBase = new YpcBase();
			$res = $YpcBase->get('etk_part', ['distinct ep_partid'], sprintf(" and CONCAT(',',ep_keyword, ',') like '%%,%s,%%'", LibFc::Escape($params['word'])));
			$epPartIdArr = array_unique(array_merge($epPartIdArr, array_column($res['data'], 'ep_partid')));
		}

		//通过零件ID找出规则
		$regArr = [];
		if(!empty($epPartIdArr))
		{
			$res = $YpcBase->get('etk_part_toname', ['ept_ep_partid, ept_grp2_id, ept_word'], sprintf(" and ept_etk_id=%d and ept_ep_partid in (%s)",$this->EtkId, implode(',', $epPartIdArr)));
			foreach($res['data'] as $v)
			{
				$regArr[$v['ept_ep_partid']]['names'][] = $v;
			}
			$res = $YpcBase->get('etk_part_tonumber', ['epn_ep_partid, epn_number'], sprintf(" and epn_etk_id=%d and epn_ep_partid in (%s)", $this->EtkId, implode(',', $epPartIdArr)));
			foreach($res['data'] as $v)
			{
				$regArr[$v['epn_ep_partid']]['nums'][] = $v;
			}
		}
		
		$proIdArr = [];
		//有规则的优先规则查找
		if(!empty($regArr))
		{
			switch($this->EtkId)
			{
				case 8:
					$regWhere = $this->getEtkPartWhere($regArr, 'rem_id', 'lnk_name', 'pro_format');
					if(!empty($regWhere))
					{
						$regWhere .= sprintf(" and val_realoem in (%s) and lnk_pro_id > 0 group by lnk_pro_id ORDER BY pro_format limit %d", implode(',', $codeArr), $maxCount);
						$table ='data_links
						 join data_group_remark on lnk_rem_id=rem_id 
						 join data_group on grp_id = rem_grp_id
						 join data_value on val_id = grp_vin_id
						 join data_product on lnk_pro_id = pro_id';
						$res = $this->get($table, ['pro_id'], $regWhere);
						$proIdArr = array_column($res['data'], 'pro_id');
					}
				break;
			}
		}

		if(empty($proIdArr) && !empty($params['word']))
		{
			$wordIdArr = [];
			$wordArr = LibFc::keyword($params['word']);
			foreach($wordArr as $word)
			{
				$res = $this->get('kl_word', ['wo_id'], sprintf(" and wo_word like '%s%%'", LibFc::Escape($word)));
				if(!empty($res['data'])) $wordIdArr = array_merge($wordIdArr, array_column($res['data'], 'wo_id'));
			}
			if(!empty($wordIdArr))
			{
				$where = '';
				switch($this->EtkId)
				{
					case 7:
					case 11:
						//&etkId=7&mod3Id=2&word=拳式 制动管 支架
						$res = $this->get('data_parts join data_value on val_id = part_val_id', ['distinct part_id as grp2_id'], sprintf(" and val_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_part_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_product_links on pw_pro_id = lnk_pro_id';
					break;
					case 2 :
						//&etkId=2&mod3Id=7508&word=制动管 支架
						$res = $this->get('data_code JOIN data_links ON vpg_uid_id = uid_id JOIN data_partgrp ON vpg_prt_id = prt_id', ['distinct vpg_id as grp2_id'], sprintf(" and uid_text in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and pw_pro_id in(select row_pro_id from data_product_content where row_vpg_id in (%s)) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word';
					break;
					case 1 :
						//&etkId=1&mod3Id=3160&word=制动管 支架
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id JOIN data_links ON lnk_grp_id = grp_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_text in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links ON pw_pro_id = lnk_pro_id';
					break;
					case 5:
						//&etkId=5&mod3Id=1013&word=制动踏板
						$table = 'data_group_list
						JOIN data_group ON prt_id = list_prt_id
						JOIN data_value ON vin_id = prt_vin_id';
						$res = $this->get($table, ['distinct list_id as grp2_id'], sprintf(" and vin_name in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_list_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links ON pw_pro_id = lnk_pro_id';
					break;
					case 12:
					case 10:
						//&etkId=10&mod3Id=15279&word=拳式 制动 支架
						$res = $this->get('data_value join data_group on vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 13:
						//&etkId=13&mod3Id=10989&word=拳式 制动 支架
						$res = $this->get('data_value join data_group on vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_name in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 9:
						//&etkId=9&mod3Id=10490&word=拳式 制动 支架
						$res = $this->get('data_value JOIN data_group ON val_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and val_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 8:
						//&etkId=8&mod3Id=7599&word=拳式 制动 支架
						$res = $this->get('data_group_remark join data_group on grp_id = rem_grp_id join data_value on val_id = grp_vin_id', ['distinct rem_id as grp2_id'], sprintf(" and val_realoem in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_rem_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 14:
						//&etkId=14&mod3Id=11943&word=拳式 制动 支架
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 15:
						//&etkId=15&mod3Id=12806&word=拳式%20制动%20支架
						$res = $this->get('data_value JOIN data_group ON val_id = grp_val_id join data_group_list on lst_grp_id=grp_id', ['distinct lst_id as grp2_id'], sprintf(" and val_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_lst_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_product_links on pw_pro_id = lnk_pro_id';
					break;
					case 4:
						//&etkId=4&mod3Id=3662&word=拳式%20制动%20支架
						$res = $this->get('data_group join data_value ON vin_id = prt_vin_id', ['distinct prt_id as grp2_id'], sprintf(" and vin_name in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and ppm_pmg_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = ppm_pro_id';
					break;
					case 16:
						//&etkId=16&mod3Id=13108&word=拳式%20制动%20支架
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 3:
						//&etkId=3&mod3Id=2092&word=拳式%20制动%20支架
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id JOIN data_part ON prt_grp_id=grp_id', ['distinct prt_id as grp2_id'], sprintf(" and prt_have = 1 and vin_name in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_prt_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 17:
						//&etkId=17&mod3Id=13365&word=拳式%20制动%20支架
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_name in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 18:
						//&etkId=18&mod3Id=18004&word=拳式%20制动%20支架
						$res = $this->get('data_value JOIN data_parts ON vin_id = prt_vin_id', ['distinct prt_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_prt_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 19:
						//&etkId=19&mod3Id=2419&word=拳式%20制动%20支架
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lng_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 20:
						//&etkId=20&mod3Id=13840&word=BRAKE
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 21:
						//&etkId=21&mod3Id=8313&word=前制动管路装置
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 22:
						//&etkId=22&mod3Id=3407&word=前制动管路装置
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 23:
						//&etkId=23&mod3Id=1450&word=前制动管路装置
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 24:
						//&etkId=24&mod3Id=9476&word=制动器制动盘
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 26:
						//&etkId=26&mod3Id=10699&word=制动器制动盘
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 28:
						//&etkId=28&18852=9476&word=制动器制动盘
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 29:
						//&etkId=29&18852=25807&word=制动器制动盘
						$res = $this->get('data_value JOIN data_group ON vin_id = grp_vin_id', ['distinct grp_id as grp2_id'], sprintf(" and vin_value in (%s)", implode(',', $codeArr) ) );
						if(empty($res['data'])) break;
						$grp2IdArr = array_column($res['data'], 'grp2_id');
						$where = sprintf(" and lnk_grp_id in (%s) and pw_wo_id in (%s) group by pw_pro_id order by wcount desc, pw_pro_id limit %d", 
							implode(',', $grp2IdArr), implode(',', $wordIdArr), $maxCount);
						$table = 'kl_product_word join data_links on pw_pro_id = lnk_pro_id';
					break;
					case 32:
						//&etkId=32&mod3Id=219105&word=加机油口盖
						$twhere = sprintf(" and vin_text in (%s) and pw_wo_id in (%s)", implode(',', $codeArr), implode(',', $wordIdArr));
						$table = sprintf("(SELECT pw_pro_id, pw_wo_id, CONCAT('3', sub_id) AS grp2_id FROM data_product
						JOIN data_part AS b ON prt_pro_id = pro_id
						JOIN data_subs ON prt_data_id = sub_id AND prt_type='sub'
						JOIN data_group ON sub_grp_id = grp_id
						JOIN kl_product_word ON pw_pro_id = prt_pro_id
						JOIN vin ON vin_id = grp_vin_id where 1 %s
						UNION ALL
						SELECT pw_pro_id, pw_wo_id, CONCAT('2', str_id) AS grp2_id FROM data_product
						JOIN data_part AS b ON prt_pro_id = pro_id
						JOIN data_structure ON prt_data_id = str_id AND prt_type='str'
						JOIN data_group ON str_grp_id = grp_id
						JOIN kl_product_word ON pw_pro_id = prt_pro_id
						JOIN vin ON vin_id = grp_vin_id where 1 %s) t", $twhere, $twhere);
						$where = sprintf(" group by pw_pro_id order by wcount desc, pw_pro_id limit %d", $maxCount);
						$prores = $this->get($table, ['pw_pro_id as pro_id', 'count(distinct pw_wo_id) as wcount', 'grp2_id'], $where);
						if(empty($prores['data'])) break;
						$grp2IdArr = array_column($prores['data'], 'grp2_id');
					break;
				}
				if(!empty($where) && !isset($prores))
					$prores = $this->get($table, ['pw_pro_id as pro_id', 'count(distinct pw_wo_id) as wcount'], $where);
				//按照关键字数量筛选配件ID
				if(!empty($prores['data']))
				{
					$last = null;
					foreach($prores['data'] as $pv)
					{
						if($last !== null && $last != $pv['wcount']) break;
						$last = $pv['wcount'];
						$proIdArr[] = $pv['pro_id'];
					}
				}
			}
		}
		if(!empty($proIdArr))
		{
			$res = $this->getAnyItemBase($proIdArr, $grp2IdArr);
			$arr = $res['data'];

			foreach($arr as $k=>$v)
			{
				$arr[$k]['etk_id'] = $this->EtkId;
			}
		}
		return LibFc::ReturnData(true, $arr);
	}

	//通过规则查找
	private function getEtkPartWhere($regArr, $grp2Id, $wordFiled, $numFiled)
	{
		$where = '';
		if(!empty($regArr))
		{
			$w0 = [];
			foreach($regArr as $reg)
			{
				$wp = [];
				if(!empty($reg['names']))
				{
					$wn = [];
					foreach($reg['names'] as $nv)
					{
						$wnt = [];
						if($nv['ept_grp2_id'] > 0) $wnt[] = sprintf(" %s=%d", $grp2Id, $nv['ept_grp2_id']);
						if(!empty($nv['ept_word'])) $wnt[] = stripos($nv['ept_word'], '%') !== false? sprintf(" %s like '%s'", $wordFiled, $nv['ept_word']):  sprintf(" %s ='%s'", $wordFiled, $nv['ept_word']);
						$wn[] = count($wnt) > 1 ? '('.implode(' and ', $wnt).')': $wnt[0];
					}
					$wp[] = count($wn) > 1 ? '('.implode(' OR ', $wn).')': $wn[0];
				}

				if(!empty($reg['nums']))
				{
					$wn = [];
					foreach($reg['nums'] as $nv)
					{
						$wn[] = sprintf(" %s like '%s'", $numFiled, $nv['epn_number']);
					}
					$wp[] = count($wn) > 1 ? '('.implode(' OR ', $wn).')': $wn[0];
				}
				$w0[] = count($wp) > 1 ? '('.implode(' AND ', $wp).')': $wp[0];
			}
			$where = sprintf(" and (%s)", implode(' or ', $w0), $numFiled);
		}
		return $where;
	}
}