/// <summary> /// 加有效库存 /// </summary> /// <param name="storeParam">库存处理参数</param> /// <returns>处理结果</returns> public DGStoreResult AddValidStore(StoreParam storeParam) { DGStoreResult result = new DGStoreResult { Result = 1 }; //默认 if (storeParam != null) { DS_ValidStorage storage = NewDao <IDSDao>().GetValidStoreageInfo(storeParam.DeptID, storeParam.DrugID); if (storage == null) { if (storeParam.Amount >= 0) { storage = NewObject <DS_ValidStorage>(); storage.StorageID = storeParam.StorageId; storage.DeptID = storeParam.DeptID; storage.DrugID = storeParam.DrugID; storage.ValidAmount = storeParam.Amount; int iRtn = storage.save(); result.Result = 0; } else { result.Result = 1; } } else { storage.ValidAmount += storeParam.Amount;//不考虑有效库存的正负数 int iRtn = storage.save(); } } return(result); }
/// <summary> /// 更新有效库存 /// </summary> /// <param name="storageID">库存ID</param> /// <param name="reduceAmount">数量</param> /// <returns>库存处理结果</returns> public int UpdateValidStore(int storageID, decimal reduceAmount) { int iRtn = 0; DS_ValidStorage validStorage = (DS_ValidStorage)NewObject <DS_ValidStorage>().getmodel(storageID); if (validStorage != null) { validStorage.ValidAmount = validStorage.ValidAmount + reduceAmount; iRtn = validStorage.save(); } return(iRtn); }
/// <summary> /// 减有效库存 /// </summary> /// <param name="storeParam">库存参数</param> /// <returns>处理结果</returns> public DGStoreResult ReduceValidStore(StoreParam storeParam) { DGStoreResult result = new DGStoreResult { Result = 1 }; //默认 if (storeParam != null) { DS_ValidStorage storage = NewDao <IDSDao>().GetValidStoreageInfo(storeParam.DeptID, storeParam.DrugID); if (storage == null) { result.Result = 1; } else { storage.ValidAmount -= storeParam.Amount; storage.save(); result.Result = 0; } } return(result); }