wanghan 4 ay önce
ebeveyn
işleme
23e1374e53

+ 53 - 48
LogForceTestApp.Modules.MainModule/ViewModels/MainPageViewModel.cs

@@ -183,7 +183,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
         #endregion
         public string ProductCode { get; set; }
 
-        string soleNum=null;
+        string soleNum = null;
         int[] q = new int[30];
         string[] operName = new string[25];
         private System.Timers.Timer _timer;
@@ -1359,7 +1359,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
             var res = _repository.GetAllQuery<Information>(c => c.ProNo == soleNum);
             if (res != null)
             {
-                for (int i = 0;i<res.Count;i++)
+                for (int i = 0; i < res.Count; i++)
                 {
                     res[i].ProCode = procode;
                     _repository.Update(res[i]);
@@ -1434,7 +1434,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                         try
                         {
                             DateTime dt = DateTime.Today;
-                            var list = _repository.GetFirstDefault<ProStatus>(c =>c.OrdNoS == Order);//查一个值
+                            var list = _repository.GetFirstDefault<ProStatus>(c => c.OrdNoS == Order);//查一个值
                             if (list != null)
                             {
                                 list.NgS++;
@@ -1466,7 +1466,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                         try
                         {
                             DateTime dt = DateTime.Today;
-                            var list = _repository.GetFirstDefault<ProStatus>(c =>c.OrdNoS == Order);//查一个值
+                            var list = _repository.GetFirstDefault<ProStatus>(c => c.OrdNoS == Order);//查一个值
                             if (list != null)
                             {
                                 list.OkS++;
@@ -1606,7 +1606,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                 //{
                 fbarcode.Clear();
                 Quest(Order);
-                
+
                 var customRepo = new CustomRepository();
                 try
                 {
@@ -1619,7 +1619,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     }
                     else
                     {
-                        WriteLog("订单错误",LogType.Error);
+                        WriteLog("订单错误", LogType.Error);
                     }
 
                     var t_pda = customRepo.GetAllQuery<t_PDABarCodeSign>(c => c.FBillNo == Order);
@@ -1636,40 +1636,45 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                 {
                     WriteLog("OrderEnter1:" + ex.Message, LogType.Error);
                 }
-                var outp = new ProStatus()
-                {
-                    Id = Guid.NewGuid(),
-                    OrdNoS = Order,
-                    PlanS = plan,
-                    RealityS = 0,
-                    OkS = 0,
-                    NgS = 0,
-                    ErrS = 0
-                };
-                _repository.Add(outp);
-
                 try
                 {
-                    DateTime dt = DateTime.Today;
-                    var allnumbers = _repository.GetFirstDefault<AllNumber>(c => c.DateA == dt);
-                    if (allnumbers != null)
+                    var ps = _repository.GetFirstDefault<ProStatus>(c => c.OrdNoS == Order);
+                    if (ps == null)
                     {
-                        allnumbers.PlanA = allnumbers.PlanA + plan;
-                        _repository.Update(allnumbers);
-                    }
-                    else
-                    {
-                        var al = new AllNumber()
+                        var outp = new ProStatus()
                         {
                             Id = Guid.NewGuid(),
-                            DateA = DateTime.Today,
-                            PlanA = plan,
-                            RealityA = 0,
-                            OkA = 0,
-                            NgA = 0,
-                            ErrA = 0
+                            OrdNoS = Order,
+                            PlanS = plan,
+                            RealityS = 0,
+                            OkS = 0,
+                            NgS = 0,
+                            ErrS = 0
                         };
-                        _repository.Add(al);
+                        _repository.Add(outp);
+
+
+                        DateTime dt = DateTime.Today;
+                        var allnumbers = _repository.GetFirstDefault<AllNumber>(c => c.DateA == dt);
+                        if (allnumbers != null)
+                        {
+                            allnumbers.PlanA = allnumbers.PlanA + plan;
+                            _repository.Update(allnumbers);
+                        }
+                        else
+                        {
+                            var al = new AllNumber()
+                            {
+                                Id = Guid.NewGuid(),
+                                DateA = DateTime.Today,
+                                PlanA = plan,
+                                RealityA = 0,
+                                OkA = 0,
+                                NgA = 0,
+                                ErrA = 0
+                            };
+                            _repository.Add(al);
+                        }
                     }
                 }
                 catch (Exception ex)
@@ -1840,7 +1845,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1032);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位1_pno{pno}");
-                    
+
                     if (pno != p1)
                     {
                         var productNew = new InformationNew
@@ -1898,7 +1903,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1035);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位2_pno{pno}");
-                    
+
                     if (pno != p2)
                     {
                         var productNew = new InformationNew
@@ -1954,7 +1959,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1038);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位3_pno{pno}");
-                    
+
                     if (pno != p3)
                     {
                         var productNew = new InformationNew
@@ -2011,7 +2016,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1041);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位4_pno{pno}");
-                    
+
                     if (pno != p4)
                     {
                         var productNew = new InformationNew
@@ -2068,7 +2073,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1044);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位5_pno{pno}");
-                    
+
                     if (pno != p5)
                     {
                         var productNew = new InformationNew
@@ -2125,7 +2130,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1047);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位6_pno{pno}");
-                    
+
                     if (pno != p6)
                     {
                         var productNew = new InformationNew
@@ -2182,7 +2187,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1050);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位7_pno{pno}");
-                    
+
                     if (pno != p7)
                     {
                         var productNew = new InformationNew
@@ -2239,7 +2244,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1053);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位8_pno{pno}");
-                    
+
                     if (pno != p8)
                     {
                         var productNew = new InformationNew
@@ -2296,7 +2301,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1056);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位9_pno{pno}");
-                    
+
                     if (pno != p9)
                     {
                         var productNew = new InformationNew
@@ -2353,7 +2358,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1059);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位10_pno{pno}");
-                    
+
                     if (pno != p10)
                     {
                         var productNew = new InformationNew
@@ -2410,7 +2415,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1062);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位11_pno{pno}");
-                    
+
                     if (pno != p11)
                     {
                         var productNew = new InformationNew
@@ -2467,7 +2472,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1065);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位12_pno{pno}");
-                    
+
                     if (pno != p12)
                     {
                         var productNew = new InformationNew
@@ -2524,7 +2529,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                     var d3 = tcpNet.ReadInt(1068);
                     var pno = d1.ToString() + d2.ToString() + d3.ToString();
                     _logger.Information("{@Message}", $"工位13_pno{pno}");
-                    
+
                     if (pno != p13)
                     {
                         var productNew = new InformationNew
@@ -2583,7 +2588,7 @@ namespace LogoForceTestApp.Modules.MainModule.ViewModels
                         var d3 = tcpNet.ReadInt(1071);
                         var pno = d1.ToString() + d2.ToString() + d3.ToString();
                         _logger.Information("{@Message}", $"工位14_pno{pno}");
-                        
+
                         if (pno != p14)
                         {
                             var productNew = new InformationNew