1代码合并

This commit is contained in:
2025-02-05 17:57:14 +08:00
parent 4bbce72980
commit 5712066e0a
57 changed files with 334 additions and 3709 deletions
-130
View File
@@ -468,135 +468,5 @@ namespace BLL
}
}
#endregion
public static string InsertCodeRecordsByMenuIdProjectIdUnitIdForApi(string menuId, string projectId, string unitId, string dataId, DateTime? compileDate)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
string ruleCode = string.Empty;
var IsHaveCodeRecords = db.Sys_CodeRecords.FirstOrDefault(x => x.DataId == dataId);
if (IsHaveCodeRecords == null) ///是否已存在编码
{
string ruleCodeower = string.Empty;
int digit = 4; ///流水位数
string symbolower = "-"; ///业主间隔符
int digitower = 4; ///业主流水位数
string symbol = "-"; ///间隔符
var project = db.Base_Project.FirstOrDefault(e => e.ProjectId == projectId); ////项目
if (project != null && !string.IsNullOrEmpty(dataId))
{
string projectCode = project.ProjectCode; ///项目编号
////编码规则表
var sysCodeTemplateRule = db.ProjectData_CodeTemplateRule.FirstOrDefault(x => x.MenuId == menuId && x.ProjectId == projectId);
if (sysCodeTemplateRule != null)
{
symbol = sysCodeTemplateRule.Symbol;
symbolower = sysCodeTemplateRule.OwerSymbol;
if (sysCodeTemplateRule.Digit.HasValue)
{
digit = sysCodeTemplateRule.Digit.Value;
}
if (sysCodeTemplateRule.OwerDigit.HasValue)
{
digitower = sysCodeTemplateRule.OwerDigit.Value;
}
if (sysCodeTemplateRule.IsProjectCode == true)
{
ruleCode = projectCode + symbol;
}
if (sysCodeTemplateRule.OwerIsProjectCode == true)
{
ruleCodeower = projectCode + symbolower;
}
if (!string.IsNullOrEmpty(sysCodeTemplateRule.Prefix))
{
ruleCode += sysCodeTemplateRule.Prefix + symbol;
}
if (!string.IsNullOrEmpty(sysCodeTemplateRule.OwerPrefix))
{
ruleCodeower += sysCodeTemplateRule.OwerPrefix + symbolower;
}
if (sysCodeTemplateRule.IsUnitCode == true || sysCodeTemplateRule.OwerIsUnitCode == true)
{
var unit = db.Base_Unit.FirstOrDefault(x => x.UnitId == unitId);
if (unit != null)
{
if (sysCodeTemplateRule.IsUnitCode == true)
{ ruleCode = unit.UnitCode + symbol; }
if (sysCodeTemplateRule.OwerIsUnitCode == true)
{
ruleCodeower = unit.UnitCode + symbolower;
}
}
}
}
}
////获取编码记录表最大排列序号
int maxNewSortIndex = 0;
if (!String.IsNullOrEmpty(projectId))
{
var maxSortIndex = db.Sys_CodeRecords.Where(x => x.ProjectId == projectId && x.MenuId == menuId).Select(x => x.SortIndex).Max();
if (maxSortIndex.HasValue)
{
maxNewSortIndex = maxSortIndex.Value;
}
}
else
{
var maxSortIndexNull = db.Sys_CodeRecords.Where(x => x.MenuId == menuId).Select(x => x.SortIndex).Max();
if (maxSortIndexNull.HasValue)
{
maxNewSortIndex = maxSortIndexNull.Value;
}
}
maxNewSortIndex = maxNewSortIndex + 1;
////插入数据库
Model.Sys_CodeRecords newCodeRecords = new Model.Sys_CodeRecords
{
CodeRecordId = SQLHelper.GetNewID(typeof(Model.Sys_CodeRecords))
};
if (project != null)
{
newCodeRecords.ProjectId = project.ProjectId;
}
newCodeRecords.MenuId = menuId;
newCodeRecords.DataId = dataId;
newCodeRecords.UnitId = unitId;
newCodeRecords.SortIndex = maxNewSortIndex;
newCodeRecords.CompileDate = compileDate;
newCodeRecords.RuleCodes = ruleCode;
newCodeRecords.Digit = digit;
newCodeRecords.OwnerRuleCodes = ruleCodeower;
newCodeRecords.OwerDigit = digitower;
if (!string.IsNullOrEmpty(ruleCode))
{
newCodeRecords.Code = ruleCode + (maxNewSortIndex.ToString().PadLeft(digit, '0')); ///字符自动补零 编码
}
else
{
newCodeRecords.Code = (maxNewSortIndex.ToString().PadLeft(digit, '0'));
}
if (!string.IsNullOrEmpty(ruleCodeower))
{
newCodeRecords.OwnerCode = ruleCodeower + (maxNewSortIndex.ToString().PadLeft(digitower, '0')); ///字符自动补零 业主编码
}
else
{
newCodeRecords.OwnerCode = (maxNewSortIndex.ToString().PadLeft(digitower, '0'));
}
db.Sys_CodeRecords.InsertOnSubmit(newCodeRecords);
db.SubmitChanges();
}
else
{
ruleCode = IsHaveCodeRecords.Code;
}
return ruleCode;
}
}
}
}
-15
View File
@@ -6415,20 +6415,5 @@ namespace BLL
/// 施工作业风险
/// </summary>
public const string ConstructionRiskMenuId = "F531D523-35BC-4D13-88D3-CB2554C4185C";
/// <summary>
/// 专项安全培训 id
/// </summary>
public static string SpecialSafeTrainId = "0e7fdf78-eaa0-4d00-a60b-490040bbea18";
/// <summary>
/// 公司看板数据维护
/// </summary>
public const string BoardDataMenuId = "B06DD352-61C6-453C-A9C7-9CF10918AF08";
/// <summary>
/// 项目看板数据维护
/// </summary>
public const string ProjectBoardDataMenuId = "087F4FAF-3B00-462A-9040-4CB3556F8177";
}
}
+1 -1
View File
@@ -1412,7 +1412,7 @@
sb.Append("<meta http-equiv=\"content-type\" content=\"application/word; charset=UTF-8\"/>");
sb.Append("<table width=\"100% \" cellspacing=\"0\" rules=\"all\" border=\"0\" style=\"border-collapse:collapse;font-size: 12pt;\">");
sb.Append("<tr style=\"height: 35px\">");
sb.AppendFormat("<td align=\"center\" style=\"width: 100%; font-size: 12pt; font-weight: bold;\">{0}</td> ", "新疆邮建" + ProjectService.GetProjectNameByProjectId(getTestRecord.ProjectId));
sb.AppendFormat("<td align=\"center\" style=\"width: 100%; font-size: 12pt; font-weight: bold;\">{0}</td> ", "中国天辰" + ProjectService.GetProjectNameByProjectId(getTestRecord.ProjectId));
sb.Append("</tr>");
sb.Append("<tr style=\"height:35px\">");
var getTrainTypeName = (from x in db.Training_TestPlan