private void timer1_Tick(object sender, EventArgs e) { double sd = 0.0; TableManage.TableDriver("运动平台")._GetAdc(2, out sd); if (sd > 0.6) { Thread.Sleep(10); time = time + (float)4; DateSave.Instance().Production.WeldDate.Add((DateSave.Instance().Production.WeldPower / 8) * (float)sd); // curveGraph1. } if (sd < 0.6 && sd > 0.1) { // curveGraph1.ShowCurve(0, 0); } else { //for (int i=0;i< DateSave.Instance().Production.WeldDate.Count;i++) //{ // curveGraph1.ShowCurve(DateSave.Instance().Production.WeldDate[i],i/ DateSave.Instance().Production.WeldDate.Count); //} } }
public void RunHome(object HubNum) { MainModule.FormMain.bHomeReady = false; TableManage.TableDriver("运动平台").Home(TableAxisName.Z); Thread.Sleep(200); while (true) { if (DateSave.Instance().Production.EStop == true) { threadList[0].Abort(); } if (TableManage.TableDriver("运动平台").HomeDone(TableAxisName.Z)) { Weld_Log.Instance().Enqueue(LOG_LEVEL.LEVEL_3, "[运动平台],Z轴回原完成"); break; } } if (DateSave.Instance().Production.WeldOther == 1) { TableManage.TableDriver("运动平台").Home(TableAxisName.X); TableManage.TableDriver("运动平台").Home(TableAxisName.Y); Thread.Sleep(200); // TableManage.TableDriver("运动平台").Home(TableAxisName.Z); while (true) { if (DateSave.Instance().Production.EStop == true) { threadList[0].Abort(); } if (TableManage.TableDriver("运动平台").HomeDone(TableAxisName.X) && TableManage.TableDriver("运动平台").HomeDone(TableAxisName.Y) /*&& TableManage.TableDriver("运动平台").HomeDone(TableAxisName.Z)*/) { Weld_Log.Instance().Enqueue(LOG_LEVEL.LEVEL_3, "[运动平台],XY轴回原完成"); break; } } MainModule.FormMain.bHomeReady = true; threadList[0].Abort(); } else { TableManage.TableDriver("运动平台").Home(TableAxisName.X); TableManage.TableDriver("运动平台").Home(TableAxisName.Y); TableManage.TableDriver("运动平台").Home(TableAxisName.U); while (true) { if (DateSave.Instance().Production.EStop == true) { threadList[0].Abort(); } if (TableManage.TableDriver("运动平台").HomeDone(TableAxisName.X) && TableManage.TableDriver("运动平台").HomeDone(TableAxisName.Y) && TableManage.TableDriver("运动平台").HomeDone(TableAxisName.U)) { Weld_Log.Instance().Enqueue(LOG_LEVEL.LEVEL_3, "[运动平台],XY轴回原完成"); break; } } MainModule.FormMain.bHomeReady = true; threadList[0].Abort(); } }
public bool Asix_Arc_Run(string PlatformName, string Position, int stime, int R) { bool sta = false; DateTime starttime = DateTime.Now; double X = TableManage.TablePosItem(PlatformName, Position).dPosX; double Y = TableManage.TablePosItem(PlatformName, Position).dPosY; bool ArcXYMove = TableManage.TableDriver(PlatformName).ArcMove(TableManage.tablesDoc.m_tableDictionary[PlatformName].axisXData.dAcc, TableManage.tablesDoc.m_tableDictionary[PlatformName].axisXData.dDec, TableManage.tablesDoc.m_tableDictionary[PlatformName].axisXData.dSpeed, X, Y, R, 0, (CoordinateType)0); for (int i = 0; i < 3; i++) { if (ArcXYMove == true) { break; } else { Thread.Sleep(10); ArcXYMove = TableManage.TableDriver(PlatformName).ArcMove(0.50, 0.50, 0.50, X, Y, 5, 0, (CoordinateType)0); } } bool ArcXYMove_run = TableManage.TableDriver(PlatformName).StartCure(false); if (ArcXYMove_run == true) { ArcXYMove_run = true; } else { ArcXYMove_run = false; return(ArcXYMove_run); } while (true) { DateTime endtime = DateTime.Now; TimeSpan spantime = endtime - starttime; if (spantime.TotalMilliseconds > stime) { sta = false; break; } int iStep = 0; TableManage.TableDriver(PlatformName).CureMoveDone(out iStep); if (iStep == 0) { sta = true; break; } if (DateSave.Instance().Production.IsStop == true) { sta = true; break; } if (DateSave.Instance().Production.EStop == true) { sta = true; break; } } return(sta); }
public bool High_Asix_Line_Run(string PlatformName, string Position, int stime, double X_Setover, double Y_Setover, double X_Camer, double Y_Camer) { bool sta = false; DateTime starttime = DateTime.Now; double X = TableManage.TablePosItem(PlatformName, Position).dPosX + X_Setover + X_Camer; double Y = TableManage.TablePosItem(PlatformName, Position).dPosY + Y_Setover + Y_Camer; bool LineXYZMove = TableManage.TableDriver(PlatformName).LineXYZMove(TableManage.tablesDoc.m_tableDictionary[PlatformName].axisXData.dAcc, TableManage.tablesDoc.m_tableDictionary[PlatformName].axisXData.dDec, TableManage.tablesDoc.m_tableDictionary[PlatformName].axisXData.dSpeed, X, Y, 500); for (int i = 0; i < 3; i++) { if (LineXYZMove == true) { break; } else { Thread.Sleep(10); LineXYZMove = TableManage.TableDriver(PlatformName).LineXYZMove(TableManage.tablesDoc.m_tableDictionary[PlatformName].axisXData.dAcc, TableManage.tablesDoc.m_tableDictionary[PlatformName].axisXData.dDec, TableManage.tablesDoc.m_tableDictionary[PlatformName].axisXData.dSpeed, X, Y, 500); } } TableManage.TableDriver(PlatformName).StartCure(false); int iStep1 = 0; TableManage.TableDriver(PlatformName).CureMoveDone(out iStep1); if (iStep1 == 0) { } else { } while (true) { DateTime endtime = DateTime.Now; TimeSpan spantime = endtime - starttime; double CurrentX = TableManage.TableDriver(PlatformName).CurrentX; double CurrentY = TableManage.TableDriver(PlatformName).CurrentY; if ((X - 0.01 < CurrentX && X + 0.01 > CurrentX) && (Y - 0.01 < CurrentY && Y + 0.01 > CurrentY)) { sta = true; break; } if (spantime.TotalMilliseconds > stime) { sta = false; break; } if (DateSave.Instance().Production.IsStop == true) { sta = true; break; } if (DateSave.Instance().Production.EStop == true) { sta = true; break; } } return(sta); }
protected void Page_Load(object sender, EventArgs e) { TableManage condition = new TableManage(); m_tableManageList = TableOperate <TableManage> .SelectByPage(condition, PageSize, PageIndex, ref Count); DataBind(); }
public static void InitHardware() { AddRunMessage(">Hardware initialize...", OutputLevel.Trace); HardwareManage.InitHardware(); TableManage.InitTables(); IOManage.InitDrivers(); VisionManage.VisionInit(); AddRunMessage(">System init ok.", OutputLevel.Trace); }
public double 调高数据() { double high = 0.0; // double ad = MainControls.ProductionData.Production.BaselineSimulation;//、、 获取基准模拟量 double ad = DateSave.Instance().Production.BaselineSimulation;//、、 获取基准模拟量 double date = 0.0; Thread.Sleep(100); TableManage.TableDriver("运动平台")._GetAdc(1, out date); //当前模拟量 double ad12 = DateSave.Instance().Production.Z_AxialDatum; //获取Z基准坐标 double sf = ad - date; if (sf > 0) { double s = Math.Abs(sf); double z = s / DateSave.Instance().Production.High_Date; // double afaf = TableManage.TablePosItem("运动平台", "调高基准点坐标").c; double CurrentZA = TableManage.TableDriver("运动平台").CurrentZ; double NeedCurrentZA = CurrentZA - z; //TableManage.TableDriver("运动平台").AbsMove(TableAxisName.Z, // NeedCurrentZA, TableManage.tablesDoc.m_tableDictionary["运动平台"].axisZData.dSpeed); if (CurrentZA + 5 < NeedCurrentZA && CurrentZA - 5 > NeedCurrentZA) { high = NeedCurrentZA; } else { high = 0.0; } //RunClass.Meth.Asix_one_Run("运动平台", "调高基准点坐标", 2, 60000); } else { double s = Math.Abs(sf); double z = s / DateSave.Instance().Production.High_Date; // double afaf = TableManage.TablePosItem("运动平台", "调高基准点坐标").c; double CurrentZA = TableManage.TableDriver("运动平台").CurrentZ; double NeedCurrentZA = CurrentZA + z; if (CurrentZA + 5 < NeedCurrentZA && CurrentZA - 5 > NeedCurrentZA) { high = NeedCurrentZA; } else { high = 0.0; } //RunClass.Meth.Asix_one_Run("运动平台", "调高基准点坐标", 2, 60000); } return(high); }
public static void LoadDoc() { AddRunMessage(">Load document...", OutputLevel.Trace); HardwareManage.LoadDoc(); TableManage.LoadDoc(); DataManage.LoadData(); IOManage.LoadObj(); VisionManage.LoadDoc(); alarmManage.LoadDoc(); }
public static string ExportALL() { decimal money = 0; string msg = ""; string temp = ""; switch (states) { case 0: temp = TableManage.ExportOutflow(storeID, out msg, out money); break; case 1: temp = TableManage.ExportConbinationOutflow(storeID, JsonConvert.SerializeObject(searchContext), out msg, out money); break; } return(temp != null?JsonConvert.SerializeObject(new Packet(200, temp, $"{states}")) : JsonConvert.SerializeObject(new Packet(201, "该搜索条件下没有需要导出的记录"))); }
private static void CcdClient_C3TaskEvent() { string ret = "C3"; for (int i = 1; i <= 9; i++) { ret += ","; ret += TableManage.TablePosItem("打标平台", "精定位" + i).dPosX; ret += ","; ret += TableManage.TablePosItem("打标平台", "精定位" + i).dPosY; } ret += "\r\n"; ccdClient.Send(ret); }
public static string GetDown() { string temp = ""; string msg = ""; decimal money = 0; switch (states) { case 0: temp = TableManage.queryAllInflow(storeID, ref totalPage, ref currentPage, out msg, out money); break; case 1: temp = TableManage.InflowCombinationQuery(storeID, JsonConvert.SerializeObject(searchContext), out msg, ref totalPage, ref currentPage, out money); break; } return(temp != null?JsonConvert.SerializeObject(new Packet(200, temp, $"{totalPage + 1}+{currentPage + 1}+{money}+{states}")) : JsonConvert.SerializeObject(new Packet(201, msg))); }
private static void CcdClient_C2TaskEvent() { string ret = "C2"; for (int i = 1; i <= 9; i++) { ret += ","; ret += TableManage.TablePosItem("移载喷码平台", "喷码标定位" + i).dPosX; ret += ","; ret += TableManage.TablePosItem("移载喷码平台", "喷码标定位" + i).dPosU; } ret += "\r\n"; ccdClient.Send(ret); }
private static void CcdClient_C1TaskEvent() { //C1,0.0,0.1,0.2,03 string ret = "C1"; for (int i = 1; i <= 9; i++) { ret += ","; ret += TableManage.TablePosItem("打标平台", "上料托盘标定位" + i).dPosX; ret += ","; ret += TableManage.TablePosItem("打标平台", "上料托盘标定位" + i).dPosY; } ret += "\r\n"; ccdClient.Send(ret); }
public static string GetALLInflow() { if (currentPage != -1) { currentPage--; } decimal money = 0; states = 0; string msg; //TODO:此处的ID将来换成从session中取 string jsonData = TableManage.queryAllInflow(storeID, ref totalPage, ref currentPage, out msg, out money); return(jsonData != null?JsonConvert.SerializeObject(new Packet(200, jsonData, $"{totalPage + 1}+{currentPage + 1}+{money}+{states}+{storeID}", JsonConvert.SerializeObject(store))) : JsonConvert.SerializeObject(new Packet(201, msg))); }
public static string AddTable(TableManage tableManage) { //SELECT OBJECT_ID(N'[PK_BaoXiaoGuanLi1]') string[] ziduanZWArr = tableManage.ZhongWenZiDuan.Split(','); string[] ziduanArr = tableManage.ZiDuan.Split(','); string[] ziduanTypeArr = tableManage.ZiDuanType.Split(','); string pk_name = "PK_" + tableManage.EnglishName; while (GetZuJIanCount(pk_name) > 0) { pk_name += "1"; } string sql = "create table " + tableManage.EnglishName + "("; // string sql = @"create table " + tableManage.EnglishName + @"( // [ID] [int] IDENTITY(1,1) NOT NULL, // [XTAddTime] [datetime] NULL, // [XTAddID] [int] NULL, // [XTAddName] [nvarchar](50) NULL, // [XTShenPi] [nvarchar](max) NULL, // [XTShenPiResult] [nvarchar](max) NULL, // [XTDingDing] [nvarchar](max) NULL, // [XTDingDingResult] [nvarchar](max) NULL, //"; for (int i = 0; i < ziduanZWArr.Length; i++) { if (ziduanArr[i] == "ID") { sql += "[ID] [int] IDENTITY(1,1) NOT NULL, "; } else { sql += "[" + ziduanArr[i] + "] " + ConvertType(ziduanTypeArr[i]) + " NULL,"; } } sql += @" CONSTRAINT [" + pk_name + @"] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] "; SQL.Exesql(sql); //return sql; //Projector p = new Projector(); //TableOperate<Projector>.Execute(sql, p); return(sql); }
public void setStartManualPulserOperation(string IOAsix, string Speed) { if (IOAsix == "手轮X") { if (Speed == "手轮1") { TableManage.TableDriver("运动平台").StartManualPulser(1, 1); } else if (Speed == "手轮10") { TableManage.TableDriver("运动平台").StartManualPulser(1, 10); } else if (Speed == "手轮100") { TableManage.TableDriver("运动平台").StartManualPulser(1, 50); } } if (IOAsix == "手轮Y") { if (Speed == "手轮1") { TableManage.TableDriver("运动平台").StartManualPulser(2, 1); } else if (Speed == "手轮10") { TableManage.TableDriver("运动平台").StartManualPulser(2, 10); } else if (Speed == "手轮100") { TableManage.TableDriver("运动平台").StartManualPulser(2, 50); } } if (IOAsix == "手轮Z") { if (Speed == "手轮1") { TableManage.TableDriver("运动平台").StartManualPulser(3, 1); } else if (Speed == "手轮10") { TableManage.TableDriver("运动平台").StartManualPulser(3, 10); } else if (Speed == "手轮100") { TableManage.TableDriver("运动平台").StartManualPulser(3, 50); } } }
protected void Page_Load(object sender, EventArgs e) { Result result = new Result(); JavaScriptSerializer js = new JavaScriptSerializer(); if (string.IsNullOrEmpty(this.Request["iD"])) { result.msg = "请选择要删除的对象"; } else { int iD = Convert.ToInt32(this.Request["iD"]); TableManage condition = new TableManage(); condition.ID = iD; TableManage tableManage = TableOperate <TableManage> .GetRowData(condition); BuildSqlTable.DelTable(tableManage.EnglishName); string buildModePath = Request.PhysicalApplicationPath + "\\App_Code\\DataProvider\\Table"; string newFileName = buildModePath + "\\" + StringDeal.HeadUpper(tableManage.EnglishName) + ".cs"; if (File.Exists(newFileName)) { File.Delete(newFileName); } string buildPath = Request.PhysicalApplicationPath + "\\Admin\\Manage" + StringDeal.HeadUpper(tableManage.EnglishName); if (Directory.Exists(buildPath)) { Directory.Delete(buildPath, true); } if (TableOperate <TableManage> .Delete(iD) > 0) { result.isOk = true; } else { result.msg = "删除失败"; } } Response.ContentType = "text/json"; Response.Write(js.Serialize(result)); Response.End(); }
private void StopClick() { //ComeOut.parse = false; isRunFinish = false; count = 0; IOManage.OUTPUT("焊接机允许入料").SetOutBit(false); TableManage.TableDriver("运动平台").Stop(TableAxisName.X); TableManage.TableDriver("运动平台").Stop(TableAxisName.Y); TableManage.TableDriver("运动平台").Stop(TableAxisName.Z); // RunClass.Instance().Stop = true; RunClass.Instance().RunClass_IsFinish = false; RunClass.Instance().StartRun = false; DateSave.Instance().Production.IsStop = true; MainControls.taskInfo.iTaskStep = (int)MainControl.flowCharNew.接进料流程; MainControl.Weld_Sta = "空闲中"; }
private void OpenFile() { try { bool bErr = false; string strFullPath = ""; OpenFileDialog dialog = new OpenFileDialog(); dialog.Multiselect = false; dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); dialog.Title = "配方读取"; dialog.RestoreDirectory = false; if (dialog.ShowDialog() != DialogResult.OK) { return; } strFullPath = dialog.FileName; TableDoc doc = TableDoc.LoadObj(strFullPath, ref bErr); if (bErr) { MessageBox.Show("不是正确的配方文件!", "", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); return; } TableManage.docTable = doc; TableManage.InitTables(); if (null != eventTableDataReLoad) { this.eventTableDataReLoad(); } MessageBox.Show("加载成功!", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); } catch (Exception ex) { TableManage.strConfigFile = string.Empty; MessageBox.Show("加载失败!\r\n" + ex.ToString(), "", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); } }
public bool Asix_Two_Run(string PlatformName, string Position, int stime) { bool sta = false; DateTime starttime = DateTime.Now; TableManage.TableDriver(PlatformName).AbsMove(TableAxisName.X, TableManage.TablePosItem(PlatformName, Position).dPosX, TableManage.tablesDoc.m_tableDictionary[PlatformName].axisXData.dSpeed); TableManage.TableDriver(PlatformName).AbsMove(TableAxisName.Y, TableManage.TablePosItem(PlatformName, Position).dPosY, TableManage.tablesDoc.m_tableDictionary[PlatformName].axisYData.dSpeed); while (true) { DateTime endtime = DateTime.Now; TimeSpan spantime = endtime - starttime; if (TableManage.TableDriver(PlatformName).MoveDone(TableAxisName.X) && TableManage.TableDriver(PlatformName).MoveDone(TableAxisName.Y)) { sta = true; break; } if (spantime.TotalMilliseconds > stime) { sta = false; break; } if (DateSave.Instance().Production.IsStop == true) { sta = true; break; } if (DateSave.Instance().Production.EStop == true) { sta = true; break; } } return(sta); }
private void timer1_Tick(object sender, EventArgs e) { if (MainControl.Weld_Sta != "") { lb_LeftStation.Text = MainControl.Weld_Sta; } //if (DateSave.Instance().Production.Door_Enable == true) //{ // DoorShow.Text = "门屏蔽"; //} //else //{ // DoorShow.Text = "门未屏蔽"; //} //if () //{ // WeldSta = true; //} if (IOManage.INPUT("锁光出光").On) { 锁光.Text = "可出光"; 锁光.BackColor = Color.Green; IOManage.OUTPUT("外部锁光").SetOutBit(true); } else { 锁光.Text = "已锁光"; 锁光.BackColor = Color.Red; IOManage.OUTPUT("外部锁光").SetOutBit(false); } if (DateSave.Instance().Production.StationMaterial == true) { btn_LeftPosWelding.Text = "工位有料"; } else { btn_LeftPosWelding.Text = "工位无料"; } if ((mes.Instance().DataReceivedstrSN != "" && LeftSnshow.Text == "") || (LeftSnshow.Text != mes.Instance().DataReceivedstrSN)) { LeftSnshow.Text = mes.Instance().DataReceivedstrSN; } try { if ((DateSave.Instance().Production.WeldDate.Average() != 0 && lb_LeftMarkPower.Text == "") || (lb_LeftMarkPower.Text != DateSave.Instance().Production.WeldDate.Average().ToString())) { lb_LeftMarkPower.Text = Math.Round(DateSave.Instance().Production.WeldDate.Average(), 1).ToString(); } } catch { } if ((DateSave.Instance().Production.OK_date != 0 && lb_LeftYield.Text == "") || (lb_LeftYield.Text != DateSave.Instance().Production.OK_date.ToString())) { lb_LeftYield.Text = DateSave.Instance().Production.OK_date.ToString(); } if ((DateSave.Instance().Production.Weld_Speed != 0 && lb_LeftMarkSpeed.Text == "") || (lb_LeftMarkSpeed.Text != DateSave.Instance().Production.Weld_Speed.ToString())) { lb_LeftMarkSpeed.Text = DateSave.Instance().Production.Weld_Speed.ToString(); } if (lb_LeftPos.Text != DateSave.Instance().Production.TheCurrentpoint.ToString()) { lb_LeftPos.Text = DateSave.Instance().Production.TheCurrentpoint.ToString(); } if ((DateSave.Instance().Production.CTtime != "" && lb_LeftCT.Text == "") || (lb_LeftCT.Text != DateSave.Instance().Production.CTtime)) { lb_LeftCT.Text = DateSave.Instance().Production.CTtime; } if (DateSave.Instance().Production.ModelNo != "" && 当前机种号.Text == "NUM" || 当前机种号.Text != DateSave.Instance().Production.ModelNo) { 当前机种号_.Text = DateSave.Instance().Production.ModelNo; 当前机种号.Text = DateSave.Instance().Production.ModelNo; } if (Socket_server.Instance().recvDate != "") { lb_RightMarkSpeed.Text = Socket_server.Instance().recvDate; } if ((DateSave.Instance().Production.Current_TIME != 0 && 清理铜嘴次数.Text == "") || (清理铜嘴次数.Text != DateSave.Instance().Production.Current_TIME.ToString())) { 清理铜嘴次数.Text = DateSave.Instance().Production.Current_TIME.ToString(); } if (DateSave.Instance().Production.Clear_TIME == DateSave.Instance().Production.Current_TIME) { MainControl.BIZZ("请清理铜嘴", "请清理铜嘴"); DateSave.Instance().Production.Current_TIME++; } if (frist == 0 && LoginForm.landingFinish == true) { frist++; asc.AddControl(panel2); } if (frist == 1) { this.Top = 0; this.Left = 0; frist++; delay(1000); int Width = Screen.PrimaryScreen.WorkingArea.Width; int Height = Screen.PrimaryScreen.WorkingArea.Height; int wih = MainModule.FormMain.Width; int aq1e = panel2.Width; int aqe = panel2.Height; panel2.SetBounds(asc.oldCtrl[0].Top, asc.oldCtrl[0].Left, Width, aqe); Thread.Sleep(100); if (asc.oldCtrl.Count > 0) { asc.controlAutoSize(panel2); } } double sd = 0.0; TableManage.TableDriver("运动平台")._GetAdc(1, out sd); if (startHoming || MainModule.FormMain.bAuto) { } else if (IOManage.INPUT("手轮X").On || IOManage.INPUT("手轮Y").On || IOManage.INPUT("手轮Z").On || IOManage.INPUT("手轮U").On) { if (IOManage.INPUT("手轮X").On&& setOk == false) { if (IOManage.INPUT("手轮1").On) { setOk = true; TableManage.TableDriver("运动平台").StartManualPulser(1, 1); } else if (IOManage.INPUT("手轮10").On) { setOk = true; TableManage.TableDriver("运动平台").StartManualPulser(1, 10); } else if (IOManage.INPUT("手轮100").On) { setOk = true; TableManage.TableDriver("运动平台").StartManualPulser(1, 50); } } if (IOManage.INPUT("手轮Y").On&& setOk == false) { if (IOManage.INPUT("手轮1").On) { setOk = true; TableManage.TableDriver("运动平台").StartManualPulser(2, 1); } else if (IOManage.INPUT("手轮10").On) { setOk = true; TableManage.TableDriver("运动平台").StartManualPulser(2, 10); } else if (IOManage.INPUT("手轮100").On) { setOk = true; TableManage.TableDriver("运动平台").StartManualPulser(2, 50); } } if (IOManage.INPUT("手轮Z").On&& setOk == false) { if (IOManage.INPUT("手轮1").On) { setOk = true; TableManage.TableDriver("运动平台").StartManualPulser(3, 1); } else if (IOManage.INPUT("手轮10").On) { setOk = true; TableManage.TableDriver("运动平台").StartManualPulser(3, 10); } else if (IOManage.INPUT("手轮100").On) { setOk = true; TableManage.TableDriver("运动平台").StartManualPulser(3, 50); } } if (IOManage.INPUT("手轮U").On&& setOk == false) { if (IOManage.INPUT("手轮1").On) { setOk = true; TableManage.TableDriver("运动平台").StartManualPulser(4, 1); } else if (IOManage.INPUT("手轮10").On) { setOk = true; TableManage.TableDriver("运动平台").StartManualPulser(4, 10); } else if (IOManage.INPUT("手轮100").On) { setOk = true; TableManage.TableDriver("运动平台").StartManualPulser(4, 50); } } } else if (IOManage.INPUT("手轮X").Off&& IOManage.INPUT("手轮Y").Off&& IOManage.INPUT("手轮Z").Off&& setOk == true) { setOk = false; TableManage.TableDriver("运动平台").StopManualPulser(0); TableManage.TableDriver("运动平台").StopManualPulser(1); TableManage.TableDriver("运动平台").StopManualPulser(2); TableManage.TableDriver("运动平台").StopManualPulser(3); TableManage.TableDriver("运动平台").StopManualPulser(4); TableManage.TableDriver("运动平台").StopManualPulser(5); TableManage.TableDriver("运动平台").StopManualPulser(6); TableManage.TableDriver("运动平台").StopManualPulser(7); } if (MainModule.FormMain.Parse == false && RunClass.Instance().parse == true) { RunClass.Instance().parse = false; RunClass.Instance().GoOnRun = true; } // if (IOManage.INPUT("文档状态").On) //{ // RunClass.Instance(). WeldFinishSta = "StartWeld"; //} // if (IOManage.INPUT("文档状态").Off) // { // RunClass.Instance().WeldFinishSta = "WeldFinish"; // } //if (StartHome==true) //{ // MainModule.FormMain.bHomeReady = false; // StartHome = false; // MainModule.FormMain.bHomeReady = false; // StartHome = false; HomeDoneZ = false; // TableManage.TableDriver("运动平台").Home(TableAxisName.Z); //} //if (TableManage.TableDriver("运动平台").HomeDone(TableAxisName.Z) && HomeDoneZ == false) //{ // HomeDoneZ = true; // HomeDoneXY = false; //} //if (HomeDoneXY == false) //{ // HomeDoneXY = true; // TableManage.TableDriver("运动平台").Home(TableAxisName.X); // TableManage.TableDriver("运动平台").Home(TableAxisName.Y); //} //if (TableManage.TableDriver("运动平台").HomeDone(TableAxisName.X) && TableManage.TableDriver("运动平台").HomeDone(TableAxisName.Y)&& HomeDoneXY == false) //{ // HomeDoneXY = true; // MainModule.FormMain.bHomeReady = true; //} //string en = ""; //string sendd = ""; //sendd = Weld_Log.Instance().Dequeue(en); //if (sendd != "") //{ // Weld_Log.Instance().WriteLog(LOG_LEVEL.LEVEL_3, sendd, LOG_TYPE.INFO); //} //else //{ // // Thread.Sleep(200); //} if (MainModule.FormMain.bEstop == true) { DateSave.Instance().Production.EStop = true; } //else //{ // DateSave.Instance().Production.EStop = false; //} }
//Projector condition = new Projector(); //condition //string sqlStr = "SELECT count(*) FROM sys.objects WHERE object_id = OBJECT_ID(N'TableManage1') AND type in (N'U')"; //m_num = Convert.ToInt32(TableOperate<Projector>.GetOneValue(sqlStr, condition)); //if (m_num == 1) //{ // //查询列 // //Select name from syscolumns Where ID=OBJECT_ID(N'TableManage') // //获取列 // //插入新列 // //ALTER TABLE distributors ADD COLUMN address varchar(30); // // //} public static string EditTable(TableManage newTable, TableManage oldTable) { string sqlAll = ""; try { // string[] ziduanArr = newTable.ZiDuan.Split(','); string[] ziduanTypeArr = newTable.ZiDuanType.Split(','); string[] oldZiduanArr = oldTable.ZiDuan.Split(','); string[] oldZiduanTypeArr = oldTable.ZiDuanType.Split(','); if (newTable.EnglishName != oldTable.EnglishName) { //string sql = " ALTER TABLE " + oldTable.EnglishName + " RENAME TO " + newTable.EnglishName; string sql = " EXEC sp_rename '" + oldTable.EnglishName + "', '" + newTable.EnglishName + "'"; sqlAll += sql; SQL.Exesql(sql); } if (ziduanArr.Length == oldZiduanArr.Length) { //修改 for (int i = 0; i < ziduanArr.Length; i++) { if (ziduanArr[i] != oldZiduanArr[i]) { //string sql = "ALTER TABLE " + newTable.EnglishName + " RENAME COLUMN " + oldZiduanArr[i] + " TO " + ziduanArr[i] + " "; //string sql = "ALTER TABLE " + newTable.EnglishName + " RENAME COLUMN " + oldZiduanArr[i] + " TO " + ziduanArr[i] + " "; string sql = "EXEC sp_rename '" + newTable.EnglishName + ".[" + oldZiduanArr[i] + "]', '" + ziduanArr[i] + "', 'column'"; sqlAll += sql; SQL.Exesql(sql); } if (ziduanTypeArr[i] != oldZiduanTypeArr[i]) { string sql = "ALTER TABLE " + newTable.EnglishName + " ALTER COLUMN " + ziduanArr[i] + " " + ConvertType(ziduanTypeArr[i]) + " "; sqlAll += sql; SQL.Exesql(sql); } } } else { for (int i = 0; i < ziduanArr.Length; i++) { int index = GetIndex(ziduanArr[i], oldZiduanArr); if (index > -1) { if (ziduanTypeArr[i] != oldZiduanTypeArr[index]) { string sql = "ALTER TABLE " + newTable.EnglishName + " ALTER column " + ziduanArr[i] + " " + ConvertType(ziduanTypeArr[i]) + " "; sqlAll += sql; SQL.Exesql(sql); } } else { string sql = "ALTER TABLE " + newTable.EnglishName + " ADD " + ziduanArr[i] + " " + ConvertType(ziduanTypeArr[i]) + " "; sqlAll += sql; SQL.Exesql(sql); } } //删除表格 for (int i = 0; i < oldZiduanArr.Length; i++) { int index = GetIndex(oldZiduanArr[i], ziduanArr); if (index == -1) { //ALTER TABLE distributors DROP COLUMN address RESTRICT; string sql = "ALTER TABLE " + newTable.EnglishName + " DROP COLUMN " + oldZiduanArr[i] + " "; sqlAll += sql; SQL.Exesql(sql); } } } } catch (Exception ex) { } return(sqlAll); //return true; }
/// <summary> /// 读取数据建立文件 /// </summary> /// <param name="_fileList"></param> public static void BuildSql(TableManage tableManage) { }
public BuildByTemplate(TableManage tableManage, bool bMode) { m_table = tableManage; m_listTable = new List <Table>(); //if (bMode) //{ // AddModeBiXu(); //} //else //{ // TypeUnit typeUnit = ConvertType("2"); // Table table = new Table(); // table.TableName = m_table.EnglishName; // table.ChineseTableName = m_table.Name; // table.Name = "ID"; // table.Brief = "编号"; // table.NetType = typeUnit.NetType; // table.SqlType = typeUnit.SqlType; // table.ConvertString = typeUnit.ConvertString; // table.BIndex = true; // m_listTable.Add(table); //} string[] ziduanZWArr = tableManage.ZhongWenZiDuan.Split(','); string[] ziduanArr = tableManage.ZiDuan.Split(','); string[] ziduanTypeArr = tableManage.ZiDuanType.Split(','); string[] addTypeArr = tableManage.AddType.Split(','); string[] chengYuanArr = tableManage.ChengYuan.Split(','); string[] zhiArr = tableManage.Zhi.Split(','); string[] biXuArr = tableManage.BiXu.Split(','); string[] souSuoArr = tableManage.SouSuo.Split(','); string[] lieBiaoArr = tableManage.LieBiao.Split(','); for (int i = 0; i < ziduanZWArr.Length; i++) { if (ziduanArr[i] == "AddID" || ziduanArr[i] == "AddName" || ziduanArr[i] == "AddTime") { continue; } TypeUnit typeUnit = ConvertType(ziduanTypeArr[i]); Table table = new Table(); table.TableName = tableManage.EnglishName; table.ChineseTableName = tableManage.Name; table.Name = ziduanArr[i]; table.Brief = ziduanZWArr[i]; table.BSearch = souSuoArr[i] == "1"; table.EditType = GetEditStr(addTypeArr[i]); table.Necessary = biXuArr[i] == "1"; table.NetType = typeUnit.NetType; table.SelectMember = chengYuanArr[i]; table.SelectValue = zhiArr[i]; table.SqlType = typeUnit.SqlType; table.ConvertString = typeUnit.ConvertString; table.BIndex = lieBiaoArr[i] == "1"; m_listTable.Add(table); } for (int i = 0; i < ziduanZWArr.Length; i++) { if (ziduanArr[i] == "AddID" || ziduanArr[i] == "AddName" || ziduanArr[i] == "AddTime") { TypeUnit typeUnit = ConvertType(ziduanTypeArr[i]); Table table = new Table(); table.TableName = tableManage.EnglishName; table.ChineseTableName = tableManage.Name; table.Name = ziduanArr[i]; table.Brief = ziduanZWArr[i]; table.BSearch = souSuoArr[i] == "1"; table.EditType = GetEditStr(addTypeArr[i]); table.Necessary = biXuArr[i] == "1"; table.NetType = typeUnit.NetType; table.SelectMember = chengYuanArr[i]; table.SelectValue = zhiArr[i]; table.SqlType = typeUnit.SqlType; table.ConvertString = typeUnit.ConvertString; table.BIndex = lieBiaoArr[i] == "1"; m_listTable.Add(table); } } //if (!bMode) //{ // TypeUnit typeUnit = ConvertType("字符串长度50"); // Table table = new Table(); // table.TableName = m_table.EnglishName; // table.ChineseTableName = m_table.Name; // table.Name = "ID"; // table.Brief = "添加人姓名"; // table.NetType = typeUnit.NetType; // table.SqlType = typeUnit.SqlType; // table.ConvertString = typeUnit.ConvertString; // table.BIndex = true; // m_listTable.Add(table); //} }