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

210 lines
6.4 KiB

5 months ago
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Data;
  6. using ICSSoft.Frame.Data.DAL;
  7. using ICSSoft.Frame.Data.Entity;
  8. namespace ICSSoft.Frame.Data.BLL
  9. {
  10. public class ICSITEM2ROUTEBLL
  11. {
  12. #region 新增和修改List
  13. public static string AddList(List<FormICSITEM2ROUTEUIModel> InfoList, string dsconn)
  14. {
  15. try
  16. {
  17. if (string.IsNullOrWhiteSpace(dsconn))
  18. {
  19. throw new Exception("数据库连接字符串错误");
  20. }
  21. return ICSITEM2ROUTEDAL.AddList(InfoList, dsconn);
  22. }
  23. catch (Exception ex)
  24. {
  25. throw ex;
  26. }
  27. }
  28. #endregion
  29. public static DataTable SearchItemInfoList(string dsconn, string invcode)
  30. {
  31. try
  32. {
  33. DataTable returndt = new DataTable();
  34. returndt.Columns.Add("guid", typeof(string));
  35. returndt.Columns.Add("存货编码", typeof(string));
  36. returndt.Columns.Add("存货名称", typeof(string));
  37. returndt.Columns.Add("规格型号", typeof(string));
  38. List<FormICSINVENTORYUIModel> returndal = ICSITEM2ROUTEDAL.SearchItemInfoList(dsconn, invcode);
  39. foreach (FormICSINVENTORYUIModel returntype in returndal)
  40. {
  41. DataRow dr = returndt.NewRow();
  42. dr["guid"] = returntype.ID;
  43. dr["存货编码"] = returntype.INVCODE;
  44. dr["存货名称"] = returntype.INVNAME;
  45. dr["规格型号"] = returntype.INVDESC;
  46. returndt.Rows.Add(dr);
  47. }
  48. return returndt;
  49. }
  50. catch (Exception ex)
  51. {
  52. throw ex;
  53. }
  54. }
  55. public static DataTable SearchRouteInfoList(string dsconn)
  56. {
  57. try
  58. {
  59. DataTable returndt = new DataTable();
  60. returndt.Columns.Add("guid", typeof(string));
  61. returndt.Columns.Add("途程代码", typeof(string));
  62. returndt.Columns.Add("途程描述", typeof(string));
  63. List<FormICSROUTEUIModel> returndal = ICSITEM2ROUTEDAL.SearchRouteInfoList(dsconn);
  64. foreach (FormICSROUTEUIModel returntype in returndal)
  65. {
  66. DataRow dr = returndt.NewRow();
  67. dr["guid"] = returntype.ID;
  68. dr["途程代码"] = returntype.ROUTECODE;
  69. dr["途程描述"] = returntype.ROUTEDESC;
  70. returndt.Rows.Add(dr);
  71. }
  72. return returndt;
  73. }
  74. catch (Exception ex)
  75. {
  76. throw ex;
  77. }
  78. }
  79. #region 新增和修改
  80. public static void Add(FormICSITEM2ROUTEUIModel Info,bool add, string dsconn)
  81. {
  82. try
  83. {
  84. if (string.IsNullOrWhiteSpace(dsconn))
  85. {
  86. throw new Exception("数据库连接字符串错误");
  87. }
  88. List<FormICSITEM2ROUTEUIModel> InfoList = new List<FormICSITEM2ROUTEUIModel>() { Info };
  89. ICSITEM2ROUTEDAL.Add(InfoList,add, dsconn);
  90. }
  91. catch (Exception ex)
  92. {
  93. throw ex;
  94. }
  95. }
  96. #endregion
  97. #region 代码是否存在
  98. public static bool IsIncluding(string itemCODE,string routeCODE, string dsconn)
  99. {
  100. try
  101. {
  102. return ICSITEM2ROUTEDAL.IsIncluding(itemCODE, routeCODE, dsconn);
  103. }
  104. catch (Exception ex)
  105. {
  106. throw ex;
  107. }
  108. }
  109. #endregion
  110. //#region 产品是否有使用的途程
  111. //public static bool IsIncludingISREF(List<string> itemcodeList, List<string> routecodeList, string dsconn)
  112. //{
  113. // try
  114. // {
  115. // return ICSITEM2ROUTEDAL.IsIncludingISREF(itemcodeList, routecodeList, dsconn);
  116. // }
  117. // catch (Exception ex)
  118. // {
  119. // throw ex;
  120. // }
  121. //}
  122. //#endregion
  123. #region 通过存货编码和途程代码查询
  124. public static FormICSITEM2ROUTEUIModel SearchInfoByCode(string itemCode, string routeCode, string dsconn)
  125. {
  126. try
  127. {
  128. List<FormICSITEM2ROUTEUIModel> returnlist = ICSITEM2ROUTEDAL.SearchInfoByCode(itemCode, routeCode, dsconn);
  129. return returnlist[0];
  130. }
  131. catch (Exception ex)
  132. {
  133. throw ex;
  134. }
  135. }
  136. #endregion
  137. #region 信息
  138. public static DataTable GetDetail(String itemcode, String routecode, String Appconstr)
  139. {
  140. try
  141. {
  142. return ICSITEM2ROUTEDAL.GetDetail(itemcode, routecode, Appconstr);
  143. }
  144. catch (Exception ex)
  145. {
  146. throw ex;
  147. }
  148. }
  149. #endregion
  150. #region 产品是否有使用的途程
  151. public static bool IsIncludingISREF(string itemCODE, string routeCODE, string dsconn, out string defaultRouteCODE)
  152. {
  153. return ICSITEM2ROUTEDAL.IsIncludingISREF(itemCODE, routeCODE, dsconn, out defaultRouteCODE);
  154. }
  155. #endregion
  156. #region 产品途程是否绑定工艺
  157. public static bool CheckOP(string ROUTECODE, string dsconn)
  158. {
  159. try
  160. {
  161. DataTable dt = ICSITEM2ROUTEDAL.CheckOP(ROUTECODE, dsconn);
  162. if (dt.Rows.Count > 0 && dt != null)
  163. {
  164. return true;
  165. }
  166. else
  167. {
  168. return false;
  169. }
  170. }
  171. catch (Exception ex)
  172. {
  173. throw ex;
  174. }
  175. }
  176. #endregion
  177. #region 删除
  178. public static void deleteInfo(string itemcode,string routecode, string dsconn)
  179. {
  180. try
  181. {
  182. ICSITEM2ROUTEDAL.deleteInfo(itemcode, routecode, dsconn);
  183. }
  184. catch (Exception ex)
  185. {
  186. throw ex;
  187. }
  188. }
  189. #endregion
  190. }
  191. }