Browse Source

更新

master
zhaoxinyu 5 months ago
parent
commit
1f823282e4
  1. 36
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
  2. 51
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
  3. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
  4. 78
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ReturnCanSettlement.cs
  5. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs
  6. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  7. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_NOT_SA_DETAIL.cs
  8. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_NOT_SA_DETAIL.cs
  9. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_NOT_SA_DETAIL.cs
  10. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs

36
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs

@ -146,28 +146,42 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[UnitOfWork(false)]
public virtual async Task<IActionResult> BackCanSettlement([FromBody] string selttleBilNum)
{
if (selttleBilNum.Substring(0, 1) == "N")
{
List<BBAC_NOT_SA_DETAIL> notList = new List<BBAC_NOT_SA_DETAIL>();
var entites = _repository.Where(p => p.BillNum == selttleBilNum).ToList();
var main = _repository.Where(p => p.BillNum == selttleBilNum).ToList();
foreach (var itm in entites)
var entites = _detailRepository.Where(p => p.BillNum == selttleBilNum).ToList();
var main = _repository.FirstOrDefault(p => p.BillNum == selttleBilNum);
if (main.State != SettleBillState.)
{
throw new UserFriendlyException("当前状态不是未结状态无法退回!", "400");
}
if (entites.Count == 0)
{
var detail = new BBAC_NOT_SA_DETAIL();
detail.InjectFrom(itm);
notList.Add(detail);
throw new UserFriendlyException("当前表单明细无数据无法退回!", "400");
}
var dbcontext = await _repository.GetDbContextAsync().ConfigureAwait(false);
await dbcontext.BulkDeleteAsync(main).ConfigureAwait(false);
await dbcontext.BulkDeleteAsync(entites).ConfigureAwait(false);
await dbcontext.BulkInsertAsync(notList).ConfigureAwait(false);
return new JsonResult(new { Code = 200, Message = "退回成功" });
main.State = SettleBillState.退;
await _repository.UpdateAsync(main).ConfigureAwait(false);
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "BillNum", Value = selttleBilNum });
customConditionList.Add(new CustomCondition() { Name = "BussinessType", Value = main.BusinessType.ToString() });
var _taskid = await _service.ExportEnqueueAsync("可结退回不可结", ExportExtentsion.Excel, string.Empty, string.Empty, CurrentUser, typeof(ReturnCanSettlement), customConditionList, (rs) =>
{
}).ConfigureAwait(false);
}
else
{
throw new UserFriendlyException("单据不是从不可结算单生成", "400");
}
return new JsonResult(new { Code = 200, Message = "开始退回" });
}

51
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs

@ -201,24 +201,53 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
if (selttleBilNum.Substring(0, 1) == "N")
{
List<HBPO_NOT_SA_DETAIL> notList = new List<HBPO_NOT_SA_DETAIL>();
var entites = _repository.Where(p => p.BillNum == selttleBilNum).ToList();
var main = _repository.Where(p => p.BillNum == selttleBilNum).ToList();
foreach (var itm in entites)
var entites = _detailRepository.Where(p => p.BillNum == selttleBilNum).ToList();
var main = _repository.FirstOrDefault(p => p.BillNum == selttleBilNum);
if (main.State != SettleBillState.)
{
throw new UserFriendlyException("当前状态不是未结状态无法退回!", "400");
}
if (entites.Count == 0)
{
var detail = new HBPO_NOT_SA_DETAIL();
detail.InjectFrom(itm);
notList.Add(detail);
throw new UserFriendlyException("当前表单明细无数据无法退回!", "400");
}
var dbcontext = await _repository.GetDbContextAsync().ConfigureAwait(false);
await dbcontext.BulkDeleteAsync(main).ConfigureAwait(false);
await dbcontext.BulkDeleteAsync(entites).ConfigureAwait(false);
await dbcontext.BulkInsertAsync(notList).ConfigureAwait(false);
return new JsonResult(new { Code = 200, Message = "退回成功" });
main.State = SettleBillState.退;
await _repository.UpdateAsync(main).ConfigureAwait(false);
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "BillNum", Value = selttleBilNum });
customConditionList.Add(new CustomCondition() { Name = "BussinessType", Value = main.BusinessType.ToString() });
var _taskid = await _service.ExportEnqueueAsync("可结退回不可结", ExportExtentsion.Excel, string.Empty, string.Empty, CurrentUser, typeof(ReturnCanSettlement), customConditionList, (rs) =>
{
}).ConfigureAwait(false);
//foreach (var itm in entites)
//{
// var detail = new HBPO_NOT_SA_DETAIL();
// detail.InjectFrom(itm);
// detail.SetId(detail.Id);
// foreach (var extra in itm.ExtraProperties)
// {
// detail.ExtraProperties.Add(extra.Key, extra.Value);
// }
// notList.Add(detail);
//}
//var dbcontext = await _repository.GetDbContextAsync().ConfigureAwait(false);
//await dbcontext.BulkDeleteAsync(new List<HBPO_CAN_SA>() { main }).ConfigureAwait(false);
//await dbcontext.BulkDeleteAsync(entites).ConfigureAwait(false);
//await dbcontext.BulkInsertAsync(notList).ConfigureAwait(false);
//return new JsonResult(new { Code = 200, Message = "退回成功" });
}
else
{
throw new UserFriendlyException("单据不是从不可结算单生成", "400");
}
return new JsonResult(new { Code = 200, Message = "退回开始!" });
}
}

18
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs

@ -258,16 +258,28 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
if (selttleBilNum.Substring(0, 1) == "N")
{
List<PUB_NOT_SA_DETAIL> notList = new List<PUB_NOT_SA_DETAIL>();
var entites = _repository.Where(p => p.BillNum == selttleBilNum).ToList();
var main = _repository.Where(p => p.BillNum == selttleBilNum).ToList();
var entites = _detailRepository.Where(p => p.BillNum == selttleBilNum).ToList();
var main = _repository.FirstOrDefault(p => p.BillNum == selttleBilNum);
if (main.State != SettleBillState.)
{
throw new UserFriendlyException("当前状态不是未结状态无法退回!", "400");
}
foreach (var itm in entites)
{
var detail = new PUB_NOT_SA_DETAIL();
detail.InjectFrom(itm);
detail.SetId(itm.Id);
foreach (var extra in itm.ExtraProperties)
{
detail.ExtraProperties.Add(extra.Key, extra.Value);
}
notList.Add(detail);
}
var dbcontext = await _repository.GetDbContextAsync().ConfigureAwait(false);
await dbcontext.BulkDeleteAsync(main).ConfigureAwait(false);
await dbcontext.BulkDeleteAsync(new List<PUB_CAN_SA>() { main }).ConfigureAwait(false);
await dbcontext.BulkDeleteAsync(entites).ConfigureAwait(false);
await dbcontext.BulkInsertAsync(notList).ConfigureAwait(false);
return new JsonResult(new { Code = 200, Message = "退回成功" });

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

@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Omu.ValueInjecter;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
{
public class ReturnCanSettlement : ApplicationService, ITransientDependency, IExportJob
{
protected readonly SettleAccountDbContext _dbcontext;
public ReturnCanSettlement(SettleAccountDbContext dbcontext)
{
_dbcontext = dbcontext;
}
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{
var billNum = property.Where(p => p.Name == "BillNum").FirstOrDefault().Value;
var BussinessType = property.Where(p => p.Name == "BussinessType").FirstOrDefault().Value;
if (BussinessType == "JisBBAC")
{
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);
}
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);
}
return id.ToString();
}
public void Execute<TMain,TDetail>(TMain p_main,List<TDetail> p_detailList) where TMain : SA_CAN_BASE_MAIN, new()
where TDetail : SA_CAN_BASE, new()
{
List<TDetail> notList = new List<TDetail>();
var entites = p_detailList;
var main = p_main;
foreach (var itm in entites)
{
var detail = new TDetail();
detail.InjectFrom(itm);
detail.SetId(detail.Id);
foreach (var extra in itm.ExtraProperties)
{
detail.ExtraProperties.Add(extra.Key, extra.Value);
}
notList.Add(detail);
}
_dbcontext.BulkDelete(new List<TMain>() { main });
_dbcontext.BulkDelete(entites);
_dbcontext.BulkInsert(notList);
}
}
}

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs

@ -114,6 +114,12 @@ namespace Win.Sfs.SettleAccount
{
return implementationFactory.GetService<MakeCanSettlementService>();
}
if (key.Equals(typeof(ReturnCanSettlement).FullName))
{
return implementationFactory.GetService<ReturnCanSettlement>();
}
else
{
throw new ArgumentException($"Not Support key:{key}");

12
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs

@ -462,6 +462,10 @@ namespace SettleAccount.Bases
public string RealPartCode { get; set; }
public string Site { get; set; }
public virtual void SetId(Guid guid)
{
Id = guid;
}
//public SA_CAN_BASE(int version, decimal price, string billNum, DateTime settleDate, string invGroupNum, string lU, string pN, string keyCode, decimal qty, string groupNum)
//{
@ -542,6 +546,14 @@ namespace SettleAccount.Bases
public string ErpLoc { get; set; }
public virtual void SetId(Guid guid)
{
Id = guid;
}
//public SA_NOT_BASE(decimal price, int version, string settleBillNum, DateTime settleDate, string invGroupNum, string lU, string pN, string keyCode, decimal qty, string groupNum)
//{
// Price = price;

1
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_NOT_SA_DETAIL.cs

@ -90,6 +90,7 @@ namespace SettleAccount.Domain.BQ
{
}
public BBAC_NOT_SA_DETAIL(Guid guid, string keyCode, int version, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, EnumBusinessType category, bool isReturn, string invGroupNum, DateTime settleDate, string groupNum, string contractDocID, string partcode)
{

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_NOT_SA_DETAIL.cs

@ -111,7 +111,7 @@ namespace SettleAccount.Domain.BQ
BusinessType = businessType;
PartCode = partcode;
}
public HBPO_NOT_SA_DETAIL()
{
}

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_NOT_SA_DETAIL.cs

@ -74,7 +74,7 @@ namespace SettleAccount.Domain.BQ
/// </summary>
[Display(Name = "计数")]
public int IndexNum { get; set; }
public PUB_NOT_SA_DETAIL(string keyCode, int version, string settleBillNum, string lU, string pN, string site, decimal qty, string extend1, string extend2, string extend3, decimal price, string invGroupNum, DateTime settleDate, EnumBusinessType businessType, string groupNum, string partcode, string pobillnum)
{
KeyCode = keyCode;
@ -95,7 +95,7 @@ namespace SettleAccount.Domain.BQ
PartCode = partcode;
PoBillNum = pobillnum;
}
public PUB_NOT_SA_DETAIL()
{
}

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs

@ -39,6 +39,11 @@ namespace Win.Sfs.SettleAccount
= 11,
[Description("发票同步中")]
= 12,
[Description("可结退回不可结同步中")]
退 = 13,
}

Loading…
Cancel
Save