lvhao 1 день назад
Родитель
Сommit
889f410841
1 измененных файлов с 452 добавлено и 1 удалено
  1. 452 1
      core/CoreApp/controllers/Warehouse.php

+ 452 - 1
core/CoreApp/controllers/Warehouse.php

@@ -369,7 +369,7 @@ class Warehouse extends Start_Controller {
 	}
 	
 	
-	public function _kcpd()
+	public function _kcpdbak()
 	{
 		header("Access-Control-Allow-Origin: *");
 		//echo json_encode(array('msg'=>'','success'=>true));exit;
@@ -1228,6 +1228,457 @@ class Warehouse extends Start_Controller {
 			}
 		}
 	}
+
+	public function _kcpd(){
+		header("Access-Control-Allow-Origin: *");
+		$post = $this->input->post(NULL, TRUE);
+		if(isset($post['warehouse'])){
+			$warehouse = $this->input->post('warehouse',true);
+			$warehouse = $this->warehouse->read($warehouse);
+			$whlabel = $this->input->post('whlabel',true);
+			$shop = $this->input->post('shop',true);
+			$data = $this->input->post('data',true);
+			$data = str_replace('--','-',$data);
+			$number = $this->input->post('number',true);
+			$y = $this->logic_order->getInfo("number = '".$number."'");
+			
+			if(!preg_match('/[0-9]/',$whlabel))
+			{
+				echo json_encode(array('msg'=>"无",'success'=>true));exit;
+			}
+			$typeclass = array();
+			$size_arr = [];
+			$tdata = $this->typeclass->find_all();
+			foreach ($tdata as $v) 
+			{
+				$typeclass[$v['id']] = $v['classid'];
+				if($v['classid'] == '14'){
+					if(!empty($v['spare'])&&(strpos($v['spare'],'Length') === false)){
+						$size_arr[$v['spare']*1] = $v['id'];
+					}
+				}
+			}
+			ksort($size_arr);
+			$size_title_arr = array_keys($size_arr);
+			$size_id_arr = array_values($size_arr);
+			$kxw = '可用现货:';
+			$tdfh = '';$cs = array();
+			$warehousedata = $this->warehouse->find_all("zd = '1' and id != '8'");
+			$pp = explode('|',trim($whlabel,'|'));
+			$ccpp = explode('|',trim($data,'|'));
+			$goods_list = [];
+			foreach($pp as $key=>$va){
+				$num = explode('-',$va);
+				if($num[1] < 1)
+				{
+					continue;
+				}
+				//看日志发现这有个错误 居然没有国家 很有可能是 没有此订单 又怕影响其他 干脆直接跳过本次循环吧
+				if(empty($y['country'])){
+					continue;
+				}
+				$features_str = $ccpp[$key];
+				//礼物类不做处理
+				if(strpos($features_str,'-131-') !== false){
+					continue;
+				}
+				$goods_list[$num[0]] = []; 
+				$cp = str_replace(array('-163-','-164-','-165-','-166-'),'-',$ccpp[$key]);
+				$cc = explode(',',$cp);
+				$features  = $this->logic_u9tools->getGoodFeatureAlone($cp);
+				foreach($warehousedata as $v){
+					if($y['country'] != '192' && $v['id'] == 5){
+						continue;
+					}
+					//var_dump("--------------------------");
+					$wh = $this->whlabel->find_count("state = '0' and number = '$num[0]' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
+					//var_dump($wh.":的值");
+					if($wh >= $num[1]){
+						$goods_list[$num[0]][] = $v['title']."有货";
+						continue;
+					}
+					
+					//美仓提档检测是否有货
+					if($v['id'] == 5){
+						if(strpos($cp,',')!== false){
+							$szie_key = array_search($cc[0],$size_id_arr);
+							if($szie_key !== false){
+								$tyd_size_id = $size_id_arr[$szie_key+1];
+							}
+							$now_size_title = $size_title_arr[$szie_key];
+							$tyd_size_title = $size_title_arr[$szie_key+1];
+							
+							// var_dump($tyd_size_title);
+							// var_dump($now_size_title);
+							if(($now_size_title + 2) == $tyd_size_title){
+								$tyd_cp =  str_replace($cc[0].',',$tyd_size_id.',',$cp);
+								// var_dump($tyd_cp);
+								// var_dump($cp);
+								
+								$tyd_features = $this->logic_u9tools->getGoodFeatureAlone($tyd_cp);
+								// var_dump($tyd_features);
+								// var_dump("===========================");
+								$tdwh = $this->whlabel->find_count("state = '0' and features = '$tyd_features' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
+								if($tdwh >= $num[1]){
+									$goods_list[$num[0]][] = $v['title']."(当前尺寸无货,提一档有货)";
+								}
+	
+							}
+							
+						}
+					}
+
+					
+					//103 Body Wave     1647 LooseBody
+					if(stripos($cp,'-103-') !== false || stripos($cp,'-1647-') !== false){
+						$tmp_str = "";
+						if(stripos($cp,'-103-') !== false){
+							$tmp_features = str_replace('-103-','-1647-',$features);
+							$tmp_str = "Loose Body";
+						}else{
+							$tmp_features = str_replace('-1647-','-103-',$features);
+							$tmp_str= "Body";
+						}
+						$qdth_wh = $this->whlabel->find_count("state = '0' and features = '$tmp_features' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+						if($qdth_wh >= $num[1]){
+							$goods_list[$num[0]][] = $v['title']."(当前曲度无货,".$tmp_str."有货)";
+						}
+					}
+					
+					// 4*7没货的,5*7如果有货,给提醒
+					if(stripos($cp,'-1253-') !== false)
+					{
+						$gpp = str_replace('-1253-','-2062-',$features);
+						$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+						if($ccxh >= $num[1])
+						{
+							$goods_list[$num[0]][] = $v['title']."- 5*7有货";
+						}
+						
+					}
+
+					// 1255  HD 4*7 Closure Wig  HD 5*7 Closure Wig 如果有货,给提醒
+					if(stripos($cp,'-1255-') !== false)
+					{
+						
+						$gpp = str_replace('-1255-','-2147-',$features);
+						$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+						if($ccxh >= $num[1])
+						{
+							$goods_list[$num[0]][] = $v['title']."- 5*7有货";
+						}
+						
+					}
+					// 1323  4*7 Bob Wig  5*7 Bob Wig 如果有货,给提醒
+					if(stripos($cp,'-1323-') !== false)
+					{
+						$gpp = str_replace('-1323-','-2167-',$features);
+						$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+						
+						if($ccxh >= $num[1])
+						{
+							$goods_list[$num[0]][] = $v['title']."- 5*7有货";
+						}
+						
+					}
+					// 1257  HD 4*7 Bob Wig  HD 5*7 Bob Wig 如果有货,给提醒
+					if(stripos($cp,'-1257-') !== false)
+					{
+						$gpp = str_replace('-1257-','-2434-',$features);
+						$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+						if($ccxh >= $num[1])
+						{
+							$goods_list[$num[0]][] = $v['title']."- 5*7有货";
+						}
+						
+					}
+
+					// 5*5没货的,5*7、5*9如果有货,给提醒
+					if(stripos($cp,'-297-') !== false) //13*4  HD13*4
+					{
+						
+						$gpp = str_replace('-297-','-2062-',$features);
+						$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+						if($ccxh >= $num[1])
+						{
+							$goods_list[$num[0]][] = $v['title']."- 5*7有货";
+						}
+						
+						$gpp2 = str_replace('-297-','-1254-',$features);
+						$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp2' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+						if($ccxh >= $num[1])
+						{
+							$goods_list[$num[0]][] = $v['title']."- 5*9有货";
+						}
+						
+					}
+
+					// 180%货的,200、250如果有货,给提醒
+					if(stripos($cp,'-72-') !== false) //13*4  HD13*4
+					{
+						if(isset($cc[1])){
+			
+							$gpp = str_replace('-72-','-73-',$features);
+							$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+							if($ccxh >= $num[1])
+							{
+								$goods_list[$num[0]][] = $v['title']."- 200%密度有货";
+							}
+						
+					
+							$gpp2 = str_replace('-72-','-74-',$features);
+							$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp2' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+							if($ccxh >= $num[1])
+							{
+								$goods_list[$num[0]][] = $v['title']."- 250%密度有货";
+							}
+						}
+
+						if(stripos($cp,'-73-') !== false) //200%   250%
+						{
+							$gpp2 = str_replace('-73-','-74-',$features);
+							$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp2' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+							if($ccxh >= $num[1])
+							{
+								$goods_list[$num[0]][] = $v['title']."- 250%密度有货";
+							}
+						}
+					
+						//HD相互提醒
+						if(stripos($cp,'-146-') !== false || stripos($cp,'-331-') !== false) //13*4  HD13*4
+						{
+							if(stripos($cp,'-146-') !== false)
+							{
+								$gpp = str_replace('-146-','-331-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- HD13*4有货";
+								}
+							}
+							else if(stripos($cp,'-331-') !== false)
+							{
+								$gpp = str_replace('-331-','-146-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- 13*4有货";
+								}
+							}
+						}
+						if(stripos($cp,'-322-') !== false || stripos($cp,'-341-') !== false)//13*6  HD13*6
+						{
+							if(stripos($cp,'-322-') !== false)
+							{
+								$gpp = str_replace('-322-','-341-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- HD13*6有货";
+								}
+							}
+							else if(stripos($cp,'-341-') !== false)
+							{
+								$gpp = str_replace('-341-','-322-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- 13*6有货";
+								}
+							}
+						}
+						if(stripos($cp,'-147-') !== false || stripos($cp,'-781-') !== false)//4*4  HD4*4
+						{
+							if(stripos($cp,'-147-') !== false)
+							{
+								$gpp = str_replace('-147-','-781-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- HD4*4有货";
+								}
+							}
+							else if(stripos($cp,'-781-') !== false)
+							{
+								$gpp = str_replace('-781-','-147-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- 4*4有货";
+								}
+							}
+						}
+						if(stripos($cp,'-297-') !== false || stripos($cp,'-540-') !== false)//5*5  HD5*5
+						{
+							if(stripos($cp,'-297-') !== false)
+							{
+								$gpp = str_replace('-297-','-540-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- HD5*5有货";
+								}
+							}
+							else if(stripos($cp,'-540-') !== false)
+							{
+								$gpp = str_replace('-540-','-297-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- 5*5有货";
+								}
+							}
+						}
+
+						if(stripos($cp,'-298-') !== false || stripos($cp,'-370-') !== false)//6*6  HD6*6
+						{
+							if(stripos($cp,'-298-') !== false)
+							{
+								$gpp = str_replace('-298-','-370-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- HD6*6有货";
+								}
+							}
+							else if(stripos($cp,'-370-') !== false)
+							{
+								$gpp = str_replace('-370-','-298-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- 6*6有货";
+								}
+							}
+						}
+
+						//抽绳款 和非抽绳款的相互提醒  针对头套
+						if(stripos($cp,'-128-')  !== false){
+							//如果是抽绳款 可以找下非抽绳的库存
+							if(stripos($cp,'-2661-')  !== false){
+								$gpp = str_replace('-2661-','-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- 非抽绳款有库存";
+								}
+							}else{
+								$gpp = $features."2661-";
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- 抽绳款有库存";
+								}
+							}
+						}
+
+						// 常规品  带MShaped字眼  带Upgraded MShaped(Lagos Hairline)字眼(M发际线升级版)
+						// 2468 2608  这个是头套的 判断的
+						if(stripos($cp,'-128-')  !== false){
+							$sku = trim($cp,'-');
+							$sku = str_replace(',','-',$sku);
+							$sku = str_replace('--','-',$sku);
+							$tmp_arr = explode('-',$sku);
+							$tmp_arr = $this->logic_zhlp->transferSku($tmp_arr);
+							//判断是否 有50
+							if(isset($tmp_arr[50])){
+								$arr_no = $arr_2468 = $arr_2608 =$tmp_arr;
+								unset($arr_no[50]);
+								$arr_2468[50] = 2468;
+								$arr_2608[50] = 2608;
+							}else{
+								$arr_no = $arr_2468 = $arr_2608 =$tmp_arr;
+								$arr_2468[50] = 2468;
+								$arr_2608[50] = 2608;
+							}
+							$res = $this->logic_zhlp->sortByClass($arr_no);
+							$fianal_arr_no = $res['data'];
+
+							$res = $this->logic_zhlp->sortByClass($arr_2468);
+							$fianal_arr_2468 = $res['data'];
+							$res = $this->logic_zhlp->sortByClass($arr_2608);
+							$fianal_arr_2608 = $res['data'];
+							$final_size = $fianal_arr_no[14];
+							unset($fianal_arr_no[14]);
+							unset($fianal_arr_2468[14]);
+							unset($fianal_arr_2608[14]);
+							$final_str_no = $final_size.",-".implode("-",$fianal_arr_no)."-";
+							$final_str_2468 = $final_size.",-".implode("-",$fianal_arr_2468)."-";
+							$final_str_2608 = $final_size.",-".implode("-",$fianal_arr_2608)."-";
+							
+							$do_str_no = $this->logic_u9tools->getGoodFeatureAlone($final_str_no);
+							$do_str_2468 = $this->logic_u9tools->getGoodFeatureAlone($final_str_2468);
+							$do_str_2608 = $this->logic_u9tools->getGoodFeatureAlone($final_str_2608);
+							//非M发际线/2468 M发际线/2608 M发际线升级版有货
+							if(stripos($cp,'-2468-') !== false){
+								$num_no = $this->whlabel->find_count("state = '0' and features = '$do_str_no' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
+								$num_2608 = $this->whlabel->find_count("state = '0' and features = '$do_str_2608' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
+								if($num_no > 0){
+									$goods_list[$num[0]][] = $v['title']."- 非M发际线有货";
+								}
+								if($num_2608 > 0){
+									$goods_list[$num[0]][] = $v['title']."- M发际线升级版有货";
+								}
+							}elseif(stripos($cp,'-2608-') !== false){
+								$num_no = $this->whlabel->find_count("state = '0' and features = '$do_str_no' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
+								$num_2468 = $this->whlabel->find_count("state = '0' and features = '$do_str_2468' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
+								if($num_no > 0){
+									$goods_list[$num[0]][] = $v['title']."- 非M发际线有货";
+								}
+								if($num_2468 > 0){
+									$goods_list[$num[0]][] = $v['title']."- M发际线有货";
+								}
+							}else{
+								$num_2608 = $this->whlabel->find_count("state = '0' and features = '$do_str_2608' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
+								$num_2468 = $this->whlabel->find_count("state = '0' and features = '$do_str_2468' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
+								if($num_2608 > 0){
+									$goods_list[$num[0]][] = $v['title']."- M发际线升级版有货";
+								}
+								if($num_2468 > 0){
+									$goods_list[$num[0]][] = $v['title']."- M发际线有货";
+								}
+							}	
+						}
+
+						if(stripos($cp,'-935-') !== false || stripos($cp,'-854-') !== false)//#P4/27/613  #P4/613
+						{
+							if(stripos($cp,'-935-') !== false)
+							{
+								$gpp = str_replace('-935-','-854-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- #P4/613";
+								}
+							}
+							else if(stripos($cp,'-854-') !== false)
+							{
+								$gpp = str_replace('-854-','-935-',$features);
+								$ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
+								if($ccxh >= $num[1])
+								{
+									$goods_list[$num[0]][] = $v['title']."- #P4/27/613";
+								}
+							}
+							
+						}
+
+						$transportlist = $this->whlabeltransport->find_all("features = '".$features."' and cz = 0 and warehouse = '".$v['id']."'");
+						if(count($transportlist) > 0)
+						{
+							$transportItem = $transportlist[0];
+							$goods_list[$num[0]][] = $transportItem['sku'] ." 在途库存:  <b>" . $transportItem['num'] . "   </b>  预达时间: ".date("Y-m-d",$transportItem['stime']). "  <br/>  备注 :  " . $transportItem['text'];
+						}
+					}
+				}
+				$str = implode(',',$goods_list[$num[0]]);
+				$kxw .= $str.';';
+				
+				
+			}
+			echo json_encode(array('msg'=>$kxw,'success'=>true));exit;
+		}
+	}
 	
 	public function str_replace_limit($search, $replace, $subject) 
 	{