12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583 |
- <?php defined('BASEPATH') OR exit('No direct script access allowed');
- class Warehouse extends Start_Controller {
- public function __construct(){
- parent::__construct();
- $this->load->library('session');
- $this->load->_model('Model_warehouse','warehouse');
- $this->load->_model('Model_country','country');
- $this->load->_model('Model_express','express');
- $this->load->_model('Model_whlabel','whlabel');
- $this->load->_model('Model_fullorder','fullorder');
- $this->load->_model('Model_fullordertt','fullordertt');
- $this->load->_model('Model_fullordersmt','fullordersmt');
- $this->load->_model('Model_typeclass','typeclass');
- $this->load->_model('Model_shop','shop');
- $this->load->_model('Model_systemwigsout','systemwigsout');
- $this->load->_model('Model_excel','excel');
- $this->load->_model('Model_transfer','transfer');
- $this->load->_model('Model_systemtransfer','systemtransfer');
- $this->load->_model('Model_whlabeltransport', 'whlabeltransport');
- $this->load->_model('Model_systemtransfer_cr', 'systemtransfer_cr');
- }
- //定义方法的调用规则 获取URI第二段值
- public function _remap($arg,$arg_array)
- {
- if($arg == 'add')//添加
- {
- $this->_add();
- }
- else if($arg == 'edit')
- {
- $this->_edit($arg_array);
- }
- else if($arg == 'del')
- {
- $this->_del();
- }
- else if($arg == 'rows')
- {
- $this->_rows();
- }
- else if($arg == 'list')
- {
- $this->_list();
- }
- else if($arg == 'kcpd')
- {
- $this->_kcpd();
- }
- else if($arg == 'orderlist')
- {
- $this->_orderlist();
- }
- else if($arg == 'orderlistck')//华荣厂查看
- {
- $this->_orderlistck();
- }
- else if($arg == 'orderlistexcel')
- {
- $this->_orderlistexcel();
- }
- else if($arg == 'ordersee')
- {
- $this->_ordersee($arg_array);
- }
- else
- {
- $this->_index();
- }
- }
- //管理
- public function _index()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $title = $this->input->post('title',true);
- $where = "1=1 ";
- if($title)
- {
- $where .= " and title = '$title'";
- }
- //数据排序
- $order_str = "id asc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- //取得信息列表
- $info_list = $this->warehouse->find_all($where,'id,title,show,zd,zdms,fpzd,wz,fpsx,express,bdcountry,yybm',$order_str,$start,$perpage);
- foreach ($info_list as $key=>$value)
- {
- if($value['show'] == 1)
- {
- $info_list[$key]['show'] = "是";
- }
- else
- {
- $info_list[$key]['show'] = "否";
- }
- if($value['zd'] == 1)
- {
- $info_list[$key]['zd'] = "启用";
- }
- else
- {
- $info_list[$key]['zd'] = "无";
- }
- if($value['zdms'] == 1)
- {
- $info_list[$key]['zdms'] = "单独占单";
- }
- else if(($value['zdms'] == 2))
- {
- $info_list[$key]['zdms'] = "全占";
- }
- else if(($value['zdms'] == 3))
- {
- $info_list[$key]['zdms'] = "混占";
- }
- else
- {
- $info_list[$key]['zdms'] = "无";
- }
- if($value['express'] == 0)
- {
- $info_list[$key]['express'] = "无";
- }
- else
- {
- $express = $this->express->read($value['express']);
- $info_list[$key]['express'] = $express['servicename'];
- }
- if($value['fpzd'] == 1)
- {
- $info_list[$key]['fpzd'] = "自动";
- }
- else
- {
- $info_list[$key]['fpzd'] = "否";
- }
- if($value['wz'] == 1)
- {
- $info_list[$key]['wz'] = "开启";
- }
- else
- {
- $info_list[$key]['wz'] = "关闭";
- }
- if($value['bdcountry'] != 0)
- {
- $country = $this->country->read($value['bdcountry']);
- $info_list[$key]['bdcountry'] = $country['name'];
- }
- else
- {
- $info_list[$key]['bdcountry'] = "";
- }
- }
- $total = $this->warehouse->find_count($where);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($info_list));
- echo json_encode($rows);exit;
- }
- $this->_Template('warehouse',$this->data);
- }
- //添加
- public function _add()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['title']))
- {
- $post['title'] = $this->input->post('title',true);
- $post['company'] = $this->input->post('company',true);
- $post['user'] = $this->input->post('user',true);
- $post['show'] = $this->input->post('show',true);
- //$post['function'] = $this->input->post('function',true);
- //$post['functiontext'] = $this->input->post('functiontext',true);
- $post['country'] = $this->input->post('country',true);
- $post['name'] = $this->input->post('name',true);
- $post['phone'] = $this->input->post('phone',true);
- $post['province'] = $this->input->post('province',true);
- $post['city'] = $this->input->post('city',true);
- $post['zipcode'] = $this->input->post('zipcode',true);
- $post['address'] = $this->input->post('address',true);
- $post['address2'] = $this->input->post('address2',true);
- $post['hz'] = $this->input->post('hz',true);
- $post['zd'] = $this->input->post('zd',true);
- $post['bdck'] = $this->input->post('bdck',true);
- if($post['zd'] == 1 && $post['bdck'] == '')
- {
- echo json_encode(array('msg'=>'开启占单模式必须填写绑定库','success'=>false));exit;
- }
- if($post['zd'] == 1 && $post['hz'] == '')
- {
- echo json_encode(array('msg'=>'开启占单模式必须填写占单后缀','success'=>false));exit;
- }
- if($post['zd'] == 1 && !ctype_alpha($post['hz']))
- {
- echo json_encode(array('msg'=>'占单后缀只允许是字母','success'=>false));exit;
- }
- if($this->warehouse->insert($post))
- {
- echo json_encode(array('msg'=>'添加成功','success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'添加失败,请重试','success'=>false));exit;
- }
- }
- $country = $this->country->find_all();
- $this->data['country'] = $country;
- $this->_Template('warehouse_add',$this->data);
- }
- //修改
- public function _edit($arg_array)
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['id']))
- {
- $id = $this->input->post('id',true);
- $data = $this->warehouse->read($id);
- $post['title'] = $this->input->post('title',true);
- $post['company'] = $this->input->post('company',true);
- $post['user'] = $this->input->post('user',true);
- $post['show'] = $this->input->post('show',true);
- /**
- $post['out'] = $this->input->post('out',true);
- if($post['out'] == 1)
- {
- //$post['mode'] = $this->input->post('mode',true);
- $post['mode'] = 0;
- }
- else
- {
- $post['mode'] = 0;
- }
- **/
- //$post['function'] = $this->input->post('function',true);
- //$post['functiontext'] = $this->input->post('functiontext',true);
- $post['country'] = $this->input->post('country',true);
- $post['name'] = $this->input->post('name',true);
- $post['phone'] = $this->input->post('phone',true);
- $post['province'] = $this->input->post('province',true);
- $post['city'] = $this->input->post('city',true);
- $post['zipcode'] = $this->input->post('zipcode',true);
- $post['address'] = $this->input->post('address',true);
- $post['address2'] = $this->input->post('address2',true);
- $post['hz'] = $this->input->post('hz',true);
- $post['zd'] = $this->input->post('zd',true);
- $post['bdck'] = $this->input->post('bdck',true);
- if($post['zd'] == 1 && $post['bdck'] == '' && $data['bdck'] == '')
- {
- echo json_encode(array('msg'=>'开启占单模式必须填写绑定库','success'=>false));exit;
- }
- if($post['zd'] == 1 && $post['hz'] == '' && $data['hz'] == '')
- {
- echo json_encode(array('msg'=>'开启占单模式必须填写占单后缀','success'=>false));exit;
- }
- if($post['hz'] && !ctype_alpha($post['hz']))
- {
- echo json_encode(array('msg'=>'占单后缀只允许是字母','success'=>false));exit;
- }
- if($data['bdck'] != '')
- {
- $post['bdck'] = $data['bdck'];
- }
- if($data['hz'] != '')
- {
- $post['hz'] = $data['hz'];
- }
- if($this->warehouse->save($post,$id))
- {
- echo json_encode(array('msg'=>'修改成功','success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'修改失败,请重试','success'=>false));exit;
- }
- }
- $arg_array = $arg_array[0];
- $warehouse = $this->warehouse->read($arg_array);
- $country = $this->country->find_all();
- $this->data['country'] = $country;
- $this->data['warehouse'] = $warehouse;
- $this->_Template('warehouse_edit',$this->data);
- }
- //删除
- public function _del()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['s']))
- {
- $id_arr = $this->input->post('s');
- $id_arr = explode(',',$id_arr);
- if(!$id_arr)
- {
- echo json_encode(array('msg'=>'参数错误!','success'=>false));exit;
- }
- //循环删除记录
- foreach ($id_arr as $v)
- {
- $this->warehouse->remove($v);
- }
- echo json_encode(array('del'=>$id_arr,'msg'=>'删除记录成功!','success'=>true));
- }
- }
- //获取数据
- public function _rows()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['rows']))
- {
- $rows = $this->input->post('rows',true);
- $bn = array('0'=>array('id'=>'3','title'=>'销售出库'),'1'=>array('id'=>'4','title'=>'非更换SKU方式调拨出库'));
- $cn = array('0'=>array('id'=>'5','title'=>'采购入库'),'1'=>array('id'=>'6','title'=>'单产品入库'),'2'=>array('id'=>'7','title'=>'非更换SKU方式调拨入库'));
- $an = array('0'=>array('id'=>'1','title'=>'出库','bn'=>$bn),'1'=>array('id'=>'2','title'=>'入库','bn'=>$cn));
- $warehouse = array();
- if($rows != "null")
- {
- $warehouse = $this->warehouse->read($rows);//找出次ID的权限内容
- if($warehouse['function'])
- {
- $warehouse = explode('|',trim($warehouse['function'],'|'));//数组化权限内容
- }
- }
- echo json_encode(array('msg'=>($an),'power'=>($warehouse),'success'=>true));
- }
- }
-
- public function _list()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['id']))
- {
- $id = $this->input->post('id',true);
- $warehouse = $this->warehouse->read($id);
- if(isset($warehouse['zd']))
- {
- if(($warehouse['zd'] == '1' && $warehouse['ys'] == '1') || $warehouse['zd'] == '0')
- {
- $zd = '0';
- }
- else
- {
- $zd = '1';
- }
-
- echo json_encode(array('msg'=>$zd,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>'错误,请重试','success'=>false));
- }
- }
- }
-
-
- public function _kcpd()
- {
- header("Access-Control-Allow-Origin: *");
- //echo json_encode(array('msg'=>'','success'=>true));exit;
- //暂时不用
- $post = $this->input->post(NULL, TRUE);
- if(isset($post['warehouse']))
- {
- $warehouse = $this->input->post('warehouse',true);
- $warehouse = $this->warehouse->read($warehouse);
- $whlabel = $this->input->post('whlabel',true);
- $shop = $this->input->post('shop',true);
- $data = $this->input->post('data',true);
- $data = str_replace('--','-',$data);
- $number = $this->input->post('number',true);
- $y = $this->fullordersmt->get_number($number);
- if(!$y)
- {
- $y = $this->fullorder->get_number($number);
- }
- if(!$y)
- {
- $y = $this->fullordertt->get_number($number);
- }
- if(!preg_match('/[0-9]/',$whlabel))
- {
- echo json_encode(array('msg'=>"无",'success'=>true));exit;
- }
- $typeclass = array();
- $tdata = $this->typeclass->find_all();
- foreach ($tdata as $v)
- {
- $typeclass[$v['id']] = $v['classid'];
- }
- $kxw = '';
- if(1==1)//($warehouse['zd'] == '0' || ($warehouse['zd'] == '1' && stripos($whlabel,$warehouse['hz'].'|') === false))
- {
- $kxw = '可用现货仓:';$tdfh = '';$cs = array();
- $warehousedata = $this->warehouse->find_all("zd = '1' and id != '8'");
- $pp = explode('|',trim($whlabel,'|'));
- $ccpp = explode('|',trim($data,'|'));
- $mgc = 0;//美国仓计数
- foreach ($warehousedata as $v)
- {
- if($y['country'] != '192' && $v['id'] == 5)
- {
- continue;
- }
- $x = 0;$j = 0;$save = array();$tdxh = 0;$thqd = 0;$thqdzh = '';$tdwh = 0;$tdshopwh = 0;$htpd = 0;$wearToGo = 0;$hdtx = '';
- foreach ($pp as $va)
- {
- $num = explode('-',$va);
- if($num[1] < 1)
- {
- continue;
- }
- $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.",%')");
- $x++;
- if($wh < $num[1])
- {
- $cp = $ccpp[$x-1];
- $cp = str_replace(array('-163-','-164-','-165-','-166-'),'-',$cp);
- $save[] = $x-1;//提前先加X不然出错,所以要减1
- $cc = explode(',',$cp);
- if($v['id'] == '5')//美国仓提档检测是否有货
- {
- $xcc = $this->typeclass->read($cc[0]+1);
- if($xcc['classid'] == '14')
- {
- $tdnum = $this->str_replace_limit($cc[0],$xcc['id'],$num[0]);
- $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.",%')");
- }
- if($tdwh < $num[1])
- {
- $tdxh += 1;//提前先加X不然出错,所以要减1
- }
- }
- //美国仓提档检测是否有货结束
- //103 Body Wave 1647 LooseBody
- if(stripos($cp,'-103-') !== false || stripos($cp,'-1647-') !== false)
- {
- $htpd += 1;
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- //曲度后边加了长度
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- if(stripos($newcp,'-103-') !== false)
- {
- $gpp = str_replace('-103-','-1647-',$newcp);
- $thqdzh = 'Loose Body';
- }
- else
- {
- $gpp = str_replace('-1647-','-103-',$newcp);
- $thqdzh = 'Body';
- }
- $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.",%')");//通用
- if($qdth_wh < $num[1])
- {
- $thqd += 1;//提前先加X不然出错,所以要减1
- }
-
- }
- /**
- if(stripos($cp,'-1181-') !== false)
- {
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- $gpp = str_replace('-1181-','-2071-',$newcp);
- $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.",%')");//通用
- if($wtgo_wh >= $num[1])
- {
- $wearToGo += 1;
- }
-
- }
- */
- /** /HKK
- if(stripos($cp,'-2028-') !== false)
- {
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- $gpp = str_replace('-2028-','-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - 非HKK有货;';
- }
-
- }
- else if(stripos($cp,'-128-') !== false)
- {
- $cptt = array(16=>128,13=>80,14=>'',43=>'',8=>'57',15=>'',18=>'',6=>30,10=>72,9=>'',39=>'',44=>'');//头套
- $cc1 = explode('-',trim($cc[1],'-'));
- $cptt[$typeclass[$cc[0]]] = $cc[0];
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- $cptt[$typeclass[$vv]] = $vv;
- }
- if($cptt[44] != '')
- {
- continue;
- }
- else
- {
- $cptt[44] = '2028';
- $cptt = array_filter($cptt);
- }
- $gpp = '-'.implode("-",$cptt).'-';
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - HKK有货;';
- }
- }
- **/
- //RTGWL 注释掉了
- // if(stripos($cp,'-2076-') !== false)
- // {
- // $cc1 = explode('-',trim($cc[1],'-'));
- // $newcp = '-';
- // foreach ($cc1 as $kk=>$vv)
- // {
- // if($kk == 1)
- // {
- // $newcp .= $vv.'-'.$cc[0].'-';
- // }
- // else
- // {
- // $newcp .= $vv.'-';
- // }
- // }
- // $gpp = str_replace('-2076-','-',$newcp);
- // $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.",%')");//通用
- // if($ccxh >= $num[1])
- // {
- // $hdtx .= $v['title'].' - 非RTGWL有货;';
- // }
-
- // }
- // else if(stripos($cp,'-128-') !== false)
- // {
- // $cptt = array(16=>128,13=>80,14=>'',43=>'',8=>'57',15=>'',18=>'',6=>30,10=>72,9=>'',39=>'',44=>'');//头套
- // $cc1 = explode('-',trim($cc[1],'-'));
- // $cptt[$typeclass[$cc[0]]] = $cc[0];
- // $newcp = '-';
- // foreach ($cc1 as $kk=>$vv)
- // {
- // $cptt[$typeclass[$vv]] = $vv;
- // }
- // if($cptt[44] != '')
- // {
- // continue;
- // }
- // else
- // {
- // $cptt[44] = '2076';
- // $cptt = array_filter($cptt);
- // }
- // $gpp = '-'.implode("-",$cptt).'-';
- // $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.",%')");//通用
- // if($ccxh >= $num[1])
- // {
- // $hdtx .= $v['title'].' - RTGWL有货;';
- // }
- // }
-
- // 4*7没货的,5*7如果有货,给提醒
- if(stripos($cp,'-1253-') !== false)
- {
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- $gpp = str_replace('-1253-','-2062-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - 5*7有货;';
- }
-
- }
- // 5*5没货的,5*7、5*9如果有货,给提醒
- if(stripos($cp,'-297-') !== false) //13*4 HD13*4
- {
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- $gpp = str_replace('-297-','-2062-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - 5*7有货;';
- }
-
-
- $gpp2 = str_replace('-297-','-1254-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - 5*9有货;';
- }
-
-
- }
-
- // 180%货的,200、250如果有货,给提醒
- if(stripos($cp,'-72-') !== false) //13*4 HD13*4
- {
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- $gpp = str_replace('-72-','-73-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - 200%密度有货;';
- }
-
-
- $gpp2 = str_replace('-72-','-74-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - 250%密度有货;';
- }
-
-
- }
- if(stripos($cp,'-73-') !== false) //200% 250%
- {
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
-
-
- $gpp2 = str_replace('-73-','-74-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - 250%密度有货;';
- }
-
-
- }
- //HD相互提醒
- if(stripos($cp,'-146-') !== false || stripos($cp,'-331-') !== false) //13*4 HD13*4
- {
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- if(stripos($cp,'-146-') !== false)
- {
- $gpp = str_replace('-146-','-331-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - HD13*4有货;';
- }
- }
- else if(stripos($cp,'-331-') !== false)
- {
- $gpp = str_replace('-331-','-146-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - 13*4有货;';
- }
- }
-
- }
-
- if(stripos($cp,'-322-') !== false || stripos($cp,'-341-') !== false)//13*6 HD13*6
- {
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- if(stripos($cp,'-322-') !== false)
- {
- $gpp = str_replace('-322-','-341-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - HD13*6有货;';
- }
- }
- else if(stripos($cp,'-341-') !== false)
- {
- $gpp = str_replace('-341-','-322-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - 13*6有货;';
- }
- }
-
- }
-
-
- if(stripos($cp,'-147-') !== false || stripos($cp,'-781-') !== false)//4*4 HD4*4
- {
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- if(stripos($cp,'-147-') !== false)
- {
- $gpp = str_replace('-147-','-781-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - HD4*4有货;';
- }
- }
- else if(stripos($cp,'-781-') !== false)
- {
- $gpp = str_replace('-781-','-147-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - 4*4有货;';
- }
- }
-
- }
-
-
- if(stripos($cp,'-297-') !== false || stripos($cp,'-540-') !== false)//5*5 HD5*5
- {
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- if(stripos($cp,'-297-') !== false)
- {
- $gpp = str_replace('-297-','-540-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - HD5*5有货;';
- }
- }
- else if(stripos($cp,'-540-') !== false)
- {
- $gpp = str_replace('-540-','-297-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - 5*5有货;';
- }
- }
-
- }
-
-
-
- if(stripos($cp,'-298-') !== false || stripos($cp,'-370-') !== false)//6*6 HD6*6
- {
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- if(stripos($cp,'-298-') !== false)
- {
- $gpp = str_replace('-298-','-370-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - HD6*6有货;';
- }
- }
- else if(stripos($cp,'-370-') !== false)
- {
- $gpp = str_replace('-370-','-298-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - 6*6有货;';
- }
- }
-
- }
-
-
- if(stripos($cp,'-935-') !== false || stripos($cp,'-854-') !== false)//#P4/27/613 #P4/613
- {
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- if(stripos($cp,'-935-') !== false)
- {
- $gpp = str_replace('-935-','-854-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - #P4/613;';
- }
- }
- else if(stripos($cp,'-854-') !== false)
- {
- $gpp = str_replace('-854-','-935-',$newcp);
- $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.",%')");//通用
- if($ccxh >= $num[1])
- {
- $hdtx .= $v['title'].' - #P4/27/613;';
- }
- }
-
- }
- //HD相互提醒结束
- $cc1 = explode('-',trim($cc[1],'-'));
- $newcp = '-';
- foreach ($cc1 as $kk=>$vv)
- {
- if($kk == 1)
- {
- $newcp .= $vv.'-'.$cc[0].'-';
- }
- else
- {
- $newcp .= $vv.'-';
- }
- }
- //在途库存
- $transportlist = $this->whlabeltransport->find_all("features = '".$newcp."' and cz = 0 and warehouse = '".$v['id']."'");
- $transportMsg = "";
- if(count($transportlist) > 0)
- {
-
- $transportItem = $transportlist[0];
- $transportMsg = "<br/>". $transportItem['sku'] . " 在途库存: <b>" . $transportItem['num'] . " </b> 预达时间: ".date("Y-m-d",$transportItem['stime']). " <br/> 备注 : " . $transportItem['text'];
- }
- }
- else
- {
- if($v['id'] == '5')
- {
- $mgc++;
- }
- else
- {
- $kxw .= $v['title'].';';
- }
- }
- }
- if(!isset($save[0]))//非预设仓库提醒
- {
- //$kxw .= $v['title'].';';
- }
- else
- {
- if($v['id'] == '5' && $tdxh == '0')
- {
- $kxw .= $v['title'].'(当前尺寸无货,提一档有货) ;';
- }
- if($thqd == 0 && $htpd > 0)
- {
- $kxw .= $v['title'].'(当前曲度无货,'.$thqdzh.'有货) ;';
- }
- if($wearToGo > 0)
- {
- $kxw .= $v['title'].'(ReadytoGo有货) ;';
- }
- if($hdtx != '')
- {
- $kxw .= $hdtx;
- }
- if (!empty($transportMsg)) {
- $kxw .= $transportMsg;
- }
- }
- }
- }
- if(isset($pp) && $mgc == count($pp))
- {
- $kxw .= '美国店;';
- }
- if($kxw == '可用现货仓:')
- {
- echo json_encode(array('msg'=>$kxw.'无','cs'=>$cs,'success'=>true));exit;
- }
- else
- {
- echo json_encode(array('msg'=>rtrim($kxw,';'),'success'=>true));exit;
- }
- }
- }
-
- public function str_replace_limit($search, $replace, $subject)
- {
- $pos = strpos($subject, $search);
- if ($pos !== false)
- {
- return substr_replace($subject, $replace, $pos, strlen($search));
- }
- return $subject;
- }
-
-
- public function _orderlist()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";$wid="";$wtype="";
- $usersp = explode('|',trim($user['shop'],'|'));
- $userwh = explode('|',trim($user['warehouse'],'|'));
- foreach ($usersp as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- foreach ($userwh as $value)
- {
- $wid .= " id = ".$value." or";
- $wtype .= " type = ".$value." or";
- }
- }
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $timetk = $this->input->post('timetk',true);
- $timetj = $this->input->post('timetj',true);
- $orderinfo = $this->input->post('orderinfo',true);
- $number = $this->input->post('number',true);
- $print = $this->input->post('print',true);
- $shop = $this->input->post('shop',true);
- $type = $this->input->post('type',true);
- $ckfl = $this->input->post('ckfl',true);
- $so = $this->input->post('so',true);
- $sfxh = $this->input->post('sfxh',true);
- $library = $this->input->post('library',true);
- $libraryconfirm = $this->input->post('libraryconfirm',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = (isset($_SESSION['api']))?"(".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($print)
- {
- $where .= " and print = '$print'";
- if($print == 3)
- {
- $where .= " and printtime > '$timetk' and printtime < '$timetj'";
- }
- }
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($type)
- {
- $where .= " and type = '$type'";
- }
- if($so)
- {
- $where .= " and shipremarks like '%$so%'";
- }
- if($ckfl)
- {
- $where .= " and ckfl = '$ckfl'";
- }
- if($library)
- {
- $where .= " and library = '$library'";
- }
- if($type)
- {
- $where .= " and type = '$type'";
- }
- if($libraryconfirm)
- {
- $where .= " and libraryconfirm = '$libraryconfirm'";
- }
- //数据排序
- $order_str = ($print != 3)?"id desc":"printtime desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- $t = array();
- $transfer = $this->transfer->find_all();
- foreach ($transfer as $v)
- {
- $t[$v['id']] = $v['title'];
- $ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
- }
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,printtime,librarytime,shipremarks',$order_str,$start,$perpage);
- $info_listsmt = $this->fullordersmt->find_all($where." and mergeid != '1'",'id,shop,orderinfo,number,printtime,librarytime,shipremarks',$order_str,$start,$perpage);
- $info_listtt = $this->fullordertt->find_all($where." and mergeid != '1'",'id,shop,orderinfo,number,printtime,librarytime,shipremarks',$order_str,$start,$perpage);
- $rows = array_merge($info_list,$info_listsmt,$info_listtt);
- //格式化数据
- foreach ($rows as $key=>$value)
- {
- $rows[$key]['id'] = $value['id'].'-fullorder';
- $shop = $this->shop->read($value['shop']);
- $rows[$key]['shop'] = $shop['shopname'];
- if($value['printtime'] > 0)
- {
- $rows[$key]['printtime'] = date('Y-m-d H:s',$value['printtime']);
- }
- else
- {
- $rows[$key]['printtime'] = '未打印';
- }
- if(isset($value['librarytime']) && $value['librarytime'] > 0)
- {
- $rows[$key]['librarytime'] = date('Y-m-d H:s',$value['librarytime']);
- }
- else
- {
- $rows[$key]['librarytime'] = '未出库';
- }
- $rows[$key]['orderinfo'] = "<h9 class='window' data-h='/warehouse/ordersee/".$value['id']."' data-t='订单号:".$value['orderinfo']."'><p>".$value['orderinfo']."</p></h9>";
- $rows[$key]['shipremarks'] = str_replace(array('<','>'),array('<','>'),$value['shipremarks']);
- $out = '';
- $tf = $this->systemtransfer->find_all("number = '".$value['number']."'");
- if(!empty($tf)){
- if($tf[0]['is_jiaji']){
- $rows[$key]['number'] = "<a href='javascript:void(0)' style='color:red'>".$rows[$key]['number']."加急!!!</a>";
- }
- }
- foreach ($tf as $k=>$v)
- {
- if(count($tf) > 1)
- {
- $out .= $k.'<br>';
- }
- $data = $this->systemtransfer_cr->find_all("fid = '".$v['id']."'");
- $out = "订单打印 :".date('Y-m-d H:i',$value['printtime']).'<br>';
- foreach ($data as $k=>$v)
- {
- $type = ($v['type']==1)?'入库':'出库';
- $out .= $t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']).'<br>';
- }
- }
- $rows[$key]['outread'] = trim($out,'<br>');
- }
- $dlz = $this->fullorder->find_count($where);
- $smt = $this->fullordersmt->find_count($where);
- $tt = $this->fullordertt->find_count($where);
-
- //$total += $this->fullorder_smt->find_count($where);
- $total = $dlz+$smt+$tt;
-
- //$rows = array_slice($rows,$start,$perpage);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $tmp = array();
- if($print == 3)
- {
- foreach ($rows as $key => $val)
- {
- $tmp[$key] = $val['printtime'];
- }
- array_multisort($tmp,SORT_DESC,$rows);
- }
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($rows),'cs'=>$where);//array_merge($info_list,$info_list_smt,$info_listsmt)
- echo json_encode($rows);exit;
- }
- if(isset($_SESSION['api']))
- {
- $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
- $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
- $this->data['wlshop'] = $wlshop;
- $this->data['warehouse'] = $warehouse;
- }
- $this->_Template('warehouse_orderlist',$this->data);
- }
-
-
- public function _orderlistck()//华荣厂查看
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";$wid="";$wtype="";
- $usersp = explode('|',trim($user['shop'],'|'));
- $userwh = explode('|',trim($user['warehouse'],'|'));
- foreach ($usersp as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- foreach ($userwh as $value)
- {
- $wid .= " id = ".$value." or";
- $wtype .= " type = ".$value." or";
- }
- }
- if(isset($post['page']))
- {
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $number = $this->input->post('number',true);
- $so = $this->input->post('so',true);
- $where = (isset($_SESSION['api']))?"(".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($so)
- {
- $where .= " and shipremarks like '%$so%'";
- }
- if(!$so && !$number)
- {
- $where = "id < 0";
- }
- //数据排序
- $order_str = "id desc";
- if(empty($page))
- {
- $start = 0;
- $perpage = 1;
- }
- else
- {
- $start = ($page - 1)*$perpage;
- }
- $info_list = array();
- $info_listsmt = array();
- $dlz = 0; $smt = 0;
- //取得信息列表
- $info_list = $this->fullorder->find_all($where,'id,number,shipremarks',$order_str,$start,$perpage);
- $info_listsmt = $this->fullordersmt->find_all($where." and mergeid != '1'",'id,number,shipremarks',$order_str,$start,$perpage);
- $info_listtt = $this->fullordertt->find_all($where." and mergeid != '1'",'id,number,shipremarks',$order_str,$start,$perpage);
- $rows = array_merge($info_list,$info_listsmt,$info_listtt);
- //格式化数据
- foreach ($rows as $key=>$value)
- {
- $rows[$key]['id'] = $value['id'].'-fullorder';
- $rows[$key]['shipremarks'] = str_replace(array('<','>'),array('<','>'),$value['shipremarks']);
- $systemwigsout = $this->systemwigsout->get_number($value['number']);
- $wigsout = '';
- if($systemwigsout)
- {
- $cz = explode('|',trim($systemwigsout['cz'],'|'));
- $cztime = explode('|',trim($systemwigsout['cztime'],'|'));
- $zw = array();
- $t = $this->transfer->find_all("1=1");
- foreach ($t as $v)
- {
- $zw[$v['id']] = $v['title'];
- }
- if($systemwigsout['cz'] != '' && count($cz) > 0)
- {
- for($i=0;$i<count($cz);$i++)
- {
- if(!isset($cztime[$i]))
- {
- $wigsout .= $zw[$cz[$i]];
- }
- else
- {
- $wigsout .= $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]).',';
- }
- }
- }
- }
- $rows[$key]['systemwigsout'] = rtrim($wigsout,',');
- }
- $dlz = $this->fullorder->find_count($where);
- $smt = $this->fullordersmt->find_count($where);
- $tt = $this->fullordersmt->find_count($where);
-
- //$total += $this->fullorder_smt->find_count($where);
- $total = $dlz+$smt+$tt;
-
- //$rows = array_slice($rows,$start,$perpage);
- $pagenum = ceil($total/$perpage);
- $over = $total-($start+$perpage);
- $tmp = array();
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($rows),'cs'=>$where);//array_merge($info_list,$info_list_smt,$info_listsmt)
- echo json_encode($rows);exit;
- }
- if(isset($_SESSION['api']))
- {
- $wlshop = $this->shop->find_all('1=1 and '.rtrim($sid,'or'));
- $warehouse = $this->warehouse->find_all('1=1 and '.rtrim($wid,'or'),"*","px asc");
- $this->data['wlshop'] = $wlshop;
- $this->data['warehouse'] = $warehouse;
- }
- $this->_Template('warehouse_orderlistck',$this->data);
- }
-
- public function _ordersee($arg_array)
- {
- $arg_array = $arg_array[0];
- $fullorder = 'fullorder';
- $data = $this->fullorder->read($arg_array);
- if(!$data)
- {
- $fullorder = 'fullordersmt';
- $data = $this->fullordersmt->read($arg_array);
- }
- if(!$data)
- {
- $fullorder = 'fullordertt';
- $data = $this->fullordertt->read($arg_array);
- }
- $fpdata = array();
- $fullorder = $this->$fullorder->read($arg_array);
- if(stripos($fullorder['fpdata'],';') !== false)
- {
- $fpdata = explode(';',rtrim($fullorder['fpdata'],';'));
- foreach ($fpdata as $k=>$v)
- {
- $fpdata[$k] = explode('|',$v);
- }
- }
- $systemwigsout = $this->systemwigsout->get_number($fullorder['number']);
- $wigsout = array();
- if($systemwigsout)
- {
- $cz = explode('|',trim($systemwigsout['cz'],'|'));
- $cztime = explode('|',trim($systemwigsout['cztime'],'|'));
- $zw = array();
- $t = $this->transfer->find_all("1=1");
- foreach ($t as $v)
- {
- $zw[$v['id']] = $v['title'];
- }
- if($systemwigsout['cz'] != '' && count($cz) > 0)
- {
- for($i=0;$i<count($cz);$i++)
- {
- if(!isset($cztime[$i]))
- {
- $wigsout[] = $zw[$cz[$i]];
- }
- else
- {
- $wigsout[] = $zw[$cz[$i]].' :'.date('Y-m-d H:i',$cztime[$i]);
- }
- }
- }
- }
- $this->data['systemwigsout'] = $wigsout;
- $this->data['fpdata'] = $fpdata;
- $this->data['data'] = $data;
- $this->_Template('warehouse_ordersee',$this->data);
- }
-
-
- public function _orderlistexcel()
- {
- $post = $this->input->post(NULL, TRUE);
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
- $usp = $user;
- $fgshop = "";$sid = "";$wid="";$wtype="";
- $usersp = explode('|',trim($user['shop'],'|'));
- $userwh = explode('|',trim($user['warehouse'],'|'));
- foreach ($usersp as $value)
- {
- $fgshop .= " shop = ".$value." or";
- $sid .= " id = ".$value." or";
- }
- foreach ($userwh as $value)
- {
- $wid .= " id = ".$value." or";
- $wtype .= " type = ".$value." or";
- }
- }
- if(isset($_GET['excel']))
- {
- $a = $this->input->get('a',true);
- $id_is = '';$id_smt = '';
- if($a)
- {
- $a = explode(',',rtrim($a,','));
- foreach ($a as $value)
- {
- $v = explode('-',$value);
- if($v[1] == 'fullorder')
- {
- $id_is .= "id = ".$v[0]." or ";
- }
- else
- {
- $id_smt .= "id = ".$v[0]." or ";
- }
- }
- if($id_is)
- {
- $id_is = " and (".rtrim($id_is,'or ').")";
- }
- if($id_smt)
- {
- $id_smt = " and (".rtrim($id_smt,'or ').")";
- }
- }
- $timetk = $this->input->get('timetk',true);
- $timetj = $this->input->get('timetj',true);
- $orderinfo = $this->input->get('orderinfo',true);
- $number = $this->input->get('number',true);
- $print = $this->input->get('print',true);
- $shop = $this->input->get('shop',true);
- $type = $this->input->get('type',true);
- $ckfl = $this->input->get('ckfl',true);
- $so = $this->input->get('so',true);
- $sfxh = $this->input->get('sfxh',true);
- $library = $this->input->get('library',true);
- $libraryconfirm = $this->input->get('libraryconfirm',true);
- $timetk = strtotime($timetk);
- $timetj = strtotime($timetj);
- $where = (isset($_SESSION['api']))?"(".rtrim($fgshop,'or').") and (".rtrim($wtype,'or').")":"id = '0'";
- if($orderinfo)
- {
- $where .= " and orderinfo = '$orderinfo'";
- }
- if($number)
- {
- $where .= " and number = '$number'";
- }
- if($print)
- {
- $where .= " and print = '$print'";
- if($print == 3)
- {
- $where .= " and printtime > '$timetk' and printtime < '$timetj'";
- }
- }
- if($shop)
- {
- $where .= " and shop = '$shop'";
- }
- if($type)
- {
- $where .= " and type = '$type'";
- }
- if($so)
- {
- $where .= " and shipremarks like '%$so%'";
- }
- if($ckfl)
- {
- $where .= " and ckfl = '$ckfl'";
- }
- if($library)
- {
- $where .= " and library = '$library'";
- }
- if($libraryconfirm)
- {
- $where .= " and libraryconfirm = '$libraryconfirm'";
- }
- $t = array();
- $transfer = $this->transfer->find_all();
- foreach ($transfer as $v)
- {
- $t[$v['id']] = $v['title'];
- $ot[$v['id']] = ($v['orvertime']>0)?$v['orvertime']*24*3600:0;
- }
- $order_str = ($print != 3)?"id desc":"printtime desc";
- $info_list = $this->fullorder->find_all($where.$id_is,'number,shipremarks,ts,printtime,library,libraryconfirm,librarynot,systemwigsout',$order_str);
- $info_listsmt = $this->fullordersmt->find_all($where.$id_smt." and mergeid != '1'",'number,shipremarks,ts,printtime,library,libraryconfirm,librarynot,systemwigsout',$order_str);
- $info_listtt = $this->fullordertt->find_all($where.$id_smt." and mergeid != '1'",'number,shipremarks,ts,printtime,library,libraryconfirm,librarynot,systemwigsout',$order_str);
- $rows = array_merge($info_list,$info_listsmt,$info_listtt);
- foreach ($rows as $key=>$value)
- {
- if($value['printtime'] > 0)
- {
- $rows[$key]['printtime'] = date('Y-m-d H:s',$value['printtime']);
- }
- else
- {
- $rows[$key]['printtime'] = '未打印';
- }
- if($value['library'] == 1)
- {
- $rows[$key]['library'] = "未出库";
- }
- else if($value['library'] == 2)
- {
- $rows[$key]['library'] = "已出库";
- }
- else if($value['library'] == 3)
- {
- $rows[$key]['printtime'] = '已退库';
- }
- if($value['libraryconfirm'] == 1)
- {
- $rows[$key]['libraryconfirm'] = '不允许出库';
- }
- else
- {
- $rows[$key]['libraryconfirm'] = '允许出库';
- }
- $rows[$key]['shipremarks'] = str_replace(array('<','>'),array('<','>'),$value['shipremarks']);
- $out = '';
- $tf = $this->systemtransfer->find_all("number = '".$value['number']."'");
- foreach ($tf as $k=>$v)
- {
- if(count($tf) > 1)
- {
- $out .= $k.'<br>';
- }
- $data = $this->systemtransfer_cr->find_all("fid = '".$v['id']."'");
- $out = "订单打印 :".date('Y-m-d H:i',$value['printtime']).'<br>';
- foreach ($data as $k=>$v)
- {
- $type = ($v['type']==1)?'入库':'出库';
- $out .= $t[$v['lx']].$type.' :'.date('Y-m-d H:i',$v['time']).'<br>';
- }
- }
- $rows[$key]['systemwigsout'] = trim($out,'<br>');
- }
-
- $title = date('Y-m-d',$timetk).'至'.date('Y-m-d',$timetj).'进销存详情';
- $titlename = "<table border=1>
- <tr><th colspan='9' align='center'><h3>".$title."<h3></th></tr>
- <tr align='center'>
- <td>编号</td>
- <td>仓库品名</td>
- <td>条数</td>
- <td>打印时间</td>
- <td>出库状态</td>
- <td>出库确认</td>
- <td>禁止出库原因</td>
- <td>追踪</td>
- </tr>
- </table>";
- $filename = $title.".xls";
- $tail = "";
- $this->excel->get_fz2($rows,$titlename,$filename,$tail);
- }
- }
- }
|