using Admin.NET.Core.TaskModule.Enum;
using iWareSql.MyDbContext;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iWareCC.Common.Helper
{
public class BusinessTypeHelper
{
///
/// 检查是否是下架业务
///
///
///
public static bool CheckIsXJOrder(int businessType, MyDbContext mycontext)
{
var wmsBusinessType = GetBusinessTypeInfoFromDB(businessType, mycontext);
if (wmsBusinessType.UpDownShelvesType == (int)UpDownShelvesTypeEnum.下架)
{
return true;
}
return false;
}
///
/// 检查是否是上架业务
///
///
///
public static bool CheckIsSJOrder(int businessType, MyDbContext mycontext)
{
var wmsBusinessType = GetBusinessTypeInfoFromDB(businessType, mycontext);
if (wmsBusinessType.UpDownShelvesType == (int)UpDownShelvesTypeEnum.上架)
{
return true;
}
return false;
}
///
/// 根据业务类型值获取 业务类型信息
///
///
///
///
public static wms_base_business_type GetBusinessTypeInfoFromDB(int businessType, MyDbContext mycontext)
{
var wmsBusinessType = mycontext.wms_base_business_type.FirstOrDefault(x => x.BusinessTypeValue == businessType);
//如果业务类型为空
if (wmsBusinessType == null) throw new Exception($"业务类型值{businessType}不存在");
return wmsBusinessType;
}
}
}