Systemfout.php 124 KB

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