| | |
| | | using SqlSugar.Extensions; |
| | |  |
| | | using Newtonsoft.Json.Serialization; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.ERP; |
| | | using WIDESEA_DTO.MES; |
| | |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode==WarehouseEnum.HA64.ToString()); |
| | | //è·ååºåè®°å½ |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId && |
| | | x.StockStatus==(int)StockStatusEmun.å
¥åºå®æ) |
| | | .Includes(x => x.Details).Where(x => x.Details.Any(x => x.BatchNo == model.ToolCode)).First(); |
| | | if (stockInfo==null) |
| | | x.StockStatus==(int)StockStatusEmun.å
¥åºå®æ).Includes(x=>x.Details).ToList(); |
| | | Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x=>x.Details.Any(x=>x.BatchNo==model.ToolCode)); |
| | | if (stockInfo == null) |
| | | { |
| | | return responseContent.Error($"æµè¯æ¶:{model.ToolCode}æ å¯ç¨åºå"); |
| | | } |
| | |
| | | NextAddress = "", |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = "", |
| | | TargetAddress = model.TargetAddressCode, |
| | | TaskStatus = (int)TaskStatusEnum.New, |
| | | TaskType = (int)TaskTypeEnum.Outbound, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | |
| | | //_recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.StockLock); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskOut },"AGV"); |
| | | PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV"); |
| | | responseContent.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | //è·åæµè¯æ¶ååºåä¿¡æ¯ |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA64.ToString()); |
| | | //è·ååºåè®°å½ |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId && |
| | | x.StockStatus == (int)StockStatusEmun.åºåºå®æ) |
| | | .Includes(x => x.Details).Where(x => x.Details.Any(x => x.BatchNo == backModel.TestToolCode)).First(); |
| | | x.StockStatus == (int)StockStatusEmun.åºåºå®æ).Includes(x => x.Details).ToList(); |
| | | Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == backModel.TestToolCode)); |
| | | if (stockInfo==null) |
| | | { |
| | | return responseContent.Error($"{backModel.TestToolCode}åºåä¿¡æ¯ä¸åå¨"); |
| | |
| | | }; |
| | | //æ´æ¹åºåç¶æ |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV"); |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | responseContent.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | //è·åæµè¯æ¶æ¹æ¬¡å·åºå |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA64.ToString()); |
| | | //è·ååºåè®°å½ |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId && x.StockStatus==StockStatusEmun.åºåºå®æ.ObjToInt()) |
| | | .Includes(x => x.Details).Where(x => x.Details.Any(x => x.BatchNo == toolScrap.ToolCode)).First(); |
| | | //è·ååºåè®°å½ |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId && |
| | | x.StockStatus == (int)StockStatusEmun.åºåºå®æ).Includes(x => x.Details).ToList(); |
| | | Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == toolScrap.ToolCode)); |
| | | |
| | | if (stockInfo == null) |
| | | { |
| | | return responseContent.Error($"{toolScrap.ToolCode}åºåä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | //æ¸
é¤åºåä¿¡æ¯ |
| | | _unitOfWorkManage.BeginTran(); |
| | | _stockRepository.StockInfoRepository.DeleteData(stockInfo); |
| | | _stockRepository.StockInfoDetailRepository.DeleteData(stockInfo.Details); |
| | | _stockRepository.StockInfoRepository.DeleteAndMoveIntoHty(stockInfo,OperateTypeEnum.èªå¨å é¤); |
| | | _stockRepository.StockInfoDetailRepository.DeleteAndMoveIntoHty(stockInfo.Details, OperateTypeEnum.èªå¨å é¤); |
| | | _unitOfWorkManage.CommitTran(); |
| | |
| | | try |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x=>x.ApiCode==APIEnum.WMS_MES_TestToolSync.ToString()); |
| | | Root<TestToolSynInfo> root = new Root<TestToolSynInfo>() |
| | | MESRoot<TestToolSynInfo> root = new MESRoot<TestToolSynInfo>() |
| | | { |
| | | From = "WMS", |
| | | DateTime = DateTime.Now.ToString(), |
| | | DateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Content=toolSynInfo |
| | | }; |
| | | JsonSerializerSettings settings = new JsonSerializerSettings |
| | | { |
| | | ContractResolver = new CamelCasePropertyNamesContractResolver() |
| | | }; |
| | | string request = JsonConvert.SerializeObject(root, settings); |
| | | string response = HttpMesHelper.Post(apiInfo.ApiAddress, request); |
| | | MesResponseContent mesResponseContent = response.DeserializeObject<MesResponseContent>(); |
| | | //è°ç¨æ¥å£ |
| | | if (mesResponseContent.BSucc==true) |
| | | { |
| | | content.OK(mesResponseContent.StrMsg); |
| | | } |
| | | else |
| | | { |
| | | content.Error(mesResponseContent.StrMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |