baseline: 小军 WMS 二开代码原始快照(含 SynOABusiness.cs Debugger.Break)

This commit is contained in:
Gaussian committed 2026-11-06 18:38:38 +08:00
commit c2b0e7be0d
6522 files changed
+3530643

No files matched your search

@@ -0,0 +1,478 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Sockets;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace GuangFu.StringTracing.Common
{
public class CtripApi
{
#region 获取携程Ticket
public string GetCtripTicket()
{
string path = "https://ct.ctrip.com/SwitchAPI/Order/Ticket";
string result = string.Empty;
var body = @"{
" + "\n" +
@" ""appKey"": ""obk_GXHJ"",
" + "\n" +
@" ""appSecurity"": ""mD2!^w7CCGq)U%c*An*um%^T""
" + "\n" +
@"}";
HttpContent httpContent = new StringContent(body);
//设置Http的内容标头
httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
//设置Http的内容标头的字符
httpContent.Headers.ContentType.CharSet = "utf-8";
using (HttpClient httpClient = new HttpClient())
{
//异步Post
HttpResponseMessage response = httpClient.PostAsync(path, httpContent).Result;
//确保Http响应成功
if (response.IsSuccessStatusCode)
{
//异步读取json
result = response.Content.ReadAsStringAsync().Result;
CtripRoot tokenData = JsonConvert.DeserializeObject<CtripRoot>(result);
return tokenData.Ticket;
}
else
{
return "";
}
}
}
#endregion
#region 获取携程全量国家数据
public string GetXCCountry(string Ticket)
{
string path = "https://ct.ctrip.com/switchAPI/basedata/v2/getcountry";
string result = string.Empty;
HttpContent httpContent = new StringContent("{\r\n \"Auth\": {\r\n \"AppKey\": \"obk_GXHJ\",\r\n \"Ticket\": \""+ Ticket + "\"\r\n },\r\n \"locale\": \"zh-CN\"\r\n}");
//设置Http的内容标头
httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
//设置Http的内容标头的字符
httpContent.Headers.ContentType.CharSet = "utf-8";
using (HttpClient httpClient = new HttpClient())
{
//异步Post
HttpResponseMessage response = httpClient.PostAsync(path, httpContent).Result;
//确保Http响应成功
if (response.IsSuccessStatusCode)
{
//异步读取json
result = response.Content.ReadAsStringAsync().Result;
}
}
return result;
}
#endregion
#region 获取携程国内城市数据
public string GetXCChinaCity(string Ticket)
{
string path = "https://ct.ctrip.com/switchapi/basedata/v2/queryAllPOIInfo";
string result = string.Empty;
HttpContent httpContent = new StringContent("{\r\n \"auth\": {\r\n \"AppKey\": \"obk_GXHJ\",\r\n \"Ticket\": \""+ Ticket + "\"\r\n },\r\n \"provinceConditions\": {\r\n \"prefectureLevelCityConditions\": {\r\n \"returnDistrict\": false\r\n }\r\n },\r\n \"countryId\": 1,\r\n \"poiConditions\": {\r\n \"returnAirport\": false,\r\n \"returnTrainStation\": false,\r\n \"returnBusStation\": false\r\n }\r\n}");
//设置Http的内容标头
httpContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
//设置Http的内容标头的字符
httpContent.Headers.ContentType.CharSet = "utf-8";
using (HttpClient httpClient = new HttpClient())
{
//异步Post
HttpResponseMessage response = httpClient.PostAsync(path, httpContent).Result;
//确保Http响应成功
if (response.IsSuccessStatusCode)
{
//异步读取json
result = response.Content.ReadAsStringAsync().Result;
}
}
return result;
}
#endregion
#region 提前审批接口
public static string PostData(string postString)
{
byte[] postData = Encoding.UTF8.GetBytes(postString);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("https://ct.ctrip.com/switchapi/approval/save"));
request.Method = "POST";
request.ServicePoint.Expect100Continue = false;
request.ContentType = "application/json";
request.ContentLength = postData.Length;
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(postData, 0, postData.Length);
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader stream = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
string srcString = stream.ReadToEnd();
response.Close();
stream.Close();
return srcString;
}
#endregion
#region 预算数据落地
public static string SaveBudget(string postString)
{
byte[] postData = Encoding.UTF8.GetBytes(postString);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("https://corpsz.ctrip.com/PreApproval/saveBudget"));
request.Method = "POST";
request.ServicePoint.Expect100Continue = false;
request.ContentType = "application/json";
request.ContentLength = postData.Length;
using (Stream requestStream = request.GetRequestStream())
{
requestStream.Write(postData, 0, postData.Length);
}
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader stream = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
string srcString = stream.ReadToEnd();
response.Close();
stream.Close();
return srcString;
}
#endregion
#region 预算落地接口加密方法
/// <summary>
/// 预算落地接口加密方法
/// </summary>
/// <param name="approvalNumber">审批单号</param>
/// <param name="appSecurity">加密密钥</param>
/// <param name="budgetInfoList">预算信息列表</param>
/// <returns>加密结果</returns>
public string CreateSign(string approvalNumber, string appSecurity, List<BudgetInfo> budgetInfoList)
{
if (approvalNumber == null || appSecurity == null || budgetInfoList == null || budgetInfoList.Count == 0)
{
throw new ArgumentException("加密参数异常");
}
// 按 Products 排序
budgetInfoList.Sort((o1, o2) => o1.Products.CompareTo(o2.Products));
// 拼接预算字符串
var budgetStr = new StringBuilder();
foreach (var budgetInfo in budgetInfoList)
{
budgetStr.Append(budgetInfo.Products).Append(budgetInfo.BudgetAmount);
}
// 加密
string plainText = approvalNumber + budgetStr + Sha1Hex(appSecurity);
return Sha1Hex(plainText);
}
private static string Sha1Hex(string input)
{
using (var sha1 = SHA1.Create())
{
byte[] bytes = sha1.ComputeHash(Encoding.UTF8.GetBytes(input));
return BitConverter.ToString(bytes).Replace("-", "").ToLower();
}
}
#endregion
}
#region 自定义变量
public class Status
{
/// <summary>
///
/// </summary>
public bool Success { get; set; }
/// <summary>
///
/// </summary>
public int ErrorCode { get; set; }
/// <summary>
/// 调用成功。
/// </summary>
public string Message { get; set; }
}
public class CtripRoot
{
/// <summary>
///
/// </summary>
public Status Status { get; set; }
/// <summary>
///
/// </summary>
public string Ticket { get; set; }
}
/// <summary>
/// 携程接口请求模型
/// </summary>
public class CtripApprovalRequest
{
/// <summary>
/// 申请单号
/// </summary>
public string ApprovalNumber { get; set; }
/// <summary>
/// 状态:固定值1(有效)
/// </summary>
public int Status { get; set; } = 1;
/// <summary>
/// 员工工号
/// </summary>
public string EmployeeID { get; set; }
/// <summary>
/// 过期时间
/// </summary>
public DateTime ExpiredTime { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 鉴权对象
/// </summary>
public CtripAuth Auth { get; set; }
/// <summary>
/// 扩展字段列表
/// </summary>
public List<CtripExtendField> ExtendFieldList { get; set; }
/// <summary>
/// 机票行程明细列表
/// </summary>
public List<FlightEndorsementDetail> FlightEndorsementDetails { get; set; }
/// <summary>
/// 酒店行程明细列表
/// </summary>
public List<HotelEndorsementDetail> HotelEndorsementDetails { get; set; }
}
/// <summary>
/// 机票行程明细
/// </summary>
public class FlightEndorsementDetail
{
/// <summary>
/// 产品类型:固定FLIGHT
/// </summary>
public string ProductType { get; set; } = "FLIGHT";
///// <summary>
///// 行程类型:1-单程,2-往返
///// </summary>
public int FlightWay { get; set; }
///// <summary>
///// 出发开始日期
///// </summary>
//public DateTime DepartDateBegin { get; set; }
///// <summary>
///// 出发结束日期
///// </summary>
//public DateTime DepartDateEnd { get; set; }
///// <summary>
///// 返程开始日期
///// </summary>
//public DateTime? ReturnDateBegin { get; set; }
///// <summary>
///// 返程结束日期
///// </summary>
//public DateTime? ReturnDateEnd { get; set; }
///// <summary>
///// 出发城市编码列表
///// </summary>
//public List<string> DepartCityIds { get; set; }
///// <summary>
///// 到达城市编码列表
///// </summary>
//public List<string> ArrivalCityIds { get; set; }
///// <summary>
///// 舱位等级:3-经济舱
///// </summary>
//public int SeatClass { get; set; } = 3;
/// <summary>
/// 出行人列表
/// </summary>
public List<PassengerInfo> PassengerList { get; set; }
}
/// <summary>
/// 酒店行程明细
/// </summary>
public class HotelEndorsementDetail
{
/// <summary>
/// 产品类型:固定HOTEL
/// </summary>
public string ProductType { get; set; } = "HOTEL";
///// <summary>
///// 入住开始日期
///// </summary>
//public DateTime CheckInDateBegin { get; set; }
///// <summary>
///// 入住结束日期
///// </summary>
//public DateTime CheckInDateEnd { get; set; }
///// <summary>
///// 离店开始日期
///// </summary>
//public DateTime CheckOutDateBegin { get; set; }
///// <summary>
///// 离店结束日期
///// </summary>
//public DateTime CheckOutDateEnd { get; set; }
///// <summary>
///// 入住城市编码列表
///// </summary>
//public List<string> CheckInCityCodes { get; set; }
/// <summary>
/// 出行人列表
/// </summary>
public List<PassengerInfo> PassengerList { get; set; }
}
/// <summary>
/// 出行人信息
/// </summary>
public class PassengerInfo
{
/// <summary>
/// 员工工号
/// </summary>
public string EID { get; set; }
/// <summary>
/// 英文姓名(暂不传)
/// </summary>
public string NameEn { get; set; }
}
/// <summary>
/// 携程鉴权对象
/// </summary>
public class CtripAuth
{
/// <summary>
/// 应用Key
/// </summary>
public string AppKey { get; set; } = "obk_GXHJ";
/// <summary>
/// 动态票据
/// </summary>
public string Ticket { get; set; }
}
/// <summary>
/// 携程扩展字段
/// </summary>
public class CtripExtendField
{
/// <summary>
/// 字段名
/// </summary>
public string FieldName { get; set; }
/// <summary>
/// 字段值
/// </summary>
public string FieldValue { get; set; }
}
public class CtripBudgetRequest
{
/// <summary>
/// 申请单号
/// </summary>
public string ApprovalNumber { get; set; }
/// <summary>
/// 签名
/// </summary>
public string Signature { get; set; }
/// <summary>
/// 鉴权对象
/// </summary>
public CtripAuth Auth { get; set; }
/// <summary>
/// 扩展字段列表
/// </summary>
public List<BudgetInfo> BudgetInfoList { get; set; }
}
public class BudgetInfo
{
public decimal BudgetAmount { get; set; }
public long Products { get; set; } = 12;
}
#endregion
}
@@ -0,0 +1,117 @@
function Get-Checksum($file) {
$cryptoProvider = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider"
$fileInfo = Get-Item $file
trap { ;
continue } $stream = $fileInfo.OpenRead()
if ($? -eq $false) {
# Couldn't open file for reading
return $null
}
$bytes = $cryptoProvider.ComputeHash($stream)
$checksum = ''
foreach ($byte in $bytes) {
$checksum += $byte.ToString('x2')
}
$stream.Close() | Out-Null
return $checksum
}
function AddOrUpdate-Reference($scriptsFolderProjectItem, $fileNamePattern, $newFileName) {
try {
$referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js")
}
catch {
# _references.js file not found
return
}
if ($referencesFileProjectItem -eq $null) {
# _references.js file not found
return
}
$referencesFilePath = $referencesFileProjectItem.FileNames(1)
$referencesTempFilePath = Join-Path $env:TEMP "_references.tmp.js"
if ((Select-String $referencesFilePath -pattern $fileNamePattern).Length -eq 0) {
# File has no existing matching reference line
# Add the full reference line to the beginning of the file
"/// <reference path=""$newFileName"" />" | Add-Content $referencesTempFilePath -Encoding UTF8
Get-Content $referencesFilePath | Add-Content $referencesTempFilePath
}
else {
# Loop through file and replace old file name with new file name
Get-Content $referencesFilePath | ForEach-Object { $_ -replace $fileNamePattern, $newFileName } > $referencesTempFilePath
}
# Copy over the new _references.js file
Copy-Item $referencesTempFilePath $referencesFilePath -Force
Remove-Item $referencesTempFilePath -Force
}
function Remove-Reference($scriptsFolderProjectItem, $fileNamePattern) {
try {
$referencesFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("_references.js")
}
catch {
# _references.js file not found
return
}
if ($referencesFileProjectItem -eq $null) {
return
}
$referencesFilePath = $referencesFileProjectItem.FileNames(1)
$referencesTempFilePath = Join-Path $env:TEMP "_references.tmp.js"
if ((Select-String $referencesFilePath -pattern $fileNamePattern).Length -eq 1) {
# Delete the line referencing the file
Get-Content $referencesFilePath | ForEach-Object { if (-not ($_ -match $fileNamePattern)) { $_ } } > $referencesTempFilePath
# Copy over the new _references.js file
Copy-Item $referencesTempFilePath $referencesFilePath -Force
Remove-Item $referencesTempFilePath -Force
}
}
function Delete-ProjectItem($item) {
$itemDeleted = $false
for ($1=1; $i -le 5; $i++) {
try {
$item.Delete()
$itemDeleted = $true
break
}
catch {
# Try again in 200ms
[System.Threading.Thread]::Sleep(200)
}
}
if ($itemDeleted -eq $false) {
throw "Unable to delete project item after five attempts."
}
}
# Extract the version number from the jquery file in the package's content\scripts folder
$packageScriptsFolder = Join-Path $installPath Content\Scripts
$jqueryFileName = Join-Path $packageScriptsFolder "jquery-*.js" | Get-ChildItem -Exclude "*.min.js","*-vsdoc.js" | Split-Path -Leaf
$jqueryFileNameRegEx = "jquery-((?:\d+\.)?(?:\d+\.)?(?:\d+\.)?(?:\d+)).js"
$jqueryFileName -match $jqueryFileNameRegEx
$ver = $matches[1]
$intelliSenseFileName = "jquery-$ver.intellisense.js"
# Get the project item for the scripts folder
try {
$scriptsFolderProjectItem = $project.ProjectItems.Item("Scripts")
$projectScriptsFolderPath = $scriptsFolderProjectItem.FileNames(1)
}
catch {
# No Scripts folder
Write-Host "No scripts folder found"
}