Systemprint.php 89 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. header("Access-Control-Allow-Origin: *");
  3. class Systemprint extends Start_Controller {
  4. public function __construct(){
  5. parent::__construct();
  6. $this->load->library('session');
  7. $this->load->_model('Model_whlabel','whlabel');
  8. $this->load->_model('Model_warehouse','warehouse');
  9. $this->load->_model('Model_productprice','productprice');
  10. $this->load->_model('Model_excel','excel');
  11. $this->load->_model('Model_fullorder','fullorder');
  12. $this->load->_model('Model_fullorder_smt','fullorder_smt');
  13. $this->load->_model('Model_fullordersmt','fullordersmt');
  14. $this->load->_model('Model_fullordertt','fullordertt');
  15. $this->load->_model('Model_fullorderamz','fullorderamz');
  16. $this->load->_model('Model_outbound','outbound');
  17. $this->load->_model('Model_express','express');
  18. $this->load->_model('Model_shop','shop');
  19. $this->load->_model('Model_typeclass','typeclass');
  20. $this->load->_model('Model_country','country');
  21. $this->load->_model('Model_kdniao','kdniao');
  22. $this->load->_model('Model_notice','notice');
  23. $this->load->_model('Model_dhl','dhl');
  24. $this->load->_model('Model_dhlhz','dhlhz');
  25. $this->load->_model('Model_usps','usps');
  26. $this->load->_model('Model_fedex','fedex');
  27. $this->load->_model('Model_cne','cne');
  28. $this->load->_model('Model_fedex_cby','fedex_cby');
  29. $this->load->_model('Model_ups','ups');
  30. $this->load->_model('Model_ali','ali');
  31. $this->load->_model('Model_dpd','dpd');
  32. $this->load->_model('Model_hualeixw','hualeixw');
  33. $this->load->_model('Model_dpdxw','dpdxw');
  34. $this->load->_model('Model_shop','shop');
  35. $this->load->_model('Model_user','user');
  36. $this->load->_model('Model_whlabel','whlabel');
  37. $this->load->_model('Model_dpd_IOSS','dpdioss');
  38. $this->load->_model('Model_whlabelbarcodeprint','whlabelbarcodeprint');
  39. $this->load->_model('Model_whlabelbarcode','whlabelbarcode');
  40. $this->load->_model('Model_yswaybill','yswaybill');
  41. $this->load->_model('Model_hualei','hualei');
  42. $this->load->_model('Model_apiyy','apiyy');
  43. $this->load->_model('Model_classid','classid');
  44. $this->load->_model('Model_fullorderxw','fullorderxw');
  45. $this->load->_model('Model_setting','setting');
  46. $this->load->helper('url');
  47. $this->load->_model("Model_yuntu","yuntu");
  48. $this->load->_model("Model_api","api");
  49. $this->load->_model("Model_fedexv1",'fedexv1');
  50. $this->load->_model("Model_customsdeclaration","customsdeclaration");
  51. $this->load->_model("Model_logic_ding","logic_ding");
  52. $this->load->_model("Model_zxyuntu","zxyuntu");
  53. }
  54. //定义方法的调用规则 获取URI第二段值
  55. public function _remap($arg,$arg_array)
  56. {
  57. if($arg == 'printing')//打印操作
  58. {
  59. $this->_printing();
  60. }
  61. else if($arg == 'exceldy')
  62. {
  63. $this->_exceldy($arg_array);
  64. }
  65. else if($arg == 'screen')
  66. {
  67. $this->_screen();
  68. }
  69. else if($arg == 'cz')
  70. {
  71. $this->_cz();
  72. }
  73. else if($arg == 'barcode')
  74. {
  75. $this->_barcode();
  76. }
  77. else if($arg == 'barcodedc')
  78. {
  79. $this->_barcodedc();
  80. }
  81. else if($arg == 'barcodedr')
  82. {
  83. $this->_barcodedr();
  84. }
  85. else if($arg == 'yswaybill')
  86. {
  87. $this->_yswaybill();
  88. }
  89. else
  90. {
  91. $this->_index();
  92. }
  93. }
  94. public function _cz()
  95. {
  96. if(isset($_SESSION['api']))
  97. {
  98. $user = $this->user->get_api($_SESSION['api']);
  99. $usp = $user;
  100. $shop = array();$type = array();
  101. $usersp = explode('|',trim($user['shop'],'|'));
  102. $userwh = explode('|',trim($user['warehouse'],'|'));
  103. foreach ($usersp as $v)
  104. {
  105. $shop[$v] = $v;
  106. }
  107. foreach ($userwh as $v)
  108. {
  109. $type[$v] = $v;
  110. }
  111. }
  112. $post = $this->input->post(NULL, TRUE);
  113. if(isset($post['cz']))
  114. {
  115. $cz = $this->input->post('cz');
  116. $cz = explode(',',trim($cz,','));
  117. $bj = $this->input->post('bj');
  118. $i = 0;$a = array();
  119. foreach ($cz as $v)
  120. {
  121. $dd = explode('-',$v);
  122. $fu = $dd[1];
  123. $thisdd = $this->$fu->read($dd[0]);
  124. if(isset($shop[$thisdd['shop']]) && isset($type[$thisdd['type']]))
  125. {
  126. $this->$fu->save(array('wigs'=>$bj),$dd[0]);
  127. $i++;
  128. }
  129. }
  130. if(count($cz) == $i)
  131. {
  132. echo json_encode(array('msg'=>'标记完成!','success'=>true));exit;
  133. }
  134. else if($i == '0')
  135. {
  136. echo json_encode(array('msg'=>'标记失败,请重试!','success'=>false));exit;
  137. }
  138. else
  139. {
  140. echo json_encode(array('msg'=>'有部分标记失败,请检查!','success'=>false));exit;
  141. }
  142. }
  143. }
  144. public function _screen()
  145. {
  146. $post = $this->input->post(NULL, TRUE);
  147. if(isset($_SESSION['api']))
  148. {
  149. $user = $this->user->get_api($_SESSION['api']);
  150. $usp = $user;
  151. $fgshop = "";$sid = "";$wid="";$wtype="";
  152. $usersp = explode('|',trim($user['shop'],'|'));
  153. $userwh = explode('|',trim($user['warehouse'],'|'));
  154. foreach ($usersp as $value)
  155. {
  156. $fgshop .= " shop = ".$value." or";
  157. $sid .= " id = ".$value." or";
  158. }
  159. foreach ($userwh as $value)
  160. {
  161. $wid .= " id = ".$value." or";
  162. $wtype .= " type = ".$value." or";
  163. }
  164. }
  165. if(isset($post['page']))
  166. {
  167. $page = $this->input->post('page',true);
  168. $perpage = $this->input->post('perpage',true);
  169. $wigs = $this->input->post('wigs',true);
  170. $shop = $this->input->post('shop',true);
  171. $orderinfo = $this->input->post('orderinfo',true);
  172. $number = $this->input->post('number',true);
  173. $so = $this->input->post('so',true);
  174. //$where = (isset($_SESSION['api']))?"mergeid != '1' and (state = '207' or state = '209') and (".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
  175. //$where .= " and express != 0 and printtype > 0 and printtype < 3 and print = 2 and review > 4 and library = 1 and type = 4";
  176. $where = (isset($_SESSION['api']))?"mergeid != '1' and (".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
  177. if($shop)
  178. {
  179. $where .= " and shop = '$shop'";
  180. }
  181. if($orderinfo)
  182. {
  183. $where .= " and orderinfo = '$orderinfo'";
  184. }
  185. if($number)
  186. {
  187. $where .= " and number = '$number'";
  188. }
  189. if($wigs || $wigs == '0')
  190. {
  191. $where .= " and wigs = '$wigs'";
  192. }
  193. //数据排序
  194. $order_str = "id desc";
  195. if(empty($page))
  196. {
  197. $start = 0;
  198. $perpage = 1;
  199. }
  200. else
  201. {
  202. $start = ($page - 1)*$perpage;
  203. }
  204. $info_list = array();
  205. $info_listsmt = array();
  206. $info_listtt = array();
  207. $info_listxw = array();
  208. $dlz = 0; $smt = 0; $tt = 0;$xw = 0;
  209. //取得信息列表
  210. $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,shipremarks',$order_str,$start,$perpage);
  211. //格式化数据
  212. foreach ($info_list as $key=>$value)
  213. {
  214. $w = $this->fullorder->read($value['id']);
  215. if(stripos($w['issku'],'#pack') !== false)
  216. {
  217. unset($info_list[$key]);
  218. continue;
  219. }
  220. $info_list[$key]['id'] = $value['id'].'-fullorder';
  221. $shop = $this->shop->read($value['shop']);
  222. $info_list[$key]['shop'] = $shop['shopname'];
  223. }
  224. $dlz = $this->fullorder->find_count($where);
  225. $info_listtt = $this->fullordertt->find_all($where,'id,shop,orderinfo,number,shipremarks',$order_str,$start,$perpage);
  226. //格式化数据
  227. foreach ($info_listtt as $key=>$value)
  228. {
  229. $w = $this->fullordertt->read($value['id']);
  230. if(stripos($w['issku'],'#pack') !== false)
  231. {
  232. unset($info_list[$key]);
  233. continue;
  234. }
  235. $info_list[$key]['id'] = $value['id'].'-fullordertt';
  236. $shop = $this->shop->read($value['shop']);
  237. $info_list[$key]['shop'] = $shop['shopname'];
  238. }
  239. $tt = $this->fullordertt->find_count($where);
  240. $info_listamz = $this->fullorderamz->find_all($where,'id,shop,orderinfo,number,shipremarks',$order_str,$start,$perpage);
  241. //格式化数据
  242. foreach ($info_listamz as $key=>$value)
  243. {
  244. $w = $this->fullorderamz->read($value['id']);
  245. if(stripos($w['issku'],'#pack') !== false)
  246. {
  247. unset($info_list[$key]);
  248. continue;
  249. }
  250. $info_list[$key]['id'] = $value['id'].'-fullorderamz';
  251. $shop = $this->shop->read($value['shop']);
  252. $info_list[$key]['shop'] = $shop['shopname'];
  253. }
  254. $amz = $this->fullorderamz->find_count($where);
  255. $info_listxw = $this->fullorderxw->find_all($where,'id,shop,orderinfo,number,shipremarks',$order_str,$start,$perpage);
  256. //格式化数据
  257. foreach ($info_listxw as $key=>$value)
  258. {
  259. $w = $this->fullorderxw->read($value['id']);
  260. if(stripos($w['issku'],'#pack') !== false)
  261. {
  262. unset($info_list[$key]);
  263. continue;
  264. }
  265. $info_list[$key]['id'] = $value['id'].'-fullorderxw';
  266. $shop = $this->shop->read($value['shop']);
  267. $info_list[$key]['shop'] = $shop['shopname'];
  268. }
  269. $xw = $this->fullorderxw->find_count($where);
  270. $info_listsmt = $this->fullordersmt->find_all($where,'id,shop,orderinfo,number,shipremarks',$order_str,$start,$perpage);
  271. //格式化数据
  272. foreach ($info_listsmt as $key=>$value)
  273. {
  274. $w = $this->fullordersmt->read($value['id']);
  275. if(stripos($w['sku'],'#pack') !== false)
  276. {
  277. unset($info_listsmt[$key]);
  278. continue;
  279. }
  280. $info_listsmt[$key]['id'] = $value['id'].'-fullordersmt';
  281. $shop = $this->shop->read($value['shop']);
  282. $info_listsmt[$key]['shop'] = $shop['shopname'];
  283. }
  284. $smt += $this->fullordersmt->find_count($where);
  285. //$total += $this->fullorder_smt->find_count($where);
  286. $total = $dlz+$smt+$tt+$xw+$amz;
  287. $rows = array_merge($info_list,$info_listtt,$info_listamz,$info_listxw,$info_listsmt);
  288. //$rows = array_slice($rows,$start,$perpage);
  289. $pagenum = ceil($total/$perpage);
  290. $over = $total-($start+$perpage);
  291. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($rows));//array_merge($info_list,$info_list_smt,$info_listsmt)
  292. echo json_encode($rows);exit;
  293. }
  294. if(isset($_SESSION['api']))
  295. {
  296. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  297. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  298. $this->data['wlshop'] = $wlshop;
  299. $this->data['warehouse'] = $warehouse;
  300. }
  301. $this->_Template('systemprint_screen',$this->data);
  302. }
  303. public function _index()
  304. {
  305. $post = $this->input->post(NULL, TRUE);
  306. if(isset($_SESSION['api']))
  307. {
  308. $user = $this->user->get_api($_SESSION['api']);
  309. $usp = $user;
  310. $fgshop = "";$sid = "";$wid="";$wtype="";
  311. $usersp = explode('|',trim($user['shop'],'|'));
  312. $userwh = explode('|',trim($user['warehouse'],'|'));
  313. foreach ($usersp as $value)
  314. {
  315. $fgshop .= " shop = ".$value." or";
  316. $sid .= " id = ".$value." or";
  317. }
  318. foreach ($userwh as $value)
  319. {
  320. $wid .= " id = ".$value." or";
  321. $wtype .= " type = ".$value." or";
  322. }
  323. }
  324. if(isset($post['page']))
  325. {
  326. $page = $this->input->post('page',true);
  327. $perpage = $this->input->post('perpage',true);
  328. $timetk = $this->input->post('timetk',true);
  329. $timetj = $this->input->post('timetj',true);
  330. $shop = $this->input->post('shop',true);
  331. $print = $this->input->post('print',true);
  332. $express = $this->input->post('express',true);
  333. $waybill = $this->input->post('waybill',true);
  334. $printtype = $this->input->post('printtype',true);
  335. $orderinfo = $this->input->post('orderinfo',true);
  336. $number = $this->input->post('number',true);
  337. $type = $this->input->post('type',true);
  338. $lowe = $this->input->post('lowe',true);
  339. $info = $this->input->post('info',true);
  340. $ji = $this->input->post('ji',true);
  341. $so = $this->input->post('so',true);
  342. $ckfl = $this->input->post('ckfl',true);
  343. $sfxh = $this->input->post('sfxh',true);
  344. $lowe = $this->input->post('lowe',true);
  345. $color = $this->input->post('color',true);
  346. $is_jiaji = $this->input->post('is_jiaji',true);
  347. $timetk = strtotime($timetk);
  348. $timetj = strtotime($timetj);
  349. $where = (isset($_SESSION['api']))?"(state = '207' or state = '209') and (".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
  350. if($print == 3)
  351. {
  352. $where .= " and printtime > '$timetk' and printtime < '$timetj' and print = '3' and library = 1";
  353. }
  354. else
  355. {
  356. $where .= " and express != 0 and printtype != 3 and printtype > 0 and print = 2 and review > 4 and library = 1 and reviewtime > '".(time() - 30*24*3600)."'";
  357. //$where .= " and express != 0 and printtype != 3 and printtype > 0 and print = 2 and review > 4 and library = 1 ";
  358. }
  359. if($shop)
  360. {
  361. $where .= " and shop = '$shop'";
  362. }
  363. if($express)
  364. {
  365. $where .= " and express = '$express'";
  366. }
  367. if($printtype)
  368. {
  369. $where .= " and printtype = '$printtype'";
  370. }
  371. if($orderinfo)
  372. {
  373. $where .= " and orderinfo = '$orderinfo'";
  374. }
  375. if($number)
  376. {
  377. $where .= " and number = '$number'";
  378. }
  379. if($waybill)
  380. {
  381. $where .= " and waybill = '$waybill'";
  382. }
  383. if($color)
  384. {
  385. $where .= " and fpdata like '%-$color-%'";
  386. }
  387. if($lowe)
  388. {
  389. $where .= " and fpdata like '%-$lowe-%'";
  390. }
  391. if($type)
  392. {
  393. $where .= " and type = '$type'";
  394. }
  395. else
  396. {
  397. $where .= " and type != '16'";
  398. }
  399. /**
  400. if($type)
  401. {
  402. if($type != '4')
  403. {
  404. $where .= " and type = '$type'";
  405. $where2 = '';
  406. $where3 = '';
  407. }
  408. else
  409. {
  410. $where2 = " and type = '4' and (wigs = '3' or wigs = '8') and issku not like '%#pack%'";
  411. $where3 = " and type = '4' and (wigs = '3' or wigs = '8') and sku not like '%#pack%'";
  412. }
  413. $where_a = "";
  414. $where_b = "";
  415. }
  416. else
  417. {
  418. $where .= " and type != '4'";
  419. $where_a = "(";
  420. $where_b = ")";
  421. $where2 = " or (type = '4' and (wigs = '3' or wigs = '8') and issku not like '%#pack%')";
  422. $where3 = " or (type = '4' and (wigs = '3' or wigs = '8') and sku not like '%#pack%')";
  423. }
  424. **/
  425. if($ji)
  426. {
  427. $where .= " and shipremarks like '%急%'";
  428. }
  429. if($so)
  430. {
  431. $where .= " and shipremarks like '%$so%'";
  432. }
  433. if($ckfl)
  434. {
  435. $where .= " and ckfl = '$ckfl'";
  436. }
  437. if($sfxh != '')
  438. {
  439. $where .= " and sfxh = '$sfxh'";
  440. }
  441. //数据排序
  442. $order_str = ($print != 3)?"id desc":"printtime desc";
  443. if(empty($page))
  444. {
  445. $start = 0;
  446. $perpage = 1;
  447. }
  448. else
  449. {
  450. $start = ($page - 1)*$perpage;
  451. }
  452. $info_list = $info_listtt = $info_listxw = $info_listsmt = $info_listamz =[];
  453. $info_list_jj = $info_listtt_jj = $info_listxw_jj = $info_listsmt_jj = $info_listamz_jj =[];
  454. $dlz = 0; $smt = 0; $tt = 0; $xw = 0;$amz = 0;
  455. $dlz_jj = 0;$smt_jj=0;$tt_jj=0;$xw_jj=0;$amz_jj=0;
  456. $field = 'id,shop,orderinfo,number,express,waybill,print,printtype,printnumber,printtime,shipremarks,is_jiaji';
  457. if(($is_jiaji == 1)||($is_jiaji == -1)){
  458. $where_jiaji = $where." and is_jiaji = 1 ";
  459. $dlz_ret_jj = $this->indexData('fullorder',$start,$perpage,$where_jiaji,$field,$order_str);
  460. $info_list_jj = $dlz_ret_jj['list'];
  461. $dlz_jj = $dlz_ret_jj['total'];
  462. $tt_ret_jj = $this->indexData('fullordertt',$start,$perpage,$where_jiaji,$field,$order_str);
  463. $info_listtt_jj = $tt_ret_jj['list'];
  464. $tt_jj = $tt_ret_jj['total'];
  465. $amz_ret_jj = $this->indexData('fullorderamz',$start,$perpage,$where_jiaji,$field,$order_str);
  466. $info_listamz_jj = $amz_ret_jj['list'];
  467. $amz_jj = $amz_ret_jj['total'];
  468. $smt_ret_jj = $this->indexData('fullordersmt',$start,$perpage,$where_jiaji,$field,$order_str);
  469. $info_listsmt_jj = $smt_ret_jj['list'];
  470. $smt_jj = $smt_ret_jj['total'];
  471. $xw_ret_jj = $this->indexData('fullorderxw',$start,$perpage,$where_jiaji,$field,$order_str);
  472. $info_listxw_jj = $xw_ret_jj['list'];
  473. $xw_jj = $xw_ret_jj['total'];
  474. }
  475. /****************************执行非加急的************************************/
  476. if(($is_jiaji == 0) || ($is_jiaji == -1)){
  477. $where_nojj = $where." and is_jiaji = 0 ";
  478. $dlz_ret = $this->indexData('fullorder',$start,$perpage,$where_nojj,$field,$order_str);
  479. $info_list = $dlz_ret['list'];
  480. $dlz = $dlz_ret['total'];
  481. $tt_ret = $this->indexData('fullordertt',$start,$perpage,$where_nojj,$field,$order_str);
  482. $info_listtt = $tt_ret['list'];
  483. $tt = $tt_ret['total'];
  484. $amz_ret = $this->indexData('fullorderamz',$start,$perpage,$where_nojj,$field,$order_str);
  485. $info_listamz = $amz_ret['list'];
  486. $amz = $amz_ret['total'];
  487. $smt_ret = $this->indexData('fullordersmt',$start,$perpage,$where_nojj,$field,$order_str);
  488. $info_listsmt = $smt_ret['list'];
  489. $smt = $smt_ret['total'];
  490. $xw_ret = $this->indexData('fullorderxw',$start,$perpage,$where_nojj,$field,$order_str);
  491. $info_listxw = $xw_ret['list'];
  492. $xw = $xw_ret['total'];
  493. }
  494. $total = $dlz+$tt+$amz+$smt+$xw+$dlz_jj+$tt_jj+$amz_jj+$smt_jj+$xw_jj;
  495. $pagenum = ceil($total/$perpage);
  496. $over = $total-($start+$perpage);
  497. if($print == 3){
  498. // $rows_jj = $this->indexSort($info_list_jj,$info_listamz_jj,$info_listtt_jj,$info_listxw_jj,$info_listsmt_jj,$print);
  499. // $rows_no = $this->indexSort($info_list,$info_listamz,$info_listtt,$info_listxw,$info_listsmt,$print);
  500. $tmp_all_rows = array_merge($info_list_jj,$info_listamz_jj,$info_listsmt_jj,$info_listtt_jj,$info_listxw_jj,$info_list,$info_listamz,$info_listsmt,$info_listtt,$info_listxw);
  501. $rows = $this->indexSort($tmp_all_rows,$print);
  502. }else{
  503. $tmp_jj_row = array_merge($info_list_jj,$info_listamz_jj,$info_listtt_jj,$info_listxw_jj,$info_listsmt_jj);
  504. $rows_jj = $this->indexSort($tmp_jj_row,$print);
  505. $tmp_no_row = array_merge($info_list,$info_listamz,$info_listtt,$info_listxw,$info_listsmt);
  506. $rows_no = $this->indexSort($tmp_no_row,$print);
  507. $rows = array_merge($rows_jj,$rows_no);
  508. }
  509. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($rows),'cs'=>$where);//array_merge($info_list,$info_list_smt,$info_listsmt)
  510. echo json_encode($rows);exit;
  511. }
  512. if(isset($_SESSION['api']))
  513. {
  514. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  515. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  516. $this->data['wlshop'] = $wlshop;
  517. $this->data['warehouse'] = $warehouse;
  518. }
  519. $this->_Template('systemprint',$this->data);
  520. }
  521. /**
  522. * $table_name 订单表名
  523. * $start 偏移开始坐标
  524. * $limit 偏移量
  525. * $where 条件
  526. * $field 字段
  527. * $order_str 排序
  528. */
  529. protected function indexData($table_name,$start,$limit,$where,$filed,$order_str){
  530. $info_list = $this->$table_name->find_all($where,$filed,$order_str,$start,$limit);
  531. if(empty($info_list)){
  532. $info_list = [];
  533. }
  534. //格式化数据
  535. foreach ($info_list as $key=>$value)
  536. {
  537. $info_list[$key]['id'] = $value['id'].'-'.$table_name;
  538. $shop = $this->shop->read($value['shop']);
  539. $info_list[$key]['shop'] = $shop['shopname'];
  540. $express = $this->express->read($value['express']);
  541. if($express)
  542. {
  543. $info_list[$key]['express'] = $express['servicename'];
  544. }
  545. else
  546. {
  547. $info_list[$key]['express'] = '未选择';
  548. }
  549. if($value['printtime'] != 0)
  550. {
  551. $info_list[$key]['printtime'] = date('Y-m-d H:i',$value['printtime']);
  552. }
  553. else
  554. {
  555. $info_list[$key]['printtime'] = '无';
  556. }
  557. if($value['print'] == 1)
  558. {
  559. $info_list[$key]['print'] = "禁止打印";
  560. }
  561. else if($value['print'] == 2)
  562. {
  563. $info_list[$key]['print'] = "未打印";
  564. }
  565. else if($value['print'] == 3)
  566. {
  567. $info_list[$key]['print'] = "已打印";
  568. }
  569. if($value['printtype'] == 1)
  570. {
  571. $info_list[$key]['printtype'] = "运单";
  572. }
  573. else if($value['printtype'] == 2)
  574. {
  575. $info_list[$key]['printtype'] = "发货单";
  576. }
  577. else if($value['printtype'] == 0)
  578. {
  579. $info_list[$key]['printtype'] = "未选择";
  580. }
  581. if($value['is_jiaji'] == 1){
  582. $info_list[$key]['number'] = "<c style='color:red'>".$value['number']."</c>";
  583. }
  584. unset($info_list[$key]['is_jiaji']);
  585. $info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  586. }
  587. $total = $this->$table_name->find_count($where);
  588. return [
  589. 'list'=>$info_list,
  590. 'total'=>$total,
  591. ];
  592. }
  593. //订单表排序
  594. protected function indexSort($rows,$print){
  595. foreach($rows as $k=>$v){
  596. $rows[$k]['index'] = $v['shipremarks'].$v['id'];
  597. }
  598. $tmp_rows = array_column($rows,null,'index');
  599. ksort($tmp_rows);
  600. $tmp_rows = array_values($tmp_rows);
  601. foreach($tmp_rows as $k=>$v){
  602. unset($tmp_rows[$k]['index']);
  603. }
  604. $rows = $tmp_rows;
  605. $tmp = array();
  606. if($print == 3)
  607. {
  608. foreach ($rows as $key => $val)
  609. {
  610. $tmp[$key] = $val['printtime'];
  611. }
  612. array_multisort($tmp,SORT_DESC,$rows);
  613. }
  614. return $rows;
  615. }
  616. //打印
  617. public function _printing()
  618. {
  619. $post = $this->input->post(NULL, TRUE);
  620. if(isset($post['s']))
  621. {
  622. $v = $this->input->post('s');
  623. $va = explode(',',rtrim($v,','));
  624. $n = $this->input->post('n');
  625. $tf = $this->input->post('tf');
  626. $type = 3;$text = array();$text['data'] = array();$time = time();
  627. $pd = explode('-',$va[$n]);
  628. $va[$n] = $pd[0];
  629. $fullorder_name = $pd[1];
  630. $fullorder = $this->$fullorder_name->read($va[$n]);
  631. if(isset($va[$n+1]))
  632. {
  633. $xyz = explode('-',$va[$n+1]);
  634. $sf = $this->$fullorder_name->read($xyz[0]);
  635. }
  636. if($tf)
  637. {
  638. if($tf == '2' && ($fullorder['print'] == 3 || $fullorder['printtime'] > 0))
  639. {
  640. echo json_encode(array('msg'=>$fullorder['number'].' 此订单已打印,请提交给技术处理','success'=>false));exit;
  641. }
  642. }
  643. if($fullorder['print'] == 1)
  644. {
  645. echo json_encode(array('msg'=>$fullorder['number'].' 店员已操作禁止打印,请刷新当前程序','success'=>false));exit;
  646. }
  647. if($fullorder['print'] == 2 && $fullorder['printtime'] > 0)
  648. {
  649. echo json_encode(array('msg'=>$fullorder['number'].' 状态异常,请提交给技术处理','success'=>false));exit;
  650. }
  651. $fullorder = $this->_text($fullorder);//获取所需信息
  652. $this->logic_ding->sendToDing("打印快递单,订单的信息".json_encode($fullorder,JSON_UNESCAPED_UNICODE));
  653. //美仓不需要海关报关信息,
  654. if($fullorder['type'] != 5){
  655. //中国发货的 目前是dhl需要海关申报编码
  656. if(empty($fullorder['sbbm'])){
  657. echo json_encode(array('msg'=>$fullorder['number'].' 海关申报配置异常,请提交给技术处理'.$fullorder['sbbm'],'success'=>false));exit;
  658. }
  659. }
  660. $oldprinttime = ($fullorder['printtime'] > 0)?$fullorder['oldprinttime'].$fullorder['printtime'].'-':'';
  661. $fullorder['printtime'] = date('m-d H:i',$time);//打印用时间、发货单用,不能删
  662. $pdfnum = 1;//PDF打印几遍
  663. if($fullorder['printtype'] == 1 && $fullorder['library'] != 2)// && $fullorder['library'] != 2
  664. {
  665. if($fullorder['printcode'] == "DHL")//如果打印过那么重新获取运单
  666. {
  667. $barcode = $this->dhl->get_data($fullorder);//获取DHL快递信息
  668. if(isset($barcode['AirwayBillNumber']))
  669. {
  670. $bctime = date('Ymd',$time);
  671. $Hwaybill = $barcode['AirwayBillNumber'];
  672. $Hfp = $this->_pdf($barcode['LabelImage']['MultiLabels']['MultiLabel']['DocImageVal'],'f-'.$Hwaybill,$bctime);
  673. $Hyd = $this->_pdf($barcode['LabelImage']['OutputImage'],'y-'.$Hwaybill,$bctime);
  674. if(isset($Hfp) && isset($Hyd) && isset($Hwaybill))
  675. {
  676. if($fullorder['waybill'] != "")
  677. {
  678. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  679. }
  680. else
  681. {
  682. $oldwaybill = $fullorder['oldwaybill'];
  683. }
  684. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  685. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  686. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  687. {
  688. $type = 1;
  689. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>85);
  690. }
  691. }
  692. }
  693. else
  694. {
  695. if(isset($barcode['Response']['Status']['Condition']['ConditionData']) || isset($barcode['Response']['Status']['Condition'][0]['ConditionData']))
  696. {
  697. $failed = (isset($barcode['Response']['Status']['Condition']['ConditionData'])?$barcode['Response']['Status']['Condition']['ConditionData']:$barcode['Response']['Status']['Condition'][0]['ConditionData']);
  698. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  699. }
  700. }
  701. }
  702. else if($fullorder['printcode'] == "DHLUSA")//DHL9610
  703. {
  704. $barcode = $this->dhl->get_data($fullorder);//获取DHL快递信息
  705. if(isset($barcode['AirwayBillNumber']))
  706. {
  707. $bctime = date('Ymd',$time);
  708. $Hwaybill = $barcode['AirwayBillNumber'];
  709. $Hfp = $this->_pdf($barcode['LabelImage']['MultiLabels']['MultiLabel']['DocImageVal'],'f-'.$Hwaybill,$bctime);
  710. $Hyd = $this->_pdf($barcode['LabelImage']['OutputImage'],'y-'.$Hwaybill,$bctime);
  711. if(isset($Hfp) && isset($Hyd) && isset($Hwaybill))
  712. {
  713. if($fullorder['waybill'] != "")
  714. {
  715. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  716. }
  717. else
  718. {
  719. $oldwaybill = $fullorder['oldwaybill'];
  720. }
  721. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  722. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  723. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  724. {
  725. $type = 1;
  726. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>85);
  727. }
  728. }
  729. }
  730. else
  731. {
  732. if(isset($barcode['Response']['Status']['Condition']['ConditionData']) || isset($barcode['Response']['Status']['Condition'][0]['ConditionData']))
  733. {
  734. $failed = (isset($barcode['Response']['Status']['Condition']['ConditionData'])?$barcode['Response']['Status']['Condition']['ConditionData']:$barcode['Response']['Status']['Condition'][0]['ConditionData']);
  735. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  736. }
  737. }
  738. /**
  739. if(isset($barcode['AirwayBillNumber']))
  740. {
  741. $bctime = date('Ymd',$time);
  742. $Hwaybill = $barcode['AirwayBillNumber'];
  743. $Hfp = $this->_pdf($barcode['LabelImage']['MultiLabels']['MultiLabel']['DocImageVal'],'f-'.$Hwaybill,$bctime);
  744. $Hyd = $this->_pdf($barcode['LabelImage']['OutputImage'],'y-'.$Hwaybill,$bctime);
  745. if(isset($Hfp) && isset($Hyd) && isset($Hwaybill))
  746. {
  747. $fullorder['waybill'] = $Hwaybill;
  748. $sb = $this->dhl->get_data_9610($fullorder);
  749. if($sb != 1)
  750. {
  751. $this->$fullorder_name->save(array('print'=>1,'failed'=>$sb),$va[$n]);
  752. }
  753. else
  754. {
  755. if($fullorder['waybill'] != "")
  756. {
  757. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  758. }
  759. else
  760. {
  761. $oldwaybill = $fullorder['oldwaybill'];
  762. }
  763. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  764. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  765. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  766. {
  767. $type = 1;
  768. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>85);
  769. }
  770. }
  771. }
  772. }
  773. else
  774. {
  775. if(isset($barcode['Response']['Status']['Condition']['ConditionData']) || isset($barcode['Response']['Status']['Condition'][0]['ConditionData']))
  776. {
  777. $failed = (isset($barcode['Response']['Status']['Condition']['ConditionData'])?$barcode['Response']['Status']['Condition']['ConditionData']:$barcode['Response']['Status']['Condition'][0]['ConditionData']);
  778. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  779. }
  780. }
  781. **/
  782. }
  783. /**
  784. else if($fullorder['printcode'] == "DHLHZ")//如果打印过那么重新获取运单
  785. {
  786. $barcode = $this->dhlhz->get_data($fullorder);//获取DHL快递信息
  787. if($barcode['c'] == 1)
  788. {
  789. $bctime = date('Ymd',$time);
  790. $Hwaybill = $barcode['data']['waybill'];
  791. $Hfp = $this->_pdf($barcode['data']['fp'],'f-'.$Hwaybill,$bctime);
  792. $Hyd = $this->_pdf($barcode['data']['yd'],'y-'.$Hwaybill,$bctime);
  793. if(isset($Hfp) && isset($Hyd) && isset($Hwaybill))
  794. {
  795. if($fullorder['waybill'] != "")
  796. {
  797. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  798. }
  799. else
  800. {
  801. $oldwaybill = $fullorder['oldwaybill'];
  802. }
  803. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  804. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  805. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  806. {
  807. $type = 1;
  808. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>85);
  809. }
  810. }
  811. }
  812. else
  813. {
  814. if(isset($barcode['data']))
  815. {
  816. $failed = $barcode['data'];
  817. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  818. }
  819. }
  820. }
  821. **/
  822. else if($fullorder['printcode'] == "USPS")
  823. {
  824. $barcode = $this->usps->get_data($fullorder);
  825. //改新的去掉
  826. // if(isset($barcode[0]))
  827. // {
  828. // $barcode = $barcode[0];
  829. // }
  830. //if(isset($barcode['LabelImage']) || isset($barcode[0]['LabelImage']))
  831. //改新的去掉
  832. if(isset($barcode['labelImage']))
  833. {
  834. $bctime = date('Ymd',$time);
  835. //$Hwaybill = substr($barcode['BarcodeNumber'], 8); //改新的去掉 新的 Labellmage 改 labelImage
  836. $Hwaybill = $barcode['trackingNumber'];
  837. $Hyd = $this->_pdf($barcode['labelImage'],'y-'.$Hwaybill,$bctime);
  838. //$Hyd = $this->_pdf($barcode['LabelImage'],'y-'.$Hwaybill,$bctime);
  839. //if(isset($barcode['LabelImage']) && isset($Hwaybill))
  840. if(isset($barcode['labelImage']) && isset($Hwaybill))
  841. {
  842. if($fullorder['waybill'] != "")
  843. {
  844. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  845. }
  846. else
  847. {
  848. $oldwaybill = $fullorder['oldwaybill'];
  849. }
  850. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  851. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  852. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime,'freight'=>0),$va[$n]))//'freight'=>$barcode['extraServices'][0]['price']
  853. {
  854. $type = 1;
  855. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
  856. }
  857. }
  858. }
  859. else if(isset($barcode['error']))
  860. {
  861. $failed = $barcode['Description'];//错误提示
  862. if(stripos($failed,'The requested Mail') === false)
  863. {
  864. if($failed != 'false')
  865. {
  866. $this->$fullorder_name->save(array('print'=>1,'failed'=>json_encode($barcode['error'])),$va[$n]);
  867. }
  868. }
  869. }
  870. /**
  871. else if(isset($barcode['error']['message']))
  872. {
  873. if(isset($barcode['error']['errors'][0]['detail']))
  874. {
  875. $failed = $barcode['error']['errors'][0]['detail'];//错误提示
  876. }
  877. else
  878. {
  879. $failed = $barcode['error']['message'];//错误提示
  880. }
  881. //if(stripos($failed,'The requested Mail') === false)
  882. //{
  883. if($failed != 'false')
  884. {
  885. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  886. }
  887. //}
  888. }
  889. **/
  890. else
  891. {
  892. $failed = json_encode($barcode);//错误提示
  893. if($failed != 'false')
  894. {
  895. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  896. }
  897. }
  898. }
  899. else if($fullorder['printcode'] == "FEDEXGF")//官方FEDEX接口
  900. {
  901. //$barcode = $this->fedex->get_data($fullorder);//获取联邦快递信息
  902. //接口升级
  903. $barcode = $this->fedexv1->get_data($fullorder);//获取联邦快递信息
  904. if($barcode['x'] == 1)
  905. {
  906. $bctime = date('Ymd',$time);
  907. $Hwaybill = $barcode['waybill'];
  908. $Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
  909. $Hfp = $this->_pdfurl($barcode['invoice'],'f-'.$Hwaybill,$bctime);//开通ETD模式,保留PDF,不需要打印
  910. // $Hyd = $this->_pdf($barcode['label'],'y-'.$Hwaybill,$bctime);
  911. // $Hfp = $this->_pdf($barcode['invoice'],'f-'.$Hwaybill,$bctime);//开通ETD模式,保留PDF,不需要打印
  912. if(isset($barcode['label']) && isset($Hwaybill))
  913. {
  914. if($fullorder['waybill'] != "")
  915. {
  916. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  917. }
  918. else
  919. {
  920. $oldwaybill = $fullorder['oldwaybill'];
  921. }
  922. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  923. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  924. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  925. {
  926. $type = 1;
  927. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95,'fp'=>base_url().'data/pdf/'.$bctime.'/f-'.$Hwaybill.'.pdf');
  928. }
  929. }
  930. }
  931. else
  932. {
  933. if(isset($barcode['Description']))
  934. {
  935. if($barcode['Description'] != 'FEDEX_INTERNATIONAL_PRIORITY is not supported for the origin and destination pair.')
  936. {
  937. $failed = $barcode['Description'];//错误提示
  938. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  939. }
  940. else
  941. {
  942. $failed = 'FEDEX返回不正确信息';//错误提示
  943. }
  944. }
  945. }
  946. }
  947. /**
  948. else if($fullorder['printcode'] == "FEDEXCBY")//官方FEDEX接口许昌玉美桥
  949. {
  950. $barcode = $this->fedex_cby->get_data($fullorder);//获取联邦快递信息
  951. if($barcode['x'] == 1)
  952. {
  953. $bctime = date('Ymd',$time);
  954. $Hwaybill = $barcode['waybill'];
  955. $Hyd = $this->_pdf($barcode['label'],'y-'.$Hwaybill,$bctime);
  956. $Hfp = $this->_pdf($barcode['invoice'],'f-'.$Hwaybill,$bctime);//开通ETD模式,保留PDF,不需要打印
  957. if(isset($barcode['label']) && isset($Hwaybill))
  958. {
  959. if($fullorder['waybill'] != "")
  960. {
  961. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  962. }
  963. else
  964. {
  965. $oldwaybill = $fullorder['oldwaybill'];
  966. }
  967. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  968. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  969. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  970. {
  971. $type = 1;
  972. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
  973. }
  974. }
  975. }
  976. else
  977. {
  978. if(isset($barcode['Description']))
  979. {
  980. $failed = $barcode['Description'];//错误提示
  981. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  982. }
  983. }
  984. }
  985. **/
  986. else if($fullorder['printcode'] == "DPD" || $fullorder['printcode'] == "FTFEDEX")
  987. {
  988. $barcode = $this->dpd->get_data($fullorder);//获取联邦快递信息
  989. if($barcode['x'] == 1)
  990. {
  991. $bctime = date('Ymd',$time);
  992. $Hwaybill = $barcode['waybill'];
  993. $Hyd = $this->_pdf($barcode['yd'],'y-'.$Hwaybill,$bctime);
  994. if(isset($barcode['yd']) && isset($Hwaybill) && $Hwaybill != '' && $barcode['yd'] != '')
  995. {
  996. if($fullorder['waybill'] != "")
  997. {
  998. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  999. }
  1000. else
  1001. {
  1002. $oldwaybill = $fullorder['oldwaybill'];
  1003. }
  1004. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1005. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1006. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1007. {
  1008. $type = 1;
  1009. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>98);
  1010. }
  1011. }
  1012. else if(isset($barcode['yd']) && $Hwaybill == '' && $barcode['yd'] == '')
  1013. {
  1014. $oldwaybill = $fullorder['oldwaybill'];
  1015. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1016. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1017. {
  1018. $type = 2;
  1019. }
  1020. }
  1021. else
  1022. {
  1023. $failed = 'DPD平台可能已产生订单信息,需要查看并删除再处理错误。'.$barcode['res'];//错误提示
  1024. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1025. }
  1026. }
  1027. else
  1028. {
  1029. $failed = $barcode['Description'];//错误提示
  1030. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1031. }
  1032. }
  1033. else if($fullorder['printcode'] == "DPDIOSS" || $fullorder['printcode'] == "FTFEDEXIOSS")
  1034. {
  1035. $barcode = $this->dpdioss->get_data($fullorder);//获取联邦快递信息
  1036. /** 正常
  1037. if($barcode['x'] == 1)
  1038. {
  1039. $bctime = date('Ymd',$time);
  1040. $Hwaybill = $barcode['waybill'];
  1041. $Hyd = $this->_pdf($barcode['yd'],'y-'.$Hwaybill,$bctime);
  1042. if(isset($barcode['yd']) && isset($Hwaybill) && $Hwaybill != '' && $barcode['yd'] != '')
  1043. {
  1044. if($fullorder['waybill'] != "")
  1045. {
  1046. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1047. }
  1048. else
  1049. {
  1050. $oldwaybill = $fullorder['oldwaybill'];
  1051. }
  1052. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1053. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1054. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1055. {
  1056. $type = 1;
  1057. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>98);
  1058. }
  1059. }
  1060. else
  1061. {
  1062. $failed = '平台可能已产生订单信息,需要查看并删除再处理错误。'.$barcode['res'];//错误提示
  1063. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1064. }
  1065. }
  1066. **/
  1067. //临时开始
  1068. if($barcode['x'] == 1)
  1069. {
  1070. $bctime = date('Ymd',$time);
  1071. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1072. if($this->$fullorder_name->save(array('libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldprinttime'=>$oldprinttime),$va[$n]))
  1073. {
  1074. $type = 2;
  1075. }
  1076. }
  1077. //临时结束
  1078. else
  1079. {
  1080. $failed = $barcode['Description'];//错误提示
  1081. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1082. }
  1083. }
  1084. // 只获取运单号不打印运单
  1085. else if($fullorder['printcode'] == "DPDXW" || $fullorder['printcode'] == "UKDHLXW" || $fullorder['printcode'] == "FTFEDEXXW")
  1086. {
  1087. $barcode = $this->dpdxw->get_data($fullorder);//获取联邦快递信息
  1088. if($barcode['x'] == 1)
  1089. {
  1090. $bctime = date('Ymd',$time);
  1091. $Hwaybill = $barcode['waybill'];
  1092. $Hyd = $this->_pdf($barcode['yd'],'y-'.$Hwaybill,$bctime);
  1093. if(isset($barcode['yd']) && isset($Hwaybill) && $Hwaybill != '' && $barcode['yd'] != '')
  1094. {
  1095. if($fullorder['waybill'] != "")
  1096. {
  1097. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1098. }
  1099. else
  1100. {
  1101. $oldwaybill = $fullorder['oldwaybill'];
  1102. }
  1103. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1104. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1105. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1106. {
  1107. $type = 1;
  1108. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>98);
  1109. }
  1110. }
  1111. else
  1112. {
  1113. $failed = 'DPD平台可能已产生订单信息,需要查看并删除再处理错误。'.$barcode['res'];//错误提示
  1114. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1115. }
  1116. }
  1117. else
  1118. {
  1119. $failed = $barcode['Description'];//错误提示
  1120. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1121. }
  1122. }
  1123. /**
  1124. // 此DPD接口暂时不用
  1125. // DPD只获取运单号不打印运单
  1126. else if($fullorder['printcode'] == "DPD")
  1127. {
  1128. if($fullorder['zhou'] == '12')//欧洲
  1129. {
  1130. if($fullorder_name == 'fullordersmt')//速卖通9610
  1131. {
  1132. $fullorder['ysfs'] == '1921';
  1133. }
  1134. else if($fullorder_name == 'fullorder')//独立站9610
  1135. {
  1136. $fullorder['ysfs'] == '2021';
  1137. }
  1138. }
  1139. else if($fullorder['zhou'] == '13')//非洲
  1140. {
  1141. $fullorder['ysfs'] == '1881';
  1142. }
  1143. //$fullorder['ysfs'] == '2041';//欧洲全程不包双清、税
  1144. //$fullorder['ysfs'] == '1981';//欧洲速卖通非9610
  1145. //$fullorder['ysfs'] == '2001';//欧洲独立站非9610
  1146. $barcode = $this->dpd->get_data($fullorder);//获取信息
  1147. if($barcode['x'] == 1)//$barcode['a'] == 2 && $Hyd['a'] == 2
  1148. {
  1149. $bctime = date('Ymd',$time);
  1150. $Hwaybill = $barcode['waybill'];//运单号
  1151. if($fullorder['waybill'] != "")
  1152. {
  1153. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1154. }
  1155. else
  1156. {
  1157. $oldwaybill = $fullorder['oldwaybill'];
  1158. }
  1159. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1160. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1161. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1162. {
  1163. $type = 2;
  1164. }
  1165. }
  1166. else
  1167. {
  1168. $failed = $barcode['Description'];
  1169. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1170. }
  1171. }
  1172. **/
  1173. /** 阿里仓联邦不打印运单模式
  1174. else if($fullorder['printcode'] == "FEDEX" || $fullorder['printcode'] == "TOLL" || $fullorder['printcode'] == "ARAMEX")
  1175. {
  1176. $lj = $this->ali->get_lj($fullorder['number'],2,'订单修改');
  1177. $barcode = $this->ali->get_data($fullorder);//获取DHL快递信息
  1178. //$Hyd = $this->ali->get_label($fullorder['number'],1);//目前不需要打印标签
  1179. //1:10 X 10标签 2:A4纸 3:10X15标签 默认1
  1180. if($barcode['a'] == 2)//$barcode['a'] == 2 && $Hyd['a'] == 2
  1181. {
  1182. $bctime = date('Ymd',$time);
  1183. $Hwaybill = $barcode['number'];//运单号
  1184. //$this->_pdfurl($Hyd['pdf'],'y-'.$Hwaybill,$bctime);//目前不需要打印标签
  1185. if($fullorder['waybill'] != "")
  1186. {
  1187. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1188. }
  1189. else
  1190. {
  1191. $oldwaybill = $fullorder['oldwaybill'];
  1192. }
  1193. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1194. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1195. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1196. {
  1197. $type = 2;
  1198. }
  1199. }
  1200. else
  1201. {
  1202. $failed = $barcode['m'];
  1203. //$failed = isset($barcode['m'])?$barcode['m']:'-(此单已预报,务必先取消再允许打印)';//获取运单号错误提示
  1204. //$failed .= isset($Hyd['m'])?$Hyd['m']:'';//获取标签错误提示
  1205. if($fullorder['print'] == 3)
  1206. {
  1207. $this->$fullorder_name->save(array('libraryconfirm'=>1,'failed'=>date('Y-m-d H:i:s',time()).$failed),$va[$n]);
  1208. }
  1209. else
  1210. {
  1211. $this->$fullorder_name->save(array('print'=>1,'failed'=>date('Y-m-d H:i:s',time()).$failed),$va[$n]);
  1212. }
  1213. }
  1214. }
  1215. **/
  1216. else if($fullorder['printcode'] == "FEDEX" || $fullorder['printcode'] == "TOLL" || $fullorder['printcode'] == "ARAMEX")
  1217. {
  1218. $lj = $this->ali->get_lj($fullorder['number'],2,'订单修改');
  1219. $barcode = $this->ali->get_data($fullorder);//获取快递信息
  1220. $Hyd = $this->ali->get_label($fullorder['number'],1);//目前不需要打印标签
  1221. //1:10 X 10标签 2:A4纸 3:10X15标签 默认1
  1222. if($barcode['a'] == 2 && $Hyd['a'] == 2)
  1223. {
  1224. $bctime = date('Ymd',$time);
  1225. $Hwaybill = $barcode['number'];//运单号
  1226. $this->_pdfurl($Hyd['pdf'],'y-'.$Hwaybill,$bctime);//上传PDF
  1227. if($fullorder['waybill'] != "")
  1228. {
  1229. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1230. }
  1231. else
  1232. {
  1233. $oldwaybill = $fullorder['oldwaybill'];
  1234. }
  1235. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1236. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1237. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1238. {
  1239. $type = 1;
  1240. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
  1241. }
  1242. }
  1243. else
  1244. {
  1245. //$failed = $barcode['m'];
  1246. $failed = isset($barcode['m'])?$barcode['m']:'-(此单已预报,务必先取消再允许打印)';//获取运单号错误提示
  1247. $failed .= isset($Hyd['m'])?$Hyd['m']:'';//获取标签错误提示
  1248. if($fullorder['print'] == 3)
  1249. {
  1250. $this->$fullorder_name->save(array('libraryconfirm'=>1,'failed'=>date('Y-m-d H:i:s',time()).$failed),$va[$n]);
  1251. }
  1252. else
  1253. {
  1254. $this->$fullorder_name->save(array('print'=>1,'failed'=>date('Y-m-d H:i:s',time()).$failed),$va[$n]);
  1255. }
  1256. }
  1257. }
  1258. else if($fullorder['printcode'] == "UPS")//接口
  1259. {
  1260. $barcode = $this->ups->get_data($fullorder);//获取快递信息
  1261. if($barcode['x'] == 1)
  1262. {
  1263. $bctime = date('Ymd',$time);
  1264. $Hwaybill = $barcode['waybill'];
  1265. $Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
  1266. if(isset($barcode['label']) && isset($Hwaybill))
  1267. {
  1268. if($fullorder['waybill'] != "")
  1269. {
  1270. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1271. }
  1272. else
  1273. {
  1274. $oldwaybill = $fullorder['oldwaybill'];
  1275. }
  1276. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1277. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1278. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1279. {
  1280. $type = 1;
  1281. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
  1282. }
  1283. }
  1284. }
  1285. else
  1286. {
  1287. $failed = $barcode['Description'];//错误提示
  1288. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1289. }
  1290. }
  1291. else if($fullorder['printcode'] == "DPEX" || $fullorder['printcode'] == "FedEx_2day" || $fullorder['printcode'] == "usps_priority" || $fullorder['printcode'] == 'FEDEX_G' )//官方FEDEX接口
  1292. {
  1293. if($fullorder['waybillid'] != '')
  1294. {
  1295. $del = $this->cne->get_del($fullorder['waybillid']);
  1296. }
  1297. $barcode = $this->cne->get_data($fullorder);
  1298. if($barcode['x'] == 1)
  1299. {
  1300. $bctime = date('Ymd',$time);
  1301. $Hwaybill = $barcode['waybill'];
  1302. $Hyd = $this->_pdfurl($barcode['yd'],'y-'.$Hwaybill,$bctime);
  1303. //$Hfp = $this->_pdfurl($barcode['fp'],'f-'.$Hwaybill,$bctime);//保留PDF,不需要打印
  1304. if(isset($barcode['yd']) && isset($Hwaybill))
  1305. {
  1306. if($fullorder['waybill'] != "")
  1307. {
  1308. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1309. }
  1310. else
  1311. {
  1312. $oldwaybill = $fullorder['oldwaybill'];
  1313. }
  1314. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1315. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1316. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'waybillid'=>$barcode['waybillid'],'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1317. {
  1318. $type = 1;
  1319. $pdfnum = ($fullorder['printcode'] == "DPEX")?2:1;
  1320. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>100);
  1321. }
  1322. }
  1323. }
  1324. else
  1325. {
  1326. $failed = $barcode['Description'];//错误提示
  1327. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1328. }
  1329. }
  1330. else if($fullorder['printcode'] == "HUALEIXW-FEDEX" || $fullorder['printcode'] == "HUALEIXW-GES-GB-A" || $fullorder['printcode'] == "HUALEIXW-GES-EU9610" || $fullorder['printcode'] == "HUALEIXW-TNT" || $fullorder['printcode'] == "HUALEIXW-FEDEX" || $fullorder['printcode'] == "HUALEIXW-UPS" || $fullorder['printcode'] == "HUALEIXW-FEDEX-EUROPE" || $fullorder['printcode'] == "HUALEIXW-USPS" || $fullorder['printcode'] == "HUALEIXW-DHL" || $fullorder['printcode'] == "HUALEIXW-ARAMEX")
  1331. {
  1332. $barcode = $this->hualeixw->get_data($fullorder);
  1333. $bctime = date('Ymd',$time);
  1334. if(!isset($barcode['x']))
  1335. {
  1336. print_r($barcode);exit;
  1337. }
  1338. if($barcode['x'] == 1)
  1339. {
  1340. if($barcode['ys'] == 1)
  1341. {
  1342. if(!$this->yswaybill->insert(array('type'=>$fullorder_name,'express'=>'hualeixw','number'=>$fullorder['number'])))
  1343. {
  1344. echo json_encode(array('msg'=>'失败请重试','success'=>false));exit;
  1345. }
  1346. $bctime = date('Ymd',$time);
  1347. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1348. if($this->$fullorder_name->save(array('waybill'=>$barcode['waybill'],'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldprinttime'=>$oldprinttime),$va[$n]))
  1349. {
  1350. $type = 2;
  1351. }
  1352. }
  1353. else
  1354. {
  1355. $Hwaybill = $barcode['waybill'];
  1356. $Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
  1357. if(isset($barcode['label']) && isset($Hwaybill))
  1358. {
  1359. if($fullorder['waybill'] != "")
  1360. {
  1361. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1362. }
  1363. else
  1364. {
  1365. $oldwaybill = $fullorder['oldwaybill'];
  1366. }
  1367. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1368. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1369. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1370. {
  1371. if($fullorder['printcode'] == "HUALEIXW-FEDEX")
  1372. {
  1373. $type = 5;
  1374. }
  1375. else
  1376. {
  1377. $type = 2;
  1378. }
  1379. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
  1380. }
  1381. }
  1382. }
  1383. }
  1384. else
  1385. {
  1386. $failed = $barcode['Description'];//错误提示
  1387. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1388. }
  1389. /**
  1390. if($barcode['x'] == 1)
  1391. {
  1392. if($barcode['ys'] == 1)
  1393. {
  1394. if(!$this->yswaybill->insert(array('type'=>$fullorder_name,'express'=>'hualeixw','number'=>$fullorder['number'])))
  1395. {
  1396. echo json_encode(array('msg'=>'失败请重试','success'=>false));exit;
  1397. }
  1398. }
  1399. $bctime = date('Ymd',$time);
  1400. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1401. if($this->$fullorder_name->save(array('libraryconfirm'=>2,'librarynot'=>'','waybill'=>$barcode['waybill'],'printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldprinttime'=>$oldprinttime),$va[$n]))
  1402. {
  1403. $type = 2;
  1404. }
  1405. }
  1406. else
  1407. {
  1408. $failed = $barcode['Description'];//错误提示
  1409. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1410. }
  1411. **/
  1412. }
  1413. else if($fullorder['printcode'] == "HUALEI-FEDEX" || $fullorder['printcode'] == "HUALEI-ARAMEX-S" || $fullorder['printcode'] == "HUALEI-ARAMEX-G" || $fullorder['printcode'] == "HUALEI-GES-EU" || $fullorder['printcode'] == "HUALEI-DHL-A1" || $fullorder['printcode'] == "HUALEI-WMS"||$fullorder['printcode'] == 'HUALEI-DHL' || $fullorder['printcode'] == 'HUALEI-MLXY')
  1414. {
  1415. $barcode = $this->hualei->get_data($fullorder);
  1416. $bctime = date('Ymd',$time);
  1417. if(!isset($barcode['x']))
  1418. {
  1419. print_r($barcode);exit;
  1420. }
  1421. if($barcode['x'] == 1)
  1422. {
  1423. if($barcode['ys'] == 1)
  1424. {
  1425. if(!$this->yswaybill->insert(array('type'=>$fullorder_name,'express'=>'hualei','number'=>$fullorder['number'])))
  1426. {
  1427. echo json_encode(array('msg'=>'失败请重试','success'=>false));exit;
  1428. }
  1429. $bctime = date('Ymd',$time);
  1430. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1431. $waybill2 = '';
  1432. if(isset($barcode['waybill2']))
  1433. {
  1434. $waybill2 = $barcode['waybill2'];
  1435. }
  1436. if($this->$fullorder_name->save(array('waybill'=>$barcode['waybill'],'waybill2'=>$waybill2,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldprinttime'=>$oldprinttime),$va[$n]))
  1437. {
  1438. $type = 2;
  1439. }
  1440. }
  1441. else
  1442. {
  1443. $Hwaybill = $barcode['waybill'];
  1444. $Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
  1445. if(isset($barcode['label']) && isset($Hwaybill))
  1446. {
  1447. if($fullorder['waybill'] != "")
  1448. {
  1449. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1450. }
  1451. else
  1452. {
  1453. $oldwaybill = $fullorder['oldwaybill'];
  1454. }
  1455. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1456. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1457. $waybill2 = '';
  1458. if(isset($barcode['waybill2']))
  1459. {
  1460. $waybill2 = $barcode['waybill2'];
  1461. }
  1462. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'waybill2'=>$waybill2,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1463. {
  1464. if($fullorder['printcode'] == "HUALEI-FEDEX" || $fullorder['printcode'] == "HUALEI-MLXY" )
  1465. {
  1466. //$type = 5;
  1467. $type = 1;
  1468. }
  1469. else if($fullorder['printcode'] == "HUALEI-ARAMEX-G" || $fullorder['printcode'] == "HUALEI-ARAMEX-S" || $fullorder['printcode'] == "HUALEI-GES-EU")
  1470. {
  1471. $type = 1;
  1472. }
  1473. else if($fullorder['printcode'] == "HUALEI-DHL")
  1474. {
  1475. //$type = 5;
  1476. $type = 1;
  1477. }
  1478. else
  1479. {
  1480. $type = 2;
  1481. }
  1482. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
  1483. }
  1484. }
  1485. }
  1486. }
  1487. else
  1488. {
  1489. $failed = $barcode['Description'];//错误提示
  1490. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1491. }
  1492. }
  1493. /** 云途开始**/
  1494. else if(($fullorder['printcode'] == "YunExpress")||($fullorder['printcode'] =='YunExpress_BaoXian'))
  1495. {
  1496. // echo "123";
  1497. // exit;
  1498. // if(!empty($fullorder['waybill']))
  1499. // {
  1500. // $label = $this->yuntu->get_label($fullorder['number']);
  1501. // if($label['x'] == 1){
  1502. // $bctime = date('Ymd',$time);
  1503. // $Hwaybill = $fullorder['waybill'];//运单号
  1504. // $this->_pdfurl($label['url'],'y-'.$Hwaybill,$bctime);//上传PDF
  1505. // $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1506. // if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3),$va[$n]))
  1507. // {
  1508. // $type = 1;
  1509. // $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
  1510. // }
  1511. // }
  1512. // }
  1513. // else{
  1514. $barcode = $this->yuntu->get_data($fullorder);//获取快递信息
  1515. // var_dump($barcode);
  1516. if($barcode['x'] == 1){
  1517. $bctime = date('Ymd',$time);
  1518. $Hwaybill = $barcode['waybill'];//运单号
  1519. $this->_pdfurl($barcode['url'],'y-'.$Hwaybill,$bctime);//上传PDF
  1520. if($fullorder['waybill'] != "")
  1521. {
  1522. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1523. }
  1524. else
  1525. {
  1526. $oldwaybill = $fullorder['oldwaybill'];
  1527. }
  1528. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1529. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1530. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1531. {
  1532. $type = 1;
  1533. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>95);
  1534. }
  1535. }else{
  1536. $failed = $barcode['Description'].'123';//错误提示
  1537. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1538. }
  1539. //}
  1540. //die;
  1541. }
  1542. elseif(($fullorder['printcode'] == "USKD01")){
  1543. if($fullorder['waybillid'] != '')
  1544. {
  1545. $del = $this->zxyuntu->get_del($fullorder['waybillid']);
  1546. }
  1547. // $send_info = $fullorder;
  1548. // $send_info['number'] = $send_info['number']."_".$fullorder['printnumber'];
  1549. //$barcode = $this->zxyuntu->get_data($send_info);
  1550. $barcode = $this->zxyuntu->get_data($fullorder);
  1551. if($barcode['x'] == 1)
  1552. {
  1553. $bctime = date('Ymd',$time);
  1554. $Hwaybill = $barcode['waybill'];
  1555. $Hyd = $this->_pdfurl($barcode['yd'],'y-'.$Hwaybill,$bctime);
  1556. //$Hfp = $this->_pdfurl($barcode['fp'],'f-'.$Hwaybill,$bctime);//保留PDF,不需要打印
  1557. if(isset($barcode['yd']) && isset($Hwaybill))
  1558. {
  1559. if($fullorder['waybill'] != "")
  1560. {
  1561. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1562. }
  1563. else
  1564. {
  1565. $oldwaybill = $fullorder['oldwaybill'];
  1566. }
  1567. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1568. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1569. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'waybillid'=>$barcode['waybillid'],'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1570. {
  1571. $type = 1;
  1572. $pdfnum = 1;
  1573. $text = array('yd'=>base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','mode'=>100);
  1574. }
  1575. }
  1576. }
  1577. else
  1578. {
  1579. $failed = $barcode['Description'];//错误提示
  1580. $this->$fullorder_name->save(array('print'=>1,'failed'=>$failed),$va[$n]);
  1581. }
  1582. }
  1583. /*********云途结束 */
  1584. else
  1585. {
  1586. $this->$fullorder_name->save(array('print'=>1,'failed'=>'未找到此快递运单接口'),$va[$n]);
  1587. }
  1588. if($fullorder_name == 'fullordersmt' || $fullorder_name == 'fullorder_smt')
  1589. {
  1590. $text['name'] = '速卖通';
  1591. }
  1592. else if($fullorder_name == 'fullordertt')
  1593. {
  1594. $text['name'] = 'TikTok';
  1595. }
  1596. else if($fullorder_name == 'fullorderamz')
  1597. {
  1598. $text['name'] = '亚马逊';
  1599. }
  1600. else if($fullorder_name == 'fullorderxw')
  1601. {
  1602. $text['name'] = '翔文';
  1603. }
  1604. else
  1605. {
  1606. $text['name'] = '独立站';
  1607. }
  1608. $text['express'] = $fullorder['express'];
  1609. $text['country'] = $fullorder['country'];
  1610. $text['orderinfo'] = $fullorder['orderinfo'];
  1611. $text['number'] = $fullorder['number'];
  1612. $text['shipremarks'] = $fullorder['shipremarks'];
  1613. $text['ts'] = $fullorder['ts'];
  1614. $text['time'] = $fullorder['times'];
  1615. $text['printnumber'] = $fullorder['printnumber'];
  1616. $text['pdfnum'] = $pdfnum;
  1617. $text['pt'] = $fullorder['pt'];
  1618. $text['warehouse'] = $fullorder['warehouse']['title'];
  1619. $text['is_jiaji'] = $fullorder['is_jiaji'];
  1620. $rows = array('type'=>$type,'n'=>$n-1,'data'=>$v,'text'=>$text);
  1621. echo json_encode(array('rows'=>($rows),'success'=>true));exit;
  1622. }
  1623. else if(($fullorder['printtype'] == 2 || $fullorder['printtype'] == 4) && $fullorder['library'] != 2)
  1624. {
  1625. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1626. if($this->$fullorder_name->save(array('libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldprinttime'=>$oldprinttime),$va[$n]))
  1627. {
  1628. $type = 2;
  1629. }
  1630. if($fullorder_name == 'fullordersmt' || $fullorder_name == 'fullorder_smt')
  1631. {
  1632. $text['name'] = '速卖通';
  1633. }
  1634. else
  1635. {
  1636. $text['name'] = '独立站';
  1637. }
  1638. $text['express'] = $fullorder['express'];
  1639. $text['country'] = $fullorder['country'];
  1640. $text['orderinfo'] = $fullorder['orderinfo'];
  1641. $text['number'] = $fullorder['number'];
  1642. $text['shipremarks'] = $fullorder['shipremarks'];
  1643. $text['ts'] = $fullorder['ts'];
  1644. $text['time'] = $fullorder['times'];
  1645. $text['printnumber'] = $fullorder['printnumber'];
  1646. $text['pdfnum'] = $pdfnum;
  1647. $text['pt'] = $fullorder['pt'];
  1648. $text['warehouse'] = $fullorder['warehouse']['title'];
  1649. $text['is_jiaji'] = $fullorder['is_jiaji'];
  1650. $rows = array('type'=>$fullorder['printtype'],'n'=>$n-1,'data'=>$v,'text'=>$text);
  1651. echo json_encode(array('rows'=>($rows),'success'=>true));exit;
  1652. }
  1653. else
  1654. {
  1655. if($fullorder_name == 'fullordersmt' || $fullorder_name == 'fullorder_smt')
  1656. {
  1657. $text['name'] = '速卖通';
  1658. }
  1659. else
  1660. {
  1661. $text['name'] = '独立站';
  1662. }
  1663. $text['express'] = $fullorder['express'];
  1664. $text['country'] = $fullorder['country'];
  1665. $text['orderinfo'] = $fullorder['orderinfo'];
  1666. $text['number'] = $fullorder['number'];
  1667. $text['shipremarks'] = $fullorder['shipremarks'];
  1668. $text['ts'] = $fullorder['ts'];
  1669. $text['time'] = $fullorder['times'];
  1670. $text['printnumber'] = $fullorder['printnumber'];
  1671. $text['pdfnum'] = $pdfnum;
  1672. $text['warehouse'] = $fullorder['warehouse']['title'];
  1673. $text['is_jiaji'] = $fullorder['is_jiaji'];
  1674. $rows = array('type'=>$type,'n'=>$n-1,'data'=>$v,'text'=>$text);
  1675. echo json_encode(array('msg'=>'该订单已出库,无法打印!','success'=>false));exit;
  1676. }
  1677. }
  1678. }
  1679. public function _text($fullorder)
  1680. {
  1681. /** 发票地址信息暂时无用
  1682. $fullorder['baddress'] = explode(',',$fullorder['baddress']);
  1683. $fullorder['baddress'] = array_reverse($fullorder['baddress']);
  1684. $fullorder['baddress'][1] = $country['ename'];
  1685. **/
  1686. //获取所用相关信息
  1687. $warehouse = $this->warehouse->read($fullorder['type']);
  1688. $country = $this->country->read($fullorder['country']);//订单国家信息
  1689. $fcountry = $this->country->read($warehouse['country']);//仓库国家信息
  1690. $warehouse['country'] = $fcountry['ename'];//仓库国家名
  1691. $warehouse['lb'] = $fcountry['lb'];//仓库国家编码
  1692. $fullorder['warehouse'] = $warehouse;//仓库数据加入订单
  1693. $fullorder['lb'] = $country['lb'];//订单国家编码加入
  1694. $fullorder['country'] = $country['ename'];//订单国家名
  1695. $fullorder['zhou'] = $country['continent'];//所属州
  1696. $express = $this->express->read($fullorder['express']);
  1697. $fullorder['express'] = $express['servicename'];
  1698. $fullorder['account'] = $express['account'];
  1699. $fullorder['printcode'] = $express['printcode'];
  1700. $fullorder['time'] = date('Y-m-d',time());
  1701. $fullorder['times'] = date('Y-m-d H:i',time());
  1702. // $fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
  1703. // 修复报关编码问题
  1704. $declara_info = $this->customsdeclaration->find("ename like '%".trim($fullorder['sbpm'])."%' ","*");
  1705. $sbbm = "";
  1706. if(empty($declara_info)){
  1707. $sbbm = "";
  1708. }else{
  1709. $sbbm = $declara_info['bname'];
  1710. }
  1711. $fullorder['sbbm']= $sbbm;
  1712. $fullorder['address'] = str_replace(array('&'),array('&#38;'),$fullorder['address']);
  1713. $fullorder['address2'] = str_replace(array('&'),array('&#38;'),$fullorder['address2']);
  1714. $fullorder['shipremarks'] = str_replace(array('&lt;','&gt;'),array('<','>'),$fullorder['shipremarks']);
  1715. $fullorder['shipremarks'] = str_replace(array('<','>',';',';'),array('&lt','&gt',';<br>',';<br>'),$fullorder['shipremarks']);
  1716. $shop = $this->shop->read($fullorder['shop']);
  1717. $fullorder['shop'] = $shop['shopname'];
  1718. $shoptype = $this->typeclass->read($shop['type']);
  1719. $fullorder['shoptype'] = $shoptype['classtitle'];
  1720. $fullorder['city'] = preg_replace('/( | | |\s)/',' ',$fullorder['city']);
  1721. $fullorder['province'] = preg_replace('/( | | |\s)/',' ',$fullorder['province']);
  1722. if(is_numeric($fullorder['pay']))
  1723. {
  1724. $pay = $this->typeclass->read($fullorder['pay']);
  1725. if($pay['classid'] == '4')
  1726. {
  1727. $fullorder['pay'] = $pay['title'];
  1728. }
  1729. }
  1730. if($fullorder['printcode'] != "USPS")
  1731. {
  1732. $fullorder['client'] = htmlspecialchars($fullorder['client']);
  1733. $fullorder['name'] = htmlspecialchars($fullorder['name']);
  1734. }
  1735. //增加退货单所需信息
  1736. $pt = '';
  1737. $fpdata = explode(';',trim($fullorder['fpdata'],';'));
  1738. foreach ($fpdata as $v)
  1739. {
  1740. $p = explode('|',trim($v,'|'));
  1741. if(isset($p[1]) && isset($p[2]))
  1742. {
  1743. $pt .= '<p>'.$p[1].' * '.$p[2].'</p>';
  1744. }
  1745. }
  1746. $fullorder['pt'] = $pt;
  1747. return $fullorder;
  1748. }
  1749. public function _pdf($pdf,$title,$bctime)
  1750. {
  1751. $pdf_path = './data/pdf/'.$bctime.'/';
  1752. $file_base64 = $pdf;
  1753. $file_base64 = preg_replace('/data:.*;base64,/i', '', $file_base64);
  1754. $file_base64 = base64_decode($file_base64);
  1755. if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建
  1756. file_put_contents($pdf_path.$title.'.pdf',$file_base64);
  1757. return $bctime;
  1758. }
  1759. public function _pdfurl($pdf,$title,$bctime)
  1760. {
  1761. $pdf_path = './data/pdf/'.$bctime.'/';
  1762. $pdf = fopen($pdf,"r");
  1763. if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建
  1764. file_put_contents($pdf_path.$title.'.pdf',$pdf);
  1765. return $bctime;
  1766. }
  1767. public function _exceldy()
  1768. {
  1769. if(isset($_GET['fexcel']))
  1770. {
  1771. if(isset($_SESSION['api']))
  1772. {
  1773. $user = $this->user->get_api($_SESSION['api']);
  1774. $usp = $user;
  1775. $fgshop = "";$sid = "";$wid="";$wtype="";
  1776. $usersp = explode('|',trim($user['shop'],'|'));
  1777. $userwh = explode('|',trim($user['warehouse'],'|'));
  1778. foreach ($usersp as $value)
  1779. {
  1780. $fgshop .= " shop = ".$value." or";
  1781. $sid .= " id = ".$value." or";
  1782. }
  1783. foreach ($userwh as $value)
  1784. {
  1785. $wid .= " id = ".$value." or";
  1786. $wtype .= " type = ".$value." or";
  1787. }
  1788. }
  1789. $dowid = $this->input->get('a');
  1790. $wid = "";
  1791. if($dowid != "")
  1792. {
  1793. $id_arr = explode(',',rtrim($dowid,','));
  1794. foreach ($id_arr as $v)
  1795. {
  1796. $wid .= " id = '$v' or";
  1797. }
  1798. $wid = " and (".rtrim($wid,'or').")";
  1799. }
  1800. $page = $this->input->get('page',true);
  1801. $perpage = $this->input->get('perpage',true);
  1802. $timetk = $this->input->get('timetk',true);
  1803. $timetj = $this->input->get('timetj',true);
  1804. $shop = $this->input->get('shop',true);
  1805. $print = $this->input->get('print',true);
  1806. $express = $this->input->get('express',true);
  1807. $waybill = $this->input->get('waybill',true);
  1808. $printtype = $this->input->get('printtype',true);
  1809. $orderinfo = $this->input->get('orderinfo',true);
  1810. $number = $this->input->get('number',true);
  1811. $type = $this->input->get('type',true);
  1812. $lowe = $this->input->get('lowe',true);
  1813. $info = $this->input->get('info',true);
  1814. $ji = $this->input->get('ji',true);
  1815. $so = $this->input->get('so',true);
  1816. $timetk = strtotime($timetk);
  1817. $timetj = strtotime($timetj);
  1818. $where = (isset($_SESSION['api']))?"(state = '207' or state = '209') and (".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
  1819. if($print == 3)
  1820. {
  1821. $where .= " and printtime > '$timetk' and printtime < '$timetj' and print = '3' and library = 1";
  1822. }
  1823. else
  1824. {
  1825. $where .= " and express != 0 and printtype != 3 and printtype > 0 and print = 2 and review > 4 and library = 1 and reviewtime > '".(time() - 30*24*3600)."'";
  1826. }
  1827. if($shop)
  1828. {
  1829. $where .= " and shop = '$shop'";
  1830. }
  1831. if($express)
  1832. {
  1833. $where .= " and express = '$express'";
  1834. }
  1835. if($printtype)
  1836. {
  1837. $where .= " and printtype = '$printtype'";
  1838. }
  1839. if($orderinfo)
  1840. {
  1841. $where .= " and orderinfo = '$orderinfo'";
  1842. }
  1843. if($number)
  1844. {
  1845. $where .= " and number = '$number'";
  1846. }
  1847. if($waybill)
  1848. {
  1849. $where .= " and waybill = '$waybill'";
  1850. }
  1851. if($type)
  1852. {
  1853. $where .= " and type = '$type'";
  1854. }
  1855. else
  1856. {
  1857. $where .= " and type != '16'";
  1858. }
  1859. /**
  1860. if($type)
  1861. {
  1862. if($type != '4')
  1863. {
  1864. $where .= " and type = '$type'";
  1865. $where2 = '';
  1866. $where3 = '';
  1867. }
  1868. else
  1869. {
  1870. $where2 = " and type = '4' and (wigs = '3' or wigs = '8') and issku not like '%#pack%'";
  1871. $where3 = " and type = '4' and (wigs = '3' or wigs = '8') and sku not like '%#pack%'";
  1872. }
  1873. $where_a = "";
  1874. $where_b = "";
  1875. }
  1876. else
  1877. {
  1878. $where .= " and type != '4'";
  1879. $where_a = "(";
  1880. $where_b = ")";
  1881. $where2 = " or (type = '4' and (wigs = '3' or wigs = '8') and issku not like '%#pack%')";
  1882. $where3 = " or (type = '4' and (wigs = '3' or wigs = '8') and sku not like '%#pack%')";
  1883. }
  1884. **/
  1885. if($lowe)
  1886. {
  1887. $where .= " and fpdata like '%-$lowe-%'";
  1888. }
  1889. if($ji)
  1890. {
  1891. $where .= " and shipremarks like '%急%'";
  1892. }
  1893. if($so)
  1894. {
  1895. $where .= " and shipremarks like '%$so%'";
  1896. }
  1897. //数据排序
  1898. $order_str = ($print != 3)?"id desc":"printtime desc";
  1899. //取得信息列表
  1900. $info_list = $this->fullorder->find_all($where.$wid,'shop,type,orderinfo,number,waybill,express,print,printnumber,library,printtime,shipremarks,ts',$order_str);
  1901. //格式化数据
  1902. foreach ($info_list as $key=>$value)
  1903. {
  1904. $shop = $this->shop->read($value['shop']);
  1905. $info_list[$key]['shop'] = $shop['shopname'];
  1906. if($value['waybill'] == '0')
  1907. {
  1908. $info_list[$key]['waybill'] = "";
  1909. }
  1910. $express = $this->express->read($value['express']);
  1911. $info_list[$key]['express'] = $express['servicename'];
  1912. $warehouse = $this->warehouse->read($value['type']);
  1913. $info_list[$key]['type'] = $warehouse['title'];
  1914. if($value['printtime'] == '0')
  1915. {
  1916. $info_list[$key]['printtime'] = '<em class="t"></em>';
  1917. }
  1918. else
  1919. {
  1920. $info_list[$key]['printtime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['printtime']).'</em>';
  1921. }
  1922. if($value['print'] == 1)
  1923. {
  1924. $info_list[$key]['print'] = '不可打印';
  1925. }
  1926. else if($value['print'] == 2)
  1927. {
  1928. $info_list[$key]['print'] = '未打印';
  1929. }
  1930. else if($value['print'] == 3)
  1931. {
  1932. $info_list[$key]['print'] = '已打印';
  1933. }
  1934. if($value['library'] == 1)
  1935. {
  1936. $info_list[$key]['library'] = '<em class="c">未出库</em>';
  1937. }
  1938. else if($value['library'] == 2)
  1939. {
  1940. $info_list[$key]['library'] = '<em class="c">已出库</em>';
  1941. }
  1942. else if($value['library'] == 3)
  1943. {
  1944. $info_list[$key]['library'] = '<em class="c">已退库</em>';
  1945. }
  1946. //$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  1947. }
  1948. //取得信息列表
  1949. $info_listsmt = $this->fullordersmt->find_all($where.$wid,'shop,type,orderinfo,number,waybill,express,print,printnumber,library,printtime,shipremarks,ts',$order_str);
  1950. //格式化数据
  1951. foreach ($info_listsmt as $key=>$value)
  1952. {
  1953. $shop = $this->shop->read($value['shop']);
  1954. $info_listsmt[$key]['shop'] = $shop['shopname'];
  1955. if($value['waybill'] == '0')
  1956. {
  1957. $info_listsmt[$key]['waybill'] = "";
  1958. }
  1959. $express = $this->express->read($value['express']);
  1960. $info_listsmt[$key]['express'] = $express['servicename'];
  1961. $warehouse = $this->warehouse->read($value['type']);
  1962. $info_listsmt[$key]['type'] = $warehouse['title'];
  1963. if($value['printtime'] == '0')
  1964. {
  1965. $info_listsmt[$key]['printtime'] = '<em class="t"></em>';
  1966. }
  1967. else
  1968. {
  1969. $info_listsmt[$key]['printtime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['printtime']).'</em>';
  1970. }
  1971. if($value['print'] == 1)
  1972. {
  1973. $info_listsmt[$key]['print'] = '不可打印';
  1974. }
  1975. else if($value['print'] == 2)
  1976. {
  1977. $info_listsmt[$key]['print'] = '未打印';
  1978. }
  1979. else if($value['print'] == 3)
  1980. {
  1981. $info_listsmt[$key]['print'] = '已打印';
  1982. }
  1983. if($value['library'] == 1)
  1984. {
  1985. $info_listsmt[$key]['library'] = '<em class="c">未出库</em>';
  1986. }
  1987. else if($value['library'] == 2)
  1988. {
  1989. $info_listsmt[$key]['library'] = '<em class="c">已出库</em>';
  1990. }
  1991. else if($value['library'] == 3)
  1992. {
  1993. $info_listsmt[$key]['library'] = '<em class="c">已退库</em>';
  1994. }
  1995. //$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  1996. }
  1997. $info_listtt = $this->fullordertt->find_all($where.$wid,'shop,type,orderinfo,number,waybill,express,print,printnumber,library,printtime,shipremarks,ts',$order_str);
  1998. //格式化数据
  1999. foreach ($info_listtt as $key=>$value)
  2000. {
  2001. $shop = $this->shop->read($value['shop']);
  2002. $info_listtt[$key]['shop'] = $shop['shopname'];
  2003. if($value['waybill'] == '0')
  2004. {
  2005. $info_listtt[$key]['waybill'] = "";
  2006. }
  2007. $express = $this->express->read($value['express']);
  2008. $info_listtt[$key]['express'] = $express['servicename'];
  2009. $warehouse = $this->warehouse->read($value['type']);
  2010. $info_listtt[$key]['type'] = $warehouse['title'];
  2011. if($value['printtime'] == '0')
  2012. {
  2013. $info_listtt[$key]['printtime'] = '<em class="t"></em>';
  2014. }
  2015. else
  2016. {
  2017. $info_listtt[$key]['printtime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['printtime']).'</em>';
  2018. }
  2019. if($value['print'] == 1)
  2020. {
  2021. $info_listtt[$key]['print'] = '不可打印';
  2022. }
  2023. else if($value['print'] == 2)
  2024. {
  2025. $info_listtt[$key]['print'] = '未打印';
  2026. }
  2027. else if($value['print'] == 3)
  2028. {
  2029. $info_listtt[$key]['print'] = '已打印';
  2030. }
  2031. if($value['library'] == 1)
  2032. {
  2033. $info_listtt[$key]['library'] = '<em class="c">未出库</em>';
  2034. }
  2035. else if($value['library'] == 2)
  2036. {
  2037. $info_listtt[$key]['library'] = '<em class="c">已出库</em>';
  2038. }
  2039. else if($value['library'] == 3)
  2040. {
  2041. $info_listtt[$key]['library'] = '<em class="c">已退库</em>';
  2042. }
  2043. //$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  2044. }
  2045. $info_listamz = $this->fullorderamz->find_all($where.$wid,'shop,type,orderinfo,number,waybill,express,print,printnumber,library,printtime,shipremarks,ts',$order_str);
  2046. //格式化数据
  2047. foreach ($info_listamz as $key=>$value)
  2048. {
  2049. $shop = $this->shop->read($value['shop']);
  2050. $info_listamz[$key]['shop'] = $shop['shopname'];
  2051. if($value['waybill'] == '0')
  2052. {
  2053. $info_listamz[$key]['waybill'] = "";
  2054. }
  2055. $express = $this->express->read($value['express']);
  2056. $info_listamz[$key]['express'] = $express['servicename'];
  2057. $warehouse = $this->warehouse->read($value['type']);
  2058. $info_listamz[$key]['type'] = $warehouse['title'];
  2059. if($value['printtime'] == '0')
  2060. {
  2061. $info_listamz[$key]['printtime'] = '<em class="t"></em>';
  2062. }
  2063. else
  2064. {
  2065. $info_listamz[$key]['printtime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['printtime']).'</em>';
  2066. }
  2067. if($value['print'] == 1)
  2068. {
  2069. $info_listamz[$key]['print'] = '不可打印';
  2070. }
  2071. else if($value['print'] == 2)
  2072. {
  2073. $info_listamz[$key]['print'] = '未打印';
  2074. }
  2075. else if($value['print'] == 3)
  2076. {
  2077. $info_listamz[$key]['print'] = '已打印';
  2078. }
  2079. if($value['library'] == 1)
  2080. {
  2081. $info_listamz[$key]['library'] = '<em class="c">未出库</em>';
  2082. }
  2083. else if($value['library'] == 2)
  2084. {
  2085. $info_listamz[$key]['library'] = '<em class="c">已出库</em>';
  2086. }
  2087. else if($value['library'] == 3)
  2088. {
  2089. $info_listamz[$key]['library'] = '<em class="c">已退库</em>';
  2090. }
  2091. //$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  2092. }
  2093. $info_listxw = $this->fullorderxw->find_all($where.$wid,'shop,type,orderinfo,number,waybill,express,print,printnumber,library,printtime,shipremarks,ts',$order_str);
  2094. //格式化数据
  2095. foreach ($info_listxw as $key=>$value)
  2096. {
  2097. $shop = $this->shop->read($value['shop']);
  2098. $info_listxw[$key]['shop'] = $shop['shopname'];
  2099. if($value['waybill'] == '0')
  2100. {
  2101. $info_listxw[$key]['waybill'] = "";
  2102. }
  2103. $express = $this->express->read($value['express']);
  2104. $info_listxw[$key]['express'] = $express['servicename'];
  2105. $warehouse = $this->warehouse->read($value['type']);
  2106. $info_listxw[$key]['type'] = $warehouse['title'];
  2107. if($value['printtime'] == '0')
  2108. {
  2109. $info_listxw[$key]['printtime'] = '<em class="t"></em>';
  2110. }
  2111. else
  2112. {
  2113. $info_listxw[$key]['printtime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['printtime']).'</em>';
  2114. }
  2115. if($value['print'] == 1)
  2116. {
  2117. $info_listxw[$key]['print'] = '不可打印';
  2118. }
  2119. else if($value['print'] == 2)
  2120. {
  2121. $info_listxw[$key]['print'] = '未打印';
  2122. }
  2123. else if($value['print'] == 3)
  2124. {
  2125. $info_listxw[$key]['print'] = '已打印';
  2126. }
  2127. if($value['library'] == 1)
  2128. {
  2129. $info_listxw[$key]['library'] = '<em class="c">未出库</em>';
  2130. }
  2131. else if($value['library'] == 2)
  2132. {
  2133. $info_listxw[$key]['library'] = '<em class="c">已出库</em>';
  2134. }
  2135. else if($value['library'] == 3)
  2136. {
  2137. $info_listxw[$key]['library'] = '<em class="c">已退库</em>';
  2138. }
  2139. //$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  2140. }
  2141. $title = '订单出库-'.date('Ymd',time());
  2142. $titlename = "<table border=1><td>店铺名称</td><td>仓库</td><td>订单号</td><td>编号</td><td>运单号</td><td>快递</td><td>类型</td><td>打印次数</td><td>状态</td><td>打印时间</td><td>仓库品名</td><td>条数</td></table>";
  2143. $tail = "\n";
  2144. $filename = $title.".xls";
  2145. $this->excel->get_fz2(array_merge($info_list,$info_listamz,$info_listsmt,$info_listtt,$info_listxw),$titlename,$filename,$tail);
  2146. }
  2147. }
  2148. public function _barcode()
  2149. {
  2150. $post = $this->input->post(NULL, TRUE);
  2151. if(isset($_SESSION['api']))
  2152. {
  2153. $user = $this->user->get_api($_SESSION['api']);
  2154. $usp = $user;
  2155. $fgshop = "";$sid = "";$wid="";$wtype="";
  2156. $usersp = explode('|',trim($user['shop'],'|'));
  2157. $userwh = explode('|',trim($user['warehouse'],'|'));
  2158. foreach ($usersp as $value)
  2159. {
  2160. $fgshop .= " shop = ".$value." or";
  2161. $sid .= " id = ".$value." or";
  2162. }
  2163. foreach ($userwh as $value)
  2164. {
  2165. $wid .= " id = ".$value." or";
  2166. $wtype .= " type = ".$value." or";
  2167. }
  2168. }
  2169. if(isset($post['page']))
  2170. {
  2171. $page = $this->input->post('page',true);
  2172. $perpage = $this->input->post('perpage',true);
  2173. $warehouse = $this->input->post('warehouse',true);
  2174. $sku = $this->input->post('sku ',true);
  2175. $title = $this->input->post('title',true);
  2176. $print = $this->input->post('print ',true);
  2177. $timetk = $this->input->post('timetk',true);
  2178. $timetj = $this->input->post('timetj',true);
  2179. $timetk = strtotime($timetk);
  2180. $timetj = strtotime($timetj);
  2181. $where = "time > '$timetk' and time < '$timetj'";
  2182. if($warehouse)
  2183. {
  2184. $where .= " and warehouse = '$warehouse'";
  2185. }
  2186. if($sku)
  2187. {
  2188. $where .= " and sku like '%$sku%'";
  2189. }
  2190. if($title)
  2191. {
  2192. $where .= " and title like '%$title%'";
  2193. }
  2194. if($print)
  2195. {
  2196. $where .= " and print = '$print'";
  2197. }
  2198. //数据排序
  2199. $order_str = "time desc";
  2200. if(empty($page))
  2201. {
  2202. $start = 0;
  2203. $perpage = 1;
  2204. }
  2205. else
  2206. {
  2207. $start = ($page - 1)*$perpage;
  2208. }
  2209. //取得信息列表
  2210. $info_list = $this->whlabelbarcodeprint->find_all($where,'id,sku,title,num,printtime',$order_str,$start,$perpage);
  2211. //格式化数据
  2212. foreach ($info_list as $key=>$value)
  2213. {
  2214. if($value['printtime'] > 0)
  2215. {
  2216. $info_list[$key]['printtime'] = date("Y-m-d H:i:s",$value['printtime']);
  2217. }
  2218. else
  2219. {
  2220. $info_list[$key]['printtime'] = '未打印';
  2221. }
  2222. }
  2223. $total = $this->whlabelbarcodeprint->find_count($where);
  2224. $pagenum = ceil($total/$perpage);
  2225. $over = $total-($start+$perpage);
  2226. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  2227. echo json_encode($rows);exit;
  2228. }
  2229. if(isset($_SESSION['api']))
  2230. {
  2231. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  2232. $this->data['warehouse'] = $warehouse;
  2233. }
  2234. $this->_Template('systemprint_barcode',$this->data);
  2235. }
  2236. public function _barcodedc()
  2237. {
  2238. if(isset($_GET['excel']))
  2239. {
  2240. $warehouse = $this->input->post('warehouse',true);
  2241. $sku = $this->input->post('sku ',true);
  2242. $title = $this->input->post('title',true);
  2243. $print = $this->input->post('print ',true);
  2244. $ktime = $this->input->post('timetk',true);
  2245. $jtime = $this->input->post('timetj',true);
  2246. $ktime = strtotime($ktime);
  2247. $jtime = strtotime($jtime);
  2248. $where = "time > '$timetk' and time < '$timetj'";
  2249. if($warehouse)
  2250. {
  2251. $where .= " and warehouse = '$warehouse'";
  2252. }
  2253. if($sku)
  2254. {
  2255. $where .= " and sku like '%$sku%'";
  2256. }
  2257. if($title)
  2258. {
  2259. $where .= " and title like '%$title%'";
  2260. }
  2261. if($print)
  2262. {
  2263. $where .= " and print = '$print'";
  2264. }
  2265. $order_str = "time desc";
  2266. if(empty($page))
  2267. {
  2268. $start = 0;
  2269. $perpage = 1;
  2270. }
  2271. else
  2272. {
  2273. $start = ($page - 1)*$perpage;
  2274. }
  2275. $info_list = $this->whlabelbarcodeprint->find_all($where,'label,sku,title',$order_str);
  2276. $title = '标签-'.date('Y-m-d H-i-s',time());
  2277. $titlename = "<table border=1>
  2278. <tr align='center'>
  2279. <td>条码号</td>
  2280. <td>SKU</td>
  2281. <td>产品名称</td>
  2282. </tr>
  2283. </table>";
  2284. $filename = $title.".xls";
  2285. $tail = "";
  2286. $this->excel->get_fz2($info_list,$titlename,$filename,$tail);
  2287. }
  2288. }
  2289. public function _barcodedr()
  2290. {
  2291. $dir = '/data/excel/'.date('Ymd',time()).'/';
  2292. $config['upload_path'] = '.'.$dir ;
  2293. $config['file_name'] = date('Ymd_His_',time()).rand(1000,9999);
  2294. $config['allowed_types'] = 'xls|xlsx|csv';
  2295. $config['max_size'] = 10240;
  2296. $this->load->library('upload', $config);
  2297. $this->upload->initialize($config);
  2298. if ($this->upload->do_upload('userfile'))
  2299. {
  2300. $full_path = $dir.$this->upload->data('file_name');
  2301. $fileName = '.' . $full_path;
  2302. if (!file_exists($fileName))
  2303. {
  2304. echo json_encode(array('msg'=>"上传失败,请重试",'success'=>false));exit;
  2305. }
  2306. else
  2307. {
  2308. libxml_use_internal_errors(true);
  2309. require_once "./data/excel/PHPExcel/IOFactory.php";
  2310. $phpExcel = PHPExcel_IOFactory::load($fileName);// 载入当前文件
  2311. $phpExcel->setActiveSheetIndex(0);// 设置为默认表
  2312. $sheetCount = $phpExcel->getSheetCount();// 获取表格数量
  2313. $row = $phpExcel->getActiveSheet()->getHighestRow();// 获取行数
  2314. $column = $phpExcel->getActiveSheet()->getHighestColumn();// 获取列数
  2315. ++$column;//如果列数大于26行
  2316. $list = array();
  2317. for ($i = 2; $i <= $row; $i++) // 行数循环
  2318. {
  2319. $data = array();
  2320. for ($c = 'A'; $c != $column; $c++) // 列数循环
  2321. {
  2322. $data[] = $phpExcel->getActiveSheet()->getCell($c . $i)->getValue();
  2323. }
  2324. $list[] = $data;
  2325. }
  2326. }
  2327. $i = 0;$j = 0;$ed = array();
  2328. foreach ($list as $key=>$value)
  2329. {
  2330. $time = time();
  2331. if($value['0'] == "")
  2332. {
  2333. continue;
  2334. }
  2335. $label = $value['0'];
  2336. $sku = $value['1'];
  2337. $title = $value['2'];
  2338. $num = $value['3'];
  2339. $d = $this->whlabelbarcode->get_skulabel($sku,$label);
  2340. if(!$d)//如果没有这个SKU
  2341. {
  2342. $ed[] = array($sku.'-库存中不存在此SKU');
  2343. $j++;
  2344. continue;
  2345. }
  2346. if($num < 1)
  2347. {
  2348. $ed[] = array($sku.'-数量错误!');
  2349. $j++;
  2350. continue;
  2351. }
  2352. unset($d['id']);
  2353. $d['time'] = $time;
  2354. $d['num'] = $num;
  2355. $this->whlabelbarcodeprint->insert($d);
  2356. }
  2357. if($j > 0)
  2358. {
  2359. $tt = date('Ymd',time());
  2360. $title = '库存导入错误信息-'.$tt;
  2361. $titlename = "<table border=1><tr><td>错误详情</td></tr></table>";
  2362. $tail = "\n";
  2363. $filename = $title.".xls";
  2364. $ecl = $this->excel->get_fz3($ed,$titlename,$filename,$tail);
  2365. $dir = '/data/excel/'.$time.'/';
  2366. $file_name = 'error_'.$time.rand(1000,9999);
  2367. if(!is_dir('.'.$dir))mkdir('.'.$dir,0777);
  2368. $myfile = fopen(".".$dir.$file_name.".xls", "w") or die();
  2369. fwrite($myfile,$ecl);
  2370. fclose($myfile);
  2371. $error = $dir.$file_name.'.xls';
  2372. echo json_encode(array('msg'=>'导入成功,'.$j.'条异常,','error'=>$error,'success'=>true));exit;
  2373. }
  2374. else
  2375. {
  2376. echo json_encode(array('msg'=>'导入成功!','error'=>1,'success'=>true));exit;
  2377. }
  2378. }
  2379. }
  2380. public function _yswaybill()
  2381. {
  2382. $data = $this->yswaybill->find_all("waybill = ''");
  2383. foreach ($data as $v)
  2384. {
  2385. $type = $v['type'];
  2386. $number = $v['number'];
  2387. $express = $v['express'];
  2388. $fullorder = $this->$type->get_number($number);
  2389. $fullorder = $this->_text($fullorder);
  2390. $barcode = $this->$express->get_hqwaybill($number);
  2391. if(!isset($barcode['x']))
  2392. {
  2393. continue;
  2394. }
  2395. if($barcode['x'] == 1)
  2396. {
  2397. if($barcode['ys'] != 1)
  2398. {
  2399. $this->db->trans_begin();
  2400. $this->$type->save(array('waybill'=>$barcode['waybill']),$fullorder['id']);
  2401. $this->yswaybill->save(array('waybill'=>$barcode['waybill'],'time'=>time()),$v['id']);
  2402. if ($this->db->trans_status() === TRUE)
  2403. {
  2404. $this->db->trans_commit();
  2405. }
  2406. else
  2407. {
  2408. $this->db->trans_rollback();
  2409. }
  2410. }
  2411. }
  2412. else
  2413. {
  2414. $this->yswaybill->save(array('cw'=>$barcode['Description'],'time'=>time()),$v['id']);
  2415. }
  2416. }
  2417. echo 1;
  2418. }
  2419. }