物料中 地区必录字段 首次修改时,将必录字段值赋给其他区域的 对应字段
This commit is contained in:
parent
c36840a462
commit
ac242ccc16
|
|
@ -0,0 +1,209 @@
|
|||
package tqq9.lc123.cloud.app.plugin.form.sys;
|
||||
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 单据界面插件
|
||||
* 物料中 地区必录字段 首次修改时,将必录字段值赋给其他区域的 对应字段
|
||||
*/
|
||||
public class MaterialBillRegionRequiredFieldAssignPlugin extends AbstractBillPlugIn implements Plugin {
|
||||
private final static Log logger = LogFactory.getLog(MaterialBillRegionRequiredFieldAssignPlugin.class);
|
||||
|
||||
@Override
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
String name = e.getProperty().getName();
|
||||
Boolean isfirst = (Boolean) this.getModel().getValue("tqq9_isfirst");// 是否首次修改
|
||||
if (isfirst) {// 首次修改
|
||||
//是否启用有效期管理
|
||||
String tqq9_sfqyxqgl1 = (String) this.getModel().getValue("tqq9_sfqyxqgl1");// 上海
|
||||
String tqq9_sfqyxqgl2 = (String) this.getModel().getValue("tqq9_sfqyxqgl2");// 北京
|
||||
String tqq9_sfqyxqgl3 = (String) this.getModel().getValue("tqq9_sfqyxqgl3");// 广州
|
||||
//效期管理(日)
|
||||
Integer tqq9_xqglshsh = (Integer) this.getModel().getValue("tqq9_xqglshsh");//上海
|
||||
Integer tqq9_xqglbj = (Integer) this.getModel().getValue("tqq9_xqglbj");//北京
|
||||
Integer tqq9_xqglgz = (Integer) this.getModel().getValue("tqq9_xqglgz");//广州
|
||||
//业务负责人
|
||||
DynamicObject tqq9_ywfzr21 = (DynamicObject) this.getModel().getValue("tqq9_ywfzr21");//上海
|
||||
DynamicObject tqq9_ywfzr2 = (DynamicObject) this.getModel().getValue("tqq9_ywfzr2");// 北京
|
||||
DynamicObject tqq9_ywfzr3 = (DynamicObject) this.getModel().getValue("tqq9_ywfzr3");// 广州
|
||||
//执行采购
|
||||
DynamicObjectCollection tqq9_shcg = (DynamicObjectCollection) this.getModel().getValue("tqq9_shcg");// 上海
|
||||
DynamicObjectCollection tqq9_bjcg = (DynamicObjectCollection) this.getModel().getValue("tqq9_bjcg");// 北京
|
||||
DynamicObjectCollection tqq9_gzcg = (DynamicObjectCollection) this.getModel().getValue("tqq9_gzcg");// 广州
|
||||
// 最高采购限价
|
||||
BigDecimal tqq9_maxprice_sh = (BigDecimal) this.getModel().getValue("tqq9_maxprice_sh");// 上海
|
||||
BigDecimal tqq9_maxprice_bj = (BigDecimal) this.getModel().getValue("tqq9_maxprice_bj");// 北京
|
||||
BigDecimal tqq9_maxprice_gz = (BigDecimal) this.getModel().getValue("tqq9_maxprice_gz");// 广州
|
||||
// 销售原价
|
||||
BigDecimal tqq9_xsyj1 = (BigDecimal) this.getModel().getValue("tqq9_xsyj1"); // 上海
|
||||
BigDecimal tqq9_amountfield1 = (BigDecimal) this.getModel().getValue("tqq9_amountfield1"); // 北京
|
||||
BigDecimal tqq9_amountfield4 = (BigDecimal) this.getModel().getValue("tqq9_amountfield4");// 广州
|
||||
// 是否启用有效期管理
|
||||
if ("tqq9_sfqyxqgl1".equals(name)) {
|
||||
if ("false".equals(tqq9_sfqyxqgl1)) {
|
||||
this.getModel().setValue("tqq9_xqglshsh", BigDecimal.ZERO);
|
||||
}
|
||||
if (StringUtils.isNotBlank(tqq9_sfqyxqgl1) && StringUtils.isBlank(tqq9_sfqyxqgl2)) {
|
||||
this.getModel().setValue("tqq9_sfqyxqgl2", tqq9_sfqyxqgl1);
|
||||
}
|
||||
if (StringUtils.isNotBlank(tqq9_sfqyxqgl1) && StringUtils.isBlank(tqq9_sfqyxqgl3)) {
|
||||
this.getModel().setValue("tqq9_sfqyxqgl3", tqq9_sfqyxqgl1);
|
||||
}
|
||||
} else if ("tqq9_sfqyxqgl2".equals(name)) {
|
||||
if ("false".equals(tqq9_sfqyxqgl2)) {
|
||||
this.getModel().setValue("tqq9_xqglbj", BigDecimal.ZERO);
|
||||
}
|
||||
if ( StringUtils.isNotBlank(tqq9_sfqyxqgl2) && StringUtils.isBlank(tqq9_sfqyxqgl1)) {
|
||||
this.getModel().setValue("tqq9_sfqyxqgl1", tqq9_sfqyxqgl2);
|
||||
}
|
||||
if (StringUtils.isNotBlank(tqq9_sfqyxqgl2) && StringUtils.isBlank(tqq9_sfqyxqgl3)) {
|
||||
this.getModel().setValue("tqq9_sfqyxqgl3", tqq9_sfqyxqgl2);
|
||||
}
|
||||
} else if ("tqq9_sfqyxqgl3".equals(name)) {
|
||||
if ("false".equals(tqq9_sfqyxqgl3)) {
|
||||
this.getModel().setValue("tqq9_xqglgz", BigDecimal.ZERO);
|
||||
}
|
||||
if ( StringUtils.isNotBlank(tqq9_sfqyxqgl3) && StringUtils.isBlank(tqq9_sfqyxqgl1)) {
|
||||
this.getModel().setValue("tqq9_sfqyxqgl1", tqq9_sfqyxqgl3);
|
||||
}
|
||||
if ( StringUtils.isNotBlank(tqq9_sfqyxqgl3) && StringUtils.isBlank(tqq9_sfqyxqgl2)) {
|
||||
this.getModel().setValue("tqq9_sfqyxqgl2", tqq9_sfqyxqgl3);
|
||||
}
|
||||
}
|
||||
|
||||
// 效期管理(日)
|
||||
if ("tqq9_xqglshsh".equals(name)) {
|
||||
if (tqq9_xqglshsh != 0 && tqq9_xqglbj == 0 && "true".equals(tqq9_sfqyxqgl2)) {
|
||||
this.getModel().setValue("tqq9_xqglbj", tqq9_xqglshsh);
|
||||
}
|
||||
if (tqq9_xqglshsh != 0 && tqq9_xqglgz == 0 && "true".equals(tqq9_sfqyxqgl3)) {
|
||||
this.getModel().setValue("tqq9_xqglgz", tqq9_xqglshsh);
|
||||
}
|
||||
} else if ("tqq9_xqglbj".equals(name)) {
|
||||
if (tqq9_xqglbj != 0 && tqq9_xqglshsh == 0 && "true".equals(tqq9_sfqyxqgl1)) {
|
||||
this.getModel().setValue("tqq9_xqglshsh", tqq9_xqglbj);
|
||||
}
|
||||
if (tqq9_xqglbj != 0 && tqq9_xqglgz == 0 && "true".equals(tqq9_sfqyxqgl3)) {
|
||||
this.getModel().setValue("tqq9_xqglgz", tqq9_xqglbj);
|
||||
}
|
||||
} else if ("tqq9_xqglgz".equals(name)) {
|
||||
if (tqq9_xqglgz != 0 && tqq9_xqglshsh == 0 && "true".equals(tqq9_sfqyxqgl1)) {
|
||||
this.getModel().setValue("tqq9_xqglshsh", tqq9_xqglgz);
|
||||
}
|
||||
if (tqq9_xqglgz != 0 && tqq9_xqglbj == 0 && "true".equals(tqq9_sfqyxqgl2)) {
|
||||
this.getModel().setValue("tqq9_xqglbj", tqq9_xqglgz);
|
||||
}
|
||||
}
|
||||
|
||||
// 业务负责人
|
||||
if ("tqq9_ywfzr21".equals(name)) {
|
||||
if (tqq9_ywfzr21 != null && tqq9_ywfzr2 == null) {
|
||||
this.getModel().setValue("tqq9_ywfzr2", tqq9_ywfzr21);
|
||||
}
|
||||
if (tqq9_ywfzr21 != null && tqq9_ywfzr3 == null) {
|
||||
this.getModel().setValue("tqq9_ywfzr3", tqq9_ywfzr21);
|
||||
}
|
||||
} else if ("tqq9_ywfzr2".equals(name)) {
|
||||
if (tqq9_ywfzr2 != null && tqq9_ywfzr21 == null) {
|
||||
this.getModel().setValue("tqq9_ywfzr21", tqq9_ywfzr2);
|
||||
}
|
||||
if (tqq9_ywfzr2 != null && tqq9_ywfzr3 == null) {
|
||||
this.getModel().setValue("tqq9_ywfzr3", tqq9_ywfzr2);
|
||||
}
|
||||
} else if ("tqq9_ywfzr3".equals(name)) {
|
||||
if (tqq9_ywfzr3 != null && tqq9_ywfzr21 == null) {
|
||||
this.getModel().setValue("tqq9_ywfzr21", tqq9_ywfzr3);
|
||||
}
|
||||
if (tqq9_ywfzr3 != null && tqq9_ywfzr2 == null) {
|
||||
this.getModel().setValue("tqq9_ywfzr2", tqq9_ywfzr3);
|
||||
}
|
||||
}
|
||||
|
||||
// 执行采购
|
||||
if ("tqq9_shcg".equals(name)) {
|
||||
if (tqq9_shcg != null && tqq9_shcg.size() > 0 && tqq9_bjcg.size() == 0) {
|
||||
this.getModel().setValue("tqq9_bjcg", tqq9_shcg);
|
||||
}
|
||||
if (tqq9_shcg != null && tqq9_shcg.size() > 0 && tqq9_gzcg.size() == 0) {
|
||||
this.getModel().setValue("tqq9_gzcg", tqq9_shcg);
|
||||
}
|
||||
} else if ("tqq9_bjcg".equals(name)) {
|
||||
if (tqq9_bjcg != null && tqq9_bjcg.size() > 0 && tqq9_shcg.size() == 0) {
|
||||
this.getModel().setValue("tqq9_shcg", tqq9_bjcg);
|
||||
}
|
||||
if (tqq9_bjcg != null && tqq9_bjcg.size() > 0 && tqq9_gzcg.size() == 0) {
|
||||
this.getModel().setValue("tqq9_gzcg", tqq9_bjcg);
|
||||
}
|
||||
} else if ("tqq9_gzcg".equals(name)) {
|
||||
if (tqq9_gzcg != null && tqq9_gzcg.size() > 0 && tqq9_shcg.size() == 0) {
|
||||
this.getModel().setValue("tqq9_shcg", tqq9_gzcg);
|
||||
}
|
||||
if (tqq9_gzcg != null && tqq9_gzcg.size() > 0 && tqq9_bjcg.size() == 0) {
|
||||
this.getModel().setValue("tqq9_bjcg", tqq9_gzcg);
|
||||
}
|
||||
}
|
||||
|
||||
// 最高采购限价
|
||||
if ("tqq9_maxprice_sh".equals(name)) {
|
||||
if (tqq9_maxprice_sh.compareTo(BigDecimal.ZERO) > 0 && tqq9_maxprice_bj.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getModel().setValue("tqq9_maxprice_bj", tqq9_maxprice_sh);
|
||||
}
|
||||
if (tqq9_maxprice_sh.compareTo(BigDecimal.ZERO) > 0 && tqq9_maxprice_gz.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getModel().setValue("tqq9_maxprice_gz", tqq9_maxprice_sh);
|
||||
}
|
||||
} else if ("tqq9_maxprice_bj".equals(name)) {
|
||||
if (tqq9_maxprice_bj.compareTo(BigDecimal.ZERO) > 0 && tqq9_maxprice_sh.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getModel().setValue("tqq9_maxprice_sh", tqq9_maxprice_bj);
|
||||
}
|
||||
if (tqq9_maxprice_bj.compareTo(BigDecimal.ZERO) > 0 && tqq9_maxprice_gz.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getModel().setValue("tqq9_maxprice_gz", tqq9_maxprice_bj);
|
||||
}
|
||||
} else if ("tqq9_maxprice_gz".equals(name)) {
|
||||
if (tqq9_maxprice_gz.compareTo(BigDecimal.ZERO) > 0 && tqq9_maxprice_sh.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getModel().setValue("tqq9_maxprice_sh", tqq9_maxprice_gz);
|
||||
}
|
||||
if (tqq9_maxprice_gz.compareTo(BigDecimal.ZERO) > 0 && tqq9_maxprice_bj.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getModel().setValue("tqq9_maxprice_bj", tqq9_maxprice_gz);
|
||||
}
|
||||
}
|
||||
|
||||
// 销售原价
|
||||
if ("tqq9_xsyj1".equals(name)) {
|
||||
if (tqq9_xsyj1.compareTo(BigDecimal.ZERO) > 0 && tqq9_amountfield1.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getModel().setValue("tqq9_amountfield1", tqq9_xsyj1);
|
||||
}
|
||||
if (tqq9_xsyj1.compareTo(BigDecimal.ZERO) > 0 && tqq9_amountfield4.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getModel().setValue("tqq9_amountfield4", tqq9_xsyj1);
|
||||
}
|
||||
} else if ("tqq9_amountfield1".equals(name)) {
|
||||
if (tqq9_amountfield1.compareTo(BigDecimal.ZERO) > 0 && tqq9_xsyj1.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getModel().setValue("tqq9_xsyj1", tqq9_amountfield1);
|
||||
}
|
||||
if (tqq9_amountfield1.compareTo(BigDecimal.ZERO) > 0 && tqq9_amountfield4.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getModel().setValue("tqq9_amountfield4", tqq9_amountfield1);
|
||||
}
|
||||
} else if ("tqq9_amountfield4".equals(name)) {
|
||||
if (tqq9_amountfield4.compareTo(BigDecimal.ZERO) > 0 && tqq9_xsyj1.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getModel().setValue("tqq9_xsyj1", tqq9_amountfield4);
|
||||
}
|
||||
if (tqq9_amountfield4.compareTo(BigDecimal.ZERO) > 0 && tqq9_amountfield1.compareTo(BigDecimal.ZERO) == 0) {
|
||||
this.getModel().setValue("tqq9_amountfield1", tqq9_amountfield4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue