|
|
|
@ -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<SysUser>().Where(x => x.Id == userId).Select(x => new
|
|
|
|
|
{
|
|
|
|
|
x.Id,
|
|
|
|
|
x.UserName,
|
|
|
|
|
x.IdCardNo
|
|
|
|
|
}).FirstAsync();
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(userInfo.IdCardNo))
|
|
|
|
|
return DataResult<string>.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<InvoiceDetail>().Where(y => y.ApplicationId == x.Id)
|
|
|
|
|
.LeftJoin<CodeInvoice>((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()
|
|
|
|
|
};
|
|
|
|
|