| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.Logging;
- namespace Admin.NET.Plugin.AiDOP.MaterialWarehouse;
- /// <summary>库存冷链手工补偿入口(管理员)。不接受前端 tenantId/domain/entityCode。</summary>
- [ApiDescriptionSettings(Order = 310, Description = "S5库存冷链入站")]
- [Route("api/S5InventoryInbound")]
- [NonUnify]
- public sealed class InventoryInboundAdminService : IDynamicApiController, ITransient
- {
- private readonly InventoryMdpSyncService _sync;
- private readonly InventoryReconService _recon;
- private readonly ILogger _logger;
- public InventoryInboundAdminService(
- InventoryMdpSyncService sync,
- InventoryReconService recon,
- ILoggerFactory loggerFactory)
- {
- _sync = sync;
- _recon = recon;
- _logger = loggerFactory.CreateLogger(nameof(InventoryInboundAdminService));
- }
- [DisplayName("库存冷链首刷")]
- [HttpPost("bootstrap")]
- [ApiDescriptionSettings(Name = "S5InventoryBootstrap")]
- public async Task<InventorySyncResult> Bootstrap(CancellationToken ct)
- {
- _logger.LogInformation("[S5InventoryInbound] bootstrap requested");
- return await _sync.RunBootstrapAsync(ct);
- }
- [DisplayName("库存冷链跑一轮")]
- [HttpPost("run-once")]
- [ApiDescriptionSettings(Name = "S5InventoryRunOnce")]
- public async Task<InventorySyncResult> RunOnce(CancellationToken ct)
- {
- _logger.LogInformation("[S5InventoryInbound] run-once requested");
- return await _sync.RunIncrementalAsync(ct);
- }
- [DisplayName("库存冷链全量校准")]
- [HttpPost("reconcile")]
- [ApiDescriptionSettings(Name = "S5InventoryReconcile")]
- public async Task<InventorySyncResult> Reconcile(CancellationToken ct)
- {
- _logger.LogInformation("[S5InventoryInbound] reconcile requested");
- return await _sync.RunReconcileFullAsync(ct);
- }
- [DisplayName("库存流水 stg→std 补转换")]
- [HttpPost("transform-std")]
- [ApiDescriptionSettings(Name = "S5InventoryTransformStd")]
- public async Task<InventorySyncResult> TransformStd(CancellationToken ct)
- {
- _logger.LogInformation("[S5InventoryInbound] transform-std requested");
- return await _sync.TransformTransStdFromStgAsync(ct);
- }
- [DisplayName("库存日终对账(手工)")]
- [HttpPost("daily-recon")]
- [ApiDescriptionSettings(Name = "S5InventoryDailyRecon")]
- public async Task<object> DailyRecon(CancellationToken ct)
- {
- _logger.LogInformation("[S5InventoryInbound] daily-recon requested");
- var diffs = await _recon.RunDailyReconAsync(ct);
- return new { diffs, message = diffs == 0 ? "clean" : "diffs written" };
- }
- }
|