lvhao 23 годин тому
батько
коміт
fed5c79adb
1 змінених файлів з 117 додано та 6 видалено
  1. 117 6
      core/CoreApp/controllers/Whlabelfz.php

+ 117 - 6
core/CoreApp/controllers/Whlabelfz.php

@@ -556,7 +556,7 @@ class Whlabelfz extends Start_Controller
 		$classid = $this->classid->sku();
 		
 		foreach($params as $k => $v){
-			$r = $this->_transferForm($v['0'],$v,$warehouse_list,$purchase_list,$classid);
+			$r = $this->_transferForm($v['0'],$v,$warehouse_list,$purchase_list,$classid,$k);
 			if($r['code'] != 1){
 				$error_list[] = [
 					'sku'=>$v['0'],
@@ -572,7 +572,7 @@ class Whlabelfz extends Start_Controller
 	/**
 	 * 将数据转化为 批量打印标签需要data格式
 	 */
-	private function _transferForm($tmsku,$info,$warehouse_list,$purchase_list,$classid){
+	private function _transferForm($tmsku,$info,$warehouse_list,$purchase_list,$classid,$i){
 		if (is_numeric($tmsku)) {
 			$yyh = $this->whlabellabel->get_label($tmsku);
 		} else {
@@ -602,14 +602,125 @@ class Whlabelfz extends Start_Controller
 		$warehouse = isset($warehouse_list[$info['3']])?$warehouse_list[$info['3']]:1;
 		$insert_arr['warehouse'] = $warehouse;
 		$insert_arr['cpbz'] = '';
-		
-		$size = $res['data']['size'];
-		unset($res['data']['size']);
+		$post = $res['data'];
+		$list = [];
+		$category = $post['category'];
+		$list['category'] = $category;
+		$list['hairtype'] = empty($post['hairtype'])?'':$post['hairtype'];
+		$list['grade'] = empty($post['grade'])?'':$post['grade'];
+		$list['size'] = empty($post['size'])?'':$post['size'];
+		$list['hairnumber'] = empty($post['hairnumber'])?'':$post['hairnumber'];
+		$list['extension'] = empty($post['extension'])?'':$post['extension'];
 
 
-		
+
+		if ($category == 1297) {
+			$list['sywignumber'] = empty($post['sywignumber'])?'':$post['sywignumber'];
+		}
+		if ($category == 1702) {
+			$list['syhairnumber'] = empty($post['syhairnumber'])?'':$post['syhairnumber'];
+			$list['syother'] = empty($post['syother'])?'':$post['syother'];
+		}
+		if ($category == 133) {
+			$list['fittype'] = empty($post['fittype'])?'':$post['fittype'];
+			$list['acother'] = empty($post['acother'])?'':$post['acother'];
+		}
+		$list['color'] = empty($post['color'])?'':$post['color'];
+		$list['lowe'] = empty($post['lowe'])?'':$post['lowe'];
+
+		if ($category == 127) {
+			$list['type'] = empty($post['type'])?'':$post['type'];
+			$list['headroad'] = empty($post['headroad'])?'':$post['headroad'];
+			$list['density'] =empty($post['density'])?'':$post['density'];
+			if ($list['type'] == 195 || $list['type'] == 197 || $list['type'] == 199) {
+				$list['lacesize'] = empty($post['lacesize'])?'':$post['lacesize'];
+			}
+			$list['lacecolor'] = empty($post['lacecolor'])?'':$post['lacecolor'];
+			$list['lacetypes'] = empty($post['lacetypes'])?'':$post['lacetypes'];
+		}
+		if ($category == 128) {
+			$list['lacetype'] =empty($post['lacetype'])?'':$post['lacetype'];
+			$list['haircap'] = empty($post['haircap'])?'':$post['haircap'];
+			$list['density'] = empty($post['density'])?'':$post['density'];
+			$list['lacecolor'] = empty($post['lacecolor'])?'':$post['lacecolor'];
+			$list['lacetypes'] = empty($post['lacetypes'])?'':$post['lacetypes'];
+			$list['wigother'] = empty($post['wigother'])?'':$post['wigother'];
+			$list['wigother1'] = empty($post['wigother1'])?'':$post['wigother1'];
+			$list['wigother2'] = empty($post['wigother2'])?'':$post['wigother2'];
+		}
+		if ($category == 129) {
+			$list['wide'] = empty($post['wide'])?'':$post['wide'];
+		}
+
+		if ($category == 131) {
+			$list['gifttype'] = empty($post['gifttype'])?'':$post['gifttype'];
+			$list['giftother'] = empty($post['giftother'])?'':$post['giftother'];
+		}
+
+		if ($category == 134) {
+			$list['pieceweight'] = empty($post['pieceweight'])?'':$post['pieceweight'];
+		}
+		if ($category == 1297) {
+			$list['synthetictype'] = empty($post['synthetictype'])?'':$post['synthetictype'];
+			$list['sywigother'] = empty($post['sywigother'])?'':$post['sywigother'];
+		}
+		if ($category == 130 || $category == 133 || $category == 1702) {
+			$list['items'] = empty($post['items'])?'':$post['items'];
+			$list['weight'] = empty($post['weight'])?'':$post['weight'];
+		}
+		if ($category == 1702) {
+			$list['syhairther'] = empty($post['syhairther'])?'':$post['syhairther'];
+		}
+		$pm =  $scsku = $classid;
+		$number = $features = "";
+		foreach ($list as $k => $v) {
+			if ($v != 0) {
+				$number .= $v;
+				$features .= $v . '-';
+				$typeclass = $this->typeclass->read($v);
+				if (isset($pm[$typeclass['classid']])) {
+					if (stripos($typeclass['zh'], '|') !== false) {
+						$exzh = explode('|', $typeclass['zh']);
+						$pm[$typeclass['classid']] = $exzh[0];
+					} else {
+						$pm[$typeclass['classid']] = $typeclass['zh'];
+					}
+				}
+				$scsku[$typeclass['classid']] = $typeclass['bqsku'];
+				if ($k != 'size') {
+					$title .= $typeclass['title'] . " ";
+				}
+			}
+		}
+		$typeclass = $this->typeclass->read($list['size']);
+		$title .= $typeclass['title'];
+		$time = time();
+		$insert_arr['title'] = rtrim($title, ' ');
+		$insert_arr['number'] = $num;
+		$insert_arr['features'] = rtrim($features, '-');
+
+		$featurespp = str_replace(array('-163-', '-164-', '-165-', '-166-'), '-', $features);
+		$featurespp = explode('-', trim($featurespp, '-'));
+		if (isset($featurespp[5])) {
+			$insert_arr['featurespp'] = $featurespp[0] . '-' . $featurespp[3] . '-' . $featurespp[4] . '-' . $featurespp[5];
+		} else {
+			$insert_arr['featurespp'] = $featurespp[0] . '-' . $featurespp[3] . '-' . $featurespp[4];
+		}
+		$insert_arr['time'] = $time;
+
 		$insert_arr['dynum'] = $info['1'];
 		$title = $features = "";
+		$scsku = implode("-", $scsku);
+		$zh = implode(" ", $pm);
+		$scsku = str_replace('- ', '-', trim($scsku, '-'));
+		$scsku = str_replace(array('--------', '-------', '------', '-----', '----', '---', '--'), '-', $scsku);
+		$bqsku =  $scsku;;
+		$insert_arr['sku'] = $bqsku;
+		$label = time() . rand(0, 9).$i;
+		$insert_arr['label'] = $label;
+		echo "<pre>";
+		print_r($insert_arr);
+		die;
 	}
 
 	private function _bqplprint(){