|
|
|
@ -15,6 +15,8 @@ using Admin.Core.Model.ViewModels;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc.ViewEngines;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
using System.Numerics;
|
|
|
|
|
using Admin.Core.IService.IService_New;
|
|
|
|
|
|
|
|
|
|
namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
{
|
|
|
|
@ -38,16 +40,30 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly IHw_WarehouseServices _hw_WarehouseService;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 料筒服务类
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly IHw_BarrelServices _hw_BarrelService;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 称重服务类
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly ILR_weighServices _lr_weighService;
|
|
|
|
|
|
|
|
|
|
#region 构造方法
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 构造方法
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="hw_WarehouseServices"></param>
|
|
|
|
|
/// <param name="sysUserService"></param>
|
|
|
|
|
public WarehouseController(IHw_WarehouseServices hw_WarehouseServices, ISysUserService sysUserService) : base(sysUserService)
|
|
|
|
|
/// <param name="hwBarrelService"></param>
|
|
|
|
|
/// <param name="lrweighService"></param>
|
|
|
|
|
public WarehouseController(IHw_WarehouseServices hw_WarehouseServices, ISysUserService sysUserService, IHw_BarrelServices hwBarrelService, ILR_weighServices lrweighService) : base(sysUserService)
|
|
|
|
|
{
|
|
|
|
|
_sysUserService = sysUserService;
|
|
|
|
|
_hw_WarehouseService = hw_WarehouseServices;
|
|
|
|
|
_hw_BarrelService = hwBarrelService;
|
|
|
|
|
_lr_weighService = lrweighService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
@ -61,13 +77,13 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
/// <param name="code">料桶Id</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<MessageModel<BarrelView>> GetByBarrelInfo(string kettleBarCode, string planId,string code)
|
|
|
|
|
public async Task<MessageModel<BarrelView>> GetByBarrelInfo(string kettleBarCode, string planId, string code)
|
|
|
|
|
{
|
|
|
|
|
if (!code.IsNotEmptyOrNull())
|
|
|
|
|
{
|
|
|
|
|
return Failed<BarrelView>("传入参数为空!");
|
|
|
|
|
}
|
|
|
|
|
var query = await _hw_WarehouseService.GetXlInfo(kettleBarCode.Trim(),planId.Trim(),code.Trim());
|
|
|
|
|
var query = await _hw_WarehouseService.GetXlInfo(kettleBarCode.Trim(), planId.Trim(), code.Trim());
|
|
|
|
|
if (query == null)
|
|
|
|
|
{
|
|
|
|
|
return Failed<BarrelView>("查询失败!");
|
|
|
|
@ -84,7 +100,7 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
/// <param name="planId">计划Id</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<MessageModel<WarehouseView>> GetByCode(string code,string planId)
|
|
|
|
|
public async Task<MessageModel<WarehouseView>> GetByCode(string code, string planId)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (!code.IsNotEmptyOrNull())
|
|
|
|
@ -96,11 +112,11 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
return Failed<WarehouseView>("传入计划ID参数为空!");
|
|
|
|
|
}
|
|
|
|
|
var query = await _hw_WarehouseService.QueryByCode(code.Trim(), planId);
|
|
|
|
|
|
|
|
|
|
if (query==null)
|
|
|
|
|
|
|
|
|
|
if (query == null)
|
|
|
|
|
{
|
|
|
|
|
return Failed<WarehouseView>("查询失败!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Success(query);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
@ -121,7 +137,7 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
var result = await _hw_WarehouseService.UpdatePlcState(view);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
return Success(result);
|
|
|
|
|
return Success(result);
|
|
|
|
|
}
|
|
|
|
|
return Failed<bool>("执行失败!");
|
|
|
|
|
}
|
|
|
|
@ -162,7 +178,7 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
////产品名称
|
|
|
|
|
//var ss3 = "D1-813";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
@ -179,13 +195,13 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
/// <param name="state"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<MessageModel<bool>> ExecPlcState(string code,int state)
|
|
|
|
|
public async Task<MessageModel<bool>> ExecPlcState(string code, int state)
|
|
|
|
|
{
|
|
|
|
|
if (!code.IsNotEmptyOrNull() || !state.IsNotEmptyOrNull())
|
|
|
|
|
{
|
|
|
|
|
return Failed<bool>("传入参数为空!");
|
|
|
|
|
}
|
|
|
|
|
var result = await _hw_WarehouseService.UpdatePlcState(code,state);
|
|
|
|
|
var result = await _hw_WarehouseService.UpdatePlcState(code, state);
|
|
|
|
|
if (result)
|
|
|
|
|
{
|
|
|
|
|
return Success(result);
|
|
|
|
@ -208,7 +224,7 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
var result = await _hw_WarehouseService.GetPlanWeightInfo();
|
|
|
|
|
if (result != null)
|
|
|
|
|
{
|
|
|
|
|
return Success(result,"成功");
|
|
|
|
|
return Success(result, "成功");
|
|
|
|
|
}
|
|
|
|
|
return Failed<List<XLPlanWeightView>>("执行失败!");
|
|
|
|
|
}
|
|
|
|
@ -234,7 +250,34 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
messageModel.success = true;
|
|
|
|
|
messageModel.data = list;
|
|
|
|
|
return Success(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据罐号查询称量列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="barrelID"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<MessageModel<List<LR_weigh>>> GetWeightInfoByBarrelID(string barrelBarcode)
|
|
|
|
|
{
|
|
|
|
|
if (!barrelBarcode.IsNotEmptyOrNull())
|
|
|
|
|
{
|
|
|
|
|
return Failed<List<LR_weigh>>("传入参数为空!");
|
|
|
|
|
}
|
|
|
|
|
MessageModel<List<LR_weigh>> messageModel = new MessageModel<List<LR_weigh>>();
|
|
|
|
|
string planID = _hw_BarrelService.GetPlanIdByBarrelID(barrelBarcode.Trim());
|
|
|
|
|
if (string.IsNullOrEmpty(planID))
|
|
|
|
|
{
|
|
|
|
|
return Failed<List<LR_weigh>>("查询不到罐号对应的计划ID!");
|
|
|
|
|
}
|
|
|
|
|
List<LR_weigh> list = _lr_weighService.GetRecentWeightList(planID);
|
|
|
|
|
if (list != null)
|
|
|
|
|
{
|
|
|
|
|
return Success(list);
|
|
|
|
|
}
|
|
|
|
|
return Failed<List<LR_weigh>>("执行失败!");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|