Warehouse.php 79 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276
  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 _kcpdbak()
  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 _kcpd(){
  1171. header("Access-Control-Allow-Origin: *");
  1172. $post = $this->input->post(NULL, TRUE);
  1173. if(isset($post['warehouse'])){
  1174. $warehouse = $this->input->post('warehouse',true);
  1175. $warehouse = $this->warehouse->read($warehouse);
  1176. $whlabel = $this->input->post('whlabel',true);
  1177. $shop = $this->input->post('shop',true);
  1178. $data = $this->input->post('data',true);
  1179. $data = str_replace('--','-',$data);
  1180. $number = $this->input->post('number',true);
  1181. $y = $this->logic_order->getInfo("number = '".$number."'");
  1182. if(!preg_match('/[0-9]/',$whlabel))
  1183. {
  1184. echo json_encode(array('msg'=>"无",'success'=>true));exit;
  1185. }
  1186. $typeclass = array();
  1187. $size_arr = [];
  1188. $tdata = $this->typeclass->find_all();
  1189. foreach ($tdata as $v)
  1190. {
  1191. $typeclass[$v['id']] = $v['classid'];
  1192. if($v['classid'] == '14'){
  1193. if(!empty($v['spare'])&&(strpos($v['spare'],'Length') === false)){
  1194. $size_arr[$v['spare']*1] = $v['id'];
  1195. }
  1196. }
  1197. }
  1198. ksort($size_arr);
  1199. $size_title_arr = array_keys($size_arr);
  1200. $size_id_arr = array_values($size_arr);
  1201. $kxw = '可用现货:';
  1202. $tdfh = '';$cs = array();
  1203. $warehousedata = $this->warehouse->find_all("zd = '1' and id != '8'");
  1204. $pp = explode('|',trim($whlabel,'|'));
  1205. $ccpp = explode('|',trim($data,'|'));
  1206. $goods_list = [];
  1207. foreach($pp as $key=>$va){
  1208. $num = explode('-',$va);
  1209. if($num[1] < 1)
  1210. {
  1211. continue;
  1212. }
  1213. //看日志发现这有个错误 居然没有国家 很有可能是 没有此订单 又怕影响其他 干脆直接跳过本次循环吧
  1214. if(empty($y['country'])){
  1215. continue;
  1216. }
  1217. $features_str = $ccpp[$key];
  1218. //礼物类不做处理
  1219. if(strpos($features_str,'-131-') !== false){
  1220. continue;
  1221. }
  1222. $goods_list[$num[0]] = [];
  1223. $cp = str_replace(array('-163-','-164-','-165-','-166-'),'-',$ccpp[$key]);
  1224. $cc = explode(',',$cp);
  1225. $features = $this->logic_u9tools->getGoodFeatureAlone($cp);
  1226. foreach($warehousedata as $v){
  1227. if($y['country'] != '192' && $v['id'] == 5){
  1228. continue;
  1229. }
  1230. //var_dump("--------------------------");
  1231. $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.",%')");
  1232. //var_dump($wh.":的值");
  1233. if($wh >= $num[1]){
  1234. $goods_list[$num[0]][] = $v['title']."有货";
  1235. continue;
  1236. }
  1237. //美仓提档检测是否有货
  1238. if($v['id'] == 5){
  1239. if(strpos($cp,',')!== false){
  1240. $szie_key = array_search($cc[0],$size_id_arr);
  1241. if($szie_key !== false){
  1242. $tyd_size_id = $size_id_arr[$szie_key+1];
  1243. }
  1244. $now_size_title = $size_title_arr[$szie_key];
  1245. $tyd_size_title = $size_title_arr[$szie_key+1];
  1246. // var_dump($tyd_size_title);
  1247. // var_dump($now_size_title);
  1248. if(($now_size_title + 2) == $tyd_size_title){
  1249. $tyd_cp = str_replace($cc[0].',',$tyd_size_id.',',$cp);
  1250. // var_dump($tyd_cp);
  1251. // var_dump($cp);
  1252. $tyd_features = $this->logic_u9tools->getGoodFeatureAlone($tyd_cp);
  1253. // var_dump($tyd_features);
  1254. // var_dump("===========================");
  1255. $tdwh = $this->whlabel->find_count("state = '0' and features = '$tyd_features' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");
  1256. if($tdwh >= $num[1]){
  1257. $goods_list[$num[0]][] = $v['title']."(当前尺寸无货,提一档有货)";
  1258. }
  1259. }
  1260. }
  1261. }
  1262. //103 Body Wave 1647 LooseBody
  1263. if(stripos($cp,'-103-') !== false || stripos($cp,'-1647-') !== false){
  1264. $tmp_str = "";
  1265. if(stripos($cp,'-103-') !== false){
  1266. $tmp_features = str_replace('-103-','-1647-',$features);
  1267. $tmp_str = "Loose Body";
  1268. }else{
  1269. $tmp_features = str_replace('-1647-','-103-',$features);
  1270. $tmp_str= "Body";
  1271. }
  1272. $qdth_wh = $this->whlabel->find_count("state = '0' and features = '$tmp_features' and warehouse = '".$v['id']."' and zd = '' and (shop IS NULL or shop = '' or shop like '%,".$shop.",%')");//通用
  1273. if($qdth_wh >= $num[1]){
  1274. $goods_list[$num[0]][] = $v['title']."(当前曲度无货,".$tmp_str."有货)";
  1275. }
  1276. }
  1277. // 4*7没货的,5*7如果有货,给提醒
  1278. if(stripos($cp,'-1253-') !== false)
  1279. {
  1280. $gpp = str_replace('-1253-','-2062-',$features);
  1281. $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.",%')");//通用
  1282. if($ccxh >= $num[1])
  1283. {
  1284. $goods_list[$num[0]][] = $v['title']."- 5*7有货";
  1285. }
  1286. }
  1287. // 1255 HD 4*7 Closure Wig HD 5*7 Closure Wig 如果有货,给提醒
  1288. if(stripos($cp,'-1255-') !== false)
  1289. {
  1290. $gpp = str_replace('-1255-','-2147-',$features);
  1291. $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.",%')");//通用
  1292. if($ccxh >= $num[1])
  1293. {
  1294. $goods_list[$num[0]][] = $v['title']."- 5*7有货";
  1295. }
  1296. }
  1297. // 1323 4*7 Bob Wig 5*7 Bob Wig 如果有货,给提醒
  1298. if(stripos($cp,'-1323-') !== false)
  1299. {
  1300. $gpp = str_replace('-1323-','-2167-',$features);
  1301. $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.",%')");//通用
  1302. if($ccxh >= $num[1])
  1303. {
  1304. $goods_list[$num[0]][] = $v['title']."- 5*7有货";
  1305. }
  1306. }
  1307. // 1257 HD 4*7 Bob Wig HD 5*7 Bob Wig 如果有货,给提醒
  1308. if(stripos($cp,'-1257-') !== false)
  1309. {
  1310. $gpp = str_replace('-1257-','-2434-',$features);
  1311. $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.",%')");//通用
  1312. if($ccxh >= $num[1])
  1313. {
  1314. $goods_list[$num[0]][] = $v['title']."- 5*7有货";
  1315. }
  1316. }
  1317. // 5*5没货的,5*7、5*9如果有货,给提醒
  1318. if(stripos($cp,'-297-') !== false) //13*4 HD13*4
  1319. {
  1320. $gpp = str_replace('-297-','-2062-',$features);
  1321. $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.",%')");//通用
  1322. if($ccxh >= $num[1])
  1323. {
  1324. $goods_list[$num[0]][] = $v['title']."- 5*7有货";
  1325. }
  1326. $gpp2 = str_replace('-297-','-1254-',$features);
  1327. $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.",%')");//通用
  1328. if($ccxh >= $num[1])
  1329. {
  1330. $goods_list[$num[0]][] = $v['title']."- 5*9有货";
  1331. }
  1332. }
  1333. // 180%货的,200、250如果有货,给提醒
  1334. if(stripos($cp,'-72-') !== false) //13*4 HD13*4
  1335. {
  1336. if(isset($cc[1])){
  1337. $gpp = str_replace('-72-','-73-',$features);
  1338. $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.",%')");//通用
  1339. if($ccxh >= $num[1])
  1340. {
  1341. $goods_list[$num[0]][] = $v['title']."- 200%密度有货";
  1342. }
  1343. $gpp2 = str_replace('-72-','-74-',$features);
  1344. $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.",%')");//通用
  1345. if($ccxh >= $num[1])
  1346. {
  1347. $goods_list[$num[0]][] = $v['title']."- 250%密度有货";
  1348. }
  1349. }
  1350. }
  1351. if(stripos($cp,'-73-') !== false) //200% 250%
  1352. {
  1353. $gpp2 = str_replace('-73-','-74-',$features);
  1354. $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.",%')");//通用
  1355. if($ccxh >= $num[1])
  1356. {
  1357. $goods_list[$num[0]][] = $v['title']."- 250%密度有货";
  1358. }
  1359. }
  1360. //HD相互提醒
  1361. if(stripos($cp,'-146-') !== false || stripos($cp,'-331-') !== false) //13*4 HD13*4
  1362. {
  1363. if(stripos($cp,'-146-') !== false)
  1364. {
  1365. $gpp = str_replace('-146-','-331-',$features);
  1366. $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.",%')");//通用
  1367. if($ccxh >= $num[1])
  1368. {
  1369. $goods_list[$num[0]][] = $v['title']."- HD13*4有货";
  1370. }
  1371. }
  1372. else if(stripos($cp,'-331-') !== false)
  1373. {
  1374. $gpp = str_replace('-331-','-146-',$features);
  1375. $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.",%')");//通用
  1376. if($ccxh >= $num[1])
  1377. {
  1378. $goods_list[$num[0]][] = $v['title']."- 13*4有货";
  1379. }
  1380. }
  1381. }
  1382. if(stripos($cp,'-322-') !== false || stripos($cp,'-341-') !== false)//13*6 HD13*6
  1383. {
  1384. if(stripos($cp,'-322-') !== false)
  1385. {
  1386. $gpp = str_replace('-322-','-341-',$features);
  1387. $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.",%')");//通用
  1388. if($ccxh >= $num[1])
  1389. {
  1390. $goods_list[$num[0]][] = $v['title']."- HD13*6有货";
  1391. }
  1392. }
  1393. else if(stripos($cp,'-341-') !== false)
  1394. {
  1395. $gpp = str_replace('-341-','-322-',$features);
  1396. $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.",%')");//通用
  1397. if($ccxh >= $num[1])
  1398. {
  1399. $goods_list[$num[0]][] = $v['title']."- 13*6有货";
  1400. }
  1401. }
  1402. }
  1403. if(stripos($cp,'-147-') !== false || stripos($cp,'-781-') !== false)//4*4 HD4*4
  1404. {
  1405. if(stripos($cp,'-147-') !== false)
  1406. {
  1407. $gpp = str_replace('-147-','-781-',$features);
  1408. $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.",%')");//通用
  1409. if($ccxh >= $num[1])
  1410. {
  1411. $goods_list[$num[0]][] = $v['title']."- HD4*4有货";
  1412. }
  1413. }
  1414. else if(stripos($cp,'-781-') !== false)
  1415. {
  1416. $gpp = str_replace('-781-','-147-',$features);
  1417. $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.",%')");//通用
  1418. if($ccxh >= $num[1])
  1419. {
  1420. $goods_list[$num[0]][] = $v['title']."- 4*4有货";
  1421. }
  1422. }
  1423. }
  1424. if(stripos($cp,'-297-') !== false || stripos($cp,'-540-') !== false)//5*5 HD5*5
  1425. {
  1426. if(stripos($cp,'-297-') !== false)
  1427. {
  1428. $gpp = str_replace('-297-','-540-',$features);
  1429. $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.",%')");//通用
  1430. if($ccxh >= $num[1])
  1431. {
  1432. $goods_list[$num[0]][] = $v['title']."- HD5*5有货";
  1433. }
  1434. }
  1435. else if(stripos($cp,'-540-') !== false)
  1436. {
  1437. $gpp = str_replace('-540-','-297-',$features);
  1438. $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.",%')");//通用
  1439. if($ccxh >= $num[1])
  1440. {
  1441. $goods_list[$num[0]][] = $v['title']."- 5*5有货";
  1442. }
  1443. }
  1444. }
  1445. if(stripos($cp,'-298-') !== false || stripos($cp,'-370-') !== false)//6*6 HD6*6
  1446. {
  1447. if(stripos($cp,'-298-') !== false)
  1448. {
  1449. $gpp = str_replace('-298-','-370-',$features);
  1450. $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.",%')");//通用
  1451. if($ccxh >= $num[1])
  1452. {
  1453. $goods_list[$num[0]][] = $v['title']."- HD6*6有货";
  1454. }
  1455. }
  1456. else if(stripos($cp,'-370-') !== false)
  1457. {
  1458. $gpp = str_replace('-370-','-298-',$features);
  1459. $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.",%')");//通用
  1460. if($ccxh >= $num[1])
  1461. {
  1462. $goods_list[$num[0]][] = $v['title']."- 6*6有货";
  1463. }
  1464. }
  1465. }
  1466. //抽绳款 和非抽绳款的相互提醒 针对头套
  1467. if(stripos($cp,'-128-') !== false){
  1468. //如果是抽绳款 可以找下非抽绳的库存
  1469. if(stripos($cp,'-2661-') !== false){
  1470. $gpp = str_replace('-2661-','-',$features);
  1471. $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.",%')");//通用
  1472. if($ccxh >= $num[1])
  1473. {
  1474. $goods_list[$num[0]][] = $v['title']."- 非抽绳款有库存";
  1475. }
  1476. }else{
  1477. $gpp = $features."2661-";
  1478. $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.",%')");//通用
  1479. if($ccxh >= $num[1])
  1480. {
  1481. $goods_list[$num[0]][] = $v['title']."- 抽绳款有库存";
  1482. }
  1483. }
  1484. }
  1485. // 常规品 带MShaped字眼 带Upgraded MShaped(Lagos Hairline)字眼(M发际线升级版)
  1486. // 2468 2608 这个是头套的 判断的
  1487. if(stripos($cp,'-128-') !== false){
  1488. $sku = trim($cp,'-');
  1489. $sku = str_replace(',','-',$sku);
  1490. $sku = str_replace('--','-',$sku);
  1491. $tmp_arr = explode('-',$sku);
  1492. $tmp_arr = $this->logic_zhlp->transferSku($tmp_arr);
  1493. //判断是否 有50
  1494. if(isset($tmp_arr[50])){
  1495. $arr_no = $arr_2468 = $arr_2608 =$tmp_arr;
  1496. unset($arr_no[50]);
  1497. $arr_2468[50] = 2468;
  1498. $arr_2608[50] = 2608;
  1499. }else{
  1500. $arr_no = $arr_2468 = $arr_2608 =$tmp_arr;
  1501. $arr_2468[50] = 2468;
  1502. $arr_2608[50] = 2608;
  1503. }
  1504. $res = $this->logic_zhlp->sortByClass($arr_no);
  1505. $fianal_arr_no = $res['data'];
  1506. $res = $this->logic_zhlp->sortByClass($arr_2468);
  1507. $fianal_arr_2468 = $res['data'];
  1508. $res = $this->logic_zhlp->sortByClass($arr_2608);
  1509. $fianal_arr_2608 = $res['data'];
  1510. $final_size = $fianal_arr_no[14];
  1511. unset($fianal_arr_no[14]);
  1512. unset($fianal_arr_2468[14]);
  1513. unset($fianal_arr_2608[14]);
  1514. $final_str_no = $final_size.",-".implode("-",$fianal_arr_no)."-";
  1515. $final_str_2468 = $final_size.",-".implode("-",$fianal_arr_2468)."-";
  1516. $final_str_2608 = $final_size.",-".implode("-",$fianal_arr_2608)."-";
  1517. $do_str_no = $this->logic_u9tools->getGoodFeatureAlone($final_str_no);
  1518. $do_str_2468 = $this->logic_u9tools->getGoodFeatureAlone($final_str_2468);
  1519. $do_str_2608 = $this->logic_u9tools->getGoodFeatureAlone($final_str_2608);
  1520. //非M发际线/2468 M发际线/2608 M发际线升级版有货
  1521. if(stripos($cp,'-2468-') !== false){
  1522. $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.",%')");
  1523. $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.",%')");
  1524. if($num_no > 0){
  1525. $goods_list[$num[0]][] = $v['title']."- 非M发际线有货";
  1526. }
  1527. if($num_2608 > 0){
  1528. $goods_list[$num[0]][] = $v['title']."- M发际线升级版有货";
  1529. }
  1530. }elseif(stripos($cp,'-2608-') !== false){
  1531. $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.",%')");
  1532. $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.",%')");
  1533. if($num_no > 0){
  1534. $goods_list[$num[0]][] = $v['title']."- 非M发际线有货";
  1535. }
  1536. if($num_2468 > 0){
  1537. $goods_list[$num[0]][] = $v['title']."- M发际线有货";
  1538. }
  1539. }else{
  1540. $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.",%')");
  1541. $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.",%')");
  1542. if($num_2608 > 0){
  1543. $goods_list[$num[0]][] = $v['title']."- M发际线升级版有货";
  1544. }
  1545. if($num_2468 > 0){
  1546. $goods_list[$num[0]][] = $v['title']."- M发际线有货";
  1547. }
  1548. }
  1549. }
  1550. if(stripos($cp,'-935-') !== false || stripos($cp,'-854-') !== false)//#P4/27/613 #P4/613
  1551. {
  1552. if(stripos($cp,'-935-') !== false)
  1553. {
  1554. $gpp = str_replace('-935-','-854-',$features);
  1555. $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.",%')");//通用
  1556. if($ccxh >= $num[1])
  1557. {
  1558. $goods_list[$num[0]][] = $v['title']."- #P4/613";
  1559. }
  1560. }
  1561. else if(stripos($cp,'-854-') !== false)
  1562. {
  1563. $gpp = str_replace('-854-','-935-',$features);
  1564. $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.",%')");//通用
  1565. if($ccxh >= $num[1])
  1566. {
  1567. $goods_list[$num[0]][] = $v['title']."- #P4/27/613";
  1568. }
  1569. }
  1570. }
  1571. $transportlist = $this->whlabeltransport->find_all("features = '".$features."' and cz = 0 and warehouse = '".$v['id']."'");
  1572. if(count($transportlist) > 0)
  1573. {
  1574. $transportItem = $transportlist[0];
  1575. $goods_list[$num[0]][] = $transportItem['sku'] ." 在途库存: <b>" . $transportItem['num'] . " </b> 预达时间: ".date("Y-m-d",$transportItem['stime']). " <br/> 备注 : " . $transportItem['text'];
  1576. }
  1577. }
  1578. $str = implode(',',$goods_list[$num[0]]);
  1579. $kxw .= $str.';';
  1580. }
  1581. echo json_encode(array('msg'=>$kxw,'success'=>true));exit;
  1582. }
  1583. }
  1584. public function str_replace_limit($search, $replace, $subject)
  1585. {
  1586. $pos = strpos($subject, $search);
  1587. if ($pos !== false)
  1588. {
  1589. return substr_replace($subject, $replace, $pos, strlen($search));
  1590. }
  1591. return $subject;
  1592. }
  1593. public function _orderlist()
  1594. {
  1595. $post = $this->input->post(NULL, TRUE);
  1596. if(isset($_SESSION['api']))
  1597. {
  1598. $user = $this->user->get_api($_SESSION['api']);
  1599. $usp = $user;
  1600. $fgshop = "";$sid = "";$wid="";$wtype="";
  1601. $usersp = explode('|',trim($user['shop'],'|'));
  1602. $userwh = explode('|',trim($user['warehouse'],'|'));
  1603. foreach ($usersp as $value)
  1604. {
  1605. $fgshop .= " shop = ".$value." or";
  1606. $sid .= " id = ".$value." or";
  1607. }
  1608. foreach ($userwh as $value)
  1609. {
  1610. $wid .= " id = ".$value." or";
  1611. $wtype .= " type = ".$value." or";
  1612. }
  1613. }
  1614. if(isset($post['page']))
  1615. {
  1616. $page = $this->input->post('page',true);
  1617. $perpage = $this->input->post('perpage',true);
  1618. $timetk = $this->input->post('timetk',true);
  1619. $timetj = $this->input->post('timetj',true);
  1620. $orderinfo = $this->input->post('orderinfo',true);
  1621. $number = $this->input->post('number',true);
  1622. $print = $this->input->post('print',true);
  1623. $shop = $this->input->post('shop',true);
  1624. $type = $this->input->post('type',true);
  1625. $ckfl = $this->input->post('ckfl',true);
  1626. $so = $this->input->post('so',true);
  1627. $sfxh = $this->input->post('sfxh',true);
  1628. $library = $this->input->post('library',true);
  1629. $libraryconfirm = $this->input->post('libraryconfirm',true);
  1630. $timetk = strtotime($timetk);
  1631. $timetj = strtotime($timetj);
  1632. $where = (isset($_SESSION['api']))?"(".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
  1633. if($orderinfo)
  1634. {
  1635. $where .= " and orderinfo = '$orderinfo'";
  1636. }
  1637. if($number)
  1638. {
  1639. $where .= " and number = '$number'";
  1640. }
  1641. if($print)
  1642. {
  1643. $where .= " and print = '$print'";
  1644. if($print == 3)
  1645. {
  1646. $where .= " and printtime > '$timetk' and printtime < '$timetj'";
  1647. }
  1648. }
  1649. if($shop)
  1650. {
  1651. $where .= " and shop = '$shop'";
  1652. }
  1653. if($type)
  1654. {
  1655. $where .= " and type = '$type'";
  1656. }
  1657. if($so)
  1658. {
  1659. $where .= " and shipremarks like '%$so%'";
  1660. }
  1661. if($ckfl)
  1662. {
  1663. $where .= " and ckfl = '$ckfl'";
  1664. }
  1665. if($library)
  1666. {
  1667. $where .= " and library = '$library'";
  1668. }
  1669. if($type)
  1670. {
  1671. $where .= " and type = '$type'";
  1672. }
  1673. if($libraryconfirm)
  1674. {
  1675. $where .= " and libraryconfirm = '$libraryconfirm'";
  1676. }
  1677. //数据排序
  1678. $order_str = ($print != 3)?"id desc":"printtime desc";
  1679. if(empty($page))
  1680. {
  1681. $start = 0;
  1682. $perpage = 1;
  1683. }
  1684. else
  1685. {
  1686. $start = ($page - 1)*$perpage;
  1687. }
  1688. $t = array();
  1689. $transfer = $this->transfer->find_all();
  1690. foreach ($transfer as $v)
  1691. {
  1692. $t[$v['id']] = $v['title'];
  1693. $ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
  1694. }
  1695. //取得信息列表
  1696. $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,printtime,librarytime,shipremarks',$order_str,$start,$perpage);
  1697. foreach ($info_list as $key=>$value) {
  1698. $info_list[$key]['id'] = "fullorder-".$value['id'];
  1699. }
  1700. $info_listsmt = $this->fullordersmt->find_all($where." and mergeid != '1'",'id,shop,orderinfo,number,printtime,librarytime,shipremarks',$order_str,$start,$perpage);
  1701. foreach ($info_listsmt as $key=>$value) {
  1702. $info_listsmt[$key]['id'] = "fullordersmt-".$value['id'];
  1703. }
  1704. $info_listtt = $this->fullordertt->find_all($where." and mergeid != '1'",'id,shop,orderinfo,number,printtime,librarytime,shipremarks',$order_str,$start,$perpage);
  1705. foreach ($info_listtt as $key=>$value) {
  1706. $info_listtt[$key]['id'] = "fullordertt-".$value['id'];
  1707. }
  1708. $info_listamz = $this->fullorderamz->find_all($where." and mergeid != '1'",'id,shop,orderinfo,number,printtime,librarytime,shipremarks',$order_str,$start,$perpage);
  1709. foreach ($info_listamz as $key=>$value) {
  1710. $info_listamz[$key]['id'] = "fullorderamz-".$value['id'];
  1711. }
  1712. $rows = array_merge($info_list,$info_listsmt,$info_listtt,$info_listamz);
  1713. //格式化数据
  1714. foreach ($rows as $key=>$value)
  1715. {
  1716. $rows[$key]['id'] = $value['id'].'-fullorder';
  1717. $shop = $this->shop->read($value['shop']);
  1718. $rows[$key]['shop'] = $shop['shopname'];
  1719. if($value['printtime'] > 0)
  1720. {
  1721. $rows[$key]['printtime'] = date('Y-m-d H:s',$value['printtime']);
  1722. }
  1723. else
  1724. {
  1725. $rows[$key]['printtime'] = '未打印';
  1726. }
  1727. if(isset($value['librarytime']) && $value['librarytime'] > 0)
  1728. {
  1729. $rows[$key]['librarytime'] = date('Y-m-d H:s',$value['librarytime']);
  1730. }
  1731. else
  1732. {
  1733. $rows[$key]['librarytime'] = '未出库';
  1734. }
  1735. $rows[$key]['orderinfo'] = "<h9 class='window' data-h='/warehouse/ordersee/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p></h9>";
  1736. $rows[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  1737. $out = '';
  1738. $tf = $this->systemtransfer->find_all("number = '".$value['number']."'");
  1739. if(!empty($tf)){
  1740. if($tf[0]['is_jiaji']){
  1741. $rows[$key]['number'] = "<a href='javascript:void(0)' style='color:red'>".$rows[$key]['number']."加急!!!</a>";
  1742. }
  1743. }
  1744. foreach ($tf as $k=>$v)
  1745. {
  1746. if(count($tf) > 1)
  1747. {
  1748. $out .= $k.'<br>';
  1749. }
  1750. $data = $this->systemtransfer_cr->find_all("fid = '".$v['id']."'");
  1751. $out = "订单打印 :".date('Y-m-d H:i',$value['printtime']).'<br>';
  1752. foreach ($data as $k=>$v)
  1753. {
  1754. $type = ($v['type']==1)?'入库':'出库';
  1755. $out .= $t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']).'<br>';
  1756. }
  1757. }
  1758. $rows[$key]['outread'] = trim($out,'<br>');
  1759. }
  1760. $dlz = $this->fullorder->find_count($where);
  1761. $smt = $this->fullordersmt->find_count($where);
  1762. $tt = $this->fullordertt->find_count($where);
  1763. $amz = $this->fullorderamz->find_count($where);
  1764. //$total += $this->fullorder_smt->find_count($where);
  1765. $total = $dlz+$smt+$tt+$amz;
  1766. //$rows = array_slice($rows,$start,$perpage);
  1767. $pagenum = ceil($total/$perpage);
  1768. $over = $total-($start+$perpage);
  1769. $tmp = array();
  1770. if($print == 3)
  1771. {
  1772. foreach ($rows as $key => $val)
  1773. {
  1774. $tmp[$key] = $val['printtime'];
  1775. }
  1776. array_multisort($tmp,SORT_DESC,$rows);
  1777. }
  1778. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($rows),'cs'=>$where);//array_merge($info_list,$info_list_smt,$info_listsmt)
  1779. echo json_encode($rows);exit;
  1780. }
  1781. if(isset($_SESSION['api']))
  1782. {
  1783. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  1784. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  1785. $this->data['wlshop'] = $wlshop;
  1786. $this->data['warehouse'] = $warehouse;
  1787. }
  1788. $this->_Template('warehouse_orderlist',$this->data);
  1789. }
  1790. public function _orderlistck()//华荣厂查看
  1791. {
  1792. $post = $this->input->post(NULL, TRUE);
  1793. if(isset($_SESSION['api']))
  1794. {
  1795. $user = $this->user->get_api($_SESSION['api']);
  1796. $usp = $user;
  1797. $fgshop = "";$sid = "";$wid="";$wtype="";
  1798. $usersp = explode('|',trim($user['shop'],'|'));
  1799. $userwh = explode('|',trim($user['warehouse'],'|'));
  1800. foreach ($usersp as $value)
  1801. {
  1802. $fgshop .= " shop = ".$value." or";
  1803. $sid .= " id = ".$value." or";
  1804. }
  1805. foreach ($userwh as $value)
  1806. {
  1807. $wid .= " id = ".$value." or";
  1808. $wtype .= " type = ".$value." or";
  1809. }
  1810. }
  1811. if(isset($post['page']))
  1812. {
  1813. $page = $this->input->post('page',true);
  1814. $perpage = $this->input->post('perpage',true);
  1815. $number = $this->input->post('number',true);
  1816. $so = $this->input->post('so',true);
  1817. $where = (isset($_SESSION['api']))?"(".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
  1818. if($number)
  1819. {
  1820. $where .= " and number = '$number'";
  1821. }
  1822. if($so)
  1823. {
  1824. $where .= " and shipremarks like '%$so%'";
  1825. }
  1826. if(!$so && !$number)
  1827. {
  1828. $where = "id < 0";
  1829. }
  1830. //数据排序
  1831. $order_str = "id desc";
  1832. if(empty($page))
  1833. {
  1834. $start = 0;
  1835. $perpage = 1;
  1836. }
  1837. else
  1838. {
  1839. $start = ($page - 1)*$perpage;
  1840. }
  1841. $info_list = array();
  1842. $info_listsmt = array();
  1843. $dlz = 0; $smt = 0;
  1844. //取得信息列表
  1845. $info_list = $this->fullorder->find_all($where,'id,number,shipremarks',$order_str,$start,$perpage);
  1846. $info_listsmt = $this->fullordersmt->find_all($where." and mergeid != '1'",'id,number,shipremarks',$order_str,$start,$perpage);
  1847. $info_listtt = $this->fullordertt->find_all($where." and mergeid != '1'",'id,number,shipremarks',$order_str,$start,$perpage);
  1848. $info_listamz = $this->fullorderamz->find_all($where." and mergeid != '1'",'id,number,shipremarks',$order_str,$start,$perpage);
  1849. $rows = array_merge($info_list,$info_listsmt,$info_listtt,$info_listamz);
  1850. //格式化数据
  1851. foreach ($rows as $key=>$value)
  1852. {
  1853. $rows[$key]['id'] = $value['id'].'-fullorder';
  1854. $rows[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  1855. $systemwigsout = $this->systemwigsout->get_number($value['number']);
  1856. $wigsout = '';
  1857. if($systemwigsout)
  1858. {
  1859. $cz = explode('|',trim($systemwigsout['cz'],'|'));
  1860. $cztime = explode('|',trim($systemwigsout['cztime'],'|'));
  1861. $zw = array();
  1862. $t = $this->transfer->find_all("1=1");
  1863. foreach ($t as $v)
  1864. {
  1865. $zw[$v['id']] = $v['title'];
  1866. }
  1867. if($systemwigsout['cz'] != '' && count($cz) > 0)
  1868. {
  1869. for($i=0;$i<count($cz);$i++)
  1870. {
  1871. if(!isset($cztime[$i]))
  1872. {
  1873. $wigsout .= $zw[$cz[$i]];
  1874. }
  1875. else
  1876. {
  1877. $wigsout .= $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).',';
  1878. }
  1879. }
  1880. }
  1881. }
  1882. $rows[$key]['systemwigsout'] = rtrim($wigsout,',');
  1883. }
  1884. $dlz = $this->fullorder->find_count($where);
  1885. $smt = $this->fullordersmt->find_count($where);
  1886. $tt = $this->fullordersmt->find_count($where);
  1887. $amz = $this->fullorderamz->find_count($where);
  1888. //$total += $this->fullorder_smt->find_count($where);
  1889. $total = $dlz+$smt+$tt+$amz;
  1890. //$rows = array_slice($rows,$start,$perpage);
  1891. $pagenum = ceil($total/$perpage);
  1892. $over = $total-($start+$perpage);
  1893. $tmp = array();
  1894. $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($rows),'cs'=>$where);//array_merge($info_list,$info_list_smt,$info_listsmt)
  1895. echo json_encode($rows);exit;
  1896. }
  1897. if(isset($_SESSION['api']))
  1898. {
  1899. $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
  1900. $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
  1901. $this->data['wlshop'] = $wlshop;
  1902. $this->data['warehouse'] = $warehouse;
  1903. }
  1904. $this->_Template('warehouse_orderlistck',$this->data);
  1905. }
  1906. public function _ordersee($arg_array)
  1907. {
  1908. $arr_str = $arg_array[0];
  1909. $arr= explode('-',rtrim($arr_str,'-'));
  1910. $table_name = $arr[0];
  1911. $arg_array = $arr[1];
  1912. $fullorder = $table_name;
  1913. $data = $this->$fullorder->read($arg_array);
  1914. // $fullorder = 'fullorder';
  1915. // $data = $this->fullorder->read($arg_array);
  1916. // if(!$data)
  1917. // {
  1918. // $fullorder = 'fullordersmt';
  1919. // $data = $this->fullordersmt->read($arg_array);
  1920. // }
  1921. // if(!$data)
  1922. // {
  1923. // $fullorder = 'fullordertt';
  1924. // $data = $this->fullordertt->read($arg_array);
  1925. // }
  1926. // if(!$data){
  1927. // $fullorder = 'fullorderamz';
  1928. // $data = $this->fullorderamz->read($arg_array);
  1929. // }
  1930. $fpdata = array();
  1931. $fullorder = $this->$fullorder->read($arg_array);
  1932. if(stripos($fullorder['fpdata'],';') !== false)
  1933. {
  1934. $fpdata = explode(';',rtrim($fullorder['fpdata'],';'));
  1935. foreach ($fpdata as $k=>$v)
  1936. {
  1937. $fpdata[$k] = explode('|',$v);
  1938. }
  1939. }
  1940. $systemwigsout = $this->systemwigsout->get_number($fullorder['number']);
  1941. $wigsout = array();
  1942. if($systemwigsout)
  1943. {
  1944. $cz = explode('|',trim($systemwigsout['cz'],'|'));
  1945. $cztime = explode('|',trim($systemwigsout['cztime'],'|'));
  1946. $zw = array();
  1947. $t = $this->transfer->find_all("1=1");
  1948. foreach ($t as $v)
  1949. {
  1950. $zw[$v['id']] = $v['title'];
  1951. }
  1952. if($systemwigsout['cz'] != '' && count($cz) > 0)
  1953. {
  1954. for($i=0;$i<count($cz);$i++)
  1955. {
  1956. if(!isset($cztime[$i]))
  1957. {
  1958. $wigsout[] = $zw[$cz[$i]];
  1959. }
  1960. else
  1961. {
  1962. $wigsout[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]);
  1963. }
  1964. }
  1965. }
  1966. }
  1967. $this->data['systemwigsout'] = $wigsout;
  1968. $this->data['fpdata'] = $fpdata;
  1969. $this->data['data'] = $data;
  1970. $this->_Template('warehouse_ordersee',$this->data);
  1971. }
  1972. public function _orderlistexcel()
  1973. {
  1974. $post = $this->input->post(NULL, TRUE);
  1975. if(isset($_SESSION['api']))
  1976. {
  1977. $user = $this->user->get_api($_SESSION['api']);
  1978. $usp = $user;
  1979. $fgshop = "";$sid = "";$wid="";$wtype="";
  1980. $usersp = explode('|',trim($user['shop'],'|'));
  1981. $userwh = explode('|',trim($user['warehouse'],'|'));
  1982. foreach ($usersp as $value)
  1983. {
  1984. $fgshop .= " shop = ".$value." or";
  1985. $sid .= " id = ".$value." or";
  1986. }
  1987. foreach ($userwh as $value)
  1988. {
  1989. $wid .= " id = ".$value." or";
  1990. $wtype .= " type = ".$value." or";
  1991. }
  1992. }
  1993. if(isset($_GET['excel']))
  1994. {
  1995. $a = $this->input->get('a',true);
  1996. $id_is = '';$id_smt = '';
  1997. if($a)
  1998. {
  1999. $a = explode(',',rtrim($a,','));
  2000. foreach ($a as $value)
  2001. {
  2002. $v = explode('-',$value);
  2003. if($v[1] == 'fullorder')
  2004. {
  2005. $id_is .= "id = ".$v[0]." or ";
  2006. }
  2007. else
  2008. {
  2009. $id_smt .= "id = ".$v[0]." or ";
  2010. }
  2011. }
  2012. if($id_is)
  2013. {
  2014. $id_is = " and (".rtrim($id_is,'or ').")";
  2015. }
  2016. if($id_smt)
  2017. {
  2018. $id_smt = " and (".rtrim($id_smt,'or ').")";
  2019. }
  2020. }
  2021. $timetk = $this->input->get('timetk',true);
  2022. $timetj = $this->input->get('timetj',true);
  2023. $orderinfo = $this->input->get('orderinfo',true);
  2024. $number = $this->input->get('number',true);
  2025. $print = $this->input->get('print',true);
  2026. $shop = $this->input->get('shop',true);
  2027. $type = $this->input->get('type',true);
  2028. $ckfl = $this->input->get('ckfl',true);
  2029. $so = $this->input->get('so',true);
  2030. $sfxh = $this->input->get('sfxh',true);
  2031. $library = $this->input->get('library',true);
  2032. $libraryconfirm = $this->input->get('libraryconfirm',true);
  2033. $timetk = strtotime($timetk);
  2034. $timetj = strtotime($timetj);
  2035. $where = (isset($_SESSION['api']))?"(".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
  2036. if($orderinfo)
  2037. {
  2038. $where .= " and orderinfo = '$orderinfo'";
  2039. }
  2040. if($number)
  2041. {
  2042. $where .= " and number = '$number'";
  2043. }
  2044. if($print)
  2045. {
  2046. $where .= " and print = '$print'";
  2047. if($print == 3)
  2048. {
  2049. $where .= " and printtime > '$timetk' and printtime < '$timetj'";
  2050. }
  2051. }
  2052. if($shop)
  2053. {
  2054. $where .= " and shop = '$shop'";
  2055. }
  2056. if($type)
  2057. {
  2058. $where .= " and type = '$type'";
  2059. }
  2060. if($so)
  2061. {
  2062. $where .= " and shipremarks like '%$so%'";
  2063. }
  2064. if($ckfl)
  2065. {
  2066. $where .= " and ckfl = '$ckfl'";
  2067. }
  2068. if($library)
  2069. {
  2070. $where .= " and library = '$library'";
  2071. }
  2072. if($libraryconfirm)
  2073. {
  2074. $where .= " and libraryconfirm = '$libraryconfirm'";
  2075. }
  2076. $t = array();
  2077. $transfer = $this->transfer->find_all();
  2078. foreach ($transfer as $v)
  2079. {
  2080. $t[$v['id']] = $v['title'];
  2081. $ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
  2082. }
  2083. $order_str = ($print != 3)?"id desc":"printtime desc";
  2084. $info_list = $this->fullorder->find_all($where.$id_is,'number,shipremarks,ts,printtime,library,libraryconfirm,librarynot,systemwigsout',$order_str);
  2085. $info_listsmt = $this->fullordersmt->find_all($where.$id_smt." and mergeid != '1'",'number,shipremarks,ts,printtime,library,libraryconfirm,librarynot,systemwigsout',$order_str);
  2086. $info_listtt = $this->fullordertt->find_all($where.$id_smt." and mergeid != '1'",'number,shipremarks,ts,printtime,library,libraryconfirm,librarynot,systemwigsout',$order_str);
  2087. $info_listamz = $this->fullorderamz->find_all($where.$id_smt." and mergeid != '1'",'number,shipremarks,ts,printtime,library,libraryconfirm,librarynot,systemwigsout',$order_str);
  2088. $rows = array_merge($info_list,$info_listsmt,$info_listtt,$info_listamz);
  2089. foreach ($rows as $key=>$value)
  2090. {
  2091. if($value['printtime'] > 0)
  2092. {
  2093. $rows[$key]['printtime'] = date('Y-m-d H:s',$value['printtime']);
  2094. }
  2095. else
  2096. {
  2097. $rows[$key]['printtime'] = '未打印';
  2098. }
  2099. if($value['library'] == 1)
  2100. {
  2101. $rows[$key]['library'] = "未出库";
  2102. }
  2103. else if($value['library'] == 2)
  2104. {
  2105. $rows[$key]['library'] = "已出库";
  2106. }
  2107. else if($value['library'] == 3)
  2108. {
  2109. $rows[$key]['printtime'] = '已退库';
  2110. }
  2111. if($value['libraryconfirm'] == 1)
  2112. {
  2113. $rows[$key]['libraryconfirm'] = '不允许出库';
  2114. }
  2115. else
  2116. {
  2117. $rows[$key]['libraryconfirm'] = '允许出库';
  2118. }
  2119. $rows[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
  2120. $out = '';
  2121. $tf = $this->systemtransfer->find_all("number = '".$value['number']."'");
  2122. foreach ($tf as $k=>$v)
  2123. {
  2124. if(count($tf) > 1)
  2125. {
  2126. $out .= $k.'<br>';
  2127. }
  2128. $data = $this->systemtransfer_cr->find_all("fid = '".$v['id']."'");
  2129. $out = "订单打印 :".date('Y-m-d H:i',$value['printtime']).'<br>';
  2130. foreach ($data as $k=>$v)
  2131. {
  2132. $type = ($v['type']==1)?'入库':'出库';
  2133. $out .= $t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']).'<br>';
  2134. }
  2135. }
  2136. $rows[$key]['systemwigsout'] = trim($out,'<br>');
  2137. }
  2138. $title = date('Y-m-d',$timetk).'至'.date('Y-m-d',$timetj).'进销存详情';
  2139. $titlename = "<table border=1>
  2140. <tr><th colspan='9' align='center'><h3>".$title."<h3></th></tr>
  2141. <tr align='center'>
  2142. <td>编号</td>
  2143. <td>仓库品名</td>
  2144. <td>条数</td>
  2145. <td>打印时间</td>
  2146. <td>出库状态</td>
  2147. <td>出库确认</td>
  2148. <td>禁止出库原因</td>
  2149. <td>追踪</td>
  2150. </tr>
  2151. </table>";
  2152. $filename = $title.".xls";
  2153. $tail = "";
  2154. $this->excel->get_fz2($rows,$titlename,$filename,$tail);
  2155. }
  2156. }
  2157. }