Systemfout.php 124 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. header("Access-Control-Allow-Origin: *");
  3. class Systemfout 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_fullordertt','fullordertt');
  13. $this->load->_model('Model_fullorderamz','fullorderamz');
  14. $this->load->_model('Model_fullordersmt','fullordersmt');
  15. $this->load->_model('Model_outbound','outbound');
  16. $this->load->_model('Model_express','express');
  17. $this->load->_model('Model_shop','shop');
  18. $this->load->_model('Model_typeclass','typeclass');
  19. $this->load->_model('Model_country','country');
  20. $this->load->_model('Model_kdniao','kdniao');
  21. $this->load->_model('Model_notice','notice');
  22. $this->load->_model('Model_dhl','dhl');
  23. $this->load->_model('Model_dhlhz','dhlhz');
  24. $this->load->_model('Model_usps','usps');
  25. $this->load->_model('Model_fedex','fedex');
  26. $this->load->_model('Model_fedex_cby','fedex_cby');
  27. $this->load->_model('Model_ups','ups');
  28. $this->load->_model('Model_ali','ali');
  29. $this->load->_model('Model_dpd','dpd');
  30. $this->load->_model('Model_shop','shop');
  31. $this->load->_model('Model_user','user');
  32. $this->load->_model('Model_whlabel','whlabel');
  33. $this->load->_model('Model_specialstock','specialstock');
  34. $this->load->_model('Model_ck','ck');
  35. $this->load->_model('Model_whlabellabel','whlabellabel');
  36. $this->load->_model('Model_apiyy','apiyy');
  37. $this->load->helper('url');
  38. $this->load->_model('Model_whlabel_fc','whlabel_fc');
  39. $this->load->_model('Model_systemtransfer','systemtransfer');
  40. $this->load->_model('Model_classid','classid');
  41. $this->load->_model('Model_allocation','allocation');
  42. $this->load->_model('Model_fullorderxw','fullorderxw');
  43. $this->load->_model('Model_fullorderpaypal','fullorderpaypal');
  44. $this->load->_model("Model_logic_ding","logic_ding");
  45. $this->load->_model("Model_fedexv1",'fedexv1');
  46. $this->load->_model("Model_zzquque_u9","zzquque_u9");
  47. $this->load->_model("Model_customsdeclaration","customsdeclaration");
  48. $this->load->_model("Model_check","check");
  49. $this->load->_model("Model_logic_express","logic_express");
  50. $this->load->_model('Model_outerrors','outerrors');
  51. $this->load->_model("Model_logic_u9tools","logic_u9tools");
  52. }
  53. //定义方法的调用规则 获取URI第二段值
  54. public function _remap($arg,$arg_array)
  55. {
  56. if($arg == 'fedexhz')
  57. {
  58. $this->_fedexhz();
  59. }
  60. else if($arg == 'fout')
  61. {
  62. $this->_fout($arg_array);
  63. }
  64. else if($arg == 'fouthb')//合并出库的
  65. {
  66. $this->_fouthb($arg_array);
  67. }
  68. else if($arg == 'excel')
  69. {
  70. $this->_excel($arg_array);
  71. }
  72. else if($arg == 'cpexcel')
  73. {
  74. $this->_cpexcel($arg_array);
  75. }
  76. else if($arg == 'orderyz')
  77. {
  78. $this->_orderyz();
  79. }
  80. else if($arg == 'hwyz')
  81. {
  82. $this->_hwyz();
  83. }
  84. else if($arg == 'outnumber')
  85. {
  86. $this->_outnumber();
  87. }
  88. else if($arg == 'hb')
  89. {
  90. $this->_hb();
  91. }
  92. else if($arg == 'indexmc'){
  93. $this->_indexmc();
  94. }
  95. else
  96. {
  97. $this->_index();
  98. }
  99. }
  100. public function _index()
  101. {
  102. $post = $this->input->post(NULL, TRUE);
  103. $xw = '';
  104. if(isset($_SESSION['api']))
  105. {
  106. $user = $this->user->get_api($_SESSION['api']);
  107. $usp = $user;
  108. $fgshop = "";$sid = "";$wid="";$wtype="";
  109. $usersp = explode('|',trim($user['shop'],'|'));
  110. $userwh = explode('|',trim($user['warehouse'],'|'));
  111. foreach ($usersp as $value)
  112. {
  113. $fgshop .= " shop = ".$value." or";
  114. $sid .= " id = ".$value." or";
  115. }
  116. foreach ($userwh as $value)
  117. {
  118. $wid .= " id = ".$value." or";
  119. $wtype .= " type = ".$value." or";
  120. }
  121. if($user['userid'] == 'xw')
  122. {
  123. $xw = 1;
  124. }
  125. }
  126. if(isset($post['page']))
  127. {
  128. $page = $this->input->post('page',true);
  129. $perpage = $this->input->post('perpage',true);
  130. $timetk = $this->input->post('timetk',true);
  131. $timetj = $this->input->post('timetj',true);
  132. $shop = $this->input->post('shop',true);
  133. $source = $this->input->post('source',true);
  134. $orderinfo = $this->input->post('orderinfo',true);
  135. $number = $this->input->post('number',true);
  136. $library = $this->input->post('library',true);
  137. $waybill = $this->input->post('waybill',true);
  138. $express = $this->input->post('express',true);
  139. $type = $this->input->post('type',true);
  140. $lowe = $this->input->post('lowe',true);
  141. $so = $this->input->post('so',true);
  142. $is_jiaji = $this->input->post('is_jiaji',true);
  143. $librarytime = $this->input->post('librarytime',true);
  144. $timetk = strtotime($timetk);
  145. $timetj = strtotime($timetj);
  146. $cxtime = 'id';
  147. $where = "library!=3 and libraryconfirm=2 and print = 3 and (".rtrim($wtype,'or').")";
  148. if($timetk && $timetj && $library == 1)
  149. {
  150. $tmp_timetj = time();
  151. //$cxtime = 'reviewtime';
  152. $where .= " and printtime > '$timetk - 180*24*3600' and printtime < '$tmp_timetj '";
  153. $where .= " and state != 217";
  154. }
  155. else if($timetk && $timetj && $library == 2)
  156. {
  157. $cxtime = 'librarytime';
  158. $where .= " and librarytime > '$timetk' and librarytime < '$timetj'";
  159. }
  160. if($shop)
  161. {
  162. $where .= " and shop = '$shop'";
  163. }
  164. if($number)
  165. {
  166. $where .= " and number = '$number'";
  167. }
  168. if($library)
  169. {
  170. $where .= " and library = '$library'";
  171. }
  172. if($waybill)
  173. {
  174. $where .= " and waybill = '$waybill'";
  175. }
  176. if($express)
  177. {
  178. $where .= " and express = '$express'";
  179. }
  180. if($orderinfo)
  181. {
  182. $where .= " and orderinfo = '$orderinfo'";
  183. }
  184. if($type)
  185. {
  186. $where .= " and type = '$type'";
  187. }
  188. if($lowe)
  189. {
  190. $where .= " and shipremarks like '%$lowe%'";
  191. }
  192. if($so)
  193. {
  194. $where .= " and shipremarks like '%$so%'";
  195. }
  196. if($is_jiaji >-1){
  197. $where .= " and is_jiaji = ".$is_jiaji." ";
  198. }
  199. //数据排序
  200. $order_str = $cxtime." desc";
  201. if(empty($page))
  202. {
  203. $start = 0;
  204. $perpage = 1;
  205. }
  206. else
  207. {
  208. $start = ($page - 1)*$perpage;
  209. }
  210. //取得信息列表
  211. $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks',$order_str,$start,$perpage);
  212. //格式化数据
  213. foreach ($info_list as $key=>$value)
  214. {
  215. $shop = $this->shop->read($value['shop']);
  216. $info_list[$key]['shop'] = $shop['shopname'];
  217. if($value['waybill'] == '0')
  218. {
  219. $info_list[$key]['waybill'] = "";
  220. }
  221. $express = $this->express->read($value['express']);
  222. $info_list[$key]['express'] = $express['servicename'];
  223. $warehouse = $this->warehouse->read($value['type']);
  224. $info_list[$key]['type'] = $warehouse['title'];
  225. if($value['print'] == 1)
  226. {
  227. $info_list[$key]['print'] = '不可打印';
  228. }
  229. else if($value['print'] == 2)
  230. {
  231. $info_list[$key]['print'] = '未打印';
  232. }
  233. else if($value['print'] == 3)
  234. {
  235. $info_list[$key]['print'] = '已打印';
  236. }
  237. if($value['library'] == 1)
  238. {
  239. $info_list[$key]['library'] = '<em class="c">未出库</em>';
  240. }
  241. else if($value['library'] == 2)
  242. {
  243. $info_list[$key]['library'] = '<em class="c">已出库</em>';
  244. }
  245. else if($value['library'] == 3)
  246. {
  247. $info_list[$key]['library'] = '<em class="c">已退库</em>';
  248. }
  249. if($value['librarytime'] == '0')
  250. {
  251. $info_list[$key]['librarytime'] = '<em class="t"></em>';
  252. }
  253. else
  254. {
  255. $info_list[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i',$value['librarytime']).'</em>';
  256. }
  257. $info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  258. }
  259. $info_listtt = $this->fullordertt->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks',$order_str,$start,$perpage);
  260. //格式化数据
  261. foreach ($info_listtt as $key=>$value)
  262. {
  263. $shop = $this->shop->read($value['shop']);
  264. $info_listtt[$key]['shop'] = $shop['shopname'];
  265. if($value['waybill'] == '0')
  266. {
  267. $info_listtt[$key]['waybill'] = "";
  268. }
  269. $express = $this->express->read($value['express']);
  270. $info_listtt[$key]['express'] = $express['servicename'];
  271. $warehouse = $this->warehouse->read($value['type']);
  272. $info_listtt[$key]['type'] = $warehouse['title'];
  273. if($value['print'] == 1)
  274. {
  275. $info_listtt[$key]['print'] = '不可打印';
  276. }
  277. else if($value['print'] == 2)
  278. {
  279. $info_listtt[$key]['print'] = '未打印';
  280. }
  281. else if($value['print'] == 3)
  282. {
  283. $info_listtt[$key]['print'] = '已打印';
  284. }
  285. if($value['library'] == 1)
  286. {
  287. $info_listtt[$key]['library'] = '<em class="c">未出库</em>';
  288. }
  289. else if($value['library'] == 2)
  290. {
  291. $info_listtt[$key]['library'] = '<em class="c">已出库</em>';
  292. }
  293. else if($value['library'] == 3)
  294. {
  295. $info_listtt[$key]['library'] = '<em class="c">已退库</em>';
  296. }
  297. if($value['librarytime'] == '0')
  298. {
  299. $info_listtt[$key]['librarytime'] = '<em class="t"></em>';
  300. }
  301. else
  302. {
  303. $info_listtt[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  304. }
  305. }
  306. $info_listamz = $this->fullorderamz->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks',$order_str,$start,$perpage);
  307. //格式化数据
  308. foreach ($info_listamz as $key=>$value)
  309. {
  310. $shop = $this->shop->read($value['shop']);
  311. $info_listamz[$key]['shop'] = $shop['shopname'];
  312. if($value['waybill'] == '0')
  313. {
  314. $info_listamz[$key]['waybill'] = "";
  315. }
  316. $express = $this->express->read($value['express']);
  317. $info_listamz[$key]['express'] = $express['servicename'];
  318. $warehouse = $this->warehouse->read($value['type']);
  319. $info_listamz[$key]['type'] = $warehouse['title'];
  320. if($value['print'] == 1)
  321. {
  322. $info_listamz[$key]['print'] = '不可打印';
  323. }
  324. else if($value['print'] == 2)
  325. {
  326. $info_listamz[$key]['print'] = '未打印';
  327. }
  328. else if($value['print'] == 3)
  329. {
  330. $info_listamz[$key]['print'] = '已打印';
  331. }
  332. if($value['library'] == 1)
  333. {
  334. $info_listamz[$key]['library'] = '<em class="c">未出库</em>';
  335. }
  336. else if($value['library'] == 2)
  337. {
  338. $info_listamz[$key]['library'] = '<em class="c">已出库</em>';
  339. }
  340. else if($value['library'] == 3)
  341. {
  342. $info_listamz[$key]['library'] = '<em class="c">已退库</em>';
  343. }
  344. if($value['librarytime'] == '0')
  345. {
  346. $info_listamz[$key]['librarytime'] = '<em class="t"></em>';
  347. }
  348. else
  349. {
  350. $info_listamz[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  351. }
  352. }
  353. $info_listxw = $this->fullorderxw->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks',$order_str,$start,$perpage);
  354. //格式化数据
  355. foreach ($info_listxw as $key=>$value)
  356. {
  357. $shop = $this->shop->read($value['shop']);
  358. $info_listxw[$key]['shop'] = $shop['shopname'];
  359. if($value['waybill'] == '0')
  360. {
  361. $info_listxw[$key]['waybill'] = "";
  362. }
  363. $express = $this->express->read($value['express']);
  364. $info_listxw[$key]['express'] = $express['servicename'];
  365. $warehouse = $this->warehouse->read($value['type']);
  366. $info_listxw[$key]['type'] = $warehouse['title'];
  367. if($value['print'] == 1)
  368. {
  369. $info_listxw[$key]['print'] = '不可打印';
  370. }
  371. else if($value['print'] == 2)
  372. {
  373. $info_listxw[$key]['print'] = '未打印';
  374. }
  375. else if($value['print'] == 3)
  376. {
  377. $info_listxw[$key]['print'] = '已打印';
  378. }
  379. if($value['library'] == 1)
  380. {
  381. $info_listxw[$key]['library'] = '<em class="c">未出库</em>';
  382. }
  383. else if($value['library'] == 2)
  384. {
  385. $info_listxw[$key]['library'] = '<em class="c">已出库</em>';
  386. }
  387. else if($value['library'] == 3)
  388. {
  389. $info_listxw[$key]['library'] = '<em class="c">已退库</em>';
  390. }
  391. if($value['librarytime'] == '0')
  392. {
  393. $info_listxw[$key]['librarytime'] = '<em class="t"></em>';
  394. }
  395. else
  396. {
  397. $info_listxw[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  398. }
  399. }
  400. $info_listsmt = $this->fullordersmt->find_all($where." and mergeid = '0'",'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks',$order_str,$start,$perpage);
  401. //格式化数据
  402. foreach ($info_listsmt as $key=>$value)
  403. {
  404. $shop = $this->shop->read($value['shop']);
  405. $info_listsmt[$key]['shop'] = $shop['shopname'];
  406. if($value['waybill'] == '0')
  407. {
  408. $info_listsmt[$key]['waybill'] = "";
  409. }
  410. $express = $this->express->read($value['express']);
  411. $info_listsmt[$key]['express'] = $express['servicename'];
  412. $warehouse = $this->warehouse->read($value['type']);
  413. $info_listsmt[$key]['type'] = $warehouse['title'];
  414. if($value['print'] == 1)
  415. {
  416. $info_listsmt[$key]['print'] = '不可打印';
  417. }
  418. else if($value['print'] == 2)
  419. {
  420. $info_listsmt[$key]['print'] = '未打印';
  421. }
  422. else if($value['print'] == 3)
  423. {
  424. $info_listsmt[$key]['print'] = '已打印';
  425. }
  426. if($value['library'] == 1)
  427. {
  428. $info_listsmt[$key]['library'] = '<em class="c">未出库</em>';
  429. }
  430. else if($value['library'] == 2)
  431. {
  432. $info_listsmt[$key]['library'] = '<em class="c">已出库</em>';
  433. }
  434. else if($value['library'] == 3)
  435. {
  436. $info_listsmt[$key]['library'] = '<em class="c">已退库</em>';
  437. }
  438. if($value['librarytime'] == '0')
  439. {
  440. $info_listsmt[$key]['librarytime'] = '<em class="t"></em>';
  441. }
  442. else
  443. {
  444. $info_listsmt[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  445. }
  446. }
  447. $total = $this->fullorder->find_count($where);
  448. $total += $this->fullordertt->find_count($where);
  449. $total += $this->fullorderamz->find_count($where);
  450. $total += $this->fullorderxw->find_count($where);
  451. $total += $this->fullordersmt->find_count($where);
  452. $pagenum = ceil($total/$perpage);
  453. $over = $total-($start+$perpage);
  454. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>(array_merge($info_list,$info_listamz,$info_listtt,$info_listxw,$info_listsmt)));
  455. echo json_encode($rows);exit;
  456. }
  457. if(isset($_SESSION['api']))
  458. {
  459. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  460. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  461. $this->data['wlshop'] = $wlshop;
  462. $this->data['warehouse'] = $warehouse;
  463. }
  464. $this->data['xw'] = $xw;
  465. $this->_Template('systemfout',$this->data);
  466. }
  467. public function _indexmc()
  468. {
  469. $post = $this->input->post(NULL, TRUE);
  470. $xw = '';
  471. if(isset($_SESSION['api']))
  472. {
  473. $user = $this->user->get_api($_SESSION['api']);
  474. $usp = $user;
  475. $fgshop = "";$sid = "";$wid="";$wtype="";
  476. $usersp = explode('|',trim($user['shop'],'|'));
  477. $userwh = explode('|',trim($user['warehouse'],'|'));
  478. foreach ($usersp as $value)
  479. {
  480. $fgshop .= " shop = ".$value." or";
  481. $sid .= " id = ".$value." or";
  482. }
  483. foreach ($userwh as $value)
  484. {
  485. $wid .= " id = ".$value." or";
  486. $wtype .= " type = ".$value." or";
  487. }
  488. if($user['userid'] == 'xw')
  489. {
  490. $xw = 1;
  491. }
  492. }
  493. if(isset($_SESSION['api']))
  494. {
  495. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  496. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  497. $this->data['wlshop'] = $wlshop;
  498. $this->data['warehouse'] = $warehouse;
  499. }else{
  500. //未登录不允许访问
  501. header("location:/");
  502. exit;
  503. }
  504. $this->data['xw'] = $xw;
  505. $this->_Template('systemfoutmc',$this->data);
  506. }
  507. public function _fout()
  508. {
  509. $post = $this->input->post(NULL, TRUE);
  510. if(isset($post['order']))
  511. {
  512. $time = time();
  513. $order = $this->input->post('order',true);
  514. $weight = $this->input->post('weight',true);
  515. if(!isset($weight))//测试没问题后可以删
  516. {
  517. $weight = '';
  518. }
  519. if(substr($order,0,3) == '788' && substr($order,-4,4) == '0430')//Fedex联邦
  520. {
  521. $order = substr($order,0,12);
  522. }
  523. if(strlen($order) == '34')//联邦杭州超长运单截取
  524. {
  525. $str = substr($order, 0,3);
  526. if($str == "420"){
  527. $order = substr($order,12);
  528. }else{
  529. $order = substr($order,22,12);
  530. }
  531. }
  532. if(!$order)
  533. {
  534. echo json_encode(array('msg'=>'出库信息不能为空!','success'=>false));exit;
  535. }
  536. if(strlen($order) == 30)
  537. {
  538. $order = substr($order, 8);
  539. }
  540. $fullorder_name = 'fullorder';$outtype = 1;
  541. $y = $this->fullorder->get_waybill($order);
  542. // $this->logic_ding->sendToDing("排查五次数据的原有".$order);
  543. // $this->logic_ding->sendToDing("排查五次数据的订单".json_encode($y));
  544. if(!$y)
  545. {
  546. $y = $this->fullorder->get_number($order);
  547. $outtype = 2;
  548. // $this->logic_ding->sendToDing("排查五次数据的原有".$order);
  549. // $this->logic_ding->sendToDing("排查五次数据的订单".json_encode($y));
  550. if(!$y)
  551. {
  552. $fullorder_name = 'fullordersmt';$outtype = 1;
  553. $y = $this->fullordersmt->get_waybill($order);
  554. if(!$y)
  555. {
  556. $y = $this->fullordersmt->get_number($order);
  557. $outtype = 2;
  558. if(!$y)
  559. {
  560. $fullorder_name = 'fullordertt';$outtype = 1;
  561. $y = $this->fullordertt->get_waybill($order);
  562. if(!$y)
  563. {
  564. $y = $this->fullordertt->get_number($order);
  565. $outtype = 2;
  566. if(!$y)
  567. {
  568. $fullorder_name = 'fullorderamz';$outtype = 1;
  569. $y = $this->fullorderamz->get_waybill($order);
  570. if(!$y)
  571. {
  572. $y = $this->fullorderamz->get_number($order);
  573. $outtype = 2;
  574. if(!$y){
  575. $fullorder_name = 'fullorderxw';$outtype = 1;
  576. $y = $this->fullorderxw->get_waybill($order);
  577. if(!$y)
  578. {
  579. $y = $this->fullorderxw->get_number($order);
  580. $outtype = 2;
  581. if(!$y)
  582. {
  583. $this->logic_ding->sendToDing("排查五次数据的原有".$order);
  584. echo json_encode(array('msg'=>'无此数据','success'=>false));exit;
  585. }
  586. }
  587. }
  588. }
  589. }
  590. }
  591. }
  592. }
  593. }
  594. }
  595. if($y['mergeid'] == '1')
  596. {
  597. $y = $this->$fullorder_name->read($y['merge']);
  598. }
  599. //云尚-FedEx普货专线 如果出库时打印的快递面单超过6天,不允许出库
  600. // if($y['express'] == 75 ){
  601. // $printtime = $y['printtime'];
  602. // $set_time = 24 * 60 * 60 * 6;
  603. // $time = time();
  604. // if(($time - $set_time) > $printtime){
  605. // //允许出库状态
  606. // if($y['libraryconfirm'] == 2){
  607. // echo json_encode(array('msg'=>"该单超时,请重新打印后再出库。".$y['number'],'success'=>false));exit;
  608. // }else{
  609. // echo json_encode(array('msg'=>"该单超时且禁止出库,请联系梦体做后续处理!".$y['number'],'success'=>false));exit;
  610. // }
  611. // }
  612. // }
  613. // 66 云途(欧洲) 67 云途(欧洲)-带保险 如果是欧洲云途 需要检擦出库时间是否超过15天
  614. if(in_array($y['express'],[66,67,82])){
  615. if((time() - $y['printtime']) >= (14*24*3600)){
  616. echo json_encode(array('msg'=>'运单超时!请联系梦体处理!','success'=>false));exit;
  617. }
  618. }
  619. // 78 dpd英国 和 79dpd欧盟
  620. if(in_array($y['express'],[78,79,84])){
  621. $r = $this->check->checkOverdue($y['name'],$y['number'],$y['address']);
  622. if(!$r){
  623. echo json_encode(array('msg'=>'同一个客户3天内发货超过2包,不可出库!请联系店员做申报信息修改!'.$y['name']."-".$y['number']."-".$r*1,'success'=>false));exit;
  624. }
  625. }
  626. $express = $this->express->read($y['express']);
  627. if($y['state'] == 216 && $fullorder_name == 'fullordersmt')
  628. {
  629. $y['librarynot'] = '客户已取消!';
  630. }
  631. if($y['print'] != 3 || $y['libraryconfirm'] == 1 || $y['state'] == 214 || $y['state'] == 217 || $y['state'] == 283 || $y['state'] == 206 || $y['state'] == 205 || $y['state'] == 204 || $y['state'] == 210 || $y['state'] == 211 || $y['state'] == 212 || ($y['state'] == 216 && $fullorder_name == 'fullordersmt'))//独立站216先关了
  632. {
  633. echo json_encode(array('msg'=>'禁止出库!'.$y['librarynot'],'success'=>false));exit;
  634. }
  635. if($y['library'] > 1)
  636. {
  637. echo json_encode(array('msg'=>'此数据 '.date('Y-m-d H:i:s',$y['librarytime']).' 已操作','success'=>false));exit;
  638. }
  639. if($express['out'] != 3)
  640. {
  641. if($express['out'] != $outtype)
  642. {
  643. $smlx = ($express['out']=='1')?'运单':'发货单';
  644. echo json_encode(array('msg'=>'扫描类型错误!此单需要扫描'.$smlx,'success'=>false));exit;
  645. }
  646. }
  647. if($y['type'] != 7 && $y['waybill'] != '' && $y['printtype'] == '1')
  648. {
  649. // $y['waybill'] = trim($y['waybill'],' ');
  650. // if(strlen($y['waybill']) == 12 && $y['express'] != 24 && $y['express'] != 31 && $y['express'] != 38 && $y['express'] != 41 && $y['express'] != 6 && $y['express'] != 43 && $y['express'] != 48 && $y['express'] != 50 && $y['express'] != 51 && $y['express'] != 63 && $y['express'] != 70 && $y['express'] != 71 && $y['express'] != 73 && $y['express'] != 74 && $y['express'] != 75 && $y['express'] != 78 && $y['express'] != 79 && $y['express'] != 83 && $y['express'] != 85)
  651. // {
  652. // echo json_encode(array('msg'=>'出库物流和系统不匹配,请联系梦体解决'.$y['express'].'-1','success'=>false));exit;
  653. // }
  654. // else if(strlen($y['waybill']) == 10 && $y['express'] != 1 && $y['express'] != 37 && $y['express'] != 49 && $y['express'] != 42 && $y['express'] != 69 && $y['express'] != 78 && $y['express'] != 79 && $y['express'] != 83 && $y['express'] != 85)
  655. // {
  656. // echo json_encode(array('msg'=>'出库物流和系统不匹配,请联系梦体解决'.$y['express'].'-2','success'=>false));exit;
  657. // }
  658. // else if(strlen($y['waybill']) == 18 && $y['express'] != 3 && $y['express'] != 66 && $y['express'] != 67 && $y['express'] != 72 && $y['express'] != 2 && $y['express'] != 82 && $y['express'] != 83 && $y['express'] != 85)
  659. // {
  660. // echo json_encode(array('msg'=>'出库物流和系统不匹配,请联系梦体解决'.$y['express'].'-3','success'=>false));exit;
  661. // }
  662. // else if(strlen($y['waybill']) == 16 && $y['express'] != 76 && $y['express'] != 77 && $y['express'] != 80 && $y['express'] != 83 && $y['express'] != 85)
  663. // {
  664. // echo json_encode(array('msg'=>'出库物流和系统不匹配,请联系梦体解决'.$y['express'].'-4','success'=>false));exit;
  665. // }
  666. $r = $this->logic_express->ydCheckById($y['waybill'],$y['express']);
  667. if(!$r){
  668. echo json_encode(array('msg'=>'出库物流和系统不匹配,请联系梦体解决'.$y['express'],'success'=>false));exit;
  669. }
  670. }
  671. if(stripos($weight,',') !== false){
  672. $tmp_arr = explode(",",$weight);
  673. $weight = end($tmp_arr);
  674. $numweight = (float)$weight;
  675. $weight = $numweight."kg";
  676. }
  677. $numweight = str_replace('kg','',$weight);
  678. // if(($y['express'] == '24' || $y['express'] == '3' || $y['express'] == '28' || $y['express'] == '33' || $y['express'] == '42') && $y['type'] != 6)//杭州除外
  679. // {
  680. // if($weight == '' || $numweight < '0.1' || !is_numeric($numweight))
  681. // {
  682. // echo json_encode(array('msg'=>'此单需要称重!','success'=>false));exit;
  683. // }
  684. // $yzweight = explode('.',$numweight);
  685. // if($yzweight[0] == '')
  686. // {
  687. // echo json_encode(array('msg'=>'重量错误,请重新称重!','success'=>false));exit;
  688. // }
  689. // if($numweight < ($y['jweight']/1000))
  690. // {
  691. // echo json_encode(array('msg'=>'重量小于净重,请重新称重!','success'=>false));exit;
  692. // }
  693. // if($numweight -($y['jweight']/1000) > 0.9 && $y['number'] != 'QQS-30401-002')
  694. // {
  695. // echo json_encode(array('msg'=>'称重重量和净重相差过大,请找成会或梦体处理!','success'=>false));exit;
  696. // }
  697. // if($numweight > '0.98' && $y['express'] == '3')
  698. // {
  699. // echo json_encode(array('msg'=>'UPS大于0.98公斤需要拆包!','success'=>false));exit;
  700. // }
  701. // if($numweight > '2' && $y['express'] == '37')
  702. // {
  703. // echo json_encode(array('msg'=>'杭州DHL大于2公斤需要联系店员!','success'=>false));exit;
  704. // }
  705. // if($numweight >= '10' && ($y['express'] == '24' || $y['express'] == '31'))
  706. // {
  707. // echo json_encode(array('msg'=>'联邦不能大于10公斤!','success'=>false));exit;
  708. // }
  709. // }
  710. //根据要求 USPS-USA 2 FEDEX-US2 63 USPS-US2 64 这三个快递方式除外的所有快递都需要称重再发货 或者说是【国内发货】的都需要称重
  711. //还有翔文仓库的 不执行
  712. //源代码是
  713. //所有快递必须称重
  714. //所有快递必须称重 翔文除外
  715. //$this->logic_ding->sendToDing("检测订单".$y['number']."称重".$numweight."快递公司".$y['express']."-".$weight."[".$numweight."]");
  716. if(!in_array($y['express'],[2,8,39,43,44,45,47,48,49,55,61,63,64,65,74,81,83,85])){
  717. if($weight == '' || $numweight < '0.1' || !is_numeric($numweight))
  718. {
  719. echo json_encode(array('msg'=>'此单需要称重!','success'=>false));exit;
  720. }
  721. $yzweight = explode('.',$numweight);
  722. if($yzweight[0] == '')
  723. {
  724. echo json_encode(array('msg'=>'重量错误,请重新称重!','success'=>false));exit;
  725. }
  726. if(empty($numweight)){
  727. echo json_encode(array('msg'=>'此单需要称重2!','success'=>false));exit;
  728. }
  729. //$this->logic_ding->sendToDing("检测订单---------------------标记需要认证的东西".$y['number']);
  730. }
  731. //$this->logic_ding->sendToDing("检测订单".$y['number']."称重".$numweight."快递公司".$y['express']);
  732. $express_info = $this->express->read($y['express']);
  733. if(empty($express_info)){
  734. echo json_encode(array('msg'=>'该快递信息异常,请联系技术!','success'=>false));exit;
  735. }
  736. $weight_limit = $express_info['weight_limit']*1;
  737. if($weight_limit > 0 && $y['type'] != 5){
  738. $yzweight = explode('.',$numweight);
  739. if($yzweight[0] == '')
  740. {
  741. echo json_encode(array('msg'=>'重量错误,请重新称重!','success'=>false));exit;
  742. }
  743. if($numweight < ($y['jweight']/1000)){
  744. echo json_encode(array('msg'=>'重量小于净重,请重新称重!','success'=>false));exit;
  745. }
  746. //Fedex(杭州),UPS,DHL官方-美国 需要判断实际重量和净重差 其他快递不需要
  747. if(in_array($y['express'],[3,24,42])){
  748. //规定实际重量不允许超过 净重为1kg
  749. if($numweight -($y['jweight']/1000) > 1 )
  750. {
  751. echo json_encode(array('msg'=>'称重重量和净重相差过大,请找成会处理!','success'=>false));exit;
  752. }
  753. }
  754. if($weight_limit < $numweight){
  755. echo json_encode(array('msg'=>$express['servicename'].'大于'.$weight_limit.'公斤需要拆包!','success'=>false));exit;
  756. }
  757. }
  758. if(((time() - $y['printtime']) > (15*24*3600) || $y['printtime'] < 1590211800) && $y['express'] == '24' && $y['type'] != 6)//杭州店铺除外
  759. {
  760. //echo json_encode(array('yd'=>1,'id'=>$y['id'],'express'=>$y['express'],'name'=>$fullorder_name,'success'=>true));exit;
  761. }
  762. if((time() - $y['printtime']) > (6*24*3600) && $y['express'] == '3' && $y['type'] != 6)//杭州店铺除外
  763. {
  764. //echo json_encode(array('yd'=>1,'id'=>$y['id'],'express'=>$y['express'],'name'=>$fullorder_name,'success'=>true));exit;
  765. echo json_encode(array('msg'=>'此运单过期无法出库,请联系成会处理!','success'=>false));exit;
  766. }
  767. if((time() - $y['printtime']) > (7*24*3600) && $y['express'] == '37' && $y['type'] != 6)//杭州店铺除外
  768. {
  769. //echo json_encode(array('yd'=>1,'id'=>$y['id'],'express'=>$y['express'],'name'=>$fullorder_name,'success'=>true));exit;
  770. }
  771. $this->db->trans_begin();
  772. $warehouse = $this->warehouse->read($y['type']);
  773. $bdck = $warehouse['bdck'];
  774. if($warehouse['zd'] == '1')
  775. {
  776. if($warehouse['bdck'] == '')
  777. {
  778. $this->db->trans_rollback();
  779. echo json_encode(array('msg'=>'仓库设置错误!','success'=>false));exit;
  780. }
  781. $wh = $this->_fout_db($y,$warehouse,$bdck);
  782. if($wh['fh'] == 2)
  783. {
  784. $kcyz = $this->ck->get_kc($y['state'],$warehouse,$y['shop'],$y['number'],$y['whlabel'],$y['fpdata']);
  785. if($kcyz['t'] == '0')
  786. {
  787. if($kcyz['fpdata'] != '')
  788. {
  789. $x['whlabel'] = $kcyz['whlabel'];
  790. $x['fpdata'] = $kcyz['fpdata'];
  791. $y['whlabel'] = $x['whlabel'];
  792. $this->$fullorder_name->save($x,$y['id']);
  793. }
  794. }
  795. $wh = $this->_fout_db($y,$warehouse,$bdck);
  796. if($wh['fh'] == 2)
  797. {
  798. $this->db->trans_rollback();
  799. echo json_encode(array('msg'=>'库存占用量与实际出库量不符!','success'=>false));exit;
  800. }
  801. }
  802. foreach ($wh['sj'] as $v)
  803. {
  804. $this->$bdck->save(array('state'=>1,'cktype'=>1,'orderinfo'=>$y['orderinfo'],'waybill'=>$y['waybill'],'outk'=>$time,'time'=>$time),$v['id']);
  805. }
  806. }
  807. /**
  808. if($warehouse['zd'] == '1' && stripos($y['whlabel'],'z|') === false)
  809. {
  810. $whlabel = $this->whlabel->find_all("zd = '".$y['number']."' and warehouse = '".$y['type']."' and (state = '0' or state = '9')");
  811. $cpsl = 0;
  812. $pp = explode('|',trim($y['whlabel'],'|'));
  813. foreach ($pp as $va)
  814. {
  815. $num = explode('-',$va);
  816. $cpsl += $num[1];
  817. }
  818. if(count($whlabel) != $cpsl)
  819. {
  820. echo json_encode(array('msg'=>'库存占用量与实际出库量不符','success'=>false));exit;
  821. }
  822. foreach ($whlabel as $v)
  823. {
  824. $this->whlabel->save(array('state'=>1,'orderinfo'=>$y['orderinfo'],'waybill'=>$y['waybill'],'outk'=>$time,'time'=>$time),$v['id']);
  825. }
  826. }
  827. if($warehouse['zd'] == '1' && stripos($y['whlabel'],'z|') !== false)
  828. {
  829. $wh = $this->specialstock->find_all("zd = '".$y['number']."' and state = '0'");
  830. $cpsl = 0;
  831. $pp = explode('|',trim($y['whlabel'],'|'));
  832. foreach ($pp as $va)
  833. {
  834. $num = explode('-',$va);
  835. if(stripos($num[2],'z') !== false)//如果是特殊库存
  836. {
  837. $cpsl += $num[1];
  838. }
  839. }
  840. if(count($wh) != $cpsl)
  841. {
  842. echo json_encode(array('msg'=>'库存占用量与实际出库量不符','success'=>false));exit;
  843. }
  844. foreach ($wh as $v)
  845. {
  846. if(!$this->specialstock->save(array('state'=>1,'orderinfo'=>$y['orderinfo'],'waybill'=>$y['waybill'],'outk'=>$time,'time'=>$time),$v['id']))
  847. {
  848. echo json_encode(array('msg'=>'出库失败,请重试','success'=>false));exit;
  849. }
  850. }
  851. }
  852. **/
  853. /**
  854. if($y['dbapi'] == 99 && $y['scapi'] == 99)
  855. {
  856. $d = $this->apiyy->get_chd($y);
  857. if($d['Data'][0]['m_isSucess'] != 1)
  858. {
  859. echo json_encode(array('msg'=>'用友出库失败:'.$d['Data'][0]['m_errorMsg'],'success'=>false));exit;
  860. }
  861. }
  862. $systemtransfer = $this->systemtransfer->find_all("number = '".$y['number']."'");
  863. if(isset($systemtransfer[0]))
  864. {
  865. foreach ($systemtransfer as $v)
  866. {
  867. if($v['dbapi'] != 99)
  868. {
  869. echo json_encode(array('msg'=>'此订单货物:'.$v['pm'].'没有成功扫布标入库,无法出库!','success'=>false));exit;
  870. }
  871. }
  872. $y['ts'] = count($systemtransfer);
  873. $d = $this->apiyy->get_chd($y);
  874. if($d['Data'][0]['m_isSucess'] != 1)
  875. {
  876. echo json_encode(array('msg'=>'用友出库失败:'.$d['Data'][0]['m_errorMsg'],'success'=>false));exit;
  877. }
  878. }
  879. **/
  880. $shop = $this->shop->read($y['shop']);
  881. if($express['printcode'] == "DHLUSA" && $y['waybill'] != '')
  882. {
  883. $type = $this->typeclass->read($shop['type']);
  884. $y['shoptype'] = $type['title'];
  885. $y['weight'] = $weight;
  886. $d = $this->dhl->get_data_9610($y);
  887. if($d != 1)
  888. {
  889. $this->db->trans_rollback();
  890. $this->allocation->insert(array('order'=>1,'title'=>$y['number'],'content'=>$d));
  891. echo json_encode(array('msg'=>'9610失败,'.$d,'success'=>false));exit;
  892. }
  893. $this->allocation->insert(array('order'=>9610,'title'=>$y['number']));
  894. }
  895. if($fullorder_name == 'fullordersmt')
  896. {
  897. $stt = ($y['waybill']!='')?209:$y['state'];
  898. $post = array('library'=>2,'state'=>$stt,'librarytime'=>$time,'weight'=>$weight,'dbapi'=>0);
  899. /**
  900. if($this->$fullorder_name->save(array('library'=>2,'state'=>$stt,'librarytime'=>$time,'weight'=>$weight),$y['id']))
  901. {
  902. echo json_encode(array('success'=>true));exit;
  903. }
  904. else
  905. {
  906. echo json_encode(array('msg'=>'出库失败,请重试','success'=>false));exit;
  907. }
  908. **/
  909. }
  910. else if(($fullorder_name == 'fullordertt' || $fullorder_name == 'fullorderxw' || $fullorder_name == 'fullorder' || $fullorder_name = 'fullorderamz') && $y['source'] == 1)
  911. {
  912. /**
  913. if($this->$fullorder_name->save(array('library'=>2,'librarytime'=>$time,'weight'=>$weight),$y['id']))
  914. {
  915. echo json_encode(array('success'=>true));exit;
  916. }
  917. else
  918. {
  919. echo json_encode(array('msg'=>'出库失败,请重试','success'=>false));exit;
  920. }
  921. **/
  922. $post = array('library'=>2,'state'=>216,'librarytime'=>$time,'weight'=>$weight,'dbapi'=>0);
  923. }
  924. else
  925. {
  926. /**
  927. if($this->$fullorder_name->save(array('library'=>2,'librarytime'=>$time,'weight'=>$weight),$y['id']))
  928. {
  929. echo json_encode(array('success'=>true));exit;
  930. }
  931. else
  932. {
  933. echo json_encode(array('msg'=>'出库失败,请重试','success'=>false));exit;
  934. }
  935. **/
  936. $post = array('library'=>2,'librarytime'=>$time,'weight'=>$weight,'dbapi'=>0);
  937. }
  938. /**
  939. if($fullorder_name == 'fullorder')
  940. {
  941. $orderinfo = preg_replace('/^' . preg_quote($y['shop'], '/') . '/', '', $y['orderinfo']);
  942. $post['incrementId'] = $orderinfo;
  943. $post['trackingNumber'] = $y['waybill'];
  944. $ex = $this->express->read($y['express']);
  945. $post['carrier'] = $ex['iscode'];
  946. $url = 'https://www.romandhair.com/applepay/payment/addTrack';
  947. $ch = curl_init();
  948. curl_setopt($ch,CURLOPT_URL,$url);
  949. curl_setopt($ch, CURLOPT_POST, 1);
  950. curl_setopt($ch, CURLOPT_HEADER, 0);
  951. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  952. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  953. curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
  954. curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post));
  955. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  956. curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,1800000);
  957. $res = curl_exec($ch);
  958. curl_close($ch);
  959. $res = json_decode($res,true);
  960. if($res['success'] == 0)
  961. {
  962. $this->fullorderpaypal->insert(array('orderinfo'=>$y['orderinfo'],'waybill'=>$y['waybill'],'time'=>$time,'cw'=>$res['msg']));//失败
  963. }
  964. else
  965. {
  966. $this->fullorderpaypal->insert(array('orderinfo'=>$y['orderinfo'],'waybill'=>$y['waybill'],'time'=>$time,'type'=>1));
  967. }
  968. }
  969. **/
  970. //开始录入执行u9队列的数据
  971. $queue_u9_list = [];
  972. $queue_u9_list[] = [
  973. 'platform'=>$fullorder_name,
  974. 'warehouse'=>$y['type'],
  975. 'type'=>($y['type'] == 5)?11:10, //5代表美仓
  976. 'order_no'=>$y['number'],
  977. 'status'=>0,
  978. 'create_time'=>time(),
  979. 'update_time'=>time(),
  980. ];
  981. //将要执行的队列数据添加进去
  982. foreach($queue_u9_list as $item){
  983. if($item['platform'] != 'fullorderxw'){
  984. // if(($item['warehouse'] != 5) || ($item['warehouse'] != 7) || ($item['warehouse'] != 8) || ($item['warehouse'] != 9) ){
  985. // $this->zzquque_u9->insert($item);
  986. // }
  987. if( !in_array($item['warehouse'],[5,7,8,9]) ){
  988. $this->zzquque_u9->insert($item);
  989. }
  990. }
  991. }
  992. //$this->logic_ding->sendToDing("u9小单队列监听数据".json_encode($queue_u9_list,JSON_UNESCAPED_UNICODE));
  993. if($outtype == 2 && $y['printnumber'] > 1)
  994. {
  995. $p = json_encode($post);
  996. $this->db->trans_rollback();
  997. echo json_encode(array('msg'=>'该单共打印过'.$y['printnumber'].'次,请注意核对当前发货单是否是最新发货单!','outnumber'=>$y['id'],'post'=>$p,'fullorder_name'=>$fullorder_name,'success'=>false));exit;
  998. }
  999. $this->$fullorder_name->save($post,$y['id']);
  1000. //检测单子是否是扫不出库单子重新出库 如果是 就更正
  1001. $outerrors_info = $this->outerrors->find("number = '".$y['number']."'");
  1002. if(!empty($outerrors_info)){
  1003. $this->outerrors->save(array('order_status'=>1,'library_time'=>$time),$outerrors_info['id']);
  1004. }
  1005. $this->logic_ding->sendJobs('order_out',['number'=>$y['number']],0,'');
  1006. //合并订单自动发货
  1007. $hb = $this->$fullorder_name->find_all("merge = '".$y['id']."' and id != '".$y['id']."'");
  1008. $post['waybill'] = $y['waybill'];
  1009. $post['express'] = $y['express'];
  1010. $post['printtype'] = $y['printtype'];
  1011. $post['ioss'] = $y['ioss'];
  1012. $post['review'] = 6;
  1013. $post['bx'] = $y['bx'];
  1014. $post['qm'] = $y['qm'];
  1015. $post['js'] = $y['js'];
  1016. //$post['state'] = 216;
  1017. $post['print'] = $y['print'];
  1018. $post['printtime'] = $y['printtime'];
  1019. $post['library'] = 2;
  1020. $post['librarytime'] = $time;
  1021. $post['libraryconfirm'] = 2;
  1022. $post['librarynot'] = '';
  1023. foreach ($hb as $v)
  1024. {
  1025. $post['state'] = $v['state'];
  1026. $vshop = $this->shop->read($v['shop']);
  1027. $vwarehouse = $this->warehouse->read($v['type']);
  1028. $this->$fullorder_name->save($post,$v['id']);
  1029. //2025年1月25日发现翔文合并订单发现此问题
  1030. if($warehouse['zd'] == '1'){
  1031. $wh = $this->_fout_db($v,$warehouse,$bdck);
  1032. foreach ($wh['sj'] as $vv)
  1033. {
  1034. $this->$bdck->save(array('state'=>1,'cktype'=>1,'orderinfo'=>$v['orderinfo'],'waybill'=>$y['waybill'],'outk'=>$time,'time'=>$time),$vv['id']);
  1035. }
  1036. }
  1037. }
  1038. if ($this->db->trans_status() === TRUE)
  1039. {
  1040. $this->db->trans_commit();
  1041. echo json_encode(array('success'=>true));
  1042. }
  1043. else
  1044. {
  1045. $this->db->trans_rollback();
  1046. echo json_encode(array('msg'=>'出库失败,请重试','success'=>false));
  1047. }
  1048. }
  1049. }
  1050. //之所以用订单已占的库存,就循环更新 为什么不用全部检索是因为牵扯到可能是工厂有可能直接生产后 带到成品库 不入成品库 可能会直接发走,所以只检索已占库存的订单 然后更新
  1051. public function _outnumber()//对比占单是否正确
  1052. {
  1053. $post = $this->input->post(NULL, TRUE);
  1054. if(isset($post['outnumber']))
  1055. {
  1056. $post = $this->input->post('post',true);
  1057. $fullorder_name = $this->input->post('fullorder_name',true);
  1058. $outnumber = $this->input->post('outnumber',true);
  1059. $post = json_decode($post,true);
  1060. $y = $this->$fullorder_name->read($outnumber);
  1061. if(empty($y)){
  1062. echo json_encode(array('msg'=>'订单异常不能出库','success'=>false));exit;
  1063. }
  1064. $warehouse = $this->warehouse->read($y['type']);
  1065. if(empty($warehouse)){
  1066. echo json_encode(array('msg'=>'仓库异常不能出库','success'=>false));exit;
  1067. }
  1068. if($y['library']== 2){
  1069. echo json_encode(array('msg'=>'订单已出库,请勿重复出库','success'=>false));exit;
  1070. }
  1071. if($y['library']== 3){
  1072. echo json_encode(array('msg'=>'订单已退库,请勿重复出库','success'=>false));exit;
  1073. }
  1074. $bdck = $warehouse['bdck'];
  1075. if(!empty($bdck)){
  1076. // $warehouse = $this->warehouse->read($y['type']);
  1077. $list = $this->$bdck->find_all("zd = '".$y['number']."' and warehouse = '".$y['type']."' and (state = '0' or state = '9')");
  1078. $this->db->trans_begin();
  1079. foreach ($list as $v)
  1080. {
  1081. $this->$bdck->save(array('state'=>1,'cktype'=>1,'orderinfo'=>$y['orderinfo'],'waybill'=>$y['waybill'],'outk'=>$post['librarytime'],'time'=>$post['librarytime']),$v['id']);
  1082. }
  1083. $this->$fullorder_name->save($post,$y['id']);
  1084. //检测单子是否是扫不出库单子重新出库 如果是 就更正
  1085. $outerrors_info = $this->outerrors->find("number = '".$y['number']."'");
  1086. if(!empty($outerrors_info)){
  1087. $this->outerrors->save(array('order_status'=>1,'library_time'=>$post['librarytime']),$outerrors_info['id']);
  1088. }
  1089. //需要添加上合并订单的订单信息更新
  1090. $hb = $this->$fullorder_name->find_all("merge = '".$y['id']."' and id != '".$y['id']."'");
  1091. $save_arr = [];
  1092. $save_arr['waybill'] = $y['waybill'];
  1093. $save_arr['express'] = $y['express'];
  1094. $save_arr['printtype'] = $y['printtype'];
  1095. $save_arr['ioss'] = $y['ioss'];
  1096. $save_arr['review'] = 6;
  1097. $save_arr['bx'] = $y['bx'];
  1098. $save_arr['qm'] = $y['qm'];
  1099. $save_arr['js'] = $y['js'];
  1100. $post['state'] = $y['state'];
  1101. $save_arr['print'] = $y['print'];
  1102. $save_arr['printtime'] = $y['printtime'];
  1103. $save_arr['library'] = 2;
  1104. $save_arr['librarytime'] = $post['librarytime'];
  1105. $save_arr['libraryconfirm'] = 2;
  1106. $save_arr['librarynot'] = '';
  1107. foreach($hb as $v){
  1108. $this->$fullorder_name->save($save_arr,$v['id']);
  1109. }
  1110. if ($this->db->trans_status() === TRUE)
  1111. {
  1112. $this->db->trans_commit();
  1113. if($fullorder_name != 'fullorderxw'){
  1114. // if(($item['warehouse'] != 5) || ($item['warehouse'] != 7) || ($item['warehouse'] != 8) || ($item['warehouse'] != 9) ){
  1115. // $this->zzquque_u9->insert($item);
  1116. // }
  1117. $y = $this->$fullorder_name->read($outnumber);
  1118. if( !in_array($y['type'],[5,7,8,9]) ){
  1119. $data = [
  1120. 'platform'=>$fullorder_name,
  1121. 'warehouse'=>$y['type'],
  1122. 'type'=>($y['type'] == 5)?11:10, //5代表美仓
  1123. 'order_no'=>$y['number'],
  1124. 'status'=>0,
  1125. 'create_time'=>time(),
  1126. 'update_time'=>time(),
  1127. ];
  1128. $this->zzquque_u9->insert($data);
  1129. }
  1130. }
  1131. echo json_encode(array('success'=>true));
  1132. die;
  1133. }
  1134. else
  1135. {
  1136. $this->db->trans_rollback();
  1137. echo json_encode(array('msg'=>'出库失败,请重试','success'=>false));
  1138. die;
  1139. }
  1140. }else{
  1141. $this->$fullorder_name->save($post,$y['id']);
  1142. //需要添加上合并订单的订单信息更新
  1143. $hb = $this->$fullorder_name->find_all("merge = '".$y['id']."' and id != '".$y['id']."'");
  1144. $save_arr = [];
  1145. $save_arr['waybill'] = $y['waybill'];
  1146. $save_arr['express'] = $y['express'];
  1147. $save_arr['printtype'] = $y['printtype'];
  1148. $save_arr['ioss'] = $y['ioss'];
  1149. $save_arr['review'] = 6;
  1150. $save_arr['bx'] = $y['bx'];
  1151. $save_arr['qm'] = $y['qm'];
  1152. $save_arr['js'] = $y['js'];
  1153. $post['state'] = $y['state'];
  1154. $save_arr['print'] = $y['print'];
  1155. $save_arr['printtime'] = $y['printtime'];
  1156. $save_arr['library'] = 2;
  1157. $save_arr['librarytime'] = $post['librarytime'];
  1158. $save_arr['libraryconfirm'] = 2;
  1159. $save_arr['librarynot'] = '';
  1160. foreach($hb as $v){
  1161. $this->$fullorder_name->save($save_arr,$v['id']);
  1162. }
  1163. if($fullorder_name != 'fullorderxw'){
  1164. // if(($item['warehouse'] != 5) || ($item['warehouse'] != 7) || ($item['warehouse'] != 8) || ($item['warehouse'] != 9) ){
  1165. // $this->zzquque_u9->insert($item);
  1166. // }
  1167. $y = $this->$fullorder_name->read($outnumber);
  1168. if( !in_array($y['type'],[5,7,8,9]) ){
  1169. $data = [
  1170. 'platform'=>$fullorder_name,
  1171. 'warehouse'=>$y['type'],
  1172. 'type'=>($y['type'] == 5)?11:10, //5代表美仓
  1173. 'order_no'=>$y['number'],
  1174. 'status'=>0,
  1175. 'create_time'=>time(),
  1176. 'update_time'=>time(),
  1177. ];
  1178. $this->zzquque_u9->insert($data);
  1179. }
  1180. }
  1181. echo json_encode(array('success'=>true));
  1182. die;
  1183. }
  1184. }else{
  1185. echo json_encode(array('msg'=>'传参异常,请重试','success'=>false));
  1186. die;
  1187. }
  1188. }
  1189. public function _fout_db($y,$warehouse,$bdck)//对比占单是否正确
  1190. {
  1191. $wh = $this->$bdck->find_all("zd = '".$y['number']."' and warehouse = '".$y['type']."' and (state = '0' or state = '9')");
  1192. $cpsl = 0;
  1193. $pp = explode('|',trim($y['whlabel'],'|'));
  1194. foreach ($pp as $va)
  1195. {
  1196. $num = explode('-',$va);
  1197. if(isset($num[2]))
  1198. {
  1199. if(stripos($num[2],$warehouse['hz']) !== false)
  1200. {
  1201. $cpsl += $num[1];
  1202. }
  1203. }
  1204. }
  1205. if(count($wh) == $cpsl)
  1206. {
  1207. return array('fh'=>1,'sj'=>$wh);
  1208. }
  1209. else
  1210. {
  1211. return array('fh'=>2);
  1212. }
  1213. }
  1214. public function _fedexhz()
  1215. {
  1216. $post = $this->input->post(NULL, TRUE);
  1217. if(isset($post['id']))
  1218. {
  1219. $id = $this->input->post('id',true);
  1220. $fullorder_name = $this->input->post('name',true);
  1221. $express = $this->input->post('express',true);
  1222. $express = $this->express->read($express);
  1223. $fullorder = $this->$fullorder_name->read($id);
  1224. if($fullorder['type'] == '2')
  1225. {
  1226. $fullorder['type'] = 1;
  1227. }
  1228. $time = time();
  1229. $fullorder = $this->_text($fullorder);//获取所需信息
  1230. $oldprinttime = ($fullorder['printtime'] > 0)?$fullorder['oldprinttime'].$fullorder['printtime'].'-':'';
  1231. $fullorder['printtime'] = date('m-d H:i',$time);//打印用时间、发货单用,不能删
  1232. $time = time();
  1233. if($express['printcode'] == "FEDEXGF")
  1234. {
  1235. //$barcode = $this->fedex->get_data($fullorder);//获取联邦快递信息
  1236. //升级的api
  1237. $barcode = $this->fedexv1->get_data($fullorder);//获取联邦快递信息
  1238. if($barcode['x'] == 1)
  1239. {
  1240. $bctime = date('Ymd',$time);
  1241. $Hwaybill = $barcode['waybill'];
  1242. // $Hyd = $this->_pdf($barcode['label'],'y-'.$Hwaybill,$bctime);
  1243. // $Hfp = $this->_pdf($barcode['invoice'],'f-'.$Hwaybill,$bctime);//开通ETD模式,保留PDF,不需要打印
  1244. $Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
  1245. $Hfp = $this->_pdfurl($barcode['invoice'],'f-'.$Hwaybill,$bctime);//开通ETD模式,保留PDF,不需要打印
  1246. if(isset($barcode['label']) && isset($Hwaybill))
  1247. {
  1248. if($fullorder['waybill'] != "")
  1249. {
  1250. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1251. }
  1252. else
  1253. {
  1254. $oldwaybill = $fullorder['oldwaybill'];
  1255. }
  1256. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1257. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1258. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$fullorder['id']))
  1259. {
  1260. $warehouse = $this->warehouse->read($fullorder['type']);
  1261. $text = array();
  1262. $text['yd'] = base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf';
  1263. $text['number'] = $fullorder['number'];
  1264. $text['mode'] = '95';
  1265. $text['pdfnum'] = 1;
  1266. $rows = array('text'=>$text);
  1267. echo json_encode(array('rows'=>($rows),'success'=>true));exit;
  1268. }
  1269. else
  1270. {
  1271. echo json_encode(array($fullorder['number'].'msg'=>'打印错误,请联系店员','cw'=>'写入数据库错误','success'=>false));exit;
  1272. }
  1273. }
  1274. }
  1275. else
  1276. {
  1277. echo json_encode(array('msg'=>'打印错误,请联系店员','cw'=>$barcode['Description'],'success'=>false));exit;
  1278. }
  1279. }
  1280. else if($express['printcode'] == "UPS")//接口UPS暂时不打
  1281. {
  1282. echo json_encode(array('msg'=>'此订单超期无法出库,请联系成会处理','success'=>false));exit;
  1283. $barcode = $this->ups->get_data($fullorder);//获取快递信息
  1284. if($barcode['x'] == 1)
  1285. {
  1286. $bctime = date('Ymd',$time);
  1287. $Hwaybill = $barcode['waybill'];
  1288. $Hyd = $this->_pdfurl($barcode['label'],'y-'.$Hwaybill,$bctime);
  1289. if(isset($barcode['label']) && isset($Hwaybill))
  1290. {
  1291. if($fullorder['waybill'] != "")
  1292. {
  1293. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1294. }
  1295. else
  1296. {
  1297. $oldwaybill = $fullorder['oldwaybill'];
  1298. }
  1299. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1300. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删
  1301. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'libraryconfirm'=>2,'librarynot'=>'','printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'print'=>3,'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$va[$n]))
  1302. {
  1303. $type = 1;
  1304. $text = array('yd'=>'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf','data'=>$fullorder,'id'=>$fullorder['id'],'pt'=>$fullorder_name);
  1305. }
  1306. }
  1307. }
  1308. else
  1309. {
  1310. echo json_encode(array('msg'=>$fullorder['number'].'打印错误,请联系店员','cw'=>$barcode['Description'],'success'=>false));exit;
  1311. }
  1312. }
  1313. else if($express['printcode'] == "DHLHZ")//如果打印过那么重新获取运单
  1314. {
  1315. $barcode = $this->dhlhz->get_data($fullorder);//获取DHL快递信息
  1316. if($barcode['c'] == 1)
  1317. {
  1318. $bctime = date('Ymd',$time);
  1319. $Hwaybill = $barcode['data']['waybill'];
  1320. $Hfp = $this->_pdf($barcode['data']['fp'],'f-'.$Hwaybill,$bctime);
  1321. $Hyd = $this->_pdf($barcode['data']['yd'],'y-'.$Hwaybill,$bctime);
  1322. if(isset($Hfp) && isset($Hyd) && isset($Hwaybill))
  1323. {
  1324. if($fullorder['waybill'] != "")
  1325. {
  1326. $oldwaybill = $fullorder['oldwaybill'].'-'.date('Ymd',$time).'/'.$fullorder['waybill'];
  1327. }
  1328. else
  1329. {
  1330. $oldwaybill = $fullorder['oldwaybill'];
  1331. }
  1332. $oldwaybill .= '-'.$bctime.'/'.$Hwaybill;
  1333. $fullorder['printnumber'] = $fullorder['printnumber'] +1;//不能删d
  1334. if($this->$fullorder_name->save(array('waybill'=>$Hwaybill,'printtime'=>$time,'printnumber'=>$fullorder['printnumber'],'oldwaybill'=>$oldwaybill,'oldprinttime'=>$oldprinttime),$fullorder['id']))
  1335. {
  1336. $warehouse = $this->warehouse->read($fullorder['type']);
  1337. $text = array();
  1338. $text['yd'] = base_url().'data/pdf/'.$bctime.'/y-'.$Hwaybill.'.pdf';
  1339. $text['number'] = $fullorder['number'];
  1340. $text['mode'] = '95';
  1341. $text['pdfnum'] = 1;
  1342. $rows = array('text'=>$text);
  1343. echo json_encode(array('rows'=>($rows),'success'=>true));exit;
  1344. }
  1345. }
  1346. }
  1347. else
  1348. {
  1349. echo json_encode(array('msg'=>$fullorder['number'].'打印错误,请联系店员','cw'=>$barcode['Description'],'success'=>false));exit;
  1350. }
  1351. }
  1352. else
  1353. {
  1354. echo json_encode(array('msg'=>'此订单超期无法出库,请联系成会或者梦体处理','success'=>false));exit;
  1355. }
  1356. }
  1357. }
  1358. public function _text($fullorder)
  1359. {
  1360. /** 发票地址信息暂时无用
  1361. $fullorder['baddress'] = explode(',',$fullorder['baddress']);
  1362. $fullorder['baddress'] = array_reverse($fullorder['baddress']);
  1363. $fullorder['baddress'][1] = $country['ename'];
  1364. **/
  1365. //获取所用相关信息
  1366. $warehouse = $this->warehouse->read($fullorder['type']);
  1367. $country = $this->country->read($fullorder['country']);//订单国家信息
  1368. $fcountry = $this->country->read($warehouse['country']);//仓库国家信息
  1369. $warehouse['country'] = $fcountry['ename'];//仓库国家名
  1370. $warehouse['lb'] = $fcountry['lb'];//仓库国家编码
  1371. $fullorder['warehouse'] = $warehouse;//仓库数据加入订单
  1372. $fullorder['lb'] = $country['lb'];//订单国家编码加入
  1373. $fullorder['country'] = $country['ename'];//订单国家名
  1374. $fullorder['zhou'] = $country['continent'];//所属州
  1375. $express = $this->express->read($fullorder['express']);
  1376. $fullorder['express'] = $express['servicename'];
  1377. $fullorder['account'] = $express['account'];
  1378. $fullorder['printcode'] = $express['printcode'];
  1379. $fullorder['time'] = date('Y-m-d',time());
  1380. $fullorder['times'] = date('Y-m-d H:i',time());
  1381. //$fullorder['sbbm']= ($fullorder['sbpm'] == 'Hair Sample') ? 67042000 : 67041100;
  1382. // 修复报关编码问题
  1383. $declara_info = $this->customsdeclaration->find("ename like '%".trim($fullorder['sbpm'])."%' ","*");
  1384. $sbbm = "";
  1385. if(empty($declara_info)){
  1386. $sbbm = "";
  1387. }else{
  1388. $sbbm = $declara_info['bname'];
  1389. }
  1390. $fullorder['sbbm']= $sbbm;
  1391. $fullorder['address'] = str_replace(array('&'),array('&#38;'),$fullorder['address']);
  1392. $fullorder['address2'] = str_replace(array('&'),array('&#38;'),$fullorder['address2']);
  1393. $shop = $this->shop->read($fullorder['shop']);
  1394. $fullorder['shop'] = $shop['shopname'];
  1395. return $fullorder;
  1396. }
  1397. public function _lowe()
  1398. {
  1399. $post = $this->input->post(NULL, TRUE);
  1400. if(isset($post['lowe']))
  1401. {
  1402. $lowe = $this->typeclass->find_all('classid = 15 and id != 105 and id != 107 and id != 108 and id != 112 and id != 114 and id != 115 and id != 116 and id != 117 and id != 118 and id != 119 and id != 120 and id != 121 and id != 122 and id != 123 and id != 124 and id != 125 and id != 292 and id != 63 and id != 289 and id != 290 and id != 181 and id != 273 and id != 148 and id != 38 and id != 291 and id != 55 and id != 271 and id != 285 and id != 186 and id != 187 and id != 188 and id != 189');
  1403. echo json_encode(array('msg'=>$lowe));exit;
  1404. }
  1405. }
  1406. public function _pdf($pdf,$title,$bctime)
  1407. {
  1408. $pdf_path = './data/pdf/'.$bctime.'/';
  1409. $file_base64 = $pdf;
  1410. $file_base64 = preg_replace('/data:.*;base64,/i', '', $file_base64);
  1411. $file_base64 = base64_decode($file_base64);
  1412. if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建
  1413. file_put_contents($pdf_path.$title.'.pdf',$file_base64);
  1414. return $bctime;
  1415. }
  1416. public function _pdfurl($pdf,$title,$bctime)
  1417. {
  1418. $pdf_path = './data/pdf/'.$bctime.'/';
  1419. $pdf = fopen($pdf,"r");
  1420. if(!is_dir($pdf_path))mkdir($pdf_path,0777); //上传目录不存在则创建
  1421. file_put_contents($pdf_path.$title.'.pdf',$pdf);
  1422. return $bctime;
  1423. }
  1424. public function _excel()
  1425. {
  1426. $xw = '';
  1427. if(isset($_SESSION['api']))
  1428. {
  1429. $user = $this->user->get_api($_SESSION['api']);
  1430. $usp = $user;
  1431. $fgshop = "";$sid = "";$wid="";$wtype="";
  1432. $usersp = explode('|',trim($user['shop'],'|'));
  1433. $userwh = explode('|',trim($user['warehouse'],'|'));
  1434. foreach ($usersp as $value)
  1435. {
  1436. $fgshop .= " shop = ".$value." or";
  1437. $sid .= " id = ".$value." or";
  1438. }
  1439. foreach ($userwh as $value)
  1440. {
  1441. $wid .= " id = ".$value." or";
  1442. $wtype .= " type = ".$value." or";
  1443. }
  1444. if($user['userid'] == 'xw')
  1445. {
  1446. $xw = 1;
  1447. }
  1448. }
  1449. if(isset($_GET['fexcel']))
  1450. {
  1451. $dowid = $this->input->get('a');
  1452. $wid = "";
  1453. if($dowid != "")
  1454. {
  1455. $id_arr = explode(',',rtrim($dowid,','));
  1456. foreach ($id_arr as $v)
  1457. {
  1458. $wid .= " id = '$v' or";
  1459. }
  1460. $wid = " and".rtrim($wid,'or');
  1461. }
  1462. $t = $this->input->get('t',true);
  1463. $timetk = $this->input->get('timetk',true);
  1464. $timetj = $this->input->get('timetj',true);
  1465. $shop = $this->input->get('shop',true);
  1466. $source = $this->input->get('source',true);
  1467. $orderinfo = $this->input->get('orderinfo',true);
  1468. $number = $this->input->get('number',true);
  1469. $library = $this->input->get('library',true);
  1470. $waybill = $this->input->get('waybill',true);
  1471. $express = $this->input->get('express',true);
  1472. $type = $this->input->get('type',true);
  1473. $so = $this->input->get('so',true);
  1474. $timetk = strtotime($timetk);
  1475. $timetj = strtotime($timetj);
  1476. $where = (isset($_SESSION['api']))?"library!=3 and libraryconfirm=2 and print = 3 and (".rtrim($wtype,'or').")":"id = '0'";
  1477. if($timetk && $timetj && $library == 1)
  1478. {
  1479. //$cxtime = 'reviewtime';
  1480. $where .= " and printtime > '$timetk - 180*24*3600' and printtime < '$timetj'";
  1481. $where .= " and state != 217";
  1482. }
  1483. else if($timetk && $timetj && $library == 2)
  1484. {
  1485. $cxtime = 'librarytime';
  1486. $where .= " and librarytime > '$timetk' and librarytime < '$timetj'";
  1487. }
  1488. /**
  1489. $where = "library!=3 and libraryconfirm=2 and mergeid = 0 and print = 3";
  1490. if($timetk && $timetj && $library == 1)
  1491. {
  1492. //$cxtime = 'reviewtime';
  1493. //$where .= " and librarytime > '$timetk' and librarytime < '$timetj'";
  1494. }
  1495. else if($timetk && $timetj && $library == 2)
  1496. {
  1497. $cxtime = 'librarytime';
  1498. $where .= " and librarytime > '$timetk' and librarytime < '$timetj'";
  1499. }
  1500. **/
  1501. if(isset($_SESSION['api']))
  1502. {
  1503. if($type)
  1504. {
  1505. $where .= " and type = '$type'";
  1506. }
  1507. else
  1508. {
  1509. $uw = '';
  1510. $u = $this->user->get_api($_SESSION['api']);
  1511. $u['warehouse'] = explode('|',trim($u['warehouse'],'|'));
  1512. foreach ($u['warehouse'] as $v)
  1513. {
  1514. $uw .= " type = '$v' or";
  1515. }
  1516. $uw = rtrim($uw,'or');
  1517. $uw = " and (".ltrim($uw,' ').")";
  1518. $where .= $uw;
  1519. }
  1520. }
  1521. else
  1522. {
  1523. echo json_encode(array('msg'=>'导出失败,请重新登陆!','success'=>false));exit;
  1524. }
  1525. if($shop)
  1526. {
  1527. $where .= " and shop = '$shop'";
  1528. }
  1529. if($number)
  1530. {
  1531. $where .= " and number = '$number'";
  1532. }
  1533. if($library)
  1534. {
  1535. $where .= " and library = '$library'";
  1536. }
  1537. if($waybill)
  1538. {
  1539. $where .= " and waybill = '$waybill'";
  1540. }
  1541. if($express)
  1542. {
  1543. $where .= " and express = '$express'";
  1544. }
  1545. if($orderinfo)
  1546. {
  1547. $where .= " and orderinfo = '$orderinfo'";
  1548. }
  1549. if($so)
  1550. {
  1551. $where .= " and shipremarks like '%$so%'";
  1552. }
  1553. //数据排序
  1554. //$order_str = ($print != 3)?"id desc":"librarytime desc";
  1555. $order_str = "librarytime desc";
  1556. if(empty($page))
  1557. {
  1558. $start = 0;
  1559. $perpage = 1;
  1560. }
  1561. else
  1562. {
  1563. $start = ($page - 1)*$perpage;
  1564. }
  1565. $typeclass = array();
  1566. $tclass = $this->typeclass->find_all();
  1567. foreach ($tclass as $v)
  1568. {
  1569. $typeclass[$v['id']] = $v;
  1570. }
  1571. //取得信息列表
  1572. $info_list = $this->fullorder->find_all($where.$wid,'shop,type,orderinfo,number,waybill,waybillid,express,print,library,librarytime,shipremarks,ts,fpdata',$order_str);
  1573. //格式化数据
  1574. foreach ($info_list as $key=>$value)
  1575. {
  1576. $shop = $this->shop->read($value['shop']);
  1577. $info_list[$key]['shop'] = $shop['shopname'];
  1578. if($value['waybill'] == '0')
  1579. {
  1580. $info_list[$key]['waybill'] = "";
  1581. }
  1582. $express = $this->express->read($value['express']);
  1583. $info_list[$key]['express'] = $express['servicename'];
  1584. $warehouse = $this->warehouse->read($value['type']);
  1585. $info_list[$key]['type'] = $warehouse['title'];
  1586. if($value['print'] == 1)
  1587. {
  1588. $info_list[$key]['print'] = '不可打印';
  1589. }
  1590. else if($value['print'] == 2)
  1591. {
  1592. $info_list[$key]['print'] = '未打印';
  1593. }
  1594. else if($value['print'] == 3)
  1595. {
  1596. $info_list[$key]['print'] = '已打印';
  1597. }
  1598. if($value['library'] == 1)
  1599. {
  1600. $info_list[$key]['library'] = '<em class="c">未出库</em>';
  1601. }
  1602. else if($value['library'] == 2)
  1603. {
  1604. $info_list[$key]['library'] = '<em class="c">已出库</em>';
  1605. }
  1606. else if($value['library'] == 3)
  1607. {
  1608. $info_list[$key]['library'] = '<em class="c">已退库</em>';
  1609. }
  1610. if($value['librarytime'] == '0')
  1611. {
  1612. $info_list[$key]['librarytime'] = '<em class="t"></em>';
  1613. }
  1614. else
  1615. {
  1616. $info_list[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  1617. }
  1618. $classid = $classid = $this->classid->sku();
  1619. $dbapi = explode(';',trim($value['fpdata'],';'));
  1620. $tmp_jm = "";
  1621. $tmp_zh = "";
  1622. foreach ($dbapi as $va)
  1623. {
  1624. $pm = $classid;
  1625. $jm = $classid;
  1626. $bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
  1627. $features = str_replace(array('-163-','-164-','-165-','-166-'),'-',$va);
  1628. $ts = explode('|',trim($features,'|'));
  1629. if(stripos($ts[0],',') !== false)
  1630. {
  1631. $ft = explode(',',$ts[0]);
  1632. $features = explode('-',trim($ft[1],'-'));
  1633. $features[] = $ft[0];
  1634. }
  1635. else
  1636. {
  1637. $features = explode('-',trim($ts[0],'-'));
  1638. }
  1639. foreach($features as $k=>$v)
  1640. {
  1641. if(isset($typeclass[$v]) && isset($bmpx[$typeclass[$v]['classid']]))
  1642. {
  1643. if($typeclass[$v]['bm'] != '')
  1644. {
  1645. $bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
  1646. }
  1647. }
  1648. if($v != 0 && isset($typeclass[$v]))
  1649. {
  1650. if($typeclass[$v]['classid'] == 13)
  1651. {
  1652. $dj = $typeclass[$v]['title'];
  1653. }
  1654. if($typeclass[$v]['classid'] == 8)
  1655. {
  1656. $ys = $typeclass[$v]['title'];
  1657. }
  1658. if($typeclass[$v]['classid'] == 15)
  1659. {
  1660. $hx = $typeclass[$v]['title'];
  1661. }
  1662. if(isset($pm[$typeclass[$v]['classid']]))
  1663. {
  1664. if($typeclass[$v]['title'] == '9A')
  1665. {
  1666. $pm[$typeclass[$v]['classid']] = '9A';
  1667. }
  1668. else if($typeclass[$v]['title'] == '10A')
  1669. {
  1670. $pm[$typeclass[$v]['classid']] = '10A';
  1671. }
  1672. else
  1673. {
  1674. $clzh = $typeclass[$v]['zh'];
  1675. if(stripos($typeclass[$v]['zh'],'|') !== false)
  1676. {
  1677. $clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
  1678. $clzh = $clzh[0];
  1679. }
  1680. $pm[$typeclass[$v]['classid']] = $clzh;
  1681. }
  1682. }
  1683. if(isset($jm[$typeclass[$v]['classid']]))
  1684. {
  1685. if($typeclass[$v]['jm'])
  1686. {
  1687. $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
  1688. }
  1689. }
  1690. }
  1691. }
  1692. $jm = array_filter($jm);//去除空值
  1693. $jm = implode("-",$jm);
  1694. $tmp_jm .= $jm.";";
  1695. $pm = array_filter($pm);//去除空值
  1696. $zh = implode(" ",$pm);
  1697. $zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
  1698. $tmp_zh .= $zh.";";
  1699. }
  1700. $info_list[$key]['jm'] = trim($tmp_jm,';');
  1701. $info_list[$key]['zh'] = trim($tmp_zh,';');
  1702. }
  1703. //取得信息列表
  1704. $info_listsmt = $this->fullordersmt->find_all($where.$wid,'shop,type,orderinfo,number,waybill,waybillid,express,print,library,librarytime,shipremarks,ts,fpdata',$order_str);
  1705. //格式化数据
  1706. foreach ($info_listsmt as $key=>$value)
  1707. {
  1708. $shop = $this->shop->read($value['shop']);
  1709. $info_listsmt[$key]['shop'] = $shop['shopname'];
  1710. if($value['waybill'] == '0')
  1711. {
  1712. $info_listsmt[$key]['waybill'] = "";
  1713. }
  1714. $express = $this->express->read($value['express']);
  1715. $info_listsmt[$key]['express'] = $express['servicename'];
  1716. $warehouse = $this->warehouse->read($value['type']);
  1717. $info_listsmt[$key]['type'] = $warehouse['title'];
  1718. if($value['print'] == 1)
  1719. {
  1720. $info_listsmt[$key]['print'] = '不可打印';
  1721. }
  1722. else if($value['print'] == 2)
  1723. {
  1724. $info_listsmt[$key]['print'] = '未打印';
  1725. }
  1726. else if($value['print'] == 3)
  1727. {
  1728. $info_listsmt[$key]['print'] = '已打印';
  1729. }
  1730. if($value['library'] == 1)
  1731. {
  1732. $info_listsmt[$key]['library'] = '<em class="c">未出库</em>';
  1733. }
  1734. else if($value['library'] == 2)
  1735. {
  1736. $info_listsmt[$key]['library'] = '<em class="c">已出库</em>';
  1737. }
  1738. else if($value['library'] == 3)
  1739. {
  1740. $info_listsmt[$key]['library'] = '<em class="c">已退库</em>';
  1741. }
  1742. if($value['librarytime'] == '0')
  1743. {
  1744. $info_listsmt[$key]['librarytime'] = '<em class="t"></em>';
  1745. }
  1746. else
  1747. {
  1748. $info_listsmt[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  1749. }
  1750. $classid = $classid = $this->classid->sku();
  1751. $dbapi = explode(';',trim($value['fpdata'],';'));
  1752. $tmp_jm = "";
  1753. $tmp_zh = "";
  1754. foreach ($dbapi as $va)
  1755. {
  1756. $pm = $classid;
  1757. $jm = $classid;
  1758. $bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
  1759. $features = str_replace(array('-163-','-164-','-165-','-166-'),'-',$va);
  1760. $ts = explode('|',trim($features,'|'));
  1761. if(stripos($ts[0],',') !== false)
  1762. {
  1763. $ft = explode(',',$ts[0]);
  1764. $features = explode('-',trim($ft[1],'-'));
  1765. $features[] = $ft[0];
  1766. }
  1767. else
  1768. {
  1769. $features = explode('-',trim($ts[0],'-'));
  1770. }
  1771. foreach($features as $k=>$v)
  1772. {
  1773. if(isset($typeclass[$v]) && isset($bmpx[$typeclass[$v]['classid']]))
  1774. {
  1775. if($typeclass[$v]['bm'] != '')
  1776. {
  1777. $bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
  1778. }
  1779. }
  1780. if($v != 0 && isset($typeclass[$v]))
  1781. {
  1782. if($typeclass[$v]['classid'] == 13)
  1783. {
  1784. $dj = $typeclass[$v]['title'];
  1785. }
  1786. if($typeclass[$v]['classid'] == 8)
  1787. {
  1788. $ys = $typeclass[$v]['title'];
  1789. }
  1790. if($typeclass[$v]['classid'] == 15)
  1791. {
  1792. $hx = $typeclass[$v]['title'];
  1793. }
  1794. if(isset($pm[$typeclass[$v]['classid']]))
  1795. {
  1796. if($typeclass[$v]['title'] == '9A')
  1797. {
  1798. $pm[$typeclass[$v]['classid']] = '9A';
  1799. }
  1800. else if($typeclass[$v]['title'] == '10A')
  1801. {
  1802. $pm[$typeclass[$v]['classid']] = '10A';
  1803. }
  1804. else
  1805. {
  1806. $clzh = $typeclass[$v]['zh'];
  1807. if(stripos($typeclass[$v]['zh'],'|') !== false)
  1808. {
  1809. $clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
  1810. $clzh = $clzh[0];
  1811. }
  1812. $pm[$typeclass[$v]['classid']] = $clzh;
  1813. }
  1814. }
  1815. if(isset($jm[$typeclass[$v]['classid']]))
  1816. {
  1817. if($typeclass[$v]['jm'])
  1818. {
  1819. $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
  1820. }
  1821. }
  1822. }
  1823. }
  1824. $jm = array_filter($jm);//去除空值
  1825. $jm = implode("-",$jm);
  1826. $pm = array_filter($pm);//去除空值
  1827. $zh = implode(" ",$pm);
  1828. $zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
  1829. $tmp_jm .= $jm.";";
  1830. $tmp_zh .= $zh.";";
  1831. }
  1832. $info_listsmt[$key]['jm'] = trim($tmp_jm,';');
  1833. $info_listsmt[$key]['zh'] = trim($tmp_zh,';');
  1834. }
  1835. //取得信息列表
  1836. $info_listtt = $this->fullordertt->find_all($where.$wid,'shop,type,orderinfo,number,waybill,waybillid,express,print,library,librarytime,shipremarks,ts,fpdata',$order_str);
  1837. //格式化数据
  1838. foreach ($info_listtt as $key=>$value)
  1839. {
  1840. $shop = $this->shop->read($value['shop']);
  1841. $info_listtt[$key]['shop'] = $shop['shopname'];
  1842. if($value['waybill'] == '0')
  1843. {
  1844. $info_listtt[$key]['waybill'] = "";
  1845. }
  1846. $express = $this->express->read($value['express']);
  1847. $info_listtt[$key]['express'] = $express['servicename'];
  1848. $warehouse = $this->warehouse->read($value['type']);
  1849. $info_listtt[$key]['type'] = $warehouse['title'];
  1850. if($value['print'] == 1)
  1851. {
  1852. $info_listtt[$key]['print'] = '不可打印';
  1853. }
  1854. else if($value['print'] == 2)
  1855. {
  1856. $info_listtt[$key]['print'] = '未打印';
  1857. }
  1858. else if($value['print'] == 3)
  1859. {
  1860. $info_listtt[$key]['print'] = '已打印';
  1861. }
  1862. if($value['library'] == 1)
  1863. {
  1864. $info_listtt[$key]['library'] = '<em class="c">未出库</em>';
  1865. }
  1866. else if($value['library'] == 2)
  1867. {
  1868. $info_listtt[$key]['library'] = '<em class="c">已出库</em>';
  1869. }
  1870. else if($value['library'] == 3)
  1871. {
  1872. $info_listtt[$key]['library'] = '<em class="c">已退库</em>';
  1873. }
  1874. if($value['librarytime'] == '0')
  1875. {
  1876. $info_listtt[$key]['librarytime'] = '<em class="t"></em>';
  1877. }
  1878. else
  1879. {
  1880. $info_listtt[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  1881. }
  1882. $classid = $classid = $this->classid->sku();
  1883. $tmp_jm = "";
  1884. $tmp_zh = "";
  1885. $dbapi = explode(';',trim($value['fpdata'],';'));
  1886. foreach ($dbapi as $va)
  1887. {
  1888. $pm = $classid;
  1889. $jm = $classid;
  1890. $bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
  1891. $features = str_replace(array('-163-','-164-','-165-','-166-'),'-',$va);
  1892. $ts = explode('|',trim($features,'|'));
  1893. if(stripos($ts[0],',') !== false)
  1894. {
  1895. $ft = explode(',',$ts[0]);
  1896. $features = explode('-',trim($ft[1],'-'));
  1897. $features[] = $ft[0];
  1898. }
  1899. else
  1900. {
  1901. $features = explode('-',trim($ts[0],'-'));
  1902. }
  1903. foreach($features as $k=>$v)
  1904. {
  1905. if(isset($typeclass[$v]) && isset($bmpx[$typeclass[$v]['classid']]))
  1906. {
  1907. if($typeclass[$v]['bm'] != '')
  1908. {
  1909. $bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
  1910. }
  1911. }
  1912. if($v != 0 && isset($typeclass[$v]))
  1913. {
  1914. if($typeclass[$v]['classid'] == 13)
  1915. {
  1916. $dj = $typeclass[$v]['title'];
  1917. }
  1918. if($typeclass[$v]['classid'] == 8)
  1919. {
  1920. $ys = $typeclass[$v]['title'];
  1921. }
  1922. if($typeclass[$v]['classid'] == 15)
  1923. {
  1924. $hx = $typeclass[$v]['title'];
  1925. }
  1926. if(isset($pm[$typeclass[$v]['classid']]))
  1927. {
  1928. if($typeclass[$v]['title'] == '9A')
  1929. {
  1930. $pm[$typeclass[$v]['classid']] = '9A';
  1931. }
  1932. else if($typeclass[$v]['title'] == '10A')
  1933. {
  1934. $pm[$typeclass[$v]['classid']] = '10A';
  1935. }
  1936. else
  1937. {
  1938. $clzh = $typeclass[$v]['zh'];
  1939. if(stripos($typeclass[$v]['zh'],'|') !== false)
  1940. {
  1941. $clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
  1942. $clzh = $clzh[0];
  1943. }
  1944. $pm[$typeclass[$v]['classid']] = $clzh;
  1945. }
  1946. }
  1947. if(isset($jm[$typeclass[$v]['classid']]))
  1948. {
  1949. if($typeclass[$v]['jm'])
  1950. {
  1951. $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
  1952. }
  1953. }
  1954. }
  1955. }
  1956. $jm = array_filter($jm);//去除空值
  1957. $jm = implode("-",$jm);
  1958. $pm = array_filter($pm);//去除空值
  1959. $zh = implode(" ",$pm);
  1960. $zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
  1961. $tmp_jm .= $jm.";";
  1962. $tmp_zh .= $zh.";";
  1963. }
  1964. $info_listtt[$key]['jm'] = trim($tmp_jm,';');
  1965. $info_listtt[$key]['zh'] = trim($tmp_zh,';');
  1966. }
  1967. //取得信息列表
  1968. $info_listamz = $this->fullorderamz->find_all($where.$wid,'shop,type,orderinfo,number,waybill,waybillid,express,print,library,librarytime,shipremarks,ts,fpdata',$order_str);
  1969. //格式化数据
  1970. foreach ($info_listamz as $key=>$value)
  1971. {
  1972. $shop = $this->shop->read($value['shop']);
  1973. $info_listamz[$key]['shop'] = $shop['shopname'];
  1974. if($value['waybill'] == '0')
  1975. {
  1976. $info_listamz[$key]['waybill'] = "";
  1977. }
  1978. $express = $this->express->read($value['express']);
  1979. $info_listamz[$key]['express'] = $express['servicename'];
  1980. $warehouse = $this->warehouse->read($value['type']);
  1981. $info_listamz[$key]['type'] = $warehouse['title'];
  1982. if($value['print'] == 1)
  1983. {
  1984. $info_listamz[$key]['print'] = '不可打印';
  1985. }
  1986. else if($value['print'] == 2)
  1987. {
  1988. $info_listamz[$key]['print'] = '未打印';
  1989. }
  1990. else if($value['print'] == 3)
  1991. {
  1992. $info_listamz[$key]['print'] = '已打印';
  1993. }
  1994. if($value['library'] == 1)
  1995. {
  1996. $info_listamz[$key]['library'] = '<em class="c">未出库</em>';
  1997. }
  1998. else if($value['library'] == 2)
  1999. {
  2000. $info_listamz[$key]['library'] = '<em class="c">已出库</em>';
  2001. }
  2002. else if($value['library'] == 3)
  2003. {
  2004. $info_listamz[$key]['library'] = '<em class="c">已退库</em>';
  2005. }
  2006. if($value['librarytime'] == '0')
  2007. {
  2008. $info_listamz[$key]['librarytime'] = '<em class="t"></em>';
  2009. }
  2010. else
  2011. {
  2012. $info_listamz[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  2013. }
  2014. $classid = $classid = $this->classid->sku();
  2015. $dbapi = explode(';',trim($value['fpdata'],';'));
  2016. $tmp_jm = "";
  2017. $tmp_zh = "";
  2018. foreach ($dbapi as $va)
  2019. {
  2020. $pm = $classid;
  2021. $jm = $classid;
  2022. $bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
  2023. $features = str_replace(array('-163-','-164-','-165-','-166-'),'-',$va);
  2024. $ts = explode('|',trim($features,'|'));
  2025. if(stripos($ts[0],',') !== false)
  2026. {
  2027. $ft = explode(',',$ts[0]);
  2028. $features = explode('-',trim($ft[1],'-'));
  2029. $features[] = $ft[0];
  2030. }
  2031. else
  2032. {
  2033. $features = explode('-',trim($ts[0],'-'));
  2034. }
  2035. foreach($features as $k=>$v)
  2036. {
  2037. if(isset($typeclass[$v]) && isset($bmpx[$typeclass[$v]['classid']]))
  2038. {
  2039. if($typeclass[$v]['bm'] != '')
  2040. {
  2041. $bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
  2042. }
  2043. }
  2044. if($v != 0 && isset($typeclass[$v]))
  2045. {
  2046. if($typeclass[$v]['classid'] == 13)
  2047. {
  2048. $dj = $typeclass[$v]['title'];
  2049. }
  2050. if($typeclass[$v]['classid'] == 8)
  2051. {
  2052. $ys = $typeclass[$v]['title'];
  2053. }
  2054. if($typeclass[$v]['classid'] == 15)
  2055. {
  2056. $hx = $typeclass[$v]['title'];
  2057. }
  2058. if(isset($pm[$typeclass[$v]['classid']]))
  2059. {
  2060. if($typeclass[$v]['title'] == '9A')
  2061. {
  2062. $pm[$typeclass[$v]['classid']] = '9A';
  2063. }
  2064. else if($typeclass[$v]['title'] == '10A')
  2065. {
  2066. $pm[$typeclass[$v]['classid']] = '10A';
  2067. }
  2068. else
  2069. {
  2070. $clzh = $typeclass[$v]['zh'];
  2071. if(stripos($typeclass[$v]['zh'],'|') !== false)
  2072. {
  2073. $clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
  2074. $clzh = $clzh[0];
  2075. }
  2076. $pm[$typeclass[$v]['classid']] = $clzh;
  2077. }
  2078. }
  2079. if(isset($jm[$typeclass[$v]['classid']]))
  2080. {
  2081. if($typeclass[$v]['jm'])
  2082. {
  2083. $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
  2084. }
  2085. }
  2086. }
  2087. }
  2088. $jm = array_filter($jm);//去除空值
  2089. $jm = implode("-",$jm);
  2090. $pm = array_filter($pm);//去除空值
  2091. $zh = implode(" ",$pm);
  2092. $zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
  2093. $tmp_jm .= $jm.";";
  2094. $tmp_zh .= $zh.";";
  2095. }
  2096. $info_listamz[$key]['jm'] = trim($tmp_jm,';');
  2097. $info_listamz[$key]['zh'] = trim($tmp_zh,';');
  2098. }
  2099. //取得信息列表
  2100. $info_listxw = $this->fullorderxw->find_all($where.$wid,'shop,type,orderinfo,number,waybill,waybillid,express,print,library,librarytime,shipremarks,ts,fpdata',$order_str);
  2101. //格式化数据
  2102. foreach ($info_listxw as $key=>$value)
  2103. {
  2104. $shop = $this->shop->read($value['shop']);
  2105. $info_listxw[$key]['shop'] = $shop['shopname'];
  2106. if($value['waybill'] == '0')
  2107. {
  2108. $info_listxw[$key]['waybill'] = "";
  2109. }
  2110. $express = $this->express->read($value['express']);
  2111. $info_listxw[$key]['express'] = $express['servicename'];
  2112. $warehouse = $this->warehouse->read($value['type']);
  2113. $info_listxw[$key]['type'] = $warehouse['title'];
  2114. if($value['print'] == 1)
  2115. {
  2116. $info_listxw[$key]['print'] = '不可打印';
  2117. }
  2118. else if($value['print'] == 2)
  2119. {
  2120. $info_listxw[$key]['print'] = '未打印';
  2121. }
  2122. else if($value['print'] == 3)
  2123. {
  2124. $info_listxw[$key]['print'] = '已打印';
  2125. }
  2126. if($value['library'] == 1)
  2127. {
  2128. $info_listxw[$key]['library'] = '<em class="c">未出库</em>';
  2129. }
  2130. else if($value['library'] == 2)
  2131. {
  2132. $info_listxw[$key]['library'] = '<em class="c">已出库</em>';
  2133. }
  2134. else if($value['library'] == 3)
  2135. {
  2136. $info_listxw[$key]['library'] = '<em class="c">已退库</em>';
  2137. }
  2138. if($value['librarytime'] == '0')
  2139. {
  2140. $info_listxw[$key]['librarytime'] = '<em class="t"></em>';
  2141. }
  2142. else
  2143. {
  2144. $info_listxw[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  2145. }
  2146. $classid = $classid = $this->classid->sku();
  2147. $dbapi = explode(';',trim($value['fpdata'],';'));
  2148. foreach ($dbapi as $va)
  2149. {
  2150. $pm = $classid;
  2151. $jm = $classid;
  2152. $bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
  2153. $features = str_replace(array('-163-','-164-','-165-','-166-'),'-',$va);
  2154. $ts = explode('|',trim($features,'|'));
  2155. if(stripos($ts[0],',') !== false)
  2156. {
  2157. $ft = explode(',',$ts[0]);
  2158. $features = explode('-',trim($ft[1],'-'));
  2159. $features[] = $ft[0];
  2160. }
  2161. else
  2162. {
  2163. $features = explode('-',trim($ts[0],'-'));
  2164. }
  2165. foreach($features as $k=>$v)
  2166. {
  2167. if(isset($typeclass[$v]) && isset($bmpx[$typeclass[$v]['classid']]))
  2168. {
  2169. if($typeclass[$v]['bm'] != '')
  2170. {
  2171. $bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
  2172. }
  2173. }
  2174. if($v != 0 && isset($typeclass[$v]))
  2175. {
  2176. if($typeclass[$v]['classid'] == 13)
  2177. {
  2178. $dj = $typeclass[$v]['title'];
  2179. }
  2180. if($typeclass[$v]['classid'] == 8)
  2181. {
  2182. $ys = $typeclass[$v]['title'];
  2183. }
  2184. if($typeclass[$v]['classid'] == 15)
  2185. {
  2186. $hx = $typeclass[$v]['title'];
  2187. }
  2188. if(isset($pm[$typeclass[$v]['classid']]))
  2189. {
  2190. if($typeclass[$v]['title'] == '9A')
  2191. {
  2192. $pm[$typeclass[$v]['classid']] = '9A';
  2193. }
  2194. else if($typeclass[$v]['title'] == '10A')
  2195. {
  2196. $pm[$typeclass[$v]['classid']] = '10A';
  2197. }
  2198. else
  2199. {
  2200. $clzh = $typeclass[$v]['zh'];
  2201. if(stripos($typeclass[$v]['zh'],'|') !== false)
  2202. {
  2203. $clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
  2204. $clzh = $clzh[0];
  2205. }
  2206. $pm[$typeclass[$v]['classid']] = $clzh;
  2207. }
  2208. }
  2209. if(isset($jm[$typeclass[$v]['classid']]))
  2210. {
  2211. if($typeclass[$v]['jm'])
  2212. {
  2213. $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
  2214. }
  2215. }
  2216. }
  2217. }
  2218. $jm = array_filter($jm);//去除空值
  2219. $jm = implode("-",$jm);
  2220. $pm = array_filter($pm);//去除空值
  2221. $zh = implode(" ",$pm);
  2222. $zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
  2223. }
  2224. $info_listxw[$key]['jm'] = $jm;
  2225. $info_listxw[$key]['zh'] = $zh;
  2226. }
  2227. $title = '订单出库-'.date('Ymd',time());
  2228. $t = str_replace("<td>运单号</td>","<td>运单号</td><td>转单号</td>",$t);
  2229. $titlename = "<table border=1>".$t."<td>条数</td><td>料品</td><td>品名</td></table>";
  2230. $tail = "\n";
  2231. $filename = $title.".xls";
  2232. $this->excel->get_fz2(array_merge($info_list,$info_listtt,$info_listamz,$info_listxw,$info_listsmt),$titlename,$filename,$tail);
  2233. }
  2234. }
  2235. public function _cpexcel()
  2236. {
  2237. if(isset($_SESSION['api']))
  2238. {
  2239. $user = $this->user->get_api($_SESSION['api']);
  2240. $usp = $user;
  2241. $fgshop = "";$sid = "";$excelshop="";
  2242. $usersp = explode('|',trim($user['shop'],'|'));
  2243. foreach ($usersp as $value)
  2244. {
  2245. $fgshop .= " shop = ".$value." or";
  2246. $sid .= " id = ".$value." or";
  2247. }
  2248. $userexcel = explode('|',trim($user['excelshop'],'|'));
  2249. foreach ($userexcel as $value)
  2250. {
  2251. $excelshop .= " shop = ".$value." or";
  2252. }
  2253. if($excelshop != "")
  2254. {
  2255. $excelshop = "(".rtrim($excelshop,'or').")";
  2256. }
  2257. }
  2258. if(isset($_GET['excel']))
  2259. {
  2260. $timetk = $this->input->get('timetk',true);
  2261. $timetj = $this->input->get('timetj',true);
  2262. $shop = $this->input->get('shop',true);
  2263. $library = $this->input->get('library',true);
  2264. $type = $this->input->get('type',true);
  2265. $number = $this->input->get('number',true);
  2266. $orderinfo = $this->input->get('orderinfo',true);
  2267. $so = $this->input->get('so',true);
  2268. $number = $this->input->get('number',true);
  2269. $express = $this->input->get('express',true);
  2270. $timetk = strtotime($timetk);
  2271. $timetj = strtotime($timetj);
  2272. $where = "mergeid = 0";
  2273. if($timetk && $timetj && $library == 2)
  2274. {
  2275. $where .= " and librarytime > '$timetk' and librarytime < '$timetj'";
  2276. }
  2277. else
  2278. {
  2279. $where .= " and printtime > '$timetk' and printtime < '$timetj'";
  2280. }
  2281. if(isset($_SESSION['api']))
  2282. {
  2283. if($type)
  2284. {
  2285. $where .= " and type = '$type'";
  2286. }
  2287. else
  2288. {
  2289. $uw = '';
  2290. $u = $this->user->get_api($_SESSION['api']);
  2291. $u['warehouse'] = explode('|',trim($u['warehouse'],'|'));
  2292. foreach ($u['warehouse'] as $v)
  2293. {
  2294. $uw .= " type = '$v' or";
  2295. }
  2296. $uw = rtrim($uw,'or');
  2297. $uw = " and (".ltrim($uw,' ').")";
  2298. $where .= $uw;
  2299. }
  2300. }
  2301. else
  2302. {
  2303. echo json_encode(array('msg'=>'导出失败,请重新登陆!','success'=>false));exit;
  2304. }
  2305. if($shop)
  2306. {
  2307. $where .= " and shop = '$shop'";
  2308. }
  2309. else
  2310. {
  2311. $where .= " and ".$excelshop;
  2312. }
  2313. if($library)
  2314. {
  2315. $where .= " and library = '$library'";
  2316. }
  2317. if($number)
  2318. {
  2319. $where .= " and number = '$number'";
  2320. }
  2321. if($orderinfo)
  2322. {
  2323. $where .= " and orderinfo = '$orderinfo'";
  2324. }
  2325. if($so)
  2326. {
  2327. $where .= " and shipremarks like '%$so%'";
  2328. }
  2329. if($express)
  2330. {
  2331. $where .= " and express = '$express'";
  2332. }
  2333. /* 匹配ID加入 */
  2334. $tc = array();
  2335. $typeclass = $this->typeclass->find_all();
  2336. foreach ($typeclass as $v)
  2337. {
  2338. $tc[$v['id']] = $v['title'];
  2339. }
  2340. $shouldmoney=0;$expressmoney=0;$budget=0;$refundj=0;$refundj=0;$cost=0;$lr=0;
  2341. //取得信息列表
  2342. $info_lista = $this->fullordersmt->find_all($where,'fpdata');
  2343. $info_listb = $this->fullorder->find_all($where,'fpdata');
  2344. $info_list = array_merge($info_lista,$info_listb);
  2345. //格式化数据
  2346. $i = 0;$cpexcel = array();
  2347. foreach ($info_list as $key=>$value)
  2348. {
  2349. if(stripos($value['fpdata'],';') !== false)
  2350. {
  2351. $fpdata = explode(';',rtrim($value['fpdata'],';'));
  2352. foreach ($fpdata as $ke=>$va)
  2353. {
  2354. $title = '';
  2355. $fg = explode('|',$va);
  2356. $fg[0] = str_replace(array('163-','164-','165-','166-','-0-'),array('','','','','-'),$fg[0]);
  2357. $cp = explode('-',rtrim($fg[0],'-'));
  2358. if(isset($cp[2])){
  2359. $kw = $this->logic_u9tools->checkLengthLocal($fg[0]);
  2360. if($kw == 3){
  2361. if(isset($cp[3])){
  2362. $title = $tc[$cp[3]];
  2363. }else{
  2364. $dj = "";
  2365. }
  2366. }else{
  2367. $dj = $tc[$cp[2]];
  2368. }
  2369. }else{
  2370. $dj= "";
  2371. }
  2372. if(!isset($cp[3]))
  2373. {
  2374. $ys = json_encode($cp);
  2375. }
  2376. else
  2377. {
  2378. $ys = $tc[$cp[3]];
  2379. }
  2380. unset($cp[0],$cp[1],$cp[2],$cp[3]);
  2381. foreach ($cp as $v)
  2382. {
  2383. $title .= $tc[$v].' ';
  2384. }
  2385. $cpexcel[$ke] = array($fg[5],$dj,$ys,$title,$fg[2]);//内容,尺寸,等级,颜色,数量
  2386. }
  2387. }
  2388. $i++;
  2389. }
  2390. $title = "统计信息";
  2391. $titlename = "<table border=1>
  2392. <tr>
  2393. <td>尺寸</td>
  2394. <td>等级</td>
  2395. <td>颜色</td>
  2396. <td>花型</td>
  2397. <td>数量</td>
  2398. </tr>
  2399. </table>";
  2400. $filename = $title.".xls";
  2401. $tail = "\n";
  2402. $this->excel->get_fz2($cpexcel,$titlename,$filename,$tail);
  2403. }
  2404. }
  2405. public function _orderyz()
  2406. {
  2407. $post = $this->input->post(NULL, TRUE);
  2408. if(isset($post['yz']))
  2409. {
  2410. $yz = $this->input->post('yz',true);
  2411. $number = $this->input->post('number',true);
  2412. $y = $this->fullorder->get_number($number);
  2413. if(!$y)
  2414. {
  2415. $y = $this->fullordersmt->get_number($number);
  2416. if(!$y)
  2417. {
  2418. echo json_encode(array('msg'=>'没有找到此订单,请检查是否扫描错误','success'=>false));exit;
  2419. }
  2420. }
  2421. $whlabel = explode('|',trim($y['whlabel'],'|'));
  2422. foreach($whlabel as $k=>$v)
  2423. {
  2424. $w = explode('-',trim($v,'-'));
  2425. $wldata[$w[0]] = $w;
  2426. }
  2427. $whlabellabel = $this->whlabellabel->get_label($yz);
  2428. if(!$whlabellabel)
  2429. {
  2430. echo json_encode(array('msg'=>'没有找到此产品条码','success'=>false));exit;
  2431. }
  2432. else
  2433. {
  2434. if(isset($wldata[$whlabellabel['number']]))
  2435. {
  2436. if(!isset($wldata[$whlabellabel['number']][2]))
  2437. {
  2438. echo json_encode(array('msg'=>'此货物没有占单!','success'=>false));exit;
  2439. }
  2440. else if($wldata[$whlabellabel['number']][2] == 0)
  2441. {
  2442. echo json_encode(array('msg'=>'此货物没有占单!','success'=>false));exit;
  2443. }
  2444. }
  2445. else
  2446. {
  2447. echo json_encode(array('msg'=>'此订单中没有扫码产品!','success'=>false));exit;
  2448. }
  2449. echo json_encode(array('number'=>$whlabellabel['number'],'success'=>true));exit;
  2450. }
  2451. }
  2452. if(isset($post['number']))
  2453. {
  2454. $number = $this->input->post('number',true);
  2455. $f = 'fullorder';
  2456. $y = $this->fullorder->get_number($number);
  2457. if(!$y)
  2458. {
  2459. $f = 'fullordersmt';
  2460. $y = $this->fullordersmt->get_number($number);
  2461. if(!$y)
  2462. {
  2463. echo json_encode(array('msg'=>'没有找到此订单,请检查是否扫描错误','success'=>false));exit;
  2464. }
  2465. }
  2466. if($y['librarytime'] > 0)
  2467. {
  2468. echo json_encode(array('msg'=>'错误,此订单已出库!','success'=>false));exit;
  2469. }
  2470. $warehouse = $this->warehouse->read($y['type']);
  2471. if(stripos($y['whlabel'],$warehouse['hz']) === false)
  2472. {
  2473. echo json_encode(array('msg'=>'pz','success'=>false));exit;
  2474. }
  2475. $data = explode('|',trim($y['whlabel'],'|'));
  2476. $fpdata = explode(';',trim($y['fpdata'],';'));
  2477. $cp = array();$i = 0;$x=0;$byz = array();$znum = 0;
  2478. foreach($fpdata as $val)
  2479. {
  2480. $pm = array(13=>'',22=>'',8=>'',15=>'',18=>'','100'=>'',33=>'',34=>'',7=>'','dc'=>'','c'=>'',14=>'',12=>'',25=>'',26=>'',27=>'',10=>'',6=>'',9=>'',999=>'',9999=>'');
  2481. $scsku = array(13=>'',22=>'',8=>'',15=>'',18=>'','100'=>'',33=>'',34=>'',7=>'','dc'=>'','c'=>'',14=>'',12=>'',25=>'',26=>'',27=>'',10=>'',6=>'',9=>'',999=>'',9999=>'');
  2482. $fp = explode('|',$val);
  2483. $fp[0] = str_replace(',','-',$fp[0]);
  2484. $value = explode('-',$fp[0]);
  2485. foreach($value as $v)
  2486. {
  2487. $typeclass = $this->typeclass->read($v);
  2488. $zh = explode('|',trim($typeclass['zh'],'|'));
  2489. $pm[$typeclass['classid']] = $zh[0];
  2490. $scsku[$typeclass['classid']] = $typeclass['bqsku'];
  2491. }
  2492. $scsku = implode("-",$scsku);
  2493. $zh = implode(" ",$pm);
  2494. $zh = str_replace('自然色 ','',rtrim($zh,' '));
  2495. $scsku = str_replace('- ','-',trim($scsku,'-'));
  2496. $scsku = str_replace(array('--------','-------','------','-----','----','---','--'),'-',$scsku);
  2497. $zh = str_replace(array(' ',' ',' ',' ',' ',' ',' '),' ',$zh);
  2498. $data[$i] = explode('-',$data[$i]);
  2499. for($j=0;$j<$data[$i][1];$j++)
  2500. {
  2501. if(isset($data[$i][2]) && $warehouse['hz'] != '' && stripos($data[$i][2],$warehouse['hz']) !== false)
  2502. {
  2503. $znum++;//只计算现货
  2504. //$cp[$x] = array('id'=>$data[$i][0],'sku'=>$scsku,'zh'=>$zh,'t'=>'<span data-id="'.$data[$i][0].'">替换现货</sapn>','c'=>1,'color'=>'#333');//区别位置模式,暂不使用
  2505. $cp[] = array('id'=>$data[$i][0],'sku'=>$scsku,'zh'=>$zh,'y'=>'已占单','t'=>'<span data-id="'.$data[$i][0].'">替换现货</sapn>','c'=>1,'color'=>'#333');
  2506. }
  2507. else
  2508. {
  2509. //$cp[999+$x] = array('id'=>$data[$i][0],'sku'=>$scsku,'zh'=>$zh,'t'=>'<span data-id="'.$data[$i][0].'" style="background-color:#ccc">增加现货</sapn>','c'=>0,'color'=>'#999');//区别位置模式,暂不使用
  2510. $cp[] = array('id'=>$data[$i][0],'sku'=>$scsku,'zh'=>$zh,'y'=>'','t'=>'<span data-id="'.$data[$i][0].'" style="background-color:#e7ba08">增加现货</sapn>','c'=>0,'color'=>'#666');
  2511. }
  2512. $x++;//所有数量
  2513. }
  2514. $i++;
  2515. }
  2516. //ksort($cp);//区别位置模式,暂不使用
  2517. $cp = array_values($cp);
  2518. if($this->$f->save(array('yhs'=>1),$y['id']))
  2519. {
  2520. echo json_encode(array('rows'=>$cp,'z'=>$znum,'success'=>true));exit;
  2521. }
  2522. else
  2523. {
  2524. echo json_encode(array('msg'=>'处理信息失败,请重试','success'=>false));exit;
  2525. }
  2526. }
  2527. if(isset($post['tid']))
  2528. {
  2529. $typeclass = array();
  2530. $tc = $this->typeclass->find_all();
  2531. foreach($tc as $v)
  2532. {
  2533. $typeclass[$v['id']] = array('id'=>$v['id'],'classid'=>$v['classid'],'spare'=>$v['spare']);
  2534. }
  2535. $tid = $this->input->post('tid',true);
  2536. $id = $this->input->post('id',true);
  2537. $number = $this->input->post('n',true);
  2538. $ful = 'fullorder';
  2539. $y = $this->fullorder->get_number($number);
  2540. if(!$y)
  2541. {
  2542. $ful = 'fullordersmt';
  2543. $y = $this->fullordersmt->get_number($number);
  2544. if(!$y)
  2545. {
  2546. echo json_encode(array('msg'=>'没有找到此订单,请检查是否扫描错误','success'=>false));exit;
  2547. }
  2548. }
  2549. $wtid = $this->whlabellabel->get_label($tid);
  2550. if(!$wtid)
  2551. {
  2552. echo json_encode(array('msg'=>'没有找到此产品条码','success'=>false));exit;
  2553. }
  2554. $whlabel = explode('|',trim($y['whlabel'],'|'));
  2555. $fpdata = explode(';',trim($y['fpdata'],';'));
  2556. $warehouse = $this->warehouse->read($y['type']);
  2557. $zdkc = $warehouse['bdck'];
  2558. $ptc = $this->$zdkc->find_all("state = '0' and number = '".$wtid['number']."' and warehouse = '".$warehouse['id']."' and zd = '' and (shop IS NULL or shop = '')");//通用
  2559. $zsc = $this->$zdkc->find_all("state = '0' and number = '".$wtid['number']."' and warehouse = '".$warehouse['id']."' and zd = '' and shop like '%,".$y['shop'].",%'");//专属
  2560. if((count($ptc)+count($zsc)) < 1)
  2561. {
  2562. echo json_encode(array('msg'=>'录入的产品没有足够的库存!-'.(count($ptc)+count($zsc)),'success'=>false));exit;
  2563. }
  2564. $this->db->trans_begin();
  2565. $dataw = '';$dataf = '';$fhdata = array();$ww = '';$ff = '';$thff = '';
  2566. if($zsc)
  2567. {
  2568. $this->$zdkc->save(array('zd'=>$number),$zsc[0]['id']);
  2569. $xrid = $zsc[0]['id'];
  2570. }
  2571. else if($ptc)
  2572. {
  2573. $this->$zdkc->save(array('zd'=>$number),$ptc[0]['id']);
  2574. $xrid = $ptc[0]['id'];
  2575. }
  2576. $xr = $this->$zdkc->read($xrid);
  2577. $features = explode('-',trim($xr['features'],'-'));
  2578. $fhdata = array('sku'=>$xr['sku'],'title'=>$xr['title'],'id'=>$xr['features']);
  2579. foreach($features as $kk=>$v)
  2580. {
  2581. if($typeclass[$v]['classid'] == 14)
  2582. {
  2583. $cc = array('id'=>$typeclass[$v]['id'],'spare'=>$typeclass[$v]['spare']);
  2584. unset($kk);
  2585. }
  2586. }
  2587. $dataw = $tid.'-1-'.$xrid.$warehouse['hz'].'|';
  2588. $dataf = $cc['id'].',-'.implode("-",$features).'-|'.$xr['title'].' |1|0|0|'.$cc['spare'].'|0|0|0|'.$xr['id'].$warehouse['hz'].';';
  2589. $wldata = array();
  2590. $fdata = array();
  2591. foreach($whlabel as $k=>$v)
  2592. {
  2593. $w = explode('-',trim($v,'-'));
  2594. $wldata[$w[0]] = array('wz'=>$k,'sj'=>$w);
  2595. }
  2596. if(!isset($wldata[$id]))
  2597. {
  2598. echo json_encode(array('msg'=>'错误,未找到需要替换的产品,请重新扫发货单条码验货','success'=>false));exit;
  2599. }
  2600. if(isset($wldata[$wtid['number']]['sj']))
  2601. {
  2602. $tw = $wldata[$wtid['number']]['sj'];
  2603. if($wtid['number'] != $id)
  2604. {
  2605. echo json_encode(array('msg'=>'替换的产品已存在,请操作此产品','success'=>false));exit;
  2606. }
  2607. else
  2608. {
  2609. if(isset($tw[2]) && $tw[2] != 0)
  2610. {
  2611. echo json_encode(array('msg'=>'替换的产品已存在,并且已占单,无法操作替换!','success'=>false));exit;
  2612. }
  2613. }
  2614. if($tw[1] > 1)
  2615. {
  2616. echo json_encode(array('msg'=>'替换的产品已存在,并且已数量为大于1,无法操作替换!','success'=>false));exit;
  2617. }
  2618. }
  2619. $thfpdata = $y['thfpdata'];
  2620. $w = $wldata[$id]['sj'];
  2621. $f = explode('|',trim($fpdata[$wldata[$id]['wz']],'|'));
  2622. $zdkc = $warehouse['bdck'];
  2623. if($w[1] > 1)
  2624. {
  2625. if(isset($w[2]) && $w[2] != 0)
  2626. {
  2627. $hz = explode('~',trim($w[2],'~'));
  2628. $this->$zdkc->save(array('zd'=>''),trim($hz[0],$warehouse['hz']));
  2629. $zd = str_replace($hz[0],'',$w[2]);
  2630. $zd = trim($zd,'~');
  2631. $w[2] = $zd;
  2632. }
  2633. foreach($w as $kk=>$v)
  2634. {
  2635. if($kk == 1)
  2636. {
  2637. $v = $v-1;
  2638. }
  2639. $ww .= $v .'-';
  2640. }
  2641. $whlabel[$wldata[$id]['wz']] = trim($ww,'-');
  2642. foreach($f as $kk=>$v)
  2643. {
  2644. if($kk == 2)
  2645. {
  2646. $v = $v-1;
  2647. $thff .= '1|';
  2648. }
  2649. else
  2650. {
  2651. $thff .= $v .'|';
  2652. }
  2653. $ff .= $v .'|';
  2654. }
  2655. $fpdata[$wldata[$id]['wz']] = trim($ff,'|');
  2656. $thfpdata .= trim($thff,'|');
  2657. }
  2658. else
  2659. {
  2660. $thfpdata .= $fpdata[$wldata[$id]['wz']];
  2661. unset($whlabel[$wldata[$id]['wz']]);
  2662. unset($fpdata[$wldata[$id]['wz']]);
  2663. }
  2664. $thfpdata .= '~'.$dataf;
  2665. $whlabel = '|'.implode("|",$whlabel).'|'.$dataw;
  2666. $fpdata = implode(";",$fpdata).';'.$dataf;
  2667. $this->$ful->save(array('whlabel'=>$whlabel,'fpdata'=>$fpdata,'thfpdata'=>$thfpdata),$y['id']);
  2668. if ($this->db->trans_status() === TRUE)
  2669. {
  2670. $this->db->trans_commit();
  2671. echo json_encode(array('sku'=>$fhdata['sku'],'title'=>$fhdata['title'],'id'=>$fhdata['id'],'msg'=>321,'success'=>true));exit;
  2672. }
  2673. else
  2674. {
  2675. $this->db->trans_rollback();
  2676. echo json_encode(array('msg'=>'条码录入失败,请重试','success'=>false));exit;
  2677. }
  2678. }
  2679. if(isset($post['yhs']))
  2680. {
  2681. $f = 'fullorder';
  2682. $number = $this->input->post('yhs',true);
  2683. $y = $this->fullorder->get_number($number);
  2684. if(!$y)
  2685. {
  2686. $f = 'fullordersmt';
  2687. $y = $this->fullordersmt->get_number($number);
  2688. }
  2689. if($this->$f->save(array('yhs'=>0),$y['id']))
  2690. {
  2691. echo json_encode(array('success'=>true));exit;
  2692. }
  2693. else
  2694. {
  2695. echo json_encode(array('success'=>false));exit;
  2696. }
  2697. }
  2698. $this->_Template('systemfout_orderyz',$this->data);
  2699. }
  2700. public function _hwyz()
  2701. {
  2702. $post = $this->input->post(NULL, TRUE);
  2703. if(isset($post['yz']))
  2704. {
  2705. $yz = $this->input->post('yz',true);
  2706. $number = $this->input->post('number',true);
  2707. $y = $this->fullorder->get_number($number);
  2708. if(!$y)
  2709. {
  2710. $y = $this->fullordersmt->get_number($number);
  2711. if(!$y)
  2712. {
  2713. echo json_encode(array('msg'=>'没有找到此订单,请检查是否扫描错误','success'=>false));exit;
  2714. }
  2715. }
  2716. $whlabel = explode('|',trim($y['whlabel'],'|'));
  2717. foreach($whlabel as $k=>$v)
  2718. {
  2719. $w = explode('-',trim($v,'-'));
  2720. $wldata[$w[0]] = $w;
  2721. }
  2722. $whlabellabel = $this->whlabellabel->get_label($yz);
  2723. if(!$whlabellabel)
  2724. {
  2725. echo json_encode(array('msg'=>'没有找到此产品条码','success'=>false));exit;
  2726. }
  2727. else
  2728. {
  2729. if(isset($wldata[$whlabellabel['number']]))
  2730. {
  2731. if(!isset($wldata[$whlabellabel['number']][2]))
  2732. {
  2733. echo json_encode(array('msg'=>'此货物没有占单!','success'=>false));exit;
  2734. }
  2735. else if($wldata[$whlabellabel['number']][2] == 0)
  2736. {
  2737. echo json_encode(array('msg'=>'此货物没有占单!','success'=>false));exit;
  2738. }
  2739. }
  2740. else
  2741. {
  2742. echo json_encode(array('msg'=>'此订单中没有扫码产品!','success'=>false));exit;
  2743. }
  2744. echo json_encode(array('number'=>$whlabellabel['number'],'success'=>true));exit;
  2745. }
  2746. }
  2747. if(isset($post['number']))
  2748. {
  2749. $number = $this->input->post('number',true);
  2750. $f = 'fullorder';
  2751. $y = $this->fullorder->get_number($number);
  2752. if(!$y)
  2753. {
  2754. $f = 'fullordersmt';
  2755. $y = $this->fullordersmt->get_number($number);
  2756. if(!$y)
  2757. {
  2758. echo json_encode(array('msg'=>'没有找到此订单,请检查是否扫描错误','success'=>false));exit;
  2759. }
  2760. }
  2761. if($y['librarytime'] > 0)
  2762. {
  2763. echo json_encode(array('msg'=>'错误,此订单已出库!','success'=>false));exit;
  2764. }
  2765. $warehouse = $this->warehouse->read($y['type']);
  2766. $data = explode('|',trim($y['whlabel'],'|'));
  2767. $fpdata = explode(';',trim($y['fpdata'],';'));
  2768. $cp = array();$i = 0;$x=0;$byz = array();$znum = 0;
  2769. foreach($fpdata as $val)
  2770. {
  2771. $pm = array(13=>'',22=>'',8=>'',15=>'',18=>'','100'=>'',33=>'',34=>'',7=>'','dc'=>'','c'=>'',14=>'',12=>'',25=>'',26=>'',27=>'',10=>'',6=>'',9=>'',999=>'',9999=>'');
  2772. $scsku = array(13=>'',22=>'',8=>'',15=>'',18=>'','100'=>'',33=>'',34=>'',7=>'','dc'=>'','c'=>'',14=>'',12=>'',25=>'',26=>'',27=>'',10=>'',6=>'',9=>'',999=>'',9999=>'');
  2773. $fp = explode('|',$val);
  2774. $fp[0] = str_replace(',','-',$fp[0]);
  2775. $value = explode('-',$fp[0]);
  2776. foreach($value as $v)
  2777. {
  2778. $typeclass = $this->typeclass->read($v);
  2779. $zh = explode('|',trim($typeclass['zh'],'|'));
  2780. $pm[$typeclass['classid']] = $zh[0];
  2781. $scsku[$typeclass['classid']] = $typeclass['bqsku'];
  2782. }
  2783. $scsku = implode("-",$scsku);
  2784. $zh = implode(" ",$pm);
  2785. $zh = str_replace('自然色 ','',rtrim($zh,' '));
  2786. $scsku = str_replace('- ','-',trim($scsku,'-'));
  2787. $scsku = str_replace(array('--------','-------','------','-----','----','---','--'),'-',$scsku);
  2788. $zh = str_replace(array(' ',' ',' ',' ',' ',' ',' '),' ',$zh);
  2789. $data[$i] = explode('-',$data[$i]);
  2790. for($j=0;$j<$data[$i][1];$j++)
  2791. {
  2792. if(isset($data[$i][2]) && $warehouse['hz'] != '' && stripos($data[$i][2],$warehouse['hz']) !== false)
  2793. {
  2794. $znum++;//只计算现货
  2795. //$cp[$x] = array('id'=>$data[$i][0],'sku'=>$scsku,'zh'=>$zh,'t'=>'<span data-id="'.$data[$i][0].'">替换现货</sapn>','c'=>1,'color'=>'#333');//区别位置模式,暂不使用
  2796. $cp[] = array('id'=>$data[$i][0],'sku'=>$scsku,'zh'=>$zh,'y'=>'已占单','t'=>'<span data-id="'.$data[$i][0].'">替换现货</sapn>','c'=>1,'color'=>'#333');
  2797. }
  2798. else
  2799. {
  2800. //$cp[999+$x] = array('id'=>$data[$i][0],'sku'=>$scsku,'zh'=>$zh,'t'=>'<span data-id="'.$data[$i][0].'" style="background-color:#ccc">增加现货</sapn>','c'=>0,'color'=>'#999');//区别位置模式,暂不使用
  2801. $cp[] = array('id'=>$data[$i][0],'sku'=>$scsku,'zh'=>$zh,'y'=>'','t'=>'<span data-id="'.$data[$i][0].'" style="background-color:#e7ba08">增加现货</sapn>','c'=>0,'color'=>'#666');
  2802. }
  2803. $x++;//所有数量
  2804. }
  2805. $i++;
  2806. }
  2807. //ksort($cp);//区别位置模式,暂不使用
  2808. $cp = array_values($cp);
  2809. if($this->$f->save(array('yhs'=>1),$y['id']))
  2810. {
  2811. if(stripos($y['whlabel'],$warehouse['hz']) === false)
  2812. {
  2813. echo json_encode(array('rows'=>$cp,'z'=>$znum,'msg'=>'pz','success'=>false));exit;
  2814. }
  2815. echo json_encode(array('rows'=>$cp,'z'=>$znum,'success'=>true));exit;
  2816. }
  2817. else
  2818. {
  2819. echo json_encode(array('msg'=>'处理信息失败,请重试','success'=>false));exit;
  2820. }
  2821. }
  2822. if(isset($post['tid']))
  2823. {
  2824. $typeclass = array();
  2825. $tc = $this->typeclass->find_all();
  2826. foreach($tc as $v)
  2827. {
  2828. $typeclass[$v['id']] = array('id'=>$v['id'],'classid'=>$v['classid'],'spare'=>$v['spare']);
  2829. }
  2830. $tid = $this->input->post('tid',true);
  2831. $id = $this->input->post('id',true);
  2832. $number = $this->input->post('n',true);
  2833. $ful = 'fullorder';
  2834. $y = $this->fullorder->get_number($number);
  2835. if(!$y)
  2836. {
  2837. $ful = 'fullordersmt';
  2838. $y = $this->fullordersmt->get_number($number);
  2839. if(!$y)
  2840. {
  2841. echo json_encode(array('msg'=>'没有找到此订单,请检查是否扫描错误','success'=>false));exit;
  2842. }
  2843. }
  2844. $wtid = $this->whlabellabel->get_label($tid);
  2845. if(!$wtid)
  2846. {
  2847. echo json_encode(array('msg'=>'没有找到此产品条码','success'=>false));exit;
  2848. }
  2849. $whlabel = explode('|',trim($y['whlabel'],'|'));
  2850. $fpdata = explode(';',trim($y['fpdata'],';'));
  2851. $warehouse = $this->warehouse->read($y['type']);
  2852. $zdkc = $warehouse['bdck'];
  2853. $ptc = $this->$zdkc->find_all("state = '0' and number = '".$wtid['number']."' and warehouse = '".$warehouse['id']."' and zd = '' and (shop IS NULL or shop = '')");//通用
  2854. $zsc = $this->$zdkc->find_all("state = '0' and number = '".$wtid['number']."' and warehouse = '".$warehouse['id']."' and zd = '' and shop like '%,".$y['shop'].",%'");//专属
  2855. if((count($ptc)+count($zsc)) < 1)
  2856. {
  2857. echo json_encode(array('msg'=>'录入的产品没有足够的库存!-'.(count($ptc)+count($zsc)),'success'=>false));exit;
  2858. }
  2859. $this->db->trans_begin();
  2860. $dataw = '';$dataf = '';$fhdata = array();$ww = '';$ff = '';$thff = '';
  2861. if($zsc)
  2862. {
  2863. $this->$zdkc->save(array('zd'=>$number),$zsc[0]['id']);
  2864. $xrid = $zsc[0]['id'];
  2865. }
  2866. else if($ptc)
  2867. {
  2868. $this->$zdkc->save(array('zd'=>$number),$ptc[0]['id']);
  2869. $xrid = $ptc[0]['id'];
  2870. }
  2871. $xr = $this->$zdkc->read($xrid);
  2872. $features = explode('-',trim($xr['features'],'-'));
  2873. $fhdata = array('sku'=>$xr['sku'],'title'=>$xr['title'],'id'=>$xr['features']);
  2874. foreach($features as $kk=>$v)
  2875. {
  2876. if($typeclass[$v]['classid'] == 14)
  2877. {
  2878. $cc = array('id'=>$typeclass[$v]['id'],'spare'=>$typeclass[$v]['spare']);
  2879. unset($kk);
  2880. }
  2881. }
  2882. $dataw = $tid.'-1-'.$xrid.$warehouse['hz'].'|';
  2883. $dataf = $cc['id'].',-'.implode("-",$features).'-|'.$xr['title'].' |1|0|0|'.$cc['spare'].'|0|0|0|'.$xr['id'].$warehouse['hz'].';';
  2884. $wldata = array();
  2885. $fdata = array();
  2886. foreach($whlabel as $k=>$v)
  2887. {
  2888. $w = explode('-',trim($v,'-'));
  2889. $wldata[$w[0]] = array('wz'=>$k,'sj'=>$w);
  2890. }
  2891. if(!isset($wldata[$id]))
  2892. {
  2893. echo json_encode(array('msg'=>'错误,未找到需要替换的产品,请重新扫发货单条码验货','success'=>false));exit;
  2894. }
  2895. if(isset($wldata[$wtid['number']]['sj']))
  2896. {
  2897. $tw = $wldata[$wtid['number']]['sj'];
  2898. if($wtid['number'] != $id)
  2899. {
  2900. echo json_encode(array('msg'=>'替换的产品已存在,请操作此产品','success'=>false));exit;
  2901. }
  2902. else
  2903. {
  2904. if(isset($tw[2]) && $tw[2] != 0)
  2905. {
  2906. echo json_encode(array('msg'=>'替换的产品已存在,并且已占单,无法操作替换!','success'=>false));exit;
  2907. }
  2908. }
  2909. if($tw[1] > 1)
  2910. {
  2911. echo json_encode(array('msg'=>'替换的产品已存在,并且已数量为大于1,无法操作替换!','success'=>false));exit;
  2912. }
  2913. }
  2914. $thfpdata = $y['thfpdata'];
  2915. $w = $wldata[$id]['sj'];
  2916. $f = explode('|',trim($fpdata[$wldata[$id]['wz']],'|'));
  2917. $zdkc = $warehouse['bdck'];
  2918. if($w[1] > 1)
  2919. {
  2920. if(isset($w[2]) && $w[2] != 0)
  2921. {
  2922. $hz = explode('~',trim($w[2],'~'));
  2923. $this->$zdkc->save(array('zd'=>''),trim($hz[0],$warehouse['hz']));
  2924. $zd = str_replace($hz[0],'',$w[2]);
  2925. $zd = trim($zd,'~');
  2926. $w[2] = $zd;
  2927. }
  2928. foreach($w as $kk=>$v)
  2929. {
  2930. if($kk == 1)
  2931. {
  2932. $v = $v-1;
  2933. }
  2934. $ww .= $v .'-';
  2935. }
  2936. $whlabel[$wldata[$id]['wz']] = trim($ww,'-');
  2937. foreach($f as $kk=>$v)
  2938. {
  2939. if($kk == 2)
  2940. {
  2941. $v = $v-1;
  2942. $thff .= '1|';
  2943. }
  2944. else
  2945. {
  2946. $thff .= $v .'|';
  2947. }
  2948. $ff .= $v .'|';
  2949. }
  2950. $fpdata[$wldata[$id]['wz']] = trim($ff,'|');
  2951. $thfpdata .= trim($thff,'|');
  2952. }
  2953. else
  2954. {
  2955. $thfpdata .= $fpdata[$wldata[$id]['wz']];
  2956. unset($whlabel[$wldata[$id]['wz']]);
  2957. unset($fpdata[$wldata[$id]['wz']]);
  2958. }
  2959. $thfpdata .= '~'.$dataf;
  2960. $whlabel = '|'.implode("|",$whlabel).'|'.$dataw;
  2961. $fpdata = implode(";",$fpdata).';'.$dataf;
  2962. $this->$ful->save(array('whlabel'=>$whlabel,'fpdata'=>$fpdata,'thfpdata'=>$thfpdata),$y['id']);
  2963. if ($this->db->trans_status() === TRUE)
  2964. {
  2965. $this->db->trans_commit();
  2966. echo json_encode(array('sku'=>$fhdata['sku'],'title'=>$fhdata['title'],'id'=>$fhdata['id'],'msg'=>321,'success'=>true));exit;
  2967. }
  2968. else
  2969. {
  2970. $this->db->trans_rollback();
  2971. echo json_encode(array('msg'=>'条码录入失败,请重试','success'=>false));exit;
  2972. }
  2973. }
  2974. if(isset($post['yhs']))
  2975. {
  2976. $f = 'fullorder';
  2977. $number = $this->input->post('yhs',true);
  2978. $y = $this->fullorder->get_number($number);
  2979. if(!$y)
  2980. {
  2981. $f = 'fullordersmt';
  2982. $y = $this->fullordersmt->get_number($number);
  2983. }
  2984. if($this->$f->save(array('yhs'=>0),$y['id']))
  2985. {
  2986. echo json_encode(array('success'=>true));exit;
  2987. }
  2988. else
  2989. {
  2990. echo json_encode(array('success'=>false));exit;
  2991. }
  2992. }
  2993. $this->_Template('systemfout_hwyz',$this->data);
  2994. }
  2995. public function _fouthb()
  2996. {
  2997. $post = $this->input->post(NULL, TRUE);
  2998. $xw = '';
  2999. if(isset($_SESSION['api']))
  3000. {
  3001. $user = $this->user->get_api($_SESSION['api']);
  3002. $usp = $user;
  3003. $fgshop = "";$sid = "";$wid="";$wtype="";
  3004. $usersp = explode('|',trim($user['shop'],'|'));
  3005. $userwh = explode('|',trim($user['warehouse'],'|'));
  3006. foreach ($usersp as $value)
  3007. {
  3008. $fgshop .= " shop = ".$value." or";
  3009. $sid .= " id = ".$value." or";
  3010. }
  3011. foreach ($userwh as $value)
  3012. {
  3013. $wid .= " id = ".$value." or";
  3014. $wtype .= " type = ".$value." or";
  3015. }
  3016. if($user['userid'] == 'xw')
  3017. {
  3018. $xw = 1;
  3019. }
  3020. }
  3021. if(isset($post['page']))
  3022. {
  3023. $page = $this->input->post('page',true);
  3024. $perpage = $this->input->post('perpage',true);
  3025. $timetk = $this->input->post('timetk',true);
  3026. $timetj = $this->input->post('timetj',true);
  3027. $shop = $this->input->post('shop',true);
  3028. $type = $this->input->post('type',true);
  3029. $express = $this->input->post('express',true);
  3030. $number = $this->input->post('number',true);
  3031. $waybill = $this->input->post('waybill',true);
  3032. $librarytime = $this->input->post('librarytime',true);
  3033. $timetk = strtotime($timetk);
  3034. $timetj = strtotime($timetj);
  3035. $where = "mergeid = '1'";
  3036. $where .= " and librarytime > '$timetk' and librarytime < '$timetj'";
  3037. if($shop)
  3038. {
  3039. $where .= " and shop = '$shop'";
  3040. }
  3041. if($number)
  3042. {
  3043. $where .= " and number like '$number%'";
  3044. }
  3045. if($waybill)
  3046. {
  3047. $where .= " and waybill = '$waybill'";
  3048. }
  3049. if($type)
  3050. {
  3051. $where .= " and type = '$type'";
  3052. }
  3053. if($express)
  3054. {
  3055. $where .= " and express = '$express'";
  3056. }
  3057. //数据排序
  3058. $order_str = "librarytime desc";
  3059. if(empty($page))
  3060. {
  3061. $start = 0;
  3062. $perpage = 1;
  3063. }
  3064. else
  3065. {
  3066. $start = ($page - 1)*$perpage;
  3067. }
  3068. //取得信息列表
  3069. $info_list = $this->fullorder->find_all($where,'id,shop,number,waybill,express,librarytime',$order_str,$start,$perpage);
  3070. //格式化数据
  3071. foreach ($info_list as $key=>$value)
  3072. {
  3073. $shop = $this->shop->read($value['shop']);
  3074. $info_list[$key]['shop'] = $shop['shopname'];
  3075. $express = $this->express->read($value['express']);
  3076. $info_list[$key]['express'] = $express['servicename'];
  3077. $warehouse = $this->warehouse->read($value['type']);
  3078. $info_list[$key]['type'] = $warehouse['title'];
  3079. $info_list[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i',$value['librarytime']).'</em>';
  3080. }
  3081. $info_listtt = $this->fullordertt->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks',$order_str,$start,$perpage);
  3082. //格式化数据
  3083. foreach ($info_listtt as $key=>$value)
  3084. {
  3085. $shop = $this->shop->read($value['shop']);
  3086. $info_listtt[$key]['shop'] = $shop['shopname'];
  3087. $express = $this->express->read($value['express']);
  3088. $info_listtt[$key]['express'] = $express['servicename'];
  3089. $warehouse = $this->warehouse->read($value['type']);
  3090. $info_listtt[$key]['type'] = $warehouse['title'];
  3091. $info_listtt[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  3092. }
  3093. $info_listamz = $this->fullorderamz->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks',$order_str,$start,$perpage);
  3094. //格式化数据
  3095. foreach ($info_listamz as $key=>$value)
  3096. {
  3097. $shop = $this->shop->read($value['shop']);
  3098. $info_listamz[$key]['shop'] = $shop['shopname'];
  3099. $express = $this->express->read($value['express']);
  3100. $info_listamz[$key]['express'] = $express['servicename'];
  3101. $warehouse = $this->warehouse->read($value['type']);
  3102. $info_listamz[$key]['type'] = $warehouse['title'];
  3103. $info_listamz[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  3104. }
  3105. $info_listxw = $this->fullorderxw->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks',$order_str,$start,$perpage);
  3106. //格式化数据
  3107. foreach ($info_listxw as $key=>$value)
  3108. {
  3109. $shop = $this->shop->read($value['shop']);
  3110. $info_listxw[$key]['shop'] = $shop['shopname'];
  3111. $express = $this->express->read($value['express']);
  3112. $info_listxw[$key]['express'] = $express['servicename'];
  3113. $warehouse = $this->warehouse->read($value['type']);
  3114. $info_listxw[$key]['type'] = $warehouse['title'];
  3115. $info_listxw[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  3116. }
  3117. $info_listsmt = $this->fullordersmt->find_all($where." and mergeid = '0'",'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks',$order_str,$start,$perpage);
  3118. //格式化数据
  3119. foreach ($info_listsmt as $key=>$value)
  3120. {
  3121. $shop = $this->shop->read($value['shop']);
  3122. $info_listsmt[$key]['shop'] = $shop['shopname'];
  3123. $express = $this->express->read($value['express']);
  3124. $info_listsmt[$key]['express'] = $express['servicename'];
  3125. $warehouse = $this->warehouse->read($value['type']);
  3126. $info_listsmt[$key]['type'] = $warehouse['title'];
  3127. $info_listsmt[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  3128. }
  3129. $total = $this->fullorder->find_count($where);
  3130. $total += $this->fullordertt->find_count($where);
  3131. $total += $this->fullorderamz->find_count($where);
  3132. $total += $this->fullorderxw->find_count($where);
  3133. $total += $this->fullordersmt->find_count($where);
  3134. $pagenum = ceil($total/$perpage);
  3135. $over = $total-($start+$perpage);
  3136. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>(array_merge($info_list,$info_listamz,$info_listtt,$info_listxw,$info_listsmt)));
  3137. echo json_encode($rows);exit;
  3138. }
  3139. if(isset($_SESSION['api']))
  3140. {
  3141. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  3142. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  3143. $this->data['wlshop'] = $wlshop;
  3144. $this->data['warehouse'] = $warehouse;
  3145. }
  3146. $this->data['xw'] = $xw;
  3147. $this->_Template('systemfout_fouthb',$this->data);
  3148. }
  3149. public function _hb()
  3150. {
  3151. $post = $this->input->post(NULL, TRUE);
  3152. $xw = '';
  3153. if(isset($_SESSION['api']))
  3154. {
  3155. $user = $this->user->get_api($_SESSION['api']);
  3156. $usp = $user;
  3157. $fgshop = "";$sid = "";$wid="";$wtype="";
  3158. $usersp = explode('|',trim($user['shop'],'|'));
  3159. $userwh = explode('|',trim($user['warehouse'],'|'));
  3160. foreach ($usersp as $value)
  3161. {
  3162. $fgshop .= " shop = ".$value." or";
  3163. $sid .= " id = ".$value." or";
  3164. }
  3165. foreach ($userwh as $value)
  3166. {
  3167. $wid .= " id = ".$value." or";
  3168. $wtype .= " type = ".$value." or";
  3169. }
  3170. if($user['userid'] == 'xw')
  3171. {
  3172. $xw = 1;
  3173. }
  3174. }
  3175. if(isset($post['page']))
  3176. {
  3177. $page = $this->input->post('page',true);
  3178. $perpage = $this->input->post('perpage',true);
  3179. $timetk = $this->input->post('timetk',true);
  3180. $timetj = $this->input->post('timetj',true);
  3181. $shop = $this->input->post('shop',true);
  3182. $source = $this->input->post('source',true);
  3183. $orderinfo = $this->input->post('orderinfo',true);
  3184. $number = $this->input->post('number',true);
  3185. $library = $this->input->post('library',true);
  3186. $waybill = $this->input->post('waybill',true);
  3187. $express = $this->input->post('express',true);
  3188. $type = $this->input->post('type',true);
  3189. $lowe = $this->input->post('lowe',true);
  3190. $so = $this->input->post('so',true);
  3191. $librarytime = $this->input->post('librarytime',true);
  3192. $timetk = strtotime($timetk);
  3193. $timetj = strtotime($timetj);
  3194. $cxtime = 'id';
  3195. $where = (isset($_SESSION['api']))?"library!=3 and mergeid = 1 and libraryconfirm=2 and print = 3 and (".rtrim($wtype,'or').")":"id = '0' and mergeid = 1";
  3196. if($timetk && $timetj && $library == 1)
  3197. {
  3198. //$cxtime = 'reviewtime';
  3199. $where .= " and printtime > '$timetk - 180*24*3600' and printtime < '$timetj'";
  3200. $where .= " and state != 217";
  3201. }
  3202. else if($timetk && $timetj && $library == 2)
  3203. {
  3204. $cxtime = 'librarytime';
  3205. $where .= " and librarytime > '$timetk' and librarytime < '$timetj'";
  3206. }
  3207. if($shop)
  3208. {
  3209. $where .= " and shop = '$shop'";
  3210. }
  3211. if($number)
  3212. {
  3213. $where .= " and number = '$number'";
  3214. }
  3215. if($library)
  3216. {
  3217. $where .= " and library = '$library'";
  3218. }
  3219. if($waybill)
  3220. {
  3221. $where .= " and waybill = '$waybill'";
  3222. }
  3223. if($express)
  3224. {
  3225. $where .= " and express = '$express'";
  3226. }
  3227. if($orderinfo)
  3228. {
  3229. $where .= " and orderinfo = '$orderinfo'";
  3230. }
  3231. if($type)
  3232. {
  3233. $where .= " and type = '$type'";
  3234. }
  3235. if($lowe)
  3236. {
  3237. $where .= " and shipremarks like '%$lowe%'";
  3238. }
  3239. if($so)
  3240. {
  3241. $where .= " and shipremarks like '%$so%'";
  3242. }
  3243. //数据排序
  3244. $order_str = $cxtime." desc";
  3245. if(empty($page))
  3246. {
  3247. $start = 0;
  3248. $perpage = 1;
  3249. }
  3250. else
  3251. {
  3252. $start = ($page - 1)*$perpage;
  3253. }
  3254. //取得信息列表
  3255. $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str);
  3256. //格式化数据
  3257. // foreach ($info_list as $key=>$value)
  3258. // {
  3259. // $shop = $this->shop->read($value['shop']);
  3260. // $info_list[$key]['shop'] = $shop['shopname'];
  3261. // if($value['waybill'] == '0')
  3262. // {
  3263. // $info_list[$key]['waybill'] = "";
  3264. // }
  3265. // $express = $this->express->read($value['express']);
  3266. // $info_list[$key]['express'] = $express['servicename'];
  3267. // $warehouse = $this->warehouse->read($value['type']);
  3268. // $info_list[$key]['type'] = $warehouse['title'];
  3269. // if($value['print'] == 1)
  3270. // {
  3271. // $info_list[$key]['print'] = '不可打印';
  3272. // }
  3273. // else if($value['print'] == 2)
  3274. // {
  3275. // $info_list[$key]['print'] = '未打印';
  3276. // }
  3277. // else if($value['print'] == 3)
  3278. // {
  3279. // $info_list[$key]['print'] = '已打印';
  3280. // }
  3281. // if($value['library'] == 1)
  3282. // {
  3283. // $info_list[$key]['library'] = '<em class="c">未出库</em>';
  3284. // }
  3285. // else if($value['library'] == 2)
  3286. // {
  3287. // $info_list[$key]['library'] = '<em class="c">已出库</em>';
  3288. // }
  3289. // else if($value['library'] == 3)
  3290. // {
  3291. // $info_list[$key]['library'] = '<em class="c">已退库</em>';
  3292. // }
  3293. // if($value['librarytime'] == '0')
  3294. // {
  3295. // $info_list[$key]['librarytime'] = '<em class="t"></em>';
  3296. // }
  3297. // else
  3298. // {
  3299. // $info_list[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i',$value['librarytime']).'</em>';
  3300. // }
  3301. // $info_list[$key]['orderremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['orderremarks']);
  3302. // }
  3303. $info_listtt = $this->fullordertt->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str);
  3304. //格式化数据
  3305. // foreach ($info_listtt as $key=>$value)
  3306. // {
  3307. // $shop = $this->shop->read($value['shop']);
  3308. // $info_listtt[$key]['shop'] = $shop['shopname'];
  3309. // if($value['waybill'] == '0')
  3310. // {
  3311. // $info_listtt[$key]['waybill'] = "";
  3312. // }
  3313. // $express = $this->express->read($value['express']);
  3314. // $info_listtt[$key]['express'] = $express['servicename'];
  3315. // $warehouse = $this->warehouse->read($value['type']);
  3316. // $info_listtt[$key]['type'] = $warehouse['title'];
  3317. // if($value['print'] == 1)
  3318. // {
  3319. // $info_listtt[$key]['print'] = '不可打印';
  3320. // }
  3321. // else if($value['print'] == 2)
  3322. // {
  3323. // $info_listtt[$key]['print'] = '未打印';
  3324. // }
  3325. // else if($value['print'] == 3)
  3326. // {
  3327. // $info_listtt[$key]['print'] = '已打印';
  3328. // }
  3329. // if($value['library'] == 1)
  3330. // {
  3331. // $info_listtt[$key]['library'] = '<em class="c">未出库</em>';
  3332. // }
  3333. // else if($value['library'] == 2)
  3334. // {
  3335. // $info_listtt[$key]['library'] = '<em class="c">已出库</em>';
  3336. // }
  3337. // else if($value['library'] == 3)
  3338. // {
  3339. // $info_listtt[$key]['library'] = '<em class="c">已退库</em>';
  3340. // }
  3341. // if($value['librarytime'] == '0')
  3342. // {
  3343. // $info_listtt[$key]['librarytime'] = '<em class="t"></em>';
  3344. // }
  3345. // else
  3346. // {
  3347. // $info_listtt[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  3348. // }
  3349. // }
  3350. $info_listamz = $this->fullorderamz->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str);
  3351. //格式化数据
  3352. // foreach ($info_listamz as $key=>$value)
  3353. // {
  3354. // $shop = $this->shop->read($value['shop']);
  3355. // $info_listamz[$key]['shop'] = $shop['shopname'];
  3356. // if($value['waybill'] == '0')
  3357. // {
  3358. // $info_listamz[$key]['waybill'] = "";
  3359. // }
  3360. // $express = $this->express->read($value['express']);
  3361. // $info_listamz[$key]['express'] = $express['servicename'];
  3362. // $warehouse = $this->warehouse->read($value['type']);
  3363. // $info_listamz[$key]['type'] = $warehouse['title'];
  3364. // if($value['print'] == 1)
  3365. // {
  3366. // $info_listamz[$key]['print'] = '不可打印';
  3367. // }
  3368. // else if($value['print'] == 2)
  3369. // {
  3370. // $info_listamz[$key]['print'] = '未打印';
  3371. // }
  3372. // else if($value['print'] == 3)
  3373. // {
  3374. // $info_listamz[$key]['print'] = '已打印';
  3375. // }
  3376. // if($value['library'] == 1)
  3377. // {
  3378. // $info_listamz[$key]['library'] = '<em class="c">未出库</em>';
  3379. // }
  3380. // else if($value['library'] == 2)
  3381. // {
  3382. // $info_listamz[$key]['library'] = '<em class="c">已出库</em>';
  3383. // }
  3384. // else if($value['library'] == 3)
  3385. // {
  3386. // $info_listamz[$key]['library'] = '<em class="c">已退库</em>';
  3387. // }
  3388. // if($value['librarytime'] == '0')
  3389. // {
  3390. // $info_listamz[$key]['librarytime'] = '<em class="t"></em>';
  3391. // }
  3392. // else
  3393. // {
  3394. // $info_listamz[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  3395. // }
  3396. // }
  3397. $info_listxw = $this->fullorderxw->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str);
  3398. //格式化数据
  3399. // foreach ($info_listxw as $key=>$value)
  3400. // {
  3401. // $shop = $this->shop->read($value['shop']);
  3402. // $info_listxw[$key]['shop'] = $shop['shopname'];
  3403. // if($value['waybill'] == '0')
  3404. // {
  3405. // $info_listxw[$key]['waybill'] = "";
  3406. // }
  3407. // $express = $this->express->read($value['express']);
  3408. // $info_listxw[$key]['express'] = $express['servicename'];
  3409. // $warehouse = $this->warehouse->read($value['type']);
  3410. // $info_listxw[$key]['type'] = $warehouse['title'];
  3411. // if($value['print'] == 1)
  3412. // {
  3413. // $info_listxw[$key]['print'] = '不可打印';
  3414. // }
  3415. // else if($value['print'] == 2)
  3416. // {
  3417. // $info_listxw[$key]['print'] = '未打印';
  3418. // }
  3419. // else if($value['print'] == 3)
  3420. // {
  3421. // $info_listxw[$key]['print'] = '已打印';
  3422. // }
  3423. // if($value['library'] == 1)
  3424. // {
  3425. // $info_listxw[$key]['library'] = '<em class="c">未出库</em>';
  3426. // }
  3427. // else if($value['library'] == 2)
  3428. // {
  3429. // $info_listxw[$key]['library'] = '<em class="c">已出库</em>';
  3430. // }
  3431. // else if($value['library'] == 3)
  3432. // {
  3433. // $info_listxw[$key]['library'] = '<em class="c">已退库</em>';
  3434. // }
  3435. // if($value['librarytime'] == '0')
  3436. // {
  3437. // $info_listxw[$key]['librarytime'] = '<em class="t"></em>';
  3438. // }
  3439. // else
  3440. // {
  3441. // $info_listxw[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  3442. // }
  3443. // }
  3444. $info_listsmt = $this->fullordersmt->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str);
  3445. //格式化数据
  3446. // foreach ($info_listsmt as $key=>$value)
  3447. // {
  3448. // $shop = $this->shop->read($value['shop']);
  3449. // $info_listsmt[$key]['shop'] = $shop['shopname'];
  3450. // if($value['waybill'] == '0')
  3451. // {
  3452. // $info_listsmt[$key]['waybill'] = "";
  3453. // }
  3454. // $express = $this->express->read($value['express']);
  3455. // $info_listsmt[$key]['express'] = $express['servicename'];
  3456. // $warehouse = $this->warehouse->read($value['type']);
  3457. // $info_listsmt[$key]['type'] = $warehouse['title'];
  3458. // if($value['print'] == 1)
  3459. // {
  3460. // $info_listsmt[$key]['print'] = '不可打印';
  3461. // }
  3462. // else if($value['print'] == 2)
  3463. // {
  3464. // $info_listsmt[$key]['print'] = '未打印';
  3465. // }
  3466. // else if($value['print'] == 3)
  3467. // {
  3468. // $info_listsmt[$key]['print'] = '已打印';
  3469. // }
  3470. // if($value['library'] == 1)
  3471. // {
  3472. // $info_listsmt[$key]['library'] = '<em class="c">未出库</em>';
  3473. // }
  3474. // else if($value['library'] == 2)
  3475. // {
  3476. // $info_listsmt[$key]['library'] = '<em class="c">已出库</em>';
  3477. // }
  3478. // else if($value['library'] == 3)
  3479. // {
  3480. // $info_listsmt[$key]['library'] = '<em class="c">已退库</em>';
  3481. // }
  3482. // if($value['librarytime'] == '0')
  3483. // {
  3484. // $info_listsmt[$key]['librarytime'] = '<em class="t"></em>';
  3485. // }
  3486. // else
  3487. // {
  3488. // $info_listsmt[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  3489. // }
  3490. // }
  3491. // $total = $this->fullorder->find_count($where);
  3492. // $total += $this->fullordertt->find_count($where);
  3493. // $total += $this->fullorderamz->find_count($where);
  3494. // $total += $this->fullorderxw->find_count($where);
  3495. // $total += $this->fullordersmt->find_count($where);
  3496. $total_list = array_merge($info_list,$info_listtt,$info_listamz,$info_listxw,$info_listsmt);
  3497. $sort_list = [];
  3498. foreach($total_list as $key => $value){
  3499. $tmp_librarytime = (int)($value['librarytime']."0000");
  3500. if(isset($sort_list[$tmp_librarytime])){
  3501. $tmp_librarytime =(int)($value['librarytime'].rand(1000,9999));
  3502. $sort_list[$tmp_librarytime] = $value;
  3503. }else{
  3504. $sort_list[$tmp_librarytime] = $value;
  3505. }
  3506. }
  3507. krsort($sort_list);
  3508. if(!empty($sort_list)){
  3509. $split_list = array_chunk($sort_list, $perpage, true);
  3510. $shop_list = $this->shop->find_all('1=1');
  3511. $shop_arr = array_column($shop_list,'shopname','id');
  3512. $express_list = $this->express->find_all('1=1');
  3513. $express_arr = array_column($express_list,'servicename','id');
  3514. $warehouse_list = $this->warehouse->find_all('1=1');
  3515. $warehouse_arr = array_column($warehouse_list,'title','id');
  3516. $final_list = $split_list[$page-1];
  3517. foreach ($final_list as $key=>$value)
  3518. {
  3519. $final_list[$key]['shop'] = isset($shop_arr[$value['shop']])? $shop_arr[$value['shop']] :"";
  3520. if($value['waybill'] == '0')
  3521. {
  3522. $final_list[$key]['waybill'] = "";
  3523. }
  3524. $final_list[$key]['express'] = isset($express_arr[$value['express']])? $express_arr[$value['express']] :"";
  3525. $final_list[$key]['type'] = isset($warehouse_arr[$value['type']])? $warehouse_arr[$value['type']] :"";
  3526. if($value['print'] == 1)
  3527. {
  3528. $final_list[$key]['print'] = '不可打印';
  3529. }
  3530. else if($value['print'] == 2)
  3531. {
  3532. $final_list[$key]['print'] = '未打印';
  3533. }
  3534. else if($value['print'] == 3)
  3535. {
  3536. $final_list[$key]['print'] = '已打印';
  3537. }
  3538. if($value['library'] == 1)
  3539. {
  3540. $final_list[$key]['library'] = '<em class="c">未出库</em>';
  3541. }
  3542. else if($value['library'] == 2)
  3543. {
  3544. $final_list[$key]['library'] = '<em class="c">已出库</em>';
  3545. }
  3546. else if($value['library'] == 3)
  3547. {
  3548. $final_list[$key]['library'] = '<em class="c">已退库</em>';
  3549. }
  3550. if($value['librarytime'] == '0')
  3551. {
  3552. $final_list[$key]['librarytime'] = '<em class="t"></em>';
  3553. }
  3554. else
  3555. {
  3556. $final_list[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
  3557. }
  3558. }
  3559. $final_list = array_values($final_list);
  3560. }else{
  3561. $final_list = [];
  3562. }
  3563. $total = count($total_list);
  3564. $pagenum = ceil($total/$perpage);
  3565. $over = $total-($start+$perpage);
  3566. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($final_list));
  3567. echo json_encode($rows);exit;
  3568. }
  3569. if(isset($_SESSION['api']))
  3570. {
  3571. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  3572. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  3573. $this->data['wlshop'] = $wlshop;
  3574. $this->data['warehouse'] = $warehouse;
  3575. }
  3576. $this->data['xw'] = $xw;
  3577. $this->_Template('systemfout_hb',$this->data);
  3578. }
  3579. }