Systemprint.php 89 KB

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