?? 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 + -