| | |
| | | return currentConfig; |
| | | } |
| | | |
| | | public override WebResponseContent UpdateData(SaveModel saveModel) |
| | | { |
| | | |
| | | return base.UpdateData(saveModel); |
| | | } |
| | | |
| | | public async Task<Dt_BDCConfiguration> UpdateConfiguration(int maxWhiteBody, int maxPaintedBody, |
| | | int maxBatteryCase, int maxEmptySled, string updatedBy) |
| | | int maxBatteryCase, int maxEmptySled) |
| | | { |
| | | // ç¦ç¨å½åé
ç½® |
| | | var currentConfigs = await BaseDal.QueryDataAsync(c => c.IsActive == 1); |
| | | |
| | | currentConfigs.ForEach(c => c.IsActive = 2); |
| | | |
| | | // å建æ°é
ç½® |
| | |
| | | MaxBatteryCaseCache = maxBatteryCase, |
| | | MaxEmptySledCache = maxEmptySled, |
| | | LastUpdatedTime = DateTime.Now, |
| | | UpdatedBy = updatedBy, |
| | | UpdatedBy = App.User.UserName, |
| | | IsActive = 1 |
| | | }; |
| | | |
| | |
| | | return newConfig; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç½è½¦èº«æ¯å¦å¯å
¥åº |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public async Task<bool> CanAddWhiteBody() |
| | | { |
| | | var config = await GetCurrentConfiguration(); |
| | | var currentCount = GetWhiteBodyCount(); |
| | | var currentCount = GetWhiteBodyCount(); |
| | | |
| | | // é¢ç5%çç¼å²ç©ºé´ |
| | | var threshold = (int)(config.MaxWhiteBodyCache * 0.95); |
| | |
| | | public async Task<bool> CanAddPaintedBody() |
| | | { |
| | | var config = await GetCurrentConfiguration(); |
| | | var currentCount = GetPaintedBodyCount(); |
| | | var currentCount = GetPaintedBodyCount(); |
| | | |
| | | // é¢ç5%çç¼å²ç©ºé´ |
| | | var threshold = (int)(config.MaxPaintedBodyCache * 0.95); |
| | | return currentCount < threshold; |
| | | } |
| | | |
| | | |
| | | public async Task<bool> CanAddEmptySled() |
| | | { |
| | | var config = await GetCurrentConfiguration(); |
| | | var currentCount = GetEmptySledCount(); |
| | | var currentCount = GetEmptySledCount(); |
| | | |
| | | // é¢ç5%çç¼å²ç©ºé´ |
| | | var threshold = (int)(config.MaxEmptySledCache * 0.95); |
| | | return currentCount < threshold; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç½è½¦èº«åºåæ°é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public int GetWhiteBodyCount() |
| | | { |
| | | return _palletStockInfoRepository.QueryData(b => b.CarType == (int)BodyType.WhiteBody && b.StockStatus == (int)BodyStatus.InBDC).Count; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 彩车身åºåæ°é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public int GetPaintedBodyCount() |
| | | { |
| | | return _palletStockInfoRepository.QueryData(b => b.CarType == (int)BodyType.PaintedBody && b.StockStatus == (int)BodyStatus.InBDC).Count; |
| | | return _palletStockInfoRepository.QueryData(b => b.CarType == (int)BodyType.PaintedBody && b.StockStatus == (int)BodyStatus.InBDC).Count; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// çµæ± 壳åºåæ°é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public int GetBatteryCaseCount() |
| | | { |
| | | return _palletStockInfoRepository.QueryData(b => b.StockStatus == (int)BodyStatus.InBDC).Count; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç©ºæ»æ©åºåæ°é |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public int GetEmptySledCount() |
| | | { |
| | | return _palletStockInfoRepository.QueryData(s => s.StockStatus == (int)BodyStatus.InBDC).Count; |