@ -25,11 +25,11 @@ using System.Linq;
using System.Text ;
using System.Text ;
using System.Threading ;
using System.Threading ;
using System.Threading.Tasks ;
using System.Threading.Tasks ;
using Z.EntityFramework.Plus ;
using System.Windows.Threading ;
using System.Windows.Input ;
using System.Windows ;
using System.Windows ;
using System.Windows.Controls ;
using System.Windows.Controls ;
using System.Windows.Input ;
using System.Windows.Threading ;
using Z.EntityFramework.Plus ;
namespace Khd.Core.Wpf.Form
namespace Khd.Core.Wpf.Form
{
{
@ -107,23 +107,28 @@ namespace Khd.Core.Wpf.Form
{
{
try
try
{
{
foreach ( var plcConfig in SystemData . PlcConfigs )
Task . Run ( ( ) = >
{
{
if ( ! SystemData . PlcDic . Any ( t = > t . Key = = plcConfig . Code ) )
foreach ( var plcConfig in SystemData . PlcConfigs )
{
{
Plc . S7 . Plc plc ;
if ( ! SystemData . PlcDic . Any ( t = > t . Key = = plcConfig . Code ) )
plc = new Plc . S7 . Plc ( plcConfig . CpuType , plcConfig . IP , plcConfig . Port , plcConfig . Rack , plcConfig . Slot ) ;
{
//try
Plc . S7 . Plc plc ;
//{
plc = new Plc . S7 . Plc ( plcConfig . CpuType , plcConfig . IP , plcConfig . Port , plcConfig . Rack , plcConfig . Slot ) ;
// plc.Open();
//try
//}
//{
//catch (Exception ex)
// plc.Open();
//{
//}
// LogManager.Error(ex);
//catch (Exception ex)
//}
//{
SystemData . PlcDic . TryAdd ( plcConfig . Code , plc ) ;
// LogManager.Error(ex);
}
//}
} ;
SystemData . PlcDic . TryAdd ( plcConfig . Code , plc ) ;
}
} ;
} ) ;
GetMenu ( ) ;
GetMenu ( ) ;
DispatcherTimer dispatcherTimer = new DispatcherTimer ( ) ;
DispatcherTimer dispatcherTimer = new DispatcherTimer ( ) ;
@ -195,7 +200,7 @@ namespace Khd.Core.Wpf.Form
}
}
catch ( Exception ex )
catch ( Exception ex )
{
{
MessageBox. Show ( "条码枪连接失败" ) ;
HandyControl. Controls . MessageBox . Error ( "条码枪连接失败" ) ;
}
}
@ -229,7 +234,7 @@ namespace Khd.Core.Wpf.Form
// //plc.Open();
// //plc.Open();
// //if (!plc.IsConnected)
// //if (!plc.IsConnected)
// //{
// //{
// // MessageBox.Show("PLC连接失败,重新连接");
// // HandyControl.Controls. MessageBox.Show("PLC连接失败,重新连接");
// //}
// //}
// //else
// //else
// //{
// //{
@ -262,7 +267,7 @@ namespace Khd.Core.Wpf.Form
}
}
catch ( Exception ex )
catch ( Exception ex )
{
{
MessageBox. Show ( ex . Message ) ;
HandyControl. Controls . MessageBox . Error ( ex . Message ) ;
}
}
}
}
@ -498,7 +503,7 @@ namespace Khd.Core.Wpf.Form
/// <param name="e"></param>
/// <param name="e"></param>
private void btnExit_Click ( object sender , RoutedEventArgs e )
private void btnExit_Click ( object sender , RoutedEventArgs e )
{
{
if ( MessageBox. Show ( "是否确认关闭程序" , "提示信息" , MessageBoxButton . YesNo , MessageBoxImage . Information ) = = MessageBoxResult . Yes )
if ( HandyControl. Controls . MessageBox. Show ( "是否确认关闭程序" , "提示信息" , MessageBoxButton . YesNo , MessageBoxImage . Information ) = = MessageBoxResult . Yes )
{
{
System . Environment . Exit ( System . Environment . ExitCode ) ;
System . Environment . Exit ( System . Environment . ExitCode ) ;
}
}
@ -542,7 +547,7 @@ namespace Khd.Core.Wpf.Form
// this.WcsTaskLogDataGrid.Items.Refresh();
// this.WcsTaskLogDataGrid.Items.Refresh();
// if (wcsTaskLogs.Count == 0)
// if (wcsTaskLogs.Count == 0)
// {
// {
// MessageBox.Show("未查询到数据");
// HandyControl.Controls. MessageBox.Show("未查询到数据");
// }
// }
// }
// }
// catch (Exception ex)
// catch (Exception ex)
@ -557,7 +562,7 @@ namespace Khd.Core.Wpf.Form
// }
// }
// catch
// catch
// {
// {
// MessageBox.Show("PLC连接失败,无法读取任务");
// HandyControl.Controls. MessageBox.Show("PLC连接失败,无法读取任务");
// }
// }
// }
// }
// }
// }
@ -598,7 +603,7 @@ namespace Khd.Core.Wpf.Form
this . LoadMaterial0 . Items . Refresh ( ) ;
this . LoadMaterial0 . Items . Refresh ( ) ;
if ( data . Count = = 0 )
if ( data . Count = = 0 )
{
{
MessageBox. Show ( "未查询到数据" ) ;
HandyControl. Controls . MessageBox. Show ( "未查询到数据" ) ;
}
}
}
}
/// <summary>
/// <summary>
@ -610,12 +615,12 @@ namespace Khd.Core.Wpf.Form
{
{
if ( LoadMaterial0 . SelectedIndex = = - 1 )
if ( LoadMaterial0 . SelectedIndex = = - 1 )
{
{
MessageBox. Show ( "请选择要删除的任务!" ) ;
HandyControl. Controls . MessageBox. Show ( "请选择要删除的任务!" ) ;
}
}
else
else
{
{
MessageBoxResult messageBoxResult = MessageBox . Show ( "确定要删除这些任务吗?" , "提示信息" , MessageBoxButton . YesNo ) ;
MessageBoxResult MessageBoxResult = HandyControl . Controls . MessageBox . Show ( "确定要删除这些任务吗?" , "提示信息" , MessageBoxButton . YesNo ) ;
if ( m essageBoxResult = = MessageBoxResult . Yes )
if ( M essageBoxResult = = MessageBoxResult . Yes )
{
{
using var scope = _host . Services . CreateScope ( ) ;
using var scope = _host . Services . CreateScope ( ) ;
using var dbContext = scope . ServiceProvider . GetRequiredService < DefaultDbContext > ( ) ;
using var dbContext = scope . ServiceProvider . GetRequiredService < DefaultDbContext > ( ) ;
@ -653,7 +658,7 @@ namespace Khd.Core.Wpf.Form
{
{
if ( LoadMaterial0 . SelectedIndex = = - 1 )
if ( LoadMaterial0 . SelectedIndex = = - 1 )
{
{
MessageBox. Show ( "请选择要完成的任务!" ) ;
HandyControl. Controls . MessageBox. Show ( "请选择要完成的任务!" ) ;
}
}
else
else
{
{
@ -683,7 +688,7 @@ namespace Khd.Core.Wpf.Form
this . LoadMaterial3 . Items . Refresh ( ) ;
this . LoadMaterial3 . Items . Refresh ( ) ;
if ( data . Count = = 0 )
if ( data . Count = = 0 )
{
{
MessageBox. Show ( "未查询到数据" ) ;
HandyControl. Controls . MessageBox. Show ( "未查询到数据" ) ;
}
}
}
}
/// <summary>
/// <summary>
@ -734,12 +739,12 @@ namespace Khd.Core.Wpf.Form
this . LoadMaterial1 . Items . Refresh ( ) ;
this . LoadMaterial1 . Items . Refresh ( ) ;
if ( data . Count = = 0 )
if ( data . Count = = 0 )
{
{
MessageBox. Show ( "未查询到数据" ) ;
HandyControl. Controls . MessageBox. Show ( "未查询到数据" ) ;
}
}
}
}
else
else
{
{
MessageBox. Show ( "请选择仓库!" ) ;
HandyControl. Controls . MessageBox. Show ( "请选择仓库!" ) ;
return ;
return ;
}
}
}
}
@ -764,7 +769,7 @@ namespace Khd.Core.Wpf.Form
// this.LoadMaterial.Items.Refresh();
// this.LoadMaterial.Items.Refresh();
// if (data.Count == 0)
// if (data.Count == 0)
// {
// {
// MessageBox.Show("未查询到数据");
// HandyControl.Controls. MessageBox.Show("未查询到数据");
// }
// }
//}
//}
///// <summary>
///// <summary>
@ -776,7 +781,7 @@ namespace Khd.Core.Wpf.Form
//{
//{
// if (LoadMaterial.SelectedIndex == -1)
// if (LoadMaterial.SelectedIndex == -1)
// {
// {
// MessageBox.Show("请选择要删除的指令!");
// HandyControl.Controls. MessageBox.Show("请选择要删除的指令!");
// }
// }
// else
// else
// {
// {
@ -798,7 +803,7 @@ namespace Khd.Core.Wpf.Form
//{
//{
// if (LoadMaterial.SelectedIndex == -1)
// if (LoadMaterial.SelectedIndex == -1)
// {
// {
// MessageBox.Show("请选择要重发的指令!");
// HandyControl.Controls. MessageBox.Show("请选择要重发的指令!");
// }
// }
// else
// else
// {
// {
@ -843,11 +848,11 @@ namespace Khd.Core.Wpf.Form
// };
// };
// dbContext.Add(wmsRawOutstock);
// dbContext.Add(wmsRawOutstock);
// dbContext.SaveChanges();
// dbContext.SaveChanges();
// MessageBox.Show("料箱呼叫任务添加成功!");
// HandyControl.Controls. MessageBox.Show("料箱呼叫任务添加成功!");
// }
// }
// else
// else
// {
// {
// MessageBox.Show("请输入有效的数字");
// HandyControl.Controls. MessageBox.Show("请输入有效的数字");
// }
// }
// }
// }
// }
// }
@ -886,7 +891,7 @@ namespace Khd.Core.Wpf.Form
// var mesInfo = dbContext.MesBaseBarcodeInfo.Where(t => t.barcodeInfo == txtBarCode.Text).FirstOrDefault();
// var mesInfo = dbContext.MesBaseBarcodeInfo.Where(t => t.barcodeInfo == txtBarCode.Text).FirstOrDefault();
// if (mesInfo == null)
// if (mesInfo == null)
// {
// {
// MessageBox.Show("请扫描正确的条码");
// HandyControl.Controls. MessageBox.Show("请扫描正确的条码");
// return;
// return;
// }
// }
// barcodeLsit.Add(mesInfo);
// barcodeLsit.Add(mesInfo);
@ -914,12 +919,12 @@ namespace Khd.Core.Wpf.Form
// var box = txtBox.Text;
// var box = txtBox.Text;
// if (string.IsNullOrEmpty(box))
// if (string.IsNullOrEmpty(box))
// {
// {
// MessageBox.Show("容器号不能为空!");
// HandyControl.Controls. MessageBox.Show("容器号不能为空!");
// return;
// return;
// }
// }
// if (barcodeLsit.Count == 0)
// if (barcodeLsit.Count == 0)
// {
// {
// MessageBox.Show("未扫描条码!");
// HandyControl.Controls. MessageBox.Show("未扫描条码!");
// return;
// return;
// }
// }
// using var scope = _host.Services.CreateScope();
// using var scope = _host.Services.CreateScope();
@ -927,7 +932,7 @@ namespace Khd.Core.Wpf.Form
// WmsBaseLocation? wmsBaseLocation = dbContext.WmsBaseLocation.Where(t => t.warehouseId == 512 && t.containerCode == box).FirstOrDefault();
// WmsBaseLocation? wmsBaseLocation = dbContext.WmsBaseLocation.Where(t => t.warehouseId == 512 && t.containerCode == box).FirstOrDefault();
// if (wmsBaseLocation == null)
// if (wmsBaseLocation == null)
// {
// {
// MessageBox.Show("容器号不存在!,请重新扫描!");
// HandyControl.Controls. MessageBox.Show("容器号不存在!,请重新扫描!");
// return;
// return;
// }
// }
// if (cbxType.Text == "入库")
// if (cbxType.Text == "入库")
@ -938,7 +943,7 @@ namespace Khd.Core.Wpf.Form
// .Where(t => t.warehouseFloor == 5 && t.warehouseId == 512).ToList();
// .Where(t => t.warehouseFloor == 5 && t.warehouseId == 512).ToList();
// if (wmsRawStocks.Count > 0)
// if (wmsRawStocks.Count > 0)
// {
// {
// MessageBox.Show("该批次已入库!");
// HandyControl.Controls. MessageBox.Show("该批次已入库!");
// return;
// return;
// }
// }
// foreach (var item in barcodeLsit)
// foreach (var item in barcodeLsit)
@ -973,12 +978,12 @@ namespace Khd.Core.Wpf.Form
// }
// }
// else
// else
// {
// {
// MessageBox.Show("该批次已入库!");
// HandyControl.Controls. MessageBox.Show("该批次已入库!");
// return;
// return;
// }
// }
// }
// }
// dbContext.SaveChanges();
// dbContext.SaveChanges();
// MessageBox.Show("入库成功!");
// HandyControl.Controls. MessageBox.Show("入库成功!");
// }
// }
// if (cbxType.Text == "出库")
// if (cbxType.Text == "出库")
// {
// {
@ -1008,7 +1013,7 @@ namespace Khd.Core.Wpf.Form
// }
// }
// else
// else
// {
// {
// MessageBox.Show("当前容器不存在当前扫描物料");
// HandyControl.Controls. MessageBox.Show("当前容器不存在当前扫描物料");
// }
// }
// }
// }
@ -1021,7 +1026,7 @@ namespace Khd.Core.Wpf.Form
// .Where(t => t.warehouseFloor == 5 && t.warehouseId == 512).ToList();
// .Where(t => t.warehouseFloor == 5 && t.warehouseId == 512).ToList();
// if (wmsRawStocks.Count > 0)
// if (wmsRawStocks.Count > 0)
// {
// {
// MessageBox.Show("该批次已入库!");
// HandyControl.Controls. MessageBox.Show("该批次已入库!");
// return;
// return;
// }
// }
// foreach (var item in barcodeLsit)
// foreach (var item in barcodeLsit)
@ -1056,12 +1061,12 @@ namespace Khd.Core.Wpf.Form
// }
// }
// else
// else
// {
// {
// MessageBox.Show("该批次已入库!");
// HandyControl.Controls. MessageBox.Show("该批次已入库!");
// return;
// return;
// }
// }
// }
// }
// dbContext.SaveChanges();
// dbContext.SaveChanges();
// MessageBox.Show("回库成功!");
// HandyControl.Controls. MessageBox.Show("回库成功!");
// }
// }
// barcodeLsit.Clear();
// barcodeLsit.Clear();
// txtScan.Text = string.Empty;
// txtScan.Text = string.Empty;
@ -1080,7 +1085,7 @@ namespace Khd.Core.Wpf.Form
/// <param name="e"></param>
/// <param name="e"></param>
private void WindowClose_Click ( object sender , RoutedEventArgs e )
private void WindowClose_Click ( object sender , RoutedEventArgs e )
{
{
if ( MessageBox. Show ( "是否确认关闭程序" , "提示信息" , MessageBoxButton . YesNo , MessageBoxImage . Information ) = = MessageBoxResult . Yes )
if ( HandyControl. Controls . MessageBox. Show ( "是否确认关闭程序" , "提示信息" , MessageBoxButton . YesNo , MessageBoxImage . Information ) = = MessageBoxResult . Yes )
{
{
System . Environment . Exit ( System . Environment . ExitCode ) ;
System . Environment . Exit ( System . Environment . ExitCode ) ;
}
}
@ -1105,7 +1110,7 @@ namespace Khd.Core.Wpf.Form
}
}
catch ( Exception ex )
catch ( Exception ex )
{
{
MessageBox. Show ( "打开软键盘时出错: " + ex . Message ) ;
HandyControl. Controls . MessageBox . Error ( "打开软键盘时出错: " + ex . Message ) ;
}
}
}
}
/// <summary>
/// <summary>
@ -1126,7 +1131,7 @@ namespace Khd.Core.Wpf.Form
}
}
catch ( Exception ex )
catch ( Exception ex )
{
{
MessageBox. Show ( "打开软键盘时出错: " + ex . Message ) ;
HandyControl. Controls . MessageBox . Error ( "打开软键盘时出错: " + ex . Message ) ;
}
}
}
}
/// <summary>
/// <summary>
@ -1149,7 +1154,7 @@ namespace Khd.Core.Wpf.Form
. FirstOrDefault ( ) ;
. FirstOrDefault ( ) ;
if ( wcsCmd = = null )
if ( wcsCmd = = null )
{
{
MessageBox. Show ( "未查询到当前有背负式Agv由装配区到捡料区任务" ) ;
HandyControl. Controls . MessageBox . Error ( "未查询到当前有背负式Agv由装配区到捡料区任务" ) ;
}
}
else
else
{
{
@ -1169,12 +1174,12 @@ namespace Khd.Core.Wpf.Form
}
}
dbContext . Update ( wcsCmd ) ;
dbContext . Update ( wcsCmd ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "背负式Agv任务确认完成成功" ) ;
HandyControl. Controls . MessageBox . Success ( "背负式Agv任务确认完成成功" ) ;
}
}
}
}
catch ( Exception ex )
catch ( Exception ex )
{
{
MessageBox. Show ( ex . Message ) ;
HandyControl. Controls . MessageBox . Error ( ex . Message ) ;
}
}
}
}
/// <summary>
/// <summary>
@ -1232,7 +1237,7 @@ namespace Khd.Core.Wpf.Form
// var material = dbContext.WmsRawStock.Where(t => t.instockBatch == callMaterialId.Text).FirstOrDefault();
// var material = dbContext.WmsRawStock.Where(t => t.instockBatch == callMaterialId.Text).FirstOrDefault();
// if (material == null)
// if (material == null)
// {
// {
// MessageBox.Show("批次号不存在!");
// HandyControl.Controls. MessageBox.Show("批次号不存在!");
// callMaterialId.Text = string.Empty;
// callMaterialId.Text = string.Empty;
// }
// }
// else
// else
@ -1258,7 +1263,7 @@ namespace Khd.Core.Wpf.Form
{
{
if ( LoadMaterial0 . SelectedIndex = = - 1 )
if ( LoadMaterial0 . SelectedIndex = = - 1 )
{
{
MessageBox. Show ( "请选择要开始的任务!" ) ;
HandyControl. Controls . MessageBox. Show ( "请选择要开始的任务!" ) ;
}
}
else
else
{
{
@ -1284,7 +1289,7 @@ namespace Khd.Core.Wpf.Form
}
}
catch ( Exception ex )
catch ( Exception ex )
{
{
MessageBox. Show ( ex . Message ) ;
HandyControl. Controls . MessageBox . Error ( ex . Message ) ;
}
}
}
}
@ -1410,14 +1415,14 @@ namespace Khd.Core.Wpf.Form
WcsTask ? wcsTask = dbContext . WcsTask . FirstOrDefault ( t = > t . nextPointId = = 11 & & t . taskType = = 29 ) ;
WcsTask ? wcsTask = dbContext . WcsTask . FirstOrDefault ( t = > t . nextPointId = = 11 & & t . taskType = = 29 ) ;
if ( wcsTask = = null )
if ( wcsTask = = null )
{
{
MessageBox. Show ( "未查询到当前有CTU入库任务!" ) ;
HandyControl. Controls . MessageBox . Info ( "未查询到当前有CTU入库任务!" ) ;
}
}
else
else
{
{
wcsTask . CTUExecute = "1" ;
wcsTask . CTUExecute = "1" ;
dbContext . WcsTask . Update ( wcsTask ) ;
dbContext . WcsTask . Update ( wcsTask ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "CTU入库任务确认完成成功!" ) ;
HandyControl. Controls . MessageBox . Info ( "CTU入库任务确认完成成功!" ) ;
}
}
}
}
catch
catch
@ -1467,14 +1472,14 @@ namespace Khd.Core.Wpf.Form
using var dbContext = scope . ServiceProvider . GetRequiredService < DefaultDbContext > ( ) ;
using var dbContext = scope . ServiceProvider . GetRequiredService < DefaultDbContext > ( ) ;
if ( txtInScan . Text = = "" )
if ( txtInScan . Text = = "" )
{
{
MessageBox. Show ( "请先输入数量" ) ; return ;
HandyControl. Controls . MessageBox . Error ( "请先输入数量" ) ; return ;
}
}
decimal amount = decimal . Parse ( txtInScan . Text ) ;
decimal amount = decimal . Parse ( txtInScan . Text ) ;
// 计算入库后当前总数量,仅用来提示使用
// 计算入库后当前总数量,仅用来提示使用
decimal? totalMessage = 0 ;
decimal? totalMessage = 0 ;
if ( amount < = 0 )
if ( amount < = 0 )
{
{
MessageBox. Show ( "入库数量需大于0" ) ;
HandyControl. Controls . MessageBox . Error ( "入库数量需大于0" ) ;
return ;
return ;
}
}
var material = dbContext . MesBaseBarcodeInfo . FirstOrDefault ( t = > t . barcodeInfo = = txtInBarCode . Text ) ;
var material = dbContext . MesBaseBarcodeInfo . FirstOrDefault ( t = > t . barcodeInfo = = txtInBarCode . Text ) ;
@ -1516,13 +1521,12 @@ namespace Khd.Core.Wpf.Form
}
}
else
else
{
{
WmsRawStock wmsRawStock = wmsRawStocks . First OrDefault ( ) ;
WmsRawStock wmsRawStock = wmsRawStocks . First ( ) ;
wmsRawStock . totalAmount + = amount ;
wmsRawStock . totalAmount + = amount ;
dbContext . WmsRawStock . Update ( wmsRawStock ) ;
dbContext . WmsRawStock . Update ( wmsRawStock ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
totalMessage = wmsRawStock . totalAmount ;
totalMessage = wmsRawStock . totalAmount ;
}
}
}
}
else
else
{
{
@ -1563,7 +1567,7 @@ namespace Khd.Core.Wpf.Form
}
}
else
else
{
{
MsgText . Text = "请先扫描容器号和条码!" ;
MsgText . Text = "请先扫描容器号和条码!" ;
}
}
}
}
catch ( Exception ex )
catch ( Exception ex )
@ -1593,7 +1597,7 @@ namespace Khd.Core.Wpf.Form
WmsRawReturn ? wmsRawReturn = dbContext . WmsRawReturn . Where ( t = > t . executeStatus = = "1" ) . FirstOrDefault ( ) ;
WmsRawReturn ? wmsRawReturn = dbContext . WmsRawReturn . Where ( t = > t . executeStatus = = "1" ) . FirstOrDefault ( ) ;
if ( wmsRawReturn = = null )
if ( wmsRawReturn = = null )
{
{
MessageBox. Show ( "未查询到退库任务!" ) ;
HandyControl. Controls . MessageBox. Show ( "未查询到退库任务!" ) ;
return ;
return ;
}
}
var material = dbContext . MesBaseBarcodeInfo . FirstOrDefault ( t = > t . barcodeInfo = = txtInBarCode . Text ) ;
var material = dbContext . MesBaseBarcodeInfo . FirstOrDefault ( t = > t . barcodeInfo = = txtInBarCode . Text ) ;
@ -1603,20 +1607,20 @@ namespace Khd.Core.Wpf.Form
. Where ( t = > t . warehouseFloor = = 5 & & t . warehouseId = = 512 ) . ToList ( ) ;
. Where ( t = > t . warehouseFloor = = 5 & & t . warehouseId = = 512 ) . ToList ( ) ;
if ( wmsRawStocks . Count > 0 )
if ( wmsRawStocks . Count > 0 )
{
{
MessageBox. Show ( $"该条码已入库!料箱号为{wmsRawStocks.First().palletInfoCode},库位号为{wmsRawStocks.First().locationCode}" ) ;
HandyControl. Controls . MessageBox . Info ( $"该条码已入库!料箱号为{wmsRawStocks.First().palletInfoCode},库位号为{wmsRawStocks.First().locationCode}" ) ;
txtInBarCode . Text = string . Empty ;
txtInBarCode . Text = string . Empty ;
txtInScan . Text = string . Empty ;
txtInScan . Text = string . Empty ;
return ;
return ;
}
}
if ( container = = null )
if ( container = = null )
{
{
MessageBox. Show ( "未查询到该容器!" ) ;
HandyControl. Controls . MessageBox . Error ( "未查询到该容器!" ) ;
txtInBox . Text = string . Empty ;
txtInBox . Text = string . Empty ;
return ;
return ;
}
}
if ( material = = null )
if ( material = = null )
{
{
MessageBox. Show ( "未查询到该条码内容!" ) ;
HandyControl. Controls . MessageBox . Error ( "未查询到该条码内容!" ) ;
txtInBarCode . Text = string . Empty ;
txtInBarCode . Text = string . Empty ;
txtInScan . Text = string . Empty ;
txtInScan . Text = string . Empty ;
return ;
return ;
@ -1645,20 +1649,20 @@ namespace Khd.Core.Wpf.Form
} ;
} ;
dbContext . WmsRawStock . Add ( newRawStock ) ;
dbContext . WmsRawStock . Add ( newRawStock ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "入库成功!" ) ;
HandyControl. Controls . MessageBox . Success ( "入库成功!" ) ;
txtInBarCode . Text = string . Empty ;
txtInBarCode . Text = string . Empty ;
txtInScan . Text = string . Empty ;
txtInScan . Text = string . Empty ;
txtInBarCode . Focus ( ) ;
txtInBarCode . Focus ( ) ;
}
}
else
else
{
{
MessageBox. Show ( "请先扫描容器号和条码!" ) ;
HandyControl. Controls . MessageBox . Info ( "请先扫描容器号和条码!" ) ;
}
}
}
}
catch ( Exception ex )
catch ( Exception ex )
{
{
LogManager . Error ( ex ) ;
LogManager . Error ( ex ) ;
MessageBox. Show ( "入库失败" ) ;
HandyControl. Controls . MessageBox . Error ( "入库失败" ) ;
}
}
}
}
/// <summary>
/// <summary>
@ -1673,7 +1677,7 @@ namespace Khd.Core.Wpf.Form
string containerCode = txtInBox . Text ;
string containerCode = txtInBox . Text ;
if ( containerCode . Length > = 1 ) MsgText . Text = string . Empty ;
if ( containerCode . Length > = 1 ) MsgText . Text = string . Empty ;
if ( containerCode . Length < 15 )
if ( containerCode . Length < 15 )
return ;
return ;
if ( ! string . IsNullOrEmpty ( containerCode ) )
if ( ! string . IsNullOrEmpty ( containerCode ) )
{
{
@ -1871,19 +1875,19 @@ namespace Khd.Core.Wpf.Form
. FirstOrDefault ( t = > t . instockBatch = = txtOutBarCode . Text & & t . palletInfoCode = = txtOutBox . Text ) ;
. FirstOrDefault ( t = > t . instockBatch = = txtOutBarCode . Text & & t . palletInfoCode = = txtOutBox . Text ) ;
if ( wmsRawStock = = null )
if ( wmsRawStock = = null )
{
{
MessageBox. Show ( "库存已经被清空!" ) ;
HandyControl. Controls . MessageBox . Error ( "库存已经被清空!" ) ;
return ;
return ;
}
}
decimal outScan = Convert . ToDecimal ( this . txtOutScan . Text ) ;
decimal outScan = Convert . ToDecimal ( this . txtOutScan . Text ) ;
if ( outScan ! = 1 & & outScan > wmsRawStock . totalAmount - wmsRawStock . frozenAmount )
if ( outScan ! = 1 & & outScan > wmsRawStock . totalAmount - wmsRawStock . frozenAmount )
{
{
MessageBox. Show ( "出库数量不能大于库存数量!" ) ;
HandyControl. Controls . MessageBox . Error ( "出库数量不能大于库存数量!" ) ;
return ;
return ;
}
}
var wcsTask = dbContext . WcsTask . Where ( t = > t . containerNo = = txtOutBox . Text ) . FirstOrDefault ( ) ;
var wcsTask = dbContext . WcsTask . Where ( t = > t . containerNo = = txtOutBox . Text ) . FirstOrDefault ( ) ;
if ( wcsTask = = null )
if ( wcsTask = = null )
{
{
MessageBox. Show ( "出库失败, 非CTU出库任务, 无法出库!" ) ;
HandyControl. Controls . MessageBox . Error ( "出库失败, 非CTU出库任务, 无法出库!" ) ;
return ;
return ;
}
}
else
else
@ -1902,7 +1906,7 @@ namespace Khd.Core.Wpf.Form
}
}
else if ( wmsRawOutstock . realOutstockAmount > wmsRawOutstock . outstockAmount )
else if ( wmsRawOutstock . realOutstockAmount > wmsRawOutstock . outstockAmount )
{
{
MessageBox. Show ( "出库数量不能大于申请单数量,当前出库数量为:" + ( wmsRawOutstock . realOutstockAmount - outScan ) + ",申请单数量为:" + wmsRawOutstock . outstockAmount + "!" ) ;
HandyControl. Controls . MessageBox . Error ( "出库数量不能大于申请单数量,当前出库数量为:" + ( wmsRawOutstock . realOutstockAmount - outScan ) + ",申请单数量为:" + wmsRawOutstock . outstockAmount + "!" ) ;
return ;
return ;
}
}
wmsRawStock . totalAmount - = outScan ;
wmsRawStock . totalAmount - = outScan ;
@ -1961,27 +1965,27 @@ namespace Khd.Core.Wpf.Form
}
}
else
else
{
{
MessageBox. Show ( "该条码的销售订单不正确" ) ;
HandyControl. Controls . MessageBox . Error ( "该条码的销售订单不正确" ) ;
txtOutScan . Text = string . Empty ;
txtOutScan . Text = string . Empty ;
txtOutBarCode . Text = string . Empty ;
txtOutBarCode . Text = string . Empty ;
return ;
return ;
}
}
}
}
MessageBox. Show ( "出库成功!" ) ;
HandyControl. Controls . MessageBox . Success ( "出库成功!" ) ;
txtOutScan . Text = string . Empty ;
txtOutScan . Text = string . Empty ;
txtOutBarCode . Text = string . Empty ;
txtOutBarCode . Text = string . Empty ;
txtOutBarCode . Focus ( ) ;
txtOutBarCode . Focus ( ) ;
}
}
else
else
{
{
MessageBox. Show ( "未查询到该条码信息!" ) ;
HandyControl. Controls . MessageBox . Error ( "未查询到该条码信息!" ) ;
}
}
}
}
}
}
else
else
{
{
MessageBox. Show ( "请先扫描容器号和条码!" ) ;
HandyControl. Controls . MessageBox . Info ( "请先扫描容器号和条码!" ) ;
}
}
}
}
/// <summary>
/// <summary>
@ -2079,7 +2083,7 @@ namespace Khd.Core.Wpf.Form
Pagination2 . MaxPageCount = ( sum / pageCount ) + ( sum % pageCount = = 0 ? 0 : 1 ) ;
Pagination2 . MaxPageCount = ( sum / pageCount ) + ( sum % pageCount = = 0 ? 0 : 1 ) ;
if ( bills . Count = = 0 )
if ( bills . Count = = 0 )
{
{
MessageBox. Show ( "未查询到数据" ) ;
HandyControl. Controls . MessageBox. Show ( "未查询到数据" ) ;
}
}
}
}
catch
catch
@ -2240,21 +2244,21 @@ namespace Khd.Core.Wpf.Form
dbContext . AddRange ( addCheckDetail ) ;
dbContext . AddRange ( addCheckDetail ) ;
dbContext . AddRange ( addList ) ;
dbContext . AddRange ( addList ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "任务创建成功!" ) ;
HandyControl. Controls . MessageBox. Show ( "任务创建成功!" ) ;
}
}
else
else
{
{
MessageBox. Show ( "无可盘点库位!" ) ;
HandyControl. Controls . MessageBox . Error ( "无可盘点库位!" ) ;
}
}
}
}
else
else
{
{
MessageBox. Show ( "当前有盘点任务正在出库" ) ;
HandyControl. Controls . MessageBox . Info ( "当前有盘点任务正在出库" ) ;
}
}
}
}
else
else
{
{
MessageBox. Show ( "当前有盘点任务正在出库" ) ;
HandyControl. Controls . MessageBox . Info ( "当前有盘点任务正在出库" ) ;
}
}
}
}
}
}
@ -2281,7 +2285,7 @@ namespace Khd.Core.Wpf.Form
//int taskCount = dbContext.WcsTask.Where(t => t.taskType == 30).Count();
//int taskCount = dbContext.WcsTask.Where(t => t.taskType == 30).Count();
//if (taskCount >= 6)
//if (taskCount >= 6)
//{
//{
// HandyControl.Controls. MessageBox.Show("当前CTU入库任务已满6个,请等待任务完成后再叫空箱!");
// HandyControl.Controls. HandyControl.Controls. MessageBox.Show("当前CTU入库任务已满6个,请等待任务完成后再叫空箱!");
// return;
// return;
//}
//}
var wmsBaseLocation = dbContext . WmsBaseLocation
var wmsBaseLocation = dbContext . WmsBaseLocation
@ -2323,11 +2327,11 @@ namespace Khd.Core.Wpf.Form
}
}
dbContext . AddRange ( addList ) ;
dbContext . AddRange ( addList ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "任务创建成功!" ) ;
HandyControl. Controls . MessageBox. Show ( "任务创建成功!" ) ;
}
}
else
else
{
{
MessageBox. Show ( $"没有足够的空箱库位库位,剩余空库位数量为{wmsBaseLocation.Count}!" ) ;
HandyControl. Controls . MessageBox . Error ( $"没有足够的空箱库位库位,剩余空库位数量为{wmsBaseLocation.Count}!" ) ;
}
}
}
}
@ -2351,7 +2355,7 @@ namespace Khd.Core.Wpf.Form
BaseEquip endEquip = SystemData . BaseEquip . First ( t = > t . objid = = 20 ) ;
BaseEquip endEquip = SystemData . BaseEquip . First ( t = > t . objid = = 20 ) ;
if ( CallSelectedItem . Count = = 0 )
if ( CallSelectedItem . Count = = 0 )
{
{
MessageBox. Show ( "请选择料箱!" ) ;
HandyControl. Controls . MessageBox. Show ( "请选择料箱!" ) ;
return ;
return ;
}
}
@ -2360,7 +2364,7 @@ namespace Khd.Core.Wpf.Form
//int taskCount = dbContext.WcsTask.Where(t => t.nextPointId == 11).Count();
//int taskCount = dbContext.WcsTask.Where(t => t.nextPointId == 11).Count();
//if (taskCount + ids.Count > 6)
//if (taskCount + ids.Count > 6)
//{
//{
// MessageBox.Show($"当前CTU只能有6个任务,当前任务数{taskCount}");
// HandyControl.Controls. MessageBox.Show($"当前CTU只能有6个任务,当前任务数{taskCount}");
// return;
// return;
//}
//}
var wmsBaseLocation = dbContext . WmsBaseLocation . Where ( t = > t . warehouseId = = 512 & & t . ContainerStatus = = "1" ) . Where ( t = > CallSelectedItem . Contains ( t . locationId ) ) . ToList ( ) ;
var wmsBaseLocation = dbContext . WmsBaseLocation . Where ( t = > t . warehouseId = = 512 & & t . ContainerStatus = = "1" ) . Where ( t = > CallSelectedItem . Contains ( t . locationId ) ) . ToList ( ) ;
@ -2370,8 +2374,8 @@ namespace Khd.Core.Wpf.Form
{
{
stringBuilder . AppendLine ( $"库位号{item.locationCode},料箱号{item.containerCode}." ) ;
stringBuilder . AppendLine ( $"库位号{item.locationCode},料箱号{item.containerCode}." ) ;
}
}
MessageBoxResult messageBoxResult = MessageBox . Show ( stringBuilder . ToString ( ) , "提示" , MessageBoxButton . YesNo ) ;
MessageBoxResult MessageBoxResult = HandyControl . Controls . MessageBox . Show ( stringBuilder . ToString ( ) , "提示" , MessageBoxButton . YesNo ) ;
if ( m essageBoxResult = = MessageBoxResult . Yes )
if ( M essageBoxResult = = MessageBoxResult . Yes )
{
{
List < WcsTaskManual > addList = new List < WcsTaskManual > ( ) ;
List < WcsTaskManual > addList = new List < WcsTaskManual > ( ) ;
foreach ( var item in wmsBaseLocation )
foreach ( var item in wmsBaseLocation )
@ -2403,7 +2407,7 @@ namespace Khd.Core.Wpf.Form
}
}
dbContext . AddRange ( addList ) ;
dbContext . AddRange ( addList ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "创建出库任务成功!" ) ;
HandyControl. Controls . MessageBox. Show ( "创建出库任务成功!" ) ;
}
}
CallSelectedItem . Clear ( ) ;
CallSelectedItem . Clear ( ) ;
GetPersonCallMaterialData ( ) ;
GetPersonCallMaterialData ( ) ;
@ -2437,11 +2441,11 @@ namespace Khd.Core.Wpf.Form
dbContext . Update ( task ) ;
dbContext . Update ( task ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
}
}
MessageBox. Show ( "任务执行成功!" ) ;
HandyControl. Controls . MessageBox. Show ( "任务执行成功!" ) ;
}
}
else
else
{
{
MessageBox. Show ( "没有可执行的任务!" ) ;
HandyControl. Controls . MessageBox . Error ( "没有可执行的任务!" ) ;
}
}
}
}
}
}
@ -2471,8 +2475,11 @@ namespace Khd.Core.Wpf.Form
if ( item . Value . IP = = ex . Message )
if ( item . Value . IP = = ex . Message )
{
{
MsgText . Text = "PLC断开连接, 正在重连!" ;
MsgText . Text = "PLC断开连接, 正在重连!" ;
SystemData . PlcDic [ item . Key ] = new Plc . S7 . Plc ( item . Value . CPU , item . Value . IP , item . Value . Port , item . Value . Slot , item . Value . Rack ) ;
Task . Run ( ( ) = >
SystemData . PlcDic [ item . Key ] . Open ( ) ;
{
SystemData . PlcDic [ item . Key ] = new Plc . S7 . Plc ( item . Value . CPU , item . Value . IP , item . Value . Port , item . Value . Rack , item . Value . Slot ) ;
SystemData . PlcDic [ item . Key ] . Open ( ) ;
} ) ;
break ;
break ;
}
}
}
}
@ -2523,7 +2530,7 @@ namespace Khd.Core.Wpf.Form
{
{
if ( ! ReadEmptyLocation ( ) )
if ( ! ReadEmptyLocation ( ) )
{
{
MessageBox. Show ( "有任务正在执行" ) ;
HandyControl. Controls . MessageBox. Show ( "有任务正在执行" ) ;
return ;
return ;
}
}
using var scope = _host . Services . CreateScope ( ) ;
using var scope = _host . Services . CreateScope ( ) ;
@ -2534,11 +2541,11 @@ namespace Khd.Core.Wpf.Form
baseEquip . emptyCount + = 1 ;
baseEquip . emptyCount + = 1 ;
dbContext . Update ( baseEquip ) ;
dbContext . Update ( baseEquip ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "下发成功" ) ;
HandyControl. Controls . MessageBox. Show ( "下发成功" ) ;
}
}
else
else
{
{
MessageBox. Show ( "未检测到托盘" ) ;
HandyControl. Controls . MessageBox . Error ( "未检测到托盘" ) ;
}
}
}
}
catch ( Exception ex )
catch ( Exception ex )
@ -2549,9 +2556,12 @@ namespace Khd.Core.Wpf.Form
{
{
if ( item . Value . IP = = ex . Message )
if ( item . Value . IP = = ex . Message )
{
{
MessageBox . Show ( "PLC断开连接, 正在重连!" ) ;
HandyControl . Controls . MessageBox . Error ( "PLC断开连接, 正在重连!" ) ;
SystemData . PlcDic [ item . Key ] = new Plc . S7 . Plc ( item . Value . CPU , item . Value . IP , item . Value . Port , item . Value . Rack , item . Value . Slot ) ;
Task . Run ( ( ) = >
SystemData . PlcDic [ item . Key ] . Open ( ) ;
{
SystemData . PlcDic [ item . Key ] = new Plc . S7 . Plc ( item . Value . CPU , item . Value . IP , item . Value . Port , item . Value . Rack , item . Value . Slot ) ;
SystemData . PlcDic [ item . Key ] . Open ( ) ;
} ) ;
}
}
}
}
}
}
@ -2569,7 +2579,7 @@ namespace Khd.Core.Wpf.Form
{
{
if ( ! ReadEmptyLocation ( ) )
if ( ! ReadEmptyLocation ( ) )
{
{
MessageBox. Show ( "有任务正在执行" ) ;
HandyControl. Controls . MessageBox. Show ( "有任务正在执行" ) ;
return ;
return ;
}
}
using var scope = _host . Services . CreateScope ( ) ;
using var scope = _host . Services . CreateScope ( ) ;
@ -2580,11 +2590,11 @@ namespace Khd.Core.Wpf.Form
baseEquip . emptyCount - = 1 ;
baseEquip . emptyCount - = 1 ;
dbContext . Update ( baseEquip ) ;
dbContext . Update ( baseEquip ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "下发成功" ) ;
HandyControl. Controls . MessageBox. Show ( "下发成功" ) ;
}
}
else
else
{
{
MessageBox. Show ( "检测到外侧有托盘,无法出堆垛机" ) ;
HandyControl. Controls . MessageBox. Show ( "检测到外侧有托盘,无法出堆垛机" ) ;
}
}
}
}
catch ( Exception ex )
catch ( Exception ex )
@ -2595,9 +2605,12 @@ namespace Khd.Core.Wpf.Form
{
{
if ( item . Value . IP = = ex . Message )
if ( item . Value . IP = = ex . Message )
{
{
MessageBox . Show ( "PLC断开连接, 正在重连!" ) ;
HandyControl . Controls . MessageBox . Show ( "PLC断开连接, 正在重连!" ) ;
SystemData . PlcDic [ item . Key ] = new Plc . S7 . Plc ( item . Value . CPU , item . Value . IP , item . Value . Port , item . Value . Rack , item . Value . Slot ) ;
Task . Run ( ( ) = >
SystemData . PlcDic [ item . Key ] . Open ( ) ;
{
SystemData . PlcDic [ item . Key ] = new Plc . S7 . Plc ( item . Value . CPU , item . Value . IP , item . Value . Port , item . Value . Rack , item . Value . Slot ) ;
SystemData . PlcDic [ item . Key ] . Open ( ) ;
} ) ;
}
}
}
}
}
}
@ -2619,7 +2632,7 @@ namespace Khd.Core.Wpf.Form
{
{
if ( ! ReadEmptyLocation ( ) )
if ( ! ReadEmptyLocation ( ) )
{
{
MessageBox. Show ( "有任务正在执行" ) ;
HandyControl. Controls . MessageBox. Show ( "有任务正在执行" ) ;
return ;
return ;
}
}
int emptyTaskCount = EmptyCountForm . EmptyTaskCount ;
int emptyTaskCount = EmptyCountForm . EmptyTaskCount ;
@ -2631,12 +2644,12 @@ namespace Khd.Core.Wpf.Form
baseEquip . emptyCount = emptyTaskCount ;
baseEquip . emptyCount = emptyTaskCount ;
dbContext . Update ( baseEquip ) ;
dbContext . Update ( baseEquip ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "下发成功" ) ;
HandyControl. Controls . MessageBox. Show ( "下发成功" ) ;
}
}
}
}
//else
//else
//{
//{
// MessageBox.Show("未检测到托盘");
// HandyControl.Controls. MessageBox.Show("未检测到托盘");
//}
//}
}
}
catch ( Exception ex )
catch ( Exception ex )
@ -2647,9 +2660,12 @@ namespace Khd.Core.Wpf.Form
{
{
if ( item . Value . IP = = ex . Message )
if ( item . Value . IP = = ex . Message )
{
{
MessageBox . Show ( "PLC断开连接, 正在重连!" ) ;
HandyControl . Controls . MessageBox . Show ( "PLC断开连接, 正在重连!" ) ;
SystemData . PlcDic [ item . Key ] = new Plc . S7 . Plc ( item . Value . CPU , item . Value . IP , item . Value . Port , item . Value . Rack , item . Value . Slot ) ;
Task . Run ( ( ) = >
SystemData . PlcDic [ item . Key ] . Open ( ) ;
{
SystemData . PlcDic [ item . Key ] = new Plc . S7 . Plc ( item . Value . CPU , item . Value . IP , item . Value . Port , item . Value . Rack , item . Value . Slot ) ;
SystemData . PlcDic [ item . Key ] . Open ( ) ;
} ) ;
}
}
}
}
}
}
@ -2663,7 +2679,7 @@ namespace Khd.Core.Wpf.Form
{
{
if ( ! ReadEmptyLocation ( ) )
if ( ! ReadEmptyLocation ( ) )
{
{
MessageBox. Show ( "有任务正在执行" ) ;
HandyControl. Controls . MessageBox. Show ( "有任务正在执行" ) ;
return ;
return ;
}
}
BasePlcpoint lineSignal = SystemData . BasePlcpoints . First ( t = > t . plcpointNo = = "linesignal01" ) ;
BasePlcpoint lineSignal = SystemData . BasePlcpoints . First ( t = > t . plcpointNo = = "linesignal01" ) ;
@ -2678,11 +2694,11 @@ namespace Khd.Core.Wpf.Form
baseEquip . emptyCount = 0 ;
baseEquip . emptyCount = 0 ;
dbContext . Update ( baseEquip ) ;
dbContext . Update ( baseEquip ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "下发成功" ) ;
HandyControl. Controls . MessageBox. Show ( "下发成功" ) ;
}
}
else
else
{
{
MessageBox. Show ( "检测到外侧有托盘,无法出堆垛机" ) ;
HandyControl. Controls . MessageBox. Show ( "检测到外侧有托盘,无法出堆垛机" ) ;
}
}
}
}
@ -2694,9 +2710,12 @@ namespace Khd.Core.Wpf.Form
{
{
if ( item . Value . IP = = ex . Message )
if ( item . Value . IP = = ex . Message )
{
{
MessageBox . Show ( "PLC断开连接, 正在重连!" ) ;
HandyControl . Controls . MessageBox . Show ( "PLC断开连接, 正在重连!" ) ;
SystemData . PlcDic [ item . Key ] = new Plc . S7 . Plc ( item . Value . CPU , item . Value . IP , item . Value . Port , item . Value . Rack , item . Value . Slot ) ;
Task . Run ( ( ) = >
SystemData . PlcDic [ item . Key ] . Open ( ) ;
{
SystemData . PlcDic [ item . Key ] = new Plc . S7 . Plc ( item . Value . CPU , item . Value . IP , item . Value . Port , item . Value . Rack , item . Value . Slot ) ;
SystemData . PlcDic [ item . Key ] . Open ( ) ;
} ) ;
}
}
}
}
}
}
@ -2722,7 +2741,7 @@ namespace Khd.Core.Wpf.Form
baseEquip . emptyCount = EmptyCountForm . EmptyTaskCount ;
baseEquip . emptyCount = EmptyCountForm . EmptyTaskCount ;
dbContext . Update ( baseEquip ) ;
dbContext . Update ( baseEquip ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "修改成功" ) ;
HandyControl. Controls . MessageBox. Show ( "修改成功" ) ;
}
}
}
}
}
}
@ -2750,7 +2769,7 @@ namespace Khd.Core.Wpf.Form
bool hasTaskManual = dbContext . WcsTaskManual . Where ( t = > t . endPointId = = baseEquip . objid | | t . currPointId = = baseEquip . objid ) . Any ( ) ;
bool hasTaskManual = dbContext . WcsTaskManual . Where ( t = > t . endPointId = = baseEquip . objid | | t . currPointId = = baseEquip . objid ) . Any ( ) ;
if ( hasTask | | hasTaskManual )
if ( hasTask | | hasTaskManual )
{
{
MessageBox. Show ( "有任务正在执行,请等待任务完成后再执行此操作!" ) ;
HandyControl. Controls . MessageBox. Show ( "有任务正在执行,请等待任务完成后再执行此操作!" ) ;
return ;
return ;
}
}
else
else
@ -2758,7 +2777,7 @@ namespace Khd.Core.Wpf.Form
var endEquip = dbContext . BaseEquip . FirstOrDefault ( t = > t . equipType = = 20 & & t . equipStatus = = 0 & & t . emptyCount = = 0 ) ;
var endEquip = dbContext . BaseEquip . FirstOrDefault ( t = > t . equipType = = 20 & & t . equipStatus = = 0 & & t . emptyCount = = 0 ) ;
if ( endEquip = = null )
if ( endEquip = = null )
{
{
MessageBox. Show ( "没有空箱库位!" ) ;
HandyControl. Controls . MessageBox. Show ( "没有空箱库位!" ) ;
return ;
return ;
}
}
else
else
@ -2784,7 +2803,7 @@ namespace Khd.Core.Wpf.Form
} ;
} ;
dbContext . Add ( task ) ;
dbContext . Add ( task ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "任务生成成功!" ) ;
HandyControl. Controls . MessageBox. Show ( "任务生成成功!" ) ;
}
}
}
}
}
}
@ -2804,7 +2823,7 @@ namespace Khd.Core.Wpf.Form
bool hasTaskManual = dbContext . WcsTaskManual . Where ( t = > t . endPointId = = baseEquip . objid | | t . currPointId = = baseEquip . objid ) . Any ( ) ;
bool hasTaskManual = dbContext . WcsTaskManual . Where ( t = > t . endPointId = = baseEquip . objid | | t . currPointId = = baseEquip . objid ) . Any ( ) ;
if ( hasTask | | hasTaskManual )
if ( hasTask | | hasTaskManual )
{
{
MessageBox. Show ( "有任务正在执行,请等待任务完成后再执行此操作!" ) ;
HandyControl. Controls . MessageBox. Show ( "有任务正在执行,请等待任务完成后再执行此操作!" ) ;
return ;
return ;
}
}
else
else
@ -2815,8 +2834,8 @@ namespace Khd.Core.Wpf.Form
BaseEquip firstEmptyEquip = dbContext . BaseEquip . First ( t = > t . objid = = 40 ) ;
BaseEquip firstEmptyEquip = dbContext . BaseEquip . First ( t = > t . objid = = 40 ) ;
if ( firstEmptyEquip . emptyCount > 0 )
if ( firstEmptyEquip . emptyCount > 0 )
{
{
MessageBoxResult messageBoxResult = MessageBox . Show ( "二楼未找到一个托盘的库位,是否从一楼调取?" , "提示" , MessageBoxButton . OKCancel ) ;
MessageBoxResult MessageBoxResult = HandyControl . Controls . MessageBox . Show ( "二楼未找到一个托盘的库位,是否从一楼调取?" , "提示" , MessageBoxButton . OKCancel ) ;
if ( m essageBoxResult = = MessageBoxResult . OK )
if ( M essageBoxResult = = MessageBoxResult . OK )
{
{
if ( ReadEmptyLocation ( ) )
if ( ReadEmptyLocation ( ) )
{
{
@ -2825,17 +2844,17 @@ namespace Khd.Core.Wpf.Form
firstEmptyEquip . emptyCount - = 1 ;
firstEmptyEquip . emptyCount - = 1 ;
dbContext . Update ( firstEmptyEquip ) ;
dbContext . Update ( firstEmptyEquip ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "下发成功" ) ;
HandyControl. Controls . MessageBox. Show ( "下发成功" ) ;
}
}
else
else
{
{
MessageBox. Show ( "一楼托盘库忙碌中,请稍后再试!" ) ;
HandyControl. Controls . MessageBox. Show ( "一楼托盘库忙碌中,请稍后再试!" ) ;
}
}
}
}
}
}
else
else
{
{
MessageBox. Show ( "未找到一个托盘的库位" ) ;
HandyControl. Controls . MessageBox. Show ( "未找到一个托盘的库位" ) ;
return ;
return ;
}
}
}
}
@ -2862,7 +2881,7 @@ namespace Khd.Core.Wpf.Form
} ;
} ;
dbContext . Add ( task ) ;
dbContext . Add ( task ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "任务生成成功!" ) ;
HandyControl. Controls . MessageBox. Show ( "任务生成成功!" ) ;
}
}
}
}
}
}
@ -2895,8 +2914,8 @@ namespace Khd.Core.Wpf.Form
{
{
if ( this . EmptyEquip . SelectedItem is BaseEquip equip )
if ( this . EmptyEquip . SelectedItem is BaseEquip equip )
{
{
MessageBoxResult messageBoxResult = MessageBox . Show ( $"是否清除{equip.equipName}的托盘信息?" , "提示" , MessageBoxButton . OKCancel ) ;
MessageBoxResult MessageBoxResult = HandyControl . Controls . MessageBox . Show ( $"是否清除{equip.equipName}的托盘信息?" , "提示" , MessageBoxButton . OKCancel ) ;
if ( m essageBoxResult = = MessageBoxResult . OK )
if ( M essageBoxResult = = MessageBoxResult . OK )
{
{
using var scope = _host . Services . CreateScope ( ) ;
using var scope = _host . Services . CreateScope ( ) ;
using var dbContext = scope . ServiceProvider . GetRequiredService < DefaultDbContext > ( ) ;
using var dbContext = scope . ServiceProvider . GetRequiredService < DefaultDbContext > ( ) ;
@ -2905,7 +2924,7 @@ namespace Khd.Core.Wpf.Form
baseEquip . equipStatus = 0 ;
baseEquip . equipStatus = 0 ;
dbContext . Update ( baseEquip ) ;
dbContext . Update ( baseEquip ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "清除成功" ) ;
HandyControl. Controls . MessageBox. Show ( "清除成功" ) ;
}
}
}
}
}
}
@ -2921,7 +2940,7 @@ namespace Khd.Core.Wpf.Form
bool hasTaskManual = dbContext . WcsTaskManual . Where ( t = > t . currPointId = = baseEquip . objid | | t . endPointId = = baseEquip . objid ) . Any ( ) ;
bool hasTaskManual = dbContext . WcsTaskManual . Where ( t = > t . currPointId = = baseEquip . objid | | t . endPointId = = baseEquip . objid ) . Any ( ) ;
if ( hastask | | hasTaskManual )
if ( hastask | | hasTaskManual )
{
{
MessageBox. Show ( "已存在当前库位的任务" ) ;
HandyControl. Controls . MessageBox. Show ( "已存在当前库位的任务" ) ;
return ;
return ;
}
}
if ( baseEquip . emptyCount > 0 )
if ( baseEquip . emptyCount > 0 )
@ -2948,12 +2967,12 @@ namespace Khd.Core.Wpf.Form
} ;
} ;
dbContext . Add ( task ) ;
dbContext . Add ( task ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "下发成功" ) ;
HandyControl. Controls . MessageBox. Show ( "下发成功" ) ;
}
}
}
}
else
else
{
{
MessageBox. Show ( "库位已空!" ) ;
HandyControl. Controls . MessageBox. Show ( "库位已空!" ) ;
}
}
}
}
}
}
@ -2977,11 +2996,11 @@ namespace Khd.Core.Wpf.Form
baseEquip . containerNo = null ;
baseEquip . containerNo = null ;
dbContext . Update ( baseEquip ) ;
dbContext . Update ( baseEquip ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "确认入库成功!" ) ;
HandyControl. Controls . MessageBox. Show ( "确认入库成功!" ) ;
}
}
else
else
{
{
MessageBox. Show ( "未扫描到RFID! " ) ;
HandyControl. Controls . MessageBox. Show ( "未扫描到RFID! " ) ;
}
}
}
}
@ -2998,14 +3017,14 @@ namespace Khd.Core.Wpf.Form
{
{
if ( user . OBJID = = 1 )
if ( user . OBJID = = 1 )
{
{
MessageBox. Show ( "不能删除根用户!" ) ;
HandyControl. Controls . MessageBox. Show ( "不能删除根用户!" ) ;
return ;
return ;
}
}
using var scope = _host . Services . CreateScope ( ) ;
using var scope = _host . Services . CreateScope ( ) ;
using var dbContext = scope . ServiceProvider . GetRequiredService < DefaultDbContext > ( ) ;
using var dbContext = scope . ServiceProvider . GetRequiredService < DefaultDbContext > ( ) ;
dbContext . SysUser . Remove ( user ) ;
dbContext . SysUser . Remove ( user ) ;
dbContext . SaveChanges ( ) ;
dbContext . SaveChanges ( ) ;
MessageBox. Show ( "删除成功!" ) ;
HandyControl. Controls . MessageBox. Show ( "删除成功!" ) ;
GetMenu ( ) ;
GetMenu ( ) ;
}
}
}
}
@ -3077,7 +3096,7 @@ namespace Khd.Core.Wpf.Form
{
{
//if (user.OBJID == 1)
//if (user.OBJID == 1)
//{
//{
// MessageBox.Show("不能修改根用户!");
// HandyControl.Controls. MessageBox.Show("不能修改根用户!");
// return;
// return;
//}
//}
MenuList menuList = new MenuList ( _host , user . OBJID ) ;
MenuList menuList = new MenuList ( _host , user . OBJID ) ;
@ -3127,7 +3146,7 @@ namespace Khd.Core.Wpf.Form
this . InventoryMaterial . Items . Refresh ( ) ;
this . InventoryMaterial . Items . Refresh ( ) ;
if ( list . Count = = 0 )
if ( list . Count = = 0 )
{
{
MessageBox. Show ( "没有数据!" ) ;
HandyControl. Controls . MessageBox. Show ( "没有数据!" ) ;
}
}
}
}
catch
catch
@ -3148,5 +3167,23 @@ namespace Khd.Core.Wpf.Form
SelectOutRawForm selectOutRawForm = new SelectOutRawForm ( this . _host ) ;
SelectOutRawForm selectOutRawForm = new SelectOutRawForm ( this . _host ) ;
selectOutRawForm . ShowDialog ( ) ;
selectOutRawForm . ShowDialog ( ) ;
}
}
private void ContineOutBtn_Click ( object sender , RoutedEventArgs e )
{
try
{
using var scope = _host . Services . CreateScope ( ) ;
using var dbContext = scope . ServiceProvider . GetRequiredService < DefaultDbContext > ( ) ;
BaseEquip baseEquip = dbContext . BaseEquip . Where ( t = > t . objid = = 10 ) . First ( ) ;
baseEquip . IsOut = 1 ;
dbContext . Update ( baseEquip ) ;
dbContext . SaveChanges ( ) ;
HandyControl . Controls . MessageBox . Show ( "继续出库成功!" ) ;
}
catch
{
}
}
}
}
}
}