1
zrg
2024-06-27 9d8889f3c64cc5b1e91c642d5a1266efdff300b2
1
9个文件已修改
149 ■■■■■ 已修改文件
DDServer/.vs/DDServer/DesignTimeBuild/.dtbcache.v2 补丁 | 查看 | 原始文档 | blame | 历史
DDServer/.vs/DDServer/v16/.suo 补丁 | 查看 | 原始文档 | blame | 历史
DDServer/DDServer/DingDingServeices.cs 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DDServer/DDServer/DingDingServices_SMR.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DDServer/DDServer/obj/Debug/netcoreapp3.1/DingDingServices_SMR.assets.cache 补丁 | 查看 | 原始文档 | blame | 历史
DDServer/DDServer/obj/Debug/netcoreapp3.1/DingDingServices_SMR.csproj.AssemblyReference.cache 补丁 | 查看 | 原始文档 | blame | 历史
DDServer/DDServer/obj/DingDingServices_SMR.csproj.nuget.dgspec.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DDServer/DDServer/obj/project.assets.json 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DDServer/DDServer/obj/project.nuget.cache 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DDServer/.vs/DDServer/DesignTimeBuild/.dtbcache.v2
Binary files differ
DDServer/.vs/DDServer/v16/.suo
Binary files differ
DDServer/DDServer/DingDingServeices.cs
@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
@@ -8,6 +9,7 @@
    public class DingDingServeices
    {
        public DataSet ds = new DataSet();
        public DataSet ds1 = new DataSet();
        public DBHelper oCN = new DBHelper();       
        /// <summary>
@@ -16,36 +18,117 @@
        public object Get_ErrMsgBackBillMain()
        {
            //获取未关闭单子
            string sql = "select a.HInterID,a.HContext,a.HReceiveMan,a.HCopyMan,a.HMakeDate,DATEDIFF(MINUTE, a.HMakeDate, GETDATE()) AS MinutesPassed from OA_ErrMsgBackBillMain a where HResult='未完成'";
            string sql = "select a.HInterID,a.HContext,a.HDescription,a.HReceiveMan,a.HCopyMan,a.HMakeDate,DATEDIFF(MINUTE, a.HMakeDate, GETDATE()) AS MinutesPassed from OA_ErrMsgBackBillMain a where HResult='未完成'";
            ds = oCN.RunProcReturn(sql, "OA_ErrMsgBackBillMain");
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                //获取已发送人
                //获取已发送人,未关闭的单子 主内码 内容
                string Superiors = ds.Tables[0].Rows[i]["HReceiveMan"].ToString();
                string HInterID = ds.Tables[0].Rows[i]["HInterID"].ToString();
                string HDescription = ds.Tables[0].Rows[i]["HDescription"].ToString();
                //获取制单日期到现在过了多长时间
                int TimeInterval = Convert.ToInt32(ds.Tables[0].Rows[i]["MinutesPassed"]);
                //根据发送人去找对应的上级
                string sql1 = "select a.HGroupID,c.GroupName,* from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserIdleft join System_UserGroup c on b.GroupId = c.GroupIDwhere Czymc = '" + Superiors + "'";
                string sql1 = "select a.HGroupID,c.GroupName,* from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId left join System_UserGroup c on b.GroupId = c.GroupID where Czymc = '" + Superiors + "'";
                ds = oCN.RunProcReturn(sql1, "Gy_Czygl");
                //获取职务
                string Job = ds.Tables[0].Rows[0]["GroupName"].ToString();
                //根据职务去找当前人上级
                string sql2 = "select * from Gy_Duty where HParentID=(select HParentID from Gy_Duty where HItemID=(select HParentID from Gy_Duty where HName='" + Job + "' ))";
                ds = oCN.RunProcReturn(sql2, "Gy_Duty");
                //根据安灯规则去找到匹配规则的职位,然后获取到时间,看是否大于1
                if (ds.Tables[0].Rows.Count>1)
                {
                    for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
                    {
                        //获取上级人的职务
                        string Jobs = ds.Tables[0].Rows[j]["HName"].ToString();
                        //根据安灯去匹配职务和触发时间
                        string sql3 = "select b.HTimes,c.HName from OA_AndengFlowRuleBillMain a inner join OA_AndengFlowRuleBillSub b on a.HInterID = b.HInterID left join Gy_Duty c on b.HDutyID = c.HItemID where c.HName = '" + Jobs + "'";
                        ds = oCN.RunProcReturn(sql3, "OA_AndengFlowRuleBillMain");
                        //根据规则获取触发时间  职务
                        int HTimes = Convert.ToInt32(ds.Tables[0].Rows[0]["HTimes"]);
                        string JobS = ds.Tables[0].Rows[0]["HName"].ToString();
                        //如果时间间隔大于触发时间
                        if (TimeInterval > HTimes)
                        {
                            //根据职务去匹配相对应的人 用于插入数据库
                            string sql4 = "select a.HGroupID,c.GroupName,* from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId left join System_UserGroup c on b.GroupId = c.GroupID  where c.GroupName = '" + JobS + "'";
                            ds = oCN.RunProcReturn(sql4, "Gy_Czygl");
                            string HName = ds.Tables[0].Rows[0]["Czymc"].ToString();
                            //获取当前异常反馈单子表的ID是多大,然后插入子表信息
                            string sql5 = "select max(HEntryID) HEntryID from OA_ErrMsgBackBillSub2 where HInterID='" + HInterID + "'";
                            ds1 = oCN.RunProcReturn(sql5, "OA_ErrMsgBackBillSub2");
                            int HEntryID = Convert.ToInt32(ds1.Tables[0].Rows[0]["HName"]);
                            int newHEntryID = HEntryID + 1; //根据当前ID最大的子ID去加1
                            string sql6 = "insert OA_ErrMsgBackBillSub2 values('" + HInterID + "','" + newHEntryID + "','" + HName + "','0','1')";
                            ds1 = oCN.RunProcReturn(sql6, "OA_ErrMsgBackBillSub2");
                            //传入插入子表的人    异常反馈单的内容
                            DingDingMesAsync(HName, HDescription);
                        }
                    }
                }
                else
                {
                    //获取上级人的职务
                    string Jobs = ds.Tables[0].Rows[0]["HName"].ToString();
                    //根据安灯去匹配职务和触发时间
                    string sql3 = "select b.HTimes,c.HName from OA_AndengFlowRuleBillMain a inner join OA_AndengFlowRuleBillSub b on a.HInterID = b.HInterID left join Gy_Duty c on b.HDutyID = c.HItemID where c.HName = '"+ Jobs + "'";
                    ds = oCN.RunProcReturn(sql3, "OA_AndengFlowRuleBillMain");
                    //根据规则获取触发时间  职务
                    int HTimes = Convert.ToInt32(ds.Tables[0].Rows[0]["HTimes"]);
                    string JobS = ds.Tables[0].Rows[0]["HName"].ToString();
                    //如果时间间隔大于触发时间
                    if (TimeInterval > HTimes)
                    {
                        //根据职务去匹配相对应的人 用于插入数据库
                        string sql4 = "select a.HGroupID,c.GroupName,* from Gy_Czygl a left join System_UserGroupInfo b on a.Czybm = b.UserId left join System_UserGroup c on b.GroupId = c.GroupID  where c.GroupName = '"+ JobS + "'";
                        ds = oCN.RunProcReturn(sql4, "Gy_Czygl");
                        string HName= ds.Tables[0].Rows[0]["Czymc"].ToString();
                        //获取当前异常反馈单子表的ID是多大,然后插入子表信息
                        string sql5 = "select max(HEntryID) HEntryID from OA_ErrMsgBackBillSub2 where HInterID='" + HInterID + "'";
                        ds1 = oCN.RunProcReturn(sql5, "OA_ErrMsgBackBillSub2");
                        int HEntryID = Convert.ToInt32(ds1.Tables[0].Rows[0]["HName"]);
                        int newHEntryID = HEntryID + 1; //根据当前ID最大的子ID去加1
                        string sql6 = "insert OA_ErrMsgBackBillSub2 values('"+HInterID+"','"+newHEntryID+"','"+HName+"','0','1')";
                        ds1 = oCN.RunProcReturn(sql6, "OA_ErrMsgBackBillSub2");
                        //传入插入子表的人    异常反馈单的内容
                        DingDingMesAsync(HName, HDescription);
                    }
                }
            }
            return 1;
        }
        //查询异常反馈单,未关闭的单子 后面是循环
        //根据接收人获取他的职位,查询组织架构获取上级,再去
        /// <summary>
        /// 钉钉接口发送消息
        /// </summary>
        /// <param name="HReceiveMan">要发信息的人</param>
        /// <param name="HDescription">异常反馈单内容</param>
        public async void DingDingMesAsync(string HReceiveMan, string HDescription)
        {
            ds = oCN.RunProcReturn("select * from Gy_Czygl where Czymc='" + HReceiveMan + "'", "Gy_Czygl");
            string DDUserID = ds.Tables[0].Rows[0]["DDUserID"].ToString();  //钉钉用户的id
            MSG msg = new MSG();
            string appKey = "dingrsrzhdyn3mlaof95";
            string appSecret = "RAqH6YtZnPLCpDbuqfaYQkKkVtVdS0wqfC8I26X6qiS-8eoCJCNrzx3fubGND4Sq";
            //获取企业的access_token的值
            string response = msg.GetAccessToken(appKey, appSecret);
            JObject responseJson = JObject.Parse(response);
            // 获取access_token的值
            string accessToken = responseJson["accessToken"].ToString();
            //调用方法发送消息
            string agentId = "3118119317";  //企业内部小程序id
            string deptIdList = "0"; // 空字符串表示不指定部门
            string toAllUser = "false";
            string message = HDescription;//异常反馈单的内容
            response = await msg.SendTextMessage(accessToken, agentId, DDUserID, deptIdList, toAllUser, message);
            Console.WriteLine($"初始消息发送结果: {response}");
        }
    }
}
DDServer/DDServer/DingDingServices_SMR.csproj
@@ -6,6 +6,7 @@
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
    <PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
  </ItemGroup>
DDServer/DDServer/obj/Debug/netcoreapp3.1/DingDingServices_SMR.assets.cache
Binary files differ
DDServer/DDServer/obj/Debug/netcoreapp3.1/DingDingServices_SMR.csproj.AssemblyReference.cache
Binary files differ
DDServer/DDServer/obj/DingDingServices_SMR.csproj.nuget.dgspec.json
@@ -44,6 +44,10 @@
        "netcoreapp3.1": {
          "targetAlias": "netcoreapp3.1",
          "dependencies": {
            "Newtonsoft.Json": {
              "target": "Package",
              "version": "[13.0.3, )"
            },
            "System.Data.SqlClient": {
              "target": "Package",
              "version": "[4.8.6, )"
DDServer/DDServer/obj/project.assets.json
@@ -34,6 +34,15 @@
          }
        }
      },
      "Newtonsoft.Json/13.0.3": {
        "type": "package",
        "compile": {
          "lib/netstandard2.0/Newtonsoft.Json.dll": {}
        },
        "runtime": {
          "lib/netstandard2.0/Newtonsoft.Json.dll": {}
        }
      },
      "runtime.native.System.Data.SqlClient.sni/4.7.0": {
        "type": "package",
        "dependencies": {
@@ -196,6 +205,36 @@
        "runtimes/win/lib/netstandard2.0/Microsoft.Win32.Registry.xml",
        "useSharedDesignerContext.txt",
        "version.txt"
      ]
    },
    "Newtonsoft.Json/13.0.3": {
      "sha512": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==",
      "type": "package",
      "path": "newtonsoft.json/13.0.3",
      "files": [
        ".nupkg.metadata",
        ".signature.p7s",
        "LICENSE.md",
        "README.md",
        "lib/net20/Newtonsoft.Json.dll",
        "lib/net20/Newtonsoft.Json.xml",
        "lib/net35/Newtonsoft.Json.dll",
        "lib/net35/Newtonsoft.Json.xml",
        "lib/net40/Newtonsoft.Json.dll",
        "lib/net40/Newtonsoft.Json.xml",
        "lib/net45/Newtonsoft.Json.dll",
        "lib/net45/Newtonsoft.Json.xml",
        "lib/net6.0/Newtonsoft.Json.dll",
        "lib/net6.0/Newtonsoft.Json.xml",
        "lib/netstandard1.0/Newtonsoft.Json.dll",
        "lib/netstandard1.0/Newtonsoft.Json.xml",
        "lib/netstandard1.3/Newtonsoft.Json.dll",
        "lib/netstandard1.3/Newtonsoft.Json.xml",
        "lib/netstandard2.0/Newtonsoft.Json.dll",
        "lib/netstandard2.0/Newtonsoft.Json.xml",
        "newtonsoft.json.13.0.3.nupkg.sha512",
        "newtonsoft.json.nuspec",
        "packageIcon.png"
      ]
    },
    "runtime.native.System.Data.SqlClient.sni/4.7.0": {
@@ -450,6 +489,7 @@
  },
  "projectFileDependencyGroups": {
    ".NETCoreApp,Version=v3.1": [
      "Newtonsoft.Json >= 13.0.3",
      "System.Data.SqlClient >= 4.8.6"
    ]
  },
@@ -497,6 +537,10 @@
      "netcoreapp3.1": {
        "targetAlias": "netcoreapp3.1",
        "dependencies": {
          "Newtonsoft.Json": {
            "target": "Package",
            "version": "[13.0.3, )"
          },
          "System.Data.SqlClient": {
            "target": "Package",
            "version": "[4.8.6, )"
DDServer/DDServer/obj/project.nuget.cache
@@ -1,11 +1,12 @@
{
  "version": 2,
  "dgSpecHash": "r9ZGm/mVVa5wwVLZhwYj1CFR/kymOslTF3CG8GuG1hRuyXY0gD3ZJKFU3rxrknp9Mg7UMI6YFHM0aUrR4+AJdA==",
  "dgSpecHash": "EViDjUUa2UGxdWFfSvLcuZkDdIeu2gzaAcAxbPpXzobUbn190XpKfZ8G+Fif200cJP9VYCqFMkyzs7iArtTglw==",
  "success": true,
  "projectFilePath": "D:\\智云迈思\\MES\\DingDingServices\\DDServer\\DDServer\\DingDingServices_SMR.csproj",
  "expectedPackageFiles": [
    "C:\\Users\\86187\\.nuget\\packages\\microsoft.netcore.platforms\\3.1.0\\microsoft.netcore.platforms.3.1.0.nupkg.sha512",
    "C:\\Users\\86187\\.nuget\\packages\\microsoft.win32.registry\\4.7.0\\microsoft.win32.registry.4.7.0.nupkg.sha512",
    "C:\\Users\\86187\\.nuget\\packages\\newtonsoft.json\\13.0.3\\newtonsoft.json.13.0.3.nupkg.sha512",
    "C:\\Users\\86187\\.nuget\\packages\\runtime.native.system.data.sqlclient.sni\\4.7.0\\runtime.native.system.data.sqlclient.sni.4.7.0.nupkg.sha512",
    "C:\\Users\\86187\\.nuget\\packages\\runtime.win-arm64.runtime.native.system.data.sqlclient.sni\\4.4.0\\runtime.win-arm64.runtime.native.system.data.sqlclient.sni.4.4.0.nupkg.sha512",
    "C:\\Users\\86187\\.nuget\\packages\\runtime.win-x64.runtime.native.system.data.sqlclient.sni\\4.4.0\\runtime.win-x64.runtime.native.system.data.sqlclient.sni.4.4.0.nupkg.sha512",