فهرست منبع

修改队列空指针报错

DuGuYang 3 سال پیش
والد
کامیت
8b9ff0cc16
1فایلهای تغییر یافته به همراه4 افزوده شده و 5 حذف شده
  1. 4 5
      AppStart/ExcelHelper.cs

+ 4 - 5
AppStart/ExcelHelper.cs

@@ -275,12 +275,11 @@ namespace MySystem
                                         int BrandId = int.Parse(function.CheckInt(BrandIdString));
 
                                         //调拨时若出货仓库与填写仓库不符,则该条出货失败
-                                        var posinfo = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == SnNo && m.BrandId == BrandId);
-                                        var storeinfo = db.StoreForCode.FirstOrDefault(m => m.Code == OutStoreNo && m.StoreId == posinfo.StoreId);
-                                        if (posinfo != null)
+                                        var posinfo = db.PosMachinesTwo.FirstOrDefault(m => m.PosSn == SnNo && m.BrandId == BrandId) ?? new PosMachinesTwo();
+                                        var storeinfo = db.StoreForCode.FirstOrDefault(m => m.Code == OutStoreNo && m.StoreId == posinfo.StoreId) ?? new StoreForCode();
+                                        if (posinfo.Id > 0)
                                         {
-
-                                            if (storeinfo != null)
+                                            if (storeinfo.StoreId > 0)
                                             {
                                                 KqProducts kqProduct = db.KqProducts.FirstOrDefault(m => m.Id == BrandId) ?? new KqProducts();
                                                 if (kqProduct.Id > 0)