parent
5e0a0af3a6
commit
52c16c7e5a
|
@ -0,0 +1,58 @@
|
||||||
|
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());
|
||||||
|
showParameter.setCustomParam("versionnum",this.getModel().getValue("versionnum"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package shkd.repc.repmd.formplugin;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.operate.Save;
|
||||||
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
|
import kd.bos.form.operate.FormOperate;
|
||||||
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.QueryServiceHelper;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
public class WorkQuantityPlugin extends AbstractFormPlugin {
|
||||||
|
@Override
|
||||||
|
public void afterBindData(EventObject e) {
|
||||||
|
super.afterBindData(e);
|
||||||
|
String billno = this.getView().getFormShowParameter().getCustomParam("billno");
|
||||||
|
String billname = this.getView().getFormShowParameter().getCustomParam("billname");
|
||||||
|
String versionnum = this.getView().getFormShowParameter().getCustomParam("versionnum");
|
||||||
|
String productentry_producttype = this.getView().getFormShowParameter().getCustomParam("productentry_producttype");
|
||||||
|
this.getModel().setValue("qeug_xmnumber",billno);
|
||||||
|
this.getModel().setValue("name",billname);
|
||||||
|
this.getModel().setValue("qeug_cpmc",productentry_producttype);
|
||||||
|
this.getModel().setValue("qeug_bbh",versionnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||||
|
if (args.getSource() instanceof Save){
|
||||||
|
String qeug_xmnumber = (String) this.getModel().getValue("qeug_xmnumber");
|
||||||
|
String qeug_bbh = (String) this.getModel().getValue("qeug_bbh");
|
||||||
|
QFilter filter = new QFilter("qeug_xmnumber", QCP.equals, qeug_xmnumber).and(new QFilter("qeug_bbh", QCP.equals, qeug_bbh));
|
||||||
|
DynamicObjectCollection query = QueryServiceHelper.query("qeug_gcl", "id", filter.toArray());
|
||||||
|
if (query.size()!=0){
|
||||||
|
this.getView().showSuccessNotification("已存在当前版本号的项目数据,不允许保存");
|
||||||
|
args.setCancel(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
||||||
|
if (afterDoOperationEventArgs.getSource() instanceof Save){
|
||||||
|
this.getView().invokeOperation("submit");
|
||||||
|
this.getView().invokeOperation("audit");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue