星瀚单据分录赋值原创
金蝶云社区-夜阑风
夜阑风
2人赞赏了该文章 575次浏览 未经作者许可,禁止转载编辑于2024年01月16日 09:42:08

        String billId = this.getView().getFormShowParameter().getCustomParams().get("decisionId").toString();
        DynamicObject headOject = BusinessDataServiceHelper.loadSingle(billId,"src_decision");
        String selectEntryFiles = "supplier,suppliername";
        List<QFilter> entryList= new ArrayList();
        entryList.add(new QFilter("project", "=", billId));
        entryList.add(new QFilter("entrystatus", "=", "C"));
        QFilter[] dbdEntryFilter = (QFilter[]) entryList.toArray(new QFilter[entryList.size()]);
        DynamicObject[] entryObjects = BusinessDataServiceHelper.load("src_purlistf7",selectEntryFiles, dbdEntryFilter);
        HashMap supplierMap = new HashMap();
        int i=0;
        for(DynamicObject obj:entryObjects){
            //供应商去重
            if(!EmptyUtil.isEmpty(supplierMap.get(obj.get("suppliername")))&&(supplierMap.get(obj.get("suppliername")).equals(obj.get("supplier").toString()))){
                continue;
            }else{
                supplierMap.put(obj.get("suppliername").toString(),obj.get("supplier").toString());
            }
            this.getModel().createNewEntryRow("wlhl_entryentity");
            this.getModel().setValue("wlhl_supplier",obj.get("supplier"),i);
            this.getModel().setValue("wlhl_decisionno",headOject.get("billno"),i);
            this.getModel().setValue("wlhl_bidresult","中标",i);
            this.getModel().setValue("wlhl_global_assessment","1",i);
            this.getModel().setValue("wlhl_evaluate","用户未评价,此评价为默认评价",i);
            i++;
        }
        this.getModel().clearNoDataRow();
//        int size = entryObjects.length;
//        AbstractFormDataModel model = (AbstractFormDataModel) this.getModel();
//        // 事务的作用是将多次修改的数据作为整体向前端发送,将多次渲染合并为一次,避免多次渲染造成的卡顿等性能问题。
//        model.beginInit();
//        // 设置表格值设置器表格所包含的列
//        TableValueSetter setter = new TableValueSetter();
//        // 向表格设置器填充数据
//        int i = 0;
//        for(DynamicObject obj:entryObjects){
//            setter.set("wlhl_supplier",obj.get("supplier"),i);
//            setter.set("wlhl_decisionno",headOject.get("billno"),i);
//            setter.set("wlhl_bidresult","中标",i);
//            setter.set("wlhl_global_assessment","1",i);
//            setter.set("wlhl_evaluate",obj.get("materialnane"),i);
//            i++;
//        }
//        // 用表格设置器批量添加行
//        model.batchCreateNewEntryRow("wlhl_entryentity",setter);
//        // 关闭事务
//        model.endInit();
//        // 更新分录
//        this.getView().updateView("wlhl_entryentity");

图标赞 2
2人点赞
还没有人点赞,快来当第一个点赞的人吧!
图标打赏
0人打赏
还没有人打赏,快来当第一个打赏的人吧!