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

146 lines
6.3 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.DBHelper;
  7. using System.Data;
  8. using ICSSoft.Base.Config.AppConfig;
  9. namespace ICSSoft.Frame.Data.DAL
  10. {
  11. public class ICSASNIQCDETAILDAL
  12. {
  13. public static void AddAndEdit(List<ICSASNIQCDETAIL> mandayInfoList, string dsconn)
  14. {
  15. FramDataContext db = new FramDataContext(dsconn);
  16. db.Connection.Open();
  17. db.Transaction = db.Connection.BeginTransaction();
  18. try
  19. {
  20. foreach (ICSASNIQCDETAIL mandayInfo in mandayInfoList)
  21. {
  22. ///jia pan duan
  23. bool isNew = false;
  24. var entity = db.ICSASNIQCDETAIL.SingleOrDefault(a => a.ID == mandayInfo.ID);
  25. if (entity == null)
  26. {
  27. isNew = true;
  28. entity = new ICSASNIQCDETAIL();
  29. entity.ID = mandayInfo.ID;
  30. }
  31. entity.IQCID = mandayInfo.IQCID;
  32. entity.IQCNO = mandayInfo.IQCNO;
  33. entity.STNO = mandayInfo.STNO;
  34. entity.STLINE = mandayInfo.STLINE;
  35. entity.ITEMCODE = mandayInfo.ITEMCODE;
  36. //采购订单号
  37. entity.ORDERNO =mandayInfo.ORDERNO;
  38. //采购订单行
  39. entity.ORDERLINE =mandayInfo.ORDERLINE;
  40. entity.STDSTATUS = mandayInfo.STDSTATUS;
  41. entity.RECEIVEQTY = mandayInfo.RECEIVEQTY;
  42. entity.CHECKSTATUS = mandayInfo.CHECKSTATUS;
  43. entity.UNIT = mandayInfo.UNIT;
  44. //采购备注
  45. entity.PurchaseMEMO = mandayInfo.PurchaseMEMO;
  46. entity.MEMO = mandayInfo.MEMO;
  47. entity.MEMOEX = mandayInfo.MEMOEX;
  48. entity.SAMPLEQTY = mandayInfo.SAMPLEQTY;
  49. entity.NGQTY = mandayInfo.NGQTY;
  50. entity.PIC = mandayInfo.PIC;
  51. entity.ACTION =mandayInfo.ACTION;
  52. entity.INSType = mandayInfo.INSType;
  53. entity.DINSPDATE = mandayInfo.DINSPDATE;
  54. entity.DINSPECTOR = mandayInfo.DINSPECTOR;
  55. entity.ATTRIBUTE = mandayInfo.ATTRIBUTE;
  56. entity.Type = mandayInfo.Type;
  57. entity.StorageID = mandayInfo.StorageID;
  58. entity.concessionStatus = mandayInfo.concessionStatus;
  59. entity.concessionQTY = mandayInfo.concessionQTY;
  60. entity.concessionNO = mandayInfo.concessionNO;
  61. entity.concessionMemo = mandayInfo.concessionMemo;
  62. entity.WORKPOINT = mandayInfo.WORKPOINT;
  63. entity.MUSER = mandayInfo.MUSER;
  64. entity.MUSERNAME = mandayInfo.MUSERNAME;
  65. entity.MTIME = mandayInfo.MTIME;
  66. entity.isSample = mandayInfo.isSample;
  67. entity.AQL = mandayInfo.AQL;
  68. entity.CheckGroup = mandayInfo.CheckGroup;
  69. entity.TSErrorCodeGroup = mandayInfo.TSErrorCodeGroup;
  70. entity.TSErrorCode = mandayInfo.TSErrorCode;
  71. entity.IQCDepartment = mandayInfo.IQCDepartment;
  72. if (isNew)
  73. db.ICSASNIQCDETAIL.InsertOnSubmit(entity);
  74. db.SubmitChanges();
  75. }
  76. db.SubmitChanges();
  77. db.Transaction.Commit();
  78. }
  79. catch (Exception ex)
  80. {
  81. db.Transaction.Rollback();
  82. throw ex;
  83. }
  84. }
  85. //public static void deleteInfo(string dsconn, List<string> codeList)
  86. //{
  87. // FramDataContext db = new FramDataContext(dsconn);
  88. // db.Connection.Open();
  89. // db.Transaction = db.Connection.BeginTransaction();
  90. // try
  91. // {
  92. // var lines = db.ICSASNIQCDETAIL.Where(a => codeList.Contains(a.ID));
  93. // db.ICSASNIQCDETAIL.DeleteAllOnSubmit(lines);
  94. // db.SubmitChanges();
  95. // db.Transaction.Commit();
  96. // }
  97. // catch (Exception ex)
  98. // {
  99. // db.Transaction.Rollback();
  100. // throw ex;
  101. // }
  102. //}
  103. public static int SelectCount(string iqcno)
  104. {
  105. string sql = @"select STDSTATUS
  106. from dbo.ICSASNIQCDETAIL
  107. where IQCNO='" + iqcno + "' and STDSTATUS='' and WorkPoint='" + AppConfig.WorkPointCode + "'";
  108. sql = string.Format(sql);
  109. DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
  110. int str = dt.Rows.Count;
  111. return str;
  112. }
  113. //修改入库单子表状态
  114. public static void UpdateICSINVReceiptDetailState(string checkstatus,double qualifyqty,string node)
  115. {
  116. string str = "update ICSINVReceiptDetail set IQCStatus='" + checkstatus + "' from ICSASNIQCDETAIL as a,ICSINVReceiptDetail as b " +
  117. "where a.STNO=b.ReceiptNO and a.STLINE=b.ReceiptLine and a.IQCNO='"+node+"' and a.WorkPoint='" + AppConfig.WorkPointCode + "' and b.WorkPoint='" + AppConfig.WorkPointCode + "' ";
  118. string s=
  119. " update ICSINVReceiptDetail set QualifyQTY='" + qualifyqty + "' from ICSASNIQCDETAIL as a,ICSINVReceiptDetail as b " +
  120. "where a.STNO=b.ReceiptNO and a.STLINE=b.ReceiptLine and a.IQCNO='" + node + "' and a.WorkPoint='" + AppConfig.WorkPointCode + "' and b.WorkPoint='" + AppConfig.WorkPointCode + "'";
  121. DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, str);
  122. DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, s);
  123. }
  124. public static void Set(string iqcno)
  125. {
  126. string sql = @"update dbo.ICSASNIQC
  127. set STATUS=''
  128. where IQCNO='" + iqcno + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
  129. sql = string.Format(sql);
  130. DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql);
  131. return;
  132. }
  133. }
  134. }