ERP产品购进批量提交文件(三十六)

网友投稿 500 2022-11-10

ERP产品购进批量提交文件(三十六)

ERP产品购进批量提交文件(三十六)

商品录入前端的代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProNew.aspx.cs" Inherits="BioErpWeb.WholeSaleSystem.Product.ProNew" %>

商品信息录入
商品名称 全名 所属类型 经手人
销售渠道 供货商 商品规格 批准文号
单位 包装尺寸 毛重 生产企业
最高零售价 中标价 批发限价 指导价
县级招商低价 市级招商低价 省级招商低价 网上公示价
网上VIP价 网上会员价 有效期 库存上限
库存下限 我方公司 上海某某公司 成都某某公司 北京某某公司 雅安某某公司 商标
备注
商品图片选择

批量文件上传使用的类:HttpFileCollection:提供对客户端上载文件的访问,并组织这些文件。Request.Files:获取上载文件格式集合

批量文件上传的后台代码:

rotected void btnSubmit_Click(object sender, EventArgs e) { string proLogoName ="\\Files\\Product\\ProLogo\\"+ DateTime.Now.ToString("yyyyMMddhhmmss") + this.f_prologo.FileName; ViewProInfo pro = new ViewProInfo() { AdvicePrice =this.txtAdvicePrice.Text==""?0:decimal.Parse(this.txtAdvicePrice.Text), BidPrice =this.txtBidPrice.Text==""?0:decimal.Parse(this.txtBidPrice.Text), ChannelID = int.Parse(this.txtChannel.Text), CityPrice = decimal.Parse(this.txtCityPrice.Text), ConfirmNo = this.txtConfirmNo.Text, CountyPrice = decimal.Parse(this.txtCountyPrice.Text), Grossweight = this.txtGrossweight.Text, MadeEnterprise = this.txtMadeEnterprise.Text, CustomerID = int.Parse(this.txtCustormer.Text), NetMemberprice = decimal.Parse(this.txtNetMemberprice.Text), NetPrice = decimal.Parse(this.txtNetPrice.Text), NetVipPrice = decimal.Parse(this.txtNetPrice.Text), OurCompany = this.ddlCompany.Text, ProFullName = this.txtFullName.Text, ProLogo =this.f_prologo.FileName!=""? proLogoName:null, ProName = this.txtName.Text, ProSize = this.txtProSize.Text, Spec = this.txtSpec.Text, ProvincePrice = decimal.Parse(this.txtProvincePrice.Text), Retailprice = decimal.Parse(this.txtRetailprice.Text), StockLess = this.txtStockLess.Text, Unit = this.txtUnit.Text, TypeID = int.Parse(this.txtType.Text), StockMost = this.txtStockMost.Text, Usefullife = this.txtUsefullife.Text, TradePrice = decimal.Parse(this.txtTradePrice.Text), SubmitTime = DateTime.Now, Remark = this.txtRemark.Text, Userid=int.Parse(Session["Userid"].ToString()) }; ProductBLL pbll = new ProductBLL(); int proid= pbll.BiotbProductAdd(pro); if (proid != 0) { HttpFileCollection hfloads=Request.Files; if (hfloads.Count >= 2) { string SavePath = Server.MapPath("\\Files\\Product\\ProImgs\\"); for (int i = 1; i < hfloads.Count; i++) { string fileName =DateTime.Now.ToString("yyyyMMddhhmmss")+hfloads[i].FileName.Substring(hfloads[i].FileName.LastIndexOf("\\") + 1); BiotbProImgs proimg = new BiotbProImgs(); proimg.ProImg = fileName; proimg.ProID = proid; hfloads[i].SaveAs(SavePath + fileName); BiotbProImgsBLL bimgbll = new BiotbProImgsBLL(); bimgbll.BiotbProImgsAdd(proimg); } } } }

产品展示和查询的页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProListShow.aspx.cs" Inherits="BioErpWeb.WholeSaleSystem.Product.ProListShow" %><%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %>

产品搜索
">查看详细……

搜索的后台代码:

protected void imgbutnSearch_Click(object sender, ImageClickEventArgs e) { pageindex = 0; condition = ""; if (txtName.Text.Trim() != null && this.txtName.Text.Trim().Length != 0) { condition = condition + " and ProName like '" + txtName.Text + "%'"; } if (this.txtCustumor.Text.Trim() != null && this.txtCustumor.Text.Trim().Length != 0) { condition = condition + " and CustomerName like '" + txtCustumor.Text + "%'"; } if (this.txtChannel.Text.Trim() != null && this.txtChannel.Text.Trim().Length != 0) { condition = condition + " and ChannelName like '" + txtChannel.Text + "%'"; } if (this.txtType.Text.Trim() != null && this.txtType.Text.Trim().Length != 0) { condition = condition + " and TypeName like '" + txtType.Text + "%'"; } getallPageList(); }

查看详细的后台代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProDetail.aspx.cs" Inherits="BioErpWeb.WholeSaleSystem.Product.ProDetail" %>

商品信息查看
商品名称 全名 所属类型 经手人
销售渠道 供货商 商品规格 批准文号
单位 包装尺寸 毛重 生产企业
最高零售价 中标价 批发限价 指导价
县级招商低价 市级招商低价 省级招商低价 网上公示价
网上VIP价 网上会员价 有效期 库存上限
库存下限 我方公司
商标 商品图片
备注

后台代码:

public partial class ProDetail: BasePage { protected void Page_Load(object sender, EventArgs e) { //遍历页面所有TextBox控件,设置为只读 TextBox txt = null; foreach (Control c in Page.Controls) { if (c.GetType().Name == "HtmlForm") { foreach (Control c1 in c.Controls) { if (c1.GetType().Name == "TextBox") { txt = ((TextBox)c1); txt.ReadOnly = true; } } } } if (!IsPostBack) { pageinfo(); if (SqlComm.getUserRightsByUserId(Session["Userid"].ToString()).Contains(",46,")) { this.btnSubmit.Text = "编辑"; } else { this.btnSubmit.Text = "返回"; } } } private void pageinfo() { if (Request.QueryString["id"] == null || Request.QueryString["id"].ToString() == "") { Response.Redirect("ProListShow.aspx"); return; } string id = Request.QueryString["id"].ToString(); ProductBLL pbll = new ProductBLL(); ViewProInfo viewpro = new ViewProInfo(); viewpro = pbll.getProViewByProId(id); this.txtName.Text = viewpro.ProName; this.txtCustormer.Text = viewpro.CustomerName; this.txtFullName.Text = viewpro.ProFullName; this.txtChannel.Text = viewpro.ChannelName; this.txtType.Text = viewpro.TypeName; this.txtUserID.Text = viewpro.Userid.ToString(); this.txtSpec.Text = viewpro.Spec; this.txtConfirmNo.Text = viewpro.ConfirmNo; this.txtBidPrice.Text = viewpro.BidPrice.ToString(); this.txtCityPrice.Text = viewpro.CityPrice.ToString(); this.txtUnit.Text = viewpro.Unit.ToString(); this.txtUsefullife.Text = viewpro.Usefullife.ToString(); this.txtTradePrice.Text = viewpro.TradePrice.ToString(); this.txtStockMost.Text = viewpro.StockMost.ToString(); this.txtStockLess.Text = viewpro.StockLess.ToString(); this.txtRetailprice.Text = viewpro.Retailprice.ToString(); this.txtRemark.Text = viewpro.Remark.ToString(); this.txtProSize.Text = viewpro.ProSize.ToString(); this.txtNetVipPrice.Text = viewpro.NetVipPrice.ToString(); this.txtNetPrice.Text = viewpro.NetPrice.ToString(); this.txtNetMemberprice.Text = viewpro.NetMemberprice.ToString(); this.txtProvincePrice.Text = viewpro.ProvincePrice.ToString(); this.txtCountyPrice.Text = viewpro.CountyPrice.ToString(); this.txtMadeEnterprise.Text = viewpro.MadeEnterprise; this.txtGrossweight.Text = viewpro.Grossweight; this.txtAdvicePrice.Text = viewpro.AdvicePrice.ToString(); this.ddlCompany.Text = viewpro.OurCompany; this.imgProLogo.ImageUrl = "~"+viewpro.ProLogo; this.DataList1.DataSource= SqlComm.GetDataByCondition("BiotbProImgs", "ProImgID,ProID,ProImg", " ProID=" + id).Tables[0]; this.DataList1.DataBind(); } protected void btnSubmit_Click(object sender, EventArgs e) { if (this.btnSubmit.Text == "编辑") { Response.Redirect("ProEdit.aspx?id="+Request.QueryString["id"].ToString()); } else { Response.Redirect("ProListShow.aspx"); } } }

编辑业务的需求: 1.产品基本信息编辑。2.产品多图片编辑。

需求分析:

3.可以添加新的图片但总数不超过5个

修改的前端代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProEdit.aspx.cs" Inherits="BioErpWeb.WholeSaleSystem.Product.ProEdit" %>

商品信息编辑
商品名称 全名 所属类型 经手人
销售渠道 供货商 商品规格 批准文号
单位 包装尺寸 毛重 生产企业
最高零售价 中标价 批发限价 指导价
县级招商低价 市级招商低价 省级招商低价 网上公示价
网上VIP价 网上会员价 有效期 库存上限
库存下限 我方公司 上海某某公司 成都某某公司 北京某某公司 雅安某某公司
商标 商品图片
)">
备注 状态

后台代码:

public partial class ProEdit: BasePage { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { pageinfo(); this.btnSubmit0.Visible = true; } } private void pageinfo() { if (Request.QueryString["id"] == null || Request.QueryString["id"].ToString() == "") { Response.Redirect("ProListShow.aspx"); return; } string id = Request.QueryString["id"].ToString(); ProductBLL pbll = new ProductBLL(); ViewProInfo viewpro = new ViewProInfo(); viewpro = pbll.getProViewByProId(id); this.txtName.Text = viewpro.ProName; this.txtCustormer.Text = viewpro.CustomerID.ToString(); this.txtFullName.Text = viewpro.ProFullName; this.txtChannel.Text = viewpro.ChannelID.ToString(); this.txtType.Text = viewpro.TypeID.ToString(); this.txtUserID.Text = viewpro.Userid.ToString(); this.txtSpec.Text = viewpro.Spec; this.txtConfirmNo.Text = viewpro.ConfirmNo; this.txtBidPrice.Text = viewpro.BidPrice.ToString(); this.txtCityPrice.Text = viewpro.CityPrice.ToString(); this.txtUnit.Text = viewpro.Unit.ToString(); this.txtUsefullife.Text = viewpro.Usefullife.ToString(); this.txtTradePrice.Text = viewpro.TradePrice.ToString(); this.txtStockMost.Text = viewpro.StockMost.ToString(); this.txtStockLess.Text = viewpro.StockLess.ToString(); this.txtRetailprice.Text = viewpro.Retailprice.ToString(); this.txtRemark.Text = viewpro.Remark.ToString(); this.txtProSize.Text = viewpro.ProSize.ToString(); this.txtNetVipPrice.Text = viewpro.NetVipPrice.ToString(); this.txtNetPrice.Text = viewpro.NetPrice.ToString(); this.txtNetMemberprice.Text = viewpro.NetMemberprice.ToString(); this.txtProvincePrice.Text = viewpro.ProvincePrice.ToString(); this.txtCountyPrice.Text = viewpro.CountyPrice.ToString(); this.txtMadeEnterprise.Text = viewpro.MadeEnterprise; this.txtGrossweight.Text = viewpro.Grossweight; this.txtAdvicePrice.Text = viewpro.AdvicePrice.ToString(); this.ddlCompany.Text = viewpro.OurCompany; this.imgProLogo.ImageUrl = "~" + viewpro.ProLogo; this.cbDelete.Checked = bool.Parse(viewpro.DeleteSate.ToString()); this.txtUserID.Text = viewpro.Userid.ToString(); this.DataList1.DataSource = SqlComm.GetDataByCondition("BiotbProImgs", "ProImgID,ProID,ProImg", " ProID=" + id).Tables[0]; this.DataList1.DataBind(); } protected void btnSubmit_Click(object sender, EventArgs e) { string proLogoName ="\\Files\\Product\\ProLogo\\"+ DateTime.Now.ToString("yyyyMMddhhmmss") + this.f_prologo.FileName; ViewProInfo pro = new ViewProInfo() { AdvicePrice =this.txtAdvicePrice.Text==""?0:decimal.Parse(this.txtAdvicePrice.Text), BidPrice =this.txtBidPrice.Text==""?0:decimal.Parse(this.txtBidPrice.Text), ChannelID = int.Parse(this.txtChannel.Text), CityPrice = decimal.Parse(this.txtCityPrice.Text), ConfirmNo = this.txtConfirmNo.Text, CountyPrice = decimal.Parse(this.txtCountyPrice.Text), Grossweight = this.txtGrossweight.Text, MadeEnterprise = this.txtMadeEnterprise.Text, CustomerID = int.Parse(this.txtCustormer.Text), NetMemberprice = decimal.Parse(this.txtNetMemberprice.Text), NetPrice = decimal.Parse(this.txtNetPrice.Text), NetVipPrice = decimal.Parse(this.txtNetPrice.Text), OurCompany = this.ddlCompany.Text, ProFullName = this.txtFullName.Text, ProLogo = this.f_prologo.FileName != "" ? proLogoName : this.imgProLogo.ImageUrl.Substring(1), ProName = this.txtName.Text, ProSize = this.txtProSize.Text, Spec = this.txtSpec.Text, ProvincePrice = decimal.Parse(this.txtProvincePrice.Text), Retailprice = decimal.Parse(this.txtRetailprice.Text), StockLess = this.txtStockLess.Text, Unit = this.txtUnit.Text, TypeID = int.Parse(this.txtType.Text), StockMost = this.txtStockMost.Text, Usefullife = this.txtUsefullife.Text, TradePrice = decimal.Parse(this.txtTradePrice.Text), SubmitTime = DateTime.Now, Remark = this.txtRemark.Text, Userid=int.Parse(Session["Userid"].ToString()), DeleteSate=this.cbDelete.Checked, ProID=int.Parse(Request.QueryString["id"].ToString()) }; string savepath = Server.MapPath("\\Files\\Product\\ProLogo\\"); this.f_prologo.SaveAs(savepath + DateTime.Now.ToString("yyyyMMddhhmmss")+this.f_prologo.FileName); ProductBLL pbll = new ProductBLL(); int count = pbll.BiotbProductUpdate(pro); if (count != 0) { HttpFileCollection hfloads = Request.Files; string FileNameDate = DateTime.Now.ToString("yyyyMMddhhmmss"); if (hfloads.Count >= 2) { string SavePath = Server.MapPath("\\Files\\Product\\ProImgs\\"); string proimgs = Request["input_ImgName"]; string proimgids = Request["intput_imgUpdate"]; if (proimgs != null) { string[] proimg = proimgs.Split(','); string[] proimgid = proimgids.Split(','); for (int i = 0; i < proimg.Length; i++) { SqlComm.UpdateTableByCondition("BiotbProImgs", "[ProImg]='" +(FileNameDate+ proimg[i]) + "'", " ProImgID=" + proimgid[i]); } } for (int i = 1; i < hfloads.Count; i++) { if (hfloads.AllKeys[i] == "FileProImg") { string fileName = FileNameDate+ hfloads[i].FileName.Substring(hfloads[i].FileName.LastIndexOf("\\") + 1); BiotbProImgs img = new BiotbProImgs(); img.ProImg = fileName; img.ProID =int.Parse(Request.QueryString["id"].ToString()); hfloads[i].SaveAs(SavePath + fileName); BiotbProImgsBLL bimgbll = new BiotbProImgsBLL(); bimgbll.BiotbProImgsAdd(img); } //修改图片文件的上传 if (proimgs != null && proimgs.Length > 0) { if (hfloads.AllKeys[i] == "FileImg") { string fileName = FileNameDate+ hfloads[i].FileName.Substring(hfloads[i].FileName.LastIndexOf("\\") + 1); hfloads[i].SaveAs(SavePath + fileName); } } } } } Response.Redirect("ProListShow.aspx"); } protected void btnSubmit0_Click(object sender, EventArgs e) { Response.Redirect("ProListShow.aspx"); } }

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:C#DataTable转List和List转DataTable
下一篇:ERP商品类型管理相关业务处理(三十五)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~