public void ProcessRequest(HttpContext context) { string title = context.Request.Form["title"]; string strSql = string.Format("SELECT top 5 fname FROM t_user"); DataTable dt = SqlHelper1.getTable(strSql, null); StringBuilder sb = new StringBuilder(); if (dt.Rows.Count > 0) { sb.Append("<ul>"); for (int i = 0; i < dt.Rows.Count; i++) { sb.Append(string.Format(dt.Rows[i][0].ToString())); } sb.Append("</ul>"); } context.Response.Write(sb.ToString()); //JavaScriptSerializer ser = new JavaScriptSerializer(); //context.Response.Write(ser.Serialize(sb.ToString())); //List<realSchoolInfoViewModel> schoolInfo = iRegister.QueryAllSchoolInfo(schoolname); //List<string> results = new List<string>(); ////定义数组,添加返回的集合中的学校名称字段 //for (int i = 0; i < schoolInfo.Count; i++) //{ // string allName = schoolInfo[i].schoolName.ToString(); // results.Add(allName); //} //返回json串 //return Json(results, JsonRequestBehavior.AllowGet); //context.Response.ContentType = "text/plain"; //context.Response.Write("Hello World"); }
private static string getdjhm() { DataTable FahdNumMax = SqlHelper1.ExecuteDataSetText(CommandType.StoredProcedure, "proc_get_nummax_fahd", null).Tables[0]; string djhm = FahdNumMax.Rows[0][0].ToString(); return(djhm); }
private static string getNumber() { DataTable FahdNumMax = SqlHelper1.ExecuteDataSetText(CommandType.StoredProcedure, "proc_get_nummax_jggl", null).Tables[0]; string Number = FahdNumMax.Rows[0][0].ToString(); return(Number); }
protected void btnAdd_Click(object sender, EventArgs e) { txtwuliao.Text = ""; txtFModel.Text = ""; string FNumber = txtFNumber_xx.Text; string FName = txtFName_xx.Text; string FModel = txtFModel_xx.Text; decimal Amount = string.IsNullOrEmpty(txtAmount_xx.Text) ? 0 : Convert.ToDecimal(txtAmount_xx.Text); decimal Price = Convert.ToDecimal(txtPrice_xx.Text); decimal Total = string.IsNullOrEmpty(txtTotal_xx.Text) ? 0 : Convert.ToDecimal(txtTotal_xx.Text); int FInterID = Convert.ToInt32(danju_no.Text); if (Total > 0) { //新增物料 string sql = string.Format(@"insert into fahuodan_wl(FNumber,FName,FModel,Amount,Price,Total,FInterID) VALUES('{0}','{1}','{2}',{3},{4},{5},{6})", FNumber, FName, FModel, Amount, Price, Total, FInterID); SqlHelper1.ExecteNonQueryText(sql, null); //Response.Write("<script>alert('物料添加成功!');location='javascript:history.go(-1);'</script>"); txtwuliao.Focus(); //查询物料显示在表3 sql = string.Format(@"select FName,FModel,Amount,Price,Total from fahuodan_wl where FInterID={0} order by Id desc", FInterID); DataTable dt = SqlHelper1.getTable(sql, null); Repeater3.DataSource = dt; Repeater3.DataBind(); } else { Response.Write("<script>alert('金额为零,请点击金额计算按钮!');location='javascript:history.go(-1);'</script>"); } }
private static void UpdatePrice(decimal _FPrice, int _FItemID, int _FRelatedID) { string upDatetime = DateTime.Now.ToString(); // 2018-3-16 10:02:10 int whrID = 16394; string sql = string.Format(@"update ICPrcPlyEntry set FPrice={0},FmaintDate='{3}',fmainterID={4} where FItemID='{1}' and FRelatedID={2}", _FPrice, _FItemID, _FRelatedID, upDatetime, whrID); SqlHelper1.ExecteNonQueryText(sql, null); }
private static DataTable del(int FbillNo_Del, int nm_Del) { string sql; sql = string.Format(@"delete z_jggl where djhm={0} and nm={1}", FbillNo_Del, nm_Del); SqlHelper1.ExecteNonQueryText(sql, null); sql = string.Format(@"select * from z_jggl where djhm={0}", FbillNo_Del); DataTable dt_del = SqlHelper1.getTable(sql, null); return(dt_del); }
private static DataTable getKeHu(string kehuName) { string strSql = string.Format(@"SELECT top 5 orgn.FNumber,orgn.FName,orgn.FPhone, orgn.FTypeID,sube.FName as suFName,emp.FName as empFName FROM t_Organization orgn LEFT JOIN dbo.t_SubMessage sube ON orgn.FTypeID=sube.FInterID LEFT JOIN dbo.t_EMP emp on orgn.F_103=emp.Fitemid WHERE orgn.FName LIKE '%{0}%'OR orgn.FPhone LIKE '%{0}%'", kehuName); DataTable dt = SqlHelper1.getTable(strSql, null); return(dt); }
private static DataTable getWuLiao_DEL(string FNumber, string pihao, int FInterID) { //新增物料 string sql = string.Format(@"delete fahuodan_wl where FNumber='{0}' and pihao='{1}' and FInterID={2}", FNumber, pihao, FInterID); SqlHelper1.ExecteNonQueryText(sql, null); //查询物料显示在表3 sql = string.Format(@"select FNumber,FInterID,FName,FModel,Amount,Price,Total,dengji,danwei,pihao,chandi from fahuodan_wl where FInterID={0} order by Id desc", FInterID); DataTable dt = SqlHelper1.getTable(sql, null); return(dt); }
private static DataTable getWuLiao_zs(string FNumber, string FName, string FModel, decimal Amount, decimal Price, decimal Total, int FInterID, string dengji, string danwei, string pihao, string chandi) { //新增物料 string sql = string.Format(@"insert into fahuodan_wl(FNumber,FName,FModel,Amount,Price,Total,FInterID,dengji,danwei,pihao,chandi) VALUES('{0}','{1}','{2}',{3},{4},{5},{6},'{7}','{8}','{9}','{10}')", FNumber, FName, FModel, Amount, Price, Total, FInterID, dengji, danwei, pihao, chandi); SqlHelper1.ExecteNonQueryText(sql, null); //查询物料显示在表3 sql = string.Format(@"select FNumber,FInterID,FName,FModel,Amount,Price,Total,dengji,danwei,pihao,chandi from fahuodan_wl where FInterID={0} order by Id desc", FInterID); DataTable dt = SqlHelper1.getTable(sql, null); return(dt); }
public void ProcessRequest(HttpContext context) { string pcontent = context.Request.Form["pcontent"]; switch (pcontent) { case "kehu": //客户资料 string kehuName = context.Request.Form["kehuName"]; DataTable dt = getKeHu(kehuName); string jsonString = string.Empty; jsonString = JsonConvert.SerializeObject(dt); context.Response.Write(jsonString); break; case "djhm": //单据号码 DataTable FahdNumMax = SqlHelper1.ExecuteDataSetText(CommandType.StoredProcedure, "proc_get_nummax_fahd", null).Tables[0]; string danju_no = FahdNumMax.Rows[0][0].ToString(); context.Response.Write(danju_no); break; case "wuliao": //物料 break; default: break; } //string kehuName = context.Request.Form["kehuName"]; //string strSql = string.Format("SELECT top 5 fname FROM t_user"); //DataTable dt = SqlHelper1.getTable(strSql, null); //StringBuilder sb = new StringBuilder(); //if (dt.Rows.Count > 0) //{ // sb.Append("<table id=\"kehutable\" border=1>"); // sb.Append("<tr><th>客户ID</th><th>客户名称</th><th>客户电话</th><th>等级</th></tr>"); // for (int i = 0; i < dt.Rows.Count; i++) // { // sb.Append("<tr>"); // sb.Append(string.Format("<td>{0}</td>", dt.Rows[i][0].ToString())); // sb.Append(string.Format("<td>{0}</td>", dt.Rows[i][0].ToString())); // sb.Append(string.Format("<td>{0}</td>", dt.Rows[i][0].ToString())); // sb.Append(string.Format("<td>{0}</td>", dt.Rows[i][0].ToString())); // sb.Append("</tr>"); // } // sb.Append("</table>"); //} //sb.Append("111"); //context.Response.Write(sb.ToString()); }
private static DataTable getKeHu(string kehuName) { string strSql = string.Format(@"SELECT top 2 orgn.FNumber,orgn.FName,orgn.FPhone, orgn.FTypeID,sube.FName as suFName,emp.FName as empFName FROM t_Organization orgn LEFT JOIN dbo.t_SubMessage sube ON orgn.FTypeID=sube.FInterID LEFT JOIN dbo.t_EMP emp on orgn.F_103=emp.Fitemid WHERE orgn.FName LIKE '%{0}%'OR orgn.FPhone LIKE '%{0}%'", kehuName); DataTable dt = SqlHelper1.getTable(strSql, null); return(dt); //string aa="11"; //JavaScriptSerializer jss = new JavaScriptSerializer(); //cont //context.Response.Write(jss.Serialize(aa)); }
private static DataTable getWuLiao(string wuliaoName) { //物料代码、商品名称、规格、等级、数量(获取初始表格内容) string sql = string.Format(@"SELECT icitem.FNumber,icitem.fitemid,icitem.FName,icitem.F_103 as wldj,icitem.FModel, Sube.fname as suFName,icitem.FNote,tmu.FName as tmuFName,icpy.FPrice FROM dbo.t_ICItem ICitem left join dbo.ICPrcPlyEntry icpy ON ICitem.FItemID=icpy.FItemID LEFT JOIN dbo.t_MeasureUnit tmu ON ICitem.FSaleUnitID=tmu.FMeasureUnitID LEFT JOIN dbo.t_SubMessage Sube ON icpy.FRelatedID=Sube.FInterID WHERE LEFT(icitem.FNumber,2)='CP' AND FRelatedID=83560 AND icitem.fname LIKE '%{0}%'", wuliaoName); DataTable dt = SqlHelper1.getTable(sql, null); return(dt); }
protected void danju_new_Click(object sender, EventArgs e) { DataTable FahdNumMax = SqlHelper1.ExecuteDataSetText(CommandType.StoredProcedure, "proc_get_nummax_fahd", null).Tables[0]; danju_no.Text = FahdNumMax.Rows[0][0].ToString(); //客户信息清空 txtkehuFNumber.Text = ""; txtkehuName.Text = ""; txtkehuPhone.Text = ""; txtkehuDengji.Text = ""; txtdjdm.Text = ""; txtywy.Text = ""; //Repeater1.DataSource = ""; //Repeater1.DataBind(); //txtkehu.Focus(); }
private static bool UpdatePrice(int _djhm, decimal _price) { bool bl = false; string sql = string.Format(@"select * from z_jggl where djhm={0}", _djhm); DataTable dt = SqlHelper1.getTable(sql, null); int rows = dt.Rows.Count; if (rows > 0) { for (int i = 0; i < rows; i++) { int _FRelatedID = 0; int _FItemID = Convert.ToInt32(dt.Rows[i]["nm"]); string _jiedeng = dt.Rows[i]["dj"].ToString(); switch (_jiedeng) { case "一级": _FRelatedID = 20011; break; case "二级": _FRelatedID = 20012; break; case "三级": _FRelatedID = 83558; break; case "四级": _FRelatedID = 83559; break; default: //五级 _FRelatedID = 83560; break; } sql = string.Format(@"update ICPrcPlyEntry set FPrice={0} where FItemID='{1}' and FRelatedID={2}", _price, _FItemID, _FRelatedID); SqlHelper1.ExecteNonQueryText(sql, null); } } bl = true; return(bl); }
private static DataTable getWuLiao(string wuliaoName, string dengji) { //物料代码、商品名称、规格、等级、数量(获取初始表格内容) string sql = string.Format(@"SELECT top 20 icitem.FNumber,icitem.FName,icitem.F_103 as wldj,icitem.FModel,iciy.FBatchNo, Sube.fname as suFName,icitem.FNote,tmu.FName as tmuFName,iciy.FQty,icpy.FPrice,stock.FName as ckFName FROM dbo.ICInventory iciy left join dbo.ICPrcPlyEntry icpy ON iciy.FItemID=icpy.FItemID LEFT JOIN dbo.t_ICItem ICitem ON iciy.FItemID=ICitem.FItemID LEFT JOIN dbo.t_MeasureUnit tmu ON ICitem.FSaleUnitID=tmu.FMeasureUnitID LEFT JOIN dbo.t_SubMessage Sube ON icpy.FRelatedID=Sube.FInterID LEFT JOIN t_Stock stock ON iciy.FStockID=stock.FItemID WHERE iciy.fqty>0 AND LEFT(icitem.FNumber,2)='CP' AND Sube.fname='{1}' AND icitem.fname LIKE '%{0}%'", wuliaoName, dengji); DataTable dt = SqlHelper1.getTable(sql, null); return(dt); }
public void ProcessRequest(HttpContext context) { string pid = context.Request.Form["pid"]; string title = context.Request.Form["title"]; string strSql = string.Format("SELECT top 5 fname FROM t_user"); DataTable dt = SqlHelper1.getTable(strSql, null); StringBuilder sb = new StringBuilder(); if (dt.Rows.Count > 0) { sb.Append("<ul>"); for (int i = 0; i < dt.Rows.Count; i++) { sb.Append(string.Format("<li>{0}</li>", dt.Rows[i][0].ToString())); } sb.Append("</ul>"); } context.Response.Write(sb.ToString()); }
private static void xzjgwl(HttpContext context, StringBuilder sp, string djhm, int nm, string mc, string ggxh, string dj) { string sql = string.Format(@"select * from z_jggl where nm={0} and djhm={1} ", nm, djhm); int icount = SqlHelper1.getTable(sql, null).Rows.Count; if (icount > 0) { context.Response.Write(0);//已经有记录返回整型数字0 } else { //新增记录 sp.Append("insert into z_jggl "); sp.Append("(djhm,nm,mc,ggxh,dj) "); sp.Append("values({0},{1},'{2}','{3}','{4}')"); sql = sp.ToString(); sql = string.Format(sql, djhm, nm, mc, ggxh, dj); SqlHelper1.ExecteNonQueryText(sql, null); context.Response.Write(1);//更新成功返回成功标记 } }
protected void btnkehu_Click(object sender, EventArgs e) { //string khnr = txtkehu.Text; string khnr = ""; string danju_no1 = danju_no.Text; txtwuliao.Text = ""; if (!string.IsNullOrEmpty(khnr) || !string.IsNullOrEmpty(danju_no1)) { string strSql = string.Format(@"SELECT top 1 orgn.FNumber,orgn.FName,orgn.FPhone, orgn.FTypeID,sube.FName as suFName,emp.FName as empFName FROM t_Organization orgn LEFT JOIN dbo.t_SubMessage sube ON orgn.FTypeID=sube.FInterID LEFT JOIN dbo.t_EMP emp on orgn.F_103=emp.Fitemid WHERE orgn.FName LIKE '%{0}%'OR orgn.FPhone LIKE '%{0}%'", khnr); DataTable dt = SqlHelper1.getTable(strSql, null); //Repeater1.DataSource = dt; //Repeater1.DataBind(); } else { Response.Write("<script>alert('请点击新增单据按钮或者填写客户信息!');location='javascript:history.go(-1);'</script>"); } }
private static bool k3bc(string fad_ph, string kehuFNumber, string ywy, string zhidan, string bz, string kehuDengji) { bool djbc = false; string DtNow = DateTime.Now.ToString("yyyy-MM-dd"); //获取表体FInterID(最大号) DataTable FahtzdNumMax = SqlHelper1.ExecuteDataSetText(CommandType.StoredProcedure, "proc_get_nummax_fahtzd", null).Tables[0]; string FInterID = FahtzdNumMax.Rows[0][0].ToString(); //获取新增物料的表格 string sql = string.Format(@"select * from fahuodan_wl where FInterID='{0}'", fad_ph); DataTable fahuodan = SqlHelper1.getTable(sql, null); int fhdcount = fahuodan.Rows.Count; if (fhdcount > 0) { //查询购货单位 sql = string.Format(@"select fitemid from t_Organization where fnumber='{0}'", kehuFNumber); int FCustID = Convert.ToInt32(SqlHelper1.getTable(sql, null).Rows[0][0]); //查询业务员ID sql = string.Format(@"select fitemid from t_emp where fname='{0}'", ywy); int FEmpID = Convert.ToInt32(SqlHelper1.getTable(sql, null).Rows[0][0]); //查询制单人ID sql = string.Format(@"select FUserID from t_User where fname='{0}'", zhidan); int FbUserID = Convert.ToInt32(SqlHelper1.getTable(sql, null).Rows[0][0]); //发货通知单表体生成 for (int i = 0; i < fhdcount; i++) { //获取FItemID和FUnitID string FNumber = fahuodan.Rows[i]["FNumber"].ToString(); sql = string.Format(@"select FItemID,FUnitID from t_icitem where FNumber='{0}'", FNumber); DataTable dt = SqlHelper1.getTable(sql, null); int FItemID = Convert.ToInt32(dt.Rows[0][0]); int FUnitID = Convert.ToInt32(dt.Rows[0][1]); decimal FQty = Convert.ToDecimal(fahuodan.Rows[i]["Amount"]); decimal FPrice = Convert.ToDecimal(fahuodan.Rows[i]["Price"]); decimal Famount = Convert.ToDecimal(fahuodan.Rows[i]["Total"]); //SQL插入语句 sql = string.Format(@"INSERT INTO SEOutStockEntry (FInterID,FEntryID, FBrNo,FMapNumber,FMapName,FItemID,Fauxqty,Fauxprice,Famount,FUnitID,FBatchNo, FAuxPropID,FQty,FSecCoefficient,FSecQty,Fnote,FSourceBillNo,FSourceTranType, FSourceInterId,FSourceEntryID,FContractBillNo,FContractInterID, FContractEntryID,FOrderBillNo,FOrderInterID,FOrderEntryID,FAuxInvoiceQty, FInvoiceQty,FFetchDate,FStockID,FStdAmount,FPlanMode,FMTONo,FClientEntryID, FClientOrderNo) values({0},{1},'0','','',{2},{3},{4},{5},{6},'',0,{3},0,0,'','',0,0,0,'',0,0,'',0,0,{3},{3}, '{7}',0,{5},14036,'','','')", FInterID, i + 1, FItemID, FQty, FPrice, Famount, FUnitID, DtNow); SqlHelper1.ExecteNonQueryText(sql, null); } //发货通知单表头生成 //获取单据号码(流水号) DataTable FdjNO = SqlHelper1.ExecuteDataSetText(CommandType.StoredProcedure, "proc_get_nummax_fhdjhm", null).Tables[0]; int FBlsh = Convert.ToInt32(FdjNO.Rows[0][0]); string djt = "SEOUT"; string rjyear = DtNow.Substring(2, 2); string rjmonth = DtNow.Substring(5, 2); string lsh; if (FBlsh >= 10000000) { lsh = FBlsh.ToString(); } else if (FBlsh >= 1000000) { lsh = "0"; } else if (FBlsh >= 100000) { lsh = "00"; } else { lsh = "000"; } string FBillNo = djt + rjyear + rjmonth + lsh + FBlsh; /*(FInterID,FBillNo,FStatus,Fdate,FCustID,FCheckDate,FManagerID,FEmpID, * FBillerID,FExplanation,FHeadSelfS0238,FHeadSelfS0239,FHeadSelfS0240)*/ sql = string.Format(@"INSERT INTO SEOutStock(FInterID,FBillNo,FBrNo, FTranType,FCancellation,FStatus,Fdate,FCurrencyID, FCustID,FSalType,FCheckDate,FManagerID,FDeptID,FEmpID,FBillerID, FSettleID,FExchangeRateType,FExchangeRate,FMultiCheckDate1, FMultiCheckDate2,FMultiCheckDate3,FMultiCheckDate4, FMultiCheckDate5,FMultiCheckDate6,FRelateBrID,FSelTranType, FFetchAdd,FExplanation,FAreaPS,FManageType,FPrintCount, FHeadSelfS0238,FHeadSelfS0239,FHeadSelfS0240) values({0},'{1}', '0',83,0,{2},'{3}',1,{4},101,'{3}',15495,14053,{5},{6}, 0,1,1,Null,Null,Null,Null,Null,Null,0,81,'','{7}',20302,0,0,{5},{5},'{8}')", FInterID, FBillNo, 0, DtNow, FCustID, FEmpID, FbUserID, bz, kehuDengji); SqlHelper1.ExecteNonQueryText(sql, null); djbc = true; } return(djbc); }
public void ProcessRequest(HttpContext context) { StringBuilder sp = new StringBuilder(); string sw = context.Request.Form["content"]; string jsonString = string.Empty; switch (sw) { case "wuliao": //物料查询 string FName = context.Request.Form["wuliaoName"]; string dengji = context.Request.Form["dengji"]; string chadeng = context.Request.Form["wuliaochadeng"]; if (string.IsNullOrEmpty(chadeng)) { DataTable dt = getWuLiao(FName, dengji); jsonString = JsonConvert.SerializeObject(dt); context.Response.Write(jsonString); } else { DataTable dt = getWuLiaocd(FName, chadeng, dengji); jsonString = JsonConvert.SerializeObject(dt); context.Response.Write(jsonString); } break; case "djxz": //得到价格单据最大号 string Number = getNumber(); context.Response.Write(Number); break; case "jgxz": //新增价格修改项目 string djhm = context.Request.Form["djhm"]; int nm = Convert.ToInt32(context.Request.Form["nm"]); string mc = context.Request.Form["mc"]; string ggxh = context.Request.Form["ggxh"]; string dj = context.Request.Form["dj"]; xzjgwl(context, sp, djhm, nm, mc, ggxh, dj); break; case "selrn": //返回选择修改物料 int FbillNo = Convert.ToInt32(context.Request.Form["FbillNo"]); string sql = string.Format(@"select * from z_jggl where djhm={0}", FbillNo); DataTable dtSel = SqlHelper1.getTable(sql, null); jsonString = JsonConvert.SerializeObject(dtSel); context.Response.Write(jsonString); break; case "del": //删除物料 int FbillNo_Del = Convert.ToInt32(context.Request.Form["FbillNo"]); int nm_Del = Convert.ToInt32(context.Request.Form["nm"]); DataTable dt_del = del(FbillNo_Del, nm_Del); jsonString = JsonConvert.SerializeObject(dt_del); context.Response.Write(jsonString); break; case "wuliao_price": //价格修改 int djhm_jg = Convert.ToInt32(context.Request.Form["djhm"]); decimal Price = Convert.ToDecimal(context.Request.Form["Price"]); bool bl = UpdatePrice(djhm_jg, Price); if (bl) { int hc = 1; context.Response.Write(hc); } else { int hc0 = 0; context.Response.Write(hc0); } break; default: break; } }
protected void btnwuliao_Click(object sender, EventArgs e) { //txtkehu.Text = ""; string wuliao = txtwuliao.Text; string djdm = txtdjdm.Text; string wldengji = txtwuliaodj.Text; string FModel = txtFModel.Text; if (!string.IsNullOrEmpty(wuliao)) { //物料代码、商品名称、规格、等级、数量(获取初始表格内容) string sql = string.Format(@"SELECT top 20 icitem.FNumber,icitem.FName,icitem.F_103 as wldj,icitem.FModel,iciy.FBatchNo, Sube.fname as suFName,icitem.FNote, iciy.FQty,icpy.FPrice,stock.FName as ckFName FROM dbo.ICInventory iciy left join dbo.ICPrcPlyEntry icpy ON iciy.FItemID=icpy.FItemID LEFT JOIN dbo.t_ICItem ICitem ON iciy.FItemID=ICitem.FItemID LEFT JOIN dbo.t_SubMessage Sube ON icpy.FRelatedID=Sube.FInterID LEFT JOIN t_Stock stock ON iciy.FStockID=stock.FItemID WHERE iciy.fqty>0 AND LEFT(icitem.FNumber,2)='CP' AND icpy.FRelatedID='{3}' AND icitem.fname LIKE '%{0}%' AND icitem.F_103 LIKE '%{1}%' AND icitem.FModel LIKE '%{2}%'", wuliao, wldengji, FModel, djdm); DataTable dt = SqlHelper1.getTable(sql, null); //重新加工表格(主要是价格等级) DataTable dt2 = new DataTable(); DataColumnCollection cols2 = dt2.Columns; cols2.Add("FNumber", typeof(string)); cols2.Add("FName", typeof(string)); cols2.Add("wldj", typeof(string)); cols2.Add("FModel", typeof(string)); cols2.Add("FBatchNo", typeof(string)); cols2.Add("suFName", typeof(string)); cols2.Add("FNote", typeof(string)); cols2.Add("FQty", typeof(decimal)); cols2.Add("FPrice", typeof(decimal)); cols2.Add("ckFName", typeof(string)); cols2.Add("djjg1", typeof(decimal)); cols2.Add("djjg2", typeof(decimal)); cols2.Add("djjg3", typeof(decimal)); cols2.Add("djjg4", typeof(decimal)); cols2.Add("djjg5", typeof(decimal)); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt2.NewRow(); string FNumber = dt.Rows[i]["FNumber"].ToString(); dr["FNumber"] = FNumber; dr["FName"] = dt.Rows[i]["FName"].ToString(); dr["wldj"] = dt.Rows[i]["wldj"].ToString(); dr["FModel"] = dt.Rows[i]["FModel"].ToString(); dr["FBatchNo"] = dt.Rows[i]["FBatchNo"].ToString(); dr["suFName"] = dt.Rows[i]["suFName"].ToString(); dr["FNote"] = dt.Rows[i]["FNote"].ToString(); dr["FQty"] = Convert.ToDecimal(dt.Rows[i]["FQty"]); dr["FPrice"] = Convert.ToDecimal(dt.Rows[i]["FPrice"]); dr["ckFName"] = dt.Rows[i]["ckFName"].ToString(); //获取5个等级的价格 int[] mySigArray = new int[5]; mySigArray[0] = 20011; mySigArray[1] = 20012; mySigArray[2] = 83558; mySigArray[3] = 83559; mySigArray[4] = 83560; decimal[] mydjjg = new decimal[5]; for (int j = 0; j < 5; j++) { sql = string.Format(@"SELECT ISNULL(FPrice,0) FROM dbo.ICPrcPlyEntry icey LEFT JOIN dbo.t_Item item ON icey.FItemID=item.FItemID WHERE item.FNumber='{0}' AND FRelatedID={1}", FNumber, mySigArray[j]); DataTable dt3 = SqlHelper1.getTable(sql, null); int icount = dt3.Rows.Count; if (icount == 0) { mydjjg[j] = 0; } else { mydjjg[j] = Convert.ToDecimal(dt3.Rows[0][0]); } } dr["djjg1"] = mydjjg[0]; dr["djjg2"] = mydjjg[1]; dr["djjg3"] = mydjjg[2]; dr["djjg4"] = mydjjg[3]; dr["djjg5"] = mydjjg[4]; dt2.Rows.Add(dr); } } Repeater2.DataSource = dt2; Repeater2.DataBind(); } else { Response.Write("请输入物料信息!"); } }