Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
4c982718eb
|
|
@ -0,0 +1,49 @@
|
|||
package zcgj.zcdev.zcdev.fs.plugin.form;
|
||||
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.form.ShowType;
|
||||
import kd.bos.form.control.EntryGrid;
|
||||
import kd.bos.form.events.HyperLinkClickEvent;
|
||||
import kd.bos.form.events.HyperLinkClickListener;
|
||||
import kd.bos.list.ListShowParameter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EventObject;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* 定额备用金初始台账表单插件
|
||||
*/
|
||||
public class QuotaImprestLedgerBillPlugin extends AbstractBillPlugIn implements HyperLinkClickListener {
|
||||
|
||||
@Override
|
||||
public void registerListener(EventObject e) {
|
||||
super.registerListener(e);
|
||||
EntryGrid entryGrid = this.getView().getControl("zcgj_entryentity");
|
||||
entryGrid.addHyperClickListener(this);
|
||||
}
|
||||
|
||||
public void hyperLinkClick(HyperLinkClickEvent hyperLinkClickEvent) {
|
||||
String fieldName = hyperLinkClickEvent.getFieldName();
|
||||
if (StringUtils.equals(fieldName, "zcgj_usedquota")) {
|
||||
//已使用
|
||||
List<Long> dailyLoanBillDataIds = new ArrayList<>();
|
||||
int rowIndex = hyperLinkClickEvent.getRowIndex();
|
||||
DynamicObjectCollection entryEntityCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_entryentity");//分录
|
||||
DynamicObject entryEntity = entryEntityCollection.get(rowIndex);
|
||||
DynamicObjectCollection zcgj_dailyLoanBillDataIds = entryEntity.getDynamicObjectCollection("zcgj_dailyloanbilldatas");//被引用的借款单数据
|
||||
for (DynamicObject zcgj_dailyLoanBillDataId : zcgj_dailyLoanBillDataIds) {
|
||||
dailyLoanBillDataIds.add((Long) zcgj_dailyLoanBillDataId.getDynamicObject("fbasedataid").getPkValue());
|
||||
}
|
||||
ListShowParameter listShowParameter = new ListShowParameter();
|
||||
listShowParameter.setFormId("bos_list"); //列表界面
|
||||
listShowParameter.setBillFormId("er_dailyloanbill"); //单据的标识
|
||||
listShowParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
|
||||
dailyLoanBillDataIds.forEach(listShowParameter::addLinkQueryPkId);
|
||||
this.getView().showForm(listShowParameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ import java.time.LocalDate;
|
|||
import java.time.ZoneId;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -61,6 +62,7 @@ public class LoanSlipReserveFundReverserOp extends AbstractOperationServicePlugI
|
|||
if (person == null) {
|
||||
continue;
|
||||
}
|
||||
DynamicObjectCollection zcgj_dailyloanbilldatas = entryEntity.getDynamicObjectCollection("zcgj_dailyloanbilldatas");//借款单
|
||||
if (person.getPkValue().equals(applier.getPkValue())) {
|
||||
if (operationKey.equals("submit")) {
|
||||
//提交
|
||||
|
|
@ -69,12 +71,23 @@ public class LoanSlipReserveFundReverserOp extends AbstractOperationServicePlugI
|
|||
BigDecimal zcgj_quota = entryEntity.getBigDecimal("zcgj_quota");//额度
|
||||
BigDecimal zcgj_remainingquota = zcgj_quota.subtract(entryEntity.getBigDecimal("zcgj_usedquota"));//额度-已使用
|
||||
entryEntity.set("zcgj_remainingquota", zcgj_remainingquota);//剩余额度
|
||||
DynamicObject newCurrency = new DynamicObject(zcgj_dailyloanbilldatas.getDynamicObjectType());
|
||||
newCurrency.set("fbasedataId", er_dailyLoanBill);
|
||||
zcgj_dailyloanbilldatas.add(newCurrency);
|
||||
entryEntity.set("zcgj_dailyloanbilldatas", zcgj_dailyloanbilldatas);//借款单
|
||||
} else if (operationKey.equals("unsubmit") || operationKey.equals("unaudit")) {
|
||||
//撤销、反审核
|
||||
BigDecimal zcgj_usedquota = entryEntity.getBigDecimal("zcgj_usedquota").subtract(er_dailyLoanBill.getBigDecimal("loanamount"));//已使用+借款金额
|
||||
entryEntity.set("zcgj_usedquota", zcgj_usedquota);//已使用
|
||||
BigDecimal zcgj_remainingquota = entryEntity.getBigDecimal("zcgj_quota").subtract(entryEntity.getBigDecimal("zcgj_usedquota"));//额度-已使用
|
||||
entryEntity.set("zcgj_remainingquota", zcgj_remainingquota);//剩余额度
|
||||
Iterator<DynamicObject> iterator = zcgj_dailyloanbilldatas.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
DynamicObject dynamicObject = iterator.next();
|
||||
if (er_dailyLoanBill.get("billno").equals(dynamicObject.getDynamicObject("fbasedataid").get("billno"))) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -100,6 +113,7 @@ public class LoanSlipReserveFundReverserOp extends AbstractOperationServicePlugI
|
|||
// DynamicObject person = entryEntity.getDynamicObject("zcgj_person");//人员
|
||||
DynamicObject zcgj_personType = entryEntity.getDynamicObject("zcgj_persontype");//人员类型
|
||||
if (zcgj_personType != null && zcgj_personType.getString("number").equals("项目筹备")) {
|
||||
DynamicObjectCollection zcgj_dailyloanbilldatas = entryEntity.getDynamicObjectCollection("zcgj_dailyloanbilldatas");//借款单
|
||||
if (operationKey.equals("submit")) {
|
||||
//提交
|
||||
BigDecimal zcgj_usedquota = entryEntity.getBigDecimal("zcgj_usedquota").add(loanAmount);//已使用+借款金额
|
||||
|
|
@ -107,12 +121,23 @@ public class LoanSlipReserveFundReverserOp extends AbstractOperationServicePlugI
|
|||
BigDecimal zcgj_quota = entryEntity.getBigDecimal("zcgj_quota");//额度
|
||||
BigDecimal zcgj_remainingquota = zcgj_quota.subtract(entryEntity.getBigDecimal("zcgj_usedquota"));//额度-已使用
|
||||
entryEntity.set("zcgj_remainingquota", zcgj_remainingquota);//剩余额度
|
||||
DynamicObject newCurrency = new DynamicObject(zcgj_dailyloanbilldatas.getDynamicObjectType());
|
||||
newCurrency.set("fbasedataId", er_dailyLoanBill);
|
||||
zcgj_dailyloanbilldatas.add(newCurrency);
|
||||
entryEntity.set("zcgj_dailyloanbilldatas", zcgj_dailyloanbilldatas);//借款单
|
||||
} else if (operationKey.equals("unsubmit") || operationKey.equals("unaudit")) {
|
||||
//撤销、反审核
|
||||
BigDecimal zcgj_usedquota = entryEntity.getBigDecimal("zcgj_usedquota").subtract(er_dailyLoanBill.getBigDecimal("loanamount"));//已使用+借款金额
|
||||
entryEntity.set("zcgj_usedquota", zcgj_usedquota);//已使用
|
||||
BigDecimal zcgj_remainingquota = entryEntity.getBigDecimal("zcgj_quota").subtract(entryEntity.getBigDecimal("zcgj_usedquota"));//额度-已使用
|
||||
entryEntity.set("zcgj_remainingquota", zcgj_remainingquota);//剩余额度
|
||||
Iterator<DynamicObject> iterator = zcgj_dailyloanbilldatas.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
DynamicObject dynamicObject = iterator.next();
|
||||
if (er_dailyLoanBill.get("billno").equals(dynamicObject.getDynamicObject("fbasedataid").get("billno"))) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,6 +121,10 @@ public class PaymentapplyGeneralPlugin extends AbstractBillPlugIn implements Plu
|
|||
this.getModel().setValue("zcgj_isshowcgsq",isshowcgsq);
|
||||
this.getView().updateView("zcgj_isshowcgsq");
|
||||
}
|
||||
} else if (name.equals("zcgj_supplier")) {
|
||||
//供应商
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
this.getModel().setValue("bankaccount", null, rowIndex);//收款账号
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,216 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EventObject;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.data.ParameterHelper;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.resource.ResManager;
|
||||
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||
import kd.bos.entity.list.option.ListUserOption;
|
||||
import kd.bos.entity.plugin.Plugin;
|
||||
import kd.bos.form.CloseCallBack;
|
||||
import kd.bos.form.FormConfig;
|
||||
import kd.bos.form.FormMetadataCache;
|
||||
import kd.bos.form.ShowFormHelper;
|
||||
import kd.bos.form.control.Control;
|
||||
import kd.bos.form.events.ClosedCallBackEvent;
|
||||
import kd.bos.form.field.TextEdit;
|
||||
import kd.bos.list.ListFilterParameter;
|
||||
import kd.bos.list.ListShowParameter;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
||||
/*
|
||||
* 付款申请单(项目资金)供应商银行信息字段点击系统插件二开
|
||||
*/
|
||||
public class SupplierBankInfoClickBillPluginExt extends AbstractBillPlugIn {
|
||||
public SupplierBankInfoClickBillPluginExt() {
|
||||
}
|
||||
|
||||
public void registerListener(EventObject e) {
|
||||
super.registerListener(e);
|
||||
TextEdit payeebanknum = (TextEdit) this.getView().getControl("bankaccount");
|
||||
payeebanknum.addButtonClickListener(this);
|
||||
}
|
||||
|
||||
public void click(EventObject evt) {
|
||||
super.click(evt);
|
||||
Control c = (Control) evt.getSource();
|
||||
switch (c.getKey().toLowerCase()) {
|
||||
case "bankaccount":
|
||||
this.showBankInfoF7();
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
|
||||
super.closedCallBack(closedCallBackEvent);
|
||||
String actionId = closedCallBackEvent.getActionId();
|
||||
if ("payeeaccountbank".equals(actionId)) {
|
||||
Object returnData = closedCallBackEvent.getReturnData();
|
||||
if (returnData != null) {
|
||||
int row = this.getModel().getEntryCurrentRowIndex("entryentity");
|
||||
ListSelectedRowCollection rowInfo = (ListSelectedRowCollection) returnData;
|
||||
Object entryKey = rowInfo.getEntryPrimaryKeyValues()[0];
|
||||
DynamicObject bankRowObject = this.loadBankInfo((Long) entryKey);
|
||||
this.getPageCache().put("bankaccountcache-" + row, bankRowObject.getString("bankaccount"));
|
||||
this.getModel().setValue("bankname", bankRowObject.getDynamicObject("bank").getString("name"), row);
|
||||
this.getModel().setValue("bankaccount", bankRowObject.getString("bankaccount"), row);
|
||||
this.getModel().setValue("bebank", bankRowObject.getDynamicObject("bank").getPkValue(), row);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void showBankInfoF7() {
|
||||
int row = this.getModel().getEntryCurrentRowIndex("entryentity");
|
||||
DynamicObject contract = (DynamicObject) this.getModel().getValue("contract", row);
|
||||
DynamicObject partner = null;
|
||||
//二开添加↓
|
||||
partner = (DynamicObject) this.getModel().getValue("zcgj_supplier", row);//供应商
|
||||
if (partner == null) {
|
||||
if (this.isSupplier()) {
|
||||
partner = contract.getDynamicObject("partb");//合同乙方
|
||||
} else {
|
||||
partner = contract.getDynamicObject("parta");//合同甲方
|
||||
}
|
||||
}
|
||||
//二开添加↑
|
||||
/* if (this.isSupplier()) {
|
||||
partner = contract.getDynamicObject("partb");
|
||||
} else {
|
||||
partner = contract.getDynamicObject("parta");
|
||||
}*///源码
|
||||
|
||||
boolean hasDefaultBankInfo = this.hasDefaultBankInfo(partner);
|
||||
if (!hasDefaultBankInfo) {
|
||||
if (this.isSupplier()) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("请维护对应供应商的银行信息。", "SupplierBankInfoClickBillPlugin_0", "ec-contract-formplugin", new Object[0]));
|
||||
} else {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("请维护对应客户的银行信息。", "SupplierBankInfoClickBillPlugin_1", "ec-contract-formplugin", new Object[0]));
|
||||
}
|
||||
|
||||
} else {
|
||||
ListShowParameter lsp = null;
|
||||
lsp = this.getSupplierBankInfoShowParameter(partner.getPkValue());
|
||||
CloseCallBack closeCallBack = new CloseCallBack(this, "payeeaccountbank");
|
||||
lsp.setCloseCallBack(closeCallBack);
|
||||
this.getView().showForm(lsp);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasDefaultBankInfo(DynamicObject supplier) {
|
||||
if (supplier == null) {
|
||||
return false;
|
||||
} else {
|
||||
String entity = supplier.getDataEntityType().getName();
|
||||
supplier = BusinessDataServiceHelper.loadSingleFromCache(supplier.getPkValue(), entity);
|
||||
DynamicObjectCollection bankColls = supplier.getDynamicObjectCollection("entry_bank");
|
||||
DynamicObject defaultBankAccountInfo = null;
|
||||
|
||||
for (int i = 0; i < bankColls.size(); ++i) {
|
||||
if (i == 0 || ((DynamicObject) bankColls.get(i)).getBoolean("isdefault_bank")) {
|
||||
defaultBankAccountInfo = (DynamicObject) bankColls.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (defaultBankAccountInfo != null) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ListShowParameter createDynamicListShowParameter(String entity, String entry, List<String> showFields) {
|
||||
ListShowParameter lsp = ShowFormHelper.createShowListForm(entity, false, 2);
|
||||
lsp.setCustomParam("entity", entity);
|
||||
lsp.setCustomParam("entry", entry);
|
||||
lsp.setCustomParam("isEntryMain", true);
|
||||
lsp.setCustomParam("showFields", showFields);
|
||||
this.clearPlugins(lsp);
|
||||
this.registerScript("kingdee.ec.cont.mainpage.ecdynamiclistscriptplugin", lsp);
|
||||
this.setMergeRow(false, lsp);
|
||||
lsp.setAppId("cont");
|
||||
return lsp;
|
||||
}
|
||||
|
||||
private void registerScript(String script, ListShowParameter lsp) {
|
||||
List<Plugin> plugins = this.getOrCreateFormConfig(lsp).getPlugins();
|
||||
Plugin p = new Plugin();
|
||||
p.setClassName(script);
|
||||
p.setType(1);
|
||||
plugins.add(p);
|
||||
}
|
||||
|
||||
private void clearPlugins(ListShowParameter lsp) {
|
||||
List<Plugin> plugins = this.getOrCreateFormConfig(lsp).getPlugins();
|
||||
plugins.clear();
|
||||
}
|
||||
|
||||
private void setMergeRow(boolean mergeRow, ListShowParameter lsp) {
|
||||
Map<String, Object> listUserOptions = ParameterHelper.getListOptions(Long.parseLong(RequestContext.get().getUserId()), lsp.getBillFormId(), this.getOrCreateFormConfig(lsp).getListUserOption(), (String) null);
|
||||
ListUserOption listUserOption = new ListUserOption(listUserOptions);
|
||||
listUserOption.setMergeRow(mergeRow);
|
||||
lsp.setListUserOption(listUserOption);
|
||||
}
|
||||
|
||||
private FormConfig getOrCreateFormConfig(ListShowParameter lsp) {
|
||||
FormConfig formConfig = lsp.getFormConfig();
|
||||
if (formConfig == null) {
|
||||
formConfig = FormMetadataCache.getFormConfig(lsp.getFormId());
|
||||
lsp.setFormConfig(formConfig);
|
||||
}
|
||||
|
||||
return formConfig;
|
||||
}
|
||||
|
||||
private ListShowParameter getSupplierBankInfoShowParameter(Object pk) {
|
||||
List<String> showFields = new ArrayList();
|
||||
showFields.add("bank.name");
|
||||
showFields.add("bankaccount");
|
||||
showFields.add("accountname");
|
||||
showFields.add("currency.name");
|
||||
showFields.add("isdefault_bank");
|
||||
ListShowParameter lsp = this.createDynamicListShowParameter(this.isSupplier() ? "bd_supplier" : "bd_customer", "entry_bank", showFields);
|
||||
ListFilterParameter lfp = new ListFilterParameter();
|
||||
lfp.setFilter(new QFilter("id", "=", pk));
|
||||
lsp.setListFilterParameter(lfp);
|
||||
lsp.setCaption(this.isSupplier() ? ResManager.loadKDString("供应商-银行信息", "SupplierBankInfoClickBillPlugin_2", "ec-contract-formplugin", new Object[0]) : ResManager.loadKDString("客户-银行信息", "SupplierBankInfoClickBillPlugin_3", "ec-contract-formplugin", new Object[0]));
|
||||
return lsp;
|
||||
}
|
||||
|
||||
public DynamicObject loadBankInfo(Long entryPk) {
|
||||
DynamicObject customerOrSupplier = BusinessDataServiceHelper.loadSingle(this.isSupplier() ? "bd_supplier" : "bd_customer", "bankaccount,accountname,bank,currency,isdefault_bank", new QFilter[]{new QFilter("entry_bank.id", "=", entryPk)});
|
||||
if (customerOrSupplier != null) {
|
||||
DynamicObjectCollection entryBanks = customerOrSupplier.getDynamicObjectCollection("entry_bank");
|
||||
Iterator var4 = entryBanks.iterator();
|
||||
|
||||
while (var4.hasNext()) {
|
||||
DynamicObject row = (DynamicObject) var4.next();
|
||||
if (row.getPkValue().equals(entryPk)) {
|
||||
return row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isSupplier() {
|
||||
String formId = this.getView().getEntityId();
|
||||
return !"ec_incomeapply".equals(formId);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue