瀏覽代碼

上传完成扫入

lvhao 1 天之前
父節點
當前提交
9e8a18e83c
共有 2 個文件被更改,包括 120 次插入0 次删除
  1. 103 0
      core/CoreApp/controllers/Whlabel_bh.php
  2. 17 0
      template/erp/whlabel_bh_operate.html

+ 103 - 0
core/CoreApp/controllers/Whlabel_bh.php

@@ -136,6 +136,9 @@ class Whlabel_bh extends Start_Controller {
 		}
 		else if($arg == 'edit_jgtime'){
 			$this->_edit_jgtime();
+		}else if($arg == 'excelcpkhz'){
+			$this->_excelcpkhz();
+
 		}
 		else
 		{
@@ -2810,4 +2813,104 @@ class Whlabel_bh extends Start_Controller {
 				exit($str); 
 		}
 	}
+
+
+	public function _excelcpkhz(){
+		// $classid = $this->classid->sku();
+		// $pm = $classid;
+		// $typeclass = array();
+		// $tc = $this->typeclass->find_all();
+		// foreach ($tc as $v)
+		// {
+		// 	$typeclass[$v['id']] = $v;
+		// }
+		// $prc = array();
+		// $purchase = $this->purchase->find_all();
+		// foreach($purchase as $k=>$v)
+		// {
+		// 	$prc[$v['id']] = $v['title'];
+		// }
+		if(isset($_GET['fexcel']))  
+		{
+    			
+    			
+    			$transfer = $this->input->get('transfer',true);
+    			$ktime = $this->input->get('timetk',true);
+    			$jtime = $this->input->get('timetj',true);
+    			$ktime = strtotime($ktime);
+    			$jtime = strtotime($jtime);
+    			$where = " time >= ".$ktime." and time <= ".$jtime." and lx = " .$transfer." and type = 1 " ;$gj = "";$ck = "";
+    
+			
+			
+          
+				$list = array();
+				$rows = $this->whlabel_bh_transfer_cr->find_all($where,'*');
+				foreach($rows as $k=>$v){
+					if(!isset($list['fid'])){
+						$list[$v['fid']] = [
+							'fid'=>$v['fid'],
+							'time'=>date("Y-m-d H:i:s",$v['time'])
+						];
+
+					}
+				}
+				
+            	$fid_list = array_column($list,'fid');
+				$tmp_list = $this->whlabel_bh_transfer->find_all(" id in (".implode(",",$fid_list).") ","id,wbid,orderinfo,jm,pm,time,label","id asc");
+				$tmp_list = array_column($tmp_list,null,'id');
+				foreach($list as $k=>$v){
+					if(isset($tmp_list[$k])){
+						$list[$v['fid']]['wbid'] = $tmp_list[$k]['wbid'];
+						$list[$v['fid']]['orderinfo'] = $tmp_list[$k]['orderinfo'];
+						$list[$v['fid']]['jm'] = $tmp_list[$k]['jm'];
+						$list[$v['fid']]['pm'] = $tmp_list[$k]['pm'];
+						$list[$v['fid']]['sl'] = 1;
+						$list[$v['fid']]['label'] = $tmp_list[$k]['label'];
+					}
+				}
+				$filename = date("YmdHi",$ktime)."~".date("YmdHi",$jtime)."工厂成品库扫入库汇总.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>布标ID</td><td>订单ID</td><td>编号</td><td>简码</td><td>品名</td><td>数量</td><td>扫描时间</td><td>扫描条码</td></tr>";
+				foreach ($list as $key=>$value) 
+				{ 
+					$str .= "<tr>";
+					$str .= "<td>". $key. "</td>";
+					$str .= "<td>". $value['wbid']. "</td>";
+					$str .= "<td>". $value['orderinfo']. "</td>";	
+					$str .= "<td>". $value['jm']. "</td>";	
+					$str .= "<td>". $value['pm']. "</td>";	
+					$str .= "<td>". $value['sl']. "</td>";
+					$str .= "<td>".$value['time']."</td>";
+					$str .= "<td>`".$value['label']."</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); 
+		}
+	}
 }

+ 17 - 0
template/erp/whlabel_bh_operate.html

@@ -43,6 +43,9 @@
 <li>
 <font class="cona xz">下载Excel</font>
 </li>
+<li>
+    <font class="cona cpkxz">成品库入库下载excel</font>
+</li>
 <li>
 <font class="cona wcxz">完成汇总下载excel</font>
 </li>
@@ -189,6 +192,20 @@ $(".wcxz").click(function() {
     });
   window.location.href = "/whlabel_bh/excelwchz/?fexcel=1&"+f;
 });
+$(".cpkxz").click(function(){
+    var f = "transfer=11&";
+    // $(".select").each(function() {
+    //     f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
+    // });
+    f = f + "color="+$("select[name='color']").val()+"&";
+    $("input:text").each(function() {
+        f = f + $(this).attr("name") + "=" + $(this).val() + "&";
+    });
+	$("input:hidden").each(function() {
+        f = f + $(this).attr("name") + "=" + $(this).val() + "&";
+    });
+  window.location.href = "/whlabel_bh/excelcpkhz/?fexcel=1&"+f;
+})
 
 $(".obdel").click(function() {
 	var a = "";