Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
1311835083
|
|
@ -4,6 +4,7 @@ import kd.bos.algo.DataSet;
|
|||
import kd.bos.algo.Row;
|
||||
import kd.bos.context.RequestContext;
|
||||
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;
|
||||
|
|
@ -113,6 +114,7 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
|
|||
int visitTime = 0;
|
||||
//探亲年限
|
||||
int visitYear = 0;
|
||||
//探亲天数
|
||||
|
||||
//探父母假天数
|
||||
int visitDays =dynamicObject.getInt("visitDays");
|
||||
|
|
@ -148,6 +150,7 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
|
|||
if("2".equals(visitType)){
|
||||
visitTime = marriedSpouseTime;
|
||||
visitYear = marriedSpouseYear;
|
||||
|
||||
}
|
||||
}else if (marriedStatus == 2) { // 未婚
|
||||
if(!"1".equals(visitType)){//报销探亲类型
|
||||
|
|
@ -207,10 +210,16 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
|
|||
|
||||
//已用剩余次数
|
||||
int remainderTimes = visitTime-holidayCount;
|
||||
//已用剩余天数
|
||||
int remainderDays =visitDays-allHolidayCount;
|
||||
//计算提交单据的剩余次数
|
||||
|
||||
//已用剩余天数
|
||||
int remainderDays = 0;
|
||||
if("1".equals(visitType)){ //探望父母
|
||||
remainderDays = visitDays-allHolidayCount;
|
||||
}else {//探望配偶
|
||||
remainderDays = marriedSpouseDays-allHolidayCount;
|
||||
}
|
||||
|
||||
//计算提交单据的剩余次数
|
||||
int tims = remainderTimes - 1;
|
||||
//计算提交单据的剩余天数
|
||||
int dayCount = remainderDays - days;
|
||||
|
|
|
|||
|
|
@ -185,83 +185,83 @@ public class CustomInvoiceDataHandleHelper extends InvoiceDataHandleHelper {
|
|||
|
||||
DynamicObject seller = StringUtils.equals(dt.getName(), "ec_in_invoice") ? BusinessDataServiceHelper.loadSingle("bd_supplier", "", new QFilter[]{sellerFilter}) : BusinessDataServiceHelper.loadSingle("bos_org", "", new QFilter[]{sellerFilter});
|
||||
if (seller == null) {
|
||||
throw new KDBizException(String.format(ResManager.loadKDString("发票【%1$s】:销售方【%2$s】不存在。", "InvoiceDataHandleHelper_6", "ec-ecbd-common", new Object[0]), invoiceVO.getInvoiceCode(), sellerName));
|
||||
//throw new KDBizException(String.format(ResManager.loadKDString("发票【%1$s】:销售方【%2$s】不存在。", "InvoiceDataHandleHelper_6", "ec-ecbd-common", new Object[0]), invoiceVO.getInvoiceCode(), sellerName));
|
||||
} else {
|
||||
invoice.set("seller", seller);
|
||||
invoice.set("invoicestatus", invoiceVO.getInvoiceStatus());
|
||||
invoice.set("billstatus", BillStatusEnum.AUDIT.getValue());
|
||||
invoice.set("org_id", orgID);
|
||||
List<InvoiceItemVO> detailEntries = invoiceVO.getItems();
|
||||
if (detailEntries != null && !detailEntries.isEmpty()) {
|
||||
DynamicObjectCollection invoiceEntries = invoice.getDynamicObjectCollection("entryentity");
|
||||
DynamicObjectType entryDt = (new DynamicObject(dt)).getDynamicObjectCollection("entryentity").getDynamicObjectType();
|
||||
|
||||
for(InvoiceItemVO item : detailEntries) {
|
||||
DynamicObject entry = new DynamicObject(entryDt);
|
||||
entry.set("name", item.getGoodsName());
|
||||
entry.set("model", item.getSpecModel());
|
||||
String unitName = item.getUnit();
|
||||
if (unitName != null && !unitName.isEmpty()) {
|
||||
QFilter unitFilter = (new QFilter("name", "=", unitName)).or("number", "=", unitName).or("number", "=", unitName.toLowerCase()).or("number", "=", unitName.toUpperCase());
|
||||
QFilter validFilter = (new QFilter("enable", "=", DefaultEnum.YES.getValue().charAt(0))).and("status", "=", BillStatusEnum.AUDIT.getValue().charAt(0));
|
||||
DynamicObject unit = BusinessDataServiceHelper.loadSingle("bd_measureunits", "name", new QFilter[]{unitFilter, validFilter});
|
||||
if (unit != null) {
|
||||
entry.set("unit", unit);
|
||||
}
|
||||
}
|
||||
|
||||
entry.set("qty", item.getNum());
|
||||
BigDecimal price = item.getUnitPrice();
|
||||
entry.set("price", item.getUnitPrice());
|
||||
entry.set("amount", item.getDetailAmount());
|
||||
BigDecimal ofTaxPrice = price;
|
||||
BigDecimal tax = item.getTaxRate();
|
||||
if (tax != null) {
|
||||
BigDecimal taxRateHundred = tax.multiply(BigDecimal.TEN.multiply(BigDecimal.TEN));
|
||||
QFilter taxFilter = new QFilter("taxrate", "=", taxRateHundred);
|
||||
DynamicObject[] taxRate = BusinessDataServiceHelper.load("bd_taxrate", "name", new QFilter[]{taxFilter});
|
||||
if (taxRate != null && taxRate.length > 0) {
|
||||
entry.set("taxrate", taxRate[0]);
|
||||
}
|
||||
|
||||
if (price != null) {
|
||||
ofTaxPrice = price.multiply(BigDecimal.ONE.add(tax));
|
||||
}
|
||||
}
|
||||
|
||||
entry.set("oftaxprice", ofTaxPrice);
|
||||
entry.set("tax", item.getTaxAmount());
|
||||
entry.set("oftaxamount", item.getDetailAmount().add(item.getTaxAmount() == null ? BigDecimal.ZERO : item.getTaxAmount()));
|
||||
invoiceEntries.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
String snapshotUrl = invoiceVO.getSnapshotUrl();
|
||||
if (!StringUtils.isBlank(snapshotUrl)) {
|
||||
DynamicObjectCollection pictureEntries = invoice.getDynamicObjectCollection("pictureentry");
|
||||
DynamicObjectType pictureEntryDt = (new DynamicObject(dt)).getDynamicObjectCollection("pictureentry").getDynamicObjectType();
|
||||
DynamicObject item = new DynamicObject(pictureEntryDt);
|
||||
item.set("filename", invoiceVO.getInvoiceNo());
|
||||
item.set("imageurl", snapshotUrl);
|
||||
item.set("uploaddate", date);
|
||||
pictureEntries.add(item);
|
||||
}
|
||||
|
||||
invoice.set("creator_id", userID);
|
||||
invoice.set("modifier_id", userID);
|
||||
invoice.set("auditor_id", userID);
|
||||
invoice.set("createtime", date);
|
||||
invoice.set("modifytime", date);
|
||||
invoice.set("auditdate", date);
|
||||
CodeRuleInfo codeRuleInfo = CodeRuleServiceHelper.getCodeRule(dt.getName(), invoice, String.valueOf(RequestContext.get().getOrgId()));
|
||||
if (null != codeRuleInfo) {
|
||||
invoice.set("billno", CodeRuleServiceHelper.getNumber(codeRuleInfo, invoice));
|
||||
} else {
|
||||
invoice.set("billno", invoiceVO.getSerialNo());
|
||||
}
|
||||
|
||||
return invoice;
|
||||
}
|
||||
invoice.set("invoicestatus", invoiceVO.getInvoiceStatus());
|
||||
invoice.set("billstatus", BillStatusEnum.AUDIT.getValue());
|
||||
invoice.set("org_id", orgID);
|
||||
List<InvoiceItemVO> detailEntries = invoiceVO.getItems();
|
||||
if (detailEntries != null && !detailEntries.isEmpty()) {
|
||||
DynamicObjectCollection invoiceEntries = invoice.getDynamicObjectCollection("entryentity");
|
||||
DynamicObjectType entryDt = (new DynamicObject(dt)).getDynamicObjectCollection("entryentity").getDynamicObjectType();
|
||||
|
||||
for(InvoiceItemVO item : detailEntries) {
|
||||
DynamicObject entry = new DynamicObject(entryDt);
|
||||
entry.set("name", item.getGoodsName());
|
||||
entry.set("model", item.getSpecModel());
|
||||
String unitName = item.getUnit();
|
||||
if (unitName != null && !unitName.isEmpty()) {
|
||||
QFilter unitFilter = (new QFilter("name", "=", unitName)).or("number", "=", unitName).or("number", "=", unitName.toLowerCase()).or("number", "=", unitName.toUpperCase());
|
||||
QFilter validFilter = (new QFilter("enable", "=", DefaultEnum.YES.getValue().charAt(0))).and("status", "=", BillStatusEnum.AUDIT.getValue().charAt(0));
|
||||
DynamicObject unit = BusinessDataServiceHelper.loadSingle("bd_measureunits", "name", new QFilter[]{unitFilter, validFilter});
|
||||
if (unit != null) {
|
||||
entry.set("unit", unit);
|
||||
}
|
||||
}
|
||||
|
||||
entry.set("qty", item.getNum());
|
||||
BigDecimal price = item.getUnitPrice();
|
||||
entry.set("price", item.getUnitPrice());
|
||||
entry.set("amount", item.getDetailAmount());
|
||||
BigDecimal ofTaxPrice = price;
|
||||
BigDecimal tax = item.getTaxRate();
|
||||
if (tax != null) {
|
||||
BigDecimal taxRateHundred = tax.multiply(BigDecimal.TEN.multiply(BigDecimal.TEN));
|
||||
QFilter taxFilter = new QFilter("taxrate", "=", taxRateHundred);
|
||||
DynamicObject[] taxRate = BusinessDataServiceHelper.load("bd_taxrate", "name", new QFilter[]{taxFilter});
|
||||
if (taxRate != null && taxRate.length > 0) {
|
||||
entry.set("taxrate", taxRate[0]);
|
||||
}
|
||||
|
||||
if (price != null) {
|
||||
ofTaxPrice = price.multiply(BigDecimal.ONE.add(tax));
|
||||
}
|
||||
}
|
||||
|
||||
entry.set("oftaxprice", ofTaxPrice);
|
||||
entry.set("tax", item.getTaxAmount());
|
||||
entry.set("oftaxamount", item.getDetailAmount().add(item.getTaxAmount() == null ? BigDecimal.ZERO : item.getTaxAmount()));
|
||||
invoiceEntries.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
String snapshotUrl = invoiceVO.getSnapshotUrl();
|
||||
if (!StringUtils.isBlank(snapshotUrl)) {
|
||||
DynamicObjectCollection pictureEntries = invoice.getDynamicObjectCollection("pictureentry");
|
||||
DynamicObjectType pictureEntryDt = (new DynamicObject(dt)).getDynamicObjectCollection("pictureentry").getDynamicObjectType();
|
||||
DynamicObject item = new DynamicObject(pictureEntryDt);
|
||||
item.set("filename", invoiceVO.getInvoiceNo());
|
||||
item.set("imageurl", snapshotUrl);
|
||||
item.set("uploaddate", date);
|
||||
pictureEntries.add(item);
|
||||
}
|
||||
|
||||
invoice.set("creator_id", userID);
|
||||
invoice.set("modifier_id", userID);
|
||||
invoice.set("auditor_id", userID);
|
||||
invoice.set("createtime", date);
|
||||
invoice.set("modifytime", date);
|
||||
invoice.set("auditdate", date);
|
||||
CodeRuleInfo codeRuleInfo = CodeRuleServiceHelper.getCodeRule(dt.getName(), invoice, String.valueOf(RequestContext.get().getOrgId()));
|
||||
if (null != codeRuleInfo) {
|
||||
invoice.set("billno", CodeRuleServiceHelper.getNumber(codeRuleInfo, invoice));
|
||||
} else {
|
||||
invoice.set("billno", invoiceVO.getSerialNo());
|
||||
}
|
||||
|
||||
return invoice;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import kd.bos.util.StringUtils;
|
|||
import kd.fi.bcm.business.model.BalanceQueryParamApi;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import zcgj.zcdev.zcdev.pr.plugin.utils.AccountRecord;
|
||||
import zcgj.zcdev.zcdev.pr.plugin.utils.CashflowRecord;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -42,6 +43,7 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
|
|||
BillShowParameter bsp=(BillShowParameter)this.getView().getFormShowParameter();
|
||||
if(bsp.getStatus()== OperationStatus.ADDNEW ){
|
||||
fundplyentry();
|
||||
getCashflow();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -88,6 +90,9 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
|
|||
}
|
||||
}
|
||||
|
||||
getCashflow();
|
||||
}else if("zcgj_org".equals(name)){
|
||||
getCashflow();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -519,6 +524,68 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
|
|||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 取现金流量项目
|
||||
*/
|
||||
public void getCashflow(){
|
||||
|
||||
DynamicObject period = (DynamicObject)this.getModel().getValue("zcgj_period");
|
||||
DynamicObject org = (DynamicObject)this.getModel().getValue("zcgj_org");
|
||||
if(period != null && org != null){
|
||||
String periodnumber = period.getString("number");
|
||||
String orgnumber = org.getString("number");
|
||||
String par = "{" +
|
||||
"\"selectors\":[" +
|
||||
"\"org\"," +
|
||||
"\"yearamount\"," +
|
||||
"\"amount\"" +
|
||||
"]," +
|
||||
"\"orgNumber\":\""+orgnumber+"\"," +
|
||||
"\"bookTypeNumber\":\"100002\"," +
|
||||
"\"periodNumber\":\""+periodnumber+"\"," +
|
||||
"\"cfitemNumbers\":[" +
|
||||
"\"01020402\"" + //往来款
|
||||
"]," +
|
||||
"\"groupBys\":[" +
|
||||
"\"org\"" +
|
||||
"]" +
|
||||
"}";
|
||||
|
||||
log.info("FundingplanapplyAccountBalancePlugin:获取现金流量项目-par"+par);
|
||||
Gson gson = new Gson();
|
||||
Map<String, Object> params1 = gson.fromJson(par,
|
||||
new TypeToken<Map<String, Object>>() {
|
||||
}.getType());
|
||||
OpenApiResult balanceData = OpenApiSdkUtil.invoke("/v2/gl/getCashflowApi", params1);
|
||||
log.info("FundingplanapplyAccountBalancePlugin:获取现金流量项目-"+balanceData.getMessage());
|
||||
if (balanceData.isStatus()) {
|
||||
String data = (String) balanceData.getData();
|
||||
Type listType = new TypeToken<List<CashflowRecord>>() {
|
||||
}.getType();
|
||||
List<CashflowRecord> records = gson.fromJson(data, listType);
|
||||
|
||||
BigDecimal totalyearamount = BigDecimal.ZERO;//本年累计
|
||||
BigDecimal totalamount = BigDecimal.ZERO;//本期发生
|
||||
for (CashflowRecord record : records) {
|
||||
totalyearamount = totalyearamount.add(record.getYearamount());//期初本位币金额
|
||||
totalamount = totalamount.add(record.getAmount());//期末本位币金额
|
||||
}
|
||||
DynamicObjectCollection fundplyentry = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_fundplyentry");
|
||||
DynamicObject dynamicObject = fundplyentry.get(6);
|
||||
dynamicObject.set("zcgj_cashamt",totalyearamount);//本年累计拨款-现金
|
||||
this.getView().updateView("zcgj_fundplyentry");
|
||||
|
||||
}else{
|
||||
DynamicObjectCollection fundplyentry = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_fundplyentry");
|
||||
DynamicObject dynamicObject = fundplyentry.get(6);
|
||||
dynamicObject.set("zcgj_cashamt",BigDecimal.ZERO);//本年累计拨款-现金
|
||||
this.getView().updateView("zcgj_fundplyentry");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//公司资金往来
|
||||
public void fundplyentry(){
|
||||
fundplyentryXJ();//现金
|
||||
|
|
@ -704,4 +771,6 @@ public class FundingplanapplyAccountBalancePlugin extends AbstractBillPlugIn imp
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,84 +108,85 @@ public class InvoiceNameRecognitionBillPlugin extends InvoiceDataHandleHelper {
|
|||
|
||||
DynamicObject seller = StringUtils.equals(dt.getName(), "ec_in_invoice") ? BusinessDataServiceHelper.loadSingle("bd_supplier", "", new QFilter[]{sellerFilter}) : BusinessDataServiceHelper.loadSingle("bos_org", "", new QFilter[]{sellerFilter});
|
||||
if (seller == null) {
|
||||
throw new KDBizException(String.format(ResManager.loadKDString("发票【%1$s】:销售方【%2$s】不存在。", "InvoiceDataHandleHelper_6", "ec-ecbd-common", new Object[0]), invoiceVO.getInvoiceCode(), sellerName));
|
||||
//throw new KDBizException(String.format(ResManager.loadKDString("发票【%1$s】:销售方【%2$s】不存在。", "InvoiceDataHandleHelper_6", "ec-ecbd-common", new Object[0]), invoiceVO.getInvoiceCode(), sellerName));
|
||||
} else {
|
||||
invoice.set("seller", seller);
|
||||
invoice.set("invoicestatus", invoiceVO.getInvoiceStatus());
|
||||
invoice.set("billstatus", BillStatusEnum.AUDIT.getValue());
|
||||
invoice.set("org_id", orgID);
|
||||
//处理发票明细
|
||||
List<InvoiceItemVO> detailEntries = invoiceVO.getItems();
|
||||
if (detailEntries != null && !detailEntries.isEmpty()) {
|
||||
DynamicObjectCollection invoiceEntries = invoice.getDynamicObjectCollection("entryentity");
|
||||
DynamicObjectType entryDt = (new DynamicObject(dt)).getDynamicObjectCollection("entryentity").getDynamicObjectType();
|
||||
|
||||
for(InvoiceItemVO item : detailEntries) {
|
||||
DynamicObject entry = new DynamicObject(entryDt);
|
||||
entry.set("name", item.getGoodsName());
|
||||
entry.set("model", item.getSpecModel());
|
||||
String unitName = item.getUnit();
|
||||
if (unitName != null && !unitName.isEmpty()) {
|
||||
QFilter unitFilter = (new QFilter("name", "=", unitName)).or("number", "=", unitName).or("number", "=", unitName.toLowerCase()).or("number", "=", unitName.toUpperCase());
|
||||
QFilter validFilter = (new QFilter("enable", "=", DefaultEnum.YES.getValue().charAt(0))).and("status", "=", BillStatusEnum.AUDIT.getValue().charAt(0));
|
||||
DynamicObject unit = BusinessDataServiceHelper.loadSingle("bd_measureunits", "name", new QFilter[]{unitFilter, validFilter});
|
||||
if (unit != null) {
|
||||
entry.set("unit", unit);
|
||||
}
|
||||
}
|
||||
|
||||
entry.set("qty", item.getNum());
|
||||
BigDecimal price = item.getUnitPrice();
|
||||
entry.set("price", item.getUnitPrice());
|
||||
entry.set("amount", item.getDetailAmount());
|
||||
BigDecimal ofTaxPrice = price;
|
||||
BigDecimal tax = item.getTaxRate();
|
||||
if (tax != null) {
|
||||
BigDecimal taxRateHundred = tax.multiply(BigDecimal.TEN.multiply(BigDecimal.TEN));
|
||||
QFilter taxFilter = new QFilter("taxrate", "=", taxRateHundred);
|
||||
DynamicObject[] taxRate = BusinessDataServiceHelper.load("bd_taxrate", "name", new QFilter[]{taxFilter});
|
||||
if (taxRate != null && taxRate.length > 0) {
|
||||
entry.set("taxrate", taxRate[0]);
|
||||
}
|
||||
|
||||
if (price != null) {
|
||||
ofTaxPrice = price.multiply(BigDecimal.ONE.add(tax));
|
||||
}
|
||||
}
|
||||
|
||||
entry.set("oftaxprice", ofTaxPrice);
|
||||
entry.set("tax", item.getTaxAmount());
|
||||
entry.set("oftaxamount", item.getDetailAmount().add(item.getTaxAmount() == null ? BigDecimal.ZERO : item.getTaxAmount()));
|
||||
invoiceEntries.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
String snapshotUrl = invoiceVO.getSnapshotUrl();
|
||||
if (!StringUtils.isBlank(snapshotUrl)) {
|
||||
DynamicObjectCollection pictureEntries = invoice.getDynamicObjectCollection("pictureentry");
|
||||
DynamicObjectType pictureEntryDt = (new DynamicObject(dt)).getDynamicObjectCollection("pictureentry").getDynamicObjectType();
|
||||
DynamicObject item = new DynamicObject(pictureEntryDt);
|
||||
item.set("filename", invoiceVO.getInvoiceNo());
|
||||
item.set("imageurl", snapshotUrl);
|
||||
item.set("uploaddate", date);
|
||||
pictureEntries.add(item);
|
||||
}
|
||||
|
||||
invoice.set("creator_id", userID);
|
||||
invoice.set("modifier_id", userID);
|
||||
invoice.set("auditor_id", userID);
|
||||
invoice.set("createtime", date);
|
||||
invoice.set("modifytime", date);
|
||||
invoice.set("auditdate", date);
|
||||
CodeRuleInfo codeRuleInfo = CodeRuleServiceHelper.getCodeRule(dt.getName(), invoice, String.valueOf(RequestContext.get().getOrgId()));
|
||||
if (null != codeRuleInfo) {
|
||||
invoice.set("billno", CodeRuleServiceHelper.getNumber(codeRuleInfo, invoice));
|
||||
} else {
|
||||
invoice.set("billno", invoiceVO.getSerialNo());
|
||||
}
|
||||
|
||||
return invoice;
|
||||
}
|
||||
|
||||
invoice.set("invoicestatus", invoiceVO.getInvoiceStatus());
|
||||
invoice.set("billstatus", BillStatusEnum.AUDIT.getValue());
|
||||
invoice.set("org_id", orgID);
|
||||
//处理发票明细
|
||||
List<InvoiceItemVO> detailEntries = invoiceVO.getItems();
|
||||
if (detailEntries != null && !detailEntries.isEmpty()) {
|
||||
DynamicObjectCollection invoiceEntries = invoice.getDynamicObjectCollection("entryentity");
|
||||
DynamicObjectType entryDt = (new DynamicObject(dt)).getDynamicObjectCollection("entryentity").getDynamicObjectType();
|
||||
|
||||
for(InvoiceItemVO item : detailEntries) {
|
||||
DynamicObject entry = new DynamicObject(entryDt);
|
||||
entry.set("name", item.getGoodsName());
|
||||
entry.set("model", item.getSpecModel());
|
||||
String unitName = item.getUnit();
|
||||
if (unitName != null && !unitName.isEmpty()) {
|
||||
QFilter unitFilter = (new QFilter("name", "=", unitName)).or("number", "=", unitName).or("number", "=", unitName.toLowerCase()).or("number", "=", unitName.toUpperCase());
|
||||
QFilter validFilter = (new QFilter("enable", "=", DefaultEnum.YES.getValue().charAt(0))).and("status", "=", BillStatusEnum.AUDIT.getValue().charAt(0));
|
||||
DynamicObject unit = BusinessDataServiceHelper.loadSingle("bd_measureunits", "name", new QFilter[]{unitFilter, validFilter});
|
||||
if (unit != null) {
|
||||
entry.set("unit", unit);
|
||||
}
|
||||
}
|
||||
|
||||
entry.set("qty", item.getNum());
|
||||
BigDecimal price = item.getUnitPrice();
|
||||
entry.set("price", item.getUnitPrice());
|
||||
entry.set("amount", item.getDetailAmount());
|
||||
BigDecimal ofTaxPrice = price;
|
||||
BigDecimal tax = item.getTaxRate();
|
||||
if (tax != null) {
|
||||
BigDecimal taxRateHundred = tax.multiply(BigDecimal.TEN.multiply(BigDecimal.TEN));
|
||||
QFilter taxFilter = new QFilter("taxrate", "=", taxRateHundred);
|
||||
DynamicObject[] taxRate = BusinessDataServiceHelper.load("bd_taxrate", "name", new QFilter[]{taxFilter});
|
||||
if (taxRate != null && taxRate.length > 0) {
|
||||
entry.set("taxrate", taxRate[0]);
|
||||
}
|
||||
|
||||
if (price != null) {
|
||||
ofTaxPrice = price.multiply(BigDecimal.ONE.add(tax));
|
||||
}
|
||||
}
|
||||
|
||||
entry.set("oftaxprice", ofTaxPrice);
|
||||
entry.set("tax", item.getTaxAmount());
|
||||
entry.set("oftaxamount", item.getDetailAmount().add(item.getTaxAmount() == null ? BigDecimal.ZERO : item.getTaxAmount()));
|
||||
invoiceEntries.add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
String snapshotUrl = invoiceVO.getSnapshotUrl();
|
||||
if (!StringUtils.isBlank(snapshotUrl)) {
|
||||
DynamicObjectCollection pictureEntries = invoice.getDynamicObjectCollection("pictureentry");
|
||||
DynamicObjectType pictureEntryDt = (new DynamicObject(dt)).getDynamicObjectCollection("pictureentry").getDynamicObjectType();
|
||||
DynamicObject item = new DynamicObject(pictureEntryDt);
|
||||
item.set("filename", invoiceVO.getInvoiceNo());
|
||||
item.set("imageurl", snapshotUrl);
|
||||
item.set("uploaddate", date);
|
||||
pictureEntries.add(item);
|
||||
}
|
||||
|
||||
invoice.set("creator_id", userID);
|
||||
invoice.set("modifier_id", userID);
|
||||
invoice.set("auditor_id", userID);
|
||||
invoice.set("createtime", date);
|
||||
invoice.set("modifytime", date);
|
||||
invoice.set("auditdate", date);
|
||||
CodeRuleInfo codeRuleInfo = CodeRuleServiceHelper.getCodeRule(dt.getName(), invoice, String.valueOf(RequestContext.get().getOrgId()));
|
||||
if (null != codeRuleInfo) {
|
||||
invoice.set("billno", CodeRuleServiceHelper.getNumber(codeRuleInfo, invoice));
|
||||
} else {
|
||||
invoice.set("billno", invoiceVO.getSerialNo());
|
||||
}
|
||||
|
||||
return invoice;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
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.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 入库单提交时校验已冲销金额
|
||||
*/
|
||||
public class MaterialinCheckBoltamountOp extends AbstractOperationServicePlugIn {
|
||||
|
||||
private static final Log log = LogFactory.getLog(MaterialinCheckBoltamountOp.class);
|
||||
|
||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||
e.getFieldKeys().add("zcgj_prepayentry");
|
||||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_sourceapplybillid");
|
||||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_sourceapplyentryid");
|
||||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_boltamount");//本次冲销金额
|
||||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_alreadyboltamount");//已冲销金额
|
||||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_prepayamount");//预付金额
|
||||
e.getFieldKeys().add("zcgj_isprepay");
|
||||
}
|
||||
|
||||
@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 dataEntity = extendedDataEntity.getDataEntity();//入库单
|
||||
String isprepay = dataEntity.getString("zcgj_isprepay");
|
||||
if("10".equals(isprepay)){
|
||||
DynamicObjectCollection prepayentryCollection = dataEntity.getDynamicObjectCollection("zcgj_prepayentry");//冲销预付分录
|
||||
if(prepayentryCollection == null || prepayentryCollection.isEmpty()){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("请录入冲销预付明细数据!"));
|
||||
}else{
|
||||
int seq = 0;
|
||||
for (DynamicObject prepay : prepayentryCollection) {//入库单预付信息分录
|
||||
seq++;
|
||||
long sourceapplybillid = prepay.getLong("zcgj_sourceapplybillid");
|
||||
long sourceapplyentryid = prepay.getLong("zcgj_sourceapplyentryid");
|
||||
BigDecimal boltamount = prepay.getBigDecimal("zcgj_boltamount");//本次冲销金额
|
||||
BigDecimal prepayamount = prepay.getBigDecimal("zcgj_prepayamount");//预付金额
|
||||
DynamicObject paymentapply = BusinessDataServiceHelper.loadSingle(sourceapplybillid, "ec_paymentapply");//工程资金付款申请单
|
||||
if (paymentapply != null) {
|
||||
DynamicObjectCollection entryentityCollection = paymentapply.getDynamicObjectCollection("entryentity");
|
||||
|
||||
for (DynamicObject dynamicObject : entryentityCollection) {
|
||||
long pkValue = (long)dynamicObject.getPkValue();
|
||||
if(pkValue==sourceapplyentryid){
|
||||
BigDecimal yreversalamount = dynamicObject.getBigDecimal("zcgj_yreversalamount");//付款申请单已冲销金额+入库单本次冲销金额
|
||||
yreversalamount = yreversalamount.add(boltamount);
|
||||
if(prepayamount.subtract(yreversalamount).compareTo(BigDecimal.ZERO) < 0){
|
||||
this.addFatalErrorMessage(extendedDataEntity, String.format("冲销预付分录第%d行,累计冲销金额超过预付金额!",seq));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ public class OutFinaceconfirmReversalamountCkOp extends AbstractOperationService
|
|||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_sourceapplyentryid");
|
||||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_boltamount");
|
||||
e.getFieldKeys().add("zcgj_isprepay");
|
||||
e.getFieldKeys().add("zcgj_billsource");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -48,9 +49,8 @@ public class OutFinaceconfirmReversalamountCkOp extends AbstractOperationService
|
|||
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
|
||||
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||
DynamicObject dataEntity = extendedDataEntity.getDataEntity();//支出财务确认单
|
||||
DynamicObjectCollection entryEntityCollection = dataEntity.getDynamicObjectCollection("zcgj_prepayentry");//付款信息分录
|
||||
for (int i = 0; i < entryEntityCollection.size(); i++) {
|
||||
DynamicObject entryEntity = entryEntityCollection.get(i);
|
||||
String billsource = dataEntity.getString("zcgj_billsource");
|
||||
if(!"1".equals(billsource)){ //来源入库单时,不进行校验
|
||||
DynamicObjectCollection prepayentryCollection = dataEntity.getDynamicObjectCollection("zcgj_prepayentry");//冲销预付分录
|
||||
String isprepay = dataEntity.getString("zcgj_isprepay");
|
||||
if("10".equals(isprepay)){
|
||||
|
|
@ -62,7 +62,7 @@ public class OutFinaceconfirmReversalamountCkOp extends AbstractOperationService
|
|||
seq++;
|
||||
long sourceapplybillid = prepay.getLong("zcgj_sourceapplybillid");
|
||||
long sourceapplyentryid = prepay.getLong("zcgj_sourceapplyentryid");
|
||||
BigDecimal boltamount = prepay.getBigDecimal("zcgj_boltamount");//支出财务确认单冲销金额
|
||||
BigDecimal boltamount = prepay.getBigDecimal("zcgj_boltamount");//支出财务确认单本次冲销金额
|
||||
DynamicObject paymentapply = BusinessDataServiceHelper.loadSingle(sourceapplybillid, "ec_paymentapply");//工程资金付款申请单
|
||||
if (paymentapply != null) {
|
||||
DynamicObjectCollection entryentityCollection = paymentapply.getDynamicObjectCollection("entryentity");
|
||||
|
|
@ -83,6 +83,7 @@ public class OutFinaceconfirmReversalamountCkOp extends AbstractOperationService
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ public class OutFinaceconfirmReversalamountOp extends AbstractOperationServicePl
|
|||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_sourceapplybillid");
|
||||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_sourceapplyentryid");
|
||||
e.getFieldKeys().add("zcgj_prepayentry.zcgj_boltamount");
|
||||
e.getFieldKeys().add("zcgj_billsource");
|
||||
|
||||
}
|
||||
@Override
|
||||
|
|
@ -55,91 +56,37 @@ public class OutFinaceconfirmReversalamountOp extends AbstractOperationServicePl
|
|||
List<DynamicObject> updateData = new ArrayList<>();
|
||||
for (DynamicObject dataEntity : dataEntities) {
|
||||
long id = dataEntity.getLong("id");
|
||||
DynamicObjectCollection prepayentryCollection = dataEntity.getDynamicObjectCollection("zcgj_prepayentry");//冲销预付分录
|
||||
for (DynamicObject prepay : prepayentryCollection) {
|
||||
long sourceapplybillid = prepay.getLong("zcgj_sourceapplybillid");
|
||||
long sourceapplyentryid = prepay.getLong("zcgj_sourceapplyentryid");
|
||||
BigDecimal boltamount = prepay.getBigDecimal("zcgj_boltamount");//支出财务确认单冲销金额
|
||||
DynamicObject paymentapply = BusinessDataServiceHelper.loadSingle(sourceapplybillid, "ec_paymentapply");//工程资金付款申请单
|
||||
if (paymentapply != null) {
|
||||
DynamicObjectCollection entryentityCollection = paymentapply.getDynamicObjectCollection("entryentity");
|
||||
for (DynamicObject dynamicObject : entryentityCollection) {
|
||||
BigDecimal thisrealpayamt = dynamicObject.getBigDecimal("thisrealpayamt");//付款申请单本次实付金额
|
||||
long pkValue = (long)dynamicObject.getPkValue();
|
||||
if(pkValue==sourceapplyentryid){
|
||||
BigDecimal zcgjYreversalamount = dynamicObject.getBigDecimal("zcgj_yreversalamount");
|
||||
if(!isSubmit){
|
||||
boltamount = boltamount.multiply(BigDecimal.ZERO.subtract(BigDecimal.ONE));//取相反数
|
||||
String billsource = dataEntity.getString("zcgj_billsource");
|
||||
if("1".equals(billsource)){//来源入库单时,不反写付款申请单
|
||||
DynamicObjectCollection prepayentryCollection = dataEntity.getDynamicObjectCollection("zcgj_prepayentry");//冲销预付分录
|
||||
for (DynamicObject prepay : prepayentryCollection) {
|
||||
long sourceapplybillid = prepay.getLong("zcgj_sourceapplybillid");
|
||||
long sourceapplyentryid = prepay.getLong("zcgj_sourceapplyentryid");
|
||||
BigDecimal boltamount = prepay.getBigDecimal("zcgj_boltamount");//支出财务确认单冲销金额
|
||||
DynamicObject paymentapply = BusinessDataServiceHelper.loadSingle(sourceapplybillid, "ec_paymentapply");//工程资金付款申请单
|
||||
if (paymentapply != null) {
|
||||
DynamicObjectCollection entryentityCollection = paymentapply.getDynamicObjectCollection("entryentity");
|
||||
for (DynamicObject dynamicObject : entryentityCollection) {
|
||||
BigDecimal thisrealpayamt = dynamicObject.getBigDecimal("thisrealpayamt");//付款申请单本次实付金额
|
||||
long pkValue = (long)dynamicObject.getPkValue();
|
||||
if(pkValue==sourceapplyentryid){
|
||||
BigDecimal zcgjYreversalamount = dynamicObject.getBigDecimal("zcgj_yreversalamount");
|
||||
if(!isSubmit){
|
||||
boltamount = boltamount.multiply(BigDecimal.ZERO.subtract(BigDecimal.ONE));//取相反数
|
||||
}
|
||||
zcgjYreversalamount = zcgjYreversalamount.add(boltamount);
|
||||
dynamicObject.set("zcgj_yreversalamount",zcgjYreversalamount);
|
||||
}
|
||||
zcgjYreversalamount = zcgjYreversalamount.add(boltamount);
|
||||
dynamicObject.set("zcgj_yreversalamount",zcgjYreversalamount);
|
||||
}
|
||||
}
|
||||
updateData.add(paymentapply);
|
||||
}
|
||||
updateData.add(paymentapply);
|
||||
}
|
||||
if(!updateData.isEmpty()){
|
||||
try (TXHandle txType = TX.requiresNew("updateAmt")) {
|
||||
SaveServiceHelper.save(updateData.toArray(new DynamicObject[0]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// idList.add(id);
|
||||
/*Map<String, HashSet<Long>> sourceBills = BFTrackerServiceHelper.findSourceBills("cas_paybill", new Long[]{id});
|
||||
HashSet<Long> zcgjEcFundingplanapply = sourceBills.get("zcgj_ec_fundingplanapply");
|
||||
if(zcgjEcFundingplanapply != null && !zcgjEcFundingplanapply.isEmpty()) {
|
||||
Long dataId = (Long)zcgjEcFundingplanapply.toArray()[0];
|
||||
|
||||
//计算实际付款金额
|
||||
DynamicObject paybill = BusinessDataServiceHelper.loadSingle(id, "cas_paybill");
|
||||
DynamicObject settletype = paybill.getDynamicObject("settletype");
|
||||
String typeString = "";
|
||||
|
||||
DynamicObjectCollection entryCpllection = paybill.getDynamicObjectCollection("entry");
|
||||
BigDecimal allActamt = BigDecimal.ZERO;
|
||||
for (DynamicObject entry : entryCpllection) {
|
||||
BigDecimal val = entry.getBigDecimal("e_actamt");
|
||||
BigDecimal eActamt = val !=null ?val:BigDecimal.ZERO;//获取实付金额
|
||||
allActamt = allActamt.add(eActamt);
|
||||
}
|
||||
|
||||
//读取资金计划申请
|
||||
DynamicObject fundingplanapply = BusinessDataServiceHelper.loadSingle(dataId, "zcgj_ec_fundingplanapply");
|
||||
DynamicObjectCollection zcgjFinApprovedAmount = fundingplanapply.getDynamicObjectCollection("zcgj_fin_approved_amount");
|
||||
for (DynamicObject dynamicObject : zcgjFinApprovedAmount) {
|
||||
String zcgjSetttype = dynamicObject.getString("zcgj_setttype");
|
||||
if(typeString.equals(zcgjSetttype)){
|
||||
BigDecimal zcgjAmountpaid = dynamicObject.getBigDecimal("zcgj_amountpaid");
|
||||
BigDecimal zcgjAmountRecommended = zcgjAmountpaid !=null ? zcgjAmountpaid:BigDecimal.ZERO;//实际付款金额
|
||||
BigDecimal amountrecommended = BigDecimal.ZERO;
|
||||
if(!isSubmit){
|
||||
amountrecommended = allActamt;
|
||||
allActamt = allActamt.multiply(BigDecimal.ZERO.subtract(BigDecimal.ONE));//取相反数
|
||||
}
|
||||
allActamt = allActamt.add(zcgjAmountRecommended);
|
||||
dynamicObject.set("zcgj_amountpaid", allActamt);//实付金额
|
||||
dynamicObject.set("zcgj_amount_inpayment",amountrecommended);//
|
||||
|
||||
//zcgj_amount_remaining = zcgj_hdamount - zcgj_amount_inpayment - zcgj_amountpaid
|
||||
//剩余待拨付金额 = 财务核定金额 - 付款处理中金额 - 实付金额
|
||||
BigDecimal hdamount = dynamicObject.getBigDecimal("zcgj_hdamount");
|
||||
if(hdamount !=null && isSubmit){
|
||||
BigDecimal subtract = hdamount.subtract(amountrecommended).subtract(allActamt);
|
||||
dynamicObject.set("zcgj_amount_remaining",subtract);
|
||||
}else if(hdamount != null){
|
||||
BigDecimal subtract = hdamount.add(amountrecommended).subtract(allActamt);//实付金额已经成为相反数
|
||||
dynamicObject.set("zcgj_amount_remaining",subtract);
|
||||
}
|
||||
if(!updateData.isEmpty()){
|
||||
try (TXHandle txType = TX.requiresNew("updateAmt")) {
|
||||
SaveServiceHelper.save(updateData.toArray(new DynamicObject[0]));
|
||||
}
|
||||
}
|
||||
updateData.add(fundingplanapply);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
/*if(!updateData.isEmpty()){
|
||||
try (TXHandle txType = TX.requiresNew("updateAmt")) {
|
||||
SaveServiceHelper.save(updateData.toArray(new DynamicObject[0]));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 现金流量
|
||||
*/
|
||||
public class CashflowRecord {
|
||||
private long org;//核算组织
|
||||
private BigDecimal yearamount;//本年累计
|
||||
private BigDecimal amount;//本期发生
|
||||
|
||||
public long getOrg() {
|
||||
return org;
|
||||
}
|
||||
|
||||
public void setOrg(long org) {
|
||||
this.org = org;
|
||||
}
|
||||
|
||||
public BigDecimal getYearamount() {
|
||||
return yearamount;
|
||||
}
|
||||
|
||||
public void setYearamount(BigDecimal yearamount) {
|
||||
this.yearamount = yearamount;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(BigDecimal amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ public class OutContractSettleFiConfirmWorkFlowPlugin implements IWorkflowPlugin
|
|||
boolean isReversabillid = outContractSettle.getBoolean("zcgj_is_reversabillid");
|
||||
boolean isInvalid = outContractSettle.getBoolean("zcgj_is_invalid");
|
||||
boolean nofinconfirm = outContractSettle.getBoolean("zcgj_nofinconfirm");
|
||||
|
||||
if(!isReversabillid && !isInvalid && !nofinconfirm) {
|
||||
//如果时冲销单据
|
||||
//生成支出财务确认单 start
|
||||
|
|
@ -51,6 +52,10 @@ public class OutContractSettleFiConfirmWorkFlowPlugin implements IWorkflowPlugin
|
|||
outFinaceconfirm.set("zcgj_jscustomer",outContractSettle.getDynamicObject("zcgj_jscustomer"));
|
||||
outFinaceconfirm.set("billstatus","A");
|
||||
outFinaceconfirm.set("creator",outContractSettle.getDynamicObject("creator"));
|
||||
//按入库单结算-判断上游有入库单
|
||||
if(outContractSettle.getBoolean("issettlebymatin")){
|
||||
outFinaceconfirm.set("zcgj_billsource","1");
|
||||
}
|
||||
DynamicObjectCollection itementry = outContractSettle.getDynamicObjectCollection("itementry");
|
||||
|
||||
DynamicObjectCollection entryEntity1 = outFinaceconfirm.getDynamicObjectCollection("zcgj_itementry");
|
||||
|
|
|
|||
Loading…
Reference in New Issue