diff --git a/src/WMS.Web.Domain/Entitys/TakeStock.cs b/src/WMS.Web.Domain/Entitys/TakeStock.cs
index 353aff6c..4a368931 100644
--- a/src/WMS.Web.Domain/Entitys/TakeStock.cs
+++ b/src/WMS.Web.Domain/Entitys/TakeStock.cs
@@ -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; }
///
- /// 明细
+ /// 箱Id
///
- public List Details = new List();
+ [Column("BoxId")]
+ public int BoxId { get; set; }
+ ///
+ /// 物料ID
+ ///
+ [Column("MaterialId")]
+ public int MaterialId { get; set; }
+ ///
+ /// 单位ID
+ ///
+ [Column("UnitId")]
+ public int UnitId { get; set; }
+ ///
+ /// 仓库ID
+ ///
+ [Column("StockId")]
+ public int StockId { get; set; }
+ ///
+ /// 仓位ID
+ ///
+ [Column("SubStockId")]
+ public int SubStockId { get; set; }
+ ///
+ /// 盘点前数量(wms系统数量)
+ ///
+ [Column("BeforeQty")]
+ public decimal BeforeQty { get; set; }
+ ///
+ /// 盘点实际数量(实际仓库数量)
+ ///
+ [Column("AfterQty")]
+ public decimal AfterQty { get; set; }
+ ///
+ /// 盘点后数量
+ ///
+ [Column("FinalQty")]
+ public decimal FinalQty { get; set; }
+ ///
+ /// 盘点结果类型:1为盘盈,2位盘亏
+ ///
+ [Column("ResultType")]
+ public TakeStockType ResultType { get; set; } = TakeStockType.Profit;
+ ///
+ /// 备注
+ ///
+ [Column("Remark")]
+ public string Remark { get; set; }
///
/// 创建
///
diff --git a/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs b/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs
index 23bdb3fe..26d0c222 100644
--- a/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs
+++ b/src/WMS.Web.Repositories/Configuration/RepositoryDbContext.cs
@@ -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(ent =>
{
diff --git a/src/WMS.Web.Repositories/TakeStockRepositories.cs b/src/WMS.Web.Repositories/TakeStockRepositories.cs
index 73215d98..36e39508 100644
--- a/src/WMS.Web.Repositories/TakeStockRepositories.cs
+++ b/src/WMS.Web.Repositories/TakeStockRepositories.cs
@@ -77,40 +77,40 @@ namespace WMS.Web.Repositories
///
public async Task<(List 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();