From e30625fdf79f0cc0607c255566d538d8a721e75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=9A=E8=B1=86=E8=B1=86?= <13356128+sunandmoon60@user.noreply.gitee.com> Date: Fri, 17 Oct 2025 17:48:44 +0800 Subject: [PATCH] =?UTF-8?q?1.url=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/im/OtherOutApplyBillPlugin.java | 3 +- .../plugin/form/pm/PurApplyBillPlugin.java | 205 ++++++++++-------- .../form/pm/PurRefundApplyBillPlugin.java | 39 +--- .../form/pm/PuroderBillShareRefundPlugin.java | 64 +++--- .../form/sys/DownloadAttachmentPlugin.java | 31 +++ .../form/sys/GoodlotManageBillPlugin.java | 7 +- .../form/sys/upattAchmentBillPlugin.java | 49 ++++- 7 files changed, 234 insertions(+), 164 deletions(-) create mode 100644 lc123/cloud/app/plugin/form/sys/DownloadAttachmentPlugin.java diff --git a/lc123/cloud/app/plugin/form/im/OtherOutApplyBillPlugin.java b/lc123/cloud/app/plugin/form/im/OtherOutApplyBillPlugin.java index 1bc94a4..ac02c78 100644 --- a/lc123/cloud/app/plugin/form/im/OtherOutApplyBillPlugin.java +++ b/lc123/cloud/app/plugin/form/im/OtherOutApplyBillPlugin.java @@ -201,7 +201,8 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor dynamicObject.set("tqq9_licensenoxkzh", entry.getString("tqq9_ykzno"));//许可证号 dynamicObject.set("tqq9_producedate", entry.getDate("tqq9_createdate"));//生产日期 dynamicObject.set("tqq9_expirydate", entry.getDate("tqq9_deadline"));//到期日期 - dynamicObject.set("tqq9_dcck", entry.getDynamicObject("tqq9_thck"));//退货仓库 + dynamicObject.set("tqq9_drck", entry.getDynamicObject("tqq9_thck"));//退货仓库 + dataEntity.set("tqq9_basedatafield1", entry.getDynamicObject("tqq9_thck"));//退货仓库 dynamicObject.set("tqq9_lot", entry.getDynamicObject("tqq9_ph"));//批号 dynamicObject.set("tqq9_qty", entry.getBigDecimal("qty"));//数量 dynamicObject.set("tqq9_baseqty", entry.getBigDecimal("qty"));//数量 diff --git a/lc123/cloud/app/plugin/form/pm/PurApplyBillPlugin.java b/lc123/cloud/app/plugin/form/pm/PurApplyBillPlugin.java index 6527f2d..d22a795 100644 --- a/lc123/cloud/app/plugin/form/pm/PurApplyBillPlugin.java +++ b/lc123/cloud/app/plugin/form/pm/PurApplyBillPlugin.java @@ -70,40 +70,46 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin { //集采供应商 if (StringUtils.equals("tqq9_sup_sh", name)) { DynamicObject tqq9_sup_sh = (DynamicObject) model.getValue("tqq9_sup_sh");//供应商 - DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, SH_ORGNUMBER)}); - EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); - entryFieldRefresher.updateDynamicObjectByOrg(SH_ORGNUMBER, "supplier", tqq9_sup_sh, model); - String tqq9_mulcombofield1 = tqq9_sup_sh.getString("tqq9_mulcombofield1"); - model.setValue("tqq9_suparea_sh", tqq9_mulcombofield1); - HashMap queryMap = new HashMap<>(); - queryMap.put("supplierId", tqq9_sup_sh.getString("number")); - queryMap.put("companyId", org.getString("number")); - Gson gson = new Gson(); - try { - String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap); - HashMap map = gson.fromJson(bodyString, HashMap.class); - ArrayList> data = (ArrayList) map.get("data"); - if (data != null) { - for (Map datum : data) { - Map dataMap = datum; - String type = dataMap.get("type").toString();//类型 - BigDecimal totalMoney = new BigDecimal((Double) dataMap.get("totalMoney"));//剩余总金额 - BigDecimal totalMoneyAvailable = new BigDecimal((Double) dataMap.get("totalMoneyAvailable"));//可使用金额 - if (StringUtils.equals(type, "1.0")) { - //货返 - model.setValue("tqq9_hshfzje_sh", totalMoney);//含税货返总金额 - model.setValue("tqq9_hshfkyje_sh", totalMoneyAvailable);//含税货返可用金额 - } else if (StringUtils.equals(type, "0.0")) { - //现返 - model.setValue("tqq9_hsxfzje_sh", totalMoney);//含税现返总金额 - model.setValue("tqq9_hsxfkyje_sh", totalMoneyAvailable);//含税现返可用金额 + if (tqq9_sup_sh != null) { + DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, SH_ORGNUMBER)}); + String number = org.getString("number"); + DynamicObject org_fl = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name", + new QFilter[]{new QFilter("number", QCP.equals, number)}); + String orgid_fl = org_fl != null ? org_fl.getString("name") : null; + EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); + entryFieldRefresher.updateDynamicObjectByOrg(SH_ORGNUMBER, "supplier", tqq9_sup_sh, model); + String tqq9_mulcombofield1 = tqq9_sup_sh.getString("tqq9_mulcombofield1"); + model.setValue("tqq9_suparea_sh", tqq9_mulcombofield1); + HashMap queryMap = new HashMap<>(); + queryMap.put("supplierId", tqq9_sup_sh.getString("tqq9_ztsupplierid")); + queryMap.put("companyId", orgid_fl); + Gson gson = new Gson(); + try { + String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap); + HashMap map = gson.fromJson(bodyString, HashMap.class); + ArrayList> data = (ArrayList) map.get("data"); + if (data != null) { + for (Map datum : data) { + Map dataMap = datum; + String type = dataMap.get("type").toString();//类型 + BigDecimal totalMoney = new BigDecimal((Double) dataMap.get("totalMoney"));//剩余总金额 + BigDecimal totalMoneyAvailable = new BigDecimal((Double) dataMap.get("totalMoneyAvailable"));//可使用金额 + if (StringUtils.equals(type, "1.0")) { + //货返 + model.setValue("tqq9_hshfzje_sh", totalMoney);//含税货返总金额 + model.setValue("tqq9_hshfkyje_sh", totalMoneyAvailable);//含税货返可用金额 + } else if (StringUtils.equals(type, "0.0")) { + //现返 + model.setValue("tqq9_hsxfzje_sh", totalMoney);//含税现返总金额 + model.setValue("tqq9_hsxfkyje_sh", totalMoneyAvailable);//含税现返可用金额 + } } } + } catch (IOException ex) { + throw new RuntimeException(ex); } - } catch (IOException ex) { - throw new RuntimeException(ex); + view.updateView(); } - view.updateView(); } //收货仓库 if (StringUtils.equals("tqq9_rewares_sh", name)) { @@ -151,42 +157,48 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin { //集采供应商 if (StringUtils.equals("tqq9_sup_bj", name)) { DynamicObject tqq9_sup_bj = (DynamicObject) model.getValue("tqq9_sup_bj"); - DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, BJ_ORGNUMBER)}); - EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); - entryFieldRefresher.updateDynamicObjectByOrg(BJ_ORGNUMBER, "supplier", tqq9_sup_bj, model); - String tqq9_mulcombofield1 = tqq9_sup_bj.getString("tqq9_mulcombofield1"); - model.setValue("tqq9_suparea_bj", tqq9_mulcombofield1); - HashMap queryMap = new HashMap<>(); - queryMap.put("supplierId", tqq9_sup_bj.getString("number")); - queryMap.put("companyId", org.getString("number")); - Gson gson = new Gson(); - try { - String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap); - HashMap map = gson.fromJson(bodyString, HashMap.class); - ArrayList> data = (ArrayList) map.get("data"); - if (data != null) { - for (Map datum : data) { - Map dataMap = datum; - String type = dataMap.get("type").toString();//类型 - BigDecimal totalMoney = new BigDecimal((Double) dataMap.get("totalMoney"));//剩余总金额 - BigDecimal totalMoneyAvailable = new BigDecimal((Double) dataMap.get("totalMoneyAvailable"));//可使用金额 - if (StringUtils.equals(type, "1.0")) { - //货返 - model.setValue("tqq9_hshfzje_bj", totalMoney);//含税货返总金额 - model.setValue("tqq9_hshfkyje_bj", totalMoneyAvailable);//含税货返可用金额 - } else if (StringUtils.equals(type, "0.0")) { - //现返 - model.setValue("tqq9_hsxfzje_bj", totalMoney);//含税现返总金额 - model.setValue("tqq9_hsxfkyje_bj", totalMoneyAvailable);//含税现返可用金额 + if (tqq9_sup_bj != null) { + DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, BJ_ORGNUMBER)}); + String number = org.getString("number"); + DynamicObject org_fl = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name", + new QFilter[]{new QFilter("number", QCP.equals, number)}); + String orgid_fl = org_fl != null ? org_fl.getString("name") : null; + EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); + entryFieldRefresher.updateDynamicObjectByOrg(BJ_ORGNUMBER, "supplier", tqq9_sup_bj, model); + String tqq9_mulcombofield1 = tqq9_sup_bj.getString("tqq9_mulcombofield1"); + model.setValue("tqq9_suparea_bj", tqq9_mulcombofield1); + HashMap queryMap = new HashMap<>(); + queryMap.put("supplierId", tqq9_sup_bj.getString("tqq9_ztsupplierid")); + queryMap.put("companyId", orgid_fl); + Gson gson = new Gson(); + try { + String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap); + HashMap map = gson.fromJson(bodyString, HashMap.class); + ArrayList> data = (ArrayList) map.get("data"); + if (data != null) { + for (Map datum : data) { + Map dataMap = datum; + String type = dataMap.get("type").toString();//类型 + BigDecimal totalMoney = new BigDecimal((Double) dataMap.get("totalMoney"));//剩余总金额 + BigDecimal totalMoneyAvailable = new BigDecimal((Double) dataMap.get("totalMoneyAvailable"));//可使用金额 + if (StringUtils.equals(type, "1.0")) { + //货返 + model.setValue("tqq9_hshfzje_bj", totalMoney);//含税货返总金额 + model.setValue("tqq9_hshfkyje_bj", totalMoneyAvailable);//含税货返可用金额 + } else if (StringUtils.equals(type, "0.0")) { + //现返 + model.setValue("tqq9_hsxfzje_bj", totalMoney);//含税现返总金额 + model.setValue("tqq9_hsxfkyje_bj", totalMoneyAvailable);//含税现返可用金额 + } } } + } catch (IOException ex) { + throw new RuntimeException(ex); } - } catch (IOException ex) { - throw new RuntimeException(ex); + + + view.updateView(); } - - - view.updateView(); } //收货仓库 if (StringUtils.equals("tqq9_rewares_bj", name)) { @@ -234,40 +246,47 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin { //集采供应商 if (StringUtils.equals("tqq9_sup_gz", name)) { DynamicObject tqq9_sup_gz = (DynamicObject) model.getValue("tqq9_sup_gz"); - DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, GZ_ORGNUMBER)}); - EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); - entryFieldRefresher.updateDynamicObjectByOrg(GZ_ORGNUMBER, "supplier", tqq9_sup_gz, model); - String tqq9_mulcombofield1 = tqq9_sup_gz.getString("tqq9_mulcombofield1"); - model.setValue("tqq9_suparea_gz", tqq9_mulcombofield1); - HashMap queryMap = new HashMap<>(); - queryMap.put("supplierId", tqq9_sup_gz.getString("number")); - queryMap.put("companyId", org.getString("number")); - Gson gson = new Gson(); - try { - String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap); - HashMap map = gson.fromJson(bodyString, HashMap.class); - ArrayList> data = (ArrayList) map.get("data"); - if (data != null) { - for (Map datum : data) { - Map dataMap = datum; - String type = dataMap.get("type").toString();//类型 - BigDecimal totalMoney = new BigDecimal((Double) dataMap.get("totalMoney"));//剩余总金额 - BigDecimal totalMoneyAvailable = new BigDecimal((Double) dataMap.get("totalMoneyAvailable"));//可使用金额 - if (StringUtils.equals(type, "1.0")) { - //货返 - model.setValue("tqq9_hshfzje_gz", totalMoney);//含税货返总金额 - model.setValue("tqq9_hshfkyje_gz", totalMoneyAvailable);//含税货返可用金额 - } else if (StringUtils.equals(type, "0.0")) { - //现返 - model.setValue("tqq9_hsxfzje_gz", totalMoney);//含税现返总金额 - model.setValue("tqq9_hsxfkyje_gz", totalMoneyAvailable);//含税现返可用金额 + if (tqq9_sup_gz != null) { + + DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, GZ_ORGNUMBER)}); + String number = org.getString("number"); + DynamicObject org_fl = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name", + new QFilter[]{new QFilter("number", QCP.equals, number)}); + String orgid_fl = org_fl != null ? org_fl.getString("name") : null; + EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher(); + entryFieldRefresher.updateDynamicObjectByOrg(GZ_ORGNUMBER, "supplier", tqq9_sup_gz, model); + String tqq9_mulcombofield1 = tqq9_sup_gz.getString("tqq9_mulcombofield1"); + model.setValue("tqq9_suparea_gz", tqq9_mulcombofield1); + HashMap queryMap = new HashMap<>(); + queryMap.put("supplierId", tqq9_sup_gz.getString("tqq9_ztsupplierid")); + queryMap.put("companyId", orgid_fl); + Gson gson = new Gson(); + try { + String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap); + HashMap map = gson.fromJson(bodyString, HashMap.class); + ArrayList> data = (ArrayList) map.get("data"); + if (data != null) { + for (Map datum : data) { + Map dataMap = datum; + String type = dataMap.get("type").toString();//类型 + BigDecimal totalMoney = new BigDecimal((Double) dataMap.get("totalMoney"));//剩余总金额 + BigDecimal totalMoneyAvailable = new BigDecimal((Double) dataMap.get("totalMoneyAvailable"));//可使用金额 + if (StringUtils.equals(type, "1.0")) { + //货返 + model.setValue("tqq9_hshfzje_gz", totalMoney);//含税货返总金额 + model.setValue("tqq9_hshfkyje_gz", totalMoneyAvailable);//含税货返可用金额 + } else if (StringUtils.equals(type, "0.0")) { + //现返 + model.setValue("tqq9_hsxfzje_gz", totalMoney);//含税现返总金额 + model.setValue("tqq9_hsxfkyje_gz", totalMoneyAvailable);//含税现返可用金额 + } } } + } catch (IOException ex) { + throw new RuntimeException(ex); } - } catch (IOException ex) { - throw new RuntimeException(ex); + view.updateView(); } - view.updateView(); } //收货仓库 if (StringUtils.equals("tqq9_rewares_gz", name)) { @@ -465,7 +484,7 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin { model.setValue("bomtime", date, i);//展BOM时间 model.setValue("linetype", LINETYPE, i);//行类型 model.setValue("linetype", LINETYPE, i);//行类型 - model.setValue("entrychangetype", "B",i);//变更方式 + model.setValue("entrychangetype", "B", i);//变更方式 model.setValue("entrycreator", user, i);//创建人 model.setValue("entryrecdept", tqq9_org, i);//收货部门 model.setValue("entrypurdept", tqq9_org, i);//采购部门 diff --git a/lc123/cloud/app/plugin/form/pm/PurRefundApplyBillPlugin.java b/lc123/cloud/app/plugin/form/pm/PurRefundApplyBillPlugin.java index 21e416f..ced4a48 100644 --- a/lc123/cloud/app/plugin/form/pm/PurRefundApplyBillPlugin.java +++ b/lc123/cloud/app/plugin/form/pm/PurRefundApplyBillPlugin.java @@ -2,7 +2,6 @@ package tqq9.lc123.cloud.app.plugin.form.pm; import kd.bos.bill.AbstractBillPlugIn; import kd.bos.bill.BillShowParameter; -import kd.bos.bill.OperationStatus; import kd.bos.dataentity.OperateOption; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; @@ -10,8 +9,6 @@ import kd.bos.dataentity.utils.StringUtils; import kd.bos.entity.operate.result.OperationResult; import kd.bos.form.CloseCallBack; import kd.bos.form.ShowType; -import kd.bos.form.StyleCss; -import kd.bos.form.control.Control; import kd.bos.form.events.BeforeDoOperationEventArgs; import kd.bos.form.events.ClosedCallBackEvent; import kd.bos.form.field.BasedataEdit; @@ -71,10 +68,10 @@ public class PurRefundApplyBillPlugin extends AbstractBillPlugIn implements Befo super.beforeDoOperation(args); FormOperate Operate = (FormOperate) args.getSource(); Boolean tqq9_isydth = (Boolean) this.getModel().getValue("tqq9_isydth");//是否异地退货 - DynamicObject tqq9_yythbillno = (DynamicObject)this.getModel().getValue("tqq9_yythbillno");//异地退货单号 - String tqq9_ydthno=null; - if (tqq9_yythbillno!=null){ - tqq9_ydthno=tqq9_yythbillno.getString("billno"); + DynamicObject tqq9_yythbillno = (DynamicObject) this.getModel().getValue("tqq9_yythbillno");//异地退货单号 + String tqq9_ydthno = null; + if (tqq9_yythbillno != null) { + tqq9_ydthno = tqq9_yythbillno.getString("billno"); } if (StringUtils.equals("save", Operate.getOperateKey()) && tqq9_isydth && StringUtils.isBlank(tqq9_ydthno)) { BillShowParameter param = new BillShowParameter(); @@ -90,12 +87,12 @@ public class PurRefundApplyBillPlugin extends AbstractBillPlugIn implements Befo String billno = this.getModel().getValue("billno").toString(); this.getView().showErrorNotification("采购退货单:" + billno + ",对应的异地退货单号:" + tqq9_ydthno + "未提交"); } - }else if(StringUtils.equals("audit", Operate.getOperateKey()) && tqq9_isydth && StringUtils.isNotBlank(tqq9_ydthno)){ + } else if (StringUtils.equals("audit", Operate.getOperateKey()) && tqq9_isydth && StringUtils.isNotBlank(tqq9_ydthno)) { DynamicObject tqq9_otheroutapply = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.equals, tqq9_ydthno)}); String billstatus = tqq9_otheroutapply.getString("billstatus"); - if(StringUtils.equals("B",billstatus)){ + if (StringUtils.equals("B", billstatus)) { OperateOption operateOption = OperateOption.create(); - OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, "tqq9_otheroutapply", new DynamicObject[]{tqq9_otheroutapply }, operateOption); + OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, "tqq9_otheroutapply", new DynamicObject[]{tqq9_otheroutapply}, operateOption); if (auditResult.isSuccess()) { this.getView().showMessage("异地退货审核成功"); } @@ -103,28 +100,6 @@ public class PurRefundApplyBillPlugin extends AbstractBillPlugIn implements Befo } } -// /** -// * 点击对应异地退货单号跳转 -// */ -// @Override -// public void click(EventObject evt) { -// super.click(evt); -// Control source = (Control) evt.getSource(); -// if (StringUtils.equals("tqq9_ydthno", source.getKey())) { -// String tqq9_ydthno = (String) this.getModel().getValue("tqq9_ydthno"); -// DynamicObject tqq9_otheroutapply = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.equals, tqq9_ydthno)}); -// if (tqq9_otheroutapply != null) { -// BillShowParameter formshowParameter = new BillShowParameter(); -// formshowParameter.setFormId("tqq9_otheroutapply"); -// formshowParameter.getOpenStyle().setInlineStyleCss(new StyleCss()); -// formshowParameter.setPkId(tqq9_otheroutapply.get("id")); -// formshowParameter.getOpenStyle().setShowType(ShowType.Modal); -// formshowParameter.setStatus(OperationStatus.VIEW); -// this.getView().showForm(formshowParameter); -// } -// } -// -// } /** * 出库批号根据了做筛选 diff --git a/lc123/cloud/app/plugin/form/pm/PuroderBillShareRefundPlugin.java b/lc123/cloud/app/plugin/form/pm/PuroderBillShareRefundPlugin.java index 34bdc7e..5d7e566 100644 --- a/lc123/cloud/app/plugin/form/pm/PuroderBillShareRefundPlugin.java +++ b/lc123/cloud/app/plugin/form/pm/PuroderBillShareRefundPlugin.java @@ -39,6 +39,7 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn { }}; private static String URL; + static { DynamicObject url = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name", new QFilter[]{new QFilter("number", QCP.equals, "FLXT_Balance_Url")}); @@ -46,7 +47,6 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn { } - @Override public void afterAddRow(AfterAddRowEventArgs e) { super.afterAddRow(e); @@ -321,9 +321,9 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn { int rowIndex = changeData.getRowIndex(); int seq = rowIndex; BigDecimal newValue = (BigDecimal) changeData.getNewValue(); - BigDecimal tqq9_zgcgxj = (BigDecimal) getModel().getValue("tqq9_zgcgxj",seq); + BigDecimal tqq9_zgcgxj = (BigDecimal) getModel().getValue("tqq9_zgcgxj", seq); if (newValue.compareTo(tqq9_zgcgxj) > 0 && tqq9_zgcgxj.compareTo(BigDecimal.ZERO) > 0) { - getModel().setValue("priceandtax", 0,seq); + getModel().setValue("priceandtax", 0, seq); this.getView().showErrorNotification("物料明细分录行" + seq + "含税单价超过最高采购限价,请修改"); } } @@ -331,36 +331,42 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn { IDataModel model = this.getModel(); ChangeData changeData = e.getChangeSet()[0]; DynamicObject newValue = (DynamicObject) changeData.getNewValue();//供应商 - DynamicObject org = (DynamicObject)model.getValue("org");//组织 - HashMap queryMap =new HashMap<>(); - queryMap.put("supplierId",newValue.getString("number")); - queryMap.put("companyId",org.getString("number")); - Gson gson = new Gson(); - try { - String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap); - HashMap map = gson.fromJson(bodyString, HashMap.class); - ArrayList> data = (ArrayList) map.get("data"); - if(data!=null){ - for (Map datum : data) { - Map dataMap = datum; - String type = dataMap.get("type").toString();//类型 - BigDecimal totalMoney = new BigDecimal((Double)dataMap.get("totalMoney"));//剩余总金额 - BigDecimal totalMoneyAvailable = new BigDecimal((Double)dataMap.get("totalMoneyAvailable")) ;//可使用金额 - if(StringUtils.equals(type,"1.0")){ - //货返 - model.setValue("tqq9_hshfzje",totalMoney);//含税货返总金额 - model.setValue("tqq9_hshfkyje",totalMoneyAvailable);//含税货返可用金额 - }else if(StringUtils.equals(type,"0.0")){ - //现返 - model.setValue("tqq9_hsxfzje",totalMoney);//含税现返总金额 - model.setValue("tqq9_hsxfzje",totalMoneyAvailable);//含税现返可用金额 + DynamicObject org = (DynamicObject) model.getValue("org");//组织 + if (newValue != null && org != null) { + String number = org.getString("number"); + DynamicObject org_fl = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name", + new QFilter[]{new QFilter("number", QCP.equals, number)}); + String orgid_fl = org_fl != null ? org_fl.getString("name") : null; + HashMap queryMap = new HashMap<>(); + queryMap.put("supplierId", newValue.getString("tqq9_ztsupplierid")); + queryMap.put("companyId", orgid_fl); + Gson gson = new Gson(); + try { + String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap); + HashMap map = gson.fromJson(bodyString, HashMap.class); + ArrayList> data = (ArrayList) map.get("data"); + if (data != null) { + for (Map datum : data) { + Map dataMap = datum; + String type = dataMap.get("type").toString();//类型 + BigDecimal totalMoney = new BigDecimal((Double) dataMap.get("totalMoney"));//剩余总金额 + BigDecimal totalMoneyAvailable = new BigDecimal((Double) dataMap.get("totalMoneyAvailable"));//可使用金额 + if (StringUtils.equals(type, "1.0")) { + //货返 + model.setValue("tqq9_hshfzje", totalMoney);//含税货返总金额 + model.setValue("tqq9_hshfkyje", totalMoneyAvailable);//含税货返可用金额 + } else if (StringUtils.equals(type, "0.0")) { + //现返 + model.setValue("tqq9_hsxfzje", totalMoney);//含税现返总金额 + model.setValue("tqq9_hsxfkyje", totalMoneyAvailable);//含税现返可用金额 + } } } + } catch (IOException ex) { + throw new RuntimeException(ex); } - } catch (IOException ex) { - throw new RuntimeException(ex); + getView().updateView(); } - getView().updateView(); } } } diff --git a/lc123/cloud/app/plugin/form/sys/DownloadAttachmentPlugin.java b/lc123/cloud/app/plugin/form/sys/DownloadAttachmentPlugin.java new file mode 100644 index 0000000..595036a --- /dev/null +++ b/lc123/cloud/app/plugin/form/sys/DownloadAttachmentPlugin.java @@ -0,0 +1,31 @@ +package tqq9.lc123.cloud.app.plugin.form.sys; + +import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.dataentity.utils.StringUtils; +import kd.bos.form.control.events.ItemClickEvent; +import kd.sdk.plugin.Plugin; + +import java.util.EventObject; + +/** + * 点击按钮下载附件 + */ +public class DownloadAttachmentPlugin extends AbstractBillPlugIn implements Plugin { + @Override + public void registerListener(EventObject e) { + super.registerListener(e); + this.addItemClickListeners("tbmain"); + } + + @Override + public void itemClick(ItemClickEvent evt) { + super.itemClick(evt); + String itemKey = evt.getItemKey(); + if (StringUtils.equals("tqq9_download", itemKey)) { + String tqq9_zcztplj = this.getModel().getValue("tqq9_zcztplj").toString(); + if (StringUtils.isNotBlank(tqq9_zcztplj)) { + this.getView().openUrl(tqq9_zcztplj); + } + } + } +} \ No newline at end of file diff --git a/lc123/cloud/app/plugin/form/sys/GoodlotManageBillPlugin.java b/lc123/cloud/app/plugin/form/sys/GoodlotManageBillPlugin.java index beb2589..d353b6a 100644 --- a/lc123/cloud/app/plugin/form/sys/GoodlotManageBillPlugin.java +++ b/lc123/cloud/app/plugin/form/sys/GoodlotManageBillPlugin.java @@ -78,8 +78,8 @@ public class GoodlotManageBillPlugin extends AbstractListPlugin implements Plugi Object[] ids = selectedRows.getPrimaryKeyValues(); Object id = ids[0]; FormShowParameter param = new FormShowParameter(); - param.setFormId("tqq9_upload"); - param.setCloseCallBack(new CloseCallBack(this, "tqq9_upload")); + param.setFormId("tqq9_uploadattachment"); + param.setCloseCallBack(new CloseCallBack(this, "tqq9_uploadattachment")); param.getOpenStyle().setShowType(ShowType.Modal); param.setCustomParam("buttontype", itemKey); param.setCustomParam("id", id); @@ -96,7 +96,7 @@ public class GoodlotManageBillPlugin extends AbstractListPlugin implements Plugi String actionId = closedCallBackEvent.getActionId(); Object returnData = closedCallBackEvent.getReturnData(); if (returnData != null) { - if (StringUtils.equals("tqq9_upload", actionId)) { + if (StringUtils.equals("tqq9_uploadattachment", actionId)) { ArrayList attachmentData = (ArrayList) ((HashMap) returnData).get("attachmentData"); HashMap map = (HashMap) attachmentData.get(0); String url = map.get("url").toString(); @@ -139,6 +139,7 @@ public class GoodlotManageBillPlugin extends AbstractListPlugin implements Plugi String url = tqq9_goodlotmanage.getString(fieldName); if (url != null) { this.getView().download(url); +// this.getView().openUrl(url); } } } diff --git a/lc123/cloud/app/plugin/form/sys/upattAchmentBillPlugin.java b/lc123/cloud/app/plugin/form/sys/upattAchmentBillPlugin.java index 8051780..baf923f 100644 --- a/lc123/cloud/app/plugin/form/sys/upattAchmentBillPlugin.java +++ b/lc123/cloud/app/plugin/form/sys/upattAchmentBillPlugin.java @@ -5,7 +5,12 @@ import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.utils.StringUtils; import kd.bos.form.FormShowParameter; import kd.bos.form.control.AttachmentPanel; -import kd.bos.form.events.AfterDoOperationEventArgs; +import kd.bos.form.events.BeforeDoOperationEventArgs; +import kd.bos.form.operate.FormOperate; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import kd.sdk.plugin.Plugin; import java.util.EventObject; @@ -25,14 +30,46 @@ public class upattAchmentBillPlugin extends AbstractBillPlugIn implements Plugin } + /** + * 由商品批次注册证管理界面跳转此界面,选择附件后回传相关信息 + */ +// @Override +// public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) { +// super.afterDoOperation(afterDoOperationEventArgs); +// String itemKey = afterDoOperationEventArgs.getOperateKey(); +// if (StringUtils.equals("dothing", itemKey)) { +// FormShowParameter formShowParameter = this.getView().getFormShowParameter(); +// String buttontype = formShowParameter.getCustomParam("buttontype").toString(); +// String id = formShowParameter.getCustomParam("id").toString(); +// AttachmentPanel tqq9_attachmentpanelap = this.getView().getControl("tqq9_attachmentpanelap"); +// List> attachmentData = tqq9_attachmentpanelap.getAttachmentData(); +// HashMap map = new HashMap<>(); +// map.put("attachmentData", attachmentData); +// map.put("buttontype", buttontype); +// map.put("id", id); +// this.getView().returnDataToParent(map); +// this.getView().close(); +// +// } +// } + /** * 由商品批次注册证管理界面跳转此界面,选择附件后回传相关信息 */ @Override - public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) { - super.afterDoOperation(afterDoOperationEventArgs); - String itemKey = afterDoOperationEventArgs.getOperateKey(); - if (StringUtils.equals("donothing", itemKey)) { + public void beforeDoOperation(BeforeDoOperationEventArgs args) { + super.beforeDoOperation(args); + FormOperate formOperate = (FormOperate)args.getSource(); + if ( StringUtils.equals( "save", formOperate.getOperateKey())){ + DynamicObject dataEntity = this.getModel().getDataEntity(); + long currentUserId = UserServiceHelper.getCurrentUserId(); + DynamicObject user = BusinessDataServiceHelper.loadSingle("bos_user", new QFilter[]{new QFilter("id", QCP.equals, currentUserId)}); + long timestamp = System.currentTimeMillis(); + String number = String.valueOf(timestamp); + dataEntity.set("number",number); + dataEntity.set("status","A"); + dataEntity.set("creator",user); + dataEntity.set("enable","1"); FormShowParameter formShowParameter = this.getView().getFormShowParameter(); String buttontype = formShowParameter.getCustomParam("buttontype").toString(); String id = formShowParameter.getCustomParam("id").toString(); @@ -46,8 +83,8 @@ public class upattAchmentBillPlugin extends AbstractBillPlugIn implements Plugin this.getView().close(); } + } - } \ No newline at end of file