📄 countinventorybilllistui.java
字号:
package com.cownew.PIS.inv.client;
import java.awt.event.ActionEvent;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.JToolBar;
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.inv.common.CountInvBillStateEnum;
import com.cownew.PIS.inv.common.CountInventoryBillInfo;
import com.cownew.PIS.inv.common.ICountInventoryBillDAO;
import com.cownew.PIS.inv.common.InvException;
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 CountInventoryBillListUI extends ListUI
{
private FilterUI filterUI;
protected ActionAccountBill actionAccountBill;
public CountInventoryBillListUI() throws Exception
{
super();
}
protected void initAction()
{
super.initAction();
actionAccountBill = new ActionAccountBill("登帐");
}
protected void initToolBar(JToolBar tBar)
{
super.initToolBar(tBar);
JButton btnAccountBill = new JButton();
btnAccountBill.setAction(actionAccountBill);
tBar.add(btnAccountBill);
}
public IValueObject generateNewVO() throws Exception
{
CountInventoryBillInfo info = new CountInventoryBillInfo();
INumberRuleDAO numDAO = (INumberRuleDAO) RemoteServiceLocator
.getRemoteService(INumberRuleDAO.class);
info.setNumber(numDAO.generateSN("盘点单编码规则"));
info.setCreateDate(ClientContextMgr.getServerSQLNow());
info.setOperator(ClientContextMgr.getCurrencyUser().getPerson());
info.setBillState(CountInvBillStateEnum.SAVED.getName());
return info;
}
protected void actionEdit_actionPerformed(ActionEvent e) throws Exception
{
ICountInventoryBillDAO intf = (ICountInventoryBillDAO) 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());
ICountInventoryBillDAO dao = (ICountInventoryBillDAO) getRemoteService();
dao.accountBill(getSelectedId());
refreshData();
MsgBox.showInfo(this, "登帐成功!");
}
protected FilterUI getFilterUI()
{
if(filterUI!=null)
{
return filterUI;
}
FilterSortItem[] sortProps = new FilterSortItem[] {
new FilterSortItem("number", "编号"),
new FilterSortItem("createDate", "制单日期"),
new FilterSortItem("countDate", "盘点日期"),
new FilterSortItem("accountDate", "登帐日期"),
new FilterSortItem("operator.name", "操作员"),
new FilterSortItem("billState", "单据状态"),
new FilterSortItem("countType", "盘点类型")};
filterUI = new FilterUI(new CountInvBillSysDefFilterUI(), sortProps);
return filterUI;
}
public Class getEditUIClass()
{
return CountInventoryBillEditUI.class;
}
public Class getServiceIntfClass()
{
return ICountInventoryBillDAO.class;
}
protected class ActionAccountBill extends PISAbstractAction
{
public ActionAccountBill(String name, Icon icon)
{
super(name, icon);
}
public ActionAccountBill(String name)
{
super(name);
}
public void onActionPerformed(ActionEvent e) throws Exception
{
actionAccountBill_Performed(e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -