2026821
This commit is contained in:
@@ -0,0 +1,241 @@
|
||||
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_CONTROL;
|
||||
using GThinking.N_PUBLIC;
|
||||
using GThinking.N_MISPRO.Caching;
|
||||
using GThinking.N_MISPRO.Utility;
|
||||
|
||||
namespace GThinking.N_XLXSBJ
|
||||
{
|
||||
public partial class XLBJD_WBBJDMX_XLXHInfo : SingleCardBase
|
||||
{
|
||||
XLBJD_WBBJDMX_XLXH entity = new XLBJD_WBBJDMX_XLXH();
|
||||
|
||||
string sWBBJDID = "";
|
||||
string sSELBJDID = "";
|
||||
string sDRHHList = "";
|
||||
|
||||
#region Page_Load
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.UMID = 100860043;
|
||||
this.UMName = "外部线缆产品导入";
|
||||
base.CurMaster = Master;
|
||||
base.CurEntity = entity;
|
||||
this.PageHeight = 400;
|
||||
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;
|
||||
|
||||
sWBBJDID = PageParam.GetRTrimString("WBBJDID");
|
||||
sSELBJDID = PageParam.GetRTrimString("SELBJDID").Equals("") ? " " : PageParam.GetRTrimString("SELBJDID");
|
||||
sDRHHList = PageParam.GetRTrimString("DRHHList");
|
||||
base.InitPage();
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
InitControl();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 自定义函数
|
||||
|
||||
private void InitControl()
|
||||
{
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sSQL = new TSQL(dberp);
|
||||
|
||||
cbxCPYT.ClearItems();
|
||||
cbxCPYT.Items.Add(new ListItem("非线缆产品", "NNNN"));
|
||||
cbxCPYT.SelectedIndex = 0;
|
||||
|
||||
cbxGGJDGZ.ClearItems();
|
||||
cbxGGJDGZ.Items.Add(new ListItem("mm2-芯数截面", "0"));
|
||||
cbxGGJDGZ.Items.Add(new ListItem("mm2-绞型线", "1"));
|
||||
cbxGGJDGZ.Items.Add(new ListItem("mm-信号线", "2"));
|
||||
cbxGGJDGZ.Items.Add(new ListItem("mm2-矿缆", "3"));
|
||||
cbxGGJDGZ.Items.Add(new ListItem("mm-矿缆", "4"));
|
||||
cbxGGJDGZ.Items.Add(new ListItem("射频电缆", "5"));
|
||||
cbxGGJDGZ.Items.Add(new ListItem("安装线", "6"));
|
||||
cbxGGJDGZ.Items.Add(new ListItem("绕粗线", "7"));
|
||||
cbxGGJDGZ.SelectedIndex = 0;
|
||||
|
||||
|
||||
|
||||
sSQL.Clear();
|
||||
sSQL.Add(" select XLWBBJDMX_XLXHID ");
|
||||
sSQL.Add(" from XLWBBJDMX ");
|
||||
sSQL.Add(" where 1 = 1 ");
|
||||
sSQL.Add(" and XLWBBJDMX_WBBJDID=:pWBBJDID and XLWBBJDMX_BJDID=:pBJDID ");
|
||||
sSQL.Add(" and XLWBBJDMX_DRHH = :pDRHH ");
|
||||
sSQL.ParamByName("pWBBJDID").Value = sWBBJDID;
|
||||
sSQL.ParamByName("pBJDID").Value = sSELBJDID;
|
||||
sSQL.ParamByName("pDRHH").Value = sDRHHList;
|
||||
DataSet dsXLXHID = dberp.OpenDataSet(sSQL);
|
||||
if (dsXLXHID.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
txtXLXHID.Text = dsXLXHID.Tables[0].Rows[0]["XLWBBJDMX_XLXHID"].ToString().Trim();
|
||||
}
|
||||
|
||||
string sXLXHID = txtXLXHID.Text.Trim();
|
||||
string sXLJBXHID = "";
|
||||
string sCPTX = "";
|
||||
if (!sXLXHID.Equals(""))
|
||||
{
|
||||
if (sXLXHID.LastIndexOf('-') > 0)
|
||||
{
|
||||
sCPTX = sXLXHID.Substring(0, sXLXHID.LastIndexOf('-'));
|
||||
sXLJBXHID = sXLXHID.Substring(sXLXHID.LastIndexOf('-') + 1, sXLXHID.Length - sXLXHID.LastIndexOf('-') - 1);
|
||||
sXLJBXHID = RemoveNumber(sXLJBXHID);
|
||||
}
|
||||
else
|
||||
{
|
||||
sXLJBXHID = RemoveNumber(sXLXHID);
|
||||
}
|
||||
}
|
||||
|
||||
txtCPTX.Text = sCPTX;
|
||||
txtXLJBXHID.Text = sXLJBXHID;
|
||||
sSQL.Clear();
|
||||
sSQL.Add(" select XLXHB_CPYT,XLXHB_XLGGJDGZ,XLXHB_RDT from XLXHB WHERE XLXHB_XLJBXHID = :pXLJBXHID ");
|
||||
sSQL.ParamByName("pXLJBXHID").Value = sXLJBXHID;
|
||||
DataSet dsXLXHB = dberp.OpenDataSet(sSQL);
|
||||
if (dsXLXHB.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
//cbxCPYT.SelectedValue = dsXLXHB.Tables[0].Rows[0]["XLXHB_CPYT"].ToString().Trim();
|
||||
chkDTLX.Checked = dsXLXHB.Tables[0].Rows[0]["XLXHB_RDT"].ToString().Trim().Equals("Y");
|
||||
//cbxGGJDGZ.SelectedValue = dsXLXHB.Tables[0].Rows[0]["XLXHB_XLGGJDGZ"].ToString().Trim();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 去掉字符串中的数字
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static string RemoveNumber(string key)
|
||||
{
|
||||
return System.Text.RegularExpressions.Regex.Replace(key, @"\d", "");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 自定义按钮
|
||||
protected void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (cbxGGJDGZ.SelectedValue.Equals(""))
|
||||
{
|
||||
ShowMessage("规格解读规则不允许为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cbxCPYT.SelectedValue.Equals(""))
|
||||
{
|
||||
ShowMessage("产品用途不允许为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (txtXLXHID.Text.Trim().Equals(""))
|
||||
{
|
||||
ShowMessage("线缆型号不允许为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sSQL = new TSQL(dberp);
|
||||
try
|
||||
{
|
||||
dberp.BeginTrans();
|
||||
|
||||
string SQL = string.Format("select top 1 XLXHB_XLXHID from XLXHB where XLXHB_XLXHID = '{0}' ", txtXLXHID.Text.Trim());
|
||||
if (!CMISproDataBase.ExistsRecord("DBERP", SQL))
|
||||
{
|
||||
sSQL.Clear();
|
||||
sSQL.Add("insert into XLXHB(XLXHB_XLXHID,XLXHB_XLXHMC,XLXHB_XLTXID,XLXHB_CPYT,XLXHB_XLJBXHID,XLXHB_RDT,");
|
||||
sSQL.Add(" XLXHB_WHR,XLXHB_WHRID,XLXHB_WHSJ,XLXHB_XLGGJDGZ,XLXHB_QYRQ,XLXHB_XLXHBH,XLXHB_TYBZ)");
|
||||
sSQL.Add(" values(:XLXHB_XLXHID,:XLXHB_XLXHMC,:XLXHB_XLTXID,:XLXHB_CPYT,:XLXHB_XLJBXHID,:XLXHB_RDT,");
|
||||
sSQL.Add(" :XLXHB_WHR,:XLXHB_WHRID,:XLXHB_WHSJ,:XLXHB_XLGGJDGZ,:XLXHB_QYRQ,:XLXHB_XLXHBH,'N')");
|
||||
sSQL.ParamByName("XLXHB_XLXHID").Value = txtXLXHID.Text.Trim();
|
||||
sSQL.ParamByName("XLXHB_XLXHMC").Value = txtXLXHID.Text.Trim();
|
||||
sSQL.ParamByName("XLXHB_XLTXID").Value = txtCPTX.Text.Trim();
|
||||
sSQL.ParamByName("XLXHB_CPYT").Value = cbxCPYT.SelectedValue.Trim();
|
||||
sSQL.ParamByName("XLXHB_XLJBXHID").Value = txtXLJBXHID.Text.Trim();
|
||||
sSQL.ParamByName("XLXHB_XLGGJDGZ").Value = cbxGGJDGZ.SelectedValue.Trim();
|
||||
sSQL.ParamByName("XLXHB_XLXHBH").Value = "";
|
||||
if (chkDTLX.Checked)
|
||||
{
|
||||
sSQL.ParamByName("XLXHB_RDT").Value = "Y";
|
||||
}
|
||||
else
|
||||
{
|
||||
sSQL.ParamByName("XLXHB_RDT").Value = "N";
|
||||
}
|
||||
sSQL.ParamByName("XLXHB_QYRQ").Value = CMISproConvert.ConvertDate(DateTime.Now);
|
||||
sSQL.ParamByName("XLXHB_WHR").Value = tSession.UserName;
|
||||
sSQL.ParamByName("XLXHB_WHRID").Value = tSession.UserId;
|
||||
sSQL.ParamByName("XLXHB_WHSJ").Value = DateTime.Now.ToString();
|
||||
dberp.ExecSQL(sSQL);
|
||||
|
||||
}
|
||||
|
||||
sSQL.Clear();
|
||||
sSQL.Add("select XLCPYT_CPYT,XLCPYT_CPYTMC from XLCPYT where XLCPYT_CPYT = 'NNNN' ");
|
||||
DataSet ds = dberp.OpenDataSet(sSQL);
|
||||
if (ds.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
sSQL.Clear();
|
||||
sSQL.Add(" insert into XLCPYT(XLCPYT_CPYT,XLCPYT_CPYTMC,XLCPYT_WHR,XLCPYT_WHRID,XLCPYT_WHSJ,XLCPYT_XSSX)");
|
||||
sSQL.Add(" values(:XLCPYT_CPYT,:XLCPYT_CPYTMC,:XLCPYT_WHR,:XLCPYT_WHRID,:XLCPYT_WHSJ,:XLCPYT_XSSX)");
|
||||
sSQL.ParamByName("XLCPYT_CPYT").Value = "NNNN";
|
||||
sSQL.ParamByName("XLCPYT_CPYTMC").Value = "非线缆产品";
|
||||
sSQL.ParamByName("XLCPYT_WHR").Value = tSession.UserName;
|
||||
sSQL.ParamByName("XLCPYT_WHRID").Value = tSession.UserId;
|
||||
sSQL.ParamByName("XLCPYT_WHSJ").Value = DateTime.Now;
|
||||
sSQL.ParamByName("XLCPYT_XSSX").Value = 0;
|
||||
dberp.ExecSQL(sSQL);
|
||||
}
|
||||
dberp.CommitTrans();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowAboutInfo("新增失败,错误信息:" + ex);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DialogOperationScript dos = new DialogOperationScript(this);
|
||||
//直接增补进入XLXHB
|
||||
//dos.SetOwnerControlValue(PageParam.GetRTrimString("txtRetXLXHID"), cbxDefault.SelectedValue.Trim());
|
||||
dos.ClickOwnerButton(PageParam.GetRTrimString("btnRefreshXLXHIDBHFCX"));
|
||||
dos.CloseSelf();
|
||||
dos.Execute();
|
||||
}
|
||||
|
||||
protected void btnQX_Click(object sender, EventArgs e)
|
||||
{
|
||||
CloseWindow();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user