/// <summary>判断是否需要显示换产提醒 /// /// </summary> /// <param name="newvin"></param> public static void GetChange(VinMsg newvin) { if (newvin != null) { if (LastVinMsg == null || LastVinMsg.ZTBM != newvin.ZTBM) { var s1 = LastVinMsg?.ZTBM ?? "空"; var s2 = newvin?.ZTBM ?? "空"; ToolAlarm.ShowDialog(string.Format("换型:\r\n{0}→{1}", s1, s2)); } } }
/// <summary>将一个待处理的机号存入缓存队列中,并返回队列中的数量 /// /// </summary> /// <returns></returns> public static int SetVin(VinMsg vin, out string err) { if (sns.Contains(vin.vin)) { err = "机号" + vin.vin + "已在缓存队列中存在"; return(sns.Count); } sns.Enqueue(vin.vin); err = ""; CacheJHCountChanged?.Invoke(); return(sns.Count); }
/// <summary>上传干检数据 /// /// </summary> /// <param name="vin"></param> /// <param name="gjre"></param> /// <param name="err"></param> /// <returns></returns> public static bool Insert_ZXJC_QMD(VinMsg vin, Cosmo.GJResult gjre, out string err) { if (SParms.DebugMode) { err = ""; return(true); } string sql = "insert into ZXJC_QMD(BARCODE,MODEL,P1_VALUE,P2_VALUE,DP_VALUE,V_VALUE,TEST_RESULT,TEST_DATE,TEST_RY) values ('" + vin.vin + "','" + vin.ZTBM + "','" + gjre.Hi + "','" + gjre.Lo + "','" + gjre.DP + "','" + gjre.XLZ + "','" + (gjre.OK ? "合格" : "不合格") + "',sysdate,'" + SParms.User + "')"; /*int re = */ SQLConnect.ExeSQL(sql, out err); return(err == ""); }
/// <summary>上传扭力数据 /// /// </summary> /// <param name="vin"></param> /// <param name="nl"></param> /// <param name="ok"></param> /// <param name="err"></param> /// <returns></returns> public static bool Insert_BOSCHPDC(VinMsg vin, decimal nl, bool ok, out string err) { if (SParms.DebugMode) { err = ""; return(true); } int DQCXH_Int_Temp = Regex.Replace(vin.DQCXH, @"[^0-9]+", "").ToInt();//因为BOSCHPDC表的PROGRAM字段是数字类型,没有理由,就是这么流氓,只能提取数字部分存取进去 string sql = "insert into BOSCHPDC(IDENTIFIER,NODE,RESULT,IDATE,ITIME,CHANNEL,PROGRAM,DATA1,SCX,LRR) values ('" + vin.vin + "_" + vin.NowCount + "','" + AppConfig.GX + "','" + (ok ? "OK" : "NOK") + "'," + "to_char(sysdate, 'yyyy-mm-dd')" + "," + "to_char(sysdate, 'hh24:mi:ss')" + ",'1','" + DQCXH_Int_Temp + "','" + nl + "','" + AppConfig.SCX + "','" + SParms.User + "' )"; /* int re = */ SQLConnect.ExeSQL(sql, out err); return(err == ""); }
/// <summary>尝试从缓冲队列中取出一个有效的机号信息,否则返回null /// /// </summary> /// <returns></returns> public static VinMsg GetVin() { //var sw = System.Diagnostics.Stopwatch.StartNew(); while (sns.Count > 0) { //System.Diagnostics.Trace.WriteLine(sw.ElapsedMilliseconds.ToString()); VinMsg vinmsg = VinMsg.Create(sns.Dequeue(), out string err); CacheJHCountChanged?.Invoke(); //System.Diagnostics.Trace.WriteLine(sw.ElapsedMilliseconds.ToString()); if (err == "") { return(vinmsg); } } //System.Diagnostics.Trace.WriteLine(sw.ElapsedMilliseconds.ToString()); return(null); }
/// <summary>上传过程数据 /// /// </summary> /// <param name="vin"></param> /// <param name="ok"></param> /// <param name="err"></param> /// <returns></returns> public static bool Insert_ZXJC_Data_List(VinMsg vin, bool ok, out string err) { if (SParms.DebugMode) { err = ""; return(true); } if (AppConfig.SCX == 1 && AppConfig.GX == 22) { string sql1 = "insert into ZXJC_DATA_LIST(VIN,ZTBM,WORK_FLOW,JCSJ,JCRY,JCJG,GZXX,SCX,JJH) values ('" + vin.vin + "','" + vin.ZTBM + "','" + 49 + "',sysdate,'" + SParms.User + "','" + (ok ? "合格" : "不合格") + "','','" + AppConfig.SCX + "','')"; string sql2 = "insert into ZXJC_DATA_LIST(VIN,ZTBM,WORK_FLOW,JCSJ,JCRY,JCJG,GZXX,SCX,JJH) values ('" + vin.vin + "','" + vin.ZTBM + "','" + 50 + "',sysdate,'" + SParms.User + "','" + (ok ? "合格" : "不合格") + "','','" + AppConfig.SCX + "','')"; SQLConnect.ExeSQL(sql1, out string err1); SQLConnect.ExeSQL(sql2, out string err2); err = (err1 + err2).Trim(); return(err == ""); } string sql = "insert into ZXJC_DATA_LIST(VIN,ZTBM,WORK_FLOW,JCSJ,JCRY,JCJG,GZXX,SCX,JJH) values ('" + vin.vin + "','" + vin.ZTBM + "','" + AppConfig.GX + "',sysdate,'" + SParms.User + "','" + (ok ? "合格" : "不合格") + "','','" + AppConfig.SCX + "','')"; SQLConnect.ExeSQL(sql, out err); return(err == ""); }
public static VinMsg Create(string as_vin, out string err) { //var sw = System.Diagnostics.Stopwatch.StartNew(); VinMsg vin = new VinMsg { vin = as_vin }; #region 查询机型和状态编码 var dt = SQL.SQLConnect.SelectSQL("select t.ztbm,t.write_req from BARCODE_PRINT t where t.vin='" + vin.vin + "'", out err); //System.Diagnostics.Trace.WriteLine(sw.ElapsedMilliseconds.ToString()); if (err != "") { err = "从数据库查询数据失败:" + err; return(null); } if (dt.Rows.Count == 0) { err = "数据库中未查询到机号相关信息:" + vin.vin; return(null); } vin.ZTBM = dt.Rows[0]["ztbm"].ToString(); vin.JX = dt.Rows[0]["write_req"].ToString(); #endregion #region 查询前端状态 switch (AppConfig.GXType_Enum) { case AppConfig.GXType_EnumType.人工: case AppConfig.GXType_EnumType.干检: case AppConfig.GXType_EnumType.扭力: vin.QDZT = SQL.GetLastWork(vin.vin, AppConfig.GX, AppConfig.SCX, out string[] qdzt2, out err); if (!vin.QDZT) { vin.QDBHGGX = qdzt2 /*.Split('|')*/.ToList().ConvertAll(qw => { string str_tmp = SQL.GetWorkNameByWorkNO(qw); return(string.IsNullOrWhiteSpace(str_tmp) ? qw : str_tmp); }); } break; } #endregion #region 查询工艺数据 switch (AppConfig.GXType_Enum) { case AppConfig.GXType_EnumType.扭力: var dt_nl_temp = SQL.SQLConnect.SelectSQL("select * from ZXJC_NL_CSYQ where ztbm='" + vin.ZTBM + "' and work_no='" + AppConfig.GX + "'", out err); //System.Diagnostics.Trace.WriteLine(sw.ElapsedMilliseconds.ToString()); if (err != "") { err = "查询扭力数据出错:" + err; return(null); } if (dt_nl_temp.Rows.Count == 0) { err = "查询扭力数据出错:在表ZXJC_NL_CSYQ未查询到任何数据,状态编码为" + vin.ZTBM; } if (!dt_nl_temp.Rows[0]["SHBZ"].ToType <bool>()) { err = "查询扭力数据出错:在表ZXJC_NL_CSYQ中查询到未审核数据,请联系工艺人员,状态编码为" + vin.ZTBM; } vin.DQCXH = dt_nl_temp.Rows[0]["GS"].ToType <string>(); vin.NLSX = dt_nl_temp.Rows[0]["SX"].ToType <decimal>(); vin.NLXX = dt_nl_temp.Rows[0]["XX"].ToType <decimal>(); vin.TotalCount = dt_nl_temp.Rows[0]["CS"].ToType <int>(); break; case AppConfig.GXType_EnumType.人工: break; case AppConfig.GXType_EnumType.干检: var dt_gj_temp = SQL.SQLConnect.SelectSQL("select * from ZXJC_GJ_CSYQ where ztbm='" + vin.ZTBM + "'", out err); //System.Diagnostics.Trace.WriteLine(sw.ElapsedMilliseconds.ToString()); if (err != "") { err = "查询干检数据出错:" + err; return(null); } if (dt_gj_temp.Rows.Count == 0) { err = "查询干检数据出错:在表ZXJC_GJ_CSYQ未查询到任何数据,状态编码为" + vin.ZTBM; } if (!dt_gj_temp.Rows[0]["SHBZ"].ToType <bool>()) { err = "查询干检数据出错:在表ZXJC_GJ_CSYQ中查询到未审核数据,请联系工艺人员,状态编码为" + vin.ZTBM; } vin.DQCXH = dt_gj_temp.Rows[0]["GJGS"].ToType <string>(); vin.NLSX = dt_gj_temp.Rows[0]["GJYLSX"].ToType <decimal>(); vin.NLXX = dt_gj_temp.Rows[0]["GJYLXX"].ToType <decimal>(); vin.充气时间_干检 = dt_gj_temp.Rows[0]["GJCQSJ"].ToType <decimal>(); vin.允许泄漏_干检 = dt_gj_temp.Rows[0]["GJXLZ"].ToType <decimal>(); break; } #endregion return(vin); }
/// <summary>将指定机号设定为程序最新的机号 /// /// </summary> /// <param name="newvin"></param> public static void SetChange(VinMsg newvin) { LastVinMsg = newvin; }