dobe_comic8/main/java/shkd/repc/recos/formplugin/GetDecisionAndPurProjectPlu...

55 lines
1.9 KiB
Java

package shkd.repc.recos.formplugin;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.datamodel.IDataModel;
import kd.bos.form.FormShowParameter;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.sdk.plugin.Plugin;
import java.util.EventObject;
/**
* 单据界面插件
*/
public class GetDecisionAndPurProjectPlugin extends AbstractBillPlugIn implements Plugin {
/*
* 目标成本调整-若本单据是从定标跳转过来,则将定标上的采购项目赋值到项目
* */
@Override
public void beforeBindData(EventObject e) {
super.beforeBindData(e);
}
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
FormShowParameter formShowParameter = this.getView().getFormShowParameter();
Object decisionId = formShowParameter.getCustomParam("decision_id");
Object purProjectNumber = formShowParameter.getCustomParam("purproject_number");
Object seqNum = formShowParameter.getCustomParam("seqNum");
IDataModel model = this.getModel();
if (decisionId != null && 0 != (Long) decisionId) {
model.setValue("qeug_decision", decisionId);
}
if (seqNum != null) {
model.setValue("qeug_section_seq", seqNum);
}
if (purProjectNumber != null && !((String) purProjectNumber).isEmpty()) {
DynamicObject project = (DynamicObject) this.getModel().getValue("project");
if (project == null) {
QFilter projectQF= new QFilter("number", QCP.equals, purProjectNumber);
project = BusinessDataServiceHelper.loadSingle("repmd_project_f7", projectQF.toArray());
model.setValue("project", project);
}
}
}
}