浏览代码

提交数据

lvhao 5 月之前
父节点
当前提交
56ca702ec2
共有 2 个文件被更改,包括 135 次插入4 次删除
  1. 134 3
      core/CoreApp/controllers/Zzququeu9.php
  2. 1 1
      template/erp/zzququeu9.html

+ 134 - 3
core/CoreApp/controllers/Zzququeu9.php

@@ -597,7 +597,7 @@ class Zzququeu9 extends Start_Controller {
 
     public function _excel(){
         $params = $this->input->get();
-        $where = "1 = 1";
+        $where = " type = 10 ";
         if(!empty($params['order_no'])){
           $where .= " order_no =  '".$params['order_no']."' ";
         } 
@@ -608,9 +608,140 @@ class Zzququeu9 extends Start_Controller {
           $where .= " create_time <  ".strtotime($params['timetj'])." ";
         }    
         if(!empty($params['status'])){
-          $where .= " status = ".$params['status'];
+               if($status = 1){
+                    $where .= " and dc_status = 0 ";
+               }elseif($status = 2){
+                    $where .= " and dc_status = -1  ";
+               }elseif($status = 3){
+                    $where .= " and dc_status = -2  ";
+               }elseif($status = 4){
+                    $where .= " and dc_status = -3  ";
+               }elseif($status = 5){
+                    $where .= " and dc_status < 3  ";
+               }
         }
-        var_dump($where);
+        
+          $info_list = $this->zzquque_u9->find_all($where,'*','id desc',$start,$perpage);
+          $type_list = $this->zzquque_u9->getType();
+          $list = [];
+          foreach($info_list as $k=>$v){
+               $dc_no = $v['dc_no'];
+               $error_str = "";
+               $error_json ="";
+               if($v['dc_status'] == -1){
+                    $error = $this->zzququeu9_logs->find_all("oid = ".$v['id']." and one_type = 1 and two_type = 1 ","*",'id desc',0,1);
+                    $error_json = $error[0]['ret_data'];
+                    if($error[0]['apply_api']=='lpck'){
+                         $ret_data = json_decode($error[0]['ret_data'],true);
+                         $apply_data = json_decode($error[0]['apply_data'],true);
+                         if(isset($ret_data["ResMsg"])){
+                              if(empty($apply_data['0'])){
+                                   $error_str = $ret_data["ResMsg"];
+                              }else{
+                                   $error_str = $ret_data["ResMsg"]."【". $apply_data[0]['EntityCode']."】";
+                              }
+                              
+                         }else{
+                              $error_str = "料品同步失败";
+                         }
+                    }else{
+
+                         $ret_data = json_decode($error[0]['ret_data'],true);
+                         if(isset($ret_data[0]["ResMsg"])){
+                              $error_str = $ret_data[0]["ResMsg"];
+                         }elseif(isset($ret_data['msg'])){
+                              $error_str = $ret_data['msg'];
+                         }else{
+                              $error_str = "料品同步失败";
+                         }
+                    }
+                    
+               }
+               
+              
+               if(!empty($v['cg_no'])){
+                    $cg_no = $v['cg_no'];
+               }
+               
+               if(!empty($v['xs_no'])){
+                    $xs_no = $v['xs_no'];
+               }
+               
+               if(!empty($v['xs_two_no'])){
+                    $xs_two_no = $v['xs_two_no'];
+               }
+               
+              
+               if(!empty($v['bzch_no'])){
+                    $bzch_no = $v['bzch_no'];
+               }
+
+               $dr_no = "";
+             
+               if(!empty($v['dr_no'])){
+                    $dr_no = $v['dr_no'];
+               }
+
+               $list[] = [
+                    'id'=>$v['id'],
+                    'order_no'=>$v['order_no'],
+                    'type'=>isset($type_list[$v['type']])?$type_list[$v['type']]:"异常",
+                    'dc_no'=> $dc_no,
+                    'error'=>$error_str,
+                    'error_json'=>$error_json,
+                    //'bzsh_no'=>$bzsh_no,
+                    
+                    'create_time'=>date("Y-m-d H:i:s",$v['create_time']),
+               ];
+          }
+
+
+
+
+        $info_list = [];
+
+        $filename = date("Y-m-d")."u9小单导出.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>订单号</td><td>类型</td><td>调出单号</td><td>创建时间</td><td>错误信息</td><td>错误json</td></tr>";
+		foreach ($info_list as $key=>$value) 
+		{ 
+			
+		    $str .= "<tr>";
+			$str .= "<td>". $value['id']. "</td>";
+			$str .= "<td>". $value['order_no']. "</td>";	
+			$str .= "<td>". $value['type']. "</td>";	
+			$str .= "<td>". $value['dc_no']. "</td>";
+			$str .= "<td>". $value['error']. "</td>";
+			$str .= "<td>". $value['error_json']. "</td>";
+               $str .= "<td>". $value['create_time']. "</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/zzququeu9.html

@@ -63,7 +63,7 @@
                 <a href="javascript:void(0);" class="btn btn-success" onclick="addData()">添 加</a>
                 
                 <!-- <a href="javascript:void(0);" style="font-size: 15px;" class="check">删 除</a> -->
-                <!-- <a href="javascript:void(0);" style="font-size: 15px;background-color: #f39c12;" onclick="excelexport()">按条件导出</a> -->
+                <a href="javascript:void(0);" style="font-size: 15px;background-color: #f39c12;" onclick="excelexport()">按条件导出</a>
                 </div>
             
             <table class="datatitle data" border="0" style="border-collapse:collapse;">