提交代码
This commit is contained in:
@@ -0,0 +1,176 @@
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public class BaseApproveService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
/// <summary>
|
||||
/// 获取工程量基础表模板列表
|
||||
/// </summary>
|
||||
/// <param name="satartRowIndex"></param>
|
||||
/// <param name="maximumRows"></param>
|
||||
/// <returns></returns>
|
||||
public static DataTable getListData(string BaseId)
|
||||
{
|
||||
var res = from x in db.QuantityManagement_BaseApprove
|
||||
where x.BaseId == BaseId && x.ApproveDate != null && x.ApproveType != "S"
|
||||
orderby x.ApproveDate
|
||||
select new
|
||||
{
|
||||
x.BaseApproveId,
|
||||
x.BaseId,
|
||||
ApproveMan = (from y in db.Sys_User where y.UserId == x.ApproveMan select y.UserName).First(),
|
||||
x.ApproveDate,
|
||||
x.IsAgree,
|
||||
x.ApproveIdea,
|
||||
x.ApproveType,
|
||||
};
|
||||
return Funs.LINQToDataTable(res);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据工程量基础表编号删除对应的所有工程量基础表审批信息
|
||||
/// </summary>
|
||||
/// <param name="BaseId">工程量基础表编号</param>
|
||||
public static void DeleteBaseApprovesByBaseId(string BaseId)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
var q = (from x in db.QuantityManagement_BaseApprove where x.BaseId == BaseId select x).ToList();
|
||||
db.QuantityManagement_BaseApprove.DeleteAllOnSubmit(q);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取登录人的通知信息
|
||||
/// </summary>
|
||||
/// <param name="BaseId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public static IQueryable getList(string userId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var res = from x in db.QuantityManagement_BaseApprove
|
||||
join ca in db.QuantityManagement_Base on x.BaseId equals ca.BaseId
|
||||
where x.ApproveDate == null && x.ApproveType == "S" && x.ApproveMan == userId
|
||||
orderby x.ApproveDate
|
||||
select new
|
||||
{
|
||||
//x.BaseApproveId,
|
||||
x.BaseId,
|
||||
//x.ApproveDate,
|
||||
//x.IsAgree,
|
||||
//x.ApproveIdea,
|
||||
//x.ApproveType,
|
||||
};
|
||||
return res.AsQueryable().Distinct();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 更新通知信息提醒
|
||||
/// </summary>
|
||||
/// <param name="BaseId"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.QuantityManagement_BaseApprove GetSee(string BaseId, string userId)
|
||||
{
|
||||
return db.QuantityManagement_BaseApprove.FirstOrDefault(x => x.BaseId == BaseId && x.ApproveType == "S" && x.ApproveMan == userId && x.ApproveDate == null);
|
||||
}
|
||||
public static void See(string BaseId, string userId)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var res = db.QuantityManagement_BaseApprove.FirstOrDefault(x => x.BaseId == BaseId && x.ApproveType == "S" && x.ApproveMan == userId && x.ApproveDate == null);
|
||||
if (res != null)
|
||||
{
|
||||
res.ApproveDate = DateTime.Now;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据工程量基础表编号获取一个工程量基础表审批信息
|
||||
/// </summary>
|
||||
/// <param name="BaseId">工程量基础表编号</param>
|
||||
/// <returns>一个工程量基础表审批实体</returns>
|
||||
public static Model.QuantityManagement_BaseApprove GetBaseApproveByBaseId(string BaseId)
|
||||
{
|
||||
return db.QuantityManagement_BaseApprove.FirstOrDefault(x => x.BaseId == BaseId && x.ApproveType != "S" && x.ApproveDate == null);
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改工程量基础表审批信息
|
||||
/// </summary>
|
||||
/// <param name="managerRuleApprove">工程量基础表审批实体</param>
|
||||
public static void UpdateBaseApprove(Model.QuantityManagement_BaseApprove approve)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
Model.QuantityManagement_BaseApprove newApprove = db.QuantityManagement_BaseApprove.First(e => e.BaseApproveId == approve.BaseApproveId && e.ApproveDate == null);
|
||||
newApprove.BaseId = approve.BaseId;
|
||||
newApprove.ApproveMan = approve.ApproveMan;
|
||||
newApprove.ApproveDate = approve.ApproveDate;
|
||||
newApprove.ApproveIdea = approve.ApproveIdea;
|
||||
newApprove.IsAgree = approve.IsAgree;
|
||||
newApprove.ApproveType = approve.ApproveType;
|
||||
|
||||
db.SubmitChanges();
|
||||
}
|
||||
/// <summary>
|
||||
/// 增加工程量基础表审批信息
|
||||
/// </summary>
|
||||
/// <param name="managerRuleApprove">工程量基础表审批实体</param>
|
||||
public static void AddBaseApprove(Model.QuantityManagement_BaseApprove approve)
|
||||
{
|
||||
Model.SGGLDB db = Funs.DB;
|
||||
string newKeyID = SQLHelper.GetNewID(typeof(Model.QuantityManagement_BaseApprove));
|
||||
Model.QuantityManagement_BaseApprove newApprove = new Model.QuantityManagement_BaseApprove();
|
||||
newApprove.BaseApproveId = newKeyID;
|
||||
newApprove.BaseId = approve.BaseId;
|
||||
newApprove.ApproveMan = approve.ApproveMan;
|
||||
newApprove.ApproveDate = approve.ApproveDate;
|
||||
newApprove.ApproveIdea = approve.ApproveIdea;
|
||||
newApprove.IsAgree = approve.IsAgree;
|
||||
newApprove.ApproveType = approve.ApproveType;
|
||||
db.QuantityManagement_BaseApprove.InsertOnSubmit(newApprove);
|
||||
db.SubmitChanges();
|
||||
|
||||
}
|
||||
public static string AddBaseApproveForApi(Model.QuantityManagement_BaseApprove approve)
|
||||
{
|
||||
using (var db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string newKeyID = SQLHelper.GetNewID(typeof(Model.QuantityManagement_BaseApprove));
|
||||
Model.QuantityManagement_BaseApprove newApprove = new Model.QuantityManagement_BaseApprove();
|
||||
newApprove.BaseApproveId = newKeyID;
|
||||
newApprove.BaseId = approve.BaseId;
|
||||
newApprove.ApproveMan = approve.ApproveMan;
|
||||
newApprove.ApproveDate = approve.ApproveDate;
|
||||
newApprove.ApproveIdea = approve.ApproveIdea;
|
||||
newApprove.IsAgree = approve.IsAgree;
|
||||
newApprove.ApproveType = approve.ApproveType;
|
||||
|
||||
db.QuantityManagement_BaseApprove.InsertOnSubmit(newApprove);
|
||||
db.SubmitChanges();
|
||||
return newKeyID;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 总包负责人审批信息
|
||||
/// </summary>
|
||||
/// <param name="BaseId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.QuantityManagement_BaseApprove GetAudit1(string BaseId)
|
||||
{
|
||||
return db.QuantityManagement_BaseApprove.OrderByDescending(x => x.ApproveDate).FirstOrDefault(x => x.BaseId == BaseId && x.ApproveType == BLL.Const.Base_Audit1);
|
||||
}
|
||||
|
||||
public static Model.QuantityManagement_BaseApprove GetComplie(string BaseId)
|
||||
{
|
||||
return db.QuantityManagement_BaseApprove.FirstOrDefault(x => x.BaseId == BaseId && x.ApproveType == BLL.Const.Base_Compile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ namespace BLL
|
||||
newBase.WorkTeam = Base.WorkTeam;
|
||||
newBase.CompileMan = Base.CompileMan;
|
||||
newBase.CompileDate = Base.CompileDate;
|
||||
newBase.State = Base.State;
|
||||
|
||||
db.QuantityManagement_Base.InsertOnSubmit(newBase);
|
||||
db.SubmitChanges();
|
||||
@@ -62,6 +63,7 @@ namespace BLL
|
||||
newBase.Amount = Base.Amount;
|
||||
newBase.WorkTeam = Base.WorkTeam;
|
||||
newBase.CompileMan = Base.CompileMan;
|
||||
newBase.State = Base.State;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
@@ -108,7 +110,7 @@ namespace BLL
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var q = (from x in db.QuantityManagement_Base
|
||||
where x.DrawingId == drawingId
|
||||
where x.DrawingId == drawingId && x.State == BLL.Const.Base_Complete
|
||||
orderby x.Part
|
||||
select x.Part).Distinct().ToList();
|
||||
ListItem[] list = new ListItem[q.Count()];
|
||||
@@ -147,10 +149,47 @@ namespace BLL
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
return (from x in db.QuantityManagement_Base
|
||||
where x.DrawingId == drawingId && x.Part == part
|
||||
where x.DrawingId == drawingId && x.Part == part && x.State == BLL.Const.Base_Complete
|
||||
orderby x.ProjectContent
|
||||
select x).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Init(FineUIPro.DropDownList dropName, string state, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "Value";
|
||||
dropName.DataTextField = "Text";
|
||||
dropName.DataSource = GetDHandleTypeByState(state);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据状态选择下一步办理类型
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
public static ListItem[] GetDHandleTypeByState(string state)
|
||||
{
|
||||
if (state == Const.Base_Compile || state == Const.Base_ReCompile) //无是否同意
|
||||
{
|
||||
ListItem[] lis = new ListItem[1];
|
||||
lis[0] = new ListItem("审核", Const.Base_Audit1);
|
||||
return lis;
|
||||
}
|
||||
else if (state == Const.Base_Audit1)//有是否同意
|
||||
{
|
||||
ListItem[] lis = new ListItem[2];
|
||||
lis[0] = new ListItem("审批完成", Const.Base_Complete);//是 加载
|
||||
lis[1] = new ListItem("重新编制", Const.Base_ReCompile);//否加载
|
||||
return lis;
|
||||
}
|
||||
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ namespace BLL
|
||||
newChange.Major = Change.Major;
|
||||
newChange.AcceptDate = Change.AcceptDate;
|
||||
newChange.CompletionStatus = Change.CompletionStatus;
|
||||
newChange.CompletionStatus2 = Change.CompletionStatus2;
|
||||
newChange.DutyPerson = Change.DutyPerson;
|
||||
newChange.DrawingId = Change.DrawingId;
|
||||
newChange.Remark = Change.Remark;
|
||||
newChange.CompileMan = Change.CompileMan;
|
||||
newChange.CompileDate = Change.CompileDate;
|
||||
@@ -63,7 +65,9 @@ namespace BLL
|
||||
newChange.Major = Change.Major;
|
||||
newChange.AcceptDate = Change.AcceptDate;
|
||||
newChange.CompletionStatus = Change.CompletionStatus;
|
||||
newChange.CompletionStatus2 = Change.CompletionStatus2;
|
||||
newChange.DutyPerson = Change.DutyPerson;
|
||||
newChange.DrawingId = Change.DrawingId;
|
||||
newChange.Remark = Change.Remark;
|
||||
newChange.CompileMan = Change.CompileMan;
|
||||
db.SubmitChanges();
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace BLL
|
||||
newDayInput.ProjectId = DayInput.ProjectId;
|
||||
newDayInput.BaseId = DayInput.BaseId;
|
||||
newDayInput.Date = DayInput.Date;
|
||||
newDayInput.WorkTeam = DayInput.WorkTeam;
|
||||
newDayInput.DayAmount = DayInput.DayAmount;
|
||||
newDayInput.CompileMan = DayInput.CompileMan;
|
||||
newDayInput.CompileDate = DayInput.CompileDate;
|
||||
@@ -54,6 +55,7 @@ namespace BLL
|
||||
newDayInput.ProjectId = DayInput.ProjectId;
|
||||
newDayInput.BaseId = DayInput.BaseId;
|
||||
newDayInput.Date = DayInput.Date;
|
||||
newDayInput.WorkTeam = DayInput.WorkTeam;
|
||||
newDayInput.DayAmount = DayInput.DayAmount;
|
||||
newDayInput.CompileMan = DayInput.CompileMan;
|
||||
db.SubmitChanges();
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace BLL
|
||||
newDrawing.Major = Drawing.Major;
|
||||
newDrawing.AcceptDate = Drawing.AcceptDate;
|
||||
newDrawing.CompletionStatus = Drawing.CompletionStatus;
|
||||
newDrawing.CompletionStatus2 = Drawing.CompletionStatus2;
|
||||
newDrawing.DutyPerson = Drawing.DutyPerson;
|
||||
newDrawing.Remark = Drawing.Remark;
|
||||
newDrawing.CompileMan = Drawing.CompileMan;
|
||||
@@ -63,6 +64,7 @@ namespace BLL
|
||||
newDrawing.Major = Drawing.Major;
|
||||
newDrawing.AcceptDate = Drawing.AcceptDate;
|
||||
newDrawing.CompletionStatus = Drawing.CompletionStatus;
|
||||
newDrawing.CompletionStatus2 = Drawing.CompletionStatus2;
|
||||
newDrawing.DutyPerson = Drawing.DutyPerson;
|
||||
newDrawing.Remark = Drawing.Remark;
|
||||
newDrawing.CompileMan = Drawing.CompileMan;
|
||||
@@ -102,6 +104,23 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图纸登记下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitDrawingChangeDropDownList(FineUIPro.DropDownList dropName, string projectId, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "Value";
|
||||
dropName.DataTextField = "Text";
|
||||
dropName.DataSource = GetDrawingChangeListByProjectId(projectId);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目Id获取图纸登记下拉选择项
|
||||
/// </summary>
|
||||
@@ -112,11 +131,41 @@ namespace BLL
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var q = (from x in db.QuantityManagement_Drawing
|
||||
where x.ProjectId == projectId
|
||||
where x.ProjectId == projectId
|
||||
orderby x.DrawingNo
|
||||
select x).ToList();
|
||||
return q;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据项目Id获取图纸登记下拉选择项
|
||||
/// </summary>
|
||||
/// <param name="projectId"></param>
|
||||
/// <returns></returns>
|
||||
public static ListItem[] GetDrawingChangeListByProjectId(string projectId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var q1 = (from x in db.QuantityManagement_Drawing
|
||||
where x.ProjectId == projectId
|
||||
orderby x.DrawingNo
|
||||
select x).ToList();
|
||||
var q2 = (from x in db.QuantityManagement_Change
|
||||
where x.ProjectId == projectId
|
||||
orderby x.ChangeNo
|
||||
select x).ToList();
|
||||
ListItem[] list = new ListItem[q1.Count() + q2.Count()];
|
||||
for (int i = 0; i < q1.Count(); i++)
|
||||
{
|
||||
list[i] = new ListItem(q1[i].DrawingNo ?? "", q1[i].DrawingId.ToString());
|
||||
}
|
||||
for (int j = q1.Count(); j < q1.Count() + q2.Count(); j++)
|
||||
{
|
||||
list[j] = new ListItem(q2[j - q1.Count()].ChangeNo ?? "", q2[j - q1.Count()].ChangeId.ToString());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user