代码无效引用清理,试压包资料界面看板修改
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using FineUIPro;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using FineUIPro;
|
||||
using Model;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
@@ -19,24 +18,9 @@ namespace BLL
|
||||
/// </summary>
|
||||
public static int Count { get; set; }
|
||||
|
||||
public static IQueryable<PHTGL_ContractTrackProgress> GetPHTGL_ContractTrackProgressByModle( PHTGL_ContractTrackProgress table)
|
||||
public static IQueryable<PHTGL_ContractTrackProgress> GetPHTGL_ContractTrackProgressByModle(PHTGL_ContractTrackProgress table)
|
||||
{
|
||||
var q = from x in Funs.DB.PHTGL_ContractTrackProgress
|
||||
where
|
||||
(string.IsNullOrEmpty(table.ContractTrackProgressId) ||
|
||||
x.ContractTrackProgressId.Contains(table.ContractTrackProgressId)) &&
|
||||
(string.IsNullOrEmpty(table.ContractTrackId) ||
|
||||
x.ContractTrackId.Contains(table.ContractTrackId)) &&
|
||||
(string.IsNullOrEmpty(table.Date) ||
|
||||
x.Date.Contains(table.Date))
|
||||
orderby x.Date
|
||||
select x
|
||||
;
|
||||
return q;
|
||||
}
|
||||
public static PHTGL_ContractTrackProgress GetFirstOrDefaultByModle(PHTGL_ContractTrackProgress table)
|
||||
{
|
||||
var q = (from x in Funs.DB.PHTGL_ContractTrackProgress
|
||||
where
|
||||
(string.IsNullOrEmpty(table.ContractTrackProgressId) ||
|
||||
x.ContractTrackProgressId.Contains(table.ContractTrackProgressId)) &&
|
||||
@@ -45,7 +29,22 @@ namespace BLL
|
||||
(string.IsNullOrEmpty(table.Date) ||
|
||||
x.Date.Contains(table.Date))
|
||||
orderby x.Date
|
||||
select x).FirstOrDefault()
|
||||
select x
|
||||
;
|
||||
return q;
|
||||
}
|
||||
public static PHTGL_ContractTrackProgress GetFirstOrDefaultByModle(PHTGL_ContractTrackProgress table)
|
||||
{
|
||||
var q = (from x in Funs.DB.PHTGL_ContractTrackProgress
|
||||
where
|
||||
(string.IsNullOrEmpty(table.ContractTrackProgressId) ||
|
||||
x.ContractTrackProgressId.Contains(table.ContractTrackProgressId)) &&
|
||||
(string.IsNullOrEmpty(table.ContractTrackId) ||
|
||||
x.ContractTrackId.Contains(table.ContractTrackId)) &&
|
||||
(string.IsNullOrEmpty(table.Date) ||
|
||||
x.Date.Contains(table.Date))
|
||||
orderby x.Date
|
||||
select x).FirstOrDefault()
|
||||
;
|
||||
return q;
|
||||
}
|
||||
@@ -63,18 +62,18 @@ namespace BLL
|
||||
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize);
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
select new
|
||||
{
|
||||
x.ContractTrackProgressId,
|
||||
x.ContractTrackId,
|
||||
x.BCWS_Quantity,
|
||||
x.BCWS_OutputValue,
|
||||
x.BCWS_Percentage,
|
||||
x.ACWP_Quantity,
|
||||
x.ACWP_OutputValue,
|
||||
x.ACWP_Percentage,
|
||||
x.Date
|
||||
};
|
||||
select new
|
||||
{
|
||||
x.ContractTrackProgressId,
|
||||
x.ContractTrackId,
|
||||
x.BCWS_Quantity,
|
||||
x.BCWS_OutputValue,
|
||||
x.BCWS_Percentage,
|
||||
x.ACWP_Quantity,
|
||||
x.ACWP_OutputValue,
|
||||
x.ACWP_Percentage,
|
||||
x.Date
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -84,10 +83,10 @@ namespace BLL
|
||||
return Funs.DB.PHTGL_ContractTrackProgress.FirstOrDefault(x =>
|
||||
x.ContractTrackProgressId == ContractTrackProgressId);
|
||||
}
|
||||
public static PHTGL_ContractTrackProgress GetPHTGL_ContractTrackProgressByTrackIdAndDate(string ContractTrackId,string date)
|
||||
public static PHTGL_ContractTrackProgress GetPHTGL_ContractTrackProgressByTrackIdAndDate(string ContractTrackId, string date)
|
||||
{
|
||||
return Funs.DB.PHTGL_ContractTrackProgress.FirstOrDefault(x =>
|
||||
x.ContractTrackId == ContractTrackId && x.Date==date);
|
||||
x.ContractTrackId == ContractTrackId && x.Date == date);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据合同价格信息主键创建进度日期数据
|
||||
@@ -97,7 +96,7 @@ namespace BLL
|
||||
{
|
||||
var model = PhtglContractTrackService.GetPHTGL_ContractTrackById(ContractTrackId);
|
||||
if (model == null) return;
|
||||
var contractNum=model.ContractNum;
|
||||
var contractNum = model.ContractNum;
|
||||
var contractmode = ContractService.GetContractByContractNum(contractNum);
|
||||
if (contractmode.ContractStartDate != null && contractmode.ContractEndDate != null)
|
||||
{
|
||||
@@ -110,7 +109,7 @@ namespace BLL
|
||||
var querymodel = new Model.PHTGL_ContractTrackProgress
|
||||
{
|
||||
ContractTrackId = ContractTrackId,
|
||||
Date= month.ToString("yyyy-MM")
|
||||
Date = month.ToString("yyyy-MM")
|
||||
};
|
||||
|
||||
if (!GetPHTGL_ContractTrackProgressByModle(querymodel).Any())
|
||||
@@ -130,22 +129,23 @@ namespace BLL
|
||||
/// </summary>
|
||||
/// <param name="contractTrackList"></param>
|
||||
/// <param name="projectid"></param>
|
||||
public static void CreateTemplateByContractList(List<PHTGL_ContractTrack> contractTrackList,string projectid)
|
||||
public static void CreateTemplateByContractList(List<PHTGL_ContractTrack> contractTrackList, string projectid)
|
||||
{
|
||||
var dbcontractTrack=(from x in Funs.DB.PHTGL_ContractTrack where x.ProjectId==projectid select x).ToList();
|
||||
var dbContractTrackProgress=(from x in Funs.DB.PHTGL_ContractTrackProgress
|
||||
join y in Funs.DB.PHTGL_ContractTrack on x.ContractTrackId equals y.Id
|
||||
where y.ProjectId==projectid select x).ToList();
|
||||
var dbcontractTrack = (from x in Funs.DB.PHTGL_ContractTrack where x.ProjectId == projectid select x).ToList();
|
||||
var dbContractTrackProgress = (from x in Funs.DB.PHTGL_ContractTrackProgress
|
||||
join y in Funs.DB.PHTGL_ContractTrack on x.ContractTrackId equals y.Id
|
||||
where y.ProjectId == projectid
|
||||
select x).ToList();
|
||||
|
||||
List<List<PHTGL_ContractTrack>> splitLists = new List<List<PHTGL_ContractTrack>>();
|
||||
if (contractTrackList.Count>10)
|
||||
List<List<PHTGL_ContractTrack>> splitLists = new List<List<PHTGL_ContractTrack>>();
|
||||
if (contractTrackList.Count > 10)
|
||||
{
|
||||
splitLists = Funs.SplitList(contractTrackList, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
splitLists = Funs.SplitList(contractTrackList, 1);
|
||||
}
|
||||
}
|
||||
ConcurrentBag<PHTGL_ContractTrackProgress> contractTrackProgressList = new ConcurrentBag<PHTGL_ContractTrackProgress>();//用于批量新增的数据(无序集合)
|
||||
|
||||
ParallelOptions parallelOptions = new ParallelOptions();
|
||||
@@ -154,10 +154,10 @@ namespace BLL
|
||||
///使用多线程开启并行任务,操作拆分后的list 同时进行数据处理
|
||||
Parallel.ForEach(splitLists, parallelOptions, sublist =>
|
||||
{
|
||||
|
||||
foreach (var item in sublist)
|
||||
|
||||
foreach (var item in sublist)
|
||||
{
|
||||
var model =( from x in dbcontractTrack where x.Id==item.Id select x).FirstOrDefault() ;
|
||||
var model = (from x in dbcontractTrack where x.Id == item.Id select x).FirstOrDefault();
|
||||
if (model == null) return;
|
||||
var contractNum = model.ContractNum;
|
||||
var contractmode = ContractService.GetContractByContractNum(contractNum);
|
||||
@@ -175,13 +175,13 @@ namespace BLL
|
||||
Date = month.ToString("yyyy-MM")
|
||||
};
|
||||
var q = (from x in dbContractTrackProgress
|
||||
where
|
||||
(string.IsNullOrEmpty(querymodel.ContractTrackId) ||
|
||||
x.ContractTrackId.Contains(querymodel.ContractTrackId)) &&
|
||||
(string.IsNullOrEmpty(querymodel.Date) ||
|
||||
x.Date.Contains(querymodel.Date))
|
||||
orderby x.Date
|
||||
select x).ToList()
|
||||
where
|
||||
(string.IsNullOrEmpty(querymodel.ContractTrackId) ||
|
||||
x.ContractTrackId.Contains(querymodel.ContractTrackId)) &&
|
||||
(string.IsNullOrEmpty(querymodel.Date) ||
|
||||
x.Date.Contains(querymodel.Date))
|
||||
orderby x.Date
|
||||
select x).ToList()
|
||||
;
|
||||
if (!q.Any())
|
||||
{
|
||||
@@ -190,14 +190,14 @@ namespace BLL
|
||||
newmodel.ContractTrackId = item.Id;
|
||||
newmodel.Date = month.ToString("yyyy-MM");
|
||||
contractTrackProgressList.Add(newmodel);
|
||||
// AddPHTGL_ContractTrackProgress(newmodel);
|
||||
// AddPHTGL_ContractTrackProgress(newmodel);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // 处理完成后,可以将结果保存到集合或其他地方
|
||||
|
||||
});
|
||||
|
||||
|
||||
AddBulkPHTGL_ContractTrackProgress(contractTrackProgressList.ToList());
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace BLL
|
||||
}
|
||||
|
||||
public static void UpdatePHTGL_ContractTrackProgress(PHTGL_ContractTrackProgress newtable)
|
||||
{
|
||||
{
|
||||
var table = Funs.DB.PHTGL_ContractTrackProgress.FirstOrDefault(x =>
|
||||
x.ContractTrackProgressId == newtable.ContractTrackProgressId);
|
||||
if (table != null)
|
||||
@@ -255,7 +255,7 @@ namespace BLL
|
||||
table.ACWP_Quantity = newtable.ACWP_Quantity;
|
||||
table.ACWP_OutputValue = newtable.ACWP_OutputValue;
|
||||
table.ACWP_Percentage = newtable.ACWP_Percentage;
|
||||
table.Date =newtable.Date;
|
||||
table.Date = newtable.Date;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
@@ -266,19 +266,19 @@ namespace BLL
|
||||
public static void CheckProgressByContractTrackId(string contractTrackId)
|
||||
{
|
||||
var modeContractTrack = PhtglContractTrackService.GetPHTGL_ContractTrackById(contractTrackId);
|
||||
if (modeContractTrack!=null)
|
||||
if (modeContractTrack != null)
|
||||
{
|
||||
var totalCostFixedComprehensiveUnitPrice = modeContractTrack.TotalCostFixedComprehensiveUnitPrice; //全费用综合单价
|
||||
var settledAmount = modeContractTrack.SettledAmount??0;//预算金额
|
||||
var contractWeight= Funs.GetNewDecimalOrZero(modeContractTrack.ContractWeight)==0?0: Funs.GetNewDecimalOrZero(modeContractTrack.ContractWeight)/100;//合同权重
|
||||
var settledAmount = modeContractTrack.SettledAmount ?? 0;//预算金额
|
||||
var contractWeight = Funs.GetNewDecimalOrZero(modeContractTrack.ContractWeight) == 0 ? 0 : Funs.GetNewDecimalOrZero(modeContractTrack.ContractWeight) / 100;//合同权重
|
||||
var quserytable = new Model.PHTGL_ContractTrackProgress();
|
||||
quserytable.ContractTrackId = contractTrackId;
|
||||
var list= GetPHTGL_ContractTrackProgressByModle(quserytable);
|
||||
var list = GetPHTGL_ContractTrackProgressByModle(quserytable);
|
||||
foreach (var item in list)
|
||||
{
|
||||
//产值=计划工程量*全费用综合单价(来源于“费用对比统计”),
|
||||
// 百分比 =(产值 / 预算金额)*合同权重
|
||||
item.ACWP_OutputValue = (item.ACWP_Quantity??0)* totalCostFixedComprehensiveUnitPrice;
|
||||
item.ACWP_OutputValue = (item.ACWP_Quantity ?? 0) * totalCostFixedComprehensiveUnitPrice;
|
||||
if (settledAmount == 0)
|
||||
{
|
||||
item.ACWP_Percentage = 0;
|
||||
@@ -295,7 +295,7 @@ namespace BLL
|
||||
}
|
||||
else
|
||||
{
|
||||
item.BCWS_Percentage = Math.Round(((item.BCWS_OutputValue ?? 0) / settledAmount) * contractWeight * 100, 2) ;
|
||||
item.BCWS_Percentage = Math.Round(((item.BCWS_OutputValue ?? 0) / settledAmount) * contractWeight * 100, 2);
|
||||
}
|
||||
UpdatePHTGL_ContractTrackProgress(item);
|
||||
}
|
||||
@@ -307,13 +307,13 @@ namespace BLL
|
||||
/// <param name="ContractTrackProgressId"></param>
|
||||
/// <param name="date"></param>
|
||||
public static PHTGL_ContractTrackProgress GetSumProgress(string contractTrackProgressId)
|
||||
{
|
||||
var result=new PHTGL_ContractTrackProgress();
|
||||
{
|
||||
var result = new PHTGL_ContractTrackProgress();
|
||||
var model = GetPHTGL_ContractTrackProgressById(contractTrackProgressId);
|
||||
var q = (from x in Funs.DB.PHTGL_ContractTrackProgress
|
||||
where x.ContractTrackId == model.ContractTrackId && string.Compare(x.Date,model.Date)<=0
|
||||
select x).ToList();
|
||||
result.ACWP_Quantity = q.Sum(x => x.ACWP_Quantity ??0);
|
||||
where x.ContractTrackId == model.ContractTrackId && string.Compare(x.Date, model.Date) <= 0
|
||||
select x).ToList();
|
||||
result.ACWP_Quantity = q.Sum(x => x.ACWP_Quantity ?? 0);
|
||||
result.ACWP_OutputValue = q.Sum(x => x.ACWP_OutputValue ?? 0);
|
||||
result.ACWP_Percentage = q.Sum(x => x.ACWP_Percentage ?? 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user