diff --git a/SlnMesnac.WCS/WCS/CreateTaskByRecord.cs b/SlnMesnac.WCS/WCS/CreateTaskByRecord.cs index 2877488..d3105bd 100644 --- a/SlnMesnac.WCS/WCS/CreateTaskByRecord.cs +++ b/SlnMesnac.WCS/WCS/CreateTaskByRecord.cs @@ -434,7 +434,8 @@ namespace SlnMesnac.WCS.WCS return; } //暂时排序,后期结合小料正在生产的计划提前调度要配送机台的空托盘,或者可以根据实际位置调度最近的空料箱 - startLocation = emptyLocations.First(); + startLocation = emptyLocations.Last();//从12机台开始送 + //startLocation = emptyLocations.First();//从头开始送 } WcsBaseEquip? endEquip = sqlSugarClient.Queryable().Where(it => it.EquipNo == "3SuppleEmptyPalletPoint").ToList().First(); @@ -990,7 +991,7 @@ namespace SlnMesnac.WCS.WCS #region 如果有补空箱任务,并且起点是要送料机台的库位,就不再生成移库任务 //目标机台的两个库位编号 - List locationCodes = AllWmsBaseLocationList.Where(x => x.MachineId == machineId).Select(x => x.LocationCode).ToList(); + List locationCodes = AllWmsBaseLocationList.Where(x => x.MachineId == machineId).Select(x => x.AgvPositionCode).ToList(); bool hasTask = sqlSugarClient.Queryable().Any(x => x.TaskType == StaticTaskType.SupplyEmptyPalletTask && locationCodes.Contains(x.CurrPointNo)); if (hasTask) { diff --git a/SlnMesnac.WPF/Page/CreateMoveWindow.xaml.cs b/SlnMesnac.WPF/Page/CreateMoveWindow.xaml.cs index 0505775..254c61f 100644 --- a/SlnMesnac.WPF/Page/CreateMoveWindow.xaml.cs +++ b/SlnMesnac.WPF/Page/CreateMoveWindow.xaml.cs @@ -54,6 +54,12 @@ namespace SlnMesnac.WPF.Page string startCode = StartComboBox.SelectedItem?.ToString(); string endCode = EndComboBox.SelectedItem?.ToString(); + if(SqlSugarClient == null) + { + MessageBox.Show("SqlSugarClient为空!"); + return; + } + if (string.IsNullOrEmpty(startCode) || string.IsNullOrEmpty(endCode)) { MessageBox.Show("请选择起点和终点!"); @@ -74,41 +80,45 @@ namespace SlnMesnac.WPF.Page endCode = "3066"; } - WmsBaseLocation? startLocation = SqlSugarClient.Queryable().Where(it => it.LocationCode == startCode).First(); - WmsBaseLocation? endLocation = SqlSugarClient.Queryable().Where(it => it.LocationCode == endCode).First(); + WmsBaseLocation? startLocation = SqlSugarClient.Queryable().Where(it => it.AgvPositionCode == startCode).First(); + WmsBaseLocation? endLocation = SqlSugarClient.Queryable().Where(it => it.AgvPositionCode == endCode).First(); + if (startLocation.LocationStatus != 0) { MessageBox.Show("起点库位不可用,状态被锁定!"); return; } + if (endLocation.LocationStatus != 0) { MessageBox.Show("终点库位不可用,状态被锁定!"); return; } + if (string.IsNullOrEmpty(startLocation.ContainerCode)) { MessageBox.Show("起点库位无托盘,请检查库存!"); return; } + if (!string.IsNullOrEmpty(endLocation.ContainerCode)) { MessageBox.Show($"终点库位已有托盘:{endLocation.ContainerCode},禁止移库,请检查库存!"); return; } - WcsTask task = new WcsTask(); - task.TaskType = StaticTaskType.MoveLocationTask; - task.CurrPointNo = startLocation.AgvPositionCode; - task.EndPointNo = endLocation.AgvPositionCode; - task.TaskStatus = 0; - task.CreatedTime = DateTime.Now; - task.CreatedBy = "wcs"; - task.TaskName = "1-12机台移库任务"; - task.PalletInfoCode = startLocation.ContainerCode; - SqlSugarClient.AsTenant().BeginTran(); try { + WcsTask task = new WcsTask(); + task.TaskType = StaticTaskType.MoveLocationTask; + task.CurrPointNo = startLocation.AgvPositionCode; + task.EndPointNo = endLocation.AgvPositionCode; + task.TaskStatus = 0; + task.CreatedTime = DateTime.Now; + task.CreatedBy = "wcs"; + task.TaskName = "1-12机台移库任务"; + task.PalletInfoCode = startLocation.ContainerCode; + SqlSugarClient.AsTenant().BeginTran(); int id = SqlSugarClient.Insertable(task).ExecuteReturnIdentity(); WcsTaskLog wcsTaskLog = CoreMapper.Map(task); wcsTaskLog.Id = id; diff --git a/SlnMesnac.WPF/Page/TonerBoxingControl.xaml b/SlnMesnac.WPF/Page/TonerBoxingControl.xaml index aff76e7..13845f1 100644 --- a/SlnMesnac.WPF/Page/TonerBoxingControl.xaml +++ b/SlnMesnac.WPF/Page/TonerBoxingControl.xaml @@ -30,5 +30,6 @@ IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource Style="{StaticResource MaterialDesignOutlinedSecondaryDarkButton}" /> +