| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792 | 
							- <?php defined('BASEPATH') OR exit('No direct script access allowed');
 
- header("Access-Control-Allow-Origin: *");
 
- class Systemprint extends Start_Controller {
 
- 	public function __construct(){
 
- 		parent::__construct();
 
- 		$this->load->library('session');
 
- 		$this->load->_model('Model_whlabel','whlabel');
 
- 		$this->load->_model('Model_warehouse','warehouse');
 
- 		$this->load->_model('Model_productprice','productprice');
 
- 		$this->load->_model('Model_excel','excel');
 
- 		$this->load->_model('Model_fullorder','fullorder');
 
- 		$this->load->_model('Model_fullorder_smt','fullorder_smt');
 
- 		$this->load->_model('Model_fullordersmt','fullordersmt');
 
- 		$this->load->_model('Model_fullordertt','fullordertt');
 
- 		$this->load->_model('Model_fullorderamz','fullorderamz');
 
- 		$this->load->_model('Model_outbound','outbound');
 
- 		$this->load->_model('Model_express','express');
 
- 		$this->load->_model('Model_shop','shop');
 
- 		$this->load->_model('Model_typeclass','typeclass');
 
- 		$this->load->_model('Model_country','country');
 
- 		$this->load->_model('Model_kdniao','kdniao');
 
- 		$this->load->_model('Model_notice','notice');
 
- 		$this->load->_model('Model_dhl','dhl');
 
- 		$this->load->_model('Model_dhlhz','dhlhz');
 
- 		$this->load->_model('Model_usps','usps');
 
- 		$this->load->_model('Model_fedex','fedex');
 
- 		$this->load->_model('Model_cne','cne');
 
- 		$this->load->_model('Model_fedex_cby','fedex_cby');
 
- 		$this->load->_model('Model_ups','ups');
 
- 		$this->load->_model('Model_ali','ali');
 
- 		$this->load->_model('Model_dpd','dpd');
 
- 		$this->load->_model('Model_hualeixw','hualeixw');
 
- 		$this->load->_model('Model_dpdxw','dpdxw');
 
- 		$this->load->_model('Model_shop','shop');
 
- 		$this->load->_model('Model_user','user');
 
- 		$this->load->_model('Model_whlabel','whlabel');
 
- 		$this->load->_model('Model_dpd_IOSS','dpdioss');
 
- 		$this->load->_model('Model_whlabelbarcodeprint','whlabelbarcodeprint');
 
- 		$this->load->_model('Model_whlabelbarcode','whlabelbarcode');
 
- 		$this->load->_model('Model_yswaybill','yswaybill');
 
- 		$this->load->_model('Model_hualei','hualei');
 
- 		$this->load->_model('Model_apiyy','apiyy');
 
- 		$this->load->_model('Model_classid','classid');
 
- 		$this->load->_model('Model_fullorderxw','fullorderxw');
 
- 		$this->load->_model('Model_setting','setting');
 
- 		$this->load->helper('url');
 
- 		$this->load->_model("Model_yuntu","yuntu");
 
- 		$this->load->_model("Model_api","api");
 
- 		$this->load->_model("Model_fedexv1",'fedexv1');
 
- 		$this->load->_model("Model_customsdeclaration","customsdeclaration");
 
- 		$this->load->_model("Model_logic_ding","logic_ding");
 
- 		$this->load->_model("Model_zxyuntu","zxyuntu");
 
- 		$this->load->_model("Model_logic_order","logic_order");
 
- 		$this->load->_model("Model_itsxb","itsxb");
 
- 	}
 
- 	//定义方法的调用规则 获取URI第二段值
 
-     public function _remap($arg,$arg_array)
 
-     {
 
- 		if($arg == 'printing')//打印操作
 
-         {
 
-              $this->_printing();
 
-         }
 
- 		else if($arg == 'printbyfh')
 
-         {
 
-              $this->_printbyfh();
 
-         }
 
- 		else if($arg == 'getorderinfo')
 
-         {
 
-              $this->_getInfoByNumber();
 
-         }
 
- 		else if($arg == 'exceldy')
 
-         {
 
-              $this->_exceldy($arg_array);
 
-         }
 
- 		else if($arg == 'screen')
 
-         {
 
-              $this->_screen();
 
-         }
 
- 		else if($arg == 'cz')
 
-         {
 
-              $this->_cz();
 
-         }
 
- 		else if($arg == 'barcode')
 
-         {
 
-              $this->_barcode();
 
-         }
 
- 		else if($arg == 'barcodedc')
 
-         {
 
-              $this->_barcodedc();
 
-         }
 
- 		else if($arg == 'barcodedr')
 
-         {
 
-              $this->_barcodedr();
 
-         }
 
- 		else if($arg == 'yswaybill')
 
-         {
 
-              $this->_yswaybill();
 
-         }
 
- 		else if($arg == 'mcindex'){
 
- 			$this->_mcindex();
 
- 		}
 
- 		else
 
- 		{
 
- 			 $this->_index();
 
- 		}
 
-     }
 
- 	
 
- 	public function _cz()
 
- 	{
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $shop = array();$type = array();
 
- 		    $usersp = explode('|',trim($user['shop'],'|'));
 
- 			$userwh = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($usersp as $v) 
 
- 		    {
 
- 				$shop[$v] = $v;
 
- 			}
 
- 			foreach ($userwh as $v) 
 
- 		    {
 
- 				$type[$v] = $v;
 
- 			}
 
- 		}
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['cz']))  
 
- 		{
 
- 			$cz = $this->input->post('cz');
 
- 			$cz = explode(',',trim($cz,','));
 
- 			$bj = $this->input->post('bj');
 
- 			$i = 0;$a = array();
 
- 			foreach ($cz as $v) 
 
- 		    {
 
- 				$dd = explode('-',$v);
 
- 				$fu = $dd[1];
 
- 				$thisdd = $this->$fu->read($dd[0]);
 
- 				if(isset($shop[$thisdd['shop']]) && isset($type[$thisdd['type']]))
 
- 				{
 
- 					$this->$fu->save(array('wigs'=>$bj),$dd[0]);
 
- 					$i++;
 
- 				}
 
- 			}
 
- 			if(count($cz) == $i)
 
- 			{
 
- 			    echo json_encode(array('msg'=>'标记完成!','success'=>true));exit;
 
- 			}
 
- 			else if($i == '0')
 
- 			{
 
- 				 echo json_encode(array('msg'=>'标记失败,请重试!','success'=>false));exit;
 
- 			}
 
- 			else
 
- 			{
 
- 				 echo json_encode(array('msg'=>'有部分标记失败,请检查!','success'=>false));exit;
 
- 			}
 
- 		}
 
- 	}
 
- 	
 
- 	public function _screen()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $fgshop = "";$sid = "";$wid="";$wtype="";
 
- 		    $usersp = explode('|',trim($user['shop'],'|'));
 
- 			$userwh = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($usersp as $value) 
 
- 		    {
 
- 				$fgshop .= " shop = ".$value." or";
 
- 				$sid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($userwh as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 				$wtype .= " type = ".$value." or";
 
- 			}
 
- 		}
 
- 		if(isset($post['page']))  
 
- 		{
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			$wigs = $this->input->post('wigs',true);
 
- 			$shop = $this->input->post('shop',true);
 
- 			$orderinfo = $this->input->post('orderinfo',true);
 
- 			$number = $this->input->post('number',true);
 
- 			$so = $this->input->post('so',true);
 
- 			//$where = (isset($_SESSION['api']))?"mergeid != '1' and (state = '207' or state = '209') and (".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
 
- 			//$where  .= " and express != 0 and printtype > 0 and printtype < 3 and print = 2 and review > 4 and library = 1 and type = 4";
 
- 			$where = (isset($_SESSION['api']))?"mergeid != '1' and (".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
 
- 			if($shop)
 
-             {
 
-                 $where  .= " and shop = '$shop'";
 
-             }
 
- 			if($orderinfo)
 
-             {
 
-                 $where  .= " and orderinfo = '$orderinfo'";
 
-             }
 
- 			if($number)
 
-             {
 
-                 $where  .= " and number = '$number'";
 
-             }
 
- 			if($wigs || $wigs == '0')
 
-             {
 
-                 $where  .= " and wigs = '$wigs'";
 
-             }
 
-             //数据排序
 
-             $order_str = "id desc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
- 			$info_list = array();
 
- 			$info_listsmt = array();
 
- 			$info_listtt = array();
 
- 			$info_listxw = array();
 
- 			$dlz = 0; $smt = 0; $tt = 0;$xw = 0;
 
-             //取得信息列表
 
-             $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,shipremarks',$order_str,$start,$perpage);
 
- 			 //格式化数据
 
-             foreach ($info_list as $key=>$value) 
 
- 		    {
 
- 				$w = $this->fullorder->read($value['id']);
 
- 				if(stripos($w['issku'],'#pack') !== false)
 
- 				{
 
- 					unset($info_list[$key]);
 
- 					continue;
 
- 				}
 
- 				$info_list[$key]['id'] = $value['id'].'-fullorder';
 
- 				$shop = $this->shop->read($value['shop']);
 
- 				$info_list[$key]['shop'] = $shop['shopname'];
 
-             }
 
- 			    $dlz = $this->fullorder->find_count($where);
 
- 			 $info_listtt = $this->fullordertt->find_all($where,'id,shop,orderinfo,number,shipremarks',$order_str,$start,$perpage);
 
- 			 //格式化数据
 
-             foreach ($info_listtt as $key=>$value) 
 
- 		    {
 
- 				$w = $this->fullordertt->read($value['id']);
 
- 				if(stripos($w['issku'],'#pack') !== false)
 
- 				{
 
- 					unset($info_list[$key]);
 
- 					continue;
 
- 				}
 
- 				$info_list[$key]['id'] = $value['id'].'-fullordertt';
 
- 				$shop = $this->shop->read($value['shop']);
 
- 				$info_list[$key]['shop'] = $shop['shopname'];
 
-             }
 
- 			    $tt = $this->fullordertt->find_count($where);
 
- 			    
 
- 			    
 
- 			     $info_listamz = $this->fullorderamz->find_all($where,'id,shop,orderinfo,number,shipremarks',$order_str,$start,$perpage);
 
- 			 //格式化数据
 
-             foreach ($info_listamz as $key=>$value) 
 
- 		    {
 
- 				$w = $this->fullorderamz->read($value['id']);
 
- 				if(stripos($w['issku'],'#pack') !== false)
 
- 				{
 
- 					unset($info_list[$key]);
 
- 					continue;
 
- 				}
 
- 				$info_list[$key]['id'] = $value['id'].'-fullorderamz';
 
- 				$shop = $this->shop->read($value['shop']);
 
- 				$info_list[$key]['shop'] = $shop['shopname'];
 
-             }
 
- 			    $amz = $this->fullorderamz->find_count($where);
 
- 			    
 
- 			    
 
- 			    
 
- 			    
 
- 			 $info_listxw = $this->fullorderxw->find_all($where,'id,shop,orderinfo,number,shipremarks',$order_str,$start,$perpage);
 
- 			 //格式化数据
 
-             foreach ($info_listxw as $key=>$value) 
 
- 		    {
 
- 				$w = $this->fullorderxw->read($value['id']);
 
- 				if(stripos($w['issku'],'#pack') !== false)
 
- 				{
 
- 					unset($info_list[$key]);
 
- 					continue;
 
- 				}
 
- 				$info_list[$key]['id'] = $value['id'].'-fullorderxw';
 
- 				$shop = $this->shop->read($value['shop']);
 
- 				$info_list[$key]['shop'] = $shop['shopname'];
 
-             }
 
- 			    $xw = $this->fullorderxw->find_count($where);
 
- 			$info_listsmt = $this->fullordersmt->find_all($where,'id,shop,orderinfo,number,shipremarks',$order_str,$start,$perpage);
 
- 			 //格式化数据
 
-             foreach ($info_listsmt as $key=>$value) 
 
- 		    {
 
- 				$w = $this->fullordersmt->read($value['id']);
 
- 				if(stripos($w['sku'],'#pack') !== false)
 
- 				{
 
- 					unset($info_listsmt[$key]);
 
- 					continue;
 
- 				}
 
- 				$info_listsmt[$key]['id'] = $value['id'].'-fullordersmt';
 
- 				$shop = $this->shop->read($value['shop']);
 
- 				$info_listsmt[$key]['shop'] = $shop['shopname'];
 
-             }
 
- 			    $smt += $this->fullordersmt->find_count($where);
 
- 			//$total += $this->fullorder_smt->find_count($where);
 
- 			$total = $dlz+$smt+$tt+$xw+$amz;
 
- 			$rows = array_merge($info_list,$info_listtt,$info_listamz,$info_listxw,$info_listsmt);
 
- 			//$rows = array_slice($rows,$start,$perpage);
 
- 		    $pagenum = ceil($total/$perpage);
 
- 		    $over = $total-($start+$perpage);
 
- 		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($rows));//array_merge($info_list,$info_list_smt,$info_listsmt)
 
- 		    echo json_encode($rows);exit;
 
- 		}
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
 
- 			$warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
 
- 		    $this->data['wlshop'] = $wlshop;
 
- 		    $this->data['warehouse'] = $warehouse;
 
- 		}
 
- 		$this->_Template('systemprint_screen',$this->data);
 
- 	}
 
- 	
 
- 	public function _index()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $fgshop = "";$sid = "";$wid="";$wtype="";
 
- 		    $usersp = explode('|',trim($user['shop'],'|'));
 
- 			$userwh = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($usersp as $value) 
 
- 		    {
 
- 				$fgshop .= " shop = ".$value." or";
 
- 				$sid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($userwh as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 				$wtype .= " type = ".$value." or";
 
- 			}
 
- 		}
 
- 		if(isset($post['page']))  
 
- 		{
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			$timetk = $this->input->post('timetk',true);
 
- 			$timetj = $this->input->post('timetj',true);
 
- 			$shop = $this->input->post('shop',true);
 
- 			$print = $this->input->post('print',true);
 
- 			$express = $this->input->post('express',true);
 
- 			$waybill = $this->input->post('waybill',true);
 
- 			$printtype = $this->input->post('printtype',true);
 
- 			$orderinfo = $this->input->post('orderinfo',true);
 
- 			$number = $this->input->post('number',true);
 
-             $type = $this->input->post('type',true);
 
- 			$lowe = $this->input->post('lowe',true);
 
- 			$info = $this->input->post('info',true);
 
- 			$ji = $this->input->post('ji',true);
 
- 			$so = $this->input->post('so',true);
 
- 			$ckfl = $this->input->post('ckfl',true);
 
- 			$sfxh = $this->input->post('sfxh',true);
 
- 			$lowe = $this->input->post('lowe',true);
 
- 			$color = $this->input->post('color',true);
 
- 			$is_jiaji = $this->input->post('is_jiaji',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$where = (isset($_SESSION['api']))?"(state = '207' or state = '209') and (".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
 
- 			    if($print == 3)
 
-                 {
 
-                     $where  .= " and printtime > '$timetk' and printtime < '$timetj' and print = '3' and library = 1";
 
-                 }
 
- 			    else
 
- 			    {
 
- 				    $where  .= " and express != 0 and printtype != 3 and printtype > 0 and print = 2 and review > 4 and library = 1 and reviewtime > '".(time() - 30*24*3600)."'";
 
- 					//$where  .= " and express != 0 and printtype != 3 and printtype > 0 and print = 2 and review > 4 and library = 1  ";
 
- 			    }
 
- 			if($shop)
 
-             {
 
-                 $where  .= " and shop = '$shop'";
 
-             }
 
- 			if($express)
 
-             {
 
- 				$where  .= " and express = '$express'";
 
-             }
 
- 			if($printtype)
 
-             {
 
-                 $where  .= " and printtype = '$printtype'";
 
-             }
 
- 			if($orderinfo)
 
-             {
 
-                 $where  .= " and orderinfo = '$orderinfo'";
 
-             }
 
- 			if($number)
 
-             {
 
-                 $where  .= " and number = '$number'";
 
-             }
 
- 			if($waybill)
 
-             {
 
-                 $where  .= " and waybill = '$waybill'";
 
-             }
 
- 			if($color)
 
-             {
 
-                 $where  .= " and fpdata like '%-$color-%'";
 
-             }
 
- 			if($lowe)
 
-             {
 
-                 $where  .= " and fpdata like '%-$lowe-%'";
 
-             }
 
- 			if($type)
 
-             {
 
- 				$where  .= " and type = '$type'";
 
- 			}
 
- 			else
 
- 			{
 
- 				$where  .= " and type != '16'";
 
- 			}
 
- 			/**
 
-             if($type)
 
-             {
 
- 				if($type != '4')
 
- 				{
 
- 					$where  .= " and type = '$type'";
 
- 					$where2 = '';
 
- 					$where3 = '';
 
- 				}
 
- 				else
 
- 				{
 
- 					$where2 = " and type = '4' and (wigs = '3' or wigs = '8') and issku not like '%#pack%'";
 
- 					$where3 = " and type = '4' and (wigs = '3' or wigs = '8') and sku not like '%#pack%'";
 
- 				}
 
- 				$where_a = "";
 
- 				$where_b = "";
 
-             }
 
- 			else
 
- 			{
 
- 				$where  .= " and type != '4'";
 
- 				$where_a = "(";
 
- 				$where_b = ")";
 
- 				$where2 = " or (type = '4' and (wigs = '3' or wigs = '8') and issku not like '%#pack%')";
 
- 				$where3 = " or (type = '4' and (wigs = '3' or wigs = '8') and sku not like '%#pack%')";
 
- 			}
 
- 			**/
 
- 			if($ji)
 
-             {
 
-                 $where  .= " and shipremarks like '%急%'";
 
-             }
 
- 			if($so)
 
-             {
 
-                 $where  .= " and shipremarks like '%$so%'";
 
-             }
 
- 			if($ckfl)
 
-             {
 
-                 $where  .= " and ckfl = '$ckfl'";
 
-             }
 
- 			if($sfxh != '')
 
-             {
 
-                 $where  .= " and sfxh = '$sfxh'";
 
-             }
 
-             //数据排序
 
-             $order_str = ($print != 3)?"id desc":"printtime desc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
- 			$info_list = $info_listtt = $info_listxw = $info_listsmt = $info_listamz =[];
 
- 			$info_list_jj = $info_listtt_jj = $info_listxw_jj = $info_listsmt_jj = $info_listamz_jj =[];
 
- 		
 
- 			$dlz = 0; $smt = 0;  $tt = 0; $xw = 0;$amz = 0;
 
- 			$dlz_jj = 0;$smt_jj=0;$tt_jj=0;$xw_jj=0;$amz_jj=0;
 
- 			$field = 'id,shop,orderinfo,number,express,waybill,print,printtype,printnumber,printtime,shipremarks,is_jiaji';
 
- 			if(($is_jiaji == 1)||($is_jiaji == -1)){
 
- 				$where_jiaji = $where." and is_jiaji = 1 ";
 
- 				$dlz_ret_jj = $this->indexData('fullorder',$start,$perpage,$where_jiaji,$field,$order_str);
 
- 				
 
- 				$info_list_jj = $dlz_ret_jj['list'];
 
- 				$dlz_jj = $dlz_ret_jj['total'];
 
- 	
 
- 				$tt_ret_jj = $this->indexData('fullordertt',$start,$perpage,$where_jiaji,$field,$order_str);
 
- 				$info_listtt_jj = $tt_ret_jj['list'];
 
- 				$tt_jj = $tt_ret_jj['total'];
 
- 	
 
- 				$amz_ret_jj = $this->indexData('fullorderamz',$start,$perpage,$where_jiaji,$field,$order_str);
 
- 				$info_listamz_jj = $amz_ret_jj['list'];
 
- 				$amz_jj = $amz_ret_jj['total'];
 
- 	
 
- 				$smt_ret_jj = $this->indexData('fullordersmt',$start,$perpage,$where_jiaji,$field,$order_str);
 
- 				$info_listsmt_jj = $smt_ret_jj['list'];
 
- 				$smt_jj = $smt_ret_jj['total'];
 
- 	
 
- 				$xw_ret_jj = $this->indexData('fullorderxw',$start,$perpage,$where_jiaji,$field,$order_str);
 
- 				$info_listxw_jj = $xw_ret_jj['list'];
 
- 				$xw_jj = $xw_ret_jj['total'];
 
- 	
 
- 			}
 
- 			
 
- 			/****************************执行非加急的************************************/ 
 
- 			if(($is_jiaji == 0) || ($is_jiaji == -1)){
 
- 				$where_nojj = $where." and is_jiaji = 0 ";
 
- 				$dlz_ret = $this->indexData('fullorder',$start,$perpage,$where_nojj,$field,$order_str);
 
- 				$info_list = $dlz_ret['list'];
 
- 				$dlz = $dlz_ret['total'];
 
- 	
 
- 				$tt_ret = $this->indexData('fullordertt',$start,$perpage,$where_nojj,$field,$order_str);
 
- 				$info_listtt = $tt_ret['list'];
 
- 				$tt = $tt_ret['total'];
 
- 	
 
- 				$amz_ret = $this->indexData('fullorderamz',$start,$perpage,$where_nojj,$field,$order_str);
 
- 				$info_listamz = $amz_ret['list'];
 
- 				$amz = $amz_ret['total'];
 
- 	
 
- 				$smt_ret = $this->indexData('fullordersmt',$start,$perpage,$where_nojj,$field,$order_str);
 
- 				$info_listsmt = $smt_ret['list'];
 
- 				$smt = $smt_ret['total'];
 
- 	
 
- 				$xw_ret = $this->indexData('fullorderxw',$start,$perpage,$where_nojj,$field,$order_str);
 
- 				$info_listxw = $xw_ret['list'];
 
- 				$xw = $xw_ret['total'];
 
- 			}
 
- 			
 
-            
 
- 			$total = $dlz+$tt+$amz+$smt+$xw+$dlz_jj+$tt_jj+$amz_jj+$smt_jj+$xw_jj;
 
- 			$pagenum = ceil($total/$perpage);
 
- 		    $over = $total-($start+$perpage);
 
- 			if($print == 3){
 
- 				// $rows_jj = $this->indexSort($info_list_jj,$info_listamz_jj,$info_listtt_jj,$info_listxw_jj,$info_listsmt_jj,$print);
 
- 				// $rows_no = $this->indexSort($info_list,$info_listamz,$info_listtt,$info_listxw,$info_listsmt,$print);
 
- 				$tmp_all_rows =  array_merge($info_list_jj,$info_listamz_jj,$info_listsmt_jj,$info_listtt_jj,$info_listxw_jj,$info_list,$info_listamz,$info_listsmt,$info_listtt,$info_listxw);
 
- 				$rows = $this->indexSort($tmp_all_rows,$print);
 
- 			}else{
 
- 				$tmp_jj_row =  array_merge($info_list_jj,$info_listamz_jj,$info_listtt_jj,$info_listxw_jj,$info_listsmt_jj);
 
- 				$rows_jj = $this->indexSort($tmp_jj_row,$print);
 
- 				$tmp_no_row = array_merge($info_list,$info_listamz,$info_listtt,$info_listxw,$info_listsmt);
 
- 				$rows_no = $this->indexSort($tmp_no_row,$print);
 
- 	
 
- 				$rows = array_merge($rows_jj,$rows_no);
 
- 			}
 
- 			
 
- 			
 
- 			$rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($rows),'cs'=>$where);//array_merge($info_list,$info_list_smt,$info_listsmt)
 
- 		    echo json_encode($rows);exit;
 
- 		}
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
 
- 			$warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
 
- 		    $this->data['wlshop'] = $wlshop;
 
- 		    $this->data['warehouse'] = $warehouse;
 
- 		}
 
- 		$this->_Template('systemprint',$this->data);
 
- 	}
 
- 	public function _mcindex()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $fgshop = "";$sid = "";$wid="";$wtype="";
 
- 		    $usersp = explode('|',trim($user['shop'],'|'));
 
- 			$userwh = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($usersp as $value) 
 
- 		    {
 
- 				$fgshop .= " shop = ".$value." or";
 
- 				$sid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($userwh as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 				$wtype .= " type = ".$value." or";
 
- 			}
 
- 		}
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
 
- 			$warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
 
- 		    $this->data['wlshop'] = $wlshop;
 
- 		    $this->data['warehouse'] = $warehouse;
 
- 		}
 
- 		$this->_Template('systemprintmc',$this->data);
 
- 	}
 
- 	/**
 
- 	 * $table_name  订单表名
 
- 	 * $start 		偏移开始坐标
 
- 	 * $limit   	偏移量
 
- 	 * $where  		条件
 
- 	 * $field		字段
 
- 	 * $order_str   排序
 
- 	 */
 
- 	protected function indexData($table_name,$start,$limit,$where,$filed,$order_str){	
 
- 		$info_list = $this->$table_name->find_all($where,$filed,$order_str,$start,$limit);
 
- 		
 
- 		if(empty($info_list)){
 
- 			$info_list = [];
 
- 		}
 
- 		 //格式化数据
 
- 		 foreach ($info_list as $key=>$value) 
 
- 		 {
 
- 			 $info_list[$key]['id'] = $value['id'].'-'.$table_name;
 
- 			 $shop = $this->shop->read($value['shop']);
 
- 			 $info_list[$key]['shop'] = $shop['shopname'];
 
- 			 $express = $this->express->read($value['express']);
 
- 			 if($express)
 
- 			 {
 
- 				 $info_list[$key]['express'] = $express['servicename'];
 
- 			 }
 
- 			 else
 
- 			 {
 
- 				 $info_list[$key]['express'] = '未选择';
 
- 			 }
 
- 			 if($value['printtime'] != 0)
 
- 			 {
 
- 				 $info_list[$key]['printtime'] = date('Y-m-d H:i',$value['printtime']);
 
- 			 }
 
- 			 else
 
- 			 {
 
- 				 $info_list[$key]['printtime'] = '无';
 
- 			 }
 
- 			 if($value['print'] == 1)
 
- 			 {
 
- 				 $info_list[$key]['print'] = "禁止打印";
 
- 			 }
 
- 			 else if($value['print'] == 2)
 
- 			 {
 
- 				 $info_list[$key]['print'] = "未打印";
 
- 			 }
 
- 			 else if($value['print'] == 3)
 
- 			 {
 
- 				 $info_list[$key]['print'] = "已打印";
 
- 			 }
 
- 			 if($value['printtype'] == 1)
 
- 			 {
 
- 				 $info_list[$key]['printtype'] = "运单";
 
- 			 }
 
- 			 else if($value['printtype'] == 2)
 
- 			 {
 
- 				 $info_list[$key]['printtype'] = "发货单";
 
- 			 }
 
- 			 else if($value['printtype'] == 0)
 
- 			 {
 
- 				 $info_list[$key]['printtype'] = "未选择";
 
- 			 }
 
- 			 if($value['is_jiaji'] == 1){
 
- 				$info_list[$key]['number'] = "<c style='color:red'>".$value['number']."</c>";
 
- 			 }
 
- 			 unset($info_list[$key]['is_jiaji']);
 
- 			 $info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('<','>'),$value['shipremarks']);
 
- 		 }
 
- 		$total = $this->$table_name->find_count($where);
 
- 		return [
 
- 			'list'=>$info_list,
 
- 			'total'=>$total,
 
- 		];
 
- 	}
 
- 	//订单表排序
 
- 	protected function indexSort($rows,$print){
 
- 		foreach($rows as $k=>$v){
 
- 			$rows[$k]['index'] = $v['shipremarks'].$v['id'];
 
- 		}
 
- 		$tmp_rows = array_column($rows,null,'index');
 
- 		
 
- 		ksort($tmp_rows);
 
- 		$tmp_rows = array_values($tmp_rows);
 
- 		foreach($tmp_rows as $k=>$v){
 
- 			
 
- 			unset($tmp_rows[$k]['index']);
 
- 		}
 
- 		
 
- 		$rows = $tmp_rows;
 
- 		
 
- 		$tmp = array();
 
- 		if($print == 3)
 
- 		{
 
- 			foreach ($rows as $key => $val)
 
- 			{
 
- 				$tmp[$key] = $val['printtime'];
 
- 			}
 
- 			array_multisort($tmp,SORT_DESC,$rows);
 
- 		}
 
- 		return $rows;
 
- 	}
 
- 	//打印
 
- 	public function _printing()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['s']))  
 
- 		{
 
- 			$v = $this->input->post('s');
 
- 			$va = explode(',',rtrim($v,','));
 
- 			$n = $this->input->post('n');
 
- 			$tf = $this->input->post('tf');
 
- 			$type = 3;$text = array();$text['data'] = array();$time = time();
 
- 			$pd = explode('-',$va[$n]);
 
- 			$va[$n] = $pd[0];
 
- 			$fullorder_name = $pd[1];
 
- 			$fullorder = $this->$fullorder_name->read($va[$n]);
 
- 			if(isset($va[$n+1]))
 
- 			{
 
- 				$xyz = explode('-',$va[$n+1]);
 
- 				$sf = $this->$fullorder_name->read($xyz[0]);
 
- 			}
 
- 			if($tf)
 
- 			{
 
- 				if($tf == '2' && ($fullorder['print'] == 3 || $fullorder['printtime'] > 0))
 
- 				{
 
- 					 echo json_encode(array('msg'=>$fullorder['number'].' 此订单已打印,请提交给技术处理','success'=>false));exit;
 
- 				}
 
- 			}
 
- 			if($fullorder['print'] == 1)
 
- 			{
 
- 				 echo json_encode(array('msg'=>$fullorder['number'].' 店员已操作禁止打印,请刷新当前程序','success'=>false));exit;
 
- 			}
 
- 			if($fullorder['print'] == 2 && $fullorder['printtime'] > 0)
 
- 			{
 
- 				 echo json_encode(array('msg'=>$fullorder['number'].' 状态异常,请提交给技术处理','success'=>false));exit;
 
- 			}
 
- 			$fullorder = $this->_text($fullorder);//获取所需信息
 
- 			$this->logic_ding->sendToDing("打印快递单,订单的信息".json_encode($fullorder,JSON_UNESCAPED_UNICODE));
 
- 			//美仓不需要海关报关信息,
 
- 			if($fullorder['type'] != 5){
 
- 				//中国发货的 目前是dhl需要海关申报编码
 
- 				if(empty($fullorder['sbbm'])){
 
- 					echo json_encode(array('msg'=>$fullorder['number'].' 海关申报配置异常,请提交给技术处理'.$fullorder['sbbm'],'success'=>false));exit;
 
- 				}
 
- 			}
 
- 			
 
- 			$oldprinttime = ($fullorder['printtime'] > 0)?$fullorder['oldprinttime'].$fullorder['printtime'].'-':'';
 
- 			$fullorder['printtime'] = date('m-d H:i',$time);//打印用时间、发货单用,不能删
 
- 			$pdfnum = 1;//PDF打印几遍
 
- 			if($fullorder['printtype'] == 1 && $fullorder['library'] != 2)// && $fullorder['library'] != 2
 
- 			{
 
- 				if($fullorder['printcode'] == "DHL")//如果打印过那么重新获取运单
 
- 				{
 
- 				    $barcode = $this->dhl->get_data($fullorder);//获取DHL快递信息
 
- 					if(isset($barcode['AirwayBillNumber']))
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['AirwayBillNumber'];
 
- 						$Hfp = $this->_pdf($barcode['LabelImage']['MultiLabels']['MultiLabel']['DocImageVal'],'f-'.$Hwaybill,$bctime);
 
- 					    $Hyd = $this->_pdf($barcode['LabelImage']['OutputImage'],'y-'.$Hwaybill,$bctime);
 
- 						if(isset($Hfp) && isset($Hyd) && isset($Hwaybill))
 
- 						{
 
- 							if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>85);
 
- 							}
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						$this->$fullorder_name->save(array('print'=>1,'failed'=>json_encode($barcode,JSON_UNESCAPED_UNICODE)),$va[$n]);
 
- 						// if(isset($barcode['Response']['Status']['Condition']['ConditionData']) || isset($barcode['Response']['Status']['Condition'][0]['ConditionData']))
 
- 						// {
 
- 						//     $failed = (isset($barcode['Response']['Status']['Condition']['ConditionData'])?$barcode['Response']['Status']['Condition']['ConditionData']:$barcode['Response']['Status']['Condition'][0]['ConditionData']);
 
- 						//     $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 						// }
 
- 					}
 
- 				}
 
- 				else if($fullorder['printcode'] == "DHLUSA")//DHL9610
 
- 				{
 
- 				    $barcode = $this->dhl->get_data($fullorder);//获取DHL快递信息
 
- 					if(isset($barcode['AirwayBillNumber']))
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['AirwayBillNumber'];
 
- 						$Hfp = $this->_pdf($barcode['LabelImage']['MultiLabels']['MultiLabel']['DocImageVal'],'f-'.$Hwaybill,$bctime);
 
- 					    $Hyd = $this->_pdf($barcode['LabelImage']['OutputImage'],'y-'.$Hwaybill,$bctime);
 
- 						if(isset($Hfp) && isset($Hyd) && isset($Hwaybill))
 
- 						{
 
- 							if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>85);
 
- 							}
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						if(isset($barcode['Response']['Status']['Condition']['ConditionData']) || isset($barcode['Response']['Status']['Condition'][0]['ConditionData']))
 
- 						{
 
- 						    $failed = (isset($barcode['Response']['Status']['Condition']['ConditionData'])?$barcode['Response']['Status']['Condition']['ConditionData']:$barcode['Response']['Status']['Condition'][0]['ConditionData']);
 
- 						    $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 						}
 
- 					}
 
- 					/**
 
- 					if(isset($barcode['AirwayBillNumber']))
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['AirwayBillNumber'];
 
- 						$Hfp = $this->_pdf($barcode['LabelImage']['MultiLabels']['MultiLabel']['DocImageVal'],'f-'.$Hwaybill,$bctime);
 
- 					    $Hyd = $this->_pdf($barcode['LabelImage']['OutputImage'],'y-'.$Hwaybill,$bctime);
 
- 						if(isset($Hfp) && isset($Hyd) && isset($Hwaybill))
 
- 						{
 
- 							$fullorder['waybill'] = $Hwaybill;
 
- 							$sb = $this->dhl->get_data_9610($fullorder);
 
- 							if($sb != 1)
 
- 							{
 
- 								$this->$fullorder_name->save(array('print'=>1,'failed'=>$sb),$va[$n]);
 
- 							}
 
- 							else
 
- 							{
 
- 							    if($fullorder['waybill'] != "")
 
- 							    {
 
- 							    	$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							    }
 
- 							    else
 
- 							    {
 
- 							    	$oldwaybill = $fullorder['oldwaybill'];
 
- 							    }
 
- 							    $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							    $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							    if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	    {
 
- 								    $type = 1;
 
- 								    $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>85);
 
- 							    }
 
- 							}
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						if(isset($barcode['Response']['Status']['Condition']['ConditionData']) || isset($barcode['Response']['Status']['Condition'][0]['ConditionData']))
 
- 						{
 
- 						    $failed = (isset($barcode['Response']['Status']['Condition']['ConditionData'])?$barcode['Response']['Status']['Condition']['ConditionData']:$barcode['Response']['Status']['Condition'][0]['ConditionData']);
 
- 						    $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 						}
 
- 					}
 
- 					**/
 
- 				}
 
- 				/**
 
- 				else if($fullorder['printcode'] == "DHLHZ")//如果打印过那么重新获取运单
 
- 				{
 
- 				    $barcode = $this->dhlhz->get_data($fullorder);//获取DHL快递信息
 
- 					if($barcode['c'] == 1)
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['data']['waybill'];
 
- 						$Hfp = $this->_pdf($barcode['data']['fp'],'f-'.$Hwaybill,$bctime);
 
- 					    $Hyd = $this->_pdf($barcode['data']['yd'],'y-'.$Hwaybill,$bctime);
 
- 						if(isset($Hfp) && isset($Hyd) && isset($Hwaybill))
 
- 						{
 
- 							if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>85);
 
- 							}
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						if(isset($barcode['data']))
 
- 						{
 
- 						    $failed = $barcode['data'];
 
- 						    $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 						}
 
- 					}
 
- 				}
 
- 				**/
 
- 				else if($fullorder['printcode'] == "USPS")
 
- 				{
 
- 				    $barcode = $this->usps->get_data($fullorder);
 
- 					//改新的去掉
 
- 					// if(isset($barcode[0]))
 
- 					// {
 
- 					// 	$barcode = $barcode[0];
 
- 					// }
 
- 					//if(isset($barcode['LabelImage']) || isset($barcode[0]['LabelImage']))
 
- 					//改新的去掉
 
- 					if(isset($barcode['labelImage']))
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						//$Hwaybill = substr($barcode['BarcodeNumber'], 8); //改新的去掉  新的 Labellmage 改  labelImage
 
- 				 		$Hwaybill = $barcode['trackingNumber'];
 
- 				 	    $Hyd = $this->_pdf($barcode['labelImage'],'y-'.$Hwaybill,$bctime);
 
- 					    //$Hyd = $this->_pdf($barcode['LabelImage'],'y-'.$Hwaybill,$bctime);
 
- 						//if(isset($barcode['LabelImage']) && isset($Hwaybill))
 
- 						if(isset($barcode['labelImage']) && isset($Hwaybill))
 
- 						{
 
- 							if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime,'freight'=>0),$va[$n]))//'freight'=>$barcode['extraServices'][0]['price']
 
- 				   		 	{
 
- 								$type = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
 
- 							}
 
- 						}
 
- 					}
 
- 				
 
- 					else if(isset($barcode['error']))
 
- 					{
 
- 						$failed = $barcode['Description'];//错误提示
 
- 						if(stripos($failed,'The requested Mail') === false)
 
- 						{
 
- 							if($failed != 'false')
 
- 							{
 
- 						    	$this->$fullorder_name->save(array('print'=>1,'failed'=>json_encode($barcode['error'])),$va[$n]);
 
- 							}
 
- 						}
 
- 					}
 
- 					
 
- 					/**
 
- 					else if(isset($barcode['error']['message']))
 
- 					{
 
- 						if(isset($barcode['error']['errors'][0]['detail']))
 
- 						{
 
- 							$failed = $barcode['error']['errors'][0]['detail'];//错误提示
 
- 						}
 
- 						else
 
- 						{
 
- 						    $failed = $barcode['error']['message'];//错误提示
 
- 						}
 
- 						//if(stripos($failed,'The requested Mail') === false)
 
- 						//{
 
- 							if($failed != 'false')
 
- 							{
 
- 						    	$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 							}
 
- 						//}
 
- 					}
 
- 					**/
 
- 					else
 
- 					{
 
- 						$failed = json_encode($barcode);//错误提示
 
- 						if($failed != 'false')
 
- 						{
 
- 						    $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 						}
 
- 					}
 
- 				}
 
- 				else if($fullorder['printcode'] == "FEDEXGF")//官方FEDEX接口
 
- 				{
 
- 					
 
- 				    //$barcode = $this->fedex->get_data($fullorder);//获取联邦快递信息
 
- 				    //接口升级
 
- 					$barcode = $this->fedexv1->get_data($fullorder);//获取联邦快递信息
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['waybill'];
 
- 						$Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
 
- 						$Hfp = $this->_pdfurl($barcode['invoice'],'f-'.$Hwaybill,$bctime);//开通ETD模式,保留PDF,不需要打印
 
- 						// $Hyd = $this->_pdf($barcode['label'],'y-'.$Hwaybill,$bctime);
 
- 						// $Hfp = $this->_pdf($barcode['invoice'],'f-'.$Hwaybill,$bctime);//开通ETD模式,保留PDF,不需要打印
 
- 						if(isset($barcode['label']) && isset($Hwaybill))
 
- 						{
 
- 						    if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95,'fp'=>base_url().'data/pdf/'.$bctime.'/f-'.$Hwaybill.'.pdf');
 
- 							}
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						if(isset($barcode['Description']))
 
- 						{
 
- 							if($barcode['Description'] != 'FEDEX_INTERNATIONAL_PRIORITY is not supported for the origin and destination pair.')
 
- 							{
 
- 						        $failed = $barcode['Description'];//错误提示
 
- 								$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 							}
 
- 							else
 
- 							{
 
- 								$failed = 'FEDEX返回不正确信息';//错误提示
 
- 							}
 
- 						}
 
- 					}
 
- 				}
 
- 				/**
 
- 				else if($fullorder['printcode'] == "FEDEXCBY")//官方FEDEX接口许昌玉美桥
 
- 				{
 
- 				    $barcode = $this->fedex_cby->get_data($fullorder);//获取联邦快递信息
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['waybill'];
 
- 						$Hyd = $this->_pdf($barcode['label'],'y-'.$Hwaybill,$bctime);
 
- 						$Hfp = $this->_pdf($barcode['invoice'],'f-'.$Hwaybill,$bctime);//开通ETD模式,保留PDF,不需要打印
 
- 						if(isset($barcode['label']) && isset($Hwaybill))
 
- 						{
 
- 						    if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
 
- 							}
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						if(isset($barcode['Description']))
 
- 						{
 
- 						    $failed = $barcode['Description'];//错误提示
 
- 						    $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 						}
 
- 					}
 
- 				}
 
- 				**/
 
- 				else if($fullorder['printcode'] == "DPD" || $fullorder['printcode'] == "FTFEDEX")
 
- 				{
 
- 				    $barcode = $this->dpd->get_data($fullorder);//获取联邦快递信息
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['waybill'];
 
- 						$Hyd = $this->_pdf($barcode['yd'],'y-'.$Hwaybill,$bctime);
 
- 						if(isset($barcode['yd']) && isset($Hwaybill) && $Hwaybill != '' && $barcode['yd'] != '')
 
- 						{
 
- 						    if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>98);
 
- 							}
 
- 						}
 
- 						else if(isset($barcode['yd']) && $Hwaybill == '' && $barcode['yd'] == '')
 
- 						{
 
- 							$oldwaybill = $fullorder['oldwaybill'];
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 2;
 
- 							}
 
- 						}
 
- 						else
 
- 						{
 
- 							$failed = 'DPD平台可能已产生订单信息,需要查看并删除再处理错误。'.$barcode['res'];//错误提示
 
- 						    $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						$failed = $barcode['Description'];//错误提示
 
- 						$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 					}
 
- 				}
 
- 				else if($fullorder['printcode'] == "DPDIOSS" || $fullorder['printcode'] == "FTFEDEXIOSS")
 
- 				{
 
- 				    $barcode = $this->dpdioss->get_data($fullorder);//获取联邦快递信息
 
- 					
 
- 					/** 正常
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['waybill'];
 
- 						$Hyd = $this->_pdf($barcode['yd'],'y-'.$Hwaybill,$bctime);
 
- 						if(isset($barcode['yd']) && isset($Hwaybill) && $Hwaybill != '' && $barcode['yd'] != '')
 
- 						{
 
- 						    if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>98);
 
- 							}
 
- 						}
 
- 						else
 
- 						{
 
- 							$failed = '平台可能已产生订单信息,需要查看并删除再处理错误。'.$barcode['res'];//错误提示
 
- 						    $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 						}
 
- 					}
 
- 					**/
 
- 					//临时开始
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 2;
 
- 							}
 
- 						
 
- 						
 
- 					}
 
- 					//临时结束
 
- 					else
 
- 					{
 
- 						$failed = $barcode['Description'];//错误提示
 
- 						$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 					}
 
- 				}
 
- 				// 只获取运单号不打印运单
 
- 				else if($fullorder['printcode'] == "DPDXW" || $fullorder['printcode'] == "UKDHLXW" || $fullorder['printcode'] == "FTFEDEXXW")
 
- 				{
 
- 				     $barcode = $this->dpdxw->get_data($fullorder);//获取联邦快递信息
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['waybill'];
 
- 						$Hyd = $this->_pdf($barcode['yd'],'y-'.$Hwaybill,$bctime);
 
- 						if(isset($barcode['yd']) && isset($Hwaybill) && $Hwaybill != '' && $barcode['yd'] != '')
 
- 						{
 
- 						    if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>98);
 
- 							}
 
- 						}
 
- 						else
 
- 						{
 
- 							$failed = 'DPD平台可能已产生订单信息,需要查看并删除再处理错误。'.$barcode['res'];//错误提示
 
- 						    $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						$failed = $barcode['Description'];//错误提示
 
- 						$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 					}
 
- 				}
 
- 				/**
 
- 				// 此DPD接口暂时不用
 
- 				// DPD只获取运单号不打印运单
 
- 				else if($fullorder['printcode'] == "DPD")
 
- 				{
 
- 					if($fullorder['zhou'] == '12')//欧洲
 
- 					{
 
- 						if($fullorder_name == 'fullordersmt')//速卖通9610
 
- 						{
 
- 							$fullorder['ysfs'] == '1921';
 
- 						}
 
- 						else if($fullorder_name == 'fullorder')//独立站9610
 
- 						{
 
- 							$fullorder['ysfs'] == '2021';
 
- 						}
 
- 					}
 
- 					else if($fullorder['zhou'] == '13')//非洲
 
- 					{
 
- 						$fullorder['ysfs'] == '1881';
 
- 					}
 
- 					//$fullorder['ysfs'] == '2041';//欧洲全程不包双清、税
 
- 					//$fullorder['ysfs'] == '1981';//欧洲速卖通非9610
 
- 					//$fullorder['ysfs'] == '2001';//欧洲独立站非9610
 
- 				    $barcode = $this->dpd->get_data($fullorder);//获取信息
 
- 					if($barcode['x'] == 1)//$barcode['a'] == 2 && $Hyd['a'] == 2
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['waybill'];//运单号
 
- 						if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 						$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 						if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		{
 
- 							$type = 2;
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						$failed = $barcode['Description'];
 
- 						$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 					}
 
- 				}
 
- 				**/
 
- 				/** 阿里仓联邦不打印运单模式
 
- 				else if($fullorder['printcode'] == "FEDEX" || $fullorder['printcode'] == "TOLL" || $fullorder['printcode'] == "ARAMEX")
 
- 				{
 
- 					$lj = $this->ali->get_lj($fullorder['number'],2,'订单修改');
 
- 				    $barcode = $this->ali->get_data($fullorder);//获取DHL快递信息
 
- 					//$Hyd = $this->ali->get_label($fullorder['number'],1);//目前不需要打印标签
 
- 					//1:10 X 10标签 2:A4纸 3:10X15标签 默认1
 
- 					if($barcode['a'] == 2)//$barcode['a'] == 2 && $Hyd['a'] == 2
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['number'];//运单号
 
- 						//$this->_pdfurl($Hyd['pdf'],'y-'.$Hwaybill,$bctime);//目前不需要打印标签
 
- 						if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 						$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 						if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		{
 
- 							$type = 2;
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						$failed = $barcode['m'];
 
- 						//$failed = isset($barcode['m'])?$barcode['m']:'-(此单已预报,务必先取消再允许打印)';//获取运单号错误提示
 
- 						//$failed .= isset($Hyd['m'])?$Hyd['m']:'';//获取标签错误提示
 
- 						if($fullorder['print'] == 3)
 
- 						{
 
- 							$this->$fullorder_name->save(array('libraryconfirm'=>1,'failed'=>date('Y-m-d H:i:s',time()).$failed),$va[$n]);
 
- 						}
 
- 						else
 
- 						{
 
- 						    $this->$fullorder_name->save(array('print'=>1,'failed'=>date('Y-m-d H:i:s',time()).$failed),$va[$n]);
 
- 						}
 
- 					}
 
- 				}
 
- 				**/
 
- 				else if($fullorder['printcode'] == "FEDEX" || $fullorder['printcode'] == "TOLL" || $fullorder['printcode'] == "ARAMEX")
 
- 				{
 
- 					$lj = $this->ali->get_lj($fullorder['number'],2,'订单修改');
 
- 				    $barcode = $this->ali->get_data($fullorder);//获取快递信息
 
- 					$Hyd = $this->ali->get_label($fullorder['number'],1);//目前不需要打印标签
 
- 					//1:10 X 10标签 2:A4纸 3:10X15标签 默认1
 
- 					if($barcode['a'] == 2 && $Hyd['a'] == 2)
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['number'];//运单号
 
- 						$this->_pdfurl($Hyd['pdf'],'y-'.$Hwaybill,$bctime);//上传PDF
 
- 						if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 						$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 						if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		{
 
- 							$type = 1;
 
- 							$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						//$failed = $barcode['m'];
 
- 						$failed = isset($barcode['m'])?$barcode['m']:'-(此单已预报,务必先取消再允许打印)';//获取运单号错误提示
 
- 						$failed .= isset($Hyd['m'])?$Hyd['m']:'';//获取标签错误提示
 
- 						if($fullorder['print'] == 3)
 
- 						{
 
- 							$this->$fullorder_name->save(array('libraryconfirm'=>1,'failed'=>date('Y-m-d H:i:s',time()).$failed),$va[$n]);
 
- 						}
 
- 						else
 
- 						{
 
- 						    $this->$fullorder_name->save(array('print'=>1,'failed'=>date('Y-m-d H:i:s',time()).$failed),$va[$n]);
 
- 						}
 
- 					}
 
- 				}
 
- 				else if($fullorder['printcode'] == "UPS")//接口
 
- 				{
 
- 				    $barcode = $this->ups->get_data($fullorder);//获取快递信息
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['waybill'];
 
- 						$Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
 
- 						if(isset($barcode['label']) && isset($Hwaybill))
 
- 						{
 
- 						    if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
 
- 							}
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						$failed = $barcode['Description'];//错误提示
 
- 						$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 					}
 
- 				}
 
- 				else if($fullorder['printcode'] == "DPEX" || $fullorder['printcode'] == "FedEx_2day" || $fullorder['printcode'] == "usps_priority" || $fullorder['printcode'] == 'FEDEX_G' || $fullorder['printcode'] == 'FedEx_GD')//官方FEDEX接口
 
- 				{
 
- 					if($fullorder['waybillid'] != '')
 
- 					{
 
- 						 $del = $this->cne->get_del($fullorder['waybillid']);
 
- 					}
 
- 				    $barcode = $this->cne->get_data($fullorder);
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['waybill'];
 
- 						$Hyd = $this->_pdfurl($barcode['yd'],'y-'.$Hwaybill,$bctime);
 
- 						//$Hfp = $this->_pdfurl($barcode['fp'],'f-'.$Hwaybill,$bctime);//保留PDF,不需要打印
 
- 						if(isset($barcode['yd']) && isset($Hwaybill))
 
- 						{
 
- 						    if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'waybillid'=>$barcode['waybillid'],'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 1;
 
- 								$pdfnum = ($fullorder['printcode'] == "DPEX")?2:1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>100);
 
- 							}
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						//云尚比较特殊 有时间请求500 也会在对方系统中
 
- 						//$fullorder['printnumber'] = $fullorder['printnumber'] +1;
 
- 						if(empty($barcode['Description'])){
 
- 							$this->logic_ding->sendToDing("云尚打印返回错误未保存【".$fullorder['number']."】".json_encode($barcode));
 
- 							$failed = "API接口异常,订单打印失败";//错误提示
 
- 						}else{
 
- 							$failed = $barcode['Description'];//错误提示
 
- 						}
 
- 						
 
- 						//$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed,'printnumber'=>$fullorder['printnumber']),$va[$n]);
 
- 						$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 					}
 
- 				}
 
- 				else if($fullorder['printcode'] == "HUALEIXW-FEDEX" || $fullorder['printcode'] == "HUALEIXW-GES-GB-A" || $fullorder['printcode'] == "HUALEIXW-GES-EU9610" || $fullorder['printcode'] == "HUALEIXW-TNT" || $fullorder['printcode'] == "HUALEIXW-FEDEX" || $fullorder['printcode'] == "HUALEIXW-UPS" || $fullorder['printcode'] == "HUALEIXW-FEDEX-EUROPE" || $fullorder['printcode'] == "HUALEIXW-USPS" || $fullorder['printcode'] == "HUALEIXW-DHL" || $fullorder['printcode'] == "HUALEIXW-ARAMEX"|| $fullorder['printcode'] == "HUALEIXW-HC-FEDEX")
 
- 				{
 
- 					$barcode = $this->hualeixw->get_data($fullorder);
 
- 					$bctime = date('Ymd',$time);
 
- 					if(!isset($barcode['x']))
 
- 					{
 
- 						print_r($barcode);exit;
 
- 					}
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						if($barcode['ys'] == 1)
 
- 						{
 
- 							if(!$this->yswaybill->insert(array('type'=>$fullorder_name,'express'=>'hualeixw','number'=>$fullorder['number'])))
 
-         					{
 
-          						echo json_encode(array('msg'=>'失败请重试','success'=>false));exit;
 
-        	 					}
 
- 							$bctime = date('Ymd',$time);
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$barcode['waybill'],'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   			{
 
- 								$type = 2;
 
- 							}
 
- 						}
 
- 						else
 
- 						{
 
- 						    $Hwaybill = $barcode['waybill'];
 
- 					        $Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
 
- 						    if(isset($barcode['label']) && isset($Hwaybill))
 
- 						    {
 
- 						        if($fullorder['waybill'] != "")
 
- 							    {
 
- 								    $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							    }
 
- 							    else
 
- 							    {
 
- 								    $oldwaybill = $fullorder['oldwaybill'];
 
- 							    }
 
- 							    $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							    $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							    if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	    {
 
- 									if($fullorder['printcode'] == "HUALEIXW-FEDEX")
 
- 									{
 
- 								        $type = 5;
 
- 									}
 
- 									else
 
- 									{
 
- 								        $type = 2;
 
- 									}
 
- 									$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
 
- 							    }
 
- 						    }
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						$failed = $barcode['Description'];//错误提示
 
- 						$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 					}
 
- 					
 
- 					/**
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						if($barcode['ys'] == 1)
 
- 						{
 
- 							if(!$this->yswaybill->insert(array('type'=>$fullorder_name,'express'=>'hualeixw','number'=>$fullorder['number'])))
 
-         					{
 
-          						echo json_encode(array('msg'=>'失败请重试','success'=>false));exit;
 
-        	 					}
 
- 						}
 
- 						$bctime = date('Ymd',$time);
 
- 						$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 						if($this->$fullorder_name->save(array('libraryconfirm'=>2,'librarynot'=>'','waybill'=>$barcode['waybill'],'printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		{
 
- 							$type = 2;
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						$failed = $barcode['Description'];//错误提示
 
- 						$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 					}
 
- 					**/
 
- 				}
 
- 				else if($fullorder['printcode'] == "HUALEI-FEDEX" || $fullorder['printcode'] == "HUALEI-ARAMEX-S" || $fullorder['printcode'] == "HUALEI-ARAMEX-G" || $fullorder['printcode'] == "HUALEI-GES-EU" || $fullorder['printcode'] == "HUALEI-DHL-A1" || $fullorder['printcode'] == "HUALEI-WMS"||$fullorder['printcode'] == 'HUALEI-DHL' || $fullorder['printcode'] == 'HUALEI-MLXY' || $fullorder['printcode'] == 'HUALEI-MGLB')
 
- 				{
 
- 					$barcode = $this->hualei->get_data($fullorder);
 
- 					$bctime = date('Ymd',$time);
 
- 					if(!isset($barcode['x']))
 
- 					{
 
- 						print_r($barcode);exit;
 
- 					}
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						if($barcode['ys'] == 1)
 
- 						{
 
- 							if(!$this->yswaybill->insert(array('type'=>$fullorder_name,'express'=>'hualei','number'=>$fullorder['number'])))
 
-         					{
 
-          						echo json_encode(array('msg'=>'失败请重试','success'=>false));exit;
 
-        	 					}
 
- 							$bctime = date('Ymd',$time);
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							$waybill2 = '';
 
- 							if(isset($barcode['waybill2']))
 
- 							{
 
- 								$waybill2 = $barcode['waybill2'];
 
- 							}
 
- 							if($this->$fullorder_name->save(array('waybill'=>$barcode['waybill'],'waybill2'=>$waybill2,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   			{
 
- 								$type = 2;
 
- 							}
 
- 						}
 
- 						else
 
- 						{
 
- 						    $Hwaybill = $barcode['waybill'];
 
- 					        $Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
 
- 						    if(isset($barcode['label']) && isset($Hwaybill))
 
- 						    {
 
- 						        if($fullorder['waybill'] != "")
 
- 							    {
 
- 								    $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							    }
 
- 							    else
 
- 							    {
 
- 								    $oldwaybill = $fullorder['oldwaybill'];
 
- 							    }
 
- 							    $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							    $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 								$waybill2 = '';
 
- 								if(isset($barcode['waybill2']))
 
- 								{
 
- 									$waybill2 = $barcode['waybill2'];
 
- 								}
 
- 							    if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'waybill2'=>$waybill2,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	    {
 
- 									if($fullorder['printcode'] == "HUALEI-FEDEX" || $fullorder['printcode'] == "HUALEI-MLXY" )
 
- 									{
 
- 								        //$type = 5;
 
- 										$type = 1;
 
- 									}
 
- 									else if($fullorder['printcode'] == "HUALEI-ARAMEX-G" || $fullorder['printcode'] == "HUALEI-ARAMEX-S" || $fullorder['printcode'] == "HUALEI-GES-EU")
 
- 									{
 
- 								        $type = 1;
 
- 									}
 
- 									else if($fullorder['printcode'] == "HUALEI-DHL")
 
- 									{
 
- 								        //$type = 5;
 
- 										$type = 1;
 
- 									}
 
- 									else if($fullorder['printcode'] == "HUALEI-MGLB")
 
- 									{
 
- 								        //$type = 5;
 
- 										$type = 1;
 
- 									}
 
- 									else
 
- 									{
 
- 								        $type = 2;
 
- 									}
 
- 									$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
 
- 							    }
 
- 						    }
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						$failed = $barcode['Description'];//错误提示
 
- 						$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 					}
 
- 				}
 
- 			    /** 云途开始**/
 
- 				else if(($fullorder['printcode'] == "YunExpress")||($fullorder['printcode'] =='YunExpress_BaoXian'))
 
- 				{
 
- 				// 	echo "123";
 
- 				// 	exit;
 
- 				// 	if(!empty($fullorder['waybill']))
 
- 				// 	{
 
- 				// 		$label = $this->yuntu->get_label($fullorder['number']);
 
- 				// 		if($label['x'] == 1){
 
- 				// 			$bctime = date('Ymd',$time);
 
- 				// 			$Hwaybill = $fullorder['waybill'];//运单号
 
- 				// 			$this->_pdfurl($label['url'],'y-'.$Hwaybill,$bctime);//上传PDF
 
- 				// 			$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 				// 			if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3),$va[$n]))
 
- 				// 			{
 
- 				// 					$type = 1;
 
- 				// 					$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
 
- 				// 			}
 
- 				// 		}
 
- 				// 	}
 
- 				// 	else{
 
- 						$barcode = $this->yuntu->get_data($fullorder);//获取快递信息
 
- 						// var_dump($barcode);
 
- 						if($barcode['x'] == 1){
 
- 							$bctime = date('Ymd',$time);
 
- 							$Hwaybill = $barcode['waybill'];//运单号
 
- 							$this->_pdfurl($barcode['url'],'y-'.$Hwaybill,$bctime);//上传PDF
 
- 							if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 							{
 
- 								$type = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
 
- 							}
 
- 						}else{
 
- 							$failed = $barcode['Description'].'123';//错误提示
 
- 							$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 						}
 
- 					
 
- 					//}
 
- 					
 
- 					//die;
 
- 				}
 
- 				elseif(($fullorder['printcode'] == "USKD01")){
 
- 					if($fullorder['waybillid'] != '')
 
- 					{
 
- 						 $del = $this->zxyuntu->get_del($fullorder['waybillid']);
 
- 					}
 
- 					// $send_info = $fullorder;
 
- 					// $send_info['number'] = $send_info['number']."_".$fullorder['printnumber'];
 
- 				    //$barcode = $this->zxyuntu->get_data($send_info);
 
- 					$barcode = $this->zxyuntu->get_data($fullorder);
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['waybill'];
 
- 						$Hyd = $this->_pdfurl($barcode['yd'],'y-'.$Hwaybill,$bctime);
 
- 						//$Hfp = $this->_pdfurl($barcode['fp'],'f-'.$Hwaybill,$bctime);//保留PDF,不需要打印
 
- 						if(isset($barcode['yd']) && isset($Hwaybill))
 
- 						{
 
- 						    if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'waybillid'=>$barcode['waybillid'],'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 1;
 
- 								$pdfnum = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>100);
 
- 							}
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						$failed = $barcode['Description'];//错误提示
 
- 						$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 					}
 
- 				}elseif(($fullorder['printcode'] == "3PE_XB") || ($fullorder['printcode'] == "3PE_NONBOX")){
 
- 					if($fullorder['printnumber'] > 0){
 
- 						$this->itsxb->cancel_order($fullorder['number']);
 
- 					}
 
- 					$barcode = $this->itsxb->get_data($fullorder);
 
- 					if($barcode['x'] == 1)
 
- 					{
 
- 						$bctime = date('Ymd',$time);
 
- 						$Hwaybill = $barcode['waybill'];
 
- 						$Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
 
- 						//$Hfp = $this->_pdfurl($barcode['fp'],'f-'.$Hwaybill,$bctime);//保留PDF,不需要打印
 
- 						if(isset($barcode['label']) && isset($Hwaybill))
 
- 						{
 
- 						    if($fullorder['waybill'] != "")
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 							}
 
- 							else
 
- 							{
 
- 								$oldwaybill = $fullorder['oldwaybill'];
 
- 							}
 
- 							$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 							$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 							if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'waybill2'=>$barcode['waybill2'],'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				   		 	{
 
- 								$type = 8;
 
- 								$pdfnum = 1;
 
- 								$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>100);
 
- 							}
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						$failed = $barcode['Description'];//错误提示
 
- 						$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
 
- 					}
 
- 				}
 
- 				else
 
- 				{
 
- 					$this->$fullorder_name->save(array('print'=>1,'failed'=>'未找到此快递运单接口'),$va[$n]);
 
- 				}
 
- 				if($fullorder_name == 'fullordersmt' || $fullorder_name == 'fullorder_smt')
 
- 				{
 
- 					$text['name'] = '速卖通';
 
- 				}
 
- 				else if($fullorder_name == 'fullordertt')
 
- 				{
 
- 					$text['name'] = 'TikTok';
 
- 				}
 
- 					else if($fullorder_name == 'fullorderamz')
 
- 				{
 
- 					$text['name'] = '亚马逊';
 
- 				}
 
- 				else if($fullorder_name == 'fullorderxw')
 
- 				{
 
- 					$text['name'] = '翔文';
 
- 				}
 
- 				else
 
- 				{
 
- 					$text['name'] = '独立站';
 
- 				}
 
- 				$text['express'] = $fullorder['express'];
 
- 				//$text['country'] = $fullorder['country'];
 
- 				$text['country'] = $this->logic_order->getCountry($fullorder['country']);
 
- 				$text['orderinfo'] = $fullorder['orderinfo'];
 
- 				$text['number'] = $fullorder['number'];
 
- 				$text['shipremarks'] = $fullorder['shipremarks'];
 
- 				$text['ts'] = $fullorder['ts'];
 
- 				$text['time'] = $fullorder['times'];
 
- 				$text['printnumber'] = $fullorder['printnumber'];
 
- 				$text['pdfnum'] = $pdfnum;
 
- 				$text['pt'] = $fullorder['pt'];
 
- 				$text['warehouse'] = $fullorder['warehouse']['title'];
 
- 				$text['is_jiaji'] = $fullorder['is_jiaji'];
 
- 				$rows = array('type'=>$type,'n'=>$n-1,'data'=>$v,'text'=>$text);
 
- 			    echo json_encode(array('rows'=>($rows),'success'=>true));exit;
 
- 			}
 
- 			else if(($fullorder['printtype'] == 2 || $fullorder['printtype'] == 4) && $fullorder['library'] != 2)
 
- 			{
 
-                 $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 				if($this->$fullorder_name->save(array('libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldprinttime'=>$oldprinttime),$va[$n]))
 
- 				{
 
- 					$type = 2;
 
- 				}
 
- 				if($fullorder_name == 'fullordersmt' || $fullorder_name == 'fullorder_smt')
 
- 				{
 
- 					$text['name'] = '速卖通';
 
- 				}
 
- 				else
 
- 				{
 
- 					$text['name'] = '独立站';
 
- 				}
 
- 				$text['express'] = $fullorder['express'];
 
- 				//$text['country'] = $fullorder['country'];
 
- 				$text['country'] = $this->logic_order->getCountry($fullorder['country']);
 
- 				$text['orderinfo'] = $fullorder['orderinfo'];
 
- 				$text['number'] = $fullorder['number'];
 
- 				$text['shipremarks'] = $fullorder['shipremarks'];
 
- 				$text['ts'] = $fullorder['ts'];
 
- 				$text['time'] = $fullorder['times'];
 
- 				$text['printnumber'] = $fullorder['printnumber'];
 
- 				$text['pdfnum'] = $pdfnum;
 
- 				$text['pt'] = $fullorder['pt'];
 
- 				$text['warehouse'] = $fullorder['warehouse']['title'];
 
- 				$text['is_jiaji'] = $fullorder['is_jiaji'];
 
- 				$rows = array('type'=>$fullorder['printtype'],'n'=>$n-1,'data'=>$v,'text'=>$text);
 
- 			    echo json_encode(array('rows'=>($rows),'success'=>true));exit;
 
- 			}
 
- 			else
 
- 			{
 
- 				if($fullorder_name == 'fullordersmt' || $fullorder_name == 'fullorder_smt')
 
- 				{
 
- 					$text['name'] = '速卖通';
 
- 				}
 
- 				else
 
- 				{
 
- 					$text['name'] = '独立站';
 
- 				}
 
- 				$text['express'] = $fullorder['express'];
 
- 				//$text['country'] = $fullorder['country'];
 
- 				$text['country'] = $this->logic_order->getCountry($fullorder['country']);
 
- 				$text['orderinfo'] = $fullorder['orderinfo'];
 
- 				$text['number'] = $fullorder['number'];
 
- 				$text['shipremarks'] = $fullorder['shipremarks'];
 
- 				$text['ts'] = $fullorder['ts'];
 
- 				$text['time'] = $fullorder['times'];
 
- 				$text['printnumber'] = $fullorder['printnumber'];
 
- 				$text['pdfnum'] = $pdfnum;
 
- 				$text['warehouse'] = $fullorder['warehouse']['title'];
 
- 				$text['is_jiaji'] = $fullorder['is_jiaji'];
 
- 				$rows = array('type'=>$type,'n'=>$n-1,'data'=>$v,'text'=>$text);
 
- 			    echo json_encode(array('msg'=>'该订单已出库,无法打印!','success'=>false));exit;
 
- 			}
 
- 		}
 
- 	}
 
- 	
 
- 	public function _text($fullorder)
 
-     {
 
- 		/** 发票地址信息暂时无用 
 
- 		$fullorder['baddress'] = explode(',',$fullorder['baddress']);
 
- 		$fullorder['baddress'] = array_reverse($fullorder['baddress']);
 
- 		$fullorder['baddress'][1] = $country['ename'];
 
- 		**/
 
- 		//获取所用相关信息
 
- 		$warehouse = $this->warehouse->read($fullorder['type']);
 
- 		$country = $this->country->read($fullorder['country']);//订单国家信息
 
- 		$fcountry = $this->country->read($warehouse['country']);//仓库国家信息
 
- 		$warehouse['country'] = $fcountry['ename'];//仓库国家名
 
- 		$warehouse['lb'] = $fcountry['lb'];//仓库国家编码
 
- 		$fullorder['warehouse'] = $warehouse;//仓库数据加入订单
 
- 		$fullorder['lb'] = $country['lb'];//订单国家编码加入
 
- 		$fullorder['country'] = $country['ename'];//订单国家名
 
- 		$fullorder['zhou'] = $country['continent'];//所属州
 
- 		$express = $this->express->read($fullorder['express']);
 
- 		$fullorder['express'] = $express['servicename'];
 
- 		$fullorder['account'] = $express['account'];
 
- 		$fullorder['printcode'] = $express['printcode'];
 
- 		$fullorder['time'] = date('Y-m-d',time());
 
- 		$fullorder['times'] = date('Y-m-d H:i',time());
 
- // 		$fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
 
- //      修复报关编码问题
 
- 	    $declara_info = $this->customsdeclaration->find("ename like '%".trim($fullorder['sbpm'])."%' ","*");
 
- 	
 
- 		$sbbm = "";
 
- 		if(empty($declara_info)){
 
- 			$sbbm = "";
 
- 		}else{
 
- 		    $sbbm = $declara_info['bname'];
 
- 		}
 
- 	
 
- 		$fullorder['sbbm']= $sbbm;
 
- 		$fullorder['address'] = str_replace(array('&'),array('&'),$fullorder['address']);
 
- 		$fullorder['address2'] = str_replace(array('&'),array('&'),$fullorder['address2']);
 
- 		$fullorder['shipremarks'] = str_replace(array('<','>'),array('<','>'),$fullorder['shipremarks']);
 
- 		$fullorder['shipremarks'] = str_replace(array('<','>',';',';'),array('<','>',';<br>',';<br>'),$fullorder['shipremarks']);
 
- 		$shop = $this->shop->read($fullorder['shop']);
 
- 		$fullorder['shop'] = $shop['shopname'];
 
- 		$shoptype = $this->typeclass->read($shop['type']);
 
- 		$fullorder['shoptype'] = $shoptype['classtitle'];
 
- 		$fullorder['city'] = preg_replace('/( | | |\s)/',' ',$fullorder['city']);
 
- 		$fullorder['province'] = preg_replace('/( | | |\s)/',' ',$fullorder['province']);
 
- 		if(is_numeric($fullorder['pay']))
 
- 		{
 
- 		    $pay = $this->typeclass->read($fullorder['pay']);
 
- 		    if($pay['classid'] == '4')
 
- 		    {
 
- 		        $fullorder['pay'] = $pay['title'];
 
- 		    }
 
- 		}
 
- 		if($fullorder['printcode'] != "USPS")
 
- 		{
 
- 		    $fullorder['client'] = htmlspecialchars($fullorder['client']);
 
- 		    $fullorder['name'] = htmlspecialchars($fullorder['name']);
 
- 		}
 
- 		//增加退货单所需信息
 
- 		$pt = '';
 
- 		$fpdata = explode(';',trim($fullorder['fpdata'],';'));
 
- 		foreach ($fpdata as $v) 
 
- 		{
 
- 			$p = explode('|',trim($v,'|'));
 
- 			if(isset($p[1]) && isset($p[2]))
 
- 			{
 
- 			    $pt .= '<p>'.$p[1].' * '.$p[2].'</p>';
 
- 			}
 
- 		}
 
- 		$fullorder['pt'] = $pt;
 
- 		return $fullorder;
 
-     }
 
- 	public function _pdf($pdf,$title,$bctime)
 
-     {
 
-     	$pdf_path = './data/pdf/'.$bctime.'/';
 
-         $file_base64 = $pdf; 
 
-         $file_base64 = preg_replace('/data:.*;base64,/i', '', $file_base64);  
 
-         $file_base64 = base64_decode($file_base64);
 
- 		if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建
 
-         file_put_contents($pdf_path.$title.'.pdf',$file_base64);
 
- 		return $bctime;
 
-     }
 
- 	public function _pdfurl($pdf,$title,$bctime)
 
-     {
 
-     	$pdf_path = './data/pdf/'.$bctime.'/';
 
-         $pdf = fopen($pdf,"r");
 
- 		if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建
 
-         file_put_contents($pdf_path.$title.'.pdf',$pdf);
 
- 		return $bctime;
 
-     }
 
- 	
 
- 	public function _exceldy()
 
- 	{
 
- 		if(isset($_GET['fexcel']))  
 
- 		{
 
- 			if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $fgshop = "";$sid = "";$wid="";$wtype="";
 
- 		    $usersp = explode('|',trim($user['shop'],'|'));
 
- 			$userwh = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($usersp as $value) 
 
- 		    {
 
- 				$fgshop .= " shop = ".$value." or";
 
- 				$sid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($userwh as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 				$wtype .= " type = ".$value." or";
 
- 			}
 
- 		}
 
- 		$dowid = $this->input->get('a');
 
- 			$wid = "";
 
- 			if($dowid != "")
 
- 			{
 
- 				$id_arr =  explode(',',rtrim($dowid,','));
 
- 				foreach ($id_arr as $v) 
 
- 		        {
 
-                     $wid  .= " id = '$v' or";
 
-                 }
 
- 				$wid = " and (".rtrim($wid,'or').")";
 
- 			}
 
- 		    $page = $this->input->get('page',true);
 
- 		    $perpage = $this->input->get('perpage',true);
 
- 			$timetk = $this->input->get('timetk',true);
 
- 			$timetj = $this->input->get('timetj',true);
 
- 			$shop = $this->input->get('shop',true);
 
- 			$print = $this->input->get('print',true);
 
- 			$express = $this->input->get('express',true);
 
- 			$waybill = $this->input->get('waybill',true);
 
- 			$printtype = $this->input->get('printtype',true);
 
- 			$orderinfo = $this->input->get('orderinfo',true);
 
- 			$number = $this->input->get('number',true);
 
-             $type = $this->input->get('type',true);
 
- 			$lowe = $this->input->get('lowe',true);
 
- 			$info = $this->input->get('info',true);
 
- 			$ji = $this->input->get('ji',true);
 
- 			$so = $this->input->get('so',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$where = (isset($_SESSION['api']))?"(state = '207' or state = '209') and (".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
 
- 			    if($print == 3)
 
-                 {
 
-                     $where  .= " and printtime > '$timetk' and printtime < '$timetj' and print = '3' and library = 1";
 
-                 }
 
- 			    else
 
- 			    {
 
- 				    $where  .= " and express != 0 and printtype != 3 and printtype > 0 and print = 2 and review > 4 and library = 1 and reviewtime > '".(time() - 30*24*3600)."'";
 
- 			    }
 
- 			if($shop)
 
-             {
 
-                 $where  .= " and shop = '$shop'";
 
-             }
 
- 			if($express)
 
-             {
 
- 				$where  .= " and express = '$express'";
 
-             }
 
- 			if($printtype)
 
-             {
 
-                 $where  .= " and printtype = '$printtype'";
 
-             }
 
- 			if($orderinfo)
 
-             {
 
-                 $where  .= " and orderinfo = '$orderinfo'";
 
-             }
 
- 			if($number)
 
-             {
 
-                 $where  .= " and number = '$number'";
 
-             }
 
- 			if($waybill)
 
-             {
 
-                 $where  .= " and waybill = '$waybill'";
 
-             }
 
- 			if($type)
 
-             {
 
- 				$where  .= " and type = '$type'";
 
- 			}
 
- 			else
 
- 			{
 
- 				$where  .= " and type != '16'";
 
- 			}
 
- 			/**
 
-             if($type)
 
-             {
 
- 				if($type != '4')
 
- 				{
 
- 					$where  .= " and type = '$type'";
 
- 					$where2 = '';
 
- 					$where3 = '';
 
- 				}
 
- 				else
 
- 				{
 
- 					$where2 = " and type = '4' and (wigs = '3' or wigs = '8') and issku not like '%#pack%'";
 
- 					$where3 = " and type = '4' and (wigs = '3' or wigs = '8') and sku not like '%#pack%'";
 
- 				}
 
- 				$where_a = "";
 
- 				$where_b = "";
 
-             }
 
- 			else
 
- 			{
 
- 				$where  .= " and type != '4'";
 
- 				$where_a = "(";
 
- 				$where_b = ")";
 
- 				$where2 = " or (type = '4' and (wigs = '3' or wigs = '8') and issku not like '%#pack%')";
 
- 				$where3 = " or (type = '4' and (wigs = '3' or wigs = '8') and sku not like '%#pack%')";
 
- 			}
 
- 			**/
 
- 			if($lowe)
 
-             {
 
-                 $where  .= " and fpdata like '%-$lowe-%'";
 
-             }
 
- 			if($ji)
 
-             {
 
-                 $where  .= " and shipremarks like '%急%'";
 
-             }
 
- 			if($so)
 
-             {
 
-                 $where  .= " and shipremarks like '%$so%'";
 
-             }
 
-             
 
-              //数据排序
 
-             $order_str = ($print != 3)?"id desc":"printtime desc";
 
-             //取得信息列表
 
-             $info_list = $this->fullorder->find_all($where.$wid,'shop,type,orderinfo,number,waybill,express,print,printnumber,library,printtime,printtype,shipremarks,ts',$order_str);
 
- 			 //格式化数据
 
-             foreach ($info_list as $key=>$value) 
 
- 		    {
 
- 				$shop = $this->shop->read($value['shop']);
 
- 				$info_list[$key]['shop'] = $shop['shopname'];
 
- 				if($value['waybill'] == '0')
 
- 				{
 
- 					$info_list[$key]['waybill'] = "";
 
- 				}
 
- 				$express = $this->express->read($value['express']);
 
- 				$info_list[$key]['express'] = $express['servicename'];
 
- 				$warehouse = $this->warehouse->read($value['type']);
 
- 				$info_list[$key]['type'] = $warehouse['title'];
 
- 				if($value['printtime'] == '0')
 
- 				{
 
- 					$info_list[$key]['printtime'] = '<em class="t"></em>';
 
- 				}
 
- 				else
 
- 				{
 
- 					$info_list[$key]['printtime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['printtime']).'</em>';
 
- 				}
 
- 				if($value['print'] == 1)
 
- 				{
 
- 					$info_list[$key]['print'] = '不可打印';
 
- 				}
 
- 				else if($value['print'] == 2)
 
- 				{
 
- 					$info_list[$key]['print'] = '未打印';
 
- 				}
 
- 				else if($value['print'] == 3)
 
- 				{
 
- 					$info_list[$key]['print'] = '已打印';
 
- 				}
 
- 				if($value['library'] == 1)
 
- 				{
 
- 					$info_list[$key]['library'] = '<em class="c">未出库</em>';
 
- 				}
 
- 				else if($value['library'] == 2)
 
- 				{
 
- 					$info_list[$key]['library'] = '<em class="c">已出库</em>';
 
- 				}
 
- 				else if($value['library'] == 3)
 
- 				{
 
- 					$info_list[$key]['library'] = '<em class="c">已退库</em>';
 
- 				}
 
- 				if($value['printtype'] == 1){
 
- 				    $info_list[$key]['printtype'] = '运单';
 
- 				}elseif($value['printtype'] == 2){
 
- 				     $info_list[$key]['printtype'] = '发货单';
 
- 				}else{
 
- 				     $info_list[$key]['printtype'] = '不打印单据';
 
- 				}
 
- 				//$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('<','>'),$value['shipremarks']);
 
-             }
 
- 			//取得信息列表
 
-             $info_listsmt = $this->fullordersmt->find_all($where.$wid,'shop,type,orderinfo,number,waybill,express,print,printnumber,library,printtime,printtype,shipremarks,ts',$order_str);
 
- 			 //格式化数据
 
-             foreach ($info_listsmt as $key=>$value) 
 
- 		    {
 
- 				$shop = $this->shop->read($value['shop']);
 
- 				$info_listsmt[$key]['shop'] = $shop['shopname'];
 
- 				if($value['waybill'] == '0')
 
- 				{
 
- 					$info_listsmt[$key]['waybill'] = "";
 
- 				}
 
- 				$express = $this->express->read($value['express']);
 
- 				$info_listsmt[$key]['express'] = $express['servicename'];
 
- 				$warehouse = $this->warehouse->read($value['type']);
 
- 				$info_listsmt[$key]['type'] = $warehouse['title'];
 
- 				if($value['printtime'] == '0')
 
- 				{
 
- 					$info_listsmt[$key]['printtime'] = '<em class="t"></em>';
 
- 				}
 
- 				else
 
- 				{
 
- 					$info_listsmt[$key]['printtime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['printtime']).'</em>';
 
- 				}
 
- 				if($value['print'] == 1)
 
- 				{
 
- 					$info_listsmt[$key]['print'] = '不可打印';
 
- 				}
 
- 				else if($value['print'] == 2)
 
- 				{
 
- 					$info_listsmt[$key]['print'] = '未打印';
 
- 				}
 
- 				else if($value['print'] == 3)
 
- 				{
 
- 					$info_listsmt[$key]['print'] = '已打印';
 
- 				}
 
- 				if($value['library'] == 1)
 
- 				{
 
- 					$info_listsmt[$key]['library'] = '<em class="c">未出库</em>';
 
- 				}
 
- 				else if($value['library'] == 2)
 
- 				{
 
- 					$info_listsmt[$key]['library'] = '<em class="c">已出库</em>';
 
- 				}
 
- 				else if($value['library'] == 3)
 
- 				{
 
- 					$info_listsmt[$key]['library'] = '<em class="c">已退库</em>';
 
- 				}
 
- 				if($value['printtype'] == 1){
 
- 				     $info_listsmt[$key]['printtype'] = '运单';
 
- 				}elseif($value['printtype'] == 2){
 
- 				     $info_listsmt[$key]['printtype'] = '发货单';
 
- 				}else{
 
- 				     $info_listsmt[$key]['printtype'] = '不打印单据';
 
- 				}
 
- 				//$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('<','>'),$value['shipremarks']);
 
-             }
 
- 			
 
- 			 $info_listtt = $this->fullordertt->find_all($where.$wid,'shop,type,orderinfo,number,waybill,express,print,printnumber,library,printtime,printtype,shipremarks,ts',$order_str);
 
- 			 //格式化数据
 
-             foreach ($info_listtt as $key=>$value) 
 
- 		    {
 
- 				$shop = $this->shop->read($value['shop']);
 
- 				$info_listtt[$key]['shop'] = $shop['shopname'];
 
- 				if($value['waybill'] == '0')
 
- 				{
 
- 					$info_listtt[$key]['waybill'] = "";
 
- 				}
 
- 				$express = $this->express->read($value['express']);
 
- 				$info_listtt[$key]['express'] = $express['servicename'];
 
- 				$warehouse = $this->warehouse->read($value['type']);
 
- 				$info_listtt[$key]['type'] = $warehouse['title'];
 
- 				if($value['printtime'] == '0')
 
- 				{
 
- 					$info_listtt[$key]['printtime'] = '<em class="t"></em>';
 
- 				}
 
- 				else
 
- 				{
 
- 					$info_listtt[$key]['printtime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['printtime']).'</em>';
 
- 				}
 
- 				if($value['print'] == 1)
 
- 				{
 
- 					$info_listtt[$key]['print'] = '不可打印';
 
- 				}
 
- 				else if($value['print'] == 2)
 
- 				{
 
- 					$info_listtt[$key]['print'] = '未打印';
 
- 				}
 
- 				else if($value['print'] == 3)
 
- 				{
 
- 					$info_listtt[$key]['print'] = '已打印';
 
- 				}
 
- 				if($value['library'] == 1)
 
- 				{
 
- 					$info_listtt[$key]['library'] = '<em class="c">未出库</em>';
 
- 				}
 
- 				else if($value['library'] == 2)
 
- 				{
 
- 					$info_listtt[$key]['library'] = '<em class="c">已出库</em>';
 
- 				}
 
- 				else if($value['library'] == 3)
 
- 				{
 
- 					$info_listtt[$key]['library'] = '<em class="c">已退库</em>';
 
- 				}
 
- 				if($value['printtype'] == 1){
 
- 				     $info_listtt[$key]['printtype'] = '运单';
 
- 				}elseif($value['printtype'] == 2){
 
- 				     $info_listtt[$key]['printtype'] = '发货单';
 
- 				}else{
 
- 				     $info_listtt[$key]['printtype'] = '不打印单据';
 
- 				}
 
- 				//$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('<','>'),$value['shipremarks']);
 
-             }
 
-             
 
-             
 
-              $info_listamz = $this->fullorderamz->find_all($where.$wid,'shop,type,orderinfo,number,waybill,express,print,printnumber,library,printtime,printtype,shipremarks,ts',$order_str);
 
- 			 //格式化数据
 
-             foreach ($info_listamz as $key=>$value) 
 
- 		    {
 
- 				$shop = $this->shop->read($value['shop']);
 
- 				$info_listamz[$key]['shop'] = $shop['shopname'];
 
- 				if($value['waybill'] == '0')
 
- 				{
 
- 					$info_listamz[$key]['waybill'] = "";
 
- 				}
 
- 				$express = $this->express->read($value['express']);
 
- 				$info_listamz[$key]['express'] = $express['servicename'];
 
- 				$warehouse = $this->warehouse->read($value['type']);
 
- 				$info_listamz[$key]['type'] = $warehouse['title'];
 
- 				if($value['printtime'] == '0')
 
- 				{
 
- 					$info_listamz[$key]['printtime'] = '<em class="t"></em>';
 
- 				}
 
- 				else
 
- 				{
 
- 					$info_listamz[$key]['printtime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['printtime']).'</em>';
 
- 				}
 
- 				if($value['print'] == 1)
 
- 				{
 
- 					$info_listamz[$key]['print'] = '不可打印';
 
- 				}
 
- 				else if($value['print'] == 2)
 
- 				{
 
- 					$info_listamz[$key]['print'] = '未打印';
 
- 				}
 
- 				else if($value['print'] == 3)
 
- 				{
 
- 					$info_listamz[$key]['print'] = '已打印';
 
- 				}
 
- 				if($value['library'] == 1)
 
- 				{
 
- 					$info_listamz[$key]['library'] = '<em class="c">未出库</em>';
 
- 				}
 
- 				else if($value['library'] == 2)
 
- 				{
 
- 					$info_listamz[$key]['library'] = '<em class="c">已出库</em>';
 
- 				}
 
- 				else if($value['library'] == 3)
 
- 				{
 
- 					$info_listamz[$key]['library'] = '<em class="c">已退库</em>';
 
- 				}
 
- 				if($value['printtype'] == 1){
 
- 				     $info_listamz[$key]['printtype'] = '运单';
 
- 				}elseif($value['printtype'] == 2){
 
- 				     $info_listamz[$key]['printtype'] = '发货单';
 
- 				}else{
 
- 				     $info_listamz[$key]['printtype'] = '不打印单据';
 
- 				}
 
- 				//$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('<','>'),$value['shipremarks']);
 
-             }
 
-             
 
-             
 
-             
 
-             
 
-             
 
- 			 $info_listxw = $this->fullorderxw->find_all($where.$wid,'shop,type,orderinfo,number,waybill,express,print,printnumber,library,printtime,printtype,shipremarks,ts',$order_str);
 
- 			 //格式化数据
 
-             foreach ($info_listxw as $key=>$value) 
 
- 		    {
 
- 				$shop = $this->shop->read($value['shop']);
 
- 				$info_listxw[$key]['shop'] = $shop['shopname'];
 
- 				if($value['waybill'] == '0')
 
- 				{
 
- 					$info_listxw[$key]['waybill'] = "";
 
- 				}
 
- 				$express = $this->express->read($value['express']);
 
- 				$info_listxw[$key]['express'] = $express['servicename'];
 
- 				$warehouse = $this->warehouse->read($value['type']);
 
- 				$info_listxw[$key]['type'] = $warehouse['title'];
 
- 				if($value['printtime'] == '0')
 
- 				{
 
- 					$info_listxw[$key]['printtime'] = '<em class="t"></em>';
 
- 				}
 
- 				else
 
- 				{
 
- 					$info_listxw[$key]['printtime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['printtime']).'</em>';
 
- 				}
 
- 				if($value['print'] == 1)
 
- 				{
 
- 					$info_listxw[$key]['print'] = '不可打印';
 
- 				}
 
- 				else if($value['print'] == 2)
 
- 				{
 
- 					$info_listxw[$key]['print'] = '未打印';
 
- 				}
 
- 				else if($value['print'] == 3)
 
- 				{
 
- 					$info_listxw[$key]['print'] = '已打印';
 
- 				}
 
- 				if($value['library'] == 1)
 
- 				{
 
- 					$info_listxw[$key]['library'] = '<em class="c">未出库</em>';
 
- 				}
 
- 				else if($value['library'] == 2)
 
- 				{
 
- 					$info_listxw[$key]['library'] = '<em class="c">已出库</em>';
 
- 				}
 
- 				else if($value['library'] == 3)
 
- 				{
 
- 					$info_listxw[$key]['library'] = '<em class="c">已退库</em>';
 
- 				}
 
- 				if($value['printtype'] == 1){
 
- 				     $info_listxw[$key]['printtype'] = '运单';
 
- 				}elseif($value['printtype'] == 2){
 
- 				     $info_listxw[$key]['printtype'] = '发货单';
 
- 				}else{
 
- 				     $info_listxw[$key]['printtype'] = '不打印单据';
 
- 				}
 
- 				//$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('<','>'),$value['shipremarks']);
 
-             }
 
-             $title = '订单出库-'.date('Ymd',time());
 
-             $titlename = "<table border=1><td>店铺名称</td><td>仓库</td><td>订单号</td><td>编号</td><td>运单号</td><td>快递</td><td>类型</td><td>打印次数</td><td>打印类型</td><td>状态</td><td>打印时间</td><td>仓库品名</td><td>条数</td></table>";
 
- 			$tail = "\n";
 
-             $filename = $title.".xls";
 
-             $this->excel->get_fz2(array_merge($info_list,$info_listamz,$info_listsmt,$info_listtt,$info_listxw),$titlename,$filename,$tail);
 
- 		}
 
- 	}
 
- 	
 
- 	public function _barcode()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $fgshop = "";$sid = "";$wid="";$wtype="";
 
- 		    $usersp = explode('|',trim($user['shop'],'|'));
 
- 			$userwh = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($usersp as $value) 
 
- 		    {
 
- 				$fgshop .= " shop = ".$value." or";
 
- 				$sid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($userwh as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 				$wtype .= " type = ".$value." or";
 
- 			}
 
- 		}
 
- 		if(isset($post['page']))  
 
- 		{
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			$warehouse = $this->input->post('warehouse',true);
 
- 			$sku = $this->input->post('sku ',true);
 
- 			$title = $this->input->post('title',true);
 
- 			$print = $this->input->post('print ',true);
 
- 			$timetk = $this->input->post('timetk',true);
 
- 			$timetj = $this->input->post('timetj',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$where = "time > '$timetk' and time < '$timetj'";
 
- 			if($warehouse)
 
-             {
 
-                 $where  .= " and warehouse = '$warehouse'";
 
-             }
 
- 			if($sku)
 
-             {
 
- 				$where  .= " and sku like '%$sku%'";
 
-             }
 
- 			if($title)
 
-             {
 
- 				$where  .= " and title like '%$title%'";
 
-             }
 
- 			if($print)
 
-             {
 
-                 $where  .= " and print = '$print'";
 
-             }
 
-             //数据排序
 
-             $order_str = "time desc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
- 			
 
-             //取得信息列表
 
-             $info_list = $this->whlabelbarcodeprint->find_all($where,'id,sku,title,num,printtime',$order_str,$start,$perpage);
 
- 			 //格式化数据
 
-             foreach ($info_list as $key=>$value) 
 
- 		    {
 
- 				if($value['printtime'] > 0)
 
- 				{
 
- 					$info_list[$key]['printtime'] = date("Y-m-d H:i:s",$value['printtime']);
 
- 				}
 
- 				else
 
- 				{
 
- 					$info_list[$key]['printtime'] = '未打印';
 
- 				}
 
-             }
 
- 			$total = $this->whlabelbarcodeprint->find_count($where);
 
- 		    $pagenum = ceil($total/$perpage);
 
- 		    $over = $total-($start+$perpage);
 
- 		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
 
- 		    echo json_encode($rows);exit;
 
- 		}
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
 
- 		    $this->data['warehouse'] = $warehouse;
 
- 		}
 
- 		$this->_Template('systemprint_barcode',$this->data);
 
- 	}
 
- 	
 
- 	public function _barcodedc()
 
- 	{
 
- 		if(isset($_GET['excel']))  
 
- 		{
 
- 			$warehouse = $this->input->post('warehouse',true);
 
- 			$sku = $this->input->post('sku ',true);
 
- 			$title = $this->input->post('title',true);
 
- 			$print = $this->input->post('print ',true);
 
- 			$ktime = $this->input->post('timetk',true);
 
- 			$jtime = $this->input->post('timetj',true);
 
- 			$ktime = strtotime($ktime);
 
- 			$jtime = strtotime($jtime);
 
- 			$where = "time > '$timetk' and time < '$timetj'";
 
- 			if($warehouse)
 
-             {
 
-                 $where  .= " and warehouse = '$warehouse'";
 
-             }
 
- 			if($sku)
 
-             {
 
- 				$where  .= " and sku like '%$sku%'";
 
-             }
 
- 			if($title)
 
-             {
 
- 				$where  .= " and title like '%$title%'";
 
-             }
 
- 			if($print)
 
-             {
 
-                 $where  .= " and print = '$print'";
 
-             }
 
-             $order_str = "time desc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
-            
 
- 				$info_list = $this->whlabelbarcodeprint->find_all($where,'label,sku,title',$order_str);
 
- 			   
 
- 				$title = '标签-'.date('Y-m-d H-i-s',time()); 
 
-                 $titlename = "<table border=1>
 
-                 <tr align='center'>
 
- 				<td>条码号</td>
 
- 			    <td>SKU</td>
 
-                 <td>产品名称</td>
 
-                 </tr>
 
-                 </table>"; 
 
-                 $filename = $title.".xls";
 
- 			    $tail = "";
 
-                 $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
 
- 			
 
- 	    }
 
- 	}
 
- 	
 
- 	public function _barcodedr()
 
- 	{
 
- 		$dir = '/data/excel/'.date('Ymd',time()).'/';
 
- 		$config['upload_path'] = '.'.$dir ;
 
- 		$config['file_name'] = date('Ymd_His_',time()).rand(1000,9999);
 
-         $config['allowed_types'] = 'xls|xlsx|csv';
 
-         $config['max_size'] = 10240;
 
- 		$this->load->library('upload', $config);
 
- 		$this->upload->initialize($config);
 
-         if ($this->upload->do_upload('userfile'))
 
-         {
 
- 			$full_path = $dir.$this->upload->data('file_name');
 
- 			$fileName = '.' . $full_path;
 
-             if (!file_exists($fileName)) 
 
- 			{
 
- 				echo json_encode(array('msg'=>"上传失败,请重试",'success'=>false));exit;
 
-             }
 
- 			else
 
- 			{
 
- 				libxml_use_internal_errors(true);
 
- 				require_once "./data/excel/PHPExcel/IOFactory.php";
 
- 				$phpExcel = PHPExcel_IOFactory::load($fileName);// 载入当前文件
 
- 				$phpExcel->setActiveSheetIndex(0);// 设置为默认表
 
- 				$sheetCount = $phpExcel->getSheetCount();// 获取表格数量
 
- 				$row = $phpExcel->getActiveSheet()->getHighestRow();// 获取行数
 
- 				$column = $phpExcel->getActiveSheet()->getHighestColumn();// 获取列数
 
- 				++$column;//如果列数大于26行
 
- 				$list = array();
 
- 				for ($i = 2; $i <= $row; $i++) // 行数循环
 
- 				{
 
- 					$data = array();
 
-                     for ($c = 'A'; $c != $column; $c++)  // 列数循环
 
- 	                {
 
- 						$data[] = $phpExcel->getActiveSheet()->getCell($c . $i)->getValue();
 
-                     }
 
- 					$list[] = $data;
 
-                 }
 
- 			}
 
- 			$i = 0;$j = 0;$ed = array();
 
- 		    foreach ($list as $key=>$value)
 
- 		    {
 
- 				$time = time();
 
- 				if($value['0'] == "")
 
- 				{
 
- 					continue;
 
- 				}
 
- 				$label =  $value['0'];
 
- 				$sku =  $value['1'];
 
- 				$title =  $value['2'];
 
- 				$num =  $value['3'];
 
- 				$d = $this->whlabelbarcode->get_skulabel($sku,$label);
 
- 				if(!$d)//如果没有这个SKU
 
- 				{
 
- 					$ed[] = array($sku.'-库存中不存在此SKU');
 
- 					$j++;
 
- 					continue;
 
- 				}
 
- 				if($num < 1)
 
- 				{
 
- 					$ed[] = array($sku.'-数量错误!');
 
- 					$j++;
 
- 					continue;
 
- 				}
 
- 				unset($d['id']);
 
- 				$d['time'] = $time;
 
- 				$d['num'] = $num;
 
- 				$this->whlabelbarcodeprint->insert($d);
 
- 			}
 
- 			if($j > 0)
 
- 			{
 
- 				$tt = date('Ymd',time());
 
- 				$title = '库存导入错误信息-'.$tt;
 
-         		$titlename = "<table border=1><tr><td>错误详情</td></tr></table>";
 
- 				$tail = "\n";
 
-         		$filename = $title.".xls";
 
-         		$ecl = $this->excel->get_fz3($ed,$titlename,$filename,$tail);
 
- 				$dir = '/data/excel/'.$time.'/';
 
- 				$file_name = 'error_'.$time.rand(1000,9999);
 
- 				if(!is_dir('.'.$dir))mkdir('.'.$dir,0777);
 
- 				$myfile = fopen(".".$dir.$file_name.".xls", "w") or die();
 
- 				fwrite($myfile,$ecl);
 
- 				fclose($myfile);
 
- 				$error = $dir.$file_name.'.xls';
 
- 				echo json_encode(array('msg'=>'导入成功,'.$j.'条异常,','error'=>$error,'success'=>true));exit;
 
- 			}
 
- 			else
 
- 			{
 
- 				echo json_encode(array('msg'=>'导入成功!','error'=>1,'success'=>true));exit;
 
- 			}
 
- 		}
 
- 	}
 
- 	public function _yswaybill()
 
- 	{
 
- 		$data = $this->yswaybill->find_all("waybill = ''");
 
- 		foreach ($data as $v) 
 
- 		{
 
- 			$type = $v['type'];
 
- 			$number = $v['number'];
 
- 			$express = $v['express'];
 
- 			$fullorder = $this->$type->get_number($number);
 
- 			$fullorder = $this->_text($fullorder);
 
- 			$barcode = $this->$express->get_hqwaybill($number);
 
- 			if(!isset($barcode['x']))
 
- 			{
 
- 				continue;
 
- 			}
 
- 			if($barcode['x'] == 1)
 
- 			{
 
- 				if($barcode['ys'] != 1)
 
- 				{
 
- 					$this->db->trans_begin();
 
- 					$this->$type->save(array('waybill'=>$barcode['waybill']),$fullorder['id']);
 
- 					$this->yswaybill->save(array('waybill'=>$barcode['waybill'],'time'=>time()),$v['id']);
 
- 					if ($this->db->trans_status() === TRUE)
 
-         			{
 
- 						$this->db->trans_commit();
 
- 					}
 
- 					else
 
- 					{
 
- 						$this->db->trans_rollback();
 
- 					}
 
- 				}
 
- 			}
 
- 			else
 
- 			{
 
- 				$this->yswaybill->save(array('cw'=>$barcode['Description'],'time'=>time()),$v['id']);
 
- 			}
 
- 		}
 
- 		echo 1;
 
- 	}
 
- 	/**
 
- 	 * 根据发货单打印快递
 
- 	 */
 
- 	public function _printbyfh(){
 
- 		$this->_Template('systemprint_fhd',$this->data);
 
- 	}
 
- 	/**
 
- 	 * 此方法是为了临时解决一下打印的问题
 
- 	 */
 
- 	public function _getInfoByNumber(){
 
- 		$param = $this->input->get(NULL, TRUE);
 
- 		if(empty($param['number'])){
 
- 			$param = $this->input->post(NULL, TRUE);
 
- 		}
 
- 		
 
- 		if(empty($param['number'])){
 
- 			 echo json_encode([
 
- 				'code'=>-1,
 
- 				'msg'=>"订单编码未传递",
 
- 				'data'=>[]
 
- 			],JSON_UNESCAPED_UNICODE);
 
- 			die;
 
- 		}
 
- 		$this->logic_ding->sendToDing("扫面发货单出运单订单编码".json_encode($param));
 
- 		$info = $this->logic_order->getInfo("number = '".$param['number']."'");
 
- 		if(empty($info)){
 
- 			echo json_encode([
 
- 				'code'=>-1,
 
- 				'msg'=>"未查询到订单信息",
 
- 				'data'=>[]
 
- 			],JSON_UNESCAPED_UNICODE);
 
- 			die;
 
- 		}
 
- 		if($info['library'] ==2 ){
 
- 			echo json_encode([
 
- 				'code'=>-1,
 
- 				'msg'=>"该订单已出库!",
 
- 				'data'=>[]
 
- 			],JSON_UNESCAPED_UNICODE);
 
- 			die;
 
- 		}
 
- 		if(empty($param['is_ok'])){
 
- 			if($info['printnumber'] > 1){
 
- 				echo json_encode([
 
- 					'code'=>2,
 
- 					'msg'=>'该单共打印过<b style="color:red;">'.$info['printnumber'].'</b>次,请核对当前发货单是否是最新发货单',
 
- 					'data'=>[
 
- 						'number'=>$info['number'],
 
- 						'is_ok'=>1
 
- 					]
 
- 				],JSON_UNESCAPED_UNICODE);
 
- 				die;
 
- 			}
 
- 		}
 
- 		if(!in_array($info['express'],[71])){
 
- 			echo json_encode([
 
- 				'code'=>-1,
 
- 				'msg'=>"快递不符合打印要求",
 
- 				'data'=>[]
 
- 			],JSON_UNESCAPED_UNICODE);
 
- 			die;
 
- 		}
 
- 		$fullorder_name =  $info['lv_platform'];
 
- 		if($info['libraryconfirm'] == 1){
 
- 			echo json_encode([
 
- 				'code'=>-1,
 
- 				'msg'=>"该订单不允许出库:".$info['librarynot'],
 
- 				'data'=>[]
 
- 			],JSON_UNESCAPED_UNICODE);
 
- 			die;
 
- 		}
 
- 		if($info['library'] == 3){
 
- 			echo json_encode([
 
- 				'code'=>-1,
 
- 				'msg'=>"该订单已退库!",
 
- 				'data'=>[]
 
- 			],JSON_UNESCAPED_UNICODE);
 
- 			die;
 
- 		}
 
- 		
 
- 		$fullorder = $this->_text($info);//获取所需信息
 
- 		$this->logic_ding->sendToDing("打印快递单,订单的信息".json_encode($fullorder,JSON_UNESCAPED_UNICODE));
 
- 		//美仓不需要海关报关信息,
 
- 		if($fullorder['type'] != 5){
 
- 			//中国发货的 目前是dhl需要海关申报编码
 
- 			if(empty($fullorder['sbbm'])){
 
- 				echo json_encode([
 
- 					'code'=>-1,
 
- 					'msg'=>$fullorder['number'].' 海关申报配置异常,请提交给技术处理'.$fullorder['sbbm'],
 
- 					'data'=>[]
 
- 				],JSON_UNESCAPED_UNICODE);
 
- 				die;
 
- 			}
 
- 		}
 
- 		$time = time();
 
- 		$oldprinttime = ($fullorder['printtime'] > 0)?$fullorder['oldprinttime'].$fullorder['printtime'].'-':'';
 
- 		$fullorder['printtime'] = date('m-d H:i',$time);//打印用时间、发货单用,不能删
 
- 		$pdfnum = 1;//PDF打印几遍
 
- 		
 
- 		if($fullorder['waybillid'] != '')
 
- 		{
 
- 			$del = $this->cne->get_del($fullorder['waybillid']);
 
- 		}
 
- 		$barcode = $this->cne->get_data($fullorder);
 
- 		$this->logic_ding->sendToDing("扫面发货单出运单".json_encode($barcode,JSON_UNESCAPED_UNICODE));
 
- 		if($barcode['x'] == 1)
 
- 		{
 
- 			$bctime = date('Ymd',$time);
 
- 			$Hwaybill = $barcode['waybill'];
 
- 			$Hyd = $this->_pdfurl($barcode['yd'],'y-'.$Hwaybill,$bctime);
 
- 			//$Hfp = $this->_pdfurl($barcode['fp'],'f-'.$Hwaybill,$bctime);//保留PDF,不需要打印
 
- 			if(isset($barcode['yd']) && isset($Hwaybill))
 
- 			{
 
- 				if($fullorder['waybill'] != "")
 
- 				{
 
- 					$oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
 
- 				}
 
- 				else
 
- 				{
 
- 					$oldwaybill = $fullorder['oldwaybill'];
 
- 				}
 
- 				$oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
 
- 				$fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
 
- 				if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'waybillid'=>$barcode['waybillid'],'printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$info['id']))
 
- 				{
 
- 					$text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>100);
 
- 					$this->logic_ding->sendToDing("扫面发货单出运单的text".json_encode($text,JSON_UNESCAPED_UNICODE));
 
- 					echo json_encode([
 
- 						'code'=>1,
 
- 						'msg'=>"ok",
 
- 						'data'=>$text
 
- 					],JSON_UNESCAPED_UNICODE);
 
- 					die;
 
- 				}else{
 
- 					echo json_encode([
 
- 						'code'=>-1,
 
- 						'msg'=>"订单信息保存异常",
 
- 						'data'=>[]
 
- 					],JSON_UNESCAPED_UNICODE);
 
- 					die;
 
- 				}
 
- 			}
 
- 		}
 
- 		else
 
- 		{
 
- 			$failed = $barcode['Description'];//错误提示
 
- 			//$fullorder['printnumber'] = $fullorder['printnumber'] +1;
 
- 			//$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed,'printnumber'=>$fullorder['printnumber']),$info['id']);
 
- 			$this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$info['id']);
 
- 			echo json_encode([
 
- 				'code'=>-1,
 
- 				'msg'=>$failed,
 
- 				'data'=>[]
 
- 			],JSON_UNESCAPED_UNICODE);
 
- 			die;
 
- 		}
 
- 		echo json_encode([
 
- 			'code'=>-1,
 
- 			'msg'=>"执行订单异常,请联系技术",
 
- 			'data'=>[]
 
- 		],JSON_UNESCAPED_UNICODE);
 
- 		die;
 
- 	}
 
- }
 
 
  |