protected void Button1_Click(object sender, EventArgs e) { if (Session["anti_refresh"] != "1") { // JSHelper.WriteScript("alert('请勿重复提交');history.back();"); // Response.End(); } Session["anti_refresh"] = "0"; helper.Params.Clear(); helper.Params.Add("factory_manager", Request["factory_manager"]); helper.Params.Add("our_manager", Request["our_manager"]); helper.Params.Add("factory_id", Request["factory_id"]); helper.Params.Add("warehouse_id", Request["from_warehouse_id"]); helper.Params.Add("start_date", Request["start_date"]); helper.Params.Add("end_date", Request["end_date"]); helper.Params.Add("work_remark", work_remark.Text); if (work_id == 0) { string ProductionSn = ProductionHelper.genProductionSn(); helper.Params.Add("work_sn", ProductionSn); helper.Params.Add("operator_id", HttpContext.Current.Session["ManageUserId"].ToString()); helper.Insert("Tb_Working"); work_id = Convert.ToInt32(helper.ExecScalar("select top 1 work_id from Tb_Working order by work_id desc")); helper.Params.Clear(); helper.Execute("update Tb_Working_material set work_id=" + work_id + " where wm_id in (select wm_id from Tb_Working_main where work_id=0 and operator_id=" + HttpContext.Current.Session["ManageUserId"].ToString() + ")"); helper.Execute("update Tb_Working_main set work_id=" + work_id + " where work_id=0 and operator_id=" + HttpContext.Current.Session["ManageUserId"].ToString()); helper.Execute(" update a set a.do_cost=b.do_cost,a.other_cost=b.other_cost,a.pro_code_new=b.pro_code from dbo.Tb_Working_main a,Tb_template b where a.work_id=" + work_id + " and a.tpl_id=b.tpl_id"); } else { helper.Params.Add("work_id", work_id); helper.Update("Tb_Working", "work_id"); } JSHelper.WriteScript("alert('编辑成功');location.href='ProductionList.Aspx';"); Response.End(); }