using HH.WMS.DAL.Basic;
|
using HH.WMS.Entitys.Algorithm;
|
using HH.WMS.Entitys.Basic;
|
using HH.WMS.Entitys.Common;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using HH.WMS.Entitys;
|
using System.Data;
|
|
namespace HH.WMS.BLL.Basic
|
{
|
public class TN_WMS_ITEMBLL : BaseBLL
|
{
|
#region 根据物料编码获取物料实体信息(访问MongoDB)
|
/// <summary>
|
/// 根据物料编码获取物料实体信息(访问MongoDB)
|
/// </summary>
|
/// <param name="itemCode">物料编码</param>
|
/// <returns></returns>
|
/// <History>[Hanhe(DBS)] created 2018-5-5</History>
|
public AutoBomItemEntity GetItem(string itemCode)
|
{
|
return CreateDAL<TN_WMS_ITEMDAL>().GetItemEntity(itemCode);
|
}
|
public AutoBomItemEntityYS GetItemYS(string itemCode)
|
{
|
return CreateDAL<TN_WMS_ITEMDAL>().GetItemEntityYS(itemCode);
|
}
|
|
public List<AutoBomItemEntity> GetItemByNameSpec(string itemName, string specification)
|
{
|
return CreateDAL<TN_WMS_ITEMDAL>().GetItemByNameSpec(itemName, specification);
|
}
|
/// <summary>
|
/// 根据物料编码返回物料实体
|
/// </summary>
|
/// <param name="itemCode"></param>
|
/// <returns></returns>
|
public List<AutoBomItemEntity> GetItemList(List<string> itemCodes)
|
{
|
return CreateDAL<TN_WMS_ITEMDAL>().GetItemList(itemCodes);
|
}
|
|
/// <summary>
|
/// 根据物料编码返回物料实体
|
/// </summary>
|
/// <param name="itemCode"></param>
|
/// <returns></returns>
|
public List<AutoBomItemEntity> GetAllItem(string itemCode)
|
{
|
return CreateDAL<TN_WMS_ITEMDAL>().GetAllItem(itemCode);
|
}
|
/// <summary>
|
/// 根据物料编码返回物料实体
|
/// </summary>
|
/// <param name="itemCode"></param>
|
/// <returns></returns>
|
/// <history>[HanHe(LT)] CREATED 2018/11/26</history>
|
public List<AutoBomItemEntity> GetListItemByCode(string itemCode, string itemName, string model, int pageIndex, int pageSize, out int total)
|
{
|
return CreateDAL<TN_WMS_ITEMDAL>().GetListItemByCode(itemCode, itemName, model, pageIndex, pageSize, out total);
|
}
|
#endregion
|
|
#region 物料列表
|
/// <summary>
|
/// 物料列表
|
/// </summary>
|
/// <returns></returns>
|
public List<AutoBomItemEntity> GetItemList(SearchModel searchModel, out int total)
|
{
|
return CreateDAL<TN_WMS_ITEMDAL>().GetItemList(searchModel, out total);
|
}
|
#endregion
|
|
#region 模糊匹配top条
|
/// <summary>
|
/// 模糊匹配top条
|
/// </summary>
|
/// <param name="key"></param>
|
/// <param name="top"></param>
|
/// <returns></returns>
|
public List<AutoBomItemEntity> GetMatchItem(string key, int top = 10)
|
{
|
return CreateDAL<TN_WMS_ITEMDAL>().GetMatchItem(key, top);
|
}
|
#endregion
|
|
public TN_AB_B_ITEM_PRICEEntity GetItemPriceModel(string itemCode)
|
{
|
TN_AB_B_ITEM_PRICEEntity entity = CreateDAL<TN_WMS_ITEMDAL>().GetItemPriceModel(itemCode);
|
//if (entity == null)
|
//{
|
|
//}
|
|
return entity;
|
}
|
|
public OperateResult GetItemDetail(string scanCode, string codeType)
|
{
|
string sqlWhere = "";//where条件
|
string itemCode = "";//物料编码
|
MONGO_PRINT_BARCODE printEntity = new MONGO_PRINT_BARCODE();
|
if (codeType == "0") //不限制
|
{
|
sqlWhere += "and CN_S_ITEM_CODE ='{0}' OR CN_S_SERIAL_NO='{0}' OR CN_S_PACKING_CODE='{0}'";
|
printEntity = CreateDAL<MONGO_PRINT_BARCODEDAL>().GetLikeValue(scanCode);
|
|
}
|
else if (codeType == "1")
|
{
|
itemCode = scanCode;
|
}
|
else if (codeType == "2")
|
{
|
printEntity = CreateDAL<MONGO_PRINT_BARCODEDAL>().GetFieldValue("CN_S_SERIAL_NO", scanCode);
|
}
|
else if (codeType == "3")
|
{
|
printEntity = CreateDAL<MONGO_PRINT_BARCODEDAL>().GetFieldValue("CN_S_UNIQUE_CODE", scanCode);
|
}
|
if (codeType != "1" && !string.IsNullOrEmpty(codeType))
|
{
|
itemCode = printEntity.CN_S_ITEM_CODE;
|
}
|
AutoBomItemEntity itemEnity = BLLCreator.Create<TN_WMS_ITEMBLL>().GetItem(itemCode);
|
return OperateResult.Succeed("", itemEnity);
|
|
}
|
}
|
}
|