Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Mod_TB_SLAB_MATRAL model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TB_SLAB_MATRAL set ");
            strSql.Append("C_MATRAL_CODE=:C_MATRAL_CODE,");
            strSql.Append("C_STL_GRD=:C_STL_GRD,");
            strSql.Append("C_STD_CODE=:C_STD_CODE,");
            strSql.Append("N_STATUS=:N_STATUS,");
            strSql.Append("C_EMP_ID=:C_EMP_ID,");
            strSql.Append("D_MOD_DT=:D_MOD_DT,");
            strSql.Append("C_REMARK=:C_REMARK,");
            strSql.Append("C_ROUTE_DESC=:C_ROUTE_DESC ");//C_ROUTE_DESC
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_MATRAL_CODE", OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STL_GRD",     OracleDbType.Varchar2,  50),
                new OracleParameter(":C_STD_CODE",    OracleDbType.Varchar2,  50),
                new OracleParameter(":N_STATUS",      OracleDbType.Decimal,    1),
                new OracleParameter(":C_EMP_ID",      OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",      OracleDbType.Date),
                new OracleParameter(":C_REMARK",      OracleDbType.Varchar2, 500),
                new OracleParameter(":C_ROUTE_DESC",  OracleDbType.Varchar2, 100),
                new OracleParameter(":C_ID",          OracleDbType.Varchar2, 50)
            };
            parameters[0].Value = model.C_MATRAL_CODE;
            parameters[1].Value = model.C_STL_GRD;
            parameters[2].Value = model.C_STD_CODE;
            parameters[3].Value = model.N_STATUS;
            parameters[4].Value = model.C_EMP_ID;
            parameters[5].Value = model.D_MOD_DT;
            parameters[6].Value = model.C_REMARK;
            parameters[7].Value = model.C_ROUTE_DESC;
            parameters[8].Value = model.C_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TB_SLAB_MATRAL DataRowToModel(DataRow row)
        {
            Mod_TB_SLAB_MATRAL model = new Mod_TB_SLAB_MATRAL();

            if (row != null)
            {
                if (row["C_ID"] != null)
                {
                    model.C_ID = row["C_ID"].ToString();
                }
                if (row["C_MATRAL_CODE"] != null)
                {
                    model.C_MATRAL_CODE = row["C_MATRAL_CODE"].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_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["C_REMARK"] != null)
                {
                    model.C_REMARK = row["C_REMARK"].ToString();
                }
                if (row["C_ROUTE_DESC"] != null)
                {
                    model.C_ROUTE_DESC = row["C_ROUTE_DESC"].ToString();
                }
            }
            return(model);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Mod_TB_SLAB_MATRAL model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TB_SLAB_MATRAL(");
            strSql.Append("C_MATRAL_CODE,C_STL_GRD,C_STD_CODE,N_STATUS,C_EMP_ID,D_MOD_DT,C_REMARK,C_ROUTE_DESC)");
            strSql.Append(" values (");
            strSql.Append(":C_MATRAL_CODE,:C_STL_GRD,:C_STD_CODE,:N_STATUS,:C_EMP_ID,:D_MOD_DT,:C_REMARK,:C_ROUTE_DESC)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_MATRAL_CODE", OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STL_GRD",     OracleDbType.Varchar2,  50),
                new OracleParameter(":C_STD_CODE",    OracleDbType.Varchar2,  50),
                new OracleParameter(":N_STATUS",      OracleDbType.Decimal,    1),
                new OracleParameter(":C_EMP_ID",      OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",      OracleDbType.Date),
                new OracleParameter(":C_REMARK",      OracleDbType.Varchar2, 500),
                new OracleParameter(":C_ROUTE_DESC",  OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = model.C_MATRAL_CODE;
            parameters[1].Value = model.C_STL_GRD;
            parameters[2].Value = model.C_STD_CODE;
            parameters[3].Value = model.N_STATUS;
            parameters[4].Value = model.C_EMP_ID;
            parameters[5].Value = model.D_MOD_DT;
            parameters[6].Value = model.C_REMARK;
            parameters[7].Value = model.C_ROUTE_DESC;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TB_SLAB_MATRAL GetModel(string C_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select C_ID,C_MATRAL_CODE,C_STL_GRD,C_STD_CODE,N_STATUS,C_EMP_ID,D_MOD_DT,C_REMARK,C_ROUTE_DESC from TB_SLAB_MATRAL ");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_ID", OracleDbType.Varchar2, 50)
            };
            parameters[0].Value = C_ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Add_Click(object sender, EventArgs e)
        {
            try
            {
                DataRow dr_StdMain = gv_StdMain.GetDataRow(gv_StdMain.FocusedRowHandle);
                int[]   rownumber  = gv_Slab.GetSelectedRows();//获取选中行号数组;
                if (rownumber.Length == 0)
                {
                    MessageBox.Show("请选择需要添加的信息!");
                    return;
                }

                for (int si = 0; si < rownumber.Length; si++)
                {
                    DataRow dr = gv_Slab.GetDataRow(rownumber[si]);

                    Mod_TB_SLAB_MATRAL model = new Mod_TB_SLAB_MATRAL();
                    model.C_MATRAL_CODE = dr["C_ID"].ToString();
                    model.C_STD_CODE    = dr_StdMain["C_STD_CODE"].ToString();
                    model.C_STL_GRD     = dr_StdMain["C_STL_GRD"].ToString();
                    model.C_ROUTE_DESC  = dr_StdMain["C_ROUTE_DESC"].ToString();
                    model.C_EMP_ID      = RV.UI.UserInfo.userID;

                    #region 检测是否重复添加
                    System.Collections.Hashtable ht = new System.Collections.Hashtable();
                    ht.Add("C_MATRAL_CODE", model.C_MATRAL_CODE);
                    ht.Add("C_STD_CODE", model.C_STD_CODE);
                    ht.Add("C_STL_GRD", model.C_STL_GRD);
                    ht.Add("C_ROUTE_DESC", model.C_ROUTE_DESC);
                    ht.Add("N_STATUS", "1");
                    if (Common.CheckRepeat.CheckTable("TB_SLAB_MATRAL", ht) > 0)
                    {
                        MessageBox.Show("已存在,不能重复添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    #endregion
                    bllSlabMatral.Add(model);

                    Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加钢坯定尺匹配关系");//添加操作日志
                }


                BindSlabMatchList(dr_StdMain["C_STL_GRD"].ToString(), dr_StdMain["C_STD_CODE"].ToString(), dr_StdMain["C_ROUTE_DESC"].ToString());
                BindSlabList(dr_StdMain["C_STL_GRD"].ToString(), dr_StdMain["KP"].ToString(), dr_StdMain["C_STD_CODE"].ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            #region 批量添加
            //try
            //{
            //    DataRow dr_Slab = gv_Slab.GetDataRow(gv_Slab.FocusedRowHandle);
            //    DataRow dr_StdMain = gv_StdMain.GetDataRow(gv_StdMain.FocusedRowHandle);
            //    if (dr_Slab == null) return;
            //    int[] rownumber = gv_Slab.GetSelectedRows();//获取选中行号数组;
            //    if (rownumber.Length == 0)
            //    {
            //        MessageBox.Show("请选择需要添加的信息!");
            //        return;
            //    }
            //    DataTable dt = ((DataView)gv_StdMain.DataSource).ToTable();

            //    DataTable dt_slab = new DataTable();

            //    for (int i = 0; i < dt.Rows.Count; i++)
            //    {
            //        if (dt.Rows[i]["KP"].ToString() != "")
            //        {
            //            dt_slab = bllTqbSlabLen.GetSLabNoMatch613(dt.Rows[i]["C_STL_GRD"].ToString(), txt_Size.Text.Trim(), dt.Rows[i]["C_STD_CODE"].ToString()).Tables[0];
            //        }
            //        else
            //        {
            //            dt_slab = bllTqbSlabLen.GetSLabNoMatch611_BXG(dt.Rows[i]["C_STL_GRD"].ToString(), txt_Size.Text.Trim(), dt.Rows[i]["C_STD_CODE"].ToString()).Tables[0];
            //        }
            //        for (int si = 0; si < dt_slab.Rows.Count; si++)
            //        {
            //            DataRow dr = gv_Slab.GetDataRow(rownumber[si]);

            //            Mod_TB_SLAB_MATRAL model = new Mod_TB_SLAB_MATRAL();
            //            model.C_MATRAL_CODE = dt_slab.Rows[si]["C_ID"].ToString();
            //            model.C_STD_CODE = dt.Rows[i]["C_STD_CODE"].ToString();
            //            model.C_STL_GRD = dt.Rows[i]["C_STL_GRD"].ToString();
            //            model.C_EMP_ID = RV.UI.UserInfo.userID;
            //            #region 检测是否重复添加
            //            System.Collections.Hashtable ht = new System.Collections.Hashtable();
            //            ht.Add("C_MATRAL_CODE", model.C_MATRAL_CODE);
            //            ht.Add("C_STD_CODE", model.C_STD_CODE);
            //            ht.Add("C_STL_GRD", model.C_STL_GRD);
            //            ht.Add("N_STATUS", "1");
            //            if (Common.CheckRepeat.CheckTable("TB_SLAB_MATRAL", ht) > 0)
            //            {
            //                MessageBox.Show("已存在,不能重复添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //                return;
            //            }
            //            #endregion
            //            bllSlabMatral.Add(model);

            //            Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加钢坯定尺匹配关系");//添加操作日志

            //        }
            //    }

            //    BindSlabMatchList(dr_StdMain["C_STL_GRD"].ToString(), dr_StdMain["C_STD_CODE"].ToString());
            //    BindSlabList(dr_StdMain["C_STL_GRD"].ToString(), dr_StdMain["KP"].ToString(), dr_StdMain["C_STD_CODE"].ToString());
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);
            //}
            #endregion
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Seave_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(btnEdit_Std.Text.Trim()))
                {
                    MessageBox.Show("请选择执行标准!");
                    return;
                }
                if (string.IsNullOrEmpty(cbo_Type.Text.Trim()))
                {
                    MessageBox.Show("请选择工艺路线类型!");
                    return;
                }
                if (string.IsNullOrEmpty(txt_LX.Text.Trim()))
                {
                    MessageBox.Show("请选择工艺路线!");
                    return;
                }
                Mod_TQB_ROUTE model = bllRoute.GetModel(c_id);
                string[]      std;
                if (btnEdit_Std.Text.Contains("Q/XG") || btnEdit_Std.Text.Contains("GB/T"))
                {
                    if (btnEdit_Std.Text.Contains("."))
                    {
                        std = btnEdit_Std.Text.Trim().Split('.');
                        model.C_STD_CODE = std[0];
                    }
                    else
                    {
                        std = btnEdit_Std.Text.Trim().Split('-');
                        model.C_STD_CODE = std[0];
                    }
                }
                else
                {
                    model.C_STD_CODE = btnEdit_Std.Text.Trim();
                }
                model.C_STL_GRD       = txt_Grd.Text.Trim();
                model.C_ROUTE_TYPE    = cbo_Type.Text.Trim();
                model.C_ROUTE_DESC    = txt_LX.Text.Trim();
                model.C_IS_BXG        = strPhyCode;
                model.C_SPEC          = txt_Spec.Text.Trim();
                model.C_CUSTFILE_NAME = btn_KHMC.Text.Trim();
                model.C_EMP_ID        = RV.UI.UserInfo.userID;
                model.D_MOD_DT        = RV.UI.ServerTime.timeNow();
                model.C_REMARK        = txt_Remark.Text.Trim();
                #region 检测是否重复添加
                System.Collections.Hashtable ht = new System.Collections.Hashtable();
                ht.Add("C_ID", c_id);
                ht.Add("C_STD_CODE", model.C_STD_CODE);
                ht.Add("C_STL_GRD", model.C_STL_GRD);
                ht.Add("C_SPEC", model.C_SPEC);
                ht.Add("C_ROUTE_TYPE", model.C_ROUTE_TYPE);
                ht.Add("C_CUSTFILE_NAME", model.C_CUSTFILE_NAME);
                ht.Add("N_STATUS", "1");
                ht.Add("C_IS_BXG", strPhyCode);
                if (Common.CheckRepeat.CheckTable("TQB_ROUTE", ht) > 0)
                {
                    MessageBox.Show("已存在,不能重复添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                #endregion
                if (bllRoute.Update(model))
                {
                    DataTable dt = bllSlabMatral.GetList(model.C_STL_GRD, model.C_STD_CODE, strLX).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            Mod_TB_SLAB_MATRAL mod_slab = bllSlabMatral.GetModel(dt.Rows[i]["C_ID"].ToString());
                            mod_slab.C_ROUTE_DESC = txt_LX.Text.Trim();
                            bllSlabMatral.Update(mod_slab);
                        }
                    }

                    Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "修改工艺路线信息");//添加操作日志

                    MessageBox.Show("修改成功!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mod_TB_SLAB_MATRAL model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Mod_TB_SLAB_MATRAL model)
 {
     return(dal.Add(model));
 }