using Microsoft.AspNetCore.Mvc;
using MiniExcelLibs;
using System.Linq.Expressions;
using WCS.BLL.DbModels;
using WCS.BLL.Services.IService;
using WCS.BLL.Services.Service;
using WCS.DAL.Db;
using WCS.DAL.DbModels;
using WCS.Model;
using WCS.Model.ApiModel;
using WCS.Model.ApiModel.BatchBindMatDetail;
using WCS.Model.ApiModel.Home;
using WCS.Model.ApiModel.MatBaseInfo;
using WCS.Model.ApiModel.PDAMatBind;
using WCS.Model.ApiModel.StoreInfo;
using WCS.Model.ApiModel.User;
using WCS.Model.WebSocketModel;
namespace WCS.WebApi.Controllers
{
///
/// PDA物料绑定相关接口
///
[ApiController]
[Route("[controller]")]
public class BatchBindMatDetailController : ControllerBase
{
public IBatchBindMatDetailService _batchBindMatDetailService { get; set; }
public BatchBindMatDetailController(IBatchBindMatDetailService batchBindMatDetailService)
{
_batchBindMatDetailService = batchBindMatDetailService;
}
[Route("getOrderTypes")]
[HttpPost(Name = "getOrderTypes")]
public async Task getOrderTypes(RequestBase request)
{
try
{
//直接获取当前所有货架类型并返回
var OrderTypes = DbHelp.db.Queryable()
.Select(t => new OrderTypeModel()
{
Id = t.Id,
OrderTypeName = t.OrderTypeName
})
.ToList();
return new PageQueryResponse()
{
Code = 200,
Message = "success",
Data = new PageQueryResponseData
{
Lists = OrderTypes,
Count = OrderTypes.Count
}
};
}
catch (Exception ex)
{
return new PageQueryResponse()
{
Code = 300,
Message = $"查询失败:{ex.Message}",
};
}
}
[Route("getMatDetailCurrentInfosByStationCode")]
[HttpPost(Name = "getMatDetailCurrentInfosByStationCode")]
public async Task GetMatDetailCurrentInfosByStationCode(GetMatDetailCurrentInfosByStationCodeRequest request)
{
////判断参数
//if (string.IsNullOrEmpty(request.StationCode))
//{
// return new ResponseCommon()
// {
// Code = 201,
// Message = "工位编码为空,请联系相关人员进行配置!",
// Data = null,
// };
//}
////判断工位是否存在
//var isExsistLocation = await DbHelp.db.Queryable()
// .Where(t => t.LocationCode == request.StationCode)
// .AnyAsync();
////不存在工位
//if (!isExsistLocation)
//{
// return new ResponseCommon()
// {
// Code = 201,
// Message = $"工位[{request.StationCode}]不存在,暂时无法使用此功能!",
// Data = null,
// };
//}
return await _batchBindMatDetailService.GetMatDetailCurrentInfosByStationCode(request);
}
[HttpPost("updateMatDetailCurrentInfoForBind")]
public async Task> updateMatDetailCurrentInfoForBind(AddLocaionInfoRequest request)
{
return await _batchBindMatDetailService.updateMatDetailCurrentInfo(request);
}
[HttpPost("deleteMatDetailCurrentInfoForBind")]
public async Task> deleteMatDetailCurrentInfoForBind(DeleteInfosRequest request)
{
//校验
if (request.needDeleteIds == null || request.needDeleteIds.Count == 0)
{
return new ResponseCommon