lvhao 3 дней назад
Родитель
Сommit
3602539ac2
1 измененных файлов с 58 добавлено и 0 удалено
  1. 58 0
      core/CoreApp/controllers/Beihuogl.php

+ 58 - 0
core/CoreApp/controllers/Beihuogl.php

@@ -75,6 +75,9 @@ class Beihuogl extends Start_Controller {
             $this->_ckbherprk($arg_array);
         }elseif($arg == 'bhdcdsave'){
             $this->_bhdcdsave();
+        }elseif($arg == 'u9scdexcel')
+        {
+            $this->_u9scdexcel($arg_array);
         }
 		else
 		{
@@ -966,6 +969,12 @@ class Beihuogl extends Start_Controller {
                     $str .= "<a href='javascript:void(0)' class='window' data-h='/beihuogl/makeu9scd/".$v['id']."' data-t='修改'  style='margin-right:4px;color: #fff;background-color:#0099FF;padding:4px 10px;border-radius:5px;font-size:15px' >生成u9生产单</a>";
                     $str .=  "</div>";
                 }
+                if($v['ck_status'] > 2){
+                    $str .=  "<div style='text-align:center;'>";
+                    $str .= "<a href='/beihuogl/u9scdexcel/".$v['id']."'  data-t='修改'  style='margin-right:4px;color: #fff;background-color:#D2691E;padding:4px 10px;border-radius:5px;font-size:15px' >生产单EXCEL下载</a>";
+                    $str .=  "</div>";
+                }
+                
                 $list[$k]['update_time'] = $str;
             }
 
@@ -1476,4 +1485,53 @@ class Beihuogl extends Start_Controller {
          echo json_encode(['success'=>false,'msg'=>'请求方式错误']);exit;
        }
     }
+
+    private function _u9scdexcel($arg_array){
+        $id = $arg_array[0];
+        $info = $this->bhccwl->read($id);
+        $list = $this->bhsq->find_all("bh_no = '".$info['bh_no']."' ");
+      
+        	//生成excel
+		$filename = $info['bh_no']."备货生产单.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>u9生产单号</td></tr>";
+		foreach ($list as $key=>$value) 
+		{ 
+			
+			$str .= "<tr>";
+			$str .= "<td>". $value['bh_no']. "</td>";	
+			$str .= "<td>". $value['title']. "</td>";	
+			$str .= "<td>". $value['jm']. "</td>";
+			$str .= "<td>". $value['ck_num']. "</td>";
+			$str .= "<td>". $value['u9sc_no']. "</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); 
+		
+    }
 }