/// <summary> /// 绑定库位产品明细 /// </summary> private void BindDepotSeatProductDetails() { dt = WareHouseProductDetailsBLL.GetMoreProductInfoByWareHouseIDDepotSeatID(Convert.ToInt32(Session["WareHouseID"]), Convert.ToInt32(Session["DepotSeatID"])); this.lbl_storename.Visible = false; if (dt.Rows.Count < 1) { this.lbl_flag.Text = GetTran("001946", "没有相关数据"); } else { this.lbl_flag.Text = GetTran("000357", "库位名称") + ":" + dt.Rows[0][1].ToString(); } this.lbl_title.Text = GetTran("000390", "库位"); string table = " ProductQuantity a,Product b,WareHouse c ,DepotSeat j"; string columus = " C.WareHouseName,j.SeatName,a.ProductID,b.ProductCode,b.ProductName," + " (select d.ProductUnitName from ProductUnit as d where ProductUnitID=b.BigProductUnitID) as ProductBigUnitName," + " (select d.ProductUnitName from ProductUnit as d where ProductUnitID=b.SmallProductUnitID) as ProductSmallUnitName ," + " b.Weight," + " convert(nvarchar(20),b.Length)+'*'+Convert(nvarchar(20),b.Width)+'*'+Convert(nvarchar(20),b.High) as Cubage," + " sum(a.TotalIn) as TotalIn," + " sum(a.TotalOut) as TotalOut ," + " sum(a.TotalIn-a.TotalOut) as TotalEnd," + " sum(b.AlertnessCount)as AlertnessCount "; string where = " a.ProductID=b.ProductID and a.WareHouseID=c.WareHouseID and c.WareHouseID=j.WareHouseID and a.DepotSeatID=j.DepotSeatID and a.DepotSeatID=" + Session["DepotSeatID"] + " and a.wareHouseID=" + Session["WareHouseID"]; string group = " C.WareHouseName,j.SeatName,a.ProductID,b.ProductCode,b.ProductName, b.BigProductUnitID,b.SmallProductUnitID, b.Weight,b.Length,b.Width,b.High"; Pager1.PageBindGroup(0, 10, table, columus, where, " a.ProductID ", group, "gvProduct"); //this.gvProduct.DataSource = dt; //this.gvProduct.DataBind(); }
protected void Butt_Excel_Click(object sender, ImageClickEventArgs e) { if (ViewState["type"].ToString() == "1") { dt = WareHouseProductDetailsBLL.GetMoreProductInfoByWareHouseID(Convert.ToInt32(Session["WareHouseID"])); Excel.OutToExcel(dt, GetTran("001943", "仓库产品明细"), new string[] { "WareHouseName=" + GetTran("000355", "仓库名称"), "ProductCode=" + GetTran("000263", "产品编码"), "ProductName=" + GetTran("000501", "产品名称"), "ProductBigUnitName=" + GetTran("001948", "产品大单位"), "ProductSmallUnitName=" + GetTran("001949", "产品小单位"), "TotalIn=" + GetTran("000359", "入库数量"), "TotalOut=" + GetTran("000362", "出库数量"), "totalend=" + GetTran("001958", "结库数量"), "AlertnessCount=" + GetTran("000365", "预警数量") }); } else { dt = WareHouseProductDetailsBLL.GetMoreProductInfoByWareHouseIDDepotSeatID(Convert.ToInt32(Session["WareHouseID"]), Convert.ToInt32(Session["DepotSeatID"])); Excel.OutToExcel(dt, GetTran("001944", "库位产品明细"), new string[] { "WareHouseName=" + GetTran("000355", "仓库名称"), "SeatName=" + GetTran("000357", "库位名称"), "ProductCode=" + GetTran("000263", "产品编码"), "ProductName=" + GetTran("000501", "产品名称"), "ProductBigUnitName=" + GetTran("001948", "产品大单位"), "ProductSmallUnitName=" + GetTran("001949", "产品小单位"), "TotalIn=" + GetTran("000359", "入库数量"), "TotalOut=" + GetTran("000362", "出库数量"), "totalend=" + GetTran("001958", "结库数量"), "AlertnessCount=" + GetTran("000365", "预警数量") }); } }
private string ProductData() { int top = 9; bool need = true; decimal other = 0; string column = ""; string result = ""; DataTable table = new DataTable(); string coll = "var data1=["; string CBLL = " var data2=["; if (ViewState["ID"].ToString() == "WareHouse") { if (ddlWareHouse.SelectedIndex != -1) { table = WareHouseProductDetailsBLL.GetMoreProductInfoByWareHouseID(Convert.ToInt32(this.ddlWareHouse.SelectedValue)); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001933", "对不起,请选择仓库!"))); return(null); } } if (ViewState["ID"].ToString() == "DepotSeat") { if (ddlWareHouse.SelectedIndex != -1) { if (ddlDepotSeat.SelectedIndex != -1) { table = WareHouseProductDetailsBLL.GetMoreProductInfoByWareHouseIDDepotSeatID(Convert.ToInt32(this.ddlWareHouse.SelectedValue), Convert.ToInt32(this.ddlDepotSeat.SelectedValue)); } else { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001934", "对不起,请选择库位!"))); return(null); } } else { Page.ClientScript.RegisterStartupScript(GetType(), "", Transforms.ReturnAlert(GetTran("001933", "对不起,请选择仓库!"))); return(null); } } column = "ProductName"; result = "TotalEnd"; int rows = table.Rows.Count; DataView dv = table.DefaultView; dv.Sort = result + "" + " Desc"; if (top >= dv.Count) { need = false; top = dv.Count; } for (int i = 0; i < top; i++) { coll += "[" + i + ",'" + dv[i][column].ToString() + "'],"; CBLL += "[" + i + "," + Convert.ToDecimal(dv[i][result].ToString()) + "],"; } if (need) { for (int i = top; i < dv.Count; i++) { other = other + Convert.ToDecimal(dv[i][column].ToString()); } coll += "{label: '" + GetTran("000470", "其它") + "',data: '" + other + "'},"; } coll = coll.Substring(0, coll.Length - 1); CBLL = CBLL.Substring(0, CBLL.Length - 1); coll += "];"; CBLL += "];"; coll += CBLL; return(coll); }