提交人:陈绍鑫

日期:2025/7/16 17:00
内容:拉单优化
This commit is contained in:
陈绍鑫 2025-07-17 14:12:00 +08:00
parent 1a235ad038
commit 03cc4ee2d3
2 changed files with 31 additions and 12 deletions

View File

@ -47,6 +47,7 @@ import kd.fi.cas.util.EmptyUtil;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 单据界面插件 * 单据界面插件
@ -122,8 +123,8 @@ public class CasRecbillFormPlugin extends AbstractBillPlugIn implements BeforeF7
logger.info("单据编号"+cdm_drafttradebill.getString("billno")+"取消完成失败"); logger.info("单据编号"+cdm_drafttradebill.getString("billno")+"取消完成失败");
this.getView().showSuccessNotification("单据编号"+cdm_drafttradebill.getString("billno")+"取消确认完成失败,请检查并手动取消完成"); this.getView().showSuccessNotification("单据编号"+cdm_drafttradebill.getString("billno")+"取消确认完成失败,请检查并手动取消完成");
} }
this.getModel().setValue("draftbill",null); // this.getModel().setValue("draftbill",null);
this.getModel().setValue("settletnumber",null); // this.getModel().setValue("settletnumber",null);
} }
this.getView().invokeOperation("drawauto"); this.getView().invokeOperation("drawauto");
}else { }else {
@ -143,6 +144,7 @@ public class CasRecbillFormPlugin extends AbstractBillPlugIn implements BeforeF7
} }
this.getModel().setValue("draftbill",null); this.getModel().setValue("draftbill",null);
this.getModel().setValue("settletnumber",null); this.getModel().setValue("settletnumber",null);
this.getModel().getDataEntity(true).set("cas_draftinfo",null);
SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity(true)}); SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity(true)});
// this.getView().invokeOperation("save"); // this.getView().invokeOperation("save");
} }
@ -383,13 +385,20 @@ public class CasRecbillFormPlugin extends AbstractBillPlugIn implements BeforeF7
if (entry.size()>entrysize){ if (entry.size()>entrysize){
for (int i =entrysize ; i < entry.size(); i++) { for (int i =entrysize ; i < entry.size(); i++) {
this.getView().getModel().deleteEntryRow("entry", i);//删除生成的行 this.getView().getModel().deleteEntryRow("entry", i);//删除生成的行
i--;
} }
} }
DynamicObjectCollection dynamicObjectCollection = (BusinessDataServiceHelper.loadSingle(cdm_drafttradebill.getLong("id"), cdm_drafttradebill.getDataEntityType().getName())).getDynamicObjectCollection("entrys");
List<String> billno = dynamicObjectCollection.stream()
.map(e -> e.getDynamicObject("draftbill").getString("billno"))
.collect(Collectors.toList());
DynamicObjectCollection cas_draftinfo = (DynamicObjectCollection) this.getView().getModel().getValue("cas_draftinfo"); DynamicObjectCollection cas_draftinfo = (DynamicObjectCollection) this.getView().getModel().getValue("cas_draftinfo");
if (cas_draftinfo.size()>cas_draftinfosize){ for (int i = 0; i < cas_draftinfo.size(); i++) {
for (int i = 0; i < cas_draftinfosize; i++) { DynamicObject draftbillinfo = cas_draftinfo.get(i).getDynamicObject("draftbillinfo");//结算号
this.getView().getModel().deleteEntryRow("cas_draftinfo", i);//删除原有的行 if (!billno.contains(draftbillinfo.getString("billno"))){
} this.getView().getModel().deleteEntryRow("cas_draftinfo", i);//删除生成的行
i--;
};
} }
this.getView().updateView(); this.getView().updateView();

View File

@ -41,6 +41,7 @@ import kd.fi.cas.util.EmptyUtil;
import kd.sdk.plugin.Plugin; import kd.sdk.plugin.Plugin;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
public class PaymentDealBillPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener { public class PaymentDealBillPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener {
private static final Log logger = LogFactory.getLog(PaymentProcessingBillPlugin.class); private static final Log logger = LogFactory.getLog(PaymentProcessingBillPlugin.class);
@ -107,8 +108,8 @@ public class PaymentDealBillPlugin extends AbstractBillPlugIn implements Plugin,
logger.info("单据编号"+cdm_drafttradebill.getString("billno")+"取消完成失败"); logger.info("单据编号"+cdm_drafttradebill.getString("billno")+"取消完成失败");
this.getView().showSuccessNotification("单据编号"+cdm_drafttradebill.getString("billno")+"取消确认完成失败,请检查并手动取消完成"); this.getView().showSuccessNotification("单据编号"+cdm_drafttradebill.getString("billno")+"取消确认完成失败,请检查并手动取消完成");
} }
this.getModel().setValue("draftbill",null); // this.getModel().setValue("draftbill",null);
this.getModel().setValue("settletnumber",null); // this.getModel().setValue("settletnumber",null);
} }
this.getView().invokeOperation("drawauto"); this.getView().invokeOperation("drawauto");
}else { }else {
@ -128,10 +129,12 @@ public class PaymentDealBillPlugin extends AbstractBillPlugIn implements Plugin,
} }
this.getModel().setValue("draftbill",null); this.getModel().setValue("draftbill",null);
this.getModel().setValue("settletnumber",null); this.getModel().setValue("settletnumber",null);
this.getModel().getDataEntity(true).set("cas_draftinfo",null);
SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity(true)}); SaveServiceHelper.save(new DynamicObject[]{this.getView().getModel().getDataEntity(true)});
} }
} }
} }
} }
public void afterBindData(EventObject e) { public void afterBindData(EventObject e) {
DynamicObject settleType; DynamicObject settleType;
@ -236,13 +239,20 @@ public class PaymentDealBillPlugin extends AbstractBillPlugIn implements Plugin,
if (entry.size()>entrysize){ if (entry.size()>entrysize){
for (int i =entrysize ; i < entry.size(); i++) { for (int i =entrysize ; i < entry.size(); i++) {
this.getView().getModel().deleteEntryRow("entry", i);//删除生成的行 this.getView().getModel().deleteEntryRow("entry", i);//删除生成的行
i--;
} }
} }
DynamicObjectCollection dynamicObjectCollection = (BusinessDataServiceHelper.loadSingle(cdm_drafttradebill.getLong("id"), cdm_drafttradebill.getDataEntityType().getName())).getDynamicObjectCollection("entrys");
List<String> billno = dynamicObjectCollection.stream()
.map(e -> e.getDynamicObject("draftbill").getString("billno"))
.collect(Collectors.toList());
DynamicObjectCollection cas_draftinfo = (DynamicObjectCollection) this.getView().getModel().getValue("cas_draftinfo"); DynamicObjectCollection cas_draftinfo = (DynamicObjectCollection) this.getView().getModel().getValue("cas_draftinfo");
if (cas_draftinfo.size()>cas_draftinfosize){ for (int i = 0; i < cas_draftinfo.size(); i++) {
for (int i = 0; i < cas_draftinfosize; i++) { DynamicObject draftbillinfo = cas_draftinfo.get(i).getDynamicObject("draftbillinfo");//结算号
this.getView().getModel().deleteEntryRow("cas_draftinfo", i);//删除原有的行 if (!billno.contains(draftbillinfo.getString("billno"))){
} this.getView().getModel().deleteEntryRow("cas_draftinfo", i);//删除生成的行
i--;
};
} }
this.getView().updateView(); this.getView().updateView();