From 05dcd65261f960631b9515765ffbd1caa34cd7f8 Mon Sep 17 00:00:00 2001
From: zhouhongjun <565221961@qq.com>
Date: Mon, 4 Dec 2023 13:05:08 +0800
Subject: [PATCH] =?UTF-8?q?QAD=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=98=8E=E7=BB=86=E6=8C=89=E9=92=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../wwwroot/models/settle/sync.js | 2 +
.../wwwroot/router/business.js | 6 +-
.../wwwroot/views/finance/sync.js | 69 ++++++++++++++--
.../Entities/BQ/Dtos/InvoiceSyncQadDto.cs | 2 +
.../Entities/BQ/InvoiceSyncQadService.cs | 29 ++++++-
...ttleAccountApplicationAutoMapperProfile.cs | 2 +
.../Entities/BQ/TED_SAS_INVOICE.cs | 80 +++++++++++++++++++
7 files changed, 181 insertions(+), 9 deletions(-)
diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/sync.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/sync.js
index d08be8ed..cddc44d0 100644
--- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/sync.js
+++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/sync.js
@@ -54,6 +54,7 @@ export default function () {
const queryUrl = `settleaccount/${service}/get-list`;
const exportMethod = "POST";
const exportUrl = `settleaccount/${service}/export`;
+ const exportGroupUrl = `settleaccount/${service}/export-detail`;
return {
query: {
@@ -127,6 +128,7 @@ export default function () {
schema,
exportMethod,
exportUrl,
+ exportGroupUrl,
},
};
}
diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js
index d81e7747..86c4c0ee 100644
--- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js
+++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js
@@ -390,7 +390,11 @@ export default [
{
...createPage("sync", `title=Qad发票同步状态查询`),
component: "/finance/sync",
- children: [createButton("query", "title=查询&isTop=true"), createButton("export", "title=导出&isTop=true&pattern=paged")],
+ children: [
+ createButton("query", "title=查询&isTop=true"),
+ createButton("export", "title=导出&isTop=true&pattern=paged"),
+ createButton("export-group", "title=导出明细&pattern=paged"),
+ ],
},
],
},
diff --git a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/finance/sync.js b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/finance/sync.js
index 1596546d..48898ad1 100644
--- a/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/finance/sync.js
+++ b/code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/finance/sync.js
@@ -1,18 +1,73 @@
+
import AppList from "../../components/list/index.js";
import html from "html";
+import { useRoute } from "vue-router";
+import { ref } from "vue";
+import request, { getUrl } from "../../request/index.js";
import useConfig from "../../models/settle/sync.js";
+import AppCheck from "../_check.js";
export default {
- components: { AppList },
- template: html``,
+ components: { AppList, AppCheck },
+ template: html`
+ `,
setup() {
- const config = useConfig();
+ const appListRef = ref(null);
+ const visable = ref(false);
+ const row = ref(null);
+ const data = ref(null);
+ const route = useRoute();
+ const businessType = route.meta.businessType;
+ const config = useConfig(businessType, "cai-wu");
const onCommand = async (item, rows) => {
+ if (item.path === "approval" || item.path === "reject" || item.path === "receive" || item.path === "sync") {
+ if (rows.length > 0) {
+ let message = null;
+ let url = null;
+ let data = rows.map((o) => o.invbillNum);
+ if (item.path === "approval") {
+ message = `确认审核通过选中的${rows.length}行数据吗?`;
+ url = config.edit.approvalUrl;
+ } else if (item.path === "reject") {
+ message = `确认退回选中的${rows.length}行数据吗?`;
+ data = rows[0]["invGroupNum"];
+ url = config.edit.rejectUrl;
+ } else if (item.path === "receive") {
+ message = `确认选中的${rows.length}行数据客户已收票吗?`;
+ url = config.edit.receivedUrl;
+ } else if (item.path === "sync") {
+ message = `确认选中的${rows.length}行数据同步到QAD吗?`;
+ url = "settleaccount/invoice_service/submit-to-qad";
+ }
+ await appListRef.value.onClick(async () => await request(url, data, { method: "POST" }), message, true);
+ }
+ } else if (item.path === "export-group") {
+ const url = config.edit.exportGroupUrl;
+ const method = config.edit.exportMethod;
+ const postData = {
+ filters: [
+ {
+ logic: "and",
+ column: "invoiceNumber",
+ action: "equal",
+ value: rows[0]["invoiceNumber"],
+ },
+ ],
+ };
+ await appListRef.value.onClick(async () => {
+ const response = await request(url, postData, { method }, true);
+ if (!response.errors) {
+ window.open(getUrl(`settleaccount/getblobfile/download/${response.data}`));
+ }
+ });
+ } else if (item.path === "invbillNum" || item.path === "invGroupNum") {
+ row.value = rows[0];
+ data.value = { [item.path]: rows[0][item.path] };
+ visable.value = true;
+ }
console.log(item.path, item, rows);
};
- return {
- config,
- onCommand,
- };
+ return { appListRef, config, onCommand, visable, row, data, businessType };
},
};
+
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/InvoiceSyncQadDto.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/InvoiceSyncQadDto.cs
index 214df2c8..df50d2ef 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/InvoiceSyncQadDto.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/InvoiceSyncQadDto.cs
@@ -134,4 +134,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[ExporterHeader(DisplayName = "凭证号")]
public string Voucher { get; set; }
}
+
+
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/InvoiceSyncQadService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/InvoiceSyncQadService.cs
index 46bd611c..5a4f1d03 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/InvoiceSyncQadService.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/InvoiceSyncQadService.cs
@@ -1,10 +1,13 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
+using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
+using NPOI.HPSF;
using SettleAccount.Domain.BQ;
using Shouldly;
using Volo.Abp.Application.Dtos;
@@ -13,6 +16,7 @@ using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
+using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.Options;
using Win.Sfs.Shared.RepositoryBase;
@@ -30,8 +34,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly INormalEfCoreRepository _repository;
private readonly IOptions _globalConfigOptions;
+ ///
+ /// 数据中心数据上下文
+ ///
+ private readonly ExChangeCenterDbContext _exChangeCenterDbContext;
+
public InvoiceSyncQadService(
ILogger logger,
+ ExChangeCenterDbContext exChangeCenterDbContext,
INormalEfCoreRepository repository,
IOptions globalConfigOptions,
IDistributedCache cache,
@@ -41,6 +51,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_logger = logger;
+ _exChangeCenterDbContext = exChangeCenterDbContext;
_repository = repository;
_globalConfigOptions = globalConfigOptions;
}
@@ -52,7 +63,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[HttpPost]
public async Task ExportAsync(RequestDto input)
{
- var fileName = $"Qad发票同步状态_{Guid.NewGuid()}.xlsx";
+ var fileName = $"Qad发票同步状态_{Guid.NewGuid()}.xlsx";
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false);
var dtos = ObjectMapper.Map, List>(entities);
@@ -65,6 +76,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
#endregion
+ [HttpPost]
+ public virtual async Task ExportDetailAsync(INVOICE_GRP_REQ_DTO input)
+ {
+
+ string fileName = $"Qad发票明细_{Guid.NewGuid().ToString()}.xlsx";
+ var condition = input.Filters.FirstOrDefault(p => p.Column == "invoiceNumber");
+ var entities_INVOICE = _exChangeCenterDbContext.Set().Where(p => p.invoiceNumber == condition.Value).ToList();
+ var dtos = ObjectMapper.Map, List>(entities_INVOICE);
+ var exportImporter = new ExportImporter();
+ var result = await exportImporter.ExcelExporter(dtos).ConfigureAwait(false);
+ result.ShouldNotBeNull();
+
+ await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false);
+ return fileName;
+ }
+
#region CURD
///
/// 获取列表
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
index 8e7bbbed..44e86d1f 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
@@ -9,6 +9,7 @@ using Win.Sfs.SettleAccount.Boms;
using Win.Sfs.SettleAccount.BTNotConsignReports;
using Win.Sfs.SettleAccount.BTSeqKBDiffReports;
using Win.Sfs.SettleAccount.Entities.Boms;
+using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos.SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@@ -527,6 +528,7 @@ namespace Win.Sfs.SettleAccount
{
CreateMap();
CreateMap();
+ CreateMap();
}
private void CreateMapInvoiceSettledDiff()
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SAS_INVOICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SAS_INVOICE.cs
index 850358c5..133c5c86 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SAS_INVOICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SAS_INVOICE.cs
@@ -1,6 +1,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using Magicodes.ExporterAndImporter.Core;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
@@ -36,4 +37,83 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public Guid GUID { get; set; }
public string Voucher { get; set; }
}
+
+ ///
+ /// 导出
+ ///
+ public class TED_SAS_INVOICEExportDto
+ {
+ ///
+ /// 金税发票号
+ ///
+ [Display(Name = "金税发票号")]
+ [ExporterHeader(DisplayName = "金税发票号")]
+ public string invoiceNumber { get; set; }
+
+ ///
+ /// 结算发票号
+ ///
+ [Display(Name = "结算发票号")]
+ [ExporterHeader(DisplayName = "结算发票号")]
+ public string sasInvoiceNumber { get; set; }
+
+ ///
+ /// 客户
+ ///
+ [Display(Name = "客户")]
+ [ExporterHeader(DisplayName = "客户")]
+ public string Customer { get; set; }
+
+
+ ///
+ /// 状态
+ ///
+ [Display(Name = "开票日期")]
+ [ExporterHeader(DisplayName = "开票日期", Format = "yyyy-MM-dd HH:mm:ss")]
+ public DateTime InvoiceDate { get; set; }
+
+ ///
+ /// 厂内零件号
+ ///
+ [Display(Name = "厂内零件号")]
+ [ExporterHeader(DisplayName = "厂内零件号")]
+ public string PartNumber { get; set; }
+
+ ///
+ /// 出库数量
+ ///
+ [Display(Name = "出库数量")]
+ [ExporterHeader(DisplayName = "出库数量")]
+ public decimal InvoiceQuatity { get; set; }
+
+ ///
+ /// 单价
+ ///
+ [Display(Name = "单价")]
+ [ExporterHeader(DisplayName = "单价")]
+ public decimal Price { get; set; }
+
+ ///
+ /// 发票未税金额
+ ///
+ [Display(Name = "发票未税金额")]
+ [ExporterHeader(DisplayName = "发票未税金额")]
+ public decimal InvoiceNetAmount { get; set; }
+
+ ///
+ /// 发票税额
+ ///
+ [Display(Name = "发票税额")]
+ [ExporterHeader(DisplayName = "发票税额")]
+ public decimal InvoiceTaxAmount { get; set; }
+
+ ///
+ /// 税率
+ ///
+ [Display(Name = "税率")]
+ [ExporterHeader(DisplayName = "税率")]
+ public decimal TaxRate { get; set; }
+
+
+ }
}