/// <summary> /// 增加一条数据 /// </summary> public decimal Add(Maticsoft.Model.LabVerify model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into tb_LabVerify("); strSql.Append("Orm_ID,Pb_ID,IsVerify,UserID,LabPic_ID)"); strSql.Append(" values ("); strSql.Append("@Orm_ID,@Pb_ID,@IsVerify,@UserID,@LabPic_ID)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@Orm_ID", SqlDbType.VarChar, 50), new SqlParameter("@Pb_ID", SqlDbType.VarChar, 50), new SqlParameter("@IsVerify", SqlDbType.VarChar, 50), new SqlParameter("@UserID", SqlDbType.VarChar, 50), new SqlParameter("@LabPic_ID", SqlDbType.VarChar, 50) }; parameters[0].Value = model.Orm_ID; parameters[1].Value = model.Pb_ID; parameters[2].Value = model.IsVerify; parameters[3].Value = model.UserID; parameters[4].Value = model.LabPic_ID; object obj = dbs.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToDecimal(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.LabVerify GetModel(decimal LBV_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 LBV_ID,Orm_ID,Pb_ID,IsVerify,UserID,LabPic_ID from tb_LabVerify "); strSql.Append(" where LBV_ID=@LBV_ID"); SqlParameter[] parameters = { new SqlParameter("@LBV_ID", SqlDbType.Decimal) }; parameters[0].Value = LBV_ID; Maticsoft.Model.LabVerify model = new Maticsoft.Model.LabVerify(); DataSet ds = dbs.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["LBV_ID"] != null && ds.Tables[0].Rows[0]["LBV_ID"].ToString() != "") { model.LBV_ID = decimal.Parse(ds.Tables[0].Rows[0]["LBV_ID"].ToString()); } if (ds.Tables[0].Rows[0]["Orm_ID"] != null && ds.Tables[0].Rows[0]["Orm_ID"].ToString() != "") { model.Orm_ID = ds.Tables[0].Rows[0]["Orm_ID"].ToString(); } if (ds.Tables[0].Rows[0]["Pb_ID"] != null && ds.Tables[0].Rows[0]["Pb_ID"].ToString() != "") { model.Pb_ID = ds.Tables[0].Rows[0]["Pb_ID"].ToString(); } if (ds.Tables[0].Rows[0]["IsVerify"] != null && ds.Tables[0].Rows[0]["IsVerify"].ToString() != "") { model.IsVerify = ds.Tables[0].Rows[0]["IsVerify"].ToString(); } if (ds.Tables[0].Rows[0]["UserID"] != null && ds.Tables[0].Rows[0]["UserID"].ToString() != "") { model.UserID = ds.Tables[0].Rows[0]["UserID"].ToString(); } if (ds.Tables[0].Rows[0]["LabPic_ID"] != null && ds.Tables[0].Rows[0]["LabPic_ID"].ToString() != "") { model.LabPic_ID = ds.Tables[0].Rows[0]["LabPic_ID"].ToString(); } return(model); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.LabVerify GetModel(string sqlWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 LBV_ID,Orm_ID,Pb_ID,IsVerify,UserID,LabPic_ID from tb_LabVerify "); if (sqlWhere != "") { strSql.Append(" where " + sqlWhere); } Maticsoft.Model.LabVerify model = new Maticsoft.Model.LabVerify(); DataSet ds = dbs.Query(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["LBV_ID"] != null && ds.Tables[0].Rows[0]["LBV_ID"].ToString() != "") { model.LBV_ID = decimal.Parse(ds.Tables[0].Rows[0]["LBV_ID"].ToString()); } if (ds.Tables[0].Rows[0]["Orm_ID"] != null && ds.Tables[0].Rows[0]["Orm_ID"].ToString() != "") { model.Orm_ID = ds.Tables[0].Rows[0]["Orm_ID"].ToString(); } if (ds.Tables[0].Rows[0]["Pb_ID"] != null && ds.Tables[0].Rows[0]["Pb_ID"].ToString() != "") { model.Pb_ID = ds.Tables[0].Rows[0]["Pb_ID"].ToString(); } if (ds.Tables[0].Rows[0]["IsVerify"] != null && ds.Tables[0].Rows[0]["IsVerify"].ToString() != "") { model.IsVerify = ds.Tables[0].Rows[0]["IsVerify"].ToString(); } if (ds.Tables[0].Rows[0]["UserID"] != null && ds.Tables[0].Rows[0]["UserID"].ToString() != "") { model.UserID = ds.Tables[0].Rows[0]["UserID"].ToString(); } if (ds.Tables[0].Rows[0]["LabPic_ID"] != null && ds.Tables[0].Rows[0]["LabPic_ID"].ToString() != "") { model.LabPic_ID = ds.Tables[0].Rows[0]["LabPic_ID"].ToString(); } return(model); } else { return(null); } }
// //选择待验证的项目 // private void dgv_Not_Verify_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { try { //获取选定项目 _W_LabVerify = (Maticsoft.Model.LabVerify)dgv_Not_Verify.SelectedItem; decimal picID = decimal.Parse(_W_LabVerify.LabPic_ID); imBytes = MCP_CS.ImageList.GetModel(picID).Im; //在控件中显示图片 BitmapImage BI = new BitmapImage(); BI.BeginInit(); BI.StreamSource = new MemoryStream(imBytes); //bufPic是图片二进制,byte类型 BI.EndInit(); image1.Source = BI; //image是XAML页面上定义的Image控件 // System.Diagnostics.Process.Start("explorer.exe", FilePath); //打开指定文件夹 //显示工单中设置的检测标准 dgv_InspecStandard.ItemsSource = MCP_CS.InseectStandaer.GetModelList(_W_LabVerify.Orm_ID); } catch { image1.Source = null; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.LabVerify model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_LabVerify set "); strSql.Append("Orm_ID=@Orm_ID,"); strSql.Append("Pb_ID=@Pb_ID,"); strSql.Append("IsVerify=@IsVerify,"); strSql.Append("UserID=@UserID,"); strSql.Append("LabPic_ID=@LabPic_ID"); strSql.Append(" where LBV_ID=@LBV_ID"); SqlParameter[] parameters = { new SqlParameter("@Orm_ID", SqlDbType.VarChar, 50), new SqlParameter("@Pb_ID", SqlDbType.VarChar, 50), new SqlParameter("@IsVerify", SqlDbType.VarChar, 50), new SqlParameter("@UserID", SqlDbType.VarChar, 50), new SqlParameter("@LabPic_ID", SqlDbType.VarChar, 50), new SqlParameter("@LBV_ID", SqlDbType.Decimal, 9) }; parameters[0].Value = model.Orm_ID; parameters[1].Value = model.Pb_ID; parameters[2].Value = model.IsVerify; parameters[3].Value = model.UserID; parameters[4].Value = model.LabPic_ID; parameters[5].Value = model.LBV_ID; int rows = dbs.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
//针对跳线设计 public My_Print(Maticsoft.Model.PackBatch _packBatch) { try { //1.获取工单中标签的设置信息 2.开启BT打印程序后台线程 OrderLabSet _M_LabSetInfo = new OrderLabSet(); _WTT_LabSetInfo = _M_LabSetInfo.GetLabInfo("(tb_OrderLabSet.OrderID = '" + _packBatch.OrderID + "' )"); if (_WTT_LabSetInfo.Tables[0].Rows.Count > 0) { LabName = _WTT_LabSetInfo.Tables[0].Rows[0]["LabName"].ToString(); _PrintRecord.BatchNo = _packBatch.BatchNo; _PrintRecord.OrderID = _packBatch.OrderID; _PrintRecord.LabellMode = LabName; btEngine.Start(); //开启后台线程 IsPrint = true; //启用标签打印 //检查标签是否核对 LabVerify labv = new LabVerify(); Maticsoft.Model.LabVerify _temLabv = labv.GetModel(" Orm_ID = '" + _packBatch.OrderID + "'"); if (_temLabv != null && _temLabv.IsVerify != "0") { } else { IsPrint = false; My_MessageBox.My_MessageBox_Erry("此工单标签未经过核对!!!\r\n请通知助理或工程师进行标签核对后重试!"); } } else { IsPrint = false; My_MessageBox.My_MessageBox_Message("未找到此批号的任何标签,将不进行标签打印!!!\r\n请确认是否需要进行标签打印"); } } catch { My_MessageBox.My_MessageBox_Message("打印服务未能启动,将导致无法打印!/r/n导致此错误的原因可能是您的计算机未安装BT打印软件或其它必要的服务程序!如有疑问请联系系统管理员"); } }