wanggang 1 year ago
parent
commit
658e433361
  1. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs
  2. 105
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs
  3. 65
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  4. 299
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  5. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
  6. 295
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  7. 295
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  8. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  9. 32
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs
  10. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs
  11. 29
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs
  12. 46
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs
  13. 73
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs
  14. 23
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  15. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs
  16. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongBBACSeSyncAppService.cs
  17. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs
  18. 21
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  19. 199
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs
  20. 201
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_DETAIL.cs
  21. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs
  22. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs
  23. 32
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  24. 1284
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs
  25. 43
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/MaterialRelationshipManager.cs
  26. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_CAN_SA_MNG.cs
  27. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIS_RECORD.cs
  28. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs
  29. 23
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs
  30. 5503
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815054853_20230815-3.Designer.cs
  31. 368
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815054853_20230815-3.cs
  32. 98
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

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

@ -83,8 +83,6 @@ public class PUB_ADJ_DETAIL_IMP_DTO
[ImporterHeader(Name = "厂内零件号")]
public string PartCode { get; set; }
[ImporterHeader(Name = "标识号")]
public string PN { get; set; }
[ImporterHeader(Name = "数量")]

105
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs

@ -21,6 +21,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Bases;
@ -34,6 +35,7 @@ public class ADJ_SERVICE : BASE_SERVICE
protected readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _repository;
protected readonly BaseDomainService _baseDomainService;
protected readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _invRepository;
protected readonly INormalEfCoreRepository<MaterialRelationship, Guid> _relRepository;
public ADJ_SERVICE(
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> repository,
@ -41,11 +43,13 @@ public class ADJ_SERVICE : BASE_SERVICE
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager,
INormalEfCoreRepository<INVOICE_GRP, Guid> invRepository
INormalEfCoreRepository<INVOICE_GRP, Guid> invRepository,
INormalEfCoreRepository<MaterialRelationship, Guid> relRepository
)
: base(excelImportService, snowflakeIdGenerator, commonManager)
{
_relRepository = relRepository;
_invRepository = invRepository;
_repository = repository;
_baseDomainService = baseDomainService;
@ -64,6 +68,7 @@ public class ADJ_SERVICE : BASE_SERVICE
var dtos = ObjectMapper.Map<List<PUB_ADJ_DETAIL>, List<PUB_ADJ_DETAIL_DTO>>(entitys);
return new PagedResultDto<PUB_ADJ_DETAIL_DTO>(totalCount, dtos);
}
/// <summary>
/// 导入文件
/// </summary>
@ -81,6 +86,7 @@ public class ADJ_SERVICE : BASE_SERVICE
{
throw new BusinessException("8989", "导入数据记录为0条");
}
var relation = _relRepository.ToList();
var invs = result.Select(p => p.OldInvBillNum).ToList();//所有发票号
var deletels = _repository.Where(p => invs.Contains(p.OldInvBillNum)).ToList();//所有关联发票号的调整表
var invlist = _invRepository.Where(p => invs.Contains(p.InvbillNum)).ToList();//所有发票
@ -113,12 +119,13 @@ public class ADJ_SERVICE : BASE_SERVICE
var query = from itm in entityList
join itm1 in invlist
on itm.InvBillNum equals itm1.InvbillNum
join itm2 in relation on itm.LU equals itm2.SettleMaterialCode
select new PUB_ADJ_DETAIL(
id: GuidGenerator.Create(),
keyCode: itm.PN + itm.LU,
version: itm.Version,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
lU: itm2.ErpMaterialCode,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
@ -133,10 +140,104 @@ public class ADJ_SERVICE : BASE_SERVICE
partcode: itm.PartCode
);
await _repository.DbContext.BulkDeleteAsync(deletels);//删除发票下所有调整明细
await _repository.DbContext.BulkInsertAsync(query.ToList());
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 导入文件
/// </summary>
/// <param name="files"></param>
/// <returns></returns>
/// <exception cref="BusinessException"></exception>
[HttpPost]
[DisableRequestSizeLimit]
public async Task<string> CheckImport(List<PUB_ADJ_DETAIL_DTO> p_list)
{
List<ERR_EXP_DTO> errorList = new List<ERR_EXP_DTO>();
//ExportImporter _exportImporter = new ExportImporter();
//var result = await _exportImporter.UploadExcelImport<PUB_ADJ_DETAIL_IMP_DTO>(files, _excelImportService);
//if (result.Count == 0)
//{
// throw new BusinessException("8989", "导入数据记录为0条");
//}
// var invs= p_list.Select(p => p.InvBillNum).ToList();//所有发票号
//var deletels = _repository.Where(p =>invs.Contains(p.OldInvBillNum) ).ToList();//所有关联发票号的调整表
// var invlist= _invRepository.Where(p => invs.Contains(p.InvbillNum)).ToList();//所有旧发票
// var dlists= deletels.Where(p=>string.IsNullOrEmpty(p.InvBillNum)).ToList();//所有新发票号不为空的调整记录
//foreach (var itm in dlists)
//{
// errorList.Add(new ERR_EXP_DTO() { ItemCode = $"{itm.LU}", Message = $"客户零件号{itm.LU}标识号{itm.PN}下线日期{itm.SettleDate}记录已经被重新开票,新发票号为:{itm.InvBillNum}" });
//}
//var first = deletels.FirstOrDefault();
//if (!string.IsNullOrEmpty(first.InvBillNum))
//{
// throw new BusinessException("8989", $"调整记录已经生成新发票号:{first.InvBillNum}");
//}
var entityList = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
var codelist = entityList.Select(p => p.LU).ToList();
var errors = await _baseDomainService.CheckBase(codelist, new BASE_CONF() { IsRelationShip = true });
foreach (var itm in errors)
{
errorList.Add(
new ERR_EXP_DTO() { ItemCode = $"{itm}", Message = $"[客户零件关系表]不存在客户零件号{itm}" });
}
var errorEntitylist = await _baseDomainService.CheckPriceList(entityList);
if (errorEntitylist.Count > 0)
{
foreach (var itm in errorEntitylist)
{
errorList.Add(new ERR_EXP_DTO() { ItemCode = $"{itm.LU}", Message = $"客户零件号{itm.LU}标识号{itm.PN}下线日期{itm.SettleDate}不存在价格单记录" });
}
}
if (errorList.Count > 0)
{
return await ExportErrorReportAsync(errorList);
}
//var query = from itm in entityList
// join itm1 in invlist
// on itm.InvBillNum equals itm1.InvbillNum
// select new PUB_ADJ_DETAIL(
// id: GuidGenerator.Create(),
// keyCode: itm.PN + itm.LU,
// version: itm.Version,
// settleBillNum: itm.SettleBillNum,
// lU: itm.LU,
// pN: itm.PN,
// site: itm.Site,
// qty: itm.Qty,
// extend1: string.Empty,
// price: 0,
// invGroupNum: itm1.InvGroupNum,
// settleDate: itm.SettleDate,
// businessType: itm1.BusinessType,
// groupNum: itm.GroupNum,
// oldinv: itm.InvBillNum,
// inv: string.Empty,
// partcode:itm.PartCode
// );
//await _repository.DbContext.BulkDeleteAsync(deletels);//删除发票下所有调整明细
//await _repository.DbContext.BulkInsertAsync(query.ToList());
return ApplicationConsts.SuccessStr;
}
}

65
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs

@ -322,6 +322,71 @@ namespace Win.Sfs.SettleAccount.Bases
throw new BusinessException("8989", "生成失败,请检查调整表和旧发票内容");
}
/// <summary>
/// hbpo、jit、备件等
/// </summary>
/// <param name="dtos">可结算明细列表</param>
/// <param name="p_version">版本号</param>
/// <param name="p_InvGroupNum">发票分组</param>
/// <param name="p_parentInvBillNum">原发票号</param>
protected async Task<List<INVOICE_WAIT_DETAIL>> ReissueSecInvoiceExtend<TDetail>(List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> p_tmplist, int p_version, string p_parentInvBillNum) where TDetail : SA_CAN_BASE
{
var ls = await _invMng.ReissueSecInvoiceExtend(p_list, p_adjlist, p_tmplist, p_parentInvBillNum, p_version);
if (ls.Count>0)
{
return ls;
}
throw new BusinessException("8989", "生成失败,请检查调发票整表和旧发票内容");
}
/// <summary>
/// 第一次开票
/// </summary>
/// <param name="dtos"></param>
/// <param name="p_notlist"></param>
/// <param name="p_version"></param>
/// <param name="p_InvGroupNum"></param>
/// <param name="p_parentInvBillNum">要作废的发票号</param>
/// <param name="businessType"></param>
/// <returns></returns>
protected async Task<List<INVOICE_WAIT_DETAIL>> ReissueFirstInvoiceExtend<TDetail>(List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_parentInvBillNum) where TDetail : SA_CAN_BASE
{
var ls = await _invMng.ReissueFirstInvoiceExtend(p_list, p_adjlist, dtos, p_parentInvBillNum, p_version);
if (ls.Count>0)
{
return ls;
}
throw new BusinessException("8989", "生成失败,请检查调整表和旧发票内容");
}
/// <summary>
/// 校验规则

299
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs

@ -1,4 +1,5 @@
using DocumentFormat.OpenXml.Spreadsheet;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@ -12,6 +13,7 @@ using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.ObjectMapping;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
@ -65,18 +67,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <returns></returns>
public override async Task<string> ReissueInvoice(string p_invbillnum)
{
var mappingList= await GetMapGroupAsync(p_invbillnum);//发票对应结算分组
if (mappingList != null && mappingList.Count() > 0)
{
//var mappingList= await GetMapGroupAsync(p_invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(p_invbillnum);
var settle = await _bbacMng.GetMainAsync(inv.InvGroupNum);
if (settle == null)
{
throw new BusinessException("8989", $"选择发票:{p_invbillnum}对应的可结算单不在请检查!");
throw new UserFriendlyException($"选择发票:{p_invbillnum}对应的可结算单不在请检查!");
}
version = settle.Version;
@ -84,9 +87,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态为报废状态不能重开!");
throw new UserFriendlyException($"选择发票:{p_invbillnum}状态为报废状态不能重开!");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new UserFriendlyException($"选择发票:{p_invbillnum}状态在财务审核后可以报废重开,之前不能重开可以退回!");
}
var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum, gList);//结算分组对应结算零件
var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
@ -165,14 +173,287 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
else
{
throw new BusinessException("8989", $"不存发票号为:{p_invbillnum}发票");
throw new UserFriendlyException($"不存发票号为:{p_invbillnum}发票");
}
//}
//else
//{
// throw new UserFriendlyException( $"不存发票号:{p_invbillnum}对应的结算分组号");
//}
return ApplicationConsts.SuccessStr;
}
[HttpPost]
/// <summary>
/// 发票重开
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public virtual async Task<string> ReissueInvoiceExtend(List<PUB_ADJ_DETAIL_DTO> p_list)
{
var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count == 0)
{
throw new UserFriendlyException($"调整表无数据!");
}
var first = p_list.FirstOrDefault();
var invbillnum = first.InvBillNum;
//var mappingList= await GetMapGroupAsync(p_invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version=int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv= await GetInvoiceGroupByInvBillNum(invbillnum);
var settle =await _bbacMng.GetMainAsync(inv.InvGroupNum);
if(settle==null)
{
throw new UserFriendlyException( $"选择发票:{invbillnum}对应的可结算单不在请检查!");
}
version=settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new UserFriendlyException( $"选择发票:{invbillnum}状态为报废状态不能重开!");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new UserFriendlyException( $"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前不能重开可以退回!");
}
var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
// var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
bbaclist.Add(new BBAC_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
category: itm.BusinessType,
isReturn: itm.Qty > 0 ? false : true,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum:string.Empty,
partcode:itm.PartCode
));
}
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单
var errorList =await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
if (errorList.Count() > 0)
{
return await ExportErrorReportAsync(errorList);
}
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号
select new TEMP_CAN_SA_DETAIL
{
Id=d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = d.ContractDocID,
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode= d.PartCode
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
await ReissueFirstInvoice(bbaclist,adjlist,dtos,version, invbillnum);
}
else//二次开票
{
await ReissueSecInvoice(bbaclist,adjlist,dtos,version, invbillnum);
}
}
}
else
{
throw new BusinessException("8989", $"不存发票号:{p_invbillnum}对应的结算分组号");
throw new UserFriendlyException( $"不存发票号为:{invbillnum}发票");
}
//}
//else
//{
// throw new UserFriendlyException( $"不存发票号:{p_invbillnum}对应的结算分组号");
//}
return ApplicationConsts.SuccessStr;
}
[HttpPost]
/// <summary>
/// 发票重开列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public virtual async Task<List<INVOICE_WAIT_DETAIL_DTO>> ReissueInvoiceList(List<PUB_ADJ_DETAIL_DTO> p_list)
{
List<INVOICE_WAIT_DETAIL_DTO> ls = new List<INVOICE_WAIT_DETAIL_DTO>();
var adjlist=ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count==0)
{
throw new UserFriendlyException($"调整表无数据!");
}
var first = p_list.FirstOrDefault();
var invbillnum = first.InvBillNum;
//var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
var settle = await _bbacMng.GetMainAsync(inv.InvGroupNum);
if (settle == null)
{
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!");
}
version = settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!");
}
var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
bbaclist.Add(new BBAC_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
category: itm.BusinessType,
isReturn: itm.Qty > 0 ? false : true,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum: string.Empty,
partcode: itm.PartCode
));
}
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var priceList = _priceRepository.ToList();//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
//{
// return await ExportErrorReportAsync(errorList);
//}
var dto1s = ObjectMapper.Map<List<BBAC_CAN_SA_DETAIL>, List<BBAC_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号
select new TEMP_CAN_SA_DETAIL
{
Id = d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = d.ContractDocID,
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
var entities=await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
ls= ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
}
else//二次开票
{
var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
ls=ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
}
}
}
else
{
throw new UserFriendlyException($"不存发票号为:{invbillnum}发票");
}
//}
//else
//{
// throw new UserFriendlyException($"不存发票号:{p_invbillnum}对应的结算分组号");
//}
return ls;
}
}
}

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

@ -159,7 +159,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
else
{
throw new BusinessException("8989", string.Format("{0}不存在该可结算单号", input.BillNum));
throw new UserFriendlyException(string.Format("{0}不存在该可结算单号", input.BillNum));
}
return ApplicationConsts.SuccessStr;
}

295
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs

@ -56,25 +56,29 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <returns></returns>
public override async Task<string> ReissueInvoice(string p_invbillnum)
{
var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组
if (mappingList != null && mappingList.Count() > 0)
{
//var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(p_invbillnum);
var settle = await _hbpoMng.GetMainAsync(inv.InvGroupNum);
if (settle == null)
{
throw new BusinessException("8989", $"选择发票:{p_invbillnum}对应的可结算单不在请检查!");
throw new UserFriendlyException( $"选择发票:{p_invbillnum}对应的可结算单不在请检查!");
}
version = settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态为报废状态不能重开!");
throw new UserFriendlyException( $"选择发票:{p_invbillnum}状态为报废状态不能重开!");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new UserFriendlyException( $"选择发票:{p_invbillnum}状态在财务审核后可以报废重开,之前请退回重开!");
}
var hbpolist = await _hbpoMng.GetContainsAsync(inv.InvbillNum, gList);//结算分组对应结算零件
var hbpolist = await _hbpoMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
@ -150,15 +154,288 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
else
{
throw new BusinessException("8989", $"不存发票号为:{p_invbillnum}发票");
throw new UserFriendlyException( $"不存发票号为:{p_invbillnum}发票");
}
//}
//else
//{
// throw new UserFriendlyException( $"不存发票号:{p_invbillnum}对应的结算分组号");
//}
return ApplicationConsts.SuccessStr;
}
[HttpPost]
/// <summary>
/// 发票重开
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public virtual async Task<string> ReissueInvoiceExtend(List<PUB_ADJ_DETAIL_DTO> p_list)
{
var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count == 0)
{
throw new UserFriendlyException($"调整表无数据!");
}
var first = p_list.FirstOrDefault();
var invbillnum = first.InvBillNum;
//var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
var settle = await _hbpoMng.GetMainAsync(inv.InvGroupNum);
if (settle == null)
{
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不存在请检查!");
}
version = settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!");
}
var hbpolist = await _hbpoMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
// var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
foreach (var itm in adjlist)
{
hbpolist.Add(new HBPO_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode
));
}
}
var entitys = hbpolist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
if (errorList.Count() > 0)
{
return await ExportErrorReportAsync(errorList);
}
// var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in entitys
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
select new TEMP_CAN_SA_DETAIL
{
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
// MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = "n",
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
await ReissueFirstInvoice(hbpolist, adjlist, dtos, version, invbillnum);
}
else//二次开票
{
await ReissueSecInvoice(hbpolist, adjlist, dtos, version, invbillnum);
}
}
}
else
{
throw new BusinessException("8989", $"不存发票号:{p_invbillnum}对应的结算分组号");
throw new UserFriendlyException($"不存发票号为:{invbillnum}发票");
}
//}
//else
//{
// throw new UserFriendlyException( $"不存发票号:{p_invbillnum}对应的结算分组号");
//}
return ApplicationConsts.SuccessStr;
}
[HttpPost]
/// 发票重开列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public virtual async Task<List<INVOICE_WAIT_DETAIL_DTO>> ReissueInvoiceList( List<PUB_ADJ_DETAIL_DTO> p_list)
{
List<INVOICE_WAIT_DETAIL_DTO> ls = new List<INVOICE_WAIT_DETAIL_DTO>();
var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count == 0)
{
throw new UserFriendlyException($"调整表无数据!");
}
var first = p_list.FirstOrDefault();
var invbillnum = first.InvBillNum;
//var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
var settle = await _hbpoMng.GetMainAsync(inv.InvGroupNum);
if (settle == null)
{
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!");
}
version = settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!");
}
var bbaclist = await _hbpoMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
bbaclist.Add(new HBPO_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode
));
}
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var priceList = _priceRepository.ToList();//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
//{
// return await ExportErrorReportAsync(errorList);
//}
var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号
select new TEMP_CAN_SA_DETAIL
{
Id = d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = "N",
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
}
else//二次开票
{
var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
}
}
}
else
{
throw new UserFriendlyException($"不存发票号为:{invbillnum}发票");
}
//}
//else
//{
// throw new UserFriendlyException($"不存发票号:{invbillnum}对应的结算分组号");
//}
return ls;
}
}
}

295
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs

@ -15,6 +15,7 @@ using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices;
@ -43,6 +44,138 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
/// <summary>
/// 提交发票
/// </summary>
/// <param name="p_list"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
/// <exception cref="BusinessException"></exception>
[HttpPost]
public virtual async Task<string> ReissueInvoiceExtend(List<PUB_ADJ_DETAIL_DTO> p_list)
{
var first = p_list.FirstOrDefault();
var invbillnum = first.InvBillNum;
List<INVOICE_WAIT_DETAIL_DTO> ls = new List<INVOICE_WAIT_DETAIL_DTO>();
var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count == 0)
{
throw new UserFriendlyException($"调整表无数据!");
}
//var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
var settle = await _pubMng.GetMainAsync(inv.InvGroupNum);
if (settle == null)
{
throw new BusinessException("8989", $"选择发票:{invbillnum}对应的可结算单不在请检查!");
}
version = settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new BusinessException("8989", $"选择发票:{invbillnum}状态为报废状态不能重开!");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new BusinessException("8989", $"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前不能重开可以退回!");
}
var publist = await _pubMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
publist.Add(new PUB_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode
));
}
}
var entitys = publist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
var priceList = _priceRepository.ToList();//价格单
var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
if (errorList.Count > 0)
{
return await ExportErrorReportAsync(errorList);
}
// var dto1s = ObjectMapper.Map<List<HBPO_CAN_SA_DETAIL>, List<HBPO_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in entitys
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
select new TEMP_CAN_SA_DETAIL
{
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
// MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = "n",
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
await ReissueFirstInvoice(publist, adjlist, dtos, version, invbillnum);
}
else//二次开票
{
await ReissueSecInvoice(publist, adjlist, dtos, version, invbillnum);
}
}
}
else
{
throw new BusinessException("8989", $"不存发票号为:{invbillnum}发票");
}
//}
//else
//{
// throw new BusinessException("8989", $"不存发票号:{p_invbillnum}对应的结算分组号");
//}
return ApplicationConsts.SuccessStr;
}
@ -55,11 +188,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public override async Task<string> ReissueInvoice(string p_invbillnum)
{
var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组
if (mappingList != null && mappingList.Count() > 0)
{
//var mappingList = await GetMapGroupAsync(p_invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(p_invbillnum);
var settle = await _pubMng.GetMainAsync(inv.InvGroupNum);
@ -75,7 +208,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态为报废状态不能重开!");
}
var publist = await _pubMng.GetContainsAsync(inv.InvbillNum, gList);//结算分组对应结算零件
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态在财务审核后可以报废重开,之前不能重开可以退回!");
}
var publist = await _pubMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
@ -156,12 +293,156 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
throw new BusinessException("8989", $"不存发票号为:{p_invbillnum}发票");
}
//}
//else
//{
// throw new BusinessException("8989", $"不存发票号:{p_invbillnum}对应的结算分组号");
//}
return ApplicationConsts.SuccessStr;
}
[HttpPost]
/// 发票重开列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public virtual async Task<List<INVOICE_WAIT_DETAIL_DTO>> ReissueInvoiceList(List<PUB_ADJ_DETAIL_DTO> p_list)
{
var first=p_list.FirstOrDefault();
var invbillnum=first.InvBillNum;
List<INVOICE_WAIT_DETAIL_DTO> ls = new List<INVOICE_WAIT_DETAIL_DTO>();
var adjlist = ObjectMapper.Map<List<PUB_ADJ_DETAIL_DTO>, List<PUB_ADJ_DETAIL>>(p_list);
if (adjlist == null && adjlist.Count == 0)
{
throw new UserFriendlyException($"调整表无数据!");
}
//var mappingList = await GetMapGroupAsync(invbillnum);//发票对应结算分组
//if (mappingList != null && mappingList.Count() > 0)
//{
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(invbillnum);
var settle = await _pubMng.GetMainAsync(inv.InvGroupNum);
if (settle == null)
{
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!");
}
version = settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态为报废状态不能重开!");
}
if (inv.State == SettleBillState. || inv.State == SettleBillState.)
{
throw new UserFriendlyException($"选择发票:{invbillnum}状态在财务审核后可以报废重开,之前请退回重开!");
}
var bbaclist = await _pubMng.GetContainsAsync(inv.InvbillNum);//结算分组对应结算零件
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0)
{
foreach (var itm in adjlist)
{
bbaclist.Add(new PUB_CAN_SA_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.InvGroupNum,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: itm.PartCode
));
}
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var priceList = _priceRepository.ToList();//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
//{
// return await ExportErrorReportAsync(errorList);
//}
var dto1s = ObjectMapper.Map<List<PUB_CAN_SA_DETAIL>, List<PUB_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime//客户零件号
select new TEMP_CAN_SA_DETAIL
{
Id = d.Id,
SettleBillNum = d.SettleBillNum,
Site = d.Site,
Version = d.Version,
Price = p.Price,
BillNum = d.BillNum,
SettleDate = d.SettleDate,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
MaterialDesc = d.MaterialDesc,
PN = d.PN,
Qty = d.Qty,
GroupNum = d.GroupNum,
Amt = Math.Round(d.Qty * p.Price, 2),
ContractDocID = "N",
BeginDate = p.BeginTime,
EndDate = p.EndTime,
PartCode = d.PartCode
};
var dtos = q.ToList();
if (dtos != null && dtos.Count > 0)
{
if (invbillnum.Substring(0, 3) == "INV")//一次开票重开
{
var entities = await ReissueFirstInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
}
else//二次开票
{
var entities = await ReissueSecInvoiceExtend(bbaclist, adjlist, dtos, version, invbillnum);
ls = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(entities);
}
}
}
else
{
throw new BusinessException("8989", $"不存发票号:{p_invbillnum}对应的结算分组号");
throw new UserFriendlyException($"不存发票号为:{invbillnum}发票");
}
return ApplicationConsts.SuccessStr;
//}
//else
//{
// throw new UserFriendlyException($"不存发票号:{invbillnum}对应的结算分组号");
//}
return ls;
}
}
}

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

@ -155,7 +155,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
[HttpPost]
public async Task<PagedResultDto<PUB_SA_DTO>> GetListAsync(PUB_SARequestDto input)
{
input.Filters.Add(new FilterCondition("BusinessType", input.BusinessType.ToString(), EnumFilterAction.Equal, EnumFilterLogic.And));
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
var dtos = ObjectMapper.Map<List<PUB_SA>, List<PUB_SA_DTO>>(entities);

32
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BBACSeSyncAppService.cs

@ -8,8 +8,10 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -36,17 +38,30 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService
/// </summary>
private readonly INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> _bbacSeDetailRepository;
/// <summary>
/// 客户零件关系领域
/// </summary>
private readonly MaterialRelationshipManager _materialRelationshipManager;
/// <summary>
/// 客户零件关系集合
/// </summary>
private List<MaterialRelationship> _addMaterialRelationships;
/// <summary>
/// 构造
/// </summary>
public BBACSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> bbacSeDetailRepository)
INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> bbacSeDetailRepository,
MaterialRelationshipManager materialRelationshipManager)
{
_wmsBJBMPTContext = wmsBJBMPTContext;
_syncPositionFlagRepository = syncPositionFlagRepository;
_bbacSeDetailRepository = bbacSeDetailRepository;
_materialRelationshipManager = materialRelationshipManager;
_addMaterialRelationships = new List<MaterialRelationship>();
}
[ApiExplorerSettings(IgnoreApi = true)]
@ -60,6 +75,11 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService
{
await SyncJitRecordAsync();
await SyncJisRecordAsync();
if (_addMaterialRelationships.Any())
{
_addMaterialRelationships = _addMaterialRelationships.GroupBy(t => new { t.ErpMaterialCode }).Select(t => t.First()).ToList();
await _materialRelationshipManager.AddNewMaterialRelationships(_addMaterialRelationships).ConfigureAwait(false);
}
}
/// <summary>
@ -73,7 +93,7 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService
var EnumDeliverSubBillTypes = GetDeliverSubBillTypes();
Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> predicate = (t) => t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType);
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName);
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false);
if (syncPositionFlag != null)
{
predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == EnumDeliverBjBmpBillType.JIS件 && EnumDeliverSubBillTypes.Contains(t.DeliverSubBillType);
@ -85,6 +105,10 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService
var bbacSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords);
if (bbacSeDetails.Any())
{
//客户零件号和厂内零件号
var materialRelationships = bbacSeDetails.GroupBy(t => new { t.LU, t.PartCode }).Select(t => new MaterialRelationship(GuidGenerator.Create(), t.Key.LU, "", t.Key.PartCode, ""));
_addMaterialRelationships.AddRange(materialRelationships);
bbacSeDetails.ForEach(bbacSeDetail =>
{
bbacSeDetail.KeyCode = bbacSeDetail.PN + bbacSeDetail.LU;
@ -131,6 +155,10 @@ public class BBACSeSyncAppService : ApplicationService, IInvocable, IJobService
var bbacSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<BBAC_SE_DETAIL>>(wmsRecords);
if (bbacSeDetails.Any())
{
//客户零件号和厂内零件号
var materialRelationships = bbacSeDetails.GroupBy(t => new { t.LU, t.PartCode }).Select(t => new MaterialRelationship(GuidGenerator.Create(), t.Key.LU, "", t.Key.PartCode, ""));
_addMaterialRelationships.AddRange(materialRelationships);
bbacSeDetails.ForEach(bbacSeDetail => bbacSeDetail.KeyCode = bbacSeDetail.PN + bbacSeDetail.LU);
await _bbacSeDetailRepository.InsertManyAsync(bbacSeDetails);

5
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs

@ -4,8 +4,10 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -24,8 +26,9 @@ public class BeiSeSyncAppService : JitSeSyncAppService, IJobService
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
MaterialRelationshipManager materialRelationshipManager,
VmiAppService vmiService
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, vmiService)
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, materialRelationshipManager, vmiService)
{
base.SeSyncConfigInfo = new SeSyncConfig()
{

29
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HBPOSeSyncAppService.cs

@ -9,8 +9,10 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -42,6 +44,16 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService
/// </summary>
private readonly INormalEfCoreRepository<PUB_SE_DETAIL, Guid> _pubSeDetailRepository;
/// <summary>
/// 客户零件关系领域
/// </summary>
private readonly MaterialRelationshipManager _materialRelationshipManager;
/// <summary>
/// 客户零件关系集合
/// </summary>
private List<MaterialRelationship> _addMaterialRelationships;
/// <summary>
/// 构造
/// </summary>
@ -49,12 +61,15 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> hbpoSeDetailRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository)
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
MaterialRelationshipManager materialRelationshipManager)
{
_wmsBJBMPTContext = wmsBJBMPTContext;
_syncPositionFlagRepository = syncPositionFlagRepository;
_hbpoSeDetailRepository = hbpoSeDetailRepository;
_pubSeDetailRepository = pubSeDetailRepository;
_materialRelationshipManager = materialRelationshipManager;
_addMaterialRelationships = new List<MaterialRelationship>();
}
[ApiExplorerSettings(IgnoreApi = true)]
@ -71,6 +86,11 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService
{
await SyncJitRecordAsync().ConfigureAwait(false);
await SyncJisRecordAsync().ConfigureAwait(false);
if (_addMaterialRelationships.Any())
{
_addMaterialRelationships = _addMaterialRelationships.GroupBy(t => new { t.ErpMaterialCode }).Select(t => t.First()).ToList();
await _materialRelationshipManager.AddNewMaterialRelationships(_addMaterialRelationships).ConfigureAwait(false);
}
}
/// <summary>
@ -186,6 +206,13 @@ public class HBPOSeSyncAppService : ApplicationService, IInvocable, IJobService
/// </summary>
private async Task SaveSeDataAsync(List<HBPO_SE_DETAIL> hbpoSeDetails, List<PUB_SE_DETAIL> maiDanHBPOSeDetails)
{
//客户零件号和厂内零件号
var hbpoSeLuRePartCodes = hbpoSeDetails.Select(t => new { t.LU, t.PartCode });
var maiDanHBPOSeLuRePartCodes = maiDanHBPOSeDetails.Select(t => new { t.LU, t.PartCode });
var luRePartCodes = hbpoSeLuRePartCodes.Union(maiDanHBPOSeLuRePartCodes);
var materialRelationships = luRePartCodes.GroupBy(t => new { t.LU, t.PartCode }).Select(t => new MaterialRelationship(GuidGenerator.Create(), t.Key.LU, "", t.Key.PartCode, ""));
_addMaterialRelationships.AddRange(materialRelationships);
hbpoSeDetails.ForEach(hbpoSeDetail => hbpoSeDetail.KeyCode = hbpoSeDetail.PN + hbpoSeDetail.LU);
maiDanHBPOSeDetails.ForEach(maiDanHBPOSeDetail =>
{

46
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs

@ -3,7 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Coravel.Invocable;
using LinqToDB;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
@ -16,6 +18,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
[ApiExplorerSettings(IgnoreApi = true)]
public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable
{
private readonly object _lockObj = new object();
private readonly IServiceProvider _serviceProvider;
public JisBBACSeEdiCompareAppService(IServiceProvider serviceProvider)
@ -27,22 +30,40 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable
/// 执行
/// </summary>
public async Task Invoke()
{
try
{
using var serviceScope = _serviceProvider.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
await HandDelEdiDataAsync().ConfigureAwait(false);
lock (_lockObj)
{
var seDetailGroup = db.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
var ediDetailGroup = db.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (se, edi) => new { se.PN, se.LU });
var seDetails = db.Set<BBAC_SE_DETAIL>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
var ediDetails = db.Set<BBAC_SE_EDI>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
if (keyCodes.Any())
{
var seDetails = db.Set<BBAC_SE_DETAIL>().Join(keyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a);
var ediDetails = db.Set<BBAC_SE_EDI>().Join(keyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a);
if (seDetails.Any())
{
seDetails.ForEach(t => t.IsHaveEdiData = true);
ediDetails.ForEach(t => t.IsHaveSeData = true);
db.Set<BBAC_SE_DETAIL>().UpdateRange(seDetails);
}
if (ediDetails.Any())
{
ediDetails.ForEach(t => t.IsHaveSeData = true);
db.Set<BBAC_SE_EDI>().UpdateRange(ediDetails);
await db.SaveChangesAsync().ConfigureAwait(false);
}
db.SaveChanges();
}
}
}
catch (Exception)
{
throw;
}
}
/// <summary>
@ -61,12 +82,21 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable
//Edi 删除的数据(有发运数据)
var ediDelKeyCodes = db.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == true && t.IsHaveSeData == true).Select(t => new { t.PN, t.LU }).Distinct();
var seDetails = db.Set<BBAC_SE_DETAIL>().Where(t => ediDelKeyCodes.Contains(new { t.PN, t.LU }));
var ediDetails = db.Set<BBAC_SE_EDI>().Where(t => ediDelKeyCodes.Contains(new { t.PN, t.LU }));
if (ediDelKeyCodes.Any())
{
var seDetails = db.Set<BBAC_SE_DETAIL>().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a);
var ediDetails = db.Set<BBAC_SE_EDI>().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a);
if (seDetails.Any())
{
seDetails.ForEach(t => t.IsHaveEdiData = false);
ediDetails.ForEach(t => t.IsHaveSeData = false);
db.Set<BBAC_SE_DETAIL>().UpdateRange(seDetails);
}
if (ediDetails.Any())
{
ediDetails.ForEach(t => t.IsHaveSeData = false);
db.Set<BBAC_SE_EDI>().UpdateRange(ediDetails);
}
await db.SaveChangesAsync().ConfigureAwait(false);
}
}
}

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

@ -20,6 +20,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
[ApiExplorerSettings(IgnoreApi = true)]
public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable
{
private readonly object _lockObj = new object();
private readonly IServiceProvider _serviceProvider;
/// <summary>
@ -46,48 +47,39 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable
/// </summary>
public async Task Invoke()
{
Debug.WriteLine($"执行了:{this.GetType()}");
try
{
using var serviceScope = _serviceProvider.CreateScope();
var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>();
await HandDelEdiDataAsync().ConfigureAwait(false);
var seDetailGroup = from se in db.Set<HBPO_SE_DETAIL>()
where se.IsHaveEdiData == false
group se by new { se.PN, se.LU }
into a
select new { a.Key.PN, a.Key.LU };
var ediDetailGroup = from edi in db.Set<HBPO_SE_EDI>()
where edi.IsDeleted == false && edi.IsHaveSeData == false
group edi by new { edi.PN, edi.LU }
into a
select new { a.Key.PN, a.Key.LU };
var keyCodes = from se in seDetailGroup
join edi in ediDetailGroup on new
lock (_lockObj)
{
se.PN,
se.LU
} equals new
var seDetailGroup = db.Set<HBPO_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
var ediDetailGroup = db.Set<HBPO_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (se, edi) => new { se.PN, se.LU });
if (keyCodes.Any())
{
var seDetails = db.Set<HBPO_SE_DETAIL>().Join(keyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a);
var ediDetails = db.Set<HBPO_SE_EDI>().Join(keyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a);
if (seDetails.Any())
{
edi.PN,
edi.LU
}
select new { se.PN, se.LU };
//var seDetailGroup2 = db.Set<HBPO_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
//var ediDetailGroup2 = db.Set<HBPO_SE_EDI>().Where(t => t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
//var keyCodes2 = seDetailGroup2.Join(ediDetailGroup2, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (se, edi) => new { se.PN, se.LU });
var seDetails = db.Set<HBPO_SE_DETAIL>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
var ediDetails = db.Set<HBPO_SE_EDI>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
seDetails.ForEach(t => t.IsHaveEdiData = true);
ediDetails.ForEach(t => t.IsHaveSeData = true);
db.Set<HBPO_SE_DETAIL>().UpdateRange(seDetails);
}
if (ediDetails.Any())
{
ediDetails.ForEach(t => t.IsHaveSeData = true);
db.Set<HBPO_SE_EDI>().UpdateRange(ediDetails);
await db.SaveChangesAsync().ConfigureAwait(false);
Debug.WriteLine($"处理数量:{keyCodes.Count()}");
}
db.SaveChanges();
}
}
}
catch (Exception)
{
throw;
}
}
/// <summary>
@ -100,12 +92,21 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable
//Edi 删除的数据(有发运数据)
var ediDelKeyCodes = db.Set<HBPO_SE_EDI>().Where(t => t.IsDeleted == true && t.IsHaveSeData == true).Select(t => new { t.PN, t.LU }).Distinct();
var seDetails = db.Set<HBPO_SE_DETAIL>().Where(t => ediDelKeyCodes.Contains(new { t.PN, t.LU }));
var ediDetails = db.Set<HBPO_SE_EDI>().Where(t => ediDelKeyCodes.Contains(new { t.PN, t.LU }));
if (ediDelKeyCodes.Any())
{
var seDetails = db.Set<HBPO_SE_DETAIL>().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a);
var ediDetails = db.Set<HBPO_SE_EDI>().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a);
if (seDetails.Any())
{
seDetails.ForEach(t => t.IsHaveEdiData = false);
ediDetails.ForEach(t => t.IsHaveSeData = false);
db.Set<HBPO_SE_DETAIL>().UpdateRange(seDetails);
}
if (ediDetails.Any())
{
ediDetails.ForEach(t => t.IsHaveSeData = false);
db.Set<HBPO_SE_EDI>().UpdateRange(ediDetails);
}
await db.SaveChangesAsync().ConfigureAwait(false);
}
}
}

23
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs

@ -7,9 +7,11 @@ using Coravel.Invocable;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.CurrentBranch;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -36,9 +38,9 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
private readonly INormalEfCoreRepository<PUB_SE_DETAIL, Guid> _pubSeDetailRepository;
/// <summary>
/// 客户零件关系仓储
/// 客户零件关系领域
/// </summary>
private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _materialRelationshipRepository;
private readonly MaterialRelationshipManager _materialRelationshipManager;
private readonly IVmiService _vmiService;
@ -49,11 +51,13 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
MaterialRelationshipManager materialRelationshipManager,
VmiAppService vmiService)
{
_wmsBJBMPTContext = wmsBJBMPTContext;
_syncPositionFlagRepository = syncPositionFlagRepository;
_pubSeDetailRepository = pubSeDetailRepository;
_materialRelationshipManager = materialRelationshipManager;
_vmiService = vmiService;
}
@ -88,20 +92,15 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_OTHER_RECORD.Where(predicate).OrderBy(b => b.UID).ToList();
var pubSeDetails = ObjectMapper.Map<List<TM_BJBMPT_OTHER_RECORD>, List<PUB_SE_DETAIL>>(wmsSeRecords);
pubSeDetails.RemoveAll(t => !string.IsNullOrEmpty(t.LU) || !string.IsNullOrEmpty(t.PartCode));
pubSeDetails.RemoveAll(t => string.IsNullOrEmpty(t.LU) || string.IsNullOrEmpty(t.PartCode));
if (pubSeDetails.Any())
{
//客户零件号和厂内零件号
var luRePartCodes = pubSeDetails.Select(t => new { t.LU, t.PartCode });
var haveLuRePartCodes = (await _materialRelationshipRepository.GetListAsync(t => luRePartCodes.Contains(new { LU = t.ErpMaterialCode, PartCode = t.SettleMaterialCode })).ConfigureAwait(false)).Select(t => new { LU = t.ErpMaterialCode, PartCode = t.SettleMaterialCode });
var noHaveLuRePartCodes = luRePartCodes.Except(haveLuRePartCodes);
if (noHaveLuRePartCodes.Any())
var luRePartCodes = pubSeDetails.Select(t => new { t.LU, t.PartCode }).Distinct().ToList();
if (luRePartCodes.Any())
{
var materialRelationships = noHaveLuRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.LU, "", t.PartCode, ""));
await _materialRelationshipRepository.InsertManyAsync(materialRelationships).ConfigureAwait(false);
var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.LU, "", t.PartCode, businessType.ToString()));
await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false);
}
pubSeDetails.ForEach(t =>

5
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs

@ -4,8 +4,10 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -24,8 +26,9 @@ public class YinDuSeSyncAppService : JitSeSyncAppService, IJobService
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
MaterialRelationshipManager materialRelationshipManager,
VmiAppService vmiService
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, vmiService)
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, materialRelationshipManager, vmiService)
{
base.SeSyncConfigInfo = new SeSyncConfig()
{

5
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongBBACSeSyncAppService.cs

@ -4,8 +4,10 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -24,8 +26,9 @@ public class ZhiGongBBACSeSyncAppService : JitSeSyncAppService, IJobService
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
MaterialRelationshipManager materialRelationshipManager,
VmiAppService vmiService
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, vmiService)
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, materialRelationshipManager, vmiService)
{
base.SeSyncConfigInfo = new SeSyncConfig()
{

5
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs

@ -4,8 +4,10 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
@ -24,8 +26,9 @@ public class ZhiGongHBPOSeSyncAppService : JitSeSyncAppService, IJobService
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
MaterialRelationshipManager materialRelationshipManager,
VmiAppService vmiService
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, vmiService)
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, materialRelationshipManager, vmiService)
{
base.SeSyncConfigInfo = new SeSyncConfig()
{

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

@ -1129,27 +1129,27 @@ namespace Win.Sfs.SettleAccount
private void CreateMapSeSync()
{
CreateMap<TM_BJBMPT_JIT_RECORD, BBAC_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.DeliverCode))
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.Seq))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.MatchNumber))
.ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.UniqueCode))
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, HBPO_SE_DETAIL>()
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.JISNum))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.DeliverCode))
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.SeqNumber, y => y.MapFrom(d => d.Seq))
.ForMember(x => x.AssemblyCode, y => y.MapFrom(d => d.MatchNumber))
.ForMember(x => x.InjectionCode, y => y.MapFrom(d => d.UniqueCode))
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, PUB_SE_DETAIL>()
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
@ -1188,7 +1188,8 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
//.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
}

199
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs

@ -1,7 +1,9 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using SettleAccount.Bases;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
namespace SettleAccount.Domain.BQ;
@ -46,157 +48,196 @@ public class BBAC_SE_DETAIL:SE_BASE
//[Display(Name = "Wms发货单号")]
//public string WmsBillNum { get; set; } = null!;
/// <summary>
/// 单据编
/// JIT订单号
/// </summary>
[Display(Name = "单据编号")]
public string Num { get; set; }
[Display(Name = "JIT订单号")]
[DisplayName("JIT订单号")]
public string JISNum { get; set; }
/// <summary>
/// 发货时间
/// JIT排序生产码
/// </summary>
[Display(Name = "发货时间")]
public DateTime BillTime { get; set; }
[Display(Name = "JIT排序生产码")]
public string VinCode { get; set; }
/// <summary>
/// 发货人
/// JIT排序生产码类型
/// </summary>
[Display(Name = "发货人")]
public string Oper { get; set; }
[Display(Name = "JIT排序生产码类型")]
public string CodeType { get; set; }
/// <summary>
/// 排序单
/// 订单零件
/// </summary>
[Display(Name = "排序单号")]
public string OrderNum { get; set; }
[Display(Name = "订单零件号")]
public string PartCode { get; set; }
/// <summary>
/// 订单零件号
/// </summary>
[Display(Name = "订单零件号")]
public string RealPartCode { get; set; }
/// <summary>
/// 批次
/// </summary>
[Display(Name = "批次")]
public string Batch { get; set; }
/// <summary>
/// 客户零件号
/// </summary>
[Display(Name = "客户零件号")]
public string CustPartCode { get; set; }
/// <summary>
/// 订单序号
/// </summary>
[Display(Name = "订单序号")]
public string Seq { get; set; }
/// <summary>
/// 实际生产码
/// 订单时间
/// </summary>
[Display(Name = "实际生产码")]
public string RealCode { get; set; }
[Display(Name = "订单时间")]
public DateTime AssembleData { get; set; }
/// <summary>
/// 订单生产码
/// 发货条
/// </summary>
[Display(Name = "订单生产码")]
public string VinCode { get; set; }
[Display(Name = "发货条码")]
public string DeliverCode { get; set; }
/// <summary>
/// 生产码类型
/// 发货单号
/// </summary>
[Display(Name = "生产码类型")]
public string CodeType { get; set; }
[Display(Name = "发货单号")]
public string BillNum { get; set; }
/// <summary>
/// 实际零件号
/// 发货时间
/// </summary>
[Display(Name = "实际零件号")]
public string RealPartCode { get; set; }
[Display(Name = "发货时间")]
public DateTime? BillTime { get; set; }
/// <summary>
/// 零件号
/// 发货人
/// </summary>
[Display(Name = "零件号")]
public string PartCode { get; set; }
[Display(Name = "发货人")]
public string Oper { get; set; }
/// <summary>
/// 批次
/// 客户位置
/// </summary>
[Display(Name = "批次")]
public string Batch { get; set; }
[Display(Name = "客户位置")]
public string Position { get; set; }
/// <summary>
/// 工厂
/// </summary>
[Display(Name = "工厂")]
public string Factory { get; set; }
/// <summary>
/// MES配置码
/// </summary>
[Display(Name = "MES配置码")]
public string MESConfigCode { get; set; }
/// <summary>
/// 来源库位
/// </summary>
[Display(Name = "来源库位")]
public string FromLoc { get; set; }
/// <summary>
/// 目标库位
/// </summary>
[Display(Name = "目标库位")]
public string ToLoc { get; set; }
/// <summary>
/// 参照订单生产码
/// 单据类型
/// </summary>
[Display(Name = "参照订单生产码")]
public string RefVinCode { get; set; }
public EnumBillType BillType { get; set; }
/// <summary>
/// 单据性质
/// 子单据类型
/// </summary>
[Display(Name = "单据性质")]
public string BillCharacter { get; set; }
[Display(Name = "子单据类型")]
public EnumSubBillType SubBillType { get; set; }
/// <summary>
/// 发货关联单号
/// 事务类型
/// </summary>
[Display(Name = "发货关联单号")]
public string RefBillNum { get; set; }
[Display(Name = "事务类型")]
public EnumDelTransType TransType { get; set; }
/// <summary>
/// Erp目标库位
/// 发运主类型
/// </summary>
[Display(Name = "Erp目标库位")]
public string ErpToLoc { get; set; }
[Display(Name = "发运主类型")]
public EnumDeliverBjBmpBillType DeliverBillType { get; set; }
/// <summary>
/// 发运子类型
/// </summary>
[Display(Name = "发运子类型")]
public EnumDeliverSubBillType DeliverSubBillType { get; set; }
/// <summary>
/// 单据性质
/// </summary>
[Display(Name = "单据性质")]
public string BillCharacter { get; set; }
/// <summary>
/// 原生产码
/// </summary>
[Display(Name = "原生产码")]
public string OrigiCode { get; set; }
/// <summary>
/// 描述
/// </summary>
[Display(Name = "描述")]
public string PartDesc { get; set; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
public string Remark { get; set; }
/// <summary>
/// 业务类型
/// </summary>
[Display(Name = "业务类型")]
public EnumProTpe ProType { get; set; }
/// <summary>
/// JIS排序单号
/// </summary>
[Display(Name = "JIS排序单号")]
public string OrderNum { get; set; }
/// <summary>
/// JIS实际生产码
/// </summary>
[Display(Name = "JIS实际生产码")]
public string RealCode { get; set; }
/// <summary>
/// 来源库位
/// </summary>
[Display(Name = "来源库位")]
public string FromLoc { get; set; }
/// <summary>
/// 参照订单生产码
/// </summary>
[Display(Name = "参照订单生产码")]
public string RefVinCode { get; set; }
/// <summary>
/// 发货关联单号
/// </summary>
[Display(Name = "发货关联单号")]
public string RefBillNum { get; set; }
/// <summary>
/// Erp目标库位
/// </summary>
[Display(Name = "Erp目标库位")]
public string ErpToLoc { get; set; }
/// <summary>
/// 塑件唯一码
/// </summary>
[Display(Name = "塑件唯一码")]
public string UniqueCode { get; set; }
/// <summary>
/// PJS顺序号
/// </summary>
[Display(Name = "PJS顺序号")]
public string PjsNum { get; set; }
/// <summary>
/// 虚拟小总成
/// </summary>
[Display(Name = "虚拟小总成")]
public string MatchNumber { get; set; }
/// <summary>
/// 发货条码
/// 状态
/// </summary>
[Display(Name = "发货条码")]
public string DeliverCode { get; set; }
[Display(Name = "状态")]
public EnumBillState State { get; set; }
/// <summary>
/// 客户位置
/// 创建时间
/// </summary>
[Display(Name = "客户位置")]
public string Position { get; set; }
[Display(Name = "创建时间")]
public DateTime CreateTime { get; set; }
/// <summary>
/// 是否有EDI数据
/// </summary>

201
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_DETAIL.cs

@ -2,8 +2,8 @@ using SettleAccount.Bases;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
namespace SettleAccount.Domain.BQ;
@ -42,157 +42,196 @@ public class HBPO_SE_DETAIL :SE_BASE
//[Display(Name = "Wms发货单号")]
//public string WmsBillNum { get; set; } = null!;
/// <summary>
/// 单据编
/// JIT订单号
/// </summary>
[Display(Name = "单据编号")]
public string Num { get; set; }
[Display(Name = "JIT订单号")]
[DisplayName("JIT订单号")]
public string JISNum { get; set; }
/// <summary>
/// 发货时间
/// JIT排序生产码
/// </summary>
[Display(Name = "发货时间")]
public DateTime BillTime { get; set; }
[Display(Name = "JIT排序生产码")]
public string VinCode { get; set; }
/// <summary>
/// 发货人
/// JIT排序生产码类型
/// </summary>
[Display(Name = "发货人")]
public string Oper { get; set; }
[Display(Name = "JIT排序生产码类型")]
public string CodeType { get; set; }
/// <summary>
/// 排序单
/// 订单零件
/// </summary>
[Display(Name = "排序单号")]
public string OrderNum { get; set; }
[Display(Name = "订单零件号")]
public string PartCode { get; set; }
/// <summary>
/// 订单零件号
/// </summary>
[Display(Name = "订单零件号")]
public string RealPartCode { get; set; }
/// <summary>
/// 批次
/// </summary>
[Display(Name = "批次")]
public string Batch { get; set; }
/// <summary>
/// 客户零件号
/// </summary>
[Display(Name = "客户零件号")]
public string CustPartCode { get; set; }
/// <summary>
/// 订单序号
/// </summary>
[Display(Name = "订单序号")]
public string Seq { get; set; }
/// <summary>
/// 实际生产码
/// 订单时间
/// </summary>
[Display(Name = "实际生产码")]
public string RealCode { get; set; }
[Display(Name = "订单时间")]
public DateTime AssembleData { get; set; }
/// <summary>
/// 订单生产码
/// 发货条
/// </summary>
[Display(Name = "订单生产码")]
public string VinCode { get; set; }
[Display(Name = "发货条码")]
public string DeliverCode { get; set; }
/// <summary>
/// 生产码类型
/// 发货单号
/// </summary>
[Display(Name = "生产码类型")]
public string CodeType { get; set; }
[Display(Name = "发货单号")]
public string BillNum { get; set; }
/// <summary>
/// 实际零件号
/// 发货时间
/// </summary>
[Display(Name = "实际零件号")]
public string RealPartCode { get; set; }
[Display(Name = "发货时间")]
public DateTime? BillTime { get; set; }
/// <summary>
/// 零件号
/// 发货人
/// </summary>
[Display(Name = "零件号")]
public string PartCode { get; set; }
[Display(Name = "发货人")]
public string Oper { get; set; }
/// <summary>
/// 批次
/// 客户位置
/// </summary>
[Display(Name = "批次")]
public string Batch { get; set; }
[Display(Name = "客户位置")]
public string Position { get; set; }
/// <summary>
/// 工厂
/// </summary>
[Display(Name = "工厂")]
public string Factory { get; set; }
/// <summary>
/// MES配置码
/// </summary>
[Display(Name = "MES配置码")]
public string MESConfigCode { get; set; }
/// <summary>
/// 来源库位
/// </summary>
[Display(Name = "来源库位")]
public string FromLoc { get; set; }
/// <summary>
/// 目标库位
/// </summary>
[Display(Name = "目标库位")]
public string ToLoc { get; set; }
/// <summary>
/// 参照订单生产码
/// 单据类型
/// </summary>
[Display(Name = "参照订单生产码")]
public string RefVinCode { get; set; }
public EnumBillType BillType { get; set; }
/// <summary>
/// 单据性质
/// 子单据类型
/// </summary>
[Display(Name = "单据性质")]
public string BillCharacter { get; set; }
[Display(Name = "子单据类型")]
public EnumSubBillType SubBillType { get; set; }
/// <summary>
/// 发货关联单号
/// 事务类型
/// </summary>
[Display(Name = "发货关联单号")]
public string RefBillNum { get; set; }
[Display(Name = "事务类型")]
public EnumDelTransType TransType { get; set; }
/// <summary>
/// Erp目标库位
/// 发运主类型
/// </summary>
[Display(Name = "Erp目标库位")]
public string ErpToLoc { get; set; }
[Display(Name = "发运主类型")]
public EnumDeliverBjBmpBillType DeliverBillType { get; set; }
/// <summary>
/// 发运子类型
/// </summary>
[Display(Name = "发运子类型")]
public EnumDeliverSubBillType DeliverSubBillType { get; set; }
/// <summary>
/// 单据性质
/// </summary>
[Display(Name = "单据性质")]
public string BillCharacter { get; set; }
/// <summary>
/// 原生产码
/// </summary>
[Display(Name = "原生产码")]
public string OrigiCode { get; set; }
/// <summary>
/// 描述
/// </summary>
[Display(Name = "描述")]
public string PartDesc { get; set; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
public string Remark { get; set; }
/// <summary>
/// 业务类型
/// </summary>
[Display(Name = "业务类型")]
public EnumProTpe ProType { get; set; }
/// <summary>
/// JIS排序单号
/// </summary>
[Display(Name = "JIS排序单号")]
public string OrderNum { get; set; }
/// <summary>
/// JIS实际生产码
/// </summary>
[Display(Name = "JIS实际生产码")]
public string RealCode { get; set; }
/// <summary>
/// 来源库位
/// </summary>
[Display(Name = "来源库位")]
public string FromLoc { get; set; }
/// <summary>
/// 参照订单生产码
/// </summary>
[Display(Name = "参照订单生产码")]
public string RefVinCode { get; set; }
/// <summary>
/// 发货关联单号
/// </summary>
[Display(Name = "发货关联单号")]
public string RefBillNum { get; set; }
/// <summary>
/// Erp目标库位
/// </summary>
[Display(Name = "Erp目标库位")]
public string ErpToLoc { get; set; }
/// <summary>
/// 塑件唯一码
/// </summary>
[Display(Name = "塑件唯一码")]
public string UniqueCode { get; set; }
/// <summary>
/// PJS顺序号
/// </summary>
[Display(Name = "PJS顺序号")]
public string PjsNum { get; set; }
/// <summary>
/// 虚拟小总成
/// </summary>
[Display(Name = "虚拟小总成")]
public string MatchNumber { get; set; }
/// <summary>
/// 发货条码
/// 状态
/// </summary>
[Display(Name = "发货条码")]
public string DeliverCode { get; set; }
[Display(Name = "状态")]
public EnumBillState State { get; set; }
/// <summary>
/// 客户位置
/// 创建时间
/// </summary>
[Display(Name = "客户位置")]
public string Position { get; set; }
[Display(Name = "创建时间")]
public DateTime CreateTime { get; set; }
/// <summary>
/// 是否有EDI数据
/// </summary>

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs

@ -253,7 +253,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return await _detailRepository.Where(p =>p.InvbillNum== p_invbillnum && p_list.Contains(p.GroupNum)).ToListAsync();
}
public virtual async Task<List<BBAC_CAN_SA_DETAIL>> GetContainsAsync(string p_invbillnum)
{
return await _detailRepository.Where(p => p.InvbillNum == p_invbillnum).ToListAsync();
}
/// <summary>
/// 通过发票号获取结算数据
/// </summary>

11
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_CAN_SA_MNG.cs

@ -263,6 +263,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return await _detailRepository.Where(p => p.InvbillNum == p_invbillnum && p_list.Contains(p.GroupNum)).ToListAsync();
}
/// <summary>
/// 获取发票对应结算分组所有零件
/// </summary>
/// <param name="billNum"></param>
/// <returns></returns>
public virtual async Task<List<HBPO_CAN_SA_DETAIL>> GetContainsAsync(string p_invbillnum)
{
return await _detailRepository.Where(p => p.InvbillNum == p_invbillnum).ToListAsync();
}
/// <summary>
/// 通过发票号获取结算数据

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

@ -28,7 +28,7 @@ using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
public class INV_MNG : DomainService
public partial class INV_MNG : DomainService
{
//private readonly INormalEfCoreRepository<TCAN_SA, Guid> _canRepository;
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository;
@ -1385,6 +1385,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
);
invlist.Add(invbill);
}
await _repository.DbContext.BulkInsertAsync(invlist);
await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList);
@ -1900,10 +1905,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
switch (inv.BusinessType)
{
case EnumBusinessType.MaiDanJianHBPO:
invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true);
invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true);
break;
case EnumBusinessType.MaiDanJianBBAC:
invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true);
invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true);
break;
case EnumBusinessType.ZhiGongJianBBAC:
invlist = await JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true);//重开可以变多张发票
@ -1926,23 +1931,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
//if (inv.BusinessType == EnumBusinessType.MaiDanJianHBPO)
//{
// invlist = await MakeInvoice(p_list,p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true);
//}
//if (inv.BusinessType == EnumBusinessType.BeiJian)
//{
// invlist = await BJInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true);
//}
//else
//{
// invlist = await FirstInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);//重开可以变多张发票
//}
if (invlist.Count == 0)
{
return false;
@ -2239,10 +2227,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
switch (inv.BusinessType)
{
case EnumBusinessType.MaiDanJianHBPO:
invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, false);
invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, false);
break;
case EnumBusinessType.MaiDanJianBBAC:
invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, false);
invlist = await MakeInvoice(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, false);
break;
case EnumBusinessType.ZhiGongJianBBAC:
invlist = await JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType,false);//重开可以变多张发票

1284
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs

File diff suppressed because it is too large

43
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/MaterialRelationshipManager.cs

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Services;
using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers;
/// <summary>
/// 客户零件关系
/// </summary>
public class MaterialRelationshipManager : DomainService
{
/// <summary>
/// 客户零件关系仓储
/// </summary>
private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _materialRelationshipRepository;
public MaterialRelationshipManager(INormalEfCoreRepository<MaterialRelationship, Guid> materialRelationshipRepository)
{
_materialRelationshipRepository = materialRelationshipRepository;
}
/// <summary>
/// 添加零件关系
/// </summary>
public async Task AddNewMaterialRelationships(IEnumerable<MaterialRelationship> materialRelationships)
{
//客户零件号和厂内零件号
var luRePartCodes = materialRelationships.Select(t => new { t.ErpMaterialCode, t.SettleMaterialCode }).Distinct().ToList();
var haveLuRePartCodes = materialRelationships.Join(_materialRelationshipRepository.AsNoTracking(),
a => new { a.ErpMaterialCode, a.SettleMaterialCode },
b => new { b.ErpMaterialCode, b.SettleMaterialCode },
(a, b) => a).ToList();
var noHaveLuRePartCodes = materialRelationships.Except(haveLuRePartCodes).ToList();
if (noHaveLuRePartCodes.Any())
{
await _materialRelationshipRepository.InsertManyAsync(noHaveLuRePartCodes).ConfigureAwait(false);
}
}
}

11
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_CAN_SA_MNG.cs

@ -255,6 +255,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
/// <summary>
/// 获取发票对应结算分组所有零件
/// </summary>
/// <param name="billNum"></param>
/// <returns></returns>
public virtual async Task<List<PUB_CAN_SA_DETAIL>> GetContainsAsync(string p_invbillnum)
{
return await _detailRepository.Where(p => p.InvbillNum == p_invbillnum).ToListAsync();
}
/// <summary>
/// 通过发票号获取结算数据

10
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIS_RECORD.cs

@ -35,8 +35,8 @@ public class TM_BJBMPT_JIS_RECORD
[DisplayName("JIS生产码类型")]
public string CodeType { get; set; }
[DisplayName("状态")]
public EnumBillState State { get; set; }
//[DisplayName("状态")]
//public EnumBillState State { get; set; }
[DisplayName("订单零件号")]
public string RealPartCode { get; set; }
@ -51,7 +51,7 @@ public class TM_BJBMPT_JIS_RECORD
public string CustPartCode { get; set; }
[DisplayName("数量")]
public decimal Qty { get; set; }
public decimal? Qty { get; set; }
[DisplayName("发货单号")]
public string BillNum { get; set; }
@ -60,7 +60,7 @@ public class TM_BJBMPT_JIS_RECORD
public string MESConfigCode { get; set; }
[DisplayName("订单时间")]
public DateTime AssembleData { get; set; }
public DateTime? AssembleData { get; set; }
[DisplayName("来源库位")]
public string FromLoc { get; set; }
@ -120,5 +120,5 @@ public class TM_BJBMPT_JIS_RECORD
public string Position { get; set; }
[DisplayName("创建时间")]
public DateTime CreateTime { get; set; }
public DateTime? CreateTime { get; set; }
}

11
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Syncs/TM_BJBMPT_JIT_RECORD.cs

@ -39,7 +39,7 @@ public class TM_BJBMPT_JIT_RECORD
public string Seq { get; set; }
[DisplayName("订单时间")]
public DateTime AssembleData { get; set; }
public DateTime? AssembleData { get; set; }
[DisplayName("发货条码")]
public string DeliverCode { get; set; }
@ -89,9 +89,6 @@ public class TM_BJBMPT_JIT_RECORD
[DisplayName("原生产码")]
public string OrigiCode { get; set; }
[DisplayName("描述")]
public string PartDesc { get; set; }
[DisplayName("备注")]
public string Remark { get; set; }
@ -125,11 +122,11 @@ public class TM_BJBMPT_JIT_RECORD
[DisplayName("虚拟小总成")]
public string MatchNumber { get; set; }
[DisplayName("状态")]
public EnumBillState State { get; set; }
//[DisplayName("状态")]
//public EnumBillState State { get; set; }
[DisplayName("创建时间")]
public DateTime CreateTime { get; set; }
public DateTime? CreateTime { get; set; }
}
public enum EnumProTpe

23
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs

@ -5,6 +5,8 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BQ.Temp;
public class TMEP_INV
@ -27,6 +29,27 @@ public class TMEP_INV
/// </summary>
public DateTime EndDate { get; set; }
}
public class INVOICE_GRP_DETAIL
{
/// <summary>
/// 发票明细
/// </summary>
public List<INVOICE_WAIT_DETAIL> INVOICE_DETAIL { get; set; }
/// <summary>
/// 发票和结算分组对应关系
/// </summary>
public List<INVOICE_MAP_GROUP> INVOICE_MAP_GROUP { get; set; }
/// <summary>
/// 发票调整明细
/// </summary>
public List<PUB_ADJ_DETAIL> ADJ_DETAIL { get; set; }
}
public class TEMP_CAN_SA_DETAIL
{

5503
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815054853_20230815-3.Designer.cs

File diff suppressed because it is too large

368
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230815054853_20230815-3.cs

@ -0,0 +1,368 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308153 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("75ce4934-06de-4cac-a1f0-536935975b38"));
migrationBuilder.RenameColumn(
name: "Num",
table: "Set_HBPO_SE_DETAIL",
newName: "PartDesc");
migrationBuilder.RenameColumn(
name: "Num",
table: "Set_BBAC_SE_DETAIL",
newName: "PartDesc");
migrationBuilder.AlterColumn<DateTime>(
name: "BillTime",
table: "Set_HBPO_SE_DETAIL",
type: "datetime2",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "datetime2");
migrationBuilder.AddColumn<DateTime>(
name: "AssembleData",
table: "Set_HBPO_SE_DETAIL",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "BillNum",
table: "Set_HBPO_SE_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "BillType",
table: "Set_HBPO_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<DateTime>(
name: "CreateTime",
table: "Set_HBPO_SE_DETAIL",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "CustPartCode",
table: "Set_HBPO_SE_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "DeliverBillType",
table: "Set_HBPO_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "DeliverSubBillType",
table: "Set_HBPO_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "Factory",
table: "Set_HBPO_SE_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "JISNum",
table: "Set_HBPO_SE_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ProType",
table: "Set_HBPO_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "State",
table: "Set_HBPO_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "SubBillType",
table: "Set_HBPO_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "TransType",
table: "Set_HBPO_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AlterColumn<DateTime>(
name: "BillTime",
table: "Set_BBAC_SE_DETAIL",
type: "datetime2",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "datetime2");
migrationBuilder.AddColumn<DateTime>(
name: "AssembleData",
table: "Set_BBAC_SE_DETAIL",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "BillNum",
table: "Set_BBAC_SE_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "BillType",
table: "Set_BBAC_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<DateTime>(
name: "CreateTime",
table: "Set_BBAC_SE_DETAIL",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<string>(
name: "CustPartCode",
table: "Set_BBAC_SE_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "DeliverBillType",
table: "Set_BBAC_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "DeliverSubBillType",
table: "Set_BBAC_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "Factory",
table: "Set_BBAC_SE_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "JISNum",
table: "Set_BBAC_SE_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "ProType",
table: "Set_BBAC_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "State",
table: "Set_BBAC_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "SubBillType",
table: "Set_BBAC_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "TransType",
table: "Set_BBAC_SE_DETAIL",
type: "int",
nullable: false,
defaultValue: 0);
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("c085a562-1da9-4dd3-8e65-85e4518f1383"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "4b83550d90bf425493e93dcd552a0bd1", 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("c085a562-1da9-4dd3-8e65-85e4518f1383"));
migrationBuilder.DropColumn(
name: "AssembleData",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "BillNum",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "BillType",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "CreateTime",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "CustPartCode",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "DeliverBillType",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "DeliverSubBillType",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "Factory",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "JISNum",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "ProType",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "State",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "SubBillType",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "TransType",
table: "Set_HBPO_SE_DETAIL");
migrationBuilder.DropColumn(
name: "AssembleData",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "BillNum",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "BillType",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "CreateTime",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "CustPartCode",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "DeliverBillType",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "DeliverSubBillType",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "Factory",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "JISNum",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "ProType",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "State",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "SubBillType",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.DropColumn(
name: "TransType",
table: "Set_BBAC_SE_DETAIL");
migrationBuilder.RenameColumn(
name: "PartDesc",
table: "Set_HBPO_SE_DETAIL",
newName: "Num");
migrationBuilder.RenameColumn(
name: "PartDesc",
table: "Set_BBAC_SE_DETAIL",
newName: "Num");
migrationBuilder.AlterColumn<DateTime>(
name: "BillTime",
table: "Set_HBPO_SE_DETAIL",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldNullable: true);
migrationBuilder.AlterColumn<DateTime>(
name: "BillTime",
table: "Set_BBAC_SE_DETAIL",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldNullable: 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("75ce4934-06de-4cac-a1f0-536935975b38"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "8e865c8947ea4381b1b48c3ee4d572b4", 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 });
}
}
}

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

@ -611,6 +611,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("AssembleData")
.HasColumnType("datetime2");
b.Property<string>("AssemblyCode")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
@ -624,9 +627,15 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("BillCharacter")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("BillTime")
b.Property<string>("BillNum")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("BillTime")
.HasColumnType("datetime2");
b.Property<int>("BillType")
.HasColumnType("int");
b.Property<int>("BusinessType")
.HasColumnType("int");
@ -639,6 +648,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(50)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
@ -647,6 +659,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
@ -655,9 +670,15 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<int>("DeliverBillType")
.HasColumnType("int");
b.Property<string>("DeliverCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("DeliverSubBillType")
.HasColumnType("int");
b.Property<string>("ErpToLoc")
.HasColumnType("nvarchar(max)");
@ -665,6 +686,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Factory")
.HasColumnType("nvarchar(max)");
b.Property<string>("FromLoc")
.HasColumnType("nvarchar(max)");
@ -681,6 +705,9 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<bool>("IsHaveEdiData")
.HasColumnType("bit");
b.Property<string>("JISNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("KeyCode")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
@ -703,9 +730,6 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("MatchNumber")
.HasColumnType("nvarchar(max)");
b.Property<string>("Num")
.HasColumnType("nvarchar(max)");
b.Property<string>("Oper")
.HasColumnType("nvarchar(max)");
@ -722,12 +746,18 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("PartCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("PartDesc")
.HasColumnType("nvarchar(max)");
b.Property<string>("PjsNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("Position")
.HasColumnType("nvarchar(max)");
b.Property<int>("ProType")
.HasColumnType("int");
b.Property<decimal>("Qty")
.HasColumnType("decimal(18,2)");
@ -756,9 +786,18 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("ShippingDate")
.HasColumnType("datetime2");
b.Property<int>("State")
.HasColumnType("int");
b.Property<int>("SubBillType")
.HasColumnType("int");
b.Property<string>("ToLoc")
.HasColumnType("nvarchar(max)");
b.Property<int>("TransType")
.HasColumnType("int");
b.Property<string>("UniqueCode")
.HasColumnType("nvarchar(max)");
@ -1758,6 +1797,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("AssembleData")
.HasColumnType("datetime2");
b.Property<string>("AssemblyCode")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
@ -1771,9 +1813,15 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("BillCharacter")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("BillTime")
b.Property<string>("BillNum")
.HasColumnType("nvarchar(max)");
b.Property<DateTime?>("BillTime")
.HasColumnType("datetime2");
b.Property<int>("BillType")
.HasColumnType("int");
b.Property<string>("CodeType")
.HasColumnType("nvarchar(max)");
@ -1783,6 +1831,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(50)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
@ -1791,6 +1842,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<string>("CustPartCode")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
@ -1799,9 +1853,15 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<int>("DeliverBillType")
.HasColumnType("int");
b.Property<string>("DeliverCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("DeliverSubBillType")
.HasColumnType("int");
b.Property<string>("ErpToLoc")
.HasColumnType("nvarchar(max)");
@ -1809,6 +1869,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("Factory")
.HasColumnType("nvarchar(max)");
b.Property<string>("FromLoc")
.HasColumnType("nvarchar(max)");
@ -1825,6 +1888,9 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<bool>("IsHaveEdiData")
.HasColumnType("bit");
b.Property<string>("JISNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("KeyCode")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
@ -1847,9 +1913,6 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("MatchNumber")
.HasColumnType("nvarchar(max)");
b.Property<string>("Num")
.HasColumnType("nvarchar(max)");
b.Property<string>("Oper")
.HasColumnType("nvarchar(max)");
@ -1866,12 +1929,18 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("PartCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("PartDesc")
.HasColumnType("nvarchar(max)");
b.Property<string>("PjsNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("Position")
.HasColumnType("nvarchar(max)");
b.Property<int>("ProType")
.HasColumnType("int");
b.Property<decimal>("Qty")
.HasColumnType("decimal(18,2)");
@ -1900,9 +1969,18 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<DateTime>("ShippingDate")
.HasColumnType("datetime2");
b.Property<int>("State")
.HasColumnType("int");
b.Property<int>("SubBillType")
.HasColumnType("int");
b.Property<string>("ToLoc")
.HasColumnType("nvarchar(max)");
b.Property<int>("TransType")
.HasColumnType("int");
b.Property<string>("UniqueCode")
.HasColumnType("nvarchar(max)");
@ -4414,10 +4492,10 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasData(
new
{
Id = new Guid("75ce4934-06de-4cac-a1f0-536935975b38"),
Id = new Guid("c085a562-1da9-4dd3-8e65-85e4518f1383"),
BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
BillType = 1,
ConcurrencyStamp = "8e865c8947ea4381b1b48c3ee4d572b4",
ConcurrencyStamp = "4b83550d90bf425493e93dcd552a0bd1",
DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
ErpToLoc = "ErpToLoc",
OrderNum = "OrderNum",

Loading…
Cancel
Save