Example #1
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     try
     {
         Mod_TPB_CAST_STOVE mod = bll_TPB_SLAB_CAPACITY.GetModel(c_id);
         mod.N_STOVE_MAX_NUM = Convert.ToDecimal(txt_MAX.Text);
         mod.N_STOVE_MIN_NUM = Convert.ToDecimal(txt_MIN.Text);
         mod.N_TARGET_NUM    = Convert.ToDecimal(txt_MBLS.Text);
         mod.C_EMP_ID        = RV.UI.UserInfo.UserID;
         mod.D_MOD_DT        = RV.UI.ServerTime.timeNow();
         if (mod.N_STOVE_MAX_NUM == 0)
         {
             MessageBox.Show("保存失败!最大炉数不能为0!");
             return;
         }
         if (mod.N_STOVE_MIN_NUM == 0)
         {
             MessageBox.Show("保存失败!最小炉数不能为0!");
             return;
         }
         if (mod.N_TARGET_NUM == 0)
         {
             MessageBox.Show("保存失败!目标炉数不能为0!");
             return;
         }
         bll_TPB_SLAB_CAPACITY.Update(mod);
         MessageBox.Show("保存成功!");
         Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "修改钢种整浇次炉数!");//添加操作日志
         this.DialogResult = DialogResult.Cancel;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Mod_TPB_CAST_STOVE model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TPB_CAST_STOVE set ");
            strSql.Append("C_STL_GRD=:C_STL_GRD,");
            strSql.Append("C_STD_CODE=:C_STD_CODE,");
            strSql.Append("N_STOVE_MIN_NUM=:N_STOVE_MIN_NUM,");
            strSql.Append("N_STOVE_MAX_NUM=:N_STOVE_MAX_NUM,");
            strSql.Append("C_REMARK=:C_REMARK,");
            strSql.Append("N_STATUS=:N_STATUS,");
            strSql.Append("C_EMP_ID=:C_EMP_ID,");
            strSql.Append("D_MOD_DT=:D_MOD_DT,");
            strSql.Append("D_START_DATE=:D_START_DATE,");
            strSql.Append("D_END_DATE=:D_END_DATE,");
            strSql.Append("N_TARGET_NUM=:N_TARGET_NUM,");
            strSql.Append("C_STA_ID=:C_STA_ID");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_STL_GRD",       OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STD_CODE",      OracleDbType.Varchar2, 100),
                new OracleParameter(":N_STOVE_MIN_NUM", OracleDbType.Decimal,    3),
                new OracleParameter(":N_STOVE_MAX_NUM", OracleDbType.Decimal,    3),
                new OracleParameter(":C_REMARK",        OracleDbType.Varchar2, 200),
                new OracleParameter(":N_STATUS",        OracleDbType.Decimal,    1),
                new OracleParameter(":C_EMP_ID",        OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",        OracleDbType.Date),
                new OracleParameter(":D_START_DATE",    OracleDbType.Date),
                new OracleParameter(":D_END_DATE",      OracleDbType.Date),
                new OracleParameter(":N_TARGET_NUM",    OracleDbType.Decimal,    3),
                new OracleParameter(":C_STA_ID",        OracleDbType.Varchar2, 100),
                new OracleParameter(":C_ID",            OracleDbType.Varchar2, 100)
            };
            parameters[0].Value  = model.C_STL_GRD;
            parameters[1].Value  = model.C_STD_CODE;
            parameters[2].Value  = model.N_STOVE_MIN_NUM;
            parameters[3].Value  = model.N_STOVE_MAX_NUM;
            parameters[4].Value  = model.C_REMARK;
            parameters[5].Value  = model.N_STATUS;
            parameters[6].Value  = model.C_EMP_ID;
            parameters[7].Value  = model.D_MOD_DT;
            parameters[8].Value  = model.D_START_DATE;
            parameters[9].Value  = model.D_END_DATE;
            parameters[10].Value = model.N_TARGET_NUM;
            parameters[11].Value = model.C_STA_ID;
            parameters[12].Value = model.C_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        private void FrmPB_GZZJCLS_EDIT_Load(object sender, EventArgs e)
        {
            strMenuName = RV.UI.UserInfo.menuName;
            Mod_TPB_CAST_STOVE mod = bll_TPB_SLAB_CAPACITY.GetModel(c_id);

            commonSub.ImageComboBoxEditBindGW("", cbo_GW2);//绑定工位
            cbo_GW2.EditValue = mod.C_STA_ID;
            cbo_GW2.Enabled   = false;
            txt_GZ2.Text      = mod.C_STL_GRD;
            txt_GZ2.Enabled   = false;
            txt_ZXBZ2.Text    = mod.C_STD_CODE;
            txt_ZXBZ2.Enabled = false;
            txt_MIN.Text      = mod.N_STOVE_MIN_NUM.ToString();
            txt_MAX.Text      = mod.N_STOVE_MAX_NUM.ToString();
            txt_MBLS.Text     = mod.N_TARGET_NUM.ToString();
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Mod_TPB_CAST_STOVE model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TPB_CAST_STOVE(");
            strSql.Append("C_STL_GRD,C_STD_CODE,N_STOVE_MIN_NUM,N_STOVE_MAX_NUM,C_REMARK,N_STATUS,C_EMP_ID,D_MOD_DT,D_START_DATE,D_END_DATE,N_TARGET_NUM,C_STA_ID)");
            strSql.Append(" values (");
            strSql.Append(":C_STL_GRD,:C_STD_CODE,:N_STOVE_MIN_NUM,:N_STOVE_MAX_NUM,:C_REMARK,:N_STATUS,:C_EMP_ID,:D_MOD_DT,:D_START_DATE,:D_END_DATE,:N_TARGET_NUM,:C_STA_ID)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_STL_GRD",       OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STD_CODE",      OracleDbType.Varchar2, 100),
                new OracleParameter(":N_STOVE_MIN_NUM", OracleDbType.Decimal,    3),
                new OracleParameter(":N_STOVE_MAX_NUM", OracleDbType.Decimal,    3),
                new OracleParameter(":C_REMARK",        OracleDbType.Varchar2, 200),
                new OracleParameter(":N_STATUS",        OracleDbType.Decimal,    1),
                new OracleParameter(":C_EMP_ID",        OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",        OracleDbType.Date),
                new OracleParameter(":D_START_DATE",    OracleDbType.Date),
                new OracleParameter(":D_END_DATE",      OracleDbType.Date),
                new OracleParameter(":N_TARGET_NUM",    OracleDbType.Decimal,    3),
                new OracleParameter(":C_STA_ID",        OracleDbType.Varchar2, 100)
            };
            parameters[0].Value  = model.C_STL_GRD;
            parameters[1].Value  = model.C_STD_CODE;
            parameters[2].Value  = model.N_STOVE_MIN_NUM;
            parameters[3].Value  = model.N_STOVE_MAX_NUM;
            parameters[4].Value  = model.C_REMARK;
            parameters[5].Value  = model.N_STATUS;
            parameters[6].Value  = model.C_EMP_ID;
            parameters[7].Value  = model.D_MOD_DT;
            parameters[8].Value  = model.D_START_DATE;
            parameters[9].Value  = model.D_END_DATE;
            parameters[10].Value = model.N_TARGET_NUM;
            parameters[11].Value = model.C_STA_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #5
0
        private void btn_Stop_Click(object sender, EventArgs e)
        {
            try
            {
                if (DialogResult.No == MessageBox.Show("是否确认删除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1))
                {
                    return;
                }

                int   selectedNum = this.gv_ZJCLS.SelectedRowsCount;
                int   commitNum   = 0;                               //删除记录数量
                int   failtNum    = 0;                               //删除失败数量
                int[] rownumber   = this.gv_ZJCLS.GetSelectedRows(); //获取选中行号数组;
                for (int i = 0; i < rownumber.Length; i++)
                {
                    int                selectedHandle = rownumber[i];
                    string             strID          = this.gv_ZJCLS.GetRowCellValue(selectedHandle, "C_ID").ToString();
                    Mod_TPB_CAST_STOVE model          = bll_TPB_CAST_STOVE.GetModel(strID);
                    model.N_STATUS   = 0;
                    model.C_EMP_ID   = RV.UI.UserInfo.userID;
                    model.D_MOD_DT   = RV.UI.ServerTime.timeNow();
                    model.D_END_DATE = RV.UI.ServerTime.timeNow();
                    bool update = bll_TPB_CAST_STOVE.Update(model);
                    if (update)
                    {
                        commitNum = commitNum + 1;
                    }
                    else
                    {
                        failtNum = failtNum + 1;
                    }
                }
                MessageBox.Show("选择" + selectedNum.ToString() + "条记录,删除" + commitNum.ToString() + "条记录!");

                Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "删除钢种整浇次炉数信息"); //添加操作日志

                Query2();                                                                //重新加载
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TPB_CAST_STOVE GetModel(string C_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select C_ID,C_STL_GRD,C_STD_CODE,N_STOVE_MIN_NUM,N_STOVE_MAX_NUM,C_REMARK,N_STATUS,C_EMP_ID,D_MOD_DT,D_START_DATE,D_END_DATE,N_TARGET_NUM,C_STA_ID from TPB_CAST_STOVE ");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_ID", OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = C_ID;

            Mod_TPB_CAST_STOVE model = new Mod_TPB_CAST_STOVE();
            DataSet            ds    = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #7
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (DialogResult.No == MessageBox.Show("是否确认保存?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1))
                {
                    return;
                }
                if (cbo_GW1.EditValue.ToString() == "")
                {
                    MessageBox.Show("未选中工位!");
                    return;
                }
                if (txt_MAX.Text.Trim() == "" || txt_MAX.Text.Trim() == "0")
                {
                    MessageBox.Show("最大炉数不能为空或为0!");
                    return;
                }
                if (txt_MBLS.Text.Trim() == "" || txt_MBLS.Text.Trim() == "0")
                {
                    MessageBox.Show("目标炉数不能为空或为0!");
                    return;
                }
                if (txt_MIN.Text.Trim() == "" || txt_MIN.Text.Trim() == "0")
                {
                    MessageBox.Show("最小炉数不能为空或为0!");
                    return;
                }
                if (Convert.ToInt32(txt_MIN.Text) > Convert.ToInt32(txt_MIN.Text.Trim()))
                {
                    MessageBox.Show("最大炉数不能小于最小炉数!");
                    return;
                }
                int[]  rownumber = this.gv_StdMain.GetSelectedRows();//获取选中行号数组;
                int    succount  = 0;
                string str       = "";
                if (rownumber.Count() > 0)
                {
                    foreach (var item in rownumber)
                    {
                        Mod_TPB_CAST_STOVE mod_TPB_CAST_STOVE = new Mod_TPB_CAST_STOVE();
                        mod_TPB_CAST_STOVE.C_EMP_ID   = RV.UI.UserInfo.userID;
                        mod_TPB_CAST_STOVE.C_STD_CODE = this.gv_StdMain.GetRowCellValue(item, "C_STD_CODE").ToString();
                        mod_TPB_CAST_STOVE.C_STL_GRD  = this.gv_StdMain.GetRowCellValue(item, "C_STL_GRD").ToString();
                        mod_TPB_CAST_STOVE.C_STA_ID   = cbo_GW1.EditValue.ToString();
                        if (txt_MAX.Text != "")
                        {
                            mod_TPB_CAST_STOVE.N_STOVE_MAX_NUM = Convert.ToDecimal(txt_MAX.Text);
                        }
                        if (txt_MIN.Text != "")
                        {
                            mod_TPB_CAST_STOVE.N_STOVE_MIN_NUM = Convert.ToDecimal(txt_MIN.Text);
                        }
                        if (txt_MBLS.Text != "")
                        {
                            mod_TPB_CAST_STOVE.N_TARGET_NUM = Convert.ToDecimal(txt_MBLS.Text);
                        }
                        if (bll_TPB_CAST_STOVE.ExistsDate(mod_TPB_CAST_STOVE.C_STL_GRD, mod_TPB_CAST_STOVE.C_STD_CODE, mod_TPB_CAST_STOVE.C_STA_ID))
                        {
                            str += cbo_GW1.Text + "下" + mod_TPB_CAST_STOVE.C_STL_GRD + "(" + mod_TPB_CAST_STOVE.C_STD_CODE + "),";
                        }
                        else
                        {
                            bll_TPB_CAST_STOVE.Add(mod_TPB_CAST_STOVE);
                            succount += 1;
                        }
                    }
                    if (str.Length > 0)
                    {
                        Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加钢种整浇次炉数");//添加操作日志

                        MessageBox.Show("共" + rownumber.Count() + "条数据,保存成功" + succount + "条," + str.Substring(0, str.Length - 1) + "已存在!");
                        cbo_GW2.EditValue = cbo_GW1.EditValue;
                        Query2();
                    }
                    else
                    {
                        MessageBox.Show("共" + rownumber.Count() + "条数据,保存成功" + succount + "条");
                        cbo_GW2.EditValue = cbo_GW1.EditValue;
                        Query2();
                    }
                }
                else
                {
                    MessageBox.Show("未选中行");
                    this.gv_StdMain.Focus();
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TPB_CAST_STOVE DataRowToModel(DataRow row)
        {
            Mod_TPB_CAST_STOVE model = new Mod_TPB_CAST_STOVE();

            if (row != null)
            {
                if (row["C_ID"] != null)
                {
                    model.C_ID = row["C_ID"].ToString();
                }
                if (row["C_STL_GRD"] != null)
                {
                    model.C_STL_GRD = row["C_STL_GRD"].ToString();
                }
                if (row["C_STD_CODE"] != null)
                {
                    model.C_STD_CODE = row["C_STD_CODE"].ToString();
                }
                if (row["N_STOVE_MIN_NUM"] != null && row["N_STOVE_MIN_NUM"].ToString() != "")
                {
                    model.N_STOVE_MIN_NUM = decimal.Parse(row["N_STOVE_MIN_NUM"].ToString());
                }
                if (row["N_STOVE_MAX_NUM"] != null && row["N_STOVE_MAX_NUM"].ToString() != "")
                {
                    model.N_STOVE_MAX_NUM = decimal.Parse(row["N_STOVE_MAX_NUM"].ToString());
                }
                if (row["C_REMARK"] != null)
                {
                    model.C_REMARK = row["C_REMARK"].ToString();
                }
                if (row["N_STATUS"] != null && row["N_STATUS"].ToString() != "")
                {
                    model.N_STATUS = decimal.Parse(row["N_STATUS"].ToString());
                }
                if (row["C_EMP_ID"] != null)
                {
                    model.C_EMP_ID = row["C_EMP_ID"].ToString();
                }
                if (row["D_MOD_DT"] != null && row["D_MOD_DT"].ToString() != "")
                {
                    model.D_MOD_DT = DateTime.Parse(row["D_MOD_DT"].ToString());
                }
                if (row["D_START_DATE"] != null && row["D_START_DATE"].ToString() != "")
                {
                    model.D_START_DATE = DateTime.Parse(row["D_START_DATE"].ToString());
                }
                if (row["D_END_DATE"] != null && row["D_END_DATE"].ToString() != "")
                {
                    model.D_END_DATE = DateTime.Parse(row["D_END_DATE"].ToString());
                }
                if (row["N_TARGET_NUM"] != null && row["N_TARGET_NUM"].ToString() != "")
                {
                    model.N_TARGET_NUM = decimal.Parse(row["N_TARGET_NUM"].ToString());
                }
                if (row["C_STA_ID"] != null)
                {
                    model.C_STA_ID = row["C_STA_ID"].ToString();
                }
            }
            return(model);
        }
Example #9
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mod_TPB_CAST_STOVE model)
 {
     return(dal.Update(model));
 }
Example #10
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Mod_TPB_CAST_STOVE model)
 {
     return(dal.Add(model));
 }