diff --git a/main/java/shjh/jhzj7/fi/fi/plugin/form/RecBillChangeFormPlugin.java b/main/java/shjh/jhzj7/fi/fi/plugin/form/RecBillChangeFormPlugin.java new file mode 100644 index 0000000..b8bd95a --- /dev/null +++ b/main/java/shjh/jhzj7/fi/fi/plugin/form/RecBillChangeFormPlugin.java @@ -0,0 +1,71 @@ +package shjh.jhzj7.fi.fi.plugin.form; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.db.DB; +import kd.bos.db.DBRoute; +import kd.bos.form.plugin.AbstractFormPlugin; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.sdk.plugin.Plugin; + +import java.util.EventObject; + +/** + * 动态表单插件 + */ +public class RecBillChangeFormPlugin extends AbstractFormPlugin implements Plugin { + + private static final String UPDATE_TOP = "update t_cas_recbillchang_e set fk_shjh_oldbizebig = ?,fk_shjh_oldbizsmall = ?,fk_shjh_oldcostcenter = ?,fk_shjh_oldprofitcenter = ?,fk_shjh_oldproductgroups = ?,fk_shjh_oldcountry = ?,fk_shjh_oldcity = ?,fk_shjh_oldbankcharges = ?,fk_shjh_bthirdpartyfees =? where fid=?;"; + + @Override + public void afterBindData(EventObject e) { + super.afterBindData(e); + if ("A".equals((String)this.getModel().getValue("billstatus"))){ + boolean dataChanged = this.getModel().getDataChanged(); + if (!dataChanged){ + Long bizBigId=0L; + Long bizSmallId=0L; + Long costCenterId=0L; + Long profitCenterId=0L; + Long productGroupsId=0L; + Object pkValue = this.getModel().getDataEntity().getPkValue(); + DynamicObject bizBig = (DynamicObject) this.getModel().getValue("shjh_bizebig"); + if (bizBig!=null){ + bizBigId=bizBig.getLong("id"); + } + DynamicObject bizSmall = (DynamicObject) this.getModel().getValue("shjh_bizsmall"); + if (bizSmall!=null){ + bizSmallId=bizSmall.getLong("id"); + } + DynamicObject costCenter = (DynamicObject) this.getModel().getValue("shjh_costcenter"); + if (costCenter!=null){ + costCenterId=costCenter.getLong("id"); + } + DynamicObject profitCenter = (DynamicObject) this.getModel().getValue("shjh_profitcenter"); + if (profitCenter!=null){ + profitCenterId=profitCenter.getLong("id"); + } + DynamicObject productGroups = (DynamicObject) this.getModel().getValue("shjh_productgroups"); + if (productGroups!=null){ + productGroupsId=productGroups.getLong("id"); + } + DB.update(DBRoute.of("fi"),UPDATE_TOP,new Object[]{ + bizBigId, + bizSmallId, + costCenterId, + profitCenterId, + productGroupsId, + this.getModel().getValue("shjh_country"), + this.getModel().getValue("shjh_city"), + this.getModel().getValue("shjh_bankcharges"), + this.getModel().getValue("shjh_thirdpartyfees"), + pkValue + }); + } + } + } + + +} \ No newline at end of file