static public Object CheckRUsersMachine() { string result = string.Empty; try { string UserId = DNTRequest.GetString("UserId"); #region 获取列表 string where = string.Empty; where = "RecordIsDelete=0 and UserID= " + UserId; R_UsersMachineBLL bll = new R_UsersMachineBLL(); DataTable dt = bll.GetList(where).Tables[0]; string MachineIds = string.Empty; for (int i = 0; i < dt.Rows.Count; i++) { MachineIds = MachineIds + "," + dt.Rows[i]["MachineID"]; } MachineIds = MachineIds.TrimStart(',').TrimEnd(','); MachineBLL MBLL = new MachineBLL(); string sqlMach = string.Empty; sqlMach = "MachineID in (" + MachineIds + ")"; DataTable dt2 = MBLL.GetList(sqlMach).Tables[0]; DataTable dt3 = dt2.DefaultView.ToTable(false, new string[] { "MachineID", "SN", "Address", "Platform", "Longitude", "Latitude" }); for (int j = 0; j < dt3.Rows.Count; j++) { if (dt3.Rows[j]["Platform"].ToString() == "1") { dt3.Rows[j]["Platform"] = "平板"; } else if (dt3.Rows[j]["Platform"].ToString() == "2") { dt3.Rows[j]["Platform"] = "机器"; } else { dt3.Rows[j]["Platform"] = "暂无"; } } //object obj = new //{ // result = true, // code = "", // msg = "", // data = ((dt2 == null) ? (new DataTable()) : (dt2)) //}; result = Newtonsoft.Json.JsonConvert.SerializeObject(dt3); #endregion } catch (Exception ex) { result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null); ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString()); } return(result); }
public SelectKnifeOutForm(string ids, DataTable dt, DataTable dtBak, List <string> listIds, List <string> listMachine) { InitializeComponent(); this.ids = ids; this.dt = dt; this.dtBak = dtBak; this.listIds = listIds; this.listMachine = listMachine; #region 初始化 机床 DataTable dtt = mBll.GetList(); DataView dataViewt = dtt.DefaultView; dataViewt.Sort = "C_ID asc"; cmbMachine.DataSource = dataViewt.ToTable(); cmbMachine.DisplayMember = "C_ID"; cmbMachine.ValueMember = "C_ID"; #endregion }
public SelectKnifeUseForm(string id, DataTable dt, DataTable dtBak) { InitializeComponent(); this.id = id; this.dt = dt; this.dtBak = dtBak; #region 初始化 机床 DataTable dtt = mBll.GetList(); //DataView dataViewt = dtt.DefaultView; //dataViewt.Sort = "C_ID asc"; //cmbMachine.DataSource = dataViewt.ToTable(); cmbMachine.DataSource = dtt.DefaultView; cmbMachine.DisplayMember = "C_ID"; cmbMachine.ValueMember = "C_ID"; cmbMachine.SelectedIndex = -1; #endregion }