|
|
@@ -47,6 +47,9 @@ class Systembound extends Start_Controller {
|
|
|
}else if($arg == 'zxdpdexcel'){
|
|
|
$this->_zxdpdexcel();
|
|
|
}
|
|
|
+ else if($arg == 'dcall'){
|
|
|
+ $this->_dcall();
|
|
|
+ }
|
|
|
else
|
|
|
{
|
|
|
$this->_index();
|
|
|
@@ -1172,4 +1175,130 @@ class Systembound extends Start_Controller {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public function _dcall(){
|
|
|
+ if(isset($_GET['fexcel']))
|
|
|
+ {
|
|
|
+ $timetk = $this->input->get('timetk',true);
|
|
|
+ $timetj = $this->input->get('timetj',true);
|
|
|
+ $library = $this->input->get('library',true);
|
|
|
+ $type = $this->input->get('type',true);
|
|
|
+ $number = $this->input->get('number',true);
|
|
|
+ $waybill = $this->input->get('waybill',true);
|
|
|
+ $timetk = strtotime($timetk);
|
|
|
+ $timetj = strtotime($timetj);
|
|
|
+
|
|
|
+ $typename = "订单计数";
|
|
|
+ // $cx_arr = [78,79];
|
|
|
+
|
|
|
+ // $ex_list = $this->express->find_all("id in (".implode(',',$cx_arr).")","id,servicename");
|
|
|
+
|
|
|
+ // $where = "type != 0 and express in (".implode(',',$cx_arr).")";
|
|
|
+ $where = " type != 0 ";
|
|
|
+
|
|
|
+ if($timetk && $timetj)
|
|
|
+ {
|
|
|
+ $where .= " and time > '$timetk' and time < '$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($number)
|
|
|
+ {
|
|
|
+ $where .= " and number = '$number'";
|
|
|
+ }
|
|
|
+ if($waybill)
|
|
|
+ {
|
|
|
+ $where .= " and waybill = '$waybill'";
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = array();
|
|
|
+ $datafy = array();
|
|
|
+ $j = 0;
|
|
|
+ $info_list = $this->outbound->find_all($where,'number,waybill,express','time asc');
|
|
|
+
|
|
|
+ $express_ids = array_unique(array_column($info_list,'express'));
|
|
|
+ $express_ids = array_values($express_ids);
|
|
|
+
|
|
|
+
|
|
|
+ $ex_list = $this->express->find_all("id in (".implode(',',$express_ids).")","id,servicename",'id asc');
|
|
|
+
|
|
|
+ $final_list= [
|
|
|
+
|
|
|
+ ];
|
|
|
+ foreach($ex_list as $v){
|
|
|
+ $final_list[$v['id']] = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($info_list as $key=>$value)
|
|
|
+ {
|
|
|
+ if(isset($final_list[$value['express']])){
|
|
|
+ $orderinfo = $this->logic_order->getInfo('number = "'.$value['number'].'"');
|
|
|
+ $weight = 0;
|
|
|
+ if(!empty($orderinfo)){
|
|
|
+ $weight = $orderinfo['weight'];
|
|
|
+ }
|
|
|
+ $weight = str_replace('kgkg','kg',$weight);
|
|
|
+ $final_list[$value['express']][] = [
|
|
|
+ $value['number'],
|
|
|
+ $value['waybill'],
|
|
|
+ $weight
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ $data[] = $datafy;
|
|
|
+ //格式化数据
|
|
|
+ $i = 0;$cpexcel = array();
|
|
|
+
|
|
|
+ $title = date('Ymd',time()).$typename."发货统计信息"; $td = '';
|
|
|
+ $td = "";
|
|
|
+ $count = 0;
|
|
|
+ foreach($ex_list as $v){
|
|
|
+ $num = count($final_list[$v['id']]);
|
|
|
+ if($num > $count){
|
|
|
+ $count = $num;
|
|
|
+ }
|
|
|
+ $td .= "<td>".$v['servicename']."</td><td>总数(".$num.")</td><td>重量</td>";
|
|
|
+ }
|
|
|
+ foreach($final_list as $k=>$v){
|
|
|
+ for($i=0;$i < $count ;$i++){
|
|
|
+ if(!isset($final_list[$k][$i])){
|
|
|
+ $final_list[$k][$i] = [
|
|
|
+ " "," ",""
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $titlename = "<table border=1>
|
|
|
+ <tr>
|
|
|
+ ".$td."
|
|
|
+ </tr>
|
|
|
+ </table>";
|
|
|
+ $filename = $title.".xls";
|
|
|
+ $this->excel->get_fz7($final_list,$titlename,$filename);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|