diff --git a/MaterialTraceability.Business/Impl/LYSignalReadBusiness.cs b/MaterialTraceability.Business/Impl/LYSignalReadBusiness.cs index e4526a6..c87deb9 100644 --- a/MaterialTraceability.Business/Impl/LYSignalReadBusiness.cs +++ b/MaterialTraceability.Business/Impl/LYSignalReadBusiness.cs @@ -109,14 +109,12 @@ namespace MaterialTraceability.Business.Impl LogRefreshEvent?.Invoke(LogType.PlcLog, "冷压放卷位涨紧信号触发成功"); LogRefreshEvent?.Invoke(LogType.RfidLog, "冷压放卷位涨紧信号触发成功"); LogHelper.Info("冷压放卷位涨紧信号触发成功"); - //upLolldBusiness.SaveLogRecord(position, "冷压放卷位涨紧信号触发成功"); //读取卷筒RFID物料信息 ProEquip proEquip = equipBusiness.Equiplist.Where(x => x.positionId == position).FirstOrDefault(); if (proEquip == null) { LogRefreshEvent?.Invoke(LogType.AlarmLog, "获取放卷位读写器设备信息异常"); - //upLoadBusiness.SaveLogRecord(position, "获取放卷位读写器设备信息异常"); return; } string epc = equipBusiness.ReadEPCByAntana(proEquip.equipId); @@ -124,10 +122,9 @@ namespace MaterialTraceability.Business.Impl SaveReadRecord(proEquip, epc); if (StringExtension.IsBlank(epc)) { - plcBusiness.writePlc("D6024", 1); + plcBusiness.writePlc(appConfig.LyAddress.RFID异常, 1); LogHelper.Info("放卷位RFID条码信息读取失败,下发PLC报警D6024写1"); LogRefreshEvent?.Invoke(LogType.AlarmLog, "放卷位RFID条码信息读取失败"); - //upLoadBusiness.SaveLogRecord(position, "放卷位RFID条码信息读取失败"); ViewModelRefreshEvent?.Invoke(new ViewModelDto() { rfidInfo = new RfidInfoDto() @@ -142,21 +139,18 @@ namespace MaterialTraceability.Business.Impl return; } LogHelper.Info(String.Format("放卷位RFID条码信息读取成功:{0}", epc)); - //upLoadBusiness.SaveLogRecord(position, String.Format("放卷位RFID条码信息读取成功:{0}", epc)); LogRefreshEvent?.Invoke(LogType.RfidLog, String.Format("放卷位RFID条码信息读取成功,RFID为{0}", epc)); //判断RFID标签是否重复 LogHelper.Info("判断RFID标签是否重复"); - //upLoadBusiness.SaveLogRecord(position, "判断RFID标签是否重复"); if (BusinessHelper.UpRfidIsRecur(epc, position).Result) { //判断是否已经生产结束 if (UpMaterialIsEndProduction(epc).Result) { - plcBusiness.writePlc("D6024", 1); + plcBusiness.writePlc(appConfig.LyAddress.RFID异常, 1); LogRefreshEvent?.Invoke(LogType.AlarmLog, String.Format("当前读取的RFID:{0},已经生产结束不允许再次上料", epc)); LogHelper.Info(String.Format("当前读取的RFID:{0},已经生产结束不允许再次上料", epc)); - //upLoadBusiness.SaveLogRecord(position, String.Format("当前读取的RFID:{0},已经生产结束不允许再次上料", epc)); return; } else @@ -166,7 +160,7 @@ namespace MaterialTraceability.Business.Impl ProUpRecord upRecord = upRecordServices.QueryFirst(exp, order, false).Result; if (upRecord != null) { - PlcBusiness.writeStrPlc("D6034", upRecord.Sfc); + PlcBusiness.writeStrPlc(appConfig.LyAddress.放卷SFC, upRecord.Sfc); ViewModelRefreshEvent?.Invoke(new ViewModelDto() { rfidInfo = new RfidInfoDto() @@ -180,9 +174,8 @@ namespace MaterialTraceability.Business.Impl } LogHelper.Info("放卷位RFID读取到的条码:" + epc + "与前一读取相同并且生产未结束,可以继续生产"); LogRefreshEvent?.Invoke(LogType.RfidLog, "放卷位RFID读取到的条码:" + epc + "与前一读取相同并且生产未结束,可以继续生产"); - //upLoadBusiness.SaveLogRecord(position, "放卷位RFID读取到的条码:" + epc + "与前一读取相同并且生产未结束,可以继续生产"); LogHelper.Info("冷压放卷流程处理成功,D6014写0"); - plcBusiness.writePlc("D6014", 0); + plcBusiness.writePlc(appConfig.LyAddress.放卷OK, 0); return; } } @@ -203,7 +196,6 @@ namespace MaterialTraceability.Business.Impl { LogHelper.Error("冷压放卷涨紧逻辑处理异常", ex); LogRefreshEvent?.Invoke(LogType.AlarmLog, "冷压放卷涨紧逻辑处理异常" + ex.Message); - //upLoadBusiness.SaveLogRecord(position, "冷压放卷涨紧逻辑处理异常" + ex.Message); } } @@ -219,12 +211,10 @@ namespace MaterialTraceability.Business.Impl LogRefreshEvent?.Invoke(LogType.PlcLog, "冷压放卷位结束信号触发成功"); LogRefreshEvent?.Invoke(LogType.RfidLog, "冷压放卷位结束信号触发成功"); LogHelper.Info("冷压放卷位结束信号触发成功"); - //upLoadBusiness.SaveLogRecord(position, "冷压放卷位结束信号触发成功"); ProShaftInfo shaftInfo = await this.GetShaftInfoByPosition(position); if (shaftInfo == null) { LogRefreshEvent?.Invoke(LogType.RfidLog, "放卷结束,获取卷轴绑定的信息为空"); - //upLoadBusiness.SaveLogRecord(position, "放卷结束,获取卷轴绑定的信息为空"); return; } Expression> upExp = s1 => true; @@ -234,7 +224,6 @@ namespace MaterialTraceability.Business.Impl if (upRecord == null) { LogRefreshEvent?.Invoke(LogType.AlarmLog, "放卷结束,获取上料信息为空"); - //upLoadBusiness.SaveLogRecord(position, "放卷结束,获取上料信息为空"); return; } @@ -246,10 +235,10 @@ namespace MaterialTraceability.Business.Impl //LogRefreshEvent?.Invoke(LogType.RfidLog, "放卷结束,清除卷轴绑定信息"); LogRefreshEvent?.Invoke(LogType.RfidLog, "获取当前正在生产的收卷轴"); - if (PlcBusiness.readPlc("D6026") == 1) UpdateShaftEndFlag(1); - if (PlcBusiness.readPlc("D6027") == 1) UpdateShaftEndFlag(2); - if (PlcBusiness.readPlc("D6028") == 1) UpdateShaftEndFlag(3); - if (PlcBusiness.readPlc("D6029") == 1) UpdateShaftEndFlag(4); + if (PlcBusiness.readPlc(appConfig.LyAddress.收卷1A状态) == 1) UpdateShaftEndFlag(1); + if (PlcBusiness.readPlc(appConfig.LyAddress.收卷1B状态) == 1) UpdateShaftEndFlag(2); + if (PlcBusiness.readPlc(appConfig.LyAddress.收卷2A状态) == 1) UpdateShaftEndFlag(3); + if (PlcBusiness.readPlc(appConfig.LyAddress.收卷2B状态) == 1) UpdateShaftEndFlag(4); //更新放卷信息 upRecord.endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); @@ -286,7 +275,7 @@ namespace MaterialTraceability.Business.Impl LogRefreshEvent?.Invoke(LogType.RfidLog, logStr + "收卷位涨紧信号触发成功"); LogHelper.Info(logStr + "收卷位涨紧信号触发成功"); - if (StringExtension.IsBlank(PlcBusiness.readStrPlc("D6034", 32))) + if (StringExtension.IsBlank(PlcBusiness.readStrPlc(appConfig.LyAddress.放卷SFC, 32))) { LogRefreshEvent?.Invoke(LogType.AlarmLog, "放卷位物料信息为空,先触发放卷位物料信息"); return; @@ -484,10 +473,10 @@ namespace MaterialTraceability.Business.Impl LogHelper.Info(logStr + "收卷结束信号触发成功"); //通过PLC读取收卷轴绑定的放卷位SFC信息 ProShaftInfo upMaterialInfo = new ProShaftInfo(); - if (position == 1) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc("D6050", (ushort)18).Replace("\0", "").Trim(); - if (position == 2) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc("D6066", (ushort)18).Replace("\0", "").Trim(); - if (position == 3) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc("D6082", (ushort)18).Replace("\0", "").Trim(); - if (position == 4) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc("D6098", (ushort)18).Replace("\0", "").Trim(); + if (position == 1) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.收卷1ASFC, (ushort)18).Replace("\0", "").Trim(); + if (position == 2) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.收卷1BSFC, (ushort)18).Replace("\0", "").Trim(); + if (position == 3) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.收卷2ASFC, (ushort)18).Replace("\0", "").Trim(); + if (position == 4) upMaterialInfo.bindSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.收卷2BSFC, (ushort)18).Replace("\0", "").Trim(); if (StringExtension.IsBlank(upMaterialInfo.bindSfc)) { @@ -533,10 +522,10 @@ namespace MaterialTraceability.Business.Impl //1A轴:1,1B轴:2,2A轴:3,2B轴:4 //读取卷轴的EA值 LogHelper.Info("读取" + logStr + "的EA值"); - if (position == 1) realEaValue = PlcBusiness.readPlc("D6030"); - if (position == 2) realEaValue = PlcBusiness.readPlc("D6031"); - if (position == 3) realEaValue = PlcBusiness.readPlc("D6032"); - if (position == 4) realEaValue = PlcBusiness.readPlc("D6033"); + if (position == 1) realEaValue = PlcBusiness.readPlc(appConfig.LyAddress.收卷1AEA); + if (position == 2) realEaValue = PlcBusiness.readPlc(appConfig.LyAddress.收卷1BEA); + if (position == 3) realEaValue = PlcBusiness.readPlc(appConfig.LyAddress.收卷2AEA); + if (position == 4) realEaValue = PlcBusiness.readPlc(appConfig.LyAddress.收卷2BEA); LogHelper.Info(logStr + "设备EA值:" + realEaValue); LogRefreshEvent?.Invoke(LogType.PlcLog, logStr + "设备EA值:" + realEaValue); shaftInfo.bindEaValue = realEaValue.ToString(); @@ -595,11 +584,9 @@ namespace MaterialTraceability.Business.Impl //获取放卷物料MES账目 #region 获取放卷物料EA string upMaterialEaValue = GetUpMaterialQty(position,upMaterialInfo.bindSfc, logStr); - //upMaterialEaValue = "2343";//正式环境删除 if (StringExtension.IsBlank(upMaterialEaValue)) { LogRefreshEvent?.Invoke(LogType.MesLog, String.Format("通过MES获取放卷位{0}物料EA值为空", upMaterialInfo.bindSfc)); - //upLoadBusiness.SaveLogRecord(position, String.Format("通过MES获取放卷位{0}物料EA值为空", upMaterialInfo.bindSfc)); return; } upMaterialInfo.bindEaValue = upMaterialEaValue; @@ -645,8 +632,7 @@ namespace MaterialTraceability.Business.Impl if (GetSameSfcByPlc(upMaterialInfo.bindSfc, position)) { LogRefreshEvent?.Invoke(LogType.AlarmLog, String.Format("{0}其它收卷位还有物料未完工,请勿提前完工最后一卷料", upMaterialInfo.bindSfc)); - //upLoadBusiness.SaveLogRecord(position, String.Format("{0}其它收卷位还有物料未完工,请勿提前完工最后一卷料", upMaterialInfo.bindSfc)); - plcBusiness.writePlc("D6025", 1); + plcBusiness.writePlc(appConfig.LyAddress.MES异常, 1); return; } #endregion @@ -789,7 +775,6 @@ namespace MaterialTraceability.Business.Impl { LogRefreshEvent?.Invoke(LogType.RfidLog, logStr + "下料流程结束,下发PLC下料信号"); LogRefreshEvent?.Invoke(LogType.PlcLog, logStr + "下料流程结束,下发PLC下料信号"); - //upLoadBusiness.SaveLogRecord(position, logStr + "下料流程结束,下发PLC下料信号"); LogHelper.Info(logStr + "下料流程结束,下发PLC下料信号"); //下发PLC下料信号 this.sendSuccess(position); @@ -799,7 +784,6 @@ namespace MaterialTraceability.Business.Impl { LogHelper.Error("冷压收卷结束信号逻辑处理异常", ex); LogRefreshEvent?.Invoke(LogType.AlarmLog, "冷压收卷结束信号逻辑处理异常" + ex.Message); - //upLoadBusiness.SaveLogRecord(position, "冷压收卷结束信号逻辑处理异常" + ex.Message); } } @@ -814,19 +798,8 @@ namespace MaterialTraceability.Business.Impl { //调取MES调整数量接口 LogRefreshEvent?.Invoke(LogType.MesLog, "调用MES调整数量接口"); - //upLoadBusiness.SaveLogRecord(position, "调用MES调整数量接口"); MiBatchCompleteSfcAndAdujustQtyServiceServiceParam miBatchCompleteSfcAndAdujustQtyServiceServiceParam = new MiBatchCompleteSfcAndAdujustQtyServiceServiceParam() { - //url = "http://lymesa.catlbattery.com:8103/atlmeswebservice/MiBatchCompleteSfcAndAdujustQtyServiceService?wsdl", - //site = "2100", - //sfcPre = bindSfc, - //processLotPre = "", - //operation = appConfig.operationByA, - //operationRevision = "A", - //resource = appConfig.resource, - //user = "SUP_LYA_RF01", - //activity = "Z_PR591", - //modeProcessSfc = WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc.MODE_NONE, url = inifile.IniReadValue("AdujustQtyParam","url"), site = inifile.IniReadValue("AdujustQtyParam", "site"), sfcPre = bindSfc, @@ -851,23 +824,19 @@ namespace MaterialTraceability.Business.Impl LogHelper.Info("调用MES接口调整物料" + bindSfc + "数量"); LogHelper.Info("MES调整数量接口请求参数:" + JsonChange.ModeToJson(miBatchCompleteSfcAndAdujustQtyServiceServiceParam)); - //upLoadBusiness.SaveLogRecord(position, "MES调整数量接口请求参数:" + JsonChange.ModeToJson(miBatchCompleteSfcAndAdujustQtyServiceServiceParam)); if (appConfig.isMesFlag == 1) { var requestResult = MesWebServices.iMiBatchCompleteSfcAndAdujustQtyServiceService(miBatchCompleteSfcAndAdujustQtyServiceServiceParam); LogHelper.Info("MES调整数量接口返回参数:" + JsonChange.ModeToJson(requestResult)); - //upLoadBusiness.SaveLogRecord(position, "MES调整数量接口返回参数:" + JsonChange.ModeToJson(requestResult)); if (requestResult.@return.code > 0) { LogHelper.Info("MES调整数量接口调用失败:" + requestResult.@return.message); LogRefreshEvent?.Invoke(LogType.AlarmLog, "MES调整数量接口调用失败:" + upLoadBusiness.GetMesMessage(requestResult.@return.code, requestResult.@return.message)); - //upLoadBusiness.SaveLogRecord(position, "MES调整数量接口调用失败:" + requestResult.@return.message); - plcBusiness.writePlc("D6025", requestResult.@return.code); + plcBusiness.writePlc(appConfig.LyAddress.MES异常, requestResult.@return.code); return false; } } LogRefreshEvent?.Invoke(LogType.MesLog, "MES调整数量接口调用成功"); - //upLoadBusiness.SaveLogRecord(position, "MES调整数量接口调用成功"); return true; } @@ -925,7 +894,6 @@ namespace MaterialTraceability.Business.Impl private string GetUpMaterialQty(int position,string bindSfc, string logStr) { LogHelper.Info(logStr + "通过MES接口获取放卷物料的EA值"); - //upLoadBusiness.SaveLogRecord(position, logStr + "通过MES接口获取放卷物料的EA值"); MiSFCQueryQtyServiceServiceParam sFCQueryQtyServiceServiceParam = new MiSFCQueryQtyServiceServiceParam() { //url = "http://lymesa.catlbattery.com:8103/atlmeswebservice/MiSFCQueryQtyServiceService?wsdl", @@ -935,7 +903,6 @@ namespace MaterialTraceability.Business.Impl sfc = bindSfc }; LogHelper.Info(logStr + "完工,MES获取物料EA值接口请求参数:" + JsonChange.ModeToJson(sFCQueryQtyServiceServiceParam)); - //upLoadBusiness.SaveLogRecord(position, logStr + "完工,MES获取物料EA值接口请求参数:" + JsonChange.ModeToJson(sFCQueryQtyServiceServiceParam)); DateTime beginTime = DateTime.Now; try { @@ -944,11 +911,9 @@ namespace MaterialTraceability.Business.Impl var sfcQueryQtyResponse = MesWebServices.iMiSFCQueryQtyServiceService(sFCQueryQtyServiceServiceParam); LogHelper.Info(logStr + "MES获取物料EA值接口返回参数:" + JsonChange.ModeToJson(sfcQueryQtyResponse)); - //upLoadBusiness.SaveLogRecord(position, logStr + "MES获取物料EA值接口返回参数:" + JsonChange.ModeToJson(sfcQueryQtyResponse)); if (sfcQueryQtyResponse.@return.code > 0) { LogHelper.Info(logStr + "MES获取物料EA值接口请求失败:" + sfcQueryQtyResponse.@return.message); - //upLoadBusiness.SaveLogRecord(position, logStr + "MES获取物料EA值接口请求失败:" + sfcQueryQtyResponse.@return.message); LogRefreshEvent?.Invoke(LogType.MesLog, String.Format(logStr + "通过MES接口获取放卷物料{0}的SFC数量失败:{1}", bindSfc, upLoadBusiness.GetMesMessage(sfcQueryQtyResponse.@return.code, sfcQueryQtyResponse.@return.message))); LogRefreshEvent?.Invoke(LogType.AlarmLog, String.Format(logStr + "通过MES接口获取放卷物料{0}的SFC数量失败:{1}", bindSfc, upLoadBusiness.GetMesMessage(sfcQueryQtyResponse.@return.code, sfcQueryQtyResponse.@return.message))); return ""; @@ -963,7 +928,6 @@ namespace MaterialTraceability.Business.Impl catch (Exception ex) { LogHelper.Info(String.Format(logStr + "MES获取SFC数量接口异常:{1}", ex.Message)); - //upLoadBusiness.SaveLogRecord(position, String.Format(logStr + "MES获取SFC数量接口异常:{1}", ex.Message)); WebServiceLog.saveMiSFCQueryQtyServiceService(sFCQueryQtyServiceServiceParam, null, beginTime, ex.Message); LogRefreshEvent?.Invoke(LogType.MesLog, String.Format(logStr + "MES获取SFC数量接口异常:{1}", ex.Message)); LogRefreshEvent?.Invoke(LogType.AlarmLog, String.Format(logStr + "MES获取SFC数量接口异常:{1}", ex.Message)); @@ -1050,15 +1014,13 @@ namespace MaterialTraceability.Business.Impl LogHelper.Info("MES自动拆分接口调用失败:" + result.message); LogRefreshEvent?.Invoke(LogType.AlarmLog, "MES自动拆分接口调用失败:" + upLoadBusiness.GetMesMessage(result.code, result.message)); LogRefreshEvent?.Invoke(LogType.MesLog, "MES自动拆分接口调用失败:" + upLoadBusiness.GetMesMessage(result.code, result.message)); - plcBusiness.writePlc("D6025", result.code); + plcBusiness.writePlc(appConfig.LyAddress.MES异常, result.code); return false; } } - //添加集合存放需要开启此功能的机台,通过配置文件中的资源号来判断是否启用此功能 LogHelper.Info("MES自动拆分接口调用成功"); LogRefreshEvent?.Invoke(LogType.RfidLog, "MES自动拆分接口调用成功"); - //upLoadBusiness.SaveLogRecord(position, "MES自动拆分接口调用成功"); #region 重量特征数据上传 Add By 2022-12-02 if (upLoadBusiness.JudgeResourceIsUplpadData()) //判断是否为190品种 @@ -1093,12 +1055,10 @@ namespace MaterialTraceability.Business.Impl LogHelper.Error("MES自动完工接口调用异常", ex); LogHelper.Info("MES自动完工接口调用异常:" + ex.Message); - //upLoadBusiness.SaveLogRecord(position, "MES自动完工接口调用异常:" + ex.Message); WebServiceLog.saveMiBatchCompleteSfcAndAdujustQtyServiceService(requestParam, null, beginTime, ex.Message); LogRefreshEvent?.Invoke(LogType.AlarmLog, "MES自动完工接口异常:" + ex.Message); LogRefreshEvent?.Invoke(LogType.MesLog, "MES自动完工接口异常:" + ex.Message); - //sendError(position, 1, true,1); - plcBusiness.writePlc("D6025", 1); + plcBusiness.writePlc(appConfig.LyAddress.MES异常, 1); return false; } return true; @@ -1170,7 +1130,7 @@ namespace MaterialTraceability.Business.Impl LogRefreshEvent?.Invoke(LogType.AlarmLog, "MES自动完工接口调用失败:" + upLoadBusiness.GetMesMessage(result.code, result.message)); LogRefreshEvent?.Invoke(LogType.MesLog, "MES自动完工接口调用失败:" + upLoadBusiness.GetMesMessage(result.code, result.message)); //sendError(position, 1, true,result.code); - plcBusiness.writePlc("D6025", result.code); + plcBusiness.writePlc(appConfig.LyAddress.MES异常, result.code); return false; } } @@ -1182,7 +1142,7 @@ namespace MaterialTraceability.Business.Impl LogRefreshEvent?.Invoke(LogType.AlarmLog, "MES自动完工接口异常:" + ex.Message); LogRefreshEvent?.Invoke(LogType.MesLog, "MES自动完工接口异常:" + ex.Message); //sendError(position, 1, true,1); - plcBusiness.writePlc("D6025", 1); + plcBusiness.writePlc(appConfig.LyAddress.MES异常, 1); return false; } LogRefreshEvent?.Invoke(LogType.MesLog, "MES自动完工接口调用成功"); @@ -1199,23 +1159,23 @@ namespace MaterialTraceability.Business.Impl { if (position != 1) { - if (PlcBusiness.readStrPlc("D6050", (ushort)18).Replace("\0", "").Trim() == bindSfc) + if (PlcBusiness.readStrPlc(appConfig.LyAddress.收卷1ASFC, (ushort)18).Replace("\0", "").Trim() == bindSfc) return true; } if (position != 2) { - if (PlcBusiness.readStrPlc("D6066", (ushort)18).Replace("\0", "").Trim() == bindSfc) + if (PlcBusiness.readStrPlc(appConfig.LyAddress.收卷1BSFC, (ushort)18).Replace("\0", "").Trim() == bindSfc) return true; } if (position != 3) { - if (PlcBusiness.readStrPlc("D6082", (ushort)18).Replace("\0", "").Trim() == bindSfc) + if (PlcBusiness.readStrPlc(appConfig.LyAddress.收卷2ASFC, (ushort)18).Replace("\0", "").Trim() == bindSfc) return true; } if (position != 4) { - if (PlcBusiness.readStrPlc("D6098", (ushort)18).Replace("\0", "").Trim() == bindSfc) + if (PlcBusiness.readStrPlc(appConfig.LyAddress.收卷2BSFC, (ushort)18).Replace("\0", "").Trim() == bindSfc) return true; } return false; @@ -1229,7 +1189,7 @@ namespace MaterialTraceability.Business.Impl { LogRefreshEvent?.Invoke(LogType.RfidLog, "判断是否为最后一卷料"); //获取放卷位SFC - string upMaterialSfc = PlcBusiness.readStrPlc("D6034", (ushort)18).Replace("\0", "").Trim(); + string upMaterialSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.放卷SFC, (ushort)18).Replace("\0", "").Trim(); try { if (upMaterialSfc != bindSfc) @@ -1295,10 +1255,8 @@ namespace MaterialTraceability.Business.Impl //手动写入清除放卷位报警 if (!auto) { - plcBusiness.writePlc("D6024", 0); - plcBusiness.writePlc("D6025", 0); - //手动写入自动下降U型块 - //plcBusiness.writePlc("D6115", 1); + plcBusiness.writePlc(appConfig.LyAddress.RFID异常, 0); + plcBusiness.writePlc(appConfig.LyAddress.MES异常, 0); } string binSfc = GetBindSfcByMes(epc);//add by liulb 2022-11-09 @@ -1308,22 +1266,9 @@ namespace MaterialTraceability.Business.Impl LogHelper.Info("调用MES首工序获取SFC接口"); LogRefreshEvent?.Invoke(LogType.MesLog, "调用MES首工序获取SFC接口"); LogRefreshEvent?.Invoke(LogType.RfidLog, "调用MES首工序获取SFC接口"); - //upLoadBusiness.SaveLogRecord(position, "调用MES首工序获取SFC接口"); //调MES首工序获取SFC接口 MiFirstOperationForsfcServiceServiceParam miFirstOperationForsfcServiceServiceParam = new MiFirstOperationForsfcServiceServiceParam() { - //url = "http://lymesa.catlbattery.com:8103/atlmeswebservice/MiFirstOperationForsfcServiceService?wsdl", - //site = "2100", - //sfc = "", - //processLot = epc, - //operation = appConfig.operation, - //operationRevision = "#", - //resource = appConfig.resource, - //user = "SUP_LYA_RF01", - //activity = "Z_AUTO_EN530", - //modeProcessSfc = "MODE_RELEASE_START_SFC", - //loginUser = "", - //password = "", url = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "url"), site = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "site"), sfc = "", @@ -1338,7 +1283,6 @@ namespace MaterialTraceability.Business.Impl password = "", }; LogHelper.Info("MES首工序获取SFC接口请求参数:" + JsonChange.ModeToJson(miFirstOperationForsfcServiceServiceParam)); - //upLoadBusiness.SaveLogRecord(position, "MES首工序获取SFC接口请求参数:" + JsonChange.ModeToJson(miFirstOperationForsfcServiceServiceParam)); miFirstOperationForsfcResponse firstOperationForsfcResponse = new miFirstOperationForsfcResponse(); if (appConfig.isMesFlag == 1) { @@ -1348,15 +1292,13 @@ namespace MaterialTraceability.Business.Impl firstOperationForsfcResponse = MesWebServices.iMiFirstOperationForsfcServiceService(miFirstOperationForsfcServiceServiceParam); LogHelper.Info("MES首工序获取SFC接口返回参数:" + JsonChange.ModeToJson(firstOperationForsfcResponse)); - //upLoadBusiness.SaveLogRecord(position, "MES首工序获取SFC接口返回参数:" + JsonChange.ModeToJson(firstOperationForsfcResponse)); //判断返回结果 if (firstOperationForsfcResponse.@return.code > 0) { LogHelper.Info("MES首工序获取SFC接口请求失败:" + firstOperationForsfcResponse.@return.message); - //upLoadBusiness.SaveLogRecord(position, "MES首工序获取SFC接口请求失败:" + firstOperationForsfcResponse.@return.message); - plcBusiness.writePlc("D6014", 1); - plcBusiness.writePlc("D6025", firstOperationForsfcResponse.@return.code); + plcBusiness.writePlc(appConfig.LyAddress.放卷OK, 1); + plcBusiness.writePlc(appConfig.LyAddress.MES异常, firstOperationForsfcResponse.@return.code); LogHelper.Info("MES首工序获取SFC接口调用失败,下发PLC泄气D6014报警D6025信号," + firstOperationForsfcResponse.@return.message); LogRefreshEvent?.Invoke(LogType.RfidLog, "MES首工序获取SFC接口调用失败"); LogRefreshEvent?.Invoke(LogType.MesLog, "MES首工序获取SFC接口调用失败" + upLoadBusiness.GetMesMessage(firstOperationForsfcResponse.@return.code, firstOperationForsfcResponse.@return.message)); @@ -1368,18 +1310,16 @@ namespace MaterialTraceability.Business.Impl qty = firstOperationForsfcResponse.@return.qty; LogRefreshEvent?.Invoke(LogType.RfidLog, String.Format("MES首工序获取SFC接口调用成功,SFC:{0};EA:{1}", sfc, qty)); LogHelper.Info(String.Format("MES首工序获取SFC接口调用成功,SFC:{0};EA:{1}", sfc, qty)); - //upLoadBusiness.SaveLogRecord(position, String.Format("MES首工序获取SFC接口调用成功,SFC:{0};EA:{1}", sfc, qty)); } catch (Exception ex) { LogHelper.Info("调用MES首工序获取SFC接口异常:" + ex.Message); - //upLoadBusiness.SaveLogRecord(position, "调用MES首工序获取SFC接口异常:" + ex.Message); LogRefreshEvent?.Invoke(LogType.AlarmLog, "调用MES首工序获取SFC接口异常:" + ex.Message); LogRefreshEvent?.Invoke(LogType.MesLog, "调用MES首工序获取SFC接口异常:" + ex.Message); WebServiceLog.saveMiFirstOperationForsfcServiceService(miFirstOperationForsfcServiceServiceParam, null , beginTime, ex.Message); - plcBusiness.writePlc("D6025", 1); + plcBusiness.writePlc(appConfig.LyAddress.MES异常, 1); return; } } @@ -1389,12 +1329,10 @@ namespace MaterialTraceability.Business.Impl qty = "2000"; LogRefreshEvent?.Invoke(LogType.RfidLog, String.Format("MES首工序获取SFC接口调用成功,SFC:{0};EA:{1}", sfc, qty)); - //upLoadBusiness.SaveLogRecord(position, String.Format("MES首工序获取SFC接口调用成功,SFC:{0};EA:{1}", sfc, qty)); } //放卷位膜卷号写入PLC地址 - PlcBusiness.writeStrPlc("D6034", sfc); + PlcBusiness.writeStrPlc(appConfig.LyAddress.放卷SFC, sfc); LogRefreshEvent?.Invoke(LogType.PlcLog, "放卷位物料SFC写入PLC地址:" + sfc); - //upLoadBusiness.SaveLogRecord(position, "放卷位物料SFC写入PLC地址:" + sfc); ViewModelRefreshEvent?.Invoke(new ViewModelDto() { @@ -1410,7 +1348,6 @@ namespace MaterialTraceability.Business.Impl //实时绑定卷轴与RFID信息 LogHelper.Info(String.Format("绑定放卷轴与RFID:{0};获取卷轴信息", epc)); - //upLoadBusiness.SaveLogRecord(position, String.Format("绑定放卷轴与RFID:{0};获取卷轴信息", epc)); ProShaftInfo shaftInfo = await this.GetShaftInfoByPosition(position); if (shaftInfo == null || StringExtension.IsBlank(shaftInfo.processId)) @@ -1418,11 +1355,9 @@ namespace MaterialTraceability.Business.Impl LogRefreshEvent?.Invoke(LogType.RfidLog, "绑定卷轴与RFID,获取卷轴信息为空"); LogRefreshEvent?.Invoke(LogType.AlarmLog, "绑定卷轴与RFID,获取卷轴信息为空"); LogHelper.Info("绑定卷轴与RFID,获取卷轴信息为空"); - //upLoadBusiness.SaveLogRecord(position, "绑定卷轴与RFID,获取卷轴信息为空"); return; } LogHelper.Info("获取卷轴信息为:" + JsonChange.ModeToJson(shaftInfo)); - //upLoadBusiness.SaveLogRecord(position, "获取卷轴信息为:" + JsonChange.ModeToJson(shaftInfo)); shaftInfo.bindRfid = epc; shaftInfo.bindSfc = sfc; shaftInfo.bindEaValue = qty; @@ -1451,20 +1386,16 @@ namespace MaterialTraceability.Business.Impl if (JudgementMaterial(sfc)) { LogHelper.Info("上料成功,收卷位SFC与放卷SFC不同触发合卷报警"); - //upLoadBusiness.SaveLogRecord(position, "上料成功,收卷位SFC与放卷SFC不同触发合卷报警"); - //LogRefreshEvent?.Invoke(LogType.AlarmLog, "收卷位SFC与放卷SFC不同触发合卷报警"); - plcBusiness.writePlc("D6114", 1); + plcBusiness.writePlc(appConfig.LyAddress.合卷报警, 1); } LogHelper.Info("冷压放卷流程处理成功,D6014写0"); - //upLoadBusiness.SaveLogRecord(position, "冷压放卷流程处理成功,D6014写0"); - plcBusiness.writePlc("D6014", 0); + plcBusiness.writePlc(appConfig.LyAddress.放卷OK, 0); //手动写入自动下降U型块 - plcBusiness.writePlc("D6115", 1); + plcBusiness.writePlc(appConfig.LyAddress.手动上料, 1); } catch (Exception ex) { LogHelper.Error("放卷涨紧手动写入异常", ex); - //upLoadBusiness.SaveLogRecord(position, "放卷涨紧手动写入异常"+ex.Message); } } @@ -1487,9 +1418,9 @@ namespace MaterialTraceability.Business.Impl //获取正在生产收卷轴绑定的SFC string downSfc = ""; //1A - if (PlcBusiness.readPlc("D6026") == 1) + if (PlcBusiness.readPlc(appConfig.LyAddress.收卷1A状态) == 1) { - downSfc = PlcBusiness.readStrPlc("D6050", (ushort)18).Replace("\0", "").Trim(); + downSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.收卷1ASFC, (ushort)18).Replace("\0", "").Trim(); LogHelper.Info("1A轴在生产,SFC:" + downSfc); if (StringExtension.IsBlank(downSfc)) { @@ -1511,9 +1442,9 @@ namespace MaterialTraceability.Business.Impl } } //1B - if (PlcBusiness.readPlc("D6027") == 1) + if (PlcBusiness.readPlc(appConfig.LyAddress.收卷1B状态) == 1) { - downSfc = PlcBusiness.readStrPlc("D6066", (ushort)18).Replace("\0", "").Trim(); + downSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.收卷1BSFC, (ushort)18).Replace("\0", "").Trim(); LogHelper.Info("1B轴在生产,SFC:" + downSfc); if (StringExtension.IsBlank(downSfc)) { @@ -1535,9 +1466,9 @@ namespace MaterialTraceability.Business.Impl } } //2A - if (PlcBusiness.readPlc("D6028") == 1) + if (PlcBusiness.readPlc(appConfig.LyAddress.收卷2A状态) == 1) { - downSfc = PlcBusiness.readStrPlc("D6082", (ushort)18).Replace("\0", "").Trim(); + downSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.收卷2ASFC, (ushort)18).Replace("\0", "").Trim(); LogHelper.Info("2A轴在生产,SFC:" + downSfc); if (StringExtension.IsBlank(downSfc)) { @@ -1559,9 +1490,9 @@ namespace MaterialTraceability.Business.Impl } } //2B - if (PlcBusiness.readPlc("D6029") == 1) + if (PlcBusiness.readPlc(appConfig.LyAddress.收卷2B状态) == 1) { - downSfc = PlcBusiness.readStrPlc("D6098", (ushort)18).Replace("\0", "").Trim(); + downSfc = PlcBusiness.readStrPlc(appConfig.LyAddress.收卷2BSFC, (ushort)18).Replace("\0", "").Trim(); LogHelper.Info("2B轴在生产,SFC:" + downSfc); if (StringExtension.IsBlank(downSfc)) { @@ -1591,10 +1522,10 @@ namespace MaterialTraceability.Business.Impl /// public void sendSuccessByDownBegin(int position) { - if (position == 1) plcBusiness.writePlc("D6015", 0); - if (position == 2) plcBusiness.writePlc("D6016", 0); - if (position == 3) plcBusiness.writePlc("D6017", 0); - if (position == 4) plcBusiness.writePlc("D6018", 0); + if (position == 1) plcBusiness.writePlc(appConfig.LyAddress.收卷1AOK, 0); + if (position == 2) plcBusiness.writePlc(appConfig.LyAddress.收卷1BOK, 0); + if (position == 3) plcBusiness.writePlc(appConfig.LyAddress.收卷2AOK, 0); + if (position == 4) plcBusiness.writePlc(appConfig.LyAddress.收卷2BOK, 0); } /// @@ -1605,23 +1536,23 @@ namespace MaterialTraceability.Business.Impl { if (position == 1) { - plcBusiness.writePlc("D6020", 0); - plcBusiness.writePlc("D6015", 1); + plcBusiness.writePlc(appConfig.LyAddress.收卷1A控制下料, 0); + plcBusiness.writePlc(appConfig.LyAddress.收卷1AOK, 1); } if (position == 2) { - plcBusiness.writePlc("D6021", 0); - plcBusiness.writePlc("D6016", 1); + plcBusiness.writePlc(appConfig.LyAddress.收卷1B控制下料, 0); + plcBusiness.writePlc(appConfig.LyAddress.收卷1BOK, 1); } if (position == 3) { - plcBusiness.writePlc("D6022", 0); - plcBusiness.writePlc("D6017", 1); + plcBusiness.writePlc(appConfig.LyAddress.收卷2A控制下料, 0); + plcBusiness.writePlc(appConfig.LyAddress.收卷2AOK, 1); } if (position == 4) { - plcBusiness.writePlc("D6023", 0); - plcBusiness.writePlc("D6018", 1); + plcBusiness.writePlc(appConfig.LyAddress.收卷2B控制下料, 0); + plcBusiness.writePlc(appConfig.LyAddress.收卷2BOK, 1); } } @@ -1631,10 +1562,10 @@ namespace MaterialTraceability.Business.Impl /// public void sendError(int position) { - if (position == 1) plcBusiness.writePlc("D6020", 1); - if (position == 2) plcBusiness.writePlc("D6021", 1); - if (position == 3) plcBusiness.writePlc("D6022", 1); - if (position == 4) plcBusiness.writePlc("D6023", 1); + if (position == 1) plcBusiness.writePlc(appConfig.LyAddress.收卷1A控制下料, 1); + if (position == 2) plcBusiness.writePlc(appConfig.LyAddress.收卷1B控制下料, 1); + if (position == 3) plcBusiness.writePlc(appConfig.LyAddress.收卷2A控制下料, 1); + if (position == 4) plcBusiness.writePlc(appConfig.LyAddress.收卷2B控制下料, 1); } /// @@ -1649,18 +1580,18 @@ namespace MaterialTraceability.Business.Impl { if (errorType == 1) //MES异常 { - plcBusiness.writePlc("D6025", mesCode); + plcBusiness.writePlc(appConfig.LyAddress.MES异常, mesCode); } } else { if (errorType == 1) //MES异常 { - plcBusiness.writePlc("D6025", mesCode); + plcBusiness.writePlc(appConfig.LyAddress.MES异常, mesCode); } if (errorType == 2) { - plcBusiness.writePlc("D6024", 1); + plcBusiness.writePlc(appConfig.LyAddress.RFID异常, 1); } } } @@ -1678,8 +1609,6 @@ namespace MaterialTraceability.Business.Impl { ProcessLotServiceWSServiceParam lotServiceWSServiceParam = new ProcessLotServiceWSServiceParam() { - //url = "http://lymesa.catlbattery.com:8103/manufacturing-papiservices/ProcessLotServiceWSService?wsdl", - //site = "2100", url = inifile.IniReadValue("ProcessLotServiceWSServiceParam","url"), site = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "site"), processlotref = "ProcessLotBO:2100," + rfidStr, @@ -1885,26 +1814,26 @@ namespace MaterialTraceability.Business.Impl case 1: LogRefreshEvent?.Invoke(LogType.PlcLog, "1A轴异常下料信号触发,下发下料信号"); LogHelper.Info("1A轴异常下料信号触发,下发下料信号"); - plcBusiness.writePlc("D6020", 0); - plcBusiness.writePlc("D6015", 1); + plcBusiness.writePlc(appConfig.LyAddress.收卷1A控制下料, 0); + plcBusiness.writePlc(appConfig.LyAddress.收卷1AOK, 1); break; case 2: LogRefreshEvent?.Invoke(LogType.PlcLog, "1B轴异常下料信号触发,下发下料信号"); LogHelper.Info("1B轴异常下料信号触发,下发下料信号"); - plcBusiness.writePlc("D6021", 0); - plcBusiness.writePlc("D6016", 1); + plcBusiness.writePlc(appConfig.LyAddress.收卷1B控制下料, 0); + plcBusiness.writePlc(appConfig.LyAddress.收卷1BOK, 1); break; case 3: LogRefreshEvent?.Invoke(LogType.PlcLog, "2A轴异常下料信号触发,下发下料信号"); LogHelper.Info("2A轴异常下料信号触发,下发下料信号"); - plcBusiness.writePlc("D6022", 0); - plcBusiness.writePlc("D6017", 1); + plcBusiness.writePlc(appConfig.LyAddress.收卷2A控制下料, 0); + plcBusiness.writePlc(appConfig.LyAddress.收卷2AOK, 1); break; case 4: LogRefreshEvent?.Invoke(LogType.PlcLog, "2B轴异常下料信号触发,下发下料信号"); LogHelper.Info("2B轴异常下料信号触发,下发下料信号"); - plcBusiness.writePlc("D6023", 0); - plcBusiness.writePlc("D6018", 1); + plcBusiness.writePlc(appConfig.LyAddress.收卷2B控制下料, 0); + plcBusiness.writePlc(appConfig.LyAddress.收卷2BOK, 1); break; default: break; @@ -2123,8 +2052,6 @@ namespace MaterialTraceability.Business.Impl DateTime beginTime = new DateTime(); ProcessLotServiceWSServiceParam processLotServiceWSServiceParam = new ProcessLotServiceWSServiceParam() { - //url = "http://lymesa.catlbattery.com:8103/manufacturing-papiservices/ProcessLotServiceWSService?wsdl", - //site = "2100", url = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "url"), site = inifile.IniReadValue("ProcessLotServiceWSServiceParam", "site"), processlotref = String.Format("ProcessLotBO:2100,{0}", rfidStr) @@ -2174,15 +2101,6 @@ namespace MaterialTraceability.Business.Impl #region 将物料上传到mes中 MachineIntegrationServiceParam machineIntegrationServiceParam = new MachineIntegrationServiceParam() { - //url = "http://lymesa.catlbattery.com:8103/atlmeswebservice/MachineIntegrationServiceService?wsdl", - //site = "2100", - //sfc = x.bindSfc, //将数据上传至拆分后的冷压下料膜卷号 - //operation = appConfig.operation, - //operationRevision = "#", - //activityId = "EAP_WS", - //resource = appConfig.resource, - //dcGroup = upLoadBusiness.GerDcGroupByResource(), - //dcGroupRevision = "#", url = inifile.IniReadValue("MachineIntegrationServiceParam","url"), site = inifile.IniReadValue("MachineIntegrationServiceParam", "site"), sfc = x.bindSfc, //将数据上传至拆分后的冷压下料膜卷号 @@ -2197,16 +2115,13 @@ namespace MaterialTraceability.Business.Impl }; LogHelper.Info("上传MES数据接口请求参数:" + JsonChange.ModeToJson(machineIntegrationServiceParam)); - //upLoadBusiness.SaveLogRecord(StringChange.ParseToInt(x.positionId), "上传MES数据接口请求参数:" + JsonChange.ModeToJson(machineIntegrationServiceParam)); var dataCollectForSfcExResponse = MesWebServices.machineIntegration(machineIntegrationServiceParam); - //upLoadBusiness.SaveLogRecord(StringChange.ParseToInt(x.positionId), "上传MES数据接口返回参数:" + JsonChange.ModeToJson(dataCollectForSfcExResponse)); var result = dataCollectForSfcExResponse.@return; if (result.code > 0) { LogHelper.Info("冷压数据上传MES失败:" + result.message); - //upLoadBusiness.SaveLogRecord(StringChange.ParseToInt(x.positionId), "冷压数据上传MES失败:" + result.message); LogRefreshEvent?.Invoke(LogType.AlarmLog, "冷压数据上传MES失败:" + upLoadBusiness.GetMesMessage(result.code, result.message)); LogRefreshEvent?.Invoke(LogType.MesLog, "冷压数据上传MES失败:" + upLoadBusiness.GetMesMessage(result.code, result.message)); upResult = false; @@ -2215,7 +2130,6 @@ namespace MaterialTraceability.Business.Impl { LogRefreshEvent?.Invoke(LogType.MesLog, "冷压数据上传MES成功"); LogHelper.Info("冷压数据上传MES成功"); - //upLoadBusiness.SaveLogRecord(StringChange.ParseToInt(x.positionId), "冷压数据上传MES成功"); upResult = true; } @@ -2226,7 +2140,6 @@ namespace MaterialTraceability.Business.Impl catch (Exception ex) { LogHelper.Info($"冷压数据异常:{ex.Message}"); - //upLoadBusiness.SaveLogRecord(StringChange.ParseToInt(x.positionId), $"冷压数据异常:{ex.Message}"); return upResult = false; } } @@ -2259,13 +2172,13 @@ namespace MaterialTraceability.Business.Impl #region 横向膜区 //1、判断轴的方向 - LY_FJFX = PlcBusiness.readPlc("D6120") == 0 ? "顺时针" : "逆时针"; + LY_FJFX = PlcBusiness.readPlc(appConfig.LyAddress.放卷方向) == 0 ? "顺时针" : "逆时针"; LogHelper.Info($"放卷轴方向:{LY_FJFX}"); - if (x.positionId == "1" || x.positionId == "2") LY_SJFX = PlcBusiness.readPlc("D6121") == 0 ? "顺时针" : "逆时针"; - if (x.positionId == "3" || x.positionId == "4") LY_SJFX = PlcBusiness.readPlc("D6122") == 0 ? "顺时针" : "逆时针"; - if (x.positionId == "5" || x.positionId == "6") LY_SJFX = PlcBusiness.readPlc("D6123") == 0 ? "顺时针" : "逆时针"; - if (x.positionId == "7" || x.positionId == "8") LY_SJFX = PlcBusiness.readPlc("D6124") == 0 ? "顺时针" : "逆时针"; + if (x.positionId == "1" || x.positionId == "2") LY_SJFX = PlcBusiness.readPlc(appConfig.LyAddress.收卷1A方向) == 0 ? "顺时针" : "逆时针"; + if (x.positionId == "3" || x.positionId == "4") LY_SJFX = PlcBusiness.readPlc(appConfig.LyAddress.收卷1B方向) == 0 ? "顺时针" : "逆时针"; + if (x.positionId == "5" || x.positionId == "6") LY_SJFX = PlcBusiness.readPlc(appConfig.LyAddress.收卷2A方向) == 0 ? "顺时针" : "逆时针"; + if (x.positionId == "7" || x.positionId == "8") LY_SJFX = PlcBusiness.readPlc(appConfig.LyAddress.收卷2B方向) == 0 ? "顺时针" : "逆时针"; LogHelper.Info($"收卷轴方向:{LY_SJFX}"); //2、 根据posttion判断料是左中右那个膜区 string tagAmount = ConfigHelper.GetConfig("tagAmount"); @@ -2344,7 +2257,6 @@ namespace MaterialTraceability.Business.Impl LogHelper.Info(String.Format("涂布来料膜卷号:{0};冷压上料膜卷号:{1};下料拆分膜卷号:{2}", upMaterialSfc, upRecord.Sfc, x.shaftName)); - //upLoadBusiness.SaveLogRecord(StringChange.ParseToInt(x.positionId), String.Format("涂布来料膜卷号:{0};冷压上料膜卷号:{1};下料拆分膜卷号:{2}", upMaterialSfc, upRecord.Sfc, x.shaftName)); #region 注释内容 add 2023-02-25 /* string downSplitSfc = x.bindSfc; var df = downSplitSfc.Substring(downSplitSfc.IndexOf("-") + 1, 2); @@ -2362,7 +2274,6 @@ namespace MaterialTraceability.Business.Impl LY_ZXMQ = upLoadBusiness.GetLengthwaysArea(upMaterialSfc); LogHelper.Info(String.Format("纵向膜区第几轮:{0}", LY_ZXMQ)); - //upLoadBusiness.SaveLogRecord(StringChange.ParseToInt(x.positionId), $"纵向膜区第几轮:{splitAmount}"); #endregion #region 从mes中获取值 @@ -2444,11 +2355,9 @@ namespace MaterialTraceability.Business.Impl try { - //upLoadBusiness.SaveLogRecord(StringChange.ParseToInt(x.positionId), $"调用MES获取涂布数据请求参数:{JsonChange.ModeToJson(tbServiceParam)}"); var tbresult = MesWebServices.findTBData(tbServiceParam); LogHelper.Info($"从mes中获取涂布数据:{JsonChange.ModeToJson(tbresult)}"); - //upLoadBusiness.SaveLogRecord(StringChange.ParseToInt(x.positionId), $"调用MES获取涂布数据返回参数:{JsonChange.ModeToJson(tbresult)}"); foreach (var item in tbresult.paramValues) { if (LY_HXMQ == "左" && LY_ZXMQ == 1) diff --git a/MaterialTraceability.Business/MainBusiness.cs b/MaterialTraceability.Business/MainBusiness.cs index 31ba661..229c740 100644 --- a/MaterialTraceability.Business/MainBusiness.cs +++ b/MaterialTraceability.Business/MainBusiness.cs @@ -256,10 +256,10 @@ namespace MaterialTraceability.Business { try { - plcBusiness.writePlc("D9600", 0); - plcBusiness.writePlc("D9606", 0); - plcBusiness.writePlc("D9620", 0); - plcBusiness.writePlc("D9626", 0); + plcBusiness.writePlc(appConfig.TbAddress.A收卷轴涨紧, 0); + plcBusiness.writePlc(appConfig.TbAddress.A收卷轴完工, 0); + plcBusiness.writePlc(appConfig.TbAddress.B收卷轴涨紧, 0); + plcBusiness.writePlc(appConfig.TbAddress.B收卷轴完工, 0); }catch(Exception ex) { LogHelper.Error("涂布信号清除", ex); diff --git a/MaterialTraceability.Business/MaterialFeatureBusiness.cs b/MaterialTraceability.Business/MaterialFeatureBusiness.cs index 6b4e2d6..ac13b58 100644 --- a/MaterialTraceability.Business/MaterialFeatureBusiness.cs +++ b/MaterialTraceability.Business/MaterialFeatureBusiness.cs @@ -399,13 +399,13 @@ namespace MaterialTraceability.Business #region 横向膜区 //1、判断轴的方向 - LY_FJFX = PlcBusiness.readPlc("D6120") == 0 ? "顺时针" : "逆时针"; + LY_FJFX = PlcBusiness.readPlc(appConfig.LyAddress.放卷方向) == 0 ? "顺时针" : "逆时针"; LogHelper.Info($"放卷轴方向:{LY_FJFX}"); - if (positionId == "1" || positionId == "2") LY_SJFX = PlcBusiness.readPlc("D6121") == 0 ? "顺时针" : "逆时针"; - if (positionId == "3" || positionId == "4") LY_SJFX = PlcBusiness.readPlc("D6122") == 0 ? "顺时针" : "逆时针"; - if (positionId == "5" || positionId == "6") LY_SJFX = PlcBusiness.readPlc("D6123") == 0 ? "顺时针" : "逆时针"; - if (positionId == "7" || positionId == "8") LY_SJFX = PlcBusiness.readPlc("D6124") == 0 ? "顺时针" : "逆时针"; + if (positionId == "1" || positionId == "2") LY_SJFX = PlcBusiness.readPlc(appConfig.LyAddress.收卷1A方向) == 0 ? "顺时针" : "逆时针"; + if (positionId == "3" || positionId == "4") LY_SJFX = PlcBusiness.readPlc(appConfig.LyAddress.收卷1B方向) == 0 ? "顺时针" : "逆时针"; + if (positionId == "5" || positionId == "6") LY_SJFX = PlcBusiness.readPlc(appConfig.LyAddress.收卷2A方向) == 0 ? "顺时针" : "逆时针"; + if (positionId == "7" || positionId == "8") LY_SJFX = PlcBusiness.readPlc(appConfig.LyAddress.收卷2B方向) == 0 ? "顺时针" : "逆时针"; LogHelper.Info($"收卷轴方向:{LY_SJFX}"); //2、 根据posttion判断料是左中右那个膜区 string tagAmount = ConfigHelper.GetConfig("tagAmount"); diff --git a/MaterialTraceability.Business/PlcBusiness.cs b/MaterialTraceability.Business/PlcBusiness.cs index 0d60032..6924e93 100644 --- a/MaterialTraceability.Business/PlcBusiness.cs +++ b/MaterialTraceability.Business/PlcBusiness.cs @@ -284,111 +284,105 @@ namespace MaterialTraceability.Business //冷压工序、赢合厂家 if (processCode.Equals("LY_A")) { - //if (plcInstance.readInt32ByAddress("D6125") == 1) - //{ - // plcInstance.writeInt32ByAddress("D6125", 0); - // SignalRefreshEvent?.Invoke(8, 0); - //} - //放卷 涨紧信号 - if (plcInstance.readInt32ByAddress("D6005") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.放卷涨紧) == 1) { - plcInstance.writeInt32ByAddress("D6005", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.放卷涨紧, 0); SignalRefreshEvent?.Invoke(1, 0); } //放卷结束信号 - if (plcInstance.readInt32ByAddress("D6000") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.放卷结束) == 1) { - plcInstance.writeInt32ByAddress("D6000", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.放卷结束, 0); SignalRefreshEvent?.Invoke(2, 0); } //收卷涨紧信号-1A气胀轴 - if (plcInstance.readInt32ByAddress("D6006") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.收卷1A涨紧) == 1) { - plcInstance.writeInt32ByAddress("D6006", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.收卷1A涨紧, 0); SignalRefreshEvent?.Invoke(3, 1); } //收卷涨紧信号-1B气胀轴 - if (plcInstance.readInt32ByAddress("D6007") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.收卷1B涨紧) == 1) { - plcInstance.writeInt32ByAddress("D6007", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.收卷1B涨紧, 0); SignalRefreshEvent?.Invoke(3, 2); } //收卷涨紧信号-2A气胀轴 - if (plcInstance.readInt32ByAddress("D6008") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.收卷2A涨紧) == 1) { - plcInstance.writeInt32ByAddress("D6008", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.收卷2A涨紧, 0); SignalRefreshEvent?.Invoke(3, 3); } //收卷涨紧信号-2B气胀轴 - if (plcInstance.readInt32ByAddress("D6009") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.收卷2B涨紧) == 1) { - plcInstance.writeInt32ByAddress("D6009", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.收卷2B涨紧, 0); SignalRefreshEvent?.Invoke(3, 4); } //收卷结束信号-1A气胀轴 - if (plcInstance.readInt32ByAddress("D6001") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.收卷1A结束) == 1) { lock (string.Empty) { - plcInstance.writeInt32ByAddress("D6001", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.收卷1A结束, 0); SignalRefreshEvent?.Invoke(4, 1); } } //收卷结束信号-1B气胀轴 - if (plcInstance.readInt32ByAddress("D6002") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.收卷1B结束) == 1) { lock (string.Empty) { - plcInstance.writeInt32ByAddress("D6002", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.收卷1B结束, 0); SignalRefreshEvent?.Invoke(4, 2); } } //收卷结束信号-2A气胀轴 - if (plcInstance.readInt32ByAddress("D6003") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.收卷2A结束) == 1) { lock (string.Empty) { - plcInstance.writeInt32ByAddress("D6003", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.收卷2A结束, 0); SignalRefreshEvent?.Invoke(4, 3); } } //收卷结束信号-2B气胀轴 - if (plcInstance.readInt32ByAddress("D6004") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.收卷2B结束) == 1) { lock (string.Empty) { - plcInstance.writeInt32ByAddress("D6004", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.收卷2B结束, 0); SignalRefreshEvent?.Invoke(4, 4); } } //异常下料-1A - if (plcInstance.readInt32ByAddress("D6116") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.收卷1A异常下料) == 1) { - plcInstance.writeInt32ByAddress("D6116", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.收卷1A异常下料, 0); SignalRefreshEvent?.Invoke(5, 1); } //异常下料-1B - if (plcInstance.readInt32ByAddress("D6117") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.收卷1B异常下料) == 1) { - plcInstance.writeInt32ByAddress("D6117", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.收卷1B异常下料, 0); SignalRefreshEvent?.Invoke(5, 2); } //异常下料-2A - if (plcInstance.readInt32ByAddress("D6118") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.收卷2A异常下料) == 1) { - plcInstance.writeInt32ByAddress("D6118", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.收卷2A异常下料, 0); SignalRefreshEvent?.Invoke(5, 3); } //异常下料-2B - if (plcInstance.readInt32ByAddress("D6119") == 1) + if (plcInstance.readInt32ByAddress(appConfig.LyAddress.收卷2B异常下料) == 1) { - plcInstance.writeInt32ByAddress("D6119", 0); + plcInstance.writeInt32ByAddress(appConfig.LyAddress.收卷2B异常下料, 0); SignalRefreshEvent?.Invoke(5, 4); } } diff --git a/MaterialTraceability.Entity/Config/LyAddress.cs b/MaterialTraceability.Entity/Config/LyAddress.cs new file mode 100644 index 0000000..24a6ae8 --- /dev/null +++ b/MaterialTraceability.Entity/Config/LyAddress.cs @@ -0,0 +1,119 @@ +using MaterialTraceability.Common; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MaterialTraceability.Entity.Config +{ + public sealed class LyAddress + { + private static INIFile iNIFile = new INIFile(System.Environment.CurrentDirectory + "/PlcConfig/App.InI"); + + private static readonly Lazy lazy = new Lazy(() => new LyAddress()); + + public static LyAddress Instance + { + get + { + return lazy.Value; + } + } + + private LyAddress() { } + + public string 放卷涨紧 = iNIFile.IniReadValue("LYPLcAddress", "放卷涨紧"); + + public string 放卷结束 = iNIFile.IniReadValue("LYPLcAddress", "放卷结束"); + + public string 收卷1A涨紧 = iNIFile.IniReadValue("LYPLcAddress", "1A收卷涨紧"); + + public string 收卷1B涨紧 = iNIFile.IniReadValue("LYPLcAddress", "1B收卷涨紧"); + + public string 收卷2A涨紧 = iNIFile.IniReadValue("LYPLcAddress", "2A收卷涨紧"); + + public string 收卷2B涨紧 = iNIFile.IniReadValue("LYPLcAddress", "2B收卷涨紧"); + + public string 收卷1A结束 = iNIFile.IniReadValue("LYPLcAddress", "1A收卷结束"); + + public string 收卷1B结束 = iNIFile.IniReadValue("LYPLcAddress", "1B收卷结束"); + + public string 收卷2A结束 = iNIFile.IniReadValue("LYPLcAddress", "2A收卷结束"); + + public string 收卷2B结束 = iNIFile.IniReadValue("LYPLcAddress", "2B收卷结束"); + + public string 收卷1A异常下料 = iNIFile.IniReadValue("LYPLcAddress", "1A异常下料"); + + public string 收卷1B异常下料 = iNIFile.IniReadValue("LYPLcAddress", "1B异常下料"); + + public string 收卷2A异常下料 = iNIFile.IniReadValue("LYPLcAddress", "2A异常下料"); + + public string 收卷2B异常下料 = iNIFile.IniReadValue("LYPLcAddress", "2B异常下料"); + + public string 放卷SFC = iNIFile.IniReadValue("LYPLcAddress", "放卷SFC"); + + public string 收卷1ASFC = iNIFile.IniReadValue("LYPLcAddress", "1A轴SFC"); + + public string 收卷1BSFC = iNIFile.IniReadValue("LYPLcAddress", "1B轴SFC"); + + public string 收卷2ASFC = iNIFile.IniReadValue("LYPLcAddress", "2A轴SFC"); + + public string 收卷2BSFC = iNIFile.IniReadValue("LYPLcAddress", "2B轴SFC"); + + public string 放卷OK = iNIFile.IniReadValue("LYPLcAddress", "放卷OK"); + + public string 收卷1AOK = iNIFile.IniReadValue("LYPLcAddress", "1A轴OK"); + + public string 收卷1BOK = iNIFile.IniReadValue("LYPLcAddress", "1B轴OK"); + + public string 收卷2AOK = iNIFile.IniReadValue("LYPLcAddress", "2A轴OK"); + + public string 收卷2BOK = iNIFile.IniReadValue("LYPLcAddress", "2B轴OK"); + + public string 放卷控制下料 = iNIFile.IniReadValue("LYPLcAddress", "放卷控制下料"); + + public string 收卷1A控制下料 = iNIFile.IniReadValue("LYPLcAddress", "1A轴控制下料"); + + public string 收卷1B控制下料 = iNIFile.IniReadValue("LYPLcAddress", "1B轴控制下料"); + + public string 收卷2A控制下料 = iNIFile.IniReadValue("LYPLcAddress", "2A轴控制下料"); + + public string 收卷2B控制下料 = iNIFile.IniReadValue("LYPLcAddress", "2B轴控制下料"); + + public string 收卷1AEA = iNIFile.IniReadValue("LYPLcAddress", "1A轴EA"); + + public string 收卷1BEA = iNIFile.IniReadValue("LYPLcAddress", "1B轴EA"); + + public string 收卷2AEA = iNIFile.IniReadValue("LYPLcAddress", "2A轴EA"); + + public string 收卷2BEA = iNIFile.IniReadValue("LYPLcAddress", "2B轴EA"); + + public string 收卷1A状态 = iNIFile.IniReadValue("LYPLcAddress", "1A轴状态"); + + public string 收卷1B状态 = iNIFile.IniReadValue("LYPLcAddress", "1B轴状态"); + + public string 收卷2A状态 = iNIFile.IniReadValue("LYPLcAddress", "2A轴状态"); + + public string 收卷2B状态 = iNIFile.IniReadValue("LYPLcAddress", "2B轴状态"); + + public string RFID异常 = iNIFile.IniReadValue("LYPLcAddress", "RFID异常"); + + public string MES异常 = iNIFile.IniReadValue("LYPLcAddress", "MES异常"); + + public string 合卷报警 = iNIFile.IniReadValue("LYPLcAddress", "合卷报警"); + + public string 手动上料 = iNIFile.IniReadValue("LYPLcAddress", "手动上料"); + + public string 放卷方向 = iNIFile.IniReadValue("LYPLcAddress", "放卷方向"); + + public string 收卷1A方向 = iNIFile.IniReadValue("LYPLcAddress", "1A轴方向"); + + public string 收卷1B方向 = iNIFile.IniReadValue("LYPLcAddress", "1B轴方向"); + + public string 收卷2A方向 = iNIFile.IniReadValue("LYPLcAddress", "2A轴方向"); + + public string 收卷2B方向 = iNIFile.IniReadValue("LYPLcAddress", "2B轴方向"); + + } +} diff --git a/MaterialTraceability.Entity/DTO/AppConfigDto.cs b/MaterialTraceability.Entity/DTO/AppConfigDto.cs index cd3cc1a..7fc5007 100644 --- a/MaterialTraceability.Entity/DTO/AppConfigDto.cs +++ b/MaterialTraceability.Entity/DTO/AppConfigDto.cs @@ -49,5 +49,7 @@ namespace MaterialTraceability.Entity.DTO public string MesWebServiceTimeOut = iNIFile.IniReadValue("SystemConfig", "MesWebServiceTimeOut"); public TbAddress TbAddress = TbAddress.Instance; + + public LyAddress LyAddress = LyAddress.Instance; } } diff --git a/MaterialTraceability.Entity/MaterialTraceability.Entity.csproj b/MaterialTraceability.Entity/MaterialTraceability.Entity.csproj index 333fb0e..7f5d1e7 100644 --- a/MaterialTraceability.Entity/MaterialTraceability.Entity.csproj +++ b/MaterialTraceability.Entity/MaterialTraceability.Entity.csproj @@ -44,6 +44,7 @@ +