diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index b7dc6843..ad605e33 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -683,6 +683,9 @@ public static class MultiLanguageConst [Description("开票信息不完整,请检查每张发票是否添加了费用明细")] public const string InvoiceIncomplete = "Invoice_Incomplete"; + + [Description("请通过用户管理功能设置证件号码后再提交开票")] + public const string DrawerIDNumberIsNull = "Drawer_IDNumber_IsNull"; #endregion #region 预订舱API diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs index 36c030c0..d9bb0c09 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceIssuanceService.cs @@ -1,5 +1,7 @@ using DS.Module.Core; +using DS.WMS.Core.Application.Entity; using DS.WMS.Core.Application.Method; +using DS.WMS.Core.Code.Entity; using DS.WMS.Core.Invoice.Dtos; using DS.WMS.Core.Sys.Entity; using Microsoft.Extensions.Configuration; @@ -37,9 +39,13 @@ namespace DS.WMS.Core.Invoice.Method long userId = long.Parse(User.UserId); var userInfo = await Db.Queryable().Where(x => x.Id == userId).Select(x => new { - x.Id, + x.UserName, + x.IdCardNo }).FirstAsync(); + if (string.IsNullOrEmpty(userInfo.IdCardNo)) + return DataResult.FailedWithDesc(MultiLanguageConst.DrawerIDNumberIsNull); + //请求参数设置 InvoiceIssuanceRequest request = new() { @@ -62,11 +68,12 @@ namespace DS.WMS.Core.Invoice.Method hjse = x.InvoiceAmount * x.TaxRate, hjje = x.InvoiceAmount - x.InvoiceAmount * x.TaxRate, jshj = x.InvoiceAmount, - clerk = x.CreateUserName, //开票人 - kprzjhm = "", //证件号 + clerk = userInfo.UserName, //开票人 + kprzjhm = userInfo.IdCardNo, //证件号 kprzjlx = "201", //身份证, //---------发票明细--------- - invoiceDetail = x.InvoiceDetails.Select(y => new InvoiceDetailInfo + invoiceDetail = SqlFunc.Subqueryable().Where(y => y.ApplicationId == x.Id) + .LeftJoin((y, z) => y.CodeId == z.Id).ToList((y, z) => new InvoiceDetailInfo { mxxh = SqlFunc.RowNumber(y.Id), //x.InvoiceDetails.IndexOf(y) + 1, xmmc = y.Name, @@ -78,9 +85,10 @@ namespace DS.WMS.Core.Invoice.Method taxRate = y.TaxRate.ToString(), tax = y.TaxAmount, taxIncludedAmount = y.TaxUnitPrice, - goodsCode = "", //商品和服务税收分类合并编码 - invoiceLineProperty = "00" - }).ToList() + goodsCode = z.Code, //商品和服务税收分类合并编码 + invoiceLineProperty = "00", + favouredPolicyFlag = z.PreferentialPolicyDescription + }) }).ToListAsync() };