Просмотр исходного кода

退回仓库操作要清除机具历史记录
换绑操作要设置商户的激活状态和激活时间

lcl 3 лет назад
Родитель
Сommit
726e3f253f

+ 1 - 0
AppStart/ExcelHelper.cs

@@ -839,6 +839,7 @@ namespace MySystem
                                                         machine.IsPurchase = 0;
                                                         machine.LeaderUserId = 0;
                                                         machine.PreUserId = 0;
+                                                        PublicFunction.ClearPosHistory(db, SnNo); //清除机具历史记录
                                                         db.SaveChanges();
                                                         if (!storeData.ContainsKey(storefor.StoreId + "_" + BrandId))
                                                         {

+ 21 - 0
AppStart/PublicFunction.cs

@@ -439,6 +439,27 @@ namespace MySystem
 
         #endregion
 
+        #region 退回仓库,清除历史记录
+
+        public static void ClearPosHistory(WebCMSEntities db, string PosSn)
+        {
+            PreSendStockDetail prepos = db.PreSendStockDetail.FirstOrDefault(m => m.SnNo == PosSn && m.Status == 1 && m.AuthFlag == 1);
+            if(prepos != null)
+            {
+                prepos.Status = -1;
+                prepos.AuthFlag = 0;
+                // db.SaveChanges();
+            }
+            MachineApply apply = db.MachineApply.FirstOrDefault(m => m.SwapSnExpand.Contains(PosSn));
+            if(apply != null)
+            {
+                apply.SwapSnExpand = apply.SwapSnExpand.Replace(PosSn, PosSn.Substring(0, 3) + "d" + PosSn.Substring(4));
+                // db.SaveChanges();
+            }
+        }
+
+        #endregion
+
 
 
         #region 测试创客Id

+ 2 - 0
Areas/Admin/Controllers/MainServer/StoreHouseController.cs

@@ -1012,6 +1012,7 @@ namespace MySystem.Areas.Admin.Controllers
                                 toStore.LaveNum += 1;
                                 fromStore.TotalNum -= 1;
                                 fromStore.LaveNum -= 1;
+                                PublicFunction.ClearPosHistory(db, posInfo.PosSn); //清除机具历史记录
                                 db.SaveChanges();
                             }
                             else
@@ -1098,6 +1099,7 @@ namespace MySystem.Areas.Admin.Controllers
                                 fuserMachineData.UnBindCount -= 1;
                                 toStore.LaveNum += 1;
                                 toStore.TotalNum += 1;
+                                PublicFunction.ClearPosHistory(db, posInfo.PosSn); //清除机具历史记录
                                 db.SaveChanges();
                             }
                             db.SaveChanges();

+ 6 - 0
Areas/Admin/Controllers/MainServer/SysToolsController.cs

@@ -1532,6 +1532,8 @@ namespace MySystem.Areas.Admin.Controllers
                     forMerNo.SnId = newpos.Id;
                 }
                 merchant.KqSnNo = NewSn;
+                merchant.ActiveStatus = newpos.ActivationState;
+                merchant.MerStandardDate = newpos.ActivationTime;
                 db.MachineChangeDetail.Add(new MachineChangeDetail()
                 {
                     CreateDate = DateTime.Now,
@@ -1754,6 +1756,7 @@ namespace MySystem.Areas.Admin.Controllers
                     oldpos.BuyUserId = 0;
                     oldpos.UserId = 0;
                     oldpos.Status = -1;
+                    PublicFunction.ClearPosHistory(db, oldpos.PosSn); //清除机具历史记录
                     db.SaveChanges();
 
                     PosMerchantInfo merchant = db.PosMerchantInfo.FirstOrDefault(m => m.Id == newpos.BindMerchantId);
@@ -1942,6 +1945,7 @@ namespace MySystem.Areas.Admin.Controllers
                     oldpos.BuyUserId = 0;
                     oldpos.UserId = 0;
                     oldpos.Status = -1;
+                    PublicFunction.ClearPosHistory(db, oldpos.PosSn); //清除机具历史记录
                     db.SaveChanges();
 
                     BrokenMachineChange add = db.BrokenMachineChange.Add(new BrokenMachineChange()
@@ -4124,6 +4128,7 @@ namespace MySystem.Areas.Admin.Controllers
                 oldpos.SourcePosSn = null;
                 oldpos.BuyUserId = 0;
                 oldpos.UserId = 0;
+                PublicFunction.ClearPosHistory(db, oldpos.PosSn); //清除机具历史记录
             }
             if (!string.IsNullOrEmpty(error))
             {
@@ -4427,6 +4432,7 @@ namespace MySystem.Areas.Admin.Controllers
                     pos.SourcePosSn = null;
                     pos.BuyUserId = 0;
                     pos.UserId = 0;
+                    PublicFunction.ClearPosHistory(db, pos.PosSn); //清除机具历史记录
                 }
                 else
                 {

+ 2 - 0
Areas/Admin/Controllers/OperateServer/StoreHouseOperateController.cs

@@ -798,6 +798,7 @@ namespace MySystem.Areas.Admin.Controllers
                                 toStore.LaveNum += 1;
                                 fromStore.TotalNum -= 1;
                                 fromStore.LaveNum -= 1;
+                                PublicFunction.ClearPosHistory(db, posInfo.PosSn); //清除机具历史记录
                                 db.SaveChanges();
                             }
                             else
@@ -883,6 +884,7 @@ namespace MySystem.Areas.Admin.Controllers
                                 fuserMachineData.UnBindCount -= 1;
                                 toStore.LaveNum += 1;
                                 toStore.TotalNum += 1;
+                                PublicFunction.ClearPosHistory(db, posInfo.PosSn); //清除机具历史记录
                                 db.SaveChanges();
                             }
                             db.SaveChanges();