Compare commits
No commits in common. "3eabd65c39f0380ab41689b3d13a09360e4b50bf" and "8d6a60c8905fb8acb80e38e55dd53d744302a816" have entirely different histories.
3eabd65c39
...
8d6a60c890
|
|
@ -1,55 +0,0 @@
|
||||||
package zcgj.zcdev.zcdev.fs.plugin.form;
|
|
||||||
|
|
||||||
import kd.bos.bill.AbstractBillPlugIn;
|
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
|
||||||
import kd.bos.form.field.ComboEdit;
|
|
||||||
import kd.bos.form.field.TextEdit;
|
|
||||||
import kd.bos.orm.query.QCP;
|
|
||||||
import kd.bos.orm.query.QFilter;
|
|
||||||
import kd.bos.servicehelper.QueryServiceHelper;
|
|
||||||
|
|
||||||
import java.util.EventObject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 出差申请单表单插件
|
|
||||||
*/
|
|
||||||
public class TripReqBillPlugin extends AbstractBillPlugIn {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterCopyData(EventObject e) {
|
|
||||||
super.afterCopyData(e);
|
|
||||||
updateModificationTypeVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterBindData(EventObject e) {
|
|
||||||
super.afterBindData(e);
|
|
||||||
updateModificationTypeVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterCreateNewData(EventObject e) {
|
|
||||||
super.afterCreateNewData(e);
|
|
||||||
updateModificationTypeVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateModificationTypeVisibility() {
|
|
||||||
Boolean isChange = (Boolean) this.getModel().getValue("ischange");//是否变更
|
|
||||||
|
|
||||||
DynamicObject costCompany = (DynamicObject) this.getModel().getValue("costcompany");//费用承担公司
|
|
||||||
QFilter filter = new QFilter("zcgj_companyblentry.zcgj_org.id", QCP.equals, costCompany.getPkValue());
|
|
||||||
filter.and(new QFilter("number", QCP.equals, "001"));
|
|
||||||
filter.and(new QFilter("zcgj_changetype", QCP.equals, true));
|
|
||||||
DynamicObject companyBelong = QueryServiceHelper.queryOne("zcgj_companybelong", "id", new QFilter[]{filter});//公司归属区域
|
|
||||||
|
|
||||||
if (isChange && companyBelong != null) {
|
|
||||||
this.getView().setVisible(true, "zcgj_modificationtype");//变更类型可见
|
|
||||||
ComboEdit edit = this.getView().getControl("zcgj_modificationtype");
|
|
||||||
edit.setMustInput(true);//变更类型必录
|
|
||||||
} else {
|
|
||||||
this.getView().setVisible(false, "zcgj_modificationtype");//变更类型不可见
|
|
||||||
ComboEdit edit = this.getView().getControl("zcgj_modificationtype");
|
|
||||||
edit.setMustInput(false);//变更类型不必录
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -6,7 +6,6 @@ import kd.bos.bill.OperationStatus;
|
||||||
import kd.bos.context.RequestContext;
|
import kd.bos.context.RequestContext;
|
||||||
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.metadata.dynamicobject.DynamicObjectType;
|
|
||||||
import kd.bos.dataentity.utils.StringUtils;
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
import kd.bos.entity.datamodel.events.ChangeData;
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
|
@ -30,7 +29,9 @@ import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.EventObject;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收入合同确认单插件
|
* 收入合同确认单插件
|
||||||
|
|
@ -93,50 +94,15 @@ public class InContractFinaceConfirmePlugin extends AbstractBillPlugIn implement
|
||||||
item.set("zcgj_remark",dynamicObject.getString("remark"));
|
item.set("zcgj_remark",dynamicObject.getString("remark"));
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicObjectCollection payItemDetailEntryCollection = ecincontractsettle.getDynamicObjectCollection("payitemdetailentry");//合同支付项明细
|
DynamicObjectCollection meteringSummaryCollection1 = ecincontractsettle.getDynamicObjectCollection("zcgj_metering_summary");//计量汇总
|
||||||
DynamicObjectCollection meteringSummaryCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_metering_summary");//计量汇总
|
DynamicObjectCollection meteringSummaryCollection2 = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_metering_summary");//计量汇总
|
||||||
meteringSummaryCollection.clear();
|
meteringSummaryCollection2.clear();
|
||||||
DynamicObjectType meteringSummaryType = meteringSummaryCollection.getDynamicObjectType();
|
for (DynamicObject meteringSummary1 : meteringSummaryCollection1){
|
||||||
|
DynamicObject newMeteringSummary = meteringSummaryCollection2.addNew();
|
||||||
// 创建全局Map按税率分组存储合并数据,用于累计所有payitemdetailentry的数据
|
newMeteringSummary.set("zcgj_rateval",meteringSummary1.getBigDecimal("zcgj_rateval"));
|
||||||
Map<BigDecimal, Map<String, BigDecimal>> globalRateGroupMap = new HashMap<>();
|
newMeteringSummary.set("zcgj_pa_amount",meteringSummary1.getBigDecimal("zcgj_pa_amount"));
|
||||||
|
newMeteringSummary.set("zcgj_amountnotax",meteringSummary1.getBigDecimal("zcgj_amountnotax"));
|
||||||
for (DynamicObject payItemDetailEntry : payItemDetailEntryCollection) {
|
newMeteringSummary.set("zcgj_taxamt1",meteringSummary1.getBigDecimal("zcgj_taxamt"));
|
||||||
String referBillNumber = payItemDetailEntry.getString("referbillnumber");//关联单据
|
|
||||||
QFilter[] qFilters = new QFilter[]{new QFilter("billno", QCP.equals, referBillNumber)};
|
|
||||||
DynamicObject ec_incontractmeasure = BusinessDataServiceHelper.loadSingle("ec_incontractmeasure", qFilters);//收入合同计量
|
|
||||||
if (ec_incontractmeasure != null) {
|
|
||||||
DynamicObjectCollection listModelEntryCollection = ec_incontractmeasure.getDynamicObjectCollection("listmodelentry");//模板分录
|
|
||||||
DynamicObjectCollection listEntryCollection = listModelEntryCollection.get(0).getDynamicObjectCollection("listentry");//清单分录
|
|
||||||
|
|
||||||
// 遍历当前收入合同计量的清单分录
|
|
||||||
for (DynamicObject listEntry : listEntryCollection) {
|
|
||||||
BigDecimal entrytaxrate = listEntry.getBigDecimal("entrytaxrate");// 税率(%)
|
|
||||||
BigDecimal thisamount = listEntry.getBigDecimal("thisamount");// 本期计量金额
|
|
||||||
BigDecimal thistax = listEntry.getBigDecimal("thistax");// 本期税额
|
|
||||||
BigDecimal thisoftaxmount = listEntry.getBigDecimal("thisoftaxmount");// 本期计量含税金额
|
|
||||||
|
|
||||||
// 使用全局Map按税率分组,累加各金额字段
|
|
||||||
Map<String, BigDecimal> sumMap = globalRateGroupMap.computeIfAbsent(entrytaxrate, k -> new HashMap<>());
|
|
||||||
sumMap.merge("thisamount", thisamount, BigDecimal::add);
|
|
||||||
sumMap.merge("thistax", thistax, BigDecimal::add);
|
|
||||||
sumMap.merge("thisoftaxmount", thisoftaxmount, BigDecimal::add);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 循环结束后,使用全局累计数据生成最终的计量汇总行
|
|
||||||
for (Map.Entry<BigDecimal, Map<String, BigDecimal>> entry : globalRateGroupMap.entrySet()) {
|
|
||||||
DynamicObject newEntry = new DynamicObject(meteringSummaryType);
|
|
||||||
BigDecimal rate = entry.getKey();
|
|
||||||
Map<String, BigDecimal> sumMap = entry.getValue();
|
|
||||||
|
|
||||||
// 设置合并后的值到新行
|
|
||||||
newEntry.set("zcgj_rateval", rate); // 税率
|
|
||||||
newEntry.set("zcgj_amountnotax", sumMap.get("thisamount")); // 不含税金额合计
|
|
||||||
newEntry.set("zcgj_taxamt1", sumMap.get("thistax")); // 税额合计
|
|
||||||
newEntry.set("zcgj_pa_amount", sumMap.get("thisoftaxmount")); // 含税金额合计
|
|
||||||
meteringSummaryCollection.add(newEntry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getView().updateView("zcgj_itementry");
|
this.getView().updateView("zcgj_itementry");
|
||||||
|
|
|
||||||
|
|
@ -402,8 +402,8 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setNewExpenseSummary();
|
setNewExpenseSummary();
|
||||||
} else if ("qty".equals(key) || "price".equals(key) || "entrytaxrate".equals(key)) {
|
} else if ("qty".equals(key) || "price".equals(key)) {
|
||||||
//数量、入库单价、税率名称
|
//数量、入库单价
|
||||||
BigDecimal matAmount = (BigDecimal) this.getModel().getValue("matamount");//材料总金额
|
BigDecimal matAmount = (BigDecimal) this.getModel().getValue("matamount");//材料总金额
|
||||||
BigDecimal transAmount = (BigDecimal) this.getModel().getValue("transamount");//总运费
|
BigDecimal transAmount = (BigDecimal) this.getModel().getValue("transamount");//总运费
|
||||||
BigDecimal totalAmount = matAmount.add(transAmount);
|
BigDecimal totalAmount = matAmount.add(transAmount);
|
||||||
|
|
|
||||||
|
|
@ -1,112 +0,0 @@
|
||||||
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
|
||||||
|
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
||||||
import kd.bos.entity.ExtendedDataEntity;
|
|
||||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
|
||||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
|
||||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
|
||||||
import kd.bos.entity.validate.AbstractValidator;
|
|
||||||
import kd.bos.orm.query.QCP;
|
|
||||||
import kd.bos.orm.query.QFilter;
|
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 入库单日期提交操作校验插件
|
|
||||||
* 说明:采购申请审批日期不能晚于开票日期和入库日期(业务日期)
|
|
||||||
*/
|
|
||||||
public class MaterialInBillDateSubValidatorOp extends AbstractOperationServicePlugIn {
|
|
||||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
|
||||||
super.onPreparePropertys(e);
|
|
||||||
e.getFieldKeys().add("matinsource");//入库来源
|
|
||||||
e.getFieldKeys().add("zcgj_ispurchaseapplys");//多采购申请
|
|
||||||
e.getFieldKeys().add("zcgj_purchaseapplyentry");//采购申请分录
|
|
||||||
e.getFieldKeys().add("zcgj_purchaseapply_f7");//采购申请
|
|
||||||
e.getFieldKeys().add("bizdate");//业务日期
|
|
||||||
e.getFieldKeys().add("zcgj_entryentity");//合同进项发票信息
|
|
||||||
e.getFieldKeys().add("zcgj_invoice");//发票号码
|
|
||||||
e.getFieldKeys().add("zcgj_purchaseapply");//采购申请
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
|
||||||
super.onAddValidators(e);
|
|
||||||
e.getValidators().add(new ValidatorExt());
|
|
||||||
}
|
|
||||||
|
|
||||||
class ValidatorExt extends AbstractValidator {
|
|
||||||
@Override
|
|
||||||
public void validate() {
|
|
||||||
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
|
||||||
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
|
||||||
DynamicObject ecma_MaterialInBill = extendedDataEntity.getDataEntity();
|
|
||||||
String matinsource = ecma_MaterialInBill.getString("matinsource");//入库来源
|
|
||||||
if ("6".equals(matinsource)) {
|
|
||||||
//入库来源为采购申请
|
|
||||||
boolean zcgj_ispurchaseapplys = ecma_MaterialInBill.getBoolean("zcgj_ispurchaseapplys");//多采购申请
|
|
||||||
if (zcgj_ispurchaseapplys) {
|
|
||||||
DynamicObjectCollection zcgj_purchaseapplyentryCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_purchaseapplyentry");//采购申请分录
|
|
||||||
if (zcgj_purchaseapplyentryCollection.size() > 0) {
|
|
||||||
for (DynamicObject zcgj_purchaseapplyentry : zcgj_purchaseapplyentryCollection) {
|
|
||||||
DynamicObject zcgj_purchaseapply = zcgj_purchaseapplyentry.getDynamicObject("zcgj_purchaseapply_f7");//采购申请
|
|
||||||
if (zcgj_purchaseapply == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String zcgj_number = zcgj_purchaseapply.getString("zcgj_number");
|
|
||||||
QFilter[] qFilters = new QFilter[]{new QFilter("billno", QCP.equals, zcgj_number)};
|
|
||||||
DynamicObject ecma_purchaseapply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply", "auditdate", qFilters);//采购申请
|
|
||||||
Date auditdate = ecma_purchaseapply.getDate("auditdate");//采购申请-审核时间
|
|
||||||
Date bizdate = ecma_MaterialInBill.getDate("bizdate");//业务日期
|
|
||||||
if (auditdate != null && bizdate != null && auditdate.after(bizdate)) {
|
|
||||||
this.addFatalErrorMessage(extendedDataEntity, "采购申请单:" + zcgj_number + "的审批日期不能晚于业务日期!");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
DynamicObjectCollection zcgj_entryentityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息
|
|
||||||
if (zcgj_entryentityCollection.size() > 0) {
|
|
||||||
for (DynamicObject zcgj_entryentity : zcgj_entryentityCollection) {
|
|
||||||
DynamicObject zcgj_invoice = zcgj_entryentity.getDynamicObject("zcgj_invoice");//发票号码
|
|
||||||
if (zcgj_invoice != null) {
|
|
||||||
Date invoicedate = zcgj_invoice.getDate("invoicedate");//发票号码-开票日期
|
|
||||||
String billno = zcgj_invoice.getString("billno");
|
|
||||||
if (invoicedate != null && auditdate != null && auditdate.after(invoicedate)) {
|
|
||||||
this.addFatalErrorMessage(extendedDataEntity, "采购申请单:" + zcgj_number + "的审批日期不能晚于发票:" + billno + "的开票日期!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
DynamicObject zcgj_purchaseapply = ecma_MaterialInBill.getDynamicObject("zcgj_purchaseapply");//采购申请
|
|
||||||
if (zcgj_purchaseapply == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
QFilter[] qFilters = new QFilter[]{new QFilter("id", QCP.equals, zcgj_purchaseapply.getPkValue())};
|
|
||||||
DynamicObject ecma_purchaseapply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply", "auditdate", qFilters);//采购申请
|
|
||||||
Date auditdate = ecma_purchaseapply.getDate("auditdate");//采购申请-审核时间
|
|
||||||
Date bizdate = ecma_MaterialInBill.getDate("bizdate");//业务日期
|
|
||||||
if (auditdate != null && bizdate != null && auditdate.after(bizdate)) {
|
|
||||||
this.addFatalErrorMessage(extendedDataEntity, "采购申请的审批日期不能晚于业务日期!");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
DynamicObjectCollection zcgj_entryentityCollection = ecma_MaterialInBill.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息
|
|
||||||
if (zcgj_entryentityCollection.size() > 0) {
|
|
||||||
for (DynamicObject zcgj_entryentity : zcgj_entryentityCollection) {
|
|
||||||
DynamicObject zcgj_invoice = zcgj_entryentity.getDynamicObject("zcgj_invoice");//发票号码
|
|
||||||
if (zcgj_invoice != null) {
|
|
||||||
Date invoicedate = zcgj_invoice.getDate("invoicedate");//发票号码-开票日期
|
|
||||||
String billno = zcgj_invoice.getString("billno");
|
|
||||||
if (invoicedate != null && auditdate != null && auditdate.after(invoicedate)) {
|
|
||||||
this.addFatalErrorMessage(extendedDataEntity, "采购申请的审批日期不能晚于发票:" + billno + "的开票日期!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue