供方入围添加报名供应商逻辑二开
This commit is contained in:
parent
b42bc3afb8
commit
7ff7e30065
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue