📄 storehousetool.java
字号:
package com.tool;
import com.bean.*;
import com.dao.*;
import java.sql.SQLException;
//仓库管理及仓管员管理用到的一些方法
public class StorehouseTool {
//判断仓管员类型
//如果是自有仓管返回true,第三方仓管返回false
public static boolean getSHManagerType (int shMId) throws SQLException,Exception{
StorehouseShmanagerView shM = StorehouseShmanagerViewDAO.selectStorehouseShmanagerViewByshmId(shMId);
if(shM.getCompFlag()==0) return true;
if(shM.getCompFlag()==1) return false;
else throw new Exception("未知的仓管员类型!");
}
//判仓库类型
//自有仓库返回true,第三方仓库返回false
public static boolean getStorehouseType(int shId) throws SQLException,Exception{
Storehouse storehouse = StorehouseDAO.selectStorehouseByshId(shId);
if(storehouse.getShKind()==0) return true;
if(storehouse.getShKind()==1) return false;
else throw new Exception("未知的仓库类型!");
}
//判断某仓管员能否添加到某仓库
//true表示可,false表示不可以
//shMId为要判断的仓管员Id,shId要判断的仓库Id
public static boolean isShMCanAddToSh(int shMId,int shId) throws Exception{
boolean tmpShManageType = getSHManagerType(shMId);
boolean tmpStorehouseType = getStorehouseType(shId);
if(tmpShManageType&&tmpStorehouseType) return true;//自有仓管员可添加到自有仓库
if(!tmpShManageType&&!tmpStorehouseType) return true;//第三方仓管员可添加到第三方仓库
else return false;//其它情况都不允许添加
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -