设备调令单表单插件逻辑优化

This commit is contained in:
xuhaihui 2025-08-14 14:27:59 +08:00
parent 58e268988a
commit 7fe122ccba
1 changed files with 10 additions and 8 deletions

View File

@ -80,7 +80,7 @@ public class EquipmentCommandBillPlugin extends AbstractBillPlugIn implements Be
ChangeData changeData = changeSet[0]; ChangeData changeData = changeSet[0];
Object newValue = changeData.getNewValue();//新值 Object newValue = changeData.getNewValue();//新值
Object oldValue = changeData.getOldValue();//旧值 Object oldValue = changeData.getOldValue();//旧值
if (newValue == null || !newValue.equals(oldValue)) { if ((newValue == null || !newValue.equals(oldValue)) && oldValue != null) {
if (StringUtil.equals(key, "zcgj_outorg")) { if (StringUtil.equals(key, "zcgj_outorg")) {
//调出组织 //调出组织
DynamicObjectCollection dispatchEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_dispatchentry");//调出资产详情分录 DynamicObjectCollection dispatchEntryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_dispatchentry");//调出资产详情分录
@ -100,13 +100,15 @@ public class EquipmentCommandBillPlugin extends AbstractBillPlugIn implements Be
if (newValue != null) { if (newValue != null) {
DynamicObject newValueDy = (DynamicObject) newValue; DynamicObject newValueDy = (DynamicObject) newValue;
QFilter[] qFilters = new QFilter[]{new QFilter("billno", QCP.equals, newValueDy.getString("number"))}; QFilter[] qFilters = new QFilter[]{new QFilter("billno", QCP.equals, newValueDy.getString("number"))};
DynamicObject ec_project = BusinessDataServiceHelper.loadSingle("ec_project", "id,zcgj_pm", qFilters);//项目 DynamicObject ec_project = BusinessDataServiceHelper.loadSingle("ec_project", "id,zcgj_pm,fiaccountorg", qFilters);//项目
if (ec_project != null) { if (ec_project != null) {
if (StringUtil.equals(key, "zcgj_outproject")) { if (StringUtil.equals(key, "zcgj_outproject")) {
//调出项目 //调出项目
this.getModel().setValue("zcgj_outuser", ec_project.get("zcgj_pm"));//调出负责人 this.getModel().setValue("zcgj_outuser", ec_project.get("zcgj_pm"));//调出负责人
this.getModel().setValue("zcgj_outorg", ec_project.get("fiaccountorg"));//调出组织
} else { } else {
this.getModel().setValue("zcgj_inuser", ec_project.get("zcgj_pm"));//调出负责人 this.getModel().setValue("zcgj_inuser", ec_project.get("zcgj_pm"));//调入负责人
this.getModel().setValue("zcgj_inorg", ec_project.get("fiaccountorg"));//调入组织
} }
} }
} }
@ -142,8 +144,8 @@ public class EquipmentCommandBillPlugin extends AbstractBillPlugIn implements Be
// 调出项目 // 调出项目
Object outOrg = this.getModel().getValue("zcgj_outorg");//调出组织 Object outOrg = this.getModel().getValue("zcgj_outorg");//调出组织
if (outOrg == null) { if (outOrg == null) {
this.getView().showErrorNotification("请先填写调出组织!"); // this.getView().showErrorNotification("请先填写调出组织!");
beforeF7SelectEvent.setCancel(true); // beforeF7SelectEvent.setCancel(true);
return; return;
} }
DynamicObject outOrgDy = (DynamicObject) outOrg;//调出组织 DynamicObject outOrgDy = (DynamicObject) outOrg;//调出组织
@ -162,13 +164,13 @@ public class EquipmentCommandBillPlugin extends AbstractBillPlugIn implements Be
//调入项目 //调入项目
Object inOrg = this.getModel().getValue("zcgj_inorg");//调入组织 Object inOrg = this.getModel().getValue("zcgj_inorg");//调入组织
if (inOrg == null) { if (inOrg == null) {
this.getView().showErrorNotification("请先填写调入组织!"); // this.getView().showErrorNotification("请先填写调入组织!");
beforeF7SelectEvent.setCancel(true); // beforeF7SelectEvent.setCancel(true);
return; return;
} }
DynamicObject inOrgDy = (DynamicObject) inOrg; DynamicObject inOrgDy = (DynamicObject) inOrg;
QFilter filter = new QFilter("fiaccountorg.id", "=", inOrgDy.get("id")); QFilter filter = new QFilter("fiaccountorg.id", "=", inOrgDy.get("id"));
DynamicObject[] projectF7s = BusinessDataServiceHelper.load("ec_ecbd_projectf7", "id", new QFilter[]{filter}); DynamicObject[] projectF7s = BusinessDataServiceHelper.load("ec_ecbd_projectf7", "id", new QFilter[]{filter});//工程项目
List<Long> projectF7Ids = getIdsFromDynamicObjects(projectF7s); List<Long> projectF7Ids = getIdsFromDynamicObjects(projectF7s);
qFilters.add(new QFilter("id", QCP.in, projectF7Ids)); qFilters.add(new QFilter("id", QCP.in, projectF7Ids));
// beforeF7SelectEvent.setCancel(true); // beforeF7SelectEvent.setCancel(true);