调整盘点单
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Domain.Values;
|
||||
|
||||
namespace WMS.Web.Domain.Entitys
|
||||
{
|
||||
@@ -40,9 +41,55 @@ namespace WMS.Web.Domain.Entitys
|
||||
[Column("SuccessSync")]
|
||||
public bool? SuccessSync { get; set; }
|
||||
/// <summary>
|
||||
/// 明细
|
||||
/// 箱Id
|
||||
/// </summary>
|
||||
public List<TakeStockDetails> Details = new List<TakeStockDetails>();
|
||||
[Column("BoxId")]
|
||||
public int BoxId { get; set; }
|
||||
/// <summary>
|
||||
/// 物料ID
|
||||
/// </summary>
|
||||
[Column("MaterialId")]
|
||||
public int MaterialId { get; set; }
|
||||
/// <summary>
|
||||
/// 单位ID
|
||||
/// </summary>
|
||||
[Column("UnitId")]
|
||||
public int UnitId { get; set; }
|
||||
/// <summary>
|
||||
/// 仓库ID
|
||||
/// </summary>
|
||||
[Column("StockId")]
|
||||
public int StockId { get; set; }
|
||||
/// <summary>
|
||||
/// 仓位ID
|
||||
/// </summary>
|
||||
[Column("SubStockId")]
|
||||
public int SubStockId { get; set; }
|
||||
/// <summary>
|
||||
/// 盘点前数量(wms系统数量)
|
||||
/// </summary>
|
||||
[Column("BeforeQty")]
|
||||
public decimal BeforeQty { get; set; }
|
||||
/// <summary>
|
||||
/// 盘点实际数量(实际仓库数量)
|
||||
/// </summary>
|
||||
[Column("AfterQty")]
|
||||
public decimal AfterQty { get; set; }
|
||||
/// <summary>
|
||||
/// 盘点后数量
|
||||
/// </summary>
|
||||
[Column("FinalQty")]
|
||||
public decimal FinalQty { get; set; }
|
||||
/// <summary>
|
||||
/// 盘点结果类型:1为盘盈,2位盘亏
|
||||
/// </summary>
|
||||
[Column("ResultType")]
|
||||
public TakeStockType ResultType { get; set; } = TakeStockType.Profit;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Column("Remark")]
|
||||
public string Remark { get; set; }
|
||||
/// <summary>
|
||||
/// 创建
|
||||
/// </summary>
|
||||
|
||||
@@ -91,10 +91,10 @@ namespace WMS.Web.Repositories.Configuration
|
||||
ent.ToTable("t_wms_takestock");
|
||||
ent.HasKey(x => x.Id);
|
||||
|
||||
ent.HasMany(p => p.Details)
|
||||
.WithOne()
|
||||
.HasForeignKey(p => p.Fid)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
//ent.HasMany(p => p.Details)
|
||||
// .WithOne()
|
||||
// .HasForeignKey(p => p.Fid)
|
||||
// .OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
builder.Entity<TakeStockDetails>(ent =>
|
||||
{
|
||||
|
||||
@@ -77,40 +77,40 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<(List<TakeStockQueryInfoResponse> list, int total)> GetListAsync(TakeStockQueryRequest dto)
|
||||
{
|
||||
var query = _context.TakeStockDetails
|
||||
.GroupJoin(_context.TakeStock, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
.OrderByDescending(o => o.order.Id)
|
||||
var query = _context.TakeStock
|
||||
//.GroupJoin(_context.TakeStock, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||
//.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||
.OrderByDescending(o => o.Id)
|
||||
.Where(adv => 1 == 1);
|
||||
|
||||
if (dto.ResultType != null)
|
||||
query = query.Where(w => w.detail.ResultType == (TakeStockType)dto.ResultType);
|
||||
query = query.Where(w => w.ResultType == (TakeStockType)dto.ResultType);
|
||||
if (!string.IsNullOrEmpty(dto.BillNo))
|
||||
query = query.Where(w => EF.Functions.Like(w.order.BillNo, "%" + dto.BillNo + "%"));
|
||||
query = query.Where(w => EF.Functions.Like(w.BillNo, "%" + dto.BillNo + "%"));
|
||||
if (dto.StockId != null)
|
||||
query = query.Where(w => w.detail.StockId == dto.StockId);
|
||||
query = query.Where(w => w.StockId == dto.StockId);
|
||||
if (dto.DateBeginDate != null)
|
||||
query = query.Where(w => w.order.Date >= dto.DateBeginDate);
|
||||
query = query.Where(w => w.Date >= dto.DateBeginDate);
|
||||
if (dto.DateEndDate != null)
|
||||
query = query.Where(w => w.order.Date <= dto.DateEndDate);
|
||||
query = query.Where(w => w.Date <= dto.DateEndDate);
|
||||
//组装
|
||||
int total = await query.CountAsync();
|
||||
var list = await query.Select(s => new TakeStockQueryInfoResponse()
|
||||
{
|
||||
#region dto组装
|
||||
Id = s.order.Id,
|
||||
BillNo = s.order.BillNo,
|
||||
Unit = _singleDataService.GetSingleData(SingleAction.Units, _loginRepositories.CompanyId, s.detail.UnitId),
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.detail.StockId),
|
||||
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.detail.SubStockId),
|
||||
BeforeQty = s.detail.BeforeQty,
|
||||
AfterQty = s.detail.AfterQty,
|
||||
FinalQty = s.detail.FinalQty,
|
||||
ResultType = s.detail.ResultType.GetRemark(),
|
||||
Remark = s.detail.Remark,
|
||||
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.CreatorId),
|
||||
Date = s.order.Date.DateToStringSeconds(),
|
||||
SuccessSync = s.order.SuccessSync
|
||||
Id = s.Id,
|
||||
BillNo = s.BillNo,
|
||||
Unit = _singleDataService.GetSingleData(SingleAction.Units, _loginRepositories.CompanyId, s.UnitId),
|
||||
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.StockId),
|
||||
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.SubStockId),
|
||||
BeforeQty = s.BeforeQty,
|
||||
AfterQty = s.AfterQty,
|
||||
FinalQty = s.FinalQty,
|
||||
ResultType = s.ResultType.GetRemark(),
|
||||
Remark = s.Remark,
|
||||
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.CreatorId),
|
||||
Date = s.Date.DateToStringSeconds(),
|
||||
SuccessSync = s.SuccessSync
|
||||
#endregion
|
||||
|
||||
}).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
|
||||
|
||||
Reference in New Issue
Block a user