Forráskód Böngészése

添加检查发货信息实体,修复重复添加剩余库存数问题

DuGuYang 3 éve
szülő
commit
6a176ed46e

+ 14 - 4
Areas/Admin/Controllers/MainServer/StoreMachineApplyController.cs

@@ -460,6 +460,7 @@ namespace MySystem.Areas.Admin.Controllers
             Dictionary<string, object> Obj = new Dictionary<string, object>();
             List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
             List<SendInfo> sendInfos = new List<SendInfo>();
+            List<CheckSendInfo> checksendInfo = new List<CheckSendInfo>();
             StoreMachineApply apply = db.StoreMachineApply.FirstOrDefault(m => m.Id == data.Id) ?? new StoreMachineApply();
             JsonData ApplyList = JsonMapper.ToObject(apply.SendSn);
             decimal ApplyAmount = 0;
@@ -523,17 +524,17 @@ namespace MySystem.Areas.Admin.Controllers
                 if (BrandId == 8) FromStoreId = 4831;
                 if (BrandId == 9) FromStoreId = 4832;
                 tostore = db.StoreHouse.FirstOrDefault(m => m.UserId == apply.UserId && m.BrandId == BrandId.ToString() && m.Status > -1);
-                SendInfo items = sendInfos.FirstOrDefault(m => m.FromStoreId == FromStoreId && m.ToStoreId == tostore.Id && m.BrandId == BrandId);
+                CheckSendInfo items = checksendInfo.FirstOrDefault(m => m.FromStoreId == FromStoreId && m.ToStoreId == tostore.Id && m.BrandId == BrandId);
                 if (items == null)
                 {
-                    SendInfo rows = new SendInfo()
+                    CheckSendInfo rows = new CheckSendInfo()
                     {
                         FromStoreId = FromStoreId,
                         ToStoreId = tostore.Id,
                         BrandId = BrandId,
                         Num = 1
                     };
-                    sendInfos.Add(rows);
+                    checksendInfo.Add(rows);
                 }
                 else
                 {
@@ -555,7 +556,7 @@ namespace MySystem.Areas.Admin.Controllers
                 if (BrandIds == 9) FromStoreId = 4832;
                 var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == BrandIds);
                 tostore = db.StoreHouse.FirstOrDefault(m => m.UserId == apply.UserId && m.BrandId == BrandIds.ToString() && m.Status > -1);
-                SendInfo items = sendInfos.FirstOrDefault(m => m.FromStoreId == FromStoreId && m.ToStoreId == tostore.Id && m.BrandId == BrandIds) ?? new SendInfo();
+                CheckSendInfo items = checksendInfo.FirstOrDefault(m => m.FromStoreId == FromStoreId && m.ToStoreId == tostore.Id && m.BrandId == BrandIds) ?? new CheckSendInfo();
                 if (items.Num > num)
                 {
                     return "Warning|" + "该条发货记录的" + brandInfo.Name + "发货数量过多!";
@@ -816,5 +817,14 @@ namespace MySystem.Areas.Admin.Controllers
             public int Num { get; set; }
         }
 
+         //检查发货信息实体类
+        private class CheckSendInfo
+        {
+            public int FromStoreId { get; set; }
+            public int ToStoreId { get; set; }
+            public int BrandId { get; set; }
+            public int Num { get; set; }
+        }
+
     }
 }