杨张扬
2025-05-28 150b2843db8bf76a35615aa46c17f59df1a0f0f4
wms/SpecHelper.cs
@@ -368,7 +368,14 @@
                            LogHelper.Info($"更新WMS库存明细的入库时间,失败,容器号:{cntId}");
                        }
                    }
                    else
                    {
                        LogHelper.Info($"更新WMS库存明细的入库时间,失败,容器号:{cntId},TN_InventoryM为空");
                    }
                }
                else
                {
                    LogHelper.Info($"更新WMS库存明细的入库时间,失败,容器号:{cntId},TN_CG_Detail为空");
                }
            }
            catch (Exception ex)
@@ -399,5 +406,30 @@
                LogHelper.Error("更新WMS库存明细的过期时间失败", ex);
            }
        }
        public static int CalculateDaysDifference(DateTime start, DateTime end)
        {
            try
            {
                // 计算总时间差
                TimeSpan difference = end - start;
                // 如果差值为负(end早于start),返回0
                if (difference.TotalDays < 0)
                {
                    return 0;
                }
                // 获取总天数(包括小数部分)
                double totalDays = difference.TotalDays;
                // 向上取整
                return (int)Math.Ceiling(totalDays);
            }
            catch (Exception ex)
            {
                return 0;
            }
        }
    }
}