|
|
|
@ -19,6 +19,7 @@ using TouchSocket.Core;
|
|
|
|
|
using System.Numerics;
|
|
|
|
|
using Admin.Core.IService.IService_New;
|
|
|
|
|
using Admin.Core.Model.Model_New;
|
|
|
|
|
using log4net;
|
|
|
|
|
|
|
|
|
|
namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
{
|
|
|
|
@ -37,6 +38,8 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
//25kg物料重量
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(WarehouseController));
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 投料仓服务
|
|
|
|
|
/// </summary>
|
|
|
|
@ -57,6 +60,11 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly IBinFeedingReportServices _binFeedingReportServices;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物料服务
|
|
|
|
|
/// </summary>
|
|
|
|
|
private readonly Ixl_materialServices _xl_materialService;
|
|
|
|
|
|
|
|
|
|
#region 构造方法
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 构造方法
|
|
|
|
@ -65,13 +73,17 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
/// <param name="sysUserService"></param>
|
|
|
|
|
/// <param name="hwBarrelService"></param>
|
|
|
|
|
/// <param name="lrweighService"></param>
|
|
|
|
|
public WarehouseController(IHw_WarehouseServices hw_WarehouseServices, ISysUserService sysUserService, IHw_BarrelServices hwBarrelService, ILR_weighServices lrweighService, IBinFeedingReportServices binFeedingReportServices) : base(sysUserService)
|
|
|
|
|
/// <param name="binFeedingReportServices"></param>
|
|
|
|
|
/// <param name="xl_materialService"></param>
|
|
|
|
|
public WarehouseController(IHw_WarehouseServices hw_WarehouseServices, ISysUserService sysUserService,
|
|
|
|
|
IHw_BarrelServices hwBarrelService, ILR_weighServices lrweighService, IBinFeedingReportServices binFeedingReportServices, Ixl_materialServices xl_materialService) : base(sysUserService)
|
|
|
|
|
{
|
|
|
|
|
_sysUserService = sysUserService;
|
|
|
|
|
_hw_WarehouseService = hw_WarehouseServices;
|
|
|
|
|
_hw_BarrelService = hwBarrelService;
|
|
|
|
|
_lr_weighService = lrweighService;
|
|
|
|
|
_binFeedingReportServices = binFeedingReportServices;
|
|
|
|
|
_xl_materialService = xl_materialService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
@ -274,18 +286,46 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 读取对应料罐的编码并结束任务
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据罐号查询称量列表
|
|
|
|
|
/// 根据罐号查询称量列表并结束任务
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="barrelBarcode"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public async Task<MessageModel<List<LR_weigh_BatchCode>>> GetWeightInfoByBarrelID(string barrelBarcode)
|
|
|
|
|
public async Task<MessageModel<List<LR_weigh_BatchCode>>> GetWeightInfoByBarrelIDAndEndTask(string barrelBarcode)
|
|
|
|
|
{
|
|
|
|
|
if (!barrelBarcode.IsNotEmptyOrNull())
|
|
|
|
|
{
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("传入参数为空!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var result = await _xl_materialService.BindBarrel(barrelBarcode.Trim());
|
|
|
|
|
if (result == 0)
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("未查询到正在执行的计划!");
|
|
|
|
|
if (result == 1)
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("未查询到桶!");
|
|
|
|
|
if (result == 2)
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>($"未查询到[{barrelBarcode}]桶信息!");
|
|
|
|
|
if (result == 3)
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("该桶已经绑定物料,请联系系统管理员处理!");
|
|
|
|
|
if (result == 6)
|
|
|
|
|
//return Success(true);
|
|
|
|
|
log.Info("任务结束成功");
|
|
|
|
|
if (result == 7)
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("称重未完成!");
|
|
|
|
|
if (result == 8)
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("PLC连接失败,请检查PLC或者联系管理员处理!");
|
|
|
|
|
if (result == 10)
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("未知异常,请查看错误日志!");
|
|
|
|
|
if (result == 99)
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("保存处理数据失败!");
|
|
|
|
|
if (result == 100)
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("处理中....!");
|
|
|
|
|
if (result == 110)
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("执行批次未获取!");
|
|
|
|
|
|
|
|
|
|
MessageModel<List<LR_weigh>> messageModel = new MessageModel<List<LR_weigh>>();
|
|
|
|
|
string materialName = _hw_BarrelService.GetMaterialNameByBarrelID(barrelBarcode.Trim());
|
|
|
|
|
if (string.IsNullOrEmpty(materialName))
|
|
|
|
@ -309,8 +349,12 @@ namespace Admin.Core.Api.Controllers.Business
|
|
|
|
|
{
|
|
|
|
|
return Success(list);
|
|
|
|
|
}
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("执行失败!");
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return Failed<List<LR_weigh_BatchCode>>("任务结束成功但称量信息查询失败!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|