change-一线下线AB库切换完善

main
liuwf 12 months ago
parent 9085610112
commit 901f4a62b5

@ -386,11 +386,7 @@ namespace Aucma.Core.ProductOffLine.Business
bool plcResult = false;
// 先查询分垛方向A或者B
string direction = getDirectioneEvent?.Invoke(materialType);
if (direction == "")
{
//未设置方向处理,默认去A
direction = "A";
}
plcResult = DownLoadPassFlag(ScannerNo, direction); //下发plc放行信号,分垛AB库
return plcResult;
}

@ -56,8 +56,22 @@ namespace Aucma.Core.ProductOffLine.ViewModels
// 初始化界面分垛模式及分垛方向
private void DirectionInit()
{
#region 分垛模式
if (appConfig.SelectedMaterialType == "1")
{
SelectedMaterialType = "手动模式";
}
else if (appConfig.SelectedMaterialType == "2")
{
SelectedMaterialType = "自动模式";
}
else
{
SelectedMaterialType = "手动模式";
appConfig.SelectedMaterialType = "1";
}
#endregion
#region 默认方向
if (appConfig.PalletizDirection == "1")
@ -85,26 +99,28 @@ namespace Aucma.Core.ProductOffLine.ViewModels
/// <param name="materialType"></param>
public String getInstoreDirection(string materialType)
{
// 二线默认A库一线默认B库
string direction = "A";
string direction = string.Empty;
Application.Current.Dispatcher.Invoke(() =>
// 自动模式模式
if (appConfig.SelectedMaterialType == "2")
{
// 设置了入库自动模式模式
if (SelectedMaterialType != null && SelectedMaterialType.Content.ToString() == "自动模式")
BaseMaterialInfo info = _baseMaterialInfoServices.Query(x => x.MaterialCode == materialType).FirstOrDefault();
if (info != null && !string.IsNullOrEmpty(info.InboundDirection)) // 设置过了方向
{
BaseMaterialInfo info = _baseMaterialInfoServices.Query(x => x.MaterialCode == materialType).FirstOrDefault();
if (info != null && !string.IsNullOrEmpty(info.InboundDirection)) // 设置过了方向
{
direction = info.InboundDirection;
}
direction = info.InboundDirection;
}
else // 设置手动模式
else // 自动模式未设置方向,按照手动模式走
{
if (IsSelectedOptionA == true) direction = "A";
if (IsSelectedOptionB == true) direction = "B";
direction = appConfig.PalletizDirection == "1" ? "A" : "B";
}
});
}
else // 设置手动模式
{
direction = appConfig.PalletizDirection == "1" ? "A" : "B";
}
return direction;
}
@ -139,7 +155,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
public async void init()
{
await _baseQualityInspectionItemInfoServices.query();
}
List<MaterialComplateInfo> materialComplateInfos = new List<MaterialComplateInfo>();
@ -150,14 +166,26 @@ namespace Aucma.Core.ProductOffLine.ViewModels
/// 分垛模式(自动模式,手动模式)SelectedMaterialType.content.tostring()
/// </summary>
/// private string _selectedMaterialType;
private ComboBoxItem _selectedMaterialType;
public ComboBoxItem SelectedMaterialType
private string _selectedMaterialType;
public string SelectedMaterialType
{
get { return _selectedMaterialType; }
set
{
if (_selectedMaterialType != value)
{
if (value == "手动模式")
{
appConfig.SelectedMaterialType = "1";
}
else if (value == "自动模式")
{
appConfig.SelectedMaterialType = "2";
}
else
{
appConfig.SelectedMaterialType = "1";
}
_selectedMaterialType = value;
OnPropertyChanged(nameof(SelectedMaterialType));
}
@ -180,7 +208,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
if (result == MessageBoxResult.Yes)
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
// obj = null;
// obj = null;
if (obj != null)
{
bool flag = obj.plc.ReadBool("B100A");
@ -194,7 +222,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
{
IsSelectedOptionB = false;
}
MessageBox.Show("切换成功");
}
else
{
@ -227,10 +255,11 @@ namespace Aucma.Core.ProductOffLine.ViewModels
if (value)
{
var result = MessageBox.Show("确认切换B方向吗?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
// obj = null;
// obj = null;
if (obj != null)
{
bool flag = obj.plc.ReadBool("B100A");
@ -245,7 +274,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
{
IsSelectedOptionA = false;
}
MessageBox.Show("切换成功");
}
else
{

@ -70,7 +70,7 @@
<Grid Grid.Row="1">
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Text="分垛模式选择:" Margin="10 0" Foreground="White" FontSize="20" VerticalAlignment="Center"/>
<ComboBox Name="SelectedMaterialType" SelectedItem="{Binding SelectedMaterialType,Mode=TwoWay}" Width="200" Margin="5 0 0 0" VerticalAlignment="Center" FontSize="30" Foreground="White">
<ComboBox Name="SelectedMaterialType" SelectedValue="{Binding SelectedMaterialType,Mode=TwoWay}" SelectedValuePath="Content" Width="200" Margin="5 0 0 0" VerticalAlignment="Center" FontSize="30" Foreground="White">
<ComboBoxItem Content="手动模式" Foreground="Blue" />
<ComboBoxItem Content="自动模式" Foreground="Blue"/>
</ComboBox>

@ -229,10 +229,10 @@
"EquipName": "成品下线Plc",
"PlcType": "Melsec",
"Enabled": true,
"IP": "127.0.0.1",
"Port": 6000
//"IP": "10.10.92.70",
// "Port": 2015
// "IP": "127.0.0.1",
// "Port": 6000
"IP": "10.10.92.70",
"Port": 2015
}
],

Loading…
Cancel
Save