| | |
| | | using System.Linq.Expressions; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_IStoragIntegrationServices; |
| | | |
| | | namespace WIDESEA_StorageBasicService; |
| | | |
| | | public class VV_MesLockInfoService : ServiceBase<VV_MesLockInfo, IVV_MesLockInfoRepository>, IVV_MesLockInfoService |
| | | { |
| | | private readonly IVV_StockInfoRepository _stockInfoRepository; |
| | | public VV_MesLockInfoService(IVV_MesLockInfoRepository BaseDal, IVV_StockInfoRepository stockInfoRepository) : base(BaseDal) |
| | | private readonly IDt_MESLockInfoRepository _MESLockInfoRepository; |
| | | private readonly IDt_CarBodyInfoRepository _carBodyInfoRepository; |
| | | private readonly IMESService _MESService; |
| | | public VV_MesLockInfoService(IVV_MesLockInfoRepository BaseDal, IVV_StockInfoRepository stockInfoRepository, IDt_MESLockInfoRepository MESLockInfoRepository, IDt_CarBodyInfoRepository carBodyInfoRepository, IMESService MESService) : base(BaseDal) |
| | | { |
| | | _stockInfoRepository = stockInfoRepository; |
| | | _MESLockInfoRepository = MESLockInfoRepository; |
| | | _carBodyInfoRepository = carBodyInfoRepository; |
| | | _MESService = MESService; |
| | | } |
| | | |
| | | public WebResponseContent GetMesLockInfo() |
| | |
| | | carBodyCharacteristic = x.carBodyCharacteristic |
| | | }); |
| | | }); |
| | | |
| | | return content.OK(data: mesLockDTOs); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent MesLock(object[] keys) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | List<Dt_CarBodyInfo> bodyInfos = new List<Dt_CarBodyInfo>(); |
| | | List<Dt_MESLockInfo> lockinfo = new List<Dt_MESLockInfo>(); |
| | | foreach (var item in keys) |
| | | { |
| | | |
| | | } |
| | | |
| | | if (!bodyInfos.Any()) throw new Exception("éè½¦ä¸æ¥å¤±è´¥:æ éè½¦æ°æ®"); |
| | | |
| | | var mesLock = _MESLockInfoRepository.QueryFirst(x => x.Id == Convert.ToInt32(keys)); |
| | | mesLock.LockStatue = 3; //å¼å¸¸é车 |
| | | var carInfo = _carBodyInfoRepository.QueryFirst(x => x.Id == mesLock.carBodyID); |
| | | if (carInfo != null) |
| | | { |
| | | bodyInfos.Add(carInfo); |
| | | lockinfo.Add(mesLock); |
| | | } |
| | | |
| | | WebResponseContent webResponse = _MESService.LockRequest(carInfo, 1); |
| | | if (webResponse.Status) |
| | | { |
| | | _MESLockInfoRepository.UpdateData(lockinfo); |
| | | content.OK(); |
| | | } |
| | | else |
| | | { |
| | | content.Error(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public WebResponseContent MesUnLock(object[] keys) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | List<Dt_CarBodyInfo> bodyInfos = new List<Dt_CarBodyInfo>(); |
| | | foreach (var item in keys) |
| | | { |
| | | |
| | | } |
| | | |
| | | if (!bodyInfos.Any()) throw new Exception("éè½¦ä¸æ¥å¤±è´¥:æ éè½¦æ°æ®"); |
| | | |
| | | var mesLock = _MESLockInfoRepository.QueryFirst(x => x.Id == Convert.ToInt32(keys)); |
| | | |
| | | var carInfo = _carBodyInfoRepository.QueryFirst(x => x.Id == mesLock.carBodyID); |
| | | if (carInfo != null) bodyInfos.Add(carInfo); |
| | | |
| | | WebResponseContent webResponse = _MESService.LockRequest(carInfo, 1); |
| | | if (webResponse.Status) |
| | | { |
| | | content.OK(); |
| | | } |
| | | else |
| | | { |
| | | content.Error(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | } |