예제 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            MyTable mtType = new MyTable("DOC_LICENSE");

            if (PubFunc.FormDataCheck(FormProducer).Length > 1)
            {
                return; //存在为空的非空列则返回!
            }
            if ((DbHelperOra.Exists("select 1 from DOC_LICENSE where code = '" + tbxCODE.Text + "'")) && (!hfdIsNew.Text.Equals("N")))
            {
                Alert.Show("此证照编码已经存在,请重新输入!");
                return;
            }
            mtType.ColRow = PubFunc.FormDataHT(FormProducer);


            if (hfdIsNew.Text == "" || hfdIsNew.Text == "Y")
            {
                mtType.InsertExec();
            }
            else
            {
                mtType.UpdateExec("");
            }

            Alert.Show("数据保存成功!");
            dataSearch();
            hfdIsNew.Text = "N";
        }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            MyTable mtType = new MyTable("DOC_LICENSE");

            if (PubFunc.FormDataCheck(FormProducer).Length > 1)
            {
                return; //存在为空的非空列则返回!
            }
            if ((DbHelperOra.Exists("select 1 from DOC_LICENSE where code = '" + tbxCODE.Text + "'")) && (!hfdIsNew.Text.Equals("N")))
            {
                Alert.Show("此证照编码已经存在,请重新输入!");
                return;
            }
            if (string.IsNullOrWhiteSpace(ddlFLAG.SelectedValue))
            {
                Alert.Show("请选择证照类别状态!", "提示", MessageBoxIcon.Information);
                return;
            }
            mtType.ColRow = PubFunc.FormDataHT(FormProducer);


            if (hfdIsNew.Text == "" || hfdIsNew.Text == "Y")
            {
                mtType.InsertExec();
            }
            else
            {
                mtType.UpdateExec("");
            }

            Alert.Show("数据保存成功!");
            dataSearch();
            //hfdIsNew.Text = "N";
        }
예제 #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (PubFunc.FormDataCheck(FormMx).Length > 0)
            {
                return;
            }
            //if (tbxCode.Text.Length != ddlSJCODE.SelectedValue.Length + 2 && tbxCode.Text.Length > 2)
            //{
            //    Alert.Show("编码规则不正确,请检查!", "提示信息", MessageBoxIcon.Warning);
            //    return;
            //}
            //增加控制避免主键重复
            if ((DbHelperOra.Exists("select 1 from SYS_DEPT where code = '" + tbxCode.Text + "'")) && (tbxCode.Enabled))
            {
                Alert.Show("你输入的编码已存在,请检查!");
                return;
            }

            if (string.IsNullOrWhiteSpace(ddlSJCODE.SelectedValue))
            {
                Alert.Show("请填选上级!", "提示", MessageBoxIcon.Information);
                return;
            }
            if (!CheckTel(tbxSTR6.Text))
            {
                Alert.Show("联系电话请保证格式(固话XXX-XXX)(手机1XXX)!");
                return;
            }
            string  ls_codelabel;
            MyTable mtTable = new MyTable(strTable, "CODE");

            mtTable.ColRow = PubFunc.FormDataHT(FormMx);
            ls_codelabel   = PubFunc.FormLabelGet(FormMx, "CODE");
            if (PubFunc.StrIsEmpty(mtTable.ColRow["CODE"].ToString()))
            {
                Alert.Show("【" + ls_codelabel + "】不能为空!");
                return;
            }
            if (tbxCode.Enabled)  //新增
            {
                mtTable.InsertExec();
            }
            else
            {
                mtTable.UpdateExec("");
            }
            //写入日志
            OperLog("管理架构定义", "修改资料【" + tbxCode.Text + "】");
            Alert.Show("数据保存成功!");
            ERPUtility.CacheClear("SYS_DEPT");
            tbxCode.Enabled = false;
            InitTree();
        }
예제 #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (PubFunc.FormDataCheck(FormLot).Length > 1)
            {
                return;
            }
            hfdGDSEQ.Text = tbxGDNAME.Text;
            if (PubFunc.StrIsEmpty(hfdGDSEQ.Text))
            {
                Alert.Show(string.Format("您输入的商品【{0}】在商品资料中不存在,请重新输入!", tbxGDNAME.Text), "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (dpkYXQZ.SelectedDate == null || dpkRQ_SC.SelectedDate == null)
            {
                Alert.Show("输入的效期或生产日期错误,请检查!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            DateTime time_sc  = Convert.ToDateTime(dpkRQ_SC.Text);
            DateTime time_yx  = Convert.ToDateTime(dpkYXQZ.Text);
            DateTime time_now = new DateTime();

            time_now = DateTime.Now;
            if (DateTime.Compare(time_sc, time_now) > 0)
            {
                Alert.Show("生产日期不能大于当前日期!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (DateTime.Compare(time_now, time_yx) > 0)
            {
                Alert.Show("有效日期不能小于当前日期!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (!DbHelperOra.Exists(string.Format("select 1 from DOC_GOODS where GDSEQ='{0}' OR GDNAME ='{0}' ", hfdGDSEQ.Text.Trim())))
            {
                Alert.Show(string.Format("您输入的商品【{0}】在商品资料中不存在,请重新输入!", "消息提示", tbxGDNAME.Text), MessageBoxIcon.Warning);
                return;
            }
            //验证批号是否已经存在
            if (DbHelperOra.Exists(string.Format("select 1 from DAT_GOODSSTOCK where GDSEQ=(select gdseq from doc_goods where  GDSEQ='{0}' OR GDNAME ='{0}') and PHID = '{1}'", hfdGDSEQ.Text.Trim(), tbsPH.Text)))
            {
                Alert.Show("您输入的商品批号已存在,请检查!");
                return;
            }
            MyTable myLot = new MyTable("DOC_GOODSPH");

            myLot.ColRow = PubFunc.FormDataHT(FormLot);
            myLot.ColRow.Add("PHID", tbsPH.Text);
            myLot.ColRow.Remove("GDNAME");
            myLot.InsertExec();

            Alert.Show("批号信息保存成功!");
            DataSearch();
        }
예제 #5
0
        protected void btSave_Click(object sender, EventArgs e)
        {
            MyTable mtQuest = new MyTable("PRO_QUESTION");

            mtQuest.ColRow = PubFunc.FormDataHT(FormQuest);
            if (fudIMAGE.HasFile)
            {
                string fileName = fudIMAGE.ShortFileName;

                if (!ValidateFileType(fileName))
                {
                    Alert.Show("无效的文件类型!");
                    return;
                }

                fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
                fileName = DateTime.Now.Ticks.ToString() + "_" + fileName;

                //按日期归类保存
                string datePath = DateTime.Now.ToString("yyyyMM") + "/" + DateTime.Now.ToString("dd") + "/";
                //物理完整路径
                string filePath = MapPath("~/ERPUpload/Question/" + datePath);

                //检查是否有该路径,没有就创建
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }
                fudIMAGE.SaveAs(filePath + fileName);
                mtQuest.ColRow.Add("IMAGE", "~/ERPUpload/Question/" + datePath + fileName);
            }
            mtQuest.ColRow.Remove("ISNEW");
            if (hfdISNEW.Text == "Y")
            {
                object objSeq = DbHelperOra.GetSingle("select seq_public.nextval from dual");
                mtQuest.ColRow["SEQ"] = objSeq.ToString();
                mtQuest.InsertExec();
            }
            else
            {
                mtQuest.UpdateExec();
            }
            billNew();
            DataSearch();
            Alert.Show("项目问题信息保存成功!", "消息提示", MessageBoxIcon.Information);
        }
예제 #6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (PubFunc.FormDataCheck(FormDosage).Length > 0)
            {
                return;
            }
            int out_i = 0;

            if (!int.TryParse(tbxCode.Text, out out_i))
            {
                Alert.Show("请输入正确的药效编码!");
                return;
            }
            if (out_i < 1)
            {
                Alert.Show("请输入正确的药效编码!");
                return;
            }
            MyTable mtType = new MyTable("DOC_GOODSJX");

            mtType.ColRow = PubFunc.FormDataHT(FormDosage);
            if (hfdIsNew.Text == "Y")
            {
                if (DbHelperOra.Exists(string.Format("select 1 from DOC_GOODSJX where code='{0}'", tbxCode.Text)))
                {
                    Alert.Show(string.Format("您输入的剂型编码【{0}】已存在,请重新输入!", tbxCode.Text), MessageBoxIcon.Warning);
                    return;
                }
                mtType.InsertExec();
            }
            else
            {
                if (ckbFlag.Checked)
                {
                    DbHelperOra.ExecuteSql("UPDATE DOC_GOODSJX SET flag='Y',name='" + tbxName.Text.Trim() + "' WHERE CODE='" + tbxCode.Text + "'");
                }
                else
                {
                    DbHelperOra.ExecuteSql("UPDATE DOC_GOODSJX SET flag='N',name='" + tbxName.Text.Trim() + "' WHERE CODE='" + tbxCode.Text + "'");
                }
            }
            OperLog("剂型资料", "修改剂型【" + tbxName.Text.Trim() + "】");
            Alert.Show("数据保存成功!");
            GetDosage();
        }
예제 #7
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (PubFunc.FormDataCheck(FormMx).Length > 0)
            {
                return;
            }
            //判断此类别是否存在
            if ((DbHelperOra.Exists("select 1 from SYS_CATEGORY where code = '" + tbxCode.Text + "'")) && (tbxCode.Enabled))
            {
                Alert.Show("此商品类别编码已经存在,请检查!");
                return;
            }

            string  ls_codelabel;
            MyTable mtTable = new MyTable(strTable, "CODE");

            mtTable.ColRow = PubFunc.FormDataHT(FormMx);
            ls_codelabel   = PubFunc.FormLabelGet(FormMx, "CODE");
            if (PubFunc.StrIsEmpty(mtTable.ColRow["CODE"].ToString()))
            {
                Alert.Show("【" + ls_codelabel + "】不能为空!");
                return;
            }
            else if (mtTable.ColRow["CODE"].ToString().Length != CodeLen(tbxCLASS.Text))
            {
                Alert.Show("【" + ls_codelabel + "】长度应该为【" + CodeLen(tbxCLASS.Text).ToString() + "】,请修改!");
                return;
            }
            if (tbxCode.Enabled)  //新增
            {
                mtTable.InsertExec();
            }
            else
            {
                mtTable.UpdateExec("");
            }
            Alert.Show("数据保存成功!");
            tbxCode.Enabled = false;
            InitTree();
        }
예제 #8
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!chkMONDAY.Checked && !chkTUESDAY.Checked && !chkWEDNESDAY.Checked && !chkTHURSDAY.Checked && !chkFRIDAY.Checked && !chkSATURDAY.Checked && !chkSUNDAY.Checked)
            {
                Alert.Show("请选择业务操作的周期!", "操作提示", MessageBoxIcon.Warning);
                return;
            }
            MyTable mtType = new MyTable("DAT_WORK");

            mtType.ColRow = PubFunc.FormDataHT(FormMange);
            if (!DbHelperOra.Exists(string.Format("SELECT 1 FROM DAT_WORK WHERE DEPTID = '{0}' AND TYPE = '{1}'", ddlDEPTID.SelectedValue, ddlTYPE.SelectedValue)))
            {
                mtType.InsertExec();
            }
            else
            {
                mtType.UpdateExec("");
            }

            Alert.Show("数据保存成功!");
            dataSearch();
            PubFunc.FormDataClear(FormMange);
        }
예제 #9
0
        protected void btnRejectSubmit_Click(object sender, EventArgs e)
        {
            if (ddlType.SelectedValue != "D")
            {
                if (PubFunc.FormDataCheck(FormProducer).Length > 0)
                {
                    return;
                }
            }

            if (tbxSUPID.Text.Trim().Length > 1)
            {
                if (DbHelperOra.Exists("select 1 from DOC_SUPPLIERTEMP where SUPID='" + tbxSUPID.Text + "'"))
                {
                    DbHelperOra.ExecuteSql("DELETE FROM DOC_SUPPLIERTEMP WHERE SUPID='" + tbxSUPID.Text + "'");
                }
            }
            if (hfdIsNew.Text == "N" && tbxSUPID.Text.Trim().Length < 1)
            {
                DataTable dt = DbHelperOra.QueryForTable("SELECT F_GET_SUPCODE FROM DUAL");
                if (dt.Rows.Count > 0)
                {
                    tbxSUPID.Text = dt.Rows[0][0].ToString();
                }
            }
            else if (hfdIsNew.Text == "M" && tbxSUPID.Text.Trim().Length > 0)
            {
                if (DbHelperOra.Exists("select 1 from DOC_SUPPLIERTEMP where SUPID='" + tbxSUPID.Text + "'"))
                {
                    DbHelperOra.ExecuteSql("DELETE FROM DOC_SUPPLIERTEMP WHERE SUPID='" + tbxSUPID.Text + "'");
                }
            }
            else if (hfdIsNew.Text == "D")
            {
                for (int i = 0; i < GridSupplier.SelectedRowIndexArray.Length; i++)
                {
                    if (DbHelperOra.Exists("select 1 from DOC_SUPPLIERTEMP where SUPID='" + GridSupplier.Rows[GridSupplier.SelectedRowIndexArray[i]].DataKeys[0] + "'"))
                    {
                        DbHelperOra.ExecuteSql("DELETE FROM DOC_SUPPLIERTEMP WHERE SUPID='" + GridSupplier.Rows[GridSupplier.SelectedRowIndexArray[i]].DataKeys[0] + "'");
                    }
                    if (DbHelperOra.Exists("select 1 from DOC_SUPPLIER where SUPID='" + GridSupplier.Rows[GridSupplier.SelectedRowIndexArray[i]].DataKeys[0] + "'"))
                    {
                        DbHelperOra.ExecuteSql("INSERT INTO DOC_SUPPLIERTEMP SELECT * FROM DOC_SUPPLIER where SUPID='" + GridSupplier.Rows[GridSupplier.SelectedRowIndexArray[i]].DataKeys[0] + "' ");
                    }
                    hfdTEMP.Text += GridSupplier.Rows[GridSupplier.SelectedRowIndexArray[i]].DataKeys[0] + ",";
                }
                GridInIt();
                WindowGoods.Hidden = true;
                return;
            }
            MyTable mtType = new MyTable("DOC_SUPPLIERTEMP");

            if (tbxSUPNAME.Text.Trim().Length < 1)
            {
                Alert.Show("请输入供应商名称!", "提示信息", MessageBoxIcon.Warning);
                return;
            }
            if ((DbHelperOra.Exists("select 1 from DOC_SUPPLIER where SUPID = '" + tbxSUPID.Text + "'")) && (tbxSUPID.Enabled))
            {
                Alert.Show("此供应商编码已经存在,请重新输入!", "提示信息", MessageBoxIcon.Warning);
                return;
            }
            if (hfdIsNew.Text == "N")
            {
                if (DbHelperOra.Exists("SELECT 1 FROM DOC_SUPPLIER WHERE SUPNAME = '" + tbxSUPNAME.Text + "'"))
                {
                    Alert.Show("供应商名称已存在,请重新输入!", "提示信息", MessageBoxIcon.Warning);
                    return;
                }
            }
            mtType.ColRow = PubFunc.FormDataHT(FormProducer);
            mtType.ColRow.Add("SUPCAT", "03");
            mtType.ColRow["ISSEND"] = chkSTR1.Checked ? "N" : "Y";
            mtType.ColRow["ISDG"]   = chkSTR1.Checked ? "Y" : "N";
            mtType.ColRow["FLAG"]   = "Y";
            mtType.InsertExec();
            GridInTo();
        }
예제 #10
0
        private void saveExec()
        {
            try
            {
                if (PubFunc.FormDataCheck(FormProducer).Length > 0)
                {
                    return;                                                //存在为空的非空列则返回!
                }
                //增加自动生成的编码
                if (hfdIsNew.Text == "Y" && tbxSUPID.Text.Trim().Length < 1)
                {
                    DataTable dt = DbHelperOra.QueryForTable("SELECT F_GET_SUPCODE FROM DUAL");
                    if (dt.Rows.Count > 0)
                    {
                        tbxSUPID.Text = dt.Rows[0][0].ToString();
                    }
                    if (string.IsNullOrEmpty(tbxSUPID.Text))//当导入供应商时,SUPID再次新增时,超过50次尝试后无法自动生成
                    {
                        string          getstring  = DbHelperOra.GetSingle("SELECT SUPID FROM(SELECT SUPID FROM DOC_SUPPLIER ORDER BY SUPID DESC) WHERE ROWNUM=1  ").ToString();
                        int             totalcount = 0;
                        int             zerocount  = 0;
                        string          newstring  = "";
                        MatchCollection ms         = Regex.Matches(getstring, @"\d+");
                        foreach (Match m in ms)
                        {
                            if (!string.IsNullOrEmpty(m.Value))
                            {
                                totalcount    = m.Value.Length;                                      //总位数
                                zerocount     = totalcount - Int32.Parse(m.Value).ToString().Length; //0的位数
                                newstring     = (Int32.Parse(m.Value) + 1).ToString();
                                tbxSUPID.Text = getstring.Replace(m.Value, "") + m.Value.Substring(0, zerocount) + newstring;
                            }
                        }
                    }
                }
                MyTable mtType = new MyTable("DOC_SUPPLIER");

                if ((DbHelperOra.Exists("select 1 from DOC_SUPPLIER where SUPID = '" + tbxSUPID.Text + "'")) && (tbxSUPID.Enabled))
                {
                    Alert.Show("此供应商编码已经存在,请重新输入!", "提示信息", MessageBoxIcon.Warning);
                    return;
                }
                if (string.IsNullOrEmpty(hfdsavecount.Text))
                {
                    if (DbHelperOra.Exists("select 1 from DOC_SUPPLIER where SUPNAME = '" + tbxSUPNAME.Text + "'"))
                    {
                        Alert.Show("此供应商名称已经存在,请重新输入!", "提示信息", MessageBoxIcon.Warning);
                        return;
                    }
                }
                if (!chkISDG.Checked && chkSTR1.Checked)
                {
                    Alert.Show("本地供应商必须为代管供应商!", "提示信息", MessageBoxIcon.Warning);
                    chkISDG.Checked = true;
                    return;
                }
                if (chkISSUPPLIER.Checked && chkISPSS.Checked)
                {
                    Alert.Show("【供应商】标记与【配送商】标记不能同时维护!", "提示信息", MessageBoxIcon.Warning);
                    return;
                }
                mtType.ColRow = PubFunc.FormDataHT(FormProducer);
                //mtType.ColRow.Add("FLAG", "N");
                mtType.ColRow.Add("SUPCAT", "03");

                if (hfdIsNew.Text == "" || hfdIsNew.Text == "Y")
                {
                    mtType.ColRow["ISSEND"] = chkSTR1.Checked?"Y":"N";
                    mtType.InsertExec();
                    Alert.Show("数据保存成功!");
                    btnSave.Enabled = false;
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(tbxSUPPWD.Text.Trim()))
                    {
                        mtType.ColRow.Remove("SUPPWD");
                    }
                    else
                    {
                        mtType.ColRow["SUPPWD"] = PasswordUtil.CreateDbPassword(tbxSUPPWD.Text.Trim());
                    }
                    mtType.UpdateExec("");
                    Alert.Show("数据更新成功!");
                }
                OperLog("供应商资料", "修改供应商【" + tbxSUPID.Text + "】");
            }
            catch (Exception)
            {
                Alert.Show("请确认您的供应商名称是否重复了!");
            }
        }
예제 #11
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (PubFunc.FormDataCheck(FormUnit).Length > 1)
            {
                return; //存在为空的非空列则返回!
            }
            if (tbxCode.Text.Trim() == "" || tbxName.Text.Trim() == "")
            {
                Alert.Show("请维护单位编码和单位名称!");
                return;
            }
            if (tbxCode.Text.Length > 15 || tbxName.Text.Length > 30)
            {
                Alert.Show("单位编码或单位名称超长!");
                return;
            }
            try
            {
                int k = Convert.ToInt16(tbxCode.Text);
                if (k < 0)
                {
                    Alert.Show("单位编码只能输入大于0的数字!");
                    return;
                }
            }
            catch
            {
                Alert.Show("单位编码只能输入数字!");
                return;
            }
            if (tbxCode.Enabled != false)
            {
                if (DbHelperOra.Exists(string.Format("select 1 from DOC_GOODSUNIT where CODE='{0}'", tbxCode.Text.Trim())))
                {
                    Alert.Show(string.Format("您输入的单位编码【{0}】已存在,请重新输入!", tbxCode.Text), MessageBoxIcon.Warning);
                    return;
                }
            }

            MyTable mtType = new MyTable("DOC_GOODSUNIT");

            mtType.ColRow = PubFunc.FormDataHT(FormUnit);
            if (hfdIsNew.Text == "Y")
            {
                mtType.InsertExec();
            }
            else
            {
                if (ckbFlag.Checked)
                {
                    DbHelperOra.ExecuteSql("update DOC_GOODSUNIT set name = '" + tbxName.Text.Trim() + "',flag='Y' where code = '" + tbxCode.Text.Trim() + "'");
                }
                else
                {
                    DbHelperOra.ExecuteSql("update DOC_GOODSUNIT set name = '" + tbxName.Text.Trim() + "',flag='N' where code ='" + tbxCode.Text.Trim() + "'");
                }
                OperLog("单位资料", "修改单位【" + tbxName.Text.Trim() + "】");
            }

            Alert.Show("数据保存成功!");
            LoadData();
        }
예제 #12
0
        private void saveExec()
        {
            try
            {
                if (PubFunc.FormDataCheck(FormProducer).Length > 0)
                {
                    return;                                                //存在为空的非空列则返回!
                }
                //增加自动生成的编码
                if (hfdIsNew.Text == "Y" && tbxSUPID.Text.Trim().Length < 1)
                {
                    DataTable dt = DbHelperOra.QueryForTable("SELECT F_GET_SUPCODE FROM DUAL");
                    if (dt.Rows.Count > 0)
                    {
                        tbxSUPID.Text = dt.Rows[0][0].ToString();
                    }
                    if (string.IsNullOrEmpty(tbxSUPID.Text))//当导入供应商时,SUPID再次新增时,超过50次尝试后无法自动生成
                    {
                        string          getstring  = DbHelperOra.GetSingle("SELECT SUPID FROM(SELECT SUPID FROM DOC_SUPPLIER ORDER BY SUPID DESC) WHERE ROWNUM=1  ").ToString();
                        int             totalcount = 0;
                        int             zerocount  = 0;
                        string          newstring  = "";
                        MatchCollection ms         = Regex.Matches(getstring, @"\d+");
                        foreach (Match m in ms)
                        {
                            if (!string.IsNullOrEmpty(m.Value))
                            {
                                totalcount    = m.Value.Length;                                      //总位数
                                zerocount     = totalcount - Int32.Parse(m.Value).ToString().Length; //0的位数
                                newstring     = (Int32.Parse(m.Value) + 1).ToString();
                                tbxSUPID.Text = getstring.Replace(m.Value, "") + m.Value.Substring(0, zerocount) + newstring;
                            }
                        }
                    }
                }
                MyTable mtType = new MyTable("DOC_SUPPLIER");

                if ((DbHelperOra.Exists("select 1 from DOC_SUPPLIER where SUPID = '" + tbxSUPID.Text + "'")) && (tbxSUPID.Enabled))
                {
                    Alert.Show("此供应商编码已经存在,请重新输入!", "提示信息", MessageBoxIcon.Warning);
                    return;
                }
                mtType.ColRow = PubFunc.FormDataHT(FormProducer);
                mtType.ColRow.Add("SUPCAT", "03");
                mtType.ColRow.Add("ISAGENT", 'Y');
                mtType.ColRow.Add("FLAG", 'N');

                if (hfdIsNew.Text == "" || hfdIsNew.Text == "Y")
                {
                    mtType.InsertExec();
                    Alert.Show("数据保存成功!");
                    btnSave.Enabled = false;
                }
                else
                {
                    mtType.UpdateExec("");
                    Alert.Show("数据更新成功!");
                }
            }
            catch (Exception)
            {
                Alert.Show("请确认您的供应商名称是否重复了!");
            }
        }
예제 #13
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (PubFunc.FormDataCheck(FormMain).Length > 0)
            {
                return;
            }
            //增加自动生成的编码
            if (hfdIsNew.Text == "Y" && tbxGDID.Text.Trim().Length < 1)
            {
                string catid = string.IsNullOrWhiteSpace(ddlCATID0.SelectedValue) ? "2" : ddlCATID0.SelectedValue;
                tbxGDID.Text = DbHelperOra.GetSingle("SELECT F_GET_BGGDSEQ('" + catid + "') FROM DUAL").ToString();
            }

            if (tbxGDID.Text.Trim().Length < 1)
            {
                Alert.Show("输入商品编码不符合规范!", "操作提示", MessageBoxIcon.Warning);
                return;
            }

            if ((",N,Y").IndexOf(ddlFLAG.SelectedValue) < 1)
            {
                Alert.Show("当前商品为【" + ddlFLAG.SelectedText + "】状态,不允许进行编辑!", "操作提示", MessageBoxIcon.Warning);
                return;
            }

            //增加单位的验证
            if (ddlUNIT_ORDER.SelectedValue == "D" && PubFunc.StrIsEmpty(nbbNUM_DABZ.Text))
            {
                Alert.Show("订货单位为大包装,请维护大包装数量!", "操作提示", MessageBoxIcon.Warning);
                return;
            }
            if (ddlUNIT_ORDER.SelectedValue == "D" && PubFunc.StrIsEmpty(ddlUNIT_DABZ.SelectedValue))
            {
                Alert.Show("订货单位为大包装,请维护大包装单位!", "操作提示", MessageBoxIcon.Warning);
                return;
            }
            if (ddlUNIT_ORDER.SelectedValue == "Z" && PubFunc.StrIsEmpty(nbbNUM_ZHONGBZ.Text))
            {
                Alert.Show("订货单位为中包装,请维护中包装数量!", "操作提示", MessageBoxIcon.Warning);
                return;
            }
            if (ddlUNIT_ORDER.SelectedValue == "Z" && PubFunc.StrIsEmpty(ddlUNIT_ZHONGBZ.SelectedValue))
            {
                Alert.Show("订货单位为中包装,请维护中包装单位!", "操作提示", MessageBoxIcon.Warning);
                return;
            }

            if (ddlUNIT_SELL.SelectedValue == "D" && PubFunc.StrIsEmpty(nbbNUM_DABZ.Text))
            {
                Alert.Show("出库单位为大包装,请维护大包装数量!", "操作提示", MessageBoxIcon.Warning);
                return;
            }
            if (ddlUNIT_SELL.SelectedValue == "D" && PubFunc.StrIsEmpty(ddlUNIT_DABZ.SelectedValue))
            {
                Alert.Show("出库单位为大包装,请维护大包装单位!", "操作提示", MessageBoxIcon.Warning);
                return;
            }
            if (ddlUNIT_SELL.SelectedValue == "Z" && PubFunc.StrIsEmpty(nbbNUM_ZHONGBZ.Text))
            {
                Alert.Show("出库单位为中包装,请维护中包装数量!", "操作提示", MessageBoxIcon.Warning);
                return;
            }
            if (ddlUNIT_SELL.SelectedValue == "Z" && PubFunc.StrIsEmpty(ddlUNIT_ZHONGBZ.SelectedValue))
            {
                Alert.Show("出库单位为中包装,请维护中包装单位!", "操作提示", MessageBoxIcon.Warning);
                return;
            }
            if (!PubFunc.StrIsEmpty(nbbHSJJ.Text))
            {
                if (Convert.ToDecimal(nbbHSJJ.Text) < 0)
                {
                    Alert.Show("含税进价不能小于0", "操作提示", MessageBoxIcon.Warning);
                    return;
                }
            }
            else
            {
                return;
            }
            //if (PubFunc.StrIsEmpty(trbSUPPLIER.SelectedValue))
            //{
            //    Alert.Show("缺省默认供应商不能为空", "操作提示", MessageBoxIcon.Warning);
            //    return;

            //}
            //如果是高值商品,订货单位和出库单位要相等
            if (ckbISGZ.Checked)
            {
                if (ddlUNIT_ORDER.SelectedValue != "X" || ddlUNIT_SELL.SelectedValue != "X")
                {
                    Alert.Show("高值商品,订货单位和出库单位必须为【最小包装单位】不一致,请调整!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                //不允许是定数商品
                if (DbHelperOra.Exists(string.Format("SELECT 1 FROM DOC_GOODSCFG WHERE NVL(NUM1,0)> 0 AND NVL(DSNUM,0) > 0 AND GDSEQ = '{0}'", tbxGDID.Text)))
                {
                    Alert.Show("商品为定数商品,不允许设置为高值", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                //必须无库存时可设置为高值商品
                if (DbHelperOra.Exists(string.Format("SELECT 1 FROM DAT_GOODSSTOCK A,DOC_GOODS B WHERE A.KCSL > 0 AND A.GDSEQ = '{0}' AND A.GDSEQ =B.GDSEQ AND B.ISGZ = 'N'", tbxGDID.Text)))
                {
                    Alert.Show("商品存在未使用库存,不允许设置为高值商品", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
            }
            //if (ckbISFLAG3.Checked)
            //{
            //    object Supname = DbHelperOra.GetSingle("select f_getsupname(SUPID) from doc_goodssup WHERE GDSEQ = '" + tbxGDID.Text.Trim() + "'");
            //    if (!PubFunc.StrIsEmpty((Supname ?? "").ToString()))
            //    {
            //        Alert.Show("该商品被设置为【直送商品】但它当前为【" + Supname + "】供应商的库存品,无法执行操作。", "操作提示", MessageBoxIcon.Warning);
            //        return;
            //    }
            //}
            if (ckbISFLAG3.Checked)
            {
                DataTable dt = DbHelperOra.QueryForTable(string.Format(@"SELECT SD.CODE FROM DOC_GOODSCFG DGC ,SYS_DEPT SD WHERE DGC.DEPTID=SD.CODE AND DGC.GDSEQ='{0}' AND SD.TYPE='1' AND (SELECT F_GETKCGDSEQ(SD.CODE,DGC.GDSEQ,'') FROM DUAL)>0", tbxGDID.Text.Trim()));
                if (dt.Rows.Count > 0)
                {
                    string deptname = "";
                    foreach (DataRow dr in dt.Rows)
                    {
                        deptname += dr["CODE"].ToString() + ",";
                    }
                    Alert.Show("商品在库房【" + deptname.Substring(0, deptname.Length - 1) + "】有库存,无法被设置为【直送商品】。", "操作提示", MessageBoxIcon.Warning);
                    return;
                }
            }

            if (ckbISFLAG3.Checked)
            {
                if (DbHelperOra.Exists(string.Format("SELECT 1 FROM DOC_GOODSCFG WHERE GDSEQ = '{0}' AND NUM1 >0 AND DSNUM>0", tbxGDID.Text.Trim())))
                {
                    Alert.Show("该商品被设置为定数,不允许设置为直送商品!", "操作提示", MessageBoxIcon.Warning);
                    return;
                }
            }
            hfdGDSEQ.Text = tbxGDID.Text;
            MyTable mtType = new MyTable("DOC_GOODS");

            mtType.ColRow = PubFunc.FormDataHT(FormMain);
            Hashtable htAssist = PubFunc.FormDataHT(FormAssist);

            foreach (string key in htAssist.Keys)
            {
                mtType.ColRow.Add(key, htAssist[key]);
            }

            //数据处理
            mtType.ColRow.Remove("ISNEW");
            if (hfdIsNew.Text == "Y")
            {
                if (DbHelperOra.Exists(string.Format("select 1 from doc_goods where GDSEQ='{0}'", tbxGDID.Text.Trim())))
                {
                    Alert.Show(string.Format("您输入的商品编码【{0}】已存在,请重新输入!", tbxGDID.Text), MessageBoxIcon.Warning);
                    return;
                }
                if (string.IsNullOrWhiteSpace(trbSUPPLIER.SelectedValue))
                {
                    //trbSUPPLIER.SelectedValue = "00002";
                    mtType.ColRow["SUPPLIER"] = "00002";
                }
                mtType.ColRow["GDSEQ"]   = mtType.ColRow["GDID"];
                mtType.ColRow["ISFLAG7"] = ddlISFLAG7.SelectedValue;
                mtType.InsertExec();
            }
            else
            {
                if (DbHelperOra.Exists(string.Format("SELECT 1 FROM DAT_RK_DOC A,DAT_RK_COM B WHERE A.SEQNO=B.SEQNO AND A.FLAG IN ('M','N','R') AND ISGZ='{0}' AND B.GDNAME='{1}'", ckbISGZ.Checked ? "N" : "Y", tbsGDNAME.Text)))
                {
                    Alert.Show(string.Format("商品【{0}】还有入库单未处理,请处理完入库单之后再做修改!", tbsGDNAME.Text), "警告提示", MessageBoxIcon.Warning);
                    return;
                }
                if (string.IsNullOrWhiteSpace(trbSUPPLIER.SelectedValue))
                {
                    //trbSUPPLIER.SelectedValue = "00002";
                    mtType.ColRow["SUPPLIER"] = "00002";
                }

                string    msg = "";
                DataTable dt  = DbHelperOra.Query(string.Format("SELECT * FROM DOC_GOODS WHERE GDSEQ = '{0}'", mtType.ColRow["GDSEQ"])).Tables[0];
                if (dt != null && dt.Rows.Count > 0)
                {
                    DataCheck(dt.Rows[0], FormMain, ref msg);
                    DataCheck(dt.Rows[0], FormAssist, ref msg);
                }
                List <CommandInfo> cmdList = new List <CommandInfo>();
                //if (dt.Rows[0]["SUPPLIER"].ToString() != trbSUPPLIER.SelectedValue && !string.IsNullOrWhiteSpace(trbSUPPLIER.SelectedValue) && trbSUPPLIER.SelectedValue != "00001")
                //{
                //    string sup_sql = @"declare
                //                                  ln_num number;
                //                                begin
                //                                  select count(1) into ln_num from doc_goodssup where gdseq = '{0}';
                //                                  if ln_num > 0 then
                //                                    update doc_goodssup s
                //                                       set s.supid = '{1}', s.supname = '{2}'
                //                                     where s.gdseq = '{0}' ;
                //                                  else
                //                                    insert into doc_goodssup
                //                                      (custid, gdseq, supid, supname,str3)
                //                                    values
                //                                      (f_getpara('USERCODE'), '{0}', '{1}', '{2}',SUBSTR(nvl(f_getpara('FDSMODE'),'XSJ'),1,1));
                //                                  end if;
                //                                end;";
                //    cmdList.Add(new CommandInfo(string.Format(sup_sql, hfdGDSEQ.Text, trbSUPPLIER.SelectedValue, trbSUPPLIER.SelectedText), null));
                //}
                if (!string.IsNullOrEmpty(msg))
                {
                    //Alert.Show(DateTime.Now + "', '" + UserAction.UserID + "', 'USER', 'GoodsManage.aspx', '商品资料更改:"+msg );
                    //return;
                    string sql = "INSERT INTO sys_operlog (SEQNO, RQSJ, USERID, STATION, FUNCID, MEMO, TYPE) VALUES (seq_operlog.nextval, SYSDATE, '" + UserAction.UserID + "', 'USER', '商品资料管理', '商品【" + mtType.ColRow["GDSEQ"] + "】资料更新:" + msg + "','LOG')";
                    cmdList.Add(new CommandInfo(sql, null));
                }
                //if (!string.IsNullOrWhiteSpace(trbSUPPLIER.SelectedValue))
                //{
                //    cmdList.Add(new CommandInfo(string.Format("update doc_goods set supplier='{0}' where gdseq='{1}'", trbSUPPLIER.SelectedValue,hfdGDSEQ.Text), null));
                //}
                mtType.ColRow["UPTTIME"] = DateTime.Now;
                cmdList.Add(mtType.Update(""));
                DbHelperOra.ExecuteSqlTran(cmdList);
                DataTable dtBack = DbHelperOra.Query("select * from doc_goods where gdseq='" + tbxGDID.Text + "'").Tables[0];
                PubFunc.FormDataSet(FormMain, dtBack.Rows[0]);
                PubFunc.FormDataSet(FormAssist, dtBack.Rows[0]);
            }
            //更新部门配置信息
            string cfg = "";

            int[] selections = GridDept.SelectedRowIndexArray;
            foreach (int rowIndex in selections)
            {
                cfg += string.Concat(GridDept.DataKeys[rowIndex][0].ToString(), ",");
            }
            if (!string.IsNullOrEmpty(cfg))
            {
                OracleParameter[] parameters =
                {
                    new OracleParameter("V_GDSEQ",   OracleDbType.Varchar2,   20),
                    new OracleParameter("V_CFGLIST", OracleDbType.Varchar2, 4000),
                    new OracleParameter("V_USERID",  OracleDbType.Varchar2, 20)
                };
                parameters[0].Value = hfdGDSEQ.Text;
                parameters[1].Value = cfg.TrimEnd(',');
                parameters[2].Value = UserAction.UserID;
                try
                {
                    DbHelperOra.RunProcedure("P_GOODSMANAGE", parameters);
                }
                catch (Exception ex)
                {
                    Alert.Show(Error_Parse(ex.Message), "提示信息", MessageBoxIcon.Warning);
                    return;
                }
            }
            else
            {
                OracleParameter[] parameters =
                {
                    new OracleParameter("V_GDSEQ",   OracleDbType.Varchar2,   20),
                    new OracleParameter("V_CFGLIST", OracleDbType.Varchar2, 2000),
                    new OracleParameter("V_USERID",  OracleDbType.Varchar2, 20)
                };
                parameters[0].Value = hfdGDSEQ.Text;
                parameters[1].Value = "NULL";
                parameters[2].Value = UserAction.UserID;
                try
                {
                    DbHelperOra.RunProcedure("P_GOODSMANAGE", parameters);
                }
                catch (Exception ex)
                {
                    Alert.Show(Error_Parse(ex.Message), "提示信息", MessageBoxIcon.Warning);
                    return;
                }
            }
            Alert.Show("数据保存成功!");

            hfdIsNew.Text   = "N";
            btExp.Enabled   = false;
            ddlUNIT.Enabled = false;
            //nbbHSJJ.Enabled = true;
            ddlCATID.Enabled = false;

            //保存后,界面的锁定 lvj 20160615
            ddlISFLAG7.Enabled  = false;
            tbxGDID.Enabled     = false;
            tbxGDSPEC.Enabled   = false;
            ddlUNIT.Enabled     = false;
            nbbBHSJJ.Enabled    = false;
            trbPRODUCER.Enabled = false;
            tbxPIZNO.Enabled    = false;
        }
예제 #14
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (PubFunc.FormDataCheck(FormProducer).Length > 1)
            {
                return; //存在为空的非空列则返回!
            }
            foreach (FineUIPro.FormRow fr in FormProducer.Rows)
            {
                if (fr.Hidden)
                {
                    continue;
                }
                foreach (Field cl in fr.Items)
                {
                    if (cl is FineUIPro.TextBox)
                    {
                        FineUIPro.TextBox tbx = (FineUIPro.TextBox)cl;
                        if (tbx.Text.Length > (tbx.MaxLength ?? 20))
                        {
                            Alert.Show(string.Format("您输入的{0}字段长度超长,最大长度为:{1}!", tbx.Label, tbx.MaxLength), "警告提示", MessageBoxIcon.Warning);
                            return;
                        }
                    }
                }
            }
            //if (tbxCODE.Text.Length > 50 || tbxLEADER.Text.Length > 20 || tbxNAME.Text.Length > 60 || tbxTEL.Text.Length > 20)
            //{
            //    Alert.Show("您输入的{0}字段超长,!", "警告提示", MessageBoxIcon.Warning);
            //    return;
            //}
            //if (tbxFAX.Text.Length > 20 || tbxENAME.Text.Length > 60 || tbxZIP.Text.Length > 6 || tbxEMAIL.Text.Length > 60 || tbxLOGINADDR.Text.Length > 60 || tbxJYFW.Text.Length > 60)
            //{
            //    Alert.Show("您输入的字段超长!", "警告提示", MessageBoxIcon.Warning);
            //    return;
            //}
            //if (tbxLINKFAX.Text.Length > 40 || tbxLINKMAN.Text.Length > 20 || tbxLINKTEL.Text.Length > 40 || tbxLINKEMAIL.Text.Length > 40)
            //{
            //    Alert.Show("您输入的字段超长!", "警告提示", MessageBoxIcon.Warning);
            //    return;
            //}
            MyTable mtType = new MyTable("DOC_PRODUCER");

            mtType.ColRow = PubFunc.FormDataHT(FormProducer);
            mtType.ColRow.Add("FLAG", "Y");
            mtType.ColRow.Add("SIMID", XTBase.Utilities.PinYinUtil.GetCodstring(tbxNAME.Text.Trim()));
            if (hfdIsNew.Text == "Y")
            {
                if (DbHelperOra.Exists(string.Format("SELECT 1 FROM DOC_PRODUCER WHERE CODE = '{0}'", mtType.ColRow["CODE"])))
                {
                    Alert.Show("生产商编码【" + tbxCODE.Text + "】已存在,请重新输入生产商编码!", "警告提示", MessageBoxIcon.Warning);
                    return;
                }
                mtType.InsertExec();
            }
            else
            {
                mtType.UpdateExec("");
            }

            Alert.Show("数据保存成功!");
            dataSearch();
            PubFunc.FormDataClear(FormProducer);
        }