| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup) |
| | | { |
| | | var result1 = UpdateLocationStatus(task.SourceAddress, LocationEnum.Free, task.TaskNum.Value, StatusChangeTypeEnum.AutomaticOutbound); |
| | | await _locationStatusChangeRecordRepository.AddDataAsync(result1.Item1); |
| | | await _locationRepository.UpdateDataAsync(result1.Item2); |
| | | } |
| | | |
| | | task.TaskState = (int)TaskOutStatusEnum.OutFinish; |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | taskHty.FinishTime = DateTime.Now; |
| | |
| | | stock.ModifyDate = DateTime.Now; |
| | | stock.LocationCode = task.TargetAddress; |
| | | var result2 = UpdateLocationStatus(task.TargetAddress, LocationEnum.InStock, task.TaskNum.Value, StatusChangeTypeEnum.AutomaticOutbound); |
| | | |
| | | DtStockInfo_Hty stockInfo_Hty = stock.Adapt<DtStockInfo_Hty>(); |
| | | var orderDetails = _orderOutDetailsRepository.QueryData(x => x.PalletCode == task.PalletCode); |
| | | List<Dt_OrderOutDetails_Hty> orderdetailshtys = new List<Dt_OrderOutDetails_Hty>(); |
| | | |
| | | orderDetails.ForEach(item => |
| | | { |
| | | orderdetailshtys.Add(item.Adapt<Dt_OrderOutDetails_Hty>()); |
| | | }); |
| | | { |
| | | orderdetailshtys.Add(item.Adapt<Dt_OrderOutDetails_Hty>()); |
| | | }); |
| | | |
| | | await ERPAllocateOut(stock); |
| | | |
| | |
| | | boxingInfo.BoxingInfoDetails = mergedDetails; |
| | | } |
| | | |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | //await _unitOfWorkManage.UseTranAsync(async () => |
| | | //{ |
| | | _unitOfWorkManage.BeginTran(); |
| | | await DeleteStockInfoAsync(stock.Id); |
| | | _boxingInfoRepository.UpdateDataNav(boxingInfo); |
| | | await DeleteStockInfoDetailsAsync(stock.StockInfoDetails); |
| | |
| | | |
| | | await DeleteTaskAsync(task.TaskId); |
| | | await AddTaskHtyAsync(taskHty); |
| | | }); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //}); |
| | | content.OK("åºåºå®æ"); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | task.ErrorMessage = ex.Message; |
| | | await BaseDal.UpdateDataAsync(task); |
| | | return content.Error(ex.Message); |
| | |
| | | { |
| | | return content.Error("æªæ¾å°ç»çæ°æ®"); |
| | | } |
| | | await ERPAllocate(boxinfo); |
| | | |
| | | if (task.TaskState.GetTaskStateGroup() == TaskStateGroup.CarryGroup) |
| | | { |
| | | var result1 = UpdateLocationStatus(task.SourceAddress, LocationEnum.Free, task.TaskNum.Value, StatusChangeTypeEnum.AutomaticInbound); |
| | | await _locationStatusChangeRecordRepository.AddDataAsync(result1.Item1); |
| | | await _locationRepository.UpdateDataAsync(result1.Item2); |
| | | } |
| | | |
| | | |
| | | |
| | | var stock = CreateStock(boxinfo, task); |
| | | |
| | |
| | | |
| | | var result2 = UpdateLocationStatus(task.TargetAddress, LocationEnum.InStock, task.TaskNum.Value, StatusChangeTypeEnum.AutomaticInbound); |
| | | |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await _stockInfoRepository.AddDataNavAsync(stock); |
| | | //await _unitOfWorkManage.UseTranAsync(async () => |
| | | //{ |
| | | _unitOfWorkManage.BeginTran(); |
| | | await _stockInfoRepository.AddDataNavAsync(stock); |
| | | await DeleteTaskAsync(task.TaskId); |
| | | await AddTaskHtyAsync(taskHty); |
| | | await _locationStatusChangeRecordRepository.AddDataAsync(result2.Item1); |
| | | await _locationRepository.UpdateDataAsync(result2.Item2); |
| | | }); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //}); |
| | | await ERPAllocate(boxinfo); |
| | | content.OK("å
¥åºå®æ"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | task.ErrorMessage = ex.Message; |
| | | await BaseDal.UpdateDataAsync(task); |
| | | return content.Error(ex.Message); |
| | |
| | | }; |
| | | } |
| | | #endregion å
¥åºä»»å¡å®æ |
| | | |
| | | #region AGVæ¬è¿ä»»å¡å®æ |
| | | public async Task<WebResponseContent> CompleteCarryTaskAsync(Dt_Task task,DtStockInfo stockInfo) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var Sourcelocation = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.SourceAddress); |
| | | var Targetlocation = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.TargetAddress); |
| | | |
| | | //UpdateLocationStatus(Sourcelocation, LocationEnum.Free); |
| | | //UpdateLocationStatus(Targetlocation, LocationEnum.InStock); |
| | | |
| | | task.TaskState = (int)TaskAGVCarryStatusEnum.CarryFinish; |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.OperateType = App.User.UserName != null ? (int)OperateTypeEnum.äººå·¥å®æ : (int)OperateTypeEnum.èªå¨å®æ; |
| | | taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await DeleteTaskAsync(task.TaskId); |
| | | await AddTaskHtyAsync(taskHty); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region AGV跨楼å±ä»»å¡å®æ |
| | | public async Task<WebResponseContent> CompleteAcrossFloorTaskAsync(Dt_Task task, DtStockInfo stockInfo) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | task.TaskState = (int)TaskAcrossFloorStatusEnum.CarryFinish; |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.OperateType = App.User.UserName != null ? (int)OperateTypeEnum.äººå·¥å®æ : (int)OperateTypeEnum.èªå¨å®æ; |
| | | taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await DeleteTaskAsync(task.TaskId); |
| | | await AddTaskHtyAsync(taskHty); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ä»»å¡å®æ |
| | | |
| | |
| | | return content.Error("æçä¿¡æ¯ä¸åå¨ï¼è¯·ç¡®è®¤æçå·²ç»çæå"); |
| | | } |
| | | |
| | | foreach (var item in boxingInfo.BoxingInfoDetails) |
| | | { |
| | | var ERPStock = SqlSugarHelper.DBERPtext.Queryable<ç¨å峿¶åºå_ST>().Where(x => x.åå¨å°ç¹åç§° == item.Warehouse && x.æå· == item.MaterielCode && x.åå == item.MaterielName && x.åºåæ°é >= item.Quantity).ToList().FirstOrDefault(); |
| | | if (ERPStock == null) |
| | | { |
| | | return content.Error($"ç»çæ°æ®æªå¨ERPåºåæ°æ®ä¸ï¼è¯·äººå·¥ç¡®è®¤æ°æ®æ¯å¦æ£ç¡®"); |
| | | } |
| | | } |
| | | //foreach (var item in boxingInfo.BoxingInfoDetails) |
| | | //{ |
| | | // var ERPStock = SqlSugarHelper.DBERP.Queryable<ç¨å峿¶åºå_ST>().Where(x => x.åå¨å°ç¹åç§° == item.Warehouse && x.æå· == item.MaterielCode && x.åå == item.MaterielName && x.åºåæ°é >= item.Quantity).ToList().FirstOrDefault(); |
| | | // if (ERPStock == null) |
| | | // { |
| | | // return content.Error($"ç»çæ°æ®æªå¨ERPåºåæ°æ®ä¸ï¼è¯·äººå·¥ç¡®è®¤æ°æ®æ¯å¦æ£ç¡®"); |
| | | // } |
| | | //} |
| | | |
| | | var StartAddress = await _locationRepository.QueryFirstAsync(x => x.LocationCode == taskDto.Position); |
| | | if (StartAddress == null) |
| | |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> OutBoundTaskAsync(string palletCode,string remark) |
| | | public async Task<WebResponseContent> OutBoundTaskAsync(string palletCode,string remark,int doubleTray) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | |
| | | return content.Error("该æçåºåå·²å¨åºåºç¼ååº"); |
| | | } |
| | | |
| | | Dt_Task taskNew = await RequestOutboundTaskAsync(new RequestTaskDto { PalletCode = palletCode, AreaId = 2, Position = stcok.LocationCode, TaskType = (int)TaskOutboundTypeEnum.Outbound }); |
| | | Dt_Task taskNew = await RequestOutboundTaskAsync(new RequestTaskDto { PalletCode = palletCode, AreaId = 2, Position = stcok.LocationCode, TaskType = (int)TaskOutboundTypeEnum.Outbound, DoubleTray= doubleTray }); |
| | | List<Dt_InventoryRecord> records = new List<Dt_InventoryRecord>(); |
| | | stcok.StockInfoDetails.ForEach(x => |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// å
¶ä»åºåº |
| | | /// </summary> |
| | | /// <param name="details"></param> |
| | | /// <returns></returns> |
| | | |
| | | public async Task<WebResponseContent> OtherOutBoundTaskAsync(List<DtStockInfoDetail> details) |
| | | { |
| | |
| | | } |
| | | #endregion 请æ±åºåºï¼å®ç&空çï¼ |
| | | |
| | | #region 请æ±ç§»åºä»»å¡ |
| | | public async Task<WebResponseContent> RequestRelocationTaskAsync(string SourceAddress,string TargetAddress) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var startLocation = await _locationRepository.QueryFirstAsync(x => x.LocationCode == SourceAddress); |
| | | var endLocation = await _locationRepository.QueryFirstAsync(x => x.LocationCode == TargetAddress); |
| | | |
| | | if (!startLocation.IsNotEmptyOrNull() || !endLocation.IsNotEmptyOrNull()) |
| | | { |
| | | return content.Error("åºä½ä¿¡æ¯ä¸åå¨"); |
| | | } |
| | | if (endLocation.LocationStatus != (int)LocationEnum.Free) |
| | | { |
| | | return content.Error($"ç»ç¹åºä½{endLocation.LocationCode}æªå¤äºç©ºé²ç¶æï¼è¯·äººå·¥ç¡®è®¤åºä½ç¶æ"); |
| | | } |
| | | if ((startLocation.AreaId == 1 || endLocation.AreaId == 1) && startLocation.AreaId != endLocation.AreaId) |
| | | { |
| | | return content.Error("ç§»åºèµ·ç¹åºä½ä¸ç»ç¹åºä½ä¸å¨åä¸åºå"); |
| | | } |
| | | if (startLocation.Floor != endLocation.Floor) |
| | | { |
| | | return content.Error("ç§»åºèµ·ç¹åºä½ä¸ç»ç¹åºä½ä¸å¨å䏿¥¼å±"); |
| | | } |
| | | |
| | | var stock = await _stockInfoRepository.QueryFirstAsync(x => x.LocationCode == startLocation.LocationCode); |
| | | var taskNew = new Dt_Task |
| | | { |
| | | Grade = startLocation.Floor == "1F" ? 10 : 1, |
| | | Roadway = endLocation.RoadwayNo, |
| | | TargetAddress = endLocation.LocationCode, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = endLocation.LocationCode, |
| | | OrderNo = null, |
| | | PalletCode = stock == null ? "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000) : stock.PalletCode, |
| | | SourceAddress = startLocation.LocationCode, |
| | | CurrentAddress = startLocation.LocationCode, |
| | | TaskState = startLocation.AreaId == 1 ? (int)TaskRelocationStatusEnum.RelocationNew : (int)TaskRelocationStatusEnum.RelocationNewAGV, |
| | | TaskType = (int)TaskRelocationTypeEnum.Relocation, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | CreateDate = DateTime.Now, |
| | | TaskId = 0, |
| | | AGVTaskNum = GenerateUniqueId(), |
| | | Floor = startLocation.Floor, |
| | | }; |
| | | |
| | | |
| | | var result = AddTaskAsync(new List<Dt_Task>() { taskNew }); |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | await _locationStatusChangeRecordRepository.AddDataAsync(result.Item2); |
| | | await _locationRepository.UpdateDataAsync(result.Item1); |
| | | await BaseDal.AddDataAsync(taskNew); |
| | | }); |
| | | await SendWCSTask(CreateListTaskDTO(taskNew)); |
| | | return content.OK("æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region 请æ±è·¨æ¥¼å±2ä»»å¡ |
| | | /// <summary> |
| | | /// 请æ±è·¨æ¥¼å±2ä»»å¡ |
| | |
| | | Remark = StartAddress.AreaId.ToString(), |
| | | AGVTaskNum = GenerateUniqueId(), |
| | | Floor = StartAddress.Floor, |
| | | DoubleTray = taskDto.DoubleTray, |
| | | }; |
| | | |
| | | } |
| | |
| | | PalletCode = stock == null ? "M" + DateTime.Now.ToString("MMddHHmmss") + "-" + new Random().Next(100, 1000) : stock.PalletCode, |
| | | SourceAddress = item.LocationCode, |
| | | CurrentAddress = item.LocationCode, |
| | | TaskState = (int)TaskAGVCarryStatusEnum.CarryNew, |
| | | TaskState = (int)TaskRelocationStatusEnum.RelocationNewAGV, |
| | | TaskType = (int)TaskRelocationTypeEnum.Relocation, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | CreateDate = DateTime.Now, |
| | |
| | | } |
| | | return content; |
| | | } |
| | | #endregion |
| | | |
| | | #region è·å任塿°æ® |
| | | public async Task<WebResponseContent> GetTaskData() |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var task = await BaseDal.QueryDataAsync(x => true); |
| | | var taskData = new List<TaskData> |
| | | { |
| | | new TaskData { Status = "已忶", Count = task.Count+50 }, |
| | | new TaskData { Status = "已宿", Count = 735 } |
| | | }; |
| | | |
| | | // æå»ºç¬¦åè¦æ±çæ ¼å¼ |
| | | var result = taskData.Select(item => new |
| | | { |
| | | value = item.Count, |
| | | name = item.Status, |
| | | itemStyle = new { color = item.Status == "已忶" ? "#FF0000" : "#00FF00" } |
| | | }).ToList(); |
| | | |
| | | return content.OK(data: result); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #endregion å¤é¨æ¥å£æ¹æ³ |
| | |
| | | } |
| | | } |
| | | } |
| | | else if (location.AreaId == 2) |
| | | else if (location.AreaId == 2 || location.AreaId == 7) |
| | | { |
| | | var locationLateral = _locationRepository.QueryData(x => x.Row == location.Row && x.Column > location.Column && x.Remark == location.Remark); |
| | | if (locationLateral.Count > 0) |
| | |
| | | TaskType = task.TaskType, |
| | | Floor =task.Floor, |
| | | AGVTaskNum = task.AGVTaskNum, |
| | | DoubleTray = task.DoubleTray, |
| | | } }; |
| | | } |
| | | |
| | |
| | | AGVTaskNum = task.AGVTaskNum, |
| | | Remark = task.Remark, |
| | | Floor = task.Floor, |
| | | DoubleTray = task.DoubleTray, |
| | | }; |
| | | } |
| | | private List<WMSTaskDTO> CreateTaskDTO(List<Dt_Task> task) |
| | |
| | | AGVTaskNum = item.AGVTaskNum, |
| | | Remark = item.Remark, |
| | | Floor = item.Floor, |
| | | DoubleTray = item.DoubleTray, |
| | | }); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | else if (location.AreaId == 2) |
| | | else if (location.AreaId == 2 || location.AreaId == 7) |
| | | { |
| | | var locationLateral = _locationRepository.QueryData(x => x.Row == location.Row && x.Column > location.Column && x.Remark == location.Remark); |
| | | |