Beispiel #1
0
        protected void Window1_Close(object sender, WindowCloseEventArgs e)
        {
            DataTable dt = GetGoods(hfdValue.Text);

            if (dt != null && dt.Rows.Count > 0)
            {
                //判断商品是否重复
                List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();
                foreach (DataRow dr in dt.Rows)
                {
                    for (int i = 0; i < newDict.Count; i++)
                    {
                        if (newDict[i]["GDSEQ"].ToString() == dr["GDSEQ"].ToString())
                        {
                            Alert.Show("商品【" + newDict[i]["GDSEQ"] + "】已存在!", "提示信息", MessageBoxIcon.Warning);
                            return;
                        }
                    }
                }
                DataTable newTable = dt.DefaultView.ToTable(false, new string[] { "GDSEQ", "GDNAME", "GDSPEC", "UNIT", "UNITNAME", "HSJJ", "PRODUCER", "PRODUCERNAME", "PIZNO" });
                newTable.Columns.Add("XHSJJ", Type.GetType("System.Double"));
                Doc.GridRowAdd(GridGoods, newTable);
            }
            else
            {
                Alert.Show("商品信息条件失败,请检查网络信息!!!", "消息提示", MessageBoxIcon.Warning);
            }
        }
Beispiel #2
0
        protected override void billGoods()
        {
            if (ddlFLAG.SelectedValue != "N")
            {
                Alert.Show("非『新增』盘点单不能增加商品批号信息!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (GridGoods.SelectedCell == null)
            {
                Alert.Show("请选择要添加批号的商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            int rowIndex = GridGoods.SelectedRowIndex;

            if (rowIndex < 0)
            {
                Alert.Show("请选择要添加批号的商品信息!", "警告提示", MessageBoxIcon.Warning);
                return;
            }

            string[] strCell = GridGoods.SelectedCell;
            Dictionary <string, object> newDict = GridGoods.GetNewAddedList()[Convert.ToInt32(strCell[0])];

            lblUNIT.Text    = newDict["UNITNAME"].ToString();
            WindowPH.Title  = "商品【" + newDict["GDNAME"].ToString() + "】批号新增";
            WindowPH.Hidden = false;
        }
Beispiel #3
0
        protected override void billDelRow()
        {
            if (docFLAG.SelectedValue != "N")
            {
                Alert.Show("非『新增』单据不能删行!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (GridGoods.SelectedRowID == null)
            {
                Alert.Show("请选择数据行删除!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            GridGoods.DeleteSelectedRows();
            //计算合计数量
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();
            decimal bzslTotal = 0, feeTotal = 0;

            foreach (Dictionary <string, object> dic in newDict)
            {
                bzslTotal += Convert.ToDecimal(dic["BZSL"]);
                feeTotal  += Convert.ToDecimal(dic["HSJJ"]) * Convert.ToDecimal(dic["BZSL"]);
            }
            JObject summary = new JObject();

            summary.Add("GDNAME", "本页合计");
            summary.Add("BZSL", bzslTotal.ToString());
            summary.Add("HSJE", feeTotal.ToString("F2"));
            GridGoods.SummaryData = summary;
        }
Beispiel #4
0
        protected void btnScanClose_Click(object sender, EventArgs e)
        {
            string seq = GridSacn.Rows[0].Values[1].ToString(), oneCode = "";

            foreach (GridRow row in GridSacn.Rows)
            {
                int rowIndex = row.RowIndex;
                System.Web.UI.WebControls.TextBox tbxONECODE = (System.Web.UI.WebControls.TextBox)GridSacn.Rows[rowIndex].FindControl("tbxONECODE");
                if (string.IsNullOrWhiteSpace(tbxONECODE.Text))
                {
                    Alert.Show(string.Format("第【{0}】行商品【{1}】唯一码为空!", rowIndex + 1, GridSacn.Rows[rowIndex].Values[1]), "消息提示", MessageBoxIcon.Warning);
                    return;
                }
                //验证追溯码是否重复
                string tbx = tbxONECODE.Text;
                foreach (GridRow rowchild in GridSacn.Rows)
                {
                    int rowIndex_child = rowchild.RowIndex;
                    System.Web.UI.WebControls.TextBox tbxONECODE_child = (System.Web.UI.WebControls.TextBox)GridSacn.Rows[rowIndex_child].FindControl("tbxONECODE");
                    string tbx_child = tbxONECODE_child.Text;
                    if (tbx == tbx_child && rowIndex != rowIndex_child)
                    {
                        Alert.Show(string.Format("第【{0}】行与第【{1}】行编码出现重复", rowIndex + 1, rowIndex_child + 1));
                        return;
                    }
                }
                if (DbHelperOra.Exists("select 1 from DAT_CK_EXT where ONECODE = '" + tbxONECODE.Text + "'"))
                {
                    Alert.Show(string.Format("第【{0}】行商品【{1}】唯一码已存在!", rowIndex + 1, GridSacn.Rows[rowIndex].Values[1]), "消息提示", MessageBoxIcon.Warning);
                    return;
                }

                if (seq != GridSacn.Rows[rowIndex].Values[1].ToString() || (rowIndex + 1) == GridSacn.Rows.Count)
                {
                    int rowNo = 0;
                    List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();
                    if ((rowIndex + 1) == GridSacn.Rows.Count || GridSacn.Rows.Count == 1)
                    {
                        oneCode += tbxONECODE.Text + ",";
                    }
                    foreach (Dictionary <string, object> dic in newDict)
                    {
                        if (seq == dic["GDSEQ"].ToString())
                        {
                            dic["CODEINFO"] = oneCode.TrimEnd(',');
                            PageContext.RegisterStartupScript(GridGoods.GetAddNewRecordReference(GetJObject(dic), rowNo)); oneCode = "";
                            break;
                        }
                        rowNo++;
                    }

                    seq = GridSacn.Rows[rowIndex].Values[1].ToString();
                }
                else
                {
                    oneCode += tbxONECODE.Text + ",";
                }
            }
            WindowScan.Hidden = true;
        }
Beispiel #5
0
        protected void GridGoods_AfterEdit(object sender, FineUIPro.GridAfterEditEventArgs e)
        {
            string[] strCell = GridGoods.SelectedCell;
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();

            if (newDict.Count == 0)
            {
                return;
            }
            if (e.ColumnID == "BZSL" || e.ColumnID == "HSJJ")
            {
                PageContext.RegisterStartupScript(GridGoods.GetUpdateCellValueReference(strCell[0], strCell[1], GetJObject(newDict[e.RowIndex]).ToString()));

                if (e.RowIndex != Convert.ToInt32(strCell[0]))
                {
                    PageContext.RegisterStartupScript(GridGoods.GetUpdateCellValueReference(strCell[0], strCell[1], GetJObject(newDict[Convert.ToInt32(strCell[0])]).ToString()));
                }
                //计算合计数量
                decimal bzslTotal = 0, feeTotal = 0;
                foreach (Dictionary <string, object> dic in newDict)
                {
                    bzslTotal += Convert.ToDecimal(dic["BZSL"]);
                    feeTotal  += Convert.ToDecimal(dic["HSJJ"]) * Convert.ToDecimal(dic["BZSL"]) * Convert.ToDecimal(dic["BZHL"]);
                }
                JObject summary = new JObject();
                summary.Add("GDNAME", "本页合计");
                summary.Add("BZSL", bzslTotal.ToString());
                summary.Add("HSJE", feeTotal.ToString("F2"));
                GridGoods.SummaryData = summary;
            }
        }
Beispiel #6
0
        protected void btnClosePostBack_Click(object sender, EventArgs e)
        {
            bool firstRow = true;

            foreach (GridRow row in GridLot.Rows)
            {
                int rowIndex = row.RowIndex;
                System.Web.UI.WebControls.TextBox tbxNumber = (System.Web.UI.WebControls.TextBox)GridLot.Rows[rowIndex].FindControl("tbxNumber");
                if (!string.IsNullOrWhiteSpace(tbxNumber.Text) && tbxNumber.Text != "0")
                {
                    string[] strCell = GridGoods.SelectedCell;
                    Dictionary <string, object> newDict = GridGoods.GetNewAddedList()[Convert.ToInt32(strCell[0])];
                    newDict["PH"]    = row.Values[1];
                    newDict["YXQZ"]  = row.Values[2];
                    newDict["PZWH"]  = row.Values[4];
                    newDict["RQ_SC"] = row.Values[3];
                    newDict["BZSL"]  = tbxNumber.Text;
                    if (firstRow)
                    {
                        firstRow = false;
                        PageContext.RegisterStartupScript(GridGoods.GetUpdateCellValueReference(strCell[0], strCell[1], GetJObject(newDict).ToString()));
                    }
                    else
                    {
                        PageContext.RegisterStartupScript(GridGoods.GetAddNewRecordReference(GetJObject(newDict)));
                    }
                }
            }
            WindowLot.Hidden = true;
        }
Beispiel #7
0
        private bool saveTest(string flag = "N")
        {
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();

            if (newDict.Count == 0)
            {
                Alert.Show("没有生成任何数据!", "消息提示", MessageBoxIcon.Information);
                return(false);
            }
            int rowIndex = 0;

            foreach (Dictionary <string, object> dic in newDict)
            {
                rowIndex++;
                if ((dic["YSSL"] ?? "0").ToString() == "0")
                {
                    PageContext.RegisterStartupScript(Confirm.GetShowReference("第【" + rowIndex + "】行预算数量为空或0,确认执行操作?", "操作提示", MessageBoxIcon.Question, PageManager1.GetCustomEventReference("Confirm_OKSumbit"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
                    return(false);
                }
            }
            DataSave(flag);
            billSearch();
            return(true);
            //SaveSuccess = true;
        }
Beispiel #8
0
        private void save(string flag = "N")
        {
            #region 数据有效性验证
            if (docFLAG.SelectedValue != "M" && docFLAG.SelectedValue != "R")
            {
                Alert.Show("非[新单]不能保存!", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            if (PubFunc.FormDataCheck(FormDoc).Length > 0)
            {
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();
            if (newDict.Count == 0)
            {
                Alert.Show("请输入商品信息", "消息提示", MessageBoxIcon.Warning);
                return;
            }
            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;
                    }
                    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;
                    }
                }
            }

            #endregion


            if (!string.IsNullOrWhiteSpace(msg))
            {
                msg += "【使用数】不等于【预入库数量】,确认保存,请选择【确定】";
                PageContext.RegisterStartupScript(Confirm.GetShowReference(msg, "消息提示", MessageBoxIcon.Information, PageManager1.GetCustomEventReference("btnOk"), PageManager1.GetCustomEventReference("btnCancel")));
            }
            else
            {
                btnOk();
            }
            SaveSuccess = true;
        }
Beispiel #9
0
        protected void btnPostBack_Click(object sender, EventArgs e)
        {
            if (GridCom.SelectedRowIndexArray.Length < 1)
            {
                Alert.ShowInTop("没有选择请选择需要添加的定数!!", "消息提示!");
                return;
            }
            string billno = "";

            foreach (int index in GridCom.SelectedRowIndexArray)
            {
                billno += GridCom.Rows[index].DataKeys[0].ToString() + ",";
            }
            billno = billno.TrimEnd(',').Replace(",", "','");
            string    sql = @"SELECT A.GDSEQ,
                                    A.GDNAME,
                                    A.GDSPEC,
									 A.UNIT,
                                    f_getunitname(A.UNIT) UNITNAME,
                                    b.num1 BZHL,
                                    1 BZSL,
                                     ROUND(A.HSJJ,4),
                                    '' STR2,
                                    (B.NUM1 *  a.hsjj) CHJE,
                                    (B.NUM1 * a.hsjj) HSJE,A.PRODUCER,
                                    f_getsupname(A.PRODUCER) PRODUCERNAME,
                                    F_GETHWID('{2}',A.GDSEQ) HWID,
                                    ''PH,
                                 (NVL(B.DSNUM, 0) - NVL(B.NUM3, 0) - NVL(B.DSPOOL, 0)) CH,
                                 B.DSNUM,
                                    A.PIZNO PZWH,
                                    ''RQ_SC,
                                    ''YXQZ,
                                    B.NUM1 DHSL,A.JXTAX,A.HSJJ
                                FROM DOC_GOODS A, DOC_GOODSCFG B 
                                WHERE B.GDSEQ = A.GDSEQ
                                AND B.GDSEQ IN ('{0}')
                                AND B.DEPTID = '{1}'";
            DataTable dt  = DbHelperOra.Query(string.Format(sql, billno, docDEPTID.SelectedValue, docDEPTOUT.SelectedValue)).Tables[0];

            dt = GetNewDT(dt);
            foreach (DataRow row in dt.Rows)
            {
                List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();
                int sameRowCount = newDict.Where(a => a["GDSEQ"].ToString() == row["GDSEQ"].ToString()).Count();
                if (sameRowCount > 0)
                {
                    Alert.Show("商品编码为【" + row["GDSEQ"].ToString() + "】的商品已经存在,无需重复填加!");
                    return;
                }
            }

            PubFunc.GridRowAdd(GridGoods, dt);

            GridCom.SelectedRowIndexArray = new int[] { };
        }
Beispiel #10
0
        protected void GridGoods_AfterEdit(object sender, FineUIPro.GridAfterEditEventArgs e)
        {
            string[] strCell          = GridGoods.SelectedCell;
            int      selectedRowIndex = GridGoods.SelectedRowIndex;
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();

            if (newDict.Count == 0)
            {
                return;
            }
            if (e.ColumnID == "BZSL" || e.ColumnID == "HSJJ")
            {
                if (!PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "BZHL")) || !PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "BZSL")) || !PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "HSJJ")))
                {
                    if (!PubFunc.isNumeric(newDict[e.RowIndex]["BZHL"].ToString()) || !PubFunc.isNumeric(newDict[e.RowIndex]["BZSL"].ToString()) || !PubFunc.isNumeric(newDict[e.RowIndex]["HSJJ"].ToString()))
                    {
                        Alert.Show("商品信息异常,请详细检查商品信息:包装含量或价格!", "异常信息", MessageBoxIcon.Warning);
                        return;
                    }
                }
                JObject defaultObj = Doc.GetJObject(GridGoods, e.RowID);
                //if (Convert.ToDecimal(Doc.GetGridInf(GridGoods, e.RowID, "BZSL")) > Convert.ToDecimal(Doc.GetGridInf(GridGoods, e.RowID, "NUM1")))
                //{

                //    defaultObj["BZSL"] = "0";
                //    PageContext.RegisterStartupScript(GridGoods.GetUpdateCellValueReference(e.RowID, defaultObj));
                //    Alert.Show("申请数不能大于库存数量", "异常信息", MessageBoxIcon.Warning);
                //    return;
                //}
                decimal hl = 0, rs = 0, jg = 0;
                decimal.TryParse((defaultObj["BZHL"] ?? "0").ToString(), out hl);
                decimal.TryParse((defaultObj["BZSL"] ?? "0").ToString(), out rs);
                decimal.TryParse((defaultObj["HSJJ"] ?? "0").ToString(), out jg);
                defaultObj["DHSL"] = rs * hl;
                defaultObj["HSJE"] = Math.Round(rs * jg, 2).ToString("F2");
                PageContext.RegisterStartupScript(GridGoods.GetUpdateCellValueReference(e.RowID, defaultObj));

                //计算合计数量
                decimal bzslTotal = 0, feeTotal = 0;
                foreach (Dictionary <string, object> dic in newDict)
                {
                    if (dic["BZSL"].ToString().Length > 0 && dic["HSJJ"].ToString().Length > 0)
                    {
                        bzslTotal += Convert.ToDecimal(dic["BZSL"]);
                        feeTotal  += Convert.ToDecimal(dic["HSJJ"]) * Convert.ToDecimal(dic["BZSL"]) * Convert.ToDecimal(dic["BZHL"]);
                    }
                }
                JObject summary = new JObject();
                summary.Add("GDNAME", "本页合计");
                summary.Add("BZSL", bzslTotal.ToString());
                summary.Add("HSJE", feeTotal.ToString("F2"));
                GridGoods.SummaryData = summary;
            }
        }
Beispiel #11
0
        protected void GridGoods_AfterEdit(object sender, FineUIPro.GridAfterEditEventArgs e)
        {
            if (hdfOper.Text == "audit" || (",M,N").IndexOf(docFLAG.SelectedValue) < 0)
            {
                return;
            }
            string[] strCell = GridGoods.SelectedCell;
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();

            if (newDict.Count == 0)
            {
                return;
            }
            #region 取消其他计算列
            if (e.ColumnID == "BZSL")
            {
                if (!PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "BZHL")) || !PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "BZSL")) || !PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "HSJJ")))
                {
                    Alert.Show("商品信息异常,请详细检查商品信息:包装含量、价格或数量!", "异常信息", MessageBoxIcon.Warning);
                    return;
                }
                JObject defaultObj = Doc.GetJObject(GridGoods, e.RowID);
                decimal hl = 0, rs = 0, jg = 0;
                decimal.TryParse((defaultObj["BZHL"] ?? "0").ToString(), out hl);
                decimal.TryParse((defaultObj["BZSL"] ?? "0").ToString(), out rs);
                decimal.TryParse((defaultObj["HSJJ"] ?? "0").ToString(), out jg);
                defaultObj["DHSL"] = rs * hl;
                defaultObj["HSJE"] = Math.Round(rs * jg, 2).ToString("F2");
                PageContext.RegisterStartupScript(GridGoods.GetUpdateCellValueReference(e.RowID, defaultObj));

                //计算合计数量
                decimal bzslTotal = 0, feeTotal = 0, dhslTotal = 0;
                foreach (Dictionary <string, object> dic in newDict)
                {
                    if (dic["BZSL"] != null)
                    {
                        if (!PubFunc.StrIsEmpty(dic["BZSL"].ToString()))
                        {
                            bzslTotal += Convert.ToDecimal(dic["BZSL"]);
                            feeTotal  += Convert.ToDecimal(dic["HSJJ"]) * Convert.ToDecimal(dic["BZSL"]);
                            dhslTotal += Convert.ToDecimal(dic["BZHL"]) * Convert.ToDecimal(dic["BZSL"]);
                        }
                    }
                }
                JObject summary = new JObject();
                summary.Add("GDNAME", "本页合计");
                summary.Add("BZSL", bzslTotal.ToString());
                summary.Add("HSJE", feeTotal.ToString("F2"));
                summary.Add("DHSL", dhslTotal.ToString());
                GridGoods.SummaryData = summary;
            }
            #endregion
        }
Beispiel #12
0
        private void DataGridBack(DataTable dt)
        {
            dt.Columns.Add("DHSL", Type.GetType("System.Int32"));
            if (dt != null && dt.Rows.Count > 0)
            {
                string someDjbh = string.Empty;
                bool   getDjbh  = false;

                dt.Columns.Add("BZSL", Type.GetType("System.Int32"));
                dt.Columns.Add("STR2", Type.GetType("System.String"));
                dt.Columns.Add("STR3", Type.GetType("System.String"));
                foreach (DataRow row in dt.Rows)
                {
                    decimal jingdu = 0;
                    decimal bzhl   = 0;
                    if (decimal.TryParse(row["HSJJ"].ToString(), out jingdu) && decimal.TryParse(row["BZHL"].ToString(), out bzhl))
                    {
                        row["HSJJ"] = Math.Round(jingdu * bzhl, 4).ToString("F4");
                    }
                    row["DHSL"] = row["SSSL"];
                    row["BZSL"] = "1";
                    row["HSJE"] = row["HSJJ"];
                    row["STR3"] = row["SEQNO"];
                    if ((row["STR1"] ?? "").ToString().Length > 0)
                    {
                        row["STR2"] = row["STR1"];
                    }
                    docMEMO.Enabled = true;
                    List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();
                    int sameRowCount = newDict.Where(a => a["GDSEQ"].ToString() == row["GDSEQ"].ToString() && (a["STR1"] ?? "").ToString() == (row["STR1"] ?? "").ToString()).Count();
                    if (sameRowCount > 0)
                    {
                        someDjbh += "【" + row["GDNAME"].ToString() + "】";
                        getDjbh   = true;
                    }
                    else
                    {
                        PubFunc.GridRowAdd(GridGoods, row, false);
                    }
                }
                if (getDjbh)
                {
                    Alert.Show("商品名称:" + someDjbh + "申请明细中已存在", "消息提示", MessageBoxIcon.Warning);
                }
            }
            else
            {
                Alert.Show("请先选择要加载的商品信息!", "消息提示", MessageBoxIcon.Warning);
            }
            WindowGoods.Hidden = true;
        }
Beispiel #13
0
        private bool IsHaveSomeDjbh(string strDjbh)
        {
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();
            int rowCount = newDict.Where(a => a["GDSEQ"].ToString() == strDjbh).Count();

            if (rowCount > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #14
0
        //验证部门是否重复
        protected bool dept_exis(DataRow row)
        {
            string dept_new = row["CODE"].ToString();
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();

            for (int i = 0; i < newDict.Count; i++)
            {
                if (dept_new == newDict[i]["CODE"].ToString())
                {
                    return(true);
                }
                //if (DbHelperOra.Exists("select 1 from dat_pdplan_doc a,dat_pdplan_com b where a.seqno=b.seqno and a.flag in('Y','R','N') and b.code='" + dept_new + "'"))
                //{
                //    return true;
                //}
                //改为界面验证,保存触发cjl
            }
            return(false);
        }
Beispiel #15
0
        protected void GridGoods_AfterEdit(object sender, FineUIPro.GridAfterEditEventArgs e)
        {
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();

            if (newDict.Count == 0)
            {
                return;
            }
            if (e.ColumnID == "DHS")
            {
                string[] strCell = GridGoods.SelectedCell;
                if (!PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "DHS")))
                {
                    Alert.Show("商品信息异常,请详细检查采购值!", "异常信息", MessageBoxIcon.Warning);
                    return;
                }
                JObject defaultObj = Doc.GetJObject(GridGoods, e.RowID);
                decimal hl = 0, jg = 0;
                decimal.TryParse((defaultObj["DHS"] ?? "0").ToString(), out hl);
                decimal.TryParse((defaultObj["HSJJ"] ?? "0").ToString(), out jg);
                defaultObj["HSJE"] = Math.Round(hl * jg, 2).ToString("F2");

                PageContext.RegisterStartupScript(GridGoods.GetUpdateCellValueReference(e.RowID, defaultObj));
                //计算合计数量
                decimal bzslTotal = 0, feeTotal = 0;
                foreach (Dictionary <string, object> dic in newDict)
                {
                    if ((dic["DHS"] ?? "0").ToString().Length > 0 && (dic["HSJJ"] ?? "0").ToString().Length > 0)
                    {
                        bzslTotal += Convert.ToDecimal(dic["DHS"] ?? "0");
                        feeTotal  += Convert.ToDecimal(dic["HSJJ"] ?? "0") * Convert.ToDecimal(dic["DHS"] ?? "0");
                    }
                }
                JObject summary = new JObject();
                summary.Add("GDNAME", "本页合计");
                summary.Add("DHS", bzslTotal.ToString());
                summary.Add("HSJE", feeTotal.ToString("F2"));
                GridGoods.SummaryData = summary;
            }
        }
Beispiel #16
0
        protected void Window1_Close(object sender, WindowCloseEventArgs e)
        {
            DataTable dt = GetGoods(hfdValue.Text);

            if (dt != null && dt.Rows.Count > 0)
            {
                dt.Columns["PIZNO"].ColumnName = "PZWH";
                dt.Columns["DSNUM"].ColumnName = "DSSL";
                dt.Columns["NUM1"].ColumnName  = "DSHL";
                dt.Columns["ZDKC"].ColumnName  = "NUM1";
                dt.Columns.Add("DSSL_TZ", Type.GetType("System.Int32"));
                dt.Columns.Add("DSHL_TZ", Type.GetType("System.Int32"));
                dt.Columns.Add("NUM2", Type.GetType("System.Int32"));
                foreach (DataRow row in dt.Rows)
                {
                    //比对商品是否添加重复
                    List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();
                    for (int i = 0; i < newDict.Count; i++)
                    {
                        if (newDict[i]["GDSEQ"].ToString() == row["GDSEQ"].ToString())
                        {
                            Alert.Show("商品【" + newDict[i]["GDNAME"].ToString() + "】已添加到商品列表,请检查!", "提示信息", MessageBoxIcon.Warning);
                            return;
                        }
                    }

                    row["DSSL_TZ"] = row["DSSL"];
                    row["DSHL_TZ"] = row["DSHL"];
                    row["NUM2"]    = row["NUM1"];
                    row["HSJJ"]    = row["HSJJ"] ?? "0";
                    LoadGridRow(row, false);
                }
            }
            else
            {
                Alert.Show("未选择商品信息!", "消息提示", MessageBoxIcon.Warning);
            }
        }
Beispiel #17
0
        protected void btnClosePostBack_Click(object sender, EventArgs e)
        {
            int[]     selections = GridDs.SelectedRowIndexArray;
            string    Sql        = "";
            DataTable dt         = DbHelperOra.Query(@"SELECT '' DEPTID,''  DEPTIDNAME,0 DSSL,0 DSSL_OLD,0 DSHL,0 WSSL,'' REASON,'' FLAGNAME,'' DSHL_OLD,'' DSSL_OLD
                        FROM DUAL A").Tables[0];
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();
            Boolean TG = true;

            foreach (int rowIndex in selections)
            {
                TG = true;
                for (int i = 0; i < newDict.Count; i++)
                {
                    if (newDict[i]["DEPTID"].ToString() == GridDs.DataKeys[rowIndex][0].ToString())
                    {
                        TG = false;
                        break;
                    }
                }
                if (TG)
                {
                    dt.Rows[0]["DEPTID"]     = GridDs.DataKeys[rowIndex][0];
                    dt.Rows[0]["DEPTIDNAME"] = GridDs.DataKeys[rowIndex][1];
                    dt.Rows[0]["DSSL_OLD"]   = GridDs.DataKeys[rowIndex][2];
                    dt.Rows[0]["DSSL"]       = GridDs.DataKeys[rowIndex][2];
                    dt.Rows[0]["DSHL_OLD"]   = GridDs.DataKeys[rowIndex][3];
                    dt.Rows[0]["DSHL"]       = GridDs.DataKeys[rowIndex][3];
                    dt.Rows[0]["WSSL"]       = GridDs.DataKeys[rowIndex][4];
                    dt.Rows[0]["REASON"]     = GridDs.DataKeys[rowIndex][5];
                    dt.Rows[0]["FLAGNAME"]   = "未开始";

                    PubFunc.GridRowAdd(GridGoods, dt.Rows[0], false);
                }
            }
            //增加数据
            WindowGoods.Hidden = true;
        }
Beispiel #18
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //201509211433 6448版本缺失  add by zhanghaicheng
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();

            if (newDict.Count == 0)
            {
                Alert.Show("没有生成任何数据!", "消息提示", MessageBoxIcon.Information);
                return;
            }
            int rowIndex = 0;

            foreach (Dictionary <string, object> dic in newDict)
            {
                rowIndex++;
                if ((dic["YSSL"] ?? "0").ToString() == "0")
                {
                    PageContext.RegisterStartupScript(Confirm.GetShowReference("第【" + rowIndex + "】行预算数量为空或0,确认执行操作?", "操作提示", MessageBoxIcon.Question, PageManager1.GetCustomEventReference("Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
                    return;
                }
            }
            btnSave.Enabled = false;
            DataSave("N");
        }
Beispiel #19
0
        protected override void billSave()
        {
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();

            if (newDict.Count == 0)
            {
                Alert.Show("没有生成任何数据!", "消息提示", MessageBoxIcon.Information);
                return;
            }
            int rowIndex = 0;

            foreach (Dictionary <string, object> dic in newDict)
            {
                rowIndex++;
                if ((dic["DHS"] ?? "0").ToString() == "0")
                {
                    PageContext.RegisterStartupScript(Confirm.GetShowReference("第【" + rowIndex + "】行采购数量为空或0,确认执行操作?", "操作提示", MessageBoxIcon.Question, PageManager1.GetCustomEventReference("Confirm_OK"), PageManager1.GetCustomEventReference("Confirm_Cancel")));
                    return;
                }
            }

            DataSave();
            billSearch();
        }
Beispiel #20
0
        protected void GridGoods_AfterEdit(object sender, FineUIPro.GridAfterEditEventArgs e)
        {
            string[] strCell = GridGoods.SelectedCell;
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();

            if (e.ColumnID == "BZSL")
            {
                if (!PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "BZHL")) || !PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "BZSL")) || !PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "HSJJ")))
                {
                    if (Doc.GetGridInf(GridGoods, e.RowID, "BZHL") == "非赠品")
                    {
                        Alert.Show("商品信息异常,请详细检查商品信息:包装含量、价格或数量!", "异常信息", MessageBoxIcon.Warning);
                        return;
                    }
                }
                //处理返回jobject
                JObject defaultObj = Doc.GetJObject(GridGoods, e.RowID);
                decimal hl = 0, rs = 0, jg = 0;
                decimal.TryParse((defaultObj["BZHL"] ?? "0").ToString(), out hl);
                decimal.TryParse((defaultObj["BZSL"] ?? "0").ToString(), out rs);
                decimal.TryParse((defaultObj["HSJJ"] ?? "0").ToString(), out jg);
                defaultObj["XSSL"] = rs * hl;
                defaultObj["HSJE"] = Math.Round(rs * jg, 2).ToString("F2");
                PageContext.RegisterStartupScript(GridGoods.GetUpdateCellValueReference(e.RowID, defaultObj));
                if (Convert.ToDecimal(Doc.GetGridInf(GridGoods, e.RowID, "BZSL")) * Convert.ToDecimal(Doc.GetGridInf(GridGoods, e.RowID, "BZHL")) > Convert.ToDecimal(Doc.GetGridInf(GridGoods, e.RowID, "DHSL")) && Doc.GetGridInf(GridGoods, e.RowID, "NUM1NAME") == "非赠品")
                {
                    Alert.Show("拣货数量不能大于申领数量!", "异常信息", MessageBoxIcon.Warning);
                    return;
                }
                //计算合计数量
                decimal bzslTotal = 0, feeTotal = 0, dhslTotal = 0;
                foreach (Dictionary <string, object> dic in newDict)
                {
                    bzslTotal += Convert.ToDecimal(dic["BZSL"] ?? "0");
                    feeTotal  += Convert.ToDecimal(dic["HSJJ"] ?? "0") * Convert.ToDecimal(dic["BZSL"] ?? "0");
                    dhslTotal += Convert.ToDecimal(dic["DHSL"] ?? "0");
                }
                JObject summary = new JObject();
                summary.Add("GDNAME", "本页合计");
                summary.Add("BZSL", bzslTotal.ToString());
                summary.Add("HSJE", feeTotal.ToString("F2"));
                summary.Add("DHSL", dhslTotal.ToString());
                GridGoods.SummaryData = summary;
            }
            else if (e.ColumnID == "PH")
            {
                String gdseq = Doc.GetGridInf(GridGoods, e.RowID, "GDSEQ");
                if (gdseq.Length < 1)
                {
                    Alert.Show("请先选择商品信息!", "异常信息", MessageBoxIcon.Warning);
                    return;
                }
                DataTable dtPH = Doc.GetGoodsPHKC(gdseq, docDEPTOUT.SelectedValue);
                if (dtPH != null && dtPH.Rows.Count > 0)
                {
                    if (dtPH.Rows.Count == 1)
                    {
                        JObject defaultObj = Doc.GetJObject(GridGoods, e.RowID);
                        defaultObj["PH"]    = dtPH.Rows[0]["PH"].ToString();
                        defaultObj["PZWH"]  = dtPH.Rows[0]["PZWH"].ToString();
                        defaultObj["RQ_SC"] = dtPH.Rows[0]["RQ_SC"].ToString();
                        defaultObj["YXQZ"]  = dtPH.Rows[0]["YXQZ"].ToString();
                        defaultObj["KCSL"]  = dtPH.Rows[0]["KCSL"].ToString();
                        defaultObj["HWID"]  = dtPH.Rows[0]["HWID"].ToString();
                        PageContext.RegisterStartupScript(GridGoods.GetUpdateCellValueReference(e.RowID, defaultObj));
                    }
                    else
                    {
                        GridLot.DataSource = dtPH;
                        GridLot.DataBind();
                        WindowLot.Hidden = false;
                    }
                }
                else
                {
                    Alert.Show("请先维护商品批号!", MessageBoxIcon.Warning);
                }
            }
        }
Beispiel #21
0
        protected void tbxBARCODE_TextChanged(object sender, EventArgs e)
        {
            int len = Doc.LENCODE();

            if (tbxBARCODE.Text.Trim().Length < len)
            {
                return;
            }
            DataTable dtCode = DbHelperOra.Query(string.Format("SELECT * FROM DAT_CK_BARCODE WHERE BARCODE = '{0}'", tbxBARCODE.Text)).Tables[0];

            if (dtCode == null || dtCode.Rows.Count != 1)
            {
                Alert.Show("条码信息错误,请检查!!!", "异常提示", MessageBoxIcon.Warning);
                return;
            }
            if (dtCode.Rows[0]["FLAG"].ToString() != "N")
            {
                Alert.Show("您扫描的条码状态不是【未使用】,请检查!!!", "异常提示", MessageBoxIcon.Warning);
                return;
            }
            string deptid = dtCode.Rows[0]["DEPTIN"].ToString();

            if (docDEPTID.SelectedValue == "")
            {
                docDEPTID.SelectedValue = deptid;
            }
            else
            {
                if (docDEPTID.SelectedValue != deptid)
                {
                    Alert.Show("扫描条码非[" + docDEPTID.SelectedText + "]科室条码,请检查!", "操作提示", MessageBoxIcon.Warning);
                    tbxBARCODE.Text = "";
                    tbxBARCODE.Focus();
                    return;
                }
            }

            if (tbxBARCODE.Text.Substring(0, 1) != "0")
            {
                //增加定数条码提示
                if (tbxBARCODE.Text.Substring(0, 1) == "1")
                {
                    Alert.Show("扫描定数条码为定数条码,请到【使定数条码回收】界面录入!", "异常提示", MessageBoxIcon.Warning);
                }
                else
                {
                    Alert.Show(string.Format("条码【{0}】不是非定数条码,不能在本页面进行回收扫描!", tbxBARCODE.Text), "异常提示", MessageBoxIcon.Warning);
                }
                tbxBARCODE.Text = "";
                tbxBARCODE.Focus();
                return;
            }

            //重新取得数量
            DataTable barcode = DbHelperOra.Query("select A.*,B.PIZNO,F_GETUNITNAME(B.UNIT)UNITSMALLNAME from dat_ck_barcode A,DOC_GOODS B where A.GDSEQ = B.GDSEQ AND B.FLAG IN('Y','T') AND A.BARCODE = '" + tbxBARCODE.Text + "' and A.FLAG = 'N'").Tables[0];

            if (barcode.Rows.Count < 1)
            {
                Alert.Show("扫描条码不存在或已经被回收请检查!");
                tbxBARCODE.Text = "";
                tbxBARCODE.Focus();
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList();

            for (int i = 0; i < newDict.Count; i++)
            {
                string barcode_old = newDict[i]["STR1"].ToString();
                if (barcode_old == tbxBARCODE.Text)
                {
                    Alert.Show("扫描定数条码已存在!");
                    tbxBARCODE.Text = "";
                    tbxBARCODE.Focus();
                    return;
                }
            }
            string code = dtCode.Rows[0]["GDSEQ"].ToString(); //tbxBARCODE.Text.Trim().Substring(13, 12);
            string dept = docDEPTID.SelectedValue;

            if (!string.IsNullOrWhiteSpace(code) && code.Trim().Length >= 2)
            {
                DataTable dt_goods = Doc.GetGoods_His(code, "", dept);

                if (dt_goods != null && dt_goods.Rows.Count > 0)
                {
                    dt_goods.Columns.Add("ONECODE", Type.GetType("System.String"));
                    dt_goods.Columns.Add("BZSL", Type.GetType("System.Int32"));
                    dt_goods.Columns.Add("DHSL", Type.GetType("System.Int32"));
                    dt_goods.Columns.Add("KCSL", Type.GetType("System.Int32"));
                    dt_goods.Columns.Add("HSJE", Type.GetType("System.Double"));
                    dt_goods.Columns["UNITNAME"].ColumnName = "UNITSMALLNAME";
                    DataRow dr_goods = dt_goods.Rows[0];
                    dr_goods["BZSL"]  = barcode.Rows[0]["DHSL"];
                    dr_goods["DHSL"]  = barcode.Rows[0]["DHSL"];
                    dr_goods["KCSL"]  = barcode.Rows[0]["DHSL"];
                    dr_goods["HSJE"]  = Convert.ToDecimal(barcode.Rows[0]["BZSL"]) * Convert.ToDecimal(barcode.Rows[0]["HSJJ"]);
                    dr_goods["PH"]    = barcode.Rows[0]["PH"];
                    dr_goods["PZWH"]  = barcode.Rows[0]["PIZNO"];
                    dr_goods["RQ_SC"] = barcode.Rows[0]["RQ_SC"];
                    dr_goods["YXQZ"]  = barcode.Rows[0]["YXQZ"];
                    //货位使用科室编码
                    dr_goods["HWID"] = dept;
                    dr_goods["STR1"] = tbxBARCODE.Text;
                    LoadGridRow(dr_goods, false);
                    tbxNUM.Text     = (Convert.ToInt16(tbxNUM.Text) + 1).ToString();
                    tbxBARCODE.Text = "";
                    tbxBARCODE.Focus();
                }
                else
                {
                    Alert.Show(string.Format("{0}尚未配置商品【{1}】!!!", docDEPTID.SelectedText, code), MessageBoxIcon.Warning);
                    PubFunc.GridRowAdd(GridGoods, "CLEAR");
                }
            }
        }
Beispiel #22
0
        protected void Window1_Close(object sender, WindowCloseEventArgs e)
        {
            DataTable dt = GetGoods(hfdValue.Text);

            dt.Columns.Remove(dt.Columns["BZHL"]);
            //dt.Columns.Remove(dt.Columns["UNIT"]);
            if (dt != null && dt.Rows.Count > 0)
            {
                dt.Columns["UNITNAME"].ColumnName       = "UNITSMALLNAME";
                dt.Columns["UNIT_SELL_NAME"].ColumnName = "UNITNAME";
                //dt.Columns["UNIT_SELL"].ColumnName = "UNIT";
                dt.Columns["BZHL_SELL"].ColumnName = "BZHL";

                dt.Columns.Add("PH", Type.GetType("System.String"));
                dt.Columns.Add("RQ_SC", Type.GetType("System.String"));
                dt.Columns.Add("YXQZ", Type.GetType("System.String"));
                dt.Columns.Add("MEMO", Type.GetType("System.String"));
                dt.Columns.Add("BZSL", Type.GetType("System.Int32"));
                dt.Columns.Add("DHSL", Type.GetType("System.Int32"));
                dt.Columns.Add("KCSL", Type.GetType("System.Int32"));
                dt.Columns.Add("HSJE", Type.GetType("System.Double"));
                dt.Columns.Add("STR1", Type.GetType("System.String"));
                string msg  = "";
                string msg1 = "";
                string msg2 = "";
                string msg3 = "";//
                foreach (DataRow row in dt.Rows)
                {
                    row["BZSL"]     = "0";
                    row["DHSL"]     = "0";
                    row["KCSL"]     = "0";
                    row["HSJE"]     = "0";
                    row["HWID"]     = "";
                    row["STR1"]     = "";
                    row["UNITNAME"] = row["UNITSMALLNAME"];
                    row["BZHL"]     = "1";
                    DataTable Temp = DbHelperOra.Query(string.Format("SELECT * FROM (SELECT A.HWID, SUM(A.KCSL) KCSL,A.PH,A.YXQZ,A.RQ_SC,B.ISGZ,B.GDNAME FROM DAT_GOODSSTOCK A ,DOC_GOODS B WHERE A.DEPTID ='{0}' AND A.GDSEQ = '{1}'  AND A.GDSEQ = B.GDSEQ AND A.KCSL >0 GROUP BY HWID,PH,YXQZ,RQ_SC,ISGZ,GDNAME ORDER BY YXQZ ASC) WHERE ROWNUM = 1", docDEPTID.SelectedValue, row["GDSEQ"].ToString())).Tables[0];

                    List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList(); //
                    int sameRowCount = newDict.Where(a => a["GDSEQ"].ToString() == row["GDSEQ"].ToString()).Count();             //

                    if (Temp.Rows.Count > 0)
                    {
                        if (Temp.Rows[0]["ISGZ"].ToString() == "Y")
                        {
                            msg += "【" + row["GDSEQ"].ToString() + " | " + row["GDNAME"].ToString() + "】,";
                            continue;
                        }

                        row["KCSL"]  = Temp.Rows[0]["KCSL"];
                        row["PH"]    = Temp.Rows[0]["PH"];
                        row["YXQZ"]  = Temp.Rows[0]["YXQZ"];
                        row["RQ_SC"] = Temp.Rows[0]["RQ_SC"];
                        row["HWID"]  = Temp.Rows[0]["HWID"];
                    }
                    else
                    {
                        msg1 += row["GDNAME"] + ",";
                        continue;
                    }

                    if (string.IsNullOrWhiteSpace(row["HSJJ"].ToString()) || row["HSJJ"].ToString() == "0")
                    {
                        msg2 += "【" + row["GDSEQ"].ToString() + " | " + row["GDNAME"].ToString() + "】,";
                        continue;
                    }
                    if (sameRowCount > 0)//
                    {
                        msg3 += "【" + row["GDNAME"].ToString() + "】";
                        continue;
                    }
                    //换算价格
                    row["HSJJ"] = Math.Round(Convert.ToDecimal(row["HSJJ"]) * Convert.ToDecimal(row["BZHL"]), 4);
                    LoadGridRow(row, false);
                }

                if (!string.IsNullOrWhiteSpace(msg))
                {
                    String strNostock = "";
                    strNostock = string.Format("商品【{0}】属于高值商品,请在【高值商品使用】里进行录入!", msg.Trim(','));
                    Alert.Show(strNostock, "消息提示", MessageBoxIcon.Warning);
                }
                if (!string.IsNullOrWhiteSpace(msg1))
                {
                    String strNostock = "";
                    strNostock = string.Format("商品【{0}】无库存!", msg1.Trim(','));
                    Alert.Show(strNostock, "消息提示", MessageBoxIcon.Warning);
                }
                if (!string.IsNullOrWhiteSpace(msg2))
                {
                    String strNostock = "";
                    strNostock = string.Format("商品【{0}】【含税进价】为空,不能进行【商品退货审批】操作。", msg2.Trim(','));
                    Alert.Show(strNostock, "消息提示", MessageBoxIcon.Warning);
                }
                if (!string.IsNullOrWhiteSpace(msg3))//
                {
                    String strNostock = "";
                    strNostock = string.Format("商品【{0}】在申请明细中已存在。", msg3.Trim(','));
                    Alert.Show(strNostock, "消息提示", MessageBoxIcon.Warning);
                }
            }
            else
            {
                Alert.Show("请选择需要添加的商品!", "消息提示", MessageBoxIcon.Warning);
            }
        }
Beispiel #23
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;
        }
Beispiel #24
0
        protected void GridGoods_AfterEdit(object sender, FineUIPro.GridAfterEditEventArgs e)
        {
            string[] strCell = GridGoods.SelectedCell;
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();

            if (newDict.Count == 0)
            {
                return;
            }
            if (e.ColumnID == "BZSL")
            {
                if (!PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "BZHL")) || !PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "BZSL")) || !PubFunc.isNumeric(Doc.GetGridInf(GridGoods, e.RowID, "HSJJ")))
                {
                    Alert.Show("商品信息异常,请详细检查商品信息:包装含量、价格或数量!", "异常信息", MessageBoxIcon.Warning);
                    return;
                }
                JObject defaultObj = Doc.GetJObject(GridGoods, e.RowID);
                decimal hl = 0, rs = 0, jg = 0;
                decimal.TryParse((defaultObj["BZHL"] ?? "0").ToString(), out hl);
                decimal.TryParse((defaultObj["BZSL"] ?? "0").ToString(), out rs);
                decimal.TryParse((defaultObj["HSJJ"] ?? "0").ToString(), out jg);
                defaultObj["DHSL"] = rs * hl;
                defaultObj["HSJE"] = Math.Round(rs * jg, 2).ToString("F2");
                PageContext.RegisterStartupScript(GridGoods.GetUpdateCellValueReference(e.RowID, defaultObj));

                //计算合计数量
                decimal bzslTotal = 0, feeTotal = 0;
                foreach (Dictionary <string, object> dic in newDict)
                {
                    bzslTotal += Convert.ToDecimal(dic["BZSL"]);
                    feeTotal  += Convert.ToDecimal(dic["HSJJ"]) * Convert.ToDecimal(dic["BZSL"]);
                }
                JObject summary = new JObject();
                summary.Add("GDNAME", "本页合计");
                summary.Add("BZSL", bzslTotal.ToString());
                summary.Add("HSJE", feeTotal.ToString("F2"));
                GridGoods.SummaryData = summary;
            }
            else if (e.ColumnID == "PH")
            {
                String gdseq = Doc.GetGridInf(GridGoods, e.RowID, "GDSEQ");
                if (gdseq.Length < 1)
                {
                    Alert.Show("请先选择商品信息!", "异常信息", MessageBoxIcon.Question);
                    return;
                }
                String ph = Doc.GetGridInf(GridGoods, e.RowID, "PH");
                if (ph.Length < 1 && DbHelperOra.Exists(string.Format("SELECT 1 FROM DOC_GOODS WHERE GDSEQ = '{0}' AND ISLOT = '2'", gdseq)))
                {
                    Alert.Show("请填写商品[" + gdseq + "]批次信息!", "异常信息", MessageBoxIcon.Warning);
                    return;
                }

                if (ph.ToString() == "\\")
                {
                    DataTable dtPH = Doc.GetGoodsPH_New(gdseq, docDEPTID.SelectedValue);
                    if (dtPH != null && dtPH.Rows.Count > 0)
                    {
                        hfdRowIndex.Text   = GridGoods.SelectedRowIndex.ToString();
                        GridLot.DataSource = dtPH;
                        GridLot.DataBind();
                        WindowLot.Hidden = false;
                    }
                    else
                    {
                        Alert.Show("商品[" + gdseq + "]已无库存,请检查!", MessageBoxIcon.Warning);
                    }
                }
            }
        }
Beispiel #25
0
        protected void btnOk()
        {
            if (Doc.DbGetSysPara("LOCKSTOCK") == "Y")
            {
                Alert.Show("系统库存已被锁定,请等待物资管理科结存处理完毕再做审核处理!", "消息提醒", MessageBoxIcon.Warning);
                return;
            }

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

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

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

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

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

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

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

            if (flag)
            {
                billLockDoc(true);
                //增加待办事宜
                DbHelperOra.ExecuteSql("UPDATE DAT_DO_LIST SET FLAG = 'Y' WHERE PARA='" + docBILLNO.Text.Trim() + "'");
                if (DbHelperOra.Exists("select 1 from dat_ck_com where seqno = '" + docBILLNO.Text.Trim() + "' and gdseq in (select gdseq from doc_goods where catid0 = 1 )") == true)
                {
                    Alert.Show("商品出库确认完成!需要打印试剂条码!", "消息提示", MessageBoxIcon.Information);
                }
                else
                {
                    Alert.Show("商品出库确认完成!", "消息提示", MessageBoxIcon.Information);
                    OperLog("科室申领", "出库确认单据【" + docBILLNO.Text + "】");
                }
                billOpen(docBILLNO.Text);
            }
            else
            {
                Alert.Show("商品出库确认出错!!!", "错误提示", MessageBoxIcon.Error);
            }
        }
Beispiel #26
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";
                }
            }
        }
Beispiel #27
0
        protected void Window3_Close(object sender, WindowCloseEventArgs e)
        {
            DataTable dt = GetGoods(hfdValue.Text);

            dt.Columns.Remove(dt.Columns["BZHL"]);
            dt.Columns.Remove(dt.Columns["UNIT"]);
            string msg = "";

            if (dt != null && dt.Rows.Count > 0)
            {
                dt.Columns["UNITNAME"].ColumnName       = "UNITSMALLNAME";
                dt.Columns["UNIT_SELL_NAME"].ColumnName = "UNITNAME";
                dt.Columns["UNIT_SELL"].ColumnName      = "UNIT";
                dt.Columns["BZHL_SELL"].ColumnName      = "BZHL";

                dt.Columns.Add("PH", Type.GetType("System.String"));
                dt.Columns.Add("RQ_SC", Type.GetType("System.String"));
                dt.Columns.Add("YXQZ", Type.GetType("System.String"));
                dt.Columns.Add("MEMO", Type.GetType("System.String"));
                dt.Columns.Add("BZSL", Type.GetType("System.Int32"));
                dt.Columns.Add("DHSL", Type.GetType("System.Int32"));
                dt.Columns.Add("HSJE", Type.GetType("System.Double"));

                string someDjbh = string.Empty;
                bool   getDjbh  = false;
                foreach (DataRow row in dt.Rows)
                {
                    // if (btnCollect.Text == "全部商品")
                    //   {
                    //   row["BZSL"] = row["DEFSL"];
                    //  }
                    //  else
                    //  {
                    row["BZSL"] = "0";
                    //  }
                    row["MEMO"] = row["ISZS"];
                    row["DHSL"] = "0";
                    row["HSJE"] = "0";
                    //row["HSJJ"].ToString();
                    if (string.IsNullOrWhiteSpace(row["HSJJ"].ToString()) || row["HSJJ"].ToString() == "0")
                    {
                        msg += "【" + row["GDSEQ"].ToString() + " | " + row["GDNAME"].ToString() + "】,";
                        Alert.Show("商品" + msg + "【含税进价】为空,不能进行【科室申领录入】操作。", "消息提示", MessageBoxIcon.Warning);
                        continue;
                    }
                    //处理金额格式
                    decimal jingdu = 0;
                    decimal bzhl   = 0;
                    if (decimal.TryParse(row["HSJJ"].ToString(), out jingdu) && decimal.TryParse(row["BZHL"].ToString(), out bzhl))
                    {
                        row["HSJJ"] = Math.Round(jingdu * bzhl, 4).ToString("F4");
                    }
                    if (decimal.TryParse(row["YBJ"].ToString(), out jingdu))
                    {
                        row["YBJ"] = jingdu.ToString("F4");
                    }
                    if (decimal.TryParse(row["HSJE"].ToString(), out jingdu))
                    {
                        row["HSJE"] = Math.Round(jingdu, 2).ToString("F2");
                    }
                    //  docMEMO.Enabled = true;
                    List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().OrderBy(x => x["GDSEQ"]).ToList();
                    int sameRowCount = newDict.Where(a => a["GDSEQ"].ToString() == row["GDSEQ"].ToString()).Count();
                    if (sameRowCount > 0)
                    {
                        someDjbh += "【" + row["GDNAME"].ToString() + "】";
                        getDjbh   = true;
                    }
                    else
                    {
                        PubFunc.GridRowAdd(GridGoods, row, false);
                        // docDEPTID.Enabled = false;
                    }
                }
                if (getDjbh)
                {
                    Alert.Show("商品名称:" + someDjbh + "申请明细中已存在", "消息提示", MessageBoxIcon.Warning);
                }
            }
            else
            {
                Alert.Show("请先选择要加载的商品信息!", "消息提示", MessageBoxIcon.Warning);
            }
        }
Beispiel #28
0
        protected void trbBARCODE_TriggerClick(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(docDEPTID.SelectedValue))
            {
                Alert.Show("请选择申领科室!", "提示信息", MessageBoxIcon.Warning);
                trbBARCODE.Text = "";
                trbBARCODE.Focus();
                return;
            }
            if (string.IsNullOrWhiteSpace(docLRY.SelectedValue))
            {
                Alert.Show("【操作员】不能为空,请维护!", "提示信息", MessageBoxIcon.Warning);
                return;
            }
            //扫码出库
            if (trbBARCODE.Text.Length < Doc.LENCODE())
            {
                return;
            }
            List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList();

            for (int i = 0; i < newDict.Count; i++)
            {
                if (newDict[i]["STR2"].ToString() == trbBARCODE.Text.Trim())
                {
                    Alert.Show("扫描条码已增加到单据中!", "提示信息", MessageBoxIcon.Warning);
                    trbBARCODE.Text = "";
                    trbBARCODE.Focus();
                    return;
                }
            }
            DataTable dtCode = DbHelperOra.Query(String.Format("SELECT DEPTCUR,DEPTID,GDSEQ FROM DAT_GZ_EXT WHERE UPPER(ONECODE) = UPPER('{0}') OR UPPER(STR1) = UPPER('{0}')", trbBARCODE.Text)).Tables[0];

            if (dtCode == null || dtCode.Rows.Count < 1)
            {
                Alert.Show("系统中不存在条码【" + trbBARCODE.Text.Trim() + "】!", "提示信息", MessageBoxIcon.Warning);
                trbBARCODE.Text = "";
                trbBARCODE.Focus();
                return;
            }
            string dept  = dtCode.Rows[0]["DEPTCUR"].ToString();//Doc.ONECODE_GZ(trbBARCODE.Text.Trim(), "DEPTCUR");
            string gdseq = dtCode.Rows[0]["GDSEQ"].ToString();

            if (docDEPTOUT.SelectedValue.Length > 0)
            {
                if (docDEPTOUT.SelectedValue != dept)
                {
                    Alert.Show("高值条码为【" + trbBARCODE.Text.Trim() + "】的商品不在库房【" + docDEPTOUT.SelectedText + "】中,请检查!", "提示信息", MessageBoxIcon.Warning);
                    trbBARCODE.Text = "";
                    trbBARCODE.Focus();
                    return;
                }
            }
            else
            {
                docDEPTOUT.SelectedValue = dept;
                if (docDEPTOUT.Text.Length < 1)
                {
                    Alert.Show("扫描条码的库房不存在或条码已被使用!");
                    docDEPTOUT.SelectedValue = "";
                    trbBARCODE.Text          = "";
                    trbBARCODE.Focus();
                    return;
                }
            }

            if (!DbHelperOra.Exists(string.Format("SELECT 1 FROM DOC_GOODSCFG WHERE DEPTID='{0}' AND GDSEQ='{1}' AND ISCFG='Y'", docDEPTID.SelectedValue, gdseq)))
            {
                Alert.Show("编码为【" + gdseq.Trim() + "】的商品未配置到科室【" + docDEPTID.SelectedText + "】!", "提示信息", MessageBoxIcon.Warning);
                trbBARCODE.Text = "";
                trbBARCODE.Focus();
                return;
            }
            docDEPTOUT.Enabled = false;
            docDEPTID.Enabled  = false;
            //增加商品
            //信息赋值
            DataTable dt = DbHelperOra.Query("SELECT A.* FROM DAT_GZ_EXT A WHERE (UPPER(A.ONECODE) = UPPER('" + trbBARCODE.Text.Trim() + "') OR UPPER(A.STR1) = UPPER('" + trbBARCODE.Text.Trim() + "')) AND FLAG IN('Y','R')").Tables[0];

            if (dt.Rows.Count < 1)
            {
                Alert.Show("扫描条码未入库或已被使用!", "提示信息", MessageBoxIcon.Warning);
                trbBARCODE.Text = "";
                trbBARCODE.Focus();
                return;
            }
            DataTable dt_goods = Doc.GetGoods_His(gdseq, "", dept);
            int       index    = 0;

            if (hdfRowIndex.Text.Trim().Length > 0)
            {
                index = int.Parse(hdfRowIndex.Text);
            }
            else
            {
                index = 1;
            }

            if (dt_goods != null && dt_goods.Rows.Count > 0)
            {
                dt_goods.Columns.Add("BZSL", Type.GetType("System.Int32"));
                dt_goods.Columns.Add("HSJE", Type.GetType("System.Double"));
                dt_goods.Columns.Add("STR2", Type.GetType("System.String"));
                dt_goods.Columns.Add("ROWNO", Type.GetType("System.Int32"));
                DataRow dr_goods = dt_goods.Rows[0];
                dr_goods["BZSL"]  = "1";
                dr_goods["BZHL"]  = "1";
                dr_goods["STR2"]  = trbBARCODE.Text.Trim().ToUpper();
                dr_goods["HSJE"]  = dr_goods["HSJJ"];
                dr_goods["PH"]    = dt.Rows[0]["PH"];
                dr_goods["YXQZ"]  = dt.Rows[0]["YXQZ"];
                dr_goods["RQ_SC"] = dt.Rows[0]["RQ_SC"];
                dr_goods["ROWNO"] = index;
                LoadGridRow(dr_goods, false);
                index++;
                hdfRowIndex.Text = index.ToString();
            }
            else
            {
                Alert.Show(string.Format("{0}尚未配置商品【{1}】!!!", docDEPTID.SelectedText, gdseq), MessageBoxIcon.Warning);
            }
            trbBARCODE.Text = "";
            trbBARCODE.Focus();
        }
Beispiel #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);
            }
        }
Beispiel #30
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;
        }