| | |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | for (int i = 0; i < task.Count; i++) |
| | | if (task.Count > 0) |
| | | { |
| | | Dt_LocationInfo location = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task[i].SourceAddress && x.RoadwayNo == task[i].Roadway); |
| | | if (location != null) |
| | | |
| | | for (int i = 0; i < task.Count; i++) |
| | | { |
| | | //(Dt_LocationInfo?, int?) result = _basicService.LocationInfoService.isDepth(location); |
| | | (Dt_LocationInfo?, int?) result = isDepth(location); |
| | | if (result.Item1 != null &&result.Item2 != LocationStatusEnum.Lock.ObjToInt() && result.Item2 != LocationStatusEnum.PalletLock.ObjToInt() && result.Item2 != LocationStatusEnum.Free.ObjToInt()) |
| | | Dt_LocationInfo location = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task[i].SourceAddress && x.RoadwayNo == task[i].Roadway); |
| | | if (location != null) |
| | | { |
| | | int sum = 0; |
| | | for (int j = 0; j < task.Count; j++) |
| | | //(Dt_LocationInfo?, int?) result = _basicService.LocationInfoService.isDepth(location); |
| | | (Dt_LocationInfo?, int?) result = isDepth(location); |
| | | if (result.Item1 != null && result.Item2 != LocationStatusEnum.Lock.ObjToInt() && result.Item2 != LocationStatusEnum.PalletLock.ObjToInt() && result.Item2 != LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | if (result.Item1.LocationCode == task[j].SourceAddress) |
| | | int sum = 0; |
| | | for (int j = 0; j < task.Count; j++) |
| | | { |
| | | sum++; |
| | | if (result.Item1.LocationCode == task[j].SourceAddress) |
| | | { |
| | | sum++; |
| | | } |
| | | } |
| | | if (sum == 0) |
| | | { |
| | | return content = RelocationTask(task[i]); |
| | | } |
| | | else |
| | | { |
| | | BaseDal.AddData(task[i]); |
| | | _basicService.LocationInfoService.UpdateLocationLock(location, task[i].TaskNum, StockChangeType.Outbound.ObjToInt(), true); |
| | | } |
| | | } |
| | | if (sum == 0) |
| | | { |
| | | return content = RelocationTask(task[i]); |
| | | } |
| | | else |
| | | { |
| | | BaseDal.AddData(task[i]); |
| | | _basicService.LocationInfoService.UpdateLocationLock(location, task[i].TaskNum, StockChangeType.Outbound.ObjToInt(), true); |
| | | } |
| | | } |
| | | else if (result.Item1 == null && result.Item2 == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | BaseDal.AddData(task[i]); |
| | | location.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateData(location); |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | else if (result.Item1 != null && result.Item2 == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | BaseDal.AddData(task[i]); |
| | | location.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateData(location); |
| | | _basicService.LocationInfoService.UpdateLocationLock(location, task[i].TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | else if (result.Item1 != null && (result.Item2 == LocationStatusEnum.Lock.ObjToInt() || result.Item2 == LocationStatusEnum.PalletLock.ObjToInt())) |
| | | { |
| | | Dt_Task TaskInfo = BaseDal.QueryFirst(x => x.SourceAddress == result.Item1.LocationCode); |
| | | if (TaskInfo == null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error("è´§ä½è¢«éå®ä¸å¯åºåº"); |
| | | } |
| | | else |
| | | else if (result.Item1 == null && result.Item2 == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | BaseDal.AddData(task[i]); |
| | | location.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateData(location); |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | else if (result.Item1 != null && result.Item2 == LocationStatusEnum.Free.ObjToInt()) |
| | | { |
| | | BaseDal.AddData(task[i]); |
| | | location.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateData(location); |
| | | _basicService.LocationInfoService.UpdateLocationLock(location, task[i].TaskNum, StockChangeType.Outbound.ObjToInt(), false); |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | else if (result.Item1 != null && (result.Item2 == LocationStatusEnum.Lock.ObjToInt() || result.Item2 == LocationStatusEnum.PalletLock.ObjToInt())) |
| | | { |
| | | Dt_Task TaskInfo = BaseDal.QueryFirst(x => x.SourceAddress == result.Item1.LocationCode); |
| | | if (TaskInfo == null) |
| | | { |
| | | return content = WebResponseContent.Instance.Error("è´§ä½è¢«éå®ä¸å¯åºåº"); |
| | | } |
| | | else |
| | | { |
| | | BaseDal.AddData(task[i]); |
| | | location.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateData(location); |
| | | content = WebResponseContent.Instance.OK(); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error("ä»»å¡å¼å¸¸"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.OK("ä»»å¡å¼å¸¸"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return content = WebResponseContent.Instance.Error("没æåºåçæä»»å¡"); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content; |
| | | } |
| | | catch(Exception ex) |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content = WebResponseContent.Instance.Error(ex.Message); |
| | |
| | | if (result.Item1 != null && result.Item2 != null) |
| | | { |
| | | _basicService.LocationInfoService.RelocationLock(Result.Item1, result.Item2, result.Item1.TaskNum); |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | locationInfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt(); |
| | | _basicService.LocationInfoService.UpdateData(locationInfo); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Relocation.ObjToInt(), "", task.TaskNum); |
| | | return content = WebResponseContent.Instance.OK(); |