| | |
| | | } |
| | | |
| | | var carBody = _carBodyRepository.QueryFirst(x => x.PalletCode == input.PalletCode); |
| | | if (carBody != null) throw new Exception($"空æ¬{input.PalletCode}ä¿¡æ¯å·²åå¨"); |
| | | |
| | | BDCManager bDCManager = new BDCManager(_bdcConfigurationService, _locationRepository, _roadWayInfoRepository); |
| | | Dt_CarBodyInfo dt_CarBodyInfo = new Dt_CarBodyInfo |
| | | { |
| | | PalletCode = input.PalletCode, |
| | | CarType = 3, |
| | | PVI = input.PalletCode, |
| | | RFID = input.PalletCode, |
| | | BodyStatus = 0 |
| | | }; |
| | | |
| | | await bDCManager.AddToBDC(carBody); |
| | | //BDCManager bDCManager = new BDCManager(_bdcConfigurationService, _locationRepository, _roadWayInfoRepository); |
| | | |
| | | //await bDCManager.AddToBDC(carBody); |
| | | |
| | | // è·ååºä½ |
| | | var location = RequestLocation(stationInfo.Roadway); |
| | | var location = RequestLocation(stationInfo.RoadwayNo, 3); |
| | | if (location == null) |
| | | { |
| | | return content.Error("æ æ³è·åè´§ä½ä¿¡æ¯æåºä½å·²æ»¡"); |
| | |
| | | Grade = 1, |
| | | Roadway = stationInfo.Roadway, |
| | | TargetAddress = location.LocationCode, |
| | | Dispatchertime = DateTime.Now, |
| | | NextAddress = stationInfo.Roadway, |
| | | //Dispatchertime = DateTime.Now, |
| | | NextAddress = input.Position, |
| | | OrderNo = null, |
| | | PalletCode = input.PalletCode, |
| | | SourceAddress = stationInfo.stationLocation, |
| | | TaskState = (int)TaskInStatusEnum.InNew, |
| | | TaskType = (int)TaskInboundTypeEnum.Inbound, |
| | | TaskType = (int)TaskInboundTypeEnum.InTray, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam", |
| | | PVI = input.PVI, |
| | | }; |
| | | |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | BaseDal.AddData(newtask); |
| | | _carBodyRepository.AddData(dt_CarBodyInfo); |
| | | location.LocationStatus = (int)LocationEnum.InStockDisable; |
| | | _locationRepository.UpdateData(location); |
| | | _unitOfWorkManage.CommitTran(); |
| | |
| | | #endregion 请æ±ä»»å¡å
¥åº |
| | | |
| | | #region åºä½åé
|
| | | |
| | | #region è·åè´§ä½ |
| | | object objLOCK = new object(); |
| | | /// <summary> |
| | | /// åååºä½åé
|
| | | /// åºä½åé
|
| | | /// </summary> |
| | | /// <param name="requestTask"></param> |
| | | /// <param name="locationInfos"></param> |
| | | /// <returns></returns> |
| | | public DtLocationInfo RequestLocation(string roadwayNo) |
| | | public DtLocationInfo RequestLocation(string roadwayNo, int carType) |
| | | { |
| | | lock (objLOCK) |
| | | { |
| | | try |
| | | { |
| | | List<DtLocationInfo> locations = new List<DtLocationInfo>(); |
| | | locations = _locationRepository.QueryData(x => x.RoadwayNo == roadwayNo && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1); //&& x.LocationType == 1 |
| | | if (carType == 1) |
| | | { |
| | | locations = _locationRepository.QueryData(x => x.RoadwayNo == roadwayNo && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1 && (x.LocationType == 1 || x.LocationType == 3)); //&& x.LocationType == 1 |
| | | } |
| | | else if (carType == 2) |
| | | { |
| | | locations = _locationRepository.QueryData(x => x.RoadwayNo == roadwayNo && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1 && (x.LocationType == 2 || x.LocationType == 3)); //&& x.LocationType == 1 |
| | | } |
| | | else if (carType == 3) |
| | | { |
| | | locations = _locationRepository.QueryData(x => x.RoadwayNo == roadwayNo && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1 && x.LocationType == 3); //&& x.LocationType == 1 |
| | | } |
| | | |
| | | var location = GetEmptyLocation(locations); |
| | | var location = GetEmptyLocation(locations, carType); |
| | | if (location == null) |
| | | { |
| | | throw new Exception("åºä½å·²æ»¡"); |
| | |
| | | } |
| | | |
| | | |
| | | private DtLocationInfo GetEmptyLocation(List<DtLocationInfo> dtLocationInfos) |
| | | private DtLocationInfo GetEmptyLocation(List<DtLocationInfo> dtLocationInfos, int carType) |
| | | { |
| | | var locationinfo = dtLocationInfos.Where(x => x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1).OrderBy(x => x.Column).ThenBy(x => x.Row).ThenBy(x => x.Layer).FirstOrDefault(); //.ThenByDescending(x => x.Depth) |
| | | DtLocationInfo locationinfo = new DtLocationInfo(); |
| | | if (carType == 1 || carType == 3) |
| | | { |
| | | locationinfo = dtLocationInfos.Where(x => x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1).OrderBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).FirstOrDefault(); |
| | | } |
| | | else if (carType == 2) |
| | | { |
| | | locationinfo = dtLocationInfos.Where(x => x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1).OrderBy(x => x.Layer).ThenByDescending(x => x.Column).ThenBy(x => x.Row).FirstOrDefault(); |
| | | } |
| | | //else if (carType == 3) |
| | | //{ |
| | | // locationinfo = dtLocationInfos.Where(x => x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == 1).OrderBy(x => x.Column).ThenBy(x => x.Row).ThenBy(x => x.Layer).FirstOrDefault(); |
| | | //} |
| | | |
| | | return locationinfo; |
| | | } |
| | | |
| | |
| | | #endregion è·åè´§ä½ |
| | | #endregion åºä½åé
|
| | | |
| | | public WebResponseContent confirmTask(int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var taskInfo = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (taskInfo == null) throw new Exception("æªç¥ä»»å¡"); |
| | | |
| | | if (taskInfo.TaskState != (int)TaskOutStatusEnum.OutFinish) throw new Exception("å½å任塿ªå®æ,ç¦æ¢ç¡®è®¤"); |
| | | |
| | | var taskHty = taskInfo.Adapt<Dt_Task_Hty>(); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.OperateType = (int)OperateTypeEnum.人工确认; |
| | | |
| | | BaseDal.DeleteData(taskInfo); |
| | | _task_HtyRepository.AddData(taskHty); |
| | | |
| | | content.OK("ç¡®è®¤å®æ"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error($"确认å¼å¸¸:{ex.Message}"); |
| | | } |
| | | |
| | | return content; |
| | | } |
| | | //public WebResponseContent |
| | | |
| | | } |