Selaa lähdekoodia

1. 修改配料请求申请的方式。避免发错配料请求。

master
ZhaoGang 1 vuosi sitten
vanhempi
commit
eac4c0e99d
3 muutettua tiedostoa jossa 57 lisäystä ja 7 poistoa
  1. +2
    -0
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  2. +2
    -2
      BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
  3. +53
    -5
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs

+ 2
- 0
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs Näytä tiedosto

@@ -1473,6 +1473,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
GVL_BigStation.Recipe2DosingFinish = true;
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:{code},托盘编号:{trayCode},配料完成");
ReadStockBinDosingWeight(SiemensRecipes.ElementAt(index));

if (SiemensDevice.IsConnected && SiemensRecipes.ElementAt(index).RecipesSource == RecipeSource.远程 /*!GVL_BigStation.IsUseLocalRecipe*/)
{
FinishData.Order_No = SiemensRecipes.ElementAt(index).RecipeCode;
@@ -1499,6 +1500,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
MessageNotify.GetInstance.ShowRunLog($"配方2,配方编号:【{code}】,托盘编号:【{trayCode}】,配料完成,西门子未连接或配方为本地下发未将完成数据反馈至MES系统。");
}

HKDevice.HK_PLC_S7.Write("DB99.DBX1.5", true);
GVL_BigStation.Recipe2DosingStatus = 3;
}


+ 2
- 2
BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs Näytä tiedosto

@@ -204,9 +204,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// </summary>
public int RecipeStatusIDTray1 { get; set; } = 0;

[VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
[VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料,3:PLC配料完成,返回完成数据。")]
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料,3:PLC配料完成,返回完成数据。
/// </summary>
public int[] RecipeProcessStatus { get; set; } = new int[5] { 0, 0, 0, 0, 0 };



+ 53
- 5
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs Näytä tiedosto

@@ -1,4 +1,5 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPA.Message;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodSmallStation.Model.GVL;
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
@@ -10,6 +11,7 @@ using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Configuration;
using System.Linq;
using System.Reflection;
@@ -538,7 +540,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
foreach (var data in RemoteRecipes)
{
if (data.TrayCode == 1)
if (data.TrayCode == 1 && IsInQueue(data.RecipeCode))
{
if (SiemensDevice.XL_Status is XL_Status_DB status)
{
@@ -1010,8 +1012,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
MessageNotify.GetInstance.ShowRunLog($"配方ID:【{code}】:【{item.RawMaterialName}】,下料重量:【{item.Laying_Off_Weight}】g");
}

GVL_SmallStation.GetInstance.RecipeProcessStatus[recipeNum] = 3;

#region 给主控PLC发送配料完成数据信号。
if (SiemensDevice.IsConnected && !GVL_SmallStation.GetInstance.IsUseLocalRecipe)
if (SiemensDevice.IsConnected && RemoteRecipes.ElementAt(index).RecipesSource==RecipeSource.远程 /*!GVL_SmallStation.GetInstance.IsUseLocalRecipe*/)
{
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
@@ -1044,10 +1048,12 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
else
{
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方【{res.RecipeCode}】,配料完成,数据无法反馈给西门子,西门子设备未连接或处于本地配方");
MessageNotify.GetInstance.ShowRecipeLog(res.RecipeName);
}
MessageNotify.GetInstance.ShowRecipeLog($"配方名称:【{res.RecipeName}】\t 配方号:【{res.RecipeCode}】");
}
#endregion

GVL_SmallStation.GetInstance.WindSendDosing = false;
App.Current.Dispatcher.Invoke(() =>
{
@@ -1777,5 +1783,47 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0059", "孜然粉");
GVL_SmallStation.GetInstance.RawMaterialsNameCode.TryAdd("0060", "孜然油");
}

/// <summary>
/// 检查指定的配方号是否已经下发至配方执行队列中。
/// </summary>
/// <param name="recipeCode">需要检测的配方号</param>
/// <returns>是否在下发配方执行队列中</returns>
private bool IsInQueue(string recipeCode)
{
bool result = false;
foreach (var queue in RecipeQueueTray.Values)
{
if (queue.Contains(recipeCode))
{
result = true;
break;
}
}
return result;
}
private void SendFinishData(XL_Finish_DB finishData)
{
var isConnected = SiemensDevice.IsConnected;

if (isConnected)
{
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(finishData, 2261);
}


//读取mes是否收到完成数据。
if (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2261.DBX0.0")==true)
{
MessageNotify.GetInstance.ShowRunLog("发送了完成数据");
}
else
{

}


}
}
}

Ladataan…
Peruuta
Tallenna