|
|
@@ -95,13 +95,34 @@ namespace Business.ResourceExamineManagement
|
|
|
DateTime toTime = DateTime.Now.Date;
|
|
|
|
|
|
//先查询出满足日期,并且数量可满足占用的数据
|
|
|
- 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();
|
|
|
+ //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();
|
|
|
+ List<mo_srm_po_list> poDetails = new List<mo_srm_po_list>();
|
|
|
+ //日期满足
|
|
|
+ /*var backPodtls = poDetailList.Where(x => x.rarrdate.GetValueOrDefault() < DeliverDate).ToList();
|
|
|
+ var occpolist = new List<mo_srm_po_occupy>();
|
|
|
+ foreach (var pdtl in backPodtls)
|
|
|
+ {
|
|
|
+ occpolist = poOccupys.Where(p => p.polist_id == pdtl.mysql_id).ToList();
|
|
|
+ decimal occqty = 0;
|
|
|
+ if (occpolist.Any())
|
|
|
+ {
|
|
|
+ occqty = occpolist.Sum(m => m.qty.GetValueOrDefault());
|
|
|
+ }
|
|
|
+ if (pdtl.qty - pdtl.rqty - pdtl.esqty - occqty > Quantity)
|
|
|
+ {
|
|
|
+ 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;
|
|
|
foreach (var item in poDetails)
|
|
|
{
|