MyTetra Share
Делитесь знаниями!
Взаимодействие с пользователем
Время создания: 18.11.2019 22:17
Раздел: INFO - JOB - CUBA - WorkFlow
Запись: wwwlir/Tetra/master/base/1574086637zp5exrd9g4/text.html на raw.githubusercontent.com

import com.groupstp.workflowstp.web.util.WebUiHelper;

import com.groupstp.workflowstp.web.util.MapHelper;

import com.groupstp.rtneo.web.util.WorkflowUiHelper;

import com.groupstp.rtneo.web.simplecomment.SimpleCommentDialog;

import com.haulmont.cuba.gui.components.Window;


askCommentAndPerform();


private void askCommentAndPerform() {

final SimpleCommentDialog dialog = SimpleCommentDialog.show(screen, true, 255)

dialog.addCloseWithCommitListener(new Window.CloseWithCommitListener() {

void windowClosedWithCommitAction() {

Map params = MapHelper.asMap("расчет_по_факту_отказано", "да", "комментарий", dialog.getComment());

WorkflowUiHelper.get().performWorkflowActionWithoutConfirmation(entity, target, workflowInstanceTask, workflowInstance, stage, screen, params);

}

});

}


===============================================

import com.groupstp.rtneo.entity.ContainerYard

import com.groupstp.rtneo.entity.RealEstateContainerYard

import com.groupstp.rtneo.util.ParsingUtil

import com.groupstp.workflowstp.web.util.WebUiHelper;

import com.groupstp.workflowstp.web.util.MapHelper;

import com.groupstp.rtneo.web.util.WorkflowUiHelper;

import com.groupstp.rtneo.web.simplecomment.SimpleCommentDialog

import com.haulmont.chile.core.model.MetaClass

import com.haulmont.chile.core.model.MetaProperty

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

import com.haulmont.cuba.core.global.AppBeans

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

import com.haulmont.cuba.gui.components.Window;

import com.groupstp.rtneo.entity.FactRequestStatus;

//import java.lang.reflect.Method;

askCommentAndPerform();


private void askCommentAndPerform() {

final SimpleCommentDialog dialog = SimpleCommentDialog.show(screen, false, 255)

dialog.addCloseWithCommitListener(new Window.CloseWithCommitListener() {

void windowClosedWithCommitAction() {

//verifyContainerYard()

setFactAcceptStatus();

Map params = MapHelper.asMap("расчет_по_факту_согласовано", "да", "комментарий", dialog.getComment());

WorkflowUiHelper.get().performWorkflowActionWithoutConfirmation(entity, target, workflowInstanceTask, workflowInstance, stage, screen, params);

}

void setFactAcceptStatus()

{

Metadata metadata = AppBeans.get(Metadata.NAME)

MetaClass metaClass= metadata.getClassNN(entity.getEntityName())

MetaProperty idProperty =metaClass.getPropertyNN("id")

DataManager dm = AppBeans.get(DataManager.NAME)

ParsingUtil parsing = AppBeans.get(ParsingUtil.NAME)

RealEstateContainerYard reContainerYard = (RealEstateContainerYard) dm.load(metaClass.getJavaClass())

.id(parsing.toSimpleValue(entity.getEntityId(), idProperty.getJavaType()))

.view("realEstateContainerYard-withContainerYard")

.optional()

.orElse(null)

for(att in entity. getAttributesList())

{

if(att.getProperty()=="factRequest")

{

reContainerYard.setFactRequest(FactRequestStatus.fromId(20))

reContainerYard.setFactAcceptedDate(new Date());

dm.commit(reContainerYard)

}

}

}


void verifyContainerYard() {

DataManager dm = AppBeans.get(DataManager.NAME)

ParsingUtil parsing = AppBeans.get(ParsingUtil.NAME)


MetaClass metaClass = metadata.getClassNN(change.getEntityName());

MetaProperty idProperty = metaClass.getPropertyNN("id");


RealEstateContainerYard reContainerYard = (RealEstateContainerYard) dm.load(metaClass.getJavaClass())

.id(parsing.toSimpleValue(entity.getEntityId(), idProperty.getJavaType()))

.view("realEstateContainerYard-withContainerYard")

.optional()

.orElse(null)

if (reContainerYard?.getContainerYard() != null) {

ContainerYard containerYard = reContainerYard.getContainerYard()

containerYard.setVerified(Boolean.TRUE)

dm.commit(containerYard)

}

}

});

}

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