lvhao 4 hónapja
szülő
commit
e445f21192
2 módosított fájl, 2749 hozzáadás és 310 törlés
  1. 174 310
      core/CoreApp/controllers/Systemprint.php
  2. 2575 0
      core/CoreApp/controllers/Systemprintbak.php

+ 174 - 310
core/CoreApp/controllers/Systemprint.php

@@ -361,6 +361,7 @@ class Systemprint extends Start_Controller {
 			    else
 			    {
 				    $where  .= " and express != 0 and printtype != 3 and printtype > 0 and print = 2 and review > 4 and library = 1 and reviewtime > '".(time() - 30*24*3600)."'";
+					//$where  .= " and express != 0 and printtype != 3 and printtype > 0 and print = 2 and review > 4 and library = 1  ";
 			    }
 			if($shop)
             {
@@ -455,321 +456,84 @@ class Systemprint extends Start_Controller {
 		    {
                 $start = ($page - 1)*$perpage;
             }
-			$info_list = array();
-			$info_listtt = array();
-			$info_listxw = array();
-			$info_listsmt = array();
-			$dlz = 0; $smt = 0;  $tt = 0; $xw = 0;
-			
-            //取得信息列表
-            $info_list = $this->fullorder->find_all($where,'id,shop,orderinfo,number,express,waybill,print,printtype,printnumber,printtime,shipremarks',$order_str,$start,$perpage);
-			 //格式化数据
-            foreach ($info_list as $key=>$value) 
-		    {
-				
-				$info_list[$key]['id'] = $value['id'].'-fullorder';
-				$shop = $this->shop->read($value['shop']);
-				$info_list[$key]['shop'] = $shop['shopname'];
-				$express = $this->express->read($value['express']);
-				if($express)
-				{
-				    $info_list[$key]['express'] = $express['servicename'];
-				}
-				else
-				{
-					$info_list[$key]['express'] = '未选择';
-				}
-				if($value['printtime'] != 0)
-				{
-				    $info_list[$key]['printtime'] = date('Y-m-d H:i',$value['printtime']);
-				}
-				else
-				{
-					$info_list[$key]['printtime'] = '无';
-				}
-				if($value['print'] == 1)
-				{
-					$info_list[$key]['print'] = "禁止打印";
-				}
-				else if($value['print'] == 2)
-				{
-					$info_list[$key]['print'] = "未打印";
-				}
-				else if($value['print'] == 3)
-				{
-					$info_list[$key]['print'] = "已打印";
-				}
-				if($value['printtype'] == 1)
-				{
-					$info_list[$key]['printtype'] = "运单";
-				}
-				else if($value['printtype'] == 2)
-				{
-					$info_list[$key]['printtype'] = "发货单";
-				}
-				else if($value['printtype'] == 0)
-				{
-					$info_list[$key]['printtype'] = "未选择";
-				}
-				$info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
-            }
-			    $dlz = $this->fullorder->find_count($where);
-			
-			
-            //取得信息列表
-            $info_listtt = $this->fullordertt->find_all($where,'id,shop,orderinfo,number,express,waybill,print,printtype,printnumber,printtime,shipremarks',$order_str,$start,$perpage);
-			 //格式化数据
-            foreach ($info_listtt as $key=>$value) 
-		    {
-				
-				$info_listtt[$key]['id'] = $value['id'].'-fullordertt';
-				$shop = $this->shop->read($value['shop']);
-				$info_listtt[$key]['shop'] = $shop['shopname'];
-				$express = $this->express->read($value['express']);
-				if($express)
-				{
-				    $info_listtt[$key]['express'] = $express['servicename'];
-				}
-				else
-				{
-					$info_listtt[$key]['express'] = '未选择';
-				}
-				if($value['printtime'] != 0)
-				{
-				    $info_listtt[$key]['printtime'] = date('Y-m-d H:i',$value['printtime']);
-				}
-				else
-				{
-					$info_listtt[$key]['printtime'] = '无';
-				}
-				if($value['print'] == 1)
-				{
-					$info_listtt[$key]['print'] = "禁止打印";
-				}
-				else if($value['print'] == 2)
-				{
-					$info_listtt[$key]['print'] = "未打印";
-				}
-				else if($value['print'] == 3)
-				{
-					$info_listtt[$key]['print'] = "已打印";
-				}
-				if($value['printtype'] == 1)
-				{
-					$info_listtt[$key]['printtype'] = "运单";
-				}
-				else if($value['printtype'] == 2)
-				{
-					$info_listtt[$key]['printtype'] = "发货单";
-				}
-				else if($value['printtype'] == 0)
-				{
-					$info_listtt[$key]['printtype'] = "未选择";
-				}
-				$info_listtt[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
-            }
-			    $tt = $this->fullordertt->find_count($where);
-			    
-			    
-			    
-//取得信息列表
-            $info_listamz = $this->fullorderamz->find_all($where,'id,shop,orderinfo,number,express,waybill,print,printtype,printnumber,printtime,shipremarks',$order_str,$start,$perpage);
-			 //格式化数据
-            foreach ($info_listamz as $key=>$value) 
-		    {
-				
-				$info_listamz[$key]['id'] = $value['id'].'-fullorderamz';
-				$shop = $this->shop->read($value['shop']);
-				$info_listamz[$key]['shop'] = $shop['shopname'];
-				$express = $this->express->read($value['express']);
-				if($express)
-				{
-				    $info_listamz[$key]['express'] = $express['servicename'];
-				}
-				else
-				{
-					$info_listamz[$key]['express'] = '未选择';
-				}
-				if($value['printtime'] != 0)
-				{
-				    $info_listamz[$key]['printtime'] = date('Y-m-d H:i',$value['printtime']);
-				}
-				else
-				{
-					$info_listamz[$key]['printtime'] = '无';
-				}
-				if($value['print'] == 1)
-				{
-					$info_listamz[$key]['print'] = "禁止打印";
-				}
-				else if($value['print'] == 2)
-				{
-					$info_listamz[$key]['print'] = "未打印";
-				}
-				else if($value['print'] == 3)
-				{
-					$info_listamz[$key]['print'] = "已打印";
-				}
-				if($value['printtype'] == 1)
-				{
-					$info_listamz[$key]['printtype'] = "运单";
-				}
-				else if($value['printtype'] == 2)
-				{
-					$info_listamz[$key]['printtype'] = "发货单";
-				}
-				else if($value['printtype'] == 0)
-				{
-					$info_listamz[$key]['printtype'] = "未选择";
-				}
-				$info_listamz[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
-            }
-			    $amz = $this->fullorderamz->find_count($where);			    
-			    
-			    
+			$info_list = $info_listtt = $info_listxw = $info_listsmt = $info_listamz =[];
+			$info_list_jj = $info_listtt_jj = $info_listxw_jj = $info_listsmt_jj = $info_listamz_jj =[];
+		
+			$dlz = 0; $smt = 0;  $tt = 0; $xw = 0;$amz = 0;
+			$dlz_jj = 0;$smt_jj=0;$tt_jj=0;$xw_jj=0;$amz_jj=0;
 
+			$field = 'id,shop,orderinfo,number,express,waybill,print,printtype,printnumber,printtime,shipremarks,is_jiaji';
+
+			$where_jiaji = $where." and is_jiaji = 1 ";
+
+			$dlz_ret_jj = $this->indexData('fullorder',$start,$perpage,$where_jiaji,$field,$order_str);
 			
-			
-			 //取得信息列表
-            $info_listxw = $this->fullorderxw->find_all($where,'id,shop,orderinfo,number,express,waybill,print,printtype,printnumber,printtime,shipremarks',$order_str,$start,$perpage);
-			 //格式化数据
-            foreach ($info_listxw as $key=>$value) 
-		    {
-				
-				$info_listxw[$key]['id'] = $value['id'].'-fullorderxw';
-				$shop = $this->shop->read($value['shop']);
-				$info_listxw[$key]['shop'] = $shop['shopname'];
-				$express = $this->express->read($value['express']);
-				if($express)
-				{
-				    $info_listxw[$key]['express'] = $express['servicename'];
-				}
-				else
-				{
-					$info_listxw[$key]['express'] = '未选择';
-				}
-				if($value['printtime'] != 0)
-				{
-				    $info_listxw[$key]['printtime'] = date('Y-m-d H:i',$value['printtime']);
-				}
-				else
-				{
-					$info_listxw[$key]['printtime'] = '无';
-				}
-				if($value['print'] == 1)
-				{
-					$info_listxw[$key]['print'] = "禁止打印";
-				}
-				else if($value['print'] == 2)
-				{
-					$info_listxw[$key]['print'] = "未打印";
-				}
-				else if($value['print'] == 3)
-				{
-					$info_listxw[$key]['print'] = "已打印";
-				}
-				if($value['printtype'] == 1)
-				{
-					$info_listxw[$key]['printtype'] = "运单";
-				}
-				else if($value['printtype'] == 2)
-				{
-					$info_listxw[$key]['printtype'] = "发货单";
-				}
-				else if($value['printtype'] == 0)
-				{
-					$info_listxw[$key]['printtype'] = "未选择";
-				}
-				$info_listxw[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
-            }
-			    $xw = $this->fullorderxw->find_count($where);
-			
-			
-			$info_listsmt = $this->fullordersmt->find_all($where." and mergeid != '1'",'id,shop,orderinfo,number,express,waybill,print,printtype,printnumber,printtime,shipremarks',$order_str,$start,$perpage);
-			 //格式化数据
-            foreach ($info_listsmt as $key=>$value) 
-		    {
-				
-				$info_listsmt[$key]['id'] = $value['id'].'-fullordersmt';
-				$shop = $this->shop->read($value['shop']);
-				$info_listsmt[$key]['shop'] = $shop['shopname'];
-				$express = $this->express->read($value['express']);
-				if($express)
-				{
-				    $info_listsmt[$key]['express'] = $express['servicename'];
-				}
-				else
-				{
-					$info_listsmt[$key]['express'] = '未选择';
-				}
-				if($value['printtime'] != 0)
-				{
-				    $info_listsmt[$key]['printtime'] = date('Y-m-d H:i',$value['printtime']);
-				}
-				else
-				{
-					$info_listsmt[$key]['printtime'] = '无';
-				}
-				if($value['print'] == 1)
-				{
-					$info_listsmt[$key]['print'] = "禁止打印";
-				}
-				else if($value['print'] == 2)
-				{
-					$info_listsmt[$key]['print'] = "未打印";
-				}
-				else if($value['print'] == 3)
-				{
-					$info_listsmt[$key]['print'] = "已打印";
-				}
-				if($value['printtype'] == 1)
-				{
-					$info_listsmt[$key]['printtype'] = "运单";
-				}
-				else if($value['printtype'] == 2)
-				{
-					$info_listsmt[$key]['printtype'] = "发货单";
-				}
-				else if($value['printtype'] == 0)
-				{
-					$info_listsmt[$key]['printtype'] = "未选择";
-				}
-				$info_listsmt[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
-            }
-			    $smt += $this->fullordersmt->find_count($where);
-			
-			//$total += $this->fullorder_smt->find_count($where);
-			$total = $dlz+$smt+$tt+$xw+$amz;
-			$rows = array_merge($info_list,$info_listamz,$info_listtt,$info_listxw,$info_listsmt);
-			//$rows = array_slice($rows,$start,$perpage);
-			
-			
-			foreach($rows as $k=>$v){
-				$rows[$k]['index'] = $v['shipremarks'].$v['id'];
-			}
-			$tmp_rows = array_column($rows,null,'index');
-			
-			ksort($tmp_rows);
-			$tmp_rows = array_values($tmp_rows);
-			foreach($tmp_rows as $k=>$v){
-			    
-				unset($tmp_rows[$k]['index']);
+			$info_list_jj = $dlz_ret_jj['list'];
+			$dlz_jj = $dlz_ret_jj['total'];
+
+			$tt_ret_jj = $this->indexData('fullordertt',$start,$perpage,$where_jiaji,$field,$order_str);
+			$info_listtt_jj = $tt_ret_jj['list'];
+			$tt_jj = $tt_ret_jj['total'];
+
+			$amz_ret_jj = $this->indexData('fullorderamz',$start,$perpage,$where_jiaji,$field,$order_str);
+			$info_listamz_jj = $amz_ret_jj['list'];
+			$amz_jj = $amz_ret_jj['total'];
+
+			$smt_ret_jj = $this->indexData('fullordersmt',$start,$perpage,$where_jiaji,$field,$order_str);
+			$info_listsmt_jj = $smt_ret_jj['list'];
+			$smt_jj = $smt_ret_jj['total'];
+
+			$xw_ret_jj = $this->indexData('fullorderxw',$start,$perpage,$where_jiaji,$field,$order_str);
+			$info_listxw_jj = $xw_ret_jj['list'];
+			$xw_jj = $xw_ret_jj['total'];
+
+			/****************************执行非加急的************************************/ 
+
+			$where_nojj = $where." and is_jiaji = 0 ";
+
+			$dlz_ret = $this->indexData('fullorder',$start,$perpage,$where_nojj,$field,$order_str);
+			$info_list = $dlz_ret['list'];
+			$dlz = $dlz_ret['total'];
+
+			$tt_ret = $this->indexData('fullordertt',$start,$perpage,$where_nojj,$field,$order_str);
+			$info_listtt = $tt_ret['list'];
+			$tt = $tt_ret['total'];
+
+			$amz_ret = $this->indexData('fullorderamz',$start,$perpage,$where_nojj,$field,$order_str);
+			$info_listamz = $amz_ret['list'];
+			$amz = $amz_ret['total'];
+
+			$smt_ret = $this->indexData('fullordersmt',$start,$perpage,$where_nojj,$field,$order_str);
+			$info_listsmt = $smt_ret['list'];
+			$smt = $smt_ret['total'];
+
+			$xw_ret = $this->indexData('fullorderxw',$start,$perpage,$where_nojj,$field,$order_str);
+			$info_listxw = $xw_ret['list'];
+			$xw = $xw_ret['total'];
+           
+			$total = $dlz+$tt+$amz+$smt+$xw+$dlz_jj+$tt_jj+$amz_jj+$smt_jj+$xw_jj;
+
+			$pagenum = ceil($total/$perpage);
+		    $over = $total-($start+$perpage);
+			if($print == 3){
+				// $rows_jj = $this->indexSort($info_list_jj,$info_listamz_jj,$info_listtt_jj,$info_listxw_jj,$info_listsmt_jj,$print);
+
+				// $rows_no = $this->indexSort($info_list,$info_listamz,$info_listtt,$info_listxw,$info_listsmt,$print);
+				$tmp_all_rows =  array_merge($info_list_jj,$info_listamz_jj,$info_listsmt_jj,$info_listtt_jj,$info_listxw_jj,$info_list,$info_listamz,$info_listsmt,$info_listtt,$info_listxw);
+
+				$rows = $this->indexSort($tmp_all_rows,$print);
+			}else{
+				$tmp_jj_row =  array_merge($info_list_jj,$info_listamz_jj,$info_listtt_jj,$info_listxw_jj,$info_listsmt_jj);
+				$rows_jj = $this->indexSort($tmp_jj_row,$print);
+				$tmp_no_row = array_merge($info_list,$info_listamz,$info_listtt,$info_listxw,$info_listsmt);
+				$rows_no = $this->indexSort($tmp_no_row,$print);
+	
+				$rows = array_merge($rows_jj,$rows_no);
 			}
 			
-			$rows = $tmp_rows;
 			
-		    $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)
+
+			$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']))
@@ -781,6 +545,106 @@ class Systemprint extends Start_Controller {
 		}
 		$this->_Template('systemprint',$this->data);
 	}
+	/**
+	 * $table_name  订单表名
+	 * $start 		偏移开始坐标
+	 * $limit   	偏移量
+	 * $where  		条件
+	 * $field		字段
+	 * $order_str   排序
+	 */
+	protected function indexData($table_name,$start,$limit,$where,$filed,$order_str){	
+		$info_list = $this->$table_name->find_all($where,$filed,$order_str,$start,$limit);
+		
+		if(empty($info_list)){
+			$info_list = [];
+		}
+		 //格式化数据
+		 foreach ($info_list as $key=>$value) 
+		 {
+			 $info_list[$key]['id'] = $value['id'].'-'.$table_name;
+			 $shop = $this->shop->read($value['shop']);
+			 $info_list[$key]['shop'] = $shop['shopname'];
+			 $express = $this->express->read($value['express']);
+			 if($express)
+			 {
+				 $info_list[$key]['express'] = $express['servicename'];
+			 }
+			 else
+			 {
+				 $info_list[$key]['express'] = '未选择';
+			 }
+			 if($value['printtime'] != 0)
+			 {
+				 $info_list[$key]['printtime'] = date('Y-m-d H:i',$value['printtime']);
+			 }
+			 else
+			 {
+				 $info_list[$key]['printtime'] = '无';
+			 }
+			 if($value['print'] == 1)
+			 {
+				 $info_list[$key]['print'] = "禁止打印";
+			 }
+			 else if($value['print'] == 2)
+			 {
+				 $info_list[$key]['print'] = "未打印";
+			 }
+			 else if($value['print'] == 3)
+			 {
+				 $info_list[$key]['print'] = "已打印";
+			 }
+			 if($value['printtype'] == 1)
+			 {
+				 $info_list[$key]['printtype'] = "运单";
+			 }
+			 else if($value['printtype'] == 2)
+			 {
+				 $info_list[$key]['printtype'] = "发货单";
+			 }
+			 else if($value['printtype'] == 0)
+			 {
+				 $info_list[$key]['printtype'] = "未选择";
+			 }
+			 if($value['is_jiaji'] == 1){
+				$info_list[$key]['number'] = "<c style='color:red'>".$value['number']."</c>";
+			 }
+			 unset($info_list[$key]['is_jiaji']);
+			 $info_list[$key]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
+		 }
+		$total = $this->$table_name->find_count($where);
+		return [
+			'list'=>$info_list,
+			'total'=>$total,
+		];
+	}
+	//订单表排序
+	protected function indexSort($rows,$print){
+		foreach($rows as $k=>$v){
+			$rows[$k]['index'] = $v['shipremarks'].$v['id'];
+		}
+		$tmp_rows = array_column($rows,null,'index');
+		
+		ksort($tmp_rows);
+		$tmp_rows = array_values($tmp_rows);
+		foreach($tmp_rows as $k=>$v){
+			
+			unset($tmp_rows[$k]['index']);
+		}
+		
+		$rows = $tmp_rows;
+		
+		$tmp = array();
+		if($print == 3)
+		{
+			foreach ($rows as $key => $val)
+			{
+				$tmp[$key] = $val['printtime'];
+			}
+			array_multisort($tmp,SORT_DESC,$rows);
+		}
+		return $rows;
+	}
 	//打印
 	public function _printing()
 	{

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 2575 - 0
core/CoreApp/controllers/Systemprintbak.php