|
@@ -1,5 +1,6 @@
|
|
|
|
|
|
using DefaultEdit.Communication;
|
|
|
+using DefaultEdit.DataBase;
|
|
|
using DefaultEdit.Log4xml;
|
|
|
using DefaultEdit.Model;
|
|
|
using Newtonsoft.Json.Linq;
|
|
@@ -21,6 +22,7 @@ using System.Text;
|
|
|
using System.Threading;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows;
|
|
|
+using System.Xml.Linq;
|
|
|
|
|
|
|
|
|
namespace DefaultEdit.Core
|
|
@@ -48,6 +50,10 @@ namespace DefaultEdit.Core
|
|
|
|
|
|
public CurrConfig CurrConfig { get => _currConfig; set { SetProperty(ref _currConfig, value); } }
|
|
|
|
|
|
+ private tb_formulasdata _formulasdata = new tb_formulasdata();
|
|
|
+
|
|
|
+ public tb_formulasdata Formulasdata { get => _formulasdata; set { SetProperty(ref _formulasdata, value); } }
|
|
|
+
|
|
|
private DateTime _DateTimeNow;
|
|
|
/// <summary>
|
|
|
/// 当前时间
|
|
@@ -85,15 +91,9 @@ namespace DefaultEdit.Core
|
|
|
|
|
|
public CurentApplicationSettings CurentApplicationSettings { get => _CurentApplicationSettings; set { SetProperty(ref _CurentApplicationSettings, value); } }
|
|
|
|
|
|
+ public bool Ismeswork { get => ismeswork; set => ismeswork = value; }
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ private bool ismeswork = true;
|
|
|
//运行线程
|
|
|
private Thread WorkThread;
|
|
|
|
|
@@ -158,6 +158,11 @@ namespace DefaultEdit.Core
|
|
|
LogHelper.Info(" 1工位离心开始");
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ LogHelper.Info(" 1工位离心开始");
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
break;
|
|
@@ -193,24 +198,29 @@ namespace DefaultEdit.Core
|
|
|
CurrStationRfid[1] = "";
|
|
|
CurrStationRfid[2] = "";
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.Info(" 1工位离心完成");
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
break;
|
|
|
case "2工位离心开始":
|
|
|
if ( value )
|
|
|
{
|
|
|
stopwatchs[1].Restart();
|
|
|
- if ( RfIDList.Count != 0 )
|
|
|
+ if (RfIDList.Count != 0)
|
|
|
{
|
|
|
- int index= RfIDList.FindIndex(x => x.StationId == 3);
|
|
|
- if ( index != -1 )
|
|
|
+ int index = RfIDList.FindIndex(x => x.StationId == 3);
|
|
|
+ if (index != -1)
|
|
|
{
|
|
|
- RfIDList[ index ].StationId = 4;
|
|
|
- CurrStationRfid[ 3 ] = RfIDList[ index ].Rfid;
|
|
|
- LogHelper.Info(RfIDList[ index ].Rfid + " 2工位离心开始");
|
|
|
+ RfIDList[index].StationId = 4;
|
|
|
+ CurrStationRfid[3] = RfIDList[index].Rfid;
|
|
|
+ LogHelper.Info(RfIDList[index].Rfid + " 2工位离心开始");
|
|
|
}
|
|
|
- else
|
|
|
+ else
|
|
|
{
|
|
|
- LogHelper.Info( " 2工位离心开始");
|
|
|
+ LogHelper.Info(" 2工位离心开始");
|
|
|
}
|
|
|
index = RfIDList.FindIndex(x => x.StationId == 1);
|
|
|
if (index != -1)
|
|
@@ -224,6 +234,10 @@ namespace DefaultEdit.Core
|
|
|
LogHelper.Info(" 2工位离心开始");
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.Info(" 2工位离心开始");
|
|
|
+ }
|
|
|
}
|
|
|
break;
|
|
|
case "2工位离心完成":
|
|
@@ -256,6 +270,10 @@ namespace DefaultEdit.Core
|
|
|
CurrStationRfid[3] = "";
|
|
|
CurrStationRfid[4] = "";
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.Info(" 2工位离心完成");
|
|
|
+ }
|
|
|
}
|
|
|
break;
|
|
|
case "脱模开始":
|
|
@@ -263,7 +281,10 @@ namespace DefaultEdit.Core
|
|
|
{
|
|
|
|
|
|
LogHelper.Info(CurrConfig.Rfid + " 脱模开始");
|
|
|
- PlateInPlace(CurrConfig.Rfid);
|
|
|
+
|
|
|
+ PlateInPlace(CurrConfig.Rfid);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
break;
|
|
|
case "脱模完成":
|
|
@@ -271,7 +292,8 @@ namespace DefaultEdit.Core
|
|
|
{
|
|
|
|
|
|
LogHelper.Info(CurrConfig.Rfid + " 脱模完成");
|
|
|
- PrintInfo(processDataModels[0],"");
|
|
|
+ if(processDataModels.Count!=0)
|
|
|
+ PrintInfo(processDataModels[0],"手动");
|
|
|
}
|
|
|
break;
|
|
|
case "固化开始":
|
|
@@ -304,6 +326,10 @@ namespace DefaultEdit.Core
|
|
|
LogHelper.Info(" 固化开始");
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.Info(" 固化开始");
|
|
|
+ }
|
|
|
}
|
|
|
break;
|
|
|
case "固化完成":
|
|
@@ -343,6 +369,10 @@ namespace DefaultEdit.Core
|
|
|
}
|
|
|
ProduceDataToChangeEvent?.Invoke();
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogHelper.Info(" 固化完成");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|
|
@@ -367,7 +397,8 @@ namespace DefaultEdit.Core
|
|
|
BoolPairs.Add("固化完成", false);
|
|
|
BoolPairs.CollectionChanged += BoolPairs_CollectionChanged;
|
|
|
|
|
|
-
|
|
|
+ //BoolPairs["脱模开始"] =true ;
|
|
|
+ //BoolPairs["脱模完成"] = true ;
|
|
|
|
|
|
while ( true )
|
|
|
{
|
|
@@ -376,9 +407,9 @@ namespace DefaultEdit.Core
|
|
|
if (s7PlcCommunicate!=null&& s7PlcCommunicate.IsConnected )
|
|
|
{
|
|
|
byte []buff= s7PlcCommunicate.ReadByte(25, 780, 84);
|
|
|
- int actuallength=buff[53];
|
|
|
+ int actuallength=buff[73];
|
|
|
byte[] buffsT = new byte[ actuallength ];
|
|
|
- Array.Copy(buff, 54, buffsT, 0, actuallength);
|
|
|
+ Array.Copy(buff, 74, buffsT, 0, actuallength);
|
|
|
CurrConfig.Rfid = Encoding.ASCII.GetString(buffsT);
|
|
|
BoolPairs[ "1工位离心开始" ] = s7PlcCommunicate.GetBitAt(buff, 0, 0);
|
|
|
BoolPairs[ "1工位离心完成" ] = s7PlcCommunicate.GetBitAt(buff, 0, 1);
|
|
@@ -419,6 +450,10 @@ namespace DefaultEdit.Core
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ List<tb_formulasdata> tb_Formulasdatas = SqlSugarHelper.Queryabletb_formulasdata();
|
|
|
+ if (tb_Formulasdatas.Count != 0)
|
|
|
+ Formulasdata = tb_Formulasdatas[0];
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
@@ -484,35 +519,44 @@ namespace DefaultEdit.Core
|
|
|
var count = 0;
|
|
|
var tip = "";
|
|
|
var isoutline = false;
|
|
|
- var groupdata = _httpService.GetGroupItems(boardId, CurentApplicationSettings.DeviceId);
|
|
|
- if ( !groupdata.Success )
|
|
|
+ XnRestfulResult<List<Re_Items>> groupdata=new XnRestfulResult<List<Re_Items>>();
|
|
|
+ if (Ismeswork)
|
|
|
{
|
|
|
-
|
|
|
- if ( groupdata.RawText.Contains("未点检") )
|
|
|
+ groupdata = _httpService.GetGroupItems(boardId, CurentApplicationSettings.DeviceId);
|
|
|
+ if (!groupdata.Success)
|
|
|
{
|
|
|
- var s = MessageBox.Show("设备未点检,请点检后确认!", "提示", MessageBoxButton.OK);
|
|
|
|
|
|
+ if (groupdata.RawText.Contains("未点检"))
|
|
|
+ {
|
|
|
+ var s = MessageBox.Show("设备未点检,请点检后确认!", "提示", MessageBoxButton.OK);
|
|
|
+
|
|
|
+ }
|
|
|
+ LogHelper.MesInfo($"网板ID:{boardId}获取信息失败,Code:{(int)groupdata.Code},原因:{groupdata.RawText}");
|
|
|
+ isoutline = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (groupdata.Data.Count <= 0)
|
|
|
+ {
|
|
|
+ LogHelper.MesInfo($"网板ID:{boardId}获取信息失败,Code:{(int)groupdata.Code},原因:{groupdata.RawText}");
|
|
|
+ isoutline = true;
|
|
|
+ }
|
|
|
}
|
|
|
- LogHelper.MesInfo($"网板ID:{boardId}获取信息失败,Code:{( int ) groupdata.Code},原因:{groupdata.RawText}");
|
|
|
- isoutline = true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if ( groupdata.Data.Count <= 0 )
|
|
|
- {
|
|
|
- LogHelper.MesInfo($"网板ID:{boardId}获取信息失败,Code:{( int ) groupdata.Code},原因:{groupdata.RawText}");
|
|
|
- isoutline = true;
|
|
|
- }
|
|
|
+
|
|
|
+ isoutline = true;
|
|
|
}
|
|
|
- if ( !isoutline )
|
|
|
+ if (!isoutline)
|
|
|
{
|
|
|
///上传后处理记录
|
|
|
var result = UpdateRecord(boardId);
|
|
|
- if ( !string.IsNullOrEmpty(result) )
|
|
|
+ if (!string.IsNullOrEmpty(result))
|
|
|
{
|
|
|
LogHelper.MesInfo($"上传记录失败,{result}!");
|
|
|
var boxresult = MessageBox.Show($"{result}(是:放回;否:重试)", "提示", MessageBoxButton.YesNo);
|
|
|
- if ( boxresult == MessageBoxResult.Yes )
|
|
|
+ if (boxresult == MessageBoxResult.Yes)
|
|
|
{
|
|
|
IsOK = false;
|
|
|
return;
|
|
@@ -520,7 +564,7 @@ namespace DefaultEdit.Core
|
|
|
|
|
|
}
|
|
|
///读取网板内的牙模的信息(方便打印在小票上),如果读取失败就读取下一个牙模,读取成功就跳出循环
|
|
|
- for ( int i = 0; i < 10; i++ )
|
|
|
+ for (int i = 0; i < 10; i++)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -528,44 +572,44 @@ namespace DefaultEdit.Core
|
|
|
count = groupdata.Data.Count;
|
|
|
var Id = groupdata.Data[groupdata.Data.Count - i].itemId;
|
|
|
var infos = _httpService.GetModels(Id, CurentApplicationSettings.DeviceId);
|
|
|
- if ( infos.Success )
|
|
|
+ if (infos.Success)
|
|
|
{
|
|
|
modelsinfo = infos.Data.uvcuringReleaseBatch + " " + infos.Data.alignerSpec.material + "-" + infos.Data.alignerSpec.thickness;
|
|
|
- if ( infos.Data.order.is_expedited == "1" || infos.Data.remade || infos.Data.produceType == "R" )
|
|
|
+ if (infos.Data.order.is_expedited == "1" || infos.Data.remade || infos.Data.produceType == "R")
|
|
|
{
|
|
|
modelsinfo = modelsinfo + "\r\n";
|
|
|
- if ( infos.Data.order.is_expedited == "1" )
|
|
|
+ if (infos.Data.order.is_expedited == "1")
|
|
|
{
|
|
|
modelsinfo = modelsinfo + " 加急";
|
|
|
}
|
|
|
- if ( infos.Data.remade )
|
|
|
+ if (infos.Data.remade)
|
|
|
{
|
|
|
modelsinfo = modelsinfo + " 返工";
|
|
|
}
|
|
|
- if ( infos.Data.produceType == "R" )
|
|
|
+ if (infos.Data.produceType == "R")
|
|
|
{
|
|
|
modelsinfo = modelsinfo + " 保持器";
|
|
|
}
|
|
|
}
|
|
|
iskid = infos.Data.isKid;
|
|
|
ishaiwai = infos.Data.order.country.Contains("中国") ? false : true;
|
|
|
- if ( infos.Data.processParameters != null )
|
|
|
+ if (infos.Data.processParameters != null)
|
|
|
{
|
|
|
var carrierf = infos.Data.processParameters.FirstOrDefault(x => x.key == "carrier");
|
|
|
- if ( carrierf != null )
|
|
|
+ if (carrierf != null)
|
|
|
{
|
|
|
isLarge = carrierf.value == "small" ? "小载具" : "大载具";
|
|
|
}
|
|
|
}
|
|
|
var record = _httpService.GetProductionRecord(Id);
|
|
|
- if ( record.Success )
|
|
|
+ if (record.Success)
|
|
|
{
|
|
|
printdeviceId = record.Data.First().deviceId;
|
|
|
- if ( record.Data.First().description.FirstOrDefault(x => x.key == "printTaskId") != null )
|
|
|
+ if (record.Data.First().description.FirstOrDefault(x => x.key == "printTaskId") != null)
|
|
|
{
|
|
|
var taskId = record.Data.First().description.FirstOrDefault(x => x.key == "printTaskId").value;
|
|
|
var taskinfo = _httpService.GetPrintTask(taskId);
|
|
|
- if ( taskinfo.Success )
|
|
|
+ if (taskinfo.Success)
|
|
|
{
|
|
|
materialtype = taskinfo.Data.description.FirstOrDefault(x => x.key == "filmType") != null ? taskinfo.Data.description.FirstOrDefault(x => x.key == "filmType").value : "";
|
|
|
printTagProduct = taskinfo.Data.description.FirstOrDefault(x => x.key == "printTagProduct") != null ? taskinfo.Data.description.FirstOrDefault(x => x.key == "printTagProduct").value : "";
|
|
@@ -576,7 +620,7 @@ namespace DefaultEdit.Core
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- catch ( Exception e )
|
|
|
+ catch (Exception e)
|
|
|
{
|
|
|
LogHelper.Error("读取网板内牙模信息异常:" + e.ToString());
|
|
|
}
|