学 赵
1 year ago
55 changed files with 23327 additions and 655 deletions
@ -1,14 +1,29 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.SignalR; |
|||
using SettleAccount.Job.SignalR; |
|||
using Volo.Abp.AspNetCore.Mvc; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Controllers |
|||
{ |
|||
public class HomeController : AbpController |
|||
{ |
|||
private readonly IHubContext<PageHub> _hubContext; |
|||
|
|||
public HomeController(IHubContext<PageHub> hubContext) |
|||
{ |
|||
this._hubContext = hubContext; |
|||
} |
|||
|
|||
[ResponseCache(NoStore = true)] |
|||
public ActionResult Index() |
|||
{ |
|||
return File("~/index.html", "text/html"); |
|||
} |
|||
|
|||
public IActionResult Test() |
|||
{ |
|||
this._hubContext.Clients.All.ServerToClient("test", "hello", ""); |
|||
return Json("ok"); |
|||
} |
|||
} |
|||
} |
|||
|
@ -1,3 +1,7 @@ |
|||
{ |
|||
"compilerOptions": { |
|||
"baseUrl": "./", |
|||
"target": "ES6" |
|||
}, |
|||
"exclude": ["node_modules", "files", "btsecsummary", "secsummary"] |
|||
} |
|||
|
@ -0,0 +1,21 @@ |
|||
using System; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Attributes |
|||
{ |
|||
/// <summary>
|
|||
/// Excel导入头部描述
|
|||
/// </summary>
|
|||
[AttributeUsage(AttributeTargets.Property)] |
|||
public class ExcelImporterHeadDescAttribute : Attribute |
|||
{ |
|||
/// <summary>
|
|||
/// 行数
|
|||
/// </summary>
|
|||
public int Row { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 列数
|
|||
/// </summary>
|
|||
public int Cell { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,123 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Linq.Dynamic.Core; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.OpenApi.Extensions; |
|||
using SettleAccount.Domain.BQ; |
|||
using SettleAccount.Job.Services; |
|||
using SettleAccount.Job.Services.Report; |
|||
using Shouldly; |
|||
using TaskJob.EventArgs; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Caching; |
|||
using Win.Abp.Snowflakes; |
|||
using Win.Sfs.BaseData.ImportExcelCommon; |
|||
using Win.Sfs.SettleAccount.CommonManagers; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
|||
using Win.Sfs.SettleAccount.Entities.TaskJobs; |
|||
using Win.Sfs.SettleAccount.ExcelImporter; |
|||
using Win.Sfs.Shared.Filter; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ; |
|||
|
|||
/// <summary>
|
|||
/// PUB结算明细
|
|||
/// </summary>
|
|||
[AllowAnonymous] |
|||
[Route("api/settleaccount/[controller]/[action]")]
|
|||
public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase<PUB_SA_DETAIL> |
|||
{ |
|||
/// <summary>
|
|||
/// PUB结算明细仓储
|
|||
/// </summary>
|
|||
private readonly INormalEfCoreRepository<PUB_SA_DETAIL, Guid> _pubSaDetailRepository; |
|||
|
|||
/// <summary>
|
|||
/// PUB结算仓储
|
|||
/// </summary>
|
|||
private readonly INormalEfCoreRepository<PUB_SA, Guid> _pubSaRepository; |
|||
|
|||
/// <summary>
|
|||
/// 任务服务
|
|||
/// </summary>
|
|||
private readonly TaskJobService _taskJobService; |
|||
|
|||
/// <summary>
|
|||
/// 构造
|
|||
/// </summary>
|
|||
public PUB_SA_DETAIL_SERVICE(INormalEfCoreRepository<PUB_SA_DETAIL, Guid> pubSaDetailRepository, |
|||
INormalEfCoreRepository<PUB_SA, Guid> pubSaRepository, |
|||
TaskJobService taskJobService, |
|||
IDistributedCache<PUB_SA_DETAIL> cache, |
|||
IExcelImportAppService excelImportService, |
|||
ISnowflakeIdGenerator snowflakeIdGenerator, |
|||
ICommonManager commonManager |
|||
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager) |
|||
{ |
|||
_pubSaDetailRepository = pubSaDetailRepository; |
|||
_pubSaRepository = pubSaRepository; |
|||
_taskJobService = taskJobService; |
|||
} |
|||
|
|||
#region 导出
|
|||
/// <summary>
|
|||
/// 导出
|
|||
/// </summary>
|
|||
[HttpPost] |
|||
public async Task<string> ExportAsync(PUB_SA_DETAIL_EXPORT_REQUEST_DTO input) |
|||
{ |
|||
var pubSaEntity = await _pubSaRepository.FirstOrDefaultAsync(t => t.BillNum == input.BillNum); |
|||
if (pubSaEntity == null) |
|||
{ |
|||
throw new UserFriendlyException($"导出失败,结算单号不存在!", "400"); |
|||
} |
|||
var businessType = pubSaEntity.BusinessType; |
|||
|
|||
var displayName = businessType.ToString(); |
|||
DisplayAttribute attributeOfType = businessType.GetAttributeOfType<DisplayAttribute>(); |
|||
if (attributeOfType != null) |
|||
{ |
|||
displayName = attributeOfType.Name; |
|||
} |
|||
|
|||
string fileName = $"{displayName}的结算数据_{Guid.NewGuid()}.xlsx"; |
|||
List<FilterCondition> filters = new List<FilterCondition>(); |
|||
filters.Add(new FilterCondition("BillNum", input.BillNum, EnumFilterAction.Equal, EnumFilterLogic.And)); |
|||
|
|||
var entities = await _pubSaDetailRepository.GetListByFilterAsync(filters); |
|||
var dtos = ObjectMapper.Map<List<PUB_SA_DETAIL>, List<PUB_SA_DETAIL_EXPORT_DTO>>(entities); |
|||
|
|||
ExportImporter _exportImporter = new ExportImporter(); |
|||
var result = await _exportImporter.ExcelExporter(dtos); |
|||
result.ShouldNotBeNull(); |
|||
|
|||
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }); |
|||
return fileName; |
|||
} |
|||
#endregion
|
|||
|
|||
#region 对比
|
|||
/// <summary>
|
|||
/// Pub结算与发运比对
|
|||
/// </summary>
|
|||
[HttpPost] |
|||
public async Task<string> PubSaSeCompare(PubSaSeCompareRequestDto pubSaSeCompareRequestDto) |
|||
{ |
|||
List<CustomCondition> customConditionList = new List<CustomCondition>(); |
|||
customConditionList.Add(new CustomCondition() { Name = "Version", Value = pubSaSeCompareRequestDto.Version }); |
|||
customConditionList.Add(new CustomCondition() { Name = "BusinessType", Value = pubSaSeCompareRequestDto.BusinessType.ToString() }); |
|||
|
|||
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算与发运数据对比" }); |
|||
var _taskid = await _taskJobService.ExportEnqueueAsync("Pub结算与发运核对汇总表", ExportExtentsion.Excel, pubSaSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(PubSaSeCompareExportService), customConditionList, (rs) => |
|||
{ |
|||
Console.WriteLine("TaskJob 回调了"); |
|||
}); |
|||
return _taskid; |
|||
} |
|||
#endregion
|
|||
} |
@ -0,0 +1,56 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ; |
|||
|
|||
public interface IVmiService : IApplicationService, ITransientDependency, IJobService |
|||
{ |
|||
string Test(); |
|||
|
|||
void In(); |
|||
|
|||
void Out(); |
|||
|
|||
IQueryable<VmiBalance> Query(); |
|||
} |
|||
|
|||
[ApiExplorerSettings(IgnoreApi = true)] |
|||
[AllowAnonymous] |
|||
[Route("api/settleaccount/[controller]/[action]")]
|
|||
public class VmiService : IVmiService |
|||
{ |
|||
[NonAction] |
|||
public void Invoke() |
|||
{ |
|||
Console.WriteLine($"{nameof(VmiService)}:{DateTime.Now}"); |
|||
} |
|||
|
|||
[NonAction] |
|||
public void In() |
|||
{ |
|||
throw new System.NotImplementedException(); |
|||
} |
|||
|
|||
[NonAction] |
|||
public void Out() |
|||
{ |
|||
throw new System.NotImplementedException(); |
|||
} |
|||
|
|||
[HttpPost] |
|||
public IQueryable<VmiBalance> Query() |
|||
{ |
|||
throw new System.NotImplementedException(); |
|||
} |
|||
|
|||
[HttpGet] |
|||
public string Test() |
|||
{ |
|||
return "Test"; |
|||
} |
|||
} |
@ -0,0 +1,6 @@ |
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
public interface IJobService |
|||
{ |
|||
void Invoke(); |
|||
} |
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
public class JobItem : Entity<Guid>, IHasConcurrencyStamp |
|||
{ |
|||
public JobItem() |
|||
{ |
|||
this.Id = Guid.NewGuid(); |
|||
} |
|||
|
|||
public string Name { get; set; } |
|||
public string Cron { get; set; } |
|||
public string Service { get; set; } |
|||
public bool IsRunning { get; set; } |
|||
public List<JobLog> Logs { get; set; } = new List<JobLog>(); |
|||
public string ConcurrencyStamp { get; set; } |
|||
} |
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
public class JobLog : Entity<Guid> |
|||
{ |
|||
public JobItem Job { get; set; } |
|||
public Guid? JobId { get; set; } |
|||
public DateTime Start { get; set; } |
|||
public DateTime End { get; set; } |
|||
public bool Success { get; set; } |
|||
public string Exception { get; set; } |
|||
} |
@ -0,0 +1,35 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
public class VmiBalance : Entity<Guid> |
|||
{ |
|||
/// <summary>
|
|||
/// LU零件号:BBAC发运单BBAC_SE_DETAIL.LU
|
|||
/// </summary>
|
|||
public string LU { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 生产码:BBAC发运单BBAC_SE_DETAIL.PN
|
|||
/// </summary>
|
|||
public string PN { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 生产码类型(01前保、02后保、03门槛等)
|
|||
/// </summary>
|
|||
public int PNType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 发货类型???
|
|||
/// </summary>
|
|||
public string Type { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 数量
|
|||
/// </summary>
|
|||
public decimal Qty { get; set; } |
|||
|
|||
public List<VmiLog> Logs { get; set; } = new List<VmiLog>(); |
|||
} |
@ -0,0 +1,16 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
/// <summary>
|
|||
/// 寄售库存操作分类
|
|||
/// </summary>
|
|||
public class VmiCategory : Entity<Guid> |
|||
{ |
|||
public VmiType Type { get; set; } |
|||
public string Number { get; set; } |
|||
public string Name { get; set; } |
|||
public List<VmiLog> Logs { get; set; } = new List<VmiLog>(); |
|||
} |
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
/// <summary>
|
|||
/// 寄售库存操作记录
|
|||
/// </summary>
|
|||
public class VmiLog : Entity<Guid> |
|||
{ |
|||
public Guid CategoryId { get; set; } |
|||
public Guid BalanceId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 操作范围
|
|||
/// </summary>
|
|||
public string SessionId { get; set; } |
|||
|
|||
public VmiOperatorType Type { get; set; } |
|||
public VmiCategory Category { get; set; } |
|||
public VmiBalance Balance { get; set; } |
|||
} |
@ -0,0 +1,8 @@ |
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
public enum VmiOperatorType |
|||
{ |
|||
Do, |
|||
UnDo, |
|||
ReDo |
|||
} |
@ -0,0 +1,17 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
/// <summary>
|
|||
/// 库存快照,每月26日8.00,取库存按照时间存储到sqlite文件中
|
|||
/// </summary>
|
|||
public class VmiSnapshot : Entity<Guid> |
|||
{ |
|||
/// <summary>
|
|||
/// YYYY-MM-DD hh
|
|||
/// </summary>
|
|||
public string Name { get; set; } |
|||
|
|||
public string Path { get; set; } |
|||
} |
@ -0,0 +1,10 @@ |
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
|
|||
/// <summary>
|
|||
/// 寄售库存操作类型
|
|||
/// </summary>
|
|||
public enum VmiType |
|||
{ |
|||
In, |
|||
Out |
|||
} |
@ -0,0 +1,50 @@ |
|||
using Magicodes.ExporterAndImporter.Core; |
|||
using Magicodes.ExporterAndImporter.Excel; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Reports; |
|||
|
|||
[ExcelExporter(MaxRowNumberOnASheet = 900000)] |
|||
public class PubSaSeCompareDiff |
|||
{ |
|||
/// <summary>
|
|||
/// 零件号
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "零件号")] |
|||
public string SeLU { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 生产号
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "生产号")] |
|||
public string SePN { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 零件号
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "零件号")] |
|||
public string SaLU { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 生产号
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "生产号")] |
|||
public string SaPN { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 结算数量
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "结算数量")] |
|||
public decimal SaQty { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 发运数量
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "发运数量")] |
|||
public decimal SeQty { set; get; } |
|||
|
|||
/// <summary>
|
|||
/// 差异数量
|
|||
/// </summary>
|
|||
[ExporterHeader(DisplayName = "差异数量")] |
|||
public decimal DiffQty { set; get; } |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,56 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Migrations |
|||
{ |
|||
public partial class _202307191 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<string>( |
|||
name: "ContractNo", |
|||
table: "Set_PriceListBJ", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<DateTime>( |
|||
name: "Date", |
|||
table: "Set_PriceListBJ", |
|||
type: "datetime2", |
|||
nullable: false, |
|||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "ContractNo", |
|||
table: "Set_PriceList", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<DateTime>( |
|||
name: "Date", |
|||
table: "Set_PriceList", |
|||
type: "datetime2", |
|||
nullable: false, |
|||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "ContractNo", |
|||
table: "Set_PriceListBJ"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "Date", |
|||
table: "Set_PriceListBJ"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "ContractNo", |
|||
table: "Set_PriceList"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "Date", |
|||
table: "Set_PriceList"); |
|||
} |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,24 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Migrations |
|||
{ |
|||
public partial class _202307192 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<int>( |
|||
name: "BusinessType", |
|||
table: "Set_PUB_SA", |
|||
type: "int", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "BusinessType", |
|||
table: "Set_PUB_SA"); |
|||
} |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,173 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Migrations |
|||
{ |
|||
public partial class vmi : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "Set_JobItem", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), |
|||
Cron = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), |
|||
Service = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false), |
|||
IsRunning = table.Column<bool>(type: "bit", nullable: false), |
|||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_Set_JobItem", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Set_VmiBalance", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
LU = table.Column<string>(type: "nvarchar(450)", nullable: false), |
|||
PN = table.Column<string>(type: "nvarchar(450)", nullable: false), |
|||
PNType = table.Column<int>(type: "int", nullable: false), |
|||
Type = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
Qty = table.Column<decimal>(type: "decimal(18,2)", nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_Set_VmiBalance", x => x.Id); |
|||
table.UniqueConstraint("AK_Set_VmiBalance_PN_LU", x => new { x.PN, x.LU }); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Set_VmiCategory", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
Type = table.Column<int>(type: "int", nullable: false), |
|||
Number = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false), |
|||
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_Set_VmiCategory", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Set_VmiSnapshot", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
Path = table.Column<string>(type: "nvarchar(max)", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_Set_VmiSnapshot", x => x.Id); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "JobLog", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
JobId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
Start = table.Column<DateTime>(type: "datetime2", nullable: false), |
|||
End = table.Column<DateTime>(type: "datetime2", nullable: false), |
|||
Success = table.Column<bool>(type: "bit", nullable: false), |
|||
Exception = table.Column<string>(type: "nvarchar(max)", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_JobLog", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_JobLog_Set_JobItem_JobId", |
|||
column: x => x.JobId, |
|||
principalTable: "Set_JobItem", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.SetNull); |
|||
}); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "Set_VmiLog", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
CategoryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
BalanceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
SessionId = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
Type = table.Column<int>(type: "int", nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_Set_VmiLog", x => x.Id); |
|||
table.ForeignKey( |
|||
name: "FK_Set_VmiLog_Set_VmiBalance_BalanceId", |
|||
column: x => x.BalanceId, |
|||
principalTable: "Set_VmiBalance", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
table.ForeignKey( |
|||
name: "FK_Set_VmiLog_Set_VmiCategory_CategoryId", |
|||
column: x => x.CategoryId, |
|||
principalTable: "Set_VmiCategory", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_JobItem", |
|||
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" }, |
|||
values: new object[] { new Guid("a6d57042-e087-421e-a086-dfb34c6bfe80"), null, "0 0 8 26 *", false, "库存快照", "Win.Sfs.SettleAccount.Entities.BQ.VmiService" }); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_JobLog_JobId", |
|||
table: "JobLog", |
|||
column: "JobId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Set_JobItem_Name", |
|||
table: "Set_JobItem", |
|||
column: "Name", |
|||
unique: true); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Set_VmiCategory_Number", |
|||
table: "Set_VmiCategory", |
|||
column: "Number", |
|||
unique: true); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Set_VmiLog_BalanceId", |
|||
table: "Set_VmiLog", |
|||
column: "BalanceId"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_Set_VmiLog_CategoryId", |
|||
table: "Set_VmiLog", |
|||
column: "CategoryId"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "JobLog"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Set_VmiLog"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Set_VmiSnapshot"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Set_JobItem"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Set_VmiBalance"); |
|||
|
|||
migrationBuilder.DropTable( |
|||
name: "Set_VmiCategory"); |
|||
} |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,53 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Migrations |
|||
{ |
|||
public partial class _202307193 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "Set_TaskJob", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
Type = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
State = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
TaskId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true), |
|||
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true), |
|||
ActionName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true), |
|||
Error = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
Creator = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true), |
|||
Email = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true), |
|||
FileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), |
|||
RealFileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), |
|||
RealDownFileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), |
|||
DownFileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true), |
|||
ServiceName = table.Column<string>(type: "nvarchar(300)", maxLength: 300, nullable: true), |
|||
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true), |
|||
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true), |
|||
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false), |
|||
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|||
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false), |
|||
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), |
|||
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true), |
|||
BranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), |
|||
Enabled = table.Column<bool>(type: "bit", nullable: false), |
|||
Remark = table.Column<string>(type: "nvarchar(max)", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_Set_TaskJob", x => x.Id); |
|||
}); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "Set_TaskJob"); |
|||
} |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,45 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Migrations |
|||
{ |
|||
public partial class _202307194 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DeleteData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("a6d57042-e087-421e-a086-dfb34c6bfe80")); |
|||
|
|||
migrationBuilder.AddColumn<int>( |
|||
name: "BusinessType", |
|||
table: "Set_PUB_SA_DETAIL", |
|||
type: "int", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_JobItem", |
|||
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" }, |
|||
values: new object[] { new Guid("6efe1947-a242-4d20-b633-20b0f716a782"), null, "0 0 8 26 *", false, "库存快照", "Win.Sfs.SettleAccount.Entities.BQ.VmiService" }); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DeleteData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("6efe1947-a242-4d20-b633-20b0f716a782")); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "BusinessType", |
|||
table: "Set_PUB_SA_DETAIL"); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_JobItem", |
|||
columns: new[] { "Id", "ConcurrencyStamp", "Cron", "IsRunning", "Name", "Service" }, |
|||
values: new object[] { new Guid("a6d57042-e087-421e-a086-dfb34c6bfe80"), null, "0 0 8 26 *", false, "库存快照", "Win.Sfs.SettleAccount.Entities.BQ.VmiService" }); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,162 @@ |
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Dapper; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Repositories.Dapper; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
using Win.Sfs.SettleAccount.Entities; |
|||
using Win.Sfs.SettleAccount.Reports; |
|||
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; |
|||
|
|||
/// <summary>
|
|||
/// Pub结算与发运对比Dapper仓储
|
|||
/// </summary>
|
|||
public class PubSaSeCompareDapperRepository : DapperRepository<SettleAccountDbContext>, ITransientDependency |
|||
{ |
|||
public PubSaSeCompareDapperRepository(IDbContextProvider<SettleAccountDbContext> dbContextProvider) : base(dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取差异
|
|||
/// </summary>
|
|||
public virtual List<PubSaSeCompareDiff> GetDetailDiffReportList(string version, string businessType) |
|||
{ |
|||
string strSqlText = @$"
|
|||
SELECT |
|||
A.LU SeLU, |
|||
A.PN SePN, |
|||
SeQty, |
|||
B.LU SaLU, |
|||
B.PN SaPN, |
|||
SaQty, |
|||
(SaQty - SeQty) DiffQty |
|||
FROM |
|||
(SELECT SUM(QTY) SeQty, LU, PN FROM Set_PUB_SE_DETAIL WHERE GROUP BY LU, PN) A |
|||
FULL JOIN (SELECT SUM(QTY) SaQty, LU, PN FROM Set_PUB_SA_DETAIL GROUP BY LU, PN) B ON A.LU= B.LU AND A.PN= B.PN |
|||
";
|
|||
return DbConnection.Query<PubSaSeCompareDiff>(strSqlText, null, null, true, 1200, null).ToList(); |
|||
} |
|||
|
|||
public virtual List<InvoiceSettledDetailDiff> GetInvoiceSettledDetailDiffReportList(string version, string materialCode, string begin, string end, string cp7begin, string cp7end, string kennCode, string chassisNumber, string materialGroup) |
|||
{ |
|||
List<InvoiceSettledDetailDiff> _list = new List<InvoiceSettledDetailDiff>(); |
|||
|
|||
if (CacheManager.CacheMaterials != null && CacheManager.CacheInvoiceSettledDetailDiff.Count(p => p.Version == version) > 0) |
|||
{ |
|||
_list = CacheManager.CacheInvoiceSettledDetailDiff.Where(p => p.Version == version).ToList(); |
|||
_list = _list.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); |
|||
} |
|||
else |
|||
{ |
|||
|
|||
//string isExistSql = string.Format("SELECT count(1) lincount FROM [Set_Settle_RAM] WITH(SNAPSHOT) where Version = '{0}'", version);
|
|||
//int _count = DbConnection.ExecuteScalar<int>(isExistSql);
|
|||
int _count = 0; |
|||
|
|||
string condition = " where 1=1 "; |
|||
if (!string.IsNullOrEmpty(begin)) |
|||
{ |
|||
condition += string.Format(" and a.BeginTime>='{0}' ", begin); |
|||
} |
|||
if (!string.IsNullOrEmpty(end)) |
|||
{ |
|||
condition += string.Format(" and a.BeginTime<='{0}' ", end); |
|||
} |
|||
if (!string.IsNullOrEmpty(cp7begin)) |
|||
{ |
|||
condition += string.Format(" and B.cp7>='{0}' ", cp7begin); |
|||
} |
|||
if (!string.IsNullOrEmpty(cp7end)) |
|||
{ |
|||
condition += string.Format(" and B.cp7<='{0}' ", cp7end); |
|||
} |
|||
|
|||
|
|||
string tablestr = (_count == 0) ? |
|||
" ( SELECT * FROM Set_Settle b WHERE b.Version = '{0}' ) b\n" : |
|||
|
|||
" (SELECT * FROM [Set_Settle_RAM] WITH(SNAPSHOT) where Version = '{0}') b \n"; |
|||
string str = |
|||
"SELECT\n" + |
|||
string.Format(" '{0}' version ,\n", version) + |
|||
" temp1.*,\n" + |
|||
" TEMP2.Price,(\n" + |
|||
" Isnull( temp2.Price, 0 ) * isnull( temp1.Qty, 0 )) Amt \n" + |
|||
"FROM\n" + |
|||
" (\n" + |
|||
" SELECT\n" + |
|||
" b.YEAR,\n" + |
|||
" a.OrderBillNum Kenncode,\n" + |
|||
" b.MaterialCode,\n" + |
|||
" b.Model,\n" + |
|||
" a.ChassisNumber,\n" + |
|||
" a.Qty,\n" + |
|||
" a.BeginTime CP5Time,\n" + |
|||
" a.ChassisNumber2,\n" + |
|||
" B.CP7 CP7Time,\n" + |
|||
" a.QTY SettledQty,\n" + |
|||
" a.ErpMaterialCode ParentSapMaterialCode,\n" + |
|||
" a.WMSState,\n" + |
|||
" a.WMSBillNum,\n" + |
|||
" d.MaterialCode SapMaterialCode,\n" + |
|||
" d.MaterialDesc MaterialDesc,\n" + |
|||
" d.EstimateTypeDesc MaterialGroup,\n" + |
|||
" e.MaterialDesc ParentMaterialDesc,\n" + |
|||
" c.InvoicePrice,\n" + |
|||
" Round( c.InvoicePrice * a.qty,2 ) InvoiceAmt,\n" + |
|||
" Round( c.InvoicePrice * a.Qty,2 ) SettleAmt,\n" + |
|||
" 0 DiffSettleFisQty,\n" + |
|||
" 0 DiffSettleInvQty, \n" + |
|||
" a.Qty InvoiceQty ,\n" + |
|||
" IsNull( B.Qty, 0 ) SettleReadyQty, \n" + |
|||
" a.UnSettleVersion \n" + |
|||
" FROM\n" + |
|||
tablestr + |
|||
|
|||
" INNER JOIN Set_fis a ON b.ChassisNumber = a.ChassisNumber2 \n" + |
|||
" AND b.KENNCode = a.KENNCode \n" + |
|||
" AND b.MaterialCode = a.ItemCode\n" + |
|||
" LEFT JOIN ( SELECT SUM( amt )/ SUM( Qty ) InvoicePrice, MaterialCode FROM set_invoice WHERE version = '{0}' GROUP BY materialcode ) c ON a.ItemCode = c.MaterialCode\n" + |
|||
" LEFT JOIN set_material d ON a.ItemCode = d.CustomerPartCode\n" + |
|||
" LEFT JOIN (select max(Id) Id,MaterialCode,MaterialDesc from Set_material group by MaterialCode,MaterialDesc) e ON a.ErpMaterialCode = e.MaterialCode {1} \n" + |
|||
" ) TEMP1\n" + |
|||
" LEFT JOIN (\n" + |
|||
" SELECT\n" + |
|||
" Price,\n" + |
|||
" MaterialCode \n" + |
|||
" FROM\n" + |
|||
" Set_PriceList \n" + |
|||
" WHERE\n" + |
|||
" version = ( SELECT Max( Version ) FROM Set_PriceList ) and type=10 ) TEMP2 ON TEMP1.SapMaterialCode = TEMP2.MaterialCode"; |
|||
var _sql = string.Format(str, version, condition); |
|||
|
|||
var _query = DbConnection.Query<InvoiceSettledDetailDiff>(_sql, null, null, true, 1200, null); |
|||
|
|||
_list = _query.ToList(); |
|||
|
|||
if (CacheManager.CacheMaterials != null && CacheManager.CacheInvoiceSettledDetailDiff.Count(p => p.Version == version) > 0) |
|||
{ |
|||
_list = CacheManager.CacheInvoiceSettledDetailDiff.Where(p => p.Version == version).ToList(); |
|||
_list = _list.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); |
|||
} |
|||
else |
|||
{ |
|||
if (CacheManager.CacheInvoiceSettledDetailDiff == null) |
|||
{ |
|||
CacheManager.CacheInvoiceSettledDetailDiff = new List<InvoiceSettledDetailDiff>(); |
|||
} |
|||
CacheManager.CacheInvoiceSettledDetailDiff.AddRange(_list); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
return _list; |
|||
|
|||
} |
|||
} |
@ -0,0 +1,19 @@ |
|||
using System.IO; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Design; |
|||
using Microsoft.Extensions.Configuration; |
|||
|
|||
namespace Win.Sfs.SettleAccount; |
|||
|
|||
public class SettleAccountDbContextFactory : IDesignTimeDbContextFactory<SettleAccountDbContext> |
|||
{ |
|||
public SettleAccountDbContext CreateDbContext(string[] args) |
|||
{ |
|||
var config = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json").Build(); |
|||
var connectionString = config.GetConnectionString("SettleAccountService"); |
|||
var optionsBuilder = new DbContextOptionsBuilder<SettleAccountDbContext>(); |
|||
optionsBuilder.UseSqlServer(connectionString); |
|||
|
|||
return new SettleAccountDbContext(optionsBuilder.Options); |
|||
} |
|||
} |
@ -0,0 +1,288 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Magicodes.ExporterAndImporter.Excel; |
|||
using System.Linq; |
|||
using TaskJob.EventArgs; |
|||
using TaskJob.Interfaces; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Win.Sfs.BaseData.ImportExcelCommon; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
using SettleAccount.Domain.BQ; |
|||
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; |
|||
using Shouldly; |
|||
using Volo.Abp.BlobStoring; |
|||
|
|||
namespace SettleAccount.Job.Services.Report |
|||
{ |
|||
/// <summary>
|
|||
/// Pub结算发运对比导出服务
|
|||
/// </summary>
|
|||
public class PubSaSeCompareExportService: ITransientDependency, IExportJob |
|||
{ |
|||
/// <summary>
|
|||
/// Pub结算明细仓储
|
|||
/// </summary>
|
|||
private readonly INormalEfCoreRepository<PUB_SA_DETAIL, Guid> _pubSaDetailRepository; |
|||
|
|||
/// <summary>
|
|||
/// Pub发运数据仓储
|
|||
/// </summary>
|
|||
private readonly INormalEfCoreRepository<PUB_SE_DETAIL, Guid> _pubSeDetailRepository; |
|||
|
|||
private readonly PubSaSeCompareDapperRepository _pubSaSeCompareDapperRepository; |
|||
|
|||
private readonly IBlobContainer<MyFileContainer> _fileContainer; |
|||
|
|||
/// <summary>
|
|||
/// 构造
|
|||
/// </summary>
|
|||
public PubSaSeCompareExportService(INormalEfCoreRepository<PUB_SA_DETAIL, Guid> pubSaDetailRepository, |
|||
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository, |
|||
PubSaSeCompareDapperRepository pubSaSeCompareDapperRepository, |
|||
IBlobContainer<MyFileContainer> fileContainer) |
|||
{ |
|||
_pubSaDetailRepository = pubSaDetailRepository; |
|||
_pubSeDetailRepository = pubSeDetailRepository; |
|||
_pubSaSeCompareDapperRepository = pubSaSeCompareDapperRepository; |
|||
_fileContainer = fileContainer; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 导出
|
|||
/// </summary>
|
|||
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property) |
|||
{ |
|||
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value; |
|||
var businessType = property.Where(t => t.Name == "BusinessType").FirstOrDefault().Value; |
|||
var filename = exportName.FirstOrDefault(); |
|||
var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(version, businessType); |
|||
|
|||
ExcelExporter excelExporter = new ExcelExporter(); |
|||
|
|||
var result = excelExporter |
|||
.Append(pubSaSeCompareDiffs, "差异明细表") |
|||
.SeparateBySheet() |
|||
.Append(pubSaSeCompareDiffs, "数量差异汇总表") |
|||
.SeparateBySheet() |
|||
.Append(pubSaSeCompareDiffs, "按物料价格差异明细表") |
|||
.SeparateBySheet() |
|||
.Append(pubSaSeCompareDiffs, "差异汇总验证表") |
|||
.ExportAppendDataAsByteArray(); |
|||
result.ShouldNotBeNull(); |
|||
_fileContainer.SaveAsync(filename, result.Result, true); |
|||
|
|||
return id.ToString(); |
|||
|
|||
//结算
|
|||
|
|||
//var _lsSum = _ls.GroupBy(p => new { p.MaterialCode, p.SapMaterialCode, p.MaterialGroup, p.InvoicePrice }).Select(p => new UnInvoiceSettledDetailSum
|
|||
//{
|
|||
// MaterialCode = p.Key.MaterialCode,
|
|||
// SapMaterailCode = p.Key.SapMaterialCode,
|
|||
// MaterialGroup = p.Key.MaterialGroup,
|
|||
// SettleQty = p.Sum(itm => itm.SettledQty),
|
|||
// FisQty = 0,
|
|||
// DiffQty = -p.Sum(itm => itm.SettledQty),
|
|||
// Price = p.Key.InvoicePrice,
|
|||
// DiffAmt = p.Sum(itm => itm.SettledQty) * p.Key.InvoicePrice
|
|||
//}).ToList();
|
|||
|
|||
//var _sumTotal = new UnInvoiceSettledDetailSum()
|
|||
//{
|
|||
|
|||
// SettleQty = _lsSum.Sum(p => p.SettleQty),
|
|||
// DiffQty = _lsSum.Sum(p => p.DiffQty),
|
|||
// Price = _lsSum.Sum(p => p.Price),
|
|||
// DiffAmt = _lsSum.Sum(p => p.DiffAmt)
|
|||
|
|||
|
|||
//};
|
|||
//_lsSum.Add(_sumTotal);
|
|||
|
|||
|
|||
|
|||
//var _ls1 = DiffPrice(id, exportName, p_list);
|
|||
|
|||
//var report1List = _ls1.Where(p => p.DiffPrice != 0).GroupBy(p => new { p.MaterialGroup, p.MaterialCode, p.MaterialDesc, p.Price, p.InvoicePrice, p.DiffPrice, p.SapMaterialCode })
|
|||
// .Select(t => new SettleDoorPanelExport { MaterialGroup = t.FirstOrDefault().MaterialGroup, MaterialCode = t.FirstOrDefault().MaterialCode, MaterialDesc = t.FirstOrDefault().MaterialDesc, Price = t.FirstOrDefault().Price, InvoicePrice = t.FirstOrDefault().InvoicePrice, InvoiceDiffPrice = t.FirstOrDefault().DiffPrice, SAPCode = t.FirstOrDefault().SapMaterialCode }).ToList();
|
|||
|
|||
|
|||
|
|||
//var report2List = _ls1.Where(p => p.DiffPrice != 0).Select(p => new { p.MaterialGroup, DiffAmt = p.DiffPrice * p.Qty }).GroupBy(p => new { p.MaterialGroup }).Select(p => new SettleDoorPanelSumExport { MaterialGroup = p.Key.MaterialGroup, InvoiceDiffPrice = p.Sum(itm => itm.DiffAmt), Version = version });
|
|||
|
|||
//var list1 = LSettleSum(id, exportName, p_list);
|
|||
|
|||
//var report1 = report2List.ToList();
|
|||
|
|||
//foreach (var itm in list1)
|
|||
//{
|
|||
// itm.MaterialGroup = itm.MaterialGroup + "(漏结)";
|
|||
//}
|
|||
|
|||
//report1.AddRange(list1);
|
|||
|
|||
//ExcelExporter _exporter = new ExcelExporter();//导出Excel
|
|||
|
|||
//var result = _exporter
|
|||
//.Append(_ls, "差异明细表")
|
|||
//.SeparateBySheet()
|
|||
//.Append(_lsSum, "数量差异汇总表")
|
|||
//.SeparateBySheet()
|
|||
//.Append(report1List, "按物料价格差异明细表")
|
|||
//.SeparateBySheet()
|
|||
//.Append(report1, "差异汇总验证表")
|
|||
//.ExportAppendDataAsByteArray();
|
|||
//result.ShouldNotBeNull();
|
|||
//_fileContainer.SaveAsync(_filename, result.Result, true);
|
|||
|
|||
////_outputService.Export<InvoiceSettledDetailDiff>(id, string.Format("大众结算未发运核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _ls);
|
|||
|
|||
//return id.ToString();
|
|||
|
|||
return this.GetType().FullName; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 导出
|
|||
/// </summary>
|
|||
public string ExportFile333(Guid id, List<string> exportName, List<CustomCondition> property) |
|||
{ |
|||
return ""; |
|||
// var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
|
|||
|
|||
// var _filename = exportName.FirstOrDefault();
|
|||
|
|||
// var _ls = _dapperRepository.GetDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber, materialGroup);
|
|||
// var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
|
|||
// foreach (var itm in _ls)
|
|||
// {
|
|||
// itm.InvoiceAmt = Math.Round(itm.InvoiceQty * itm.InvoicePrice, 2);
|
|||
// itm.DiffPrice = itm.Price - itm.InvoicePrice;
|
|||
// itm.DiffSettleFisQty = itm.SettledQty;
|
|||
// }
|
|||
// _ls = _ls.OrderBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ThenBy(p => p.SapMaterialCode).ToList();
|
|||
|
|||
|
|||
|
|||
// if (!string.IsNullOrEmpty(materialGroup))
|
|||
// {
|
|||
// var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList();
|
|||
// if (_groupList.Count() > 0)
|
|||
// {
|
|||
// _ls = _ls.Where(p => _groupList.Contains(p.MaterialGroup)).ToList();
|
|||
// }
|
|||
// }
|
|||
// if (!string.IsNullOrEmpty(kenncode))
|
|||
// {
|
|||
// var _groupList = kenncode.Split(new char[] { '\n' }).Distinct().ToList();
|
|||
// if (_groupList.Count() > 0)
|
|||
// {
|
|||
// _ls = _ls.Where(p => _groupList.Contains(p.KENNCode)).ToList();
|
|||
// }
|
|||
// }
|
|||
// if (!string.IsNullOrEmpty(chassisNumber))
|
|||
// {
|
|||
// var _groupList = chassisNumber.Split(new char[] { '\n' }).Distinct().ToList();
|
|||
// if (_groupList.Count() > 0)
|
|||
// {
|
|||
// _ls = _ls.Where(p => _groupList.Contains(p.ChassisNumber)).ToList();
|
|||
// }
|
|||
// }
|
|||
// if (!string.IsNullOrEmpty(sapCode))
|
|||
// {
|
|||
// var _groupList = sapCode.Split(new char[] { '\n' }).Distinct().ToList();
|
|||
// if (_groupList.Count() > 0)
|
|||
// {
|
|||
// _ls = _ls.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
|
|||
// }
|
|||
// }
|
|||
// if (!string.IsNullOrEmpty(materialCode))
|
|||
// {
|
|||
// var _groupList = materialCode.Split(new char[] { '\n' }).Distinct().ToList();
|
|||
// if (_groupList.Count() > 0)
|
|||
// {
|
|||
// _ls = _ls.Where(p => _groupList.Contains(p.MaterialCode)).ToList();
|
|||
// }
|
|||
// }
|
|||
|
|||
|
|||
// var _checkList = _erpdapperRepository.GetErrorBillList();
|
|||
|
|||
// var query = from itm in _ls
|
|||
// join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
|
|||
//equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
|
|||
// from tm1 in temp1.DefaultIfEmpty()
|
|||
// where tm1 == null
|
|||
// select itm;
|
|||
|
|||
|
|||
// _ls = query.ToList();
|
|||
|
|||
|
|||
|
|||
// var _lsSum = _ls.GroupBy(p => new { p.MaterialCode, p.SapMaterialCode, p.MaterialGroup, p.InvoicePrice }).Select(p => new UnInvoiceSettledDetailSum
|
|||
// {
|
|||
// MaterialCode = p.Key.MaterialCode,
|
|||
// SapMaterailCode = p.Key.SapMaterialCode,
|
|||
// MaterialGroup = p.Key.MaterialGroup,
|
|||
// SettleQty = p.Sum(itm => itm.SettledQty),
|
|||
// FisQty = 0,
|
|||
// DiffQty = -p.Sum(itm => itm.SettledQty),
|
|||
// Price = p.Key.InvoicePrice,
|
|||
// DiffAmt = p.Sum(itm => itm.SettledQty) * p.Key.InvoicePrice
|
|||
// }).ToList();
|
|||
|
|||
// var _sumTotal = new UnInvoiceSettledDetailSum()
|
|||
// {
|
|||
|
|||
// SettleQty = _lsSum.Sum(p => p.SettleQty),
|
|||
// DiffQty = _lsSum.Sum(p => p.DiffQty),
|
|||
// Price = _lsSum.Sum(p => p.Price),
|
|||
// DiffAmt = _lsSum.Sum(p => p.DiffAmt)
|
|||
|
|||
|
|||
// };
|
|||
// _lsSum.Add(_sumTotal);
|
|||
|
|||
|
|||
|
|||
// var _ls1 = DiffPrice(id, exportName, p_list);
|
|||
|
|||
// var report1List = _ls1.Where(p => p.DiffPrice != 0).GroupBy(p => new { p.MaterialGroup, p.MaterialCode, p.MaterialDesc, p.Price, p.InvoicePrice, p.DiffPrice, p.SapMaterialCode })
|
|||
// .Select(t => new SettleDoorPanelExport { MaterialGroup = t.FirstOrDefault().MaterialGroup, MaterialCode = t.FirstOrDefault().MaterialCode, MaterialDesc = t.FirstOrDefault().MaterialDesc, Price = t.FirstOrDefault().Price, InvoicePrice = t.FirstOrDefault().InvoicePrice, InvoiceDiffPrice = t.FirstOrDefault().DiffPrice, SAPCode = t.FirstOrDefault().SapMaterialCode }).ToList();
|
|||
|
|||
|
|||
|
|||
// var report2List = _ls1.Where(p => p.DiffPrice != 0).Select(p => new { p.MaterialGroup, DiffAmt = p.DiffPrice * p.Qty }).GroupBy(p => new { p.MaterialGroup }).Select(p => new SettleDoorPanelSumExport { MaterialGroup = p.Key.MaterialGroup, InvoiceDiffPrice = p.Sum(itm => itm.DiffAmt), Version = version });
|
|||
|
|||
// var list1 = LSettleSum(id, exportName, p_list);
|
|||
|
|||
// var report1 = report2List.ToList();
|
|||
|
|||
// foreach (var itm in list1)
|
|||
// {
|
|||
// itm.MaterialGroup = itm.MaterialGroup + "(漏结)";
|
|||
// }
|
|||
|
|||
// report1.AddRange(list1);
|
|||
|
|||
// ExcelExporter _exporter = new ExcelExporter();//导出Excel
|
|||
|
|||
// var result = _exporter
|
|||
// .Append(_ls, "差异明细表")
|
|||
// .SeparateBySheet()
|
|||
// .Append(_lsSum, "数量差异汇总表")
|
|||
// .SeparateBySheet()
|
|||
// .Append(report1List, "按物料价格差异明细表")
|
|||
// .SeparateBySheet()
|
|||
// .Append(report1, "差异汇总验证表")
|
|||
// .ExportAppendDataAsByteArray();
|
|||
// result.ShouldNotBeNull();
|
|||
// _fileContainer.SaveAsync(_filename, result.Result, true);
|
|||
|
|||
// //_outputService.Export<InvoiceSettledDetailDiff>(id, string.Format("大众结算未发运核对明细表_{0}.xlsx", Guid.NewGuid().ToString()), _ls);
|
|||
|
|||
// return id.ToString();
|
|||
} |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.SignalR; |
|||
|
|||
namespace SettleAccount.Job.SignalR |
|||
{ |
|||
public class PageHub : Hub |
|||
{ |
|||
public override async Task OnConnectedAsync() |
|||
{ |
|||
await this.Groups.AddToGroupAsync(this.Context.ConnectionId, this.Context.ConnectionId).ConfigureAwait(false); |
|||
await Clients.Group(Context.ConnectionId).SendAsync("Connected", Context.ConnectionId).ConfigureAwait(false); |
|||
} |
|||
} |
|||
|
|||
public static class HubExtensions |
|||
{ |
|||
public static void ServerToClient(this IClientProxy clientProxy, string method, string message, string toClient, string? fromClient = null) |
|||
{ |
|||
clientProxy.SendAsync(nameof(ServerToClient), method, message, toClient, fromClient); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue