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

44 lines
1.6 KiB
Java
Raw Normal View History

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 afterBindData(EventObject e) {
super.afterBindData(e);
FormShowParameter formShowParameter = this.getView().getFormShowParameter();
Object decisionId = formShowParameter.getCustomParam("decision_id");
Object purProjectNumber = formShowParameter.getCustomParam("purproject_number");
IDataModel model = this.getModel();
if (decisionId != null && 0 != (Long) decisionId) {
model.setValue("qeug_decision", decisionId);
}
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);
}
}
}
}