📄 stockmanagementdatabean.java
字号:
detail[i][14] = supplier.getHomesite();
detail[i][15] = supplier.getRemark();
i++;
}
}
}catch(Exception ex){
ex.printStackTrace();
}
return detail;
}
//创建客户的方法
public int createCustomer(String[] customerArray) {
int result = 0;
if(customerArray.length != 17){
return result;
}
try {
//创建客户
customerHome.create(customerArray[0], customerArray[1], customerArray[2],
customerArray[3], customerArray[4], customerArray[5],
customerArray[6], customerArray[7], customerArray[8],
customerArray[9], customerArray[10], customerArray[11],
customerArray[12], customerArray[13], customerArray[14],
Double.parseDouble(customerArray[15]), customerArray[16]);
result = 1;
}catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
//更新客户的方法
public int updateCustomer(String[] customerArray) {
int result = 0;
if(customerArray.length != 17){
return result;
}
try {
customer = customerHome.findByPrimaryKey(customerArray[0]);
//更新客户
customer.setCustomerZone(customerArray[1]);
customer.setPyCode(customerArray[2]);
customer.setAbbreviation(customerArray[3]);
customer.setCompanyPhone(customerArray[4]);
customer.setLinkman(customerArray[5]);
customer.setMobilePhone(customerArray[6]);
customer.setFax(customerArray[7]);
customer.setFixedPhone(customerArray[8]);
customer.setAddress(customerArray[9]);
customer.setZipCode(customerArray[10]);
customer.setBankName(customerArray[11]);
customer.setBankAccount(customerArray[12]);
customer.setEmail(customerArray[13]);
customer.setHomesite(customerArray[14]);
customer.setCreditlimit(Double.parseDouble(customerArray[15]));
customer.setRemark(customerArray[16]);
result = 1;
}catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
//删除客户的方法
public int deleteCustomer(String customerName) {
int result = 0;
try {
customer = customerHome.findByPrimaryKey(customerName);
//删除客户
customer.remove();
result = 1;
}catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
//根据客户名字取得记录的方法
public String[][] getCustomersByCustomerName(String customerName){
String[][] detail = new String[0][17];
try{
//根据客户名字取得记录
Collection col = customerHome.findByCustomerName("%" + customerName + "%");
if(col.size() > 0){
Iterator iterator = col.iterator();
//重新创建数组
detail = new String[col.size()][17];
int i = 0;
while (iterator.hasNext()) {
//取得远程接口
customer = (Customer) PortableRemoteObject.narrow(
iterator.next(), Customer.class);
detail[i][0] = customer.getCustomerName();
detail[i][1] = customer.getCustomerZone();
detail[i][2] = customer.getPyCode();
detail[i][3] = customer.getAbbreviation();
detail[i][4] = customer.getCompanyPhone();
detail[i][5] = customer.getLinkman();
detail[i][6] = customer.getMobilePhone();
detail[i][7] = customer.getFax();
detail[i][8] = customer.getFixedPhone();
detail[i][9] = customer.getAddress();
detail[i][10] = customer.getZipCode();
detail[i][11] = customer.getBankName();
detail[i][12] = customer.getBankAccount();
detail[i][13] = customer.getEmail();
detail[i][14] = customer.getHomesite();
detail[i][15] = String.valueOf(dataMethod.round(customer.getCreditlimit()));
detail[i][16] = customer.getRemark();
i++;
}
}
}catch(Exception ex){
ex.printStackTrace();
}
return detail;
}
//根据地区取得客户记录的方法
public String[][] getCustomersByCustomerZone(String customerZone){
String[][] detail = new String[0][17];
try{
//根据地区取得记录
Collection col = customerHome.findByCustomerZone("%" + customerZone + "%");
if(col.size() > 0){
Iterator iterator = col.iterator();
//重新创建数组
detail = new String[col.size()][17];
int i = 0;
while (iterator.hasNext()) {
//取得远程接口
customer = (Customer) PortableRemoteObject.narrow(
iterator.next(), Customer.class);
detail[i][0] = customer.getCustomerName();
detail[i][1] = customer.getCustomerZone();
detail[i][2] = customer.getPyCode();
detail[i][3] = customer.getAbbreviation();
detail[i][4] = customer.getCompanyPhone();
detail[i][5] = customer.getLinkman();
detail[i][6] = customer.getMobilePhone();
detail[i][7] = customer.getFax();
detail[i][8] = customer.getFixedPhone();
detail[i][9] = customer.getAddress();
detail[i][10] = customer.getZipCode();
detail[i][11] = customer.getBankName();
detail[i][12] = customer.getBankAccount();
detail[i][13] = customer.getEmail();
detail[i][14] = customer.getHomesite();
detail[i][15] = String.valueOf(dataMethod.round(customer.getCreditlimit()));
detail[i][16] = customer.getRemark();
i++;
}
}
}catch(Exception ex){
ex.printStackTrace();
}
return detail;
}
//取得信用客户的方法
public String[][] getCreditCustomer() {
String[][] detail = new String[0][17];
try{
//取得信用客户记录
Collection col = customerHome.findCreditCustomer();
if(col.size() > 0){
Iterator iterator = col.iterator();
//重新创建数组
detail = new String[col.size()][17];
int i = 0;
while (iterator.hasNext()) {
//取得远程接口
customer = (Customer) PortableRemoteObject.narrow(
iterator.next(), Customer.class);
detail[i][0] = customer.getCustomerName();
detail[i][1] = customer.getCustomerZone();
detail[i][2] = customer.getPyCode();
detail[i][3] = customer.getAbbreviation();
detail[i][4] = customer.getCompanyPhone();
detail[i][5] = customer.getLinkman();
detail[i][6] = customer.getMobilePhone();
detail[i][7] = customer.getFax();
detail[i][8] = customer.getFixedPhone();
detail[i][9] = customer.getAddress();
detail[i][10] = customer.getZipCode();
detail[i][11] = customer.getBankName();
detail[i][12] = customer.getBankAccount();
detail[i][13] = customer.getEmail();
detail[i][14] = customer.getHomesite();
detail[i][15] = String.valueOf(dataMethod.round(customer.getCreditlimit()));
detail[i][16] = customer.getRemark();
i++;
}
}
}catch(Exception ex){
ex.printStackTrace();
}
return detail;
}
//设置客户信用的方法
public int setCreditCustomer(String customerName, double creditlimit) {
int result = 0;
try {
customer = customerHome.findByPrimaryKey(customerName);
//设置客户的信用
customer.setCreditlimit(creditlimit);
result = 1;
}catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
//创建仓库
public int createWarehouse(String[] warehouseArray) {
int result = 0;
if(warehouseArray.length != 4){
return result;
}
try {
//创建仓库
warehouseHome.create(warehouseArray[0], warehouseArray[1], warehouseArray[2],
warehouseArray[3]);
result = 1;
}catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
//更新仓库
public int updateWarehouse(String[] warehouseArray) {
int result = 0;
if(warehouseArray.length != 4){
return result;
}
try {
warehouse = warehouseHome.findByPrimaryKey(warehouseArray[0]);
//更新仓库
warehouse.setPyCode(warehouseArray[1]);
warehouse.setLocation(warehouseArray[2]);
warehouse.setDescription(warehouseArray[3]);
result = 1;
}catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
//删除仓库
public int deleteWarehouse(String warehouseName) {
int result = 0;
try {
warehouse = warehouseHome.findByPrimaryKey(warehouseName);
//删除仓库
warehouse.remove();
result = 1;
}catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
//取得所有仓库
public String[][] getAllWarehouse() {
String[][] detail = new String[0][4];
try{
//取得所有仓库记录
Collection col = warehouseHome.findAll();
if(col.size() > 0){
Iterator iterator = col.iterator();
//重新创建数组
detail = new String[col.size()][4];
int i = 0;
while (iterator.hasNext()) {
//取得远程接口
warehouse = (Warehouse) PortableRemoteObject.narrow(
iterator.next(), Warehouse.class);
detail[i][0] = warehouse.getWarehouseName();
detail[i][1] = warehouse.getPyCode();
detail[i][2] = warehouse.getLocation();
detail[i][3] = warehouse.getDescription();
i++;
}
}
}catch(Exception ex){
ex.printStackTrace();
}
return detail;
}
//创建会计科目
public int createAccountName(int parentId, String accountNameStr) {
int result = 0;
try {
Collection col = accountNameHome.findAll();
//根据集合创建Vector集合类
Vector vector = new Vector(col);
Integer id = null;
if (col.size() > 0) {
//取得最后一条记录
AccountName accountName = (AccountName) PortableRemoteObject.narrow(
vector.lastElement(), AccountName.class);
//创建新序号
int newInt = accountName.getAccountId().intValue() + 1;
id = new Integer(newInt);
}
else {
//如果集合不返回记录,开始序号是1
id = new Integer(1);
}
//创建会计科目
accountNameHome.create(id, parentId, accountNameStr);
result = 1;
}catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
//更新会计科目
public int updateAccountName(int accountId, int parentId, String accountNameStr) {
int result = 0;
try {
accountName = accountNameHome.findByPrimaryKey(new Integer(accountId));
//更新会计科目
accountName.setParentId(parentId);
accountName.setAccountName(accountNameStr);
result = 1;
}catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
//删除会计科目
public int deleteAccountName(int accountId) {
int result = 0;
try {
accountName = accountNameHome.findByPrimaryKey(new Integer(accountId));
int idOriginal = accountName.getAccountId().intValue();
Collection col = accountNameHo
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -