parent
e6d8e169d2
commit
02e9989768
|
|
@ -4,51 +4,50 @@ import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.entity.EntityMetadataCache;
|
import kd.bos.entity.EntityMetadataCache;
|
||||||
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||||
import kd.bos.form.control.events.BeforeItemClickEvent;
|
import kd.bos.form.control.events.BeforeItemClickEvent;
|
||||||
|
import kd.bos.form.events.SetFilterEvent;
|
||||||
import kd.bos.list.BillList;
|
import kd.bos.list.BillList;
|
||||||
|
import kd.bos.list.ListShowParameter;
|
||||||
import kd.bos.list.plugin.AbstractListPlugin;
|
import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static kd.fi.cas.helper.PayBillListPlugnHelper.getFcaFilter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标准单据列表插件
|
* 标准单据列表插件
|
||||||
* 付款处理-取消付款校验
|
* 付款处理-取消付款校验
|
||||||
*/
|
*/
|
||||||
public class PayBillListPlugin extends AbstractListPlugin implements Plugin {
|
public class PayBillListPlugin extends AbstractListPlugin implements Plugin {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeItemClick(BeforeItemClickEvent evt) {
|
public void setFilter(SetFilterEvent e) {
|
||||||
super.beforeItemClick(evt);
|
super.setFilter(e);
|
||||||
|
ListShowParameter listShowParameter = (ListShowParameter)this.getView().getFormShowParameter();
|
||||||
String key = evt.getItemKey().toLowerCase();
|
if (!"付款处理".equals(listShowParameter.getCaption())) {
|
||||||
if ("tblcancelpay".equals(key)){
|
|
||||||
BillList list = (BillList) this.getView().getControl("billlistap");
|
|
||||||
ListSelectedRowCollection selectedRows = list.getSelectedRows();
|
|
||||||
if (selectedRows == null || selectedRows.isEmpty()) {
|
|
||||||
this.getView().showTipNotification("请选择需要操作的付款单!");
|
|
||||||
evt.setCancel(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (selectedRows.size()>1){
|
List<QFilter> qFilters = e.getQFilters();
|
||||||
this.getView().showTipNotification("请选择单条数据进行操作");
|
HashSet<Long> value = new HashSet<>();
|
||||||
evt.setCancel(true);
|
for (QFilter qFilter : qFilters) {
|
||||||
return;
|
if (qFilter.toString().contains("billtype")) {
|
||||||
|
List<QFilter.QFilterNest> nests = qFilter.getNests(true);
|
||||||
|
for (QFilter.QFilterNest nest : nests) {
|
||||||
|
String string1 = nest.toString();
|
||||||
|
if (string1.contains("billtype")) {
|
||||||
|
value = (HashSet<Long>)nest.getFilter().getValue();
|
||||||
|
value.add(993266082510901248L);
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicObject recBill= BusinessDataServiceHelper.loadSingle(
|
|
||||||
selectedRows.get(0).getPrimaryKeyValue(),
|
|
||||||
EntityMetadataCache.getDataEntityType("cas_paybill"));
|
|
||||||
this.cancelPayValidator(evt,recBill);
|
|
||||||
}
|
}
|
||||||
|
nests.clear();
|
||||||
|
qFilters.remove(qFilter);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelPayValidator(BeforeItemClickEvent evt, DynamicObject recBill) {
|
|
||||||
boolean ispushsap = recBill.getBoolean("shjh_ispushsap");
|
|
||||||
if (ispushsap){
|
|
||||||
this.getView().showTipNotification("已推送SAP,不允许取消付款!");
|
|
||||||
evt.setCancel(true);
|
|
||||||
}
|
}
|
||||||
|
qFilters.add(new QFilter("billtype", QCP.in, value).and("iswaitsche", QCP.equals, '0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue