protected decimal CountDone(DepotObject obj) { var query = obj.DepotIn.ToList(); var amount = 0M; foreach (var g in query.GroupBy(o => o.Note)) { amount += XININ.Where(o => o.Note == g.Key).Sum(o => o.Amount); } return (amount); }
protected string CountTotal(DepotObject obj) { var query = obj.DepotUseX.Where(o => o.ReturnedAmount < o.Amount); var noOut = query.Count() > 0 ? query.Where(o => o.Type == UseType.借用).Sum(o => o.Amount - o.ReturnedAmount) : 0; return (obj.Amount + noOut).ToAmount(Depot.Featured(DepotType.小数数量库)); }
public static void DepotObjectAddX(this DepotEntities db, Guid id, List<Guid> catalogIds, Guid depotId, string name, bool single, bool consumable, bool @fixed, string fixedCard, string fixedNumber, string brand, string extension, string unit, string specification, decimal low, decimal high, string pa, string pb, string pc, string pd, string note, int ordinal) { var obj = new DepotObject { Id = id, Name = name, PinYin = db.ToPinYin(name).Single(), Single = single, Consumable = consumable, Fixed = @fixed, FixedCard = fixedCard, FixedNumber = fixedNumber, Brand = brand, Extension = extension, Unit = unit, Specification = specification, Low = low, High = high, ImageA = pa, ImageB = pb, ImageC = pc, ImageD = pd, Note = note, Ordinal = ordinal, State = State.启用, Code = string.Empty, Amount = 0.00M, Money = 0.00M }; db.DepotObject.Add(obj); for (var i = 0; i < catalogIds.Count; i++) { db.DepotObjectCatalog.Add(new DepotObjectCatalog { ObjectId = id, CatalogId = catalogIds[i], IsVirtual = true, Level = i, IsLeaf = i == catalogIds.Count - 1 }); } db.SaveChanges(); obj.Code = db.ToQR(CodeType.Object, obj.AutoId); db.SaveChanges(); db.DepotDictionaryAdd(depotId, DictionaryType.单位, unit); db.DepotDictionaryAdd(depotId, DictionaryType.规格, specification); db.DepotDictionaryAdd(depotId, DictionaryType.品牌, brand); }
protected decimal CountTotal(DepotObject obj) { var query = obj.DepotUseX.Where(o => o.ReturnedAmount < o.Amount); var noOut = query.Count() > 0 ? query.Where(o => o.Type == UseType.借用).Sum(o => o.Amount - o.ReturnedAmount) : 0; return (obj.Amount + noOut); }