load->library('session'); $this->load->_model('Model_whlabel','whlabel'); $this->load->_model('Model_warehouse','warehouse'); $this->load->_model('Model_productprice','productprice'); $this->load->_model('Model_excel','excel'); $this->load->_model('Model_fullorder','fullorder'); $this->load->_model('Model_fullordertt','fullordertt'); $this->load->_model('Model_fullorderamz','fullorderamz'); $this->load->_model('Model_fullordersmt','fullordersmt'); $this->load->_model('Model_outbound','outbound'); $this->load->_model('Model_express','express'); $this->load->_model('Model_shop','shop'); $this->load->_model('Model_typeclass','typeclass'); $this->load->_model('Model_country','country'); $this->load->_model('Model_kdniao','kdniao'); $this->load->_model('Model_notice','notice'); $this->load->_model('Model_dhl','dhl'); $this->load->_model('Model_dhlhz','dhlhz'); $this->load->_model('Model_usps','usps'); $this->load->_model('Model_fedex','fedex'); $this->load->_model('Model_fedex_cby','fedex_cby'); $this->load->_model('Model_ups','ups'); $this->load->_model('Model_ali','ali'); $this->load->_model('Model_dpd','dpd'); $this->load->_model('Model_shop','shop'); $this->load->_model('Model_user','user'); $this->load->_model('Model_whlabel','whlabel'); $this->load->_model('Model_specialstock','specialstock'); $this->load->_model('Model_ck','ck'); $this->load->_model('Model_whlabellabel','whlabellabel'); $this->load->_model('Model_apiyy','apiyy'); $this->load->helper('url'); $this->load->_model('Model_whlabel_fc','whlabel_fc'); $this->load->_model('Model_systemtransfer','systemtransfer'); $this->load->_model('Model_classid','classid'); $this->load->_model('Model_allocation','allocation'); $this->load->_model('Model_fullorderxw','fullorderxw'); $this->load->_model('Model_fullorderpaypal','fullorderpaypal'); $this->load->_model("Model_logic_ding","logic_ding"); $this->load->_model("Model_fedexv1",'fedexv1'); $this->load->_model("Model_zzquque_u9","zzquque_u9"); $this->load->_model("Model_customsdeclaration","customsdeclaration"); } //定义方法的调用规则 获取URI第二段值 public function _remap($arg,$arg_array) { if($arg == 'exceltwo') { $this->_exceltwo($arg_array); } else { $this->_index(); } } public function _exceltwo($arg_array) { 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($user['userid'] == 'xw') { $xw = 1; } } if(isset($_GET['fexcel'])) { $dowid = $this->input->get('a'); $wid = ""; if($dowid != "") { $id_arr = explode(',',rtrim($dowid,',')); foreach ($id_arr as $v) { $wid .= " id = '$v' or"; } $wid = " and".rtrim($wid,'or'); } $t = $this->input->get('t',true); $timetk = $this->input->get('timetk',true); $timetj = $this->input->get('timetj',true); $shop = $this->input->get('shop',true); $source = $this->input->get('source',true); $orderinfo = $this->input->get('orderinfo',true); $number = $this->input->get('number',true); $library = $this->input->get('library',true); $waybill = $this->input->get('waybill',true); $express = $this->input->get('express',true); $type = $this->input->get('type',true); $so = $this->input->get('so',true); $timetk = strtotime($timetk); $timetj = strtotime($timetj); $where = (isset($_SESSION['api']))?"library!=3 and libraryconfirm=2 and print = 3 and (".rtrim($wtype,'or').")":"id = '0'"; if($timetk && $timetj && $library == 1) { //$cxtime = 'reviewtime'; $where .= " and printtime > '$timetk - 180*24*3600' and printtime < '$timetj'"; $where .= " and state != 217"; } else if($timetk && $timetj && $library == 2) { $cxtime = 'librarytime'; $where .= " and librarytime > '$timetk' and librarytime < '$timetj'"; } if(isset($_SESSION['api'])) { if($type) { $where .= " and type = '$type'"; } else { $uw = ''; $u = $this->user->get_api($_SESSION['api']); $u['warehouse'] = explode('|',trim($u['warehouse'],'|')); foreach ($u['warehouse'] as $v) { $uw .= " type = '$v' or"; } $uw = rtrim($uw,'or'); $uw = " and (".ltrim($uw,' ').")"; $where .= $uw; } } else { echo json_encode(array('msg'=>'导出失败,请重新登陆!','success'=>false));exit; } if($shop) { $where .= " and shop = '$shop'"; } if($number) { $where .= " and number = '$number'"; } if($library) { $where .= " and library = '$library'"; } if($waybill) { $where .= " and waybill = '$waybill'"; } if($express) { $where .= " and express = '$express'"; } if($orderinfo) { $where .= " and orderinfo = '$orderinfo'"; } if($so) { $where .= " and shipremarks like '%$so%'"; } //数据排序 //$order_str = ($print != 3)?"id desc":"librarytime desc"; $order_str = "librarytime desc"; if(empty($page)) { $start = 0; $perpage = 1; } else { $start = ($page - 1)*$perpage; } $typeclass = array(); $tclass = $this->typeclass->find_all(); foreach ($tclass as $v) { $typeclass[$v['id']] = $v; } $classid = $classid = $this->classid->sku(); $shop_list = $this->shop->find_all(); $shop_list = array_column($shop_list,'shopname','id'); $express_list = $this->express->find_all(); $express_list = array_column($express_list,'servicename','id'); $warehouse_list = $this->warehouse->find_all(); $warehouse_list = array_column($warehouse_list,'title','id'); $info_list = $this->_getAndTransfer('fullorder',$where.$wid,$order_str,$shop_list,$express_list,$warehouse_list,$classid,$typeclass); $info_listsmt = $this->_getAndTransfer('fullordersmt',$where.$wid,$order_str,$shop_list,$express_list,$warehouse_list,$classid,$typeclass); $info_listtt = $this->_getAndTransfer('fullordertt',$where.$wid,$order_str,$shop_list,$express_list,$warehouse_list,$classid,$typeclass); $info_listamz = $this->_getAndTransfer('fullorderamz',$where.$wid,$order_str,$shop_list,$express_list,$warehouse_list,$classid,$typeclass); $info_listxw = $this->_getAndTransfer('fullorderxw',$where.$wid,$order_str,$shop_list,$express_list,$warehouse_list,$classid,$typeclass); $list = []; $list = array_merge($info_list,$info_listsmt,$info_listtt,$info_listamz,$info_listxw); // $final_list = []; // foreach(){ // } //生成excel $filename = '订单出库-'.date('Ymd',time()).".xlsx"; $str = "
"; $str .= "编码 | 出库时间 | 仓库品名 | 申报条数 | 品名 | 料品 | 料品条数 |
". $value['number']. " | "; $str .= "". $value['librarytime']. " | "; $str .= "". $value['shipremarks']. " | "; $str .= "". $value['ts']. " | "; $str .= "". $v['pm']. " | "; $str .= "". $v['jm']. " | "; $str .= "". $v['ts']. " | "; $str .= "