锐腾搅拌上料功能
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.4 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using ICSSoft.Frame.Data.Entity;
  6. using ICSSoft.Base.Config.AppConfig;
  7. namespace ICSSoft.Frame.Data.DAL
  8. {
  9. public class ICSLOTONWIPCheckDetailDAL
  10. {
  11. public static void Add(List<ICSLOTONWIPCheckDetail> list, string conn)
  12. {
  13. FramDataContext db = new FramDataContext(conn);
  14. db.Connection.Open();
  15. db.Transaction = db.Connection.BeginTransaction();
  16. try
  17. {
  18. string StrMaxFlow = "";
  19. int maxFlow = 0;
  20. var x = db.ICSLOTONWIPCheckDetail.Where(a => a.FORTRANID == list[0].FORTRANID);
  21. if (x.Count() != 0)
  22. {
  23. StrMaxFlow = x.Max(a => a.EATTRIBUTE2);
  24. }
  25. if (!Int32.TryParse(StrMaxFlow, out maxFlow))
  26. {
  27. maxFlow = 0;
  28. }
  29. maxFlow++;
  30. list.ForEach(a =>
  31. {
  32. a.EATTRIBUTE2 = maxFlow.ToString();
  33. db.ICSLOTONWIPCheckDetail.InsertOnSubmit(a);
  34. db.SubmitChanges();
  35. });
  36. db.Transaction.Commit();
  37. }
  38. catch (Exception ex)
  39. {
  40. db.Transaction.Rollback();
  41. throw ex;
  42. }
  43. }
  44. }
  45. }