/// <summary> /// 设置金额信息 /// </summary> /// <param name="goods">物品信息</param> /// <param name="storageID">库房ID</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作成功返回True,操作失败返回False</returns> private bool SetPriceInfo(S_HomemadeRejectList goods, string storageID, out string error) { decimal factUnitPrice = 0; decimal planUnitPrice = 0; if (!m_basicGoodsServer.GetPlanUnitPrice(goods.GoodsID, out planUnitPrice, out error)) { return(false); } goods.PlanUnitPrice = planUnitPrice; goods.PlanPrice = planUnitPrice * goods.Amount; goods.UnitPrice = factUnitPrice; goods.Price = factUnitPrice * goods.Amount; goods.TotalPrice = CalculateClass.GetTotalPrice(goods.Price); return(true); }
/// <summary> /// 设置金额信息 /// </summary> /// <param name="orderFormNumber">订单号</param> /// <param name="goods">物品信息</param> /// <param name="storageID">库房ID</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>返回操作是否成功的标志</returns> public bool SetPriceInfo(string orderFormNumber, S_MaterialListRejectBill goods, string storageID, out string error) { decimal factUnitPrice = 0; decimal planUnitPrice = 0; if (!string.IsNullOrEmpty(orderFormNumber)) { if (orderFormNumber.Length > 3 && orderFormNumber.Substring(0, 3) == "BFD") { factUnitPrice = m_storeServer.GetFactUnitPrice(goods.GoodsID, goods.Provider, goods.BatchNo, storageID); } else { string strSql = "select b.UnitPrice/(1+cess/100) as UnitPrice from B_OrderFormInfo as a " + " inner join B_BargainInfo as d on a.BargainNumber = d.BargainNumber " + " inner join B_BargainGoods as b on a.BargainNumber = b.BargainNumber " + " where a.orderFormNumber = '" + orderFormNumber + "' and b.GoodsID = " + Convert.ToInt32(goods.GoodsID); DataTable dtBargainPrice = GlobalObject.DatabaseServer.QueryInfo(strSql); if (dtBargainPrice.Rows.Count == 0) { factUnitPrice = 0; } else { //委外报检的物品单价直接从委外报检入库单中的单价金额获得 if (goods.BatchNo.Contains("WJD")) { strSql = " select UnitPrice from S_CheckOutInDepotForOutsourcingBill where Bill_ID = '" + goods.BatchNo + "' "; DataTable dtRawMaterialPrice = GlobalObject.DatabaseServer.QueryInfo(strSql); if (dtRawMaterialPrice.Rows.Count == 0) { factUnitPrice = 0; } else { factUnitPrice = Convert.ToDecimal(dtRawMaterialPrice.Rows[0][0]); } } else { factUnitPrice = Convert.ToDecimal(dtBargainPrice.Rows[0][0].ToString()); } } } } if (!m_basicGoodsServer.GetPlanUnitPrice(goods.GoodsID, out planUnitPrice, out error)) { return(false); } goods.PlanUnitPrice = planUnitPrice; goods.PlanPrice = planUnitPrice * goods.Amount; goods.UnitPrice = factUnitPrice; goods.Price = factUnitPrice * goods.Amount; goods.TotalPrice = CalculateClass.GetTotalPrice(goods.Price); return(true); }