spDbContext.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. using Microsoft.EntityFrameworkCore;
  2. using Microsoft.Extensions.Configuration;
  3. using System.Collections.Generic;
  4. using System.Configuration;
  5. using System.Data;
  6. using wispro.sp.entity;
  7. namespace wispro.sp.api
  8. {
  9. public partial class spDbContext : DbContext
  10. {
  11. public spDbContext()
  12. {
  13. }
  14. public spDbContext(DbContextOptions<spDbContext> options)
  15. : base(options)
  16. {
  17. }
  18. public virtual DbSet<CalMonth> CalMonths { get; set; }
  19. public virtual DbSet<Customer> Customers { get; set; }
  20. public virtual DbSet<ItemStaff> ItemStaffs { get; set; }
  21. public virtual DbSet<PerformanceItem> PerformanceItems { get; set; }
  22. public virtual DbSet<StaffGrade> StaffGrades { get; set; }
  23. public virtual DbSet<VerifyCoefficient> VerifyCoefficients { get; set; }
  24. public virtual DbSet<Staff> Staffs { get; set; }
  25. public virtual DbSet<Message> Messages { get; set; }
  26. public virtual DbSet<MessageReadRecord> MessageReadRecords { get;set;}
  27. public virtual DbSet<MessagePerformanceItem> MessagePerformanceItems { get; set; }
  28. public virtual DbSet<AttachFile> AttachFiles { get; set; }
  29. public virtual DbSet<BasePointRule> BasePointRules { get; set; }
  30. public virtual DbSet<InputField> InputFields { get; set; }
  31. public virtual DbSet<InputFieldValue> InputFieldValues { get; set; }
  32. public virtual DbSet<AppealType> AppealTypes { get; set; }
  33. public virtual DbSet<AppealRecord> AppealRecords { get; set; }
  34. public virtual DbSet<SelectValue> SelectValues { get; set; }
  35. public virtual DbSet<CaseCeoffcient> CaseCeoffcients { get; set; }
  36. public virtual DbSet<Department> Departments { get; set; }
  37. public virtual DbSet<Position> Positions { get; set; }
  38. public virtual DbSet<DepartmentPosition> DepartmentPositions { get; set; }
  39. protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
  40. {
  41. if (!optionsBuilder.IsConfigured)
  42. {
  43. optionsBuilder.UseSqlServer(utility.ConfigHelper.GetSectionValue("ConnectionStrings:DefaultConnect"));// "Data Source=(local);Initial Catalog=spDB;User ID=sa;Password=Lqftiu807005");// Configuration.GetConnectionString("DefaultConnect"));
  44. //ConfigurationManager.AppSettings["ValidAudience"]
  45. }
  46. }
  47. protected override void OnModelCreating(ModelBuilder modelBuilder)
  48. {
  49. modelBuilder.Entity<CaseCeoffcient>( entity=>
  50. {
  51. entity.ToTable("CaseCeofficient");
  52. entity.HasKey(e=>e.Ceoffcient);
  53. });
  54. modelBuilder.Entity<BasePointRule>(entity=> {
  55. entity.ToTable("BasePointRule");
  56. entity.Property(e => e.PointExpress).HasMaxLength(100);
  57. entity.Property(e => e.Rule).HasMaxLength(1000);
  58. entity.Property(e => e.Type).HasMaxLength(20);
  59. });
  60. modelBuilder.Entity<CalMonth>(entity =>
  61. {
  62. entity.ToTable("CalMonth");
  63. entity.Property(e => e.Year).HasColumnName("year");
  64. entity.Property(e => e.Month).HasColumnName("month");
  65. entity.Property(e => e.Status).HasColumnName("status");
  66. }
  67. ) ;
  68. modelBuilder.Entity<Customer>(entity =>
  69. {
  70. entity.ToTable("Customer");
  71. entity.Property(e => e.Address).HasMaxLength(500);
  72. entity.Property(e => e.ContactMan).HasMaxLength(50);
  73. entity.Property(e => e.Name)
  74. .IsRequired()
  75. .HasMaxLength(200);
  76. entity.Property(e => e.Phone).HasMaxLength(50);
  77. entity.HasOne(d => d.ResponseMan)
  78. .WithMany(p => p.Customers)
  79. .HasForeignKey(d => d.ResponseManId)
  80. .HasConstraintName("FK_Customer_Staff");
  81. });
  82. modelBuilder.Entity<ItemStaff>(entity =>
  83. {
  84. entity.HasKey(e => new { e.ItemId, e.DoPersonId });
  85. entity.ToTable("ItemStaff");
  86. entity.Property(e => e.PerformancePoint);//.HasColumnType("numeric(18, 2)");
  87. entity.HasOne(d => d.DoPerson)
  88. .WithMany(p => p.ItemStaffs)
  89. .HasForeignKey(d => d.DoPersonId)
  90. .OnDelete(DeleteBehavior.ClientSetNull)
  91. .HasConstraintName("FK_ItemStaff_Staff");
  92. entity.HasOne(d => d.Item)
  93. .WithMany(p => p.ItemStaffs)
  94. .HasForeignKey(d => d.ItemId)
  95. .OnDelete(DeleteBehavior.ClientSetNull)
  96. .HasConstraintName("FK_ItemStaff_PerformanceItem");
  97. });
  98. modelBuilder.Entity<PerformanceItem>(entity =>
  99. {
  100. entity.ToTable("PerformanceItem");
  101. entity.Property(e => e.ApplicationName).HasMaxLength(200);
  102. entity.Property(e => e.ApplicationType).HasMaxLength(50);
  103. entity.Property(e => e.BasePoint).HasColumnType("numeric(18, 2)");
  104. entity.Property(e => e.BusinessType).HasMaxLength(50);
  105. entity.Property(e => e.CaseCoefficient).HasMaxLength(10);
  106. entity.Property(e => e.CaseName).HasMaxLength(500);
  107. entity.Property(e => e.CaseNo).HasMaxLength(50);
  108. entity.Property(e => e.CaseStage).HasMaxLength(50);
  109. entity.Property(e => e.CaseState).HasMaxLength(50);
  110. entity.Property(e => e.CaseType).HasMaxLength(50);
  111. entity.Property(e => e.EntrustingDate).HasColumnType("date");
  112. entity.Property(e => e.CustomerLimitDate).HasColumnType("date");
  113. entity.Property(e => e.DoItem).HasMaxLength(50);
  114. entity.Property(e => e.DoItemCoefficient).HasMaxLength(50);
  115. entity.Property(e => e.DoItemMemo).HasMaxLength(500);
  116. entity.Property(e => e.DoItemState).HasMaxLength(50);
  117. entity.Property(e => e.FinalizationDate).HasColumnType("date");
  118. entity.Property(e => e.FinishedDate).HasColumnType("date");
  119. entity.Property(e => e.FirstDraftDate).HasColumnType("date");
  120. entity.Property(e => e.InternalDate).HasColumnType("date");
  121. entity.Property(e => e.OverDueMemo).HasMaxLength(100);
  122. entity.Property(e => e.PreOastaffId).HasColumnName("PreOAStaffId");
  123. entity.Property(e => e.ReturnDate).HasColumnType("date");
  124. entity.HasOne(d => d.Customer)
  125. .WithMany(p => p.PerformanceItems)
  126. .HasForeignKey(d => d.CustomerId)
  127. .HasConstraintName("FK_PerformanceItem_Customer");
  128. entity.HasOne(d => d.PreOastaff)
  129. .WithMany()
  130. .HasForeignKey(d => d.PreOastaffId)
  131. .HasConstraintName("FK_PerformanceItem_Staff");
  132. entity.HasOne(d => d.Reviewer)
  133. .WithMany(p => p.ReviewerItems)
  134. .HasForeignKey(d => d.ReviewerId)
  135. .HasConstraintName("FK_PerformanceItem_Reviewer");
  136. entity.HasOne(d => d.CalMonth)
  137. .WithMany(p => p.PerformanceItems)
  138. .HasForeignKey(d => d.CalMonthId)
  139. .HasConstraintName("FK_PerformanceItem_CalMonth");
  140. });
  141. modelBuilder.Entity<StaffGrade>(entity =>
  142. {
  143. entity.ToTable("StaffGrade");
  144. entity.Property(e => e.Coefficient);//.HasColumnType("numeric(18, 2)");
  145. entity.Property(e => e.Grade)
  146. .IsRequired()
  147. .HasMaxLength(5)
  148. .IsFixedLength(true);
  149. });
  150. modelBuilder.Entity<VerifyCoefficient>(entity =>
  151. {
  152. entity.HasKey(e => new { e.CheckerId, e.DoPersonId });
  153. entity.ToTable("VerifyCoefficient");
  154. entity.Property(e => e.Coefficient);//.HasColumnType("numeric(18, 2)");
  155. entity.HasOne(d => d.Checker)
  156. .WithMany(p => p.VerifyCoefficientCheckers)
  157. .HasForeignKey(d => d.CheckerId)
  158. .OnDelete(DeleteBehavior.ClientSetNull)
  159. .HasConstraintName("FK_VerifyCoefficient_StaffGrade");
  160. entity.HasOne(d => d.DoPerson)
  161. .WithMany(p => p.VerifyCoefficientDoPeople)
  162. .HasForeignKey(d => d.DoPersonId)
  163. .OnDelete(DeleteBehavior.ClientSetNull)
  164. .HasConstraintName("FK_VerifyCoefficient_StaffGrade1");
  165. });
  166. modelBuilder.Entity<Staff>(entity =>
  167. {
  168. entity.ToTable("Staff");
  169. //entity.Property(e => e.Id).ValueGeneratedNever();
  170. entity.Property(e => e.Account)
  171. .IsRequired()
  172. .HasMaxLength(50);
  173. entity.Property(e => e.Department).HasMaxLength(50);
  174. entity.Property(e => e.EntyDate).HasColumnType("date");
  175. entity.Property(e => e.IsCalPerformsnce).HasColumnName("isCalPerformsnce");
  176. entity.Property(e => e.Name)
  177. .IsRequired()
  178. .HasMaxLength(50);
  179. entity.Property(e => e.Password).IsRequired();
  180. entity.Property(e => e.Status)
  181. .IsRequired()
  182. .HasMaxLength(25);
  183. entity.Property(e => e.WorkPlace).HasMaxLength(50);
  184. entity.HasOne(d => d.StaffGrade)
  185. .WithMany(p => p.Staff)
  186. .HasForeignKey(d => d.StaffGradeId)
  187. .OnDelete(DeleteBehavior.ClientSetNull)
  188. .HasConstraintName("FK_Staff_StaffGrade");
  189. });
  190. modelBuilder.Entity<Message>(entity =>
  191. {
  192. //entity.HasKey(e => e.Id);
  193. entity.ToTable("Message");
  194. entity.Property(e => e.Type);
  195. entity.Property(e => e.MessageInfo).HasMaxLength(500);
  196. entity.HasOne(d => d.From)
  197. .WithMany()
  198. .HasForeignKey(d => d.FromId)
  199. .OnDelete(DeleteBehavior.ClientSetNull)
  200. .HasConstraintName("FK_From_Staff");
  201. });
  202. modelBuilder.Entity<MessageReadRecord>(entity =>
  203. {
  204. entity.HasKey(e => new { e.MessageId,e.StaffId});
  205. entity.ToTable("MessageReadRecord");
  206. entity.Property(e => e.isReaded);
  207. entity.HasOne(d => d.Staff)
  208. .WithMany()
  209. .HasForeignKey(d => d.StaffId)
  210. .OnDelete(DeleteBehavior.ClientSetNull)
  211. .HasConstraintName("FK_MessageReadRecord_Staff");
  212. entity.HasOne(d => d.Message)
  213. .WithMany()
  214. .HasForeignKey(d => d.MessageId)
  215. .OnDelete(DeleteBehavior.ClientSetNull)
  216. .HasConstraintName("FK_MessageReadRecord_Message");
  217. });
  218. modelBuilder.Entity<MessagePerformanceItem>( entity =>
  219. {
  220. entity.HasKey(e=> new { e.ItemId,e.MessageId});
  221. entity.HasOne(d => d.Message)
  222. .WithMany(m => m.RelatedItem)
  223. .HasForeignKey(d => d.MessageId)
  224. .HasConstraintName("FK_MessagePerformanceItem_Message");
  225. entity.HasOne(d => d.Item )
  226. .WithMany()
  227. .HasForeignKey(d => d.ItemId)
  228. .HasConstraintName("FK_MessagePerformanceItem_Item");
  229. });
  230. modelBuilder.Entity<AttachFile>(entity =>
  231. {
  232. entity.ToTable("AttachFile");
  233. entity.Property(e=>e.Name).HasMaxLength(200);
  234. entity.Property(e => e.SavePath).HasMaxLength(200);
  235. entity.HasOne(d => d.UploadUser)
  236. .WithMany()
  237. .HasForeignKey(d => d.UploadUserId)
  238. .HasConstraintName("FK_AttachFile_UpdateUser")
  239. .OnDelete(DeleteBehavior.NoAction);
  240. entity.HasOne(d => d.AppealRecord)
  241. .WithMany(a=>a.AttachFiles)
  242. .HasForeignKey(d => d.AppealRecordId)
  243. .HasConstraintName("FK_AttachFile_AppealRecord")
  244. .IsRequired(false);
  245. });
  246. modelBuilder.Entity<AppealType>(entity =>
  247. {
  248. entity.ToTable("AppealType");
  249. entity.Property(e => e.Name).HasMaxLength(50);
  250. entity.Property(e => e.ReviewerExpress).HasMaxLength(500);
  251. entity.Property(e => e.CanDoExpress).HasMaxLength(500);
  252. });
  253. modelBuilder.Entity<AppealRecord>(entity =>
  254. {
  255. entity.ToTable("AppealRecord");
  256. entity.Property(e => e.Reason).HasMaxLength(500);
  257. entity.HasOne(d => d.Creater)
  258. .WithMany()
  259. .HasForeignKey(d => d.CreaterId);
  260. entity.HasOne(d => d.Reviewer)
  261. .WithMany().OnDelete(DeleteBehavior.NoAction)
  262. .HasForeignKey(d => d.ReviewerId);
  263. entity.HasOne(d => d.Type)
  264. .WithMany()
  265. .OnDelete(DeleteBehavior.NoAction)
  266. .HasForeignKey(d => d.TypeId);
  267. entity.HasOne(d => d.Item)
  268. .WithMany()
  269. .HasForeignKey(d=>d.ItemId);
  270. }) ;
  271. modelBuilder.Entity<InputField>(entity=> {
  272. entity.ToTable("InputField");
  273. entity.Property(e=>e.FieldName).HasMaxLength(50);
  274. entity.Property(e => e.FieldType).HasMaxLength(50);
  275. entity.Property(e => e.MapObjectField).HasMaxLength(50);
  276. entity.HasOne(d => d.AppealType)
  277. .WithMany()
  278. .HasForeignKey(d=>d.AppealTypeId);
  279. //entity.HasKey(d=>new { d.AppealTypeId,d.AppealState});
  280. });
  281. modelBuilder.Entity<SelectValue>(entity => {
  282. entity.ToTable("SelectValue");
  283. entity.HasOne(d => d.InputField)
  284. .WithMany(s=>s.SelectValues)
  285. .HasForeignKey(d => d.InputFieldId);
  286. //entity.HasKey(d=>new { d.AppealTypeId,d.AppealState});
  287. });
  288. modelBuilder.Entity<InputFieldValue>(entity => {
  289. entity.ToTable("InputFieldValue");
  290. entity.Property(e => e.Value).HasMaxLength(500);
  291. entity.HasOne(d => d.InputField)
  292. .WithMany()
  293. .HasForeignKey(d => d.InputFieldId);
  294. entity.HasOne(d => d.AppealRecord)
  295. .WithMany()
  296. .HasForeignKey(d => d.AppealRecordId);
  297. //entity.HasKey(d=>new { d.AppealRecordId,d.InputFieldId});
  298. });
  299. modelBuilder.Entity<Department>(entity => {
  300. entity.ToTable("Department");
  301. });
  302. modelBuilder.Entity<Position>(entity => {
  303. entity.ToTable("Position");
  304. });
  305. modelBuilder.Entity<DepartmentPosition>(entity=> {
  306. entity.ToTable("DepartmentPosition");
  307. entity.HasOne(d => d.department)
  308. .WithMany()
  309. .HasForeignKey(d => d.departmentId);
  310. entity.HasOne(d => d.Position)
  311. .WithMany()
  312. .HasForeignKey(d=>d.PositionId);
  313. entity.HasOne(d => d.Staff)
  314. .WithMany(d=>d.Positions)
  315. .HasForeignKey(d => d.StaffId);
  316. });
  317. modelBuilder.Entity<StaffGrade>().HasData(
  318. new StaffGrade[]
  319. {
  320. new StaffGrade() {Id=1, Grade = "S级", Coefficient = 1.2},
  321. new StaffGrade() {Id=2, Grade = "A3级", Coefficient = 1.1},
  322. new StaffGrade() {Id =3, Grade = "A2级", Coefficient = 1.1},
  323. new StaffGrade() {Id=4, Grade = "A1级", Coefficient = 1.1},
  324. new StaffGrade() {Id=5, Grade = "B3级", Coefficient = 1.0},
  325. new StaffGrade() {Id=6, Grade = "B2级", Coefficient = 1.0},
  326. new StaffGrade() {Id=7, Grade = "B1级", Coefficient = 0.9},
  327. new StaffGrade() {Id=8, Grade = "C3级", Coefficient = 0.9},
  328. new StaffGrade() {Id=9, Grade = "C2级", Coefficient = 0.7},
  329. new StaffGrade() {Id= 10, Grade = "C1级", Coefficient = 0.7},
  330. new StaffGrade() {Id=11, Grade = "D3级", Coefficient = 0.6},
  331. new StaffGrade() {Id=12, Grade = "D2级", Coefficient = 0.6},
  332. new StaffGrade() {Id=13, Grade = "D1级", Coefficient = 0.5},
  333. new StaffGrade() {Id=14, Grade = "A级", Coefficient = 1.1},
  334. new StaffGrade() {Id=15, Grade = "C级", Coefficient = 1.0},
  335. new StaffGrade() {Id=16, Grade = "D级", Coefficient = 0.9}
  336. });
  337. modelBuilder.Entity<VerifyCoefficient>().HasData(
  338. new VerifyCoefficient[]
  339. {
  340. new VerifyCoefficient() { CheckerId = 1, DoPersonId =5, Coefficient =0.3},
  341. new VerifyCoefficient() { CheckerId = 1, DoPersonId =6, Coefficient =0.3},
  342. new VerifyCoefficient() { CheckerId = 1, DoPersonId =7, Coefficient =0.3},
  343. new VerifyCoefficient() { CheckerId = 1, DoPersonId =8, Coefficient =0.3},
  344. new VerifyCoefficient() { CheckerId = 1, DoPersonId =9, Coefficient =0.4},
  345. new VerifyCoefficient() { CheckerId = 1, DoPersonId =10, Coefficient =0.4},
  346. new VerifyCoefficient() { CheckerId = 1, DoPersonId =11, Coefficient =0.5},
  347. new VerifyCoefficient() { CheckerId = 1, DoPersonId =12, Coefficient =0.5},
  348. new VerifyCoefficient() { CheckerId = 1, DoPersonId =13, Coefficient =0.6},
  349. new VerifyCoefficient() { CheckerId = 2, DoPersonId =5, Coefficient =0.2},
  350. new VerifyCoefficient() { CheckerId = 2, DoPersonId =6, Coefficient =0.2},
  351. new VerifyCoefficient() { CheckerId = 2, DoPersonId =7, Coefficient =0.2},
  352. new VerifyCoefficient() { CheckerId = 2, DoPersonId =8, Coefficient =0.2},
  353. new VerifyCoefficient() { CheckerId = 2, DoPersonId =9, Coefficient =0.3},
  354. new VerifyCoefficient() { CheckerId = 2, DoPersonId =10, Coefficient =0.3},
  355. new VerifyCoefficient() { CheckerId = 2, DoPersonId =11, Coefficient =0.4},
  356. new VerifyCoefficient() { CheckerId = 2, DoPersonId =12, Coefficient =0.4},
  357. new VerifyCoefficient() { CheckerId = 2, DoPersonId =13, Coefficient =0.5},
  358. new VerifyCoefficient() { CheckerId = 3, DoPersonId =5, Coefficient =0.2},
  359. new VerifyCoefficient() { CheckerId = 3, DoPersonId =6, Coefficient =0.2},
  360. new VerifyCoefficient() { CheckerId = 3, DoPersonId =7, Coefficient =0.2},
  361. new VerifyCoefficient() { CheckerId = 3, DoPersonId =8, Coefficient =0.2},
  362. new VerifyCoefficient() { CheckerId = 3, DoPersonId =9, Coefficient =0.3},
  363. new VerifyCoefficient() { CheckerId = 3, DoPersonId =10, Coefficient =0.3},
  364. new VerifyCoefficient() { CheckerId = 3, DoPersonId =11, Coefficient =0.4},
  365. new VerifyCoefficient() { CheckerId = 3, DoPersonId =12, Coefficient =0.4},
  366. new VerifyCoefficient() { CheckerId = 3, DoPersonId =13, Coefficient =0.5},
  367. new VerifyCoefficient() { CheckerId = 4, DoPersonId =5, Coefficient =0.2},
  368. new VerifyCoefficient() { CheckerId = 4, DoPersonId =6, Coefficient =0.2},
  369. new VerifyCoefficient() { CheckerId = 4, DoPersonId =7, Coefficient =0.2},
  370. new VerifyCoefficient() { CheckerId = 4, DoPersonId =8, Coefficient =0.2},
  371. new VerifyCoefficient() { CheckerId = 4, DoPersonId =9, Coefficient =0.3},
  372. new VerifyCoefficient() { CheckerId = 4, DoPersonId =10, Coefficient =0.3},
  373. new VerifyCoefficient() { CheckerId = 4, DoPersonId =11, Coefficient =0.4},
  374. new VerifyCoefficient() { CheckerId = 4, DoPersonId =12, Coefficient =0.4},
  375. new VerifyCoefficient() { CheckerId = 4, DoPersonId =13, Coefficient =0.5},
  376. new VerifyCoefficient() { CheckerId = 5, DoPersonId =5, Coefficient =0.2},
  377. new VerifyCoefficient() { CheckerId = 5, DoPersonId =6, Coefficient =0.2},
  378. new VerifyCoefficient() { CheckerId = 5, DoPersonId =7, Coefficient =0.2},
  379. new VerifyCoefficient() { CheckerId = 5, DoPersonId =8, Coefficient =0.2},
  380. new VerifyCoefficient() { CheckerId = 5, DoPersonId =9, Coefficient =0.3},
  381. new VerifyCoefficient() { CheckerId = 5, DoPersonId =10, Coefficient =0.3},
  382. new VerifyCoefficient() { CheckerId = 5, DoPersonId =11, Coefficient =0.4},
  383. new VerifyCoefficient() { CheckerId = 5, DoPersonId =12, Coefficient =0.4},
  384. new VerifyCoefficient() { CheckerId = 5, DoPersonId =13, Coefficient =0.5},
  385. new VerifyCoefficient() { CheckerId = 6, DoPersonId =5, Coefficient =0.2},
  386. new VerifyCoefficient() { CheckerId = 6, DoPersonId =6, Coefficient =0.2},
  387. new VerifyCoefficient() { CheckerId = 6, DoPersonId =7, Coefficient =0.2},
  388. new VerifyCoefficient() { CheckerId = 6, DoPersonId =8, Coefficient =0.2},
  389. new VerifyCoefficient() { CheckerId = 6, DoPersonId =9, Coefficient =0.3},
  390. new VerifyCoefficient() { CheckerId = 6, DoPersonId =10, Coefficient =0.3},
  391. new VerifyCoefficient() { CheckerId = 6, DoPersonId =11, Coefficient =0.4},
  392. new VerifyCoefficient() { CheckerId = 6, DoPersonId =12, Coefficient =0.4},
  393. new VerifyCoefficient() { CheckerId = 6, DoPersonId =13, Coefficient =0.5}
  394. }
  395. );
  396. #region 初始化绩效点数规则
  397. //List<BasePointRule> rules = new List<BasePointRule>();
  398. //DataTable dt = wispro.sp.utility.NPOIExcel.ExcelToDataTable("ExcelFiles\\20211109-绩效点数规则-lcy-v1.xlsx", true);
  399. //foreach (DataRow row in dt.Rows)
  400. //{
  401. // BasePointRule rule = new BasePointRule()
  402. // {
  403. // Rule = row["规则"].ToString(),
  404. // PointExpress = row["点数计算"].ToString(),
  405. // Priority = int.Parse(row["优先级修订"].ToString()),
  406. // Type = row["类型"].ToString()
  407. // };
  408. //}
  409. //for (int i = 0; i < rules.Count; i++)
  410. //{
  411. // rules[i].Id = i + 1;
  412. //}
  413. //modelBuilder.Entity<BasePointRule>().HasData(rules);
  414. #endregion
  415. AppealType[] appealTypes = new AppealType[]
  416. {
  417. new AppealType(){Id=1, Name ="绩效点数分配比率",CanDoExpress = "p.ItemStaffs.Count()>1"},
  418. new AppealType(){Id=2,Name ="案件系数复核",CanDoExpress = "p.DoItem==\"新申请\"",ReviewerExpress ="p.Reviewer"},
  419. new AppealType(){Id=3,Name ="处理事项系数复核",CanDoExpress = "p.DoItem==\"新申请\"",ReviewerExpress ="p.Reviewer"},
  420. new AppealType(){Id=4,Name ="案件缺漏申诉",CanDoExpress ="",ReviewerExpress ="p.Reviewer",Type =1},
  421. new AppealType(){Id=5,Name ="案件严重超期说明",CanDoExpress ="p.isDanger()"},
  422. new AppealType(){Id=6,Name ="按照翻译字数算绩效备注",CanDoExpress ="p.DoItem==\"新申请\" || p.DoItem==\"翻译\""}
  423. };
  424. InputField[] inputFields = new InputField[] {
  425. new InputField(){Id=1,AppealTypeId =1,AppealState =0,FieldName ="分配比率",
  426. MapObjectField ="ItemStaffs.PerformancePoint",
  427. FieldType = typeof(double).ToString(),
  428. MapObjectFieldLabel="ItemStaffs.DoPerson.Name"
  429. },
  430. new InputField(){Id=3,AppealTypeId =1,AppealState =0,FieldName ="原因",FieldType =typeof(string).ToString() },
  431. new InputField(){Id=4,AppealTypeId =1,AppealState =1,FieldName ="备注",FieldType =typeof(string).ToString() },
  432. new InputField(){Id=5,AppealTypeId =1,AppealState =1,FieldName ="审核意见",FieldType =typeof(string).ToString()},
  433. new InputField(){Id=6,AppealTypeId =2,AppealState =0,FieldName ="案件系数", MapObjectField ="CaseCoefficient",FieldType = typeof(string).ToString() },
  434. new InputField(){Id=9,AppealTypeId =2,AppealState =1,FieldName ="备注",FieldType =typeof(string).ToString() },
  435. new InputField(){Id=10,AppealTypeId =2,AppealState =1,FieldName ="审核意见",FieldType =typeof(string).ToString()},
  436. new InputField(){Id=11,AppealTypeId =3,AppealState =0,FieldName ="处理事项系数", MapObjectField ="DoItemCoefficient",FieldType = typeof(string).ToString() },
  437. new InputField(){Id=12,AppealTypeId =3,AppealState =1,FieldName ="备注",FieldType =typeof(string).ToString() },
  438. new InputField(){Id=13,AppealTypeId =3,AppealState =1,FieldName ="审核意见",FieldType =typeof(string).ToString()},
  439. new InputField(){Id=14,AppealTypeId =4,AppealState =0,FieldName ="我方文号", FieldType = typeof(string).ToString() },
  440. new InputField(){Id=15,AppealTypeId =4,AppealState =0,FieldName ="处理事项", FieldType = typeof(string).ToString() },
  441. new InputField(){Id=16,AppealTypeId =4,AppealState =1,FieldName ="备注",FieldType =typeof(string).ToString() },
  442. new InputField(){Id=17,AppealTypeId =4,AppealState =1,FieldName ="审核意见",FieldType =typeof(string).ToString()},
  443. new InputField(){Id=18,AppealTypeId =5,AppealState =0,FieldName ="超期说明",MapObjectField ="OverDueMemo", FieldType = typeof(string).ToString() },
  444. new InputField(){Id=21,AppealTypeId =5,AppealState =1,FieldName ="审核意见", FieldType = typeof(string).ToString() },
  445. new InputField(){Id=22,AppealTypeId =5,AppealState =1,FieldName ="备注", FieldType = typeof(string).ToString() },
  446. new InputField(){Id=19,AppealTypeId =6,AppealState =0,FieldName ="翻译类型", MapObjectField ="AgentFeedbackMemo", FieldType = typeof(string).ToString() },
  447. new InputField(){Id=20,AppealTypeId =6,AppealState =0,FieldName ="翻译字数", MapObjectField ="WordCount", FieldType = typeof(int).ToString() },
  448. new InputField(){Id=23,AppealTypeId =6,AppealState =1,FieldName ="审核意见", FieldType = typeof(int).ToString() },
  449. new InputField(){Id=24,AppealTypeId =6,AppealState =1,FieldName ="翻译字数", MapObjectField ="WordCount", FieldType = typeof(int).ToString() },
  450. };
  451. List<SelectValue> selectValues = new List<SelectValue>() {
  452. new SelectValue(){Id =1, InputFieldId =5, Value ="同意" },
  453. new SelectValue(){Id =2, InputFieldId =5, Value ="拒绝" },
  454. new SelectValue(){Id =3, InputFieldId =10, Value ="同意" },
  455. new SelectValue(){Id =4, InputFieldId =10, Value ="拒绝" },
  456. new SelectValue(){Id =5, InputFieldId =13, Value ="同意" },
  457. new SelectValue(){Id =6, InputFieldId =13, Value ="拒绝" },
  458. new SelectValue(){Id =7, InputFieldId =17, Value ="同意" },
  459. new SelectValue(){Id =8, InputFieldId =17, Value ="拒绝" },
  460. new SelectValue(){Id =9, InputFieldId =6, Value ="S" },
  461. new SelectValue(){Id =10, InputFieldId =6, Value ="A" },
  462. new SelectValue(){Id =11, InputFieldId =6, Value ="B" },
  463. new SelectValue(){Id =12, InputFieldId =6, Value ="C" },
  464. new SelectValue(){Id =13, InputFieldId =6, Value ="D" },
  465. new SelectValue(){Id =14, InputFieldId =11, Value ="实质" },
  466. new SelectValue(){Id =15, InputFieldId =11, Value ="形式" },
  467. new SelectValue(){Id =16, InputFieldId =19, Value ="中-德" },
  468. new SelectValue(){Id =17, InputFieldId =19, Value ="中-英" },
  469. new SelectValue(){Id =18, InputFieldId =19, Value ="英-中" },
  470. new SelectValue(){Id =19, InputFieldId =22, Value ="同意" },
  471. new SelectValue(){Id =20, InputFieldId =22, Value ="拒绝" },
  472. };
  473. List<CaseCeoffcient> caseCeoffcients = new List<CaseCeoffcient>()
  474. {
  475. new CaseCeoffcient(){ Ceoffcient="S",Value =2.5},
  476. new CaseCeoffcient(){ Ceoffcient="A",Value =1.5},
  477. new CaseCeoffcient(){ Ceoffcient="B",Value =1.0},
  478. new CaseCeoffcient(){ Ceoffcient="C",Value =0.7},
  479. new CaseCeoffcient(){ Ceoffcient="D",Value =0.4}
  480. };
  481. modelBuilder.Entity<AppealType>().HasData(appealTypes);
  482. modelBuilder.Entity<InputField>().HasData(inputFields);
  483. modelBuilder.Entity<SelectValue>().HasData(selectValues);
  484. modelBuilder.Entity<CaseCeoffcient>().HasData(caseCeoffcients);
  485. OnModelCreatingPartial(modelBuilder);
  486. }
  487. partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
  488. }
  489. }