2026821
This commit is contained in:
@@ -0,0 +1,489 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
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_WORKFLOW;
|
||||
using GThinking.N_MODEL.Dialog;
|
||||
using GThinking.N_PUBLIC;
|
||||
using GThinking.N_MISPRO.Utility;
|
||||
using GThinking.N_CONTROL;
|
||||
using System.IO;
|
||||
using System.Data.OleDb;
|
||||
using System.Data.Common;
|
||||
using GThinking.N_MISPROAS;
|
||||
using System.Data.SqlClient;
|
||||
using System.Text;
|
||||
|
||||
namespace GThinking.N_XLXSBJ
|
||||
{
|
||||
public partial class XLJGB_SYSDRInfo : SingleCardBase
|
||||
{
|
||||
XLJGB_SYSDREntity entity = new XLJGB_SYSDREntity();
|
||||
int sSucessDr = 0;
|
||||
string sErrorMessage ="";
|
||||
|
||||
#region page类事件
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.UMID = 100860001;
|
||||
this.UMName = "线缆销售报价价格表";
|
||||
base.CurMaster = Master;
|
||||
base.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;
|
||||
fupdPost.FileSaveType = gtAsyncFileUpload.DFileSaveType.SaveToPath;
|
||||
if (AppRuntime.BitType == AppBitType.Bit32)
|
||||
{
|
||||
fupdPost.Filter = "XLS";
|
||||
}
|
||||
else // AppBitType.Bit64
|
||||
{
|
||||
fupdPost.Filter = "XLS,XLSX";
|
||||
}
|
||||
base.InitPage();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 控件事件
|
||||
|
||||
protected void btnQD_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (fupdPost.FilePath.Equals(""))
|
||||
{
|
||||
ShowMessage("请选择需要导入的文件!");
|
||||
return;
|
||||
}
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sSQL = new TSQL(dberp);
|
||||
try
|
||||
{
|
||||
lblTitle.Text = "正在导入数据,请稍后...";
|
||||
dberp.BeginTrans();
|
||||
DataSet aDataExcel = new DataSet();
|
||||
if (AppRuntime.BitType == AppBitType.Bit32)
|
||||
{
|
||||
aDataExcel = XLBJDUtils.ReadFromExcelFile(fupdPost.FilePath, 0, "");
|
||||
}
|
||||
else // AppBitType.Bit64
|
||||
{
|
||||
ReadWJ(fupdPost.FilePath, ref aDataExcel);
|
||||
}
|
||||
Dictionary<string, string> dicDRMXBZ = new Dictionary<string, string>();
|
||||
dicDRMXBZ.Clear();
|
||||
sSQL.Clear();
|
||||
sSQL.Add("select XLBZ_XLBZID,XLBZ_XLBZLXMC from XLBZ where 1 = 1 ");
|
||||
DataSet ds = dberp.OpenDataSet(sSQL);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
dicDRMXBZ.Add(ds.Tables[0].Rows[i]["XLBZ_XLBZID"].ToString().Trim(), ds.Tables[0].Rows[i]["XLBZ_XLBZLXMC"].ToString().Trim());
|
||||
}
|
||||
}
|
||||
|
||||
ExcelColumnValid(aDataExcel);
|
||||
insertJGBMX(dberp, sSQL, aDataExcel, dicDRMXBZ);
|
||||
dberp.CommitTrans();
|
||||
if (!sErrorMessage.Equals(""))
|
||||
{
|
||||
ShowMessage("导入完成!\r\n" + sErrorMessage);
|
||||
}
|
||||
else
|
||||
{ ShowMessage("导入完成!");
|
||||
}
|
||||
|
||||
DialogOperationScript dos = new DialogOperationScript(this);
|
||||
dos.ClickOwnerButton(PageParam.GetRTrimString("btnRefreshCID"));
|
||||
dos.CloseSelf();
|
||||
dos.Execute();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
lblTitle.Text = "";
|
||||
dberp.RollbackTrans();
|
||||
ShowMessage(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnQX_Click(object sender, EventArgs e)
|
||||
{
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 自定义事件
|
||||
//根据表格,更新价格表表价
|
||||
|
||||
private void insertJGBMX(TDatabase dberp, TSQL sSQL, DataSet ds, Dictionary<string, string> dicDRMXBZ)
|
||||
{
|
||||
#region 导入记录
|
||||
string sXLXHID = "";
|
||||
string sXLGGID = "";
|
||||
string sXLBZID = "G";
|
||||
string sXLDYDJ = "";
|
||||
string sJLDW = "";
|
||||
int iXH = 1;
|
||||
sSucessDr = 0;
|
||||
|
||||
int iXSWS = string.IsNullOrEmpty(GetOption("BJU002")) ? 5 : CMISproConvert.StrToInt(GetOption("BJU002"));
|
||||
if (iXSWS < 0)
|
||||
iXSWS = 0;
|
||||
else if (iXSWS > 8)
|
||||
iXSWS = 8;
|
||||
|
||||
//是否启用非长度计量单位
|
||||
bool bQYFCDJLDW = XLBJDUtils.GetXLXSBJPZXX(100860018).QYFCDJLDW();
|
||||
|
||||
Dictionary<string, double> dicLenJLDWTD = XLBJDUtils.GetLenJLDWTD();
|
||||
|
||||
//有效期
|
||||
string sYXQS = PageParam.GetRTrimString("YXQS");
|
||||
string sYXQZ = PageParam.GetRTrimString("YXQZ");
|
||||
string sBJU003 = PageParam.GetRTrimString("BJU003");
|
||||
string sDefaultXLBZID = PageParam.GetRTrimString("sDefaultXLBZID");
|
||||
string sJJLY = PageParam.GetRTrimString("JJLY");
|
||||
string sBJLY = PageParam.GetRTrimString("BJLY");
|
||||
string sJGBID = PageParam.GetRTrimString("JGBID");
|
||||
|
||||
string sXLJGU007 = GetOption(102579000, "XLJGU007");
|
||||
iXH = XLJGB_JGBMX.getMaxXH(sJGBID) - 1;
|
||||
|
||||
int VnewID = CMISproDataBase.NewID("DBERP", "V_XSBJJSJGB");
|
||||
int iVXH = 1;
|
||||
|
||||
#region 循环EXCEL插入V表
|
||||
|
||||
foreach (DataRow Row in ds.Tables[0].Rows)
|
||||
{
|
||||
sSucessDr++;
|
||||
sXLXHID = sGetCellTest(Row, 0).Trim();
|
||||
sXLGGID = sGetCellTest(Row, 1).Trim();
|
||||
if (sXLJGU007.Equals("A"))
|
||||
{
|
||||
sXLGGID = sXLGGID.Replace("x", "X").Replace("X", "*").Replace("*", "×");
|
||||
}
|
||||
else if (sXLJGU007.Equals("B"))
|
||||
{
|
||||
sXLGGID = sXLGGID.Replace("x", "X").Replace("X", "*").Replace("×", "*");
|
||||
}
|
||||
sXLBZID = XLBJDUtils.GetBZXLZBZID(sGetCellTest(Row, 2).Trim(), sDefaultXLBZID, dicDRMXBZ);
|
||||
if (sXLBZID.Equals(""))
|
||||
sXLBZID = sGetCellTest(Row, 2).Trim();
|
||||
sXLDYDJ = sGetCellTest(Row, 3).Trim().Replace('K', 'k').Replace('v', 'V'); ;
|
||||
sJLDW = sGetCellTest(Row, 4).Trim();
|
||||
if (!bQYFCDJLDW)
|
||||
{
|
||||
if (!sJLDW.ToUpper().Equals("KM") && !sJLDW.ToUpper().Equals("M") && !sJLDW.Equals("千米") && !sJLDW.Equals("米") && !dicLenJLDWTD.ContainsKey(sJLDW))
|
||||
sJLDW = sBJU003;
|
||||
else if (sJLDW.ToUpper().Equals("KM"))
|
||||
sJLDW = "Km";
|
||||
else if (sJLDW.ToUpper().Equals("M"))
|
||||
sJLDW = "M";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sJLDW.Equals(""))
|
||||
sJLDW = sBJU003;
|
||||
else if (sJLDW.ToUpper().Equals("KM"))
|
||||
sJLDW = "Km";
|
||||
else if (sJLDW.ToUpper().Equals("M"))
|
||||
sJLDW = "M";
|
||||
}
|
||||
|
||||
#region 插入V_XSBJJSJGB表 V_XSBJJSJGB_JGBJJ->含税基价 V_XSBJJSJGB_JGBBJ->无税基价,V_XSBJJSJGB_CLCB->含税表价,V_XSBJJSJGB_BJDHQCLCB->无税表价
|
||||
|
||||
sSQL.Clear();
|
||||
sSQL.Add(@"insert into V_XSBJJSJGB (V_XSBJJSJGB_ID,V_XSBJJSJGB_BJDID,V_XSBJJSJGB_BJDXH,V_XSBJJSJGB_XLXHID,V_XSBJJSJGB_XLGGID,V_XSBJJSJGB_XLBZID,V_XSBJJSJGB_DYDJID,V_XSBJJSJGB_JGBJLDW,V_XSBJJSJGB_JGBJJ,V_XSBJJSJGB_JGBBJ,V_XSBJJSJGB_CLCB,V_XSBJJSJGB_BJDHQCLCB )
|
||||
values(:pID,:pJGBID,:pXH,:pXLXHID,:pXLGGID,:pXLBZID,:pDYDJID,:pJGBJLDW,:pJGBJJ,:pJGBBJ,:pHSBJ,:pWSBJ)");
|
||||
sSQL.ParamByName("pID").Value = VnewID;
|
||||
sSQL.ParamByName("pJGBID").Value = sJGBID;
|
||||
sSQL.ParamByName("pXH").Value = iVXH++;
|
||||
sSQL.ParamByName("pXLXHID").Value = sXLXHID;
|
||||
sSQL.ParamByName("pXLGGID").Value = sXLGGID;
|
||||
sSQL.ParamByName("pXLBZID").Value = sXLBZID;
|
||||
sSQL.ParamByName("pDYDJID").Value = sXLDYDJ;
|
||||
sSQL.ParamByName("pJGBJLDW").Value = sJLDW;
|
||||
sSQL.ParamByName("pJGBJJ").Value = 0;
|
||||
sSQL.ParamByName("pJGBBJ").Value =0;
|
||||
sSQL.ParamByName("pHSBJ").Value = 0;
|
||||
sSQL.ParamByName("pWSBJ").Value = 0;
|
||||
dberp.ExecSQL(sSQL);
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 存在相同报价产品不允许导入
|
||||
|
||||
sSQL.Clear();
|
||||
sSQL.Add(" SELECT V_XSBJJSJGB_XLXHID,V_XSBJJSJGB_XLGGID,V_XSBJJSJGB_XLBZID,V_XSBJJSJGB_DYDJID ");
|
||||
sSQL.Add(" FROM V_XSBJJSJGB where V_XSBJJSJGB_ID = :pID and V_XSBJJSJGB_BJDID=:pJGBID ");
|
||||
sSQL.Add(" GROUP BY V_XSBJJSJGB_XLXHID,V_XSBJJSJGB_XLGGID,V_XSBJJSJGB_XLBZID,V_XSBJJSJGB_DYDJID HAVING COUNT(1) > 1 ");
|
||||
sSQL.ParamByName("pID").Value = VnewID;
|
||||
sSQL.ParamByName("pJGBID").Value = sJGBID;
|
||||
DataSet dsV = dberp.OpenDataSet(sSQL);
|
||||
if (dsV.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
#region 删除V表
|
||||
sSQL.Clear();
|
||||
sSQL.Add("delete from V_XSBJJSJGB ");
|
||||
sSQL.Add(" where V_XSBJJSJGB_ID=:pID");
|
||||
sSQL.Add(" and V_XSBJJSJGB_BJDID=:pJGBID");
|
||||
sSQL.ParamByName("pID").Value = VnewID;
|
||||
sSQL.ParamByName("pJGBID").Value = sJGBID;
|
||||
dberp.ExecSQL(sSQL);
|
||||
#endregion
|
||||
|
||||
string sErrXLXHID = dsV.Tables[0].Rows[0]["V_XSBJJSJGB_XLXHID"].ToString().Trim();
|
||||
string sErrXLGGID = dsV.Tables[0].Rows[0]["V_XSBJJSJGB_XLGGID"].ToString().Trim();
|
||||
string sErrXLBZID = dsV.Tables[0].Rows[0]["V_XSBJJSJGB_XLBZID"].ToString().Trim();
|
||||
string sErrDYDJID = dsV.Tables[0].Rows[0]["V_XSBJJSJGB_DYDJID"].ToString().Trim();
|
||||
string sErrorMessage = "导入数据中存在相同报价产品[" + sErrXLXHID + " " + sErrXLGGID + " " + sErrXLBZID + " " + sErrDYDJID + "],导入失败!";
|
||||
throw new Exception(sErrorMessage);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 校验四要素是否存在材料清单
|
||||
|
||||
sSQL.Clear();
|
||||
sSQL.Add(@"
|
||||
SELECT
|
||||
V.V_XSBJJSJGB_XLXHID,
|
||||
V.V_XSBJJSJGB_XLGGID,
|
||||
V.V_XSBJJSJGB_XLBZID,
|
||||
V.V_XSBJJSJGB_DYDJID
|
||||
FROM V_XSBJJSJGB V
|
||||
WHERE V.V_XSBJJSJGB_ID = :pID
|
||||
AND NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM XLXSCLQD Q
|
||||
WHERE Q.XLXSCLQD_XLXHID = V.V_XSBJJSJGB_XLXHID
|
||||
AND REPLACE(Q.XLXSCLQD_XLGGID,'×','*')= REPLACE(V.V_XSBJJSJGB_XLGGID,'×','*')
|
||||
AND Q.XLXSCLQD_XLBZID = V.V_XSBJJSJGB_XLBZID
|
||||
AND ISNULL(Q.XLXSCLQD_DYDJID,'') = ISNULL(V.V_XSBJJSJGB_DYDJID,'' ) AND XLXSCLQD_WPID='ZZZZ'
|
||||
)");
|
||||
sSQL.ParamByName("pID").Value = VnewID;
|
||||
DataSet dsNoQD = dberp.OpenDataSet(sSQL);
|
||||
if (dsNoQD.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
StringBuilder sbMsg = new StringBuilder();
|
||||
int iCount = 0;
|
||||
foreach (DataRow dr in dsNoQD.Tables[0].Rows)
|
||||
{
|
||||
iCount++;
|
||||
sbMsg.AppendLine(
|
||||
dr["V_XSBJJSJGB_XLXHID"].ToString().Trim() + " " +
|
||||
dr["V_XSBJJSJGB_XLGGID"].ToString().Trim() + " " +
|
||||
dr["V_XSBJJSJGB_XLBZID"].ToString().Trim() + " " +
|
||||
dr["V_XSBJJSJGB_DYDJID"].ToString().Trim()
|
||||
);
|
||||
if (iCount >= 20)
|
||||
{
|
||||
sbMsg.AppendLine("......");
|
||||
break;
|
||||
}
|
||||
}
|
||||
sSQL.Clear();
|
||||
sSQL.Add(@"
|
||||
DELETE
|
||||
FROM V_XSBJJSJGB
|
||||
WHERE V_XSBJJSJGB_ID = :pID
|
||||
AND NOT EXISTS
|
||||
(
|
||||
SELECT 1
|
||||
FROM XLXSCLQD Q
|
||||
WHERE Q.XLXSCLQD_XLXHID = V_XSBJJSJGB_XLXHID
|
||||
AND REPLACE(Q.XLXSCLQD_XLGGID,'×','*')= REPLACE(V_XSBJJSJGB_XLGGID,'×','*')
|
||||
AND Q.XLXSCLQD_XLBZID = V_XSBJJSJGB_XLBZID
|
||||
AND ISNULL(Q.XLXSCLQD_DYDJID,'') = ISNULL(V_XSBJJSJGB_DYDJID,'' ) AND XLXSCLQD_WPID='ZZZZ'
|
||||
)");
|
||||
sSQL.ParamByName("pID").Value = VnewID;
|
||||
dberp.OpenDataSet(sSQL);
|
||||
sErrorMessage = "存在以下四要素不在材料清单中,已跳过!\r\n" + sbMsg.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 将V表插入XLXSJGBMX
|
||||
|
||||
sSQL.Clear();
|
||||
sSQL.Add(@" merge into XLXSJGBMX tar
|
||||
using ( select row_number() over( order by V_XSBJJSJGB_BJDXH )+:pMaxXH as XH,
|
||||
V_XSBJJSJGB_XLXHID as XLXHID,
|
||||
V_XSBJJSJGB_XLGGID as XLGGID,
|
||||
V_XSBJJSJGB_XLBZID as XLBZID,
|
||||
V_XSBJJSJGB_DYDJID as DYDJID,
|
||||
V_XSBJJSJGB_JGBJLDW as JLDW,
|
||||
V_XSBJJSJGB_JGBJJ as JGBJJ,
|
||||
V_XSBJJSJGB_JGBBJ as JGBBJ,
|
||||
V_XSBJJSJGB_CLCB as HSBJ,
|
||||
V_XSBJJSJGB_BJDHQCLCB as WSBJ,
|
||||
case when upper(V_XSBJJSJGB_JGBJLDW) in ('KM','千米') then 0.001 when upper(V_XSBJJSJGB_JGBJLDW) in ('M','米') then 1 else 0 end as dJQJGXS
|
||||
from V_XSBJJSJGB
|
||||
where V_XSBJJSJGB_ID=:pID and V_XSBJJSJGB_BJDID=:pJGBID
|
||||
) sor
|
||||
on (
|
||||
tar.XLXSJGBMX_JGBID=:pJGBID
|
||||
and tar.XLXSJGBMX_XLXHID =sor.XLXHID
|
||||
and tar.XLXSJGBMX_XLGGID =sor.XLGGID
|
||||
and tar.XLXSJGBMX_XLBZID =sor.XLBZID
|
||||
and tar.XLXSJGBMX_DYDJID =sor.DYDJID
|
||||
)
|
||||
when matched then update set ");
|
||||
sSQL.Add(" XLXSJGBMX_WHR = :XLXSJGBMX_WHR, XLXSJGBMX_WHRID=:XLXSJGBMX_WHRID, XLXSJGBMX_WHSJ=:XLXSJGBMX_WHSJ ");
|
||||
sSQL.Add(" when not matched then insert ( ");
|
||||
sSQL.Add(" XLXSJGBMX_JGBID, XLXSJGBMX_XH,XLXSJGBMX_XLXHID,XLXSJGBMX_XLGGID,XLXSJGBMX_XLBZID,XLXSJGBMX_DYDJID,XLXSJGBMX_JLDW, ");
|
||||
sSQL.Add(" XLXSJGBMX_YXQS,XLXSJGBMX_YXQZ,XLXSJGBMX_WSJJ,XLXSJGBMX_HSJJ,XLXSJGBMX_HSBJ,XLXSJGBMX_WSBJ,XLXSJGBMX_BZ,XLXSJGBMX_WHR,XLXSJGBMX_WHRID,XLXSJGBMX_WHSJ,");
|
||||
sSQL.Add(" XLXSJGBMX_HSJJM,XLXSJGBMX_HSBJM,XLXSJGBMX_WSJJM,XLXSJGBMX_WSBJM )");
|
||||
sSQL.Add(" values(");
|
||||
sSQL.Add(" :pJGBID,sor.XH,sor.XLXHID,sor.XLGGID,sor.XLBZID,isnull(sor.DYDJID,' '),sor.JLDW, ");
|
||||
sSQL.Add(" :XLXSJGBMX_YXQS,:XLXSJGBMX_YXQZ,sor.JGBBJ,sor.JGBJJ,sor.HSBJ,sor.WSBJ,:XLXSJGBMX_BZ,:XLXSJGBMX_WHR,:XLXSJGBMX_WHRID,:XLXSJGBMX_WHSJ, ");
|
||||
sSQL.Add(" RoundFix(sor.JGBJJ* sor.dJQJGXS,6), RoundFix(sor.HSBJ* sor.dJQJGXS,6), RoundFix(sor.JGBBJ* sor.dJQJGXS,6),RoundFix(sor.WSBJ* sor.dJQJGXS,6) )");
|
||||
sSQL.ParamByName("pMaxXH").Value = iXH;
|
||||
sSQL.ParamByName("pID").Value = VnewID;
|
||||
sSQL.ParamByName("pJGBID").Value = sJGBID;
|
||||
sSQL.ParamByName("XLXSJGBMX_YXQS").Value = sYXQS;
|
||||
sSQL.ParamByName("XLXSJGBMX_YXQZ").Value = sYXQZ.Equals("") ? null : sYXQZ;
|
||||
sSQL.ParamByName("XLXSJGBMX_BZ").Value = "";
|
||||
sSQL.ParamByName("XLXSJGBMX_WHR").Value = tSession.UserName;
|
||||
sSQL.ParamByName("XLXSJGBMX_WHRID").Value = tSession.UserId;
|
||||
sSQL.ParamByName("XLXSJGBMX_WHSJ").Value = CMISproConvert.ConvertTime(DateTime.Now);
|
||||
dberp.ExecSQL(sSQL);
|
||||
XLBJDUtils.SyncXLXSBJXLGGTHB_ByXLXSJGBMX_Batch(dberp, tSession, PageParam.GetRTrimString("JGBID"));
|
||||
if (GetOption(100860001, "BJU066").Equals("Y"))
|
||||
{
|
||||
XLJGB_CLJGTZList.UpdateCLCB(dberp, sSQL, PageParam.GetRTrimString("JGBID"), iXSWS, PageParam.GetRTrimString("JSBLFS"), tSession.UserId, tSession.UserName, iXH, sBJU003);
|
||||
XLJGB_CLJGTZList.DoCPJJ(dberp, PageParam.GetRTrimString("MXBH"), PageParam.GetRTrimString("JGBID"), true, iXSWS, PageParam.GetRTrimString("JSBLFS"), tSession.UserId, tSession.UserName, iXH, sBJU003);
|
||||
XLJGB_CLJGTZList.ReCalcWSJG(dberp, sSQL, PageParam.GetRTrimString("JGBID"), PageParam.GetRTrimString("MXBH"), iXSWS, iXH);
|
||||
JGBMLInfo.UpdateJGBMXXSXH(dberp, PageParam.GetRTrimString("JGBID"), PageParam.GetRTrimString("MXBH"));
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 删除V表
|
||||
|
||||
sSQL.Clear();
|
||||
sSQL.Add("delete from V_XSBJJSJGB ");
|
||||
sSQL.Add(" where V_XSBJJSJGB_ID=:pID");
|
||||
sSQL.Add(" and V_XSBJJSJGB_BJDID=:pJGBID");
|
||||
sSQL.ParamByName("pID").Value = VnewID;
|
||||
sSQL.ParamByName("pJGBID").Value = sJGBID;
|
||||
dberp.ExecSQL(sSQL);
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
private void ExcelColumnValid(DataSet ds)
|
||||
{
|
||||
Dictionary<string, string> ColumnNames = new Dictionary<string, string>();
|
||||
ColumnNames.Add("0", "型号");
|
||||
ColumnNames.Add("1", "规格");
|
||||
ColumnNames.Add("2", "标准");
|
||||
ColumnNames.Add("3", "电压等级");
|
||||
ColumnNames.Add("4", "计量单位");
|
||||
for (int i = 0; i < ColumnNames.Count; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!ds.Tables[0].Columns[i].ColumnName.Trim().Equals(ColumnNames[i.ToString()].Trim()))
|
||||
{
|
||||
throw new Exception("栏目[" + ds.Tables[0].Columns[i].ColumnName + "]与导入文件要求的栏目格式不一致!");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ReadWJ(string sPath, ref DataSet aDataExcel)
|
||||
{
|
||||
string sMessage = "";
|
||||
aDataExcel = TExcelData.ReadExcel(sPath.Trim(), "", "", false, ref sMessage);
|
||||
if(!sMessage.Trim().Equals(""))
|
||||
{
|
||||
throw new Exception("文件读取失败!具体原因:" + sMessage);
|
||||
}
|
||||
}
|
||||
|
||||
private string sGetCellTest(DataRow Row, int ColumnIndex)
|
||||
{
|
||||
return Row[ColumnIndex].ToString().Trim().Replace("\r\n", "").Replace("\n", "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static string GetStdConnStr(string sDriverName, string sJSConnStr)
|
||||
{
|
||||
string result = ""; ;
|
||||
string[] pairs = sJSConnStr.Split(';');
|
||||
foreach (string pair in pairs)
|
||||
{
|
||||
string[] keyValue = pair.Split('=');
|
||||
if (keyValue[0] == "Server Name")
|
||||
{
|
||||
if (sDriverName == "ORACLE")
|
||||
{
|
||||
result = result + "Data Source=" + keyValue[1] + ";";
|
||||
}
|
||||
else
|
||||
{
|
||||
result = result + "Server=" + keyValue[1] + ";";
|
||||
}
|
||||
}
|
||||
else if (keyValue[0] == "Database Name")
|
||||
{
|
||||
result = result + "Database=" + keyValue[1] + ";";
|
||||
}
|
||||
else if (keyValue[0] == "User Name")
|
||||
{
|
||||
result = result + "User ID=" + keyValue[1] + ";";
|
||||
}
|
||||
else if (keyValue[0] == "Password")
|
||||
{
|
||||
result = result + "Password=" + keyValue[1] + ";";
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user