/// <summary> /// 上工序校验 /// </summary> /// <param name="session"></param> /// <param name="data"></param> /// <returns></returns> public static bool CheckRouteOnlyCheck(TransmitData data) { try { //上工序校验 DM_SFCInterface DM_SFC = new DM_SFCInterface(); DataTable dt = DM_SFC.SFC_DM_CheckRouteOnlyCheck(data.SN, data.EquipmentID, "", "");//FAIL string CheckStatus = dt.Rows[0][0].ToString().ToString(); string ReturnMsg = dt.Rows[0][1].ToString().ToString(); if (CheckStatus == "1") // 成功 { data.CheckResult = CheckResult.OK.ToString(); return(true); } else { data.CheckResult = CheckResult.ERROR.ToString(); data.Description = ReturnMsg; return(false); } } catch (Exception e) { data.CheckResult = CheckResult.ERROR.ToString(); data.Description = e.Message; return(false); } }
private void Plc_DataChange(object sender, DataChangeEventArgs e) { lock (sync) { string ht = e._stateType; ushort hv = e._stateValue; if (ht == "HandleType") { #region OP130-2 switch (hv) { case 0: SetBtnEnable(false); ClearGsProcess(true); OnDisplayLog("", true); ResetWarningChart(0, true); log.Info(hv + INITADDRESS); break; case 1: log.Info(hv + SCANCOMPLETE); ResetWarningChart(1, true); SetPlcStatus(GlobalData.MonitorTagAdd, 2); break; case 2: //扫码完成,MES读取条码 byte[] bytes = plc.ReadBytes(DataType.DataBlock, int.Parse(GlobalData.MsgDB), 256, 256); plcSN = Utility.ConvertToString(bytes); log.Info(hv + READBARCODESUCCESS + "plcSN<" + plcSN + ">"); OnDisplayLog("SN: " + plcSN, true); try { if (GlobalData.SimWrite != "true") { //调用MES函数向MES传递SN码,MES验证上工序是否成功,成功返回true,失败返回false dt = SFCInterface.SFC_DM_CheckRouteOnlyCheck(plcSN, GlobalData.EquipmentNO, "", ""); CheckStatus = dt.Rows[0][0].ToString().ToString(); ReturnMsg = dt.Rows[0][1].ToString().ToString(); Msg = CheckStatus + ":" + ReturnMsg; if (CheckStatus == "1") //成功 { SetPlcStatus(GlobalData.MonitorTagAdd, 3); SendMsgToPlc(int.Parse(GlobalData.MsgDB), int.Parse(GlobalData.MsgStart), hv + PROCESSCHECKSUCCESS + Msg); log.Info(hv + PROCESSCHECKSUCCESS + Msg); } else { SetPlcStatus(GlobalData.MonitorTagAdd, 4); SendMsgToPlc(int.Parse(GlobalData.MsgDB), int.Parse(GlobalData.MsgStart), hv + PROCESSCHECKFAIL + Msg); log.Info(hv + PROCESSCHECKFAIL + Msg); OnDisplayLog("Error: " + Msg, false); DisplayResetBtn(true); } } } catch (Exception ex) { log.Info(hv + PROCESSCHECKFAIL + ex.Message); OnDisplayLog("Error: " + ex.Message, false); } break; case 3: SetBtnEnable(true); ResetWarningChart(2, true); log.Info(hv + PROCESSCHECKSUCCESS); LoadFlowHistory(plcSN); break; case 4: SetBtnEnable(false); ResetWarningChart(2, false); log.Info(hv + PROCESSCHECKFAIL); break; case 5: SetBtnEnable(true); ResetWarningChart(3, true); SetlblText(VICheck); log.Info(hv + PFCheckPASS); break; case 6: ResetWarningChart(3, false); log.Info(hv + PFCheckFAIL); break; case 7: ResetWarningChart(4, true); SetlblText(PFCheck); log.Info(hv + VICheckPASS); break; case 8: ResetWarningChart(4, false); log.Info(hv + VICheckFAIL); break; case 9: ResetWarningChart(5, true); log.Info(hv + STATIONPASS); break; case 10: ResetWarningChart(5, false); log.Info(hv + STATIONFAIL); break; default: log.Info(hv + UNKNOWNVALEU); break; } #endregion } } }