diff --git a/src/WMS.Web.Core/Dto/OutStock/SaveOutStockRequest.cs b/src/WMS.Web.Core/Dto/OutStock/SaveOutStockRequest.cs
index da80c997..bf87a0c3 100644
--- a/src/WMS.Web.Core/Dto/OutStock/SaveOutStockRequest.cs
+++ b/src/WMS.Web.Core/Dto/OutStock/SaveOutStockRequest.cs
@@ -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
///
public class SaveOutStockRequest
{
+ ///
+ /// 来源单号
+ ///
+ [Required(ErrorMessage = "来源单号不能为空")]
+ public string SourceBillNo { get; set; }
+ ///
+ /// 销售订单号
+ ///
+ [Required(ErrorMessage = "销售订单号不能为空")]
+ public string SaleBillNo { get; set; }
+ ///
+ /// 发货组织
+ ///
+ [Required(ErrorMessage = "发货组织不能为空")]
+ public int DeliveryOrgId { get; set; }
+ ///
+ /// 收货客户
+ ///
+ [Required(ErrorMessage = "收货客户不能为空")]
+ public int ReceiptCustomerId { get; set; }
+ ///
+ /// 物料Id
+ ///
+ [Required(ErrorMessage = "物料不能为空")]
+ public int MaterialId { get; set; }
+ ///
+ /// 仓库ID
+ ///
+ [Required(ErrorMessage = "仓库不能为空")]
+ public int StockId { get; set; }
+ ///
+ /// 出库数量
+ ///
+ [Required(ErrorMessage = "出库数量不能为空")]
+ public decimal Qty { get; set; }
}
}
diff --git a/src/WMS.Web.Domain/Entitys/OutStock.cs b/src/WMS.Web.Domain/Entitys/OutStock.cs
index 45a4f0a7..c9a786aa 100644
--- a/src/WMS.Web.Domain/Entitys/OutStock.cs
+++ b/src/WMS.Web.Domain/Entitys/OutStock.cs
@@ -50,5 +50,14 @@ namespace WMS.Web.Domain.Entitys
/// 明细
///
public List Details = new List();
+ ///
+ /// 创建
+ ///
+ ///
+ public void Create(int creatorId)
+ {
+ this.CreatorId = creatorId;
+ this.CreateTime = DateTime.Now;
+ }
}
}
diff --git a/src/WMS.Web.Domain/Mappers/OutStockMapper.cs b/src/WMS.Web.Domain/Mappers/OutStockMapper.cs
new file mode 100644
index 00000000..273a3d7b
--- /dev/null
+++ b/src/WMS.Web.Domain/Mappers/OutStockMapper.cs
@@ -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();
+ }
+ }
+}
diff --git a/src/WMS.Web.Domain/Services/OutStockService.cs b/src/WMS.Web.Domain/Services/OutStockService.cs
index dd056cd5..4b9ebacb 100644
--- a/src/WMS.Web.Domain/Services/OutStockService.cs
+++ b/src/WMS.Web.Domain/Services/OutStockService.cs
@@ -34,9 +34,28 @@ namespace WMS.Web.Domain.Services
_transactionRepositories = transactionRepositories;
_outStockRepositories = outStockRepositories;
}
- public Task Save(List dto, LoginInDto loginInfo)
+ public async Task Save(List dto, LoginInDto loginInfo)
{
- throw new NotImplementedException();
+ OutStock entity = new OutStock();
+ entity.Details = _mapper.Map>(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();
}
}
}