1
wangxinhui
7 天以前 6abb6078281bed657365d9512af90e87ac90ab60
项目代码/WMS/WMSServices/WIDESEA_TaskInfoService/TaskService_Reloaction.cs
@@ -8,8 +8,10 @@
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.Basic;
using WIDESEA_DTO.Task;
using WIDESEA_Model.Models;
@@ -126,7 +128,6 @@
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public WebResponseContent RelocationTaskCompleted(Dt_Task task)
        {
            try
@@ -166,5 +167,54 @@
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public WebResponseContent IsRelocation(string startAddress,string endAddress,string roadWay)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                //鑾峰彇璐т綅
                Dt_LocationInfo startLocationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == startAddress);
                Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.LocationCode == startAddress);
                Dt_LocationInfo endLocationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == endAddress);
                if (startLocationInfo != null && endLocationInfo != null && stockInfo!=null)
                {
                    Dt_Task newTask = new Dt_Task()
                    {
                        Roadway = roadWay,
                        WarehouseId = stockInfo.WarehouseId,
                        CurrentAddress = startLocationInfo.LocationCode,
                        Grade = 99,
                        NextAddress = endLocationInfo.LocationCode,
                        OrderNo = "",
                        PalletCode = stockInfo.PalletCode,
                        PalletType = stockInfo.PalletType,
                        SourceAddress = startLocationInfo.LocationCode,
                        TargetAddress = endLocationInfo.LocationCode,
                        TaskNum = Repository.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
                        TaskStatus = 0,
                        TaskType = TaskTypeEnum.Relocation.ObjToInt()
                    };
                    stockInfo.StockStatus = StockStatusEmun.绉诲簱閿佸畾.ObjToInt();
                    _unitOfWorkManage.BeginTran();
                    Repository.AddData(newTask);
                    _basicService.LocationInfoService.UpdateLocationStatus(startLocationInfo, stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId);
                    _basicService.LocationInfoService.UpdateLocationStatus(endLocationInfo, stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId);
                    _stockService.StockInfoService.Repository.UpdateData(stockInfo);
                    _unitOfWorkManage.CommitTran();
                    PushTasksToWCS(new List<Dt_Task> { newTask });
                    content.OK("鎴愬姛");
                }
                else
                {
                    content.Error("搴撳瓨璐т綅淇℃伅涓虹┖");
                }
            }
            catch (Exception ex)
            {
                _unitOfWorkManage.RollbackTran();
                content.Error(ex.Message);
            }
            return content;
        }
    }
}