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