using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using GThinking.N_MISPRO; using GThinking.N_MISPRO.Data; using GThinking.N_MODEL.Page; using GThinking.N_MISPRO.Utility; using GThinking.N_CONTROL; namespace GThinking.N_XLXSBJ { public partial class CXBJD_BJFKInfo : SingleCardBase { CXBJD_BJFK entity = new CXBJD_BJFK(); protected void Page_Load(object sender, EventArgs e) { this.UMID = 100860046; this.UMName = "线缆销售报价反馈"; this.CurMaster = Master; this.CurEntity = entity; this.PageHeight = 180; this.PageWidth = 420; Master.EnableAttachBtn = false; Master.EnableCancelBtn = false; Master.EnableCopyBtn = false; Master.EnableDeleteBtn = false; Master.EnableEditBtn = false; Master.EnableInsertBtn = false; Master.EnablePrintBtn = false; Master.EnableRefreshBtn = false; Master.EnableSaveBtn = false; base.InitPage(); if (!IsPostBack) { InitControl(); } } protected override void SetControlState() { base.SetControlState(); txtZBJE.Enabled = false; } #region 自定义事件 private void InitControl() { txtBJDID.Value = PageParam.GetRTrimString("BJDID"); txtBJDXH.Value = CMISproConvert.StrToFloat(PageParam.GetRTrimString("BJDXH"), 0).ToString(); txtCFXH.Value = CMISproConvert.StrToFloat(PageParam.GetRTrimString("CFXH"), 0).ToString(); string sBJU002 = GetOption(100860000, "BJU002"); int iXSWS = string.IsNullOrEmpty(sBJU002) ? 5 : CMISproConvert.StrToInt(sBJU002); if (iXSWS < 0) iXSWS = 0; else if (iXSWS > 8) iXSWS = 8; txtCPBJ.DecimalPlaces = iXSWS; cbxZB.ClearItems(); cbxZB.Items.Add(new ListItem("全部中标", "Y")); cbxZB.Items.Add(new ListItem("部分中标", "P")); cbxZB.Items.Add(new ListItem("未中标", "N")); cbxZB.Items.Add(new ListItem("废标", "F")); cbxZB.Items.Add(new ListItem("弃标", "Q")); bool bCF = false; if (XLBJDUtils.GetXLXSBJPZXX(100860046).XLXSBJPZ_ZCCF.Trim().Equals("Y") && !txtCFXH.Value.Equals("0")) { bCF = true; } TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL sql = new TSQL(dberp); sql.Clear(); sql.Add("select XLXSBJDMX_CPBJ,XLXSBJDMX_BJSL,XLXSBJDMX_JLDW,XLXSBJDMX_ZB,XLXSBJDMX_ZBSL,XLXSBJDMX_ZBJE"); if (bCF) { sql.Add(" ,XLXSBJFKCFMX_CFSL"); } else { sql.Add(" ,0 AS XLXSBJFKCFMX_CFSL"); } sql.Add(" from XLXSBJDMX"); if (bCF) { sql.Add(" LEFT JOIN XLXSBJFKCFMX ON XLXSBJFKCFMX_BJDID=XLXSBJDMX_BJDID AND XLXSBJFKCFMX_BJDXH=XLXSBJDMX_XH AND XLXSBJFKCFMX_CFXH=:pCFXH "); sql.ParamByName("pCFXH").Value = txtCFXH.Value; } sql.Add(" where XLXSBJDMX_BJDID=:pBJDID"); sql.Add(" and XLXSBJDMX_XH=:pXH"); sql.ParamByName("pBJDID").Value = txtBJDID.Value; sql.ParamByName("pXH").Value = txtBJDXH.Value; DataSet ds = dberp.OpenDataSet(sql); if (ds.Tables[0].Rows.Count > 0) { txtCPBJ.Value = CMISproConvert.StrToFloat(ds.Tables[0].Rows[0]["XLXSBJDMX_CPBJ"].ToString()); cbxZB.SelectedValue = ds.Tables[0].Rows[0]["XLXSBJDMX_ZB"].ToString().Trim(); txtZBSL.Value = CMISproConvert.StrToFloat(ds.Tables[0].Rows[0]["XLXSBJDMX_ZBSL"].ToString()); lblJLDW.Text = ds.Tables[0].Rows[0]["XLXSBJDMX_JLDW"].ToString().Trim(); txtZBJE.Value = CMISproConvert.StrToFloat(ds.Tables[0].Rows[0]["XLXSBJDMX_ZBJE"].ToString()); txtBJSL.Value = ds.Tables[0].Rows[0]["XLXSBJDMX_BJSL"].ToString().Trim(); txtCFSL.Value = ds.Tables[0].Rows[0]["XLXSBJFKCFMX_CFSL"].ToString().Trim(); if (cbxZB.SelectedValue.Trim().Equals("")) { cbxZB.SelectedValue = "Y"; cbxZB_SelectedIndexChanged(null, null); } else { if (cbxZB.SelectedValue.Equals("Y") || cbxZB.SelectedValue.Equals("P"))//Y|全部中标、P|部分中标 { txtZBSL.Enabled = true; } else//N|未中标、F|废标、Q|弃标 { txtZBSL.Enabled = false; } } } } #endregion protected void cbxZB_SelectedIndexChanged(object sender, EventArgs e) { if (cbxZB.SelectedValue.Equals("Y") || cbxZB.SelectedValue.Equals("P"))//Y|全部中标、P|部分中标 { txtZBSL.Enabled = true; if (cbxZB.SelectedValue.Equals("Y")) { if (XLBJDUtils.GetXLXSBJPZXX(100860046).XLXSBJPZ_ZCCF.Trim().Equals("Y") && !txtCFXH.Value.Equals("0")) { txtZBSL.Value = CMISproConvert.StrToFloat(txtCFSL.Value); } else { txtZBSL.Value = CMISproConvert.StrToFloat(txtBJSL.Value); } txtZBSL_TextChanged(null, null); } } else//N|未中标、F|废标、Q|弃标 { txtZBSL.Value = 0; txtZBJE.Value = 0; txtZBSL.Enabled = false; } } protected void txtZBSL_TextChanged(object sender, EventArgs e) { txtZBJE.Value = NumberUtils.RoundX(txtZBSL.Value * txtCPBJ.Value, 2); } protected void btnQR_Click(object sender, EventArgs e) { if (cbxZB.SelectedValue.Trim().Equals("")) { ShowMessage("中标--不允许为空!"); return; } if (cbxZB.SelectedValue.Equals("Y") || cbxZB.SelectedValue.Equals("P"))//Y|全部中标、P|部分中标 { if (txtZBSL.Value == 0) { ShowMessage("中标数量--不允许为0!"); return; } else if (txtZBSL.Value < 0) { ShowMessage("中标数量--不允许为负数!"); return; } if (txtZBJE.Value == 0) { ShowMessage("中标金额--不允许为0!"); return; } else if (txtZBJE.Value < 0) { ShowMessage("中标金额--不允许为负数!"); return; } } TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL SQL = new TSQL(dberp); try { dberp.BeginTrans(); if (XLBJDUtils.GetXLXSBJPZXX(100860046).XLXSBJPZ_ZCCF.Trim().Equals("Y") && !txtCFXH.Value.Equals("0")) { SQL.Clear(); SQL.Add(" update XLXSBJFKCFMX set "); SQL.Add(" XLXSBJFKCFMX_ZBZT=:XLXSBJFKCFMX_ZB, "); SQL.Add(" XLXSBJFKCFMX_WHR=:XLXSBJFKCFMX_WHR, "); SQL.Add(" XLXSBJFKCFMX_WHRID=:XLXSBJFKCFMX_WHRID, "); SQL.Add(" XLXSBJFKCFMX_WHSJ=:XLXSBJFKCFMX_WHSJ "); SQL.Add(" where XLXSBJFKCFMX_BJDID=:pBJDID "); SQL.Add(" and XLXSBJFKCFMX_BJDXH=:pXH "); SQL.ParamByName("XLXSBJFKCFMX_ZB").Value = cbxZB.SelectedValue.Trim(); SQL.ParamByName("XLXSBJFKCFMX_WHR").Value = tSession.UserName; SQL.ParamByName("XLXSBJFKCFMX_WHRID").Value = tSession.UserId; SQL.ParamByName("XLXSBJFKCFMX_WHSJ").Value = DateTime.Now; SQL.ParamByName("pBJDID").Value = txtBJDID.Value; SQL.ParamByName("pXH").Value = txtBJDXH.Value; dberp.ExecSQL(SQL); SQL.Clear(); SQL.Add(" update XLXSBJFKCFMX set "); SQL.Add(" XLXSBJFKCFMX_ZBSL=:XLXSBJFKCFMX_ZBSL, "); SQL.Add(" XLXSBJFKCFMX_ZBJE=:XLXSBJFKCFMX_ZBJE "); SQL.Add(" where XLXSBJFKCFMX_BJDID=:pBJDID "); SQL.Add(" and XLXSBJFKCFMX_BJDXH=:pXH and XLXSBJFKCFMX_CFXH=:pCFXH "); SQL.ParamByName("XLXSBJFKCFMX_ZBSL").Value = txtZBSL.Value; SQL.ParamByName("XLXSBJFKCFMX_ZBJE").Value = txtZBJE.Value; SQL.ParamByName("XLXSBJFKCFMX_WHR").Value = tSession.UserName; SQL.ParamByName("XLXSBJFKCFMX_WHRID").Value = tSession.UserId; SQL.ParamByName("XLXSBJFKCFMX_WHSJ").Value = DateTime.Now; SQL.ParamByName("pBJDID").Value = txtBJDID.Value; SQL.ParamByName("pXH").Value = txtBJDXH.Value; SQL.ParamByName("pCFXH").Value = txtCFXH.Value; dberp.ExecSQL(SQL); SQL.Clear(); SQL.Add(" SELECT SUM(XLXSBJFKCFMX_ZBSL) AS ZBSL,SUM(XLXSBJFKCFMX_ZBJE) AS ZBJE "); SQL.Add(" FROM XLXSBJFKCFMX "); SQL.Add(" where XLXSBJFKCFMX_BJDID=:pBJDID "); SQL.Add(" and XLXSBJFKCFMX_BJDXH=:pXH "); SQL.Add(" GROUP BY XLXSBJFKCFMX_BJDID,XLXSBJFKCFMX_BJDXH "); SQL.ParamByName("pBJDID").Value = txtBJDID.Value; SQL.ParamByName("pXH").Value = txtBJDXH.Value; DataSet ds = dberp.OpenDataSet(SQL); if (ds.Tables[0].Rows.Count > 0) { SQL.Clear(); SQL.Add(" update XLXSBJDMX set "); SQL.Add(" XLXSBJDMX_ZB=:XLXSBJDMX_ZB, "); SQL.Add(" XLXSBJDMX_ZBSL=:XLXSBJDMX_ZBSL, "); SQL.Add(" XLXSBJDMX_ZBJE=:XLXSBJDMX_ZBJE, "); SQL.Add(" XLXSBJDMX_WHR=:XLXSBJDMX_WHR, "); SQL.Add(" XLXSBJDMX_WHRID=:XLXSBJDMX_WHRID, "); SQL.Add(" XLXSBJDMX_WHSJ=:XLXSBJDMX_WHSJ "); SQL.Add(" where XLXSBJDMX_BJDID=:pBJDID "); SQL.Add(" and XLXSBJDMX_XH=:pXH "); SQL.ParamByName("XLXSBJDMX_ZB").Value = cbxZB.SelectedValue.Trim(); SQL.ParamByName("XLXSBJDMX_ZBSL").Value = ds.Tables[0].Rows[0]["ZBSL"].ToString().Trim(); SQL.ParamByName("XLXSBJDMX_ZBJE").Value = ds.Tables[0].Rows[0]["ZBJE"].ToString().Trim(); SQL.ParamByName("XLXSBJDMX_WHR").Value = tSession.UserName; SQL.ParamByName("XLXSBJDMX_WHRID").Value = tSession.UserId; SQL.ParamByName("XLXSBJDMX_WHSJ").Value = DateTime.Now; SQL.ParamByName("pBJDID").Value = txtBJDID.Value; SQL.ParamByName("pXH").Value = txtBJDXH.Value; dberp.ExecSQL(SQL); } } else { SQL.Clear(); SQL.Add(" update XLXSBJDMX set "); SQL.Add(" XLXSBJDMX_ZB=:XLXSBJDMX_ZB, "); SQL.Add(" XLXSBJDMX_ZBSL=:XLXSBJDMX_ZBSL, "); SQL.Add(" XLXSBJDMX_ZBJE=:XLXSBJDMX_ZBJE, "); SQL.Add(" XLXSBJDMX_WHR=:XLXSBJDMX_WHR, "); SQL.Add(" XLXSBJDMX_WHRID=:XLXSBJDMX_WHRID, "); SQL.Add(" XLXSBJDMX_WHSJ=:XLXSBJDMX_WHSJ "); SQL.Add(" where XLXSBJDMX_BJDID=:pBJDID "); SQL.Add(" and XLXSBJDMX_XH=:pXH "); SQL.ParamByName("XLXSBJDMX_ZB").Value = cbxZB.SelectedValue.Trim(); SQL.ParamByName("XLXSBJDMX_ZBSL").Value = txtZBSL.Value; SQL.ParamByName("XLXSBJDMX_ZBJE").Value = txtZBJE.Value; SQL.ParamByName("XLXSBJDMX_WHR").Value = tSession.UserName; SQL.ParamByName("XLXSBJDMX_WHRID").Value = tSession.UserId; SQL.ParamByName("XLXSBJDMX_WHSJ").Value = DateTime.Now; SQL.ParamByName("pBJDID").Value = txtBJDID.Value; SQL.ParamByName("pXH").Value = txtBJDXH.Value; dberp.ExecSQL(SQL); } //更新报价单主表中标状态和中标金额 XLBJDUtils.UpdateBJDZBZT(dberp, txtBJDID.Value); dberp.CommitTrans(); } catch (Exception ex) { ShowMessage(ex.Message); dberp.RollbackTrans(); return; } DialogOperationScript dos = new DialogOperationScript(this); dos.ClickOwnerButton(PageParam.GetRTrimString("RefreshCtrlID")); dos.CloseSelf(); dos.Execute(); } protected void btnQX_Click(object sender, EventArgs e) { CloseWindow(); } } }