出入库回退增加备注
This commit is contained in:
@@ -110,6 +110,19 @@ namespace WMS.Web.Api.Controllers
|
||||
return Result.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
return await _backRecordService.BackShelf(dto, BackRecordType.InstockOff, loginInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改备注
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("UpdateRemark")]
|
||||
public async Task<Result> UpdateRemark([FromBody] UpdateRemarkRequest 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.UpdateRemark(dto, loginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,11 @@ namespace WMS.Web.Core.Dto
|
||||
/// </summary>
|
||||
[Ignore]
|
||||
public string Stock { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,5 +39,9 @@ namespace WMS.Web.Core.Dto.BackRecord
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "序列号不能为空")]
|
||||
public List<string> SerialNumbers { get; set; } = new List<string>();
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
27
src/WMS.Web.Core/Dto/BackRecord/UpdateRemarkRequest.cs
Normal file
27
src/WMS.Web.Core/Dto/BackRecord/UpdateRemarkRequest.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Npoi.Mapper.Attributes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WMS.Web.Core.Dto.BackRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// 修改备注
|
||||
/// </summary>
|
||||
public class UpdateRemarkRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 明细ID
|
||||
/// </summary>
|
||||
public int DetailsId { get; set; }
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Values;
|
||||
|
||||
namespace WMS.Web.Domain.Entitys
|
||||
@@ -10,7 +13,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// wms出入库回退记录表
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_wms_back_record")]
|
||||
[Table("t_wms_back_record")]
|
||||
public class BackRecord
|
||||
{
|
||||
/// <summary>
|
||||
@@ -89,5 +92,18 @@ namespace WMS.Web.Domain.Entitys
|
||||
}
|
||||
this.BillNo = "CR" + idStr;
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改备注
|
||||
/// </summary>
|
||||
/// <param name="detailId"></param>
|
||||
/// <param name="remark"></param>
|
||||
/// <returns></returns>
|
||||
public Result UpdateRemark(int detailId, string remark)
|
||||
{
|
||||
var detail = this.Details.Where(w => w.Id == detailId).FirstOrDefault();
|
||||
if (detail == null) return Result.ReFailure(ResultCodes.NoDateError);
|
||||
detail.Remark = remark;
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using WMS.Web.Core;
|
||||
|
||||
namespace WMS.Web.Domain.Entitys
|
||||
{
|
||||
@@ -10,12 +11,12 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[Table("t_wms_back_record_details")]
|
||||
public class BackRecordDetails
|
||||
public class BackRecordDetails : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// 编号
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
public override int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 回退记录表ID
|
||||
/// </summary>
|
||||
@@ -39,5 +40,9 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// 序列号集
|
||||
/// </summary>
|
||||
public List<string> SerialNumbers { get; set; } = new List<string>();
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,5 +22,13 @@ namespace WMS.Web.Domain.IService
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<Result> BackShelf(BackRecordOnOffRequest dto, BackRecordType type, LoginInDto loginInfo);
|
||||
|
||||
/// <summary>
|
||||
/// 修改备注
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
Task<Result> UpdateRemark(UpdateRemarkRequest dto, LoginInDto loginInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,5 +28,9 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
/// <param name="isTransaction"></param>
|
||||
/// <returns></returns>
|
||||
Task<BackRecord> Add(BackRecord entity, bool isTransaction = true);
|
||||
//修改
|
||||
Task<BackRecord> Edit(BackRecord entity, bool isTransaction = true);
|
||||
//获取
|
||||
Task<BackRecord> GetEntity(int id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace WMS.Web.Domain.Services
|
||||
else
|
||||
_logger.LogInformation($"回退上架:{JsonConvert.SerializeObject(dto)} 操作人:{loginInfo.UserInfo.StaffId + loginInfo.UserInfo.Nickname}");
|
||||
//回退上下架:不能扫同样的箱,按箱入库时候
|
||||
if (dto.Details != null && dto.Details.Count != 0 && dto.Method== (int)InventoryInOutMethod.Box)
|
||||
if (dto.Details != null && dto.Details.Count != 0 && dto.Method == (int)InventoryInOutMethod.Box)
|
||||
{
|
||||
var mIds = dto.Details.GroupBy(g => g.MaterialNumber).Select(s => s.Key).ToList();
|
||||
foreach (var m in mIds)
|
||||
@@ -113,11 +113,11 @@ namespace WMS.Web.Domain.Services
|
||||
return boxInventoryResult;
|
||||
|
||||
//下架:需要解绑收货过的箱子
|
||||
if (entity.Type == BackRecordType.InstockOff)
|
||||
if (entity.Type == BackRecordType.InstockOff)
|
||||
{
|
||||
_logger.LogInformation("入库回退下架:" + entity.BillNo);
|
||||
var boxIds= entity.Details.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
||||
var unBindResult= await _inStockTaskBoxService.UnBind(boxIds, isTransaction);
|
||||
var boxIds = entity.Details.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
||||
var unBindResult = await _inStockTaskBoxService.UnBind(boxIds, isTransaction);
|
||||
_logger.LogInformation("入库回退下架-BOXID:" + JsonConvert.SerializeObject(boxIds));
|
||||
if (!unBindResult.IsSuccess)
|
||||
return unBindResult;
|
||||
@@ -132,5 +132,24 @@ namespace WMS.Web.Domain.Services
|
||||
return Result.ReSuccess();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改备注
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="loginInfo"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public async Task<Result> UpdateRemark(UpdateRemarkRequest dto, LoginInDto loginInfo)
|
||||
{
|
||||
var entity = await _backRecordRepositories.GetEntity(dto.Id);
|
||||
if (entity == null) return Result.ReFailure(ResultCodes.NoDateError);
|
||||
|
||||
var res = entity.UpdateRemark(dto.DetailsId, dto.Remark);
|
||||
if (!res.IsSuccess) return res;
|
||||
|
||||
entity = await _backRecordRepositories.Edit(entity, true);
|
||||
if (entity == null) return Result.ReFailure(ResultCodes.DateWriteError);
|
||||
return Result.ReSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ 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.Domain.Mappers;
|
||||
using WMS.Web.Domain.Values.Single;
|
||||
using WMS.Web.Repositories.Configuration;
|
||||
|
||||
@@ -122,6 +123,7 @@ namespace WMS.Web.Repositories
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, companyId, s.order.StockCode + s.order.OrgCode),
|
||||
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocksJoinOrgCode, companyId, s.order.SubStockCode + s.order.StockCode + s.order.OrgCode),
|
||||
SerialNumbers = (string.Join(",", s.detail.SerialNumbers)).TrimEnd(','),
|
||||
Remark=s.detail.Remark
|
||||
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
||||
|
||||
return (list,total);
|
||||
@@ -171,5 +173,42 @@ namespace WMS.Web.Repositories
|
||||
{
|
||||
return await GetPagedList(dto,companyId);
|
||||
}
|
||||
|
||||
public async Task<BackRecord> Edit(BackRecord entity, bool isTransaction = true)
|
||||
{
|
||||
IDbContextTransaction _transaction = null;
|
||||
if (isTransaction)
|
||||
_transaction = _context.Database.BeginTransaction();
|
||||
|
||||
try
|
||||
{
|
||||
var res = await _context.BackRecord
|
||||
.Include(s => s.Details)
|
||||
.FirstOrDefaultAsync(f => f.Id == entity.Id);
|
||||
if (res == null) return null;
|
||||
|
||||
_mapper.Map(entity, res);
|
||||
_mapper.ToMapList(entity.Details, res.Details);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
if (_transaction != null)
|
||||
_transaction.Commit();
|
||||
|
||||
return res;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (_transaction != null)
|
||||
_transaction.Rollback();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BackRecord> GetEntity(int id)
|
||||
{
|
||||
return await _context.BackRecord.AsNoTracking()
|
||||
.Include(s => s.Details)
|
||||
.Where(f => id == f.Id).FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user