diff --git a/MaterialTraceability.Business/CFliterRFID.cs b/MaterialTraceability.Business/CFliterRFID.cs index 705d6ca..4e32b9b 100644 --- a/MaterialTraceability.Business/CFliterRFID.cs +++ b/MaterialTraceability.Business/CFliterRFID.cs @@ -1,5 +1,6 @@ using GRreader; using MaterialTraceability.Common; +using MaterialTraceability.Entity.DTO; using System; using System.Collections.Generic; using System.Linq; @@ -213,12 +214,21 @@ namespace MaterialTraceability.Business //如果是第一个标签直接添加 if (LTag.Count < 1) { + string epc = ""; + if (AppConfigDto.Instance.processId == "AB") + { + epc = T.EPCstring; + } + else + { + epc = T.EPCstring.Substring(0, T.EPCstring.Length - 2); + } LTag.Add(new FilterRFIDInfo() { //tagInfo = T, TagCount = 1, - TagString = T.EPCstring.Substring(0, T.EPCstring.Length-2), + TagString = epc, TagAllCount=T.Count, MaxRSSI=T.RSSI }); @@ -226,9 +236,19 @@ namespace MaterialTraceability.Business } //判断是否和当前标签相同 bool newflag = true; + foreach (var newtag in LTag) { - string epc = T.EPCstring.Substring(0, T.EPCstring.Length - 2); + string epc = ""; + if (AppConfigDto.Instance.processId == "AB") + { + epc = T.EPCstring; + + } + else + { + epc = T.EPCstring.Substring(0, T.EPCstring.Length - 2); + } if (epc == newtag.TagString) { newtag.TagCount++; diff --git a/MaterialTraceability.Business/Impl/ABSignalReadBusiness.cs b/MaterialTraceability.Business/Impl/ABSignalReadBusiness.cs index ba9cf46..c1eb99d 100644 --- a/MaterialTraceability.Business/Impl/ABSignalReadBusiness.cs +++ b/MaterialTraceability.Business/Impl/ABSignalReadBusiness.cs @@ -13,6 +13,7 @@ using MaterialTraceability.WebService.MiFirstOperationForsfcServiceService; using MaterialTraceability.WebService.MiReleaseSfcWithActivityServiceService; using MaterialTraceability.WebService.Param; using MaterialTraceability.WebService.ProcessLotServiceWSService; +using MySqlX.XDevAPI.Common; using System; using System.Collections.Generic; using System.Linq; @@ -129,15 +130,14 @@ namespace MaterialTraceability.Business.Impl //{ // Random random = new Random(); - // epc = "JSLY4RDA0000" + random.Next(10, 99); + // //epc = "JSLY4RDA0000" + random.Next(10, 99); + // epc = "BACC02117424112290871"; //} //SaveReadRecord(proEquip, epc); if (StringExtension.IsBlank(epc)) { sendError(position, 2, false, 1); plcBusiness.writePlc(appConfig.AbAddress.放卷气胀轴泄气, 1); - - //plcBusiness.writePlc(appConfig.AbAddress.RFID异常, 1); LogHelper.Info("放卷位RFID条码信息读取失败,下发PLC报警D6024写1"); LogRefreshEvent?.Invoke(LogType.AlarmLog, "放卷位RFID条码信息读取失败"); @@ -154,6 +154,27 @@ namespace MaterialTraceability.Business.Impl }); return; } + if (epc.Length != 30) + { + sendError(position, 2, false, 1); + plcBusiness.writePlc(appConfig.AbAddress.放卷气胀轴泄气, 1); + //plcBusiness.writePlc(appConfig.AbAddress.RFID异常, 1); + LogHelper.Info("放卷位RFID条码信息读取失败,下发PLC报警D6024写1"); + LogRefreshEvent?.Invoke(LogType.AlarmLog, "放卷位RFID条码信息读取失败"); + ViewModelRefreshEvent?.Invoke(new ViewModelDto() + { + rfidInfo = new RfidInfoDto() + { + rfid = "", + sfc = "", + ea = "", + position = position, + }, + plcStatus = true, + }); + return; + } + epc = epc.Substring(9, epc.Length-9); LogHelper.Info(String.Format("放卷位RFID条码信息读取成功:{0}", epc)); LogRefreshEvent?.Invoke(LogType.RfidLog, String.Format("放卷位RFID条码信息读取成功,RFID为{0}", epc)); //判断RFID标签是否重复 @@ -290,14 +311,13 @@ namespace MaterialTraceability.Business.Impl } string epc = equipBusiness.ReadEPCByAntana(proEquip.equipId); epc = epc.Replace("\0", "").Trim(); - //add by CaesarBao 这里需要截取标签 - if (epc == "" || epc == null) - { - Random random = new Random(); + //if (epc == "" || epc == null) + //{ + // Random random = new Random(); - epc = "JSLY4RDA0000" + random.Next(10, 99); - } + // epc = "JSLY4RDA0000" + random.Next(10, 99); + //} if (StringExtension.IsBlank(epc)) { plcBusiness.writePlc(appConfig.AbAddress.收卷气胀轴泄气, 1); @@ -316,7 +336,10 @@ namespace MaterialTraceability.Business.Impl }, plcStatus = true, }); + return; } + epc = epc.Substring(0, 9); + LogHelper.Info("收卷位设备:" + proEquip.equipIp + "涨紧信号读取成功:" + epc); LogRefreshEvent?.Invoke(LogType.RfidLog,"收卷RFID条码信息读取成功:" + epc); @@ -598,15 +621,15 @@ namespace MaterialTraceability.Business.Impl WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc modeProcessSfc = WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc.MODE_COMPLETE_SFC_POST_DC; MiBatchCompleteSfcAndAdujustQtyServiceServiceParam requestParam = new MiBatchCompleteSfcAndAdujustQtyServiceServiceParam() { - url = inifile.IniReadValue("SplitSfcParam","url"), - site = inifile.IniReadValue("SplitSfcParam", "site"), + url = inifile.IniReadValue("AdujustQtyParam", "url"), + site = inifile.IniReadValue("AdujustQtyParam", "site"), sfcPre = upMaterialSfc, processLotPre = "", operation = appConfig.operation, //阳极ANCAP1 //阴极CACAP1 - operationRevision = inifile.IniReadValue("SplitSfcParam", "operationRevision"), + operationRevision = inifile.IniReadValue("AdujustQtyParam", "operationRevision"), resource = appConfig.resource, - user = inifile.IniReadValue("SplitSfcParam", "user"), - activity = inifile.IniReadValue("SplitSfcParam", "activity"), + user = inifile.IniReadValue("AdujustQtyParam", "user"), + activity = inifile.IniReadValue("AdujustQtyParam", "activity"), //modeProcessSfc = WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc.MODE_NONE, modeProcessSfc = modeProcessSfc, sfcList = miBatchCompleteSfcAndAdujustQtySfcEntities, @@ -619,7 +642,7 @@ namespace MaterialTraceability.Business.Impl LogHelper.Info("MES自动完工接口请求参数:" + JsonChange.ModeToJson(requestParam)); if (appConfig.isMesFlag == 1) { - if (StringExtension.IsBlank(downRecord.Sfc)) + if (!StringExtension.IsBlank(downRecord.Sfc)) { batchCompleteSfcAndAdujustQtyResponse = MesWebServices.iMiBatchCompleteSfcAndAdujustQtyServiceService(requestParam); LogHelper.Info("MES自动完工接口返回参数:" + JsonChange.ModeToJson(batchCompleteSfcAndAdujustQtyResponse)); @@ -634,6 +657,15 @@ namespace MaterialTraceability.Business.Impl return false; } } + else + { + + LogHelper.Info("MES自动完工接口调用失败:收卷SFC为空"); + LogRefreshEvent?.Invoke(LogType.AlarmLog, "MES自动完工接口调用失败:收卷SFC为空"); + LogRefreshEvent?.Invoke(LogType.MesLog, "MES自动完工接口调用失败:收卷SFC为空"); + plcBusiness.writePlc(appConfig.AbAddress.MES异常, 1); + return false; + } LogHelper.Info("MES自动完工接口调用成功"); LogRefreshEvent?.Invoke(LogType.RfidLog, "MES自动完工接口调用成功"); @@ -833,7 +865,7 @@ namespace MaterialTraceability.Business.Impl plcBusiness.writePlc(appConfig.AbAddress.MES异常, 1); //写入转塔是否可以旋转 //plcBusiness.writePlc(appConfig.AbAddress.是否转塔, 0); - LogHelper.Info("凹版工单下达接口获取失败:" + releaseSfcWithActivityResponse.@return.message + ",下发气胀轴泄气D9608,下发MES接口返回异常报警D9612"); + LogHelper.Info("凹版工单下达接口获取失败:" + releaseSfcWithActivityResponse.@return.message + ",下发气胀轴泄气,下发MES接口返回异常报警"); return ""; } @@ -895,21 +927,67 @@ namespace MaterialTraceability.Business.Impl LogHelper.Info("调用MES凹版自动上料接口"); LogRefreshEvent?.Invoke(LogType.MesLog, "调用MES凹版自动上料接口"); LogRefreshEvent?.Invoke(LogType.RfidLog, "调用MES凹版自动上料接口"); - - - - LogHelper.Info("调用MES首工序获取SFC接口"); - LogRefreshEvent?.Invoke(LogType.MesLog, "调用MES首工序获取SFC接口"); - LogRefreshEvent?.Invoke(LogType.RfidLog, "调用MES首工序获取SFC接口"); - sfc = GetSFC(position); - if (StringExtension.IsBlank(sfc)) + ResourceSlotConfigurationSetupForJITServiceParam resourceSlotConfigurationSetupForJITServiceParam = new ResourceSlotConfigurationSetupForJITServiceParam + { + url = inifile.IniReadValue("ResourceSlotConfigurationSetupForJITServiceParam", "url"), + site = inifile.IniReadValue("ResourceSlotConfigurationSetupForJITServiceParam", "site"), + resource = inifile.IniReadValue("ResourceSlotConfigurationSetupForJITServiceParam", "resource"), + operation = inifile.IniReadValue("ResourceSlotConfigurationSetupForJITServiceParam", "operation"), + barcodeId = epc, + barcodeType = inifile.IniReadValue("ResourceSlotConfigurationSetupForJITServiceParam", "barcodeType"), + activityId = inifile.IniReadValue("ResourceSlotConfigurationSetupForJITServiceParam", "activityId"), + mountingPoint = inifile.IniReadValue("ResourceSlotConfigurationSetupForJITServiceParam", "mountingPoint"), + loginUser = "", + password = "", + }; + LogHelper.Info("调用MES凹版自动上料接口请求参数:" + JsonChange.ModeToJson(resourceSlotConfigurationSetupForJITServiceParam)); + try { + var response = MesWebServices.resourceSlotConfigurationSetupForJITService(resourceSlotConfigurationSetupForJITServiceParam); + if (int.Parse(response.@return.code) > 0) + { + LogRefreshEvent?.Invoke(LogType.MesLog, "调用MES凹版自动上料接口失败:" + int.Parse(response.@return.code) + response.@return.message); + LogRefreshEvent?.Invoke(LogType.AlarmLog, "调用MES凹版自动上料接口失败:" + int.Parse(response.@return.code) + response.@return.message); + if (position == 0) + { + plcBusiness.writePlc(appConfig.AbAddress.放卷气胀轴泄气, 1); + } + //写入报警 + plcBusiness.writePlc(appConfig.AbAddress.MES异常, 1); + LogHelper.Info("调用MES凹版自动上料接口失败:" + response.@return.message + ",下发气胀轴泄气,下发MES接口返回异常报警"); + return; + } + } + catch (Exception ex) + { + + LogRefreshEvent?.Invoke(LogType.MesLog, "调用MES凹版自动上料接口异常:" + ex.Message); + LogRefreshEvent?.Invoke(LogType.AlarmLog, "调用MES凹版自动上料接口异常:" + ex.Message); + + if (position == 0) + { + plcBusiness.writePlc(appConfig.AbAddress.放卷气胀轴泄气, 1); + } + //写入报警 + plcBusiness.writePlc(appConfig.AbAddress.MES异常, 1); + LogHelper.Info("调用MES凹版自动上料接口异常:" + ex.Message + ",下发气胀轴泄气,下发MES接口返回异常报警"); return; } + + + + //LogHelper.Info("调用MES首工序获取SFC接口"); + //LogRefreshEvent?.Invoke(LogType.MesLog, "调用MES首工序获取SFC接口"); + //LogRefreshEvent?.Invoke(LogType.RfidLog, "调用MES首工序获取SFC接口"); + //sfc = GetSFC(position); + //if (StringExtension.IsBlank(sfc)) + //{ + // return; + //} //放卷位膜卷号写入PLC地址 WriteSfcAndEpc(position, sfc,epc); - LogRefreshEvent?.Invoke(LogType.PlcLog, "放卷位物料SFC写入PLC地址:" + sfc); + //LogRefreshEvent?.Invoke(LogType.PlcLog, "放卷位物料SFC写入PLC地址:" + sfc); ViewModelRefreshEvent?.Invoke(new ViewModelDto() { @@ -1208,8 +1286,8 @@ namespace MaterialTraceability.Business.Impl LogRefreshEvent?.Invoke(LogType.PlcLog, logStr + "收卷开始信号触发成功"); LogRefreshEvent?.Invoke(LogType.RfidLog, logStr + "解绑RFID绑定的SFC条码"); //获取RFID条码信息 - ProShaftInfo shaftInfo = this.GetShaftInfoByPosition(position).Result; - this.UnBindRfidAndSfc(shaftInfo.bindRfid); + //ProShaftInfo shaftInfo = this.GetShaftInfoByPosition(position).Result; + //this.UnBindRfidAndSfc(shaftInfo.bindRfid); } catch (Exception ex) { @@ -1380,3 +1458,22 @@ namespace MaterialTraceability.Business.Impl } } + +/* + #凹版上料 +[ResourceSlotConfigurationSetupForJITServiceParam] +url=http://lymesa.catlbattery.com:8103/atlmeswebservice/ResourceSlotConfigurationSetupForJITServiceService?wsdl +site=2100 +resource=GRAVA015 +operation=ANGRC1 +barcodeType = INVENTORY_ID +activityId = Z_AUTO_EN530 +mountingPoint = S10L + +user=SUP_LYA_RF01 +loginUser=SUP_LYA_RF01 +password=4BD591363E7AA065FD4D5E077CDB0C94 + + + + */ diff --git a/MaterialTraceability.Business/Impl/TBSignalReadBusiness.cs b/MaterialTraceability.Business/Impl/TBSignalReadBusiness.cs index 87678dd..8a5967d 100644 --- a/MaterialTraceability.Business/Impl/TBSignalReadBusiness.cs +++ b/MaterialTraceability.Business/Impl/TBSignalReadBusiness.cs @@ -122,14 +122,15 @@ namespace MaterialTraceability.Business.Impl LogRefreshEvent?.Invoke(LogType.AlarmLog, $"获取{logStr}读写器设备信息异常"); return; } - string epc = equipBusiness.ReadEPCByAntana(proEquip.equipId); + string epc = equipBusiness.ReadEPCByAntana(proEquip.equipId); // "JSLY5RSD20241216";// equipBusiness.ReadEPCByAntana(proEquip.equipId); + epc = epc.Replace("\0", "").Trim(); SaveReadRecord(proEquip, epc); if (StringExtension.IsBlank(epc)) { plcBusiness.writePlc(appConfig.TbAddress.放卷气胀泄气, 1); - plcBusiness.writePlc(position == 3 ? appConfig.TbAddress.放卷RFID异常 : appConfig.TbAddress.放卷RFID异常, 1); + plcBusiness.writePlc(appConfig.TbAddress.放卷RFID异常, 1); LogHelper.Info($"{logStr}RFID条码信息读取失败,下发PLC报警"); LogRefreshEvent?.Invoke(LogType.AlarmLog, $"{logStr}RFID条码信息读取失败"); ViewModelRefreshEvent?.Invoke(new ViewModelDto() @@ -145,10 +146,13 @@ namespace MaterialTraceability.Business.Impl }); return; } + epc = epc.Substring(0, 9); LogHelper.Info($"{logStr}RFID条码信息读取成功:{epc}"); LogRefreshEvent?.Invoke(LogType.RfidLog, $"{logStr}RFID条码信息读取成功,RFID为{epc}"); //判断RFID标签是否重复 LogHelper.Info($"{logStr}判断RFID标签是否重复"); + PlcBusiness.writeStrPlc(position == 3 ? appConfig.TbAddress.A放卷RFID : appConfig.TbAddress.B放卷RFID, epc); + if (BusinessHelper.UpRfidIsRecur(epc, position).Result) { @@ -182,7 +186,7 @@ namespace MaterialTraceability.Business.Impl LogHelper.Info($"{logStr}RFID读取到的条码:{epc};与前一读取相同并且生产未结束,可以继续生产"); LogRefreshEvent?.Invoke(LogType.RfidLog, $"{logStr}RFID读取到的条码:{epc};与前一读取相同并且生产未结束,可以继续生产"); LogHelper.Info("冷压放卷流程处理成功"); - //plcBusiness.writePlc(appConfig.LyAddress.放卷OK, 0); + plcBusiness.writePlc(appConfig.TbAddress.放卷是否转塔, 1); return; } } @@ -203,7 +207,7 @@ namespace MaterialTraceability.Business.Impl catch (Exception ex) { LogHelper.Info($"{logStr}放卷涨紧流程RFID逻辑处理异常:{ex.Message}"); - plcBusiness.writePlc(position == 3 ? appConfig.TbAddress.放卷RFID异常 : appConfig.TbAddress.放卷RFID异常, 1); + plcBusiness.writePlc( appConfig.TbAddress.放卷RFID异常, 1); } } @@ -236,6 +240,7 @@ namespace MaterialTraceability.Business.Impl return; } + //更新放卷信息 upRecord.endTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); upRecord.IsProduction = 1; @@ -291,8 +296,8 @@ namespace MaterialTraceability.Business.Impl { if (!auto) { - plcBusiness.writePlc(position == 3 ? appConfig.TbAddress.放卷RFID异常 : appConfig.TbAddress.放卷RFID异常, 0); - plcBusiness.writePlc(position == 3 ? appConfig.TbAddress.放卷MES异常 : appConfig.TbAddress.放卷MES异常, 0); + plcBusiness.writePlc(appConfig.TbAddress.放卷RFID异常, 0); + plcBusiness.writePlc(appConfig.TbAddress.放卷MES异常, 0); } #region 这里进行MES操作 @@ -361,7 +366,7 @@ namespace MaterialTraceability.Business.Impl { sfc = System.Guid.NewGuid().ToString("N").Substring(0, 14); qty = "2000"; - LogRefreshEvent?.Invoke(LogType.RfidLog, String.Format("MES首工序获取SFC接口调用成功,SFC:{0};EA:{1}", sfc, qty)); + LogRefreshEvent?.Invoke(LogType.RfidLog, String.Format("MES首工序----------------------------------获取SFC接口调用成功,SFC:{0};EA:{1}", sfc, qty)); } #endregion @@ -398,6 +403,7 @@ namespace MaterialTraceability.Business.Impl shaftInfo.bindTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); await shaftInfoServices.Update(shaftInfo); + //本地保存SFC,上料记录 ProUpRecord upRecord = new ProUpRecord() { @@ -415,13 +421,14 @@ namespace MaterialTraceability.Business.Impl upLoadBusiness.SaveUpRecord(upRecord); + plcBusiness.writePlc(appConfig.TbAddress.放卷是否转塔, 1); + LogHelper.Info($"{logStr}放卷流程处理成功"); - plcBusiness.writePlc(position == 3 ? appConfig.TbAddress.A放卷OK : appConfig.TbAddress.B放卷OK, 1); } catch (Exception ex) { LogHelper.Info($"{logStr}放卷流程MES逻辑处理异常:{ex.Message}"); - plcBusiness.writePlc(position == 3 ? appConfig.TbAddress.放卷RFID异常 : appConfig.TbAddress.放卷RFID异常, 1); + plcBusiness.writePlc(appConfig.TbAddress.放卷RFID异常, 1); } } diff --git a/MaterialTraceability.Business/PlcBusiness.cs b/MaterialTraceability.Business/PlcBusiness.cs index cbb6838..f6d06a9 100644 --- a/MaterialTraceability.Business/PlcBusiness.cs +++ b/MaterialTraceability.Business/PlcBusiness.cs @@ -259,30 +259,30 @@ namespace MaterialTraceability.Business } // A放卷开始 A轴position设为3 - if (plcInstance.readInt32ByAddress(appConfig.TbAddress.A放卷开始) == 1) + if (plcInstance.readInt32ByAddress(appConfig.TbAddress.放卷开始) == 1) { - LogHelper.PlcLog("B放卷开始"); - plcInstance.writeInt32ByAddress(appConfig.TbAddress.A放卷开始, 0); + LogHelper.PlcLog("A放卷开始"); + plcInstance.writeInt32ByAddress(appConfig.TbAddress.放卷开始, 0); SignalRefreshEvent?.Invoke(6, 3); } // B放卷开始 B轴position设为4 - if (plcInstance.readInt32ByAddress(appConfig.TbAddress.B放卷开始) == 1) + if (plcInstance.readInt32ByAddress(appConfig.TbAddress.放卷开始) == 2) { LogHelper.PlcLog("B放卷开始"); - plcInstance.writeInt32ByAddress(appConfig.TbAddress.B放卷开始, 0); + plcInstance.writeInt32ByAddress(appConfig.TbAddress.放卷开始, 0); SignalRefreshEvent?.Invoke(6, 4); } // A放卷结束 A轴position设为3 if (plcInstance.readInt32ByAddress(appConfig.TbAddress.A放卷结束) == 1) { - LogHelper.PlcLog("B放卷结束"); + LogHelper.PlcLog("A放卷结束"); plcInstance.writeInt32ByAddress(appConfig.TbAddress.A放卷结束, 0); SignalRefreshEvent?.Invoke(2, 3); } - // B放卷结束 B轴position设为4 + // B放卷结束 B轴position设为4` ` ```` if (plcInstance.readInt32ByAddress(appConfig.TbAddress.B放卷结束) == 1) { LogHelper.PlcLog("B放卷结束"); diff --git a/MaterialTraceability.Business/UpLoadBusiness.cs b/MaterialTraceability.Business/UpLoadBusiness.cs index 30d5faf..e2ea79c 100644 --- a/MaterialTraceability.Business/UpLoadBusiness.cs +++ b/MaterialTraceability.Business/UpLoadBusiness.cs @@ -555,7 +555,7 @@ namespace MaterialTraceability.Business if (result < 1) { - LogHelper.Info("设备当前时间失败!!!"); + //LogHelper.Info("设备当前时间失败!!!"); } } catch (Exception ex) diff --git a/MaterialTraceability.Common/LogHelper.cs b/MaterialTraceability.Common/LogHelper.cs index b749df8..817958e 100644 --- a/MaterialTraceability.Common/LogHelper.cs +++ b/MaterialTraceability.Common/LogHelper.cs @@ -51,10 +51,10 @@ namespace MaterialTraceability.Common /// public static void RfidLog(string msg) { - /* if (logRfid.IsInfoEnabled) + if (logRfid.IsInfoEnabled) { logRfid.Info(msg); - }*/ + } } /// diff --git a/MaterialTraceability.Entity/Config/TbAddress.cs b/MaterialTraceability.Entity/Config/TbAddress.cs index e84ab8d..ebd6d63 100644 --- a/MaterialTraceability.Entity/Config/TbAddress.cs +++ b/MaterialTraceability.Entity/Config/TbAddress.cs @@ -61,24 +61,21 @@ namespace MaterialTraceability.Entity.Config public string 收卷轴米数 = iNIFile.IniReadValue("TBPLcAddress", "收卷轴米数"); - public string A放卷涨紧 = iNIFile.IniReadValue("TBPLcAddress", "A放卷涨紧"); public string B放卷涨紧 = iNIFile.IniReadValue("TBPLcAddress", "B放卷涨紧"); - public string A放卷开始 = iNIFile.IniReadValue("TBPLcAddress", "A放卷开始"); - public string B放卷开始 = iNIFile.IniReadValue("TBPLcAddress", "B放卷开始"); + public string 放卷开始 = iNIFile.IniReadValue("TBPLcAddress", "放卷开始"); public string A放卷结束 = iNIFile.IniReadValue("TBPLcAddress", "A放卷结束"); public string B放卷结束 = iNIFile.IniReadValue("TBPLcAddress", "B放卷结束"); public string A放卷RFID = iNIFile.IniReadValue("TBPLcAddress", "A放卷RFID"); public string B放卷RFID = iNIFile.IniReadValue("TBPLcAddress", "B放卷RFID"); public string A放卷SFC = iNIFile.IniReadValue("TBPLcAddress", "A放卷SFC"); public string B放卷SFC = iNIFile.IniReadValue("TBPLcAddress", "B放卷SFC"); - public string A放卷OK = iNIFile.IniReadValue("TBPLcAddress", "A放卷OK"); - public string B放卷OK = iNIFile.IniReadValue("TBPLcAddress", "B放卷OK"); public string 放卷RFID异常 = iNIFile.IniReadValue("TBPLcAddress", "放卷RFID异常"); public string 放卷MES异常 = iNIFile.IniReadValue("TBPLcAddress", "放卷MES异常"); public string 放卷气胀泄气 = iNIFile.IniReadValue("TBPLcAddress", "放卷气胀泄气"); public string 放卷控制下料 = iNIFile.IniReadValue("TBPLcAddress", "放卷控制下料"); public string 放卷强制下料 = iNIFile.IniReadValue("TBPLcAddress", "放卷强制下料"); + public string 放卷是否转塔 = iNIFile.IniReadValue("TBPLcAddress", "放卷是否转塔"); } } diff --git a/MaterialTraceability.Rfid/Impl/RFly_I160Adapter.cs b/MaterialTraceability.Rfid/Impl/RFly_I160Adapter.cs index aa2e490..a4bd998 100644 --- a/MaterialTraceability.Rfid/Impl/RFly_I160Adapter.cs +++ b/MaterialTraceability.Rfid/Impl/RFly_I160Adapter.cs @@ -948,83 +948,100 @@ namespace MaterialTraceability.Rfid.Impl public List Device_DealTagInfoList2(byte[] AutoDealReportData) { List tagInfoList = new List(); - byte[] numArray1 = new byte[14]; - this.m_AutoReadEPC = (byte[])null; - this.m_readEPCDataLen = 0; + byte[] bResultEPC_Data = new byte[14]; + m_AutoReadEPC = null; + m_readEPCDataLen = 0; try { - this.mutauto.WaitOne(); - int sourceIndex1 = 6; - int sourceIndex2 = 7; - int sourceIndex3 = 8; - int sourceIndex4 = 9; - int sourceIndex5 = 11; - int int32_1 = Convert.ToInt32(AutoDealReportData[5].ToString()); - int num1 = 0; - for (int index1 = 0; index1 < int32_1; ++index1) + mutauto.WaitOne(); + int iFirstCountPos = 6; //第一次读取标签次数位置 + int iFirstRSSIPos = 7; //第一次读取标签强度位置 + int iFirstAnt = 8; + int iFirstPC = 9; //第一次读取标签天线位置 + int iFirstLeftBarcketPos = 11;//EPC数据起始位置 + UInt16 tempDataCount = 0; + int tempDataRSSI = 0; + UInt16 tempDataANT = 0; + int iBarcodeGroupCount = Convert.ToInt32(AutoDealReportData[5].ToString()); //标签组数 + int iBarcodeLength = 16; //标签长度 + int iCommonSecondFlag = 0; + int dataLength = Convert.ToInt32(AutoDealReportData[2].ToString()); + for (int j = 0; j < iBarcodeGroupCount; j++) { - TagInfo tagInfo = new TagInfo(); - byte[] destinationArray1 = new byte[2]; - Array.Clear((Array)destinationArray1, 0, 2); - Array.Copy((Array)AutoDealReportData, sourceIndex4, (Array)destinationArray1, 0, 2); - int int32_2 = Convert.ToInt32(destinationArray1[0].ToString("X")); - int length1 = this.EPCLengthByPC(int32_2); - int length2 = length1; - byte[] numArray2 = new byte[length1]; - Array.Clear((Array)numArray2, 0, length2); - Array.Copy((Array)AutoDealReportData, sourceIndex5, (Array)numArray2, 0, length2); - byte[] destinationArray2 = new byte[1]; - Array.Clear((Array)destinationArray2, 0, 1); - Array.Copy((Array)AutoDealReportData, sourceIndex1, (Array)destinationArray2, 0, 1); - ushort num2 = (ushort)destinationArray2[0]; - byte[] destinationArray3 = new byte[1]; - Array.Clear((Array)destinationArray3, 0, 1); - Array.Copy((Array)AutoDealReportData, sourceIndex2, (Array)destinationArray3, 0, 1); - int negative = StringChange.HexStringToNegative(StringChange.bytesToHexStr(destinationArray3, 1)); - byte[] destinationArray4 = new byte[1]; - Array.Clear((Array)destinationArray4, 0, 1); - Array.Copy((Array)AutoDealReportData, sourceIndex3, (Array)destinationArray4, 0, 1); - ushort num3 = (ushort)destinationArray4[0]; - tagInfo.Count = (int)num2; - tagInfo.RSSI = negative; - tagInfo.EPC = numArray2; - if (int32_2 == 44) - { - tagInfo.EPCstring = Encoding.ASCII.GetString(numArray2); - } - else - { - tagInfo.EPCstring = StringChange.bytesToHexStr(numArray2, numArray2.Length); - char[] chArray = new char[5]; - for (int index2 = 0; index2 < 5; ++index2) - { - if (numArray2[index2] >= (byte)0 && numArray2[index2] <= (byte)127) - { - chArray[index2] = Convert.ToChar(numArray2[index2]); - } - else - { - Console.WriteLine(string.Format("警告: 数值 {0} 不在ASCII码范围内。", (object)numArray2[index2])); - chArray[index2] = '?'; - } - } - string str = new string(chArray) + tagInfo.EPCstring.Substring(10, tagInfo.EPCstring.Length - 10); - tagInfo.EPCstring = str.Replace('F', ' ').Trim() + "00"; - } - tagInfo.PC = destinationArray1; - tagInfo.Antana = (int)num3; - tagInfoList.Add(tagInfo); - int count = tagInfoList.Count; - sourceIndex1 = sourceIndex1 + length2 + 5; - sourceIndex2 = sourceIndex1 + 1; - sourceIndex3 = sourceIndex2 + 1; - sourceIndex4 = sourceIndex3 + 1; - sourceIndex5 = sourceIndex5 + length2 + 5; - LogHelper.RfidLog("----函数调用:Device_DealTagInfoList2 第[" + (num1 + 1).ToString() + "]次数据解析为:" + tagInfo.EPCstring + ",读取标签次数:[" + num2.ToString() + "],标签信号强度:[" + negative.ToString() + "],天线号:[" + num3.ToString() + "]"); - ++num1; - if (num1 == int32_1) + //int EPCLength = dataLength - (6 * iBarcodeGroupCount); + + TagInfo tag = new TagInfo(); + byte[] tempPCByte = new byte[2]; //取出PC + Array.Clear(tempPCByte, 0, 2); + Array.Copy(AutoDealReportData, iFirstPC, tempPCByte, 0, 2); + + //PC转二进制取前五位转十进制 + int epcLength = Convert.ToInt32(Convert.ToString(Convert.ToInt64(tempPCByte[0].ToString("X"), 16), 2).PadLeft(8, '0').Substring(0, 5), 2) * 2; + + //int pc = Convert.ToInt32(tempPCByte[0].ToString()); + //int epcLength = EPCLengthByPC(pc); + iBarcodeLength = epcLength; + + byte[] tempDataByte = new byte[epcLength]; + Array.Clear(tempDataByte, 0, iBarcodeLength); + Array.Copy(AutoDealReportData, iFirstLeftBarcketPos, tempDataByte, 0, iBarcodeLength); + + + + byte[] tempCountByte = new byte[1]; //取出标签次数 + Array.Clear(tempCountByte, 0, 1); + Array.Copy(AutoDealReportData, iFirstCountPos, tempCountByte, 0, 1); + tempDataCount = tempCountByte[0]; + + byte[] tempRSSIByte = new byte[1]; //取出标签强度 + Array.Clear(tempRSSIByte, 0, 1); + Array.Copy(AutoDealReportData, iFirstRSSIPos, tempRSSIByte, 0, 1); + + + tempDataRSSI = StringChange.HexStringToNegative(StringChange.bytesToHexStr(tempRSSIByte, 1)); + + #region add by wenjy 20220829 取出天线号 + byte[] tempAntByte = new byte[1]; //取出天线号 + Array.Clear(tempAntByte, 0, 1); + Array.Copy(AutoDealReportData, iFirstAnt, tempAntByte, 0, 1); + tempDataANT = tempAntByte[0]; + #endregion + + tag.Count = tempDataCount; + tag.RSSI = tempDataRSSI; + tag.EPC = tempDataByte; + + //if (pc == 24) + //{ + // tag.EPCstring = StringChange.bytesToHexStr(tempDataByte, tempDataByte.Length).Substring(0, 7); + //} + //else + //{ + // tag.EPCstring = System.Text.Encoding.ASCII.GetString(tempDataByte); + //} + tag.EPCstring = System.Text.Encoding.ASCII.GetString(tempDataByte); + //byte[] hexbyte = new byte[tempDataByte.Length]; + //for (int i = 0; i < tempDataByte.Length; i++) + //{ + // hexbyte[i] = Convert.ToByte(tempDataByte[i].ToString("X")); + //} + //tag.EPCstring = System.Text.Encoding.ASCII.GetString(hexbyte); + tag.PC = tempPCByte; + tag.Antana = tempDataANT; + tagInfoList.Add(tag); + int iBarcodeListLen = tagInfoList.Count; //特别注意,必须这样,要不然会多一条数据 + + iFirstCountPos = iFirstCountPos + iBarcodeLength + 5; //次数 + iFirstRSSIPos = iFirstCountPos + 1; //强度 + iFirstAnt = iFirstRSSIPos + 1; //天线 + iFirstPC = iFirstAnt + 1; + iFirstLeftBarcketPos = iFirstLeftBarcketPos + iBarcodeLength + 5; + + LogHelper.RfidLog("----函数调用:Device_DealTagInfoList 第[" + (iCommonSecondFlag + 1) + "]次数据解析为:" + tag.EPCstring + ",读取标签次数:[" + tempDataCount + "],标签信号强度:[" + tempDataRSSI + "],天线号:[" + tempDataANT + "]"); + iCommonSecondFlag++; + if (iCommonSecondFlag == iBarcodeGroupCount) { - this.mutauto.ReleaseMutex(); + mutauto.ReleaseMutex(); LogHelper.RfidLog("《《《返回标签数据!"); return tagInfoList; } @@ -1033,7 +1050,7 @@ namespace MaterialTraceability.Rfid.Impl catch (Exception ex) { LogHelper.RfidLog("----函数调用:Device_AutoDealContent 自动处理函数异常:" + ex.ToString()); - this.mutauto.ReleaseMutex(); + mutauto.ReleaseMutex(); } return tagInfoList; } diff --git a/MaterialTraceability.WebService/IMesWebServices.cs b/MaterialTraceability.WebService/IMesWebServices.cs index ecea07b..17983d1 100644 --- a/MaterialTraceability.WebService/IMesWebServices.cs +++ b/MaterialTraceability.WebService/IMesWebServices.cs @@ -7,6 +7,7 @@ using MaterialTraceability.WebService.MiSFCQueryQtyServiceService; using MaterialTraceability.WebService.MiSignOffSFCsServiceService; using MaterialTraceability.WebService.Param; using MaterialTraceability.WebService.ProcessLotServiceWSService; +using MaterialTraceability.WebService.ResourceSlotConfigurationSetupForJITService; using MaterialTraceability.WebService.ShopOrderServiceWSService; using MaterialTraceability.WebService.WarehouseIntegrationServiceService; using System; @@ -107,5 +108,13 @@ namespace MaterialTraceability.WebService /// /// TBParametricValueResult findTBData(TBDataServiceParam upTBDataServiceParam); + + /// + /// 凹版上料接口 + /// + /// + /// + resourceSlotConfigurationSetupForJITServiceRequestPlanResponse resourceSlotConfigurationSetupForJITService(ResourceSlotConfigurationSetupForJITServiceParam resourceSlotConfigurationSetupForJITServiceParam); + } } diff --git a/MaterialTraceability.WebService/MaterialTraceability.WebService.csproj b/MaterialTraceability.WebService/MaterialTraceability.WebService.csproj index e23bdbb..372d9c4 100644 --- a/MaterialTraceability.WebService/MaterialTraceability.WebService.csproj +++ b/MaterialTraceability.WebService/MaterialTraceability.WebService.csproj @@ -57,6 +57,7 @@ + @@ -106,6 +107,11 @@ True Reference.map + + True + True + Reference.map + True True @@ -335,6 +341,11 @@ Reference.map + + MSDiscoCodeGenerator + Reference.cs + + Reference.map @@ -544,6 +555,17 @@ Settings MaterialTraceability_WebService_MiSignOffSFCsServiceService_MiSignOffSFCsServiceService + + Dynamic + Web References\ResourceSlotConfigurationSetupForJITService\ + http://lymesa.catlbattery.com:8103/atlmeswebservice/ResourceSlotConfigurationSetupForJITServiceService%3fwsdl + + + + + Settings + MaterialTraceability_WebService_ResourceSlotConfigurationSetupForJITService_ResourceSlotConfigurationSetupForJITServiceService + Dynamic Web References\WarehouseIntegrationServiceService\ diff --git a/MaterialTraceability.WebService/MesWebServicesImpl.cs b/MaterialTraceability.WebService/MesWebServicesImpl.cs index 140fd4f..2343e42 100644 --- a/MaterialTraceability.WebService/MesWebServicesImpl.cs +++ b/MaterialTraceability.WebService/MesWebServicesImpl.cs @@ -6,6 +6,7 @@ using MaterialTraceability.WebService.MachineIntegrationServiceService; using MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyServiceService; using MaterialTraceability.WebService.MiFirstOperationForsfcServiceService; using MaterialTraceability.WebService.MiReleaseSfcWithActivityServiceService; +using MaterialTraceability.WebService.ResourceSlotConfigurationSetupForJITService; using MaterialTraceability.WebService.MiSFCQueryQtyServiceService; using MaterialTraceability.WebService.MiSignOffSFCsServiceService; using MaterialTraceability.WebService.Param; @@ -21,6 +22,7 @@ using System.Xml.Serialization; using System.Xml; using MaterialTraceability.Entity.DTO; using System.Windows; + namespace MaterialTraceability.WebService { public class MesWebServicesImpl : IMesWebServices @@ -524,7 +526,7 @@ namespace MaterialTraceability.WebService { LogHelper.Error("mes接口调用异常,", ex); LogHelper.Info("mes接口调用异常:" + ex.Message); - MessageBox.Show(" " + ex.Message + " ,请调大mes接口超时时间"); + //MessageBox.Show(" " + ex.Message + " ,请调大mes接口超时时间"); throw new Exception(" " + ex.Message); } } @@ -888,5 +890,90 @@ namespace MaterialTraceability.WebService throw new Exception(" " + ex.Message); } } + + /// + /// 凹版上料接口 + /// + /// + /// + /// + public resourceSlotConfigurationSetupForJITServiceRequestPlanResponse resourceSlotConfigurationSetupForJITService(ResourceSlotConfigurationSetupForJITServiceParam resourceSlotConfigurationSetupForJITServiceParam) + { + try + { + if (StringExtension.IsBlank(resourceSlotConfigurationSetupForJITServiceParam.loginUser) && StringExtension.IsBlank(resourceSlotConfigurationSetupForJITServiceParam.password)) + { + resourceSlotConfigurationSetupForJITServiceParam.loginUser = "SUP_LYA_RF01"; + resourceSlotConfigurationSetupForJITServiceParam.password = "CA@TLmespcrf01"; + } + ResourceSlotConfigurationSetupForJITServiceService resourceSlotConfigurationSetupForJITServiceService = new ResourceSlotConfigurationSetupForJITServiceService(); + + //设置多线程数量 + ServicePointManager.DefaultConnectionLimit = 32; + //设置Http会话机制 + ServicePointManager.SetTcpKeepAlive(false, 100000, 100000); + + //设置Http双连接限制,reamrk:默认情况下,一个http客户端与服务端最多可同时建立两个TCP连接。http请求都在这两个通道中按顺序发送。调整此参数值,增加TCP连接数, + ServicePointManager.DefaultConnectionLimit = 10; + + //调用接口服务用户预认证设置,reamrk:避免设备软件每次调用接口,系统后台会产生一条接口认证报错信息,影响系统性能,接口服务属性字段PreAuthenticate设置为:true + resourceSlotConfigurationSetupForJITServiceService.PreAuthenticate = true; + + //添加认证否则调用接口报权限错误 + NetworkCredential nc = new NetworkCredential + { + UserName = resourceSlotConfigurationSetupForJITServiceParam.loginUser, + Password = resourceSlotConfigurationSetupForJITServiceParam.password + }; + + resourceSlotConfigurationSetupForJITServiceService.Url = resourceSlotConfigurationSetupForJITServiceParam.url; + resourceSlotConfigurationSetupForJITServiceService.Credentials = nc; + resourceSlotConfigurationSetupForJITServiceService.Timeout = int.Parse(appConfig.MesWebServiceTimeOut); + + + + resourceSlotConfigurationSetupForJITServiceRequestPlan resourceSlotConfigurationSetupForJITService = new resourceSlotConfigurationSetupForJITServiceRequestPlan(); + var Param = new resourceSlotConfigurationSetupForJITServiceRequest(); + Param.site = resourceSlotConfigurationSetupForJITServiceParam.site; + Param.resouce = resourceSlotConfigurationSetupForJITServiceParam.resource; + Param.operation = resourceSlotConfigurationSetupForJITServiceParam.operation; + Param.barcodeId = resourceSlotConfigurationSetupForJITServiceParam.barcodeId; + Param.barcodeType = resourceSlotConfigurationSetupForJITServiceParam.barcodeType; + Param.activityId = resourceSlotConfigurationSetupForJITServiceParam.activityId; + Param.mountingPoint = resourceSlotConfigurationSetupForJITServiceParam.mountingPoint; + Param.qty = null; + Param.emptyTray = null; + resourceSlotConfigurationSetupForJITService.resourceSlotConfigurationSetupForJITServiceRequestPlan1 = Param; + DateTime beginTime = DateTime.Now; + + var requestResult = resourceSlotConfigurationSetupForJITServiceService.resourceSlotConfigurationSetupForJITServiceRequestPlan(resourceSlotConfigurationSetupForJITService); + + //本地记录交互日志 + //WebServiceLog.saveMiFirstOperationForsfcServiceService(miFirstOperationForsfcServiceServiceParam, requestResult, beginTime, ""); + + //保存Mes接口请求记录 + webServiceRequestServices.Add(new RecordMesWebServiceRequest() + { + id = System.Guid.NewGuid().ToString(), + machineId = appConfig.machineId.ToString(), + interfaceType = "ResourceSlotConfigurationSetupForJITService", + requestState = 0, + requestParam = JsonChange.ModeToJson(resourceSlotConfigurationSetupForJITServiceParam), + responseCode = int.Parse(requestResult.@return.code), + responseMessage = requestResult.@return.message, + responseJson = JsonChange.ModeToJson(requestResult.@return), + requestTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + }); + + return requestResult; + } + catch (Exception ex) + { + LogHelper.Error("mes接口调用异常,", ex); + LogHelper.Info("mes接口调用异常:" + ex.Message); + throw new Exception(" " + ex.Message); + } + + } } } diff --git a/MaterialTraceability.WebService/Param/MiBatchCompleteSfcAndAdujustQtyServiceServiceParam.cs b/MaterialTraceability.WebService/Param/MiBatchCompleteSfcAndAdujustQtyServiceServiceParam.cs index 1a4d620..45e371c 100644 --- a/MaterialTraceability.WebService/Param/MiBatchCompleteSfcAndAdujustQtyServiceServiceParam.cs +++ b/MaterialTraceability.WebService/Param/MiBatchCompleteSfcAndAdujustQtyServiceServiceParam.cs @@ -69,5 +69,6 @@ namespace MaterialTraceability.WebService.Param /// 最后一卷 /// public string tailmark { get; set; } + } } diff --git a/MaterialTraceability.WebService/Param/ResourceSlotConfigurationSetupForJITServiceParam.cs b/MaterialTraceability.WebService/Param/ResourceSlotConfigurationSetupForJITServiceParam.cs new file mode 100644 index 0000000..43d72ad --- /dev/null +++ b/MaterialTraceability.WebService/Param/ResourceSlotConfigurationSetupForJITServiceParam.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + +namespace MaterialTraceability.WebService.Param +{ + public class ResourceSlotConfigurationSetupForJITServiceParam : BaseWebServiceParam + { + public string site { get; set; } + public string resource { get; set; } + public string operation { get; set; } + public string barcodeId { get; set; } + public string barcodeType { get; set; } + public string qty { get; set; } + public string activityId { get; set; } + public string mountingPoint { get; set; } + public string emptyTray { get; set; } + } +} diff --git a/MaterialTraceability.WebService/Properties/Settings.Designer.cs b/MaterialTraceability.WebService/Properties/Settings.Designer.cs index cf643dc..7c007c9 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", "16.10.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -142,5 +142,17 @@ namespace MaterialTraceability.WebService.Properties { "ueServiceService"])); } } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)] + [global::System.Configuration.DefaultSettingValueAttribute("http://lymesap225.catlbattery.com:50200/atlmeswebservice/ResourceSlotConfiguratio" + + "nSetupForJITServiceService")] + public string MaterialTraceability_WebService_ResourceSlotConfigurationSetupForJITService_ResourceSlotConfigurationSetupForJITServiceService { + get { + return ((string)(this["MaterialTraceability_WebService_ResourceSlotConfigurationSetupForJITService_Resou" + + "rceSlotConfigurationSetupForJITServiceService"])); + } + } } } diff --git a/MaterialTraceability.WebService/Properties/Settings.settings b/MaterialTraceability.WebService/Properties/Settings.settings index 5fc7d86..2254b43 100644 --- a/MaterialTraceability.WebService/Properties/Settings.settings +++ b/MaterialTraceability.WebService/Properties/Settings.settings @@ -32,5 +32,8 @@ http://lymesap227.catlbattery.com:50400/atlmeswebservice/GetParametricValueServiceService + + http://lymesap225.catlbattery.com:50200/atlmeswebservice/ResourceSlotConfigurationSetupForJITServiceService + \ No newline at end of file diff --git a/MaterialTraceability.WebService/Web References/ResourceSlotConfigurationSetupForJITService/Reference.cs b/MaterialTraceability.WebService/Web References/ResourceSlotConfigurationSetupForJITService/Reference.cs new file mode 100644 index 0000000..7ff5eba --- /dev/null +++ b/MaterialTraceability.WebService/Web References/ResourceSlotConfigurationSetupForJITService/Reference.cs @@ -0,0 +1,430 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +// +// 此源代码是由 Microsoft.VSDesigner 4.0.30319.42000 版自动生成。 +// +#pragma warning disable 1591 + +namespace MaterialTraceability.WebService.ResourceSlotConfigurationSetupForJITService { + using System.Diagnostics; + using System; + using System.Xml.Serialization; + using System.ComponentModel; + using System.Web.Services.Protocols; + using System.Web.Services; + + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.9037.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Web.Services.WebServiceBindingAttribute(Name="ResourceSlotConfigurationSetupForJITServiceBinding", Namespace="http://resourceSlotConfigurationSetupForJITService.ws.atlmes.com/")] + public partial class ResourceSlotConfigurationSetupForJITServiceService : System.Web.Services.Protocols.SoapHttpClientProtocol { + + private System.Threading.SendOrPostCallback resourceSlotConfigurationSetupForJITServiceRequestPlanOperationCompleted; + + private bool useDefaultCredentialsSetExplicitly; + + /// + public ResourceSlotConfigurationSetupForJITServiceService() { + this.Url = global::MaterialTraceability.WebService.Properties.Settings.Default.MaterialTraceability_WebService_ResourceSlotConfigurationSetupForJITService_ResourceSlotConfigurationSetupForJITServiceService; + if ((this.IsLocalFileSystemWebService(this.Url) == true)) { + this.UseDefaultCredentials = true; + this.useDefaultCredentialsSetExplicitly = false; + } + else { + this.useDefaultCredentialsSetExplicitly = true; + } + } + + public new string Url { + get { + return base.Url; + } + set { + if ((((this.IsLocalFileSystemWebService(base.Url) == true) + && (this.useDefaultCredentialsSetExplicitly == false)) + && (this.IsLocalFileSystemWebService(value) == false))) { + base.UseDefaultCredentials = false; + } + base.Url = value; + } + } + + public new bool UseDefaultCredentials { + get { + return base.UseDefaultCredentials; + } + set { + base.UseDefaultCredentials = value; + this.useDefaultCredentialsSetExplicitly = true; + } + } + + /// + public event resourceSlotConfigurationSetupForJITServiceRequestPlanCompletedEventHandler resourceSlotConfigurationSetupForJITServiceRequestPlanCompleted; + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)] + [return: System.Xml.Serialization.XmlElementAttribute("resourceSlotConfigurationSetupForJITServiceRequestPlanResponse", Namespace="http://resourceSlotConfigurationSetupForJITService.ws.atlmes.com/")] + public resourceSlotConfigurationSetupForJITServiceRequestPlanResponse resourceSlotConfigurationSetupForJITServiceRequestPlan([System.Xml.Serialization.XmlElementAttribute("resourceSlotConfigurationSetupForJITServiceRequestPlan", Namespace="http://resourceSlotConfigurationSetupForJITService.ws.atlmes.com/")] resourceSlotConfigurationSetupForJITServiceRequestPlan resourceSlotConfigurationSetupForJITServiceRequestPlan1) { + object[] results = this.Invoke("resourceSlotConfigurationSetupForJITServiceRequestPlan", new object[] { + resourceSlotConfigurationSetupForJITServiceRequestPlan1}); + return ((resourceSlotConfigurationSetupForJITServiceRequestPlanResponse)(results[0])); + } + + /// + public void resourceSlotConfigurationSetupForJITServiceRequestPlanAsync(resourceSlotConfigurationSetupForJITServiceRequestPlan resourceSlotConfigurationSetupForJITServiceRequestPlan1) { + this.resourceSlotConfigurationSetupForJITServiceRequestPlanAsync(resourceSlotConfigurationSetupForJITServiceRequestPlan1, null); + } + + /// + public void resourceSlotConfigurationSetupForJITServiceRequestPlanAsync(resourceSlotConfigurationSetupForJITServiceRequestPlan resourceSlotConfigurationSetupForJITServiceRequestPlan1, object userState) { + if ((this.resourceSlotConfigurationSetupForJITServiceRequestPlanOperationCompleted == null)) { + this.resourceSlotConfigurationSetupForJITServiceRequestPlanOperationCompleted = new System.Threading.SendOrPostCallback(this.OnresourceSlotConfigurationSetupForJITServiceRequestPlanOperationCompleted); + } + this.InvokeAsync("resourceSlotConfigurationSetupForJITServiceRequestPlan", new object[] { + resourceSlotConfigurationSetupForJITServiceRequestPlan1}, this.resourceSlotConfigurationSetupForJITServiceRequestPlanOperationCompleted, userState); + } + + private void OnresourceSlotConfigurationSetupForJITServiceRequestPlanOperationCompleted(object arg) { + if ((this.resourceSlotConfigurationSetupForJITServiceRequestPlanCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.resourceSlotConfigurationSetupForJITServiceRequestPlanCompleted(this, new resourceSlotConfigurationSetupForJITServiceRequestPlanCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + public new void CancelAsync(object userState) { + base.CancelAsync(userState); + } + + private bool IsLocalFileSystemWebService(string url) { + if (((url == null) + || (url == string.Empty))) { + return false; + } + System.Uri wsUri = new System.Uri(url); + if (((wsUri.Port >= 1024) + && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) { + return true; + } + return false; + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.9037.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://resourceSlotConfigurationSetupForJITService.ws.atlmes.com/")] + public partial class resourceSlotConfigurationSetupForJITServiceRequestPlan { + + private resourceSlotConfigurationSetupForJITServiceRequest resourceSlotConfigurationSetupForJITServiceRequestPlan1Field; + + /// + [System.Xml.Serialization.XmlElementAttribute("resourceSlotConfigurationSetupForJITServiceRequestPlan", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public resourceSlotConfigurationSetupForJITServiceRequest resourceSlotConfigurationSetupForJITServiceRequestPlan1 { + get { + return this.resourceSlotConfigurationSetupForJITServiceRequestPlan1Field; + } + set { + this.resourceSlotConfigurationSetupForJITServiceRequestPlan1Field = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.9037.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://resourceSlotConfigurationSetupForJITService.ws.atlmes.com/")] + public partial class resourceSlotConfigurationSetupForJITServiceRequest { + + private string siteField; + + private string resouceField; + + private string operationField; + + private string barcodeIdField; + + private string barcodeTypeField; + + private string qtyField; + + private string activityIdField; + + private string mountingPointField; + + private string emptyTrayField; + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string site { + get { + return this.siteField; + } + set { + this.siteField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string resouce { + get { + return this.resouceField; + } + set { + this.resouceField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string operation { + get { + return this.operationField; + } + set { + this.operationField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string barcodeId { + get { + return this.barcodeIdField; + } + set { + this.barcodeIdField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string barcodeType { + get { + return this.barcodeTypeField; + } + set { + this.barcodeTypeField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string qty { + get { + return this.qtyField; + } + set { + this.qtyField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string activityId { + get { + return this.activityIdField; + } + set { + this.activityIdField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string mountingPoint { + get { + return this.mountingPointField; + } + set { + this.mountingPointField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string emptyTray { + get { + return this.emptyTrayField; + } + set { + this.emptyTrayField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.9037.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://resourceSlotConfigurationSetupForJITService.ws.atlmes.com/")] + public partial class resourceSlotConfigurationSetupItemList { + + private string atlIdField; + + private string inventoryIdField; + + private string itemField; + + private string qtyField; + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string atlId { + get { + return this.atlIdField; + } + set { + this.atlIdField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string inventoryId { + get { + return this.inventoryIdField; + } + set { + this.inventoryIdField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string item { + get { + return this.itemField; + } + set { + this.itemField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string qty { + get { + return this.qtyField; + } + set { + this.qtyField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.9037.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://resourceSlotConfigurationSetupForJITService.ws.atlmes.com/")] + public partial class resourceSlotConfigurationSetupForJITServiceResponse { + + private string codeField; + + private string messageField; + + private resourceSlotConfigurationSetupItemList[] itemListField; + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string code { + get { + return this.codeField; + } + set { + this.codeField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public string message { + get { + return this.messageField; + } + set { + this.messageField = value; + } + } + + /// + [System.Xml.Serialization.XmlElementAttribute("itemList", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public resourceSlotConfigurationSetupItemList[] itemList { + get { + return this.itemListField; + } + set { + this.itemListField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.9037.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://resourceSlotConfigurationSetupForJITService.ws.atlmes.com/")] + public partial class resourceSlotConfigurationSetupForJITServiceRequestPlanResponse { + + private resourceSlotConfigurationSetupForJITServiceResponse returnField; + + /// + [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] + public resourceSlotConfigurationSetupForJITServiceResponse @return { + get { + return this.returnField; + } + set { + this.returnField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.9037.0")] + public delegate void resourceSlotConfigurationSetupForJITServiceRequestPlanCompletedEventHandler(object sender, resourceSlotConfigurationSetupForJITServiceRequestPlanCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.9037.0")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class resourceSlotConfigurationSetupForJITServiceRequestPlanCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal resourceSlotConfigurationSetupForJITServiceRequestPlanCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public resourceSlotConfigurationSetupForJITServiceRequestPlanResponse Result { + get { + this.RaiseExceptionIfNecessary(); + return ((resourceSlotConfigurationSetupForJITServiceRequestPlanResponse)(this.results[0])); + } + } + } +} + +#pragma warning restore 1591 \ No newline at end of file diff --git a/MaterialTraceability.WebService/Web References/ResourceSlotConfigurationSetupForJITService/Reference.map b/MaterialTraceability.WebService/Web References/ResourceSlotConfigurationSetupForJITService/Reference.map new file mode 100644 index 0000000..36efa57 --- /dev/null +++ b/MaterialTraceability.WebService/Web References/ResourceSlotConfigurationSetupForJITService/Reference.map @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MaterialTraceability.WebService/Web References/ResourceSlotConfigurationSetupForJITService/ResourceSlotConfigurationSetupForJITServiceService.wsdl b/MaterialTraceability.WebService/Web References/ResourceSlotConfigurationSetupForJITService/ResourceSlotConfigurationSetupForJITServiceService.wsdl new file mode 100644 index 0000000..051758f --- /dev/null +++ b/MaterialTraceability.WebService/Web References/ResourceSlotConfigurationSetupForJITService/ResourceSlotConfigurationSetupForJITServiceService.wsdl @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/MaterialTraceability.WebService/app.config b/MaterialTraceability.WebService/app.config index 51b0f77..664ef26 100644 --- a/MaterialTraceability.WebService/app.config +++ b/MaterialTraceability.WebService/app.config @@ -47,11 +47,24 @@ serializeAs="String"> http://lymesap227.catlbattery.com:50400/atlmeswebservice/GetParametricValueServiceService + + http://lymesap225.catlbattery.com:50200/atlmeswebservice/ResourceSlotConfigurationSetupForJITServiceService + - - + + + + + + + + diff --git a/MaterialTraceabilityUI/CoatingProcess.xaml.cs b/MaterialTraceabilityUI/CoatingProcess.xaml.cs index 9d9214e..7aaca63 100644 --- a/MaterialTraceabilityUI/CoatingProcess.xaml.cs +++ b/MaterialTraceabilityUI/CoatingProcess.xaml.cs @@ -185,7 +185,7 @@ namespace MaterialTraceabilityUI SFC_Finish.Dispatcher.BeginInvoke(action); } - else if (viewModelDto.rfidInfo.position == 4) + else if (viewModelDto.rfidInfo.position == 3) { action = () => { diff --git a/MaterialTraceabilityUI/SplitSfc.xaml.cs b/MaterialTraceabilityUI/SplitSfc.xaml.cs index 5bbc4a3..ebb4cab 100644 --- a/MaterialTraceabilityUI/SplitSfc.xaml.cs +++ b/MaterialTraceabilityUI/SplitSfc.xaml.cs @@ -12,6 +12,7 @@ using MaterialTraceability.WebService.MiFirstOperationForsfcServiceService; using MaterialTraceability.WebService.MiSignOffSFCsServiceService; using MaterialTraceability.WebService.Param; using MaterialTraceabilityUI.Common; +using MySqlX.XDevAPI.Common; using SqlSugar; using System; using System.Collections.Generic; @@ -812,15 +813,89 @@ namespace MaterialTraceabilityUI MessageBox.Show("请输入ea值"); return; } + string splitSfc = GetSfcByRfid(downRecord.Rfid); + if (StringExtension.IsBlank(splitSfc)) + { + MessageBox.Show("RFID条码: " + downRecord.Rfid + "未绑定SFC"); + } + Complete(sfcTextBox.Text, splitSfc, downRecord.Rfid, downRecord.PositionId, eaTextBox.Text); + } + else + { + + ABComplete(downRecord.Sfc, downRecord.Rfid); + //Complete(sfcTextBox.Text, downRecord.Sfc, downRecord.Rfid, downRecord.PositionId, eaTextBox.Text); + } + + } + private void ABComplete(string upMaterialSfc,string RFID) + { + string ea = GetUpMaterialQty(upMaterialSfc); + if (string.IsNullOrEmpty(ea)) + { + return; } - + LogHelperBusiness.LogInfo("调用MES手动完工接口"); + MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc modeProcessSfc = MaterialTraceability.WebService.MiBatchCompleteSfcAndAdujustQtyServiceService.ModeProcessSfc.MODE_COMPLETE_SFC_POST_DC; + miBatchCompleteSfcAndAdujustQtySfcEntity[] miBatchCompleteSfcAndAdujustQtySfcEntities = new miBatchCompleteSfcAndAdujustQtySfcEntity[] + { + new miBatchCompleteSfcAndAdujustQtySfcEntity() + { + processLot = RFID, + qty = ea, + unit = "EA", + } + }; + MiBatchCompleteSfcAndAdujustQtyServiceServiceParam requestParam = new MiBatchCompleteSfcAndAdujustQtyServiceServiceParam() + { + url = inifile.IniReadValue("AdujustQtyParam", "url"), + site = inifile.IniReadValue("AdujustQtyParam", "site"), + sfcPre = upMaterialSfc, + processLotPre = "", + operation = appConfig.operation, //阳极ANCAP1 //阴极CACAP1 + operationRevision = inifile.IniReadValue("AdujustQtyParam", "operationRevision"), + resource = appConfig.resource, + user = inifile.IniReadValue("AdujustQtyParam", "user"), + activity = inifile.IniReadValue("AdujustQtyParam", "activity"), + modeProcessSfc = modeProcessSfc, + sfcList = miBatchCompleteSfcAndAdujustQtySfcEntities, + + }; + MiBatchCompleteSfcAndAdujustQtyResponse batchCompleteSfcAndAdujustQtyResponse = new MiBatchCompleteSfcAndAdujustQtyResponse(); + DateTime beginTime = DateTime.Now; + try + { + LogHelperBusiness.LogInfo("MES自动完工接口请求参数:" + JsonChange.ModeToJson(requestParam)); + if (appConfig.isMesFlag == 1) + { + if (!StringExtension.IsBlank(upMaterialSfc)) + { + batchCompleteSfcAndAdujustQtyResponse = MesWebServices.iMiBatchCompleteSfcAndAdujustQtyServiceService(requestParam); + LogHelperBusiness.LogInfo("MES自动完工接口返回参数:" + JsonChange.ModeToJson(batchCompleteSfcAndAdujustQtyResponse)); + + var result = batchCompleteSfcAndAdujustQtyResponse.@return; + if (result.code > 0) + { + LogHelperBusiness.LogInfo("MES自动完工接口调用失败:" + result.message); + MessageBox.Show("MES自动完工接口调用失败:" + result.message); + } + } + else + { + LogHelperBusiness.LogInfo("MES自动完工接口调用失败:收卷SFC为空"); + MessageBox.Show("MES自动完工接口调用失败:收卷SFC为空"); + + } + LogHelperBusiness.LogInfo("MES自动完工接口调用成功"); + MessageBox.Show("MES自动完工接口调用成功"); + - string splitSfc = GetSfcByRfid(downRecord.Rfid); - if (StringExtension.IsBlank(splitSfc)) + } + } + catch (Exception ex) { - MessageBox.Show("RFID条码: " + downRecord.Rfid + "未绑定SFC"); + LogHelperBusiness.LogInfo("MES自动完工接口调用异常"+ ex.Message); } - Complete(sfcTextBox.Text, splitSfc, downRecord.Rfid,downRecord.PositionId, eaTextBox.Text); } private string GetLyShaftName(int positionId) @@ -859,7 +934,7 @@ namespace MaterialTraceabilityUI if (sfcQueryQtyResponse.@return.code > 0) { - LogHelperBusiness.LogInfo(String.Format("通过MES接口获取放卷物料{0}的SFC数量失败:{1}", bindSfc, upLoadBusiness.GetMesMessage(sfcQueryQtyResponse.@return.code, sfcQueryQtyResponse.@return.message))); + LogHelperBusiness.LogInfo(String.Format("通过MES接口获取物料{0}的SFC数量失败:{1}", bindSfc, upLoadBusiness.GetMesMessage(sfcQueryQtyResponse.@return.code, sfcQueryQtyResponse.@return.message))); return ""; } return sfcQueryQtyResponse.@return.qty; diff --git a/MaterialTraceabilityUI/WriteInfo.xaml b/MaterialTraceabilityUI/WriteInfo.xaml index 0736a85..c071e6d 100644 --- a/MaterialTraceabilityUI/WriteInfo.xaml +++ b/MaterialTraceabilityUI/WriteInfo.xaml @@ -17,7 +17,9 @@ - --> + +