Example #1
0
        //TODO 保存到数据库
        private void SaveToDatabase(HttpContext context, string owner, JObject fileObj)
        {
            //写你自己的sql语句执行即可
            //上传商品图片时,owner可为商品id
            List <CommandInfo> cmdList = new List <CommandInfo>();

            string[] arrays = owner.Split('|');

            decimal i      = Convert.ToDecimal(DbHelperOra.GetSingle("select count(1) c from doc_license_img where seqno='" + arrays[0] + "'"));
            MyTable mtType = new MyTable("doc_license_img");

            mtType.ColRow["SEQNO"]     = arrays[0];
            mtType.ColRow["ROWNO"]     = i + 1;
            mtType.ColRow["FLAG"]      = "N";
            mtType.ColRow["IMGPATH"]   = fileObj["path"];
            mtType.ColRow["GDSEQ"]     = arrays[3];
            mtType.ColRow["UPTTIME"]   = System.DateTime.Now;
            mtType.ColRow["SUPID"]     = arrays[1];
            mtType.ColRow["LICENSEID"] = arrays[2];
            cmdList.Add(mtType.Insert());
            DbHelperOra.ExecuteSqlTran(cmdList);
            int picn = Convert.ToInt32(DbHelperOra.GetSingle("select count(1) from doc_license_img where seqno='" + arrays[0] + "' and licenseid='" + arrays[2] + "'"));

            DbHelperOra.ExecuteSql(string.Format("update doc_license_log set picnum = {0} where seqno='{1}' and licenseid='{2}'", picn, arrays[0], arrays[2]));
        }
Example #2
0
        //TODO 保存到数据库
        private void SaveToDatabase(HttpContext context, string owner, JObject fileObj)
        {
            //写你自己的sql语句执行即可
            //上传商品图片时,owner可为商品id
            List <CommandInfo> cmdList = new List <CommandInfo>();



            MyTable mtType = new MyTable("DOC_GOODSPICTURE");

            mtType.ColRow["ROWNO"]   = fileObj["rowno"];
            mtType.ColRow["GDSEQ"]   = owner;
            mtType.ColRow["GDPICT"]  = fileObj["name"];
            mtType.ColRow["PICPATH"] = fileObj["path"];
            mtType.ColRow["STR1"]    = fileObj["picname"];
            mtType.ColRow["FLAG"]    = "N";

            cmdList.Add(new CommandInfo(string.Format("update doc_goods set ISFLAG4 = 'Y' where gdseq='{0}'", owner), null));
            cmdList.Add(mtType.Insert());
            DbHelperOra.ExecuteSqlTran(cmdList);



            //if (context.Session[sessionName] == null)
            //{
            //    context.Session[sessionName] = new JArray();
            //}

            //JArray source = context.Session[sessionName] as JArray;
            //source.Add(fileObj);

            //context.Session[sessionName] = source;
        }
Example #3
0
        protected void btnAudit_Click(object sender, EventArgs e)
        {
            if (ddlDEPTOUT.SelectedValue.Length < 1)
            {
                Alert.Show("请选择【出库部门】!");
                return;
            }
            if (GridList.SelectedRowIndexArray.Length <= 0)
            {
                return;
            }

            DataTable table  = PubFunc.GridDataGet(GridList);
            string    billno = DbHelperOra.GetSingle("SELECT SEQ_PUBLIC.NEXTVAL FROM DUAL").ToString();

            List <CommandInfo> cmdList = new List <CommandInfo>();
            MyTable            mtCom   = new MyTable("DAT_DSCK_LIST");

            foreach (int index in GridList.SelectedRowIndexArray)
            {
                mtCom.ColRow["SEQNO"]    = billno;
                mtCom.ColRow["ROWNO"]    = index + 1;
                mtCom.ColRow["DEPTOUT"]  = ddlDEPTOUT.SelectedValue;
                mtCom.ColRow["DEPTIN"]   = table.Rows[index]["DEPTID"].ToString();
                mtCom.ColRow["GDSEQ"]    = table.Rows[index]["GDSEQ"].ToString();
                mtCom.ColRow["GDNAME"]   = table.Rows[index]["GDNAME"].ToString();
                mtCom.ColRow["UNIT"]     = table.Rows[index]["UNIT"].ToString();
                mtCom.ColRow["GDSPEC"]   = table.Rows[index]["GDSPEC"].ToString();
                mtCom.ColRow["PRODUCER"] = table.Rows[index]["PRODUCER"].ToString();
                mtCom.ColRow["DSSL"]     = table.Rows[index]["DSNUM"].ToString();
                mtCom.ColRow["DSHL"]     = table.Rows[index]["NUM1"].ToString();
                mtCom.ColRow["DSKC"]     = table.Rows[index]["KCSL"].ToString();
                mtCom.ColRow["DSDC"]     = table.Rows[index]["NUM2"].ToString();
                mtCom.ColRow["DSYH"]     = table.Rows[index]["YCDS"].ToString();
                mtCom.ColRow["HSJJ"]     = table.Rows[index]["HSJJ"].ToString();
                mtCom.ColRow["OPERGH"]   = UserAction.UserID;

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

            OracleParameter[] parameters = new OracleParameter[] { new OracleParameter("V_seqno", OracleDbType.Varchar2) };
            parameters[0].Value = billno;
            cmdList.Add(new CommandInfo("P_DS2CK", parameters, CommandType.StoredProcedure));

            if (!DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("生成定数出库单失败!", "错误提示", MessageBoxIcon.Error);
                return;
            }
            else
            {
                Alert.Show("生成定数出库单成功!", "消息提示", MessageBoxIcon.Information);

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

                    DbHelperOra.ExecuteSqlTran(cmdList);
                    dataSearch();
                    dataSearch("right");
                }
                else
                {
                    Alert.Show("请选择要进行配置的商品信息!");
                    GridGoods.Focus();
                }
            }
            else
            {
                Alert.Show("请选择要进行配置的部门!");
                ddlDept.Focus();
            }
        }
        protected override void billSave()
        {
            List <Dictionary <string, object> > newDict = GridList.GetNewAddedList();
            MyTable            mtTypeMx  = new MyTable("doc_mygoods");
            List <CommandInfo> cmdList   = new List <CommandInfo>();
            string             Sql       = string.Empty;
            string             GETdeptid = "";
            string             GETgdseq  = "";

            for (int i = 0; i < newDict.Count; i++)
            {
                GETdeptid = newDict[i]["DEPTID"].ToString();
                GETgdseq  = newDict[i]["GDSEQ"].ToString();
                if (DbHelperOra.Exists("select 1 from DOC_MYGOODS where DEPTID='" + GETdeptid + "' and GDSEQ ='" + GETgdseq + "'"))
                {
                    Sql = "DELETE FROM DOC_MYGOODS WHERE DEPTID = '" + GETdeptid + "' and GDSEQ = '" + GETgdseq + "'";
                    cmdList.Add(new CommandInfo(Sql, null));
                }
                mtTypeMx.ColRow = PubFunc.GridDataGet(newDict[i]);
                mtTypeMx.ColRow.Remove("DEPTIDNAME");
                mtTypeMx.ColRow.Remove("GDNAME");
                mtTypeMx.ColRow.Remove("GDSPEC");
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("BZHL");
                mtTypeMx.ColRow.Remove("ZDKC");
                mtTypeMx.ColRow.Remove("ZGKC");
                mtTypeMx.ColRow.Remove("DSNUM");
                mtTypeMx.ColRow.Remove("NUM1");
                mtTypeMx.ColRow.Remove("NUM2");
                mtTypeMx.ColRow.Remove("NUM3");
                mtTypeMx.ColRow.Remove("OPERDATE");
                cmdList.Add(mtTypeMx.Insert());
            }
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("保存成功!");
            }
            else
            {
                Alert.Show("保存失败!");
            }
        }
Example #6
0
        //授权图片上传进行保存
        private void SQSaveToDatabase1(HttpContext context, string owner, JObject fileObj)
        {
            //写你自己的sql语句执行即可
            //上传商品图片时,owner可为商品id
            List <CommandInfo> cmdList = new List <CommandInfo>();

            string[] arrays = owner.Split('|');

            decimal i      = Convert.ToDecimal(DbHelperOra.GetSingle("select count(1) c from doc_license_img where seqno='" + arrays[0] + "'"));
            MyTable mtType = new MyTable("doc_license_img");

            mtType.ColRow["SEQNO"]   = arrays[0];
            mtType.ColRow["ROWNO"]   = i + 1;
            mtType.ColRow["FLAG"]    = "N";
            mtType.ColRow["IMGPATH"] = fileObj["path"];
            mtType.ColRow["UPTTIME"] = System.DateTime.Now;
            mtType.ColRow["SUPID"]   = arrays[1];
            cmdList.Add(mtType.Insert());
            DbHelperOra.ExecuteSqlTran(cmdList);
        }
Example #7
0
        private bool DataSave()
        {
            #region 数据有效性验证
            if ((",M,R").IndexOf(docFLAG.SelectedValue) < 0)
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return(false);
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入科室信息", "消息提示", MessageBoxIcon.Warning);
                return(false);
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["DEPTID"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["DEPTIDNAME"].ToString()))
                {
                    goodsData.Add(newDict[i]);
                }
            }

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

            if (PubFunc.StrIsEmpty(docSEQNO.Text))
            {
                docSEQNO.Text     = BillSeqGet();
                docBILLNO.Text    = docSEQNO.Text;
                docBILLNO.Enabled = false;
            }
            else
            {
                string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_DZ_DOC WHERE SEQNO='{0}'", docSEQNO.Text));
                if (!PubFunc.StrIsEmpty(flg) && (",N,R,M").IndexOf(flg) < 0)
                {
                    Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
                    return(false);
                }
                else
                {
                    docBILLNO.Text   = docSEQNO.Text;
                    docSEQNO.Enabled = false;
                }
            }
            MyTable mtType = new MyTable("DAT_DZ_DOC");
            mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
            mtType.ColRow["SEQNO"] = docBILLNO.Text;
            mtType.ColRow["FLAG"]  = "M";//所有单据在保存时单据状态一律为新增N
            mtType.ColRow.Add("BILLTYPE", BillType);
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("XSTYPE", "1");
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_DZ_COM");
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("DELETE DAT_DZ_DOC WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("DELETE DAT_DZ_COM WHERE SEQNO='" + docBILLNO.Text + "'", null)); //删除单据明细
            cmdList.AddRange(mtType.InsertCommand());
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("XSSL", 0);
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Remove("FLAGNAME");
                cmdList.Add(mtTypeMx.Insert());
            }
            OperLog("商品替代", "修改单据【" + docBILLNO.Text + "】");
            return(DbHelperOra.ExecuteSqlTran(cmdList));
        }
Example #8
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()))
                {
                    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;
        }
Example #9
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if ((",M,R").IndexOf(docFLAG.SelectedValue) < 0)
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            List <string> newstr = new List <string>();
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    if ((newDict[i]["BZSL"] ?? "").ToString() == "" || (newDict[i]["BZSL"] ?? "").ToString() == "0")
                    {
                        Alert.Show("请填写商品[" + newDict[i]["GDSEQ"] + "]出库数!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(newDict[i]["BZHL"].ToString()) || string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString()))
                    {
                        Alert.Show("商品[" + newDict[i]["GDSEQ"] + "]包装单位信息错误,请联系管理员维护!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(newDict[i]["HSJJ"].ToString()))
                    {
                        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】含税进价不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString()))
                    {
                        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】出库包装未维护!!!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    goodsData.Add(newDict[i]);
                    newstr.Add(newDict[i]["STR2"].ToString());
                }
            }

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

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

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

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

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

                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow["DHSL"]  = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                mtTypeMx.ColRow["HSJE"]  = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                mtTypeMx.ColRow.Add("XSSL", mtTypeMx.ColRow["DHSL"].ToString());
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                onecode += mtTypeMx.ColRow["STR2"].ToString() + ",";
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBSUM", subNum);
            //object objCount = DbHelperOra.GetSingle(@"SELECT LISTAGG(ONECODE,',') WITHIN GROUP( ORDER BY ONECODE)
            //                                                                      FROM DAT_CK_EXT WHERE BILLNO <> '" + docBILLNO.Text + @"'
            //                                                                       AND ONECODE IN ('" + onecode.Trim(',').Replace(",", "','") + "')");
            //if (objCount != null && objCount.ToString().Length > 0)
            //{
            //    Alert.Show("高值码【" + objCount.ToString() + "】重复!!!", "异常提醒", MessageBoxIcon.Warning);
            //    return;
            //}
            //写入追溯码表
            //cmdList.Add(new CommandInfo("DELETE FROM DAT_CK_EXT WHERE BILLNO='" + docBILLNO.Text + "'", null));//删除单据明细
            //cmdList.Add(new CommandInfo(String.Format(@"INSERT INTO DAT_CK_EXT(DEPTID,BILLNO,ROWNO,ONECODE,GDSEQ,GDNAME,BARCODE,UNIT,GDSPEC,DEPTCUR,BZHL,FLAG,PH,RQ_SC,YXQZ)
            //            SELECT '{1}','{0}',ROWNUM,A.ONECODE,A.GDSEQ,A.GDNAME,A.BARCODE,A.UNIT,A.GDSPEC,A.DEPTCUR,A.BZHL,A.FLAG,A.PH,A.RQ_SC,A.YXQZ
            //              FROM DAT_RK_EXT A,DAT_CK_COM B
            //             WHERE A.GDSEQ = B.GDSEQ AND B.SEQNO = '{0}' AND (A.ONECODE = B.STR2 OR A.STR1 = B.STR2)", docBILLNO.Text, docDEPTID.SelectedValue), null));//删除单据明细
            cmdList.Add(mtType.Insert());
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                if (flag == "N")
                {
                    Alert.Show("商品出库信息保存成功!");
                }
                billLockDoc(true);
                OperLog("高值扫码出库", "修改单据【" + docBILLNO.Text.Trim() + "】");
                billOpen(docBILLNO.Text);
                hdfRowIndex.Text = "";
            }
            SaveSuccess = true;
        }
Example #10
0
        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);
            }
        }
Example #11
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";
                }
            }
        }
Example #12
0
        private void save(string flag = "Y")
        {
            #region 数据有效性验证
            if ((",M,R").IndexOf(docFLAG.SelectedValue) < 0)
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    //填写商品追溯码时,使用数必须为小于等于1
                    if (newDict[i]["NUM1"].ToString() == newDict[i]["NUM2"].ToString())
                    {
                        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】调整与原设定相同,请检查!", "提示信息", MessageBoxIcon.Warning);
                        return;
                    }
                    goodsData.Add(newDict[i]);
                }
            }

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

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

            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("高值修改信息保存成功!");
                OperLog("高值调整", "修改单据【" + docBILLNO.Text + "】");
                billOpen(docBILLNO.Text);
            }
            SaveSuccess = true;
        }
Example #13
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);
            }
        }
Example #14
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);
            }
        }
Example #15
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(docDEPTID.SelectedValue))
            {
                Alert.Show("没有选择【库房】,不能生成养护单。");
                return;
            }
            if (GridLeft.SelectedRowIndexArray.Length < 1)
            {
                Alert.Show("请选择需要生成的单据信息!", "提示信息", MessageBoxIcon.Warning);
                return;
            }
            string             strSeqNo = BillSeqGet();
            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtType   = new MyTable("DAT_YH_DOC");

            mtType.ColRow["SEQNO"]    = strSeqNo;
            mtType.ColRow["BILLNO"]   = strSeqNo;
            mtType.ColRow["BILLTYPE"] = BillType.ToString();
            mtType.ColRow["FLAG"]     = "M";
            mtType.ColRow["DEPTID"]   = docDEPTID.SelectedValue;
            mtType.ColRow["YHRQ"]     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            mtType.ColRow["SUBNUM"]   = GridLeft.SelectedRowIndexArray.Length;
            mtType.ColRow["YHY"]      = UserAction.UserID;
            mtType.ColRow["LRY"]      = UserAction.UserID;
            mtType.ColRow["LRRQ"]     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            MyTable mtTypeMx = new MyTable("DAT_YH_COM");
            //先删除单据信息在插入
            int     i        = 0;
            decimal decTotal = 0;

            foreach (int index in GridLeft.SelectedRowIndexArray)
            {
                Hashtable row = PubFunc.GridDataGet(GridLeft.Rows[index]);
                mtTypeMx.ColRow["SEQNO"]    = strSeqNo;
                mtTypeMx.ColRow["ROWNO"]    = i + 1;
                mtTypeMx.ColRow["GDSEQ"]    = row["GDSEQ"];
                mtTypeMx.ColRow["GDID"]     = row["GDID"];
                mtTypeMx.ColRow["GDNAME"]   = row["GDNAME"];
                mtTypeMx.ColRow["GDSPEC"]   = row["GDSPEC"];
                mtTypeMx.ColRow["UNIT"]     = row["UNIT"];
                mtTypeMx.ColRow["ISGZ"]     = row["ISGZ"];
                mtTypeMx.ColRow["ISLOT"]    = row["ISLOT"];
                mtTypeMx.ColRow["HSJJ"]     = row["HSJJ"];
                mtTypeMx.ColRow["KCSL"]     = row["KCSL"];
                mtTypeMx.ColRow["HSJE"]     = row["HSJE"];
                mtTypeMx.ColRow["STR1"]     = row["HWID"];
                mtTypeMx.ColRow["PHID"]     = row["PHID"];
                mtTypeMx.ColRow["YXQZ"]     = row["YXQZ"];
                mtTypeMx.ColRow["RQ_SC"]    = row["RQ_SC"];
                mtTypeMx.ColRow["HWID"]     = row["HWID"];
                mtTypeMx.ColRow["GDMODE"]   = row["GDMODE"];
                mtTypeMx.ColRow["BZHL"]     = row["BZHL"];
                mtTypeMx.ColRow["PIZNO"]    = row["PIZNO"];
                mtTypeMx.ColRow["PRODUCER"] = row["PRODUCER"];
                mtTypeMx.ColRow["ZPBH"]     = row["ZPBH"];
                mtTypeMx.ColRow["MEMO"]     = row["MEMO"];
                mtTypeMx.ColRow["PICINO"]   = row["PICINO"];

                decTotal += decimal.Parse(row["HSJE"].ToString());
                i++;
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow["SUBSUM"] = decTotal;
            cmdList.Add(mtType.Insert());

            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                //PubFunc.FormDataClear(fmForm);
                Alert.Show("商品养护信息保存成功,已生成养护单【" + strSeqNo + "】!", "消息提示", MessageBoxIcon.Information);
                OperLog("在库养护", "生成单据【" + strSeqNo + "】");
            }
            //docDEPTID.Enabled = true;
            TabStrip1.ActiveTabIndex = 1;
            btnSear_Click(null, null);
        }
Example #16
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;
            }
        }
Example #17
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if (docFLAG.SelectedValue != "M" && docFLAG.SelectedValue != "R")
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (!CheckFlag("M") && !CheckFlag("R"))
            {
                Alert.Show("此单据已经被别人操作,请等待操作!");
                return;
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();//.OrderBy(x => x["GDSEQ"]).ToList(); //排序这里给关掉
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }

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

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

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

            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_TH_COM");
            decimal            subNum   = 0;                                                              //总金额
                                                                                                          //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_TH_DOC where seqno='" + docBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_TH_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
            cmdList.Add(new CommandInfo("delete DAT_TH_EXT where billno='" + docBILLNO.Text + "'", null));
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow         = PubFunc.GridDataGet(goodsData[i]);
                mtTypeMx.ColRow["BZSL"] = Math.Abs(decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString())) * -1;
                mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow["THSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                mtTypeMx.ColRow.Add("SSSL", mtTypeMx.ColRow["THSL"]);
                mtTypeMx.ColRow.Add("DEPTID", docDEPTID.SelectedValue);
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
                //cmdList.Add(new CommandInfo("delete DAT_TH_EXT where onecode='" + mtTypeMx.ColRow["STR2"].ToString() + "'", null));
                cmdList.Add(new CommandInfo(String.Format(@"INSERT INTO DAT_TH_EXT(DEPTID,BILLNO,ROWNO,ONECODE,GDSEQ,GDNAME,BARCODE,UNIT,GDSPEC,DEPTCUR,BZHL,FLAG,PH,RQ_SC,YXQZ)
                        SELECT '{1}','{2}',B.ROWNO,A.ONECODE,A.GDSEQ,A.GDNAME,A.BARCODE,A.UNIT,A.GDSPEC,A.DEPTCUR,A.BZHL,A.FLAG,A.PH,A.RQ_SC,A.YXQZ
                          FROM DAT_RK_EXT A,DAT_TH_COM B
                         WHERE A.GDSEQ = B.GDSEQ AND A.ONECODE = '{0}' AND A.ONECODE = B.STR2 ", mtTypeMx.ColRow["STR2"].ToString(), docDEPTID.SelectedValue, docBILLNO.Text), null));
            }
            mtType.ColRow.Add("SUBSUM", subNum);
            //     cmdList.Add(new CommandInfo("delete DAT_TH_EXT where billno='" + docBILLNO.Text + "'", null));单据编号发生了变化,这条语句无法删除DAT_TH_EXT表中已经存在的ONECODE,ONECODE是唯一键,执行会报错
            //            cmdList.Add(new CommandInfo(String.Format(@"INSERT INTO DAT_TH_EXT(DEPTID,BILLNO,ROWNO,ONECODE,GDSEQ,GDNAME,BARCODE,UNIT,GDSPEC,DEPTCUR,BZHL,FLAG,PH,RQ_SC,YXQZ)
            //                        SELECT '{1}','{0}',B.ROWNUM,A.ONECODE,A.GDSEQ,A.GDNAME,A.BARCODE,A.UNIT,A.GDSPEC,A.DEPTCUR,A.BZHL,A.FLAG,A.PH,A.RQ_SC,A.YXQZ
            //                          FROM DAT_RK_EXT A,DAT_TH_COM B
            //                         WHERE A.GDSEQ = B.GDSEQ AND B.SEQNO = '{0}' AND A.ONECODE = B.STR2 ", docBILLNO.Text, docDEPTID.SelectedValue), null));
            cmdList.AddRange(mtType.InsertCommand());
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                if (flag == "N")
                {
                    Alert.Show("商品退货信息保存成功!");
                }
                //   billOpen(docBILLNO.Text);
                billLockDoc(true);
                billOpen(docSEQNO.Text);
                OperLog("商品退货", "修改单据【" + docBILLNO.Text + "】");
                SaveSuccess = true;
            }
            else
            {
                Alert.Show("商品退货信息保存失败,请联系管理员!");
            }
        }
Example #18
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);
            }
        }
Example #19
0
        protected bool DataSave(string flag = "N")
        {
            if (docFLAG.SelectedValue != "N")
            {
                Alert.Show("非[已提交]不能保存!", "消息提示", MessageBoxIcon.Warning);
                return(false);
            }
            List <Dictionary <string, object> > goodsData = GridLis.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();

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

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

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

            MyTable mtType = new MyTable("DAT_YH_DOC");

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

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

                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PH", mtTypeMx.ColRow["PHID"]);
                decTotal += decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBNUM", goodsData.Count);
            mtType.ColRow.Add("SUBSUM", decTotal);
            if (flag == "Y")
            {
                mtType.ColRow["FLAG"] = "Y";
                //mtType.ColRow["SHR"] = ddlSHR.SelectedValue;
                mtType.ColRow["SHR"]  = UserAction.UserID;
                mtType.ColRow["SHRQ"] = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
            }
            cmdList.Add(mtType.Insert());
            return(DbHelperOra.ExecuteSqlTran(cmdList));
        }
Example #20
0
 private bool DataSave()
 {
     #region 数据有效性验证
     if ((",N,R").IndexOf(docFLAG.SelectedValue) < 0)
     {
         Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
         return(false);
     }
     string strBillno = docSEQNO.Text;
     if (!Doc.getFlag(strBillno, "N", BillType) && !Doc.getFlag(strBillno, "R", BillType))
     {
         Alert.Show("此单据已被其他人处理,请刷新页面更新单据状态!", "警告提示", MessageBoxIcon.Warning);
         return(false);
     }
     List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();
     if (newDict.Count == 0)
     {
         Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
         return(false);
     }
     List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
     //判断是否有空行
     for (int i = 0; i < newDict.Count; i++)
     {
         if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
         {
             if ((newDict[i]["BZSL"] ?? "").ToString() == "" || (newDict[i]["BZSL"] ?? "").ToString() == "0")
             {
                 //Alert.Show("请填写商品[" + newDict[i]["GDSEQ"] + "]的申请数量!", "消息提示", MessageBoxIcon.Warning);
                 //return false;
                 continue;
             }
             //if (decimal.Parse(newDict[i]["BZSL"].ToString()) > decimal.Parse(newDict[i]["NUM1"].ToString()))
             //{
             //    Alert.Show("商品【" + (newDict[i]["GDSEQ"].ToString()) + "】申请数不能大于库存数量", "异常信息", MessageBoxIcon.Warning);
             //    return false;
             //}
             if (string.IsNullOrWhiteSpace(newDict[i]["BZHL"].ToString()) || string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString()))
             {
                 Alert.Show("商品[" + newDict[i]["GDSEQ"] + "]包装单位信息错误,请联系管理员维护!", "消息提示", MessageBoxIcon.Warning);
                 return(false);
             }
             goodsData.Add(newDict[i]);
         }
     }
     if (goodsData.Count == 0)//所有Gird行都为空行时
     {
         Alert.Show("商品信息不能为空", "消息提示", MessageBoxIcon.Warning);
         return(false);
     }
     #endregion
     if (PubFunc.StrIsEmpty(docSEQNO.Text))
     {
         docSEQNO.Text     = BillSeqGet();
         docBILLNO.Text    = docSEQNO.Text;
         docBILLNO.Enabled = false;
     }
     else
     {
         string flg = (string)DbHelperOra.GetSingle(string.Format("SELECT NVL(FLAG,'N') FROM DAT_DB_DOC WHERE SEQNO='{0}'", docSEQNO.Text));
         if (!PubFunc.StrIsEmpty(flg) && (",N,R").IndexOf(flg) < 0)
         {
             Alert.Show("您输入的单据号存在重复信息,请重新输入或置空!", "消息提示", MessageBoxIcon.Warning);
             return(false);
         }
         else
         {
             docBILLNO.Text   = docSEQNO.Text;
             docSEQNO.Enabled = false;
         }
     }
     if (string.IsNullOrWhiteSpace(docDEPTOUT.SelectedValue))
     {
         Alert.Show("请选择出库库房!", "提示", MessageBoxIcon.Information);
         return(false);
     }
     MyTable mtType = new MyTable("DAT_DB_DOC");
     mtType.ColRow          = PubFunc.FormDataHT(FormDoc);
     mtType.ColRow["SEQNO"] = docBILLNO.Text;
     mtType.ColRow["FLAG"]  = "N";//所有单据在保存时单据状态一律为新增N
     mtType.ColRow.Add("BILLTYPE", BillType);
     mtType.ColRow.Add("SUBNUM", goodsData.Count);
     mtType.ColRow.Add("XSTYPE", "1");
     List <CommandInfo> cmdList  = new List <CommandInfo>();
     MyTable            mtTypeMx = new MyTable("DAT_DB_COM");
     //先删除单据信息在插入
     cmdList.Add(new CommandInfo("delete DAT_DB_DOC where seqno='" + docBILLNO.Text + "'", null)); //删除单据台头
     cmdList.Add(new CommandInfo("delete DAT_DB_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
     decimal subNum = 0;                                                                           //总金额
     for (int i = 0; i < goodsData.Count; i++)
     {
         mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
         //判断含税进价,为0时不能保存
         string isJiFei = string.Format("select 1 from DOC_GOODS t where iscf = 'N' and gdseq = '{0}'", mtTypeMx.ColRow["GDSEQ"].ToString());
         if (DbHelperOra.Exists(isJiFei))
         {
             if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["HSJJ"].ToString()) || mtTypeMx.ColRow["HSJJ"].ToString() == "0")
             {
                 Alert.Show("商品【含税进价】为0或空,无法进行【补货管理】操作。");
                 return(false);
             }
         }
         mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
         mtTypeMx.ColRow["ROWNO"] = i + 1;
         //mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
         if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["DHSL"].ToString()) || mtTypeMx.ColRow["DHSL"].ToString() == "0")
         {
             mtTypeMx.ColRow["DHSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
         }
         mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString());
         mtTypeMx.ColRow.Add("XSSL", 0);
         mtTypeMx.ColRow.Add("BHSJJ", 0);
         mtTypeMx.ColRow.Add("BHSJE", 0);
         mtTypeMx.ColRow.Remove("UNITNAME");
         mtTypeMx.ColRow.Remove("PRODUCERNAME");
         mtTypeMx.ColRow["PH"] = "";
         subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
         cmdList.Add(mtTypeMx.Insert());
     }
     mtType.ColRow.Add("SUBSUM", subNum);
     cmdList.AddRange(mtType.InsertCommand());
     string flag = DbHelperOra.GetSingle("SELECT VALUE FROM SYS_PARA WHERE CODE='ISAUTOAUDIT'").ToString();
     if (flag == "Y")
     {
         //当系统设置为自动审批时,商品申领信息在保存之后即进行审核操作
         OracleParameter[] parameters =
         {
             new OracleParameter("VTASKID", OracleDbType.Varchar2, 20),
             new OracleParameter("VPARA",   OracleDbType.Varchar2, 800)
         };
         parameters[0].Value = BillType;
         parameters[1].Value = "'" + docBILLNO.Text + "','" + BillType + "','" + UserAction.UserID + "','DECLARE'";
         cmdList.Add(new CommandInfo("P_EXECTASK", parameters, CommandType.StoredProcedure));
     }
     return(DbHelperOra.ExecuteSqlTran(cmdList));
 }
Example #21
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);
            }
        }
Example #22
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if (docFLAG.SelectedValue != "N")
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()))
                {
                    if (newDict[i].ContainsKey("STR2") && goodsData.Count > 0 && goodsData.Where(x => x["STR2"].ToString() == newDict[i]["STR2"].ToString()).Count() > 0)
                    {
                        Alert.Show("条码[" + newDict[i]["STR2"] + "]扫描重复!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    goodsData.Add(newDict[i]);
                }
            }

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

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

                mtTypeMx.ColRow["HSJE"] = -Math.Abs(decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()));
                subsum = subsum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBSUM", subsum);
            cmdList.AddRange(mtType.InsertCommand());
            DbHelperOra.ExecuteSqlTran(cmdList);
            if (flag == "N")
            {
                Alert.Show("定数商品退货信息保存成功!");
            }
            OperLog("定数退货", "修改单据【" + docBILLNO.Text + "】");
            billOpen(docBILLNO.Text);
            btnDel.Enabled = true;
            billLockDoc(true);
            SaveSuccess = true;
        }
Example #23
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;
        }
Example #24
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(docGROUPNAME.Text))
            {
                Alert.Show("请输入模板名称!", "警告提醒", MessageBoxIcon.Warning);
                return;
            }
            if (docGROUPNAME.Text.Length > 50)
            {
                Alert.Show("输入的模板名称超过字数限制!", "警告提醒", MessageBoxIcon.Warning);
                return;
            }
            if (ddlTYPE.SelectedValue == "")
            {
                Alert.Show("请选择申请模板!", "警告提醒", MessageBoxIcon.Warning);
                return;
            }


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

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

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

            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("DELETE DOC_GROUPDOC WHERE GROUPID='" + hfdGROUPID.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("DELETE DOC_GROUPCOM WHERE GROUPID='" + hfdGROUPID.Text + "'", null)); //删除单据明细
            cmdList.AddRange(mt.InsertCommand());
            for (int i = 0; i < newDict.Count; i++)
            {
                int num = Convert.ToInt32(newDict[i]["SL"]);
                if (num < 1)
                {
                    Alert.Show("申请数量不能为0!", "警告提醒", MessageBoxIcon.Warning);
                    return;
                }
                mtTypeMx.ColRow = PubFunc.GridDataGet(newDict[i]);
                mtTypeMx.ColRow.Remove("ROWNO");
                mtTypeMx.ColRow.Add("ROWNO", i + 1);
                mtTypeMx.ColRow.Add("GROUPID", hfdGROUPID.Text);
                cmdList.Add(mtTypeMx.Insert());
            }
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                Alert.Show("模板信息保存成功!", "消息提示", MessageBoxIcon.Information);
                //DataInit();
                GridStrategy.DataSource = GridTemplate("");
                GridStrategy.DataBind();
            }
        }
Example #25
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if ((",M,N").IndexOf(docFLAG.SelectedValue) < 0)
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    if ((newDict[i]["BZSL"] ?? "").ToString() == "" || (newDict[i]["BZSL"] ?? "").ToString() == "0")
                    {
                        Alert.Show("第【" + i + 1 + "】行,商品[" + newDict[i]["GDSEQ"] + "]借货数未填写!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(newDict[i]["BZHL"].ToString()) || string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString()))
                    {
                        Alert.Show("第【" + i + 1 + "】行,商品[" + newDict[i]["GDSEQ"] + "]包装单位信息错误,请联系管理员维护!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    if (string.IsNullOrWhiteSpace(newDict[i]["UNIT"].ToString()))
                    {
                        Alert.Show("第【" + i + 1 + "】行,商品【" + newDict[i]["GDNAME"].ToString() + "】出库包装未维护!!!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    //有效期必须大于等于生成日期
                    if (newDict[i]["ISLOT"].ToString() == "1" || newDict[i]["ISLOT"].ToString() == "2")
                    {
                        if (string.IsNullOrWhiteSpace((string)newDict[i]["PH"]))
                        {
                            GridGoods.SelectedCell = new string[] { i.ToString(), "8" };
                            Alert.Show("第[" + (i + 1) + "]行商品【" + newDict[i]["GDNAME"].ToString() + "】批号不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                            return;
                        }
                        //if ((newDict[i]["RQ_SC"] ?? "").ToString() == "" || (newDict[i]["YXQZ"] ?? "").ToString() == "")
                        //{
                        //    GridGoods.SelectedCell = new string[] { i.ToString(), "8" };
                        //    Alert.Show("第[" + (i + 1) + "]行商品【" + newDict[i]["GDNAME"].ToString() + "】生产日期/有效期至/注册证号不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                        //    return;
                        //}
                    }
                    try
                    {
                        if (!newDict[i].ContainsKey("RQ_SC"))
                        {
                            Alert.Show("第[" + (i + 1) + "]行商品【" + newDict[i]["GDNAME"].ToString() + "】生产日期不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                            return;
                        }
                        if (!newDict[i].ContainsKey("YXQZ"))
                        {
                            Alert.Show("第[" + (i + 1) + "]行商品【" + newDict[i]["GDNAME"].ToString() + "】有效期至不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                            return;
                        }
                        if (!string.IsNullOrWhiteSpace((newDict[i]["YXQZ"] ?? "").ToString()) && !string.IsNullOrWhiteSpace((newDict[i]["RQ_SC"] ?? "").ToString()))
                        {
                            if (DateTime.Compare(Convert.ToDateTime(newDict[i]["RQ_SC"]), Convert.ToDateTime(newDict[i]["YXQZ"])) > 0)
                            {
                                Alert.Show("第【" + i + 1 + "】行,商品【" + newDict[i]["GDNAME"].ToString() + "】有效期不能小于生产日期!!!", "消息提示", MessageBoxIcon.Warning);
                                return;
                            }
                        }
                    }
                    catch
                    {
                        Alert.Show("生产日期/有效期至不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                        return;
                    }
                    goodsData.Add(newDict[i]);
                }
            }

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

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

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

                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBSUM", subNum);
            cmdList.AddRange(mtType.InsertCommand());
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                if (flag == "N")
                {
                    Alert.Show("商品借货信息保存成功!");
                }
                billLockDoc(true);
                billOpen(docBILLNO.Text);
                OperLog("商品接货", "修改单据【" + docBILLNO.Text + "】");
            }
            SaveSuccess = true;
        }
Example #26
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;
        }
Example #27
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if (docFLAG.SelectedValue != "N")
            {
                Alert.Show("非新单不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            decimal subsum = 0;
            List <Dictionary <string, object> > goodsData = new List <Dictionary <string, object> >();
            //判断是否有空行、批号填写是否符合要求
            for (int i = 0; i < newDict.Count; i++)
            {
                if (!string.IsNullOrWhiteSpace(newDict[i]["GDSEQ"].ToString()) && !string.IsNullOrWhiteSpace(newDict[i]["GDNAME"].ToString()))
                {
                    //if (newDict[i]["ISLOT"].ToString() == "1" || newDict[i]["ISLOT"].ToString() == "2")
                    //{
                    //    if (string.IsNullOrWhiteSpace(newDict[i]["PH"].ToString()) || newDict[i]["PH"].ToString() == "\\")
                    //    {
                    //        //GridGoods.SelectedCell = new int[] { i, 8 };
                    //        string[] selectedCell = GridGoods.SelectedCell;
                    //        PageContext.RegisterStartupScript(String.Format("F('{0}').selectCell('{1}','{2}');", GridGoods.ClientID, selectedCell[0], "KCSL"));
                    //        Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】批号不能为空!!!", "消息提示", MessageBoxIcon.Warning);
                    //        return;
                    //    }
                    //}

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

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

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

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

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

            List <CommandInfo> cmdList  = new List <CommandInfo>();
            MyTable            mtTypeMx = new MyTable("DAT_XS_COM");
            //先删除单据信息在插入
            cmdList.Add(new CommandInfo("delete DAT_XS_DOC where seqno='" + docBILLNO.Text + "'", null)); //删除单据台头
            cmdList.Add(new CommandInfo("delete DAT_XS_COM where seqno='" + docBILLNO.Text + "'", null)); //删除单据明细
            decimal subNum = 0;
            for (int i = 0; i < goodsData.Count; i++)
            {
                mtTypeMx.ColRow = PubFunc.GridDataGet(goodsData[i]);
                if (PubFunc.StrIsEmpty(mtTypeMx.ColRow["BZSL"].ToString()) || mtTypeMx.ColRow["BZSL"].ToString() == "0")
                {
                    Alert.Show("商品【" + mtTypeMx.ColRow["GDSEQ"] + " | " + mtTypeMx.ColRow["GDNAME"] + "】【使用数】为0或空,无法进行【使用信息管理】操作。");
                    return;
                }
                mtTypeMx.ColRow.Add("SEQNO", docBILLNO.Text);
                mtTypeMx.ColRow["ROWNO"] = i + 1;
                mtTypeMx.ColRow.Add("PHID", mtTypeMx.ColRow["PH"]);
                mtTypeMx.ColRow["DHSL"] = decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString());
                mtTypeMx.ColRow["HSJE"] = decimal.Parse(mtTypeMx.ColRow["HSJJ"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZSL"].ToString()) * decimal.Parse(mtTypeMx.ColRow["BZHL"].ToString());
                //mtTypeMx.ColRow["XSSL"] = goodsData[i]["DHSL"].ToString();
                mtTypeMx.ColRow["XSSL"] = mtTypeMx.ColRow["DHSL"];
                mtTypeMx.ColRow.Add("BHSJJ", 0);
                mtTypeMx.ColRow.Add("BHSJE", 0);
                mtTypeMx.ColRow.Remove("UNITNAME");
                mtTypeMx.ColRow.Remove("PRODUCERNAME");
                subNum = subNum + decimal.Parse(mtTypeMx.ColRow["HSJE"].ToString());
                cmdList.Add(mtTypeMx.Insert());
            }
            mtType.ColRow.Add("SUBSUM", subNum);
            cmdList.AddRange(mtType.InsertCommand());
            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                if (flag == "N")
                {
                    Alert.Show("商品使用信息保存成功!");
                }
                OperLog("使用管理", "修改单据【" + docBILLNO.Text + "】");
                billOpen(docBILLNO.Text);
            }
            SaveSuccess = true;
        }
Example #28
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);
        }
Example #29
0
        protected override void billSave()
        {
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();

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

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

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

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

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

            MyTable mtType = new MyTable("DAT_TJ_DOC");

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

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

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

            if (DbHelperOra.ExecuteSqlTran(cmdList))
            {
                btnSubmit.Enabled = true;
                Alert.Show("商品价格修改信息保存成功!", "消息提示", MessageBoxIcon.Information);
                OperLog("商品调价", "修改单据【" + docBILLNO.Text + "】");
                billOpen(docBILLNO.Text);
            }
            else
            {
                Alert.Show("商品价格修改信息保存失败,请联系管理员!", "消息提示", MessageBoxIcon.Error);
            }
        }
Example #30
0
        protected void btnAddRight_Click(object sender, EventArgs e)
        {
            int[] selectArray = GridSupplier.SelectedRowIndexArray;
            if (selectArray.Length > 0)
            {
                String             strData = hfdGridSupplier.Text;
                DataTable          dt      = JsonConvert.DeserializeObject <DataTable>(strData);
                List <CommandInfo> cmdList = new List <CommandInfo>();
                for (int i = 0; i < selectArray.Length; i++)
                {
                    MyTable   mySupplierCFG = new MyTable("DOC_SUPPLIER");
                    Hashtable ht            = new Hashtable(mySupplierCFG.ColRow);
                    foreach (DictionaryEntry de in ht)
                    {
                        if (dt.Columns.Contains(de.Key.ToString()))
                        {
                            mySupplierCFG.ColRow[de.Key.ToString()] = dt.Rows[selectArray[i]][de.Key.ToString()];
                        }
                    }
                    #region not use
                    //mySupplierCFG.ColRow["SUPID"] =  dt.Rows[selectArray[i]]["SUPID"];
                    //mySupplierCFG.ColRow["SUPNAME"] = dt.Rows[selectArray[i]]["SUPNAME"];
                    //mySupplierCFG.ColRow["SUPENAME"] = dt.Rows[selectArray[i]]["SUPENAME"];
                    //mySupplierCFG.ColRow["SUPSIMNAME"] = dt.Rows[selectArray[i]]["SUPSIMNAME"];
                    //mySupplierCFG.ColRow["SUPSIMID"] = dt.Rows[selectArray[i]]["SUPSIMID"];
                    //mySupplierCFG.ColRow["FLAG"] = dt.Rows[selectArray[i]]["FLAG"];
                    //mySupplierCFG.ColRow["SUBJECT"] = dt.Rows[selectArray[i]]["SUBJECT"];
                    //mySupplierCFG.ColRow["SUPCAT"] = dt.Rows[selectArray[i]]["SUPCAT"];
                    //mySupplierCFG.ColRow["REGID"] = dt.Rows[selectArray[i]]["REGID"];
                    //mySupplierCFG.ColRow["CORPKID"] = dt.Rows[selectArray[i]]["CORPKID"];
                    //mySupplierCFG.ColRow["CORPTYPE"] = dt.Rows[selectArray[i]]["CORPTYPE"];
                    //mySupplierCFG.ColRow["YYZZNO"] = dt.Rows[selectArray[i]]["YYZZNO"];
                    //mySupplierCFG.ColRow["LOGINRQ"] = dt.Rows[selectArray[i]]["LOGINRQ"];
                    //mySupplierCFG.ColRow["LOGINLABEL"] = dt.Rows[selectArray[i]]["LOGINLABEL"];
                    //mySupplierCFG.ColRow["LOGINFUND"] = dt.Rows[selectArray[i]]["LOGINFUND"];
                    //mySupplierCFG.ColRow["JYGM"] = dt.Rows[selectArray[i]]["JYGM"];
                    //mySupplierCFG.ColRow["JYFW"] = dt.Rows[selectArray[i]]["JYFW"];
                    //mySupplierCFG.ColRow["TAXPAYER"] = dt.Rows[selectArray[i]]["TAXPAYER"];
                    //mySupplierCFG.ColRow["TAXRATE"] = dt.Rows[selectArray[i]]["TAXRATE"];
                    //mySupplierCFG.ColRow["TAXNO"] = dt.Rows[selectArray[i]]["TAXNO"];
                    //mySupplierCFG.ColRow["BANK"] = dt.Rows[selectArray[i]]["BANK"];
                    //mySupplierCFG.ColRow["ACCNTNO"] = dt.Rows[selectArray[i]]["ACCNTNO"];
                    //mySupplierCFG.ColRow["LOGINADDR"] = dt.Rows[selectArray[i]]["LOGINADDR"];
                    //mySupplierCFG.ColRow["LEADER"] = dt.Rows[selectArray[i]]["LEADER"];
                    //mySupplierCFG.ColRow["LEADERIDCARD"] = dt.Rows[selectArray[i]]["LEADERIDCARD"];



                    //mySupplierCFG.ColRow["TEL"] = dt.Rows[selectArray[i]]["TEL"];
                    //mySupplierCFG.ColRow["FAX"] = dt.Rows[selectArray[i]]["FAX"];
                    //mySupplierCFG.ColRow["TELSERVICE"] = dt.Rows[selectArray[i]]["TELSERVICE"];
                    //mySupplierCFG.ColRow["ZIP"] = dt.Rows[selectArray[i]]["ZIP"];
                    //mySupplierCFG.ColRow["EMAIL"] = dt.Rows[selectArray[i]]["EMAIL"];
                    //mySupplierCFG.ColRow["URL"] = dt.Rows[selectArray[i]]["URL"];
                    //mySupplierCFG.ColRow["ISGATHERING"] = dt.Rows[selectArray[i]]["ISGATHERING"];
                    //mySupplierCFG.ColRow["GATFUNDCORP"] = dt.Rows[selectArray[i]]["GATFUNDCORP"];
                    //mySupplierCFG.ColRow["GATFUNDBANK"] = dt.Rows[selectArray[i]]["GATFUNDBANK"];
                    //mySupplierCFG.ColRow["GATACCNTNO"] = dt.Rows[selectArray[i]]["GATACCNTNO"];
                    //mySupplierCFG.ColRow["ZZADDR"] = dt.Rows[selectArray[i]]["ZZADDR"];
                    //mySupplierCFG.ColRow["LINKMAN"] = dt.Rows[selectArray[i]]["LINKMAN"];
                    //mySupplierCFG.ColRow["LINKMANDUTY"] = dt.Rows[selectArray[i]]["LINKMANDUTY"];
                    //mySupplierCFG.ColRow["LINKTEL"] = dt.Rows[selectArray[i]]["LINKTEL"];
                    //mySupplierCFG.ColRow["LINKFAX"] = dt.Rows[selectArray[i]]["LINKFAX"];
                    //mySupplierCFG.ColRow["LINKEMAIL"] = dt.Rows[selectArray[i]]["LINKEMAIL"];
                    //mySupplierCFG.ColRow["CWLINKMAN"] = dt.Rows[selectArray[i]]["CWLINKMAN"];
                    //mySupplierCFG.ColRow["CWLINKDUTY"] = dt.Rows[selectArray[i]]["CWLINKDUTY"];
                    //mySupplierCFG.ColRow["CWLINKTEL"] = dt.Rows[selectArray[i]]["CWLINKTEL"];
                    //mySupplierCFG.ColRow["CWLINKFAX"] = dt.Rows[selectArray[i]]["CWLINKFAX"];
                    //mySupplierCFG.ColRow["CWLINKEMAIL"] = dt.Rows[selectArray[i]]["CWLINKEMAIL"];
                    //mySupplierCFG.ColRow["BUYERID"] = dt.Rows[selectArray[i]]["BUYERID"];
                    //mySupplierCFG.ColRow["APPLYDEPT"] = dt.Rows[selectArray[i]]["APPLYDEPT"];
                    //mySupplierCFG.ColRow["MANAGER"] = dt.Rows[selectArray[i]]["MANAGER"];
                    //mySupplierCFG.ColRow["CRERQ"] = dt.Rows[selectArray[i]]["CRERQ"];

                    //mySupplierCFG.ColRow["ZZRQ"] = dt.Rows[selectArray[i]]["ZZRQ"];
                    //mySupplierCFG.ColRow["BUYERID"] = dt.Rows[selectArray[i]]["BUYERID"];
                    //mySupplierCFG.ColRow["APPLYDEPT"] = dt.Rows[selectArray[i]]["APPLYDEPT"];
                    //mySupplierCFG.ColRow["MANAGER"] = dt.Rows[selectArray[i]]["MANAGER"];
                    //mySupplierCFG.ColRow["CRERQ"] = dt.Rows[selectArray[i]]["CRERQ"];
                    #endregion
                    mySupplierCFG.ColRow["ISDG"] = "Y";
                    cmdList.Add(mySupplierCFG.Insert());
                }
                //List<CommandInfo> cmdList = new List<CommandInfo>();
                //MyTable mySupplierCFG = new MyTable("DOC_SUPPLIER_CUST");
                //for (int i = 0; i < selectArray.Length; i++)
                //{
                //    //if (GridSupplier.Rows[selectArray[i]].Values[7].ToString() != "Y")
                //    //{
                //    //    Alert.Show(string.Format("供应商【{0}】状态信息错误!", GridSupplier.Rows[selectArray[i]].Values[2].ToString()), "消息提示", MessageBoxIcon.Warning);
                //    //    return;
                //    //}
                //    mySupplierCFG.ColRow.Clear();
                //    mySupplierCFG.ColRow.Add("SUPID", GridSupplier.Rows[selectArray[i]].Values[0]);
                //    //mySupplierCFG.ColRow.Add("ISCFG", "1");
                //    cmdList.Add(mySupplierCFG.Insert());
                //}
                DbHelperOra.ExecuteSqlTran(cmdList);
                CacheHelper.RemoveOneCache("DDL_DOC_SUPPLIER_DG");
                hfdGridSupDisabled1.Text = "";
                dataSearch();
                Alert.Show("本地代管供应商信息添加成功,您需要【刷新】页面后才能进行【代管补货】操作!");
                dataSearch("right");
            }
            else
            {
                Alert.Show("请选择要添加的供应商信息!");
                GridSupplier.Focus();
            }
        }