出库单保存
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.OutStock
|
||||
@@ -9,5 +10,40 @@ namespace WMS.Web.Core.Dto.OutStock
|
||||
/// </summary>
|
||||
public class SaveOutStockRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 来源单号
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "来源单号不能为空")]
|
||||
public string SourceBillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 销售订单号
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "销售订单号不能为空")]
|
||||
public string SaleBillNo { get; set; }
|
||||
/// <summary>
|
||||
/// 发货组织
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "发货组织不能为空")]
|
||||
public int DeliveryOrgId { get; set; }
|
||||
/// <summary>
|
||||
/// 收货客户
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "收货客户不能为空")]
|
||||
public int ReceiptCustomerId { get; set; }
|
||||
/// <summary>
|
||||
/// 物料Id
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "物料不能为空")]
|
||||
public int MaterialId { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "仓库不能为空")]
|
||||
public int StockId { get; set; }
|
||||
/// <summary>
|
||||
/// 出库数量
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "出库数量不能为空")]
|
||||
public decimal Qty { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,5 +50,14 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 明细
|
||||
/// </summary>
|
||||
public List<OutStockDetails> Details = new List<OutStockDetails>();
|
||||
/// <summary>
|
||||
/// 创建
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Create(int creatorId)
|
||||
{
|
||||
this.CreatorId = creatorId;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
17
src/WMS.Web.Domain/Mappers/OutStockMapper.cs
Normal file
17
src/WMS.Web.Domain/Mappers/OutStockMapper.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto.OutStock;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Mappers
|
||||
{
|
||||
public class OutStockMapper : Profile
|
||||
{
|
||||
public OutStockMapper()
|
||||
{
|
||||
CreateMap<SaveOutStockRequest, OutStockDetails>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,9 +34,28 @@ namespace WMS.Web.Domain.Services
|
||||
_transactionRepositories = transactionRepositories;
|
||||
_outStockRepositories = outStockRepositories;
|
||||
}
|
||||
public Task<Result> Save(List<SaveOutStockRequest> dto, LoginInDto loginInfo)
|
||||
public async Task<Result> Save(List<SaveOutStockRequest> dto, LoginInDto loginInfo)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
OutStock entity = new OutStock();
|
||||
entity.Details = _mapper.Map<List<OutStockDetails>>(dto);
|
||||
entity.Create(loginInfo.UserInfo.StaffId);
|
||||
|
||||
//需要填写序列号
|
||||
//需要修改库存
|
||||
//需要同步金蝶
|
||||
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isSuccess = true;
|
||||
entity = await _outStockRepositories.Add(entity, true);
|
||||
if (entity == null) isRollback = true;
|
||||
|
||||
//提交事务
|
||||
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user