12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277 |
- using Oracle.ManagedDataAccess.Client;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Runtime.InteropServices;
- using System.Text;
- namespace UAS.MES
- {
- [Guid("CD971431-4D28-4F26-986C-0D238066936C")]
- [InterfaceType(ComInterfaceType.InterfaceIsDual)]
- public interface IMESHelper
- {
- [DispId(14)]
- 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 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 SetTestDetail(string iSN, string iTestResult, string iResCode, string[] iTestDetail, 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, string iIMEI2, string iIMEI3, out string oErrMessage);
- bool SetKeyInfo(string iSN, string iKey1, string iKey2, string iKey3, 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 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 GetSoftVersion(string iSN, out string oSoftVersion, out string oErrMessage);
- bool GetSNAllInfo(string iSN, out string oMakeCode, out string oSaleCode, out string oProdType, out string oSoftVersion1, out string oSoftVersion2, out string oSoftVersion3, out string oMaterialCode1, out string oMaterialCode2, out string oMaterialCode3, out string oMaterialCode4, out string oMaterialCode5, out string oMAC, out string oBT, 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 oItem1, out string oItem2, out string oItem3, out string oItem4, out string oErrMessage);
- }
- [Guid("707D771D-AA71-4BC1-B2DA-05CBBA868362")]
- [ComSourceInterfaces(typeof(IMESHelper))]
- [ClassInterface(ClassInterfaceType.None)]
- [ProgId("DllService.MESHelper")]
- public class MESHelper : IMESHelper
- {
- //用于拼接SQL
- StringBuilder sql = new StringBuilder();
- //用于存放批量执行的SQL
- List<string> sqls = new List<string>();
- //系统默认的的连接字符串
- private string ConnectionStrings = "Data Source=192.168.230.200/orcl;User ID=MES;PassWord=select!#%*(;";
- //用户选择的数据库的连接字符串
- private OracleConnection connection;
- //用户选择的数据库的连接字符串
- private OracleCommand command = null;
- public DataTable MasterDB;
- public MESHelper()
- {
- connection = new OracleConnection(ConnectionStrings);
- }
- /// <summary>
- /// 检测当前的岗位资源对应的工序
- /// </summary>
- /// <param name="iSN"></param>
- /// <param name="iResCode"></param>
- /// <param name="oErrMessage"></param>
- /// <returns></returns>
- [Description("验证登陆信息")]
- public bool CheckRoutePassed(string iSN, string iResCode, out string oErrMessage)
- {
- if (iSN == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- string oMsid = "";
- 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);
- oMsid = param[5];
- oErrMessage = param[6];
- DataTable dt = null;
- if (oMsid == "" || oMsid == null || oMsid == "null" || oMsid == "0")
- {
- sql.Clear();
- sql.Append("select max(ms_id) from makeserial where ms_sncode in (select '" + iSN + "' from dual union select sn from makesnrelation where ");
- sql.Append(" beforesn = '" + iSN + "' and sn <> ' ' union select beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' ')");
- dt = (DataTable)ExecuteSql(sql.ToString(), "select");
- oMsid = dt.Rows[0][0].ToString();
- }
- dt = (DataTable)ExecuteSql("select ms_status,ms_stepcode,ms_nextstepcode from makeserial where ms_id='" + oMsid + "'", "select");
- string ms_status = "";
- string ms_stepcode = "";
- string ms_nextstepcode = "";
- if (dt.Rows.Count > 0)
- {
- ms_status = dt.Rows[0]["ms_status"].ToString();
- ms_stepcode = dt.Rows[0]["ms_stepcode"].ToString();
- ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
- }
- string stepcode = GetStepCodeBySource(iResCode);
- //if (ms_nextstepcode != "" && ms_nextstepcode != stepcode)
- //{
- // oErrMessage = "序列号下一工序" + ms_nextstepcode + ",前岗位资源不允许采集";
- // return false;
- //}
- if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null" || (ms_status == "3" && stepcode == ms_stepcode))
- {
- if (ms_status == "3")
- {
- oErrMessage = "";
- }
- return true;
- }
- else
- return false;
- }
- [Description("获取工单软件版本")]
- public bool GetSoftVersion(string iSN, out string oSoftVersion, out string oErrMessage)
- {
- string oMakeCode = "";
- oErrMessage = "";
- GetRcardMOInfo(iSN, out oMakeCode, out oErrMessage);
- oSoftVersion = getFieldDataByCondition("make", "ma_softversion", "ma_code='" + oMakeCode + "'").ToString();
- return true;
- }
- /// <summary>
- /// 验证用户身份信息
- /// </summary>
- /// <param name="iUserCode"></param>
- /// <param name="oErrorMessage"></param>
- /// <returns></returns>
- 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)ExecuteSql(SQL, "select", iUserCode, iPassWord);
- if (dt.Rows.Count > 0)
- return true;
- else
- {
- oErrorMessage = "用户名或者密码不正确!";
- return false;
- }
- }
- /// <summary>
- /// 验证用户身份信息和岗位资源
- /// </summary>
- /// <param name="iUserCode"></param>
- /// <param name="iResCode"></param>
- /// <param name="oErrMessage"></param>
- /// <returns></returns>
- [Description("验证用户身份信息和岗位资源")]
- public bool CheckUserAndResourcePassed(string iUserCode, string iResCode, string iPassWord, out string oErrMessage)
- {
- oErrMessage = "";
- if (iUserCode == "" || iPassWord == "" || iResCode == "")
- {
- oErrMessage = "用户名,密码,岗位资源必须填写";
- return false;
- }
- if (CheckUserLogin(iUserCode, iPassWord, out oErrMessage))
- {
- 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)
- {
- 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")
- {
- if (CheckExist("Source", "sc_code='" + iResCode + "' and sc_statuscode='AUDITED'"))
- {
- return true;
- }
- else
- {
- oErrMessage = "岗位资源编号错误或者未审核!";
- return false;
- }
- }
- else
- {
- 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 = "用户不存在!";
- }
- return false;
- }
- /// <summary>
- /// 分配Mac地址和BT地址
- /// </summary>
- /// <param name="iSN"></param>
- /// <param name="oWIFI"></param>
- /// <param name="oBT"></param>
- /// <param name="oCode1"></param>
- /// <param name="oCode2"></param>
- /// <param name="oCdoe3"></param>
- /// <param name="oErrMessage"></param>
- /// <returns></returns>
- [Description("分配Mac地址和BT地址")]
- public bool GetAddressRangeByMO(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCdoe3, out string oErrMessage)
- {
- oWIFI = "";
- oBT = "";
- oCode1 = "";
- oCode2 = "";
- oCdoe3 = "";
- if (iSN == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- oErrMessage = "";
- string omakeCode = "";
- GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
- string[] param = new string[] { iSN, omakeCode, oWIFI, oBT, oCode1, oCode2, oCdoe3, 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);
- oWIFI = param[2];
- oBT = param[3];
- oCode1 = param[4];
- oCode2 = param[5];
- oCdoe3 = param[6];
- oErrMessage = param[7];
- if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
- return true;
- else
- return false;
- }
- /// <summary>
- /// 输入的 SN 号查找在制品是否有 IMEI 信息存在,如果存在则将 IMEI 信息传出,如果没有则在该工单下未使用的 IMEI 中随机分配一组
- /// 如果iIMEI1、iNetCode不为空,则分别作为获取的附件加条件。
- /// </summary>
- /// <param name="iSN"></param>
- /// <param name="iIMEI1"></param>
- /// <param name="iNetCode"></param>
- /// <param name="oIMEI1"></param>
- /// <param name="oIMEI2"></param>
- /// <param name="oIMEI3"></param>
- /// <param name="oMEID"></param>
- /// <param name="oNetCode"></param>
- /// <param name="oPSN"></param>
- /// <param name="oID1"></param>
- /// <param name="oID2"></param>
- /// <param name="oID3"></param>
- /// <param name="oErrMessage"></param>
- /// <returns></returns>
- [Description("获取IMEI,网标信息")]
- public bool GetMEIOrNetCodeRange(string iSN, 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 = "";
- oMEID = "";
- oNetCode = "";
- oPSN = "";
- oID1 = "";
- oID2 = "";
- oID3 = "";
- oID4 = "";
- oID5 = "";
- if (iSN == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- oErrMessage = "";
- string[] param = new string[] { iSN, "", iIMEI1, iNetCode, oIMEI1, oIMEI2, "", 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);
- oIMEI1 = param[4];
- oIMEI2 = param[5];
- oMEID = param[7];
- oNetCode = param[8];
- oPSN = param[9];
- oID1 = param[10];
- oID2 = param[11];
- oID3 = param[12];
- oErrMessage = param[13];
- if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
- return true;
- else
- return false;
- }
- /// <summary>
- /// 获取工单的最近一条执行记录
- /// </summary>
- /// <param name="iSN"></param>
- /// <param name="oMoCode"></param>
- /// <param name="oErrMessage"></param>
- /// <returns></returns>
- [Description("获取工单信息")]
- public bool GetRcardMOInfo(string iSN, out string oMoCode, out string oErrMessage)
- {
- //取MakeProcess表中的执行记录ID最大的一个工单的号码
- oMoCode = "";
- if (iSN == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- oErrMessage = "";
- sql.Clear();
- sql.Append("select max(ms_id) from makeserial where ms_sncode in (select '" + iSN + "' from dual union select sn from makesnrelation where ");
- sql.Append(" beforesn = '" + iSN + "' and sn <> ' ' union select beforesn from makesnrelation where sn='" + iSN + "' and beforesn<>' ')");
- DataTable dt = (DataTable)ExecuteSql(sql.ToString(), "select");
- string ms_id = dt.Rows[0][0].ToString();
- oMoCode = getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
- if (oMoCode != "")
- return true;
- else
- {
- oErrMessage = "序列号:" + iSN + " 未归属工单";
- return false;
- }
- }
- /// <summary>
- /// 获取序列号的所有串号信息
- /// </summary>
- /// <param name="iSN"></param>
- /// <param name="oWIFI"></param>
- /// <param name="oBT"></param>
- /// <param name="oCode1"></param>
- /// <param name="oCode2"></param>
- /// <param name="oCode3"></param>
- /// <param name="oIMEI1"></param>
- /// <param name="oIMEI2"></param>
- /// <param name="oIMEI3"></param>
- /// <param name="oMEID"></param>
- /// <param name="oNetCode"></param>
- /// <param name="oPSN"></param>
- /// <param name="oID1"></param>
- /// <param name="oID2"></param>
- /// <param name="oID3"></param>
- /// <param name="oID4"></param>
- /// <param name="oID5"></param>
- /// <param name="oErrMessage"></param>
- /// <returns></returns>
- [Description("获取序列号关联信息")]
- 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 oErrMessage)
- {
- oBT = "";
- oMEID = "";
- oWIFI = "";
- oPSN = "";
- oNetCode = "";
- oIMEI1 = "";
- oIMEI2 = "";
- oCode1 = "";
- oCode2 = "";
- oCode3 = "";
- oID1 = "";
- oID2 = "";
- oID3 = "";
- oID4 = "";
- oID5 = "";
- if (iSN == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- //通过序列号获取最近操作的工单号
- string ms_id = getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + 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 + "'");
- if (dt.Rows.Count > 0)
- {
- oWIFI = dt.Rows[0]["ms_mac"].ToString();
- oBT = dt.Rows[0]["ms_bt"].ToString();
- oPSN = dt.Rows[0]["ms_psn"].ToString();
- oNetCode = dt.Rows[0]["ms_netcode"].ToString();
- oMEID = dt.Rows[0]["ms_meid"].ToString();
- oIMEI1 = dt.Rows[0]["ms_imei1"].ToString();
- oIMEI2 = dt.Rows[0]["ms_imei2"].ToString();
- oCode1 = dt.Rows[0]["ms_othcode1"].ToString();
- oCode2 = dt.Rows[0]["ms_othcode2"].ToString();
- oCode3 = dt.Rows[0]["ms_othcode3"].ToString();
- oID1 = dt.Rows[0]["ms_othid3"].ToString();
- oID2 = dt.Rows[0]["ms_othid3"].ToString();
- oID3 = dt.Rows[0]["ms_othid3"].ToString();
- oErrMessage = "";
- return true;
- }
- else
- {
- oErrMessage = "序列号" + iSN + "不存在";
- return false;
- }
- }
- else
- {
- oErrMessage = "序列号" + iSN + "不存在";
- return false;
- }
- }
- /// <summary>
- /// 记录操作日志
- /// </summary>
- /// <param name="iSnCode"></param>
- /// <param name="iMakeCode"></param>
- /// <param name="iMPKind"></param>
- /// <param name="result"></param>
- /// <param name="iUserCode"></param>
- private void InsertMakeProcess(string iSnCode, string iMakeCode, string iSourceCode, string iMPKind, string result, string iUserCode)
- {
- string CurrentStep = "";
- string LineCode = "";
- string CurrentStepName = "";
- GetStepCodeAndNameAndLineBySource(iSourceCode, ref CurrentStep, ref CurrentStepName, ref LineCode);
- sql.Length = 0;
- sql.Append("insert into MakeProcess(mp_id,mp_makecode,mp_maid, mp_mscode,mp_sncode,mp_stepcode,mp_stepname,");
- sql.Append("mp_craftcode,mp_craftname,mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode,mp_snstatus,mp_sncheckno,mp_snoutboxcode)");
- sql.Append("select MakeProcess_seq.nextval, ma_code,ma_id,ms_code,ms_sncode,'" + CurrentStep + "','" + CurrentStepName + "',");
- 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 + "'");
- ExecuteSql(sql.ToString(), "insert");
- }
- /// <summary>
- /// 保存Mac地址和BT地址
- /// </summary>
- /// <param name="iSN"></param>
- /// <param name="iWIFI"></param>
- /// <param name="iBT"></param>
- /// <param name="iCode1"></param>
- /// <param name="iCode2"></param>
- /// <param name="iCode3"></param>
- /// <param name="oErrMessage"></param>
- /// <returns></returns>
- [Description("保存Mac地址和BT地址")]
- public bool SetAddressInfo(string iSN, string iWIFI, string iBT, string iCode1, string iCode2, string iCode3, out string oErrMessage)
- {
- if (iSN == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- oErrMessage = "";
- string[] param = new string[] { iSN, iWIFI, 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);
- oErrMessage = param[6];
- if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
- return true;
- else
- return false;
- }
- [Description("执行过站")]
- private bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrMessage)
- {
- if (iSN == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- oErrMessage = "";
- string StepCode = getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'").ToString();
- string CurrentStep = GetStepCodeBySource(iSourceCode);
- string BgCode = getFieldDataByCondition("step", "st_badgroupcode", "st_code='" + CurrentStep + "'").ToString();
- switch (iResult)
- {
- case "OK":
- break;
- case "NG":
- if (iErrCode == "")
- {
- oErrMessage = "测试结果为NG时必须传递不良代码";
- return false;
- }
- else
- {
- UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "' and mb_makecode='" + iMakeCode + "' and mb_stepcode='" + CurrentStep + "' and mb_status=0");
- string[] BadCode = iErrCode.Split(',');
- sql.Length = 0;
- sql.Append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,mb_indate,mb_stepcode");
- sql.Append(",mb_sourcecode,mb_badcode,mb_badtable,mb_bgcode,mb_soncode,mb_status) select makebad_seq.nextval");
- sql.Append(",ma_code,ms_code,ms_sncode,'" + iUserCode + "',sysdate,'" + CurrentStep + "','" + iSourceCode + "',:bc_code,'',");
- sql.Append("'" + BgCode + "',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 + "' and ms_makecode='" + iMakeCode + "'");
- List<string> InsertSQL = new List<string>();
- for (int i = 0; i < BadCode.Length; i++)
- {
- InsertSQL.Add(sql.ToString().Replace(":bc_code", "'" + BadCode[i] + "'"));
- }
- ExecuteSQLTran(InsertSQL.ToArray());
- //将不良的序列号的状态码设为3
- ExecuteSql("update makeserial set ms_status='3' where ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'", "update");
- }
- break;
- default:
- oErrMessage = "测试结果必须为NG或者OK";
- return false;
- }
- //不良采集为良品是更新
- if (StepCode == CurrentStep && iResult == "OK")
- {
- DataTable dt = getFieldsDataByCondition("makeserial", new string[] { "ms_status", "ms_craftcode", "ms_prodcode" }, "ms_sncode='" + iSN + "' and ms_makecode='" + iMakeCode + "'");
- if (dt.Rows.Count > 0)
- {
- string ms_status = dt.Rows[0]["ms_status"].ToString();
- string ms_craftcode = dt.Rows[0]["ms_craftcode"].ToString();
- string ms_prodcode = dt.Rows[0]["ms_prodcode"].ToString();
- if (ms_status == "3")
- {
- 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 + "' and ms_makecode='" + iMakeCode + "'");
- UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "' and mb_makecode='" + iMakeCode + "'");
- }
- }
- }
- return CS_SetFinish(iMakeCode, iSourceCode, iSN, iUserCode, iResult, out oErrMessage);
- }
- /// <summary>
- /// 设置测试结果
- /// </summary>
- /// <param name="iMakeCode"></param>
- /// <param name="iSourceCode"></param>
- /// <param name="iSN"></param>
- /// <param name="iOperater"></param>
- /// <param name="iResult"></param>
- /// <param name="iUserCode"></param>
- /// <param name="oErrorMessage"></param>
- /// <returns></returns>
- [Description("转号过站")]
- public bool SetMobileData(string iTSN, string iSN, string iSourceCode, string iOperater, string iResult, string iErrCode, string flag, out string oErrorMessage)
- {
- oErrorMessage = "";
- if (iTSN == "") { oErrorMessage = "TSN不能为空"; return false; }
- if (iSN == "") { oErrorMessage = "SN不能为空"; return false; }
- 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", ParamName, ref param);
- oErrorMessage = param[6];
- if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
- return true;
- else
- return false;
- }
- private bool CS_SetFinish(string iMakeCode, string iSourceCode, string iSN, string iUserCode, string iResult, out string oErrMessage)
- {
- if (iSN == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- oErrMessage = "";
- string[] param = new string[] { iMakeCode, iSourceCode, iSN, iUserCode, iResult, oErrMessage };
- string[] ParamName = new string[] { "v_i_macode", "v_i_sourcecode", "v_i_sncode", "v_i_usercode", "v_i_result", "v_o_errmsg" };
- CallProcedure("CS_SETSTEPRESULT", ParamName, ref param);
- oErrMessage = param[5];
- if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
- return true;
- else
- return false;
- }
- /// <summary>
- /// 方法说明:测试详细信息录入系统,针对一个SN多个测试项目结果可循环调用
- /// </summary>
- /// <param name="iSN">序列号</param>
- /// <param name="iClass"></param>
- /// <param name="iSubClass1"></param>
- /// <param name="iSubClass2"></param>
- /// <param name="iSubClass3"></param>
- /// <param name="iMaxValue"></param>
- /// <param name="iMinValue"></param>
- /// <param name="iActualValue"></param>
- /// <param name="iValue1"></param>
- /// <param name="iValue2"></param>
- /// <param name="iValue3"></param>
- /// <param name="iTestResult"></param>
- /// <param name="oErrMessage"></param>
- /// <returns></returns>
- [Description("上传测试结果")]
- public bool SetTestDetail(string iSN, string iTestResult, string iResCode, string[] iTestDetail, out string oErrMessage)
- {
- if (iSN == "" || iSN == null)
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- oErrMessage = "";
- string omakeCode;
- GetRcardMOInfo(iSN, out omakeCode, out oErrMessage);
- sql.Clear();
- sql.Append("begin ");
- for (int i = 0; i < iTestDetail.Length; i++)
- {
- sql.Append("Insert into STEPTESTDETAIL (STD_ID,STD_CLASS,STD_SN,STD_MAKECODE,STD_ACTUALVALUE,STD_TESTRESULT,STD_INDATE,STD_RESCODE)");
- sql.Append("values(STEPTESTDETAIL_SEQ.nextval,'ITEM" + i + "','" + iSN + "','" + omakeCode + "','" + iTestDetail[i] + "','" + iTestResult + "',sysdate,'" + iResCode + "');");
- }
- sql.Append("end;");
- ExecuteSql(sql.ToString(), "insert");
- return true;
- }
- /// <summary>
- /// 作业调用该方法将确认接收SN对应的IMEI及附属信息。
- /// </summary>
- /// <param name="iSN"></param>
- /// <param name="iMO"></param>
- /// <param name="iIMEI1"></param>
- /// <param name="iIMEI2"></param>
- /// <param name="iIMEI3"></param>
- /// <param name="iMEID"></param>
- /// <param name="iNetCode"></param>
- /// <param name="iPSN"></param>
- /// <param name="iID1"></param>
- /// <param name="iBT"></param>
- /// <param name="iID1"></param>
- /// <param name="iID2"></param>
- /// <param name="iID3"></param>
- /// <param name="oErrorMessage"></param>
- /// <returns></returns>
- [Description("保存IMEI信息")]
- public bool SetIMEIInfo(string iSN, string iIMEI1, string iIMEI2, string iIMEI3, out string oErrMessage)
- {
- if (iSN == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- oErrMessage = "";
- string[] param = new string[] { iSN, iIMEI1, iIMEI2, iIMEI3, "", "", "", "", "", "", 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_SETKEYINFO", ParamName, ref param);
- oErrMessage = param[10];
- if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
- return true;
- else
- return false;
- }
- [Description("保存Key信息")]
- public bool SetKeyInfo(string iSnCode, string iKey1, string iKey2, string iKey3, out string oErrMessage)
- {
- if (iSnCode == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- oErrMessage = "";
- string[] param = new string[] { iSnCode, "", "", "", "", "", "", iKey1, iKey2, iKey3, 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_SETKEYINFO", ParamName, ref param);
- oErrMessage = param[10];
- if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
- return true;
- else
- return false;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="iSN"></param>
- /// <param name="iResCode"></param>
- /// <param name="iOperator"></param>
- /// <param name="iResult"></param>
- /// <param name="iErrCode"></param>
- /// <param name="oErrMessage"></param>
- /// <returns></returns>
- [Description("调用过站方法")]
- public bool SetPcbaData(string iSN, string iResCode, string iOperator, string iResult, string iErrCode, out string oErrMessage)
- {
- if (iSN == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- oErrMessage = "";
- string oMakeCode = "";
- GetRcardMOInfo(iSN, out oMakeCode, out oErrMessage);
- return SetStepFinish(oMakeCode, iResCode, iSN, "", iResult, iOperator, iErrCode, out oErrMessage);
- }
- [Description("序列号归属工单")]
- public bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage)
- {
- if (iSN == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- oErrMessage = "";
- string[] param = new string[] { iMO, 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='" + iSN + "')", "select");
- string ms_status = "";
- string ms_stepcode = "";
- string ms_nextstepcode = "";
- if (dt.Rows.Count > 0)
- {
- ms_status = dt.Rows[0]["ms_status"].ToString();
- ms_stepcode = dt.Rows[0]["ms_stepcode"].ToString();
- ms_nextstepcode = dt.Rows[0]["ms_nextstepcode"].ToString();
- }
- string stepcode = GetStepCodeBySource(iResCode);
- if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null" || (ms_status == "3" && stepcode == ms_stepcode))
- {
- if (ms_status == "3")
- {
- oErrMessage = "";
- }
- return true;
- }
- else
- return false;
- }
- /// <summary>
- /// 获取执行步骤代码,名称和线别
- /// </summary>
- /// <param name="Source"></param>
- /// <param name="StepCode"></param>
- /// <param name="StepName"></param>
- /// <param name="LineCode"></param>
- private void GetStepCodeAndNameAndLineBySource(string Source, ref string StepCode, ref string StepName, ref string LineCode)
- {
- 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();
- StepName = dt.Rows[0]["sc_stepname"].ToString();
- LineCode = dt.Rows[0]["sc_linecode"].ToString();
- }
- }
- /// <summary>
- /// 获取步骤代码和名称
- /// </summary>
- /// <param name="Source"></param>
- /// <param name="StepCode"></param>
- /// <param name="StepName"></param>
- private void GetStepCodeAndNameBySource(string Source, ref string StepCode, ref string StepName)
- {
- 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();
- StepName = dt.Rows[0]["sc_stepname"].ToString();
- }
- }
- /// <summary>
- /// 获取步骤代码
- /// </summary>
- /// <param name="Source"></param>
- /// <returns></returns>
- private string GetStepCodeBySource(string Source)
- {
- return getFieldDataByCondition("source", "sc_stepcode", "sc_code='" + Source + "'").ToString();
- }
- /// <summary>
- /// 获取第一行第一列的信息
- /// </summary>
- 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 "";
- }
- }
- /// <summary>
- /// 通过表名和获取单行的记录
- /// </summary>
- 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;
- }
- /// <summary>
- /// 通过表名,字段和条件获取DataTable类型的数据
- /// </summary>
- 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;
- }
- /// <summary>
- /// 通过表名,字段获取DataTable类型的数据
- /// </summary>
- 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;
- }
- /// <summary>
- /// 检测内容是否存在
- /// </summary>
- /// <param name="TableName"></param>
- /// <param name="Condition"></param>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 直接执行SQL,同时传入SQL的类型
- /// </summary>
- /// <param name="SQL"></param>
- /// <param name="Type"></param>
- /// <returns></returns>
- 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类型的数组用来存储每个字节的变量
- char[] c = par[i + 1].ToCharArray();
- addpar[i] = new StringBuilder();
- for (int j = 0; j < c.Length; j++)
- {
- if (c[j] != ' ' && 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(), names[i]));
- }
- }
- 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;
- }
- /// <summary>
- /// 出现异常进行回滚的执行方法
- /// </summary>
- /// <param name="SQL"></param>
- private void ExecuteSQLTran(params string[] SQL)
- {
- command = new OracleCommand();
- command.Connection = new OracleConnection(ConnectionStrings);
- command.Connection.Open();
- Reconnect(command);
- OracleTransaction tx = command.Connection.BeginTransaction(IsolationLevel.ReadCommitted);
- command.Transaction = tx;
- try
- {
- foreach (string sql in SQL)
- {
- if (!String.IsNullOrEmpty(sql))
- {
- command.CommandText = sql;
- command.ExecuteNonQuery();
- }
- }
- tx.Commit();
- }
- catch (OracleException E)
- {
- tx.Rollback();
- throw new Exception(E.Message);
- }
- 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, string[] ParamName, 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(ParamName[i], OracleDbType.Varchar2, 200, param[i], ParameterDirection.InputOutput));
- //command.Parameters.Add(new OracleParameter(ParamName[i], OracleType.VarChar, 200, ParameterDirection.InputOutput, "", DataRowVersion.Default, true, param[i]));
- }
- 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();
- command.Dispose();
- }
- 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();
- }
- }
- /// <summary>
- /// 获取序列号全部信息
- /// </summary>
- /// <param name="iSN"></param>
- /// <param name="oMakeCode"></param>
- /// <param name="oSaleCode"></param>
- /// <param name="oProdType"></param>
- /// <param name="oSoftVersion1"></param>
- /// <param name="oSoftVersion2"></param>
- /// <param name="oSoftVersion3"></param>
- /// <param name="oMaterialCode1"></param>
- /// <param name="oMaterialCode2"></param>
- /// <param name="oMaterialCode3"></param>
- /// <param name="oMAC"></param>
- /// <param name="oBT"></param>
- /// <param name="oIMEI1"></param>
- /// <param name="oIMEI2"></param>
- /// <param name="oIMEI3"></param>
- /// <param name="oMEID"></param>
- /// <param name="oNetCode"></param>
- /// <param name="oPSN"></param>
- /// <param name="oID1"></param>
- /// <param name="oID2"></param>
- /// <param name="oID3"></param>
- /// <param name="oItem1"></param>
- /// <param name="oItem2"></param>
- /// <param name="oItem3"></param>
- /// <param name="oItem4"></param>
- /// <param name="oErrMessage"></param>
- /// <returns></returns>
- [Description("获取SN信息")]
- public bool GetSNAllInfo(string iSN, out string oMakeCode, out string oSaleCode, out string oProdType, out string oSoftVersion1, out string oSoftVersion2, out string oSoftVersion3, out string oMaterialCode1, out string oMaterialCode2, out string oMaterialCode3, out string oMaterialCode4, out string oMaterialCode5, out string oMAC, out string oBT, 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 oItem1, out string oItem2, out string oItem3, out string oItem4, out string oErrMessage)
- {
- oMakeCode = "";
- oSaleCode = "";
- oProdType = "";
- oSoftVersion1 = "";
- oSoftVersion2 = "";
- oSoftVersion3 = "";
- oMaterialCode1 = "";
- oMaterialCode2 = "";
- oMaterialCode3 = "";
- oMaterialCode4 = "";
- oMaterialCode5 = "";
- oMAC = "";
- oBT = "";
- oIMEI1 = "";
- oIMEI2 = "";
- oIMEI3 = "";
- oMEID = "";
- oNetCode = "";
- oPSN = "";
- oID1 = "";
- oID2 = "";
- oID3 = "";
- oItem1 = "";
- oItem2 = "";
- oItem3 = "";
- oItem4 = "";
- oErrMessage = "";
- if (iSN == "")
- {
- oErrMessage = "SN不能为空";
- return false;
- }
- oErrMessage = "";
- string[] param = new string[] { iSN, oMakeCode, oSaleCode, oProdType, oSoftVersion1, oSoftVersion2, oSoftVersion3, oMaterialCode1, oMaterialCode2, oMaterialCode3, oMAC, oBT, oIMEI1, oIMEI2, oIMEI3, oMEID, oNetCode, oPSN, oID1, oID2, oID3, oItem1, oItem2, oItem3, oItem4, oErrMessage, oMaterialCode4, oMaterialCode5 };
- string[] ParamName = new string[] { "v_i_sncode", "v_o_makecode", "v_o_salecode", "v_o_prodtype", "v_o_softverision1", "v_o_softverision2", "v_o_softverision3", "v_o_materialcode1", "v_o_materialcode2", "v_o_materialcode3", "v_o_mac", "v_o_bt", "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_item1", "v_o_item2", "v_o_item3", "v_o_item4", "v_o_errmsg", "v_o_materialcode4", "v_o_materialcode5" };
- CallProcedure("CS_DLLGETSNINFO", ParamName, ref param);
- oMakeCode = param[1];
- oSaleCode = param[2];
- oProdType = param[3];
- oSoftVersion1 = param[4];
- oSoftVersion2 = param[5];
- oSoftVersion3 = param[6];
- oMaterialCode1 = param[7];
- oMaterialCode2 = param[8];
- oMaterialCode3 = param[9];
- oMAC = param[10];
- oBT = param[11];
- oIMEI1 = param[12];
- oIMEI2 = param[13];
- oIMEI3 = param[14];
- oMEID = param[15];
- oNetCode = param[16];
- oPSN = param[17];
- oID1 = param[18];
- oID2 = param[19];
- oID3 = param[20];
- oItem1 = param[21];
- oItem2 = param[22];
- oItem3 = param[23];
- oItem4 = param[24];
- oErrMessage = param[25];
- oMaterialCode4 = param[26];
- oMaterialCode5 = param[27];
- if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
- return true;
- else
- return false;
- }
- [Description("获取账套信息")]
- public bool GetMaster(out string oMaster)
- {
- MasterDB = (DataTable)ExecuteSql("select ms_pwd,ma_user,ma_inneraddress from master", "select");
- oMaster = "";
- for (int i = 0; i < MasterDB.Rows.Count; i++)
- {
- if (i != MasterDB.Rows.Count - 1)
- oMaster += MasterDB.Rows[i]["ma_user"].ToString() + "|";
- else
- oMaster += MasterDB.Rows[i]["ma_user"].ToString();
- }
- return true;
- }
- [Description("设置账套信息")]
- public bool SetMaster(string iMaster)
- {
- DataTable dt = (DataTable)ExecuteSql("select ms_pwd,ma_user,ma_inneraddress from master where ma_user='" + iMaster + "'", "select");
- if (dt.Rows.Count > 0)
- {
- ConnectionStrings = "Data Source=" + dt.Rows[0]["ma_inneraddress"].ToString() + "/orcl;User ID=" + iMaster + ";PassWord=" + dt.Rows[0]["ms_pwd"].ToString() + ";";
- try
- {
- connection = new OracleConnection(ConnectionStrings);
- }
- catch (Exception)
- {
- return false;
- }
- return true;
- }
- return false;
- }
- }
- }
|