Commit a8a0e3fc by 陶然

init

parents
################################################################################
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
################################################################################
/Src/obj
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Samples
{
internal class Configs
{
public const string TableNameSample = "SMPL_Samples";
public const string TableNameLocation = "SMPL_Locations";
public const string TableNameRoute = "SMPL_Routes";
//public const string TableNameSource = "SMPL_Sources";
}
}
using Kivii.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Samples.Entities
{
[Api(Description = "地点配置")]
[Alias(Configs.TableNameLocation)]
public class Location : EntityWithMetadata
{
[InternalSetter]
[DefaultEmptyGuid]
public Guid OwnerKvid { get; set; }
[InternalSetter]
[StringLength(500)]//所属信息,记录当前数据的所属信息,可以是部门可以是组织可以是个人
public string OwnerName { get; set; }
[ApiMember(Description = "地点名称")]
[Required]
[StringLength(200)]
public string Title { get; set; }
[ApiMember(Description = "地点地址")]
[StringLength(500), Default("")]
public string Address { get; set; }
/// <summary>
/// 内部编码,唯一,样品在流转过程中必须传入目标地点的InternalCode
/// </summary>
[ApiMember(Description = "内部编码")]
[StringLength(200), Required]
[Unique()]
public string InternalCode { get; set; }
[ApiMember(Description = "配置类型")]
[StringLength(50), Default("")]
public string Type { get; set; }
[InternalSetter]
[DefaultEmptyGuid]
public Guid ManagerKvid { get; set; }
[InternalSetter]
[StringLength(500)]
public string ManagerName { get; set; }
#region 文本 摘要 备注
[ApiMember(Description = "摘要,最大500字")]
//[IgnoreUpdate]
[StringLength(500), Default("")]
public string Summary { get; set; }
[ApiMember(Description = "备注,最大2000字")]
[StringLength(2000), Default("")]
public string Remark { get; set; }
#endregion
}
}
using Kivii.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Samples.Entities
{
[Api(Description = "样品路由")]
[Alias(Configs.TableNameRoute)]
public class Route: EntityWithMetadata, IEntityHasBiz, IEntityInAssemblyDb, IEntityHasRemark, IEntityHasCreator, IEntityHasUpdater
{
[ApiMember(Description = "样品名称")]
[IgnoreUpdate]
[StringLength(200), Default("")]
public string SampleName { get; set; }
[ApiMember(Description = "样品Kvid")]
[DefaultEmptyGuid]
public Guid SampleKvid { get; set; }
[ApiMember(Description = "主样品Kvid")]
[DefaultEmptyGuid]
public Guid SampleRootKvid { get; set; }
[ApiMember(Description = "父级样品Kvid")]
[DefaultEmptyGuid]
public Guid SampleParentKvid { get; set; }
#region 第三方关联V1.0
[ApiMember(Description = "关联业务,例如:此样品用于具体某一报告,此处记录报告信息")]
[InternalSetter]
[StringLength(200), Default("")]
public string BizId { get; set; }
[ApiMember(Description = "业务Kvid")]
[InternalSetter]
[DefaultEmptyGuid]
public Guid BizKvid { get; set; }
[ApiMember(Description = "业务类型,指实体类型全名称")]
[InternalSetter]
[StringLength(200), Default("")]
public string BizType { get; set; }
#endregion
#region 基本信息
[ApiMember(Description = "样品路由标题")]
[StringLength(200), Required]
public string Title { get; set; }
/// <summary>
/// 送样,快递等
/// </summary>
[ApiMember(Description = "样品路由类型")]
[StringLength(50)]
public string Type { get; set; }
/// <summary>
/// 当前路由地点
/// </summary>
[ApiMember(Description = "当前路由地点")]
[StringLength(200), Required]
public string CurrentLocationTitle { get; set; }
[ApiMember(Description = "当前路由地点Kvid")]
[DefaultEmptyGuid]
public Guid CurrentLocationKvid { get; set; }
/// <summary>
/// 目标地点,目标节点是下一个节点产生后返写的,代表此样品已经从当前节点离开
/// </summary>
[ApiMember(Description = "目标路由地点")]
[StringLength(200)]
public string NextLocationTitle { get; set; }
[ApiMember(Description = "目标路由地点Kvid")]
[DefaultEmptyGuid]
public Guid NextLocationKvid { get; set; }
/// <summary>
/// 操作人
/// </summary>
[ApiMember(Description = "操作人")]
[StringLength(100), Default("")]
public string OperatorName { get; set; }
/// <summary>
/// 操作人Kvid
/// </summary>
[ApiMember(Description = "操作人Kvid")]
public Guid OperatorKvid { get; set; }
/// <summary>
/// 操作日期
/// </summary>
[ApiMember(Description = "操作日期")]
public DateTime OperateTime { get; set; }
/// <summary>
/// 摘要
/// </summary>
[ApiMember(Description = "摘要")]
[StringLength(1000), Default("")]
public string Summary { get; set; }
[ApiMember(Description = "备注")]
[StringLength(1000), Default("")]
public string Remark { get; set; }
[ApiMember(Description = "创建人Kvid ")]
[IgnoreUpdate]
[CurrentMemberKvid]
public Guid CreatorKvid { get; set; }
[ApiMember(Description = "创建人")]
[IgnoreUpdate]
[StringLength(50), CurrentMemberName]
public string CreatorName { get; set; }
[ApiMember(Description = "更新人Kvid ")]
[CurrentMemberKvid]
public Guid UpdaterKvid { get; set; }
[ApiMember(Description = "更新人")]
[StringLength(50), CurrentMemberName]
public string UpdaterName { get; set; }
#endregion
}
}
using Kivii.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Samples.Entities
{
[Api(Description = "样品信息")]
[Alias(Configs.TableNameSample)]
public class Sample: EntityWithMetadata, IEntityInAssemblyDb, IEntityHasRemark, IEntityHasCreator, IEntityHasUpdater
{
#region 第三方关联V1.0
[ApiMember(Description = "关联业务,例如:此样品用于具体某一报告,此处记录报告信息")]
[InternalSetter]
[StringLength(200), Default("")]
public string BizId { get; set; }
[ApiMember(Description = "业务Kvid")]
[InternalSetter]
[DefaultEmptyGuid]
public Guid BizKvid { get; set; }
[ApiMember(Description = "业务类型,指实体类型全名称")]
[InternalSetter]
[StringLength(200), Default("")]
public string BizType { get; set; }
[InternalSetter]
[DefaultEmptyGuid]
public Guid OwnerKvid { get; set; }
[InternalSetter]
[StringLength(500)]//所属信息,记录当前数据的所属信息,可以是部门可以是组织可以是个人
public string OwnerName { get; set; }
#endregion
#region 关联信息
[InternalSetter]
[DefaultEmptyGuid]
public Guid RootKvid { get; set; }
[ApiMember(Description = "父级样品Kvid")]
[DefaultEmptyGuid]
public Guid ParentKvid { get; set; }
[ApiMember(Description = "包裹Kvid,只有在样品打包后会记录当前样品所属的包裹Kvid,包裹也是样品实体,包裹类型")]
[DefaultEmptyGuid]
public Guid PackageKvid { get; set; }
[ApiMember(Description = "来源名称")]
[IgnoreUpdate]
[StringLength(200), Default("")]
public string SourceName { get; set; }
[ApiMember(Description = "来源编号,邮寄则为记录快递号,抽样则为计划编号")]
[IgnoreUpdate]
[StringLength(200), Default("")]
public string SourceNumber { get; set; }
[ApiMember(Description = "来源类型,例如是快递方式则记录,顺丰,中通等")]
[IgnoreUpdate]
[StringLength(200), Default("")]
public string SourceType { get; set; }
#endregion
#region 基本信息
[ApiMember(Description = "样品名称")]
[Required]
[StringLength(200)]
public string Name { get; set; }
[ApiMember(Description = "样品内部编号")]
[StringLength(200), Default("")]
public string InternalCode { get; set; }
[ApiMember(Description = "样品编号")]
[SerialNumber]
[StringLength(100), Default("")]
public string SerialNumber { get; set; }
[ApiMember(Description = "样品批次编号")]
[StringLength(200), Default("")]
public string BatchNumber { get; set; }
[ApiMember(Description = "样品类型,类型:主样,子样,包裹")]
[StringLength(50), Default("")]
public SampleType Type { get; set; }
[ApiMember(Description = "操作日期")]
public DateTime OperateTime { get; set; }
[ApiMember(Description = "样品分类")]
[StringLength(50), Default("")]
public string Category { get; set; }
[ApiMember(Description = "样品品牌")]
[StringLength(200), Default("")]
public string Brand { get; set; }
[ApiMember(Description = "样品规格")]
[StringLength(200), Default("")]
public string Specification { get; set; }
[ApiMember(Description = "样品型号")]
[StringLength(200), Default("")]
public string Model { get; set; }
[ApiMember(Description = "样品材质")]
[StringLength(200), Default("")]
public string Material { get; set; }
[ApiMember(Description = "样品品级")]
[StringLength(200), Default("")]
public string Grade { get; set; }
[ApiMember(Description = "安全类别")]
[StringLength(200), Default("")]
public string GradeSafety { get; set; }
[ApiMember(Description = "样品状况,一般是指收到样品时的状况,是否完好等")]
[StringLength(200), Default("")]
public string Condition { get; set; }
#endregion
#region 数量相关
[ApiMember(Description = "样品数量")]
[DecimalLength(10, 2), Default(0)]
public decimal Quantity { get; set; }
[ApiMember(Description = "数量单位")]
[StringLength(50), Default("")]
public string QuantityUnit { get; set; }
#endregion
#region 生产单位信息及生产日期
[ApiMember(Description = "生产单位")]
[StringLength(100), Default("")]
public string ManufacturerName { get; set; }
[ApiMember(Description = "生产单位Kvid")]
[DefaultEmptyGuid]
[IgnoreUpdate]
public Guid ManufacturerKvid { get; set; }
[ApiMember(Description = "生产单位联系人姓名")]
[StringLength(50), Default("")]
public string ManufacturerContactName { get; set; }
[ApiMember(Description = "生产单位联系人Kvid")]
[DefaultEmptyGuid]
[IgnoreUpdate]
public Guid ManufacturerContactKvid { get; set; }
[ApiMember(Description = "生产单位联系人电话")]
[StringLength(50), Default("")]
//正则表达式验证:(^(\d{3,4}-)?\d{7,8})$|(13[0-9]{9})
public string ManufacturerContactNumber { get; set; }
[ApiMember(Description = "生产单位地址")]
[StringLength(200), Default("")]
public string ManufacturerAddress { get; set; }
[ApiMember(Description = "生产日期")]
public DateTime? ProductionDate { get; set; }
#endregion
#region 文本 备注
[ApiMember(Description = "摘要")]
[StringLength(1000), Default("")]
public string Summary { get; set; }
[ApiMember(Description = "备注")]
[StringLength(1000), Default("")]
public string Remark { get; set; }
#endregion
[Ignore]
public DateTime? AssignTime { get; set; }
#region 创建/更新人V1.0
[ApiMember(Description = "创建人Kvid ")]
[IgnoreUpdate]
[CurrentMemberKvid]
public Guid CreatorKvid { get; set; }
[ApiMember(Description = "创建人")]
[IgnoreUpdate]
[StringLength(50), CurrentMemberName]
public string CreatorName { get; set; }
[ApiMember(Description = "更新人Kvid ")]
[CurrentMemberKvid]
public Guid UpdaterKvid { get; set; }
[ApiMember(Description = "更新人")]
[StringLength(50), CurrentMemberName]
public string UpdaterName { get; set; }
#endregion
}
public enum SampleType
{
Unsupport=0,
/// <summary>
/// 主样
/// </summary>
Master,
/// <summary>
/// 子样
/// </summary>
Node,
/// <summary>
/// 包裹
/// </summary>
Package
}
}
<?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>{93752ABA-829A-470A-A726-78CDEF47B969}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Kivii.Samples</RootNamespace>
<AssemblyName>Kivii.Biz.Samples.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>..\..\..\k5-local\appextend\</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>..\..\Kivii%27s Releases\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Kivii.Common.V4.5, Version=5.6.2023.2150, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\k5-local\packages\Kivii.Common.5.6.2023.2150\lib\net45\Kivii.Common.V4.5.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Kivii.Core.V4.5, Version=5.6.2023.1310, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\k5-local\packages\Kivii.Core.5.6.2023.1310\lib\net45\Kivii.Core.V4.5.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Kivii.Linq.V4.5, Version=5.6.2022.12200, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\k5-local\packages\Kivii.Linq.5.6.2022.12200\lib\net45\Kivii.Linq.V4.5.dll</HintPath>
<Private>False</Private>
</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="Configs.cs" />
<Compile Include="Entities\Sample.cs" />
<Compile Include="Entities\Location.cs" />
<Compile Include="Entities\Route.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SampleExtension.cs" />
<Compile Include="Transforms\RestfulLocation.cs" />
<Compile Include="Transforms\RestfulRoute.cs" />
<Compile Include="Transforms\RestfulSample.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>if "$(ConfigurationName)"=="Release" if exist "$(TargetDir)Reactor\dotNET_Reactor.exe" (call "$(TargetDir)Reactor\dotNET_Reactor.exe" -file "$(TargetPath)" -targetfile "$(TargetDir)Release\$(TargetFileName)" -stringencryption 0 -antitamp 1 -suppressildasm 1)</PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartArguments>-debug</StartArguments>
<StartAction>Program</StartAction>
<StartProgram>D:\git.kivii.org\k5-local\Startup.exe</StartProgram>
</PropertyGroup>
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Kivii.Biz.Samples.V4.5")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
#if DEBUG
[assembly: AssemblyCompany("Kivii.Org")]
#else
[assembly: AssemblyCompany("Kivii.Com")]
#endif
[assembly: AssemblyProduct("Kivii.Biz.Samples.V4.5")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("93752aba-829a-470a-a726-78cdef47b969")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2023.4240")]
[assembly: AssemblyFileVersion("5.4.2023.4240")]
using Kivii.Linq;
using Kivii.Samples.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Samples
{
public static class SampleExtension
{
/// <summary>
/// 主样品创建,传入要创建的样品信息和地点配置信息
/// </summary>
/// <param name="sample"></param>
/// <param name="location"></param>
/// <param name="route"></param>
/// <returns></returns>
public static Sample Accept(this Sample sample, Location location, Route route = null)
{
(sample == null).ThrowIfTrue("缺少要创建的样品实例!");
(sample.Name.IsNullOrEmpty()).ThrowIfTrue("缺少样品名称信息!");
(location == null).ThrowIfTrue("缺少目的地点配置信息!");
var conn = KiviiContext.GetOpenedDbConnection<Sample>();
conn.InitEntityType<Location>();
conn.InitEntityType<Route>();
if (location.Kvid == Guid.Empty)
{
(location.InternalCode.IsNullOrEmpty()).ThrowIfTrue("缺少目的地点配置InternalCode信息");
location = conn.Single<Location>(o => o.InternalCode == location.InternalCode);
(location == null).ThrowIfTrue($"未找到{location.InternalCode}目的地点配置信息!");
}
//var local = conn.Single<Location>(o => o.InternalCode == location.InternalCode);
//(local == null).ThrowIfTrue($"未找到{location.InternalCode}目的地点配置信息!");
#region 数据验证
if (!sample.BizId.IsNullOrEmpty())
{
(conn.Exists<Sample>(o => o.BizId == sample.BizId && o.RootKvid == o.Kvid && o.Name == sample.Name)).ThrowIfTrue("已存在的主样品!");
}
else if (sample.BizKvid != Guid.Empty)
{
(conn.Exists<Sample>(o => o.BizKvid == sample.BizKvid && o.RootKvid == o.Kvid && o.Name == sample.Name)).ThrowIfTrue("已存在的主样品!");
}
#endregion
var trans = conn.OpenTransaction();
try
{
#region 创建样品信息
var sampleKvid = Guid.NewGuid();
if (sample.OwnerKvid == Guid.Empty)
{
sample.OwnerKvid = KiviiContext.CurrentMember.DepartmentKvid;
sample.OwnerName = KiviiContext.CurrentMember.DepartmentName;
}
sample.RootKvid = sampleKvid;
sample.Kvid = sampleKvid;
sample.ParentKvid = Guid.Empty;
sample.PackageKvid = Guid.Empty;
sample.Type = SampleType.Master;
sample.OperateTime = sample.OperateTime == DateTime.MinValue ? DateTime.Now : sample.OperateTime;
conn.Insert(sample);
#endregion
#region 生成样品路由信息
if (route == null) route = new Route();
route.SampleRootKvid = sample.RootKvid;
route.SampleKvid = sample.Kvid;
route.SampleParentKvid = sample.ParentKvid;
route.SampleName = sample.Name;
route.BizId = sample.BizId;
route.BizKvid = sample.BizKvid;
route.BizType = sample.BizType;
route.Title = route.Title.IsNullOrEmpty() ? $"样品[{sample.Name}]录入" : route.Title;
route.Type = route.Type.IsNullOrEmpty() ? sample.SourceType : route.Type;
route.CurrentLocationKvid = location.Kvid;
route.CurrentLocationTitle = location.Title;
route.OperateTime = route.OperateTime == DateTime.MinValue ? DateTime.Now : route.OperateTime;
if (route.OperatorName.IsNullOrEmpty())
{
route.OperatorName = KiviiContext.CurrentMember.FullName;
route.OperatorKvid = KiviiContext.CurrentMember.Kvid;
}
conn.Insert(route);
#endregion
trans.Commit();
}
catch (Exception ex)
{
trans.Rollback();
throw ex;
}
return sample;
}
/// <summary>
/// 样品流转,此方法用于样品从一个地点到另一个地点,只生成route数据以及回写上级route的Next信息
/// </summary>
/// <param name="sample"></param>
/// <param name="location"></param>
/// <param name="route">下一地点的路由信息组织好传入,用于创建</param>
/// <returns></returns>
public static Sample Assign(this Sample sample, Location location, Route route = null)
{
(sample == null).ThrowIfTrue("请传入需要流转的样品信息!");
(location == null).ThrowIfTrue("缺少目的地点配置信息!");
var conn = KiviiContext.GetOpenedDbConnection<Sample>();
conn.InitEntityType<Location>();
if (location.Kvid == Guid.Empty)
{
(location.InternalCode.IsNullOrEmpty()).ThrowIfTrue("缺少目的地点配置InternalCode信息");
location = conn.Single<Location>(o => o.InternalCode == location.InternalCode);
(location == null).ThrowIfTrue($"未找到{location.InternalCode}目的地点配置信息!");
}
var existSample = conn.SingleById<Sample>(sample.Kvid);
existSample.ThrowIfNull("未找到此样品信息!");
//找出当前样品所在路由地点,根据Next为空说明就在此地
var currentRoute = conn.Single<Route>(o => o.SampleKvid == existSample.Kvid && o.NextLocationKvid == Guid.Empty);
var trans = conn.OpenTransaction();
try
{
#region 生成新的路由信息,更新上一个路由信息
if (route == null) route = new Route();
route.SampleRootKvid = existSample.RootKvid;
route.SampleKvid = existSample.Kvid;
route.SampleParentKvid = existSample.ParentKvid;
route.SampleName = existSample.Name;
route.BizId = existSample.BizId;
route.BizKvid = existSample.BizKvid;
route.BizType = existSample.BizType;
route.Title = route.Title.IsNullOrEmpty() ? $"样品[{existSample.Name}]流转" : route.Title;
route.Type = route.Type.IsNullOrEmpty() ? "流转" : route.Type;
route.CurrentLocationKvid = location.Kvid;
route.CurrentLocationTitle = location.Title;
route.OperateTime = route.OperateTime == DateTime.MinValue ? DateTime.Now : route.OperateTime;
existSample.AssignTime = route.OperateTime;
if (route.OperatorName.IsNullOrEmpty())
{
route.OperatorName = KiviiContext.CurrentMember.FullName;
route.OperatorKvid = KiviiContext.CurrentMember.Kvid;
}
conn.Insert(route);
if (currentRoute != null)
{
currentRoute.NextLocationKvid = location.Kvid;
currentRoute.NextLocationTitle = location.Title;
currentRoute.AddOnlyProperties(o => o.NextLocationKvid);
currentRoute.AddOnlyProperties(o => o.NextLocationTitle);
conn.UpdateOnly(currentRoute);
}
#endregion
trans.Commit();
}
catch (Exception ex)
{
trans.Rollback();
throw ex;
}
return existSample;
}
/// <summary>
/// 样品拆分
/// </summary>
/// <param name="sample"></param>
/// <param name="splitSamples"></param>
/// <param name="location"></param>
/// <returns></returns>
public static List<Sample> Split(this Sample sample, List<Sample> splitSamples, Location location)
{
(sample == null).ThrowIfTrue("请传入需要拆分的主样品信息!");
splitSamples.ThrowIfNullOrEmpty("缺少拆分的样品信息");
(location == null).ThrowIfTrue("缺少目的地点配置信息!");
var conn = KiviiContext.GetOpenedDbConnection<Sample>();
conn.InitEntityType<Location>();
if (location.Kvid == Guid.Empty)
{
(location.InternalCode.IsNullOrEmpty()).ThrowIfTrue("缺少目的地点配置InternalCode信息");
location = conn.Single<Location>(o => o.InternalCode == location.InternalCode);
(location == null).ThrowIfTrue($"未找到{location.InternalCode}目的地点配置信息!");
}
var existSample = conn.SingleById<Sample>(sample.Kvid);
existSample.ThrowIfNull("未找到此样品信息!");
var rtns = new List<Sample>();
var trans = conn.OpenTransaction();
try
{
foreach (var item in splitSamples)
{
var sampleKvid = Guid.NewGuid();
if (item.OwnerKvid == Guid.Empty)
{
item.OwnerKvid = KiviiContext.CurrentMember.DepartmentKvid;
item.OwnerName = KiviiContext.CurrentMember.DepartmentName;
}
item.Kvid = sampleKvid;
item.RootKvid = existSample.RootKvid;
item.ParentKvid = existSample.Kvid;
item.PackageKvid = Guid.Empty;
item.Type = SampleType.Node;
item.OperateTime = item.OperateTime == DateTime.MinValue ? DateTime.Now : item.OperateTime;
conn.Insert(item);
rtns.Add(item);
var route = new Route();
route.SampleRootKvid = item.RootKvid;
route.SampleKvid = item.Kvid;
route.SampleParentKvid = item.ParentKvid;
route.SampleName = item.Name;
route.BizId = item.BizId;
route.BizKvid = item.BizKvid;
route.BizType = item.BizType;
route.Title = $"样品[{existSample.Name}]拆分";
route.Type = "拆分";
route.CurrentLocationKvid = location.Kvid;
route.CurrentLocationTitle = location.Title;
route.OperateTime = DateTime.Now;
if (route.OperatorName.IsNullOrEmpty())
{
route.OperatorName = KiviiContext.CurrentMember.FullName;
route.OperatorKvid = KiviiContext.CurrentMember.Kvid;
}
conn.Insert(route);
}
trans.Commit();
}
catch (Exception ex)
{
trans.Rollback();
throw ex;
}
return rtns;
}
/// <summary>
/// 样品打包
/// </summary>
/// <param name="samples"></param>
/// <param name="package">生成的包裹信息</param>
/// <param name="location"></param>
/// <param name="packageRoute"></param>
/// <returns></returns>
public static Sample Packaging(this List<Sample> samples, Sample package, Location location, Route packageRoute = null)
{
samples.ThrowIfNullOrEmpty("请传入要打包的样品信息!");
package.ThrowIfNull("请传入包裹信息!");
(location == null).ThrowIfTrue("缺少目的地点配置信息!");
var conn = KiviiContext.GetOpenedDbConnection<Sample>();
conn.InitEntityType<Location>();
if (location.Kvid == Guid.Empty)
{
(location.InternalCode.IsNullOrEmpty()).ThrowIfTrue("缺少目的地点配置InternalCode信息");
location = conn.Single<Location>(o => o.InternalCode == location.InternalCode);
(location == null).ThrowIfTrue($"未找到{location.InternalCode}目的地点配置信息!");
}
var exists = conn.SelectByIds<Sample>(samples.ConvertAll(p => p.Kvid));
exists.ThrowIfNullOrEmpty("未找到要打包的样品信息!");
exists.Exists(o => o.PackageKvid != Guid.Empty).ThrowIfTrue("存在样品已经打包!");
//var local = conn.Single<Location>(o => o.InternalCode == location.InternalCode);
//(local == null).ThrowIfTrue($"未找到{location.InternalCode}目的地点配置信息!");
var currentRoutes = conn.Select<Route>(o => Sql.In(o.SampleKvid, exists.ConvertAll(p => p.Kvid)) && o.NextLocationKvid == Guid.Empty);
var existPackage = conn.SingleById<Sample>(package.Kvid);
if (existPackage != null) package = existPackage;
var trans = conn.OpenTransaction();
try
{
#region 生成包裹和路由
//要是包裹不存在就要创建一个新的包裹,要是存在就直接用已有的包裹
if (existPackage == null)
{
var packageKvid = Guid.NewGuid();
if (package.OwnerKvid == Guid.Empty)
{
package.OwnerKvid = KiviiContext.CurrentMember.DepartmentKvid;
package.OwnerName = KiviiContext.CurrentMember.DepartmentName;
}
package.RootKvid = packageKvid;
package.Kvid = packageKvid;
package.ParentKvid = Guid.Empty;
package.PackageKvid = Guid.Empty;
package.Type = SampleType.Package;
package.OperateTime = package.OperateTime == DateTime.MinValue ? DateTime.Now : package.OperateTime;
conn.Insert(package);
if (packageRoute == null) packageRoute = new Route();
packageRoute.SampleRootKvid = package.RootKvid;
packageRoute.SampleKvid = package.Kvid;
packageRoute.SampleParentKvid = package.ParentKvid;
packageRoute.SampleName = package.Name;
packageRoute.BizId = package.BizId;
packageRoute.BizKvid = package.BizKvid;
packageRoute.BizType = package.BizType;
packageRoute.Title = packageRoute.Title.IsNullOrEmpty() ? $"样品打包" : packageRoute.Title;
packageRoute.Type = packageRoute.Type.IsNullOrEmpty() ? "打包" : packageRoute.Type;
packageRoute.CurrentLocationKvid = location.Kvid;
packageRoute.CurrentLocationTitle = location.Title;
packageRoute.OperateTime = packageRoute.OperateTime == DateTime.MinValue ? DateTime.Now : packageRoute.OperateTime;
if (packageRoute.OperatorName.IsNullOrEmpty())
{
packageRoute.OperatorName = KiviiContext.CurrentMember.FullName;
packageRoute.OperatorKvid = KiviiContext.CurrentMember.Kvid;
}
conn.Insert(packageRoute);
}
#endregion
foreach (var item in exists)
{
//更新样品的包裹Kvid
item.PackageKvid = package.Kvid;
item.AddOnlyProperties(o => o.PackageKvid);
conn.UpdateOnly(item);
//如果当前样品存在当前路由信息就更新
if (!currentRoutes.IsNullOrEmpty())
{
var currentRoute = currentRoutes.FirstOrDefault(o => o.SampleKvid == item.Kvid);
if (currentRoute != null)
{
currentRoute.NextLocationKvid = location.Kvid;
currentRoute.NextLocationTitle = location.Title;
currentRoute.AddOnlyProperties(o => o.NextLocationKvid);
currentRoute.AddOnlyProperties(o => o.NextLocationTitle);
conn.UpdateOnly(currentRoute);
}
}
//生成新的路由信息
var route = new Route();
route.SampleRootKvid = item.RootKvid;
route.SampleKvid = item.Kvid;
route.SampleParentKvid = item.ParentKvid;
route.SampleName = item.Name;
route.BizId = item.BizId;
route.BizKvid = item.BizKvid;
route.BizType = item.BizType;
route.Title = $"样品[{item.Name}]打包[{package.Name}]";
route.Type = "打包";
route.CurrentLocationKvid = location.Kvid;
route.CurrentLocationTitle = location.Title;
route.OperateTime = DateTime.Now;
if (route.OperatorName.IsNullOrEmpty())
{
route.OperatorName = KiviiContext.CurrentMember.FullName;
route.OperatorKvid = KiviiContext.CurrentMember.Kvid;
}
conn.Insert(route);
}
trans.Commit();
}
catch (Exception ex)
{
trans.Rollback();
throw ex;
}
return package;
}
/// <summary>
/// 包裹拆分
/// </summary>
/// <param name="sample"></param>
/// <param name="location"></param>
/// <param name="route"></param>
/// <returns></returns>
public static Sample UnPackaging(this Sample sample, Location location, Route route = null)
{
sample.ThrowIfNull("请传入要取出的样品信息!");
(location == null).ThrowIfTrue("缺少目的地点配置信息!");
var conn = KiviiContext.GetOpenedDbConnection<Sample>();
conn.InitEntityType<Location>();
if (location.Kvid == Guid.Empty)
{
(location.InternalCode.IsNullOrEmpty()).ThrowIfTrue("缺少目的地点配置InternalCode信息");
location = conn.Single<Location>(o => o.InternalCode == location.InternalCode);
(location == null).ThrowIfTrue($"未找到{location.InternalCode}目的地点配置信息!");
}
var existSample = conn.SingleById<Sample>(sample.Kvid);
existSample.ThrowIfNull("未找到此样品信息!");
(existSample.PackageKvid == Guid.Empty).ThrowIfTrue("样品未打包,无需取出!");
//var package = conn.SingleById<Sample>(existSample.PackageKvid);
//var local = conn.Single<Location>(o => o.InternalCode == location.InternalCode);
//(local == null).ThrowIfTrue($"未找到{location.InternalCode}目的地点配置信息!");
var currentRoute = conn.Single<Route>(o => o.SampleKvid == existSample.Kvid && o.NextLocationKvid == Guid.Empty);
var trans = conn.OpenTransaction();
try
{
existSample.PackageKvid = Guid.Empty;
existSample.AddOnlyProperties(o => o.PackageKvid);
conn.UpdateOnly(existSample);
if (route == null) route = new Route();
route.SampleRootKvid = existSample.RootKvid;
route.SampleKvid = existSample.Kvid;
route.SampleParentKvid = existSample.ParentKvid;
route.SampleName = existSample.Name;
route.BizId = existSample.BizId;
route.BizKvid = existSample.BizKvid;
route.BizType = existSample.BizType;
route.Title = route.Title.IsNullOrEmpty() ? $"包裹拆分出样品[{existSample.Name}]" : route.Title;
route.Type = route.Type.IsNullOrEmpty() ? "包裹拆分" : route.Type;
route.CurrentLocationKvid = location.Kvid;
route.CurrentLocationTitle = location.Title;
route.OperateTime = route.OperateTime == DateTime.MinValue ? DateTime.Now : route.OperateTime;
if (route.OperatorName.IsNullOrEmpty())
{
route.OperatorName = KiviiContext.CurrentMember.FullName;
route.OperatorKvid = KiviiContext.CurrentMember.Kvid;
}
conn.Insert(route);
if (currentRoute != null)
{
currentRoute.NextLocationKvid = location.Kvid;
currentRoute.NextLocationTitle = location.Title;
currentRoute.AddOnlyProperties(o => o.NextLocationKvid);
currentRoute.AddOnlyProperties(o => o.NextLocationTitle);
conn.UpdateOnly(currentRoute);
}
trans.Commit();
}
catch (Exception ex)
{
trans.Rollback();
throw ex;
}
return existSample;
}
/// <summary>
/// 获取当前指定样品所在地
/// </summary>
/// <param name="sample"></param>
/// <returns></returns>
public static Location GetCurrentLocation(this Sample sample)
{
sample.ThrowIfNull("请传入要取出的样品信息!");
var conn = KiviiContext.GetOpenedDbConnection<Sample>();
var queryRoute = conn.From<Route>();
queryRoute.Where(o => o.SampleKvid == sample.Kvid && o.NextLocationKvid == Guid.Empty);
var routes = conn.Select(queryRoute);
routes.ThrowIfNullOrEmpty("未找到指定样品当前所在地点!");
(routes.Count() > 1).ThrowIfTrue("所在地点不唯一!");
var route = routes[0];
var rtns = conn.SingleById<Location>(route.CurrentLocationKvid);
rtns.ThrowIfNull($"未找到所在地({route.CurrentLocationTitle})数据信息!");
return rtns;
}
}
}
using Kivii.Samples.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Samples.Transforms
{
[RequiresAnyRole(SystemRoles.Everyone)]
public class LocationCreate : RestfulCreate<Location>
{
}
[RequiresAnyRole(SystemRoles.Everyone)]
public class LocationUpdate : RestfulUpdate<Location>
{
}
[RequiresAnyRole(SystemRoles.Everyone)]
public class LocationRead : RestfulRead<Location>
{
}
[RequiresAnyRole(SystemRoles.Everyone)]
public class LocationDelete : RestfulDelete<Location>
{
}
[RequiresAnyRole(SystemRoles.Everyone)]
public class LocationQuery : RestfulQuery<Location>
{
}
}
using Kivii.Samples.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Samples.Transforms
{
//[RequiresAnyRole(SystemRoles.Everyone)]
//public class RouteCreate : RestfulCreate<Route>
//{
//}
//[RequiresAnyRole(SystemRoles.Everyone)]
//public class RouteUpdate : RestfulUpdate<Route>
//{
//}
[RequiresAnyRole(SystemRoles.Everyone)]
public class RouteRead : RestfulRead<Route>
{
}
//[RequiresAnyRole(SystemRoles.Everyone)]
//public class RouteDelete : RestfulDelete<Route>
//{
//}
[RequiresAnyRole(SystemRoles.Everyone)]
public class RouteQuery : RestfulQuery<Route>
{
}
}
using Kivii.Linq;
using Kivii.Samples.Entities;
using Kivii.Web;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.Samples.Transforms
{
#region CRUDQ
//[RequiresAnyRole(SystemRoles.Everyone)]
public class SampleQuery : RestfulQuery<Sample>
{
public List<Guid> BizKvids { get; set; }
public override bool OnPreRestfulQuery(IRequest req, IResponse res, IDbConnection dbConnection, IRestfulQueryResponse<Sample> rtns, ref Expression<Func<Sample, bool>> where)
{
if (!BizKvids.IsNullOrEmpty()) where = o => Sql.In(o.BizKvid, BizKvids);
return base.OnPreRestfulQuery(req, res, dbConnection, rtns, ref where);
}
}
[RequiresAnyRole(SystemRoles.Everyone)]
public class SampleCreate : RestfulCreate<Sample>
{
}
[RequiresAnyRole(SystemRoles.Everyone)]
public class SampleUpdate : RestfulUpdate<Sample>
{
}
[RequiresAnyRole(SystemRoles.Everyone)]
public class SampleRead : RestfulRead<Sample>
{
}
[RequiresAnyRole(SystemRoles.Everyone)]
public class SampleDelete : RestfulDelete<Sample>
{
}
//public class SampleAssigningResponse : RestfulUpdateResponse<Sample>
//{
//}
//[RequiresAnyRole(SystemRoles.Everyone)]
//public class SampleAssigning : RestfulExecution<Sample>
//{
// //public List<Guid> SampleKvids { get; set; }
// public List<Sample> Samples { get; set; }
// public StatusType StatusType { get; set; }
// public override object OnExecution(IRequest req, IResponse res)
// {
// Samples.ThrowIfNullOrEmpty("请传入要流转的样品信息!");
// var conn = KiviiContext.GetOpenedDbConnection<Sample>();
// var samples = conn.SelectByIds<Sample>(Samples.ConvertAll(p => p.Kvid));
// samples.ThrowIfNullOrEmpty("未找到要流转的样品信息!");
// var title = string.Empty;
// var type = StatusType.ToString();
// var from = string.Empty;
// var to = string.Empty;
// var operatorName = string.Empty;
// switch (StatusType)
// {
// case StatusType.Created:
// title = "样品创建";
// //type = "创建";
// from = "委托受理";
// to = "样品受理交接";
// operatorName = "业务发展科";
// break;
// case StatusType.CommissionAssign:
// title = "受理交接";
// //type = "交接";
// from = "样品受理交接";
// to = "实验室领取交接";
// operatorName = "业务发展科";
// break;
// case StatusType.TaskAssign:
// title = "领取交接";
// //type = "交接";
// from = "实验室领取交接";
// to = "任务分派";
// operatorName = "开样组";
// break;
// default:
// break;
// }
// var preUpdateSamples = new List<Sample>();
// foreach (var item in samples)
// {
// var sample = Samples.FirstOrDefault(o => o.Kvid == item.Kvid);
// if (sample != null) item.AssignTime = sample.AssignTime;
// if (StatusType == StatusType.CommissionAssign)
// {
// if (item.Status == (int)StatusType.Created) preUpdateSamples.Add(item);
// }
// else if (StatusType == StatusType.TaskAssign)
// {
// if (item.Status == (int)StatusType.CommissionAssign) preUpdateSamples.Add(item);
// }
// else
// {
// preUpdateSamples.Add(item);
// }
// }
// var rtns = new SampleAssigningResponse();
// rtns.Results = new List<Sample>();
// var trans = conn.OpenTransaction();
// try
// {
// var updateLamda = conn.From<Sample>();
// updateLamda = updateLamda.Update(o => o.Status);
// updateLamda = updateLamda.Where(o => Sql.In(o.Kvid, preUpdateSamples.ConvertAll(p => p.Kvid)));
// conn.UpdateOnly(new Sample { Status = (int)StatusType }, updateLamda);
// preUpdateSamples.ForEach(o => o.Status = (int)StatusType);
// rtns.Results.AddRange(preUpdateSamples);
// foreach (var item in preUpdateSamples)
// {
// var assign = new Route();
// assign.SampleKvid = item.Kvid;
// assign.SampleName = item.Name;
// assign.BizId = item.BizId;
// assign.BizKvid = item.BizKvid;
// assign.BizType = item.BizType;
// assign.Title = title;
// assign.Type = type;
// //assign.From = from;
// //assign.To = to;
// //assign.PlanStartTime = DateTime.Now.AddHours(3);
// assign.OperateTime = item.AssignTime != null ? item.AssignTime.Value : DateTime.Now;
// assign.OperatorName = operatorName;
// conn.Insert(assign);
// }
// trans.Commit();
// }
// catch (Exception ex)
// {
// trans.Rollback();
// throw ex;
// }
// return rtns;
// }
//}
#endregion
[RequiresAnyRole(SystemRoles.Everyone)]
[Api(Description ="生成样品")]
public class SampleAccept : RestfulExecution<Sample>
{
public Sample Item { get; set; }//要创建的样品信息
public Location Location { get; set; }//地点位置信息,只需要InternalCode
public Route Route { get; set; }//自定义路由信息,可不填写
public override object OnExecution(IRequest req, IResponse res)
{
(Item == null).ThrowIfTrue("缺少要创建的样品实例!");
(Item.Name.IsNullOrEmpty()).ThrowIfTrue("缺少样品名称信息!");
(Location == null).ThrowIfTrue("缺少目的地点配置信息!");
(Location.InternalCode.IsNullOrEmpty()).ThrowIfTrue("缺少目的地点配置InternalCode信息");
var conn = KiviiContext.GetOpenedDbConnection<Location>();
var local= conn.Single<Location>(o => o.InternalCode == Location.InternalCode);
(local == null).ThrowIfTrue($"未找到{Location.InternalCode}目的地点配置信息!");
var rtns = new RestfulCreateResponse<Sample>();
rtns.Results = new List<Sample>();
var accept = Item.Accept(local, Route);
rtns.Results.Add(accept);
return rtns;
}
}
[RequiresAnyRole(SystemRoles.Everyone)]
[Api(Description = "样品拆分")]
public class SampleSplit:RestfulExecution<Sample>
{
public Guid Kvid { get; set; }//要拆分的样品Kvid
public List<Sample> Samples { get; set; }//拆分出的子样品信息
public Location Location { get; set; }//地点位置信息,只需要InternalCode
public override object OnExecution(IRequest req, IResponse res)
{
(Kvid == Guid.Empty).ThrowIfTrue("缺少要拆分的样品Kvid");
Samples.ThrowIfNullOrEmpty("缺少拆分的样品信息");
(Location == null).ThrowIfTrue("缺少目的地点配置信息!");
(Location.InternalCode.IsNullOrEmpty()).ThrowIfTrue("缺少目的地点配置InternalCode信息");
var conn = KiviiContext.GetOpenedDbConnection<Location>();
var local = conn.Single<Location>(o => o.InternalCode == Location.InternalCode);
(local == null).ThrowIfTrue($"未找到{Location.InternalCode}目的地点配置信息!");
var sample = new Sample();
sample.Kvid = Kvid;
var splited = sample.Split(Samples, local);
var rtns = new RestfulCreateResponse<Sample>();
rtns.Results = new List<Sample>();
rtns.Results.AddRange(splited);
return rtns;
}
}
//[RequiresAnyRole(SystemRoles.Everyone)]
[Api(Description = "样品流转")]
public class SampleAssign : RestfulExecution<Sample>
{
public Guid Kvid { get; set; }//要流转样品信息
public List<Guid> Kvids { get; set; }//要流转样品信息
public Location Location { get; set; }//地点位置信息,只需要InternalCode
public Route Route { get; set; }//自定义路由信息,可不填写
public override object OnExecution(IRequest req, IResponse res)
{
(Kvid == Guid.Empty && Kvids.IsNullOrEmpty()).ThrowIfTrue("缺少要流转的样品信息!");
Location.ThrowIfNull("缺少目的地点信息!");
(Location.InternalCode.IsNullOrEmpty()).ThrowIfTrue("缺少目的地点配置InternalCode信息");
var conn = KiviiContext.GetOpenedDbConnection<Location>();
var local = conn.Single<Location>(o => o.InternalCode == Location.InternalCode);
(local == null).ThrowIfTrue($"未找到{Location.InternalCode}目的地点配置信息!");
if (Kvids.IsNullOrEmpty()) Kvids = new List<Guid>();
if (Kvid != Guid.Empty) Kvids.Add(Kvid);
var rtns = new RestfulUpdateResponse<Sample>();
rtns.Results = new List<Sample>();
foreach (var kvid in Kvids)
{
var sample = new Sample();
sample.Kvid = kvid;
var assign = sample.Assign(local, Route);
rtns.Results.Add(assign);
}
return rtns;
}
}
//[RequiresAnyRole(SystemRoles.Everyone)]
[Api(Description = "所在地样品")]
public class SampleLocationEx : RestfulExecution<Sample>
{
#region QueryArgs
public virtual int? Skip { get; set; }
public virtual int? Take { get; set; }
public virtual string OrderBy { get; set; }
public string OrderByDesc { get; set; }
public virtual string Include { get; set; }
public virtual string Fields { get; set; }
public string QueryKeys { get; set; }
public string QueryValues { get; set; }
#endregion
public Guid LocationKvid { get; set; }
public string LocationInternalCode { get; set; }
public override object OnExecution(IRequest req, IResponse res)
{
(LocationKvid == Guid.Empty && LocationInternalCode.IsNullOrEmpty()).ThrowIfTrue("请传入要查询的地点信息!");
var conn = KiviiContext.GetOpenedDbConnection<Location>();
Location location = null;
if (LocationKvid != Guid.Empty) location = conn.SingleById<Location>(LocationKvid);
if (location == null)
{
if (!LocationInternalCode.IsNullOrEmpty()) location = conn.Single<Location>(o => o.InternalCode == LocationInternalCode);
location.ThrowIfNull("未找到指定的地点信息!");
}
var queryRoutes = conn.From<Route>();
queryRoutes.Where(o => o.CurrentLocationKvid == location.Kvid && o.NextLocationKvid == Guid.Empty);
queryRoutes.Select(o => o.SampleKvid);
var dynamicParams = Request.GetRequestParams();
var autoQuery = Request.TryResolve<IAutoQueryDb>();
autoQuery.IncludeTotal = true;
var request = new RestfulQuery<Sample>();
request = request.PopulateWith(this);
var sqlExpress = autoQuery.CreateQuery(Request, conn, request, dynamicParams);
sqlExpress.Where(o => Sql.In(o.Kvid, queryRoutes));
var rtns = autoQuery.Execute(Request, conn, request, sqlExpress);
//var samples = conn.Select<Sample>(o => Sql.In(o.Kvid, queryRoutes));
//var rtns = new RestfulQueryResponse<Sample>();
//rtns.Results = new List<Sample>();
//rtns.Results.AddRange(samples);
//rtns.Total = rtns.Results.Count;
return rtns;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Kivii.Common" version="5.6.2023.2150" targetFramework="net45" />
<package id="Kivii.Core" version="5.6.2023.1310" targetFramework="net45" />
<package id="Kivii.Linq" version="5.6.2022.12200" 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