|
|
@@ -3,8 +3,13 @@ using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel;
|
|
|
using System.Data;
|
|
|
+using System.Globalization;
|
|
|
+using System.IO;
|
|
|
+using System.Net;
|
|
|
using System.Runtime.InteropServices;
|
|
|
+using System.Security.Cryptography;
|
|
|
using System.Text;
|
|
|
+using System.Text.RegularExpressions;
|
|
|
using System.Web.Script.Serialization;
|
|
|
|
|
|
namespace UMESDLLService
|
|
|
@@ -18,15 +23,24 @@ namespace UMESDLLService
|
|
|
bool CheckRoutePassed(string iSN, string iResCode, out string oErrMessage);
|
|
|
bool GetRcardMOInfo(string iSN, out string oMoCode, out string oErrMessage);
|
|
|
bool CheckUserAndResourcePassed(string iUserCode, string iResCode, string iPassWord, out string oErrMessage);
|
|
|
- bool GetAddressRangeByMO(string iSN, out string oInfo, out string oErrMessage);
|
|
|
+ bool GetAddressRangeByMO(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oErrMessage);
|
|
|
bool SetAddressInfo(string iSN, string iMac, string iBT, string iCode1, string iCode2, string iCode3, out string oErrorMessage);
|
|
|
- bool SetTestDetail(string iSN, string iTestResult, string iResCode, string[,] iTestDetail, out string oErrMessage);
|
|
|
- bool GetMEIOrNetCodeRange(string iSnCode, string iIMEI1, string iNetCode, out string oInfo, out string oErrMessage);
|
|
|
- bool SetIMEIInfo(string iSnCode, string iIMEI1, out string oErrMessage);
|
|
|
+ bool SetTestDetail(string iSN, string iResCode, string[] iClassName, string[] iTestResult, string iMaxValue, string iMinValue, string[] iTestDetail, out string oErrMessage);
|
|
|
+ bool GetMEIOrNetCodeRange(string iSN, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oIMEI3, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oErrMessage);
|
|
|
+ bool SetIMEIInfo(string iSN, string iIMEI1, string iIMEI2, string iIMEI3, string iMEID, string iPSN, string iNETCODE, string iID1, string iID2, string iID3, out string oErrMessage);
|
|
|
bool GetMobileAllInfo(string iSnCode, out string oInfo, out string oErrorMessage);
|
|
|
bool SetMobileData(string iTSN, string iSN, string iSourceCode, string iOperator, string iResult, string iErrCode, string flag, out string oErrorMessage);
|
|
|
bool SetPcbaData(string iSN, string iResCode, string iOperator, string iResult, string iErrCode, out string oErrMessage);
|
|
|
bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage);
|
|
|
+ bool GetInfoByMaterial(string iPCBA, out string oSN, out string oErrMessage);
|
|
|
+ bool GetSoftVersion(string iSN, out string oSoftVersion, out string oErrMessage);
|
|
|
+ bool GetMakeInfoBySN(string iSN, out string oInfo, out string oErrorMessage);
|
|
|
+ bool GetPSN(string iSN, out string oInfo, out string oErrorMessage);
|
|
|
+
|
|
|
+ bool GetMakeInfo(string iSN, out string oInfo, out string oErrorMessage);
|
|
|
+
|
|
|
+ bool GetPCBABySN(string iSN, out string oPCBA);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
[Guid("5379A8F6-EB38-4A2B-9050-52AD9757E12D")]
|
|
|
@@ -39,8 +53,10 @@ namespace UMESDLLService
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
//用于存放批量执行的SQL
|
|
|
List<string> sqls = new List<string>();
|
|
|
+
|
|
|
+ string Master = "YD_CYZZ";
|
|
|
//系统默认的的连接字符串
|
|
|
- private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES_T;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=218.64.89.153)(PORT=61521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
|
|
|
+ private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.15.168)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
|
|
|
//用户选择的数据库的连接字符串
|
|
|
private OracleConnection connection;
|
|
|
//用户选择的数据库的连接字符串
|
|
|
@@ -53,7 +69,52 @@ namespace UMESDLLService
|
|
|
|
|
|
public MESHelper(string IP)
|
|
|
{
|
|
|
- connection = new OracleConnection("Data Source=" + IP + "/orcl;User ID=MES;PassWord=select!#%*(;");
|
|
|
+ connection = new OracleConnection("Data Source=" + IP + "/orcl;User ID=N_MES;PassWord=select!#%*(;");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ [Description("获取工单软件版本")]
|
|
|
+ public bool GetSoftVersion(string iMakeCode, out string oSoftVersion, out string oErrMessage)
|
|
|
+ {
|
|
|
+ string oMakeCode = "";
|
|
|
+ oErrMessage = "";
|
|
|
+ oSoftVersion = "";
|
|
|
+ //GetRcardMOInfo(iSN, out oMakeCode, out oErrMessage);
|
|
|
+ if (!CheckExist("Make", "ma_Code='" + iMakeCode + "'"))
|
|
|
+ {
|
|
|
+ oErrMessage = "工单号" + iMakeCode + "不存在";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ oSoftVersion = getFieldDataByCondition("make", "ma_softversion", "ma_code='" + iMakeCode + "'").ToString();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public bool GetInfoByMaterial(string iPCBA, out string oSN, out string oErrMessage)
|
|
|
+ {
|
|
|
+ oSN = "";
|
|
|
+ oErrMessage = "";
|
|
|
+ if (iPCBA == "")
|
|
|
+ {
|
|
|
+ oErrMessage = "主板SN不能为空";
|
|
|
+ }
|
|
|
+
|
|
|
+ DataTable dt = (DataTable)ExecuteSql("select ms_firstsn,ms_sncode from CRAFTMATERIAL left join make on cm_makecode=ma_code " +
|
|
|
+ "left join makeserial on ms_firstsn=cm_firstsn and cm_makecode=ms_makecode where cm_barcode='" + iPCBA + "' and nvl(cm_status,0)<>-1 order by cm_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ oSN = dt.Rows[0]["ms_sncode"].ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ oErrMessage = "主板SN未查询到关联信息";
|
|
|
+ }
|
|
|
+ if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -71,12 +132,22 @@ namespace UMESDLLService
|
|
|
oErrMessage = "SN不能为空";
|
|
|
return false;
|
|
|
}
|
|
|
+ string SNcode = iSN;
|
|
|
+ DataTable dt = (DataTable)ExecuteSql("select ms_sncode from makeserial where ms_sncode='" + iSN + "' or ms_imei1='" + iSN + "' or ms_imei2='" + iSN + "' order by ms_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ iSN = dt.Rows[0]["ms_sncode"].ToString();
|
|
|
+ }
|
|
|
+ if (iSN == "")
|
|
|
+ {
|
|
|
+ iSN = SNcode;
|
|
|
+ }
|
|
|
oErrMessage = "";
|
|
|
string[] param = new string[] { "", iResCode, iSN, "", "", "", oErrMessage };
|
|
|
string[] ParamName = new string[] { "v_i_macode", "v_i_sourcecode", "v_i_sncode", "v_i_usercode", "v_o_macode", "v_o_msid", "v_o_errmsg" };
|
|
|
CallProcedure("CS_CHECKSTEPSNANDMACODE", ParamName, ref param);
|
|
|
oErrMessage = param[6];
|
|
|
- DataTable dt = (DataTable)ExecuteSql("select ms_status,ms_stepcode,ms_nextstepcode from makeserial where ms_id=( select max(ms_id) from makeserial where ms_sncode in ( select '" + iSN + "' from dual union select sn from makesnrelation where beforesn='" + iSN + "' and sn<>' ' union select beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' '))", "select");
|
|
|
+ dt = (DataTable)ExecuteSql("select ms_status,ms_stepcode,ms_nextstepcode from makeserial where ms_id=( select max(ms_id) from makeserial where ms_sncode in ( select '" + iSN + "' from dual union select sn from makesnrelation where beforesn='" + iSN + "' and sn<>' ' union select beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' '))", "select");
|
|
|
string ms_status = "";
|
|
|
string ms_stepcode = "";
|
|
|
string ms_nextstepcode = "";
|
|
|
@@ -89,7 +160,7 @@ namespace UMESDLLService
|
|
|
string stepcode = GetStepCodeBySource(iResCode);
|
|
|
if (ms_nextstepcode != "" && ms_nextstepcode != stepcode)
|
|
|
{
|
|
|
- oErrMessage = "当前序列号下一工序" + ms_nextstepcode;
|
|
|
+ oErrMessage = "当前序列号" + iSN + "下一工序" + ms_nextstepcode;
|
|
|
return false;
|
|
|
}
|
|
|
if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null" || (ms_status == "3" && stepcode == ms_stepcode))
|
|
|
@@ -211,14 +282,13 @@ namespace UMESDLLService
|
|
|
/// <param name="oErrMessage"></param>
|
|
|
/// <returns></returns>
|
|
|
[Description("分配MAC和BT信息")]
|
|
|
- public bool GetAddressRangeByMO(string iSN, out string oInfo, out string oErrMessage)
|
|
|
+ public bool GetAddressRangeByMO(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oErrMessage)
|
|
|
{
|
|
|
- oInfo = "";
|
|
|
- string oWIFI = "";
|
|
|
- string oBT = "";
|
|
|
- string oCode1 = "";
|
|
|
- string oCode2 = "";
|
|
|
- string oCdoe3 = "";
|
|
|
+ oWIFI = "";
|
|
|
+ oBT = "";
|
|
|
+ oCode1 = "";
|
|
|
+ oCode2 = "";
|
|
|
+ oCode3 = "";
|
|
|
if (iSN == "")
|
|
|
{
|
|
|
oErrMessage = "SN不能为空";
|
|
|
@@ -227,14 +297,14 @@ namespace UMESDLLService
|
|
|
oErrMessage = "";
|
|
|
string omakeCode = "";
|
|
|
GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
|
|
|
- string[] param = new string[] { iSN, omakeCode, oWIFI, oBT, oCode1, oCode2, oCdoe3, oErrMessage };
|
|
|
+ string[] param = new string[] { iSN, omakeCode, oWIFI, oBT, oCode1, oCode2, oCode3, oErrMessage };
|
|
|
string[] ParamName = new string[] { "v_i_sncode", "v_i_macode", "v_o_mac", "v_o_bt", "v_o_code1", "v_o_code2", "v_o_code3", "v_o_errmsg" };
|
|
|
CallProcedure("CS_GETADDRESSBYMAKECODE", ParamName, ref param);
|
|
|
- oInfo += "MAC:"+param[2].ToString() + "^";
|
|
|
- oInfo += "BT:" + param[3].ToString() + "^";
|
|
|
- oInfo += "Code1:" + param[4].ToString() + "^";
|
|
|
- oInfo += "Code2:" + param[5].ToString() + "^";
|
|
|
- oInfo += "Code3:" + param[6].ToString() + "";
|
|
|
+ oWIFI = param[2].ToString();
|
|
|
+ oBT = param[3].ToString();
|
|
|
+ oCode1 = param[4].ToString();
|
|
|
+ oCode2 = param[5].ToString();
|
|
|
+ oCode3 = param[6].ToString();
|
|
|
oErrMessage = param[7];
|
|
|
if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
|
|
|
return true;
|
|
|
@@ -261,36 +331,35 @@ namespace UMESDLLService
|
|
|
/// <param name="oErrMessage"></param>
|
|
|
/// <returns></returns>
|
|
|
[Description("分配IMEI和NetCode信息")]
|
|
|
- public bool GetMEIOrNetCodeRange(string iSN, string iIMEI1, string iNetCode, out string oInfo, out string oErrMessage)
|
|
|
+ public bool GetMEIOrNetCodeRange(string iSN, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oIMEI3, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oErrMessage)
|
|
|
{
|
|
|
- oInfo = "";
|
|
|
- string oIMEI1 = "";
|
|
|
- string oIMEI2 = "";
|
|
|
- string oMEID = "";
|
|
|
- string oNetCode = "";
|
|
|
- string oPSN = "";
|
|
|
- string oID1 = "";
|
|
|
- string oID2 = "";
|
|
|
- string oID3 = "";
|
|
|
-
|
|
|
+ oIMEI1 = "";
|
|
|
+ oIMEI2 = "";
|
|
|
+ oIMEI3 = "";
|
|
|
+ oMEID = "";
|
|
|
+ oNetCode = "";
|
|
|
+ oPSN = "";
|
|
|
+ oID1 = "";
|
|
|
+ oID2 = "";
|
|
|
+ oID3 = "";
|
|
|
if (iSN == "")
|
|
|
{
|
|
|
oErrMessage = "SN不能为空";
|
|
|
return false;
|
|
|
}
|
|
|
oErrMessage = "";
|
|
|
- string[] param = new string[] { iSN, "", iIMEI1, iNetCode, oIMEI1, oIMEI2, "", oMEID, oNetCode, oPSN, oID1, oID2, oID3, oErrMessage };
|
|
|
+ string[] param = new string[] { iSN, "", iIMEI1, iNetCode, oIMEI1, oIMEI2, oIMEI3, oMEID, oNetCode, oPSN, oID1, oID2, oID3, oErrMessage };
|
|
|
string[] ParamName = new string[] { "v_i_sncode", "v_i_macode", "v_i_imei", "v_i_netcode", "v_o_imei1", "v_o_imei2", "v_o_imei3", "v_o_meid", "v_o_netcode", "v_o_psn", "v_o_id1", "v_o_id2", "v_o_id3", "v_o_errmsg" };
|
|
|
CallProcedure("CS_GETIMEIORNETCODERANGE", ParamName, ref param);
|
|
|
-
|
|
|
- oInfo += "IMEI1:" + param[4].ToString() + "^";
|
|
|
- oInfo += "IMEI2:" + param[5].ToString() + "^";
|
|
|
- oInfo += "MEID:" + param[7].ToString() + "^";
|
|
|
- oInfo += "NETCODE:" + param[8].ToString() + "^";
|
|
|
- oInfo += "PSN:" + param[9].ToString() + "";
|
|
|
- oInfo += "ID1:" + param[10].ToString() + "";
|
|
|
- oInfo += "ID2:" + param[11].ToString() + "";
|
|
|
- oInfo += "ID3:" + param[12].ToString() + "";
|
|
|
+ oIMEI1 = param[4].ToString();
|
|
|
+ oIMEI2 = param[5].ToString();
|
|
|
+ oIMEI3 = param[6].ToString();
|
|
|
+ oMEID = param[7].ToString();
|
|
|
+ oNetCode = param[8].ToString();
|
|
|
+ oPSN = param[9].ToString();
|
|
|
+ oID1 = param[10].ToString();
|
|
|
+ oID2 = param[11].ToString();
|
|
|
+ oID3 = param[12].ToString();
|
|
|
oErrMessage = param[13];
|
|
|
if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
|
|
|
return true;
|
|
|
@@ -331,7 +400,7 @@ namespace UMESDLLService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
+ /// <summary>
|
|
|
/// 获取序列号的所有串号信息
|
|
|
/// </summary>
|
|
|
/// <param name="iSN"></param>
|
|
|
@@ -365,31 +434,16 @@ namespace UMESDLLService
|
|
|
oErrMessage = "SN不能为空";
|
|
|
return false;
|
|
|
}
|
|
|
- string MacInfo;
|
|
|
- if (!GetAddressRangeByMO(iSN, out MacInfo, out oErrMessage))
|
|
|
- {
|
|
|
- if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
|
|
|
- return true;
|
|
|
- else
|
|
|
- return false;
|
|
|
- }
|
|
|
- string MAC = MacInfo.Split('^')[0].Replace("MAC:", "");
|
|
|
- string BT = MacInfo.Split('^')[1].Replace("BT:", "");
|
|
|
- string TCode1 = MacInfo.Split('^')[2].Replace("Code1:", "");
|
|
|
- string TCode2 = MacInfo.Split('^')[3].Replace("Code2:", "");
|
|
|
- string TCode3 = MacInfo.Split('^')[4].Replace("Code3:", "");
|
|
|
- if (!SetAddressInfo(iSN, MAC == "null" ? "" : MAC, BT == "null" ? "" : BT, TCode1 == "null" ? "" :TCode1,TCode2 == "null" ? "" :TCode2,TCode3 == "null" ? "" :TCode3, out oErrMessage))
|
|
|
+ DataTable dt = (DataTable)ExecuteSql("select ms_sncode from makeserial where ms_sncode='" + iSN + "' or ms_firstsn='" + iSN + "' order by ms_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
|
|
|
- return true;
|
|
|
- else
|
|
|
- return false;
|
|
|
+ iSN = dt.Rows[0]["ms_sncode"].ToString();
|
|
|
}
|
|
|
//通过序列号获取最近操作的工单号
|
|
|
string ms_id = getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + iSN + "' or ms_firstsn='" + iSN + "'").ToString();
|
|
|
if (ms_id != "")
|
|
|
{
|
|
|
- DataTable dt = getFieldsDataByCondition("MakeSerial", new string[] { "ms_id", "ms_mac", "ms_bt", "ms_meid", "ms_netcode", "ms_psn", "ms_imei1", "ms_imei2", "ms_imei3", "ms_othcode1", "ms_othcode2", "ms_othcode3", "ms_othid1", "ms_othid2", "ms_othid3" }, "ms_id='" + ms_id + "'");
|
|
|
+ dt = getFieldsDataByCondition("MakeSerial", new string[] { "ms_id", "ms_mac", "ms_bt", "ms_meid", "ms_netcode", "ms_psn", "ms_imei1", "ms_imei2", "ms_imei3", "ms_othcode1", "ms_othcode2", "ms_othcode3", "ms_othid1", "ms_othid2", "ms_othid3" }, "ms_id='" + ms_id + "'");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
string Code1 = "";
|
|
|
@@ -419,7 +473,7 @@ namespace UMESDLLService
|
|
|
string Code25 = "";
|
|
|
string[] param = new string[] { ms_id, Code1, Code2, Code3, Code4, Code5, Code6, Code7, Code8, Code9, Code10, Code11, Code12, Code13, Code14, Code15, Code16, Code17, Code18, Code19, Code20, Code21, Code22, Code23, Code24, Code25 };
|
|
|
string[] ParamName = new string[] { "v_ms_id", "v_i_code1", "v_i_code2", "v_i_code3", "v_i_code4", "v_i_code5", "v_i_code6", "v_i_code7", "v_i_code8", "v_i_code9", "v_i_code10", "v_i_code11", "v_i_code12", "v_i_code13", "v_i_code14", "v_i_code15", "v_i_code16", "v_i_code17", "v_i_code18", "v_i_code19", "v_i_code20", "v_i_code21", "v_i_code22", "v_i_code23", "v_i_code24", "v_i_code25" };
|
|
|
- CallProcedure("GetMobileAllInfo_NEW", ParamName, ref param);
|
|
|
+ CallProcedure("GetMobileAllInfo_NEW_TOOL", ParamName, ref param);
|
|
|
for (int i = 1; i < param.Length; i++)
|
|
|
{
|
|
|
//获取出来的参数使用^分割
|
|
|
@@ -489,6 +543,7 @@ namespace UMESDLLService
|
|
|
return false;
|
|
|
}
|
|
|
oErrMessage = "";
|
|
|
+ iSN = getFieldDataByCondition("makeserial", "ms_sncode", "ms_sncode='" + iSN + "' order by ms_id").ToString();
|
|
|
string[] param = new string[] { iSN, iMac, iBT, iCode1, iCode2, iCode3, oErrMessage };
|
|
|
string[] ParamName = new string[] { "v_i_sncode", "v_i_mac", "v_i_bt", "v_i_code1", "v_i_code2", "v_i_code3", "v_o_errmsg" };
|
|
|
CallProcedure("CS_SETADDRESSINFO", ParamName, ref param);
|
|
|
@@ -582,6 +637,19 @@ namespace UMESDLLService
|
|
|
oErrorMessage = "";
|
|
|
if (iTSN == "") { oErrorMessage = "TSN不能为空"; return false; }
|
|
|
if (iSN == "") { oErrorMessage = "SN不能为空"; return false; }
|
|
|
+ DataTable dt = (DataTable)ExecuteSql("select ms_sncode from makeserial where ms_sncode='" + iTSN + "' order by ms_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ iTSN = dt.Rows[0]["ms_sncode"].ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ dt = (DataTable)ExecuteSql("select ms_sncode from makeserial where ms_imei2='" + iTSN + "' order by ms_id desc", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ iTSN = dt.Rows[0]["ms_sncode"].ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
string[] param = new string[] { iTSN, iSN, iSourceCode, iOperater, iResult, iErrCode, oErrorMessage };
|
|
|
string[] ParamName = new string[] { "v_i_tsn", "v_i_sncode", "v_i_sourcecode", "v_i_usercode", "v_i_result", "v_i_errcode", "v_o_errmsg" };
|
|
|
CallProcedure("CS_DLLSNCHANGE_TOOL", ParamName, ref param);
|
|
|
@@ -628,7 +696,7 @@ namespace UMESDLLService
|
|
|
/// <param name="oErrMessage"></param>
|
|
|
/// <returns></returns>
|
|
|
[Description("设置测试结果")]
|
|
|
- public bool SetTestDetail(string iSN, string iClass, string iResCode, string[,] iTestDetail, out string oErrMessage)
|
|
|
+ public bool SetTestDetail(string iSN, string iResCode, string[] iClassName, string[] iTestResult, string iMaxValue, string iMinValue, string[] iTestDetail, out string oErrMessage)
|
|
|
{
|
|
|
if (iSN == "" || iSN == null)
|
|
|
{
|
|
|
@@ -640,36 +708,17 @@ namespace UMESDLLService
|
|
|
GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
|
|
|
sql.Clear();
|
|
|
sql.Append("begin ");
|
|
|
- bool needBreak = false;
|
|
|
- for (int i = 0; i < iTestDetail.Length / 200; i++)
|
|
|
+ if (iClassName.Length != iTestResult.Length || iTestResult.Length != iTestDetail.Length)
|
|
|
{
|
|
|
- string DataField = "Insert into MES_TEST(STD_ID,STD_SN,STD_MAKECODE,STD_CLASS,STD_TESTDATE,";
|
|
|
- string ValueField = ")values(MES_TEST_SEQ.nextval,'" + iSN + "','" + omakeCode + "','" + iClass + "',sysdate,";
|
|
|
- for (int j = 0; j < 200; j++)
|
|
|
- {
|
|
|
- if (j == 0)
|
|
|
- {
|
|
|
- DataField += "STD_ITEMNAME,";
|
|
|
- //如果传递的参数没有测试名称则中断插入
|
|
|
- if (iTestDetail[i, j] == "" || iTestDetail[i, j] == null)
|
|
|
- {
|
|
|
- //外层循环也需要中断
|
|
|
- needBreak = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DataField += "STD_ITEM" + j + " ,";
|
|
|
- }
|
|
|
- ValueField += "'" + iTestDetail[i, j] + "',";
|
|
|
- }
|
|
|
- if (needBreak)
|
|
|
- break;
|
|
|
- sql.Append(DataField.Substring(0, DataField.Length - 1) + ValueField.Substring(0, ValueField.Length - 1) + ");");
|
|
|
+ oErrMessage = "参数项次不对应";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (int i = 0; i < iTestDetail.Length; i++)
|
|
|
+ {
|
|
|
+ string sql = "Insert into STEPTESTDETAIL (STD_ID,STD_CLASS,STD_SN,STD_MAKECODE,STD_ACTUALVALUE,STD_TESTRESULT,STD_INDATE,STD_RESCODE,STD_MAXVALUE, STD_MINVALUE)";
|
|
|
+ sql += "values(STEPTESTDETAIL_SEQ.nextval,'" + iClassName[i] + "','" + iSN + "','" + omakeCode + "','" + iTestDetail[i] + "','" + iTestResult[i] + "',sysdate,'" + iResCode + "','" + iMaxValue + "','" + iMinValue + "')";
|
|
|
+ ExecuteSql(sql.ToString(), "insert");
|
|
|
}
|
|
|
- sql.Append("end;");
|
|
|
- ExecuteSql(sql.ToString(), "insert");
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -692,7 +741,7 @@ namespace UMESDLLService
|
|
|
/// <param name="oErrorMessage"></param>
|
|
|
/// <returns></returns>
|
|
|
[Description("设置IMEI信息")]
|
|
|
- public bool SetIMEIInfo(string iSN, string iIMEI1, out string oErrMessage)
|
|
|
+ public bool SetIMEIInfo(string iSN, string iIMEI1, string iIMEI2, string iIMEI3, string iMEID, string iPSN, string iNETCODE, string iID1, string iID2, string iID3, out string oErrMessage)
|
|
|
{
|
|
|
if (iSN == "")
|
|
|
{
|
|
|
@@ -700,7 +749,7 @@ namespace UMESDLLService
|
|
|
return false;
|
|
|
}
|
|
|
oErrMessage = "";
|
|
|
- string[] param = new string[] { iSN, iIMEI1, "", "", "", "", "", "", "", "", oErrMessage };
|
|
|
+ string[] param = new string[] { iSN, iIMEI1, iIMEI2, iIMEI3, iMEID, iNETCODE, iPSN, iID1, iID2, iID3, oErrMessage };
|
|
|
string[] ParamName = new string[] { "v_i_sncode", "v_i_imei1", "v_i_imei2", "v_i_imei3", "v_i_meid", "v_i_netcode", "v_i_psn", "v_i_id1", "v_i_id2", "v_i_id3", "v_o_errmsg" };
|
|
|
CallProcedure("CS_SETIMEIINFO", ParamName, ref param);
|
|
|
oErrMessage = param[10];
|
|
|
@@ -728,6 +777,15 @@ namespace UMESDLLService
|
|
|
oErrMessage = "SN不能为空";
|
|
|
return false;
|
|
|
}
|
|
|
+ string SNcode = iSN;
|
|
|
+ //if (!GetInfoByMaterial(iSN, out iSN, out oErrMessage))
|
|
|
+ //{
|
|
|
+ // oErrMessage = "";
|
|
|
+ //}
|
|
|
+ if (iSN == "")
|
|
|
+ {
|
|
|
+ iSN = SNcode;
|
|
|
+ }
|
|
|
oErrMessage = "";
|
|
|
string oMakeCode = "";
|
|
|
GetRcardMOInfo(iSN, out oMakeCode, out oErrMessage);
|
|
|
@@ -1185,5 +1243,184 @@ namespace UMESDLLService
|
|
|
cmd.Connection.Open();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 验证用户身份信息
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="iUserCode"></param>
|
|
|
+ /// <param name="oErrorMessage"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private bool CheckUserLogin(string iUserCode, string iPassWord, string Master, out string oErrorMessage)
|
|
|
+ {
|
|
|
+ oErrorMessage = "";
|
|
|
+ string SQL = "select em_code from employee where em_code=:UserName and em_password =:PassWord";
|
|
|
+ DataTable dt;
|
|
|
+ dt = (DataTable)ExecuteSql(SQL, "select", iUserCode, iPassWord);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ return true;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ oErrorMessage = "用户名或者密码不正确!";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Dictionary<string, object> ToDictionary(string JsonData)
|
|
|
+ {
|
|
|
+ object Data = null;
|
|
|
+ Dictionary<string, object> Dic = new Dictionary<string, object>();
|
|
|
+ if (JsonData.StartsWith("["))
|
|
|
+ {
|
|
|
+ //如果目标直接就为数组类型,则将会直接输出一个Key为List的List<Dictionary<string, object>>集合
|
|
|
+ //使用示例List<Dictionary<string, object>> ListDic = (List<Dictionary<string, object>>)Dic["List"];
|
|
|
+ List<Dictionary<string, object>> List = new List<Dictionary<string, object>>();
|
|
|
+ MatchCollection ListMatch = Regex.Matches(JsonData, @"{[\s\S]+?}");//使用正则表达式匹配出JSON数组
|
|
|
+ foreach (Match ListItem in ListMatch)
|
|
|
+ {
|
|
|
+ List.Add(ToDictionary(ListItem.ToString()));//递归调用
|
|
|
+ }
|
|
|
+ Data = List;
|
|
|
+ Dic.Add("List", Data);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MatchCollection Match = Regex.Matches(JsonData, @"""(.+?)"": {0,1}(\[[\s\S]+?\]|null|"".+?""|-{0,1}\d*)");//使用正则表达式匹配出JSON数据中的键与值
|
|
|
+ foreach (Match item in Match)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (item.Groups[2].ToString().StartsWith("["))
|
|
|
+ {
|
|
|
+ //如果目标是数组,将会输出一个Key为当前Json的List<Dictionary<string, object>>集合
|
|
|
+ //使用示例List<Dictionary<string, object>> ListDic = (List<Dictionary<string, object>>)Dic["Json中的Key"];
|
|
|
+ List<Dictionary<string, object>> List = new List<Dictionary<string, object>>();
|
|
|
+ MatchCollection ListMatch = Regex.Matches(item.Groups[2].ToString(), @"{[\s\S]+?}");//使用正则表达式匹配出JSON数组
|
|
|
+ foreach (Match ListItem in ListMatch)
|
|
|
+ {
|
|
|
+ List.Add(ToDictionary(ListItem.ToString()));//递归调用
|
|
|
+ }
|
|
|
+ Data = List;
|
|
|
+ }
|
|
|
+ else if (item.Groups[2].ToString().ToLower() == "null") Data = null;//如果数据为null(字符串类型),直接转换成null
|
|
|
+ else Data = item.Groups[2].ToString(); //数据为数字、字符串中的一类,直接写入
|
|
|
+ Dic.Add(item.Groups[1].ToString(), Data);
|
|
|
+ }
|
|
|
+ catch { }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Dic;
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool GetMakeInfoBySN(string iSN, out string oInfo, out string oErrorMessage)
|
|
|
+ {
|
|
|
+ oInfo = "";
|
|
|
+ oErrorMessage = "";
|
|
|
+ DataTable rs = (DataTable)ExecuteSql("select ma_remark1,ma_remark2,ma_remark3,ma_remark4,ma_remark5,ma_remark6,ma_remark7,ma_remark8,ma_remark9,ma_remark10,ma_remark11,ma_remark12,ma_remark13,ma_remark14,ma_remark15,ma_remark16,ma_remark17,ma_remark18 from " + Master + ".make " +
|
|
|
+ "left join " + Master + ".makeserial on ms_makecode=ma_code where ms_sncode='" + iSN + "' order by ms_id desc", "select");
|
|
|
+ if (rs.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ oInfo += "oMaremark1:" + rs.Rows[0]["ma_remark1"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark2:" + rs.Rows[0]["ma_remark2"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark3:" + rs.Rows[0]["ma_remark3"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark4:" + rs.Rows[0]["ma_remark4"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark5:" + rs.Rows[0]["ma_remark5"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark6:" + rs.Rows[0]["ma_remark6"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark7:" + rs.Rows[0]["ma_remark7"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark8:" + rs.Rows[0]["ma_remark8"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark9:" + rs.Rows[0]["ma_remark9"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark10:" + rs.Rows[0]["ma_remark10"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark11:" + rs.Rows[0]["ma_remark11"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark12:" + rs.Rows[0]["ma_remark12"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark13:" + rs.Rows[0]["ma_remark13"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark14:" + rs.Rows[0]["ma_remark14"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark15:" + rs.Rows[0]["ma_remark15"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark16:" + rs.Rows[0]["ma_remark16"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark17:" + rs.Rows[0]["ma_remark17"].ToString() + "^";
|
|
|
+ oInfo += "oMaremark18:" + rs.Rows[0]["ma_remark18"].ToString() + "^";
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ oErrorMessage = "SN未查询到关联信息";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool GetMakeInfo(string iSN, out string oInfo, out string oErrorMessage)
|
|
|
+ {
|
|
|
+ oInfo = "";
|
|
|
+ oErrorMessage = "";
|
|
|
+ JavaScriptSerializer jss = new JavaScriptSerializer();
|
|
|
+ if (iSN == "")
|
|
|
+ {
|
|
|
+ oErrorMessage = "SN不能为空";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ Dictionary<string, string> Info = new Dictionary<string, string>();
|
|
|
+ String makecode = getFieldDataByCondition("makeserial", "ms_makecode", "ms_id=(select max(ms_id) from makeserial where ms_sncode='" + iSN + "')").ToString();
|
|
|
+ DataTable rs = (DataTable)ExecuteSql("select mid_item,mid_value from makeitem left join makeitemdetail on mi_id=mid_miid where mi_makecode='" + makecode + "' and mid_item is not null", "select");
|
|
|
+ for (int i = 0; i < rs.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ Info.Add(rs.Rows[i]["mid_item"].ToString(), rs.Rows[i]["mid_value"].ToString());
|
|
|
+ }
|
|
|
+ oInfo = jss.Serialize(Info);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool GetPSN(string iSN, out string oPSN, out string oErrorMessage)
|
|
|
+ {
|
|
|
+ oPSN = "";
|
|
|
+ oErrorMessage = "";
|
|
|
+ string iMakecode = getFieldDataByCondition("makeserial", "ms_makecode", "ms_id=(select max(ms_id) from makeserial where ms_sncode='" + iSN + "')").ToString();
|
|
|
+ if (iMakecode == "")
|
|
|
+ {
|
|
|
+ oErrorMessage = iSN + "无关联工单";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ DataTable rs = (DataTable)ExecuteSql("select msl_sncode from makesnlist where msl_beforesn='" + iSN + "'", "select");
|
|
|
+ if (rs.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ oPSN = rs.Rows[0][0].ToString();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ rs = (DataTable)ExecuteSql("select msl_sncode,msl_id from makesnlist where msl_makecode='" + iMakecode + "' and msl_type='after' and nvl(msl_status,0)=0 order by msl_sncode", "select");
|
|
|
+ if (rs.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ String msl_id = rs.Rows[0]["msl_id"].ToString();
|
|
|
+ String msl_sncode = rs.Rows[0]["msl_sncode"].ToString();
|
|
|
+ ExecuteSql("update makesnlist set msl_status=-1,msl_beforesn='" + iSN + "' where msl_id=" + msl_id + " and nvl(msl_status,0)=0", "update");
|
|
|
+ oPSN = rs.Rows[0][0].ToString();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ oErrorMessage = "无可分配号段";
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void GetPCBABySN(string iSN, out string oPCBA)
|
|
|
+ {
|
|
|
+ string oErrMessage = "";
|
|
|
+ oPCBA = "";
|
|
|
+ if (iSN == null)
|
|
|
+ {
|
|
|
+ oErrMessage = "SN不能为空";
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ DataTable rs = (DataTable)ExecuteSql("select ms_firstsn from makeserial where ms_sncode='" + iSN + "' order by ms_id desc", "select");
|
|
|
+ if (rs.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ rs = (DataTable)ExecuteSql("select cm_barcode from craftmaterial left join product on cm_fsoncode=pr_code " +
|
|
|
+ "where cm_firstsn='" + rs.Rows[0]["ms_firstsn"].ToString() + "' and cm_status=0 and (pr_detail like '%PCBA%' or pr_detail like '%主板%')", "select");
|
|
|
+ if (rs.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ oPCBA = rs.Rows[0]["cm_barcode"].ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|