323 lines
17 KiB
C#
323 lines
17 KiB
C#
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_MODEL.Page;
|
||
using GThinking.N_MISPRO.Data;
|
||
using GThinking.N_MISPRO.Utility;
|
||
using GThinking.N_CONTROL;
|
||
|
||
namespace GThinking.N_XLXSBJ
|
||
{
|
||
public partial class TZYZBJC_YZZTZInfo : SingleCardBase
|
||
{
|
||
TZYZBJC_YZZTZ entity = new TZYZBJC_YZZTZ();
|
||
|
||
private string sBJDID = "";
|
||
private string sJGBID = "";
|
||
private string sCPMLID = "";
|
||
private string sZXJMSX = "";
|
||
private string sZXJMXX = "";
|
||
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
this.UMID = 100860072;
|
||
this.UMName = "按产品目录主芯截面范围产品特性调报价";
|
||
this.CurMaster = Master;
|
||
this.CurEntity = entity;
|
||
this.PageHeight = 450;
|
||
this.PageWidth = 500;
|
||
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;
|
||
|
||
sBJDID = PageParam.GetRTrimString("BJDID");
|
||
sJGBID = PageParam.GetRTrimString("JGBID");
|
||
sCPMLID = PageParam.GetRTrimString("CPMLID");
|
||
sZXJMSX = PageParam.GetRTrimString("ZXJMSX");
|
||
sZXJMXX = PageParam.GetRTrimString("ZXJMXX");
|
||
|
||
base.InitPage();
|
||
|
||
SetTJYZLable();
|
||
if (!IsPostBack)
|
||
{
|
||
InitControl();
|
||
}
|
||
}
|
||
|
||
#region 自定义事件
|
||
|
||
private void InitControl()
|
||
{
|
||
TComboBox.SetComboBox("DBERP", cbxCPML, "select XLXSCPML_CPMLID,XLXSCPML_CPMLMC from XLXSCPML where isnull(XLXSCPML_TYBZ,'N')<>'Y' order by XLXSCPML_CPMLID ", false);
|
||
|
||
cbxCPML.SelectedValue = sCPMLID;
|
||
txtZXJMSX.Value = CMISproConvert.StrToFloat(sZXJMSX);
|
||
txtZXJMXX.Value = CMISproConvert.StrToFloat(sZXJMXX);
|
||
|
||
# region 给调价因子控件赋值
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL SQL = new TSQL(dberp);
|
||
SQL.Clear();
|
||
SQL.Add(string.Format(" select XLXSBJDYZZ{0}_YZID,XLXSBJDYZZ{0}_CPMLYZZ,XLXSBJDYZZ{0}_RDTYZZ,XLXSBJDYZZ{0}_PBYZZ, XLXSBJDYZZ{0}_NHYZZ from XLXSBJDYZZ{0} ", "C"));
|
||
SQL.Add(string.Format(" where XLXSBJDYZZ{0}_JGBID=:pJGBID and XLXSBJDYZZ{0}_BJDID=:pBJDID ", "C"));
|
||
SQL.Add(string.Format(" and XLXSBJDYZZ{0}_CPMLID=:pCPMLID ", "C"));
|
||
SQL.Add(string.Format(" and XLXSBJDYZZ{0}_ZXJMXX=:pZXJMXX and XLXSBJDYZZ{0}_ZXJMSX=:pZXJMSX ", "C"));
|
||
SQL.Add(string.Format(" order by XLXSBJDYZZ{0}_YZID", "C"));
|
||
SQL.ParamByName("pJGBID").Value = sJGBID;
|
||
SQL.ParamByName("pBJDID").Value = XLBJDUtils.FetEmptyStr(sBJDID);
|
||
SQL.ParamByName("pCPMLID").Value = sCPMLID;
|
||
SQL.ParamByName("pZXJMSX").Value = CMISproConvert.StrToFloat(sZXJMSX);
|
||
SQL.ParamByName("pZXJMXX").Value = CMISproConvert.StrToFloat(sZXJMXX);
|
||
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 dCPMLYZZ = CMISproConvert.StrToFloat(ds.Tables[0].Rows[i][1].ToString().Trim());
|
||
double dRDTYZZ = CMISproConvert.StrToFloat(ds.Tables[0].Rows[i][2].ToString().Trim());
|
||
double dPBYZZ = CMISproConvert.StrToFloat(ds.Tables[0].Rows[i][3].ToString().Trim());
|
||
double dNHYZZ = CMISproConvert.StrToFloat(ds.Tables[0].Rows[i][4].ToString().Trim());
|
||
if (PageParam.GetRTrimString("TJYZList").Contains(sYZID + "|"))
|
||
{
|
||
for (int j = 1; j <= 20; j++)
|
||
{
|
||
string sTZYZID = "BJ" + j.ToString().PadLeft(2, '0');
|
||
gtNumTextBox txtCPML = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "CPML" + j.ToString().Trim());
|
||
gtNumTextBox txtRDT = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "RDT" + j.ToString().Trim());
|
||
gtNumTextBox txtPB = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "PB" + j.ToString().Trim());
|
||
gtNumTextBox txtNH = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "NH" + j.ToString().Trim());
|
||
if (sYZID.Equals(sTZYZID))
|
||
{
|
||
txtCPML.Value = dCPMLYZZ;
|
||
txtRDT.Value = dRDTYZZ;
|
||
txtPB.Value = dPBYZZ;
|
||
txtNH.Value = dNHYZZ;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
|
||
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 txtCPML = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "CPML" + j.ToString().Trim());
|
||
gtNumTextBox txtRDT = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "RDT" + j.ToString().Trim());
|
||
gtNumTextBox txtPB = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "PB" + j.ToString().Trim());
|
||
gtNumTextBox txtNH = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "NH" + 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("(元)"))
|
||
{
|
||
txtCPML.DecimalPlaces = 2;
|
||
txtRDT.DecimalPlaces = 2;
|
||
txtPB.DecimalPlaces = 2;
|
||
txtNH.DecimalPlaces = 2;
|
||
}
|
||
else if (sTJYZList[i].EndsWith("(X)"))
|
||
{
|
||
txtCPML.DecimalPlaces = 4;
|
||
txtRDT.DecimalPlaces = 4;
|
||
txtPB.DecimalPlaces = 4;
|
||
txtNH.DecimalPlaces = 4;
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|
||
|
||
for (int i = 1; i <= 20; i++)
|
||
{
|
||
gtLabel lblTJYZ = (gtLabel)Master.ContentFormControl.FindControl("lbl" + "TJYZ" + i.ToString().Trim());
|
||
gtLabel lblCPML = (gtLabel)Master.ContentFormControl.FindControl("lbl" + "CPML" + i.ToString().Trim());
|
||
gtLabel lblRDT = (gtLabel)Master.ContentFormControl.FindControl("lbl" + "RDT" + i.ToString().Trim());
|
||
gtLabel lblPB = (gtLabel)Master.ContentFormControl.FindControl("lbl" + "PB" + i.ToString().Trim());
|
||
gtLabel lblNH = (gtLabel)Master.ContentFormControl.FindControl("lbl" + "NH" + i.ToString().Trim());
|
||
//gtLabel lblN = (gtLabel)Master.ContentFormControl.FindControl("lbl" + i.ToString().Trim());
|
||
gtNumTextBox txtCPML = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "CPML" + i.ToString().Trim());
|
||
gtNumTextBox txtRDT = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "RDT" + i.ToString().Trim());
|
||
gtNumTextBox txtPB = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "PB" + i.ToString().Trim());
|
||
gtNumTextBox txtNH = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "NH" + i.ToString().Trim());
|
||
lblTJYZ.Style["display"] = "none";
|
||
lblCPML.Style["display"] = "none";
|
||
lblRDT.Style["display"] = "none";
|
||
lblPB.Style["display"] = "none";
|
||
lblNH.Style["display"] = "none";
|
||
//lblN.Style["display"] = "none";
|
||
txtCPML.Style["display"] = "none";
|
||
txtRDT.Style["display"] = "none";
|
||
txtPB.Style["display"] = "none";
|
||
txtNH.Style["display"] = "none";
|
||
}
|
||
for (int i = 0; i < sTJYZList.Length; i++)
|
||
{
|
||
for (int j = 1; j <= 20; j++)
|
||
{
|
||
string sTZYZID = "BJ" + j.ToString().PadLeft(2, '0') + "|";
|
||
gtLabel lblTJYZ = (gtLabel)Master.ContentFormControl.FindControl("lbl" + "TJYZ" + j.ToString().Trim());
|
||
gtLabel lblCPML = (gtLabel)Master.ContentFormControl.FindControl("lbl" + "CPML" + j.ToString().Trim());
|
||
gtLabel lblRDT = (gtLabel)Master.ContentFormControl.FindControl("lbl" + "RDT" + j.ToString().Trim());
|
||
gtLabel lblPB = (gtLabel)Master.ContentFormControl.FindControl("lbl" + "PB" + j.ToString().Trim());
|
||
gtLabel lblNH = (gtLabel)Master.ContentFormControl.FindControl("lbl" + "NH" + j.ToString().Trim());
|
||
//gtLabel lblN = (gtLabel)Master.ContentFormControl.FindControl("lbl" + j.ToString().Trim());
|
||
gtNumTextBox txtCPML = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "CPML" + j.ToString().Trim());
|
||
gtNumTextBox txtRDT = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "RDT" + j.ToString().Trim());
|
||
gtNumTextBox txtPB = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "PB" + j.ToString().Trim());
|
||
gtNumTextBox txtNH = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "NH" + j.ToString().Trim());
|
||
|
||
if (sTJYZList[i].StartsWith(sTZYZID))
|
||
{
|
||
lblTJYZ.Style["display"] = "block";
|
||
lblCPML.Style["display"] = "block";
|
||
lblRDT.Style["display"] = "block";
|
||
lblPB.Style["display"] = "block";
|
||
lblNH.Style["display"] = "block";
|
||
//lblN.Style["display"] = "block";
|
||
txtCPML.Style["display"] = "block";
|
||
txtRDT.Style["display"] = "block";
|
||
txtPB.Style["display"] = "block";
|
||
txtNH.Style["display"] = "block";
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
protected void btnQR_Click(object sender, EventArgs e)
|
||
{
|
||
string sUpdateAll = "";
|
||
Confirm.Register("IsQD", "是否要按当前记录的特性加点更新报价单下其他产品目录的记录?");
|
||
Confirm.ShowBtnText = TConfirm.cBtnText.Yes_No;
|
||
if (Confirm.GetValue("IsQD").Trim().Equals(""))
|
||
{
|
||
Confirm.Ask("IsQD");
|
||
return;
|
||
}
|
||
else if (Confirm.GetValue("IsQD").Trim().Equals("N"))
|
||
{
|
||
//表示进行了提示并选择了取消,直接返回或其他处理
|
||
Confirm.Clear();
|
||
sUpdateAll = "N";
|
||
}
|
||
else if (Confirm.GetValue("IsQD").Trim().Equals("Y"))
|
||
{
|
||
//表示进行了提示并选择了确认
|
||
Confirm.Clear();
|
||
sUpdateAll = "Y";
|
||
}
|
||
|
||
|
||
|
||
|
||
# region 将调价因子控件值更新至数据库中
|
||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||
TSQL SQL = new TSQL(dberp);
|
||
SQL.Clear();
|
||
dberp.ExecSQL(string.Format("delete from XLXSBJDYZZ{0} where XLXSBJDYZZ{0}_JGBID='{1}' and XLXSBJDYZZ{0}_BJDID='{2}' and XLXSBJDYZZ{0}_CPMLID='{3}' "
|
||
+ " and XLXSBJDYZZ{0}_ZXJMSX={4} and XLXSBJDYZZ{0}_ZXJMXX={5} ", "C", sJGBID, sBJDID, sCPMLID, CMISproConvert.StrToFloat(sZXJMSX),CMISproConvert.StrToFloat(sZXJMXX)));
|
||
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}_BJDID, XLXSBJDYZZ{0}_CPMLID,XLXSBJDYZZ{0}_ZXJMSX,XLXSBJDYZZ{0}_ZXJMXX,XLXSBJDYZZ{0}_YZID, ", "C"));
|
||
SQL.Add(string.Format(" XLXSBJDYZZ{0}_CPMLYZZ, XLXSBJDYZZ{0}_RDTYZZ,XLXSBJDYZZ{0}_PBYZZ,XLXSBJDYZZ{0}_NHYZZ,XLXSBJDYZZ{0}_WHR, XLXSBJDYZZ{0}_WHRID, XLXSBJDYZZ{0}_WHSJ)", "C"));
|
||
SQL.Add(string.Format(" values(:pJGBID,:pBJDID, :pCPMLID,:pZXJMSX,:pZXJMXX,:pYZID,:pCPMLYZZ,:pRDTYZZ,:pPBYZZ,:pNHYZZ,:pWHR,:pWHRID,:pWHSJ)"));
|
||
SQL.ParamByName("pJGBID").Value = sJGBID;
|
||
SQL.ParamByName("pBJDID").Value = sBJDID;
|
||
SQL.ParamByName("pCPMLID").Value = sCPMLID;
|
||
SQL.ParamByName("pZXJMSX").Value = CMISproConvert.StrToFloat(sZXJMSX);
|
||
SQL.ParamByName("pZXJMXX").Value = CMISproConvert.StrToFloat(sZXJMXX);
|
||
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 txtCPML = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "CPML" + j.ToString().Trim());
|
||
gtNumTextBox txtRDT = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "RDT" + j.ToString().Trim());
|
||
gtNumTextBox txtPB = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "PB" + j.ToString().Trim());
|
||
gtNumTextBox txtNH = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "NH" + j.ToString().Trim());
|
||
if (sTJYZList[i].StartsWith(sTZYZID))
|
||
{
|
||
SQL.ParamByName("pYZID").Value = sTZYZID.TrimEnd('|');
|
||
SQL.ParamByName("pCPMLYZZ").Value = txtCPML.Value;
|
||
SQL.ParamByName("pRDTYZZ").Value = txtRDT.Value;
|
||
SQL.ParamByName("pPBYZZ").Value = txtPB.Value;
|
||
SQL.ParamByName("pNHYZZ").Value = txtNH.Value;
|
||
dberp.ExecSQL(SQL);
|
||
}
|
||
}
|
||
}
|
||
if (sUpdateAll.Equals("Y"))
|
||
{
|
||
for (int i = 0; i < sTJYZList.Length; i++)
|
||
{
|
||
SQL.Clear();
|
||
SQL.Add(string.Format(" update XLXSBJDYZZ{0} set ", "C"));
|
||
SQL.Add(string.Format(" XLXSBJDYZZ{0}_RDTYZZ =:pRDTYZZ,", "C"));
|
||
SQL.Add(string.Format(" XLXSBJDYZZ{0}_PBYZZ = :pPBYZZ ,XLXSBJDYZZ{0}_NHYZZ = :pNHYZZ,", "C"));
|
||
SQL.Add(string.Format(" XLXSBJDYZZ{0}_WHR=:pWHR, XLXSBJDYZZ{0}_WHRID=:pWHRID, XLXSBJDYZZ{0}_WHSJ =:pWHSJ ", "C"));
|
||
SQL.Add(string.Format(" where 1=1 ", "C"));
|
||
SQL.Add(string.Format(" and XLXSBJDYZZ{0}_JGBID = :pJGBID and XLXSBJDYZZ{0}_BJDID = :pBJDID and XLXSBJDYZZ{0}_YZID = :pYZID ", "C"));
|
||
SQL.ParamByName("pJGBID").Value = sJGBID;
|
||
SQL.ParamByName("pBJDID").Value = sBJDID;
|
||
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 txtRDT = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "RDT" + j.ToString().Trim());
|
||
gtNumTextBox txtPB = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "PB" + j.ToString().Trim());
|
||
gtNumTextBox txtNH = (gtNumTextBox)Master.ContentFormControl.FindControl("txt" + "NH" + j.ToString().Trim());
|
||
if (sTJYZList[i].StartsWith(sTZYZID))
|
||
{
|
||
SQL.ParamByName("pYZID").Value = sTZYZID.TrimEnd('|');
|
||
SQL.ParamByName("pRDTYZZ").Value = txtRDT.Value;
|
||
SQL.ParamByName("pPBYZZ").Value = txtPB.Value;
|
||
SQL.ParamByName("pNHYZZ").Value = txtNH.Value;
|
||
dberp.ExecSQL(SQL);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
#endregion
|
||
DialogOperationScript dos = new DialogOperationScript(this);
|
||
dos.ClickOwnerButton(PageParam.GetRTrimString("RefreshCtrlID2"));
|
||
dos.CloseSelf();
|
||
dos.Execute();
|
||
}
|
||
|
||
protected void btnQX_Click(object sender, EventArgs e)
|
||
{
|
||
CloseWindow();
|
||
}
|
||
}
|
||
}
|