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
216 lines
7.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data;
|
|
|
|
|
|
namespace ICSSoft.Frame.Data.DAL
|
|
{
|
|
public class ICSPictureDAL
|
|
{
|
|
/// <summary>
|
|
/// 获取图纸信息
|
|
/// </summary>
|
|
/// <param name="no">工序</param>
|
|
/// <param name="prcvno">工艺路线</param>
|
|
/// <param name="ver">版本</param>
|
|
/// <param name="type">图纸名称</param>
|
|
/// <returns></returns>
|
|
public static String SearchPath(String no, String prcvno, String ver, String type,string partno)
|
|
{
|
|
string sql = @" select
|
|
filename,
|
|
filepath
|
|
from
|
|
";
|
|
|
|
string filepath = "";
|
|
switch (type)
|
|
{
|
|
case "过程卡":
|
|
sql += " V_C_GUOCHENG ";
|
|
break;
|
|
case "工序卡":
|
|
sql += " V_C_GONGXU ";
|
|
break;
|
|
case "综合工序卡":
|
|
sql += " V_C_ZONGHEGONGXU ";
|
|
break;
|
|
case "焊接工序卡":
|
|
sql += " V_C_HANJIE ";
|
|
break;
|
|
case "热处理":
|
|
sql += "V_C_RECHULI ";
|
|
break;
|
|
case "作业指导书":
|
|
sql += " V_C_ZUOYEZHIDAO ";
|
|
break;
|
|
}
|
|
|
|
sql +=" where prcvno='" + prcvno + "' and ver='" + ver + "' and no='" + no + "' and partno='"+partno+"' and rownum<2 ";
|
|
try
|
|
{
|
|
//DataTable table = DBHelper_Oracle.GetDataSet(sql).Tables[0];
|
|
//foreach (DataRow row in table.Rows)
|
|
//{
|
|
// filepath = row["filepath"].ToString();
|
|
//}
|
|
|
|
}
|
|
catch (Exception ex) {
|
|
throw ex;
|
|
|
|
}
|
|
return filepath;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取图纸信息(所有类型)
|
|
/// </summary>
|
|
/// <param name="no">工序</param>
|
|
/// <param name="prcvno">工艺路线</param>
|
|
/// <param name="ver">版本</param>
|
|
/// <param name="typeList">图纸名称</param>
|
|
/// <returns></returns>
|
|
public static DataTable SearchPathALL(String no, String prcvno, String ver, string partno,List<string> typeList)
|
|
{
|
|
string sql = @"
|
|
|
|
SELECT
|
|
filepath filepath,
|
|
'过程卡' FileType
|
|
FROM V_C_GUOCHENG
|
|
WHERE
|
|
prcvno = '{0}' ----------------------工艺路线代码
|
|
AND ver = '{1}' ---------------版本
|
|
AND NO = '{2}' ------------------------------工序号
|
|
AND partno = '{3}' ---------------图号
|
|
AND nvl ( filepath, '*' ) != '*'
|
|
AND rownum < 2
|
|
UNION ALL
|
|
SELECT
|
|
filepath,
|
|
'作业指导书' FileType
|
|
FROM
|
|
V_C_ZUOYEZHIDAO
|
|
WHERE
|
|
prcvno = '{0}'
|
|
AND ver = '{1}'
|
|
AND NO = '{2}'
|
|
AND partno = '{3}'
|
|
AND nvl ( filepath, '*' ) != '*'
|
|
AND rownum < 2
|
|
UNION ALL
|
|
SELECT
|
|
filepath,
|
|
'焊接工序卡' FileType
|
|
FROM
|
|
V_C_HANJIE
|
|
WHERE
|
|
prcvno = '{0}'
|
|
AND ver = '{1}'
|
|
AND NO = '{2}'
|
|
AND partno = '{3}'
|
|
AND nvl ( filepath, '*' ) != '*'
|
|
AND rownum < 2
|
|
UNION ALL
|
|
SELECT
|
|
filepath,
|
|
'工序卡' FileType
|
|
FROM
|
|
V_C_GONGXU
|
|
WHERE
|
|
prcvno = '{0}'
|
|
AND ver = '{1}'
|
|
AND NO = '{2}'
|
|
AND partno = '{3}'
|
|
AND nvl ( filepath, '*' ) != '*'
|
|
AND rownum < 2
|
|
UNION ALL
|
|
SELECT
|
|
filepath,
|
|
'热处理' FileType
|
|
FROM
|
|
V_C_RECHULI
|
|
WHERE
|
|
prcvno = '{0}'
|
|
AND ver = '{1}'
|
|
AND NO = '{2}'
|
|
AND partno = '{3}'
|
|
AND nvl ( filepath, '*' ) != '*'
|
|
AND rownum < 2
|
|
UNION ALL
|
|
SELECT
|
|
filepath,
|
|
'综合工序卡' FileType
|
|
FROM
|
|
V_C_ZONGHEGONGXU
|
|
WHERE
|
|
prcvno = '{0}'
|
|
AND ver = '{1}'
|
|
AND NO = '{2}'
|
|
AND partno = '{3}'
|
|
AND nvl ( filepath, '*' ) != '*'
|
|
AND rownum < 2 ";
|
|
try
|
|
{
|
|
sql = string.Format(sql, prcvno, ver, no, partno);
|
|
DataTable table = null;// DBHelper_Oracle.GetDataSet(sql).Tables[0];
|
|
return table;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取图纸信息Item
|
|
/// </summary>
|
|
/// <param name="ItemCode">物料编码</param>
|
|
/// <returns>图纸地址</returns>
|
|
public static String SearchPathItem(String ItemCode, String type)
|
|
{
|
|
string sql = @" select doc_pdfaddress from sipm7 where mtr_code='" + ItemCode + "' ";
|
|
string filepath = "";
|
|
try
|
|
{
|
|
//DataTable table = DBHelper_Oracle.GetDataSet(sql).Tables[0];
|
|
//if (table != null && table.Rows.Count > 0)
|
|
//{
|
|
// filepath = table.Rows[0]["doc_pdfaddress"].ToString();
|
|
//}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(ex.Message);
|
|
|
|
}
|
|
return filepath;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 拆分工艺路线 ,获取工艺路线和版本号
|
|
/// </summary>
|
|
/// <param name="RouteCodeOLD">MES工艺路线</param>
|
|
/// <param name="RouteCode">返回PLM工艺路线</param>
|
|
/// <param name="Version">返回版本号</param>
|
|
/// <returns></returns>
|
|
public static void GetRouteVersion(String RouteCodeOLD, ref string RouteCode, ref string Version)
|
|
{
|
|
if (!string.IsNullOrEmpty(RouteCodeOLD) && RouteCodeOLD.Contains("-"))
|
|
{
|
|
int index = RouteCodeOLD.LastIndexOf('-');
|
|
RouteCode = RouteCodeOLD.Substring(0, index);
|
|
Version = RouteCodeOLD.Substring(index + 1);
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|