Browse Source

修改信息

lvhao 1 month ago
parent
commit
b516f52b00
1 changed files with 33 additions and 7 deletions
  1. 33 7
      core/CoreApp/controllers/Whlabelfz.php

+ 33 - 7
core/CoreApp/controllers/Whlabelfz.php

@@ -351,6 +351,24 @@ class Whlabelfz extends Start_Controller
     }
 
 	public function _whlabel_cprk_excel(){
+		if (empty($_SESSION['api'])) {
+			exit('No direct script access allowed');
+
+		}
+
+		$user = $this->user->get_api($_SESSION['api']);
+		$warehouses = $user['warehouse'];
+		if(empty($warehouses)){
+			exit('没有仓库权限!!!');
+		}
+		$warehouses = explode('|',trim($warehouses,'|'));
+		$ware_list = [];
+		foreach ($warehouses as $v) {
+			if(!empty($v)){
+				$ware_list[] = $v;
+			}
+		}
+		
 		$category = $this->input->get('category', true);
 		$size = $this->input->get('size', true);
 		$grade = $this->input->get('grade', true);
@@ -363,9 +381,19 @@ class Whlabelfz extends Start_Controller
 		$jtime = $this->input->get('jtime', true);
 		$ktime = strtotime($ktime);
 		$jtime = strtotime($jtime);
-		$where = "1=1";
-		$gj = "";
-		$ck = "";
+		$where = "";
+		if ($warehouse) {
+			if(in_array($warehouse,$ware_list)){
+				$where  .= "  warehouse = '$warehouse'  ";
+			}else{
+				$where  .= "  warehouse = 0 ";
+			}
+
+			
+		}else{
+			$where  .= "  warehouse in (".implode(',',$ware_list).")";
+		}
+		
 		if ($category) {
 			$where  .= " and features like '%-$category-%'";
 		}
@@ -382,9 +410,7 @@ class Whlabelfz extends Start_Controller
 		if ($lowe) {
 			$where  .= " and features like '%-$lowe-%'";
 		}
-		if ($warehouse) {
-			$where  .= " and warehouse = '$warehouse'";
-		}
+		
 		if ($purchase) {
 			$where  .= " and purchase = '$purchase'";
 		}
@@ -423,7 +449,7 @@ class Whlabelfz extends Start_Controller
 
 
 		//生成excel
-		$filename = date("Y-m-d")."标签入库导出.xls";
+		$filename = date("Y-m-d")."产品入库导出.xls";
 		$str = "<html xmlns:x=\"urn:schemas-microsoft-com:office:excel\">
 		<head>
 		<!--[if gte mso 9]><xml>