Browse Source

更新版本

FoShanPG
Administrator 2 years ago
parent
commit
1c907f6efb
  1. 18
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs
  2. 7
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ISettleAccountDbContext.cs
  3. 8
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountEntityFrameworkCoreModule.cs
  4. 149
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/UnInterfaceDapperRepository.cs
  5. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/UnInterfaceDbContext.cs
  6. 9
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/WmsJitOutput/WmsJitOutputDapperRepository.cs
  7. 12
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/FisOutputService.cs

18
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/WMS/WMSJitAppService.cs

@ -56,6 +56,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
/// wms出库 /// wms出库
/// </summary> /// </summary>
//[Authorize(SettleAccountPermissions.WMSJIT.Default)] //[Authorize(SettleAccountPermissions.WMSJIT.Default)]
[AllowAnonymous]
[Route("api/settleaccount/wmsjitoutput")] [Route("api/settleaccount/wmsjitoutput")]
public class WMSJitAppService : public class WMSJitAppService :
@ -91,7 +92,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager, ICommonManager commonManager,
ErpPartDapperRepository repository ErpPartDapperRepository repository,
TaskJobService service
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) ) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{ {
@ -102,6 +104,7 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
_wmsefRespository = wmsefRespository; _wmsefRespository = wmsefRespository;
_excelImportService = excelImportService; _excelImportService = excelImportService;
_repository = repository; _repository = repository;
_service = service;
} }
@ -505,23 +508,16 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
[HttpPost] [HttpPost]
[Route("WmsJitOutPut-Pass")] [Route("WmsJitOutPut-Pass")]
[UnitOfWork(false)] [UnitOfWork(false)]
[Authorize(SettleAccountPermissions.WMSJIT.Create)]
public async Task<bool> WmsJitOutPutPass(WmsJitRequestDto input) public async Task<bool> WmsJitOutPutPass(WmsJitRequestDto input)
{ {
List<CustomCondition> customConditionList = new List<CustomCondition>(); List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "BillNum", Value = input.BillNum ?? string.Empty }); customConditionList.Add(new CustomCondition() { Name = "BillNum", Value = input.BillNum ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "Date", Value = input.AccountDate.ToString() }); customConditionList.Add(new CustomCondition() { Name = "Date", Value = input.AccountDate.ToString() });
var _taskid = await _service.ExportEnqueueAsync("准时化出库服务"+input.BillNum, ExportExtentsion.Excel, input.Version, string.Empty, CurrentUser, typeof(FisOutputService), customConditionList, (rs) => var _taskid = await _service.ExportEnqueueAsync("准时化出库服务"+input.BillNum, ExportExtentsion.Excel, input.Version, string.Empty, CurrentUser, typeof(FisOutputService), customConditionList, (rs) =>
{ {
}); });
//var sql = "DECLARE @return_value int\n" + //var sql = "DECLARE @return_value int\n" +
// "EXEC @return_value = [dbo].[p_wms_output]\n" + // "EXEC @return_value = [dbo].[p_wms_output]\n" +
// " @billnum = N'{0}',\n" + // " @billnum = N'{0}',\n" +
@ -531,6 +527,10 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts
// await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync( // await _wmsRepository.GetDbContext().Database.ExecuteSqlRawAsync(
// string.Format(sql,input.BillNum,input.AccountDate.ToShortDateString()) // string.Format(sql,input.BillNum,input.AccountDate.ToShortDateString())
// ); // );
return true; return true;
} }

7
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ISettleAccountDbContext.cs

@ -17,4 +17,11 @@ namespace Win.Sfs.SettleAccount
* DbSet<Question> Questions { get; } * DbSet<Question> Questions { get; }
*/ */
} }
[ConnectionStringName("UnInterface")]
public interface IUnInterfaceDbContext : IEfCoreDbContext
{
/* Add DbSet for each Aggregate Root here. Example:
* DbSet<Question> Questions { get; }
*/
}
} }

8
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountEntityFrameworkCoreModule.cs

@ -11,6 +11,7 @@ using Volo.Abp.TenantManagement.EntityFrameworkCore;
using Win.Sfs.SettleAccount.BTNotConsignReports; using Win.Sfs.SettleAccount.BTNotConsignReports;
using Win.Sfs.SettleAccount.BTSeqKBDiffReports; using Win.Sfs.SettleAccount.BTSeqKBDiffReports;
using Win.Sfs.SettleAccount.BTStockUnsettledDiffReports; using Win.Sfs.SettleAccount.BTStockUnsettledDiffReports;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.EstimatedStockDiffReports; using Win.Sfs.SettleAccount.EstimatedStockDiffReports;
using Win.Sfs.SettleAccount.JFNotConsignReports; using Win.Sfs.SettleAccount.JFNotConsignReports;
using Win.Sfs.SettleAccount.Repository; using Win.Sfs.SettleAccount.Repository;
@ -62,13 +63,18 @@ namespace Win.Sfs.SettleAccount
}); });
context.Services.AddAbpDbContext<UnInterfaceDbContext>(options =>
{
options.AddDefaultRepositories();
});
// context.Services.AddTransient(typeof(IInventoryDetailRepository), // context.Services.AddTransient(typeof(IInventoryDetailRepository),
//typeof(InventoryDetailRepository)); //typeof(InventoryDetailRepository));
context.Services.AddTransient(typeof(UnInterfaceEfCoreRepository<>));
context.Services.AddTransient(typeof(WMSEfCoreRepository<>)); context.Services.AddTransient(typeof(WMSEfCoreRepository<>));
context.Services.AddTransient(typeof(INormalEfCoreRepository<,>), context.Services.AddTransient(typeof(INormalEfCoreRepository<,>),
typeof(SettleAccountNormalEfCoreRepository<,>)); typeof(SettleAccountNormalEfCoreRepository<,>));

149
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/UnInterfaceDapperRepository.cs

@ -0,0 +1,149 @@
using Dapper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
namespace Win.Sfs.SettleAccount
{
public class FisOutputDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency
{
public FisOutputDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
[UnitOfWork(false)]
public virtual bool Execute(string server,string billnum, string date)
{
string sqlString =
"DECLARE\t@return_value int\n" +
"EXEC\t@return_value = [dbo].[p_wms_output_jit]\n" +
"@billnum = N'{1}',\n" +
"@type = 0,\n" +
"@date = N'{2}'\n" +
"SELECT\t'Return Value' = @return_value\n";
string _sql = string.Format(sqlString,server, billnum, date);
var _query = DbConnection.ExecuteScalar(_sql, null, null, 1200, System.Data.CommandType.Text);
return true;
}
public virtual async Task<List<T>> GetListBySqlAsync<T>(string sql, bool isTrans = false)
{
if (isTrans)
{
IDbConnection conn = await GetDbConnectionAsync();
IDbTransaction trans = await GetDbTransactionAsync();
return (await conn.QueryAsync<T>(sql, null, trans))
.ToList();
}
else
{
IDbConnection conn = await GetDbConnectionAsync();
return (await conn.QueryAsync<T>(sql))
.ToList();
}
}
public virtual async Task<T> GetSingleBySqlAsync<T>(string sql, bool isTrans = false)
{
if (isTrans)
{
IDbConnection conn = await GetDbConnectionAsync();
IDbTransaction trans = await GetDbTransactionAsync();
return await conn.QuerySingleOrDefaultAsync<T>(sql, null, trans);
}
else
{
IDbConnection conn = await GetDbConnectionAsync();
return await conn.QuerySingleOrDefaultAsync<T>(sql);
}
}
public virtual async Task<int> ExecuteSqlAsync(string sql, object obj = null, bool isTrans = false)
{
if (isTrans)
{
//return await DbConnection.ExecuteAsync("update People set Name = @NewName", new { NewName = name }, DbTransaction);
IDbConnection conn = await GetDbConnectionAsync();
IDbTransaction trans = await GetDbTransactionAsync();
return await conn.ExecuteAsync(sql, obj, trans);
}
else
{
//return await DbConnection.ExecuteAsync("update People set Name = @NewName", new { NewName = name }, DbTransaction);
IDbConnection conn = await GetDbConnectionAsync();
return await conn.ExecuteAsync(sql, obj);
}
}
#region 同步方法
public virtual List<T> GetListBySql<T>(string sql, bool isTrans = false)
{
if (isTrans)
{
IDbConnection conn = GetDbConnectionAsync().GetAwaiter().GetResult();
IDbTransaction trans = GetDbTransactionAsync().GetAwaiter().GetResult();
return (conn.Query<T>(sql, null, trans))
.ToList();
}
else
{
IDbConnection conn = (IDbConnection)GetDbConnectionAsync().GetAwaiter().GetResult();
return (conn.Query<T>(sql))
.ToList();
}
}
public virtual T GetSingleBySql<T>(string sql, bool isTrans = false)
{
if (isTrans)
{
IDbConnection conn = GetDbConnectionAsync().GetAwaiter().GetResult();
IDbTransaction trans = GetDbTransactionAsync().GetAwaiter().GetResult();
return conn.QuerySingleOrDefault<T>(sql, null, trans);
}
else
{
IDbConnection conn = (IDbConnection)GetDbConnectionAsync().GetAwaiter().GetResult();
return conn.QuerySingleOrDefault<T>(sql);
}
}
public virtual int ExecuteSql(string sql, object obj = null, bool isTrans = false)
{
if (isTrans)
{
IDbConnection conn = GetDbConnectionAsync().GetAwaiter().GetResult();
IDbTransaction trans = GetDbTransactionAsync().GetAwaiter().GetResult();
return conn.Execute(sql, obj, trans);
}
else
{
IDbConnection conn = (IDbConnection)GetDbConnectionAsync().GetAwaiter().GetResult();
return conn.Execute(sql, obj);
}
}
#endregion
}
}

2
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/UnInterfaceDbContext.cs

@ -16,7 +16,7 @@ using WY.NewJit.Extends.PaiGe.WMS;
namespace Win.Sfs.SettleAccount.EntityFrameworkCore namespace Win.Sfs.SettleAccount.EntityFrameworkCore
{ {
[ConnectionStringName("UnInterface")] [ConnectionStringName("UnInterface")]
public class UnInterfaceDbContext : AbpDbContext<UnInterfaceDbContext> public class UnInterfaceDbContext : AbpDbContext<UnInterfaceDbContext>, IUnInterfaceDbContext
{ {
#region DbSet #region DbSet

9
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/WmsJitOutput/WmsJitOutputDapperRepository.cs

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.Dapper; using Volo.Abp.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs; using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
@ -23,20 +24,22 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob
: base(dbContextProvider) : base(dbContextProvider)
{ {
} }
[UnitOfWork(false)]
public virtual bool Execute(string billnum,string date) public virtual bool Execute(string billnum,string date)
{ {
string sqlString = string sqlString =
"DECLARE\t@return_value int\n" + "DECLARE\t@return_value int\n" +
"EXEC\t@return_value = [dbo].[p_wms_output_jit1]\n" + "EXEC\t@return_value = [dbo].[p_wms_output_jit1]\n" +
"@billnum = N'{0}',\n" + "@billnum = N'{0}',\n" +
"@type = 1,\n" + "@type = 0,\n" +
"@date = N'{1}'\n" + "@date = N'{1}'\n" +
"SELECT\t'Return Value' = @return_value\n"; "SELECT\t'Return Value' = @return_value\n";
string _sql = string.Format(sqlString, billnum,date); string _sql = string.Format(sqlString, billnum,date);
var _query = DbConnection.ExecuteScalar(_sql,null,null,1200,System.Data.CommandType.StoredProcedure); var _query = DbConnection.ExecuteScalar(_sql,null,null,1200,System.Data.CommandType.Text);
return true; return true;

12
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/FisOutputService.cs

@ -6,6 +6,8 @@ using System.Threading.Tasks;
using TaskJob.EventArgs; using TaskJob.EventArgs;
using TaskJob.Interfaces; using TaskJob.Interfaces;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs; using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
using Win.Sfs.SettleAccount.Repository.SettleAccount; using Win.Sfs.SettleAccount.Repository.SettleAccount;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob; using Win.Sfs.SettleAccount.Repository.SettleAccountJob;
@ -16,14 +18,14 @@ namespace SettleAccount.Job.Services
{ {
private readonly InvoiceSettledDiffRepository _repository; private readonly InvoiceSettledDiffRepository _repository;
private readonly InvoiceSettledDiffVersionRepository _versionRepository; private readonly InvoiceSettledDiffVersionRepository _versionRepository;
private readonly WmsJitOutputDapperRepository _dapperRepository; private readonly FisOutputDapperRepository _dapperRepository;
private readonly OutputService _outputService; private readonly OutputService _outputService;
private readonly InputService _inputService; private readonly InputService _inputService;
public FisOutputService( public FisOutputService(
InvoiceSettledDiffRepository repository, InvoiceSettledDiffRepository repository,
InvoiceSettledDiffVersionRepository versionRepository, InvoiceSettledDiffVersionRepository versionRepository,
WmsJitOutputDapperRepository dapperRepository, FisOutputDapperRepository dapperRepository,
OutputService outputService, OutputService outputService,
InputService inputService InputService inputService
) )
@ -34,14 +36,16 @@ namespace SettleAccount.Job.Services
_versionRepository = versionRepository; _versionRepository = versionRepository;
_dapperRepository=dapperRepository; _dapperRepository=dapperRepository;
} }
[UnitOfWork(false)]
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list) public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
{ {
var billnum = p_list.Where(p => p.Name == "BillNum").FirstOrDefault().Value; var billnum = p_list.Where(p => p.Name == "BillNum").FirstOrDefault().Value;
var date = p_list.Where(p => p.Name == "Date").FirstOrDefault().Value; var date = p_list.Where(p => p.Name == "Date").FirstOrDefault().Value;
var _ls= _dapperRepository.Execute(billnum,date);
var _ls= _dapperRepository.Execute("192.168.0.63",billnum,date);
return id.ToString(); return id.ToString();
} }

Loading…
Cancel
Save