1
huangxiaoqiang
2025-12-25 8b8fd6e60718e5015c9b200a59edcdfede284b87
1
已修改6个文件
54 ■■■■ 文件已修改
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/InventoryLockJob.cs 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/QuartzJobMildd.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Common/StockEnum/StockStatusEmun.cs
@@ -107,6 +107,9 @@
        [Description("已清理")]
        å·²æ¸…理 = 33,
        [Description("手动解锁")]
        æ‰‹åŠ¨è§£é” = 66,
        [Description("过期")]
        è¿‡æœŸ =98,
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_InboundService/InboundService.cs
@@ -134,7 +134,6 @@
                        OrderNo = inboundOrder.InboundOrderNo,
                        BusinessType = inboundOrder.BusinessType,
                        ValidDate = inboundOrder.BusinessType == BusinessTypeEnum.外部仓库调智仓.ToString() ? item.ValidDate : datevaliDate == null ? null : Convert.ToDateTime(DateTime.Now).AddDays(Convert.ToDouble(datevaliDate.ValidityDays)),
                        //ValidDate = datevaliDate == null ? null : DateTime.Now.AddDays(datevaliDate.ValidityDays),
                    });
                    item.ReceiptQuantity = item.BarcodeQty;
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs
@@ -549,7 +549,7 @@
        private List<Dt_StockInfo> BuildStockQueryWithInfo(MaterielOutboundCalculationDTO materielCalc, string factoryArea)
        {
            // åŸºç¡€æŸ¥è¯¢æ¡ä»¶ï¼šç‰©æ–™ç¼–号、批次号(如果提供)、库存数量>0
            ISugarQueryable<Dt_StockInfoDetail> stockDetails = _stockDetailRepository.Db.Queryable<Dt_StockInfoDetail>().Where(x => x.MaterielCode == materielCalc.MaterielCode && x.StockQuantity > 0);
            ISugarQueryable<Dt_StockInfoDetail> stockDetails = _stockDetailRepository.Db.Queryable<Dt_StockInfoDetail>().Where(x => x.MaterielCode == materielCalc.MaterielCode && x.StockQuantity > 0 && (x.Status == (int)StockStatusEmun.入库完成 || x.Status == (int)StockStatusEmun.手动解锁));
            // æ ¹æ®æ¡ä»¶æ·»åŠ ä¾›åº”å•†ç¼–å·åŒ¹é…ï¼ˆä¸ä¸ºç©ºæ—¶æ‰éœ€è¦åŒ¹é…ï¼‰
            if (!string.IsNullOrEmpty(materielCalc.SupplyCode))
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/InventoryLockJob.cs
@@ -4,37 +4,25 @@
using WIDESEA_Common.StockEnum;
using WIDESEA_Model.Models;
using WIDESEA_Model.Models.Basic;
using WIDESEA_WMSServer.Jobs;
namespace WIDESEA_WMSServer.Jobs
namespace WIDESEA_WMSServer
{
    [DisallowConcurrentExecution]
    public class InventoryLockJob : IJob
    {
        private readonly ILogger<ErpJob> _logger;
        private readonly ISqlSugarClient _db;
        public InventoryLockJob(ILogger<ErpJob> logger, ISqlSugarClient db )
        public InventoryLockJob(ISqlSugarClient db)
        {
            _logger = logger;
            _db = db;
        }
        public Task Execute(IJobExecutionContext context)
        {
            // ç¬¬ä¸€æ­¥ï¼šæ›´æ–°ValidDate的原生SQL(SQL Server)
    //        string updateSql = @"
    //UPDATE s
    //SET s.ValidDate = DATEADD(DAY, m.ValidityDays, s.CreateDate)
    //FROM Dt_StockInfoDetail s
    //INNER JOIN Dt_MaterialExpirationDate m ON SUBSTRING(s.MaterielCode, 1, 6) = m.MaterialCode
    //WHERE s.ValidDate IS NULL";
    //        int updateValidDateResult = _db.Ado.ExecuteCommand(updateSql);
            // ç¬¬äºŒæ­¥ï¼šæ›´æ–°è¿‡æœŸçŠ¶æ€çš„åŽŸç”ŸSQL
            string updateStatusSql = @"
    UPDATE Dt_StockInfoDetail
    SET Status = 98
    WHERE ValidDate IS NOT NULL AND ValidDate < GETDATE()";
                                        WHERE  ValidDate IS NOT NULL AND ValidDate < GETDATE()
                                        AND Status = 6";
            int updateStatusResult = _db.Ado.ExecuteCommand(updateStatusSql);
            return Task.CompletedTask;
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Jobs/QuartzJobMildd.cs
@@ -34,6 +34,19 @@
                         Name = "AgvTaskJob",
                         TriggerType = 0
                    },
                     new TasksQz()
                    {
                         Id = 2,
                         AssemblyName = "WIDESEA_WMSServer",
                         ClassName = "InventoryLockJob",
                         CreateTime = DateTime.Now,
                         IntervalSecond = 3,
                         IsDeleted = false,
                         IsStart = false,
                         JobGroup = "WIDESEA_WMSServer",
                         Name = "InventoryLockJob",
                         TriggerType = 0
                    },
                };
                foreach (var item in allQzServices)
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs
@@ -188,6 +188,7 @@
});
builder.Services.AddSingleton<IJobFactory, JobFactory>();
builder.Services.AddTransient<AgvTaskJob>();//Job使用瞬时依赖注入
builder.Services.AddTransient<InventoryLockJob>();//Job使用瞬时依赖注入
builder.Services.AddSingleton<ISchedulerCenter, SchedulerCenterServer>();
builder.Services.AddQuartz(q =>
@@ -202,13 +203,13 @@
        .WithIdentity("ErpJob-trigger")
        .WithCronSchedule("0 0 10,14,20 * * ?"));
    var inventoryLockJobKey = new JobKey("InventoryLockJob");
    q.AddJob<InventoryLockJob>(opts => opts.WithIdentity(inventoryLockJobKey));
    //var inventoryLockJobKey = new JobKey("InventoryLockJob");
    //q.AddJob<InventoryLockJob>(opts => opts.WithIdentity(inventoryLockJobKey));
    q.AddTrigger(opts => opts
        .ForJob(inventoryLockJobKey)
        .WithIdentity("InventoryLockJob-trigger")
        .WithCronSchedule("0 0/10 * * * ?")); // æ¯10分钟执行一次
    //q.AddTrigger(opts => opts
    //    .ForJob(inventoryLockJobKey)
    //    .WithIdentity("InventoryLockJob-trigger")
    //    .WithCronSchedule("0 0/10 * * * ?")); // æ¯10分钟执行一次
});
builder.Services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true);