This commit is contained in:
李超 2024-05-09 18:03:12 +08:00
parent a041fdd85d
commit ba518ac354
12 changed files with 571 additions and 145 deletions

View File

@ -0,0 +1,6 @@
alter TABLE [dbo].[Training_CompanyTrainingItem]add
[TestTrainingIds] [nvarchar](max) NULL
alter TABLE [dbo].[Training_TestRecord]add
[CompanyTrainingItemId] [nvarchar](50) NULL

View File

@ -658,7 +658,7 @@ namespace BLL
}
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
var getTrainType = TrainTypeService.GetTrainTypeById(trainTypeId);
if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))
if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat.Value == false))
{
int score = 80;
var sysTestRule = db.Sys_TestRule.FirstOrDefault();
@ -699,7 +699,7 @@ namespace BLL
}
return getTrainPersonList;
}
else if (getTrainType != null && getTrainType.IsRepeat.HasValue && getTrainType.IsRepeat == true)//重复的 过滤人员
else if (getTrainType != null && getTrainType.IsRepeat.HasValue && getTrainType.IsRepeat.Value == true)//重复的 过滤人员
{
foreach (var item in getPersons)
{

View File

@ -263,6 +263,164 @@ namespace BLL
return testRecordId;
}
#endregion
public static string CreateTestRecordItem(Model.Training_CompanyTrainingItem getCompanyTraining, string testRecordId, Model.SitePerson_Person person, Model.Sys_User user)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var trainingIds = getCompanyTraining.TestTrainingIds.Split(',');
var testTrainings= db.Training_TestTraining.Where(x => trainingIds.Contains(x.TrainingId));
var getTestRecord = db.Training_TestRecord.FirstOrDefault(x => x.TestRecordId == testRecordId);
if (getTestRecord != null && !getTestRecord.TestStartTime.HasValue)
{
////考试时长
getTestRecord.Duration =120;
getTestRecord.TestStartTime = DateTime.Now;
db.SubmitChanges();
}
////当前人考试记录 未加入考试计划的 当考试开始扫码时 不允许再参与考试
var item = db.Training_TestRecordItem.FirstOrDefault(x => x.TestRecordId == getTestRecord.TestRecordId);
if (item == null)
{
List<Model.Training_TestTrainingItem> getTestTrainingItemList = new List<Model.Training_TestTrainingItem>();
//var testPlanTrainings = from x in db.Training_TestPlanTraining
// where x.TestPlanId == getTestPlan.TestPlanId
// select x;
//// 计划考试中单选、多选、判断题总数
var sysTestRule = Funs.DB.Sys_TestRule.FirstOrDefault();
int sumTestType1Count = 0;// testPlanTrainings.Sum(x => x.TestType1Count) ?? 0;
int sumTestType2Count = 0;//testPlanTrainings.Sum(x => x.TestType2Count) ?? 0;
int sumTestType3Count = 0;//testPlanTrainings.Sum(x => x.TestType3Count) ?? 0;
if (sysTestRule != null)
{
sumTestType1Count = sysTestRule.SCount;
sumTestType2Count = sysTestRule.MCount;
sumTestType3Count = sysTestRule.JCount;
}
////获取类型下适合岗位试题集合
List<Model.Training_TestTrainingItem> getTestTrainingItemALLs;
string WorkPostId = "";
string DepartId = "";
if (person != null)
{
WorkPostId = person.WorkPostId;
}
if (user != null)
{
DepartId = user.DepartId;
}
getTestTrainingItemALLs = (from x in db.Training_TestTrainingItem
where x.TrainingId != null && (x.WorkPostIds == null || string.IsNullOrEmpty(WorkPostId) || x.WorkPostIds.Contains(WorkPostId)) || (x.DepartIds == null || string.IsNullOrEmpty(DepartId) || x.DepartIds.Contains(DepartId))
select x).ToList();
foreach (var itemT in testTrainings)
{
//// 获取类型下的题目
var getTestTrainingItems = getTestTrainingItemALLs.Where(x => x.TrainingId == itemT.TrainingId).ToList();
if (getTestTrainingItems.Count() > 0)
{
////单选题
var getSItem = getTestTrainingItems.Where(x => x.TestType == "1").OrderBy(x => Guid.NewGuid());
if (getSItem.Count() > 0)
{
getTestTrainingItemList.AddRange(getSItem);
}
///多选题
var getMItem = getTestTrainingItems.Where(x => x.TestType == "2").OrderBy(x => Guid.NewGuid());
if (getMItem.Count() > 0)
{
getTestTrainingItemList.AddRange(getMItem);
}
///判断题
var getJItem = getTestTrainingItems.Where(x => x.TestType == "3").OrderBy(x => Guid.NewGuid());
if (getJItem.Count() > 0)
{
getTestTrainingItemList.AddRange(getJItem);
}
}
}
//// 获取得到的单选题、多选题、判断题 数量
int getDiffTestType1Count = sumTestType1Count - getTestTrainingItemList.Where(x => x.TestType == "1").Count();
int getDiffTestType2Count = sumTestType2Count - getTestTrainingItemList.Where(x => x.TestType == "2").Count();
int getDiffTestType3Count = sumTestType3Count - getTestTrainingItemList.Where(x => x.TestType == "3").Count();
if (getDiffTestType1Count > 0 || getDiffTestType2Count > 0 || getDiffTestType3Count > 0)
{
var getTestTrainingItemNulls = getTestTrainingItemALLs.Where(x => x.WorkPostIds == null).ToList();
if (getTestTrainingItemNulls.Count() > 0)
{
/// 通用且未选择的题目
var getTestTrainingItemDiffs = getTestTrainingItemNulls.Except(getTestTrainingItemList).ToList();
////单选题
if (getDiffTestType1Count > 0)
{
var getSItemD = getTestTrainingItemDiffs.Where(x => x.TestType == "1").OrderBy(x => Guid.NewGuid()).Take(getDiffTestType1Count);
if (getSItemD.Count() > 0)
{
getTestTrainingItemList.AddRange(getSItemD);
}
}
///多选题
if (getDiffTestType2Count > 0)
{
var getMItemD = getTestTrainingItemDiffs.Where(x => x.TestType == "2").OrderBy(x => Guid.NewGuid()).Take(getDiffTestType2Count);
if (getMItemD.Count() > 0)
{
getTestTrainingItemList.AddRange(getMItemD);
}
}
///判断题
if (getDiffTestType3Count > 0)
{
var getJItemD = getTestTrainingItemDiffs.Where(x => x.TestType == "3").OrderBy(x => Guid.NewGuid()).Take(getDiffTestType3Count);
if (getJItemD.Count() > 0)
{
getTestTrainingItemList.AddRange(getJItemD);
}
}
}
}
if (getTestTrainingItemList.Count() > 0)
{
var getItems = from x in getTestTrainingItemList
select new Model.Training_TestRecordItem
{
TestRecordItemId = SQLHelper.GetNewID(),
TestRecordId = getTestRecord.TestRecordId,
TrainingItemName = x.TrainingItemName,
TrainingItemCode = x.TrainingItemCode,
Abstracts = x.Abstracts,
AttachUrl = x.AttachUrl,
TestType = x.TestType,
AItem = x.AItem,
BItem = x.BItem,
CItem = x.CItem,
DItem = x.DItem,
EItem = x.EItem,
AnswerItems = x.AnswerItems,
Score = x.TestType == "1" ? sysTestRule.SValue : (x.TestType == "2" ? sysTestRule.MValue : sysTestRule.JValue),
};
db.Training_TestRecordItem.InsertAllOnSubmit(getItems);
db.SubmitChanges();
BLL.RedisHelper redis = new BLL.RedisHelper();
redis.SetObjString(testRecordId, getItems);
}
}
}
return testRecordId;
}
#region PersonIdTestPlanId生成试卷
/// <summary>
/// 根据PersonId、TestPlanId生成试卷 扫码生成试卷

View File

@ -33,8 +33,9 @@ namespace BLL
newCompanyTrainingItem.AttachUrl = companyTrainingItem.AttachUrl;
newCompanyTrainingItem.CompileMan = companyTrainingItem.CompileMan;
newCompanyTrainingItem.CompileDate = companyTrainingItem.CompileDate;
newCompanyTrainingItem.LearningTime = companyTrainingItem.LearningTime;
db.Training_CompanyTrainingItem.InsertOnSubmit(newCompanyTrainingItem);
newCompanyTrainingItem.LearningTime = companyTrainingItem.LearningTime;
newCompanyTrainingItem.TestTrainingIds = companyTrainingItem.TestTrainingIds;
db.Training_CompanyTrainingItem.InsertOnSubmit(newCompanyTrainingItem);
db.SubmitChanges();
}
@ -52,8 +53,11 @@ namespace BLL
newCompanyTrainingItem.AttachUrl = companyTrainingItem.AttachUrl;
newCompanyTrainingItem.CompileMan = companyTrainingItem.CompileMan;
newCompanyTrainingItem.CompileDate = companyTrainingItem.CompileDate;
newCompanyTrainingItem.LearningTime = companyTrainingItem.LearningTime;
db.SubmitChanges();
newCompanyTrainingItem.LearningTime = companyTrainingItem.LearningTime;
newCompanyTrainingItem.TestTrainingIds = companyTrainingItem.TestTrainingIds;
db.SubmitChanges();
}
}

View File

@ -44,6 +44,20 @@
<f:NumberBox ID="txtLearningTime" Label="时长(分钟)" runat="server" DecimalPrecision="0" NoDecimal="true" NoNegative="true" ></f:NumberBox>
</Items>
</f:FormRow>
<f:FormRow>
<Items>
<f:DropDownBox runat="server" ID="ddTestTraining" Label="考试题库" EnableMultiSelect="true" CustomData="true">
<PopPanel>
<f:Tree ID="treeTestTraining" ShowHeader="false" Hidden="true" runat="server" EnableCheckBox="true" CascadeCheck="true">
</f:Tree>
</PopPanel>
<Listeners>
<f:Listener Event="poppanelshow" Handler="onPopPanelShow" />
</Listeners>
</f:DropDownBox>
</Items>
</f:FormRow>
</Rows>
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Bottom" ToolbarAlign="Right" runat="server">
@ -72,4 +86,46 @@
</f:Window>
</form>
</body>
<script>
var ddTestTraining = '<%= ddTestTraining.ClientID %>';
var treeTestTraining = '<%= treeTestTraining.ClientID %>';
function onPopPanelShow(event) {
var nodes = this.getValue();
F.noEvent(function () {
// 第二个参数true是否递归调用子节点
F(treeTestTraining).checkNodes(nodes, true);
// 启用树控件的级联选择时,确保把树控件的选中值全部同步到下拉框
syncToDropDownBox();
});
}
// 将树控件的选中值同步到下拉框
function syncToDropDownBox() {
var values = [], texts = [];
var checkedNodes = F(treeTestTraining).getCheckedNodes(true);
$.each(checkedNodes, function (index, node) {
debugger;
values.push(node.id);
texts.push(node.text);
});
F(ddTestTraining).setValue(values, texts);
}
F.ready(function () {
F(treeTestTraining).on('nodecheck', function (event, nodeId, checked) {
// 加个延迟,等待复选框的级联选择完成
window.setTimeout(function () {
syncToDropDownBox();
});
});
});
</script>
</html>

View File

@ -2,6 +2,8 @@
using System.Linq;
using Model;
using BLL;
using System.Collections.Generic;
using Microsoft.Office.Interop.Excel;
namespace FineUIPro.Web.HSSE.EduTrain
{
@ -46,7 +48,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
{
this.GetButtonPower();
btnClose.OnClientClick = ActiveWindow.GetHideReference();
BoundTree(treeTestTraining.Nodes, "0");
this.CompanyTrainingItemId = Request.QueryString["CompanyTrainingItemId"];
this.CompanyTrainingId = Request.QueryString["CompanyTrainingId"];
if (!string.IsNullOrEmpty(this.CompanyTrainingItemId))
@ -59,6 +61,21 @@ namespace FineUIPro.Web.HSSE.EduTrain
txtCompanyTrainingItemName.Text = q.CompanyTrainingItemName;
txtCompileMan.Text = q.CompileMan;
hdCompileMan.Text = q.CompileMan;
if (!string.IsNullOrEmpty(q.TestTrainingIds))
{
ddTestTraining.Values = q.TestTrainingIds.Split(',');
string text = "";
var trains = Funs.DB.Training_TestTraining.ToList();
foreach (var ids in ddTestTraining.Values)
{
var t = trains.FirstOrDefault(x => x.TrainingId == ids);
if (t != null)
{
text += "[" + t.TrainingCode + "]" + t.TrainingName + ",";
}
}
ddTestTraining.Text = text.TrimEnd(new char[] { ',' });
}
if (q.LearningTime.HasValue)
{
txtLearningTime.Text = (q.LearningTime.Value/60).ToString();
@ -81,10 +98,49 @@ namespace FineUIPro.Web.HSSE.EduTrain
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
}
}
}
}
#endregion
private List<Model.Training_TestTraining> GetNewTraining(string parentId)
{
return (from x in Funs.DB.Training_TestTraining
where x.SupTrainingId == parentId
orderby x.TrainingCode
select x).ToList();
}
private void BoundTree(TreeNodeCollection nodes, string parentId)
{
var dt = GetNewTraining(parentId);
if (dt.Count() > 0)
{
TreeNode tn = null;
foreach (var dr in dt)
{
string name = dr.TrainingName;
if (!string.IsNullOrEmpty(dr.TrainingCode))
{
name = "[" + dr.TrainingCode + "]" + dr.TrainingName;
}
tn = new TreeNode
{
Text = name,
NodeID = dr.TrainingId,
EnableClickEvent = true,
ToolTip = dr.TrainingName
};
nodes.Add(tn);
///是否存在下级节点
var sup = Funs.DB.Training_TestTraining.FirstOrDefault(x => x.SupTrainingId == tn.NodeID);
if (sup != null)
{
BoundTree(tn.Nodes, tn.NodeID);
}
}
}
}
#region
/// <summary>
/// 保存数据
@ -97,7 +153,11 @@ namespace FineUIPro.Web.HSSE.EduTrain
CompanyTrainingItemName = this.txtCompanyTrainingItemName.Text.Trim(),
CompileMan = hdCompileMan.Text.Trim()
};
if (!string.IsNullOrEmpty(txtLearningTime.Text))
if (ddTestTraining.Values != null && ddTestTraining.Values.Length > 0)
{
newCompanyTrainItem.TestTrainingIds = string.Join(",", ddTestTraining.Values);
}
if (!string.IsNullOrEmpty(txtLearningTime.Text))
{
newCompanyTrainItem.LearningTime = int.Parse(txtLearningTime.Text)*60;
}

View File

@ -11,151 +11,169 @@ namespace FineUIPro.Web.HSSE.EduTrain
{
public partial class CompanyTrainingItemSave
{
public partial class CompanyTrainingItemSave
{
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// form1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// PageManager1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.PageManager PageManager1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// SimpleForm1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Form SimpleForm1;
/// <summary>
/// txtCompanyTrainingItemCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCompanyTrainingItemCode;
/// <summary>
/// txtCompanyTrainingItemCode 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCompanyTrainingItemCode;
/// <summary>
/// txtCompanyTrainingItemName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCompanyTrainingItemName;
/// <summary>
/// txtCompanyTrainingItemName 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCompanyTrainingItemName;
/// <summary>
/// txtCompileMan 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCompileMan;
/// <summary>
/// txtCompileMan 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.TextBox txtCompileMan;
/// <summary>
/// txtCompileDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtCompileDate;
/// <summary>
/// txtCompileDate 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DatePicker txtCompileDate;
/// <summary>
/// txtLearningTime 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtLearningTime;
/// <summary>
/// txtLearningTime 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.NumberBox txtLearningTime;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// ddTestTraining 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownBox ddTestTraining;
/// <summary>
/// lbTemp 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lbTemp;
/// <summary>
/// treeTestTraining 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Tree treeTestTraining;
/// <summary>
/// btnAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAttachUrl;
/// <summary>
/// Toolbar1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar1;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// lbTemp 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Label lbTemp;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// btnAttachUrl 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAttachUrl;
/// <summary>
/// btnClose 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnClose;
/// <summary>
/// ToolbarFill1 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.ToolbarFill ToolbarFill1;
/// <summary>
/// hdCompileMan 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdCompileMan;
/// <summary>
/// btnSave 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnSave;
/// <summary>
/// WindowAtt 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
}
/// <summary>
/// btnClose 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnClose;
/// <summary>
/// hdCompileMan 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.HiddenField hdCompileMan;
/// <summary>
/// WindowAtt 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Window WindowAtt;
}
}

View File

@ -119,6 +119,7 @@
// 返回false来阻止浏览器右键菜单
function onTreeNodeContextMenu(event, nodeId) {
debugger
currentNodeId = nodeId;
F(menuID).show();
return false;

View File

@ -267,7 +267,7 @@ namespace FineUIPro.Web.ProjectData
/// <param name="e"></param>
protected void btnMenuAdd_Click(object sender, EventArgs e)
{
if (this.trProjects.SelectedNode != null)
if (this.trProjects.SelectedNode != null && this.trProjects.SelectedNode.CommandName == "project")
{
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectInstallationMenuId, BLL.Const.BtnAdd))
{
@ -289,6 +289,10 @@ namespace FineUIPro.Web.ProjectData
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
else if (this.trProjects.SelectedNode != null && this.trProjects.SelectedNode.CommandName != "project")
{
ShowNotify("装置只能录入一级!", MessageBoxIcon.Warning);
}
else
{
ShowNotify("请选择树节点!", MessageBoxIcon.Warning);

View File

@ -34,14 +34,31 @@ namespace FineUIPro.Web.SysManage
// this.btnArrowRefresh.Hidden = false;
//}
/// TAB1加载页面方法
this.LoadTab1Data();
try
{
this.LoadTab1Data();
}
catch (Exception e1) { }
ConstValue.InitConstValueDropDownList(this.drpSuperMenu, this.rblMenuType.SelectedValue, true);
/// TAB2加载页面方法
this.LoadTab2Data();
try
{
this.LoadTab2Data();
}
catch (Exception e1) { }
/// TAB2加载页面方法
this.LoadTab3Data();
try
{
this.LoadTab3Data();
}
catch (Exception e1) { }
///产值
this.LoadTab4Data();
try
{
this.LoadTab4Data();
}
catch (Exception e1) { }
}
}
#region

View File

@ -22,7 +22,7 @@ namespace Model
using System;
public partial class SGGLDB : System.Data.Linq.DataContext
public partial class SGGLDB : System.Data.Linq.DataContext
{
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();
@ -365195,6 +365195,8 @@ namespace Model
private System.Nullable<int> _LearningTime;
private string _TestTrainingIds;
private EntitySet<Person_TrainingTask> _Person_TrainingTask;
private EntityRef<Training_CompanyTraining> _Training_CompanyTraining;
@ -365221,6 +365223,8 @@ namespace Model
partial void OnWorkPostIdsChanged();
partial void OnLearningTimeChanging(System.Nullable<int> value);
partial void OnLearningTimeChanged();
partial void OnTestTrainingIdsChanging(string value);
partial void OnTestTrainingIdsChanged();
#endregion
public Training_CompanyTrainingItem()
@ -365414,6 +365418,26 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_TestTrainingIds", DbType="NVarChar(MAX)", UpdateCheck=UpdateCheck.Never)]
public string TestTrainingIds
{
get
{
return this._TestTrainingIds;
}
set
{
if ((this._TestTrainingIds != value))
{
this.OnTestTrainingIdsChanging(value);
this.SendPropertyChanging();
this._TestTrainingIds = value;
this.SendPropertyChanged("TestTrainingIds");
this.OnTestTrainingIdsChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Person_TrainingTask_Training_CompanyTrainingItem", Storage="_Person_TrainingTask", ThisKey="CompanyTrainingItemId", OtherKey="CompanyTrainingItemId", DeleteRule="NO ACTION")]
public EntitySet<Person_TrainingTask> Person_TrainingTask
{
@ -369018,6 +369042,8 @@ namespace Model
private string _Fingerprint;
private string _CompanyTrainingItemId;
private EntityRef<Training_TestPlan> _Training_TestPlan;
private EntitySet<Training_TestRecordItem> _Training_TestRecordItem;
@ -369052,6 +369078,8 @@ namespace Model
partial void OnSignatureChanged();
partial void OnFingerprintChanging(string value);
partial void OnFingerprintChanged();
partial void OnCompanyTrainingItemIdChanging(string value);
partial void OnCompanyTrainingItemIdChanged();
#endregion
public Training_TestRecord()
@ -369325,6 +369353,26 @@ namespace Model
}
}
[global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_CompanyTrainingItemId", DbType="NVarChar(50)")]
public string CompanyTrainingItemId
{
get
{
return this._CompanyTrainingItemId;
}
set
{
if ((this._CompanyTrainingItemId != value))
{
this.OnCompanyTrainingItemIdChanging(value);
this.SendPropertyChanging();
this._CompanyTrainingItemId = value;
this.SendPropertyChanged("CompanyTrainingItemId");
this.OnCompanyTrainingItemIdChanged();
}
}
}
[global::System.Data.Linq.Mapping.AssociationAttribute(Name="FK_Training_TestRecord_Training_TestPlan", Storage="_Training_TestPlan", ThisKey="TestPlanId", OtherKey="TestPlanId", IsForeignKey=true)]
public Training_TestPlan Training_TestPlan
{

View File

@ -308,5 +308,59 @@ namespace WebAPI.Controllers
return responeData;
}
#endregion
public Model.ResponeData getTrainingPlanTestRecordItemByTestPlanIdPersonId(string companyTrainingItemId, string personId,string projectId)
{
var responeData = new Model.ResponeData();
try
{
using (var db = new Model.SGGLDB(Funs.ConnString))
{
var getCompanyTraining = db.Training_CompanyTrainingItem.FirstOrDefault(e => e.CompanyTrainingItemId == companyTrainingItemId );
if (getCompanyTraining != null)
{
var user = db.Sys_User.FirstOrDefault(x => x.UserId == personId);
Model.SitePerson_Person person;
if (user != null)
{
person = db.SitePerson_Person.FirstOrDefault(e => (e.PersonId == personId || e.IdentityCard == user.IdentityCard) && e.ProjectId == projectId);// PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId);
}
else
{
person = db.SitePerson_Person.FirstOrDefault(e => e.PersonId == personId && e.ProjectId == projectId);// PersonService.GetPersonByUserId(personId, getTestPlan.ProjectId);
}
if (person != null || user != null)
{
var testRecord = db.Training_TestRecord.FirstOrDefault(x => x.CompanyTrainingItemId == getCompanyTraining.CompanyTrainingItemId && x.TestManId == personId && !x.TestEndTime.HasValue);
if (testRecord != null)
{
string testRecordId = APITestRecordService.CreateTestRecordItem(getCompanyTraining, testRecord.TestRecordId, person, user);
responeData.code = 2;
responeData.data = new { testRecordId };
}
else if (person != null)
{
var testRecord2 = db.Training_TestRecord.FirstOrDefault(x => x.CompanyTrainingItemId == getCompanyTraining.CompanyTrainingItemId && x.TestManId == person.PersonId && !x.TestEndTime.HasValue);
if (testRecord2 != null)
{
string testRecordId = APITestRecordService.CreateTestRecordItem(getCompanyTraining, testRecord2.TestRecordId, person, user);
responeData.code = 2;
responeData.data = new { testRecordId };
}
}
}
}
}
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
}
}