change-老线成品下线调试完成版

main
liuwf
parent 901f4a62b5
commit 0f4ae8e9ce

@ -2491,9 +2491,9 @@
plc放行标志1为自动放行2为手动放行 plc放行标志1为自动放行2为手动放行
</summary> </summary>
</member> </member>
<member name="P:Admin.Core.Model.CodeBindingRecord.LinerCode"> <member name="P:Admin.Core.Model.CodeBindingRecord.Position2">
<summary> <summary>
内胆码 MES/SN绑定数据:1,区分集存库及条码绑定位置数据
</summary> </summary>
</member> </member>
<member name="T:Admin.Core.Model.CurrentTeamTime"> <member name="T:Admin.Core.Model.CurrentTeamTime">

@ -57,9 +57,10 @@ namespace Admin.Core.Model
public int IsPass { get; set; } public int IsPass { get; set; }
/// <summary> /// <summary>
/// 内胆码 /// MES/SN绑定数据:1,区分集存库及条码绑定位置数据
/// </summary> /// </summary>
[SugarColumn(ColumnName = "LINER_CODE")] [SugarColumn(ColumnName = "POSITION2")]
public string LinerCode { get; set; } public int Position2 { get; set; }
} }
} }

@ -39,7 +39,7 @@ namespace Admin.Core.Service
{ {
List<CodeBindCharts> list = null; List<CodeBindCharts> list = null;
var _db = this.BaseDal.Db; var _db = this.BaseDal.Db;
list = await _db.CopyNew().Ado.SqlQueryAsync<CodeBindCharts>("SELECT BOX_NAME as BoxName, COUNT(*) as Amount FROM CODE_BINDING WHERE PRODUCT_CODE IS NOT NULL AND TRUNC(RECORD_TIME2) = TRUNC(SYSDATE) GROUP BY BOX_NAME"); list = await _db.CopyNew().Ado.SqlQueryAsync<CodeBindCharts>("SELECT BOX_NAME as BoxName, COUNT(*) as Amount FROM CODE_BINDING WHERE PRODUCT_CODE IS NOT NULL and POSITION2=1 AND TRUNC(RECORD_TIME2) = TRUNC(SYSDATE) GROUP BY BOX_NAME");
list.OrderBy(x =>x.BoxName); list.OrderBy(x =>x.BoxName);
return list; return list;
} }
@ -61,23 +61,23 @@ namespace Admin.Core.Service
// 默认查询最近三天的数据,防止信息过多 // 默认查询最近三天的数据,防止信息过多
if (string.IsNullOrEmpty(time1) && string.IsNullOrEmpty(time2)) if (string.IsNullOrEmpty(time1) && string.IsNullOrEmpty(time2))
{ {
list = await _codeBindingRecordRepository.QueryAsync(d => d.RecordTime2 >= System.DateTime.Now.AddDays(-1)); list = await _codeBindingRecordRepository.QueryAsync(d => d.Position2==1&& d.RecordTime2 >= System.DateTime.Now.AddDays(-1));
} }
else if (!string.IsNullOrEmpty(time1) && string.IsNullOrEmpty(time2)) else if (!string.IsNullOrEmpty(time1) && string.IsNullOrEmpty(time2))
{ {
DateTime BeginTime = Convert.ToDateTime(Convert.ToDateTime(time1).ToString("yyyy-MM-dd")); DateTime BeginTime = Convert.ToDateTime(Convert.ToDateTime(time1).ToString("yyyy-MM-dd"));
list = await _codeBindingRecordRepository.QueryAsync(d => d.RecordTime2 >= BeginTime); list = await _codeBindingRecordRepository.QueryAsync(d => d.Position2 == 1 && d.RecordTime2 >= BeginTime);
} }
else if (string.IsNullOrEmpty(time1) && !string.IsNullOrEmpty(time2)) else if (string.IsNullOrEmpty(time1) && !string.IsNullOrEmpty(time2))
{ {
DateTime EndTime = Convert.ToDateTime(Convert.ToDateTime(time2).ToString("yyyy-MM-dd")); DateTime EndTime = Convert.ToDateTime(Convert.ToDateTime(time2).ToString("yyyy-MM-dd"));
list = await _codeBindingRecordRepository.QueryAsync(d => d.RecordTime2 <= EndTime); list = await _codeBindingRecordRepository.QueryAsync(d => d.Position2 == 1 && d.RecordTime2 <= EndTime);
} }
else if (!string.IsNullOrEmpty(time1) && !string.IsNullOrEmpty(time2)) else if (!string.IsNullOrEmpty(time1) && !string.IsNullOrEmpty(time2))
{ {
DateTime BeginTime = Convert.ToDateTime(Convert.ToDateTime(time1).ToString("yyyy-MM-dd")); DateTime BeginTime = Convert.ToDateTime(Convert.ToDateTime(time1).ToString("yyyy-MM-dd"));
DateTime EndTime = Convert.ToDateTime(Convert.ToDateTime(time2).ToString("yyyy-MM-dd")); DateTime EndTime = Convert.ToDateTime(Convert.ToDateTime(time2).ToString("yyyy-MM-dd"));
list = await _codeBindingRecordRepository.QueryAsync(d => d.RecordTime2 >= BeginTime && d.RecordTime2 <= EndTime); list = await _codeBindingRecordRepository.QueryAsync(d => d.Position2 == 1 && d.RecordTime2 >= BeginTime && d.RecordTime2 <= EndTime);
} }
return list.OrderByDescending(x => x.RecordTime2).ToList(); return list.OrderByDescending(x => x.RecordTime2).ToList();

@ -37,14 +37,7 @@ namespace Aucma.Core.CodeBinding.Business
#region 单例实现 #region 单例实现
private static readonly GunBusiness lazy = new GunBusiness(); private static readonly GunBusiness lazy = new GunBusiness();
/// <summary>
/// 扫码委托
/// </summary>
/// <param name="materialCodeStr"></param>
/// <param name="ip"></param>
public delegate void RefreshMaterialCodeStr(string ip,string materialCodeStr);
public static event RefreshMaterialCodeStr RefreshMaterialCodeStrEvent;
public static GunBusiness Instance public static GunBusiness Instance
{ {
get get
@ -54,6 +47,7 @@ namespace Aucma.Core.CodeBinding.Business
} }
#endregion #endregion
private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(GunBusiness)); private static readonly log4net.ILog logHelper = LogManager.GetLogger(typeof(GunBusiness));
@ -105,14 +99,12 @@ namespace Aucma.Core.CodeBinding.Business
if (str.Substring(0, 1) == "B") if (str.Substring(0, 1) == "B")
{ {
// mes条码 // mes条码
MESCode = str; MESCode = str;
RefreshMaterialCodeStrEvent?.Invoke(MesScannerIp,str);
} }
else else
{ {
//SN码 //SN码
SNCode = str; SNCode = str;
RefreshMaterialCodeStrEvent?.Invoke(SNScannerIp,str);
} }
if(!string.IsNullOrEmpty(MESCode) && !string.IsNullOrEmpty(SNCode)) if(!string.IsNullOrEmpty(MESCode) && !string.IsNullOrEmpty(SNCode))
{ {
@ -121,6 +113,7 @@ namespace Aucma.Core.CodeBinding.Business
SNCode = string.Empty; SNCode = string.Empty;
MESCode = string.Empty; MESCode = string.Empty;
} }
sb.Clear(); sb.Clear();
} }

@ -95,8 +95,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
// Business.MvCodeHelper.NoReadEvent += ReceiveNoRead; // Business.MvCodeHelper.NoReadEvent += ReceiveNoRead;
TouchSocketService.ReceiveCodeDelegateEvent += ReceiveCode; TouchSocketService.ReceiveCodeDelegateEvent += ReceiveCode;
TouchSocketService.NoReadReceiveEvent += ReceiveNoRead; TouchSocketService.NoReadReceiveEvent += ReceiveNoRead;
GunBusiness.BindingReceiveCodeEvent += BindingCode; GunBusiness.BindingReceiveCodeEvent += BindingCode;
GunBusiness.RefreshMaterialCodeStrEvent += ReceiveCode;
MsgUIColor = "White"; MsgUIColor = "White";
LoadData(); LoadData();
@ -221,7 +220,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
// LoadCharts(); // LoadCharts();
List<CodeBindingRecord> records = null; List<CodeBindingRecord> records = null;
records = _codeBindingRecordServices.QueryAsync(x => x.BoxCode != null && x.RecordTime2 >= DateTime.Today && x.RecordTime2 < DateTime.Today.AddDays(1)).Result; records = _codeBindingRecordServices.QueryAsync(x => x.Position2==1 && x.BoxCode != null && x.RecordTime2 >= DateTime.Today && x.RecordTime2 < DateTime.Today.AddDays(1)).Result;
if (records != null && records.Count > 0) if (records != null && records.Count > 0)
{ {
@ -306,7 +305,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
catch (Exception) catch (Exception)
{ {
throw;
} }
@ -679,6 +678,7 @@ namespace Aucma.Core.CodeBinding.ViewModels
//record.RecordTime1 = System.DateTime.Now; //record.RecordTime1 = System.DateTime.Now;
record.RecordTime2 = System.DateTime.Now; record.RecordTime2 = System.DateTime.Now;
record.IsPass = flag; record.IsPass = flag;
record.Position2 = 1;
record.BindingResult = "成功"; record.BindingResult = "成功";
bool result = false; bool result = false;
if (Repeatflag == 0) if (Repeatflag == 0)

@ -79,7 +79,8 @@ namespace Aucma.Core.ProductOffLine.ViewModels
/// </summary> /// </summary>
public void RefreshCharts() public void RefreshCharts()
{ {
listTime = _baseBomInfoServices.getWorkTime().Result;
if (listTime == null) return ;
List<OffLineInfo> list = LoadData(); List<OffLineInfo> list = LoadData();
// Console.WriteLine("刷新台数:"+list.Count); // Console.WriteLine("刷新台数:"+list.Count);
InitEveryDayMethod(list); InitEveryDayMethod(list);
@ -332,11 +333,10 @@ namespace Aucma.Core.ProductOffLine.ViewModels
Achievement.Clear(); Achievement.Clear();
#region 小时产量统计 #region 小时产量统计
if (listTime == null)
{ //listTime = _baseBomInfoServices.getWorkTime().Result;
listTime = _baseBomInfoServices.getWorkTime().Result; //if (listTime == null) return;
if (listTime == null) return;
}
// List<string> xList = new List<string>(); // List<string> xList = new List<string>();
foreach (WorkTime workTime in listTime) foreach (WorkTime workTime in listTime)
{ {
@ -570,11 +570,9 @@ namespace Aucma.Core.ProductOffLine.ViewModels
{ {
// List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result; // List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result;
if (listTime == null)
{
listTime = _baseBomInfoServices.getWorkTime().Result;
if (listTime == null) return null;
}
List<OffLineInfo> list = _offLineInfoServices.Query(x => x.ProductScanTime >= listTime[0].startTime && x.ProductScanTime <= listTime[11].endTime && x.ProductLineCode == "CX_02"); List<OffLineInfo> list = _offLineInfoServices.Query(x => x.ProductScanTime >= listTime[0].startTime && x.ProductScanTime <= listTime[11].endTime && x.ProductLineCode == "CX_02");
OffLineQty = list.Count.ToString(); OffLineQty = list.Count.ToString();
if (list == null || list.Count <= 0) return null; if (list == null || list.Count <= 0) return null;

@ -132,7 +132,12 @@ namespace Aucma.Core.ProductOffLineCX1.Business
HandSendPlcWindow.SendPlcPassEvent += DownLoadPassFlag; HandSendPlcWindow.SendPlcPassEvent += DownLoadPassFlag;
TouchSocketService.ReceiveCodeDelegateEvent += ReceiveAndConsumption; TouchSocketService.ReceiveCodeDelegateEvent += ReceiveAndConsumption;
TouchSocketService.NoReadReceiveEvent += NoRead; TouchSocketService.NoReadReceiveEvent += NoRead;
//Task.Run(() =>
//{
// Thread.Sleep(4000);
// var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
// int A = obj.plc.ReadInt16("ZR1000");
//});
} }
#region 变量定义 #region 变量定义
/// <summary> /// <summary>
@ -727,17 +732,17 @@ namespace Aucma.Core.ProductOffLineCX1.Business
TempOffLineInfo.OrderQty = order.OrderAmount; // 订单数量*5 TempOffLineInfo.OrderQty = order.OrderAmount; // 订单数量*5
TempOffLineInfo.ActQty = order.CompleteAmount; // 订单已上传*6 TempOffLineInfo.ActQty = order.CompleteAmount; // 订单已上传*6
} }
else //else
{ //{
TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",MES未查询到订单数据"; // TempOffLineInfo.MsgInfo = TempOffLineInfo.MsgInfo + ",MES未查询到订单数据";
TempOffLineInfo.MsgAlarmFlag = true; // TempOffLineInfo.MsgAlarmFlag = true;
//界面刷新 // //界面刷新
// TempOffLineInfo.ProductRefreshFlag = true; // // TempOffLineInfo.ProductRefreshFlag = true;
RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo); // RefreshScanMateriaCodeEvent?.Invoke(TempOffLineInfo);
AddExceptionRecord(TempOffLineInfo.ProductSNCode, TempOffLineInfo.MsgInfo, 6); // AddExceptionRecord(TempOffLineInfo.ProductSNCode, TempOffLineInfo.MsgInfo, 6);
return false; // return false;
} //}
// 条码系统保存接口 // 条码系统保存接口
string strSave = _productOffLineServices.SaveBarcodeInfo(TempOffLineInfo.ProductSNCode, appConfig.BarCodeAccount, TempOffLineInfo.ProductOrderNo, orderType); string strSave = _productOffLineServices.SaveBarcodeInfo(TempOffLineInfo.ProductSNCode, appConfig.BarCodeAccount, TempOffLineInfo.ProductOrderNo, orderType);
@ -844,6 +849,11 @@ namespace Aucma.Core.ProductOffLineCX1.Business
return true; return true;
} }
else if(offLineInfo==null)
{
// 已上传但是本地无记录
return true;
}
log.Info(TempOffLineInfo.ProductSNCode + "条码重复上传plc应答字为2已经下传过不允许再次放行"); log.Info(TempOffLineInfo.ProductSNCode + "条码重复上传plc应答字为2已经下传过不允许再次放行");
TempOffLineInfo.MsgAlarmFlag = true; TempOffLineInfo.MsgAlarmFlag = true;

@ -80,6 +80,27 @@ namespace Aucma.Core.ProductOffLineCX1.Config
set { iniHelper.IniWriteValue("system", "PassWord", value); } set { iniHelper.IniWriteValue("system", "PassWord", value); }
} }
/// <summary>
///分垛模式1手动2自动默认手动
/// </summary>
public string SelectedMaterialType
{
get { return iniHelper.IniReadValue("system", "SelectedMaterialType"); }
set { iniHelper.IniWriteValue("system", "SelectedMaterialType", value); }
}
/// <summary>
///去往分垛库方向,A库为1B库为2老线默认B库2新线默认A库1
/// </summary>
public string PalletizDirection
{
get { return iniHelper.IniReadValue("system", "PalletizDirection"); }
set { iniHelper.IniWriteValue("system", "PalletizDirection", value); }
}
} }
} }

@ -79,7 +79,9 @@ namespace Aucma.Core.ProductOffLineCX1.ViewModels
/// </summary> /// </summary>
public void RefreshCharts() public void RefreshCharts()
{ {
listTime = _baseBomInfoServices.getWorkTime().Result;
if (listTime == null) return ;
List<OffLineInfo> list = LoadData(); List<OffLineInfo> list = LoadData();
// Console.WriteLine("刷新台数:"+list.Count); // Console.WriteLine("刷新台数:"+list.Count);
InitEveryDayMethod(list); InitEveryDayMethod(list);
@ -324,7 +326,7 @@ namespace Aucma.Core.ProductOffLineCX1.ViewModels
{ {
if (list == null) return; if (list == null) return;
// 当日下线记录 // 当日下线记录
List<OffLineInfo> offList = _offLineInfoServices.QueryAsync(x => x.ProductScanTime >= listTime[0].startTime && x.ProductScanTime <= listTime[11].startTime).Result; List<OffLineInfo> offList = _offLineInfoServices.QueryAsync(x => x.ProductScanTime >= listTime[0].startTime && x.ProductScanTime <= listTime[11].startTime && x.ProductLineCode == "CX_01").Result;
Application.Current.Dispatcher.Invoke(() => Application.Current.Dispatcher.Invoke(() =>
{ {
@ -332,11 +334,11 @@ namespace Aucma.Core.ProductOffLineCX1.ViewModels
Achievement.Clear(); Achievement.Clear();
#region 小时产量统计 #region 小时产量统计
if (listTime == null) //if (listTime == null)
{ //{
listTime = _baseBomInfoServices.getWorkTime().Result; // listTime = _baseBomInfoServices.getWorkTime().Result;
if (listTime == null) return; // if (listTime == null) return;
} //}
// List<string> xList = new List<string>(); // List<string> xList = new List<string>();
foreach (WorkTime workTime in listTime) foreach (WorkTime workTime in listTime)
{ {
@ -570,11 +572,8 @@ namespace Aucma.Core.ProductOffLineCX1.ViewModels
{ {
// List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result; // List<WorkTime> listTime = _baseBomInfoServices.getWorkTime().Result;
if (listTime == null)
{
listTime = _baseBomInfoServices.getWorkTime().Result;
if (listTime == null) return null;
}
List<OffLineInfo> list = _offLineInfoServices.Query(x => x.ProductScanTime >= listTime[0].startTime && x.ProductScanTime <= listTime[11].endTime && x.ProductLineCode == "CX_01"); List<OffLineInfo> list = _offLineInfoServices.Query(x => x.ProductScanTime >= listTime[0].startTime && x.ProductScanTime <= listTime[11].endTime && x.ProductLineCode == "CX_01");
OffLineQty = list.Count.ToString(); OffLineQty = list.Count.ToString();
if (list == null || list.Count <= 0) return null; if (list == null || list.Count <= 0) return null;

@ -1,7 +1,9 @@
using Admin.Core.IService; using Admin.Core.IService;
using Admin.Core.Model; using Admin.Core.Model;
using Admin.Core.Service; using Admin.Core.Service;
using Aucma.Core.HwPLc;
using Aucma.Core.ProductOffLineCX1.Business; using Aucma.Core.ProductOffLineCX1.Business;
using Aucma.Core.ProductOffLineCX1.Config;
using Aucma.Core.ProductOffLineCX1.Models; using Aucma.Core.ProductOffLineCX1.Models;
using Aucma.Core.ProductOffLineCX1.Views; using Aucma.Core.ProductOffLineCX1.Views;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
@ -32,11 +34,14 @@ namespace Aucma.Core.ProductOffLineCX1.ViewModels
OffLineBusiness offLineBusiness = OffLineBusiness.Instance; OffLineBusiness offLineBusiness = OffLineBusiness.Instance;
private IndexPageView firstPage = new IndexPageView();//首页 private IndexPageView firstPage = new IndexPageView();//首页
private DirectionEditView directionEditView = new DirectionEditView(); private DirectionEditView directionEditView = new DirectionEditView();
private SelectQualityView selectQualityView = new SelectQualityView(); private SelectQualityView selectQualityView = new SelectQualityView();
private AppConfig appConfig = AppConfig.Instance;
public QualityPageViewModel() public QualityPageViewModel()
{ {
UserContent1 = directionEditView; UserContent1 = directionEditView;
UserContent2 = selectQualityView; UserContent2 = selectQualityView;
DirectionInit();
// 传入库方向 // 传入库方向
offLineBusiness.getDirectioneEvent += getInstoreDirection; offLineBusiness.getDirectioneEvent += getInstoreDirection;
QualityPageView.getAllQualityEvent += test; QualityPageView.getAllQualityEvent += test;
@ -47,32 +52,76 @@ namespace Aucma.Core.ProductOffLineCX1.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")
{
_isSelectedOptionA = true;
_isSelectedOptionB = false;
}
else if (appConfig.PalletizDirection == "2")
{
_isSelectedOptionA = false;
_isSelectedOptionB = true;
}
else
{
_isSelectedOptionA = true;
_isSelectedOptionB = true;
appConfig.PalletizDirection = "1";
}
#endregion
}
/// <summary> /// <summary>
/// 根据自动/手动模式获取入库方向 /// 根据自动/手动模式获取入库方向
/// </summary> /// </summary>
/// <param name="materialType"></param> /// <param name="materialType"></param>
public String getInstoreDirection(string materialType) public String getInstoreDirection(string materialType)
{ {
// 二线默认A库一线默认B库
string direction = "B";
string direction = string.Empty; // 自动模式模式
Application.Current.Dispatcher.Invoke(() => if (appConfig.SelectedMaterialType == "2")
{ {
// 设置了入库自动模式模式 BaseMaterialInfo info = _baseMaterialInfoServices.Query(x => x.MaterialCode == materialType).FirstOrDefault();
if (SelectedMaterialType != null && SelectedMaterialType.Content.ToString() == "自动模式") if (info != null && !string.IsNullOrEmpty(info.InboundDirection)) // 设置过了方向
{ {
BaseMaterialInfo info = _baseMaterialInfoServices.Query(x => x.MaterialCode == materialType).FirstOrDefault(); direction = info.InboundDirection;
if (info != null&& !string.IsNullOrEmpty(info.InboundDirection)) // 设置过了方向
{
direction = info.InboundDirection;
}
} }
else // 设置手动模式 else // 自动模式未设置方向,按照手动模式走
{ {
if (IsSelectedOptionA == true) direction = "A"; direction = appConfig.PalletizDirection == "1" ? "A" : "B";
if (IsSelectedOptionB == true) direction = "B";
} }
});
}
else // 设置手动模式
{
direction = appConfig.PalletizDirection == "1" ? "A" : "B";
}
return direction; return direction;
} }
@ -123,19 +172,33 @@ namespace Aucma.Core.ProductOffLineCX1.ViewModels
/// 分垛模式(自动模式,手动模式)SelectedMaterialType.content.tostring() /// 分垛模式(自动模式,手动模式)SelectedMaterialType.content.tostring()
/// </summary> /// </summary>
/// private string _selectedMaterialType; /// private string _selectedMaterialType;
private ComboBoxItem _selectedMaterialType; private string _selectedMaterialType;
public ComboBoxItem SelectedMaterialType public string SelectedMaterialType
{ {
get { return _selectedMaterialType; } get { return _selectedMaterialType; }
set set
{ {
if (_selectedMaterialType != value) if (_selectedMaterialType != value)
{ {
if (value == "手动模式")
{
appConfig.SelectedMaterialType = "1";
}
else if (value == "自动模式")
{
appConfig.SelectedMaterialType = "2";
}
else
{
appConfig.SelectedMaterialType = "1";
}
_selectedMaterialType = value; _selectedMaterialType = value;
OnPropertyChanged(nameof(SelectedMaterialType)); OnPropertyChanged(nameof(SelectedMaterialType));
} }
} }
} }
#region 单选框 #region 单选框
private bool _isSelectedOptionA; private bool _isSelectedOptionA;
public bool IsSelectedOptionA public bool IsSelectedOptionA
@ -143,17 +206,47 @@ namespace Aucma.Core.ProductOffLineCX1.ViewModels
get { return _isSelectedOptionA; } get { return _isSelectedOptionA; }
set set
{ {
if (_isSelectedOptionA != value)
{
_isSelectedOptionA = value;
OnPropertyChanged(nameof(IsSelectedOptionA));
// 如果选择了A选项将B选项设为false if (value)
if (_isSelectedOptionA) {
var result = MessageBox.Show("确认切换A库方向吗?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{ {
IsSelectedOptionB = false; var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
// obj = null;
if (obj != null)
{
bool flag = obj.plc.ReadBool("B100A");
if (flag)
{
_isSelectedOptionA = value;
OnPropertyChanged(nameof(IsSelectedOptionA));
appConfig.PalletizDirection = "1";
// 如果选择了A选项将B选项设为false
if (_isSelectedOptionA)
{
IsSelectedOptionB = false;
}
}
else
{
MessageBox.Show("切换失败,请检查提升机及二楼平台是否残留箱体或数据!");
}
}
else
{
MessageBox.Show("Plc连接失败请检查连接!");
}
} }
} }
else
{
_isSelectedOptionA = value;
OnPropertyChanged(nameof(IsSelectedOptionA));
}
} }
} }
@ -163,22 +256,54 @@ namespace Aucma.Core.ProductOffLineCX1.ViewModels
get { return _isSelectedOptionB; } get { return _isSelectedOptionB; }
set set
{ {
if (_isSelectedOptionB != value)
if (value)
{ {
_isSelectedOptionB = value; var result = MessageBox.Show("确认切换B方向吗?", "确认", MessageBoxButton.YesNo, MessageBoxImage.Question);
OnPropertyChanged(nameof(IsSelectedOptionB));
// 如果选择了B选项将A选项设为false if (result == MessageBoxResult.Yes)
if (_isSelectedOptionB)
{ {
IsSelectedOptionA = false; var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
// obj = null;
if (obj != null)
{
bool flag = obj.plc.ReadBool("B100A");
if (flag)
{
_isSelectedOptionB = value;
OnPropertyChanged(nameof(IsSelectedOptionB));
appConfig.PalletizDirection = "2";
// 如果选择了B选项将A选项设为false
if (_isSelectedOptionB)
{
IsSelectedOptionA = false;
}
}
else
{
MessageBox.Show("切换失败,请检查提升机及二楼平台是否残留箱体或数据!");
}
}
else
{
MessageBox.Show("Plc连接失败请检查连接!");
}
} }
} }
else
{
_isSelectedOptionB = value;
OnPropertyChanged(nameof(IsSelectedOptionB));
}
} }
} }
#endregion #endregion
#endregion #endregion

@ -35,8 +35,8 @@
<StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0"> <StackPanel Grid.Row="1" Orientation="Horizontal" VerticalAlignment="Center" Margin="50,0,0,0">
<TextBlock Text=" 选择班组:" FontSize="20" Foreground="#FFFFFF" Margin="10,0,0,0" Width="129"/> <TextBlock Text=" 选择班组:" FontSize="20" Foreground="#FFFFFF" Margin="10,0,0,0" Width="129"/>
<ComboBox SelectedItem="{Binding SelectedMaterialType}" Width="150" Margin="5 0 0 0" VerticalAlignment="Center" FontSize="30" Foreground="White"> <ComboBox SelectedItem="{Binding SelectedMaterialType}" Width="150" Margin="5 0 0 0" VerticalAlignment="Center" FontSize="30" Foreground="White">
<ComboBoxItem Content="线白班" Foreground="Blue"/> <ComboBoxItem Content="线白班" Foreground="Blue"/>
<ComboBoxItem Content="线夜班" Foreground="Blue" /> <ComboBoxItem Content="线夜班" Foreground="Blue" />
</ComboBox> </ComboBox>
</StackPanel> </StackPanel>

@ -70,7 +70,7 @@
<Grid Grid.Row="1"> <Grid Grid.Row="1">
<WrapPanel VerticalAlignment="Center" HorizontalAlignment="Left"> <WrapPanel VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Text="分垛模式选择:" Margin="10 0" Foreground="White" FontSize="20" VerticalAlignment="Center"/> <TextBlock Text="分垛模式选择:" Margin="10 0" Foreground="White" FontSize="20" VerticalAlignment="Center"/>
<ComboBox SelectedItem="{Binding SelectedMaterialType}" 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"/>
<ComboBoxItem Content="手动模式" Foreground="Blue" /> <ComboBoxItem Content="手动模式" Foreground="Blue" />
</ComboBox> </ComboBox>

@ -212,13 +212,13 @@
"ScannerServer": [ "ScannerServer": [
{ {
"Id": 1, "Id": 1,
"Ip": "10.10.92.140", "Ip": "10.10.92.142",
// "Ip": "10.10.92.121", // "Ip": "10.10.92.121",
"Name": "内侧扫码器1" "Name": "内侧扫码器1"
}, },
{ {
"Id": 2, "Id": 2,
"Ip": "10.10.92.141", "Ip": "10.10.92.143",
// "Ip": "10.10.92.122", // "Ip": "10.10.92.122",
"Name": "外侧扫码器2" "Name": "外侧扫码器2"
} }
@ -229,10 +229,10 @@
"EquipName": "成品下线Plc", "EquipName": "成品下线Plc",
"PlcType": "Melsec", "PlcType": "Melsec",
"Enabled": true, "Enabled": true,
//"IP": "127.0.0.1", "IP": "127.0.0.1",
//"Port": 6000 "Port": 6000
"IP": "10.10.92.70", // "IP": "10.10.92.110",
"Port": 2015 // "Port": 2015
} }
], ],

Loading…
Cancel
Save