private async Task <int> GetPurchaseGoodsQtyAsync(PurchaseSettingThreshold threshold, int departmentId) { var store = _storeContext.GetIndexByGoods(departmentId, threshold.HospitalGoodsId); var storeQty = store?.Qty ?? 0; var qty = 0; switch (threshold.ThresholdTypeId) { case (int)PurchaseSettingThresholdType.ByQty: if (storeQty < threshold.DownQty) { qty = threshold.UpQty - storeQty; } break; case (int)PurchaseSettingThresholdType.ByPercent: qty = await GetPurchaseGoodsQtyByPercentAsync(threshold, storeQty, departmentId); break; } return(qty); }
public Store GetIndexByGoods(int department, int goods) { return(_storeContext.GetIndexByGoods(department, goods)); }