根据出库任务单获取出库任务信息

This commit is contained in:
18942506660
2023-11-03 09:49:21 +08:00
parent eac6c6b269
commit 8494ca6662
12 changed files with 220 additions and 4 deletions

View File

@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using WMS.Web.Core;
using WMS.Web.Core.Internal.Results;
using WMS.Web.Domain.Values;
namespace WMS.Web.Domain.Entitys
{
@@ -74,5 +76,21 @@ namespace WMS.Web.Domain.Entitys
///</summary>
[Column("CreateTime")]
public DateTime? CreateTime { get; set; }
/// <summary>
/// 出库 反写 任务单
/// </summary>
/// <param name="materialId"></param>
/// <param name="qty"></param>
/// <returns></returns>
public Result OutStock(int materialId,decimal qty)
{
if ((this.AccruedQty - this.RealityQty) < qty)
return Result.ReFailure(ResultCodes.OutStockQtyError);
this.RealityQty = this.RealityQty + qty;
return Result.ReSuccess();
}
}
}

View File

@@ -17,10 +17,13 @@ namespace WMS.Web.Domain.Infrastructure
Task<List<OutStockTask>> GetEntityList(List<int> ids);
/// 修改实体集合
Task<bool> EditEntityList(List<OutStockTask> entitys, bool isTransaction = true);
//编辑
Task<OutStockTask> Edit(OutStockTask entity, bool isTransaction = true);
/// 删除实体集合
Task<bool> DeleteEntityList(List<int> ids, bool isTransaction = true);
//获取实体
Task<OutStockTask> Get(int id);
//根据订单号获取订单信息
Task<GetOutStockTaskByNoResponse> GetOutStockTaskByNo(string billNo);
}
}

View File

@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using WMS.Web.Core.Dto.OutStock;
using WMS.Web.Core.Dto.OutStockTask;
using WMS.Web.Domain.Entitys;
namespace WMS.Web.Domain.Mappers
@@ -17,6 +18,10 @@ namespace WMS.Web.Domain.Mappers
.ForMember(x => x.Id, ops => ops.Ignore())
.ForMember(x => x.Fid, ops => ops.Ignore())
.ForMember(x => x.Qty, ops => ops.Ignore());
CreateMap<OutStockTask, GetOutStockTaskByNoResponse>();
CreateMap<OutStockTaskDetails, GetOutStockTaskByNoDetailsResponse>();
}
}
}

View File

@@ -56,8 +56,11 @@ namespace WMS.Web.Domain.Services
//任务单明细
var tDetail = outStockTask.Details.FirstOrDefault(f => f.MaterialId == d.MaterialId);
if (tDetail == null) continue;
var outd = _mapper.Map<OutStockDetails>(tDetail);
var res = tDetail.OutStock(d.MaterialId, d.Qty);
if (!res.IsSuccess) return res;
var outd = _mapper.Map<OutStockDetails>(tDetail);
outd.Qty = outd.Qty + d.Qty;
entity.Details.Add(outd);
}

View File

@@ -24,6 +24,8 @@ namespace WMS.Web.Domain.Values
//出库任务单
public static ValueTuple<int, string> MergeStatusError = (70000, "所选单据数据不一致,不能合并");
public static ValueTuple<int, string> OutStockQtyError = (70001, "可出库数量不足");
public static ValueTuple<int, string> OutStockTaskNoData = (70002, "出库任务数据不存在");
public static ValueTuple<int, string> BoxNoData = (80000, "箱信息不存在");
public static ValueTuple<int, string> BoxMateriaNoData = (800010, "箱对应物料信息不存在");