考察计划表单供应商字段携带
This commit is contained in:
parent
fa366de5e9
commit
2e6044fc27
|
@ -0,0 +1,75 @@
|
||||||
|
package shkd.repc.resm.formplugin;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
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.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考察计划单据界面插件
|
||||||
|
*/
|
||||||
|
public class InvestigationPlanFormPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 值更新事件:当供应商字段发生变化时,携带联系人数据。
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
String name = e.getProperty().getName();//字段名称
|
||||||
|
if("suppliername".equals(name)){
|
||||||
|
String supplierType = "";
|
||||||
|
String supplierTypeName = "";
|
||||||
|
ChangeData[] changeSet = e.getChangeSet();
|
||||||
|
ChangeData changeData = changeSet[0];
|
||||||
|
DynamicObject newValue = (DynamicObject) changeData.getNewValue();
|
||||||
|
int rowIndex = changeData.getRowIndex();//当前更新供应商字段的行号
|
||||||
|
Object supplierclassification = this.getModel().getValue("supplierclassification");//获取单头的供应商分类
|
||||||
|
if (newValue != null){
|
||||||
|
Object pkValue = newValue.getPkValue();
|
||||||
|
String suppliersource = (String) this.getModel().getValue("suppliersource", rowIndex);//获取供应商类型
|
||||||
|
if("resm_regsupplier".equals(suppliersource)){//潜在供应商
|
||||||
|
supplierType = "resm_regsupplier";
|
||||||
|
supplierTypeName = "group";
|
||||||
|
}else {//正式供应商
|
||||||
|
supplierType = "resm_official_supplier";
|
||||||
|
supplierTypeName = "apt_group";
|
||||||
|
}
|
||||||
|
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(pkValue, supplierType);//加载供应商数据
|
||||||
|
DynamicObjectCollection entry_linkman = dynamicObject.getDynamicObjectCollection("entry_linkman");//获取联系人分录
|
||||||
|
for (DynamicObject object : entry_linkman) {
|
||||||
|
if (object.getBoolean("isdefault_linkman")){//选择默认联系人
|
||||||
|
String contactperson = object.getString("contactperson");//名称
|
||||||
|
String contactphone = object.getString("contactphone");//手机号
|
||||||
|
this.getModel().setValue("qeug_supplieruname",contactperson,rowIndex);//供应商联系人名称赋值
|
||||||
|
this.getModel().setValue("suppliercontact",contactphone,rowIndex);//供应商联系方式赋值
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (supplierclassification == null){
|
||||||
|
DynamicObjectCollection apt_group = dynamicObject.getDynamicObjectCollection(supplierTypeName);
|
||||||
|
if (apt_group != null){
|
||||||
|
DynamicObject fbasedataid = apt_group.get(0).getDynamicObject("fbasedataid");
|
||||||
|
this.getModel().setValue("detail_supplierclassifica",fbasedataid,rowIndex);//供应商分类赋值
|
||||||
|
}else {
|
||||||
|
this.getView().showTipNotification("该供应商-供应商分类数据异常,请维护!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
if (supplierclassification == null){
|
||||||
|
this.getModel().setValue("detail_supplierclassifica",null,rowIndex);//清除供应商分类
|
||||||
|
}
|
||||||
|
this.getModel().setValue("qeug_supplieruname",null,rowIndex);//清除联系人名称
|
||||||
|
this.getModel().setValue("suppliercontact",null,rowIndex);//清除联系人联系方式
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue