工程发票取消供应商存在性校验
This commit is contained in:
parent
af912e0444
commit
e2a8a7f155
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue