|
|
|
@ -21,7 +21,7 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
{
|
|
|
|
|
//readonly InvoiceApiFox api;
|
|
|
|
|
static readonly ApiFox api;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static InvoiceIssuanceService()
|
|
|
|
|
{
|
|
|
|
|
api = new ApiFox();
|
|
|
|
@ -34,7 +34,7 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
public InvoiceIssuanceService(IServiceProvider provider) : base(provider)
|
|
|
|
|
{
|
|
|
|
|
var config = provider.GetRequiredService<IConfiguration>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -134,9 +134,9 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
var invoices = ids.Select(x => new Entity.Invoice { Id = x, SN = sn, ApiType = InvoiceApiType.Default }).ToList();
|
|
|
|
|
await TenantDb.Updateable(invoices).UpdateColumns(x => new { x.SN, x.ApiType }).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
UpdateInvoiceNumberAsync(sn);
|
|
|
|
|
await UpdateInvoiceNumberAsync(sn);
|
|
|
|
|
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
return DataResult.Successed("开票已提交", data: sn);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -175,9 +175,9 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
if (queryResult == null || !queryResult.Success)
|
|
|
|
|
return DataResult.Failed(queryResult?.Message);
|
|
|
|
|
|
|
|
|
|
List<Entity.Invoice> invoices = [];
|
|
|
|
|
if (queryResult.Data.Order?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
List<Entity.Invoice> invoices = [];
|
|
|
|
|
foreach (var item in queryResult.Data.Order)
|
|
|
|
|
{
|
|
|
|
|
var inv = new Entity.Invoice
|
|
|
|
@ -218,7 +218,24 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
var result2 = DataResult.Success;
|
|
|
|
|
result2.Data = invoices;
|
|
|
|
|
return result2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新发票号码
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult> UpdateInvoiceNumberAsync(long id)
|
|
|
|
|
{
|
|
|
|
|
var model = await TenantDb.Queryable<Entity.Invoice>().Where(x => x.Id == id)
|
|
|
|
|
.Select(x => new { x.Id, x.SN, x.SaleDeptId, x.ApiType }).FirstAsync();
|
|
|
|
|
if (model == null)
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData));
|
|
|
|
|
|
|
|
|
|
return await UpdateInvoiceNumberAsync(model.SN);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -242,7 +259,7 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
api.DefaultHeaders.Add("USER_KEY", orgauthinfo.Key);
|
|
|
|
|
api.DefaultHeaders.Add("USER_SECRET", orgauthinfo.Secret);
|
|
|
|
|
var result = await api.PostAsync<InvoiceResult<string>>(AppSetting.app(new string[] { "InvoiceApi", "BaseUrl" }) + "/api/Invoice/RedInvoicing", req);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return DataResult.Failed(result.Message, result.MultiCode);
|
|
|
|
|
|
|
|
|
|