xiaochanghai 11 months ago
parent 91639be861
commit ce3b6a474e
  1. 8
      Model/Tiobon.Web.pdm
  2. 2
      Tiobon.Core.Api/Tiobon.Core.Model.xml
  3. 21
      Tiobon.Core.Model/Base/Ghre/Ghre_StudyRule.Dto.Base.cs
  4. 14
      Tiobon.Core.Model/Edit/Ghre/Ghre_StudyRule.Dto.EditInput.cs
  5. 14
      Tiobon.Core.Model/Insert/Ghre/Ghre_StudyRule.Dto.InsertInput.cs
  6. 17
      Tiobon.Core.Model/Models/Ghre/Ghre_StudyRule.cs
  7. 16
      Tiobon.Core.Model/View/Ghre/Ghre_StudyRule.Dto.View.cs
  8. 115
      Tiobon.Core.Services/Ghre/Ghre_StudyRuleServices.cs
  9. 2
      Tiobon.Core/Tiobon.Core.Model.xml

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?PowerDesigner AppLocale="UTF16" ID="{C294868A-C3F3-41AD-98CC-78B6D4E0CC40}" Label="" LastModificationDate="1723284422" Name="Tiobon" Objects="7364" Symbols="309" Target="Microsoft SQL Server 2008" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="15.0.0.2613"?>
<?PowerDesigner AppLocale="UTF16" ID="{C294868A-C3F3-41AD-98CC-78B6D4E0CC40}" Label="" LastModificationDate="1723284867" Name="Tiobon" Objects="7364" Symbols="309" Target="Microsoft SQL Server 2008" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="15.0.0.2613"?>
<!-- do not edit this file -->
<Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
@ -120972,11 +120972,11 @@ LABL 0 Arial Unicode MS,8,N</a:FontList>
<a:Code>Result</a:Code>
<a:CreationDate>1722403195</a:CreationDate>
<a:Creator>Administrator</a:Creator>
<a:ModificationDate>1722403297</a:ModificationDate>
<a:ModificationDate>1723284867</a:ModificationDate>
<a:Modifier>Administrator</a:Modifier>
<a:Comment>结果</a:Comment>
<a:DataType>nvarchar(256)</a:DataType>
<a:Length>256</a:Length>
<a:DataType>nvarchar(2000)</a:DataType>
<a:Length>2000</a:Length>
</o:Column>
<o:Column Id="o7532">
<a:ObjectID>2D5BA3A4-EFBB-4770-AFD6-9B40D4C4F2B6</a:ObjectID>

@ -4087,7 +4087,7 @@
</member>
<member name="T:Tiobon.Core.Model.Models.Ghre_StudyRuleBase">
<summary>
必选修规则 (Dto.Base)
Ghre_StudyRule (Dto.Base)
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRuleBase.RuleType">

@ -6,7 +6,7 @@
*
* Ver
*
*V0.01 2024/7/19 15:24:17 SimonHsiao
*V0.01 2024/8/10 18:11:53 SimonHsiao
*
* Copyright(c) 2024 Tiobon Corporation. All Rights Reserved.
*
@ -21,7 +21,7 @@ namespace Tiobon.Core.Model.Models
{
/// <summary>
/// 必选修规则 (Dto.Base)
/// Ghre_StudyRule (Dto.Base)
/// </summary>
public class Ghre_StudyRuleBase
{
@ -51,27 +51,32 @@ namespace Tiobon.Core.Model.Models
/// <summary>
/// 厂区
/// </summary>
public int? ZoneId { get; set; }
[Display(Name = "ZoneId"), Description("厂区"), MaxLength(2000, ErrorMessage = "厂区 不能超过 2000 个字符")]
public string ZoneId { get; set; }
/// <summary>
/// 部门
/// </summary>
public int? DeptId { get; set; }
[Display(Name = "DeptId"), Description("部门"), MaxLength(2000, ErrorMessage = "部门 不能超过 2000 个字符")]
public string DeptId { get; set; }
/// <summary>
/// 职称
/// </summary>
public int? TitleId { get; set; }
[Display(Name = "TitleId"), Description("职称"), MaxLength(2000, ErrorMessage = "职称 不能超过 2000 个字符")]
public string TitleId { get; set; }
/// <summary>
/// 职等
/// </summary>
public int? GradeId { get; set; }
[Display(Name = "GradeId"), Description("职等"), MaxLength(2000, ErrorMessage = "职等 不能超过 2000 个字符")]
public string GradeId { get; set; }
/// <summary>
/// 岗位
/// </summary>
public int? JobId { get; set; }
[Display(Name = "JobId"), Description("岗位"), MaxLength(2000, ErrorMessage = "岗位 不能超过 2000 个字符")]
public string JobId { get; set; }
/// <summary>
/// 年度
@ -93,7 +98,7 @@ namespace Tiobon.Core.Model.Models
/// <summary>
/// 结果
/// </summary>
[Display(Name = "Result"), Description("结果"), MaxLength(2000, ErrorMessage = "结果 不能超过 256 个字符")]
[Display(Name = "Result"), Description("结果"), MaxLength(256, ErrorMessage = "结果 不能超过 256 个字符")]
public string Result { get; set; }
/// <summary>

@ -23,4 +23,18 @@ namespace Tiobon.Core.Model.Models;
public class EditGhre_StudyRuleInput : Ghre_StudyRuleBase
{
public List<int> Staffs { get; set; }
public List<int> ZoneIds { get; set; }
public List<int> DeptIds { get; set; }
public List<int> TitleIds { get; set; }
public List<int> GradeIds { get; set; }
public List<int> JobIds { get; set; }
}

@ -23,4 +23,18 @@ namespace Tiobon.Core.Model.Models;
public class InsertGhre_StudyRuleInput : Ghre_StudyRuleBase
{
public List<int> Staffs { get; set; }
public List<int> ZoneIds { get; set; }
public List<int> DeptIds { get; set; }
public List<int> TitleIds { get; set; }
public List<int> GradeIds { get; set; }
public List<int> JobIds { get; set; }
}

@ -6,7 +6,7 @@
*
* Ver
*
*V0.01 2024/7/19 15:24:17 SimonHsiao
*V0.01 2024/8/10 18:11:53 SimonHsiao
*
* Copyright(c) 2024 Tiobon Corporation. All Rights Reserved.
*
@ -53,27 +53,32 @@ namespace Tiobon.Core.Model.Models
/// <summary>
/// 厂区
/// </summary>
public int? ZoneId { get; set; }
[Display(Name = "ZoneId"), Description("厂区"), MaxLength(2000, ErrorMessage = "厂区 不能超过 2000 个字符")]
public string ZoneId { get; set; }
/// <summary>
/// 部门
/// </summary>
public int? DeptId { get; set; }
[Display(Name = "DeptId"), Description("部门"), MaxLength(2000, ErrorMessage = "部门 不能超过 2000 个字符")]
public string DeptId { get; set; }
/// <summary>
/// 职称
/// </summary>
public int? TitleId { get; set; }
[Display(Name = "TitleId"), Description("职称"), MaxLength(2000, ErrorMessage = "职称 不能超过 2000 个字符")]
public string TitleId { get; set; }
/// <summary>
/// 职等
/// </summary>
public int? GradeId { get; set; }
[Display(Name = "GradeId"), Description("职等"), MaxLength(2000, ErrorMessage = "职等 不能超过 2000 个字符")]
public string GradeId { get; set; }
/// <summary>
/// 岗位
/// </summary>
public int? JobId { get; set; }
[Display(Name = "JobId"), Description("岗位"), MaxLength(2000, ErrorMessage = "岗位 不能超过 2000 个字符")]
public string JobId { get; set; }
/// <summary>
/// 年度

@ -45,4 +45,20 @@ public class Ghre_StudyRuleDto : Ghre_StudyRule
public string StaffNames { get; set; }
public List<int> Staffs { get; set; }
public List<int> ZoneIds { get; set; } = new List<int>();
public List<int> DeptIds { get; set; } = new List<int>();
public List<int> TitleIds { get; set; } = new List<int>();
public List<int> GradeIds { get; set; } = new List<int>();
public List<int> JobIds { get; set; } = new List<int>();
}

@ -14,6 +14,8 @@ using SqlSugar;
using MathNet.Numerics.Distributions;
using MongoDB.Driver.Linq;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using System.Data;
using System.Collections.Generic;
namespace Tiobon.Core.Services;
@ -49,9 +51,9 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
if (filter.pageSize == 0)
filter.pageSize = 10000;
var countSql = @$" SELECT COUNT(1) FROM Ghre_StudyRule";
var countSql = @$" SELECT COUNT(1) FROM Ghre_StudyRule_v";
var sql = @$" SELECT *
FROM Ghre_StudyRule A";
FROM Ghre_StudyRule_v A";
string conditions = " WHERE 1=1 ";
@ -113,11 +115,43 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
var ids = entitys.Select(x => x.Id).ToList();
var staffs = await _ghre_StudyRuleStaffServices.Query(x => x.StudyRuleId != null && ids.Contains(x.StudyRuleId.Value));
entitys.ForEach(x =>
var zoneIds = new List<int>();
var deptIds = new List<int>();
var titleIds = new List<int>();
var gradeIds = new List<int>();
var jobIds = new List<int>();
entitys.ForEach(rule =>
{
x.StaffNames = string.Join(",", staffs.Where(o => o.StudyRuleId == x.Id).Select(o => o.StaffName));
rule.StaffNames = string.Join(",", staffs.Where(o => o.StudyRuleId == rule.Id).Select(o => o.StaffName));
if (!rule.ZoneId.IsNull())
rule.ZoneIds = JsonHelper.JsonToObj<List<int>>(rule.ZoneId);
if (!rule.DeptId.IsNull())
rule.DeptIds = JsonHelper.JsonToObj<List<int>>(rule.DeptId);
if (!rule.TitleId.IsNull())
rule.TitleIds = JsonHelper.JsonToObj<List<int>>(rule.TitleId);
if (!rule.GradeId.IsNull())
rule.GradeIds = JsonHelper.JsonToObj<List<int>>(rule.GradeId);
if (!rule.JobId.IsNull())
rule.JobIds = JsonHelper.JsonToObj<List<int>>(rule.JobId);
if (rule.ZoneIds.Any())
zoneIds.AddRange(rule.ZoneIds);
if (rule.DeptIds.Any())
deptIds.AddRange(rule.DeptIds);
if (rule.TitleIds.Any())
titleIds.AddRange(rule.TitleIds);
if (rule.GradeIds.Any())
gradeIds.AddRange(rule.GradeIds);
if (rule.JobIds.Any())
jobIds.AddRange(rule.JobIds);
});
return new ServicePageResult<Ghre_StudyRuleDto>(filter.pageNum, total, filter.pageSize, entitys);
}
@ -125,6 +159,18 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
public override async Task<long> Add(InsertGhre_StudyRuleInput entity)
{
if (!entity.ZoneIds.IsNull() && entity.ZoneIds.Any())
entity.ZoneId = JsonHelper.ObjToJson(entity.ZoneIds);
if (!entity.DeptIds.IsNull() && entity.DeptIds.Any())
entity.DeptId = JsonHelper.ObjToJson(entity.DeptIds);
if (!entity.TitleIds.IsNull() && entity.TitleIds.Any())
entity.TitleId = JsonHelper.ObjToJson(entity.TitleIds);
if (!entity.GradeIds.IsNull() && entity.GradeIds.Any())
entity.GradeId = JsonHelper.ObjToJson(entity.GradeIds);
if (!entity.JobIds.IsNull() && entity.JobIds.Any())
entity.JobId = JsonHelper.ObjToJson(entity.JobIds);
var result = await base.Add(entity);
if (entity.Staffs != null && entity.Staffs.Any())
@ -147,15 +193,27 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
return result;
}
public override async Task<bool> Update(long Id, EditGhre_StudyRuleInput editModel)
public override async Task<bool> Update(long Id, EditGhre_StudyRuleInput entity)
{
var result = await base.Update(Id, editModel);
if (!entity.ZoneIds.IsNull() && entity.ZoneIds.Any())
entity.ZoneId = JsonHelper.ObjToJson(entity.ZoneIds);
if (!entity.DeptIds.IsNull() && entity.DeptIds.Any())
entity.DeptId = JsonHelper.ObjToJson(entity.DeptIds);
if (!entity.TitleIds.IsNull() && entity.TitleIds.Any())
entity.TitleId = JsonHelper.ObjToJson(entity.TitleIds);
if (!entity.GradeIds.IsNull() && entity.GradeIds.Any())
entity.GradeId = JsonHelper.ObjToJson(entity.GradeIds);
if (!entity.JobIds.IsNull() && entity.JobIds.Any())
entity.JobId = JsonHelper.ObjToJson(entity.JobIds);
var result = await base.Update(Id, entity);
await _ghre_StudyRuleStaffServices.Delete(x => x.StudyRuleId == Id);
if (editModel.Staffs != null && editModel.Staffs.Any())
if (!entity.IsNull() && entity.Staffs.Any())
{
var insertStaffs = editModel.Staffs.Select(x => new InsertGhre_StudyRuleStaffInput
var insertStaffs = entity.Staffs.Select(x => new InsertGhre_StudyRuleStaffInput
{
StaffId = x,
StudyRuleId = Id
@ -183,9 +241,19 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
var staffs = await _ghre_StudyRuleStaffServices.Query(x => x.StudyRuleId != null && x.StudyRuleId == result.result.DT_TableDataT1[0].Id);
var DT_TableDataT1 = result.result.DT_TableDataT1;
DT_TableDataT1.ForEach(t =>
DT_TableDataT1.ForEach(rule =>
{
t.Staffs = staffs.Where(x => x.StaffId != null).Select(x => x.StaffId.Value).ToList();
rule.Staffs = staffs.Where(x => x.StaffId != null).Select(x => x.StaffId.Value).ToList();
if (!rule.ZoneId.IsNull())
rule.ZoneIds = JsonHelper.JsonToObj<List<int>>(rule.ZoneId);
if (!rule.DeptId.IsNull())
rule.DeptIds = JsonHelper.JsonToObj<List<int>>(rule.DeptId);
if (!rule.TitleId.IsNull())
rule.TitleIds = JsonHelper.JsonToObj<List<int>>(rule.TitleId);
if (!rule.GradeId.IsNull())
rule.GradeIds = JsonHelper.JsonToObj<List<int>>(rule.GradeId);
if (!rule.JobId.IsNull())
rule.JobIds = JsonHelper.JsonToObj<List<int>>(rule.JobId);
});
result.result.DT_TableDataT1 = DT_TableDataT1;
@ -201,6 +269,22 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
var rule = await Db.Queryable<Ghre_StudyRule>().FirstAsync(x => x.Id == ruleId);
var ZoneIds = new List<int?>();
var DeptIds = new List<int?>();
var TitleIds = new List<int?>();
var GradeIds = new List<int?>();
var JobIds = new List<int?>();
if (!rule.ZoneId.IsNull())
ZoneIds = JsonHelper.JsonToObj<List<int?>>(rule.ZoneId);
if (!rule.DeptId.IsNull())
DeptIds = JsonHelper.JsonToObj<List<int?>>(rule.DeptId);
if (!rule.TitleId.IsNull())
TitleIds = JsonHelper.JsonToObj<List<int?>>(rule.TitleId);
if (!rule.GradeId.IsNull())
GradeIds = JsonHelper.JsonToObj<List<int?>>(rule.GradeId);
if (!rule.JobId.IsNull())
JobIds = JsonHelper.JsonToObj<List<int?>>(rule.JobId);
var ruleStaffs = await Db.Queryable<Ghre_StudyRuleStaff>().Where(x => x.StudyRuleId == ruleId).ToListAsync();
await Db.Updateable<Ghre_StudyRuleResult>().Where(x => x.StudyRuleId == ruleId && x.IsEnable == 1)
@ -211,13 +295,12 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul
var staffs = await Db.Queryable<Ghra_Staff>()
.Where(x => x.OutDate == null || (x.OutDate != null && x.Indate != null && x.Indate.Value.Date <= DateTime.Now.Date && x.Indate.Value.Date >= DateTime.Now.Date))
.WhereIF(!rule.ZoneId.IsNull(), x => x.ZoneID == rule.ZoneId)
.WhereIF(!rule.DeptId.IsNull(), x => x.DeptID == rule.DeptId)
.WhereIF(!rule.TitleId.IsNull(), x => x.TitleID == rule.TitleId)
.WhereIF(!rule.GradeId.IsNull(), x => x.GradeID == rule.GradeId)
.WhereIF(!rule.JobId.IsNull(), x => x.JobID == rule.JobId)
.WhereIF(ZoneIds.Any(), x => ZoneIds.Contains(x.ZoneID))
.WhereIF(DeptIds.Any(), x => DeptIds.Contains(x.DeptID))
.WhereIF(TitleIds.Any(), x => TitleIds.Contains(x.TitleID))
.WhereIF(GradeIds.Any(), x => GradeIds.Contains(x.GradeID))
.WhereIF(JobIds.Any(), x => JobIds.Contains(x.JobID))
.WhereIF(!ruleStaffIds.IsNull() && ruleStaffIds.Any(), x => ruleStaffIds.Contains(x.StaffID))
.WhereIF(!rule.GradeId.IsNull(), x => x.GradeID == rule.GradeId)
.ToListAsync();
if (!staffs.IsNull())

@ -4087,7 +4087,7 @@
</member>
<member name="T:Tiobon.Core.Model.Models.Ghre_StudyRuleBase">
<summary>
必选修规则 (Dto.Base)
Ghre_StudyRule (Dto.Base)
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRuleBase.RuleType">

Loading…
Cancel
Save