供方入围可添加供应商
This commit is contained in:
parent
6ac2d09c7d
commit
756428b3e2
|
@ -1,10 +1,21 @@
|
|||
package shkd.repc.rebm.formplugin;
|
||||
|
||||
import com.grapecity.documents.excel.B;
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.resource.ResManager;
|
||||
import kd.bos.entity.EntityMetadataCache;
|
||||
import kd.bos.entity.EntityType;
|
||||
import kd.bos.entity.datamodel.IDataModel;
|
||||
import kd.bos.entity.datamodel.IEntryOperate;
|
||||
import kd.bos.entity.datamodel.events.ChangeData;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.form.control.Control;
|
||||
import kd.bos.form.control.EntryGrid;
|
||||
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||
import kd.bos.form.operate.FormOperate;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
@ -12,10 +23,57 @@ 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;
|
||||
import kd.scm.bid.common.enums.MyTenderStatus;
|
||||
import kd.scm.bid.common.util.SupplierHelper;
|
||||
import kd.scm.ten.common.util.BackBidWayUtil;
|
||||
import kd.scm.ten.common.util.CommonUtil;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class SupplierInvitationFormPlugin extends SupplierInvitationBidNumEdit {
|
||||
|
||||
IPortraitService portraitService = new PortraitServiceImpl();
|
||||
private HashMap<String, DynamicObject> projectSectionIDMap = new HashMap();
|
||||
private HashMap<Long, DynamicObject> projectSectionMap = new HashMap();
|
||||
List<String> isCheckList = new ArrayList();
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||
super.beforeDoOperation(args);
|
||||
FormOperate source = (FormOperate) args.getSource();
|
||||
String operateKey = source.getOperateKey();
|
||||
if ("addsupplierdetail".equals(operateKey)){
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
||||
super.afterDoOperation(afterDoOperationEventArgs);
|
||||
String operateKey = afterDoOperationEventArgs.getOperateKey();
|
||||
DynamicObject bidproject = (DynamicObject) this.getModel().getValue("bidproject");
|
||||
if ("addsupplierdetail".equals(operateKey)){
|
||||
EntryGrid SEEntryGrid = this.getControl("supplierenrollentry");
|
||||
DynamicObjectCollection SEEntry = this.getModel().getEntryEntity("supplierenrollentry");
|
||||
int[] selectRows = SEEntryGrid.getSelectRows();
|
||||
this.getView().showTipNotification(String.valueOf(selectRows[0]));
|
||||
for (int selectRow : selectRows) {
|
||||
DynamicObject dy = SEEntry.get(selectRow);
|
||||
DynamicObject enrollsupplier = dy.getDynamicObject("enrollsupplier");//报名供应商
|
||||
if (enrollsupplier != null){
|
||||
Object enrollsupplierPkValue = enrollsupplier.getPkValue();
|
||||
boolean flag = checkSupplierCollection(enrollsupplierPkValue,bidproject);
|
||||
if (!flag){
|
||||
this.createRespMyTender(enrollsupplierPkValue);
|
||||
DynamicObject dataEntity = this.getModel().getDataEntity();
|
||||
SaveServiceHelper.save(new DynamicObject[]{dataEntity});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChanged(PropertyChangedArgs args) {
|
||||
ChangeData changeData = args.getChangeSet()[0];
|
||||
|
@ -61,10 +119,11 @@ public class SupplierInvitationFormPlugin extends SupplierInvitationBidNumEdit {
|
|||
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");//查询联系人分录数据
|
||||
String company_address = resm_official_supplier.getString("company_address");//公司地址
|
||||
suppRow.set("enrolladdress",company_address);
|
||||
for (DynamicObject dynamicObject : entry_linkman) {
|
||||
boolean isdefault_linkman = dynamicObject.getBoolean("isdefault_linkman");
|
||||
boolean isopenaccount = dynamicObject.getBoolean("isopenaccount");
|
||||
if (isopenaccount && isdefault_linkman){
|
||||
if (isopenaccount){
|
||||
suppRow.set("enrollsuppliercontact",dynamicObject.getString("contactperson"));//联系人名称
|
||||
String contactphone = dynamicObject.getString("contactphone");
|
||||
if (contactphone.contains("+86-")){
|
||||
|
@ -84,5 +143,78 @@ public class SupplierInvitationFormPlugin extends SupplierInvitationBidNumEdit {
|
|||
this.getView().updateView(entryName);
|
||||
}
|
||||
}
|
||||
|
||||
public void createRespMyTender(Object supplierId ){
|
||||
DynamicObject bidproject = (DynamicObject) this.getModel().getValue("bidproject");//获取招标立项f7数据
|
||||
Object bidproject_pkValue = bidproject.getPkValue();
|
||||
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"));
|
||||
myTender.set("name", announcement.getString("annotitle"));//招标名称:取招标立项名称
|
||||
myTender.set("billstatus", "C");//默认设置状态为c
|
||||
myTender.set("org", bid_project.getDynamicObject("org"));
|
||||
myTender.set("bidproject", bid_project);//设置招标立项
|
||||
myTender.set("ispublicbid", true);//是否公开招标 默认设置:true
|
||||
myTender.set("tenderstatus", MyTenderStatus.APPLIED);//投标状态, 供方入围添加默认设置为已入围
|
||||
myTender.set("publishdate", announcement.getDate("publishdate"));//发布日期
|
||||
myTender.set("announcement", announcement);//招标公告
|
||||
|
||||
Long adminUserId = SupplierHelper.listAdminUserIdBySupplier(Long.parseLong(supplierId.toString()));
|
||||
myTender.set("tenderer", adminUserId);//投标人
|
||||
myTender.set("supplier", supplierId);//供应商
|
||||
myTender.set("createtime", new Date());//创建日期
|
||||
myTender.set("entitytypeid", "resp_mytender");//entitytypeid
|
||||
String backBidWay = bid_project.getString("backbidway");
|
||||
String docType = bid_project.getString("doctype");
|
||||
String backType = BackBidWayUtil.getBackBidType(backBidWay, docType);
|
||||
myTender.set("backbidway", backBidWay);//回标方式
|
||||
myTender.set("backbidtype", backType);//回标类型
|
||||
myTender.set("rounds", 1);//轮次
|
||||
//列表展示轮次
|
||||
myTender.set("listrounds", String.format(ResManager.loadKDString("第%s次", "OnlineBidUtil_0", "scm-ten-formplugin", new Object[0]), CommonUtil.toChinese("1")));
|
||||
EntityType myTenderEntryEntityType = (EntityType)EntityMetadataCache.getDataEntityType("resp_mytender").getAllEntities().get("entry");//标段分录
|
||||
EntityType myTenderSupplierDetailType = (EntityType)EntityMetadataCache.getDataEntityType("resp_mytender").getAllEntities().get("supplierdetail");//报价明细
|
||||
DynamicObjectCollection myTenderEntryColl = new DynamicObjectCollection(myTenderEntryEntityType,myTender);//构建标段分录对象
|
||||
|
||||
|
||||
DynamicObject resm_project= BusinessDataServiceHelper.loadSingle(bidproject_pkValue, "rebm_bidproject_f7");//查询招标单完整数据
|
||||
DynamicObjectCollection bidsection = resm_project.getDynamicObjectCollection("bidsection");
|
||||
for (int i = 0; i < bidsection.size(); i++){
|
||||
DynamicObject myTenderEntry = new DynamicObject(myTenderEntryEntityType);
|
||||
DynamicObject section = bidsection.get(i);
|
||||
myTenderEntry.set("projectSection", section);
|
||||
myTenderEntry.set("seq", i);
|
||||
myTenderEntry.set("sectionname", section.get("sectionname"));
|
||||
myTenderEntry.set("sectionstatus", MyTenderStatus.APPLIED);
|
||||
myTenderEntryColl.add(myTenderEntry);
|
||||
}
|
||||
myTender.set("entry", myTenderEntryColl);
|
||||
SaveServiceHelper.save(new DynamicObject[]{myTender});
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验供应商集合是否符合存在投标单
|
||||
* @param
|
||||
*/
|
||||
public boolean checkSupplierCollection(Object supplierId,DynamicObject bidproject ){
|
||||
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());
|
||||
// DynamicObject announcement = resp_mytender.getDynamicObject("announcement");
|
||||
// Date publishdate = announcement.getDate("publishdate");
|
||||
// String tenderstatus = resp_mytender.getString("tenderstatus");
|
||||
// this.getView().showTipNotification(tenderstatus);
|
||||
// DynamicObjectCollection entry = resp_mytender.getDynamicObjectCollection("entry");
|
||||
// for (DynamicObject dynamicObject : entry) {
|
||||
// String sectionstatus = dynamicObject.getString("sectionstatus");
|
||||
// this.getView().showTipNotification(sectionstatus);
|
||||
// }
|
||||
if (resp_mytender != null){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue