Warehouse.php 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. class Warehouse extends Start_Controller {
  3. public function __construct(){
  4. parent::__construct();
  5. $this->load->library('session');
  6. $this->load->_model('Model_warehouse','warehouse');
  7. $this->load->_model('Model_country','country');
  8. $this->load->_model('Model_express','express');
  9. $this->load->_model('Model_whlabel','whlabel');
  10. $this->load->_model('Model_fullorder','fullorder');
  11. $this->load->_model('Model_fullordertt','fullordertt');
  12. $this->load->_model('Model_fullordersmt','fullordersmt');
  13. $this->load->_model('Model_typeclass','typeclass');
  14. $this->load->_model('Model_shop','shop');
  15. $this->load->_model('Model_systemwigsout','systemwigsout');
  16. $this->load->_model('Model_excel','excel');
  17. $this->load->_model('Model_transfer','transfer');
  18. $this->load->_model('Model_systemtransfer','systemtransfer');
  19. $this->load->_model('Model_whlabeltransport', 'whlabeltransport');
  20. $this->load->_model('Model_systemtransfer_cr', 'systemtransfer_cr');
  21. $this->load->_model("Model_logic_order",'logic_order');
  22. $this->load->_model("Model_logic_ding","logic_ding");
  23. $this->load->_model('Model_fullorderamz','fullorderamz');
  24. $this->load->_model('Model_logic_zhlp','logic_zhlp');
  25. $this->load->_model("Model_logic_u9tools","logic_u9tools");
  26. }
  27. //定义方法的调用规则 获取URI第二段值
  28. public function _remap($arg,$arg_array)
  29. {
  30. if($arg == 'add')//添加
  31. {
  32. $this->_add();
  33. }
  34. else if($arg == 'edit')
  35. {
  36. $this->_edit($arg_array);
  37. }
  38. else if($arg == 'del')
  39. {
  40. $this->_del();
  41. }
  42. else if($arg == 'rows')
  43. {
  44. $this->_rows();
  45. }
  46. else if($arg == 'list')
  47. {
  48. $this->_list();
  49. }
  50. else if($arg == 'kcpd')
  51. {
  52. $this->_kcpd();
  53. }
  54. else if($arg == 'orderlist')
  55. {
  56. $this->_orderlist();
  57. }
  58. else if($arg == 'orderlistck')//华荣厂查看
  59. {
  60. $this->_orderlistck();
  61. }
  62. else if($arg == 'orderlistexcel')
  63. {
  64. $this->_orderlistexcel();
  65. }
  66. else if($arg == 'ordersee')
  67. {
  68. $this->_ordersee($arg_array);
  69. }
  70. else
  71. {
  72. $this->_index();
  73. }
  74. }
  75. //管理
  76. public function _index()
  77. {
  78. $post = $this->input->post(NULL, TRUE);
  79. if(isset($post['page']))
  80. {
  81. $page = $this->input->post('page',true);
  82. $perpage = $this->input->post('perpage',true);
  83. $title = $this->input->post('title',true);
  84. $where = "1=1 ";
  85. if($title)
  86. {
  87. $where .= " and title = '$title'";
  88. }
  89. //数据排序
  90. $order_str = "id asc";
  91. if(empty($page))
  92. {
  93. $start = 0;
  94. $perpage = 1;
  95. }
  96. else
  97. {
  98. $start = ($page - 1)*$perpage;
  99. }
  100. //取得信息列表
  101. $info_list = $this->warehouse->find_all($where,'id,title,show,zd,zdms,fpzd,wz,fpsx,express,bdcountry,yybm',$order_str,$start,$perpage);
  102. foreach ($info_list as $key=>$value)
  103. {
  104. if($value['show'] == 1)
  105. {
  106. $info_list[$key]['show'] = "是";
  107. }
  108. else
  109. {
  110. $info_list[$key]['show'] = "否";
  111. }
  112. if($value['zd'] == 1)
  113. {
  114. $info_list[$key]['zd'] = "启用";
  115. }
  116. else
  117. {
  118. $info_list[$key]['zd'] = "无";
  119. }
  120. if($value['zdms'] == 1)
  121. {
  122. $info_list[$key]['zdms'] = "单独占单";
  123. }
  124. else if(($value['zdms'] == 2))
  125. {
  126. $info_list[$key]['zdms'] = "全占";
  127. }
  128. else if(($value['zdms'] == 3))
  129. {
  130. $info_list[$key]['zdms'] = "混占";
  131. }
  132. else
  133. {
  134. $info_list[$key]['zdms'] = "无";
  135. }
  136. if($value['express'] == 0)
  137. {
  138. $info_list[$key]['express'] = "无";
  139. }
  140. else
  141. {
  142. $express = $this->express->read($value['express']);
  143. $info_list[$key]['express'] = $express['servicename'];
  144. }
  145. if($value['fpzd'] == 1)
  146. {
  147. $info_list[$key]['fpzd'] = "自动";
  148. }
  149. else
  150. {
  151. $info_list[$key]['fpzd'] = "否";
  152. }
  153. if($value['wz'] == 1)
  154. {
  155. $info_list[$key]['wz'] = "开启";
  156. }
  157. else
  158. {
  159. $info_list[$key]['wz'] = "关闭";
  160. }
  161. if($value['bdcountry'] != 0)
  162. {
  163. $country = $this->country->read($value['bdcountry']);
  164. $info_list[$key]['bdcountry'] = $country['name'];
  165. }
  166. else
  167. {
  168. $info_list[$key]['bdcountry'] = "";
  169. }
  170. }
  171. $total = $this->warehouse->find_count($where);
  172. $pagenum = ceil($total/$perpage);
  173. $over = $total-($start+$perpage);
  174. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
  175. echo json_encode($rows);exit;
  176. }
  177. $this->_Template('warehouse',$this->data);
  178. }
  179. //添加
  180. public function _add()
  181. {
  182. $post = $this->input->post(NULL, TRUE);
  183. if(isset($post['title']))
  184. {
  185. $post['title'] = $this->input->post('title',true);
  186. $post['company'] = $this->input->post('company',true);
  187. $post['user'] = $this->input->post('user',true);
  188. $post['show'] = $this->input->post('show',true);
  189. //$post['function'] = $this->input->post('function',true);
  190. //$post['functiontext'] = $this->input->post('functiontext',true);
  191. $post['country'] = $this->input->post('country',true);
  192. $post['name'] = $this->input->post('name',true);
  193. $post['phone'] = $this->input->post('phone',true);
  194. $post['province'] = $this->input->post('province',true);
  195. $post['city'] = $this->input->post('city',true);
  196. $post['zipcode'] = $this->input->post('zipcode',true);
  197. $post['address'] = $this->input->post('address',true);
  198. $post['address2'] = $this->input->post('address2',true);
  199. $post['hz'] = $this->input->post('hz',true);
  200. $post['zd'] = $this->input->post('zd',true);
  201. $post['bdck'] = $this->input->post('bdck',true);
  202. if($post['zd'] == 1 && $post['bdck'] == '')
  203. {
  204. echo json_encode(array('msg'=>'开启占单模式必须填写绑定库','success'=>false));exit;
  205. }
  206. if($post['zd'] == 1 && $post['hz'] == '')
  207. {
  208. echo json_encode(array('msg'=>'开启占单模式必须填写占单后缀','success'=>false));exit;
  209. }
  210. if($post['zd'] == 1 && !ctype_alpha($post['hz']))
  211. {
  212. echo json_encode(array('msg'=>'占单后缀只允许是字母','success'=>false));exit;
  213. }
  214. if($this->warehouse->insert($post))
  215. {
  216. echo json_encode(array('msg'=>'添加成功','success'=>true));exit;
  217. }
  218. else
  219. {
  220. echo json_encode(array('msg'=>'添加失败,请重试','success'=>false));exit;
  221. }
  222. }
  223. $country = $this->country->find_all();
  224. $this->data['country'] = $country;
  225. $this->_Template('warehouse_add',$this->data);
  226. }
  227. //修改
  228. public function _edit($arg_array)
  229. {
  230. $post = $this->input->post(NULL, TRUE);
  231. if(isset($post['id']))
  232. {
  233. $id = $this->input->post('id',true);
  234. $data = $this->warehouse->read($id);
  235. $post['title'] = $this->input->post('title',true);
  236. $post['company'] = $this->input->post('company',true);
  237. $post['user'] = $this->input->post('user',true);
  238. $post['show'] = $this->input->post('show',true);
  239. /**
  240. $post['out'] = $this->input->post('out',true);
  241. if($post['out'] == 1)
  242. {
  243. //$post['mode'] = $this->input->post('mode',true);
  244. $post['mode'] = 0;
  245. }
  246. else
  247. {
  248. $post['mode'] = 0;
  249. }
  250. **/
  251. //$post['function'] = $this->input->post('function',true);
  252. //$post['functiontext'] = $this->input->post('functiontext',true);
  253. $post['country'] = $this->input->post('country',true);
  254. $post['name'] = $this->input->post('name',true);
  255. $post['phone'] = $this->input->post('phone',true);
  256. $post['province'] = $this->input->post('province',true);
  257. $post['city'] = $this->input->post('city',true);
  258. $post['zipcode'] = $this->input->post('zipcode',true);
  259. $post['address'] = $this->input->post('address',true);
  260. $post['address2'] = $this->input->post('address2',true);
  261. $post['hz'] = $this->input->post('hz',true);
  262. $post['zd'] = $this->input->post('zd',true);
  263. $post['bdck'] = $this->input->post('bdck',true);
  264. if($post['zd'] == 1 && $post['bdck'] == '' && $data['bdck'] == '')
  265. {
  266. echo json_encode(array('msg'=>'开启占单模式必须填写绑定库','success'=>false));exit;
  267. }
  268. if($post['zd'] == 1 && $post['hz'] == '' && $data['hz'] == '')
  269. {
  270. echo json_encode(array('msg'=>'开启占单模式必须填写占单后缀','success'=>false));exit;
  271. }
  272. if($post['hz'] && !ctype_alpha($post['hz']))
  273. {
  274. echo json_encode(array('msg'=>'占单后缀只允许是字母','success'=>false));exit;
  275. }
  276. if($data['bdck'] != '')
  277. {
  278. $post['bdck'] = $data['bdck'];
  279. }
  280. if($data['hz'] != '')
  281. {
  282. $post['hz'] = $data['hz'];
  283. }
  284. if($this->warehouse->save($post,$id))
  285. {
  286. echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
  287. }
  288. else
  289. {
  290. echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
  291. }
  292. }
  293. $arg_array = $arg_array[0];
  294. $warehouse = $this->warehouse->read($arg_array);
  295. $country = $this->country->find_all();
  296. $this->data['country'] = $country;
  297. $this->data['warehouse'] = $warehouse;
  298. $this->_Template('warehouse_edit',$this->data);
  299. }
  300. //删除
  301. public function _del()
  302. {
  303. $post = $this->input->post(NULL, TRUE);
  304. if(isset($post['s']))
  305. {
  306. $id_arr = $this->input->post('s');
  307. $id_arr = explode(',',$id_arr);
  308. if(!$id_arr)
  309. {
  310. echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
  311. }
  312. //循环删除记录
  313. foreach ($id_arr as $v)
  314. {
  315. $this->warehouse->remove($v);
  316. }
  317. echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
  318. }
  319. }
  320. //获取数据
  321. public function _rows()
  322. {
  323. $post = $this->input->post(NULL, TRUE);
  324. if(isset($post['rows']))
  325. {
  326. $rows = $this->input->post('rows',true);
  327. $bn = array('0'=>array('id'=>'3','title'=>'销售出库'),'1'=>array('id'=>'4','title'=>'非更换SKU方式调拨出库'));
  328. $cn = array('0'=>array('id'=>'5','title'=>'采购入库'),'1'=>array('id'=>'6','title'=>'单产品入库'),'2'=>array('id'=>'7','title'=>'非更换SKU方式调拨入库'));
  329. $an = array('0'=>array('id'=>'1','title'=>'出库','bn'=>$bn),'1'=>array('id'=>'2','title'=>'入库','bn'=>$cn));
  330. $warehouse = array();
  331. if($rows != "null")
  332. {
  333. $warehouse = $this->warehouse->read($rows);//找出次ID的权限内容
  334. if($warehouse['function'])
  335. {
  336. $warehouse = explode('|',trim($warehouse['function'],'|'));//数组化权限内容
  337. }
  338. }
  339. echo json_encode(array('msg'=>($an),'power'=>($warehouse),'success'=>true));
  340. }
  341. }
  342. public function _list()
  343. {
  344. $post = $this->input->post(NULL, TRUE);
  345. if(isset($post['id']))
  346. {
  347. $id = $this->input->post('id',true);
  348. $warehouse = $this->warehouse->read($id);
  349. if(isset($warehouse['zd']))
  350. {
  351. if(($warehouse['zd'] == '1' && $warehouse['ys'] == '1') || $warehouse['zd'] == '0')
  352. {
  353. $zd = '0';
  354. }
  355. else
  356. {
  357. $zd = '1';
  358. }
  359. echo json_encode(array('msg'=>$zd,'success'=>true));exit;
  360. }
  361. else
  362. {
  363. echo json_encode(array('msg'=>'错误,请重试','success'=>false));
  364. }
  365. }
  366. }
  367. public function _kcpd()
  368. {
  369. header("Access-Control-Allow-Origin: *");
  370. //echo json_encode(array('msg'=>'','success'=>true));exit;
  371. //暂时不用
  372. $post = $this->input->post(NULL, TRUE);
  373. if(isset($post['warehouse']))
  374. {
  375. $warehouse = $this->input->post('warehouse',true);
  376. $warehouse = $this->warehouse->read($warehouse);
  377. $whlabel = $this->input->post('whlabel',true);
  378. $shop = $this->input->post('shop',true);
  379. $data = $this->input->post('data',true);
  380. $data = str_replace('--','-',$data);
  381. $number = $this->input->post('number',true);
  382. // 替换下面代码 换成logic_order的方法
  383. // $y = $this->fullordersmt->get_number($number);
  384. // if(!$y)
  385. // {
  386. // $y = $this->fullorder->get_number($number);
  387. // }
  388. // if(!$y)
  389. // {
  390. // $y = $this->fullordertt->get_number($number);
  391. // }
  392. $y = $this->logic_order->getInfo("number = '".$number."'");
  393. if(!preg_match('/[0-9]/',$whlabel))
  394. {
  395. echo json_encode(array('msg'=>"无",'success'=>true));exit;
  396. }
  397. $typeclass = array();
  398. $tdata = $this->typeclass->find_all();
  399. foreach ($tdata as $v)
  400. {
  401. $typeclass[$v['id']] = $v['classid'];
  402. }
  403. $kxw = '';
  404. if(1==1)//($warehouse['zd'] == '0' || ($warehouse['zd'] == '1' && stripos($whlabel,$warehouse['hz'].'|') === false))
  405. {
  406. $kxw = '可用现货仓:';$tdfh = '';$cs = array();
  407. $warehousedata = $this->warehouse->find_all("zd = '1' and id != '8'");
  408. $pp = explode('|',trim($whlabel,'|'));
  409. $ccpp = explode('|',trim($data,'|'));
  410. $mgc = 0;//美国仓计数
  411. foreach ($warehousedata as $v)
  412. {
  413. //看日志发现这有个错误 居然没有国家 很有可能是 没有此订单 又怕影响其他 干脆直接跳过本次循环吧
  414. if(empty($y['country'])){
  415. continue;
  416. }
  417. if($y['country'] != '192' && $v['id'] == 5)
  418. {
  419. continue;
  420. }
  421. $x = 0;$j = 0;$save = array();$tdxh = 0;$thqd = 0;$thqdzh = '';$tdwh = 0;$tdshopwh = 0;$htpd = 0;$wearToGo = 0;$hdtx = '';
  422. foreach ($pp as $va)
  423. {
  424. $num = explode('-',$va);
  425. if($num[1] < 1)
  426. {
  427. continue;
  428. }
  429. $wh = $this->whlabel->find_count("state = '0' and number = '$num[0]' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
  430. $x++;
  431. if($wh < $num[1])
  432. {
  433. $cp = $ccpp[$x-1];
  434. $cp = str_replace(array('-163-','-164-','-165-','-166-'),'-',$cp);
  435. $save[] = $x-1;//提前先加X不然出错,所以要减1
  436. $cc = explode(',',$cp);
  437. if($v['id'] == '5')//美国仓提档检测是否有货
  438. {
  439. $tmp_cc = (int)$cc[0];
  440. //之所以这样写 是为了避免 没有尺寸的代码 造成的字符串加1 这种不可以 如果没有长度 就不会提档 tdxh如果为0 会提示加一档有现货
  441. if($tmp_cc > 0){
  442. $xcc = $this->typeclass->read($cc[0]+1);
  443. if($xcc['classid'] == '14')
  444. {
  445. $tdnum = $this->str_replace_limit($cc[0],$xcc['id'],$num[0]);
  446. $tdwh = $this->whlabel->find_count("state = '0' and number = '$tdnum' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
  447. }
  448. }
  449. if($tdwh < $num[1])
  450. {
  451. $tdxh += 1;//提前先加X不然出错,所以要减1
  452. }
  453. }
  454. //美国仓提档检测是否有货结束
  455. //103 Body Wave 1647 LooseBody
  456. if(stripos($cp,'-103-') !== false || stripos($cp,'-1647-') !== false)
  457. {
  458. $htpd += 1;
  459. $cc1 = explode('-',trim($cc[1],'-'));
  460. $newcp = '-';
  461. foreach ($cc1 as $kk=>$vv)
  462. {
  463. //曲度后边加了长度
  464. if($kk == 1)
  465. {
  466. $newcp .= $vv.'-'.$cc[0].'-';
  467. }
  468. else
  469. {
  470. $newcp .= $vv.'-';
  471. }
  472. }
  473. if(stripos($newcp,'-103-') !== false)
  474. {
  475. $gpp = str_replace('-103-','-1647-',$newcp);
  476. $thqdzh = 'Loose Body';
  477. }
  478. else
  479. {
  480. $gpp = str_replace('-1647-','-103-',$newcp);
  481. $thqdzh = 'Body';
  482. }
  483. $qdth_wh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  484. if($qdth_wh < $num[1])
  485. {
  486. $thqd += 1;//提前先加X不然出错,所以要减1
  487. }
  488. }
  489. /**
  490. if(stripos($cp,'-1181-') !== false)
  491. {
  492. $cc1 = explode('-',trim($cc[1],'-'));
  493. $newcp = '-';
  494. foreach ($cc1 as $kk=>$vv)
  495. {
  496. if($kk == 1)
  497. {
  498. $newcp .= $vv.'-'.$cc[0].'-';
  499. }
  500. else
  501. {
  502. $newcp .= $vv.'-';
  503. }
  504. }
  505. $gpp = str_replace('-1181-','-2071-',$newcp);
  506. $wtgo_wh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  507. if($wtgo_wh >= $num[1])
  508. {
  509. $wearToGo += 1;
  510. }
  511. }
  512. */
  513. /** /HKK
  514. if(stripos($cp,'-2028-') !== false)
  515. {
  516. $cc1 = explode('-',trim($cc[1],'-'));
  517. $newcp = '-';
  518. foreach ($cc1 as $kk=>$vv)
  519. {
  520. if($kk == 1)
  521. {
  522. $newcp .= $vv.'-'.$cc[0].'-';
  523. }
  524. else
  525. {
  526. $newcp .= $vv.'-';
  527. }
  528. }
  529. $gpp = str_replace('-2028-','-',$newcp);
  530. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  531. if($ccxh >= $num[1])
  532. {
  533. $hdtx .= $v['title'].' - 非HKK有货;';
  534. }
  535. }
  536. else if(stripos($cp,'-128-') !== false)
  537. {
  538. $cptt = array(16=>128,13=>80,14=>'',43=>'',8=>'57',15=>'',18=>'',6=>30,10=>72,9=>'',39=>'',44=>'');//头套
  539. $cc1 = explode('-',trim($cc[1],'-'));
  540. $cptt[$typeclass[$cc[0]]] = $cc[0];
  541. $newcp = '-';
  542. foreach ($cc1 as $kk=>$vv)
  543. {
  544. $cptt[$typeclass[$vv]] = $vv;
  545. }
  546. if($cptt[44] != '')
  547. {
  548. continue;
  549. }
  550. else
  551. {
  552. $cptt[44] = '2028';
  553. $cptt = array_filter($cptt);
  554. }
  555. $gpp = '-'.implode("-",$cptt).'-';
  556. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  557. if($ccxh >= $num[1])
  558. {
  559. $hdtx .= $v['title'].' - HKK有货;';
  560. }
  561. }
  562. **/
  563. //RTGWL 注释掉了
  564. // if(stripos($cp,'-2076-') !== false)
  565. // {
  566. // $cc1 = explode('-',trim($cc[1],'-'));
  567. // $newcp = '-';
  568. // foreach ($cc1 as $kk=>$vv)
  569. // {
  570. // if($kk == 1)
  571. // {
  572. // $newcp .= $vv.'-'.$cc[0].'-';
  573. // }
  574. // else
  575. // {
  576. // $newcp .= $vv.'-';
  577. // }
  578. // }
  579. // $gpp = str_replace('-2076-','-',$newcp);
  580. // $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  581. // if($ccxh >= $num[1])
  582. // {
  583. // $hdtx .= $v['title'].' - 非RTGWL有货;';
  584. // }
  585. // }
  586. // else if(stripos($cp,'-128-') !== false)
  587. // {
  588. // $cptt = array(16=>128,13=>80,14=>'',43=>'',8=>'57',15=>'',18=>'',6=>30,10=>72,9=>'',39=>'',44=>'');//头套
  589. // $cc1 = explode('-',trim($cc[1],'-'));
  590. // $cptt[$typeclass[$cc[0]]] = $cc[0];
  591. // $newcp = '-';
  592. // foreach ($cc1 as $kk=>$vv)
  593. // {
  594. // $cptt[$typeclass[$vv]] = $vv;
  595. // }
  596. // if($cptt[44] != '')
  597. // {
  598. // continue;
  599. // }
  600. // else
  601. // {
  602. // $cptt[44] = '2076';
  603. // $cptt = array_filter($cptt);
  604. // }
  605. // $gpp = '-'.implode("-",$cptt).'-';
  606. // $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  607. // if($ccxh >= $num[1])
  608. // {
  609. // $hdtx .= $v['title'].' - RTGWL有货;';
  610. // }
  611. // }
  612. // 4*7没货的,5*7如果有货,给提醒
  613. if(stripos($cp,'-1253-') !== false)
  614. {
  615. $cc1 = explode('-',trim($cc[1],'-'));
  616. $newcp = '-';
  617. foreach ($cc1 as $kk=>$vv)
  618. {
  619. if($kk == 1)
  620. {
  621. $newcp .= $vv.'-'.$cc[0].'-';
  622. }
  623. else
  624. {
  625. $newcp .= $vv.'-';
  626. }
  627. }
  628. $gpp = str_replace('-1253-','-2062-',$newcp);
  629. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  630. if($ccxh >= $num[1])
  631. {
  632. $hdtx .= $v['title'].' - 5*7有货;';
  633. }
  634. }
  635. // 1255 HD 4*7 Closure Wig HD 5*7 Closure Wig 如果有货,给提醒
  636. if(stripos($cp,'-1255-') !== false)
  637. {
  638. $cc1 = explode('-',trim($cc[1],'-'));
  639. $newcp = '-';
  640. foreach ($cc1 as $kk=>$vv)
  641. {
  642. if($kk == 1)
  643. {
  644. $newcp .= $vv.'-'.$cc[0].'-';
  645. }
  646. else
  647. {
  648. $newcp .= $vv.'-';
  649. }
  650. }
  651. $gpp = str_replace('-1255-','-2147-',$newcp);
  652. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  653. if($ccxh >= $num[1])
  654. {
  655. $hdtx .= $v['title'].' - 5*7有货;';
  656. }
  657. }
  658. // 1323 4*7 Bob Wig 5*7 Bob Wig 如果有货,给提醒
  659. if(stripos($cp,'-1323-') !== false)
  660. {
  661. $cc1 = explode('-',trim($cc[1],'-'));
  662. $newcp = '-';
  663. foreach ($cc1 as $kk=>$vv)
  664. {
  665. if($kk == 1)
  666. {
  667. $newcp .= $vv.'-'.$cc[0].'-';
  668. }
  669. else
  670. {
  671. $newcp .= $vv.'-';
  672. }
  673. }
  674. $gpp = str_replace('-1323-','-2167-',$newcp);
  675. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  676. if($ccxh >= $num[1])
  677. {
  678. $hdtx .= $v['title'].' - 5*7有货;';
  679. }
  680. }
  681. // 1257 HD 4*7 Bob Wig HD 5*7 Bob Wig 如果有货,给提醒
  682. if(stripos($cp,'-1257-') !== false)
  683. {
  684. $cc1 = explode('-',trim($cc[1],'-'));
  685. $newcp = '-';
  686. foreach ($cc1 as $kk=>$vv)
  687. {
  688. if($kk == 1)
  689. {
  690. $newcp .= $vv.'-'.$cc[0].'-';
  691. }
  692. else
  693. {
  694. $newcp .= $vv.'-';
  695. }
  696. }
  697. $gpp = str_replace('-1257-','-2434-',$newcp);
  698. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  699. if($ccxh >= $num[1])
  700. {
  701. $hdtx .= $v['title'].' - 5*7有货;';
  702. }
  703. }
  704. // 5*5没货的,5*7、5*9如果有货,给提醒
  705. if(stripos($cp,'-297-') !== false) //13*4 HD13*4
  706. {
  707. $cc1 = explode('-',trim($cc[1],'-'));
  708. $newcp = '-';
  709. foreach ($cc1 as $kk=>$vv)
  710. {
  711. if($kk == 1)
  712. {
  713. $newcp .= $vv.'-'.$cc[0].'-';
  714. }
  715. else
  716. {
  717. $newcp .= $vv.'-';
  718. }
  719. }
  720. $gpp = str_replace('-297-','-2062-',$newcp);
  721. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  722. if($ccxh >= $num[1])
  723. {
  724. $hdtx .= $v['title'].' - 5*7有货;';
  725. }
  726. $gpp2 = str_replace('-297-','-1254-',$newcp);
  727. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp2' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  728. if($ccxh >= $num[1])
  729. {
  730. $hdtx .= $v['title'].' - 5*9有货;';
  731. }
  732. }
  733. // 180%货的,200、250如果有货,给提醒
  734. if(stripos($cp,'-72-') !== false) //13*4 HD13*4
  735. {
  736. if(isset($cc[1])){
  737. $cc1 = explode('-',trim($cc[1],'-'));
  738. $newcp = '-';
  739. foreach ($cc1 as $kk=>$vv)
  740. {
  741. if($kk == 1)
  742. {
  743. $newcp .= $vv.'-'.$cc[0].'-';
  744. }
  745. else
  746. {
  747. $newcp .= $vv.'-';
  748. }
  749. }
  750. $gpp = str_replace('-72-','-73-',$newcp);
  751. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  752. if($ccxh >= $num[1])
  753. {
  754. $hdtx .= $v['title'].' - 200%密度有货;';
  755. }
  756. $gpp2 = str_replace('-72-','-74-',$newcp);
  757. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp2' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  758. if($ccxh >= $num[1])
  759. {
  760. $hdtx .= $v['title'].' - 250%密度有货;';
  761. }
  762. }
  763. }
  764. if(stripos($cp,'-73-') !== false) //200% 250%
  765. {
  766. $cc1 = explode('-',trim($cc[1],'-'));
  767. $newcp = '-';
  768. foreach ($cc1 as $kk=>$vv)
  769. {
  770. if($kk == 1)
  771. {
  772. $newcp .= $vv.'-'.$cc[0].'-';
  773. }
  774. else
  775. {
  776. $newcp .= $vv.'-';
  777. }
  778. }
  779. $gpp2 = str_replace('-73-','-74-',$newcp);
  780. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp2' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  781. if($ccxh >= $num[1])
  782. {
  783. $hdtx .= $v['title'].' - 250%密度有货;';
  784. }
  785. }
  786. //HD相互提醒
  787. if(stripos($cp,'-146-') !== false || stripos($cp,'-331-') !== false) //13*4 HD13*4
  788. {
  789. $cc1 = explode('-',trim($cc[1],'-'));
  790. $newcp = '-';
  791. foreach ($cc1 as $kk=>$vv)
  792. {
  793. if($kk == 1)
  794. {
  795. $newcp .= $vv.'-'.$cc[0].'-';
  796. }
  797. else
  798. {
  799. $newcp .= $vv.'-';
  800. }
  801. }
  802. if(stripos($cp,'-146-') !== false)
  803. {
  804. $gpp = str_replace('-146-','-331-',$newcp);
  805. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  806. if($ccxh >= $num[1])
  807. {
  808. $hdtx .= $v['title'].' - HD13*4有货;';
  809. }
  810. }
  811. else if(stripos($cp,'-331-') !== false)
  812. {
  813. $gpp = str_replace('-331-','-146-',$newcp);
  814. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  815. if($ccxh >= $num[1])
  816. {
  817. $hdtx .= $v['title'].' - 13*4有货;';
  818. }
  819. }
  820. }
  821. if(stripos($cp,'-322-') !== false || stripos($cp,'-341-') !== false)//13*6 HD13*6
  822. {
  823. $cc1 = explode('-',trim($cc[1],'-'));
  824. $newcp = '-';
  825. foreach ($cc1 as $kk=>$vv)
  826. {
  827. if($kk == 1)
  828. {
  829. $newcp .= $vv.'-'.$cc[0].'-';
  830. }
  831. else
  832. {
  833. $newcp .= $vv.'-';
  834. }
  835. }
  836. if(stripos($cp,'-322-') !== false)
  837. {
  838. $gpp = str_replace('-322-','-341-',$newcp);
  839. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  840. if($ccxh >= $num[1])
  841. {
  842. $hdtx .= $v['title'].' - HD13*6有货;';
  843. }
  844. }
  845. else if(stripos($cp,'-341-') !== false)
  846. {
  847. $gpp = str_replace('-341-','-322-',$newcp);
  848. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  849. if($ccxh >= $num[1])
  850. {
  851. $hdtx .= $v['title'].' - 13*6有货;';
  852. }
  853. }
  854. }
  855. if(stripos($cp,'-147-') !== false || stripos($cp,'-781-') !== false)//4*4 HD4*4
  856. {
  857. $cc1 = explode('-',trim($cc[1],'-'));
  858. $newcp = '-';
  859. foreach ($cc1 as $kk=>$vv)
  860. {
  861. if($kk == 1)
  862. {
  863. $newcp .= $vv.'-'.$cc[0].'-';
  864. }
  865. else
  866. {
  867. $newcp .= $vv.'-';
  868. }
  869. }
  870. if(stripos($cp,'-147-') !== false)
  871. {
  872. $gpp = str_replace('-147-','-781-',$newcp);
  873. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  874. if($ccxh >= $num[1])
  875. {
  876. $hdtx .= $v['title'].' - HD4*4有货;';
  877. }
  878. }
  879. else if(stripos($cp,'-781-') !== false)
  880. {
  881. $gpp = str_replace('-781-','-147-',$newcp);
  882. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  883. if($ccxh >= $num[1])
  884. {
  885. $hdtx .= $v['title'].' - 4*4有货;';
  886. }
  887. }
  888. }
  889. if(stripos($cp,'-297-') !== false || stripos($cp,'-540-') !== false)//5*5 HD5*5
  890. {
  891. $cc1 = explode('-',trim($cc[1],'-'));
  892. $newcp = '-';
  893. foreach ($cc1 as $kk=>$vv)
  894. {
  895. if($kk == 1)
  896. {
  897. $newcp .= $vv.'-'.$cc[0].'-';
  898. }
  899. else
  900. {
  901. $newcp .= $vv.'-';
  902. }
  903. }
  904. if(stripos($cp,'-297-') !== false)
  905. {
  906. $gpp = str_replace('-297-','-540-',$newcp);
  907. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  908. if($ccxh >= $num[1])
  909. {
  910. $hdtx .= $v['title'].' - HD5*5有货;';
  911. }
  912. }
  913. else if(stripos($cp,'-540-') !== false)
  914. {
  915. $gpp = str_replace('-540-','-297-',$newcp);
  916. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  917. if($ccxh >= $num[1])
  918. {
  919. $hdtx .= $v['title'].' - 5*5有货;';
  920. }
  921. }
  922. }
  923. if(stripos($cp,'-298-') !== false || stripos($cp,'-370-') !== false)//6*6 HD6*6
  924. {
  925. $cc1 = explode('-',trim($cc[1],'-'));
  926. $newcp = '-';
  927. foreach ($cc1 as $kk=>$vv)
  928. {
  929. if($kk == 1)
  930. {
  931. $newcp .= $vv.'-'.$cc[0].'-';
  932. }
  933. else
  934. {
  935. $newcp .= $vv.'-';
  936. }
  937. }
  938. if(stripos($cp,'-298-') !== false)
  939. {
  940. $gpp = str_replace('-298-','-370-',$newcp);
  941. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  942. if($ccxh >= $num[1])
  943. {
  944. $hdtx .= $v['title'].' - HD6*6有货;';
  945. }
  946. }
  947. else if(stripos($cp,'-370-') !== false)
  948. {
  949. $gpp = str_replace('-370-','-298-',$newcp);
  950. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  951. if($ccxh >= $num[1])
  952. {
  953. $hdtx .= $v['title'].' - 6*6有货;';
  954. }
  955. }
  956. }
  957. //抽绳款 和非抽绳款的相互提醒 针对头套
  958. if(stripos($cp,'-128-') !== false){
  959. $cc1 = explode('-',trim($cc[1],'-'));
  960. $newcp = '-';
  961. foreach ($cc1 as $kk=>$vv)
  962. {
  963. if($kk == 1)
  964. {
  965. $newcp .= $vv.'-'.$cc[0].'-';
  966. }
  967. else
  968. {
  969. $newcp .= $vv.'-';
  970. }
  971. }
  972. //如果是抽绳款 可以找下非抽绳的库存
  973. if(stripos($cp,'-2661-') !== false){
  974. $gpp = str_replace('-2661-','-',$newcp);
  975. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  976. if($ccxh >= $num[1])
  977. {
  978. $hdtx .= $v['title'].' - 非抽绳款有库存!';
  979. }
  980. }else{
  981. $gpp = $newcp."2661-";
  982. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  983. if($ccxh >= $num[1])
  984. {
  985. $hdtx .= $v['title'].' - 抽绳款有库存!';
  986. }
  987. }
  988. }
  989. // 常规品 带MShaped字眼 带Upgraded MShaped(Lagos Hairline)字眼(M发际线升级版)
  990. // 2468 2608 这个是头套的 判断的
  991. if(stripos($cp,'-128-') !== false){
  992. $sku = trim($cp,'-');
  993. $sku = str_replace(',','-',$sku);
  994. $sku = str_replace('--','-',$sku);
  995. $tmp_arr = explode('-',$sku);
  996. $tmp_arr = $this->logic_zhlp->transferSku($tmp_arr);
  997. //判断是否 有50
  998. if(isset($tmp_arr[50])){
  999. $arr_no = $arr_2468 = $arr_2608 =$tmp_arr;
  1000. unset($arr_no[50]);
  1001. $arr_2468[50] = 2468;
  1002. $arr_2608[50] = 2608;
  1003. }else{
  1004. $arr_no = $arr_2468 = $arr_2608 =$tmp_arr;
  1005. $arr_2468[50] = 2468;
  1006. $arr_2608[50] = 2608;
  1007. }
  1008. $res = $this->logic_zhlp->sortByClass($arr_no);
  1009. $fianal_arr_no = $res['data'];
  1010. $res = $this->logic_zhlp->sortByClass($arr_2468);
  1011. $fianal_arr_2468 = $res['data'];
  1012. $res = $this->logic_zhlp->sortByClass($arr_2608);
  1013. $fianal_arr_2608 = $res['data'];
  1014. $final_size = $fianal_arr_no[14];
  1015. unset($fianal_arr_no[14]);
  1016. unset($fianal_arr_2468[14]);
  1017. unset($fianal_arr_2608[14]);
  1018. $final_str_no = $final_size.",-".implode("-",$fianal_arr_no)."-";
  1019. $final_str_2468 = $final_size.",-".implode("-",$fianal_arr_2468)."-";
  1020. $final_str_2608 = $final_size.",-".implode("-",$fianal_arr_2608)."-";
  1021. $do_str_no = $this->logic_u9tools->getGoodFeatureAlone($final_str_no);
  1022. $do_str_2468 = $this->logic_u9tools->getGoodFeatureAlone($final_str_2468);
  1023. $do_str_2608 = $this->logic_u9tools->getGoodFeatureAlone($final_str_2608);
  1024. //非M发际线/2468 M发际线/2608 M发际线升级版有货
  1025. if(stripos($cp,'-2468-') !== false){
  1026. $num_no = $this->whlabel->find_count("state = '0' and features = '$do_str_no' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
  1027. $num_2608 = $this->whlabel->find_count("state = '0' and features = '$do_str_2608' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
  1028. if($num_no > 0){
  1029. $hdtx .= $v['title'].' - 非M发际线有货*'.$num_no.';';
  1030. }
  1031. if($num_2608 > 0){
  1032. $hdtx .= $v['title'].' - M发际线升级版有货*'.$num_2608.';';
  1033. }
  1034. }elseif(stripos($cp,'-2608-') !== false){
  1035. $num_no = $this->whlabel->find_count("state = '0' and features = '$do_str_no' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
  1036. $num_2468 = $this->whlabel->find_count("state = '0' and features = '$do_str_2468' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
  1037. if($num_no > 0){
  1038. $hdtx .= $v['title'].' - 非M发际线有货*'.$num_no.';';
  1039. }
  1040. if($num_2468 > 0){
  1041. $hdtx .= $v['title'].' - M发际线有货*'.$num_2468.';';
  1042. }
  1043. }else{
  1044. $num_2608 = $this->whlabel->find_count("state = '0' and features = '$do_str_2608' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
  1045. $num_2468 = $this->whlabel->find_count("state = '0' and features = '$do_str_2468' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
  1046. if($num_2608 > 0){
  1047. $hdtx .= $v['title'].' - M发际线升级版有货*'.$num_2608.';';
  1048. }
  1049. if($num_2468 > 0){
  1050. $hdtx .= $v['title'].' - M发际线有货*'.$num_2468.';';
  1051. }
  1052. }
  1053. }
  1054. if(stripos($cp,'-935-') !== false || stripos($cp,'-854-') !== false)//#P4/27/613 #P4/613
  1055. {
  1056. $cc1 = explode('-',trim($cc[1],'-'));
  1057. $newcp = '-';
  1058. foreach ($cc1 as $kk=>$vv)
  1059. {
  1060. if($kk == 1)
  1061. {
  1062. $newcp .= $vv.'-'.$cc[0].'-';
  1063. }
  1064. else
  1065. {
  1066. $newcp .= $vv.'-';
  1067. }
  1068. }
  1069. if(stripos($cp,'-935-') !== false)
  1070. {
  1071. $gpp = str_replace('-935-','-854-',$newcp);
  1072. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  1073. if($ccxh >= $num[1])
  1074. {
  1075. $hdtx .= $v['title'].' - #P4/613;';
  1076. }
  1077. }
  1078. else if(stripos($cp,'-854-') !== false)
  1079. {
  1080. $gpp = str_replace('-854-','-935-',$newcp);
  1081. $ccxh = $this->whlabel->find_count("state = '0' and features = '$gpp' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  1082. if($ccxh >= $num[1])
  1083. {
  1084. $hdtx .= $v['title'].' - #P4/27/613;';
  1085. }
  1086. }
  1087. }
  1088. //HD相互提醒结束
  1089. if(isset($cc[1])){
  1090. $cc1 = explode('-',trim($cc[1],'-'));
  1091. $newcp = '-';
  1092. foreach ($cc1 as $kk=>$vv)
  1093. {
  1094. if($kk == 1)
  1095. {
  1096. $newcp .= $vv.'-'.$cc[0].'-';
  1097. }
  1098. else
  1099. {
  1100. $newcp .= $vv.'-';
  1101. }
  1102. }
  1103. }else{
  1104. //$this->logic_ding->sendToDing("仓库kcpd提醒cc".json_encode($cc).'cp'.json_encode($cp)."ccpp".json_encode($ccpp)."number:".$number);
  1105. $newcp = $cc[0];
  1106. }
  1107. //在途库存
  1108. $transportlist = $this->whlabeltransport->find_all("features = '".$newcp."' and cz = 0 and warehouse = '".$v['id']."'");
  1109. $transportMsg = "";
  1110. if(count($transportlist) > 0)
  1111. {
  1112. $transportItem = $transportlist[0];
  1113. $transportMsg = "<br/>". $transportItem['sku'] . " 在途库存: <b>" . $transportItem['num'] . " </b> 预达时间: ".date("Y-m-d",$transportItem['stime']). " <br/> 备注 : " . $transportItem['text'];
  1114. }
  1115. }
  1116. else
  1117. {
  1118. if($v['id'] == '5')
  1119. {
  1120. $mgc++;
  1121. }
  1122. else
  1123. {
  1124. $kxw .= $v['title'].';';
  1125. }
  1126. }
  1127. }
  1128. if(!isset($save[0]))//非预设仓库提醒
  1129. {
  1130. //$kxw .= $v['title'].';';
  1131. }
  1132. else
  1133. {
  1134. if($v['id'] == '5' && $tdxh == '0')
  1135. {
  1136. $kxw .= $v['title'].'(当前尺寸无货,提一档有货) ;';
  1137. }
  1138. if($thqd == 0 && $htpd > 0)
  1139. {
  1140. $kxw .= $v['title'].'(当前曲度无货,'.$thqdzh.'有货) ;';
  1141. }
  1142. if($wearToGo > 0)
  1143. {
  1144. $kxw .= $v['title'].'(ReadytoGo有货) ;';
  1145. }
  1146. if($hdtx != '')
  1147. {
  1148. $kxw .= $hdtx;
  1149. }
  1150. if (!empty($transportMsg)) {
  1151. $kxw .= $transportMsg;
  1152. }
  1153. }
  1154. }
  1155. }
  1156. if(isset($pp) && $mgc == count($pp))
  1157. {
  1158. $kxw .= '美国店;';
  1159. }
  1160. if($kxw == '可用现货仓:')
  1161. {
  1162. echo json_encode(array('msg'=>$kxw.'无','cs'=>$cs,'success'=>true));exit;
  1163. }
  1164. else
  1165. {
  1166. echo json_encode(array('msg'=>rtrim($kxw,';'),'success'=>true));exit;
  1167. }
  1168. }
  1169. }
  1170. public function str_replace_limit($search, $replace, $subject)
  1171. {
  1172. $pos = strpos($subject, $search);
  1173. if ($pos !== false)
  1174. {
  1175. return substr_replace($subject, $replace, $pos, strlen($search));
  1176. }
  1177. return $subject;
  1178. }
  1179. public function _orderlist()
  1180. {
  1181. $post = $this->input->post(NULL, TRUE);
  1182. if(isset($_SESSION['api']))
  1183. {
  1184. $user = $this->user->get_api($_SESSION['api']);
  1185. $usp = $user;
  1186. $fgshop = "";$sid = "";$wid="";$wtype="";
  1187. $usersp = explode('|',trim($user['shop'],'|'));
  1188. $userwh = explode('|',trim($user['warehouse'],'|'));
  1189. foreach ($usersp as $value)
  1190. {
  1191. $fgshop .= " shop = ".$value." or";
  1192. $sid .= " id = ".$value." or";
  1193. }
  1194. foreach ($userwh as $value)
  1195. {
  1196. $wid .= " id = ".$value." or";
  1197. $wtype .= " type = ".$value." or";
  1198. }
  1199. }
  1200. if(isset($post['page']))
  1201. {
  1202. $page = $this->input->post('page',true);
  1203. $perpage = $this->input->post('perpage',true);
  1204. $timetk = $this->input->post('timetk',true);
  1205. $timetj = $this->input->post('timetj',true);
  1206. $orderinfo = $this->input->post('orderinfo',true);
  1207. $number = $this->input->post('number',true);
  1208. $print = $this->input->post('print',true);
  1209. $shop = $this->input->post('shop',true);
  1210. $type = $this->input->post('type',true);
  1211. $ckfl = $this->input->post('ckfl',true);
  1212. $so = $this->input->post('so',true);
  1213. $sfxh = $this->input->post('sfxh',true);
  1214. $library = $this->input->post('library',true);
  1215. $libraryconfirm = $this->input->post('libraryconfirm',true);
  1216. $timetk = strtotime($timetk);
  1217. $timetj = strtotime($timetj);
  1218. $where = (isset($_SESSION['api']))?"(".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
  1219. if($orderinfo)
  1220. {
  1221. $where .= " and orderinfo = '$orderinfo'";
  1222. }
  1223. if($number)
  1224. {
  1225. $where .= " and number = '$number'";
  1226. }
  1227. if($print)
  1228. {
  1229. $where .= " and print = '$print'";
  1230. if($print == 3)
  1231. {
  1232. $where .= " and printtime > '$timetk' and printtime < '$timetj'";
  1233. }
  1234. }
  1235. if($shop)
  1236. {
  1237. $where .= " and shop = '$shop'";
  1238. }
  1239. if($type)
  1240. {
  1241. $where .= " and type = '$type'";
  1242. }
  1243. if($so)
  1244. {
  1245. $where .= " and shipremarks like '%$so%'";
  1246. }
  1247. if($ckfl)
  1248. {
  1249. $where .= " and ckfl = '$ckfl'";
  1250. }
  1251. if($library)
  1252. {
  1253. $where .= " and library = '$library'";
  1254. }
  1255. if($type)
  1256. {
  1257. $where .= " and type = '$type'";
  1258. }
  1259. if($libraryconfirm)
  1260. {
  1261. $where .= " and libraryconfirm = '$libraryconfirm'";
  1262. }
  1263. //数据排序
  1264. $order_str = ($print != 3)?"id desc":"printtime desc";
  1265. if(empty($page))
  1266. {
  1267. $start = 0;
  1268. $perpage = 1;
  1269. }
  1270. else
  1271. {
  1272. $start = ($page - 1)*$perpage;
  1273. }
  1274. $t = array();
  1275. $transfer = $this->transfer->find_all();
  1276. foreach ($transfer as $v)
  1277. {
  1278. $t[$v['id']] = $v['title'];
  1279. $ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
  1280. }
  1281. //取得信息列表
  1282. $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,printtime,librarytime,shipremarks',$order_str,$start,$perpage);
  1283. foreach ($info_list as $key=>$value) {
  1284. $info_list[$key]['id'] = "fullorder-".$value['id'];
  1285. }
  1286. $info_listsmt = $this->fullordersmt->find_all($where." and mergeid != '1'",'id,shop,orderinfo,number,printtime,librarytime,shipremarks',$order_str,$start,$perpage);
  1287. foreach ($info_listsmt as $key=>$value) {
  1288. $info_listsmt[$key]['id'] = "fullordersmt-".$value['id'];
  1289. }
  1290. $info_listtt = $this->fullordertt->find_all($where." and mergeid != '1'",'id,shop,orderinfo,number,printtime,librarytime,shipremarks',$order_str,$start,$perpage);
  1291. foreach ($info_listtt as $key=>$value) {
  1292. $info_listtt[$key]['id'] = "fullordertt-".$value['id'];
  1293. }
  1294. $info_listamz = $this->fullorderamz->find_all($where." and mergeid != '1'",'id,shop,orderinfo,number,printtime,librarytime,shipremarks',$order_str,$start,$perpage);
  1295. foreach ($info_listamz as $key=>$value) {
  1296. $info_listamz[$key]['id'] = "fullorderamz-".$value['id'];
  1297. }
  1298. $rows = array_merge($info_list,$info_listsmt,$info_listtt,$info_listamz);
  1299. //格式化数据
  1300. foreach ($rows as $key=>$value)
  1301. {
  1302. $rows[$key]['id'] = $value['id'].'-fullorder';
  1303. $shop = $this->shop->read($value['shop']);
  1304. $rows[$key]['shop'] = $shop['shopname'];
  1305. if($value['printtime'] > 0)
  1306. {
  1307. $rows[$key]['printtime'] = date('Y-m-d H:s',$value['printtime']);
  1308. }
  1309. else
  1310. {
  1311. $rows[$key]['printtime'] = '未打印';
  1312. }
  1313. if(isset($value['librarytime']) && $value['librarytime'] > 0)
  1314. {
  1315. $rows[$key]['librarytime'] = date('Y-m-d H:s',$value['librarytime']);
  1316. }
  1317. else
  1318. {
  1319. $rows[$key]['librarytime'] = '未出库';
  1320. }
  1321. $rows[$key]['orderinfo'] = "<h9 class='window' data-h='/warehouse/ordersee/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p></h9>";
  1322. $rows[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  1323. $out = '';
  1324. $tf = $this->systemtransfer->find_all("number = '".$value['number']."'");
  1325. if(!empty($tf)){
  1326. if($tf[0]['is_jiaji']){
  1327. $rows[$key]['number'] = "<a href='javascript:void(0)' style='color:red'>".$rows[$key]['number']."加急!!!</a>";
  1328. }
  1329. }
  1330. foreach ($tf as $k=>$v)
  1331. {
  1332. if(count($tf) > 1)
  1333. {
  1334. $out .= $k.'<br>';
  1335. }
  1336. $data = $this->systemtransfer_cr->find_all("fid = '".$v['id']."'");
  1337. $out = "订单打印 :".date('Y-m-d H:i',$value['printtime']).'<br>';
  1338. foreach ($data as $k=>$v)
  1339. {
  1340. $type = ($v['type']==1)?'入库':'出库';
  1341. $out .= $t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']).'<br>';
  1342. }
  1343. }
  1344. $rows[$key]['outread'] = trim($out,'<br>');
  1345. }
  1346. $dlz = $this->fullorder->find_count($where);
  1347. $smt = $this->fullordersmt->find_count($where);
  1348. $tt = $this->fullordertt->find_count($where);
  1349. $amz = $this->fullorderamz->find_count($where);
  1350. //$total += $this->fullorder_smt->find_count($where);
  1351. $total = $dlz+$smt+$tt+$amz;
  1352. //$rows = array_slice($rows,$start,$perpage);
  1353. $pagenum = ceil($total/$perpage);
  1354. $over = $total-($start+$perpage);
  1355. $tmp = array();
  1356. if($print == 3)
  1357. {
  1358. foreach ($rows as $key => $val)
  1359. {
  1360. $tmp[$key] = $val['printtime'];
  1361. }
  1362. array_multisort($tmp,SORT_DESC,$rows);
  1363. }
  1364. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($rows),'cs'=>$where);//array_merge($info_list,$info_list_smt,$info_listsmt)
  1365. echo json_encode($rows);exit;
  1366. }
  1367. if(isset($_SESSION['api']))
  1368. {
  1369. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  1370. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  1371. $this->data['wlshop'] = $wlshop;
  1372. $this->data['warehouse'] = $warehouse;
  1373. }
  1374. $this->_Template('warehouse_orderlist',$this->data);
  1375. }
  1376. public function _orderlistck()//华荣厂查看
  1377. {
  1378. $post = $this->input->post(NULL, TRUE);
  1379. if(isset($_SESSION['api']))
  1380. {
  1381. $user = $this->user->get_api($_SESSION['api']);
  1382. $usp = $user;
  1383. $fgshop = "";$sid = "";$wid="";$wtype="";
  1384. $usersp = explode('|',trim($user['shop'],'|'));
  1385. $userwh = explode('|',trim($user['warehouse'],'|'));
  1386. foreach ($usersp as $value)
  1387. {
  1388. $fgshop .= " shop = ".$value." or";
  1389. $sid .= " id = ".$value." or";
  1390. }
  1391. foreach ($userwh as $value)
  1392. {
  1393. $wid .= " id = ".$value." or";
  1394. $wtype .= " type = ".$value." or";
  1395. }
  1396. }
  1397. if(isset($post['page']))
  1398. {
  1399. $page = $this->input->post('page',true);
  1400. $perpage = $this->input->post('perpage',true);
  1401. $number = $this->input->post('number',true);
  1402. $so = $this->input->post('so',true);
  1403. $where = (isset($_SESSION['api']))?"(".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
  1404. if($number)
  1405. {
  1406. $where .= " and number = '$number'";
  1407. }
  1408. if($so)
  1409. {
  1410. $where .= " and shipremarks like '%$so%'";
  1411. }
  1412. if(!$so && !$number)
  1413. {
  1414. $where = "id < 0";
  1415. }
  1416. //数据排序
  1417. $order_str = "id desc";
  1418. if(empty($page))
  1419. {
  1420. $start = 0;
  1421. $perpage = 1;
  1422. }
  1423. else
  1424. {
  1425. $start = ($page - 1)*$perpage;
  1426. }
  1427. $info_list = array();
  1428. $info_listsmt = array();
  1429. $dlz = 0; $smt = 0;
  1430. //取得信息列表
  1431. $info_list = $this->fullorder->find_all($where,'id,number,shipremarks',$order_str,$start,$perpage);
  1432. $info_listsmt = $this->fullordersmt->find_all($where." and mergeid != '1'",'id,number,shipremarks',$order_str,$start,$perpage);
  1433. $info_listtt = $this->fullordertt->find_all($where." and mergeid != '1'",'id,number,shipremarks',$order_str,$start,$perpage);
  1434. $info_listamz = $this->fullorderamz->find_all($where." and mergeid != '1'",'id,number,shipremarks',$order_str,$start,$perpage);
  1435. $rows = array_merge($info_list,$info_listsmt,$info_listtt,$info_listamz);
  1436. //格式化数据
  1437. foreach ($rows as $key=>$value)
  1438. {
  1439. $rows[$key]['id'] = $value['id'].'-fullorder';
  1440. $rows[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  1441. $systemwigsout = $this->systemwigsout->get_number($value['number']);
  1442. $wigsout = '';
  1443. if($systemwigsout)
  1444. {
  1445. $cz = explode('|',trim($systemwigsout['cz'],'|'));
  1446. $cztime = explode('|',trim($systemwigsout['cztime'],'|'));
  1447. $zw = array();
  1448. $t = $this->transfer->find_all("1=1");
  1449. foreach ($t as $v)
  1450. {
  1451. $zw[$v['id']] = $v['title'];
  1452. }
  1453. if($systemwigsout['cz'] != '' && count($cz) > 0)
  1454. {
  1455. for($i=0;$i<count($cz);$i++)
  1456. {
  1457. if(!isset($cztime[$i]))
  1458. {
  1459. $wigsout .= $zw[$cz[$i]];
  1460. }
  1461. else
  1462. {
  1463. $wigsout .= $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).',';
  1464. }
  1465. }
  1466. }
  1467. }
  1468. $rows[$key]['systemwigsout'] = rtrim($wigsout,',');
  1469. }
  1470. $dlz = $this->fullorder->find_count($where);
  1471. $smt = $this->fullordersmt->find_count($where);
  1472. $tt = $this->fullordersmt->find_count($where);
  1473. $amz = $this->fullorderamz->find_count($where);
  1474. //$total += $this->fullorder_smt->find_count($where);
  1475. $total = $dlz+$smt+$tt+$amz;
  1476. //$rows = array_slice($rows,$start,$perpage);
  1477. $pagenum = ceil($total/$perpage);
  1478. $over = $total-($start+$perpage);
  1479. $tmp = array();
  1480. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($rows),'cs'=>$where);//array_merge($info_list,$info_list_smt,$info_listsmt)
  1481. echo json_encode($rows);exit;
  1482. }
  1483. if(isset($_SESSION['api']))
  1484. {
  1485. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  1486. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  1487. $this->data['wlshop'] = $wlshop;
  1488. $this->data['warehouse'] = $warehouse;
  1489. }
  1490. $this->_Template('warehouse_orderlistck',$this->data);
  1491. }
  1492. public function _ordersee($arg_array)
  1493. {
  1494. $arr_str = $arg_array[0];
  1495. $arr= explode('-',rtrim($arr_str,'-'));
  1496. $table_name = $arr[0];
  1497. $arg_array = $arr[1];
  1498. $fullorder = $table_name;
  1499. $data = $this->$fullorder->read($arg_array);
  1500. // $fullorder = 'fullorder';
  1501. // $data = $this->fullorder->read($arg_array);
  1502. // if(!$data)
  1503. // {
  1504. // $fullorder = 'fullordersmt';
  1505. // $data = $this->fullordersmt->read($arg_array);
  1506. // }
  1507. // if(!$data)
  1508. // {
  1509. // $fullorder = 'fullordertt';
  1510. // $data = $this->fullordertt->read($arg_array);
  1511. // }
  1512. // if(!$data){
  1513. // $fullorder = 'fullorderamz';
  1514. // $data = $this->fullorderamz->read($arg_array);
  1515. // }
  1516. $fpdata = array();
  1517. $fullorder = $this->$fullorder->read($arg_array);
  1518. if(stripos($fullorder['fpdata'],';') !== false)
  1519. {
  1520. $fpdata = explode(';',rtrim($fullorder['fpdata'],';'));
  1521. foreach ($fpdata as $k=>$v)
  1522. {
  1523. $fpdata[$k] = explode('|',$v);
  1524. }
  1525. }
  1526. $systemwigsout = $this->systemwigsout->get_number($fullorder['number']);
  1527. $wigsout = array();
  1528. if($systemwigsout)
  1529. {
  1530. $cz = explode('|',trim($systemwigsout['cz'],'|'));
  1531. $cztime = explode('|',trim($systemwigsout['cztime'],'|'));
  1532. $zw = array();
  1533. $t = $this->transfer->find_all("1=1");
  1534. foreach ($t as $v)
  1535. {
  1536. $zw[$v['id']] = $v['title'];
  1537. }
  1538. if($systemwigsout['cz'] != '' && count($cz) > 0)
  1539. {
  1540. for($i=0;$i<count($cz);$i++)
  1541. {
  1542. if(!isset($cztime[$i]))
  1543. {
  1544. $wigsout[] = $zw[$cz[$i]];
  1545. }
  1546. else
  1547. {
  1548. $wigsout[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]);
  1549. }
  1550. }
  1551. }
  1552. }
  1553. $this->data['systemwigsout'] = $wigsout;
  1554. $this->data['fpdata'] = $fpdata;
  1555. $this->data['data'] = $data;
  1556. $this->_Template('warehouse_ordersee',$this->data);
  1557. }
  1558. public function _orderlistexcel()
  1559. {
  1560. $post = $this->input->post(NULL, TRUE);
  1561. if(isset($_SESSION['api']))
  1562. {
  1563. $user = $this->user->get_api($_SESSION['api']);
  1564. $usp = $user;
  1565. $fgshop = "";$sid = "";$wid="";$wtype="";
  1566. $usersp = explode('|',trim($user['shop'],'|'));
  1567. $userwh = explode('|',trim($user['warehouse'],'|'));
  1568. foreach ($usersp as $value)
  1569. {
  1570. $fgshop .= " shop = ".$value." or";
  1571. $sid .= " id = ".$value." or";
  1572. }
  1573. foreach ($userwh as $value)
  1574. {
  1575. $wid .= " id = ".$value." or";
  1576. $wtype .= " type = ".$value." or";
  1577. }
  1578. }
  1579. if(isset($_GET['excel']))
  1580. {
  1581. $a = $this->input->get('a',true);
  1582. $id_is = '';$id_smt = '';
  1583. if($a)
  1584. {
  1585. $a = explode(',',rtrim($a,','));
  1586. foreach ($a as $value)
  1587. {
  1588. $v = explode('-',$value);
  1589. if($v[1] == 'fullorder')
  1590. {
  1591. $id_is .= "id = ".$v[0]." or ";
  1592. }
  1593. else
  1594. {
  1595. $id_smt .= "id = ".$v[0]." or ";
  1596. }
  1597. }
  1598. if($id_is)
  1599. {
  1600. $id_is = " and (".rtrim($id_is,'or ').")";
  1601. }
  1602. if($id_smt)
  1603. {
  1604. $id_smt = " and (".rtrim($id_smt,'or ').")";
  1605. }
  1606. }
  1607. $timetk = $this->input->get('timetk',true);
  1608. $timetj = $this->input->get('timetj',true);
  1609. $orderinfo = $this->input->get('orderinfo',true);
  1610. $number = $this->input->get('number',true);
  1611. $print = $this->input->get('print',true);
  1612. $shop = $this->input->get('shop',true);
  1613. $type = $this->input->get('type',true);
  1614. $ckfl = $this->input->get('ckfl',true);
  1615. $so = $this->input->get('so',true);
  1616. $sfxh = $this->input->get('sfxh',true);
  1617. $library = $this->input->get('library',true);
  1618. $libraryconfirm = $this->input->get('libraryconfirm',true);
  1619. $timetk = strtotime($timetk);
  1620. $timetj = strtotime($timetj);
  1621. $where = (isset($_SESSION['api']))?"(".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
  1622. if($orderinfo)
  1623. {
  1624. $where .= " and orderinfo = '$orderinfo'";
  1625. }
  1626. if($number)
  1627. {
  1628. $where .= " and number = '$number'";
  1629. }
  1630. if($print)
  1631. {
  1632. $where .= " and print = '$print'";
  1633. if($print == 3)
  1634. {
  1635. $where .= " and printtime > '$timetk' and printtime < '$timetj'";
  1636. }
  1637. }
  1638. if($shop)
  1639. {
  1640. $where .= " and shop = '$shop'";
  1641. }
  1642. if($type)
  1643. {
  1644. $where .= " and type = '$type'";
  1645. }
  1646. if($so)
  1647. {
  1648. $where .= " and shipremarks like '%$so%'";
  1649. }
  1650. if($ckfl)
  1651. {
  1652. $where .= " and ckfl = '$ckfl'";
  1653. }
  1654. if($library)
  1655. {
  1656. $where .= " and library = '$library'";
  1657. }
  1658. if($libraryconfirm)
  1659. {
  1660. $where .= " and libraryconfirm = '$libraryconfirm'";
  1661. }
  1662. $t = array();
  1663. $transfer = $this->transfer->find_all();
  1664. foreach ($transfer as $v)
  1665. {
  1666. $t[$v['id']] = $v['title'];
  1667. $ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
  1668. }
  1669. $order_str = ($print != 3)?"id desc":"printtime desc";
  1670. $info_list = $this->fullorder->find_all($where.$id_is,'number,shipremarks,ts,printtime,library,libraryconfirm,librarynot,systemwigsout',$order_str);
  1671. $info_listsmt = $this->fullordersmt->find_all($where.$id_smt." and mergeid != '1'",'number,shipremarks,ts,printtime,library,libraryconfirm,librarynot,systemwigsout',$order_str);
  1672. $info_listtt = $this->fullordertt->find_all($where.$id_smt." and mergeid != '1'",'number,shipremarks,ts,printtime,library,libraryconfirm,librarynot,systemwigsout',$order_str);
  1673. $info_listamz = $this->fullorderamz->find_all($where.$id_smt." and mergeid != '1'",'number,shipremarks,ts,printtime,library,libraryconfirm,librarynot,systemwigsout',$order_str);
  1674. $rows = array_merge($info_list,$info_listsmt,$info_listtt,$info_listamz);
  1675. foreach ($rows as $key=>$value)
  1676. {
  1677. if($value['printtime'] > 0)
  1678. {
  1679. $rows[$key]['printtime'] = date('Y-m-d H:s',$value['printtime']);
  1680. }
  1681. else
  1682. {
  1683. $rows[$key]['printtime'] = '未打印';
  1684. }
  1685. if($value['library'] == 1)
  1686. {
  1687. $rows[$key]['library'] = "未出库";
  1688. }
  1689. else if($value['library'] == 2)
  1690. {
  1691. $rows[$key]['library'] = "已出库";
  1692. }
  1693. else if($value['library'] == 3)
  1694. {
  1695. $rows[$key]['printtime'] = '已退库';
  1696. }
  1697. if($value['libraryconfirm'] == 1)
  1698. {
  1699. $rows[$key]['libraryconfirm'] = '不允许出库';
  1700. }
  1701. else
  1702. {
  1703. $rows[$key]['libraryconfirm'] = '允许出库';
  1704. }
  1705. $rows[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  1706. $out = '';
  1707. $tf = $this->systemtransfer->find_all("number = '".$value['number']."'");
  1708. foreach ($tf as $k=>$v)
  1709. {
  1710. if(count($tf) > 1)
  1711. {
  1712. $out .= $k.'<br>';
  1713. }
  1714. $data = $this->systemtransfer_cr->find_all("fid = '".$v['id']."'");
  1715. $out = "订单打印 :".date('Y-m-d H:i',$value['printtime']).'<br>';
  1716. foreach ($data as $k=>$v)
  1717. {
  1718. $type = ($v['type']==1)?'入库':'出库';
  1719. $out .= $t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']).'<br>';
  1720. }
  1721. }
  1722. $rows[$key]['systemwigsout'] = trim($out,'<br>');
  1723. }
  1724. $title = date('Y-m-d',$timetk).'至'.date('Y-m-d',$timetj).'进销存详情';
  1725. $titlename = "<table border=1>
  1726. <tr><th colspan='9' align='center'><h3>".$title."<h3></th></tr>
  1727. <tr align='center'>
  1728. <td>编号</td>
  1729. <td>仓库品名</td>
  1730. <td>条数</td>
  1731. <td>打印时间</td>
  1732. <td>出库状态</td>
  1733. <td>出库确认</td>
  1734. <td>禁止出库原因</td>
  1735. <td>追踪</td>
  1736. </tr>
  1737. </table>";
  1738. $filename = $title.".xls";
  1739. $tail = "";
  1740. $this->excel->get_fz2($rows,$titlename,$filename,$tail);
  1741. }
  1742. }
  1743. }