lvhao 4 months ago
parent
commit
280ff00a51
2 changed files with 261 additions and 133 deletions
  1. 253 133
      core/CoreApp/controllers/Systemfout.php
  2. 8 0
      template/erp/systemfout.html

+ 253 - 133
core/CoreApp/controllers/Systemfout.php

@@ -132,9 +132,11 @@ class Systemfout extends Start_Controller {
 			$type = $this->input->post('type',true);
 			$lowe = $this->input->post('lowe',true);
 			$so = $this->input->post('so',true);
+			$is_jiaji = $this->input->post('is_jiaji',true);
 			$librarytime = $this->input->post('librarytime',true);
 			$timetk = strtotime($timetk);
 			$timetj = strtotime($timetj);
+
 			$cxtime = 'id';
 			$where = "library!=3 and libraryconfirm=2 and print = 3 and (".rtrim($wtype,'or').")";
 			if($timetk && $timetj && $library == 1)
@@ -185,6 +187,10 @@ class Systemfout extends Start_Controller {
             {
                 $where  .= " and shipremarks like '%$so%'";
             }
+			if($is_jiaji >-1){
+				$where .= " and is_jiaji = ".$is_jiaji." ";
+			}
+
             //数据排序
             $order_str = $cxtime." desc";
             if(empty($page))
@@ -196,72 +202,255 @@ class Systemfout extends Start_Controller {
 		    {
                 $start = ($page - 1)*$perpage;
             }
-           
-            $dlz_num = $tt_num = $amz_num = $smt_num = $xw_num = 0;
-			$dlz_arr = $tt_arr = $amz_arr = $smt_arr = $xw_arr = [];
-
-			$dlz_jj_num = $tt_jj_num = $amz_jj_num = $smt_jj_num = $xw_jj_num = 0;
-            $dlz_jj_arr = $tt_jj_arr = $amz_jj_arr = $smt_jj_arr = $xw_jj_arr = [];
-			
-		    $shop_list = $this->shop->find_all();
-			$shop_list = array_column($shop_list,null,'id');
-			$express_list = $this->express->find_all();
-			$express_list = array_column($express_list,null,'id');
-			$warehouse_list = $this->warehouse->find_all();
-			
-			$warehouse_list = array_column($warehouse_list,null,'id');
-	
-
-			$filed = "id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks,is_jiaji";
-
-			$where_jj = $where." and is_jiaji = 1 ";
-			$dlz_jj_ret =$this->indexData('fullorder',$start,$perpage,$where_jj,$filed,$order_str,$shop_list,$express_list,$warehouse_list);
-			$dlz_jj_num = $dlz_jj_ret['total'];
-			$dlz_jj_arr = $dlz_jj_ret['list'];
-
-			$tt_jj_ret = $this->indexData('fullordertt',$start,$perpage,$where_jj,$filed,$order_str,$shop_list,$express_list,$warehouse_list);
-			$tt_jj_num = $tt_jj_ret['total'];
-			$tt_jj_arr = $tt_jj_ret['list'];
-
-			$amz_jj_ret = $this->indexData('fullorderamz',$start,$perpage,$where_jj,$filed,$order_str,$shop_list,$express_list,$warehouse_list);
-			$amz_jj_num = $amz_jj_ret['total'];
-			$amz_jj_arr = $amz_jj_ret['list'];
-
-			$smt_jj_ret = $this->indexData('fullordersmt',$start,$perpage,$where_jj,$filed,$order_str,$shop_list,$express_list,$warehouse_list);
-			$smt_jj_num = $smt_jj_ret['total'];
-			$smt_jj_arr = $smt_jj_ret['list'];
-
-			/******************** 非加急 *************************/
-
-			$where_no_jj = $where." and is_jiaji = 0 ";
-			$dlz_no_ret =$this->indexData('fullorder',$start,$perpage,$where_no_jj,$filed,$order_str,$shop_list,$express_list,$warehouse_list);
-			$dlz_num = $dlz_no_ret['total'];
-			$dlz_arr = $dlz_no_ret['list'];
-
-			$tt_no_ret = $this->indexData('fullordertt',$start,$perpage,$where_no_jj,$filed,$order_str,$shop_list,$express_list,$warehouse_list);
-			$tt_num = $tt_no_ret['total'];
-			$tt_arr = $tt_no_ret['list'];
-
-			$amz_no_ret = $this->indexData('fullorderamz',$start,$perpage,$where_no_jj,$filed,$order_str,$shop_list,$express_list,$warehouse_list);
-			$amz_num = $amz_no_ret['total'];
-			$amz_arr = $amz_no_ret['list'];
-
-			$smt_no_ret = $this->indexData('fullordersmt',$start,$perpage,$where_no_jj,$filed,$order_str,$shop_list,$express_list,$warehouse_list);
-			$smt_num = $smt_no_ret['total'];
-			$smt_arr = $smt_no_ret['list'];
-
-			/**************************翔文的不管**************************/
-
-			$xw_no_ret = $this->indexData('fullorderxw',$start,$perpage,$where,$filed,$order_str,$shop_list,$express_list,$warehouse_list);
-			$xw_num = $xw_no_ret['total'];
-			$xw_arr = $xw_no_ret['list'];
-
-			$total = $dlz_num + $dlz_jj_num + $tt_num + $tt_jj_num + $amz_num + $amz_jj_num + $smt_num + $smt_jj_num + $xw_num;
-
+            //取得信息列表
+            $info_list = $this->fullorder->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks',$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]['shipremarks'] = str_replace(array('<','>'),array('&lt;','&gt;'),$value['shipremarks']);
+            }
+            
+			$info_listtt = $this->fullordertt->find_all($where,'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks',$order_str,$start,$perpage);
+			 //格式化数据
+            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,shipremarks',$order_str,$start,$perpage);
+			 //格式化数据
+            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,shipremarks',$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." and mergeid = '0'",'id,shop,type,orderinfo,number,waybill,express,print,library,librarytime,shipremarks',$order_str,$start,$perpage);
+			 //格式化数据
+            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);
 		    $pagenum = ceil($total/$perpage);
 		    $over = $total-($start+$perpage);
-			$rows = array_merge($dlz_jj_arr,$tt_jj_arr,$amz_jj_arr,$smt_jj_arr,$dlz_arr,$tt_arr,$amz_arr,$smt_arr,$xw_arr);
-		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>$rows);
+		    $rows = array('total'=>$total,'over'=>$over,'pagenum'=>$pagenum,'rows'=>(array_merge($info_list,$info_listamz,$info_listtt,$info_listxw,$info_listsmt)));
 		    echo json_encode($rows);exit;
 		}
 		if(isset($_SESSION['api']))
@@ -274,75 +463,6 @@ class Systemfout extends Start_Controller {
 		$this->data['xw'] = $xw;
 		$this->_Template('systemfout',$this->data);
 	}
-	/**
-	 * $table_name  订单表名
-	 * $start 		偏移开始坐标
-	 * $limit   	偏移量
-	 * $where  		条件
-	 * $field		字段
-	 * $order_str   排序
-	 */
-	protected function indexData($table_name,$start,$limit,$where,$filed,$order_str,$shop_list,$express_list,$warehouse_list){	
-		$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) 
-		{
-			if($value['is_jiaji'] == 1){
-				$info_list[$key]['number'] = "<c style='color:red'>".$value['number']."</c>";
-			}
-			$info_list[$key]['shop'] = isset($shop_list[$value['shop']])?$shop_list[$value['shop']]['shopname']:"";
-			if($value['waybill'] == '0')
-			{
-				$info_list[$key]['waybill'] = "";
-			}
-			$info_list[$key]['express'] = isset($express_list[$value['express']])?$express_list[$value['express']]['servicename']:"";
-	
-			$info_list[$key]['type'] = isset($warehouse_list[$value['type']])?$warehouse_list[$value['type']]['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:s',$value['librarytime']).'</em>';
-			}
-			unset($info_list[$key]['is_jiaji']);
-        }
-		$total = $this->$table_name->find_count($where);
-		return [
-			'list'=>$info_list,
-			'total'=>$total,
-		];
-	}
-
 	public function _fout()
 	{
 		$post = $this->input->post(NULL, TRUE);

+ 8 - 0
template/erp/systemfout.html

@@ -30,6 +30,14 @@
 <option value="{$val['id']}">{$val['title']}</option>
 {/loop}</select>
 </li>
+<li>
+    是否加急:<select name="is_jiaji" class="select">
+    <option value="-1">请选择</option>
+    <option value="1">是</option>
+    <option value="0">否</option>
+    </select>
+    </li>
+<li>
 <li>搜索品名:<input value="" name="so" type="text" style="width:250px"></li>
 <li>出库时间:<input id="timetk"  value="{date('Y-m-d',time()-30*24*3600)} 19:00" name="timetk" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})" readonly>
 至&nbsp;&nbsp;&nbsp;&nbsp; <input id="timetj" value="{date('Y-m-d',time())} 19:00" name="timetj" type="text" onClick="laydate({istime: true,format:'YYYY-MM-DD hh:mm'})" readonly></li>