using System;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model.ModelDto.DataDto;
using System.Collections.Generic;
using WMS.Entity.DataEntity;
using WMS.IBLL.IDataServer;
using System.Security.Claims;
using System.Threading.Tasks;
namespace Wms.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
public class StatisticalController : ControllerBase
{
///
/// 依赖注入
///
private readonly IStockServer _stock; //统计报表
private readonly IStockDetailServer _stockDetail; //统计报表
private readonly IDataBoxInfoServer _dataBoxInfo; //导出
private readonly IStockInfoServer _stockInfo; //库存信息
///
/// 构造函数
///
/// 统计报表
/// 库存箱码明细
/// 导出
/// 库存信息
public StatisticalController(IStockServer stock, IStockDetailServer stockDetail, IDataBoxInfoServer dataBoxInfo, IStockInfoServer stockInfo)
{
_stock = stock; //统计报表
_stockDetail = stockDetail;
_dataBoxInfo = dataBoxInfo;
_stockInfo = stockInfo; //库存信息
}
#region 库存明细
///
/// 获取库存总量
///
/// 查询类型
/// 物料编码
/// 物料名称
/// 货主编码
/// 货主名称
/// 批次
/// 库存状态
/// 质检状态
///
[HttpGet]
public async Task GetInventoryList(string selectType, string skuNo, string skuName, string ownerNo, string ownerName, string lotNo, string status, string inspectStatus)
{
List StockList = await _stock.GetDataStockList(selectType, skuNo, skuName, ownerNo, ownerName, lotNo, status, inspectStatus);
return Ok(new
{
data = StockList,
code = 0,
msg = "获取库存总量成功"
});
}
///
/// 获取库存明细
///
/// 物料编码
/// 物料名称
/// 批次
/// 储位地址
/// 托盘条码
/// 库存状态
/// 质检状态
///
[HttpGet]
public IActionResult GetInventoryList1(string skuNo, string skuName, string lotNo, string locatNo, string palletNo, string status, string inspectStatus, string ownerNo, string ownerName, string startTime, string endTime)
{
List stockDetailsList = _stock.GetInventoryList1(skuNo, skuName, lotNo, locatNo, palletNo, status, inspectStatus, ownerNo, ownerName, startTime, endTime);
return Ok(new
{
data = stockDetailsList,
code = 0,
msg = "获取库存明细成功"
});
}
#endregion
#region 托盘明细
///
/// 获取托盘明细
///
/// 物料号
/// 物料名称
/// 托盘号
/// 批次号
/// 箱码
/// 箱支状态
/// 检验标记
/// 零托标记
/// 零箱标记
/// 质量状态
///
[HttpGet]
public IActionResult GetBindList(string skuNo, string skuName, string palletNo, string lotNo, string boxNo, string status,
string inspectMark, string bitPalletMark, string bitBoxMark, string inspectStatus, string ownerNo, string ownerName,
string startTime, string endTIme,string WareHouseNo,string AreaNo)
{
try
{
List boxInfoList = _stockDetail.GetBindList(skuNo, skuName, palletNo, lotNo, boxNo, status, inspectMark,
bitPalletMark, bitBoxMark, inspectStatus, ownerNo, ownerName, startTime, endTIme, WareHouseNo, AreaNo);
return Ok(new { data = boxInfoList, code = 0, msg = "获取托盘明细成功" });
}
catch (Exception e)
{
return Ok(new { data = "", code = 0, msg = e.Message });
}
}
///
/// 获取箱码明细
///
/// id
/// 物料号
/// 物料名称
/// 托盘号
/// 批次号
/// 箱码
/// 箱支状态
/// 检验标记
/// 零箱标记
/// 质量状态
///
[HttpGet]
public IActionResult GetBoxInfo(string id, string skuNo, string skuName, string palletNo, string lotNo,
string boxNo, string status, string inspectMark, string bitBoxMark, string inspectStatus, string WareHouseNo, string AreaNo)
{
try
{
List boxInfo = _dataBoxInfo.GetDataBoxInfo(id, skuNo, skuName, palletNo,
lotNo, boxNo, status, inspectMark, bitBoxMark, inspectStatus, WareHouseNo, AreaNo);
return Ok(new { data = boxInfo, code = 0, msg = "获取箱码明细成功" });
}
catch (Exception e)
{
return Ok(new { data = "", code = 0, msg = e.Message });
}
}
///
/// 根据箱码获取箱支信息
///
/// 箱码
/// 支码
///
[HttpGet]
public IActionResult GetBoxInfoByBoxNo(string boxNo, string boxNo3)
{
try
{
List boxInfo = _dataBoxInfo.GetBoxInfoByBoxNo(boxNo, boxNo3);
return Ok(new { data = boxInfo, code = 0, msg = "根据箱码获取箱支信息成功" });
}
catch (Exception e)
{
return Ok(new { data = "", code = 0, msg = e.Message });
}
}
#endregion
#region 低库存预警
///
/// 低库存预警
///
/// 物料号
/// 物料名称
/// 批次
/// 物料类型
///
[HttpGet]
public IActionResult GetInventoryWarning(string skuNo, string skuName, string lotNo, string type)
{
List stockList = _stock.GetInventoryWarning(skuNo, skuName, lotNo, type);
return Ok(new
{
data = stockList,
code = 0,
msg = "获取低库存预警成功"
});
}
#endregion
#region 临期预警
///
/// 获取临期预警信息
///
/// 物料号
/// 物料名称
/// 批次
/// 托盘号
/// 状态
/// 检验标记
/// 质量状态
///
[HttpGet]
public IActionResult GetEmergencyWarning(string skuNo, string skuName, string lotNo, string palletNo, string status, string inspectMark, string inspectStatus)
{
try
{
List stockList = _dataBoxInfo.GetEmergencyWarning(skuNo, skuName, lotNo, palletNo, status, inspectMark, inspectStatus);
return Ok(new { data = stockList, code = 0, msg = "获取临期预警成功" });
}
catch (Exception e)
{
return Ok(new { data = "", code = 0, msg = e.Message });
}
}
#endregion
#region 出入库报表
///
/// 获取出入库总量
///
/// 物料号
/// 物料名称
/// 批次
/// 开始时间
/// 结束时间
///
[HttpGet]
public IActionResult GetTotalRecord(string skuNo, string skuName, string lotNo, string startTime, string endTime)
{
List totalsList = _stock.GetTotalRecord(skuNo, skuName, lotNo, startTime, endTime);
return Ok(new
{
data = totalsList,
code = 0,
msg = "获取出入库总量成功"
});
}
///
/// 获取出入库记录
///
/// 物料号
/// 物料名称
/// 批次
/// 托盘
/// 开始时间
/// 结束时间
///
[HttpGet]
public IActionResult GetDetailedRecord(string skuNo, string skuName, string lotNo, string palletNo, string startTime, string endTime)
{
List totalsList = _stock.GetDetailedRecord(skuNo, skuName, lotNo, palletNo, startTime, endTime);
return Ok(new
{
data = totalsList,
code = 0,
msg = "获取出入库记录成功"
});
}
#endregion
#region 年度报表
///
/// 获取年报表
///
///
///
///
[HttpGet]
public IActionResult GetAssSoInfo(string StartTime, string EndTime)
{
try
{
var skulist = _stock.GetAssSoInfo(StartTime, EndTime);
return Ok(new { code = 0, count = 0, data = skulist, msg = "获取总量成功" });
}
catch (Exception ex)
{
return Ok(new { code = 1, count = 0, msg = ex.Message });
}
}
///
/// 获取年报表明细
///
///
///
///
///
[HttpGet]
public IActionResult GetAssSoInfoDetail(string skuNo, string StartTime, string EndTime)
{
try
{
var infolist = _stock.GetAssSoInfoDetail(skuNo, StartTime, EndTime);
return Ok(new { code = 0, count = 0, data = infolist, msg = "获取明细成功" });
}
catch (Exception ex)
{
return Ok(new { code = 1, count = 0, msg = ex.Message });
}
}
#endregion
#region 导出
///
/// 导出库存总量
///
///
///
///
[HttpGet]
public IActionResult GetInventoryListDaoChu(string skuNo, string skuName)
{
List StockList = _stock.GetDataStockListDaoChu(skuNo, skuName);
return Ok(new
{
data = StockList,
code = 0,
msg = "导出库存总量成功"
});
}
///
/// 导出库存明细
///
/// 物料编码
/// 物料名称
/// 批次
/// 储位地址
/// 托盘条码
/// 库存状态
/// 质检状态
///
[HttpGet]
public IActionResult GetInventoryList1DaoChu(string skuNo, string skuName, string lotNo, string locatNo, string palletNo, string status, string inspectStatus, string startTime, string endTime)
{
List stockDetailsList = _stock.GetInventoryList1DaoChu(skuNo, skuName, lotNo, locatNo, palletNo, status, inspectStatus, startTime, endTime);
return Ok(new
{
data = stockDetailsList,
code = 0,
msg = "导出库存明细成功"
});
}
///
/// 导出托盘明细
///
/// 物料号
/// 物料名称
/// 托盘号
/// 批次号
/// 箱码
/// 箱支状态
/// 检验标记
/// 零托标记
/// 零箱标记
/// 质量状态
///
[HttpGet]
public IActionResult GetBindListDaoChu(string skuNo, string skuName, string palletNo, string lotNo, string boxNo, string status, string inspectMark, string bitPalletMark, string bitBoxMark, string inspectStatus)
{
try
{
List boxInfoList = _stockDetail.GetBindListDaoChu(skuNo, skuName, palletNo, lotNo, boxNo, status, inspectMark, bitPalletMark, bitBoxMark, inspectStatus);
return Ok(new { data = boxInfoList, code = 0, msg = "导出托盘明细成功" });
}
catch (Exception e)
{
return Ok(new { data = "", code = 0, msg = e.Message });
}
}
///
/// 导出箱码明细
///
/// id
/// 物料号
/// 物料名称
/// 托盘号
/// 批次号
/// 箱码
/// 箱支状态
/// 检验标记
/// 零箱标记
/// 质量状态
///
[HttpGet]
public IActionResult GetBoxInfoDaoChu(string id, string skuNo, string skuName, string palletNo, string lotNo, string boxNo, string status, string inspectMark, string bitBoxMark, string inspectStatus)
{
try
{
List boxInfo = _dataBoxInfo.GetDataBoxInfoDaoChu(id, skuNo, skuName, palletNo, lotNo, boxNo, status, inspectMark, bitBoxMark, inspectStatus);
return Ok(new { data = boxInfo, code = 0, msg = "导出箱码明细成功" });
}
catch (Exception e)
{
return Ok(new { data = "", code = 0, msg = e.Message });
}
}
#endregion
#region 库存信息
///
/// 根据时间获取显示库存信息
///
///
///
[HttpGet]
public IActionResult GetDataStockInfo(string StartTime)
{
try
{
var list = _stockInfo.GetDataStockInfo(StartTime);
return Ok(new { code = 0, count = list.Count, data = list, msg = "获取库存信息成功" });
}
catch (Exception ex)
{
return Ok(new { code = 1, count = 0, msg = ex.Message });
}
}
#endregion
}
}