优化接口
This commit is contained in:
@@ -79,24 +79,22 @@ namespace WMS.Web.Domain.Services
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上架
|
||||
/// 上架-采购订单
|
||||
/// </summary>
|
||||
/// <param name="instock"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> Shelf(SaveInStockRequest instock, LoginInDto loginInfo)
|
||||
public async Task<Result> Shelf(PurchaseShelfRequest instock, LoginInDto loginInfo)
|
||||
{
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isTransaction = false;
|
||||
|
||||
//1.添加入库单:(同步金蝶在save方法里面进行)
|
||||
var save_result = await this.Save(instock, loginInfo.UserInfo.StaffId, isTransaction);
|
||||
var save_result = await this.Save(instock, InstockType.Purchase, loginInfo.UserInfo.StaffId, isTransaction);
|
||||
if (!save_result.IsSuccess) isRollback = true;
|
||||
{
|
||||
//2.修改入库任务单
|
||||
var ids = new List<int>();
|
||||
ids.Add(instock.TaskId);
|
||||
var ids = instock.Details.GroupBy(x => x.TaskId).Select(x => x.Key).ToList();
|
||||
var result = await this.UpdateRange(ids, loginInfo.UserInfo.StaffId, false, isTransaction);
|
||||
if (!result.IsSuccess) isRollback = true;
|
||||
}
|
||||
@@ -142,17 +140,16 @@ namespace WMS.Web.Domain.Services
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存-出库单
|
||||
/// 采购上架-保存
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="staffId"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> Save(SaveInStockRequest dto, int staffId, bool isTransaction = true)
|
||||
private async Task<Result> Save(PurchaseShelfRequest dto, InstockType type, int staffId, bool isTransaction = true)
|
||||
{
|
||||
var entity = new InStock();
|
||||
entity.Type = (InstockType)dto.Type;
|
||||
entity.TaskId = dto.TaskId;
|
||||
entity.Type = type;
|
||||
entity.Details = _mapper.Map<List<InStockDetails>>(dto.Details);
|
||||
entity.Create(staffId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user