| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.HttpContextUser; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.Location; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_StorageBasicService; |
| | |
| | | private readonly ILocationStatusChangeRecordRepository _locationStatusChangeRecordRepository; |
| | | private readonly IMapper _mapper; |
| | | private readonly IDt_PalletStockInfoRepository _palletStockInfoRepository; |
| | | private readonly IVV_StockInfoRepository _stockrepository; |
| | | |
| | | public LocationInfoService(ILocationInfoRepository BaseDal, |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | |
| | | IStockInfoDetailRepository stockInfoDetailRepository, |
| | | IMapper mapper, |
| | | IDt_TaskService taskService, |
| | | IDt_PalletStockInfoRepository palletStockInfoRepository) : base(BaseDal) |
| | | IDt_PalletStockInfoRepository palletStockInfoRepository, |
| | | IVV_StockInfoRepository stockrepository) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _taskRepository = taskRepository; |
| | |
| | | _mapper = mapper; |
| | | _taskService = taskService; |
| | | _palletStockInfoRepository = palletStockInfoRepository; |
| | | _stockrepository = stockrepository; |
| | | } |
| | | |
| | | |
| | |
| | | _locationStatusChangeRecordRepository.AddStatusChangeRecord(changeRecordDto); |
| | | |
| | | return base.UpdateData(saveModel); |
| | | } |
| | | |
| | | public override WebResponseContent AddData(SaveModel saveModel) |
| | | { |
| | | WebResponseContent content = new(); |
| | | try |
| | | { |
| | | int line = saveModel.MainData["row"].ObjToInt(); |
| | | int column = saveModel.MainData["column"].ObjToInt(); |
| | | int layer = saveModel.MainData["layer"].ObjToInt(); |
| | | int locationType = saveModel.MainData["locationType"].ObjToInt(); |
| | | //int status = saveModel.MainData["locationStatus"].ObjToInt(); |
| | | //string roadwayNo = saveModel.MainData["roadwayNo"].ToString(); |
| | | |
| | | string locationCode = line.ToString().PadLeft(3, '0') + '-' + column.ToString().PadLeft(3, '0') + '-' + layer.ToString().PadLeft(3, '0'); |
| | | var location = BaseDal.QueryFirst(x => x.LocationCode == locationCode); |
| | | if (location != null) throw new Exception($"{locationCode}åºä½å·²åå¨,è¯·æ ¸æ¥"); |
| | | |
| | | DtLocationInfo locationInfo = new DtLocationInfo |
| | | { |
| | | Row = line, |
| | | Column = column, |
| | | Layer = layer, |
| | | LocationCode = line.ToString().PadLeft(3, '0') + '-' + column.ToString().PadLeft(3, '0') + '-' + layer.ToString().PadLeft(3, '0'), |
| | | LocationName = ConvertToFormattedString(line, column, layer), |
| | | LocationType = locationType, |
| | | Remark = "", |
| | | Depth = 0, |
| | | RoadwayNo = locationType == 1 ? "CTU" : "AGV", |
| | | LocationStatus = LocationEnum.Free.ObjToInt(), |
| | | AreaId = 0, |
| | | Creater = App.User.UserName, |
| | | EnalbeStatus = 2, //é»è®¤ç¦ç¨ |
| | | CreateDate = DateTime.Now, |
| | | }; |
| | | |
| | | if (BaseDal.AddData(locationInfo) > 0) |
| | | { |
| | | return content.OK("æ·»å æå!"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("æ·»å 失败"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error($"æ·»å 失败:{ex.Message}"); |
| | | } |
| | | |
| | | } |
| | | |
| | | #region åå§ååºä½ |
| | |
| | | { |
| | | var data = BaseDal.QueryData(x => x.AreaId == Convert.ToInt32(area.areaCode)); |
| | | |
| | | List<VV_StockInfo> stockInfos = _stockrepository.QueryData(x => true); |
| | | |
| | | List<LocationLayer> layers = new List<LocationLayer>(); |
| | | foreach (var layer in data.GroupBy(t => t.Column)) |
| | | foreach (var layer in data.GroupBy(t => t.Layer)) |
| | | { |
| | | var rows = new List<LocationRow>(); |
| | | var data_rows = layer.GroupBy(t => t.Row); |
| | |
| | | var cols = new List<LocationCol>(); |
| | | foreach (var data_col in data_row) |
| | | { |
| | | var stock = stockInfos.FirstOrDefault(x => x.LocationCode == data_col.LocationCode); |
| | | |
| | | cols.Add(new LocationCol() |
| | | { |
| | | //å |
| | | index = data_col.Layer, |
| | | index = data_col.Column, |
| | | locationCode = data_col.LocationCode, |
| | | location_state = data_col.LocationStatus.ToString(), |
| | | location_lock = data_col.EnalbeStatus.ToString(), |
| | | stockInfo = stock |
| | | }); |
| | | } |
| | | cols = cols.OrderBy(t => t.index).ToList(); |
| | |
| | | return layers; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region å
鍿¹æ³ |
| | | |