1.修改了补充大料箱顺序

2.修复了移库功能
3.新添加清空所有不在色粉库的色粉箱的功能
master
zhangxy 6 months ago
parent 0fdc58a03e
commit cd2458880a

@ -434,7 +434,8 @@ namespace SlnMesnac.WCS.WCS
return;
}
//暂时排序,后期结合小料正在生产的计划提前调度要配送机台的空托盘,或者可以根据实际位置调度最近的空料箱
startLocation = emptyLocations.First();
startLocation = emptyLocations.Last();//从12机台开始送
//startLocation = emptyLocations.First();//从头开始送
}
WcsBaseEquip? endEquip = sqlSugarClient.Queryable<WcsBaseEquip>().Where(it => it.EquipNo == "3SuppleEmptyPalletPoint").ToList().First();
@ -990,7 +991,7 @@ namespace SlnMesnac.WCS.WCS
#region 如果有补空箱任务,并且起点是要送料机台的库位,就不再生成移库任务
//目标机台的两个库位编号
List<string> locationCodes = AllWmsBaseLocationList.Where(x => x.MachineId == machineId).Select(x => x.LocationCode).ToList();
List<string> locationCodes = AllWmsBaseLocationList.Where(x => x.MachineId == machineId).Select(x => x.AgvPositionCode).ToList();
bool hasTask = sqlSugarClient.Queryable<WcsTask>().Any(x => x.TaskType == StaticTaskType.SupplyEmptyPalletTask && locationCodes.Contains(x.CurrPointNo));
if (hasTask)
{

@ -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<WmsBaseLocation>().Where(it => it.LocationCode == startCode).First();
WmsBaseLocation? endLocation = SqlSugarClient.Queryable<WmsBaseLocation>().Where(it => it.LocationCode == endCode).First();
WmsBaseLocation? startLocation = SqlSugarClient.Queryable<WmsBaseLocation>().Where(it => it.AgvPositionCode == startCode).First();
WmsBaseLocation? endLocation = SqlSugarClient.Queryable<WmsBaseLocation>().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<WcsTaskLog>(task);
wcsTaskLog.Id = id;

@ -30,5 +30,6 @@ IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource
Style="{StaticResource MaterialDesignOutlinedSecondaryDarkButton}" />
</StackPanel>
</Grid>
<Button x:Name="ClearTonerButton" Content= " 清空廊桥色粉箱&#x000A;(非特殊情况勿触)" Style="{StaticResource MaterialDesignOutlinedSecondaryDarkButton}" HorizontalAlignment="Left" Margin="1621,0,0,0" Grid.Row="1" VerticalAlignment="Center" Height="42" Width="162" RenderTransformOrigin="1.981,0.514" Click="ClearTonerButton_Click"/>
</Grid>
</UserControl>

@ -1,4 +1,7 @@
using SlnMesnac.WPF.ViewModel;
using Microsoft.Extensions.DependencyInjection;
using SlnMesnac.Model.domain;
using SlnMesnac.WPF.ViewModel;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@ -13,6 +16,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using static Dm.net.buffer.ByteArrayBuffer;
using static MaterialDesignThemes.Wpf.Theme;
namespace SlnMesnac.WPF.Page
@ -22,8 +26,10 @@ namespace SlnMesnac.WPF.Page
/// </summary>
public partial class TonerBoxingControl : UserControl
{
private ISqlSugarClient? sqlSugarClient;
public TonerBoxingControl()
{
sqlSugarClient = App.ServiceProvider.GetService<ISqlSugarClient>();
InitializeComponent();
this.DataContext = new TonerBoxingViewModel();
}
@ -32,5 +38,34 @@ namespace SlnMesnac.WPF.Page
{
this.InputBoxCodeTxt.Focus();
}
private void ClearTonerButton_Click(object sender, RoutedEventArgs e)
{
try
{
List<WmsPalletInfo> wmsPalletInfo = sqlSugarClient.Queryable<WmsPalletInfo>().InnerJoin<WcsBaseEquip>((x,y)=> x.TonerFlag == 1 && !y.ContainerCode.Contains(x.PalletInfoCode)).ToList();
if (wmsPalletInfo != null)
{
foreach (var item in wmsPalletInfo)
{
item.TonerFlag = 0;
}
int result = sqlSugarClient.Updateable(wmsPalletInfo).ExecuteCommand();
if (result > 0)
{
MessageBox.Show("操作成功!");
}
else
{
MessageBox.Show("操作失败!");
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message+ex.StackTrace);
}
}
}
}
Loading…
Cancel
Save