예제 #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //写入项目中
            if (DbHelperOra.Exists("SELECT 1 FROM DOC_EVALUATION WHERE PRONAME = '" + tbxPRONAME.Text + "' AND SEQNO <> '" + tbxSEQNO.Text + "'"))
            {
                Alert.Show("已存在评价项目【" + tbxPRONAME.Text + "】", "提示信息", MessageBoxIcon.Warning);
                return;
            }
            MyTable mtType = new MyTable("DOC_EVALUATION");

            mtType.ColRow         = PubFunc.FormDataHT(Form2);
            mtType.ColRow["XGR"]  = UserAction.UserID;
            mtType.ColRow["XGRQ"] = DateTime.Now;
            if (tbxSEQNO.Text.Length < 1)
            {
                mtType.ColRow["SEQNO"] = DbHelperOra.GetSingle("SELECT SEQ_EVAL.NEXTVAL FROM DUAL");
            }
            List <CommandInfo> cmdList = new List <CommandInfo>();

            cmdList.Add(new CommandInfo("DELETE DOC_EVALUATION WHERE SEQNO='" + tbxSEQNO.Text + "'", null));
            cmdList.AddRange(mtType.InsertCommand());
            DbHelperOra.ExecuteSqlTran(cmdList);
            WindowAdd.Hidden = true;
            btnSearch_Click(null, null);
        }
예제 #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)
        {
            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";
        }
예제 #4
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();
        }
예제 #5
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();
        }
예제 #6
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);
        }
예제 #7
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();
        }
예제 #8
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();
        }
예제 #9
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);
        }
예제 #10
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();
        }
예제 #11
0
        private void save(string flag = "Y")
        {
            #region 数据有效性验证
            if ((",M,R").IndexOf(docFLAG.SelectedValue) < 0)
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    //填写商品追溯码时,使用数必须为小于等于1
                    if (newDict[i]["NUM1"].ToString() == newDict[i]["NUM2"].ToString())
                    {
                        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】调整与原设定相同,请检查!", "提示信息", MessageBoxIcon.Warning);
                        return;
                    }
                    goodsData.Add(newDict[i]);
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docBILLNO.Text    = BillSeqGet();
                docBILLNO.Enabled = false;
            }
            else
            {
                string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'M') FROM DAT_DT_DOC WHERE SEQNO='{0}'", docBILLNO.Text));
                if (!string.IsNullOrWhiteSpace(flg) && (",M,R").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    docBILLNO.Enabled = false;
                }
            }
            MyTable mtType = new MyTable("DAT_DT_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow["FLAG"]  = "M";
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("XSTYPE", "1");
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_DT_COM");
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_DT_DOC where seqno='" + docBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_DT_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
            }
            cmdList.AddRange(mtType.InsertCommand());
            //增加待办事宜
            cmdList.Add(Doc.GETDOADD("DO_13", docDEPTID.SelectedValue, docLRY.SelectedValue, docBILLNO.Text.Trim()));

            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("高值修改信息保存成功!");
                OperLog("高值调整", "修改单据【" + docBILLNO.Text + "】");
                billOpen(docBILLNO.Text);
            }
            SaveSuccess = true;
        }
예제 #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;
                }
                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("请确认您的供应商名称是否重复了!");
            }
        }
예제 #13
0
        protected override void billSave()
        {
            #region 数据有效性验证
            if (("MR").IndexOf(docFLAG.SelectedValue) < 0)
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (!CheckFlagForM() && !CheckFlagForR())
            {
                Alert.Show("此单据已经被别人操作,请等待操作!");
                return;
            }
            if (!docBILLNO.Text.Contains(BillType) && docBILLNO.Text.Length > 0)
            {
                Alert.Show("下传单据不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > goodsData = GridCom.GetNewAddedList();
            if (goodsData.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }

            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            if (docDHRQ.SelectedDate == null)
            {
                Alert.Show("收货日期输入错误!");
                return;
            }
            string type = DbHelperOra.GetSingle(string.Format("select TYPE from SYS_DEPT where CODE='{0}'", docDEPTID.SelectedValue)).ToString();
            List <Dictionary <string, object> > newDict = new List <Dictionary <string, object> >();
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < goodsData.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(goodsData[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(goodsData[i]["GDNAME"].ToString()))
                {
                    if ((goodsData[i]["BZSL"] ?? "").ToString() == "" || (goodsData[i]["BZSL"] ?? "").ToString() == "0")
                    {
                        Alert.Show("请填写商品[" + goodsData[i]["GDSEQ"] + "]入库数!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if ((goodsData[i]["HSJJ"] ?? "").ToString() == "" || (goodsData[i]["HSJJ"] ?? "").ToString() == "0" || Convert.ToDecimal(goodsData[i]["HSJJ"]) == 0)
                    {
                        Alert.Show("商品[" + goodsData[i]["GDSEQ"] + "]的【含税进价】不能为零,请维护好商品的含税进价,再次保存!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }


                    //当入库部门为1药库、2药房时
                    if ((",1,2").IndexOf(type) > 0 && string.IsNullOrWhiteSpace(goodsData[i]["HWID"].ToString()))
                    {
                        Alert.Show("第[" + (i + 1) + "]行商品【" + goodsData[i]["GDNAME"].ToString() + "】货位不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    else
                    {
                        if (string.IsNullOrWhiteSpace(goodsData[i]["HWID"].ToString()))
                        {
                            goodsData[i]["HWID"] = docDEPTID.SelectedValue;
                        }
                    }

                    newDict.Add(goodsData[i]);
                }
            }

            if (newDict.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docSEQNO.Text     = BillSeqGet();
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            else
            {
                string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'M') FROM DAT_YRK_DOC WHERE SEQNO='{0}'", docBILLNO.Text));
                if (!PubFunc.StrIsEmpty(flg) && (",M,R").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    docSEQNO.Text     = docBILLNO.Text;
                    docBILLNO.Enabled = false;
                }
            }
            if (docBILLNO.Text.Length > 15)
            {
                Alert.Show("单据编号输入超长,请检查!");
                return;
            }
            MyTable mtType = new MyTable("DAT_YRK_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow["FLAG"]  = "M";
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", newDict.Count);
            mtType.ColRow.Add("PPSID", docPSSID.SelectedValue);
            //mtType.ColRow.Add("SUPNAME", docSUPID.SelectedText);
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_YRK_COM");
            //取消高值写入逻辑
            //MyTable mtTypeExt = new MyTable("DAT_RK_EXT");
            MyTable mtTypePh = new MyTable("DOC_GOODSPH");
            decimal subNum   = 0;                                                                          //总金额
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_YRK_DOC where seqno='" + docBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_YRK_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
            newDict = newDict.OrderBy(x => x["GDSEQ"]).ToList();                                           //按照商品编码重新排序
            for (int i = 0; i < newDict.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(newDict[i]);

                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow.Add("ROWNO", i + 1);
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Add("SSSL", 0);
                mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                mtTypeMx.ColRow["DDSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());

                string codeInfo = newDict[i]["CODEINFO"].ToString();
                mtTypeMx.ColRow.Remove("CODEINFO");
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBSUM", subNum);
            if (PubFunc.StrIsEmpty(mtType.ColRow["NUM1"].ToString()))
            {
                mtType.ColRow.Remove("NUM1");
            }
            cmdList.AddRange(mtType.InsertCommand());

            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("商品入库数据保存成功!");
                billOpen(docBILLNO.Text);
                billLockDoc(true);
                OperLog("跟台商品入库", "修改单据【" + docBILLNO.Text + "】");
            }
            else
            {
                Alert.Show("商品入库数据保存失败!", "错误提示", MessageBoxIcon.Error);
            }
        }
예제 #14
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();
        }
예제 #15
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if (docFLAG.SelectedValue != "M" && docFLAG.SelectedValue != "R")
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (!CheckFlag("M") && !CheckFlag("R"))
            {
                Alert.Show("此单据已经被别人操作,请等待操作!");
                return;
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();//.OrderBy(x => x["GDSEQ"]).ToList(); //排序这里给关掉
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }

            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    if (string.IsNullOrWhiteSpace(newDict[i]["BZHL"].ToString()) || string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString()))
                    {
                        Alert.Show("商品[" + newDict[i]["GDSEQ"] + "]包装单位信息错误,请联系管理员维护!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if ((newDict[i]["BZSL"] ?? "").ToString() == "" || (newDict[i]["BZSL"] ?? "0").ToString() == "0")
                    {
                        Alert.Show("请填写商品[" + newDict[i]["GDSEQ"] + "]退货数!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    //if (((newDict[i]["HSJJ"] ?? "").ToString() == "" || (newDict[i]["HSJJ"] ?? "").ToString() == "0") && ((newDict[i]["NUM1"] ?? "").ToString() != "1"))
                    if (((newDict[i]["HSJJ"] ?? "").ToString() == "" || (newDict[i]["HSJJ"] ?? "").ToString() == "0"))
                    {
                        Alert.Show("商品[" + newDict[i]["GDSEQ"] + "]的【含税进价】不能为零,请维护好商品的含税进价,再次保存!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (newDict[i]["ISLOT"].ToString() == "1" || newDict[i]["ISLOT"].ToString() == "2")
                    {
                        if (string.IsNullOrWhiteSpace(newDict[i]["PH"].ToString()))
                        {
                            string[] selectedCell = GridGoods.SelectedCell;
                            PageContext.RegisterStartupScript(String.Format("F('{0}').selectCell('{1}','{2}');", GridGoods.ClientID, selectedCell[0], selectedCell[1]));
                            Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】批号不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                            return;
                        }
                    }
                    goodsData.Add(newDict[i]);
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docSEQNO.Text     = BillSeqGet();
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            else
            {
                string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_TH_DOC WHERE SEQNO='{0}'", docBILLNO.Text));
                if (!string.IsNullOrWhiteSpace(flg) && (",M,R").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    docSEQNO.Text     = docBILLNO.Text;
                    docBILLNO.Enabled = false;
                }
            }
            MyTable mtType = new MyTable("DAT_TH_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow["FLAG"]  = "M";
            mtType.ColRow["NUM1"]  = "2";
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("SUPNAME", docPSSID.SelectedText);
            mtType.ColRow.Add("DEPTDH", mtType.ColRow["DEPTID"]);

            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_TH_COM");
            decimal            subNum   = 0;                                                              //总金额
                                                                                                          //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_TH_DOC where seqno='" + docBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_TH_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
            cmdList.Add(new CommandInfo("delete DAT_TH_EXT where billno='" + docBILLNO.Text + "'", null));
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow         = PubFunc.GridDataGet(goodsData[i]);
                mtTypeMx.ColRow["BZSL"] = Math.Abs(decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString())) * -1;
                mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow["THSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                mtTypeMx.ColRow.Add("SSSL", mtTypeMx.ColRow["THSL"]);
                mtTypeMx.ColRow.Add("DEPTID", docDEPTID.SelectedValue);
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
                //cmdList.Add(new CommandInfo("delete DAT_TH_EXT where onecode='" + mtTypeMx.ColRow["STR2"].ToString() + "'", null));
                cmdList.Add(new CommandInfo(String.Format(@"INSERT INTO DAT_TH_EXT(DEPTID,BILLNO,ROWNO,ONECODE,GDSEQ,GDNAME,BARCODE,UNIT,GDSPEC,DEPTCUR,BZHL,FLAG,PH,RQ_SC,YXQZ)
                        SELECT '{1}','{2}',B.ROWNO,A.ONECODE,A.GDSEQ,A.GDNAME,A.BARCODE,A.UNIT,A.GDSPEC,A.DEPTCUR,A.BZHL,A.FLAG,A.PH,A.RQ_SC,A.YXQZ
                          FROM DAT_RK_EXT A,DAT_TH_COM B
                         WHERE A.GDSEQ = B.GDSEQ AND A.ONECODE = '{0}' AND A.ONECODE = B.STR2 ", mtTypeMx.ColRow["STR2"].ToString(), docDEPTID.SelectedValue, docBILLNO.Text), null));
            }
            mtType.ColRow.Add("SUBSUM", subNum);
            //     cmdList.Add(new CommandInfo("delete DAT_TH_EXT where billno='" + docBILLNO.Text + "'", null));单据编号发生了变化,这条语句无法删除DAT_TH_EXT表中已经存在的ONECODE,ONECODE是唯一键,执行会报错
            //            cmdList.Add(new CommandInfo(String.Format(@"INSERT INTO DAT_TH_EXT(DEPTID,BILLNO,ROWNO,ONECODE,GDSEQ,GDNAME,BARCODE,UNIT,GDSPEC,DEPTCUR,BZHL,FLAG,PH,RQ_SC,YXQZ)
            //                        SELECT '{1}','{0}',B.ROWNUM,A.ONECODE,A.GDSEQ,A.GDNAME,A.BARCODE,A.UNIT,A.GDSPEC,A.DEPTCUR,A.BZHL,A.FLAG,A.PH,A.RQ_SC,A.YXQZ
            //                          FROM DAT_RK_EXT A,DAT_TH_COM B
            //                         WHERE A.GDSEQ = B.GDSEQ AND B.SEQNO = '{0}' AND A.ONECODE = B.STR2 ", docBILLNO.Text, docDEPTID.SelectedValue), null));
            cmdList.AddRange(mtType.InsertCommand());
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                if (flag == "N")
                {
                    Alert.Show("商品退货信息保存成功!");
                }
                //   billOpen(docBILLNO.Text);
                billLockDoc(true);
                billOpen(docSEQNO.Text);
                OperLog("商品退货", "修改单据【" + docBILLNO.Text + "】");
                SaveSuccess = true;
            }
            else
            {
                Alert.Show("商品退货信息保存失败,请联系管理员!");
            }
        }
예제 #16
0
        protected override void billSave()
        {
            #region 数据有效性验证
            if (docFLAG.SelectedValue != "M")
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    if (newDict[i]["ISLOT"].ToString() == "1" || newDict[i]["ISLOT"].ToString() == "2")
                    {
                        if (string.IsNullOrWhiteSpace(newDict[i]["PH"].ToString()))
                        {
                            //GridGoods.SelectedCell = new int[] { i, 8 };
                            string[] selectedCell = GridGoods.SelectedCell;
                            PageContext.RegisterStartupScript(String.Format("F('{0}').selectCell('{1}','{2}');", GridGoods.ClientID, selectedCell[0], "GDSPEC"));

                            Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】批号不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                            return;
                        }
                    }
                    if (newDict[i]["BZSL"].ToString() == "0" || string.IsNullOrWhiteSpace(newDict[i]["BZSL"].ToString()))
                    {
                        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】使用数填写不正确!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (decimal.Parse(newDict[i]["NUM5"].ToString()) < decimal.Parse(newDict[i]["BZSL"].ToString()))
                    {
                        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】使用数大于库存数,请重新输入!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    //当商品中含有贵重商品信息,即需要赋唯一码时
                    if (newDict[i]["ISGZ"].ToString() == "Y" && newDict[i]["ONECODE"].ToString() == "")
                    {
                        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】为贵重商品,请先进行扫描赋码!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    //填写商品追溯码时,使用数必须为小于等于1
                    //if (newDict[i]["ONECODE"].ToString().Length > 0 && newDict[i]["BZSL"].ToString() != "1")
                    //{
                    //    Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】为贵重商品,使用数量只能为1!");
                    //    return;
                    //}
                    goodsData.Add(newDict[i]);
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            //验证单据信息
            if (DbHelperOra.Exists("SELECT 1 FROM DAT_XS_DOC where seqno = '" + docBILLNO.Text + "'") && docBILLNO.Enabled)
            {
                Alert.Show("您输入的单号已存在,请检查!");
                return;
            }


            #endregion

            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docSEQNO.Text     = BillSeqGet();
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            else
            {
                string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_XS_DOC WHERE SEQNO='{0}'", docBILLNO.Text));
                if (!string.IsNullOrWhiteSpace(flg) && (",M,R").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    docSEQNO.Text     = docBILLNO.Text;
                    docBILLNO.Enabled = false;
                }
            }

            MyTable mtType = new MyTable("DAT_XS_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("XSTYPE", "3");
            mtType.ColRow["STR5"] = mtType.ColRow["DEPTGROUP"];

            mtType.ColRow.Remove("DEPTGROUP");
            mtType.ColRow.Remove("NUM");
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_XS_COM");
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("DELETE DAT_XS_DOC WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("DELETE DAT_XS_COM WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据明细
            cmdList.AddRange(mtType.InsertCommand());
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);


                if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["BZSL"].ToString()) || mtTypeMx.ColRow["BZSL"].ToString() == "0")
                {
                    Alert.Show("商品【" + mtTypeMx.ColRow["GDSEQ"] + " | " + mtTypeMx.ColRow["GDNAME"] + "】【使用数】为0或空,无法进行【使用信息管理】操作。", "消息提示", MessageBoxIcon.Warning);
                    return;
                }

                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow["DHSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString());
                mtTypeMx.ColRow["XSSL"] = mtTypeMx.ColRow["DHSL"];
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
            }

            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("学科组试剂领用信息保存成功!", "消息提示", MessageBoxIcon.Information);
                OperLog("试剂出库", "修改单据【" + docBILLNO.Text + "】");
                billOpen(docBILLNO.Text);
            }
        }
예제 #17
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (PubFunc.FormDataCheck(FormConfig).Length > 1)
            {
                return;
            }
            if (tbnZDKC.Text.Length > 0 && tbnZGKC.Text.Length > 0)
            {
                if (Convert.ToDecimal(tbnZDKC.Text) > Convert.ToDecimal(tbnZGKC.Text))
                {
                    Alert.Show("最低库存不能大于最高库存");
                    return;
                }
            }
            //填写定数数量,定数系数必须填写
            //if (nbxDSNUM.Text.Length > 0)
            //{
            //    if (NubNUM1.Text.Length < 1)
            //    {
            //        Alert.Show("定数数量不为0时,定数系数必须填写!");
            //        return;
            //    }
            //    if (Convert.ToDecimal(nbxDSNUM.Text) > 0 && Convert.ToDecimal(NubNUM1.Text) < 1)
            //    {
            //        Alert.Show("定数数量不为0时,定数系数必须填写!");
            //        return;
            //    }
            //}
            MyTable mtType = new MyTable("DOC_GOODSCFG");

            mtType.ColRow = PubFunc.FormDataHT(FormConfig);

            mtType.ColRow.Remove("GDNAME");
            string strISCFG = "";

            if (chkISCFGID.Checked)
            {
                strISCFG = "Y";
            }
            else
            {
                strISCFG = "N";
            }
            mtType.ColRow.Add("ISCFG", strISCFG);
            mtType.UpdateExec();
            //同步修改库存表中存在库存信息
            //if (DbHelperOra.Exists("SELECT 1 FROM SYS_DEPT WHERE CODE = '" + ddlDept.SelectedValue + "' AND TYPE IN('1','2')") && cbxTB.Checked)
            //{
            if (trbHJCODE1.Text.Trim().Length < 1)
            {
                Alert.Show("请维护库房商品【" + tbxGDSEQ.Text + "】的货位信息!", "操作提示", MessageBoxIcon.Warning);
                return;
            }
            if (cbxTB.Checked)
            {
                DbHelperOra.ExecuteSql("UPDATE DAT_GOODSSTOCK SET HWID = '" + trbHJCODE1.Text + "' WHERE GDSEQ = '" + tbxGDSEQ.Text + "' AND DEPTID = '" + ddlDept.SelectedValue + "'");
            }
            OperLog("商品配置", "修改科室【" + ddlDept.SelectedValue + "】商品【" + tbxGDSEQ.Text + "】");
            //}
            //else
            //{
            //    Alert.Show("这个是科室,直接把科室编码冻结");
            //}
            dataSearch();
            dataSearch("right");
            Alert.Show("配置信息保存成功!");
            //PubFunc.FormDataClear(FormConfig);
            //cbxTB.Checked = true;
        }
예제 #18
0
 private bool DataSave()
 {
     #region 数据有效性验证
     if ((",N,R").IndexOf(docFLAG.SelectedValue) < 0)
     {
         Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
         return(false);
     }
     string strBillno = docSEQNO.Text;
     if (!Doc.getFlag(strBillno, "N", BillType) && !Doc.getFlag(strBillno, "R", BillType))
     {
         Alert.Show("此单据已被其他人处理,请刷新页面更新单据状态!", "警告提示", MessageBoxIcon.Warning);
         return(false);
     }
     List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();
     if (newDict.Count == 0)
     {
         Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
         return(false);
     }
     List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
     //判断是否有空行
     for (int i = 0; i < newDict.Count; i++)
     {
         if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
         {
             if ((newDict[i]["BZSL"] ?? "").ToString() == "" || (newDict[i]["BZSL"] ?? "").ToString() == "0")
             {
                 //Alert.Show("请填写商品[" + newDict[i]["GDSEQ"] + "]的申请数量!", "消息提示", MessageBoxIcon.Warning);
                 //return false;
                 continue;
             }
             //if (decimal.Parse(newDict[i]["BZSL"].ToString()) > decimal.Parse(newDict[i]["NUM1"].ToString()))
             //{
             //    Alert.Show("商品【" + (newDict[i]["GDSEQ"].ToString()) + "】申请数不能大于库存数量", "异常信息", MessageBoxIcon.Warning);
             //    return false;
             //}
             if (string.IsNullOrWhiteSpace(newDict[i]["BZHL"].ToString()) || string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString()))
             {
                 Alert.Show("商品[" + newDict[i]["GDSEQ"] + "]包装单位信息错误,请联系管理员维护!", "消息提示", MessageBoxIcon.Warning);
                 return(false);
             }
             goodsData.Add(newDict[i]);
         }
     }
     if (goodsData.Count == 0)//所有Gird行都为空行时
     {
         Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
         return(false);
     }
     #endregion
     if (PubFunc.StrIsEmpty(docSEQNO.Text))
     {
         docSEQNO.Text     = BillSeqGet();
         docBILLNO.Text    = docSEQNO.Text;
         docBILLNO.Enabled = false;
     }
     else
     {
         string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_DB_DOC WHERE SEQNO='{0}'", docSEQNO.Text));
         if (!PubFunc.StrIsEmpty(flg) && (",N,R").IndexOf(flg) < 0)
         {
             Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
             return(false);
         }
         else
         {
             docBILLNO.Text   = docSEQNO.Text;
             docSEQNO.Enabled = false;
         }
     }
     if (string.IsNullOrWhiteSpace(docDEPTOUT.SelectedValue))
     {
         Alert.Show("请选择出库库房!", "提示", MessageBoxIcon.Information);
         return(false);
     }
     MyTable mtType = new MyTable("DAT_DB_DOC");
     mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
     mtType.ColRow["SEQNO"] = docBILLNO.Text;
     mtType.ColRow["FLAG"]  = "N";//所有单据在保存时单据状态一律为新增N
     mtType.ColRow.Add("BILLTYPE", BillType);
     mtType.ColRow.Add("SUBNUM", goodsData.Count);
     mtType.ColRow.Add("XSTYPE", "1");
     List <CommandInfo> cmdList  = new List <CommandInfo>();
     MyTable            mtTypeMx = new MyTable("DAT_DB_COM");
     //先删除单据信息在插入
     cmdList.Add(new CommandInfo("delete DAT_DB_DOC where seqno='" + docBILLNO.Text + "'", null)); //删除单据台头
     cmdList.Add(new CommandInfo("delete DAT_DB_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
     decimal subNum = 0;                                                                           //总金额
     for (int i = 0; i < goodsData.Count; i++)
     {
         mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
         //判断含税进价,为0时不能保存
         string isJiFei = string.Format("select 1 from DOC_GOODS t where iscf = 'N' and gdseq = '{0}'", mtTypeMx.ColRow["GDSEQ"].ToString());
         if (DbHelperOra.Exists(isJiFei))
         {
             if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["HSJJ"].ToString()) || mtTypeMx.ColRow["HSJJ"].ToString() == "0")
             {
                 Alert.Show("商品【含税进价】为0或空,无法进行【补货管理】操作。");
                 return(false);
             }
         }
         mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
         mtTypeMx.ColRow["ROWNO"] = i + 1;
         //mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
         if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["DHSL"].ToString()) || mtTypeMx.ColRow["DHSL"].ToString() == "0")
         {
             mtTypeMx.ColRow["DHSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
         }
         mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString());
         mtTypeMx.ColRow.Add("XSSL", 0);
         mtTypeMx.ColRow.Add("BHSJJ", 0);
         mtTypeMx.ColRow.Add("BHSJE", 0);
         mtTypeMx.ColRow.Remove("UNITNAME");
         mtTypeMx.ColRow.Remove("PRODUCERNAME");
         mtTypeMx.ColRow["PH"] = "";
         subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
         cmdList.Add(mtTypeMx.Insert());
     }
     mtType.ColRow.Add("SUBSUM", subNum);
     cmdList.AddRange(mtType.InsertCommand());
     string flag = DbHelperOra.GetSingle("SELECT VALUE FROM SYS_PARA WHERE CODE='ISAUTOAUDIT'").ToString();
     if (flag == "Y")
     {
         //当系统设置为自动审批时,商品申领信息在保存之后即进行审核操作
         OracleParameter[] parameters =
         {
             new OracleParameter("VTASKID", OracleDbType.Varchar2, 20),
             new OracleParameter("VPARA",   OracleDbType.Varchar2, 800)
         };
         parameters[0].Value = BillType;
         parameters[1].Value = "'" + docBILLNO.Text + "','" + BillType + "','" + UserAction.UserID + "','DECLARE'";
         cmdList.Add(new CommandInfo("P_EXECTASK", parameters, CommandType.StoredProcedure));
     }
     return(DbHelperOra.ExecuteSqlTran(cmdList));
 }
예제 #19
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if ((",M,R").IndexOf(docFLAG.SelectedValue) < 0)
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            List <string> newstr = new List <string>();
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    if ((newDict[i]["BZSL"] ?? "").ToString() == "" || (newDict[i]["BZSL"] ?? "").ToString() == "0")
                    {
                        Alert.Show("请填写商品[" + newDict[i]["GDSEQ"] + "]出库数!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(newDict[i]["BZHL"].ToString()) || string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString()))
                    {
                        Alert.Show("商品[" + newDict[i]["GDSEQ"] + "]包装单位信息错误,请联系管理员维护!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(newDict[i]["HSJJ"].ToString()))
                    {
                        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】含税进价不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString()))
                    {
                        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】出库包装未维护!!!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    goodsData.Add(newDict[i]);
                    newstr.Add(newDict[i]["STR2"].ToString());
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }

            if (newDict.Count != newstr.Distinct().ToArray().Count())
            {
                List <string> strReturn = new List <string>();
                StringBuilder sb        = new StringBuilder();
                int           i         = 0;
                foreach (string values in newstr.ToList())
                {
                    foreach (string values2 in newstr.ToList())
                    {
                        if (values2.Equals(values))
                        {
                            i++;
                        }
                        if (i > 1)
                        {
                            strReturn.Add(values);
                            i = 0;
                            break;
                        }
                    }
                }
                foreach (string res in strReturn.Distinct())
                {
                    sb.Append(res).Append(",");
                }
                Alert.Show(sb.ToString().Substring(0, sb.ToString().Count() - 1) + "高值码重复录入!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docSEQNO.Text     = BillSeqGet();
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            else
            {
                string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_CK_DOC WHERE SEQNO='{0}'", docBILLNO.Text));
                if (!string.IsNullOrWhiteSpace(flg) && (",M,R").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    docSEQNO.Text     = docBILLNO.Text;
                    docBILLNO.Enabled = false;
                }
            }
            MyTable mtType = new MyTable("DAT_CK_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);

            mtType.ColRow.Add("XSTYPE", "G");
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_CK_COM");
            decimal            subNum   = 0;//总金额
            string             onecode  = string.Empty;
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_CK_DOC where seqno='" + docBILLNO.Text + "' and flag = 'M'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_CK_COM where seqno='" + docBILLNO.Text + "'", null));                //删除单据明细
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);

                //判断含税进价,为0时不能保存
                if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["HSJJ"].ToString()) || mtTypeMx.ColRow["HSJJ"].ToString() == "0")
                {
                    Alert.Show("商品【含税进价】为0或空,无法进行【库房出库管理】操作。");
                    return;
                }

                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow["DHSL"]  = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                mtTypeMx.ColRow["HSJE"]  = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                mtTypeMx.ColRow.Add("XSSL", mtTypeMx.ColRow["DHSL"].ToString());
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                onecode += mtTypeMx.ColRow["STR2"].ToString() + ",";
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBSUM", subNum);
            //object objCount = DbHelperOra.GetSingle(@"SELECT LISTAGG(ONECODE,',') WITHIN GROUP( ORDER BY ONECODE)
            //                                                                      FROM DAT_CK_EXT WHERE BILLNO <> '" + docBILLNO.Text + @"'
            //                                                                       AND ONECODE IN ('" + onecode.Trim(',').Replace(",", "','") + "')");
            //if (objCount != null && objCount.ToString().Length > 0)
            //{
            //    Alert.Show("高值码【" + objCount.ToString() + "】重复!!!", "异常提醒", MessageBoxIcon.Warning);
            //    return;
            //}
            //写入追溯码表
            //cmdList.Add(new CommandInfo("DELETE FROM DAT_CK_EXT WHERE BILLNO='" + docBILLNO.Text + "'", null));//删除单据明细
            //cmdList.Add(new CommandInfo(String.Format(@"INSERT INTO DAT_CK_EXT(DEPTID,BILLNO,ROWNO,ONECODE,GDSEQ,GDNAME,BARCODE,UNIT,GDSPEC,DEPTCUR,BZHL,FLAG,PH,RQ_SC,YXQZ)
            //            SELECT '{1}','{0}',ROWNUM,A.ONECODE,A.GDSEQ,A.GDNAME,A.BARCODE,A.UNIT,A.GDSPEC,A.DEPTCUR,A.BZHL,A.FLAG,A.PH,A.RQ_SC,A.YXQZ
            //              FROM DAT_RK_EXT A,DAT_CK_COM B
            //             WHERE A.GDSEQ = B.GDSEQ AND B.SEQNO = '{0}' AND (A.ONECODE = B.STR2 OR A.STR1 = B.STR2)", docBILLNO.Text, docDEPTID.SelectedValue), null));//删除单据明细
            cmdList.Add(mtType.Insert());
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                if (flag == "N")
                {
                    Alert.Show("商品出库信息保存成功!");
                }
                billLockDoc(true);
                OperLog("高值扫码出库", "修改单据【" + docBILLNO.Text.Trim() + "】");
                billOpen(docBILLNO.Text);
                hdfRowIndex.Text = "";
            }
            SaveSuccess = true;
        }
예제 #20
0
        protected override void billSave()
        {
            #region 数据有效性验证
            if (docFLAG.SelectedValue != "N")
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()))
                {
                    goodsData.Add(newDict[i]);
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            //验证单据信息
            if (DbHelperOra.Exists("SELECT 1 FROM dat_ck_doc where seqno = '" + docBILLNO.Text + "'") && docBILLNO.Enabled)
            {
                Alert.Show("您输入的单号已存在,请检查!");
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docSEQNO.Text = BillSeqGet();
                //处理单号前缀
                docSEQNO.Text     = "DSC" + docSEQNO.Text.Substring(3, docSEQNO.Text.Length - 3);
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            MyTable mtType = new MyTable("DAT_CK_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow.Add("BILLTYPE", "DSC");
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("XSTYPE", "1");
            decimal            subNum   = 0;//总金额
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_CK_COM");
            //先删除单据信息在插入
            cmdList.Add(mtType.DeleteCommand(""));                                                        //删除单据台头
            cmdList.Add(new CommandInfo("delete dat_ck_com where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);

                //判断含税进价,为0时不能保存
                string isJiFei = string.Format("select 1 from DOC_GOODS t where iscf = 'N' and gdseq = '{0}'", mtTypeMx.ColRow["GDSEQ"].ToString());
                if (DbHelperOra.Exists(isJiFei))
                {
                    if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["HSJJ"].ToString()) || mtTypeMx.ColRow["HSJJ"].ToString() == "0")
                    {
                        Alert.Show("商品【含税进价】为0或空,无法进行【定数出库管理】操作。");
                        return;
                    }
                }

                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow.Add("ROWNO", i + 1);
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow.Add("XSSL", 0);
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBSUM", subNum);
            cmdList.AddRange(mtType.InsertCommand());
            DbHelperOra.ExecuteSqlTran(cmdList);

            Alert.Show("定数出库信息保存成功!");
            //billNew();
            billOpen(docBILLNO.Text);
            billLockDoc(true);
        }
예제 #21
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if (docFLAG.SelectedValue != "N")
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()))
                {
                    if (newDict[i]["BZSL"].ToString() == "0" || string.IsNullOrWhiteSpace(newDict[i]["BZSL"].ToString()))
                    {
                        Alert.Show("第【" + (i + 1) + "】行【调拨数量】为空,请填写!");
                        return;
                    }

                    object DSBZSL = DbHelperOra.GetSingle(string.Format(@"SELECT DSHL FROM DAT_GOODSDS_LOG 
                    WHERE GDSEQ = '{0}' AND DEPTIN = '{1}' AND BARCODE = '{2}'", newDict[i]["GDSEQ"].ToString(), docDEPTOUT.SelectedValue, newDict[i]["DSCODE"].ToString()));

                    object FDSKC = DbHelperOra.GetSingle(string.Format(@"SELECT (A.KCSL - NVL(B.DSSL, 0)) KSSPSL
                          FROM (SELECT GDSEQ, SUM(KCSL) KCSL
                                  FROM DAT_GOODSSTOCK A
                                 WHERE KCSL > 0
                                   AND A.DEPTID = '{1}'
                                   AND A.GDSEQ = '{0}'
                                 GROUP BY GDSEQ) A,
                               (SELECT GDSEQ, SUM(DSHL) DSSL
                                  FROM DAT_GOODSDS_LOG
                                 WHERE DEPTIN = '{1}'
                                   AND FLAG = 'N'
                                   AND SL > 0
                                   AND DSHL > 0           
                                   AND GDSEQ = '{0}'
                                 GROUP BY GDSEQ) B
                                 WHERE A.GDSEQ = B.GDSEQ(+)", newDict[i]["GDSEQ"].ToString(), docDEPTOUT.SelectedValue));
                    if (string.IsNullOrWhiteSpace(newDict[i]["PH"].ToString()))
                    {
                        Alert.Show("第【" + (i + 1) + "】行【批号】为空,请填写!");
                        return;
                    }
                    //if (newDict[i]["ISDS"].ToString() == "定数")
                    if (!string.IsNullOrWhiteSpace(newDict[i]["DSCODE"].ToString()))
                    {
                        //if (newDict[i]["BZSL"].ToString() != newDict[i]["DSBZSL"].ToString())
                        if (newDict[i]["BZSL"].ToString() != DSBZSL.ToString())
                        {
                            //newDict[i]["BZSL"] = newDict[i]["DSBZSL"].ToString();
                            Alert.Show("第【" + (i + 1) + "】行为定数,【调拨数量】不允许由【" + DSBZSL.ToString() + "】调整为【" + newDict[i]["BZSL"].ToString() + "】,请修改!");
                            return;
                        }
                    }
                    else
                    {
                        if (Convert.ToDecimal(newDict[i]["BZSL"].ToString()) > Convert.ToDecimal(FDSKC.ToString()))
                        {
                            //newDict[i]["BZSL"] = newDict[i]["DSBZSL"].ToString();
                            Alert.Show("第【" + (i + 1) + "】行为非定数,不允许大于非定数库存数量【" + FDSKC.ToString() + "】,请修改!");
                            return;
                        }
                    }
                    goodsData.Add(newDict[i]);
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            //验证单据信息
            if (DbHelperOra.Exists("SELECT 1 FROM dat_kd_doc where seqno = '" + docBILLNO.Text + "'") && docBILLNO.Enabled)
            {
                Alert.Show("您输入的单号已存在,请检查!");
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docSEQNO.Text = BillSeqGet();
                //重新拼单号
                docSEQNO.Text     = "KSD" + docSEQNO.Text.Substring(3, docSEQNO.Text.Length - 3);
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            MyTable mtType = new MyTable("DAT_KD_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow.Add("BILLTYPE", "KSD");
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("XSTYPE", "1");
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_KD_COM");
            decimal            subNum   = 0;                                                              //总金额
            //先删除单据信息在插入
            cmdList.Add(mtType.DeleteCommand(""));                                                        //删除单据台头
            cmdList.Add(new CommandInfo("DELETE DAT_KD_COM WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据明细
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow.Add("XSSL", Convert.ToInt32(mtTypeMx.ColRow["BZHL"]) * Convert.ToInt32(mtTypeMx.ColRow["BZSL"]));
                mtTypeMx.ColRow["HSJE"] = Convert.ToDecimal(mtTypeMx.ColRow["XSSL"]) * Convert.ToDecimal(mtTypeMx.ColRow["HSJJ"]);
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBSUM", subNum);
            cmdList.AddRange(mtType.InsertCommand());
            DbHelperOra.ExecuteSqlTran(cmdList);
            if (flag == "N")
            {
                Alert.Show("科室商品调拨信息保存成功!");
            }
            //billNew();
            OperLog("科室调拨", "修改单据【" + docBILLNO.Text.Trim() + "】");
            billOpen(docBILLNO.Text);
            btnDel.Enabled = true;
            billLockDoc(true);
            SaveSuccess = true;
        }
예제 #22
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if ((",M,N").IndexOf(docFLAG.SelectedValue) < 0)
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    if ((newDict[i]["BZSL"] ?? "").ToString() == "" || (newDict[i]["BZSL"] ?? "").ToString() == "0")
                    {
                        Alert.Show("第【" + i + 1 + "】行,商品[" + newDict[i]["GDSEQ"] + "]借货数未填写!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(newDict[i]["BZHL"].ToString()) || string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString()))
                    {
                        Alert.Show("第【" + i + 1 + "】行,商品[" + newDict[i]["GDSEQ"] + "]包装单位信息错误,请联系管理员维护!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString()))
                    {
                        Alert.Show("第【" + i + 1 + "】行,商品【" + newDict[i]["GDNAME"].ToString() + "】出库包装未维护!!!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    //有效期必须大于等于生成日期
                    if (newDict[i]["ISLOT"].ToString() == "1" || newDict[i]["ISLOT"].ToString() == "2")
                    {
                        if (string.IsNullOrWhiteSpace((string)newDict[i]["PH"]))
                        {
                            GridGoods.SelectedCell = new string[] { i.ToString(), "8" };
                            Alert.Show("第[" + (i + 1) + "]行商品【" + newDict[i]["GDNAME"].ToString() + "】批号不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                            return;
                        }
                        //if ((newDict[i]["RQ_SC"] ?? "").ToString() == "" || (newDict[i]["YXQZ"] ?? "").ToString() == "")
                        //{
                        //    GridGoods.SelectedCell = new string[] { i.ToString(), "8" };
                        //    Alert.Show("第[" + (i + 1) + "]行商品【" + newDict[i]["GDNAME"].ToString() + "】生产日期/有效期至/注册证号不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                        //    return;
                        //}
                    }
                    try
                    {
                        if (!newDict[i].ContainsKey("RQ_SC"))
                        {
                            Alert.Show("第[" + (i + 1) + "]行商品【" + newDict[i]["GDNAME"].ToString() + "】生产日期不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                            return;
                        }
                        if (!newDict[i].ContainsKey("YXQZ"))
                        {
                            Alert.Show("第[" + (i + 1) + "]行商品【" + newDict[i]["GDNAME"].ToString() + "】有效期至不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                            return;
                        }
                        if (!string.IsNullOrWhiteSpace((newDict[i]["YXQZ"] ?? "").ToString()) && !string.IsNullOrWhiteSpace((newDict[i]["RQ_SC"] ?? "").ToString()))
                        {
                            if (DateTime.Compare(Convert.ToDateTime(newDict[i]["RQ_SC"]), Convert.ToDateTime(newDict[i]["YXQZ"])) > 0)
                            {
                                Alert.Show("第【" + i + 1 + "】行,商品【" + newDict[i]["GDNAME"].ToString() + "】有效期不能小于生产日期!!!", "消息提示", MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                    catch
                    {
                        Alert.Show("生产日期/有效期至不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    goodsData.Add(newDict[i]);
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docSEQNO.Text     = BillSeqGet();
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            else
            {
                string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_JH_DOC WHERE SEQNO='{0}'", docBILLNO.Text));
                if (!string.IsNullOrWhiteSpace(flg) && (",M,N").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    docSEQNO.Text     = docBILLNO.Text;
                    docBILLNO.Enabled = false;
                }
            }
            MyTable mtType = new MyTable("DAT_JH_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("XSTYPE", "1");
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_JH_COM");
            decimal            subNum   = 0;                                                              //总金额
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("DELETE DAT_JH_DOC where seqno='" + docBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("DELETE DAT_JH_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);

                //判断含税进价,为0时不能保存
                string isJiFei = string.Format("select 1 from DOC_GOODS t where iscf = 'N' and gdseq = '{0}'", mtTypeMx.ColRow["GDSEQ"].ToString());
                if (DbHelperOra.Exists(isJiFei))
                {
                    if (Convert.ToDecimal(mtTypeMx.ColRow["HSJJ"] ?? "0") <= 0)
                    {
                        Alert.Show("商品【" + mtTypeMx.ColRow["GDNAME"].ToString() + "】含税进价为0或空,无法进行【商品借货管理】操作。");
                        return;
                    }
                }
                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow["DHSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                mtTypeMx.ColRow.Add("XSSL", mtTypeMx.ColRow["DHSL"].ToString());
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);

                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBSUM", subNum);
            cmdList.AddRange(mtType.InsertCommand());
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                if (flag == "N")
                {
                    Alert.Show("商品借货信息保存成功!");
                }
                billLockDoc(true);
                billOpen(docBILLNO.Text);
                OperLog("商品接货", "修改单据【" + docBILLNO.Text + "】");
            }
            SaveSuccess = true;
        }
예제 #23
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(docGROUPNAME.Text))
            {
                Alert.Show("请输入模板名称!", "警告提醒", MessageBoxIcon.Warning);
                return;
            }
            if (docGROUPNAME.Text.Length > 50)
            {
                Alert.Show("输入的模板名称超过字数限制!", "警告提醒", MessageBoxIcon.Warning);
                return;
            }
            if (ddlTYPE.SelectedValue == "")
            {
                Alert.Show("请选择申请模板!", "警告提醒", MessageBoxIcon.Warning);
                return;
            }


            if (hfdGROUPID.Text == "")
            {
                hfdGROUPID.Text = GetCode();
            }

            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();
            MyTable mt = new MyTable("DOC_GROUPDOC");

            mt.ColRow = PubFunc.FormDataHT(FormCond);
            //string type = ddlTYPE.SelectedValue;
            //mt.ColRow.Add("TYPE", "T");
            mt.ColRow.Add("SUBNUM", newDict.Count);
            mt.ColRow.Add("LRY", UserAction.UserID);
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DOC_GROUPCOM");

            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("DELETE DOC_GROUPDOC WHERE GROUPID='" + hfdGROUPID.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("DELETE DOC_GROUPCOM WHERE GROUPID='" + hfdGROUPID.Text + "'", null)); //删除单据明细
            cmdList.AddRange(mt.InsertCommand());
            for (int i = 0; i < newDict.Count; i++)
            {
                int num = Convert.ToInt32(newDict[i]["SL"]);
                if (num < 1)
                {
                    Alert.Show("申请数量不能为0!", "警告提醒", MessageBoxIcon.Warning);
                    return;
                }
                mtTypeMx.ColRow = PubFunc.GridDataGet(newDict[i]);
                mtTypeMx.ColRow.Remove("ROWNO");
                mtTypeMx.ColRow.Add("ROWNO", i + 1);
                mtTypeMx.ColRow.Add("GROUPID", hfdGROUPID.Text);
                cmdList.Add(mtTypeMx.Insert());
            }
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("模板信息保存成功!", "消息提示", MessageBoxIcon.Information);
                //DataInit();
                GridStrategy.DataSource = GridTemplate("");
                GridStrategy.DataBind();
            }
        }
예제 #24
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if ((",M,R").IndexOf(ddlFLAG.SelectedValue) < 0)
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }

            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            if (GridGoods.Rows.Count() == 0)
            {
                Alert.Show("请先进行数据维护,再进行保存操作!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            //验证单据信息

            if (DbHelperOra.Exists("SELECT 1 FROM DAT_TZSUP_DOC where seqno = '" + tbxBILLNO.Text + "'") && tbxBILLNO.Enabled)
            {
                Alert.Show("您输入的单号已存在,请检查!");
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(tbxBILLNO.Text))
            {
                tbxSEQNO.Text     = BillSeqGet();
                tbxBILLNO.Text    = tbxSEQNO.Text;
                tbxBILLNO.Enabled = false;
            }
            else
            {
                string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'M') FROM DAT_TZSUP_DOC WHERE SEQNO='{0}'", tbxBILLNO.Text));
                if (!string.IsNullOrWhiteSpace(flg) && (",M,R").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    tbxSEQNO.Text     = tbxBILLNO.Text;
                    tbxBILLNO.Enabled = false;
                }
            }

            MyTable mtType = new MyTable("DAT_TZSUP_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = tbxBILLNO.Text;
            mtType.ColRow.Add("SUBNUM", GridGoods.Rows.Count);
            mtType.ColRow.Add("XGTYPE", ddlType.SelectedValue);
            mtType.ColRow.Add("BILLTYPE", "TZL");
            mtType.ColRow["FLAG"] = "M";
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_TZSUP_COM");
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_TZSUP_DOC where seqno='" + tbxBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_TZSUP_COM where seqno='" + tbxBILLNO.Text + "'", null)); //删除单据明细
            cmdList.AddRange(mtType.InsertCommand());
            int index = 0;
            foreach (GridRow row in GridGoods.Rows)
            {
                index++;
                mtTypeMx.ColRow          = PubFunc.GridDataGet(row);
                mtTypeMx.ColRow["SEQNO"] = tbxBILLNO.Text;
                mtTypeMx.ColRow["ROWNO"] = index;
                cmdList.Add(mtTypeMx.Insert());
            }

            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("供应商信息保存成功!");
                OperLog("供应商管理", "修改单据【" + tbxBILLNO.Text + "】");
                billOpen(tbxBILLNO.Text);
            }
            SaveSuccess = true;
        }
예제 #25
0
        protected void btnOk()
        {
            if (Doc.DbGetSysPara("LOCKSTOCK") == "Y")
            {
                Alert.Show("系统库存已被锁定,请等待物资管理科结存处理完毕再做审核处理!", "消息提醒", MessageBoxIcon.Warning);
                return;
            }

            #region 数据有效性验证
            decimal subsum = 0;//总金额
            if (docFLAG.SelectedValue != "S")
            {
                Alert.Show("非『已审批』单据不能申领确定!", "提示信息", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            //验证科室是否盘点
            if (DbHelperOra.Exists("SELECT 1 FROM DAT_PD_LOCK WHERE DEPTID IN('" + docDEPTOUT.SelectedValue + "','" + docDEPTID.SelectedValue + "') AND FLAG='N'"))
            {
                Alert.Show("出库或申领科室正在盘点,请检查!");
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    goodsData.Add(newDict[i]);
                    subsum = subsum + decimal.Parse(newDict[i]["HSJE"].ToString());
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            //验证单据信息
            if (DbHelperOra.Exists("SELECT 1 FROM DAT_CK_DOC WHERE SEQNO = '" + docBILLNO.Text + "'") && docBILLNO.Enabled)
            {
                Alert.Show("您输入的单号已存在,请检查!");
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docSEQNO.Text     = BillSeqGet();
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            else
            {
                string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_CK_DOC WHERE SEQNO='{0}'", docBILLNO.Text));
                if (!PubFunc.StrIsEmpty(flg) && (",N,R,S").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    docSEQNO.Text     = docBILLNO.Text;
                    docBILLNO.Enabled = false;
                }
            }

            MyTable mtType = new MyTable("DAT_CK_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("SUBSUM", subsum);
            mtType.ColRow.Add("XSTYPE", "1");
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_CK_COM");
            //MyTable mtTypeExt = new MyTable("DAT_CK_EXT");
            //先删除单据信息在插入
            cmdList.Add(mtType.DeleteCommand(""));                                                        //删除单据台头
            cmdList.Add(new CommandInfo("delete dat_ck_com where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
            cmdList.AddRange(mtType.InsertCommand());
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow["XSSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                if (decimal.Parse(mtTypeMx.ColRow["XSSL"].ToString()) < 0 || (decimal.Parse(mtTypeMx.ColRow["XSSL"].ToString()) > decimal.Parse(mtTypeMx.ColRow["DHSL"].ToString()) && (mtTypeMx.ColRow["NUM1NAME"].ToString() == "非赠品")))
                {
                    Alert.Show("单据号中存在拣货数量小于0或拣货数量大于申领数量!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);

                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
            }

            OracleParameter[] parameters =
            {
                new OracleParameter("VTASKID", OracleDbType.Varchar2, 20),
                new OracleParameter("VPARA",   OracleDbType.Varchar2, 800)
            };
            parameters[0].Value = BillType;
            parameters[1].Value = "'" + docBILLNO.Text + "','" + BillType + "','" + UserAction.UserID + "','AUDIT'";
            cmdList.Add(new CommandInfo("P_EXECTASK", parameters, CommandType.StoredProcedure));

            bool flag = false;
            try { flag = DbHelperOra.ExecuteSqlTran(cmdList); }
            catch (Exception ex)
            {
                Alert.Show(errorParse(ex.Message), "消息提示", MessageBoxIcon.Warning);
                return;
            }

            if (flag)
            {
                billLockDoc(true);
                //增加待办事宜
                DbHelperOra.ExecuteSql("UPDATE DAT_DO_LIST SET FLAG = 'Y' WHERE PARA='" + docBILLNO.Text.Trim() + "'");
                if (DbHelperOra.Exists("select 1 from dat_ck_com where seqno = '" + docBILLNO.Text.Trim() + "' and gdseq in (select gdseq from doc_goods where catid0 = 1 )") == true)
                {
                    Alert.Show("商品出库确认完成!需要打印试剂条码!", "消息提示", MessageBoxIcon.Information);
                }
                else
                {
                    Alert.Show("商品出库确认完成!", "消息提示", MessageBoxIcon.Information);
                    OperLog("科室申领", "出库确认单据【" + docBILLNO.Text + "】");
                }
                billOpen(docBILLNO.Text);
            }
            else
            {
                Alert.Show("商品出库确认出错!!!", "错误提示", MessageBoxIcon.Error);
            }
        }
예제 #26
0
        protected bool DataSave(string flag = "N")
        {
            if (docFLAG.SelectedValue != "N")
            {
                Alert.Show("非[已提交]不能保存!", "消息提示", MessageBoxIcon.Warning);
                return(false);
            }
            List <Dictionary <string, object> > goodsData = GridLis.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();

            if (goodsData.Count < 1)
            {
                Alert.Show("请添加要生成养护单的商品信息!", "提示信息", MessageBoxIcon.Warning);
                return(false);
            }

            List <CommandInfo> cmdList = new List <CommandInfo>();

            if (PubFunc.StrIsEmpty(docSEQNO.Text))
            {
                docSEQNO.Text  = BillSeqGet();
                docBILLNO.Text = docSEQNO.Text;
            }
            else
            {
                if (docBILLNO.Text.Length > 16)
                {
                    Alert.Show("单据编号长度不能大于16,请检查!", "消息提示", MessageBoxIcon.Warning);
                    return(false);
                }
                docSEQNO.Text = docBILLNO.Text;
            }
            cmdList.Add(new CommandInfo("delete from dat_yh_doc where seqno='" + docSEQNO.Text + "'", null));
            cmdList.Add(new CommandInfo("delete from dat_yh_com where seqno='" + docSEQNO.Text + "'", null));

            MyTable mtType = new MyTable("DAT_YH_DOC");

            mtType.ColRow = PubFunc.FormDataHT(Formlis);
            mtType.ColRow.Add("BILLTYPE", BillType);
            decimal decTotal = 0;
            MyTable mtTypeMx = new MyTable("DAT_YH_COM");

            //先删除单据信息在插入
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
                if (mtTypeMx.ColRow["REASON"].ToString().Length > 80)
                {
                    Alert.Show("第【" + i + 1 + "】行【原因说明】字段超出规定长度");
                    return(false);
                }

                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PH", mtTypeMx.ColRow["PHID"]);
                decTotal += decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("SUBSUM", decTotal);
            if (flag == "Y")
            {
                mtType.ColRow["FLAG"] = "Y";
                //mtType.ColRow["SHR"] = ddlSHR.SelectedValue;
                mtType.ColRow["SHR"]  = UserAction.UserID;
                mtType.ColRow["SHRQ"] = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
            }
            cmdList.Add(mtType.Insert());
            return(DbHelperOra.ExecuteSqlTran(cmdList));
        }
예제 #27
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if (docFLAG.SelectedValue != "N")
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            decimal subsum = 0;
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    //if (newDict[i]["ISLOT"].ToString() == "1" || newDict[i]["ISLOT"].ToString() == "2")
                    //{
                    //    if (string.IsNullOrWhiteSpace(newDict[i]["PH"].ToString()) || newDict[i]["PH"].ToString() == "\\")
                    //    {
                    //        //GridGoods.SelectedCell = new int[] { i, 8 };
                    //        string[] selectedCell = GridGoods.SelectedCell;
                    //        PageContext.RegisterStartupScript(String.Format("F('{0}').selectCell('{1}','{2}');", GridGoods.ClientID, selectedCell[0], "KCSL"));
                    //        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】批号不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                    //        return;
                    //    }
                    //}

                    //if (newDict[i].ContainsKey("STR1")&&goodsData.Count > 0 && goodsData.Where(x => x["STR1"].ToString() == newDict[i]["STR1"].ToString()).Count() > 0)
                    //{
                    //    Alert.Show("条码[" + newDict[i]["STR1"] + "]扫描重复!", "消息提示", MessageBoxIcon.Warning);
                    //    return;

                    if (!string.IsNullOrWhiteSpace(newDict[i]["STR1"].ToString()))
                    {
                        for (int k = 1 + i; k < newDict.Count; k++)
                        {
                            if ((newDict[i]["STR1"].ToString()) == (newDict[k]["STR1"].ToString()))
                            {
                                Alert.Show("商品『" + newDict[k]["GDNAME"].ToString() + "』条码『" + newDict[k]["STR1"].ToString() + "』重复,请维护!", "消息提示", MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                    if (newDict[i]["BZSL"].ToString() == "0" || string.IsNullOrWhiteSpace(newDict[i]["BZSL"].ToString()))
                    {
                        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】使用数填写不正确!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (decimal.Parse(newDict[i]["KCSL"].ToString()) < decimal.Parse(newDict[i]["BZSL"].ToString()))
                    {
                        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】使用数大于库存数,请重新输入!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    //当商品中含有贵重商品信息,即需要赋唯一码时
                    if (newDict[i]["ISGZ"].ToString() == "Y" && newDict[i]["ONECODE"].ToString() == "")
                    {
                        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】为贵重商品,请先进行扫描赋码!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    goodsData.Add(newDict[i]);
                    subsum += Convert.ToDecimal(newDict[i]["HSJJ"].ToString()) * Convert.ToDecimal(newDict[i]["BZHL"].ToString());
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            //验证单据信息
            if (DbHelperOra.Exists("SELECT 1 FROM DAT_XS_DOC where seqno = '" + docBILLNO.Text + "'") && docBILLNO.Enabled)
            {
                Alert.Show("您输入的单号已存在,请检查!");
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docSEQNO.Text     = BillSeqGet();
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            else
            {
                string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_XS_DOC WHERE SEQNO='{0}'", docBILLNO.Text));
                if (!string.IsNullOrWhiteSpace(flg) && (",N,R").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    docSEQNO.Text     = docBILLNO.Text;
                    docBILLNO.Enabled = false;
                }
            }

            MyTable mtType = new MyTable("DAT_XS_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("XSTYPE", "1");

            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_XS_COM");
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_XS_DOC where seqno='" + docBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_XS_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
            decimal subNum = 0;
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
                if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["BZSL"].ToString()) || mtTypeMx.ColRow["BZSL"].ToString() == "0")
                {
                    Alert.Show("商品【" + mtTypeMx.ColRow["GDSEQ"] + " | " + mtTypeMx.ColRow["GDNAME"] + "】【使用数】为0或空,无法进行【使用信息管理】操作。");
                    return;
                }
                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow["DHSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString());
                //mtTypeMx.ColRow["XSSL"] = goodsData[i]["DHSL"].ToString();
                mtTypeMx.ColRow["XSSL"] = mtTypeMx.ColRow["DHSL"];
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBSUM", subNum);
            cmdList.AddRange(mtType.InsertCommand());
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                if (flag == "N")
                {
                    Alert.Show("商品使用信息保存成功!");
                }
                OperLog("使用管理", "修改单据【" + docBILLNO.Text + "】");
                billOpen(docBILLNO.Text);
            }
            SaveSuccess = true;
        }
예제 #28
0
        private bool DataSave()
        {
            #region 数据有效性验证
            if ((",M,R").IndexOf(docFLAG.SelectedValue) < 0)
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return(false);
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入科室信息", "消息提示", MessageBoxIcon.Warning);
                return(false);
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["DEPTID"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["DEPTIDNAME"].ToString()))
                {
                    goodsData.Add(newDict[i]);
                }
            }

            if (goodsData.Count < 1)//所有Gird行都为空行时
            {
                Alert.Show("科室信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return(false);
            }
            #endregion

            if (PubFunc.StrIsEmpty(docSEQNO.Text))
            {
                docSEQNO.Text     = BillSeqGet();
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            else
            {
                string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_DZ_DOC WHERE SEQNO='{0}'", docSEQNO.Text));
                if (!PubFunc.StrIsEmpty(flg) && (",N,R,M").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return(false);
                }
                else
                {
                    docBILLNO.Text   = docSEQNO.Text;
                    docSEQNO.Enabled = false;
                }
            }
            MyTable mtType = new MyTable("DAT_DZ_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow["FLAG"]  = "M";//所有单据在保存时单据状态一律为新增N
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("XSTYPE", "1");
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_DZ_COM");
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("DELETE DAT_DZ_DOC WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("DELETE DAT_DZ_COM WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据明细
            cmdList.AddRange(mtType.InsertCommand());
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("XSSL", 0);
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Remove("FLAGNAME");
                cmdList.Add(mtTypeMx.Insert());
            }
            OperLog("商品替代", "修改单据【" + docBILLNO.Text + "】");
            return(DbHelperOra.ExecuteSqlTran(cmdList));
        }
예제 #29
0
        protected override void billSave()
        {
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();

            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }

            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();

            //判断是否有空行
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    if ((newDict[i]["XHSJJ"] ?? "").ToString().Length > 0)
                    {
                        if (PubFunc.StrIsEmpty(newDict[i]["UNIT"].ToString()) || !PubFunc.isNumeric(newDict[i]["XHSJJ"].ToString()))
                        {
                            Alert.Show("商品【" + newDict[i]["GDSEQ"] + "】信息异常,请详细检查商品信息:包装单位或价格!", "异常信息", MessageBoxIcon.Warning);
                            return;
                        }
                        //原价格与现价格不能相同
                        if (newDict[i]["XHSJJ"].ToString() == (newDict[i]["HSJJ"] ?? "").ToString())
                        {
                            Alert.Show("商品【" + newDict[i]["GDSEQ"] + "】原价格与调整价格相同,请检查!", "异常信息", MessageBoxIcon.Warning);
                            return;
                        }
                    }
                    else
                    {
                        Alert.Show("请维护商品【" + newDict[i]["GDSEQ"] + "】修改后价格!", "异常信息", MessageBoxIcon.Warning);
                        return;
                    }
                    goodsData.Add(newDict[i]);
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息异常,请详细检查商品信息!", "消息提示", MessageBoxIcon.Warning);
                return;
            }

            if (PubFunc.StrIsEmpty(hfdSEQNO.Text))
            {
                hfdSEQNO.Text     = BillSeqGet();
                docBILLNO.Text    = hfdSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            else
            {
                if (hfdSEQNO.Text.Length > 16 || docBILLNO.Text.Length > 16)
                {
                    Alert.Show("单据编号长度不能大于16,请检查!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'M') FROM DAT_TJ_DOC WHERE SEQNO='{0}'", docBILLNO.Text));
                if (!PubFunc.StrIsEmpty(flg) && (",M,R").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    docBILLNO.Text    = hfdSEQNO.Text;
                    docBILLNO.Enabled = false;
                }
            }

            MyTable mtType = new MyTable("DAT_TJ_DOC");

            mtType.ColRow         = PubFunc.FormDataHT(FormPrice);
            mtType.ColRow["FLAG"] = "M";//所有单据在保存时单据状态一律为新增M
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_TJ_COM");

            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("DELETE DAT_TJ_DOC WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("DELETE DAT_TJ_COM WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据明细
            cmdList.AddRange(mtType.InsertCommand());
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;

                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
            }

            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                btnSubmit.Enabled = true;
                Alert.Show("商品价格修改信息保存成功!", "消息提示", MessageBoxIcon.Information);
                OperLog("商品调价", "修改单据【" + docBILLNO.Text + "】");
                billOpen(docBILLNO.Text);
            }
            else
            {
                Alert.Show("商品价格修改信息保存失败,请联系管理员!", "消息提示", MessageBoxIcon.Error);
            }
        }
예제 #30
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if (docFLAG.SelectedValue != "N")
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()))
                {
                    if (newDict[i].ContainsKey("STR2") && goodsData.Count > 0 && goodsData.Where(x => x["STR2"].ToString() == newDict[i]["STR2"].ToString()).Count() > 0)
                    {
                        Alert.Show("条码[" + newDict[i]["STR2"] + "]扫描重复!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    goodsData.Add(newDict[i]);
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docSEQNO.Text     = BillSeqGet();
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            MyTable mtType = new MyTable("DAT_CK_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow.Add("BILLTYPE", "DST");
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("XSTYPE", "2");
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_CK_COM");
            //先删除单据信息在插入
            cmdList.Add(mtType.DeleteCommand(""));                                                        //删除单据台头
            cmdList.Add(new CommandInfo("delete dat_ck_com where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
            Decimal subsum = 0;
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                //mtTypeMx.ColRow.Add("XSSL", mtTypeMx.ColRow["BZHL"]);
                mtTypeMx.ColRow.Add("XSSL", -Math.Abs(decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString())));
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");

                mtTypeMx.ColRow["HSJE"] = -Math.Abs(decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()));
                subsum = subsum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBSUM", subsum);
            cmdList.AddRange(mtType.InsertCommand());
            DbHelperOra.ExecuteSqlTran(cmdList);
            if (flag == "N")
            {
                Alert.Show("定数商品退货信息保存成功!");
            }
            OperLog("定数退货", "修改单据【" + docBILLNO.Text + "】");
            billOpen(docBILLNO.Text);
            btnDel.Enabled = true;
            billLockDoc(true);
            SaveSuccess = true;
        }