From cd2458880a405a4649f2f579c03b66da7d8b68af Mon Sep 17 00:00:00 2001 From: zhangxy Date: Fri, 4 Jul 2025 16:38:43 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E4=BA=86=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E5=A4=A7=E6=96=99=E7=AE=B1=E9=A1=BA=E5=BA=8F=202.=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BA=86=E7=A7=BB=E5=BA=93=E5=8A=9F=E8=83=BD=203.?= =?UTF-8?q?=E6=96=B0=E6=B7=BB=E5=8A=A0=E6=B8=85=E7=A9=BA=E6=89=80=E6=9C=89?= =?UTF-8?q?=E4=B8=8D=E5=9C=A8=E8=89=B2=E7=B2=89=E5=BA=93=E7=9A=84=E8=89=B2?= =?UTF-8?q?=E7=B2=89=E7=AE=B1=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SlnMesnac.WCS/WCS/CreateTaskByRecord.cs | 5 ++- SlnMesnac.WPF/Page/CreateMoveWindow.xaml.cs | 34 +++++++++++------ SlnMesnac.WPF/Page/TonerBoxingControl.xaml | 1 + SlnMesnac.WPF/Page/TonerBoxingControl.xaml.cs | 37 ++++++++++++++++++- 4 files changed, 62 insertions(+), 15 deletions(-) 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}" /> +