using System;
using System.Collections.Generic;
using System.Text;
using wms.dto.response.sx;
using wms.service.Help.LayerPacking.model;
namespace wms.service.Help.LayerPacking
{
///
/// 比较产品
///
public class CompareProduct : IEqualityComparer
{
///
/// 比较产品
///
///
///
///
public bool Equals(LayerPackingProduct x, LayerPackingProduct y)
{
if (ReferenceEquals(x, y)) return true;
if (x == null || y == null) return false;
return string.Equals(x.ContGrpBarCode, y.ContGrpBarCode, StringComparison.Ordinal);
}
///
/// 获取产品哈希码
///
///
///
public int GetHashCode(LayerPackingProduct obj)
{
if (obj?.ContGrpBarCode == null) return 0;
// 使用更好的哈希算法,减少碰撞
unchecked
{
int hash = 17;
hash = hash * 31 + obj.ContGrpBarCode.GetHashCode();
return hash;
}
}
}
}