diff --git a/JinYuan.ControlCenter/ControlCenter_Plc.cs b/JinYuan.ControlCenter/ControlCenter_Plc.cs index 107438d..00234db 100644 --- a/JinYuan.ControlCenter/ControlCenter_Plc.cs +++ b/JinYuan.ControlCenter/ControlCenter_Plc.cs @@ -1,5 +1,6 @@  using JinYuan.CommunicationLib.Enum; +using JinYuan.CommunicationLib.Interface; using JinYuan.DataConvertLib; using JinYuan.Helper; using JinYuan.MES.Enums; @@ -342,9 +343,9 @@ namespace JinYuan.ControlCenters //解析数据 //1257 3个条码 List list = new List();//实体 - List listBarCode = GetList(3, "");//电芯条码 + List listBarCode = GetList(6, "");//电芯条码 //List listNum = GetList(1, "");//进站磁悬浮动子编号 - List listRes = GetList(3, 0);//进站电芯反馈结果 + List listRes = GetList(6, 0);//进站电芯反馈结果 byte[] bytes = bArrays.Content.ByteReverse();//高低位转换 @@ -360,13 +361,15 @@ namespace JinYuan.ControlCenters listBarCode[0] = StringLib.GetStringFromByteArrayByEncoding(bytes, 0, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim(); listBarCode[1] = StringLib.GetStringFromByteArrayByEncoding(bytes, 40, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim(); listBarCode[2] = StringLib.GetStringFromByteArrayByEncoding(bytes, 80, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim(); - + listBarCode[3] = StringLib.GetStringFromByteArrayByEncoding(bytes, 120, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim(); + listBarCode[4] = StringLib.GetStringFromByteArrayByEncoding(bytes, 160, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim(); + listBarCode[5] = StringLib.GetStringFromByteArrayByEncoding(bytes, 200, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim(); //listBarCode[0] = "TEST"; //listBarCode[1] = "TEST"; //listBarCode[2] = "TEST"; //listBarCode[3] = "TEST"; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; i++) { //有无条码标志 int CodeFlag = 1; @@ -543,7 +546,7 @@ namespace JinYuan.ControlCenters //CommonMethods.PlcLink.WriteInt16("D2100", listRes[0]);//调试结果OK写入PLC if (result != null) { - string strres = $"外观检工位发送给PLC: D2100={listRes[0]},D2101={listRes[1]},D2102={listRes[2]},"; + string strres = $"分档工位发送给PLC: D2100={listRes[0]},D2101={listRes[1]},D2102={listRes[2]},"; CommonMethods.AddDataMonitorLog(0, strres); } @@ -1777,54 +1780,43 @@ namespace JinYuan.ControlCenters #region 数据变量定义 List list = new List();//实体 //int[] MyRes = new int[2];//AB反馈结果 - int[] MyRes = new int[3];//三个外观检测反馈结果 + int[] MyRes = new int[6];//6个外观检测反馈结果 #endregion //高低位转换 byte[] bytes = bArrays.Content.ByteReverse(); byte[] bytes1 = bArrays.Content; - List listBarCode = GetList(3, "");//电芯条码 + List listBarCode = GetList(6, "");//电芯条码 //List listNum = GetList(1, "");//进站磁悬浮动子编号 - List listRes = GetList(3, 0);//出站电芯反馈结果 + List listRes = GetList(6, 0);//出站电芯反馈结果 + List listGradeResult = GetList(6, 0);//grading plc 数字结果 //反馈结果 #region 电芯解析 //电芯解析 从3200 开始 listBarCode[0] = StringLib.GetStringFromByteArrayByEncoding(bytes, 0, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim(); listBarCode[1] = StringLib.GetStringFromByteArrayByEncoding(bytes, 40, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim(); listBarCode[2] = StringLib.GetStringFromByteArrayByEncoding(bytes, 80, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim(); + listBarCode[3] = StringLib.GetStringFromByteArrayByEncoding(bytes, 120, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim(); + listBarCode[4] = StringLib.GetStringFromByteArrayByEncoding(bytes, 160, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim(); + listBarCode[5] = StringLib.GetStringFromByteArrayByEncoding(bytes, 200, 40, System.Text.Encoding.ASCII).Replace('\0', ' ').Replace('\r', ' ').Replace(" ", "").Trim(); #region 上传MES + var lstBGearEntity = GetBlankingData(listBarCode); //D3200起 - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; i++) { + //读取bgearentity + try { BGearEntity m = new BGearEntity(); AGearEntity TT = new AGearEntity(); //极限件标志 int ChallengeFlag = 0; - //芯包信息1 D3300~D3326 - //芯包信息2 D3330~D3356 - //芯包信息3 D3360~D3386 - for (int j = 0; j < 16; j++) + var bGearEntity = lstBGearEntity.OrderByDescending(x => x.CSBYHOUTSTATIONTIME).FirstOrDefault(x => x.BarCode == listBarCode[i]); + if (bGearEntity != null) { - m.CCD_Data[i, j] = ShortLib.GetShortFromByteArray(bArrays.Content, 200 + i * 30 * 2 + j * 2, DataFormat.CDAB); + m = bGearEntity; } - //厚度3400 - for (int j = 0; j < 3; j++) - { - m.Thickness_Data[i, j] = FloatLib.GetFloatFromByteArray(bArrays.Content, 400 + i * 30 * 2 + j * 4, DataFormat.CDAB); - } - //厚度plc 3500 - for (int j = 0; j < 3; j++) - { - m.Thickness_PLCData[i, j] = ShortLib.GetShortFromByteArray(bArrays.Content, 500 + i * 30 * 2 + j * 2, DataFormat.CDAB); - } - //不良ng编号4300 - for (int j = 0; j < 16; j++) - { - m.CCD_NgNo[i, j] = ShortLib.GetShortFromByteArray(bArrays.Content, 2200 + i * 30 * 2 + j * 2, DataFormat.CDAB); - } - //芯包扫码时间 //m.ScanTime[i] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); @@ -1881,69 +1873,27 @@ namespace JinYuan.ControlCenters // var (NGcodeList, NGmessage) = NGWGJcode(m.CCD_Data, i); //电芯CCD判定结果 - #region //电芯CCD判定结果 1 0K 0NG 2缺图 - m.CCDResult1 = m.CCD_Data[i, 0] == 1 ? "OK" : (m.CCD_Data[i, 0] == 0 ? "NG" : "缺图"); - m.CCDResult2 = m.CCD_Data[i, 1] == 1 ? "OK" : (m.CCD_Data[i, 1] == 0 ? "NG" : "缺图"); - m.CCDResult3 = m.CCD_Data[i, 2] == 1 ? "OK" : (m.CCD_Data[i, 2] == 0 ? "NG" : "缺图"); - m.CCDResult4 = m.CCD_Data[i, 3] == 1 ? "OK" : (m.CCD_Data[i, 3] == 0 ? "NG" : "缺图"); - m.CCDResult5 = m.CCD_Data[i, 4] == 1 ? "OK" : (m.CCD_Data[i, 4] == 0 ? "NG" : "缺图"); - m.CCDResult6 = m.CCD_Data[i, 5] == 1 ? "OK" : (m.CCD_Data[i, 5] == 0 ? "NG" : "缺图"); - m.CCDResult7 = m.CCD_Data[i, 6] == 1 ? "OK" : (m.CCD_Data[i, 6] == 0 ? "NG" : "缺图"); - m.CCDResult8 = m.CCD_Data[i, 7] == 1 ? "OK" : (m.CCD_Data[i, 7] == 0 ? "NG" : "缺图"); - m.CCDResult9 = m.CCD_Data[i, 8] == 1 ? "OK" : (m.CCD_Data[i, 8] == 0 ? "NG" : "缺图"); - m.CCDResult10 = m.CCD_Data[i, 9] == 1 ? "OK" : (m.CCD_Data[i, 9] == 0 ? "NG" : "缺图"); - m.CCDResult11 = m.CCD_Data[i, 10] == 1 ? "OK" : (m.CCD_Data[i, 10] == 0 ? "NG" : "缺图"); - m.CCDResult12 = m.CCD_Data[i, 11] == 1 ? "OK" : (m.CCD_Data[i, 11] == 0 ? "NG" : "缺图"); - m.CCDResult13 = m.CCD_Data[i, 12] == 1 ? "OK" : (m.CCD_Data[i, 12] == 0 ? "NG" : "缺图"); - m.CCDResult14 = m.CCD_Data[i, 13] == 1 ? "OK" : (m.CCD_Data[i, 13] == 0 ? "NG" : "缺图"); - m.CCDResult15 = m.CCD_Data[i, 14] == 1 ? "OK" : (m.CCD_Data[i, 14] == 0 ? "NG" : "缺图"); - m.CCDResult16 = m.CCD_Data[i, 15] == 1 ? "OK" : (m.CCD_Data[i, 15] == 0 ? "NG" : "缺图"); - #endregion - #region //厚度判定结果 - m.ThicknessResult1 = m.Thickness_PLCData[i, 0] == 1 ? "OK" : (m.Thickness_PLCData[i, 0] == 0 ? "NG" : "缺测"); - m.ThicknessResult2 = m.Thickness_PLCData[i, 1] == 1 ? "OK" : (m.Thickness_PLCData[i, 1] == 0 ? "NG" : "缺测"); - m.ThicknessResult3 = m.Thickness_PLCData[i, 2] == 1 ? "OK" : (m.Thickness_PLCData[i, 2] == 0 ? "NG" : "缺测"); - #endregion + m.CSBYHASCANNINGTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - m.CSBYHPROCESSNAME = "外观检测"; + m.CSBYHPROCESSNAME = "分档"; m.CSBYHSCHEDULE = CommonMethods.strClass; m.CSBYHINSTATIONTIME = m.ScanTime[0]; m.CSBYHOUTSTATIONTIME = m.ScanTime[1]; - m.Thickness1 = SaveTwoNum(m.Thickness_Data[i, 0]); - m.Thickness2 = SaveTwoNum(m.Thickness_Data[i, 1]); - m.Thickness3 = SaveTwoNum(m.Thickness_Data[i, 2]); + m.ChannelNo = i + 1; //条码,芯包重量,芯包侧厚,芯包CCD极性检测,电芯裁切粘连,电芯裁切毛刺,芯包焊印位置, //芯包正面极耳撕裂,芯包背面极耳撕裂,芯包正面极耳翻折,芯包背面极耳翻折 - if (Code_NG == 1) - { - for (int ii = 0; ii < 16; ii++) - { - if (m.CCD_Data[i, ii] != 1) - { - //1OK,2扫码NG,3MES反馈NG,4其他NG - MyRes[i] = 4; - break; - } - } - } - else - MyRes[i] = 2;//扫码NG - MyRes[i] = JudgmentCCDResult(Code_NG, m.CCD_Data,i); - MyRes[i] = JudgmentThickNessResult(m.Thickness_PLCData, i, MyRes[i]); - m.Result = MyRes[i]; - - m.CSBYHOUTSTATIONJUDGMENTRESULT = m.judgment_result[i] = OK_NG; - - m.Remark += NG_Type; + MyRes[i] = m.Result; + m.MaterialCode = CommonMethods.mesConfig.MaterialCode; NG_Type = "";//清除上一次不良字符串 OK_NG = ""; //清除上一次结果 list.Add(m); + string ur2 = CommonMethods.mesConfig.ResultProcessParamMesUrl; string siteCode1 = CommonMethods.mesConfig.siteCode; string lineCode1 = CommonMethods.mesConfig.lineCode; @@ -1953,85 +1903,91 @@ namespace JinYuan.ControlCenters MesUploadType unloadType = MesUploadType.DD; string Mesage = ""; //加判断无条码不上传mes 1为有条码 + #region 发送结果MES ,本地存储 if (Code_NG == 1) { string MesMessage = ""; MesResType mesResType = MesResType.C; + if (CommonMethods.mesConfig.isUpMes) { - string url = CommonMethods.mesConfig.OutStationMesUrl; - string siteCode = CommonMethods.mesConfig.siteCode; - string lineCode = CommonMethods.mesConfig.lineCode; - string equipNum = CommonMethods.mesConfig.equipNum; - string materialCode = CommonMethods.mesConfig.MaterialCode; - string userName = CommonMethods.mesConfig.mesUserName; - int type = 1; - //int type = 1; - //string materialLotCodeLocator = ""; - var (NGcodeList, NGmessage) = NGWGJcode(m.CCD_NgNo, i); - bool Res = CommonMethods.hbgMes.OutboundInformations(url, siteCode, lineCode, equipNum, materialCode, userName, m, ref MesMessage, ref mesResType, NGcodeList, NGmessage); - //bool Res = CommonMethods.hbgMes.SingleCellOutStation(url, siteCode, lineCode, equipNum, materialCode, userName, m,) - if (MesMessage.Contains("发生一个或多个错误")) - { - MesMessage = "上传失败,"; - } - else - { - m.Flag = 1; - } - if (Res) - { - //MES出站判定结果 - m.Result = MyRes[i]; - ////芯包重量1判定结果 - //if (m.list_Data1[i, 10] == 2) { m.Remark += "芯包重量NG,"; } - ////芯包侧厚判定结果 - //if (m.list_Data1[i, 11] == 2) { m.Remark += "芯包侧厚NG,"; } - ////芯包CCD极性检测结果 - //if (m.list_Data1[i, 12] == 2) { m.Remark += "芯包CCD极性检测NG,"; } - m.Remark += MesMessage; - } - else - { - switch (mesResType) - { - case MesResType.A:// 停线,设备报警停机 - //m.listRes[i] = 10; - // m.Result = MyRes[i] = 2; - m.Result = MyRes[i] = 3; - m.Remark += "MES NG"; - break; - case MesResType.B://不停机,MEs NG品要排出,要给PLC发NG信号 - //m.listRes[i] = 9; - // m.Result = MyRes[i] = 2; - m.Result = MyRes[i] = 3; - m.Remark += "MES NG"; - break; - case MesResType.C://可忽略 - //m.listRes[i] = 1; - // m.Result = MyRes[i] = 2; - m.Result = MyRes[i] = 1; - m.Remark += "MES Alerm OK"; - break; - case MesResType.D://可忽略 - //m.listRes[i] = 1; - // m.Result = MyRes[i] = 2; - m.Result = MyRes[i] = 1; - m.Remark += "MES OK"; - break; - default: - m.Remark += "MES NG"; - m.Result = MyRes[i] = 3; - break; - } - ////芯包重量1判定结果 - //if (m.list_Data1[i, 10] == 2) { m.Remark += "芯包重量NG,"; } - ////芯包侧厚判定结果 - //if (m.list_Data1[i, 11] == 2) { m.Remark += "芯包侧厚NG,"; } - ////芯包CCD极性检测结果 - //if (m.list_Data1[i, 12] == 2) { m.Remark += "芯包CCD极性检测NG,"; } - m.Remark += MesMessage; - } + #region 出站 分档取消出站 + ////{ + //// string url = CommonMethods.mesConfig.OutStationMesUrl; + //// string siteCode = CommonMethods.mesConfig.siteCode; + //// string lineCode = CommonMethods.mesConfig.lineCode; + //// string equipNum = CommonMethods.mesConfig.equipNum; + //// string materialCode = CommonMethods.mesConfig.MaterialCode; + //// string userName = CommonMethods.mesConfig.mesUserName; + //// int type = 1; + //// //int type = 1; + //// //string materialLotCodeLocator = ""; + //// var (NGcodeList, NGmessage) = NGWGJcode(m.CCD_NgNo, i); + //// bool Res = CommonMethods.hbgMes.OutboundInformations(url, siteCode, lineCode, equipNum, materialCode, userName, m, ref MesMessage, ref mesResType, NGcodeList, NGmessage); + //// //bool Res = CommonMethods.hbgMes.SingleCellOutStation(url, siteCode, lineCode, equipNum, materialCode, userName, m,) + //// if (MesMessage.Contains("发生一个或多个错误")) + //// { + //// MesMessage = "上传失败,"; + //// } + //// else + //// { + //// m.Flag = 1; + //// } + //// if (Res) + //// { + //// //MES出站判定结果 + //// m.Result = MyRes[i]; + //// ////芯包重量1判定结果 + //// //if (m.list_Data1[i, 10] == 2) { m.Remark += "芯包重量NG,"; } + //// ////芯包侧厚判定结果 + //// //if (m.list_Data1[i, 11] == 2) { m.Remark += "芯包侧厚NG,"; } + //// ////芯包CCD极性检测结果 + //// //if (m.list_Data1[i, 12] == 2) { m.Remark += "芯包CCD极性检测NG,"; } + //// m.Remark += MesMessage; + //// } + //// else + //// { + //// switch (mesResType) + //// { + //// case MesResType.A:// 停线,设备报警停机 + //// //m.listRes[i] = 10; + //// // m.Result = MyRes[i] = 2; + //// m.Result = MyRes[i] = 3; + //// m.Remark += "MES NG"; + //// break; + //// case MesResType.B://不停机,MEs NG品要排出,要给PLC发NG信号 + //// //m.listRes[i] = 9; + //// // m.Result = MyRes[i] = 2; + //// m.Result = MyRes[i] = 3; + //// m.Remark += "MES NG"; + //// break; + //// case MesResType.C://可忽略 + //// //m.listRes[i] = 1; + //// // m.Result = MyRes[i] = 2; + //// m.Result = MyRes[i] = 1; + //// m.Remark += "MES Alerm OK"; + //// break; + //// case MesResType.D://可忽略 + //// //m.listRes[i] = 1; + //// // m.Result = MyRes[i] = 2; + //// m.Result = MyRes[i] = 1; + //// m.Remark += "MES OK"; + //// break; + //// default: + //// m.Remark += "MES NG"; + //// m.Result = MyRes[i] = 3; + //// break; + //// } + //// ////芯包重量1判定结果 + //// //if (m.list_Data1[i, 10] == 2) { m.Remark += "芯包重量NG,"; } + //// ////芯包侧厚判定结果 + //// //if (m.list_Data1[i, 11] == 2) { m.Remark += "芯包侧厚NG,"; } + //// ////芯包CCD极性检测结果 + //// //if (m.list_Data1[i, 12] == 2) { m.Remark += "芯包CCD极性检测NG,"; } + //// m.Remark += MesMessage; + //// } + ////} + #endregion //发送产品结果参数给MES bool Res1 = CommonMethods.hbgMes.ProducResultParam(ur2, siteCode1, lineCode1, equipNum1, materialCode1, userName1, m, unloadType, ref Mesage); @@ -2047,6 +2003,7 @@ namespace JinYuan.ControlCenters m.Remark += "本地存储"; m.UpState = "未上传"; } + if (CommonMethods.sysConfig.OKSwitching) { //调试发OK @@ -2066,6 +2023,116 @@ namespace JinYuan.ControlCenters //if (m.list_Data1[i, 12] == 2) { m.Remark += ",芯包CCD极性检测NG"; } m.UpState = "未上传"; } + #endregion + #region OK分档查询 + //if (CommonMethods.sysConfig.MesModeSwitching && CommonMethods.mesConfig.isConnected) + { //1 分选测厚度NG ,2 分选外观不良 21分选一档,22分选二档,23分选三档、24分选四档,25分档5 26 ==6 + + if (list[i].Result == 1) + { + if (CommonMethods.mesConfig.isUpMes) + { + //分档接口 + //21~26 OK挡位 + var (success, mesage, mesResType) = CommonMethods.hbgMes.MesGrading( + CommonMethods.mesConfig.GradingMesUrl, + list[i].BarCode, + CommonMethods.mesConfig.siteCode, + CommonMethods.mesConfig.lineCode, + CommonMethods.mesConfig.mesUserName, + CommonMethods.mesConfig.equipNum, + CommonMethods.mesConfig.MaterialCode);//分档查询 + + try + { + //listGradeResult[i] = (short)26;//默认分档OK + list[i].Remark = "外观检OK分档"; + if (success && mesResType[0] != "NULL") + { + + if (mesResType[0].Equals(CommonMethods.mesConfig.Grading1)) + { + listGradeResult[i] = (short)(CommonMethods.MESGradingSet[0] + 20); + list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OKMES反馈档位:{mesResType[0]}"; + } + else if (mesResType[0].Equals(CommonMethods.mesConfig.Grading2)) + { + listGradeResult[i] = (short)(CommonMethods.MESGradingSet[1] + 20); + list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OKMES反馈档位:{mesResType[0]}"; + } + else if (mesResType[0].Equals(CommonMethods.mesConfig.Grading3)) + { + listGradeResult[i] = (short)(CommonMethods.MESGradingSet[2] + 20); + list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OKMES反馈档位:{mesResType[0]}"; + } + else if (mesResType[0].Equals(CommonMethods.mesConfig.Grading4)) + { + listGradeResult[i] = (short)(CommonMethods.MESGradingSet[3] + 20); + list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OKMES反馈档位:{mesResType[0]}"; + } + else if (mesResType[0].Equals(CommonMethods.mesConfig.Grading5)) + { + listGradeResult[i] = (short)(CommonMethods.MESGradingSet[4] + 20); + list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OKMES反馈档位:{mesResType[0]}"; + } + else if (mesResType[0].Equals(CommonMethods.mesConfig.Grading6)) + { + listGradeResult[i] = (short)(CommonMethods.MESGradingSet[5] + 20); + list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OKMES反馈档位:{mesResType[0]}"; + } + else + { + throw new Exception("MES未反馈正确档位"); + } + + } + else + throw new Exception("MES未反馈正确档位"); + + } + catch (Exception ex) + { + listGradeResult[i] = (short)26; + + list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OK分档NG,MES未反馈正确档位"; + LoggerHelp.WriteLog("解析出站MES分档数据异常:{ex.Message}", "SysErrorLog"); + + } + } + else + { + list[i].Remark = $"出站条码[{list[i].BarCode}]外观检OK分档,MES断连"; + listGradeResult[i] = (short)26; + // list[i].Result = "MES NG"; + CommonMethods.PlcLink.WriteValue("D80", 1, Data_Type.Short); + //反馈MES结果 + + } + + } + else + { + //厚度不良分档 + if (!(list[i].ThicknessPLCResult1 == 1 && list[i].ThicknessPLCResult2 == 1 && list[i].ThicknessPLCResult3 == 1)) + { + listGradeResult[i] = 1; + list[i].Remark = $"出站条码[{list[i].BarCode}]测厚度NG"; + } + else + { + //外观不良分档 + listGradeResult[i] = 2; + list[i].Remark = $"出站条码[{list[i].BarCode}]外观检NG不分类"; + } + } + listRes[i] = listGradeResult[i]; + list[i].Result = listGradeResult[i]; + + } + + + + #endregion #region//极限件发3给PLC //if (ChallengeFlag == 1) //{ @@ -2315,6 +2382,89 @@ namespace JinYuan.ControlCenters return NGcodelist; } #endregion + #region 读取下料数据 sql数据库 + private List GetBlankingData(List listBarCode) + { + //数据的读取 + List listData = new List(); + try + { + if (listBarCode != null && listBarCode.Count > 0) + { + listData = CommonMethods.dbServer.QuerySqlList(CommonMethods.dBSQL.GetBGearEntityByBarcode(listBarCode)).ToList(); + + + } + + } + catch (Exception ex) + { + LoggerHelp.WriteLog($"GetBlankingData:{ex}", "SysErrorLog"); + } + return listData; + } + /// + /// 通过RFID读取下料数据 mysql数据库 + /// + /// + /// + //private List GetBlankingData_ByRFID(string strRFID) + //{ + // //数据的读取 + // List listData = new List(); + // try + // { + // if (!string.IsNullOrEmpty(strRFID) && strRFID != "ERROR") + // { + // var listDataTemp = CommonMethods.dbServer.QuerySqlList(CommonMethods.dBSQL.GetBGearEntity(strRFID)); + // if (listDataTemp != null && listDataTemp.Count > 0) + // { + // foreach (var m in listDataTemp) + // { + // var entity = new BGearEntity(); + // foreach (var item in m.GetType().GetProperties()) + // { + // foreach (var eitem in entity.GetType().GetProperties()) + // { + // if (eitem.Name == item.Name) + // eitem.SetValue(entity, item.GetValue(m)); + // } + // } + // listData.Add(entity); + // } + // } + // // CommonMethods.db.QueryWhereList(x=>x.FHour==14); + + // // listData = CommonMethods.db.QueryWhereList(x => x.RFID == "123");//.ToList();//.OrderBy(x => x.ChannelNo).ToList(); + // //await CommonMethods.dbServer.GetReturnListByRFIDAsync(strRFID); + + // //数据显示 + // // CommonMethods.ShowBlankingDelegate.Invoke(listData); + + // //数据保存本地 + // string strData = string.Empty;//数据字符串,本地保存 + // foreach (BGearEntity m in listData) + // { + // foreach (var item in m.GetType().GetProperties()) + // { + // strData += item.GetValue(m) + ","; + // } + // strData = strData.TrimEnd(','); + // //BlankingDataSaveLocal(strData); + // } + // } + // else + // { + // LoggerHelp.WriteLog($"电芯出站数据List为空", "SysErrorLog"); + // } + // } + // catch (Exception ex) + // { + // LoggerHelp.WriteLog($"电芯出站数据保存异常:{ex}", "SysErrorLog"); + // } + // return listData; + //} + #endregion } } #endregion diff --git a/JinYuan.MES/IMes.cs b/JinYuan.MES/IMes.cs index d210218..17fa44b 100644 --- a/JinYuan.MES/IMes.cs +++ b/JinYuan.MES/IMes.cs @@ -2,6 +2,7 @@ using JinYuan.MES.Models; using JinYuan.Models; using System.Collections.Generic; +using System.Threading.Tasks; namespace JinYuan.MES { @@ -228,5 +229,19 @@ namespace JinYuan.MES /// /// bool UploadDeviceCollectData(string url, string equipNum, List antiDustAirSpeedNum, List collectData, ref string msg); + + /// + /// MES分档接口 + /// + /// + /// + /// + /// + /// + /// + /// + /// + (bool Success, List MesMessage, List MesResType) MesGrading( + string url, string barCode, string siteCode, string lineCode, string userName, string equipCode, string materialCode); } } diff --git a/JinYuan.MES/MesDataProcess.cs b/JinYuan.MES/MesDataProcess.cs index fea9647..4a67feb 100644 --- a/JinYuan.MES/MesDataProcess.cs +++ b/JinYuan.MES/MesDataProcess.cs @@ -8,6 +8,8 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Net.Http; +using System.Threading.Tasks; namespace JinYuan.MES { @@ -1796,5 +1798,158 @@ namespace JinYuan.MES } #endregion + + #region 17、单个电池分档 + /// + /// 单个电池分档 + /// + /// + /// + /// + /// + /// + /// + /// + /// + public (bool Success, List MesMessage, List MesResType) MesGrading( + string url, string barCode, string siteCode, string lineCode, string userName, string equipCode, string materialCode) + { + bool res = false; // 操作结果 + string resJson = ""; // 日志信息 + + //string mesage = ""; // 消息 + //MesResType mesResType = MesResType.D; // 默认响应类型 + var lstbarCode = new List(); + lstbarCode.Add(barCode); + List mesage = GetListString(lstbarCode.Count, "分档失败"); // 消息列表 + List mesResType = GetListString(lstbarCode.Count, "NULL"); // 响应类型列表 + + try + { + // 直接构建电池信息列表(对应materiallotCodeList) + JArray materiallotCodeList = new JArray(lstbarCode); + JObject gradingParam = new JObject(); + gradingParam.Add("siteCode", siteCode); + gradingParam.Add("lineCode", lineCode); + gradingParam.Add("userName", userName); + gradingParam.Add("equipCode", equipCode); + gradingParam.Add("recordDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); + gradingParam.Add("qty", 1); + gradingParam.Add("containerCode", ""); + gradingParam.Add("materialCode", materialCode); + gradingParam.Add("materiallotCodeList", materiallotCodeList); + + + // 序列化请求数据 + var nowDate = DateTime.Now; + var postcontent = JsonConvert.SerializeObject(gradingParam); + + // 记录请求开始时间 + var sw = Stopwatch.StartNew(); + + // 调用异步API + string result = MESApiHelper.WepPostAPIAsync(url, postcontent); + + // 记录请求结束时间 + sw.Stop(); + + // 如果请求耗时超过1秒,记录日志 + long outTime = sw.ElapsedMilliseconds; + if (outTime > 1000) + { + LoggerHelp.WriteLog($"卷芯分档PC<=>MES上传耗时:{outTime}ms,卷芯码:{string.Join(",", lstbarCode)}", "MESTime"); + + } + + // 如果返回结果为空,记录日志并返回 + if (string.IsNullOrEmpty(result)) + { + string resData = result == "" ? "" : result; + resJson = $"{nowDate.ToString("yyyy-MM-dd HH:mm:ss.fff")}:调用分档信息(包装)接口:{url},请求数据为:{postcontent},\n{nowDate.AddMilliseconds(sw.ElapsedMilliseconds).ToString("yyyy-MM-dd HH:mm:ss.fff")}:接口耗时:{sw.ElapsedMilliseconds}ms,返回结果:{resData}"; + TxtHelper.WriteTxt($@"D:\APILog\Logs\MesLogs\{nowDate.ToString("yyyyMMdd")}\产品出站信息\{nowDate.ToString("HH")}.txt", resJson); + return (res, mesage, mesResType); + } + + // 解析返回结果 - 修改部分开始 + var res1 = ReturnMesMsg(result); + + + + if (res1.success) + { + // 处理单个电池的结果(当只上传一个电池时) + for (int i = 0; i < lstbarCode.Count; i++) + { + string MesGrading = "NULL"; + string Mesage = string.Empty; + GetGradingMesResType(res1, barCode, ref Mesage, ref MesGrading); + mesage[i] = Mesage ?? "分档成功"; + mesResType[i] = MesGrading; + } + res = true; + resJson = $"{nowDate.ToString("yyyy-MM-dd HH:mm:ss.fff")}:调用分档信息(包装)接口:{url},请求数据为:{postcontent},\n{nowDate.AddMilliseconds(sw.ElapsedMilliseconds).ToString("yyyy-MM-dd HH:mm:ss.fff")}:接口耗时:{sw.ElapsedMilliseconds}ms,返回结果:{result}"; + TxtHelper.WriteTxt($@"D:\APILog\Logs\MesLogs\{nowDate.ToString("yyyyMMdd")}\调用分档信息\{nowDate.ToString("HH")}.txt", resJson); + } + else + { + // 设置所有电池的错误消息 + for (int i = 0; i < lstbarCode.Count; i++) + { + mesage[i] = "分档失败"; + mesResType[i] = "NULL"; + } + // 如果操作失败,记录日志 + resJson = $"{nowDate.ToString("yyyy-MM-dd HH:mm:ss.fff")}:调用分档信息(包装)接口:{url},请求数据为:{postcontent},\n{nowDate.AddMilliseconds(sw.ElapsedMilliseconds).ToString("yyyy-MM-dd HH:mm:ss.fff")}:接口耗时:{sw.ElapsedMilliseconds}ms,返回结果:{result}"; + TxtHelper.WriteTxt($@"D:\APILog\Logs\MesLogs\{nowDate.ToString("yyyyMMdd")}\调用分档信息\{nowDate.ToString("HH")}.txt", resJson); + } + + // 修改部分结束 + } + catch (Exception ex) + { + // 捕获异常并记录日志 + resJson = $"调用分档信息(包装)接口发生异常:{ex.Message}"; + LoggerHelp.WriteEX("调用分档信息(包装)接口", ex); + + } + + // 返回结果 + return (res, mesage, mesResType); + } + + /// + /// 单电池分档 + /// + /// + /// + /// + /// + private void GetGradingMesResType(MesGradingResponse res1, string BarCode, ref string MesMessage, ref string MesGrading) + { + if (res1 != null && res1.rows != null) + { + rowsListItem row = null; + foreach (var item in res1.rows) + { + if (item.identification == BarCode) + { + row = item; + break; + } + } + if (row != null) + { + MesMessage = row.message.ToString(); + MesGrading = row.rank; + } + else + { + MesMessage = "返回为空!"; + MesGrading = "NULL"; + } + + } + } + #endregion } } diff --git a/JinYuan.MES/Models/MesResponse.cs b/JinYuan.MES/Models/MesResponse.cs index 3571ee2..a0fa5ca 100644 --- a/JinYuan.MES/Models/MesResponse.cs +++ b/JinYuan.MES/Models/MesResponse.cs @@ -167,4 +167,41 @@ namespace JinYuan.MES.Models { public List Result { get; set; } } + + public class MesGradingResponse : MesResponse + { + + + /// + /// 报错消息类型 A=停线,B=排出,C=忽略(需警示) + /// + public string category { get; set; } + + + /// + /// 条码及档位结果信息 + /// + public List rows { get; set; } + + + + } + public class rowsListItem + { + /// + /// 电池条码 + /// + public string identification { get; set; } + /// + /// 电池等级 + /// + public string level { get; set; } + /// + /// 电池挡位 + /// + public string rank { get; set; } + + public object passage { get; set; } + public object message { get; set; } + } } diff --git a/JinYuan.Models/FDConfig.cs b/JinYuan.Models/FDConfig.cs index a340e8d..1a2e32a 100644 --- a/JinYuan.Models/FDConfig.cs +++ b/JinYuan.Models/FDConfig.cs @@ -26,17 +26,25 @@ namespace JinYuan.Models /// public string OKLD4Type { get; set; } /// + /// OK拉带类型5 + /// + public string OKLD5Type { get; set; } + /// + /// OK拉带类型6 + /// + public string OKLD6Type { get; set; } + /// /// NG拉带类型5 /// - public string NGLD5Type { get; set; } - /// - /// NG拉带类型6 - /// - public string NGLD6Type { get; set; } - /// - /// NG拉带类型7 - /// - public string NGLD7Type { get; set; } + //public string NGLD5Type { get; set; } + ///// + ///// NG拉带类型6 + ///// + //public string NGLD6Type { get; set; } + ///// + ///// NG拉带类型7 + ///// + //public string NGLD7Type { get; set; } /// /// 是否开启分档 /// diff --git a/JinYuan.VirtualDataLibrary/CommonMethods.cs b/JinYuan.VirtualDataLibrary/CommonMethods.cs index bd95cc2..ba23990 100644 --- a/JinYuan.VirtualDataLibrary/CommonMethods.cs +++ b/JinYuan.VirtualDataLibrary/CommonMethods.cs @@ -95,6 +95,7 @@ namespace JinYuan.VirtualDataLibrary /// MES配置文件类 /// public static MesConfig mesConfig = new MesConfig(); + public static short[] MESGradingSet = new short[] { 0,0,0,0,0,0}; ///创建一个全局的连接状态 public static bool connectState = false; @@ -301,6 +302,121 @@ namespace JinYuan.VirtualDataLibrary + #endregion + #region 写入分档 + public static bool WriteGrading() + { + var res = false; + try + { + + if (plcDevice != null && plcDevice.IsConnected) + { + DateTime Date = DateTime.Now; + #region 档位写入 + // short[] MESGradingSet = new short[] { 0, 0, 0, 0, 0, 0 }; + //1 + MESGradingSet[0] = (short)21; // 21 22 23 24 25 26 + //2 + if (mesConfig.Grading2.Trim().Equals(mesConfig.Grading1.Trim())) + MESGradingSet[1] = MESGradingSet[0]; + else + MESGradingSet[1] = (short)(MESGradingSet[0] + 1); + //3 + if (mesConfig.Grading3.Trim().Equals(CommonMethods.mesConfig.Grading1.Trim())) + MESGradingSet[2] = MESGradingSet[0]; + else + { + if (CommonMethods.mesConfig.Grading3.Trim().Equals(CommonMethods.mesConfig.Grading2.Trim())) + MESGradingSet[2] = MESGradingSet[1]; + else + MESGradingSet[2] = (short)(MESGradingSet[1] + 1); + } + //4 + if (CommonMethods.mesConfig.Grading4.Trim().Equals(CommonMethods.mesConfig.Grading1.Trim())) + MESGradingSet[3] = MESGradingSet[0]; + else + { + if (CommonMethods.mesConfig.Grading4.Trim().Equals(CommonMethods.mesConfig.Grading2.Trim())) + MESGradingSet[3] = MESGradingSet[1]; + else + { + if (CommonMethods.mesConfig.Grading4.Trim().Equals(CommonMethods.mesConfig.Grading3.Trim())) + MESGradingSet[3] = MESGradingSet[2]; + else + MESGradingSet[3] = (short)(MESGradingSet[2] + 1); + } + } + + //5 + if (CommonMethods.mesConfig.Grading5.Trim().Equals(CommonMethods.mesConfig.Grading1.Trim())) + MESGradingSet[4] = MESGradingSet[0]; + else + { + if (CommonMethods.mesConfig.Grading5.Trim().Equals(CommonMethods.mesConfig.Grading2.Trim())) + MESGradingSet[4] = MESGradingSet[1]; + else + { + if (CommonMethods.mesConfig.Grading5.Trim().Equals(CommonMethods.mesConfig.Grading3.Trim())) + MESGradingSet[4] = MESGradingSet[2]; + else + { + if (CommonMethods.mesConfig.Grading5.Trim().Equals(CommonMethods.mesConfig.Grading4.Trim())) + MESGradingSet[4] = MESGradingSet[3]; + else + MESGradingSet[4] = (short)(MESGradingSet[3] + 1); + } + } + } + //6 + if (CommonMethods.mesConfig.Grading6.Trim().Equals(CommonMethods.mesConfig.Grading1.Trim())) + MESGradingSet[5] = MESGradingSet[0]; + else + { + if (CommonMethods.mesConfig.Grading6.Trim().Equals(CommonMethods.mesConfig.Grading2.Trim())) + MESGradingSet[5] = MESGradingSet[1]; + else + { + if (CommonMethods.mesConfig.Grading6.Trim().Equals(CommonMethods.mesConfig.Grading3.Trim())) + MESGradingSet[5] = MESGradingSet[2]; + else + { + if (CommonMethods.mesConfig.Grading6.Trim().Equals(CommonMethods.mesConfig.Grading4.Trim())) + MESGradingSet[5] = MESGradingSet[3]; + else + { + if (CommonMethods.mesConfig.Grading6.Trim().Equals(CommonMethods.mesConfig.Grading5.Trim())) + MESGradingSet[5] = MESGradingSet[4]; + else + MESGradingSet[5] = (short)(MESGradingSet[4] + 1); + } + } + } + } + #endregion + var isWrite1 = PlcLink.WriteValue("D2600", MESGradingSet[0], Data_Type.Short); + var isWrite2 = PlcLink.WriteValue("D2601", MESGradingSet[1], Data_Type.Short); + var isWrite3 = PlcLink.WriteValue("D2602", MESGradingSet[2], Data_Type.Short); + var isWrite4 = PlcLink.WriteValue("D2603", MESGradingSet[3], Data_Type.Short); + var isWrite5 = PlcLink.WriteValue("D2604", MESGradingSet[4], Data_Type.Short); + var isWrite6 = PlcLink.WriteValue("D2605", MESGradingSet[5], Data_Type.Short); + if (isWrite1.IsSuccess && isWrite2.IsSuccess && isWrite3.IsSuccess && isWrite4.IsSuccess && isWrite5.IsSuccess && isWrite6.IsSuccess) + { + AddDataMonitorLog(0, $"OK分档档位写入PLC成功![2600~2605]{string.Join(",", MESGradingSet)}"); + + return true; + + } + + } + } + catch (Exception ex) + { + AddLog(true, ex.ToString()); + } + return false; + + } #endregion #region 写入PLC信息 @@ -435,6 +551,13 @@ namespace JinYuan.VirtualDataLibrary sysConfig.GetMesParam = Convert.ToBoolean(IniConfigHelper.ReadIniData("配置信息", "获取MES参数", "false")); sysConfig.OKSwitching = Convert.ToBoolean(IniConfigHelper.ReadIniData("配置信息", "强制OK/正常NG模式切换", "false")); sysConfig.SaveThreadTime = Convert.ToBoolean(IniConfigHelper.ReadIniData("配置信息", "线程耗时日志保存", "false")); + sysConfig.SaveThreadTime = Convert.ToBoolean(IniConfigHelper.ReadIniData("配置信息", "线程耗时日志保存", "false")); + mesConfig.Grading1 = IniConfigHelper.ReadIniData("MES配置", "Grading1", "false"); + mesConfig.Grading2 = IniConfigHelper.ReadIniData("MES配置", "Grading2", "false"); + mesConfig.Grading3 = IniConfigHelper.ReadIniData("MES配置", "Grading3", "false"); + mesConfig.Grading4 = IniConfigHelper.ReadIniData("MES配置", "Grading4", "false"); + mesConfig.Grading5 = IniConfigHelper.ReadIniData("MES配置", "Grading5", "false"); + mesConfig.Grading6 = IniConfigHelper.ReadIniData("MES配置", "Grading6", "false"); } catch (Exception) diff --git a/JinYuan.VirtualDataLibrary/DBSQL.cs b/JinYuan.VirtualDataLibrary/DBSQL.cs index fac98fa..1f06957 100644 --- a/JinYuan.VirtualDataLibrary/DBSQL.cs +++ b/JinYuan.VirtualDataLibrary/DBSQL.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; namespace JinYuan.VirtualDataLibrary { @@ -87,7 +88,28 @@ namespace JinYuan.VirtualDataLibrary FROM [dbo].[SysAdmin]"); return strSql; } + /// + /// 获取RFID对应的B包参数 + /// + /// + /// + public string GetBGearEntity(string strRFID) + { + string strSql = $@"SELECT `ChannelNo`,`BarCode`,`RFID`,`TestTime`,`CSBYHASCANNINGTIME`,`UpState`,`MaterialCode` FROM `BGearEntity` WHERE `RFID` = '{strRFID}'"; + return strSql; + } + public string GetBGearEntityByBarcode(List listBarCode) + { + string strSql = $@"SELECT ChannelNo,[BarCode],[CSBYHASCANNINGTIME],[UpState],[MaterialCode],[CCDResult1],[CCDResult2],[CCDResult3],[CCDResult4],[CCDResult5],[CCDResult6],[CCDResult7],[CCDResult8],[CCDResult9],[CCDResult10],[CCDResult11],[CCDResult12],[CCDResult13],[CCDResult14],[CCDResult15],[CCDResult16],[CCDResult17],[CCDResult18],[CCDResult19],[CCDResult20],[CCDResult21],[CCDResult22],[CCDResult23],[CCDResult24],[CCDResult25],[CCDResult26],[CCDResult27],[CSBYHOUTSTATIONJUDGMENTRESULT],[CSBYHPROCESSNAME],[CSBYHSCHEDULE],[CSBYHINSTATIONTIME],[CSBYHOUTSTATIONTIME],[RethrowNum],[Flag],[Remark],[Result],[ThicknessPLCResult1] + ,[ThicknessPLCResult2] + ,[ThicknessPLCResult3] + ,[ThicknessResult1] + ,[ThicknessResult2] + ,[ThicknessResult3] FROM BGearEntity WHERE BarCode in ('{string.Join("','", listBarCode)}')"; + + return strSql; + } /// /// 查询历史数据 /// diff --git a/JinYuan.VirtualDataLibrary/MesConfig.cs b/JinYuan.VirtualDataLibrary/MesConfig.cs index 50553f4..efe5802 100644 --- a/JinYuan.VirtualDataLibrary/MesConfig.cs +++ b/JinYuan.VirtualDataLibrary/MesConfig.cs @@ -114,6 +114,30 @@ namespace JinYuan.VirtualDataLibrary /// Guid /// public string guidStr = ""; + /// + /// OK1分档 + /// + public string Grading1 = "K77"; + /// + /// OK2分档 + /// + public string Grading2 = "K77"; + /// + /// OK3分档 + /// + public string Grading3 = "K77"; + /// + /// OK4分档 + /// + public string Grading4 = "K77"; + /// + /// OK5分档 + /// + public string Grading5 = "K77"; + /// + /// OK6分档 + /// + public string Grading6 = "K77"; /// /// 设备状态 @@ -188,6 +212,10 @@ namespace JinYuan.VirtualDataLibrary /// 设备风速接口 /// public string OkNgParamMesUrl = "http://10.17.128.206/core/api/public/eve/pm/eqm/new/grading"; + /// + /// 分档 + /// + public string GradingMesUrl = "http://10.54.50.1:8082/core/api/public/eve/pm/eqm/new/grading"; } } diff --git a/LargeSquareOne.sln b/LargeSquareOne.sln index a765e22..b7d1c43 100644 --- a/LargeSquareOne.sln +++ b/LargeSquareOne.sln @@ -17,8 +17,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JinYuan.MES", "JinYuan.MES\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LargeSquareOne", "LargeSquareOne\LargeSquareOne.csproj", "{29E1F0D0-43DC-4077-A136-F25477E56881}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LargeSquareOneFD", "LargeSquareOneFD\LargeSquareOneFD.csproj", "{106C173A-C303-423B-805C-B43800927ADC}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -53,16 +51,12 @@ Global {29E1F0D0-43DC-4077-A136-F25477E56881}.Debug|Any CPU.Build.0 = Debug|Any CPU {29E1F0D0-43DC-4077-A136-F25477E56881}.Release|Any CPU.ActiveCfg = Release|Any CPU {29E1F0D0-43DC-4077-A136-F25477E56881}.Release|Any CPU.Build.0 = Release|Any CPU - {106C173A-C303-423B-805C-B43800927ADC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {106C173A-C303-423B-805C-B43800927ADC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {106C173A-C303-423B-805C-B43800927ADC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {106C173A-C303-423B-805C-B43800927ADC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - RESX_NeutralResourcesLanguage = zh-CN SolutionGuid = {E8421996-BAC4-4509-9C3E-BC424197F2D8} + RESX_NeutralResourcesLanguage = zh-CN EndGlobalSection EndGlobal diff --git a/LargeSquareOne/App.config b/LargeSquareOne/App.config index 69203b1..e07d70a 100644 --- a/LargeSquareOne/App.config +++ b/LargeSquareOne/App.config @@ -6,8 +6,9 @@ + - + diff --git a/LargeSquareOne/FrmDataMonitor.Designer.cs b/LargeSquareOne/FrmDataMonitor.Designer.cs index 31117ff..09cbf2c 100644 --- a/LargeSquareOne/FrmDataMonitor.Designer.cs +++ b/LargeSquareOne/FrmDataMonitor.Designer.cs @@ -68,34 +68,15 @@ this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column22 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column33 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column29 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column138 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column25 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column96 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column97 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column98 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column99 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column100 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column101 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column103 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column104 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column105 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column106 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column107 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column108 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column109 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column110 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column111 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column112 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column113 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column114 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column147 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column34 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column35 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Column102 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.Column22 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.tableLayoutPanel1.SuspendLayout(); this.groupBoxEX3.SuspendLayout(); this.groupBoxEX2.SuspendLayout(); @@ -501,34 +482,15 @@ this.dataGridViewTextBoxColumn2, this.Column7, this.dataGridViewTextBoxColumn5, + this.Column22, this.Column33, this.Column29, - this.Column3, this.Column138, - this.Column25, - this.Column96, - this.Column97, - this.Column98, - this.Column99, - this.Column100, - this.Column101, - this.Column103, - this.Column104, - this.Column105, - this.Column106, - this.Column107, - this.Column108, - this.Column109, - this.Column110, - this.Column111, - this.Column112, - this.Column113, - this.Column114, this.Column147, this.Column34, this.Column35, this.Column102, - this.Column22}); + this.Column3}); dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(32)))), ((int)(((byte)(32))))); dataGridViewCellStyle5.Font = new System.Drawing.Font("微软雅黑", 10.5F); @@ -605,6 +567,15 @@ this.dataGridViewTextBoxColumn5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; this.dataGridViewTextBoxColumn5.Width = 210; // + // Column22 + // + this.Column22.DataPropertyName = "Result"; + this.Column22.HeaderText = "反馈结果"; + this.Column22.MinimumWidth = 8; + this.Column22.Name = "Column22"; + this.Column22.ReadOnly = true; + this.Column22.Width = 150; + // // Column33 // this.Column33.DataPropertyName = "CSBYHSCHEDULE"; @@ -623,14 +594,6 @@ this.Column29.ReadOnly = true; this.Column29.Width = 150; // - // Column3 - // - this.Column3.DataPropertyName = "Remark"; - this.Column3.HeaderText = "备注"; - this.Column3.Name = "Column3"; - this.Column3.ReadOnly = true; - this.Column3.Width = 400; - // // Column138 // this.Column138.DataPropertyName = "UpState"; @@ -638,139 +601,6 @@ this.Column138.Name = "Column138"; this.Column138.ReadOnly = true; // - // Column25 - // - this.Column25.DataPropertyName = "CCDResult1"; - this.Column25.HeaderText = "正面(2D/3D)"; - this.Column25.Name = "Column25"; - this.Column25.ReadOnly = true; - // - // Column96 - // - this.Column96.DataPropertyName = "CCDResult2"; - this.Column96.HeaderText = "反面(2D/3D)"; - this.Column96.Name = "Column96"; - this.Column96.ReadOnly = true; - // - // Column97 - // - this.Column97.DataPropertyName = "CCDResult3"; - this.Column97.HeaderText = "左侧面(2D/3D)"; - this.Column97.Name = "Column97"; - this.Column97.ReadOnly = true; - // - // Column98 - // - this.Column98.DataPropertyName = "CCDResult4"; - this.Column98.HeaderText = "右侧面(2D/3D)"; - this.Column98.Name = "Column98"; - this.Column98.ReadOnly = true; - // - // Column99 - // - this.Column99.DataPropertyName = "CCDResult5"; - this.Column99.HeaderText = "顶面(2D/3D)"; - this.Column99.Name = "Column99"; - this.Column99.ReadOnly = true; - // - // Column100 - // - this.Column100.DataPropertyName = "CCDResult6"; - this.Column100.HeaderText = "底面(2D/3D)"; - this.Column100.Name = "Column100"; - this.Column100.ReadOnly = true; - // - // Column101 - // - this.Column101.DataPropertyName = "CCDResult7"; - this.Column101.HeaderText = "底DE1"; - this.Column101.Name = "Column101"; - this.Column101.ReadOnly = true; - // - // Column103 - // - this.Column103.DataPropertyName = "CCDResult8"; - this.Column103.HeaderText = "底DE2"; - this.Column103.Name = "Column103"; - this.Column103.ReadOnly = true; - // - // Column104 - // - this.Column104.DataPropertyName = "CCDResult9"; - this.Column104.HeaderText = "底DE3"; - this.Column104.Name = "Column104"; - this.Column104.ReadOnly = true; - // - // Column105 - // - this.Column105.DataPropertyName = "CCDResult10"; - this.Column105.HeaderText = "底DE4"; - this.Column105.Name = "Column105"; - this.Column105.ReadOnly = true; - // - // Column106 - // - this.Column106.DataPropertyName = "CCDResult11"; - this.Column106.HeaderText = "中ME1"; - this.Column106.Name = "Column106"; - this.Column106.ReadOnly = true; - // - // Column107 - // - this.Column107.DataPropertyName = "CCDResult12"; - this.Column107.HeaderText = "中ME2"; - this.Column107.Name = "Column107"; - this.Column107.ReadOnly = true; - // - // Column108 - // - this.Column108.DataPropertyName = "CCDResult13"; - this.Column108.HeaderText = "中ME3"; - this.Column108.Name = "Column108"; - this.Column108.ReadOnly = true; - // - // Column109 - // - this.Column109.DataPropertyName = "CCDResult14"; - this.Column109.HeaderText = "中ME4"; - this.Column109.Name = "Column109"; - this.Column109.ReadOnly = true; - // - // Column110 - // - this.Column110.DataPropertyName = "CCDResult15"; - this.Column110.HeaderText = "极柱(POS/NEG)"; - this.Column110.Name = "Column110"; - this.Column110.ReadOnly = true; - // - // Column111 - // - this.Column111.DataPropertyName = "CCDResult16"; - this.Column111.HeaderText = "防爆阀(PRO)"; - this.Column111.Name = "Column111"; - this.Column111.ReadOnly = true; - // - // Column112 - // - this.Column112.DataPropertyName = "CCDResult17"; - this.Column112.HeaderText = "厚度1"; - this.Column112.Name = "Column112"; - this.Column112.ReadOnly = true; - // - // Column113 - // - this.Column113.DataPropertyName = "CCDResult18"; - this.Column113.HeaderText = "厚度2"; - this.Column113.Name = "Column113"; - this.Column113.ReadOnly = true; - // - // Column114 - // - this.Column114.DataPropertyName = "CCDResult19"; - this.Column114.HeaderText = "厚度3"; - this.Column114.Name = "Column114"; - this.Column114.ReadOnly = true; - // // Column147 // this.Column147.DataPropertyName = "RethrowNum"; @@ -805,14 +635,13 @@ this.Column102.ReadOnly = true; this.Column102.Width = 150; // - // Column22 + // Column3 // - this.Column22.DataPropertyName = "Result"; - this.Column22.HeaderText = "反馈结果"; - this.Column22.MinimumWidth = 8; - this.Column22.Name = "Column22"; - this.Column22.ReadOnly = true; - this.Column22.Width = 150; + this.Column3.DataPropertyName = "Remark"; + this.Column3.HeaderText = "备注"; + this.Column3.Name = "Column3"; + this.Column3.ReadOnly = true; + this.Column3.Width = 400; // // FrmDataMonitor // @@ -875,33 +704,14 @@ private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2; private System.Windows.Forms.DataGridViewTextBoxColumn Column7; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5; + private System.Windows.Forms.DataGridViewTextBoxColumn Column22; private System.Windows.Forms.DataGridViewTextBoxColumn Column33; private System.Windows.Forms.DataGridViewTextBoxColumn Column29; - private System.Windows.Forms.DataGridViewTextBoxColumn Column3; private System.Windows.Forms.DataGridViewTextBoxColumn Column138; - private System.Windows.Forms.DataGridViewTextBoxColumn Column25; - private System.Windows.Forms.DataGridViewTextBoxColumn Column96; - private System.Windows.Forms.DataGridViewTextBoxColumn Column97; - private System.Windows.Forms.DataGridViewTextBoxColumn Column98; - private System.Windows.Forms.DataGridViewTextBoxColumn Column99; - private System.Windows.Forms.DataGridViewTextBoxColumn Column100; - private System.Windows.Forms.DataGridViewTextBoxColumn Column101; - private System.Windows.Forms.DataGridViewTextBoxColumn Column103; - private System.Windows.Forms.DataGridViewTextBoxColumn Column104; - private System.Windows.Forms.DataGridViewTextBoxColumn Column105; - private System.Windows.Forms.DataGridViewTextBoxColumn Column106; - private System.Windows.Forms.DataGridViewTextBoxColumn Column107; - private System.Windows.Forms.DataGridViewTextBoxColumn Column108; - private System.Windows.Forms.DataGridViewTextBoxColumn Column109; - private System.Windows.Forms.DataGridViewTextBoxColumn Column110; - private System.Windows.Forms.DataGridViewTextBoxColumn Column111; - private System.Windows.Forms.DataGridViewTextBoxColumn Column112; - private System.Windows.Forms.DataGridViewTextBoxColumn Column113; - private System.Windows.Forms.DataGridViewTextBoxColumn Column114; private System.Windows.Forms.DataGridViewTextBoxColumn Column147; private System.Windows.Forms.DataGridViewTextBoxColumn Column34; private System.Windows.Forms.DataGridViewTextBoxColumn Column35; private System.Windows.Forms.DataGridViewTextBoxColumn Column102; - private System.Windows.Forms.DataGridViewTextBoxColumn Column22; + private System.Windows.Forms.DataGridViewTextBoxColumn Column3; } } \ No newline at end of file diff --git a/LargeSquareOne/FrmDataMonitor.cs b/LargeSquareOne/FrmDataMonitor.cs index 0b84632..f34af43 100644 --- a/LargeSquareOne/FrmDataMonitor.cs +++ b/LargeSquareOne/FrmDataMonitor.cs @@ -1,5 +1,6 @@ using HML; using JinYuan.CommunicationLib.Enum; +using JinYuan.ControlCenters; using JinYuan.Helper; using JinYuan.MES.Models; using JinYuan.Models; @@ -495,8 +496,8 @@ namespace LargeSquareOne CommonMethods.AddDataMonitorLog(0, "启动开始监控"); btSatrt.Text = "连接PLC中…"; bool IsLink = CommonMethods.ConnectPLC(); - - if (IsLink) + bool IsGrading = CommonMethods.WriteGrading(); + if (IsLink && IsGrading) { OmronStart(true); CommonMethods.IsRun = true; diff --git a/LargeSquareOne/FrmDataMonitor.resx b/LargeSquareOne/FrmDataMonitor.resx index cbf6e11..c7bab65 100644 --- a/LargeSquareOne/FrmDataMonitor.resx +++ b/LargeSquareOne/FrmDataMonitor.resx @@ -153,27 +153,18 @@ True + + True + True True - - True - True - - True - - - True - - - True - True @@ -186,7 +177,7 @@ True - + True @@ -197,7 +188,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABE - DQAAAk1TRnQBSQFMAgEBAwEAAYABAgGAAQIBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA + DQAAAk1TRnQBSQFMAgEBAwEAAYgBAgGIAQIBEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA AwABEAMAAQEBAAEgBgABEC4AAxUBHQMkATQDBQEGKAADHQEpAl4BZwHwATUBNgHPAf8BNQE2Ac8B/wE1 ATYBzwH/ATUBNgHPAf8BNQE2Ac8B/wNOAZagAAMTARkDZQHlA+YB/wPmAf8D5gH/A+YB/wPmAf8DRwGA HAACUwFUAaoBNQE2Ac8B/wE1ATYBzwH/ATUBNgHPAf8BNQE2Ac8B/wE1ATYBzwH/ATUBNgHPAf8BNQE2 diff --git a/LargeSquareOne/FrmParamSet.Designer.cs b/LargeSquareOne/FrmParamSet.Designer.cs index 37052e2..de3ef9c 100644 --- a/LargeSquareOne/FrmParamSet.Designer.cs +++ b/LargeSquareOne/FrmParamSet.Designer.cs @@ -665,7 +665,6 @@ this.title5.Size = new System.Drawing.Size(117, 37); this.title5.TabIndex = 49; this.title5.TitleName = "分档设置"; - this.title5.Visible = false; // // dgvFdConfigs // @@ -712,7 +711,6 @@ this.dgvFdConfigs.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; this.dgvFdConfigs.Size = new System.Drawing.Size(1757, 69); this.dgvFdConfigs.TabIndex = 78; - this.dgvFdConfigs.Visible = false; // // FrmSystemSet // diff --git a/LargeSquareOne/FrmParamSet.cs b/LargeSquareOne/FrmParamSet.cs index e8d9752..a139a87 100644 --- a/LargeSquareOne/FrmParamSet.cs +++ b/LargeSquareOne/FrmParamSet.cs @@ -26,6 +26,13 @@ namespace LargeSquareOne private List NGLDTypes3 = new List();//NG拉带类型 private bool isFDEditing = false; private int editingFDRowIndex = -1; + //档位 + private string Grading1 = "一档"; + private string Grading2 = "二档"; + private string Grading3 = "三档"; + private string Grading4 = "四档"; + private string Grading5 = "五档"; + private string Grading6 = "六档"; private readonly string configFolderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config"); /// /// 打印日志方法 @@ -72,8 +79,8 @@ namespace LargeSquareOne NGLDTypes2.AddRange(new string[] { "面1", "面2", "面3" }); NGLDTypes3.AddRange(new string[] { "面1", "面2", "面3" }); SetupFDDataGridView(); - //取消分档 ,有单独的分档机 - // LoadFDConfig(); + + LoadFDConfig(); this.tog_AutoStart.IsChecked = CommonMethods.sysConfig.AutoStart; this.tog_AutoLogin.IsChecked = CommonMethods.sysConfig.AutoLogin; @@ -462,9 +469,11 @@ namespace LargeSquareOne OKLD2Type = device.OKLD2Type, OKLD3Type = device.OKLD3Type, OKLD4Type = device.OKLD4Type, - NGLD5Type = device.NGLD5Type, - NGLD6Type = device.NGLD6Type, - NGLD7Type = device.NGLD7Type, + OKLD5Type = device.OKLD5Type, + OKLD6Type = device.OKLD6Type, + //NGLD5Type = device.NGLD5Type, + //NGLD6Type = device.NGLD6Type, + //NGLD7Type = device.NGLD7Type, IsFDActive = device.IsFDActive, IsNGActive = device.IsNGActive }).ToList(); @@ -561,62 +570,78 @@ namespace LargeSquareOne Width = 120, ValueType = typeof(string) }, + new DataGridViewTextBoxColumn + { + Name = "OKLD5Type", + HeaderText = "OK拉带类型5", + DataPropertyName = "OKLD5Type", + Width = 120, + ValueType = typeof(string) + }, + new DataGridViewTextBoxColumn + { + Name = "OKLD6Type", + HeaderText = "OK拉带类型6", + DataPropertyName = "OKLD6Type", + Width = 120, + ValueType = typeof(string) + }, #endregion #region NG拉带类型 - new DataGridViewComboBoxColumn - { - Name = "NGLD5Type", - HeaderText = "NG拉带类型5", - DataPropertyName = "NGLD5Type",//NG拉带 - DataSource = new List(NGLDTypes1), // 使用新列表避免引用问题 - Width = 160, - ValueType = typeof(string), - FlatStyle = FlatStyle.Flat, - DefaultCellStyle = new DataGridViewCellStyle - { - BackColor = Color.FromArgb(14, 23, 38), // 深色背景 - ForeColor = Color.White, // 白色文字 - SelectionBackColor = Color.FromArgb(0, 122, 204), // 选中时的背景色 - SelectionForeColor = Color.White, // 选中时的文字颜色 - Font = new Font("微软雅黑", 9F) // 字体设置 - } - }, - new DataGridViewComboBoxColumn - { - Name = "NGLD6Type", - HeaderText = "NG拉带类型6", - DataPropertyName = "NGLD6Type",//NG拉带 - DataSource = new List(NGLDTypes2), // 使用新列表避免引用问题 - Width = 160, - ValueType = typeof(string), - FlatStyle = FlatStyle.Flat, - DefaultCellStyle = new DataGridViewCellStyle - { - BackColor = Color.FromArgb(14, 23, 38), // 深色背景 - ForeColor = Color.White, // 白色文字 - SelectionBackColor = Color.FromArgb(0, 122, 204), // 选中时的背景色 - SelectionForeColor = Color.White, // 选中时的文字颜色 - Font = new Font("微软雅黑", 9F) // 字体设置 - } - }, - new DataGridViewComboBoxColumn - { - Name = "NGLD7Type", - HeaderText = "NG拉带类型7", - DataPropertyName = "NGLD7Type",//NG拉带 - DataSource = new List(NGLDTypes3), // 使用新列表避免引用问题 - Width = 160, - ValueType = typeof(string), - FlatStyle = FlatStyle.Flat, - DefaultCellStyle = new DataGridViewCellStyle - { - BackColor = Color.FromArgb(14, 23, 38), // 深色背景 - ForeColor = Color.White, // 白色文字 - SelectionBackColor = Color.FromArgb(0, 122, 204), // 选中时的背景色 - SelectionForeColor = Color.White, // 选中时的文字颜色 - Font = new Font("微软雅黑", 9F) // 字体设置 - } - }, + // new DataGridViewComboBoxColumn + //{ + // Name = "NGLD5Type", + // HeaderText = "NG拉带类型5", + // DataPropertyName = "NGLD5Type",//NG拉带 + // DataSource = new List(NGLDTypes1), // 使用新列表避免引用问题 + // Width = 160, + // ValueType = typeof(string), + // FlatStyle = FlatStyle.Flat, + // DefaultCellStyle = new DataGridViewCellStyle + // { + // BackColor = Color.FromArgb(14, 23, 38), // 深色背景 + // ForeColor = Color.White, // 白色文字 + // SelectionBackColor = Color.FromArgb(0, 122, 204), // 选中时的背景色 + // SelectionForeColor = Color.White, // 选中时的文字颜色 + // Font = new Font("微软雅黑", 9F) // 字体设置 + // } + //}, + //new DataGridViewComboBoxColumn + //{ + // Name = "NGLD6Type", + // HeaderText = "NG拉带类型6", + // DataPropertyName = "NGLD6Type",//NG拉带 + // DataSource = new List(NGLDTypes2), // 使用新列表避免引用问题 + // Width = 160, + // ValueType = typeof(string), + // FlatStyle = FlatStyle.Flat, + // DefaultCellStyle = new DataGridViewCellStyle + // { + // BackColor = Color.FromArgb(14, 23, 38), // 深色背景 + // ForeColor = Color.White, // 白色文字 + // SelectionBackColor = Color.FromArgb(0, 122, 204), // 选中时的背景色 + // SelectionForeColor = Color.White, // 选中时的文字颜色 + // Font = new Font("微软雅黑", 9F) // 字体设置 + // } + //}, + //new DataGridViewComboBoxColumn + //{ + // Name = "NGLD7Type", + // HeaderText = "NG拉带类型7", + // DataPropertyName = "NGLD7Type",//NG拉带 + // DataSource = new List(NGLDTypes3), // 使用新列表避免引用问题 + // Width = 160, + // ValueType = typeof(string), + // FlatStyle = FlatStyle.Flat, + // DefaultCellStyle = new DataGridViewCellStyle + // { + // BackColor = Color.FromArgb(14, 23, 38), // 深色背景 + // ForeColor = Color.White, // 白色文字 + // SelectionBackColor = Color.FromArgb(0, 122, 204), // 选中时的背景色 + // SelectionForeColor = Color.White, // 选中时的文字颜色 + // Font = new Font("微软雅黑", 9F) // 字体设置 + // } + //}, #endregion #region 开启分档 new DataGridViewCheckBoxColumn @@ -784,9 +809,11 @@ namespace LargeSquareOne config.OKLD2Type = row.Cells["OKLD2Type"].Value?.ToString() ?? ""; config.OKLD3Type = row.Cells["OKLD3Type"].Value?.ToString() ?? ""; config.OKLD4Type = row.Cells["OKLD4Type"].Value?.ToString() ?? ""; - config.NGLD5Type = row.Cells["NGLD5Type"].Value?.ToString() ?? ""; - config.NGLD6Type = row.Cells["NGLD6Type"].Value?.ToString() ?? ""; - config.NGLD7Type = row.Cells["NGLD7Type"].Value?.ToString() ?? ""; + config.OKLD5Type = row.Cells["OKLD5Type"].Value?.ToString() ?? ""; + config.OKLD6Type = row.Cells["OKLD6Type"].Value?.ToString() ?? ""; + //config.NGLD5Type = row.Cells["NGLD5Type"].Value?.ToString() ?? ""; + //config.NGLD6Type = row.Cells["NGLD6Type"].Value?.ToString() ?? ""; + //config.NGLD7Type = row.Cells["NGLD7Type"].Value?.ToString() ?? ""; config.IsFDActive = row.Cells["IsFDActive"].Value != null && Convert.ToBoolean(row.Cells["IsFDActive"].Value); @@ -833,7 +860,14 @@ namespace LargeSquareOne string backupFile = $"{FdConfigFilePath}.bak"; File.Copy(FdConfigFilePath, backupFile, true); } - + // + Grading1 = fdConfigs[0].OKLD1Type; + Grading2 = fdConfigs[0].OKLD2Type; + Grading3 = fdConfigs[0].OKLD3Type; + Grading4 = fdConfigs[0].OKLD4Type; + Grading5 = fdConfigs[0].OKLD5Type; + Grading6 = fdConfigs[0].OKLD6Type; + SaveFD2xml(); // 直接保存到目标文件 MiniExcel.SaveAs(FdConfigFilePath, fdConfigs, overwriteFile: true); } @@ -860,6 +894,25 @@ namespace LargeSquareOne { dgvFdConfigs.DataSource = null; dgvFdConfigs.DataSource = new BindingList(fdConfigs); + } + private void SaveFD2xml() + { + CommonMethods.mesConfig.Grading1 = Grading1; + CommonMethods.mesConfig.Grading2 = Grading2; + CommonMethods.mesConfig.Grading3 = Grading3; + CommonMethods.mesConfig.Grading4 = Grading4; + CommonMethods.mesConfig.Grading5 = Grading5; + CommonMethods.mesConfig.Grading6 = Grading6; + //档位 + IniConfigHelper.WriteIniData("MES配置", "Grading1", Grading1); + IniConfigHelper.WriteIniData("MES配置", "Grading2", Grading2); + IniConfigHelper.WriteIniData("MES配置", "Grading3", Grading3); + IniConfigHelper.WriteIniData("MES配置", "Grading4", Grading4); + IniConfigHelper.WriteIniData("MES配置", "Grading5", Grading5); + IniConfigHelper.WriteIniData("MES配置", "Grading6", Grading6); + + + } #endregion }