protected void delete_Click(object sender, EventArgs e) { int temp = candelete(); if (temp == 0) { foreach (RepeaterItem Retem in EQU_Need_List_Repeater.Items) { CheckBox cbk = Retem.FindControl("CKBOX_SELECT") as CheckBox; if (cbk.Checked) { string code = ((Label)Retem.FindControl("DocuNum")).Text; string sqltext = "delete from EQU_Need where DocuNum='" + code + "'"; string sqltext1 = "delete from EQU_Need_Audit where DocuNum='" + code + "'"; DBCallCommon.ExeSqlText(sqltext); DBCallCommon.ExeSqlText(sqltext1); } } bindRepeater(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('删除成功!');window.location.href=window.location.href;", true); } else if (temp == 1) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('未选择数据!');", true); } else if (temp == 2) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('您不是制单人,无权删除!');", true); } else if (temp == 3) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('正在审核中,不能删除!');", true); } }
protected void delete_Click(object sender, EventArgs e) { int temp = candelete(); if (temp == 0) { foreach (RepeaterItem Retem in tbpc_otherpurbill_list_Repeater.Items) { CheckBox cbk = Retem.FindControl("CKBOX_SELECT") as CheckBox; if (cbk.Checked) { string code = ((Label)Retem.FindControl("PCODE")).Text; string sqltext = "delete from TBPC_OTPURRVW where MP_PCODE='" + code + "'"; string sqltext1 = "delete from TBPC_OTPURPLAN where MP_PCODE='" + code + "'"; string sqltext2 = "delete from TBPC_OTPUR_AUDIT where PA_CODE='" + code + "'"; DBCallCommon.ExeSqlText(sqltext); DBCallCommon.ExeSqlText(sqltext1); DBCallCommon.ExeSqlText(sqltext2); } } bindRepeater(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('删除成功!');window.location.href=window.location.href;", true); } else if (temp == 1) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('未选择数据!');", true); } else if (temp == 2) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('您不是制单人,无权删除!');", true); } else if (temp == 3) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('正在审核中,不能删除!');", true); } }
//删除库存占用单 protected void btn_delete_click(object sender, EventArgs e) { int temp = candelete(); int j = 0; if (temp == 0) { foreach (RepeaterItem Retem in tbpc_pchsplanrvwchecklistRepeater.Items) { System.Web.UI.WebControls.CheckBox cbk = Retem.FindControl("CKBOX_SELECT") as System.Web.UI.WebControls.CheckBox; if (cbk.Checked) { string code = ((System.Web.UI.WebControls.Label)Retem.FindControl("PR_PCODE")).Text;//批号 string sqlde = "select PUR_PTCODE,PUR_NEWSQCODE,PUR_SQCODE,PUR_USTNUM from TBPC_MARSTOUSEALLDETAIL where PUR_PCODE='" + code + "'"; System.Data.DataTable dt1 = DBCallCommon.GetDTUsingSqlText(sqlde); for (int i = 0; i < dt1.Rows.Count; i++) { string ptcode1 = dt1.Rows[i]["PUR_PTCODE"].ToString(); string newsqcode = dt1.Rows[i]["PUR_NEWSQCODE"].ToString(); string oldsqcode = dt1.Rows[i]["PUR_SQCODE"].ToString(); double num = Convert.ToDouble(dt1.Rows[i]["PUR_USTNUM"].ToString()); //**********************改变备库量********************* string sqltext = "select * from TBWS_STORAGE where SQ_CODE ='" + oldsqcode + "' AND SQ_PTC='备库'"; System.Data.DataTable dt = DBCallCommon.GetDTUsingSqlText(sqltext); if (dt.Rows.Count > 0) { string sqltext1 = "update TBWS_STORAGE set SQ_NUM=SQ_NUM+" + num + " where SQ_CODE ='" + oldsqcode + "' AND SQ_PTC='备库'"; DBCallCommon.ExeSqlText(sqltext1); string sqltext2 = "delete from TBWS_STORAGE where SQ_CODE='" + newsqcode + "'"; DBCallCommon.ExeSqlText(sqltext2); } else { string sqltext3 = "update TBWS_STORAGE set SQ_PTC='备库',SQ_CODE='" + oldsqcode + "' where SQ_CODE='" + newsqcode + "'"; DBCallCommon.ExeSqlText(sqltext3); } } string sql = "select PUR_PTCODE from TBPC_MARSTOUSEALL where PUR_PCODE='" + code + "'"; System.Data.DataTable dt2 = DBCallCommon.GetDTUsingSqlText(sql); for (int i = 0; i < dt2.Rows.Count; i++) { string ptcode = dt2.Rows[i]["PUR_PTCODE"].ToString(); sql = "select * from TBPC_PURCHASEPLAN where PUR_PTCODE='" + ptcode + "'"; System.Data.DataTable dt5 = DBCallCommon.GetDTUsingSqlText(sql); if (dt5.Rows.Count > 0) { string cgr = dt5.Rows[0]["PUR_CGMAN"].ToString(); if (dt5.Rows.Count == 2) { double num1 = Convert.ToDouble(dt5.Rows[0]["PUR_NUM"].ToString()); double fznum1 = Convert.ToDouble(dt5.Rows[0]["PUR_FZNUM"].ToString()); if (cgr == "") { sql = "update TBPC_PURCHASEPLAN set PUR_STATE='0' where PUR_PTCODE='" + ptcode + "' and PUR_CSTATE='1'"; } else { sql = "update TBPC_PURCHASEPLAN set PUR_STATE='4' where PUR_PTCODE='" + ptcode + "' and PUR_CSTATE='1'"; } DBCallCommon.ExeSqlText(sql); } else { double num1 = Convert.ToDouble(dt5.Rows[0]["PUR_NUM"].ToString()); double fznum1 = Convert.ToDouble(dt5.Rows[0]["PUR_FZNUM"].ToString()); if (cgr == "") { sql = "update TBPC_PURCHASEPLAN set PUR_STATE='0' where PUR_PTCODE='" + ptcode + "'"; } else { sql = "update TBPC_PURCHASEPLAN set PUR_STATE='4' where PUR_PTCODE='" + ptcode + "'"; } DBCallCommon.ExeSqlText(sql); } } string sql2 = "delete from TBPC_MARSTOUSEALLDETAIL where PUR_PTCODE='" + ptcode + "'"; DBCallCommon.ExeSqlText(sql2); } string sqltext4 = "delete from TBPC_MARSTOUSEALL where PUR_PCODE='" + code + "'"; DBCallCommon.ExeSqlText(sqltext4); sqltext4 = "delete from TBPC_MARSTOUSETOTAL where PR_PCODE='" + code + "'"; DBCallCommon.ExeSqlText(sqltext4); } } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('删除成功!');", true); lb_CurrentPage.Text = "1"; getArticle(); } else if (temp == 1) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('未选择数据!');", true); } else if (temp == 2) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('您不是制单人,无权删除!');", true); } }
//protected void btn_back_Click(object sender, EventArgs e)//返回 //{ //} private void savedate() { string sqltext = ""; int i = 0; List <string> sqltextlist = new List <string>(); string mpcode = ""; string ptcode = ""; string newmarid = ""; double newnuma = 0; double newnumb = 0; double length = 0; double width = 0; string newnote = ""; foreach (RepeaterItem Retem in Marreplace_edit_repeater.Items) { newnuma = Convert.ToDouble(((TextBox)Retem.FindControl("TMP_NEWNUMA")).Text == "" ? "0" : ((TextBox)Retem.FindControl("TMP_NEWNUMA")).Text); if (newnuma == 0) { i++; break; } } if (i > 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请输入代用数量!');", true); } else { //2017.5.12修改,修改发给部长,没部长发给人本人通知 //2018.3.26修改,修改部门领导李利恒 string str = "select ST_ID from TBDS_STAFFINFO where ST_POSITION='0701' and ST_PD='0'"; System.Data.DataTable leader = DBCallCommon.GetDTUsingSqlText(str); string lead = ""; if (leader.Rows.Count > 0) { lead = leader.Rows[0][0].ToString(); } if (!string.IsNullOrEmpty(lead)) { //2017.8.29修改,MP_CHARGEID修改为技术部长ID,原为写死'曹卫亮'ID。 sqltext = "update TBPC_MARREPLACETOTAL set MP_STATE='000',MP_LEADER=" + lead + ",MP_REASON='',MP_FILLFMTIME='" + Tb_Date.Text + "'," + "MP_REVIEWAADVC='',MP_REVIEWATIME='',MP_CHARGEID=(SELECT TOP 1 st_id FROM dbo.TBDS_STAFFINFO WHERE ST_POSITION='0301' and ST_PD='0'),MP_CHARGETIME='',MP_CHARGEADVC='',MP_NOTE='" + Tb_Abstract.Text + "' where MP_CODE='" + Tb_Code.Text + "'"; sqltextlist.Add(sqltext); sqltext = "delete from TBPC_MARREPLACEDETAIL where MP_CODE='" + Tb_Code.Text + "'"; sqltextlist.Add(sqltext); foreach (RepeaterItem Retem in Marreplace_edit_repeater.Items) { mpcode = Tb_Code.Text; ptcode = ((Label)Retem.FindControl("MP_PTCODE")).Text.ToString(); newmarid = ((TextBox)Retem.FindControl("MP_NEWMARID")).Text.ToString(); newnuma = Convert.ToDouble(((TextBox)Retem.FindControl("TMP_NEWNUMA")).Text == "" ? "0" : ((TextBox)Retem.FindControl("TMP_NEWNUMA")).Text); newnumb = Convert.ToDouble(((TextBox)Retem.FindControl("TMP_NEWNUMB")).Text == "" ? "0" : ((TextBox)Retem.FindControl("TMP_NEWNUMB")).Text); length = Convert.ToDouble(((TextBox)Retem.FindControl("MP_NEWLENGTH")).Text == "" ? "0" : ((TextBox)Retem.FindControl("MP_NEWLENGTH")).Text); width = Convert.ToDouble(((TextBox)Retem.FindControl("MP_NEWWIDTH")).Text == "" ? "0" : ((TextBox)Retem.FindControl("MP_NEWWIDTH")).Text); newnote = ((TextBox)Retem.FindControl("MP_NEWNOTE")).Text.ToString(); sqltext = "insert into TBPC_MARREPLACEDETAIL(MP_CODE,MP_PTCODE,MP_NEWMARID," + "MP_NEWNUMA,MP_NEWNUMB,MP_LENGTH,MP_WIDTH,MP_NEWNOTE) values " + "('" + mpcode + "','" + ptcode + "','" + newmarid + "'," + newnuma + "," + newnumb + "," + length + "," + width + ",'" + newnote + "')"; sqltextlist.Add(sqltext); } DBCallCommon.ExecuteTrans(sqltextlist); Response.Redirect("~/PC_Data/PC_TBPC_Marreplace_panel.aspx?mpno=" + Tb_Code.Text); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('采购部暂时无部长,无法进行审批操作,请及时与负责人沟通!');", true); return; } } }