箱唛接口功能
This commit is contained in:
62
src/WMS.Web.Domain/Services/BoxMarkService.cs
Normal file
62
src/WMS.Web.Domain/Services/BoxMarkService.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Values;
|
||||
|
||||
namespace WMS.Web.Domain.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 箱唛-服务
|
||||
/// </summary>
|
||||
public class BoxMarkService : IBoxMarkService
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
public readonly IBasicsRepositories _transactionRepositories;
|
||||
private readonly IBoxMarkRepositories _boxMarkRepositories;
|
||||
public BoxMarkService(IMapper mapper,
|
||||
IBasicsRepositories transactionRepositories,
|
||||
IBoxMarkRepositories boxMarkRepositories)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_transactionRepositories = transactionRepositories;
|
||||
_boxMarkRepositories = boxMarkRepositories;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> Generate(GenerateBoxMarkDto dto, LoginInDto loginInfo)
|
||||
{
|
||||
//1.获取最新的箱唛信息
|
||||
var entity_new = await _boxMarkRepositories.GetBy();
|
||||
|
||||
//2.dto映射实体
|
||||
var entity = new BoxMark();
|
||||
entity= _mapper.Map(dto, entity);
|
||||
entity.Create(loginInfo.UserInfo.StaffId);
|
||||
|
||||
var new_firstBillNo = entity_new == null ? 0 : entity_new.FirstBillNo;
|
||||
var new_lastBillNo = entity_new == null ? 0 : entity_new.LastBillNo;
|
||||
entity.GenerateBillNo(new_firstBillNo, new_lastBillNo);
|
||||
|
||||
//添加
|
||||
var isSuccess = await _boxMarkRepositories.Add(entity);
|
||||
if (!isSuccess)
|
||||
return Result<InStockTask>.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user