MyTetra Share
Делитесь знаниями!
Создание начислений
Время создания: 02.12.2020 16:58
Раздел: INFO - JOB - rtneo - Accruals
Запись: wwwlir/Tetra/master/base/1606899488rnw4v04hqu/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.global.ViewRepository;

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

import java.util.function.*;

import com.haulmont.cuba.core.TransactionalDataManager

import java.math.RoundingMode;

import org.apache.commons.collections4.*;

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import com.haulmont.bali.util.Preconditions;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import de.diedavids.cuba.runtimediagnose.groovy.*

import groovy.transform.InheritConstructors;

import com.groupstp.rtneo.util.*;

import java.util.stream.Collectors

import java.time.*;


df = new SimpleDateFormat("dd.MM.yyyy");

def start = df.parse('01.01.2020')

def end = df.parse('31.12.2020')

CalculationWorker calcWorker = AppBeans.get(CalculationWorker.class)

ViewRepository vRep = AppBeans.get(ViewRepository.NAME)

View contractView = vRep.getView(Contract.class, "contract-edit")

.addProperty("positions", vRep.getView(ContractPosition.class, "_local")

.addProperty("contragent", vRep.getView(Contragent.class, "_local"))

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

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

)

.addProperty("wasteProject", vRep.getView(WasteGenerationProject.class, "_local"))

.addProperty("contragentRealEstate", vRep.getView(ContragentRealEstate.class, "_local")

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

.addProperty("wasteGenerationProjects", vRep.getView(WasteGenerationProject.class, "_local"))

.addProperty("contragent", vRep.getView(Contragent.class, "_local"))

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

.addProperty("zone", vRep.getView(Zone.class, "_local"))

)

)

)

// .addProperty("realEstates", vRep.getView(Contragent.class, "contragent-create-contract")

// .getProperty("realEstates").getView()

// .addProperty("exportStartDate")

// .addProperty("type", vRep.getView(RealEstateType.class, "_minimal")

// .addProperty("isLiving")

// )

// )


//List<Contract> contracts = dataManager.load(Contract.class).query('select distinct cp.contract from rtneo$ContractPosition cp where size(cp.accruals) = 0')

//.view(contractView)

//.firstResult(0)

//.maxResults(1)

//.list()


List<Contract> contracts = dataManager.load(Contract.class).query('select c from rtneo$Contract c where c.id = \'16e7bf83-6303-723e-84c8-280d33defe4f\'')

.view(contractView)

//.firstResult(0)

//.maxResults(1)

.list()

log.debug(contracts.size())

for(Contract item : contracts){

log.debug(item.getContragent())

CommitContext commitContext = new CommitContext();

accruals = calcWorker.calculateAccruals(start, end, item.getContragent(), item.getDate(), item, commitContext);

log.debug(accruals)

dataManager.commit(commitContext)

}



 
MyTetra Share v.0.65
Яндекс индекс цитирования