add-实时库位界面添加中转区展示

dev
liuwf 2 weeks ago
parent 0d7ebe7a8f
commit d6f2f64a7c

@ -0,0 +1,152 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;
namespace SlnMesnac.Model.domain
{
/// <summary>
/// 设备信息
/// </summary>
[SugarTable("wcs_base_equip"), TenantAttribute("mes")]
public class BaseEquipment
{
/// <summary>
/// 主键
/// </summary>
[SugarColumn(ColumnName = "objid", IsPrimaryKey = true)]
public long ObjId { get; set; }
/// <summary>
/// 所属仓库
/// </summary>
[SugarColumn(ColumnName = "warehouse_id")]
public long? WarehouseId { get; set; }
/// <summary>
/// 设备编号
/// </summary>
[SugarColumn(ColumnName = "equip_no")]
public string EquipNo { get; set; }
/// <summary>
/// 设备名称
/// </summary>
[SugarColumn(ColumnName = "equip_name")]
public string EquipName { get; set; }
/// <summary>
/// 设备类型 1输送线 2 提升机 3 分拣输送线
/// </summary>
[SugarColumn(ColumnName = "equip_type")]
public int? EquipType { get; set; }
/// <summary>
/// IP地址
/// </summary>
[SugarColumn(ColumnName = "server_ip")]
public string ServerIp { get; set; }
/// <summary>
/// 端口
/// </summary>
[SugarColumn(ColumnName = "server_port")]
public int? ServerPort { get; set; }
/// <summary>
/// 设备状态,字典表
/// </summary>
[SugarColumn(ColumnName = "equip_status")]
public int? EquipStatus { get; set; }
/// <summary>
/// 所属楼层
/// </summary>
[SugarColumn(ColumnName = "floor_no")]
public int? FloorNo { get; set; }
/// <summary>
/// 是否可用 0:不可用 1:可用
/// </summary>
[SugarColumn(ColumnName = "use_flag")]
public int UseFlag { get; set; } = 1;
/// <summary>
/// 创建者
/// </summary>
[SugarColumn(ColumnName = "create_by")]
public string CreateBy { get; set; } = "SYS";
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnName = "create_time")]
public DateTime? CreateTime { get; set; } = DateTime.Now;
/// <summary>
/// 更新者
/// </summary>
[SugarColumn(ColumnName = "update_by")]
public string UpdateBy { get; set; } = "SYS";
/// <summary>
/// 更新时间
/// </summary>
[SugarColumn(ColumnName = "update_time")]
public DateTime? UpdateTime { get; set; } = DateTime.Now;
/// <summary>
/// 人工任务起始地
/// </summary>
[SugarColumn(ColumnName = "ud1")]
public string Ud1 { get; set; }
/// <summary>
/// 人工任务终止地
/// </summary>
[SugarColumn(ColumnName = "ud2")]
public string Ud2 { get; set; }
/// <summary>
/// 备用字段3
/// </summary>
[SugarColumn(ColumnName = "ud3")]
public string Ud3 { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnName = "remark")]
public string Remark { get; set; }
/// <summary>
/// Agv地址
/// </summary>
[SugarColumn(ColumnName = "agv_position_code")]
public string AgvPositionCode { get; set; }
/// <summary>
///
/// </summary>
[SugarColumn(ColumnName = "empty_count")]
public int? EmptyCount { get; set; }
/// <summary>
/// RFID
/// </summary>
[SugarColumn(ColumnName = "container_no")]
public string ContainerNo { get; set; }
/// <summary>
///
/// </summary>
[SugarColumn(ColumnName = "endStationCode")]
public string EndStationCode { get; set; }
/// <summary>
///
/// </summary>
[SugarColumn(ColumnName = "is_out")]
public int IsOut { get; set; } = 0;
}
}

@ -34,10 +34,10 @@ namespace SlnMesnac.WPF.Page
"二楼仓库","三楼仓库","五楼仓库" "二楼仓库","三楼仓库","五楼仓库"
}; };
WareHouseId.SelectedItem = "三楼仓库"; WareHouseId.SelectedItem = "三楼仓库";
Refresh(); loadLocations(GetLocations());
} }
private void Refresh() private List<WmsBaseLocation> GetLocations()
{ {
try try
{ {
@ -59,26 +59,27 @@ namespace SlnMesnac.WPF.Page
warehouseId.Add(531); warehouseId.Add(531);
} }
List<WmsBaseLocation> list = sqlSugarClient.AsTenant().GetConnection("mes").Queryable<WmsBaseLocation>().Where(t => warehouseId.Contains(t.WarehouseId)).ToList(); List<WmsBaseLocation> list = sqlSugarClient.AsTenant().GetConnection("mes").Queryable<WmsBaseLocation>().Where(t => warehouseId.Contains(t.WarehouseId)).ToList();
if (list != null && list.Count > 0)
{ return list;
loadLocations(list);
}
}catch(Exception ex) }catch(Exception ex)
{ {
Console.WriteLine(ex.Message); Console.WriteLine(ex.Message);
return null;
} }
} }
private void Refulsh_Click(object sender, RoutedEventArgs e) private void Refulsh_Click(object sender, RoutedEventArgs e)
{ {
Refresh(); loadLocations(GetLocations());
} }
private void WarehouseChanged(object sender, SelectionChangedEventArgs e) private void WarehouseChanged(object sender, SelectionChangedEventArgs e)
{ {
Refresh(); loadLocations(GetLocations());
} }
@ -91,6 +92,21 @@ namespace SlnMesnac.WPF.Page
return; return;
} }
List<BaseEquipment> baseEquips = new List<BaseEquipment>();
if (wmsBaseLocations.First().WarehouseFloor == 2)
{
baseEquips = sqlSugarClient.AsTenant().GetConnection("mes").Queryable<BaseEquipment>().Where(t => t.EquipType==20).OrderBy(t => t.AgvPositionCode).ToList();
}
else if (wmsBaseLocations.First().WarehouseFloor == 3)
{
baseEquips = sqlSugarClient.AsTenant().GetConnection("mes").Queryable<BaseEquipment>().Where(t => t.EquipType == 15).OrderBy(t => t.AgvPositionCode).ToList();
}
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
this.LocaltionGrid.Children.Clear(); this.LocaltionGrid.Children.Clear();
@ -98,6 +114,7 @@ namespace SlnMesnac.WPF.Page
this.LocaltionGrid.ColumnDefinitions.Clear(); this.LocaltionGrid.ColumnDefinitions.Clear();
List<long> list = wmsBaseLocations.Select(t => t.WarehouseId).Distinct().ToList(); List<long> list = wmsBaseLocations.Select(t => t.WarehouseId).Distinct().ToList();
int? column = 0; int? column = 0;
for (var i = 0; i < list.Count; i++) for (var i = 0; i < list.Count; i++)
{ {
this.LocaltionGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1.0, GridUnitType.Star) }); this.LocaltionGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1.0, GridUnitType.Star) });
@ -105,7 +122,11 @@ namespace SlnMesnac.WPF.Page
List<WmsBaseLocation> locations = wmsBaseLocations.Where(t => t.WarehouseId == list[i]).ToList(); List<WmsBaseLocation> locations = wmsBaseLocations.Where(t => t.WarehouseId == list[i]).ToList();
var row = locations.Max(t => t.LocRow); var row = locations.Max(t => t.LocRow);
column = locations.Max(t => t.LocColumn); column = locations.Max(t => t.LocColumn);
if (list[0] == 231 && i == 0)
{
grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1.0, GridUnitType.Star) });
grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1.0, GridUnitType.Star) });
}
for (var j = 0; j < row; j++) for (var j = 0; j < row; j++)
{ {
grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1.0, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1.0, GridUnitType.Star) });
@ -126,9 +147,53 @@ namespace SlnMesnac.WPF.Page
Tag = location.LocationId, Tag = location.LocationId,
Background = string.IsNullOrEmpty(location.ContainerCode) ? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4789AE")) : new SolidColorBrush((Color)ColorConverter.ConvertFromString("#75F76D")) Background = string.IsNullOrEmpty(location.ContainerCode) ? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4789AE")) : new SolidColorBrush((Color)ColorConverter.ConvertFromString("#75F76D"))
}; };
// button.Click += OnLocationButton_Click;
Grid.SetColumn(button, location.LocColumn.Value - 1); Grid.SetColumn(button, location.LocColumn.Value - 1);
if (list[0] == 231)
{
Grid.SetRow(button, -(location.LocRow.Value - row.Value) + 2);
for (var k = 0; k < 8; k++)
{
var button2 = new Button()
{
Content = baseEquips[k].AgvPositionCode + $"({baseEquips[k].EmptyCount})",
Name = baseEquips[k].AgvPositionCode,
Width = 100,
Height = 50,
FontSize = 15,
Margin = new Thickness(2),
Background = baseEquips[k].EmptyCount > 0 ? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#75F76D")) : new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4789AE")),
};
Grid.SetColumn(button2, k % 4 * 2 + 1);
Grid.SetRow(button2, -((k / 4) - 1));
Grid.SetColumnSpan(button2, 2);
grid.Children.Add(button2);
}
}
else
{
Grid.SetRow(button, -(location.LocRow.Value - row.Value)); Grid.SetRow(button, -(location.LocRow.Value - row.Value));
if (list[0] == 311)
{
for (var k = 0; k < 3; k++)
{
var button2 = new Button()
{
Content = baseEquips[k].AgvPositionCode + $"({baseEquips[k].EmptyCount})",
Name = baseEquips[k].AgvPositionCode,
Width = 100,
Height = 50,
FontSize = 15,
Margin = new Thickness(2),
Background = baseEquips[k].EmptyCount > 0 ? new SolidColorBrush((Color)ColorConverter.ConvertFromString("#75F76D")) : new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4789AE")),
};
Grid.SetColumn(button2, k % 4 * 2 + 17);
Grid.SetRow(button2, -((k / 4) - 1));
Grid.SetColumnSpan(button2, 2);
grid.Children.Add(button2);
}
}
}
grid.Children.Add(button); grid.Children.Add(button);
} }
Grid.SetRow(grid, i); Grid.SetRow(grid, i);

Loading…
Cancel
Save