From 7ff7e300650b8f0bc356b2b7b1b2104172b9837b Mon Sep 17 00:00:00 2001 From: zengweihai Date: Thu, 14 Nov 2024 18:39:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9B=E6=96=B9=E5=85=A5=E5=9B=B4=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=8A=A5=E5=90=8D=E4=BE=9B=E5=BA=94=E5=95=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BA=8C=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SupplierInvitationFormPlugin.java | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 main/java/shkd/repc/rebm/formplugin/SupplierInvitationFormPlugin.java diff --git a/main/java/shkd/repc/rebm/formplugin/SupplierInvitationFormPlugin.java b/main/java/shkd/repc/rebm/formplugin/SupplierInvitationFormPlugin.java new file mode 100644 index 0000000..685860a --- /dev/null +++ b/main/java/shkd/repc/rebm/formplugin/SupplierInvitationFormPlugin.java @@ -0,0 +1,88 @@ +package shkd.repc.rebm.formplugin; + +import com.grapecity.documents.excel.B; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.datamodel.events.ChangeData; +import kd.bos.entity.datamodel.events.PropertyChangedArgs; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.SaveServiceHelper; +import kd.repc.rebm.formplugin.bill.SupplierInvitationBidNumEdit; +import kd.repc.resm.business.portrait.IPortraitService; +import kd.repc.resm.business.portrait.PortraitServiceImpl; + +public class SupplierInvitationFormPlugin extends SupplierInvitationBidNumEdit { + + IPortraitService portraitService = new PortraitServiceImpl(); + @Override + public void propertyChanged(PropertyChangedArgs args) { + ChangeData changeData = args.getChangeSet()[0]; + String name = args.getProperty().getName(); + int rowIndex = changeData.getRowIndex(); + DynamicObject newValue; + if ("supplier".equals(name)) { + newValue = (DynamicObject)changeData.getNewValue(); + if (newValue == null) { + return; + } + this.suppChanged("supplierentry", "bidnum", "abandonbidnum", newValue, rowIndex); + }else if ("enrollsupplier".equals(name)) { + newValue = (DynamicObject)changeData.getNewValue(); + this.suppChanged("supplierenrollentry", "enrollbidnum", "enrollabandonbidnum", newValue, rowIndex); + } + } + + @Override + public void suppChanged(String entryName, String bidName, String abandonBidName, DynamicObject newValue, int rowIndex) { + DynamicObject dataEntity = this.getModel().getDataEntity(true); + DynamicObjectCollection supplierentry = this.getModel().getEntryEntity(entryName); + Object suppPk = newValue.getPkValue(); + Object belongOrgId = dataEntity.getDynamicObject("bidproject").getDynamicObject("org").getPkValue(); + DynamicObject suppRow = (DynamicObject)supplierentry.get(rowIndex); + DynamicObject libraryForBid = this.portraitService.getLibraryForBid(suppPk, belongOrgId); + if (libraryForBid != null) { + Integer bidnum = libraryForBid.getInt("bid_bidnum"); + Integer outnum = libraryForBid.getInt("bid_outnum"); + suppRow.set(bidName, bidnum); + suppRow.set(abandonBidName, outnum); + DynamicObject supplierstatistic = suppRow.getDynamicObject("enrollsupplierstatistic"); + if (supplierstatistic != null) { + supplierstatistic.set("invitedqty", libraryForBid.getInt("bid_shortlistednum")); + supplierstatistic.set("wonqty", libraryForBid.getInt("bid_winningnum")); + if (!"0".equals(supplierstatistic.getString("id"))) { + SaveServiceHelper.update(supplierstatistic); + } + }else { + //todo:根据系统供应商字段匹配当前供应商统计数据 + QFilter qFilter = new QFilter("supplier.id", QCP.equals, suppPk); + //获取系统预置供应商统计数据 + DynamicObject rebm_supplierstatistic = BusinessDataServiceHelper.loadSingle("rebm_supplierstatistic", qFilter.toArray()); + DynamicObject resm_official_supplier = BusinessDataServiceHelper.loadSingle(suppPk, "resm_official_supplier"); + DynamicObjectCollection entry_linkman = resm_official_supplier.getDynamicObjectCollection("entry_linkman");//查询联系人分录数据 + for (DynamicObject dynamicObject : entry_linkman) { + boolean isdefault_linkman = dynamicObject.getBoolean("isdefault_linkman"); + boolean isopenaccount = dynamicObject.getBoolean("isopenaccount"); + if (isopenaccount && isdefault_linkman){ + suppRow.set("enrollsuppliercontact",dynamicObject.getString("contactperson"));//联系人名称 + String contactphone = dynamicObject.getString("contactphone"); + if (contactphone.contains("+86-")){ + String substring = contactphone.substring(4, contactphone.length()); + suppRow.set("enrollcontactphone",substring);//手机号 + }else { + suppRow.set("enrollcontactphone",contactphone);//手机号 + } + + suppRow.set("enrollemail",dynamicObject.getString("contactemail"));//手机号 + break; + } + } + suppRow.set("enrollsupplierstatistic",rebm_supplierstatistic); + } + + this.getView().updateView(entryName); + } + } +} +