2026821
This commit is contained in:
@@ -0,0 +1,724 @@
|
||||
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 System.Text;
|
||||
using GThinking.N_CONTROL;
|
||||
using GThinking.N_MISPRO;
|
||||
using GThinking.N_MISPRO.TableCache;
|
||||
using GThinking.N_MISPROAS.Services;
|
||||
|
||||
namespace GThinking.N_XLXSBJ
|
||||
{
|
||||
public partial class XLJGB_PLDRList : SingleGridBase
|
||||
{
|
||||
XLJGB_PLDR entity = new XLJGB_PLDR();
|
||||
PLDR_M queryEntity = new PLDR_M();
|
||||
|
||||
#region 页面初始化
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.UMID = 100860001;
|
||||
this.UMName = "线缆销售报价价格表";
|
||||
this.CurMaster = Master;
|
||||
this.ModuleGV = ContentGrid;
|
||||
this.CurEntity = entity;
|
||||
this.CurQueryEntity = queryEntity;
|
||||
sQueryURLTarget = "XLJGB_PLDRQuery.aspx";
|
||||
this.PageHeight = 400;
|
||||
this.PageWidth = 500;
|
||||
base.DataKeyNames = new string[] { "XLXSCLQD_XLXHID", "XLXSCLQD_XLGGID", "XLXSCLQD_XLBZID", "XLXSCLQD_DYDJID" };
|
||||
|
||||
this.Master.EnableNewBtn = false;
|
||||
this.Master.EnableCopyBtn = false;
|
||||
this.Master.EnableEditBtn = false;
|
||||
this.Master.EnableDeleteBtn = false;
|
||||
this.Master.EnableViewBtn = false;
|
||||
if (!IsPostBack)
|
||||
{
|
||||
queryEntity.FieldByName("FJDDZB").Value = "True";
|
||||
}
|
||||
|
||||
base.InitPage();
|
||||
|
||||
this.ModuleGV.OnClientDblClick = "return false;";
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 模板继承事件
|
||||
|
||||
protected override void Master_OnStandardQuery(object sender, EventArgs e)
|
||||
{
|
||||
base.InitEntityByCondition();
|
||||
entity.EntityTable.QuerySelSql = GetQuerySql();
|
||||
base.Master_OnStandardQuery(sender, e);
|
||||
entity.GridDataBind(ContentGrid, tSession);
|
||||
}
|
||||
|
||||
protected override void moduleGV_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
}
|
||||
base.moduleGV_RowDataBound(sender, e);
|
||||
}
|
||||
|
||||
protected override void moduleGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
|
||||
{
|
||||
base.InitEntityByCondition();
|
||||
entity.EntityTable.QuerySelSql = GetQuerySql();
|
||||
ContentGrid.SelectedIndex = -1;
|
||||
base.moduleGV_PageIndexChanging(sender, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 控件事件
|
||||
|
||||
protected void btnQR_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(ContentGrid.CheckedRowIndexs))
|
||||
{
|
||||
ShowMessage("请勾选要导入的记录!");
|
||||
return;
|
||||
}
|
||||
int iXSWS = string.IsNullOrEmpty(GetOption("BJU002")) ? 5 : CMISproConvert.StrToInt(GetOption("BJU002"));
|
||||
if (iXSWS < 0)
|
||||
iXSWS = 0;
|
||||
else if (iXSWS > 8)
|
||||
iXSWS = 8;
|
||||
string sBJU003 = GetOption(100860000, "BJU003");
|
||||
string[] sRowIndexs = ContentGrid.CheckedRowIndexs.Split(',');
|
||||
if (!string.IsNullOrEmpty(PageParam.GetRTrimString("JGBID")))
|
||||
{
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sSQL = new TSQL(dberp);
|
||||
|
||||
//获取价格表明细最大序号
|
||||
sSQL.Clear();
|
||||
sSQL.Add("select isnull(max(XLXSJGBMX_XH),0.0) from XLXSJGBMX where XLXSJGBMX_JGBID=:pJGBID");
|
||||
sSQL.ParamByName("pJGBID").Value = PageParam.GetRTrimString("JGBID");
|
||||
DataSet dsJGB = dberp.OpenDataSet(sSQL);
|
||||
double MaxXH = 0.0;
|
||||
if (dsJGB.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
MaxXH = CMISproConvert.StrToFloat(dsJGB.Tables[0].Rows[0][0].ToString(), 0);
|
||||
}
|
||||
try
|
||||
{
|
||||
dberp.BeginTrans();
|
||||
//批量插入XLXSJGBMX
|
||||
sSQL.Clear();
|
||||
sSQL.Add("insert into XLXSJGBMX( ");
|
||||
sSQL.Add("XLXSJGBMX_JGBID,XLXSJGBMX_XH, ");
|
||||
sSQL.Add("XLXSJGBMX_XLXHID,XLXSJGBMX_XLGGID,XLXSJGBMX_XLBZID,XLXSJGBMX_DYDJID,XLXSJGBMX_JLDW, ");
|
||||
sSQL.Add("XLXSJGBMX_YXQS,XLXSJGBMX_YXQZ, ");
|
||||
sSQL.Add("XLXSJGBMX_WSJJ,XLXSJGBMX_HSJJ,XLXSJGBMX_WSBJ,XLXSJGBMX_HSBJ,XLXSJGBMX_WSJJM,XLXSJGBMX_HSJJM,XLXSJGBMX_WSBJM,XLXSJGBMX_HSBJM, ");
|
||||
sSQL.Add("XLXSJGBMX_BZ,XLXSJGBMX_WHRID,XLXSJGBMX_WHR,XLXSJGBMX_WHSJ) ");
|
||||
sSQL.Add("select :pJGBID as JGBID,:pMaxXH+row_number() over(order by XLXHID,XH) as XH, ");
|
||||
sSQL.Add("XLXHID,XLGGID,XLBZID,DYDJID,:pJLDW, ");
|
||||
sSQL.Add(":pYXQS as YXQS,:pYXQZ as YXQZ, ");
|
||||
sSQL.Add(" 0.0 as WSCLCB,0.0 as CLCB, ");
|
||||
sSQL.Add(" 0.0 as WSCPJJ,0.0 as CPJJ, ");
|
||||
sSQL.Add(" 0.0 as WSCLCBM,0.0 as CLCBM, ");
|
||||
sSQL.Add(" 0.0 as WSCPJJM,0.0 as CPJJM, ");
|
||||
sSQL.Add("' ' as BZ,:pWHRID,:pWHR,:pWHSJ ");
|
||||
|
||||
sSQL.Add(" from");
|
||||
sSQL.Add(" (");
|
||||
sSQL.Add(" select XLXSCLQD_XLXHID as XLXHID,XLXSCLQD_XLGGID as XLGGID,XLXSCLQD_XLBZID as XLBZID,XLXSCLQD_DYDJID as DYDJID,XLXSCLQD_XH as XH");
|
||||
sSQL.Add(" from XLXSCLQD");
|
||||
sSQL.Add(" where not exists");
|
||||
sSQL.Add(" (select 1 from XLXSJGBMX where XLXSJGBMX_JGBID=:pJGBID and XLXSJGBMX_XLXHID=XLXSCLQD_XLXHID and XLXSJGBMX_XLGGID=XLXSCLQD_XLGGID and XLXSJGBMX_XLBZID=XLXSCLQD_XLBZID and isnull(XLXSJGBMX_DYDJID,' ')=XLXSCLQD_DYDJID) ");
|
||||
sSQL.Add(" and (");
|
||||
for (int i = 0; i < sRowIndexs.Length; i++)
|
||||
{
|
||||
if (i == sRowIndexs.Length - 1)
|
||||
sSQL.Add(string.Format(" (XLXSCLQD_XLXHID='{0}' and XLXSCLQD_XLGGID='{1}' and XLXSCLQD_XLBZID='{2}' and XLXSCLQD_DYDJID='{3}') ",
|
||||
ContentGrid.DataKeys[int.Parse(sRowIndexs[i])]["XLXSCLQD_XLXHID"].ToString().Trim(),
|
||||
ContentGrid.DataKeys[int.Parse(sRowIndexs[i])]["XLXSCLQD_XLGGID"].ToString().Trim(),
|
||||
ContentGrid.DataKeys[int.Parse(sRowIndexs[i])]["XLXSCLQD_XLBZID"].ToString().Trim(),
|
||||
ContentGrid.DataKeys[int.Parse(sRowIndexs[i])]["XLXSCLQD_DYDJID"].ToString().Trim().Equals("") ? " " : ContentGrid.DataKeys[int.Parse(sRowIndexs[i])]["XLXSCLQD_DYDJID"].ToString().Trim()));
|
||||
else
|
||||
sSQL.Add(string.Format(" (XLXSCLQD_XLXHID='{0}' and XLXSCLQD_XLGGID='{1}' and XLXSCLQD_XLBZID='{2}' and XLXSCLQD_DYDJID='{3}') or ",
|
||||
ContentGrid.DataKeys[int.Parse(sRowIndexs[i])]["XLXSCLQD_XLXHID"].ToString().Trim(),
|
||||
ContentGrid.DataKeys[int.Parse(sRowIndexs[i])]["XLXSCLQD_XLGGID"].ToString().Trim(),
|
||||
ContentGrid.DataKeys[int.Parse(sRowIndexs[i])]["XLXSCLQD_XLBZID"].ToString().Trim(),
|
||||
ContentGrid.DataKeys[int.Parse(sRowIndexs[i])]["XLXSCLQD_DYDJID"].ToString().Trim().Equals("") ? " " : ContentGrid.DataKeys[int.Parse(sRowIndexs[i])]["XLXSCLQD_DYDJID"].ToString().Trim()));
|
||||
}
|
||||
sSQL.Add(") ");
|
||||
sSQL.Add(" ) c");
|
||||
sSQL.ParamByName("pJGBID").Value = PageParam.GetRTrimString("JGBID");
|
||||
sSQL.ParamByName("pMaxXH").Value = MaxXH;
|
||||
sSQL.ParamByName("pYXQS").Value = PageParam.GetRTrimString("YXQS");
|
||||
if (PageParam.GetRTrimString("YXQZ").Equals(""))
|
||||
sSQL.ParamByName("pYXQZ").Value = null;
|
||||
else
|
||||
sSQL.ParamByName("pYXQZ").Value = PageParam.GetRTrimString("YXQZ");
|
||||
sSQL.ParamByName("pWHRID").Value = tSession.UserId;
|
||||
sSQL.ParamByName("pWHR").Value = tSession.UserName;
|
||||
sSQL.ParamByName("pWHSJ").Value = DateTime.Now;
|
||||
sSQL.ParamByName("pJLDW").Value = GetOption("BJU003");
|
||||
dberp.ExecSQL(sSQL);
|
||||
XLBJDUtils.SyncXLXSBJXLGGTHB_ByXLXSJGBMX_Batch(dberp, tSession, PageParam.GetRTrimString("JGBID"));
|
||||
|
||||
XLJGB_CLJGTZList.UpdateCLCB(dberp, sSQL, PageParam.GetRTrimString("JGBID"), iXSWS, PageParam.GetRTrimString("JSBLFS"), tSession.UserId, tSession.UserName, MaxXH, sBJU003);
|
||||
XLJGB_CLJGTZList.DoCPJJ(dberp, PageParam.GetRTrimString("MXBH"), PageParam.GetRTrimString("JGBID"), true, iXSWS, PageParam.GetRTrimString("JSBLFS"), tSession.UserId, tSession.UserName, MaxXH, sBJU003);
|
||||
XLJGB_CLJGTZList.ReCalcWSJG(dberp, sSQL, PageParam.GetRTrimString("JGBID"), PageParam.GetRTrimString("MXBH"),iXSWS,MaxXH);
|
||||
JGBMLInfo.UpdateJGBMXXSXH(dberp, PageParam.GetRTrimString("JGBID"), PageParam.GetRTrimString("MXBH"));
|
||||
dberp.CommitTrans();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowMessage(ex.Message);
|
||||
dberp.RollbackTrans();
|
||||
return;
|
||||
}
|
||||
ShowMessage("导入完成!");
|
||||
}
|
||||
//CloseWindow();
|
||||
moduleGV_PageIndexChanging(null, null);
|
||||
}
|
||||
|
||||
protected void btnALL_Click(object sender, EventArgs e)
|
||||
{
|
||||
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();
|
||||
return;
|
||||
}
|
||||
else if (Confirm.GetValue("IsQD").Trim().Equals("Y"))
|
||||
{
|
||||
Confirm.Clear();
|
||||
}
|
||||
int iXSWS = string.IsNullOrEmpty(GetOption("BJU002")) ? 5 : CMISproConvert.StrToInt(GetOption("BJU002"));
|
||||
if (iXSWS < 0)
|
||||
iXSWS = 0;
|
||||
else if (iXSWS > 8)
|
||||
iXSWS = 8;
|
||||
if (!string.IsNullOrEmpty(PageParam.GetRTrimString("JGBID")))
|
||||
{
|
||||
base.InitEntityByCondition();
|
||||
string sBJU029 = GetOption("BJU029");
|
||||
int DRSL = CMISproConvert.StrToInt(sBJU029);
|
||||
if (DRSL > 0 && DSActiveModule.IsActiveModule(102373011))
|
||||
{
|
||||
TDatabase DBERP = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL tmpSQL = new TSQL(DBERP);
|
||||
tmpSQL.Clear();
|
||||
tmpSQL.Add("select 1 from XLXSJGB ");
|
||||
tmpSQL.Add(" where XLXSJGB_DRZT in ('W','J') ");//W|等待
|
||||
tmpSQL.Add(" and XLXSJGB_MXBH=:pMXBH");
|
||||
tmpSQL.Add(" and XLXSJGB_JGBID=:pJGBID");
|
||||
tmpSQL.ParamByName("pMXBH").Value = PageParam.GetRTrimString("MXBH");
|
||||
tmpSQL.ParamByName("pJGBID").Value = PageParam.GetRTrimString("JGBID");
|
||||
DataSet dsFW=DBERP.OpenDataSet(tmpSQL);
|
||||
if (dsFW.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
JGBDRXX drxx = new JGBDRXX();
|
||||
drxx.JGBID = PageParam.GetRTrimString("JGBID");
|
||||
drxx.MXBH = PageParam.GetRTrimString("MXBH");
|
||||
drxx.JSBLFS = PageParam.GetRTrimString("JSBLFS");
|
||||
drxx.iXSWS = iXSWS;
|
||||
drxx.JGCZBID = CurQueryEntity.FieldByName("JGCZBID").Value.Trim();
|
||||
drxx.CPMLID = CurQueryEntity.FieldByName("CPMLID").Value.Trim();
|
||||
drxx.XLXHIDJQPP = CurQueryEntity.FieldByName("XLXHIDJQPP").Value.ToString().Trim().ToUpper().Equals("TRUE") ? "Y" : "N";
|
||||
drxx.XLGGIDJQPP = CurQueryEntity.FieldByName("XLGGIDJQPP").Value.ToString().Trim().ToUpper().Equals("TRUE") ? "Y" : "N";
|
||||
drxx.XLXHID = CurQueryEntity.FieldByName("XLXHID").Value.Trim();
|
||||
drxx.XLGGID = CurQueryEntity.FieldByName("XLGGID").Value.Trim();
|
||||
drxx.ST = CurQueryEntity.FieldByName("ST").Value.Trim();
|
||||
drxx.DYDJ = CurQueryEntity.FieldByName("DYDJ").Value.Trim();
|
||||
drxx.FJDDZB = CurQueryEntity.FieldByName("FJDDZB").Value.ToString().Trim().ToUpper().Equals("TRUE") ? "Y" : "N";
|
||||
drxx.JCXFDZBZ = CurQueryEntity.FieldByName("JCXFDZBZ").Value.ToString().Trim().ToUpper().Equals("TRUE") ? "Y" : "N";
|
||||
drxx.YXQS = PageParam.GetRTrimString("YXQS");
|
||||
drxx.YXQZ = PageParam.GetRTrimString("YXQZ");
|
||||
drxx.BJU003 = GetOption(100860000, "BJU003");
|
||||
drxx.SL = DRSL;
|
||||
string sBZMC = CurQueryEntity.FieldByName("BZMC").Value.Trim();
|
||||
if (!string.IsNullOrEmpty(sBZMC))
|
||||
{
|
||||
tmpSQL.Clear();
|
||||
tmpSQL.Add("select XLBZ_XLBZID from XLBZ ");
|
||||
tmpSQL.Add(" where 1=1 and len(XLBZ_XLBZID) < 10 ");
|
||||
tmpSQL.Add(" and XLBZ_XLBZLXMC like :pBZMC ");
|
||||
tmpSQL.Add(" order by XLBZ_XLBZID ");
|
||||
tmpSQL.ParamByName("pBZMC").Value = "%" + sBZMC + "%";
|
||||
DataSet dsBZID = DBERP.OpenDataSet(tmpSQL);
|
||||
for (int i = 0; i < dsBZID.Tables[0].Rows.Count; i++)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(drxx.ST))
|
||||
{
|
||||
drxx.ST += ",";
|
||||
}
|
||||
drxx.ST += dsBZID.Tables[0].Rows[i]["XLBZ_XLBZID"].ToString().Trim();
|
||||
}
|
||||
}
|
||||
ServiceParams serviceParams = new ServiceParams();
|
||||
serviceParams.Add("objJGB", drxx);
|
||||
ServiceProgress serviceProgress = AsyncService.Enqueue("S_XLXSBJ", 102373011, "AsyncDoJGBDR", serviceParams);
|
||||
|
||||
tmpSQL.Clear();
|
||||
tmpSQL.Add("update XLXSJGB set ");
|
||||
tmpSQL.Add(" XLXSJGB_DRZT='W'");//W|等待
|
||||
tmpSQL.Add(" where XLXSJGB_MXBH=:pMXBH");
|
||||
tmpSQL.Add(" and XLXSJGB_JGBID=:pJGBID");
|
||||
tmpSQL.ParamByName("pMXBH").Value = drxx.MXBH;
|
||||
tmpSQL.ParamByName("pJGBID").Value = drxx.JGBID;
|
||||
DBERP.ExecSQL(tmpSQL);
|
||||
}
|
||||
|
||||
ShowMessage("已开始导入,请稍后查看!");
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
||||
TSQL sSQL = new TSQL(dberp);
|
||||
|
||||
//获取价格表明细最大序号
|
||||
sSQL.Clear();
|
||||
sSQL.Add("select isnull(max(XLXSJGBMX_XH),0.0) from XLXSJGBMX where XLXSJGBMX_JGBID=:pJGBID");
|
||||
sSQL.ParamByName("pJGBID").Value = PageParam.GetRTrimString("JGBID");
|
||||
DataSet dsJGB = dberp.OpenDataSet(sSQL);
|
||||
double MaxXH = 0.0;
|
||||
if (dsJGB.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
MaxXH = CMISproConvert.StrToFloat(dsJGB.Tables[0].Rows[0][0].ToString(), 0);
|
||||
}
|
||||
try
|
||||
{
|
||||
dberp.BeginTrans();
|
||||
//查询结果全部插入XLXSJGBMX
|
||||
sSQL.Clear();
|
||||
sSQL.Add("insert into XLXSJGBMX( ");
|
||||
sSQL.Add("XLXSJGBMX_JGBID,XLXSJGBMX_XH, ");
|
||||
sSQL.Add("XLXSJGBMX_XLXHID,XLXSJGBMX_XLGGID,XLXSJGBMX_XLBZID,XLXSJGBMX_DYDJID,XLXSJGBMX_JLDW, ");
|
||||
sSQL.Add("XLXSJGBMX_YXQS,XLXSJGBMX_YXQZ, ");
|
||||
sSQL.Add("XLXSJGBMX_WSJJ,XLXSJGBMX_HSJJ,XLXSJGBMX_WSBJ,XLXSJGBMX_HSBJ,XLXSJGBMX_WSJJM,XLXSJGBMX_HSJJM,XLXSJGBMX_WSBJM,XLXSJGBMX_HSBJM, ");
|
||||
sSQL.Add("XLXSJGBMX_BZ,XLXSJGBMX_WHRID,XLXSJGBMX_WHR,XLXSJGBMX_WHSJ) ");
|
||||
sSQL.Add("select :pJGBID as JGBID,:pMaxXH+row_number() over(order by XLXHID,XH) as XH, ");
|
||||
sSQL.Add("XLXHID,XLGGID,XLBZID,DYDJID,:pJLDW, ");
|
||||
sSQL.Add(":pYXQS as YXQS,:pYXQZ as YXQZ, ");
|
||||
sSQL.Add(" 0.0 as WSCLCB,0.0 as CLCB, ");
|
||||
sSQL.Add(" 0.0 as WSCPJJ,0.0 as CPJJ, ");
|
||||
sSQL.Add(" 0.0 as WSCLCBM,0.0 as CLCBM, ");
|
||||
sSQL.Add(" 0.0 as WSCPJJM,0.0 as CPJJM, ");
|
||||
sSQL.Add("' ' as BZ,:pWHRID,:pWHR,:pWHSJ ");
|
||||
|
||||
sSQL.Add(" from");
|
||||
sSQL.Add(" (");
|
||||
sSQL.Add(" select XLXSCLQD_XLXHID as XLXHID,XLXSCLQD_XLGGID as XLGGID,XLXSCLQD_XLBZID as XLBZID,XLXSCLQD_DYDJID as DYDJID,XLXSCLQD_XH as XH");
|
||||
sSQL.Add(" from XLXSCLQD");
|
||||
sSQL.Add(" left join XLBZ on XLBZ_XLBZID=XLXSCLQD_XLBZID");
|
||||
sSQL.Add(" left join XLXHB on XLXHB_XLXHID = XLXSCLQD_XLXHID");
|
||||
sSQL.Add(" left join XLXSBJXLGGTHB on XLXSBJXLGGTHB_XLGGID = XLXSCLQD_XLGGID");
|
||||
sSQL.Add(" where XLXSCLQD_WPID ='ZZZZ' and isnull(XLXHB_TYBZ,'N') <> 'Y' and not exists ");
|
||||
sSQL.Add(" (select 1 from XLXSJGBMX where XLXSJGBMX_JGBID=:pJGBID and XLXSJGBMX_XLXHID=XLXSCLQD_XLXHID and XLXSJGBMX_XLGGID=XLXSCLQD_XLGGID and XLXSJGBMX_XLBZID=XLXSCLQD_XLBZID and isnull(XLXSJGBMX_DYDJID,' ')=XLXSCLQD_DYDJID) ");
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("JGCZBID").Value.Trim()))
|
||||
{
|
||||
string[] sJGCZBList = CurQueryEntity.FieldByName("JGCZBID").Value.Trim().Split(',');
|
||||
sSQL.Add(" and ( 1<>1 ");
|
||||
for (int i = 0; i < sJGCZBList.Length; i++)
|
||||
{
|
||||
string[] sJGCZB = sJGCZBList[i].Split('|');
|
||||
if (sJGCZB.Length == 2)
|
||||
{
|
||||
sSQL.Add(string.Format(" or (XLXSCLQD_JGCZBID='{0}' and XLXSCLQD_JGCZBBBID='{1}' ) ", sJGCZB[0], sJGCZB[1]));
|
||||
}
|
||||
else if (sJGCZB.Length == 1)
|
||||
{
|
||||
sSQL.Add(string.Format(" or (XLXSCLQD_JGCZBID='{0}' ) ", sJGCZB[0]));
|
||||
}
|
||||
|
||||
}
|
||||
sSQL.Add(" ) ");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("CPMLID").Value.Trim()))
|
||||
{
|
||||
sSQL.Add(" and XLXSCLQD_CPMLID = :pCPMLID ");
|
||||
sSQL.ParamByName("pCPMLID").Value = CurQueryEntity.FieldByName("CPMLID").Value.Trim();
|
||||
}
|
||||
//型号模糊
|
||||
if (!CurQueryEntity.FieldByName("XLXHIDJQPP").Value.ToString().Trim().ToUpper().Equals("TRUE"))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("XLXHID").Value.Trim()))
|
||||
{
|
||||
sSQL.Add(" and XLXSCLQD_XLXHID like :pXLXHID ");
|
||||
sSQL.ParamByName("pXLXHID").Value = string.Format("%{0}%", CurQueryEntity.FieldByName("XLXHID").Value.Trim());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("XLXHID").Value.Trim()))
|
||||
{
|
||||
sSQL.Add(" and XLXSCLQD_XLXHID = :pXLXHID ");
|
||||
sSQL.ParamByName("pXLXHID").Value = CurQueryEntity.FieldByName("XLXHID").Value.Trim();
|
||||
}
|
||||
}
|
||||
//规格模糊
|
||||
if (!CurQueryEntity.FieldByName("XLGGIDJQPP").Value.ToString().Trim().ToUpper().Equals("TRUE"))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("XLGGID").Value.Trim()))
|
||||
{
|
||||
sSQL.Add(" and XLXSBJXLGGTHB_XLGGIDCH like :pXLGGID ");
|
||||
sSQL.ParamByName("pXLGGID").Value = string.Format("%{0}%", CurQueryEntity.FieldByName("XLGGID").Value.Trim().Replace("*", "×"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string sXLGGID = CurQueryEntity.FieldByName("XLGGID").Value.Trim();
|
||||
if (!string.IsNullOrEmpty(sXLGGID))
|
||||
{
|
||||
string[] sTemp = sXLGGID.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (sTemp.Length >= 2)
|
||||
{
|
||||
sSQL.Add(" and " + CMISproDataBase.GetWhereEqual(" XLXSBJXLGGTHB_XLGGIDCH", sXLGGID.Replace('*', '×')));
|
||||
}
|
||||
else
|
||||
{
|
||||
sSQL.Add(" and XLXSBJXLGGTHB_XLGGIDCH = :pXLGGID ");
|
||||
sSQL.ParamByName("pXLGGID").Value = CurQueryEntity.FieldByName("XLGGID").Value.Trim().Replace("*", "×");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("ST").Value.Trim()))
|
||||
{
|
||||
sSQL.Add(" and XLXSCLQD_XLBZID = :pST ");
|
||||
sSQL.ParamByName("pST").Value = CurQueryEntity.FieldByName("ST").Value.Trim();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("BZMC").Value.Trim()))
|
||||
{
|
||||
sSQL.Add(" and XLBZ_XLBZLXMC like :pBZMC ");
|
||||
sSQL.ParamByName("pBZMC").Value = "%" + CurQueryEntity.FieldByName("BZMC").Value.Trim() + "%";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("DYDJ").Value.Trim()))
|
||||
{
|
||||
sSQL.Add(" and XLXSCLQD_DYDJID = :pDYDJ ");
|
||||
sSQL.ParamByName("pDYDJ").Value = CurQueryEntity.FieldByName("DYDJ").Value.Trim();
|
||||
}
|
||||
if (CurQueryEntity.FieldByName("FJDDZB").Value.ToString().Trim().ToUpper().Equals("TRUE"))
|
||||
{
|
||||
sSQL.Add(@" and not exists (select 1 from XLXSJGBXHDZB
|
||||
where XLXSJGBXHDZB_BJDXLXHID=XLXSCLQD_XLXHID
|
||||
and XLXSCLQD_DYDJID =case when XLXSJGBXHDZB_DZHDYDJID <>' ' then XLXSJGBXHDZB_DZHDYDJID
|
||||
when XLXSJGBXHDZB_DYDJID <>' 'then XLXSJGBXHDZB_DYDJID else XLXSCLQD_DYDJID end ) ");
|
||||
}
|
||||
if (CurQueryEntity.FieldByName("JCXFDZBZ").Value.ToString().Trim().ToUpper().Equals("TRUE"))
|
||||
{
|
||||
sSQL.Add(" and isnull(XLBZ_DZSC,'N')<>'Y' ");
|
||||
}
|
||||
sSQL.Add(" ) c");
|
||||
sSQL.ParamByName("pJGBID").Value = PageParam.GetRTrimString("JGBID");
|
||||
sSQL.ParamByName("pMaxXH").Value = MaxXH;
|
||||
sSQL.ParamByName("pYXQS").Value = PageParam.GetRTrimString("YXQS");
|
||||
if (PageParam.GetRTrimString("YXQZ").Equals(""))
|
||||
sSQL.ParamByName("pYXQZ").Value = null;
|
||||
else
|
||||
sSQL.ParamByName("pYXQZ").Value = PageParam.GetRTrimString("YXQZ");
|
||||
sSQL.ParamByName("pWHRID").Value = tSession.UserId;
|
||||
sSQL.ParamByName("pWHR").Value = tSession.UserName;
|
||||
sSQL.ParamByName("pWHSJ").Value = DateTime.Now;
|
||||
sSQL.ParamByName("pJLDW").Value = GetOption("BJU003");
|
||||
dberp.ExecSQL(sSQL);
|
||||
XLBJDUtils.SyncXLXSBJXLGGTHB_ByXLXSJGBMX_Batch(dberp, tSession, PageParam.GetRTrimString("JGBID"));
|
||||
string sBJU003 = GetOption(100860000, "BJU003");
|
||||
XLJGB_CLJGTZList.UpdateCLCB(dberp, sSQL, PageParam.GetRTrimString("JGBID"), iXSWS, PageParam.GetRTrimString("JSBLFS"), tSession.UserId, tSession.UserName, MaxXH, sBJU003);
|
||||
XLJGB_CLJGTZList.DoCPJJ(dberp, PageParam.GetRTrimString("MXBH"), PageParam.GetRTrimString("JGBID"), true, iXSWS, PageParam.GetRTrimString("JSBLFS"), tSession.UserId, tSession.UserName, MaxXH, sBJU003);
|
||||
XLJGB_CLJGTZList.ReCalcWSJG(dberp, sSQL, PageParam.GetRTrimString("JGBID"), PageParam.GetRTrimString("MXBH"), iXSWS, MaxXH);
|
||||
JGBMLInfo.UpdateJGBMXXSXH(dberp, PageParam.GetRTrimString("JGBID"), PageParam.GetRTrimString("MXBH"));
|
||||
dberp.CommitTrans();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ShowMessage(ex.Message);
|
||||
dberp.RollbackTrans();
|
||||
return;
|
||||
}
|
||||
|
||||
ShowMessage("全部导入完成!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
DialogOperationScript dos = new DialogOperationScript(this);
|
||||
dos.CloseSelf();
|
||||
dos.Execute();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 私有函数
|
||||
|
||||
private string GetQuerySql()
|
||||
{
|
||||
string sSQL = "select XLXSCLQD_XLXHID, XLXSCLQD_XLGGID, XLXSCLQD_XLBZID, XLXSCLQD_DYDJID,RTRIM(XLXSCLQD_XLBZID)||'|'||XLBZ_XLBZLXMC as XLBZ from XLXSCLQD ";
|
||||
sSQL += " left join XLBZ on XLBZ_XLBZID=XLXSCLQD_XLBZID ";
|
||||
sSQL += " left join XLXHB on XLXHB_XLXHID = XLXSCLQD_XLXHID ";
|
||||
sSQL += " left join XLXSBJXLGGTHB on XLXSBJXLGGTHB_XLGGID = XLXSCLQD_XLGGID ";
|
||||
sSQL += " where 1=1 and XLXSCLQD_WPID ='ZZZZ' and isnull(XLXHB_TYBZ,'N') <> 'Y'";
|
||||
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("JGCZBID").Value.Trim()))
|
||||
{
|
||||
string []sJGCZBList = CurQueryEntity.FieldByName("JGCZBID").Value.Trim().Split(',');
|
||||
sSQL += " and ( 1<>1 ";
|
||||
for (int i = 0; i < sJGCZBList.Length; i++)
|
||||
{
|
||||
string[] sJGCZB = sJGCZBList[i].Split('|');
|
||||
if (sJGCZB.Length == 2)
|
||||
{
|
||||
sSQL += string.Format(" or (XLXSCLQD_JGCZBID='{0}' and XLXSCLQD_JGCZBBBID='{1}' ) ",sJGCZB[0],sJGCZB[1]);
|
||||
}
|
||||
else if (sJGCZB.Length == 1)
|
||||
{
|
||||
sSQL += string.Format(" or (XLXSCLQD_JGCZBID='{0}' ) ", sJGCZB[0]);
|
||||
}
|
||||
|
||||
}
|
||||
sSQL += " ) ";
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("CPMLID").Value.Trim()))
|
||||
{
|
||||
sSQL += "\r\n and XLXSCLQD_CPMLID = :pCPMLID ";
|
||||
entity.Param.Add("pCPMLID", CurQueryEntity.FieldByName("CPMLID").Value.Trim());
|
||||
}
|
||||
//型号模糊
|
||||
if (!CurQueryEntity.FieldByName("XLXHIDJQPP").Value.ToString().Trim().ToUpper().Equals("TRUE"))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("XLXHID").Value.Trim()))
|
||||
{
|
||||
sSQL += "\r\n and XLXSCLQD_XLXHID like :pXLXHID ";
|
||||
entity.Param.Add("pXLXHID", "%" + CurQueryEntity.FieldByName("XLXHID").Value.Trim() + "%");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("XLXHID").Value.Trim()))
|
||||
{
|
||||
sSQL += "\r\n and XLXSCLQD_XLXHID = :pXLXHID ";
|
||||
entity.Param.Add("pXLXHID", CurQueryEntity.FieldByName("XLXHID").Value.Trim());
|
||||
}
|
||||
}
|
||||
//规格模糊
|
||||
if (!CurQueryEntity.FieldByName("XLGGIDJQPP").Value.ToString().Trim().ToUpper().Equals("TRUE"))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("XLGGID").Value.Trim()))
|
||||
{
|
||||
sSQL += " and XLXSBJXLGGTHB_XLGGIDCH like :pXLGGID ";
|
||||
entity.Param.Add("pXLGGID", "%" + CurQueryEntity.FieldByName("XLGGID").Value.Trim().Replace("*", "×") + "%");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string sXLGGID = CurQueryEntity.FieldByName("XLGGID").Value.Trim();
|
||||
if (!string.IsNullOrEmpty(sXLGGID))
|
||||
{
|
||||
string[] sTemp = sXLGGID.Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (sTemp.Length >= 2)
|
||||
{
|
||||
sSQL += " and " + CMISproDataBase.GetWhereEqual(" XLXSBJXLGGTHB_XLGGIDCH ", sXLGGID.Replace('*', '×'));
|
||||
}
|
||||
else
|
||||
{
|
||||
sSQL += " and XLXSBJXLGGTHB_XLGGIDCH = :pXLGGID ";
|
||||
entity.Param.Add("pXLGGID", CurQueryEntity.FieldByName("XLGGID").Value.Trim().Replace("*", "×"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("ST").Value.Trim()))
|
||||
{
|
||||
sSQL += "\r\n and XLXSCLQD_XLBZID = :pST ";
|
||||
entity.Param.Add("pST", CurQueryEntity.FieldByName("ST").Value.Trim());
|
||||
}
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("BZMC").Value.Trim()))
|
||||
{
|
||||
sSQL += "\r\n and XLBZ_XLBZLXMC like :pBZMC ";
|
||||
entity.Param.Add("pBZMC", "%" + CurQueryEntity.FieldByName("BZMC").Value.Trim() + "%");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(CurQueryEntity.FieldByName("DYDJ").Value.Trim()))
|
||||
{
|
||||
sSQL += "\r\n and XLXSCLQD_DYDJID = :pDYDJ ";
|
||||
entity.Param.Add("pDYDJ", CurQueryEntity.FieldByName("DYDJ").Value.Trim());
|
||||
}
|
||||
if (CurQueryEntity.FieldByName("FJDDZB").Value.ToString().Trim().ToUpper().Equals("TRUE"))
|
||||
{
|
||||
sSQL += "\r\n and not exists ( select 1 from XLXSJGBXHDZB where XLXSJGBXHDZB_BJDXLXHID=XLXSCLQD_XLXHID ";
|
||||
sSQL += " and XLXSCLQD_DYDJID =case when XLXSJGBXHDZB_DZHDYDJID <>' ' then XLXSJGBXHDZB_DZHDYDJID ";
|
||||
sSQL += " when XLXSJGBXHDZB_DYDJID <>' 'then XLXSJGBXHDZB_DYDJID else XLXSCLQD_DYDJID end )";
|
||||
}
|
||||
if (CurQueryEntity.FieldByName("JCXFDZBZ").Value.ToString().Trim().ToUpper().Equals("TRUE"))
|
||||
{
|
||||
sSQL += " and isnull(XLBZ_DZSC,'N')<>'Y' ";
|
||||
}
|
||||
sSQL +=" and not exists (select 1 from XLXSJGBMX where XLXSJGBMX_JGBID=:JGBID and XLXSJGBMX_XLXHID=XLXSCLQD_XLXHID and XLXSJGBMX_XLGGID=XLXSCLQD_XLGGID and XLXSJGBMX_XLBZID=XLXSCLQD_XLBZID and XLXSJGBMX_DYDJID=XLXSCLQD_DYDJID)";
|
||||
entity.Param.Add("JGBID", PageParam.GetRTrimString("JGBID"));
|
||||
sSQL +=" order by XLXSCLQD_XLXHID,XLXSCLQD_XH ";
|
||||
|
||||
return sSQL;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class JGBDRXX
|
||||
{
|
||||
public JGBDRXX()
|
||||
{
|
||||
}
|
||||
|
||||
private string _JGBID;//价格表ID
|
||||
public string JGBID
|
||||
{
|
||||
get { return _JGBID; }
|
||||
set { _JGBID = value; }
|
||||
}
|
||||
|
||||
private string _MXBH;
|
||||
public string MXBH
|
||||
{
|
||||
get { return _MXBH; }
|
||||
set { _MXBH = value; }
|
||||
}
|
||||
|
||||
private string _JSBLFS;
|
||||
public string JSBLFS
|
||||
{
|
||||
get { return _JSBLFS; }
|
||||
set { _JSBLFS = value; }
|
||||
}
|
||||
|
||||
private int _iXSWS = 0;
|
||||
public int iXSWS
|
||||
{
|
||||
get { return _iXSWS; }
|
||||
set { _iXSWS = value; }
|
||||
}
|
||||
|
||||
private string _JGCZBID;
|
||||
public string JGCZBID
|
||||
{
|
||||
get { return _JGCZBID; }
|
||||
set { _JGCZBID = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private string _CPMLID;
|
||||
public string CPMLID
|
||||
{
|
||||
get { return _CPMLID; }
|
||||
set { _CPMLID = value; }
|
||||
}
|
||||
|
||||
private string _XLXHIDJQPP;
|
||||
public string XLXHIDJQPP
|
||||
{
|
||||
get { return _XLXHIDJQPP; }
|
||||
set { _XLXHIDJQPP = value; }
|
||||
}
|
||||
|
||||
private string _XLXHID;
|
||||
public string XLXHID
|
||||
{
|
||||
get { return _XLXHID; }
|
||||
set { _XLXHID = value; }
|
||||
}
|
||||
|
||||
private string _XLGGIDJQPP;
|
||||
public string XLGGIDJQPP
|
||||
{
|
||||
get { return _XLGGIDJQPP; }
|
||||
set { _XLGGIDJQPP = value; }
|
||||
}
|
||||
|
||||
private string _XLGGID;
|
||||
public string XLGGID
|
||||
{
|
||||
get { return _XLGGID; }
|
||||
set { _XLGGID = value; }
|
||||
}
|
||||
|
||||
private string _ST;
|
||||
public string ST
|
||||
{
|
||||
get { return _ST; }
|
||||
set { _ST = value; }
|
||||
}
|
||||
|
||||
private string _DYDJ;
|
||||
public string DYDJ
|
||||
{
|
||||
get { return _DYDJ; }
|
||||
set { _DYDJ = value; }
|
||||
}
|
||||
|
||||
private string _FJDDZB;
|
||||
public string FJDDZB
|
||||
{
|
||||
get { return _FJDDZB; }
|
||||
set { _FJDDZB = value; }
|
||||
}
|
||||
|
||||
private string _JCXFDZBZ;
|
||||
public string JCXFDZBZ
|
||||
{
|
||||
get { return _JCXFDZBZ; }
|
||||
set { _JCXFDZBZ = value; }
|
||||
}
|
||||
|
||||
private string _YXQS;
|
||||
public string YXQS
|
||||
{
|
||||
get { return _YXQS; }
|
||||
set { _YXQS = value; }
|
||||
}
|
||||
|
||||
private string _YXQZ;
|
||||
public string YXQZ
|
||||
{
|
||||
get { return _YXQZ; }
|
||||
set { _YXQZ = value; }
|
||||
}
|
||||
|
||||
private string _BJU003;
|
||||
public string BJU003
|
||||
{
|
||||
get { return _BJU003; }
|
||||
set { _BJU003 = value; }
|
||||
}
|
||||
|
||||
private int _SL;
|
||||
public int SL
|
||||
{
|
||||
get { return _SL; }
|
||||
set { _SL = value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user