|  | @@ -1,8 +1,10 @@
 | 
	
		
			
				|  |  |  package com.ruoyi.web.controller.warehouse.basicData;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.JSONArray;
 | 
	
		
			
				|  |  |  import com.ruoyi.basicData.domain.TWarehouse;
 | 
	
		
			
				|  |  |  import com.ruoyi.basicData.service.ITWarehouseService;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.annotation.Log;
 | 
	
		
			
				|  |  | +import com.ruoyi.common.constant.UserConstants;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.domain.AjaxResult;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.core.domain.model.LoginUser;
 | 
	
	
		
			
				|  | @@ -62,15 +64,6 @@ public class TWarehouseController extends BaseController {
 | 
	
		
			
				|  |  |          return AjaxResult.success(tWarehouseService.selectTWarehouseById1(fId));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    /**
 | 
	
		
			
				|  |  | -     * 新增仓库
 | 
	
		
			
				|  |  | -     */
 | 
	
		
			
				|  |  | -   /* @PreAuthorize("@ss.hasPermi('basicdata:warehouse:add')")
 | 
	
		
			
				|  |  | -    @Log(title = "仓库", businessType = BusinessType.INSERT)
 | 
	
		
			
				|  |  | -    @PostMapping
 | 
	
		
			
				|  |  | -    public AjaxResult add(@RequestBody TWarehouse tWarehouse) {
 | 
	
		
			
				|  |  | -        return toAjax(tWarehouseService.insertTWarehouse(tWarehouse));
 | 
	
		
			
				|  |  | -    }*/
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 新增仓库
 | 
	
	
		
			
				|  | @@ -79,6 +72,15 @@ public class TWarehouseController extends BaseController {
 | 
	
		
			
				|  |  |      @Log(title = "仓库", businessType = BusinessType.INSERT)
 | 
	
		
			
				|  |  |      @PostMapping
 | 
	
		
			
				|  |  |      public AjaxResult add(@RequestParam("tWarehouse") String tWarehouse, @RequestParam("tWarehouseArea") String tWarehouseArea) {
 | 
	
		
			
				|  |  | +        // 检验编号、名称、地址 唯一
 | 
	
		
			
				|  |  | +        TWarehouse tWarehouses = JSONArray.parseObject(tWarehouse, TWarehouse.class);
 | 
	
		
			
				|  |  | +        if (UserConstants.NOT_UNIQUE.equals(tWarehouseService.checkUFNoUnique(tWarehouses))) {
 | 
	
		
			
				|  |  | +            return AjaxResult.error("新增仓库'" + tWarehouses.getfNo() + "'失败,编号已存在");
 | 
	
		
			
				|  |  | +        } else if (UserConstants.NOT_UNIQUE.equals(tWarehouseService.checkUFNnameUnique(tWarehouses))) {
 | 
	
		
			
				|  |  | +            return AjaxResult.error("新增仓库'" + tWarehouses.getfName() + "'失败,名称已存在");
 | 
	
		
			
				|  |  | +        } else if (UserConstants.NOT_UNIQUE.equals(tWarehouseService.checkUFAaddrUnique(tWarehouses))) {
 | 
	
		
			
				|  |  | +            return AjaxResult.error("新增仓库'" + tWarehouses.getfAddr() + "'失败,地址已存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          // 获取当前的用户
 | 
	
		
			
				|  |  |          LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
 | 
	
		
			
				|  |  |          return tWarehouseService.insertTWarehouse1(tWarehouse, tWarehouseArea, loginUser);
 |