|
|
@@ -2402,7 +2402,7 @@ namespace TeamAAS_VP.Core
|
|
|
{
|
|
|
SendTaskMessage($"不是当站螺丝:{code}", MessageLevel.Info);
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_QrCodePhotoResault.Address, (Int16)2);
|
|
|
- await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -2562,7 +2562,7 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
//产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
- await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -2572,117 +2572,88 @@ namespace TeamAAS_VP.Core
|
|
|
|
|
|
//产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
- await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)3);
|
|
|
}
|
|
|
}
|
|
|
else //直接基于RFID询问是否过站
|
|
|
{
|
|
|
SendTaskMessage($"基于RFID询问是否过站", MessageLevel.Debug);
|
|
|
- (bool isSuccess, string response) = await _mesService.StationGetExAsync(code, "", 2);
|
|
|
+ (bool isSuccess, string response) = await _mesService.StationGetAsync(code, "", 2);//询问mes
|
|
|
if (isSuccess)
|
|
|
{
|
|
|
- string ProductMainSN_Temp = "";
|
|
|
LogHelper.WriteLogMes($"询问mes成功");
|
|
|
SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
|
|
|
- string[] item = response.Split('\n');
|
|
|
- //获取过度件sn
|
|
|
+
|
|
|
+ var item = response.Split('\n');
|
|
|
string snItem = item.FirstOrDefault(f => f.Contains("sn="));
|
|
|
if (snItem != null)
|
|
|
{
|
|
|
- ProductMainSN_Temp = snItem.Replace("sn=", "").Trim();
|
|
|
- SendTaskMessage($"过度件sn:{ProductMainSN_Temp}", MessageLevel.Info);
|
|
|
+ ProductMainSN[i] = snItem.Replace("sn=", "").Trim();
|
|
|
+ _productService.CurrentProductCode = ProductMainSN[i];
|
|
|
+ //_eventAggregator.GetEvent<DelaySaveImageNotification>().Publish(true);//通知界面延迟保存图片,等待MES查询结果返回,避免图片和数据不同步
|
|
|
+ SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
|
|
|
}
|
|
|
-
|
|
|
- LogHelper.WriteLogMes($"询问mes成功");
|
|
|
- SendTaskMessage($"询问mes成功:{response}", MessageLevel.Debug);
|
|
|
-
|
|
|
- (bool isSuccess2, string response2) = await _mesService.StationGetAsync(ProductMainSN_Temp, "", 2);//询问mes
|
|
|
- if (isSuccess2)
|
|
|
+ string woItem = item.FirstOrDefault(f => f.Contains("wo="));
|
|
|
+ if (woItem != null)
|
|
|
{
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ string ppidItem = item.FirstOrDefault(f => f.Contains("ppid="));
|
|
|
+ if (ppidItem != null)
|
|
|
+ {
|
|
|
+ ppid[i] = ppidItem.Replace("ppid=", "").Trim();
|
|
|
+ SendTaskMessage($"ppid:{ppid[i]}", MessageLevel.Info);
|
|
|
+ }
|
|
|
+ string revisionItem = item.FirstOrDefault(f => f.Contains("stage="));
|
|
|
+ if (revisionItem != null)
|
|
|
+ {
|
|
|
+ revision[i] = revisionItem.Replace("stage=", "").Trim();
|
|
|
+ SendTaskMessage($"stage:{revision[i]}", MessageLevel.Info);
|
|
|
+ }
|
|
|
|
|
|
- item = response2.Split('\n');
|
|
|
- snItem = item.FirstOrDefault(f => f.Contains("sn="));
|
|
|
- if (snItem != null)
|
|
|
- {
|
|
|
- ProductMainSN[i] = snItem.Replace("sn=", "").Trim();
|
|
|
- _productService.CurrentProductCode = ProductMainSN[i];
|
|
|
- SendTaskMessage($"产品主sn:{ProductMainSN[i]}", MessageLevel.Info);
|
|
|
- }
|
|
|
- string woItem = item.FirstOrDefault(f => f.Contains("wo="));
|
|
|
- if (woItem != null)
|
|
|
- {
|
|
|
- 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);
|
|
|
- }
|
|
|
- string ppidItem = item.FirstOrDefault(f => f.Contains("ppid="));
|
|
|
- if (ppidItem != null)
|
|
|
- {
|
|
|
- ppid[i] = ppidItem.Replace("ppid=", "").Trim();
|
|
|
- SendTaskMessage($"ppid:{ppid[i]}", MessageLevel.Info);
|
|
|
- }
|
|
|
- string revisionItem = item.FirstOrDefault(f => f.Contains("stage="));
|
|
|
- if (revisionItem != null)
|
|
|
- {
|
|
|
- revision[i] = revisionItem.Replace("stage=", "").Trim();
|
|
|
- SendTaskMessage($"stage:{revision[i]}", MessageLevel.Info);
|
|
|
- }
|
|
|
-
|
|
|
- LogHelper.WriteLogMes($"第二次询问mes成功");
|
|
|
- SendTaskMessage($"第二次询问mes成功:{response2}", MessageLevel.Debug);
|
|
|
-
|
|
|
- //切换产品
|
|
|
- if (i == 0)//i=0时才会切换产品
|
|
|
+ //切换产品
|
|
|
+ if (i == 0)//i=0时才会切换产品
|
|
|
+ {
|
|
|
+ var q = await _systemDatabaseService.QueryProductFromMesAsync(model_num[i], color[i]);
|
|
|
+ if (q != null && !string.IsNullOrEmpty(q.ProductName))
|
|
|
{
|
|
|
- var q = await _systemDatabaseService.QueryProductFromMesAsync(model_num[i], color[i]);
|
|
|
- if (q != null && !string.IsNullOrEmpty(q.ProductName))
|
|
|
+ ProductList = new ObservableCollection<ProductModel>(_productService.GetAllProducts());
|
|
|
+ Guid productId = Guid.Empty;
|
|
|
+ foreach (var itt in ProductList)
|
|
|
{
|
|
|
- ProductList = new ObservableCollection<ProductModel>(_productService.GetAllProducts());
|
|
|
- Guid productId = Guid.Empty;
|
|
|
- foreach (var itt in ProductList)
|
|
|
- {
|
|
|
- if (itt.Name == q.ProductName)
|
|
|
- {
|
|
|
- productId = itt.ID;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (currentProduct.ID != productId)
|
|
|
+ if (itt.Name == q.ProductName)
|
|
|
{
|
|
|
- //切换产品
|
|
|
- await _productService.LoadProductAsync(productId);
|
|
|
- _productService.SetCurrentProduct(productId);
|
|
|
- await WriteParameterToPlcExAsync();
|
|
|
- SendTaskMessage($"切换产品成功", MessageLevel.Debug);
|
|
|
+ productId = itt.ID;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
+ if (currentProduct.ID != productId)
|
|
|
+ {
|
|
|
+ //切换产品
|
|
|
+ await _productService.LoadProductAsync(productId);
|
|
|
+ _productService.SetCurrentProduct(productId);
|
|
|
+ await WriteParameterToPlcExAsync();
|
|
|
+ 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);
|
|
|
-
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- LogHelper.WriteLogMes($"第二次询问mes失败");
|
|
|
- SendTaskMessage($"第二次询问mes失败:{response2}", MessageLevel.Error);
|
|
|
|
|
|
- //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
- await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
- await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)2);
|
|
|
- }
|
|
|
+ //产品发生改变并且供料器发生了变化时,需要通知PLC进行取料更改
|
|
|
+ await plc.WriteNodeAsync(addressConfig.Out_ScrewFeederIsChanged.Address, (Int16)1); //不发生改变
|
|
|
+ await plc.WriteNodeAsync(string.Format(addressConfig.Out_MesStatus.Address, i), (Int16)1);
|
|
|
}
|
|
|
else
|
|
|
{
|