|  | @@ -1,7 +1,9 @@
 | 
	
		
			
				|  |  |  package com.ruoyi.web.controller.warehouse.basicData;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  |  import com.ruoyi.basicData.domain.TWarehouse;
 | 
	
		
			
				|  |  | +import com.ruoyi.basicData.domain.TWarehouseArea;
 | 
	
		
			
				|  |  |  import com.ruoyi.basicData.service.ITWarehouseService;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.annotation.Log;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.constant.UserConstants;
 | 
	
	
		
			
				|  | @@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.security.access.prepost.PreAuthorize;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.util.Date;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /**
 | 
	
	
		
			
				|  | @@ -81,6 +84,16 @@ public class TWarehouseController extends BaseController {
 | 
	
		
			
				|  |  |          } else if (UserConstants.NOT_UNIQUE.equals(tWarehouseService.checkUFAaddrUnique(tWarehouses))) {
 | 
	
		
			
				|  |  |              return AjaxResult.error("新增仓库'" + tWarehouses.getfAddr() + "'失败,地址已存在");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        JSONArray jsonArray = JSONArray.parseArray(tWarehouseArea);
 | 
	
		
			
				|  |  | +        List<TWarehouseArea> tWarehouseAreaList = JSONObject.parseArray(jsonArray.toJSONString(), TWarehouseArea.class);
 | 
	
		
			
				|  |  | +        for (TWarehouseArea tWarehouseAreas : tWarehouseAreaList) {
 | 
	
		
			
				|  |  | +            if (UserConstants.NOT_UNIQUE.equals(tWarehouseService.checkUFTWarehouseAreaNoUnique(tWarehouseAreas))) {
 | 
	
		
			
				|  |  | +                return AjaxResult.error("新增仓库'" + tWarehouseAreas.getfNo() + "'失败,库区编号已存在");
 | 
	
		
			
				|  |  | +            } else if (UserConstants.NOT_UNIQUE.equals(tWarehouseService.checkUTWarehouseAreaFNnameUnique(tWarehouseAreas))) {
 | 
	
		
			
				|  |  | +                return AjaxResult.error("新增仓库'" + tWarehouseAreas.getfName() + "'失败,库区编号已存在");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          // 获取当前的用户
 | 
	
		
			
				|  |  |          LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
 | 
	
		
			
				|  |  |          return tWarehouseService.insertTWarehouse1(tWarehouse, tWarehouseArea, loginUser);
 |