From e808058b608f6cfe6a8c7cb11cebae66bf7c69b6 Mon Sep 17 00:00:00 2001
From: sunkaixuan <610262374@qq.com>
Date: Wed, 9 Nov 2022 19:28:42 +0800
Subject: [PATCH] Add unit test
---
Src/Asp.Net/OracleTest/OracleTest.csproj | 1 +
Src/Asp.Net/OracleTest/UnitTest/Main.cs | 1 +
Src/Asp.Net/OracleTest/UnitTest/Unit001.cs | 645 +++++++++++++++++++++
3 files changed, 647 insertions(+)
create mode 100644 Src/Asp.Net/OracleTest/UnitTest/Unit001.cs
diff --git a/Src/Asp.Net/OracleTest/OracleTest.csproj b/Src/Asp.Net/OracleTest/OracleTest.csproj
index b67109fd1..91c423b17 100644
--- a/Src/Asp.Net/OracleTest/OracleTest.csproj
+++ b/Src/Asp.Net/OracleTest/OracleTest.csproj
@@ -80,6 +80,7 @@
+
diff --git a/Src/Asp.Net/OracleTest/UnitTest/Main.cs b/Src/Asp.Net/OracleTest/UnitTest/Main.cs
index 439e76a70..7c8fcb236 100644
--- a/Src/Asp.Net/OracleTest/UnitTest/Main.cs
+++ b/Src/Asp.Net/OracleTest/UnitTest/Main.cs
@@ -34,6 +34,7 @@ namespace OrmTest
}
public static void Init()
{
+ Unit001.Init();
UnitStorageableBool.Init();
UCustom03.Init();
UCustom02.Init();
diff --git a/Src/Asp.Net/OracleTest/UnitTest/Unit001.cs b/Src/Asp.Net/OracleTest/UnitTest/Unit001.cs
new file mode 100644
index 000000000..8a747cdae
--- /dev/null
+++ b/Src/Asp.Net/OracleTest/UnitTest/Unit001.cs
@@ -0,0 +1,645 @@
+ using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using SqlSugar;
+using static OrmTest.Program;
+
+namespace OrmTest
+{
+ public class Unit001
+ {
+ public static void Init()
+ {
+ var db = NewUnitTest.Db;
+
+
+ db.Aop.OnLogExecuting = (sql, pars) =>
+ {
+ Console.WriteLine(sql);//输出sql,查看执行sql 性能无影响
+
+
+ //5.0.8.2 获取无参数化 SQL 对性能有影响,特别大的SQL参数多的,调试使用
+ //UtilMethods.GetSqlString(DbType.SqlServer,sql,pars)
+ };
+ db.CodeFirst.InitTables();
+ var result = db.Queryable()
+ .LeftJoin((a, l) => a.Sfbaent == l.Imaalent && a.Sfba006 == l.Imaal001 && l.Imaal002 == "zh_CH")
+ .Where(a => a.Sfbadocno == "AAA" && a.Sfba008 != "3")
+ .Select(a => new
+ {
+
+ WarehouseLocation = SqlFunc.Subqueryable()
+ .Where(g => g.Inag001 == a.Sfba006)
+ .Where(g => (new string[] { "40", "41", "42", "49" }).Contains(g.Inag004.ToString()))
+ .Where(g => g.Inagent == a.Sfbaent && g.Inagsite == a.Sfbasite)
+ .Where(g => SqlFunc.IsNull(g.Inag008, 0) > 0)
+ .SelectStringJoin(g => SqlFunc.MergeString(g.Inag004, "-", g.Inag008.ToString()), ",")
+ }).ToList();
+
+ }
+ //建类
+ public class Test001
+ {
+ public int id { get; set; }
+ }
+ ///
+ /// 工单备料单身档
+ ///
+ [SugarTable("SFBA_T")]
+ public class SfbaT
+ {
+ ///
+ /// 企业编号
+ ///
+ [SugarColumn(ColumnName = "SFBAENT", IsPrimaryKey = true)]
+ public string Sfbaent { get; set; }
+ ///
+ /// 营运据点
+ ///
+ [SugarColumn(ColumnName = "SFBASITE")]
+ public string Sfbasite { get; set; }
+ ///
+ /// 单号
+ ///
+ [SugarColumn(ColumnName = "SFBADOCNO", IsPrimaryKey = true)]
+ public string Sfbadocno { get; set; }
+ ///
+ /// 项次
+ ///
+ [SugarColumn(ColumnName = "SFBASEQ", IsPrimaryKey = true)]
+ public long Sfbaseq { get; set; }
+ ///
+ /// 项序
+ ///
+ [SugarColumn(ColumnName = "SFBASEQ1", IsPrimaryKey = true)]
+ public long Sfbaseq1 { get; set; }
+ ///
+ /// 上阶料号
+ ///
+ [SugarColumn(ColumnName = "SFBA001")]
+ public string Sfba001 { get; set; }
+ ///
+ /// 部位
+ ///
+ [SugarColumn(ColumnName = "SFBA002")]
+ public string Sfba002 { get; set; }
+ ///
+ /// 作业编号
+ ///
+ [SugarColumn(ColumnName = "SFBA003")]
+ public string Sfba003 { get; set; }
+ ///
+ /// 作业序
+ ///
+ [SugarColumn(ColumnName = "SFBA004")]
+ public string Sfba004 { get; set; }
+ ///
+ /// BOM料号
+ ///
+ [SugarColumn(ColumnName = "SFBA005")]
+ public string Sfba005 { get; set; }
+ ///
+ /// 发料料号
+ ///
+ [SugarColumn(ColumnName = "SFBA006")]
+ public string Sfba006 { get; set; }
+ ///
+ /// 投料时距
+ ///
+ [SugarColumn(ColumnName = "SFBA007")]
+ public string Sfba007 { get; set; }
+ ///
+ /// 必要特性
+ ///
+ [SugarColumn(ColumnName = "SFBA008")]
+ public string Sfba008 { get; set; }
+ ///
+ /// 倒扣料
+ ///
+ [SugarColumn(ColumnName = "SFBA009")]
+ public string Sfba009 { get; set; }
+ ///
+ /// 标准QPA分子
+ ///
+ [SugarColumn(ColumnName = "SFBA010")]
+ public decimal? Sfba010 { get; set; }
+ ///
+ /// 标准QPA分母
+ ///
+ [SugarColumn(ColumnName = "SFBA011")]
+ public decimal? Sfba011 { get; set; }
+ ///
+ /// 允许误差率
+ ///
+ [SugarColumn(ColumnName = "SFBA012")]
+ public decimal? Sfba012 { get; set; }
+ ///
+ /// 应发数量
+ ///
+ [SugarColumn(ColumnName = "SFBA013")]
+ public decimal? Sfba013 { get; set; }
+ ///
+ /// 单位
+ ///
+ [SugarColumn(ColumnName = "SFBA014")]
+ public string Sfba014 { get; set; }
+ ///
+ /// 委外代买数量
+ ///
+ [SugarColumn(ColumnName = "SFBA015")]
+ public decimal? Sfba015 { get; set; }
+ ///
+ /// 已发数量
+ ///
+ [SugarColumn(ColumnName = "SFBA016")]
+ public decimal? Sfba016 { get; set; }
+ ///
+ /// 报废数量
+ ///
+ [SugarColumn(ColumnName = "SFBA017")]
+ public decimal? Sfba017 { get; set; }
+ ///
+ /// 盘盈亏数量
+ ///
+ [SugarColumn(ColumnName = "SFBA018")]
+ public decimal? Sfba018 { get; set; }
+ ///
+ /// 指定发料仓库
+ ///
+ [SugarColumn(ColumnName = "SFBA019")]
+ public string Sfba019 { get; set; }
+ ///
+ /// 指定发料储位
+ ///
+ [SugarColumn(ColumnName = "SFBA020")]
+ public string Sfba020 { get; set; }
+ ///
+ /// 产品特征
+ ///
+ [SugarColumn(ColumnName = "SFBA021")]
+ public string Sfba021 { get; set; }
+ ///
+ /// 替代率
+ ///
+ [SugarColumn(ColumnName = "SFBA022")]
+ public decimal? Sfba022 { get; set; }
+ ///
+ /// 标准应发数量
+ ///
+ [SugarColumn(ColumnName = "SFBA023")]
+ public decimal? Sfba023 { get; set; }
+ ///
+ /// 调整应发数量
+ ///
+ [SugarColumn(ColumnName = "SFBA024")]
+ public decimal? Sfba024 { get; set; }
+ ///
+ /// 超领数量
+ ///
+ [SugarColumn(ColumnName = "SFBA025")]
+ public decimal? Sfba025 { get; set; }
+ ///
+ /// SET替代状态
+ ///
+ [SugarColumn(ColumnName = "SFBA026")]
+ public string Sfba026 { get; set; }
+ ///
+ /// SET替代群组
+ ///
+ [SugarColumn(ColumnName = "SFBA027")]
+ public string Sfba027 { get; set; }
+ ///
+ /// 客供料
+ ///
+ [SugarColumn(ColumnName = "SFBA028")]
+ public string Sfba028 { get; set; }
+ ///
+ /// 指定发料批号
+ ///
+ [SugarColumn(ColumnName = "SFBA029")]
+ public string Sfba029 { get; set; }
+ ///
+ /// 指定库存管理特征
+ ///
+ [SugarColumn(ColumnName = "SFBA030")]
+ public string Sfba030 { get; set; }
+ ///
+ /// 自定义字段(文本)001
+ ///
+ [SugarColumn(ColumnName = "SFBAUD001")]
+ public string Sfbaud001 { get; set; }
+ ///
+ /// 自定义字段(文本)002
+ ///
+ [SugarColumn(ColumnName = "SFBAUD002")]
+ public string Sfbaud002 { get; set; }
+ ///
+ /// 自定义字段(文本)003
+ ///
+ [SugarColumn(ColumnName = "SFBAUD003")]
+ public string Sfbaud003 { get; set; }
+ ///
+ /// 自定义字段(文本)004
+ ///
+ [SugarColumn(ColumnName = "SFBAUD004")]
+ public string Sfbaud004 { get; set; }
+ ///
+ /// 自定义字段(文本)005
+ ///
+ [SugarColumn(ColumnName = "SFBAUD005")]
+ public string Sfbaud005 { get; set; }
+ ///
+ /// 自定义字段(文本)006
+ ///
+ [SugarColumn(ColumnName = "SFBAUD006")]
+ public string Sfbaud006 { get; set; }
+ ///
+ /// 自定义字段(文本)007
+ ///
+ [SugarColumn(ColumnName = "SFBAUD007")]
+ public string Sfbaud007 { get; set; }
+ ///
+ /// 自定义字段(文本)008
+ ///
+ [SugarColumn(ColumnName = "SFBAUD008")]
+ public string Sfbaud008 { get; set; }
+ ///
+ /// 自定义字段(文本)009
+ ///
+ [SugarColumn(ColumnName = "SFBAUD009")]
+ public string Sfbaud009 { get; set; }
+ ///
+ /// 品号对应代替料号
+ ///
+ [SugarColumn(ColumnName = "SFBAUD010")]
+ public string Sfbaud010 { get; set; }
+ ///
+ /// 自定义字段(数字)011
+ ///
+ [SugarColumn(ColumnName = "SFBAUD011")]
+ public decimal? Sfbaud011 { get; set; }
+ ///
+ /// 自定义字段(数字)012
+ ///
+ [SugarColumn(ColumnName = "SFBAUD012")]
+ public decimal? Sfbaud012 { get; set; }
+ ///
+ /// 自定义字段(数字)013
+ ///
+ [SugarColumn(ColumnName = "SFBAUD013")]
+ public decimal? Sfbaud013 { get; set; }
+ ///
+ /// 自定义字段(数字)014
+ ///
+ [SugarColumn(ColumnName = "SFBAUD014")]
+ public decimal? Sfbaud014 { get; set; }
+ ///
+ /// 自定义字段(数字)015
+ ///
+ [SugarColumn(ColumnName = "SFBAUD015")]
+ public decimal? Sfbaud015 { get; set; }
+ ///
+ /// 自定义字段(数字)016
+ ///
+ [SugarColumn(ColumnName = "SFBAUD016")]
+ public decimal? Sfbaud016 { get; set; }
+ ///
+ /// 自定义字段(数字)017
+ ///
+ [SugarColumn(ColumnName = "SFBAUD017")]
+ public decimal? Sfbaud017 { get; set; }
+ ///
+ /// 自定义字段(数字)018
+ ///
+ [SugarColumn(ColumnName = "SFBAUD018")]
+ public decimal? Sfbaud018 { get; set; }
+ ///
+ /// 自定义字段(数字)019
+ ///
+ [SugarColumn(ColumnName = "SFBAUD019")]
+ public decimal? Sfbaud019 { get; set; }
+ ///
+ /// 自定义字段(数字)020
+ ///
+ [SugarColumn(ColumnName = "SFBAUD020")]
+ public decimal? Sfbaud020 { get; set; }
+ ///
+ /// 自定义字段(日期时间)021
+ ///
+ [SugarColumn(ColumnName = "SFBAUD021")]
+ public DateTime? Sfbaud021 { get; set; }
+ ///
+ /// 自定义字段(日期时间)022
+ ///
+ [SugarColumn(ColumnName = "SFBAUD022")]
+ public DateTime? Sfbaud022 { get; set; }
+ ///
+ /// 自定义字段(日期时间)023
+ ///
+ [SugarColumn(ColumnName = "SFBAUD023")]
+ public DateTime? Sfbaud023 { get; set; }
+ ///
+ /// 自定义字段(日期时间)024
+ ///
+ [SugarColumn(ColumnName = "SFBAUD024")]
+ public DateTime? Sfbaud024 { get; set; }
+ ///
+ /// 自定义字段(日期时间)025
+ ///
+ [SugarColumn(ColumnName = "SFBAUD025")]
+ public DateTime? Sfbaud025 { get; set; }
+ ///
+ /// 自定义字段(日期时间)026
+ ///
+ [SugarColumn(ColumnName = "SFBAUD026")]
+ public DateTime? Sfbaud026 { get; set; }
+ ///
+ /// 自定义字段(日期时间)027
+ ///
+ [SugarColumn(ColumnName = "SFBAUD027")]
+ public DateTime? Sfbaud027 { get; set; }
+ ///
+ /// 自定义字段(日期时间)028
+ ///
+ [SugarColumn(ColumnName = "SFBAUD028")]
+ public DateTime? Sfbaud028 { get; set; }
+ ///
+ /// 自定义字段(日期时间)029
+ ///
+ [SugarColumn(ColumnName = "SFBAUD029")]
+ public DateTime? Sfbaud029 { get; set; }
+ ///
+ /// 自定义字段(日期时间)030
+ ///
+ [SugarColumn(ColumnName = "SFBAUD030")]
+ public DateTime? Sfbaud030 { get; set; }
+ ///
+ /// 备置量
+ ///
+ [SugarColumn(ColumnName = "SFBA031")]
+ public decimal? Sfba031 { get; set; }
+ ///
+ /// 备置理由码
+ ///
+ [SugarColumn(ColumnName = "SFBA032")]
+ public string Sfba032 { get; set; }
+ ///
+ /// 保税否
+ ///
+ [SugarColumn(ColumnName = "SFBA033")]
+ public string Sfba033 { get; set; }
+ ///
+ /// SET被替代群组
+ ///
+ [SugarColumn(ColumnName = "SFBA034")]
+ public string Sfba034 { get; set; }
+ ///
+ /// SET替代套数
+ ///
+ [SugarColumn(ColumnName = "SFBA035")]
+ public decimal? Sfba035 { get; set; }
+ ///
+ /// SET已发料套数
+ ///
+ [SugarColumn(ColumnName = "SFBA036")]
+ public decimal? Sfba036 { get; set; }
+ ///
+ /// 替代群组
+ ///
+ [SugarColumn(ColumnName = "SFBA037")]
+ public string Sfba037 { get; set; }
+ }
+
+
+ ///
+ /// 物料名称档
+ ///
+ [SugarTable("IMAAL_T")]
+ public class ImaalT
+ {
+ ///
+ /// 企业编号
+ ///
+ [SugarColumn(ColumnName = "IMAALENT", IsPrimaryKey = true)]
+ public string Imaalent { get; set; }
+ ///
+ /// 料号
+ ///
+ [SugarColumn(ColumnName = "IMAAL001", IsPrimaryKey = true)]
+ public string Imaal001 { get; set; }
+ ///
+ /// 语种
+ ///
+ [SugarColumn(ColumnName = "IMAAL002", IsPrimaryKey = true)]
+ public string Imaal002 { get; set; }
+ ///
+ /// 名称
+ ///
+ [SugarColumn(ColumnName = "IMAAL003")]
+ public string Imaal003 { get; set; }
+ ///
+ /// 规格
+ ///
+ [SugarColumn(ColumnName = "IMAAL004")]
+ public string Imaal004 { get; set; }
+ ///
+ /// 助记码
+ ///
+ [SugarColumn(ColumnName = "IMAAL005")]
+ public string Imaal005 { get; set; }
+ }
+ ///
+ /// 庫存明細檔
+ ///
+ [SugarTable("INAG_T")]
+ public class InagT
+ {
+ ///
+ /// 企业编号
+ ///
+ [SugarColumn(ColumnName = "INAGENT", IsPrimaryKey = true)]
+ public string Inagent { get; set; }
+ ///
+ /// 营运据点
+ ///
+ [SugarColumn(ColumnName = "INAGSITE", IsPrimaryKey = true)]
+ public string Inagsite { get; set; }
+ ///
+ /// 料件编号
+ ///
+ [SugarColumn(ColumnName = "INAG001", IsPrimaryKey = true)]
+ public string Inag001 { get; set; }
+ ///
+ /// 产品特征
+ ///
+ [SugarColumn(ColumnName = "INAG002", IsPrimaryKey = true)]
+ public string Inag002 { get; set; }
+ ///
+ /// 库存管理特征
+ ///
+ [SugarColumn(ColumnName = "INAG003", IsPrimaryKey = true)]
+ public string Inag003 { get; set; }
+ ///
+ /// 库位编号
+ ///
+ [SugarColumn(ColumnName = "INAG004", IsPrimaryKey = true)]
+ public string Inag004 { get; set; }
+ ///
+ /// 储位编号
+ ///
+ [SugarColumn(ColumnName = "INAG005", IsPrimaryKey = true)]
+ public string Inag005 { get; set; }
+ ///
+ /// 批号
+ ///
+ [SugarColumn(ColumnName = "INAG006", IsPrimaryKey = true)]
+ public string Inag006 { get; set; }
+ ///
+ /// 库存单位
+ ///
+ [SugarColumn(ColumnName = "INAG007", IsPrimaryKey = true)]
+ public string Inag007 { get; set; }
+ ///
+ /// 账面库存数量
+ ///
+ [SugarColumn(ColumnName = "INAG008")]
+ public decimal? Inag008 { get; set; }
+ ///
+ /// 实际库存数量
+ ///
+ [SugarColumn(ColumnName = "INAG009")]
+ public decimal? Inag009 { get; set; }
+ ///
+ /// 库存可用否
+ ///
+ [SugarColumn(ColumnName = "INAG010")]
+ public string Inag010 { get; set; }
+ ///
+ /// MRP可用否
+ ///
+ [SugarColumn(ColumnName = "INAG011")]
+ public string Inag011 { get; set; }
+ ///
+ /// 成本库否
+ ///
+ [SugarColumn(ColumnName = "INAG012")]
+ public string Inag012 { get; set; }
+ ///
+ /// 拣货优先序
+ ///
+ [SugarColumn(ColumnName = "INAG013")]
+ public string Inag013 { get; set; }
+ ///
+ /// 最近一次盘点日期
+ ///
+ [SugarColumn(ColumnName = "INAG014")]
+ public DateTime? Inag014 { get; set; }
+ ///
+ /// 最后异动日期
+ ///
+ [SugarColumn(ColumnName = "INAG015")]
+ public DateTime? Inag015 { get; set; }
+ ///
+ /// 呆滞日期
+ ///
+ [SugarColumn(ColumnName = "INAG016")]
+ public DateTime? Inag016 { get; set; }
+ ///
+ /// 第一次入库日期
+ ///
+ [SugarColumn(ColumnName = "INAG017")]
+ public DateTime? Inag017 { get; set; }
+ ///
+ /// No Use
+ ///
+ [SugarColumn(ColumnName = "INAG018")]
+ public DateTime? Inag018 { get; set; }
+ ///
+ /// 留置否
+ ///
+ [SugarColumn(ColumnName = "INAG019")]
+ public string Inag019 { get; set; }
+ ///
+ /// 留置原因
+ ///
+ [SugarColumn(ColumnName = "INAG020")]
+ public string Inag020 { get; set; }
+ ///
+ /// 备置数量
+ ///
+ [SugarColumn(ColumnName = "INAG021")]
+ public decimal? Inag021 { get; set; }
+ ///
+ /// No Use
+ ///
+ [SugarColumn(ColumnName = "INAG022")]
+ public string Inag022 { get; set; }
+ ///
+ /// Tag二进位码
+ ///
+ [SugarColumn(ColumnName = "INAG023")]
+ public string Inag023 { get; set; }
+ ///
+ /// 参考单位
+ ///
+ [SugarColumn(ColumnName = "INAG024")]
+ public string Inag024 { get; set; }
+ ///
+ /// 参考数量
+ ///
+ [SugarColumn(ColumnName = "INAG025")]
+ public decimal? Inag025 { get; set; }
+ ///
+ /// 最近一次检验日期
+ ///
+ [SugarColumn(ColumnName = "INAG026")]
+ public DateTime? Inag026 { get; set; }
+ ///
+ /// 下次检验日期
+ ///
+ [SugarColumn(ColumnName = "INAG027")]
+ public DateTime? Inag027 { get; set; }
+ ///
+ /// 留置日期
+ ///
+ [SugarColumn(ColumnName = "INAG028")]
+ public DateTime? Inag028 { get; set; }
+ ///
+ /// 留置人员
+ ///
+ [SugarColumn(ColumnName = "INAG029")]
+ public string Inag029 { get; set; }
+ ///
+ /// 留置部门
+ ///
+ [SugarColumn(ColumnName = "INAG030")]
+ public string Inag030 { get; set; }
+ ///
+ /// 留置单号
+ ///
+ [SugarColumn(ColumnName = "INAG031")]
+ public string Inag031 { get; set; }
+ ///
+ /// 基础单位
+ ///
+ [SugarColumn(ColumnName = "INAG032")]
+ public string Inag032 { get; set; }
+ ///
+ /// 基础单位数量
+ ///
+ [SugarColumn(ColumnName = "INAG033")]
+ public decimal? Inag033 { get; set; }
+ ///
+ /// 更新日期时间
+ ///
+ [SugarColumn(ColumnName = "INAG034")]
+ public DateTime? Inag034 { get; set; }
+ ///
+ /// 受虚拟异动影响否
+ ///
+ [SugarColumn(ColumnName = "INAG035")]
+ public string Inag035 { get; set; }
+ }
+ }
+}
\ No newline at end of file