锐腾搅拌上料功能
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.

80 lines
2.7 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 ICSITEMROUTE2OPDAL
  10. {
  11. #region 删除
  12. public static void deleteInfo(List<string> codeList, string dsconn)
  13. {
  14. FramDataContext db = new FramDataContext(dsconn);
  15. db.Connection.Open();
  16. db.Transaction = db.Connection.BeginTransaction();
  17. try
  18. {
  19. var lines = db.ICSITEMROUTE2OP.Where(a => codeList.Contains(a.OPCODE));
  20. db.ICSITEMROUTE2OP.DeleteAllOnSubmit(lines);
  21. db.SubmitChanges();
  22. db.Transaction.Commit();
  23. }
  24. catch (Exception ex)
  25. {
  26. db.Transaction.Rollback();
  27. throw ex;
  28. }
  29. }
  30. #endregion
  31. #region 新增和修改
  32. public static void Add(List<FormICSITEMROUTE2OPUIModel> InfoList, string dsconn)
  33. {
  34. FramDataContext db = new FramDataContext(dsconn);
  35. db.Connection.Open();
  36. db.Transaction = db.Connection.BeginTransaction();
  37. try
  38. {
  39. foreach (FormICSITEMROUTE2OPUIModel info in InfoList)
  40. {
  41. //bool isNew = false;
  42. //var line = db.ICSITEMROUTE2OP.SingleOrDefault(a => a.OPCODE == tbinfo.OPCODE);
  43. //if (line == null)
  44. //{
  45. // isNew = true;
  46. // line = new ICSOP();
  47. // line.ID = AppConfig.GetGuid();
  48. // line.OPCODE = tbinfo.OPCODE;
  49. //}
  50. var line = db.ICSITEMROUTE2OP.SingleOrDefault(a => a.ITEMCODE == info.ITEMCODE && a.ROUTECODE == info.ROUTECODE && a.OPCODE == info.OPCODE);
  51. line.OPCONTROL = info.ro.OPCONTROL;
  52. line.OPTIONALOP = info.OPTIONALOP;
  53. line.IDMERGETYPE = info.IDMERGETYPE;
  54. line.IDMERGERULE = Convert.ToInt32(info.IDMERGERULE);
  55. line.MUSER = AppConfig.UserId;
  56. line.MUSERName = AppConfig.UserName;
  57. line.MTIME = DateTime.Now;
  58. line.WorkPoint = AppConfig.WorkPointCode;
  59. //if (isNew)
  60. // db.ICSOP.InsertOnSubmit(line);
  61. db.SubmitChanges();
  62. }
  63. db.Transaction.Commit();
  64. }
  65. catch (Exception ex)
  66. {
  67. db.Transaction.Rollback();
  68. throw ex;
  69. }
  70. }
  71. #endregion
  72. }
  73. }