diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialOutBillEditPluginExt.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialOutBillEditPluginExt.java new file mode 100644 index 0000000..49e36e0 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/MaterialOutBillEditPluginExt.java @@ -0,0 +1,79 @@ +package zcgj.zcdev.zcdev.pr.plugin.form; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.dataentity.entity.LocaleString; +import kd.bos.form.field.BasedataEdit; +import kd.bos.form.field.ComboEdit; +import kd.bos.form.field.ComboItem; +import kd.ec.material.formplugin.MaterialOutBillEditPlugin; + +import java.util.ArrayList; +import java.util.EventObject; +import java.util.Iterator; + +/** + * 出库单扩展系统代码:修改领料人必填逻辑 + */ +public class MaterialOutBillEditPluginExt extends MaterialOutBillEditPlugin { + public MaterialOutBillEditPluginExt() { + } + + public void afterBindData(EventObject e) { + super.afterBindData(e); + DynamicObject labour = (DynamicObject) this.getModel().getValue("labour"); + this.buildRequestPerson(labour); + this.setProjectAndUnitProEable(); + this.setUnitProject(); + this.setMustInputByCostType((String) this.getModel().getValue("costtype")); + } + + protected void buildRequestPerson(DynamicObject labour) { + BasedataEdit reqPersonF7; + if (labour != null) { + String team = labour.getString("team"); + if ("01".equals(team)) { + ComboEdit reqPersonCombo = (ComboEdit) this.getControl("reqpersonname"); + this.getView().setVisible(false, new String[]{"reqpersonname"}); + reqPersonCombo.setMustInput(false); + BasedataEdit reqPersonF71 = (BasedataEdit) this.getControl("requestperson"); + this.getView().setVisible(true, new String[]{"requestperson"}); +// reqPersonF71.setMustInput(true); + } else if ("02".equals(team)) { + reqPersonF7 = (BasedataEdit) this.getControl("requestperson"); + this.getView().setVisible(false, new String[]{"requestperson"}); + reqPersonF7.setMustInput(false); + ComboEdit reqPersonCombo = (ComboEdit) this.getControl("reqpersonname"); + this.getView().setVisible(true, new String[]{"reqpersonname"}); + reqPersonCombo.setMustInput(true); + DynamicObjectCollection personEntryEntitys = labour.getDynamicObjectCollection("entryentity"); + ArrayList comboList = new ArrayList(); + if (personEntryEntitys != null && personEntryEntitys.size() > 0) { + Iterator var7 = personEntryEntitys.iterator(); + + while (var7.hasNext()) { + DynamicObject person = (DynamicObject) var7.next(); + ComboItem comboItem = new ComboItem(); + LocaleString localeString = new LocaleString(); + String personName = person.getString("pickmaterialsname"); + localeString.setLocaleValue(personName); + comboItem.setCaption(localeString); + comboItem.setValue(personName); + comboList.add(comboItem); + } + } + + reqPersonCombo.setComboItems(comboList); + } + } else { + ComboEdit reqPersonCombo = (ComboEdit) this.getControl("reqpersonname"); + this.getView().setVisible(false, new String[]{"reqpersonname"}); + reqPersonCombo.setMustInput(false); + reqPersonF7 = (BasedataEdit) this.getControl("requestperson"); + this.getView().setVisible(true, new String[]{"requestperson"}); +// reqPersonF7.setMustInput(true);//系统代码 + reqPersonF7.setMustInput(false);//二开系统代码 + } + + } +}