lvhao 4 일 전
부모
커밋
0b5d611fd2
2개의 변경된 파일73개의 추가작업 그리고 1개의 파일을 삭제
  1. 72 0
      core/CoreApp/controllers/Whlabelfz1.php
  2. 1 1
      template/erp/whlabelfz1_mgxxindex.html

+ 72 - 0
core/CoreApp/controllers/Whlabelfz1.php

@@ -48,6 +48,9 @@ class Whlabelfz1 extends Start_Controller
 		else if($arg =='zoutorder'){
 			$this->_zoutorder();
 		}
+		else if($arg == 'mgxxexcel'){
+			$this->_mgxxexcel();
+		}
 	    else {
 			$this->_index();
 		}
@@ -643,4 +646,73 @@ class Whlabelfz1 extends Start_Controller
 			'total' => $total,
 		];
 	}
+
+
+	private function _mgxxexcel(){
+		$timetk = $this->input->get('timetk',true);
+		$timetj = $this->input->get('timetj',true);
+		$type = $this->input->get('type',true);
+		$timetk = strtotime($timetk);
+		$timetj = strtotime($timetj);
+		
+		$where_sql = " 1=1 ";
+		if($timetk&&$timetj){
+			$where_sql .= " and scantime >= ".$timetk ." and scantime <= ".$timetj." ";
+
+		}
+		if(!empty($post['orderinfo'])){
+			$where_sql .=" and orderinfo = '".$post['orderinfo']."' ";
+		}
+		if($type){
+			$where_sql .=" and type = ".$type." ";
+		}
+		$list = $this->db->from("whlabel_bh_scan")->select('id,orderinfo,type,jm,pm,sl,scantime')->where($where_sql)->order_by('id desc')->get()->result_array();
+		foreach($list as $k=>$v){
+			$list[$k]['type'] = ($v['type']== 1)?"工厂布标":"仓库标签";
+			$list[$k]['scantime'] = date('Y-m-d H:i:s',$v['scantime']);
+		}
+		
+		//生成excel
+		$filename = date("Y-m-d")."成品库备货扫描记录导出.xls";
+		$str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
+		<head>
+		<!--[if gte mso 9]><xml>
+		<x:ExcelWorkbook>
+		<x:ExcelWorksheets>
+		<x:ExcelWorksheet>
+		<x:Name>EXCEL</x:Name>
+		<x:WorksheetOptions>
+		<x:Print>
+		<x:ValidPrinterInfo />
+		</x:Print>
+		</x:WorksheetOptions>
+		</x:ExcelWorksheet>
+		</x:ExcelWorksheets>
+		</x:ExcelWorkbook>
+		</xml>
+		<![endif]-->
+		</head><body>";
+		$str .= "<table border=1 style='font-family: Microsoft Yahei;font-size: 13px;'>"; 
+		$str .= "<tr><td>备货单编码</td><td>类型</td><td>u9料号</td><td>品名</td><td>数量</td><td>扫描时间</td></tr>";
+		foreach ($info_list as $key=>$value) 
+		{ 
+			
+			$str .= "<tr>";
+			$str .= "<td>". $value['orderinfo']. "</td>";
+			$str .= "<td>". $value['type']. "</td>";	
+			$str .= "<td>". $value['jm']. "</td>";	
+			$str .= "<td>". $value['pm']. "</td>";
+			$str .= "<td>". $value['sl']. "</td>";
+			$str .= "<td>". $value['scantime']. "</td>";
+			$str .= "</tr>";
+		}
+		$str .= "</table></body></html>"; 
+		header( "Content-Type: application/vnd.ms-excel; name='excel'" ); 
+		header( "Content-type: application/octet-stream" ); 
+		header( "Content-Disposition: attachment; filename=".$filename ); 
+		header( "Cache-Control: must-revalidate, post-check=0, pre-check=0" ); 
+		header( "Pragma: no-cache" ); 
+		header( "Expires: 0" ); 
+		exit($str); 
+	}
 }

+ 1 - 1
template/erp/whlabelfz1_mgxxindex.html

@@ -171,7 +171,7 @@
         let timetk = $("#timetk").val();
         let timetj = $("#timetj").val();
         let orderinfo = $("input[name='orderinfo']").val()
-        let url  = "/whlabelfz1/scanlogs?timetk="+timetk+"&timetj="+timetj;
+        let url  = "/whlabelfz1/mgxxexcel?timetk="+timetk+"&timetj="+timetj;
         if(orderinfo.length > 0){
             url += "&orderinfo="+orderinfo;
         }