3
肖洋
2024-11-25 7202fced2a265369f83f1557d3db7525bb62d41b
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -184,7 +184,7 @@
    private (DtLocationInfo, Dt_Task) UpdateStockAndTaskStatus(DtStockInfo stock, Dt_Task task)
    {
        var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress);
        var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress && x.RoadwayNo == task.Roadway);
        //var details = _stockInfoDetailRepository.QueryData(x => x.StockId == stock.Id);
        location.LocationStatus = (int)LocationEnum.Free;
@@ -315,6 +315,7 @@
            // 根据是否有组盘信息创建库存实例模型
            DtStockInfo stock = boxing == null ? CreateEmptyPalletStock(task, locationInf) : CreateFullPalletStock(task, locationInf, boxing);
            // 执行数据库事务
            bool isResult = await ExecuteTransaction(stock, taskHty, locationInf, task.TaskId);
            if (isResult)
@@ -350,13 +351,41 @@
            CreateDate = DateTime.Now,
            Creater = "system",
            IsFull = false,
            AreaCode = area.AreaCode,
            AreaCode = area.AreaCode ?? "",
            LocationId = loation.Id,
            StockInfoDetails = new List<DtStockInfoDetail>()
            {
                new DtStockInfoDetail()
                {
                    MaterielCode = "空托盘",
                    Id = 0,
                    Status = (int)StockStateEmun.已入库
                }
            }
        };
    }
    /// <summary>
    /// 创建分容的实托盘的库存实例模型
    /// </summary>
    private DtStockInfo CreateFullPalletStockByFR(Dt_Task task, DtLocationInfo locationInf)
    {
        var loation = _locationRepository.QueryFirst(x => x.RoadwayNo == task.Roadway && x.LocationCode == task.TargetAddress);
        var area = _areaInfoRepository.QueryFirst(x => x.AreaID == loation.AreaId);
        return new DtStockInfo()
        {
            PalletCode = task.PalletCode,
            LocationCode = task.TargetAddress,
            CreateDate = DateTime.Now,
            Creater = "system",
            IsFull = false,
            AreaCode = area.AreaCode ?? "",
            LocationId = loation.Id,
            StockInfoDetails = new List<DtStockInfoDetail>()
            {
                new DtStockInfoDetail()
                {
                    MaterielCode = "实托盘",
                    Id = 0,
                    Status = (int)StockStateEmun.已入库
                }
@@ -571,7 +600,7 @@
            // 调用CreateBoxingInfo方法,创建组盘信息
            var boxing = await CreateBoxingInfo(result, input.PalletCode);
            var boxing = CreateBoxingInfo(result, input.PalletCode);
            if (boxing == null) return content.Error("组盘失败");
            // 调用GetProcessApplyAsync方法,获取工艺路线
@@ -702,7 +731,7 @@
    }
    // 获取组盘信息
    private async Task<DtBoxingInfo> CreateBoxingInfo(ResultTrayCellsStatus result, string palletCode)
    private DtBoxingInfo CreateBoxingInfo(ResultTrayCellsStatus result, string palletCode)
    {
        return new DtBoxingInfo
        {
@@ -1208,12 +1237,14 @@
            {
                // 添加库存
                isUpdateStock = await _stockInfoRepository.AddDataNavAsync(stock);
                if (boxingInfo != null)
                {
                isDeleteBoxing = await _boxingInfoRepository.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxingInfo.Id)
                   .Include(x => x.BoxingInfoDetails)
                   .ExecuteCommandAsync();
            }
            }
            // 添加历史任务
            var isTaskHtyAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0;