Browse Source

QAD页面增加导出明细按钮

master
zhouhongjun 12 months ago
parent
commit
05dcd65261
  1. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/settle/sync.js
  2. 6
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/router/business.js
  3. 69
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/views/finance/sync.js
  4. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/InvoiceSyncQadDto.cs
  5. 27
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/InvoiceSyncQadService.cs
  6. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  7. 80
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SAS_INVOICE.cs

2
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,
},
};
}

6
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"),
],
},
],
},

69
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`<app-list v-if="config" :config="config" @command="onCommand" />`,
components: { AppList, AppCheck },
template: html`<app-list ref="appListRef" :config="config" @command="onCommand" />
<app-check v-if="visable" v-model="visable" :businessType="businessType" :row="row" :data="data" />`,
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 };
},
};

2
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; }
}
}

27
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<InvoiceSyncQad, Guid> _repository;
private readonly IOptions<GlobalConfigOptions> _globalConfigOptions;
/// <summary>
/// 数据中心数据上下文
/// </summary>
private readonly ExChangeCenterDbContext _exChangeCenterDbContext;
public InvoiceSyncQadService(
ILogger<InvoiceSyncQadService> logger,
ExChangeCenterDbContext exChangeCenterDbContext,
INormalEfCoreRepository<InvoiceSyncQad, Guid> repository,
IOptions<GlobalConfigOptions> globalConfigOptions,
IDistributedCache<InvoiceSyncQad> cache,
@ -41,6 +51,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_logger = logger;
_exChangeCenterDbContext = exChangeCenterDbContext;
_repository = repository;
_globalConfigOptions = globalConfigOptions;
}
@ -65,6 +76,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
#endregion
[HttpPost]
public virtual async Task<string> 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<TED_SAS_INVOICE>().Where(p => p.invoiceNumber == condition.Value).ToList();
var dtos = ObjectMapper.Map<List<TED_SAS_INVOICE>, List<TED_SAS_INVOICEExportDto>>(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
/// <summary>
/// 获取列表

2
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<InvoiceSyncQad, InvoiceSyncQadDto>();
CreateMap<InvoiceSyncQad, InvoiceSyncQadExportDto>();
CreateMap<TED_SAS_INVOICE, TED_SAS_INVOICEExportDto>();
}
private void CreateMapInvoiceSettledDiff()

80
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; }
}
/// <summary>
/// 导出
/// </summary>
public class TED_SAS_INVOICEExportDto
{
/// <summary>
/// 金税发票号
/// </summary>
[Display(Name = "金税发票号")]
[ExporterHeader(DisplayName = "金税发票号")]
public string invoiceNumber { get; set; }
/// <summary>
/// 结算发票号
/// </summary>
[Display(Name = "结算发票号")]
[ExporterHeader(DisplayName = "结算发票号")]
public string sasInvoiceNumber { get; set; }
/// <summary>
/// 客户
/// </summary>
[Display(Name = "客户")]
[ExporterHeader(DisplayName = "客户")]
public string Customer { get; set; }
/// <summary>
/// 状态
/// </summary>
[Display(Name = "开票日期")]
[ExporterHeader(DisplayName = "开票日期", Format = "yyyy-MM-dd HH:mm:ss")]
public DateTime InvoiceDate { get; set; }
/// <summary>
/// 厂内零件号
/// </summary>
[Display(Name = "厂内零件号")]
[ExporterHeader(DisplayName = "厂内零件号")]
public string PartNumber { get; set; }
/// <summary>
/// 出库数量
/// </summary>
[Display(Name = "出库数量")]
[ExporterHeader(DisplayName = "出库数量")]
public decimal InvoiceQuatity { get; set; }
/// <summary>
/// 单价
/// </summary>
[Display(Name = "单价")]
[ExporterHeader(DisplayName = "单价")]
public decimal Price { get; set; }
/// <summary>
/// 发票未税金额
/// </summary>
[Display(Name = "发票未税金额")]
[ExporterHeader(DisplayName = "发票未税金额")]
public decimal InvoiceNetAmount { get; set; }
/// <summary>
/// 发票税额
/// </summary>
[Display(Name = "发票税额")]
[ExporterHeader(DisplayName = "发票税额")]
public decimal InvoiceTaxAmount { get; set; }
/// <summary>
/// 税率
/// </summary>
[Display(Name = "税率")]
[ExporterHeader(DisplayName = "税率")]
public decimal TaxRate { get; set; }
}
}

Loading…
Cancel
Save