关联预付款单的供应商默认带出来后不允许修改

--s
This commit is contained in:
weiyunlong 2025-06-05 11:51:27 +08:00
parent 4cb177f253
commit 853e1b6143
1 changed files with 39 additions and 15 deletions

View File

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.utils.StringUtils; import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.FormShowParameter; import kd.bos.form.FormShowParameter;
import kd.bos.form.control.Button; import kd.bos.form.control.Button;
import kd.bos.form.control.Control; import kd.bos.form.control.Control;
@ -83,13 +84,21 @@ public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
//将日期减去一年 //将日期减去一年
cal.add(Calendar.YEAR, -1); cal.add(Calendar.YEAR, -1);
this.getModel().setValue("shjh_startdate",cal.getTime()); this.getModel().setValue("shjh_startdate", cal.getTime());
this.getView().updateView("shjh_startdate"); this.getView().updateView("shjh_startdate");
String paymenttype = (String) this.getView().getParentView().getModel().getValue("paymenttype"); String paymenttype = (String) this.getView().getParentView().getModel().getValue("paymenttype");
if ("bd_supplier".equals(paymenttype)) { if ("bd_supplier".equals(paymenttype)) {
this.getModel().setValue("shjh_supplier",this.getView().getParentView().getModel().getValue("recbasepayer")); this.getModel().setValue("shjh_supplier", this.getView().getParentView().getModel().getValue("recbasepayer"));
this.getView().updateView("shjh_supplier"); this.getView().updateView("shjh_supplier");
} }
DynamicObject supplier = (DynamicObject) this.getView().getModel().getValue("shjh_supplier");
DynamicObject recbasepayer = (DynamicObject) this.getView().getParentView().getModel().getValue("recbasepayer");
if (null != supplier && null != recbasepayer) {
this.getView().setEnable(false, "shjh_supplier");
} else {
this.getView().setEnable(true, "shjh_supplier");
}
} }
/** /**
@ -137,6 +146,19 @@ public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
} }
} }
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
DynamicObject supplier = (DynamicObject) this.getView().getModel().getValue("shjh_supplier");
DynamicObject recbasepayer = (DynamicObject) this.getView().getParentView().getModel().getValue("recbasepayer");
if (null != supplier && null != recbasepayer) {
this.getView().setEnable(false, "shjh_supplier");
} else {
this.getView().setEnable(true, "shjh_supplier");
}
}
/** /**
* 点击查询按钮 * 点击查询按钮
* *
@ -180,11 +202,11 @@ public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
return; return;
} }
String supplierCode = supplier.getString("number"); String supplierCode = supplier.getString("number");
HashMap<String, Object> data = this.getData(companyCode,startDate,endDate); HashMap<String, Object> data = this.getData(companyCode, startDate, endDate);
// 添加额外的参数 // 添加额外的参数
data.put("SupplierCode", supplierCode); data.put("SupplierCode", supplierCode);
data.put("IsWriteOffDetail", true); data.put("IsWriteOffDetail", true);
String response = ApiUtils.sendPost(INTERFACE_ID1,RECEIVER_ID,data); String response = ApiUtils.sendPost(INTERFACE_ID1, RECEIVER_ID, data);
if (response != null) { if (response != null) {
Boolean result = parseResponse(response, billNumber, data, "预付款单清单查询接口"); Boolean result = parseResponse(response, billNumber, data, "预付款单清单查询接口");
if (result) { if (result) {
@ -207,7 +229,7 @@ public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
*/ */
private void handleLoanApi(String companyCode, Date startDate, Date endDate, String billNumber) { private void handleLoanApi(String companyCode, Date startDate, Date endDate, String billNumber) {
try { try {
HashMap<String, Object> data = this.getData(companyCode,startDate,endDate); HashMap<String, Object> data = this.getData(companyCode, startDate, endDate);
String response = ApiUtils.sendPost(INTERFACE_ID2, RECEIVER_ID, data); String response = ApiUtils.sendPost(INTERFACE_ID2, RECEIVER_ID, data);
if (response != null) { if (response != null) {
Boolean result = parseResponse(response, billNumber, data, "借款单清单查询接口"); Boolean result = parseResponse(response, billNumber, data, "借款单清单查询接口");
@ -410,6 +432,7 @@ public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
/** /**
* 获取当前操作用户工号 * 获取当前操作用户工号
*
* @return * @return
*/ */
public String getUserCode() { public String getUserCode() {
@ -438,21 +461,22 @@ public class FeeControlApiPlugin extends AbstractFormPlugin implements Plugin {
/** /**
* 组装参数 * 组装参数
*
* @param companyCode 公司代码 * @param companyCode 公司代码
* @param startDate 开始日期 * @param startDate 开始日期
* @param endDate 结束日期 * @param endDate 结束日期
* @return * @return
*/ */
private HashMap<String,Object> getData(String companyCode, Date startDate, Date endDate){ private HashMap<String, Object> getData(String companyCode, Date startDate, Date endDate) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
HashMap<String,Object> data = new HashMap<>(10); HashMap<String, Object> data = new HashMap<>(10);
// data.put("UserCode","GH017994");//测试用默认余老师账号 // data.put("UserCode","GH017994");//测试用默认余老师账号
data.put("UserCode",this.getUserCode()); data.put("UserCode", this.getUserCode());
data.put("QueryBeginDate",sdf.format(startDate)); data.put("QueryBeginDate", sdf.format(startDate));
data.put("QueryEndDate",sdf.format(endDate)); data.put("QueryEndDate", sdf.format(endDate));
data.put("page","1"); data.put("page", "1");
data.put("rows","5000"); data.put("rows", "5000");
data.put("CompanyCode",companyCode); data.put("CompanyCode", companyCode);
return data; return data;
} }