调整接口
This commit is contained in:
@@ -66,6 +66,14 @@ namespace WMS.Web.Api.Controllers
|
||||
return "";
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("Refresh")]
|
||||
public async Task<string> Refresh()
|
||||
{
|
||||
var result = await this._outStockTaskService.Sync(null);
|
||||
return "";
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("tf")]
|
||||
public async Task<string> TestTF()
|
||||
|
||||
@@ -435,26 +435,11 @@
|
||||
目标箱子ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.ChangeBoxRecord.SaveChangeBoxRecordRequest.StockCode">
|
||||
<summary>
|
||||
目标箱的仓库或重新上架选择仓位对应的仓库
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.ChangeBoxRecord.SaveChangeBoxRecordRequest.SubStockId">
|
||||
<summary>
|
||||
目标箱仓位或重新上架选择仓位
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.ChangeBoxRecord.SaveChangeBoxRecordRequest.SrcBoxOrgCode">
|
||||
<summary>
|
||||
原箱组织编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.ChangeBoxRecord.SaveChangeBoxRecordRequest.DestBoxOrgCode">
|
||||
<summary>
|
||||
目标箱组织编码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.ChangeBoxRecord.SaveChangeBoxRecordRequest.Details">
|
||||
<summary>
|
||||
明细
|
||||
@@ -3351,11 +3336,6 @@
|
||||
箱号ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.MoveBoxRecord.SaveMoveBoxRecordRequest.StockCode">
|
||||
<summary>
|
||||
仓库
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.MoveBoxRecord.SaveMoveBoxRecordRequest.SubStockId">
|
||||
<summary>
|
||||
仓位ID
|
||||
@@ -4121,11 +4101,6 @@
|
||||
物料ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.TakeStock.SaveTakeStockRequest.StockCode">
|
||||
<summary>
|
||||
仓库ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.TakeStock.SaveTakeStockRequest.SubStockId">
|
||||
<summary>
|
||||
仓位ID
|
||||
|
||||
@@ -945,12 +945,12 @@
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.MoveBoxRecord.SrcSubStockId">
|
||||
<summary>
|
||||
原仓位编码
|
||||
原仓位Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.MoveBoxRecord.DestSubStockId">
|
||||
<summary>
|
||||
目标仓位编码
|
||||
目标仓位Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.MoveBoxRecord.Qty">
|
||||
@@ -973,7 +973,7 @@
|
||||
操作时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Entitys.MoveBoxRecord.Create(WMS.Web.Domain.Values.MoveBoxType,System.Int32,System.String,System.Int32,System.Int32)">
|
||||
<member name="M:WMS.Web.Domain.Entitys.MoveBoxRecord.Create(WMS.Web.Domain.Values.MoveBoxType,System.Int32,System.String,System.String,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
创建
|
||||
</summary>
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace WMS.Web.Core.Dto.ChangeBoxRecord
|
||||
/// 目标箱仓位或重新上架选择仓位
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "仓位不能为空")]
|
||||
public int SubStockId { get; set; }
|
||||
public int SubStockId { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 明细
|
||||
/// </summary>
|
||||
|
||||
@@ -16,11 +16,6 @@ namespace WMS.Web.Core.Dto.MoveBoxRecord
|
||||
[Required(ErrorMessage = "箱号不能为空")]
|
||||
public int BoxId { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库
|
||||
///</summary>
|
||||
[Required(ErrorMessage = "仓库不能为空")]
|
||||
public string StockCode { get; set; }
|
||||
/// <summary>
|
||||
/// 仓位ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "仓位不能为空")]
|
||||
|
||||
@@ -21,11 +21,6 @@ namespace WMS.Web.Core.Dto.TakeStock
|
||||
[Required(ErrorMessage = "物料不能为空")]
|
||||
public int MaterialId { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "仓库不能为空")]
|
||||
public string StockCode { get; set; }
|
||||
/// <summary>
|
||||
/// 仓位ID
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "仓位不能为空")]
|
||||
|
||||
@@ -41,12 +41,12 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("StockCode")]
|
||||
public string StockCode { get; set; }
|
||||
/// <summary>
|
||||
/// 原仓位编码
|
||||
/// 原仓位Id
|
||||
/// </summary>
|
||||
[Column("SrcSubStockId")]
|
||||
public int SrcSubStockId { get; set; }
|
||||
/// <summary>
|
||||
/// 目标仓位编码
|
||||
/// 目标仓位Id
|
||||
/// </summary>
|
||||
[Column("DestSubStockId")]
|
||||
public int DestSubStockId { get; set; }
|
||||
@@ -75,10 +75,11 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 创建
|
||||
/// </summary>
|
||||
/// <param name="creatorId"></param>
|
||||
public void Create(MoveBoxType type, int boxId, string stockCode, int subStockId, int creatorId)
|
||||
public void Create(MoveBoxType type, int boxId,string orgCode, string stockCode, int subStockId, int creatorId)
|
||||
{
|
||||
this.BoxId = boxId;
|
||||
this.Type = type;
|
||||
this.OrgCode = orgCode;
|
||||
this.StockCode = stockCode;
|
||||
SrcSubStockId = type == MoveBoxType.Up ? 0 : subStockId;//上架 原仓位是0 目标仓位有值
|
||||
DestSubStockId = type == MoveBoxType.Up ? subStockId : 0; //下架 原仓位有值 目标仓位是0
|
||||
|
||||
@@ -19,9 +19,7 @@ namespace WMS.Web.Domain.Mappers
|
||||
|
||||
CreateMap<SaveChangeBoxRecordRequest, BoxInventoryChangeGenerateDto>()
|
||||
.ForMember(x => x.BoxId, ops => ops.MapFrom(x => x.SrcBoxId))
|
||||
.ForMember(x => x.TargetBoxId, ops => ops.MapFrom(x => x.DestBoxId))
|
||||
.ForMember(x => x.BoxOrgCode, ops => ops.MapFrom(x => x.SrcBoxOrgCode))
|
||||
.ForMember(x => x.TargetBoxOrgCode, ops => ops.MapFrom(x => x.DestBoxOrgCode));
|
||||
.ForMember(x => x.TargetBoxId, ops => ops.MapFrom(x => x.DestBoxId));
|
||||
CreateMap<SaveChangeBoxRecordDetailsRequest, BoxInventoryDetailsChangeGenerateDto>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,31 +75,29 @@ namespace WMS.Web.Domain.Services
|
||||
if (destBox != null)
|
||||
boxList.Add(destBox);
|
||||
|
||||
//2.修改库存时需要区别 有原箱和没有原箱的情况
|
||||
var subStock= await _basbicsRepositories.GetSubUcStockAsync(dto.SubStockId, loginInfo.UserInfo.CompanyId);
|
||||
//var entity = _mapper.Map<ChangeBoxRecord>(dto);\
|
||||
|
||||
List<ChangeBoxRecord> list = new List<ChangeBoxRecord>();
|
||||
foreach (var d in dto.Details)
|
||||
{
|
||||
ChangeBoxRecord entity = new ChangeBoxRecord();
|
||||
entity.Create(loginInfo.UserInfo.StaffId, d.Qty, d.MaterialId, d.SerialNumbers, dto.SrcBoxId, dto.DestBoxId);
|
||||
entity.SrcSubStockId = 0;//原乡仓位需要去拉一下库存获取
|
||||
if (subStock != null)
|
||||
{
|
||||
entity.DestSubStockId = dto.SubStockId;
|
||||
entity.DestBoxOrgCode = subStock.ErpOrgCode;
|
||||
entity.DestStockCode = subStock.StockCode;
|
||||
}
|
||||
list.Add(entity);
|
||||
}
|
||||
var inventoryList = new List<BoxInventoryChangeGenerateDto>();
|
||||
inventoryList.Add(_mapper.Map<BoxInventoryChangeGenerateDto>(dto));
|
||||
|
||||
//需要填写序列号
|
||||
//需要修改库存
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _basbicsRepositories.GetTransaction();
|
||||
Result res_Rollback = Result.ReSuccess();
|
||||
bool isSuccess = true;
|
||||
var res_Inventory = await _boxInventoryService.GenerateChangeBox(inventoryList, false);
|
||||
if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
|
||||
|
||||
if (res_Rollback.IsSuccess)
|
||||
{
|
||||
isSuccess = await _changeBoxRecordRepositories.AddRange(list, false);
|
||||
@@ -115,6 +113,11 @@ namespace WMS.Web.Domain.Services
|
||||
isSuccess = await _boxRepositories.EditEntityList(boxList, false);
|
||||
if (!isSuccess) res_Rollback= Result.ReFailure(ResultCodes.DateWriteError);
|
||||
}
|
||||
if(res_Rollback.IsSuccess)
|
||||
{
|
||||
var res_Inventory = await _boxInventoryService.GenerateChangeBox(list, false);
|
||||
if (!res_Inventory.IsSuccess) res_Rollback = res_Inventory;
|
||||
}
|
||||
//提交事务
|
||||
if (isTransaction)
|
||||
{
|
||||
@@ -134,12 +137,12 @@ namespace WMS.Web.Domain.Services
|
||||
public async Task<Result> MoveBoxSave(List<SaveMoveBoxRecordRequest> dto, bool IsUp, LoginInDto loginInfo)
|
||||
{
|
||||
//1.下架时 需要验证箱是否在库存里
|
||||
|
||||
List<MoveBoxRecord> entityList = new List<MoveBoxRecord>();
|
||||
foreach (var d in dto)
|
||||
{
|
||||
var subStock = await _basbicsRepositories.GetSubUcStockAsync(d.SubStockId, loginInfo.UserInfo.CompanyId);
|
||||
var entity = new MoveBoxRecord();
|
||||
entity.Create(IsUp == true ? MoveBoxType.Up : MoveBoxType.Down, d.BoxId, d.StockCode, d.SubStockId, loginInfo.UserInfo.StaffId);
|
||||
entity.Create(IsUp == true ? MoveBoxType.Up : MoveBoxType.Down, d.BoxId, subStock ?.ErpOrgCode, subStock?.StockCode, d.SubStockId, loginInfo.UserInfo.StaffId);
|
||||
entityList.Add(entity);
|
||||
}
|
||||
var inventoryList = _mapper.Map<List<BoxInventoryMoveGenerateDto>>(dto);
|
||||
|
||||
@@ -64,7 +64,12 @@ namespace WMS.Web.Domain.Services
|
||||
{
|
||||
List<TakeStock> list = _mapper.Map<List<TakeStock>>(dto);
|
||||
foreach (var entity in list)
|
||||
{
|
||||
var subStock = await _transactionRepositories.GetSubUcStockAsync(entity.SubStockId, loginInfo.UserInfo.CompanyId);
|
||||
entity.Create(loginInfo.UserInfo.StaffId);
|
||||
entity.OrgCode = subStock?.ErpOrgCode;
|
||||
entity.StockCode = subStock?.StockCode;
|
||||
}
|
||||
|
||||
#region 组装库存dto
|
||||
List<BoxInventoryGenerateDto> inventoryList = new List<BoxInventoryGenerateDto>();
|
||||
|
||||
Reference in New Issue
Block a user