|
|
|
@ -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<Func<ProUpRecord, bool>> 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
|
|
|
|
|
/// <param name="splitSfc"></param>
|
|
|
|
|
/// <param name="downRecord"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private async Task<machineIntegrationParametricData[]> GetMaterialWeight(ProShaftInfo shaftInfo, int position, string splitSfc, ProDownRecord downRecord)
|
|
|
|
|
private async Task<machineIntegrationParametricData[]> 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<Func<ProUpRecord, bool>> upExp = s1 => true;
|
|
|
|
@ -2361,7 +2363,7 @@ namespace MaterialTraceability.Business.Impl
|
|
|
|
|
|
|
|
|
|
var lyMaterialCharacter = JsonChange.JsonToMode<TBParametricValueResult>(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
|
|
|
|
|
/// <param name="x"></param>
|
|
|
|
|
/// <param name="bindSfc"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取最后一卷,绑定信息中的endFlag用于存储运行方向,使用ProDownRecord中的shaftNumber存储是否最后一卷
|
|
|
|
|
/// 放卷结束后进行判断
|
|
|
|
|
/// </summary>
|
|
|
|
|
private async void IsEndFlag()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//通过PLC获取收卷轴,设置下轴为最后一卷
|
|
|
|
|
//判断当前收卷生产轴
|
|
|
|
|
List<int> positions = new List<int>();
|
|
|
|
|
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<Func<ProDownRecord, bool>> 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<Func<ProDownRecord, object>> 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|