|
|
|
@ -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
|
|
|
|
|
{
|
|
|
|
|