diff --git a/fi/fi/shkd-fi-fi-plugin/src/main/java/shkd/repc/recon/formplugin/ContractCarryFormPlugin.java b/fi/fi/shkd-fi-fi-plugin/src/main/java/shkd/repc/recon/formplugin/ContractCarryFormPlugin.java new file mode 100644 index 0000000..e031f0b --- /dev/null +++ b/fi/fi/shkd-fi-fi-plugin/src/main/java/shkd/repc/recon/formplugin/ContractCarryFormPlugin.java @@ -0,0 +1,70 @@ +package shkd.repc.recon.formplugin; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.datamodel.events.PropertyChangedArgs; +import kd.bos.form.plugin.AbstractFormPlugin; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; + +import java.math.BigDecimal; + +/** + * 合同 + * qeug_recon_contractbi_ext + */ +public class ContractCarryFormPlugin extends AbstractFormPlugin { + + /** + * 采购合同(形成方式选择战略采购) + * 选择协议携带物料 战采管理,战略协议新增,组织项目(字段名称相同均携带) + */ + @Override + public void propertyChanged(PropertyChangedArgs e) { + super.propertyChanged(e); + String propertyname = e.getProperty().getName(); + switch (propertyname) { + //战略协议 + case "bidstrategic": + //合同--物料明细 + DynamicObjectCollection orderformentrys = this.getModel().getDataEntity(true).getDynamicObjectCollection("qeug_orderformentry"); + orderformentrys.clear(); + + DynamicObject bidstrategic = (DynamicObject) this.getModel().getValue(propertyname); + if (null == bidstrategic) { + this.getView().updateView("qeug_orderformentry"); + return; + } + //rebm_strategicagreement 战略协议 + //rebm_strategicagreementf7 战略协议f7 + QFilter q1 = new QFilter("id", QCP.equals, bidstrategic.getPkValue()); + DynamicObject rebm_strategicagreement = BusinessDataServiceHelper.loadSingle("rebm_strategicagreement", new QFilter[]{q1}); + + if (null != rebm_strategicagreement) { + + DynamicObjectCollection listentrys = rebm_strategicagreement.getDynamicObjectCollection("listentry"); + for (int i = 0; i < listentrys.size(); i++) { + DynamicObject qeugOrderformentry = listentrys.get(i); + DynamicObject add = orderformentrys.addNew(); + add.set("seq", i); + this.getModel().setValue("qeug_material", qeugOrderformentry.get("resourcename"), i);//物料 + this.getModel().setValue("qeug_brand", qeugOrderformentry.get("brand"), i);//品牌 + this.getModel().setValue("qeug_model", qeugOrderformentry.get("model"), i);//型号 + this.getModel().setValue("qeug_description", qeugOrderformentry.get("remark"), i);//备注 + this.getModel().setValue("qeug_unitprice", qeugOrderformentry.get("materialprice"), i);//材料单价 + this.getModel().setValue("qeug_transportprice", qeugOrderformentry.get("freightprice"), i);//运费单价 + this.getModel().setValue("qeug_installprice", qeugOrderformentry.get("installprice"), i);//安装单价 + this.getModel().setValue("qeug_totalprice", qeugOrderformentry.get("price"), i);//综合单价 + this.getModel().setValue("qeug_taxrate", qeugOrderformentry.get("taxrate"), i);//税率 + this.getModel().setValue("qeug_taxamount", qeugOrderformentry.get("taxamount"), i);//税额 + this.getModel().setValue("qeug_taxtotalprice", qeugOrderformentry.get("taxprice"), i);//含税单价 + } + } + this.getView().updateView("qeug_orderformentry"); + break; + default: + break; + } + } +}