From 87e7e9995d59c847f6e568453eb4895a77d74e32 Mon Sep 17 00:00:00 2001 From: 肖洋 <cathay_xy@163.com> Date: 星期三, 20 十一月 2024 13:03:51 +0800 Subject: [PATCH] MOM设备编号与上位机名称加入区域配置项 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 67 +++++++++++++++++++++------------ 1 files changed, 43 insertions(+), 24 deletions(-) diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs index ed4d3ef..01a3727 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs @@ -93,11 +93,11 @@ { if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound) { - var process = await SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>() - .FirstAsync(x => x.EquipmentName == task.Roadway); - var info = JsonConvert.DeserializeObject<ResponseEqptRunDto>(process.ProcessValue); + //var process = await SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>() + // .FirstAsync(x => x.EquipmentName == task.Roadway); + //var info = JsonConvert.DeserializeObject<ResponseEqptRunDto>(process.ProcessValue); - var agingOutputDto = MapToAgingOutputDto(stock, info); + var agingOutputDto = MapToAgingOutputDto(stock); content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto); ValidateResponse(content); } @@ -123,31 +123,37 @@ } } - private AgingOutputDto MapToAgingOutputDto(DtStockInfo stock, ResponseEqptRunDto info) + private AgingOutputDto MapToAgingOutputDto(DtStockInfo stock, ResponseEqptRunDto info = null) { // TODO Value鍊兼牴鎹甅OM涓嬪彂鐨勯潤缃椂闂村埌褰撳墠鏃堕棿鐨勫垎閽熸暟 + var area = _areaInfoRepository.QueryFirst(x => x.AreaCode == stock.AreaCode); + if (area == null) + { + throw new Exception("鏈壘鍒板搴旂殑搴撳尯淇℃伅"); + } return new AgingOutputDto { OpFlag = 1, - Software = "WMS", - EquipmentCode = "24MEJQ08-1091", + Software = area.Spare3, + EquipmentCode = area.Spare2, TrayBarcode = stock.PalletCode, SerialNos = stock.StockInfoDetails.Select(x => new SerialNoOutDto { SlotNo = x.OrderNo.ToInt32(), SerialNo = x.SerialNumber, SerialNoResult = true, - ParameterInfo = info.ParameterInfo.Select(y => new ParameterInfo() - { - LowerLomit = y.LowerControlLimit, - UpperLimit = y.UpperControlLimit, - ParameterResult = y.EquipmentAvailabilityFlag, - ParameterCode = y.ParameterCode, - ParameterDesc = y.Description, - TargetValue = y.TargetValue, - Value = (DateTime.Parse(stock.LinedProcessFeedbackTime, null, System.Globalization.DateTimeStyles.RoundtripKind).ToLocalTime() - stock.CreateDate).TotalMinutes.ToString(), - DefectCode = y.UOMCode - }).ToList() + ParameterInfo = new List<ParameterInfo> { new ParameterInfo() { Value = (DateTime.Now - stock.CreateDate).TotalMinutes.ToString() } } + //ParameterInfo = info.ParameterInfo.Select(y => new ParameterInfo() + //{ + // LowerLomit = y.LowerControlLimit, + // UpperLimit = y.UpperControlLimit, + // ParameterResult = y.EquipmentAvailabilityFlag, + // ParameterCode = y.ParameterCode, + // ParameterDesc = y.Description, + // TargetValue = y.TargetValue, + // Value = (DateTime.Parse(stock.LinedProcessFeedbackTime, null, System.Globalization.DateTimeStyles.RoundtripKind).ToLocalTime() - stock.CreateDate).TotalMinutes.ToString(), + // DefectCode = y.UOMCode + //}).ToList() }).ToList() }; } @@ -289,6 +295,7 @@ // 璁板綍寮傚父淇℃伅鍒版帶鍒跺彴鍜屾棩蹇� Console.WriteLine(err.Message.ToString()); LogFactory.GetLog("浠诲姟瀹屾垚").Error(true, err); + content.Error(err.Message); } return content; } @@ -327,7 +334,11 @@ private DtStockInfo CreateFullPalletStock(Dt_Task task, DtLocationInfo locationInf, DtBoxingInfo boxing) { var loation = _locationRepository.QueryFirst(x => x.RoadwayNo == task.Roadway && x.LocationCode == task.TargetAddress); + if (loation == null) + throw new Exception("鏈壘鍒板搴斾綅缃俊鎭�"); var area = _areaInfoRepository.QueryFirst(x => x.AreaID == loation.AreaId); + if (area == null) + throw new Exception("鏈壘鍒板搴斿尯鍩熶俊鎭�"); var boxDetail = boxing.BoxingInfoDetails.Adapt<List<DtStockInfoDetail>>(); boxDetail.ForEach(x => { x.Status = (int)StockStateEmun.宸插叆搴�; }); var stock = new DtStockInfo() @@ -350,8 +361,8 @@ .ToList(), TrayBarcode = task.PalletCode, OpFlag = 1, - EquipmentCode = "24MEJQ08-1091", - Software = "WMS" + EquipmentCode = area.Spare2, + Software = area.Spare3 }; var result = _agingInOrOutInputService.GetOCVInputAsync(agingInputDto).Result; var respone = JsonConvert.DeserializeObject<ResponeAgingInputDto>(result.Data.ToString()); @@ -452,13 +463,17 @@ } } + var area = await _areaInfoRepository.QueryFirstAsync(x => x.Spare1.Contains(input.Position)); + if (area == null) + return content.Error("鏀圭偣浣嶄笉鍦ㄥ尯鍩熷垪琛ㄤ腑瀛樺湪"); + // 鍒涘缓涓�涓猅rayCellsStatusDto瀵硅薄锛屽苟璧嬪�� TrayCellsStatusDto trayCells = new TrayCellsStatusDto() { - Software = "WMS", + Software = area.Spare3, TrayBarcode = input.PalletCode, //EquipmentCode = "EQ_CWJZ01" - EquipmentCode = "24MEJQ08-1091" + EquipmentCode = area.Spare2 }; // 璋冪敤GetTrayCellStatusAsync鏂规硶锛岃幏鍙栨暣鐩樼數鑺� @@ -487,6 +502,12 @@ // 濡傛灉process涓簄ull锛屽垯杩斿洖content if (process == null) return content; + + // 骞惰祴鍊间笂浣嶈蒋浠跺悕绉板拰璁惧缂栫爜 + process.Software = area.Spare3; + process.EquipmentCode = area.Spare2; + + // 璋冪敤GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹虹敵璇� // 璋冪敤_processApplyService.GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹虹敵璇� content = await _processApplyService.GetProcessApplyAsync(process); @@ -615,8 +636,6 @@ // 鍒涘缓涓�涓狿rocessApplyDto瀵硅薄锛屽苟璧嬪�� return new ProcessApplyDto() { - EquipmentCode = "24MEJQ08-1091", - Software = "WMS", //WipOrderNo = result.BindCode, SerialNos = content.SerialNos.Select(item => new SerialNos { -- Gitblit v1.9.3