using Rhea.Common;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using Tiger.IBusiness;
|
using Tiger.Model;
|
|
namespace Tiger.Business.WMS
|
{
|
/// <summary>
|
/// 条码库存信息,包括仓库,储区,货架,储位,父条码,包装明细等
|
/// </summary>
|
public class Inventory : IInventory
|
{
|
public string SN { get; set; }
|
public Barcode Barcode { get; set; }
|
public bool IsQRCode => Barcode.IsQRCode;
|
public WMS_ITEM_EXT ExtInfo { get; set; }
|
public BAS_ITEM ItemInfo { get; set; }
|
public WMS_WAREHOUSE Warehouse { get; set; }
|
public WMS_REGION Region { get; set; }
|
public WMS_SHELF Shelf { get; set; }
|
public WMS_LOCATION Location { get; set; }
|
public WMS_ITEM_PKG ParentPkg { get; set; }
|
public List<WMS_ITEM_PKG> Packages { get; set; } = new List<WMS_ITEM_PKG>();
|
public List<WMS_ITEM> Items { get; set; } = new List<WMS_ITEM>();
|
public List<WMS_ITEM_EXT> ItemsExt { get; set; } = new List<WMS_ITEM_EXT>();
|
public List<WMS_ITEM_HIS> History { get; set; } = new List<WMS_ITEM_HIS>();
|
public List<WMS_ITEM.STATUSs> StatusList => Items.GroupBy(q => q.STATUS).Select(q => new { Status = q.Key.GetEnum<WMS_ITEM.STATUSs>(), Count = q.Count() }).OrderByDescending(q => q.Count).Select(q => q.Status).ToList();
|
public bool isNormalStatus => Items.Select(q => q.STATUS).Distinct().Count() == 1;
|
public WMS_ITEM.STATUSs Status => StatusList?.FirstOrDefault() ?? WMS_ITEM.STATUSs.NotExists;
|
public WMS_ITEM_PKG CurPkg => Packages.FirstOrDefault(q => q.SN == SN);
|
public bool isExists => CurPkg != null;
|
public bool isMinPackage => Items.Count == 1 && Items.Single().SN == SN;
|
|
public void UpdatePkgQty()
|
{
|
this.Packages = WMS_ITEM_PKG.UpdateQty(this.Packages);
|
}
|
}
|
}
|