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

master
liuwf 1 year ago
parent e232619343
commit 9d75dde1a2

@ -100,5 +100,17 @@ namespace Khd.Core.Api.Controllers
LogManager.Info($"AGVStopOrStart 接口收到消息: {agvStopOrStart.ToJsonString()}"); LogManager.Info($"AGVStopOrStart 接口收到消息: {agvStopOrStart.ToJsonString()}");
return _application.CallAgvStopOrStart(agvStopOrStart); 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 CallMaterial(CallMaterial callMaterial);
ReponseMessage AGVTaskComplete(); ReponseMessage AGVTaskComplete();
ReponseMessage CallAgvStopOrStart(CallAgvStopOrStart agvStopOrStart); ReponseMessage CallAgvStopOrStart(CallAgvStopOrStart agvStopOrStart);
ReponseMessage CancelPreScheduling();
} }
} }

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

@ -1998,24 +1998,25 @@
<RowDefinition Height="167*"/> <RowDefinition Height="167*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="扫描入库" FontSize="50" Grid.ColumnSpan="6" HorizontalAlignment="Center" VerticalAlignment="Center"/> <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="1" Grid.Column="0" 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="2" Grid.Column="0" 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="3" Grid.Column="0" 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="4" Grid.Column="0" 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"/> <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="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="1" Grid.Column="3" Grid.ColumnSpan="3"/> <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"> <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"/> <Image Source="..\Resources\cancel.png"/>
</Button> </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"> <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"/> <Image Source="..\Resources\cancel.png"/>
</Button> </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="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="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="3" Grid.Column="3" Grid.ColumnSpan="3"/> <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="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="4" Grid.Column="3" 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="700" HorizontalAlignment="Left" VerticalAlignment="Center" Height="100" Grid.Row="5" Grid.Column="3" Grid.ColumnSpan="3" KeyDown="ScanInKeyDown" /> <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="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 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" /> <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"/> <Button Content="执行CTU入库任务" Visibility="Hidden" Click="btnCtuInConfirmBox_Click" Grid.Row="5" Grid.ColumnSpan="6" Width="500" Height="100" FontSize="50" Background="#346DFF" Foreground="White"/>

@ -1,6 +1,7 @@
using HandyControl.Tools.Extension; using HandyControl.Tools.Extension;
using Jc.SnowId; using Jc.SnowId;
using Khd.Core.Domain.Auth; using Khd.Core.Domain.Auth;
using Khd.Core.Domain.Dto.webapi;
using Khd.Core.Domain.Models; using Khd.Core.Domain.Models;
using Khd.Core.EntityFramework; using Khd.Core.EntityFramework;
using Khd.Core.Library.Mapper; using Khd.Core.Library.Mapper;
@ -15,6 +16,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
@ -129,14 +131,14 @@ namespace Khd.Core.Wpf.Form
{ {
Plc.S7.Plc plc; Plc.S7.Plc plc;
plc = new Plc.S7.Plc(plcConfig.CpuType, plcConfig.IP, plcConfig.Port, plcConfig.Rack, plcConfig.Slot); plc = new Plc.S7.Plc(plcConfig.CpuType, plcConfig.IP, plcConfig.Port, plcConfig.Rack, plcConfig.Slot);
//try try
//{ {
// plc.Open(); plc.Open();
//} }
//catch (Exception ex) catch (Exception ex)
//{ {
// LogManager.Error(ex); LogManager.Error(ex);
//} }
SystemData.PlcDic.TryAdd(plcConfig.Code, plc); 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