Ver Fonte

修改数据

lvhao há 1 dia atrás
pai
commit
5644b073fd

+ 70 - 18
core/CoreApp/controllers/Whlabelfz.php

@@ -521,43 +521,95 @@ class Whlabelfz extends Start_Controller
 		$this->_Template('whlabelfz_bqpl', $this->data);
 	}
 
+	private function _getShop($str){
+		$str = trim($str);
+		if($str == '无'){
+			return '';
+		}else{
+			$str = strtolower($str);
+			if($str =='alipearl'){
+				return 1;
+			}elseif($str == 'supernova'){
+				return 2;
+			}elseif($str == 'asteriahair'){
+				return 3;
+			}elseif($str == 'westkiss'){
+				return 4;
+			}elseif($str == 'yolissahair'){
+				return 5;
+			}elseif($str == 'wiggins'){
+				return 6;
+			}
+		}
+	}
 	private function _bqpladd(){
 		$params = $this->input->post('data',true);
 		$params = json_decode($params,true);
+		$list = [];
+		$error_list= [];
+
+		$warehouse_list = $this->warehouse->find_all("1 = 1","id,title");
+		$warehouse_list = array_column($warehouse_list,'id','title');
+		
+		$purchase_list = $this->purchase->find_all("1 = 1","id,title");
+		$purchase_list = array_column($purchase_list,'id','title');
+		$classid = $this->classid->sku();
+		
 		foreach($params as $k => $v){
-			$r = $this->_transferForm($v['0']);
+			$r = $this->_transferForm($v['0'],$v,$warehouse_list,$purchase_list,$classid);
+			if($r['code'] != 1){
+				$error_list[] = [
+					'sku'=>$v['0'],
+					'msg'=>$r['msg']
+				];
+			}else{
+				$list[] = [
+					'shop'=>'',
+				];
+			}
 		}
 	}
 	/**
 	 * 将数据转化为 批量打印标签需要data格式
 	 */
-	private function _transferForm($tmsku){
+	private function _transferForm($tmsku,$info,$warehouse_list,$purchase_list,$classid){
 		if (is_numeric($tmsku)) {
 			$yyh = $this->whlabellabel->get_label($tmsku);
 		} else {
 			$yyh = $this->whlabellabel->get_sku($tmsku);
-			if(empty($yyh)){
-				$r = $this->logic_u9tools->getErpSkuByU9Lp($tmsku);
-				if($r['code'] == -1 ){
-					return ['code'=>-1,'msg'=>"未找到对应的料品"];
-				}else{
-					$yyh = [];
-					$yyh['features'] = $r['data'];
-				}
-			}
 		}
-		if(empty($yyh)){
+		if(!empty($yyh)){
+			return ['code'=>1,'msg'=>"获取标签",'data'=>$yyh];
+		}
+		$r = $this->logic_u9tools->getErpSkuByU9Lp($tmsku);
+		if($r['code'] == -1 ){
 			return ['code'=>-1,'msg'=>"未找到对应的料品"];
 		}
-		$str = $yyh['features'];
-
+		$str = $r['data'];
 		$arr = explode("-",trim($str,"-"));
 		$data = $this->logic_zhlp->transferSku($arr);
-		$res = $this->logic_zhlp->sortByName($data);
-		echo "<pre>";
-		print_r($res);
-		die;
+		$res = $this->logic_zhlp->ortByColume($data);
+
+		if($res['code'] == -1){
+			return $res;
+		}
+		$insert_arr = [];
+		$insert_arr['sku_master_id']= $insert_arr['sku_shop_id'] =0;
+		$insert_arr['status'] = 0; 
+		$insert_arr['shop'] = '';
+		$purchase = isset($purchase_list[$info['2']])?$purchase_list[$info['2']]:1;
+		$insert_arr['purchase'] = $purchase;
+		$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']);
+
+
 		
+		$insert_arr['dynum'] = $info['1'];
+		$title = $features = "";
 	}
 
 	private function _bqplprint(){

+ 113 - 0
core/CoreApp/models/Model_logic_zhlp.php

@@ -18,6 +18,10 @@ class Model_logic_zhlp extends Lin_Model {
     public function sortByClass($arr){
         return $this->doAction(2,$arr);
     }
+    //只有id  然后转化为字段名 + 值
+    public function sortByColume($arr){
+        return $this->doAction(3,$arr);
+    }
     //根据已有的规格id 获取到对应主类id  转化为需要的规格序列
     public function transferSku($arr){
         $sku_list = $this->db->select('id,classid,classtitle,title')->from('typeclass')->where_in('id ',$arr)->get()->result_array();
@@ -35,6 +39,10 @@ class Model_logic_zhlp extends Lin_Model {
             if(isset($arr['hairtype']) && in_array($arr['hairtype'],[163,164,165,166])){
                 $arr['hairtype'] = 0;
             }
+        }elseif($type == 3){
+            if(isset($arr[22]) && in_array($arr[22],[163,164,165,166])){
+                $arr[22] = 0;
+            }
         }else{
             if(isset($arr[22]) && in_array($arr[22],[163,164,165,166])){
                 $arr[22] = 0;
@@ -64,6 +72,8 @@ class Model_logic_zhlp extends Lin_Model {
     private function chooseCate($type,$arr){
         if($type == 1){
             $cate = $arr['category'];
+        }elseif($type == 3){
+            $cate = $arr[16];
         }else{
             $cate = $arr[16];
         }
@@ -115,6 +125,15 @@ class Model_logic_zhlp extends Lin_Model {
                 "lowe"=>empty($arr['lowe'])?0:$arr['lowe'],
                 "size"=>empty($arr['size'])?0:$arr['size'],
             ];
+        }elseif($type == 3){
+            return [
+                "category"=>empty($arr[16])?0:$arr[16],//类目
+                "hairtype"=>empty($arr[22])?0:$arr[22],//真人发类型
+                "grade"=>empty($arr[13])?0:$arr[13],//等 级
+                "color"=>empty($arr[8])?0:$arr[8],//头发颜色
+                "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
+                "size"=>empty($arr[14])?0:$arr[14],//长 度
+            ];
         }else{
             return [
                 16=>empty($arr[16])?0:$arr[16],//类目
@@ -146,6 +165,29 @@ class Model_logic_zhlp extends Lin_Model {
                 "lacetypes"=>empty($arr['lacetypes'])?0:$arr['lacetypes'],
                 "size"=>empty($arr['size'])?0:$arr['size'],
             ];
+        }elseif($type == 3){
+            $lacesize = 0;
+            if(!empty($arr[25])){
+                $lacesize = $arr[25];
+            }
+            if(!empty($arr[26])){
+                $lacesize = $arr[26];
+            }
+            return [
+                "category"=>empty($arr[16])?0:$arr[16],//类目
+                "hairtype"=>empty($arr[22])?0:$arr[22],//真人发类型
+                "grade"=>empty($arr[13])?0:$arr[13],//等 级
+                "color"=>empty($arr[8])?0:$arr[8],//头发颜色
+                "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
+                "type"=>empty($arr[27])?0:$arr[27],//类 型
+                "headroad"=>empty($arr[12])?0:$arr[12],//头路设计
+                "density"=>empty($arr[10])?0:$arr[10],//密 度
+                //到时间会去重处理
+                'lacesize'=> $lacesize,
+                'lacecolor'=>empty($arr[9])?0:$arr[9],//蕾丝颜色
+                "lacetypes"=>empty($arr[44])?0:$arr[44],//蕾丝类型
+                "size"=>empty($arr[14])?0:$arr[14],//长 度
+            ];
         }else{
             return [
                 16=>empty($arr[16])?0:$arr[16],//类目
@@ -187,6 +229,24 @@ class Model_logic_zhlp extends Lin_Model {
                 "wigother2"=>empty($arr['wigother2'])?0:$arr['wigother2'],
                 "size"=>empty($arr['size'])?0:$arr['size'],
             ];
+        }elseif($type == 3){
+            return [
+                "category"=>empty($arr[16])?0:$arr[16],//类目
+                "hairtype"=>empty($arr[22])?0:$arr[22],//真人发类型
+                "grade"=>empty($arr[13])?0:$arr[13],//等 级
+                "hairnumber"=>empty($arr[43])?0:$arr[43],//人发头套编号
+                "color"=>empty($arr[8])?0:$arr[8],//头发颜色
+                "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
+                "lacetype"=>empty($arr[18])?0:$arr[18],//头套种类
+                "haircap"=>empty($arr[6])?0:$arr[6],//发帽大小
+                "density"=>empty($arr[10])?0:$arr[10],//密 度
+                "lacecolor"=>empty($arr[9])?0:$arr[9],//蕾丝颜色
+                "lacetypes"=>empty($arr[44])?0:$arr[44],//蕾丝类型
+                "wigother"=>empty($arr[39])?0:$arr[39],//分缝及刘海
+                "wigother1"=>empty($arr[50])?0:$arr[50],//头套其它1
+                "wigother2"=>empty($arr[51])?0:$arr[51],//头套其它2
+                "size"=>empty($arr[14])?0:$arr[14],//长 度
+            ];
         }else{
             return [
                 16=>empty($arr[16])?0:$arr[16],//类目
@@ -221,6 +281,18 @@ class Model_logic_zhlp extends Lin_Model {
                 "weight"=>empty($arr['weight'])?0:$arr['weight'],
                 "size"=>empty($arr['size'])?0:$arr['size'],
             ];
+        }elseif($type == 3){
+            return [
+                "category"=>empty($arr[16])?0:$arr[16],//类目
+                "hairtype"=>empty($arr[22])?0:$arr[22],//真人发类型
+                "grade"=>empty($arr[13])?0:$arr[13],//等 级
+                "extension"=>empty($arr[33])?0:$arr[33],//Extension类型
+                "color"=>empty($arr[8])?0:$arr[8],//头发颜色
+                "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
+                "items"=>empty($arr[38])?0:$arr[38],//单片片数
+                "weight"=>empty($arr[7])?0:$arr[7],//重量
+                "size"=>empty($arr[14])?0:$arr[14],//长 度
+            ];
         }else{
             return [
                 16=>empty($arr[16])?0:$arr[16],//类目
@@ -243,6 +315,12 @@ class Model_logic_zhlp extends Lin_Model {
                 "gifttype"=>empty($arr['gifttype'])?0:$arr['gifttype'],
                 "giftother"=>empty($arr['giftother'])?0:$arr['giftother'],
             ];
+        }elseif($type == 3){
+            return [
+                "category"=>empty($arr[16])?0:$arr[16],//类目
+                "gifttype"=>empty($arr[34])?0:$arr[34],//礼物类型
+                "giftother"=>empty($arr[49])?0:$arr[49],//礼物其它
+            ];
         }else{
             return [
                 16=>empty($arr[16])?0:$arr[16],//类目
@@ -266,6 +344,18 @@ class Model_logic_zhlp extends Lin_Model {
                 "weight"=>empty($arr['weight'])?0:$arr['weight'],
                 'size'=>empty($arr['size'])?0:$arr['size'],
             ];
+        }elseif($type == 3){
+            return [
+                "category"=>empty($arr[16])?0:$arr[16],//类目
+                "grade"=>empty($arr[13])?0:$arr[13],//等 级
+                "fittype"=>empty($arr[35])?0:$arr[35],//配件类型
+                "acother"=>empty($arr[45])?0:$arr[45],//配件其它
+                "color"=>empty($arr[8])?0:$arr[8],//头发颜色
+                "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
+                "items"=>empty($arr[38])?0:$arr[38],//单片片数
+                "weight"=>empty($arr[7])?0:$arr[7],//重量
+                'size'=>empty($arr[14])?0:$arr[14],//长 度
+            ];
         }else{
             return [
                 16=>empty($arr[16])?0:$arr[16],//类目
@@ -294,6 +384,17 @@ class Model_logic_zhlp extends Lin_Model {
                 "sywigother"=>empty($arr['sywigother'])?0:$arr['sywigother'],
                 "size"=>empty($arr['size'])?0:$arr['size'],
             ];
+        }elseif($type == 3){
+            return [
+                "category"=>empty($arr[16])?0:$arr[16],//类目
+                "grade"=>empty($arr[13])?0:$arr[13],//等 级
+                "sywignumber"=>empty($arr[40])?0:$arr[40],//化纤头套编号
+                "color"=>empty($arr[8])?0:$arr[8],//头发颜色
+                "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
+                "synthetictype"=>empty($arr[41])?0:$arr[41],//化纤头套类型
+                "sywigother"=>empty($arr[42])?0:$arr[42],//化纤头套其它
+                "size"=>empty($arr[14])?0:$arr[14],//长 度
+            ];
         }else{
             return [
                 16=>empty($arr[16])?0:$arr[16],//类目
@@ -322,6 +423,18 @@ class Model_logic_zhlp extends Lin_Model {
                 "syother"=>empty($arr['syother'])?0:$arr['syother'],
                 "size"=>empty($arr['size'])?0:$arr['size'],
             ];
+        }elseif($type == 3){
+            return [
+                "category"=>empty($arr[16])?0:$arr[16],//类目
+                "grade"=>empty($arr[13])?0:$arr[13],//等 级
+                "sywignumber"=>empty($arr[47])?0:$arr[47],//化纤发编号
+                "syother"=>empty($arr[46])?0:$arr[46],//化纤其它分类
+                "color"=>empty($arr[8])?0:$arr[8],//头发颜色
+                "lowe"=>empty($arr[15])?0:$arr[15],//曲 度
+                "items"=>empty($arr[38])?0:$arr[38],//单包片数
+                "syother"=>empty($arr[48])?0:$arr[48],//化纤发其它
+                "size"=>empty($arr[14])?0:$arr[14],//长 度
+            ];
         }else{
             return [
                 16=>empty($arr[16])?0:$arr[16],//类目