/// <summary> /// 保存IQC数据临时保存 /// </summary> /// <param name="SQCId"></param> /// <returns></returns> public bool SPec_SaveIQCCheckResultTempXmlData(string SendQCReportId, string XMLData, out string returnMsg) { try { using (SqlConnection conn = DBClass.getSqlConnection()) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 520; cmd.CommandText = "SaveIQCCheckResultTempXmlData"; cmd.Parameters.AddWithValue("@SendQCReportId", SendQCReportId); cmd.Parameters.AddWithValue("@XMLData", XMLData); cmd.Parameters.Add("@Result_Msg", SqlDbType.NVarChar, 300).Direction = ParameterDirection.Output; cmd.Parameters.Add("@Return", SqlDbType.NVarChar, 20).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); int ret_Value = Convert.ToInt32(cmd.Parameters["@Return"].Value); returnMsg = (cmd.Parameters["@Result_Msg"].Value).ToString(); cmd.Parameters.Clear(); conn.Close(); if (ret_Value >= 0) { return(true); } else { return(false); } } } } catch { throw; } }
/// <summary> /// 加抽 /// </summary> /// <param name="SQCId"></param> /// <param name="ExtQty"></param> /// <param name="returnMsg"></param> /// <returns></returns> public bool SPec_Speciment_ExtRecordSubmit(string SQCId, decimal ExtQty, out string returnMsg) { try { using (SqlConnection conn = DBClass.getSqlConnection()) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 520; cmd.CommandText = "Speciment_ExtRecordSubmit"; cmd.Parameters.AddWithValue("@SendQCReportId", SQCId); cmd.Parameters.AddWithValue("@ExtQty", ExtQty); cmd.Parameters.Add("@Result_Msg", SqlDbType.NVarChar, 300).Direction = ParameterDirection.Output; cmd.Parameters.Add("@Return", SqlDbType.NVarChar, 20).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); int ret_Value = Convert.ToInt32(cmd.Parameters["@Return"].Value); returnMsg = (cmd.Parameters["@Result_Msg"].Value).ToString(); cmd.Parameters.Clear(); conn.Close(); if (ret_Value >= 0) { return(true); } else { return(false); } } } } catch (Exception ex) { throw; } }
/// <summary> /// 删除原材料检验记录 /// </summary> /// <param name="model"></param> /// <param name="returnMsg"></param> /// <returns></returns> public bool SPec_SQRMCheckResultDel(string RMId, out string returnMsg) { try { using (SqlConnection conn = DBClass.getSqlConnection()) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 520; cmd.CommandText = "P_RawMaterialIQCCheckDelete"; cmd.Parameters.AddWithValue("@RawMaterialIQCCheckId", RMId); cmd.Parameters.Add("@Result_Msg", SqlDbType.NVarChar, 300).Direction = ParameterDirection.Output; cmd.Parameters.Add("@Return", SqlDbType.NVarChar, 20).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); int ret_Value = Convert.ToInt32(cmd.Parameters["@Return"].Value); returnMsg = (cmd.Parameters["@Result_Msg"].Value).ToString(); cmd.Parameters.Clear(); conn.Close(); if (ret_Value >= 0) { return(true); } else { return(false); } } } } catch (Exception ex) { throw; } }
/// <summary> /// 删除扫描记录 /// </summary> /// <param name="SQCId"></param> /// <returns></returns> public bool delScanList(string SQCId, string lotSN, out string returnMsg) { try { using (SqlConnection conn = DBClass.getSqlConnection()) { conn.Open(); using (SqlCommand cmd = conn.CreateCommand()) { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandTimeout = 120; cmd.CommandText = "P_DelSQCData"; cmd.Parameters.AddWithValue("@SQCId", SQCId); cmd.Parameters.AddWithValue("@LotSN", lotSN); cmd.Parameters.Add("@Result_Msg", SqlDbType.NVarChar, 300).Direction = ParameterDirection.Output; cmd.Parameters.Add("@Return", SqlDbType.NVarChar, 300).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); int ret_Value = Convert.ToInt32(cmd.Parameters["@Return"].Value); returnMsg = (cmd.Parameters["@Result_Msg"].Value).ToString(); cmd.Parameters.Clear(); conn.Close(); if (ret_Value >= 0) { return(true); } else { return(false); } } } } catch { throw; } }
/// <summary> /// 根据扫描项获取检验Id /// </summary> /// <param name="ScanSn"></param> /// <returns></returns> public string GetIQCCheclIdByScanSn(string ScanSn) { SqlConnection con = DBClass.getSqlConnection(); SqlCommand cmd = new SqlCommand(string.Format(" SELECT TOP 1 A.SendQCReportId FROM Speciment A LEFT JOIN Speciment_ExtRecord B ON A.SpecimentId=B.SpecimentId WHERE isnull(a.YBSN,'')= '{0}'", ScanSn), con); try { con.Open(); Object o = cmd.ExecuteScalar(); if (o != null) { return(o.ToString()); } } catch (Exception ex) { throw ex; } finally { con.Close(); } return(""); }
private DataSet getScanInfosUnknowSQId(string LotSN, bool IsQ) { DataSet ds = new DataSet(); DBClass dbc = new DBClass(); //string sqlStr = @"SELECT LotId,LotSN,Lot.Qty,ProductShortName, dbo.Product.ProductDescription // FROM dbo.Lot LEFT JOIN dbo.Product ON lot.ProductId = dbo.Product.ProductId // LEFT JOIN dbo.ProductRoot ON ProductRoot.ProductRootId = Product.ProductRootId // WHERE LotSN = '"+ LotSN + "'";--RB1150000000G string sqlStr = string.Format(@"SELECT Lot.LotId,VendorDeliveryItemLot.LotSN,LotQty,ProductShortName, dbo.Product.ProductDescription ,VendorDeliveryItemLot.SendQCReportId,SendQCReport.QCResult FROM dbo.VendorDeliveryItemLot LEFT JOIN dbo.Product ON VendorDeliveryItemLot.ProductId = dbo.Product.ProductId LEFT JOIN dbo.ProductRoot ON ProductRoot.ProductRootId = Product.ProductRootId LEFT JOIN dbo.Lot ON Lot.LotSN = VendorDeliveryItemLot.LotSN LEFT JOIN dbo.SendQCReport ON SendQCReport.SendQCReportId=VendorDeliveryItemLot.SendQCReportId WHERE VendorDeliveryItemLot.LotSN = '{0}' AND SendQCReport.QCResult{1}", LotSN, IsQ?"!=0":"=0"); SqlConnection con = getSqlConnection(); SqlCommand cmd = new SqlCommand(sqlStr, con); try { con.Open(); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(ds); } catch (Exception ex) { throw ex; } finally { con.Close(); } return(ds); }