| | |
| | | using MapsterMapper;
|
| | | using Microsoft.Extensions.Configuration;
|
| | | using Newtonsoft.Json;
|
| | | using Newtonsoft.Json.Linq;
|
| | | using Serilog;
|
| | | using SqlSugar;
|
| | | using System.Diagnostics;
|
| | | using System.Diagnostics.CodeAnalysis;
|
| | | using System.Text;
|
| | | using WIDESEA_Core;
|
| | | using WIDESEAWCS_Common;
|
| | | using WIDESEAWCS_Common.HttpEnum;
|
| | |
| | | _taskExecuteDetailService = taskExecuteDetailService;
|
| | | _logger = logger;
|
| | | }
|
| | |
|
| | | public override WebResponseContent DeleteData(object[] keys)
|
| | | {
|
| | | List<int> taskKeys = new List<int>();
|
| | |
| | | List<Dt_RobotTask> tasks = BaseDal.QueryData(x => taskKeys.Contains(x.RobotTaskId));
|
| | | BaseDal.DeleteAndMoveIntoHty(tasks, OperateTypeEnum.人工删除);
|
| | | return WebResponseContent.Instance.OK($"成功删除{tasks.Count}条数据");
|
| | |
|
| | | }
|
| | |
|
| | | public bool DeleteRobotTask(int id)
|
| | | {
|
| | | Dt_RobotTask task = BaseDal.QueryFirst(x => x.RobotTaskId == id);
|
| | |
| | |
|
| | | public Dt_RobotTask? QueryRobotCraneTask(string deviceCode)
|
| | | {
|
| | | return BaseDal.QueryFirst(x => x.RobotRoadway == deviceCode && x.RobotTaskState != (int)TaskRobotStatusEnum.RobotExecuting, TaskOrderBy);
|
| | | return BaseDal.QueryFirst(x => x.RobotRoadway == deviceCode, TaskOrderBy);
|
| | | }
|
| | |
|
| | | public Dt_RobotTask? QueryRobotCraneExecutingTask(string deviceCode)
|
| | |
| | | /// 获取机械手任务总数量。
|
| | | /// 组盘任务固定48,换盘和拆盘任务通过托盘号查询WMS库存明细数量。
|
| | | /// </summary>
|
| | | private int GetRobotTaskTotalNum(int taskType, string? palletCode)
|
| | | public int GetRobotTaskTotalNum(int taskType, string? palletCode)
|
| | | {
|
| | | if (taskType == (int)RobotTaskTypeEnum.GroupPallet)
|
| | | return 48;
|
| | |
| | |
|
| | | try
|
| | | {
|
| | | QuartzLogHelper.LogInfo(_logger, $"开始调用WMS接口获取库存明细数量,托盘号:【{palletCode}】", "RobotTaskService");
|
| | | string url = $"{BaseAPI.WMSBaseUrl}Stock/GetStockDetailCount?palletCode={Uri.EscapeDataString(palletCode)}";
|
| | | var result = _httpClientHelper.Get(url);
|
| | | QuartzLogHelper.LogInfo(_logger, $"调用WMS获取库存明细数量接口,请求URL:【{url}】,响应数据:【{result.Content}】,耗时:{result.Duration}ms", "RobotTaskService");
|
| | | if (!result.IsSuccess || string.IsNullOrEmpty(result.Content))
|
| | | return 1;
|
| | |
|
| | |
| | | if (response == null || !response.Status)
|
| | | return 1;
|
| | |
|
| | | var detailCount = response.Data?.GetType().GetProperty("DetailCount")?.GetValue(response.Data);
|
| | | return detailCount is int count and > 0 ? count : 1;
|
| | | var detailCount = (response.Data as JObject)?["detailCount"]?.Value<int>();
|
| | | return detailCount.HasValue && detailCount.Value > 0 ? detailCount.Value : 1;
|
| | | }
|
| | | catch
|
| | | {
|
| | |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
|
| | |
|
| | | DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(ConveyorLineDBNameNew.Barcode) && x.DeviceChildCode == sourceLineNo);
|
| | | //conveyorLine.Communicator.Read(devicePro.DeviceProAddress, 20);
|
| | | //ConveyorLineTaskCommandNew command = conveyorLine.ReadCustomer<ConveyorLineTaskCommandNew>(sourceLineNo); // 测试用
|
| | | var barcode = conveyorLine.GetValue<ConveyorLineDBNameNew, string>(ConveyorLineDBNameNew.Barcode, sourceLineNo);
|
| | | var bytes = conveyorLine.Communicator.Read(devicePro.DeviceProAddress, 20);
|
| | | var barcode = Encoding.Default.GetString(bytes).Trim();
|
| | | stock.SourcePalletNo = string.IsNullOrEmpty(barcode) ? string.Empty : barcode;
|
| | | }
|
| | | }
|