| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using AutoMapper; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.StationEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | |
| | | { |
| | | private readonly IDt_ContainerInfoRepository _ContainerInfoRepository; |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | public Dt_MaterialInfoService(IDt_MaterialInfoRepository BaseDal, IDt_ContainerInfoRepository dt_ContainerInfoRepository, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | private readonly IDt_MaterialInfo_HtyRepository _MaterialInfo_HtyRepository; |
| | | private readonly IMapper _mapper; |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | public Dt_MaterialInfoService(IDt_MaterialInfoRepository BaseDal, IDt_ContainerInfoRepository dt_ContainerInfoRepository, IUnitOfWorkManage unitOfWorkManage, IDt_MaterialInfo_HtyRepository materialInfo_HtyRepository,IMapper mapper, IDt_StationManagerRepository stationManagerRepository) : base(BaseDal) |
| | | { |
| | | _ContainerInfoRepository = dt_ContainerInfoRepository; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _MaterialInfo_HtyRepository = materialInfo_HtyRepository; |
| | | _mapper = mapper; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | } |
| | | /// <summary> |
| | | /// æ°å¢ç»çä¿¡æ¯ |
| | |
| | | Dt_MaterialInfo dt_MaterialInfo = await BaseDal.QueryFirstAsync(x => x.ContainerCode == containerbindingDTO.VehicleNumber); |
| | | if (dt_MaterialInfo != null) return content.Error("å½å容å¨å·²ç»å® 请å¿éå¤æäº¤"); |
| | | |
| | | dt_MaterialInfo = await BaseDal.QueryFirstAsync(x => x.MaterialName == containerbindingDTO.materSn); |
| | | if (dt_MaterialInfo != null) return content.Error("å½åé¶ä»¶å·å·²åå¨ è¯·å¿éå¤æäº¤"); |
| | | Dt_StationManager dt_StationManager = _stationManagerRepository.QueryFirst( |
| | | x => x.StationLocation == containerbindingDTO.Position |
| | | && x.StationStatus == ((int)StationEnum.Enable).ToString()); |
| | | |
| | | if (dt_StationManager == null) return content.Error("å½åç«å°æªé
ç½® æå·²åç¨"); |
| | | |
| | | dt_MaterialInfo = new Dt_MaterialInfo(); |
| | | dt_MaterialInfo.MaterialName = containerbindingDTO.materSn; |
| | | dt_MaterialInfo.ContainerCode = containerbindingDTO.VehicleNumber; |
| | | dt_MaterialInfo.Position = containerbindingDTO.Position; |
| | | dt_MaterialInfo.Carmodel = containerbindingDTO.Carmodel; |
| | | string s = App.User.UserName; |
| | | await BaseDal.AddDataAsync(dt_MaterialInfo); |
| | | dt_MaterialInfo.Region = dt_StationManager.StationArea; |
| | | |
| | | // 2. æ§è¡ä¸å®ä¼æ¥éç代ç ï¼é¤ä»¥é¶ |
| | | //int a = 1; |
| | | //int b = 0; |
| | |
| | | containerInfo = new Dt_ContainerInfo(); |
| | | containerInfo.RequestId = Guid.NewGuid().ToString().Replace("-", ""); |
| | | containerInfo.ContainerCode = containerbindingDTO.VehicleNumber; |
| | | dt_MaterialInfo.IsNew = true; |
| | | await _ContainerInfoRepository.AddDataAsync(containerInfo); |
| | | } |
| | | await BaseDal.AddDataAsync(dt_MaterialInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content.OK(); |
| | | return content.OK(message:"ç©æç»å®æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | public async Task<WebResponseContent> DeleteGroupPlateAsync(string PalletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | // å
æ¥è¯¢ç¸åºçç»çç»å®ä¿¡æ¯ å¦ææ²¡ææ°æ®åè¿å |
| | | Dt_MaterialInfo dt_MaterialInfo = await BaseDal.QueryFirstAsync(x => x.ContainerCode == PalletCode); |
| | | if (dt_MaterialInfo == null) return content.Error("æ¥è¯¢ä¸å°ç¸å
³æ°æ® æè
å·²ç»è§£ç»ï¼"); |
| | | |
| | | // è¿éé¢è¦åç©æç»çä¿¡æ¯çç¶ææ¹åä¾å¦å·²è§£ç» |
| | | dt_MaterialInfo.IsBind = false; |
| | | |
| | | Dt_MaterialInfo_Hty dt_MaterialInfo_Hty = _mapper.Map<Dt_MaterialInfo_Hty>(dt_MaterialInfo); |
| | | |
| | | await _MaterialInfo_HtyRepository.AddDataAsync(dt_MaterialInfo_Hty); |
| | | await BaseDal.DeleteDataAsync(dt_MaterialInfo); |
| | | |
| | | // å é¤å½åç»çæ°æ®æ·»å è¿å
¥åå²è®°å½ |
| | | return content.OK(message: "ç©æè§£ç»æå"); |
| | | } |
| | | } |
| | | } |