Aay.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Aay extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->_model('Model_shop','shop');
  6. $this->load->_model('Model_fullorder','fullorder');
  7. $this->load->_model('Model_fullordertt','fullordertt');
  8. $this->load->_model('Model_fullordersmt','fullordersmt');
  9. $this->load->_model('Model_fullorder_2020','fullorder2020');
  10. $this->load->_model('Model_fullordersmt_2020','fullordersmt2020');
  11. $this->load->_model('Model_customersmt','customersmt');
  12. $this->load->_model('Model_country','country');
  13. $this->load->_model('Model_hl','hl');
  14. $this->load->_model('Model_is','is');
  15. $this->load->_model('Model_kdniao','kdniao');
  16. $this->load->_model('Model_typeclass','typeclass');
  17. $this->load->_model('Model_warehouse','warehouse');
  18. $this->load->_model('Model_fullorderexcel','fullorderexcel');
  19. $this->load->_model('Model_dhl','dhl');
  20. $this->load->_model('Model_usps','usps');
  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_whlabel','whlabel');
  26. $this->load->_model('Model_productdescribe','productdescribe');
  27. $this->load->_model('Model_ljg','ljg');
  28. $this->load->_model('Model_commodityread','commodityread');
  29. $this->load->_model('Model_service','service');
  30. $this->load->_model('Model_fedex','fedex');
  31. $this->load->_model('Model_commodity','commodity');
  32. $this->load->_model('Model_fullordersmtorder','fullordersmtorder');
  33. $this->load->_model('Model_ali','ali');
  34. $this->load->_model('Model_fullordersmthb','fullordersmthb');
  35. $this->load->_model('Model_fullordersmtbf','fullordersmtbf');
  36. $this->load->_model('Model_taxzhengzhou','taxzhengzhou');
  37. $this->load->_model('Model_taxshanghai','taxshanghai');
  38. $this->load->_model('Model_excel','excel');
  39. $this->load->_model('Model_ups','ups');
  40. $this->load->_model('Model_dpd','dpd');
  41. $this->load->_model('Model_dpdold','dpdold');
  42. $this->load->_model('Model_dpd_IOSS','dpd_IOSS');
  43. $this->load->_model('Model_dpdxw','dpdxw');
  44. $this->load->_model('Model_cne','cne');
  45. $this->load->_model('Model_outbound','outbound');
  46. $this->load->_model('Model_api','api');
  47. $this->load->_model('Model_dhlhz','dhlhz');
  48. $this->load->_model('Model_apismt','apismt');
  49. $this->load->_model('Model_specialstock','specialstock');
  50. $this->load->_model('Model_systemwigsout','systemwigsout');
  51. $this->load->_model('Model_purchaseorder','purchaseorder');
  52. $this->load->_model('Model_returns','returns');
  53. $this->load->_model('Model_whlabellabel','whlabellabel');
  54. $this->load->_model('Model_whlabelbarcode','whlabelbarcode');
  55. $this->load->_model('Model_tjadd','tjadd');
  56. $this->load->_model('Model_stafflist','stafflist');
  57. $this->load->_model('Model_paypal','paypal');
  58. $this->load->_model('Model_warehousefactory','warehousefactory');
  59. $this->load->_model('Model_commodityread_del','commodityreaddel');
  60. $this->load->_model('Model_als','als');
  61. $this->load->_model('Model_allocation','allocation');
  62. $this->load->_model('Model_17track','17track');
  63. $this->load->_model('Model_hualei','hualei');
  64. $this->load->_model('Model_ck','ck');
  65. $this->load->_model('Model_colour','colour');
  66. $this->load->_model('Model_color','color');
  67. $this->load->_model('Model_emaildata','emaildata');
  68. $this->load->_model('Model_wigprint','wigprint');
  69. $this->load->_model('Model_weight','weight');
  70. $this->load->_model('Model_whlabeltransport','whlabeltransport');
  71. $this->load->_model('Model_pay','pay');
  72. $this->load->_model('Model_orderurl','orderurl');
  73. $this->load->_model('Model_classid','classid');
  74. $this->load->_model('Model_apiyy','apiyy');
  75. $this->load->_model('Model_purchase','purchase');
  76. $this->load->_model('Model_apitt','apitt');
  77. }
  78. //定义方法的调用规则 获取URI第二段值
  79. public function _remap($arg,$arg_array)
  80. {
  81. if($arg == 'a')
  82. {
  83. $this->_a($arg_array);
  84. }
  85. else if($arg == 'b')
  86. {
  87. $this->_b($arg_array);
  88. }
  89. else if($arg == 'rk')
  90. {
  91. $this->_rk($arg_array);
  92. }
  93. else if($arg == 'dc')
  94. {
  95. $this->_dc($arg_array);
  96. }
  97. }
  98. public function _dc($arg_array)
  99. {
  100. $data = $this->fullorder->get_number($arg_array[0]);
  101. $classid = $this->classid->sku();
  102. $tc = $this->typeclass->find_all();
  103. $typeclass = array();
  104. foreach ($tc as $v)
  105. {
  106. $tcjm[$v['id']] = array($v['jm'],$v['classid']);
  107. $typeclass[$v['id']] = array('zh'=>$v['zh'],'classid'=>$v['classid'],'bm'=>$v['bm'],'title'=>$v['title'],'jm'=>$v['jm']);
  108. }
  109. $bm = '03';
  110. $xysc = array();
  111. $data['lh'] = array();
  112. $scid = '';$cw = '';$lc = 0;
  113. $sku = explode(';',trim($data['fpdata'],';'));
  114. $whlabelsc = explode('|',trim($data['whlabel'],'|'));
  115. $cs = array();
  116. foreach($sku as $key=>$val)
  117. {
  118. $pm = $classid;
  119. $jm = $classid;
  120. $bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
  121. $features = str_replace(array('-163-','-164-','-165-','-166-'),'-',$val);
  122. $ts = explode('|',trim($features,'|'));
  123. if(stripos($ts[0],',') !== false)
  124. {
  125. $ft = explode(',',$ts[0]);
  126. $features = explode('-',trim($ft[1],'-'));
  127. $features[] = $ft[0];
  128. }
  129. else
  130. {
  131. $features = explode('-',trim($ts[0],'-'));
  132. }
  133. foreach($features as $k=>$v)
  134. {
  135. if(isset($typeclass[$v]) && isset($bmpx[$typeclass[$v]['classid']]))
  136. {
  137. if($typeclass[$v]['bm'] != '')
  138. {
  139. $bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
  140. }
  141. }
  142. if($v != 0)
  143. {
  144. if(isset($pm[$typeclass[$v]['classid']]))
  145. {
  146. if($typeclass[$v]['title'] == '9A')
  147. {
  148. $pm[$typeclass[$v]['classid']] = '9A';
  149. }
  150. else if($typeclass[$v]['title'] == '10A')
  151. {
  152. $pm[$typeclass[$v]['classid']] = '10A';
  153. }
  154. else
  155. {
  156. $clzh = $typeclass[$v]['zh'];
  157. if(stripos($typeclass[$v]['zh'],'|') !== false)
  158. {
  159. $clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
  160. $clzh = $clzh[0];
  161. }
  162. $pm[$typeclass[$v]['classid']] = $clzh;
  163. }
  164. }
  165. if(isset($jm[$typeclass[$v]['classid']]))
  166. {
  167. if($typeclass[$v]['jm'])
  168. {
  169. $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
  170. }
  171. }
  172. }
  173. }
  174. $cs[] = array($bmpx,$jm);
  175. $jm = array_filter($jm);
  176. $jm = implode("-",$jm);
  177. $pm = array_filter($pm);//去除空值
  178. $zh = implode(" ",$pm);
  179. $zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
  180. $data['lh'][] = array('sku'=>$jm,'ts'=>$ts[2]);
  181. }
  182. echo "<pre>";
  183. print_r($cs);
  184. echo "<pre>";
  185. print_r($sku);
  186. }
  187. public function _rk($arg_array)
  188. {
  189. $a = $this->fullorder->get_number($arg_array[0]);
  190. $classid = $this->classid->sku();
  191. $tcall = $this->typeclass->find_all();
  192. $apiyy = $a;
  193. $shop = $this->shop->read($a['shop']);
  194. @$ay = $this->apiyy->_order($apiyy,$classid,$tcall);
  195. echo "<pre>";
  196. print_r($ay);
  197. echo "<pre>";
  198. print_r($a);
  199. echo "<pre>";
  200. print_r($shop);
  201. exit;
  202. }
  203. public function _b()
  204. {
  205. $data = $this->fullorder->get_number('Alipearl-70419-001');
  206. echo "<pre>";
  207. print_r($data);
  208. exit;
  209. $data = $this->fullorder->get_number('KISS-30929-094');
  210. $data['dtime'] = time();
  211. $classid = $this->classid->sku();
  212. $tc = $this->typeclass->find_all();
  213. $error = '';
  214. $typeclass = array();
  215. foreach ($tc as $v)
  216. {
  217. $tcjm[$v['id']] = array($v['jm'],$v['classid']);
  218. $typeclass[$v['id']] = array('zh'=>$v['zh'],'classid'=>$v['classid'],'bm'=>$v['bm'],'title'=>$v['title'],'jm'=>$v['jm']);
  219. }
  220. $pm = $classid;
  221. $jm = $classid;
  222. $bm = '03';
  223. $bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
  224. $data['lh'] = array();$sc = array();
  225. $sku = explode(';',trim($data['fpdata'],';'));
  226. $whlabelsc = explode('|',trim($data['whlabel'],'|'));
  227. foreach($sku as $key=>$val)
  228. {
  229. $features = str_replace(array('-163-','-164-','-165-','-166-'),'-',$val);
  230. $ts = explode('|',trim($features,'|'));
  231. if(stripos($ts[0],',') !== false)
  232. {
  233. $ft = explode(',',$ts[0]);
  234. $features = explode('-',trim($ft[1],'-'));
  235. $features[] = $ft[0];
  236. }
  237. else
  238. {
  239. $features = explode('-',trim($ts[0],'-'));
  240. }
  241. foreach($features as $k=>$v)
  242. {
  243. if(isset($typeclass[$v]) && isset($bmpx[$typeclass[$v]['classid']]))
  244. {
  245. if($typeclass[$v]['bm'] != '')
  246. {
  247. $bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
  248. }
  249. }
  250. if($v != 0)
  251. {
  252. if(isset($pm[$typeclass[$v]['classid']]))
  253. {
  254. if($typeclass[$v]['title'] == '9A')
  255. {
  256. $pm[$typeclass[$v]['classid']] = '9A';
  257. }
  258. else if($typeclass[$v]['title'] == '10A')
  259. {
  260. $pm[$typeclass[$v]['classid']] = '10A';
  261. }
  262. else
  263. {
  264. $clzh = $typeclass[$v]['zh'];
  265. if(stripos($typeclass[$v]['zh'],'|') !== false)
  266. {
  267. $clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
  268. $clzh = $clzh[0];
  269. }
  270. $pm[$typeclass[$v]['classid']] = $clzh;
  271. }
  272. }
  273. if(isset($jm[$typeclass[$v]['classid']]))
  274. {
  275. $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
  276. }
  277. }
  278. }
  279. $jm = array_filter($jm);//去除空值
  280. $pm = array_filter($pm);//去除空值
  281. $zh = implode(" ",$pm);
  282. $zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
  283. $data['lh'][] = array('sku'=>implode("-",$jm),'ts'=>$ts[2]);
  284. $lh = $this->apiyy->get_cjlp(array('sku'=>implode("-",$jm),'title'=>$ts[1],'zh'=>$zh,'bm'=>$bm.implode("",$bmpx)));
  285. $sfsc = explode('-',$whlabelsc[$key]);
  286. if($sfsc[2] == 'DNOTO')
  287. {
  288. $sc[] = $this->apiyy->get_sc(array('sku'=>implode("-",$jm),'title'=>$ts[1],'id'=>$data['id']));
  289. }
  290. }
  291. if($error)
  292. {
  293. return array('c'=>1,'error'=>$error,'lx'=>'料号','number'=>$data['number']);exit;
  294. }
  295. $a = $this->apiyy->get_order($data);
  296. if($a == 1)
  297. {
  298. return array('c'=>0);exit;
  299. }
  300. echo "<pre>";
  301. print_r($a);
  302. echo "<pre>";
  303. print_r($sc);
  304. echo "<pre>";
  305. print_r($lh);
  306. echo "<pre>";
  307. exit;
  308. }
  309. public function _bsd($arg_array)
  310. {
  311. exit;
  312. $post = $this->fullorder->get_number($arg_array[0]);
  313. $classid = $this->classid->sku();
  314. $tcall = $this->typeclass->find_all();
  315. $ay = $this->apiyy->_order($post,$classid,$tcall);
  316. if($ay['c'] == 1)
  317. {
  318. $this->apiyy->insert(array('number'=>$ay['number'],'lx'=>$ay['lx'],'error'=>$ay['error']));
  319. }
  320. print_r($a);
  321. /**
  322. $a = $this->apiyy->get_cjlp(array('sku'=>'9A-#color25-wavy25-5*5Bob-14-180%-M','title'=>'Wigs 9A #color25 wavy25 5*5 Bob Wig Medium 180% 14inch ','zh'=>'9A 5*5波波头套 14寸 (180%密度) (中号)'));
  323. echo "<pre>";
  324. print_r($a);
  325. exit;
  326. $tc = $this->typeclass->find_all();
  327. $typeclass = array();
  328. foreach ($tc as $v)
  329. {
  330. $this->typeclass->save(array('yzh'=>$v['zh']),$v['id']);
  331. }
  332. **/
  333. exit;
  334. $s = $this->fullorder->get_number($arg_array[0]);
  335. $a = $this->apiyy->get_chd($s);
  336. echo "<pre>";
  337. print_r($a);
  338. exit;
  339. }
  340. public function _a($arg_array)
  341. {
  342. $list["SqlString"] = "select a.id,a.code,c.name,a.org,b.name org_name from CBO_Wh a left join CBO_Wh_trl c on c.id=a.id left join Base_Organization_trl b on a.org=b.id";
  343. $list = json_encode($list);
  344. $token = $this->setting->get_yytoken_101();
  345. $url = 'http://172.31.105.167/U9C/webapi/QueryCommon/QueryInfoBySql';
  346. $header[] = "Content-Type: application/json";
  347. $header[] = "Token: ".$token;
  348. $ch = curl_init();
  349. curl_setopt($ch, CURLOPT_URL, $url);
  350. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  351. curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
  352. curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE);
  353. curl_setopt($ch, CURLOPT_POST, 1);
  354. curl_setopt($ch, CURLOPT_POSTFIELDS, $list);
  355. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  356. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
  357. $res = curl_exec($ch);
  358. $res = json_decode($res,true);
  359. echo "<pre>";
  360. print_r($res);
  361. exit;
  362. $tc = $this->typeclass->find_all();
  363. $typeclass = array();
  364. foreach ($tc as $v)
  365. {
  366. $tcjm[$v['id']] = array($v['jm'],$v['classid']);
  367. $typeclass[$v['id']] = array('zh'=>$v['zh'],'classid'=>$v['classid'],'bm'=>$v['bm'],'title'=>$v['title'],'jm'=>$v['jm']);
  368. }
  369. //$s = $this->fullorder->find_all('1=1','*','id desc',100,103);
  370. $s = $this->fullorder->get_number($arg_array[0]);
  371. $classid = $this->classid->sku();
  372. $pm = $classid;
  373. $jm = $classid;
  374. $bm = '03';
  375. $bmpx = array(13=>'',16=>'',18=>'',25=>'',26=>'',41=>'');
  376. $s['lh'] = array();
  377. $sku = explode(';',trim($s['fpdata'],';'));
  378. foreach($sku as $val)
  379. {
  380. $features = str_replace(array('-163-','-164-','-165-','-166-'),'-',$val);
  381. $ts = explode('|',trim($features,'|'));
  382. if(stripos($ts[0],',') !== false)
  383. {
  384. $ft = explode(',',$ts[0]);
  385. $features = explode('-',trim($ft[1],'-'));
  386. $features[] = $ft[0];
  387. }
  388. else
  389. {
  390. $features = explode('-',trim($ft[1],'-'));
  391. }
  392. foreach($features as $k=>$v)
  393. {
  394. if(isset($typeclass[$v]) && isset($bmpx[$typeclass[$v]['classid']]))
  395. {
  396. if($typeclass[$v]['bm'] != '')
  397. {
  398. $bmpx[$typeclass[$v]['classid']] = $typeclass[$v]['bm'];
  399. }
  400. }
  401. if($v != 0)
  402. {
  403. if(isset($pm[$typeclass[$v]['classid']]))
  404. {
  405. if($typeclass[$v]['title'] == '9A')
  406. {
  407. $pm[$typeclass[$v]['classid']] = '9A';
  408. }
  409. else if($typeclass[$v]['title'] == '10A')
  410. {
  411. $pm[$typeclass[$v]['classid']] = '10A';
  412. }
  413. else
  414. {
  415. $clzh = $typeclass[$v]['zh'];
  416. if(stripos($typeclass[$v]['zh'],'|') !== false)
  417. {
  418. $clzh = explode('|',rtrim($typeclass[$v]['zh'],'|'));
  419. $clzh = $clzh[0];
  420. }
  421. $pm[$typeclass[$v]['classid']] = $clzh;
  422. }
  423. }
  424. if(isset($jm[$typeclass[$v]['classid']]))
  425. {
  426. $jm[$typeclass[$v]['classid']] = $typeclass[$v]['jm'];
  427. }
  428. }
  429. }
  430. $jm = array_filter($jm);//去除空值
  431. $pm = array_filter($pm);//去除空值
  432. $zh = implode(" ",$pm);
  433. $zh = preg_replace("/\r\n|\r|\n/",'',trim($zh,' '));
  434. $s['lh'][] = array('sku'=>implode("-",$jm),'ts'=>$ts[2]);
  435. $lh = $this->apiyy->get_cjlp(array('sku'=>implode("-",$jm),'title'=>$ts[1],'zh'=>$zh,'bm'=>$bm.implode("",$bmpx)));
  436. if(!isset($lh['Data'][0]) || $lh['Data'][0]['m_isSucess'] != 1)
  437. {
  438. if($lh['Data'][0]['m_errorMsg'] == '料号 已存在,请重新输入!')
  439. {
  440. continue;
  441. }
  442. else
  443. {
  444. print_r($lh);exit;
  445. }
  446. }
  447. }
  448. $a = $this->apiyy->get_order($s);
  449. echo "<pre>";
  450. print_r($a);
  451. echo "<pre>";
  452. print_r(array('sku'=>implode("-",$jm),'title'=>$ts[1],'zh'=>$zh,'bm'=>$bm.implode("",$bmpx)));
  453. exit;
  454. }
  455. }