提交 7ce2d476 authored 作者: 曾传波's avatar 曾传波

纽迪瑞报表项目

上级
using Kingdee.BOS.Core.Log;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using Kingdee.BOS.WebApi.Client;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
namespace LQKJ.K3.IScheduleServicePlugIn
{
[HotUpdate, Description("执行计划")]
public class IsCheduleServicePlugIn : Kingdee.BOS.Contracts.IScheduleService
{
//public string url = "http://192.168.0.242:89/k3cloud/";
//public string dbid = "64243c12d1eb7a";
//public string pwd = "kingdee@123";
public string url = Kingdee.BOS.KDConfiguration.Current.CommonConfiguration.AppSettings.Settings["Url"].Value;
public string dbid = Kingdee.BOS.KDConfiguration.Current.CommonConfiguration.AppSettings.Settings["Dbid"].Value;
public string pwd = Kingdee.BOS.KDConfiguration.Current.CommonConfiguration.AppSettings.Settings["passWord"].Value;
public string login = Kingdee.BOS.KDConfiguration.Current.CommonConfiguration.AppSettings.Settings["login"].Value;
//public string url = "http://192.168.0.90/ndr/";
//public string dbid = "640aea3709a243";
//public string pwd = "kingdee$2023";
public void Run(Kingdee.BOS.Context ctx, Kingdee.BOS.Core.Schedule schedule)
{
var Hour = DateTime.Now.Hour;
var Time = DateTime.Now.ToString("yyyyMM");
var Day = DateTime.Now.Day;
if (Hour == 12 && Day == 1)
{
string sql2 = $"select * from LQKJ_t_KAIZHANGSTATE";
if (DBServiceHelper.ExecuteDataSet(ctx, sql2).Tables[0].Rows.Count == 0)
{
sql2 = $"insert LQKJ_t_KAIZHANGSTATE(FID, F_LQKJ_TEXT,F_LQKJ_TEXT1,F_LQKJ_TEXT2,F_LQKJ_TEXT3) values(1, 'false','{Time}','false','false')";
DBServiceHelper.ExecuteDataSet(ctx, sql2);
}
else
{
sql2 = $"update LQKJ_t_KAIZHANGSTATE set F_LQKJ_TEXT='false',F_LQKJ_TEXT1='{Time}',F_LQKJ_TEXT2='false',F_LQKJ_TEXT3='false' where FID=1";
DBServiceHelper.ExecuteDataSet(ctx, sql2);
}
}
string date = DateTime.Now.AddMonths(-1).ToString("yyyy-MM");
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("{\"Ids\":\"");
string sql = string.Format("/*dialect*/select FID from LQKJ_T_PROJECTHOURS where convert(varchar(7),F_LQKJ_DATE2,120)='{0}'", date);
DataTable dt = DBServiceHelper.ExecuteDataSet(ctx, sql).Tables[0];//查表
if (dt.Rows.Count > 0)
{
stringBuilder.Append(dt.Rows[0]["FID"].ToString());
if (dt.Rows.Count > 1)
{
for (int i = 1; i < dt.Rows.Count; i++)
{
stringBuilder.Append(","+dt.Rows[i]["FID"].ToString());
}
}
stringBuilder.Append("\"}");
string parmeters = JsonConvert.SerializeObject(stringBuilder.ToString());
string parmeters2 = stringBuilder.ToString();
//parmeters = JsonConvert.DeserializeObject(parmeters).ToString();
K3CloudApiClient client = new K3CloudApiClient(url);
var loginResult = client.ValidateLogin(dbid, "Administrator", pwd, 2052);
var resultType = JObject.Parse(loginResult)["LoginResultType"].Value<int>();
if (resultType == 1)
{
JObject result = JObject.Parse(client.Submit("LQKJ_XMGSDJ", parmeters2));
string r = "提交失败";
if(result["Result"]["ResponseStatus"]["IsSuccess"].ToString() == "True")
{
r = "提交成功";
}
var logs = new List<LogObject>();
var log = new LogObject();
log.pkValue = "0";
log.Description = r;
log.OperateName = "项目工时";
log.ObjectTypeId = "BOS_SCHEDULETYPE";
log.SubSystemId = "BOS";
log.Environment = OperatingEnvironment.BizOperate;
logs.Add(log);
new Kingdee.BOS.App.LogService.Log().BatchWriteLog(ctx, logs);
}
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3744A15F-BB9F-4206-B33A-E9DA3A97A13A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LQKJ.K3.IScheduleServicePlugIn</RootNamespace>
<AssemblyName>LQKJ.K3.IScheduleServicePlugIn</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>D:\纽迪瑞\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Kingdee.BOS">
<HintPath>D:\纽迪瑞\bin\Kingdee.BOS.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.App">
<HintPath>D:\纽迪瑞\bin\Kingdee.BOS.App.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.App.LogService, Version=8.1.529.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\纽迪瑞\bin\Kingdee.BOS.App.LogService.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.Contracts">
<HintPath>D:\纽迪瑞\bin\Kingdee.BOS.Contracts.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.Core">
<HintPath>D:\纽迪瑞\bin\Kingdee.BOS.Core.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.ServiceHelper">
<HintPath>D:\纽迪瑞\bin\Kingdee.BOS.ServiceHelper.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.WebApi.Client, Version=8.1.529.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\纽迪瑞\bin\Kingdee.BOS.WebApi.Client.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\纽迪瑞\bin\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="IsCheduleServicePlugIn.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("LQKJ.K3.IScheduleServicePlugIn")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LQKJ.K3.IScheduleServicePlugIn")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("3744a15f-bb9f-4206-b33a-e9da3a97a13a")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论