添加序列号记录
This commit is contained in:
@@ -36,25 +36,20 @@ namespace WMS.Web.Core.Dto
|
||||
[JsonProperty("CompleteCartonTime")]
|
||||
public string CompleteCartonTime { get; set; }
|
||||
/// <summary>
|
||||
/// 箱子的创建时间
|
||||
/// </summary>
|
||||
[JsonProperty("cartonCreateTime")]
|
||||
public string cartonCreateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 箱子创建用户
|
||||
/// </summary>
|
||||
[JsonProperty("BoxUser")]
|
||||
public string BoxUser { get; set; }
|
||||
public string CreateUser { get; set; }
|
||||
/// <summary>
|
||||
/// 创建时间(对应老OPS的创建时间)
|
||||
/// </summary>
|
||||
[JsonProperty("CreateTime")]
|
||||
[JsonProperty("cartonCreateTime")]
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 明细
|
||||
/// </summary>
|
||||
[JsonProperty("BoxReturnDetails")]
|
||||
public List<OpsBoxDetailsResponse> Details = new List<OpsBoxDetailsResponse>();
|
||||
public List<OpsBoxDetailsResponse> Details { get; set; } = new List<OpsBoxDetailsResponse>();
|
||||
}
|
||||
public class SerialNumbersResponse
|
||||
{
|
||||
@@ -64,15 +59,15 @@ namespace WMS.Web.Core.Dto
|
||||
[JsonProperty("sn")]
|
||||
public string SerialNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 条码生成时间
|
||||
/// 序列号生成时间
|
||||
/// </summary>
|
||||
[JsonProperty("barCreateTime")]
|
||||
public string barCreateTime { get; set; }
|
||||
public string BarCreateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 条码生成用户
|
||||
/// 序列号生成用户
|
||||
/// </summary>
|
||||
[JsonProperty("barCereateUser")]
|
||||
public string barCereateUser { get; set; }
|
||||
public string BarCereateUser { get; set; }
|
||||
|
||||
}
|
||||
public class OpsBoxDetailsResponse {
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 对应老OPS的箱ID
|
||||
/// </summary>
|
||||
public int OpsBoxId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱编号(老OPS生成的箱号)
|
||||
/// </summary>
|
||||
@@ -40,6 +39,14 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
public int? OrgId { get; set; }
|
||||
/// <summary>
|
||||
/// 完成装箱时间
|
||||
/// </summary>
|
||||
public string CompleteCartonTime { get; set; }
|
||||
/// <summary>
|
||||
/// 箱子创建用户
|
||||
/// </summary>
|
||||
public string CreateUser { get; set; }
|
||||
/// <summary>
|
||||
/// 创建时间(对应老OPS的创建时间)
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
|
||||
68
src/WMS.Web.Domain/Entitys/SerialNumberOperate.cs
Normal file
68
src/WMS.Web.Domain/Entitys/SerialNumberOperate.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Domain.Values;
|
||||
|
||||
namespace WMS.Web.Domain.Entitys
|
||||
{
|
||||
/// <summary>
|
||||
/// 序列号操作记录表
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_wms_serialnumberoperate")]
|
||||
public class SerialNumberOperate : EntityBase
|
||||
{
|
||||
public SerialNumberOperate() { }
|
||||
public SerialNumberOperate(string serialNumber, SerialNumberOperateType operateType, string operateUser, string remark,
|
||||
int? supplierId = null, int? orgId = null, int? stockId = null,
|
||||
DateTime? operateTime = null)
|
||||
{
|
||||
this.SerialNumber = serialNumber;
|
||||
this.OperateType = operateType;
|
||||
this.OperateUser = operateUser;
|
||||
this.Remark = remark;
|
||||
this.SupplierId = supplierId == null ? 0 : (int)supplierId;
|
||||
this.OrgId = orgId == null ? 0 : (int)orgId;
|
||||
this.StockId = stockId == null ? 0 : (int)stockId;
|
||||
this.OperateTime = operateTime == null ? DateTime.Now : (DateTime)operateTime;
|
||||
}
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 序列号
|
||||
/// </summary>
|
||||
public string SerialNumber { get; set; }
|
||||
/// <summary>
|
||||
/// 序列号操作类型
|
||||
/// </summary>
|
||||
public SerialNumberOperateType OperateType { get; set; } = SerialNumberOperateType.Generate;
|
||||
/// <summary>
|
||||
/// 供应商Id
|
||||
/// </summary>
|
||||
public int SupplierId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 组织Id
|
||||
/// </summary>
|
||||
public int OrgId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 仓库Id
|
||||
/// </summary>
|
||||
public int StockId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 操作时间
|
||||
/// </summary>
|
||||
public DateTime OperateTime { get; set; } = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 操作人
|
||||
/// </summary>
|
||||
public string OperateUser { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
public interface ISerialNumberOperateRepositories
|
||||
{
|
||||
/// <summary>
|
||||
/// 批量添加
|
||||
/// </summary>
|
||||
/// <param name="entitys"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<bool> AddRange(List<SerialNumberOperate> entitys, bool isTransaction = true);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
@@ -18,7 +19,8 @@ namespace WMS.Web.Domain.Mappers
|
||||
CreateMap<BoxDetails, BoxDetailResponse>();
|
||||
|
||||
CreateMap<OpsBoxResponse, Box>();
|
||||
CreateMap<OpsBoxDetailsResponse, BoxDetails>();
|
||||
CreateMap<OpsBoxDetailsResponse, BoxDetails>()
|
||||
.ForPath(x => x.SerialNumbers, ops => ops.MapFrom(x => x.SerialNumbers.Select(s=>s.SerialNumber).ToList()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,14 +39,14 @@ namespace WMS.Web.Domain.Services.Public
|
||||
List<SerialNumbersResponse> ss = new List<SerialNumbersResponse>();
|
||||
ss.Add(new SerialNumbersResponse() {
|
||||
SerialNumber="sss",
|
||||
barCereateUser="sdf",
|
||||
barCreateTime="20-20-20"
|
||||
BarCereateUser="sdf",
|
||||
BarCreateTime="20-20-20"
|
||||
});
|
||||
ss.Add(new SerialNumbersResponse()
|
||||
{
|
||||
SerialNumber = "sss2",
|
||||
barCereateUser = "sdf2",
|
||||
barCreateTime = "20-20-20"
|
||||
BarCereateUser = "sdf2",
|
||||
BarCreateTime = "20-20-20"
|
||||
});
|
||||
details.Add(new OpsBoxDetailsResponse()
|
||||
{
|
||||
|
||||
14
src/WMS.Web.Domain/Values/SerialNumberOperateType.cs
Normal file
14
src/WMS.Web.Domain/Values/SerialNumberOperateType.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Domain.Values
|
||||
{
|
||||
/// <summary>
|
||||
/// 序列号操作类型
|
||||
/// </summary>
|
||||
public enum SerialNumberOperateType
|
||||
{
|
||||
Generate = 0
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ namespace WMS.Web.Repositories.Configuration
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
{
|
||||
|
||||
//改箱
|
||||
builder.Entity<ChangeBoxRecord>(ent =>
|
||||
@@ -48,7 +48,14 @@ namespace WMS.Web.Repositories.Configuration
|
||||
ent.ToTable("t_wms_movebox_record");
|
||||
ent.HasKey(x => x.Id);
|
||||
});
|
||||
|
||||
|
||||
//序列号操作记录
|
||||
builder.Entity<SerialNumberOperate>(ent =>
|
||||
{
|
||||
ent.ToTable("t_wms_serialnumberoperate");
|
||||
ent.HasKey(x => x.Id);
|
||||
});
|
||||
|
||||
#region 出库单
|
||||
builder.Entity<OutStock>(ent =>
|
||||
{
|
||||
@@ -66,7 +73,7 @@ namespace WMS.Web.Repositories.Configuration
|
||||
ent.HasKey(x => x.Id);
|
||||
});
|
||||
#endregion
|
||||
|
||||
|
||||
#region 出库任务单
|
||||
builder.Entity<OutStockTask>(ent =>
|
||||
{
|
||||
@@ -84,7 +91,7 @@ namespace WMS.Web.Repositories.Configuration
|
||||
ent.HasKey(x => x.Id);
|
||||
});
|
||||
#endregion
|
||||
|
||||
|
||||
#region 盘点单
|
||||
builder.Entity<TakeStock>(ent =>
|
||||
{
|
||||
@@ -223,6 +230,7 @@ namespace WMS.Web.Repositories.Configuration
|
||||
base.OnModelCreating(builder);
|
||||
}
|
||||
|
||||
public DbSet<SerialNumberOperate> SerialNumberOperate { get; set; }
|
||||
public DbSet<ChangeBoxRecord> ChangeBoxRecord { get; set; }
|
||||
public DbSet<MoveBoxRecord> MoveBoxRecord { get; set; }
|
||||
public DbSet<OutStock> OutStock { get; set; }
|
||||
|
||||
@@ -42,10 +42,10 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
services.AddTransient<IInventoryDetailsRepositories, InventoryDetailsRepositories>();
|
||||
services.AddTransient<IInventoryInOutDetailsRepositories, InventoryInOutDetailsRepositories>();
|
||||
services.AddTransient<IBoxInventoryRepositories, BoxInventoryRepositories>();
|
||||
|
||||
|
||||
|
||||
|
||||
services.AddTransient<ISerialNumberOperateRepositories, SerialNumberOperateRepositories>();
|
||||
services.AddTransient<IChangeBoxRecordRepositories, ChangeBoxRecordRepositories>();
|
||||
services.AddTransient<IMoveBoxRecordRepositories, MoveBoxRecordRepositories>();
|
||||
services.AddTransient<IOutStockRepositories, OutStockRepositories>();
|
||||
|
||||
50
src/WMS.Web.Repositories/SerialNumberOperateRepositories.cs
Normal file
50
src/WMS.Web.Repositories/SerialNumberOperateRepositories.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
using WMS.Web.Domain.Infrastructure;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
namespace WMS.Web.Repositories
|
||||
{
|
||||
public class SerialNumberOperateRepositories: ISerialNumberOperateRepositories
|
||||
{
|
||||
private readonly IMapper _mapper;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly RepositoryDbContext _context;
|
||||
|
||||
public SerialNumberOperateRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public async Task<bool> AddRange(List<SerialNumberOperate> entitys, bool isTransaction = true)
|
||||
{
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _context.Database.BeginTransaction();
|
||||
try
|
||||
{
|
||||
if (entitys != null && entitys.Count != 0)
|
||||
{
|
||||
await _context.SerialNumberOperate.AddRangeAsync(entitys);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user