diff --git a/Admin.Core.Api/Admin.Core.Api.xml b/Admin.Core.Api/Admin.Core.Api.xml index fa457cb..0693c6a 100644 --- a/Admin.Core.Api/Admin.Core.Api.xml +++ b/Admin.Core.Api/Admin.Core.Api.xml @@ -410,7 +410,12 @@ 料仓投料验证服务类 - + + + 物料服务 + + + 构造方法 @@ -418,6 +423,8 @@ + + @@ -471,9 +478,9 @@ - + - 根据罐号查询称量列表 + 根据罐号查询称量列表并结束任务 diff --git a/Admin.Core.Api/Controllers/Business/WarehouseController.cs b/Admin.Core.Api/Controllers/Business/WarehouseController.cs index 03c47fb..e1b4690 100644 --- a/Admin.Core.Api/Controllers/Business/WarehouseController.cs +++ b/Admin.Core.Api/Controllers/Business/WarehouseController.cs @@ -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)); + /// /// 投料仓服务 /// @@ -57,6 +60,11 @@ namespace Admin.Core.Api.Controllers.Business /// private readonly IBinFeedingReportServices _binFeedingReportServices; + /// + /// 物料服务 + /// + private readonly Ixl_materialServices _xl_materialService; + #region 构造方法 /// /// 构造方法 @@ -65,13 +73,17 @@ namespace Admin.Core.Api.Controllers.Business /// /// /// - public WarehouseController(IHw_WarehouseServices hw_WarehouseServices, ISysUserService sysUserService, IHw_BarrelServices hwBarrelService, ILR_weighServices lrweighService, IBinFeedingReportServices binFeedingReportServices) : base(sysUserService) + /// + /// + 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 读取对应料罐的编码并结束任务 + /// - /// 根据罐号查询称量列表 + /// 根据罐号查询称量列表并结束任务 /// /// /// [HttpGet] - public async Task>> GetWeightInfoByBarrelID(string barrelBarcode) + public async Task>> GetWeightInfoByBarrelIDAndEndTask(string barrelBarcode) { if (!barrelBarcode.IsNotEmptyOrNull()) { return Failed>("传入参数为空!"); } + + var result = await _xl_materialService.BindBarrel(barrelBarcode.Trim()); + if (result == 0) + return Failed>("未查询到正在执行的计划!"); + if (result == 1) + return Failed>("未查询到桶!"); + if (result == 2) + return Failed>($"未查询到[{barrelBarcode}]桶信息!"); + if (result == 3) + return Failed>("该桶已经绑定物料,请联系系统管理员处理!"); + if (result == 6) + //return Success(true); + log.Info("任务结束成功"); + if (result == 7) + return Failed>("称重未完成!"); + if (result == 8) + return Failed>("PLC连接失败,请检查PLC或者联系管理员处理!"); + if (result == 10) + return Failed>("未知异常,请查看错误日志!"); + if (result == 99) + return Failed>("保存处理数据失败!"); + if (result == 100) + return Failed>("处理中....!"); + if (result == 110) + return Failed>("执行批次未获取!"); + MessageModel> messageModel = new MessageModel>(); 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>("执行失败!"); - + else + { + return Failed>("任务结束成功但称量信息查询失败!"); + } } + + #endregion } } \ No newline at end of file