出入库回退上下架
This commit is contained in:
81
src/WMS.Web.Api/Controllers/BackRecordController.cs
Normal file
81
src/WMS.Web.Api/Controllers/BackRecordController.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.BackRecord;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Domain.Values;
|
||||
|
||||
namespace WMS.Web.Api.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 出入库回退上下架:接口
|
||||
/// </summary>
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class BackRecordController : ControllerBase
|
||||
{
|
||||
private readonly ILoginService _loginService;
|
||||
private readonly IBackRecordService _backRecordService;
|
||||
private readonly IBackRecordRepositories _backRecordRepositories;
|
||||
public BackRecordController(ILoginService loginService, IBackRecordRepositories backRecordRepositories, IBackRecordService backRecordService)
|
||||
{
|
||||
this._loginService = loginService;
|
||||
this._backRecordService = backRecordService;
|
||||
this._backRecordRepositories = backRecordRepositories;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("GetList")]
|
||||
public async Task<ResultPagedList<BackRecordQueryResponse>> GetPagedList([FromBody] BackRecordQueryRequest dto)
|
||||
{
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||
return ResultPagedList<BackRecordQueryResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
var result = await _backRecordRepositories.GetPagedList(dto);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 出库回退上架
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("OnShelf")]
|
||||
public async Task<Result> OnShelf([FromBody] SaveBackRecordRequest dto)
|
||||
{
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||
return Result.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
return await _backRecordService.BackShelf(dto, loginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 入库回退下架
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("OffShelf")]
|
||||
public async Task<Result> OffShelf([FromBody] SaveBackRecordRequest dto)
|
||||
{
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||
return Result.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
return await _backRecordService.BackShelf(dto, loginInfo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,10 @@ namespace WMS.Web.Api.Controllers
|
||||
{
|
||||
response.InstockStatus.Add(enumv.ToString(), enumv.GetRemark());
|
||||
}
|
||||
foreach (BackRecordType enumv in Enum.GetValues(typeof(BackRecordType)))
|
||||
{
|
||||
response.BackRecordType.Add(enumv.ToString(), enumv.GetRemark());
|
||||
}
|
||||
//2
|
||||
//1
|
||||
return Task.FromResult(Result<EnumStatusResponse>.ReSuccess(response));
|
||||
|
||||
@@ -4,6 +4,32 @@
|
||||
<name>WMS.Web.Api</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="T:WMS.Web.Api.Controllers.BackRecordController">
|
||||
<summary>
|
||||
出入库回退上下架:接口
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.BackRecordController.GetPagedList(WMS.Web.Core.Dto.BackRecordQueryRequest)">
|
||||
<summary>
|
||||
列表
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.BackRecordController.OnShelf(WMS.Web.Core.Dto.BackRecord.SaveBackRecordRequest)">
|
||||
<summary>
|
||||
出库回退上架
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.BackRecordController.OffShelf(WMS.Web.Core.Dto.BackRecord.SaveBackRecordRequest)">
|
||||
<summary>
|
||||
入库回退下架
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Api.Controllers.ChangeBoxRecordController">
|
||||
<summary>
|
||||
改箱
|
||||
|
||||
@@ -180,6 +180,51 @@
|
||||
序列号集
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.BackRecord.SaveBackRecordDetailsRequest">
|
||||
<summary>
|
||||
保存出入库回退上下架明细:请求对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BackRecord.SaveBackRecordDetailsRequest.BoxId">
|
||||
<summary>
|
||||
所属箱号ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BackRecord.SaveBackRecordDetailsRequest.MaterialId">
|
||||
<summary>
|
||||
物料ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BackRecord.SaveBackRecordDetailsRequest.Qty">
|
||||
<summary>
|
||||
数量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BackRecord.SaveBackRecordDetailsRequest.SubStockId">
|
||||
<summary>
|
||||
仓位ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BackRecord.SaveBackRecordDetailsRequest.SerialNumbers">
|
||||
<summary>
|
||||
序列号集
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.BackRecord.SaveBackRecordRequest">
|
||||
<summary>
|
||||
保存出入库回退上下架:请求对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BackRecord.SaveBackRecordRequest.Type">
|
||||
<summary>
|
||||
类型:1为入库回退下架,2为出库回退上架
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BackRecord.SaveBackRecordRequest.Details">
|
||||
<summary>
|
||||
明细
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.ChangeBoxRecord.ChangeBoxRecordQueryRequest">
|
||||
<summary>
|
||||
改箱列表请求
|
||||
@@ -350,6 +395,11 @@
|
||||
入库状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.EnumStatusResponse.BackRecordType">
|
||||
<summary>
|
||||
类型:1为入库回退下架,2为出库回退上架
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Core.Dto.Erp.ErpBillQueryDto">
|
||||
<summary>
|
||||
ERP:单据查询-dto
|
||||
|
||||
@@ -14,11 +14,6 @@
|
||||
ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.BackRecord.BoxId">
|
||||
<summary>
|
||||
所属箱号ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.BackRecord.Type">
|
||||
<summary>
|
||||
类型:1为入库回退下架,2为出库回退上架
|
||||
@@ -39,6 +34,12 @@
|
||||
明细
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Entitys.BackRecord.Create(System.Int32)">
|
||||
<summary>
|
||||
创建
|
||||
</summary>
|
||||
<param name="creatorId"></param>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Entitys.BackRecordDetails">
|
||||
<summary>
|
||||
wms出入库回退记录表
|
||||
@@ -54,6 +55,11 @@
|
||||
回退记录表ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.BackRecordDetails.BoxId">
|
||||
<summary>
|
||||
所属箱号ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.BackRecordDetails.MaterialId">
|
||||
<summary>
|
||||
物料ID
|
||||
@@ -997,6 +1003,14 @@
|
||||
<param name="dto"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.IBackRecordRepositories.Add(WMS.Web.Domain.Entitys.BackRecord,System.Boolean)">
|
||||
<summary>
|
||||
新增
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Infrastructure.IBasicsRepositories">
|
||||
<summary>
|
||||
基础数据
|
||||
@@ -1132,6 +1146,19 @@
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.IService.IBackRecordService">
|
||||
<summary>
|
||||
出入库回退上下架:服务接口
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.IBackRecordService.BackShelf(WMS.Web.Core.Dto.BackRecord.SaveBackRecordRequest,WMS.Web.Core.Dto.Login.LoginInDto)">
|
||||
<summary>
|
||||
回退上下架
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<param name="loginInfo"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.IService.IChangeMoveBoxService">
|
||||
<summary>
|
||||
改箱 移箱服务
|
||||
@@ -1663,7 +1690,7 @@
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.QuartzJob.InStockOrderQuartzJob">
|
||||
<summary>
|
||||
erp入库单-获取定时任务
|
||||
erp入库任务单-获取定时任务
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.QuartzJob.InStockOrderQuartzJob.Execute(Quartz.IJobExecutionContext)">
|
||||
@@ -1673,6 +1700,19 @@
|
||||
<param name="context"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Services.BackRecordService">
|
||||
<summary>
|
||||
出入库回退上下架:服务接口
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.BackRecordService.BackShelf(WMS.Web.Core.Dto.BackRecord.SaveBackRecordRequest,WMS.Web.Core.Dto.Login.LoginInDto)">
|
||||
<summary>
|
||||
回退上下架
|
||||
</summary>
|
||||
<param name="dto"></param>
|
||||
<param name="loginInfo"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Services.ChangeMoveBoxService">
|
||||
改箱 移箱服务
|
||||
</member>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.BackRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存出入库回退上下架明细:请求对象
|
||||
/// </summary>
|
||||
public class SaveBackRecordDetailsRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 所属箱号ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "箱号不能为空")]
|
||||
public int BoxId { get; set; }
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "物料不能为空")]
|
||||
public int MaterialId { get; set; }
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "数量不能为空")]
|
||||
public decimal Qty { get; set; }
|
||||
/// <summary>
|
||||
/// 仓位ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "仓位不能为空")]
|
||||
public int SubStockId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 序列号集
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "序列号不能为空")]
|
||||
public string SerialNumbers { get; set; }
|
||||
}
|
||||
}
|
||||
24
src/WMS.Web.Core/Dto/BackRecord/SaveBackRecordRequest.cs
Normal file
24
src/WMS.Web.Core/Dto/BackRecord/SaveBackRecordRequest.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.BackRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存出入库回退上下架:请求对象
|
||||
/// </summary>
|
||||
public class SaveBackRecordRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 类型:1为入库回退下架,2为出库回退上架
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "类型不能为空")]
|
||||
public int Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 明细
|
||||
/// </summary>
|
||||
public List<SaveBackRecordDetailsRequest> Details { get; set; } = new List<SaveBackRecordDetailsRequest>();
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,10 @@ namespace WMS.Web.Core.Dto
|
||||
/// 入库状态
|
||||
/// </summary>
|
||||
public Dictionary<string, string> InstockStatus { get; set; } = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// 类型:1为入库回退下架,2为出库回退上架
|
||||
/// </summary>
|
||||
public Dictionary<string, string> BackRecordType { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,11 +16,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 所属箱号ID
|
||||
/// </summary>
|
||||
public int BoxId { get; set; }
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 类型:1为入库回退下架,2为出库回退上架
|
||||
/// </summary>
|
||||
@@ -39,5 +35,15 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public List<BackRecordDetails> Details = new List<BackRecordDetails>();
|
||||
|
||||
/// <summary>
|
||||
/// 创建
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Create(int creatorId)
|
||||
{
|
||||
this.CreatorId = creatorId;
|
||||
this.CreateTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,10 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
public int Fid { get; set; }
|
||||
/// <summary>
|
||||
/// 所属箱号ID
|
||||
/// </summary>
|
||||
public int BoxId { get; set; }
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
public int MaterialId { get; set; }
|
||||
|
||||
24
src/WMS.Web.Domain/IService/IBackRecordService.cs
Normal file
24
src/WMS.Web.Domain/IService/IBackRecordService.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.BackRecord;
|
||||
using WMS.Web.Core.Dto.Login;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
|
||||
namespace WMS.Web.Domain.IService
|
||||
{
|
||||
/// <summary>
|
||||
/// 出入库回退上下架:服务接口
|
||||
/// </summary>
|
||||
public interface IBackRecordService
|
||||
{
|
||||
/// <summary>
|
||||
/// 回退上下架
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<Result> BackShelf(SaveBackRecordRequest dto, LoginInDto loginInfo);
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
@@ -18,5 +19,13 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
Task<ResultPagedList<BackRecordQueryResponse>> GetPagedList(BackRecordQueryRequest dto);
|
||||
|
||||
/// <summary>
|
||||
/// 新增
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<BackRecord> Add(BackRecord entity, bool isTransaction = true);
|
||||
}
|
||||
}
|
||||
|
||||
17
src/WMS.Web.Domain/Mappers/BackRecordMapper.cs
Normal file
17
src/WMS.Web.Domain/Mappers/BackRecordMapper.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto.BackRecord;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Mappers
|
||||
{
|
||||
public class BackRecordMapper : Profile
|
||||
{
|
||||
public BackRecordMapper()
|
||||
{
|
||||
CreateMap<SaveBackRecordDetailsRequest, BackRecordDetails>().ReverseMap();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ using WMS.Web.Domain.Options;
|
||||
namespace WMS.Web.Domain.QuartzJob
|
||||
{
|
||||
/// <summary>
|
||||
/// erp入库单-获取定时任务
|
||||
/// erp入库任务单-获取定时任务
|
||||
/// </summary>
|
||||
public class InStockOrderQuartzJob : IJob
|
||||
{
|
||||
|
||||
66
src/WMS.Web.Domain/Services/BackRecordService.cs
Normal file
66
src/WMS.Web.Domain/Services/BackRecordService.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto.BackRecord;
|
||||
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 BackRecordService: IBackRecordService
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
private readonly ILoginService _loginService;
|
||||
public readonly ITransactionRepositories _transactionRepositories;
|
||||
private readonly IBackRecordRepositories _backRecordRepositories;
|
||||
public BackRecordService(IMapper mapper, ILoginService loginService,
|
||||
ITransactionRepositories transactionRepositories,
|
||||
IBackRecordRepositories backRecordRepositories)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_loginService = loginService;
|
||||
_transactionRepositories = transactionRepositories;
|
||||
_backRecordRepositories = backRecordRepositories;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 回退上下架
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Result> BackShelf(SaveBackRecordRequest dto, LoginInDto loginInfo)
|
||||
{
|
||||
IDbContextTransaction _transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isTransaction = false;
|
||||
|
||||
var entity = new BackRecord();
|
||||
entity.Type = (BackRecordType)dto.Type;
|
||||
entity.Details = _mapper.Map<List<BackRecordDetails>>(dto.Details);
|
||||
entity.Create(loginInfo.UserInfo.StaffId);
|
||||
entity = await _backRecordRepositories.Add(entity, isTransaction);
|
||||
|
||||
//提交事务
|
||||
var isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
if (entity != null)
|
||||
return Result.ReSuccess();
|
||||
else
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -8,6 +9,7 @@ using System.Threading.Tasks;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Domain.IService.Public;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
@@ -88,5 +90,33 @@ namespace WMS.Web.Repositories
|
||||
response.Data = list;
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<BackRecord> Add(BackRecord entity, bool isTransaction = true)
|
||||
{
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
await _context.BackRecord.AddAsync(entity);
|
||||
await _context.SaveChangesAsync();
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
return entity;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,6 +233,8 @@ namespace WMS.Web.Repositories.DependencyInjection
|
||||
Services.AddTransient<IHttpClientService, HttpClientService>();
|
||||
Services.AddTransient<ISingleDataService, SingleDataService>();
|
||||
Services.AddTransient<IErpService, ErpService>();
|
||||
Services.AddTransient<IBackRecordService, BackRecordService>();
|
||||
|
||||
|
||||
Services.AddTransient<IChangeMoveBoxService, ChangeMoveBoxService>();
|
||||
Services.AddTransient<ITakeStockService, TakeStockService>();
|
||||
|
||||
Reference in New Issue
Block a user