劳务班组系统插件标志

This commit is contained in:
xuhaihui 2025-08-13 10:38:25 +08:00
parent 46fade1ef4
commit b208c7513b
1 changed files with 161 additions and 0 deletions

View File

@ -0,0 +1,161 @@
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package zcgj.zcdev.zcdev.pr.plugin.form;
import java.util.EventObject;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.dataentity.utils.ObjectUtils;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.form.field.BasedataEdit;
import kd.bos.form.field.FieldEdit;
import kd.bos.form.field.events.BeforeF7SelectEvent;
import kd.bos.form.field.events.BeforeF7SelectListener;
import kd.bos.form.operate.FormOperate;
import kd.bos.list.ListShowParameter;
import kd.bos.orm.query.QFilter;
public class LabourEditPluginExt extends AbstractBillPlugIn implements BeforeF7SelectListener {
public LabourEditPluginExt() {
}
public void afterCreateNewData(EventObject e) {
super.afterCreateNewData(e);
}
public void registerListener(EventObject e) {
super.registerListener(e);
BasedataEdit contract = (BasedataEdit) this.getControl("contract");
contract.addBeforeF7SelectListener(this);
BasedataEdit unitProject = (BasedataEdit) this.getControl("unitproject");
if (unitProject != null) {
unitProject.addBeforeF7SelectListener(this);
}
BasedataEdit project = (BasedataEdit) this.getControl("project");
if (project != null) {
project.addBeforeF7SelectListener(this);
}
}
public void afterBindData(EventObject e) {
super.afterBindData(e);
this.teamChanged();
this.setUnitProject();
}
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String propertyName = e.getProperty().getName();
if (StringUtils.equals(propertyName, "team")) {
this.teamChanged();
this.getModel().deleteEntryData("entryentity");
} else {
DynamicObject contract;
if (StringUtils.equals(propertyName, "supplier")) {
contract = (DynamicObject) this.getModel().getValue("supplier");
if (null != contract) {
this.getModel().setValue("supplierman", contract.getString("linkman"));
this.getModel().setValue("supplieridcard", contract.getString("tx_register_no"));
this.getModel().setValue("suppliertel", contract.getString("bizpartner_phone"));
}
} else if (StringUtils.equals(propertyName, "contract")) {
contract = (DynamicObject) this.getModel().getValue("contract");
if (null != contract && null != contract.getDynamicObject("partb")) {
this.getModel().setValue("supplier", contract.getDynamicObject("partb").getPkValue());
}
} else if (StringUtils.equals(propertyName, "project")) {
this.getModel().setValue("unitproject", (Object) null);
this.setUnitProject();
this.getView().updateView("unitproject");
}
}
}
protected void setUnitProject() {
DynamicObject project = (DynamicObject) this.getModel().getValue("project");
if (project == null) {
this.getView().setEnable(false, new String[]{"unitproject"});
} else {
boolean editOnUnit = project.getBoolean("editonunit");
FieldEdit unitProjectEdit = (FieldEdit) this.getView().getControl("unitproject");
if (editOnUnit) {
this.getView().setEnable(true, new String[]{"unitproject"});
} else {
unitProjectEdit.setMustInput(false);
this.getView().setEnable(false, new String[]{"unitproject"});
}
}
}
private void teamChanged() {
String team = (String) this.getModel().getValue("team");
BasedataEdit supplier = (BasedataEdit) this.getControl("supplier");
BasedataEdit f7pickmaterials = (BasedataEdit) this.getControl("pickmaterials");
FieldEdit pickmaterialsName = (FieldEdit) this.getControl("pickmaterialsname");
if (StringUtils.equals(team, "01")) {
supplier.setMustInput(false);
this.getView().setVisible(false, new String[]{"pickmaterialsname"});
pickmaterialsName.setMustInput(false);
this.getView().setVisible(true, new String[]{"pickmaterials"});
f7pickmaterials.setMustInput(true);
this.getModel().setValue("supplier", (Object) null);
} else if (StringUtils.equals(team, "02")) {
supplier.setMustInput(true);
this.getView().setVisible(true, new String[]{"pickmaterialsname"});
pickmaterialsName.setMustInput(true);
this.getView().setVisible(false, new String[]{"pickmaterials"});
f7pickmaterials.setMustInput(false);
}
}
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
super.beforeDoOperation(args);
FormOperate operate = (FormOperate) args.getSource();
String operateKey = operate.getOperateKey();
if (StringUtils.equals(operateKey, "save") || StringUtils.equals(operateKey, "submit")) {
String team = (String) this.getModel().getValue("team");
DynamicObjectCollection entryCollection = this.getModel().getEntryEntity("entryentity");
if (null != entryCollection && entryCollection.size() > 0) {
for (int i = 0; i < entryCollection.size(); ++i) {
if (StringUtils.equals(team, "01")) {
if (ObjectUtils.isEmpty(((DynamicObject) entryCollection.get(i)).get("pickmaterials"))) {
this.getView().showTipNotification(String.format(ResManager.loadKDString("领料人设置分录,第[%s]行领料人姓名为空。", "LabourEditPlugin_0", "ec-ecma-formplugin", new Object[0]), i + 1));
args.setCancel(true);
return;
}
} else if (StringUtils.equals(team, "02") && StringUtils.isEmpty(((DynamicObject) entryCollection.get(i)).get("pickmaterialsname").toString().trim())) {
this.getView().showTipNotification(String.format(ResManager.loadKDString("领料人设置分录,第[%s]行领料人姓名为空。", "LabourEditPlugin_0", "ec-ecma-formplugin", new Object[0]), i + 1));
args.setCancel(true);
return;
}
}
}
}
}
public void beforeF7Select(BeforeF7SelectEvent arg0) {
BasedataEdit source = (BasedataEdit) arg0.getSource();
String key = source.getFieldKey();
if (StringUtils.equals(key, "contract")) {
ListShowParameter showParameter = (ListShowParameter) arg0.getFormShowParameter();
QFilter typpeFilter = new QFilter("contracttype.contattr.basictype", "=", "03");
showParameter.getListFilterParameter().setFilter(typpeFilter);
} else if (StringUtils.equals("unitproject", key)) {
}
}
}