소스 검색

Merge branch 'dev' of http://123.60.180.165:4647/ZZYDOP/DOPCore into dev

heteng 2 년 전
부모
커밋
435fb21bfe

+ 23 - 5
MicroServices/Business/Business.Application/ResourceExamineManagement/ResourceExamineAppService.cs

@@ -3,6 +3,7 @@ using Business.Core.MongoDBHelper;
 using Business.Core.Utilities;
 using Business.EntityFrameworkCore;
 using Business.ResourceExamineManagement.Dto;
+using Bussiness.EntityFrameworkCore.SqlRepositories;
 using Bussiness.Model.Bang;
 using Bussiness.Model.MES.IC;
 using Bussiness.Model.Production;
@@ -17,8 +18,6 @@ using Microsoft.EntityFrameworkCore;
 using MongoDB.Driver;
 using MongoDB.Driver.Linq;
 using Newtonsoft.Json;
-using Spire.Pdf.Exporting.XPS.Schema;
-using Spire.Pdf.General.Render.Decode.Jpeg2000.j2k.wavelet.synthesis;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -28,10 +27,7 @@ using Volo.Abp.Application.Services;
 using Volo.Abp.DependencyInjection;
 using Volo.Abp.Domain.Repositories;
 using Volo.Abp.MultiTenancy;
-using Volo.Abp.ObjectMapping;
 using Z.EntityFramework.Plus;
-using ZstdSharp.Unsafe;
-using static Spire.Pdf.General.Render.Decode.Jpeg2000.j2k.codestream.HeaderInfo;
 
 namespace Business.ResourceExamineManagement
 {
@@ -236,6 +232,7 @@ namespace Business.ResourceExamineManagement
 
         private readonly BusinessBangDbContext _businessBangDbContext;
         private readonly BusinessDbContext _businessDbContext;
+        private readonly ISqlRepository<TagMaster> _tagMasterRepository;
         #endregion
 
         #region 构造函数
@@ -297,6 +294,7 @@ namespace Business.ResourceExamineManagement
             IRepository<b_purchase, long> mysql_purchase,
             IRepository<b_purchase_occupy, long> mysql_purchase_occupy,
             IRepository<b_bom_pretreatment, long> mysql_b_bom_pretreatment,
+            ISqlRepository<TagMaster> tagMasterRepository,
             PretreatmentAppService pretreatmentAppService,
             CalcBomViewAppService calcbomviewAppService,
             PurchaseOrderAppService purchaseOrderAppService,
@@ -355,6 +353,7 @@ namespace Business.ResourceExamineManagement
             _mysql_purchase = mysql_purchase;
             _mysql_purchase_occupy = mysql_purchase_occupy;
             _mysql_b_bom_pretreatment = mysql_b_bom_pretreatment;
+            _tagMasterRepository = tagMasterRepository;
             _pretreatmentAppService = pretreatmentAppService;
             _CalcBomViewAppService = calcbomviewAppService;
             _purchaseOrderAppService = purchaseOrderAppService;
@@ -373,6 +372,25 @@ namespace Business.ResourceExamineManagement
         /// <exception cref="NotImplementedException"></exception>
         public async Task<string> ReceiveResult(ResourceCheckInputDto input)
         {
+            //TagMaster tagMaster=new TagMaster();
+            //tagMaster.Domain = "1000";
+            //tagMaster.Nbr = "20230505002"+DateTime.Now.Second.ToString();
+            //tagMaster.Type = "Q";
+            //tagMaster.Print = false;
+            //tagMaster.Void= false;
+            //tagMaster.Posted= false;
+            //tagMaster.BusinessID = 0;
+            //tagMaster.CreateUser = "admin";
+            //tagMaster.UpdateUser = "admin";
+            //tagMaster.CreateTime = DateTime.Now;
+            //tagMaster.UpdateTime= DateTime.Now;
+            //tagMaster.IsActive= true;
+            //tagMaster.IsConfirm= true;
+            //tagMaster.IsChanged= true;
+            //tagMaster.InvTitle = "线边库存核查";
+            //await _tagMasterRepository.Insert(tagMaster);
+            //var test= _tagMasterRepository.Select(a => a.CreateUser == "admin");
+            //return JsonConvert.SerializeObject(test.Result);
             //资源检查入参全局变量赋值
             param.sorderId = input.sorderId;
             param.tenantId = input.tenantId;

+ 5 - 0
MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/BusinessDbContextModelCreatingExtensions.cs

@@ -630,6 +630,11 @@ namespace Business.EntityFrameworkCore
                 b.Property(x => x.Id).ValueGeneratedNever();//迁移sqlserver默认是自增,需要配置一下
             });
 
+            builder.Entity<TagMaster>(b =>
+            {
+                b.HasKey(a=>a.RecID);
+            });
+
             //Code generation...
 
             //添加表名字段名描述属性,请放在最后,会导致NotMap不生效

+ 1 - 0
MicroServices/Business/Business.EntityFrameworkCore/EntityFrameworkCore/DOP/BusinessDbContext.cs

@@ -69,6 +69,7 @@ namespace Business.EntityFrameworkCore
 
         #region Sale
         public DbSet<crm_seorder> crm_seorder { get; set; }
+        public DbSet<TagMaster> TagMaster { get; set; }
         public DbSet<crm_seorderentry> crm_seorderentry { get; set; }
         public DbSet<crm_seorderprog> crm_seorderprog { get; set; }
         public DbSet<crm_seorderreview> crm_seorderreview { get; set; }

+ 29 - 0
MicroServices/Business/Business.EntityFrameworkCore/Repository/SqlRepositories/ISqlRepository.cs

@@ -0,0 +1,29 @@
+using Microsoft.EntityFrameworkCore.ChangeTracking;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.SqlClient;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+
+namespace Bussiness.EntityFrameworkCore.SqlRepositories
+{
+    public interface ISqlRepository<T> where T : class, new()
+    {
+        Task<int> Insert(T entity);
+
+        Task<int> Update(T entity);
+
+        Task<int> Update(Expression<Func<T, bool>> whereLambda, Expression<Func<T, T>> entity);
+
+        Task<int> Delete(Expression<Func<T, bool>> whereLambda);
+
+        Task<bool> IsExist(Expression<Func<T, bool>> whereLambda);
+
+        Task<List<T>> Select();
+
+        Task<List<T>> Select(Expression<Func<T, bool>> whereLambda);
+
+        Task<Tuple<List<T>, int>> Select<S>(int pageSize, int pageIndex, Expression<Func<T, bool>> whereLambda, Expression<Func<T, S>> orderByLambda, bool isAsc);
+    }
+}

+ 89 - 0
MicroServices/Business/Business.EntityFrameworkCore/Repository/SqlRepositories/SqlRepository.cs

@@ -0,0 +1,89 @@
+using System;
+using System.Collections.Generic;
+using System.Data.Common;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.DependencyInjection;
+using Volo.Abp.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
+using System.Collections;
+using Business.EntityFrameworkCore;
+using System.Linq.Expressions;
+using Z.EntityFramework.Plus;
+
+namespace Bussiness.EntityFrameworkCore.SqlRepositories
+{
+    public class SqlRepository<T>:ISqlRepository<T> where T : class, new()
+    {
+        private IDbContextProvider<BusinessDbContext> _dbContextProvider;
+
+        public SqlRepository(IDbContextProvider<BusinessDbContext> dbContextProvider)
+        {
+            _dbContextProvider = dbContextProvider;
+        }
+        public  async Task<int> Insert(T entity)
+        {
+            _dbContextProvider.GetDbContext().Set<T>().Add(entity);
+            return await _dbContextProvider.GetDbContext().SaveChangesAsync();
+        }
+
+        public async Task<int> Update(T entity)
+        {
+            _dbContextProvider.GetDbContext().Set<T>().Update(entity);
+           return await _dbContextProvider.GetDbContext().SaveChangesAsync();
+        }
+
+        public  async Task<int> Update(Expression<Func<T, bool>> whereLambda, Expression<Func<T, T>> entity)
+        {
+            _dbContextProvider.GetDbContext().Set<T>().Where(whereLambda).Update(entity);
+            return await _dbContextProvider.GetDbContext().SaveChangesAsync();
+        }
+
+        public  async Task<int> Delete(Expression<Func<T, bool>> whereLambda)
+        {
+            _dbContextProvider.GetDbContext().Set<T>().Where(whereLambda).Delete();
+            return await _dbContextProvider.GetDbContext().SaveChangesAsync();
+        }
+
+        public  async Task<bool> IsExist(Expression<Func<T, bool>> whereLambda)
+        {
+            return await _dbContextProvider.GetDbContext().Set<T>().AnyAsync(whereLambda);
+        }
+
+        public  async Task<List<T>> Select()
+        {
+            return await _dbContextProvider.GetDbContext().Set<T>().ToListAsync();
+        }
+
+        public  async Task<List<T>> Select(Expression<Func<T, bool>> whereLambda)
+        {
+            return await _dbContextProvider.GetDbContext().Set<T>().Where(whereLambda).ToListAsync();
+        }
+
+        public  async Task<Tuple<List<T>, int>> Select<S>(int pageSize, int pageIndex, Expression<Func<T, bool>> whereLambda, Expression<Func<T, S>> orderByLambda, bool isAsc)
+        {
+            var total = _dbContextProvider.GetDbContext().Set<T>().Where(whereLambda).Count();
+
+            if (isAsc)
+            {
+                var entities = await _dbContextProvider.GetDbContext().Set<T>().Where(whereLambda)
+                                      .OrderBy<T, S>(orderByLambda)
+                                      .Skip(pageSize * (pageIndex - 1))
+                                      .Take(pageSize).ToListAsync();
+
+                return  new Tuple<List<T>, int>(entities, total);
+            }
+            else
+            {
+                var entities =await _dbContextProvider.GetDbContext().Set<T>().Where(whereLambda)
+                                      .OrderByDescending<T, S>(orderByLambda)
+                                      .Skip(pageSize * (pageIndex - 1))
+                                      .Take(pageSize).ToListAsync();
+
+                return new Tuple<List<T>, int>(entities, total);
+            }
+        }
+    }
+}

+ 0 - 19
MicroServices/Business/Business.EntityFrameworkCore/Repository/sim_baseRepository.cs

@@ -1,19 +0,0 @@
-using Business.Domain;
-using Bussiness.Model.SIM;
-using Microsoft.EntityFrameworkCore;
-using System.Threading;
-using System.Threading.Tasks;
-using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
-using Volo.Abp.EntityFrameworkCore;
-
-namespace Business.EntityFrameworkCore.Repository
-{
-    public class sim_baseRepository : EfCoreRepository<BusinessDbContext, sim_base, long>, Isim_baseRepository
-    {
-        public sim_baseRepository(IDbContextProvider<BusinessDbContext> dbContextProvider)
-            : base(dbContextProvider)
-        {
-
-        }
-    }
-}

+ 0 - 24
MicroServices/Business/Business.EntityFrameworkCore/Repository/sim_issue_typeRepository.cs

@@ -1,24 +0,0 @@
-using Business.Domain;
-using Bussiness.Model.SIM;
-using Microsoft.EntityFrameworkCore;
-using System.Threading;
-using System.Threading.Tasks;
-using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
-using Volo.Abp.EntityFrameworkCore;
-
-namespace Business.EntityFrameworkCore.Repository
-{
-    public class sim_issue_typeRepository : EfCoreRepository<BusinessDbContext, sim_issue_type, long>, Isim_issue_typeRepository
-    {
-        public sim_issue_typeRepository(IDbContextProvider<BusinessDbContext> dbContextProvider)
-            : base(dbContextProvider)
-        {
-
-        }
-
-        public async Task<sim_issue_type> FindByItemNameAsync(string itemName, CancellationToken cancellationToken = default)
-        {
-            return await(await GetDbSetAsync()).FirstOrDefaultAsync(p => p.type_name ==itemName, GetCancellationToken(cancellationToken));
-        }
-    }
-}

+ 2 - 0
MicroServices/Business/Business.Host/Startup.cs

@@ -1,4 +1,5 @@
 using Business.Core.MongoDBHelper;
+using Bussiness.EntityFrameworkCore.SqlRepositories;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.Extensions.DependencyInjection;
@@ -13,6 +14,7 @@ namespace Business
             services.AddApplication<BusinessHostModule>();
             //MongoDBHelperÒÀÀµ×¢Èë
             services.AddScoped(typeof(IMongoDB<>), typeof(MongoDBTools<>));
+            services.AddScoped(typeof(ISqlRepository<>), typeof(SqlRepository<>));
             services.AddScoped<Config>();
         }
 

+ 5 - 1
MicroServices/Business/Bussiness.Model/MES/IC/ic_bom_child.cs

@@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore;
 using MongoDB.Bson.Serialization.Attributes;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
 
 namespace Bussiness.Model.MES.IC
 {
@@ -146,12 +147,15 @@ namespace Bussiness.Model.MES.IC
         [Comment("序号")]
         public int? child_num { get; set; }
 
-       /// <summary>
+        /// <summary>
         /// 版本
         /// </summary>
         [StringLength(80)]
         [Comment("版本")]
         public string? version { get; set; }
+
+        [ForeignKey("Id")]
+        public virtual ic_bom Bom { get; set; }
     }
 }
 

+ 108 - 0
MicroServices/Business/Bussiness.Model/Sale/TagMaster.cs

@@ -0,0 +1,108 @@
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Internal;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Principal;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Entities;
+
+namespace Bussiness.Model.Sale
+{
+    /// <summary>
+    /// 盘点单主表
+    ///</summary>
+    [Comment("TagMaster")]
+    public class TagMaster
+    {
+        /// <summary>
+        /// 域名 
+        /// 默认值: ('')
+        ///</summary>
+        public string? Domain { get; set; }
+        /// <summary>
+        /// 单号 
+        /// 默认值: ('')
+        ///</summary>
+        public string Nbr { get; set; }
+        /// <summary>
+        /// 类型 
+        /// 默认值: ('')
+        ///</summary>
+        public string Type { get; set; }
+        /// <summary>
+        /// 打印 
+        /// 默认值: ((0))
+        ///</summary>
+        public bool Print { get; set; }
+        /// <summary>
+        /// 无效 
+        /// 默认值: ((0))
+        ///</summary>
+ 
+        public bool Void { get; set; }
+        /// <summary>
+        /// 邮政编码 
+        /// 默认值: ((0))
+        ///</summary>
+        public bool Posted { get; set; }
+        /// <summary>
+        /// 业务流程ID 
+        /// 默认值: ((0))
+        ///</summary>
+ 
+        public long BusinessID { get; set; }
+        /// <summary>
+        /// 创建用户 
+        /// 默认值: ('')
+        ///</summary>
+        public string? CreateUser { get; set; }
+        /// <summary>
+        /// 更新用户 
+        /// 默认值: ('')
+        ///</summary>
+        public string? UpdateUser { get; set; }
+        /// <summary>
+        /// 创建时间 
+        ///</summary>
+        public DateTime? CreateTime { get; set; }
+        /// <summary>
+        /// 更新时间 
+        ///</summary>
+        public DateTime? UpdateTime { get; set; }
+        /// <summary>
+        /// 失效时间 
+        ///</summary>
+        public DateTime? EffTime { get; set; }
+        /// <summary>
+        /// 有效 
+        /// 默认值: ((0))
+        ///</summary>
+        public bool IsActive { get; set; }
+        /// <summary>
+        /// 确认 
+        /// 默认值: ((0))
+        ///</summary>
+        public bool IsConfirm { get; set; }
+        /// <summary>
+        /// 自增列 
+        ///</summary>
+        public int RecID { get; set; }
+        /// <summary>
+        /// 是否改变 
+        /// 默认值: ((0))
+        ///</summary>
+        public bool IsChanged { get; set; }
+        /// <summary>
+        /// 库位标题 
+        /// 默认值: ('')
+        ///</summary>
+        public string InvTitle { get; set; }
+        /// <summary>
+        ///  
+        /// 默认值: ('')
+        ///</summary>
+        public string? ProdLine { get; set; }
+    }
+}