|  | @@ -3,6 +3,7 @@ package com.ruoyi.web.controller.shipping.controller;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  import java.util.Map;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.ruoyi.common.constant.UserConstants;
 | 
	
		
			
				|  |  |  import com.ruoyi.common.utils.StringUtils;
 | 
	
		
			
				|  |  |  import org.springframework.security.access.prepost.PreAuthorize;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @@ -88,29 +89,14 @@ public class TCntrController extends BaseController
 | 
	
		
			
				|  |  |          }else if (StringUtils.isEmpty(tCntr.getfName())){
 | 
	
		
			
				|  |  |              return AjaxResult.error("集装箱英文名不能为空");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        if (UserConstants.NOT_UNIQUE.equals(tCntrService.selectTcnrFno(tCntr))) {
 | 
	
		
			
				|  |  | +            return AjaxResult.error(tCntr.getfNo() + "编号已存在");
 | 
	
		
			
				|  |  | +        } else if (UserConstants.NOT_UNIQUE.equals(tCntrService.selectTcnrFName(tCntr))){
 | 
	
		
			
				|  |  | +            return AjaxResult.error(tCntr.getfName() + "名称已存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          if (tCntr.getfId() == null){
 | 
	
		
			
				|  |  | -            String name = tCntrService.selectTcnrFName(tCntr.getfName());
 | 
	
		
			
				|  |  | -            String fno = tCntrService.selectTcnrFno(tCntr.getfNo());
 | 
	
		
			
				|  |  | -            if (StringUtils.isNotEmpty(name)){
 | 
	
		
			
				|  |  | -                return AjaxResult.error("名称已存在");
 | 
	
		
			
				|  |  | -            }else if (StringUtils.isNotEmpty(fno)){
 | 
	
		
			
				|  |  | -                return AjaxResult.error("编号已存在");
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  |              return toAjax(tCntrService.insertTCntr(tCntr));
 | 
	
		
			
				|  |  |          }else {
 | 
	
		
			
				|  |  | -            TCntr cntr = tCntrService.selectTCntrById(tCntr.getfId());
 | 
	
		
			
				|  |  | -            if (!cntr.getfName().equals(tCntr.getfName())){
 | 
	
		
			
				|  |  | -                String name = tCntrService.selectTcnrFName(tCntr.getfName());
 | 
	
		
			
				|  |  | -                if (StringUtils.isNotEmpty(name)){
 | 
	
		
			
				|  |  | -                    return AjaxResult.error("名称已存在");
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -            if (!cntr.getfNo().equals(tCntr.getfNo())){
 | 
	
		
			
				|  |  | -                String fno = tCntrService.selectTcnrFno(tCntr.getfNo());
 | 
	
		
			
				|  |  | -                if (StringUtils.isNotEmpty(fno)){
 | 
	
		
			
				|  |  | -                    return AjaxResult.error("编号已存在");
 | 
	
		
			
				|  |  | -                }
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  |              if (tCntr.getfStatus().equals("T") ||tCntr.getfStatus().equals("正常")){
 | 
	
		
			
				|  |  |                  tCntr.setfStatus("T");
 | 
	
		
			
				|  |  |              }else {
 | 
	
	
		
			
				|  | @@ -153,33 +139,4 @@ public class TCntrController extends BaseController
 | 
	
		
			
				|  |  |          List<Map<String,Object>> list = tCntrService.selectRcntrName(tCntr);
 | 
	
		
			
				|  |  |          return getDataTable(list);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    /**
 | 
	
		
			
				|  |  | -     * 获取集装箱编号
 | 
	
		
			
				|  |  | -     */
 | 
	
		
			
				|  |  | -    //@PreAuthorize("@ss.hasPermi('shipping:cntr:selectTcnrFno')")
 | 
	
		
			
				|  |  | -    @GetMapping(value = "/selectTcnrFno/{fNo}")
 | 
	
		
			
				|  |  | -    public AjaxResult selectTcnrFno(@PathVariable("fNo") String fNo)
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -        String fno = tCntrService.selectTcnrFno(fNo);
 | 
	
		
			
				|  |  | -        if (StringUtils.isNotEmpty(fno)){
 | 
	
		
			
				|  |  | -            return AjaxResult.error("编号已存在");
 | 
	
		
			
				|  |  | -        }else {
 | 
	
		
			
				|  |  | -            return AjaxResult.success();
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -    /**
 | 
	
		
			
				|  |  | -     * 获取集装箱名称
 | 
	
		
			
				|  |  | -     */
 | 
	
		
			
				|  |  | -    //@PreAuthorize("@ss.hasPermi('shipping:cntr:selectTcnrFName')")
 | 
	
		
			
				|  |  | -    @GetMapping(value = "/selectTcnrFName/{fName}")
 | 
	
		
			
				|  |  | -    public AjaxResult selectTcnrFName(@PathVariable("fName") String fName)
 | 
	
		
			
				|  |  | -    {
 | 
	
		
			
				|  |  | -        String name = tCntrService.selectTcnrFName(fName);
 | 
	
		
			
				|  |  | -        if (StringUtils.isNotEmpty(name)){
 | 
	
		
			
				|  |  | -            return AjaxResult.error("名称已存在");
 | 
	
		
			
				|  |  | -        }else {
 | 
	
		
			
				|  |  | -            return AjaxResult.success();
 | 
	
		
			
				|  |  | -        }
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  |  }
 |