533 lines
21 KiB
C#
533 lines
21 KiB
C#
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
public class ContactSheetService
|
|
{
|
|
#region 一级分类下拉框
|
|
/// <summary>
|
|
/// 一级分类下拉框
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static ListItem[] DraftReason1List()
|
|
{
|
|
List<ListItem> list = new List<ListItem>();
|
|
var dc = Funs.DB;
|
|
HashSet<string> set = new HashSet<string>();
|
|
var q = (from x in dc.CQMS_Information_DraftReason
|
|
orderby x.Orders
|
|
select x).ToList();
|
|
foreach (var item in q)
|
|
{
|
|
if (!set.Contains(item.DraftReasonCode.Substring(0, 1)))
|
|
{
|
|
ListItem row = new ListItem(item.DraftReasonType,item.DraftReasonType);
|
|
list.Add(row);
|
|
set.Add(item.DraftReasonCode.Substring(0, 1));
|
|
}
|
|
}
|
|
return list.ToArray();
|
|
|
|
}
|
|
#endregion
|
|
#region 二级分类表格
|
|
/// <summary>
|
|
/// 二级分类表格
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static ListItem[] DraftReason2 (string DraftReasonType)
|
|
{
|
|
var dc = Funs.DB;
|
|
List<ListItem> list = new List<ListItem>();
|
|
var q = (from x in dc.CQMS_Information_DraftReason
|
|
where x.DraftReasonType == DraftReasonType
|
|
orderby x.Orders
|
|
select x).ToList();
|
|
foreach (var item in q)
|
|
{
|
|
ListItem row = new ListItem(item.DraftReason, item.DraftReasonCode);
|
|
list.Add(row);
|
|
|
|
}
|
|
return list.ToArray();
|
|
}
|
|
public static List<CQMS_Information_DraftReason> DraftReason2ByCode(string draftReasonCode)
|
|
{
|
|
var dc = Funs.DB;
|
|
List<ListItem> list = new List<ListItem>();
|
|
var q = (from x in dc.CQMS_Information_DraftReason
|
|
where x.DraftReasonCode.Contains(draftReasonCode)
|
|
orderby x.Orders
|
|
select x).ToList();
|
|
return q.ToList();
|
|
}
|
|
#endregion
|
|
public static void AddConfirmForm(Model.CQMS_Information_ContactSheet CheckControl)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.CQMS_Information_ContactSheet newCheckControl = new Model.CQMS_Information_ContactSheet();
|
|
newCheckControl.ContactSheetId = CheckControl.ContactSheetId;
|
|
newCheckControl.ContactSheetCode = CheckControl.ContactSheetCode;
|
|
newCheckControl.DraftReasonCode = CheckControl.DraftReasonCode;
|
|
newCheckControl.InstallationCode = CheckControl.InstallationCode;
|
|
newCheckControl.ProfessionCode = CheckControl.ProfessionCode;
|
|
newCheckControl.NeedDesign = CheckControl.NeedDesign;
|
|
newCheckControl.CreatMan = CheckControl.CreatMan;
|
|
|
|
newCheckControl.Contents = CheckControl.Contents;
|
|
newCheckControl.DName = CheckControl.DName;
|
|
newCheckControl.ProjectId = CheckControl.ProjectId;
|
|
newCheckControl.ProjectCode = CheckControl.ProjectCode;
|
|
newCheckControl.CreatDate = CheckControl.CreatDate;
|
|
newCheckControl.AuditUser = CheckControl.AuditUser;
|
|
newCheckControl.RealCompletDate = CheckControl.RealCompletDate;
|
|
newCheckControl.CompanyCode = CheckControl.CompanyCode;
|
|
newCheckControl.Receiver = CheckControl.Receiver;
|
|
newCheckControl.UnitWork = CheckControl.UnitWork;
|
|
newCheckControl.OwnerCode = CheckControl.OwnerCode;
|
|
newCheckControl.DocCode = CheckControl.DocCode;
|
|
|
|
newCheckControl.States = CheckControl.States;
|
|
newCheckControl.CIType = CheckControl.CIType;
|
|
newCheckControl.AuditArtificialInput = CheckControl.AuditArtificialInput;
|
|
newCheckControl.ArtificialInput = CheckControl.ArtificialInput;
|
|
newCheckControl.IsPo = CheckControl.IsPo;
|
|
|
|
|
|
db.CQMS_Information_ContactSheet.InsertOnSubmit(newCheckControl);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
public static CQMS_Information_ContactSheet GetConfirmFormById(string contactSheetId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
return db.CQMS_Information_ContactSheet.Where(e => e.ContactSheetId == contactSheetId).FirstOrDefault();
|
|
}
|
|
|
|
public static void UpdateConfirmForm(CQMS_Information_ContactSheet CheckControl)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.CQMS_Information_ContactSheet newCheckControl = db.CQMS_Information_ContactSheet.First(e => e.ContactSheetId == CheckControl.ContactSheetId);
|
|
newCheckControl.ContactSheetCode = CheckControl.ContactSheetCode;
|
|
newCheckControl.DraftReasonCode = CheckControl.DraftReasonCode;
|
|
newCheckControl.InstallationCode = CheckControl.InstallationCode;
|
|
newCheckControl.ProfessionCode = CheckControl.ProfessionCode;
|
|
newCheckControl.NeedDesign = CheckControl.NeedDesign;
|
|
newCheckControl.CreatMan = CheckControl.CreatMan;
|
|
|
|
newCheckControl.Contents = CheckControl.Contents;
|
|
newCheckControl.DName = CheckControl.DName;
|
|
newCheckControl.ProjectId = CheckControl.ProjectId;
|
|
newCheckControl.ProjectCode = CheckControl.ProjectCode;
|
|
newCheckControl.CreatDate = CheckControl.CreatDate;
|
|
newCheckControl.AuditUser = CheckControl.AuditUser;
|
|
newCheckControl.RealCompletDate = CheckControl.RealCompletDate;
|
|
newCheckControl.CompanyCode = CheckControl.CompanyCode;
|
|
newCheckControl.Receiver = CheckControl.Receiver;
|
|
|
|
newCheckControl.UnitWork = CheckControl.UnitWork;
|
|
newCheckControl.OwnerCode = CheckControl.OwnerCode;
|
|
newCheckControl.States = CheckControl.States;
|
|
newCheckControl.DocCode = CheckControl.DocCode;
|
|
newCheckControl.CIType = CheckControl.CIType;
|
|
newCheckControl.IsPo = CheckControl.IsPo;
|
|
newCheckControl.AuditArtificialInput = CheckControl.AuditArtificialInput;
|
|
newCheckControl.ArtificialInput = CheckControl.ArtificialInput;
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
|
|
public static void updateDistribute(List<string> userId, string contactSheetId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
var distributes = db.CQMS_Information_ContactSheetDistribute.Where(e => e.ContactSheetId == contactSheetId);
|
|
foreach (var dis in distributes)
|
|
{
|
|
if (!userId.Contains(dis.UserId))
|
|
{
|
|
db.CQMS_Information_ContactSheetDistribute.DeleteOnSubmit(dis);
|
|
}
|
|
}
|
|
|
|
foreach (var id in userId)
|
|
{
|
|
bool has = false;
|
|
foreach (var dis in distributes)
|
|
{
|
|
|
|
if (id == dis.UserId)
|
|
has = true;
|
|
}
|
|
|
|
if (!has)
|
|
{
|
|
CQMS_Information_ContactSheetDistribute newdis = new CQMS_Information_ContactSheetDistribute();
|
|
newdis.UserId = id;
|
|
newdis.ContactSheetId = contactSheetId;
|
|
newdis.ContactSheetDistributeId = Guid.NewGuid().ToString();
|
|
db.CQMS_Information_ContactSheetDistribute.InsertOnSubmit(newdis);
|
|
}
|
|
}
|
|
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
public static List<CQMS_Information_ContactSheet> getCListByProjectId(string projectId, string contactSheetId)
|
|
{
|
|
Model.SGGLDB dc = Funs.DB;
|
|
List<CQMS_Information_ContactSheet> res = (from c in dc.CQMS_Information_ContactSheet
|
|
where c.ProjectId == projectId && c.CIType == "C" && c.ContactSheetId != contactSheetId
|
|
select c).ToList();
|
|
return res;
|
|
}
|
|
|
|
public static List<string> GetDistributesUserId(string contactSheetId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
var distributes = db.CQMS_Information_ContactSheetDistribute.Where(e => e.ContactSheetId == contactSheetId).Select(e=>e.UserId);
|
|
return distributes.ToList();
|
|
|
|
}
|
|
public static ListItem[] GetDHandleTypeByState(string state, string isAgree)
|
|
{
|
|
if (state == Const.ContactSheet_Compile || state == Const.ContactSheet_ReCompile)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("分包技术负责人审核", Const.ContactSheet_Audit1);
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactSheet_Audit1)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if ("true" == isAgree)
|
|
{
|
|
lis[0] = new ListItem("专业工程师审核", Const.ContactSheet_Audit2);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.ContactSheet_ReCompile);
|
|
}
|
|
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactSheet_Audit2)
|
|
{
|
|
ListItem[] lis = new ListItem[2];
|
|
lis[0] = new ListItem("施工经理审核", Const.ContactSheet_Audit3);
|
|
lis[1] = new ListItem("QA/QC经理确认", Const.ContactSheet_Audit4);
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactSheet_Audit3)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if ("true" == isAgree)
|
|
{
|
|
lis[0] = new ListItem("QA/QC经理确认", Const.ContactSheet_Audit4);
|
|
}
|
|
else
|
|
{ lis[1] = new ListItem("重新整理", Const.ContactSheet_ReCompile);
|
|
|
|
}
|
|
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactSheet_Audit4)
|
|
{
|
|
ListItem[] lis = new ListItem[2];
|
|
lis[0] = new ListItem("文件上传签字盖章", Const.ContactSheet_Audit5);
|
|
lis[1] = new ListItem("设计审批", Const.ContactSheet_Audit7);
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactSheet_Audit5)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("费控经理", Const.ContactSheet_Audit6);
|
|
return lis;
|
|
|
|
}
|
|
else if (state == Const.ContactSheet_Audit6)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("审批完成", Const.ContactSheet_AuditCompleted);
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactSheet_Audit7)
|
|
{
|
|
ListItem[] lis = new ListItem[2];
|
|
lis[0] = new ListItem("QA/QC经理确认", Const.ContactSheet_Audit4);
|
|
lis[1] = new ListItem("专业工程师审核", Const.ContactSheet_Audit2);
|
|
return lis;
|
|
}
|
|
|
|
|
|
else
|
|
return null;
|
|
}
|
|
public static ListItem[] GetFHandleTypeByState(string state ,string isAgree)
|
|
{
|
|
if (state == Const.ContactForm_Compile || state == Const.ContactForm_ReCompile)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("分包技术负责人审核", Const.ContactForm_Audit1);
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactForm_Audit1)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("专业工程师审核", Const.ContactForm_Audit2);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.ContactSheet_ReCompile);
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactForm_Audit2)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("施工经理/技术质量经理审核", Const.ContactForm_Audit3);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.ContactSheet_ReCompile);
|
|
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactForm_Audit3)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("项目费控工程师审核", Const.ContactForm_Audit4);
|
|
}else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.ContactSheet_ReCompile);
|
|
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactForm_Audit4)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("项目费控经理审核", Const.ContactForm_Audit5);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.ContactSheet_ReCompile);
|
|
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactForm_Audit5)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("现场负责人/项目经理审核", Const.ContactForm_Audit6);
|
|
return lis;
|
|
|
|
}
|
|
else if (state == Const.ContactForm_Audit6)
|
|
{
|
|
ListItem[] lis = new ListItem[2];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("QA/QC经理审核", Const.ContactForm_Audit7);
|
|
}
|
|
else
|
|
{
|
|
lis[1] = new ListItem("重新整理", Const.ContactSheet_ReCompile);
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactForm_Audit7)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("文控分发审核", Const.ContactForm_Audit8);
|
|
return lis;
|
|
}
|
|
else if (state == Const.ContactForm_Audit8)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("审批完成", Const.ContactForm_AuditCompleted);
|
|
return lis;
|
|
}
|
|
|
|
|
|
else
|
|
return null;
|
|
}
|
|
public static ListItem[] GetIHandleTypeByState(string state, string isAgree)
|
|
{
|
|
if (state == Const.InstructionSheet_Compile || state == Const.InstructionSheet_ReCompile)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("施工经理审核", Const.InstructionSheet_Audit1);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.InstructionSheet_ReCompile);
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.InstructionSheet_Audit1)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("费用工程师审核", Const.InstructionSheet_Audit2);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.InstructionSheet_ReCompile);
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.InstructionSheet_Audit2)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("控制经理审核", Const.InstructionSheet_Audit3);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.InstructionSheet_ReCompile);
|
|
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.InstructionSheet_Audit3)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("现场经理/项目经理审核", Const.InstructionSheet_Audit4);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.InstructionSheet_ReCompile);
|
|
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.InstructionSheet_Audit4)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis = new ListItem[3];
|
|
lis[0] = new ListItem("建造部审核", Const.InstructionSheet_Audit5);
|
|
lis[1] = new ListItem("公司分管副总审核", Const.InstructionSheet_Audit9);
|
|
lis[2] = new ListItem("AQ/QC经理确认", Const.InstructionSheet_Audit10);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.InstructionSheet_ReCompile);
|
|
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.InstructionSheet_Audit5)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("造价费控部审核", Const.InstructionSheet_Audit6);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.InstructionSheet_ReCompile);
|
|
|
|
}
|
|
return lis;
|
|
|
|
}
|
|
else if (state == Const.InstructionSheet_Audit6)
|
|
{
|
|
ListItem[] lis = new ListItem[2];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("审计部审核", Const.InstructionSheet_Audit7);
|
|
}
|
|
else
|
|
{
|
|
lis[1] = new ListItem("重新整理", Const.InstructionSheet_ReCompile);
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.InstructionSheet_Audit7)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("公司总经理审核", Const.InstructionSheet_Audit8);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.InstructionSheet_ReCompile);
|
|
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.InstructionSheet_Audit8)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("QA/QC经理审核", Const.InstructionSheet_Audit10);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.InstructionSheet_ReCompile);
|
|
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.InstructionSheet_Audit9)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
if (isAgree == "true")
|
|
{
|
|
lis[0] = new ListItem("QA/QC经理审核", Const.InstructionSheet_Audit10);
|
|
}
|
|
else
|
|
{
|
|
lis[0] = new ListItem("重新整理", Const.InstructionSheet_ReCompile);
|
|
|
|
}
|
|
return lis;
|
|
}
|
|
else if (state == Const.InstructionSheet_Audit10)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("文控分发", Const.InstructionSheet_Audit11);
|
|
return lis;
|
|
}
|
|
else if (state == Const.InstructionSheet_Audit11)
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("审批完成", Const.InstructionSheet_AuditCompleted);
|
|
return lis;
|
|
}
|
|
else
|
|
return null;
|
|
}
|
|
|
|
}
|
|
}
|