You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
6.1 KiB
C#

using AUCMA.STORE.Common;
using AUCMA.STORE.Entity.DAO;
using AUCMA.STORE.Entity.DTO;
using AUCMA.STORE.Entity.Enums;
using AUCMA.STORE.SqlSugar.serviceImpl;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace AUCMA.STORE.UnitTest
{
/// <summary>
/// UnitTest2 的摘要说明
/// </summary>
[TestClass]
public class UnitTest2
{
public UnitTest2()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
private TestContext testContextInstance;
/// <summary>
///获取或设置测试上下文,该上下文提供
///有关当前测试运行及其功能的信息。
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region 附加测试特性
//
// 编写测试时,可以使用以下附加特性:
//
// 在运行类中的第一个测试之前使用 ClassInitialize 运行代码
// [ClassInitialize()]
// public static void MyClassInitialize(TestContext testContext) { }
//
// 在类中的所有测试都已运行之后使用 ClassCleanup 运行代码
// [ClassCleanup()]
// public static void MyClassCleanup() { }
//
// 在运行每个测试之前,使用 TestInitialize 来运行代码
// [TestInitialize()]
// public void MyTestInitialize() { }
//
// 在每个测试运行完之后,使用 TestCleanup 来运行代码
// [TestCleanup()]
// public void MyTestCleanup() { }
//
#endregion
[TestMethod]
public void TestMethod1()
{
//
// TODO: 在此处添加测试逻辑
//
test();
}
public async void test()
{
for (int i = 1; i <= 3; i++)
{
/*BaseMaterialStore baseMaterialStore = new BaseMaterialStore();
baseMaterialStore.objid = System.Guid.NewGuid().ToString();
baseMaterialStore.materialType = "0";
baseMaterialStore.materialCode = "123";
baseMaterialStore.locationCode = "1-1-" + i;
baseMaterialStore.locationArea = Entity.Enums.LocationArea.Location_Left;
baseMaterialStore.deleteFlag = Entity.Enums.DeleteFlag.No;
baseMaterialStore.recordTime = DateTime.Now;
int info = await new BaseServices<BaseMaterialStore>().Add(baseMaterialStore);*/
BaseTaskQueue task = new BaseTaskQueue();
task.pilerTaskCode = "123456";
task.plcCode = 1002;
task.boxCode = "8208001992BG1231";
task.materialCode = "8208001992";
task.storeCode = "A";
task.taskStatus = Entity.Enums.TaskStatus.Await;
task.pilerTaskType = Entity.Enums.TaskType.OutStore;
task.locationArea = Entity.Enums.LocationArea.Location_Left;
task.operationType = Entity.Enums.OperationType.Automatic;
task.pilerClaimGoodsRows = 1;
task.pilerClaimGoodsLine = 2;
task.pilerClaimGoodsTier = 3;
task.pilerUnloadRows = 2;
task.pilerUnloadLine = 2;
task.pilerUnloadTier = 2;
task.uuid = System.Guid.NewGuid().ToString("N");
task.recordTime = DateTime.Now;
int info = await new BaseServices<BaseTaskQueue>().Add(task);
}
/*Expression<Func<BaseMaterialStore, BaseLocationInfo, object[]>> joinTable = (s1, s2) => new object[]
{
JoinType.Left,s1.locationCode == s2.locationCode
};
Expression<Func<BaseMaterialStore, BaseLocationInfo, BaseMaterialStore>> joinWhere = (s1, s2) => new BaseMaterialStore
{
locationCode = s1.locationCode,
*//*locationName = s2.locationName,
materialType = s2.materialType,
storeCode = s2.storeCode,
locationArea = s2.locationArea,
locationRow = s2.locationRow,
locationLine = s2.locationLine,
locationTier = s2.locationTier,
locationStatus = s2.locationStatus,
efficiency = s2.efficiency,
remark = s2.remark,
deleteFlag = s2.deleteFlag,
recordTime = s2.recordTime*//*
};
Expression<Func<BaseMaterialStore, bool>> exp = (s1) => true;
exp = exp.And(s1 => s1.materialType == 0 && s1.locationStatus == Entity.Enums.LocationStatus.InUse);
var info = await new BaseServices<BaseMaterialStore>().QueryMuch<BaseMaterialStore, BaseLocationInfo, BaseMaterialStore>(joinTable, joinWhere, exp);*/
//Expression<Func<BaseMaterialStore, bool>> exp = s1 => true;
//exp = exp.And(s1 => s1.materialType == 0 && s1.deleteFlag == Entity.Enums.DeleteFlag.No);
//List<BaseMaterialStore> baseMaterialStores = await new BaseServices<BaseMaterialStore>().Query(exp);
//List<BaseLocationInfo> info = new List<BaseLocationInfo>();
//baseMaterialStores.ForEach(async x => {
// Expression<Func<BaseLocationInfo, bool>> expression = s1 => true;
// expression = expression.And(s1 => s1.locationCode == x.locationCode);
// info.Add(await new BaseServices<BaseLocationInfo>().QuerySingle(expression));
//});
//List<IGrouping<LocationArea, BaseLocationInfo>> _group = info.GroupBy(g => g.locationArea).ToList();
//List<LocationArea> locationAreas = new List<LocationArea>();
//_group.ForEach(x => locationAreas.Add(x.Key));
}
}
}