| using System; | 
| using Microsoft.VisualStudio.TestTools.UnitTesting; | 
| using wcftest.wcf; | 
| using wcftest.EnumDefine; | 
| using System.Collections.Generic; | 
| using Newtonsoft.Json; | 
| using wcftest.orm; | 
| using wcftest.BussinessExtension; | 
| using wcftest.BussinessExtension.Handle; | 
| using System.Linq; | 
| using wcftest.sendToSap; | 
|   | 
| namespace WMS_UnitTest | 
| { | 
|   | 
|   | 
|     [TestClass] | 
|     public class UnitTest1 | 
|     { | 
|         [TestMethod] | 
|         public void Test_NULL() | 
|         { | 
|             Base_PositionPrint item = new Base_PositionPrint(); | 
|             item.Quantity = null; | 
|             //测试 异常:可为空的对象必须具有一个值。 | 
|             //测试结果:就是一个对象是NULL,但是你有把他转换成不为NULL的类型了,比如decimal。你应该转换为 decimal? | 
|             Base_PositionPrint printRecord = new Base_PositionPrint(); | 
|             printRecord.Quantity = (decimal)item.Quantity;//标签上物料数量 | 
|   | 
|             Assert.IsFalse(false); | 
|         } | 
|   | 
|         [TestMethod] | 
|         public void Test_ConvertPlcNO() | 
|         { | 
|             //var a1 = ExtendHelper.ConvertPlcNO(0); | 
|             //var a2 = ExtendHelper.ConvertPlcNO(1); | 
|   | 
|             var a2 = ExtendHelper.ConvertPlcNO(65534); | 
|             var a3 = ExtendHelper.ConvertPlcNO(65535); | 
|             var a4 = ExtendHelper.ConvertPlcNO(65535 + 1); | 
|             var a9 = ExtendHelper.ConvertPlcNO(65535 + 2); | 
|             int aa = 196603; | 
|             var a5 = ExtendHelper.ConvertPlcNO(aa); | 
|             aa = 196604; | 
|             a5 = ExtendHelper.ConvertPlcNO(aa); | 
|             aa = 196605; | 
|             a5 = ExtendHelper.ConvertPlcNO(aa); | 
|             aa = 196606; | 
|             a5 = ExtendHelper.ConvertPlcNO(aa); | 
|             aa = 196607; | 
|             a5 = ExtendHelper.ConvertPlcNO(aa); | 
|         } | 
|   | 
|         [TestMethod] | 
|         public void Test_Decimal() | 
|         { | 
|             decimal numDecimal = 34.3471M; | 
|             numDecimal = Math.Round(numDecimal, 2); | 
|   | 
|             numDecimal = 0.5000M; | 
|             numDecimal = Math.Round(numDecimal, 2); | 
|   | 
|             numDecimal = 5.0000M; | 
|             numDecimal = Math.Round(numDecimal, 2); | 
|   | 
|             numDecimal = 5.5635M; | 
|             numDecimal = Math.Round(numDecimal, 2); | 
|   | 
|   | 
|         } | 
|   | 
|         [TestMethod] | 
|         public void TestMethod_Sale_OrderList() | 
|         { | 
|             using (dbModel mod = new dbModel()) | 
|             { | 
|                 List<Sale_OrderList> saleList = mod.Sale_OrderList.Where(x => x.QuantityOrder > 0).ToList(); | 
|   | 
|             } | 
|         } | 
|   | 
|   | 
|         [TestMethod] | 
|         public void TestMethod_StockOutConfirm() | 
|         { | 
|             apitest _apitest = new apitest(); | 
|             // _apitest.StockOutConfirm(null, "800022583944"); | 
|         } | 
|   | 
|         [TestMethod] | 
|         public void TestMethod_lackData() | 
|         { | 
|             apitest _apitest = new apitest(); | 
|             _apitest.lackData("800022583944"); | 
|   | 
|   | 
|         } | 
|   | 
|         [TestMethod] | 
|         public void TestMethod_FitlterFindEmptyPlace() | 
|         { | 
|             using (dbModel mod = new dbModel()) | 
|             { | 
|                 var list = mod.Base_Position.Where(x => x.AreaCode == "1" && x.PositionName == "1-01-13-11").Take(1).ToList(); | 
|   | 
|                 BussinessExtension.FitlterFindEmptyPlace(list, 1, mod); | 
|             } | 
|         } | 
|   | 
|         [TestMethod] | 
|         public void TestMethod_AddForSH() | 
|         { | 
|             string _retResult = "aaa"; | 
|             string _retMsg = "bbb"; | 
|             GRMaterialEntity[] results = new GRMaterialEntity[1]; | 
|             GRMaterialEntity zz = new GRMaterialEntity() | 
|             { | 
|                 MaterialCode = "A7EQD-5141154321", | 
|                 PoNumber = "11", | 
|                 PoItem = "233232", | 
|                 StorageLocation = "23232" | 
|             }; | 
|             results[0] = zz; | 
|             SapSendFailRecodInfoHandler.AddForSH(results, _retResult, _retMsg);//记录失败表 | 
|         } | 
|   | 
|         /// <summary> | 
|         /// 分拣确认测试 | 
|         /// </summary> | 
|         [TestMethod] | 
|         public void TestMethod_sortingConfirm() | 
|         { | 
|             apitest test = new apitest(); | 
|             var plateCode = "10023"; | 
|   | 
|             List<sortingType> products = new List<sortingType>(); | 
|   | 
|   | 
|             var _products = JsonConvert.SerializeObject(products); | 
|   | 
|             test.sortingConfirm(plateCode, _products, "5"); | 
|         } | 
|   | 
|         [TestMethod] | 
|         public void Test_AddOutInStockTask() | 
|         { | 
|             using (dbModel mod = new dbModel()) | 
|             { | 
|                 var ProductCode = "A7EQDG10 99 002-01"; | 
|                 ProductCode = "A7EQD-5141154321"; | 
|                 var aa = mod.Base_ProductPosition.Where(x => x.ProductCode == ProductCode).FirstOrDefault(); | 
|                 OutInStockTaskHandler.AddOutInStockTask22("测试用户", mod, OutInStockTaskName.清库任务, aa.ProductStorage, aa, "tesssdsdssdsadfasdfsdafdasfasdft",""); | 
|                 mod.SaveChanges(); | 
|             } | 
|         } | 
|   | 
|         [TestMethod] | 
|         public void Test_AddOutInStockTask2() | 
|         { | 
|             using (dbModel mod = new dbModel()) | 
|             { | 
|                 var ProductCode = "A7EQDG10 99 002-01"; | 
|                 ProductCode = "A7EQD-5141154321"; | 
|                 var aa = mod.Base_ProductPosition.Where(x => x.ProductCode == ProductCode).FirstOrDefault(); | 
|                 OutInStockTaskHandler.AddOutInStockTask22("测试用户", mod, OutInStockTaskName.出库任务, aa.ProductStorage, aa, "tesssdsdssdsadfasdfsdafdasfasdft",""); | 
|                 mod.SaveChanges(); | 
|             } | 
|         } | 
|   | 
|         [TestMethod] | 
|         public void Test_AddOutInStockTask3() | 
|         { | 
|             using (dbModel mod = new dbModel()) | 
|             { | 
|                 var ProductCode = "A7EQDG10 99 002-01"; | 
|                 ProductCode = "A7EQD-5141154321"; | 
|                 var aa = mod.Base_ProductPosition.Where(x => x.ProductCode == ProductCode).FirstOrDefault(); | 
|                 OutInStockTaskHandler.AddOutInStockTask22("测试用户", mod, OutInStockTaskName.入库任务, aa.ProductStorage, aa, "tesssdsdssdsadfasdfsdafdasfasdft",""); | 
|                 mod.SaveChanges(); | 
|             } | 
|         } | 
|   | 
|   | 
|         [TestMethod] | 
|         public void TestMethod_x() | 
|         { | 
|             using (dbModel mod = new dbModel()) | 
|             { | 
|                 //var ProductCode = "A7EQD-5130124968"; | 
|                 //var ProductName = "铁芯环氧支撑板-3 501 481 8"; | 
|                 //OutInStockTask addOutTask = new OutInStockTask(); | 
|                 //addOutTask.taskName = "出库任务"; | 
|                 //addOutTask.orderCode = "222"; | 
|                 //addOutTask.trackNumber = "111"; | 
|                 //addOutTask.materialNumber = ProductCode; | 
|                 //addOutTask.materialName = ProductName; | 
|                 //addOutTask.unit = "KG"; | 
|                 //addOutTask.quantity = 99; | 
|                 //addOutTask.creatDate = DateTime.Now; | 
|                 ////增加字段 【EditBy shaocx,2022-03-06】 | 
|                 //addOutTask.PositionName = "1111"; | 
|                 //decimal cghw_ProductStorage = 0; | 
|                 //decimal zcq__ProductStorage = 0; | 
|                 //decimal dqkw_ProductStorage = 0; | 
|                 //BussinessExtension.GetCurrentProductStorage(mod, addOutTask.materialNumber,addOutTask.PositionName, out cghw_ProductStorage, out zcq__ProductStorage, out dqkw_ProductStorage); | 
|                 //addOutTask.CGHW_ProductStorage = cghw_ProductStorage; | 
|                 //addOutTask.ZCG_ProductStorage = zcq__ProductStorage; | 
|                 //addOutTask.ext2 = dqkw_ProductStorage.ToString(); | 
|   | 
|                 //mod.OutInStockTask.Add(addOutTask);//增加出库记录 | 
|   | 
|                 //mod.SaveChanges(); | 
|             } | 
|         } | 
|   | 
|     } | 
| } |