| | |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Common.OtherEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Common.WareHouseEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.MES; |
| | | using WIDESEA_DTO.Task; |
| | | using WIDESEA_Model.Models; |
| | | |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent RequestZHInboundTask(string agvTaskCode, string palletCode, string palletType, string materialLot) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·åæµè¯æ¶ååºåä¿¡æ¯ |
| | | 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(); |
| | | 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) |
| | | { |
| | | return content.Error($"æçç±»åä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | //è·åé»çæ¹æ¬¡ |
| | | WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot); |
| | | if (!requestLotInfo.Status) |
| | | { |
| | | return content.Error($"{requestLotInfo.Message}"); |
| | | } |
| | | MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString()); |
| | | Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() |
| | | { |
| | | MaterielSpec = mesLotInfo.ProductVersion, |
| | | BatchNo = materialLot, |
| | | EffectiveDate = mesLotInfo.DateCode, |
| | | MaterielCode = mesLotInfo.Product, |
| | | InboundOrderRowNo = 0, |
| | | MaterielName = mesLotInfo.Product, |
| | | ProductionDate = mesLotInfo.DateCode, |
| | | OrderNo = "", |
| | | OutboundQuantity = 0, |
| | | SerialNumber = materialLot, |
| | | StockQuantity = (float)mesLotInfo.Qty, |
| | | Status = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(), |
| | | Unit = "Lot", |
| | | Remark= mesLotInfo.IsFullNumber?"满Lot":"䏿»¡Lot" |
| | | }; |
| | | Dt_StockInfo stockInfo = new Dt_StockInfo() |
| | | { |
| | | PalletCode = palletCode, |
| | | PalletType = palletTypeInfo.PalletType, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(), |
| | | Details = new List<Dt_StockInfoDetail> { stockInfoDetail } |
| | | }; |
| | | |
| | | //çæéåºä»»å¡ |
| | | Dt_Task taskIn = new() |
| | | { |
| | | CurrentAddress = "AGV_ZH", |
| | | Grade = 0, |
| | | PalletCode = palletCode, |
| | | NextAddress = "", |
| | | Roadway = "", |
| | | SourceAddress = "AGV_ZH", |
| | | TargetAddress = "", |
| | | TaskStatus = (int)TaskStatusEnum.New, |
| | | TaskType = (int)TaskTypeEnum.InZHProduct, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = palletTypeInfo.PalletType, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); |
| | | BaseDal.AddData(taskIn); |
| | | //BaseDal.AddData(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_ZH"); ; |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public readonly string[] OutStartPonits = { "5230", "5237", "5244" }; |
| | | /// <summary> |
| | | /// æå使éåºå
¥ä» |