| | |
| | | { |
| | | return BaseDal.QueryFirst(x => x.RoadwayNo == locationInfo.RoadwayNo && x.Column == locationInfo.Column && x.Layer == locationInfo.Layer && x.Depth != locationInfo.Depth && x.Row != locationInfo.Row && (SqlFunc.Abs(x.Row - locationInfo.Row) == 1)); |
| | | } |
| | | public void UpdateLocationLock(Dt_LocationInfo locationInfo, int? TaskNum) |
| | | public void UpdateLocationLock(Dt_LocationInfo locations, int TaskNum,int changType,bool black) |
| | | { |
| | | try |
| | | { |
| | | if (locationInfo.Depth == 2) |
| | | if (black) |
| | | { |
| | | Dt_LocationInfo dt_LocationInfo = null; |
| | | int beforeStatus = 0; |
| | | if (locationInfo.Row == 1 || locationInfo.Row == 5) |
| | | (Dt_LocationInfo?, int?) result = isDepth(locations); |
| | | if (result.Item1 != null && (result.Item2 == LocationStatusEnum.Free.ObjToInt()|| result.Item2 == LocationStatusEnum.Lock.ObjToInt())) |
| | | { |
| | | dt_LocationInfo = BaseDal.QueryFirst(x => x.Row == locationInfo.Row + 1 && x.Layer == locationInfo.Layer && x.Column == locationInfo.Column && x.RoadwayNo == locationInfo.RoadwayNo); |
| | | beforeStatus = dt_LocationInfo.LocationStatus; |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | dt_LocationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | BaseDal.UpdateData(dt_LocationInfo); |
| | | } |
| | | int beforeStatusEnd = result.Item1.LocationStatus; |
| | | |
| | | result.Item1.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | |
| | | BaseDal.UpdateData(result.Item1); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(result.Item1, beforeStatusEnd, changType, "", TaskNum); |
| | | } |
| | | else if (locationInfo.Row == 4 || locationInfo.Row == 8) |
| | | } |
| | | else |
| | | { |
| | | (Dt_LocationInfo?, int?) result = isDepth(locations); |
| | | if (result.Item1 != null && result.Item2 == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | dt_LocationInfo = BaseDal.QueryFirst(x => x.Row == locationInfo.Row + 1 && x.Layer == locationInfo.Layer && x.Column == locationInfo.Column && x.RoadwayNo == locationInfo.RoadwayNo); |
| | | beforeStatus = dt_LocationInfo.LocationStatus; |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | dt_LocationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | BaseDal.UpdateData(dt_LocationInfo); |
| | | } |
| | | int beforeStatusEnd = result.Item1.LocationStatus; |
| | | |
| | | result.Item1.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | |
| | | BaseDal.UpdateData(result.Item1); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(result.Item1, beforeStatusEnd, changType, "", TaskNum); |
| | | } |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Lock.ObjToInt(), "", TaskNum); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw ex; |
| | | } |
| | | |
| | | } |
| | | public void UpdateLocationFree(Dt_LocationInfo locations, int TaskNum, int changType,bool black) |
| | | { |
| | | try |
| | | { |
| | | (Dt_LocationInfo?, int?) result = isDepth(locations); |
| | | if (result.Item1 != null) |
| | | { |
| | | int beforeStatusEnd = result.Item1.LocationStatus; |
| | | |
| | | result.Item1.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | |
| | | BaseDal.UpdateData(result.Item1); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(result.Item1, beforeStatusEnd, changType, "", TaskNum); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | |
| | | } |
| | | public void UpdateLocationFree(Dt_LocationInfo locationInfo, int? TaskNum) |
| | | { |
| | | try |
| | | { |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | Dt_LocationInfo dt_LocationInfo = null; |
| | | int beforeStatus = 0; |
| | | if (locationInfo.Row == 1 || locationInfo.Row == 5) |
| | | { |
| | | dt_LocationInfo = BaseDal.QueryFirst(x => x.Row == locationInfo.Row + 1 && x.Layer == locationInfo.Layer && x.Column == locationInfo.Column && x.RoadwayNo == locationInfo.RoadwayNo); |
| | | beforeStatus = dt_LocationInfo.LocationStatus; |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | dt_LocationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | BaseDal.UpdateData(dt_LocationInfo); |
| | | } |
| | | } |
| | | else if (locationInfo.Row == 4 || locationInfo.Row == 8) |
| | | { |
| | | dt_LocationInfo = BaseDal.QueryFirst(x => x.Row == locationInfo.Row + 1 && x.Layer == locationInfo.Layer && x.Column == locationInfo.Column && x.RoadwayNo == locationInfo.RoadwayNo); |
| | | beforeStatus = dt_LocationInfo.LocationStatus; |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | dt_LocationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | BaseDal.UpdateData(dt_LocationInfo); |
| | | } |
| | | } |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(dt_LocationInfo, beforeStatus, StockChangeType.Lock.ObjToInt(), "", TaskNum); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw ex; |
| | | } |
| | | |
| | | } |
| | | public Dt_LocationInfo isDepth(Dt_LocationInfo locationInfo) |
| | | public (Dt_LocationInfo?,int?) isDepth(Dt_LocationInfo locationInfo) |
| | | { |
| | | if (locationInfo.Depth == 2) |
| | | { |
| | | if (locationInfo.Row == 1 || locationInfo.Row == 5) |
| | | { |
| | | Dt_LocationInfo dt_LocationInfo = BaseDal.QueryFirst(x => x.Row == locationInfo.Row + 1 && x.Layer == locationInfo.Layer && x.Column == locationInfo.Column && x.RoadwayNo == locationInfo.RoadwayNo); |
| | | |
| | | if (dt_LocationInfo != null&& dt_LocationInfo.LocationStatus==LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | return dt_LocationInfo; |
| | | return (dt_LocationInfo, LocationStatusEnum.InStock.ObjToInt()); |
| | | } |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | return (dt_LocationInfo, LocationStatusEnum.Free.ObjToInt()); |
| | | } |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.Lock.ObjToInt()) |
| | | { |
| | | return (dt_LocationInfo, LocationStatusEnum.Lock.ObjToInt()); |
| | | } |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.PalletLock.ObjToInt()) |
| | | { |
| | | return (dt_LocationInfo, LocationStatusEnum.PalletLock.ObjToInt()); |
| | | } |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.Pallet.ObjToInt()) |
| | | { |
| | | return (dt_LocationInfo, LocationStatusEnum.Pallet.ObjToInt()); |
| | | } |
| | | } |
| | | else if (locationInfo.Row == 4 || locationInfo.Row == 8) |
| | | { |
| | | Dt_LocationInfo dt_LocationInfo = BaseDal.QueryFirst(x => x.Row == locationInfo.Row + 1 && x.Layer == locationInfo.Layer && x.Column == locationInfo.Column && x.RoadwayNo == locationInfo.RoadwayNo); |
| | | |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | return dt_LocationInfo; |
| | | return (dt_LocationInfo, LocationStatusEnum.InStock.ObjToInt()); |
| | | } |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | return (dt_LocationInfo, LocationStatusEnum.Free.ObjToInt()); |
| | | } |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.Lock.ObjToInt()) |
| | | { |
| | | return (dt_LocationInfo, LocationStatusEnum.Lock.ObjToInt()); |
| | | } |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.PalletLock.ObjToInt()) |
| | | { |
| | | return (dt_LocationInfo, LocationStatusEnum.PalletLock.ObjToInt()); |
| | | } |
| | | if (dt_LocationInfo != null && dt_LocationInfo.LocationStatus == LocationStatusEnum.Pallet.ObjToInt()) |
| | | { |
| | | return (dt_LocationInfo, LocationStatusEnum.Pallet.ObjToInt()); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | return (null, LocationStatusEnum.Free.ObjToInt()); |
| | | } |
| | | public void RelocationLock(Dt_LocationInfo locationInfo, Dt_LocationInfo locationInfos,int TaskNum) |
| | | public void RelocationLock(Dt_LocationInfo locationInfo, Dt_LocationInfo locationInfos, int TaskNum) |
| | | { |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | int beforeStatu = locationInfos.LocationStatus; |
| | | int beforeStartStatus = locationInfo.LocationStatus; |
| | | int beforeEndStatus = locationInfos.LocationStatus; |
| | | |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | locationInfos.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | |
| | | if (locationInfos.LocationStatus == LocationStatusEnum.Pallet.ObjToInt()) |
| | | { |
| | | locationInfos.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | locationInfos.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | } |
| | | |
| | | BaseDal.UpdateData(locationInfo); |
| | | |
| | | BaseDal.UpdateData(locationInfos); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Relocation.ObjToInt(), "", TaskNum); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, beforeStatu, StockChangeType.Relocation.ObjToInt(), "", TaskNum); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStartStatus, StockChangeType.Relocation.ObjToInt(), "", TaskNum); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, beforeEndStatus, StockChangeType.Relocation.ObjToInt(), "", TaskNum); |
| | | } |
| | | public void RelocationFree(Dt_LocationInfo locationInfo, Dt_LocationInfo locationInfos, int TaskNum) |
| | | public void RelocationFree(Dt_LocationInfo locations, int TaskNum) |
| | | { |
| | | int beforeStatus = locationInfo.LocationStatus; |
| | | int beforeStatu = locationInfos.LocationStatus; |
| | | int beforeEndStatus = locations.LocationStatus; |
| | | |
| | | locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt(); |
| | | locationInfos.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | locations.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | |
| | | BaseDal.UpdateData(locationInfo); |
| | | BaseDal.UpdateData(locationInfos); |
| | | BaseDal.UpdateData(locations); |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Relocation.ObjToInt(), "", TaskNum); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, beforeStatu, StockChangeType.Relocation.ObjToInt(), "", TaskNum); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locations, beforeEndStatus, StockChangeType.Relocation.ObjToInt(), "", TaskNum); |
| | | } |
| | | } |
| | | } |