Commit 32ecaa64 by 陶然

init

parents
################################################################################
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
################################################################################
/Src/bin/Debug
/Src/obj/Debug
using Kivii.Auth;
using Kivii.Finances.Entities;
using Kivii.Finances.Seeyon.Entities;
using Kivii.Seeyon.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Finances.Seeyon.Extensions
{
internal static class ApplyExtension
{
public static ResponseToken RequestRestToken(this JsonServiceClient client, string loginName)
{
if (client == null) throw new ArgumentNullException("client");
if (loginName.IsNullOrEmpty()) throw new ArgumentNullException("loginName");
var request = new RequestRestToken();
request.userName = Configs.restUserName;
request.password = Configs.restPassword;
request.loginName = loginName;
var rtns = client.Post<ResponseToken>($"{Configs.RouteRestToken}", request);
return rtns;
}
public static Form_InvoiceApply ConvertToForm(this InvoiceApply apply)
{
var rtns = new Form_InvoiceApply();
var settlementType = "code|MonthlySettlement";//默认月结
rtns.业务类型 = typeof(BillApply).FullName;
rtns.业务编号 = apply.Kvid.ToString();
rtns.申请人 = KiviiContext.CurrentMember.FullName;
rtns.申请科室 = KiviiContext.CurrentMember.DepartmentName;
rtns.申请日期 = DateTime.Now.ToString("yyyy-MM-dd");
rtns.企业名称 = apply.PayerName;
rtns.地址 = apply.PayerCompanyAddress;
rtns.联系人 = apply.PayerRegisteredBank;
rtns.联系电话 = apply.PayerPhone;
rtns.收费 = apply.Amount.ToString();
rtns.结算方式 = settlementType;
rtns.开始日期 = DateTime.Now.ToString("yyyy-MM-dd");
rtns.结束日期 = DateTime.Now.AddDays(10).ToString("yyyy-MM-dd"); ;
rtns.合同负责人 = apply.OperatorName;
rtns.附加备注 = apply.Remark;
rtns.是否定制价 = "2";
rtns.说明 = apply.Remark;
return rtns;
}
public static ResponseForm<ResponseData> RequestBillForm(this JsonServiceClient client, Form_InvoiceApply form, IAuthSession session)
{
if (client == null) throw new ArgumentNullException("client");
if (form == null) throw new ArgumentNullException("form");
var token = client.RequestRestToken(session.UserAuthName);
var request = new RequestForm<RequestForm_InvoiceApply>();
request.appName = Configs.appName;//"collaboration";
request.data = new RequestData<RequestForm_InvoiceApply>();
request.data.templateCode = Configs.templateCode;//"JYHTSQ";
request.data.draft = "1";
request.data.senderLoginName = token.bindingUser.loginName;
request.data.subject = $"检验合同申请({token.bindingUser.name} {DateTime.Now:yyyy-MM-dd HH:mm})";
request.data.data = new RequestForm_InvoiceApply();
request.data.data.formmain_0061 = new Form_InvoiceApply();
request.data.data.formmain_0061 = form;
var rtns = client.Post<ResponseForm<ResponseData>>($"{Configs.RouteRequestForm}?token={token.id}", request);
return rtns;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Finances.Seeyon
{
internal static class Configs
{
internal static string BaseUrl = "";//"http://zyoa.jst-gov.com";
public const string TableNameApply = "FINA_Applies";
internal static string RouteRequestForm = "";//"/seeyon/rest/bpm/process/start";
internal static string RouteRestToken = "";//"/seeyon/rest/token";
internal static string appName = "";//"collaboration";//"collaboration";//OA提供
internal static string templateCode = "";//"JYHTSQ";//"JYHTSQ";//OA提供
internal static string restUserName = "";//"rest";
internal static string restPassword = "";//"fba09671-2b1e-4c8c-9aaf-de16821070df";
}
}
using Kivii.DataAnnotations;
using Kivii.Finances.Entities;
using Kivii.Finances.Seeyon.Extensions;
using Kivii.Linq;
using Kivii.Seeyon;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Finances.Seeyon.Entities
{
[Api(Description = "账单申请")]
[Alias(Configs.TableNameApply)]
internal class BillApply : InvoiceApply, IEntityIsSeeyonApply
{
public object OnGetApplyResult(Guid Kvid, object Result, string Message)
{
if (Kvid == Guid.Empty) throw new Exception("缺少业务编号!");
if (Result == null) throw new Exception("缺少审批结果信息");
var conn = KiviiContext.GetOpenedDbConnection<InvoiceApply>();
var rtns = new RestfulExecutionResponse<InvoiceApply>();
rtns.Results = new List<InvoiceApply>();
var apply = conn.SingleById<InvoiceApply>(Kvid);
if (apply == null) throw new Exception("未找到此业务信息!");
var result = Result.ToString();
if (apply.Metadata.IsNullOrEmpty()) apply.Metadata = new Dictionary<string, string>();
EntityLog<InvoiceApply> log = null;
if (result == "审批通过")
{
apply.Metadata["SeeyonResult"] = result;
apply.AddOnlyProperties(o => o.Metadata);
if (apply.Status == (int)InvoiceApplyStatus.ProcessAdoption)
{
apply.Status = (int)InvoiceApplyStatus.FinancialApproval;
apply.AddOnlyProperties(o => o.Status);
log = new EntityLog<InvoiceApply>();
log.OwnerKvid = apply.Kvid;
log.Title = "账单借票";
log.Type = "流转";
log.Summary = "OA审批通过,可进行开票";
log.Remark = Message;
log.CreatorName = "OA审批";
}
}
else if (result == "审批不通过")
{
apply.Metadata["SeeyonResult"] = result;
apply.Metadata["SeeyonMessage"] = Message;
apply.AddOnlyProperties(o => o.Metadata);
if (apply.Status == (int)InvoiceApplyStatus.ProcessAdoption)
{
apply.Status = (int)InvoiceApplyStatus.ApplyReject;
apply.AddOnlyProperties(o => o.Status);
log = new EntityLog<InvoiceApply>();
log.OwnerKvid = apply.Kvid;
log.Title = "账单借票";
log.Type = "流转";
log.Summary = "OA审批不通过,驳回了账单借票审批";
log.Remark = Message;
log.CreatorName = "OA审批";
}
}
if (log != null) conn.Insert(log);
if (!apply.OnlyProperties.IsNullOrEmpty())
{
conn.UpdateOnly(apply);
rtns.Results.Add(apply);
}
return rtns;
}
public object OnSubmitApplyForm<T>(Guid Kvid)
{
Kvid.ThrowIfEmpty("请传入要申请的账单借票信息!");
var conn = KiviiContext.GetOpenedDbConnection<InvoiceApply>();
InvoiceApply apply = conn.SingleById<InvoiceApply>(Kvid);
apply.ThrowIfNull("未找到此业务信息!");
if (apply.Status > (int)InvoiceApplyStatus.ProcessAdoption) throw new Exception("当前账单借票非待审批状态,无法申请审批!");
var applyForm = apply.ConvertToForm();
var session = KiviiContext.Request.GetSession();
var client = new JsonServiceClient(Configs.BaseUrl);
var resp = client.RequestBillForm(applyForm, session);
if (resp.code != "0") throw new Exception($"OA接口调用失败,原因:{resp.message}");
apply.BizId = resp.data.subject;
apply.AddOnlyProperties(o => o.BizId);
apply.BizType = typeof(BillApply).FullName;
apply.AddOnlyProperties(o => o.BizType);
apply.Status = (int)InvoiceApplyStatus.ProcessAdoption;
apply.AddOnlyProperties(o => o.Status);
conn.UpdateOnly(apply);
var _log = new EntityLog<InvoiceApply>();
_log.OwnerKvid = apply.Kvid;
_log.Title = "账单借票";
_log.Type = "流转";
_log.Summary = $"提交了账单借票,审批将在OA执行";
conn.Insert(_log);
var rtns = new RestfulUpdateResponse<InvoiceApply>();
rtns.Results = new List<InvoiceApply>();
rtns.Results.Add(apply);
return rtns;
}
}
public class RequestForm_InvoiceApply
{
public Form_InvoiceApply formmain_0061 { get; set; }
}
public class Form_InvoiceApply
{
/// <summary>
/// 唯一编号,BizKvid
/// </summary>
public string 业务编号 { get; set; }
/// <summary>
/// 业务类型,BizType
/// </summary>
public string 业务类型 { get; set; }
/// <summary>
/// 人员登陆名
/// </summary>
public string 申请人 { get; set; }
/// <summary>
/// 部门编码
/// </summary>
public string 申请科室 { get; set; }
public string 申请日期 { get; set; }
public string 企业名称 { get; set; }
public string 地址 { get; set; }
public string 联系人 { get; set; }
public string 联系电话 { get; set; }
/// <summary>
/// 折扣
/// </summary>
public string 收费 { get; set; }
/// <summary>
/// 形如code|xxx,MonthlySettlement月结,BatchSettlement批结,QuarterlySettlement季结
/// </summary>
public string 结算方式 { get; set; }
public string 开始日期 { get; set; }
public string 结束日期 { get; set; }
public string 合同负责人 { get; set; }
public string 附加备注 { get; set; }
/// <summary>
/// 0是 1否 2其他
/// </summary>
public string 是否定制价 { get; set; }
public string 说明 { get; set; }
}
}
<?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>{75F26551-119F-4EEF-A557-3CEEEDD13703}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Kivii.Finances.Seeyon</RootNamespace>
<AssemblyName>Kivii.Third.Finances.Seeyon.V4.5</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</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="Kivii.Common.V4.5, Version=5.6.2023.6000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\NJZJ\local-njzj\packages\Kivii.Common.5.6.2023.6000\lib\net45\Kivii.Common.V4.5.dll</HintPath>
</Reference>
<Reference Include="Kivii.Core.V4.5, Version=5.6.2023.6000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\NJZJ\local-njzj\packages\Kivii.Core.5.6.2023.6000\lib\net45\Kivii.Core.V4.5.dll</HintPath>
</Reference>
<Reference Include="Kivii.Linq.V4.5, Version=5.6.2023.4200, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\NJZJ\local-njzj\packages\Kivii.Linq.5.6.2023.4200\lib\net45\Kivii.Linq.V4.5.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="ApplyExtension.cs" />
<Compile Include="Configs.cs" />
<Compile Include="Entities\BillApply.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Kivii.Biz.Finances.V2.0\Src\Kivii.Biz.Finances.V2.0.csproj">
<Project>{8d9479e9-5c4f-4d96-8bc1-c771be0d91b1}</Project>
<Name>Kivii.Biz.Finances.V2.0</Name>
</ProjectReference>
<ProjectReference Include="..\Kivii.Seeyon.Addons\Src\Kivii.Seeyon.Addons.V4.5.csproj">
<Project>{4304bea2-2f6c-41e6-976b-3b2bc63d3fe3}</Project>
<Name>Kivii.Seeyon.Addons.V4.5</Name>
</ProjectReference>
</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("Kivii.Third.Finances.Seeyon.V4.5")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Kivii.Third.Finances.Seeyon.V4.5")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75f26551-119f-4eef-a557-3ceeedd13703")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Kivii.Common" version="5.6.2023.6000" targetFramework="net45" />
<package id="Kivii.Core" version="5.6.2023.6000" targetFramework="net45" />
<package id="Kivii.Linq" version="5.6.2023.4200" targetFramework="net45" />
</packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment