parent
7cb19e208a
commit
81df7a6c44
|
@ -0,0 +1,79 @@
|
|||
package shkd.repc.recon.formplugin;
|
||||
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
public class ContractProjectFormPlugin extends AbstractBillPlugIn {
|
||||
|
||||
@Override
|
||||
public void afterBindData(EventObject e) {
|
||||
super.afterBindData(e);
|
||||
//根据组织携带项目
|
||||
updateRenovationProject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
String name = e.getProperty().getName();
|
||||
//根据组织携带项目
|
||||
if ("org".equals(name)) {
|
||||
updateRenovationProject();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateRenovationProject() {
|
||||
DynamicObject org = (DynamicObject) this.getModel().getValue("org");
|
||||
|
||||
// 只有在需求组织不为空的情况下才进行查询
|
||||
if (org != null) {
|
||||
setRenovationProjectByOrg(org);
|
||||
} else {
|
||||
// 组织为空,清空项目
|
||||
this.getModel().setValue("project", null);
|
||||
this.getView().updateView("project");
|
||||
}
|
||||
}
|
||||
|
||||
private void setRenovationProjectByOrg(DynamicObject org) {
|
||||
// 检查 org 是否为 null
|
||||
if (org == null) {
|
||||
return; // 如果为 null,直接返回
|
||||
}
|
||||
|
||||
// 采购项目
|
||||
DynamicObject[] projectbills = BusinessDataServiceHelper.load("rebm_purproject", "id",
|
||||
new QFilter[]{new QFilter("org.id", QCP.equals, org.getPkValue())});
|
||||
|
||||
DynamicObject projectbill = null;
|
||||
|
||||
if (projectbills.length > 0) {
|
||||
DynamicObject projectbill1 = projectbills[0];
|
||||
if (projectbill1 != null) {
|
||||
//项目建立F7
|
||||
DynamicObject add = BusinessDataServiceHelper.loadSingle("repmd_project_f7",
|
||||
new QFilter[]{new QFilter("number", QCP.equals, projectbill1.getString("number"))});
|
||||
if (add != null) {
|
||||
projectbill = add;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DynamicObject add = BusinessDataServiceHelper.loadSingle("repmd_project_f7",
|
||||
new QFilter[]{new QFilter("number", QCP.equals, "XM-202412-008")});
|
||||
if (add != null) {
|
||||
projectbill = add;
|
||||
}
|
||||
}
|
||||
|
||||
// 设置项目并更新视图
|
||||
this.getModel().setValue("project", projectbill);
|
||||
this.getView().updateView("project");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package shkd.repc.recon.formplugin;
|
||||
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
public class ReconPayreqProjectFormPlugin extends AbstractBillPlugIn {
|
||||
|
||||
@Override
|
||||
public void afterBindData(EventObject e) {
|
||||
super.afterBindData(e);
|
||||
//根据组织携带项目
|
||||
updateRenovationProject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
String name = e.getProperty().getName();
|
||||
//根据组织携带项目
|
||||
if ("org".equals(name)) {
|
||||
updateRenovationProject();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateRenovationProject() {
|
||||
DynamicObject org = (DynamicObject) this.getModel().getValue("org");
|
||||
|
||||
// 只有在需求组织不为空的情况下才进行查询
|
||||
if (org != null) {
|
||||
setRenovationProjectByOrg(org);
|
||||
} else {
|
||||
// 组织为空,清空项目
|
||||
this.getModel().setValue("project", null);
|
||||
this.getView().updateView("project");
|
||||
}
|
||||
}
|
||||
|
||||
private void setRenovationProjectByOrg(DynamicObject org) {
|
||||
// 检查 org 是否为 null
|
||||
if (org == null) {
|
||||
return; // 如果为 null,直接返回
|
||||
}
|
||||
|
||||
// 采购项目
|
||||
DynamicObject[] projectbills = BusinessDataServiceHelper.load("rebm_purproject", "id",
|
||||
new QFilter[]{new QFilter("org.id", QCP.equals, org.getPkValue())});
|
||||
|
||||
DynamicObject projectbill = null;
|
||||
|
||||
if (projectbills.length > 0) {
|
||||
DynamicObject projectbill1 = projectbills[0];
|
||||
if (projectbill1 != null) {
|
||||
//项目建立F7
|
||||
DynamicObject add = BusinessDataServiceHelper.loadSingle("repmd_project_f7",
|
||||
new QFilter[]{new QFilter("number", QCP.equals, projectbill1.getString("number"))});
|
||||
if (add != null) {
|
||||
projectbill = add;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DynamicObject add = BusinessDataServiceHelper.loadSingle("repmd_project_f7",
|
||||
new QFilter[]{new QFilter("number", QCP.equals, "XM-202412-008")});
|
||||
if (add != null) {
|
||||
projectbill = add;
|
||||
}
|
||||
}
|
||||
|
||||
// 设置项目并更新视图
|
||||
this.getModel().setValue("project", projectbill);
|
||||
this.getView().updateView("project");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue