2024-11-18 06:07:13 +00:00
|
|
|
package shkd.repc.repmd.formplugin;
|
|
|
|
|
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
import kd.bos.dataentity.entity.OrmLocaleValue;
|
|
|
|
import kd.bos.form.FormShowParameter;
|
|
|
|
import kd.bos.form.field.BasedataEdit;
|
|
|
|
import kd.bos.form.field.events.BeforeQuickAddNewEvent;
|
|
|
|
import kd.bos.form.field.events.BeforeQuickAddNewListener;
|
|
|
|
import kd.bos.form.operate.FormOperate;
|
|
|
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
|
|
|
|
|
|
|
import java.util.EventObject;
|
|
|
|
|
|
|
|
public class ProjectBillPlugin extends AbstractFormPlugin implements BeforeQuickAddNewListener {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerListener(EventObject e) {
|
|
|
|
super.registerListener(e);
|
|
|
|
BasedataEdit qeug_gcl = this.getControl("qeug_gcl");
|
|
|
|
qeug_gcl.addBeforeQuickAddNewListener(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void beforeQuickAddNew(BeforeQuickAddNewEvent beforeQuickAddNewEvent) {
|
|
|
|
|
|
|
|
BasedataEdit operate = (BasedataEdit)beforeQuickAddNewEvent.getSource();
|
|
|
|
String operateKey = String.valueOf(operate.getDisplayName());
|
|
|
|
int productentry = this.getModel().getEntryCurrentRowIndex("productentry");
|
|
|
|
if (operateKey.equals("工程量")){
|
|
|
|
FormShowParameter showParameter = beforeQuickAddNewEvent.getShowParameter();
|
|
|
|
|
|
|
|
String billno = (String) this.getModel().getValue("billno");
|
|
|
|
if (billno == null || billno.isEmpty()) {
|
|
|
|
beforeQuickAddNewEvent.setCancel(true);
|
|
|
|
this.getView().showSuccessNotification("请填写项目编号");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
OrmLocaleValue billname = (OrmLocaleValue) this.getModel().getValue("billname");
|
|
|
|
String zh_cn = billname.get("zh_CN");
|
|
|
|
if (billname.size()==0) {
|
|
|
|
beforeQuickAddNewEvent.setCancel(true);
|
|
|
|
this.getView().showSuccessNotification("请填写项目名称");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
DynamicObject productentry_producttype = (DynamicObject) this.getModel().getValue("productentry_producttype",productentry);
|
|
|
|
if (productentry_producttype==null){
|
|
|
|
beforeQuickAddNewEvent.setCancel(true);
|
|
|
|
this.getView().showSuccessNotification("请填写对应行的产品类型");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
showParameter.setCustomParam("billno",billno);
|
|
|
|
showParameter.setCustomParam("billname",zh_cn);
|
|
|
|
showParameter.setCustomParam("productentry_producttype",productentry_producttype.getPkValue().toString());
|
2024-11-18 09:04:00 +00:00
|
|
|
showParameter.setCustomParam("operateKey",operateKey);
|
|
|
|
|
2024-11-18 06:07:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|