提交说明10/9
This commit is contained in:
+257
@@ -0,0 +1,257 @@
|
||||
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_MISPROAS;
|
||||
using GThinking.N_CONTROL;
|
||||
using GThinking.N_MISPRO.Utility;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GThinking.U20261363_N_XLXSBJ
|
||||
{
|
||||
[TableMap(DB = "DBERP", DbTableName = "XLXSBJDMX", Umid = 100860174, IsWorkFlow = false)]
|
||||
public class DRWLJCPEntity : EntityManager
|
||||
{
|
||||
}
|
||||
public partial class DRWLJCP : SingleCardBase
|
||||
{
|
||||
DRWLJCPEntity entity = new DRWLJCPEntity();
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.UMID = 100860174;
|
||||
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();
|
||||
}
|
||||
|
||||
#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);
|
||||
}
|
||||
ExcelColumnValid(aDataExcel);
|
||||
UpdateJGBBJ(dberp, sSQL, aDataExcel);
|
||||
dberp.CommitTrans();
|
||||
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 UpdateJGBBJ(TDatabase dberp, TSQL SQL, DataSet ds)
|
||||
{
|
||||
string sBJDID = PageParam.GetRTrimString("BJDID");
|
||||
string sBJFLID = PageParam.GetRTrimString("BJFLID");
|
||||
|
||||
string sXLXHID = "";
|
||||
string sXLGGID = "";
|
||||
string sXLBZID = "";
|
||||
string sDYDJID = "";
|
||||
string sXLYSID = "";
|
||||
string sJLDW = "";
|
||||
|
||||
string sBJSL = "";
|
||||
string sCLCB = "";
|
||||
string sJGBBJ = "";
|
||||
string sBZ = "";
|
||||
|
||||
double dXH = 0;
|
||||
|
||||
string sBJDXHList = "";
|
||||
|
||||
int tmpXSWS = string.IsNullOrEmpty(GetOption(100860000, "BJU002")) ? 5 : CMISproConvert.StrToInt(GetOption(100860000, "BJU002"));
|
||||
if (tmpXSWS < 0)
|
||||
tmpXSWS = 0;
|
||||
else if (tmpXSWS > 8)
|
||||
tmpXSWS = 8;
|
||||
|
||||
BJFLXX flxx = XLBJDUtils.GetBJFLXX(sBJFLID);
|
||||
|
||||
string sCPBJMRXSWS = flxx.XLXSBJFL_CPBJMRXSWS;
|
||||
|
||||
|
||||
string sJCLLX = flxx.XLXSBJFL_BJJCLLX;
|
||||
string sLJJCL = flxx.XLXSBJFL_LJJCLLX;
|
||||
|
||||
DateTime tWHSJCondition = MISproUtils.GetServerTime();
|
||||
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
double fCLZL = 0;
|
||||
double dCPJJ = 0;
|
||||
double dJJ = 0;
|
||||
double dCLCB = 0;
|
||||
double dBJDHQCLCB = 0;
|
||||
|
||||
#region 完成报价单明细的更新
|
||||
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
sXLXHID = ds.Tables[0].Rows[i]["型号"].ToString().Trim();
|
||||
sXLGGID = ds.Tables[0].Rows[i]["规格"].ToString().Trim();
|
||||
sXLBZID = ds.Tables[0].Rows[i]["标准"].ToString().Trim().Split('|')[0];
|
||||
sDYDJID = ds.Tables[0].Rows[i]["电压等级"].ToString().Trim();
|
||||
sJLDW = ds.Tables[0].Rows[i]["计量单位"].ToString().Trim();
|
||||
sXLYSID = ds.Tables[0].Rows[i]["颜色"].ToString().Trim().Split('|')[0];
|
||||
|
||||
sBJSL = ds.Tables[0].Rows[i]["报价数量"].ToString().Trim();
|
||||
sCLCB = ds.Tables[0].Rows[i]["料价"].ToString().Trim();
|
||||
sJGBBJ = ds.Tables[0].Rows[i]["表价"].ToString().Trim();
|
||||
sBZ = ds.Tables[0].Rows[i]["备注"].ToString().Trim();
|
||||
dXH = CMISproConvert.StrToFloat(ds.Tables[0].Rows[i]["序号"].ToString().Trim(), 0);
|
||||
SQL.Clear();
|
||||
SQL.Add("update XLXSBJDMX set XLXSBJDMX_CLCB =:pCLCB,XLXSBJDMX_BJDHQCLCB =:pCLCB,XLXSBJDMX_JGBBJ =:pJGBBJ, XLXSBJDMX_JGBBJTZ = 'Y', XLXSBJDMX_JGBBJGXSJ = :pJGBBJGXSJ,XLXSBJDMX_BZ = XLXSBJDMX_BZ||:pBZ,XLXSBJDMX_BJLY='SSJGBBJ' ");
|
||||
SQL.Add(",XLXSBJDMX_WHR=:pWHR,XLXSBJDMX_WHRID=:pWHRID,XLXSBJDMX_WHSJ=:tWHSJCondition ");
|
||||
SQL.Add("where 1=1 ");
|
||||
SQL.Add(" and XLXSBJDMX_BJDID = :XLXSBJDMX_BJDID ");
|
||||
SQL.Add(" and XLXSBJDMX_XH=:pXH");
|
||||
SQL.ParamByName("XLXSBJDMX_BJDID").Value = sBJDID;
|
||||
SQL.ParamByName("pXH").Value = dXH;
|
||||
SQL.ParamByName("pCLCB").Value = CMISproConvert.StrToFloat(sCLCB);
|
||||
SQL.ParamByName("pJGBBJ").Value = CMISproConvert.StrToFloat(sJGBBJ);
|
||||
SQL.ParamByName("pJGBBJGXSJ").Value = MISproUtils.GetServerTime();
|
||||
SQL.ParamByName("pBZ").Value = sBZ;
|
||||
SQL.ParamByName("pWHR").Value = tSession.UserName;
|
||||
SQL.ParamByName("pWHRID").Value = tSession.UserId;
|
||||
SQL.ParamByName("tWHSJCondition").Value = tWHSJCondition;
|
||||
dberp.ExecSQL(SQL);
|
||||
sBJDXHList = sBJDXHList + "," + ds.Tables[0].Rows[i]["序号"].ToString().Trim();
|
||||
}
|
||||
#endregion
|
||||
|
||||
sBJDXHList = sBJDXHList.TrimStart(',').TrimEnd(',');
|
||||
|
||||
if (!sBJDXHList.Equals(""))
|
||||
{
|
||||
#region 完成报价更新
|
||||
XLBJDUtils.UpdateBJDMX(dberp, SQL, sBJFLID, sBJDID, tmpXSWS, sJCLLX, sLJJCL, sCPBJMRXSWS, sBJDXHList, 0, false, false, false, "", tWHSJCondition);
|
||||
#endregion
|
||||
|
||||
#region 最低限价的更新
|
||||
XLBJDUtils.UpdateZDXJGS(sBJDID, sBJFLID, GetOption(100860000, "BJU002"));
|
||||
XLBJDUtils.UpdateJSJGS(sBJDID, sBJFLID, GetOption(100860000, "BJU002"));
|
||||
|
||||
#endregion
|
||||
|
||||
#region 完成主表信息的更新
|
||||
XLBJDUtils.UpdateXLXSBJD(dberp, SQL, sBJDID, sJCLLX, sLJJCL, flxx.XLXSBJFL_ZDXJJCLLX, flxx.XLXSBJFL_JYF, PageParam.GetRTrimString("YSJDID"),
|
||||
PageParam.GetRTrimString("GYSID"), flxx.XLXSBJFL_YFWLID, flxx.XLXSBJFL_BJHYF);
|
||||
}
|
||||
#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", "标准");
|
||||
ColumnNames.Add("5", "电压等级");
|
||||
ColumnNames.Add("6", "计量单位");
|
||||
ColumnNames.Add("7", "颜色");
|
||||
ColumnNames.Add("8", "报价产品");
|
||||
ColumnNames.Add("9", "报价数量");
|
||||
ColumnNames.Add("10", "料价");
|
||||
ColumnNames.Add("11", "表价");
|
||||
ColumnNames.Add("12", "备注");
|
||||
|
||||
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", "");
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user