| | |
| | | _roadwayInforepository = roadwayInforepository; |
| | | _dt_ApiInfoService = dt_ApiInfoService; |
| | | _locationStatusChangeRecordService = locationStatusChangeRecordService; |
| | | _stationMangerService=stationMangerService; |
| | | _stationMangerService = stationMangerService; |
| | | } |
| | | public int GetTaskNum(string sequenceName) |
| | | { |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | //è·åå°æ·±åºä½ç¼å· |
| | | Dt_LocationInfo DeepLocation = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == Locatask); |
| | | if(DeepLocation == null) return content.Error($"æªæ¾å°è¯¥è´§ä½ä¿¡æ¯,è´§ä½ç¼å·:{Locatask}"); |
| | | if (DeepLocation == null) return content.Error($"æªæ¾å°è¯¥è´§ä½ä¿¡æ¯,è´§ä½ç¼å·:{Locatask}"); |
| | | |
| | | //è¿è¡è·åæµ
åºä½ç¼å· |
| | | int locrow = DeepLocation.Row == 1 ? 2 : 3; |
| | | Dt_LocationInfo ShallowLocation = _basicService.LocationInfoService.Repository.QueryFirst(x =>x.Row== locrow && x.Layer== DeepLocation.Layer && x.Column== DeepLocation.Column && x.RoadwayNo== DeepLocation.RoadwayNo); |
| | | Dt_LocationInfo ShallowLocation = _basicService.LocationInfoService.Repository.QueryFirst(x => x.Row == locrow && x.Layer == DeepLocation.Layer && x.Column == DeepLocation.Column && x.RoadwayNo == DeepLocation.RoadwayNo); |
| | | if (ShallowLocation == null) return content.Error($"æªæ¾å°è´§ä½ç¼å·:{Locatask}çæµ
è´§ä½"); |
| | | |
| | | if (ShallowLocation.LocationStatus == (int)LocationStatusEnum.Free) |
| | |
| | | if (dt_Stock == null) return content.Error($"è´§ä½ç¼å·:{Locatask}çæµ
è´§ä½åºåå¼å¸¸ï¼è¯·æ£æ¥ï¼ï¼ï¼"); |
| | | |
| | | //è¿è¡è·åæ°çåºä½ |
| | | Dt_LocationInfo? Nextlocation = _basicService.LocationInfoService.GetLocation(DeepLocation.RoadwayNo);//è·åå°æ°åºä½ |
| | | //Dt_LocationInfo? Nextlocation = _basicService.LocationInfoService.GetLocation(DeepLocation.RoadwayNo);//è·åå°æ°åºä½ |
| | | Dt_LocationInfo? Nextlocation = _basicService.LocationInfoService.GetLocationSC01(DeepLocation.RoadwayNo);//è·åå°æ°åºä½ |
| | | if (Nextlocation == null) |
| | | { |
| | | return content.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | |
| | | return webResponse.Error($"ç§»åºä»»å¡å®æå¤±è´¥ï¼ä»»å¡idï¼{task.TaskNum}"); |
| | | throw; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | |
| | | stockInfo.StockStatus = StockStatusEmun.åºåºå®æ.ObjToInt(); |
| | | |
| | | |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus =(int)LocationStatusEnum.Free; |
| | | locationInfo.LocationStatus = (int)LocationStatusEnum.Free; |
| | | task.TaskStatus = TaskOutStatusEnum.OutFinish.ObjToInt(); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | _stockRepository.DeleteData(stockInfo); |
| | | _locationInfoRepository.UpdateData(locationInfo); //ä¿®æ¹æç©ºè´§ä½ |
| | | |
| | | //å é¤åºåºå®æä»»å¡ |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.èªå¨å®æ : OperateTypeEnum.äººå·¥å®æ); |
| | | _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockStatusEmun.åºåºå®æ.ObjToInt(), "1", task.TaskNum); |
| | | WebResponseContent content = TaskCompletionFeedback(task); |
| | |
| | | return webResponse.Error($"åºåºä»»å¡å®æå¤±è´¥ï¼ä»»å¡idï¼{task.TaskNum},é误åå ï¼{ex.Message}"); |
| | | throw; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | string WCSReceiveTaskAPI = ConfigsAPIInfo.ApiAddress + ConfigsAPIInfo.ApiName; |
| | | if (WCSReceiveTaskAPI == null) |
| | | { |
| | | return webResponse.Error($"åºåºå¤±è´¥ï¼æªé
ç½®MESç§»åºå®æå馿¥å£"); |
| | | return webResponse.Error($"åºåºå¤±è´¥ï¼æªé
ç½®MESç§»åºå®æå馿¥å£"); |
| | | } |
| | | var respon = HttpHelper.Post(WCSReceiveTaskAPI, JsonConvert.SerializeObject(transferRequest)); |
| | | if (respon != null) |
| | | { |
| | | var response = JsonConvert.DeserializeObject<ApiResponse<object>>(respon); |
| | | if (response.Success) |
| | | { |
| | | return webResponse.OK(); |
| | | } |
| | | else |
| | | { |
| | | return webResponse.Error($"è°åæ¥å£å¤±è´¥ï¼åé¦åæ°åå ï¼{response.Message}"); |
| | | } |
| | | var response = JsonConvert.DeserializeObject<ApiResponse<object>>(respon); |
| | | if (response.Success) |
| | | { |
| | | return webResponse.OK(); |
| | | } |
| | | else |
| | | { |
| | | return webResponse.Error($"è°åæ¥å£å¤±è´¥ï¼åé¦åæ°åå ï¼{response.Message}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return webResponse.Error($"è°åæ¥å£å¤±è´¥ï¼åé¦åæ°ä¸ºç©º"); |
| | | return webResponse.Error($"è°åæ¥å£å¤±è´¥ï¼åé¦åæ°ä¸ºç©º"); |
| | | } |
| | | |
| | | return webResponse.OK(); |
| | |
| | | locationCode = dt_Task.TargetAddress; |
| | | } |
| | | TaskNotification transferRequest = new TaskNotification() |
| | | { |
| | | //ä¸å¡idï¼ä»»å¡idåç»è¿è¡æ´æ¹ |
| | | taskId = dt_Task.MEStaskId, //ä»»å¡id |
| | | businessId = dt_Task.MESbusinessId, //ä¸å¡id |
| | | palletCode = dt_Task.PalletCode, |
| | | subPalletCode = dt_Task.MESsubPalletCode,//åæçç¼ç |
| | | locationCode = locationCode, |
| | | errorStatus = "NORMAL", |
| | | errorInfo = "", |
| | | }; |
| | | { |
| | | //ä¸å¡idï¼ä»»å¡idåç»è¿è¡æ´æ¹ |
| | | taskId = dt_Task.MEStaskId, //ä»»å¡id |
| | | businessId = dt_Task.MESbusinessId, //ä¸å¡id |
| | | palletCode = dt_Task.PalletCode, |
| | | subPalletCode = dt_Task.MESsubPalletCode,//åæçç¼ç |
| | | locationCode = locationCode, |
| | | errorStatus = "NORMAL", |
| | | errorInfo = "", |
| | | }; |
| | | |
| | | //è·åæ¥å£è¿è¡è°å |
| | | var ConfigsAPIInfo = _dt_ApiInfoService.GetConfigsByAPIInfo(CateGoryConst.CONFIG_MES_IPAddress, SysConfigConst.MESTaskFeedback); //è·åå°wcså
¨é¨ç±»åçæ¥å£ |
| | |
| | | { |
| | | return webResponse.Error($"ä»»å¡åé¦MESå¤±è´¥ï¼æªé
ç½®MESä»»å¡å®æå馿¥å£"); |
| | | } |
| | | |
| | | |
| | | // æ·»å è°è¯ä¿¡æ¯ |
| | | string requestJson = JsonConvert.SerializeObject(transferRequest); |
| | | //Console.WriteLine($"MESå馿¥å£URL: {WCSReceiveTaskAPI}"); |
| | | //Console.WriteLine($"MESåé¦è¯·æ±æ°æ®: {requestJson}"); |
| | | |
| | | |
| | | // 使ç¨ä¿®å¤åçPostSyncæ¹æ³ï¼å·²å¨PostSyncä¸è®¾ç½®é»è®¤è¯·æ±å¤´ï¼ |
| | | var respon = HttpHelper.Post(WCSReceiveTaskAPI, requestJson); |
| | | if (respon != null) |
| | |
| | | } |
| | | } |
| | | |
| | | public ApiResponse<object> MESresponse(string Message, bool Success,int Code) |
| | | public ApiResponse<object> MESresponse(string Message, bool Success, int Code) |
| | | { |
| | | ApiResponse<object> apiResponse = new ApiResponse<object>(); |
| | | apiResponse.Message = Message; |
| | |
| | | try |
| | | { |
| | | // æ¥æ¾ä»»å¡ |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.PalletCode == palletTaskDTO && (x.TaskStatus == TaskOutStatusEnum.OutNew.ObjToInt()|| x.TaskStatus == TaskRelocationStatusEnum.RelocationNew.ObjToInt()|| x.TaskStatus == TaskInStatusEnum.Line_InExecuting.ObjToInt())); |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.PalletCode == palletTaskDTO && (x.TaskStatus == TaskOutStatusEnum.OutNew.ObjToInt() || x.TaskStatus == TaskRelocationStatusEnum.RelocationNew.ObjToInt() || x.TaskStatus == TaskInStatusEnum.Line_InExecuting.ObjToInt())); |
| | | if (task == null) |
| | | { |
| | | return MESresponse($"æªæ¾å°è´§ä½ä¿¡æ¯,æ¡ç ï¼{palletTaskDTO}", false, 0); |
| | |
| | | .SetColumns(x => x.StockStatus == StockStatusEmun.å
¥åºå®æ.ObjToInt()) |
| | | .Where(x => x.PalletCode == task.PalletCode) |
| | | .ExecuteCommand(); |
| | | if (stockmsseg<=0) |
| | | if (stockmsseg <= 0) |
| | | { |
| | | return MESresponse($"æ åºåä¿¡æ¯", false, 0); |
| | | } |
| | |
| | | stockmsseg = _stockRepository.DeleteData(stockInfo).ObjToInt(); |
| | | taskmsseg = BaseDal.DeleteData(task); |
| | | } |
| | | BaseDal.DeleteAndMoveIntoHty(task,OperateTypeEnum.人工å é¤); |
| | | BaseDal.DeleteAndMoveIntoHty(task, OperateTypeEnum.人工å é¤); |
| | | //è·åæ¥å£è¿è¡è°å |
| | | var ConfigsAPIInfo = _dt_ApiInfoService.GetConfigsByAPIInfo(CateGoryConst.CONFIG_WCS_IPAddress, SysConfigConst.WCSCancelinventory); //è·åå°wcså
¨é¨ç±»åçæ¥å£ |
| | | string WCSReceiveTaskAPI = ConfigsAPIInfo.ApiAddress + ConfigsAPIInfo.ApiName; |
| | |
| | | return MESresponse($"WCSè°åæ¥å£å¤±è´¥ï¼åé¦åæ°åå ï¼{response.Message}", false, 0); |
| | | } |
| | | if (stockmsseg <= 0 && locationmsseg <= 0 && taskmsseg) |
| | | { |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return MESresponse($"ä»»å¡åæ¶å¤±è´¥", false, 0); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return MESresponse($"åæ¶ä»»å¡å¤±è´¥ï¼åå ï¼{ex.Message}", false, 0); |
| | | return MESresponse($"åæ¶ä»»å¡å¤±è´¥ï¼åå ï¼{ex.Message}", false, 0); |
| | | } |
| | | } |
| | | |
| | |
| | | int res = _locationInfoRepository.AddData(dt_LocationInfoList); |
| | | if (res <= 0) |
| | | { |
| | | return MESresponse($"å建货ä½å¤±è´¥",false); |
| | | return MESresponse($"å建货ä½å¤±è´¥", false); |
| | | } |
| | | return MESresponse($"", true); |
| | | } |
| | |
| | | .ExecuteCommand() > 0; |
| | | if (!res) |
| | | { |
| | | return MESresponse($"ä¿®æ¹è´§ä½å¤±è´¥",false); |
| | | return MESresponse($"ä¿®æ¹è´§ä½å¤±è´¥", false); |
| | | } |
| | | return MESresponse($"", true); |
| | | } |
| | |
| | | int res = _locationInfoRepository.Db.Deleteable<Dt_LocationInfo>().Where(x => locationCode.Contains(x.LocationCode)).ExecuteCommand(); |
| | | if (res <= 0) |
| | | { |
| | | return MESresponse($"å é¤è´§ä½å¤±è´¥",false); |
| | | return MESresponse($"å é¤è´§ä½å¤±è´¥", false); |
| | | } |
| | | return MESresponse($"", true); |
| | | } |
| | |
| | | |
| | | try |
| | | { |
| | | Dt_StockInfo dt_StockInfo = _stockRepository.QueryFirst(x => x.LocationCode.StartsWith("SC01") && x.StockStatus == 6); |
| | | Dt_StockInfo dt_StockInfo = _stockRepository.QueryFirst(x => x.LocationCode.StartsWith("SC01") && x.StockStatus == 6); |
| | | int result = GetLastPart(dt_StockInfo.LocationCode).ObjToInt(); // è¿å "C03" |
| | | |
| | | List<Dt_Task> dt_s = new List<Dt_Task>(); |
| | |
| | | { |
| | | // æ¥æ¾ä»»å¡ |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.PalletCode == palletTaskDTO); |
| | | |
| | | |
| | | if (task == null) |
| | | { |
| | | return webResponse.Error($"æªæ¾å°æçç¼ç 为ã{palletTaskDTO}ãçä»»å¡ä¿¡æ¯"); |
| | |
| | | // if (locationmsseg1 == null) { webResponse.Error("æªæ¾å°è´§ä½ä¿¡æ¯"); } |
| | | // locationmsseg1.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | // location1 = _locationInfoRepository.UpdateData(locationmsseg1); |
| | | |
| | | |
| | | // } |
| | | //} |
| | | //else |
| | |
| | | } |
| | | } |
| | | //æå¨ä¸åä»»å¡å°WCS |
| | | public WebResponseContent WCSTask(int task) |
| | | public WebResponseContent WCSTask([FromQuery] int task) |
| | | { |
| | | List<Dt_Task> AddtaskList = BaseDal.QueryData(x=>x.TaskNum == task); |
| | | List<Dt_Task> AddtaskList = BaseDal.QueryData(x => x.TaskNum == task); |
| | | |
| | | if (!AddtaskList.Any()) |
| | | { |
| | |
| | | //return WebResponseContent.Instance.OK(); |
| | | } |
| | | |
| | | |
| | | public ApiResponse<object> TaskFeedback(TaskNotification taskFeedback) |
| | | { |
| | | throw new NotImplementedException(); |