|
|
@ -5076,14 +5076,14 @@ namespace CK.SCP.Controller |
|
|
|
var _list = p.ToList(); |
|
|
|
decimal _PlanQTY = _list.Sum(t => t.PlanQty); |
|
|
|
var _ls = _list.First(); |
|
|
|
var MaxP = db.TB_MAXPO_DETAIL.Where(t => t.PartCode == _ls.PartCode && t.VendId == _ls.UpdateInfo).Sum(t => t.SurplusQty); |
|
|
|
var MaxP = db.TB_MAXPO_DETAIL.Where(t => t.PartCode == _ls.PartCode && t.VendId == _ls.UpdateInfo && !t.IsDeleted).Sum(t => t.SurplusQty); |
|
|
|
if (_PlanQTY > MaxP) |
|
|
|
{ |
|
|
|
_ret.MessageList.Add(string.Format("物料号{0}大订单总剩余数{1}小于本次要货数{2}", _ls.PartCode, MaxP, _PlanQTY)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
var _MaxpoList = db.TB_MAXPO_DETAIL.Where(t => t.PartCode == _ls.PartCode && t.SurplusQty > 0 && t.VendId == _ls.UpdateInfo).OrderBy(t => t.PoBillNum).ToList(); |
|
|
|
var _MaxpoList = db.TB_MAXPO_DETAIL.Where(t => t.PartCode == _ls.PartCode && t.SurplusQty > 0 && t.VendId == _ls.UpdateInfo && !t.IsDeleted).OrderBy(t => t.PoBillNum).ToList(); |
|
|
|
foreach (var _maxpo in _MaxpoList) |
|
|
|
{ |
|
|
|
if (_maxpo.SurplusQty > _PlanQTY) |
|
|
@ -8067,9 +8067,11 @@ namespace CK.SCP.Controller |
|
|
|
{ |
|
|
|
foreach (var ui in Uid) |
|
|
|
{ |
|
|
|
var maxpodetail = db.V_TB_MAXPO_DETAIL.FirstOrDefault(p => p.UID.ToString() == ui); |
|
|
|
var maxpodetail = db.TB_MAXPO_DETAIL.FirstOrDefault(p => p.UID.ToString() == ui); |
|
|
|
maxpodetail.IsDeleted = true; |
|
|
|
var uni = db.TS_UNI_API.FirstOrDefault(p => p.PartCode == maxpodetail.PartCode && p.BillNum == maxpodetail.PoBillNum); |
|
|
|
uni.State = 1; |
|
|
|
db.TB_MAXPO_DETAIL.AddOrUpdate(maxpodetail); |
|
|
|
db.TS_UNI_API.AddOrUpdate(uni); |
|
|
|
} |
|
|
|
} |
|
|
@ -9300,7 +9302,7 @@ namespace CK.SCP.Controller |
|
|
|
|
|
|
|
foreach (var itm in p_entitys) |
|
|
|
{ |
|
|
|
var _entity = db.TB_MAXPO_DETAIL.Where(p => p.UID == itm.UID).FirstOrDefault(); |
|
|
|
var _entity = db.TB_MAXPO_DETAIL.Where(p => p.UID == itm.UID && !p.IsDeleted).FirstOrDefault(); |
|
|
|
if (itm.OrderQtykg < _entity.OrderQtykg - _entity.AsnQty) |
|
|
|
{ |
|
|
|
_ret.MessageList.Add("零件号" + _entity.PartCode + "剩余可消耗订货量不足!"); |
|
|
@ -9458,7 +9460,7 @@ namespace CK.SCP.Controller |
|
|
|
foreach (var itm in p_entitys) |
|
|
|
{ |
|
|
|
var _entity = db.V_TB_MAXPO_DETAIL.Where(p => p.UID == itm.UID).FirstOrDefault(); |
|
|
|
if (Math.Abs( (itm.ReductionQty * 1000).Value) < _entity.SurplusQty) |
|
|
|
if (Math.Abs( (itm.ReductionQty * 1000).Value) > _entity.SurplusQty) |
|
|
|
{ |
|
|
|
_ret.MessageList.Add("零件号" + _entity.PartCode + "单次削减量不能大于剩余订货量(千克)"); |
|
|
|
} |
|
|
@ -9526,8 +9528,8 @@ namespace CK.SCP.Controller |
|
|
|
maxuni.CreateTime = DateTime.Now; |
|
|
|
maxuni.PutTime = DateTime.Now; |
|
|
|
maxuni.Extend1 = _entity.PartNumber; |
|
|
|
maxuni.PackQty = _entity.OrderQtykg/1000; |
|
|
|
maxuni.Price = _entity.OrderQtydNow; |
|
|
|
maxuni.PackQty = _entity.MinordQty; |
|
|
|
maxuni.Price = _entity.OrderQtykg / 1000; |
|
|
|
maxuni.VendBatch = _entity.ContractMonth;//合同月
|
|
|
|
maxuni.Currency = _entity.Model; |
|
|
|
maxuni.Buyer = _entity.TechStandard; |
|
|
|