| | |
| | | using NPOI.SS.Formula.Functions; |
| | | using NPOI.SS.UserModel; |
| | | using NPOI.XSSF.UserModel; |
| | | using RYB_PTL_API; |
| | | using SqlSugar; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.DirectoryServices.Protocols; |
| | | using System.Linq; |
| | | using System.Net.Http.Headers; |
| | | using System.Security.Policy; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_DTO.Agv; |
| | | using WIDESEA_External.Model; |
| | |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// 䏿æç§å¢ä¸å |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public EPLightContent Phase1PickOrderInfoRequest(List<EPLightSendDTO> lightSendDTOs) |
| | | { |
| | | EPLightContent content = new EPLightContent(); |
| | | |
| | | try |
| | | { |
| | | string? url = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.Phase1PickOrderInfoRequest.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(url)) |
| | | { |
| | | return content.Error("æªæ¾å°æç§å¢ä¸åæ¥å£ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | } |
| | | |
| | | bool allSuccess = true; |
| | | StringBuilder errorMessages = new StringBuilder(); |
| | | |
| | | foreach (EPLightSendDTO lightSendDTO in lightSendDTOs) |
| | | { |
| | | try |
| | | { |
| | | bool operationResult; |
| | | |
| | | // å¤çç¯å
ç±»åè½¬æ¢ |
| | | if (!int.TryParse(lightSendDTO.LIGHTTYPE, out int lightType)) |
| | | { |
| | | allSuccess = false; |
| | | errorMessages.AppendLine($"ä½ç½® {lightSendDTO.LOCATION} é误: æ æçç¯å
ç±»å '{lightSendDTO.LIGHTTYPE}'"); |
| | | continue; |
| | | } |
| | | |
| | | // å¤çå
³éç¯å
è¯·æ± |
| | | if (lightType == 2) |
| | | { |
| | | operationResult = RYB_PTL.RYB_PTL_CloseDigit5(url, lightSendDTO.LOCATION); |
| | | // TODO: å
³éç¯å
åè°å¤ç |
| | | List<EPLightBackDTO> lightBackDTOs = new List<EPLightBackDTO>(); |
| | | List<TaskBackLight> taskBackLights = lightBackDTOs.Select(x => new TaskBackLight() |
| | | { |
| | | TagNo = "B1", |
| | | TagCode = x.LOCATION, |
| | | }).ToList(); |
| | | content = WMSLightBack(taskBackLights); |
| | | } |
| | | // å¤çæ¾ç¤ºç¯å
è¯·æ± |
| | | else |
| | | { |
| | | // å¤çç¯å
é¢è²è½¬æ¢ |
| | | if (!int.TryParse(lightSendDTO.LIGHTCOLOR, out int lightColor)) |
| | | { |
| | | allSuccess = false; |
| | | errorMessages.AppendLine($"ä½ç½® {lightSendDTO.LOCATION} é误: æ æçç¯å
é¢è² '{lightSendDTO.LIGHTCOLOR}'"); |
| | | continue; |
| | | } |
| | | |
| | | operationResult = RYB_PTL.RYB_PTL_DspDigit5( |
| | | url, |
| | | |
| | | lightSendDTO.LOCATION, |
| | | lightSendDTO.QUANTITY, |
| | | lightType, |
| | | lightColor); |
| | | } |
| | | |
| | | if (!operationResult) |
| | | { |
| | | allSuccess = false; |
| | | errorMessages.AppendLine($"ä½ç½® {lightSendDTO.LOCATION} æä½å¤±è´¥"); |
| | | } |
| | | } |
| | | |
| | | catch (Exception ex) |
| | | { |
| | | allSuccess = false; |
| | | errorMessages.AppendLine($"ä½ç½® {lightSendDTO.LOCATION} å¤çå¼å¸¸: {ex.Message}"); |
| | | } |
| | | } |
| | | |
| | | return allSuccess |
| | | ? content.OK("æææç§å¢ä¸åæä½æå") |
| | | : content.Error(errorMessages.ToString()); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// æç§å¢äº®ç¯ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (taskSendLight.TagNo=="B2") |
| | | if (taskSendLight.TagNo == "B1") |
| | | { |
| | | List<EPLightSendDTO> lightSendDTOs = new List<EPLightSendDTO>() |
| | | { |
| | | new EPLightSendDTO |
| | | { |
| | | DOCNO = taskSendLight.DocNo, |
| | | TASKNO= taskSendLight.TaskNo, |
| | | LOCATION=taskSendLight.TagCode, |
| | | QUANTITY=taskSendLight.TagQunity, |
| | | LIGHTCOLOR=taskSendLight.Color switch |
| | | { |
| | | "Blue" => "1", |
| | | "Green" => "2", |
| | | "Red" => "4", |
| | | _ => throw new Exception($"æªæ¾å°é¢è²å®ä¹") |
| | | }, |
| | | ORDERTYPE="1", |
| | | LIGHTTYPE=taskSendLight.Mode.ToString(), |
| | | } |
| | | }; |
| | | EPLightContent pLightContent = Phase1PickOrderInfoRequest(lightSendDTOs); |
| | | if (pLightContent.Result != "0") throw new Exception($"{pLightContent.Msg}"); |
| | | content.OK(); |
| | | } |
| | | else if (taskSendLight.TagNo == "B2") |
| | | { |
| | | List<EPLightSendDTO> lightSendDTOs = new List<EPLightSendDTO>() |
| | | { |