| | |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using System; |
| | | using System.Collections; |
| | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA154.ToString()); |
| | | //è·ååºåè®°å½ |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId).Includes(x => x.Details).ToList(); |
| | | x.WarehouseId == warehouse.WarehouseId && x.PalletCode== palletCode).Includes(x => x.Details).ToList(); |
| | | if (stockInfos.Count > 0) |
| | | { |
| | | return content.Error($"è½½å
·æçå·²åå¨"); |
| | | } |
| | | Dt_StockInfo? stockInfoOld = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == materialLot)); |
| | | if (stockInfoOld != null) |
| | | { |
| | | return content.Error($"åºåä¿¡æ¯å·²åå¨"); |
| | | } |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x=>x.CodeStartStr== palletType); |
| | | if (palletTypeInfo != null) |
| | | if (palletTypeInfo == null) |
| | | { |
| | | return content.Error($"æçç±»åä¿¡æ¯ä¸åå¨"); |
| | | } |
| | |
| | | WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot); |
| | | if (!requestLotInfo.Status) |
| | | { |
| | | return content.Error($"{requestLotInfo.Message}"); |
| | | return content.Error($"请æ±é»çæ¹æ¬¡ä¿¡æ¯å¤±è´¥,{requestLotInfo.Message}"); |
| | | } |
| | | MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString()); |
| | | Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() |
| | |
| | | Grade = 0, |
| | | PalletCode = palletCode, |
| | | NextAddress = "", |
| | | Roadway = "", |
| | | Roadway = "SC01_ZH", |
| | | SourceAddress = "AGV_ZH", |
| | | TargetAddress = "", |
| | | TaskStatus = (int)TaskStatusEnum.New, |
| | | TaskType = (int)TaskTypeEnum.InZHProduct, |
| | | TaskType = (int)TaskTypeEnum.InZHProductSmall, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = palletTypeInfo.PalletType, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | WarehouseId = warehouse.WarehouseId |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); |
| | |
| | | _unitOfWorkManage.CommitTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_ZH"); ; |
| | | content.OK(); |
| | | content.OK(data: taskIn); |
| | | } |
| | | catch (Exception ex) |
| | | { |