收货接口
This commit is contained in:
@@ -1035,11 +1035,6 @@
|
||||
ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.UpdateInStockTaskBoxRequest.TaskId">
|
||||
<summary>
|
||||
单据ID(等同-入库任务单ID)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.UpdateInStockTaskBoxRequest.BoxId">
|
||||
<summary>
|
||||
箱信息ID
|
||||
@@ -1060,11 +1055,6 @@
|
||||
明细ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.UpdateInStockTaskDetailsRequest.Fid">
|
||||
<summary>
|
||||
单据ID(等同-入库任务单ID)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.InStockTask.UpdateInStockTaskDetailsRequest.MaterialId">
|
||||
<summary>
|
||||
物料ID
|
||||
|
||||
@@ -410,12 +410,12 @@
|
||||
入库时间(上架时间)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WMS.Web.Domain.Entitys.InStockTask.Boxs">
|
||||
<member name="P:WMS.Web.Domain.Entitys.InStockTask.Boxs">
|
||||
<summary>
|
||||
箱信息集合
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WMS.Web.Domain.Entitys.InStockTask.Details">
|
||||
<member name="P:WMS.Web.Domain.Entitys.InStockTask.Details">
|
||||
<summary>
|
||||
明细
|
||||
</summary>
|
||||
|
||||
@@ -13,10 +13,6 @@ namespace WMS.Web.Core.Dto.InStockTask
|
||||
/// ID
|
||||
/// </summary>
|
||||
public override int Id { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 单据ID(等同-入库任务单ID)
|
||||
/// </summary>
|
||||
public int TaskId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱信息ID
|
||||
|
||||
@@ -14,10 +14,6 @@ namespace WMS.Web.Core.Dto.InStockTask
|
||||
/// </summary>
|
||||
public override int Id { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 单据ID(等同-入库任务单ID)
|
||||
/// </summary>
|
||||
public int Fid { get; set; }
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public int MaterialId { get; set; }
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_erp_instock_task_box")]
|
||||
public class InStockTaskBox:EntityBase
|
||||
public class InStockTaskBox : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Id
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Domain.Values;
|
||||
|
||||
namespace WMS.Web.Domain.Entitys
|
||||
@@ -11,12 +12,12 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_erp_instock_task")]
|
||||
public class InStockTask
|
||||
public class InStockTask : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 单据编号
|
||||
/// </summary>
|
||||
@@ -53,12 +54,12 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// <summary>
|
||||
/// 箱信息集合
|
||||
/// </summary>
|
||||
public List<InStockTaskBox> Boxs = new List<InStockTaskBox>();
|
||||
public List<InStockTaskBox> Boxs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 明细
|
||||
/// </summary>
|
||||
public List<InStockTaskDetails> Details = new List<InStockTaskDetails>();
|
||||
public List<InStockTaskDetails> Details { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建
|
||||
|
||||
@@ -11,12 +11,12 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_erp_instock_task_details")]
|
||||
public class InStockTaskDetails: EntityBase
|
||||
public class InStockTaskDetails : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public override int Id { get; set; }
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 单据头ID
|
||||
/// </summary>
|
||||
|
||||
@@ -17,13 +17,14 @@ namespace WMS.Web.Domain.Mappers
|
||||
public InStockMapper()
|
||||
{
|
||||
CreateMap<UpdateInStockTaskRequest, InStockTask>()
|
||||
.ForMember(x => x.Details, opt => opt.Ignore())
|
||||
.ReverseMap();
|
||||
CreateMap<UpdateInStockTaskDetailsRequest, InStockTaskDetails>().ReverseMap();
|
||||
CreateMap<UpdateInStockTaskBoxRequest, InStockTaskBox>().ReverseMap();
|
||||
.ForMember(x => x.Boxs, opt => opt.Ignore())
|
||||
.ForMember(x => x.Details, opt => opt.Ignore());
|
||||
CreateMap<UpdateInStockTaskDetailsRequest, InStockTaskDetails>();
|
||||
CreateMap<UpdateInStockTaskBoxRequest, InStockTaskBox>();
|
||||
|
||||
|
||||
|
||||
CreateMap<SaveInStockDetailsRequest, InStockDetails>().ReverseMap();
|
||||
|
||||
CreateMap<ErpPurchaseInStockResultDto, InStockTask>()
|
||||
.ForMember(x => x.SourceBillNo, ops => ops.MapFrom(x => x.FBillNo));
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.InStockTask;
|
||||
using WMS.Web.Core.Help;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
@@ -125,9 +126,12 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<InStockTask> Get(int id)
|
||||
{
|
||||
return await _context.InStockTask
|
||||
var entity =await _context.InStockTask
|
||||
.Include(x=>x.Boxs)
|
||||
.Include(s => s.Details)
|
||||
.FirstOrDefaultAsync(f => f.Id == id);
|
||||
|
||||
return entity.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -137,11 +141,13 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<InStockTask> GetBy(string boxBillNo)
|
||||
{
|
||||
return await _context.InStockTask
|
||||
var entity= await _context.InStockTask
|
||||
.Include(s => s.Boxs.Where(b => b.BoxBillNo == boxBillNo))
|
||||
.Include(s => s.Details)
|
||||
.Where(w => w.Boxs.Where(b => b.BoxBillNo == boxBillNo).Count() > 0).FirstOrDefaultAsync();
|
||||
|
||||
return entity.Clone();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -152,10 +158,10 @@ namespace WMS.Web.Repositories
|
||||
public async Task<bool> IsExist(string boxBillNo)
|
||||
{
|
||||
return await _context.InStockTask
|
||||
.AsNoTracking()
|
||||
.Include(s => s.Boxs.Where(b => b.BoxBillNo == boxBillNo))
|
||||
.Include(s => s.Details)
|
||||
.Where(w =>(w.Status== InstockStatus.Part || w.Status== InstockStatus.Wait) && w.Boxs.Where(b => b.BoxBillNo == boxBillNo).Count() > 0).AnyAsync();
|
||||
|
||||
.Where(w => (w.Status == InstockStatus.Part || w.Status == InstockStatus.Wait) && w.Boxs.Where(b => b.BoxBillNo == boxBillNo).Count() > 0).AnyAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -165,10 +171,11 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<List<InStockTask>> GetList(List<int> ids)
|
||||
{
|
||||
return await _context.InStockTask
|
||||
var entitys= await _context.InStockTask
|
||||
.Include(s => s.Details)
|
||||
.Where(f => ids.Contains(f.Id))
|
||||
.ToListAsync();
|
||||
return entitys.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -178,10 +185,12 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<List<InStockTask>> GetListBy(List<string> sourceBillNos)
|
||||
{
|
||||
return await _context.InStockTask
|
||||
var entitys= await _context.InStockTask
|
||||
.Include(s => s.Details)
|
||||
.Where(w => sourceBillNos.Contains(w.SourceBillNo))
|
||||
.ToListAsync();
|
||||
|
||||
return entitys.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -301,8 +310,8 @@ namespace WMS.Web.Repositories
|
||||
try
|
||||
{
|
||||
List<int> list = entitys.Select(s => s.Id).ToList();
|
||||
var res = await _context.InStockTask.Include(x => x.Details).Where(f => list.Contains(f.Id)).ToListAsync();
|
||||
_mapper.Map(entitys, res);
|
||||
var res = await _context.InStockTask.Include(x=>x.Boxs).Include(x => x.Details).Where(f => list.Contains(f.Id)).ToListAsync();
|
||||
_mapper.ToMapList(entitys, res);
|
||||
await _context.SaveChangesAsync();
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
@@ -330,18 +339,20 @@ namespace WMS.Web.Repositories
|
||||
try
|
||||
{
|
||||
var model = await _context.InStockTask
|
||||
.AsNoTracking()
|
||||
.Include(s=>s.Boxs)
|
||||
.Include(s => s.Details)
|
||||
.FirstOrDefaultAsync(f => f.Id == entity.Id);
|
||||
if (model == null)
|
||||
return null;
|
||||
_mapper.Map(entity, model);
|
||||
await _context.SaveChangesAsync();
|
||||
_mapper.ToMapList(entity.Boxs, model.Boxs);
|
||||
_mapper.ToMapList(entity.Details, model.Details);
|
||||
var result= await _context.SaveChangesAsync();
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
return model;
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
|
||||
Reference in New Issue
Block a user