|
|
@ -1471,7 +1471,7 @@ namespace CK.SCP.Controller |
|
|
|
{ |
|
|
|
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】已经存在,请更换行号!", p_excel.订单编号, p_excel.行号)); |
|
|
|
} |
|
|
|
var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel.零件号 && p.Site == site && p.VendId == p_excel.供应商编号 && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime).ToList(); |
|
|
|
var checkcount = db.TB_PRICE.Where(p => p.PartCode == p_excel.零件号 && p.Site == site && p.VendId == p_excel.供应商编号 && p.StartTime <= DateTime.Now && DateTime.Now <= p.EndTime && p.Extend3 != "D").ToList(); |
|
|
|
if (checkcount.Count == 0) |
|
|
|
{ |
|
|
|
ErrorList.Add(string.Format("零件名称【{0}】供应编码【{1}】价格表没有维护信息!", p_excel.零件号, p_excel.供应商编号)); |
|
|
@ -2230,7 +2230,7 @@ namespace CK.SCP.Controller |
|
|
|
{ |
|
|
|
ErrorList.Add(string.Format("物料号码{0}的BOM版本号填写错误", p_excel.物料号码)); |
|
|
|
} |
|
|
|
var price = db.TB_NetPrice.Count(p => p.PartCode == p_excel.物料号码 && p.VendId == p_excel.供应商编号 && p.EndTime > DateTime.Now); |
|
|
|
var price = db.TB_NetPrice.Count(p => p.PartCode == p_excel.物料号码 && p.VendId == p_excel.供应商编号 && p.EndTime > DateTime.Now && p.StartTime <DateTime.Now && p.Extend3 != "D"); |
|
|
|
if (price == 0) |
|
|
|
{ |
|
|
|
ErrorList.Add(string.Format("物料号码{0}不存在净价", p_excel.物料号码)); |
|
|
@ -2367,7 +2367,7 @@ namespace CK.SCP.Controller |
|
|
|
{ |
|
|
|
ErrorList.Add(string.Format("物料号码{0}的BOM版本号填写错误", p_excel.物料号码)); |
|
|
|
} |
|
|
|
var price = db.TB_NetPrice.Count(p => p.PartCode == p_excel.物料号码 && p.VendId == p_excel.供应商编号 && p.EndTime > DateTime.Now); |
|
|
|
var price = db.TB_NetPrice.Count(p => p.PartCode == p_excel.物料号码 && p.VendId == p_excel.供应商编号 && p.EndTime > DateTime.Now && p.StartTime < DateTime.Now && p.Extend3 != "D"); |
|
|
|
if (price == 0) |
|
|
|
{ |
|
|
|
ErrorList.Add(string.Format("物料号码{0}不存在净价", p_excel.物料号码)); |
|
|
@ -6808,7 +6808,7 @@ namespace CK.SCP.Controller |
|
|
|
_detail.EndTime = p_PoBillTime; |
|
|
|
_detail.PlanQty = p_Qty; |
|
|
|
_detail.CreateUser = str; |
|
|
|
var _price = db.TB_NetPrice.Count(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId); |
|
|
|
var _price = db.TB_NetPrice.Count(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId && t.Extend3 != "D"); |
|
|
|
if (_price == 0) |
|
|
|
{ |
|
|
|
var _price1 = db.TA_PART.SingleOrDefault(t => t.PartCode == _detail.PartCode.ToUpper()); |
|
|
@ -6816,12 +6816,11 @@ namespace CK.SCP.Controller |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var _price2 = db.TB_NetPrice.Where(t => t.PartCode == _detail.PartCode.ToUpper()&&t.VendId==p_Po.VendId).Select(r => r.EndTime).Max(); |
|
|
|
var _price8 = db.TB_NetPrice.Where(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId).Select(r => r.StartTime).Max(); |
|
|
|
DateTime dateTime = DateTime.Now; |
|
|
|
if (_price2 > dateTime || _price2 == dateTime) |
|
|
|
int count = db.TB_NetPrice.Count(t => t.PartCode == _detail.PartCode.ToUpper() && t.StartTime <dateTime && t.EndTime > dateTime && t.VendId == p_Po.VendId && t.Extend3 != "D"); |
|
|
|
if (count > 0) |
|
|
|
{ |
|
|
|
var _price3 = db.TB_NetPrice.FirstOrDefault(t => t.PartCode == _detail.PartCode.ToUpper() && t.StartTime == _price8 && t.VendId == p_Po.VendId); |
|
|
|
var _price3 = db.TB_NetPrice.Where(t => t.PartCode == _detail.PartCode.ToUpper() && t.StartTime < dateTime && t.EndTime > dateTime && t.VendId == p_Po.VendId && t.Extend3 != "D").OrderByDescending(u=>u.UID).FirstOrDefault(); |
|
|
|
_detail.Price = _price3.Amt; |
|
|
|
} |
|
|
|
else |
|
|
@ -6859,7 +6858,7 @@ namespace CK.SCP.Controller |
|
|
|
_detail.EndTime = p_PoBillTime; |
|
|
|
_detail.PlanQty = p_Qty; |
|
|
|
_detail.CreateUser = str; |
|
|
|
var _price = db.TB_NetPrice.Count(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId); |
|
|
|
var _price = db.TB_NetPrice.Count(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId && t.Extend3!="D"); |
|
|
|
if (_price == 0) |
|
|
|
{ |
|
|
|
var _price1 = db.TA_PART.SingleOrDefault(t => t.PartCode == _detail.PartCode.ToUpper()); |
|
|
@ -6867,12 +6866,12 @@ namespace CK.SCP.Controller |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var _price2 = db.TB_NetPrice.Where(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId).Select(r => r.EndTime).Max(); |
|
|
|
var _price8 = db.TB_NetPrice.Where(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId).Select(r => r.StartTime).Max(); |
|
|
|
|
|
|
|
DateTime dateTime = DateTime.Now; |
|
|
|
if (_price2 > dateTime || _price2 == dateTime) |
|
|
|
int count = db.TB_NetPrice.Count(t => t.PartCode == _detail.PartCode.ToUpper() && t.StartTime < dateTime && t.EndTime > dateTime && t.Extend3 != "D" && t.VendId == p_Po.VendId); |
|
|
|
if (count > 0) |
|
|
|
{ |
|
|
|
var _price3 = db.TB_NetPrice.FirstOrDefault(t => t.PartCode == _detail.PartCode.ToUpper() && t.StartTime == _price8 && t.VendId == p_Po.VendId); |
|
|
|
var _price3 = db.TB_NetPrice.Where(t => t.PartCode == _detail.PartCode.ToUpper() && t.StartTime < dateTime && t.EndTime > dateTime && t.Extend3 != "D" && t.VendId == p_Po.VendId).OrderByDescending(u=>u.UID).FirstOrDefault(); |
|
|
|
_detail.Price = _price3.Amt; |
|
|
|
} |
|
|
|
else |
|
|
@ -7200,7 +7199,7 @@ namespace CK.SCP.Controller |
|
|
|
_detail.EndTime = p_PoBillTime; |
|
|
|
_detail.PlanQty = p_Qty; |
|
|
|
_detail.CreateUser = str; |
|
|
|
var _price = db.TB_PRICE.Count(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId); |
|
|
|
var _price = db.TB_PRICE.Count(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId && t.Extend3 != "D"); |
|
|
|
if (_price == 0) |
|
|
|
{ |
|
|
|
var _price1 = db.TA_PART.SingleOrDefault(t => t.PartCode == _detail.PartCode.ToUpper()); |
|
|
@ -7208,12 +7207,10 @@ namespace CK.SCP.Controller |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var _price2 = db.TB_PRICE.Where(t => t.PartCode == _detail.PartCode.ToUpper()&&t.VendId==p_Po.VendId).Select(r => r.EndTime).Max(); |
|
|
|
var _price8 = db.TB_PRICE.Where(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId).Select(r => r.StartTime).Max(); |
|
|
|
DateTime dateTime = DateTime.Now; |
|
|
|
if(_price2> dateTime|| _price2 ==dateTime) |
|
|
|
int count1 = db.TB_PRICE.Count(t => t.PartCode == _detail.PartCode.ToUpper() && t.EndTime > DateTime.Now && t.StartTime < DateTime.Now && t.VendId == p_Po.VendId && t.Extend3 != "D"); |
|
|
|
if (count1 != 0) |
|
|
|
{ |
|
|
|
var _price3 = db.TB_PRICE.Where(t => t.PartCode == _detail.PartCode.ToUpper() && t.EndTime == _price2 && t.VendId == p_Po.VendId).OrderByDescending(o => o.UID).FirstOrDefault(); //获取最新采购的价格
|
|
|
|
var _price3 = db.TB_PRICE.Where(t => t.PartCode == _detail.PartCode.ToUpper() && t.EndTime > DateTime.Now && t.StartTime < DateTime.Now && t.VendId == p_Po.VendId && t.Extend3 != "D").OrderByDescending(o => o.UID).FirstOrDefault(); //获取最新采购的价格
|
|
|
|
_detail.Price = _price3.Amt; |
|
|
|
} |
|
|
|
else |
|
|
@ -7248,7 +7245,7 @@ namespace CK.SCP.Controller |
|
|
|
_detail.EndTime = p_PoBillTime; |
|
|
|
_detail.PlanQty = p_Qty; |
|
|
|
_detail.CreateUser = str; |
|
|
|
var _price = db.TB_PRICE.Count(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId); |
|
|
|
var _price = db.TB_PRICE.Count(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId && t.Extend3!="D"); |
|
|
|
if (_price == 0) |
|
|
|
{ |
|
|
|
var _price1 = db.TA_PART.SingleOrDefault(t => t.PartCode == _detail.PartCode.ToUpper()); |
|
|
@ -7256,12 +7253,12 @@ namespace CK.SCP.Controller |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var _price2 = db.TB_PRICE.Where(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId).Select(r => r.EndTime).Max(); |
|
|
|
var _price8 = db.TB_PRICE.Where(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId).Select(r => r.StartTime).Max(); |
|
|
|
var _price2 = db.TB_PRICE.Where(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId && t.Extend3 != "D").Select(r => r.EndTime).Max(); |
|
|
|
var _price8 = db.TB_PRICE.Where(t => t.PartCode == _detail.PartCode.ToUpper() && t.VendId == p_Po.VendId && t.Extend3 != "D").Select(r => r.StartTime).Max(); |
|
|
|
DateTime dateTime = DateTime.Now; |
|
|
|
if (_price2 > dateTime || _price2 == dateTime) |
|
|
|
{ |
|
|
|
var _price3 = db.TB_PRICE.FirstOrDefault(t => t.PartCode == _detail.PartCode.ToUpper() && t.EndTime == _price2 && t.VendId == p_Po.VendId); |
|
|
|
var _price3 = db.TB_PRICE.FirstOrDefault(t => t.PartCode == _detail.PartCode.ToUpper() && t.EndTime == _price2 && t.VendId == p_Po.VendId && t.Extend3 != "D"); |
|
|
|
_detail.Price = _price3.Amt; |
|
|
|
} |
|
|
|
else |
|
|
|