|
@@ -7,6 +7,7 @@ class Model_logic_u9tools extends Lin_Model {
|
|
parent::__construct();
|
|
parent::__construct();
|
|
$this->load->_model('Model_classid','classid');
|
|
$this->load->_model('Model_classid','classid');
|
|
$this->load->_model('Model_typeclass','typeclass');
|
|
$this->load->_model('Model_typeclass','typeclass');
|
|
|
|
+ $this->load->_model("Model_logic_tools",'logic_tools');
|
|
}
|
|
}
|
|
//获取u9的料号
|
|
//获取u9的料号
|
|
public function getU9bm(array $list,$sku_name){
|
|
public function getU9bm(array $list,$sku_name){
|
|
@@ -100,4 +101,286 @@ class Model_logic_u9tools extends Lin_Model {
|
|
'bm'=>$bm.implode("",$bmpx),//主分类下的编码
|
|
'bm'=>$bm.implode("",$bmpx),//主分类下的编码
|
|
];
|
|
];
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * 通过erp的组合出来的sku反推出erp的sku的id组合和u9的编码以及中文名和料品 这种仅限于满足老代码排序的那种 要是不满足 再重新开一个方法吧
|
|
|
|
+ */
|
|
|
|
+ public function getGoodInfoByErpSku($category,$sku,$typeclass,$typeclassid,$classid){
|
|
|
|
+ $sku_arr = explode("-",trim($sku,"-"));
|
|
|
|
+ $sku_list = [];
|
|
|
|
+ $flag = false;
|
|
|
|
+ $err_msg = "";
|
|
|
|
+ foreach($sku_arr as $v){
|
|
|
|
+ if(!isset($typeclass[$v])){
|
|
|
|
+ $err_msg="u9组合简码不存在,请核对";
|
|
|
|
+ $flag = true;
|
|
|
|
+ }else{
|
|
|
|
+ $sku_list[$typeclass[$v]['classid']] = $typeclass[$v];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if($flag){
|
|
|
|
+ return $this->logic_tools->ret_arr(-1,$err_msg."异常行的料号为【".$sku."】");
|
|
|
|
+ }
|
|
|
|
+ if($category == "发条"){
|
|
|
|
+ $cate = 126;
|
|
|
|
+ }elseif($category == "发块前头"){
|
|
|
|
+ $cate = 127;
|
|
|
|
+ }elseif($category == "头套"){
|
|
|
|
+ $cate = 128;
|
|
|
|
+ }elseif($category == "接发"){
|
|
|
|
+ $cate = 130;
|
|
|
|
+ }elseif($category == "礼物"){
|
|
|
|
+ $cate = 131;
|
|
|
|
+ }
|
|
|
|
+ elseif($category == "配件"){
|
|
|
|
+ $cate = 133;
|
|
|
|
+ }
|
|
|
|
+ elseif($category == "化纤头套"){
|
|
|
|
+ $cate = 1297;
|
|
|
|
+ }
|
|
|
|
+ elseif($category == "化纤其它"){
|
|
|
|
+ $cate = 1702;
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ return $this->logic_tools->ret_arr(-1,"分类异常请手动输入"."异常行的料号为【".$sku."】");
|
|
|
|
+ }
|
|
|
|
+ $list['category'] = $cate; //类目
|
|
|
|
+ if(isset($sku_list[22])){
|
|
|
|
+ $list['hairtype'] = $sku_list[22]['id']; //真人发类型
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[13])){
|
|
|
|
+ $list['grade'] = $sku_list[13]['id'];//等级
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[14])){
|
|
|
|
+ $list['size'] = $sku_list[14]['id'];//长度
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[43])){
|
|
|
|
+ $list['hairnumber'] = $sku_list[43]['id'];//人发头套编号
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(isset($sku_list[33])){
|
|
|
|
+ $list['extension'] = $sku_list[33]['id'];//Extension类型
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if( $cate == 1297)
|
|
|
|
+ {
|
|
|
|
+ if(isset($sku_list[40])){
|
|
|
|
+ $list['sywignumber'] = $sku_list[40]['id'];//化纤头套编号
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if( $cate == 1702)
|
|
|
|
+ {
|
|
|
|
+ if(isset($sku_list[47])){
|
|
|
|
+ $list['syhairnumber'] = $sku_list[47]['id'];//化纤发编号
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[46])){
|
|
|
|
+ $list['syother'] = $sku_list[46]['id'];//化纤其它分类
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if($cate == 133)
|
|
|
|
+ {
|
|
|
|
+ if(isset($sku_list[35])){
|
|
|
|
+ $list['fittype'] = $sku_list[35]['id'];//配件类型
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[45])){
|
|
|
|
+ $list['acother'] = $sku_list[45]['id'];//配件其他
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[8])){
|
|
|
|
+ $list['color'] = $sku_list[8]['id'];//头发颜色
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[15])){
|
|
|
|
+ $list['lowe'] = $sku_list[15]['id'];//曲 度
|
|
|
|
+ }
|
|
|
|
+ if($cate == 127)
|
|
|
|
+ {
|
|
|
|
+ if(isset($sku_list[27])){
|
|
|
|
+ $list['type'] = $sku_list[27]['id']; //类 型
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[12])){
|
|
|
|
+ $list['headroad'] = $sku_list[12]['id']; //头路设计
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[10])){
|
|
|
|
+ $list['density'] = $sku_list[10]['id']; //密 度
|
|
|
|
+ }
|
|
|
|
+ if($list['type'] == 195 || $list['type'] == 197 || $list['type'] == 199)
|
|
|
|
+ {
|
|
|
|
+ //蕾丝尺寸
|
|
|
|
+ if(isset($sku_list[25])){
|
|
|
|
+ $list['lacesize'] = $sku_list[25]['id'];
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[26])){
|
|
|
|
+ $list['lacesize'] = $sku_list[26]['id'];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[9])){
|
|
|
|
+ $list['lacecolor'] = $sku_list[9]['id'];//蕾丝颜色
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[44])){
|
|
|
|
+ $list['lacetypes'] = $sku_list[44]['id'];//蕾丝类型
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if($cate == 128)
|
|
|
|
+ {
|
|
|
|
+ if(isset($sku_list[18])){
|
|
|
|
+ $list['lacetype'] = $sku_list[18]['id'];//头套种类
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[6])){
|
|
|
|
+ $list['haircap'] = $sku_list[6]['id'];//发帽大小
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[10])){
|
|
|
|
+ $list['density'] = $sku_list[10]['id'];//密 度
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[9])){
|
|
|
|
+ $list['lacecolor'] = $sku_list[9]['id'];//蕾丝颜色
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[44])){
|
|
|
|
+ $list['lacetypes'] = $sku_list[44]['id'];//蕾丝类型
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[39])){
|
|
|
|
+ $list['wigother'] = $sku_list[39]['id'];//头套其它
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[50])){
|
|
|
|
+ $list['wigother2'] = $sku_list[50]['id'];//头套其它2
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //现在没有129这个分类了
|
|
|
|
+ // if($category == 129)
|
|
|
|
+ // {
|
|
|
|
+ // if(isset($sku_list[50])){
|
|
|
|
+ // $list['wide'] = $sku_list[50]['id'];
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ if($cate == 131)
|
|
|
|
+ {
|
|
|
|
+ if(isset($sku_list[34])){
|
|
|
|
+ $list['gifttype'] = $sku_list[34]['id'];//Gift类型
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[49])){
|
|
|
|
+ $list['giftother'] = $sku_list[49]['id'];//Gift其它
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //没有134这一项了
|
|
|
|
+ // if($category == 134)
|
|
|
|
+ // {
|
|
|
|
+ // if(isset($sku_list[49])){
|
|
|
|
+ // $list['giftother'] = $sku_list[49]['id'];
|
|
|
|
+ // }
|
|
|
|
+ // $list['pieceweight'] = $this->input->post('pieceweight',true);
|
|
|
|
+ // }
|
|
|
|
+ if($cate == 1297)
|
|
|
|
+ {
|
|
|
|
+ if(isset($sku_list[41])){
|
|
|
|
+ $list['synthetictype'] = $sku_list[41]['id'];//头套类型
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[42])){
|
|
|
|
+ $list['sywigother'] = $sku_list[42]['id'];//化纤头套其它
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if($cate == 130 || $cate == 133 || $cate == 1702)
|
|
|
|
+ {
|
|
|
|
+ if(isset($sku_list[38])){
|
|
|
|
+ $list['items'] = $sku_list[38]['id'];//单包片数
|
|
|
|
+ }
|
|
|
|
+ if(isset($sku_list[7])){
|
|
|
|
+ $list['weight'] = $sku_list[7]['id'];//重 量
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if($cate == 1702)
|
|
|
|
+ {
|
|
|
|
+ if(isset($sku_list[48])){
|
|
|
|
+ $list['syhairther'] = $sku_list[48]['id'];//化纤发其它
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $pm = $classid;
|
|
|
|
+ $jm = $classid;
|
|
|
|
+ $sku = [];
|
|
|
|
+ $title = '';$features = '';$cs = array();
|
|
|
|
+ $bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
|
|
|
|
+
|
|
|
|
+ foreach($list as $k=>$v)
|
|
|
|
+ {
|
|
|
|
+ if(isset($typeclassid[$v]) && isset($bmpx[$typeclassid[$v]['classid']]))
|
|
|
|
+ {
|
|
|
|
+ if($typeclassid[$v]['bm'] != '')
|
|
|
|
+ {
|
|
|
|
+ $bmpx[$typeclassid[$v]['classid']] = $typeclassid[$v]['bm'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if($v != 0)
|
|
|
|
+ {
|
|
|
|
+ if($k != 'size')
|
|
|
|
+ {
|
|
|
|
+ $title .= $typeclassid[$v]['title']." ";
|
|
|
|
+ }
|
|
|
|
+ $features .=$v.'-';
|
|
|
|
+ $sku[$typeclassid[$v]['classid']] = empty($typeclassid[$v]['bqsku'])?"":$typeclassid[$v]['bqsku'];
|
|
|
|
+ if(isset($pm[$typeclassid[$v]['classid']]))
|
|
|
|
+ {
|
|
|
|
+ if($typeclassid[$v]['title'] == '9A')
|
|
|
|
+ {
|
|
|
|
+ $pm[$typeclassid[$v]['classid']] = '9A';
|
|
|
|
+ }
|
|
|
|
+ else if($typeclassid[$v]['title'] == '10A')
|
|
|
|
+ {
|
|
|
|
+ $pm[$typeclassid[$v]['classid']] = '10A';
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ $clzh = $typeclassid[$v]['zh'];
|
|
|
|
+ if(stripos($typeclassid[$v]['zh'],'|') !== false)
|
|
|
|
+ {
|
|
|
|
+ $clzh = explode('|',rtrim($typeclassid[$v]['zh'],'|'));
|
|
|
|
+ $clzh = $clzh[0];
|
|
|
|
+ }
|
|
|
|
+ $pm[$typeclassid[$v]['classid']] = $clzh;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(isset($jm[$typeclassid[$v]['classid']]))
|
|
|
|
+ {
|
|
|
|
+ if($typeclassid[$v]['jm'])
|
|
|
|
+ {
|
|
|
|
+ $jm[$typeclassid[$v]['classid']] = $typeclassid[$v]['jm'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $jm = array_filter($jm);//去除空值
|
|
|
|
+ $jm = implode("-",$jm);
|
|
|
|
+ $sku = array_filter($sku);//去除空值
|
|
|
|
+ $sku = implode("-",$sku);
|
|
|
|
+ $pm = array_filter($pm);//去除空值
|
|
|
|
+ $pm = implode(" ",$pm);
|
|
|
|
+ $pm = preg_replace("/\r\n|\r|\n/",'',trim($pm,' '));
|
|
|
|
+ if($list['size'])
|
|
|
|
+ {
|
|
|
|
+ $typeclass = $this->typeclass->read($list['size']);
|
|
|
|
+ $title .= $typeclass['title'];
|
|
|
|
+ }
|
|
|
|
+ $title = trim($title,' ');
|
|
|
|
+
|
|
|
|
+ $post['num'] = $this->input->post('num',true);
|
|
|
|
+ $ztime = $this->input->post('ztime',true);
|
|
|
|
+ $post['ztime'] = strtotime($ztime);
|
|
|
|
+ $post['bm'] = '03'.implode("",$bmpx);
|
|
|
|
+ $post['jm'] = $jm;
|
|
|
|
+ $post['sku'] = $sku;
|
|
|
|
+ $post['pm'] = $pm;
|
|
|
|
+ $post['title'] = $title;
|
|
|
|
+ $post['features'] = '-'.$features;
|
|
|
|
+ $post['number'] = date('YmdHis',time()).rand(100,999);
|
|
|
|
+ if(!$post['num'])
|
|
|
|
+ {
|
|
|
|
+ $post['number'] = date("YmdHis").rand(100,999);
|
|
|
|
+ }
|
|
|
|
+ $time = time();
|
|
|
|
+ $post['time'] = $time;//操作时间
|
|
|
|
+ $post['printnum'] = $time;
|
|
|
|
+ $post['type'] = 0;
|
|
|
|
+ return $this->logic_tools->ret_arr(1,"ok",$post);
|
|
|
|
+ }
|
|
}
|
|
}
|