【Java开源代码栏目提醒】:网学会员为需要Java开源代码的朋友们搜集整理了OutInventoryBillListUI.java相关资料,希望对各位网友有所帮助!
package com.cownew.PIS.inv.client;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.util.Iterator;
import java.util.Set;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import com.cownew.PIS.base.numberMgr.common.INumberRuleDAO;
import com.cownew.PIS.framework.client.ClientContextMgr;
import com.cownew.PIS.framework.client.RemoteServiceLocator;
import com.cownew.PIS.framework.common.IValueObject;
import com.cownew.PIS.framework.common.db.Selectors;
import com.cownew.PIS.inv.common.IOutInventoryBillDAO;
import com.cownew.PIS.inv.common.InvException;
import com.cownew.PIS.inv.common.OutInvBillStateEnum;
import com.cownew.PIS.inv.common.OutInventoryBillDetailInfo;
import com.cownew.PIS.inv.common.OutInventoryBillInfo;
import com.cownew.PIS.ui.base.IUIContainer;
import com.cownew.PIS.ui.base.UIFactory;
import com.cownew.PIS.ui.commonUI.EditUI;
import com.cownew.PIS.ui.commonUI.EditUIModeEnum;
import com.cownew.PIS.ui.commonUI.ListUI;
import com.cownew.PIS.ui.commonUI.filterUI.FilterSortItem;
import com.cownew.PIS.ui.commonUI.filterUI.FilterUI;
import com.cownew.PIS.ui.utils.PISAbstractAction;
import com.cownew.PIS.ui.utils.UIUtils;
import com.cownew.ctk.ui.swing.MsgBox;
public class OutInventoryBillListUI extends ListUI
{
private FilterUI filterUI;
protected ActionAccountBill actionAccountBill;
protected ActionGenRedBill actionGenRedBill;
public OutInventoryBillListUI() throws Exception
{
super();
}
protected void initAction()
{
super.initAction();
actionAccountBill = new ActionAccountBill("登帐");
actionGenRedBill = new ActionGenRedBill("生成红单");
}
protected void initToolBar(JToolBar tBar)
{
super.initToolBar(tBar);
JButton btnAccountBill = new JButton();
btnAccountBill.setAction(actionAccountBill);
tBar.add(btnAccountBill);
JButton btnGenRedBill = new JButton();
btnGenRedBill.setAction(actionGenRedBill);
tBar.add(btnGenRedBill);
}
public IValueObject generateNewVO() throws Exception
{
OutInventoryBillInfo info = new OutInventoryBillInfo();
INumberRuleDAO numDAO = (INumberRuleDAO) RemoteServiceLocator
.getRemoteService(INumberRuleDAO.class);
info.setNumber(numDAO.generateSN("出库单编码规则"));
info.setCreateDate(ClientContextMgr.getServerSQLNow());
info.setOperator(ClientContextMgr.getCurrencyUser().getPerson());
info.setIsRedBill(false);
info.setBillState(OutInvBillStateEnum.SAVED.getName());
return info;
}
protected void actionEdit_actionPerformed(ActionEvent e) throws Exception
{
IOutInventoryBillDAO intf = (IOutInventoryBillDAO) getRemoteService();
// 虽然在服务器端update的时候还要做判断,不过在用户点击编辑的时候就判断一下还是比较友好的,
// 省的用户编辑了半天才发现不能保存
// 判断是否已经进行登帐等操作(即单据状态不为"保存")
if (!intf.isSavedState(getSelectedId()))
{
throw new InvException(InvException.NOTSAVEDCANNOTEDIT);
}
super.actionEdit_actionPerformed(e);
}
protected void actionAccountBill_Performed(ActionEvent e) throws Exception
{
UIUtils.checkSelected(getTableMain());
IOutInventoryBillDAO dao = (IOutInventoryBillDAO) getRemoteService();
dao.accountBill(getSelectedId());
refreshData();
MsgBox.showInfo(this, "登帐成功!");
}
protected void actionGenRedBill_Performed(ActionEvent e) throws Exception
{
UIUtils.checkSelected(getTableMain());
IOutInventoryBillDAO dao = (IOutInventoryBillDAO) getRemoteService();
String pk = getSelectedId();
//不能对红单再次红冲
if(dao.isRedBill(pk))
{
throw new InvException(InvException.CANNOTREDAGAIN);
}
Selectors selectors = new Selectors();
selectors.add("details");
selectors.add("details.material");
selectors.add("details.measureUnit");
OutInventoryBillInfo billInfo = (OutInventoryBillInfo) dao.loadByPK(pk,selectors);
//清空新单据的编号,将新单据的制单日期修改为当前日期,清空登帐日期,操作员设定为当前用户
//是否红单设置为“是”,单据状态为“保存”,并设置备注为“**的红单”(**代表被红冲单据的编号)