MyTetra Share
Делитесь знаниями!
Создание Bill
Время создания: 01.12.2020 08:24
Раздел: INFO - JOB - rtneo - Работа над задачами
Запись: wwwlir/Tetra/master/base/1606782291wycdgroi9e/text.html на raw.githubusercontent.com

import com.haulmont.cuba.core.entity.Entity

import com.haulmont.cuba.core.global.*

import com.groupstp.rtneo.entity.*

import com.groupstp.rtneo.service.*

import com.groupstp.rtneo.core.bean.*

import com.haulmont.cuba.core.*

import java.util.stream.Collectors

import com.haulmont.cuba.core.global.ViewRepository;

import com.haulmont.cuba.core.global.View;


import java.util.function.*;

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.stream.Collectors


BillService service = AppBeans.get(BillService.NAME)

ViewRepository vRep = AppBeans.get(ViewRepository.NAME)

DataManager dataManager = AppBeans.get(DataManager.NAME)


View viewAccrual = vRep.getView(Accrual.class, "_local")

.addProperty("category", vRep.getView(RealEstateCategory.class, "_local")

.addProperty("unit", vRep.getView(Unit.class, "_local"))

)

.addProperty("realEstate", vRep.getView(RealEstate.class, "_local")


)

.addProperty("bill", vRep.getView(Bill.class, "_local")


)


CommitContext commitContext = new CommitContext()


Contragent contragent = dataManager.load(Contragent.class).id(UUID.fromString('78542f0a-a54f-58f0-dba2-41aae0bbc5e2')).one()


List<Contract> contracts = dataManager.load(Contract.class)

.query('select c from rtneo$Contract c where c.contragent.id = :contragent_id and c.accepted = true order by c.createTs')

.parameter("contragent_id", contragent.getId())

.view('_local')

.list()

for(Contract contract : contracts){

List<Accrual> accruals = dataManager.load(Accrual.class)

.query('select a from rtneo$Accrual a where a.contractPosition.contract.id = :contract_id')

.parameter("contract_id", contract.getId())

.view(viewAccrual)

.list()

service.createBills(contragent, contract, accruals, commitContext)

}

dataManager.commit(commitContext)

service.redefinitionBills(contragent)

//service.createBills(Contragent contragent, Contract contract, List<Accrual> accruals, CommitContext commitContext)

Так же в этом разделе:
 
MyTetra Share v.0.58
Яндекс индекс цитирования