改箱服务调整
This commit is contained in:
@@ -118,17 +118,17 @@ namespace WMS.Web.Api.Controllers
|
|||||||
/// <param name="billNo">必填</param>
|
/// <param name="billNo">必填</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("GetBoxDetails")]
|
[Route("GetBox")]
|
||||||
public async Task<ResultList<BoxDetailResponse>> GetBoxDetails([FromQuery] string billNo)
|
public async Task<Result<BoxResponse>> GetBox([FromQuery] string billNo)
|
||||||
{
|
{
|
||||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||||
if (loginInfo == null || loginInfo.UserInfo == null)
|
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||||
return ResultList<BoxDetailResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
return Result<BoxResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||||
if(string.IsNullOrEmpty(billNo))
|
if (string.IsNullOrEmpty(billNo))
|
||||||
return ResultList<BoxDetailResponse>.ReSuccess(new List<BoxDetailResponse>());
|
return Result<BoxResponse>.ReSuccess(null);
|
||||||
|
|
||||||
var r = await _boxRepositories.GetDetails(billNo);
|
var r = await _boxRepositories.GetBox(billNo);
|
||||||
return ResultList<BoxDetailResponse>.ReSuccess(r);
|
return Result<BoxResponse>.ReSuccess(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,6 @@ namespace WMS.Web.Core.Dto
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class BoxDetailResponse
|
public class BoxDetailResponse
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 单据头ID
|
|
||||||
/// </summary>
|
|
||||||
public int Fid { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 箱Id
|
|
||||||
/// </summary>
|
|
||||||
public int BoxId { get; set; }
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 物料ID
|
/// 物料ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -44,6 +36,6 @@ namespace WMS.Web.Core.Dto
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 序列号集
|
/// 序列号集
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SerialNumbers { get; set; }
|
public List<string> SerialNumbers { get; set; } = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
25
src/WMS.Web.Core/Dto/BoxResponse.cs
Normal file
25
src/WMS.Web.Core/Dto/BoxResponse.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WMS.Web.Core.Dto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 箱信息(头部)
|
||||||
|
/// </summary>
|
||||||
|
public class BoxResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 单据头ID
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 箱Id
|
||||||
|
/// </summary>
|
||||||
|
public int BoxId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 明细信息
|
||||||
|
/// </summary>
|
||||||
|
public List<BoxDetailResponse> Details = new List<BoxDetailResponse>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,11 +16,6 @@ namespace WMS.Web.Core.Dto.ChangeBoxRecord
|
|||||||
[Required(ErrorMessage = "物料不能为空")]
|
[Required(ErrorMessage = "物料不能为空")]
|
||||||
public int MaterialId { get; set; }
|
public int MaterialId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 仓库Id
|
|
||||||
/// </summary>
|
|
||||||
[Required(ErrorMessage = "仓库不能为空")]
|
|
||||||
public int StockId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 原箱子ID
|
/// 原箱子ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required(ErrorMessage = "原箱子不能为空")]
|
[Required(ErrorMessage = "原箱子不能为空")]
|
||||||
@@ -31,14 +26,10 @@ namespace WMS.Web.Core.Dto.ChangeBoxRecord
|
|||||||
[Required(ErrorMessage = "目标箱子不能为空")]
|
[Required(ErrorMessage = "目标箱子不能为空")]
|
||||||
public int DestBoxId { get; set; }
|
public int DestBoxId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 原仓位ID
|
/// 数量
|
||||||
/// </summary>
|
///</summary>
|
||||||
[Required(ErrorMessage = "原仓位不能为空")]
|
[Required(ErrorMessage = "数量不能为空")]
|
||||||
public int SrcSubStockId { get; set; }
|
public decimal Qty { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// 目标仓位ID
|
|
||||||
/// </summary>
|
|
||||||
[Required(ErrorMessage = "目标仓位不能为空")]
|
|
||||||
public int DestSubStockId { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,6 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 序列号集
|
/// 序列号集
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SerialNumbers { get; set; }
|
public List<string> SerialNumbers { get; set; } = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,13 +33,18 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
/// 序列号
|
/// 序列号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Column("SerialNumbers")]
|
[Column("SerialNumbers")]
|
||||||
public string SerialNumbers { get; set; }
|
public List<string> SerialNumbers { get; set; } = new List<string>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 原箱子ID
|
/// 原箱子ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Column("SrcBoxId")]
|
[Column("SrcBoxId")]
|
||||||
public int SrcBoxId { get; set; }
|
public int SrcBoxId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 数量
|
||||||
|
///</summary>
|
||||||
|
[Column("Qty")]
|
||||||
|
public decimal Qty { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// 目标箱子ID
|
/// 目标箱子ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Column("DestBoxId")]
|
[Column("DestBoxId")]
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace WMS.Web.Domain.Infrastructure
|
|||||||
public interface IBoxRepositories
|
public interface IBoxRepositories
|
||||||
{
|
{
|
||||||
Task<Box> Get(string BoxBillNo);
|
Task<Box> Get(string BoxBillNo);
|
||||||
//根据箱号查询物料信息
|
//根据箱号查询明细信息
|
||||||
Task<List<BoxDetailResponse>> GetDetails(string BoxBillNo);
|
Task<BoxResponse> GetBox(string BoxBillNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,25 +45,31 @@ namespace WMS.Web.Repositories
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="BoxBillNo"></param>
|
/// <param name="BoxBillNo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<BoxDetailResponse>> GetDetails(string BoxBillNo)
|
public async Task<BoxResponse> GetBox(string BoxBillNo)
|
||||||
{
|
{
|
||||||
return await _context.BoxDetails
|
var entity = await _context.Box.FirstOrDefaultAsync(f => f.BoxBillNo.Equals(BoxBillNo));
|
||||||
.GroupJoin(_context.Box, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
if (entity == null) return null;
|
||||||
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
BoxResponse result = new BoxResponse()
|
||||||
.Where(w => w.order.BoxBillNo.Equals(BoxBillNo))
|
{
|
||||||
.Select(s => new BoxDetailResponse()
|
Id = entity.Id,
|
||||||
{
|
BoxId = entity.OpsBoxId
|
||||||
Fid = s.detail.Fid,
|
};
|
||||||
BoxId = s.order.OpsBoxId,
|
result.Details = await _context.BoxDetails
|
||||||
MaterialId = s.detail.MaterialId,
|
.GroupJoin(_context.Box, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||||
MaterialName = "",
|
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||||
MaterialNumber = "",
|
.Where(w => w.order.BoxBillNo.Equals(BoxBillNo))
|
||||||
Specifications = "",
|
.Select(s => new BoxDetailResponse()
|
||||||
SerialNumbers = s.detail.SerialNumbers,
|
{
|
||||||
SupplierId = s.detail.SupplierId,
|
MaterialId = s.detail.MaterialId,
|
||||||
Qty = s.detail.Qty
|
MaterialName = "",
|
||||||
})
|
MaterialNumber = "",
|
||||||
.ToListAsync();
|
Specifications = "",
|
||||||
|
SerialNumbers = s.detail.SerialNumbers,
|
||||||
|
SupplierId = s.detail.SupplierId,
|
||||||
|
Qty = s.detail.Qty
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging.Debug;
|
using Microsoft.Extensions.Logging.Debug;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json;
|
||||||
using WMS.Web.Domain.Entitys;
|
using WMS.Web.Domain.Entitys;
|
||||||
using WMS.Web.Repositories.Configuration.Log;
|
using WMS.Web.Repositories.Configuration.Log;
|
||||||
|
|
||||||
@@ -35,6 +37,10 @@ namespace WMS.Web.Repositories.Configuration
|
|||||||
{
|
{
|
||||||
ent.ToTable("t_wms_changebox_record");
|
ent.ToTable("t_wms_changebox_record");
|
||||||
ent.HasKey(x => x.Id);
|
ent.HasKey(x => x.Id);
|
||||||
|
|
||||||
|
ent.Property(f => f.SerialNumbers).HasConversion(
|
||||||
|
v => JsonConvert.SerializeObject(v),
|
||||||
|
v => JsonConvert.DeserializeObject<List<string>>(v));
|
||||||
});
|
});
|
||||||
//移箱
|
//移箱
|
||||||
builder.Entity<MoveBoxRecord>(ent =>
|
builder.Entity<MoveBoxRecord>(ent =>
|
||||||
@@ -197,6 +203,10 @@ namespace WMS.Web.Repositories.Configuration
|
|||||||
{
|
{
|
||||||
ent.ToTable("t_ops_box_details");
|
ent.ToTable("t_ops_box_details");
|
||||||
ent.HasKey(x => x.Id);
|
ent.HasKey(x => x.Id);
|
||||||
|
|
||||||
|
ent.Property(f => f.SerialNumbers).HasConversion(
|
||||||
|
v => JsonConvert.SerializeObject(v),
|
||||||
|
v => JsonConvert.DeserializeObject<List<string>>(v));
|
||||||
});
|
});
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user