任务单来源单调整为明细

This commit is contained in:
18942506660
2023-11-15 09:55:54 +08:00
parent 69576224da
commit 310ed29af2
7 changed files with 29 additions and 25 deletions

View File

@@ -968,11 +968,6 @@
单据编号
</summary>
</member>
<member name="P:WMS.Web.Domain.Entitys.OutStockTask.SourceBillNo">
<summary>
来源单号
</summary>
</member>
<member name="P:WMS.Web.Domain.Entitys.OutStockTask.DeliveryOrgId">
<summary>
发货组织
@@ -1059,6 +1054,11 @@
对应金蝶单据明细id(销售出库同步金蝶下推使用)
</summary>
</member>
<member name="P:WMS.Web.Domain.Entitys.OutStockTaskDetails.SourceBillNos">
<summary>
来源单号(合并后有多个)
</summary>
</member>
<member name="P:WMS.Web.Domain.Entitys.OutStockTaskDetails.SaleBillNo">
<summary>
销售订单号

View File

@@ -28,11 +28,6 @@ namespace WMS.Web.Domain.Entitys
[Column("BillNo")]
public string BillNo { get; set; }
/// <summary>
/// 来源单号
///</summary>
[Column("SourceBillNo")]
public string SourceBillNo { get; set; }
/// <summary>
/// 发货组织
///</summary>
[Column("DeliveryOrgId")]
@@ -71,10 +66,10 @@ namespace WMS.Web.Domain.Entitys
/// 明细
/// </summary>
public List<OutStockTaskDetails> Details = new List<OutStockTaskDetails>();
public void Create(OutStockType type, string sourceBillNo, int deliveryOrgId, int receiptCustomerId, DateTime createTime)
public void Create(OutStockType type, int deliveryOrgId, int receiptCustomerId, DateTime createTime)
{
this.Type = type;
this.SourceBillNo = sourceBillNo;
//this.SourceBillNos.Add(sourceBillNo);
this.DeliveryOrgId = deliveryOrgId;
this.ReceiptCustomerId = receiptCustomerId;
this.CreateTime = createTime;

View File

@@ -32,6 +32,11 @@ namespace WMS.Web.Domain.Entitys
[Column("Erp_DetailId")]
public int Erp_DetailId { get; set; }
/// <summary>
/// 来源单号(合并后有多个)
///</summary>
[Column("SourceBillNo")]
public List<string> SourceBillNos { get; set; }
/// <summary>
/// 销售订单号
///</summary>
[Column("SaleBillNo")]

View File

@@ -24,7 +24,8 @@ namespace WMS.Web.Domain.Mappers
CreateMap<OutStockTask, GetOutStockTaskByNoResponse>();
CreateMap<OutStockTaskDetails, GetOutStockTaskByNoDetailsResponse>();
CreateMap<ErpDeliveryNoticeOutStockResultDto, OutStockTaskDetails>();
CreateMap<ErpDeliveryNoticeOutStockResultDto, OutStockTaskDetails>()
.ForPath(x => x.SourceBillNos, ops => ops.MapFrom(x =>new List<string>() { x.SourceBillNo }));
}
}
}

View File

@@ -106,7 +106,7 @@ namespace WMS.Web.Domain.Services
foreach (var e in erp_list)
{
//代表单据已经存在 那么就对单据进行修改
var data = data_list.FirstOrDefault(f => f.SourceBillNo == e.SourceBillNo);
var data = data_list.FirstOrDefault(f => f.Details.SelectMany(s => s.SourceBillNos).Contains(e.SourceBillNo));
var detail = data.Details.FirstOrDefault(w => w.MaterialId == e.MaterialId);
//存在就修改,没有就添加
if (detail != null)
@@ -134,8 +134,7 @@ namespace WMS.Web.Domain.Services
{
var e = erp_list.FirstOrDefault(f => f.SourceBillNo == item);
var dto = new OutStockTask();
dto.SourceBillNo = e.SourceBillNo;
dto.Create((OutStockType)e.Type, e.SourceBillNo, e.DeliveryOrgId, e.ReceiptCustomerId, (DateTime)e.CreateTime);
dto.Create((OutStockType)e.Type, e.DeliveryOrgId, e.ReceiptCustomerId, (DateTime)e.CreateTime);
//找到当前对应来源单据编号的集合数据
var current_erp_details = erp_list.Where(x => x.SourceBillNo == item).ToList();
@@ -282,15 +281,15 @@ namespace WMS.Web.Domain.Services
foreach (var entity in taskList)
{
if (entity.Type == OutStockType.Sal)
DeliveryNotice_Nos.Add(entity.SourceBillNo);
DeliveryNotice_Nos.AddRange(entity.Details.SelectMany(s => s.SourceBillNos));
else if (entity.Type == OutStockType.Stkdirecttransfers)
TransferDirect_Nos.Add(entity.SourceBillNo);
TransferDirect_Nos.AddRange(entity.Details.SelectMany(s => s.SourceBillNos));
else if (entity.Type == OutStockType.StktransferInst)
TransferOut_Nos.Add(entity.SourceBillNo);
TransferOut_Nos.AddRange(entity.Details.SelectMany(s => s.SourceBillNos));
else if (entity.Type == OutStockType.Assembled)
AssembledApp_Nos.Add(entity.SourceBillNo);
AssembledApp_Nos.AddRange(entity.Details.SelectMany(s => s.SourceBillNos));
else if (entity.Type == OutStockType.Miscellaneous)
MisDeliveryOut_Nos.Add(entity.SourceBillNo);
MisDeliveryOut_Nos.AddRange(entity.Details.SelectMany(s => s.SourceBillNos));
}
if (DeliveryNotice_Nos.Count() > 0)

View File

@@ -112,6 +112,10 @@ namespace WMS.Web.Repositories.Configuration
{
ent.ToTable("t_erp_outstock_task_details");
ent.HasKey(x => x.Id);
ent.Property(f => f.SourceBillNos).HasConversion(
v => JsonConvert.SerializeObject(v),
v => JsonConvert.DeserializeObject<List<string>>(v));
});
#endregion

View File

@@ -263,7 +263,7 @@ namespace WMS.Web.Repositories
if (dto.Ids.Count() > 0)
query = query.Where(w => dto.Ids.Contains(w.detail.Id));
if (!string.IsNullOrEmpty(dto.SourceBillNo))
query = query.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%"));
query = query.Where(w => w.detail.SourceBillNos.Where(sw => EF.Functions.Like(sw, "%" + dto.SourceBillNo + "%")).Contains(w.order.BillNo));
if (dto.Type != null)
query = query.Where(w => w.order.Type == (OutStockType)dto.Type);
if (dto.Status != null)
@@ -290,7 +290,7 @@ namespace WMS.Web.Repositories
OutStockBeginTime = s.detail.OutStockBeginTime.DateToStringSeconds(),
OutStockEndTime = s.detail.OutStockEndTime.DateToStringSeconds(),
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.detail.StockCode),
SourceBillNo = s.order.SourceBillNo,
SourceBillNo = string.Join(",", s.detail.SourceBillNos.Select(x => x)),
SaleBillNo = s.detail.SaleBillNo,
DeliveryOrg = _erpBasicDataExtendService.GetOrgName(orgs, s.order.DeliveryOrgId),
ReceiptCustomer = s.order.Type == OutStockType.Sal
@@ -319,7 +319,7 @@ namespace WMS.Web.Repositories
var list = await _context.OutStockTask.Include(x => x.Details)
.Where(f => (EF.Functions.Like(f.BillNo, "%" + billNo + "%") ||
EF.Functions.Like(f.SourceBillNo, "%" + billNo + "%")) &&
f.Details.SelectMany(s=>s.SourceBillNos).Where(sw => EF.Functions.Like(sw, "%" + billNo + "%")).Contains(f.BillNo)) &&
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
.OrderByDescending(o => o.Id)
.ToListAsync();
@@ -419,7 +419,7 @@ namespace WMS.Web.Repositories
{
return await _context.OutStockTask.Include(x => x.Details)
.Where(f => (EF.Functions.Like(f.BillNo, "%" + billNo + "%") ||
EF.Functions.Like(f.SourceBillNo, "%" + billNo + "%")) &&
f.Details.SelectMany(s => s.SourceBillNos).Where(sw => EF.Functions.Like(sw, "%" + billNo + "%")).Contains(f.BillNo)) &&
(f.Status == OutStockStatus.Part || f.Status == OutStockStatus.Wait))
.OrderByDescending(o => o.Id)
.Select(s => s.BillNo)