| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php defined('BASEPATH') or exit('No direct script access allowed');
- /**
- * 临时表获取统计
- * erp生成临时表的统计功能
- */
- class Zshitj extends Start_Controller
- {
- public function __construct()
- {
- parent::__construct();
- }
- //定义方法的调用规则 获取URI第二段值
- public function _remap($arg, $arg_array)
- {
- if ($arg == 'xcdyld') //
- {
- //获取标签出库的按条件导出的excel
- $this->_xcdyld($arg_array);
- }
- else {
- $this->_index();
- }
- }
- private function _index(){
- echo "!!!!!!!!!!!!";
- }
- /**
- * 许昌仓打印超过24小时的漏单
- */
- private function _xcdyld($arg_array){
-
- if(isset($_SESSION['api']))
- {
- $user = $this->user->get_api($_SESSION['api']);
-
- $owner_shop = explode('|',trim($user['shop'],'|'));
-
-
- }
- if($this->input->method() == 'post'){
- $params = $this->input->post(NULL,true);
- $time =time() - 24 * 60 * 60;
- $start_time = time() - 5 * 24 * 60 * 60 ;
- $table_name = $params['table_name'];
- $waybill = $this->input->post('waybill',true);
- $number = $this->input->post('number',true);
- $orderinfo = $this->input->post('orderinfo',true);
- $shop = $this->input->post('shop',true);
- $page = $this->input->post('page',true);
- $perpage = $this->input->post('perpage',true);
- $this->db->select("f.state,f.shop,f.dtime,f.number,f.printtime,f.print,f.library,f.type");
- $this->db->from($table_name . " as f");
-
- if($waybill){
- $this->db->where('f.waybill',$waybill);
- }
- if($number){
- $this->db->where('f.number',$number);
- }
- if($orderinfo){
- $this->db->where('f.orderinfo',$orderinfo);
- }
- if($shop){
- $this->db->where('f.shop',$shop);
- }else{
- if(!empty($owner_shop)){
- $this->db->where_in('f.shop',$owner_shop);
- }
- }
- $this->db->where(' f.type','13');
- $this->db->where(' f.state','207');
- $this->db->where(' f.print','3');
- $this->db->where(' f.printtime >= ', $start_time );
- $this->db->where(' f.printtime < ', $time );
- $this->db->where(' f.library','1');
- $this->db->where(" NOT EXISTS ( SELECT 1 FROM crowd_systemtransfer as s where s.number = f.number )", null, false);
- $this->db->order_by('f.printtime','desc');
- $list = $this->db->get()->result_array();
- if(empty($list)){
- $rows = array('total'=>0,'over'=>0,'pagenum'=>$page,'rows'=>([]));
- }else{
- $total = count($list);
- $split_arr = array_chunk($list,$perpage);
- $split_total = count($split_arr);
- $over = $split_total - $page;
- $r_list = $split_arr[$page-1];
-
- $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$page,'rows'=>($r_list));
- }
-
- echo json_encode($rows);exit;
- }else{
- $table_name = $arg_array[0];
- $this->data['table_name'] = $table_name;
- $this->_Template('zshitj_xcdyld', $this->data);
- }
- }
- }
|