|
|
@@ -195,6 +195,12 @@ namespace TeamAAS_VP.Core
|
|
|
get { return _Yield; }
|
|
|
set { SetProperty(ref _Yield, value); }
|
|
|
}
|
|
|
+ private ObservableCollection<ProductModel> _ProductList;
|
|
|
+ public ObservableCollection<ProductModel> ProductList
|
|
|
+ {
|
|
|
+ get { return _ProductList; }
|
|
|
+ set { SetProperty(ref _ProductList, value); }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region 命令
|
|
|
@@ -1170,6 +1176,8 @@ namespace TeamAAS_VP.Core
|
|
|
/// 工单信息
|
|
|
/// </summary>
|
|
|
string[] wo = new string[10];
|
|
|
+ string[] model_num = new string[10];//产品model_num
|
|
|
+ string[] color = new string[10];//产品color
|
|
|
/// <summary>
|
|
|
/// 复检结果
|
|
|
/// </summary>
|
|
|
@@ -2528,7 +2536,7 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
LogHelper.WriteLogMes($"【mes开始QUERY】");
|
|
|
SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
|
|
|
- (bool isSuccess, string response) = await _mesService.StationGetExAsync(i, code, "", 2);//询问mes
|
|
|
+ (bool isSuccess, string response) = await _mesService.StationGetExAsync(i, code, PartSN, 2);//询问mes
|
|
|
if (isSuccess)
|
|
|
{
|
|
|
LogHelper.WriteLogMes($"询问mes成功");
|
|
|
@@ -2543,7 +2551,7 @@ namespace TeamAAS_VP.Core
|
|
|
SendTaskMessage($"过度件sn:{ProductMainSN_Temp}", MessageLevel.Info);
|
|
|
}
|
|
|
|
|
|
- (bool isSuccess2, string response2) = await _mesService.StationGetAsync(i, ProductMainSN_Temp, "", 2);//询问mes
|
|
|
+ (bool isSuccess2, string response2) = await _mesService.StationGetAsync(i, ProductMainSN_Temp, PartSN, 2);//询问mes
|
|
|
if (isSuccess2)
|
|
|
{
|
|
|
LogHelper.WriteLogMes($"第二次询问mes成功");
|
|
|
@@ -2567,7 +2575,45 @@ namespace TeamAAS_VP.Core
|
|
|
wo[i] = woItem.Replace("wo=", "").Trim();
|
|
|
SendTaskMessage($"工单信息:{wo[i]}", MessageLevel.Info);
|
|
|
}
|
|
|
+ string modelItem = item.FirstOrDefault(f => f.Contains("model_num="));
|
|
|
+ if (modelItem != null)
|
|
|
+ {
|
|
|
+ model_num[i] = modelItem.Replace("model_num=", "").Trim();
|
|
|
+ SendTaskMessage($"model_num:{model_num[i]}", MessageLevel.Info);
|
|
|
+ }
|
|
|
+ string colorItem = item.FirstOrDefault(f => f.Contains("color="));
|
|
|
+ if (colorItem != null)
|
|
|
+ {
|
|
|
+ color[i] = colorItem.Replace("color=", "").Trim();
|
|
|
+ SendTaskMessage($"color:{color[i]}", MessageLevel.Info);
|
|
|
+ }
|
|
|
|
|
|
+ //切换产品
|
|
|
+ if (i == 0)//i=0时才会切换产品
|
|
|
+ {
|
|
|
+ var q = await _systemDatabaseService.QueryProductFromMesAsync(model_num[i], color[i]);
|
|
|
+ if (!string.IsNullOrEmpty(q))
|
|
|
+ {
|
|
|
+ ProductList = new ObservableCollection<ProductModel>(_productService.GetAllProducts());
|
|
|
+ Guid productId = Guid.Empty;
|
|
|
+ foreach (var itt in ProductList)
|
|
|
+ {
|
|
|
+ if (itt.Name == q)
|
|
|
+ {
|
|
|
+ productId = itt.ID;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (currentProduct.ID != productId)
|
|
|
+ {
|
|
|
+ //切换产品
|
|
|
+ _productService.LoadProduct(productId);
|
|
|
+ _productService.SetCurrentProduct(productId);
|
|
|
+ await WritePositionToPlcAsync();
|
|
|
+ SendTaskMessage($"切换产品成功", MessageLevel.Debug);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
|
|
|
@@ -2600,7 +2646,7 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
LogHelper.WriteLogMes($"【mes开始QUERY】");
|
|
|
SendTaskMessage($"mes开始QUERY", MessageLevel.Info);
|
|
|
- (bool isSuccess, string response) = await _mesService.StationGetAsync(i, code, "", 2);//询问mes
|
|
|
+ (bool isSuccess, string response) = await _mesService.StationGetAsync(i, code, PartSN, 2);//询问mes
|
|
|
if (isSuccess)
|
|
|
{
|
|
|
string[] item = response.Split('\n');
|
|
|
@@ -2622,10 +2668,49 @@ namespace TeamAAS_VP.Core
|
|
|
wo[i] = woItem.Replace("wo=", "").Trim();
|
|
|
SendTaskMessage($"工单信息:{wo[i]}", MessageLevel.Info);
|
|
|
}
|
|
|
-
|
|
|
+ string modelItem = item.FirstOrDefault(f => f.Contains("model_num="));
|
|
|
+ if (modelItem != null)
|
|
|
+ {
|
|
|
+ model_num[i] = modelItem.Replace("model_num=", "").Trim();
|
|
|
+ SendTaskMessage($"model_num:{model_num[i]}", MessageLevel.Info);
|
|
|
+ }
|
|
|
+ string colorItem = item.FirstOrDefault(f => f.Contains("color="));
|
|
|
+ if (colorItem != null)
|
|
|
+ {
|
|
|
+ color[i] = colorItem.Replace("color=", "").Trim();
|
|
|
+ SendTaskMessage($"color:{color[i]}", MessageLevel.Info);
|
|
|
+ }
|
|
|
|
|
|
LogHelper.WriteLogMes($"询问mes成功");
|
|
|
SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
|
|
|
+
|
|
|
+ //切换产品
|
|
|
+ if (i == 0)//i=0时才会切换产品
|
|
|
+ {
|
|
|
+ var q = await _systemDatabaseService.QueryProductFromMesAsync(model_num[i], color[i]);
|
|
|
+ if (!string.IsNullOrEmpty(q))
|
|
|
+ {
|
|
|
+ ProductList = new ObservableCollection<ProductModel>(_productService.GetAllProducts());
|
|
|
+ Guid productId = Guid.Empty;
|
|
|
+ foreach (var itt in ProductList)
|
|
|
+ {
|
|
|
+ if (itt.Name == q)
|
|
|
+ {
|
|
|
+ productId = itt.ID;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (currentProduct.ID != productId)
|
|
|
+ {
|
|
|
+ //切换产品
|
|
|
+ _productService.LoadProduct(productId);
|
|
|
+ _productService.SetCurrentProduct(productId);
|
|
|
+ await WritePositionToPlcAsync();
|
|
|
+ SendTaskMessage($"切换产品成功", MessageLevel.Debug);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
|