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

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

@ -17,4 +17,11 @@ namespace Win.Sfs.SettleAccount
* 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.BTSeqKBDiffReports;
using Win.Sfs.SettleAccount.BTStockUnsettledDiffReports;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.EstimatedStockDiffReports;
using Win.Sfs.SettleAccount.JFNotConsignReports;
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),
//typeof(InventoryDetailRepository));
context.Services.AddTransient(typeof(UnInterfaceEfCoreRepository<>));
context.Services.AddTransient(typeof(WMSEfCoreRepository<>));
context.Services.AddTransient(typeof(INormalEfCoreRepository<,>),
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
{
[ConnectionStringName("UnInterface")]
public class UnInterfaceDbContext : AbpDbContext<UnInterfaceDbContext>
public class UnInterfaceDbContext : AbpDbContext<UnInterfaceDbContext>, IUnInterfaceDbContext
{
#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.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
@ -23,20 +24,22 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob
: base(dbContextProvider)
{
}
[UnitOfWork(false)]
public virtual bool Execute(string billnum,string date)
{
string sqlString =
"DECLARE\t@return_value int\n" +
"EXEC\t@return_value = [dbo].[p_wms_output_jit1]\n" +
"@billnum = N'{0}',\n" +
"@type = 1,\n" +
"@type = 0,\n" +
"@date = N'{1}'\n" +
"SELECT\t'Return Value' = @return_value\n";
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;

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

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

Loading…
Cancel
Save