| | |
| | | using Newtonsoft.Json; |
| | | using SqlSugar; |
| | | using System.Diagnostics; |
| | | using WIDESEA_Common.Constants; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.MES; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_IBasicService; |
| | |
| | | /// </summary> |
| | | public IMesService _mesService { get; } |
| | | |
| | | private readonly IMesLogService _mesLogService; |
| | | |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | |
| | | IStockInfo_HtyService stockInfo_HtyService, |
| | | IMesService mesService, |
| | | IWarehouseService warehouseService, |
| | | ISqlSugarClient sqlSugarClient) |
| | | ISqlSugarClient sqlSugarClient, |
| | | IMesLogService mesLogService) |
| | | { |
| | | StockInfoDetailService = stockInfoDetailService; |
| | | StockInfoService = stockInfoService; |
| | |
| | | _mesService = mesService; |
| | | _warehouseService = warehouseService; |
| | | SqlSugarClient = sqlSugarClient; |
| | | _mesLogService = mesLogService; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public async Task<WebResponseContent> GroupPalletConfirmAsync(string palletCode, string deviceName) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | var stopwatch = Stopwatch.StartNew(); |
| | | try |
| | | { |
| | | if (string.IsNullOrWhiteSpace(palletCode)) |
| | |
| | | Location = d.InboundOrderRowNo.ToString() |
| | | }).ToList() |
| | | }; |
| | | string requestJson = bindRequest.ToJson(); |
| | | var bindResult = string.IsNullOrWhiteSpace(token) |
| | | ? _mesService.BindContainer(bindRequest) |
| | | : _mesService.BindContainer(bindRequest, token); |
| | | stopwatch.Stop(); |
| | | await _mesLogService.LogAsync(new MesApiLogDto |
| | | { |
| | | ApiType = "BindContainer", |
| | | RequestJson = requestJson, |
| | | ResponseJson = System.Text.Json.JsonSerializer.Serialize(bindResult), |
| | | IsSuccess = bindResult.IsSuccess, |
| | | ErrorMessage = bindResult.ErrorMessage, |
| | | ElapsedMs = (int)stopwatch.ElapsedMilliseconds, |
| | | Creator = "systeam" |
| | | }); |
| | | if (bindResult == null || bindResult.Data == null || !bindResult.Data.IsSuccess) |
| | | { |
| | | return content.Error($"MES绑定失败: {bindResult?.Data?.Msg ?? bindResult?.ErrorMessage ?? "未知错误"}"); |