EAS BOS 新增单据设置默认值,添加默认分录

//覆盖父类方法
@Override
protected IObjectValue createNewData() {
    ExBillInfo objectValue = new ExBillInfo();
    
    objectValue.setCreator((com.kingdee.eas.base.permission.UserInfo)(com.kingdee.eas.common.client.SysContext.getSysContext().getCurrentUser()));//创建人
    objectValue.setCreateTime(new Timestamp(new Date().getTime()));//创建时间

    objectValue.setBillState(BillStateEnum.Save);//单据状态
    objectValue.setCU(SysContext.getSysContext().getCurrentCtrlUnit());//控制单元

    objectValue.setBizDate(new Date());//业务日期

    ...

    //默认添加分录
    String[] entrys = new String[]{"entry1","entry2","entry3","entry4"};
    ExBillEntryCollection coll = new ExBillEntryCollection ();
    for(int i = 0; i<entrys.length; i++){
        ExBillEntryInfo entry = new ExBillEntryInfo();
        entry.setId(BOSUuid.create("D1FF49F1"));
        entry.setContent(entrys[i]);
        coll.add(entry);
    }

    if(coll.size() > 0)
        objectValue.put("entry", coll);

    return objectValue;
}

猜你喜欢

转载自blog.csdn.net/qq_25170493/article/details/82772957