/// <summary> /// 包装后数量 /// </summary> /// <param name="data"></param> /// <param name="Search"></param> /// <returns></returns> internal bool ReadPackingNumList(out List <WarehouseProductNumModel> data, string Search) { data = new List <WarehouseProductNumModel>(); string sql = "SELECT " + " a.ProductID, " + " total(a.Quantity) as Quantity, " + " b.Number as ProductNumber, " + " b.Name as ProductName " + "FROM " + " T_Warehouse_ProductPacking a " + "LEFT JOIN T_ProductInfo_Product b on a.ProductID=b.GUID " + " WHERE (b.Number LIKE '%" + Search + "%' OR b.Name LIKE '%" + Search + "%' )" + " AND a.DeleteMark ISNULL " + " GROUP BY a.ProductID " + " ORDER BY ProductNumber"; DataSet ds = new DataSet(); if (new Helper.SQLite.DBHelper().QueryData(sql, out ds)) { int id = 1; foreach (DataRow dr in ds.Tables[0].Rows) { WarehouseProductNumModel d = new WarehouseProductNumModel(); d.Id = id++; d.ProductID = (Guid)dr["ProductID"]; d.ProductNumber = dr["ProductNumber"].ToString(); d.ProductName = dr["ProductName"].ToString(); d.Quantity = int.Parse(dr["Quantity"].ToString()); data.Add(d); } return(true); } return(false); }
private void Button_ExportData_Click(object sender, RoutedEventArgs e) { List <WarehouseProductNumModel> dn = new List <WarehouseProductNumModel>(); for (int i = 0; i < DataGrid_Num.Items.Count; i++) { WarehouseProductNumModel m = DataGrid_Num.Items[i] as WarehouseProductNumModel; dn.Add(m); } new Export().ExportData(dn, false); }