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 { /// /// UnitTest2 的摘要说明 /// [TestClass] public class UnitTest2 { public UnitTest2() { // //TODO: 在此处添加构造函数逻辑 // } private TestContext testContextInstance; /// ///获取或设置测试上下文,该上下文提供 ///有关当前测试运行及其功能的信息。 /// 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().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().Add(task); } /*Expression> joinTable = (s1, s2) => new object[] { JoinType.Left,s1.locationCode == s2.locationCode }; Expression> 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> exp = (s1) => true; exp = exp.And(s1 => s1.materialType == 0 && s1.locationStatus == Entity.Enums.LocationStatus.InUse); var info = await new BaseServices().QueryMuch(joinTable, joinWhere, exp);*/ //Expression> exp = s1 => true; //exp = exp.And(s1 => s1.materialType == 0 && s1.deleteFlag == Entity.Enums.DeleteFlag.No); //List baseMaterialStores = await new BaseServices().Query(exp); //List info = new List(); //baseMaterialStores.ForEach(async x => { // Expression> expression = s1 => true; // expression = expression.And(s1 => s1.locationCode == x.locationCode); // info.Add(await new BaseServices().QuerySingle(expression)); //}); //List> _group = info.GroupBy(g => g.locationArea).ToList(); //List locationAreas = new List(); //_group.ForEach(x => locationAreas.Add(x.Key)); } } }