2023-08-31
This commit is contained in:
@@ -7,10 +7,11 @@ using FineUIPro;
|
||||
using MiniExcelLibs;
|
||||
using MiniExcelLibs.Attributes;
|
||||
using Model;
|
||||
using WIA;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class PHTGL_ContractTrackService
|
||||
public static class PhtglContractTrackService
|
||||
{
|
||||
#region 获取列表
|
||||
|
||||
@@ -157,6 +158,8 @@ namespace BLL
|
||||
};
|
||||
Funs.DB.PHTGL_ContractTrack.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
PhtglContracttrackprogressService.CreateTemplateByContractTrackId(newtable.Id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -206,6 +209,8 @@ namespace BLL
|
||||
Funs.DB.PHTGL_ContractTrack.DeleteOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
PhtglContracttrackprogressService.DeleteModleByContractTrackId(id);
|
||||
PhtglContracttrackmatchwbsService.DeleteModelByContractTrackId(id);
|
||||
}
|
||||
|
||||
public static ResponeData ImportData(string path, string contractid, string projectid)
|
||||
@@ -243,7 +248,9 @@ namespace BLL
|
||||
ContractId = contractid,
|
||||
ProjectId = projectid,
|
||||
};
|
||||
if (string.IsNullOrEmpty(item.ProjectCode)) continue;
|
||||
var resultModel = GetPHTGL_ContractTrackByModle(phtglContractTrack);
|
||||
item.ContractNum=ContractService.GetContractById(contractid)?.ContractNum;
|
||||
if (resultModel.Any())
|
||||
{
|
||||
item.Id = resultModel[0].Id;
|
||||
@@ -254,6 +261,7 @@ namespace BLL
|
||||
item.Id = SQLHelper.GetNewID();
|
||||
AddPHTGL_ContractTrack(item);
|
||||
}
|
||||
PhtglContracttrackprogressService.CreateTemplateByContractTrackId(item.Id);
|
||||
}
|
||||
|
||||
return responeData;
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
using FineUIPro;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
|
||||
public static class PhtglContracttrackmatchwbsService
|
||||
{
|
||||
|
||||
|
||||
|
||||
#region 获取列表
|
||||
/// <summary>
|
||||
/// 记录数
|
||||
/// </summary>
|
||||
public static int Count
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public static List<Model.PHTGL_ContractTrackMatchWBS> GetPHTGL_ContractTrackMatchWBSByModle(Model.PHTGL_ContractTrackMatchWBS table)
|
||||
{
|
||||
var q = from x in Funs.DB.PHTGL_ContractTrackMatchWBS
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(string.IsNullOrEmpty(table.ContractTrackId) || x.ContractTrackId.Contains(table.ContractTrackId)) &&
|
||||
(string.IsNullOrEmpty(table.ControlItemAndCycleId) || x.ControlItemAndCycleId.Contains(table.ControlItemAndCycleId))
|
||||
select x
|
||||
;
|
||||
|
||||
return q.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取分页列表
|
||||
/// </summary>
|
||||
/// <param name="table"></param>
|
||||
/// <param name="grid1"></param>
|
||||
/// <returns></returns>
|
||||
public static IEnumerable GetListData(Model.PHTGL_ContractTrackMatchWBS table, Grid grid1)
|
||||
{
|
||||
var q = GetPHTGL_ContractTrackMatchWBSByModle(table);
|
||||
Count = q.Count();
|
||||
if (Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
q = q.Skip(grid1.PageSize * grid1.PageIndex).Take(grid1.PageSize).ToList();
|
||||
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
|
||||
return from x in q
|
||||
select new
|
||||
{
|
||||
x.Id,
|
||||
x.ContractTrackId,
|
||||
x.ControlItemAndCycleId,
|
||||
x.WorkPackageEstimate,
|
||||
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
public static Model.PHTGL_ContractTrackMatchWBS GetPHTGL_ContractTrackMatchWBSById(string Id)
|
||||
{
|
||||
return Funs.DB.PHTGL_ContractTrackMatchWBS.FirstOrDefault(x => x.Id == Id);
|
||||
}
|
||||
|
||||
|
||||
public static void AddPHTGL_ContractTrackMatchWBS(Model.PHTGL_ContractTrackMatchWBS newtable)
|
||||
{
|
||||
|
||||
Model.PHTGL_ContractTrackMatchWBS table = new Model.PHTGL_ContractTrackMatchWBS
|
||||
{
|
||||
Id = newtable.Id,
|
||||
ContractTrackId = newtable.ContractTrackId,
|
||||
ControlItemAndCycleId = newtable.ControlItemAndCycleId,
|
||||
WorkPackageEstimate = newtable.WorkPackageEstimate,
|
||||
};
|
||||
Funs.DB.PHTGL_ContractTrackMatchWBS.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
public static void UpdatePHTGL_ContractTrackMatchWBS(Model.PHTGL_ContractTrackMatchWBS newtable)
|
||||
{
|
||||
|
||||
Model.PHTGL_ContractTrackMatchWBS table = Funs.DB.PHTGL_ContractTrackMatchWBS.FirstOrDefault(x => x.Id == newtable.Id);
|
||||
if (table != null)
|
||||
{
|
||||
table.Id = newtable.Id;
|
||||
table.ContractTrackId = newtable.ContractTrackId;
|
||||
table.ControlItemAndCycleId = newtable.ControlItemAndCycleId;
|
||||
table.WorkPackageEstimate = newtable.WorkPackageEstimate;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteModelById(string Id)
|
||||
{
|
||||
|
||||
Model.PHTGL_ContractTrackMatchWBS table = Funs.DB.PHTGL_ContractTrackMatchWBS.FirstOrDefault(x => x.Id == Id);
|
||||
if (table != null)
|
||||
{
|
||||
Funs.DB.PHTGL_ContractTrackMatchWBS.DeleteOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
}
|
||||
public static void DeleteModelByContractTrackId(string ContractTrackId)
|
||||
{
|
||||
var table = Funs.DB.PHTGL_ContractTrackMatchWBS.Where(x =>
|
||||
x.ContractTrackId == ContractTrackId);
|
||||
if (table != null)
|
||||
{
|
||||
Funs.DB.PHTGL_ContractTrackMatchWBS.DeleteAllOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FineUIPro;
|
||||
@@ -33,7 +34,10 @@ namespace BLL
|
||||
(string.IsNullOrEmpty(table.ACWP_OutputValue) ||
|
||||
x.ACWP_OutputValue.Contains(table.ACWP_OutputValue)) &&
|
||||
(string.IsNullOrEmpty(table.ACWP_Percentage) ||
|
||||
x.ACWP_Percentage.Contains(table.ACWP_Percentage))
|
||||
x.ACWP_Percentage.Contains(table.ACWP_Percentage)) &&
|
||||
(string.IsNullOrEmpty(table.Date) ||
|
||||
x.Date.Contains(table.Date))
|
||||
orderby x.Date
|
||||
select x
|
||||
;
|
||||
|
||||
@@ -63,7 +67,8 @@ namespace BLL
|
||||
x.BCWS_Percentage,
|
||||
x.ACWP_Quantity,
|
||||
x.ACWP_OutputValue,
|
||||
x.ACWP_Percentage
|
||||
x.ACWP_Percentage,
|
||||
x.Date
|
||||
};
|
||||
}
|
||||
|
||||
@@ -75,7 +80,52 @@ namespace BLL
|
||||
x.ContractTrackProgressId == ContractTrackProgressId);
|
||||
}
|
||||
|
||||
public static void CreateTemplateByContractTrackId(string ContractTrackId)
|
||||
{
|
||||
var model = PhtglContractTrackService.GetPHTGL_ContractTrackById(ContractTrackId);
|
||||
if (model == null) return;
|
||||
var contractNum=model.ContractNum;
|
||||
var contractmode = ContractService.GetContractByContractNum(contractNum);
|
||||
if (contractmode.ContractStartDate != null && contractmode.ContractEndDate != null)
|
||||
{
|
||||
var startDate = (DateTime)contractmode.ContractStartDate;
|
||||
var endDate = (DateTime)contractmode.ContractEndDate;
|
||||
List<DateTime> months = GetMonthsBetween(startDate, endDate);
|
||||
|
||||
foreach (DateTime month in months)
|
||||
{
|
||||
var querymodel = new Model.PHTGL_ContractTrackProgress
|
||||
{
|
||||
ContractTrackId = ContractTrackId,
|
||||
Date= month.ToString("yyyy-MM")
|
||||
};
|
||||
if (!GetPHTGL_ContractTrackProgressByModle(querymodel).Any())
|
||||
{
|
||||
var newmodel = new Model.PHTGL_ContractTrackProgress();
|
||||
newmodel.ContractTrackProgressId = SQLHelper.GetNewID(typeof(Model.PHTGL_ContractTrackProgress));
|
||||
newmodel.ContractTrackId = ContractTrackId;
|
||||
newmodel.Date = month.ToString("yyyy-MM");
|
||||
AddPHTGL_ContractTrackProgress(newmodel);
|
||||
}
|
||||
//Console.WriteLine(month.ToString("yyyy-MM"));
|
||||
}
|
||||
}
|
||||
}
|
||||
public static List<DateTime> GetMonthsBetween(DateTime startDate, DateTime endDate)
|
||||
{
|
||||
List<DateTime> months = new List<DateTime>();
|
||||
|
||||
DateTime currentMonth = new DateTime(startDate.Year, startDate.Month, 1);
|
||||
DateTime lastMonth = new DateTime(endDate.Year, endDate.Month, 1);
|
||||
|
||||
while (currentMonth <= lastMonth)
|
||||
{
|
||||
months.Add(currentMonth);
|
||||
currentMonth = currentMonth.AddMonths(1);
|
||||
}
|
||||
|
||||
return months;
|
||||
}
|
||||
public static void AddPHTGL_ContractTrackProgress(PHTGL_ContractTrackProgress newtable)
|
||||
{
|
||||
var table = new PHTGL_ContractTrackProgress
|
||||
@@ -87,7 +137,9 @@ namespace BLL
|
||||
BCWS_Percentage = newtable.BCWS_Percentage,
|
||||
ACWP_Quantity = newtable.ACWP_Quantity,
|
||||
ACWP_OutputValue = newtable.ACWP_OutputValue,
|
||||
ACWP_Percentage = newtable.ACWP_Percentage
|
||||
ACWP_Percentage = newtable.ACWP_Percentage,
|
||||
Date = newtable.Date
|
||||
|
||||
};
|
||||
Funs.DB.PHTGL_ContractTrackProgress.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
@@ -108,6 +160,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;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user