change-钣金修改

main
liuwf 10 months ago
parent 4e1a749438
commit 74c9216347

@ -475,12 +475,35 @@ namespace Aucma.Core.SheetMetal.ViewModels
int id = Convert.ToInt32(Id);
ExecutePlanInfo executionPlanInfo = _taskExecutionPlanInfoServices.FirstAsync(s => s.ObjId == id).Result;
if (executionPlanInfo.PlanAmount == executionPlanInfo.CompleteAmount)
if (executionPlanInfo.ExecuteStatus != 2)
{
MessageBox.Show("执行计划已经完成,不可以删除!", "系统信息");
return;
// 未下发任务直接删除,已经下发的任务隐式删除
bool result1 = false;
if (executionPlanInfo.CompleteAmount==0)
{
result1 = await _taskExecutionPlanInfoServices.DeleteAsync(executionPlanInfo);
}
else
{
executionPlanInfo.IsFlag = 1;
result1 = await _taskExecutionPlanInfoServices.UpdateAsync(executionPlanInfo);
}
if (result1)
{
PlanInfoDataGrid.Clear();
await LoadData();
MessageBox.Show("执行计划删除成功", "系统信息");
return;
}
else
{
MessageBox.Show("执行计划删除失败", "系统信息");
return;
}
}
if (executionPlanInfo.PlanType == 1)
{
var obj_sidePanel = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("SidePanelPlc"));

@ -219,7 +219,7 @@
<Border Grid.Row="1" BorderBrush="#0288d1" BorderThickness="0">
<WrapPanel Grid.Row="1" VerticalAlignment="Center" Margin="10 0">
<TextBlock Text="执行类型" VerticalAlignment="Center" Foreground="#FFFFFF" FontSize="18"/>
<RadioButton Content="前后板联动" x:Name="status1" Command="{Binding UpdateRadioButtonStatusCommand}" CommandParameter="{Binding Name,ElementName=status1}" Height="60" VerticalAlignment="Center" IsChecked="True" BorderBrush="White" Foreground="White" Margin="25 0" FontSize="18"/>
<RadioButton Content="前后板联动" x:Name="status1" Command="{Binding UpdateRadioButtonStatusCommand}" CommandParameter="{Binding Name,ElementName=status1}" Height="60" VerticalAlignment="Center" BorderBrush="White" Foreground="White" Margin="25 0" FontSize="18"/>
<RadioButton Content="前板计划" x:Name="status2" Command="{Binding UpdateRadioButtonStatusCommand}" CommandParameter="{Binding Name,ElementName=status2}" Height="60" VerticalAlignment="Center" BorderBrush="White" Foreground="White" Margin="25 0" FontSize="18"/>
<RadioButton Content="后板计划" x:Name="status3" Command="{Binding UpdateRadioButtonStatusCommand}" CommandParameter="{Binding Name,ElementName=status3}" Height="60" VerticalAlignment="Center" BorderBrush="White" Foreground="White" Margin="25 0" FontSize="18"/>
</WrapPanel>

@ -27,8 +27,19 @@ namespace Aucma.Core.SheetMetal.Views
private void dgvMH_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// 检查是否有单选框被选中
if (!status1.IsChecked.HasValue || !status2.IsChecked.HasValue || !status3.IsChecked.HasValue ||
!(status1.IsChecked.Value || status2.IsChecked.Value || status3.IsChecked.Value))
{
// 如果没有单选框被选中,则触发提醒弹框
MessageBox.Show("请至少选择一个执行类型!", "提醒", MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
// 至少有一个单选框被选中,执行正常逻辑
planInfoEditViewModel.MouseClick(sender);
}
}
private void queryParam_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
{

@ -7,6 +7,7 @@ using Aucma.Core.HwPLc;
using log4net;
using Aucma.Core.SheetMetalTasks.Models;
using StackExchange.Profiling.Internal;
using NetTaste;
namespace Aucma.Core.SheetMetalTasks
{
@ -191,6 +192,13 @@ namespace Aucma.Core.SheetMetalTasks
Console.WriteLine($"【{DateTime.Now.ToString("HH:m:s")}】===>未获取到需要下发的前板任务");
return;
}
// 如果前板有正在执行的计划,不再下发新计划,直接开始读取plc数量
//if (planInfoList.FirstOrDefault().ExecuteStatus == 2)
//{
// //读取设备进度,完成后再次下发新任务
// ReadDeviceComplate_SidePanel(obj_sidePanel);
//}
planInfoList = planInfoList.Where(d => d.PlanAmount > d.SidePanelAmount && (d.ExecuteStatus == 1 || d.ExecuteStatus == 2)).ToList();
if (planInfoList == null || planInfoList.Count == 0) return;
//planInfoList = planInfoList.Where(d => d.ExecuteStatus == 1 || d.ExecuteStatus == 2).ToList();
@ -298,8 +306,23 @@ namespace Aucma.Core.SheetMetalTasks
obj_sidePanel.plc.WriteInt16("D6022", SmProductId.ToString());//产品号
string processNumber = GetProcessNumberBy(planInfo.MaterialCode);
obj_sidePanel.plc.WriteString("D6010", planInfo.MaterialSpecificatons);
//int surplus = planInfo.PlanAmount-planInfo.CompleteAmount;
// 如果没有计划执行或者是切换新计划需要将剩余数量写入PLC
// 如果是当前计划继续执行,写入计划数量
int surplus = planInfo.PlanAmount;
byte[] info = obj_sidePanel.plc.Read("D6030", 40);
string planCode = Encoding.ASCII.GetString(info.Skip(0).Take(20).ToArray()).Replace("\0", "").Trim();
if(planCode==planInfo.TaskCode)
{
surplus = planInfo.PlanAmount;
}
else
{
surplus = planInfo.PlanAmount - planInfo.CompleteAmount;
}
obj_sidePanel.plc.WriteInt16("D6020", surplus.ToString());
Thread.Sleep(500);
@ -607,8 +630,23 @@ namespace Aucma.Core.SheetMetalTasks
obj_backPanel.plc.WriteInt16("D4022", productId.ToString());
string processNumber = GetProcessNumberBy(planInfo.MaterialCode);
obj_backPanel.plc.WriteString("D4010", planInfo.MaterialSpecificatons);
// 如果没有计划执行或者是切换新计划需要将剩余数量写入PLC
// 如果是当前计划继续执行,写入计划数量
int surplus = planInfo.PlanAmount;
byte[] info = obj_backPanel.plc.Read("D4030", 40);
string planCode = Encoding.ASCII.GetString(info.Skip(0).Take(20).ToArray()).Replace("\0", "").Trim();
if (planCode == planInfo.TaskCode)
{
surplus = planInfo.PlanAmount;
}
else
{
surplus = planInfo.PlanAmount - planInfo.CompleteAmount;
}
//int surplus = planInfo.PlanAmount - planInfo.CompleteAmount;//剩余计划数量
int surplus = planInfo.PlanAmount;//剩余计划数量
obj_backPanel.plc.WriteInt16("D4020", surplus.ToString());
Thread.Sleep(500);
@ -1960,6 +1998,7 @@ namespace Aucma.Core.SheetMetalTasks
{
string productId = obj_SidePanel.plc.ReadInt16("D1402").ToString();
Bin bin = new Bin();
bin.Id = 1;
bin.ProductId = productId;
bin.Status = startb0;
list.Add(bin);
@ -1969,6 +2008,7 @@ namespace Aucma.Core.SheetMetalTasks
{
string productId = obj_SidePanel.plc.ReadInt16("D1426").ToString();
Bin bin = new Bin();
bin.Id = 2;
bin.ProductId = productId;
bin.Status = startb0;
list.Add(bin);
@ -1976,8 +2016,10 @@ namespace Aucma.Core.SheetMetalTasks
var startb4 = obj_SidePanel.plc.ReadBool("M142");
if (startb4)
{
string productId = obj_SidePanel.plc.ReadInt16("D1450").ToString();
Bin bin = new Bin();
bin.Id = 3;
bin.ProductId = productId;
bin.Status = startb4;
list.Add(bin);
@ -1987,6 +2029,7 @@ namespace Aucma.Core.SheetMetalTasks
{
string productId = obj_SidePanel.plc.ReadInt16("D1474").ToString();
Bin bin = new Bin();
bin.Id = 4;
bin.ProductId = productId;
bin.Status = startb6;
list.Add(bin);

@ -11,6 +11,10 @@ namespace Aucma.Core.SheetMetalTasks.Models
/// </summary>
public class Bin
{
/// <summary>
/// 机头ID
/// </summary>
public int Id { get; set; }
/// <summary>
/// 料仓Id
/// </summary>

Loading…
Cancel
Save