diff --git a/MaterialTraceability.Business/Impl/LYSignalReadBusiness.cs b/MaterialTraceability.Business/Impl/LYSignalReadBusiness.cs index 5c0a575..7dfc275 100644 --- a/MaterialTraceability.Business/Impl/LYSignalReadBusiness.cs +++ b/MaterialTraceability.Business/Impl/LYSignalReadBusiness.cs @@ -96,14 +96,14 @@ namespace MaterialTraceability.Business.Impl try { #region 未登录不让放卷涨紧生产,便于记录生产者 - if (StringExtension.IsBlank(ConfigHelper.GetConfig("roleId"))) + /*if (StringExtension.IsBlank(ConfigHelper.GetConfig("roleId"))) { MessageBox.Show("请先登录再开始生产"); LogHelper.Info("请先登录再开始生产"); LogRefreshEvent?.Invoke(LogType.AlarmLog, "请先登录再开始生产"); return; - } + }*/ #endregion LogRefreshEvent?.Invoke(LogType.PlcLog, "冷压放卷位涨紧信号触发成功"); diff --git a/MaterialTraceability.Business/Impl/MQSignalReadBusiness.cs b/MaterialTraceability.Business/Impl/MQSignalReadBusiness.cs index 4ada28b..cd9e092 100644 --- a/MaterialTraceability.Business/Impl/MQSignalReadBusiness.cs +++ b/MaterialTraceability.Business/Impl/MQSignalReadBusiness.cs @@ -198,13 +198,13 @@ namespace MaterialTraceability.Business.Impl #endregion #region 未登录不让放卷涨紧生产,便于记录生产者 - if (StringExtension.IsBlank(ConfigHelper.GetConfig("roleId"))) + /*if (StringExtension.IsBlank(ConfigHelper.GetConfig("roleId"))) { MessageBox.Show("请先登录再开始生产"); LogHelper.Info("请先登录再开始生产"); LogRefreshEvent?.Invoke(LogType.AlarmLog, "请先登录再开始生产"); return; - } + }*/ #endregion try @@ -323,7 +323,6 @@ namespace MaterialTraceability.Business.Impl { LogRefreshEvent?.Invoke(LogType.RfidLog, logStr + "位放卷结束,获取卷轴绑定的信息为空"); LogRefreshEvent?.Invoke(LogType.AlarmLog, logStr + "位放卷结束,获取卷轴绑定的信息为空"); - //upLoadBusiness.SaveLogRecord(position, logStr + "位放卷结束,获取卷轴绑定的信息为空"); return; } Expression> upExp = s1 => true; @@ -334,7 +333,6 @@ namespace MaterialTraceability.Business.Impl { LogRefreshEvent?.Invoke(LogType.RfidLog, logStr + "位放卷结束,获取上料信息为空"); LogRefreshEvent?.Invoke(LogType.AlarmLog, logStr + "位放卷结束,获取上料信息为空"); - //upLoadBusiness.SaveLogRecord(position, logStr + "位放卷结束,获取上料信息为空"); return; } @@ -356,7 +354,8 @@ namespace MaterialTraceability.Business.Impl shaftInfo.bindTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); await shaftInfoServices.Update(shaftInfo); LogRefreshEvent?.Invoke(LogType.RfidLog, "放卷结束,更新绑定信息"); - //upLoadBusiness.SaveLogRecord(position, logStr + "放卷结束,更新绑定信息"); + //放卷结束获取收卷轴最后一卷 + IsEndFlag(); } catch (Exception ex) { @@ -707,7 +706,7 @@ namespace MaterialTraceability.Business.Impl //获取重量特征数据上传至服务器 if (upLoadBusiness.JudgeResourceIsUplpadData()) { - machineIntegrationParametricData[] datas = GetMaterialWeight(shaftInfo, position, shaftInfo.bindSfc, downRecord).Result; + machineIntegrationParametricData[] datas = GetMaterialWeight(shaftInfo, position, shaftInfo.bindSfc).Result; UpLoadMaterialWeight(position, shaftInfo.bindSfc, downRecord.Id, datas); } #region 获取放卷物料EA @@ -1343,7 +1342,7 @@ namespace MaterialTraceability.Business.Impl LogHelper.Info("190品种获取重量特征数据"); modeProcessSfc = WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc.MODE_NONE; - datas = GetMaterialWeight(shaftInfo, position, shaftInfo.bindSfc, downRecord).Result; + datas = GetMaterialWeight(shaftInfo, position, shaftInfo.bindSfc).Result; } #endregion miBatchCompleteSfcAndAdujustQtySfcEntity[] miBatchCompleteSfcAndAdujustQtySfcEntities = new miBatchCompleteSfcAndAdujustQtySfcEntity[] @@ -1371,6 +1370,10 @@ namespace MaterialTraceability.Business.Impl modeProcessSfc = modeProcessSfc, sfcList = miBatchCompleteSfcAndAdujustQtySfcEntities, }; + if (StringExtension.IsNotBlank(downRecord.shaftNumber)) + { + requestParam.tailmark = downRecord.shaftNumber; + } LogHelper.Info("MES自动拆分接口请求参数:" + JsonChange.ModeToJson(requestParam)); if (appConfig.isMesFlag == 1) @@ -1408,7 +1411,7 @@ namespace MaterialTraceability.Business.Impl // ccd单独上传数据收集组*Y // UpMQMesData1(position, GetCcdTreetopAmount(position), splitMaterialSfc); - if (UpMQMesData(position, datas, splitMaterialSfc)) + if (UpMQMesData(position, datas, splitMaterialSfc,downRecord)) { LogHelper.Info("模切数据上传成功"); LogRefreshEvent?.Invoke(LogType.MesLog, "模切数据上传成功"); @@ -2319,7 +2322,7 @@ namespace MaterialTraceability.Business.Impl /// /// /// - private async Task GetMaterialWeight(ProShaftInfo shaftInfo, int position, string splitSfc, ProDownRecord downRecord) + private async Task GetMaterialWeight(ProShaftInfo shaftInfo, int position, string splitSfc) { try { @@ -2345,7 +2348,6 @@ namespace MaterialTraceability.Business.Impl bool isFirst = await IsFirstFlag(); LogHelper.Info(String.Format("{0}收卷结束,当前卷放卷方向:{1};收卷方向:{2};是否首检:{3}", logStr, upDirection, downDirection, isFirst)); - //upLoadBusiness.SaveLogRecord(position, String.Format("{0}收卷结束,当前卷放卷方向:{1};收卷方向:{2};是否首检:{3}", logStr, upDirection, downDirection, isFirst)); //根据上料记录获取冷压特征数据 Expression> upExp = s1 => true; @@ -2361,7 +2363,7 @@ namespace MaterialTraceability.Business.Impl var lyMaterialCharacter = JsonChange.JsonToMode(upRecord.UpMaterialId); - LogHelper.Info("获取冷压重量特征数据:" + lyMaterialCharacter); + LogHelper.Info("获取冷压重量特征数据:" + JsonChange.ModeToJson(lyMaterialCharacter)); //upLoadBusiness.SaveLogRecord(position, "获取冷压重量特征数据:" + lyMaterialCharacter); //获取冷压重量特征数据,如果数据库中为空则通过MES重新获取并存入数据库 Add by wenjy 2022-11-15 @@ -2434,7 +2436,7 @@ namespace MaterialTraceability.Business.Impl new machineIntegrationParametricData() {name ="S_CW",dataType=ParameterDataType.TEXT, value=StringExtension.IsBlank(S_CW) ? "0" : S_CW}, new machineIntegrationParametricData() {name ="B_CW",dataType=ParameterDataType.TEXT, value=StringExtension.IsBlank(B_CW) ? "0" : B_CW}, ccdTreetopAmount[0], // ccd打标数 - new machineIntegrationParametricData() {name ="S_TARGETCW",dataType=ParameterDataType.TEXT, value=StringExtension.IsBlank(S_TARGETCW.ToString()) ? "0" : S_TARGETCW.ToString()}, + new machineIntegrationParametricData() {name ="S_TARGETCW",dataType=ParameterDataType.TEXT, value=StringExtension.IsBlank(S_TARGETCW.value) ? "0" : S_TARGETCW.value}, }; LogHelper.Info("GetMaterialWeight获取模切物料特征数据:" + JsonChange.ModeToJson(data)); return data; @@ -2535,7 +2537,7 @@ namespace MaterialTraceability.Business.Impl /// /// /// - private bool UpMQMesData(int position, machineIntegrationParametricData[] data,string splitSfc) + private bool UpMQMesData(int position, machineIntegrationParametricData[] data,string splitSfc,ProDownRecord downRecord) { bool result = false; string logStr = this.Which(position); @@ -2566,6 +2568,7 @@ namespace MaterialTraceability.Business.Impl parametricArray = data, modeProcessSfc = WebService.MachineIntegrationServiceService.ModeProcessSfc.MODE_COMPLETE_SFC_POST_DC }; + LogHelper.Info("上传MES数据接口请求参数:" + JsonChange.ModeToJson(machineIntegrationServiceParam)); //upLoadBusiness.SaveLogRecord(position, "上传MES数据接口请求参数:" + JsonChange.ModeToJson(machineIntegrationServiceParam)); @@ -2794,5 +2797,56 @@ namespace MaterialTraceability.Business.Impl return lyresult; } + + /// + /// 获取最后一卷,绑定信息中的endFlag用于存储运行方向,使用ProDownRecord中的shaftNumber存储是否最后一卷 + /// 放卷结束后进行判断 + /// + private async void IsEndFlag() + { + try + { + //通过PLC获取收卷轴,设置下轴为最后一卷 + //判断当前收卷生产轴 + List positions = new List(); + if (appConfig.machineId == 3) + { + if (PlcBusiness.readPlc("MW24676") == 1) positions.Add(3); + if (PlcBusiness.readPlc("MW24678") == 1) positions.Add(1); + if (PlcBusiness.readPlc("MW24680") == 1) positions.Add(4); + if (PlcBusiness.readPlc("MW24682") == 1) positions.Add(2); + } + else + { + if (PlcBusiness.readPlc("MW24676") == 1) positions.Add(1); + if (PlcBusiness.readPlc("MW24678") == 1) positions.Add(3); + if (PlcBusiness.readPlc("MW24680") == 1) positions.Add(2); + if (PlcBusiness.readPlc("MW24682") == 1) positions.Add(4); + } + int position = positions.Max(); + + ProShaftInfo shaftInfo = await GetShaftInfoByPosition(position); + + Expression> downexp = x => true; + downexp = downexp.And(x => x.PositionId == position && x.IsProduction == 0); + + if (shaftInfo!= null) + { + downexp = downexp.And(x => x.Rfid == shaftInfo.bindRfid); + } + + Expression> orders = x => x.beginTime; + ProDownRecord downRecord = await downRecordServices.QueryFirst(downexp, orders, false); + LogHelper.Info("放卷结束,获取最后一卷收卷轴信息:" + JsonChange.ModeToJson(downRecord)); + if (downRecord != null) + { + downRecord.shaftNumber = "X"; + await downRecordServices.Update(downRecord); + } + }catch(Exception ex) + { + LogHelper.Info("放卷结束,标识最后一卷收卷轴异常:"+ex.Message); + } + } } } diff --git a/MaterialTraceability.Business/Impl/TBSignalReadBusiness.cs b/MaterialTraceability.Business/Impl/TBSignalReadBusiness.cs index 218dcfb..b1bcdb7 100644 --- a/MaterialTraceability.Business/Impl/TBSignalReadBusiness.cs +++ b/MaterialTraceability.Business/Impl/TBSignalReadBusiness.cs @@ -137,13 +137,13 @@ namespace MaterialTraceability.Business.Impl { string logStr = position == 1 ? "A轴" : "B轴"; #region 未登录不让涨紧生产,便于记录生产者 - if (StringExtension.IsBlank(ConfigHelper.GetConfig("roleId"))) + /*if (StringExtension.IsBlank(ConfigHelper.GetConfig("roleId"))) { MessageBox.Show("请先登录再开始生产"); LogHelper.Info("请先登录再开始生产"); LogRefreshEvent?.Invoke(LogType.AlarmLog, "请先登录再开始生产"); return; - } + }*/ #endregion //string sfc = ""; diff --git a/MaterialTraceability.Business/MaterialFeatureBusiness.cs b/MaterialTraceability.Business/MaterialFeatureBusiness.cs index 437e6a4..6e4418a 100644 --- a/MaterialTraceability.Business/MaterialFeatureBusiness.cs +++ b/MaterialTraceability.Business/MaterialFeatureBusiness.cs @@ -172,7 +172,7 @@ namespace MaterialTraceability.Business new machineIntegrationParametricData() {name ="S_CW",dataType=ParameterDataType.TEXT, value=StringExtension.IsBlank(S_CW) ? "0" : S_CW}, new machineIntegrationParametricData() {name ="B_CW",dataType=ParameterDataType.TEXT, value=StringExtension.IsBlank(B_CW) ? "0" : B_CW}, new machineIntegrationParametricData() {name ="CCD",dataType=ParameterDataType.TEXT, value=StringExtension.IsBlank(ccdLableAmount) ? "0" : ccdLableAmount}, - new machineIntegrationParametricData() {name ="S_TARGETCW",dataType=ParameterDataType.TEXT, value=StringExtension.IsBlank(S_TARGETCW.ToString()) ? "0" : S_TARGETCW.ToString()}, + new machineIntegrationParametricData() {name ="S_TARGETCW",dataType=ParameterDataType.TEXT, value=StringExtension.IsBlank(S_TARGETCW.value) ? "0" : S_TARGETCW.value}, }; return data; } diff --git a/MaterialTraceability.WebService/MesWebServicesImpl.cs b/MaterialTraceability.WebService/MesWebServicesImpl.cs index 85b19f8..cebc628 100644 --- a/MaterialTraceability.WebService/MesWebServicesImpl.cs +++ b/MaterialTraceability.WebService/MesWebServicesImpl.cs @@ -72,6 +72,10 @@ namespace MaterialTraceability.WebService MiBatchCompleteSfcAndAdujustQty.MiBatchCompleteSfcAndAdujustQtyRequest.modeProcessSfc = miBatchCompleteSfcAndAdujustQtyServiceServiceParam.modeProcessSfc; MiBatchCompleteSfcAndAdujustQty.MiBatchCompleteSfcAndAdujustQtyRequest.sfcList = miBatchCompleteSfcAndAdujustQtyServiceServiceParam.sfcList; + //MiBatchCompleteSfcAndAdujustQty.MiBatchCompleteSfcAndAdujustQtyRequest.tailmark = miBatchCompleteSfcAndAdujustQtyServiceServiceParam.tailmark; + + + DateTime beginTime = DateTime.Now; MiBatchCompleteSfcAndAdujustQtyResponse MiBatchCompleteSfcAndAdujustQtyResponse = MiBatchCompleteSfcAndAdujustQtyServiceService.MiBatchCompleteSfcAndAdujustQty(MiBatchCompleteSfcAndAdujustQty); @@ -751,7 +755,7 @@ namespace MaterialTraceability.WebService dataCollectForSfcEx.SfcDcExRequest.site = machineIntegrationServiceParam.site; dataCollectForSfcEx.SfcDcExRequest.sfc = machineIntegrationServiceParam.sfc; - dataCollectForSfcEx.SfcDcExRequest.user = machineIntegrationServiceParam.loginUser; + dataCollectForSfcEx.SfcDcExRequest.user = machineIntegrationServiceParam.user; dataCollectForSfcEx.SfcDcExRequest.operation = machineIntegrationServiceParam.operation; dataCollectForSfcEx.SfcDcExRequest.operationRevision = machineIntegrationServiceParam.operationRevision; dataCollectForSfcEx.SfcDcExRequest.activityId = machineIntegrationServiceParam.activityId; diff --git a/MaterialTraceability.WebService/Param/MachineIntegrationServiceParam.cs b/MaterialTraceability.WebService/Param/MachineIntegrationServiceParam.cs index faf8adb..37bba88 100644 --- a/MaterialTraceability.WebService/Param/MachineIntegrationServiceParam.cs +++ b/MaterialTraceability.WebService/Param/MachineIntegrationServiceParam.cs @@ -45,6 +45,7 @@ namespace MaterialTraceability.WebService.Param public ModeProcessSfc modeProcessSfc { get; set; } public machineIntegrationParametricData[] parametricArray { get; set; } + } } diff --git a/MaterialTraceability.WebService/Param/MiBatchCompleteSfcAndAdujustQtyServiceServiceParam.cs b/MaterialTraceability.WebService/Param/MiBatchCompleteSfcAndAdujustQtyServiceServiceParam.cs index d5b5924..1a4d620 100644 --- a/MaterialTraceability.WebService/Param/MiBatchCompleteSfcAndAdujustQtyServiceServiceParam.cs +++ b/MaterialTraceability.WebService/Param/MiBatchCompleteSfcAndAdujustQtyServiceServiceParam.cs @@ -65,5 +65,9 @@ namespace MaterialTraceability.WebService.Param public string password { get; set; } + /// + /// 最后一卷 + /// + public string tailmark { get; set; } } } diff --git a/MaterialTraceabilityUI/ConfigInfo.xaml b/MaterialTraceabilityUI/ConfigInfo.xaml index 7e5385f..ba0a3fa 100644 --- a/MaterialTraceabilityUI/ConfigInfo.xaml +++ b/MaterialTraceabilityUI/ConfigInfo.xaml @@ -58,8 +58,10 @@