📄 mosterbillinfobusiness.java
字号:
package com.bu.moster;
import java.util.*;
import com.service.*;
import com.po.*;
import com.struts.form.*;
public class MosterBillInfoBusiness implements MosterBusiness {
private DAOService ds;
public boolean delete(String id) {
// TODO Auto-generated method stub
return false;
}
public Vector findAll() {
// TODO Auto-generated method stub
List ls = ds.getBillinfodao().findAll();
Vector vcbi = new Vector();
for (Object object : ls) {
BillInfo bi = (BillInfo)object;
//创建货票信息表的对象
MosterBillInfoForm mobif = new MosterBillInfoForm();
mobif.setBillID(bi.getBillId().toString());
//获取发货方数据
mobif.setSendID(bi.getCustomerInfoBySendId().getCustomerId().toString());
mobif.setSendName(bi.getCustomerInfoBySendId().getCustomerName());
//获取收货方数据
mobif.setReceiveID(bi.getCustomerInfoByReceiveId().getCustomerId().toString());
mobif.setReceiveName(bi.getCustomerInfoByReceiveId().getCustomerName());
mobif.setTruckLine(bi.getTruckLine());
mobif.setPayerName(bi.getPayerName());
//获取用户数据
mobif.setUserID(bi.getUserInfo().getUserId().toString());
mobif.setUserName(bi.getUserInfo().getUserName());
mobif.setBillData(bi.getBillData());
//获取货票信息数据
mobif.setBillStateID(bi.getBillState().getBillStateId().toString());
mobif.setBillStateName(bi.getBillState().getBillStateName());
mobif.setBillMemo(bi.getBillMemo());
//获取发货方公司数据
mobif.setSendBranchID(bi.getBranchInfoBySendBranchId().getBranchId().toString());
mobif.setSendBranchName(bi.getBranchInfoBySendBranchId().getBranchName());
//获取收货方公司数据
mobif.setReceiveBranchID(bi.getBranchInfoByReceiveBranchId().getBranchId().toString());
mobif.setReceiveBranchName(bi.getBranchInfoByReceiveBranchId().getBranchName());
//创建货物集合对象
Vector cargos=new Vector();
//获取货物集合
Set cgi = bi.getCargoVectors();
if(cgi!=null||!cgi.isEmpty()){
Iterator it = cgi.iterator();
//获取货物集合对象
while(it.hasNext()){
CargoVector cv = (CargoVector) it.next();
//通过货物集合对象获取货物对象,并设置到货物集合中
CargoInfo ci = cv.getCargoInfo();
MosterCargoInfoForm mocif = new MosterCargoInfoForm();
mocif.setCargoID(ci.getCargoId().toString());
mocif.setCargoName(ci.getCargoName());
mocif.setCargoWeight(ci.getCargoWeight());
mocif.setCargoBulk(ci.getCargoBulk());
mocif.setCargoNum(ci.getCargoNum());
mocif.setCargoUnit(ci.getCargoUnit());
mocif.setCargoValue(ci.getCargoValue());
mocif.setCargoFreight(ci.getCargoFreight());
mocif.setCargoAmends(ci.getCargoAmends());
mocif.setCargoMemo(ci.getCargoMemo());
if(ci.getCargoState()==0){
mocif.setCargoState("库存");
}
if(ci.getCargoState()==1){
mocif.setCargoState("在途");
}
if(ci.getCargoState()==2){
mocif.setCargoState("出库");
}
//获取公司数据
mocif.setBranchID(ci.getBranchInfo().getBranchId().toString());
mocif.setBranchName(ci.getBranchInfo().getBranchName());
mocif.setCargoStartData(ci.getCargoStartData());
mocif.setCargoEndData(ci.getCargoEndData());
cargos.add(mocif);
}
}
mobif.setCargos(cargos);
vcbi.add(mobif);
}
return vcbi;
}
public Object findById(String id) {
// TODO Auto-generated method stub
BillInfo bi = ds.getBillinfodao().findById(new Integer(id));
//创建货票信息表对象
MosterBillInfoForm mobif = new MosterBillInfoForm();
mobif.setBillID(bi.getBillId().toString());
//获取发货方数据
mobif.setSendID(bi.getCustomerInfoBySendId().getCustomerId().toString());
mobif.setSendName(bi.getCustomerInfoBySendId().getCustomerName());
//获取收货方数据
mobif.setReceiveID(bi.getCustomerInfoByReceiveId().getCustomerId().toString());
mobif.setReceiveName(bi.getCustomerInfoByReceiveId().getCustomerName());
mobif.setTruckLine(bi.getTruckLine());
mobif.setPayerName(bi.getPayerName());
//获取用户数据
mobif.setUserID(bi.getUserInfo().getUserId().toString());
mobif.setUserName(bi.getUserInfo().getUserName());
mobif.setBillData(bi.getBillData());
//获取货票信息数据
mobif.setBillStateID(bi.getBillState().getBillStateId().toString());
mobif.setBillStateName(bi.getBillState().getBillStateName());
mobif.setBillMemo(bi.getBillMemo());
//获取发货方公司数据
mobif.setSendBranchID(bi.getBranchInfoBySendBranchId().getBranchId().toString());
mobif.setSendBranchName(bi.getBranchInfoBySendBranchId().getBranchName());
//获取收货方公司数据
mobif.setReceiveBranchID(bi.getBranchInfoByReceiveBranchId().getBranchId().toString());
mobif.setReceiveBranchName(bi.getBranchInfoByReceiveBranchId().getBranchName());
//创建货物集合对象
Vector cargos=new Vector();
//获取货物集合
Set cgi = bi.getCargoVectors();
if(cgi!=null||!cgi.isEmpty()){
Iterator it = cgi.iterator();
//获取货物集合对象
while(it.hasNext()){
CargoVector cv = (CargoVector) it.next();
//通过货物集合对象获取货物对象,并设置到货物集合中
CargoInfo ci = cv.getCargoInfo();
MosterCargoInfoForm mocif = new MosterCargoInfoForm();
mocif.setCargoID(ci.getCargoId().toString());
mocif.setCargoName(ci.getCargoName());
mocif.setCargoWeight(ci.getCargoWeight());
mocif.setCargoBulk(ci.getCargoBulk());
mocif.setCargoNum(ci.getCargoNum());
mocif.setCargoUnit(ci.getCargoUnit());
mocif.setCargoValue(ci.getCargoValue());
mocif.setCargoFreight(ci.getCargoFreight());
mocif.setCargoAmends(ci.getCargoAmends());
mocif.setCargoMemo(ci.getCargoMemo());
if(ci.getCargoState()==0){
mocif.setCargoState("库存");
}
if(ci.getCargoState()==1){
mocif.setCargoState("在途");
}
if(ci.getCargoState()==2){
mocif.setCargoState("出库");
}
//获取公司数据
mocif.setBranchID(ci.getBranchInfo().getBranchId().toString());
mocif.setBranchName(ci.getBranchInfo().getBranchName());
mocif.setCargoStartData(ci.getCargoStartData());
mocif.setCargoEndData(ci.getCargoEndData());
cargos.add(mocif);
}
}
mobif.setCargos(cargos);
return mobif;
}
public boolean save(Object ob) {
// TODO Auto-generated method stub
return false;
}
public boolean update(Object ob) {
// TODO Auto-generated method stub
MosterBillInfoForm mobif = (MosterBillInfoForm) ob;
BillInfo b = ds.getBillinfodao().findById(new Integer(mobif.getBillID()));
//获取用户对象,设置用户ID数据
UserInfo ui = ds.getUserinfodao().findById(new Integer(mobif.getUserID()));
b.setUserInfo(ui);
//设置货票状态数据,获取货票状态表的对象
BillState bs = ds.getBillstatedao().findById(new Integer(mobif.getBillStateID()));
b.setBillState(bs);
b.setBillMemo(mobif.getBillMemo());
try {
//更新货票信息
ds.getBillinfodao().attachDirty(b);
return true;
} catch (RuntimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
//根据公司编号,查找本公司所有的货票编号
public Vector findByBranchID(int branchID){
// TODO Auto-generated method stub
List ls = ds.getBillinfodao().findByBranchID(branchID);
Vector vcbill = new Vector();
for (Object object : ls) {
BillInfo bi = (BillInfo) object;
//创建货物信息表对象
MosterBillInfoForm mobif = new MosterBillInfoForm();
mobif.setBillID(bi.getBillId().toString());
vcbill.add(mobif);
}
return vcbill;
}
public Vector findByBillState(int id){
// TODO Auto-generated method stub
List ls = ds.getBillinfodao().findByBillStateID(id);
Vector vcbi = new Vector();
for (Object object : ls) {
BillInfo bi = (BillInfo)object;
//创建货票信息表的对象
MosterBillInfoForm mobif = new MosterBillInfoForm();
mobif.setBillID(bi.getBillId().toString());
//获取发货方数据
mobif.setSendID(bi.getCustomerInfoBySendId().getCustomerId().toString());
mobif.setSendName(bi.getCustomerInfoBySendId().getCustomerName());
//获取收货方数据
mobif.setReceiveID(bi.getCustomerInfoByReceiveId().getCustomerId().toString());
mobif.setReceiveName(bi.getCustomerInfoByReceiveId().getCustomerName());
mobif.setTruckLine(bi.getTruckLine());
mobif.setPayerName(bi.getPayerName());
//获取用户数据
mobif.setUserID(bi.getUserInfo().getUserId().toString());
mobif.setUserName(bi.getUserInfo().getUserName());
mobif.setBillData(bi.getBillData());
//获取货票信息数据
mobif.setBillStateID(bi.getBillState().getBillStateId().toString());
mobif.setBillStateName(bi.getBillState().getBillStateName());
mobif.setBillMemo(bi.getBillMemo());
//获取发货方公司数据
mobif.setSendBranchID(bi.getBranchInfoBySendBranchId().getBranchId().toString());
mobif.setSendBranchName(bi.getBranchInfoBySendBranchId().getBranchName());
//获取收货方公司数据
mobif.setReceiveBranchID(bi.getBranchInfoByReceiveBranchId().getBranchId().toString());
mobif.setReceiveBranchName(bi.getBranchInfoByReceiveBranchId().getBranchName());
//创建货物集合对象
Vector cargos=new Vector();
//获取货物集合
Set cgi = bi.getCargoVectors();
if(cgi!=null||!cgi.isEmpty()){
Iterator it = cgi.iterator();
//获取货物集合对象
while(it.hasNext()){
CargoVector cv = (CargoVector) it.next();
//通过货物集合对象获取货物对象,并设置到货物集合中
CargoInfo ci = cv.getCargoInfo();
MosterCargoInfoForm mocif = new MosterCargoInfoForm();
mocif.setCargoID(ci.getCargoId().toString());
mocif.setCargoName(ci.getCargoName());
mocif.setCargoWeight(ci.getCargoWeight());
mocif.setCargoBulk(ci.getCargoBulk());
mocif.setCargoNum(ci.getCargoNum());
mocif.setCargoUnit(ci.getCargoUnit());
mocif.setCargoValue(ci.getCargoValue());
mocif.setCargoFreight(ci.getCargoFreight());
mocif.setCargoAmends(ci.getCargoAmends());
mocif.setCargoMemo(ci.getCargoMemo());
if(ci.getCargoState()==0){
mocif.setCargoState("库存");
}
if(ci.getCargoState()==1){
mocif.setCargoState("在途");
}
if(ci.getCargoState()==2){
mocif.setCargoState("出库");
}
//获取公司数据
mocif.setBranchID(ci.getBranchInfo().getBranchId().toString());
mocif.setBranchName(ci.getBranchInfo().getBranchName());
mocif.setCargoStartData(ci.getCargoStartData());
mocif.setCargoEndData(ci.getCargoEndData());
cargos.add(mocif);
}
}
mobif.setCargos(cargos);
vcbi.add(mobif);
}
return vcbi;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -