/// <summary> /// 显示销售备货单信息 /// </summary> private void ShowStockUpBillInfo() { CStockUpBillBB stockUpBillBB = new CStockUpBillBB(); CStockUpDetailBB stockUpDetailBB = new CStockUpDetailBB(); CSaleDetailBB saleDetailBB = new CSaleDetailBB(); try { vCStockUpBillData stockUpBillModel = stockUpBillBB.GetVModel(this.IdValue); string strSaleBillNos = "", strAbsEntrys = "", strLineNums = "", strWhere = "1=1"; DataSet ds = new DataSet(); this.stockUpBillNo.Text = stockUpBillModel.stockUpBillNo; this.shippingMarkNo.Text = stockUpBillModel.shippingMarkNo; this.hidCustNo.Value = stockUpBillModel.custNo;//客户编号 this.lblCustNm.Text = stockUpBillModel.custNm; this.invoiceNo.Text = stockUpBillModel.invoiceNo; this.empNm.Text = stockUpBillModel.stockUpEmpNm; this.mark.Text = stockUpBillModel.mark; this.outBillDate.Text = Convert.ToDateTime(stockUpBillModel.outStockDt).ToString("yyyy-MM-dd"); strSaleBillNos = "'" + stockUpBillModel.saleBillNos.Replace(",", "','") + "'";//销售订单编号组合 strAbsEntrys = "'" + stockUpBillModel.absEntrys.Replace(",", "','") + "'";//提货单编号组合 strLineNums = "'" + stockUpBillModel.lineNums.Replace(",", "','") + "'";//行号组合 //绑定销售订单明细列表 string[] saleBillNoArray = strSaleBillNos.Split(','); string[] absEntryArray = strAbsEntrys.Split(','); string[] lineNumArray = strLineNums.Split(','); strWhere += " and ("; for (int i = 0; i < saleBillNoArray.Length; i++) { if (i == 0) { strWhere += " (absEntry=" + absEntryArray[i] + " and saleBillNo=" + saleBillNoArray[i] + " and lineNum=" + lineNumArray[i] + ")"; } else { strWhere += " or (absEntry=" + absEntryArray[i] + " and saleBillNo=" + saleBillNoArray[i] + " and lineNum=" + lineNumArray[i] + ")"; } } strWhere += ")"; ds = saleDetailBB.GetVList(strWhere); this.gridSaleBill.DataSource = ds; this.gridSaleBill.DataBind(); //绑定备货单明细列表 ds = stockUpDetailBB.GetVList("stockUpBillNo='" + stockUpBillModel.stockUpBillNo + "'"); this.gridStockUpDetail.DataSource = ds; this.gridStockUpDetail.DataBind(); } finally { stockUpBillBB.Dispose(); stockUpDetailBB.Dispose(); saleDetailBB.Dispose(); } }
public DataTable GetStockUpDetailById(int id) { CStockUpDetailBB stockUpDetailBB = new CStockUpDetailBB(); try { DataTable dt = new DataTable(); dt = stockUpDetailBB.GetVList("id=" + id.ToString()).Tables[0]; return dt; } finally { stockUpDetailBB.Dispose(); } }
public DataTable GetStockUpDetailByWhere(string strWhere) { CStockUpDetailBB stockUpDetailBB = new CStockUpDetailBB(); try { DataTable dt = new DataTable(); dt = stockUpDetailBB.GetVList(strWhere).Tables[0]; return dt; } finally { stockUpDetailBB.Dispose(); } }
/// <summary> /// 初始化备货单明细数据源 /// </summary> private void InitDtResult() { if (this.DtResult == null) { CStockUpDetailBB stockUpDetailBB = new CStockUpDetailBB(); try { string strWhere = "stockUpBillNo=@stockUpBillNo"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@stockUpBillNo", this.StockBillNo) }; DataSet ds = stockUpDetailBB.GetVList(strWhere, param); if (ds != null && ds.Tables.Count > 0) { this.DtResult = ds.Tables[0]; this.DtResult.Columns.Add(new DataColumn("rowId", typeof(string))); this.DtResult.Columns.Add(new DataColumn("isdel", typeof(string))); this.DtResult.Columns.Add(new DataColumn("ischeck", typeof(string))); this.DtResult.Columns.Add(new DataColumn("hideAmount", typeof(string))); this.DtResult.Columns["palletIndex"].DataType = Type.GetType("System.Int32"); foreach (DataRow dr in this.DtResult.Rows) { dr["rowId"] = Guid.NewGuid().ToString(); dr["isdel"] = "0"; dr["ischeck"] = "false"; #region 记录合计行 if (dr["num"] != null && dr["num"] != DBNull.Value) { //初始化时保存amount的原始值 dr["hideAmount"] = dr["num"].ToString() == "" ? "0" : dr["num"].ToString(); } else { dr["hideAmount"] = "0"; } #endregion } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",4);", true); return; } finally { stockUpDetailBB.Dispose(); } } }