schangxiang@126.com
2025-09-19 fc752b66a7976188c4edd5e3fb7ca6bb2822e441
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
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();
            }
        }
 
    }
}