diff --git a/MaterialTraceability.Business/EquipBusiness.cs b/MaterialTraceability.Business/EquipBusiness.cs index 994f340..ab7bfde 100644 --- a/MaterialTraceability.Business/EquipBusiness.cs +++ b/MaterialTraceability.Business/EquipBusiness.cs @@ -44,25 +44,39 @@ namespace MaterialTraceability.Business public List gettaglist(string equipid, out ProEquip eq) { - LogHelper.Info("进入gettaglist函数:" + equipid); - List taglist = new List(); - foreach (var equip in _equipList) + try { - if (equip.equipId.ToString() == equipid) + LogHelper.Info("进入gettaglist函数:" + equipid); + List taglist = new List(); + List result = new List(); + foreach (var equip in _equipList) { - taglist = equip.DeviceAdapter.Device_GetTagInfoList(DeviceType.Mesnac_GRUR445, waitTime * 1000); - if (taglist.Count < 1) + if (equip.equipId.ToString() == equipid) { taglist = equip.DeviceAdapter.Device_GetTagInfoList(DeviceType.Mesnac_GRUR445, waitTime * 1000); + if (taglist.Count < 1) + { + taglist = equip.DeviceAdapter.Device_GetTagInfoList(DeviceType.Mesnac_GRUR445, waitTime * 1000); + } + eq = equip; + LogHelper.RfidLog("gettaglist函数结果:" + JsonChange.ModeToJson(taglist)); + #region 读取结果过滤,返回读取次数大于两次的数据 Add By WenJY 2023-05-11 + result = taglist.Where(x => x.Count > 2).ToList(); + LogHelper.Info($"gettaglist函数结果过滤,返回读取次数大于2的数据{JsonChange.ModeToJson(result)}"); + #endregion + return result; } - eq = equip; - LogHelper.RfidLog("gettaglist函数结果:" + JsonChange.ModeToJson(taglist)); - return taglist; } + eq = null; + LogHelper.Info($"gettaglist函数结果:{JsonChange.ModeToJson(taglist)},设备编号{equipid};未匹配到设备信息;"); + return taglist; + } + catch(Exception ex) + { + LogHelper.Info($"gettaglist函数异常:{ex.Message}"); + eq = null; + return null; } - eq = null; - LogHelper.Info("gettaglist函数结果:" + JsonChange.ModeToJson(taglist)); - return taglist; } /// diff --git a/MaterialTraceability.Business/Impl/LYSignalReadBusiness.cs b/MaterialTraceability.Business/Impl/LYSignalReadBusiness.cs index c87deb9..aa27cc3 100644 --- a/MaterialTraceability.Business/Impl/LYSignalReadBusiness.cs +++ b/MaterialTraceability.Business/Impl/LYSignalReadBusiness.cs @@ -637,64 +637,6 @@ namespace MaterialTraceability.Business.Impl } #endregion - #region delete by wenjy 20221103 账比实物多时添加比例判断,如果比例大于指定设置时不进行拆分直接报警下料 - //if (mesEaValue > realEaValue) - //{ - // //计算比例 - // int proportion = Convert.ToInt32(decimal.Parse((((decimal)mesEaValue - (decimal)realEaValue) / (decimal)mesEaValue).ToString("0.00")) * 100); - - // //获取设置比例,读取配置文件中的参数SplitUpProportion - // string SplitUpProportion = GetSysConfigList("SysConfig").Where(s => s.paramKey == "SplitUpProportion").FirstOrDefault().paramValue; - - // if (proportion > StringChange.ParseToInt(SplitUpProportion)) - // { - // LogRefreshEvent?.Invoke(LogType.AlarmLog, String.Format("最后一卷MES账目{0},实物账目{1},数量调整比例{2}%大于设定值{3}%,不进行拆分", mesEaValue, realEaValue, proportion, SplitUpProportion)); - // LogHelper.Info(String.Format("最后一卷MES账目{0},实物账目{1},数量调整比例{2}%大于设定值{3}%,不进行拆分下发下料信号", mesEaValue, realEaValue, proportion, SplitUpProportion)); - // this.sendSuccess(position); - // return; - // } - //} - #endregion - #region 冷压留帐逻辑 add by liuwf - //// 帐比实物多,按照实物拆分 - //if (mesEaValue > realEaValue) - //{ - // LogHelper.Info("完工最后一卷,账目数量:" + mesEaValue + " 大于实物数量:" + realEaValue + ",按照实物拆分,不调整数量"); - // //按照实物拆分,不调整数量 - // if (!SpiltAccount(position, x, realEaValue, upMaterialInfo.bindSfc, upRecord, downRecord).Result) - // { - // LogHelper.Info(logStr + "拆分MES账目数量异常"); - // continue; - // } - // else - // { - // i = i + 1; - // } - //} - //else // 帐比实物少,先按帐拆分,再调整为实物数量 - //{ - // LogHelper.Info("完工最后一卷,账目数量:" + mesEaValue + " 小于实物数量:" + realEaValue + ",先按帐拆分,再调整为实物数量"); - // //拆分 - // if (!SpiltAccount(position, x, mesEaValue, upMaterialInfo.bindSfc, upRecord, downRecord).Result) - // { - // LogHelper.Info(logStr + "拆分MES账目数量异常"); - // continue; - // } - // else - // { - // i = i + 1; - // } - // //获取绑定的SFC - // string bindSfc = GetBindSfcByMes(x.bindRfid); - // //调整数量 - // if (!UpdateMesEaValue(position, bindSfc, x.bindRfid, realEaValue)) - // { - // LogRefreshEvent?.Invoke(LogType.MesLog, bindSfc + "数量调整失败"); - - // } - //} - #endregion - // 最后一卷全部按照账目数量拆分 LogHelper.Info(String.Format("最后一卷MES账目{0},实物账目{1},全部按照账目拆分", mesEaValue, realEaValue)); if (!SpiltAccount(position, x, mesEaValue, upMaterialInfo.bindSfc, upRecord, downRecord).Result) @@ -896,8 +838,6 @@ namespace MaterialTraceability.Business.Impl LogHelper.Info(logStr + "通过MES接口获取放卷物料的EA值"); MiSFCQueryQtyServiceServiceParam sFCQueryQtyServiceServiceParam = new MiSFCQueryQtyServiceServiceParam() { - //url = "http://lymesa.catlbattery.com:8103/atlmeswebservice/MiSFCQueryQtyServiceService?wsdl", - //site = "2100", url = inifile.IniReadValue("MiSFCQueryQtyServiceServiceParam", "url"), site = inifile.IniReadValue("MiSFCQueryQtyServiceServiceParam", "site"), sfc = bindSfc @@ -970,18 +910,6 @@ namespace MaterialTraceability.Business.Impl #endregion MiBatchCompleteSfcAndAdujustQtyServiceServiceParam requestParam = new MiBatchCompleteSfcAndAdujustQtyServiceServiceParam() { - //url = "http://lymesa.catlbattery.com:8103/atlmeswebservice/MiBatchCompleteSfcAndAdujustQtyServiceService?wsdl", - //site = "2100", - //sfcPre = upMaterialSfc, - //processLotPre = "", - //operation = appConfig.operation, //阳极ANCAP1 //阴极CACAP1 - //operationRevision = "A", - //resource = appConfig.resource, - //user = "SUP_LYA_RF01", - //activity = "Z_PR571", - ////modeProcessSfc = WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc.MODE_NONE, - //modeProcessSfc = modeProcessSfc, - //sfcList = miBatchCompleteSfcAndAdujustQtySfcEntities, url = inifile.IniReadValue("SplitSfcParam","url"), site = inifile.IniReadValue("SplitSfcParam", "site"), sfcPre = upMaterialSfc, @@ -2111,6 +2039,7 @@ namespace MaterialTraceability.Business.Impl dcGroup = inifile.IniReadValue("MachineIntegrationServiceParam", "dcGroup"), dcGroupRevision = inifile.IniReadValue("MachineIntegrationServiceParam", "dcGroupRevision"), parametricArray = data, + user = inifile.IniReadValue("MachineIntegrationServiceParam", "user"), modeProcessSfc = WebService.MachineIntegrationServiceService.ModeProcessSfc.MODE_COMPLETE_SFC_POST_DC }; LogHelper.Info("上传MES数据接口请求参数:" + JsonChange.ModeToJson(machineIntegrationServiceParam)); @@ -2168,6 +2097,10 @@ namespace MaterialTraceability.Business.Impl double S_TARGETCW = 0.00; // 单面目标净重 string upMaterialSfc = upRecord.UpMaterialId; + //获取涂布下料EA + //string upMaterialEaValue = GetUpMaterialQty(position,upMaterialInfo.bindSfc, logStr); + + LogHelper.Info($"收卷轴:{LY_SJZ}"); #region 横向膜区 @@ -2257,21 +2190,6 @@ namespace MaterialTraceability.Business.Impl LogHelper.Info(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); - - int recordAmount = StringChange.ParseToInt(df); - - var tag = Convert.ToInt32(ConfigHelper.GetConfig("tagAmount")); - - var splitAmount = Math.Ceiling(Convert.ToDouble(recordAmount) / Convert.ToDouble(tag)); - - LogHelper.Info($"纵向膜区第几轮:{splitAmount}"); - - LY_ZXMQ = Convert.ToInt32(splitAmount); */ - #endregion - LY_ZXMQ = upLoadBusiness.GetLengthwaysArea(upMaterialSfc); LogHelper.Info(String.Format("纵向膜区第几轮:{0}", LY_ZXMQ)); #endregion @@ -2342,10 +2260,6 @@ namespace MaterialTraceability.Business.Impl TBDataServiceParam tbServiceParam = new TBDataServiceParam() { - //url = "http://lymesa.catlbattery.com:8103/atlmeswebservice/GetParametricValueServiceService?wsdl", - //site = "2100", - //sfc = upMaterialSfc, //使用涂布膜卷号获取涂布重量特征数据 - //memberlist = t url = inifile.IniReadValue("TBParametricValueParam","url"), site = inifile.IniReadValue("TBParametricValueParam", "site"), sfc = upMaterialSfc, //使用涂布膜卷号获取涂布重量特征数据 @@ -2366,7 +2280,6 @@ namespace MaterialTraceability.Business.Impl if (item.parameter == "S_EIGENVALUE_1_2") LY_S_X02 = Convert.ToDouble((item.value)); if (item.parameter == "B_EIGENVALUE_1_1") LY_B_X01 = Convert.ToDouble((item.value)); if (item.parameter == "B_EIGENVALUE_1_2") LY_B_X02 = Convert.ToDouble((item.value)); - if (item.parameter == "B_EIGENVALUE_1_2") LY_B_X02 = Convert.ToDouble((item.value)); if (item.parameter == "S_TARGETCW") S_TARGETCW = Convert.ToDouble((item.value)); } @@ -2383,7 +2296,7 @@ namespace MaterialTraceability.Business.Impl if (item.parameter == "S_EIGENVALUE_3_1") LY_S_X01 = Convert.ToDouble((item.value)); if (item.parameter == "S_EIGENVALUE_3_2") LY_S_X02 = Convert.ToDouble((item.value)); if (item.parameter == "B_EIGENVALUE_3_1") LY_B_X01 = Convert.ToDouble((item.value)); - if (item.parameter == "B_EIGENVALUE_2_2") LY_B_X02 = Convert.ToDouble((item.value)); + if (item.parameter == "B_EIGENVALUE_3_2") LY_B_X02 = Convert.ToDouble((item.value)); if (item.parameter == "S_TARGETCW") S_TARGETCW = Convert.ToDouble((item.value)); } if (LY_HXMQ == "左" && LY_ZXMQ != 1) diff --git a/MaterialTraceability.Business/Impl/MQSignalReadBusiness.cs b/MaterialTraceability.Business/Impl/MQSignalReadBusiness.cs index bdfbcb7..885f729 100644 --- a/MaterialTraceability.Business/Impl/MQSignalReadBusiness.cs +++ b/MaterialTraceability.Business/Impl/MQSignalReadBusiness.cs @@ -570,9 +570,19 @@ namespace MaterialTraceability.Business.Impl } } - //收卷结束MES逻辑处理 - DownMaterialEndByMes(position, shaftInfo, qty); - + //增加上下轴拆分防呆,拆分时判断是否下轴,下轴拆分时判断该膜卷号之前拆分数量(下料记录数量)的奇偶数 + //偶数不能拆分,奇数可以拆分 + if(await spiltPreventDaze(position, shaftInfo)) + { + writeError(position, 2); + LogRefreshEvent?.Invoke(LogType.AlarmLog, string.Format("{0}拆分异常,不允许直接拆分下收卷轴",logStr)); + LogRefreshEvent?.Invoke(LogType.RfidLog, string.Format("{0}拆分异常,不允许直接拆分下收卷轴,先拆分上轴再执行下轴拆分", logStr)); + } + else + { + //收卷结束MES逻辑处理 + DownMaterialEndByMes(position, shaftInfo, qty); + } } catch (Exception ex) { @@ -1335,11 +1345,18 @@ namespace MaterialTraceability.Business.Impl //upLoadBusiness.SaveLogRecord(StringChange.ParseToInt(shaftInfo.positionId), "调用MES自动拆分接口"); WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc modeProcessSfc = WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc.MODE_COMPLETE_SFC_POST_DC; machineIntegrationParametricData[] datas = GetCcdTreetopAmount(position); + //所有品种添加CCD打标数上传,过账模式统一改为只拆分不完工 + //2023-03-28 设置打标数配置是否开启上传 + if (appConfig.isUploadFlag) + { + modeProcessSfc = WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc.MODE_NONE; + + } #region 重量特征数据上传 Add By wenjy 2022-12-02 过账模式只拆分不完工 if (upLoadBusiness.JudgeResourceIsUplpadData()) { LogHelper.Info("190品种获取重量特征数据"); - modeProcessSfc = WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc.MODE_NONE; + //modeProcessSfc = WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc.MODE_NONE; datas = GetMaterialWeight(shaftInfo, position, shaftInfo.bindSfc).Result; } @@ -1398,31 +1415,29 @@ namespace MaterialTraceability.Business.Impl LogRefreshEvent?.Invoke(LogType.RfidLog, "MES自动拆分接口调用成功"); //upLoadBusiness.SaveLogRecord(StringChange.ParseToInt(shaftInfo.positionId), "MES自动拆分接口调用成功"); - #region 重量特征数据上传 Add By wenjy 2022-12-02 - if (upLoadBusiness.JudgeResourceIsUplpadData()) + //Add By wenjy 2022-12-02 + //Delete By wenjy 2023-03-24:所有品种添加CCD打标数上传 + //Update By wenjy 2023-03-28 配置文件配置是否开启上传 + #region 重量特征数据上传 + if (appConfig.isUploadFlag) { + //上传重量特征数据、CCD打标数 string splitMaterialSfc = GetSfcByRfid(shaftInfo.bindRfid); downRecord.Sfc = splitMaterialSfc; downRecord.eaValue = qty; downRecord.endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); downRecordServices.Update(downRecord); - // ccd单独上传数据收集组*Y - // UpMQMesData1(position, GetCcdTreetopAmount(position), splitMaterialSfc); - - if (UpMQMesData(position, datas, splitMaterialSfc,downRecord)) + if (UpMQMesData(position, datas, splitMaterialSfc, downRecord)) { LogHelper.Info("模切数据上传成功"); LogRefreshEvent?.Invoke(LogType.MesLog, "模切数据上传成功"); - //upLoadBusiness.SaveLogRecord(position, "模切数据上传成功"); - boolFlag = true; } else { LogHelper.Info("模切数据上传失败"); LogRefreshEvent?.Invoke(LogType.MesLog, "模切数据上传失败"); - //upLoadBusiness.SaveLogRecord(position, "模切数据上传失败"); boolFlag = false; } } @@ -1431,6 +1446,8 @@ namespace MaterialTraceability.Business.Impl boolFlag = true; } #endregion + + } return boolFlag; } @@ -1961,34 +1978,6 @@ namespace MaterialTraceability.Business.Impl } } - /// - /// 放卷位四通道读写器读取 - /// - /// - /// - private string ReadEpcByPosition(int position) - { - List positionList = new List(); - positionList.Add(position); - List positionTag = equipBusiness.ReadEPCByAntanaGroup(positionList); - - string epc = ""; - //add by wenjy 判断读取结果是否为null 20220825 - if (positionTag != null) - { - foreach (var Tag in positionTag) - { - if (Tag.position == position) - { - epc = Tag.EPC; - break; - } - } - } - - return epc; - } - /// /// 放卷位物料是否结束生产 /// @@ -2131,7 +2120,8 @@ namespace MaterialTraceability.Business.Impl } //读取协议更换 List tagInfos = equipBusiness.ReadEpcByProduction(proEquip.equipId); - + LogHelper.Info(String.Format("生产过程中定时读取{0}RFID卷筒标签:{1}", logStr,JsonChange.ModeToJson(tagInfos))); + //存储数据 ProShaftInfo shaftInfo = this.GetShaftInfoByPosition(item).Result; @@ -2141,7 +2131,7 @@ namespace MaterialTraceability.Business.Impl Expression> queryExp = s1 => true; queryExp = queryExp.And(x => x.PositionId == shaftInfo.id.ToString()); List bindInfos = await tagInfoServices.Query(queryExp); - if (bindInfos.Count >= 100) + if (bindInfos.Count >= 12) { if (timer.Enabled) { @@ -2220,23 +2210,25 @@ namespace MaterialTraceability.Business.Impl List tagInfoList = new List(); - if(tagInfos != null) + if (tagInfos != null) { - int tagInfosLength = tagInfos.Count; - for(int i = 0; i < tagInfosLength; i++) + LogHelperBusiness.LogInfo($"生产过程中读取的RFID标签:{JsonChange.ModeToJson(tagInfos)}"); + var info = tagInfos.GroupBy(x => x.Epcstring.Substring(0, x.Epcstring.Length - 2)); + foreach (var item in info) { + var epcStr = item.Key; + var ecpCount = tagInfos.Where(x => x.Epcstring.Contains(epcStr)).Sum(a => Convert.ToInt32(a.Count)); TagInfo tagInfo = new TagInfo() { - Count = StringChange.ParseToInt(tagInfos[i].Count), - RSSI = StringChange.ParseToInt(tagInfos[i].Rssi), - Antana = StringChange.ParseToInt(tagInfos[i].Antana), - PCstring = tagInfos[i].Pcstring, - EPCstring = tagInfos[i].Epcstring + Count = ecpCount, + EPCstring = epcStr + "01" }; tagInfoList.Add(tagInfo); } } + LogHelper.Info($"筛选{logStr}生产过程中读取的RFID标签:{JsonChange.ModeToJson(tagInfoList)}"); + string result = equipBusiness.FilterEpcByProductionEnd(tagInfoList); LogHelper.Info("获取最终RFID条码为:" + result); @@ -2552,17 +2544,6 @@ namespace MaterialTraceability.Business.Impl { MachineIntegrationServiceParam machineIntegrationServiceParam = new MachineIntegrationServiceParam() { - //url = "http://lymesa.catlbattery.com:8103/atlmeswebservice/MachineIntegrationServiceService?wsdl", - //site = "2100", - //sfc = splitSfc, //将数据上传至拆分后的膜卷号 - //operation = appConfig.operation, - //operationRevision = "#", - //activityId = "EAP_WS", - //resource = appConfig.resource, - //dcGroup = upLoadBusiness.GerDcGroupByResource(), - //dcGroupRevision = "#", - //parametricArray = data, - //modeProcessSfc = WebService.MachineIntegrationServiceService.ModeProcessSfc.MODE_COMPLETE_SFC_POST_DC url = inifile.IniReadValue("MachineIntegrationServiceParam","url"), site = inifile.IniReadValue("MachineIntegrationServiceParam", "site"), sfc = splitSfc, //将数据上传至拆分后的膜卷号 @@ -2573,6 +2554,7 @@ namespace MaterialTraceability.Business.Impl dcGroup = inifile.IniReadValue("MachineIntegrationServiceParam", "dcGroup"), dcGroupRevision = inifile.IniReadValue("MachineIntegrationServiceParam", "dcGroupRevision"), parametricArray = data, + user = inifile.IniReadValue("MachineIntegrationServiceParam", "user"), modeProcessSfc = WebService.MachineIntegrationServiceService.ModeProcessSfc.MODE_COMPLETE_SFC_POST_DC }; @@ -2627,7 +2609,7 @@ namespace MaterialTraceability.Business.Impl operationRevision = inifile.IniReadValue("MachineIntegrationServiceParam", "operationRevision"), activityId = inifile.IniReadValue("MachineIntegrationServiceParam", "activityId"), resource = appConfig.resource, - dcGroup = "*Y", + dcGroup = inifile.IniReadValue("MachineIntegrationServiceParam", "dcGroup"), dcGroupRevision = inifile.IniReadValue("MachineIntegrationServiceParam", "dcGroupRevision"), parametricArray = data, modeProcessSfc = WebService.MachineIntegrationServiceService.ModeProcessSfc.MODE_COMPLETE_SFC_POST_DC @@ -2855,5 +2837,38 @@ namespace MaterialTraceability.Business.Impl LogHelper.Info("放卷结束,标识最后一卷收卷轴异常:"+ex.Message); } } + + /// + /// 拆分顺序防呆,增加上下轴拆分防呆,拆分时判断是否下轴,下轴拆分时判断该膜卷号之前拆分数量(下料记录数量)的奇偶数 + /// 偶数不能拆分,奇数可以拆分 + /// Add by wenjy 2023-03-23 + /// + /// + /// + /// true:报警停机 + private async Task spiltPreventDaze(int positionId,ProShaftInfo shaftInfo) + { + //判断卷轴位置,上轴1、3奇数,下轴2、4偶数 + if (positionId % 2 == 0) + { + Expression> exp = s1 => true; + exp = exp.And(x => x.Sfc.Contains(shaftInfo.bindSfc)); + List downRecords = await downRecordServices.Query(exp); + LogHelper.Info(string.Format("PositionId:{0};SFC:{1};下料记录:{2}", positionId, shaftInfo.bindSfc, downRecords.Count)); + if (downRecords.Count % 2 == 0) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + + } } } diff --git a/MaterialTraceability.Common/INIFile.cs b/MaterialTraceability.Common/INIFile.cs index c771ec1..6c1eb76 100644 --- a/MaterialTraceability.Common/INIFile.cs +++ b/MaterialTraceability.Common/INIFile.cs @@ -12,6 +12,7 @@ namespace MaterialTraceability.Common /// public class INIFile { + private string skey = "?S?)??[I"; public string path; public INIFile(string INIPath) @@ -29,6 +30,8 @@ namespace MaterialTraceability.Common [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key, string defVal, Byte[] retVal, int size, string filePath); + [DllImport("kernel32", EntryPoint = "GetPrivateProfileString")] + private static extern uint GetPrivateProfileStringA(string section, string key, string def, Byte[] retVal, int size, string filePath); /// /// 写INI文件 @@ -38,6 +41,11 @@ namespace MaterialTraceability.Common /// public void IniWriteValue(string Section, string Key, string Value) { + + if (Key == "password") + { + Value = MD5Helper.MD5Encrypt(Value, skey); + } WritePrivateProfileString(Section, Key, Value, this.path); } @@ -51,7 +59,14 @@ namespace MaterialTraceability.Common { StringBuilder temp = new StringBuilder(255); int i = GetPrivateProfileString(Section, Key, "", temp, 255, this.path); - return temp.ToString(); + //return temp.ToString(); + + string str = temp.ToString(); + if (Key == "password" && !str.Contains("CA")) + { + str = MD5Helper.MD5Decrypt(str, skey); + } + return str; } public byte[] IniReadValues(string section, string key) { @@ -77,5 +92,25 @@ namespace MaterialTraceability.Common { IniWriteValue(Section, null, null); } + + public List ReadKeys(String SectionName) + { + return ReadKeys(SectionName, this.path); + } + + public List ReadKeys(string SectionName, string iniFilename) + { + List result = new List(); + Byte[] buf = new Byte[65536]; + uint len = GetPrivateProfileStringA(SectionName, null, null, buf, buf.Length, iniFilename); + int j = 0; + for (int i = 0; i < len; i++) + if (buf[i] == 0) + { + result.Add(Encoding.Default.GetString(buf, j, i - j)); + j = i + 1; + } + return result; + } } -} +} \ No newline at end of file diff --git a/MaterialTraceability.Common/LogHelper.cs b/MaterialTraceability.Common/LogHelper.cs index b9d981d..609725c 100644 --- a/MaterialTraceability.Common/LogHelper.cs +++ b/MaterialTraceability.Common/LogHelper.cs @@ -27,7 +27,6 @@ namespace MaterialTraceability.Common /// public static void Info(string msg) { - Console.WriteLine(msg); if (loginfo.IsInfoEnabled) { loginfo.Info(msg); @@ -40,10 +39,10 @@ namespace MaterialTraceability.Common /// public static void PlcLog(string msg) { - if (logPlc.IsInfoEnabled) + /*if (logPlc.IsInfoEnabled) { logPlc.Info(msg); - } + }*/ } /// @@ -52,10 +51,10 @@ namespace MaterialTraceability.Common /// public static void RfidLog(string msg) { - if (logRfid.IsInfoEnabled) + /* if (logRfid.IsInfoEnabled) { logRfid.Info(msg); - } + }*/ } /// @@ -64,10 +63,10 @@ namespace MaterialTraceability.Common /// public static void ViewLog(string msg) { - if (logView.IsInfoEnabled) + /*if (logView.IsInfoEnabled) { logView.Info(msg); - } + }*/ } public static void SqlLog(string msg) @@ -80,10 +79,10 @@ namespace MaterialTraceability.Common public static void SemaphoreLog(string msg) { - if (semaphorelog.IsInfoEnabled) + /*if (semaphorelog.IsInfoEnabled) { semaphorelog.Info(msg); - } + }*/ } /// diff --git a/MaterialTraceability.Entity/DTO/AppConfigDto.cs b/MaterialTraceability.Entity/DTO/AppConfigDto.cs index 79ecba5..6232a70 100644 --- a/MaterialTraceability.Entity/DTO/AppConfigDto.cs +++ b/MaterialTraceability.Entity/DTO/AppConfigDto.cs @@ -48,6 +48,8 @@ namespace MaterialTraceability.Entity.DTO public string MesWebServiceTimeOut = iNIFile.IniReadValue("SystemConfig", "MesWebServiceTimeOut"); + public bool isUploadFlag = iNIFile.IniReadValue("SystemConfig", "ccdUploadIsFlag") == "是" ? true : false; + public TbAddress TbAddress = TbAddress.Instance; public LyAddress LyAddress = LyAddress.Instance; diff --git a/MaterialTraceability.WebService/MesWebServicesImpl.cs b/MaterialTraceability.WebService/MesWebServicesImpl.cs index a465168..140fd4f 100644 --- a/MaterialTraceability.WebService/MesWebServicesImpl.cs +++ b/MaterialTraceability.WebService/MesWebServicesImpl.cs @@ -71,8 +71,7 @@ namespace MaterialTraceability.WebService MiBatchCompleteSfcAndAdujustQty.MiBatchCompleteSfcAndAdujustQtyRequest.activity = miBatchCompleteSfcAndAdujustQtyServiceServiceParam.activity; MiBatchCompleteSfcAndAdujustQty.MiBatchCompleteSfcAndAdujustQtyRequest.modeProcessSfc = miBatchCompleteSfcAndAdujustQtyServiceServiceParam.modeProcessSfc; MiBatchCompleteSfcAndAdujustQty.MiBatchCompleteSfcAndAdujustQtyRequest.sfcList = miBatchCompleteSfcAndAdujustQtyServiceServiceParam.sfcList; - - //MiBatchCompleteSfcAndAdujustQty.MiBatchCompleteSfcAndAdujustQtyRequest.taiMark = miBatchCompleteSfcAndAdujustQtyServiceServiceParam.tailmark; + MiBatchCompleteSfcAndAdujustQty.MiBatchCompleteSfcAndAdujustQtyRequest.tailMark = miBatchCompleteSfcAndAdujustQtyServiceServiceParam.tailmark; DateTime beginTime = DateTime.Now; @@ -102,9 +101,10 @@ namespace MaterialTraceability.WebService LogHelper.Error("mes接口调用异常,", ex); LogHelper.Info("mes接口调用异常:" + ex.Message); MessageBox.Show(" " + ex.Message+" ,请调大mes接口超时时间"); - throw new Exception(" "+ex.Message); - } + + throw new Exception(" " + ex.Message); } + } /// /// 首工序获取SFC接口、自动入账接口、卷绕自动上料接口 diff --git a/MaterialTraceability.WebService/Properties/Settings.Designer.cs b/MaterialTraceability.WebService/Properties/Settings.Designer.cs index 751615e..cf643dc 100644 --- a/MaterialTraceability.WebService/Properties/Settings.Designer.cs +++ b/MaterialTraceability.WebService/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace MaterialTraceability.WebService.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -38,7 +38,7 @@ namespace MaterialTraceability.WebService.Properties { [global::System.Configuration.ApplicationScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] - [global::System.Configuration.DefaultSettingValueAttribute("http://lymesap224.catlbattery.com:50100/atlmeswebservice/MiBatchCompleteSfcAndAdu" + + [global::System.Configuration.DefaultSettingValueAttribute("http://lymesap226.catlbattery.com:50300/atlmeswebservice/MiBatchCompleteSfcAndAdu" + "justQtyServiceService")] public string MaterialTraceability_WebService_MiBatchCompleteSfcAndAdujustQtyServiceService_MiBatchCompleteSfcAndAdujustQtyServiceService { get { diff --git a/MaterialTraceability.WebService/Properties/Settings.settings b/MaterialTraceability.WebService/Properties/Settings.settings index fdded88..5fc7d86 100644 --- a/MaterialTraceability.WebService/Properties/Settings.settings +++ b/MaterialTraceability.WebService/Properties/Settings.settings @@ -6,7 +6,7 @@ http://lymesap227.catlbattery.com:50400/atlmeswebservice/MiSFCQueryQtyServiceService - http://lymesap224.catlbattery.com:50100/atlmeswebservice/MiBatchCompleteSfcAndAdujustQtyServiceService + http://lymesap226.catlbattery.com:50300/atlmeswebservice/MiBatchCompleteSfcAndAdujustQtyServiceService http://lymesap225.catlbattery.com:50200/atlmeswebservice/WarehouseIntegrationServiceService diff --git a/MaterialTraceability.WebService/Web References/MiBatchCompleteSfcAndAdujustQtyServiceService/MiBatchCompleteSfcAndAdujustQtyServiceService.wsdl b/MaterialTraceability.WebService/Web References/MiBatchCompleteSfcAndAdujustQtyServiceService/MiBatchCompleteSfcAndAdujustQtyServiceService.wsdl index 8b62f1d..9509a65 100644 --- a/MaterialTraceability.WebService/Web References/MiBatchCompleteSfcAndAdujustQtyServiceService/MiBatchCompleteSfcAndAdujustQtyServiceService.wsdl +++ b/MaterialTraceability.WebService/Web References/MiBatchCompleteSfcAndAdujustQtyServiceService/MiBatchCompleteSfcAndAdujustQtyServiceService.wsdl @@ -5,7 +5,9 @@ + + @@ -23,6 +25,7 @@ + @@ -42,6 +45,11 @@ + + + + + @@ -84,7 +92,7 @@ -
+
\ No newline at end of file diff --git a/MaterialTraceability.WebService/Web References/MiBatchCompleteSfcAndAdujustQtyServiceService/Reference.cs b/MaterialTraceability.WebService/Web References/MiBatchCompleteSfcAndAdujustQtyServiceService/Reference.cs index 1eb5b65..c2e325e 100644 --- a/MaterialTraceability.WebService/Web References/MiBatchCompleteSfcAndAdujustQtyServiceService/Reference.cs +++ b/MaterialTraceability.WebService/Web References/MiBatchCompleteSfcAndAdujustQtyServiceService/Reference.cs @@ -23,7 +23,7 @@ namespace MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyService /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3190.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Web.Services.WebServiceBindingAttribute(Name="MiBatchCompleteSfcAndAdujustQtyServiceBinding", Namespace="http://machineintegration.ws.atlmes.com/")] @@ -122,7 +122,7 @@ namespace MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyService } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3190.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -144,7 +144,7 @@ namespace MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyService } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3190.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -171,6 +171,8 @@ namespace MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyService private miBatchCompleteSfcAndAdujustQtySfcEntity[] sfcListField; + private string tailMarkField; + /// [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] public string site { @@ -280,10 +282,21 @@ namespace MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyService this.sfcListField = value; } } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string tailMark { + get { + return this.tailMarkField; + } + set { + this.tailMarkField = value; + } + } } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3190.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] [System.SerializableAttribute()] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://machineintegration.ws.atlmes.com/")] public enum ModeProcessSfc { @@ -308,7 +321,7 @@ namespace MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyService } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3190.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -369,7 +382,42 @@ namespace MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyService } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3190.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://machineintegration.ws.atlmes.com/")] + public partial class sfcAndProcessLotEntity { + + private string processLotField; + + private string sfcField; + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string processLot { + get { + return this.processLotField; + } + set { + this.processLotField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string sfc { + get { + return this.sfcField; + } + set { + this.sfcField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -382,9 +430,7 @@ namespace MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyService private string messageField; - private string processLotField; - - private string sfcField; + private sfcAndProcessLotEntity[] entityField; /// [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] @@ -420,30 +466,19 @@ namespace MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyService } /// - [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] - public string processLot { + [System.Xml.Serialization.XmlElementAttribute("entity", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public sfcAndProcessLotEntity[] entity { get { - return this.processLotField; + return this.entityField; } set { - this.processLotField = value; - } - } - - /// - [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] - public string sfc { - get { - return this.sfcField; - } - set { - this.sfcField = value; + this.entityField = value; } } } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3190.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.3761.0")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] @@ -465,11 +500,11 @@ namespace MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyService } /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3190.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] public delegate void MiBatchCompleteSfcAndAdujustQtyCompletedEventHandler(object sender, MiBatchCompleteSfcAndAdujustQtyCompletedEventArgs e); /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3190.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.3761.0")] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] public partial class MiBatchCompleteSfcAndAdujustQtyCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { diff --git a/MaterialTraceability.WebService/WebServiceLog.cs b/MaterialTraceability.WebService/WebServiceLog.cs index 29cc439..0518a3f 100644 --- a/MaterialTraceability.WebService/WebServiceLog.cs +++ b/MaterialTraceability.WebService/WebServiceLog.cs @@ -65,7 +65,8 @@ namespace MaterialTraceability.WebService DataRow dtRow7 = dt.NewRow(); dtRow7[0] = "返回SFC"; - dtRow7[1] =responseParam != null ? responseParam.@return.sfc : ""; + //dtRow7[1] =responseParam != null ? responseParam.@return.sfc : ""; + dtRow7[1] = ""; dt.Rows.Add(dtRow7); DataRow dtRow8 = dt.NewRow(); diff --git a/MaterialTraceability.WebService/app.config b/MaterialTraceability.WebService/app.config index a385de0..51b0f77 100644 --- a/MaterialTraceability.WebService/app.config +++ b/MaterialTraceability.WebService/app.config @@ -13,7 +13,7 @@ - http://lymesap224.catlbattery.com:50100/atlmeswebservice/MiBatchCompleteSfcAndAdujustQtyServiceService + http://lymesap226.catlbattery.com:50300/atlmeswebservice/MiBatchCompleteSfcAndAdujustQtyServiceService diff --git a/MaterialTraceabilityUI/Common/IniFileHelper.cs b/MaterialTraceabilityUI/Common/IniFileHelper.cs index 5455c66..20f466d 100644 --- a/MaterialTraceabilityUI/Common/IniFileHelper.cs +++ b/MaterialTraceabilityUI/Common/IniFileHelper.cs @@ -12,6 +12,7 @@ namespace MaterialTraceabilityUI.Common ///
public class IniFileHelper { + private string skey = "?S?)??[I"; public string path; public IniFileHelper(string INIPath) @@ -40,6 +41,11 @@ namespace MaterialTraceabilityUI.Common /// public void IniWriteValue(string Section, string Key, string Value) { + + if(Key == "password") + { + Value = MD5Helper.MD5Encrypt(Value, skey); + } WritePrivateProfileString(Section, Key, Value, this.path); } @@ -53,7 +59,14 @@ namespace MaterialTraceabilityUI.Common { StringBuilder temp = new StringBuilder(255); int i = GetPrivateProfileString(Section, Key, "", temp, 255, this.path); - return temp.ToString(); + //return temp.ToString(); + + string str = temp.ToString(); + if (Key == "password" && !str.Contains("CA")) + { + str = MD5Helper.MD5Decrypt(str, skey); + } + return str; } public byte[] IniReadValues(string section, string key) { diff --git a/MaterialTraceabilityUI/ConfigInfo.xaml b/MaterialTraceabilityUI/ConfigInfo.xaml index ebd022f..f710a4a 100644 --- a/MaterialTraceabilityUI/ConfigInfo.xaml +++ b/MaterialTraceabilityUI/ConfigInfo.xaml @@ -38,9 +38,11 @@
/// /// - private string GetUpMaterialQty(int position, string bindSfc) + private string GetUpMaterialQty(string bindSfc) { MiSFCQueryQtyServiceServiceParam sFCQueryQtyServiceServiceParam = new MiSFCQueryQtyServiceServiceParam() { @@ -765,6 +856,223 @@ namespace MaterialTraceabilityUI return ""; } } + + /// + /// 注销SFC + /// + /// + /// + private bool SignOffSFCs(string sfcStr) + { + MiSignOffSFCsServiceServiceParam miSignOffSFCsServiceServiceParam = new MiSignOffSFCsServiceServiceParam() + { + + url = inifile.IniReadValue("MiSignOffSFCsServiceServiceParam", "url"), + site = inifile.IniReadValue("MiSignOffSFCsServiceServiceParam", "site"), + user = inifile.IniReadValue("MiSignOffSFCsServiceServiceParam", "user"), + operation = appConfig.operation, + operationRevision = inifile.IniReadValue("MiSignOffSFCsServiceServiceParam", "operationRevision"), + activityId = inifile.IniReadValue("MiSignOffSFCsServiceServiceParam", "activityId"), + Resource = appConfig.resource, + amount = inifile.IniReadValue("MiSignOffSFCsServiceServiceParam", "amount"), + sfcDataArray = null, + sfc = sfcStr, + }; + DateTime beginTime = DateTime.Now; + try + { + + LogHelperBusiness.LogInfo("调用MES注销SFC接口请求参数:" + JsonChange.ModeToJson(miSignOffSFCsServiceServiceParam)); + if (appConfig.isMesFlag == 1) + { + miSignOffSFCsResponse signOffSFCsResponse = MesWebServices.iMiSignOffSFCsServiceService(miSignOffSFCsServiceServiceParam); + LogHelperBusiness.LogInfo("调用MES注销SFC接口返回参数:" + JsonChange.ModeToJson(signOffSFCsResponse)); + if (signOffSFCsResponse == null || signOffSFCsResponse.@return.code > 0) + { + LogHelperBusiness.LogInfo("注销SFC接口调用失败:" + signOffSFCsResponse.@return.message); + MessageBox.Show("注销SFC接口调用失败:" + signOffSFCsResponse.@return.message); + return false; + } + } + } + catch (Exception ex) + { + LogHelperBusiness.LogInfo("注销SFC接口调用异常:" + ex.Message); + MessageBox.Show("注销SFC接口调用异常:" + ex.Message); + return false; + } + return true; + } + + /// + /// 调整SFC MES账目数量 + /// + /// + /// + /// + private bool AdujustQtySfcByMes(string sfcStr, int PLCqty) + { + bool boolFlag = false; + try + { + MiBatchCompleteSfcAndAdujustQtyServiceServiceParam miBatchCompleteSfcAndAdujustQtyServiceServiceParam = new MiBatchCompleteSfcAndAdujustQtyServiceServiceParam() + { + url = inifile.IniReadValue("AdujustQtyParam", "url"), + site = inifile.IniReadValue("AdujustQtyParam", "site"), + sfcPre = sfcStr, + processLotPre = "", + operation = appConfig.operation, + operationRevision = inifile.IniReadValue("AdujustQtyParam", "operationRevision"), + resource = appConfig.resource, + user = inifile.IniReadValue("AdujustQtyParam", "user"), + activity = inifile.IniReadValue("AdujustQtyParam", "activity"), + modeProcessSfc = MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc.MODE_NONE, + sfcList = new miBatchCompleteSfcAndAdujustQtySfcEntity[] + { + new miBatchCompleteSfcAndAdujustQtySfcEntity() + { + processLot = "", + sfc = sfcStr, + qty = PLCqty.ToString(), + unit = "EA" + } + } + + + }; + LogHelperBusiness.LogInfo("MES调整数量接口请求参数:" + JsonChange.ModeToJson(miBatchCompleteSfcAndAdujustQtyServiceServiceParam)); + + if (appConfig.isMesFlag == 1) + { + var requestResult = MesWebServices.iMiBatchCompleteSfcAndAdujustQtyServiceService(miBatchCompleteSfcAndAdujustQtyServiceServiceParam); + LogHelperBusiness.LogInfo("MES调整数量接口返回参数:" + JsonChange.ModeToJson(requestResult)); + + if (requestResult.@return.code > 0) + { + LogHelperBusiness.LogInfo("MES调整数量接口调用失败" + upLoadBusiness.GetMesMessage(requestResult.@return.code, requestResult.@return.message)); + MessageBox.Show("MES调整数量接口调用失败:" + upLoadBusiness.GetMesMessage(requestResult.@return.code, requestResult.@return.message)); + } + else + { + boolFlag = true; + + } + } + } + catch (Exception ex) + { + MessageBox.Show("MES调整数量接口调用异常:" + ex.Message); + } + return boolFlag; + } + + /// + /// 自动入账开始SFC + /// + /// + /// + private bool SFCBegin(string sfcStr) + { + MiFirstOperationForsfcServiceServiceParam miFirstOperationForsfcServiceServiceParam = new MiFirstOperationForsfcServiceServiceParam() + { + + url = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "url"), + site = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "site"), + sfc = sfcStr, + processLot = "", + operation = appConfig.operation, + operationRevision = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "operationRevision"), + resource = appConfig.resource, + user = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "user"), + activity = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "activity"), + modeProcessSfc = inifile.IniReadValue("MiFirstOperationForsfcServiceServiceParam", "modeProcessSfc"), + }; + try + { + LogHelperBusiness.LogInfo("调用A面自动入账接口请求参数:" + JsonChange.ModeToJson(miFirstOperationForsfcServiceServiceParam)); + + if (appConfig.isMesFlag == 1) + { + miFirstOperationForsfcResponse firstOperationForsfcResponse = MesWebServices.iMiFirstOperationForsfcServiceService(miFirstOperationForsfcServiceServiceParam); + LogHelperBusiness.LogInfo("调用A面自动入账接口返回参数:" + JsonChange.ModeToJson(firstOperationForsfcResponse)); + + if (firstOperationForsfcResponse.@return.code > 0) + { + MessageBox.Show("MES自动入账开始接口调用失败:" + firstOperationForsfcResponse.@return.message); + LogHelperBusiness.LogInfo("MES自动入账开始接口调用失败:" + firstOperationForsfcResponse.@return.message); + return false; + } + } + } + catch (Exception ex) + { + MessageBox.Show("调用MES自动入账接口异常:" + ex.Message); + LogHelperBusiness.LogInfo("调用MES自动入账接口异常:" + ex.Message); + return false; + } + return true; + } + + /// + /// 模切最后一卷防呆 + /// + /// + /// + /// + private async Task spiltPreventDaze(int positionId, string bindSfc) + { + //判断卷轴位置,上轴1、3奇数,下轴2、4偶数 + if (positionId % 2 == 0) + { + Expression> exp = s1 => true; + exp = exp.And(x => x.Sfc.Contains(bindSfc)); + List downRecords = await baseServices.Query(exp); + LogHelperBusiness.LogInfo(string.Format("PositionId:{0};SFC:{1};下料记录:{2}", positionId, bindSfc, downRecords.Count)); + if (downRecords.Count % 2 == 0) + { + return true; + } + else + { + return false; + } + } + else + { + return false; + } + + } + + /// + /// 通过数据库获取Tailmark标识 + /// + /// + /// + /// + /// + private async Task GetTailmark(string rfid,int positionId,int is_production) + { + try + { + Expression> exp = s1 => true; + + exp = exp.And(x => x.Rfid == rfid && x.PositionId == positionId && x.IsProduction == is_production); + Expression> order = s1 => s1.RecordTime; + ProDownRecord downRecord = await baseServices.QueryFirst(exp, order, false); + if (downRecord != null) + { + return downRecord.shaftNumber; + } + else + { + return ""; + } + }catch (Exception) + { + return ""; + } + } } } diff --git a/MaterialTraceabilityUI/update/update.xml b/MaterialTraceabilityUI/update/update.xml index 2cf1365..e461b43 100644 --- a/MaterialTraceabilityUI/update/update.xml +++ b/MaterialTraceabilityUI/update/update.xml @@ -1,6 +1,6 @@  - 1.0.4.5 + 1.0.6.5 file://172.21.19.24/temp每天凌晨2点清理/临时文件/BHL/RFID物料追溯系统-现场更新/溧阳五程序/Debug.zip false \ No newline at end of file diff --git a/UnitTestProject/UnitTest1.cs b/UnitTestProject/UnitTest1.cs index dc51f44..2007cdd 100644 --- a/UnitTestProject/UnitTest1.cs +++ b/UnitTestProject/UnitTest1.cs @@ -14,6 +14,7 @@ using System.Linq.Expressions; using MaterialTraceability.Business; using GRreader; using System.Web.Services; +using MaterialTraceability.Entity.UpLoad; namespace UnitTestProject { @@ -29,7 +30,7 @@ namespace UnitTestProject public void TestMesthodl1() { // string binSfc = "L22221110A0160"; LYLAPC022302150114 LYLAPA032302230128 LYLAPA032302230059-06 - string binSfc = "LYLAPA032302230059-06"; + string binSfc = "LYLAPC022303250141"; string LY_SJFX = "逆时针";//收卷轴方向 string LY_FJFX = "逆时针";//放卷轴方向 string LY_HXMQ = "左";//横向膜区方向 @@ -541,55 +542,78 @@ namespace UnitTestProject } } - + private EquipBusiness equipBusiness = new EquipBusiness(); + private IBaseServices tagInfoServices = new BaseServices(); //------------------------------------------------------------------ [TestMethod] public void MQTest1() { - // 测试ccd上传 - machineIntegrationParametricData[] data = { - new machineIntegrationParametricData() {name ="CCD",dataType=ParameterDataType.TEXT, value="1"} - }; - MachineIntegrationServiceParam machineIntegrationServiceParam = new MachineIntegrationServiceParam() - { - url = "http://lymesa.catlbattery.com:8103/atlmeswebservice/MachineIntegrationServiceService?wsdl", - site = "2100", - sfc = "LYLAPC032302240101-05-01", //将数据上传至拆分后的膜卷号 LYLAPA032302240045-02-01 - dcGroup = "*E", - operation = "CAEFS1", - parametricArray = data, - operationRevision = "#", - dcGroupRevision="#", - resource= "FTJIA068", - activityId = "EAP_WS", - }; - LogHelper.Info("上传MES数据接口请求参数:" + JsonChange.ModeToJson(machineIntegrationServiceParam)); - var dataCollectForSfcExResponse = webService.machineIntegration(machineIntegrationServiceParam); - var dataCollectForSfcExResponseResult = dataCollectForSfcExResponse.@return; + test(); + } - if (dataCollectForSfcExResponseResult.code > 0) + private async void test() + { + Expression> exp = s1 => true; + exp = exp.And(x => x.PositionId == "12"); + List tagInfos = await tagInfoServices.Query(exp); + + if (tagInfos == null) { - LogHelper.Info("模切数据上传MES失败:" + dataCollectForSfcExResponseResult.message); + return; } - else - { - LogHelper.Info("模切数据上传MES成功"); + List tagInfoList = new List(); + + if (tagInfos != null) + { + int tagInfosLength = tagInfos.Count; + for (int i = 0; i < tagInfosLength; i++) + { + TagInfo tagInfo = new TagInfo() + { + Count = StringChange.ParseToInt(tagInfos[i].Count), + RSSI = StringChange.ParseToInt(tagInfos[i].Rssi), + Antana = StringChange.ParseToInt(tagInfos[i].Antana), + PCstring = tagInfos[i].Pcstring, + EPCstring = tagInfos[i].Epcstring + }; + tagInfoList.Add(tagInfo); + } } + + string result = equipBusiness.FilterEpcByProductionEnd(tagInfoList); + + LogHelper.Info("获取最终RFID条码为:" + result); } + //----------------------------------------------------------- [TestMethod] public void getLyDataTest() { - GetParametricValueRequestData[] parametricValueRequestDatas = new GetParametricValueRequestData[] { + /*GetParametricValueRequestData[] parametricValueRequestDatas = new GetParametricValueRequestData[] { new GetParametricValueRequestData { parameter= "LY_WLMX" }, new GetParametricValueRequestData { parameter= "LY_S_X01" }, new GetParametricValueRequestData { parameter= "LY_S_X02" }, new GetParametricValueRequestData { parameter= "LY_B_X01" }, new GetParametricValueRequestData { parameter= "LY_B_X02" }, }; - var lyMaterialCharacter = GetLyMaterialCharacter("L32221114A0071-02", parametricValueRequestDatas); //获取冷压特征数据 + var lyMaterialCharacter = GetLyMaterialCharacter("L32221114A0071-02", parametricValueRequestDatas); //获取冷压特征数据*/ + string info = ""; + Dictionary keyValuePairs = new Dictionary(); + for(int i = 0; i < 10; i++) + { + if (i % 2 == 0) + { + info = "偶数"; + } + else + { + info = "奇数"; + } + keyValuePairs.Add(i, info); + } + var result = keyValuePairs; } diff --git a/dll/EntityFramework.dll b/dll/EntityFramework.dll deleted file mode 100644 index 8400163..0000000 Binary files a/dll/EntityFramework.dll and /dev/null differ diff --git a/dll/GRreader.dll b/dll/GRreader.dll deleted file mode 100644 index 70ee539..0000000 Binary files a/dll/GRreader.dll and /dev/null differ diff --git a/dll/HslCommunication.dll b/dll/HslCommunication.dll deleted file mode 100644 index 7082ca2..0000000 Binary files a/dll/HslCommunication.dll and /dev/null differ diff --git a/系统更新日志.xlsx b/系统更新日志.xlsx deleted file mode 100644 index 89d7723..0000000 Binary files a/系统更新日志.xlsx and /dev/null differ