| | |
| | | public partial class TaskService |
| | | { |
| | | |
| | | |
| | | /// <summary> |
| | | /// 仅申请任务,让WCS根据路由确定下一地址 |
| | | /// </summary> |
| | |
| | | Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (task != null) |
| | | { |
| | | //PushTasksToWCS(new List<Dt_Task> { task }); |
| | | return WebResponseContent.Instance.Error($"该托盘{palletCode}已生成任务"); |
| | | } |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == palletCode).Includes(x => x.Details).First(); |
| | |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"未找到组盘信息"); |
| | | } |
| | | if (stockInfo.StockStatus == StockStatusEmun.合托出库完成.ObjToInt()) |
| | | { |
| | | |
| | | } |
| | | ///判断是否存在回库单,进行回原库位逻辑 |
| | | string returnOrderNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.OrderNo; |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"未找到组盘信息"); |
| | | } |
| | | |
| | | Dt_RoadwayInfo returnRoadwayInfo = new Dt_RoadwayInfo(); |
| | | if (stockInfo.StockStatus == StockStatusEmun.合托出库完成.ObjToInt()) |
| | | { |
| | | Dt_LocationInfo locationInfo1 = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | if (locationInfo1 == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"回库单中该库位{stockInfo.LocationCode}未找到"); |
| | | } |
| | | returnRoadwayInfo = _basicRepository.RoadwayInfoRepository.QueryFirst(x => x.RoadwayNo == locationInfo1.RoadwayNo && x.InStationCode == (returnRoadwayInfo.InStationCode != null ? returnRoadwayInfo.InStationCode : stationCode)); |
| | | } |
| | | ///判断是否存在回库单,进行回原库位逻辑 |
| | | string returnOrderNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.OrderNo; |
| | | Dt_ReturnOrder returnOrder = _returnOrderRepository.QueryFirst(x => x.OrderNo == returnOrderNo && x.OrderStatus == InOrderStatusEnum.未开始.ObjToInt()); |
| | | Dt_RoadwayInfo returnRoadwayInfo = new Dt_RoadwayInfo(); |
| | | Dt_ReturnOrder returnOrder = _returnOrderRepository.QueryFirst(x => (x.OrderNo == returnOrderNo || x.LPNNo == palletCode) && x.OrderStatus == InOrderStatusEnum.未开始.ObjToInt()); |
| | | if (returnOrder != null && !string.IsNullOrEmpty(returnOrder.LocationCode)) |
| | | { |
| | | Dt_LocationInfo locationInfo1 = _locationInfoService.Repository.QueryFirst(x => x.LocationCode == returnOrder.LocationCode); |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"回库单中该库位{returnOrder.LocationCode}未找到"); |
| | | } |
| | | returnRoadwayInfo = _basicRepository.RoadwayInfoRepository.QueryFirst(x => x.RoadwayNo == locationInfo1.RoadwayNo); |
| | | returnRoadwayInfo = _basicRepository.RoadwayInfoRepository.QueryFirst(x => x.RoadwayNo == locationInfo1.RoadwayNo && x.InStationCode == (returnRoadwayInfo.InStationCode != null ? returnRoadwayInfo.InStationCode : stationCode)); |
| | | } |
| | | |
| | | if (Repository.QueryFirst(x => x.SourceAddress == (returnRoadwayInfo.InStationCode != null ? returnRoadwayInfo.InStationCode : stationCode) && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null) |
| | |
| | | return WebResponseContent.Instance.Error($"货位分配失败,未找到可分配货位"); |
| | | } |
| | | } |
| | | |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = courceAddress, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | NextAddress = returnRoadwayInfo.InStationCode != null ? returnRoadwayInfo.InStationCode : stationCode, |
| | | PalletCode = palletCode, |
| | | OrderNo = details.OrderNo, |
| | | Roadway = roadwayInfo.RoadwayNo, |
| | |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.InInventory.ObjToInt(); |
| | | } |
| | | if (stockInfo.StockStatus == StockStatusEmun.合托出库完成.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.InSyncretism.ObjToInt(); |
| | | } |
| | | //if (stockInfo.StockStatus == StockStatusEmun.手动组盘暂存.ObjToInt()) |
| | | //{ |
| | | // stockInfo.StockStatus = StockStatusEmun.手动组盘入库确认.ObjToInt(); |
| | |
| | | //} |
| | | //else |
| | | //{ |
| | | stockInfo.StockStatus = StockStatusEmun.入库确认.ObjToInt(); |
| | | else |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.入库确认.ObjToInt(); |
| | | } |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | //} |
| | | |
| | |
| | | //查询仓库托盘货物类型 |
| | | public int GetPalletType(Dt_Warehouse warehouse, string palletCode) |
| | | { |
| | | if (warehouse.WarehouseCode == WarehouseEnum.SC01_BC.ObjToString() || warehouse.WarehouseCode == WarehouseEnum.SC02_BC.ObjToString()) |
| | | if (warehouse.WarehouseCode.Contains("BC")) |
| | | { |
| | | |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 3)); |
| | | if (palletTypeInfo == null) |
| | | { |
| | |
| | | } |
| | | return palletTypeInfo.PalletType; |
| | | } |
| | | //else if (warehouse.WarehouseCode == WarehouseEnum.HA152.ObjToString()) |
| | | //{ |
| | | // Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2)); |
| | | // if (palletTypeInfo == null) |
| | | // { |
| | | // throw new Exception($"托盘号错误"); |
| | | // } |
| | | // return palletTypeInfo.PalletType; |
| | | //} |
| | | //else if (warehouse.WarehouseCode == WarehouseEnum.HA57.ObjToString()) |
| | | //{ |
| | | // Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 3)); |
| | | // if (palletTypeInfo == null) |
| | | // { |
| | | // throw new Exception($"托盘号错误"); |
| | | // } |
| | | // return palletTypeInfo.PalletType; |
| | | //} |
| | | return -1; |
| | | else |
| | | { |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x => x.CodeStartStr == palletCode.Substring(0, 2)); |
| | | if (palletTypeInfo == null) |
| | | { |
| | | throw new Exception($"托盘号错误"); |
| | | } |
| | | return palletTypeInfo.PalletType; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | |