wanggang 1 year ago
parent
commit
f41409bb0e
  1. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs
  2. 53
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
  3. 71
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  4. 40
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  5. 192
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs
  6. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs
  7. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

4
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs

@ -131,7 +131,6 @@ public class BBAC_SA_DETAIL_IMPORT_DTO
[Display(Name = "Posting Date")] [Display(Name = "Posting Date")]
[ImporterHeader(Name = "Posting Date")] [ImporterHeader(Name = "Posting Date")]
public string SettleDate { set; get; } public string SettleDate { set; get; }
/// <summary> /// <summary>
/// 结算分组号 /// 结算分组号
/// </summary> /// </summary>
@ -139,7 +138,6 @@ public class BBAC_SA_DETAIL_IMPORT_DTO
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "Reference")] [ImporterHeader(Name = "Reference")]
public string GroupNum { get; set; } public string GroupNum { get; set; }
/// <summary> /// <summary>
/// 客户零件号 /// 客户零件号
/// </summary> /// </summary>
@ -147,14 +145,12 @@ public class BBAC_SA_DETAIL_IMPORT_DTO
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "Material")] [ImporterHeader(Name = "Material")]
public string LU { get; set; } public string LU { get; set; }
/// <summary> /// <summary>
/// 数量 /// 数量
/// </summary> /// </summary>
[Display(Name = "结算数量")] [Display(Name = "结算数量")]
[ImporterHeader(Name = "GR Quantity")] [ImporterHeader(Name = "GR Quantity")]
public decimal Qty { get; set; } public decimal Qty { get; set; }
/// <summary> /// <summary>
/// 生产号 /// 生产号
/// </summary> /// </summary>

53
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs

@ -134,17 +134,9 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
var importBBACSaDetails = ObjectMapper.Map<List<BBAC_SA_DETAIL_IMPORT_DTO>, List<BBAC_SA_DETAIL>>(importDtos); var importBBACSaDetails = ObjectMapper.Map<List<BBAC_SA_DETAIL_IMPORT_DTO>, List<BBAC_SA_DETAIL>>(importDtos);
importBBACSaDetails = HandleSaDetails(importBBACSaDetails);
importBBACSaDetails.ForEach(importBBACSaDetail => importBBACSaDetails.ForEach(importBBACSaDetail =>
{ {
List<string> lus = importBBACSaDetail.LU.Split(" ").ToList();
importBBACSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
importBBACSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
}
importBBACSaDetail.CustomerPartCodeNoSpace = importBBACSaDetail.LU.Replace(" ", "");
importBBACSaDetail.Version = Version; importBBACSaDetail.Version = Version;
importBBACSaDetail.Site = Site; importBBACSaDetail.Site = Site;
}); });
@ -325,6 +317,39 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
#endregion #endregion
#region 私有方法 #region 私有方法
/// <summary>
/// 处理结算数据
/// </summary>
private List<BBAC_SA_DETAIL> HandleSaDetails(List<BBAC_SA_DETAIL> bbacSaDetails)
{
bbacSaDetails.ForEach(bbacSaDetail =>
{
var lus = bbacSaDetail.LU.Split(" ").ToList();
bbacSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
bbacSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
}
});
return GroupPnLu(bbacSaDetails);
}
/// <summary>
/// 结算数据分组Pn、Lu
/// </summary>
private List<BBAC_SA_DETAIL> GroupPnLu(List<BBAC_SA_DETAIL> bbacSaDetails)
{
return bbacSaDetails.GroupBy(t => new { t.PN, t.LU }).Select(t =>
{
var bbacSaDetail = t.First();
bbacSaDetail.Qty = t.Sum(t => t.Qty);
return bbacSaDetail;
}).ToList();
}
/// <summary> /// <summary>
/// 结算数据处理 /// 结算数据处理
/// </summary> /// </summary>
@ -365,17 +390,9 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
bbacSaDetails.ForEach(bbacSaDetail => bbacSaDetails.ForEach(bbacSaDetail =>
{ {
bbacSaDetail.SetId(GuidGenerator.Create()); bbacSaDetail.SetId(GuidGenerator.Create());
List<string> lus = bbacSaDetail.LU.Split(" ").ToList();
bbacSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
bbacSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
}
bbacSaDetail.BillNum = bbacSaBillNum; bbacSaDetail.BillNum = bbacSaBillNum;
bbacSaDetail.KeyCode = bbacSaDetail.PN + bbacSaDetail.LU; bbacSaDetail.KeyCode = bbacSaDetail.PN + bbacSaDetail.LU;
bbacSaDetail.CustomerPartCodeNoSpace = bbacSaDetail.LU.Replace(" ", "");
bbacSaDetail.BusinessType = bbacSaDetail.PN.Contains("R0") ? EnumBusinessType.MaiDanJianBBAC : _businessType; bbacSaDetail.BusinessType = bbacSaDetail.PN.Contains("R0") ? EnumBusinessType.MaiDanJianBBAC : _businessType;
}); });

71
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs

@ -219,7 +219,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
var result = await _exportImporter.UploadExcelImport<HBPO_SA_DETAIL_IMPORT_DTO>(files, _excelImportService).ConfigureAwait(false); var result = await _exportImporter.UploadExcelImport<HBPO_SA_DETAIL_IMPORT_DTO>(files, _excelImportService).ConfigureAwait(false);
var importHBOPSaDetails = ObjectMapper.Map<List<HBPO_SA_DETAIL_IMPORT_DTO>, List<HBPO_SA_DETAIL>>(result); var importHBOPSaDetails = ObjectMapper.Map<List<HBPO_SA_DETAIL_IMPORT_DTO>, List<HBPO_SA_DETAIL>>(result);
HandleSaDetails(importHBOPSaDetails); importHBOPSaDetails = HandleSaDetails(importHBOPSaDetails);
//Site包含CN1 亦庄 //Site包含CN1 亦庄
//Site包含CN5 顺义 //Site包含CN5 顺义
@ -237,11 +237,11 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
if (importCN1HBOPSaDetails.Any()) if (importCN1HBOPSaDetails.Any())
{ {
await SaDataHandleAsync(importCN1HBOPSaDetails, "CN1").ConfigureAwait(false); await InsertSaDataAsync(importCN1HBOPSaDetails, "CN1").ConfigureAwait(false);
} }
if (importCN5HBOPSaDetails.Any()) if (importCN5HBOPSaDetails.Any())
{ {
await SaDataHandleAsync(importCN5HBOPSaDetails, "CN5").ConfigureAwait(false); await InsertSaDataAsync(importCN5HBOPSaDetails, "CN5").ConfigureAwait(false);
} }
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
@ -263,7 +263,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
} }
HandleSaDetails(importMaiDanHBPOSaDetails); importMaiDanHBPOSaDetails = HandleSaDetails(importMaiDanHBPOSaDetails);
#region 数据校验 #region 数据校验
var checkList = await CheckAsync(importMaiDanHBPOSaDetails).ConfigureAwait(false); var checkList = await CheckAsync(importMaiDanHBPOSaDetails).ConfigureAwait(false);
@ -274,14 +274,50 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
} }
#endregion #endregion
await SaDataHandleAsync(importMaiDanHBPOSaDetails, "").ConfigureAwait(false); await InsertSaDataAsync(importMaiDanHBPOSaDetails, "").ConfigureAwait(false);
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
} }
/// <summary> /// <summary>
/// 结算数据处理 /// 处理结算数据
/// </summary> /// </summary>
private async Task SaDataHandleAsync(List<HBPO_SA_DETAIL> hbpoSaDetails, string site) private List<HBPO_SA_DETAIL> HandleSaDetails(List<HBPO_SA_DETAIL> hbpoSaDetails)
{
hbpoSaDetails.ForEach(hbpoSaDetail =>
{
hbpoSaDetail.SetId(GuidGenerator.Create());
var lus = hbpoSaDetail.LU.Split(" ").ToList();
hbpoSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
hbpoSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
}
hbpoSaDetail.CustomerPartCodeNoSpace = hbpoSaDetail.LU.Replace(" ", "");
hbpoSaDetail.Version = Version;
});
return GroupPnLu(hbpoSaDetails);
}
/// <summary>
/// 结算数据分组Pn、Lu
/// </summary>
private List<HBPO_SA_DETAIL> GroupPnLu(List<HBPO_SA_DETAIL> hbpoSaDetails)
{
return hbpoSaDetails.GroupBy(t => new { t.PN, t.LU }).Select(t =>
{
var hbpoSaDetail = t.First();
hbpoSaDetail.Qty = t.Sum(t => t.Qty);
return hbpoSaDetail;
}).ToList();
}
/// <summary>
/// Insert结算数据
/// </summary>
private async Task InsertSaDataAsync(List<HBPO_SA_DETAIL> hbpoSaDetails, string site)
{ {
//结算单号 //结算单号
var hbpoSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA"); var hbpoSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA");
@ -420,27 +456,6 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
return (hbpoSas, hbpoSaDetails, hbpoCanSas, hbpoCanSaDetails, hbpoNotSaDetails); return (hbpoSas, hbpoSaDetails, hbpoCanSas, hbpoCanSaDetails, hbpoNotSaDetails);
} }
/// <summary>
/// 结算数据处理
/// </summary>
private void HandleSaDetails(List<HBPO_SA_DETAIL> hbpoSaDetails)
{
hbpoSaDetails.ForEach(hbpoSaDetail =>
{
hbpoSaDetail.SetId(GuidGenerator.Create());
var lus = hbpoSaDetail.LU.Split(" ").ToList();
hbpoSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
hbpoSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
}
hbpoSaDetail.CustomerPartCodeNoSpace = hbpoSaDetail.LU.Replace(" ", "");
hbpoSaDetail.Version = Version;
});
}
/// <summary> /// <summary>
/// 数据校验 /// 数据校验
/// </summary> /// </summary>

40
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -239,7 +239,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
} }
HandleSaDetailLU(importPubSaDetails); importPubSaDetails = HandleSaDetails(importPubSaDetails);
#region 数据校验 #region 数据校验
var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false); var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false);
@ -250,7 +250,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
} }
#endregion #endregion
return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianBBAC).ConfigureAwait(false); return await InsertSaDataAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianBBAC).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -276,7 +276,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
} }
HandleSaDetailLU(importPubSaDetails); importPubSaDetails = HandleSaDetails(importPubSaDetails);
#region 数据校验 #region 数据校验
var checkList = await CheckAsync(importPubSaDetails); var checkList = await CheckAsync(importPubSaDetails);
@ -287,7 +287,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
} }
#endregion #endregion
return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianHBPO).ConfigureAwait(false); return await InsertSaDataAsync(importPubSaDetails, EnumBusinessType.ZhiGongJianHBPO).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -306,7 +306,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
} }
HandleSaDetailLU(importPubSaDetails); importPubSaDetails = HandleSaDetails(importPubSaDetails);
#region 数据校验 #region 数据校验
var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false); var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false);
@ -317,7 +317,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
} }
#endregion #endregion
return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.BeiJian).ConfigureAwait(false); return await InsertSaDataAsync(importPubSaDetails, EnumBusinessType.BeiJian).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -337,7 +337,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
} }
HandleSaDetailLU(importPubSaDetails); importPubSaDetails = HandleSaDetails(importPubSaDetails);
#region 数据校验 #region 数据校验
var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false); var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false);
@ -348,7 +348,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
} }
#endregion #endregion
return await SaDataHandleAsync(importPubSaDetails, EnumBusinessType.YinDuJian).ConfigureAwait(false); return await InsertSaDataAsync(importPubSaDetails, EnumBusinessType.YinDuJian).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -392,10 +392,9 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
} }
/// <summary> /// <summary>
/// 处理结算数据LU /// 处理结算数据
/// </summary> /// </summary>
/// <param name="pubSaDetails"></param> private List<PUB_SA_DETAIL> HandleSaDetails(List<PUB_SA_DETAIL> pubSaDetails)
private void HandleSaDetailLU(List<PUB_SA_DETAIL> pubSaDetails)
{ {
pubSaDetails.ForEach(pubSaDetail => pubSaDetails.ForEach(pubSaDetail =>
{ {
@ -408,12 +407,27 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
pubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); pubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
} }
}); });
return GroupPnLu(pubSaDetails);
}
/// <summary>
/// 结算数据分组Pn、Lu
/// </summary>
private List<PUB_SA_DETAIL> GroupPnLu(List<PUB_SA_DETAIL> pubSaDetails)
{
return pubSaDetails.GroupBy(t => new { t.PN, t.LU }).Select(t =>
{
var pubSaDetail = t.First();
pubSaDetail.Qty = t.Sum(t => t.Qty);
return pubSaDetail;
}).ToList();
} }
/// <summary> /// <summary>
/// 结算数据处理 /// Insert结算数据
/// </summary> /// </summary>
private async Task<IActionResult> SaDataHandleAsync(List<PUB_SA_DETAIL> pubSaDetails, EnumBusinessType businessType) private async Task<IActionResult> InsertSaDataAsync(List<PUB_SA_DETAIL> pubSaDetails, EnumBusinessType businessType)
{ {
//客户零件关系 //客户零件关系
var materialRelationships = new List<MaterialRelationship>(); var materialRelationships = new List<MaterialRelationship>();

192
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/PendingDeductionService.cs

@ -21,6 +21,7 @@ using TaskJob.Interfaces;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
using Volo.Abp.Emailing;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
@ -33,12 +34,16 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
protected readonly SettleAccountDbContext _dbcontext; protected readonly SettleAccountDbContext _dbcontext;
private readonly IEmailSender _emailSender;
public PendingDeductionService( public PendingDeductionService(
SettleAccountDbContext dbcontext SettleAccountDbContext dbcontext,
IEmailSender emailSender
) )
{ {
_emailSender = emailSender;
_dbcontext = dbcontext; _dbcontext = dbcontext;
} }
@ -49,6 +54,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
var billList = property.Where(p => p.Name == "BillNumList").FirstOrDefault().Value; var billList = property.Where(p => p.Name == "BillNumList").FirstOrDefault().Value;
var type = property.Where(p => p.Name == "Type").FirstOrDefault().Value; var type = property.Where(p => p.Name == "Type").FirstOrDefault().Value;
var isout = property.Where(p => p.Name == "IsOut").FirstOrDefault().Value; var isout = property.Where(p => p.Name == "IsOut").FirstOrDefault().Value;
var email = property.Where(p => p.Name == "CurrentUserEmail").FirstOrDefault().Value;
var list = billList.Split(","); var list = billList.Split(",");
var projectList = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "库位"); var projectList = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "库位");
@ -76,7 +82,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "JisBBAC顺义").Description; itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "JisBBAC顺义").Description;
} }
} }
Sync(jisdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); Sync(jisdetail.ToList(), EnumDeliverBjBmpBillType.JIS件,email ,isout == "out" ? true : false);
} }
// //
var mdetail = _dbcontext.Set<BBAC_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianBBAC);//买单件 var mdetail = _dbcontext.Set<BBAC_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianBBAC);//买单件
@ -93,7 +99,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "JisBBAC顺义").Description; itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "JisBBAC顺义").Description;
} }
} }
Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件,email ,isout == "out" ? true : false);
} }
var detailist1 = _dbcontext.Set<PUB_PD_DETAIL>().Where(p => list.Contains(p.BillNum) ).ToList(); var detailist1 = _dbcontext.Set<PUB_PD_DETAIL>().Where(p => list.Contains(p.BillNum) ).ToList();
@ -112,7 +118,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "ZhiGongJianBBAC顺义").Description; itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "ZhiGongJianBBAC顺义").Description;
} }
} }
Sync(zgbbaclist, EnumDeliverBjBmpBillType.JIT直供件, isout == "out" ? true : false); Sync(zgbbaclist, EnumDeliverBjBmpBillType.JIT直供件,email, isout == "out" ? true : false);
var ydlist = detailist1.Where(p => p.BusinessType == EnumBusinessType.YinDuJian).ToList(); var ydlist = detailist1.Where(p => p.BusinessType == EnumBusinessType.YinDuJian).ToList();
if (ydlist.Count > 0) if (ydlist.Count > 0)
{ {
@ -123,7 +129,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "YinDuJian").Description; itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "YinDuJian").Description;
} }
} }
Sync(ydlist, EnumDeliverBjBmpBillType., isout == "out" ? true : false); Sync(ydlist, EnumDeliverBjBmpBillType., email,isout == "out" ? true : false);
} }
var bjlist = detailist1.Where(p => p.BusinessType == EnumBusinessType.BeiJian).ToList(); var bjlist = detailist1.Where(p => p.BusinessType == EnumBusinessType.BeiJian).ToList();
if (bjlist.Count > 0) if (bjlist.Count > 0)
@ -135,12 +141,8 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "BeiJian").Description; itm.Extend2 = projectList.FirstOrDefault(p => p.Value == "BeiJian").Description;
} }
} }
Sync(bjlist, EnumDeliverBjBmpBillType.4S备件, isout == "out" ? true : false); Sync(bjlist, EnumDeliverBjBmpBillType.4S备件,email ,isout == "out" ? true : false);
} }
} }
} }
else if (type == "JisHBPO" || type == "ZhiGongJianHBPO" || type == "MaiDanJianHBPO") else if (type == "JisHBPO" || type == "ZhiGongJianHBPO" || type == "MaiDanJianHBPO")
@ -153,7 +155,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
itm.Extend2 = "CC017"; itm.Extend2 = "CC017";
} }
} }
Sync(detailist, EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); Sync(detailist, EnumDeliverBjBmpBillType.JIS件,email ,isout == "out" ? true : false);
var mdetail = _dbcontext.Set<HBPO_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianHBPO);//买单件 var mdetail = _dbcontext.Set<HBPO_PD_DETAIL>().Where(p => list.Contains(p.BillNum) && p.BusinessType == EnumBusinessType.MaiDanJianHBPO);//买单件
foreach (var itm in mdetail) foreach (var itm in mdetail)
{ {
@ -162,7 +164,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
itm.Extend2 = "CC017"; itm.Extend2 = "CC017";
} }
} }
Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件, isout == "out" ? true : false); Sync(mdetail.ToList(), EnumDeliverBjBmpBillType.JIS件,email ,isout == "out" ? true : false);
var detailist1 = _dbcontext.Set<PUB_PD_DETAIL>().Where(p => list.Contains(p.BillNum)).ToList(); var detailist1 = _dbcontext.Set<PUB_PD_DETAIL>().Where(p => list.Contains(p.BillNum)).ToList();
var zgbbaclist = detailist1.Where(p => p.BusinessType == EnumBusinessType.ZhiGongJianHBPO).ToList(); var zgbbaclist = detailist1.Where(p => p.BusinessType == EnumBusinessType.ZhiGongJianHBPO).ToList();
foreach (var itm in zgbbaclist) foreach (var itm in zgbbaclist)
@ -172,28 +174,28 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
itm.Extend2 = "CC017"; itm.Extend2 = "CC017";
} }
} }
Sync(detailist, EnumDeliverBjBmpBillType.JIT直供件, isout == "out" ? true : false); Sync(detailist, EnumDeliverBjBmpBillType.JIT直供件,email,isout == "out" ? true : false);
} }
return id.ToString(); return id.ToString();
} }
public List<T> GetPagedData<T>(List<T> dataList, int pageNumber, int pageSize) //public List<T> GetPagedData<T>(List<T> dataList, int pageNumber, int pageSize)
{ //{
int startIndex = (pageNumber - 1) * pageSize; // int startIndex = (pageNumber - 1) * pageSize;
return dataList.Skip(startIndex).Take(pageSize).ToList(); // return dataList.Skip(startIndex).Take(pageSize).ToList();
} //}
public int CalculatePageCount(int totalCount, int pageSize) //public int CalculatePageCount(int totalCount, int pageSize)
{ //{
int pageCount = totalCount / pageSize; // int pageCount = totalCount / pageSize;
if (totalCount % pageSize != 0) // if (totalCount % pageSize != 0)
{ // {
pageCount += 1; // pageCount += 1;
} // }
return pageCount; // return pageCount;
} //}
public void Sync<T>(List<T> p_ls, EnumDeliverBjBmpBillType bussinessType, bool flag=true) where T : PD_BASE,new() public void Sync<T>(List<T> p_ls, EnumDeliverBjBmpBillType bussinessType,string p_email ,bool flag=true) where T : PD_BASE,new()
{ {
var query = from itm in p_ls var query = from itm in p_ls
select new VmiLog() select new VmiLog()
@ -218,8 +220,6 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
ErpToLoc = itm.Extend2, //寄售库 ErpToLoc = itm.Extend2, //寄售库
}; };
var ls = query.ToList(); var ls = query.ToList();
foreach (var itm in ls) foreach (var itm in ls)
{ {
itm.SetId(GuidGenerator.Create()); itm.SetId(GuidGenerator.Create());
@ -232,11 +232,7 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
// 执行批量数据操作 // 执行批量数据操作
if (ls != null && ls.Count > 0) if (ls != null && ls.Count > 0)
{ {
var messagelist = new List<VmiMessage>(); var messagelist = new List<VmiMessage>();
foreach (var item in ls) foreach (var item in ls)
{ {
var message = new VmiMessage var message = new VmiMessage
@ -245,41 +241,127 @@ public class PendingDeductionService : ApplicationService, ITransientDependency,
}; };
messagelist.Add(message); messagelist.Add(message);
} }
_dbcontext.BulkInsert(messagelist); _dbcontext.BulkInsert(messagelist);
_dbcontext.BulkInsert(ls,new BulkConfig() { }); _dbcontext.BulkInsert(ls, new BulkConfig() { });
var billList = p_ls.Select(p => p.BillNum).Distinct().ToList();
var pdList = _dbcontext.Set<PUB_PD>().Where(p => billList.Contains(p.BillNum)).ToList();
if (pdList.Count > 0)
{
foreach (var item in pdList)
{
if (flag == true)
{
item.State = SettleBillState.;
}
else
{
item.State = SettleBillState.;
}
}
_dbcontext.BulkUpdate(pdList);
}
var bbacList = _dbcontext.Set<BBAC_PD>().Where(p => billList.Contains(p.BillNum)).ToList();
if (bbacList.Count > 0)
{
foreach (var item in bbacList)
{
if (flag == true)
{
item.State = SettleBillState.;
}
else
{
item.State = SettleBillState.;
}
}
_dbcontext.BulkUpdate(bbacList);
}
var hbpoList = _dbcontext.Set<HBPO_PD>().Where(p => billList.Contains(p.BillNum)).ToList();
if (hbpoList.Count > 0)
{
foreach (var item in hbpoList)
{
if (flag == true)
{
item.State = SettleBillState.;
}
else
{
item.State = SettleBillState.;
}
}
_dbcontext.BulkUpdate(hbpoList);
}
}
//var count = CalculatePageCount(ls.Count, 2000); // _emailSender.SendAsync(e)
//for (int pagenumber = 0; pagenumber < count; pagenumber++)
//{
// var lst = GetPagedData(ls, pagenumber++, 2000);
// var messagelist= new List<VmiMessage>();
// foreach (var item in lst)
// {
// var message = new VmiMessage
// {
// Message = System.Text.Json.JsonSerializer.Serialize(item),
// };
// messagelist.Add(message);
// }
// _dbcontext.BulkInsert(messagelist);
// _dbcontext.BulkInsert(lst,new BulkConfig() { });
// Task.Delay(500);
//}
}
// 提交事务 // 提交事务
transaction.Commit(); transaction.Commit();
} }
catch (Exception) catch (Exception)
{ {
var billList = p_ls.Select(p => p.BillNum).Distinct().ToList();
var pdList = _dbcontext.Set<PUB_PD>().Where(p => billList.Contains(p.BillNum)).ToList();
if (pdList.Count > 0)
{
foreach (var item in pdList)
{
if (flag == true)
{
item.State = SettleBillState.;
}
else
{
item.State = SettleBillState.;
}
}
_dbcontext.BulkUpdate(pdList);
}
var bbacList = _dbcontext.Set<BBAC_PD>().Where(p => billList.Contains(p.BillNum)).ToList();
if (bbacList.Count > 0)
{
foreach (var item in bbacList)
{
if (flag == true)
{
item.State = SettleBillState.;
}
else
{
item.State = SettleBillState.;
}
}
_dbcontext.BulkUpdate(bbacList);
}
var hbpoList = _dbcontext.Set<HBPO_PD>().Where(p => billList.Contains(p.BillNum)).ToList();
if (hbpoList.Count > 0)
{
foreach (var item in hbpoList)
{
if (flag == true)
{
item.State = SettleBillState.;
}
else
{
item.State = SettleBillState.;
}
}
_dbcontext.BulkUpdate(hbpoList);
}
// 回滚事务 // 回滚事务
transaction.Rollback(); transaction.Rollback();
throw; throw;
} }
} }
} }

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

@ -9,6 +9,8 @@ using Volo.Abp.AutoMapper;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.BlobStoring.Minio; using Volo.Abp.BlobStoring.Minio;
using Volo.Abp.Dapper; using Volo.Abp.Dapper;
using Volo.Abp.Emailing.Smtp;
using Volo.Abp.Emailing;
using Volo.Abp.Http.Client.IdentityModel; using Volo.Abp.Http.Client.IdentityModel;
using Volo.Abp.Identity; using Volo.Abp.Identity;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
@ -44,7 +46,7 @@ namespace Win.Sfs.SettleAccount
ConfigureJson(context); ConfigureJson(context);
//context.Services.AddTransient(typeof(INormalEfCoreRepository<,>), //context.Services.AddTransient(typeof(INormalEfCoreRepository<,>),
//typeof(SettleAccountNormalEfCoreRepository<,>)); //typeof(SettleAccountNormalEfCoreRepository<,>));
context.Services.AddTransient<IEmailSender, SmtpEmailSender>();
context.Services.AddTransient(implementationFactory => context.Services.AddTransient(implementationFactory =>
{ {
Func<string, IExportJob> accesor = key => Func<string, IExportJob> accesor = key =>

15
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

@ -415,12 +415,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{ {
return await _repository.Where(p => invs.Contains(p.InvbillNum)).ToListAsync(); return await _repository.Where(p => invs.Contains(p.InvbillNum)).ToListAsync();
} }
/// <summary> /// <summary>
/// 客户已收票 /// 客户已收票
/// </summary> /// </summary>
@ -593,7 +587,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return true; return true;
} }
else if (inv.BusinessType == EnumBusinessType.JisHBPO) else if (inv.BusinessType == EnumBusinessType.JisHBPO || inv.BusinessType == EnumBusinessType.MaiDanJianHBPO)
{ {
var pdlist = _pdhbpoRepository.Where(p => p_invs.Contains(p.BillNum)).ToList();//包含发票号的代扣减单 var pdlist = _pdhbpoRepository.Where(p => p_invs.Contains(p.BillNum)).ToList();//包含发票号的代扣减单
if (pdlist != null && pdlist.Count > 0) if (pdlist != null && pdlist.Count > 0)
@ -724,9 +718,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
extend3: string.Empty, extend3: string.Empty,
extend4: itm.PartCode, extend4: itm.PartCode,
p_businessType:itm.BusinessType p_businessType:itm.BusinessType
); );
entity.RELU = string.IsNullOrEmpty(itm.RealPartCode) ? itm.PartCode : itm.RealPartCode;//厂内替换零件号 entity.RELU = string.IsNullOrEmpty(itm.RealPartCode) ? itm.PartCode : itm.RealPartCode;//厂内替换零件号
entity.Extend2 = itm.ErpLoc;//ERP库位 entity.Extend2 = itm.ErpLoc;//ERP库位
@ -743,6 +734,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
await _repository.DbContext.BulkUpdateAsync(invList); await _repository.DbContext.BulkUpdateAsync(invList);
return true; return true;
} }
else else
{ {
var pdlist = _pdpubRepository.Where(p => p_invs.Contains(p.BillNum)).ToList();//包含发票号的代扣减单 var pdlist = _pdpubRepository.Where(p => p_invs.Contains(p.BillNum)).ToList();//包含发票号的代扣减单

Loading…
Cancel
Save