Warehouse.php 79 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275
  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 _kcpdbak(){
  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. if(stripos($cp,'-73-') !== false) //200% 250%
  1351. {
  1352. $gpp2 = str_replace('-73-','-74-',$features);
  1353. $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.",%')");//通用
  1354. if($ccxh >= $num[1])
  1355. {
  1356. $goods_list[$num[0]][] = $v['title']."- 250%密度有货";
  1357. }
  1358. }
  1359. //HD相互提醒
  1360. if(stripos($cp,'-146-') !== false || stripos($cp,'-331-') !== false) //13*4 HD13*4
  1361. {
  1362. if(stripos($cp,'-146-') !== false)
  1363. {
  1364. $gpp = str_replace('-146-','-331-',$features);
  1365. $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.",%')");//通用
  1366. if($ccxh >= $num[1])
  1367. {
  1368. $goods_list[$num[0]][] = $v['title']."- HD13*4有货";
  1369. }
  1370. }
  1371. else if(stripos($cp,'-331-') !== false)
  1372. {
  1373. $gpp = str_replace('-331-','-146-',$features);
  1374. $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.",%')");//通用
  1375. if($ccxh >= $num[1])
  1376. {
  1377. $goods_list[$num[0]][] = $v['title']."- 13*4有货";
  1378. }
  1379. }
  1380. }
  1381. if(stripos($cp,'-322-') !== false || stripos($cp,'-341-') !== false)//13*6 HD13*6
  1382. {
  1383. if(stripos($cp,'-322-') !== false)
  1384. {
  1385. $gpp = str_replace('-322-','-341-',$features);
  1386. $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.",%')");//通用
  1387. if($ccxh >= $num[1])
  1388. {
  1389. $goods_list[$num[0]][] = $v['title']."- HD13*6有货";
  1390. }
  1391. }
  1392. else if(stripos($cp,'-341-') !== false)
  1393. {
  1394. $gpp = str_replace('-341-','-322-',$features);
  1395. $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.",%')");//通用
  1396. if($ccxh >= $num[1])
  1397. {
  1398. $goods_list[$num[0]][] = $v['title']."- 13*6有货";
  1399. }
  1400. }
  1401. }
  1402. if(stripos($cp,'-147-') !== false || stripos($cp,'-781-') !== false)//4*4 HD4*4
  1403. {
  1404. if(stripos($cp,'-147-') !== false)
  1405. {
  1406. $gpp = str_replace('-147-','-781-',$features);
  1407. $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.",%')");//通用
  1408. if($ccxh >= $num[1])
  1409. {
  1410. $goods_list[$num[0]][] = $v['title']."- HD4*4有货";
  1411. }
  1412. }
  1413. else if(stripos($cp,'-781-') !== false)
  1414. {
  1415. $gpp = str_replace('-781-','-147-',$features);
  1416. $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.",%')");//通用
  1417. if($ccxh >= $num[1])
  1418. {
  1419. $goods_list[$num[0]][] = $v['title']."- 4*4有货";
  1420. }
  1421. }
  1422. }
  1423. if(stripos($cp,'-297-') !== false || stripos($cp,'-540-') !== false)//5*5 HD5*5
  1424. {
  1425. if(stripos($cp,'-297-') !== false)
  1426. {
  1427. $gpp = str_replace('-297-','-540-',$features);
  1428. $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.",%')");//通用
  1429. if($ccxh >= $num[1])
  1430. {
  1431. $goods_list[$num[0]][] = $v['title']."- HD5*5有货";
  1432. }
  1433. }
  1434. else if(stripos($cp,'-540-') !== false)
  1435. {
  1436. $gpp = str_replace('-540-','-297-',$features);
  1437. $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.",%')");//通用
  1438. if($ccxh >= $num[1])
  1439. {
  1440. $goods_list[$num[0]][] = $v['title']."- 5*5有货";
  1441. }
  1442. }
  1443. }
  1444. if(stripos($cp,'-298-') !== false || stripos($cp,'-370-') !== false)//6*6 HD6*6
  1445. {
  1446. if(stripos($cp,'-298-') !== false)
  1447. {
  1448. $gpp = str_replace('-298-','-370-',$features);
  1449. $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.",%')");//通用
  1450. if($ccxh >= $num[1])
  1451. {
  1452. $goods_list[$num[0]][] = $v['title']."- HD6*6有货";
  1453. }
  1454. }
  1455. else if(stripos($cp,'-370-') !== false)
  1456. {
  1457. $gpp = str_replace('-370-','-298-',$features);
  1458. $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.",%')");//通用
  1459. if($ccxh >= $num[1])
  1460. {
  1461. $goods_list[$num[0]][] = $v['title']."- 6*6有货";
  1462. }
  1463. }
  1464. }
  1465. //抽绳款 和非抽绳款的相互提醒 针对头套
  1466. if(stripos($cp,'-128-') !== false){
  1467. //如果是抽绳款 可以找下非抽绳的库存
  1468. if(stripos($cp,'-2661-') !== false){
  1469. $gpp = str_replace('-2661-','-',$features);
  1470. $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.",%')");//通用
  1471. if($ccxh >= $num[1])
  1472. {
  1473. $goods_list[$num[0]][] = $v['title']."- 非抽绳款有库存";
  1474. }
  1475. }else{
  1476. $gpp = $features."2661-";
  1477. $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.",%')");//通用
  1478. if($ccxh >= $num[1])
  1479. {
  1480. $goods_list[$num[0]][] = $v['title']."- 抽绳款有库存";
  1481. }
  1482. }
  1483. }
  1484. // 常规品 带MShaped字眼 带Upgraded MShaped(Lagos Hairline)字眼(M发际线升级版)
  1485. // 2468 2608 这个是头套的 判断的
  1486. if(stripos($cp,'-128-') !== false){
  1487. $sku = trim($cp,'-');
  1488. $sku = str_replace(',','-',$sku);
  1489. $sku = str_replace('--','-',$sku);
  1490. $tmp_arr = explode('-',$sku);
  1491. $tmp_arr = $this->logic_zhlp->transferSku($tmp_arr);
  1492. //判断是否 有50
  1493. if(isset($tmp_arr[50])){
  1494. $arr_no = $arr_2468 = $arr_2608 =$tmp_arr;
  1495. unset($arr_no[50]);
  1496. $arr_2468[50] = 2468;
  1497. $arr_2608[50] = 2608;
  1498. }else{
  1499. $arr_no = $arr_2468 = $arr_2608 =$tmp_arr;
  1500. $arr_2468[50] = 2468;
  1501. $arr_2608[50] = 2608;
  1502. }
  1503. $res = $this->logic_zhlp->sortByClass($arr_no);
  1504. $fianal_arr_no = $res['data'];
  1505. $res = $this->logic_zhlp->sortByClass($arr_2468);
  1506. $fianal_arr_2468 = $res['data'];
  1507. $res = $this->logic_zhlp->sortByClass($arr_2608);
  1508. $fianal_arr_2608 = $res['data'];
  1509. $final_size = $fianal_arr_no[14];
  1510. unset($fianal_arr_no[14]);
  1511. unset($fianal_arr_2468[14]);
  1512. unset($fianal_arr_2608[14]);
  1513. $final_str_no = $final_size.",-".implode("-",$fianal_arr_no)."-";
  1514. $final_str_2468 = $final_size.",-".implode("-",$fianal_arr_2468)."-";
  1515. $final_str_2608 = $final_size.",-".implode("-",$fianal_arr_2608)."-";
  1516. $do_str_no = $this->logic_u9tools->getGoodFeatureAlone($final_str_no);
  1517. $do_str_2468 = $this->logic_u9tools->getGoodFeatureAlone($final_str_2468);
  1518. $do_str_2608 = $this->logic_u9tools->getGoodFeatureAlone($final_str_2608);
  1519. //非M发际线/2468 M发际线/2608 M发际线升级版有货
  1520. if(stripos($cp,'-2468-') !== false){
  1521. $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.",%')");
  1522. $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.",%')");
  1523. if($num_no > 0){
  1524. $goods_list[$num[0]][] = $v['title']."- 非M发际线有货";
  1525. }
  1526. if($num_2608 > 0){
  1527. $goods_list[$num[0]][] = $v['title']."- M发际线升级版有货";
  1528. }
  1529. }elseif(stripos($cp,'-2608-') !== false){
  1530. $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.",%')");
  1531. $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.",%')");
  1532. if($num_no > 0){
  1533. $goods_list[$num[0]][] = $v['title']."- 非M发际线有货";
  1534. }
  1535. if($num_2468 > 0){
  1536. $goods_list[$num[0]][] = $v['title']."- M发际线有货";
  1537. }
  1538. }else{
  1539. $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.",%')");
  1540. $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.",%')");
  1541. if($num_2608 > 0){
  1542. $goods_list[$num[0]][] = $v['title']."- M发际线升级版有货";
  1543. }
  1544. if($num_2468 > 0){
  1545. $goods_list[$num[0]][] = $v['title']."- M发际线有货";
  1546. }
  1547. }
  1548. }
  1549. if(stripos($cp,'-935-') !== false || stripos($cp,'-854-') !== false)//#P4/27/613 #P4/613
  1550. {
  1551. if(stripos($cp,'-935-') !== false)
  1552. {
  1553. $gpp = str_replace('-935-','-854-',$features);
  1554. $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.",%')");//通用
  1555. if($ccxh >= $num[1])
  1556. {
  1557. $goods_list[$num[0]][] = $v['title']."- #P4/613";
  1558. }
  1559. }
  1560. else if(stripos($cp,'-854-') !== false)
  1561. {
  1562. $gpp = str_replace('-854-','-935-',$features);
  1563. $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.",%')");//通用
  1564. if($ccxh >= $num[1])
  1565. {
  1566. $goods_list[$num[0]][] = $v['title']."- #P4/27/613";
  1567. }
  1568. }
  1569. }
  1570. $transportlist = $this->whlabeltransport->find_all("features = '".$features."' and cz = 0 and warehouse = '".$v['id']."'");
  1571. if(count($transportlist) > 0)
  1572. {
  1573. $transportItem = $transportlist[0];
  1574. $goods_list[$num[0]][] = $transportItem['sku'] ." 在途库存: <b>" . $transportItem['num'] . " </b> 预达时间: ".date("Y-m-d",$transportItem['stime']). " <br/> 备注 : " . $transportItem['text'];
  1575. }
  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. }