1
helongyang
2025-06-12 25cb7cd50d12f48e93d6cde47420ca3458e9c47a
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
using System;
using System.Collections;
@@ -749,33 +750,45 @@
                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)
                ////获取阻焊批次
                //WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot);
                //if (!requestLotInfo.Status)
                //{
                //    return content.Error($"请求阻焊批次信息失败,{requestLotInfo.Message}");
                //}
                //MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString());
                MesLotInfoModel mesLotInfo = new MesLotInfoModel()
                {
                    return content.Error($"{requestLotInfo.Message}");
                }
                MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString());
                    Product="FH001",
                    ProductVersion="A1",
                    Qty=20,
                    LotNo= materialLot,
                    IsFullNumber=true
                };
                Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail()
                {
                    MaterielSpec = mesLotInfo.ProductVersion,
                    BatchNo = materialLot,
                    EffectiveDate = mesLotInfo.DateCode,
                    EffectiveDate = mesLotInfo.DateCode ?? " ",
                    MaterielCode = mesLotInfo.Product,
                    InboundOrderRowNo =  0,
                    MaterielName = mesLotInfo.Product,
                    ProductionDate = mesLotInfo.DateCode,
                    ProductionDate = mesLotInfo.DateCode ?? " ",
                    OrderNo = "",
                    OutboundQuantity = 0,
                    SerialNumber = materialLot,
@@ -800,14 +813,14 @@
                    Grade = 0,
                    PalletCode = palletCode,
                    NextAddress = "",
                    Roadway = "",
                    Roadway = "SC01_ZH",
                    SourceAddress = "AGV_ZH",
                    TargetAddress = "",
                    TaskStatus = (int)TaskStatusEnum.New,
                    TaskType = (int)TaskTypeEnum.InZHProduct,
                    TaskType = palletTypeInfo.LocaitonCount==2? (int)TaskTypeEnum.InZHProductLarge : (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();
@@ -815,8 +828,8 @@
                //BaseDal.AddData(task);
                _unitOfWorkManage.CommitTran();
                //将任务推送到WCS
                PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_ZH"); ;
                content.OK();
                PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_ZH", agvTaskCode);
                content.OK(data: taskIn);
            }
            catch (Exception ex)
            {