| | |
| | | using AutoMapper; |
| | | using Microsoft.Extensions.Logging; |
| | | using Org.BouncyCastle.Math.EC; |
| | | using SixLabors.ImageSharp; |
| | | using SqlSugar; |
| | | using System.ComponentModel; |
| | | using System.Net; |
| | |
| | | switch (wcsTaskType) |
| | | { |
| | | case 1: |
| | | |
| | | if(task.TargetAddress == "") |
| | | |
| | | if (string.IsNullOrEmpty(task.TargetAddress)) |
| | | { |
| | | int loctype = 0; |
| | | if (task.Roadway == "1" || task.Roadway == "2") |
| | |
| | | if (ShallowCargoHold == null) return content.Error($"æªæ¾å°è¯¥è´§ä½ä¿¡æ¯,è´§ä½ç¼å·:{dt_Location.LocationCode}çæµ
è´§ä½"); |
| | | if (ShallowCargoHold.LocationStatus != (int)LocationStatusEnum.Free) return content.Error($"ä»»å¡å·ï¼{task.TaskId},æçç¼å·ï¼{task.PalletCode},æ¥æ¾çè´§ä½æµ
è´§ä½æè´§ï¼è´§ä½ç¼å·ï¼{ShallowCargoHold.LocationCode}"); |
| | | |
| | | if (task.PalletCode[0] == 1 && (dt_Location.RoadwayNo == "1" || dt_Location.RoadwayNo == "2") && dt_Location.Column < 4) |
| | | { |
| | | return content.Error($"æ¡ç ä¸ºé«æçï¼ä½æ¯æ¥æ¾çè´§ä½è¦å
¥å¨ä½æçä¸ï¼æ
é,æçæ¡ç ï¼{task.PalletCode},è´§ä½ç¼å·:{dt_Location.LocationCode}"); |
| | | } |
| | | |
| | | |
| | | Dt_roadwayinfo _Roadwayinfo = _roadWayinfoService.QbtainPlatform(task.Roadway); |
| | | |
| | | task.TargetAddress = dt_Location.LocationCode; |
| | | task.CurrentAddress = task.NextAddress; |
| | | task.CurrentAddress = _Roadwayinfo.InSCStationCode; |
| | | task.NextAddress = dt_Location.LocationCode; |
| | | task.TaskStatus = (int)InTaskStatusEnum.PLC_InFinish; |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | //夿æ¯å¦æè¯¥ç«å° |
| | | |
| | | string Resultplc = MesInTaskStatusEnum.å
¥åºå®æ.GetDescription(); |
| | | MES_parameter mES_PCLParameter = InStoreDocCallback(task.TaskNum, Resultplc, "æä½æå", task.PalletCode, task.TargetAddress); |
| | | if (mES_PCLParameter.Result == "Y") |
| | |
| | | string Resultsc = MesInTaskStatusEnum.å
¥åºå®æ.GetDescription(); |
| | | //䏿¥MESä»»å¡å®æ |
| | | MES_parameter mES_Parameter = InStoreDocCallback(task.TaskNum, Resultsc, "æä½æå", task.PalletCode, task.TargetAddress); |
| | | if (mES_Parameter.Result == "Y") |
| | | if (mES_Parameter.Result != "Y") |
| | | { |
| | | Dt_StockInfo dt_Stockowc = _stockInfoService.Repository.QueryData(x => x.PalletCode == task.PalletCode).FirstOrDefault(); |
| | | Dt_LocationInfo dt_LocationInfo=_locationInfoService.Repository.QueryData(x => x.LocationCode == dt_Stockowc.LocationCode).FirstOrDefault(); |
| | |
| | | string Resultplc = MesOutTaskStatusEnum.å°è¾¾ç®çå°.GetDescription(); |
| | | //䏿¥MESä»»å¡å®æ |
| | | MES_parameter mES_Parameter = OutStoreDocCallback(task.TaskNum, Resultplc, "æä½æå"); |
| | | if (mES_Parameter.Result == "Y") |
| | | if (mES_Parameter.Result != "Y") |
| | | { |
| | | task.TaskStatus = (int)OutTaskStatusEnum.PLC_OutFinish; |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | |
| | | |
| | | Dt_StockInfo dt_Stockowc = _stockInfoService.Repository.QueryData(x => x.PalletCode == task.PalletCode).FirstOrDefault(); |
| | | Dt_LocationInfo dt_LocationInfo = _locationInfoService.Repository.QueryData(x => x.LocationCode == dt_Stockowc.LocationCode).FirstOrDefault(); |
| | | dt_LocationInfo.LocationStatus = (int)LocationStatusEnum.Free; |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockInfoService.DeleteData(dt_Stockowc); |
| | | _locationInfoService.DeleteData(dt_LocationInfo); |
| | | BaseDal.UpdateData(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | |
| | | return content.OK($"å·²æ¥æ¶åºåºå åæºå®æä¿¡æ¯ï¼ä»»å¡å·ï¼{task.TaskId},æçç¼å·ï¼{task.PalletCode}"); |
| | | string Result = MesOutTaskStatusEnum.åºåºå®æ.GetDescription(); |
| | | //è°å䏿¸¸ç³»ç»åé¦å¼å§ä»»å¡ |
| | | MES_parameter mES_SCParameter = OutStoreDocCallback(task.TaskNum, Result, "æä½æå"); |
| | | if (mES_SCParameter.Result != "Y") |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockInfoService.DeleteData(dt_Stockowc); |
| | | _locationInfoService.UpdateData(dt_LocationInfo); |
| | | BaseDal.UpdateData(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content.OK($"å·²æ¥æ¶åºåºå åæºå®æä¿¡æ¯ï¼ä»»å¡å·ï¼{task.TaskId},æçç¼å·ï¼{task.PalletCode}"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ä¸ä¼ MES失败ï¼åå ï¼" + mES_SCParameter.ResultMsg); |
| | | } |
| | | default: |
| | | return content.Error($"WCS䏿¥ç±»åé误ï¼{wcsTaskType}"); |
| | | } |
| | |
| | | private WebResponseContent HandleRelocationTask(Dt_Task task, int wcsTaskType) |
| | | { |
| | | WebResponseContent responseContent = new WebResponseContent(); |
| | | if (wcsTaskType == 2) |
| | | try |
| | | { |
| | | //䏿¥MESå åæºç§»åºä»»å¡ |
| | | string Resultplc = MesOutTaskStatusEnum.å°è¾¾ç®çå°.GetDescription(); |
| | | //䏿¥MESä»»å¡å®æ |
| | | MES_parameter mES_Parameter = AbnormalStorageLocation(task.PalletCode, task.SourceAddress, task.TargetAddress); |
| | | if (mES_Parameter.Result == "Y") |
| | | if (wcsTaskType == 2) |
| | | { |
| | | task.TaskStatus = (int)RelocationTaskStatusEnum.RelocationFinish; |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | return WebResponseContent.Instance.OK($"å·²æ¥æ¶ç§»åºå åæºå®æä¿¡æ¯ï¼ä»»å¡å·ï¼{task.TaskId},æçç¼å·ï¼{task.PalletCode}"); |
| | | //䏿¥MESä»»å¡å®æ |
| | | MES_parameter mES_Parameter = AbnormalStorageLocation(task.PalletCode, task.SourceAddress, task.TargetAddress); |
| | | if (mES_Parameter.Result == "Y") |
| | | { |
| | | Dt_LocationInfo OriginalLocation = _locationInfoService.Repository.QueryData(x => x.LocationCode == task.SourceAddress).FirstOrDefault(); |
| | | Dt_LocationInfo NewLocation = _locationInfoService.Repository.QueryData(x => x.LocationCode == task.TargetAddress).FirstOrDefault(); |
| | | Dt_StockInfo dt_StockInfo = _stockInfoService.Repository.QueryData(x => x.LocationCode == task.TargetAddress).FirstOrDefault(); |
| | | |
| | | List<Dt_LocationInfo> dt_Locations = new List<Dt_LocationInfo>(); |
| | | |
| | | OriginalLocation.LocationStatus = (int)LocationStatusEnum.Free; |
| | | NewLocation.LocationStatus = (int)LocationStatusEnum.InStock; |
| | | dt_StockInfo.LocationCode = NewLocation.LocationCode; |
| | | dt_StockInfo.StockStatus = (int)StockStatusEmun.å·²å
¥åº; |
| | | task.TaskStatus = (int)RelocationTaskStatusEnum.RelocationFinish; |
| | | |
| | | dt_Locations.Add(OriginalLocation); |
| | | dt_Locations.Add(NewLocation); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | _locationInfoService.UpdateData(dt_Locations); |
| | | _stockInfoService.UpdateData(dt_StockInfo); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | return WebResponseContent.Instance.OK($"å·²æ¥æ¶ç§»åºå åæºå®æä¿¡æ¯ï¼ä»»å¡å·ï¼{task.TaskId},æçç¼å·ï¼{task.PalletCode}"); |
| | | } |
| | | else |
| | | { |
| | | return responseContent.Error("ä¸ä¼ MES失败ï¼åå ï¼" + mES_Parameter.ResultMsg); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return responseContent.Error("ä¸ä¼ MES失败ï¼åå ï¼" + mES_Parameter.ResultMsg); |
| | | return WebResponseContent.Instance.Error($"WCS䏿¥ç±»åé误ï¼{wcsTaskType}"); |
| | | } |
| | | } |
| | | return WebResponseContent.Instance.Error($"WCS䏿¥ç±»åé误ï¼{wcsTaskType}"); |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error($"WMSç³»ç»é误ï¼åå ï¼{ex.Message}"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |