| | |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.ERP; |
| | | using WIDESEA_DTO.MES; |
| | | using WIDESEA_ITaskInfoRepository; |
| | | using WIDESEA_ITaskInfoService; |
| | | using WIDESEA_Model.Models; |
| | |
| | | using WIDESEA_DTO.Stock; |
| | | using SqlSugar; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using WIDESEA_DTO.MES; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | | public partial class TaskService |
| | | { |
| | | static object lock_out = new object(); |
| | | /// <summary> |
| | | /// MESèªå¨å«ææ¥å£ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent ReceiveAutoIssue(MESAutoIssueDTO autoIssueDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·å对åºåæ® |
| | | Dt_OutMESOrder? outMESOrder = _outMESOrderRepository.QueryFirst(x=>x.OutDetailId==autoIssueDTO.OutDetailId); |
| | | if (outMESOrder==null) |
| | | { |
| | | return content.Error($"é¢æè®¡å{nameof(MESAutoIssueDTO.OutDetailId)}{autoIssueDTO.OutDetailId}ä¸åå¨"); |
| | | } |
| | | //è·åå¨è½¬ä½ç½®ç¼å· |
| | | Dt_AGVStationInfo? stationInfo = _agvStationInfoRepository.QueryFirst(x=>x.MESPointCode==autoIssueDTO.PointCode); |
| | | if (stationInfo == null) |
| | | { |
| | | return content.Error($"é¢æè®¡åå¨è½¬ä½{nameof(MESAutoIssueDTO.PointCode)}{autoIssueDTO.PointCode}ä¸åå¨"); |
| | | } |
| | | if (autoIssueDTO.IsEmptyPallet>0) |
| | | { |
| | | return content.Error($"é¢æè®¡åå¨è½¬ä½{nameof(MESAutoIssueDTO.PointCode)}{autoIssueDTO.PointCode}åå¨ç©ºæ"); |
| | | } |
| | | Dt_Task? task = BaseDal.QueryData(x => x.OrderNo == outMESOrder.OutMESOrderNo && x.TaskStatus==TaskStatusEnum.CallPending.ObjToInt()).OrderByDescending(x=>x.Grade).ThenBy(x=>x.TaskNum).FirstOrDefault(); |
| | | //è·åä»»å¡ |
| | | if (task==null) |
| | | { |
| | | return content.Error($"æªæ¾å°é¢æè®¡åç¼å·{outMESOrder.ProductOrderNo}å¯é
éä»»å¡"); |
| | | } |
| | | task.TaskStatus = TaskStatusEnum.New.ObjToInt(); |
| | | task.TargetAddress= stationInfo.AGVStationCode; |
| | | PushTasksToWCS(new List<Dt_Task> { task }); |
| | | return content.OK("嫿æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |