浏览代码

提交验证判断的

lvhao 1 月之前
父节点
当前提交
ab1c697398
共有 1 个文件被更改,包括 92 次插入0 次删除
  1. 92 0
      core/CoreApp/controllers/Beihuogl.php

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

@@ -61,6 +61,8 @@ class Beihuogl extends Start_Controller {
             $this->_ccwldelitem();
         }elseif($arg == 'ccwlbhsave'){
             $this->_ccwlbhsave();
+        }elseif($arg == 'ccwlbhzhcheck'){
+            $this->_ccwlbhzhcheck();
         }elseif($arg == 'ckbhindex'){
             $this->_ckbhindex();
         }elseif($arg == 'ckbhedit'){
@@ -641,6 +643,96 @@ class Beihuogl extends Start_Controller {
             exit;
         }
     }
+    private function _ccwlbhzhcheck(){
+        if($this->input->method() === 'post'){
+            exit("请求方式不对");
+        }else{
+            $bh_no = $this->input->get('bh_no',true);
+            if(empty($bh_no)){
+                exit("不符合下载要求");
+            }
+            $info = $this->bhccwl->find("bh_no = '".$bh_no."'");
+            if(empty($info)){
+                exit("备货单料品信息为空");
+            }
+            $list = $this->bhsq->find_all("bh_no = '".$info['bh_no']."'");
+
+            $final_list= [];
+            $shop_list = $this->shop->find_all("1=1","id,shopname");
+            $plat_list = $this->typeclass->find_all("classid = 32","id,title");
+            $shop_list = array_column($shop_list,'shopname','id');
+            $plat_list = array_column($plat_list,'title','id');
+            $final_list= [];
+            foreach($list as $k=>$v){
+                $final_list[] = [
+                    'bh_no'=>$v['bh_no'],
+                    'shop'=>isset($shop_list[$v['shop_id']])?$shop_list[$v['shop_id']]:"无",
+                    'plat'=>isset($plat_list[$v['plat_id']])?$plat_list[$v['plat_id']]:"无",
+                    'zh'=>$v['title'],
+                    'erp_zh'=>$v['erp_zh'],
+                    'jm'=>$v['jm'],
+                    'sqr'=>$v['sqr'],
+                    'sq_num'=>$v['ccwl_num'],
+                    'public_time'=>date("Y-m-d",$v['public_time']),
+                    'remark'=>$v['remark'],
+                ];
+            }
+        
+
+            $filename = $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>平台</td><td>中文名称</td><td>ERP仓库品名</td><td>u9料号</td><td>申请人</td><td>申报数量<td>申请时间</td><td>备注</td></tr>";
+            foreach ($final_list as $key=>$value) 
+            { 
+                if($value['erp_zh'] != $value['zh']){
+                   $str .= "<tr style='background-color: red;'>";
+                }else{
+                    $str .= "<tr>";
+                }
+                
+                $str .= "<td>". $value['bh_no']. "</td>";	
+                $str .= "<td>". $value['shop']. "</td>";
+                $str .= "<td>". $value['plat']. "</td>";	
+                $str .= "<td>". $value['zh']. "</td>";	
+                $str .= "<td>". $value['erp_zh']. "</td>";
+                $str .= "<td>". $value['jm']. "</td>";
+                $str .= "<td>". $value['sqr']. "</td>";
+                $str .= "<td>". $value['sq_num']. "</td>";
+                $str .= "<td>". $value['public_time']. "</td>";
+                $str .= "<td>". $value['remark']. "</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); 
+            
+            
+        }
+    }
+
     private function _ccwlbhdownload(){
         if($this->input->method() === 'get'){
             $query = $this->input->get(null,true);