|
|
@@ -42,6 +42,14 @@ namespace Business.ResourceExamineManagement
|
|
|
/// 雪花算法
|
|
|
/// </summary>
|
|
|
SnowFlake snowFlake = new SnowFlake();
|
|
|
+ /// <summary>
|
|
|
+ /// 采购明细
|
|
|
+ /// </summary>
|
|
|
+ public List<mo_srm_po_list> mo_Srm_Po_Lists = new List<mo_srm_po_list>();
|
|
|
+ /// <summary>
|
|
|
+ /// 采购占用
|
|
|
+ /// </summary>
|
|
|
+ public List<mo_srm_po_occupy> srm_Po_Occupies = new List<mo_srm_po_occupy>();
|
|
|
|
|
|
#endregion
|
|
|
#region 构造函数
|
|
|
@@ -66,7 +74,7 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <summary>
|
|
|
/// 检查在途订单
|
|
|
/// </summary>
|
|
|
- public List<mo_srm_po_occupy> CheckPurchaseOrder(crm_seorderentry seorderentry, long icitem_id, decimal Quantity, DateTime DeliverDate, ic_plan ic_Plan, long bang_id)
|
|
|
+ public List<mo_srm_po_occupy> CheckPurchaseOrder(crm_seorderentry seorderentry, long icitem_id, decimal Quantity, DateTime DeliverDate, List<mo_ic_plan> ic_PlanList, long bang_id)
|
|
|
{
|
|
|
if (seorderentry == null)
|
|
|
{
|
|
|
@@ -74,10 +82,11 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
List<mo_srm_po_occupy> occupyList = new List<mo_srm_po_occupy>();
|
|
|
|
|
|
+ var ic_Plan = ic_PlanList.Where(x => x.icitem_id == icitem_id).FirstOrDefault();
|
|
|
//查询出对应物料采购订单明细 --数据未被停用 && 评审通过后
|
|
|
- var poDetailList = _mo_srm_po_list.GetManyByCondition(x => x.icitem_id == icitem_id && x.state == 1 && x.rstate == 1).Result;
|
|
|
+ var poDetailList = mo_Srm_Po_Lists.Where(x => x.icitem_id == icitem_id);
|
|
|
//采购订单占用数据
|
|
|
- var poOccupys = _mo_srm_po_occupy.GetManyByCondition(x => poDetailList.Select(p => p.id).ToList().Contains(x.polist_id.GetValueOrDefault())).Result;
|
|
|
+ var poOccupys = srm_Po_Occupies.Where(x => poDetailList.Select(p => p.id).ToList().Contains(x.polist_id.GetValueOrDefault()));
|
|
|
//先查询出满足日期,并且数量可满足占用的数据
|
|
|
var poDetails = poDetailList.Where(x => x.rarrdate.GetValueOrDefault().AddDays(-(int)ic_Plan.self_inspection_date.GetValueOrDefault()) < DeliverDate && x.qty - x.rqty - x.esqty -
|
|
|
poOccupys.Where(p => p.polist_id.GetValueOrDefault() == x.mysql_id)?.Sum(m => m.qty) > Quantity).OrderByDescending(x => x.rarrdate).ToList();
|