From 2a52411bca70c10b4a8fe08ce44c2b47ef8ecbf7 Mon Sep 17 00:00:00 2001
From: zrg <z18737863051@163.com>
Date: 星期四, 09 五月 2024 09:51:17 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 Pub_Class/CustomerCls/ClsPub.cs |   80 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 75 insertions(+), 5 deletions(-)

diff --git a/Pub_Class/CustomerCls/ClsPub.cs b/Pub_Class/CustomerCls/ClsPub.cs
index 9d154cb..f324392 100644
--- a/Pub_Class/CustomerCls/ClsPub.cs
+++ b/Pub_Class/CustomerCls/ClsPub.cs
@@ -897,6 +897,76 @@
         }
 
 
+        //寰楀埌鏈�澶у熀纭�璧勬枡鐨勬祦姘村彿 HNumber
+        public static string CreateHNumber(string BillCode,string HName,string TableName, ref string sReturn, bool Add)
+        {
+
+            Int64 Glida;
+            Int32 CodeLen;
+            string sBillNumber = "";
+            char c = Convert.ToChar("0");
+            string sKjYear = DateTime.Today.Year.ToString();
+            string sPeriod = DateTime.Today.Month.ToString();
+            string sDay = DateTime.Today.Day.ToString();
+            //寰楀埌鍗曟嵁鍙疯〃 淇℃伅
+            ClsSqlHelper oCn = new ClsSqlHelper();
+            DataSet Ds = new DataSet();
+            DataSet Dss = new DataSet();
+            //绗竴娆℃煡璇㈡暟鎹槸鍚﹀瓨鍦�  涓嶅瓨鍦ㄥ氨娣诲姞
+            Ds = oCn.RunProcReturn("Select * from Gy_MaxNumber where BillName='" + HName.Trim() + "'", "Gy_MaxNumber");
+            //鎻掑叆鏂拌褰�    琛ㄥ悕,琛ㄥ悕绉�,褰撳墠id
+            if (Ds.Tables[0].Rows.Count == 0)
+            {
+
+                oCn.RunProc("insert into Gy_MaxNumber(BillType,BillName,IDNow) values('" + TableName.Trim() + "','" + HName.Trim() + "',1)");
+            }
+          
+            //绗簩娆℃煡璇� 鏄煡璇㈡彃鍏ョ殑鏂版暟鎹�
+            Dss = oCn.RunProcReturn("Select * from Gy_MaxNumber where BillName='" + HName.Trim() + "'", "Gy_MaxNumber");
+            if (Dss.Tables[0].Rows.Count != 0)
+            {
+
+                Glida = ClsPub.isLong(Dss.Tables[0].Rows[0]["Glida"].ToString());
+                CodeLen = ClsPub.isInt(Dss.Tables[0].Rows[0]["CodeLen"].ToString());
+            }
+            else
+            {
+                return "";
+            }
+            string sStr;
+            switch (Glida)
+            {
+                case 0://绾祦姘村彿
+                    Ds = oCn.RunProcReturn("Select * from Gy_MaxNumber where BillName='" + HName.Trim() + "'", "Gy_MaxNumber");
+                    if (Ds.Tables[0].Rows.Count != 0)
+                    {
+                        sStr = new string(c, CodeLen - (Ds.Tables[0].Rows[0]["IDNow"].ToString()).Length);
+                        sBillNumber = BillCode.Trim() + sStr + Ds.Tables[0].Rows[0]["IDNow"].ToString().Trim();
+                    }
+                   
+                    if (Add == true)
+                    {
+                        oCn.RunProc("update Gy_MaxNumber set IDNow=IDNow+1 where BillName='" + HName.Trim() + "'");
+                    }
+                    return sBillNumber;
+
+                case 1://鏍规嵁 YY骞�+MM鏈� 鏃� + 娴佹按鍙�  鐢熸垚鍗曟嵁鍙� 锛堟棩 閲囩敤浜� 浠撳簱鐨勫瓧娈碉級
+                    return sBillNumber;
+                case 2:      //鏍规嵁骞�+鏈�+鏃�  鐢熸垚鍗曟嵁鍙�
+                    return sBillNumber;
+                case 3: //鏍规嵁 涔斾竴 锛圫 + 骞达紙23锛�+浜斾綅娴佹按鍙凤級瀹炰緥锛歋2300001
+                    return sBillNumber;
+                case 4: //鏍规嵁 涔斾竴 宸ュ簭娴佽浆鍗″彿鏀规垚骞�+鏈�+鍥涗綅娴佹按鍙凤紙23050001锛�
+                    return sBillNumber;
+                default:
+                    return sBillNumber;
+
+            }
+            oCn.CnClose();
+            oCn.CnDispose();
+            oCn = null;
+        }
+
         //鍒ゆ柇鏄惁瀛樺湪鏉冮檺,骞跺啓鍏ユ棩蹇�
         public static bool Security_Log(string gnsy, int LogTF, bool Msg,string CurUserName)
         {
@@ -946,7 +1016,7 @@
                     }
                     else
                     {
-                        if (ClsPub.isStrNull(DsUser.Tables[0].Rows[0]["AuthorityID"]).Length > ModID
+                        if (ClsPub.isStrNull(DsUser.Tables[0].Rows[0]["AuthorityID"]).Length >= ModID
                             && DsUser.Tables[0].Rows[0]["AuthorityID"].ToString().Trim().Substring((int)ModID - 1, 1) == "1")
                         {
                             HavRight = true;
@@ -966,7 +1036,7 @@
                                 //HavRight = false;
                                 for (int i = 0; i < DsJS.Tables[0].Rows.Count; i++)
                                 {
-                                    if (ClsPub.isStrNull(DsJS.Tables[0].Rows[i]["AuthorityID"]).Length > ModID)
+                                    if (ClsPub.isStrNull(DsJS.Tables[0].Rows[i]["AuthorityID"]).Length >= ModID)
                                     {
                                         if (DsJS.Tables[0].Rows[i]["AuthorityID"].ToString().Trim().Substring((int)ModID - 1, 1) == "1")
                                         {
@@ -1055,7 +1125,7 @@
                     }
                     else
                     {
-                        if (DsUser.Tables[0].Rows[0]["AuthorityID"].ToString().Trim().Substring((int)ModID - 1, 1) == "1")
+                        if (ClsPub.isStrNull(DsUser.Tables[0].Rows[0]["AuthorityID"]).Length >= ModID && DsUser.Tables[0].Rows[0]["AuthorityID"].ToString().Trim().Substring((int)ModID - 1, 1) == "1")
                         {
                             HavRight = true;
                         }
@@ -1064,7 +1134,7 @@
                             //鑾峰彇鐢ㄦ埛缁�  骞跺惊鐜垽鏂潈闄�
                             //鍒ゆ柇瑙掕壊鏄惁鏈夋潈闄�
                             DsJS = oCn.RunProcReturn("select isnull(AuthorityID,'') AuthorityID from System_UserGroupinfo a inner join System_UserGroup b on a.GroupID=b.GroupID " +
-                                " Where a.USERID='" + UserID.Trim() + "'", "gy_czygl");
+                                " Where a.USERID='" + DsUser.Tables[0].Rows[0]["Czybm"].ToString().Trim() + "'", "gy_czygl");
                             if (DsJS == null)
                             {
                                 HavRight = false;
@@ -1074,7 +1144,7 @@
                                 HavRight = false;
                                 for (int i = 0; i < DsJS.Tables[0].Rows.Count; i++)
                                 {
-                                    if (ClsPub.isStrNull(DsJS.Tables[0].Rows[i]["AuthorityID"]).Length > ModID)
+                                    if (ClsPub.isStrNull(DsJS.Tables[0].Rows[i]["AuthorityID"]).Length >= ModID)
                                     {
                                         if (DsJS.Tables[0].Rows[i]["AuthorityID"].ToString().Trim().Substring((int)ModID - 1, 1) == "1")
                                         {

--
Gitblit v1.9.1