新疆油建优化

This commit is contained in:
2026-09-02 14:36:26 +08:00
parent 75df99e219
commit 13fa72ab8c
9 changed files with 57 additions and 57 deletions
+5 -5
View File
@@ -129,11 +129,11 @@ namespace BLL
////及格分数 ////及格分数
int passScore = 80; int passScore = 80;
var testRule = db.Sys_TestRule.FirstOrDefault(); //var testRule = db.Sys_TestRule.FirstOrDefault();
if (testRule != null) //if (testRule != null)
{ //{
passScore = testRule.PassingScore; // passScore = testRule.PassingScore;
} //}
foreach (var item in getTrainingTasks) foreach (var item in getTrainingTasks)
{ {
+5 -5
View File
@@ -159,11 +159,11 @@
public static int getPassScore() public static int getPassScore()
{ {
int passScore = 80; int passScore = 80;
var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); //var testRule = Funs.DB.Sys_TestRule.FirstOrDefault();
if (testRule != null) //if (testRule != null)
{ //{
passScore = testRule.PassingScore; // passScore = testRule.PassingScore;
} //}
return passScore; return passScore;
} }
@@ -94,10 +94,10 @@ namespace FineUIPro.Web.HSSE.EduTrain
this.BindGrid(); this.BindGrid();
this.GetButtonPower(); this.GetButtonPower();
if (string.IsNullOrEmpty(this.ProjectId)) //if (string.IsNullOrEmpty(this.ProjectId))
{ //{
btnNew.Hidden = true; this.btnNew.Hidden = true;
} //}
} }
#region #region
/// <summary> /// <summary>
@@ -55,7 +55,10 @@ namespace FineUIPro.Web.HSSE.EduTrain
{ {
this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.ProjectId = this.CurrUser.LoginProjectId; this.ProjectId = this.CurrUser.LoginProjectId;
this.InitDropDownList(); if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
{
this.ProjectId = Request.Params["projectId"];
}
this.PlanId = Request.Params["PlanId"]; this.PlanId = Request.Params["PlanId"];
if (!string.IsNullOrEmpty(PlanId)) if (!string.IsNullOrEmpty(PlanId))
@@ -63,6 +66,8 @@ namespace FineUIPro.Web.HSSE.EduTrain
var trainingPlan = TrainingPlanService.GetPlanById(PlanId); var trainingPlan = TrainingPlanService.GetPlanById(PlanId);
if (trainingPlan != null) if (trainingPlan != null)
{ {
this.ProjectId = trainingPlan.ProjectId;
this.InitDropDownList();
this.txtPlanCode.Text = trainingPlan.PlanCode; this.txtPlanCode.Text = trainingPlan.PlanCode;
this.txtPlanName.Text = trainingPlan.PlanName; this.txtPlanName.Text = trainingPlan.PlanName;
@@ -91,7 +96,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
{ {
dpCompanyTraining.SelectedValueArray = planItem; dpCompanyTraining.SelectedValueArray = planItem;
} }
var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(this.CurrUser.LoginProjectId, trainingPlan.UnitIds, trainingPlan.WorkPostId, "", trainingPlan.TrainTypeId, "", "").OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(this.ProjectId, trainingPlan.UnitIds, trainingPlan.WorkPostId, "", trainingPlan.TrainTypeId, "", "").OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList();
dpSysUser.DataTextField = "PersonName"; dpSysUser.DataTextField = "PersonName";
dpSysUser.DataValueField = "PersonId"; dpSysUser.DataValueField = "PersonId";
dpSysUser.DataSource = getDataList; dpSysUser.DataSource = getDataList;
@@ -107,8 +112,9 @@ namespace FineUIPro.Web.HSSE.EduTrain
} }
else else
{ {
string code = ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId).ProjectCode + "-"; this.InitDropDownList();
txtPlanCode.Text = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", this.CurrUser.LoginProjectId, code); string code = ProjectService.GetProjectByProjectId(this.ProjectId).ProjectCode + "-";
txtPlanCode.Text = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", this.ProjectId, code);
} }
} }
} }
@@ -120,8 +126,8 @@ namespace FineUIPro.Web.HSSE.EduTrain
{ {
TrainTypeService.InitTrainTypeDropDownList(drpTrainType, true); TrainTypeService.InitTrainTypeDropDownList(drpTrainType, true);
TrainLevelService.InitTrainLevelDropDownList(drpTrainLevel, true); TrainLevelService.InitTrainLevelDropDownList(drpTrainLevel, true);
UnitService.InitUnitByProjectIdUnitTypeDropDownList1(dpUnit, this.CurrUser.LoginProjectId, false); UnitService.InitUnitByProjectIdUnitTypeDropDownList1(dpUnit, this.ProjectId, false);
WorkPostService.InitWorkPostByProjectIdDropDownList(dpWorkPost, this.CurrUser.LoginProjectId, false); WorkPostService.InitWorkPostByProjectIdDropDownList(dpWorkPost, this.ProjectId, false);
//var postIds = (from u in Funs.DB.SitePerson_Person //var postIds = (from u in Funs.DB.SitePerson_Person
// where u.ProjectId == CurrUser.LoginProjectId // where u.ProjectId == CurrUser.LoginProjectId
// select u.WorkPostId).Distinct(); // select u.WorkPostId).Distinct();
@@ -273,7 +279,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
var db = Funs.DB; var db = Funs.DB;
Model.Training_Plan trainingPlan = new Model.Training_Plan(); Model.Training_Plan trainingPlan = new Model.Training_Plan();
trainingPlan.ProjectId = this.CurrUser.LoginProjectId; trainingPlan.ProjectId = this.ProjectId;
trainingPlan.PlanName = this.txtPlanName.Text; trainingPlan.PlanName = this.txtPlanName.Text;
trainingPlan.PlanCode = this.txtPlanCode.Text; trainingPlan.PlanCode = this.txtPlanCode.Text;
trainingPlan.TrainContent = this.txtTrainContent.Text; trainingPlan.TrainContent = this.txtTrainContent.Text;
@@ -296,8 +302,8 @@ namespace FineUIPro.Web.HSSE.EduTrain
} }
if (string.IsNullOrEmpty(PlanId)) if (string.IsNullOrEmpty(PlanId))
{ {
//string code = ProjectService.GetProjectByProjectId(this.CurrUser.LoginProjectId).ProjectCode + "-"; //string code = ProjectService.GetProjectByProjectId(this.ProjectId).ProjectCode + "-";
//trainingPlan.PlanCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", this.CurrUser.LoginProjectId, code); //trainingPlan.PlanCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", this.ProjectId, code);
//trainingPlan.PlanCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectTrainingPlanMenuId, CurrUser.LoginProjectId, CurrUser.UnitId); //trainingPlan.PlanCode = CodeRecordsService.ReturnCodeByMenuIdProjectId(Const.ProjectTrainingPlanMenuId, CurrUser.LoginProjectId, CurrUser.UnitId);
trainingPlan.PlanId = SQLHelper.GetNewID(); trainingPlan.PlanId = SQLHelper.GetNewID();
@@ -474,7 +480,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
dpSysUser.Items.Clear(); dpSysUser.Items.Clear();
string unitIds = string.Join(",", dpUnit.SelectedValueArray); string unitIds = string.Join(",", dpUnit.SelectedValueArray);
string workPostIds = string.Join(",", dpWorkPost.SelectedValueArray); string workPostIds = string.Join(",", dpWorkPost.SelectedValueArray);
var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(this.CurrUser.LoginProjectId, unitIds, workPostIds, "", drpTrainType.SelectedValue, "", "").OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(this.ProjectId, unitIds, workPostIds, "", drpTrainType.SelectedValue, "", "").OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList();
dpSysUser.DataTextField = "PersonName"; dpSysUser.DataTextField = "PersonName";
dpSysUser.DataValueField = "PersonId"; dpSysUser.DataValueField = "PersonId";
dpSysUser.DataSource = getDataList; dpSysUser.DataSource = getDataList;
@@ -631,11 +631,11 @@ namespace FineUIPro.Web.HSSE.EduTrain
select x; select x;
////及格分数 ////及格分数
int passScore = 80; int passScore = 80;
var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); //var testRule = Funs.DB.Sys_TestRule.FirstOrDefault();
if (testRule != null) //if (testRule != null)
{ //{
passScore = testRule.PassingScore; // passScore = testRule.PassingScore;
} //}
foreach (var item in getTrainingTasks) foreach (var item in getTrainingTasks)
{ {
bool isInsert = true; bool isInsert = true;
@@ -232,7 +232,8 @@ namespace FineUIPro.Web.HSSE.EduTrain
&& x.TestPlanId == this.TestPlanId); && x.TestPlanId == this.TestPlanId);
if (getTestRecord.Count() > 0) if (getTestRecord.Count() > 0)
{ ////及格分数 { ////及格分数
int getPassScores = SysConstSetService.getPassScore(); int getPassScores = 80;
//int getPassScores = SysConstSetService.getPassScore();
var getOK = getTestRecord.FirstOrDefault(x => x.TestScores >= getPassScores); var getOK = getTestRecord.FirstOrDefault(x => x.TestScores >= getPassScores);
if (getOK != null) if (getOK != null)
{ {
@@ -520,11 +520,11 @@ namespace FineUIPro.Web.Person.EduTrain
select x; select x;
////及格分数 ////及格分数
int passScore = 80; int passScore = 80;
var testRule = Funs.DB.Sys_TestRule.FirstOrDefault(); //var testRule = Funs.DB.Sys_TestRule.FirstOrDefault();
if (testRule != null) //if (testRule != null)
{ //{
passScore = testRule.PassingScore; // passScore = testRule.PassingScore;
} //}
foreach (var item in getTrainingTasks) foreach (var item in getTrainingTasks)
{ {
bool isInsert = true; bool isInsert = true;
@@ -232,7 +232,8 @@ namespace FineUIPro.Web.Person.EduTrain
&& x.TestPlanId == this.TestPlanId); && x.TestPlanId == this.TestPlanId);
if (getTestRecord.Count() > 0) if (getTestRecord.Count() > 0)
{ ////及格分数 { ////及格分数
int getPassScores = SysConstSetService.getPassScore(); int getPassScores = 80;
//int getPassScores = SysConstSetService.getPassScore();
var getOK = getTestRecord.FirstOrDefault(x => x.TestScores >= getPassScores); var getOK = getTestRecord.FirstOrDefault(x => x.TestScores >= getPassScores);
if (getOK != null) if (getOK != null)
{ {
@@ -255,7 +255,7 @@ namespace WebAPI.Controllers
/// <param name="strParam">参数</param> /// <param name="strParam">参数</param>
/// <param name="pageIndex">页码</param> /// <param name="pageIndex">页码</param>
/// <returns>考试记录列表</returns> /// <returns>考试记录列表</returns>
public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string strPass,string strParam, int pageIndex) public Model.ResponeData getTrainingTestRecordListQuery(string projectId, string unitId, string workPostId, string strPass, string strParam, int pageIndex)
{ {
var responeData = new Model.ResponeData(); var responeData = new Model.ResponeData();
try try
@@ -336,7 +336,8 @@ namespace WebAPI.Controllers
////考试分数 ////考试分数
decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord); decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord);
////及格分数 ////及格分数
int getPassScores = SysConstSetService.getPassScore(); int getPassScores = 80;
//int getPassScores = SysConstSetService.getPassScore();
if (getTestScores <= getPassScores) if (getTestScores <= getPassScores)
{ {
int testCount = Funs.DB.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count(); int testCount = Funs.DB.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count();
@@ -388,7 +389,6 @@ namespace WebAPI.Controllers
#region #region
RedisHelper redis = new RedisHelper(); RedisHelper redis = new RedisHelper();
var trainingTestRecordItems = redis.GetObjString<List<Training_TestRecordItem>>(testRecordId); var trainingTestRecordItems = redis.GetObjString<List<Training_TestRecordItem>>(testRecordId);
if (trainingTestRecordItems != null) if (trainingTestRecordItems != null)
{ {
var modeltestRecordItem = from x in db.Training_TestRecordItem var modeltestRecordItem = from x in db.Training_TestRecordItem
@@ -403,7 +403,6 @@ namespace WebAPI.Controllers
} }
#endregion #endregion
var getTestRecord = db.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecordId); var getTestRecord = db.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecordId);
if (getTestRecord != null) if (getTestRecord != null)
{ {
@@ -431,17 +430,13 @@ namespace WebAPI.Controllers
if (!string.IsNullOrEmpty(Fingerprint)) if (!string.IsNullOrEmpty(Fingerprint))
{ {
Fingerprint = Fingerprint.Replace("data:image/svg+xml;base64,", "").Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "").Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", "");//将base64头部信息替换 Fingerprint = Fingerprint.Replace("data:image/svg+xml;base64,", "").Replace("data:image/png;base64,", "").Replace("data:image/jgp;base64,", "").Replace("data:image/jpg;base64,", "").Replace("data:image/jpeg;base64,", "");//将base64头部信息替换
byte[] bytes = Convert.FromBase64String(Fingerprint); byte[] bytes = Convert.FromBase64String(Fingerprint);
MemoryStream memStream = new MemoryStream(bytes); MemoryStream memStream = new MemoryStream(bytes);
Image mImage = Image.FromStream(memStream); Image mImage = Image.FromStream(memStream);
Bitmap bp = new Bitmap(mImage); Bitmap bp = new Bitmap(mImage);
MemoryStream ms = new MemoryStream(); MemoryStream ms = new MemoryStream();
bp.Save(Fingerprintfilename, System.Drawing.Imaging.ImageFormat.Png); bp.Save(Fingerprintfilename, System.Drawing.Imaging.ImageFormat.Png);
getTestRecord.Fingerprint = Fingerprintfilename.Replace(rootUrl, ""); getTestRecord.Fingerprint = Fingerprintfilename.Replace(rootUrl, "");
} }
db.SubmitChanges(); db.SubmitChanges();
// APITestRecordService.updateTestRecord(getTestRecord); // APITestRecordService.updateTestRecord(getTestRecord);
@@ -449,14 +444,14 @@ namespace WebAPI.Controllers
////考试分数 ////考试分数
decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord); decimal getTestScores = APITestRecordService.getSubmitTestRecord(getTestRecord);
if (!string.IsNullOrEmpty(getTestRecord.TestPlanId))
{ ////及格分数
int getPassScores = 80; int getPassScores = 80;
var testRule = db.Sys_TestRule.FirstOrDefault(); if (!string.IsNullOrEmpty(getTestRecord.TestPlanId))
if (testRule != null) {////及格分数
{ //var testRule = db.Sys_TestRule.FirstOrDefault();
getPassScores = testRule.PassingScore; //if (testRule != null)
} //{
// getPassScores = testRule.PassingScore;
//}
if (getTestScores <= getPassScores) if (getTestScores <= getPassScores)
{ {
int testCount = db.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count(); int testCount = db.Training_TestRecord.Where(x => x.TestPlanId == getTestRecord.TestPlanId && x.TestManId == getTestRecord.TestManId).Count();
@@ -478,14 +473,11 @@ namespace WebAPI.Controllers
responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。"; responeData.message = "恭喜考试通过!您的成绩为:【" + getTestScores.ToString() + "】。";
} }
responeData.data = new { getTestScores, getPassScores, returnTestRecordId }; responeData.data = new { getTestScores, getPassScores, returnTestRecordId };
} }
else else
{ {
responeData.data = new { getTestScores }; responeData.data = new { getTestScores, getPassScores };
} }
} }
} }
} }