예제 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Mod_TPB_STA_MOVETIME model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TPB_STA_MOVETIME(");
            strSql.Append("C_STA_ID1,C_STA_ID2,N_TIME,C_EMP_ID,D_MOD_DT,C_REMARK,N_STATUS)");
            strSql.Append(" values (");
            strSql.Append(":C_STA_ID1,:C_STA_ID2,:N_TIME,:C_EMP_ID,:D_MOD_DT,:C_REMARK,:N_STATUS)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_STA_ID1", OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STA_ID2", OracleDbType.Varchar2, 100),
                new OracleParameter(":N_TIME",    OracleDbType.Decimal,    3),
                new OracleParameter(":C_EMP_ID",  OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",  OracleDbType.Date),
                new OracleParameter(":C_REMARK",  OracleDbType.Varchar2, 200),new OracleParameter(":N_STATUS", OracleDbType.Decimal, 1),
            };
            parameters[0].Value = model.C_STA_ID1;
            parameters[1].Value = model.C_STA_ID2;
            parameters[2].Value = model.N_TIME;
            parameters[3].Value = model.C_EMP_ID;
            parameters[4].Value = model.D_MOD_DT;
            parameters[5].Value = model.C_REMARK;
            parameters[6].Value = model.N_STATUS;
            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        public void GetFoucs()
        {
            int selectedHandle = this.gv_GWYDSJ.FocusedRowHandle;//获取焦点行索引

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

            cbo_QSGW1.EditValue = model.C_STA_ID1;
            cbo_JSGW1.EditValue = model.C_STA_ID2;
            this.txt_cn.Text    = model.N_TIME.ToString();
        }
예제 #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Mod_TPB_STA_MOVETIME model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TPB_STA_MOVETIME set ");
            strSql.Append("N_STATUS=:N_STATUS,");
            strSql.Append("C_STA_ID1=:C_STA_ID1,");
            strSql.Append("C_STA_ID2=:C_STA_ID2,");
            strSql.Append("N_TIME=:N_TIME,");
            strSql.Append("C_EMP_ID=:C_EMP_ID,");
            strSql.Append("D_MOD_DT=:D_MOD_DT,");
            strSql.Append("C_REMARK=:C_REMARK");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":N_STATUS",  OracleDbType.Decimal,    1),
                new OracleParameter(":C_STA_ID1", OracleDbType.Varchar2, 100),
                new OracleParameter(":C_STA_ID2", OracleDbType.Varchar2, 100),
                new OracleParameter(":N_TIME",    OracleDbType.Decimal,    3),
                new OracleParameter(":C_EMP_ID",  OracleDbType.Varchar2, 100),
                new OracleParameter(":D_MOD_DT",  OracleDbType.Date),
                new OracleParameter(":C_REMARK",  OracleDbType.Varchar2, 200),
                new OracleParameter(":C_ID",      OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = model.N_STATUS;
            parameters[1].Value = model.C_STA_ID1;
            parameters[2].Value = model.C_STA_ID2;
            parameters[3].Value = model.N_TIME;
            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_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
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_GWYDSJ.SelectedRowsCount;
                int   commitNum   = 0;                                //删除记录数量
                int   failtNum    = 0;                                //删除失败数量
                int[] rownumber   = this.gv_GWYDSJ.GetSelectedRows(); //获取选中行号数组;
                for (int i = 0; i < rownumber.Length; i++)
                {
                    int    selectedHandle      = rownumber[i];
                    string strID               = this.gv_GWYDSJ.GetRowCellValue(selectedHandle, "C_ID").ToString();
                    Mod_TPB_STA_MOVETIME model = bll_TPB_STA_MOVETIME.GetModel(strID);
                    model.N_STATUS = 0;
                    model.C_EMP_ID = RV.UI.UserInfo.userID;
                    model.D_MOD_DT = RV.UI.ServerTime.timeNow();
                    bool update = bll_TPB_STA_MOVETIME.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, "删除工位机时产能");//添加操作日志
                Query();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TPB_STA_MOVETIME DataRowToModel(DataRow row)
        {
            Mod_TPB_STA_MOVETIME model = new Mod_TPB_STA_MOVETIME();

            if (row != null)
            {
                if (row["C_ID"] != null)
                {
                    model.C_ID = row["C_ID"].ToString();
                }
                if (row["C_STA_ID1"] != null)
                {
                    model.C_STA_ID1 = row["C_STA_ID1"].ToString();
                }
                if (row["C_STA_ID2"] != null)
                {
                    model.C_STA_ID2 = row["C_STA_ID2"].ToString();
                }
                if (row["N_TIME"] != null && row["N_TIME"].ToString() != "")
                {
                    model.N_TIME = decimal.Parse(row["N_TIME"].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();
                }
            }
            return(model);
        }
예제 #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Mod_TPB_STA_MOVETIME GetModel(string C_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select C_ID,C_STA_ID1,C_STA_ID2,N_TIME,C_EMP_ID,D_MOD_DT,C_REMARK from TPB_STA_MOVETIME ");
            strSql.Append(" where C_ID=:C_ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_ID", OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = C_ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mod_TPB_STA_MOVETIME model)
 {
     return(dal.Update(model));
 }
예제 #8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Mod_TPB_STA_MOVETIME model)
 {
     return(dal.Add(model));
 }
예제 #9
0
        private void btn_save_fagw_Click(object sender, EventArgs e)
        {
            try
            {
                if (cbolst_GL.CheckedItemsCount + cbolst_CC.CheckedItemsCount + cbolst_LF.CheckedItemsCount + cbolst_RH.CheckedItemsCount + cbolst_ZL.CheckedItemsCount < 2)
                {
                    MessageBox.Show("必须选中俩个工位!");
                    return;
                }
                if (txt_Time1.Text == "0")
                {
                    MessageBox.Show("时间不能为空或为0!");
                    return;
                }
                if (DialogResult.No == MessageBox.Show("是否确认保存选中的数据?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1))
                {
                    return;
                }

                string gwstr1 = "";
                string gwstr2 = "";
                if (cbolst_GL.CheckedItemsCount == 0)
                {
                    cbolst_GL.Enabled = false;
                }
                else
                {
                    if (gwstr1 == "")
                    {
                        for (int i = 0; i < cbolst_GL.Items.Count; i++)
                        {
                            if (cbolst_GL.Items[i].CheckState == CheckState.Checked)
                            {
                                gwstr1 = cbolst_GL.Items[i].Value.ToString();
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < cbolst_GL.Items.Count; i++)
                        {
                            if (cbolst_GL.Items[i].CheckState == CheckState.Checked)
                            {
                                gwstr2 = cbolst_GL.Items[i].Value.ToString();
                            }
                        }
                    }
                }
                if (cbolst_ZL.CheckedItemsCount == 0)
                {
                    cbolst_ZL.Enabled = false;
                }
                else
                {
                    if (gwstr1 == "")
                    {
                        for (int i = 0; i < cbolst_ZL.Items.Count; i++)
                        {
                            if (cbolst_ZL.Items[i].CheckState == CheckState.Checked)
                            {
                                gwstr1 = cbolst_ZL.Items[i].Value.ToString();
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < cbolst_ZL.Items.Count; i++)
                        {
                            if (cbolst_ZL.Items[i].CheckState == CheckState.Checked)
                            {
                                gwstr2 = cbolst_ZL.Items[i].Value.ToString();
                            }
                        }
                    }
                }
                if (cbolst_LF.CheckedItemsCount == 0)
                {
                    cbolst_LF.Enabled = false;
                }
                else
                {
                    if (gwstr1 == "")
                    {
                        for (int i = 0; i < cbolst_LF.Items.Count; i++)
                        {
                            if (cbolst_LF.Items[i].CheckState == CheckState.Checked)
                            {
                                gwstr1 = cbolst_LF.Items[i].Value.ToString();
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < cbolst_LF.Items.Count; i++)
                        {
                            if (cbolst_LF.Items[i].CheckState == CheckState.Checked)
                            {
                                gwstr2 = cbolst_LF.Items[i].Value.ToString();
                            }
                        }
                    }
                }
                if (cbolst_RH.CheckedItemsCount == 0)
                {
                    cbolst_RH.Enabled = false;
                }
                else
                {
                    if (gwstr1 == "")
                    {
                        for (int i = 0; i < cbolst_RH.Items.Count; i++)
                        {
                            if (cbolst_RH.Items[i].CheckState == CheckState.Checked)
                            {
                                gwstr1 = cbolst_RH.Items[i].Value.ToString();
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < cbolst_RH.Items.Count; i++)
                        {
                            if (cbolst_RH.Items[i].CheckState == CheckState.Checked)
                            {
                                gwstr2 = cbolst_RH.Items[i].Value.ToString();
                            }
                        }
                    }
                }
                if (cbolst_CC.CheckedItemsCount == 0)
                {
                    cbolst_CC.Enabled = false;
                }
                else
                {
                    if (gwstr1 == "")
                    {
                        for (int i = 0; i < cbolst_CC.Items.Count; i++)
                        {
                            if (cbolst_CC.Items[i].CheckState == CheckState.Checked)
                            {
                                gwstr1 = cbolst_CC.Items[i].Value.ToString();
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < cbolst_CC.Items.Count; i++)
                        {
                            if (cbolst_CC.Items[i].CheckState == CheckState.Checked)
                            {
                                gwstr2 = cbolst_CC.Items[i].Value.ToString();
                            }
                        }
                    }
                }
                bll_TPB_STA_MOVETIME.Delete(gwstr1, gwstr2);

                bool res = false;
                Mod_TPB_STA_MOVETIME model = new Mod_TPB_STA_MOVETIME();
                model.C_STA_ID1 = gwstr1;
                model.C_STA_ID2 = gwstr2;
                model.N_TIME    = Convert.ToDecimal(this.txt_Time1.Text.Trim());
                model.D_MOD_DT  = RV.UI.ServerTime.timeNow();
                model.C_EMP_ID  = RV.UI.UserInfo.userID;
                res             = bll_TPB_STA_MOVETIME.Add(model);
                Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加工位转移时间");//添加操作日志
                if (res)
                {
                    MessageBox.Show("操作成功!");
                }
                Query();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #10
0
 private void btn_save_Click(object sender, EventArgs e)
 {
     try
     {
         bool res = false;
         if (this.lbl_id.Text == "")
         {
             if (DialogResult.No == MessageBox.Show("是否确认添加记录?", "提示"))
             {
                 return;
             }
             if (this.cbo_QSGW1.EditValue == null)
             {
                 MessageBox.Show("未选择起始工位!");
                 return;
             }
             if (this.cbo_JSGW1.EditValue == null)
             {
                 MessageBox.Show("未选择结束工位!");
                 return;
             }
             if (this.txt_cn.Text.Trim() == "" || this.txt_cn.Text.Trim() == "0")
             {
                 MessageBox.Show("时间不能0或为空!");
                 return;
             }
             Mod_TPB_STA_MOVETIME model = new Mod_TPB_STA_MOVETIME();
             model.C_STA_ID1 = this.cbo_QSGW1.EditValue.ToString();
             model.C_STA_ID2 = this.cbo_JSGW1.EditValue.ToString();
             model.N_TIME    = Convert.ToDecimal(this.txt_cn.Text.Trim());
             DataTable dt = bll_TPB_STA_MOVETIME.GetList(model.C_STA_ID1, model.C_STA_ID2, "1").Tables[0];
             if (dt.Rows.Count > 0)
             {
                 MessageBox.Show("已存在工位!");
                 return;
             }
             model.D_MOD_DT = RV.UI.ServerTime.timeNow();
             model.C_EMP_ID = RV.UI.UserInfo.userID;
             res            = bll_TPB_STA_MOVETIME.Add(model);
             Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加工位转移时间");//添加操作日志
         }
         else
         {
             if (DialogResult.No == MessageBox.Show("是否确认编辑选中的记录?", "提示"))
             {
                 return;
             }
             Mod_TPB_STA_MOVETIME model = bll_TPB_STA_MOVETIME.GetModel(lbl_id.Text);
             model.N_TIME   = Convert.ToDecimal(this.txt_cn.Text);
             model.C_EMP_ID = RV.UI.UserInfo.userID;
             model.D_MOD_DT = RV.UI.ServerTime.timeNow();
             res            = bll_TPB_STA_MOVETIME.Update(model);
         }
         if (res)
         {
             MessageBox.Show("操作成功!");
             ClearContent.ClearPanelControl(panelControl1.Controls);
             this.lbl_id.Text = "";
         }
         Query();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }