收入合同优化报错;定额备用金初始优化提交校验提示内容;定额备用金添加定时任务刷已使用和剩余额度金额值。
This commit is contained in:
parent
f98c7ac70a
commit
9b3f0e875c
|
|
@ -18,6 +18,7 @@ import kd.bos.list.ListShowParameter;
|
|||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -147,7 +148,10 @@ public class QuotaImprestLedgerBillPlugin extends AbstractBillPlugIn implements
|
|||
//年度
|
||||
DynamicObjectCollection entryEntityCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_entryentity");
|
||||
if (entryEntityCollection.size() > 0) {
|
||||
this.getView().showConfirm(ResManager.loadKDString("更换年份后分录信息将会被清空!是否继续", "AimCostBoqEditPlugin_36", "ec-ecco-formplugin", new Object[0]), MessageBoxOptions.OKCancel, new ConfirmCallBackListener("zcgj_currentyear", this));
|
||||
ChangeData[] changeSet = e.getChangeSet();
|
||||
String oldValue = (String) changeSet[0].getOldValue();
|
||||
this.getView().getPageCache().put("originalPrice", oldValue);
|
||||
this.getView().showConfirm(ResManager.loadKDString("更换年份后分录信息将会被清空!是否继续", "AimCostBoqEditPlugin_36", "ec-ecco-formplugin", new Object[0]), MessageBoxOptions.YesNo, new ConfirmCallBackListener("zcgj_currentyear", this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -160,6 +164,11 @@ public class QuotaImprestLedgerBillPlugin extends AbstractBillPlugIn implements
|
|||
if (MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) {
|
||||
this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_entryentity").clear();
|
||||
this.getView().updateView("zcgj_entryentity");
|
||||
} else {
|
||||
this.getModel().beginInit();
|
||||
this.getModel().setValue("zcgj_currentyear", this.getView().getPageCache().get("originalPrice"));//年度-恢复原值
|
||||
this.getModel().endInit();
|
||||
this.getView().updateView("zcgj_currentyear");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ public class QuotaImprestLedgerSaveOp extends AbstractOperationServicePlugIn {
|
|||
for (ExtendedDataEntity dataEnt : dataEntities) {
|
||||
DynamicObject QuotaImprestLedger = dataEnt.getDataEntity();
|
||||
String zcgj_currentyear = QuotaImprestLedger.getString("zcgj_currentyear");//年度
|
||||
DynamicObject zcgj_company = QuotaImprestLedger.getDynamicObject("zcgj_company");//所属组织
|
||||
String companyName = zcgj_company.getString("name");
|
||||
DynamicObjectCollection entryEntityCollection = QuotaImprestLedger.getDynamicObjectCollection("zcgj_entryentity");//分录
|
||||
// 添加一个Set来记录已经处理过的人员
|
||||
Set<String> processedPersons = new HashSet<>();
|
||||
|
|
@ -64,7 +66,7 @@ public class QuotaImprestLedgerSaveOp extends AbstractOperationServicePlugIn {
|
|||
filter.and(new QFilter("id", QCP.not_in, QuotaImprestLedger.getPkValue()));
|
||||
DynamicObjectCollection zcgj_quotaimprestledgers = QueryServiceHelper.query("zcgj_quotaimprestledger", "id", new QFilter[]{filter});//定额备用金初始台账
|
||||
if (zcgj_quotaimprestledgers.size() > 0) {
|
||||
this.addFatalErrorMessage(dataEnt, "您现在保存的台账中人员【" + personName + "】已在其他台账中存在" + "!!");
|
||||
this.addFatalErrorMessage(dataEnt, "您现在保存的台账中人员【" + personName + "】已在公司为【" + companyName + "】的台账中存在" + "!!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package zcgj.zcdev.zcdev.fs.plugin.task;
|
||||
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.exception.KDException;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.schedule.executor.AbstractTask;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 定额备用金初始台账已使用金额和剩余额度赋值定时任务
|
||||
*/
|
||||
public class QuotaImprestInitializeTaskPlugin extends AbstractTask {
|
||||
@Override
|
||||
public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
|
||||
|
||||
QFilter qFilter1 = new QFilter("zcgj_currentyear", QCP.not_equals, null);
|
||||
DynamicObject[] zcgj_quotaimprestledgers = BusinessDataServiceHelper.load("zcgj_quotaimprestledger",
|
||||
"id,zcgj_currentyear,zcgj_entryentity.zcgj_person,zcgj_entryentity.zcgj_quota,zcgj_entryentity.zcgj_usedquota," +
|
||||
"zcgj_entryentity.zcgj_remainingquota,zcgj_entryentity.zcgj_dailyloanbilldatas", new QFilter[]{qFilter1});//定额备用金初始台账
|
||||
if (zcgj_quotaimprestledgers != null && zcgj_quotaimprestledgers.length > 0) {
|
||||
for (DynamicObject zcgj_quotaimprestledger : zcgj_quotaimprestledgers) {
|
||||
DynamicObjectCollection entryEntityCollection = zcgj_quotaimprestledger.getDynamicObjectCollection("zcgj_entryentity");//分录
|
||||
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||
DynamicObjectCollection zcgj_dailyloanbilldatas = entryEntity.getDynamicObjectCollection("zcgj_dailyloanbilldatas");//被引用的借款单数据
|
||||
BigDecimal totalRemainingAmount = BigDecimal.ZERO;//初始化已使用金额
|
||||
for (DynamicObject zcgj_dailyloanbilldata : zcgj_dailyloanbilldatas) {
|
||||
Object zcgj_dailyLoanBillDataId = zcgj_dailyloanbilldata.getDynamicObject("fbasedataid").getPkValue();//借款单id
|
||||
QFilter[] qFilters = new QFilter[]{new QFilter("id", QCP.equals, zcgj_dailyLoanBillDataId)};
|
||||
DynamicObject er_dailyloanbill = BusinessDataServiceHelper.loadSingle("er_dailyloanbill", "id,loanamount,returnedamount,usedamount", qFilters);//借款单
|
||||
if (er_dailyloanbill == null) {
|
||||
continue;
|
||||
}
|
||||
BigDecimal loanAmount = er_dailyloanbill.getBigDecimal("loanamount");//借款金额
|
||||
BigDecimal returnedAmount = er_dailyloanbill.getBigDecimal("returnedamount");//还款金额
|
||||
BigDecimal usedamount = er_dailyloanbill.getBigDecimal("usedamount");//已报销金额
|
||||
BigDecimal remainingAmount = loanAmount.subtract(returnedAmount.add(usedamount));
|
||||
if (remainingAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
totalRemainingAmount = totalRemainingAmount.add(remainingAmount);
|
||||
}
|
||||
}
|
||||
entryEntity.set("zcgj_usedquota", totalRemainingAmount);//已使用金额
|
||||
entryEntity.set("zcgj_remainingquota", entryEntity.getBigDecimal("zcgj_quota").subtract(totalRemainingAmount));//剩余额度
|
||||
}
|
||||
}
|
||||
}
|
||||
if (zcgj_quotaimprestledgers != null) {
|
||||
SaveServiceHelper.save(zcgj_quotaimprestledgers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,6 +32,9 @@ public class EcContractRevisionFromPlugin extends AbstractBillPlugIn implements
|
|||
ChangeData changeData = e.getChangeSet()[0];
|
||||
DynamicObject contract = ((DynamicObject)this.getModel().getValue("contract"));
|
||||
DynamicObject taxrateInfo = contract.getDynamicObject("taxrate");
|
||||
if (taxrateInfo == null) {
|
||||
return;
|
||||
}
|
||||
QFilter filter = new QFilter("id", "=", taxrateInfo.getPkValue());
|
||||
DynamicObject taxtRateObj = BusinessDataServiceHelper.loadSingle("bd_taxrate", "id,taxrate", new QFilter[]{filter});
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ public class MaterialInbFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
|||
}
|
||||
DynamicObject fiaccountorg = (DynamicObject) this.getModel().getValue("fiaccountorg");//财务记账组织
|
||||
if (fiaccountorg == null) {
|
||||
this.getView().showErrorNotification("清先填写财务记账组织!");
|
||||
this.getView().showErrorNotification("请先填写财务记账组织!");
|
||||
return;
|
||||
}
|
||||
long orgId = fiaccountorg.getLong("id");//财务记账组织
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class OutContractFinaceConfirmeInvoicePlugin extends AbstractBillPlugIn i
|
|||
long currencyId = ((DynamicObject)this.getModel().getValue("zcgj_currency")).getLong("id");
|
||||
DynamicObject zcgj_invoice_org = (DynamicObject) this.getModel().getValue("zcgj_invoice_org");
|
||||
if (zcgj_invoice_org == null){
|
||||
this.getView().showErrorNotification("清先填写发票企业名称!");
|
||||
this.getView().showErrorNotification("请先填写发票企业名称!");
|
||||
return;
|
||||
}
|
||||
long orgId = zcgj_invoice_org.getLong("id");
|
||||
|
|
|
|||
Loading…
Reference in New Issue