lvhao 5 hónapja
szülő
commit
0f4642d323

+ 11 - 0
core/CoreApp/controllers/Aatest.php

@@ -53,6 +53,8 @@ class Aatest extends Start_Controller {
 		 $this->load->_model('Model_returnlogs','returnlogs');
 		 $this->load->_model('Model_productdescribe','productdescribe');
 
+		 $this->load->_model('Model_logic_u9tools','logic_u9tools');
+
     }
 
     //定义方法的调用规则 获取URI第二段值
@@ -179,6 +181,15 @@ class Aatest extends Start_Controller {
 		];
 	}
     public function _a($arg_array){
+		$list = [
+			[
+				'sku'=>'-128-80-89-57-106-341-30-72-',
+			],
+			[
+				'sku'=>'-128-80-88-57-2248-2096-30-72-2071-1645-',
+			]
+		];
+		$this->logic_u9tools->getU9bm($list);
 		die;
 		$data = $this->getDtc();
 		$dtc = $data['dtc'];

+ 3 - 3
core/CoreApp/controllers/Ac.php

@@ -222,10 +222,10 @@ class Ac extends Start_Controller {
 // 		$b  = $this->cne->get_data($fullorder);
 		//$b = $this->fedexv1->get_data($fullorder);
 		//echo $fullorder['zzl'];
-		$b = $this->usps->get_data($fullorder);
+		//$b = $this->usps->get_data($fullorder);
 	
-		echo "<pre>";
-		print_r($b);
+		// echo "<pre>";
+		// print_r($b);
 	}
 	
 	public function get_data($data)

+ 102 - 0
core/CoreApp/models/Model_logic_u9tools.php

@@ -0,0 +1,102 @@
+<?php
+/**
+ * 封装一些转化为u9数据的操作
+ */
+class Model_logic_u9tools extends Lin_Model {
+    function __construct(){
+        parent::__construct();
+        $this->load->_model('Model_classid','classid');
+        $this->load->_model('Model_typeclass','typeclass');
+    }
+    //获取u9的料号
+    public function getU9bm(array $list){
+        if(empty($list)){
+            return [];
+        }
+        $tcjm = [];  $typeclass = [];
+        $classid = $this->classid->sku();
+        $tcall = $this->typeclass->find_all();
+        foreach ($tcall as $v)
+        {
+            $tcjm[$v['id']] = array($v['jm'],$v['classid']);
+            $typeclass[$v['id']] = array('zh'=>$v['zh'],'classid'=>$v['classid'],'bm'=>$v['bm'],'title'=>$v['title'],'jm'=>$v['jm']);
+        }
+        echo "<pre>";
+        foreach($list as $k=>$v){
+            $r = $this->getOneU9bm($v['sku'],$classid,$typeclass);
+            var_dump($r);
+            var_dump($r);
+        }
+        return $list;
+    }
+
+    public function getOneU9bm($sku,$classid,$typeclass){
+        $bm = '03';
+        $ret_arr = [
+            'jm'=>"",//料号,SKU
+            'zh'=>"",//产品名称
+            'bm'=>"",//主分类下的编码
+        ];
+        if(stripos($sku,'-131-') !== false)
+        {
+            return $ret_arr;
+        }
+        $pm = $classid;
+        $jm = $classid;
+        $bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
+        $features = str_replace(array('-163-','-164-','-165-','-166-'),'-',$sku);
+        $features = explode("-",trim($sku,'-'));
+        foreach($features as $k=>$v)
+        {
+            if(isset($typeclass[$v]) && isset($bmpx[$typeclass[$v]['classid']]))
+            {
+                if($typeclass[$v]['bm'] != '')
+                {
+                    $bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
+                
+                }
+            }
+            if($v != 0)
+            {
+                if(isset($pm[$typeclass[$v]['classid']]))
+                {
+                    if($typeclass[$v]['title'] == '9A')
+                    {
+                        $pm[$typeclass[$v]['classid']] = '9A';
+                    }
+                    else if($typeclass[$v]['title'] == '10A')
+                    {
+                        $pm[$typeclass[$v]['classid']] = '10A';
+                    }
+                    else
+                    {
+                        $clzh = $typeclass[$v]['zh'];
+                        if(stripos($typeclass[$v]['zh'],'|') !== false)
+                        {
+                            $clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
+                            $clzh = $clzh[0];
+                        }
+                        $pm[$typeclass[$v]['classid']] = $clzh;
+                    }
+                }
+                if(isset($jm[$typeclass[$v]['classid']]))
+                {
+                    if($typeclass[$v]['jm'])
+                    {
+                        $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
+                    }
+                }
+            }
+        }
+        $jm = array_filter($jm);//去除空值
+        $jm = implode("-",$jm);
+        $pm = array_filter($pm);//去除空值
+        $zh = implode(" ",$pm);
+        $zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
+        return [
+            'jm'=>$jm,//料号,SKU
+            'zh'=>$zh,//产品名称
+            'bm'=>$bm.implode("",$bmpx),//主分类下的编码
+        ];
+    }
+}