|
@@ -1,4 +1,5 @@
|
|
|
-using System;
|
|
|
+using Oracle.ManagedDataAccess.Client;
|
|
|
+using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
using System.Runtime.InteropServices;
|
|
@@ -6,45 +7,44 @@ using System.Text;
|
|
|
|
|
|
namespace DllService
|
|
|
{
|
|
|
- [Guid("7F13A2B7-3B59-4E44-BBB4-77744F2CA1E9")]
|
|
|
- public interface DllService_Interface
|
|
|
+ [Guid("99D0E96E-1058-415D-9874-D34537625284")]
|
|
|
+ [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
|
|
|
+ public interface IMESHelper
|
|
|
{
|
|
|
[DispId(10)]
|
|
|
bool CheckRoutePassed(string iSN, string iResCode, out string oErrMessage);
|
|
|
- bool CheckUserLogin(string iUserCode, string iPassWord, out string oErrorMessage);
|
|
|
- bool CheckUserAndResourcePassed(string iUserCode, string iResCode, out string oErrMessage);
|
|
|
- bool SetIMEIInfo(string iSnCode, string iIMEI1, out string oErrMessage);
|
|
|
- bool GetAddressRangeByMO(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCdoe3, out string oErrMessage);
|
|
|
- bool GetMEIOrNetCodeRange(string iSnCode, 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 oID4, out string oID5, out string oErrMessage);
|
|
|
- bool GetMobileAllInfo(string iSnCode, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, 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 oID4, out string oID5, out string oErrorMessage);
|
|
|
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 oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCdoe3, out string oErrMessage);
|
|
|
bool SetAddressInfo(string iSN, string iWIFI, string iBT, string iCode1, string iCode2, string iCode3, out string oErrorMessage);
|
|
|
- bool SetMobileData(string iSN, string iSourceCode, string iMPKind, string iResult, string iErrCode, out string oErrorMessage);
|
|
|
- bool SetTestDetail(string iSN, string iClass, string iSubClass1, string iSubClass2, string iSubClass3, string iMaxValue, string iMinValue, string iActualValue, string iValue1, string iValue2, string iValue3, string iTestResult, out string oErrMessage);
|
|
|
- }
|
|
|
-
|
|
|
- [Guid("71E1A234-DB0D-44D0-8E30-28FD7B022DF6"),
|
|
|
- InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
|
|
|
- public interface DllService_Events
|
|
|
- {
|
|
|
+ bool SetTestDetail(string iSN, string iClass, string iSubClass1, string iSubClass2, string iSubClass3, string iMaxValue, string iMinValue, string iActualValue, string iValue1, string iValue2, string iValue3, string iTestResult, string iResCode, out string oErrMessage);
|
|
|
+ bool GetMEIOrNetCodeRange(string iSnCode, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage);
|
|
|
+ bool SetIMEIInfo(string iSnCode, string iIMEI1, out string oErrMessage);
|
|
|
+ bool GetMobileAllInfo(string iSnCode, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrorMessage);
|
|
|
+ bool SetMobileData(string iTSN, string iSN, string iSourceCode, string iMPKind, string iResult, string iErrCode, string flag, out string oErrorMessage);
|
|
|
}
|
|
|
|
|
|
- [Guid("C543093F-29A4-4DCF-85F4-C53FC2DB0EB2"),
|
|
|
- ClassInterface(ClassInterfaceType.None),
|
|
|
- ComSourceInterfaces(typeof(DllService_Events))]
|
|
|
-
|
|
|
- public class MESHelper: DllService_Interface
|
|
|
+ [Guid("DF5132FE-EED9-40DB-8B43-9AE63420BCB5")]
|
|
|
+ [ClassInterface(ClassInterfaceType.None)]
|
|
|
+ [ComSourceInterfaces(typeof(IMESHelper))]
|
|
|
+ [ProgId("DllService.MESHelper")]
|
|
|
+ public class MESHelper : IMESHelper
|
|
|
{
|
|
|
- public MESHelper(string Environment)
|
|
|
- {
|
|
|
- dh = new DataHelper(Environment);
|
|
|
- }
|
|
|
-
|
|
|
- DataHelper dh;
|
|
|
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
|
|
|
List<string> sqls = new List<string>();
|
|
|
+
|
|
|
+ private string ConnectionStrings = "Password=select!#%*(;User ID=MES_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
|
|
|
+
|
|
|
+ private OracleConnection connection = new OracleConnection("Password=select!#%*(;User ID=MES_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));");
|
|
|
+
|
|
|
+ private OracleCommand command = null;
|
|
|
+
|
|
|
+ public MESHelper()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -57,7 +57,7 @@ namespace DllService
|
|
|
{
|
|
|
oErrMessage = "";
|
|
|
string[] param = new string[] { "", iResCode, iSN, "", "", "", oErrMessage };
|
|
|
- dh.CallProcedure("CS_CHECKSTEPSNANDMACODE", ref param);
|
|
|
+ CallProcedure("CS_CHECKSTEPSNANDMACODE", ref param);
|
|
|
oErrMessage = param[6];
|
|
|
if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
|
|
|
return true;
|
|
@@ -71,12 +71,12 @@ namespace DllService
|
|
|
|
|
|
|
|
|
|
|
|
- public bool CheckUserLogin(string iUserCode, string iPassWord, out string oErrorMessage)
|
|
|
+ private bool CheckUserLogin(string iUserCode, string iPassWord, out string oErrorMessage)
|
|
|
{
|
|
|
oErrorMessage = "";
|
|
|
string SQL = "select em_code from employee where em_code=:UserName and em_password =:PassWord";
|
|
|
DataTable dt;
|
|
|
- dt = (DataTable)dh.ExecuteSql(SQL, "select", iUserCode, iPassWord);
|
|
|
+ dt = (DataTable)ExecuteSql(SQL, "select", iUserCode, iPassWord);
|
|
|
if (dt.Rows.Count > 0)
|
|
|
return true;
|
|
|
else
|
|
@@ -93,53 +93,56 @@ namespace DllService
|
|
|
|
|
|
|
|
|
|
|
|
- public bool CheckUserAndResourcePassed(string iUserCode, string iResCode, out string oErrMessage)
|
|
|
+ public bool CheckUserAndResourcePassed(string iUserCode, string iResCode, string iPassWord,out string oErrMessage)
|
|
|
{
|
|
|
oErrMessage = "";
|
|
|
- string SQL = "select em_code,em_type,em_name from employee where em_code=:UserName ";
|
|
|
- DataTable dt;
|
|
|
- dt = (DataTable)dh.ExecuteSql(SQL, "select", iUserCode);
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ if (CheckUserLogin(iUserCode, iPassWord, out oErrMessage))
|
|
|
{
|
|
|
- string em_name = dt.Rows[0]["em_name"].ToString();
|
|
|
- string em_type = dt.Rows[0]["em_type"].ToString();
|
|
|
- if (iResCode == "")
|
|
|
- {
|
|
|
- oErrMessage = "岗位资源不允许为空";
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (em_type == "admin")
|
|
|
+ string SQL = "select em_code,em_type,em_name from employee where em_code=:UserName ";
|
|
|
+ DataTable dt;
|
|
|
+ dt = (DataTable)ExecuteSql(SQL, "select", iUserCode);
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
- if (dh.CheckExist("Source", "sc_code='" + iResCode + "' and sc_statuscode='AUDITED'"))
|
|
|
+ string em_name = dt.Rows[0]["em_name"].ToString();
|
|
|
+ string em_type = dt.Rows[0]["em_type"].ToString();
|
|
|
+ if (iResCode == "")
|
|
|
{
|
|
|
- return true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- oErrMessage = "岗位资源编号错误或者未审核!";
|
|
|
+ oErrMessage = "岗位资源不允许为空";
|
|
|
return false;
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- dt = dh.getFieldsDatasByCondition("cs$empgroup left join cs$userresource on ur_groupcode=eg_groupcode left join source on ur_resourcecode=sc_code", new string[] { "ur_resourcecode" }, "eg_emcode = '" + iUserCode + "' and sc_statuscode='AUDITED'");
|
|
|
-
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
+ if (em_type == "admin")
|
|
|
{
|
|
|
-
|
|
|
- for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ if (CheckExist("Source", "sc_code='" + iResCode + "' and sc_statuscode='AUDITED'"))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- if (dt.Rows[i]["ur_resourcecode"].ToString() == iResCode)
|
|
|
- return true;
|
|
|
+ oErrMessage = "岗位资源编号错误或者未审核!";
|
|
|
+ return false;
|
|
|
}
|
|
|
- oErrMessage = "用户不处于当前资源所属分组!";
|
|
|
}
|
|
|
else
|
|
|
- oErrMessage = "岗位资源编号错误或者未审核!";
|
|
|
+ {
|
|
|
+ dt = getFieldsDatasByCondition("cs$empgroup left join cs$userresource on ur_groupcode=eg_groupcode left join source on ur_resourcecode=sc_code", new string[] { "ur_resourcecode" }, "eg_emcode = '" + iUserCode + "' and sc_statuscode='AUDITED'");
|
|
|
+
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+
|
|
|
+ for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (dt.Rows[i]["ur_resourcecode"].ToString() == iResCode)
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ oErrMessage = "用户不处于当前资源所属分组!";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ oErrMessage = "岗位资源编号错误或者未审核!";
|
|
|
+ }
|
|
|
}
|
|
|
+ else
|
|
|
+ oErrMessage = "用户不存在!";
|
|
|
}
|
|
|
- else
|
|
|
- oErrMessage = "用户不存在!";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -165,7 +168,7 @@ namespace DllService
|
|
|
string omakeCode = "";
|
|
|
GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
|
|
|
string[] param = new string[] { iSN, omakeCode, oWIFI, oBT, oCode1, oCode2, oCdoe3, oErrMessage };
|
|
|
- dh.CallProcedure("CS_GETADDRESSBYMAKECODE", ref param);
|
|
|
+ CallProcedure("CS_GETADDRESSBYMAKECODE", ref param);
|
|
|
oWIFI = param[2];
|
|
|
oBT = param[3];
|
|
|
oCode1 = param[4];
|
|
@@ -196,11 +199,10 @@ namespace DllService
|
|
|
|
|
|
|
|
|
|
|
|
- public bool GetMEIOrNetCodeRange(string iSnCode, 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 oID4, out string oID5, out string oErrMessage)
|
|
|
+ public bool GetMEIOrNetCodeRange(string iSnCode, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage)
|
|
|
{
|
|
|
oIMEI1 = "";
|
|
|
oIMEI2 = "";
|
|
|
- oIMEI3 = "";
|
|
|
oMEID = "";
|
|
|
oNetCode = "";
|
|
|
oPSN = "";
|
|
@@ -210,11 +212,10 @@ namespace DllService
|
|
|
oID4 = "";
|
|
|
oID5 = "";
|
|
|
oErrMessage = "";
|
|
|
- string[] param = new string[] { iSnCode, "", iIMEI1, iNetCode, oIMEI1, oIMEI2, oIMEI3, oMEID, oNetCode, oPSN, oID1, oID2, oID3, oErrMessage };
|
|
|
- dh.CallProcedure("CS_GETIMEIORNETCODERANGE", ref param);
|
|
|
+ string[] param = new string[] { iSnCode, "", iIMEI1, iNetCode, oIMEI1, oIMEI2, "", oMEID, oNetCode, oPSN, oID1, oID2, oID3, oErrMessage };
|
|
|
+ CallProcedure("CS_GETIMEIORNETCODERANGE", ref param);
|
|
|
oIMEI1 = param[4];
|
|
|
oIMEI2 = param[5];
|
|
|
- oIMEI3 = param[6];
|
|
|
oMEID = param[7];
|
|
|
oNetCode = param[8];
|
|
|
oPSN = param[9];
|
|
@@ -240,8 +241,8 @@ namespace DllService
|
|
|
|
|
|
oMoCode = "";
|
|
|
oErrMessage = "";
|
|
|
- string ms_id = dh.getFieldDataByCondition("MakeSerial", "max(ms_id) ms_id", "ms_sncode='" + iSN + "' or ms_firstsn in (select firstsn from makesnrelation where sn='" + iSN + "')").ToString();
|
|
|
- oMoCode = dh.getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
|
|
|
+ string ms_id = getFieldDataByCondition("MakeSerial", "max(ms_id) ms_id", "ms_sncode='" + iSN + "' or ms_firstsn in (select firstsn from makesnrelation where sn='" + iSN + "')").ToString();
|
|
|
+ oMoCode = getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
|
|
|
if (oMoCode != "")
|
|
|
return true;
|
|
|
else
|
|
@@ -254,7 +255,7 @@ namespace DllService
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -273,7 +274,7 @@ namespace DllService
|
|
|
|
|
|
|
|
|
|
|
|
- public bool GetMobileAllInfo(string iSnCode, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, 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 oID4, out string oID5, out string oErrorMessage)
|
|
|
+ public bool GetMobileAllInfo(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oIMEI1, out string oIMEI2, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrorMessage)
|
|
|
{
|
|
|
oBT = "";
|
|
|
oMEID = "";
|
|
@@ -282,7 +283,6 @@ namespace DllService
|
|
|
oNetCode = "";
|
|
|
oIMEI1 = "";
|
|
|
oIMEI2 = "";
|
|
|
- oIMEI3 = "";
|
|
|
oCode1 = "";
|
|
|
oCode2 = "";
|
|
|
oCode3 = "";
|
|
@@ -292,10 +292,10 @@ namespace DllService
|
|
|
oID4 = "";
|
|
|
oID5 = "";
|
|
|
|
|
|
- string ms_id = dh.getFieldDataByCondition("makeserial", "ms_id", "ms_sncode='" + iSnCode + "'").ToString();
|
|
|
+ string ms_id = getFieldDataByCondition("makeserial", "ms_id", "ms_sncode='" + iSN + "'").ToString();
|
|
|
if (ms_id != "")
|
|
|
{
|
|
|
- DataTable dt = dh.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 + "'");
|
|
|
+ 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 + "'");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
oWIFI = dt.Rows[0]["ms_mac"].ToString();
|
|
@@ -305,7 +305,6 @@ namespace DllService
|
|
|
oMEID = dt.Rows[0]["ms_meid"].ToString();
|
|
|
oIMEI1 = dt.Rows[0]["ms_imei1"].ToString();
|
|
|
oIMEI2 = dt.Rows[0]["ms_imei2"].ToString();
|
|
|
- oIMEI3 = dt.Rows[0]["ms_imei3"].ToString();
|
|
|
oCode1 = dt.Rows[0]["ms_othcode1"].ToString();
|
|
|
oCode2 = dt.Rows[0]["ms_othcode2"].ToString();
|
|
|
oCode3 = dt.Rows[0]["ms_othcode3"].ToString();
|
|
@@ -317,13 +316,13 @@ namespace DllService
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- oErrorMessage = "序列号" + iSnCode + "不存在";
|
|
|
+ oErrorMessage = "序列号" + iSN + "不存在";
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- oErrorMessage = "序列号" + iSnCode + "不存在";
|
|
|
+ oErrorMessage = "序列号" + iSN + "不存在";
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -349,7 +348,7 @@ namespace DllService
|
|
|
sql.Append("ma_craftcode,ma_craftname,'" + iMPKind + "','" + result + "',sysdate,'" + iUserCode + "',ma_wccode,'" + LineCode + "','" + iSourceCode + "',");
|
|
|
sql.Append("ms_status,ms_checkno,ms_outboxcode from make left join makeserial on ms_makecode=ma_code left join step on st_code=ms_stepcode ");
|
|
|
sql.Append("where ms_sncode='" + iSnCode + "' and ma_code='" + iMakeCode + "' and st_code='" + CurrentStep + "'");
|
|
|
- dh.ExecuteSql(sql.ToString(), "insert");
|
|
|
+ ExecuteSql(sql.ToString(), "insert");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -367,7 +366,7 @@ namespace DllService
|
|
|
{
|
|
|
oErrorMessage = "";
|
|
|
string[] param = new string[] { iSN, iWIFI, iBT, iCode1, iCode2, iCode3, oErrorMessage };
|
|
|
- dh.CallProcedure("CS_SETADDRESSINFO", ref param);
|
|
|
+ CallProcedure("CS_SETADDRESSINFO", ref param);
|
|
|
oErrorMessage = param[6];
|
|
|
if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
|
|
|
return true;
|
|
@@ -378,7 +377,7 @@ namespace DllService
|
|
|
private bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrorMessage)
|
|
|
{
|
|
|
oErrorMessage = "";
|
|
|
- string StepCode = dh.getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "'").ToString();
|
|
|
+ string StepCode = getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "'").ToString();
|
|
|
string CurrentStep = GetStepCodeBySource(iSourceCode);
|
|
|
switch (iResult)
|
|
|
{
|
|
@@ -399,9 +398,9 @@ namespace DllService
|
|
|
sql.Append(",ma_code,ms_code,ms_sncode,'" + iUserCode + "',sysdate,'" + StepCode + "',ms_sourcecode,:bc_code,'',");
|
|
|
sql.Append("sp_soncode,'0' from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
|
|
|
sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + iSN + "'");
|
|
|
- dh.BatchInsert(sql.ToString(), new string[] { "bc_code" }, BadCode);
|
|
|
+ BatchInsert(sql.ToString(), new string[] { "bc_code" }, BadCode);
|
|
|
|
|
|
- dh.ExecuteSql("update makeserial set ms_status='3' where ms_sncode=:sncode", "update", iSN);
|
|
|
+ ExecuteSql("update makeserial set ms_status='3' where ms_sncode=:sncode", "update", iSN);
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -411,7 +410,7 @@ namespace DllService
|
|
|
|
|
|
if (StepCode == CurrentStep && iResult == "OK")
|
|
|
{
|
|
|
- DataTable dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_craftcode", "ms_prodcode" }, "ms_sncode='" + iSN + "'");
|
|
|
+ DataTable dt = getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_craftcode", "ms_prodcode" }, "ms_sncode='" + iSN + "'");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
string ms_status = dt.Rows[0]["ms_status"].ToString();
|
|
@@ -419,9 +418,9 @@ namespace DllService
|
|
|
string ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
|
|
|
if (ms_status == "3")
|
|
|
{
|
|
|
- string nextstepcode = dh.getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid ", "cd_nextstepcode", "cr_code='" + ms_craftcode + "' and cr_prodcode='" + ms_prodcode + "' and cd_stepcode='" + CurrentStep + "'").ToString();
|
|
|
- dh.UpdateByCondition("makeserial", "ms_status=1,ms_nextstepcode='" + nextstepcode + "'", "ms_sncode='" + iSN + "'");
|
|
|
- dh.UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "'");
|
|
|
+ string nextstepcode = getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid ", "cd_nextstepcode", "cr_code='" + ms_craftcode + "' and cr_prodcode='" + ms_prodcode + "' and cd_stepcode='" + CurrentStep + "'").ToString();
|
|
|
+ UpdateByCondition("makeserial", "ms_status=1,ms_nextstepcode='" + nextstepcode + "'", "ms_sncode='" + iSN + "'");
|
|
|
+ UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "'");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -439,7 +438,7 @@ namespace DllService
|
|
|
|
|
|
|
|
|
|
|
|
- public bool SetMobileData(string iSN, string iSourceCode, string iMPKind, string iResult, string iErrCode, out string oErrorMessage)
|
|
|
+ public bool SetMobileData(string iTSN, string iSN, string iSourceCode, string iMPKind, string iResult, string iErrCode, string flag, out string oErrorMessage)
|
|
|
{
|
|
|
string omakecode = "";
|
|
|
GetRcardMOInfo(iSN, out omakecode, out oErrorMessage);
|
|
@@ -450,7 +449,7 @@ namespace DllService
|
|
|
{
|
|
|
oErrorMessage = "";
|
|
|
string[] param = new string[] { iMakeCode, iSourceCode, iSN, iUserCode, iResult, oErrorMessage };
|
|
|
- dh.CallProcedure("CS_SETSTEPRESULT", ref param);
|
|
|
+ CallProcedure("CS_SETSTEPRESULT", ref param);
|
|
|
oErrorMessage = param[5];
|
|
|
if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
|
|
|
return true;
|
|
@@ -475,7 +474,7 @@ namespace DllService
|
|
|
|
|
|
|
|
|
|
|
|
- public bool SetTestDetail(string iSN, string iClass, string iSubClass1, string iSubClass2, string iSubClass3, string iMaxValue, string iMinValue, string iActualValue, string iValue1, string iValue2, string iValue3, string iTestResult, out string oErrMessage)
|
|
|
+ public bool SetTestDetail(string iSN, string iClass, string iSubClass1, string iSubClass2, string iSubClass3, string iMaxValue, string iMinValue, string iActualValue, string iValue1, string iValue2, string iValue3, string iTestResult, string iResCode, out string oErrMessage)
|
|
|
{
|
|
|
oErrMessage = "";
|
|
|
sql.Clear();
|
|
@@ -483,10 +482,10 @@ namespace DllService
|
|
|
GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
|
|
|
sql.Append("Insert into STEPTESTDETAIL (STD_ID,STD_SN,STD_MAKECODE,STD_CLASS,STD_SUBCLASS1,STD_SUBCLASS2,");
|
|
|
sql.Append("STD_SUBCLASS3,STD_MAXVALUE,STD_MINVALUE,STD_ACTUALVALUE,STD_VALUE1,STD_VALUE2,STD_VALUE3,STD_TESTRESULT,");
|
|
|
- sql.Append("STD_DATE) values (STEPTESTDETAIL_SEQ.nextval,:std_sn,:std_makecode,");
|
|
|
+ sql.Append("STD_DATE,STD_RESCODE) values (STEPTESTDETAIL_SEQ.nextval,:std_sn,:std_makecode,");
|
|
|
sql.Append(":std_class,:std_subclass1,:std_subclass2,:std_subclass3,:std_maxvalue,:std_minvalue,:std_actualvalue,:std_value1,");
|
|
|
- sql.Append(":std_value2,:std_value3,:std_testresult,sysdate)");
|
|
|
- dh.ExecuteSql(sql.ToString(), "select", iSN, omakeCode, iClass, iSubClass1, iSubClass2, iSubClass3, iMaxValue, iMinValue, iActualValue, iValue1, iValue2, iValue3, iTestResult);
|
|
|
+ sql.Append(":std_value2,:std_value3,:std_testresult,sysdate,:std_rescode)");
|
|
|
+ ExecuteSql(sql.ToString(), "select", iSN, omakeCode, iClass, iSubClass1, iSubClass2, iSubClass3, iMaxValue, iMinValue, iActualValue, iValue1, iValue2, iValue3, iTestResult, iResCode);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -512,7 +511,7 @@ namespace DllService
|
|
|
{
|
|
|
oErrMessage = "";
|
|
|
string[] param = new string[] { iSnCode, iIMEI1, "", "", "", "", "", "", "", "", oErrMessage };
|
|
|
- dh.CallProcedure("CS_SETIMEIINFO", ref param);
|
|
|
+ CallProcedure("CS_SETIMEIINFO", ref param);
|
|
|
oErrMessage = param[10];
|
|
|
if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
|
|
|
return true;
|
|
@@ -529,7 +528,7 @@ namespace DllService
|
|
|
|
|
|
private void GetStepCodeAndNameAndLineBySource(string Source, ref string StepCode, ref string StepName, ref string LineCode)
|
|
|
{
|
|
|
- DataTable dt = dh.getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
|
|
|
+ DataTable dt = getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
StepCode = dt.Rows[0]["sc_stepcode"].ToString();
|
|
@@ -546,7 +545,7 @@ namespace DllService
|
|
|
|
|
|
private void GetStepCodeAndNameBySource(string Source, ref string StepCode, ref string StepName)
|
|
|
{
|
|
|
- DataTable dt = dh.getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
|
|
|
+ DataTable dt = getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
StepCode = dt.Rows[0]["sc_stepcode"].ToString();
|
|
@@ -561,7 +560,344 @@ namespace DllService
|
|
|
|
|
|
private string GetStepCodeBySource(string Source)
|
|
|
{
|
|
|
- return dh.getFieldDataByCondition("source", "sc_stepcode", "sc_code='" + Source + "'").ToString();
|
|
|
+ return getFieldDataByCondition("source", "sc_stepcode", "sc_code='" + Source + "'").ToString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private object getFieldDataByCondition(string TableName, string Field, string Condition)
|
|
|
+ {
|
|
|
+ DataTable dt = new DataTable();
|
|
|
+ string sql = "select " + Field + " from " + TableName + " where " + Condition;
|
|
|
+ command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
+ OracleDataAdapter ad = new OracleDataAdapter();
|
|
|
+ ad.SelectCommand = command;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ ad.Fill(dt);
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ connection = new OracleConnection(ConnectionStrings);
|
|
|
+ connection.Open();
|
|
|
+ command = new OracleCommand(sql, connection);
|
|
|
+ ad = new OracleDataAdapter();
|
|
|
+ ad.SelectCommand = command;
|
|
|
+ ad.Fill(dt);
|
|
|
+ }
|
|
|
+ ad.Dispose();
|
|
|
+ command.Dispose();
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ return dt.Rows[0][0];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private DataTable getFieldsDataByCondition(string TableName, string[] Fields, string Condition)
|
|
|
+ {
|
|
|
+ DataTable dt = new DataTable();
|
|
|
+ string sql = "select ";
|
|
|
+ sql += AddField(Fields);
|
|
|
+ sql += " from " + TableName + " where " + Condition + " and rownum=1";
|
|
|
+ command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
+ OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ ad.Fill(dt);
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ connection = new OracleConnection(ConnectionStrings);
|
|
|
+ connection.Open();
|
|
|
+ command = new OracleCommand(sql, connection);
|
|
|
+ ad = new OracleDataAdapter();
|
|
|
+ ad.SelectCommand = command;
|
|
|
+ ad.Fill(dt);
|
|
|
+ }
|
|
|
+ ad.Dispose();
|
|
|
+ command.Dispose();
|
|
|
+ return dt;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private DataTable getFieldsDatasByCondition(string TableName, string[] Fields, string Condition)
|
|
|
+ {
|
|
|
+ DataTable dt = new DataTable();
|
|
|
+ string sql = "select ";
|
|
|
+ sql += AddField(Fields);
|
|
|
+ sql += " from " + TableName + " where " + Condition;
|
|
|
+ command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
+ OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ ad.Fill(dt);
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ connection = new OracleConnection(ConnectionStrings);
|
|
|
+ connection.Open();
|
|
|
+ command = new OracleCommand(sql, connection);
|
|
|
+ ad = new OracleDataAdapter();
|
|
|
+ ad.SelectCommand = command;
|
|
|
+ ad.Fill(dt);
|
|
|
+ }
|
|
|
+ ad.Dispose();
|
|
|
+ command.Dispose();
|
|
|
+ return dt;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private DataTable getFieldsDatas(string TableName, string Fields)
|
|
|
+ {
|
|
|
+ DataTable dt = new DataTable();
|
|
|
+ string sql = "select ";
|
|
|
+ sql += Fields;
|
|
|
+ sql += " from " + TableName;
|
|
|
+ command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
+ OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
+ ad.SelectCommand = command;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ ad.Fill(dt);
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ connection = new OracleConnection(ConnectionStrings);
|
|
|
+ connection.Open();
|
|
|
+ command = new OracleCommand(sql, connection);
|
|
|
+ ad = new OracleDataAdapter();
|
|
|
+ ad.SelectCommand = command;
|
|
|
+ ad.Fill(dt);
|
|
|
+ }
|
|
|
+ ad.Dispose();
|
|
|
+ command.Dispose();
|
|
|
+ return dt;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private bool CheckExist(string TableName, string Condition)
|
|
|
+ {
|
|
|
+ string sql = "select count(1) from " + TableName + " where " + Condition;
|
|
|
+ command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
+ OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
+ DataTable dt = new DataTable();
|
|
|
+ ad.Fill(dt);
|
|
|
+ ad.Dispose();
|
|
|
+ command.Dispose();
|
|
|
+ return int.Parse(dt.Rows[0][0].ToString()) > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private object ExecuteSql(string SQL, string Type, params object[] names)
|
|
|
+ {
|
|
|
+ object result = null;
|
|
|
+ command = new OracleCommand(SQL, connection);
|
|
|
+ Reconnect(command);
|
|
|
+
|
|
|
+ if (names.Length > 0)
|
|
|
+ {
|
|
|
+ string[] par = SQL.Split(':');
|
|
|
+
|
|
|
+ StringBuilder[] addpar = new StringBuilder[par.Length - 1];
|
|
|
+ for (int i = 0; i < par.Length - 1; i++)
|
|
|
+ {
|
|
|
+
|
|
|
+ char[] c = par[i + 1].ToCharArray();
|
|
|
+ addpar[i] = new StringBuilder();
|
|
|
+ for (int j = 0; j < c.Length; j++)
|
|
|
+ {
|
|
|
+ if (c[j] != ' ' && c[j] != ',')
|
|
|
+ {
|
|
|
+ addpar[i].Append(c[j]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int i = 0; i < addpar.Length; i++)
|
|
|
+ command.Parameters.Add(new OracleParameter(addpar[i].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
|
|
|
+ }
|
|
|
+ switch (Type.ToUpper())
|
|
|
+ {
|
|
|
+ case "SELECT":
|
|
|
+ OracleDataAdapter ad = new OracleDataAdapter(command);
|
|
|
+ result = new DataTable();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ ad.Fill((DataTable)result);
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ connection = new OracleConnection(ConnectionStrings);
|
|
|
+ connection.Open();
|
|
|
+ command = new OracleCommand(SQL, connection);
|
|
|
+ ad = new OracleDataAdapter();
|
|
|
+ ad.SelectCommand = command;
|
|
|
+ ad.Fill((DataTable)result);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "DELETE":
|
|
|
+ try
|
|
|
+ {
|
|
|
+ result = command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ command.Connection = new OracleConnection(ConnectionStrings);
|
|
|
+ command.Connection.Open();
|
|
|
+ result = command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "UPDATE":
|
|
|
+ try
|
|
|
+ {
|
|
|
+ result = command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ command.Connection = new OracleConnection(ConnectionStrings);
|
|
|
+ command.Connection.Open();
|
|
|
+ result = command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case "INSERT":
|
|
|
+ try
|
|
|
+ {
|
|
|
+ result = command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ command.Connection = new OracleConnection(ConnectionStrings);
|
|
|
+ command.Connection.Open();
|
|
|
+ result = command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ command.Dispose();
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void BatchInsert(string sql, params object[][] names)
|
|
|
+ {
|
|
|
+ command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
+ command.ArrayBindCount = names[1].Length;
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 1; i <= names[0].Length; i++)
|
|
|
+ {
|
|
|
+ command.Parameters.Add(new OracleParameter(names[0][i - 1].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
|
|
|
+ }
|
|
|
+ try
|
|
|
+ {
|
|
|
+ command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ command.Connection = new OracleConnection(ConnectionStrings);
|
|
|
+ command.Connection.Open();
|
|
|
+ command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ command.Dispose();
|
|
|
+ }
|
|
|
+
|
|
|
+ private string UpdateByCondition(string TableName, string update, string condition)
|
|
|
+ {
|
|
|
+ string sql = "update " + TableName + " set " + update + " where " + condition;
|
|
|
+ command = new OracleCommand(sql, connection);
|
|
|
+ Reconnect(command);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ command.Connection = new OracleConnection(ConnectionStrings);
|
|
|
+ command.Connection.Open();
|
|
|
+ command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ command.Dispose();
|
|
|
+ return sql;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CallProcedure(string ProcedureName, ref string[] param)
|
|
|
+ {
|
|
|
+ command = new OracleCommand(ProcedureName);
|
|
|
+ command.Connection = connection;
|
|
|
+ Reconnect(command);
|
|
|
+ command.CommandText = ProcedureName;
|
|
|
+ command.CommandType = CommandType.StoredProcedure;
|
|
|
+ for (int i = 0; i < param.Length; i++)
|
|
|
+ command.Parameters.Add(new OracleParameter(param[i].ToString(), OracleDbType.Varchar2, 200, param[i], ParameterDirection.InputOutput));
|
|
|
+ try
|
|
|
+ {
|
|
|
+ command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ command.Connection = new OracleConnection(ConnectionStrings);
|
|
|
+ command.Connection.Open();
|
|
|
+ command.ExecuteNonQuery();
|
|
|
+ }
|
|
|
+ for (int i = 0; i < command.Parameters.Count; i++)
|
|
|
+ param[i] = command.Parameters[i].Value.ToString();
|
|
|
+ }
|
|
|
+
|
|
|
+ private string AddField(string[] Fields)
|
|
|
+ {
|
|
|
+ string sql = " ";
|
|
|
+ foreach (string field in Fields)
|
|
|
+ {
|
|
|
+ sql += field + ",";
|
|
|
+ }
|
|
|
+ return sql.Substring(0, sql.Length - 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ private string[] GetField(string field)
|
|
|
+ {
|
|
|
+ string[] fields = field.Split(',');
|
|
|
+ for (int i = 0; i < fields.Length; i++)
|
|
|
+ {
|
|
|
+ fields[i] = fields[i].Substring(fields[i].LastIndexOf("as") + 2, fields[i].Length - fields[i].LastIndexOf("as") - 2).Trim();
|
|
|
+ }
|
|
|
+ return fields;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void Reconnect(OracleCommand cmd)
|
|
|
+ {
|
|
|
+ if (cmd.Connection.State == ConnectionState.Closed)
|
|
|
+ {
|
|
|
+ cmd.Connection.Open();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|