|
@@ -83,21 +83,18 @@ namespace Business.ResourceExamineManagement
|
|
|
|
|
|
|
|
var ic_Plan = ic_PlanList.Where(x => x.mysql_id == icitem_id).FirstOrDefault();
|
|
var ic_Plan = ic_PlanList.Where(x => x.mysql_id == icitem_id).FirstOrDefault();
|
|
|
//查询出对应物料采购订单明细 --数据未被停用 && 评审通过后
|
|
//查询出对应物料采购订单明细 --数据未被停用 && 评审通过后
|
|
|
- var poDetailList = mo_Srm_Po_Lists.Where(x => x.icitem_id == icitem_id);
|
|
|
|
|
|
|
+ List<mo_srm_po_list> poDetailList = new List<mo_srm_po_list>();
|
|
|
if (supplier_id != null)
|
|
if (supplier_id != null)
|
|
|
{
|
|
{
|
|
|
- poDetailList = poDetailList.Where(x => x.pr_purchase_id == supplier_id);
|
|
|
|
|
|
|
+ poDetailList = mo_Srm_Po_Lists.Where(x => x.icitem_id == icitem_id && x.pr_purchase_id == supplier_id && x.rarrdate.GetValueOrDefault() < DeliverDate).ToList();
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ poDetailList = mo_Srm_Po_Lists.Where(x => x.icitem_id == icitem_id && x.rarrdate.GetValueOrDefault() < DeliverDate).ToList();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- //采购订单占用数据
|
|
|
|
|
- var poOccupys = srm_Po_Occupies.Where(x => poDetailList.Select(p => p.mysql_id).ToList().Contains(x.polist_id));
|
|
|
|
|
-
|
|
|
|
|
- DateTime toTime = DateTime.Now.Date;
|
|
|
|
|
-
|
|
|
|
|
//先查询出满足日期,并且数量可满足占用的数据
|
|
//先查询出满足日期,并且数量可满足占用的数据
|
|
|
//var poDetails = poDetailList.Where(x => x.rarrdate.GetValueOrDefault() < DeliverDate && x.qty - x.rqty - x.esqty -
|
|
//var poDetails = poDetailList.Where(x => x.rarrdate.GetValueOrDefault() < DeliverDate && x.qty - x.rqty - x.esqty -
|
|
|
//poOccupys.Where(p => p.polist_id == x.mysql_id)?.Sum(m => m.qty) > Quantity).OrderByDescending(x => x.rarrdate).ToList();
|
|
//poOccupys.Where(p => p.polist_id == x.mysql_id)?.Sum(m => m.qty) > Quantity).OrderByDescending(x => x.rarrdate).ToList();
|
|
|
- List<mo_srm_po_list> poDetails = new List<mo_srm_po_list>();
|
|
|
|
|
//日期满足
|
|
//日期满足
|
|
|
/*var backPodtls = poDetailList.Where(x => x.rarrdate.GetValueOrDefault() < DeliverDate).ToList();
|
|
/*var backPodtls = poDetailList.Where(x => x.rarrdate.GetValueOrDefault() < DeliverDate).ToList();
|
|
|
var occpolist = new List<mo_srm_po_occupy>();
|
|
var occpolist = new List<mo_srm_po_occupy>();
|
|
@@ -114,20 +111,11 @@ namespace Business.ResourceExamineManagement
|
|
|
poDetails.Add(pdtl);
|
|
poDetails.Add(pdtl);
|
|
|
}
|
|
}
|
|
|
}*/
|
|
}*/
|
|
|
- //未满足则查询出满足日期的订单
|
|
|
|
|
- if (poDetails.Count == 0)
|
|
|
|
|
- {
|
|
|
|
|
- poDetails = poDetailList.Where(x => x.rarrdate.GetValueOrDefault() < DeliverDate).OrderByDescending(x => x.rarrdate).ToList();
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- poDetails = poDetails.OrderByDescending(x => x.rarrdate).ToList();
|
|
|
|
|
- }
|
|
|
|
|
var QuantityNumber = 0.00m;
|
|
var QuantityNumber = 0.00m;
|
|
|
List<mo_srm_po_occupy> poOccupy = new List<mo_srm_po_occupy>();
|
|
List<mo_srm_po_occupy> poOccupy = new List<mo_srm_po_occupy>();
|
|
|
- foreach (var item in poDetails)
|
|
|
|
|
|
|
+ foreach (var item in poDetailList)
|
|
|
{
|
|
{
|
|
|
- poOccupy = poOccupys.Where(x => x.polist_id == item.mysql_id).ToList();
|
|
|
|
|
|
|
+ poOccupy = srm_Po_Occupies.Where(x => x.polist_id == item.mysql_id).ToList();
|
|
|
decimal? Qtys = poOccupy.Count > 0 ? poOccupy.Sum(x => x.qty.GetValueOrDefault()) : 0.00m;
|
|
decimal? Qtys = poOccupy.Count > 0 ? poOccupy.Sum(x => x.qty.GetValueOrDefault()) : 0.00m;
|
|
|
//剩余可用数量
|
|
//剩余可用数量
|
|
|
var PlanQty = item.qty.GetValueOrDefault() - item.rqty.GetValueOrDefault() - item.esqty.GetValueOrDefault() - Qtys;
|
|
var PlanQty = item.qty.GetValueOrDefault() - item.rqty.GetValueOrDefault() - item.esqty.GetValueOrDefault() - Qtys;
|