Commit 232c561f by 陶然

init

parents
################################################################################
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
################################################################################
/Src/obj/Debug
/Src/bin/Debug
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Njhg.Third.Semir
{
public static class Configs
{
public const string _defaultUrl = "http://scmtest.semirapp.com";
public const string _pdfUrl = "http://njhg.lims.kivii.org";
public const string _token = "dVRKbW1NMXNtbVlHVmdjYm9CTHl2TmhtRUpSbDNodjI=";
public const string _ownerName = "浙江森马电子商务有限公司";
public const string _ownerKvid = "5A6EC61D-63BE-41AE-AAD9-03DD3FF92095";
public const string RouteGenerateQcResult = "/thirdpartyapi/qc-wts/generate-qc-result";
public const string RouteAcceptWts = "/thirdpartyapi/qc-wts/accept-wts";
public const string RouteGetWtsList = "/thirdpartyapi/qc-wts/get-wts-list";
public const string RouteGetWtsData = "/thirdpartyapi/qc-wts/get-wts-data";
}
}
using Kivii;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Njhg.Third.Semir.Entities
{
[Api(Description = "报告结果推送森马结构")]
public class ReportDetail
{
/// <summary>
/// 报告编号
/// </summary>
[ApiMember(Description = "报告编号")]
public string RPT_NO { get; set; }
/// <summary>
/// PDF地址
/// </summary>
[ApiMember(Description = "PDF地址")]
public string URL { get; set; }
/// <summary>
/// 检验结论(1-合格,2-不合格)
/// </summary>
[ApiMember(Description = "检验结论(1-合格,2-不合格)")]
public int RESULT { get; set; }
/// <summary>
/// 描述
/// </summary>
[ApiMember(Description = "描述")]
public string RPT_DESC { get; set; }
/// <summary>
/// 检验项目
/// </summary>
[ApiMember(Description = "检验项目")]
public List<Detail> ITEMS { get; set; }
}
public class Detail
{
/// <summary>
/// 检测项⽬
/// </summary>
[ApiMember(Description = "检测项⽬")]
public string ITEM_NAME { get; set; }
/// <summary>
/// 检测项⽬描述
/// </summary>
[ApiMember(Description = "检测项⽬描述")]
public string ITEM_DESC { get; set; }
/// <summary>
/// 检测项模板ID
/// </summary>
[ApiMember(Description = "检测项模板ID")]
public string TEMP_ITEM_ID { get; set; }
/// <summary>
/// 成品或料颜⾊
/// </summary>
[ApiMember(Description = "成品或料颜⾊")]
public string F1_DISPLAY { get; set; }
/// <summary>
/// 测试⽅法
/// </summary>
[ApiMember(Description = "测试⽅法")]
public string ITEM_STANDARD { get; set; }
/// <summary>
/// 检测指标,单位
/// </summary>
[ApiMember(Description = "检测指标,单位")]
public string ITEM_SPEC1 { get; set; }
/// <summary>
/// "检测指标,标准值及允差
/// </summary>
[ApiMember(Description = "检测指标, 标准值及允差")]
public string ITEM_SPEC2 { get; set; }
/// <summary>
/// 检测部位
/// </summary>
[ApiMember(Description = "检测部位")]
public string CHECK_PART { get; set; }
/// <summary>
/// 检测部位描述
/// </summary>
[ApiMember(Description = "检测部位描述")]
public string CHECK_PART_DISPLAY { get; set; }
/// <summary>
/// 单项判定(0-不合格,1-合格,4-其他)
/// </summary>
[ApiMember(Description = "单项判定(0-不合格,1-合格,4-其他)")]
public int RESULT { get; set; }
/// <summary>
/// 当RESULT为4时填写
/// </summary>
[ApiMember(Description = "当RESULT为4时填写")]
public string RESULT_TEXT { get; set; }
/// <summary>
/// 检测结果
/// </summary>
[ApiMember(Description = "检测结果")]
public string RESULT_REMARK { get; set; }
}
[Api(Description = "报告结果推送森马结构")]
public class ReportResultInfo
{
/// <summary>
/// 委托书编号
/// </summary>
[ApiMember(Description = "委托书编号")]
public string DOC_NO { get; set; }
/// <summary>
/// 报告编号
/// </summary>
[ApiMember(Description = "报告编号")]
public string EXT_DOC_NO { get; set; }
/// <summary>
/// 检验结论(1-合格,2-不合格)
/// </summary>
[ApiMember(Description = "检验结论(1-合格,2-不合格)")]
public int RESULT { get; set; }
/// <summary>
/// 检验结论
/// </summary>
[ApiMember(Description = "检验结论")]
public string RESULT_TEXT { get; set; }
/// <summary>
/// 检验结论
/// </summary>
[ApiMember(Description = "检测费用")]
public decimal CHECK_FEE { get; set; }
/// <summary>
/// PDF地址
/// </summary>
[ApiMember(Description = "PDF地址")]
public List<UrlPdf> URL_PDF { get; set; }
}
public class UrlPdf
{
/// <summary>
/// 报告编号
/// </summary>
[ApiMember(Description = "报告编号")]
public string RPT_NO { get; set; }
/// <summary>
/// PDF地址
/// </summary>
[ApiMember(Description = "PDF地址")]
public string URL { get; set; }
/// <summary>
/// 检验结论(1-合格,2-不合格)
/// </summary>
[ApiMember(Description = "检验结论(1-合格,2-不合格)")]
public int RESULT { get; set; }
/// <summary>
/// 描述
/// </summary>
[ApiMember(Description = "描述")]
public string RPT_DESC { get; set; }
}
}
using Kivii;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Njhg.Third.Semir.Entities
{
[Api(Description = "森马订单")]
public partial class SemirOrder : SemirOrderBase
{
#region 实体
/// <summary>
/// ID
/// </summary>
[ApiMember(Description = "ID")]
public string ID { get; set; }
/// <summary>
/// 委托书编号
/// </summary>
[ApiMember(Description = "委托书编号")]
public string DOC_NO { get; set; }
/// <summary>
/// 样品描述
/// </summary>
[ApiMember(Description = "样品描述")]
public string MAT_NAME { get; set; }
/// <summary>
/// 款号
/// </summary>
[ApiMember(Description = "款号")]
public string FG_MAT_CODE { get; set; }
/// <summary>
/// 款⾊
/// </summary>
[ApiMember(Description = "款⾊")]
public string FG_COLOR { get; set; }
/// <summary>
/// 码段
/// </summary>
[ApiMember(Description = "码段")]
public string FG_F2_DISPLAY { get; set; }
/// <summary>
/// 料号
/// </summary>
[ApiMember(Description = "料号")]
public string MAT_CODE { get; set; }
/// <summary>
/// 料⾊
/// </summary>
[ApiMember(Description = "料⾊")]
public string COLOR { get; set; }
/// <summary>
/// 版单号
/// </summary>
[ApiMember(Description = "版单号")]
public string MAT_DEV_CODE { get; set; }
/// <summary>
/// 创建时间
/// </summary>
[ApiMember(Description = "创建时间")]
public DateTime CREATED_TIME { get; set; }
/// <summary>
/// 最后修改时间
/// </summary>
[ApiMember(Description = "最后修改时间")]
public DateTime LAST_MODIFIED_TIME { get; set; }
/// <summary>
/// 委托单位名称
/// </summary>
[ApiMember(Description = "委托单位名称")]
public string COMPANY_NAME { get; set; }
/// <summary>
/// 委托单位地址
/// </summary>
[ApiMember(Description = "委托单位地址")]
public string COMPANY_ADDRESS { get; set; }
/// <summary>
/// 委托单位联系人
/// </summary>
[ApiMember(Description = "委托单位联系人")]
public string CONTACT_PERSON { get; set; }
/// <summary>
/// 委托单位联系电话
/// </summary>
[ApiMember(Description = "委托单位联系电话")]
public string CONTACT_PHONE { get; set; }
/// <summary>
/// 委托单位邮箱
/// </summary>
[ApiMember(Description = "委托单位邮箱")]
public string CONTACT_EMAIL { get; set; }
/// <summary>
/// 委托单位业务邮箱
/// </summary>
[ApiMember(Description = "委托单位业务邮箱")]
public string CONTACT_BUSINESS_EMAIL { get; set; }
/// <summary>
/// 申请单位名称
/// </summary>
[ApiMember(Description = "申请单位名称")]
public string APPLY_ORG_NAME { get; set; }
/// <summary>
/// 申请单位地址
/// </summary>
[ApiMember(Description = "申请单位地址")]
public string APPLY_ORG_ADDRESS { get; set; }
/// <summary>
/// 付款单位名称
/// </summary>
[ApiMember(Description = "付款单位名称")]
public string PAYER_ORG_NAME { get; set; }
/// <summary>
/// 付款单位地址
/// </summary>
[ApiMember(Description = "付款单位地址")]
public string PAYER_ORG_ADDRESS { get; set; }
/// <summary>
/// 付款联系⼈
/// </summary>
[ApiMember(Description = "付款联系⼈")]
public string PAYER_CONTACT_PERSON { get; set; }
/// <summary>
/// 付款联系电话
/// </summary>
[ApiMember(Description = "付款联系电话")]
public string PAYER_CONTACT_PHONE { get; set; }
/// <summary>
/// 付款联系邮箱
/// </summary>
[ApiMember(Description = "付款联系邮箱")]
public string PAYER_CONTACT_EMAIL { get; set; }
/// <summary>
/// 品牌商标
/// </summary>
[ApiMember(Description = "品牌商标")]
public string BRAND_DISPLAY { get; set; }
/// <summary>
/// 样品阶段
/// </summary>
[ApiMember(Description = "样品阶段")]
public string SAMPLE_CYCLE { get; set; }
/// <summary>
/// 单量数
/// </summary>
[ApiMember(Description = "单量数")]
public string TOTAL_QTY { get; set; }
/// <summary>
/// 年份
/// </summary>
[ApiMember(Description = "年份")]
public string YEAR { get; set; }
/// <summary>
/// 季度
/// </summary>
[ApiMember(Description = "季度")]
public string SEASONS { get; set; }
/// <summary>
/// 原料成分
/// </summary>
[ApiMember(Description = "原料成分")]
public string KG_COMPONENT { get; set; }
/// <summary>
/// 克重
/// </summary>
[ApiMember(Description = "克重")]
public string WEIGHT { get; set; }
/// <summary>
/// 测试周期
/// </summary>
[ApiMember(Description = "测试周期")]
public string TESTING_CYCLE { get; set; }
/// <summary>
/// 安全技术类别
/// </summary>
[ApiMember(Description = "安全技术类别")]
public string CHECK_LEVEL { get; set; }
/// <summary>
/// 样品等级
/// </summary>
[ApiMember(Description = "样品等级")]
public string SAMPLE_GRADE { get; set; }
/// <summary>
/// 样品类型
/// </summary>
[ApiMember(Description = "样品类型")]
public string THIRDPARTY_TESTING_TESTPART { get; set; }
/// <summary>
/// 检测类型
/// </summary>
[ApiMember(Description = "检测类型")]
public string IS_RECHECK { get; set; }
/// <summary>
/// 原报告号
/// </summary>
[ApiMember(Description = "原报告号")]
public string ORIGINAL_WTS_NO { get; set; }
/// <summary>
/// 状态
/// </summary>
[ApiMember(Description = "状态")]
public string STATUS { get; set; }
/// <summary>
/// 最终⽤途
/// </summary>
[ApiMember(Description = "最终⽤途")]
public string FOR_USE { get; set; }
/// <summary>
/// 备注
/// </summary>
[ApiMember(Description = "备注")]
public string REMARK { get; set; }
/// <summary>
/// 产品标准(多个以逗号拼接)
/// </summary>
[ApiMember(Description = "产品标准(多个以逗号拼接)")]
public string CHECK_STANDARD { get; set; }
/// <summary>
/// 订单明细
/// </summary>
[ApiMember(Description = "订单明细")]
public List<SemirOrderDetail> ITEMS { get; set; }
#endregion
}
[Api(Description = "森马订单明细")]
public class SemirOrderDetail
{
/// <summary>
/// 检测项ID
/// </summary>
[ApiMember(Description = "检测项ID")]
public string RECORD_ID { get; set; }
/// <summary>
/// 委托单ID
/// </summary>
[ApiMember(Description = "委托单ID")]
public string H_ID { get; set; }
/// <summary>
/// 唯⼀ID(检测项模板ID)
/// </summary>
[ApiMember(Description = "唯⼀ID(检测项模板ID)")]
public string TEMP_ITEM_ID { get; set; }
/// <summary>
/// 标准要求
/// </summary>
[ApiMember(Description = "标准要求")]
public string RESULT_REQUIRE { get; set; }
/// <summary>
/// 检测项⽬
/// </summary>
[ApiMember(Description = "检测项⽬")]
public string ITEM_NAME { get; set; }
/// <summary>
///
/// </summary>
[ApiMember(Description = "")]
public string S_CHECK_ITEM_CODE { get; set; }
/// <summary>
/// 检测项标准
/// </summary>
[ApiMember(Description = "检测项标准")]
public string ITEM_STANDARD { get; set; }
/// <summary>
/// 检测项⽬
/// </summary>
[ApiMember(Description = "检测项⽬")]
public string ITEM_DESC { get; set; }
/// <summary>
///
/// </summary>
[ApiMember(Description = "")]
public string ITEM_SPEC1 { get; set; }
/// <summary>
///
/// </summary>
[ApiMember(Description = "")]
public string ITEM_SPEC2 { get; set; }
/// <summary>
///
/// </summary>
[ApiMember(Description = "")]
public string SEQ { get; set; }
}
}
using Kivii;
using Kivii.Lims;
using Kivii.Lims.Entities;
using Kivii.Lims.Extensions;
using Kivii.Linq;
using Kivii.Text;
using Njhg.Third.Semir.Extensions;
using Njhg.Third.Semir.Transforms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Njhg.Third.Semir.Entities
{
public class SemirOrderBase : IEntityIsThirdReportOrder
{
private JsonServiceClient _client = null;
public Report OnInstanceThirdReport(Guid ThirdReportOrderKvid)
{
return null;
//if (ThirdReportOrderKvid == Guid.Empty) return null;
//var conn = KiviiContext.GetOpenedDbConnection<ThirdReportOrder>();
//var third = conn.SingleById<ThirdReportOrder>(ThirdReportOrderKvid);
//if (third == null) return null;
//if (third.ThirdType != typeof(SemirOrder).FullName) return null;
//if (third.Metadata == null) return null;
//var semir = third.Metadata.DicToObject();
//var report = new Report();
//report.BizId = third.SerialNumber;
//report.BizKvid = third.Kvid;
//report.BizType = typeof(ThirdReportOrder).FullName;
//report.ReportId = $"{semir.BRAND_DISPLAY}{DateTime.Now:yyyyMMddHHmmss}";
////contract.OrderID = semir.DOC_NO;
//report.Type = "B";
//report.TypeEx = "W";
//report.TypeName = "委托送样";
//report.Category = "SE";
//report.DemanderName = semir.COMPANY_NAME;
//report.DemanderContactName = semir.CONTACT_PERSON;
//report.DemanderContactNumber = semir.CONTACT_PHONE;
//report.DemanderContactAddress = semir.COMPANY_ADDRESS;
//report.SampleManufacturerName = semir.APPLY_ORG_NAME;
//report.SampleManufacturerContactName = semir.PAYER_CONTACT_PERSON;
//report.SampleManufacturerContactNumber = semir.PAYER_CONTACT_PHONE;
//report.SampleManufacturerAddress = semir.PAYER_ORG_ADDRESS;
//report.SampleName = semir.MAT_NAME;
//report.SampleBrand = semir.BRAND_DISPLAY;
//report.SampleGradeSafety = semir.CHECK_LEVEL;
//report.SampleGrade = semir.SAMPLE_GRADE;
//report.SampleBatchNumber = semir.FG_MAT_CODE;
//var details = new List<string>();
//foreach (var detail in semir.ITEMS)
//{
// details.Add($"{detail.ITEM_NAME}({detail.ITEM_STANDARD})");
//}
//var tasks = string.Join("、", details.ToArray());
//report.Metadata = new Dictionary<string, string>();
//report.Metadata.Add("ERemark", tasks);
//return report;
}
public bool OnRejectThirdReport(Guid ThirdReportOrderKvid)
{
return false;
}
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(SemirOrder).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 reports = conn.SelectByIds<Report>(thirdDetails.ConvertAll(o => o.ReportKvid));
if (reports.IsNullOrEmpty()) return false;
if (reports.Exists(o => o.Status != (int)ReportStatusType.ReportCollected)) return false;
var result_info = new ReportResultInfo();
result_info.DOC_NO = third.SerialNumber;
result_info.URL_PDF = new List<UrlPdf>();
var rpt_detail = new List<ReportDetail>();
//针对多个报告存在不合格的项目 则回传订单整体判定为不合格
var infoJudement = true;
foreach (var report in reports)
{
//if (thirdDetail.ReportKvid == Guid.Empty) continue;
//var report = reports.FirstOrDefault(o => o.Kvid == thirdDetail.ReportKvid);
//if (report == null) continue;
if (report.Status != (int)ReportStatusType.ReportCollected) continue;
var queryReportItems = conn.From<ReportItem>();
queryReportItems.Where(o => o.ReportKvid == report.Kvid);
var allReportItems = conn.Select(queryReportItems);
var primaryAllReportItems = allReportItems.filterReportItem();
primaryAllReportItems.ForEach(o => o.PackageUnit = string.Empty);
var selfItems = allReportItems.Where(o => o.Type == ReportItemType.SampleSelf).ToList();
var partItems = allReportItems.Where(o => o.Type == ReportItemType.SamplePart).ToList();
//合并色号和部位
if (!selfItems.IsNullOrEmpty())
{
foreach (var item in selfItems)
{
var primarys = primaryAllReportItems.Where(o => o.RootKvid == item.RootKvid).ToList();
foreach (var primary in primarys)
{
primary.PackageUnit = string.Empty;
primary.PackageUnit = item.Title;
}
}
}
if (!partItems.IsNullOrEmpty())
{
foreach (var item in partItems)
{
var primarys = primaryAllReportItems.Where(o => o.ParentKvid == item.Kvid).ToList();
foreach (var primary in primarys)
{
primary.TitlePart = string.Empty;
primary.TitlePart = item.Title;
}
}
}
#region result_info
result_info.EXT_DOC_NO = report.ReportId;
result_info.CHECK_FEE += report.Amount + report.AmountTest;
result_info.RESULT = 4;
if (report.TestJudgement == "合格") result_info.RESULT = 1;
if (report.TestJudgement == "不合格")
{
infoJudement = false;
result_info.RESULT = 2;
}
result_info.RESULT_TEXT = report.TestJudgement;
if (!report.TestNeedJudge) result_info.RESULT_TEXT = "此报告无需判定";
var code = report.Kvid.ToString().Substring(0, 4);
var internalCode = $"{code}/{report.ReportId}";
var urlPdf = new UrlPdf();
urlPdf.RPT_NO = report.ReportId;
urlPdf.URL = $"{Configs._pdfUrl}/Lims/Report/{internalCode}";
urlPdf.RESULT = 4;
if (report.TestJudgement == "合格") urlPdf.RESULT = 1;
if (report.TestJudgement == "不合格") urlPdf.RESULT = 2;
urlPdf.RPT_DESC = report.TestJudgement;
if (!report.TestNeedJudge) urlPdf.RPT_DESC = "此报告无需判定";
result_info.URL_PDF.Add(urlPdf);
#endregion
#region rpt_detail
var reportDetail = new ReportDetail();
reportDetail.RPT_NO = report.ReportId;
reportDetail.URL = $"{Configs._pdfUrl}/Lims/Report/{internalCode}";
reportDetail.RESULT = 4;
if (report.TestJudgement == "合格") reportDetail.RESULT = 1;
if (report.TestJudgement == "不合格") reportDetail.RESULT = 2;
reportDetail.RPT_DESC = report.TestJudgement;
if (!report.TestNeedJudge) reportDetail.RPT_DESC = "此报告无需判定";
reportDetail.ITEMS = new List<Detail>();
foreach (var item in primaryAllReportItems)
{
var nodeItems = allReportItems.Where(o => o.ParentKvid == item.Kvid).ToList();
#region 拼接检测要求及检测值
var spec2List = new List<string>();
var resultList = new List<string>();
if (item.Type == ReportItemType.Test)
{
spec2List.Add($"{item.Title}({item.DetectionValueQualified})");
resultList.Add($"{item.Title}({item.TestValue})");
}
else if (!nodeItems.IsNullOrEmpty())
{
foreach (var node in nodeItems)
{
spec2List.Add($"{node.Title}({node.DetectionValueQualified})");
resultList.Add($"{node.Title}({node.TestValue})");
}
}
var spec2 = string.Join(", ", spec2List.ToArray());
var result = string.Join(", ", resultList.ToArray());
#endregion
var detail = new Detail();
detail.ITEM_NAME = item.Title;
detail.ITEM_DESC = item.Title;
detail.TEMP_ITEM_ID = "";
detail.F1_DISPLAY = item.PackageUnit;
detail.ITEM_STANDARD = item.DetectionCodeActual;
detail.ITEM_SPEC1 = "";
detail.ITEM_SPEC2 = spec2;
detail.CHECK_PART = item.TitlePart;
detail.CHECK_PART_DISPLAY = item.TitlePart;
detail.RESULT = 4;
if (item.Judgement == "合格") detail.RESULT = 1;
else if (item.Judgement == "不合格")
{
infoJudement = false;
detail.RESULT = 0;
}
else detail.RESULT_TEXT = "此项无需判定";
detail.RESULT_REMARK = result;
reportDetail.ITEMS.Add(detail);
}
rpt_detail.Add(reportDetail);
#endregion
}
//针对多个报告存在不合格的项目 则回传订单整体判定为不合格
if (!infoJudement)
{
result_info.RESULT = 2;
result_info.RESULT_TEXT = "不合格";
}
if (_client == null) _client = new JsonServiceClient(Configs._defaultUrl);
var info = JsonSerializer.SerializeToString(result_info);
var rpt = JsonSerializer.SerializeToString(rpt_detail);
var body = new Dictionary<string, string>();
body.Add("result_info", info);
body.Add("rpt_detail", rpt);
Console.WriteLine($"result_info:{info}\n");
Console.WriteLine($"rpt_detail:{rpt}\n");
var resp = _client.Post<SemirOrderResponse>($"{Configs.RouteGenerateQcResult}?token={Configs._token}", body);
Console.WriteLine($"Code:{resp.code}\n");
Console.WriteLine($"Message:{resp.message}\n");
Console.WriteLine($"resp_code:{resp.data.resp_code}\n");
Console.WriteLine($"data.message:{resp.data.message}\n");
Console.WriteLine($"data.errors:{resp.data.errors}\n");
Console.WriteLine($"recordsTotal:{resp.data.recordsTotal}\n");
Console.WriteLine($"results:{resp.data.results}\n");
if (resp.code == 200 || resp.code == 404)
{
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.Remark = $"Code:{resp.code} Message:{resp.message}";
conn.Insert(log);
return true;
}
else return false;
}
public object OnPullThirdReport()
{
#region 设置缓存1分钟内不能连续请求
var cache = KiviiContext.GetCacheClient();
var cacheKey = KiviiContext.GetUrnKey("SemirOrderAccept:LockedOneMinute");
var cacheValue = cache.Get<string>(cacheKey);
if (!cacheValue.IsNullOrEmpty())
{
throw new Exception(cacheValue);
}
#endregion
var rtns = new RestfulQueryResponse<ThirdReportOrder>();
if (_client == null) _client = new JsonServiceClient(Configs._defaultUrl);
var conn = KiviiContext.GetOpenedDbConnection<ThirdReportOrder>();
DateTime maxTranslateTime = conn.Scalar<ThirdReportOrder, DateTime>(o => Sql.Max(o.OperateTime), p => p.ThirdType == typeof(SemirOrder).FullName);
//DateTime maxTranslateTime = conn.Scalar<ThirdReportOrder, DateTime>(o => Sql.Max(o.OperateTime));
var response = _client.PullSemirOrder(Configs._token, maxTranslateTime);
cache.Set(cacheKey, "一分钟内不可多次查询!", TimeSpan.FromMinutes(1));
(response.code != 200).ThrowIfTrue(response.message);
rtns.Results = new List<ThirdReportOrder>();
if (response.data == null) return rtns;
if (response.data.results.IsNullOrEmpty()) return rtns;
var results = response.data.results.AcceptThirdContractOrder(Guid.Parse(Configs._ownerKvid), Configs._ownerName, conn);
rtns.Results.AddRange(results);
rtns.Total = rtns.Results.Count;
return rtns;
}
}
}
using Kivii;
using Kivii.Lims.Entities;
using Kivii.Linq;
using Kivii.Text;
using Njhg.Third.Semir.Entities;
using Njhg.Third.Semir.Transforms;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Njhg.Third.Semir.Extensions
{
public static class SemirExtension
{
/// <summary>
/// 拉取森马订单
/// </summary>
/// <param name="baseUrl"></param>
/// <param name="token"></param>
/// <returns></returns>
internal static SemirOrderResponse PullSemirOrder(this JsonServiceClient _client, string token, DateTime? beginTime = null, DateTime? endTime = null, int length = 200)
{
(_client == null).ThrowIfTrue("PullSemirOrder:请传入_client");
(token.IsNullOrEmpty()).ThrowIfTrue("PullSemirOrder:请传入token");
//var client = new JsonServiceClient(baseUrl);
var getWtsListRequest = new SemirOrderGetWtsList();
getWtsListRequest.token = token;
getWtsListRequest.length = length;
if (beginTime != null) getWtsListRequest.begin_time = beginTime.Value;
if (endTime != null) getWtsListRequest.end_time = endTime.Value;
var response = _client.Get(getWtsListRequest);
return response;
}
/// <summary>
/// 创建第三方订单数据
/// </summary>
/// <param name="semirOrders"></param>
/// <param name="conn"></param>
/// <returns></returns>
internal static List<ThirdReportOrder> AcceptThirdContractOrder(this List<SemirOrder> semirOrders, Guid? ownerKvid = null, string ownerName = null, IDbConnection conn = null)
{
(semirOrders.IsNullOrEmpty()).ThrowIfTrue("AcceptThirdContractOrder:请传入semirOrders");
bool useTransaction = conn == null;//是否启用事务,如果外部未传入conn,启用内部事务
if (conn == null)
{
conn = KiviiContext.GetOpenedDbConnection<ThirdReportOrder>();
}
var rtns = new List<ThirdReportOrder>();
//找出最小创建日期的订单
var minCreateTime = semirOrders.Min(o => o.CREATED_TIME);
if (minCreateTime == DateTime.MinValue) minCreateTime = DateTime.Now;
var queryThirdReportOrders = conn.From<ThirdReportOrder>();
queryThirdReportOrders.Where(o => o.OperateTime >= minCreateTime & o.ThirdType == typeof(SemirOrder).FullName);
queryThirdReportOrders.Select(o => o.SerialNumber);
var thirdReportOrders = conn.Column<string>(queryThirdReportOrders);
//IDbTransaction trans = null;//事务,如果外部来了Connection,不生成事务
//if (useTransaction) trans = conn.OpenTransaction();
try
{
foreach (var item in semirOrders)
{
if (thirdReportOrders.Exists(o => o == item.DOC_NO)) continue;
var third = new ThirdReportOrder();
if (ownerKvid != null) third.OwnerKvid = ownerKvid.Value;
if (!ownerName.IsNullOrEmpty()) third.OwnerName = ownerName;
third.SerialNumber = item.DOC_NO;
third.Name = item.MAT_NAME.Length > 100 ? item.MAT_NAME.Substring(0, 99) : item.MAT_NAME;
third.ThirdName = item.BRAND_DISPLAY;
third.ThirdType = typeof(SemirOrder).FullName;
third.IsAccepted = false;
third.IsUploaded = false;
third.OperateTime = item.CREATED_TIME;
third.ManufacturerName = item.APPLY_ORG_NAME;
third.ManufacturerContactName = item.PAYER_CONTACT_PERSON;
third.SampleName = item.MAT_NAME.Length > 100 ? item.MAT_NAME.Substring(0, 99) : item.MAT_NAME;
third.BatchNumber = item.FG_MAT_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 == "ITEMS")
{
var items = item.ITEMS;
if (items.IsNullOrEmpty()) items = new List<SemirOrderDetail>();
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;
}
internal static bool ConfirmAccept(this JsonServiceClient _client, string token, ThirdReportOrder thirdReportOrder)
{
(_client == null).ThrowIfTrue("ConfirmAccept:请传入_client");
(token.IsNullOrEmpty()).ThrowIfTrue("ConfirmAccept:请传入token");
var body = new Dictionary<string, string>();
body.Add("DOC_NO", thirdReportOrder.SerialNumber);
var response = _client.Post<SemirOrderResponse>($"{Configs.RouteAcceptWts}?token={token}", body);
if (response.code != 200) return false;
return true;
}
/// <summary>
/// 自动关联报告,规则:存在不合格的报告不自动关联,只有全合格的才自动关联
/// </summary>
/// <param name="third"></param>
/// <param name="conn"></param>
/// <returns></returns>
internal static void AutoLinkReports(this ThirdReportOrder third, IDbConnection conn = null)
{
third.ThrowIfNull("请传入订单信息!");
(third.Kvid == Guid.Empty).ThrowIfTrue("请传入订单Kvid信息!");
if (conn == null) conn = KiviiContext.GetOpenedDbConnection<Report>();
//third = conn.SingleById<ThirdContractOrder>(third.Kvid);
//third.ThrowIfNull("未找到对应订单信息!");
if (third.IsAccepted) return;
var queryReports = conn.From<Report>();
queryReports.Where(o => o.BizId == third.SerialNumber & o.Status >= (int)ReportStatusType.ReportIssue).OrderBy(o => o.ReportId);
var reports = conn.Select(queryReports);
if (reports.IsNullOrEmpty()) return;
var infoJudement = true;
if (reports.Exists(o => o.TestJudgement == "不合格")) infoJudement = false;
if (!infoJudement)
{
third.ReportIds = "存在不合格报告请手动关联!";
third.AddOnlyProperties(o => o.ReportIds);
conn.UpdateOnly(third);
return;
}
//var trans = conn.OpenTransaction();
try
{
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);
//trans.Commit();
}
catch (Exception ex)
{
//trans.Rollback();
throw ex;
}
}
internal static void LinkReports(List<ThirdReportOrder> thirds = null, JsonServiceClient _client = null, string token = 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(SemirOrder).FullName);
}
if (thirds.IsNullOrEmpty()) return;
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;
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;
}
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);
if (_client != null && token != null) _client.ConfirmAccept(token, third);
}
}
/// <summary>
/// 字典类型转化为对象
/// </summary>
/// <param name="dic"></param>
/// <returns></returns>
public static SemirOrder DicToObject(this Dictionary<string, string> dic)
{
var md = new SemirOrder();
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 "ITEMS":
property.SetValue(md, JsonSerializer.DeserializeFromString<List<SemirOrderDetail>>(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 "ITEMS":
property.SetValue(md, JsonSerializer.DeserializeFromString<List<SemirOrderDetail>>(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;
}
}
}
using Kivii;
using Kivii.Lims;
using Kivii.Lims.Entities;
using Kivii.Linq;
using Njhg.Third.Semir.Entities;
using Njhg.Third.Semir.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Njhg.Third.Semir.Jobs
{
public class PullJob : IJob
{
public string Name => "自动拉取森马订单";
public string Description => "拉取森马订单任务调度JOB";
public IJobContext TaskContext { get; set; }
public bool Execution()
{
#region 设置缓存1分钟内不能连续请求
var cache = KiviiContext.GetCacheClient();
var cacheKey = KiviiContext.GetUrnKey("SemirOrderAccept:LockedOneMinute");
var cacheValue = cache.Get<string>(cacheKey);
if (!cacheValue.IsNullOrEmpty())
{
throw new Exception(cacheValue);
}
#endregion
var baseUrl = TaskContext.Arguments["BaseUrl"];
baseUrl.ThrowIfNullOrEmpty("未配置参数:BaseUrl");
var token = TaskContext.Arguments["Token"];
token.ThrowIfNullOrEmpty("未配置参数:Token");
var length = TaskContext.Arguments.ContainsKey("Length") ? TaskContext.Arguments["Length"].ToInt() : 200;
var ownerKvidstr = TaskContext.Arguments["OwnerKvid"];
DateTime? maxTranslateTime = null;
var time = TaskContext.Arguments.ContainsKey("DateTime") ? TaskContext.Arguments["DateTime"] : "";
var ownerKvid = Guid.Empty;
if (!ownerKvidstr.IsNullOrEmpty()) Guid.TryParse(ownerKvidstr, out ownerKvid);
var ownerName = TaskContext.Arguments["OwnerName"];
if (time != null)
{
if (DateTime.TryParse(time, out var selectTime))
{
maxTranslateTime = selectTime;
}
}
var conn = KiviiContext.GetOpenedDbConnection<ThirdReportOrder>();
if (maxTranslateTime == null) maxTranslateTime = conn.Scalar<ThirdReportOrder, DateTime>(o => Sql.Max(o.OperateTime), p => p.ThirdType == typeof(SemirOrder).FullName);
//DateTime maxTranslateTime = conn.Scalar<ThirdReportOrder, DateTime>(o => Sql.Max(o.OperateTime));
var client = new JsonServiceClient(baseUrl);
try
{
var response = client.PullSemirOrder(token, maxTranslateTime, null, length);
cache.Set(cacheKey, "一分钟内不可多次查询!", TimeSpan.FromMinutes(1));
(response.code != 200).ThrowIfTrue(response.message);
if (response.data == null)
{
TaskContext.Message = "未查询到数据!";
return true;
}
if (response.data.results.IsNullOrEmpty())
{
TaskContext.Message = "未查询到数据!";
return true;
}
var results = response.data.results.AcceptThirdContractOrder(ownerKvid, ownerName, conn);
TaskContext.Message = $"成功插入{results.Count}/{response.data.results.Count}条数据!";
return true;
}
catch (Exception ex)
{
TaskContext.Message = $"{ex.Message}";
return false;
}
finally
{
var thread = KiviiContext.NewThread(() =>
{
//没有关联报告的 自动执行符合条件的关联
SemirExtension.LinkReports(null, client, token);
});
thread.Start();
}
}
public void Dispose()
{
}
}
public class UploadJob : IJob
{
public string Name => "自动上传森马订单";
public string Description => "上传森马订单任务调度JOB";
public IJobContext TaskContext { get; set; }
public bool Execution()
{
var conn = KiviiContext.GetOpenedDbConnection<ThirdReportOrder>();
try
{
//var querySemir = conn.From<ThirdContractOrder>();
//querySemir.Where(o => o.ThirdType == typeof(SemirOrder).FullName & o.IsUploaded == false & o.IsAccepted == true);
//querySemir.Select(o => o.Kvid);
//var semirKvids = conn.Select<Guid>(querySemir);
var semirs = conn.Select<ThirdReportOrder>(o => o.ThirdType == typeof(SemirOrder).FullName & o.IsUploaded == false & o.IsAccepted == true);
if (semirs.IsNullOrEmpty())
{
TaskContext.Message = "暂无数据处理";
return true;
}
var semirKvids = semirs.ConvertAll(o => o.Kvid);
var instance = Activator.CreateInstance(typeof(SemirOrder)) as IEntityIsThirdReportOrder;
var successed = 0;
var skip = 0;
//var result = instance.OnUploadThirdContract(semir.Kvid);
//if (result) successed++;
//else skip++;
//TaskContext.Message = $"待回传订单:{semir.SerialNumber},包含报告:{semir.ReportIds} , 成功回传:{successed}条,跳过{skip}条。";
//return true;
foreach (var kvid in semirKvids)
{
var result = instance.OnUploadThirdReport(kvid);
if (result) successed++;
else skip++;
}
TaskContext.Message = $"合计待回传订单:{semirKvids.Count}条,成功回传:{successed}条,跳过{skip}条。";
return true;
}
catch (Exception ex)
{
TaskContext.Message = $"错误:{ex.Message}";
return false;
}
finally
{
var thread = KiviiContext.NewThread(() =>
{
//没有关联报告的 自动执行符合条件的关联
SemirExtension.LinkReports();
});
thread.Start();
}
}
public void Dispose()
{
}
}
}
<?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>{B99E39BA-FF3E-4C81-9470-AB0D430D348C}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Njhg.Third.Semir</RootNamespace>
<AssemblyName>Njhg.Third.Semir.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.10280, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Kivii.K5\local.K5\packages\Kivii.Common.5.6.2023.10280\lib\net45\Kivii.Common.V4.5.dll</HintPath>
</Reference>
<Reference Include="Kivii.Core.V4.5, Version=5.6.2023.9000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Kivii.K5\local.K5\packages\Kivii.Core.5.6.2023.9000\lib\net45\Kivii.Core.V4.5.dll</HintPath>
</Reference>
<Reference Include="Kivii.Linq.V4.5, Version=5.6.2023.10000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Kivii.K5\local.K5\packages\Kivii.Linq.5.6.2023.10000\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\ReportDetail.cs" />
<Compile Include="Entities\SemirOrder.cs" />
<Compile Include="Entities\SemirOrderBase.cs" />
<Compile Include="Extensions\SemirExtension.cs" />
<Compile Include="Jobs\SemirOrderJob.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Transforms\SemirOrderResponse.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Resources\南京海关森马质检接口描述.docx" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Kivii.K5\Kivii.Biz.Lims.V1.0\Src\Kivii.Biz.Lims.V1.0.csproj">
<Project>{c2a2c9b2-e412-4267-8dad-4c37a3fe33e3}</Project>
<Name>Kivii.Biz.Lims.V1.0</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</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>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Njhg.Third.Semir.V4.5")]
[assembly: AssemblyDescription("森马对接")]
[assembly: AssemblyDefaultAlias("Njhg.Third.Semir")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Njhg.Third.Semir.V4.5")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b99e39ba-ff3e-4c81-9470-ab0d430d348c")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2023.12080")]
[assembly: AssemblyFileVersion("5.4.2023.12080")]
using Kivii;
using Njhg.Third.Semir.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Njhg.Third.Semir.Transforms
{
#region 森马对接订单接口返回数据结构
public class SemirOrderResponse
{
public int code { get; set; }
public string message { get; set; }
public SemirOrderResults data { get; set; }
}
public class SemirOrderResults
{
public int recordsTotal { get; set; }
public string resp_code { get; set; }
public string message { get; set; }
public string errors { get; set; }
public List<SemirOrder> results { get; set; }
}
#endregion
#region 获取订单接口
[Route(Configs.RouteGetWtsList)]
public class SemirOrderGetWtsList : IReturn<SemirOrderResponse>
{
[ApiMember(Description = "客户分配L")]
public string token { get; set; }
[ApiMember(Description = "时间(从)可填")]
public DateTime begin_time { get; set; }
[ApiMember(Description = "时间(到)可填")]
public DateTime end_time { get; set; }
[ApiMember(Description = "返回记录数(可填,默认为10)")]
public int length { get; set; }
[ApiMember(Description = "记录偏移量(可填,默认为0)")]
public int start { get; set; }
}
[Route(Configs.RouteGetWtsData)]
public class SemirOrderGetWtsData : IReturn<SemirOrderResponse>
{
[ApiMember(Description = "客户分配L")]
public string token { get; set; }
[ApiMember(Description = "委托书编号")]
public string doc_no { get; set; }
}
[Route(Configs.RouteAcceptWts)]
public class SemirOrderConfirmAccept : IReturn<SemirOrderResponse>
{
public string token { get; set; }
public string DOC_NO { get; set; }
}
#endregion
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Kivii.Common" version="5.6.2023.10280" targetFramework="net45" />
<package id="Kivii.Core" version="5.6.2023.9000" targetFramework="net45" />
<package id="Kivii.Linq" version="5.6.2023.10000" 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