コード例 #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
ファイル: Grid.cs プロジェクト: cjllove/ERP
        public static bool saveDoc(MyTable MyTb, string tableName, string billNo)
        {
            List <CommandInfo> cmdList = new List <CommandInfo>();

            try
            {
                MyTb.ColRow.Add("SUBSUM", DbHelperOra.GetSingle(string.Format("SELECT SUM(HSJE) FROM {0} WHERE SEQNO = '{1}'", tableName.Substring(0, tableName.Length - 3) + "COM", billNo)));
                MyTb.ColRow.Add("SUBNUM", DbHelperOra.GetSingle(string.Format("SELECT COUNT(1) FROM {0} WHERE SEQNO = '{1}'", tableName.Substring(0, tableName.Length - 3) + "COM", billNo)));
            }
            catch
            {
            }

            cmdList.Add(new CommandInfo(string.Format("DELETE {0} WHERE SEQNO='{1}'", tableName, billNo), null));//删除单据台头
            cmdList.AddRange(MyTb.InsertCommand());
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        protected override void billSave()
        {
            #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> >();
            //判断是否有空行、批号填写是否符合要求
            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]);
                }
            }

            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_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;                                                                             //总金额
            //先删除单据信息在插入
            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["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.Add(new CommandInfo("DELETE 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,'N',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.AddRange(mtType.InsertCommand());
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("商品出库信息保存成功!");
                billLockDoc(true);
                billOpen(docBILLNO.Text);
            }
        }
コード例 #4
0
        private void DataSave(string flag)
        {
            List <Dictionary <string, object> > goodsData = GridGoods.GetNewAddedList().ToList();

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("没有任何数据!", "消息提示", MessageBoxIcon.Information);
                return;
            }

            if (!string.IsNullOrEmpty(docYSRQ.Text) && Convert.ToDateTime(docYSRQ.Text + "-01") < Convert.ToDateTime(DateTime.Now.AddMonths(1).ToString("yyyy-MM") + "-01"))
            {
                Alert.Show("当前时间只能做下一个月预算!", "消息提示", MessageBoxIcon.Information);
                return;
            }


            if (string.IsNullOrWhiteSpace(docSEQNO.Text))
            {
                if (PubFunc.StrIsEmpty(docBILLNO.Text))
                {
                    docSEQNO.Text    = BillSeqGet();
                    docBILLNO.Text   = docSEQNO.Text;
                    docSEQNO.Enabled = false;
                }

                decimal bzslTotal = 0, feeTotal = 0;

                bzslTotal = goodsData.Count();
                foreach (Dictionary <string, object> dic in goodsData)
                {
                    if ((dic["HSJJ"] ?? "0").ToString().Length > 0)
                    {
                        feeTotal += Convert.ToDecimal(dic["HSJJ"] ?? "0") * Convert.ToDecimal(dic["YSSL"] ?? "0");
                    }
                }


                MyTable mtType = new MyTable("DAT_YS_DOC");
                mtType.ColRow["SEQNO"]    = docBILLNO.Text;
                mtType.ColRow["BILLNO"]   = docBILLNO.Text;
                mtType.ColRow["FLAG"]     = "M";
                mtType.ColRow["BILLTYPE"] = "YSD";                           //单据类别为预算单
                mtType.ColRow["DEPTID"]   = ddlDEPTID.SelectedValue;
                mtType.ColRow["YSRANGE"]  = Convert.ToDecimal(nbxYSSL.Text); //插入预算调整幅度
                mtType.ColRow["BEGRQ"]    = dpStartDate.SelectedDate;
                mtType.ColRow["ENDRQ"]    = dpEndDate.SelectedDate;
                mtType.ColRow["YSRQ"]     = docYSRQ.Text;
                mtType.ColRow["SUBNUM"]   = bzslTotal.ToString();
                mtType.ColRow["SUBSUM"]   = feeTotal.ToString("F2");
                mtType.ColRow["YSY"]      = UserAction.UserID;
                mtType.ColRow["LRY"]      = UserAction.UserID;
                mtType.ColRow["LRRQ"]     = DateTime.Now;
                mtType.ColRow["SPR"]      = UserAction.UserID;
                mtType.ColRow["SPRQ"]     = DateTime.Now;
                mtType.ColRow["SHR"]      = "";
                mtType.ColRow["SHRQ"]     = "";
                mtType.ColRow["MEMO"]     = docMEMO.Text;

                List <CommandInfo> cmdList  = new List <CommandInfo>();
                MyTable            mtTypeMx = new MyTable("DAT_YS_COM");
                cmdList.Add(new CommandInfo("DELETE DAT_YS_COM WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据台头
                cmdList.Add(new CommandInfo("DELETE DAT_YS_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.Add("ROWNO", i + 1);
                    mtTypeMx.ColRow.Add("BZHL", 0);
                    mtTypeMx.ColRow.Remove("HSJE");
                    mtTypeMx.ColRow.Add("HSJE", Convert.ToDecimal(goodsData[i]["HSJJ"] ?? "0") * Convert.ToDecimal(goodsData[i]["YSSL"] ?? "0"));
                    cmdList.Add(mtTypeMx.Insert());
                }


                if (DbHelperOra.ExecuteSqlTran(cmdList))
                {
                    Alert.Show("预算单生成成功!!", "消息提示", MessageBoxIcon.Information);
                    billOpen(docBILLNO.Text);
                    OperLog("科室预算", "生成单据【" + docBILLNO.Text + "】");
                    btnSave.Enabled   = true;
                    btnSumbit.Enabled = true;
                    btnPrint.Enabled  = false;
                    btnExport.Enabled = false;
                    //btnDelRow.Enabled = false;
                }
                else
                {
                    Alert.Show("预算单生成失败!", "消息提示", MessageBoxIcon.Information);
                    btnSave.Enabled = true;
                    return;
                }
            }
            else
            {
                int     mycount  = 0;
                int     RowNum   = goodsData.Count;
                Decimal CountNum = 0;
                for (int i = 0; i < goodsData.Count; i++)
                {
                    string ss   = goodsData[i]["YSSL"].ToString();
                    string hsje = goodsData[i]["HSJE"].ToString();
                    CountNum += Convert.ToDecimal(goodsData[i]["HSJE"] ?? 0);
                    string comsql = string.Format("update dat_ys_COM com set YSSL={0},HSJE={1} where com.seqno='{2}' and com.rowno={3}", Convert.ToDecimal(ss), Convert.ToDecimal(hsje), docSEQNO.Text, i + 1);
                    mycount = DbHelperOra.ExecuteSql(comsql);
                }
                string mysql = string.Format("update dat_ys_doc set DEPTID='{0}',YSRANGE={1},memo='{2}' ,SubNum={3},SubSum={4} where seqno='{5}'", ddlDEPTID.SelectedValue, Convert.ToDecimal(nbxYSSL.Text), docMEMO.Text, RowNum, CountNum, docSEQNO.Text);
                int    count = DbHelperOra.ExecuteSql(mysql);
                if (count > 0 && mycount > 0)
                {
                    if (flag == "N")
                    {
                        Alert.Show("预算单修改成功!", "消息提示", MessageBoxIcon.Information);
                    }
                    OperLog("科室预算", "修改单据【" + docBILLNO.Text + "】");
                    billOpen(docBILLNO.Text);
                    btnSave.Enabled   = true;
                    btnSumbit.Enabled = true;
                    btnPrint.Enabled  = false;
                    btnExport.Enabled = false;
                    btnDelRow.Enabled = false;
                }
                else
                {
                    Alert.Show("预算单修改失败,请检查原因!", "消息提示", MessageBoxIcon.Information);
                    btnSave.Enabled = true;
                    hfdFlag.Text    = "false";
                }
            }
        }
コード例 #5
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);
            }
        }
コード例 #6
0
ファイル: DeptGzChange.aspx.cs プロジェクト: cjllove/ERP
        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;
        }
コード例 #7
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;
        }
コード例 #8
0
ファイル: OutStrategy.aspx.cs プロジェクト: cjllove/ERP
        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();
            }
        }
コード例 #9
0
ファイル: AddGoodsNew.aspx.cs プロジェクト: cjllove/ERP
        protected override void billSave()
        {
            #region 数据有效性验证
            if (ddlFLAG.SelectedValue != "M")
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["MEMOGOODS"]).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]["MEMOGOODS"].ToString()))
                {
                    if (newDict[i]["SL"] != null && string.IsNullOrWhiteSpace(newDict[i]["SL"].ToString()))
                    {
                        Alert.Show("请填写【数量】", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    goodsData.Add(newDict[i]);
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("至少填写一条【需求说明】", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            //验证单据信息
            if (DbHelperOra.Exists("SELECT 1 FROM DAT_GOODSNEW_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_GOODSNEW_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_GOODSNEW_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = tbxBILLNO.Text;
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_GOODSNEW_COM");
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_GOODSNEW_DOC where seqno='" + tbxBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_GOODSNEW_COM where seqno='" + tbxBILLNO.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["MEMOGOODS"].ToString()))
                {
                    Alert.Show("【需求说明】为空,无法进行【商品新增管理】操作。");
                    return;
                }

                mtTypeMx.ColRow.Add("SEQNO", tbxBILLNO.Text);
                mtTypeMx.ColRow.Add("ROWNO", i + 1);

                //if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["HSJE"].ToString()) || mtTypeMx.ColRow["HSJE"].ToString() == "0")
                //{
                //    string strSL = "0";
                //    string strHSJJ = "0";
                //    if (mtTypeMx.ColRow["SL"] != null && !string.IsNullOrWhiteSpace(mtTypeMx.ColRow["SL"].ToString()))
                //    {
                //        strSL = mtTypeMx.ColRow["SL"].ToString();
                //    }
                //    if (mtTypeMx.ColRow["HSJJ"] != null && !string.IsNullOrWhiteSpace(mtTypeMx.ColRow["HSJJ"].ToString()))
                //    {
                //        strSL = mtTypeMx.ColRow["HSJJ"].ToString();
                //    }
                //    mtTypeMx.ColRow["HSJE"] = decimal.Parse(strSL) * decimal.Parse(strHSJJ);
                //}

                cmdList.Add(mtTypeMx.Insert());
            }

            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("商品新增信息保存成功!");
                //OperLog("商品新增管理", "修改单据【" + tbxBILLNO.Text + "】");
                billOpen(tbxBILLNO.Text);

                //billNew();
                //billLockDoc(true);
            }
        }
コード例 #10
0
ファイル: AddGoodsNew.aspx.cs プロジェクト: cjllove/ERP
        protected void btnSaveFa_Click(object sender, EventArgs e)
        {
            #region 数据有效性验证
            if ((",N,R").IndexOf(ddlFLAG.SelectedValue) < 0)
            {
                Alert.Show("非【已提交】单据不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["MEMOGOODS"]).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> >();
            string strSUBSUM = "";
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                string strSL   = "0";
                string strHSJJ = "0";
                if (newDict[i]["SL"] != null && !string.IsNullOrWhiteSpace(newDict[i]["SL"].ToString()))
                {
                    strSL = newDict[i]["SL"].ToString();
                }
                if (newDict[i]["HSJJ"] != null && !string.IsNullOrWhiteSpace(newDict[i]["HSJJ"].ToString()))
                {
                    strHSJJ = newDict[i]["HSJJ"].ToString();
                }
                newDict[i]["HSJE"] = decimal.Parse(strSL) * decimal.Parse(strHSJJ);

                strSUBSUM += (newDict[i]["HSJE"] ?? "0").ToString();

                goodsData.Add(newDict[i]);
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("当前单据无数据,无法进行【保存】", "消息提示", MessageBoxIcon.Warning);
                return;
            }

            #endregion


            MyTable mtType = new MyTable("DAT_GOODSNEW_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = tbxBILLNO.Text;
            mtType.ColRow["FLAG"]  = "N";
            mtType.ColRow["SPR"]   = UserAction.UserID;
            mtType.ColRow["SPRQ"]  = dpkLRRQ.SelectedDate;
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("SUBSUM", strSUBSUM);
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_GOODSNEW_COM");
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_GOODSNEW_DOC where seqno='" + tbxBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_GOODSNEW_COM where seqno='" + tbxBILLNO.Text + "'", null)); //删除单据明细
            cmdList.AddRange(mtType.InsertCommand());
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);

                mtTypeMx.ColRow.Add("SEQNO", tbxBILLNO.Text);
                mtTypeMx.ColRow.Add("ROWNO", i + 1);

                if ((newDict[i]["HSJE"] ?? "0").ToString() == "0")
                {
                    string strSL   = "0";
                    string strHSJJ = "0";
                    if (mtTypeMx.ColRow["SL"] != null && !string.IsNullOrWhiteSpace(mtTypeMx.ColRow["SL"].ToString()))
                    {
                        strSL = mtTypeMx.ColRow["SL"].ToString();
                    }
                    if (mtTypeMx.ColRow["HSJJ"] != null && !string.IsNullOrWhiteSpace(mtTypeMx.ColRow["HSJJ"].ToString()))
                    {
                        strHSJJ = mtTypeMx.ColRow["HSJJ"].ToString();
                    }
                    mtTypeMx.ColRow["HSJE"] = decimal.Parse(strSL) * decimal.Parse(strHSJJ);
                }
                cmdList.Add(mtTypeMx.Insert());
            }

            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("商品采购方案保存成功!");
                hfdISTJFA.Text = "Y";
                //OperLog("商品新增管理", "修改单据【" + tbxBILLNO.Text + "】");
                billOpen(tbxBILLNO.Text);
                //billNew();
                //billLockDoc(true);
            }
        }
コード例 #11
0
ファイル: AddGoodsNew.aspx.cs プロジェクト: cjllove/ERP
        protected override void billAudit()
        {
            #region 数据有效性验证
            if (ddlFLAG.SelectedValue == "Y")
            {
                Alert.Show("本条使用信息已经审核确认,不需要再次审核!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["MEMOGOODS"]).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> >();

            #endregion

            MyTable mtType = new MyTable("DAT_GOODSNEW_DOC");
            mtType.ColRow         = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["FLAG"] = "Y";
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow["SHR"]  = UserAction.UserID;
            mtType.ColRow["SHRQ"] = dpkSHRQ.SelectedDate;
            //mtType.ColRow.Add("SUBNUM", goodsData.Count);

            int    isNum     = 0;
            string strSUBSUM = "";
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                if (newDict[i]["ISPASS"] != null && newDict[i]["ISPASS"].ToString() == "R")
                {
                    if (string.IsNullOrWhiteSpace(newDict[i]["MEMOPASS"].ToString()))
                    {
                        Alert.Show("第【" + (i + 1) + "】行请填写【审批意见】", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    isNum++;
                }
                else if (newDict[i]["ISPASS"] != null && newDict[i]["ISPASS"].ToString() == "Y")
                {
                    newDict[i]["MEMOPASS"] = "";
                }
                strSUBSUM += newDict[i]["HSJE"];
                goodsData.Add(newDict[i]);
            }
            if (isNum > 0)
            {
                mtType.ColRow["FLAG"] = "R";
            }

            mtType.ColRow["SUBNUM"] = goodsData.Count;
            mtType.ColRow["SUBSUM"] = strSUBSUM;

            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_GOODSNEW_COM");
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_GOODSNEW_DOC where seqno='" + tbxBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_GOODSNEW_COM where seqno='" + tbxBILLNO.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["MEMOGOODS"].ToString()))
                {
                    Alert.Show("【需求说明】为空,无法进行【商品新增管理】操作。");
                    return;
                }

                mtTypeMx.ColRow.Add("SEQNO", tbxBILLNO.Text);
                mtTypeMx.ColRow.Add("ROWNO", i + 1);

                cmdList.Add(mtTypeMx.Insert());
            }

            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("商品新增信息审核成功!");
                OperLog("商品新增管理", "修改单据【" + tbxBILLNO.Text + "】");
                billOpen(tbxBILLNO.Text);
            }
        }
コード例 #12
0
ファイル: InventoryPlan.aspx.cs プロジェクト: cjllove/ERP
 private void save(string flag = "N")
 {
     #region 检查有效性
     if (("NR").IndexOf(ddlFLAG.SelectedValue) < 0)
     {
         Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
         return;
     }
     if (Convert.ToDateTime(dpkPDRQ.Text) < Convert.ToDateTime(DateTime.Now.ToShortDateString()))
     {
         Alert.Show("盘点日期不能小于当前日期");
         return;
     }
     List <Dictionary <string, object> > newDict   = GridGoods.GetNewAddedList().OrderBy(x => x["CODE"]).ToList();
     List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
     //判断是否有空行
     if (newDict.Count > 0)
     {
         for (int i = 0; i < newDict.Count; i++)
         {
             if (!string.IsNullOrWhiteSpace(newDict[i]["CODE"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["NAME"].ToString()))
             {
                 goodsData.Add(newDict[i]);
             }
         }
     }
     else
     {
         Alert.Show("请追加盘点部门!", "消息提示", MessageBoxIcon.Warning);
         return;
     }
     #endregion
     if (PubFunc.StrIsEmpty(tbxBILLNO.Text))
     {
         tbxBILLNO.Text = BillSeqGet();
     }
     MyTable mtType = new MyTable("dat_pdplan_doc");
     mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
     mtType.ColRow["SEQNO"] = tbxBILLNO.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_pdplan_com");
     //先删除单据信息在插入
     cmdList.Add(mtType.DeleteCommand(""));                                                            //删除单据台头
     cmdList.Add(new CommandInfo("delete dat_pdplan_com where seqno='" + tbxBILLNO.Text + "'", null)); //删除单据明细
     cmdList.AddRange(mtType.InsertCommand());
     for (int i = 0; i < goodsData.Count; i++)
     {
         mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
         mtTypeMx.ColRow.Add("SEQNO", tbxBILLNO.Text);
         mtTypeMx.ColRow["ROWNO"] = i + 1;
         mtTypeMx.ColRow.Remove("KSWC");
         mtTypeMx.ColRow.Remove("FLAGNAME");
         cmdList.Add(mtTypeMx.Insert());
     }
     DbHelperOra.ExecuteSqlTran(cmdList);
     tbxBILLNO.Enabled = false;
     if (flag == "N")
     {
         Alert.Show("单据保存成功");
     }
     billOpen(tbxBILLNO.Text);
     OperLog("盘点计划", "修改单据【" + tbxBILLNO.Text + "】");
     SaveSuccess = true;
 }
コード例 #13
0
        private bool DataSave()
        {
            #region 数据有效性验证
            if ((",A").IndexOf(docFLAG.SelectedValue) < 0)
            {
                Alert.Show("调拨申请单状态不正确,不能保存!", "消息提示", MessageBoxIcon.Warning);
                return(false);
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["HWID"]).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]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    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) && (",A").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return(false);
                }
                else
                {
                    docBILLNO.Text   = docSEQNO.Text;
                    docSEQNO.Enabled = false;
                }
            }
            MyTable mtType = new MyTable("DAT_DB_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow["FLAG"]  = "A";//所有单据在保存时单据状态一律为新增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 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"]);

                if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["HSJE"].ToString()) || mtTypeMx.ColRow["HSJE"].ToString() == "0")
                {
                    mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].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");
                if (mtTypeMx.ColRow["XSSL"].ToString() == "")
                {
                    subsum += decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                }
                else
                {
                    subsum += decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["XSSL"].ToString());
                }
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow["SUBSUM"] = subsum;
            cmdList.AddRange(mtType.InsertCommand());
            return(DbHelperOra.ExecuteSqlTran(cmdList));
        }
コード例 #14
0
ファイル: StorageAllocation.aspx.cs プロジェクト: cjllove/ERP
 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));
 }
コード例 #15
0
ファイル: BarcodeRecovery.aspx.cs プロジェクト: cjllove/ERP
        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()))
                {
                    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();
                //重新拼单号
                docSEQNO.Text     = "DSH" + docSEQNO.Text.Substring(3, docSEQNO.Text.Length - 3);
                docBILLNO.Text    = docSEQNO.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", "DSH");
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("XSTYPE", "1");
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_XS_COM");
            decimal            subNum   = 0;                                                              //总金额
            //先删除单据信息在插入
            cmdList.Add(mtType.DeleteCommand(""));                                                        //删除单据台头
            cmdList.Add(new CommandInfo("DELETE DAT_XS_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", mtTypeMx.ColRow["BZHL"]);
                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("条码回收信息保存成功!");
            }
            OperLog("条码回收", "修改单据【" + docBILLNO.Text + "】");
            //billNew();
            billOpen(docBILLNO.Text);
            btnDel.Enabled = true;
            billLockDoc(true);
            SaveSuccess = true;
        }
コード例 #16
0
ファイル: ConstantRtn.aspx.cs プロジェクト: cjllove/ERP
        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;
        }
コード例 #17
0
ファイル: HighPreUse.aspx.cs プロジェクト: cjllove/ERP
        protected bool btnOk()
        {
            #region 数据有效性验证
            if (docFLAG.SelectedValue != "M" && docFLAG.SelectedValue != "R")
            {
                Alert.Show("非[新单]不能保存!", "消息提示", MessageBoxIcon.Warning);
                return(false);
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return(false);
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return(false);
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            string msg = "";
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    if (int.Parse(newDict[i]["BZSL"].ToString()) > int.Parse(newDict[i]["DHSL"].ToString()))
                    {
                        Alert.Show("第" + (i + 1) + "行商品【" + newDict[i]["GDNAME"].ToString() + "】【使用数】不允许大于【预入库数量】", "提示信息", MessageBoxIcon.Warning);
                        return(false);
                    }
                    if (int.Parse(newDict[i]["BZSL"].ToString()) != int.Parse(newDict[i]["DHSL"].ToString()))
                    {
                        msg += "第" + (i + 1) + "行商品【" + newDict[i]["GDNAME"].ToString() + "】,";
                    }
                    if ((newDict[i]["STR1"] ?? "").ToString().Length > 0 && (newDict[i]["BZSL"] ?? "").ToString() != "1")
                    {
                        Alert.Show("第" + (i + 1) + "行商品【" + newDict[i]["GDNAME"].ToString() + "】【使用数】不允许大于【预入库数量】", "提示信息", MessageBoxIcon.Warning);
                        return(false);
                    }
                    goodsData.Add(newDict[i]);
                }
            }

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return(false);
            }
            #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) && (",N,R").IndexOf(flg) < 0)
            //    {
            //        Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
            //        return false;
            //    }
            //    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");
            mtType.ColRow["FLAG"] = "N";
            string Deptout = (DbHelperOra.GetSingle(string.Format("SELECT DEPTID FROM DAT_YRK_DOC WHERE SEQNO IN({0})", Billno())) ?? "").ToString();
            if (PubFunc.StrIsEmpty(Deptout))
            {
                Alert.Show("您输入的预入库单号有误,请检查!", "提示信息", MessageBoxIcon.Warning);
                return(false);
            }
            mtType.ColRow["DEPTOUT"] = Deptout;
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_CK_COM");
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_CK_DOC where seqno='" + docBILLNO.Text + "' AND FLAG = 'N'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_CK_COM where seqno='" + docBILLNO.Text + "'", null));                //删除单据明细
            Decimal JE = 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(false);
                }

                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow.Add("XSSL", decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()));
                mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["XSSL"].ToString());
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow["ISGZ"] = "Y";
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
                JE += Convert.ToDecimal(mtTypeMx.ColRow["HSJE"]);
            }
            mtType.ColRow.Add("SUBSUM", JE);
            cmdList.AddRange(mtType.InsertCommand());

            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                if (hfdSave.Text != "S")
                {
                    Alert.Show("跟台商品信息保存成功!");
                }
                OperLog("跟台使用", "修改单据【" + docBILLNO.Text + "】");
                billOpen(docSEQNO.Text);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #18
0
ファイル: StoreBorrow.aspx.cs プロジェクト: cjllove/ERP
        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;
        }
コード例 #19
0
        protected override void billSave()
        {
            #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("请填写商品[" + 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]);
                }
            }

            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_CK_DOC WHERE SEQNO='{0}'", docBILLNO.Text));
                if (!string.IsNullOrWhiteSpace(flg) && (",M,R,N").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", "1");
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_CK_COM");
            decimal            subNum   = 0;                                                              //总金额
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_CK_DOC where seqno='" + docBILLNO.Text + "'", 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时不能保存
                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["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))
            {
                Alert.Show("商品出库信息保存成功!");
                billLockDoc(true);
                billOpen(docBILLNO.Text);
            }
        }
コード例 #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
ファイル: HighGoodsRejected.aspx.cs プロジェクト: cjllove/ERP
        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("商品退货信息保存失败,请联系管理员!");
            }
        }
コード例 #22
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);
            }
        }
コード例 #23
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);
            }
        }
コード例 #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
        private void DataSave()
        {
            List <Dictionary <string, object> > goodsData = GridGoods.GetNewAddedList().ToList();

            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("没有任何数据!", "消息提示", MessageBoxIcon.Information);
                return;
            }

            if (!string.IsNullOrEmpty(docYSRQ.Text) && Convert.ToDateTime(docYSRQ.Text + "-01") < Convert.ToDateTime(DateTime.Now.AddMonths(1).ToString("yyyy-MM") + "-01"))
            {
                Alert.Show("当前时间只能做下一个月采购!", "消息提示", MessageBoxIcon.Information);
                return;
            }
            if (PubFunc.StrIsEmpty(docBILLNO.Text))
            {
                docSEQNO.Text    = BillSeqGet();
                docBILLNO.Text   = docSEQNO.Text;
                docSEQNO.Enabled = false;
            }

            decimal bzslTotal = 0, feeTotal = 0;

            bzslTotal = goodsData.Count();
            foreach (Dictionary <string, object> dic in goodsData)
            {
                if ((dic["HSJJ"] ?? "0").ToString().Length > 0)
                {
                    feeTotal += Convert.ToDecimal(dic["HSJJ"] ?? "0") * Convert.ToDecimal(dic["DHS"] ?? "0");
                }
            }

            MyTable mtType = new MyTable("DAT_DDPLAN_DOC");

            mtType.ColRow["SEQNO"]     = docBILLNO.Text;
            mtType.ColRow["BILLNO"]    = docBILLNO.Text;
            mtType.ColRow["FLAG"]      = "M";
            mtType.ColRow["BILLTYPE"]  = "CJD";                                                             //单据类别为采购单
            mtType.ColRow["DEPTID"]    = ddlDEPTID.SelectedValue;
            mtType.ColRow["NUM1"]      = Convert.ToDecimal(nbxYSSL.Text);                                   //插入采购调整幅度
            mtType.ColRow["BEGINTIME"] = Convert.ToDateTime(dpStartDate.SelectedDate).ToString("yyyy-MM-dd");
            mtType.ColRow["ENDTIME"]   = Convert.ToDateTime(dpEndDate.SelectedDate).ToString("yyyy-MM-dd"); //dpEndDate.SelectedDate;
            mtType.ColRow["XDRQ"]      = docYSRQ.Text;
            mtType.ColRow["SUBNUM"]    = bzslTotal.ToString();
            mtType.ColRow["SUBSUM"]    = feeTotal.ToString("F2");
            mtType.ColRow["CGY"]       = UserAction.UserID; //采购员
            mtType.ColRow["LRY"]       = UserAction.UserID;
            mtType.ColRow["LRRQ"]      = DateTime.Now;
            mtType.ColRow["SPR"]       = UserAction.UserID;
            mtType.ColRow["SPRQ"]      = DateTime.Now;
            mtType.ColRow["SHR"]       = "";
            mtType.ColRow["SHRQ"]      = "";
            mtType.ColRow["MEMO"]      = docMEMO.Text;

            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_DDPLAN_COM");

            cmdList.Add(new CommandInfo("DELETE DAT_DDPLAN_DOC WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("DELETE DAT_DDPLAN_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("DEPTID", lstDEPTID.SelectedValue.ToString());
                mtTypeMx.ColRow.Add("NUM1", nbxYSSL.Text);
                mtTypeMx.ColRow.Remove("HSJE");
                mtTypeMx.ColRow.Add("HSJE", Convert.ToDecimal(goodsData[i]["HSJJ"] ?? "0") * Convert.ToDecimal(goodsData[i]["DHS"] ?? "0"));
                mtTypeMx.ColRow.Add("ISGZ", "N");
                mtTypeMx.ColRow.Add("HISNAME", goodsData[i]["GDNAME"]);
                cmdList.Add(mtTypeMx.Insert());
            }


            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("采购单生成成功!!", "消息提示", MessageBoxIcon.Information);
                billOpen(docBILLNO.Text);
                btnSave.Enabled   = true;
                btnSumbit.Enabled = true;
                btnPrint.Enabled  = false;
                btnExport.Enabled = false;
                btnDelRow.Enabled = false;
            }
            else
            {
                Alert.Show("采购单生成失败!", "消息提示", MessageBoxIcon.Information);
                return;
            }
        }
コード例 #26
0
ファイル: DrugConsumption.aspx.cs プロジェクト: cjllove/ERP
        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;
        }
コード例 #27
0
ファイル: ContantReplace.aspx.cs プロジェクト: cjllove/ERP
        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));
        }
コード例 #28
0
ファイル: PriceAdjustment.aspx.cs プロジェクト: cjllove/ERP
        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);
            }
        }
コード例 #29
0
        protected override void billSave()
        {
            #region 数据有效性验证
            if (ddlFLAG.SelectedValue != "N")
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (ddlKCTYPE.SelectedValue.Length < 1)
            {
                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()))
                {
                    goodsData.Add(newDict[i]);
                }
                if (string.IsNullOrWhiteSpace(newDict[i]["BZHL"].ToString()) || string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString()))
                {
                    Alert.Show("商品包装单位信息错误,请联系管理员进行维护!", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                if (string.IsNullOrWhiteSpace(newDict[i]["SYSL"].ToString()))
                {
                    Alert.Show("请填写正确的损益数量", "消息提示", MessageBoxIcon.Warning);
                    return;
                }
            }
            if (goodsData.Count == 0)//所有Gird行都为空行时
            {
                Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            #endregion

            if (PubFunc.StrIsEmpty(tbxBILLNO.Text))
            {
                tbxBILLNO.Text    = BillSeqGet();
                tbxBILLNO.Enabled = false;
            }
            MyTable mtType = new MyTable("DAT_SY_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = tbxBILLNO.Text;
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            //如果是代管商品,把发送标志设为G-即不发送
            if (isDg())
            {
                mtType.ColRow.Add("ISSEND", "G");
            }

            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_SY_COM");
            decimal            subNum   = 0;                                                              //总金额
            //先删除单据信息在插入
            cmdList.Add(mtType.DeleteCommand(""));                                                        //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_SY_COM where seqno='" + tbxBILLNO.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["HSJE"]  = Convert.ToDecimal(mtTypeMx.ColRow["SYSL"]) * Convert.ToDecimal(mtTypeMx.ColRow["HSJJ"]);
                mtTypeMx.ColRow["BHSJE"] = Convert.ToDecimal(mtTypeMx.ColRow["SYSL"]) * Convert.ToDecimal(mtTypeMx.ColRow["BHSJJ"]);
                mtTypeMx.ColRow["LSJE"]  = Convert.ToDecimal(mtTypeMx.ColRow["SYSL"]) * Convert.ToDecimal(mtTypeMx.ColRow["LSJ"]);
                subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                mtTypeMx.ColRow.Add("SEQNO", tbxBILLNO.Text);
                mtTypeMx.ColRow["BZSL"]  = mtTypeMx.ColRow["SYSL"];
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow.Remove("UNITNAME");
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow["SUBSUM"] = subNum;
            //mtType.ColRow.Add("SUBSUM", subNum);
            cmdList.AddRange(mtType.InsertCommand());


            DbHelperOra.ExecuteSqlTran(cmdList);
            Alert.Show("损益单信息保存成功!");
            //billNew();
            OperLog("商品损益", "修改单据【" + tbxBILLNO.Text + "】");
            billOpen(tbxBILLNO.Text);
            billLockDoc(true);
        }