| | |
| | | using LogLibrary.Log; |
| | | using Masuit.Tools; |
| | | using Newtonsoft.Json; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.MOM; |
| | | using WIDESEA_IStorageBasicService; |
| | | using WIDESEA_IStoragIntegrationServices; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_StoragIntegrationServices; |
| | | |
| | | public class CellStateService : ICellStateService |
| | | { |
| | | private readonly LogFactory LogFactory = new LogFactory(); |
| | | |
| | | private readonly IBoxingInfoService _boxingInfoService; |
| | | |
| | | public CellStateService(IBoxingInfoService boxingInfoService) |
| | | { |
| | | _boxingInfoService = boxingInfoService; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 单电芯属性获取 |
| | |
| | | /// <returns></returns> |
| | | public async Task<dynamic> GetCellStateAsync(CellStateDto input) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | input.SessionId = Guid.NewGuid().ToString(); |
| | | input.Software = "陈化机"; |
| | | input.EquipmentCode = "P1K10040"; |
| | | input.EmployeeNo = "T00001"; |
| | | input.RequestTime = DateTime.UtcNow.ToString(); |
| | | input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); |
| | | var inputJson = input.ToDictionary(); |
| | | var x = await HttpsClient.PostAsync("https://localhost:7251/api/CellState/GetCellState", inputJson); |
| | | var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/CellState", inputJson); |
| | | if (x != null) |
| | | { |
| | | ResultCellState result = JsonConvert.DeserializeObject<ResultCellState>(x); |
| | | DtBoxingInfo boxingInfo = new DtBoxingInfo() |
| | | { |
| | | IsFull = true, |
| | | PalletCode = "", |
| | | }; |
| | | var details = new List<DtBoxingInfoDetail>(); |
| | | foreach (var item in result.SerialNos) |
| | | { |
| | | DtBoxingInfoDetail detail = new DtBoxingInfoDetail() |
| | | { |
| | | SerialNumber = item.SerialNo, |
| | | OrderNo = item.BindCode, |
| | | Status = item.SerialNoStatus, |
| | | }; |
| | | details.Add(detail); |
| | | } |
| | | boxingInfo.BoxingInfoDetails = details; |
| | | var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo); |
| | | if (abc.Status) |
| | | return content.OK("组盘成功"); |
| | | else |
| | | return content.Error("组盘失败"); |
| | | } |
| | | LogFactory.GetLog("单电芯属性获取").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("单电芯属性获取").Info(true, x); |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="input">电芯数据</param> |
| | | /// <returns></returns> |
| | | public async Task<dynamic> GetTrayCellStatusAsync(TrayCellsStatusDto input) |
| | | public async Task<WebResponseContent> GetTrayCellStatusAsync(TrayCellsStatusDto input) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | input.SessionId = Guid.NewGuid().ToString(); |
| | | input.Software = "陈化机"; |
| | | input.EquipmentCode = "P1K10040"; |
| | | input.EmployeeNo = "T00001"; |
| | | input.RequestTime = DateTime.UtcNow.ToString(); |
| | | input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); |
| | | var inputJson = input.ToDictionary(); |
| | | var x = await HttpsClient.PostAsync("https://localhost:7251/api/CellState/GetCellState", inputJson); |
| | | var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/TrayCellsStatus", inputJson); |
| | | if (x != null) |
| | | { |
| | | ResultTrayCellsStatus result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(x); |
| | | DtBoxingInfo boxingInfo = new DtBoxingInfo() |
| | | { |
| | | IsFull = true, |
| | | PalletCode = result.TrayBarcode, |
| | | }; |
| | | var details = new List<DtBoxingInfoDetail>(); |
| | | foreach (var item in result.SerialNos) |
| | | { |
| | | DtBoxingInfoDetail detail = new DtBoxingInfoDetail() |
| | | { |
| | | SerialNumber = item.SerialNo, |
| | | OrderNo = item.PositionNo.ToString(), |
| | | Status = item.SerialNoStatus, |
| | | Remark = result.TrayBarcodePropertys.ToJsonString(), |
| | | MaterielCode = result.BindCode, |
| | | }; |
| | | details.Add(detail); |
| | | } |
| | | boxingInfo.BoxingInfoDetails = details; |
| | | var abc = await _boxingInfoService.AddBoxingInfoAsync(boxingInfo); |
| | | if (abc.Status) |
| | | content.OK("组盘成功", result); |
| | | else |
| | | content.Error("组盘失败"); |
| | | } |
| | | LogFactory.GetLog("整盘电芯属性获取").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("整盘电芯属性获取").Info(true, x); |
| | | } |
| | |
| | | LogFactory.GetLog("整盘电芯属性获取").Error(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("整盘电芯属性获取").Error(true, err.StackTrace); |
| | | } |
| | | return Task.FromResult<dynamic>(null); |
| | | return content; |
| | | } |
| | | } |