load->library('session'); $this->load->_model('Model_api','api'); $this->load->_model('Model_shop','shop'); $this->load->_model('Model_fullorder','fullorder'); $this->load->_model('Model_fullordertt','fullordertt'); $this->load->_model('Model_fullordersmt','fullordersmt'); $this->load->_model('Model_country','country'); $this->load->_model('Model_hl','hl'); $this->load->_model('Model_is','is'); $this->load->_model('Model_kdniao','kdniao'); $this->load->_model('Model_typeclass','typeclass'); $this->load->_model('Model_warehouse','warehouse'); $this->load->_model('Model_fullorderexcel','fullorderexcel'); $this->load->_model('Model_dhl','dhl'); $this->load->_model('Model_usps','usps'); $this->load->_model('Model_ups','ups'); $this->load->_model('Model_dhltest','dhltest'); $this->load->_model('Model_customer','customer'); $this->load->_model('Model_express','express'); $this->load->_model('Model_notice','notice'); $this->load->_model('Model_emaildata','emaildata'); $this->load->_model('Model_whlabel','whlabel'); $this->load->_model('Model_productdescribe','productdescribe'); $this->load->_model('Model_ljg','ljg'); $this->load->_model('Model_commodityread','commodityread'); $this->load->_model('Model_service','service'); $this->load->_model('Model_fedex','fedex'); $this->load->_model('Model_apismt','apismt'); $this->load->_model('Model_cne','cne'); $this->load->_model('Model_specialstock','specialstock'); $this->load->_model('Model_whlabellabel','whlabellabel'); $this->load->_model('Model_allocation','allocation'); $this->load->_model('Model_yswaybill','yswaybill'); $this->load->_model('Model_paypal','paypal'); $this->load->_model('Model_17track','17track'); $this->load->_model('Model_ck','ck'); $this->load->_model('Model_weight','weight'); $this->load->_model('Model_pay','pay'); $this->load->_model('Model_setting','setting'); $this->load->_model('Model_classid','classid'); $this->load->_model('Model_apitt','apitt'); $this->load->_model('Model_customertt','customertt'); $this->load->_model('Model_als','als'); $this->load->_model('Model_apiyy','apiyy'); $this->load->_model('Model_whlabel_fc','whlabel_fc'); $this->load->_model('Model_excel','excel'); } //定义方法的调用规则 获取URI第二段值 public function _remap($arg,$arg_array) { if($arg == 'c') { $this->_c(); } else if($arg == 'cs') { $this->_cs($arg_array); } else if($arg == 'excel') { $this->_excel($arg_array); } else if($arg == 'xxpl') { $this->_xxpl(); } else if($arg == 'rz') { $this->_rz($arg_array); } } public function _excel($arg_array) { $filePath = './data/yyexcel/'.$arg_array[0].'/excel.txt'; $fileContent = file_get_contents($filePath); if ($fileContent !== false) { header( 'Content-Type: application/vnd.ms-excel; name=excel' ); header( 'Content-type: application/octet-stream' ); header( 'Content-Disposition: attachment; filename='.$arg_array[0].'.xls'); header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' ); header( 'Pragma: no-cache' ); header( 'Expires: 0' ); echo $fileContent; } else { echo "文件无法读取"; } } public function _rz($arg_array) { $a = './data/yylog/RK-'.$arg_array[0].'.txt'; if(is_file($a)) { $myfile = fopen($a, "r") or die("Unable to open file!"); $bc = fread($myfile,filesize($a)); fclose($myfile); $zt = explode('\n',trim($bc,'\n')); //$bc = json_decode($bc,true); $nr = array(); foreach($zt as $k=>$val) { $xx = explode(' = ',trim($val,' = ')); if(stripos($xx[0],'RK-F') !== false) { $nr[$k][][0] = '入库发送'; } else if(stripos($xx[0],'RK-J') !== false) { $nr[$k][][0] = '入库接收'; } else if(stripos($xx[0],'SH-F') !== false) { $nr[$k][][0] = '审核发送'; } else if(stripos($xx[0],'SH-J') !== false) { $nr[$k][][0] = '审核接收'; } else if(stripos($xx[0],'DC-F') !== false) { $nr[$k][][0] = '调出发送'; } else if(stripos($xx[0],'DC-J') !== false) { $nr[$k][][0] = '调出接收'; } $nr[$k][][1] = $xx[1]; } echo "
";
print_r($nr);
}
else
{
echo '无';
}
}
public function _c()
{
$asd = array();
$f = array('fullordersmt','fullordertt','fullorder');
foreach($f as $v)
{
$d = $this->$v->find_all("librarytime > '".(time()-(12*24*3600))."' and (type = '13' or type = '16') and dbapi < 99");
if($d)
{
$h = $this->_list($d,$v);
foreach($h as $vv)
{
$x = 0;$c = 0;
if(!isset($vv[0]))
{
continue;
}
$xs = $this->apiyy->_cxxsdd($vv['0']);
$chd = $this->apiyy->_cxchd($vv['0']);
if(isset($xs['Data'][0]))
{
$vv[] = '成功';
$x = 1;
}
else
{
$vv[] = '无';
}
if(isset($chd['Data'][0]))
{
$vv[] = '成功';
$c = 1;
}
else
{
$vv[] = '无';
}
if($x==1 && $c==1)
{
$this->$v->save(array('dbapi'=>99),$vv[4]);
}
$asd[] = $vv;
}
}
}
$title = "表 ".date("Y-m-d");
$titlename = "".$title." | ||||||
|---|---|---|---|---|---|---|
| 编号 | 销售订单发送 | 销售订单接收 | 出货单发送 | 出货单接收 | 销售订单验证 | 出货单验证 |
";
print_r(array($data,$classid,$tcall));
echo "";
print_r($ay);
exit;
$xx[$k]['xsf'] = $ay['fs'];
$xx[$k]['xss'] = $ay['fh'];
if($ay['c'] != 0)
{
$this->$fullorder->save(array('dbapi'=>0),$data['id']);
$this->apiyy->insert(array('number'=>$data['number'],'type'=>'销售订单','error'=>$ay['error'],'cs'=>$fullorder));
}
else
{
$this->$fullorder->save(array('dbapi'=>99),$data['id']);
$chdfs = '';$chdjs = '';$chdcg = 0;
foreach($data['lh'] as $k=>$v)
{
$chd = array('number'=>$data['number'],'i'=>$k+1,'ts'=>$v['ts']);
$c = $this->apiyy->get_chd($chd);
$chdfs = $c['1'];
$chdjs = json_encode($c['0']);
if(isset($c['Data']))
{
if($c['Data'][0]['m_isSucess'] == 1)
{
$chdcg += 1;
}
}
}
$xx[$k]['fhf'] = $chdfs;
$xx[$k]['fhs'] = $chdjs;
if($chdcg == count($data['lh']))
{
$cs = $this->$fullorder->save(array('dbapi'=>100),$data['id']);
}
}
}
public function _xxpl()
{
$dir = '/data/excel/'.date('Ymd',time()).'/';
$config['upload_path'] = '.'.$dir ;
$config['file_name'] = date('Ymd_His_',time()).rand(1000,9999);
$config['allowed_types'] = 'xls|xlsx|csv';
$config['max_size'] = 10240;
$this->load->library('upload', $config);
$this->upload->initialize($config);
if ($this->upload->do_upload('userfile'))
{
$full_path = $dir.$this->upload->data('file_name');
$fileName = '.' . $full_path;
if (!file_exists($fileName))
{
echo json_encode(array('msg'=>"上传失败,请重试",'success'=>false));exit;
}
else
{
require_once "./data/excel/PHPExcel/IOFactory.php";
@$phpExcel = PHPExcel_IOFactory::load($fileName);// 载入当前文件
@$phpExcel->setActiveSheetIndex(0);// 设置为默认表
$sheetCount = $phpExcel->getSheetCount();// 获取表格数量
$row = $phpExcel->getActiveSheet()->getHighestRow();// 获取行数
$column = $phpExcel->getActiveSheet()->getHighestColumn();// 获取列数
++$column;//如果列数大于26行
$list = array();
for ($i = 2; $i <= $row; $i++) // 行数循环
{
$data = array();
for ($c = 'A'; $c != $column; $c++) // 列数循环
{
$data[] = $phpExcel->getActiveSheet()->getCell($c . $i)->getValue();
}
$list[] = $data;
}
}
$cw = [];$d = [];
foreach ($list as $v)
{
$v = $v[0];
$fullorder_name = 'fullorder';
$y = $this->fullorder->get_number($v);
if(!$y)
{
$fullorder_name = 'fullordersmt';
$y = $this->fullordersmt->get_number($v);
if(!$y)
{
$fullorder_name = 'fullordertt';
$y = $this->fullordertt->get_number($v);
if(!$y)
{
$cw[] = [$v,'无数据'];
}
}
}
$d[$fullorder_name][] = $y;
}
foreach($d as $key=>$val)
{
$h = $this->_list($val,$key);
foreach($h as $vv)
{
$x = 0;$c = 0;
if(!isset($vv[0]))
{
continue;
}
$xs = $this->apiyy->_cxxsdd($vv['0']);
$chd = $this->apiyy->_cxchd($vv['0']);
if(isset($xs['Data'][0]))
{
$vv[] = '成功';
$x = 1;
}
else
{
$vv[] = '无';
}
if(isset($chd['Data'][0]))
{
$vv[] = '成功';
$c = 1;
}
else
{
$vv[] = '无';
}
if($x==1 && $c==1)
{
$this->$v->save(array('dbapi'=>99),$vv[4]);
}
$asd[] = $vv;
}
}
echo "";
print_r($cw);
echo "";
print_r($asd);
}
else
{
echo json_encode(array('msg'=>'上传失败!','t'=>$this->upload->display_errors(),'success'=>false));exit;
}
}
}