1.url下载

This commit is contained in:
龚豆豆 2025-10-17 17:48:44 +08:00
parent 6453839d00
commit e30625fdf7
7 changed files with 234 additions and 164 deletions

View File

@ -201,7 +201,8 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor
dynamicObject.set("tqq9_licensenoxkzh", entry.getString("tqq9_ykzno"));//许可证号 dynamicObject.set("tqq9_licensenoxkzh", entry.getString("tqq9_ykzno"));//许可证号
dynamicObject.set("tqq9_producedate", entry.getDate("tqq9_createdate"));//生产日期 dynamicObject.set("tqq9_producedate", entry.getDate("tqq9_createdate"));//生产日期
dynamicObject.set("tqq9_expirydate", entry.getDate("tqq9_deadline"));//到期日期 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_lot", entry.getDynamicObject("tqq9_ph"));//批号
dynamicObject.set("tqq9_qty", entry.getBigDecimal("qty"));//数量 dynamicObject.set("tqq9_qty", entry.getBigDecimal("qty"));//数量
dynamicObject.set("tqq9_baseqty", entry.getBigDecimal("qty"));//数量 dynamicObject.set("tqq9_baseqty", entry.getBigDecimal("qty"));//数量

View File

@ -70,14 +70,19 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
//集采供应商 //集采供应商
if (StringUtils.equals("tqq9_sup_sh", name)) { if (StringUtils.equals("tqq9_sup_sh", name)) {
DynamicObject tqq9_sup_sh = (DynamicObject) model.getValue("tqq9_sup_sh");//供应商 DynamicObject tqq9_sup_sh = (DynamicObject) model.getValue("tqq9_sup_sh");//供应商
if (tqq9_sup_sh != null) {
DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, SH_ORGNUMBER)}); 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 entryFieldRefresher = new EntryFieldRefresher();
entryFieldRefresher.updateDynamicObjectByOrg(SH_ORGNUMBER, "supplier", tqq9_sup_sh, model); entryFieldRefresher.updateDynamicObjectByOrg(SH_ORGNUMBER, "supplier", tqq9_sup_sh, model);
String tqq9_mulcombofield1 = tqq9_sup_sh.getString("tqq9_mulcombofield1"); String tqq9_mulcombofield1 = tqq9_sup_sh.getString("tqq9_mulcombofield1");
model.setValue("tqq9_suparea_sh", tqq9_mulcombofield1); model.setValue("tqq9_suparea_sh", tqq9_mulcombofield1);
HashMap<String, Object> queryMap = new HashMap<>(); HashMap<String, Object> queryMap = new HashMap<>();
queryMap.put("supplierId", tqq9_sup_sh.getString("number")); queryMap.put("supplierId", tqq9_sup_sh.getString("tqq9_ztsupplierid"));
queryMap.put("companyId", org.getString("number")); queryMap.put("companyId", orgid_fl);
Gson gson = new Gson(); Gson gson = new Gson();
try { try {
String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap); String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap);
@ -105,6 +110,7 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
} }
view.updateView(); view.updateView();
} }
}
//收货仓库 //收货仓库
if (StringUtils.equals("tqq9_rewares_sh", name)) { if (StringUtils.equals("tqq9_rewares_sh", name)) {
DynamicObject tqq9_rewares_sh = (DynamicObject) model.getValue("tqq9_rewares_sh"); DynamicObject tqq9_rewares_sh = (DynamicObject) model.getValue("tqq9_rewares_sh");
@ -151,14 +157,19 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
//集采供应商 //集采供应商
if (StringUtils.equals("tqq9_sup_bj", name)) { if (StringUtils.equals("tqq9_sup_bj", name)) {
DynamicObject tqq9_sup_bj = (DynamicObject) model.getValue("tqq9_sup_bj"); DynamicObject tqq9_sup_bj = (DynamicObject) model.getValue("tqq9_sup_bj");
if (tqq9_sup_bj != null) {
DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, BJ_ORGNUMBER)}); 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 entryFieldRefresher = new EntryFieldRefresher();
entryFieldRefresher.updateDynamicObjectByOrg(BJ_ORGNUMBER, "supplier", tqq9_sup_bj, model); entryFieldRefresher.updateDynamicObjectByOrg(BJ_ORGNUMBER, "supplier", tqq9_sup_bj, model);
String tqq9_mulcombofield1 = tqq9_sup_bj.getString("tqq9_mulcombofield1"); String tqq9_mulcombofield1 = tqq9_sup_bj.getString("tqq9_mulcombofield1");
model.setValue("tqq9_suparea_bj", tqq9_mulcombofield1); model.setValue("tqq9_suparea_bj", tqq9_mulcombofield1);
HashMap<String, Object> queryMap = new HashMap<>(); HashMap<String, Object> queryMap = new HashMap<>();
queryMap.put("supplierId", tqq9_sup_bj.getString("number")); queryMap.put("supplierId", tqq9_sup_bj.getString("tqq9_ztsupplierid"));
queryMap.put("companyId", org.getString("number")); queryMap.put("companyId", orgid_fl);
Gson gson = new Gson(); Gson gson = new Gson();
try { try {
String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap); String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap);
@ -188,6 +199,7 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
view.updateView(); view.updateView();
} }
}
//收货仓库 //收货仓库
if (StringUtils.equals("tqq9_rewares_bj", name)) { if (StringUtils.equals("tqq9_rewares_bj", name)) {
DynamicObject tqq9_rewares_bj = (DynamicObject) model.getValue("tqq9_rewares_bj"); DynamicObject tqq9_rewares_bj = (DynamicObject) model.getValue("tqq9_rewares_bj");
@ -234,14 +246,20 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
//集采供应商 //集采供应商
if (StringUtils.equals("tqq9_sup_gz", name)) { if (StringUtils.equals("tqq9_sup_gz", name)) {
DynamicObject tqq9_sup_gz = (DynamicObject) model.getValue("tqq9_sup_gz"); DynamicObject tqq9_sup_gz = (DynamicObject) model.getValue("tqq9_sup_gz");
if (tqq9_sup_gz != null) {
DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("number", QCP.equals, GZ_ORGNUMBER)}); 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 entryFieldRefresher = new EntryFieldRefresher();
entryFieldRefresher.updateDynamicObjectByOrg(GZ_ORGNUMBER, "supplier", tqq9_sup_gz, model); entryFieldRefresher.updateDynamicObjectByOrg(GZ_ORGNUMBER, "supplier", tqq9_sup_gz, model);
String tqq9_mulcombofield1 = tqq9_sup_gz.getString("tqq9_mulcombofield1"); String tqq9_mulcombofield1 = tqq9_sup_gz.getString("tqq9_mulcombofield1");
model.setValue("tqq9_suparea_gz", tqq9_mulcombofield1); model.setValue("tqq9_suparea_gz", tqq9_mulcombofield1);
HashMap<String, Object> queryMap = new HashMap<>(); HashMap<String, Object> queryMap = new HashMap<>();
queryMap.put("supplierId", tqq9_sup_gz.getString("number")); queryMap.put("supplierId", tqq9_sup_gz.getString("tqq9_ztsupplierid"));
queryMap.put("companyId", org.getString("number")); queryMap.put("companyId", orgid_fl);
Gson gson = new Gson(); Gson gson = new Gson();
try { try {
String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap); String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap);
@ -269,6 +287,7 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
} }
view.updateView(); view.updateView();
} }
}
//收货仓库 //收货仓库
if (StringUtils.equals("tqq9_rewares_gz", name)) { if (StringUtils.equals("tqq9_rewares_gz", name)) {
DynamicObject tqq9_rewares_gz = (DynamicObject) model.getValue("tqq9_rewares_gz"); DynamicObject tqq9_rewares_gz = (DynamicObject) model.getValue("tqq9_rewares_gz");
@ -465,7 +484,7 @@ public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
model.setValue("bomtime", date, i);//展BOM时间 model.setValue("bomtime", date, i);//展BOM时间
model.setValue("linetype", LINETYPE, i);//行类型 model.setValue("linetype", LINETYPE, i);//行类型
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("entrycreator", user, i);//创建人
model.setValue("entryrecdept", tqq9_org, i);//收货部门 model.setValue("entryrecdept", tqq9_org, i);//收货部门
model.setValue("entrypurdept", tqq9_org, i);//采购部门 model.setValue("entrypurdept", tqq9_org, i);//采购部门

View File

@ -2,7 +2,6 @@ package tqq9.lc123.cloud.app.plugin.form.pm;
import kd.bos.bill.AbstractBillPlugIn; import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.bill.BillShowParameter; import kd.bos.bill.BillShowParameter;
import kd.bos.bill.OperationStatus;
import kd.bos.dataentity.OperateOption; import kd.bos.dataentity.OperateOption;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection; 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.entity.operate.result.OperationResult;
import kd.bos.form.CloseCallBack; import kd.bos.form.CloseCallBack;
import kd.bos.form.ShowType; 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.BeforeDoOperationEventArgs;
import kd.bos.form.events.ClosedCallBackEvent; import kd.bos.form.events.ClosedCallBackEvent;
import kd.bos.form.field.BasedataEdit; import kd.bos.form.field.BasedataEdit;
@ -71,10 +68,10 @@ public class PurRefundApplyBillPlugin extends AbstractBillPlugIn implements Befo
super.beforeDoOperation(args); super.beforeDoOperation(args);
FormOperate Operate = (FormOperate) args.getSource(); FormOperate Operate = (FormOperate) args.getSource();
Boolean tqq9_isydth = (Boolean) this.getModel().getValue("tqq9_isydth");//是否异地退货 Boolean tqq9_isydth = (Boolean) this.getModel().getValue("tqq9_isydth");//是否异地退货
DynamicObject tqq9_yythbillno = (DynamicObject)this.getModel().getValue("tqq9_yythbillno");//异地退货单号 DynamicObject tqq9_yythbillno = (DynamicObject) this.getModel().getValue("tqq9_yythbillno");//异地退货单号
String tqq9_ydthno=null; String tqq9_ydthno = null;
if (tqq9_yythbillno!=null){ if (tqq9_yythbillno != null) {
tqq9_ydthno=tqq9_yythbillno.getString("billno"); tqq9_ydthno = tqq9_yythbillno.getString("billno");
} }
if (StringUtils.equals("save", Operate.getOperateKey()) && tqq9_isydth && StringUtils.isBlank(tqq9_ydthno)) { if (StringUtils.equals("save", Operate.getOperateKey()) && tqq9_isydth && StringUtils.isBlank(tqq9_ydthno)) {
BillShowParameter param = new BillShowParameter(); BillShowParameter param = new BillShowParameter();
@ -90,12 +87,12 @@ public class PurRefundApplyBillPlugin extends AbstractBillPlugIn implements Befo
String billno = this.getModel().getValue("billno").toString(); String billno = this.getModel().getValue("billno").toString();
this.getView().showErrorNotification("采购退货单:" + billno + ",对应的异地退货单号:" + tqq9_ydthno + "未提交"); 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)}); DynamicObject tqq9_otheroutapply = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.equals, tqq9_ydthno)});
String billstatus = tqq9_otheroutapply.getString("billstatus"); String billstatus = tqq9_otheroutapply.getString("billstatus");
if(StringUtils.equals("B",billstatus)){ if (StringUtils.equals("B", billstatus)) {
OperateOption operateOption = OperateOption.create(); 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()) { if (auditResult.isSuccess()) {
this.getView().showMessage("异地退货审核成功"); 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);
// }
// }
//
// }
/** /**
* 出库批号根据了做筛选 * 出库批号根据了做筛选

View File

@ -39,6 +39,7 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
}}; }};
private static String URL; private static String URL;
static { static {
DynamicObject url = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name", DynamicObject url = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
new QFilter[]{new QFilter("number", QCP.equals, "FLXT_Balance_Url")}); new QFilter[]{new QFilter("number", QCP.equals, "FLXT_Balance_Url")});
@ -46,7 +47,6 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
} }
@Override @Override
public void afterAddRow(AfterAddRowEventArgs e) { public void afterAddRow(AfterAddRowEventArgs e) {
super.afterAddRow(e); super.afterAddRow(e);
@ -321,9 +321,9 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
int rowIndex = changeData.getRowIndex(); int rowIndex = changeData.getRowIndex();
int seq = rowIndex; int seq = rowIndex;
BigDecimal newValue = (BigDecimal) changeData.getNewValue(); 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) { 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 + "含税单价超过最高采购限价,请修改"); this.getView().showErrorNotification("物料明细分录行" + seq + "含税单价超过最高采购限价,请修改");
} }
} }
@ -331,29 +331,34 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
IDataModel model = this.getModel(); IDataModel model = this.getModel();
ChangeData changeData = e.getChangeSet()[0]; ChangeData changeData = e.getChangeSet()[0];
DynamicObject newValue = (DynamicObject) changeData.getNewValue();//供应商 DynamicObject newValue = (DynamicObject) changeData.getNewValue();//供应商
DynamicObject org = (DynamicObject)model.getValue("org");//组织 DynamicObject org = (DynamicObject) model.getValue("org");//组织
HashMap<String,Object> queryMap =new HashMap<>(); if (newValue != null && org != null) {
queryMap.put("supplierId",newValue.getString("number")); String number = org.getString("number");
queryMap.put("companyId",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<String, Object> queryMap = new HashMap<>();
queryMap.put("supplierId", newValue.getString("tqq9_ztsupplierid"));
queryMap.put("companyId", orgid_fl);
Gson gson = new Gson(); Gson gson = new Gson();
try { try {
String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap); String bodyString = HttpRequestUtils.doGet(URL, queryMap, tokenMap);
HashMap map = gson.fromJson(bodyString, HashMap.class); HashMap map = gson.fromJson(bodyString, HashMap.class);
ArrayList<Map<String, Object>> data = (ArrayList) map.get("data"); ArrayList<Map<String, Object>> data = (ArrayList) map.get("data");
if(data!=null){ if (data != null) {
for (Map datum : data) { for (Map datum : data) {
Map<String, Object> dataMap = datum; Map<String, Object> dataMap = datum;
String type = dataMap.get("type").toString();//类型 String type = dataMap.get("type").toString();//类型
BigDecimal totalMoney = new BigDecimal((Double)dataMap.get("totalMoney"));//剩余总金额 BigDecimal totalMoney = new BigDecimal((Double) dataMap.get("totalMoney"));//剩余总金额
BigDecimal totalMoneyAvailable = new BigDecimal((Double)dataMap.get("totalMoneyAvailable")) ;//可使用金额 BigDecimal totalMoneyAvailable = new BigDecimal((Double) dataMap.get("totalMoneyAvailable"));//可使用金额
if(StringUtils.equals(type,"1.0")){ if (StringUtils.equals(type, "1.0")) {
//货返 //货返
model.setValue("tqq9_hshfzje",totalMoney);//含税货返总金额 model.setValue("tqq9_hshfzje", totalMoney);//含税货返总金额
model.setValue("tqq9_hshfkyje",totalMoneyAvailable);//含税货返可用金额 model.setValue("tqq9_hshfkyje", totalMoneyAvailable);//含税货返可用金额
}else if(StringUtils.equals(type,"0.0")){ } else if (StringUtils.equals(type, "0.0")) {
//现返 //现返
model.setValue("tqq9_hsxfzje",totalMoney);//含税现返总金额 model.setValue("tqq9_hsxfzje", totalMoney);//含税现返总金额
model.setValue("tqq9_hsxfzje",totalMoneyAvailable);//含税现返可用金额 model.setValue("tqq9_hsxfkyje", totalMoneyAvailable);//含税现返可用金额
} }
} }
} }
@ -363,4 +368,5 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
getView().updateView(); getView().updateView();
} }
} }
}
} }

View File

@ -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);
}
}
}
}

View File

@ -78,8 +78,8 @@ public class GoodlotManageBillPlugin extends AbstractListPlugin implements Plugi
Object[] ids = selectedRows.getPrimaryKeyValues(); Object[] ids = selectedRows.getPrimaryKeyValues();
Object id = ids[0]; Object id = ids[0];
FormShowParameter param = new FormShowParameter(); FormShowParameter param = new FormShowParameter();
param.setFormId("tqq9_upload"); param.setFormId("tqq9_uploadattachment");
param.setCloseCallBack(new CloseCallBack(this, "tqq9_upload")); param.setCloseCallBack(new CloseCallBack(this, "tqq9_uploadattachment"));
param.getOpenStyle().setShowType(ShowType.Modal); param.getOpenStyle().setShowType(ShowType.Modal);
param.setCustomParam("buttontype", itemKey); param.setCustomParam("buttontype", itemKey);
param.setCustomParam("id", id); param.setCustomParam("id", id);
@ -96,7 +96,7 @@ public class GoodlotManageBillPlugin extends AbstractListPlugin implements Plugi
String actionId = closedCallBackEvent.getActionId(); String actionId = closedCallBackEvent.getActionId();
Object returnData = closedCallBackEvent.getReturnData(); Object returnData = closedCallBackEvent.getReturnData();
if (returnData != null) { if (returnData != null) {
if (StringUtils.equals("tqq9_upload", actionId)) { if (StringUtils.equals("tqq9_uploadattachment", actionId)) {
ArrayList attachmentData = (ArrayList) ((HashMap) returnData).get("attachmentData"); ArrayList attachmentData = (ArrayList) ((HashMap) returnData).get("attachmentData");
HashMap<String, Object> map = (HashMap) attachmentData.get(0); HashMap<String, Object> map = (HashMap) attachmentData.get(0);
String url = map.get("url").toString(); String url = map.get("url").toString();
@ -139,6 +139,7 @@ public class GoodlotManageBillPlugin extends AbstractListPlugin implements Plugi
String url = tqq9_goodlotmanage.getString(fieldName); String url = tqq9_goodlotmanage.getString(fieldName);
if (url != null) { if (url != null) {
this.getView().download(url); this.getView().download(url);
// this.getView().openUrl(url);
} }
} }
} }

View File

@ -5,7 +5,12 @@ import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.utils.StringUtils; import kd.bos.dataentity.utils.StringUtils;
import kd.bos.form.FormShowParameter; import kd.bos.form.FormShowParameter;
import kd.bos.form.control.AttachmentPanel; 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 kd.sdk.plugin.Plugin;
import java.util.EventObject; 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<Map<String, Object>> attachmentData = tqq9_attachmentpanelap.getAttachmentData();
// HashMap<String, Object> map = new HashMap<>();
// map.put("attachmentData", attachmentData);
// map.put("buttontype", buttontype);
// map.put("id", id);
// this.getView().returnDataToParent(map);
// this.getView().close();
//
// }
// }
/** /**
* 由商品批次注册证管理界面跳转此界面选择附件后回传相关信息 * 由商品批次注册证管理界面跳转此界面选择附件后回传相关信息
*/ */
@Override @Override
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) { public void beforeDoOperation(BeforeDoOperationEventArgs args) {
super.afterDoOperation(afterDoOperationEventArgs); super.beforeDoOperation(args);
String itemKey = afterDoOperationEventArgs.getOperateKey(); FormOperate formOperate = (FormOperate)args.getSource();
if (StringUtils.equals("donothing", itemKey)) { 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(); FormShowParameter formShowParameter = this.getView().getFormShowParameter();
String buttontype = formShowParameter.getCustomParam("buttontype").toString(); String buttontype = formShowParameter.getCustomParam("buttontype").toString();
String id = formShowParameter.getCustomParam("id").toString(); String id = formShowParameter.getCustomParam("id").toString();
@ -46,8 +83,8 @@ public class upattAchmentBillPlugin extends AbstractBillPlugIn implements Plugin
this.getView().close(); this.getView().close();
} }
} }
} }