|
|
@ -18,12 +18,12 @@ namespace DS.WMS.Core.QuarztJobs.Method
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
public class InInvoiceService : IInInvoiceJobService
|
|
|
|
public class InInvoiceService : IInInvoiceJobService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
ISqlSugarClient? db;
|
|
|
|
ISqlSugarClient? db;
|
|
|
|
public InInvoiceService(IServiceProvider serviceProvider)
|
|
|
|
public InInvoiceService(IServiceProvider serviceProvider)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
db = serviceProvider.GetRequiredService<ISqlSugarClient>();
|
|
|
|
db = serviceProvider.GetRequiredService<ISqlSugarClient>();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -32,14 +32,14 @@ namespace DS.WMS.Core.QuarztJobs.Method
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public async Task GetInInvoiceData()
|
|
|
|
public async Task GetInInvoiceData()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
//获取组织机构请求授权列表
|
|
|
|
//获取组织机构请求授权列表
|
|
|
|
if (db==null)
|
|
|
|
if (db == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var orgauthlist= db.Queryable<SysOrgAuth>().ClearFilter().Where(t => t.Deleted == false&&t.Type== "InInvoice").ToList();
|
|
|
|
var orgauthlist = db.Queryable<SysOrgAuth>().ClearFilter().Where(t => t.Deleted == false && t.Type == "InInvoice").ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -57,15 +57,15 @@ namespace DS.WMS.Core.QuarztJobs.Method
|
|
|
|
InInvoicePost model = new InInvoicePost();
|
|
|
|
InInvoicePost model = new InInvoicePost();
|
|
|
|
model.kprqks = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss"); //往前查24小时的进项发票数据
|
|
|
|
model.kprqks = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss"); //往前查24小时的进项发票数据
|
|
|
|
model.kprqjs = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
model.kprqjs = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
|
|
var result = await HttpHellp.PostAsync("http://47.105.115.105:26650/api/XSD/GetInInvoiceDataList", JsonConvert.SerializeObject(model), header);
|
|
|
|
var result = await HttpHellp.PostAsync("http://47.105.115.105:26650/api/XSD/GetInInvoiceDataList", JsonConvert.SerializeObject(model), header);
|
|
|
|
|
|
|
|
|
|
|
|
//处理返回结果
|
|
|
|
//处理返回结果
|
|
|
|
var info= JsonConvert.DeserializeObject<InInvoicePostOutput>(result);
|
|
|
|
var info = JsonConvert.DeserializeObject<InInvoicePostOutput>(result);
|
|
|
|
if (!info.success)
|
|
|
|
if (info == null || !info.success)
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (info!=null&&info.Data.data!=null)
|
|
|
|
if (info != null && info.Data.data != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var dbLink = await db.Queryable<Module.SqlSugar.SysTenantLink>().ClearFilter().Where(t => t.TenantId == item.TenantId).FirstAsync();
|
|
|
|
var dbLink = await db.Queryable<Module.SqlSugar.SysTenantLink>().ClearFilter().Where(t => t.TenantId == item.TenantId).FirstAsync();
|
|
|
|
SqlSugarClient? tenantDb = null;
|
|
|
|
SqlSugarClient? tenantDb = null;
|
|
|
@ -83,9 +83,9 @@ namespace DS.WMS.Core.QuarztJobs.Method
|
|
|
|
var ininviceinfo = await tenantDb.Queryable<InInvoice>().Where(x => x.InvoiceNumber == itemdata.fphm).FirstAsync();
|
|
|
|
var ininviceinfo = await tenantDb.Queryable<InInvoice>().Where(x => x.InvoiceNumber == itemdata.fphm).FirstAsync();
|
|
|
|
|
|
|
|
|
|
|
|
//数据库中发票数据为空,获取发票详情数据
|
|
|
|
//数据库中发票数据为空,获取发票详情数据
|
|
|
|
if (ininviceinfo==null)
|
|
|
|
if (ininviceinfo == null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
GetInInvoiceDataInfo gidi = new GetInInvoiceDataInfo();
|
|
|
|
GetInInvoiceDataInfo gidi = new GetInInvoiceDataInfo();
|
|
|
|
gidi.fphm = itemdata.fphm;
|
|
|
|
gidi.fphm = itemdata.fphm;
|
|
|
|
var resultinfo = await HttpHellp.PostAsync("http://47.105.115.105:26650/api/XSD/GetInInvoiceDataInfo", JsonConvert.SerializeObject(gidi), header);
|
|
|
|
var resultinfo = await HttpHellp.PostAsync("http://47.105.115.105:26650/api/XSD/GetInInvoiceDataInfo", JsonConvert.SerializeObject(gidi), header);
|
|
|
|
var Iinfo = JsonConvert.DeserializeObject<InInvoiceDataInfoOutput>(resultinfo);
|
|
|
|
var Iinfo = JsonConvert.DeserializeObject<InInvoiceDataInfoOutput>(resultinfo);
|
|
|
@ -155,12 +155,12 @@ namespace DS.WMS.Core.QuarztJobs.Method
|
|
|
|
inInvoice.OrgId = item.OrgId;
|
|
|
|
inInvoice.OrgId = item.OrgId;
|
|
|
|
inInvoice.CreateTime = DateTime.Now;
|
|
|
|
inInvoice.CreateTime = DateTime.Now;
|
|
|
|
var datainv = await tenantDb.Insertable(inInvoice).ExecuteReturnEntityAsync();
|
|
|
|
var datainv = await tenantDb.Insertable(inInvoice).ExecuteReturnEntityAsync();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var dtl in Iinfo.data.List)
|
|
|
|
foreach (var dtl in Iinfo.data.List)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//添加发票详情数据
|
|
|
|
//添加发票详情数据
|
|
|
|
InInvoiceDetail inInvoicedtl = new InInvoiceDetail();
|
|
|
|
InInvoiceDetail inInvoicedtl = new InInvoiceDetail();
|
|
|
|
inInvoicedtl.Id= SnowFlakeSingle.Instance.NextId();
|
|
|
|
inInvoicedtl.Id = SnowFlakeSingle.Instance.NextId();
|
|
|
|
inInvoicedtl.PId = datainv.Id;
|
|
|
|
inInvoicedtl.PId = datainv.Id;
|
|
|
|
inInvoicedtl.DetailId = dtl.mxid;
|
|
|
|
inInvoicedtl.DetailId = dtl.mxid;
|
|
|
|
inInvoicedtl.InvoiceCode = dtl.fpdm;
|
|
|
|
inInvoicedtl.InvoiceCode = dtl.fpdm;
|
|
|
@ -187,7 +187,7 @@ namespace DS.WMS.Core.QuarztJobs.Method
|
|
|
|
await tenantDb.Insertable(inInvoicedtl).ExecuteCommandAsync();
|
|
|
|
await tenantDb.Insertable(inInvoicedtl).ExecuteCommandAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -199,9 +199,9 @@ namespace DS.WMS.Core.QuarztJobs.Method
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#region 同步发票到钉钉审批
|
|
|
|
#region 同步发票到钉钉审批
|
|
|
|
var dingconfig = db.Queryable<SysOrgAuth>().Where(t => t.Type == "DingConfig" &&t.OrgId==item.OrgId).First();
|
|
|
|
var dingconfig = db.Queryable<SysOrgAuth>().Where(t => t.Type == "DingConfig" && t.OrgId == item.OrgId).First();
|
|
|
|
|
|
|
|
|
|
|
|
if (dingconfig!=null)
|
|
|
|
if (dingconfig != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//获取钉钉密钥
|
|
|
|
//获取钉钉密钥
|
|
|
|
var token = DingDing.GetDingToken(dingconfig.Key, dingconfig.Secret);
|
|
|
|
var token = DingDing.GetDingToken(dingconfig.Key, dingconfig.Secret);
|
|
|
@ -229,8 +229,8 @@ namespace DS.WMS.Core.QuarztJobs.Method
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|