protected void btn_confirm_Click(object sender, EventArgs e) { name = Session["UserID"].ToString(); /************评审状态************/ char BP_STATUS = '0'; bindreviewer(true); /*******评审完了的状态********/ string BP_SPSTATUS = Lbstatus.Text.Trim(); int len = Lbstatus.Text.Trim().Length; StringBuilder sb_status = new StringBuilder(); for (int i = 0; i < len; i++) { sb_status.Append("1"); } if (BP_SPSTATUS == sb_status.ToString()) { BP_STATUS = '1'; } if (reviewx != string.Empty && review != string.Empty) { string sqlupdate = string.Empty; if (lbyesorno.Text == "N") { sqlupdate = "update TBBS_CONREVIEW set " + reviewx + " ='" + review + "',BP_SPSTATUS='" + BP_SPSTATUS + "',BP_STATUS='" + BP_STATUS + "',BP_YESORNO='" + lbyesorno.Text + "' where BC_ID='" + id + "'"; } else if (lbyesorno.Text == "Y") { if (Session["UserDeptID"].ToString().Equals("01")) { sqlupdate = "update TBBS_CONREVIEW set " + reviewx + " ='" + review + "',BP_SPSTATUS='" + BP_SPSTATUS + "',BP_STATUS='" + BP_STATUS + "' where BC_ID='" + id + "'"; } else { sqlupdate = "update TBBS_CONREVIEW set " + reviewx + " ='" + review + "',BP_SPSTATUS='" + BP_SPSTATUS + "',BP_STATUS='" + BP_STATUS + "',BP_LEADPS='" + getReviewer() + "' where BC_ID='" + id + "'"; } } else if (lbyesorno.Text == "") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请选择评论结果!!!');", true); return; } DBCallCommon.ExeSqlText(sqlupdate); } Response.Redirect("PD_DocManage.aspx"); }
protected void Append_Click(object sender, EventArgs e) { DataTable tb; tb = getDataFromGridView(); string sql = "SELECT UniqueID='',SQCODE AS SQCODE,MaterialCode AS MaterialCode,MaterialName AS MaterialName," + "Attribute AS Attribute,GB AS GB,Standard AS MaterialStandard,Fixed AS Fixed,CAST(Length AS CHAR(50)) AS Length," + "CAST(Width AS CHAR(50)) AS Width,LotNumber AS LotNumber,PTC AS PTCFrom,WarehouseCode AS WarehouseCode," + "Warehouse AS Warehouse,LocationCode AS PositionCode,Location AS Position,Unit AS Unit,CAST(Number AS CHAR(50)) AS WN," + "CAST(SupportNumber AS CHAR(50)) AS WQN,PTCTO='--请选择--',PlanMode AS PlanMode,CAST(Number AS CHAR(50)) AS AdjN," + "CAST(SupportNumber AS CHAR(50)) AS AdjQN,Note AS Note,OrderCode AS OrderID " + "FROM View_SM_Storage WHERE State='APPENDMTO" + Session["UserID"].ToString() + "'"; DataTable temp = new DataTable(); temp.Columns.Add("UniqueID", System.Type.GetType("System.String")); temp.Columns.Add("SQCODE", System.Type.GetType("System.String")); temp.Columns.Add("MaterialCode", System.Type.GetType("System.String")); temp.Columns.Add("MaterialName", System.Type.GetType("System.String")); temp.Columns.Add("Attribute", System.Type.GetType("System.String")); temp.Columns.Add("GB", System.Type.GetType("System.String")); temp.Columns.Add("MaterialStandard", System.Type.GetType("System.String")); temp.Columns.Add("Length", System.Type.GetType("System.String")); temp.Columns.Add("Width", System.Type.GetType("System.String")); temp.Columns.Add("LotNumber", System.Type.GetType("System.String")); temp.Columns.Add("PTCFrom", System.Type.GetType("System.String")); temp.Columns.Add("Warehouse", System.Type.GetType("System.String")); temp.Columns.Add("WarehouseCode", System.Type.GetType("System.String")); temp.Columns.Add("Position", System.Type.GetType("System.String")); temp.Columns.Add("PositionCode", System.Type.GetType("System.String")); temp.Columns.Add("Unit", System.Type.GetType("System.String")); temp.Columns.Add("WN", System.Type.GetType("System.String")); temp.Columns.Add("WQN", System.Type.GetType("System.String")); temp.Columns.Add("PTCTo", System.Type.GetType("System.String")); temp.Columns.Add("PlanMode", System.Type.GetType("System.String")); temp.Columns.Add("AdjN", System.Type.GetType("System.String")); temp.Columns.Add("AdjQN", System.Type.GetType("System.String")); temp.Columns.Add("Note", System.Type.GetType("System.String")); temp.Columns.Add("OrderID", System.Type.GetType("System.String")); temp = DBCallCommon.GetDTUsingSqlText(sql); tb.Merge(temp); GridView1.DataSource = tb; GridView1.DataBind(); sql = "UPDATE TBWS_STORAGE SET SQ_STATE='' WHERE SQ_STATE='APPENDMTO" + Session["UserID"].ToString() + "'"; DBCallCommon.ExeSqlText(sql); LabelMessage.Text = "追加成功!"; }
protected void Submit_Click(object sender, EventArgs e) //提交任务单到生产任务单内容和生产任务单总表 { string PT_CODE = TextBox1.Text.Trim(); //生产任务编号 string PT_ENGCONTEXT = TextBox2.Text.Trim(); //工程内容 float PT_QUANTITY = Convert.ToInt32(TextBox3.Text); //数量 float PT_ENGNUM = Convert.ToInt32(TextBox4.Text); // 工程量 string PT_DLVRYDATE = DateTime.Now.ToShortDateString(); //交货日期 string PT_DRAWINGDATE = DateTime.Now.ToShortDateString(); //图纸交付时间 float PT_COST = Convert.ToInt32(TextBox5.Text); //成本 string PT_STATE = TextBox6.Text.Trim(); //状态 string PT_NOTE = TextBox7.Text.Trim(); //备注 string PT_PMCHARGERNM = TextBox8.Text.Trim(); //项目管理部负责人 string PT_BPCHARGERNM = TextBox9.Text.Trim(); //经营策划部负责人 string PT_PDCHARGERNM = TextBox10.Text.Trim(); //生产单位负责人 string PT_ICKCOMNM = TextBox11.Text.Trim(); //收入核算单位 string PT_PMEXECUTENM = TextBox12.Text.Trim(); //项目管理部经办人 string PT_BPEXECUTENM = TextBox13.Text.Trim(); //经营策划部经办人 string PT_PDEXECUTENM = TextBox14.Text.Trim(); //生产单位经办人 string PT_TNCHARGERNM = TextBox15.Text.Trim(); //技术负责人 if (action == "update") { string sqlUpdate1 = "update TBMP_PRDCTTASKDETAIL set PT_CODE='" + PT_CODE + "',PT_ENGCONTEXT='" + PT_ENGCONTEXT + "',PT_QUANTITY='" + PT_QUANTITY + "',PT_ENGNUM='" + PT_ENGNUM + "',PT_DLVRYDATE='" + PT_DLVRYDATE + "',PT_DRAWINGDATE='" + PT_DRAWINGDATE + "',PT_COST='" + PT_COST + "',PT_NOTE='" + PT_NOTE + "'where PT_CODE='" + PT_CODE + "'"; string sqlUpdate2 = "update TBMP_PRDCTTASKTOTAL set PT_CODE='" + PT_CODE + "',PT_PMCHARGERNM='" + PT_PMCHARGERNM + "',PT_BPCHARGERNM='" + PT_BPCHARGERNM + "',PT_PDCHARGERNM='" + PT_PDCHARGERNM + "',PT_ICKCOMNM='" + PT_ICKCOMNM + "',PT_PMEXECUTENM='" + PT_PMEXECUTENM + "',PT_BPEXECUTENM='" + PT_BPEXECUTENM + "',PT_PDEXECUTENM='" + PT_PDEXECUTENM + "',PT_TNCHARGERNM ='" + PT_TNCHARGERNM + "'where PT_CODE='" + PT_CODE + "'"; DBCallCommon.ExeSqlText(sqlUpdate1); DBCallCommon.ExeSqlText(sqlUpdate2); } else { //插入命令 string sqlInsert1 = "insert into TBMP_PRDCTTASKDETAIL (PT_CODE,PT_ENGCONTEXT,PT_QUANTITY ,PT_ENGNUM,PT_DLVRYDATE,PT_DRAWINGDATE,PT_COST,PT_STATE,PT_NOTE ) values( '" + PT_CODE + "','" + PT_ENGCONTEXT + "','" + PT_QUANTITY + "','" + PT_ENGNUM + "','" + PT_DLVRYDATE + "','" + PT_DRAWINGDATE + "','" + PT_COST + "','" + PT_STATE + "','" + PT_NOTE + "')"; string sqlInsert2 = "insert into TBMP_PRDCTTASKTOTAL (PT_PJID,PT_PJNAME,PT_ENGID,PT_ENGNAME,PT_CODE,PT_PMCHARGERNM,PT_BPCHARGERNM ,PT_PDCHARGERNM,PT_ICKCOMNM ,PT_PMEXECUTENM,PT_BPEXECUTENM,PT_PDEXECUTENM,PT_TNCHARGERNM ) values('" + PT_PJID + "','" + tbproject.Text + "','" + PT_ENGID + "','" + tbeng.Text + "','" + PT_CODE + "','" + PT_PMCHARGERNM + "','" + PT_BPCHARGERNM + "','" + PT_PDCHARGERNM + "','" + PT_ICKCOMNM + "','" + PT_PMEXECUTENM + "','" + PT_BPEXECUTENM + "','" + PT_PDEXECUTENM + "','" + PT_TNCHARGERNM + "')"; List <string> sqlTexts = new List <string>(); sqlTexts.Add(sqlInsert1); sqlTexts.Add(sqlInsert2); DBCallCommon.ExecuteTrans(sqlTexts); sql = "insert into TBPM_TCTSASSGN (TSA_TSNAME,TSA_PJID,TSA_PJNAME,TSA_ENGID,"; sql += "TSA_ENGNAME,TSA_STATE)values ('" + PT_ENGCONTEXT + "','" + PT_PJID + "','" + tbproject.Text + "','" + PT_ENGID + "','" + tbeng.Text + "','0')"; DBCallCommon.ExeSqlText(sql); } Response.Redirect("TM_HZY_info.aspx"); }
protected void Continue_Click(object sender, EventArgs e) { string sql = "INSERT INTO TBTM_GNFY( GNFY_YEAR,GNFY_PJNAME,GNFY_ENGNAME,GNFY_HTBH,GNFY_HTJE,GNFY_RZB," + "GNFY_ZW,GNFY_ZV,GNFY_DJTIME,GNFY_ZL1,GNFY_ZL2," + "GNFY_TJ1,GNFY_TJ2,GNFY_CC,GNFY_GBZL,GNFY_LJE," + "GNFY_BZ,GNFY_CLERKID,GNFY_DATE)" + "VALUES('" + TextBoxYEAR.Text + "','" + TextBoxProject.Text + "','" + TextBoxEngine.Text + "','" + TextBoxHTBH.Text + "','" + TextBoxHTJE.Text + "','" + TextBoxRZB.Text + "','" + TextBoxZZL.Text + "','" + TextBoxZTJ.Text + "','" + TextBoxDJTIME.Text + "','" + TextBoxZL.Text + "','" + TextBoxZL1.Text + "','" + TextBoxTJ.Text + "','" + TextBoxTJ1.Text + "','" + TextBoxCC.Text + "','" + TextBoxGBZL.Text + "','" + TextBoxZZJSJE.Text + "','" + TextBoxBZ.Text + "','" + Session["UserID"].ToString() + "','" + DateTime.Now + "')"; DBCallCommon.ExeSqlText(sql); Response.Redirect("SM_Trans_GNFYEdit.aspx?FLAG=NEW&&ID=NEW"); }
protected void Continue_Click(object sender, EventArgs e) { string sql = "INSERT INTO TBTM_SHC(SHC_PROJECT,SHC_FYXS,SHC_FYPC,SHC_HWMS," + "SHC_JS,SHC_TJ,SHC_MZ,SHC_ZYG,SHC_JGWB,SHC_ZC," + "SHC_HY,SHC_CM,SHC_BZ,SHC_YEAR,SHC_CLERKID," + "SHC_DATE)" + "VALUES('" + TextBoxProject.Text + "','" + TextBoxFYXS.Text + "','" + TextBoxFYPC.Text + "','" + TextBoxHWMS.Text + "','" + TextBoxJS.Text + "','" + TextBoxTJ.Text + "','" + TextBoxMZ.Text + "','" + TextBoxZYG.Text + "','" + TextBoxJGWB.Text + "','" + TextBoxZC.Text + "','" + TextBoxHY.Text + "','" + TextBoxCM.Text + "','" + TextBoxBZ.Text + "','" + TextBoxYEAR.Text + "','" + Session["UserID"].ToString() + "','" + DateTime.Now + "')"; DBCallCommon.ExeSqlText(sql); Response.Redirect("SM_Trans_SHCEdit.aspx?FLAG=NEW&&ID=NEW"); }
protected void Continue_Click(object sender, EventArgs e) { string sql = "INSERT INTO TBTM_CNJG(CNJG_CC,CNJG_MDG,CNJG_RZB,CNJG_HTH," + "CNJG_LLSTARTDATE,CNJG_LLENDDATE,CNJG_LLFDJZL,CNJG_LLDJZL,CNJG_LLZTJ," + "CNJG_LLZZL,CNJG_LLCC,CNJG_GBFDJZL,CNJG_GBDJZL,CNJG_GBJE,CNJG_ZCJSZL," + "CNJG_ZCJSJE,CNJG_BZ,CNJG_YEAR,CNJG_CLERK,CNJG_DATE)" + "VALUES('" + TextBoxCC.Text + "','" + TextBoxMDG.Text + "','" + TextBoxRZB.Text + "','" + TextBoxHTH.Text + "','" + TextBoxLLSTARTDATE.Text + "','" + TextBoxLLENDDATE.Text + "','" + TextBoxLLFDJZL.Text + "','" + TextBoxLLDJZL.Text + "','" + TextBoxLLZTJ.Text + "','" + TextBoxLLZZL.Text + "','" + TextBoxLLCC.Text + "','" + TextBoxGBFDJZL.Text + "','" + TextBoxGBDJZL.Text + "','" + TextBoxGBJE.Text + "','" + TextBoxZCJSZL.Text + "','" + TextBoxZCJSJE.Text + "','" + TextBoxBZ.Text + "','" + TextBoxYEAR.Text + "','" + Session["UserID"].ToString() + "','" + DateTime.Now + "')"; DBCallCommon.ExeSqlText(sql); Response.Redirect("SM_Trans_CNJGEdit.aspx?FLAG=NEW&&ID=NEW"); }
protected void btn_antiadjust_Click(object sender, EventArgs e) { string sql = "update TBFM_STORAGEBAL set SI_BEGDIFF=0 where SI_YEAR='" + DateTime.Now.Year.ToString() + "' and SI_PERIOD='" + DateTime.Now.Month.ToString().PadLeft(2, '0') + "' and SI_BEGNUM=0 and SI_BEGDIFF<>0"; DBCallCommon.ExeSqlText(sql); string script = @"<script language='javascript' type='text/javascript'>alert('反调整成功!')</script>"; ExecuteJS(script); UCPaging1.CurrentPage = 1; bindGrid(); btn_adjust.Enabled = true; btn_antiadjust.Enabled = false; }
protected void btnsubmit_Click(object sender, EventArgs e) { StringBuilder col = new StringBuilder(); foreach (Control control in panel.Controls) { if (control is TextBox) { col.Append(control.ID + "='" + ((TextBox)control).Text + "',"); } } string column = col.ToString(0, col.Length - 1); string sql = string.Format("update TBCM_APPLICA set {0} where CM_ID='{1}'", column, Request.QueryString["id"]); DBCallCommon.ExeSqlText(sql); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('已成功更新!');window.opener=null;window.open('','_self');window.close();", true); }
protected string GetQueryCondition() { string sql = "select WhereCondition from TBPM_TEMPWHERECONDITION where USERID='" + Session["UserID"].ToString() + "'"; DataTable dt = DBCallCommon.GetDTUsingSqlText(sql); if (dt.Rows.Count > 0) { ViewState["Where"] = dt.Rows[0][0].ToString(); string sql_delete = "delete from TBPM_TEMPWHERECONDITION where USERID='" + Session["UserID"].ToString() + "'"; DBCallCommon.ExeSqlText(sql_delete); return("OK"); } else { return("Null"); } }
public void SetInspectPer() { string num = Request["num"]; string per = Request["per"]; string isDiret = Request["isDiret"]; string sql = "update TBQM_SetInspectPerson set IsDiret='" + isDiret + "',InspectPerson='" + per + "',AddPerson='" + Session["UserID"].ToString() + "',Addtime='" + DateTime.Now.ToString("yyyy-MM-dd") + "' where num='" + num + "'"; try { DBCallCommon.ExeSqlText(sql); Response.Write("true"); } catch (Exception) { Response.Write("false"); } }
//删除批注 //更新批注或变更备注 public void DeletePiZhu() { string mspId = Request.Form["txtPId"].ToString(); InitList(mspId); sqlText = "update " + tablename + " set MS_PIZHUBEIZHU='' where MS_PID='" + mspId + "'"; try { DBCallCommon.ExeSqlText(sqlText); result = "{\"msg\":\"更新成功\"}"; } catch (Exception) { result = "{\"msg\":\"更新失败\"}"; } Response.Write(result); }
protected void SaveNote_Click(object sender, EventArgs e) { foreach (GridViewRow gr in GridView1.Rows) { string taskid = GridView1.DataKeys[gr.RowIndex].Values["RP_TSAID"].ToString(); string marid = GridView1.DataKeys[gr.RowIndex].Values["marid"].ToString(); string note = ((System.Web.UI.WebControls.TextBox)gr.FindControl("TextBoxNote")).Text.Trim().ToString(); double lynum = 0; try { lynum = Convert.ToDouble(((System.Web.UI.WebControls.TextBox)gr.FindControl("TextBoxLingYong")).Text.Trim().ToString()); } catch { lynum = 0; } string sqltext = "select NOTE,ISNULL(LINGYONG,0) AS LINGYONG from tbws_xueyongnote where TASKID='" + taskid + "' and MARID='" + marid + "'"; System.Data.DataTable dt = DBCallCommon.GetDTUsingSqlText(sqltext); string oldenote = ""; double oldly = 0; if (dt.Rows.Count > 0) { oldenote = dt.Rows[0]["NOTE"].ToString(); oldly = Convert.ToDouble(dt.Rows[0]["LINGYONG"].ToString()); } if ((note != oldenote) || (lynum != oldly)) { string sql = ""; string notedate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); string sqlstr = "SELECT * FROM tbws_xueyongnote WHERE TASKID='" + taskid + "' and MARID='" + marid + "'"; System.Data.DataTable dtb = DBCallCommon.GetDTUsingSqlText(sqlstr); if (dtb.Rows.Count > 0) { sql = "UPDATE tbws_xueyongnote set note='" + note + "',LINGYONG=" + lynum + ",notedate='" + notedate + "' where TASKID='" + taskid + "'and MARID='" + marid + "'"; } else { sql = "INSERT INTO tbws_xueyongnote(TASKID,MARID,LINGYONG,NOTE,NOTEDATE)VALUES('" + taskid + "','" + marid + "'," + lynum + ",'" + note + "','" + notedate + "')"; } DBCallCommon.ExeSqlText(sql); } } string sqlstring = "DELETE FROM tbws_xueyongnote WHERE (NOTE='' OR NOTE IS NULL) AND (LINGYONG=0 OR LINGYONG IS NULL)"; DBCallCommon.ExeSqlText(sqlstring); bindData(); }
private void InitInfo() { //初始化单号 LabelCode.Text = generateTempCode(); string sql = "INSERT INTO TBOM_BGYP_INCODE(Code) VALUES ('" + LabelCode.Text + "')"; DBCallCommon.ExeSqlText(sql); //制单人 LabelDoc.Text = Session["UserName"].ToString(); LabelDocCode.Text = Session["UserID"].ToString(); TextBoxDate.Text = System.DateTime.Now.ToString("yyyy-MM-dd"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string dengluid = Session["UserID"].ToString(); string dengluname = Session["UserName"].ToString(); string ym = "工资汇总查询"; string sql = "insert OM_GZ_JL (USER_ID,USER_NAME,TIME,YM) values ('" + dengluid + "','" + dengluname + "','" + DateTime.Now.ToString() + "','" + ym + "')"; DBCallCommon.ExeSqlText(sql); bindgouxuanbm(); bindgouxuanbz(); bindgouxuangwxl(); bindhetongzhuti(); GetSele(); } CheckUser(ControlFinder); }
protected void Continue_Click(object sender, EventArgs e) { string sql = "INSERT INTO TBTM_GNFY(GNFY_PROJECT,GNFY_HTBH,GNFY_HTJE,GNFY_RZB," + "GNFY_LLSTARTDATE,GNFY_LLENDDATE,GNFY_LLFDJZL,GNFY_LLDJZL,GNFY_LLZTJ," + "GNFY_LLZZL,GNFY_LLCC,GNFY_GBFDJZL,GNFY_GBDJZL,GNFY_ZZJSJE," + "GNFY_ZCJSJE,GNFY_BZ,GNFY_YEAR,GNFY_CLERKID,GNFY_DATE)" + "VALUES('" + TextBoxProject.Text + "','" + TextBoxHTBH.Text + "','" + TextBoxHTJE.Text + "','" + TextBoxRZB.Text + "','" + TextBoxLLSTARTDATE.Text + "','" + TextBoxLLENDDATE.Text + "','" + TextBoxLLFDJZL.Text + "','" + TextBoxLLDJZL.Text + "','" + TextBoxLLZTJ.Text + "','" + TextBoxLLZZL.Text + "','" + TextBoxLLCC.Text + "','" + TextBoxGBFDJZL.Text + "','" + TextBoxGBDJZL.Text + "','" + TextBoxZZJSJE.Text + "','" + TextBoxZCJSJE.Text + "','" + TextBoxBZ.Text + "','" + TextBoxYEAR.Text + "','" + Session["UserID"].ToString() + "','" + DateTime.Now + "')"; DBCallCommon.ExeSqlText(sql); Response.Redirect("SM_Trans_GNFYEdit.aspx?FLAG=NEW&&ID=NEW"); }
protected void lbtnSolve_OnClick(object sender, EventArgs e) { string TZD_ID = ((LinkButton)sender).CommandArgument.ToString().Trim(); string sql = "update PM_SCDYTZ set TZD_CLZT ='1' where TZD_ID=" + TZD_ID; try { DBCallCommon.ExeSqlText(sql); } catch { Response.Write("<script>alert('处理出现问题,请与管理员联系!!!')</script>"); return; } Response.Write("<script>alert('您已成功处理该单据!!!')</script>"); bindrpt(); }
protected void packlist_Click(object sender, EventArgs e) { int count = 0; pk_no = tsa_id.Text + "." + "JSB" + "/" + Session["UserNameCode"] + "/" + "PK"; DeletePKOldData(); InitList(); for (int i = 0; i < GridView1.Rows.Count; i++) { GridViewRow gr = GridView1.Rows[i]; string id = ((Label)gr.FindControl("ID")).Text; tuhao = gr.Cells[2].Text; name = gr.Cells[4].Text; num = gr.Cells[7].Text; uweight = gr.Cells[8].Text; casenum = ((HtmlInputText)gr.FindControl("xianghao")).Value; if (casenum != "") { sqlText = "update " + tablename + " set MS_TIMERQ='" + casenum + "' "; sqlText += "where MS_ID='" + id + "'"; DBCallCommon.ExeSqlText(sqlText); sqlText = "insert into TBPM_PACKINGLIST "; sqlText += "(PL_PACKLISTNO,PL_PACKAGENO,PL_PACKNAME,PL_MARKINGNO,"; sqlText += "PL_PACKQLTY,PL_SINGLENETWGHT)"; sqlText += " values ('" + pk_no + "','" + casenum + "','" + name + "','" + tuhao + "',"; sqlText += "'" + num + "','" + uweight + "')"; DBCallCommon.ExeSqlText(sqlText); count++; } } if (count != 0) { sqlText = "insert into TBPM_PACKLISTTOTAL (PLT_PACKLISTNO,PLT_PJID,PLT_PJNAME,PLT_ENGID,"; sqlText += "PLT_ENGNAME,PLT_SUBMITID,PLT_SUBMITNM)"; sqlText += " values ('" + pk_no + "','" + pro_id.Value + "','" + lab_proname.Text + "','" + tsa_id.Text + "',"; sqlText += "'" + lab_engname.Text + "','" + Session["UserID"] + "','" + Session["UserName"] + "')"; DBCallCommon.ExeSqlText(sqlText); Response.Redirect("TM_Packing_List.aspx?id=" + pk_no + '.' + status.Value); } else { Response.Write("<script>alert('提示:装箱单已提交!')</script>"); return; } }
private void Initial(string tsa) { List <string> list = new List <string>(); //string sqltext = "SELECT marid FROM View_TBPC_MARSTOUSEALL where planno='" + TextBoxNO.Text.ToString() + "' order by ptcode asc"; string sqltext = "select SQCODE from View_SM_Storage where SQCODE like '%" + tsa + "%'"; dtzy = DBCallCommon.GetDTUsingSqlText(sqltext); for (int i = 0; i < dtzy.Rows.Count; i++) { sqltext = "UPDATE TBWS_STORAGE SET SQ_STATE='MTO" + Session["UserID"].ToString() + "' WHERE SQ_CODE='" + dtzy.Rows[i][0].ToString() + "'"; list.Add(sqltext); } DBCallCommon.ExecuteTrans(list); string LabelCode = GenerateCode(); TextBoxDate = DateTime.Now.ToString("yyyy-MM-dd"); string sql = "insert into TBWS_MTOCODE (MTO_CODE) VALUES ('" + LabelCode + "')"; DBCallCommon.ExeSqlText(sql); //LabelState.Text = "0"; ClosingAccountDate(TextBoxDate.Trim()); TextBoxComment = ""; LabelDoc = Session["UserName"].ToString(); LabelDocCode = Session["UserID"].ToString(); LabelVerifier = ""; LabelVerifierCode = ""; LabelApproveDate = ""; sqltext = "SELECT UniqueID='',SQCODE AS SQCODE,MaterialCode AS MaterialCode,MaterialName AS MaterialName," + "Attribute AS Attribute,GB AS GB,Standard AS MaterialStandard,Fixed AS Fixed,Length AS Length," + "Width AS Width,LotNumber AS LotNumber,PlanMode AS PlanMode,PTC AS PTCFrom," + "WarehouseCode AS WarehouseCode,Warehouse AS Warehouse,LocationCode AS PositionCode," + "Location AS Position,Unit AS Unit,cast(Number as float) AS WN,cast(SupportNumber as float) AS WQN,PTCTO='--请选择--',cast(Number as float) AS AdjN," + "cast(SupportNumber as float) AS AdjQN,OrderCode AS OrderID,Note AS Note " + "FROM View_SM_Storage WHERE State='MTO" + Session["UserID"].ToString() + "'"; mto = DBCallCommon.GetDTUsingSqlText(sqltext); sqltext = "UPDATE TBWS_STORAGE SET SQ_STATE='' WHERE SQ_STATE='MTO" + Session["UserID"].ToString() + "'"; DBCallCommon.ExeSqlText(sqltext); }
//保存 protected void btnsave_click(object sender, EventArgs e) { action = Request.QueryString["action"].ToString().Trim(); string sqltext = ""; if (dplYear.SelectedIndex == 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请选择年份!');", true); return; } if (action == "add") { string sqlcheck0 = "select * from FM_HTYUSUAN where ht_year='" + dplYear.SelectedValue.ToString().Trim() + "'"; DataTable dtcheck0 = DBCallCommon.GetDTUsingSqlText(sqlcheck0); if (dtcheck0.Rows.Count > 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('已存在该年度数据!');", true); return; } else { sqltext = "insert into FM_HTYUSUAN(ht_year,ht_addname,ht_addid,ht_addtime,ht_yusuanhte,ht_note,beiyong1) values('" + dplYear.SelectedValue.ToString().Trim() + "','" + Session["UserName"].ToString().Trim() + "','" + Session["UserID"].ToString().Trim() + "','" + ht_addtime.Text.Trim() + "'," + CommonFun.ComTryDecimal(ht_yusuanhte.Text.Trim()) + ",'" + ht_note.Text.Trim() + "','')"; DBCallCommon.ExeSqlText(sqltext); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "window.opener.location = window.opener.location.href;window.close();", true); } } else if (action == "edit") { id_htys = Request.QueryString["id_htys"].ToString().Trim(); string sqlcheck1 = "select * from FM_HTYUSUAN where ht_year='" + dplYear.SelectedValue.ToString().Trim() + "' and id_htys!='" + id_htys + "'"; DataTable dtcheck1 = DBCallCommon.GetDTUsingSqlText(sqlcheck1); if (dtcheck1.Rows.Count > 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('已存在该年度数据!');", true); return; } else { sqltext = "update FM_HTYUSUAN set ht_year='" + dplYear.SelectedValue.ToString().Trim() + "',ht_addname='" + Session["UserName"].ToString().Trim() + "',ht_addid='" + Session["UserID"].ToString().Trim() + "',ht_addtime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Trim() + "',ht_yusuanhte=" + CommonFun.ComTryDecimal(ht_yusuanhte.Text.Trim()) + ",ht_note='" + ht_note.Text.Trim() + "' where id_htys='" + id_htys + "'"; DBCallCommon.ExeSqlText(sqltext); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "window.opener.location = window.opener.location.href;window.close();", true); } } }
//删除 protected void imgbtndelete_Click(object sender, ImageClickEventArgs e) { //获取imgbtnDelete的ImageButton对象 ImageButton imgbtn = (ImageButton)sender; //引用imgbtnDelete控件的父控件上一级控件 GridViewRow gvr = (GridViewRow)imgbtn.Parent.Parent; GridView gv = (GridView)imgbtn.Parent.Parent.Parent.Parent; string idd = ((Label)gvr.FindControl("lbid")).Text; //获取文件真实姓名 string sqlStr = "select SAVEURL,FILENAME from OM_YONGYIN_Attach where ID='" + idd + "'"; //在文件夹Files下,停用该文件 DeleteFile(sqlStr); string sqlDelStr = "delete from OM_YONGYIN_Attach where ID='" + idd + "'";//停用数据库中的记录 DBCallCommon.ExeSqlText(sqlDelStr); GVBind(); }
//更新整批的批注 public void UpdatePiZhu() { string mspId = Request.Form["txtPId"].ToString(); string tsaId = Request.Form["txtTsaid"].ToString(); InitList(mspId); sqlText = "update a set a.MS_PIZHUBEIZHU=b.MS_PIZHUBEIZHU from " + tablename + " as a left join (select MS_ZONGXU,MS_PIZHUBEIZHU,ROW_NUMBER()over(partition by MS_ZONGXU order by MS_PID desc )rownum from " + tablename + " where MS_ENGID='" + tsaId + "' and MS_PIZHUBEIZHU is not null and MS_PIZHUBEIZHU <>'' )b on a.MS_ZONGXU=b.MS_ZONGXU where a.MS_PID='" + mspId + "'"; try { DBCallCommon.ExeSqlText(sqlText); result = "{\"msg\":\"更新成功\"}"; } catch (Exception) { result = "{\"msg\":\"更新失败\"}"; } Response.Write(result); }
//删除 protected void deleteuser_Click(object sender, CommandEventArgs e) { string cscode = e.CommandName; string sql = "delete from PC_USERINFO where supplyid='" + cscode + "'"; try { DBCallCommon.ExeSqlText(sql); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert ('删除成功!!!');", true); } catch { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert ('操作出错!!!');", true); return; } UCPaging1.CurrentPage = 1; GetQueryData(); }
protected void btnChuli_OnClick(object sender, EventArgs e)//处理---事件 { string sqltxt = "select A.*,B.MTA_DUY from View_TM_MSFORALLRVW as A left join TBMP_MANUTSASSGN as B on A.MS_ENGID=B.MTA_ID where MS_ID='" + id + "'"; System.Data.DataTable dt = DBCallCommon.GetDTUsingSqlText(sqltxt); string mtaduy = dt.Rows[0]["MTA_DUY"].ToString(); string username = Session["UserName"].ToString(); if (mtaduy == username) { string sqltext = "update TBPM_MSFORALLRVW set MS_LOOKSTATUS='1' where MS_ID='" + id + "'and MS_STATE='8'"; DBCallCommon.ExeSqlText(sqltext); //InitVar(); //this.bindRepeater(); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('您已成功处理该项目')", true); //Response.Write("<script>alert('您已成功处理该项目')</script>"); } }
protected void btnUpdate_OnClick(object sender, EventArgs e) { string sql_tb = "select dbo.TM_GetTableNameByTaskID('" + tsaid.Text.Trim() + "')"; string tablename; DataTable dt_tb = DBCallCommon.GetDTUsingSqlText(sql_tb); tablename = dt_tb.Rows[0][0].ToString(); string sql_getsum = "Select isnull(sum([BM_MATOTALWGHT]),0) from " + tablename + " Where BM_TASKID='" + tsaid.Text.Trim() + "' AND BM_MPSTATE='1' AND [BM_MASHAPE] in('板','型','圆钢') AND [BM_MARID]!=''"; string cldawx = Convert.ToDouble(DBCallCommon.GetDTUsingSqlText(sql_getsum).Rows[0][0].ToString()).ToString("0"); string sql = "update TBPM_TCTSENROLL set TSA_CNWXDLZL=" + cldawx + " where TSA_ID='" + tsaid.Text + "' "; DBCallCommon.ExeSqlText(sql); cnwxdlzl.Value = cldawx; }
protected void btn_del_Click(object sender, EventArgs e) { string strId = ""; foreach (RepeaterItem rptItem in Repeater1.Items) { CheckBox chk = (CheckBox)rptItem.FindControl("chk"); if (chk.Checked) { strId += "'" + ((Label)rptItem.FindControl("CM_ID")).Text + "'" + ","; } } strId = strId.Substring(0, strId.Length - 1); string sqlTxt = "delete from TBCM_CUSTOMER where CM_ID in (" + strId + ")"; DBCallCommon.ExeSqlText(sqlTxt); bindGrid(); }
protected void imgbtnDelete_Click(object sender, ImageClickEventArgs e) { //获取imgbtnDelete的ImageButton对象 ImageButton imgbtn = (ImageButton)sender; //引用imgbtnDelete控件的父控件上一级控件 GridViewRow gvr = (GridViewRow)imgbtn.Parent.Parent; GridView gv = (GridView)imgbtn.Parent.Parent.Parent.Parent; //获取文件真实姓名 string sqlStr = "select fileload,fileName from tb_files where fileID='" + gv.DataKeys[gvr.RowIndex].Value.ToString() + "'"; //在文件夹Files下,删除该文件 DeleteTFN(sqlStr); string sqlDelStr = "delete from tb_files where fileID='" + gv.DataKeys[gvr.RowIndex].Value.ToString() + "'";//删除数据库中的记录 DBCallCommon.ExeSqlText(sqlDelStr); GVBind(AddGridViewFiles);//删除添加的记录 //GVBind(ViewGridViewFiles);//删除查看的记录 }
protected void btnedit_Click(object sender, EventArgs e) { string sql = "update TBCM_CUSTOMER set CM_ZDYJ='" + CM_ZDYJ.Text + "',CM_SFHG='" + CM_SFHG.SelectedValue + "' where CM_ID='" + Request.QueryString["CM_ID"] + "'"; if (CM_SFHG.SelectedValue == "1") { if (psr.Value != "") { string[] strs = psr.Value.Split(','); for (int i = 0; i < strs.Length; i++) { DBCallCommon.SendEmail(DBCallCommon.GetEmailAddressByUserID(strs[i]), new List <string>(), new List <string>(), "顾客财产继续使用", "项目为 " + CM_PJNAME.Text + ",入库内容为 " + CM_INCONT.Text + ",已由市场部改为合格,可继续使用,请登录系统查看"); } } } DBCallCommon.ExeSqlText(sql); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('信息修改成功!');window.opener=null;window.open('','_self');window.close();", true); }
protected void btn_DTFclose_Click(object sender, EventArgs e) { int temp = isselected3(); if (temp == 0)//是否选择数据 { string ptcode = ""; string sql = ""; double num = 0; double fznum = 0; for (int i = 0; i < GridView1.Rows.Count; i++) { GridViewRow gr = GridView1.Rows[i]; System.Web.UI.WebControls.CheckBox cbk = (System.Web.UI.WebControls.CheckBox)gr.FindControl("CheckBox1"); if (cbk.Checked) { ptcode = ((System.Web.UI.WebControls.Label)gr.FindControl("ptcode")).Text; sql = "update TBPC_PURCHASEPLAN set PUR_CSTATE='0',PUR_ZYDY='',Pue_Closetype=NULL where PUR_PTCODE='" + ptcode + "' and (PUR_CSTATE='1' or PUR_CSTATE='2')"; DBCallCommon.ExeSqlText(sql); } } sql = "select PUR_CSTATE from TBPC_PURCHASEPLAN where PUR_PCODE='" + orderno.Text + "' and PUR_CSTATE='0' and PUR_STATE<'3'"; System.Data.DataTable dt1 = DBCallCommon.GetDTUsingSqlText(sql); if (dt1.Rows.Count > 0) { string sql2 = "update TBPC_PCHSPLANRVW set PR_STATE='0' where PR_SHEETNO='" + orderno.Text + "'"; DBCallCommon.ExeSqlText(sql2); } Response.Redirect("~/PC_Data/PC_TBPC_Purchaseplan_startcontent.aspx?mp_id=" + orderno.Text + "&shape=" + tb_shape.Text + ""); //Response.Write("<script>javascript:window.close();</script>"); } 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('现在拆分之后的计划跟踪号上加了&1,这条记录为以前拆分,不能进行单独反关闭!');", true); } }
/// <summary> /// 添加发票记录 /// </summary> private void AddFP() { //合同编号 string giv_htbh = txtHTBH.Text.Trim(); //生产制号 string giv_sczh = txtSCZH.Text.Trim(); //开票单位 string giv_kpdw = txtKPDW.Value.Trim(); //开票日期 string giv_kprq = txtKPRQ.Text.Trim(); //发票单号 string giv_fpdh = txtFPDH.Text.Trim(); //开票金额 double giv_kpje = (txtKPJE.Text.Trim() == ""?0:Convert.ToDouble(txtKPJE.Text.Trim())); //加税合计 //double giv_jshj =(txtJSHJ.Text.Trim()==""?0:Convert.ToDouble(txtJSHJ.Text.Trim())); //数量 int giv_sl = (txtSL.Text.Trim() == ""?1:Convert.ToInt16(txtSL.Text.Trim())); //收票日期 string giv_sprq = txtSPRQ.Text.Trim() != ""?txtSPRQ.Text.Trim():""; //有无凭证 int giv_pz = Convert.ToInt16(rblPZ.SelectedValue.ToString()); //凭证号 string giv_pzh = txtPZH.Text.Trim(); //经办人 string giv_jbr = txtJBR.Text.Trim(); //备注 string giv_bz = txtBZ.Text.Trim(); string sqlstr = ""; if (action == "Add") { sqlstr = "insert into TBPM_GATHINVDOC(GIV_HTBH,GIV_SCZH,GIV_KPDW,GIV_FPDH,GIV_KPJE,GIV_SL,GIV_SPRQ,GIV_PZ,GIV_PZH,GIV_JBR,GIV_BZ,GIV_KPRQ)" + "values('" + giv_htbh + "','" + giv_sczh + "','" + giv_kpdw + "','" + giv_fpdh + "'," + giv_kpje + "," + giv_sl + ",'" + giv_sprq + "'," + giv_pz + ",'" + giv_pzh + "','" + giv_jbr + "','" + giv_bz + "','" + giv_kprq + "')"; } else if (action == "Edit") { sqlstr = "update TBPM_GATHINVDOC set GIV_KPDW='" + giv_kpdw + "',GIV_KPRQ='" + giv_kprq + "',GIV_FPDH='" + giv_fpdh + "',GIV_KPJE=" + giv_kpje + ",GIV_SL=" + giv_sl + ",GIV_SPRQ='" + giv_sprq + "',GIV_PZ=" + giv_pz + ",GIV_PZH='" + giv_pzh + "',GIV_JBR='" + giv_jbr + "',GIV_BZ='" + giv_bz + "'" + " where GIV_ID=" + billID + ""; } DBCallCommon.ExeSqlText(sqlstr); btnConfirm.Visible = false; lblRemind.Visible = true; }
protected void initial() { string code = Request.QueryString["ID"].ToString(); string sql = "SELECT MTOCode AS Code,TargetCode AS TargetCode," + "TotalNote AS Abstract,Date AS Date," + "DepCode AS DepCode,Dep AS Dep,PlanerCode AS PlanerCode,Planer AS Planer," + "DocCode AS DocCode,Doc AS Doc," + "VerifierCode AS VerifierCode,Verifier AS Verifier,left(VerifyDate,10) AS ApprovedDate," + "TotalState AS State FROM View_SM_MTO WHERE MTOCode='" + code + "'"; SqlDataReader dr = DBCallCommon.GetDRUsingSqlText(sql); if (dr.Read()) { LabelState.Text = dr["State"].ToString(); //总的状态 LabelCode.Text = dr["Code"].ToString(); //编号 LabelDate.Text = dr["Date"].ToString(); LabelNewCode.Text = generateSubCode(); //生成新单号 LabelAbstract.Text = dr["Abstract"].ToString(); LabelDep.Text = dr["Dep"].ToString(); LabelDepCode.Text = dr["DepCode"].ToString(); LabelPlaner.Text = dr["Planer"].ToString(); LabelPlanerCode.Text = dr["PlanerCode"].ToString(); LabelDoc.Text = dr["Doc"].ToString(); LabelDocCode.Text = dr["DocCode"].ToString(); LabelVerifier.Text = dr["Verifier"].ToString(); LabelVerifierCode.Text = dr["VerifierCode"].ToString(); LabelApproveDate.Text = dr["ApprovedDate"].ToString(); LabelTargetCode.Text = dr["TargetCode"].ToString(); } dr.Close(); sql = "SELECT UniqueCode AS UniqueID,MaterialCode AS MaterialCode,MaterialName AS MaterialName," + "Attribute AS Attribute,GB AS GB,Standard AS MaterialStandard,Fixed AS Fixed,Length AS Length,Width AS Width," + "LotNumber AS LotNumber,Unit AS Unit,cast(TZNUM as float) AS TZN,cast(TZNUM as float) AS SN,cast(TZFZNUM as float) AS TZQuantity,cast(TZFZNUM as float) AS SQN," + "WarehouseCode AS WarehouseCode,Warehouse AS Warehouse,KTNUM AS KTNum,KTFZNUM AS KTQuantity," + "LocationCode AS PositionCode,Location AS Position,OrderCode AS OrderCode,SQCODE AS SQCODE," + "PlanMode AS PlanMode,PTCTo AS PTCTo,DetailNote AS Comment,DetailState AS DetailState,PTCFrom as FromPTC FROM View_SM_MTO WHERE MTOCode='" + code + "' AND DetailState='SPLIT" + Session["UserID"].ToString() + "'"; DataTable tb = DBCallCommon.GetDTUsingSqlText(sql); GridView1.DataSource = tb; GridView1.DataBind(); sql = "UPDATE TBWS_MTODETAIL SET MTO_STATE='' WHERE MTO_STATE='SPLIT" + Session["UserID"].ToString() + "' AND MTO_CODE='" + code + "'"; DBCallCommon.ExeSqlText(sql); LabelMessage.Text = "数据加载成功"; }