| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959 | 
							- <?php defined('BASEPATH') OR exit('No direct script access allowed');
 
- class Transfer extends Start_Controller {
 
- 	public function __construct(){
 
- 		parent::__construct();
 
- 		$this->load->library('session');
 
- 		$this->load->_model('Model_user','user');
 
- 		$this->load->_model('Model_transfer','transfer');
 
- 		$this->load->_model('Model_typeclass','typeclass');
 
- 		$this->load->_model('Model_warehouse','warehouse');
 
- 		$this->load->_model('Model_systemtransfer','systemtransfer');
 
- 		$this->load->_model('Model_excel','excel');
 
- 		$this->load->_model('Model_fullorder','fullorder');
 
- 		$this->load->_model('Model_fullordertt','fullordertt');
 
- 		$this->load->_model('Model_fullordersmt','fullordersmt');
 
- 		$this->load->_model('Model_purchase','purchase');
 
- 		$this->load->_model('Model_classid','classid');
 
- 		$this->load->_model('Model_express','express');
 
- 		$this->load->_model('Model_apiyy','apiyy');
 
- 		$this->load->_model('Model_shop','shop');
 
- 		$this->load->_model('Model_systemtransfer_cr','systemtransfer_cr');
 
- 		$this->load->_model("Model_logic_ding","logic_ding");
 
- 	}
 
- 	//定义方法的调用规则 获取URI第二段值
 
-     public function _remap($arg,$arg_array)
 
-     {
 
- 		if($arg == 'add')
 
-         {
 
-              $this->_add();
 
-         }
 
- 		else if($arg == 'edit')
 
-         {
 
-              $this->_edit($arg_array);
 
-         }
 
- 		else if($arg == 'del')
 
-         {
 
-              $this->_del();
 
-         }
 
- 		else if($arg == 'print')
 
-         {
 
-              $this->_print();
 
-         }
 
- 		else if($arg == 'number')
 
-         {
 
-              $this->_number();
 
-         }
 
- 		else if($arg == 'numberprint')
 
-         {
 
-              $this->_numberprint();
 
-         }
 
- 		else if($arg == 'operate')
 
-         {
 
-              $this->_operate();
 
-         }
 
- 		else if($arg == 'out')
 
-         {
 
-              $this->_out();
 
-         }
 
- 		else if($arg == 'excel')
 
-         {
 
-              $this->_excel();
 
-         }
 
- 		else if($arg == 'bdbb')
 
-         {
 
-              $this->_bdbb();
 
-         }
 
- 		else if($arg == 'rk')
 
-         {
 
-              $this->_rk();
 
-         }
 
- 		else if($arg == 'cqrk'){
 
- 			$this->_cqrk();
 
- 		}
 
- 		else if($arg == 'ck')
 
-         {
 
-              $this->_ck();
 
-         }
 
- 		else if($arg == 'jgl')//交工率
 
-         {
 
-              $this->_jgl();
 
-         }
 
-         else if($arg == 'linqi')
 
-         {
 
-              $this->_linqi();
 
-         }
 
- 		else if($arg == 'jiaji'){
 
- 			$this->_jiaji();
 
- 		}
 
-         else if($arg == 'overtime_export'){
 
-              $this->_overtime_export();
 
-         }
 
- 		else if($arg == 'scz'){
 
- 			$this->_scz();
 
- 	   }
 
- 	   else if($arg == 'wjsrk'){
 
- 		$this->_wjsrk();
 
- 	   }
 
- 	   else if($arg == 'wjsrkexcel'){
 
- 		$this->_wjsrkexcel();
 
- 	   }
 
- 	   else if($arg == 'cqrkexcel'){
 
- 		$this->_cqrkexcel();
 
- 	   }
 
- 	   else if($arg == 'sczexcel'){
 
- 			$this->_sczexcel();
 
- 	   }
 
- 		else
 
- 		{
 
- 				$this->_index();
 
- 		}
 
-     }
 
- 	//管理
 
- 	public function _index()
 
- 	{
 
- 		$t = array();
 
- 		$typeclass = $this->typeclass->find_all();
 
- 		foreach ($typeclass as $v)
 
- 		{
 
- 			$t[$v['id']] = $v['title'];
 
- 		}
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['page']))  
 
- 		{
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			$type = $this->input->post('type',true);
 
- 			$where = "1=1 ";
 
-             //数据排序
 
-             $order_str = "id asc";
 
- 			if($type)
 
- 			{
 
- 				$where .= "and type = '$type'";
 
- 			}
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
-             //取得信息列表
 
-             $info_list = $this->transfer->find_all($where,'id,title,orvertime,overtime_one,overtime_two',$order_str,$start,$perpage);
 
- 		    $total = $this->transfer->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;
 
- 		}
 
- 		$this->_Template('transfer',$this->data);
 
- 	}
 
- 	//添加
 
- 	public function _add()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['title']))
 
- 		{
 
- 			$title = $this->input->post('title',true);
 
- 			if($this->transfer->find_all("title = '$title'"))
 
- 			{
 
- 				echo json_encode(array('msg'=>'名称重复!','success'=>false));exit;
 
- 			}
 
- 			if($this->transfer->insert($post))
 
-         	{
 
-          		echo json_encode(array('msg'=>'添加成功','success'=>true));exit;
 
-        	 	}
 
-        		else
 
-         	{
 
-            		echo json_encode(array('msg'=>'添加失败,请重试','success'=>false));exit;
 
-         	}
 
- 		}
 
- 		$this->_Template('transfer_add',$this->data);
 
- 	}
 
- 	//修改
 
- 	public function _edit($arg_array)
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['id']))
 
- 		{
 
- 			$id = $this->input->post('id',true);
 
- 			$title = $this->input->post('title',true);
 
- 			if($this->transfer->find_all("title = '$title' and id != '".$id."'"))
 
- 			{
 
- 				echo json_encode(array('msg'=>'名称重复!','success'=>false));exit;
 
- 			}
 
- 			if($this->transfer->save($post,$id))
 
-         	{
 
-          		echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
 
-        	 	}
 
-        		else
 
-         	{
 
-            		echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
 
-         	}
 
- 		}
 
- 		$arg_array = $arg_array[0];
 
- 		$transfer = $this->transfer->read($arg_array);
 
- 		$this->data['transfer'] = $transfer;
 
- 		$this->_Template('transfer_edit',$this->data);
 
- 	}
 
- 	//删除
 
- 	public function _del()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['s']))  
 
- 		{
 
-             $id_arr = $this->input->post('s');
 
-             $id_arr =  explode(',',$id_arr);
 
-             if(!$id_arr)
 
-             {
 
-                 echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
 
-             }
 
-             //循环删除记录
 
-             foreach ($id_arr as $v) 
 
- 		    {
 
-                 $this->transfer->remove($v);
 
-             }
 
-             echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
 
- 		}
 
-     }
 
- 	
 
- 	public function _print()
 
- 	{
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $sid = "";$wid="";$wtype="";
 
- 			$userwh = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($userwh as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 				$wtype .= " type = ".$value." or";
 
- 			}
 
- 		}
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		$classid = $this->classid->sku();
 
- 		$pm = $classid;
 
- 		$scsku = $classid;
 
- 			if(isset($post['category']))
 
- 			{
 
- 				$list = array();$num = "";$title = "";$features = "";
 
- 				$order = 0;
 
- 				$xbqnum = $this->input->post('xbqnum',true);//打印数量
 
- 				$t = $this->input->post('t',true);//打印数量
 
- 				if($xbqnum > 99)
 
- 				{
 
- 					echo json_encode(array('msg'=>'打印数量不可超过99!','success'=>false));exit;
 
- 				}
 
- 				if($xbqnum < 1)
 
- 				{
 
- 					echo json_encode(array('msg'=>'打印数量错误!','success'=>false));exit;
 
- 				}
 
- 				$post['purchase'] = $this->input->post('purchase',true);//所属工厂
 
- 				$category = $this->input->post('category',true);
 
- 			$list['category'] = $category;
 
- 			$list['hairtype'] = $this->input->post('hairtype',true);
 
- 			$list['grade'] = $this->input->post('grade',true);
 
- 			$size = $this->input->post('size',true);
 
- 			$xzsku = $this->input->post('xzsku',true);
 
- 			$list['size'] = rtrim($size,',');
 
- 			$list['hairnumber'] = $this->input->post('hairnumber',true);
 
- 			$list['extension'] = $this->input->post('extension',true);
 
- 			if($category == 1297)
 
- 			{
 
- 				$list['sywignumber'] = $this->input->post('sywignumber',true);
 
- 			}
 
- 			if($category == 1702)
 
- 			{
 
- 				$list['syhairnumber'] = $this->input->post('syhairnumber',true);
 
- 				$list['syother'] = $this->input->post('syother',true);
 
- 			}
 
- 			if($category == 133)
 
- 			{
 
- 				$list['fittype'] = $this->input->post('fittype',true);
 
- 				$list['acother'] = $this->input->post('acother',true);
 
- 			}
 
- 			$list['color'] = $this->input->post('color',true);
 
- 			$list['lowe'] = $this->input->post('lowe',true);
 
- 			if($category == 127)
 
- 			{
 
- 				$list['type'] = $this->input->post('type',true);
 
- 				$list['headroad'] = $this->input->post('headroad',true);
 
- 				$list['density'] = $this->input->post('density',true);
 
- 				if($list['type'] == 195 || $list['type'] == 197 || $list['type'] == 199)
 
- 				{
 
- 					$list['lacesize'] = $this->input->post('lacesize',true);
 
- 				}
 
- 				$list['lacecolor'] = $this->input->post('lacecolor',true);
 
- 				$list['lacetypes'] = $this->input->post('lacetypes',true);
 
- 			}
 
- 			if($category == 128)
 
- 			{
 
- 				$list['lacetype'] = $this->input->post('lacetype',true);
 
- 				$list['haircap'] = $this->input->post('haircap',true);
 
- 				$list['density'] = $this->input->post('density',true);
 
- 				$list['lacecolor'] = $this->input->post('lacecolor',true);
 
- 				$list['lacetypes'] = $this->input->post('lacetypes',true);
 
- 				$list['wigother'] = $this->input->post('wigother',true);
 
- 				$list['wigother1'] = $this->input->post('wigother1',true);
 
- 				$list['wigother2'] = $this->input->post('wigother2',true);
 
- 			}
 
- 			if($category == 129)
 
- 			{
 
- 				$list['wide'] = $this->input->post('wide',true);
 
- 			}
 
- 			
 
- 			if($category == 131)
 
- 				{
 
- 					$list['gifttype'] = $this->input->post('gifttype',true);
 
- 					$list['giftother'] = $this->input->post('giftother',true);
 
- 				}
 
- 			
 
- 			if($category == 134)
 
- 			{
 
- 				$list['pieceweight'] = $this->input->post('pieceweight',true);
 
- 			}
 
- 			if($category == 1297)
 
- 			{
 
- 				$list['synthetictype'] = $this->input->post('synthetictype',true);
 
- 				$list['sywigother'] = $this->input->post('sywigother',true);
 
- 			}
 
- 			if($category == 130 || $category == 133 || $category == 1702)
 
- 			{
 
- 				$list['items'] = $this->input->post('items',true);
 
- 				$list['weight'] = $this->input->post('weight',true);
 
- 			}
 
- 			if($category == 1702)
 
- 			{
 
- 				$list['syhairther'] = $this->input->post('syhairther',true);
 
- 			}
 
- 				foreach($list as $k=>$v)
 
- 				{
 
- 					if($v != 0)
 
- 					{
 
- 						$num .=$v;
 
- 						$features .=$v.'-';
 
- 						$post[$k] = $v;
 
- 						$typeclass = $this->typeclass->read($v);
 
- 						if(isset($pm[$typeclass['classid']]))
 
- 						{
 
- 						    $pm[$typeclass['classid']] = $typeclass['zh'];
 
- 						}
 
- 						$scsku[$typeclass['classid']] = $typeclass['bqsku'];
 
- 						if($k != 'size')
 
- 					    {
 
- 			                $title .= $typeclass['title']." ";
 
- 					    }
 
- 				    }
 
-                 }
 
- 			$typeclass = $this->typeclass->read($list['size']);
 
- 			$title .= $typeclass['title'];
 
- 				$time = time();
 
- 				$post['printtime'] = $time;
 
- 				$post['title'] = rtrim($title,' ');
 
- 				$post['number'] = $num;
 
- 				$post['features'] = '-'.$features;
 
- 				$featurespp = str_replace(array('-163-','-164-','-165-','-166-'),'-',$features);
 
- 				$featurespp = explode('-',trim($featurespp,'-'));
 
- 				if(isset($featurespp[5]))
 
- 				{
 
- 				    $post['featurespp'] = $featurespp[0].'-'.$featurespp[3].'-'.$featurespp[4].'-'.$featurespp[5];
 
- 				}
 
- 				else
 
- 				{
 
- 					$post['featurespp'] = $featurespp[0].'-'.$featurespp[3].'-'.$featurespp[4];
 
- 				}
 
- 				$post['time'] = $time;//操作时间
 
- 				$scsku = implode("-",$scsku);
 
- 				$zh = implode(" ",$pm);
 
- 				$zh = str_replace('自然色 ','',trim($zh,' '));
 
- 				$zh = str_replace(array('        ','       ','      ','     ','    ','   ','  '),' ',$zh);
 
- 				$post['shipremarks'] = $zh;
 
- 				$scsku = str_replace('- ','-',trim($scsku,'-'));
 
- 				$scsku = str_replace(array('--------','-------','------','-----','----','---','--'),'-',$scsku);
 
- 			$bqsku = (isset($b['title']))?$b['title'].'-'.$scsku:$scsku;
 
- 					$post['sku'] = $bqsku;
 
- 					$post['rk'] = "|1|";//默认配货 打印后直接入库
 
- 					$post['rktime'] = "|".$time."|";
 
- 					$rows = array();
 
- 					$this->db->trans_begin();
 
- 					for($i=0;$i<$xbqnum;$i++)
 
- 					{
 
- 					    $label = substr($time,1)*100;
 
- 					    $post['label'] = $label+$i;
 
- 						 $rows[] = array('num'=>$post['label'],'number'=>'','shipremarks'=>$zh,'ex'=>'','t'=>$t,'time'=>'布标打印时间:'.date('Y-m-d H:i:s',$time),'s'=>'('.($i+1).'/'.$xbqnum.')');
 
- 						 $this->systemtransfer->insert($post);
 
- 					}
 
- 						if ($this->db->trans_status() === TRUE)
 
-        				    {
 
- 							$this->db->trans_commit();
 
- 							echo json_encode(array('rows'=>($rows),'success'=>true));exit;
 
- 						}
 
- 						else
 
- 						{
 
- 							$this->db->trans_rollback();
 
- 							echo json_encode(array('msg'=>'错误,请重试!','success'=>false));exit;
 
- 						}
 
- 			}
 
- 		$purchase = $this->purchase->find_all("yyid != ''");
 
- 		$this->data['purchase'] = $purchase;
 
- 		$this->_Template('transfer_print',$this->data);
 
- 	}
 
- 	
 
- 	public function _number()
 
- 	{
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$pid = "";$tid="";$sid="";$wid="";
 
- 			$purchase = explode('|',trim($user['purchase'],'|'));
 
- 			$transfer = explode('|',trim($user['transfer'],'|'));
 
- 			foreach ($purchase as $value) 
 
- 			{
 
- 				$pid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($transfer as $value) 
 
- 			{
 
- 				$tid .= " id = ".$value." or";
 
- 			}
 
- 		}
 
- 		else
 
- 		{
 
- 			header('Location: /');exit;
 
- 		}
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['number']))  
 
- 		{
 
- 			$number = $this->input->post('number',true);
 
- 			$type = $this->input->post('type',true);
 
- 			$xbqnum = $this->input->post('xbqnum',true);//打印数量
 
- 			$purchase = $this->input->post('purchase',true);
 
- 			$f = 'fullorder';
 
- 			$y  = $this->fullorder->get_number($number);
 
- 			if(!$y)
 
- 			{
 
- 				$f = 'fullordersmt';
 
- 				$y  = $this->fullordersmt->get_number($number);
 
- 				if(!$y)
 
- 			    {
 
- 					$f = 'fullordertt';
 
- 					$y  = $this->fullordertt->get_number($number);
 
- 					if(!$y)
 
- 			    	{
 
- 						echo json_encode(array('msg'=>'没有找到此订单,请检查是否扫描错误','success'=>false));exit;
 
- 					}
 
- 				}
 
- 			}
 
- 			if($y['librarytime'] > 0)
 
- 			{
 
- 				echo json_encode(array('msg'=>'错误,此订单已出库!','success'=>false));exit;
 
- 			}
 
- 			$cp = array();$i = 0;$x=0;$byz = array();$znum = 0;$typeclass = array();
 
- 			$classid = $this->classid->sku();
 
- 			$tc = $this->typeclass->find_all();
 
- 			foreach($tc as $v)
 
- 			{
 
- 				$typeclass[$v['id']] = $v;
 
- 			}
 
- 			$bm = '03';
 
- 			$fpdata = explode(';',trim($y['fpdata'],';'));
 
- 			$whlabelsc = explode('|',trim($y['whlabel'],'|'));
 
- 			foreach($fpdata as $key=>$val)
 
- 			{
 
- 				$pm = $classid;
 
- 		    	$jm = $classid;
 
- 				$sku = $classid;
 
- 				$bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
 
- 				$features = str_replace(array('-163-','-164-','-165-','-166-'),'-',$val);
 
- 				$jvnr = explode('|',trim($features,'|'));
 
- 				if(stripos($jvnr[0],',') !== false)
 
- 				{
 
- 					$ft = explode(',',$jvnr[0]);
 
- 			    	$features = explode('-',trim($ft[1],'-'));
 
- 					array_splice($features,2,0,$ft[0]);
 
- 				}
 
- 				else
 
- 				{
 
- 					$features = explode('-',trim($jvnr[0],'-'));
 
- 				}
 
- 				$title = $jvnr[1];
 
- 				foreach($features as $k=>$v)
 
- 				{
 
- 					if(isset($typeclass[$v]) && isset($bmpx[$typeclass[$v]['classid']]))
 
- 					{
 
- 						if($typeclass[$v]['bm'] != '')
 
- 						{
 
- 							$bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
 
- 						}
 
- 				        
 
- 					}
 
- 					if($v != 0)
 
- 					{
 
- 						$sku[$typeclass[$v]['classid']] = $typeclass[$v]['bqsku'];
 
- 						if(isset($pm[$typeclass[$v]['classid']]))
 
- 						{
 
- 							if($typeclass[$v]['title'] == '9A')
 
- 							{
 
- 								$pm[$typeclass[$v]['classid']] = '9A';
 
- 							}
 
- 							else if($typeclass[$v]['title'] == '10A')
 
- 							{
 
- 								$pm[$typeclass[$v]['classid']] = '10A';
 
- 							}
 
- 							else
 
- 							{
 
- 								$clzh = $typeclass[$v]['zh'];
 
- 								if(stripos($typeclass[$v]['zh'],'|') !== false)
 
- 								{
 
- 									$clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
 
- 									$clzh = $clzh[0];
 
- 								}
 
- 								$pm[$typeclass[$v]['classid']] = $clzh;
 
- 							}
 
- 						}
 
- 						if(isset($jm[$typeclass[$v]['classid']]))
 
- 						{
 
- 							if($typeclass[$v]['jm'])
 
- 							{
 
- 						    	$jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
 
- 							}
 
- 						}
 
- 					}
 
- 				}
 
- 				$jm = array_filter($jm);//去除空值
 
- 				$jm = implode("-",$jm);
 
- 				$sku = array_filter($sku);//去除空值
 
- 				$sku = implode("-",$sku);
 
- 				$pm = array_filter($pm);//去除空值
 
- 				$zh = implode(" ",$pm);
 
- 				$zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
 
- 				$features = implode("-",$features);
 
- 				$y['shipremarks'] = str_replace("'",'"',$y['shipremarks']);
 
- 				
 
- 				$cp[] = array('ordernumber'=>$number,'title'=>$title,'sku'=>$sku,'jm'=>$jm,'zh'=>$zh,'n'=>$jvnr[2],'b'=>$y['shipremarks'],'is_jiaji'=>$y['is_jiaji'],'data'=>json_encode(array('ordernumber'=>$number,'features'=>$features,'number'=>$number,'title'=>$title,'jm'=>$jm,'sku'=>$sku,'pm'=>$zh,'bm'=>$bm.implode("",$bmpx))));
 
- 			}
 
- 			echo json_encode(array('rows'=>$cp,'success'=>true));exit;
 
- 		}
 
- 		$purchase = $this->purchase->find_all("yyid != ''");
 
- 		$this->data['purchase'] = $purchase;
 
- 		$transfer = $this->transfer->find_all('1=1 and '.rtrim($tid,'or'));
 
- 		$this->data['transfer'] = $transfer;
 
- 		$this->_Template('transfer_number',$this->data);
 
- 	}
 
- 	
 
- 	public function _numberprint()
 
- 	{
 
- 		$time = time();
 
- 		$post = $this->input->post(NULL);
 
- 		$classid = $this->classid->sku();
 
- 		$pm = $classid;
 
- 		$scsku = $classid;
 
- 			if(isset($post['data']))
 
- 			{
 
- 				$data = json_decode($post['data'],true);
 
- 				$f = 'fullorder';
 
- 				$y = $this->fullorder->get_number($data['ordernumber']);
 
- 				if(!$y)
 
- 				{
 
- 					$f = 'fullordersmt';
 
- 					$y  = $this->fullordersmt->get_number($data['ordernumber']);
 
- 					if(!$y)
 
- 			    	{
 
- 						$f = 'fullordertt';
 
- 						$y  = $this->fullordertt->get_number($data['ordernumber']);
 
- 						if(!$y)
 
- 			    		{
 
- 							echo json_encode(array('msg'=>$data['ordernumber'].'没有找到此订单,请检查是否扫描错误'.$data['ordernumber'],'success'=>false));exit;
 
- 						}
 
- 					}
 
- 				}
 
- 				if($y['printtime'] == 0)
 
- 			    {
 
- 						echo json_encode(array('msg'=>'此单已重置,请询问梦体','success'=>false));exit;
 
- 				}
 
- 				$order = 0;$time = time();
 
- 				$xbqnum = $this->input->post('n',true);//打印数量
 
- 				if($xbqnum > 99)
 
- 				{
 
- 					echo json_encode(array('msg'=>'打印数量不可超过99!','success'=>false));exit;
 
- 				}
 
- 				if($xbqnum < 1)
 
- 				{
 
- 					echo json_encode(array('msg'=>'打印数量错误!','success'=>false));exit;
 
- 				}
 
- 				$transfer = $this->input->post('transfer',true);
 
- 				$post['type'] = $this->input->post('type',true);
 
- 				$post['shipremarks'] = $this->input->post('b',true);
 
- 				$post['ph'] = $this->input->post('ph',true);
 
- 				$is_jiaji = $this->input->post('is_jiaji',true);
 
- 				if($is_jiaji == 2){
 
- 					$post['is_jiaji'] = 2;
 
- 				}else{
 
- 					$post['is_jiaji'] = 0;
 
- 				}
 
- 				$zps = $this->input->post('zps',true);
 
- 				$post['purchase'] = $this->input->post('purchase',true);//供应商
 
- 		        $post['time'] = $time;//操作时间
 
- 				$post['jm'] = $data['jm'];
 
- 				$post['bm'] = $data['bm'];
 
- 				$post['pm'] = $data['pm'];
 
- 				$post['features'] = $data['features'];
 
- 				$post['number'] = $data['number'];
 
- 				$post['title'] = $data['title'];
 
- 				$post['sku'] = $data['sku'];
 
- 				$post['printtime'] = $y['printtime'];
 
- 				$post['rk'] = "|12|";//默认订单中心 打印后直接入库
 
- 				$post['ck'] = "|12|";
 
- 				$post['rktime'] = "|".$time."|";
 
- 				$post['cktime'] = $post['rktime'];
 
- 				$post['ctime12'] = $time;
 
- 				$express = $this->express->read($y['express']);
 
- 				$rows = array();$t='';
 
- 				$this->db->trans_begin();
 
- 				$post['xbqnum'] = $xbqnum;
 
- 				$kh = $this->shop->read($y['shop']);
 
- 				//$this->logic_ding->sendToDing("小布表打印异常".json_encode($post));
 
- 				$yy = $this->apiyy->_peihuo($post,$kh['yyid'],$y['number'],$post['xbqnum']);
 
- 			    if($yy['c'] == 0)
 
- 			    {
 
- 					$post['scapi'] = '99';
 
- 					$post['scid'] = $yy['scid'];
 
- 					if(!$post['purchase'])
 
- 					{
 
- 						$post['purchase'] = '';
 
- 					}
 
- 					$mqsl = $this->systemtransfer->find_count("number = '".$data['number']."'");
 
- 					//able_ext 实在打印小单布标时判断是否可以打印备货单 
 
- 				    $able_ext = 0;
 
- 				    $tmp_fetaures = explode('-',$data['features']);
 
-                     //只有头套和马尾才会要配货单
 
-     				if(in_array(128, $tmp_fetaures)){
 
-     					$able_ext = 1;
 
-     				}
 
-     				if(in_array(133, $tmp_fetaures)){
 
-     					if(in_array(673, $tmp_fetaures)){
 
-     						$able_ext = 1;
 
-     					}
 
-     				}
 
- 					for($i=0;$i<$xbqnum;$i++)
 
- 					{
 
- 						if($post['zps'])
 
- 						{
 
- 							if($post['zps'] > 0)
 
- 							{
 
- 								$t = '总量:'.($mqsl+$i+1).'/'.$zps;
 
- 							}
 
- 						}
 
- 						$label = substr($time,1)*100;
 
- 						$post['label'] = $label+$i;
 
- 				   		$rows[] = array('num'=>$post['label'],'number'=>$post['number'],'shipremarks'=>$post['shipremarks'],'ph'=>$post['ph'],'ex'=>$express['servicename'],'time'=>''.date('Y-m-d',$post['printtime']),'gtime'=>date('YmdH',time()),'s'=>'('.($i+1).'/'.$xbqnum.')','t'=>$t,'able_ext'=>$able_ext,'is_jiaji'=>$is_jiaji);
 
- 						$this->systemtransfer->insert($post);
 
- 					}
 
- 			    }
 
- 			    else
 
- 			    {
 
- 					$this->db->trans_rollback();
 
- 				    echo json_encode(array('msg'=>$yy['error'],'a'=>1,'success'=>false));exit;
 
- 			    }
 
-                 if($this->db->trans_status() === TRUE)
 
-        			{
 
- 					$this->db->trans_commit();
 
- 					echo json_encode(array('rows'=>($rows),'success'=>true));exit;
 
- 				}
 
- 				else
 
- 				{
 
- 					$this->db->trans_rollback();
 
- 					echo json_encode(array('msg'=>'错误,请重试!','success'=>false));exit;
 
- 				}
 
- 			}
 
- 	}
 
- 	
 
- 	public function _operate()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 	    if(isset($post['page']))  
 
- 		{
 
- 			$api = $this->input->post('api',true);
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			$number = $this->input->post('number',true);
 
- 			$color = $this->input->post('color',true);
 
- 			$purchase = $this->input->post('purchase',true);
 
- 			$transfer = $this->input->post('transfer',true);
 
- 			$lx = $this->input->post('lx',true);
 
- 			$type = $this->input->post('type',true);
 
- 			$jiaji = $this->input->post('jiaji',true);
 
- 			$xztime = $this->input->post('xztime',true);
 
- 			$timetk = $this->input->post('timetk',true);
 
- 			$timetj = $this->input->post('timetj',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$where = '1=1';
 
- 			if($number)
 
-             {
 
-                 $where  .= " and number = '$number'";
 
-             }
 
- 			if($purchase)
 
-             {
 
-                 $where  .= " and purchase = '$purchase'";
 
-             }
 
- 			if($color)
 
-             {
 
-                 $where  .= " and fpdata like '%-".$color."-%'";
 
-             }
 
- 			if($lx)
 
-             {
 
- 				if($lx == 1)
 
- 				{
 
-                     $where  .= " and ordernumber = ''";
 
- 				}
 
- 				else
 
- 				{
 
- 					$where  .= " and ordernumber != ''";
 
- 				}
 
-             }
 
-             if($jiaji){
 
-                 if($jiaji == 1){
 
-                     $where  .= " and is_jiaji = 0";
 
-                 }
 
-                 if($jiaji == 2){
 
-                     $where  .= " and is_jiaji = 2";
 
-                 }
 
-                 
 
-             }
 
-             //数据排序
 
-             $order_str = "id desc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
- 			
 
- 			if($xztime == 'printtime')
 
- 			{
 
- 				$where  .= " and ctime12 > '$timetk' and ctime12 < '$timetj'";
 
- 				if($type)
 
-             	{
 
- 					if($type == 3){
 
- 						if($transfer)
 
- 						{
 
- 							$where  .= " and rk like '%|".$transfer."|%' and rk != ck";
 
- 						}
 
- 					}else{
 
- 						$type = ($type==1)?'rk':'ck';
 
- 						if($transfer)
 
- 						{
 
- 							$where  .= " and $type like '%|".$transfer."|%'";
 
- 						}
 
- 					}
 
- 					
 
-             	}
 
- 				else
 
- 				{
 
- 					if($transfer)
 
-             		{
 
- 						$where  .= " and rk like '%|".$transfer."|%'";
 
-             		}
 
- 				}
 
- 			}
 
- 			else
 
- 			{
 
- 				$cr  = "time > '$timetk' and time < '$timetj'";
 
- 				if($transfer)
 
-             	{
 
-                 	$cr  .= " and lx = '".$transfer."' ";
 
-             	}
 
- 				if($type)
 
-             	{
 
- 					if($type == 3){
 
- 						$cr  .= " and is_over = 0 ";
 
- 					}else{
 
- 						$cr  .= " and type = '".$type."' ";
 
- 					}
 
-                 	
 
-             	}
 
- 				$fid = '';
 
- 				$info_list_cr = $this->systemtransfer_cr->find_all($cr);
 
- 				foreach ($info_list_cr as $v)
 
- 		    	{
 
- 					$fid .= "id = '".$v['fid']."' or ";
 
- 				}
 
- 				if($fid)
 
- 				{
 
- 			    	$where  .= ' and ('.trim($fid,'or ').')';
 
- 				}
 
- 				else
 
- 				{
 
- 					$where  .= ' and id = 0';
 
- 				}
 
- 			}
 
-             //取得信息列表
 
-             $info_list = $this->systemtransfer->find_all($where,'id,number,is_jiaji,pm,shipremarks,printtime,time,ctime12',$order_str,$start,$perpage);
 
- 			$transfer = $this->transfer->find_all();
 
- 			$t = array();
 
- 			foreach ($transfer as $v)
 
- 		    {
 
- 				$t[$v['id']] = $v['title'];
 
- 				$ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
 
- 			}
 
- 			 //格式化数据
 
-             foreach ($info_list as $key=>$value)
 
- 		    {
 
- 		        if($value['is_jiaji'] == 2){
 
- 		            $info_list[$key]['is_jiaji'] = "<a href='javascript:void(0)' style='color:red'>加急</a>";
 
- 		        }else{
 
- 		            $info_list[$key]['is_jiaji'] = "常规";
 
- 		        }
 
- 				$dd = $this->systemtransfer->read($value['id']);
 
- 				$info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
 
- 				$rk = explode('|',trim($dd['rk'],'|'));
 
- 				$rktime = explode('|',trim($dd['rktime'],'|'));
 
- 				$ck = explode('|',trim($dd['ck'],'|'));
 
- 				$cktime = explode('|',trim($dd['cktime'],'|'));
 
- 				$info_list[$key]['time'] = '';
 
- 				$data = $this->systemtransfer_cr->find_all("fid = '".$value['id']."'");
 
- 				/**
 
- 				for($i=0;$i<count($rk);$i++)
 
- 		        {
 
- 					if(count($rk)-1 == $i && $ot[$rk[$i]] > 0 && $rktime[$i] + $ot[$rk[$i]] < time())
 
- 					{
 
- 						$d = ' <em style="color: #fc5454;">'.$t[$rk[$i]].'入库 :'.((isset($rktime[$i]))?(date('Y-m-d H:i',$rktime[$i])):'').' 超</em><br> ';
 
- 					}
 
- 					else
 
- 					{
 
- 						$d = $t[$rk[$i]].'入库 :'.((isset($rktime[$i]))?(date('Y-m-d H:i',$rktime[$i])):'').'<br>';
 
- 					}
 
- 					$info_list[$key]['time'] .= $d;
 
- 					if(isset($ck[$i]) && $ck[$i] != '')
 
- 					{
 
- 						$info_list[$key]['time'] .= $t[$ck[$i]].'出库 :'.date('Y-m-d H:i',$cktime[$i]).'<br>';
 
- 					}
 
- 				}
 
- 				**/
 
- 				//$info_list[$key]['time'] = "订单出库 :".date('Y-m-d H:i',$value['printtime']).'<br>';
 
- 				$info_list[$key]['time'] = "布标打印 :".date('Y-m-d H:i',$value['ctime12']).'<br>';
 
- 				foreach ($data as $k=>$v)
 
- 		        {
 
- 				// 	$type = ($v['type']==1)?'入库':'出库';
 
- 				// 	$info_list[$key]['time'] .= $t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']).'<br>';
 
- 					
 
- 				    $type = ($v['type']==1)?'入库':'出库';
 
- 				
 
- 				    if($v['orver_flag'] == 1){
 
- 						if($v['is_over'] == 0){
 
- 							$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#90f'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l style='font-weight:900;'>即将超时 </l></a>";
 
- 							// $info_list[$key]['time'] .= '<i style="padding:10px;color:#90f;font-weight:bold;"> 即将超时</i>'.'<br>';
 
- 						}else{
 
- 							$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</a>";
 
- 						}
 
- 					}elseif($v['orver_flag'] == 2){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#f33'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l font-weight:900'>超时! </l></a>";
 
- 					}elseif($v['orver_flag'] == 3){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#06f'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l font-weight:900'>【该单已取消】 </l></a>";
 
- 					}else{
 
- 						$info_list[$key]['time'] .= "<a  href='javascript:void(0);' style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</a>";
 
- 					}
 
- 					if($v['extra_status'] == 1){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#90f'>【下道工序未及时入库】</a><br>";
 
- 					}elseif($v['extra_status'] == 2 || $v['extra_status'] == 3){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#A52A2A'>【工序间流转超过3天】</a><br>";
 
- 					}else{
 
- 						$info_list[$key]['time'] .= "<br>";
 
- 					}
 
- 				}
 
- 				$info_list[$key]['time'] = trim($info_list[$key]['time'],'<br>');
 
- 				unset($info_list[$key]['ctime12']);
 
-             }
 
- 			
 
- 		    $total = $this->systemtransfer->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']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $pid = "";$tid="";$sid="";$wid="";
 
- 		    $purchase = explode('|',trim($user['purchase'],'|'));
 
- 			$transfer = explode('|',trim($user['transfer'],'|'));
 
- 			$warehouse = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($purchase as $value) 
 
- 		    {
 
- 				$pid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($transfer as $value) 
 
- 		    {
 
- 				$tid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($warehouse as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 			}
 
- 		}
 
- 		else
 
- 		{
 
- 			header('Location: /');exit;
 
- 		}
 
- 		$sc_flag = 0; //生产中按钮的标识符号 为1的是可以查看 0 不可以
 
- 		//只有admin和toutao用户可以查看
 
- 		if(in_array($user['id'],[10,44,50])){
 
- 			$sc_flag = 1;
 
- 		}
 
- 		$this->data['sc_flag'] = $sc_flag;
 
- 		$kx = '';$zjtab = '';
 
- 		$warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
 
- 		$this->data['warehouse'] = $warehouse;
 
- 		$purchase = $this->purchase->find_all("yyid != ''");
 
- 		$this->data['purchase'] = $purchase;
 
- 		$transfer = $this->transfer->find_all('1=1 and '.rtrim($tid,'or'));
 
- 		$this->data['transfer'] = $transfer;
 
- 		$this->data['vip'] = $user['vip'];
 
- 		$transfer_ids = array_column($transfer,'id');
 
- 		$transfer_str = implode(",",$transfer_ids);
 
- 		$this->data['cz_1_num'] = $this->systemtransfer_cr->find_count("orver_flag = 1 and is_over = 0 and time > ".(time()-3600*24*14)  ." and lx in (".$transfer_str.")");
 
- 		$this->data['cz_2_num'] = $this->systemtransfer_cr->find_count("orver_flag = 2 and is_over = 0 and time > ".(time()-3600*24*14)  ." and lx in (".$transfer_str.")");
 
- 		//$jiaji_num = 0;
 
- 	    
 
- 	    // $jiaji_num = $this->systemtransfer->find_count(" is_jiaji = 2 and time > ".(time()-3600*24*7)." and rk not like '%|11|%'" );
 
- 		foreach($transfer_ids as $k=>$v){
 
- 			if($v == 11){
 
- 				unset($transfer_ids[$k]);
 
- 			}
 
- 		}
 
- 		if(empty($transfer_ids)){
 
- 		    $this->data['jiaji_num'] = -1;
 
- 		}else{
 
- 		    $transfer_str = implode(",",$transfer_ids);
 
-     		$sql_r = $this->db->query("select s.id,s.is_jiaji,s.rk,c.is_over,c.time,c.lx,c.id from crowd_systemtransfer as s inner join crowd_systemtransfer_cr as c   on c.fid = s.id and c.is_over = 0 and c.time > ".(time()-3600*24*14)  ." and c.lx in (".$transfer_str.") where s.is_jiaji = 2 and s.rk not like '%|11|%'");
 
-     	    // print_r("select s.id,s.is_jiaji,s.rk,c.is_over,c.time,c.lx,c.id from crowd_systemtransfer as s inner join crowd_systemtransfer_cr as c   on c.fid = s.id and c.is_over = 0 and c.time > ".(time()-3600*24*7)  ." and c.lx in (".$transfer_str.") where s.is_jiaji = 2 and s.rk not like '%|11|%'");
 
-     		
 
-     		$tmp_list= $sql_r->result_array();
 
-     		$this->data['jiaji_num'] = count($tmp_list);
 
- 		}
 
- 	
 
- 		$this->_Template('transfer_operate',$this->data);
 
- 	}
 
- 	
 
- 	public function _out()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['label']))
 
- 		{
 
- 			$time = time();
 
- 			$label = $this->input->post('label',true);
 
- 			$cz = $this->input->post('cz',true);
 
- 			$transfer = $this->input->post('transfer',true);
 
- 			if(!$label)
 
- 			{
 
- 				echo json_encode(array('msg'=>'未扫入数据!','success'=>false));exit;
 
- 			}
 
- 			if(!$transfer)
 
- 			{
 
- 				echo json_encode(array('msg'=>'请选择需对应的部门!','success'=>false));exit;
 
- 			}
 
- 			$lb = $this->systemtransfer->get_label($label);
 
- 			if(!$lb)
 
- 			{
 
- 				$this->logic_ding->sendToDing("检测货物流转异常的编码".$transfer."|".$label);
 
- 				echo json_encode(array('msg'=>'错误!未找到此条码','success'=>false));exit;
 
- 			}
 
- 			if($lb['number']!='')
 
- 			{
 
- 				$nu = $this->fullorder->get_number($lb['number']);
 
- 				if(!$nu)
 
- 				{
 
- 					$nu = $this->fullordersmt->get_number($lb['number']);
 
- 				    if(!$nu)
 
- 				    {
 
- 						$nu = $this->fullordertt->get_number($lb['number']);
 
- 					}
 
- 				}
 
- 				//取消的订单还是要继续生产的 所以还允许继续扫入扫出 只是后续的出入库中不在限定时间
 
- 				// if($nu['state'] == '214' || $nu['state'] == '217')
 
- 				// {
 
- 				// 	echo json_encode(array('msg'=>'错误,此单已取消!请联系店员核实','success'=>false));exit;
 
- 				// }
 
- 			}
 
- 			
 
- 			$tdata = $this->transfer->find_all();
 
- 			$t = array();
 
- 			foreach ($tdata as $v)
 
- 		    {
 
- 				$t[$v['id']] = $v['title'];
 
- 			}
 
- 			/**
 
- 			if($cz == 1 && stripos($lb['rk'],'|'.$transfer.'|') !== false)
 
- 			{
 
- 				echo json_encode(array('msg'=>'此条码已有入库操作!','success'=>false));exit;
 
- 			}
 
- 			if($cz == 2 && stripos($lb['ck'],'|'.$transfer.'|') !== false)
 
- 			{
 
- 				echo json_encode(array('msg'=>'此条码已有出库操作!','success'=>false));exit;
 
- 			}
 
- 			**/
 
- // 			if(stripos($lb['ck'],'|1|') === false && $transfer != 1 && stripos($nu['fpdata'],'-128-') !== false)
 
- // 			{
 
- // 				echo json_encode(array('msg'=>'必须有配货出库才可后续操作!','success'=>false));exit;
 
- // 			}
 
-            
 
- 			
 
- 			//重新定义配货的原则问题
 
- 			//先检测订单是否含有 128 头套 或者配件 如果有 133 进行下一步检测
 
-  			$sku_arr = explode("-",$lb['features']);
 
- 			if(in_array(128,$sku_arr)||in_array(133,$sku_arr)){
 
- 				// 145  Full Lace Wig
 
- 				// 1170 HDFullLaceWig
 
- 				// 1249 FullLaceBobwithBang
 
- 				// 1484 FullLaceBob
 
- 				//如果是这4中全蕾丝那么配货就不处理
 
- 				if(in_array(145,$sku_arr) || in_array(1170,$sku_arr) || in_array(1249,$sku_arr) || in_array(1484,$sku_arr)){
 
- 				}else{
 
- 					if(stripos($lb['ck'],'|1|') === false && $transfer != 1 )
 
- 					{
 
- 						echo json_encode(array('msg'=>'头套和配件除了全蕾丝外必须走配货!','success'=>false));exit;
 
- 					}
 
- 				}
 
- 			}
 
- 			if($cz == 2 && stripos($lb['rk'],'|'.$transfer.'|') === false)
 
- 			{
 
- 				echo json_encode(array('msg'=>'此条码还未入库!','success'=>false));exit;
 
- 			}
 
- 			$lbrk = array_reverse(explode('|',trim($lb['rk'],'|')));
 
- 			$lbck = array_reverse(explode('|',trim($lb['ck'],'|')));
 
- 			if($transfer != 3 && $transfer != 11 && $transfer != 2)
 
- 			{
 
- 				if($cz == 1)
 
- 				{
 
- 			        if($lb['rk'] != $lb['ck'])//判断是否没走完流程就拿到下一步奏
 
- 			        {
 
- 				        echo json_encode(array('msg'=>$t[$lbrk[0]].'还未出库,无法入库!','success'=>false));exit;
 
- 			        }
 
- 				}
 
- 				if($cz == 2 && $lbrk[0] != $transfer)//判断是否没走完流程就拿到下一步奏
 
- 			    {
 
- 				    echo json_encode(array('msg'=>$t[$transfer].'还未入库,无法出库!','success'=>false));exit;
 
- 			    }
 
- 			}
 
- 			if($cz == 1)
 
- 			{
 
- 				$lb['rk'] .= $transfer.'|';
 
- 				$lb['rktime'] .= $time.'|';
 
- 				if($lbrk[0] == $transfer)
 
- 				{
 
- 					echo json_encode(array('msg'=>'已有入库记录,不可连续重复录入!','success'=>false));exit;
 
- 				}
 
- 			}
 
- 			else if($cz == 2)
 
- 			{
 
- 				$lb['ck'] .= $transfer.'|';
 
- 				$lb['cktime'] .= $time.'|';
 
- 				if($lbck[0] == $transfer)
 
- 				{
 
- 					echo json_encode(array('msg'=>'已有出库记录,不可连续重复录入!','success'=>false));exit;
 
- 				}
 
- 			}
 
- 			$this->_doCancelWlz($lb['id']);
 
- 			$cztime = 'ctime'.$transfer;
 
- 			$this->logic_ding->sendToDing("检测货物流转打印情况".$transfer."|".$cz."|".$lb['number']."|".$lb['id']);
 
- 			if(($transfer == 3 && $lb['dbapi'] < 99 && $cz == 2) || ($transfer == 13 && $lb['dbapi'] < 99 && $cz == 1))//出入库用这个
 
- 			//if(($transfer == 8 || $transfer == 13) && $lb['dbapi'] < 99 && $cz == 1)//单入库
 
- 			{
 
- 				if($lb['type'] == 0)
 
- 				{
 
- 				    $s = $this->shop->read($nu['shop']);
 
- 			        $lb['kh'] = $s['yyid'];
 
- 				    $lb['ts'] = 1;
 
- 			        $rk = $this->apiyy->_newrk($lb);
 
- 				    if($rk['c'] == 0)
 
- 				    {
 
- 						$this->db->trans_begin();
 
- 						$this->systemtransfer->save(array('rk'=>$lb['rk'],'rktime'=>$lb['rktime'],'ck'=>$lb['ck'],'cktime'=>$lb['cktime'],'time'=>$time,'gtime'=>date('YmdH',$time),'dbapi'=>99,'scid'=>$rk['scid'].time(),$cztime=>$time),$lb['id']);
 
- 				 	    $this->systemtransfer_cr->insert(array('fid'=>$lb['id'],'lx'=>$transfer,'type'=>$cz,'time'=>$time));
 
- 				 	    //处理定时任务每三分钟 执行一次的bug  在出库的时候直接同步相关信息
 
-             			if($cz == 2){
 
-             				$this->_doCheckIsOverTime($lb['id'],$transfer);
 
-             			}
 
- 						if ($this->db->trans_status() === TRUE)
 
-         				{
 
- 							$this->db->trans_commit();
 
- 							if($nu['state'] == '216')
 
- 				 	  	    {
 
- 				     	  	    echo json_encode(array('msg'=>'数据已录入成功!提示:此订单已出库,可选择终止生产。','success'=>false));exit;
 
- 				 	  	    }
 
- 				 	  	    elseif(($nu['state'] == '217') || ($nu['state'] == '214')){
 
-             					//标记订单已经取消
 
-             					$this->_doCheckCancelFlag($lb['id']);
 
-             					echo json_encode(array('msg'=>'数据已录入成功!提示:【该单已取消】,可选择终止生产。','success'=>false));exit;
 
-             				}
 
- 				 	  	    else
 
- 				 	  	    {
 
- 								if($lb['is_jiaji'] == 2){
 
- 									echo json_encode(array('music'=>'1','is_jiaji'=>2,'success'=>true));exit;
 
- 								}else{
 
- 									echo json_encode(array('music'=>'1','success'=>true));exit;
 
- 								}
 
- 				     	  	    
 
- 				 	  	    }
 
- 						}
 
- 						else
 
- 						{
 
- 							$this->db->trans_rollback();
 
- 							echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
 
- 						}
 
- 				    }
 
- 				    else
 
- 				    {
 
- 						if(stripos($rk['error'],'DocNo') !== false)
 
- 						{
 
- 							$rk['error'] = '未找到对应的生产订单 '.$lb['scid'];
 
- 						}
 
- 						$this->systemtransfer->save(array('dbapi'=>$rk['dbapi'],'scid'=>$rk['scid']),$lb['id']);
 
- 					    echo json_encode(array('msg'=>'订单号:'.$lb['number'].' 用友报错:'.$rk['error'],'success'=>false));exit;
 
- 				    }
 
- 				}
 
- 				else
 
- 				{
 
- 					$scid = explode('~',$lb['scid']);
 
- 					$rkdata = array('od'=>$scid[1],'ts'=>1,'title'=>$lb['title']);
 
- 					$rk = $this->apiyy->get_bzsh($rkdata);
 
- 					if(isset($rk['Data'][0]))
 
- 		        	{
 
- 						if($rk['Data'][0]['IsSucess'] == 1)
 
- 				        {
 
- 							$this->db->trans_begin();
 
- 							$this->systemtransfer->save(array('rk'=>$lb['rk'],'rktime'=>$lb['rktime'],'ck'=>$lb['ck'],'cktime'=>$lb['cktime'],'time'=>$time,'gtime'=>date('YmdH',$time),'dbapi'=>99,'scid'=>$lb['scid'].'~'.$rk['Data'][0]['Code'],$cztime=>$time),$lb['id']);
 
- 				 	    	$this->systemtransfer_cr->insert(array('fid'=>$lb['id'],'lx'=>$transfer,'type'=>$cz,'time'=>$time));
 
- 				 	    	//处理定时任务每三分钟 执行一次的bug  在出库的时候直接同步相关信息
 
-                 			if($cz == 2){
 
-                 				$this->_doCheckIsOverTime($lb['id'],$transfer);
 
-                 			}
 
- 							if ($this->db->trans_status() === TRUE)
 
-         					{
 
- 								$this->db->trans_commit();
 
- 								if($nu['state'] == '216')
 
- 				 	  	    	{
 
- 				     	  	    	echo json_encode(array('msg'=>'数据已录入成功!提示:此订单已出库,可选择终止生产。','success'=>false));exit;
 
- 				 	  	    	}
 
- 				 	  	    	elseif(($nu['state'] == '217') || ($nu['state'] == '214')){
 
-                 					//标记订单已经取消
 
-                 					$this->_doCheckCancelFlag($lb['id']);
 
-                 					echo json_encode(array('msg'=>'数据已录入成功!提示:【该单已取消】,可选择终止生产。','success'=>false));exit;
 
-                 				}
 
- 				 	  	    	else
 
- 				 	  	    	{
 
- 									if($lb['is_jiaji'] == 2){
 
- 										echo json_encode(array('music'=>'1','is_jiaji'=>2,'success'=>true));exit;
 
- 									}else{
 
- 										echo json_encode(array('music'=>'1','success'=>true));exit;
 
- 									}
 
- 				 	  	   		}
 
- 							}
 
- 							else
 
- 							{
 
- 								$this->db->trans_rollback();
 
- 								echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
 
- 							}
 
- 			 	  	    }
 
- 						else
 
- 						{
 
- 							echo json_encode(array('msg'=>$rk['Data'][0]['ErrorMsg'],'success'=>false));exit;
 
- 						}
 
- 			 	  	    
 
- 					}
 
- 					else
 
- 				    {
 
- 					    echo json_encode(array('msg'=>$rk,'success'=>false));exit;
 
- 				    }
 
- 						
 
- 				 }
 
- 			}
 
- 			//if($transfer == 11 && stripos($lb['rk'],'|8|') === false && stripos($lb['ck'],'|3|') === false &&  stripos($lb['rk'],'|13|') === false)//只入库
 
- 			if($transfer == 11 && stripos($lb['ck'],'|3|') === false &&  stripos($lb['rk'],'|13|') === false)//改出入库
 
- 			{
 
- 				echo json_encode(array('msg'=>'工厂未出库,请退回工厂!','success'=>false));exit;
 
- 			}
 
- 			$this->systemtransfer->save(array('rk'=>$lb['rk'],'rktime'=>$lb['rktime'],'ck'=>$lb['ck'],'cktime'=>$lb['cktime'],'time'=>$time,'gtime'=>date('YmdH',$time),$cztime=>$time),$lb['id']);
 
- 			$this->systemtransfer_cr->insert(array('fid'=>$lb['id'],'lx'=>$transfer,'type'=>$cz,'time'=>$time));
 
- 			//处理定时任务每三分钟 执行一次的bug  在出库的时候直接同步相关信息
 
- 			if($cz == 2){
 
- 				$this->_doCheckIsOverTime($lb['id'],$transfer);
 
- 			}
 
- 			if ($this->db->trans_status() === TRUE)
 
-         	{
 
- 				$this->db->trans_commit();
 
- 				
 
- 				
 
- 			    if($nu['state'] == '216')
 
- 				{
 
- 					echo json_encode(array('msg'=>'数据已录入成功!提示:此订单已出库,可选择终止生产。','success'=>false));exit;
 
- 				}
 
- 				elseif(($nu['state'] == '217') || ($nu['state'] == '214')){
 
- 					//标记订单已经取消
 
- 					$this->_doCheckCancelFlag($lb['id']);
 
- 					echo json_encode(array('msg'=>'数据已录入成功!提示:【该单已取消】,可选择终止生产。','success'=>false));exit;
 
- 				}
 
- 				else
 
- 				{
 
- 					if($lb['is_jiaji'] == 2){
 
- 						echo json_encode(array('music'=>'1','is_jiaji'=>2,'success'=>true));exit;
 
- 					}else{
 
- 						echo json_encode(array('music'=>'1','success'=>true));exit;
 
- 					}
 
- 				}
 
- 			}
 
- 			else
 
- 			{
 
- 				$this->db->trans_rollback();
 
- 				echo json_encode(array('msg'=>'数据写入失败,请重试!','success'=>false));exit;
 
- 			}
 
- 		}
 
- 	}
 
- 	//检测取消标记是否添加 同时也检查下 该流转单是否被标记为取消单
 
- 	private function _doCheckCancelFlag($fid){
 
- 		
 
- 		$info = $this->systemtransfer->read($fid);
 
- 		if($info['status'] != 11){
 
- 			$this->systemtransfer->save(['status'=>11],$fid);
 
- 		}
 
- 		$list = $this->systemtransfer_cr->find_all("fid = ".$fid,'*','id desc');
 
- 		if(empty($list)){
 
- 			return;
 
- 		}
 
- 		$is_cancel = false;
 
- 		foreach($list as $val){
 
- 			if($val['orver_flag'] == 3){
 
- 				$is_cancel = true;
 
- 			}
 
- 		}
 
- 		if($is_cancel){
 
- 			return ;
 
- 		}
 
- 		$this->systemtransfer_cr->save(['orver_flag'=>3],$list[0]['id']);
 
- 		
 
- 	}
 
- 	//检测是否可以取消长期未流转
 
- 	private function _doCancelWlz($fid){
 
- 		
 
- 		//$info = $this->systemtransfer->read($fid);
 
- 		
 
- 		$list = $this->systemtransfer_cr->find_all("fid = ".$fid,'*','id desc');
 
- 		if(empty($list)){
 
- 			return;
 
- 		}
 
- 		$id = $list[0]['id'];
 
- 		$scan_time = $list[0]['time'];
 
- 		if($list[0]['type'] == 2){
 
- 			if(time() - $scan_time < 3600 * 24 * 3){
 
- 				$this->systemtransfer_cr->save([
 
- 					'extra_status'=>0,
 
- 				],$id);
 
- 			}else{
 
- 				$this->systemtransfer_cr->save([
 
- 					'extra_status'=>3,
 
- 				],$id);
 
- 			}
 
- 		}
 
- 	
 
- 		
 
- 		
 
- 	}
 
- 	
 
- 	//检测是否超时  车间流转环节 
 
- 	private function  _doCheckIsOverTime($fid,$transfer){
 
- 		$list = $this->systemtransfer_cr->find_all("fid = ".$fid." and lx = ".$transfer." and is_over = 0","*",'id desc',0,2);
 
- 		if(count($list) < 2){
 
- 			return ;
 
- 		}
 
- 		if($list[0]['type'] != 2){
 
- 			return;
 
- 		}
 
- 		if($list[1]['type'] != 1){
 
- 			return;
 
- 		}
 
- 		if($list[1]['orver_flag'] == 2){
 
- 			$this->systemtransfer_cr->save(array('is_over'=>1,'orver_flag'=>2),$list[0]['id']);
 
- 		}else{
 
- 			$this->systemtransfer_cr->save(array('is_over'=>1),$list[0]['id']);
 
- 		}
 
- 		$this->systemtransfer_cr->save(array('is_over'=>1),$list[1]['id']);
 
- 	}	
 
- 	
 
- 	public function _bdbb()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['s']))  
 
- 		{
 
-             $id_arr = $this->input->post('s');
 
-             $id_arr =  explode(',',trim($id_arr,','));
 
-             if(!$id_arr)
 
-             {
 
-                 echo json_encode(array('msg'=>$v.' - 未查询到需要补打信息!','success'=>false));exit;
 
-             }
 
-             //循环删除记录
 
-             foreach ($id_arr as $v) 
 
- 		    {
 
-                 $t = $this->systemtransfer->read($v);
 
- 				if(!isset($t['number']))
 
- 				{
 
- 					echo json_encode(array('msg'=>$v.' - 补打信息已被删除!','success'=>false));exit;
 
- 				}
 
- 				$y = $this->fullorder->get_number($t['number']);
 
- 				if(!$y)
 
- 				{
 
- 					$y  = $this->fullordersmt->get_number($t['number']);
 
- 					if(!$y)
 
- 			    	{
 
- 						$y  = $this->fullordertt->get_number($t['number']);
 
- 						if(!$y)
 
- 			    		{
 
- 							echo json_encode(array('msg'=>$t['number'].'没有找到此订单','success'=>false));exit;
 
- 						}
 
- 					}
 
- 				}
 
- 				$express = $this->express->read($y['express']);
 
- 				$rows[] = array('num'=>$t['label'],'number'=>$t['number'],'shipremarks'=>$t['shipremarks'],'ex'=>$express['servicename'],'time'=>''.date('Y-m-d',$t['printtime']),'gtime'=>date('YmdH',time()),'s'=>'1/1','t'=>"补打");
 
-             }
 
-             echo json_encode(array('rows'=>($rows),'success'=>true));exit;
 
- 		}
 
-     }
 
- 	
 
- 	
 
- 	public function _excel()
 
- 	{
 
- 		if(isset($_GET['fexcel']))  
 
- 		{
 
- 			$tc = array();$zh = array();
 
- 			$typeclass = $this->typeclass->find_all();
 
- 			foreach ($typeclass as $v) 
 
- 			{
 
- 				$tc[$v['id']] = $v;
 
- 			}
 
- 			$number = $this->input->get('number',true);
 
- 			$color = $this->input->get('color',true);
 
- 			$gs = $this->input->get('gs',true);
 
- 			$transfer = $this->input->get('transfer',true);
 
- 			$type = $this->input->get('type',true);
 
- 			$timetk = $this->input->get('timetk',true);
 
- 			$timetj = $this->input->get('timetj',true);
 
- 			$purchase = $this->input->get('purchase',true);
 
- 			$lx = $this->input->get('lx',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$where = "1=1";
 
- 			$cr  = "time > '$timetk' and time < '$timetj'";
 
- 			if($number)
 
-             {
 
-                 $where  .= " and number = '$number'";
 
-             }
 
- 			if($transfer)
 
-             {
 
-                 $cr  .= " and lx = '".$transfer."'";
 
-             }
 
- 			if($type)
 
-             {
 
-                 //$cr  .= " and type = '".$type."'";
 
- 				if($type == 3){
 
- 					$cr  .= " and is_over = 0 ";
 
- 				}else{
 
- 					$cr  .= " and type = '".$type."' ";
 
- 				}
 
-             }
 
- 			if($purchase)
 
-             {
 
-                 $where  .= " and purchase = '$purchase'";
 
-             }
 
- 			if($color)
 
-             {
 
-                 $where  .= " and fpdata like '%-".$color."-%'";
 
-             }
 
- 			if($lx)
 
-             {
 
- 				if($lx == 1)
 
- 				{
 
-                     $where  .= " and ordernumber = ''";
 
- 				}
 
- 				else
 
- 				{
 
- 					$where  .= " and ordernumber != ''";
 
- 				}
 
-             }
 
- 			$fid = '';
 
- 			$info_list_cr = $this->systemtransfer_cr->find_all($cr);
 
- 			foreach ($info_list_cr as $v)
 
- 		    {
 
- 				$fid .= "id = '".$v['fid']."' or ";
 
- 			}
 
- 			if($fid)
 
- 			{
 
- 			    $where  .= ' and ('.trim($fid,'or ').')';
 
- 			}
 
- 			else
 
- 			{
 
- 				$where  .= ' and id = 0';
 
- 			}
 
- 			$data = array();
 
- 			$datafy = array();
 
- 			$j = 0;
 
- 			$info_list = $this->systemtransfer->find_all($where,'id,number,pm,jm,shipremarks,printtime');
 
- 			$lzbm = $this->transfer->find_all();
 
- 			foreach ($info_list as $key=>$value)
 
- 		    {
 
- 				$dj = '';$ys = '';$cc = '';$hx = '';$md = '';
 
- 				$d = $this->systemtransfer->read($value['id']);
 
- 				$info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
 
- 				$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('<','>'),$d['shipremarks']);
 
- 				$d['features'] = str_replace(array('163-','164-','165-','166-','-0-'),array('','','','','-'),$d['features']);
 
- 				$cp = explode('-',trim($d['features'],'-'));
 
- 				$rk = explode('|',trim($d['rk'],'|'));
 
- 				$rktime = explode('|',trim($d['rktime'],'|'));
 
- 				foreach ($cp as $v)
 
- 		        {
 
- 					if(isset($tc[$v]))
 
- 					{
 
- 						if($tc[$v]['classid'] == 13)
 
- 						{
 
- 							$dj = $tc[$v]['title'];
 
- 						}
 
- 						else if($tc[$v]['classid'] == 8)
 
- 						{
 
- 							$ys = $tc[$v]['title'];
 
- 						}
 
- 						else if($tc[$v]['classid'] == 14)
 
- 						{
 
- 							$cc = $tc[$v]['title'];
 
- 						}
 
- 						else if($tc[$v]['classid'] == 15)
 
- 						{
 
- 							$hx = $tc[$v]['title'];
 
- 						}
 
- 						else if($tc[$v]['classid'] == 10)
 
- 						{
 
- 							$md = $tc[$v]['title'];
 
- 						}
 
- 					}
 
- 				}
 
- 				$rt = array();
 
- 				foreach ($rk as $k=>$v)
 
- 		        {
 
- 					$rt[$v+5] = date('Y-m-d H:i:s',$rktime[$k]);
 
- 				}
 
- 				$fpdata = array(array('0'=>$d['title'],'1'=>$cc,'2'=>$dj,'3'=>$ys,'4'=>$hx,'5'=>$md));
 
- 				foreach ($lzbm as $v)
 
- 		        {
 
- 					if(isset($rt[count($fpdata[0])]))
 
- 					{
 
- 					    //$fpdata[0][count($fpdata[0])] = $rt[count($fpdata[0])];
 
- 					    $num = $this->systemtransfer_cr->find_count("fid = ".$value['id']." and lx = ".$v['id']." and orver_flag = 2");
 
- 						if($num > 0){
 
- 							$fpdata[0][count($fpdata[0])] = "<span style='color:red;font-weight:bold;'>".$rt[count($fpdata[0])]."<span>";
 
- 						}else{
 
- 							$fpdata[0][count($fpdata[0])] = $rt[count($fpdata[0])];
 
- 						}
 
- 					}
 
- 					else
 
- 					{
 
- 						$fpdata[0][count($fpdata[0])] = '';
 
- 					}
 
- 				}
 
- 				$info_list[$key]['fpdata'] = $fpdata;//名称,尺寸,等级,颜色,花型,密度
 
- 				unset($info_list[$key]['id']);
 
-             }
 
- 			//echo "<pre>";print_r($info_list);exit;
 
- 			$lzxq = '';
 
- 			foreach ($lzbm as $v)
 
- 		    {
 
- 				$lzxq .= '<td>'.$v['title'].'</td>';
 
- 			}
 
- 			$title = date('Y-m-d',$timetk).'-'.date('Y-m-d',$timetj).' 统计表'; 
 
-             $titlename = "<table border=1>
 
-            <tr>
 
-             <td>订单编号</td>
 
-             <td>品名</td>
 
- 			<td>简码</td>
 
- 			<td>备注</td>
 
-             <td>打印时间</td>
 
- 			<td>
 
- 			<table border=1>
 
-             <tr><td colspan='6' align='center'>订单产品信息</td><td colspan='".count($lzbm)."' align='center'>货物流转时间</td></tr>
 
-             <tr>
 
- 			<td>产品名称</td>
 
- 			<td>尺寸</td>
 
- 			<td>等级</td>
 
- 			<td>颜色</td>
 
- 			<td>花型</td>
 
- 			<td>密度</td>
 
- 			".$lzxq."
 
-             </tr>
 
-             </table>
 
- 			</td>
 
-             </tr>
 
-             </table>"; 
 
-             $filename = $title.".xls"; 
 
- 			$tail = "\n";
 
-             $this->excel->get_fz($info_list,$titlename,$filename,$tail,1);
 
- 	    }
 
- 	}
 
- 	
 
- 	public function _rk()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 	    if(isset($post['page']))  
 
- 		{
 
- 			$api = $this->input->post('api',true);
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			$number = $this->input->post('number',true);
 
- 			$color = $this->input->post('color',true);
 
- 			$purchase = $this->input->post('purchase',true);
 
- 			$transfer = $this->input->post('transfer',true);
 
- 			$lx = $this->input->post('lx',true);
 
- 			$timetk = $this->input->post('timetk',true);
 
- 			$timetj = $this->input->post('timetj',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$where = "1=1";
 
- 			if($transfer)
 
- 			{
 
- 				$ctime = 'ctime'.$transfer;
 
- 			    $where  .= " and $ctime > '$timetk' and $ctime < '$timetj'";
 
- 			}
 
- 			else
 
- 			{
 
- 				$where  .= " and time > '$timetk' and time < '$timetj'";
 
- 			}
 
- 			if($number)
 
-             {
 
-                 $where  .= " and number = '$number'";
 
-             }
 
- 			if($transfer)
 
-             {
 
-                 $where  .= " and rk like '%|".$transfer."|%'";
 
-             }
 
- 			if($purchase)
 
-             {
 
-                 $where  .= " and purchase = '$purchase'";
 
-             }
 
- 			if($color)
 
-             {
 
-                 $where  .= " and fpdata like '%-".$color."-%'";
 
-             }
 
- 			if($lx)
 
-             {
 
- 				if($lx == 1)
 
- 				{
 
-                     $where  .= " and ordernumber = ''";
 
- 				}
 
- 				else
 
- 				{
 
- 					$where  .= " and ordernumber != ''";
 
- 				}
 
-             }
 
-             //数据排序
 
-             $order_str = "id desc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
-             //取得信息列表
 
-             $info_list = $this->systemtransfer->find_all($where,'id,number,pm,shipremarks,printtime,time',$order_str,$start,$perpage);
 
- 			$transfer = $this->transfer->find_all();
 
- 			$t = array();
 
- 			foreach ($transfer as $v)
 
- 		    {
 
- 				$t[$v['id']] = $v['title'];
 
- 				$ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
 
- 			}
 
- 			 //格式化数据
 
-             foreach ($info_list as $key=>$value)
 
- 		    {
 
- 				$dd = $this->systemtransfer->read($value['id']);
 
- 				$info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
 
- 				$rk = explode('|',trim($dd['rk'],'|'));
 
- 				$rktime = explode('|',trim($dd['rktime'],'|'));
 
- 				$ck = explode('|',trim($dd['ck'],'|'));
 
- 				$cktime = explode('|',trim($dd['cktime'],'|'));
 
- 				$info_list[$key]['time'] = '';
 
- 				
 
- 				for($i=0;$i<count($rk);$i++)
 
- 		        {
 
- 					if(count($rk)-1 == $i && $ot[$rk[$i]] > 0 && $rktime[$i] + $ot[$rk[$i]] < time())
 
- 					{
 
- 						$d = ' <em style="color: #fc5454;">'.$t[$rk[$i]].'入库 :'.((isset($rktime[$i]))?(date('Y-m-d H:i',$rktime[$i])):'').' 超</em><br> ';
 
- 					}
 
- 					else
 
- 					{
 
- 						$d = $t[$rk[$i]].'入库 :'.((isset($rktime[$i]))?(date('Y-m-d H:i',$rktime[$i])):'').'<br>';
 
- 					}
 
- 					$info_list[$key]['time'] .= $d;
 
- 					if(isset($ck[$i]) && $ck[$i] != '')
 
- 					{
 
- 						$info_list[$key]['time'] .= $t[$ck[$i]].'出库 :'.date('Y-m-d H:i',$cktime[$i]).'<br>';
 
- 					}
 
- 				}
 
- 				$info_list[$key]['time'] = trim($info_list[$key]['time'],'<br>');
 
-             }
 
- 		    $total = $this->systemtransfer->find_count($where);
 
- 		    $pagenum = ceil($total/$perpage);
 
- 		    $over = $total-($start+$perpage);
 
- 		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list),'cs'=>$where);
 
- 		    echo json_encode($rows);exit;
 
- 		}
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $pid = "";$tid="";$sid="";$wid="";
 
- 		    $purchase = explode('|',trim($user['purchase'],'|'));
 
- 			$transfer = explode('|',trim($user['transfer'],'|'));
 
- 			$warehouse = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($purchase as $value) 
 
- 		    {
 
- 				$pid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($transfer as $value) 
 
- 		    {
 
- 				$tid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($warehouse as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 			}
 
- 		}
 
- 		else
 
- 		{
 
- 			header('Location: /');exit;
 
- 		}
 
- 		$transfer = $this->transfer->find_all('1=1 and '.rtrim($tid,'or'));
 
- 		$this->data['transfer'] = $transfer;
 
- 		$this->_Template('transfer_rk',$this->data);
 
- 	}
 
- 	
 
- 	public function _ck()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 	    if(isset($post['page']))  
 
- 		{
 
- 			$api = $this->input->post('api',true);
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			$number = $this->input->post('number',true);
 
- 			$color = $this->input->post('color',true);
 
- 			$purchase = $this->input->post('purchase',true);
 
- 			$transfer = $this->input->post('transfer',true);
 
- 			$lx = $this->input->post('lx',true);
 
- 			$timetk = $this->input->post('timetk',true);
 
- 			$timetj = $this->input->post('timetj',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$where = "1=1";
 
- 			if($transfer)
 
- 			{
 
- 				$ctime = 'ctime'.$transfer;
 
- 			    $where  .= " and $ctime > '$timetk' and $ctime < '$timetj'";
 
- 			}
 
- 			else
 
- 			{
 
- 				$where  .= " and time > '$timetk' and time < '$timetj'";
 
- 			}
 
- 			if($number)
 
-             {
 
-                 $where  .= " and number = '$number'";
 
-             }
 
- 			if($transfer)
 
-             {
 
-                 $where  .= " and ck like '%|".$transfer."|%'";
 
-             }
 
- 			if($purchase)
 
-             {
 
-                 $where  .= " and purchase = '$purchase'";
 
-             }
 
- 			if($color)
 
-             {
 
-                 $where  .= " and fpdata like '%-".$color."-%'";
 
-             }
 
- 			if($lx)
 
-             {
 
- 				if($lx == 1)
 
- 				{
 
-                     $where  .= " and ordernumber = ''";
 
- 				}
 
- 				else
 
- 				{
 
- 					$where  .= " and ordernumber != ''";
 
- 				}
 
-             }
 
-             //数据排序
 
-             $order_str = "id desc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
-             //取得信息列表
 
-             $info_list = $this->systemtransfer->find_all($where,'id,number,pm,shipremarks,printtime,time',$order_str,$start,$perpage);
 
- 			$transfer = $this->transfer->find_all();
 
- 			$t = array();
 
- 			foreach ($transfer as $v)
 
- 		    {
 
- 				$t[$v['id']] = $v['title'];
 
- 				$ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
 
- 			}
 
- 			 //格式化数据
 
-             foreach ($info_list as $key=>$value)
 
- 		    {
 
- 				$dd = $this->systemtransfer->read($value['id']);
 
- 				$info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
 
- 				$rk = explode('|',trim($dd['rk'],'|'));
 
- 				$rktime = explode('|',trim($dd['rktime'],'|'));
 
- 				$ck = explode('|',trim($dd['ck'],'|'));
 
- 				$cktime = explode('|',trim($dd['cktime'],'|'));
 
- 				$info_list[$key]['time'] = '';
 
- 				
 
- 				for($i=0;$i<count($rk);$i++)
 
- 		        {
 
- 					if(count($rk)-1 == $i && $ot[$rk[$i]] > 0 && $rktime[$i] + $ot[$rk[$i]] < time())
 
- 					{
 
- 						$d = ' <em style="color: #fc5454;">'.$t[$rk[$i]].'入库 :'.((isset($rktime[$i]))?(date('Y-m-d H:i',$rktime[$i])):'').' 超</em><br> ';
 
- 					}
 
- 					else
 
- 					{
 
- 						$d = $t[$rk[$i]].'入库 :'.((isset($rktime[$i]))?(date('Y-m-d H:i',$rktime[$i])):'').'<br>';
 
- 					}
 
- 					$info_list[$key]['time'] .= $d;
 
- 					if(isset($ck[$i]) && $ck[$i] != '')
 
- 					{
 
- 						$info_list[$key]['time'] .= $t[$ck[$i]].'出库 :'.date('Y-m-d H:i',$cktime[$i]).'<br>';
 
- 					}
 
- 				}
 
- 				$info_list[$key]['time'] = trim($info_list[$key]['time'],'<br>');
 
-             }
 
- 		    $total = $this->systemtransfer->find_count($where);
 
- 		    $pagenum = ceil($total/$perpage);
 
- 		    $over = $total-($start+$perpage);
 
- 		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list),'cs'=>$where);
 
- 		    echo json_encode($rows);exit;
 
- 		}
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $pid = "";$tid="";$sid="";$wid="";
 
- 		    $purchase = explode('|',trim($user['purchase'],'|'));
 
- 			$transfer = explode('|',trim($user['transfer'],'|'));
 
- 			$warehouse = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($purchase as $value) 
 
- 		    {
 
- 				$pid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($transfer as $value) 
 
- 		    {
 
- 				$tid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($warehouse as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 			}
 
- 		}
 
- 		else
 
- 		{
 
- 			header('Location: /');exit;
 
- 		}
 
- 		$transfer = $this->transfer->find_all('1=1 and '.rtrim($tid,'or'));
 
- 		$this->data['transfer'] = $transfer;
 
- 		$this->_Template('transfer_ck',$this->data);
 
- 	}
 
- 	
 
- 	
 
- 	public function _jgl()
 
- 	{
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 		if(isset($post['printtime']))  
 
- 		{
 
- 		    $pt = $this->input->post('printtime',true);
 
- 			$wt = $this->input->post('wgtime',true);
 
- 			$printtime = strtotime($pt);
 
- 			$wgtime = strtotime($wt);
 
- 			$sy = $this->systemtransfer->find_count("printtime > '$printtime' and printtime < '".($printtime+24*3600)."'");
 
- 			$wg = $this->systemtransfer->find_count("printtime > '$printtime' and printtime < '".($printtime+24*3600)."' and ctime11 < '$wgtime' and ctime11 != '0'");
 
- 			if($printtime == $wgtime || $printtime > $wgtime)
 
- 			{
 
- 				echo json_encode(array('msg'=>"<p style='height:140px;line-height:140px'>时间选择错误</p>",'success'=>true));exit;
 
- 			}
 
- 			echo json_encode(array('msg'=>"<p style='height:140px;line-height:140px'>".(($wgtime-$printtime)/86400)."天 完工数量:".$wg.", 总数量:".$sy.", 完工率:".number_format(($wg/$sy*100),2)."%</p>",'success'=>true));exit;
 
- 	    }
 
- 		$this->_Template('transfer_wgl',$this->data);
 
- 	}
 
- 	
 
- 	public function _linqi(){
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 	    if(isset($post['page']))  
 
- 		{
 
- 			$api = $this->input->post('api',true);
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			
 
- 			$transfer = $this->input->post('transfer',true);
 
- 			$transfer_ids = $this->input->post('transfer_ids',true);
 
- 			$orver_flag = $this->input->post('orver_flag',true);
 
- 			
 
- 			$timetk = $this->input->post('timetk',true);
 
- 			$timetj = $this->input->post('timetj',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$transfer_list = $this->transfer->find_all();
 
- 			$t = $transfer_list = array_column($transfer_list, 'title', 'id');
 
- 			$where = 'type = 1 ';
 
- 			
 
- 			$where .= " and is_over = 0 and orver_flag = ".$orver_flag." ";
 
-             //数据排序
 
-             $order_str = "id desc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
- 			
 
- 			if($transfer){
 
- 				$where  .= " and lx = '$transfer'";
 
- 			}else{
 
- 			    $where .= " and lx in (".$transfer_ids.") ";
 
- 			}
 
- 			
 
- 			$where  .= " and time > '$timetk' and time < '$timetj'";
 
- 			
 
- 			$list = $this->systemtransfer_cr->find_all($where,'*',$order_str,$start,$perpage);
 
- 			$final_list = [];
 
- 			foreach ($list as $key => $value) {
 
- 			    
 
- 				$info = $this->systemtransfer->read($value['fid']);
 
- 				$final_list[$key]['id'] = $value['id'];
 
- 				$final_list[$key]['number'] = isset($info['number'])?$info['number']:'';
 
- 			
 
- 				if($info['is_jiaji'] == 2){
 
- 		            $final_list[$key]['is_jiaji'] = "<a href='javascript:void(0)' style='color:red'>加急</a>";
 
- 		        }else{
 
- 		            $final_list[$key]['is_jiaji'] = "常规";
 
- 		        }
 
- 			
 
- 				$final_list[$key]['pm'] = $info['pm'];
 
- 				$final_list[$key]['shipremarks'] = $info['shipremarks'];
 
- 				$final_list[$key]['printtime'] = date('Y-m-d H:i:s',$info['printtime']);
 
- 				$data = $this->systemtransfer_cr->find_all("fid = '".$info['id']."'");
 
- 				
 
- 				$info_list[$key]['time'] = "布标打印 :".date('Y-m-d H:i',$info['ctime12']).'<br>';
 
- 				foreach ($data as $k=>$v)
 
- 		        {
 
- 					$type = ($v['type']==1)?'入库':'出库';
 
- 					
 
- 					
 
- 					if($v['orver_flag'] == 1){
 
- 						if($v['is_over'] == 0){
 
- 							$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#90f'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l style='padding-left:10px;font-weight:900;'> 即将超时 </l></a>".'<br>';
 
- 							// $info_list[$key]['time'] .= '<i style="padding:10px;color:#90f;font-weight:bold;"> 即将超时</i>'.'<br>';
 
- 						}else{
 
- 							$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</a>".'<br>';
 
- 						}
 
- 					}elseif($v['orver_flag'] == 2){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#f33'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l style='padding-left:10px;font-weight:900'> 超 时 ! </l></a>".'<br>';
 
- 					}else{
 
- 						$info_list[$key]['time'] .= "<a  href='javascript:void(0);' style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</a>".'<br>';
 
- 					}
 
- 				}
 
- 				
 
- 				$final_list[$key]['time'] = trim($info_list[$key]['time'],'<br>');
 
- 			}
 
- 			
 
- 			$total = $this->systemtransfer_cr->find_count($where);
 
- 		   
 
- 		    $pagenum = ceil($total/$perpage);
 
- 		    $over = $total-($start+$perpage);
 
- 		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($final_list));
 
- 		    echo json_encode($rows);exit;
 
- 		}
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $pid = "";$tid="";$sid="";$wid="";
 
- 		    $purchase = explode('|',trim($user['purchase'],'|'));
 
- 			$transfer = explode('|',trim($user['transfer'],'|'));
 
- 			$warehouse = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($purchase as $value) 
 
- 		    {
 
- 				$pid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($transfer as $value) 
 
- 		    {
 
- 				$tid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($warehouse as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 			}
 
- 		}
 
- 		else
 
- 		{
 
- 			header('Location: /');exit;
 
- 		}
 
- 		$kx = '';$zjtab = '';
 
- 		
 
- 		$transfer = $this->transfer->find_all('1=1 and '.rtrim($tid,'or'));
 
- 		
 
- 		$this->data['transfer'] = $transfer;
 
- 		$transfer_ids = array_column($transfer, 'id');
 
- 		$this->data['transfer_ids'] =implode(",",$transfer_ids) ;
 
- 		$this->data['vip'] = $user['vip'];
 
- 		$this->data['orver_flag'] = $this->input->get('orver_flag', TRUE);
 
- 		$this->_Template('transfer_linqi',$this->data);
 
- 	}
 
- 	//按照条件导出超时车间
 
- 	public function _overtime_export(){
 
- 		$transfer_id = $this->input->get('transfer', TRUE);
 
- 		$timetk = $this->input->get('timetk', TRUE);
 
- 		$timetj = $this->input->get('timetj', TRUE);
 
- 		$timetk = strtotime($timetk);
 
- 		$timetj = strtotime($timetj);
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$transfer_ids = explode('|',trim($user['transfer'],'|'));
 
- 			$tmp_transfer_list = $this->transfer->find_all();
 
- 			$transfer_list = array_column($tmp_transfer_list, 'title', 'id');
 
- 		}
 
- 		else
 
- 		{
 
- 			header('Location: /');exit;
 
- 		}
 
- 		$where = " orver_flag =  2 and type = 1";
 
- 		
 
- 		if(empty($transfer_id)){
 
- 			$where .= " and lx in (".implode(',',$transfer_ids).")  ";
 
- 		}else{
 
- 			$where .= " and lx = ".$transfer_id." ";
 
- 		}
 
- 		$where  .= " and time > '$timetk' and time < '$timetj'";
 
- 		$list = $this->systemtransfer_cr->find_all($where,'*');
 
- 		$fid_list = array_column($list, 'fid');
 
- 		if(empty($fid_list)){
 
- 			echo "没有数据" ;
 
- 			die ;
 
- 		}
 
- 		$order_list = $this->systemtransfer->find_all("id in (".implode(',',$fid_list).")");
 
- 		
 
- 		
 
- 		$where_two = " orver_flag =  2 and type = 2";
 
- 		
 
- 		if(empty($transfer_id)){
 
- 			$where_two .= " and lx in (".implode(',',$transfer_ids).")  ";
 
- 		}else{
 
- 			$where_two .= " and lx = ".$transfer_id." ";
 
- 		}
 
- 		$where_two  .= " and time > '$timetk' and time < '$timetj'";
 
- 		$list_two = $this->systemtransfer_cr->find_all($where_two,'*');
 
- 		$final_list = [];
 
- // 		foreach($list as $k => $v){
 
- // 			$final_list[$v['fid']]['fid'] = $v['fid'];
 
- // 			$final_list[$v['fid']]['lx'] = $v['lx'];
 
- // 			$final_list[$v['fid']]['start_type'] = $v['type'];
 
- // 			$final_list[$v['fid']]['start_time'] = date('Y-m-d H:i:s',$v['time']);
 
- // 			$final_list[$v['fid']]['condition'] = json_decode($v['limit_time_str'],true);
 
- // 			$final_list[$v['fid']]['end_time'] = "";
 
- // 			$final_list[$v['fid']]['lx_name'] = isset($transfer_list[$v['lx']])?$transfer_list[$v['lx']]:'';
 
- // 		}
 
- 		
 
- // 		foreach($order_list as $k=>$v){
 
- // 			if(isset($final_list[$v['id']])){
 
- // 				$final_list[$v['id']]['number'] = $v['number'];
 
- // 				$final_list[$v['id']]['pm'] = $v['pm'];
 
- // 			}
 
- // 		}
 
- 		
 
- // 		foreach($list_two as $k => $v){
 
- // 			if(isset($final_list[$v['fid']])){
 
- // 				if($v['lx'] ==$final_list[$v['fid']]['lx']){
 
- // 					$final_list[$v['fid']]['end_time'] = date('Y-m-d H:i:s',$v['time']);
 
- // 				}
 
- 				
 
- // 			}
 
- // 		}
 
-     
 
-         foreach($list as $k => $v){
 
- 			$final_list[] = [
 
- 				'fid' => $v['fid'],
 
- 				'lx' => $v['lx'],
 
- 				'start_type' => $v['type'],
 
- 				'start_time' => date('Y-m-d H:i:s',$v['time']),
 
- 				'condition' => json_decode($v['limit_time_str'],true),
 
- 				'end_time' => "",
 
- 				'lx_name' => isset($transfer_list[$v['lx']])?$transfer_list[$v['lx']]:'',
 
- 			];
 
- 		}
 
- 		
 
- 		foreach($order_list as $k=>$v){
 
- 			foreach($final_list as $kk => $vv){
 
- 				if($v['id'] == $vv['fid']){
 
- 					$final_list[$kk]['number'] = $v['number'];
 
- 					$final_list[$kk]['pm'] = $v['pm'];
 
- 				}
 
- 			}
 
- 		}
 
- 		
 
- 		foreach($list_two as $k => $v){
 
- 			foreach($final_list as $kk => $vv){
 
- 				if(($v['fid'] == $vv['fid']) && ($v['lx'] == $vv['lx'])){
 
- 					$final_list[$kk]['end_time'] = date('Y-m-d H:i:s',$v['time']);
 
- 				}
 
- 			}
 
- 			
 
- 		}
 
-         
 
- 		$filename = date("Y-m-d")."超时单导出.xls";
 
- 		$str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
 
-         <head>
 
-         <!--[if gte mso 9]><xml>
 
-         <x:ExcelWorkbook>
 
-         <x:ExcelWorksheets>
 
-         <x:ExcelWorksheet>
 
-         <x:Name>EXCEL</x:Name>
 
-         <x:WorksheetOptions>
 
-         <x:Print>
 
-         <x:ValidPrinterInfo />
 
-         </x:Print>
 
-         </x:WorksheetOptions>
 
-         </x:ExcelWorksheet>
 
-         </x:ExcelWorksheets>
 
-         </x:ExcelWorkbook>
 
-         </xml>
 
-         <![endif]-->
 
-         </head><body>";
 
- 		$str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>"; 
 
- 		$str .= "<tr><td>订单编号</td><td>品名</td><td>车间</td><td>入库日期</td><td>出库日期</td></tr>";
 
- 		foreach ($final_list as $key=>$value) 
 
- 		{ 
 
- 			if(empty($value['number'])){
 
- 				continue;
 
- 			}
 
- 		    $str .= "<tr>";
 
- 			$str .= "<td>". $value['number']. "</td>";
 
- 			$str .= "<td>". $value['pm']. "</td>";	
 
- 			$str .= "<td>". $value['lx_name']. "</td>";	
 
- 			$str .= "<td>". $value['start_time']. "</td>";
 
- 			$str .= "<td>". $value['end_time']. "</td>";
 
- 			$str .= "</tr>";
 
- 		}
 
- 		$str .= "</table></body></html>"; 
 
- 		header( "Content-Type: application/vnd.ms-excel; name='excel'" ); 
 
- 		header( "Content-type: application/octet-stream" ); 
 
- 		header( "Content-Disposition: attachment; filename=".$filename ); 
 
- 		header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); 
 
- 		header( "Pragma: no-cache" ); 
 
- 		header( "Expires: 0" ); 
 
- 		exit($str); 
 
- 	}
 
- 	public function _jiaji(){
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 	    if(isset($post['page']))  
 
- 		{
 
- 			$api = $this->input->post('api',true);
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			
 
- 			$transfer = $this->input->post('transfer',true);
 
- 			$transfer_ids = $this->input->post('transfer_ids',true);
 
- 			$orver_flag = $this->input->post('orver_flag',true);
 
- 			
 
- 			$timetk = $this->input->post('timetk',true);
 
- 			$timetj = $this->input->post('timetj',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$transfer_list = $this->transfer->find_all();
 
- 			$t = $transfer_list = array_column($transfer_list, 'title', 'id');
 
- 			if(isset($_SESSION['api']))
 
- 			{
 
- 				$user = $this->user->get_api($_SESSION['api']);
 
- 				
 
- 				$transfer_ids = explode('|',trim($user['transfer'],'|'));
 
- 			}
 
- 			else
 
- 			{
 
- 				$transfer_ids = array_keys($t);
 
- 			}
 
- 			
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
- 			
 
- 			$sql_r = "select s.* from crowd_systemtransfer as s inner join crowd_systemtransfer_cr as c   on c.fid = s.id and c.is_over = 0 and  c.time > ".$timetk ." and c.time < ".$timetj." ";
 
- 			if($transfer){
 
- 				$sql_r .= " and c.lx = ".$transfer." ";
 
- 				
 
- 				
 
- 			}else{
 
- 				foreach($transfer_ids as $k=>$v){
 
- 					if($v == 11){
 
- 						unset($transfer_ids[$k]);
 
- 					}
 
- 				}
 
- 			    $transfer_str = implode(",",$transfer_ids);
 
- 				$sql_r .=  " and c.lx in (".$transfer_str.") ";
 
- 			}
 
- 			$sql_r .=" where s.is_jiaji = 2 and s.rk not like '%|11|%' " ;
 
- 			$rows_r = $this->db->query($sql_r);
 
- 			$get_list = $rows_r->result_array();
 
- 			
 
- 			$total = count($get_list);
 
- 			
 
- 			$split_list = array_chunk($get_list,$perpage);
 
- 		
 
- 			$pagenum = ceil(count($split_list));
 
- 			$key = $page - 1;
 
- 			$list = isset($split_list[$key])?$split_list[$key]:[];
 
- 			$final_list = [];
 
- 			foreach ($list as $key => $value) {
 
- 			   
 
- 				$final_list[$key]['id'] = $value['id'];
 
- 				$final_list[$key]['number'] = isset($value['number'])?$value['number']:'';
 
- 			
 
- 				if($value['is_jiaji'] == 2){
 
- 		            $final_list[$key]['is_jiaji'] = "<a href='javascript:void(0)' style='color:red'>加急</a>";
 
- 		        }else{
 
- 		            $final_list[$key]['is_jiaji'] = "常规";
 
- 		        }
 
- 			
 
- 				$final_list[$key]['pm'] = $value['pm'];
 
- 				$final_list[$key]['shipremarks'] = $value['shipremarks'];
 
- 				$final_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
 
- 				$data = $this->systemtransfer_cr->find_all("fid = '".$value['id']."'");
 
- 				
 
- 				$info_list[$key]['time'] = "布标打印 :".date('Y-m-d H:i',$value['ctime12']).'<br>';
 
- 				foreach ($data as $k=>$v)
 
- 		        {
 
- 					$type = ($v['type']==1)?'入库':'出库';
 
- 					
 
- 					
 
- 					if($v['orver_flag'] == 1){
 
- 						if($v['is_over'] == 0){
 
- 							$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#90f'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l style='padding-left:10px;font-weight:900;'> 即将超时 </l></a>".'<br>';
 
- 							// $info_list[$key]['time'] .= '<i style="padding:10px;color:#90f;font-weight:bold;"> 即将超时</i>'.'<br>';
 
- 						}else{
 
- 							$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</a>".'<br>';
 
- 						}
 
- 					}elseif($v['orver_flag'] == 2){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#f33'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l style='padding-left:10px;font-weight:900'> 超 时 ! </l></a>".'<br>';
 
- 					}else{
 
- 						$info_list[$key]['time'] .= "<a  href='javascript:void(0);' style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</a>".'<br>';
 
- 					}
 
- 				}
 
- 				
 
- 				$final_list[$key]['time'] = trim($info_list[$key]['time'],'<br>');
 
- 			}
 
- 			
 
- 			
 
- 		   
 
- 		   
 
- 		    $over = $total-($start+$perpage);
 
- 		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($final_list));
 
- 		    echo json_encode($rows);exit;
 
- 			    
 
- 			
 
- 		}
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $pid = "";$tid="";$sid="";$wid="";
 
- 		    $purchase = explode('|',trim($user['purchase'],'|'));
 
- 			$transfer = explode('|',trim($user['transfer'],'|'));
 
- 			$warehouse = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($purchase as $value) 
 
- 		    {
 
- 				$pid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($transfer as $value) 
 
- 		    {
 
- 				if($value){
 
- 					if($value != 11){
 
- 						$tid .= " id = ".$value." or";
 
- 					}
 
- 				}
 
- 			}
 
- 			foreach ($warehouse as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 			}
 
- 		}
 
- 		else
 
- 		{
 
- 			header('Location: /');exit;
 
- 		}
 
- 		$kx = '';$zjtab = '';
 
- 		
 
- 		$transfer = $this->transfer->find_all('1=1 and '.rtrim($tid,'or'));
 
- 		
 
- 		$this->data['transfer'] = $transfer;
 
- 		$transfer_ids = array_column($transfer, 'id');
 
- 		$this->data['transfer_ids'] =implode(",",$transfer_ids) ;
 
- 		$this->data['vip'] = $user['vip'];
 
- 		$this->data['orver_flag'] = $this->input->get('orver_flag', TRUE);
 
- 		$this->_Template('transfer_jiaji',$this->data);
 
- 	}
 
- 	public function _scz(){
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 	    if(isset($post['page']))  
 
- 		{
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			
 
- 			$transfer = $this->input->post('transfer',true);
 
- 			$transfer_ids = $this->input->post('transfer_ids',true);
 
- 			
 
- 			$timetk = $this->input->post('timetk',true);
 
- 			$timetj = $this->input->post('timetj',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			// $transfer_list = $this->transfer->find_all('id not in (8,9,11,12,15,16)');
 
- 			// $t = $transfer_list = array_column($transfer_list, 'title', 'id');
 
- 			// $transfer_ids = array_keys($t);
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
- 			$where  = "time > '$timetk' and time < '$timetj'";
 
- 			$where .= " and rk not like '%11|' ";
 
- 			if(!empty($transfer)){
 
- 				$where .= " and rk like '%|".$transfer."|%' ";
 
- 			}
 
- 			
 
- 			// if($transfer)
 
- 			// {
 
- 			// 	$cr  .= " and lx = '".$transfer."' ";
 
- 			// }else{
 
- 			// 	$cr  .= " and lx in (".implode(",",$transfer_ids).") ";
 
- 			// }
 
- 			// 	$cr  .= " and is_over = 0 ";
 
- 			// $info_list_cr = $this->systemtransfer_cr->find_all($cr);
 
- 			// $fid = [];
 
- 			// foreach ($info_list_cr as $v)
 
- 			// {
 
- 			// 	$fid[] = $v['fid']; 
 
- 			// }
 
- 			
 
- 			// if(empty($fid)){
 
- 			// 	$rows = array('total'=>0,'over'=>0,'pagenum'=>0,'rows'=>([]));
 
- 			// 	echo json_encode($rows);exit;
 
- 			// }
 
- 			// $fid = array_unique($fid);
 
- 			$order_str = "id desc";
 
-             //取得信息列表
 
-             $info_list = $this->systemtransfer->find_all($where,'id,number,is_jiaji,pm,shipremarks,printtime,time,ctime12',$order_str,$start,$perpage);
 
- 			$transfer = $this->transfer->find_all();
 
- 			$t = array();
 
- 			foreach ($transfer as $v)
 
- 		    {
 
- 				$t[$v['id']] = $v['title'];
 
- 				$ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
 
- 			}
 
- 			 //格式化数据
 
-             foreach ($info_list as $key=>$value)
 
- 		    {
 
- 		        if($value['is_jiaji'] == 2){
 
- 		            $info_list[$key]['is_jiaji'] = "<a href='javascript:void(0)' style='color:red'>加急</a>";
 
- 		        }else{
 
- 		            $info_list[$key]['is_jiaji'] = "常规";
 
- 		        }
 
- 				$dd = $this->systemtransfer->read($value['id']);
 
- 				$info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
 
- 				$rk = explode('|',trim($dd['rk'],'|'));
 
- 				$rktime = explode('|',trim($dd['rktime'],'|'));
 
- 				$ck = explode('|',trim($dd['ck'],'|'));
 
- 				$cktime = explode('|',trim($dd['cktime'],'|'));
 
- 				$info_list[$key]['time'] = '';
 
- 				$data = $this->systemtransfer_cr->find_all("fid = '".$value['id']."'");
 
- 				
 
- 				//$info_list[$key]['time'] = "订单出库 :".date('Y-m-d H:i',$value['printtime']).'<br>';
 
- 				$info_list[$key]['time'] = "布标打印 :".date('Y-m-d H:i',$value['ctime12']).'<br>';
 
- 				foreach ($data as $k=>$v)
 
- 		        {
 
- 				// 	$type = ($v['type']==1)?'入库':'出库';
 
- 				// 	$info_list[$key]['time'] .= $t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']).'<br>';
 
- 					
 
- 				    $type = ($v['type']==1)?'入库':'出库';
 
- 				
 
- 				    if($v['orver_flag'] == 1){
 
- 						if($v['is_over'] == 0){
 
- 							$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#90f'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l style='font-weight:900;'>即将超时 </l></a>".'<br>';
 
- 							// $info_list[$key]['time'] .= '<i style="padding:10px;color:#90f;font-weight:bold;"> 即将超时</i>'.'<br>';
 
- 						}else{
 
- 							$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</a>".'<br>';
 
- 						}
 
- 					}elseif($v['orver_flag'] == 2){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#f33'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l font-weight:900'>超时! </l></a>".'<br>';
 
- 					}elseif($v['orver_flag'] == 3){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#06f'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l font-weight:900'>【该单已取消】 </l></a>".'<br>';
 
- 					}else{
 
- 						$info_list[$key]['time'] .= "<a  href='javascript:void(0);' style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</a>".'<br>';
 
- 					}
 
- 				}
 
- 				$info_list[$key]['time'] = trim($info_list[$key]['time'],'<br>');
 
- 				unset($info_list[$key]['ctime12']);
 
-             }
 
- 			
 
- 		    $total = $this->systemtransfer->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']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			if(!in_array($user['id'],[10,44,50])){
 
- 				exit('No direct script access allowed');
 
- 			}
 
- 		}
 
- 		else
 
- 		{
 
- 			header('Location: /');exit;
 
- 		}
 
- 		$kx = '';$zjtab = '';
 
- 		
 
- 		$transfer = $this->transfer->find_all('id not in (8,9,11,12,15,16)');
 
- 		$this->data['transfer'] = $transfer;
 
- 		$transfer_ids = array_column($transfer, 'id');
 
- 		$this->data['transfer_ids'] =implode(",",$transfer_ids) ;
 
- 		$this->_Template('transfer_scz',$this->data);
 
- 	}
 
- 	public function _sczexcel(){
 
- 		$timetk = $this->input->get('timetk',true);
 
- 		$timetj = $this->input->get('timetj',true);
 
- 		$timetk = strtotime($timetk);
 
- 		$timetj = strtotime($timetj);
 
- 		// $transfer_list = $this->transfer->find_all('id not in (8,9,11,12,15,16)');
 
- 		// $t = $transfer_list = array_column($transfer_list, 'title', 'id');
 
- 		// $transfer_ids = array_keys($t);
 
- 		$where  = "time > '$timetk' and time < '$timetj'";
 
- 		$where .= " and rk not like '%11|' ";
 
- 		if(!empty($transfer)){
 
- 			$where .= " and rk like '%|".$transfer."|%' ";
 
- 		}
 
- 		
 
- 		$order_str = "id desc";
 
- 		//取得信息列表
 
- 		$info_list = $this->systemtransfer->find_all($where,'id,number,is_jiaji,pm,shipremarks,printtime,time,ctime12',$order_str);
 
- 		$transfer = $this->transfer->find_all();
 
- 		$t = array();
 
- 		foreach ($transfer as $v)
 
- 		{
 
- 			$t[$v['id']] = $v['title'];
 
- 			$ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
 
- 		}
 
- 		 //格式化数据
 
- 		foreach ($info_list as $key=>$value)
 
- 		{
 
- 			if($value['is_jiaji'] == 2){
 
- 				$info_list[$key]['is_jiaji'] = "<span style='color:red'>加急</span>";
 
- 			}else{
 
- 				$info_list[$key]['is_jiaji'] = "常规";
 
- 			}
 
- 			$dd = $this->systemtransfer->read($value['id']);
 
- 			$info_list[$key]['printtime'] = date('Y-m-d H:i:s',$value['printtime']);
 
- 			$rk = explode('|',trim($dd['rk'],'|'));
 
- 			$rktime = explode('|',trim($dd['rktime'],'|'));
 
- 			$ck = explode('|',trim($dd['ck'],'|'));
 
- 			$cktime = explode('|',trim($dd['cktime'],'|'));
 
- 			$info_list[$key]['time'] = '';
 
- 			$data = $this->systemtransfer_cr->find_all("fid = '".$value['id']."'");
 
- 			
 
- 			//$info_list[$key]['time'] = "订单出库 :".date('Y-m-d H:i',$value['printtime']).'<br>';
 
- 			$info_list[$key]['time'] = "布标打印 :".date('Y-m-d H:i',$value['ctime12']).'<br>';
 
- 			foreach ($data as $k=>$v)
 
- 			{
 
- 			// 	$type = ($v['type']==1)?'入库':'出库';
 
- 			// 	$info_list[$key]['time'] .= $t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']).'<br>';
 
- 				
 
- 				$type = ($v['type']==1)?'入库':'出库';
 
- 			
 
- 				if($v['orver_flag'] == 1){
 
- 					if($v['is_over'] == 0){
 
- 						$info_list[$key]['time'] .= "<span  style='color:#90f'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l style='font-weight:900;'>即将超时 </l></span>".'<br>';
 
- 						// $info_list[$key]['time'] .= '<i style="padding:10px;color:#90f;font-weight:bold;"> 即将超时</i>'.'<br>';
 
- 					}else{
 
- 						$info_list[$key]['time'] .= "<span  style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</span>".'<br>';
 
- 					}
 
- 				}elseif($v['orver_flag'] == 2){
 
- 					$info_list[$key]['time'] .= "<span style='color:#f33'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l font-weight:900'>超时! </l></span>".'<br>';
 
- 				}elseif($v['orver_flag'] == 3){
 
- 					$info_list[$key]['time'] .= "<span style='color:#06f'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l font-weight:900'>【该单已取消】 </l></span>".'<br>';
 
- 				}else{
 
- 					$info_list[$key]['time'] .= "<span style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</span>".'<br>';
 
- 				}
 
- 			}
 
- 			$info_list[$key]['time'] = trim($info_list[$key]['time'],'<br>');
 
- 			unset($info_list[$key]['ctime12']);
 
- 		}
 
- 		$filename = date("Y-m-d")."生产中订单.xls";
 
- 		$str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
 
-         <head>
 
-         <!--[if gte mso 9]><xml>
 
-         <x:ExcelWorkbook>
 
-         <x:ExcelWorksheets>
 
-         <x:ExcelWorksheet>
 
-         <x:Name>EXCEL</x:Name>
 
-         <x:WorksheetOptions>
 
-         <x:Print>
 
-         <x:ValidPrinterInfo />
 
-         </x:Print>
 
-         </x:WorksheetOptions>
 
-         </x:ExcelWorksheet>
 
-         </x:ExcelWorksheets>
 
-         </x:ExcelWorkbook>
 
-         </xml>
 
-         <![endif]-->
 
-         </head><body>";
 
- 		$str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>"; 
 
- 		$str .= "<tr><td>订单编号</td><td>加急</td><td>品名</td><td>备注</td><td>打印时间</td><td>操作</td></tr>";
 
- 		foreach ($info_list as $key=>$value) 
 
- 		{ 
 
- 			
 
- 		    $str .= "<tr>";
 
- 			$str .= "<td>". $value['number']. "</td>";
 
- 			$str .= "<td>". $value['is_jiaji']. "</td>";	
 
- 			$str .= "<td>". $value['pm']. "</td>";	
 
- 			$str .= "<td>". $value['shipremarks']. "</td>";
 
- 			$str .= "<td>". $value['printtime']. "</td>";
 
- 			$str .= "<td>". $value['time']. "</td>";
 
- 			$str .= "</tr>";
 
- 		}
 
- 		$str .= "</table></body></html>"; 
 
- 		header( "Content-Type: application/vnd.ms-excel; name='excel'" ); 
 
- 		header( "Content-type: application/octet-stream" ); 
 
- 		header( "Content-Disposition: attachment; filename=".$filename ); 
 
- 		header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); 
 
- 		header( "Pragma: no-cache" ); 
 
- 		header( "Expires: 0" ); 
 
- 		exit($str); 
 
- 	}
 
- 	public function _wjsrk(){
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 	    if(isset($post['page']))  
 
- 		{
 
- 			$api = $this->input->post('api',true);
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			
 
- 			$transfer = $this->input->post('transfer',true);
 
- 			$transfer_ids = $this->input->post('transfer_ids',true);
 
- 			$orver_flag = $this->input->post('orver_flag',true);
 
- 			
 
- 			$timetk = $this->input->post('timetk',true);
 
- 			$timetj = $this->input->post('timetj',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$transfer_list = $this->transfer->find_all();
 
- 			$t = $transfer_list = array_column($transfer_list, 'title', 'id');
 
- 			$where = 'extra_status in (1,2) ';
 
- 			
 
-             //数据排序
 
-             $order_str = "id desc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
- 			
 
- 			if($transfer){
 
- 				$where  .= " and lx = '$transfer'";
 
- 			}else{
 
- 			
 
- 			    $where .= " and lx in (".$transfer_ids.") ";
 
- 			}
 
- 			
 
- 			$where  .= " and time > '$timetk' and time < '$timetj'";
 
- 			
 
- 			$list = $this->systemtransfer_cr->find_all($where,'*',$order_str,$start,$perpage);
 
- 			$final_list = [];
 
- 			foreach ($list as $key => $value) {
 
- 			    
 
- 				$info = $this->systemtransfer->read($value['fid']);
 
- 				$final_list[$key]['id'] = $value['id'];
 
- 				$final_list[$key]['number'] = isset($info['number'])?$info['number']:'';
 
- 			
 
- 				if($info['is_jiaji'] == 2){
 
- 		            $final_list[$key]['is_jiaji'] = "<a href='javascript:void(0)' style='color:red'>加急</a>";
 
- 		        }else{
 
- 		            $final_list[$key]['is_jiaji'] = "常规";
 
- 		        }
 
- 			
 
- 				$final_list[$key]['pm'] = $info['pm'];
 
- 				$final_list[$key]['shipremarks'] = $info['shipremarks'];
 
- 				$final_list[$key]['printtime'] = date('Y-m-d H:i:s',$info['printtime']);
 
- 				$data = $this->systemtransfer_cr->find_all("fid = '".$info['id']."'");
 
- 				
 
- 				$info_list[$key]['time'] = "布标打印 :".date('Y-m-d H:i',$info['ctime12']).'<br>';
 
- 				foreach ($data as $k=>$v)
 
- 		        {
 
- 					$type = ($v['type']==1)?'入库':'出库';
 
- 					
 
- 					
 
- 					if($v['orver_flag'] == 1){
 
- 						if($v['is_over'] == 0){
 
- 							$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#90f'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l style='padding-left:10px;font-weight:900;'> 即将超时 </l></a>";
 
- 							// $info_list[$key]['time'] .= '<i style="padding:10px;color:#90f;font-weight:bold;"> 即将超时</i>'.'<br>';
 
- 						}else{
 
- 							$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</a>";
 
- 						}
 
- 					}elseif($v['orver_flag'] == 2){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#f33'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l style='padding-left:10px;font-weight:900'> 超 时 ! </l></a>";
 
- 					}else{
 
- 						$info_list[$key]['time'] .= "<a  href='javascript:void(0);' style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</a>";
 
- 					}
 
- 					if($v['extra_status'] == 1){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#90f'>【下道工序未及时入库】</a><br>";
 
- 					}elseif($v['extra_status'] == 2  || $v['extra_status'] == 3){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#A52A2A'>【工序间流转超过3天】</a><br>";
 
- 					}else{
 
- 						$info_list[$key]['time'] .= "<br>";
 
- 					}
 
- 				}
 
- 				
 
- 				$final_list[$key]['time'] = trim($info_list[$key]['time'],'<br>');
 
- 			}
 
- 			
 
- 			$total = $this->systemtransfer_cr->find_count($where);
 
- 		   
 
- 		    $pagenum = ceil($total/$perpage);
 
- 		    $over = $total-($start+$perpage);
 
- 		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($final_list));
 
- 		    echo json_encode($rows);exit;
 
- 		}
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $pid = "";$tid="";$sid="";$wid="";
 
- 		    $purchase = explode('|',trim($user['purchase'],'|'));
 
- 			$transfer = explode('|',trim($user['transfer'],'|'));
 
- 			$warehouse = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($purchase as $value) 
 
- 		    {
 
- 				$pid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($transfer as $value) 
 
- 		    {
 
- 				$tid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($warehouse as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 			}
 
- 		}
 
- 		else
 
- 		{
 
- 			header('Location: /');exit;
 
- 		}
 
- 		$kx = '';$zjtab = '';
 
- 		
 
- 		$transfer = $this->transfer->find_all('1=1 and '.rtrim($tid,'or'));
 
- 		
 
- 		$this->data['transfer'] = $transfer;
 
- 		$transfer_ids = array_column($transfer, 'id');
 
- 		$this->data['transfer_ids'] =implode(",",$transfer_ids) ;
 
- 		$this->data['vip'] = $user['vip'];
 
- 		$this->data['orver_flag'] = $this->input->get('orver_flag', TRUE);
 
- 		$this->_Template('transfer_wjsrk',$this->data);
 
- 	}
 
- 	public function _wjsrkexcel(){
 
- 		$api = $this->input->get('api',true);
 
- 		$transfer = $this->input->get('transfer',true);
 
- 		$timetk = $this->input->get('timetk',true);
 
- 		$timetj = $this->input->get('timetj',true);
 
- 		$timetk = strtotime($timetk);
 
- 		$timetj = strtotime($timetj);
 
- 		$transfer_list = $this->transfer->find_all();
 
- 		$t = $transfer_list = array_column($transfer_list, 'title', 'id');
 
- 		$where = 'extra_status in (1,2) ';
 
- 		
 
- 		//数据排序
 
- 		$order_str = "id desc";
 
- 	
 
- 		
 
- 		if($transfer){
 
- 			$where  .= " and lx = '$transfer'";
 
- 		}else{
 
- 			$transfer = $this->transfer->find_all('id not in (8,9,11,12,15,16)');
 
- 			$transfer_ids = array_column($transfer, 'id');
 
- 			$transfer_ids = implode(",",$transfer_ids);
 
- 		    $where .= " and lx in (".$transfer_ids.") ";
 
- 		}
 
- 		
 
- 		
 
- 		$where  .= " and time > '$timetk' and time < '$timetj'";
 
- 		
 
- 		$list = $this->systemtransfer_cr->find_all($where,'*',$order_str);
 
- 	
 
- 		$final_list = [];
 
- 		foreach ($list as $key => $value) {
 
- 			
 
- 			$info = $this->systemtransfer->read($value['fid']);
 
- 			
 
- 			$final_list[$key]['number'] = isset($info['number'])?$info['number']:'';
 
- 			$final_list[$key]['pm'] = $info['pm'];
 
- 			$final_list[$key]['lx_name'] = isset($transfer_list[$value['lx']])?$transfer_list[$value['lx']]:'';
 
- 			$final_list[$key]['time'] = date('Y-m-d H:i:s',$info['time']);
 
- 		}
 
-         
 
- 		$filename = date("Y-m-d")."超期未流转单导出.xls";
 
- 		$str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
 
-         <head>
 
-         <!--[if gte mso 9]><xml>
 
-         <x:ExcelWorkbook>
 
-         <x:ExcelWorksheets>
 
-         <x:ExcelWorksheet>
 
-         <x:Name>EXCEL</x:Name>
 
-         <x:WorksheetOptions>
 
-         <x:Print>
 
-         <x:ValidPrinterInfo />
 
-         </x:Print>
 
-         </x:WorksheetOptions>
 
-         </x:ExcelWorksheet>
 
-         </x:ExcelWorksheets>
 
-         </x:ExcelWorkbook>
 
-         </xml>
 
-         <![endif]-->
 
-         </head><body>";
 
- 		$str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>"; 
 
- 		$str .= "<tr><td>订单编号</td><td>品名</td><td>车间</td><td>扫出日期</td></tr>";
 
- 		foreach ($final_list as $key=>$value) 
 
- 		{ 
 
- 			if(empty($value['number'])){
 
- 				continue;
 
- 			}
 
- 		    $str .= "<tr>";
 
- 			$str .= "<td>". $value['number']. "</td>";
 
- 			$str .= "<td>". $value['pm']. "</td>";	
 
- 			$str .= "<td>". $value['lx_name']. "</td>";	
 
- 			$str .= "<td>". $value['time']. "</td>";
 
- 			$str .= "</tr>";
 
- 		}
 
- 		$str .= "</table></body></html>"; 
 
- 		header( "Content-Type: application/vnd.ms-excel; name='excel'" ); 
 
- 		header( "Content-type: application/octet-stream" ); 
 
- 		header( "Content-Disposition: attachment; filename=".$filename ); 
 
- 		header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); 
 
- 		header( "Pragma: no-cache" ); 
 
- 		header( "Expires: 0" ); 
 
- 		exit($str); 
 
- 	}
 
- 	public function _cqrk(){
 
- 		$post = $this->input->post(NULL, TRUE);
 
- 	    if(isset($post['page']))  
 
- 		{
 
- 			$api = $this->input->post('api',true);
 
- 		    $page = $this->input->post('page',true);
 
- 		    $perpage = $this->input->post('perpage',true);
 
- 			
 
- 			$transfer = $this->input->post('transfer',true);
 
- 			$transfer_ids = $this->input->post('transfer_ids',true);
 
- 			$orver_flag = $this->input->post('orver_flag',true);
 
- 			
 
- 			$timetk = $this->input->post('timetk',true);
 
- 			$timetj = $this->input->post('timetj',true);
 
- 			$timetk = strtotime($timetk);
 
- 			$timetj = strtotime($timetj);
 
- 			$transfer_list = $this->transfer->find_all();
 
- 			$t = $transfer_list = array_column($transfer_list, 'title', 'id');
 
- 			$where = 'extra_status in (2,3) ';
 
- 			
 
-             //数据排序
 
-             $order_str = "id desc";
 
-             if(empty($page))
 
- 		    {
 
-                 $start = 0;
 
- 		    	$perpage = 1;
 
-             }
 
- 		    else
 
- 		    {
 
-                 $start = ($page - 1)*$perpage;
 
-             }
 
- 			
 
- 			if($transfer){
 
- 				$where  .= " and lx = '$transfer'";
 
- 			}else{
 
- 			    $where .= " and lx in (".$transfer_ids.") ";
 
- 			}
 
- 			
 
- 			$where  .= " and time > '$timetk' and time < '$timetj'";
 
- 			
 
- 			$list = $this->systemtransfer_cr->find_all($where,'*',$order_str,$start,$perpage);
 
- 			$final_list = [];
 
- 			foreach ($list as $key => $value) {
 
- 			    
 
- 				$info = $this->systemtransfer->read($value['fid']);
 
- 				$final_list[$key]['id'] = $value['id'];
 
- 				$final_list[$key]['number'] = isset($info['number'])?$info['number']:'';
 
- 			
 
- 				if($info['is_jiaji'] == 2){
 
- 		            $final_list[$key]['is_jiaji'] = "<a href='javascript:void(0)' style='color:red'>加急</a>";
 
- 		        }else{
 
- 		            $final_list[$key]['is_jiaji'] = "常规";
 
- 		        }
 
- 			
 
- 				$final_list[$key]['pm'] = $info['pm'];
 
- 				$final_list[$key]['shipremarks'] = $info['shipremarks'];
 
- 				$final_list[$key]['printtime'] = date('Y-m-d H:i:s',$info['printtime']);
 
- 				$data = $this->systemtransfer_cr->find_all("fid = '".$info['id']."'");
 
- 				
 
- 				$info_list[$key]['time'] = "布标打印 :".date('Y-m-d H:i',$info['ctime12']).'<br>';
 
- 				foreach ($data as $k=>$v)
 
- 		        {
 
- 					$type = ($v['type']==1)?'入库':'出库';
 
- 					
 
- 					
 
- 					if($v['orver_flag'] == 1){
 
- 						if($v['is_over'] == 0){
 
- 							$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#90f'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l style='padding-left:10px;font-weight:900;'> 即将超时 </l></a>";
 
- 							// $info_list[$key]['time'] .= '<i style="padding:10px;color:#90f;font-weight:bold;"> 即将超时</i>'.'<br>';
 
- 						}else{
 
- 							$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</a>";
 
- 						}
 
- 					}elseif($v['orver_flag'] == 2){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#f33'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ." <l style='padding-left:10px;font-weight:900'> 超 时 ! </l></a>";
 
- 					}else{
 
- 						$info_list[$key]['time'] .= "<a  href='javascript:void(0);' style='color:#000'>".$t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']) ."</a>";
 
- 					}
 
- 					if($v['extra_status'] == 1){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#90f'>【下道工序未及时入库】</a><br>";
 
- 					}elseif($v['extra_status'] == 2 || $v['extra_status'] == 3){
 
- 						$info_list[$key]['time'] .= "<a href='javascript:void(0);' style='color:#A52A2A'>【工序间流转超过3天】</a><br>";
 
- 					}else{
 
- 						$info_list[$key]['time'] .= "<br>";
 
- 					}
 
- 				}
 
- 				
 
- 				$final_list[$key]['time'] = trim($info_list[$key]['time'],'<br>');
 
- 			}
 
- 			
 
- 			$total = $this->systemtransfer_cr->find_count($where);
 
- 		   
 
- 		    $pagenum = ceil($total/$perpage);
 
- 		    $over = $total-($start+$perpage);
 
- 		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($final_list));
 
- 		    echo json_encode($rows);exit;
 
- 		}
 
- 		if(isset($_SESSION['api']))
 
- 		{
 
- 			$user = $this->user->get_api($_SESSION['api']);
 
- 			$usp = $user;
 
- 		    $pid = "";$tid="";$sid="";$wid="";
 
- 		    $purchase = explode('|',trim($user['purchase'],'|'));
 
- 			$transfer = explode('|',trim($user['transfer'],'|'));
 
- 			$warehouse = explode('|',trim($user['warehouse'],'|'));
 
- 			foreach ($purchase as $value) 
 
- 		    {
 
- 				$pid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($transfer as $value) 
 
- 		    {
 
- 				$tid .= " id = ".$value." or";
 
- 			}
 
- 			foreach ($warehouse as $value) 
 
- 		    {
 
- 				$wid .= " id = ".$value." or";
 
- 			}
 
- 		}
 
- 		else
 
- 		{
 
- 			header('Location: /');exit;
 
- 		}
 
- 		$kx = '';$zjtab = '';
 
- 		
 
- 		$transfer = $this->transfer->find_all('1=1 and '.rtrim($tid,'or'));
 
- 		
 
- 		$this->data['transfer'] = $transfer;
 
- 		$transfer_ids = array_column($transfer, 'id');
 
- 		$this->data['transfer_ids'] =implode(",",$transfer_ids) ;
 
- 		$this->data['vip'] = $user['vip'];
 
- 		$this->data['orver_flag'] = $this->input->get('orver_flag', TRUE);
 
- 		$this->_Template('transfer_cqrk',$this->data);
 
- 	}
 
- 	public function _cqrkexcel(){
 
- 		$api = $this->input->get('api',true);
 
- 		$transfer = $this->input->get('transfer',true);
 
- 		$timetk = $this->input->get('timetk',true);
 
- 		$timetj = $this->input->get('timetj',true);
 
- 		$timetk = strtotime($timetk);
 
- 		$timetj = strtotime($timetj);
 
- 		$transfer_list = $this->transfer->find_all();
 
- 		$t = $transfer_list = array_column($transfer_list, 'title', 'id');
 
- 		$where = 'extra_status in (2,3) ';
 
- 		
 
- 		//数据排序
 
- 		$order_str = "id desc";
 
- 	
 
- 		
 
- 		if($transfer){
 
- 			$where  .= " and lx = '$transfer'";
 
- 		}else{
 
- 			$transfer = $this->transfer->find_all('id not in (8,9,11,12,15,16)');
 
- 			$transfer_ids = array_column($transfer, 'id');
 
- 			$transfer_ids = implode(",",$transfer_ids);
 
- 		    $where .= " and lx in (".$transfer_ids.") ";
 
- 		}
 
- 		
 
- 		
 
- 		$where  .= " and time > '$timetk' and time < '$timetj'";
 
- 		
 
- 		$list = $this->systemtransfer_cr->find_all($where,'*',$order_str);
 
- 	
 
- 		$final_list = [];
 
- 		foreach ($list as $key => $value) {
 
- 			
 
- 			$info = $this->systemtransfer->read($value['fid']);
 
- 			
 
- 			$final_list[$key]['number'] = isset($info['number'])?$info['number']:'';
 
- 			$final_list[$key]['pm'] = $info['pm'];
 
- 			$final_list[$key]['lx_name'] = isset($transfer_list[$value['lx']])?$transfer_list[$value['lx']]:'';
 
- 			$final_list[$key]['time'] = date('Y-m-d H:i:s',$info['time']);
 
- 		}
 
-         
 
- 		$filename = date("Y-m-d")."超期3天未流转单导出.xls";
 
- 		$str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
 
-         <head>
 
-         <!--[if gte mso 9]><xml>
 
-         <x:ExcelWorkbook>
 
-         <x:ExcelWorksheets>
 
-         <x:ExcelWorksheet>
 
-         <x:Name>EXCEL</x:Name>
 
-         <x:WorksheetOptions>
 
-         <x:Print>
 
-         <x:ValidPrinterInfo />
 
-         </x:Print>
 
-         </x:WorksheetOptions>
 
-         </x:ExcelWorksheet>
 
-         </x:ExcelWorksheets>
 
-         </x:ExcelWorkbook>
 
-         </xml>
 
-         <![endif]-->
 
-         </head><body>";
 
- 		$str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>"; 
 
- 		$str .= "<tr><td>订单编号</td><td>品名</td><td>车间</td><td>扫出日期</td></tr>";
 
- 		foreach ($final_list as $key=>$value) 
 
- 		{ 
 
- 			if(empty($value['number'])){
 
- 				continue;
 
- 			}
 
- 		    $str .= "<tr>";
 
- 			$str .= "<td>". $value['number']. "</td>";
 
- 			$str .= "<td>". $value['pm']. "</td>";	
 
- 			$str .= "<td>". $value['lx_name']. "</td>";	
 
- 			$str .= "<td>". $value['time']. "</td>";
 
- 			$str .= "</tr>";
 
- 		}
 
- 		$str .= "</table></body></html>"; 
 
- 		header( "Content-Type: application/vnd.ms-excel; name='excel'" ); 
 
- 		header( "Content-type: application/octet-stream" ); 
 
- 		header( "Content-Disposition: attachment; filename=".$filename ); 
 
- 		header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); 
 
- 		header( "Pragma: no-cache" ); 
 
- 		header( "Expires: 0" ); 
 
- 		exit($str); 
 
- 	}
 
- }
 
 
  |