提交所有文件

This commit is contained in:
2026-09-19 14:12:58 +08:00
parent 20e88479b1
commit 7b922290bb
62 changed files with 11832 additions and 131 deletions
+245 -5
View File
@@ -866,7 +866,7 @@ namespace GThinking.N_XLXSBJ
{
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
TSQL sql = new TSQL(dberp);
sql.Add("select XLXSBJDYZZ_YZZ,XLXSBJDYZZ_YZID,XLXSTZYZ_MRTJFW,XLXSTZYZ_JJFS from XLXSBJDYZZ,XLXSTZYZ");
sql.Add("select XLXSBJDYZZ_YZZ,XLXSBJDYZZ_YZID,XLXSTZYZ_MRTJFW,XLXSTZYZ_JJFS,XLXSTZYZ_YZMC from XLXSBJDYZZ,XLXSTZYZ");
sql.Add(" where XLXSTZYZ_JGBID=XLXSBJDYZZ_JGBID and XLXSTZYZ_YZID=XLXSBJDYZZ_YZID and XLXSTZYZ_MXBH='BJD'");
sql.Add(" and exists(select 1 from XLXSBJFLYZ where XLXSBJFLYZ_BJFLID=:pBJFLID and XLXSBJFLYZ_YZID=XLXSTZYZ_YZID)");
sql.Add(" order by XLXSBJDYZZ_YZID");
@@ -877,12 +877,14 @@ namespace GThinking.N_XLXSBJ
double dSL = string.IsNullOrEmpty((tSession.GetOption(100860000, "BJU055"))) ? 0 : (double.Parse((tSession.GetOption(100860000, "BJU055")))) / 100.0; ;
bool IsHSWL = (dSL == 0);
bool IsHS = GetBJDHSBZ(sBJDID);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
//形如(BJ10,2)
if (!dicYZZ0.ContainsKey(ds.Tables[0].Rows[i]["XLXSBJDYZZ_YZID"].ToString().Trim()))
{
double dYZZ = CMISproConvert.StrToFloat(ds.Tables[0].Rows[i]["XLXSBJDYZZ_YZZ"].ToString());
if (ds.Tables[0].Rows[i]["XLXSTZYZ_JJFS"].ToString().Trim() == "JJ")
{
dYZZ *= GetHSBL(sBJDJLDW, sBJU003, sXLXHID, sXLGGID, sXLBZID, sDYDJID);
@@ -891,6 +893,7 @@ namespace GThinking.N_XLXSBJ
dYZZ = dYZZ / NumberUtils.RoundX((1 + dSL), 6);
}
}
string sMRTJFW = "," + ds.Tables[0].Rows[i]["XLXSTZYZ_MRTJFW"].ToString().Trim() + ",";
if (sMRTJFW.Contains(",2,") && !bWGCP)//2|外购产品
{
@@ -2521,6 +2524,69 @@ namespace GThinking.N_XLXSBJ
return dicYZZBZPF;
}
//获取运费因子
public static Dictionary<string, double> GetYFYZZ(string sYFYZID,string sXZQHID, string sXLXHID,double dTJ,double dLJ)
{
string sTcpList = "";
string sLcpList = "";
XLXSBJPZXX pzxx = XLBJDUtils.GetXLXSBJPZXX(100860063);
if (!string.IsNullOrEmpty(pzxx.XLXSBJPZ_TDTGSCLID))
sTcpList = pzxx.XLXSBJPZ_TDTGSCLID;
if (!string.IsNullOrEmpty(pzxx.XLXSBJPZ_LDTGSCLID))
sLcpList = pzxx.XLXSBJPZ_LDTGSCLID;
bool bTCP = false;
bool bLCP = false;
if (!string.IsNullOrEmpty(pzxx.XLXSBJPZ_TDTGSCLID) && CMISproDataBase.ExistsRecord("DBERP", "select 1 from XLXHB where 1=1 XLXHB_XLXHID='" + sXLXHID + "' and " + CMISproDataBase.GetWhereEqual("XLXHB_DTCLID", sTcpList)))
bTCP = true;
if (!string.IsNullOrEmpty(pzxx.XLXSBJPZ_LDTGSCLID) && CMISproDataBase.ExistsRecord("DBERP", "select 1 from XLXHB where 1=1 XLXHB_XLXHID='" + sXLXHID + "' and " + CMISproDataBase.GetWhereEqual("XLXHB_DTCLID", sLcpList)))
bLCP = true;
Dictionary<string, double> dicYZZBZPF = new Dictionary<string, double>();
dicYZZBZPF.Add(sYFYZID, 0);
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
TSQL sql = new TSQL(dberp);
if (bTCP)
{
sql.Clear();
sql.Add(@" select XLXSBJYFJZQJ_YFJZQH
from XLXSBJYFJZQJ
where XLXSBJYFJZQJ_YFJZQJMC like '%铜%' and XLXSBJYFJZQJ_YFJZXX<=:pTJ and XLXSBJYFJZQJ_YFJZSX>:pTJ ");
sql.ParamByName("pTJ").Value = dTJ*1000;
}
if (bLCP)
{
sql.Clear();
sql.Add(@" select XLXSBJYFJZQJ_YFJZQH
from XLXSBJYFJZQJ
where XLXSBJYFJZQJ_YFJZQJMC like '%铝%' and XLXSBJYFJZQJ_YFJZXX<=:pTJ and XLXSBJYFJZQJ_YFJZSX>:pTJ ");
sql.ParamByName("pTJ").Value = dLJ * 1000;
}
DataSet dsQH = dberp.OpenDataSet(sql);
if (dsQH.Tables[0].Rows.Count > 0)
{
string sQH = dsQH.Tables[0].Rows[0][0].ToString().Trim();
sql.Clear();
sql.Add(" select XLXSBJDQYFB_YSFL from XLXSBJDQYFB where XLXSBJDQYFB_XZQHID=:XLXSBJDQYFB_XZQHID and XLXSBJDQYFB_YFJZQH=:XLXSBJDQYFB_YFJZQH ");
sql.ParamByName("XLXSBJDQYFB_XZQHID").Value = sXZQHID;
sql.ParamByName("XLXSBJDQYFB_YFJZQH").Value = sQH;
DataSet ds = dberp.OpenDataSet(sql);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
double dYZZ = CMISproConvert.StrToFloat(ds.Tables[0].Rows[i]["XLXSBJDQYFB_YSFL"].ToString());
dicYZZBZPF[sYFYZID] = dYZZ;
}
}
return dicYZZBZPF;
}
//获取报价因子的最小值
public static string GetMinYZZ(string sYZID, double dHSBL)
{
@@ -2984,9 +3050,9 @@ namespace GThinking.N_XLXSBJ
TSQL sql = new TSQL(dberp);
sql.Add("select XLXSJGBYZZC_YZZ,XLXSJGBYZZC_YZID ");
sql.Add(" from XLXSJGBYZZC,XLXSTZYZ ");
sql.Add(" where XLXSTZYZ_JGBID=XLXSJGBYZZC_JGBID and XLXSTZYZ_YZID=XLXSJGBYZZC_YZID and XLXSTZYZ_MXBH='JZJ'");
sql.Add(" where XLXSTZYZ_JGBID=XLXSJGBYZZC_JGBID and XLXSTZYZ_YZID=XLXSJGBYZZC_YZID and XLXSTZYZ_MXBH='JZJ' and XLXSJGBYZZC_ZXJM=:pZXJM ");
sql.Add(" and exists(select 1 from XLXSJGBYZ where XLXSJGBYZ_JGBID =:pJGEJGBID and XLXSJGBYZ_YZID = XLXSTZYZ_YZID)");
sql.Add(" and exists(select 1 from XLXSBJCPYS where XLXSBJCPYS_XLJBXHID=:pXLXHID and XLXSBJCPYS_DYDJID=:pDYDJID and XLXSBJCPYS_XLYSID=:pZXJM and XLXSBJCPYS_XXJGID =XLXSJGBYZZC_CPTX )");
sql.Add(" and exists(select 1 from XLXSBJCPYS where XLXSBJCPYS_XLJBXHID=:pXLXHID and XLXSBJCPYS_DYDJID=:pDYDJID and XLXSBJCPYS_XXJGID =XLXSJGBYZZC_CPTX )");
sql.ParamByName("pJGEJGBID").Value = sJGEJGBID;
sql.ParamByName("pXLXHID").Value = sXLXHID;
sql.ParamByName("pDYDJID").Value = sDYDJID;
@@ -9031,12 +9097,12 @@ namespace GThinking.N_XLXSBJ
sSQL.Add(" and isnull(XLJGCZBLM_CLQDL,' ')<>' '");
if (CLLX == "QTCLSH")
{
sSQL.Add(" and XLJGCZBLM_XLCLZLID <> 'DTCL' and XLJGCZBLM_CZBLMMC not like '%Í­%' and XLJGCZBLM_CZBLMMC not like '%ÂÁ%' ");
sSQL.Add(" and isnull(XLJGCZBLM_XLCLZLID,' ') <> 'DTCL' and XLJGCZBLM_CZBLMMC not like '%铜%' and XLJGCZBLM_CZBLMMC not like '%铝%' ");
}
if (CLLX == "DTCLSH")
{
sSQL.Add(" and XLJGCZBLM_XLCLZLID = 'DTCL' and (XLJGCZBLM_CZBLMMC like '%Í­%' or XLJGCZBLM_CZBLMMC like '%ÂÁ%') ");
sSQL.Add(" and isnull(XLJGCZBLM_XLCLZLID,' ') = 'DTCL' and (XLJGCZBLM_CZBLMMC like '%铜%' or XLJGCZBLM_CZBLMMC like '%铝%') ");
}
sSQL.Add(" order by XLJGCZBLM_CLQDL");
@@ -13136,6 +13202,7 @@ namespace GThinking.N_XLXSBJ
{
string sBZPFYZID = XLBJDUtils.GetBJFLSYBZPFYZID(sBJFLID);
string sCPWJPFYZID = XLBJDUtils.GetBJFLSYCPWJPFYZID(sBJFLID);
string sYFYZID = XLBJDUtils.GetBJFLSYYFYZID(sBJFLID);
string chr = "";
for (int i = 0; i < dsBJDYZ.Tables[0].Rows.Count; i++)
{
@@ -13157,6 +13224,11 @@ namespace GThinking.N_XLXSBJ
if (sCPWJPFYZID.Split('|')[0].Trim().Equals(dsBJDYZ.Tables[0].Rows[i]["XLXSBJFLYZ_YZID"].ToString().Trim()))
continue;
}
else if (!sYFYZID.Equals(""))
{
if (sYFYZID.Split('|')[0].Trim().Equals(dsBJDYZ.Tables[0].Rows[i]["XLXSBJFLYZ_YZID"].ToString().Trim()))
continue;
}
dicTJYZList["sTJYSList_"] = dicTJYZList["sTJYSList_"] + "," + dsBJDYZ.Tables[0].Rows[i]["XLXSBJFLYZ_YZID"].ToString().Trim();
}
else
@@ -13171,6 +13243,11 @@ namespace GThinking.N_XLXSBJ
if (sCPWJPFYZID.Split('|')[0].Trim().Equals(dsBJDYZ.Tables[0].Rows[i]["XLXSBJFLYZ_YZID"].ToString().Trim()))
continue;
}
else if (!sYFYZID.Equals(""))
{
if (sYFYZID.Split('|')[0].Trim().Equals(dsBJDYZ.Tables[0].Rows[i]["XLXSBJFLYZ_YZID"].ToString().Trim()))
continue;
}
dicTJYZList.Add("sTJYSList_", dsBJDYZ.Tables[0].Rows[i]["XLXSBJFLYZ_YZID"].ToString().Trim());
}
break;
@@ -13198,6 +13275,10 @@ namespace GThinking.N_XLXSBJ
{
dicTJYZList.Add("sTJYSListPFCPWJ", sCPWJPFYZID.Split('|')[0]);
}
if (!sYFYZID.Equals(""))
{
dicTJYZList.Add("sTJYSListYF", sYFYZID.Split('|')[0]);
}
}
}
@@ -17851,6 +17932,147 @@ namespace GThinking.N_XLXSBJ
}
#endregion
sErrorNum = "ErrorYF";
//自动插入TJMK=产品外径盘费的调价因子值
#region 调价模块产品外径盘费|型号&规格&电压&标准
if (dicTJYZList.ContainsKey("sTJYSListYF"))
{
string sTcpList = "";
string sLcpList = "";
XLXSBJPZXX pzxx = XLBJDUtils.GetXLXSBJPZXX(100860063);
if (!string.IsNullOrEmpty(pzxx.XLXSBJPZ_TDTGSCLID))
sTcpList = pzxx.XLXSBJPZ_TDTGSCLID;
if (!string.IsNullOrEmpty(pzxx.XLXSBJPZ_LDTGSCLID))
sLcpList = pzxx.XLXSBJPZ_LDTGSCLID;
string sTQH = string.Empty;
string sLQH = string.Empty;
sTJYZ = dicTJYZList["sTJYSListYF"].Trim().Split(new Char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
SQL.Clear();
SQL.Add(@" select XLXSBJYFJZQJ_YFJZQH
from XLXSBJYFJZQJ
where XLXSBJYFJZQJ_YFJZQJMC like '%铜%' and exists(select 1 from XLXSBJD where XLXSBJD_BJDID=:pBJDID and XLXSBJYFJZQJ_YFJZXX<=XLXSBJD_TJ*1000 and XLXSBJYFJZQJ_YFJZSX>XLXSBJD_TJ*1000) ");
SQL.ParamByName("pBJDID").Value = sBJDID;
DataSet dsQH = dberp.OpenDataSet(SQL);
if (dsQH.Tables[0].Rows.Count > 0)
sTQH = dsQH.Tables[0].Rows[0][0].ToString().Trim();
SQL.Clear();
SQL.Add(@" select XLXSBJYFJZQJ_YFJZQH
from XLXSBJYFJZQJ
where XLXSBJYFJZQJ_YFJZQJMC like '%铝%' and exists(select 1 from XLXSBJD where XLXSBJD_BJDID=:pBJDID and XLXSBJYFJZQJ_YFJZXX<=XLXSBJD_LJ*1000 and XLXSBJYFJZQJ_YFJZSX>XLXSBJD_LJ*1000) ");
SQL.ParamByName("pBJDID").Value = sBJDID;
dsQH = dberp.OpenDataSet(SQL);
if (dsQH.Tables[0].Rows.Count > 0)
sLQH = dsQH.Tables[0].Rows[0][0].ToString().Trim();
for (int i = 0; i < sTJYZ.Length; i++)
{
if (!sTJYZ[i].Trim().Equals(""))
{
if (!string.IsNullOrEmpty(sTcpList) && !string.IsNullOrEmpty(sTQH))
{
SQL.Clear();
SQL.Add("merge into XLXSBJDYZZ0 tar ");
SQL.Add("using ( ");
SQL.Add(@" select isnull(XLXSBJDQYFB_YSFL,0) as YZZ,XLXSBJDMX_BJDID as BJDID ,XLXSBJDMX_XH as XH
from XLXSBJDMX
left join XLXSBJD on XLXSBJD_BJDID=XLXSBJDMX_BJDID
left join XLXHB on XLXHB_XLXHID=XLXSBJDMX_XLXHID
left join XLXSBJDQYFB on XLXSBJD_XZQHID=XLXSBJDQYFB_XZQHID and XLXSBJDQYFB_YFJZQH=:XLXSBJDQYFB_YFJZQH
where XLXSBJDMX_BJDID=:pBJDID ");
SQL.Add("and " + CMISproDataBase.GetWhereEqual("XLXHB_DTCLID", sTcpList));
if (!sBJDXHList.Equals(""))
{
SQL.Add("and " + CMISproDataBase.GetWhereEqual("XLXSBJDMX_XH", sBJDXHList));
}
if (minBJDXH != 0)
{
SQL.Add("and XLXSBJDMX_XH > :minBJDXH");
SQL.ParamByName("minBJDXH").Value = minBJDXH;
}
if (VnewID > 0)
{
SQL.Add(" and exists(select 1 from V_BJDXH where V_BJDXH_ID = :pVID and V_BJDXH_BJDID = XLXSBJDMX_BJDID and V_BJDXH_BJDXH = XLXSBJDMX_XH) ");
SQL.ParamByName("pVID").Value = VnewID;
}
if (bYBJ)
SQL.Add(" and XLXSBJDMX_JGBBJ<>0.0");
if (bWG)
SQL.Add(" and XLXSBJDMX_WGCPBZ='Y'");
if (bFWG)
SQL.Add(" and XLXSBJDMX_WGCPBZ<>'Y'");
if (tWHSJCondition != DateTime.MinValue)
{
SQL.Add(" and XLXSBJDMX_WHSJ=:pWHSJ");
SQL.ParamByName("pWHSJ").Value = tWHSJCondition;
}
SQL.Add(") sor ");
SQL.Add("on (tar.XLXSBJDYZZ0_BJDID=sor.BJDID and tar.XLXSBJDYZZ0_XH=sor.XH) ");
SQL.Add("when matched then update set ");
SQL.Add(string.Format("tar.XLXSBJDYZZ0_YZZ{0}=sor.YZZ", sTJYZ[i].Trim().Replace("BJ", "")));
SQL.ParamByName("XLXSBJDQYFB_YFJZQH").Value = sTQH;
SQL.ParamByName("pBJDID").Value = sBJDID;
dberp.ExecSQL(SQL);
}
if (!string.IsNullOrEmpty(sLcpList) && !string.IsNullOrEmpty(sLQH))
{
SQL.Clear();
SQL.Add("merge into XLXSBJDYZZ0 tar ");
SQL.Add("using ( ");
SQL.Add(@" select isnull(XLXSBJDQYFB_YSFL,0) as YZZ,XLXSBJDMX_BJDID as BJDID ,XLXSBJDMX_XH as XH
from XLXSBJDMX
left join XLXSBJD on XLXSBJD_BJDID=XLXSBJDMX_BJDID
left join XLXHB on XLXHB_XLXHID=XLXSBJDMX_XLXHID
left join XLXSBJDQYFB on XLXSBJD_XZQHID=XLXSBJDQYFB_XZQHID and XLXSBJDQYFB_YFJZQH=:XLXSBJDQYFB_YFJZQH
where XLXSBJDMX_BJDID=:pBJDID ");
SQL.Add("and " + CMISproDataBase.GetWhereEqual("XLXHB_DTCLID", sLcpList));
if (!sBJDXHList.Equals(""))
{
SQL.Add("and " + CMISproDataBase.GetWhereEqual("XLXSBJDMX_XH", sBJDXHList));
}
if (minBJDXH != 0)
{
SQL.Add("and XLXSBJDMX_XH > :minBJDXH");
SQL.ParamByName("minBJDXH").Value = minBJDXH;
}
if (VnewID > 0)
{
SQL.Add(" and exists(select 1 from V_BJDXH where V_BJDXH_ID = :pVID and V_BJDXH_BJDID = XLXSBJDMX_BJDID and V_BJDXH_BJDXH = XLXSBJDMX_XH) ");
SQL.ParamByName("pVID").Value = VnewID;
}
if (bYBJ)
SQL.Add(" and XLXSBJDMX_JGBBJ<>0.0");
if (bWG)
SQL.Add(" and XLXSBJDMX_WGCPBZ='Y'");
if (bFWG)
SQL.Add(" and XLXSBJDMX_WGCPBZ<>'Y'");
if (tWHSJCondition != DateTime.MinValue)
{
SQL.Add(" and XLXSBJDMX_WHSJ=:pWHSJ");
SQL.ParamByName("pWHSJ").Value = tWHSJCondition;
}
SQL.Add(") sor ");
SQL.Add("on (tar.XLXSBJDYZZ0_BJDID=sor.BJDID and tar.XLXSBJDYZZ0_XH=sor.XH) ");
SQL.Add("when matched then update set ");
SQL.Add(string.Format("tar.XLXSBJDYZZ0_YZZ{0}=sor.YZZ", sTJYZ[i].Trim().Replace("BJ", "")));
SQL.ParamByName("XLXSBJDQYFB_YFJZQH").Value = sLQH;
SQL.ParamByName("pBJDID").Value = sBJDID;
dberp.ExecSQL(SQL);
}
}
}
}
#endregion
sErrorNum = "ErrorCPWJPF";
//自动插入TJMK=产品外径盘费的调价因子值
#region 调价模块产品外径盘费|型号&规格&电压&标准
@@ -20915,6 +21137,24 @@ namespace GThinking.N_XLXSBJ
return "";
}
public static string GetBJFLSYYFYZID(string sBJFLID)
{
List<TZYZXX> BJFLYZXX_List = new List<TZYZXX>();
List<XLXSBJFLYZXX> bjflYZ = GetBJFLYZXXByBJFLID(sBJFLID);
if (bjflYZ.Count > 0)
{
foreach (XLXSBJFLYZXX sYZ in bjflYZ)
{
TZYZXX yzxx = GetYZXXByYZID(sYZ.XLXSBJFLYZ_YZID);
//100860071|按产品外径报价数量区间调盘费
if (yzxx.XLXSTZYZ_TJMDID.Equals("100860071"))
return yzxx.XLXSTZYZ_YZID.Trim() + "|" + yzxx.XLXSTZYZ_YZMC.Trim();
}
}
return "";
}
#endregion
#region 字典记录因子ID、因子名称