diff --git a/main/java/shkd/repc/rebm/formplugin/SupplierInvitationFormPlugin.java b/main/java/shkd/repc/rebm/formplugin/SupplierInvitationFormPlugin.java index 21f138c..7e39f0c 100644 --- a/main/java/shkd/repc/rebm/formplugin/SupplierInvitationFormPlugin.java +++ b/main/java/shkd/repc/rebm/formplugin/SupplierInvitationFormPlugin.java @@ -12,6 +12,7 @@ import kd.bos.entity.datamodel.IEntryOperate; import kd.bos.entity.datamodel.events.AfterAddRowEventArgs; import kd.bos.entity.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.PropertyChangedArgs; +import kd.bos.entity.operate.result.OperationResult; import kd.bos.form.control.Button; import kd.bos.form.control.Control; import kd.bos.form.control.EntryGrid; @@ -23,6 +24,8 @@ import kd.bos.form.operate.FormOperate; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.operation.DeleteServiceHelper; +import kd.bos.servicehelper.operation.OperationServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.repc.rebm.formplugin.bill.SupplierInvitationBidNumEdit; import kd.repc.resm.business.portrait.IPortraitService; @@ -50,7 +53,7 @@ public class SupplierInvitationFormPlugin extends SupplierInvitationBidNumEdit { super.beforeItemClick(evt); String itemKey = evt.getItemKey(); DynamicObject bidproject = (DynamicObject) this.getModel().getValue("bidproject"); - if ("addsupplierdetail".equals(itemKey)){ + if ("addsupplierdetail".equals(itemKey) || "addsupplierenroll".equals(itemKey) ){ EntryGrid SEEntryGrid = this.getControl("supplierenrollentry"); DynamicObjectCollection SEEntry = this.getModel().getEntryEntity("supplierenrollentry"); int[] selectRows = SEEntryGrid.getSelectRows(); @@ -58,13 +61,16 @@ public class SupplierInvitationFormPlugin extends SupplierInvitationBidNumEdit { DynamicObject dy = SEEntry.get(selectRow); DynamicObject enrollsupplier = dy.getDynamicObject("enrollsupplier");//报名供应商 if (enrollsupplier != null){ - Object enrollsupplierPkValue = enrollsupplier.getPkValue(); + Object enrollsupplierPkValue = enrollsupplier.getPkValue();//syssupplier boolean flag = checkSupplierCollection(enrollsupplierPkValue,bidproject); if (!flag){ this.createRespMyTender(enrollsupplierPkValue); - DynamicObject dataEntity = this.getModel().getDataEntity(); + DynamicObject dataEntity = this.getModel().getDataEntity(true); SaveServiceHelper.save(new DynamicObject[]{dataEntity}); } +// else { +// this.updateSupplierCollection(enrollsupplierPkValue,bidproject,adminUserId); +// } } } @@ -122,6 +128,9 @@ public class SupplierInvitationFormPlugin extends SupplierInvitationBidNumEdit { this.suppChanged("supplierentry", "bidnum", "abandonbidnum", newValue, rowIndex); }else if ("enrollsupplier".equals(name)) { newValue = (DynamicObject)changeData.getNewValue(); + if (newValue == null) { + return; + } this.suppChanged("supplierenrollentry", "enrollbidnum", "enrollabandonbidnum", newValue, rowIndex); } } @@ -184,7 +193,8 @@ public class SupplierInvitationFormPlugin extends SupplierInvitationBidNumEdit { DynamicObject bid_project = BusinessDataServiceHelper.loadSingle(bidproject_pkValue, "rebm_bidproject_f7");//获取招标立项完整数据 QFilter announcement_qf = new QFilter("project.id",QCP.equals,bidproject_pkValue);//查找招标公告 DynamicObject announcement = BusinessDataServiceHelper.loadSingle("ten_announcement_f7", announcement_qf.toArray()); - DynamicObject myTender = new DynamicObject(EntityMetadataCache.getDataEntityType("resp_mytender")); + + DynamicObject myTender = BusinessDataServiceHelper.newDynamicObject("resp_mytender"); myTender.set("name", announcement.getString("annotitle"));//招标名称:取招标立项名称 myTender.set("billstatus", "C");//默认设置状态为c myTender.set("org", bid_project.getDynamicObject("org")); @@ -193,8 +203,10 @@ public class SupplierInvitationFormPlugin extends SupplierInvitationBidNumEdit { myTender.set("tenderstatus", MyTenderStatus.APPLIED);//投标状态, 供方入围添加默认设置为已入围 myTender.set("publishdate", announcement.getDate("publishdate"));//发布日期 myTender.set("announcement", announcement);//招标公告 + DynamicObject resm_official_supplier = BusinessDataServiceHelper.loadSingle(supplierId, "resm_official_supplier"); + DynamicObject syssupplier = resm_official_supplier.getDynamicObject("syssupplier");//获取系统供应商 - Long adminUserId = SupplierHelper.listAdminUserIdBySupplier(Long.parseLong(supplierId.toString())); + Long adminUserId = SupplierHelper.listAdminUserIdBySupplier(Long.parseLong(syssupplier.getString("id"))); myTender.set("tenderer", adminUserId);//投标人 myTender.set("supplier", supplierId);//供应商 myTender.set("createtime", new Date());//创建日期 @@ -224,9 +236,22 @@ public class SupplierInvitationFormPlugin extends SupplierInvitationBidNumEdit { myTenderEntryColl.add(myTenderEntry); } myTender.set("entry", myTenderEntryColl); +// OperationResult operationResult = OperationServiceHelper.executeOperate("save", "resp_mytender", new DynamicObject[]{myTender}); SaveServiceHelper.save(new DynamicObject[]{myTender}); } +// public void updateSupplierCollection(Object supplierId,DynamicObject bidproject, Long adminUserId){ +// QFilter mytender_QF = new QFilter("bidproject.id", QCP.equals, bidproject.getPkValue()); +// mytender_QF.and("supplier.id",QCP.equals,supplierId); +// DynamicObject resp_mytender = BusinessDataServiceHelper.loadSingle("resp_mytender", mytender_QF.toArray()); +// resp_mytender.set("tenderer",adminUserId); +// Object pkValue = resp_mytender.getPkValue(); +// QFilter qFilter = new QFilter("id", QCP.equals, pkValue); +// this.getView().showTipNotification(resp_mytender.getPkValue().toString()); +//// DeleteServiceHelper.delete("resp_mytender",qFilter.toArray()); +// } + + /** * 校验供应商集合是否符合存在投标单 * @param