diff --git a/SlnMesnac.WCS/WCS/CreateTaskByRecord.cs b/SlnMesnac.WCS/WCS/CreateTaskByRecord.cs index d3105bd..37de03d 100644 --- a/SlnMesnac.WCS/WCS/CreateTaskByRecord.cs +++ b/SlnMesnac.WCS/WCS/CreateTaskByRecord.cs @@ -1001,13 +1001,23 @@ namespace SlnMesnac.WCS.WCS #endregion 如果有补空箱任务,并且起点是要送料机台的库位,就不再生成移库任务 //需要生成从该库位到其他机台的移库任务,找寻移库终点库位 - moveEndLocation = AllWmsBaseLocationList.FirstOrDefault(x => x.LocationId != moveStartLocation.LocationId && x.LocationStatus == 0 && string.IsNullOrEmpty(x.ContainerCode)); + moveEndLocation = AllWmsBaseLocationList.LastOrDefault(x => x.LocationId != moveStartLocation.LocationId && x.LocationStatus == 0 && string.IsNullOrEmpty(x.ContainerCode) && x.LocationId<=22); if (moveEndLocation == null) { // 没有可以移库的库位,请等待 return null; // todo:推送预警 } + + #region 如果有送料任务,并且终点是要送料机台的库位,就不再生成移库任务 + bool hasSendTask = sqlSugarClient.Queryable().Any(it => it.TaskType == StaticTaskType.TransferMaterialBoxTask && moveEndLocation.Equals(it.EndPointNo)); + if (hasSendTask) + { + //_logger.Info("Agv已有3#车间补四宫格空箱任务"); + return null; + } + #endregion 如果有送料任务,并且终点是要送料机台的库位,就不再生成移库任务 + else //生成移库任务 { //二次确认寻找可用agv,避免在这期间agv被其他线程占用 diff --git a/SlnMesnac.WPF/Page/CreateMoveWindow.xaml.cs b/SlnMesnac.WPF/Page/CreateMoveWindow.xaml.cs index 254c61f..33e9eb4 100644 --- a/SlnMesnac.WPF/Page/CreateMoveWindow.xaml.cs +++ b/SlnMesnac.WPF/Page/CreateMoveWindow.xaml.cs @@ -39,10 +39,12 @@ namespace SlnMesnac.WPF.Page // 加载地点选项(3001-3024) private void LoadLocations() { - for (int i = 3001; i <= 3024; i++) + for (int i = 301; i <= 312; i++) { - this.StartComboBox.Items.Add(i.ToString()); - EndComboBox.Items.Add(i.ToString()); + this.StartComboBox.Items.Add(i.ToString()+"A"); + this.StartComboBox.Items.Add(i.ToString() + "B"); + EndComboBox.Items.Add(i.ToString()+"A"); + EndComboBox.Items.Add(i.ToString() + "B"); } StartComboBox.Items.Add("异常库位3066"); EndComboBox.Items.Add("异常库位3066"); @@ -80,9 +82,15 @@ namespace SlnMesnac.WPF.Page endCode = "3066"; } - WmsBaseLocation? startLocation = SqlSugarClient.Queryable().Where(it => it.AgvPositionCode == startCode).First(); - WmsBaseLocation? endLocation = SqlSugarClient.Queryable().Where(it => it.AgvPositionCode == endCode).First(); - + WmsBaseLocation? startLocation = SqlSugarClient.Queryable().Where(it => it.LocationCode == startCode).First(); + WmsBaseLocation? endLocation = SqlSugarClient.Queryable().Where(it => it.LocationCode == endCode).First(); + WmsPalletInfo? wmsPalletInfo = SqlSugarClient.Queryable().InnerJoin((x,y) => x.Amount == 0 && y.LocationCode == startCode).First(); + + if (wmsPalletInfo == null) { + MessageBox.Show("起点库位托盘未清空,无法移库!"); + return; + } + if (startLocation.LocationStatus != 0) { MessageBox.Show("起点库位不可用,状态被锁定!");