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_PUBLIC; using GThinking.N_MODEL.Dialog; using GThinking.N_WORKFLOW; using System.Collections.Generic; using GThinking.N_CONTROL; using System.Text; namespace GThinking.N_XLXSBJ { public partial class CLQDYZInfo : SingleCardBase { CLQDYZ entity = new CLQDYZ(); protected void Page_Load(object sender, EventArgs e) { this.UMID = 100860017; this.UMName = "按型号规格电压等级标准调表价"; this.CurMaster = Master; this.CurEntity = entity; this.PageHeight = 400; this.PageWidth = 500; //CreateTZYZMaster(tSession, divTZYZ); SetTJYZLable(); base.InitPage(); if (!this.IsPostBack) { InitControls(); } } #region 模板事件继承 protected override void ReportDataSetAdd() { TDatabase db = TContextDatabases.GetDatabase("DBERP"); TSQL sql = new TSQL(db); sql.Add("select XLXSTZYZ_YZID, XLXSTZYZ_YZMC from XLXSTZYZ where XLXSTZYZ_MXBH='JZJ' and XLXSTZYZ_TJYS='1' order by XLXSTZYZ_XSXH,XLXSTZYZ_YZID "); DataSet ds = db.OpenDataSet(sql); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string sYZID = "TZYZ_" + ds.Tables[0].Rows[i]["XLXSTZYZ_YZID"].ToString().Trim(); string sYZMC = ds.Tables[0].Rows[i]["XLXSTZYZ_YZMC"].ToString().Trim(); AddUserReportField("XLXSCLQD", sYZID, sYZMC, "N"); } base.ReportDataSetAdd(); } protected override void ReportRecordSetAdd() { TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL sSQL = new TSQL(dberp); TSQL SQL = new TSQL(dberp); SQL.Clear(); SQL.Add("select XLXSTZYZ_YZID, XLXSTZYZ_YZMC "); SQL.Add(" from XLXSTZYZ"); SQL.Add(" where XLXSTZYZ_MXBH = 'JZJ' and XLXSTZYZ_TJYS='1' order by XLXSTZYZ_XSXH,XLXSTZYZ_YZID "); DataSet ds = dberp.OpenDataSet(SQL); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { sSQL.Add(string.Format(",sum(decode(XLXSJGBYZZ1_YZID, '{0}', XLXSJGBYZZ1_YZZ, 0)) as TZYZ_{0}", ds.Tables[0].Rows[i][0].ToString().Trim())); } sSQL.Text = "select 1" + sSQL.Text + " from XLXSJGBYZZ1 where XLXSJGBYZZ1_JGBID='" + txtJGBID.Value.Trim() + "' and XLXSJGBYZZ1_XLXHID='" + cbxXLXHID.SelectedValue.Trim() + "' and XLXSJGBYZZ1_XLGGID='" + txtXLGGID.Text.Trim() + "' and XLXSJGBYZZ1_XLBZID='" + cbxST.SelectedValue.Trim() + "' and XLXSJGBYZZ1_DYDJID='" + cbxDYDJID.SelectedValue + "' "; AddUserReportSQL("XLXSCLQD", sSQL); base.ReportRecordSetAdd(); } protected override void SetControlState() { base.SetControlState(); txtWHR.Enabled = false; datWHSJ.Enabled = false; //CLQDYZ.SetControlStateBySt(ControlState, divTZYZ.Controls); # region 给调价因子控件设只读性 if (ControlState == TControlState.ctsInsert || ControlState == TControlState.ctsCopy || ControlState == TControlState.ctsEdit) { for (int i = 1; i <= 10; i++) { gtNumTextBox txtTJYZ = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "TJYZ" + i); txtTJYZ.Enabled = false; } string[] sTJYZList = PageParam.GetRTrimString("TJYZList").Split(','); for (int i = 0; i < sTJYZList.Length; i++) { if (sTJYZList[i].StartsWith("JZ01|")) { txtTJYZ1.DecimalPlaces = GetXSWS("JZ01"); txtTJYZ1.Enabled = true; } else if (sTJYZList[i].StartsWith("JZ02|")) { txtTJYZ2.DecimalPlaces = GetXSWS("JZ02"); txtTJYZ2.Enabled = true; } else if (sTJYZList[i].StartsWith("JZ03|")) { txtTJYZ3.DecimalPlaces = GetXSWS("JZ03"); txtTJYZ3.Enabled = true; } else if (sTJYZList[i].StartsWith("JZ04|")) { txtTJYZ4.DecimalPlaces = GetXSWS("JZ04"); txtTJYZ4.Enabled = true; } else if (sTJYZList[i].StartsWith("JZ05|")) { txtTJYZ5.DecimalPlaces = GetXSWS("JZ05"); txtTJYZ5.Enabled = true; } else if (sTJYZList[i].StartsWith("JZ06|")) { txtTJYZ6.DecimalPlaces = GetXSWS("JZ06"); txtTJYZ6.Enabled = true; } else if (sTJYZList[i].StartsWith("JZ07|")) { txtTJYZ7.DecimalPlaces = GetXSWS("JZ07"); txtTJYZ7.Enabled = true; } else if (sTJYZList[i].StartsWith("JZ08|")) { txtTJYZ8.DecimalPlaces = GetXSWS("JZ08"); txtTJYZ8.Enabled = true; } else if (sTJYZList[i].StartsWith("JZ09|")) { txtTJYZ9.DecimalPlaces = GetXSWS("JZ09"); txtTJYZ9.Enabled = true; } else if (sTJYZList[i].StartsWith("JZ10|")) { txtTJYZ10.DecimalPlaces = GetXSWS("JZ10"); txtTJYZ10.Enabled = true; } } } #endregion } protected override void LoadRecord() { if (!IsPostBack) { entity.Param.Add("XLXSJGBYZZ1_JGBID", PageParam.GetRTrimString("XLXSJGBYZZ1_JGBID")); entity.Param.Add("XLXSJGBYZZ1_XLXHID", PageParam.GetRTrimString("XLXSJGBYZZ1_XLXHID")); entity.Param.Add("XLXSJGBYZZ1_XLGGID", PageParam.GetRTrimString("XLXSJGBYZZ1_XLGGID")); entity.Param.Add("XLXSJGBYZZ1_XLBZID", PageParam.GetRTrimString("XLXSJGBYZZ1_XLBZID").Equals("") ? " " : PageParam.GetRTrimString("XLXSJGBYZZ1_XLBZID")); entity.Param.Add("XLXSJGBYZZ1_DYDJID", PageParam.GetRTrimString("XLXSJGBYZZ1_DYDJID").Equals("") ? " " : PageParam.GetRTrimString("XLXSJGBYZZ1_DYDJID")); entity.Param.Add("XLXSJGBYZZ1_YZID", PageParam.GetRTrimString("XLXSJGBYZZ1_YZID")); } else { entity.Param.Add("XLXSJGBYZZ1_JGBID", txtJGBID.Value.Trim()); entity.Param.Add("XLXSJGBYZZ1_XLXHID", txtOLD_XLXHID.Value.Trim()); entity.Param.Add("XLXSJGBYZZ1_XLGGID", txtOLD_XLGGID.Value.Trim()); entity.Param.Add("XLXSJGBYZZ1_XLBZID", txtOLD_XLBZID.Value.Trim().Equals("") ? " " : txtOLD_XLBZID.Value.Trim()); entity.Param.Add("XLXSJGBYZZ1_DYDJID", txtOLD_DYDJID.Value.Trim().Equals("") ? " " : txtOLD_DYDJID.Value.Trim()); entity.Param.Add("XLXSJGBYZZ1_YZID", txtYZID.Value.Trim()); } base.LoadRecord(); //if (ControlState == TControlState.ctsEdit)//从列表页直接点编辑 //{ // if (!CMISproDataBase.ExistsRecord("DBERP", string.Format("select 1 from XLXSJGBYZZ1 where XLXSJGBYZZ1_JGBID='{0}' and XLXSJGBYZZ1_XLXHID='{1}' and XLXSJGBYZZ1_XLGGID='{2}' and XLXSJGBYZZ1_XLBZID='{3}' and XLXSJGBYZZ1_DYDJID='{4}'", // txtJGBID.Value.Trim(), cbxXLXHID.SelectedValue.Trim(), txtXLGGID.Text.Trim(), cbxST.SelectedValue.Trim(), cbxDYDJID.SelectedValue.Trim()))) // { // divTZYZ.Controls.Clear(); // CreateTZYZMaster(tSession, divTZYZ); // } //} txtOLD_XLXHID.Value = cbxXLXHID.SelectedValue.Trim(); txtOLD_XLGGID.Value = txtXLGGID.Text.Trim(); txtOLD_XLBZID.Value = cbxST.SelectedValue.Trim().Equals("") ? " " : cbxST.SelectedValue.Trim(); txtOLD_DYDJID.Value = cbxDYDJID.SelectedValue.Trim().Equals("") ? " " : cbxDYDJID.SelectedValue.Trim(); //CLQDYZ.FillDataToCtls(txtJGBID.Value.Trim(), cbxXLXHID.SelectedValue.Trim(), txtXLGGID.Text.Trim(), cbxST.SelectedValue.Trim(), cbxDYDJID.SelectedValue.Trim(), divTZYZ.Controls, txtWHR, txtWHRID, datWHSJ); # region 给调价因子控件赋值 TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL sql = new TSQL(dberp); sql.Add("select XLXSJGBYZZ1_YZID, XLXSJGBYZZ1_YZZ, XLXSJGBYZZ1_WHR, XLXSJGBYZZ1_WHRID, XLXSJGBYZZ1_WHSJ from XLXSJGBYZZ1 "); sql.Add("where XLXSJGBYZZ1_JGBID=:pJGBID and XLXSJGBYZZ1_XLXHID=:pXLXHID and XLXSJGBYZZ1_XLGGID=:pXLGGID and XLXSJGBYZZ1_XLBZID=:pXLBZID and XLXSJGBYZZ1_DYDJID=:pDYDJID order by XLXSJGBYZZ1_YZID"); sql.ParamByName("pJGBID").Value = txtJGBID.Value.Trim(); sql.ParamByName("pXLXHID").Value = cbxXLXHID.SelectedValue.Trim(); sql.ParamByName("pXLGGID").Value = txtXLGGID.Text.Trim(); sql.ParamByName("pXLBZID").Value = cbxST.SelectedValue.Trim().Equals("") ? " " : cbxST.SelectedValue.Trim(); sql.ParamByName("pDYDJID").Value = cbxDYDJID.SelectedValue.Trim().Equals("") ? " " : cbxDYDJID.SelectedValue.Trim(); DataSet ds = dberp.OpenDataSet(sql); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string sYZID = ds.Tables[0].Rows[i]["XLXSJGBYZZ1_YZID"].ToString().Trim(); double dYZZ = CMISproConvert.StrToFloat(ds.Tables[0].Rows[i]["XLXSJGBYZZ1_YZZ"].ToString().Trim()); if (PageParam.GetRTrimString("TJYZList").Contains(sYZID + "|")) { if (sYZID.Equals("JZ01")) { txtTJYZ1.DecimalPlaces = GetXSWS(sYZID); txtTJYZ1.Value = dYZZ; } else if (sYZID.Equals("JZ02")) { txtTJYZ2.DecimalPlaces = GetXSWS(sYZID); txtTJYZ2.Value = dYZZ; } else if (sYZID.Equals("JZ03")) { txtTJYZ3.DecimalPlaces = GetXSWS(sYZID); txtTJYZ3.Value = dYZZ; } else if (sYZID.Equals("JZ04")) { txtTJYZ4.DecimalPlaces = GetXSWS(sYZID); txtTJYZ4.Value = dYZZ; } else if (sYZID.Equals("JZ05")) { txtTJYZ5.DecimalPlaces = GetXSWS(sYZID); txtTJYZ5.Value = dYZZ; } else if (sYZID.Equals("JZ06")) { txtTJYZ6.DecimalPlaces = GetXSWS(sYZID); txtTJYZ6.Value = dYZZ; } else if (sYZID.Equals("JZ07")) { txtTJYZ7.DecimalPlaces = GetXSWS(sYZID); txtTJYZ7.Value = dYZZ; } else if (sYZID.Equals("JZ08")) { txtTJYZ8.DecimalPlaces = GetXSWS(sYZID); txtTJYZ8.Value = dYZZ; } else if (sYZID.Equals("JZ09")) { txtTJYZ9.DecimalPlaces = GetXSWS(sYZID); txtTJYZ9.Value = dYZZ; } else if (sYZID.Equals("JZ10")) { txtTJYZ10.DecimalPlaces = GetXSWS(sYZID); txtTJYZ10.Value = dYZZ; } } } #endregion } protected override void OnNewRecorder() { base.OnNewRecorder(); txtJGBID.Value = PageParam.GetRTrimString("XLXSJGBYZZ1_JGBID"); txtWHR.Text = tSession.UserName; txtWHRID.Value = tSession.UserId; datWHSJ.Text = CMISproConvert.ConvertTime(DateTime.Now); if (PageParam.GetRTrimString("YCLQDCXWSZ")=="Y") { cbxXLXHID.SelectedValue = PageParam.GetRTrimString("XLXSJGBYZZ1_XLXHID"); txtXLGGID.Text = PageParam.GetRTrimString("XLXSJGBYZZ1_XLGGID"); cbxST.SelectedValue = PageParam.GetRTrimString("XLXSJGBYZZ1_XLBZID"); cbxDYDJID.SelectedValue = PageParam.GetRTrimString("XLXSJGBYZZ1_DYDJID"); } if (!string.IsNullOrEmpty(PageParam.GetRTrimString("XLXHID"))) { cbxXLXHID.SelectedValue = PageParam.GetRTrimString("XLXHID"); } } protected override void OnCopyRecorder() { base.OnCopyRecorder(); txtJGBID.Value = PageParam.GetRTrimString("XLXSJGBYZZ1_JGBID"); txtWHR.Text = tSession.UserName; txtWHRID.Value = tSession.UserId; datWHSJ.Text = CMISproConvert.ConvertTime(DateTime.Now); //divTZYZ.Controls.Clear(); //CreateTZYZMaster(tSession, divTZYZ); } protected override bool DataLogicValid() { //A|× B|* string sXLJGU007 = GetOption(102579000, "XLJGU007"); if (sXLJGU007.Equals("A")) { if (txtXLGGID.Text.Contains("*") || txtXLGGID.Text.Contains("x") || txtXLGGID.Text.Contains("X")) { ShowMessage("规格中出现*、x、X,不允许保存!"); return false; } } else if (sXLJGU007.Equals("B")) { if (txtXLGGID.Text.Contains("×") || txtXLGGID.Text.Contains("x") || txtXLGGID.Text.Contains("X")) { ShowMessage("规格中出现×、x、X,不允许保存!"); return false; } } TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL sql = new TSQL(dberp); string[] sTJYZList = PageParam.GetRTrimString("TJYZList").Split(','); for (int i = 0; i < sTJYZList.Length; i++) { if (ControlState == TControlState.ctsInsert || ControlState == TControlState.ctsCopy) { if (CMISproDataBase.ExistsRecord("DBERP", string.Format("select 1 from XLXSJGBYZZ1 where XLXSJGBYZZ1_JGBID='{0}' and XLXSJGBYZZ1_XLXHID='{1}' and XLXSJGBYZZ1_XLGGID='{2}' and XLXSJGBYZZ1_XLBZID='{3}' and XLXSJGBYZZ1_DYDJID='{4}' and XLXSJGBYZZ1_YZID='{5}'", txtJGBID.Value.Trim(), cbxXLXHID.SelectedValue.Trim(), txtXLGGID.Text.Trim(), cbxST.SelectedValue.Trim().Equals("") ? " " : cbxST.SelectedValue.Trim(), cbxDYDJID.SelectedValue.Trim().Equals("") ? " " : cbxDYDJID.SelectedValue.Trim(), sTJYZList[i].Split('|')[0]))) { ShowMessage("已存在编号相同的记录,不允许保存!"); return false; } } else { if (CMISproDataBase.ExistsRecord("DBERP", string.Format(@"select 1 from XLXSJGBYZZ1 where XLXSJGBYZZ1_JGBID='{0}' and XLXSJGBYZZ1_XLXHID='{1}' and XLXSJGBYZZ1_XLGGID='{2}' and XLXSJGBYZZ1_XLBZID='{3}' and XLXSJGBYZZ1_DYDJID='{4}' and XLXSJGBYZZ1_YZID='{9}' and (XLXSJGBYZZ1_XLXHID<>'{5}' or XLXSJGBYZZ1_XLGGID<>'{6}' or XLXSJGBYZZ1_XLBZID<>'{7}' or XLXSJGBYZZ1_DYDJID<>'{8}') ", txtJGBID.Value.Trim(), cbxXLXHID.SelectedValue.Trim(), txtXLGGID.Text.Trim(), cbxST.SelectedValue.Trim().Equals("") ? " " : cbxST.SelectedValue.Trim(), cbxDYDJID.SelectedValue.Trim().Equals("") ? " " : cbxDYDJID.SelectedValue.Trim(), txtOLD_XLXHID.Value.Trim(), txtOLD_XLGGID.Value.Trim(), txtOLD_XLBZID.Value.Trim().Equals("") ? " " : txtOLD_XLBZID.Value.Trim(), txtOLD_DYDJID.Value.Trim().Equals("") ? " " : txtOLD_DYDJID.Value.Trim(), sTJYZList[i].Split('|')[0]))) { ShowMessage("已存在编号相同的记录,不允许保存!"); return false; } } } return base.DataLogicValid(); } protected override bool Master_BeforeEditAction(object sender, EventArgs e) { //if (!CMISproDataBase.ExistsRecord("DBERP", string.Format("select 1 from XLXSJGBYZZ1 where XLXSJGBYZZ1_JGBID='{0}' and XLXSJGBYZZ1_XLXHID='{1}' and XLXSJGBYZZ1_XLGGID='{2}' and XLXSJGBYZZ1_XLBZID='{3}' and XLXSJGBYZZ1_DYDJID='{4}'", // txtJGBID.Value.Trim(), cbxXLXHID.SelectedValue.Trim(), txtXLGGID.Text.Trim(), cbxST.SelectedValue.Trim(), cbxDYDJID.SelectedValue.Trim()))) //{ // divTZYZ.Controls.Clear(); // CreateTZYZMaster(tSession, divTZYZ); //} return base.Master_BeforeEditAction(sender, e); } protected override bool Master_BeforeDeleteAction(object sender, EventArgs e) { string sYZIDlist = TZYZBJAInfo.GetYZIDList(PageParam.GetRTrimString("TJYZList")); entity.EntityTable.DeleteSql = " delete from XLXSJGBYZZ1 where XLXSJGBYZZ1_JGBID=:XLXSJGBYZZ1_JGBID and XLXSJGBYZZ1_XLXHID =:XLXSJGBYZZ1_XLXHID and XLXSJGBYZZ1_XLGGID =:XLXSJGBYZZ1_XLGGID and XLXSJGBYZZ1_XLBZID=:XLXSJGBYZZ1_XLBZID and XLXSJGBYZZ1_DYDJID=:XLXSJGBYZZ1_DYDJID and " + CMISproDataBase.GetWhereEqual("XLXSJGBYZZ1_YZID", sYZIDlist); return base.Master_BeforeDeleteAction(sender, e); } protected override bool Master_BeforeSaveAction(object sender, EventArgs e) { if (!base.Master_BeforeSaveAction(sender, e)) return false; string sYZIDlist = TZYZBJAInfo.GetYZIDList(PageParam.GetRTrimString("TJYZList")); entity.EntityTable.UpdateSql = " update XLXSJGBYZZ1 " + " set XLXSJGBYZZ1_XLXHID= :XLXSJGBYZZ1_XLXHID, XLXSJGBYZZ1_XLGGID = :XLXSJGBYZZ1_XLGGID, " + " XLXSJGBYZZ1_XLBZID = :XLXSJGBYZZ1_XLBZID, XLXSJGBYZZ1_DYDJID = isnull(:XLXSJGBYZZ1_DYDJID,' '),XLXSJGBYZZ1_TJDH = :XLXSJGBYZZ1_TJDH " + " where XLXSJGBYZZ1_JGBID=:XLXSJGBYZZ1_JGBID and XLXSJGBYZZ1_XLXHID =:OLD_XLXSJGBYZZ1_XLXHID and XLXSJGBYZZ1_XLGGID =:OLD_XLXSJGBYZZ1_XLGGID and XLXSJGBYZZ1_XLBZID=:OLD_XLXSJGBYZZ1_XLBZID " + " and XLXSJGBYZZ1_DYDJID=:OLD_XLXSJGBYZZ1_DYDJID and " + CMISproDataBase.GetWhereEqual("XLXSJGBYZZ1_YZID", sYZIDlist); txtWHR.Text = tSession.UserName; txtWHRID.Value = tSession.UserId; datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now); return true; } protected override bool Master_AfterSaveAction(object sender, EventArgs e) { txtOLD_XLXHID.Value = cbxXLXHID.SelectedValue.Trim(); txtOLD_XLGGID.Value = txtXLGGID.Text.Trim(); txtOLD_XLBZID.Value = cbxST.SelectedValue.Trim().Equals("") ? " " : cbxST.SelectedValue.Trim(); txtOLD_DYDJID.Value = cbxDYDJID.SelectedValue.Trim().Equals("") ? " " : cbxDYDJID.SelectedValue.Trim(); txtYZID.Value = PageParam.GetRTrimString("FirstYZID"); //TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); //CLQDYZ.SaveTZYZ(dberp, txtJGBID.Value.Trim(), cbxXLXHID.SelectedValue.Trim(), txtXLGGID.Text.Trim(), cbxST.SelectedValue.Trim(), cbxDYDJID.SelectedValue.Trim(), divTZYZ.Controls, tSession); string sJGBID = txtJGBID.Value.Trim(); string sXLXHID =cbxXLXHID.SelectedValue.Trim(); string sXLGGID = txtXLGGID.Text.Trim(); string sXLBZID = cbxST.SelectedValue.Trim().Equals("") ? " " : cbxST.SelectedValue.Trim(); string sDYDJID = cbxDYDJID.SelectedValue.Trim().Equals("") ? " " : cbxDYDJID.SelectedValue.Trim(); # region 将调价因子控件值更新至数据库中 TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL sql = new TSQL(dberp); sql.Clear(); string sYZIDlist = TZYZBJAInfo.GetYZIDList(PageParam.GetRTrimString("TJYZList")); dberp.ExecSQL(string.Format("delete from XLXSJGBYZZ1 where XLXSJGBYZZ1_JGBID='{0}' and XLXSJGBYZZ1_XLXHID='{1}' and XLXSJGBYZZ1_XLGGID='{2}' and XLXSJGBYZZ1_XLBZID='{3}' and XLXSJGBYZZ1_DYDJID='{4}' and " + CMISproDataBase.GetWhereEqual("XLXSJGBYZZ1_YZID", sYZIDlist) , sJGBID, sXLXHID, sXLGGID, sXLBZID.Equals("") ? " " : sXLBZID, sDYDJID.Equals("") ? " " : sDYDJID)); string[] sTJYZList = PageParam.GetRTrimString("TJYZList").Split(','); DateTime tNow = DateTime.Now; for (int i = 0; i < sTJYZList.Length; i++) { sql.Clear(); sql.Add("insert into XLXSJGBYZZ1(XLXSJGBYZZ1_JGBID,XLXSJGBYZZ1_XLXHID,XLXSJGBYZZ1_XLGGID,XLXSJGBYZZ1_XLBZID,XLXSJGBYZZ1_DYDJID,XLXSJGBYZZ1_TJDH,XLXSJGBYZZ1_YZID,XLXSJGBYZZ1_YZZ,XLXSJGBYZZ1_WHR,XLXSJGBYZZ1_WHRID,XLXSJGBYZZ1_WHSJ)"); sql.Add(" values(:pJGBID,:pXLXHID,:pXLGGID,:pXLBZID,:pDYDJID,:pTJDH,:pYZID,:pYZZ,:pWHR,:pWHRID,:pWHSJ)"); sql.ParamByName("pJGBID").Value = sJGBID; sql.ParamByName("pXLXHID").Value = sXLXHID; sql.ParamByName("pXLGGID").Value = sXLGGID; sql.ParamByName("pXLBZID").Value = sXLBZID.Equals("") ? " " : sXLBZID; sql.ParamByName("pDYDJID").Value = sDYDJID.Equals("") ? " " : sDYDJID; sql.ParamByName("pTJDH").Value = txtTJDH.Text.Trim(); sql.ParamByName("pWHR").Value = tSession.UserName; sql.ParamByName("pWHRID").Value = tSession.UserId; sql.ParamByName("pWHSJ").Value = tNow; if (sTJYZList[i].StartsWith("JZ01|")) { sql.ParamByName("pYZID").Value = "JZ01"; sql.ParamByName("pYZZ").Value = txtTJYZ1.Value; dberp.ExecSQL(sql); } else if (sTJYZList[i].StartsWith("JZ02|")) { sql.ParamByName("pYZID").Value = "JZ02"; sql.ParamByName("pYZZ").Value = txtTJYZ2.Value; dberp.ExecSQL(sql); } else if (sTJYZList[i].StartsWith("JZ03|")) { sql.ParamByName("pYZID").Value = "JZ03"; sql.ParamByName("pYZZ").Value = txtTJYZ3.Value; dberp.ExecSQL(sql); } else if (sTJYZList[i].StartsWith("JZ04|")) { sql.ParamByName("pYZID").Value = "JZ04"; sql.ParamByName("pYZZ").Value = txtTJYZ4.Value; dberp.ExecSQL(sql); } else if (sTJYZList[i].StartsWith("JZ05|")) { sql.ParamByName("pYZID").Value = "JZ05"; sql.ParamByName("pYZZ").Value = txtTJYZ5.Value; dberp.ExecSQL(sql); } else if (sTJYZList[i].StartsWith("JZ06|")) { sql.ParamByName("pYZID").Value = "JZ06"; sql.ParamByName("pYZZ").Value = txtTJYZ6.Value; dberp.ExecSQL(sql); } else if (sTJYZList[i].StartsWith("JZ07|")) { sql.ParamByName("pYZID").Value = "JZ07"; sql.ParamByName("pYZZ").Value = txtTJYZ7.Value; dberp.ExecSQL(sql); } else if (sTJYZList[i].StartsWith("JZ08|")) { sql.ParamByName("pYZID").Value = "JZ08"; sql.ParamByName("pYZZ").Value = txtTJYZ8.Value; dberp.ExecSQL(sql); } else if (sTJYZList[i].StartsWith("JZ09|")) { sql.ParamByName("pYZID").Value = "JZ09"; sql.ParamByName("pYZZ").Value = txtTJYZ9.Value; dberp.ExecSQL(sql); } else if (sTJYZList[i].StartsWith("JZ10|")) { sql.ParamByName("pYZID").Value = "JZ10"; sql.ParamByName("pYZZ").Value = txtTJYZ10.Value; dberp.ExecSQL(sql); } } #endregion return base.Master_AfterSaveAction(sender, e); } protected override void SetComboxItems() { if (ControlState == TControlState.ctsBrowse) { cbxXLXHID.ClearItems(); cbxXLXHID.Items.Add(new ListItem(cbxXLXHID.SelectedValue.Trim(), cbxXLXHID.SelectedValue.Trim())); cbxDYDJID.ClearItems(); cbxDYDJID.Items.Add(new ListItem(cbxDYDJID.SelectedValue.Trim(), cbxDYDJID.SelectedValue.Trim())); } else if (ControlState == TControlState.ctsCopy || ControlState == TControlState.ctsInsert || ControlState == TControlState.ctsEdit) { TComboBox.SetComboBox("DBERP", cbxXLXHID, "select XLXHB_XLXHID as ID,XLXHB_XLXHID as Name from XLXHB where isnull(XLXHB_TYBZ,'N')<>'Y' order by ID ", false); TComboBox.SetComboBox("DBERP", cbxDYDJID, "select distinct XLDYDJB_DYDJID as ID,XLDYDJB_DYDJID as Name from XLDYDJB where isnull(XLDYDJB_TYBZ,'N')<>'Y' order by ID ", true); } base.SetComboxItems(); } #endregion #region 自定义函数 private void InitControls() { string sBJDID = ""; sBJDID = PageParam.GetRTrimString("BJDID"); if (!sBJDID.Equals("")) { string sSQL = " SELECT DISTINCT XLBZ_XLBZID, XLBZ_XLBZLXMC FROM ( SELECT XLBZ_XLBZID, XLBZ_XLBZLXMC FROM XLBZ WHERE 1=1 AND LEN(XLBZ_XLBZID) < 10"; sSQL += " UNION ALL SELECT DISTINCT XLXSBJYLZDMX_XLBZID AS XLBZ_XLBZID, XLBZ_XLBZLXMC FROM XLXSBJYLZDMX left join XLXSBJYLZD on XLXSBJYLZDMX_SQDH=XLXSBJYLZD_SQDH LEFT JOIN XLBZ ON XLBZ_XLBZID = XLXSBJYLZDMX_XLBZID WHERE XLXSBJYLZD_BJDID ='" + sBJDID + "') T ORDER BY XLBZ_XLBZID"; TComboBox.SetComboBox("DBERP", cbxST, sSQL, true); } else { TComboBox.SetComboBox("DBERP", cbxST, "select XLBZ_XLBZID,XLBZ_XLBZLXMC from XLBZ where 1=1 and len(XLBZ_XLBZID)<10 order by XLBZ_PX,XLBZ_XLBZID", true); } } private void SetTJYZLable() { string[] sTJYZList = PageParam.GetRTrimString("TJYZList").Split(','); for (int i = 0; i < sTJYZList.Length; i++) { if (sTJYZList[i].StartsWith("JZ01|")) { lblTJYZ1.Text = sTJYZList[i].Replace("JZ01|", "") + ":"; } else if (sTJYZList[i].StartsWith("JZ02|")) { lblTJYZ2.Text = sTJYZList[i].Replace("JZ02|", "") + ":"; } else if (sTJYZList[i].StartsWith("JZ03|")) { lblTJYZ3.Text = sTJYZList[i].Replace("JZ03|", "") + ":"; } else if (sTJYZList[i].StartsWith("JZ04|")) { lblTJYZ4.Text = sTJYZList[i].Replace("JZ04|", "") + ":"; } else if (sTJYZList[i].StartsWith("JZ05|")) { lblTJYZ5.Text = sTJYZList[i].Replace("JZ05|", "") + ":"; } else if (sTJYZList[i].StartsWith("JZ06|")) { lblTJYZ6.Text = sTJYZList[i].Replace("JZ06|", "") + ":"; } else if (sTJYZList[i].StartsWith("JZ07|")) { lblTJYZ7.Text = sTJYZList[i].Replace("JZ07|", "") + ":"; } else if (sTJYZList[i].StartsWith("JZ08|")) { lblTJYZ8.Text = sTJYZList[i].Replace("JZ08|", "") + ":"; } else if (sTJYZList[i].StartsWith("JZ09|")) { lblTJYZ9.Text = sTJYZList[i].Replace("JZ09|", "") + ":"; } else if (sTJYZList[i].StartsWith("JZ10|")) { lblTJYZ10.Text = sTJYZList[i].Replace("JZ10|", "") + ":"; } } } private int GetXSWS(string sYZID) { int iXSWS = 2; TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL SQL = new TSQL(dberp); SQL.Clear(); SQL.Add("select XLXSTZYZ_YZID, XLXSTZYZ_YZMC, XLXSTZYZ_JJFS "); SQL.Add(" from XLXSTZYZ"); SQL.Add(" where XLXSTZYZ_MXBH = 'JZJ' and XLXSTZYZ_TJYS='1' "); SQL.Add(" and XLXSTZYZ_YZID = :pYZID "); SQL.ParamByName("pYZID").Value = sYZID; DataSet ds = dberp.OpenDataSet(SQL); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["XLXSTZYZ_JJFS"].ToString().Trim().Equals("JJ")) iXSWS = 5; } return iXSWS; } #endregion #region 控件事件 //不做使用 public void CreateTZYZMaster(CMISproSession tSession, HtmlGenericControl divTop) { Table TabOut = new Table(); TabOut.ID = "TblJYD"; TabOut.HorizontalAlign = HorizontalAlign.Left; TabOut.CellPadding = 0; TabOut.CellSpacing = 0; TDatabase dberp = TContextDatabases.GetDatabase("DBERP"); TSQL sql = new TSQL(dberp); sql.Add("select XLXSTZYZ_YZID, XLXSTZYZ_YZMC, XLXSTZYZ_JJFS from XLXSTZYZ "); sql.Add(" where XLXSTZYZ_MXBH='JZJ' "); sql.Add(" and XLXSTZYZ_TJYS='1' "); sql.Add(" order by XLXSTZYZ_XSXH,XLXSTZYZ_YZID "); DataSet ds = dberp.OpenDataSet(sql); if (ds.Tables[0].Rows.Count <= 0) return; for (int i = 0; i < Math.Floor((double)(ds.Tables[0].Rows.Count / 2)); i++) { TableRow RowField = new TableRow(); RowField.Height = Unit.Pixel(35); //设置行高 string sYZID = ds.Tables[0].Rows[2 * i]["XLXSTZYZ_YZID"].ToString().Trim(); string sYZMC = ds.Tables[0].Rows[2 * i]["XLXSTZYZ_YZMC"].ToString().Trim(); //double dMRZ = CMISproConvert.StrToFloat(ds.Tables[0].Rows[2 * i]["XLXSJGBYZZ_YZZ"].ToString()); string sJJFS = ds.Tables[0].Rows[2 * i]["XLXSTZYZ_JJFS"].ToString().Trim(); TableCell CellField = new TableCell(); CellField.Style.Add(HtmlTextWriterStyle.Width, "90px"); CellField.HorizontalAlign = HorizontalAlign.Right; //CellField.BorderWidth = 1; //CellField.BorderColor = System.Drawing.Color.FromArgb(173, 169, 154); CellField.Text = sYZMC.Trim() + ":"; RowField.Cells.Add(CellField); TableCell CellControls = new TableCell(); CellControls.HorizontalAlign = HorizontalAlign.Center; gtNumTextBox txt = new gtNumTextBox(); txt.Width = Unit.Pixel(80); txt.ID = string.Format("txt_{0}", sYZID); //加价类型的基价因子小数位数按BJU002设置的来 if (sJJFS.Equals("JJ")) { //txt.DecimalPlaces = CMISproConvert.StrToInt(GetOption("BJU002")); txt.DecimalPlaces = 5; } else txt.DecimalPlaces = 2; //if (bNeedMRZ) // txt.Value = dMRZ; txt.Attributes.Add("NAME", sYZID); //txt.TextChanged += new EventHandler(_txt_TextChanged); //txt.AutoPostBack = true; CellControls.Controls.Add(txt); CellControls.HorizontalAlign = HorizontalAlign.Center; RowField.Controls.Add(CellControls); //------------------ TableCell CellSpace = new TableCell(); CellSpace.Style.Add(HtmlTextWriterStyle.Width, "84px"); CellSpace.HorizontalAlign = HorizontalAlign.Left; if (sJJFS.Equals("JJ")) CellSpace.Text = "(元)"; else if (sJJFS.Equals("JD") || sJJFS.Equals("KD")) CellSpace.Text = "(%)"; RowField.Cells.Add(CellSpace); //------------------ string sYZID2 = ds.Tables[0].Rows[2 * i + 1]["XLXSTZYZ_YZID"].ToString().Trim(); string sYZMC2 = ds.Tables[0].Rows[2 * i + 1]["XLXSTZYZ_YZMC"].ToString().Trim(); //double dMRZ2 = CMISproConvert.StrToFloat(ds.Tables[0].Rows[2 * i + 1]["XLXSJGBYZZ_YZZ"].ToString()); string sJJFS2 = ds.Tables[0].Rows[2 * i + 1]["XLXSTZYZ_JJFS"].ToString().Trim(); TableCell CellField2 = new TableCell(); CellField2.Style.Add(HtmlTextWriterStyle.Width, "98px"); CellField2.HorizontalAlign = HorizontalAlign.Right; CellField2.Text = sYZMC2.Trim() + ":"; RowField.Cells.Add(CellField2); TableCell CellControls2 = new TableCell(); CellControls2.HorizontalAlign = HorizontalAlign.Center; gtNumTextBox txt2 = new gtNumTextBox(); txt2.Width = Unit.Pixel(80); txt2.ID = string.Format("txt_{0}", sYZID2); //加价类型的基价因子小数位数按BJU002设置的来 if (sJJFS2.Equals("JJ")) { //txt2.DecimalPlaces = CMISproConvert.StrToInt(GetOption("BJU002")); txt2.DecimalPlaces = 5; } else txt2.DecimalPlaces = 2; //if (bNeedMRZ) // txt2.Value = dMRZ2; txt2.Attributes.Add("NAME", sYZID2); //txt2.TextChanged += new EventHandler(_txt_TextChanged); //txt2.AutoPostBack = true; CellControls2.Controls.Add(txt2); CellControls2.HorizontalAlign = HorizontalAlign.Center; RowField.Controls.Add(CellControls2); TableCell CellSpace2 = new TableCell(); CellSpace2.Style.Add(HtmlTextWriterStyle.Width, "20px"); CellSpace2.HorizontalAlign = HorizontalAlign.Left; if (sJJFS2.Equals("JJ")) CellSpace2.Text = "(元)"; else if (sJJFS2.Equals("JD") || sJJFS2.Equals("KD")) CellSpace2.Text = "(%)"; RowField.Cells.Add(CellSpace2); TabOut.Rows.Add(RowField); } if (ds.Tables[0].Rows.Count % 2 != 0) { string sYZID = ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["XLXSTZYZ_YZID"].ToString().Trim(); string sYZMC = ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["XLXSTZYZ_YZMC"].ToString().Trim(); //double dMRZ = CMISproConvert.StrToFloat(ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["XLXSJGBYZZ_YZZ"].ToString()); string sJJFS = ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]["XLXSTZYZ_JJFS"].ToString().Trim(); TableRow RowField = new TableRow(); RowField.Height = Unit.Pixel(35); //设置行高 TableCell CellField = new TableCell(); CellField.Style.Add(HtmlTextWriterStyle.Width, "90px"); CellField.HorizontalAlign = HorizontalAlign.Right; CellField.Text = sYZMC.Trim() + ":"; RowField.Cells.Add(CellField); TableCell CellControls = new TableCell(); CellControls.HorizontalAlign = HorizontalAlign.Center; gtNumTextBox txt = new gtNumTextBox(); txt.Width = Unit.Pixel(80); txt.ID = string.Format("txt_{0}", sYZID); //加价类型的基价因子小数位数按BJU002设置的来 if (sJJFS.Equals("JJ")) { //txt.DecimalPlaces = CMISproConvert.StrToInt(GetOption("BJU002")); txt.DecimalPlaces = 5; } else txt.DecimalPlaces = 2; //if (bNeedMRZ) // txt.Value = dMRZ; txt.Attributes.Add("NAME", sYZID); //txt.TextChanged += new EventHandler(_txt_TextChanged); //txt.AutoPostBack = true; CellControls.Controls.Add(txt); CellControls.HorizontalAlign = HorizontalAlign.Center; RowField.Controls.Add(CellControls); TableCell CellSpace = new TableCell(); CellSpace.Style.Add(HtmlTextWriterStyle.Width, "84px"); CellSpace.HorizontalAlign = HorizontalAlign.Left; if (sJJFS.Equals("JJ")) CellSpace.Text = "(元)"; else if (sJJFS.Equals("JD") || sJJFS.Equals("KD")) CellSpace.Text = "(%)"; RowField.Cells.Add(CellSpace); TabOut.Rows.Add(RowField); } divTop.Controls.Add(TabOut); } #endregion } }