private int RunCommandWithTransatcion(VSM.Entities.BuWFRelationship ent, string vSql, IDbTransaction TRANS) { if (null == TRANS) { MySqlParameter[] paras = new MySqlParameter[ent.Column.Count]; for (int i = 0; i < ent.Column.Count; i++) { paras[i] = new MySqlParameter(); paras[i].ParameterName = ent.Column[i].FieldName; paras[i].DbType = ent.Column[i].FieldType; paras[i].Value = ent.Column[i].FieldValue; } return(DataBaseManage.ExecuteSql(vSql, paras)); } else { System.Data.IDbCommand CM = TRANS.Connection.CreateCommand(); CM.CommandText = vSql; CM.CommandType = CommandType.Text; CM.Transaction = TRANS; GetEntityDeleteParameter(CM, ent); try { return(CM.ExecuteNonQuery()); } catch (System.Exception e) { if (isDebug) { throw new Exception(e.Message); } return(0); } } }
private void TrajInfor() { if (gv.RowCount == 0 || gv.GetSelectedRows().Length < 1) { return; } double[] Offset = new double[6]; double[] Array = new double[6]; double[] Downlead = new double[6]; double[] Axis = new double[6]; double[] Para = new double[6]; double[] Frame = new double[6]; string Remark = ""; // string TrajName = ""; string TypeName = ""; string[] DownleadType = new string[] { "无", "直线", "圆弧" }; DataBaseManage db = new DataBaseManage(); if (db.GetTraj(RecipeName, gv.GetSelectedRows()[0] + 1, ref TrajName, ref TypeName, ref Frame, ref Offset, ref Array, ref Downlead, ref Axis, ref Para, ref Remark)) { // LL_TrajRemark.Text = "路径说明:" + Remark; } else { // LL_TrajRemark.Text = "路径说明:"; TrajName = null; } }
public int Excute() { IDbConnection conn = DataBaseManage.GetdbConnection(); int i_Return = 0; try { conn.Open(); trans = conn.BeginTransaction(); Tran(); trans.Commit(); return(i_Return); } catch (Exception ex) { if (trans != null) { trans.Rollback(); } ex.ToString(); return(i_Return); } finally { if (trans != null) { trans.Dispose(); } if (conn != null) { conn.Close(); conn.Dispose(); } } }
public Frm_Main() { //卸载与安装 if (!File.Exists(Application.StartupPath + "\\Packaging.mdb") && File.Exists(Application.StartupPath + "\\Backup\\Packaging.mdb")) { File.Copy(Application.StartupPath + "\\Backup\\Packaging.mdb", Application.StartupPath + "\\Packaging.mdb", true); } //2013.11.20 //检查数据库是否存在 if (!File.Exists(Application.StartupPath + "\\Packaging.mdb")) { MessageBox.Show("程序根目录中数据库文件Packaging.MDB不存在"); System.Environment.Exit(System.Environment.ExitCode); this.Dispose(); this.Close(); return; } PublicFunc.Init(); DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = true; // PublicFunc.ReadXMLConfigure(); InitializeComponent(); BI_ListClose_ItemClick(this, null); TE_Title.Text = "Packaging"; RC_Main.DefaultPageCategory.Expanded = true; RC_Main.Minimized = true; InitSkinGallery(); db = new DataBaseManage(); TxtData.XMLConfigure.RegCode = db.GetRegCode(); TxtData.XMLConfigure.Reged = PublicFunc.CompareCode(TxtData.XMLConfigure.RegCode); db.SaveCs8cConfigure(); PublicFunc.ReadCs8CConfigure(); db.GetIp(ref TxtData.XMLConfigure.IpAddress, ref TxtData.XMLConfigure.RestrictCode); db.GetPopedom(ref TxtData.PublicData.ScreenEnable); TxtData.XMLConfigure.User = db.GetAutoLogin(); if (TxtData.XMLConfigure.User != null) { TxtData.XMLConfigure.Login = true; TxtData.XMLConfigure.PopeDom = db.GetUserPopm(TxtData.XMLConfigure.User); db.AddLog(TxtData.XMLConfigure.User + "登录"); } PublicFunc.ReadXMLConfigure(); poll = new Thread(new ThreadStart(PublicFunc.Poll)); poll.Start(); }
/// <summary> ///修改密码 /// </summary> /// <param name="UserId"></param> /// <param name="OldPassword"></param> /// <param name="NewPassword"></param> /// <returns></returns> public bool ModifyPassword(string UserCode, string NewPassword) { StringBuilder sql = new StringBuilder(); sql.Append(" Update userinfo "); sql.Append(" Set Password = '******'"); sql.Append(" Where usercode = '" + UserCode + "'"); return(DataBaseManage.ExecuteSql(sql.ToString()) > 0); }
/// <summary> /// /// </summary> /// <param name="info"></param> /// <returns></returns> public bool ModifyDictType(DictTypeInfo info) { StringBuilder sql = new StringBuilder(); sql.Append("Update dicttypeinfo "); sql.Append(" Set Name = '" + info.Name + "'"); sql.Append(" Where code = '" + info.Code + "'"); return(DataBaseManage.ExecuteSql(sql.ToString()) > 0); }
public Frm_Main() { //卸载与安装 if (!File.Exists(Application.StartupPath+"\\RobotPolish.mdb")&&File.Exists(Application.StartupPath+"\\Backup\\RobotPolish.mdb")) { File.Copy(Application.StartupPath + "\\Backup\\RobotPolish.mdb", Application.StartupPath + "\\RobotPolish.mdb",true); } //2013.11.20 //检查数据库是否存在 if (!File.Exists(Application.StartupPath + "\\RobotPolish.mdb")) { MessageBox.Show("程序根目录中数据库文件RobotPolish.mdb不存在"); System.Environment.Exit(System.Environment.ExitCode); this.Dispose(); this.Close(); return; } PublicFunc.Init(); DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = true; // PublicFunc.ReadXMLConfigure(); InitializeComponent(); BI_ListClose_ItemClick(this, null); TE_Title.Text = "抛光工艺管理软件"; RC_Main.DefaultPageCategory.Expanded = true; RC_Main.Minimized = true; InitSkinGallery(); db = new DataBaseManage(); TxtData.XMLConfigure.RegCode = db.GetRegCode(); TxtData.XMLConfigure.Reged = true; //db.SaveCs8cConfigure(); //PublicFunc.ReadCs8CConfigure(); db.GetIp(ref TxtData.XMLConfigure.IpAddress, ref TxtData.XMLConfigure.RestrictCode); db.GetPopedom(ref TxtData.PublicData.ScreenEnable); TxtData.XMLConfigure.User = db.GetAutoLogin(); TxtData.SoapData.Tool = db.GetTool(); if (TxtData.XMLConfigure.User != null) { TxtData.XMLConfigure.Login = true; TxtData.XMLConfigure.PopeDom = db.GetUserPopm(TxtData.XMLConfigure.User); db.AddLog(TxtData.XMLConfigure.User + "登录"); } PublicFunc.ReadXMLConfigure(); poll = new Thread(new ThreadStart(PublicFunc.Poll)); poll.Start(); }
/// <summary> /// /// </summary> /// <param name="info"></param> /// <returns></returns> public bool ModifyPower(PowerInfo info) { StringBuilder sql = new StringBuilder(); sql.Append(" Update powerinfo "); sql.Append(" Set powername = '" + info.PowerName + "',"); sql.Append(" powervalue = '" + info.PowerValue.ToString() + "' "); sql.Append(" Where powerid = '" + info.PowerId.ToString() + "'"); return(DataBaseManage.ExecuteSql(sql.ToString()) > 0); }
/// <summary> /// /// </summary> /// <returns></returns> public bool ModifyMoudleSort(Dictionary <string, string> Dic) { List <string> list = new List <string>(); StringBuilder sql = new StringBuilder(); foreach (KeyValuePair <string, string> kvp in Dic) { list.Add(" Update moudleinfo Set Sort='" + kvp.Value + "' Where moudleid = '" + kvp.Key + "'"); } return(DataBaseManage.ExecuteSqlTran(list) > 0); }
/// <summary> /// 授予用户角色 /// </summary> /// <param name="UserId"></param> /// <param name="RoleId"></param> /// <returns></returns> public bool GrantUserRole(int UserId, List <string> RoleId) { List <string> list = new List <string>(); string sql = ""; foreach (string _RoleId in RoleId) { sql = string.Format("Insert Into userroleinfo (userid, roleid)Values ('{0}', '{1}')", UserId, _RoleId); list.Add(sql); } return(DataBaseManage.ExecuteSqlTran(list) > 0); }
/// <summary> /// /// </summary> /// <param name="user"></param> /// <returns></returns> public bool ModifyDept(DeptInfo info) { StringBuilder sql = new StringBuilder(); sql.Append(" Update deptinfo "); sql.Append(" Set deptname = '" + info.DeptName + "',"); sql.Append(" parentid = '" + info.ParentId + "', "); sql.Append(" remark = '" + info.Remark + "', "); sql.Append(" DEPTTYPE = '" + info.DeptType + "' "); sql.Append(" Where deptid = '" + info.DeptId + "'"); return(DataBaseManage.ExecuteSql(sql.ToString()) > 0); }
/// <summary> /// /// </summary> /// <param name="ListInfo"></param> /// <returns></returns> public bool GrantRolePower(List <RoleMoudleInfo> ListInfo) { List <string> list = new List <string>(); string sql = ""; foreach (RoleMoudleInfo info in ListInfo) { sql = string.Format("Update rolemoudleinfo Set powervalue = '{0}' Where roleid = '{1}' And moudleid = '{2}'", info.PowerValue, info.RoleId, info.MoudleId); list.Add(sql); } return(DataBaseManage.ExecuteSqlTran(list) > 0); }
/// <summary> /// /// </summary> /// <param name="info"></param> /// <returns></returns> public bool CreatePower(PowerInfo info) { StringBuilder sql = new StringBuilder(); sql.Append(" Insert Into powerinfo "); sql.Append(" ( powername, powervalue, moudleid) "); sql.Append(" Values( "); sql.Append(" '" + info.PowerName + "',"); sql.Append(" '" + info.PowerValue.ToString() + "',"); sql.Append(" '" + info.MoudleId.ToString() + "'"); sql.Append(" ) "); return(DataBaseManage.ExecuteSql(sql.ToString()) > 0); }
/// <summary> /// /// </summary> /// <param name="info"></param> /// <returns></returns> public bool ModifyDict(DictInfo info) { StringBuilder sql = new StringBuilder(); sql.Append("Update dictinfo "); sql.Append(" Set Name = '" + info.Name + "',"); sql.Append(" Type = '" + info.TypeCode + "',"); sql.Append(" remark = '" + info.Remark + "',"); sql.Append(" Sort = '" + info.Sort + "',"); sql.Append(" isenable = '" + info.IsEnable + "'"); sql.Append(" Where code = '" + info.Code + "' and Type='" + info.TypeCode + "'"); return(DataBaseManage.ExecuteSql(sql.ToString()) > 0); }
/// <summary> /// 根据角色ID取得角色信息 /// </summary> /// <param name="RoleId"></param> /// <returns></returns> public RoleInfo GetRoleById(string RoleId) { RoleInfo info = new RoleInfo(); using (DbDataReader reader = DataBaseManage.ExecuteReader(_SelectSql + " where roleid='" + RoleId + "'")) { if (reader.Read()) { info = BuilderEntity(reader); } } return(info); }
public bool CreateDictType(DictTypeInfo info) { StringBuilder sql = new StringBuilder(); sql.Append(" Insert Into dicttypeinfo "); sql.Append(" (code, Name) "); sql.Append(" Values "); sql.Append(" ( "); sql.Append(" '" + info.Code + "',"); sql.Append(" '" + info.Name + "'"); sql.Append(" )"); return(DataBaseManage.ExecuteSql(sql.ToString()) > 0); }
public bool GrantRoleMoudle(int RoleId, List <string> MoudleId) { List <string> list = new List <string>(); string sql = string.Format("Delete FROM rolemoudleinfo Where roleid = '{0}'", RoleId); list.Add(sql); foreach (string _MoudleId in MoudleId) { sql = string.Format("Insert Into rolemoudleinfo (roleid, moudleid, powervalue)Values ('{0}', '{1}','0')", RoleId, _MoudleId); list.Add(sql); } return(DataBaseManage.ExecuteSqlTran(list) > 0); }
void PollImport(object target) { DataBaseManage db = new DataBaseManage(); switch (OperIndex) { //导出 case 1: { TxtData.PublicData.ErrorCode = (db.SaveProduct(FileName, CBE_RecipeName.EditValue.ToString())) ? 40 : 34; break; } //删除产品 case 2: { TxtData.PublicData.ErrorCode = (db.DeleteRecipe(CBE_RecipeName.EditValue.ToString())) ? 40 : 32; break; } //导入 case 3: { if (PublicFunc.SaveNCFile(Application.StartupPath + "\\Txt\\NCFile.txt", PublicFunc.ReadNCFile(FileName), TxtData.CS8CConfigure.Tool)) { FileName = Application.StartupPath + "\\Txt\\NCFile.txt"; } TxtData.PublicData.ErrorCode = PublicFunc.IsTool(FileName)? 0 : 41; if (TxtData.PublicData.ErrorCode != 0) { return; } TxtData.PublicData.ErrorLine = db.ImportProduct(FileName, CBE_RecipeName.EditValue.ToString()); TxtData.PublicData.ErrorCode = (TxtData.PublicData.ErrorLine == 0) ? 40 : 20; // return; break; } //删除路径 case 4: { //2013.11.19 //TxtData.PublicData.ErrorCode = (db.DeleteTraj(TrajName,true)) ? 40 : 32; TxtData.PublicData.ErrorCode = (db.DeleteTraj(CBE_RecipeName.EditValue.ToString(), TxtData.PublicData.DeleteTrajIndex)) ? 40 : 32; break; } } }
/// <summary> /// /// </summary> /// <param name="MoudleId"></param> /// <returns></returns> public MoudleInfo GetMoudleInfo(string MoudleId) { MoudleInfo info = null; string sql = _SelectSql + " where moudleid='" + MoudleId + "'"; using (DbDataReader reader = DataBaseManage.ExecuteReader(sql)) { if (reader.Read()) { info = BuilderEntity(reader); } } return(info); }
/// <summary> /// /// </summary> /// <param name="Code"></param> /// <returns></returns> public DictInfo GetDictInfo(string Code, string Type) { DictInfo info = null; string sql = _SelectSql + string.Format(" where code='{0}' and Type='{1}'", Code, Type); using (DbDataReader reader = DataBaseManage.ExecuteReader(sql)) { if (reader.Read()) { info = BuilderEntity(reader); } } return(info); }
/// <summary> /// /// </summary> /// <param name="Code"></param> /// <returns></returns> public DictTypeInfo GetDictTypeInfo(string Code) { DictTypeInfo info = null; string sql = _SelectSql2 + string.Format(" Where code = '{0}'", Code); using (DbDataReader reader = DataBaseManage.ExecuteReader(sql)) { if (reader.Read()) { info = BuilderDictType(reader); } } return(info); }
/// <summary> /// /// </summary> /// <param name="MoudleId"></param> /// <returns></returns> public DeptInfo GetDeptInfo(string DeptId) { DeptInfo info = null; string sql = _SelectSql + " where deptid='" + DeptId + "'"; using (DbDataReader reader = DataBaseManage.ExecuteReader(sql)) { if (reader.Read()) { info = BuilderEntity(reader); } } return(info); }
/// <summary> /// /// </summary> /// <param name="MoudleId"></param> /// <returns></returns> public string GetCurrentLocation(string MoudleId) { string strSQL = "select CONCAT((Select moudlename From moudleinfo Where moudleid =t.parentid ),'>>',t.moudlename) Location from moudleinfo t Where t.moudleid='" + MoudleId + "'"; string Location = ""; using (DbDataReader reader = DataBaseManage.ExecuteReader(strSQL)) { while (reader.Read()) { Location = (reader.IsDBNull(reader.GetOrdinal("Location"))) ? "" : reader["Location"].ToString(); } } return(Location); }
/// <summary> /// /// </summary> /// <param name="Code"></param> /// <returns></returns> public PostInfo GetPostInfo(string Code) { PostInfo info = null; string Sql = _SelectSql + string.Format(" where code = '{0}'", Code.Trim()); using (DbDataReader reader = DataBaseManage.ExecuteReader(Sql)) { if (reader.Read()) { info = BuilderEntity(reader); } } return(info); }
/// <summary> /// /// </summary> /// <param name="RoleId"></param> /// <param name="MoudleId"></param> /// <returns></returns> public int GetPowerValue(string RoleId, string MoudleId) { RoleMoudleInfo info = new RoleMoudleInfo(); string sql = "Select sum(powervalue) powervalue From rolemoudleinfo where roleid in(" + RoleId + ") and moudleid='" + MoudleId + "'"; using (DbDataReader reader = DataBaseManage.ExecuteReader(sql)) { if (reader.Read()) { info.PowerValue = (reader.IsDBNull(reader.GetOrdinal("powervalue"))) ? int.Parse("0") : int.Parse(reader["powervalue"].ToString()); } } return(int.Parse(info.PowerValue.ToString())); }
void TrajInfor() { if (gv.RowCount == 0 || gv.GetSelectedRows().Length < 1) { return; } double[] Offset = new double[6]; double[] Array = new double[6]; double[] Downlead = new double[6]; double[] Axis = new double[6]; double[] Para = new double[6]; string Remark = ""; // string TrajName = ""; string TypeName = ""; string[] DownleadType = new string[] { "无", "直线", "圆弧" }; DataBaseManage db = new DataBaseManage(); if (db.GetTraj(CBE_RecipeName.EditValue.ToString(), gv.GetSelectedRows()[0] + 1, ref TrajName, ref TypeName, ref Frame, ref Offset, ref Array, ref Downlead, ref Axis, ref Para, ref Remark)) { //LL_RecipeFrame.Text = "用户坐标系:" + "X->" + Frame[0].ToString() + " Y->" + Frame[1].ToString() + " Z->" + Frame[2].ToString() + " RX->" + Frame[3].ToString() + " RY->" + Frame[4].ToString() + " RZ->" + Frame[5].ToString(); //LL_RecipeOffset.Text = "产品偏差:" + "X->" + Offset[0].ToString() + " Y->" + Offset[1].ToString() + " Z->" + Offset[2].ToString() + " RX->" + Offset[3].ToString() + " RY->" + Offset[4].ToString() + " RZ->" + Offset[5].ToString(); LL_TrajFrame.Text = "路径坐标系:" + Frame[0].ToString() + "->" + Frame[1].ToString() + "->" + Frame[2].ToString() + "->" + Frame[3].ToString() + "->" + Frame[4].ToString() + "->" + Frame[5].ToString(); LL_TrajOffset.Text = "路径偏差 :" + Offset[0].ToString() + "->" + Offset[1].ToString() + "->" + Offset[2].ToString() + "->" + Offset[3].ToString() + "->" + Offset[4].ToString() + "->" + Offset[5].ToString(); LL_TrajRemark.Text = "路径说明:" + Remark; LL_TrajArray.Text = "路径阵列:" + Array[0].ToString() + "->" + Array[1].ToString() + "->" + Array[2].ToString() + "->" + Array[3].ToString() + "->" + Array[4].ToString() + "->" + Array[5].ToString(); LL_Circle.Text = "圆直径:" + Downlead[4].ToString() + " 圆弧度(焊):" + Downlead[5].ToString(); LL_Delay.Text = "延时:" + "激光开->" + Para[0].ToString() + " 激光关->" + Para[1].ToString(); LL_DownLead.Text = "引线配置:引入->" + DownleadType[(int)Downlead[0]] + " 引出->" + DownleadType[(int)Downlead[2]]; } else { TrajName = null; LL_TrajFrame.Text = "路径坐标系:"; LL_TrajOffset.Text = "路径偏差 :"; LL_TrajRemark.Text = "路径说明:"; LL_TrajArray.Text = "路径阵列:"; LL_Circle.Text = "圆弧度配置:"; LL_Delay.Text = "延时:"; LL_DownLead.Text = "引线配置:"; } }
/// <summary> /// 得到列表 /// </summary> /// <param name="ent"></param> /// <returns></returns> public List <BuScheduleApply> GetBuScheduleApplyList(string Where) { List <BuScheduleApply> list = new List <BuScheduleApply>(); using (DbDataReader reader = DataBaseManage.ExecuteReader(DalSql + Where)) { while (reader.Read()) { BuScheduleApply ent = new BuScheduleApply(); SetEnt(ent, reader); list.Add(ent); } } return(list); }
/// <summary> /// 得到列表 /// </summary> /// <param name="ent"></param> /// <returns></returns> public List <syslogInfo> GetsyslogList(string Where) { List <syslogInfo> list = new List <syslogInfo>(); using (DbDataReader reader = DataBaseManage.ExecuteReader(DalSql + Where)) { while (reader.Read()) { syslogInfo ent = new syslogInfo(); SetEnt(ent, reader); list.Add(ent); } } return(list); }
/// <summary> /// 得到列表 /// </summary> /// <param name="ent"></param> /// <returns></returns> public List <BuGastankRepair> GetBuGastankRepairList(string Where) { List <BuGastankRepair> list = new List <BuGastankRepair>(); using (DbDataReader reader = DataBaseManage.ExecuteReader(DalSql + Where)) { while (reader.Read()) { BuGastankRepair ent = new BuGastankRepair(); SetEnt(ent, reader); list.Add(ent); } } return(list); }
/// <summary> /// 得到列表 /// </summary> /// <param name="ent"></param> /// <returns></returns> public List <BuWorkFlow> GetBuWorkFlowList(string Where) { List <BuWorkFlow> list = new List <BuWorkFlow>(); using (DbDataReader reader = DataBaseManage.ExecuteReader(DalSql + Where)) { while (reader.Read()) { BuWorkFlow ent = new BuWorkFlow(); SetEnt(ent, reader); list.Add(ent); } } return(list); }
/// <summary> /// 得到列表 /// </summary> /// <param name="ent"></param> /// <returns></returns> public List <BuWFRelationship> GetBuWFRelationshipList(string Where) { List <BuWFRelationship> list = new List <BuWFRelationship>(); using (DbDataReader reader = DataBaseManage.ExecuteReader(DalSql + Where)) { while (reader.Read()) { BuWFRelationship ent = new BuWFRelationship(); SetEnt(ent, reader); list.Add(ent); } } return(list); }
public Frm_Main() { //卸载与安装 if (!File.Exists(Application.StartupPath+"\\LasMAN.mdb")&&File.Exists(Application.StartupPath+"\\Backup\\LasMAN.mdb")) { File.Copy(Application.StartupPath + "\\Backup\\LasMAN.mdb", Application.StartupPath + "\\LasMAN.mdb",true); } if (!Directory.Exists(Application.StartupPath+"\\Log")) { Directory.CreateDirectory(Application.StartupPath + "\\Log"); } DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = true; // PublicFunc.ReadXMLConfigure(); InitializeComponent(); BI_ListClose_ItemClick(this, null); // TE_Title.Text = "机器人与装备集成实验系统"; RC_Main.DefaultPageCategory.Expanded = true; RC_Main.Minimized = true; InitSkinGallery(); db = new DataBaseManage(); db.SaveCs8cConfigure(); // PublicFunc.ReadCs8CConfigure(); db.GetRegCode(ref TxtData.XMLConfigure.RegCode); db.GetIp(ref TxtData.XMLConfigure.IpAddress, ref TxtData.XMLConfigure.RestrictCode); db.GetPopedom(ref TxtData.PublicData.ScreenEnable); TxtData.XMLConfigure.User = db.GetAutoLogin(); if (TxtData.XMLConfigure.User != null) { TxtData.XMLConfigure.Login = true; TxtData.XMLConfigure.PopeDom = db.GetUserPopm(TxtData.XMLConfigure.User); db.AddLog(TxtData.XMLConfigure.User + "登录"); } PublicFunc.ReadXMLConfigure(); poll = new Thread(new ThreadStart(PublicFunc.Poll)); poll.Start(); }
private void TrajInfor() { if (gv.RowCount == 0 || gv.GetSelectedRows().Length < 1) { return; } double[] Offset = new double[6]; double[] Array = new double[6]; double[] Downlead = new double[6]; double[] Axis = new double[6]; double[] Para = new double[6]; double[] Frame = new double[6]; string Remark = ""; // string TrajName = ""; string TypeName = ""; string[] DownleadType = new string[] {"无", "直线", "圆弧"}; DataBaseManage db = new DataBaseManage(); if (db.GetTraj(RecipeName, gv.GetSelectedRows()[0] + 1, ref TrajName, ref TypeName, ref Frame, ref Offset, ref Array, ref Downlead, ref Axis, ref Para, ref Remark)) { // LL_TrajRemark.Text = "路径说明:" + Remark; } else { // LL_TrajRemark.Text = "路径说明:"; TrajName = null; } }
void Poll(object target) { DataBaseManage db = new DataBaseManage(); if (!db.SavePreset()) { TxtData.PublicData.ErrorCode = 1; return; } if (!db.SaveAction()) { TxtData.PublicData.ErrorCode = 2; return; } if (!db.SaveProduct(CBE_RecipeName.EditValue.ToString())) { TxtData.PublicData.ErrorCode = 34; return; } FtpClient ftp = new FtpClient(TxtData.XMLConfigure.IpAddress); //******************************************* //匹配tool 2013.10.15 //匹配home if (!ftp.DownLoadConfigure()||!PublicFunc.ReadCs8CConfigure()) { TxtData.PublicData.ErrorCode = 43; return; } double[] tool = db.GetTool(); if (tool==null||tool.Length!=6||TxtData.CS8CConfigure.Tool==null||TxtData.CS8CConfigure.Tool.Length!=6) { TxtData.PublicData.ErrorCode = 42; return; } for (int i = 0; i < 6;i++) { if (tool[i]!=TxtData.CS8CConfigure.Tool[i]) { TxtData.PublicData.ErrorCode = 42; return; } } //home double[] home = db.GetHome(); if (home == null || home.Length != 6 || TxtData.CS8CConfigure.Home== null || TxtData.CS8CConfigure.Home.Length != 6) { TxtData.PublicData.ErrorCode = 44; return; } for (int i = 0; i < 6; i++) { if (home[i] != TxtData.CS8CConfigure.Home[i]) { TxtData.PublicData.ErrorCode = 44; return; } } //************************************** if (!ftp.UpLoadPreset()) { TxtData.PublicData.ErrorCode = 21; return; } if (!ftp.UploadAction()) { TxtData.PublicData.ErrorCode = 22; return; } if (!ftp.UpLoadRecipe()) { TxtData.PublicData.ErrorCode = 23; return; } if (TxtData.CS8CConfigure.EnableItem[7] || TxtData.CS8CConfigure.EnableItem[6]) { if (!SoapInstance.SoapRead.SetAppdata("nWorkPlaceIndex", WorkPlace)) { TxtData.PublicData.ErrorCode = 24; return; } } if (!SoapInstance.SoapRead.SetAppdata("nInterfaceType", 5)) { TxtData.PublicData.ErrorCode = 24; return; } db.AddLog("调试产品"+CBE_RecipeName.Text); while (TxtData.DataBase.InterfaceType == 9) { System.Threading.Thread.Sleep(10); } TxtData.PublicData.ErrorCode = 40; }
/// <summary> /// 把生产个数给保存下来 /// </summary> public static void ReadProductCount() { if (TxtData.DataBase.ProductName != null && TxtData.DataBase.InterfaceType == 9 && TxtData.DataBase.WorkPlaceProductCount != null) { int len = 0; for (int j = 0; j < TxtData.DataBase.WorkPlaceProductCount.Length; j++) { len = len + TxtData.DataBase.WorkPlaceProductCount[j]; } if (len == 0) { return; } try { DataBaseManage db = new DataBaseManage(); for (int i = 1; i <= 4; i++) { if (TxtData.DataBase.ProductName.Length >i && TxtData.DataBase.WorkPlaceProductCount.Length > i && TxtData.DataBase.WorkPlaceProductCount[i] > 0) { db.AddProductCount(i, TxtData.DataBase.Custom, TxtData.DataBase.ProductName[i], TxtData.DataBase.WorkPlaceProductCount[i]); SoapInstance.SoapRead.SetAppdata("nWpProduct[" + i.ToString() + "]", 0); } } } catch (System.Exception ex) { } } }
void PollImport(object target) { DataBaseManage db = new DataBaseManage(); switch (OperIndex) { //导出 case 1: { TxtData.PublicData.ErrorCode = (db.SaveProduct(FileName, CBE_RecipeName.EditValue.ToString())) ? 40 : 34; break; } //删除产品 case 2: { TxtData.PublicData.ErrorCode = (db.DeleteRecipe(CBE_RecipeName.EditValue.ToString())) ? 40 : 32; break; } //导入 case 3: { if (PublicFunc.SaveNCFile(Application.StartupPath + "\\Txt\\NCFile.txt", PublicFunc.ReadNCFile(FileName),TxtData.CS8CConfigure.Tool)) { FileName = Application.StartupPath + "\\Txt\\NCFile.txt"; } TxtData.PublicData.ErrorCode = PublicFunc.IsTool(FileName)? 0 : 41; if (TxtData.PublicData.ErrorCode != 0) { return; } TxtData.PublicData.ErrorLine=db.ImportProduct(FileName, CBE_RecipeName.EditValue.ToString()); TxtData.PublicData.ErrorCode = (TxtData.PublicData.ErrorLine== 0) ? 40 : 20; // return; break; } //删除路径 case 4: { //2013.11.19 //TxtData.PublicData.ErrorCode = (db.DeleteTraj(TrajName,true)) ? 40 : 32; TxtData.PublicData.ErrorCode = (db.DeleteTraj(CBE_RecipeName.EditValue.ToString(),TxtData.PublicData.DeleteTrajIndex)) ? 40 : 32; break; } } }
void PollImport(object target) { DataBaseManage db = new DataBaseManage(); TxtData.PublicData.ErrorCode = db.DeleteLog() ? 40 : 35; }
void TrajInfor() { if (gv.RowCount==0||gv.GetSelectedRows().Length<1) { return; } double[] Offset = new double[6]; double[] Array = new double[6]; double[] Downlead = new double[6]; double[] Axis = new double[6]; double[] Para = new double[6]; string Remark = ""; // string TrajName = ""; string TypeName = ""; string[] DownleadType = new string[] { "无","直线","圆弧"}; DataBaseManage db = new DataBaseManage(); if (db.GetTraj(CBE_RecipeName.EditValue.ToString(), gv.GetSelectedRows()[0] + 1, ref TrajName, ref TypeName, ref Frame, ref Offset, ref Array, ref Downlead,ref Axis, ref Para, ref Remark)) { //LL_RecipeFrame.Text = "用户坐标系:" + "X->" + Frame[0].ToString() + " Y->" + Frame[1].ToString() + " Z->" + Frame[2].ToString() + " RX->" + Frame[3].ToString() + " RY->" + Frame[4].ToString() + " RZ->" + Frame[5].ToString(); //LL_RecipeOffset.Text = "产品偏差:" + "X->" + Offset[0].ToString() + " Y->" + Offset[1].ToString() + " Z->" + Offset[2].ToString() + " RX->" + Offset[3].ToString() + " RY->" + Offset[4].ToString() + " RZ->" + Offset[5].ToString(); LL_TrajFrame.Text = "路径坐标系:" + Frame[0].ToString() + "->" + Frame[1].ToString() + "->" + Frame[2].ToString() + "->" + Frame[3].ToString() + "->" + Frame[4].ToString() + "->" + Frame[5].ToString(); LL_TrajOffset.Text = "路径偏差 :" + Offset[0].ToString() + "->" + Offset[1].ToString() + "->" + Offset[2].ToString() + "->" + Offset[3].ToString() + "->" + Offset[4].ToString() + "->" + Offset[5].ToString(); LL_TrajRemark.Text = "路径说明:" + Remark; LL_TrajArray.Text = "路径阵列:" + Array[0].ToString() + "->" + Array[1].ToString() + "->" + Array[2].ToString() + "->" + Array[3].ToString() + "->" + Array[4].ToString() + "->" + Array[5].ToString(); LL_Circle.Text = "圆直径:"+Downlead[4].ToString()+" 圆弧度(焊):"+Downlead[5].ToString(); LL_Delay.Text = "延时:" + "激光开->" + Para[0].ToString() + " 激光关->" + Para[1].ToString(); LL_DownLead.Text = "引线配置:引入->" +DownleadType[ (int)Downlead[0]] + " 引出->" +DownleadType[ (int)Downlead[2]]; } else { TrajName = null; LL_TrajFrame.Text = "路径坐标系:"; LL_TrajOffset.Text = "路径偏差 :"; LL_TrajRemark.Text = "路径说明:"; LL_TrajArray.Text = "路径阵列:"; LL_Circle.Text = "圆弧度配置:"; LL_Delay.Text = "延时:"; LL_DownLead.Text = "引线配置:"; } }