longyi hai 16 horas
pai
achega
3af5430357
Modificáronse 1 ficheiros con 66 adicións e 32 borrados
  1. 66 32
      core/CoreApp/controllers/Whlabel_bh.php

+ 66 - 32
core/CoreApp/controllers/Whlabel_bh.php

@@ -2436,40 +2436,60 @@ class Whlabel_bh extends Start_Controller {
 		{
 			$prc[$v['id']] = $v['title'];
 		}
-		if(isset($_GET['excel']))  
+		if(isset($_GET['fexcel']))  
 		{
-			$number = $this->input->post('number',true);
-			$pm = $this->input->post('pm',true);
-			$color = $this->input->post('color',true);
-			$transfer = $this->input->get('transfer',true);
-			$ktime = $this->input->get('ktime',true);
-			$jtime = $this->input->get('jtime',true);
-			$ktime = strtotime($ktime);
-			$jtime = strtotime($jtime);
-			$where = " time >= ".$ktime." and time <= ".$jtime." ";$gj = "";$ck = "";
-
-			$where .=" rk like '%|".$transfer."| ";
-			if($number)
-            {
-                $where  .= " and number like '%$number%'";
-            }
-			
-			if($pm)
-            {
-                $where  .= " and pm like '%$pm%'";
-            }
-			
-			if($color)
-            {
-                $where  .= " and features like '%-$color-%'";
-            }
+    			$number = $this->input->get('number',true);
+    			$pm = $this->input->get('pm',true);
+    			$color = $this->input->get('color',true);
+    			$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 = "status = 2 and time >= ".$ktime." and time <= ".$jtime." ";$gj = "";$ck = "";
+    
+    		//	$where .=" and ((ck like '%|".$transfer."|') or (ck like '%|".$transfer."|') )";
+    			if($number)
+                {
+                    $where  .= " and number like '%$number%'";
+                }
+    			
+    			if($pm)
+                {
+                    $where  .= " and pm like '%$pm%'";
+                }
+    			
+    			if($color)
+                {
+                    $where  .= " and features like '%-$color-%'";
+                }
 			
 			
           
 				$list = array();
-				$rows = $this->whlabel_bh_transfer->find_all($where,'id,wbid,orderinfo,jm,pm,time');
+				$rows = $this->whlabel_bh_transfer->find_all($where,'id,wbid,orderinfo,jm,pm,time,label');
 				
-            	
+            	foreach($rows as $k=>$v){
+            	    if(isset($list[$v['wbid']])){
+            	        $list[$v['wbid']]['sl'] =  $list[$v['wbid']]['sl'] + 1;
+            	        $list[$v['wbid']]['time'][] = date("Y-m-d H:i:s",$v['time']);
+            	        $list[$v['wbid']]['label'][] = $v['label'];
+            	    }else{
+            	        $list[$v['wbid']] = [
+            	            'wbid'=>$v['wbid'],
+            	            'orderinfo'=>$v['orderinfo'],
+            	            'jm'=>$v['jm'],
+            	            'pm'=>$v['pm'],
+            	            'sl'=>1,
+            	            'time'=>[
+            	                date("Y-m-d H:i:s",$v['time'])
+            	             ],
+            	             'label'=>[
+            	                $v['label'],     
+            	            ]
+            	       ];
+            	    }
+            	}
 
 				$filename = date("Y-m-d")."工厂备货完成汇总.xls";
 				$str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
@@ -2491,15 +2511,29 @@ class Whlabel_bh extends Start_Controller {
 				<![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></tr>";
+				$str .= "<tr><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>". $value['id']. "</td>";
+					$str .= "<td>". $value['wbid']. "</td>";
 					$str .= "<td>". $value['orderinfo']. "</td>";	
 					$str .= "<td>". $value['jm']. "</td>";	
 					$str .= "<td>". $value['pm']. "</td>";	
-					$str .= "<td>". date('Y-m-d H:i:s',$value['time']). "</td>";
+					$str .= "<td>". $value['sl']. "</td>";
+					$str .="<td>";
+					$tmp = "";
+					foreach($value['time'] as $kk=>$vv){
+					  $tmp .=$vv."<br/>";
+					}
+					$str .= trim($tmp,"<br/>");
+					$str .="</td>";
+					$str .="<td>";
+					$tmp_l = "";
+					foreach($value['label'] as $kk=>$vv){
+					    $tmp_l .= "`".$vv."<br/>";
+					}
+					$str .= trim($tmp_l,"<br/>");
+					$str .="</td>";
 					$str .= "</tr>";
 				}
 				$str .= "</table></body></html>"; 
@@ -2510,6 +2544,6 @@ class Whlabel_bh extends Start_Controller {
 				header( "Pragma: no-cache" ); 
 				header( "Expires: 0" ); 
 				exit($str); 
-			}
+		}
 	}
 }