| | |
| | | } |
| | | if (shallowLocation.LocationStatus == (int)LocationStatusEnum.Free) return content.OK(); |
| | | |
| | | //夿æ¯å¦æç§»åºä»»å¡ |
| | | |
| | | //夿å½åæµ
è´§ä½æ¯å¦æåºåºä»»å¡ |
| | | var OutTask = _taskService.GeOutCuTaskQueue(shallowLocation.LocationCode); |
| | | if (OutTask != null) |
| | | { |
| | | //è¿è¡ä¸åç»å åæºä»»å¡ |
| | | WCSginseng outresult = _taskService.SC_IssueTasks(OutTask.TaskId, int.Parse(OutTask.Roadway), OutTask.TaskNum, OutTask.PalletCode, int.Parse(OutTask.PalletType), OutTask.CurrentAddress, OutTask.NextAddress, OutTask.TargetAddress); |
| | | if (outresult.IsSuccess) |
| | | { |
| | | |
| | | OutTask.TaskStatus = (int)OutTaskStatusEnum.SC_OutExecuting; |
| | | OutTask.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateData(OutTask); |
| | | return content.OK(); |
| | | } |
| | | else |
| | | { |
| | | UpdateTaskStatus(dt_Task, outresult,0, 1); |
| | | |
| | | return content.Error($"ä¸åwcs失败ï¼åå ï¼{outresult.Message}"); |
| | | } |
| | | } |
| | | |
| | | |
| | | //夿æ¯å¦æç§»åºä»»å¡ |
| | | var TransferTask = _taskService.GeRelocationTaskQueue(shallowLocation.LocationCode); |
| | | if (TransferTask != null) |
| | | { |
| | |
| | | if (result.IsSuccess) |
| | | { |
| | | TransferTask.TaskStatus = (int)RelocationTaskStatusEnum.RelocationExecuting; |
| | | TransferTask.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateData(TransferTask); |
| | | return content.OK(); |
| | | } |
| | | else |
| | | { |
| | | UpdateTaskStatus(dt_Task, result, |
| | | successStatus: dt_Task.TaskStatus == (int)InTaskStatusEnum.PLC_InFinish ? (int)InTaskStatusEnum.SC_IntExecuting : (int)OutTaskStatusEnum.SC_OutExecuting, 1); |
| | | UpdateTaskStatus(dt_Task, result,0,1); //é»è®¤ä¸éè¦æ´æ¹ç¶æä¼ 0 |
| | | |
| | | return content.Error($"ä¸åwcs失败ï¼åå ï¼{result.Message}"); |
| | | } |
| | |
| | | if (CuttTransferTask) return content.Error("å½åæç§»åºä»»å¡ï¼ä¸å¯ä¸å"); |
| | | |
| | | |
| | | if (shallowLocation.LocationStatus != (int)LocationStatusEnum.InStock) return content.Error(); |
| | | if (shallowLocation.LocationStatus != (int)LocationStatusEnum.InStock) return content.Error($"åºä½ç¶æå¼å¸¸ï¼å½åç¶æï¼{(LocationStatusEnum)shallowLocation.LocationStatus}ï¼åºä¸ºï¼{LocationStatusEnum.InStock}"); |
| | | |
| | | //çæç§»åºä»»å¡ |
| | | return content = GenerateTransferTask(shallowLocation.LocationCode); |
| | |
| | | } |
| | | |
| | | |
| | | //çæç§»åºä»»å¡ |
| | | public WebResponseContent GenerateTransferTask(string shallowLocation) |
| | | { |
| | | WebResponseContent webResponse = new WebResponseContent(); |
| | |
| | | Dt_StockInfo dt_StockInfo = _stockInfoService.Repository.QueryData(x => x.LocationCode == shallowLocation).FirstOrDefault(); |
| | | Dt_LocationInfo newLocation = _locationInfoService.GetLocation(OriginalLocation.RoadwayNo, OriginalLocation.LocationType); |
| | | List<Dt_LocationInfo> dt_Locations = new List<Dt_LocationInfo>(); |
| | | |
| | | var TransferTask = _taskService.GeRelocationTaskQueue(shallowLocation); |
| | | MES_parameter mES_Parame = _taskService.ApplicationChangeStorageLocation(dt_StockInfo.PalletCode, OriginalLocation.LocationCode, newLocation.LocationCode); |
| | | if (mES_Parame != null) |
| | | { |
| | | if (mES_Parame.Result == "Y") |
| | | { |
| | | //è¿è¡çæä»»å¡ï¼ä¸åä»»å¡è³MES |
| | | Dt_Task task = new Dt_Task(); |
| | | task.TaskNum = $"REL{DateTime.Now:yyyyMMddHHmmss}{new Random().Next(1000, 9999)}"; |
| | | //task.TaskNum = "0"; |
| | | task.PalletCode = dt_StockInfo.PalletCode; |
| | | task.PalletType = dt_StockInfo.PalletType; |
| | | task.Roadway = OriginalLocation.RoadwayNo; |
| | | task.TaskType = (int)TaskTypeEnum.Relocation; |
| | | task.TaskStatus = (int)RelocationTaskStatusEnum.RelocationNew; |
| | | task.SourceAddress = OriginalLocation.LocationCode; |
| | | task.TargetAddress = newLocation.LocationCode; |
| | | task.CurrentAddress = OriginalLocation.LocationCode; |
| | | task.NextAddress = newLocation.LocationCode; |
| | | task.WarehouseId = OriginalLocation.WarehouseId; |
| | | task.OrderNo = ""; |
| | | task.Grade = 1; |
| | | task.Creater = "MES"; |
| | | task.CreateDate = DateTime.Now; |
| | | |
| | | OriginalLocation.LocationStatus = (int)LocationStatusEnum.Lock; |
| | | newLocation.LocationStatus = (int)LocationStatusEnum.Lock; |
| | | dt_StockInfo.StockStatus = (int)StockStatusEmun.ç§»åºéå®; |
| | | |
| | | dt_Locations.Add(OriginalLocation); |
| | | dt_Locations.Add(newLocation); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | //è¿è¡çæä»»å¡ï¼ä¸åä»»å¡è³MES |
| | | Dt_Task task = new Dt_Task(); |
| | | task.TaskNum = "0"; |
| | | task.PalletCode = dt_StockInfo.PalletCode; |
| | | task.PalletType = dt_StockInfo.PalletType; |
| | | task.Roadway = OriginalLocation.RoadwayNo; |
| | | task.TaskType = (int)TaskTypeEnum.Relocation; |
| | | task.TaskStatus = (int)RelocationTaskStatusEnum.RelocationNew; |
| | | task.SourceAddress = OriginalLocation.LocationCode; |
| | | task.TargetAddress = newLocation.LocationCode; |
| | | task.CurrentAddress = OriginalLocation.LocationCode; |
| | | task.NextAddress = newLocation.LocationCode; |
| | | task.WarehouseId = OriginalLocation.WarehouseId; |
| | | task.OrderNo = ""; |
| | | task.Grade = 1; |
| | | task.Creater = "MES"; |
| | | task.CreateDate = DateTime.Now; |
| | | int TaskId = _taskService.Repository.AddData(task); |
| | | _locationInfoService.UpdateData(dt_Locations); |
| | | _stockInfoService.UpdateData(dt_StockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return webResponse.Error("å·²çæç§»åºä»»å¡"); |
| | | } |
| | | else |
| | | { |
| | | |
| | | OriginalLocation.LocationStatus = (int)LocationStatusEnum.Lock; |
| | | newLocation.LocationStatus = (int)LocationStatusEnum.Lock; |
| | | dt_StockInfo.StockStatus = (int)StockStatusEmun.ç§»åºéå®; |
| | | WriteLog.Write_Log("WMS_ç§»åºæ
é", $"EMSç³è¯·å¨ä½å¼å¨è¿å失败å
容", "失败", $"MESä¸å
许移å¨====>>>>è¿åå
容ï¼{mES_Parame.ToJson()}"); |
| | | return webResponse.Error($"ç³è¯·å¨ä½å¼å¨ï¼MESä¸å
许移å¨====>>>>è¿åå
容ï¼{mES_Parame.ToJson()}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteLog.Write_Log("WMS_ç§»åºæ
é", $"EMSç³è¯·å¨ä½å¼å¨è¿å失败å
容", "失败", $"ç³è¯·å¨ä½å¼å¨ï¼MESè¿å为空"); |
| | | return webResponse.Error("ç³è¯·å¨ä½å¼å¨ï¼MESè¿å为空"); |
| | | } |
| | | |
| | | dt_Locations.Add(OriginalLocation); |
| | | dt_Locations.Add(newLocation); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | int TaskId = _taskService.Repository.AddData(task); |
| | | _locationInfoService.UpdateData(dt_Locations); |
| | | _stockInfoService.UpdateData(dt_StockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return webResponse.Error("å·²çæç§»åºä»»å¡"); |
| | | //è¿è¡ä¸åç»å åæºä»»å¡ |
| | | /*WCSginseng result = _taskService.SC_IssueTasks( |
| | | TaskId, |
| | |
| | | return webResponse.Error($"ä¸åç§»åºå¤±è´¥,åå ï¼{result.Message}"); |
| | | }*/ |
| | | |
| | | /*MES_parameter mES_Parame = _taskService.ApplicationChangeStorageLocation(dt_StockInfo.PalletCode, OriginalLocation.LocationCode, newLocation.LocationCode); |
| | | /* MES_parameter mES_Parame = _taskService.ApplicationChangeStorageLocation(dt_StockInfo.PalletCode, OriginalLocation.LocationCode, newLocation.LocationCode); |
| | | if (mES_Parame != null) |
| | | { |
| | | if (mES_Parame.Result == "Y") |