|
|
@ -61,14 +61,7 @@ namespace ICSSoft.ERPWMS.SQL |
|
|
|
{ |
|
|
|
throw new Exception("币种为空!"); |
|
|
|
} |
|
|
|
if (entity.dEnableDate == null) |
|
|
|
{ |
|
|
|
throw new Exception("生效日期为空!"); |
|
|
|
} |
|
|
|
if (entity.dDisableDate == null) |
|
|
|
{ |
|
|
|
throw new Exception("失效日期为空!"); |
|
|
|
} |
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(entity.WorkPoint)) |
|
|
|
{ |
|
|
|
throw new Exception("表头站点为空!"); |
|
|
@ -106,16 +99,12 @@ namespace ICSSoft.ERPWMS.SQL |
|
|
|
if (listDownCheck.Count > 0) |
|
|
|
{ |
|
|
|
throw new Exception("表体数量下限为空"); |
|
|
|
//sb.Append("表体数量下限为空,表头供应商编码为:" + entity.cVenCode + "!!!");
|
|
|
|
//continue;
|
|
|
|
} |
|
|
|
|
|
|
|
List<float?> listDown = entity.list.Select(x => x.iLowerLimit).Distinct().ToList(); |
|
|
|
if (listDown.Count != entity.list.Count) |
|
|
|
{ |
|
|
|
throw new Exception("表体数量下限存在重复"); |
|
|
|
//sb.Append("表体数量下限存在重复,表头供应商编码为:" + entity.cVenCode + "!!!");
|
|
|
|
//continue;
|
|
|
|
} |
|
|
|
|
|
|
|
foreach (CreateVendorInventoryPriceDetailEntity detail in entity.list) |
|
|
@ -165,13 +154,21 @@ namespace ICSSoft.ERPWMS.SQL |
|
|
|
{ |
|
|
|
throw new Exception("表体站点为空"); |
|
|
|
} |
|
|
|
if (item.dEnableDate == null) |
|
|
|
{ |
|
|
|
throw new Exception("表体生效日期为空!"); |
|
|
|
} |
|
|
|
if (item.dDisableDate == null) |
|
|
|
{ |
|
|
|
throw new Exception("表体失效日期为空!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
string UpdateSQL = ""; |
|
|
|
//将上个版本全部失效
|
|
|
|
string sqlLastCheck = @"Select Autoid,dEnableDate,dDisableDate from {0}.dbo.Ven_Inv_Price Where cVenCode ='{1}' and cInvCode ='{2}'
|
|
|
|
and iSupplyType ='{3}' and (dDisableDate>='{4}' or dDisableDate is null)";//检查是否存在交叉失效日期
|
|
|
|
sqlLastCheck = string.Format(sqlLastCheck, WorkPoint, entity.cVenCode, entity.cInvCode, iSupplyType, entity.dEnableDate); |
|
|
|
and iSupplyType ='{3}' and (dDisableDate>='{4}' or dDisableDate is null)";
|
|
|
|
sqlLastCheck = string.Format(sqlLastCheck, WorkPoint, entity.cVenCode, entity.cInvCode, iSupplyType, entity.list[0].dEnableDate); |
|
|
|
|
|
|
|
Log.WriteLogFile(sqlLastCheck, "创建价格表SQL日志"); |
|
|
|
|
|
|
@ -180,18 +177,9 @@ namespace ICSSoft.ERPWMS.SQL |
|
|
|
{ |
|
|
|
//将上个版本的失效日期改为当前生效日期的前一天
|
|
|
|
foreach (DataRow dr in dtNew.Rows) |
|
|
|
{ |
|
|
|
if (entity.dEnableDate <= Convert.ToDateTime(dr["dEnableDate"])) |
|
|
|
{ |
|
|
|
UpdateSQL += " Update {0}.dbo.Ven_Inv_Price Set dDisableDate ='{1}',dEnableDate ='{1}' Where Autoid ='{2}';"; |
|
|
|
UpdateSQL = string.Format(UpdateSQL, WorkPoint, Convert.ToDateTime(entity.dEnableDate).AddDays(-1), dr["Autoid"].ToString()); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
UpdateSQL += " Update {0}.dbo.Ven_Inv_Price Set dDisableDate ='{1}' Where Autoid ='{2}';"; |
|
|
|
UpdateSQL = string.Format(UpdateSQL, WorkPoint, Convert.ToDateTime(entity.dEnableDate).AddDays(-1), dr["Autoid"].ToString()); |
|
|
|
} |
|
|
|
|
|
|
|
UpdateSQL = string.Format(UpdateSQL, WorkPoint, Convert.ToDateTime(entity.list[0].dEnableDate).AddDays(-1), dr["Autoid"].ToString()); |
|
|
|
} |
|
|
|
} |
|
|
|
foreach (CreateVendorInventoryPriceDetailEntity detail in entity.list) |
|
|
@ -201,14 +189,14 @@ namespace ICSSoft.ERPWMS.SQL |
|
|
|
UpdateSQL += @" Insert into {0}.dbo.Ven_Inv_Price(cVenCode,cInvCode,btaxcost,iSupplyType,cExch_Name,dEnableDate,dDisableDate,iLowerLimit,
|
|
|
|
iUpperLimit,iUnitPrice,iTaxRate,iTaxUnitPrice,bPromotion) Values ('{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}',null,'{9}','{10}','{11}',0);";
|
|
|
|
UpdateSQL = string.Format(UpdateSQL, WorkPoint, entity.cVenCode, entity.cInvCode, entity.bTaxCost, iSupplyType, entity.cExch_Name, |
|
|
|
entity.dEnableDate, entity.dDisableDate, detail.iLowerLimit, detail.iUnitPrice, detail.iTaxRate, detail.iTaxUnitPrice); |
|
|
|
detail.dEnableDate, detail.dDisableDate, detail.iLowerLimit, detail.iUnitPrice, detail.iTaxRate, detail.iTaxUnitPrice); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
UpdateSQL += @" Insert into {0}.dbo.Ven_Inv_Price(cVenCode,cInvCode,btaxcost,iSupplyType,cExch_Name,dEnableDate,dDisableDate,iLowerLimit,
|
|
|
|
iUpperLimit,iUnitPrice,iTaxRate,iTaxUnitPrice,bPromotion) Values ('{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}',0);";
|
|
|
|
UpdateSQL = string.Format(UpdateSQL, WorkPoint, entity.cVenCode, entity.cInvCode, entity.bTaxCost, iSupplyType, entity.cExch_Name, |
|
|
|
entity.dEnableDate, entity.dDisableDate, detail.iLowerLimit, detail.iUpperLimit, detail.iUnitPrice, detail.iTaxRate, detail.iTaxUnitPrice); |
|
|
|
detail.dEnableDate, detail.dDisableDate, detail.iLowerLimit, detail.iUpperLimit, detail.iUnitPrice, detail.iTaxRate, detail.iTaxUnitPrice); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|