2026821
This commit is contained in:
@@ -0,0 +1,347 @@
|
||||
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_CONTROL;
|
||||
|
||||
namespace GThinking.N_XLXSBJ
|
||||
{
|
||||
public partial class TZYZBJ4Info : SingleCardBase
|
||||
{
|
||||
TZYZBJ_YZZ4 entity = new TZYZBJ_YZZ4();
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.UMID = 100860028;
|
||||
this.UMName = "按型号调报价";
|
||||
this.CurMaster = Master;
|
||||
this.CurEntity = entity;
|
||||
this.PageHeight = 400;
|
||||
this.PageWidth = 500;
|
||||
|
||||
SetTJYZLable();
|
||||
|
||||
if (!this.IsPostBack)
|
||||
{
|
||||
InitControls();
|
||||
}
|
||||
|
||||
base.InitPage();
|
||||
}
|
||||
|
||||
#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='BJD' and XLXSTZYZ_TJYS='4' 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("XLXSBJDYZZ4", 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 = 'BJD' and XLXSTZYZ_TJYS='4' 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(XLXSBJDYZZ4_YZID, '{0}', XLXSBJDYZZ4_YZZ, 0)) as TZYZ_{0}", ds.Tables[0].Rows[i][0].ToString().Trim()));
|
||||
}
|
||||
sSQL.Text = "select 1" + sSQL.Text + " from XLXSBJDYZZ4 where XLXSBJDYZZ4_JGBID='" + txtJGBID.Value.Trim() + "' and XLXSBJDYZZ4_XLXHID= '" + cbxXLXHID.SelectedValue.Trim() + "'";
|
||||
AddUserReportSQL("XLXSBJDYZZ4", sSQL);
|
||||
base.ReportRecordSetAdd();
|
||||
}
|
||||
|
||||
|
||||
protected override void SetControlState()
|
||||
{
|
||||
base.SetControlState();
|
||||
|
||||
txtWHR.Enabled = false;
|
||||
datWHSJ.Enabled = false;
|
||||
|
||||
# region 给调价因子控件设只读性
|
||||
if (ControlState == TControlState.ctsInsert || ControlState == TControlState.ctsCopy || ControlState == TControlState.ctsEdit)
|
||||
{
|
||||
for (int i = 1; i <= 20; 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++)
|
||||
{
|
||||
for (int j = 1; j <= 20; j++)
|
||||
{
|
||||
string sTZYZID = "BJ" + j.ToString().PadLeft(2, '0') + "|";
|
||||
gtNumTextBox txtTJYZ = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "TJYZ" + j.ToString().Trim());
|
||||
if (sTJYZList[i].StartsWith(sTZYZID))
|
||||
{
|
||||
txtTJYZ.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
protected override void LoadRecord()
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
entity.Param.Add("XLXSBJDYZZ4_JGBID", PageParam.GetRTrimString("XLXSBJDYZZ4_JGBID"));
|
||||
entity.Param.Add("XLXSBJDYZZ4_XLXHID", PageParam.GetRTrimString("XLXSBJDYZZ4_XLXHID"));
|
||||
entity.Param.Add("XLXSBJDYZZ4_YZID", PageParam.GetRTrimString("XLXSBJDYZZ4_YZID"));
|
||||
}
|
||||
else
|
||||
{
|
||||
entity.Param.Add("XLXSBJDYZZ4_JGBID", txtJGBID.Value.Trim());
|
||||
entity.Param.Add("XLXSBJDYZZ4_XLXHID", txtOLD_XLXHID.Value.Trim());
|
||||
entity.Param.Add("XLXSBJDYZZ4_YZID", txtYZID.Value.Trim());
|
||||
}
|
||||
base.LoadRecord();
|
||||
txtOLD_XLXHID.Value = cbxXLXHID.SelectedValue.Trim();
|
||||
|
||||
|
||||
# region 给调价因子控件赋值
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sql = new TSQL(dberp);
|
||||
sql.Clear();
|
||||
sql.Add(string.Format(" select XLXSBJDYZZ{0}_YZID, XLXSBJDYZZ{0}_YZZ from XLXSBJDYZZ{0} ", 4));
|
||||
sql.Add(string.Format(" where XLXSBJDYZZ{0}_JGBID=:pJGBID and XLXSBJDYZZ{0}_XLXHID=:pXLXHID order by XLXSBJDYZZ{0}_YZID", 4));
|
||||
sql.ParamByName("pJGBID").Value = txtJGBID.Value.Trim();
|
||||
sql.ParamByName("pXLXHID").Value = cbxXLXHID.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][0].ToString().Trim();
|
||||
double dYZZ = CMISproConvert.StrToFloat(ds.Tables[0].Rows[i][1].ToString().Trim());
|
||||
if (PageParam.GetRTrimString("TJYZList").Contains(sYZID + "|"))
|
||||
{
|
||||
for (int j = 1; j <= 20; j++)
|
||||
{
|
||||
string sTZYZID = "BJ" + j.ToString().PadLeft(2, '0');
|
||||
gtNumTextBox txtTJYZ = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "TJYZ" + j.ToString().Trim());
|
||||
if (sYZID.Equals(sTZYZID))
|
||||
txtTJYZ.Value = dYZZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
protected override void OnNewRecorder()
|
||||
{
|
||||
base.OnNewRecorder();
|
||||
txtJGBID.Value = PageParam.GetRTrimString("XLXSBJDYZZ4_JGBID");
|
||||
txtWHR.Text = tSession.UserName;
|
||||
txtWHRID.Value = tSession.UserId;
|
||||
datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now);
|
||||
if (PageParam.GetRTrimString("CLYLZDSQ") == "Y")
|
||||
{
|
||||
cbxXLXHID.SelectedValue = PageParam.GetRTrimString("XLXSBJDYZZ4_XLXHID");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(PageParam.GetRTrimString("XLXHID")))
|
||||
{
|
||||
cbxXLXHID.SelectedValue = PageParam.GetRTrimString("XLXHID");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnCopyRecorder()
|
||||
{
|
||||
base.OnCopyRecorder();
|
||||
txtJGBID.Value = PageParam.GetRTrimString("XLXSBJDYZZ4_JGBID");
|
||||
txtWHR.Text = tSession.UserName;
|
||||
txtWHRID.Value = tSession.UserId;
|
||||
datWHSJ.Text = CMISproConvert.ConvertTime(System.DateTime.Now);
|
||||
}
|
||||
|
||||
protected override bool DataLogicValid()
|
||||
{
|
||||
if (!base.DataLogicValid()) 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)
|
||||
{
|
||||
sql.Clear();
|
||||
sql.Add("select XLXSBJDYZZ4_XLXHID ");
|
||||
sql.Add("from XLXSBJDYZZ4 ");
|
||||
sql.Add("where XLXSBJDYZZ4_JGBID=:pJGBID and XLXSBJDYZZ4_YZID=:pYZID and XLXSBJDYZZ4_XLXHID =:pXLXHID ");
|
||||
sql.ParamByName("pJGBID").Value = txtJGBID.Value.Trim();
|
||||
sql.ParamByName("pYZID").Value = sTJYZList[i].Split('|')[0];
|
||||
sql.ParamByName("pXLXHID").Value = cbxXLXHID.SelectedValue.Trim();
|
||||
DataSet ds = dberp.OpenDataSet(sql);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
string sResult = ds.Tables[0].Rows[0]["XLXSBJDYZZ4_XLXHID"].ToString().Trim();
|
||||
ShowMessage(string.Format("因子{0}已经维护了{1}线缆型号,不允许保存!", sTJYZList[i].Replace("(X)", ""), sResult));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!txtOLD_XLXHID.Value.Trim().Equals(cbxXLXHID.SelectedValue.Trim()))
|
||||
{
|
||||
sql.Clear();
|
||||
sql.Add("select XLXSBJDYZZ4_XLXHID ");
|
||||
sql.Add("from XLXSBJDYZZ4 ");
|
||||
sql.Add("where XLXSBJDYZZ4_JGBID=:pJGBID and XLXSBJDYZZ4_YZID=:pYZID and XLXSBJDYZZ4_XLXHID =:pXLXHID ");
|
||||
sql.ParamByName("pJGBID").Value = txtJGBID.Value.Trim();
|
||||
sql.ParamByName("pYZID").Value = sTJYZList[i].Split('|')[0];
|
||||
sql.ParamByName("pXLXHID").Value = cbxXLXHID.SelectedValue.Trim();
|
||||
DataSet ds = dberp.OpenDataSet(sql);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
string sResult = ds.Tables[0].Rows[0]["XLXSBJDYZZ4_XLXHID"].ToString().Trim();
|
||||
ShowMessage(string.Format("因子{0}已经维护了{1}线缆型号,不允许保存!", sTJYZList[i].Replace("(X)", ""), sResult));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool Master_BeforeDeleteAction(object sender, EventArgs e)
|
||||
{
|
||||
string sYZIDlist = TZYZBJAInfo.GetYZIDList(PageParam.GetRTrimString("TJYZList"));
|
||||
entity.EntityTable.DeleteSql = " delete from XLXSBJDYZZ4 where XLXSBJDYZZ4_JGBID =:XLXSBJDYZZ4_JGBID and XLXSBJDYZZ4_XLXHID=:XLXSBJDYZZ4_XLXHID and "
|
||||
+ CMISproDataBase.GetWhereEqual("XLXSBJDYZZ4_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 XLXSBJDYZZ4 " + "\r\n"
|
||||
+ " set XLXSBJDYZZ4_JGBID = :XLXSBJDYZZ4_JGBID, XLXSBJDYZZ4_XLXHID=:XLXSBJDYZZ4_XLXHID, XLXSBJDYZZ4_WHR= :XLXSBJDYZZ4_WHR, XLXSBJDYZZ4_WHRID = :XLXSBJDYZZ4_WHRID, XLXSBJDYZZ4_WHSJ=:XLXSBJDYZZ4_WHSJ " + "\r\n"
|
||||
+ " where XLXSBJDYZZ4_JGBID =:XLXSBJDYZZ4_JGBID and XLXSBJDYZZ4_XLXHID=:OLD_XLXSBJDYZZ4_XLXHID and " + CMISproDataBase.GetWhereEqual("XLXSBJDYZZ4_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();
|
||||
txtYZID.Value = PageParam.GetRTrimString("FirstYZID");
|
||||
|
||||
string sJGBID = txtJGBID.Value.Trim();
|
||||
string sXLXHID = cbxXLXHID.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 XLXSBJDYZZ{0} where XLXSBJDYZZ{0}_JGBID='{1}' and XLXSBJDYZZ{0}_XLXHID='{2}' and " + CMISproDataBase.GetWhereEqual("XLXSBJDYZZ{0}_YZID", sYZIDlist), 4, sJGBID, sXLXHID));
|
||||
|
||||
string[] sTJYZList = PageParam.GetRTrimString("TJYZList").Split(',');
|
||||
DateTime tNow = DateTime.Now;
|
||||
for (int i = 0; i < sTJYZList.Length; i++)
|
||||
{
|
||||
sql.Clear();
|
||||
sql.Add(string.Format("insert into XLXSBJDYZZ{0}(XLXSBJDYZZ{0}_JGBID, XLXSBJDYZZ{0}_XLXHID, XLXSBJDYZZ{0}_YZID, XLXSBJDYZZ{0}_YZZ, XLXSBJDYZZ{0}_WHR, XLXSBJDYZZ{0}_WHRID, XLXSBJDYZZ{0}_WHSJ)", 4));
|
||||
sql.Add(string.Format(" values(:pJGBID,:XLXHID,:pYZID,:pYZZ,:pWHR,:pWHRID,:pWHSJ)"));
|
||||
sql.ParamByName("pJGBID").Value = sJGBID;
|
||||
sql.ParamByName("XLXHID").Value = sXLXHID;
|
||||
sql.ParamByName("pWHR").Value = tSession.UserName;
|
||||
sql.ParamByName("pWHRID").Value = tSession.UserId;
|
||||
sql.ParamByName("pWHSJ").Value = tNow;
|
||||
|
||||
for (int j = 1; j <= 20; j++)
|
||||
{
|
||||
string sTZYZID = "BJ" + j.ToString().PadLeft(2, '0') + "|";
|
||||
gtNumTextBox txtTJYZ = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "TJYZ" + j.ToString().Trim());
|
||||
if (sTJYZList[i].StartsWith(sTZYZID))
|
||||
{
|
||||
sql.ParamByName("pYZID").Value = sTZYZID.TrimEnd('|');
|
||||
sql.ParamByName("pYZZ").Value = txtTJYZ.Value;
|
||||
dberp.ExecSQL(sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
return base.Master_AfterSaveAction(sender, e);
|
||||
}
|
||||
|
||||
protected override void SetComboxItems()
|
||||
{
|
||||
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);
|
||||
base.SetComboxItems();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 自定义函数
|
||||
|
||||
private void InitControls()
|
||||
{
|
||||
txtYZID.Value = PageParam.GetRTrimString("FirstYZID");
|
||||
}
|
||||
|
||||
private void SetTJYZLable()
|
||||
{
|
||||
string[] sTJYZList = PageParam.GetRTrimString("TJYZList").Split(',');
|
||||
for (int i = 0; i < sTJYZList.Length; i++)
|
||||
{
|
||||
|
||||
for (int j = 1; j <= 20; j++)
|
||||
{
|
||||
string sTZYZID = "BJ" + j.ToString().PadLeft(2, '0') + "|";
|
||||
gtNumTextBox txtTJYZ = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "TJYZ" + j.ToString().Trim());
|
||||
gtLabel lblTJYZ = (gtLabel)Master.ContentFormControl.FindControl("lbl" + "TJYZ" + j.ToString().Trim());
|
||||
if (sTJYZList[i].StartsWith(sTZYZID))
|
||||
{
|
||||
string s = sTJYZList[i].Replace(sTZYZID, "").Replace("(X)", "") + ":";
|
||||
lblTJYZ.Text = s;
|
||||
if (sTJYZList[i].EndsWith("(%)") || sTJYZList[i].EndsWith("(元)"))
|
||||
{
|
||||
txtTJYZ.DecimalPlaces = 2;
|
||||
}
|
||||
else if (sTJYZList[i].EndsWith("(X)"))
|
||||
{
|
||||
txtTJYZ.DecimalPlaces = 4;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user