Merge branch 'master' of https://codeup.aliyun.com/62ce7bca487c500c27f70a79/OPS/WMS-Api
This commit is contained in:
@@ -831,6 +831,11 @@
|
||||
物料Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStockDetails.SerialNumbers">
|
||||
<summary>
|
||||
序列号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.OutStockDetails.StockCode">
|
||||
<summary>
|
||||
仓库
|
||||
@@ -1636,6 +1641,9 @@
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.ISerialNumbersRepositories.GetEntityList(System.Collections.Generic.List{System.String})">
|
||||
查询实体集合
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.ISerialNumbersRepositories.GetEntityListByBoxId(System.Int32)">
|
||||
根据箱Id查询集合
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Infrastructure.ISerialNumbersRepositories.EditEntityList(System.Collections.Generic.List{WMS.Web.Domain.Entitys.SerialNumbers},System.Boolean)">
|
||||
修改实体集合
|
||||
</member>
|
||||
@@ -1804,19 +1812,13 @@
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.ISerialNumberService.ChangeBox(System.Collections.Generic.List{WMS.Web.Domain.Entitys.ChangeBoxRecord},WMS.Web.Core.Dto.Login.LoginInDto,System.Boolean)">
|
||||
<summary>
|
||||
操作序列号(移箱等)
|
||||
</summary>
|
||||
<param name="changeBoxRecords"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
改箱
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.ISerialNumberService.OutStock(System.Collections.Generic.List{System.String},System.Boolean)">
|
||||
<summary>
|
||||
操作序列号(出库操作)
|
||||
</summary>
|
||||
<param name="serialNumbers">序列号</param>
|
||||
<returns></returns>
|
||||
<member name="M:WMS.Web.Domain.IService.ISerialNumberService.MoveBox(WMS.Web.Domain.Entitys.MoveBoxRecord,WMS.Web.Core.Dto.Login.LoginInDto,System.Boolean)">
|
||||
移箱
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.ISerialNumberService.OutStock(WMS.Web.Domain.Entitys.OutStock,WMS.Web.Core.Dto.Login.LoginInDto,System.Boolean)">
|
||||
出库
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.IService.ISerialNumberService.SerialNumberOperate(System.Collections.Generic.List{WMS.Web.Domain.Entitys.SerialNumberOperate},System.Boolean)">
|
||||
<summary>
|
||||
@@ -3414,11 +3416,22 @@
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.SerialNumberService.OutStock(System.Collections.Generic.List{System.String},System.Boolean)">
|
||||
<member name="M:WMS.Web.Domain.Services.SerialNumberService.MoveBox(WMS.Web.Domain.Entitys.MoveBoxRecord,WMS.Web.Core.Dto.Login.LoginInDto,System.Boolean)">
|
||||
<summary>
|
||||
操作序列号(出库操作)
|
||||
移箱
|
||||
</summary>
|
||||
<param name="serialNumbers"></param>
|
||||
<param name="moveBoxRecord"></param>
|
||||
<param name="loginInfo"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.SerialNumberService.OutStock(WMS.Web.Domain.Entitys.OutStock,WMS.Web.Core.Dto.Login.LoginInDto,System.Boolean)">
|
||||
<summary>
|
||||
出库
|
||||
</summary>
|
||||
<param name="outStock"></param>
|
||||
<param name="loginInfo"></param>
|
||||
<param name="isTransaction"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Services.SerialNumberService.SerialNumberOperate(System.Collections.Generic.List{WMS.Web.Domain.Entitys.SerialNumberOperate},System.Boolean)">
|
||||
|
||||
@@ -38,6 +38,11 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("MaterialId")]
|
||||
public int MaterialId { get; set; }
|
||||
/// <summary>
|
||||
/// 序列号
|
||||
/// </summary>
|
||||
[Column("SerialNumbers")]
|
||||
public List<string> SerialNumbers { get; set; } = new List<string>();
|
||||
/// <summary>
|
||||
/// 仓库
|
||||
///</summary>
|
||||
[Column("StockCode")]
|
||||
|
||||
@@ -14,19 +14,12 @@ namespace WMS.Web.Domain.IService
|
||||
/// </summary>
|
||||
public interface ISerialNumberService
|
||||
{
|
||||
/// <summary>
|
||||
/// 操作序列号(移箱等)
|
||||
/// </summary>
|
||||
/// <param name="changeBoxRecords"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
/// 改箱
|
||||
Task<Result> ChangeBox(List<ChangeBoxRecord> changeBoxRecords, LoginInDto loginInfo, bool isTransaction = true);
|
||||
/// <summary>
|
||||
/// 操作序列号(出库操作)
|
||||
/// </summary>
|
||||
/// <param name="serialNumbers">序列号</param>
|
||||
/// <returns></returns>
|
||||
Task<Result> OutStock(List<string> serialNumbers, bool isTransaction = true);
|
||||
/// 移箱
|
||||
Task<Result> MoveBox(MoveBoxRecord moveBoxRecord, LoginInDto loginInfo, bool isTransaction = true);
|
||||
/// 出库
|
||||
Task<Result> OutStock(OutStock outStock, LoginInDto loginInfo, bool isTransaction = true);
|
||||
/// <summary>
|
||||
/// 序列号操作记录
|
||||
/// </summary>
|
||||
|
||||
@@ -23,6 +23,8 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
Task<SerialNumbersResponse> GetSerialNumber(string serialNumber);
|
||||
/// 查询实体集合
|
||||
Task<List<SerialNumbers>> GetEntityList(List<string> serialNumbers);
|
||||
/// 根据箱Id查询集合
|
||||
Task<List<SerialNumbers>> GetEntityListByBoxId(int boxId);
|
||||
/// 修改实体集合
|
||||
Task<bool> EditEntityList(List<SerialNumbers> entitys, bool isTransaction = true);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace WMS.Web.Domain.Services
|
||||
isSuccess = await _changeBoxRecordRepositories.AddRange(list, false);
|
||||
if (!isSuccess) isRollback = true;
|
||||
var res_change = await _serialNumberService.ChangeBox(list, loginInfo, false);
|
||||
if(!res_change.IsSuccess) isRollback = true;
|
||||
if (!res_change.IsSuccess) isRollback = true;
|
||||
isSuccess = await _boxRepositories.EditEntityList(boxList, false);
|
||||
if (!isSuccess) isRollback = true;
|
||||
|
||||
@@ -122,7 +122,8 @@ namespace WMS.Web.Domain.Services
|
||||
bool isSuccess = true;
|
||||
entity = await _moveBoxRecordRepositories.Add(entity, true);
|
||||
if (entity == null) isRollback = true;
|
||||
|
||||
var res_change = await _serialNumberService.MoveBox(entity, loginInfo, false);
|
||||
if (!res_change.IsSuccess) isRollback = true;
|
||||
//提交事务
|
||||
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
|
||||
@@ -71,7 +71,8 @@ namespace WMS.Web.Domain.Services
|
||||
|
||||
var outd = _mapper.Map<OutStockDetails>(tDetail);
|
||||
|
||||
outd.Qty = outd.Qty + d.Qty;
|
||||
outd.Qty = d.Qty;
|
||||
outd.SerialNumbers = d.SerialNumbers;
|
||||
entity.Details.Add(outd);
|
||||
}
|
||||
|
||||
@@ -85,7 +86,8 @@ namespace WMS.Web.Domain.Services
|
||||
entity = await _outStockRepositories.Add(entity, false);
|
||||
|
||||
if (entity == null) isRollback = true;
|
||||
|
||||
outStockTask = await _outStockTaskRepositories.Edit(outStockTask, false);
|
||||
if (outStockTask == null) isRollback = true;
|
||||
//提交事务
|
||||
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
|
||||
@@ -94,15 +94,72 @@ namespace WMS.Web.Domain.Services
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
/// <summary>
|
||||
/// 操作序列号(出库操作)
|
||||
/// 移箱
|
||||
/// </summary>
|
||||
/// <param name="serialNumbers"></param>
|
||||
/// <param name="moveBoxRecord"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public Task<Result> OutStock(List<string> serialNumbers, bool isTransaction = true)
|
||||
public async Task<Result> MoveBox(MoveBoxRecord moveBoxRecord, LoginInDto loginInfo, bool isTransaction = true)
|
||||
{
|
||||
//获取序列号信息
|
||||
var entityList = await _serialNumbersRepositories.GetEntityListByBoxId(moveBoxRecord.BoxId);
|
||||
var box = await _boxRepositories.Get(moveBoxRecord.BoxId);
|
||||
var userName = _singleDataService.GetSingleData(SingleAction.Staffs, loginInfo.UserInfo.CompanyId, loginInfo.UserInfo.StaffId);
|
||||
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _transactionRepositories.GetTransaction();
|
||||
bool isRollback = false;
|
||||
bool isSuccess = true;
|
||||
List<SerialNumberOperate> sList = new List<SerialNumberOperate>();
|
||||
foreach (var entity in entityList)
|
||||
{
|
||||
//修改序列号和箱绑定关系
|
||||
entity.Operate(moveBoxRecord.BoxId);
|
||||
|
||||
//记录序列号操作日志
|
||||
SerialNumberOperate op = new SerialNumberOperate()
|
||||
{
|
||||
MaterialId = entity.MaterialId,
|
||||
SerialNumber = entity.SerialNumber,
|
||||
OrgId = box.OrgId,
|
||||
SupplierId = box.SupplierId,
|
||||
OperateTime = DateTime.Now,
|
||||
OperateType = SerialNumberOperateType.MoveBox,
|
||||
OperateUser = userName,
|
||||
Remark = "箱号:" + box.BoxBillNo
|
||||
};
|
||||
sList.Add(op);
|
||||
}
|
||||
isSuccess = await _serialNumbersRepositories.EditEntityList(entityList, false);
|
||||
//序列号操作记录
|
||||
var res = await this.SerialNumberOperate(sList, false);
|
||||
//提交事务
|
||||
if (isTransaction)
|
||||
{
|
||||
if (!isSuccess) isRollback = true;
|
||||
if (!res.Success) isRollback = true;
|
||||
isSuccess = _transactionRepositories.CommitTransaction(isRollback, _transaction);
|
||||
if (!isSuccess)
|
||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
if (!isSuccess) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
if (!res.Success) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
/// <summary>
|
||||
/// 出库
|
||||
/// </summary>
|
||||
/// <param name="outStock"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
public Task<Result> OutStock(OutStock outStock, LoginInDto loginInfo, bool isTransaction = true)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 序列号操作记录日志
|
||||
/// </summary>
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace WMS.Web.Repositories.Configuration
|
||||
ent.HasKey(x => x.Id);
|
||||
});
|
||||
|
||||
//序列号操作记录
|
||||
//定时任务时间记录表
|
||||
builder.Entity<ErpOpsSyncDate>(ent =>
|
||||
{
|
||||
ent.ToTable("t_wms_sync_date");
|
||||
@@ -85,6 +85,10 @@ namespace WMS.Web.Repositories.Configuration
|
||||
{
|
||||
ent.ToTable("t_wms_outstock_details");
|
||||
ent.HasKey(x => x.Id);
|
||||
|
||||
ent.Property(f => f.SerialNumbers).HasConversion(
|
||||
v => JsonConvert.SerializeObject(v),
|
||||
v => JsonConvert.DeserializeObject<List<string>>(v));
|
||||
});
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -106,6 +106,15 @@ namespace WMS.Web.Repositories
|
||||
return res.Clone();
|
||||
}
|
||||
|
||||
public async Task<List<SerialNumbers>> GetEntityListByBoxId(int boxId)
|
||||
{
|
||||
var res = await _context.SerialNumbers
|
||||
.Where(f => f.BoxId==boxId)
|
||||
.ToListAsync();
|
||||
|
||||
return res.Clone();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据序列号
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user