目录
1、设置序时簿背景颜色
2、设置序时簿显示 不忽略0
3、编辑界面分录表格点击事件
4、编辑界面页面全屏
5、字段设置颜色
6、分录设置标题
7、刷新单据的序时簿界面
8、分录编辑F7 编辑结束事件
9、分录的f7过滤
10、分录字段设置小数显示位数、设置锁定
1、设置序时簿背景颜色
@Override
protected void afterTableFillData(KDTDataRequestEvent e) {
// TODO Auto-generated method stub
super.afterTableFillData(e);
for(int i = e.getFirstRow();i<=e.getLastRow();i++){
IRow row = tblMain.getRow(i);
ICell cell = row.getCell("bizDate");
Boolean fivouchered = (Boolean) row.getCell("Fivouchered").getValue();
Date bizDate = (Date) cell.getValue();
row.getCell("bizDate");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
try {
Date parse = simpleDateFormat.parse("2021-01-30");
if(bizDate.compareTo(parse)<=0){
if(!fivouchered){
row.getCell("Fivouchered").getStyleAttributes().setBackground(Color.gray);
}
}
} catch (ParseException e1) {
e1.printStackTrace();
}
}
}
2、设置序时簿显示 不忽略0
protected IQueryExecutor getQueryExecutor(IMetaDataPK pk,
EntityViewInfo viewInfo) {
IQueryExecutor queryExecutor = super.getQueryExecutor(pk, viewInfo);
queryExecutor.option().isAutoIgnoreZero = false; // 不自动忽略数值零
return queryExecutor;
}
3、编辑界面分录表格点击事件
@Override
protected void kdtEntrys2_tableClicked(KDTMouseEvent e) throws Exception {
if(prmtcustomer.getValue() == null)throw new EASBizException(new NumericExceptionSubItem("0002","请先选择客户"));
}
4、编辑界面页面全屏
super.onLoad();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setPreferredSize(new Dimension(screenSize.width-450,screenSize.height-300));
5、字段设置颜色
this.txtinvoicedAmt.setCustomForegroundColor( Color.red);
6、分录设置标题
this.kdtEntrys_detailPanel.setTitle("发票");
7、刷新单据的序时簿界面
// disposeUIWindow();
Object uiObj = this.getUIContext().get(UIContext.OWNER); // 刷新序时薄界面
if (uiObj != null && uiObj instanceof HWReqBillListUI) {
((HWReqBillListUI) uiObj).refreshList();
}
8、分录编辑F7 编辑结束事件
protected void kdtEntrys2_editStopped(KDTEditEvent e)
9、分录的f7过滤
CustomerInfo customerInfo = (CustomerInfo) this.prmtcustomer.getValue();
KDBizPromptBox prmtHfPerson = (KDBizPromptBox) kdtEntrys2.getColumn("TempInWarehsBill").getEditor().getComponent(); //获取表格特定列绑定的F7
EntityViewInfo view = new EntityViewInfo();
prmtHfPerson.setQueryInfo("com.kingdee.eas.wastedisposal.hwd.app.TempInWarehsBilChooseQuery");
FilterInfo filter = new FilterInfo(); //过滤条件
filter.getFilterItems().add(new FilterItemInfo("customer.id", customerInfo.getId())); //条件1,#0
//filter.getFilterItems().add(new FilterItemInfo("status", BizStatusEnum.NORMAL_VALUE)); //条件2,#1
//filter.getFilterItems().add(new FilterItemInfo("status", BizStatusEnum.FROZEN_VALUE)); //条件3,#2
//filter.setMaskString("#0 and (#1 or #2)"); //3个过滤条件设定关系
view.setFilter(filter);
prmtHfPerson.setEntityViewInfo(view); //F7重新设定视图
10、分录字段设置小数显示位数、设置锁定
kdtEntrys.getColumn("qty").getStyleAttributes().setNumberFormat("#,##0.0000");
kdtEntrys.getColumn("price").getStyleAttributes().setNumberFormat("#,##0.00000000");
kdtEntrys.getColumn("amount").getStyleAttributes().setNumberFormat("#,##0.00");
kdtEntrys.getColumn("taxAmount").getStyleAttributes().setNumberFormat("#,##0.00");
kdtEntrys.getColumn("amount").getStyleAttributes().setLocked(false);
kdtEntrys.getColumn("taxAmount").getStyleAttributes().setLocked(false);
kdtEntrys.getColumn("invoicedAmt").getStyleAttributes().setLocked(false);
11、bean方法中处理凭证反写
@Override
protected void _reverseSave(Context ctx, IObjectPK srcBillPK,
IObjectValue srcBillVO, BOTBillOperStateEnum billOperStateEnum,
IObjectValue relationInfo) throws BOSException, EASBizException {
reverseSave(ctx, srcBillPK, srcBillVO, billOperStateEnum, relationInfo);
super._reverseSave(ctx, srcBillPK, srcBillVO, billOperStateEnum, relationInfo);
}
public static void reverseSave(Context ctx, IObjectPK srcBillPK, IObjectValue srcBillVO, BOTBillOperStateEnum bOTBillOperStateEnum, IObjectValue bOTRelationInfo) throws BOSException, EASBizException {
BOTRelationInfo relation = (BOTRelationInfo) bOTRelationInfo;
BOSObjectType bosType = BOSUuid.read(relation.getDestObjectID()).getType();
if (bosType.equals((new VoucherInfo()).getBOSType())) {
CoreBillBaseInfo model = (CoreBillBaseInfo) srcBillVO;
// 删除凭证
if (bOTBillOperStateEnum.equals(BOTBillOperStateEnum.DELETE)) {
//model.put(FLD_FIVOUCHERED, new Integer(0));
// 以下设置单据的凭证信息
model.put("VOUCHERNUMBER", null);
//model.put(FLD_VOUCHERDATE, null);
}
// 生成凭证
else {
String voucherID = relation.getDestObjectID();
VoucherInfo voucherInfo = (VoucherInfo) VoucherFactory.getLocalInstance(ctx).getValue(new ObjectStringPK(voucherID));
//model.put(FLD_FIVOUCHERED, voucherInfo.getNumber() );
// 以下设置单据的凭证信息
model.put("VOUCHERNUMBER", voucherInfo.getNumber());
// model.put(FLD_VOUCHERDATE, voucherInfo.getBookedDate());
}
BOSObjectType bosObjectType = srcBillVO.getBOSType();
ICoreBillBase iCoreBillBase = (ICoreBillBase) BOSObjectFactory.createBOSObject(ctx, bosObjectType);
iCoreBillBase.reverseSave(srcBillPK, (CoreBillBaseInfo) srcBillVO);
}
}