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

216 lines
7.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. namespace ICSSoft.Frame.Data.DAL
  7. {
  8. public class ICSPictureDAL
  9. {
  10. /// <summary>
  11. /// 获取图纸信息
  12. /// </summary>
  13. /// <param name="no">工序</param>
  14. /// <param name="prcvno">工艺路线</param>
  15. /// <param name="ver">版本</param>
  16. /// <param name="type">图纸名称</param>
  17. /// <returns></returns>
  18. public static String SearchPath(String no, String prcvno, String ver, String type,string partno)
  19. {
  20. string sql = @" select
  21. filename,
  22. filepath
  23. from
  24. ";
  25. string filepath = "";
  26. switch (type)
  27. {
  28. case "过程卡":
  29. sql += " V_C_GUOCHENG ";
  30. break;
  31. case "工序卡":
  32. sql += " V_C_GONGXU ";
  33. break;
  34. case "综合工序卡":
  35. sql += " V_C_ZONGHEGONGXU ";
  36. break;
  37. case "焊接工序卡":
  38. sql += " V_C_HANJIE ";
  39. break;
  40. case "热处理":
  41. sql += "V_C_RECHULI ";
  42. break;
  43. case "作业指导书":
  44. sql += " V_C_ZUOYEZHIDAO ";
  45. break;
  46. }
  47. sql +=" where prcvno='" + prcvno + "' and ver='" + ver + "' and no='" + no + "' and partno='"+partno+"' and rownum<2 ";
  48. try
  49. {
  50. //DataTable table = DBHelper_Oracle.GetDataSet(sql).Tables[0];
  51. //foreach (DataRow row in table.Rows)
  52. //{
  53. // filepath = row["filepath"].ToString();
  54. //}
  55. }
  56. catch (Exception ex) {
  57. throw ex;
  58. }
  59. return filepath;
  60. }
  61. /// <summary>
  62. /// 获取图纸信息(所有类型)
  63. /// </summary>
  64. /// <param name="no">工序</param>
  65. /// <param name="prcvno">工艺路线</param>
  66. /// <param name="ver">版本</param>
  67. /// <param name="typeList">图纸名称</param>
  68. /// <returns></returns>
  69. public static DataTable SearchPathALL(String no, String prcvno, String ver, string partno,List<string> typeList)
  70. {
  71. string sql = @"
  72. SELECT
  73. filepath filepath,
  74. '' FileType
  75. FROM V_C_GUOCHENG
  76. WHERE
  77. prcvno = '{0}' ----------------------线
  78. AND ver = '{1}' ---------------
  79. AND NO = '{2}' ------------------------------
  80. AND partno = '{3}' ---------------
  81. AND nvl ( filepath, '*' ) != '*'
  82. AND rownum < 2
  83. UNION ALL
  84. SELECT
  85. filepath,
  86. '' FileType
  87. FROM
  88. V_C_ZUOYEZHIDAO
  89. WHERE
  90. prcvno = '{0}'
  91. AND ver = '{1}'
  92. AND NO = '{2}'
  93. AND partno = '{3}'
  94. AND nvl ( filepath, '*' ) != '*'
  95. AND rownum < 2
  96. UNION ALL
  97. SELECT
  98. filepath,
  99. '' FileType
  100. FROM
  101. V_C_HANJIE
  102. WHERE
  103. prcvno = '{0}'
  104. AND ver = '{1}'
  105. AND NO = '{2}'
  106. AND partno = '{3}'
  107. AND nvl ( filepath, '*' ) != '*'
  108. AND rownum < 2
  109. UNION ALL
  110. SELECT
  111. filepath,
  112. '' FileType
  113. FROM
  114. V_C_GONGXU
  115. WHERE
  116. prcvno = '{0}'
  117. AND ver = '{1}'
  118. AND NO = '{2}'
  119. AND partno = '{3}'
  120. AND nvl ( filepath, '*' ) != '*'
  121. AND rownum < 2
  122. UNION ALL
  123. SELECT
  124. filepath,
  125. '' FileType
  126. FROM
  127. V_C_RECHULI
  128. WHERE
  129. prcvno = '{0}'
  130. AND ver = '{1}'
  131. AND NO = '{2}'
  132. AND partno = '{3}'
  133. AND nvl ( filepath, '*' ) != '*'
  134. AND rownum < 2
  135. UNION ALL
  136. SELECT
  137. filepath,
  138. '' FileType
  139. FROM
  140. V_C_ZONGHEGONGXU
  141. WHERE
  142. prcvno = '{0}'
  143. AND ver = '{1}'
  144. AND NO = '{2}'
  145. AND partno = '{3}'
  146. AND nvl ( filepath, '*' ) != '*'
  147. AND rownum < 2 ";
  148. try
  149. {
  150. sql = string.Format(sql, prcvno, ver, no, partno);
  151. DataTable table = null;// DBHelper_Oracle.GetDataSet(sql).Tables[0];
  152. return table;
  153. }
  154. catch (Exception ex)
  155. {
  156. throw ex;
  157. }
  158. }
  159. /// <summary>
  160. /// 获取图纸信息Item
  161. /// </summary>
  162. /// <param name="ItemCode">物料编码</param>
  163. /// <returns>图纸地址</returns>
  164. public static String SearchPathItem(String ItemCode, String type)
  165. {
  166. string sql = @" select doc_pdfaddress from sipm7 where mtr_code='" + ItemCode + "' ";
  167. string filepath = "";
  168. try
  169. {
  170. //DataTable table = DBHelper_Oracle.GetDataSet(sql).Tables[0];
  171. //if (table != null && table.Rows.Count > 0)
  172. //{
  173. // filepath = table.Rows[0]["doc_pdfaddress"].ToString();
  174. //}
  175. }
  176. catch (Exception ex)
  177. {
  178. throw new Exception(ex.Message);
  179. }
  180. return filepath;
  181. }
  182. /// <summary>
  183. /// 拆分工艺路线 ,获取工艺路线和版本号
  184. /// </summary>
  185. /// <param name="RouteCodeOLD">MES工艺路线</param>
  186. /// <param name="RouteCode">返回PLM工艺路线</param>
  187. /// <param name="Version">返回版本号</param>
  188. /// <returns></returns>
  189. public static void GetRouteVersion(String RouteCodeOLD, ref string RouteCode, ref string Version)
  190. {
  191. if (!string.IsNullOrEmpty(RouteCodeOLD) && RouteCodeOLD.Contains("-"))
  192. {
  193. int index = RouteCodeOLD.LastIndexOf('-');
  194. RouteCode = RouteCodeOLD.Substring(0, index);
  195. Version = RouteCodeOLD.Substring(index + 1);
  196. }
  197. }
  198. }
  199. }