public static void CalcOutput(string output, string FWQ) { DataRow dr = m_outputdt.NewRow(); try { List <DBItemInSale> lst_iteminsale = DBItemInSale.GetItemInSaleByName(output.Trim(), FWQ); if (lst_iteminsale.Count > 0) { DBItemInSale iteminsale = lst_iteminsale[0]; DBItem item = DBItem.GetItemByName(output, FWQ); float profit = iteminsale.avgprice - item.avgprice; dr["name"] = output; dr["avgprice"] = item.avgprice; dr["lowprice"] = item.lowprice; dr["highprice"] = item.highprice; dr["updatetime"] = item.updatetime; dr["FWQ"] = item.FWQ; dr["num"] = iteminsale.avgnum; dr["avgsaleprice"] = iteminsale.avgprice; dr["avgprofit"] = profit; dr["avgprofitrate"] = profit / item.avgprice; TimeSpan ts = new TimeSpan(0, m_manufacturingcycle, 0); dr["manufacturingcycle"] = String.Format("{0}天", ts.Days); m_outputdt.Rows.Add(dr); } } catch (Exception ex) { } }
public static float UpdateItemFromInSale(string name, string FWQ) { float avgprice = float.MaxValue; List <DBItemInSale> lst_iteminsale = DBItemInSale.GetItemInSaleByName(name.Trim(), FWQ); if (lst_iteminsale.Count > 0) { DBItemInSale iteminsale = lst_iteminsale[0]; avgprice = iteminsale.avgprice; DBItem.UpdateItem(iteminsale.name, iteminsale.avgprice, iteminsale.avgprice, iteminsale.lowprice, iteminsale.highprice, System.DateTime.Now, iteminsale.FWQ, Constant.FORMULAAH); } return(avgprice); }