提交代码
@ -21,7 +21,8 @@
|
||||
<!--字体-->
|
||||
<FontFamily x:Key="IconFont">pack://application,,,/货架标准上位机;component/Fonts/#iconfont</FontFamily>
|
||||
<!--字符串-->
|
||||
<sys:String x:Key="AboutInfo1">金川数智</sys:String>
|
||||
<sys:String x:Key="AboutInfo1">卓越盟讯</sys:String>
|
||||
<!--<sys:String x:Key="AboutInfo1">金川数智</sys:String>-->
|
||||
<sys:String x:Key="AboutInfo2">智造未来</sys:String>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 18 KiB |
BIN
货架标准上位机/Resources/LogoJC.ico
Normal file
After Width: | Height: | Size: 264 KiB |
BIN
货架标准上位机/Resources/LogoJC.png
Normal file
After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 18 KiB |
@ -87,5 +87,7 @@ namespace 货架标准上位机
|
||||
public string ModulesStr { get; set; } = string.Empty;
|
||||
|
||||
public string MatSn { get; set; } = string.Empty;
|
||||
|
||||
public string InstoreUser { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,11 @@ namespace 货架标准上位机.ViewModel
|
||||
Result.Data
|
||||
.ForEach(t =>
|
||||
{
|
||||
var shelf = new ShelfStatusControl(t.ShelfCode, t.CurentMode, "");
|
||||
if (t.CurentMode == 0 || t.CurentMode == 1)
|
||||
{
|
||||
t.OrderNumber = string.Empty;
|
||||
}
|
||||
var shelf = new ShelfStatusControl(t.ShelfCode, t.CurentMode, t.OrderNumber);
|
||||
wrapPanel.Children.Add(shelf);
|
||||
});
|
||||
});
|
||||
|
@ -57,11 +57,12 @@ namespace 货架标准上位机.ViewModel
|
||||
scanner.TempCode += currentScanedCode;
|
||||
//校验末尾码
|
||||
CheckDataCompleteness(scanner);
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn);
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn, scanner.InstoreUser);
|
||||
}
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
}
|
||||
RevertScannerStatus();
|
||||
}
|
||||
|
||||
#region Property
|
||||
@ -77,6 +78,58 @@ namespace 货架标准上位机.ViewModel
|
||||
#endregion
|
||||
|
||||
#region Command
|
||||
/// <summary>
|
||||
/// 第一次加载时 获取服务器对应货架是否在入库模式 是否是扫码枪启动的 还原扫码枪的状态
|
||||
/// </summary>
|
||||
public void RevertScannerStatus()
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
try
|
||||
{
|
||||
var body = new GetShelfStatusRequest()
|
||||
{
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = "WCS前端",
|
||||
GroupNames = LocalFile.Config.GroupName,
|
||||
};
|
||||
var Result = ApiHelp.Post<GetShelfStatusResponse>([LocalFile.Config.ApiIpHost, "home/getShelfStatus"], body).Result;
|
||||
if (Result != null && Result.Data != null && Result.Data?.Count > 0)
|
||||
{
|
||||
var shelfs = Result.Data.Where(t => t.CurentMode == 1 && !string.IsNullOrEmpty(t.CurrentCom)).ToList();
|
||||
if (shelfs == null || shelfs.Count == 0)
|
||||
return;
|
||||
|
||||
Logs.Write($"【启动时发现需要恢复扫码枪状态】{string.Join(",", shelfs.Select(t => t.CurrentCom).ToList())}", LogsType.Scanner);
|
||||
foreach (var shelf in shelfs)
|
||||
{
|
||||
var scanner = ScannerManager.Scanners.Where(t => t.COM == shelf.CurrentCom).FirstOrDefault();
|
||||
if (scanner != null)
|
||||
{
|
||||
|
||||
scanner.IsInstoreMode = true;
|
||||
scanner.IsInstoreModeTime = shelf.SetCurrentModeTime;
|
||||
scanner.ShelfCode = shelf.ShelfCode;
|
||||
scanner.ModulesStr = shelf.ModulesStr;
|
||||
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn, scanner.InstoreUser);
|
||||
Logs.Write($"【恢复扫码枪】{scanner.COM}", LogsType.Scanner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void CheckDataCompleteness(Scanner scanner)
|
||||
{
|
||||
if (scanner.TempCode.EndsWith("\r"))//结束符 TODO结束符是否需要自定义 现场配置
|
||||
@ -118,7 +171,24 @@ namespace 货架标准上位机.ViewModel
|
||||
Logs.Write($"[{scanner.COM}]校验到扫码数据为结束入库码【{scanner.TempCode}】", LogsType.Scanner);
|
||||
ShelfGoOutInstoreProcess(scanner);
|
||||
}
|
||||
//TODO 增加正则表达式进行判断是否扫到的是物料码
|
||||
else if (scanner.TempCode.ToUpper().Contains("MXID") && scanner.TempCode.ToUpper().Contains("NAME"))
|
||||
{
|
||||
string pattern = @"\b\d{6}\b"; // 匹配一个完整的6位数字
|
||||
Match match = Regex.Match(scanner.TempCode, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
scanner.InstoreUser = match.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
Logs.Write($"扫码枪扫到{scanner.TempCode},无法解析出工号!", LogsType.Scanner);
|
||||
}
|
||||
}
|
||||
else if (Regex.IsMatch(scanner.TempCode, @"^\d{6}$"))
|
||||
{
|
||||
scanner.InstoreUser = scanner.TempCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logs.Write($"[{scanner.COM}]校验到扫码数据为物料码【{scanner.TempCode}】", LogsType.Scanner);
|
||||
@ -164,7 +234,7 @@ namespace 货架标准上位机.ViewModel
|
||||
ShelfCode = scanner.ShelfCode,
|
||||
IPAdress = scanner.COM,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
UserName = string.IsNullOrEmpty(scanner.InstoreUser) ? LocalStatic.CurrentUser : scanner.InstoreUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST", true);
|
||||
if (Result != null && Result.Code == 200)
|
||||
@ -197,7 +267,7 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
ModuleCode = scanner.TempCode,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
UserName = string.IsNullOrEmpty(scanner.InstoreUser) ? LocalStatic.CurrentUser : scanner.InstoreUser,
|
||||
IpAdress = scanner.COM,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ShelfGoInInstoreResponse>(LocalFile.Config.ApiIpHost + "instore/shelfGoInInStore", body, "POST");
|
||||
@ -247,7 +317,7 @@ namespace 货架标准上位机.ViewModel
|
||||
ShelfCode = scanner.ShelfCode,
|
||||
IPAdress = scanner.COM,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
UserName = string.IsNullOrEmpty(scanner.InstoreUser) ? LocalStatic.CurrentUser : scanner.InstoreUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseBase>(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
@ -277,7 +347,7 @@ namespace 货架标准上位机.ViewModel
|
||||
ShelfCode = scanner.ShelfCode,
|
||||
IpAddress = scanner.COM,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
UserName = string.IsNullOrEmpty(scanner.InstoreUser) ? LocalStatic.CurrentUser : scanner.InstoreUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<MatInfoModel>>(LocalFile.Config.ApiIpHost + "instore/queryByMatSn", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
@ -294,14 +364,14 @@ namespace 货架标准上位机.ViewModel
|
||||
ShelfCode = scanner.ShelfCode,
|
||||
IpAddress = scanner.COM,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
UserName = string.IsNullOrEmpty(scanner.InstoreUser) ? LocalStatic.CurrentUser : scanner.InstoreUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<MatInfoModel>>(LocalFile.Config.ApiIpHost + "instore/queryInstoreStatus", body, "POST");
|
||||
if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
{
|
||||
TextBoxLog.AddLog($"物料[{scanner.MatSn}]" + Result.Message, "InstoreLog", DateTime.Now);
|
||||
scanner.MatSn = string.Empty;
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn);
|
||||
scanner.ScannerDisplayControl.RefreshValues(scanner.ShelfCode, scanner.MatSn, scanner.InstoreUser);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -337,7 +407,7 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
ShelfCode = t.ShelfCode,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
UserName = string.IsNullOrEmpty(t.InstoreUser) ? LocalStatic.CurrentUser : t.InstoreUser,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "instore/shelfGoOutInStore", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
@ -346,7 +416,7 @@ namespace 货架标准上位机.ViewModel
|
||||
t.ShelfCode = string.Empty;
|
||||
t.MatSn = string.Empty;
|
||||
|
||||
t.ScannerDisplayControl.RefreshValues(t.ShelfCode, t.MatSn);
|
||||
t.ScannerDisplayControl.RefreshValues(t.ShelfCode, t.MatSn, t.InstoreUser);
|
||||
Growl.Success(Result.Message);
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ namespace 货架标准上位机.ViewModel
|
||||
RefreshOutOrderList();
|
||||
}
|
||||
|
||||
public static object flag { get; set; } = new object();
|
||||
#region Property
|
||||
private OutOrderModel selectedOutOrder;
|
||||
public OutOrderModel SelectedOutOrder
|
||||
@ -42,14 +43,19 @@ namespace 货架标准上位机.ViewModel
|
||||
set
|
||||
{
|
||||
SetProperty(ref selectedOutOrder, value);
|
||||
if (selectedOutOrder != null)
|
||||
|
||||
if (selectedOutOrder != null && selectedOutOrder.OrderNumber != SelectedOutOrderNumber)
|
||||
{
|
||||
SelectedOutOrderNumber = selectedOutOrder.OrderNumber;
|
||||
RefreshDataGridItemSource();
|
||||
}
|
||||
else if (selectedOutOrder != null && selectedOutOrder.OrderNumber == SelectedOutOrderNumber)
|
||||
{
|
||||
RefreshDataGridItemSource();
|
||||
}
|
||||
else
|
||||
{
|
||||
DataGridItemSource?.Clear();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -119,8 +125,18 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
SendedPan = dataGridItemSource.Where(t => t.IsSended).Count();
|
||||
TotalPan = dataGridItemSource.Count();
|
||||
try
|
||||
{
|
||||
SendedPan = dataGridItemSource.Where(t => t.IsSended).Count();
|
||||
TotalPan = dataGridItemSource.Count();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
SendedPan = dataGridItemSource.Where(t => t.IsSended).Count();
|
||||
TotalPan = dataGridItemSource.Count();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
@ -131,6 +147,7 @@ namespace 货架标准上位机.ViewModel
|
||||
{
|
||||
var window = new MXOutOrderView();
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
window.Topmost = true;
|
||||
window.ShowDialog();
|
||||
}
|
||||
|
||||
@ -143,22 +160,22 @@ namespace 货架标准上位机.ViewModel
|
||||
//判断是否选择单据
|
||||
if (SelectedOutOrder == null)
|
||||
{
|
||||
Growl.Warning("未选择单据!");
|
||||
Growl.Warning("未选择单据!请选择左侧单据!");
|
||||
return;
|
||||
}
|
||||
|
||||
#region 调用接口开始出库
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
OrderId = selectedOutOrder.Id,
|
||||
OrderNumber = selectedOutOrder.OrderNumber,
|
||||
OrderId = SelectedOutOrder.Id,
|
||||
OrderNumber = SelectedOutOrder.OrderNumber,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "outStore/goInOutstore", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
Growl.Warning("已成功开始出库!");
|
||||
Growl.Warning("已成功开始发料!");
|
||||
RefreshOutOrderList(SelectedOutOrderNumber);
|
||||
}
|
||||
else if (Result != null)
|
||||
@ -188,23 +205,22 @@ namespace 货架标准上位机.ViewModel
|
||||
//判断是否选择单据
|
||||
if (SelectedOutOrder == null)
|
||||
{
|
||||
Growl.Warning("未选择单据!");
|
||||
Growl.Warning("未选择单据!请选择左侧单据!");
|
||||
return;
|
||||
}
|
||||
#region 调用接口结束出库
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
OrderId = selectedOutOrder.Id,
|
||||
OrderNumber = selectedOutOrder.OrderNumber,
|
||||
OrderId = SelectedOutOrder.Id,
|
||||
OrderNumber = SelectedOutOrder.OrderNumber,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "outStore/goOutOutstore", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
Growl.Warning("已成功结束出库!");
|
||||
Growl.Warning("已成功取消发料!");
|
||||
RefreshOutOrderList(SelectedOutOrderNumber);
|
||||
//RefreshDataGridItemSource();
|
||||
}
|
||||
else if (Result != null)
|
||||
{
|
||||
@ -227,59 +243,89 @@ namespace 货架标准上位机.ViewModel
|
||||
|
||||
public void RefreshOutOrderList(string OrderNumber = "")
|
||||
{
|
||||
#region 调用接口获取发料单
|
||||
try
|
||||
lock (flag)
|
||||
{
|
||||
var body = new GetOutOrderListByStatusRequest()
|
||||
Logs.Write($"【RefreshOutOrderList1】OrderNumber{OrderNumber}", LogsType.Info);
|
||||
if (string.IsNullOrEmpty(OrderNumber) && !string.IsNullOrEmpty(SelectedOutOrderNumber))
|
||||
{
|
||||
IsMXPD = false,
|
||||
OrderExeStatus = new List<OutOrderExeStatus>() { OutOrderExeStatus.开始发料, OutOrderExeStatus.发料完成 }
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<OutOrderModel>>(LocalFile.Config.ApiIpHost + "outstore/getOutOrderListByStatus", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
OrderNumber = SelectedOutOrderNumber;
|
||||
Logs.Write($"【RefreshOutOrderList2】OrderNumber{OrderNumber}", LogsType.Info);
|
||||
}
|
||||
#region 调用接口获取发料单
|
||||
try
|
||||
{
|
||||
OutOrderList = new ObservableCollection<OutOrderModel>(Result.Data.Lists);
|
||||
if (!string.IsNullOrEmpty(OrderNumber))
|
||||
var body = new GetOutOrderListByStatusRequest()
|
||||
{
|
||||
SelectedOutOrder = OutOrderList.Where(t => t.OrderNumber == OrderNumber).FirstOrDefault();
|
||||
IsMXPD = false,
|
||||
OrderExeStatus = new List<OutOrderExeStatus>() { OutOrderExeStatus.开始发料, OutOrderExeStatus.发料完成 }
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<PageQueryResponse<OutOrderModel>>(LocalFile.Config.ApiIpHost + "outstore/getOutOrderListByStatus", body, "POST");
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
OutOrderList = new ObservableCollection<OutOrderModel>(Result.Data.Lists);
|
||||
if (!string.IsNullOrEmpty(OrderNumber))
|
||||
{
|
||||
if (selectedOutOrder == null)
|
||||
{
|
||||
SelectedOutOrder = OutOrderList?.Where(t => t.OrderNumber == OrderNumber).FirstOrDefault();
|
||||
}
|
||||
Logs.Write($"【RefreshOutOrderList3】SelectedOutOrder{SelectedOutOrder?.OrderNumber}", LogsType.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (selectedOutOrder == null)
|
||||
SelectedOutOrder = OutOrderList?.FirstOrDefault();
|
||||
Logs.Write($"【RefreshOutOrderList3】SelectedOutOrder{SelectedOutOrder?.OrderNumber}", LogsType.Info);
|
||||
}
|
||||
}
|
||||
else if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
{
|
||||
Growl.Warning(Result.Message);
|
||||
}
|
||||
}
|
||||
else if (Result != null && !string.IsNullOrEmpty(Result.Message))
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Warning(Result.Message);
|
||||
Growl.Warning(ex.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Warning(ex.Message);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public void RefreshDataGridItemSource()
|
||||
{
|
||||
if (SelectedOutOrder == null)
|
||||
lock (flag)
|
||||
{
|
||||
//选择的单据为空无法进行查询
|
||||
return;
|
||||
if (SelectedOutOrder == null)
|
||||
{
|
||||
Logs.Write("【RefreshDataGridItemSource】选择的单据为空无法进行查询", LogsType.Info);
|
||||
SelectedOutOrder = OutOrderList?.FirstOrDefault();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#region 调用接口获取出库单物料明细
|
||||
Task.Run(() =>
|
||||
{
|
||||
Logs.Write($"【RefreshDataGridItemSource】{SelectedOutOrder?.OrderNumber}", LogsType.Info);
|
||||
|
||||
var body = new GetOutOrderDetailRequest()
|
||||
{
|
||||
OrderId = selectedOutOrder.Id,
|
||||
OrderNumber = selectedOutOrder.OrderNumber,
|
||||
OrderId = SelectedOutOrder.Id,
|
||||
OrderNumber = SelectedOutOrder.OrderNumber,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<OutOrderMatDetailModel>>>(LocalFile.Config.ApiIpHost + "outStore/getOutOrderMatDetail", body, "POST");
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseCommon<List<OutOrderMatDetailModel>>>(LocalFile.Config.ApiIpHost + "outStore/getOutOrderMatDetail", body, "POST", true);
|
||||
if (Result != null && Result.Code == 200)
|
||||
{
|
||||
if (Result.Data.Count > 0)
|
||||
{
|
||||
DataGridItemSource = new ObservableCollection<OutOrderMatDetailModel>(Result.Data);
|
||||
var list = Result.Data.OrderBy(t => t.IsSended).ToList();
|
||||
Logs.Write($"【RefreshDataGridItemSource】Result.Data.Count > 0{SelectedOutOrder?.OrderNumber}", LogsType.Info);
|
||||
//App.Current.Dispatcher.Invoke(() =>
|
||||
//{
|
||||
DataGridItemSource = new ObservableCollection<OutOrderMatDetailModel>(list);
|
||||
//});
|
||||
OrderStatus = Result.Message;
|
||||
if (OrderStatus == OutOrderStatus.全部发料.ToString())
|
||||
{
|
||||
@ -288,6 +334,7 @@ namespace 货架标准上位机.ViewModel
|
||||
}
|
||||
else
|
||||
{
|
||||
Logs.Write("【RefreshDataGridItemSource】Result.Data.Count <= 0,清空明细", LogsType.Info);
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
DataGridItemSource?.Clear();
|
||||
|
@ -15,6 +15,8 @@
|
||||
<TextBlock Name="txtCurrentShelf" HorizontalAlignment="Center"></TextBlock>
|
||||
<TextBlock HorizontalAlignment="Center">当前入库物料</TextBlock>
|
||||
<TextBlock Name="txtCurrentMat" HorizontalAlignment="Center"></TextBlock>
|
||||
<TextBlock HorizontalAlignment="Center">当前入库人</TextBlock>
|
||||
<TextBlock Name="txtInstoreUser" HorizontalAlignment="Center"></TextBlock>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
@ -28,12 +28,13 @@ namespace 货架标准上位机.Views.Controls
|
||||
txtCom.Text = COM;
|
||||
}
|
||||
|
||||
public void RefreshValues(string shelfCode, string matSn)
|
||||
public void RefreshValues(string shelfCode, string matSn,string instoreUser = "")
|
||||
{
|
||||
Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
txtCurrentShelf.Text = shelfCode;
|
||||
txtCurrentMat.Text = matSn;
|
||||
txtInstoreUser.Text = instoreUser;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,8 @@ namespace 货架标准上位机
|
||||
|
||||
viewModel.LoadTask();
|
||||
}
|
||||
|
||||
|
||||
private void vis(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (IsInDesignMode)
|
||||
|
@ -24,16 +24,14 @@
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Button
|
||||
Style="{StaticResource ButtonDanger}"
|
||||
Margin="10"
|
||||
PreviewKeyDown="Button_PreviewKeyDown"
|
||||
hc:BorderElement.CornerRadius="15"
|
||||
MinHeight="40"
|
||||
FontSize="20"
|
||||
MinHeight="42"
|
||||
FontSize="24"
|
||||
Content="结束所有入库"
|
||||
FontFamily="{StaticResource IconFont}"
|
||||
Command="{Binding BtnEndCommand}">
|
||||
|
@ -36,10 +36,7 @@ namespace 货架标准上位机
|
||||
t.ScannerDisplayControl = control;
|
||||
scannersWrapPanel.Children.Add(control);
|
||||
});
|
||||
|
||||
//ImageSource = new BitmapImage(new Uri("/Resources/goOutInstore.png"));
|
||||
}
|
||||
//public BitmapImage ImageSource { get; set; }
|
||||
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
|
||||
{
|
||||
DataGrid datagrid = sender as DataGrid;
|
||||
@ -60,7 +57,7 @@ namespace 货架标准上位机
|
||||
{
|
||||
if (IsInDesignMode)
|
||||
return;
|
||||
//viewModel.NewMethod();
|
||||
|
||||
}
|
||||
|
||||
private void UserControlBase_LoadedVisible(object sender, EventArgs e)
|
||||
|
226
货架标准上位机/Views/MainWindows/MainWindow2.xaml
Normal file
@ -0,0 +1,226 @@
|
||||
<hc:Window xmlns:View="clr-namespace:货架标准上位机" x:Class="货架标准上位机.MainWindow2"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:货架标准上位机"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:pi="https://github.com/ping9719/wpfex"
|
||||
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
mc:Ignorable="d"
|
||||
Title="{Binding Title}" NonClientAreaBackground="#FFDCEEFF" Height="800" Width="1280" Icon="/Resources/Logo.ico"
|
||||
Background="#FFDCEEFF" WindowStartupLocation="CenterScreen" Loaded="load">
|
||||
<!--标题栏-->
|
||||
<hc:Window.NonClientAreaContent>
|
||||
<StackPanel HorizontalAlignment="Right">
|
||||
<Menu Height="29" Background="#FFDCEEFF">
|
||||
<!--<MenuItem Height="29" Command="{Binding OpenUserCommand}" Visibility="{Binding IsLogin,Converter={StaticResource Boolean2VisibilityConverter}}">-->
|
||||
<MenuItem Height="29" Command="{Binding OpenUserCommand}">
|
||||
<MenuItem.Header>
|
||||
<TextBlock Text="{Binding LoginName,Source={x:Static local:UserInfoView.viewModel},TargetNullValue=登录}" Foreground="DimGray" Margin="-5,0"></TextBlock>
|
||||
</MenuItem.Header>
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<!--<MenuItem Height="29" Width="35" Header="">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontSize="15" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
<MenuItem Width="120" Header="蓝色">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" Foreground="Blue" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Width="120" Header="紫色">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" Foreground="Purple" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Width="120" Header="黑夜">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" Foreground="Black" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>-->
|
||||
<MenuItem Height="29" Width="35" Header="">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontSize="15" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
<MenuItem Width="120" Header="日志" Command="{Binding OpenLogCommand}">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Width="120" Header="帮助" Command="{Binding OpenHelpCommand}">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Width="120" Header="关于" Command="{Binding OpenWeCommand}">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="" FontSize="16" FontFamily="{StaticResource IconFont}"></TextBlock>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</StackPanel>
|
||||
</hc:Window.NonClientAreaContent>
|
||||
<!--内容-->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<!--菜单、内容-->
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!--菜单-->
|
||||
<Border Margin="5,3" Style="{StaticResource BorderRegion}" Padding="0" BorderThickness="1">
|
||||
<hc:TransitioningContentControl TransitionMode="Left2Right">
|
||||
<hc:SideMenu ExpandMode="ShowOne" SelectionChanged="menuSelect">
|
||||
<!--内部资源样式-->
|
||||
<hc:SideMenu.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="Image">
|
||||
<Setter Property="Width" Value="24"></Setter>
|
||||
<Setter Property="Height" Value="24"></Setter>
|
||||
</Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="FontFamily" Value="{StaticResource IconFont}"></Setter>
|
||||
<Setter Property="FontSize" Value="22"></Setter>
|
||||
<Setter Property="TextAlignment" Value="Center"></Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</hc:SideMenu.Resources>
|
||||
<!--列表-->
|
||||
<hc:SideMenuItem Header="主页" Tag="主页" IsSelected="True" MinWidth="140">
|
||||
<!--<hc:SideMenuItem.Icon>
|
||||
<Image Source="/Resources/主页.png"/>
|
||||
</hc:SideMenuItem.Icon>-->
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="设备" Tag="设备" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.调试},Converter={StaticResource AuthVisConverter}}">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Image Source="/Resources/模式.png"/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
<hc:SideMenuItem Header="PLC手动" Tag="PLC">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text=""/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="扫码枪" Tag="扫码枪">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text=""/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="数据" Tag="数据" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.调试},Converter={StaticResource AuthVisConverter}}">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Image Source="/Resources/数据.png"/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
<hc:SideMenuItem Header="统计信息" Tag="统计">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text=""/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="详情信息" Tag="详情">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text=""/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="权限" Tag="权限" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.权限},Converter={StaticResource AuthVisConverter}}">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Image Source="/Resources/权限.png"/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
<hc:SideMenuItem Header="用户" Tag="用户" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.调试},Converter={StaticResource AuthVisConverter}}">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text=""/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="角色" Tag="角色" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.调试},Converter={StaticResource AuthVisConverter}}">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text=""/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="设置" Tag="设置" Visibility="{Binding Auth,Source={x:Static local:UserInfoView.viewModel},ConverterParameter={x:Static local:AuthEnum.设置},Converter={StaticResource AuthVisConverter}}">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Image Source="/Resources/设置.png"/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenu>
|
||||
</hc:TransitioningContentControl>
|
||||
</Border>
|
||||
<!--内容-->
|
||||
<Border Margin="0,3,5,3" Grid.Column="1" Style="{StaticResource BorderRegion}" Padding="0" BorderThickness="1">
|
||||
<TabControl Style="{x:Null}" Margin="1,-3,1,1" BorderThickness="0" SelectedValue="{Binding SelectedValue}" SelectedValuePath="Header" PreviewKeyDown="tabControl_PreviewKeyDown">
|
||||
<TabItem Header="主页" IsSelected="True" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:HomeView />
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="PLC" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:DeviceView />
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="扫码枪" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<pi:TextBoxScanner Style="{StaticResource TextBoxExtend}" hc:InfoElement.Placeholder="鼠标点击此处激活" hc:InfoElement.Title="码信息" hc:InfoElement.TitlePlacement="Top" AutoClear="NextClear" IsAutoFocus="True" VerticalAlignment="Top"></pi:TextBoxScanner>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="统计" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:DataChartView/>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="详情" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:DataListView/>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="用户" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:UserView/>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="角色" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:RoleView/>
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
<TabItem Header="设置" Height="{Binding TabItemHeight}">
|
||||
<hc:TransitioningContentControl TransitionMode="Fade">
|
||||
<View:SetView />
|
||||
</hc:TransitioningContentControl>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Border>
|
||||
</Grid>
|
||||
<!--状态栏-->
|
||||
<Border Margin="5,3" Grid.Row="1" Grid.ColumnSpan="2" Background="AliceBlue" CornerRadius="3">
|
||||
<hc:TransitioningContentControl TransitionMode="Top2Bottom">
|
||||
<Grid>
|
||||
<StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||
<pi:IotState Content="PLC" IsOk="False" Height="auto" Width="auto" InteriorHeight="13" Foreground="Gray" Background="Transparent"></pi:IotState>
|
||||
<pi:IotState Content="机器人" IsOk="False" Height="auto" Width="auto" InteriorHeight="13" Foreground="Gray" Background="Transparent"></pi:IotState>
|
||||
<pi:IotState Content="数据库" IsOk="False" Height="auto" Width="auto" InteriorHeight="13" Foreground="Gray" Background="Transparent"></pi:IotState>
|
||||
<pi:IotState Content="错误" IsOk="False" Height="auto" Width="auto" InteriorHeight="13" Foreground="Gray" OkBrush="PaleVioletRed" Background="Transparent"></pi:IotState>
|
||||
<pi:SyncProgressBar SyncState="OkVisible" Margin="4,0,0,0" Width="130"></pi:SyncProgressBar>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<TextBlock Margin="0,0" Text="{Binding Time,StringFormat=yyyy-MM-dd HH:mm:ss,FallbackValue=2000-01-01 00:00:00}" Foreground="#FF3A90C1" VerticalAlignment="Center"></TextBlock>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</hc:TransitioningContentControl>
|
||||
</Border>
|
||||
<!--全局提示-->
|
||||
<ScrollViewer Background="{x:Null}" Grid.Row="0" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Right" VerticalAlignment="Top">
|
||||
<StackPanel Background="{x:Null}" hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,10" HorizontalAlignment="Right"/>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</hc:Window>
|
55
货架标准上位机/Views/MainWindows/MainWindow2.xaml.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
using HandyControl.Controls;
|
||||
using 货架标准上位机.ViewModel;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
/// <summary>
|
||||
/// MainWindow2.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MainWindow2 : HandyControl.Controls.Window
|
||||
{
|
||||
public static MainViewModel viewModel = MainWindow.viewModel;
|
||||
public MainWindow2()
|
||||
{
|
||||
if (!viewModel.InitAgo())
|
||||
this.Close();
|
||||
|
||||
InitializeComponent();
|
||||
this.DataContext = viewModel;
|
||||
}
|
||||
|
||||
private void load(object sender, RoutedEventArgs e)
|
||||
{
|
||||
viewModel.Init(this);
|
||||
}
|
||||
|
||||
private void tabControl_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
//取消tabControl快捷键切换
|
||||
if (e.Key == Key.LeftCtrl || e.Key == Key.LeftCtrl || e.Key == Key.Tab)
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void menuSelect(object sender, HandyControl.Data.FunctionEventArgs<object> e)
|
||||
{
|
||||
viewModel.SelectedValue = ((SideMenuItem)e.Info).Tag.ToString();
|
||||
}
|
||||
}
|
||||
}
|
@ -72,7 +72,7 @@
|
||||
<DataGrid.ContextMenu>
|
||||
<ContextMenu Name="dgmenu1" StaysOpen="true">
|
||||
<MenuItem Header="查询当前标定值/电压值" Click="MenuItem_Click"/>
|
||||
<MenuItem Header="手动标定" Click="MenuItem_Click"/>
|
||||
<MenuItem Header="标定+设置偏移量" Click="CalibrationOffset_Click"/>
|
||||
</ContextMenu>
|
||||
</DataGrid.ContextMenu>
|
||||
<DataGrid.Columns>
|
||||
|
@ -125,5 +125,17 @@ namespace 货架标准上位机
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
private void CalibrationOffset_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//获取选中得模组
|
||||
var module = viewModel.SelectedataGridItem;
|
||||
#region 弹出输入账号密码的窗口 输入偏移量的功能
|
||||
var window = new CalibrationWindow(module.BoardId,module.Id,module.ModuleCode);
|
||||
window.Owner = Application.Current.MainWindow;
|
||||
window.Topmost = true;
|
||||
window.ShowDialog();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
30
货架标准上位机/Views/Windows/CalibrationWindow.xaml
Normal file
@ -0,0 +1,30 @@
|
||||
<Window x:Class="货架标准上位机.CalibrationWindow"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Title="验证账号密码并标定" Height="440" Width="400" ResizeMode="NoResize" FontSize="25"
|
||||
PreviewKeyDown="Window_PreviewKeyDown" Icon="/Resources/Logo.ico" WindowStartupLocation="CenterScreen" >
|
||||
<Grid Background="AliceBlue">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="200"/>
|
||||
<RowDefinition Height="70"/>
|
||||
<RowDefinition Height="70"/>
|
||||
<RowDefinition Height="70"/>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel>
|
||||
<TextBlock Margin="5" Text="PCB板ID:13" Name="tagIdTxt"></TextBlock>
|
||||
<TextBlock Margin="5" Text="模组编码:A01-R1C1" Name="moduleCodeTxt"></TextBlock>
|
||||
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||
<TextBlock Margin="5" Text="偏差值:" Width="100" ></TextBlock>
|
||||
<TextBox Margin="5" Background="White" Width="100" Name="offSetTxt" ></TextBox>
|
||||
</StackPanel>
|
||||
<TextBlock Margin="5" Width="400" TextWrapping="Wrap" Foreground="Red" FontWeight="DemiBold" Text="请确认该模组物料全部下架后再标定!"></TextBlock>
|
||||
</StackPanel>
|
||||
<ComboBox x:Name="ComboBoxId" Grid.Row="1" Margin="20,10" Height="50" Width="220" IsEditable="True" hc:InfoElement.Placeholder="请输入账号" Style="{StaticResource ComboBoxExtend}" hc:InfoElement.ContentHeight="50"></ComboBox>
|
||||
<PasswordBox x:Name="PasswordBoxPass" Grid.Row="2" Height="50" Width="220" Margin="20,10" hc:InfoElement.Placeholder="请输入密码" Style="{StaticResource PasswordBoxExtend}"></PasswordBox>
|
||||
<Button Background="DarkRed" Content="验证账号密码并标定" Width="250" Foreground="White" FontSize="24" Height="55" Grid.Row="3" HorizontalAlignment="Stretch" Click="Button_Click"></Button>
|
||||
</Grid>
|
||||
</Window>
|
213
货架标准上位机/Views/Windows/CalibrationWindow.xaml.cs
Normal file
@ -0,0 +1,213 @@
|
||||
using HandyControl.Controls;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.StoreInfo;
|
||||
using WCS.Model.ApiModel.User;
|
||||
using 货架标准上位机.Api;
|
||||
|
||||
namespace 货架标准上位机
|
||||
{
|
||||
/// <summary>
|
||||
/// CalibrationWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class CalibrationWindow : System.Windows.Window
|
||||
{
|
||||
public int BoardId { get; set; }
|
||||
|
||||
public int ModuleId { get; set; }
|
||||
public string ModuleCode { get; set; }
|
||||
public CalibrationWindow(int boardId, int moduleId, string moduleCode)
|
||||
{
|
||||
InitializeComponent();
|
||||
BoardId = boardId;
|
||||
ModuleId = moduleId;
|
||||
tagIdTxt.Text = $"板ID:{boardId}";
|
||||
ModuleCode = moduleCode;
|
||||
moduleCodeTxt.Text = $"库位:{moduleCode}";
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
#region 输入框验证
|
||||
//偏差值输入框的验证
|
||||
var offSet = 0;
|
||||
try
|
||||
{
|
||||
offSet = Convert.ToInt32(offSetTxt.Text.Trim());
|
||||
if (offSet <= 0)
|
||||
{
|
||||
System.Windows.MessageBox.Show($"偏差值请输入大于0的自然数!", "提示");
|
||||
offSetTxt.Focus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.MessageBox.Show($"偏差值请输入大于0的自然数!", "提示");
|
||||
offSetTxt.Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
var loginName = ComboBoxId.Text.Trim();
|
||||
var pass = PasswordBoxPass.Password.ToString();
|
||||
|
||||
if (string.IsNullOrEmpty(loginName))
|
||||
{
|
||||
System.Windows.MessageBox.Show("请输入账号!", "提示");
|
||||
ComboBoxId.Focus();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(pass))
|
||||
{
|
||||
System.Windows.MessageBox.Show("请输入密码!", "提示");
|
||||
PasswordBoxPass.Focus();
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
try
|
||||
{
|
||||
#region 调用接口:验证账号密码
|
||||
var body = new UserLoginRequest()
|
||||
{
|
||||
UserName = loginName,
|
||||
DeviceType = LocalFile.Config.DeviceType + "标定",
|
||||
GroupNames = LocalFile.Config.GroupName,
|
||||
PassWord = pass,
|
||||
IsNoLogin = false,
|
||||
};
|
||||
var Result = ApiHelp.GetDataFromHttp<ResponseBase<UserModel>>(LocalFile.Config.ApiIpHost + "user/userLogin", body, "POST");
|
||||
if (Result != null && Result.Code != 200)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning(Result.Message, "提示");
|
||||
return;
|
||||
}
|
||||
else if (Result == null)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("登录失败:接口调用失败!", "提示");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Result.Data.IsAdmin && !Result.Data.IsGCYF)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Warning("登录成功!权限不足", "提示");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//此分支可以继续
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 调用接口:发送标定和设置偏移量指令
|
||||
try
|
||||
{
|
||||
var body1 = new CalibrationSetOffsetRequest()
|
||||
{
|
||||
MouduleIds = new List<int>() { ModuleId },
|
||||
OffSet = offSet,
|
||||
UserName = LocalStatic.CurrentUser,
|
||||
DeviceType = LocalFile.Config.DeviceType,
|
||||
};
|
||||
var Result1 = ApiHelp.GetDataFromHttp<ResponseCommon>(LocalFile.Config.ApiIpHost + "storeInfo/calibrationSetOffset", body1, "POST");
|
||||
if (Result1 != null && Result1.Code == 200)
|
||||
{
|
||||
Growl.Success("发送标定指令成功!");
|
||||
this.Close();
|
||||
}
|
||||
else if (Result != null)
|
||||
{
|
||||
Growl.Error(Result1.Message);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Growl.Error("操作失败:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Windows.MessageBox.Show(ex.Message, "错误");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
Button_Click(null, null);
|
||||
}
|
||||
else if (e.Key == Key.Escape)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string GetDataFromHttp(string data, string url, string httpMethod)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
|
||||
request.Method = httpMethod;
|
||||
request.ContentType = "application/json";
|
||||
if (!string.IsNullOrEmpty(data))
|
||||
{
|
||||
string strContent = data; //参数data
|
||||
using (StreamWriter dataStream = new StreamWriter(request.GetRequestStream()))
|
||||
{
|
||||
dataStream.Write(strContent);
|
||||
dataStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
string encoding = response.ContentEncoding;
|
||||
if (encoding == null || encoding.Length < 1)
|
||||
{
|
||||
encoding = "UTF-8"; //默认编码
|
||||
}
|
||||
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(encoding));
|
||||
string retString = reader.ReadToEnd();
|
||||
return retString;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class RootLogin
|
||||
{
|
||||
public int code { get; set; }
|
||||
|
||||
public string msg { get; set; }
|
||||
|
||||
public object data { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@ -62,7 +62,6 @@ namespace 货架标准上位机
|
||||
|
||||
public static void InitWarning()
|
||||
{
|
||||
//TODO 调用接口获取当前IP前端已接收未进行处理的异常,避免因前端重启造成异常无法处理
|
||||
#region 调用接口
|
||||
#endregion
|
||||
}
|
||||
|
@ -138,13 +138,18 @@ namespace 货架标准上位机
|
||||
scanner.ShelfCode = string.Empty;
|
||||
scanner.ModulesStr = string.Empty;
|
||||
|
||||
scanner.ScannerDisplayControl.RefreshValues(string.Empty, string.Empty);
|
||||
scanner.ScannerDisplayControl.RefreshValues(string.Empty, string.Empty, string.Empty);
|
||||
}
|
||||
client.Send(e.DataFrame.ToText());
|
||||
break;
|
||||
case WarningTypeEnum.通知自检进度:
|
||||
TextBoxLog.AddLog(warning.WarningMessage, "selfCheck", warning.CreateTime);
|
||||
client.Send(e.DataFrame.ToText());
|
||||
break;
|
||||
case WarningTypeEnum.自检未响应:
|
||||
TextBoxLog.AddLog(warning.WarningMessage, "selfCheck", warning.CreateTime);
|
||||
client.Send(e.DataFrame.ToText());
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
return;
|
||||
|
@ -2,11 +2,11 @@
|
||||
//连接不上加:SslMode=none;
|
||||
"MySql": "server=localhost;Database=db1;Uid=root;Pwd=123456;Convert Zero Datetime=True",
|
||||
//货架服务器的IP和端口号
|
||||
"ApiIpHost": "http://127.0.0.1:8888/",
|
||||
"ApiIpHost": "http://192.168.9.21:8888/",
|
||||
//WebSocket的地址
|
||||
"WebSocketUrl": "ws://127.0.0.1:7789/ws",
|
||||
"WebSocketUrl": "ws://192.168.9.21:7789/ws",
|
||||
//货架分区
|
||||
"GroupName": [ "C0" ],
|
||||
"GroupName": [ "A0-2" ],
|
||||
//设备类型 可以配置为每个电脑不一样
|
||||
"DeviceType": "WCS前端",
|
||||
//货架类型的是否开机自检
|
||||
@ -16,7 +16,7 @@
|
||||
//串口扫码枪延时
|
||||
"ScannerTimeOut": 2000,
|
||||
//盟讯公司配置-是否是盟讯
|
||||
"IsMX": false,
|
||||
"IsMX": true,
|
||||
//盟讯公司配置-获取要料单
|
||||
"GetPickOrderUrl": "http://192.168.2.23:9289/integrate/inOut/missPickListR",
|
||||
//盟讯公司配置-获取要料明细接口
|
||||
|