Ejemplo n.º 1
0
        protected void btnAddRight_Click(object sender, EventArgs e)
        {
            if (ddlDept.SelectedValue.Length > 0)
            {
                int[] selectArray = GridGoods.SelectedRowIndexArray;
                if (selectArray.Length > 0)
                {
                    List <CommandInfo> cmdList    = new List <CommandInfo>();
                    MyTable            myGoodsCFG = new MyTable("DOC_GOODSCFG");
                    for (int i = 0; i < selectArray.Length; i++)
                    {
                        Object OBJ = DbHelperOra.GetSingle(String.Format("SELECT DEPTID FROM DOC_GOODSCFG A,SYS_DEPT B WHERE A.DEPTID = B.CODE AND B.TYPE = '1' AND A.GDSEQ = '{0}'", GridGoods.Rows[selectArray[i]].Values[2].ToString()));
                        if ((OBJ ?? "").ToString().Length > 0)
                        {
                            Alert.Show(string.Format("商品【{0}】已配置到库房【{1}】!", GridGoods.Rows[selectArray[i]].Values[2].ToString(), OBJ), "消息提示", MessageBoxIcon.Warning);
                            return;
                        }
                        if (GridGoods.Rows[selectArray[i]].Values[8].ToString() != "Y" && GridGoods.Rows[selectArray[i]].Values[8].ToString() != "T")
                        {
                            Alert.Show(string.Format("商品【{0}】状态信息错误!", GridGoods.Rows[selectArray[i]].Values[2].ToString()), "消息提示", MessageBoxIcon.Warning);
                            return;
                        }
                        myGoodsCFG.ColRow.Clear();
                        myGoodsCFG.ColRow.Add("GDSEQ", GridGoods.Rows[selectArray[i]].Values[0]);
                        myGoodsCFG.ColRow.Add("DEPTID", ddlDept.SelectedValue);
                        myGoodsCFG.ColRow.Add("ISCFG", "Y");
                        myGoodsCFG.ColRow.Add("NUM1", "0");
                        myGoodsCFG.ColRow.Add("NUM3", "0");
                        myGoodsCFG.ColRow.Add("DSNUM", "0");
                        if (DbHelperOra.Exists("SELECT 1 FROM SYS_DEPT WHERE CODE = '" + ddlDept.SelectedValue + "' AND TYPE IN('1','2')"))
                        {
                            trbHJCODE1.Enabled = true;
                        }
                        else
                        {
                            myGoodsCFG.ColRow.Add("HJCODE1", ddlDept.SelectedValue);
                            trbHJCODE1.Enabled = false;
                        }
                        cmdList.Add(myGoodsCFG.Insert());
                        OperLog("商品配置", "修改科室【" + ddlDept.SelectedValue + "】商品【" + GridGoods.Rows[selectArray[i]].Values[0] + "】");
                    }

                    DbHelperOra.ExecuteSqlTran(cmdList);
                    dataSearch();
                    dataSearch("right");
                }
                else
                {
                    Alert.Show("请选择要进行配置的商品信息!");
                    GridGoods.Focus();
                }
            }
            else
            {
                Alert.Show("请选择要进行配置的部门!");
                ddlDept.Focus();
            }
        }