using HH.WMS.BLL;
|
using HH.WMS.BLL.Basic;
|
using HH.WMS.Entitys;
|
using HH.WMS.Entitys.Basic;
|
using HH.WMS.Entitys.Common;
|
using HH.WMS.WebApi.Areas.Common.Controllers;
|
using Newtonsoft.Json;
|
using Newtonsoft.Json.Converters;
|
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.Basic
|
{
|
public class LotInfoController : BaseController
|
{
|
/// <summary>
|
/// 分页获取批次列表
|
/// </summary>
|
/// <param name="pageIndex">页码</param>
|
/// <param name="pageSize">页显示条数</param>
|
/// <returns></returns>
|
/// <History>[HANHE(XDL)] CREATED BY 2018-12-03</History>
|
[HttpGet]
|
public OperateResult GetLotList(int pageIndex, int pageSize)
|
{
|
try
|
{
|
return ValidateToken(x =>
|
{
|
var list = BLLCreator.Create<TN_WM_LOT_INFOBLL>().GetLotList(pageIndex, pageSize);
|
return list;
|
});
|
}
|
catch (Exception ex)
|
{
|
return OperateResult.Error(ex.Message);
|
}
|
}
|
|
#region 查询批次
|
/// <summary>
|
/// 查询批次
|
/// </summary>
|
/// <param name="searchModel">查询实体</param>
|
/// <returns></returns>
|
[HttpPost]
|
public string GetLotList(SearchModel searchModel)
|
{
|
return ValidateToken(searchModel.TokenId, m =>
|
{
|
OperateResult resultInfo = GetTokenInfo(searchModel.TokenId);
|
if (!resultInfo.Success) return JsonConvert.SerializeObject(resultInfo);
|
IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
|
timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
long total;
|
DataTable dt = BLLCreator.Create<TN_WM_LOT_INFOBLL>().GetLotList(searchModel, out total);
|
OperateResult pagingList = OperateResult.Succeed("", new
|
{
|
rows = dt,
|
total = total
|
});
|
return JsonConvert.SerializeObject(pagingList, timeFormat);
|
});
|
}
|
#endregion
|
|
[HttpGet]
|
public string GetLotInfoList()
|
{
|
return ValidateToken(m =>
|
{
|
try
|
{
|
List<TN_WM_LOT_INFOEntity> lotList = BLLCreator.Create<DapperBLL<TN_WM_LOT_INFOEntity>>().GetList();
|
return JsonConvert.SerializeObject(lotList);
|
}
|
catch (Exception ex)
|
{
|
return "";
|
}
|
});
|
}
|
|
/// <summary>
|
/// U8服务调用
|
/// </summary>
|
/// <param name="lotInfoList">批次集合</param>
|
/// <returns></returns>
|
[HttpPost]
|
public string AddLotInfo(List<TN_WM_LOT_INFOEntity> lotInfoList)
|
{
|
OperateResult or = BLLCreator.Create<DapperBLL<TN_WM_LOT_INFOEntity>>().AddRange(lotInfoList);
|
return JsonConvert.SerializeObject(or);
|
|
}
|
}
|
}
|