Aayytest.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Aayytest extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->library('session');
  6. $this->load->_model('Model_api','api');
  7. $this->load->_model('Model_shop','shop');
  8. $this->load->_model('Model_fullorder','fullorder');
  9. $this->load->_model('Model_fullordertt','fullordertt');
  10. $this->load->_model('Model_fullordersmt','fullordersmt');
  11. $this->load->_model('Model_country','country');
  12. $this->load->_model('Model_hl','hl');
  13. $this->load->_model('Model_is','is');
  14. $this->load->_model('Model_kdniao','kdniao');
  15. $this->load->_model('Model_typeclass','typeclass');
  16. $this->load->_model('Model_warehouse','warehouse');
  17. $this->load->_model('Model_fullorderexcel','fullorderexcel');
  18. $this->load->_model('Model_dhl','dhl');
  19. $this->load->_model('Model_usps','usps');
  20. $this->load->_model('Model_ups','ups');
  21. $this->load->_model('Model_dhltest','dhltest');
  22. $this->load->_model('Model_customer','customer');
  23. $this->load->_model('Model_express','express');
  24. $this->load->_model('Model_notice','notice');
  25. $this->load->_model('Model_emaildata','emaildata');
  26. $this->load->_model('Model_whlabel','whlabel');
  27. $this->load->_model('Model_productdescribe','productdescribe');
  28. $this->load->_model('Model_ljg','ljg');
  29. $this->load->_model('Model_commodityread','commodityread');
  30. $this->load->_model('Model_service','service');
  31. $this->load->_model('Model_fedex','fedex');
  32. $this->load->_model('Model_apismt','apismt');
  33. $this->load->_model('Model_cne','cne');
  34. $this->load->_model('Model_specialstock','specialstock');
  35. $this->load->_model('Model_whlabellabel','whlabellabel');
  36. $this->load->_model('Model_allocation','allocation');
  37. $this->load->_model('Model_yswaybill','yswaybill');
  38. $this->load->_model('Model_paypal','paypal');
  39. $this->load->_model('Model_17track','17track');
  40. $this->load->_model('Model_ck','ck');
  41. $this->load->_model('Model_weight','weight');
  42. $this->load->_model('Model_pay','pay');
  43. $this->load->_model('Model_setting','setting');
  44. $this->load->_model('Model_classid','classid');
  45. $this->load->_model('Model_apitt','apitt');
  46. $this->load->_model('Model_customertt','customertt');
  47. $this->load->_model('Model_als','als');
  48. $this->load->_model('Model_apiyy','apiyy');
  49. $this->load->_model('Model_whlabel_fc','whlabel_fc');
  50. $this->load->_model('Model_excel','excel');
  51. }
  52. //定义方法的调用规则 获取URI第二段值
  53. public function _remap($arg,$arg_array)
  54. {
  55. if($arg == 'c')
  56. {
  57. $this->_c();
  58. }
  59. else if($arg == 'cs')
  60. {
  61. $this->_cs($arg_array);
  62. }
  63. else if($arg == 'excel')
  64. {
  65. $this->_excel($arg_array);
  66. }
  67. else if($arg == 'xxpl')
  68. {
  69. $this->_xxpl();
  70. }
  71. else if($arg == 'rz')
  72. {
  73. $this->_rz($arg_array);
  74. }
  75. }
  76. public function _excel($arg_array)
  77. {
  78. $filePath = './data/yyexcel/'.$arg_array[0].'/excel.txt';
  79. $fileContent = file_get_contents($filePath);
  80. if ($fileContent !== false)
  81. {
  82. header( 'Content-Type: application/vnd.ms-excel; name=excel' );
  83. header( 'Content-type: application/octet-stream' );
  84. header( 'Content-Disposition: attachment; filename='.$arg_array[0].'.xls');
  85. header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
  86. header( 'Pragma: no-cache' );
  87. header( 'Expires: 0' );
  88. echo $fileContent;
  89. }
  90. else
  91. {
  92. echo "文件无法读取";
  93. }
  94. }
  95. public function _rz($arg_array)
  96. {
  97. $a = './data/yylog/RK-'.$arg_array[0].'.txt';
  98. if(is_file($a))
  99. {
  100. $myfile = fopen($a, "r") or die("Unable to open file!");
  101. $bc = fread($myfile,filesize($a));
  102. fclose($myfile);
  103. $zt = explode('\n',trim($bc,'\n'));
  104. //$bc = json_decode($bc,true);
  105. $nr = array();
  106. foreach($zt as $k=>$val)
  107. {
  108. $xx = explode(' = ',trim($val,' = '));
  109. if(stripos($xx[0],'RK-F') !== false)
  110. {
  111. $nr[$k][][0] = '入库发送';
  112. }
  113. else if(stripos($xx[0],'RK-J') !== false)
  114. {
  115. $nr[$k][][0] = '入库接收';
  116. }
  117. else if(stripos($xx[0],'SH-F') !== false)
  118. {
  119. $nr[$k][][0] = '审核发送';
  120. }
  121. else if(stripos($xx[0],'SH-J') !== false)
  122. {
  123. $nr[$k][][0] = '审核接收';
  124. }
  125. else if(stripos($xx[0],'DC-F') !== false)
  126. {
  127. $nr[$k][][0] = '调出发送';
  128. }
  129. else if(stripos($xx[0],'DC-J') !== false)
  130. {
  131. $nr[$k][][0] = '调出接收';
  132. }
  133. $nr[$k][][1] = $xx[1];
  134. }
  135. echo "<pre>";
  136. print_r($nr);
  137. }
  138. else
  139. {
  140. echo '无';
  141. }
  142. }
  143. public function _c()
  144. {
  145. $asd = array();
  146. $v = "fullorder";
  147. $d = $this->$v->find_all(" number = QQS-50124-091 and librarytime > '".(time()-(12*24*3600))."' and (type = '13' or type = '16') and dbapi < 99");
  148. if($d)
  149. {
  150. $h = $this->_list($d,$v);
  151. foreach($h as $vv)
  152. {
  153. $x = 0;$c = 0;
  154. if(!isset($vv[0]))
  155. {
  156. continue;
  157. }
  158. $xs = $this->apiyy->_cxxsdd($vv['0']);
  159. $chd = $this->apiyy->_cxchd($vv['0']);
  160. if(isset($xs['Data'][0]))
  161. {
  162. $vv[] = '成功';
  163. $x = 1;
  164. }
  165. else
  166. {
  167. $vv[] = '无';
  168. }
  169. if(isset($chd['Data'][0]))
  170. {
  171. $vv[] = '成功';
  172. $c = 1;
  173. }
  174. else
  175. {
  176. $vv[] = '无';
  177. }
  178. if($x==1 && $c==1)
  179. {
  180. $this->$v->save(array('dbapi'=>99),$vv[4]);
  181. }
  182. $asd[] = $vv;
  183. }
  184. }
  185. $title = "表 ".date("Y-m-d");
  186. $titlename = "<table border=1>
  187. <tr><th colspan='6' align='left'><h3>".$title."<h3></th></tr>
  188. <tr>
  189. <td>编号</td>
  190. <td>销售订单发送</td>
  191. <td>销售订单接收</td>
  192. <td>出货单发送</td>
  193. <td>出货单接收</td>
  194. <td>销售订单验证</td>
  195. <td>出货单验证</td>
  196. </tr>
  197. </table>";
  198. $filename = $title.".xls";
  199. $tail = "\n";
  200. $data = $this->excel->get_fz2_bc($asd,$titlename,$filename,$tail);
  201. $orderinfo = time();
  202. $pdtime = date('Y-m-d',time());
  203. $folderPath = './data/yyexcel/'.$pdtime; // 文件夹路径
  204. $permissions = 0777; // 权限设置
  205. if (!file_exists($folderPath)) { mkdir($folderPath, $permissions); }//创建文件夹
  206. file_exists($folderPath);
  207. if(!is_file($folderPath."/".$orderinfo.".txt"))
  208. {
  209. $myfile = fopen($folderPath."/excel.txt", "w") or die("Unable to open file!");
  210. fwrite($myfile, $data);
  211. fclose($myfile);
  212. }
  213. else
  214. {
  215. $myfile = fopen($folderPath."/exce.txt", "a+") or die("Unable to open file!");
  216. fwrite($myfile, $data);
  217. fclose($myfile);
  218. }
  219. }
  220. public function _list($d,$fullorder)//获取订单列表
  221. {
  222. $xx = array();
  223. foreach($d as $k=>$data)
  224. {
  225. $xx[$k] = array(0=>$data['number'],'xsf'=>'','xss'=>'','fhf'=>'','fhs'=>'',4=>$data['id']);
  226. $kh = $this->shop->read($data['shop']);
  227. $classid = $this->classid->sku();
  228. $tcall = $this->typeclass->find_all();
  229. $typeclass = array();
  230. foreach ($tcall as $v)
  231. {
  232. $tcjm[$v['id']] = array($v['jm'],$v['classid']);
  233. $typeclass[$v['id']] = array('zh'=>$v['zh'],'classid'=>$v['classid'],'bm'=>$v['bm'],'title'=>$v['title'],'jm'=>$v['jm']);
  234. }
  235. $bm = '03';
  236. $xysc = array();
  237. $data['lh'] = array();
  238. $scid = '';$cw = '';$lc = 0;
  239. $sku = explode(';',trim($data['fpdata'],';'));
  240. $whlabelsc = explode('|',trim($data['whlabel'],'|'));
  241. foreach($sku as $key=>$val)
  242. {
  243. if(stripos($val,'-131-') !== false)
  244. {
  245. continue;
  246. }
  247. $pm = $classid;
  248. $jm = $classid;
  249. $bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
  250. $features = str_replace(array('-163-','-164-','-165-','-166-'),'-',$val);
  251. $ts = explode('|',trim($features,'|'));
  252. if(stripos($ts[0],',') !== false)
  253. {
  254. $ft = explode(',',$ts[0]);
  255. $features = explode('-',trim($ft[1],'-'));
  256. $features[] = $ft[0];
  257. }
  258. else
  259. {
  260. $features = explode('-',trim($ts[0],'-'));
  261. }
  262. foreach($features as $k=>$v)
  263. {
  264. if(isset($typeclass[$v]) && isset($bmpx[$typeclass[$v]['classid']]))
  265. {
  266. if($typeclass[$v]['bm'] != '')
  267. {
  268. $bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
  269. }
  270. }
  271. if($v != 0)
  272. {
  273. if(isset($pm[$typeclass[$v]['classid']]))
  274. {
  275. if($typeclass[$v]['title'] == '9A')
  276. {
  277. $pm[$typeclass[$v]['classid']] = '9A';
  278. }
  279. else if($typeclass[$v]['title'] == '10A')
  280. {
  281. $pm[$typeclass[$v]['classid']] = '10A';
  282. }
  283. else
  284. {
  285. $clzh = $typeclass[$v]['zh'];
  286. if(stripos($typeclass[$v]['zh'],'|') !== false)
  287. {
  288. $clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
  289. $clzh = $clzh[0];
  290. }
  291. $pm[$typeclass[$v]['classid']] = $clzh;
  292. }
  293. }
  294. if(isset($jm[$typeclass[$v]['classid']]))
  295. {
  296. if($typeclass[$v]['jm'])
  297. {
  298. $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
  299. }
  300. }
  301. }
  302. }
  303. $jm = array_filter($jm);//去除空值
  304. $jm = implode("-",$jm);
  305. $pm = array_filter($pm);//去除空值
  306. $zh = implode(" ",$pm);
  307. $zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
  308. if(!isset($ts[1]))
  309. {
  310. $ts[1] = '无';
  311. }
  312. $lh = $this->apiyy->get_cjlp(array('jm'=>$jm,'title'=>$ts[1],'zh'=>$zh,'bm'=>$bm.implode("",$bmpx)));
  313. if(isset($lh['Data'][0]))
  314. {
  315. if($lh['Data'][0]['m_isSucess'] != 1)
  316. {
  317. if($lh['Data'][0]['m_errorMsg'] != '料号 已存在,请重新输入!')
  318. {
  319. $xx[$k][1] = $lh;
  320. $this->apiyy->insert(array('number'=>$data['number'],'error'=>$lh['Data'][0]['m_errorMsg'],'type'=>'料号','cs'=>$fullorder));
  321. continue;
  322. }
  323. }
  324. }
  325. else
  326. {
  327. $this->apiyy->insert(array('number'=>$data['number'],'error'=>json_encode($lh),'type'=>'料号','cs'=>$fullorder));
  328. continue;
  329. }
  330. $data['lh'][] = array('sku'=>$jm,'ts'=>$ts[2]);
  331. if(stripos($val,'-131-') !== false)
  332. {
  333. continue;
  334. }
  335. if(stripos($val,'-126-') !== false)
  336. {
  337. $drck = '12003';//进入发条库
  338. }
  339. else if(stripos($val,'-127-') !== false)
  340. {
  341. $drck = '12004';//进入发块库
  342. }
  343. else
  344. {
  345. $drck = '12006';//其它进入完成库
  346. }
  347. }
  348. $data['yyid'] = $kh['yyid'];
  349. @$ay = $this->apiyy->_neworder($data,$classid,$tcall);
  350. $xx[$k]['xsf'] = $ay['fs'];
  351. $xx[$k]['xss'] = $ay['fh'];
  352. if($ay['c'] != 0)
  353. {
  354. $this->$fullorder->save(array('dbapi'=>0),$data['id']);
  355. $this->apiyy->insert(array('number'=>$data['number'],'type'=>'销售订单','error'=>$ay['error'],'cs'=>$fullorder));
  356. }
  357. else
  358. {
  359. $this->$fullorder->save(array('dbapi'=>99),$data['id']);
  360. $chdfs = '';$chdjs = '';$chdcg = 0;
  361. foreach($data['lh'] as $k=>$v)
  362. {
  363. $chd = array('number'=>$data['number'],'i'=>$k+1,'ts'=>$v['ts']);
  364. $c = $this->apiyy->get_chd($chd);
  365. $chdfs = $c['1'];
  366. $chdjs = json_encode($c['0']);
  367. if(isset($c['Data']))
  368. {
  369. if($c['Data'][0]['m_isSucess'] == 1)
  370. {
  371. $chdcg += 1;
  372. }
  373. }
  374. }
  375. $xx[$k]['fhf'] = $chdfs;
  376. $xx[$k]['fhs'] = $chdjs;
  377. if($chdcg == count($data['lh']))
  378. {
  379. $cs = $this->$fullorder->save(array('dbapi'=>100),$data['id']);
  380. }
  381. }
  382. }
  383. return $xx;
  384. }
  385. public function _cs($arg_array)
  386. {
  387. $asd = array();
  388. $data = $this->fullorder->get_number($arg_array[0]);
  389. $fullorder = 'fullorder';
  390. $xx = array();
  391. $xx[$k] = array(0=>$data['number'],'xsf'=>'','xss'=>'','fhf'=>'','fhs'=>'',4=>$data['id']);
  392. $kh = $this->shop->read($data['shop']);
  393. $classid = $this->classid->sku();
  394. $tcall = $this->typeclass->find_all();
  395. $typeclass = array();
  396. foreach ($tcall as $v)
  397. {
  398. $tcjm[$v['id']] = array($v['jm'],$v['classid']);
  399. $typeclass[$v['id']] = array('zh'=>$v['zh'],'classid'=>$v['classid'],'bm'=>$v['bm'],'title'=>$v['title'],'jm'=>$v['jm']);
  400. }
  401. $bm = '03';
  402. $xysc = array();
  403. $data['lh'] = array();
  404. $scid = '';$cw = '';$lc = 0;
  405. $sku = explode(';',trim($data['fpdata'],';'));
  406. $whlabelsc = explode('|',trim($data['whlabel'],'|'));
  407. foreach($sku as $key=>$val)
  408. {
  409. if(stripos($val,'-131-') !== false)
  410. {
  411. continue;
  412. }
  413. $pm = $classid;
  414. $jm = $classid;
  415. $bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
  416. $features = str_replace(array('-163-','-164-','-165-','-166-'),'-',$val);
  417. $ts = explode('|',trim($features,'|'));
  418. if(stripos($ts[0],',') !== false)
  419. {
  420. $ft = explode(',',$ts[0]);
  421. $features = explode('-',trim($ft[1],'-'));
  422. $features[] = $ft[0];
  423. }
  424. else
  425. {
  426. $features = explode('-',trim($ts[0],'-'));
  427. }
  428. foreach($features as $k=>$v)
  429. {
  430. if(isset($typeclass[$v]) && isset($bmpx[$typeclass[$v]['classid']]))
  431. {
  432. if($typeclass[$v]['bm'] != '')
  433. {
  434. $bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
  435. }
  436. }
  437. if($v != 0)
  438. {
  439. if(isset($pm[$typeclass[$v]['classid']]))
  440. {
  441. if($typeclass[$v]['title'] == '9A')
  442. {
  443. $pm[$typeclass[$v]['classid']] = '9A';
  444. }
  445. else if($typeclass[$v]['title'] == '10A')
  446. {
  447. $pm[$typeclass[$v]['classid']] = '10A';
  448. }
  449. else
  450. {
  451. $clzh = $typeclass[$v]['zh'];
  452. if(stripos($typeclass[$v]['zh'],'|') !== false)
  453. {
  454. $clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
  455. $clzh = $clzh[0];
  456. }
  457. $pm[$typeclass[$v]['classid']] = $clzh;
  458. }
  459. }
  460. if(isset($jm[$typeclass[$v]['classid']]))
  461. {
  462. if($typeclass[$v]['jm'])
  463. {
  464. $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
  465. }
  466. }
  467. }
  468. }
  469. $jm = array_filter($jm);//去除空值
  470. $jm = implode("-",$jm);
  471. $pm = array_filter($pm);//去除空值
  472. $zh = implode(" ",$pm);
  473. $zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
  474. if(!isset($ts[1]))
  475. {
  476. $ts[1] = '无';
  477. }
  478. $lh = $this->apiyy->get_cjlp(array('jm'=>$jm,'title'=>$ts[1],'zh'=>$zh,'bm'=>$bm.implode("",$bmpx)));
  479. if(isset($lh['Data'][0]))
  480. {
  481. if($lh['Data'][0]['m_isSucess'] != 1)
  482. {
  483. if($lh['Data'][0]['m_errorMsg'] != '料号 已存在,请重新输入!')
  484. {
  485. $xx[$k][1] = $lh;
  486. $this->apiyy->insert(array('number'=>$data['number'],'error'=>$lh['Data'][0]['m_errorMsg'],'type'=>'料号','cs'=>$fullorder));
  487. continue;
  488. }
  489. }
  490. }
  491. else
  492. {
  493. $this->apiyy->insert(array('number'=>$data['number'],'error'=>json_encode($lh),'type'=>'料号','cs'=>$fullorder));
  494. continue;
  495. }
  496. $data['lh'][] = array('sku'=>$jm,'ts'=>$ts[2]);
  497. if(stripos($val,'-131-') !== false)
  498. {
  499. continue;
  500. }
  501. if(stripos($val,'-126-') !== false)
  502. {
  503. $drck = '12003';//进入发条库
  504. }
  505. else if(stripos($val,'-127-') !== false)
  506. {
  507. $drck = '12004';//进入发块库
  508. }
  509. else
  510. {
  511. $drck = '12006';//其它进入完成库
  512. }
  513. }
  514. $data['yyid'] = $kh['yyid'];
  515. @$ay = $this->apiyy->_neworder($data,$classid,$tcall);
  516. echo "<pre>";
  517. print_r(array($data,$classid,$tcall));
  518. echo "<pre>";
  519. print_r($ay);
  520. exit;
  521. $xx[$k]['xsf'] = $ay['fs'];
  522. $xx[$k]['xss'] = $ay['fh'];
  523. if($ay['c'] != 0)
  524. {
  525. $this->$fullorder->save(array('dbapi'=>0),$data['id']);
  526. $this->apiyy->insert(array('number'=>$data['number'],'type'=>'销售订单','error'=>$ay['error'],'cs'=>$fullorder));
  527. }
  528. else
  529. {
  530. $this->$fullorder->save(array('dbapi'=>99),$data['id']);
  531. $chdfs = '';$chdjs = '';$chdcg = 0;
  532. foreach($data['lh'] as $k=>$v)
  533. {
  534. $chd = array('number'=>$data['number'],'i'=>$k+1,'ts'=>$v['ts']);
  535. $c = $this->apiyy->get_chd($chd);
  536. $chdfs = $c['1'];
  537. $chdjs = json_encode($c['0']);
  538. if(isset($c['Data']))
  539. {
  540. if($c['Data'][0]['m_isSucess'] == 1)
  541. {
  542. $chdcg += 1;
  543. }
  544. }
  545. }
  546. $xx[$k]['fhf'] = $chdfs;
  547. $xx[$k]['fhs'] = $chdjs;
  548. if($chdcg == count($data['lh']))
  549. {
  550. $cs = $this->$fullorder->save(array('dbapi'=>100),$data['id']);
  551. }
  552. }
  553. }
  554. public function _xxpl()
  555. {
  556. $dir = '/data/excel/'.date('Ymd',time()).'/';
  557. $config['upload_path'] = '.'.$dir ;
  558. $config['file_name'] = date('Ymd_His_',time()).rand(1000,9999);
  559. $config['allowed_types'] = 'xls|xlsx|csv';
  560. $config['max_size'] = 10240;
  561. $this->load->library('upload', $config);
  562. $this->upload->initialize($config);
  563. if ($this->upload->do_upload('userfile'))
  564. {
  565. $full_path = $dir.$this->upload->data('file_name');
  566. $fileName = '.' . $full_path;
  567. if (!file_exists($fileName))
  568. {
  569. echo json_encode(array('msg'=>"上传失败,请重试",'success'=>false));exit;
  570. }
  571. else
  572. {
  573. require_once "./data/excel/PHPExcel/IOFactory.php";
  574. @$phpExcel = PHPExcel_IOFactory::load($fileName);// 载入当前文件
  575. @$phpExcel->setActiveSheetIndex(0);// 设置为默认表
  576. $sheetCount = $phpExcel->getSheetCount();// 获取表格数量
  577. $row = $phpExcel->getActiveSheet()->getHighestRow();// 获取行数
  578. $column = $phpExcel->getActiveSheet()->getHighestColumn();// 获取列数
  579. ++$column;//如果列数大于26行
  580. $list = array();
  581. for ($i = 2; $i <= $row; $i++) // 行数循环
  582. {
  583. $data = array();
  584. for ($c = 'A'; $c != $column; $c++) // 列数循环
  585. {
  586. $data[] = $phpExcel->getActiveSheet()->getCell($c . $i)->getValue();
  587. }
  588. $list[] = $data;
  589. }
  590. }
  591. $cw = [];$d = [];
  592. foreach ($list as $v)
  593. {
  594. $v = $v[0];
  595. $fullorder_name = 'fullorder';
  596. $y = $this->fullorder->get_number($v);
  597. if(!$y)
  598. {
  599. $fullorder_name = 'fullordersmt';
  600. $y = $this->fullordersmt->get_number($v);
  601. if(!$y)
  602. {
  603. $fullorder_name = 'fullordertt';
  604. $y = $this->fullordertt->get_number($v);
  605. if(!$y)
  606. {
  607. $cw[] = [$v,'无数据'];
  608. }
  609. }
  610. }
  611. $d[$fullorder_name][] = $y;
  612. }
  613. foreach($d as $key=>$val)
  614. {
  615. $h = $this->_list($val,$key);
  616. foreach($h as $vv)
  617. {
  618. $x = 0;$c = 0;
  619. if(!isset($vv[0]))
  620. {
  621. continue;
  622. }
  623. $xs = $this->apiyy->_cxxsdd($vv['0']);
  624. $chd = $this->apiyy->_cxchd($vv['0']);
  625. if(isset($xs['Data'][0]))
  626. {
  627. $vv[] = '成功';
  628. $x = 1;
  629. }
  630. else
  631. {
  632. $vv[] = '无';
  633. }
  634. if(isset($chd['Data'][0]))
  635. {
  636. $vv[] = '成功';
  637. $c = 1;
  638. }
  639. else
  640. {
  641. $vv[] = '无';
  642. }
  643. if($x==1 && $c==1)
  644. {
  645. $this->$v->save(array('dbapi'=>99),$vv[4]);
  646. }
  647. $asd[] = $vv;
  648. }
  649. }
  650. echo "<pre>";
  651. print_r($cw);
  652. echo "<pre>";
  653. print_r($asd);
  654. }
  655. else
  656. {
  657. echo json_encode(array('msg'=>'上传失败!','t'=>$this->upload->display_errors(),'success'=>false));exit;
  658. }
  659. }
  660. }