Przeglądaj źródła

V2.0.7 优化报警

TongWei
CPL 1 rok temu
rodzic
commit
8ead4d2bf4
1 zmienionych plików z 32 dodań i 5 usunięć
  1. +32
    -5
      halftoneproject-master/BanBoShi/SysCtrl/SysMgr.cs

+ 32
- 5
halftoneproject-master/BanBoShi/SysCtrl/SysMgr.cs Wyświetl plik

@@ -10176,6 +10176,7 @@ namespace MaiMuAOI.SysCtrl
public bool SaveFileOrderData(string SavePath, string printerTemp, List<PrintInfo> data, Product model)
{
bool ret = true;
int step = 0;
try
{
if (!printControl.ExcelOpenFile(printerTemp))
@@ -10183,40 +10184,52 @@ namespace MaiMuAOI.SysCtrl
Log("保存", $"保存失败: 模板打开失败", WarningEnum.Low);
ret = false;
}
step = 1;
Dictionary<string, string> printData = new Dictionary<string, string>();
if (ret)
{
if (data != null)
{
step = 2;
foreach (var item in data)
{
string value = "";
//直接添加数据
if (item.Type == 3 && item.IsValue) //excel数据
{
step = 4;
if (!printData.ContainsKey(item.PrintKey))
{
step = 41;
printData.Add(item.PrintKey, item.PrintCode);
}
else
{
step = 42;
printData.Remove(item.PrintKey);
printData.Add(item.PrintKey, item.PrintCode);
}
step =43;
}
else if (item.Type == 3 && !item.IsValue) //excel Code
{
step = 5;
switch (item.PrintCode)
{
case "料号批次":
step = 51;
value = order.BatchId;
break;
case "外观比对":
step = 52;
if (CurrDefectOrders != null)
{
value = CurrDefectOrders.Exists(t => t.CompareResult == 2) ? "不符合要求" : "符合要求";
}
break;
case "检测结果":
step = 53;
if (CurrDefectOrders != null)
{
value = CurrDefectOrders.Exists(t => t.Qualified == false) ? "不符合要求" : "符合要求";
@@ -10224,51 +10237,63 @@ namespace MaiMuAOI.SysCtrl
//value = order.Qualified ? "合格" : "不合格";
break;
case "检测数量":
step = 54;
value = TotalCnt.ToString();
break;
case "合格数量":
step = 55;
if (CurrDefectOrders != null)
{
value = CurrDefectOrders.FindAll(t => t.Qualified == true).Count.ToString();
}
break;
case "不合格数量":
step = 56;
if (CurrDefectOrders != null)
{
value = CurrDefectOrders.FindAll(t => t.Qualified == false).Count.ToString();
}
break;
case "料号":
step = 57;
value = order.OrderCode;
break;
case "料号名称":
step = 58;
if (model != null)
value = model.Name;
else
value = "No Find";
break;
case "供应商":
step = 59;
if (model != null)
value = model.Spec;
else
value = "No Find";
break;
case "网版编码":
step = 510;
value = order.SN;
break;
case "检测单号":
step = 511;
value = order.DetectOrder;
break;
case "检测时间":
step = 512;
value = order.CreateTime.ToString("yyyy/MM/dd HH:mm");
break;
case "检测日期":
step = 513;
value = order.CreateTime.ToString("yyyy/MM/dd");
break;
case "操作员":
step = 514;
value = userMgr.LoginUser.Name;
break;
case "综合":
step = 515;
if (CurrDefectOrders != null)
{
List<SizeDefectInfo> frt = new List<SizeDefectInfo>();
@@ -10333,12 +10358,14 @@ namespace MaiMuAOI.SysCtrl
}
if (!printData.ContainsKey(item.PrintKey))
printData.Add(item.PrintKey, value);
step = 6;
}
}
}
}
step = 7;
//只是要sheet1
printControl.ExcelSelectSheet(1);
if ((data != null) && (printData.Count > 0))
@@ -10354,15 +10381,15 @@ namespace MaiMuAOI.SysCtrl
Log("保存", $"保存失败: 保存数据为空或错误", WarningEnum.Low);
ret = false;
}
step = 8;
if (!printControl.ExcelSave(SavePath))
ret = false;
printControl.ExcelClose();
step = 9;
}
catch (Exception ex)
{
Log("Excel保存", $"保存失败: {ex.Message}", WarningEnum.Low);
Log("Excel保存", $"保存失败: {step}-{ex.Message}", WarningEnum.Low);
ret = false;
}
return ret;


Ładowanie…
Anuluj
Zapisz