1
Zhang-Hong-Lin
2025-03-11 f9e3252c454e476ed1ee00b081d83751f623fc3e
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_WMSPart/LocationInfoService.cs
@@ -74,7 +74,7 @@
                List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>();
                for (int i = 1; i < 38; i++)
                {
                    for (int a = 1; a < 7; a++)
                    for (int a = 1; a < 12; a++)
                    {
                        for (int g = 1; g < 3; g++)
                        {
@@ -116,9 +116,18 @@
            try
            {
                var mode = _dt_storagemode.QueryFirst(v=>v.Id==1);
                if (mode.storagemode==(int)StorageModeEnum.Out)
                if (InMode == 6)
                {
                    var locations = BaseDal.QueryData(v=>v.EnableStatus== (int)EnableStatusEnum.Normal && v.LocationStatus==(int)LocationStatusEnum.Free).OrderBy(v=>v.Row).ToList();
                    var locations = BaseDal.QueryData(v => v.EnableStatus == (int)EnableStatusEnum.Normal && v.LocationStatus == (int)LocationStatusEnum.Free && v.LocationType==(int)LocationTypeEnum.Cube).OrderBy(v => v.Row).ToList();
                    if (locations.Count <= 0)
                    {
                        throw new Exception($"入库优先货位分配失败,当前无空闲货位");
                    }
                    location = locations[0];
                }
                else if (mode.storagemode==(int)StorageModeEnum.Out)
                {
                    var locations = BaseDal.QueryData(v=>v.EnableStatus== (int)EnableStatusEnum.Normal && v.LocationStatus==(int)LocationStatusEnum.Free && v.LocationType == (int)LocationTypeEnum.Flat).OrderBy(v=>v.Row).ToList();
                    if (locations.Count<=0) 
                    {
                        throw new Exception($"出库优先货位分配失败,当前无空闲货位");
@@ -127,13 +136,41 @@
                }
                else if(mode.storagemode == (int)StorageModeEnum.In)
                {
                    var locations = BaseDal.QueryData(v => v.EnableStatus == (int)EnableStatusEnum.Normal && v.LocationStatus == (int)LocationStatusEnum.Free).OrderByDescending(v => v.Row).ToList();
                    var locations = BaseDal.QueryData(v => v.EnableStatus == (int)EnableStatusEnum.Normal && v.LocationStatus == (int)LocationStatusEnum.Free && v.LocationType == (int)LocationTypeEnum.Flat).OrderByDescending(v => v.Row).ToList();
                    if (locations.Count <= 0)
                    {
                        throw new Exception($"入库优先货位分配失败,当前无空闲货位");
                    }
                    location = locations[0];
                }
                if (location!=null)
                {
                    if (InMode == 6)
                    {
                        location.LocationStatus = (int)LocationStatusEnum.Lock;
                        BaseDal.UpdateData(location);
                    }
                    else
                    {
                        //查找相邻的库位
                        Dt_LocationInfo Towlocation = new Dt_LocationInfo();
                        var Onelocation = BaseDal.QueryFirst(v => v.LocationCode == location.LocationCode);
                        if (Onelocation.Depth == 1)
                        {
                            Towlocation = BaseDal.QueryFirst(v => v.Row == Onelocation.Row && v.Column == Onelocation.Column && v.Depth == 2);
                        }
                        else
                        {
                            Towlocation = BaseDal.QueryFirst(v => v.Row == Onelocation.Row && v.Column == Onelocation.Column && v.Depth == 1);
                        }
                        location.LocationStatus = (int)LocationStatusEnum.Lock;
                        Towlocation.LocationStatus = (int)LocationStatusEnum.Lock;
                        BaseDal.UpdateData(location);
                        BaseDal.UpdateData(Towlocation);
                    }
                }
            }
            catch (Exception ex)
            {