| | |
| | | if (dt_Location.Depth == 1 && dt_Task.TaskType == (int)TaskTypeEnum.Inbound) |
| | | { |
| | | if (shallowLocation.LocationStatus == (int)LocationStatusEnum.InStock) return content.OK(); |
| | | return content.Error(); |
| | | return content.Error($"å
¥åºè³æ·±åºä½ï¼ä½æ¯æµ
è´§ä½æè´§ï¼ä»»å¡å·ï¼{dt_Task.TaskId},æçæ¡ç "); |
| | | } |
| | | 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 |
| | | |
| | | WriteLog.Write_Log("WMS_夿巷éå
ç§»åº", $"å¤æç§»åº", "失败", $"åå ï¼{result.Message}"); |
| | | return content.Error(); |
| | | return content.Error($"ä¸åwcs失败ï¼åå ï¼{result.Message}"); |
| | | } |
| | | } |
| | | |
| | | var CuttTransferTask = _taskService.RelocationTaskProgress(dt_Task.Roadway); |
| | | //夿å½åæ¯å¦æç§»åºä»»å¡ |
| | | if (CuttTransferTask != null) return content.Error(); |
| | | 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); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteLog.Write_Log("WMS_夿巷éå
ç§»åº", $"å¤æç§»åº", "失败,æ¹æ³å
æ
é", $"åå ï¼{ex.Message}"); |
| | | return content.Error(); |
| | | return content.Error($"夿巷éå
ç§»åº,失败,æ¹æ³å
æ
é,åå ï¼{ex.Message}"); |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | //çæç§»åºä»»å¡ |
| | | 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(); |
| | | |
| | | int TaskId = _taskService.Repository.AddData(task); |
| | | _locationInfoService.UpdateData(dt_Locations); |
| | | _stockInfoService.UpdateData(dt_StockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return webResponse.Error("å·²çæç§»åºä»»å¡"); |
| | | } |
| | | else |
| | | { |
| | | |
| | | 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è¿å为空"); |
| | | } |
| | | |
| | | //è¿è¡ä¸åç»å åæºä»»å¡ |
| | | /*WCSginseng result = _taskService.SC_IssueTasks( |
| | | TaskId, |
| | | int.Parse(task.Roadway), |
| | | task.TaskNum, |
| | | task.PalletCode, |
| | | int.Parse(task.PalletType), |
| | | task.CurrentAddress, |
| | | task.NextAddress, |
| | | task.TargetAddress); |
| | | if (result.IsSuccess) |
| | | { |
| | | Dt_Task dt_Task=_taskService.Repository.QueryFirst(x=>x.TaskId== task.TaskId); |
| | | dt_Task.TaskStatus = (int)RelocationTaskStatusEnum.RelocationExecuting; |
| | | _taskService.UpdateData(dt_Task); |
| | | return webResponse.OK(); |
| | | } |
| | | else |
| | | { |
| | | return webResponse.Error($"ä¸åç§»åºå¤±è´¥,åå ï¼{result.Message}"); |
| | | }*/ |
| | | |
| | | /* MES_parameter mES_Parame = _taskService.ApplicationChangeStorageLocation(dt_StockInfo.PalletCode, OriginalLocation.LocationCode, newLocation.LocationCode); |
| | | if (mES_Parame != null) |
| | | { |
| | | if (mES_Parame.Result == "Y") |
| | |
| | | } |
| | | else |
| | | { |
| | | WriteLog.Write_Log("WMS_夿巷éå
ç§»åº", $"ç§»åºä»»å¡çææ¹æ³", "ä¸åç§»åºå¤±è´¥", $"åå ï¼{result.Message}"); |
| | | |
| | | return webResponse.Error(); |
| | | return webResponse.Error($"ä¸åç§»åºå¤±è´¥,åå ï¼{result.Message}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteLog.Write_Log("WMS_夿巷éå
ç§»åº", $"ç§»åºä»»å¡çææ¹æ³", "ç³è¯·MESç§»åº", $"ç³è¯·å¨ä½å¼å¨ï¼MESä¸å
许移å¨"); |
| | | return webResponse.Error(); |
| | | return webResponse.Error($"ç³è¯·å¨ä½å¼å¨ï¼MESä¸å
许移å¨====>>>>è¿åå
容ï¼{mES_Parame.ToJson()}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteLog.Write_Log("WMS_夿巷éå
ç§»åº", $"ç§»åºä»»å¡çææ¹æ³", "ç³è¯·MESç§»åº,è¿å空", $"ç³è¯·å¨ä½å¼å¨ï¼MESè¿å为空"); |
| | | return webResponse.Error(); |
| | | } |
| | | return webResponse.Error("ç³è¯·å¨ä½å¼å¨ï¼MESè¿å为空"); |
| | | }*/ |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | WriteLog.Write_Log("WMS_夿巷éå
ç§»åº", $"ç§»åºä»»å¡çææ¹æ³", "ç³»ç»æ
é", $"åå ï¼{ex.Message}"); |
| | | return webResponse.Error(); |
| | | return webResponse.Error($"ç§»åºä»»å¡çææ¹æ³ï¼ç³»ç»æ
é,åå ï¼{ex.Message}"); |
| | | } |
| | | } |
| | | |