调整箱信息接口
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -115,20 +116,23 @@ namespace WMS.Web.Api.Controllers
|
||||
/// <summary>
|
||||
/// 根据箱号获取箱信息
|
||||
/// </summary>
|
||||
/// <param name="billNo">必填</param>
|
||||
/// <param name="billNos">必填</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("GetBox")]
|
||||
public async Task<Result<BoxResponse>> GetBox([FromQuery] string billNo)
|
||||
public async Task<ResultList<BoxResponse>> GetBox([FromQuery] List<string> billNos)
|
||||
{
|
||||
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||
return Result<BoxResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
if (string.IsNullOrEmpty(billNo))
|
||||
return Result<BoxResponse>.ReSuccess(null);
|
||||
return ResultList<BoxResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
|
||||
var r = await _boxRepositories.GetBox(billNo);
|
||||
return Result<BoxResponse>.ReSuccess(r);
|
||||
var res = await _boxRepositories.GetBox(billNos);
|
||||
var bStrList = res.Select(s => s.BoxBillNo).ToList();
|
||||
var ex = billNos.Except(bStrList).ToList();
|
||||
if (ex.Count() > 0)
|
||||
return ResultList<BoxResponse>.ReFailure("箱号" + JsonConvert.SerializeObject(ex) + "不存在", 800000);
|
||||
|
||||
return ResultList<BoxResponse>.ReSuccess(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,11 +249,11 @@
|
||||
<param name="name">仓库模糊匹配 不必填</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Api.Controllers.SysConfigController.GetBox(System.String)">
|
||||
<member name="M:WMS.Web.Api.Controllers.SysConfigController.GetBox(System.Collections.Generic.List{System.String})">
|
||||
<summary>
|
||||
根据箱号获取箱信息
|
||||
</summary>
|
||||
<param name="billNo">必填</param>
|
||||
<param name="billNos">必填</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Api.Controllers.TakeStockController">
|
||||
|
||||
@@ -250,11 +250,6 @@
|
||||
物料规格型号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BoxDetailResponse.SupplierId">
|
||||
<summary>
|
||||
供应商ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BoxDetailResponse.Qty">
|
||||
<summary>
|
||||
数量(装箱数量)
|
||||
@@ -275,6 +270,11 @@
|
||||
单据头ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BoxResponse.SupplierId">
|
||||
<summary>
|
||||
供应商Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.BoxResponse.BoxBillNo">
|
||||
<summary>
|
||||
箱号
|
||||
@@ -2180,6 +2180,11 @@
|
||||
盘点实际数量(实际仓库数量)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.TakeStock.SaveTakeStockRequest.FinalQty">
|
||||
<summary>
|
||||
盘点数量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Core.Dto.TakeStock.SaveTakeStockRequest.Remark">
|
||||
<summary>
|
||||
备注
|
||||
|
||||
@@ -100,6 +100,11 @@
|
||||
箱编号(老OPS生成的箱号)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.Box.SupplierId">
|
||||
<summary>
|
||||
供应商Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.Box.CreateTime">
|
||||
<summary>
|
||||
创建时间(对应老OPS的创建时间)
|
||||
@@ -130,11 +135,6 @@
|
||||
物料ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.BoxDetails.SupplierId">
|
||||
<summary>
|
||||
供应商ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.BoxDetails.Qty">
|
||||
<summary>
|
||||
数量(装箱数量)
|
||||
@@ -909,9 +909,55 @@
|
||||
同步成功或者失败 null 就是未同步
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WMS.Web.Domain.Entitys.TakeStock.Details">
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStock.BoxId">
|
||||
<summary>
|
||||
明细
|
||||
箱Id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStock.MaterialId">
|
||||
<summary>
|
||||
物料ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStock.UnitId">
|
||||
<summary>
|
||||
单位ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStock.StockId">
|
||||
<summary>
|
||||
仓库ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStock.SubStockId">
|
||||
<summary>
|
||||
仓位ID
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStock.BeforeQty">
|
||||
<summary>
|
||||
盘点前数量(wms系统数量)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStock.AfterQty">
|
||||
<summary>
|
||||
盘点实际数量(实际仓库数量)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStock.FinalQty">
|
||||
<summary>
|
||||
盘点数量
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStock.ResultType">
|
||||
<summary>
|
||||
盘点结果类型:1为盘盈,2位盘亏
|
||||
实际仓库数量-WMS系统数量 大于0为盘盈 小于0为盘亏
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WMS.Web.Domain.Entitys.TakeStock.Remark">
|
||||
<summary>
|
||||
备注
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WMS.Web.Domain.Entitys.TakeStock.Create(System.Int32)">
|
||||
@@ -1536,6 +1582,11 @@
|
||||
mapper映射
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Mappers.BoxMapper">
|
||||
<summary>
|
||||
箱信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WMS.Web.Domain.Mappers.ChangeBoxRecordMapper">
|
||||
<summary>
|
||||
改箱
|
||||
|
||||
@@ -26,10 +26,6 @@ namespace WMS.Web.Core.Dto
|
||||
/// </summary>
|
||||
public string Specifications { get; set; }
|
||||
/// <summary>
|
||||
/// 供应商ID
|
||||
/// </summary>
|
||||
public int SupplierId { get; set; }
|
||||
/// <summary>
|
||||
/// 数量(装箱数量)
|
||||
/// </summary>
|
||||
public decimal Qty { get; set; }
|
||||
|
||||
@@ -28,10 +28,6 @@ namespace WMS.Web.Domain.Entitys
|
||||
/// </summary>
|
||||
public int MaterialId { get; set; }
|
||||
/// <summary>
|
||||
/// 供应商ID
|
||||
/// </summary>
|
||||
public int SupplierId { get; set; }
|
||||
/// <summary>
|
||||
/// 数量(装箱数量)
|
||||
/// </summary>
|
||||
public decimal Qty { get; set; }
|
||||
|
||||
@@ -82,6 +82,7 @@ namespace WMS.Web.Domain.Entitys
|
||||
public decimal FinalQty { get; set; }
|
||||
/// <summary>
|
||||
/// 盘点结果类型:1为盘盈,2位盘亏
|
||||
/// 实际仓库数量-WMS系统数量 大于0为盘盈 小于0为盘亏
|
||||
/// </summary>
|
||||
[Column("ResultType")]
|
||||
public TakeStockType ResultType { get; set; } = TakeStockType.Profit;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
{
|
||||
Task<Box> Get(int id);
|
||||
//根据箱号查询明细信息
|
||||
Task<BoxResponse> GetBox(string BoxBillNo);
|
||||
Task<List<BoxResponse>> GetBox(List<string> billNos);
|
||||
//批量修改
|
||||
Task<bool> EditEntityList(List<Box> entitys, bool isTransaction = true);
|
||||
}
|
||||
|
||||
21
src/WMS.Web.Domain/Mappers/BoxMapper.cs
Normal file
21
src/WMS.Web.Domain/Mappers/BoxMapper.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
|
||||
namespace WMS.Web.Domain.Mappers
|
||||
{
|
||||
/// <summary>
|
||||
/// 箱信息
|
||||
/// </summary>
|
||||
public class BoxMapper : Profile
|
||||
{
|
||||
public BoxMapper()
|
||||
{
|
||||
CreateMap<Box, BoxResponse>();
|
||||
CreateMap<BoxDetails, BoxDetailResponse>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,32 +50,13 @@ namespace WMS.Web.Repositories
|
||||
/// </summary>
|
||||
/// <param name="BoxBillNo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<BoxResponse> GetBox(string BoxBillNo)
|
||||
public async Task<List<BoxResponse>> GetBox(List<string> BoxBillNos)
|
||||
{
|
||||
var entity = await _context.Box.FirstOrDefaultAsync(f => f.BoxBillNo.Equals(BoxBillNo));
|
||||
if (entity == null) return null;
|
||||
BoxResponse result = new BoxResponse()
|
||||
{
|
||||
Id = entity.Id,
|
||||
SupplierId=entity.SupplierId,
|
||||
BoxBillNo = entity.BoxBillNo
|
||||
};
|
||||
result.Details = await _context.BoxDetails
|
||||
.GroupJoin(_context.Box, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
.Where(w => w.order.BoxBillNo.Equals(BoxBillNo))
|
||||
.Select(s => new BoxDetailResponse()
|
||||
{
|
||||
MaterialId = s.detail.MaterialId,
|
||||
MaterialName = "",
|
||||
MaterialNumber = "",
|
||||
Specifications = "",
|
||||
SerialNumbers = s.detail.SerialNumbers,
|
||||
SupplierId = s.detail.SupplierId,
|
||||
Qty = s.detail.Qty
|
||||
})
|
||||
.ToListAsync();
|
||||
return result;
|
||||
var list = await _context.Box.Include(x=>x.Details).Where(f => BoxBillNos.Contains(f.BoxBillNo)).ToListAsync();
|
||||
var resList = _mapper.Map<List<BoxResponse>>(list);
|
||||
//获取物料信息 显示物料三件套
|
||||
var mIds = list.SelectMany(s => s.Details).Select(s => s.MaterialId).ToList();
|
||||
return resList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user