callm hace 3 años
padre
commit
3417683256
Se han modificado 1 ficheros con 165 adiciones y 5 borrados
  1. 165 5
      UAS_MesInterface(4.0)/MesHelper.cs

+ 165 - 5
UAS_MesInterface(4.0)/MesHelper.cs

@@ -13,7 +13,7 @@ namespace BenQGuru.eMES.DLLService
     [InterfaceType(ComInterfaceType.InterfaceIsDual)]
     public interface IMESHelper
     {
-        [DispId(16)]
+        [DispId(19)]
         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);
@@ -30,6 +30,9 @@ namespace BenQGuru.eMES.DLLService
         bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage);
         bool GetSoftVersion(string iSN, out string oSoftVersion, out string oErrMessage);
         bool GetProductRelation(string iSN, out string oWIFI, out string oBT, out string IMEI1, out string IMEI2, out string IMEI3, out string oNetCode, out string oMEID, out string oErrMessage);
+        bool GetSNList(string iMaCode, out string[] TSN_List, out string[] SN_List, out string[] TSN_Rule, out string[] SN_Rule, out string oErrMessage);
+        bool GetMaterialInfo(string iSN, out string oResult, out string oErrMessage);
+        bool GetPrintLabel(string iSN, out string oResult, out string oErrMessage);
     }
 
     [Guid("41EAB546-6EF4-464A-895A-9C34013A5D8C")]
@@ -43,7 +46,7 @@ namespace BenQGuru.eMES.DLLService
         //用于存放批量执行的SQL
         List<string> sqls = new List<string>();
         //系统默认的的连接字符串
-        private string ConnectionStrings = "Data Source=117.25.180.218/orcl;User ID=MES_ZZ;PassWord=select!#%*(;";
+        private string ConnectionStrings = "Data Source=192.168.230.200/orcl;User ID=MES_ZZ;PassWord=select!#%*(;";
         //用户选择的数据库的连接字符串
         private OracleConnection connection;
         //用户选择的数据库的连接字符串
@@ -466,6 +469,9 @@ namespace BenQGuru.eMES.DLLService
             }
         }
 
+
+
+
         /// <summary>
         /// 记录操作日志
         /// </summary>
@@ -621,10 +627,10 @@ namespace BenQGuru.eMES.DLLService
         [Description("设置账套信息")]
         public bool SetMaster(string iMaster)
         {
-            DataTable dt = (DataTable)ExecuteSql("select ms_pwd,ma_user,ma_address from master where ma_user='" + iMaster + "'", "select");
+            DataTable dt = (DataTable)ExecuteSql("select ms_pwd,ma_user,ma_address,ma_inneraddress from master where ma_user='" + iMaster + "'", "select");
             if (dt.Rows.Count > 0)
             {
-                ConnectionStrings = "Data Source=" + dt.Rows[0]["ma_address"].ToString() + "/orcl;User ID=" + iMaster + ";PassWord=" + dt.Rows[0]["ms_pwd"].ToString() + ";";
+                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);
@@ -798,12 +804,17 @@ namespace BenQGuru.eMES.DLLService
         [Description("序列号归属工单")]
         public bool GoMo(string iMO, string iSN, string iResCode, out string oErrMessage)
         {
+            oErrMessage = "";
             if (iSN == "")
             {
                 oErrMessage = "SN不能为空";
                 return false;
             }
-            oErrMessage = "";
+            if (CheckExist("makeserial", "ms_sncode='" + iSN + "' and ms_makecode='"+iMO+"'"))
+            {
+                oErrMessage = "SN" + iSN + "已存在于工单" + iMO;
+                return false;
+            }
             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);
@@ -1232,5 +1243,154 @@ namespace BenQGuru.eMES.DLLService
             dt = (DataTable)ExecuteSql("SELECT " + SeqName + ".NEXTVAL FROM DUAL", "select");
             return dt.Rows[0][0].ToString();
         }
+
+        [Description("获取上料信息")]
+        public bool GetMaterialInfo(string iSN, out string oResult, out string oErrMessage)
+        {
+            oErrMessage = "";
+            oResult = "";
+            if (iSN == "")
+            {
+                oErrMessage = "SN不能为空";
+                return false;
+            }
+            Dictionary<string, string> MacInfo = new Dictionary<string, string>();
+            //通过序列号获取最近操作的工单号
+            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 + "'");
+                if (dt.Rows.Count > 0)
+                {
+                    string Code1 = "";
+                    string Code2 = "";
+                    string Code3 = "";
+                    string Code4 = "";
+                    string Code5 = "";
+                    string Code6 = "";
+                    string Code7 = "";
+                    string Code8 = "";
+                    string Code9 = "";
+                    string Code10 = "";
+                    string Code11 = "";
+                    string Code12 = "";
+                    string Code13 = "";
+                    string Code14 = "";
+                    string Code15 = "";
+                    string[] param = new string[] { ms_id, Code1, Code2, Code3, Code4, Code5, Code6, Code7, Code8, Code9, Code10, Code11, Code12, Code13, Code14, Code15 };
+                    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" };
+                    CallProcedure("GetMaterialInfo", ParamName, ref param);
+                    for (int i = 1; i < param.Length; i++)
+                    {
+                        //获取出来的参数使用^分割
+                        if (param[i] != "" && param[i] != "null" && param[i] != null)
+                        {
+                            oResult += param[i].Split('^')[0] + "^" + param[i].Split('^')[1] + "#";
+                        }
+                    }
+                    if (oResult.IndexOf("#") > 0)
+                    {
+                        oResult = oResult.Substring(0, oResult.Length - 1);
+                    }
+                    oErrMessage = "";
+                    return true;
+                }
+                else
+                {
+                    oErrMessage = "序列号" + iSN + "不存在";
+                    return false;
+                }
+            }
+            else
+            {
+                oErrMessage = "序列号" + iSN + "不存在";
+                return false;
+            }
+        }
+
+
+        [Description("获取打印路径")]
+        public bool GetPrintLabel(string iSN, out string oResult, out string oErrMessage)
+        {
+            oResult = "";
+            oErrMessage = "";
+            string ms_id = getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + iSN + "' or ms_firstsn='" + iSN + "'").ToString();
+            if (ms_id == "")
+            {
+                oErrMessage = "SN" + iSN + "不存在";
+                return false;
+            }
+            string prcode = getFieldDataByCondition("makeserial", "ms_prodcode", "ms_id=" + ms_id).ToString();
+            DataTable dt = (DataTable)ExecuteSql("select la_templatetype,la_url from label where la_prodcode='" + prcode + "' and la_statuscode='AUDITED'", "select");
+            if (dt.Rows.Count > 0)
+            {
+                for (int i = 0; i < dt.Rows.Count; i++)
+                {
+                    oResult = dt.Rows[i]["la_templatetype"].ToString() + "^" + dt.Rows[i]["la_url"].ToString() + "#";
+                }
+                if (oResult.IndexOf("#") > 0)
+                {
+                    oResult = oResult.Substring(0, oResult.Length - 1);
+                }
+            }
+            else
+            {
+                oErrMessage = "产品" + prcode + "未维护标签";
+                return false;
+            }
+            return true;
+        }
+
+        [Description("获取序列号")]
+        public bool GetSNList(string iMaCode, out string[] TSN_List, out string[] SN_List, out string[] TSN_Rule, out string[] SN_Rule, out string oErrMessage)
+        {
+            TSN_List = null;
+            SN_List = null;
+            TSN_Rule = null;
+            SN_Rule = null;
+            if (!CheckExist("Make", "ma_code='" + iMaCode + "'"))
+            {
+                oErrMessage = "工单号" + iMaCode + "不存在";
+                return false;
+            }
+            //导入前的清单
+            DataTable listbefore = (DataTable)ExecuteSql("select msl_sncode from makesnlist where msl_makecode='" + iMaCode + "' and msl_type='before' and nvl(msl_status,0)=0  order by msl_sncode", "select");
+            List<string> _TSN = new List<string>();
+            for (int i = 0; i < listbefore.Rows.Count; i++)
+            {
+                _TSN.Add(listbefore.Rows[i]["msl_sncode"].ToString());
+            }
+            TSN_List = _TSN.ToArray();
+
+            //导入后的清单
+            DataTable listafter = (DataTable)ExecuteSql("select msl_sncode from makesnlist where msl_makecode='" + iMaCode + "' and msl_type='after' and nvl(msl_status,0)=0  order by msl_sncode", "select");
+            List<string> _SN = new List<string>();
+            for (int i = 0; i < listafter.Rows.Count; i++)
+            {
+                _SN.Add(listafter.Rows[i]["msl_sncode"].ToString());
+            }
+            SN_List = _SN.ToArray();
+
+            //转换前的规则
+            DataTable rulebefore = (DataTable)ExecuteSql("select msd_sncode from MAKESNRULEDETAIL where msd_makecode='" + iMaCode + "' and msd_type='before' and nvl(msd_status,0)=0 order by msd_sncode", "select");
+            List<string> _TSN_rule = new List<string>();
+            for (int i = 0; i < rulebefore.Rows.Count; i++)
+            {
+                _TSN_rule.Add(rulebefore.Rows[i]["msd_sncode"].ToString());
+            }
+            TSN_Rule = _TSN_rule.ToArray();
+
+            //转换后的规则
+            DataTable ruleafter = (DataTable)ExecuteSql("select msd_sncode from MAKESNRULEDETAIL where msd_makecode='" + iMaCode + "' and msd_type='after' and nvl(msd_status,0)=0 order by msd_sncode", "select");
+            List<string> _SN_rule = new List<string>();
+            for (int i = 0; i < ruleafter.Rows.Count; i++)
+            {
+                _SN_rule.Add(ruleafter.Rows[i]["msd_sncode"].ToString());
+            }
+            SN_Rule = _SN_rule.ToArray();
+
+            oErrMessage = "";
+            return true;
+        }
     }
 }