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

            strSql.Append("update TPB_GL_CAPACITY set ");
            strSql.Append("C_PRO_ID=:C_PRO_ID,");
            strSql.Append("C_STA_ID=:C_STA_ID,");
            strSql.Append("C_STA_DESC=:C_STA_DESC,");
            strSql.Append("C_STA_CODE=:C_STA_CODE,");
            strSql.Append("N_CAPACITY=:N_CAPACITY,");
            strSql.Append("D_START_DATE=:D_START_DATE,");
            strSql.Append("D_END_DATE=:D_END_DATE,");
            strSql.Append("N_STATUS=:N_STATUS,");
            strSql.Append("C_EMP_ID=:C_EMP_ID,");
            strSql.Append("D_MOD_DT=:D_MOD_DT");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_PRO_ID",     OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STA_ID",     OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STA_DESC",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STA_CODE",   OracleDbType.Varchar2, 100),
                new OracleParameter(":N_CAPACITY",   OracleDbType.Double,    15),
                new OracleParameter(":D_START_DATE", OracleDbType.Date),
                new OracleParameter(":D_END_DATE",   OracleDbType.Date),
                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_ID",         OracleDbType.Varchar2, 100)
            };
            parameters[0].Value  = model.C_PRO_ID;
            parameters[1].Value  = model.C_STA_ID;
            parameters[2].Value  = model.C_STA_DESC;
            parameters[3].Value  = model.C_STA_CODE;
            parameters[4].Value  = model.N_CAPACITY;
            parameters[5].Value  = model.D_START_DATE;
            parameters[6].Value  = model.D_END_DATE;
            parameters[7].Value  = model.N_STATUS;
            parameters[8].Value  = model.C_EMP_ID;
            parameters[9].Value  = model.D_MOD_DT;
            parameters[10].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_TPB_GL_CAPACITY DataRowToModel(DataRow row)
        {
            Mod_TPB_GL_CAPACITY model = new Mod_TPB_GL_CAPACITY();

            if (row != null)
            {
                if (row["C_ID"] != null)
                {
                    model.C_ID = row["C_ID"].ToString();
                }
                if (row["C_PRO_ID"] != null)
                {
                    model.C_PRO_ID = row["C_PRO_ID"].ToString();
                }
                if (row["C_STA_ID"] != null)
                {
                    model.C_STA_ID = row["C_STA_ID"].ToString();
                }
                if (row["C_STA_DESC"] != null)
                {
                    model.C_STA_DESC = row["C_STA_DESC"].ToString();
                }
                if (row["C_STA_CODE"] != null)
                {
                    model.C_STA_CODE = row["C_STA_CODE"].ToString();
                }
                if (row["N_CAPACITY"] != null && row["N_CAPACITY"].ToString() != "")
                {
                    model.N_CAPACITY = decimal.Parse(row["N_CAPACITY"].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_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());
                }
            }
            return(model);
        }
Ejemplo n.º 3
0
        public void GetFoucs()
        {
            int selectedHandle = this.gv_GWCN.FocusedRowHandle;//获取焦点行索引

            if (selectedHandle < 0)
            {
                ClearContent.ClearPanelControl(panelControl1.Controls);
                this.lbl_id.Text = "";
                return;
            }
            this.lbl_id.Text = this.gv_GWCN.GetRowCellValue(selectedHandle, "C_ID").ToString();//获取焦点行主键
            //根据主键得到工序对象,并在界面赋值
            Mod_TPB_GL_CAPACITY model = bll.GetModel(this.lbl_id.Text);

            cbo_GX.EditValue = model.C_PRO_ID;
            cbo_GW.EditValue = model.C_STA_ID;
            this.txt_cn.Text = model.N_CAPACITY.ToString();
        }
Ejemplo n.º 4
0
 private void btn_Stop_Click(object sender, EventArgs e)
 {
     try
     {
         if (DialogResult.No == MessageBox.Show("是否确认停用?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1))
         {
             return;
         }
         DataRow             dr  = this.gv_GWCN.GetDataRow(this.gv_GWCN.FocusedRowHandle);
         Mod_TPB_GL_CAPACITY mod = bll.GetModel(dr["C_ID"].ToString());
         mod.N_STATUS = 0;
         bll.Update(mod);
         Query();
         Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "停用工位产能");//添加操作日志
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Mod_TPB_GL_CAPACITY model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TPB_GL_CAPACITY(");
            strSql.Append("C_PRO_ID,C_STA_ID,C_STA_DESC,C_STA_CODE,N_CAPACITY,D_START_DATE,D_END_DATE,C_EMP_ID)");
            strSql.Append(" values (");
            strSql.Append(":C_PRO_ID,:C_STA_ID,:C_STA_DESC,:C_STA_CODE,:N_CAPACITY,:D_START_DATE,:D_END_DATE,:C_EMP_ID)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_PRO_ID",     OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STA_ID",     OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STA_DESC",   OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STA_CODE",   OracleDbType.Varchar2, 100),
                new OracleParameter(":N_CAPACITY",   OracleDbType.Double,    15),
                new OracleParameter(":D_START_DATE", OracleDbType.Date),
                new OracleParameter(":D_END_DATE",   OracleDbType.Date),
                new OracleParameter(":C_EMP_ID",     OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = model.C_PRO_ID;
            parameters[1].Value = model.C_STA_ID;
            parameters[2].Value = model.C_STA_DESC;
            parameters[3].Value = model.C_STA_CODE;
            parameters[4].Value = model.N_CAPACITY;
            parameters[5].Value = model.D_START_DATE;
            parameters[6].Value = model.D_END_DATE;
            parameters[7].Value = model.C_EMP_ID;

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

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

            strSql.Append("select C_ID,C_PRO_ID,C_STA_ID,C_STA_DESC,C_STA_CODE,N_CAPACITY,D_START_DATE,D_END_DATE,N_STATUS,C_EMP_ID,D_MOD_DT from TPB_GL_CAPACITY ");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_ID", OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = C_ID;

            Mod_TPB_GL_CAPACITY model = new Mod_TPB_GL_CAPACITY();
            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.º 7
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                bool res = false;
                if (this.lbl_id.Text == "")
                {
                    if (DialogResult.No == MessageBox.Show("是否确认添加记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1))
                    {
                        return;
                    }

                    if (this.cbo_GW.EditValue == null)
                    {
                        MessageBox.Show("未选择工位!");
                        return;
                    }
                    if (this.txt_cn.Text.Trim() == "" || this.txt_cn.Text.Trim() == "0")
                    {
                        MessageBox.Show("产能不能0或为空!");
                        return;
                    }
                    Mod_TPB_GL_CAPACITY model = new Mod_TPB_GL_CAPACITY();
                    model.C_STA_ID = this.cbo_GW.EditValue.ToString();
                    DataTable dt = bll.GetList(model.C_STA_ID, 1).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        MessageBox.Show("已存在工位!");
                        return;
                    }
                    //工位信息
                    Mod_TB_STA modSta = bllsta.GetModel(model.C_STA_ID);
                    model.C_PRO_ID   = modSta.C_PRO_ID;
                    model.C_STA_CODE = modSta.C_STA_CODE;
                    model.C_STA_DESC = modSta.C_STA_DESC;
                    model.N_CAPACITY = Convert.ToDecimal(this.txt_cn.Text);
                    modSta.N_STATUS  = this.rbtn_isty_gx.SelectedIndex == 0 ? 1 : 0;
                    model.C_EMP_ID   = RV.UI.UserInfo.userID;
                    res = bll.Add(model);

                    Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加工位日产能");//添加操作日志
                }
                else
                {
                    if (DialogResult.No == MessageBox.Show("是否确认编辑选中的记录?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1))
                    {
                        return;
                    }
                    Mod_TPB_GL_CAPACITY model = bll.GetModel(lbl_id.Text);
                    model.N_CAPACITY = Convert.ToDecimal(this.txt_cn.Text);
                    model.N_STATUS   = this.rbtn_isty_gx.SelectedIndex == 0 ? 1 : 0;
                    model.C_EMP_ID   = RV.UI.UserInfo.userID;
                    model.D_MOD_DT   = RV.UI.ServerTime.timeNow();
                    res = bll.Update(model);
                }
                if (res)
                {
                    MessageBox.Show("操作成功!");
                    Query();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mod_TPB_GL_CAPACITY model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Mod_TPB_GL_CAPACITY model)
 {
     return(dal.Add(model));
 }