using HH.WMS.BLL;
|
using HH.WMS.BLL.Algorithm;
|
using HH.WMS.BLL.Basic;
|
using HH.WMS.Common.Algorithm;
|
using HH.WMS.Entitys;
|
using HH.WMS.Entitys.Algorithm;
|
using HH.WMS.Entitys.Basic;
|
using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Linq;
|
using System.Net;
|
using System.Net.Http;
|
using System.Web.Http;
|
|
namespace HH.WMS.WebApi.Areas.Common.Controllers
|
{
|
public class LocationController : BaseController
|
{
|
|
#region 获取仓库下的所有巷道
|
/// <summary>
|
/// 获取仓库下的所有巷道
|
/// </summary>
|
/// <param name="tokenId"></param>
|
/// <param name="stockCode">仓库号</param>
|
/// <param name="areaCode">库区号</param>
|
/// <returns></returns>
|
/// <History>[Hanhe(DBS)] created 2018/12/04</History>
|
[HttpGet]
|
public OperateResult GetTunnels(string stockCode, string areaCode)
|
{
|
try
|
{
|
return ValidateToken(y =>
|
{
|
List<AutoBomStockStructreEntity> structreList = BLLCreator.Create<TN_WMS_STOCKBLL>().GetStructList(stockCode, areaCode);
|
List<string> roadWay = structreList.GroupBy(x => x.CN_S_ROADWAY).OrderBy(x => x.Key).Select(o => o.Key).ToList();
|
return OperateResult.Succeed("", roadWay);
|
});
|
}
|
catch (Exception ex)
|
{
|
return OperateResult.Error("查询异常!" + ex.ToString());
|
}
|
}
|
#endregion
|
|
#region 获取巷道下面的所有排信息
|
/// <summary>
|
/// 获取巷道下面的所有排信息
|
/// </summary>
|
/// <param name="tokenId"></param>
|
/// <param name="stockCode">仓库号</param>
|
/// <param name="areaCode">库区号</param>
|
/// <param name="roadway">巷道</param>
|
/// <returns></returns>
|
/// <History>[Hanhe(DBS)] created 2018/12/04</History>
|
[HttpGet]
|
public OperateResult GetStructList(string stockCode, string areaCode, string roadway)
|
{
|
return ValidateToken(y =>
|
{
|
List<AutoBomStockStructreEntity> structreList = BLLCreator.Create<TN_WMS_STOCKBLL>().GetStructList(stockCode, areaCode);
|
if (!string.IsNullOrEmpty(roadway))
|
{
|
structreList = structreList.FindAll(x => x.CN_S_ROADWAY.Equals(roadway)).ToList();
|
}
|
structreList = structreList.OrderBy(e => e.CN_S_ROW).ToList();
|
return OperateResult.Succeed("", structreList);
|
});
|
}
|
#endregion
|
|
#region 获取巷道下的货位信息
|
/// <summary>
|
/// 获取巷 道下的货位信息
|
/// </summary>
|
/// <param name="tokenId"></param>
|
/// <param name="stockCode">仓库号</param>
|
/// <param name="areaCode">库区号</param>
|
/// <param name="roadway">巷道号</param>
|
/// <returns></returns>
|
/// <History>[Hanhe(DBS)] created 2018/12/04</History>
|
[HttpGet]
|
public string GetTunnelLocations(string stockCode, string areaCode, string roadway)
|
{
|
try
|
{
|
return ValidateToken(x =>
|
{
|
DataTable dt = BLLCreator.Create<TN_WM_LOCATION_EXTBLL>().ViewState(stockCode, areaCode, roadway);
|
return JsonConvert.SerializeObject(OperateResult.Succeed("", dt));
|
});
|
}
|
catch (Exception ex)
|
{
|
return JsonConvert.SerializeObject(OperateResult.Error("查询异常!" + ex.ToString()));
|
}
|
}
|
#endregion
|
|
#region PDA接口-获取建议货位
|
/// <summary>
|
/// 整托获取建议货位-空货位
|
/// </summary>
|
/// <param name="areaCode">库区</param>
|
/// <param name="trayCode">托盘编码</param>
|
/// <param name="itemCode">物料编码</param>
|
/// <param name="locationQty">获取货位的数量</param>
|
/// <param name="tokenId">tokenId</param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetZtEmptyCommandLocation(string areaCode, string trayCode, string itemCode, int locationQty)
|
{
|
return ValidateToken(x =>
|
{
|
//调用入库算法,获取空货位
|
InAlgorEnitty iAe = new InAlgorEnitty()
|
{
|
stockAreaCode = areaCode,
|
logicCode = "",
|
locationQty = locationQty,
|
trayCode = trayCode,
|
itemCode = itemCode,
|
lockLocation = false//是否需要锁定货位
|
};
|
iAe.lstDevice = null;
|
|
var paramString = JsonConvert.SerializeObject(iAe);
|
InResultEntity irEresult = BLLCreator.Create<In_AlgorBLL>().In(iAe);
|
if (!irEresult.Success)
|
{
|
return OperateResult.Error(irEresult.Msg);//货位获取失败!
|
}
|
|
return OperateResult.Succeed("", irEresult.lstLocation);
|
});
|
}
|
|
/// <summary>
|
/// 物料上架获取建议货位-空货位
|
/// </summary>
|
/// <param name="areaCode"></param>
|
/// <param name="itemCode"></param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetEmptyCommandLocation(string areaCode, string itemCode)
|
{
|
return ValidateToken(x =>
|
{
|
//调用补料算法,获取空货位
|
FeedAlgorEntity fAe = new FeedAlgorEntity()
|
{
|
stockAreaCode = areaCode,
|
itemCode = itemCode,
|
lockLocation = false//是否需要锁定货位
|
};
|
|
var paramString = JsonConvert.SerializeObject(fAe);
|
FeedResultEntity feedResult = BLLCreator.Create<Feed_AlgorBLL>().FeedEmptyLocation(fAe);
|
if (!feedResult.Success)
|
{
|
return OperateResult.Error(feedResult.Msg);//货位获取失败!
|
}
|
|
return OperateResult.Succeed("", feedResult.lstLocation);
|
});
|
}
|
#endregion
|
|
[HttpGet]
|
public OperateResult GetStateQty(string stockCode)
|
{
|
return ValidateToken(x =>
|
{
|
DataTable dt = BLLCreator.Create<TN_WM_LOCATION_EXTBLL>().GetStateQty(stockCode);
|
return OperateResult.Succeed("", dt);
|
});
|
}
|
|
#region 获取摆放位置
|
/// <summary>
|
/// 获取摆放位置
|
/// </summary>
|
/// <param name="areaClass">区域类型</param>
|
/// <returns></returns>
|
[HttpGet]
|
public OperateResult GetSHLocation(string areaClass)
|
{
|
return ValidateToken(x =>
|
{
|
List<AutoBomStockAreaEntity> list = new List<AutoBomStockAreaEntity>();
|
List<AutoBomLocationEntity> listlocation = new List<AutoBomLocationEntity>();
|
list = BLLCreator.Create<TN_WMS_STOCKBLL>().GetSHLocationArea(areaClass);
|
if (list.Count > 0)
|
{
|
List<string> arrAreaCode = new List<string>();
|
foreach (var item in list)
|
{
|
arrAreaCode.Add(item.CN_S_AREA_CODE);
|
}
|
listlocation = BLLCreator.Create<TN_WMS_STOCKBLL>().GetSHLocation(arrAreaCode);
|
}
|
return OperateResult.Succeed("", listlocation);
|
});
|
}
|
|
#endregion
|
|
}
|
}
|