| | |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_ISystemService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Common.Constants; |
| | | using WIDESEA_Common.StockEnum; |
| | | using System.Diagnostics; |
| | | |
| | |
| | | { |
| | | private readonly IMesLogService _mesLogService; |
| | | private readonly IMesService _mesService; |
| | | private readonly IMESDeviceConfigService _mesDeviceConfigService; |
| | | private readonly ISys_DictionaryService _sysDictionaryService; |
| | | private readonly IStockInfoService _stockInfoService; |
| | | |
| | |
| | | IStockInfoService service, |
| | | IMesLogService mesLogService, |
| | | IMesService mesService, |
| | | IMESDeviceConfigService mesDeviceConfigService, |
| | | ISys_DictionaryService sysDictionaryService, |
| | | IStockInfoService stockInfoService) : base(service) |
| | | { |
| | | _mesLogService = mesLogService; |
| | | _mesService = mesService; |
| | | _mesDeviceConfigService = mesDeviceConfigService; |
| | | _sysDictionaryService = sysDictionaryService; |
| | | _stockInfoService = stockInfoService; |
| | | } |
| | |
| | | return response.Error($"当前库存状态不允许进站操作,当前状态:{stockInfo.StockStatus}"); |
| | | } |
| | | |
| | | // 4. 构造MES请求 |
| | | // 4. 动态获取MES凭证 |
| | | string deviceName = stockInfo.Remark == "GW_1" ? "高温静置1" |
| | | : stockInfo.Remark == "GW_2" ? "高温静置2" |
| | | : "常温静置1"; |
| | | var mesConfig = _mesDeviceConfigService.GetByDeviceName(deviceName); |
| | | |
| | | var mesRequest = new InboundInContainerRequest |
| | | { |
| | | EquipmentCode = "STK-GROUP-001", |
| | | ResourceCode = "STK-GROUP-001", |
| | | EquipmentCode = mesConfig?.EquipmentCode ?? StockConstants.MES_EQUIPMENT_CODE, |
| | | ResourceCode = mesConfig?.ResourceCode ?? StockConstants.MES_RESOURCE_CODE, |
| | | LocalTime = DateTime.Now, |
| | | ContainerCode = dto.PalletCode |
| | | }; |
| | | |
| | | string token = mesConfig?.Token; |
| | | string requestJson = System.Text.Json.JsonSerializer.Serialize(mesRequest); |
| | | string palletCode = stockInfo.PalletCode; |
| | | |
| | |
| | | var localStopwatch = Stopwatch.StartNew(); |
| | | try |
| | | { |
| | | var result = _mesService.InboundInContainer(mesRequest); |
| | | var result = string.IsNullOrWhiteSpace(token) |
| | | ? _mesService.InboundInContainer(mesRequest) |
| | | : _mesService.InboundInContainer(mesRequest, token); |
| | | localStopwatch.Stop(); |
| | | |
| | | bool isSuccess = result?.IsSuccess ?? false; |
| | |
| | | return response.Error($"当前库存状态不允许出站操作,当前状态:{stockInfo.StockStatus}"); |
| | | } |
| | | |
| | | // 4. 构造MES请求 |
| | | // 4. 动态获取MES凭证 |
| | | string deviceName = stockInfo.Remark == "GW_1" ? "高温静置1" |
| | | : stockInfo.Remark == "GW_2" ? "高温静置2" |
| | | : "常温静置1"; |
| | | var mesConfig = _mesDeviceConfigService.GetByDeviceName(deviceName); |
| | | |
| | | var mesRequest = new OutboundInContainerRequest |
| | | { |
| | | EquipmentCode = "STK-GROUP-001", |
| | | ResourceCode = "STK-GROUP-001", |
| | | EquipmentCode = mesConfig?.EquipmentCode ?? StockConstants.MES_EQUIPMENT_CODE, |
| | | ResourceCode = mesConfig?.ResourceCode ?? StockConstants.MES_RESOURCE_CODE, |
| | | LocalTime = DateTime.Now, |
| | | ContainerCode = dto.PalletCode, |
| | | ParamList = dto.ParamList?.Select(p => new ParamItem |
| | |
| | | }).ToList() |
| | | }; |
| | | |
| | | string token = mesConfig?.Token; |
| | | string requestJson = System.Text.Json.JsonSerializer.Serialize(mesRequest); |
| | | string palletCode = stockInfo.PalletCode; |
| | | |
| | |
| | | var localStopwatch = Stopwatch.StartNew(); |
| | | try |
| | | { |
| | | var result = _mesService.OutboundInContainer(mesRequest); |
| | | var result = string.IsNullOrWhiteSpace(token) |
| | | ? _mesService.OutboundInContainer(mesRequest) |
| | | : _mesService.OutboundInContainer(mesRequest, token); |
| | | localStopwatch.Stop(); |
| | | |
| | | bool isSuccess = result?.IsSuccess ?? false; |