Browse Source

修改连接为内网

Hcsy 8 years ago
parent
commit
36b1010d72
3 changed files with 82 additions and 13 deletions
  1. 11 9
      UAS_AutoPass/Login.cs
  2. 67 0
      UAS_AutoPass/ToolClass/LogicHandler.cs
  3. 4 4
      UAS_AutoPass/UAS_AutoPass.csproj

+ 11 - 9
UAS_AutoPass/Login.cs

@@ -8,8 +8,6 @@ namespace UAS_AutoPass
     public partial class Login : Form
     public partial class Login : Form
     {
     {
 
 
-        MESHelper helper = new MESHelper();
-
         public Login()
         public Login()
         {
         {
             StartPosition = FormStartPosition.CenterScreen;
             StartPosition = FormStartPosition.CenterScreen;
@@ -19,14 +17,18 @@ namespace UAS_AutoPass
         private void CheckLogin_Click(object sender, EventArgs e)
         private void CheckLogin_Click(object sender, EventArgs e)
         {
         {
             string ErrMessage = "";
             string ErrMessage = "";
-            if (helper.CheckUserAndResourcePassed(UserName.Text, Source.Text, PassWord.Text, out ErrMessage))
+            if (LogicHandler.CheckUserLogin(UserName.Text, PassWord.Text, out ErrMessage))
             {
             {
-                BaseUtil.SetCacheData("UserName", UserName.Text);
-                BaseUtil.SetCacheData("Source", Source.Text);
-                AutoAnalysisXml xml = new AutoAnalysisXml(UserName.Text, Source.Text);
-                Hide();
-                xml.ShowDialog();
-                Close();
+                if (LogicHandler.CheckUserAndResourcePassed(UserName.Text, Source.Text, out ErrMessage))
+                {
+                    BaseUtil.SetCacheData("UserName", UserName.Text);
+                    BaseUtil.SetCacheData("Source", Source.Text);
+                    AutoAnalysisXml xml = new AutoAnalysisXml(UserName.Text, Source.Text);
+                    Hide();
+                    xml.ShowDialog();
+                    Close();
+                }
+                else MessageBox.Show(ErrMessage);
             }
             }
             else MessageBox.Show(ErrMessage);
             else MessageBox.Show(ErrMessage);
         }
         }

+ 67 - 0
UAS_AutoPass/ToolClass/LogicHandler.cs

@@ -1,4 +1,5 @@
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Data;
 using System.Text;
 using System.Text;
 
 
 namespace UAS_AutoPass.ToolClass
 namespace UAS_AutoPass.ToolClass
@@ -49,6 +50,72 @@ namespace UAS_AutoPass.ToolClass
             dh.ExecuteSql(sql.ToString(), "insert");
             dh.ExecuteSql(sql.ToString(), "insert");
         }
         }
 
 
+        public static bool CheckUserLogin(string iUserCode, string iPassWord, out string oErrorMessage)
+        {
+            oErrorMessage = "";
+            string SQL = "select em_code from employee where upper(em_code)=:UserName and em_password =:PassWord";
+            DataTable dt;
+            dt = (DataTable)dh.ExecuteSql(SQL, "select", iUserCode.ToUpper(), iPassWord);
+            if (dt.Rows.Count > 0)
+                return true;
+            else
+            {
+                oErrorMessage = "用户名或者密码不正确!";
+                return false;
+            }
+        }
+
+        public static bool CheckUserAndResourcePassed(string iUserCode, string iSourceCode, out string oErrorMessage)
+        {
+            oErrorMessage = "";
+            iUserCode = iUserCode.ToUpper();
+            iSourceCode = iSourceCode.ToUpper();
+            string SQL = "select em_code,em_type from employee where upper(em_code)=:UserName ";
+            DataTable dt;
+            dt = (DataTable)dh.ExecuteSql(SQL, "select", iUserCode);
+            if (dt.Rows.Count > 0)
+            {
+                string em_type = dt.Rows[0]["em_type"].ToString();
+                if (iSourceCode == "")
+                {
+                    oErrorMessage = "岗位资源不允许为空";
+                    return false;
+                }
+                if (em_type == "admin")
+                {
+                    if (dh.CheckExist("Source", "upper(sc_code)='" + iSourceCode + "' and sc_statuscode='AUDITED'"))
+                    {
+                        return true;
+                    }
+                    else
+                    {
+                        oErrorMessage = "岗位资源编号错误或者未审核!";
+                        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[] { "upper(ur_resourcecode) ur_resourcecode" }, "upper(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() == iSourceCode)
+                                return true;
+                        }
+                        oErrorMessage = "用户不处于当前资源所属分组!";
+                    }
+                    else
+                        oErrorMessage = "岗位资源编号错误或者未审核!";
+                }
+            }
+            else
+                oErrorMessage = "用户不存在!";
+            return false;
+        }
+
         public static bool SetStepResult(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, out string oErrorMessage)
         public static bool SetStepResult(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, out string oErrorMessage)
         {
         {
             return CS_SetResult(iMakeCode, iSourceCode, iSN, iUserCode, iResult, out oErrorMessage);
             return CS_SetResult(iMakeCode, iSourceCode, iSN, iUserCode, iResult, out oErrorMessage);

+ 4 - 4
UAS_AutoPass/UAS_AutoPass.csproj

@@ -17,20 +17,21 @@
     <PublishUrl>E:\s_user_site\AutoPass\</PublishUrl>
     <PublishUrl>E:\s_user_site\AutoPass\</PublishUrl>
     <Install>true</Install>
     <Install>true</Install>
     <InstallFrom>Web</InstallFrom>
     <InstallFrom>Web</InstallFrom>
-    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateEnabled>true</UpdateEnabled>
     <UpdateMode>Foreground</UpdateMode>
     <UpdateMode>Foreground</UpdateMode>
     <UpdateInterval>7</UpdateInterval>
     <UpdateInterval>7</UpdateInterval>
     <UpdateIntervalUnits>Days</UpdateIntervalUnits>
     <UpdateIntervalUnits>Days</UpdateIntervalUnits>
     <UpdatePeriodically>false</UpdatePeriodically>
     <UpdatePeriodically>false</UpdatePeriodically>
-    <UpdateRequired>false</UpdateRequired>
+    <UpdateRequired>true</UpdateRequired>
     <MapFileExtensions>true</MapFileExtensions>
     <MapFileExtensions>true</MapFileExtensions>
     <InstallUrl>http://172.16.11.99/AutoPass/</InstallUrl>
     <InstallUrl>http://172.16.11.99/AutoPass/</InstallUrl>
     <ProductName>UAS自动过站解析器</ProductName>
     <ProductName>UAS自动过站解析器</ProductName>
     <PublisherName>深圳市优软科技有限公司</PublisherName>
     <PublisherName>深圳市优软科技有限公司</PublisherName>
     <SuiteName>UAS自动过站解析器</SuiteName>
     <SuiteName>UAS自动过站解析器</SuiteName>
+    <MinimumRequiredVersion>1.0.0.12</MinimumRequiredVersion>
     <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
     <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
     <WebPage>publish.htm</WebPage>
     <WebPage>publish.htm</WebPage>
-    <ApplicationRevision>4</ApplicationRevision>
+    <ApplicationRevision>13</ApplicationRevision>
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
     <UseApplicationTrust>false</UseApplicationTrust>
     <UseApplicationTrust>false</UseApplicationTrust>
     <CreateDesktopShortcut>true</CreateDesktopShortcut>
     <CreateDesktopShortcut>true</CreateDesktopShortcut>
@@ -83,7 +84,6 @@
     <Reference Include="System.Data" />
     <Reference Include="System.Data" />
     <Reference Include="System.Deployment" />
     <Reference Include="System.Deployment" />
     <Reference Include="System.Drawing" />
     <Reference Include="System.Drawing" />
-    <Reference Include="System.Net.Http" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
     <Reference Include="System.Xml" />
   </ItemGroup>
   </ItemGroup>