public string GetTB039_Down(string date_) { string _TC002 = ""; string dateFormat = date_.Substring(1); string firstvalue = dateFormat + "9999"; sqlCON data = new sqlCON(); string check9999 = data.sqlExecuteScalarString("select count(*) TRANSNO from m_SFTKEY where TRANSNO = '" + firstvalue + "'"); if (int.Parse(check9999) != 0) { string minTB002 = data.sqlExecuteScalarString("select min(TRANSNO) from m_SFTKEY where TRANSNO like '" + dateFormat + "%'"); int valueset = int.Parse(minTB002.Trim().Substring(7, 4)); valueset = valueset - 1; _TC002 = dateFormat + valueset.ToString("0000"); } else { _TC002 = firstvalue; } //insertnextvalue string sqlinsert = "insert into m_SFTKEY(TRANSNO, datetimeRST) values ('" + _TC002 + "', getdate()) "; data.sqlExecuteNonQuery(sqlinsert, false); return(_TC002); }
public void updateERPMQC(string serno) { try { StringBuilder update = new StringBuilder(); update.Append("update m_ERPMQC set status = 'OK' where serno = '" + serno + "'"); sqlCON data = new sqlCON(); data.sqlExecuteNonQuery(update.ToString(), false); } catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, "updateERPMQC(string serno)", ex.Message); } }
public bool UpdateToERPMQC_Realtime(string Status, string lot) { try { StringBuilder sqlupdate = new StringBuilder(); sqlupdate.Append("update m_ERPMQC_REALTIME set status = '" + Status + "' where "); sqlupdate.Append("lot = '" + lot + "' and data not like '0' and status like ''"); sqlCON data = new sqlCON(); data.sqlExecuteNonQuery(sqlupdate.ToString(), false); return(true); } catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, " UpdateToERPMQC_Realtime(string Status, string lot)", ex.Message); return(false); } }
public bool UpdateToERPMQC_Error(string Status, string serno) { try { StringBuilder sqlupdate = new StringBuilder(); sqlupdate.Append("update m_ERPMQC_Error set status = '" + Status + "' where "); sqlupdate.Append("serno = '" + serno + "'"); sqlCON data = new sqlCON(); data.sqlExecuteNonQuery(sqlupdate.ToString(), false); return(true); } catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, " UpdateToERPMQC_Error(string Status, string serno)", ex.Message); return(false); } }
public bool InsertToERPMQC(DataTable table) { try { for (int i = 0; i < table.Rows.Count; i++) { if (table.Rows[i]["data"].ToString().Trim() != "0" && double.Parse(table.Rows[i]["data"].ToString()) > 0) { StringBuilder sqlInsert = new StringBuilder(); sqlInsert.Append("insert into m_ERPMQC "); sqlInsert.Append(@"(serno, lot, model, site, factory, line, process, item, inspectdate, inspecttime, data, judge, status, remark )"); sqlInsert.Append(" values ( "); sqlInsert.Append("'" + table.Rows[i]["serno"].ToString() + "' , "); sqlInsert.Append("'" + table.Rows[i]["lot"].ToString() + "' , "); sqlInsert.Append("'" + table.Rows[i]["model"].ToString() + "' , "); sqlInsert.Append("'" + table.Rows[i]["site"].ToString() + "' , "); sqlInsert.Append("'" + table.Rows[i]["factory"].ToString() + "' , "); sqlInsert.Append("'" + table.Rows[i]["line"].ToString() + "' , "); sqlInsert.Append("'" + table.Rows[i]["process"].ToString() + "' , "); sqlInsert.Append("'" + table.Rows[i]["item"].ToString() + "' , "); sqlInsert.Append("'" + table.Rows[i]["inspectdate"].ToString() + "' , "); sqlInsert.Append("'" + table.Rows[i]["inspecttime"].ToString() + "' , "); sqlInsert.Append("'" + table.Rows[i]["data"].ToString() + "' , "); sqlInsert.Append("'" + table.Rows[i]["judge"].ToString() + "' , "); sqlInsert.Append("'" + table.Rows[i]["status"].ToString() + "', "); sqlInsert.Append("'" + table.Rows[i]["remark"].ToString() + "' ) "); sqlCON data = new sqlCON(); data.sqlExecuteNonQuery(sqlInsert.ToString(), false); } } return(true); } catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, "InsertToERPMQC(DataTable table)", ex.Message); return(false); } }