From 0b34e4154edb168579cce19e9242e33cf1569e75 Mon Sep 17 00:00:00 2001 From: pan-houxiang <2663608154@qq.com> Date: Thu, 11 Dec 2025 17:04:16 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E5=AF=BC=E5=85=A5=E5=9C=B0?= =?UTF-8?q?=E5=8C=BA=E5=BF=85=E5=BD=95=E5=AD=97=E6=AE=B5=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=B5=8B=E5=80=BC=E7=BB=99=E5=85=B6=E4=BB=96=E5=9C=B0=E5=8C=BA?= =?UTF-8?q?=E5=BF=85=E5=BD=95=E5=AD=97=E6=AE=B5=EF=BC=88MaterialBillImport?= =?UTF-8?q?Plugin=EF=BC=89=EF=BC=8C=20=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=EF=BC=88PurOrderBillImportPlugin=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/pm/PurOrderBillImportPlugin.java | 2 +- .../form/sys/MaterialBillImportPlugin.java | 192 ++++++++++++++++++ 2 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 lc123/cloud/app/plugin/form/sys/MaterialBillImportPlugin.java diff --git a/lc123/cloud/app/plugin/form/pm/PurOrderBillImportPlugin.java b/lc123/cloud/app/plugin/form/pm/PurOrderBillImportPlugin.java index 7e31b3d..a2c6764 100644 --- a/lc123/cloud/app/plugin/form/pm/PurOrderBillImportPlugin.java +++ b/lc123/cloud/app/plugin/form/pm/PurOrderBillImportPlugin.java @@ -15,7 +15,7 @@ import java.util.HashMap; /** * 单据界面插件 - * 物料明细分录导入带出行关闭 和 收货仓库 + * 采购订单明细分录导入带出行关闭 和 收货仓库 */ public class PurOrderBillImportPlugin extends AbstractBillPlugIn implements Plugin { @Override diff --git a/lc123/cloud/app/plugin/form/sys/MaterialBillImportPlugin.java b/lc123/cloud/app/plugin/form/sys/MaterialBillImportPlugin.java new file mode 100644 index 0000000..d192f0a --- /dev/null +++ b/lc123/cloud/app/plugin/form/sys/MaterialBillImportPlugin.java @@ -0,0 +1,192 @@ +package tqq9.lc123.cloud.app.plugin.form.sys; + +import com.alibaba.fastjson.JSONObject; +import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.dataentity.utils.StringUtils; +import kd.bos.entity.datamodel.events.BeforeImportDataEventArgs; +import kd.sdk.plugin.Plugin; + +import java.util.Map; + +/** + * 单据界面插件 + */ +public class MaterialBillImportPlugin extends AbstractBillPlugIn implements Plugin { + @Override + public void beforeImportData(BeforeImportDataEventArgs e) { + super.beforeImportData(e); + Map sourceData = e.getSourceData(); + + if (sourceData != null) { + //是否启用有效期管理 + String tqq9_sfqyxqgl1 = (String) sourceData.get("tqq9_sfqyxqgl1"); // 上海 + String tqq9_sfqyxqgl2 = (String) sourceData.get("tqq9_sfqyxqgl2"); // 北京 + String tqq9_sfqyxqgl3 = (String) sourceData.get("tqq9_sfqyxqgl3"); // 广州 + // 效期管理(日) + String tqq9_xqglshsh = (String) sourceData.get("tqq9_xqglshsh"); // 上海 + String tqq9_xqglbj = (String) sourceData.get("tqq9_xqglbj"); // 北京 + String tqq9_xqglgz = (String) sourceData.get("tqq9_xqglgz"); // 广州 + // 业务负责人 + JSONObject tqq9_ywfzr21 = (JSONObject) sourceData.get("tqq9_ywfzr21"); // 上海 + JSONObject tqq9_ywfzr2 = (JSONObject) sourceData.get("tqq9_ywfzr2"); // 北京 + JSONObject tqq9_ywfzr3 = (JSONObject) sourceData.get("tqq9_ywfzr3"); // 广州 + // 执行采购 + JSONObject tqq9_shcg = (JSONObject) sourceData.get("tqq9_shcg");// 上海 + JSONObject tqq9_bjcg = (JSONObject) sourceData.get("tqq9_bjcg");// 北京 + JSONObject tqq9_gzcg = (JSONObject) sourceData.get("tqq9_gzcg");// 广州 + // 最高采购限价 + String tqq9_maxprice_sh = (String) sourceData.get("tqq9_maxprice_sh"); // 上海 + String tqq9_maxprice_bj = (String) sourceData.get("tqq9_maxprice_bj"); // 北京 + String tqq9_maxprice_gz = (String) sourceData.get("tqq9_maxprice_gz"); // 广州 + // 销售原价 + String tqq9_xsyj1 = (String) sourceData.get("tqq9_xsyj1"); // 上海 + String tqq9_amountfield1 = (String) sourceData.get("tqq9_amountfield1"); // 北京 + String tqq9_amountfield4 = (String) sourceData.get("tqq9_amountfield4"); // 广州 + + // 按照上海>北京>广州的优先级处理字段赋值 + // 处理是否启用有效期管理 + if (tqq9_sfqyxqgl1 != null && StringUtils.isNotBlank(tqq9_sfqyxqgl1)) { + if (sourceData.get("tqq9_sfqyxqgl2") == null) { + sourceData.put("tqq9_sfqyxqgl2", tqq9_sfqyxqgl1); + } + if (sourceData.get("tqq9_sfqyxqgl3") == null) { + sourceData.put("tqq9_sfqyxqgl3", tqq9_sfqyxqgl1); + } + } else if (tqq9_sfqyxqgl2 != null && StringUtils.isNotBlank(tqq9_sfqyxqgl2)) { + if (sourceData.get("tqq9_sfqyxqgl1") == null) { + sourceData.put("tqq9_sfqyxqgl1", tqq9_sfqyxqgl2); + } + if (sourceData.get("tqq9_sfqyxqgl3") == null) { + sourceData.put("tqq9_sfqyxqgl3", tqq9_sfqyxqgl2); + } + } else if (tqq9_sfqyxqgl3 != null && StringUtils.isNotBlank(tqq9_sfqyxqgl3)) { + if (sourceData.get("tqq9_sfqyxqgl1") == null) { + sourceData.put("tqq9_sfqyxqgl1", tqq9_sfqyxqgl3); + } + if (sourceData.get("tqq9_sfqyxqgl2") == null) { + sourceData.put("tqq9_sfqyxqgl2", tqq9_sfqyxqgl3); + } + } + + // 处理效期管理(日) + if (tqq9_xqglshsh != null && StringUtils.isNotBlank(tqq9_xqglshsh)) { + if (sourceData.get("tqq9_xqglbj") == null && StringUtils.isBlank(tqq9_xqglbj)) { + sourceData.put("tqq9_xqglbj", tqq9_xqglshsh); + } + if (sourceData.get("tqq9_xqglgz") == null&& StringUtils.isBlank(tqq9_xqglgz)) { + sourceData.put("tqq9_xqglgz", tqq9_xqglshsh); + } + } else if (tqq9_xqglbj != null && StringUtils.isNotBlank(tqq9_xqglbj)) { + if (sourceData.get("tqq9_xqglshsh") == null&& StringUtils.isBlank(tqq9_xqglshsh)) { + sourceData.put("tqq9_xqglshsh", tqq9_xqglbj); + } + if (sourceData.get("tqq9_xqglgz") == null&& StringUtils.isBlank(tqq9_xqglgz)) { + sourceData.put("tqq9_xqglgz", tqq9_xqglbj); + } + } else if (tqq9_xqglgz != null&& StringUtils.isNotBlank(tqq9_xqglgz)) { + if (sourceData.get("tqq9_xqglshsh") == null&& StringUtils.isBlank(tqq9_xqglshsh)) { + sourceData.put("tqq9_xqglshsh", tqq9_xqglgz); + } + if (sourceData.get("tqq9_xqglbj") == null&& StringUtils.isBlank(tqq9_xqglbj)) { + sourceData.put("tqq9_xqglbj", tqq9_xqglgz); + } + } + + // 处理业务负责人 + if (tqq9_ywfzr21 != null && tqq9_ywfzr21.size() > 0) { + if (sourceData.get("tqq9_ywfzr2") == null) { + sourceData.put("tqq9_ywfzr2", tqq9_ywfzr21); + } + if (sourceData.get("tqq9_ywfzr3") == null) { + sourceData.put("tqq9_ywfzr3", tqq9_ywfzr21); + } + } else if (tqq9_ywfzr2 != null && tqq9_ywfzr2.size() > 0) { + if (sourceData.get("tqq9_ywfzr21") == null) { + sourceData.put("tqq9_ywfzr21", tqq9_ywfzr2); + } + if (sourceData.get("tqq9_ywfzr3") == null) { + sourceData.put("tqq9_ywfzr3", tqq9_ywfzr2); + } + } else if (tqq9_ywfzr3 != null && tqq9_ywfzr3.size() > 0) { + if (sourceData.get("tqq9_ywfzr21") == null) { + sourceData.put("tqq9_ywfzr21", tqq9_ywfzr3); + } + if (sourceData.get("tqq9_ywfzr2") == null) { + sourceData.put("tqq9_ywfzr2", tqq9_ywfzr3); + } + } + + // 处理执行采购 + if (tqq9_shcg != null && tqq9_shcg.size() > 0) { + if (sourceData.get("tqq9_bjcg") == null) { + sourceData.put("tqq9_bjcg", tqq9_shcg); + } + if (sourceData.get("tqq9_gzcg") == null) { + sourceData.put("tqq9_gzcg", tqq9_shcg); + } + } else if (tqq9_bjcg != null && tqq9_bjcg.size() > 0) { + if (sourceData.get("tqq9_shcg") == null) { + sourceData.put("tqq9_shcg", tqq9_bjcg); + } + if (sourceData.get("tqq9_gzcg") == null) { + sourceData.put("tqq9_gzcg", tqq9_bjcg); + } + } else if (tqq9_gzcg != null && tqq9_gzcg.size() > 0) { + if (sourceData.get("tqq9_shcg") == null) { + sourceData.put("tqq9_shcg", tqq9_gzcg); + } + if (sourceData.get("tqq9_bjcg") == null) { + sourceData.put("tqq9_bjcg", tqq9_gzcg); + } + } + + // 处理最高采购限价 + if (tqq9_maxprice_sh != null && StringUtils.isNotBlank(tqq9_maxprice_sh)) { + if (sourceData.get("tqq9_maxprice_bj") == null && StringUtils.isBlank(tqq9_maxprice_bj)) { + sourceData.put("tqq9_maxprice_bj", tqq9_maxprice_sh); + } + if (sourceData.get("tqq9_maxprice_gz") == null && StringUtils.isBlank(tqq9_maxprice_gz)) { + sourceData.put("tqq9_maxprice_gz", tqq9_maxprice_sh); + } + } else if (tqq9_maxprice_bj != null && StringUtils.isNotBlank(tqq9_maxprice_bj)) { + if (sourceData.get("tqq9_maxprice_sh") == null && StringUtils.isBlank(tqq9_maxprice_sh)) { + sourceData.put("tqq9_maxprice_sh", tqq9_maxprice_bj); + } + if (sourceData.get("tqq9_maxprice_gz") == null && StringUtils.isBlank(tqq9_maxprice_bj)) { + sourceData.put("tqq9_maxprice_gz", tqq9_maxprice_bj); + } + } else if (tqq9_maxprice_gz != null && StringUtils.isNotBlank(tqq9_maxprice_gz)) { + if (sourceData.get("tqq9_maxprice_sh") == null && StringUtils.isBlank(tqq9_maxprice_sh)) { + sourceData.put("tqq9_maxprice_sh", tqq9_maxprice_gz); + } + if (sourceData.get("tqq9_maxprice_bj") == null && StringUtils.isBlank(tqq9_maxprice_bj)) { + sourceData.put("tqq9_maxprice_bj", tqq9_maxprice_gz); + } + } + + // 处理销售原价 + if (tqq9_xsyj1 != null && StringUtils.isNotBlank(tqq9_xsyj1)) { + if (sourceData.get("tqq9_amountfield1") == null && StringUtils.isBlank(tqq9_amountfield1)) { + sourceData.put("tqq9_amountfield1", tqq9_xsyj1); + } + if (sourceData.get("tqq9_amountfield4") == null && StringUtils.isBlank(tqq9_amountfield4)) { + sourceData.put("tqq9_amountfield4", tqq9_xsyj1); + } + } else if (tqq9_amountfield1 != null && StringUtils.isNotBlank(tqq9_amountfield1)) { + if (sourceData.get("tqq9_xsyj1") == null && StringUtils.isBlank(tqq9_xsyj1)) { + sourceData.put("tqq9_xsyj1", tqq9_amountfield1); + } + if (sourceData.get("tqq9_amountfield4") == null && StringUtils.isBlank(tqq9_amountfield4)) { + sourceData.put("tqq9_amountfield4", tqq9_amountfield1); + } + } else if (tqq9_amountfield4 != null && StringUtils.isNotBlank(tqq9_amountfield4)) { + if (sourceData.get("tqq9_xsyj1") == null && StringUtils.isBlank(tqq9_xsyj1)) { + sourceData.put("tqq9_xsyj1", tqq9_amountfield4); + } + if (sourceData.get("tqq9_amountfield1") == null && StringUtils.isBlank(tqq9_amountfield1)) { + sourceData.put("tqq9_amountfield1", tqq9_amountfield4); + } + } + } + } +} \ No newline at end of file