lvhao 1 日 前
コミット
4c1f996dc8
1 ファイル変更26 行追加24 行削除
  1. 26 24
      core/CoreApp/controllers/Whlabel.php

+ 26 - 24
core/CoreApp/controllers/Whlabel.php

@@ -4705,29 +4705,7 @@ class Whlabel extends Start_Controller
 				continue;
 				continue;
 			}
 			}
 			
 			
-			if($details != 'DZ001'){
-				$kw_info = $this->whlabel->find('warehouse = '.$warehouse['id'].' and sku = "' . $sku . '" and  state = 0 and details != "DZ001"');
-				//判断是否有货
-				if(!empty($kw_info)){
-					//判断是否有录入库位了
-					if(empty($kw_info['details'])){
-						if($kw_info['details'] != $details){
-							$ed[] = ['msg'=>$sku . '的在系统中没有库位!'] ;
-							$j++;
-							continue;
-						}
-					}else{
-						//如果有库位了 但是库位不匹配
-						if($kw_info['details'] != $details){
-							$ed[] = ['msg'=>$sku . '的系统库位是'.$kw_info['details'].'!'] ;
-							$j++;
-							continue;
-						}
-					}
-				}
-				
-				
-			}
+			
 			
 			
 			if ($num < 0) //扣减库存
 			if ($num < 0) //扣减库存
 			{
 			{
@@ -4736,7 +4714,12 @@ class Whlabel extends Start_Controller
 					$j++;
 					$j++;
 					continue;
 					continue;
 				}
 				}
-				$data = $this->whlabel->find_all('warehouse = "' . $warehouse['id'] . '" and sku = "' . $sku . '" and (zd = "" or zd is null)and state = 0 and details = "'. $details .'"');
+				if(empty($details)){
+					$data = $this->whlabel->find_all('warehouse = "' . $warehouse['id'] . '" and sku = "' . $sku . '" and (zd = "" or zd is null)  and state = 0');	
+				}else{
+					$data = $this->whlabel->find_all('warehouse = "' . $warehouse['id'] . '" and sku = "' . $sku . '" and (zd = "" or zd is null) and state = 0 and details = "'. $details .'"');
+				}
+				
 				if (count($data) < abs($num)) {
 				if (count($data) < abs($num)) {
 					$ed[] = ['msg'=>$sku . '-扣减数量大于库存剩余数量!'] ;
 					$ed[] = ['msg'=>$sku . '-扣减数量大于库存剩余数量!'] ;
 					$j++;
 					$j++;
@@ -4760,6 +4743,25 @@ class Whlabel extends Start_Controller
 				}
 				}
 			} else if ($num > 0) //增加库存
 			} else if ($num > 0) //增加库存
 			{
 			{
+				if($details != 'DZ001'){
+					$kw_info = $this->whlabel->find('warehouse = '.$warehouse['id'].' and sku = "' . $sku . '" and  state = 0 and details != "DZ001"');
+					//判断是否有货
+					if(!empty($kw_info)){
+						//判断库位是否匹配
+						if(empty($kw_info['details'])){
+							$ed[] = ['msg'=>$sku . '的在系统中没有库位!'] ;
+							$j++;
+							continue;
+						}
+						if($kw_info['details'] != $details){
+							$ed[] = ['msg'=>$sku . '的系统库位是'.$kw_info['details'].'!'] ;
+							$j++;
+							continue;
+						}
+					}
+				}
+
+
 				if ($warehouse['id'] == 5 && ($rktype == '' || ($rktype > 1 && $text == ''))) {
 				if ($warehouse['id'] == 5 && ($rktype == '' || ($rktype > 1 && $text == ''))) {
 					$ed[] = array('msg'=>$sku . '-增加必须填写增加类型,非类型1必须填写备注');
 					$ed[] = array('msg'=>$sku . '-增加必须填写增加类型,非类型1必须填写备注');
 					$j++;
 					$j++;