change-修改入库界面、增加取消预调度按钮

master
liuwf 1 year ago
parent e232619343
commit 9d75dde1a2

@ -100,5 +100,17 @@ namespace Khd.Core.Api.Controllers
LogManager.Info($"AGVStopOrStart 接口收到消息: {agvStopOrStart.ToJsonString()}");
return _application.CallAgvStopOrStart(agvStopOrStart);
}
/// <summary>
/// 取消CTU预调度接口WPF界面使用
/// </summary>
/// <returns></returns>
[HttpPost("CancelPreScheduling")]
public ReponseMessage CancelPreScheduling()
{
LogManager.Info($"CancelPreScheduling 接口收到消息");
return _application.CancelPreScheduling();
}
}
}

@ -33,5 +33,8 @@ namespace Khd.Core.Application.Interface
ReponseMessage CallMaterial(CallMaterial callMaterial);
ReponseMessage AGVTaskComplete();
ReponseMessage CallAgvStopOrStart(CallAgvStopOrStart agvStopOrStart);
ReponseMessage CancelPreScheduling();
}
}

@ -479,5 +479,33 @@ namespace Khd.Core.Application
return new ReponseMessage() { code = "1", message = "调用失败" };
}
}
/// <summary>
/// 取消预调度
/// </summary>
/// <returns></returns>
public ReponseMessage CancelPreScheduling()
{
try
{
_dbContext.ChangeTracker.Entries().ToList().ForEach(e => e.Reload());
var baseEquip = _dbContext.BaseEquip.FirstOrDefault(x => x.objid == 11);
var executeTask = new
{
reqCode = new JcSnowId().NextId().ToString(),
positionCode = "CTU_IN",
nextTask = -1
};
string executeMessage = JsonConvert.SerializeObject(executeTask);
string executeResult = HttpHelper.SendPostMessage(baseEquip.serverIp, baseEquip.serverPort.Value, "rcms/services/rest/hikRpcService/genPreScheduleTask", executeMessage);
ReponseMessage reponseMessage = JsonConvert.DeserializeObject<ReponseMessage>(executeResult);
return reponseMessage;
}catch (Exception ex)
{
return new ReponseMessage() { code = "1", message = "调用失败" };
}
}
}
}

@ -152,12 +152,12 @@ namespace Khd.Core.Wcs.Wcs
if (task.taskType == StaticTaskType.FiveAccessoryOut || task.taskType == StaticTaskType.FiveAccessoryRemove)
{
dbContext.WcsTask.Where(t => t.objid == task.objid).Delete();
#region 如果已经开始入库,还有出库任务,删除出库任务
List<WcsTask> outTasks = dbContext.WcsTask.Where(t => t.taskType == StaticTaskType.FiveAccessoryOut && t.taskStatus == 6).ToList();
if(outTasks!=null && outTasks.Count > 0)
{
dbContext.RemoveRange(outTasks);
}
#region 暂不使用-因为删除之后ctu无法知道还有几个箱子///如果已经开始入库,还有出库任务,删除出库任务
//List<WcsTask> outTasks = dbContext.WcsTask.Where(t => t.taskType == StaticTaskType.FiveAccessoryOut && t.taskStatus == 6).ToList();
//if(outTasks!=null && outTasks.Count > 0)
//{
// dbContext.RemoveRange(outTasks);
//}
#endregion
//根据rfid找到库位
//生成入库任务

@ -1058,7 +1058,7 @@
MinWidth="10"
Header=" 序号"
IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock
@ -1131,7 +1131,7 @@
FontSize="20"
Header="楼层"
IsReadOnly="True" />
<!--<DataGridTextColumn
Width="180*"
Binding="{Binding totalAmount}"
@ -1618,10 +1618,10 @@
<Grid.RowDefinitions>
<RowDefinition Height="0.5*"/>
<RowDefinition Height="0.8*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="0.4*"/>
</Grid.RowDefinitions>
<Border Background="#213269" BorderBrush="Silver" BorderThickness="2" CornerRadius="10" Margin="0,5,0,0">
<StackPanel Orientation="Horizontal">
@ -1998,31 +1998,32 @@
<RowDefinition Height="167*"/>
</Grid.RowDefinitions>
<TextBlock Text="扫描入库" FontSize="50" Grid.ColumnSpan="6" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="扫描料箱号:" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="扫描条码号:" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="物料名称:" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="物料规格:" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="入库数量:" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<hc:TextBox x:Name="txtInBox" hc:InfoElement.ShowClearButton="True" FontSize="50" LostFocus="txtInBox_TextChanged" TextChanged="txtInBox_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="1" Grid.Column="3" Grid.ColumnSpan="3"/>
<TextBlock Text="扫描料箱号:" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="扫描条码号:" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="物料名称:" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="物料规格:" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<TextBlock Text="入库数量:" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<hc:TextBox x:Name="txtInBox" hc:InfoElement.ShowClearButton="True" FontSize="50" LostFocus="txtInBox_TextChanged" TextChanged="txtInBox_TextChanged" Width="900" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="4"/>
<Button Click="barClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="0,0,130,0" Grid.Column="5" Grid.Row="2">
<Image Source="..\Resources\cancel.png"/>
</Button>
<Button Click="boxClear_Click" HorizontalAlignment="Right" Height="100" Panel.ZIndex="1" Width="100" Margin="0,0,130,0" Grid.Column="5" Grid.Row="1">
<Image Source="..\Resources\cancel.png"/>
</Button>
<hc:TextBox x:Name="txtInBarCode" hc:InfoElement.ShowClearButton="True" FontSize="50" LostFocus="txtInBarCode_TextChanged" TextChanged="txtInBarCode_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="2" Grid.Column="3" Grid.ColumnSpan="3"/>
<hc:TextBox x:Name="materialName" IsReadOnly="True" hc:InfoElement.ShowClearButton="True" FontSize="50" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="3"/>
<hc:TextBox x:Name="materialSpec" IsReadOnly="True" hc:InfoElement.ShowClearButton="True" FontSize="50" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="4" Grid.Column="3" Grid.ColumnSpan="3"/>
<hc:TextBox x:Name="txtInScan" FontSize="50" IsReadOnly="True" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="5" Grid.Column="3" Grid.ColumnSpan="3" KeyDown="ScanInKeyDown" />
<hc:TextBox x:Name="txtInBarCode" hc:InfoElement.ShowClearButton="True" FontSize="50" LostFocus="txtInBarCode_TextChanged" TextChanged="txtInBarCode_TextChanged" Width="900" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="4"/>
<hc:TextBox x:Name="materialName" IsReadOnly="True" hc:InfoElement.ShowClearButton="True" FontSize="50" Width="900" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="3"/>
<hc:TextBox x:Name="materialSpec" IsReadOnly="True" hc:InfoElement.ShowClearButton="True" FontSize="50" Width="900" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="3"/>
<hc:TextBox x:Name="txtInScan" FontSize="50" IsReadOnly="True" Width="900" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="3" KeyDown="ScanInKeyDown" />
<Button Content="确认入库" Grid.Row="6" Grid.ColumnSpan="6" Width="300" Height="100" FontSize="50" Background="#346DFF" Foreground="White" Click="InRawBaseLocaltion_Click"/>
<Button Content="一键收料" Grid.Row="7" Grid.ColumnSpan="6" Width="300" Height="100" FontSize="50" Background="#346DFF" Foreground="White" Click="callPlc_Click" HorizontalAlignment="Right"/>
<Button Content="取消预调度" x:Name="CancelPreScheduling" Grid.Row="6" Grid.ColumnSpan="2" Width="328" Height="100" FontSize="50" Background="#346DFF" Foreground="White" HorizontalAlignment="Left" Grid.Column="4" Margin="222,0,0,0" Click="CancelPreScheduling_Click"/>
<Button Content="一键收料" Grid.Row="7" Grid.ColumnSpan="2" Width="328" Height="100" FontSize="50" Background="#346DFF" Foreground="White" Click="callPlc_Click" HorizontalAlignment="Left" Grid.Column="4" Margin="222,0,0,0"/>
<TextBlock Grid.Row="7" Text="提示信息:" HorizontalAlignment="Center" Grid.Column="1" Grid.ColumnSpan="1" Width="250" Height="100" FontSize="50" Foreground="White" />
<TextBlock x:Name="MsgText" Grid.Row="7" FontSize="50" Grid.ColumnSpan="5" Width="800" Height="100" Foreground="White" HorizontalAlignment="Right" />
<Button Content="执行CTU入库任务" Visibility="Hidden" Click="btnCtuInConfirmBox_Click" Grid.Row="5" Grid.ColumnSpan="6" Width="500" Height="100" FontSize="50" Background="#346DFF" Foreground="White"/>
</Grid>
</StackPanel>
</StackPanel>
</StackPanel>
</TabItem>
<TabItem x:Name="ScanReturnManager" Header="扫描退库" Style="{StaticResource DefaultItem}" FontSize="25" HorizontalContentAlignment="Center" Background="#213269" VerticalContentAlignment="Center" Foreground="White" Width="160" Height="100" Margin="5">
@ -2203,8 +2204,8 @@
</StackPanel>
</Border>
<Border BorderBrush="White" BorderThickness="2" Grid.Column="0" Grid.ColumnSpan="6" Grid.Row="6" Grid.RowSpan="2" Margin="20">
<DataGrid Background="Transparent"
CanUserAddRows="False"
AutoGenerateColumns="False"
@ -2234,7 +2235,7 @@
ElementStyle="{StaticResource dgCell}"
Width="2*"
/>-->
<DataGridTextColumn
Header="申请数量"
Binding="{Binding outstockAmount}"
@ -2254,7 +2255,7 @@
Width="*"
ElementStyle="{StaticResource dgCell}"
/>
<!--<DataGridTextColumn
Header="箱体携带数量"
Binding="{Binding thisOutAmount}"
@ -2314,7 +2315,7 @@
<TextBlock Text="待执行CTU任务数:" Visibility="Hidden" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="50"/>
<TextBlock x:Name="outTaskCount" Visibility="Hidden" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="75"/>
<Button Content="执行CTU出库任务" Visibility="Hidden" Grid.Row="1" Grid.Column="3" Grid.ColumnSpan="2" Width="500" Height="100" FontSize="50" Background="#346DFF" Foreground="White" Click="ExecuteCtuTask_Click"/>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="0" Grid.ColumnSpan="6">
<TextBlock Text="扫描料箱号:" Width="280" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50"/>
<Grid>
@ -2333,7 +2334,7 @@
<Image Source="..\Resources\cancel.png"/>
</Button>
</Grid>
</StackPanel>
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Grid.Row="2" Grid.ColumnSpan="6">
@ -2348,7 +2349,7 @@
<TextBlock Text="物料规格:" Width="280" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="50"/>
<Grid>
<hc:TextBox hc:InfoElement.ShowClearButton="True" IsReadOnly="True" x:Name="outMaterialSpecTxt" FontSize="50" LostFocus="txtOutBarCode_TextChanged" Width="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="3"/>
</Grid>
<Button Content="确认出库" Grid.Column="4" Grid.Row="5" Grid.ColumnSpan="2" Width="400" Height="100" Margin="100,0,0,0" FontSize="35" Background="#346DFF" Foreground="White" Click="OutRawBaseLocaltion_Click"/>
</StackPanel>
@ -2371,10 +2372,10 @@
<Grid>
<TextBlock x:Name="scanOutMsg" hc:InfoElement.ShowClearButton="True" FontSize="50" Width="1300" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="4"/>
</Grid>
</StackPanel>
</Grid>
<!--<Border Background="#213269" BorderBrush="Silver" BorderThickness="2" CornerRadius="10" Width="900" Height="500" Margin="0,5,0,0">
<StackPanel Margin="0,10,10,10">
@ -2492,7 +2493,7 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="辅料移库" FontSize="50" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="0" Grid.ColumnSpan="4"/>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="原料箱号:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Left"/>
<hc:TextBox x:Name="rawSourceBox" TextChanged="rawSourceBox_TextChanged" FontSize="40" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
@ -2507,7 +2508,7 @@
<Image Source="..\Resources\cancel.png"/>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="移库料箱:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:TextBox x:Name="removeSourceBox" FontSize="40" TextChanged="removeSourceBox_TextChanged" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
@ -2515,7 +2516,7 @@
<Image Source="..\Resources\cancel.png"/>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="移库条码:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
@ -2539,17 +2540,17 @@
<hc:TextBox x:Name="removeSourceMaterialName" FontSize="40" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="物料规格:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:TextBox x:Name="removeSourceMaterialSpec" FontSize="40" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" Margin="5">
<TextBlock Text="移库数量:" FontSize="40" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<hc:TextBox x:Name="removeScan" FontSize="40" Width="500" Height="100" Margin="0,0,0,0" hc:InfoElement.ShowClearButton="True"/>
</StackPanel>
<Button Content="确认移库" Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="4" Width="500" Height="150" FontSize="75" Background="#346DFF" Foreground="White" Click="btnRemoveConfirmBox_Click"/>

@ -1,6 +1,7 @@
using HandyControl.Tools.Extension;
using Jc.SnowId;
using Khd.Core.Domain.Auth;
using Khd.Core.Domain.Dto.webapi;
using Khd.Core.Domain.Models;
using Khd.Core.EntityFramework;
using Khd.Core.Library.Mapper;
@ -15,6 +16,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@ -129,14 +131,14 @@ namespace Khd.Core.Wpf.Form
{
Plc.S7.Plc plc;
plc = new Plc.S7.Plc(plcConfig.CpuType, plcConfig.IP, plcConfig.Port, plcConfig.Rack, plcConfig.Slot);
//try
//{
// plc.Open();
//}
//catch (Exception ex)
//{
// LogManager.Error(ex);
//}
try
{
plc.Open();
}
catch (Exception ex)
{
LogManager.Error(ex);
}
SystemData.PlcDic.TryAdd(plcConfig.Code, plc);
}
};
@ -4478,6 +4480,28 @@ namespace Khd.Core.Wpf.Form
}
}
/// <summary>
/// 取消预调度
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CancelPreScheduling_Click(object sender, RoutedEventArgs e)
{
// 调用取消预调度接口
string executeResult = HttpHelper.SendPostMessage("172.16.12.100", 5001, "wcs/RecieveRcs/CancelPreScheduling", null, "application/Json");
// string executeResult = HttpHelper.SendPostMessage("127.0.0.1", 5001, "wcs/RecieveRcs/CancelPreScheduling", null, "application/Json");
var executeReponse = JsonConvert.DeserializeObject<ReponseMessage>(executeResult);
if (executeReponse != null && executeReponse.code == "0")
{
MessageBox.Show("取消预调度成功!");
}
else
{
MessageBox.Show($"取消预调度失败!");
}
}
}
}

Loading…
Cancel
Save