Browse Source

测试信息

lvhao 1 day ago
parent
commit
a00c5883dd
1 changed files with 305 additions and 236 deletions
  1. 305 236
      core/CoreApp/controllers/Systemfout.php

+ 305 - 236
core/CoreApp/controllers/Systemfout.php

@@ -3259,255 +3259,324 @@ class Systemfout extends Start_Controller {
                 $start = ($page - 1)*$perpage;
             }
             //取得信息列表
-            $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str,$start,$perpage);
+            $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str);
 			 //格式化数据
-            foreach ($info_list as $key=>$value)
-		    {
-				$shop = $this->shop->read($value['shop']);
-				$info_list[$key]['shop'] = $shop['shopname'];
-				if($value['waybill'] == '0')
-				{
-					$info_list[$key]['waybill'] = "";
-				}
-				$express = $this->express->read($value['express']);
-				$info_list[$key]['express'] = $express['servicename'];
-				$warehouse = $this->warehouse->read($value['type']);
-				$info_list[$key]['type'] = $warehouse['title'];
-				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['library'] == 1)
-				{
-					$info_list[$key]['library'] = '<em class="c">未出库</em>';
-				}
-				else if($value['library'] == 2)
-				{
-					$info_list[$key]['library'] = '<em class="c">已出库</em>';
-				}
-				else if($value['library'] == 3)
-				{
-					$info_list[$key]['library'] = '<em class="c">已退库</em>';
-				}
-				if($value['librarytime'] == '0')
-				{
-					$info_list[$key]['librarytime'] = '<em class="t"></em>';
-				}
-				else
-				{
-					$info_list[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i',$value['librarytime']).'</em>';
-				}
-				$info_list[$key]['orderremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['orderremarks']);
-            }
-			$info_listtt = $this->fullordertt->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str,$start,$perpage);
+            // foreach ($info_list as $key=>$value)
+		    // {
+			// 	$shop = $this->shop->read($value['shop']);
+			// 	$info_list[$key]['shop'] = $shop['shopname'];
+			// 	if($value['waybill'] == '0')
+			// 	{
+			// 		$info_list[$key]['waybill'] = "";
+			// 	}
+			// 	$express = $this->express->read($value['express']);
+			// 	$info_list[$key]['express'] = $express['servicename'];
+			// 	$warehouse = $this->warehouse->read($value['type']);
+			// 	$info_list[$key]['type'] = $warehouse['title'];
+			// 	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['library'] == 1)
+			// 	{
+			// 		$info_list[$key]['library'] = '<em class="c">未出库</em>';
+			// 	}
+			// 	else if($value['library'] == 2)
+			// 	{
+			// 		$info_list[$key]['library'] = '<em class="c">已出库</em>';
+			// 	}
+			// 	else if($value['library'] == 3)
+			// 	{
+			// 		$info_list[$key]['library'] = '<em class="c">已退库</em>';
+			// 	}
+			// 	if($value['librarytime'] == '0')
+			// 	{
+			// 		$info_list[$key]['librarytime'] = '<em class="t"></em>';
+			// 	}
+			// 	else
+			// 	{
+			// 		$info_list[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i',$value['librarytime']).'</em>';
+			// 	}
+			// 	$info_list[$key]['orderremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['orderremarks']);
+            // }
+			$info_listtt = $this->fullordertt->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str);
 			 //格式化数据
-            foreach ($info_listtt as $key=>$value) 
-		    {
-				$shop = $this->shop->read($value['shop']);
-				$info_listtt[$key]['shop'] = $shop['shopname'];
-				if($value['waybill'] == '0')
-				{
-					$info_listtt[$key]['waybill'] = "";
-				}
-				$express = $this->express->read($value['express']);
-				$info_listtt[$key]['express'] = $express['servicename'];
-				$warehouse = $this->warehouse->read($value['type']);
-				$info_listtt[$key]['type'] = $warehouse['title'];
-				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['library'] == 1)
-				{
-					$info_listtt[$key]['library'] = '<em class="c">未出库</em>';
-				}
-				else if($value['library'] == 2)
-				{
-					$info_listtt[$key]['library'] = '<em class="c">已出库</em>';
-				}
-				else if($value['library'] == 3)
-				{
-					$info_listtt[$key]['library'] = '<em class="c">已退库</em>';
-				}
-				if($value['librarytime'] == '0')
-				{
-					$info_listtt[$key]['librarytime'] = '<em class="t"></em>';
-				}
-				else
-				{
-					$info_listtt[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
-				}
-            }
+            // foreach ($info_listtt as $key=>$value) 
+		    // {
+			// 	$shop = $this->shop->read($value['shop']);
+			// 	$info_listtt[$key]['shop'] = $shop['shopname'];
+			// 	if($value['waybill'] == '0')
+			// 	{
+			// 		$info_listtt[$key]['waybill'] = "";
+			// 	}
+			// 	$express = $this->express->read($value['express']);
+			// 	$info_listtt[$key]['express'] = $express['servicename'];
+			// 	$warehouse = $this->warehouse->read($value['type']);
+			// 	$info_listtt[$key]['type'] = $warehouse['title'];
+			// 	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['library'] == 1)
+			// 	{
+			// 		$info_listtt[$key]['library'] = '<em class="c">未出库</em>';
+			// 	}
+			// 	else if($value['library'] == 2)
+			// 	{
+			// 		$info_listtt[$key]['library'] = '<em class="c">已出库</em>';
+			// 	}
+			// 	else if($value['library'] == 3)
+			// 	{
+			// 		$info_listtt[$key]['library'] = '<em class="c">已退库</em>';
+			// 	}
+			// 	if($value['librarytime'] == '0')
+			// 	{
+			// 		$info_listtt[$key]['librarytime'] = '<em class="t"></em>';
+			// 	}
+			// 	else
+			// 	{
+			// 		$info_listtt[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
+			// 	}
+            // }
             
             
-            $info_listamz = $this->fullorderamz->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str,$start,$perpage);
+            $info_listamz = $this->fullorderamz->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str);
 			 //格式化数据
-            foreach ($info_listamz as $key=>$value) 
-		    {
-				$shop = $this->shop->read($value['shop']);
-				$info_listamz[$key]['shop'] = $shop['shopname'];
-				if($value['waybill'] == '0')
-				{
-					$info_listamz[$key]['waybill'] = "";
-				}
-				$express = $this->express->read($value['express']);
-				$info_listamz[$key]['express'] = $express['servicename'];
-				$warehouse = $this->warehouse->read($value['type']);
-				$info_listamz[$key]['type'] = $warehouse['title'];
-				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['library'] == 1)
-				{
-					$info_listamz[$key]['library'] = '<em class="c">未出库</em>';
-				}
-				else if($value['library'] == 2)
-				{
-					$info_listamz[$key]['library'] = '<em class="c">已出库</em>';
-				}
-				else if($value['library'] == 3)
-				{
-					$info_listamz[$key]['library'] = '<em class="c">已退库</em>';
-				}
-				if($value['librarytime'] == '0')
-				{
-					$info_listamz[$key]['librarytime'] = '<em class="t"></em>';
-				}
-				else
-				{
-					$info_listamz[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
-				}
-            }
+            // foreach ($info_listamz as $key=>$value) 
+		    // {
+			// 	$shop = $this->shop->read($value['shop']);
+			// 	$info_listamz[$key]['shop'] = $shop['shopname'];
+			// 	if($value['waybill'] == '0')
+			// 	{
+			// 		$info_listamz[$key]['waybill'] = "";
+			// 	}
+			// 	$express = $this->express->read($value['express']);
+			// 	$info_listamz[$key]['express'] = $express['servicename'];
+			// 	$warehouse = $this->warehouse->read($value['type']);
+			// 	$info_listamz[$key]['type'] = $warehouse['title'];
+			// 	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['library'] == 1)
+			// 	{
+			// 		$info_listamz[$key]['library'] = '<em class="c">未出库</em>';
+			// 	}
+			// 	else if($value['library'] == 2)
+			// 	{
+			// 		$info_listamz[$key]['library'] = '<em class="c">已出库</em>';
+			// 	}
+			// 	else if($value['library'] == 3)
+			// 	{
+			// 		$info_listamz[$key]['library'] = '<em class="c">已退库</em>';
+			// 	}
+			// 	if($value['librarytime'] == '0')
+			// 	{
+			// 		$info_listamz[$key]['librarytime'] = '<em class="t"></em>';
+			// 	}
+			// 	else
+			// 	{
+			// 		$info_listamz[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
+			// 	}
+            // }
             
             
             
-			$info_listxw = $this->fullorderxw->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str,$start,$perpage);
+			$info_listxw = $this->fullorderxw->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str);
 			 //格式化数据
-            foreach ($info_listxw as $key=>$value) 
-		    {
-				$shop = $this->shop->read($value['shop']);
-				$info_listxw[$key]['shop'] = $shop['shopname'];
-				if($value['waybill'] == '0')
-				{
-					$info_listxw[$key]['waybill'] = "";
-				}
-				$express = $this->express->read($value['express']);
-				$info_listxw[$key]['express'] = $express['servicename'];
-				$warehouse = $this->warehouse->read($value['type']);
-				$info_listxw[$key]['type'] = $warehouse['title'];
-				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['library'] == 1)
-				{
-					$info_listxw[$key]['library'] = '<em class="c">未出库</em>';
-				}
-				else if($value['library'] == 2)
-				{
-					$info_listxw[$key]['library'] = '<em class="c">已出库</em>';
-				}
-				else if($value['library'] == 3)
-				{
-					$info_listxw[$key]['library'] = '<em class="c">已退库</em>';
-				}
-				if($value['librarytime'] == '0')
-				{
-					$info_listxw[$key]['librarytime'] = '<em class="t"></em>';
-				}
-				else
-				{
-					$info_listxw[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
-				}
-            }
-			$info_listsmt = $this->fullordersmt->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str,$start,$perpage);
+            // foreach ($info_listxw as $key=>$value) 
+		    // {
+			// 	$shop = $this->shop->read($value['shop']);
+			// 	$info_listxw[$key]['shop'] = $shop['shopname'];
+			// 	if($value['waybill'] == '0')
+			// 	{
+			// 		$info_listxw[$key]['waybill'] = "";
+			// 	}
+			// 	$express = $this->express->read($value['express']);
+			// 	$info_listxw[$key]['express'] = $express['servicename'];
+			// 	$warehouse = $this->warehouse->read($value['type']);
+			// 	$info_listxw[$key]['type'] = $warehouse['title'];
+			// 	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['library'] == 1)
+			// 	{
+			// 		$info_listxw[$key]['library'] = '<em class="c">未出库</em>';
+			// 	}
+			// 	else if($value['library'] == 2)
+			// 	{
+			// 		$info_listxw[$key]['library'] = '<em class="c">已出库</em>';
+			// 	}
+			// 	else if($value['library'] == 3)
+			// 	{
+			// 		$info_listxw[$key]['library'] = '<em class="c">已退库</em>';
+			// 	}
+			// 	if($value['librarytime'] == '0')
+			// 	{
+			// 		$info_listxw[$key]['librarytime'] = '<em class="t"></em>';
+			// 	}
+			// 	else
+			// 	{
+			// 		$info_listxw[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
+			// 	}
+            // }
+			$info_listsmt = $this->fullordersmt->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,orderremarks',$order_str);
 			 //格式化数据
-            foreach ($info_listsmt as $key=>$value) 
-		    {
-				$shop = $this->shop->read($value['shop']);
-				$info_listsmt[$key]['shop'] = $shop['shopname'];
-				if($value['waybill'] == '0')
-				{
-					$info_listsmt[$key]['waybill'] = "";
-				}
-				$express = $this->express->read($value['express']);
-				$info_listsmt[$key]['express'] = $express['servicename'];
-				$warehouse = $this->warehouse->read($value['type']);
-				$info_listsmt[$key]['type'] = $warehouse['title'];
-				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['library'] == 1)
-				{
-					$info_listsmt[$key]['library'] = '<em class="c">未出库</em>';
-				}
-				else if($value['library'] == 2)
-				{
-					$info_listsmt[$key]['library'] = '<em class="c">已出库</em>';
-				}
-				else if($value['library'] == 3)
-				{
-					$info_listsmt[$key]['library'] = '<em class="c">已退库</em>';
-				}
-				if($value['librarytime'] == '0')
-				{
-					$info_listsmt[$key]['librarytime'] = '<em class="t"></em>';
-				}
-				else
-				{
-					$info_listsmt[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
+            // foreach ($info_listsmt as $key=>$value) 
+		    // {
+			// 	$shop = $this->shop->read($value['shop']);
+			// 	$info_listsmt[$key]['shop'] = $shop['shopname'];
+			// 	if($value['waybill'] == '0')
+			// 	{
+			// 		$info_listsmt[$key]['waybill'] = "";
+			// 	}
+			// 	$express = $this->express->read($value['express']);
+			// 	$info_listsmt[$key]['express'] = $express['servicename'];
+			// 	$warehouse = $this->warehouse->read($value['type']);
+			// 	$info_listsmt[$key]['type'] = $warehouse['title'];
+			// 	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['library'] == 1)
+			// 	{
+			// 		$info_listsmt[$key]['library'] = '<em class="c">未出库</em>';
+			// 	}
+			// 	else if($value['library'] == 2)
+			// 	{
+			// 		$info_listsmt[$key]['library'] = '<em class="c">已出库</em>';
+			// 	}
+			// 	else if($value['library'] == 3)
+			// 	{
+			// 		$info_listsmt[$key]['library'] = '<em class="c">已退库</em>';
+			// 	}
+			// 	if($value['librarytime'] == '0')
+			// 	{
+			// 		$info_listsmt[$key]['librarytime'] = '<em class="t"></em>';
+			// 	}
+			// 	else
+			// 	{
+			// 		$info_listsmt[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
+			// 	}
+            // }
+		    // $total = $this->fullorder->find_count($where);
+			// $total += $this->fullordertt->find_count($where);
+			// $total += $this->fullorderamz->find_count($where);
+			// $total += $this->fullorderxw->find_count($where);
+			// $total += $this->fullordersmt->find_count($where);
+			$total_list = array_merge($info_list,$info_listtt,$info_listamz,$info_listxw,$info_listsmt);
+			$sort_list = [];
+			foreach($total_list as $key => $value){
+				$tmp_librarytime = (int)($value['librarytime']."0000");
+				if(isset($sort_list[$tmp_librarytime])){
+					$tmp_librarytime =(int)($value['librarytime'].rand(1000,9999));
+					$sort_list[$tmp_librarytime] = $value;
+				}else{
+					$sort_list[$tmp_librarytime] = $value;
+				}
+			}
+			ksort($sort_list);
+			if(!empty($split_list)){
+				$split_list = array_chunk($sort_list, $perpage, true);
+				$shop_list = $this->shop->find_all('1=1');
+				$shop_arr = array_column($shop_list,'id','shopname');
+				$express_list = $this->express->find_all('1=1');
+				$express_arr = array_column($express_list,'id','servicename');
+				$warehouse_list = $this->warehouse->find_all('1=1');
+				$warehouse_arr = array_column($warehouse_list,'id','title');
+				$final_list = $split_list[$page-1];
+				foreach ($final_list as $key=>$value) 
+				{
+					$final_list[$key]['shop'] = isset($shop_arr[$value['shop']])? $shop_arr[$value['shop']] :"";
+					if($value['waybill'] == '0')
+					{
+						$final_list[$key]['waybill'] = "";
+					}
+					$final_list[$key]['express'] = isset($express_arr[$value['express']])? $express_arr[$value['express']] :"";    
+					$final_list[$key]['type'] = isset($warehouse_arr[$value['type']])? $warehouse_arr[$value['type']] :"";
+					if($value['print'] == 1)
+					{
+						$final_list[$key]['print'] = '不可打印';
+					}
+					else if($value['print'] == 2)
+					{
+						$final_list[$key]['print'] = '未打印';
+					}
+					else if($value['print'] == 3)
+					{
+						$final_list[$key]['print'] = '已打印';
+					}
+					if($value['library'] == 1)
+					{
+						$final_list[$key]['library'] = '<em class="c">未出库</em>';
+					}
+					else if($value['library'] == 2)
+					{
+						$final_list[$key]['library'] = '<em class="c">已出库</em>';
+					}
+					else if($value['library'] == 3)
+					{
+						$final_list[$key]['library'] = '<em class="c">已退库</em>';
+					}
+					if($value['librarytime'] == '0')
+					{
+						$final_list[$key]['librarytime'] = '<em class="t"></em>';
+					}
+					else
+					{
+						$final_list[$key]['librarytime'] = '<em class="t">'.date('Y-m-d H:i:s',$value['librarytime']).'</em>';
+					}
 				}
-            }
-		    $total = $this->fullorder->find_count($where);
-			$total += $this->fullordertt->find_count($where);
-			$total += $this->fullorderamz->find_count($where);
-			$total += $this->fullorderxw->find_count($where);
-			$total += $this->fullordersmt->find_count($where);
+
+			}else{
+				$final_list = [];
+			}
+			
+			$total = count($total_list);
 		    $pagenum = ceil($total/$perpage);
 		    $over = $total-($start+$perpage);
-		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>(array_merge($info_list,$info_listtt,$info_listamz,$info_listxw,$info_listsmt)));
+		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>($final_list));
 		    echo json_encode($rows);exit;
 		}
 		if(isset($_SESSION['api']))