学 赵 1 year ago
parent
commit
603ca1b68b
  1. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  2. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SA_DTO.cs
  3. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs
  4. 93
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
  5. 24
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/TB_RePartsRelationship_DTO.cs
  6. 35
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
  7. 22
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  8. 180
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  9. 82
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs
  10. 206
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  11. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  12. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  13. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs
  14. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_NOT_SA_DETAIL.cs
  15. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SA.cs
  16. 5386
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230810012032_20230810-1.Designer.cs
  17. 64
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230810012032_20230810-1.cs
  18. 5395
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230810025021_20230810-2.Designer.cs
  19. 67
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230810025021_20230810-2.cs
  20. 22
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

@ -29,6 +29,7 @@ public class Startup
options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "image/svg+xml" }); options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "image/svg+xml" });
}); });
services.AddScheduler(); services.AddScheduler();
services.AddSingleton<JisHBPOSeEdiCompareAppService>();
services.AddSignalR(o => o.EnableDetailedErrors = true); services.AddSignalR(o => o.EnableDetailedErrors = true);
JobHostdService.AddService(services); JobHostdService.AddService(services);
services.AddSingleton<JobHostdService>(); services.AddSingleton<JobHostdService>();
@ -56,6 +57,7 @@ public class Startup
app.UseEndpoints(endpoints => endpoints.MapHub<PageHub>("/api/hub")); app.UseEndpoints(endpoints => endpoints.MapHub<PageHub>("/api/hub"));
app.ApplicationServices.UseScheduler(scheduler => app.ApplicationServices.UseScheduler(scheduler =>
{ {
scheduler.Schedule<JisHBPOSeEdiCompareAppService>().EverySeconds(10);
}); });
var contentTypeProvider = new FileExtensionContentTypeProvider(); var contentTypeProvider = new FileExtensionContentTypeProvider();
contentTypeProvider.Mappings.Add(".mjs", "text/javascript"); contentTypeProvider.Mappings.Add(".mjs", "text/javascript");

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

@ -79,7 +79,7 @@ public class BBAC_SA_DETAIL_IMPORT_DTO
[Display(Name = "Material")] [Display(Name = "Material")]
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "Material")] [ImporterHeader(Name = "Material")]
public string LU { get; set; } public string PartCode { get; set; }
/// <summary> /// <summary>
/// 数量 /// 数量

2
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SA_DTO.cs

@ -87,7 +87,7 @@ public class HBPO_SA_DETAIL_IMPORT_DTO
[Display(Name = "PartNumber")] [Display(Name = "PartNumber")]
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "PartNumber")] [ImporterHeader(Name = "PartNumber")]
public string LU { get; set; } public string PartCode { get; set; }
/// <summary> /// <summary>
/// 数量 /// 数量

93
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs

@ -76,12 +76,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public DateTime SettleDate { set; get; } public DateTime SettleDate { set; get; }
/// <summary> /// <summary>
/// 零件号 /// 客户零件号
/// </summary> /// </summary>
[Display(Name = "Material")] [Display(Name = "Material")]
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "Material")] [ImporterHeader(Name = "Material")]
public string LU { get; set; } public string PartCode { get; set; }
/// <summary> /// <summary>
/// 生产号 /// 生产号
@ -120,12 +120,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public DateTime SettleDate { set; get; } public DateTime SettleDate { set; get; }
/// <summary> /// <summary>
/// 零件号 /// 客户零件号
/// </summary> /// </summary>
[Display(Name = "零件号")] [Display(Name = "零件号")]
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "零件号")] [ImporterHeader(Name = "零件号")]
public string LU { get; set; } public string PartCode { get; set; }
/// <summary> /// <summary>
/// 生产号 /// 生产号
@ -164,12 +164,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public DateTime SettleDate { set; get; } public DateTime SettleDate { set; get; }
/// <summary> /// <summary>
/// 零件号 /// 客户零件号
/// </summary> /// </summary>
[Display(Name = "零件号")] [Display(Name = "零件号")]
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "零件号")] [ImporterHeader(Name = "零件号")]
public string LU { get; set; } public string PartCode { get; set; }
/// <summary> /// <summary>
/// 生产号 /// 生产号
@ -208,12 +208,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public DateTime SettleDate { set; get; } public DateTime SettleDate { set; get; }
/// <summary> /// <summary>
/// 零件号 /// 客户零件号
/// </summary> /// </summary>
[Display(Name = "零件号")] [Display(Name = "零件号")]
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "零件号")] [ImporterHeader(Name = "零件号")]
public string LU { get; set; } public string PartCode { get; set; }
/// <summary> /// <summary>
/// 生产号 /// 生产号
@ -252,12 +252,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public DateTime SettleDate { set; get; } public DateTime SettleDate { set; get; }
/// <summary> /// <summary>
/// 零件号 /// 客户零件号
/// </summary> /// </summary>
[Display(Name = "Material")] [Display(Name = "Material")]
[Required(ErrorMessage = "{0}不能为空")] [Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "Material")] [ImporterHeader(Name = "Material")]
public string LU { get; set; } public string PartCode { get; set; }
/// <summary> /// <summary>
/// 生产号 /// 生产号
@ -283,79 +283,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public string GroupNum { get; set; } public string GroupNum { get; set; }
} }
/// <summary>
/// 导入
/// </summary>
public class PUB_SA_DETAIL_IMPORT_DTO
{
///// <summary>
///// 期间
///// </summary>
//public int Version { set; get; }
///// <summary>
///// 单价
///// </summary>
//public decimal Price { set; get; }
///// <summary>
///// 结算单
///// </summary>
//public string BillNum { set; get; }
/// <summary>
/// 结算日期
/// </summary>
[Display(Name = "结算日期")]
[ImporterHeader(Name = "Pstng Date")]
public DateTime SettleDate { set; get; }
/// <summary>
/// 零件号
/// </summary>
[Display(Name = "零件号")]
[Required(ErrorMessage = "{0}不能为空")]
[ImporterHeader(Name = "Material")]
public string LU { get; set; }
/// <summary>
/// 生产号
/// </summary>
[Display(Name = "生产号")]
[ImporterHeader(Name = "External Delivery ID")]
[Required(ErrorMessage = "{0}不能为空")]
public string PN { get; set; }
///// <summary>
///// 组合键值(LU+PN)
///// </summary>
//public string KeyCode
//{
// get => LU + PN;
//}
///// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
[ImporterHeader(Name = "Quantity")]
public decimal Qty { get; set; }
/// <summary>
/// 结算分组号
/// </summary>
[Display(Name = "结算分组号")]
[ImporterHeader(Name = "Delivery")]
[Required(ErrorMessage = "{0}不能为空")]
public string GroupNum { get; set; }
/////// <summary>
/////// 工厂地点
/////// </summary>
////[Display(Name = "工厂地点")]
////public string Site { get; set; }
}
/// <summary> /// <summary>
/// 结算明细导出请求 /// 结算明细导出请求
/// </summary> /// </summary>

24
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/TB_RePartsRelationship_DTO.cs

@ -41,11 +41,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public class TB_RePartsRelationship_IMPORT_DTO public class TB_RePartsRelationship_IMPORT_DTO
{ {
/// <summary> /// <summary>
/// 客户物料号 /// 厂内物料号
/// </summary> /// </summary>
[Display(Name = "客户物料号")] [Display(Name = "厂内物料号")]
[Required(ErrorMessage = "{0}是必填项")] [Required(ErrorMessage = "{0}是必填项")]
[ImporterHeader(Name = "客户物料号")] [ImporterHeader(Name = "厂内物料号")]
public string LU { set; get; } public string LU { set; get; }
/// <summary> /// <summary>
@ -56,11 +56,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public EnumBusinessType BusinessType { get; set; } public EnumBusinessType BusinessType { get; set; }
/// <summary> /// <summary>
/// 替换客户物料号 /// 替换厂内物料号
/// </summary> /// </summary>
[Display(Name = "替换客户物料号")] [Display(Name = "替换厂内物料号")]
[Required(ErrorMessage = "{0}是必填项")] [Required(ErrorMessage = "{0}是必填项")]
[ImporterHeader(Name = "替换客户物料号")] [ImporterHeader(Name = "替换厂内物料号")]
public string RepLU { set; get; } public string RepLU { set; get; }
} }
@ -70,10 +70,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public class TB_RePartsRelationship_EXPORT_DTO public class TB_RePartsRelationship_EXPORT_DTO
{ {
/// <summary> /// <summary>
/// 零件 /// 厂内物料
/// </summary> /// </summary>
[Display(Name = "零件号")] [Display(Name = "厂内物料号")]
[ExporterHeader(DisplayName = "客户物料号")] [ExporterHeader(DisplayName = "厂内物料号")]
public string LU { set; get; } public string LU { set; get; }
/// <summary> /// <summary>
@ -84,10 +84,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public EnumBusinessType BusinessType { get; set; } public EnumBusinessType BusinessType { get; set; }
/// <summary> /// <summary>
/// 替换零件 /// 替换厂内物料
/// </summary> /// </summary>
[Display(Name = "替换零件号")] [Display(Name = "替换厂内物料号")]
[ExporterHeader(DisplayName = "替换客户物料号")] [ExporterHeader(DisplayName = "替换厂内物料号")]
public string RepLU { set; get; } public string RepLU { set; get; }
} }

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

@ -114,14 +114,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
#region 导入数据转换、数据校验 #region 导入数据转换、数据校验
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var importDtos = await _exportImporter.UploadExcelImport<BBAC_SA_DETAIL_IMPORT_DTO>(files, _excelImportService); var importDtos = await _exportImporter.UploadExcelImport<BBAC_SA_DETAIL_IMPORT_DTO>(files, _excelImportService);
var importBBACSaDetails = ObjectMapper.Map<List<BBAC_SA_DETAIL_IMPORT_DTO>, List<BBAC_SA_DETAIL>>(importDtos);
//JisBBAC
var importHBOPDtos = importDtos.FindAll(t => t.PN.Contains("R0") == false);
//买单件BBAC
var importMaiDanJianHBOPDtos = importDtos.FindAll(t => t.PN.Contains("R0"));
var importBBACSaDetails = ObjectMapper.Map<List<BBAC_SA_DETAIL_IMPORT_DTO>, List<BBAC_SA_DETAIL>>(importHBOPDtos);
var importMaiDanJianBBACSaDetails = ObjectMapper.Map<List<BBAC_SA_DETAIL_IMPORT_DTO>, List<PUB_SA_DETAIL>>(importHBOPDtos);
//数据校验 //数据校验
var checkList = new List<ErrorExportDto>(); var checkList = new List<ErrorExportDto>();
@ -139,14 +132,14 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
if (checkList.Count > 0) if (checkList.Count > 0)
{ {
string fileName = await ExportErrorReportAsync(checkList); string fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false);
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName });
} }
#endregion #endregion
if (importBBACSaDetails.Any()) if (importBBACSaDetails.Any())
{ {
await SaDataHandleAsync(importBBACSaDetails, importMaiDanJianBBACSaDetails); await SaDataHandleAsync(importBBACSaDetails).ConfigureAwait(false);
} }
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
@ -286,7 +279,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
/// <summary> /// <summary>
/// 结算数据处理 /// 结算数据处理
/// </summary> /// </summary>
private async Task SaDataHandleAsync(List<BBAC_SA_DETAIL> bbacSaDetails, List<PUB_SA_DETAIL> maiDanJianBBACSaDetails) private async Task SaDataHandleAsync(List<BBAC_SA_DETAIL> bbacSaDetails)
{ {
//结算单号 //结算单号
var bbacSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA"); var bbacSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA");
@ -319,13 +312,13 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
bbacSaDetails.ForEach(bbacSaDetail => bbacSaDetails.ForEach(bbacSaDetail =>
{ {
List<string> luList = bbacSaDetail.LU.Split(" ").ToList(); List<string> partCodes = bbacSaDetail.PartCode.Split(" ").ToList();
bbacSaDetail.LU = luList[0].Replace(" ", ""); bbacSaDetail.PartCode = partCodes[0].Replace(" ", "");
if (luList.Count > 1) if (partCodes.Count > 1)
{ {
luList.RemoveAt(0); partCodes.RemoveAt(0);
var luAssemble = luList.Select(t => t.Replace(" ", "")); var partCodeAssemble = partCodes.Select(t => t.Replace(" ", ""));
bbacSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); bbacSaDetail.PartCode += partCodeAssemble.Aggregate(" ", (current, index) => current + index);
} }
bbacSaDetail.BillNum = bbacSaBillNum; bbacSaDetail.BillNum = bbacSaBillNum;
@ -334,6 +327,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
//根据物料号、结算日期获取价格 //根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.Find(t => t.LU == bbacSaDetail.LU && bbacSaDetail.SettleDate > t.BeginTime && bbacSaDetail.SettleDate < t.EndTime); var priceListEntity = priceListEntitys.Find(t => t.LU == bbacSaDetail.LU && bbacSaDetail.SettleDate > t.BeginTime && bbacSaDetail.SettleDate < t.EndTime);
bbacSaDetail.Price = priceListEntity?.Price ?? default; bbacSaDetail.Price = priceListEntity?.Price ?? default;
bbacSaDetail.IsMaiDan = bbacSaDetail.PN.Contains("R0");
}); });
//导入的零件号集合 //导入的零件号集合
@ -353,6 +347,13 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t, _businessType.ToString()); var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t, _businessType.ToString());
materialRelationships.Add(materialRelationship); materialRelationships.Add(materialRelationship);
}); });
var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships);
bbacSaDetails.ForEach(bbacSaDetail =>
{
bbacSaDetail.LU = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == bbacSaDetail.PartCode)?.ErpMaterialCode ?? bbacSaDetail.PartCode.Replace(" ", "-");
bbacSaDetail.KeyCode = bbacSaDetail.PN + bbacSaDetail.LU;
});
#endregion #endregion
#region 入库数据赋值 #region 入库数据赋值

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

@ -323,20 +323,19 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
hbpoSaDetails.ForEach(hbpoSaDetail => hbpoSaDetails.ForEach(hbpoSaDetail =>
{ {
List<string> luList = hbpoSaDetail.LU.Split(" ").ToList(); List<string> partCodes = hbpoSaDetail.PartCode.Split(" ").ToList();
hbpoSaDetail.LU = luList[0].Replace(" ", ""); hbpoSaDetail.PartCode = partCodes[0].Replace(" ", "");
if (luList.Count > 1) if (partCodes.Count > 1)
{ {
luList.RemoveAt(0); partCodes.RemoveAt(0);
var luAssemble = luList.Select(t => t.Replace(" ", "")); var partCodeAssemble = partCodes.Select(t => t.Replace(" ", ""));
hbpoSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); hbpoSaDetail.PartCode += partCodeAssemble.Aggregate(" ", (current, index) => current + index);
} }
hbpoSaDetail.BillNum = hbpoSaBillNum; hbpoSaDetail.BillNum = hbpoSaBillNum;
hbpoSaDetail.KeyCode = hbpoSaDetail.PN + hbpoSaDetail.LU;
//根据物料号、结算日期获取价格 //根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.Find(t => t.LU == hbpoSaDetail.LU && hbpoSaDetail.SettleDate > t.BeginTime && hbpoSaDetail.SettleDate < t.EndTime); var priceListEntity = priceListEntitys.Find(t => t.LU == hbpoSaDetail.PartCode && hbpoSaDetail.SettleDate > t.BeginTime && hbpoSaDetail.SettleDate < t.EndTime);
hbpoSaDetail.Price = priceListEntity?.Price ?? default; hbpoSaDetail.Price = priceListEntity?.Price ?? default;
hbpoSaDetail.BusinessType = _businessType; hbpoSaDetail.BusinessType = _businessType;
}); });
@ -358,6 +357,13 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t, _businessType.ToString()); var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t, _businessType.ToString());
materialRelationships.Add(materialRelationship); materialRelationships.Add(materialRelationship);
}); });
var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships);
hbpoSaDetails.ForEach(hbpoSaDetail =>
{
hbpoSaDetail.LU = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == hbpoSaDetail.PartCode)?.ErpMaterialCode ?? hbpoSaDetail.PartCode.Replace(" ", "-");
hbpoSaDetail.KeyCode = hbpoSaDetail.PN + hbpoSaDetail.LU;
});
#endregion #endregion
#region 入库数据赋值 #region 入库数据赋值

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

@ -278,158 +278,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
#endregion #endregion
#region 私有方法 #region 私有方法
/// <summary>
/// 导入
/// </summary>
[Obsolete(message: "过时废弃")]
private async Task<string> ImportAsync([FromForm] IFormFileCollection files, EnumBusinessType businessType)
{
//数据校验
var checkList = new List<ErrorExportDto>();
//结算单号
var pubSaBillNum = OrderNumberGenerator.GenerateOrderNumber("SA");
//结算主表
var pubSa = new PUB_SA()
{
BillNum = pubSaBillNum,
State = "1",
BusinessType = businessType
};
//结算明细
var pubSaDetails = new List<PUB_SA_DETAIL>();
//可结算单号
var pubCanSaBillNum = OrderNumberGenerator.GenerateOrderNumber("C");
//可结算主表
var pubCanSa = new PUB_CAN_SA()
{
BillNum = pubCanSaBillNum,
SettleBillNum = pubSaBillNum,
State = SettleBillState.,
BusinessType = businessType
};
//可结算明细
var pubCanSaDetails = new List<PUB_CAN_SA_DETAIL>();
//不可结算明细
var pubNotSaDetails = new List<PUB_NOT_SA_DETAIL>();
//客户零件关系
var materialRelationships = new List<MaterialRelationship>();
#region 导入数据转换、数据校验
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<PUB_SA_DETAIL_IMPORT_DTO>(files, _excelImportService);
var importPubSaDetails = ObjectMapper.Map<List<PUB_SA_DETAIL_IMPORT_DTO>, List<PUB_SA_DETAIL>>(result);
//结算分组号
var pubSaGroupNums = importPubSaDetails.Select(t => t.GroupNum).Distinct();
//已存在的结算分组号
var havPubSaGroupNums = (await _pubSaDetailRepository.GetListAsync(t => pubSaGroupNums.Contains(t.GroupNum))).Select(t => t.GroupNum).Distinct();
if (havPubSaGroupNums.Any() == true)
{
foreach (var item in havPubSaGroupNums)
{
checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, $"结算分组号{item}已存在", string.Empty));
}
//throw new UserFriendlyException($"导入失败,结算分组号({string.Join(",", havPubSaGroupNums)})已存在", "400");
}
if (checkList.Count > 0)
{
return await ExportErrorReportAsync(checkList);
}
#endregion
#region 处理结算数据
//销售价格
var priceListEntitys = await _priceListRepository.GetAllAsync();
importPubSaDetails.ForEach(importPubSaDetail =>
{
List<string> luList = importPubSaDetail.LU.Split(" ").ToList();
importPubSaDetail.LU = luList[0].Replace(" ", "");
if (luList.Count > 1)
{
luList.RemoveAt(0);
var luAssemble = luList.Select(t => t.Replace(" ", ""));
importPubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
}
importPubSaDetail.BillNum = pubSaBillNum;
importPubSaDetail.Site = "XX工厂";
importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU;
//根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate > t.BeginTime && importPubSaDetail.SettleDate < t.EndTime);
importPubSaDetail.Price = priceListEntity?.Price ?? 0;
});
//导入的零件号集合
var importPubSaLUs = importPubSaDetails.Select(t => t.LU).Distinct();
var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode));
var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct();
/*
* ()
*
* 6-
*/
var noExistSettleMaterialCodes = importPubSaLUs.Except(materialRelationshipEntitySettleMaterialCodes);
noExistSettleMaterialCodes.ForEach(t =>
{
var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t, businessType.ToString());
materialRelationships.Add(materialRelationship);
});
#endregion
#region 入库数据赋值
//结算明细
pubSaDetails = importPubSaDetails;
//不可结算 结算分组号码(根据价格区分结算、不可结算)
var pubNotSaGroupNums = importPubSaDetails.FindAll(t => t.Price == default(decimal)).Select(t => t.GroupNum).Distinct();
var pubSaDetailsCanSes = importPubSaDetails.FindAll(t => pubNotSaGroupNums.Contains(t.GroupNum) == false);
var pubSaDetailsNotCanSes = importPubSaDetails.FindAll(t => pubNotSaGroupNums.Contains(t.GroupNum) == true);
//可结算明细
pubCanSaDetails = ObjectMapper.Map<List<PUB_SA_DETAIL>, List<PUB_CAN_SA_DETAIL>>(pubSaDetailsCanSes);
//不可结算明细
pubNotSaDetails = ObjectMapper.Map<List<PUB_SA_DETAIL>, List<PUB_NOT_SA_DETAIL>>(pubSaDetailsNotCanSes);
#endregion
#region 添加入库
await _repository.InsertAsync(pubSa);
await _pubSaDetailRepository.InsertManyAsync(importPubSaDetails);
if (pubCanSaDetails.Count > 0)
{
pubCanSa.InvGroupNum = pubCanSaDetails.Count.ToString();
pubCanSaDetails.ForEach(pubCanSaDetail =>
{
pubCanSaDetail.BillNum = pubCanSaDetail.InvGroupNum = pubCanSaBillNum;
pubCanSaDetail.BusinessType = businessType;
});
await _pubCanSaRepository.InsertAsync(pubCanSa);
await _pubCanSaDetailRepository.InsertManyAsync(pubCanSaDetails);
}
if (pubNotSaDetails.Count > 0)
{
pubNotSaDetails.ForEach(pubNotSaDetail =>
{
pubNotSaDetail.BusinessType = businessType;
});
await _pubNotSaDetailRepository.InsertManyAsync(pubNotSaDetails);
}
if (materialRelationships.Count > 0)
{
await _materialRelationshipRepository.InsertManyAsync(materialRelationships);
}
#endregion
return ApplicationConsts.SuccessStr;
}
/// <summary> /// <summary>
/// 直供件BBAC导入 /// 直供件BBAC导入
/// </summary> /// </summary>
@ -601,28 +449,27 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
pubSaDetails.ForEach(importPubSaDetail => pubSaDetails.ForEach(importPubSaDetail =>
{ {
List<string> luList = importPubSaDetail.LU.Split(" ").ToList(); List<string> partCodes = importPubSaDetail.PartCode.Split(" ").ToList();
importPubSaDetail.LU = luList[0].Replace(" ", ""); importPubSaDetail.PartCode = partCodes[0].Replace(" ", "");
if (luList.Count > 1) if (partCodes.Count > 1)
{ {
luList.RemoveAt(0); partCodes.RemoveAt(0);
var luAssemble = luList.Select(t => t.Replace(" ", "")); var luAssemble = partCodes.Select(t => t.Replace(" ", ""));
importPubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); importPubSaDetail.PartCode += luAssemble.Aggregate(" ", (current, index) => current + index);
} }
importPubSaDetail.Version = _version; importPubSaDetail.Version = _version;
importPubSaDetail.BusinessType = businessType; importPubSaDetail.BusinessType = businessType;
importPubSaDetail.Site = "XX工厂"; importPubSaDetail.Site = "XX工厂";
importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU;
//根据物料号、结算日期获取价格 //根据物料号、结算日期获取价格
var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.LU && importPubSaDetail.SettleDate > t.BeginTime && importPubSaDetail.SettleDate < t.EndTime); var priceListEntity = priceListEntitys.Find(t => t.LU == importPubSaDetail.PartCode && importPubSaDetail.SettleDate > t.BeginTime && importPubSaDetail.SettleDate < t.EndTime);
importPubSaDetail.Price = priceListEntity?.Price ?? 0; importPubSaDetail.Price = priceListEntity?.Price ?? 0;
}); });
//导入的零件号集合 //导入的零件号集合
var importPubSaLUs = pubSaDetails.Select(t => t.LU).Distinct(); var importPubSaPartCodes = pubSaDetails.Select(t => t.PartCode).Distinct();
var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)); var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaPartCodes.Contains(t.SettleMaterialCode));
var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct(); var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct();
/* /*
@ -630,13 +477,20 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
* *
* 6- * 6-
*/ */
var noExistSettleMaterialCodes = importPubSaLUs.Except(materialRelationshipEntitySettleMaterialCodes); var noExistSettleMaterialCodes = importPubSaPartCodes.Except(materialRelationshipEntitySettleMaterialCodes);
noExistSettleMaterialCodes.ForEach(t => noExistSettleMaterialCodes.ForEach(t =>
{ {
var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t, businessType.ToString()); var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t, businessType.ToString());
materialRelationships.Add(materialRelationship); materialRelationships.Add(materialRelationship);
}); });
var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships);
pubSaDetails.ForEach(pubSaDetail =>
{
pubSaDetail.LU = seAllMaterialRelationships.FirstOrDefault(t => t.SettleMaterialCode == pubSaDetail.PartCode)?.ErpMaterialCode ?? pubSaDetail.PartCode.Replace(" ", "-");
pubSaDetail.KeyCode = pubSaDetail.PN + pubSaDetail.LU;
});
#endregion #endregion
#region 添加入库 #region 添加入库

82
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs

@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Coravel.Invocable;
using LinqToDB;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// JisHBPO 发运数据与EDI数据对比
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable
{
private readonly IServiceProvider _serviceProvider;
/// <summary>
/// HBPO发运数据仓储
/// </summary>
private readonly INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> _hbpoSeDetailRepository;
/// <summary>
/// HBPOEDI数据仓储
/// </summary>
private readonly INormalEfCoreRepository<HBPO_SE_EDI, Guid> _hbpoSeEdiRepository;
public JisHBPOSeEdiCompareAppService(
IServiceProvider serviceProvider,
INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> hbpoSeDetailRepository, INormalEfCoreRepository<HBPO_SE_EDI, Guid> hbpoSeEdiRepository)
{
_serviceProvider = serviceProvider;
_hbpoSeDetailRepository = hbpoSeDetailRepository;
_hbpoSeEdiRepository = hbpoSeEdiRepository;
}
/// <summary>
/// 执行
/// </summary>
public async Task Invoke()
{
Debug.WriteLine($"执行了:{this.GetType()}");
using var serviceScope = _serviceProvider.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
//var query = from se in db.Set<HBPO_SE_DETAIL>()
// join edi in db.Set<HBPO_SE_EDI>() on new
// {
// se.LU,
// se.PN,
// se.Qty
// } equals new
// {
// edi.LU,
// edi.PN,
// edi.Qty
// }
// where se.IsHaveEdiData == false && edi.IsHaveSeData == false
// select new
// {
// se,
// edi
// };
var query = db.Set<HBPO_SE_DETAIL>().Join(db.Set<HBPO_SE_EDI>(), a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se, edi }).Where(t => t.se.IsHaveEdiData == false && t.edi.IsHaveSeData == false);
var ses = query.Select(t => t.se);
var edis = query.Select(t => t.edi);
ses.ForEach(t => t.IsHaveEdiData = true);
edis.ForEach(t => t.IsHaveSeData = true);
db.Set<HBPO_SE_DETAIL>().UpdateRange(ses);
db.Set<HBPO_SE_EDI>().UpdateRange(edis);
await db.SaveChangesAsync().ConfigureAwait(false);
Debug.WriteLine($"处理数量:{query.Count()}");
}
}

206
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

@ -30,7 +30,6 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow;
using Volo.Abp.Users; using Volo.Abp.Users;
using Volo.Abp.Validation; using Volo.Abp.Validation;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
@ -49,7 +48,7 @@ public interface IVmiService : IApplicationService, ITransientDependency, IJobSe
Task Out(VmiLogType logType, string changedNumber, VmiLog data); Task Out(VmiLogType logType, string changedNumber, VmiLog data);
Task UnDo(string groupId); //Task UnDo(string groupId);
} }
[AllowAnonymous] [AllowAnonymous]
@ -139,7 +138,7 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
{ {
//this._hubContext.Clients.All.ServerToClient("JobItem", "refresh", ""); //this._hubContext.Clients.All.ServerToClient("JobItem", "refresh", "");
Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/files/vmi")); Directory.CreateDirectory(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/files/vmi"));
var date = DateTime.Now.ToString("yyyyMMddHHmmss"); var date = DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss");
var connectionString = $"Data Source=wwwroot/files/vmi/{date}.db"; var connectionString = $"Data Source=wwwroot/files/vmi/{date}.db";
using var dbContext = new VmiSqliteContext(connectionString); using var dbContext = new VmiSqliteContext(connectionString);
if (!dbContext.GetService<IRelationalDatabaseCreator>().Exists() && dbContext.Database.EnsureCreated()) if (!dbContext.GetService<IRelationalDatabaseCreator>().Exists() && dbContext.Database.EnsureCreated())
@ -312,7 +311,7 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
var log = new VmiLog var log = new VmiLog
{ {
LogType = logType, LogType = logType,
ChangedType = VmiType.In, ChangedType = VmiType.Out,
ChangedNumber = changedNumber, ChangedNumber = changedNumber,
ChangedTime = DateTime.Now, ChangedTime = DateTime.Now,
ChangedBy = _currentUser.UserName, ChangedBy = _currentUser.UserName,
@ -361,41 +360,41 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
}).ConfigureAwait(false); }).ConfigureAwait(false);
} }
/// <summary> ///// <summary>
/// 库存事务回滚 ///// 库存事务回滚
/// </summary> ///// </summary>
[NonAction] //[NonAction]
[UnitOfWork] //[UnitOfWork]
public async Task UnDo(string groupId) //public async Task UnDo(string groupId)
{ //{
var logList = this._logRepository.Where(o => o.GroupId == groupId).AsNoTracking().OrderBy(o => o.ChangedTime); // var logList = this._logRepository.Where(o => o.GroupId == groupId).AsNoTracking().OrderBy(o => o.ChangedTime);
foreach (var item in logList) // foreach (var item in logList)
{ // {
var balance = this._balanceRepository.FirstOrDefault(o => o.BillType == item.BillType && // var balance = this._balanceRepository.FirstOrDefault(o => o.BillType == item.BillType &&
o.PartCode == item.PartCode && // o.PartCode == item.PartCode &&
o.VinCode == item.VinCode && // o.VinCode == item.VinCode &&
o.ErpToLoc == item.ErpToLoc && // o.ErpToLoc == item.ErpToLoc &&
o.OrderNum == item.OrderNum); // o.OrderNum == item.OrderNum);
if (balance == null) // if (balance == null)
{ // {
balance = new VmiBalance(GuidGenerator.Create()); // balance = new VmiBalance(GuidGenerator.Create());
balance.InjectFrom(item); // balance.InjectFrom(item);
await _balanceRepository.InsertAsync(balance).ConfigureAwait(false); // await _balanceRepository.InsertAsync(balance).ConfigureAwait(false);
} // }
else // else
{ // {
balance.Qty += item.ChangedQty; // balance.Qty += item.ChangedQty;
this._balanceRepository.UpdateAsync(balance).Wait(); // this._balanceRepository.UpdateAsync(balance).Wait();
} // }
var log = new VmiLog(); // var log = new VmiLog();
log.InjectFrom(item); // log.InjectFrom(item);
log.LogType = VmiLogType.Type300; // log.LogType = VmiLogType.Type300;
log.ChangedType = VmiType.In; // log.ChangedType = VmiType.In;
log.ChangedTime = DateTime.Now; // log.ChangedTime = DateTime.Now;
log.ChangedBy = _currentUser.UserName; // log.ChangedBy = _currentUser.UserName;
await _logRepository.InsertAsync(log).ConfigureAwait(false); // await _logRepository.InsertAsync(log).ConfigureAwait(false);
} // }
} //}
/// <summary> /// <summary>
/// 库存余额查询 /// 库存余额查询
@ -424,10 +423,18 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
return fileName; return fileName;
} }
[HttpGet] /// <summary>
public void VmiLogInsertTest() /// 补货数据导出
/// </summary>
[HttpPost]
public async Task<string> ReplenishedExportAsync(RequestDto input)
{ {
new InfluxHelper(_cfg).Insert(new VmiLog(GuidGenerator.Create())); var entities = await _logRepository.WhereIf(input.Filters?.Count != 0, input.Filters.ToLambda<VmiLog>())
.ToListAsync().ConfigureAwait(false);
var fileName = $"补货数据_{DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss")}.xlsx";
var content = this.GetContent(entities, "补货数据_");
await _fileContainer.SaveAsync(fileName, content, true).ConfigureAwait(false);
return fileName;
} }
/// <summary> /// <summary>
@ -520,6 +527,31 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
return fileName; return fileName;
} }
/// <summary>
/// 人工调整
/// </summary>
/// <param name="log"></param>
/// <returns></returns>
[HttpPost]
public async Task EditBalance(VmiLog log)
{
if (log.Qty >= decimal.Zero)
{
log.LogType = VmiLogType.Type500;
log.ChangedType = VmiType.In;
var data = new VmiBalance();
data.InjectFrom(log);
await In(VmiLogType.Type500, null, data).ConfigureAwait(false);
}
else
{
log.LogType = VmiLogType.Type600;
log.ChangedType = VmiType.Out;
log.Qty=-log.Qty;
await this.Out(VmiLogType.Type600, null, log).ConfigureAwait(false);
}
}
private byte[] GetContent<TExport>(List<TExport> entities, string name = "sheet1") private byte[] GetContent<TExport>(List<TExport> entities, string name = "sheet1")
{ {
using var workbook = new XLWorkbook(); using var workbook = new XLWorkbook();
@ -590,51 +622,51 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran
} }
} }
private void SetPropertyValue(PropertyInfo property, VmiLog entity, string value) //private void SetPropertyValue(PropertyInfo property, VmiLog entity, string value)
{ //{
try // try
{ // {
object propertyValue = null; // object propertyValue = null;
if (!string.IsNullOrEmpty(value)) // if (!string.IsNullOrEmpty(value))
{ // {
propertyValue = Convert.ChangeType(value, property.PropertyType); // propertyValue = Convert.ChangeType(value, property.PropertyType);
} // }
property.SetValue(entity, propertyValue, null); // property.SetValue(entity, propertyValue, null);
} // }
catch (Exception) // catch (Exception)
{ // {
throw; // throw;
} // }
} //}
private string GetOperator(EnumFilterAction action) //private string GetOperator(EnumFilterAction action)
{ //{
var dictonary = new Dictionary<EnumFilterAction, string>() { // var dictonary = new Dictionary<EnumFilterAction, string>() {
{EnumFilterAction.Equal,"={0}"}, // {EnumFilterAction.Equal,"={0}"},
{EnumFilterAction.NotEqual,"!={0}"}, // {EnumFilterAction.NotEqual,"!={0}"},
{EnumFilterAction.SmallThanOrEqual,"<={0}"}, // {EnumFilterAction.SmallThanOrEqual,"<={0}"},
{EnumFilterAction.Like,"~/{0}/"}, // {EnumFilterAction.Like,"~/{0}/"},
{EnumFilterAction.NotLike,"!~/{0}/"}, // {EnumFilterAction.NotLike,"!~/{0}/"},
{EnumFilterAction.BiggerThan,">{0}"}, // {EnumFilterAction.BiggerThan,">{0}"},
{EnumFilterAction.BiggerThanOrEqual,">={0}"}, // {EnumFilterAction.BiggerThanOrEqual,">={0}"},
{EnumFilterAction.SmallThan,"<{0}"}, // {EnumFilterAction.SmallThan,"<{0}"},
}; // };
return dictonary[action]; // return dictonary[action];
} //}
private object GetValue(PropertyInfo property, string value) //private object GetValue(PropertyInfo property, string value)
{ //{
if (property.PropertyType == typeof(int) || // if (property.PropertyType == typeof(int) ||
property.PropertyType == typeof(long) || // property.PropertyType == typeof(long) ||
property.PropertyType == typeof(float) || // property.PropertyType == typeof(float) ||
property.PropertyType == typeof(double) || // property.PropertyType == typeof(double) ||
property.PropertyType == typeof(decimal) || // property.PropertyType == typeof(decimal) ||
property.PropertyType == typeof(bool)) // property.PropertyType == typeof(bool))
{ // {
return value; // return value;
} // }
return $"'{value}'"; // return $"'{value}'";
} //}
} }
public class BackupListRequest : RequestDto public class BackupListRequest : RequestDto

1
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -1102,7 +1102,6 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum)); .ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<PUB_SA_DETAIL, PUB_SA_DETAIL_EXPORT_DTO>(); CreateMap<PUB_SA_DETAIL, PUB_SA_DETAIL_EXPORT_DTO>();
CreateMap<PUB_SA_DETAIL_IMPORT_DTO, PUB_SA_DETAIL>();
CreateMap<ZhiGongJianBBACImportDto, PUB_SA_DETAIL>(); CreateMap<ZhiGongJianBBACImportDto, PUB_SA_DETAIL>();
CreateMap<ZhiGongJianHBPOImportDto, PUB_SA_DETAIL>(); CreateMap<ZhiGongJianHBPOImportDto, PUB_SA_DETAIL>();
CreateMap<MaiDanJianHBPOImportDto, PUB_SA_DETAIL>(); CreateMap<MaiDanJianHBPOImportDto, PUB_SA_DETAIL>();

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

@ -355,7 +355,7 @@ namespace SettleAccount.Bases
/// </summary> /// </summary>
public virtual DateTime SettleDate { set; get; } public virtual DateTime SettleDate { set; get; }
/// <summary> /// <summary>
/// 零件號 /// 客户物料号
/// </summary> /// </summary>
public virtual string LU { get ; set ; } public virtual string LU { get ; set ; }
/// <summary> /// <summary>
@ -374,7 +374,10 @@ namespace SettleAccount.Bases
/// 結算分組號 /// 結算分組號
/// </summary> /// </summary>
public virtual string GroupNum { get ; set ; } public virtual string GroupNum { get ; set ; }
/// <summary>
/// 厂内物料号
/// </summary>
public virtual string PartCode { get; set; }
} }
public class SA_CAN_BASE : AuditedAggregateRoot<Guid>, ISA_BASE public class SA_CAN_BASE : AuditedAggregateRoot<Guid>, ISA_BASE
@ -534,9 +537,9 @@ namespace SettleAccount.Bases
/// 发运单号 /// 发运单号
/// </summary> /// </summary>
public string WmsBillNum { set; get; } public string WmsBillNum { set; get; }
/// <summary> /// <summary>
/// 零件號 /// 厂内零件号
/// </summary> /// </summary>
public string LU { get; set; } public string LU { get; set; }
/// <summary> /// <summary>
@ -551,7 +554,6 @@ namespace SettleAccount.Bases
/// 數量 /// 數量
/// </summary> /// </summary>
public decimal Qty { get; set; } public decimal Qty { get; set; }
} }
public class PD_BASE : FullAuditedAggregateRoot<Guid>, ISBASE public class PD_BASE : FullAuditedAggregateRoot<Guid>, ISBASE
{ {

8
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs

@ -117,7 +117,7 @@ public class BBAC_CAN_SA_DETAIL: SA_CAN_BASE
public string ContractDocID { get; set; } public string ContractDocID { get; set; }
@ -136,6 +136,12 @@ public class BBAC_CAN_SA_DETAIL: SA_CAN_BASE
//[Display(Name = "发票分组号")] //[Display(Name = "发票分组号")]
//public string InvGroupNum { get; set; } = null!; //public string InvGroupNum { get; set; } = null!;
/// <summary>
/// 是否是买单件
/// </summary>
[Display(Name = "是否是买单件")]
public bool IsMaiDan { get; set; }
public BBAC_CAN_SA_DETAIL() public BBAC_CAN_SA_DETAIL()
{ {

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

@ -87,6 +87,12 @@ public class BBAC_NOT_SA_DETAIL:SA_NOT_BASE
[Display(Name = "合同号")] [Display(Name = "合同号")]
public string ContractDocID { get; set; } public string ContractDocID { get; set; }
/// <summary>
/// 是否是买单件
/// </summary>
[Display(Name = "是否是买单件")]
public bool IsMaiDan { get; set; }
public BBAC_NOT_SA_DETAIL() public BBAC_NOT_SA_DETAIL()
{ {

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SA.cs

@ -126,6 +126,12 @@ public class BBAC_SA_DETAIL:SA_BASE
//[Display(Name = "发票分组号")] //[Display(Name = "发票分组号")]
//public string InvGroupNum { get; set; } = null!; //public string InvGroupNum { get; set; } = null!;
/// <summary>
/// 是否是买单件
/// </summary>
[Display(Name = "是否是买单件")]
public bool IsMaiDan { get; set; }
public BBAC_SA_DETAIL(Guid p_guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, string category, string isReturn, DateTime settleDate, string groupNum, string invGroupNum):base(p_guid) public BBAC_SA_DETAIL(Guid p_guid, string keyCode, int version, string billNum, string lU, string pN, string site, decimal qty, decimal price, string category, string isReturn, DateTime settleDate, string groupNum, string invGroupNum):base(p_guid)
{ {

5386
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230810012032_20230810-1.Designer.cs

File diff suppressed because it is too large

64
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230810012032_20230810-1.cs

@ -0,0 +1,64 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308101 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("6c0cbeb6-6530-4ede-ac96-d0f294f76086"));
migrationBuilder.AddColumn<string>(
name: "PartCode",
table: "Set_PUB_SA_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "PartCode",
table: "Set_HBPO_SA_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "PartCode",
table: "Set_BBAC_SA_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" },
values: new object[] { new Guid("ce5291a6-b9d4-48b4-9c6d-4ce09ed4cbf9"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "3f981885343b41278337f1b6de40088b", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("ce5291a6-b9d4-48b4-9c6d-4ce09ed4cbf9"));
migrationBuilder.DropColumn(
name: "PartCode",
table: "Set_PUB_SA_DETAIL");
migrationBuilder.DropColumn(
name: "PartCode",
table: "Set_HBPO_SA_DETAIL");
migrationBuilder.DropColumn(
name: "PartCode",
table: "Set_BBAC_SA_DETAIL");
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" },
values: new object[] { new Guid("6c0cbeb6-6530-4ede-ac96-d0f294f76086"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "4d0aea6c7eb24ecf908624ef4ffc315a", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null });
}
}
}

5395
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230810025021_20230810-2.Designer.cs

File diff suppressed because it is too large

67
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230810025021_20230810-2.cs

@ -0,0 +1,67 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308102 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("ce5291a6-b9d4-48b4-9c6d-4ce09ed4cbf9"));
migrationBuilder.AddColumn<bool>(
name: "IsMaiDan",
table: "Set_BBAC_SA_DETAIL",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsMaiDan",
table: "Set_BBAC_NOT_SA_DETAIL",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsMaiDan",
table: "Set_BBAC_CAN_SA_DETAIL",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" },
values: new object[] { new Guid("96b1beec-0eef-4ae5-880b-23678addb759"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "ebf2d34687e14358a9d63dbe3df7abd3", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("96b1beec-0eef-4ae5-880b-23678addb759"));
migrationBuilder.DropColumn(
name: "IsMaiDan",
table: "Set_BBAC_SA_DETAIL");
migrationBuilder.DropColumn(
name: "IsMaiDan",
table: "Set_BBAC_NOT_SA_DETAIL");
migrationBuilder.DropColumn(
name: "IsMaiDan",
table: "Set_BBAC_CAN_SA_DETAIL");
migrationBuilder.InsertData(
table: "Set_VmiBalance",
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" },
values: new object[] { new Guid("ce5291a6-b9d4-48b4-9c6d-4ce09ed4cbf9"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "3f981885343b41278337f1b6de40088b", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null });
}
}
}

22
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -128,6 +128,9 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("InvbillNum") b.Property<string>("InvbillNum")
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<bool>("IsMaiDan")
.HasColumnType("bit");
b.Property<bool>("IsReturn") b.Property<bool>("IsReturn")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("bit"); .HasColumnType("bit");
@ -218,6 +221,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<bool>("IsMaiDan")
.HasColumnType("bit");
b.Property<bool>("IsReturn") b.Property<bool>("IsReturn")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("bit"); .HasColumnType("bit");
@ -545,6 +551,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<bool>("IsMaiDan")
.HasColumnType("bit");
b.Property<string>("IsReturn") b.Property<string>("IsReturn")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
@ -569,6 +578,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<string>("PartCode")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price") b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
@ -1704,6 +1716,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<string>("PartCode")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price") b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
@ -3342,6 +3357,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<string>("PartCode")
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price") b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
@ -4366,10 +4384,10 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasData( b.HasData(
new new
{ {
Id = new Guid("6c0cbeb6-6530-4ede-ac96-d0f294f76086"), Id = new Guid("96b1beec-0eef-4ae5-880b-23678addb759"),
BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
BillType = 1, BillType = 1,
ConcurrencyStamp = "4d0aea6c7eb24ecf908624ef4ffc315a", ConcurrencyStamp = "ebf2d34687e14358a9d63dbe3df7abd3",
DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
ErpToLoc = "ErpToLoc", ErpToLoc = "ErpToLoc",
OrderNum = "OrderNum", OrderNum = "OrderNum",

Loading…
Cancel
Save