根据出库任务单获取出库任务信息
This commit is contained in:
Binary file not shown.
@@ -84,5 +84,23 @@ namespace WMS.Web.Api.Controllers
|
|||||||
return await _outStockService.merge(dto, loginInfo);
|
return await _outStockService.merge(dto, loginInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据出库单任务编号搜索
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="billNo"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
[Route("GetOutStockTaskByNo/{billNo}")]
|
||||||
|
public async Task<Result<GetOutStockTaskByNoResponse>> GetOutStockTaskByNo([FromRoute] string billNo)
|
||||||
|
{
|
||||||
|
var loginInfo = _loginService.GetLoginInfo(this.HttpContext.Request.Headers["Authorization"]);
|
||||||
|
if (loginInfo == null || loginInfo.UserInfo == null)
|
||||||
|
return Result<GetOutStockTaskByNoResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||||
|
|
||||||
|
var res= await _repositories.GetOutStockTaskByNo(billNo);
|
||||||
|
if (res == null) return Result<GetOutStockTaskByNoResponse>.ReFailure(ResultCodes.OutStockTaskNoData);
|
||||||
|
return Result<GetOutStockTaskByNoResponse>.ReSuccess(res);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,7 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="M:WMS.Web.Api.Controllers.OutStockController.Save(WMS.Web.Core.Dto.OutStock.SaveOutStockRequest)">
|
<member name="M:WMS.Web.Api.Controllers.OutStockController.Save(WMS.Web.Core.Dto.OutStock.SaveOutStockRequest)">
|
||||||
<summary>
|
<summary>
|
||||||
保存
|
保存(出库)
|
||||||
</summary>
|
</summary>
|
||||||
<param name="dto"></param>
|
<param name="dto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
@@ -230,6 +230,13 @@
|
|||||||
<param name="dto"></param>
|
<param name="dto"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:WMS.Web.Api.Controllers.OutStockTaskController.GetOutStockTaskByNo(System.String)">
|
||||||
|
<summary>
|
||||||
|
根据出库单任务编号搜索
|
||||||
|
</summary>
|
||||||
|
<param name="billNo"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Api.Controllers.SysConfigController">
|
<member name="T:WMS.Web.Api.Controllers.SysConfigController">
|
||||||
<summary>
|
<summary>
|
||||||
系统配置
|
系统配置
|
||||||
|
|||||||
@@ -2010,6 +2010,56 @@
|
|||||||
操作 Id集合
|
操作 Id集合
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:WMS.Web.Core.Dto.OutStockTask.GetOutStockTaskByNoResponse">
|
||||||
|
<summary>
|
||||||
|
根据单号搜索出库单任务信息
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.OutStockTask.GetOutStockTaskByNoResponse.Id">
|
||||||
|
<summary>
|
||||||
|
主键 订单编号
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.OutStockTask.GetOutStockTaskByNoResponse.BillNo">
|
||||||
|
<summary>
|
||||||
|
单据编号
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.OutStockTask.GetOutStockTaskByNoResponse.details">
|
||||||
|
<summary>
|
||||||
|
详情
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.OutStockTask.GetOutStockTaskByNoDetailsResponse.MaterialId">
|
||||||
|
<summary>
|
||||||
|
物料Id
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.OutStockTask.GetOutStockTaskByNoDetailsResponse.MaterialName">
|
||||||
|
<summary>
|
||||||
|
物料名称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.OutStockTask.GetOutStockTaskByNoDetailsResponse.MaterialNumber">
|
||||||
|
<summary>
|
||||||
|
物料编码
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.OutStockTask.GetOutStockTaskByNoDetailsResponse.Specifications">
|
||||||
|
<summary>
|
||||||
|
物料规格型号
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.OutStockTask.GetOutStockTaskByNoDetailsResponse.AccruedQty">
|
||||||
|
<summary>
|
||||||
|
应出库数量
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:WMS.Web.Core.Dto.OutStockTask.GetOutStockTaskByNoDetailsResponse.RealityQty">
|
||||||
|
<summary>
|
||||||
|
已出库数量
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Core.Dto.OutStockTask.OutStockTaskQueryInfoResponse">
|
<member name="T:WMS.Web.Core.Dto.OutStockTask.OutStockTaskQueryInfoResponse">
|
||||||
<summary>
|
<summary>
|
||||||
出库单任务列表
|
出库单任务列表
|
||||||
|
|||||||
@@ -889,6 +889,14 @@
|
|||||||
创建时间(erp那边的创建时间)
|
创建时间(erp那边的创建时间)
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:WMS.Web.Domain.Entitys.OutStockTaskDetails.OutStock(System.Int32,System.Decimal)">
|
||||||
|
<summary>
|
||||||
|
出库 反写 任务单
|
||||||
|
</summary>
|
||||||
|
<param name="materialId"></param>
|
||||||
|
<param name="qty"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Domain.Entitys.TakeStock">
|
<member name="T:WMS.Web.Domain.Entitys.TakeStock">
|
||||||
<summary>
|
<summary>
|
||||||
wms盘点单
|
wms盘点单
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace WMS.Web.Core.Dto.OutStockTask
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 根据单号搜索出库单任务信息
|
||||||
|
/// </summary>
|
||||||
|
public class GetOutStockTaskByNoResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 主键 订单编号
|
||||||
|
/// </summary>
|
||||||
|
public int Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 单据编号
|
||||||
|
/// </summary>
|
||||||
|
public string BillNo { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 详情
|
||||||
|
/// </summary>
|
||||||
|
public List<GetOutStockTaskByNoDetailsResponse> details { get; set; } = new List<GetOutStockTaskByNoDetailsResponse>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GetOutStockTaskByNoDetailsResponse
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 物料Id
|
||||||
|
///</summary>
|
||||||
|
public int MaterialId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料名称
|
||||||
|
/// </summary>
|
||||||
|
public string MaterialName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料编码
|
||||||
|
/// </summary>
|
||||||
|
public string MaterialNumber { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料规格型号
|
||||||
|
/// </summary>
|
||||||
|
public string Specifications { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 应出库数量
|
||||||
|
///</summary>
|
||||||
|
public decimal AccruedQty { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 已出库数量
|
||||||
|
///</summary>
|
||||||
|
public decimal RealityQty { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using WMS.Web.Core;
|
using WMS.Web.Core;
|
||||||
|
using WMS.Web.Core.Internal.Results;
|
||||||
|
using WMS.Web.Domain.Values;
|
||||||
|
|
||||||
namespace WMS.Web.Domain.Entitys
|
namespace WMS.Web.Domain.Entitys
|
||||||
{
|
{
|
||||||
@@ -74,5 +76,21 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
///</summary>
|
///</summary>
|
||||||
[Column("CreateTime")]
|
[Column("CreateTime")]
|
||||||
public DateTime? CreateTime { get; set; }
|
public DateTime? CreateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 出库 反写 任务单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="materialId"></param>
|
||||||
|
/// <param name="qty"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Result OutStock(int materialId,decimal qty)
|
||||||
|
{
|
||||||
|
if ((this.AccruedQty - this.RealityQty) < qty)
|
||||||
|
return Result.ReFailure(ResultCodes.OutStockQtyError);
|
||||||
|
|
||||||
|
this.RealityQty = this.RealityQty + qty;
|
||||||
|
|
||||||
|
return Result.ReSuccess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,13 @@ namespace WMS.Web.Domain.Infrastructure
|
|||||||
Task<List<OutStockTask>> GetEntityList(List<int> ids);
|
Task<List<OutStockTask>> GetEntityList(List<int> ids);
|
||||||
/// 修改实体集合
|
/// 修改实体集合
|
||||||
Task<bool> EditEntityList(List<OutStockTask> entitys, bool isTransaction = true);
|
Task<bool> EditEntityList(List<OutStockTask> entitys, bool isTransaction = true);
|
||||||
|
//编辑
|
||||||
|
Task<OutStockTask> Edit(OutStockTask entity, bool isTransaction = true);
|
||||||
/// 删除实体集合
|
/// 删除实体集合
|
||||||
Task<bool> DeleteEntityList(List<int> ids, bool isTransaction = true);
|
Task<bool> DeleteEntityList(List<int> ids, bool isTransaction = true);
|
||||||
//获取实体
|
//获取实体
|
||||||
Task<OutStockTask> Get(int id);
|
Task<OutStockTask> Get(int id);
|
||||||
|
//根据订单号获取订单信息
|
||||||
|
Task<GetOutStockTaskByNoResponse> GetOutStockTaskByNo(string billNo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using WMS.Web.Core.Dto.OutStock;
|
using WMS.Web.Core.Dto.OutStock;
|
||||||
|
using WMS.Web.Core.Dto.OutStockTask;
|
||||||
using WMS.Web.Domain.Entitys;
|
using WMS.Web.Domain.Entitys;
|
||||||
|
|
||||||
namespace WMS.Web.Domain.Mappers
|
namespace WMS.Web.Domain.Mappers
|
||||||
@@ -17,6 +18,10 @@ namespace WMS.Web.Domain.Mappers
|
|||||||
.ForMember(x => x.Id, ops => ops.Ignore())
|
.ForMember(x => x.Id, ops => ops.Ignore())
|
||||||
.ForMember(x => x.Fid, ops => ops.Ignore())
|
.ForMember(x => x.Fid, ops => ops.Ignore())
|
||||||
.ForMember(x => x.Qty, ops => ops.Ignore());
|
.ForMember(x => x.Qty, ops => ops.Ignore());
|
||||||
|
|
||||||
|
|
||||||
|
CreateMap<OutStockTask, GetOutStockTaskByNoResponse>();
|
||||||
|
CreateMap<OutStockTaskDetails, GetOutStockTaskByNoDetailsResponse>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,11 @@ namespace WMS.Web.Domain.Services
|
|||||||
//任务单明细
|
//任务单明细
|
||||||
var tDetail = outStockTask.Details.FirstOrDefault(f => f.MaterialId == d.MaterialId);
|
var tDetail = outStockTask.Details.FirstOrDefault(f => f.MaterialId == d.MaterialId);
|
||||||
if (tDetail == null) continue;
|
if (tDetail == null) continue;
|
||||||
var outd = _mapper.Map<OutStockDetails>(tDetail);
|
var res = tDetail.OutStock(d.MaterialId, d.Qty);
|
||||||
|
if (!res.IsSuccess) return res;
|
||||||
|
|
||||||
|
var outd = _mapper.Map<OutStockDetails>(tDetail);
|
||||||
|
|
||||||
outd.Qty = outd.Qty + d.Qty;
|
outd.Qty = outd.Qty + d.Qty;
|
||||||
entity.Details.Add(outd);
|
entity.Details.Add(outd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ namespace WMS.Web.Domain.Values
|
|||||||
|
|
||||||
//出库任务单
|
//出库任务单
|
||||||
public static ValueTuple<int, string> MergeStatusError = (70000, "所选单据数据不一致,不能合并");
|
public static ValueTuple<int, string> MergeStatusError = (70000, "所选单据数据不一致,不能合并");
|
||||||
|
public static ValueTuple<int, string> OutStockQtyError = (70001, "可出库数量不足");
|
||||||
|
public static ValueTuple<int, string> OutStockTaskNoData = (70002, "出库任务数据不存在");
|
||||||
|
|
||||||
public static ValueTuple<int, string> BoxNoData = (80000, "箱信息不存在");
|
public static ValueTuple<int, string> BoxNoData = (80000, "箱信息不存在");
|
||||||
public static ValueTuple<int, string> BoxMateriaNoData = (800010, "箱对应物料信息不存在");
|
public static ValueTuple<int, string> BoxMateriaNoData = (800010, "箱对应物料信息不存在");
|
||||||
|
|||||||
@@ -169,6 +169,42 @@ namespace WMS.Web.Repositories
|
|||||||
return res.Clone();
|
return res.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 编辑
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <param name="isTransaction"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<OutStockTask> Edit(OutStockTask entity, bool isTransaction = true)
|
||||||
|
{
|
||||||
|
IDbContextTransaction _transaction = null;
|
||||||
|
if (isTransaction)
|
||||||
|
_transaction = _context.Database.BeginTransaction();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var res = await _context.OutStockTask
|
||||||
|
.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)
|
||||||
|
{
|
||||||
|
if (_transaction != null)
|
||||||
|
_transaction.Rollback();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 列表
|
/// 列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -224,5 +260,18 @@ namespace WMS.Web.Repositories
|
|||||||
}).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
}).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
||||||
return (list, total);
|
return (list, total);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 根据订单号获取订单信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="billNo"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<GetOutStockTaskByNoResponse> GetOutStockTaskByNo(string billNo)
|
||||||
|
{
|
||||||
|
var entity = await _context.OutStockTask.Include(x => x.Details).FirstOrDefaultAsync(f => billNo.Equals(f.BillNo));
|
||||||
|
var response = _mapper.Map<GetOutStockTaskByNoResponse>(entity);
|
||||||
|
//获取物料信息 显示物料三件套
|
||||||
|
var mIds = entity.Details.Select(s => s.MaterialId).ToList();
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user