被动付款入账进入付款单报错

This commit is contained in:
李贵强 2025-07-25 16:54:32 +08:00
parent a867f1154f
commit e33b267b6f
2 changed files with 28 additions and 2 deletions

View File

@ -106,7 +106,8 @@ public class CimFinancialBillPlugin extends AbstractBillPlugIn implements Plugin
for (DynamicObject item : entryEntity) { for (DynamicObject item : entryEntity) {
int currentSeq = item.getInt("seq"); int currentSeq = item.getInt("seq");
if (currentSeq==0){ if (currentSeq==0){
throw new RuntimeException("初始行不可删除!"); this.getView().showMessage("初始行不可删除!");
return null;
} }
if (currentSeq > maxSeq) { if (currentSeq > maxSeq) {
maxSeq = currentSeq; maxSeq = currentSeq;

View File

@ -8,11 +8,15 @@ 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.ListShowParameter;
import kd.bos.list.plugin.AbstractListPlugin; import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.orm.query.QCP; import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter; 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 shjh.jhzj7.fi.fi.plugin.operate.ApplyTransBillSaveOperation;
import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -23,6 +27,9 @@ import static kd.fi.cas.helper.PayBillListPlugnHelper.getFcaFilter;
* 付款处理-取消付款校验 * 付款处理-取消付款校验
*/ */
public class PayBillListPlugin extends AbstractListPlugin implements Plugin { public class PayBillListPlugin extends AbstractListPlugin implements Plugin {
private static final Log logger = LogFactory.getLog(PayBillListPlugin.class);
@Override @Override
public void setFilter(SetFilterEvent e) { public void setFilter(SetFilterEvent e) {
super.setFilter(e); super.setFilter(e);
@ -30,15 +37,32 @@ public class PayBillListPlugin extends AbstractListPlugin implements Plugin {
if (!"付款处理".equals(listShowParameter.getCaption())) { if (!"付款处理".equals(listShowParameter.getCaption())) {
return; return;
} }
List<QFilter> qFilters = e.getQFilters(); List<QFilter> qFilters = e.getQFilters();
HashSet<Long> value = new HashSet<>(); HashSet<Long> value = new HashSet<>();
for (QFilter qFilter : qFilters) { for (QFilter qFilter : qFilters) {
if (qFilter.toString().contains("billtype")) { if (qFilter.toString().contains("billtype")) {
List<QFilter.QFilterNest> nests = qFilter.getNests(true); List<QFilter.QFilterNest> nests = qFilter.getNests(true);
for (QFilter.QFilterNest nest : nests) { for (QFilter.QFilterNest nest : nests) {
String string1 = nest.toString(); String string1 = nest.toString();
if (string1.contains("billtype")) { if (string1.contains("billtype")) {
value = (HashSet<Long>)nest.getFilter().getValue(); // 修改这里正确处理获取的值
Object filterValue = nest.getFilter().getValue();
if (filterValue instanceof String[]) {
String[] stringValues = (String[])filterValue;
for (String str : stringValues) {
try {
value.add(Long.parseLong(str));
} catch (NumberFormatException ex) {
// 处理转换失败的情况
logger.error("无法转换字符串到Long: " + str, ex);
}
}
} else if (filterValue instanceof Collection) {
// 如果已经是集合类型直接转换
value = new HashSet<>((Collection<Long>)filterValue);
}
value.add(993266082510901248L); value.add(993266082510901248L);
} }
} }
@ -47,6 +71,7 @@ public class PayBillListPlugin extends AbstractListPlugin implements Plugin {
break; break;
} }
} }
qFilters.add(new QFilter("billtype", QCP.in, value).and("iswaitsche", QCP.equals, '0')); qFilters.add(new QFilter("billtype", QCP.in, value).and("iswaitsche", QCP.equals, '0'));
} }