Exemple #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.WorkStation model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_Workstation set ");
            strSql.Append("Workstation=@Workstation");
            strSql.Append(" where Wo_ID=@Wo_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Workstation", SqlDbType.VarChar, 15),
                new SqlParameter("@Wo_ID",       SqlDbType.Decimal, 9)
            };
            parameters[0].Value = model.Workstation;
            parameters[1].Value = model.Wo_ID;

            int rows = dbs.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
 //
 //选择站别
 //
 private void cmb_Workstation_Receive_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (cmb_Workstation_Receive.SelectedItem != null)
     {
         _WTT_WK = (Maticsoft.Model.WorkStation)cmb_Workstation_Receive.SelectedItem;
     }
 }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public decimal Add(Maticsoft.Model.WorkStation model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_Workstation(");
            strSql.Append("Workstation)");
            strSql.Append(" values (");
            strSql.Append("@Workstation)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Workstation", SqlDbType.VarChar, 15)
            };
            parameters[0].Value = model.Workstation;

            object obj = dbs.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToDecimal(obj));
            }
        }
 //
 //领料站别—改变站别
 //
 private void cmb_Workstation_Receive_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         _WTT_WK_Receive = (Maticsoft.Model.WorkStation)cmb_Workstation_Receive.SelectedItem;
         cmb_State_Receive.ItemsSource = MCP_CS._M_StateList.GetModelList("Wk_ID='" + _WTT_WK_Receive.Wo_ID + "'");
         if (cmb_State_Receive.Items.Count > 0)
         {
             cmb_State_Receive.SelectedIndex = 0;
         }
     }
     catch (Exception) { throw; }
 }
Exemple #5
0
 //
 //选择投料记录
 //
 private void dgv_source_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         btn_Add.IsEnabled = false;
         isEn(true, false);
         _WTT_Material_Inject       = (Maticsoft.Model.Material_Inject)dgv_source.SelectedItem;
         txb_Count.Text             = _WTT_Material_Inject.Count;
         txb_JobNumber_Receive.Text = _WTT_Material_Inject.UserID;
         _WTT_WK = MCP_CS._M_Workstation.GetModel(decimal.Parse(_WTT_Material_Inject.WK_ID));
         cmb_Workstation_Receive.Text = _WTT_WK.Workstation;
     }
     catch { }
 }
Exemple #6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.WorkStation DataRowToModel(DataRow row)
 {
     Maticsoft.Model.WorkStation model = new Maticsoft.Model.WorkStation();
     if (row != null)
     {
         if (row["Wo_ID"] != null && row["Wo_ID"].ToString() != "")
         {
             model.Wo_ID = decimal.Parse(row["Wo_ID"].ToString());
         }
         if (row["Workstation"] != null)
         {
             model.Workstation = row["Workstation"].ToString();
         }
     }
     return(model);
 }
Exemple #7
0
 //
 //用户列表
 //
 private void dgv_Source_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (dgv_Source.SelectedItem != null)
     {
         _WTT_User = (Maticsoft.Model.sysUser)dgv_Source.SelectedItem;
         //
         txb_Password.Text  = _WTT_User.Password;
         txb_JobNum.Text    = _WTT_User.UserID;
         txb_UserName.Text  = _WTT_User.UserName;
         cmb_Privilege.Text = _WTT_User.Privilege;
         //
         decimal _WK_ID = 0;
         if (decimal.TryParse(_WTT_User.Workstation, out _WK_ID))
         {
             _WTT_Workstation     = _M_Workstation.GetModel(_WK_ID);
             cmb_Workstation.Text = _WTT_Workstation.Workstation;
         }
     }
 }
Exemple #8
0
 //
 //领料—工号
 //
 private void txb_JobNumber_Receive_KeyUp(object sender, KeyEventArgs e)
 {
     Maticsoft.BLL.sysUser _M_User = new Maticsoft.BLL.sysUser();
     if (e.Key == Key.Enter && txb_JobNumber_Receive.IsFocused == true && txb_JobNumber_Receive.Text != "" &&
         txb_JobNumber_Receive.Text != "002222")
     {
         _WTT_User_Receive = _M_User.GetModel(txb_JobNumber_Receive.Text.Trim());
         if (_WTT_User_Receive != null)
         {
             int tem = -1; int.TryParse(_WTT_User_Receive.Workstation, out tem);
             if (tem > -1)
             {
                 cmb_Workstation_Receive.SelectedIndex = tem - 1;
                 _WTT_WK = (Maticsoft.Model.WorkStation)cmb_Workstation_Receive.SelectedItem;
             }
             txb_UserName_Receive.Text = _WTT_User_Receive.UserName;
         }
         else
         {
             txb_JobNumber_Receive.SelectAll();
         }
     }
 }
Exemple #9
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.WorkStation GetModel(string _workstation)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Wo_ID,Workstation from tb_Workstation ");
            strSql.Append(" where Workstation=@Workstation");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Workstation", SqlDbType.VarChar)
            };
            parameters[0].Value = _workstation;

            Maticsoft.Model.WorkStation model = new Maticsoft.Model.WorkStation();
            DataSet ds = dbs.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #10
0
 //
 //选择站别
 //
 private void cmb_Workstation_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     _WTT_Workstation = (Maticsoft.Model.WorkStation)cmb_Workstation.SelectedItem;
 }