Browse Source

更新版本

master
zhaoxinyu 5 months ago
parent
commit
0833bed5c0
  1. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  2. 79
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
  3. 69
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs
  4. 48
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  5. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs
  6. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ReturnCanSettlement.cs

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -1,6 +1,6 @@
{
"App": {
"CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088"
"CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088,http://localhost:44378"
},
"ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13326;Database=BJABP;User ID=sa;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True",

79
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs

@ -25,6 +25,7 @@ using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
@ -73,6 +74,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
IExporter _excel = new ExcelExporter();
var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false);
var dtoDetails = ObjectMapper.Map<List<BBAC_NOT_SA_DETAIL>, List<BBAC_NOT_SA_DETAIL_EXP_DTO>>(entities);
var inner = from d in entities
@ -148,22 +162,65 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
input.Filters.Remove(first);
}
//_detailRepository.DbContext.Set<BBAC_NOT_SA_DETAIL>().Where(p=>p.)
var flag= await _bbacNotMng.IsCompleted().ConfigureAwait(false);
if (flag == false)
var _dbcontext = await _detailRepository.GetDbContextAsync().ConfigureAwait(false);
var pricelist = _dbcontext.Set<PriceList>().Where(p => p.ClientCode == "1040" && p.IsCancel == false).ToList();
var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false);
var query = from d in entities
join p in pricelist
on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == "1040"
select new
{
a =
new BBAC_CAN_SA_DETAIL()
{
ContractDocID = d.ContractDocID,
IsMaiDan = d.IsMaiDan,
Version = d.Version,
KeyCode = d.KeyCode,
Site = "1040",
BusinessType = d.BusinessType,
ErpLoc = d.ErpLoc,
CreationTime = d.CreationTime,
GroupNum = d.GroupNum,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
PN = d.PN,
SettleBillNum = d.SettleBillNum,
Price = p.Price,
SettleDate = d.SettleDate,
RealPartCode = d.RealPartCode,
PartCode = d.PartCode,
Qty = d.Qty
},
b = d
};
var bbac_can_list = query.Select(p => p.a).ToList();
var bbac_not_list = query.Select(p => p.b).ToList();
if (bbac_can_list.Count > 0)
{
throw new UserFriendlyException("任务生成中请等待...", "400");
var flag = await _bbacNotMng.IsCompleted().ConfigureAwait(false);
if (flag == false)
{
throw new UserFriendlyException("任务生成中请等待...", "400");
}
else
{
var filters = JsonSerializer.Serialize(input.Filters);
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "condition", Value = filters });
customConditionList.Add(new CustomCondition() { Name = "businesstype", Value = EnumBusinessType.JisBBAC.ToString() });
var _taskid = await _service.ExportEnqueueAsync($"{EnumBusinessType.JisBBAC.ToString()}生成可结算单任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(MakeCanSettlementService), customConditionList, (rs) =>
{ }).ConfigureAwait(false);
}
return new JsonResult(new { Code = 200, Message = "正在生成" });
}
else
{
var filters = JsonSerializer.Serialize(input.Filters);
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "condition", Value = filters });
customConditionList.Add(new CustomCondition() { Name = "businesstype", Value = EnumBusinessType.JisBBAC.ToString() });
var _taskid = await _service.ExportEnqueueAsync($"{EnumBusinessType.JisBBAC.ToString()}生成可结算单任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(MakeCanSettlementService), customConditionList, (rs) =>
{ }).ConfigureAwait(false);
return new JsonResult(new { Code = 400, Message = "筛选的数据都没有价格!" });
}
return new JsonResult(new { Code = 200, Message = "正在生成" });
}
}

69
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs

@ -24,6 +24,7 @@ using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
@ -141,20 +142,68 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
input.Filters.Remove(first);
}
var flag = await _hbpoNotMng.IsCompleted().ConfigureAwait(false);
if (flag == false)
var _dbcontext = await _detailRepository.GetDbContextAsync().ConfigureAwait(false);
var pricelist = _dbcontext.Set<PriceList>().Where(p => p.ClientCode == "1040" && p.IsCancel == false).ToList();
var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false);
var query = from d in entities
join p in pricelist
on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == "1040"
select new
{
a =
new HBPO_CAN_SA_DETAIL()
{
Version = d.Version,
KeyCode = d.KeyCode,
Site = "1040",
BusinessType = d.BusinessType,
ErpLoc = d.ErpLoc,
CreationTime = d.CreationTime,
GroupNum = d.GroupNum,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
PN = d.PN,
SettleBillNum = d.SettleBillNum,
Price = p.Price,
SettleDate = d.SettleDate,
RealPartCode = d.RealPartCode,
PartCode = d.PartCode,
Qty = d.Qty
},
b = d
};
var bbac_can_list = query.Select(p => p.a).ToList();
var bbac_not_list = query.Select(p => p.b).ToList();
if (bbac_can_list.Count > 0)
{
throw new UserFriendlyException("任务生成中请等待...", "400");
var flag = await _hbpoNotMng.IsCompleted().ConfigureAwait(false);
if (flag == false)
{
throw new UserFriendlyException("任务生成中请等待...", "400");
}
else
{
var filters = JsonSerializer.Serialize(input.Filters);
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "condition", Value = filters });
customConditionList.Add(new CustomCondition() { Name = "businesstype", Value = EnumBusinessType.JisHBPO.ToString() });
var _taskid = await _service.ExportEnqueueAsync($"{EnumBusinessType.JisHBPO.ToString()}生成可结算单任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(MakeCanSettlementService), customConditionList, (rs) =>
{ }).ConfigureAwait(false);
return new JsonResult(new { Code = 200, Message = "正在生成" });
}
}
else
{
var filters = JsonSerializer.Serialize(input.Filters);
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "condition", Value = filters });
customConditionList.Add(new CustomCondition() { Name = "businesstype", Value = EnumBusinessType.JisHBPO.ToString() });
var _taskid = await _service.ExportEnqueueAsync($"{EnumBusinessType.JisHBPO.ToString()}生成可结算单任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(MakeCanSettlementService), customConditionList, (rs) =>
{ }).ConfigureAwait(false);
return new JsonResult(new { Code = 200, Message = "生成成功" });
return new JsonResult(new { Code = 400, Message = "筛选的数据都没有价格!" });
}
}
}

48
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

@ -179,6 +179,54 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
return new OkResult();
}
[HttpPost]
[UnitOfWork(false)]
public virtual async Task<IActionResult> CancelToQad(List<string> invbillNums)
{
_globalConfigOptions.IsSyncInvoiceQadState = true;
var invoiceGrps1 = _settleAccountDbContext.Set<INVOICE_GRP>()
.Where(t => invbillNums.Contains(t.InvbillNum) && t.State == SettleBillState.);
foreach (var itm in invoiceGrps1)
{
itm.State = SettleBillState.;
}
await _settleAccountDbContext.BulkUpdateAsync(invoiceGrps1.ToList()).ConfigureAwait(false);
var invoiceGrps = _settleAccountDbContext.Set<INVOICE_GRP>()
.Where(t => invbillNums.Contains(t.InvbillNum) && t.State == SettleBillState.);
var invoiceBBACGrps = invoiceGrps.Where(p => p.BusinessType == EnumBusinessType.JisBBAC);
var invoicePubGrps = invoiceGrps.Where(p => p.BusinessType != EnumBusinessType.JisBBAC && p.BusinessType != EnumBusinessType.JisHBPO);
var invoiceHbpoGrps = invoiceGrps.Where(p => p.BusinessType == EnumBusinessType.JisHBPO);
if (invoiceBBACGrps.Any())
{
var invlist = await invoiceBBACGrps.ToListAsync().ConfigureAwait(false);
var billinvs = invlist.Select(p => p.InvbillNum).ToList();
//await CreateBBACTaskAsync(billinvs).ConfigureAwait(false);
await CreateBBACHongChongTaskAsync(billinvs).ConfigureAwait(false);
}
if (invoicePubGrps.Any())
{
var invlist = await invoicePubGrps.ToListAsync().ConfigureAwait(false);
var billinvs = invlist.Select(p => p.InvbillNum).ToList();
await CreatePubHongChongTaskAsync(billinvs).ConfigureAwait(false);
}
if (invoiceHbpoGrps.Any())
{
var invlist = await invoiceHbpoGrps.ToListAsync().ConfigureAwait(false);
var billinvs = invlist.Select(p => p.InvbillNum).ToList();
await CreateHBPOHongChongTaskAsync(billinvs).ConfigureAwait(false);
}
return new OkResult();
}
//[UnitOfWork(false)]
/// <summary>
/// 提交到QAD

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs

@ -67,6 +67,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
if (jis1.Count > 0)//1040
{
var pricelist = _dbcontext.Set<PriceList>().Where(p => p.ClientCode == "1040" && p.IsCancel == false).ToList();
var query = from d in jis1
join p in pricelist
on d.LU equals p.LU

15
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ReturnCanSettlement.cs

@ -31,36 +31,35 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
{
var entites = _dbcontext.Set<BBAC_CAN_SA_DETAIL>().Where(p => p.BillNum == billNum).ToList();
var main = _dbcontext.Set<BBAC_CAN_SA>().FirstOrDefault(p => p.BillNum == billNum);
Execute(main, entites);
Execute<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL, BBAC_NOT_SA_DETAIL>(main, entites);
}
if (BussinessType == "JisHBPO")
{
var entites = _dbcontext.Set<HBPO_CAN_SA_DETAIL>().Where(p => p.BillNum == billNum).ToList();
var main = _dbcontext.Set<HBPO_CAN_SA>().FirstOrDefault(p => p.BillNum == billNum);
Execute(main, entites);
Execute<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL, HBPO_NOT_SA_DETAIL>(main, entites);
}
return id.ToString();
}
public void Execute<TMain,TDetail>(TMain p_main,List<TDetail> p_detailList) where TMain : SA_CAN_BASE_MAIN, new()
public void Execute<TMain,TDetail,TNOTDetail>(TMain p_main,List<TDetail> p_detailList) where TMain : SA_CAN_BASE_MAIN, new()
where TDetail : SA_CAN_BASE, new()
where TNOTDetail : SA_NOT_BASE, new()
{
List<TDetail> notList = new List<TDetail>();
List<TNOTDetail> notList = new List<TNOTDetail>();
var entites = p_detailList;
var main = p_main;
foreach (var itm in entites)
{
var detail = new TDetail();
var detail = new TNOTDetail();
detail.InjectFrom(itm);
detail.SetId(detail.Id);
detail.SetId(itm.Id);
foreach (var extra in itm.ExtraProperties)
{
detail.ExtraProperties.Add(extra.Key, extra.Value);

Loading…
Cancel
Save