付款单取消付款校验
This commit is contained in:
parent
281f6f497e
commit
5e98e9e32c
|
|
@ -0,0 +1,48 @@
|
||||||
|
package shjh.jhzj7.fi.fi.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.form.control.events.BeforeItemClickEvent;
|
||||||
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态表单插件
|
||||||
|
* 付款处理表单插件
|
||||||
|
*/
|
||||||
|
public class PayBillFromPlugin extends AbstractFormPlugin implements Plugin {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
this.addItemClickListeners("tbmain");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeItemClick(BeforeItemClickEvent evt) {
|
||||||
|
super.beforeItemClick(evt);
|
||||||
|
String key = evt.getItemKey().toLowerCase();
|
||||||
|
if ("bar_cancelpay".equals(key)) {
|
||||||
|
this.cancelRecValidator(evt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已推送SAP不允许取消付款
|
||||||
|
* @param evt
|
||||||
|
*/
|
||||||
|
private void cancelRecValidator(BeforeItemClickEvent evt) {
|
||||||
|
String billno = (String)this.getModel().getValue("billno");
|
||||||
|
DynamicObject recObj = BusinessDataServiceHelper.loadSingle("cas_paybill", "id,billno,shjh_ispushsap", new QFilter[]{new QFilter("billno", "=", billno)});
|
||||||
|
boolean ispushsap = recObj.getBoolean("shjh_ispushsap");
|
||||||
|
if (ispushsap){
|
||||||
|
this.getView().showTipNotification("已推送SAP,不允许取消付款!");
|
||||||
|
evt.setCancel(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package shjh.jhzj7.fi.fi.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.EntityMetadataCache;
|
||||||
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||||
|
import kd.bos.form.control.events.BeforeItemClickEvent;
|
||||||
|
import kd.bos.list.BillList;
|
||||||
|
import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标准单据列表插件
|
||||||
|
* 付款处理-取消付款校验
|
||||||
|
*/
|
||||||
|
public class PayBillListPlugin extends AbstractListPlugin implements Plugin {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeItemClick(BeforeItemClickEvent evt) {
|
||||||
|
super.beforeItemClick(evt);
|
||||||
|
BillList list = (BillList) this.getView().getControl("billlistap");
|
||||||
|
ListSelectedRowCollection selectedRows = list.getSelectedRows();
|
||||||
|
if (selectedRows == null || selectedRows.isEmpty()) {
|
||||||
|
this.getView().showTipNotification("请选择需要操作的付款单!");
|
||||||
|
evt.setCancel(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (selectedRows.size()>1){
|
||||||
|
this.getView().showTipNotification("请选择单条数据进行操作");
|
||||||
|
evt.setCancel(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DynamicObject recBill= BusinessDataServiceHelper.loadSingle(
|
||||||
|
selectedRows.get(0).getPrimaryKeyValue(),
|
||||||
|
EntityMetadataCache.getDataEntityType("cas_paybill"));
|
||||||
|
|
||||||
|
String key = evt.getItemKey().toLowerCase();
|
||||||
|
if ("tblcancelpay".equals(key)){
|
||||||
|
this.cancelPayValidator(evt,recBill);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelPayValidator(BeforeItemClickEvent evt, DynamicObject recBill) {
|
||||||
|
boolean ispushsap = recBill.getBoolean("shjh_ispushsap");
|
||||||
|
if (ispushsap){
|
||||||
|
this.getView().showTipNotification("已推送SAP,不允许取消付款!");
|
||||||
|
evt.setCancel(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -46,7 +46,7 @@ public class RecBillChangeListExtendPlugin extends AbstractListPlugin implements
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selectedRows.size()>1){
|
if (selectedRows.size()>1){
|
||||||
this.getView().showTipNotification("请选择单条数据进行变更");
|
this.getView().showTipNotification("请选择单条数据进行操作");
|
||||||
evt.setCancel(true);
|
evt.setCancel(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue