提交 0305cd36 authored 作者: 曾传波's avatar 曾传波

西部和档案表单插件

上级
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LQKJ.DANGAN.ReportPlugIN
{
[HotUpdate,Description("动态表单插件")]
public class DynamicReport: AbstractDynamicFormPlugIn
{
private string FBillNo = "";
public override void OnLoad(EventArgs e)
{
this.FBillNo = this.View.OpenParameter.GetCustomParameter("FBillNo").ToString();
}
}
}
<?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>{50FFAF6A-67AB-4C16-B85E-7C99DC74BE7D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LQKJ.DANGAN.ReportPlugIN</RootNamespace>
<AssemblyName>LQKJ.DANGAN.ReportPlugIN</AssemblyName>
<TargetFrameworkVersion>v4.7.2</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:\西部培训\WebSite\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, Version=8.1.620.16, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\西部培训\WebSite\bin\Kingdee.BOS.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.Core, Version=8.1.620.16, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\西部培训\WebSite\bin\Kingdee.BOS.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<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.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DynamicReport.cs" />
<Compile Include="Report.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.DANGAN.ReportPlugIN")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LQKJ.DANGAN.ReportPlugIN")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("50ffaf6a-67ab-4c16-b85e-7c99dc74be7d")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LQKJ.DANGAN.ReportPlugIN
{
[HotUpdate,Description("动态表单")]
public class Report: AbstractBillPlugIn
{
public override void BarItemClick(BarItemClickEventArgs e)
{
if (e.BarItemKey.Equals("LQKJ_YRDANGAN"))
{ //调用,动态表单
var model = this.View.Model;
DynamicFormShowParameter form = new DynamicFormShowParameter();
//调用哪个表单
form.FormId = "LQKJ_DAYJYY";
form.CustomParams.Add("FBillNo", Convert.ToString(this.View.Model.GetValue("FBillNo")));
//打开的动态表单,加载进来
this.View.ShowForm(form);
}
}
}
}
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
D:\西部培训\WebSite\bin\LQKJ.DANGAN.ReportPlugIN.dll
D:\西部培训\WebSite\bin\LQKJ.DANGAN.ReportPlugIN.pdb
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.DANGAN.ReportPlugIN\obj\Debug\LQKJ.DANGAN.ReportPlugIN.csproj.CoreCompileInputs.cache
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.DANGAN.ReportPlugIN\obj\Debug\LQKJ.DANGAN.ReportPlugIN.csproj.CopyComplete
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.DANGAN.ReportPlugIN\obj\Debug\LQKJ.DANGAN.ReportPlugIN.dll
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.DANGAN.ReportPlugIN\obj\Debug\LQKJ.DANGAN.ReportPlugIN.pdb

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33529.622
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LQKJ.XiBU.ReportPlugIN", "LQKJ.XiBU.ReportPlugIN\LQKJ.XiBU.ReportPlugIN.csproj", "{23310E5C-C861-47C2-AF16-6A6449EBE35F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LQKJ.XiBU.ServicePlugIN", "LQKJ.XiBU.ServicePlugIN\LQKJ.XiBU.ServicePlugIN.csproj", "{5280D0C0-5AA1-4766-8D2E-BC34DA8245D1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LQKJ.DANGAN.ReportPlugIN", "LQKJ.DANGAN.ReportPlugIN\LQKJ.DANGAN.ReportPlugIN.csproj", "{50FFAF6A-67AB-4C16-B85E-7C99DC74BE7D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{23310E5C-C861-47C2-AF16-6A6449EBE35F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23310E5C-C861-47C2-AF16-6A6449EBE35F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23310E5C-C861-47C2-AF16-6A6449EBE35F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23310E5C-C861-47C2-AF16-6A6449EBE35F}.Release|Any CPU.Build.0 = Release|Any CPU
{5280D0C0-5AA1-4766-8D2E-BC34DA8245D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5280D0C0-5AA1-4766-8D2E-BC34DA8245D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5280D0C0-5AA1-4766-8D2E-BC34DA8245D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5280D0C0-5AA1-4766-8D2E-BC34DA8245D1}.Release|Any CPU.Build.0 = Release|Any CPU
{50FFAF6A-67AB-4C16-B85E-7C99DC74BE7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50FFAF6A-67AB-4C16-B85E-7C99DC74BE7D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50FFAF6A-67AB-4C16-B85E-7C99DC74BE7D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50FFAF6A-67AB-4C16-B85E-7C99DC74BE7D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A4CBA867-BFFF-4836-A9A9-77971C931192}
EndGlobalSection
EndGlobal
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LQKJ.XiBU.ReportPlugIN
{
[HotUpdate,Description("表单插件")]
public class BiaodanPlugIn: AbstractBillPlugIn
{
public override void BarItemClick(BarItemClickEventArgs e)
{
base.BarItemClick(e);
if (e.BarItemKey.Equals("LQKJ_Relieve"))
{
var Id = this.View.Model.GetPKValue().ToString();
string uptSql = $"update T_PX_StudentsInfo set FOPENID='' where FSTUDENTID={Id}";
var result = DBServiceHelper.Execute(this.Context, uptSql);
if (result > 0)
{
this.View.ShowMessage("解绑成功!");
//this.View.UpdateView();
this.View.Refresh();
}
}
}
}
}
<?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>{23310E5C-C861-47C2-AF16-6A6449EBE35F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LQKJ.XiBU.ReportPlugIN</RootNamespace>
<AssemblyName>LQKJ.XiBU.ReportPlugIN</AssemblyName>
<TargetFrameworkVersion>v4.7.2</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:\西部培训\WebSite\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, Version=8.1.620.16, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\西部培训\WebSite\bin\Kingdee.BOS.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.Core, Version=8.1.620.16, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\西部培训\WebSite\bin\Kingdee.BOS.Core.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.DataEntity, Version=8.1.620.16, Culture=neutral, PublicKeyToken=null" />
<Reference Include="Kingdee.BOS.ServiceHelper, Version=8.1.620.16, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\西部培训\WebSite\bin\Kingdee.BOS.ServiceHelper.dll</HintPath>
</Reference>
<Reference Include="System" />
<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.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BiaodanPlugIn.cs" />
<Compile Include="PXItemListReportPlugIn.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.List.PlugIn;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LQKJ.XiBU.ReportPlugIN
{
[HotUpdate,Description("列表插件")]
public class PXItemListReportPlugIn: AbstractListPlugIn
{
public override void BarItemClick(BarItemClickEventArgs e)
{
var barItemKey = e.BarItemKey;
base.BarItemClick(e);
var identity = this.View.Model.OpenParameter.FormId;
ListSelectedRowCollection listcoll = this.ListView.SelectedRowsInfo;
List<string> sqlList = new List<string>();
int result = 0;
if (listcoll.Count == 0 && (barItemKey.Equals("LQKJ_ClassIssue")||barItemKey.Equals("LQKJ_Relieve")))
{
this.View.ShowMessage("您没有选择任何数据");
return;
}
if(identity== "LQKJ_Course"&&barItemKey== "tbRefresh")
{
string sql = "exec CourseCount";
DBServiceHelper.Execute(base.Context, sql);
this.View.Refresh();
}
switch (barItemKey)
{
case "LQKJ_ClassIssue":
sqlList = Sql(barItemKey, listcoll);
result = DBServiceHelper.ExecuteBatch(this.Context, sqlList);
if (result > 0)
{
this.View.ShowMessage("发布成功!");
}
break;
case "LQKJ_Relieve":
sqlList = Sql(barItemKey, listcoll);
result = DBServiceHelper.ExecuteBatch(this.Context, sqlList);
if (result > 0)
{
this.View.ShowMessage("解绑成功!");
}
break;
}
}
private List<string> Sql(string barItemKey, ListSelectedRowCollection listcoll)
{
List<string> sqlList = new List<string>();
string uptSql = "";
for(int i = 0; i < listcoll.Count; i++)
{
switch (barItemKey)
{
case "LQKJ_ClassIssue":
var entryId = listcoll[i].EntryPrimaryKeyValue;
uptSql = $"update T_PX_TRAININGPROINFOENTRY set FISRELEASE='1' where FENTRYID={entryId}";
break;
case "LQKJ_Relieve":
var stuId = listcoll[i].PrimaryKeyValue;
uptSql = $"update T_PX_StudentsInfo set FOPENID='' where FSTUDENTID={stuId}";
break;
}
sqlList.Add(uptSql);
}
return sqlList;
}
public override void OnInitialize(InitializeEventArgs e)
{
base.OnInitialize(e);
var identity = this.View.Model.OpenParameter.FormId;
if (identity.Equals("LQKJ_Course"))//课程
{
string sql = "exec CourseCount";
DBServiceHelper.Execute(base.Context, sql);
}
}
public override void EntryButtonCellClick(EntryButtonCellClickEventArgs e)
{
base.EntryButtonCellClick(e);
var identity = this.View.Model.OpenParameter.FormId;
if(identity== "LQKJ_Course")
{
var key = e.FieldKey;
DynamicObject curRow = this.ListModel.GetData(e.Row - 1, 1, false)[0];
var param = new ListShowParameter();
string Filter = "";
param.FormId = "LQKJ_AttendanceRecord";
switch (key)
{
case "FRepairCard"://补卡待审批
Filter = $"FCOURSEID={curRow["FCOURSEID"]} and (FCOCKINTYPE='QTBQ' OR FCOCKINTYPE='QDBQ') and FDOCUMENTSTATUS!='C' AND FFORBIDSTATUS='A'";
break;
case "FNormalCheckIn"://正常签到
Filter = $"FCOURSEID={curRow["FCOURSEID"]} and FCOCKINTYPE='QD' and FDOCUMENTSTATUS='C' AND FFORBIDSTATUS='A'";
break;
case "FRepairCheckIn"://补卡签到
Filter = $"FCOURSEID={curRow["FCOURSEID"]} and FCOCKINTYPE='QDBQ' and FDOCUMENTSTATUS='C' AND FFORBIDSTATUS='A'";
break;
case "FNormalCheckOut"://正常签退
Filter = $"FCOURSEID={curRow["FCOURSEID"]} and FCOCKINTYPE='QT' and FDOCUMENTSTATUS='C' AND FFORBIDSTATUS='A'";
break;
case "FRepairCheckOut"://补卡签退
Filter = $"FCOURSEID={curRow["FCOURSEID"]} and FCOCKINTYPE='QTBQ' and FDOCUMENTSTATUS='C' AND FFORBIDSTATUS='A'";
break;
case "FQDAskForFeave"://签到请假
Filter = $"FCOURSEID={curRow["FCOURSEID"]} and FCOCKINTYPE='QDQJ' and FDOCUMENTSTATUS='C' AND FFORBIDSTATUS='A'";
break;
case "FQTAskForFeave"://签退请假
Filter = $"FCOURSEID={curRow["FCOURSEID"]} and FCOCKINTYPE='QTQJ' and FDOCUMENTSTATUS='C' AND FFORBIDSTATUS='A'";
break;
case "FEvaluated"://已评价
param.FormId = "LQKJ_Evaluates";
Filter = $"FCOURSE={curRow["FCOURSEID"]} and FDOCUMENTSTATUS='C' AND FFORBIDSTATUS='A'";
break;
}
if (!String.IsNullOrWhiteSpace(Filter))
{
param.ListFilterParameter.Filter = Filter;
this.View.ShowForm(param);
}
}
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("LQKJ.XiBU.ReportPlugIN")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LQKJ.XiBU.ReportPlugIN")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("23310e5c-c861-47c2-af16-6a6449ebe35f")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
D:\西部培训\WebSite\bin\LQKJ.XiBU.ReportPlugIN.dll
D:\西部培训\WebSite\bin\LQKJ.XiBU.ReportPlugIN.pdb
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.XiBU.ReportPlugIN\obj\Debug\LQKJ.XiBU.ReportPlugIN.csproj.CoreCompileInputs.cache
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.XiBU.ReportPlugIN\obj\Debug\LQKJ.XiBU.ReportPlugIN.csproj.CopyComplete
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.XiBU.ReportPlugIN\obj\Debug\LQKJ.XiBU.ReportPlugIN.dll
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.XiBU.ReportPlugIN\obj\Debug\LQKJ.XiBU.ReportPlugIN.pdb
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.XiBU.ReportPlugIN\obj\Debug\LQKJ.XiBU.ReportPlugIN.csproj.AssemblyReference.cache
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Log;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using Kingdee.BOS.WebApi.Client;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LQKJ.XiBU.ServicePlugIN
{
[HotUpdate, Description("服务插件")]
public class CourseServicePlugIn : AbstractOperationServicePlugIn
{
public string dbid = Kingdee.BOS.KDConfiguration.Current.CommonConfiguration.AppSettings.Settings["Dbid"].Value;
public string username = Kingdee.BOS.KDConfiguration.Current.CommonConfiguration.AppSettings.Settings["username"].Value;
public string password = Kingdee.BOS.KDConfiguration.Current.CommonConfiguration.AppSettings.Settings["password"].Value;
public string url = Kingdee.BOS.KDConfiguration.Current.CommonConfiguration.AppSettings.Settings["url"].Value;
//服务插件
public override void EndOperationTransaction(EndOperationTransactionArgs e)
{
base.EndOperationTransaction(e);
var identity = this.BusinessInfo.GetForm().Id;
List<string> sqlList = new List<string>();
string classId = "";
string uptSql = "";
switch (identity)
{
case "LQKJ_Class"://班级
//保存成功后将班级反写到对应课程中
var entity = e.DataEntitys[0]["PX_CLASSENTRY"] as DynamicObjectCollection;
classId = e.DataEntitys[0]["Id"].ToString();
for (int i = 0; i < entity.Count; i++)
{
var courseId = entity[i]["FCourseId_Id"];//课程Id
uptSql = $"update T_PX_COURSE set FCLASSID={classId} where FCOURSEID={courseId}";
sqlList.Add(uptSql);
DBServiceHelper.ExecuteBatch(this.Context, sqlList);
}
break;
case "LQKJ_ClassDetails"://班级学员通讯录
var count = e.DataEntitys[0]["PX_ADDRESSBOOKENTRY"] as DynamicObjectCollection;
classId = e.DataEntitys[0]["Class_Id"].ToString();
uptSql = $"update T_PX_CLASS set FCONFIRMQTY={count.Count} where FCLASSID={classId}";
sqlList.Add(uptSql);
DBServiceHelper.ExecuteBatch(this.Context, sqlList);
break;
//case "LQKJ_AttendanceRecord"://考勤
//case "LQKJ_Evaluates"://评价
// var Id = e.DataEntitys[0]["Id"].ToString();
// K3CloudApiClient Client = new K3CloudApiClient(url);
// var loginResult = Client.ValidateLogin(dbid, username, password, 2052);
// var resultType = JObject.Parse(loginResult)["LoginResultType"].Value<int>();
// if (resultType == 1)//登录成功
// {
// Client.Submit(identity, "{\"Ids\":" + Id + "}");
// Client.Audit(identity, "{\"Ids\":" + Id + "}");
// }
// break;
}
}
}
}
<?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>{5280D0C0-5AA1-4766-8D2E-BC34DA8245D1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LQKJ.XiBU.ServicePlugIN</RootNamespace>
<AssemblyName>LQKJ.XiBU.ServicePlugIN</AssemblyName>
<TargetFrameworkVersion>v4.7.2</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:\西部培训\WebSite\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:\西部培训\WebSite\bin\Kingdee.BOS.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.App, Version=8.1.620.16, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\西部培训\WebSite\bin\Kingdee.BOS.App.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.App.Core, Version=8.1.620.16, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\西部培训\WebSite\bin\Kingdee.BOS.App.Core.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.Core">
<HintPath>D:\西部培训\WebSite\bin\Kingdee.BOS.Core.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.DataEntity, Version=8.1.620.16, Culture=neutral, PublicKeyToken=null" />
<Reference Include="Kingdee.BOS.ServiceHelper, Version=8.1.620.16, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\西部培训\WebSite\bin\Kingdee.BOS.ServiceHelper.dll</HintPath>
</Reference>
<Reference Include="Kingdee.BOS.WebApi.Client, Version=8.1.620.16, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>D:\西部培训\WebSite\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:\西部培训\WebSite\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.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CourseServicePlugIn.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SubmitAudit.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.XiBU.ServicePlugIN")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LQKJ.XiBU.ServicePlugIN")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("5280d0c0-5aa1-4766-8d2e-bc34da8245d1")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
using Kingdee.BOS.App.Core;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Util;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
namespace LQKJ.XiBU.ServicePlugIN
{
[HotUpdate,Description("保存提交审核")]
public class SubmitAudit: AbstractOperationServicePlugIn
{
public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
{
base.AfterExecuteOperationTransaction(e);
var saveResult = this.OperationResult;
// 筛选出保存成功的单据内码
var successPKs = saveResult.OperateResult.Where(o => o.SuccessStatus == true).Select(x => x.PKValue).Distinct().ToArray();
if (successPKs.Length == 0)
{
// 没有保存成功的结果,直接退出
return;
}
// 提交处理
var submitService = new SubmitService();
var submitResult = submitService.Submit(Context, BusinessInfo, successPKs, FormOperationEnum.Submit.ToString(), Option.Copy());
var isExit = CheckResult(saveResult, submitResult);
saveResult.MergeResult(submitResult);
if (isExit)
{
// 有提交失败的结果,直接退出
return;
}
// 审核处理
// 再次筛选中保存成功并且提交也成功的结果
successPKs = saveResult.OperateResult.Where(o => o.SuccessStatus == true).Select(x => x.PKValue).Distinct().ToArray();
if (successPKs.Length == 0)
{
// 没有提交成功的结果,直接退出
return;
}
var paras = new List<object>() { "1" }; //审核所需参数
var auditPKs = successPKs.Select(x => new KeyValuePair<object, object>(x, "")).ToList();
var statusService = new SetStatusService();
var auditResult = statusService.SetBillStatus(Context, BusinessInfo, auditPKs, paras, FormOperationEnum.Audit.ToString(), Option.Copy());
isExit = CheckResult(saveResult, auditResult);
saveResult.MergeResult(auditResult);
if (isExit)
{
// 有审核失败的结果,直接退出
return;
}
// 操作完成后刷新单据状态数据
var billStatusField = this.BusinessInfo.GetBillStatusField();
var billStatusPropertyName = billStatusField.PropertyName;
var objs = new BusinessDataReader(Context).Load(e.DataEntitys.Select(o => o[0]).ToArray()
, BusinessInfo.GetSubBusinessInfo(new List<string>(new[] { billStatusField.Key })).GetDynamicObjectType());
foreach (var obj in objs)
{
var saveObj = e.DataEntitys.FirstOrDefault(o => o[0].ToString() == obj[0].ToString());
if (saveObj != null)
{
saveObj[billStatusPropertyName] = obj[billStatusPropertyName];
}
}
}
/// <summary>
/// 检查操作结果,判断是否需要退出
/// </summary>
/// <param name="saveResult"></param>
/// <param name="nextResult"></param>
/// <returns></returns>
private bool CheckResult(IOperationResult saveResult, IOperationResult nextResult)
{
if (nextResult == null)
{
saveResult.IsSuccess = false;
return true;
}
if (!nextResult.IsSuccess)
{
// 操作失败
saveResult.IsSuccess = false;
return true;
}
if (nextResult.InteractionContext != null)
{
// 交互异常
saveResult.IsSuccess = false;
return true;
}
var failResults = nextResult.OperateResult.Where(e => e.SuccessStatus == false).ToArray();
if (failResults.Length > 0 || nextResult.ValidationErrors.Count > 0)
{
// 操作异常,校验异常
saveResult.IsSuccess = false;
return true;
}
return false;
}
}
}
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
D:\西部培训\WebSite\bin\LQKJ.XiBU.ServicePlugIN.dll
D:\西部培训\WebSite\bin\LQKJ.XiBU.ServicePlugIN.pdb
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.XiBU.ServicePlugIN\obj\Debug\LQKJ.XiBU.ServicePlugIN.csproj.CoreCompileInputs.cache
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.XiBU.ServicePlugIN\obj\Debug\LQKJ.XiBU.ServicePlugIN.csproj.CopyComplete
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.XiBU.ServicePlugIN\obj\Debug\LQKJ.XiBU.ServicePlugIN.dll
C:\Users\zcb27\Desktop\LQKJ.XiBU.ReportPlugIN\LQKJ.XiBU.ServicePlugIN\obj\Debug\LQKJ.XiBU.ServicePlugIN.pdb
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论