protected void Page_Load(object sender, EventArgs e) { if (Session["username"] != null && Session["gs_name"] != null) { if (Request["id"] != null) { string rkid = Request["id"]; ming_xi_info mxlist = cal.ming_xi_select(Session["username"].ToString(), Session["gs_name"].ToString()).Find(fd => fd.Id == rkid); orderid.Text = mxlist.Orderid; shuliang.Text = mxlist.Cpsl; Danjia.Text = mxlist.Cpjg; List <zl_and_jc_info> jichu = cal.select_jczl(Session["username"].ToString(), Session["gs_name"].ToString()); shangpingname.DataSource = jichu; shangpingname.DataBind(); fenlei.DataSource = jichu; fenlei.DataBind(); Gonghuofang.DataSource = jichu.FindAll(fd => !fd.Gong_huo.Equals("无") && !fd.Gong_huo.Equals(string.Empty)); Gonghuofang.DataBind(); spid.Value = rkid; oid.InnerText = "更改前信息为:" + mxlist.Orderid; fl.InnerText = "更改前信息为:" + mxlist.Cplb; name.InnerText = "更改前信息为:" + mxlist.Cpname; ghf.InnerText = "更改前信息为:" + mxlist.shou_h; sl.InnerText = "更改前信息为:" + mxlist.Cpsl; dj.InnerText = "更改前信息为:" + mxlist.Cpjg; time.InnerText = "更改前信息为:" + mxlist.Shijian; } } }
protected void submit_Click(object sender, EventArgs e) { try { List <ku_cun> kc = new List <ku_cun>(); List <ming_xi_info> mxlist = new List <ming_xi_info>(); string ylname = ""; List <yong_liao_set_info> list = cal.yl_set_select(Session["username"].ToString(), Session["gs_name"].ToString()); //string orderid = Context.Request["ckdh"]; string orderid = Context.Request["ckdh"]; kc = cal.SelectKucun().FindAll(fn => fn.gs_name.Equals(Session["gs_name"]) && fn.zh_name.Equals(Session["username"])); string shouhuo = Context.Request["ghf"]; string date = Context.Request["shijian"]; for (int i = 0; i < list.Count; i++) { string name = Request["ck" + i]; if (name != null) { string shoujia = Context.Request["txt" + i]; string shuliang = Context.Request["txtsl" + i]; ylname = Context.Request["ck" + i]; List <yong_liao_set_info> yl = list.FindAll(fn => fn.cp_name.Equals(ylname)); for (int yli = 0; yli < yl.Count; yli++) { ku_cun k = kc.Find(fn => fn.Name.Equals(yl[yli].yl_name)); if (Convert.ToInt32(k.Shu_liang) > Convert.ToInt32(k.Shu_liang) - (Convert.ToInt32(yl[yli].yl_sl.ToString()) * Convert.ToInt32(shuliang))) { ming_xi_info mxi = new ming_xi_info(); mxi.kcid = k.Id; mxi.Cplb = k.Lei_bie; mxi.Cpname = k.Name; mxi.Cpsl = yl[yli].yl_sl; mxi.Cpsj = (Convert.ToInt32(shoujia) / yl.Count).ToString(); mxi.shou_h = shouhuo; mxi.Orderid = orderid; mxi.zh_name = Session["username"].ToString(); mxi.gs_name = Session["gs_name"].ToString(); mxi.Shijian = date; mxi.Mxtype = "出库"; mxlist.Add(mxi); } } } } cal.addinput_ku(mxlist, ""); Page_Load(sender, e); Response.Write("<script>alert(销售成功!)</script>"); //Response.Write("[{\"endtext\":\"提交成功!\"}]"); //Response.End(); } catch (Exception ex) { } }
protected void rk_pd(object sender, EventArgs e) { try { if (Context.Request["tj_pd"].ToString() == "tj_true") { ming_xi_info mxi = new ming_xi_info(); int check_num = 0; for (int i = 0; i < select_kc(Session["username"].ToString(), Session["gs_name"].ToString()).Count; i++) { string name = Request["Checkbox_bd" + i]; List <ku_cun> list = select_kc(Session["username"].ToString(), Session["gs_name"].ToString()); if (name == null) { } else { if (Convert.ToInt32(name) == i) { List <ku_cun> selectlist = selectkc(Session["username"].ToString(), Session["gs_name"].ToString(), Context.Request["ck_spdm" + i].ToString()); check_num = ck_update_cs(list[i].Id, (Convert.ToInt32(list[i].Shu_liang) - Convert.ToInt32(Request["ck_sl" + i])).ToString()); List <ming_xi_info> list_mx = new List <ming_xi_info>(); mxi.Cpname = Context.Request["ck_name" + i].ToString(); mxi.Openid = "2"; mxi.Cpsj = Context.Request["ck_dj" + i]; mxi.Cpsl = Convert.ToInt32(Request["ck_sl" + i]).ToString(); mxi.Orderid = Context.Request["orderid"].ToString(); mxi.Gongsi = Context.Request["gongsi"].ToString(); mxi.shou_h = Context.Request["shou_h"].ToString(); mxi.Shijian = Context.Request["shijian"].ToString(); mxi.Mxtype = "出库"; mxi.Cplb = Context.Request["cp_lb" + i].ToString(); mxi.zh_name = Session["username"].ToString(); mxi.gs_name = Session["gs_name"].ToString(); mxi.sp_dm = Context.Request["ck_spdm" + i].ToString(); mxi.Id = Context.Request["ck_id" + i].ToString(); list_mx.Add(mxi); kc_t_mx(list_mx); int sl = Convert.ToInt32(selectlist[0].Shu_liang) - Convert.ToInt32(Context.Request["ck_sl" + i].ToString()); update_kc(Context.Request["ck_spdm" + i].ToString(), sl.ToString()); } else { } } } // Response.Write(" <script>alert('出库成功');</script>"); Response.Write(" <script>alert('出库成功'); location='chu_ku.aspx';</script>"); bt_select_Click(sender, e); } } catch (Exception ex) { throw; } }
protected void submit_Click(object sender, EventArgs e) { try { List <ku_cun> kc = new List <ku_cun>(); List <ming_xi_info> list = new List <ming_xi_info>(); string kcid = ""; string orderid = Context.Request["ckdh"]; string shouhuo = Context.Request["ghf"]; string date = Context.Request["shijian"]; kc = cal.SelectKucun().FindAll(fn => fn.gs_name.Equals(Session["gs_name"]) && fn.zh_name.Equals(Session["username"])); for (int i = 0; i < kc.Count; i++) { string name = Request["ck" + i]; if (name != null) { string shoujia = Context.Request["txt" + i]; string shuliang = Context.Request["txtsl" + i]; kcid = Context.Request["ck" + i]; ku_cun k = kc.Find(fn => fn.Id.Equals(kcid)); if (Convert.ToInt32(k.Shu_liang) > Convert.ToInt32(k.Shu_liang) - Convert.ToInt32(shuliang)) { ming_xi_info mxi = new ming_xi_info(); mxi.kcid = kcid; mxi.Cplb = k.Lei_bie; mxi.Cpname = k.Name; mxi.Cpsl = shuliang; mxi.Cpsj = shoujia; mxi.shou_h = shouhuo; mxi.Orderid = orderid; mxi.zh_name = userid; mxi.gs_name = gongsi; mxi.Shijian = date; mxi.Mxtype = "出库"; list.Add(mxi); } } } cal.addinput_ku(list, kcid); Page_Load(sender, e); Response.Write("<script>alert(出库成功!)</script>"); //Response.Write("[{\"endtext\":\"提交成功!\"}]"); //Response.End(); } catch (Exception ex) { } }
protected void update() { try { if (Session["username"] != null && Session["gs_name"] != null) { string fl = Request["fl"]; string name = Request["name"]; string sl = Request["sl"]; string dj = Request["dj"]; string gonghuofang = Request["bz"]; string orderid = Request["orderid"]; userid = Session["username"].ToString(); gongsi = Session["gs_name"].ToString(); string shijian = Request["shijian"].ToString(); ming_xi_info mxi = new ming_xi_info(); mxi.Cplb = fl; mxi.Cpname = name; mxi.Cpsl = sl; mxi.Cpjg = dj; mxi.Cpsj = dj; mxi.shou_h = gonghuofang; mxi.Orderid = orderid; mxi.zh_name = userid; mxi.gs_name = gongsi; mxi.Shijian = shijian; mxi.Mxtype = "入库"; mxi.Id = Request["id"]; List <ming_xi_info> list = new List <ming_xi_info>(); list.Add(mxi); cal.buindess_upinput_ku(list); Response.Write("[{\"endtext\":\"提交成功!\"}]"); Response.End(); } } catch (Exception ex) { throw ex; } }
protected void bt_add_Click(object sender, EventArgs e) { try { if (Context.Request["tj_pd"].ToString() == "tj_true") { ku_cun kc = new ku_cun(); ming_xi_info mxi = new ming_xi_info(); for (int i = 0; i < (Convert.ToInt32(Context.Request["row_i"].ToString()) - 1); i++) { if (Context.Request["sp_name" + i] != null) { List <ku_cun> list_kc = new List <ku_cun>(); List <ku_cun> selectkc = new List <ku_cun>(); selectkc = select_kc(Session["username"].ToString(), Session["gs_name"].ToString(), Context.Request["sp_dm" + i].ToString()) as List <ku_cun>; if (selectkc.Count <= 0) { kc.Name = Context.Request["sp_name" + i].ToString(); kc.Sp_dm = Context.Request["sp_dm" + i].ToString(); kc.Lei_bie = Context.Request["sp_cplb" + i].ToString(); kc.Shou_jia = Context.Request["sp_cpsj" + i].ToString(); kc.Shu_liang = Context.Request["sp_cpsl" + i].ToString(); kc.Bei_zhu = Context.Request["sp_bz" + i].ToString(); kc.Dan_hao = Context.Request["orderid"].ToString(); kc.Gong_huo = Context.Request["gongsi"].ToString(); kc.Shou_huo = Context.Request["shou_h"].ToString(); kc.Ri_qi = Context.Request["shijian"].ToString(); kc.Id = mxi.Id = (Convert.ToInt32(kc_id) + i + 1).ToString(); kc.zh_name = Session["username"].ToString(); kc.gs_name = Session["gs_name"].ToString(); kc.Mx_lb = "入库"; list_kc.Add(kc); add_kc(list_kc); } else { int sl = Convert.ToInt32(Context.Request["sp_cpsl" + i].ToString()) + Convert.ToInt32(selectkc[0].Shu_liang); update_kc(Context.Request["sp_dm" + i].ToString(), sl.ToString()); } //明细!!!!! List <ming_xi_info> list = new List <ming_xi_info>(); mxi.Cpname = Context.Request["sp_name" + i].ToString(); mxi.sp_dm = Context.Request["sp_dm" + i].ToString(); mxi.Cplb = Context.Request["sp_cplb" + i].ToString(); mxi.Cpsj = Context.Request["sp_cpsj" + i].ToString(); mxi.Cpsl = Context.Request["sp_cpsl" + i].ToString(); mxi.Orderid = Context.Request["orderid"].ToString(); mxi.Gongsi = Context.Request["gongsi"].ToString(); mxi.shou_h = Context.Request["shou_h"].ToString(); mxi.Shijian = Context.Request["shijian"].ToString(); mxi.Openid = "1"; mxi.Id = (Convert.ToInt32(kc_id) + i + 1).ToString(); mxi.zh_name = Session["username"].ToString(); mxi.gs_name = Session["gs_name"].ToString(); mxi.Mxtype = "入库"; list.Add(mxi); insert_ruku(list); } if (i == (Convert.ToInt32(Context.Request["row_i"].ToString()) - 2)) { Response.Write(" <script>alert('入库成功'); location='ru_ku.aspx';</script>"); } } } } catch (Exception ex) { throw; } }