Przeglądaj źródła

提交导入库存

lvhao 13 godzin temu
rodzic
commit
c5fc8af693
1 zmienionych plików z 20 dodań i 25 usunięć
  1. 20 25
      core/CoreApp/controllers/Whlabel.php

+ 20 - 25
core/CoreApp/controllers/Whlabel.php

@@ -4649,7 +4649,6 @@ class Whlabel extends Start_Controller
 		}
 		if(empty($data)){
 			echo json_encode(array('msg' => '传输数据异常!', 'error' => 1, 'success' => false));
-			exit;
 		}
 		$list = [];
 		if(isset($data['list'])){
@@ -4662,14 +4661,14 @@ class Whlabel extends Start_Controller
 		foreach ($list as $key => $value) {
 			$time = time();
 			if ($value['0'] == "") {
-				$ed[] = ['msg'=>'第'.($key+2). '行-仓库未填写!'] ;
+				$ed[] = ['msg'=>'第'.($key+1). '行-仓库未填写!'] ;
 				$j++;
 				continue;
 			}
 		
 			$warehouse = $this->warehouse->get_title($value['0']);
 			if(empty($warehouse)){
-				$ed[] = ['msg'=>'第'.($key+2). '行-仓库名错误!'] ;
+				$ed[] = ['msg'=>'第'.($key+1). '行-仓库名错误!'] ;
 				$j++;
 				continue;
 			}
@@ -4715,10 +4714,10 @@ class Whlabel extends Start_Controller
 					$j++;
 					continue;
 				}
-				if(empty($details)){
-					$data = $this->whlabel->find_all('warehouse = "' . $warehouse['id'] . '" and sku = "' . $sku . '" and (zd = "" or zd is null)  and state = 0');	
-				}else{
+				if(!empty($details)){
 					$data = $this->whlabel->find_all('warehouse = "' . $warehouse['id'] . '" and sku = "' . $sku . '" and (zd = "" or zd is null) and state = 0 and details = "'. $details .'"');
+				}else{
+					$data = $this->whlabel->find_all('warehouse = "' . $warehouse['id'] . '" and sku = "' . $sku . '" and (zd = "" or zd is null) and state = 0');	
 				}
 				
 				if (count($data) < abs($num)) {
@@ -4744,30 +4743,26 @@ class Whlabel extends Start_Controller
 				}
 			} 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 == ''))) {
 					$ed[] = array('msg'=>$sku . '-增加必须填写增加类型,非类型1必须填写备注');
 					$j++;
 					continue;
 				}
+				if(empty($details)){
+					$tmp_info = $this->whlabel->find('warehouse = "' . $warehouse['id'] . '" and sku = "' . $sku . '" and (details != "" or details is not null) ','*','id desc');
+					if(empty($tmp_info)){
+						$details = '';
+					}else{
+						$details = $tmp_info[0]['details'];
+					}
+				}else{
+					$tmp_info = $this->whlabel->find('warehouse = "' . $warehouse['id'] . '" and sku = "' . $sku . '" and details = "'.$details.'" ','*','id desc');
+					if(empty($tmp_info)){
+						$ed[] = array('msg'=>$sku . '-的库位' . $details . '不存在!');
+						$j++;
+						continue;
+					}
+				}
 				$post['sku'] = $d['sku'];
 				$post['shop'] = $d['shop'];
 				$post['warehouse'] = $warehouse['id'];