DuGuYang 3 лет назад
Родитель
Сommit
2e39fdf977

+ 26 - 3
Areas/Admin/Controllers/MainServer/StoreHouseController.cs

@@ -147,7 +147,30 @@ namespace MySystem.Areas.Admin.Controllers
                 var userForMakerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new UserForMakerCode();
                 if (userForMakerCode.UserId > 0)
                 {
-                    condition += " and UserId in (SELECT Id FROM Users WHERE ParentNav LIKE '%," + userForMakerCode.UserId + ",%')";
+                    var user = db.Users.FirstOrDefault(m => m.Id == userForMakerCode.UserId);
+                    var users = db.Users.Where(m => m.ParentNav.Contains("," + user.Id.ToString() + ",")).ToList();
+                    string userIds = "";
+                    foreach (var item in users)
+                    {
+                        userIds += item.Id + ",";
+                    }
+                    userIds += user.Id;//下线创客Id包含自己
+                    string ParentNav = function.CheckNull(user.ParentNav).Trim(',').Replace(",,", ",");
+                    string[] ParentNavList = ParentNav.Split(',');
+                    string OpId = ParentNavList[^1];//上线创客
+                    var storeHouse = db.StoreHouse.Where(m => m.OpId == int.Parse(OpId) && m.Sort == 0 && m.UserId != 0 && m.UserId != 1).ToList();//上线关联的分仓
+                    var storeHouses = db.StoreHouse.Where(m => m.OpId == 0 && userIds.TrimEnd(',').Contains(m.UserId.ToString()) && m.UserId != 0 && m.UserId != 1 && m.Status > 0).ToList();//下线未关联分仓
+                    string Id = "";
+                    foreach (var items in storeHouse)
+                    {
+                        Id += items.Id + ",";
+                    }
+                    foreach (var item1 in storeHouses)
+                    {
+                        Id += item1.Id + ",";
+                    }
+                    condition += " and Id in (" + Id.TrimEnd(',') + ")";
+
                 }
             }
             //运营中心编号
@@ -177,11 +200,11 @@ namespace MySystem.Areas.Admin.Controllers
             {
                 if (int.Parse(StoreKindSelect) > 0)
                 {
-                    condition += " and OpId>0 and StoreKind=2";
+                    condition += " and Sort>0 and StoreKind=2";
                 }
                 else
                 {
-                    condition += " and OpId>0 and StoreKind!=2";
+                    condition += " and Sort=0 and StoreKind!=2";
 
                 }
             }

+ 5 - 0
Areas/Admin/Controllers/OperateServer/StoreMachineApplyOperateController.cs

@@ -902,6 +902,11 @@ namespace MySystem.Areas.Admin.Controllers
                 balance.TransRecordNo = ChangeNo2; //交易流水编号
                 storeSH.TotalNum += item.Num;
                 storeSH.LaveNum += item.Num;
+                var sysAdmin = opdb.SysAdmin.FirstOrDefault(m => m.QueryCount == 1 && m.Status == 0 && m.UserId == storeSH.UserId) ?? new SysAdmin();
+                if (sysAdmin.Id > 0)
+                {
+                    // sysAdmin.TotalMachineCount += item.Num;
+                }
             }
             apply.SeoTitle = SysUserName + '-' + SysRealName;//添加操作人信息
             apply.UseAmount = ApplyAmount;

+ 1 - 0
Areas/Admin/Controllers/OperateServer/SysAdminOperateController.cs

@@ -250,6 +250,7 @@ namespace MySystem.Areas.Admin.Controllers
                             Sort = info.Id,//运营中心Id
                             Status = 1,
                             BrandId = item.Id.ToString(),
+                            StoreKind = 2,//运营仓
 
                         }).Entity;
                         db.SaveChanges();

+ 4 - 1
Areas/Admin/Views/MainServer/StoreHouse/BatchSetting.cshtml

@@ -34,7 +34,7 @@
                                     <label class="layui-form-label">运营创客编号</label>
                                     <div class="layui-input-inline">
                                         <input class="layui-input" type="text" id="MakerCode" name="MakerCode"
-                                            maxlength="50" lay-verify="required|" autocomplete="off"
+                                            maxlength="50" lay-verify="required|" autocomplete="off" onkeyup="GetReserve(this)"
                                             placeholder="请输入运营创客编号">
                                     </div>
                                 </div>
@@ -56,6 +56,9 @@
     <script src="/other/mybjq/kindeditor-min.js"></script>
     <script src="/other/mybjq/lang/zh_CN.js"></script>
     <script>
+        function GetReserve(obj){
+            console.log($(obj).val());
+        }
 
 
         //编辑器

+ 20 - 0
OpModels/PosCoupons.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.OpModels
+{
+    public partial class PosCoupons
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public int PosCouponId { get; set; }
+        public int OpId { get; set; }
+    }
+}

+ 21 - 0
OpModels/PosMachines.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.OpModels
+{
+    public partial class PosMachines
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public int PosId { get; set; }
+        public int OpId { get; set; }
+        public int BrandId { get; set; }
+    }
+}

+ 22 - 0
OpModels/StoreActMerDaySummary.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.OpModels
+{
+    public partial class StoreActMerDaySummary
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public int ActCount { get; set; }
+        public int BrandId { get; set; }
+        public string TradeDate { get; set; }
+        public int OpId { get; set; }
+    }
+}

+ 22 - 0
OpModels/StoreActMerMonthSummary.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.OpModels
+{
+    public partial class StoreActMerMonthSummary
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public int ActCount { get; set; }
+        public int BrandId { get; set; }
+        public string TradeMonth { get; set; }
+        public int OpId { get; set; }
+    }
+}

+ 22 - 0
OpModels/StoreSendDaySummary.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.OpModels
+{
+    public partial class StoreSendDaySummary
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public int SendCount { get; set; }
+        public int BrandId { get; set; }
+        public string TradeDate { get; set; }
+        public int OpId { get; set; }
+    }
+}

+ 22 - 0
OpModels/StoreSendMonthSummary.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+
+namespace MySystem.OpModels
+{
+    public partial class StoreSendMonthSummary
+    {
+        public int Id { get; set; }
+        public int Sort { get; set; }
+        public int QueryCount { get; set; }
+        public int Status { get; set; }
+        public DateTime? CreateDate { get; set; }
+        public DateTime? UpdateDate { get; set; }
+        public string SeoTitle { get; set; }
+        public string SeoKeyword { get; set; }
+        public string SeoDescription { get; set; }
+        public int SendCount { get; set; }
+        public int BrandId { get; set; }
+        public string TradeMonth { get; set; }
+        public int OpId { get; set; }
+    }
+}

+ 1 - 0
OpModels/SysAdmin.cs

@@ -30,5 +30,6 @@ namespace MySystem.OpModels
         public string RealName { get; set; }
         public string Password { get; set; }
         public string AdminName { get; set; }
+        public int TotalMachineCount { get; set; }
     }
 }

+ 245 - 3
OpModels/WebCMSEntities.cs

@@ -39,12 +39,18 @@ namespace MySystem.OpModels
         public virtual DbSet<PosCouponMonthSummary> PosCouponMonthSummary { get; set; }
         public virtual DbSet<PosCouponOrders> PosCouponOrders { get; set; }
         public virtual DbSet<PosCouponRecord> PosCouponRecord { get; set; }
+        public virtual DbSet<PosCoupons> PosCoupons { get; set; }
+        public virtual DbSet<PosMachines> PosMachines { get; set; }
         public virtual DbSet<PublicAccountSet> PublicAccountSet { get; set; }
         public virtual DbSet<RightDic> RightDic { get; set; }
         public virtual DbSet<SendDaySummary> SendDaySummary { get; set; }
         public virtual DbSet<SendMonthSummary> SendMonthSummary { get; set; }
+        public virtual DbSet<StoreActMerDaySummary> StoreActMerDaySummary { get; set; }
+        public virtual DbSet<StoreActMerMonthSummary> StoreActMerMonthSummary { get; set; }
         public virtual DbSet<StoreForOperate> StoreForOperate { get; set; }
         public virtual DbSet<StoreMachineApply> StoreMachineApply { get; set; }
+        public virtual DbSet<StoreSendDaySummary> StoreSendDaySummary { get; set; }
+        public virtual DbSet<StoreSendMonthSummary> StoreSendMonthSummary { get; set; }
         public virtual DbSet<SysAdmin> SysAdmin { get; set; }
         public virtual DbSet<SysAdminRole> SysAdminRole { get; set; }
         public virtual DbSet<SysLog> SysLog { get; set; }
@@ -103,7 +109,7 @@ namespace MySystem.OpModels
                 entity.Property(e => e.Status).HasColumnType("int(11)");
 
                 entity.Property(e => e.TradeDate)
-                    .HasColumnType("varchar(6)")
+                    .HasColumnType("varchar(8)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
@@ -1335,7 +1341,7 @@ namespace MySystem.OpModels
                 entity.Property(e => e.Status).HasColumnType("int(11)");
 
                 entity.Property(e => e.TradeDate)
-                    .HasColumnType("varchar(6)")
+                    .HasColumnType("varchar(8)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
@@ -1570,6 +1576,76 @@ namespace MySystem.OpModels
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<PosCoupons>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.OpId).HasColumnType("int(11)");
+
+                entity.Property(e => e.PosCouponId).HasColumnType("int(11)");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+            });
+
+            modelBuilder.Entity<PosMachines>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.BrandId).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.OpId).HasColumnType("int(11)");
+
+                entity.Property(e => e.PosId).HasColumnType("int(11)");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+            });
+
             modelBuilder.Entity<PublicAccountSet>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -1834,7 +1910,7 @@ namespace MySystem.OpModels
                 entity.Property(e => e.Status).HasColumnType("int(11)");
 
                 entity.Property(e => e.TradeDate)
-                    .HasColumnType("varchar(6)")
+                    .HasColumnType("varchar(8)")
                     .HasCharSet("utf8")
                     .HasCollation("utf8_general_ci");
 
@@ -1901,6 +1977,88 @@ namespace MySystem.OpModels
                 entity.Property(e => e.Version).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<StoreActMerDaySummary>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.ActCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.BrandId).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.OpId).HasColumnType("int(11)");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.TradeDate)
+                    .HasColumnType("varchar(8)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+            });
+
+            modelBuilder.Entity<StoreActMerMonthSummary>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.ActCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.BrandId).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.OpId).HasColumnType("int(11)");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.TradeMonth)
+                    .HasColumnType("varchar(6)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+            });
+
             modelBuilder.Entity<StoreForOperate>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -2007,6 +2165,88 @@ namespace MySystem.OpModels
                 entity.Property(e => e.UserId).HasColumnType("int(11)");
             });
 
+            modelBuilder.Entity<StoreSendDaySummary>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.BrandId).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.OpId).HasColumnType("int(11)");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.SendCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.TradeDate)
+                    .HasColumnType("varchar(8)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+            });
+
+            modelBuilder.Entity<StoreSendMonthSummary>(entity =>
+            {
+                entity.Property(e => e.Id).HasColumnType("int(11)");
+
+                entity.Property(e => e.BrandId).HasColumnType("int(11)");
+
+                entity.Property(e => e.CreateDate).HasColumnType("datetime");
+
+                entity.Property(e => e.OpId).HasColumnType("int(11)");
+
+                entity.Property(e => e.QueryCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.SendCount).HasColumnType("int(11)");
+
+                entity.Property(e => e.SeoDescription)
+                    .HasColumnType("varchar(500)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoKeyword)
+                    .HasColumnType("varchar(200)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.SeoTitle)
+                    .HasColumnType("varchar(100)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.Sort).HasColumnType("int(11)");
+
+                entity.Property(e => e.Status).HasColumnType("int(11)");
+
+                entity.Property(e => e.TradeMonth)
+                    .HasColumnType("varchar(6)")
+                    .HasCharSet("utf8")
+                    .HasCollation("utf8_general_ci");
+
+                entity.Property(e => e.UpdateDate).HasColumnType("datetime");
+            });
+
             modelBuilder.Entity<SysAdmin>(entity =>
             {
                 entity.Property(e => e.Id).HasColumnType("int(11)");
@@ -2093,6 +2333,8 @@ namespace MySystem.OpModels
 
                 entity.Property(e => e.StoreCount).HasColumnType("int(11)");
 
+                entity.Property(e => e.TotalMachineCount).HasColumnType("int(11)");
+
                 entity.Property(e => e.UpdateDate).HasColumnType("datetime");
 
                 entity.Property(e => e.UpdateMan)