Commit c2e7b548 by Neo Turing

init

parents
################################################################################
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
################################################################################
/.vs
/Src/bin/Debug
/Src/obj
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Net.WebRequestMethods;
namespace Kivii.OnlineCustomization
{
internal static class Configs
{
public const string _pdfUrl = "http://bjhyfi.lims.kivii.org";
//正式环境
public const string _defaultUrl = "http://jstonline.kivii.org";
public const string _token = "E026CBA4E0B970973490FB39DD1EB627";
public const string _secret = "$2y$13$rIiP4vdNuYua2ksnvJlbhuVhkZaxd2Xwvy/qIQaD9RqQ9h5FOVera";
//public const string _ownerName = "绫致时装(天津)有限公司";
//public const string _ownerKvid = "0A02263D-50C9-43B5-B27A-E732FD6D8BDE";
//public const string RouteCloseWts = "/thirdapi/wtsapi/coord-wts/close-wts";
//public const string RouteUpdateWtsReport = "/thirdapi/wtsapi/coord-wts/update-wts-report";
public const string RouteUpdateWtsResult = "/thirdapi/wtsapi/coord-wts/update-wts-result";
public const string RouteRejectWts = "/thirdapi/wtsapi/coord-wts/reject-wts";
//public const string RouteAcceptWts = "/thirdapi/wtsapi/coord-wts/accept-wts";
public const string RouteGetWtsList = "/thirdapi/wtsapi/coord-wts/get-wts-list";
//public const string RouteGetWtsData = "/thirdapi/wtsapi/coord-wts/get-wts-data";
}
}
using Kivii.DataAnnotations;
using Kivii.Lims;
using Kivii.Lims.Entities;
using Kivii.Linq;
using Kivii.OnlineCustomization.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.OnlineCustomization.Entities
{
public class OnlineOrder : EntityWithMetadata, IEntityIsThirdReportOrder
{
#region field
[ApiMember(Description = "订单号")]
public string OrderId { get; set; }
/// <summary>
/// 购物车内不同商品根据分类进行分组
/// </summary>
[ApiMember(Description = "分类")]
public string Category { get; set; }
[ApiMember(Description = "订单总金额")]
public decimal TotalAmount { get; set; }
[ApiMember(Description = "所属Kvid")]
public Guid OwnerKvid { get; set; }
[ApiMember(Description = "买家单位")]
public string BuyerCompony { get; set; }
[ApiMember(Description = "买家名称")]
public string BuyerName { get; set; }
[ApiMember(Description = "买家手机号")]
public string BuyerMobile { get; set; }
[ApiMember(Description = "省份")]
public string Province { get; set; }
[ApiMember(Description = "城市")]
public string City { get; set; }
[ApiMember(Description = "区县")]
public string District { get; set; }
[ApiMember(Description = "详细地址")]
public string Address { get; set; }
[ApiMember(Description = "备注")]
public string Remark { get; set; }
#region 创建/更新人
[ApiMember(Description = "创建人Kvid")]
public Guid CreatorKvid { get; set; }
[ApiMember(Description = "创建人")]
public string CreatorName { get; set; }
[ApiMember(Description = "更新人Kvid")]
public Guid UpdaterKvid { get; set; }
[ApiMember(Description = "更新人")]
public string UpdaterName { get; set; }
#endregion
[Ignore]
public OrderStatusType StatusType
{
get => (OrderStatusType)Status;
set => Status = (int)value;
}
[Ignore]
public List<OnlineOrderItem> OrderItems { get; set; }
#endregion
#region Interface
public Report OnInstanceThirdReport(Guid ThirdReportOrderKvid)
{
return new Report();
}
public object OnPullThirdReport()
{
var rtns = new RestfulQueryResponse<ThirdReportOrder>();
var client = new JsonHttpClient(Configs._defaultUrl);
var conn = KiviiContext.GetOpenedDbConnection<ThirdReportOrder>();
DateTime maxTranslateTime = conn.Scalar<ThirdReportOrder, DateTime>(o => Sql.Max(o.OperateTime), p => p.ThirdType == typeof(OnlineOrder).FullName);
try
{
var response = client.PullOrders(Configs._token, Configs._secret, maxTranslateTime);
rtns.Results = new List<ThirdReportOrder>();
if (response == null) return rtns;
if (response.Results.IsNullOrEmpty()) return rtns;
var results = response.Results.AcceptThirdContractOrder(null, null, conn);
rtns.Results.AddRange(results);
rtns.Total = rtns.Results.Count;
var thread = KiviiContext.NewThread(() =>
{
//没有关联报告的 自动执行符合条件的关联
OrderExtension.LinkReports();
});
thread.Start();
}
catch (Exception ex)
{
throw ex;
}
return rtns;
}
public bool OnRejectThirdReport(Guid ThirdReportOrderKvid)
{
if (ThirdReportOrderKvid == Guid.Empty) return false;
var conn = KiviiContext.GetOpenedDbConnection<ThirdReportOrder>();
var third = conn.SingleById<ThirdReportOrder>(ThirdReportOrderKvid);
if (third == null) return false;
if (third.ThirdType != typeof(OnlineOrder).FullName) return false;
//订单还未受理的才退回 否则不能退回
if (third.IsAccepted) return false;// third.AutoLinkReports();
if (third.IsUploaded) return false;
var client = new JsonHttpClient(Configs._defaultUrl);
try
{
var resp = client.RejectOrder(third.SerialNumber, Configs._token, Configs._secret);
return true;
}
catch (Exception ex)
{
throw ex;
}
}
public bool OnUploadThirdReport(Guid ThirdReportOrderKvid)
{
if (ThirdReportOrderKvid == Guid.Empty) return false;
var conn = KiviiContext.GetOpenedDbConnection<ThirdReportOrder>();
var third = conn.SingleById<ThirdReportOrder>(ThirdReportOrderKvid);
if (third == null) return false;
if (third.ThirdType != typeof(OnlineOrder).FullName) return false;
//订单还未受理的 则自动去找相关报告进行关联
if (!third.IsAccepted) return false;// third.AutoLinkReports();
if (third.IsUploaded) return true;
var thirdDetails = conn.Select<ThirdReportOrderDetail>(o => o.ThirdOrderKvid == third.Kvid);
if (thirdDetails.IsNullOrEmpty()) return false;
var thirdDetailDis = new List<ThirdReportOrderDetail>();
foreach (var item in thirdDetails)
{
if (!thirdDetailDis.Exists(o => o.ReportKvid == item.ReportKvid)) thirdDetailDis.Add(item);
continue;
}
if (thirdDetailDis.IsNullOrEmpty()) return false;
var reports = conn.SelectByIds<Report>(thirdDetailDis.ConvertAll(o => o.ReportKvid));
if (reports.IsNullOrEmpty()) return false;
if (reports.Exists(o => o.Status <= (int)ReportStatusType.ReportIssue)) return false;
//if (reports.Exists(o => o.Status != (int)ReportStatusType.ReportCollected)) return false;
var client = new JsonHttpClient(Configs._defaultUrl);
var pdfs = new List<string>();
foreach (var thirdDetail in thirdDetailDis)
{
if (thirdDetail.ReportKvid == Guid.Empty) continue;
var report = reports.FirstOrDefault(o => o.Kvid == thirdDetail.ReportKvid);
if (report == null) continue;
if (report.Status <= (int)ReportStatusType.ReportIssue) continue;
#region 报告PDF
var code = report.Kvid.ToString().Substring(0, 4);
var internalCode = $"{code}/{report.ReportId}";
pdfs.Add($"{Configs._pdfUrl}/Lims/Report/{internalCode}");
#endregion
}
try
{
var respResult = client.UploadOrderPdf(Configs._token, Configs._secret, third.SerialNumber, pdfs);
third.IsUploaded = true;
third.AddOnlyProperties(o => o.IsUploaded);
conn.UpdateOnly(third);
var log = new EntityLog<ThirdReportOrder>();
log.OwnerKvid = third.Kvid;
log.BizId = third.SerialNumber;
log.BizKvid = third.Kvid;
log.BizType = third.ThirdType;
log.Title = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
log.Type = "报告数据回传";
log.Summary = $"回传成功";
log.Remark = $"{respResult.Results.Count}";
conn.Insert(log);
return true;
}
catch (Exception ex)
{
var err = ex.GetResponseStatus();
var message = (err == null ? ex.Message : err.Message);
var log = new EntityLog<ThirdReportOrder>();
log.OwnerKvid = third.Kvid;
log.BizId = third.SerialNumber;
log.BizKvid = third.Kvid;
log.BizType = third.ThirdType;
log.Title = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
log.Type = "报告数据回传";
log.Summary = $"回传失败";
log.Remark = $"{message}";
conn.Insert(log);
return false;
}
}
#endregion
}
public class OnlineOrderItem : EntityWithMetadata
{
[ApiMember(Description = "订单Kvid")]
public Guid OrderKvid { get; set; }
[ApiMember(Description = "商品Kvid")]
public Guid GoodsKvid { get; set; }
[ApiMember(Description = "商品分类")]
public string Category { get; set; }
[ApiMember(Description = "商品名称")]
public string GoodsName { get; set; }
[ApiMember(Description = "SKU编码")]
public string SkuCode { get; set; }
[ApiMember(Description = "商品单价")]
public decimal UnitPrice { get; set; }
[ApiMember(Description = "购买数量")]
public int Quantity { get; set; }
[ApiMember(Description = "商品总价")]
public decimal TotalPrice { get; set; }
[ApiMember(Description = "商品规格信息")]
public string Specifications { get; set; }
[ApiMember(Description = "商品图片URL")]
public string ImageUrl { get; set; }
[ApiMember(Description = "备注")]
public string Remark { get; set; }
#region 创建/更新人
[ApiMember(Description = "创建人Kvid")]
public Guid CreatorKvid { get; set; }
[ApiMember(Description = "创建人")]
public string CreatorName { get; set; }
[ApiMember(Description = "更新人Kvid")]
public Guid UpdaterKvid { get; set; }
[ApiMember(Description = "更新人")]
public string UpdaterName { get; set; }
#endregion
}
public enum OrderStatusType
{
/// <summary>
/// 不支持的状态
/// </summary>
Unsupported = 0,
/// <summary>
/// 已创建
/// </summary>
Created = 100,
/// <summary>
/// 已支付
/// </summary>
Paid = 200,
/// <summary>
/// 已发货
/// </summary>
Shipped = 300,
/// <summary>
/// 已完成
/// </summary>
Completed = 400,
/// <summary>
/// 已取消
/// </summary>
Cancelled = 500
}
}
using Kivii.Lims.Entities;
using Kivii.Linq;
using Kivii.OnlineCustomization.Entities;
using Kivii.OnlineCustomization.Requests;
using Kivii.Text;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Net.Sockets;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Kivii.OnlineCustomization.Extensions
{
public static class OrderExtension
{
/// <summary>
/// 拉取订单
/// </summary>
/// <param name="baseUrl"></param>
/// <param name="apptoken"></param>
/// <returns></returns>
public static RestfulQueryResponse<OnlineOrder> PullOrders(this JsonHttpClient _client, string apptoken, string appsecret, DateTime? beginTime = null, DateTime? endTime = null, int length = 200)
{
(_client == null).ThrowIfTrue("PullOrders:请传入_client");
(apptoken.IsNullOrEmpty()).ThrowIfTrue("PullOrders:请传入apptoken");
(appsecret.IsNullOrEmpty()).ThrowIfTrue("PullOrders:请传入appsecret");
//var client = new JsonServiceClient(baseUrl);
//var timeStamp = GetTimeStamp();
//var appSign = $"apptoken={apptoken}&appsecret={appsecret}&timestamp={timeStamp}";
//var signature = GetSign(appSign);
var getWtsListRequest = new OnlineOrderGetWtsList();
getWtsListRequest.Take = length;
//getWtsListRequest.status = 0;
if (beginTime != null && beginTime.Value != DateTime.MinValue) getWtsListRequest.BeginTime = beginTime.Value.ToString("yyyy-MM-dd");
if (endTime != null && endTime.Value != DateTime.MinValue) getWtsListRequest.EndTime = endTime.Value.ToString("yyyy-MM-dd");
var response = _client.Get(getWtsListRequest);
return response;
}
public static RestfulUpdateResponse<OnlineOrder> RejectOrder(this JsonHttpClient _client, string orderNo, string apptoken = null, string appsecret = null)
{
(_client == null).ThrowIfTrue("RejectOrder:请传入_client");
//if (apptoken.IsNullOrEmpty()) apptoken = Configs._token;//.ThrowIfTrue("RejectOrder:请传入apptoken");
//if (appsecret.IsNullOrEmpty()) appsecret = Configs._secret;//.ThrowIfTrue("RejectOrder:请传入appsecret");
(orderNo.IsNullOrEmpty()).ThrowIfTrue("RejectOrder:请传入orderNo");
//var client = new JsonServiceClient(baseUrl);
//var timeStamp = GetTimeStamp();
//var appSign = $"apptoken={apptoken}&appsecret={appsecret}&timestamp={timeStamp}";
//var signature = GetSign(appSign);
//var paramsString = $"?appToken={apptoken}&signature={signature}&timestamp={timeStamp}";
//var getWtsListRequest = new Dictionary<string, string>();
//getWtsListRequest.Add("ORDER_NO", orderNo);
var paramsString = $"?OrderId={orderNo}";
var request = new OnlineOrderReject();
request.OrderId = orderNo;
try
{
var response = _client.Post(request);
return response;
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 回传报告PDF
/// </summary>
/// <param name="_client"></param>
/// <param name="apptoken"></param>
/// <param name="appsecret"></param>
/// <param name="orderNo"></param>
/// <param name="orderPdfs"></param>
/// <returns></returns>
public static RestfulUpdateResponse<OnlineOrder> UploadOrderPdf(this JsonHttpClient _client, string apptoken, string appsecret, string orderNo, List<string> pdfUrls)
{
(_client == null).ThrowIfTrue("UploadOrderPdf:请传入_client");
(apptoken.IsNullOrEmpty()).ThrowIfTrue("UploadOrderPdf:请传入apptoken");
(appsecret.IsNullOrEmpty()).ThrowIfTrue("UploadOrderPdf:请传入appsecret");
orderNo.ThrowIfNullOrEmpty("请传入订单号");
pdfUrls.ThrowIfNullOrEmpty("UploadOrderPdf:请传入回传内容");
//var timeStamp = GetTimeStamp();
//var appSign = $"apptoken={apptoken}&appsecret={appsecret}&timestamp={timeStamp}";
//var signature = GetSign(appSign);
//var jsons = JsonSerializer.SerializeToString(orderPdfs);
//var body = new Dictionary<string, string>();
//body.Add("DATA", jsons);
//body.Add("ORDER_NO", orderNo);
//var paramsString = $"?appToken={apptoken}&signature={signature}&timestamp={timeStamp}";
//Console.WriteLine($"-------PrePost:UploadOrderPdf:{JsonSerializer.SerializeToString(body)}\n");
var request = new OnlineOrderUploadResults();
request.PdfUrls = new List<string>();
request.PdfUrls.AddRange(pdfUrls);
var response = _client.Post(request);
return response;
}
/// <summary>
/// 创建第三方订单数据
/// </summary>
/// <param name="orders"></param>
/// <param name="conn"></param>
/// <returns></returns>
public static List<ThirdReportOrder> AcceptThirdContractOrder(this List<OnlineOrder> orders, Guid? ownerKvid = null, string ownerName = null, IDbConnection conn = null)
{
(orders.IsNullOrEmpty()).ThrowIfTrue("AcceptThirdContractOrder:请传入orders");
bool useTransaction = conn == null;//是否启用事务,如果外部未传入conn,启用内部事务
if (conn == null)
{
conn = KiviiContext.GetOpenedDbConnection<ThirdReportOrder>();
}
var rtns = new List<ThirdReportOrder>();
//找出最小创建日期的订单
var queryThirdReportOrders = conn.From<ThirdReportOrder>();
queryThirdReportOrders.Where(o => o.ThirdType == typeof(OnlineOrder).FullName);
queryThirdReportOrders.Select(o => o.SerialNumber);
var thirdReportOrders = conn.Column<string>(queryThirdReportOrders);
try
{
foreach (var item in orders)
{
if (thirdReportOrders.Exists(o => o == item.OrderId)) continue;
var third = new ThirdReportOrder();
third.SerialNumber = item.OrderId;
third.Name = item.BuyerName;
third.ThirdName = item.BuyerCompony;
third.ThirdType = typeof(OnlineOrder).FullName;
third.IsAccepted = false;
third.IsUploaded = false;
third.OperateTime = DateTime.Now;
third.ManufacturerName = item.BuyerCompony;
third.ManufacturerContactName = item.BuyerName;
//third.SampleName = item.MAT_NAME;
//third.BatchNumber = item.PRD_CODE;
//third.Brand = item.BRAND_DISPLAY;
//thirdReportOrder.Content = JsonSerializer.SerializeToString(item);
third.Metadata = new Dictionary<string, string>();
foreach (var propertyInfo in item.GetType().GetProperties())
{
if (propertyInfo.Name == "Metadata")
{
var items = item.Metadata;
if (items.IsNullOrEmpty()) items = new Dictionary<string, string>();
third.Metadata.Add(propertyInfo.Name, JsonSerializer.SerializeToString(items));
continue;
}
if (propertyInfo.Name == "OrderItems")
{
var items = item.OrderItems;
if (items.IsNullOrEmpty()) items = new List<OnlineOrderItem>();
third.Metadata.Add(propertyInfo.Name, JsonSerializer.SerializeToString(items));
continue;
}
var value = propertyInfo.GetValue(item);
third.Metadata.Add(propertyInfo.Name, value == null ? string.Empty : value.ToString());
}
conn.Insert(third);
//trans?.Commit();
third.RemoveAllOnlyProperties();
rtns.Add(third);
}
}
catch (Exception ex)
{
//trans?.Rollback();
throw ex;
}
return rtns;
}
public static void LinkReports(List<ThirdReportOrder> thirds = null)
{
var conn = KiviiContext.GetOpenedDbConnection<Report>();
if (thirds.IsNullOrEmpty())
{
thirds = conn.Select<ThirdReportOrder>(o => /*o.IsAccepted == false &*/ o.IsOffseted == false & o.IsUploaded == false & o.ThirdType == typeof(OnlineOrder).FullName);
}
if (thirds.IsNullOrEmpty()) return;
var allThirdDetails = conn.Select<ThirdReportOrderDetail>(o => Sql.In(o.ThirdOrderKvid, thirds.ConvertAll(p => p.Kvid)));
var queryReports = conn.From<Report>();
queryReports.Where(o => Sql.In(o.BizId, thirds.ConvertAll(p => p.SerialNumber)) & o.Status >= (int)ReportStatusType.ReportIssue).OrderBy(o => o.ReportId);
var allReports = conn.Select(queryReports);
if (allReports.IsNullOrEmpty()) return;
var client = new JsonHttpClient(Configs._defaultUrl);
foreach (var third in thirds)
{
var reports = allReports.Where(o => o.BizId == third.SerialNumber).ToList();
if (reports.IsNullOrEmpty()) continue;
//if (reports.Exists(o => o.TestJudgement == "不合格"))
//{
// third.ReportIds = "存在不合格报告请手动关联!";
// third.AddOnlyProperties(o => o.ReportIds);
// conn.UpdateOnly(third);
// continue;
//}
if (!allThirdDetails.IsNullOrEmpty())
{
var thirdDetails = allThirdDetails.Where(o => o.ThirdOrderKvid == third.Kvid).ToList();
if (!thirdDetails.IsNullOrEmpty())
{
foreach (var node in thirdDetails)
{
node.Status = -1;
node.AddOnlyProperties(o => o.Status);
conn.UpdateOnly(node);
}
}
}
third.ReportIds = string.Empty;
var reportIds = new List<string>();
foreach (var report in reports)
{
report.BizId = third.SerialNumber;
report.AddOnlyProperties(o => o.BizId);
report.BizKvid = third.Kvid;
report.AddOnlyProperties(o => o.BizKvid);
report.BizType = typeof(ThirdReportOrder).FullName;
report.AddOnlyProperties(o => o.BizType);
conn.UpdateOnly(report);
var thirdDetail = new ThirdReportOrderDetail();
thirdDetail.ThirdOrderKvid = third.Kvid;
thirdDetail.ReportId = report.ReportId;
thirdDetail.ReportKvid = report.Kvid;
thirdDetail.ThirdType = third.ThirdType;
thirdDetail.SerialNumber = third.SerialNumber;
thirdDetail.Name = third.Name;
thirdDetail.ThirdName = third.ThirdName;
thirdDetail.IsUploaded = false;
thirdDetail.OperateTime = DateTime.Now;
thirdDetail.Metadata = new Dictionary<string, string>();
thirdDetail.Metadata = report.Metadata;
foreach (var propertyInfo in report.GetType().GetProperties())
{
if (propertyInfo.Name == "Metadata") continue;
try
{
var value = propertyInfo.GetValue(report);
thirdDetail.Metadata.Add(propertyInfo.Name, value == null ? string.Empty : value.ToString());
}
catch { }
}
conn.Insert(thirdDetail);
reportIds.Add(report.ReportId);
}
if (third.Metadata.IsNullOrEmpty()) third.Metadata = new Dictionary<string, string>();
third.Metadata["Amount"] = reports.Sum(o => o.Amount + o.AmountTest).ToString();
third.AddOnlyProperties(o => o.Metadata);
third.ReportIds = string.Join("、", reportIds);
third.AddOnlyProperties(o => o.ReportIds);
third.IsAccepted = true;
third.AddOnlyProperties(o => o.IsAccepted);
conn.UpdateOnly(third);
}
}
public static string GetTimeStamp()
{
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区
var timeStamp = ((int)(DateTime.Now - startTime).TotalSeconds).ToString(); // 相差秒数
return timeStamp;
//return string.Format("{0:yyyyMMddHHmmss}", DateTime.Now);//$"{DateTime.Now:yyyyMMddHHmmss}";
}
/// <summary>
/// apptoken=12345&appsecret=56789&timestamp=1632127400
/// </summary>
/// <param name="accessKey"></param>
/// <returns></returns>
public static string GetSign(string accessKey)
{
if (accessKey.IsNullOrEmpty()) accessKey = string.Empty;
MD5 md5 = new MD5CryptoServiceProvider();
byte[] targetData = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(accessKey));
StringBuilder sign = new StringBuilder("");
foreach (byte b in targetData)
{
sign.AppendFormat("{0:x2}", b);
}
return sign.ToString().ToUpper();
}
/// <summary>
/// 字典类型转化为对象
/// </summary>
/// <param name="dic"></param>
/// <returns></returns>
public static OnlineOrder DicToObject(this Dictionary<string, string> dic)
{
var md = new OnlineOrder();
CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
TextInfo textInfo = cultureInfo.TextInfo;
foreach (var d in dic)
{
var filed = textInfo.ToTitleCase(d.Key);
try
{
var value = d.Value;
var property = md.GetType().GetProperty(filed);
if (property == null) continue;
if (!property.PropertyType.IsGenericType)
{
switch (property.Name)
{
case "Metadata":
property.SetValue(md, JsonSerializer.DeserializeFromString<Dictionary<string, string>>(value), null);
break;
case "OrderItems":
property.SetValue(md, JsonSerializer.DeserializeFromString<List<OnlineOrderItem>>(value), null);
break;
default:
property.SetValue(md, string.IsNullOrEmpty(value) ? null : Convert.ChangeType(value, property.PropertyType), null);
break;
}
}
else
{
Type genericTypeDefinition = property.PropertyType.GetGenericTypeDefinition();
switch (property.Name)
{
case "Metadata":
property.SetValue(md, JsonSerializer.DeserializeFromString<Dictionary<string, string>>(value), null);
break;
case "OrderItems":
property.SetValue(md, JsonSerializer.DeserializeFromString<List<OnlineOrderItem>>(value), null);
break;
default:
//泛型Nullable<>
if (genericTypeDefinition == typeof(Nullable<>))
{
property.SetValue(md, string.IsNullOrEmpty(value) ? null : Convert.ChangeType(value, Nullable.GetUnderlyingType(property.PropertyType)), null);
}
break;
}
}
}
catch (Exception ex)
{
throw ex;
}
}
return md;
}
}
}
<?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>{7BE6A6FE-C9DE-4842-B8C4-6C0921D33594}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Kivii.OnlineCustomization</RootNamespace>
<AssemblyName>Kivii.Third.OnlineCustomization.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>..\..\Kivii%27s Releases\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Kivii.Common.V4.5, Version=5.6.2024.11000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Kivii.Common.5.6.2024.11000\lib\net45\Kivii.Common.V4.5.dll</HintPath>
</Reference>
<Reference Include="Kivii.Core.V4.5, Version=5.6.2024.11000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Kivii.Core.5.6.2024.11000\lib\net45\Kivii.Core.V4.5.dll</HintPath>
</Reference>
<Reference Include="Kivii.Linq.V4.5, Version=5.6.2024.11000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\Kivii.Linq.5.6.2024.11000\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="Configs.cs" />
<Compile Include="Entities\OnlineOrder.cs" />
<Compile Include="Extensions\OrderExtension.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Requests\OrderRequest.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Kivii.Biz.Lims\Src\Kivii.Biz.Lims.V4.5.csproj">
<Project>{a1971816-ee6f-4558-8923-b1b85779cb7f}</Project>
<Name>Kivii.Biz.Lims.V4.5</Name>
</ProjectReference>
</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
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Kivii.Third.OnlineCustomization.V4.5")]
[assembly: AssemblyDescription("K5网上订单对接LimsV4.5")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Kivii.Third.OnlineCustomization.V4.5")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("7be6a6fe-c9de-4842-b8c4-6c0921d33594")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2025.5260")]
[assembly: AssemblyFileVersion("5.4.2025.5260")]
using Kivii.OnlineCustomization.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Kivii.OnlineCustomization.Requests
{
#region Request
/// <summary>
/// 获取进行中的三方检测单据列表(包含单据基本信息和检测项信息)
/// </summary>
[Route(Configs.RouteGetWtsList)]
public class OnlineOrderGetWtsList : IReturn<RestfulQueryResponse<OnlineOrder>>
{
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; }
public string BeginTime { get; set; }
public string EndTime { get; set; }
}
[Route(Configs.RouteUpdateWtsResult)]
public class OnlineOrderUploadResults : IReturn<RestfulUpdateResponse<OnlineOrder>>
{
public List<string> PdfUrls { get; set; }
}
[Route(Configs.RouteRejectWts)]
public class OnlineOrderReject : IReturn<RestfulUpdateResponse<OnlineOrder>>
{
public string OrderId { get; set; }
}
#endregion
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Kivii.Common" version="5.6.2024.11000" targetFramework="net45" />
<package id="Kivii.Core" version="5.6.2024.11000" targetFramework="net45" />
<package id="Kivii.Linq" version="5.6.2024.11000" 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