/// <summary> /// /// </summary> /// <param name="textWhere"></param> /// <param name="textOrder"></param> /// <param name="pageIndex"></param> /// <param name="pageRow"></param> /// <param name="columns"></param> /// <returns></returns> public DataTable GetLackOfInspectionListByPage(string textWhere, string textOrder, int pageIndex, int pageRow, List <string> dateColumns, out int dataCount) { DataTable supplyPlanData = GetSupplyPlanListByPage(textWhere, textOrder, pageIndex, pageRow, dateColumns, out dataCount); ///增加RDC数量和VMI数量 foreach (var item in dateColumns) { } supplyPlanData.Columns.Add("RDC", typeof(decimal)); supplyPlanData.Columns.Add("VMI", typeof(decimal)); ///获取所有零件号 List <string> partNos = new List <string>(); foreach (DataRow dr in supplyPlanData.Rows) { string partNo = dr["PartNo"].ToString(); if (partNos.Contains(partNo)) { continue; } partNos.Add(partNo); } List <StocksInfo> stocksInfos = new StocksDAL().GetList("[PART_NO] in ('" + string.Join("','", partNos.ToArray()) + "')", string.Empty); List <WarehouseInfo> warehouseInfos = new WarehouseDAL().GetList("[WAREHOUSE_TYPE] in (" + (int)WarehouseTypeConstants.RDC + "," + (int)WarehouseTypeConstants.VMI + ")", string.Empty); foreach (DataRow dr in supplyPlanData.Rows) { string partNo = dr["PartNo"].ToString(); string supplierNum = dr["SupplierNum"].ToString(); string plant = dr["Plant"].ToString(); /// decimal rdcQty = stocksInfos.Where(d => warehouseInfos.Where(w => w.WarehouseType.GetValueOrDefault() == (int)WarehouseTypeConstants.RDC).Select(w => w.Warehouse).Contains(d.WmNo) && d.PartNo == partNo && d.SupplierNum == supplierNum && d.Plant == plant).Sum(d => d.AvailbleStocks.GetValueOrDefault()); /// decimal vmiQty = stocksInfos.Where(d => warehouseInfos.Where(w => w.WarehouseType.GetValueOrDefault() == (int)WarehouseTypeConstants.VMI).Select(w => w.Warehouse).Contains(d.WmNo) && d.PartNo == partNo && d.SupplierNum == supplierNum && d.Plant == plant).Sum(d => d.AvailbleStocks.GetValueOrDefault()); dr["RDC"] = rdcQty; dr["VMI"] = vmiQty; } return(supplyPlanData); }