Ejemplo n.º 1
0
        protected void btnDel_Click(object sender, EventArgs e)
        {
            //int[] selectArray = GridLot.SelectedRowIndexArray;
            //if (selectArray.Length > 0)
            //{
            //    List<CommandInfo> cmdList = new List<CommandInfo>();
            //    for (int i = 0; i < selectArray.Length; i++)
            //    {
            //        cmdList.Add(new CommandInfo("delete DOC_GOODSPH where PHID='" + GridLot.Rows[selectArray[i]].Values[0].ToString() + "' and GDSEQ='" + GridLot.Rows[selectArray[i]].Values[1].ToString() + "'", null));
            //    }
            //    DbHelperOra.ExecuteSqlTran(cmdList);
            //    LoadData();
            //}
            if (GridLot.SelectedRowIndexArray.Length < 1)
            {
                return;
            }
            //if (GridLot.SelectedCell == null) return;
            //int rowIndex = GridLot.SelectedRowIndex;
            int rowIndex = GridLot.SelectedRowIndexArray[0];

            if (DbHelperOra.Exists("select 1 from DAT_GOODSSTOCK where GDSEQ='" + GridLot.DataKeys[rowIndex][1] + "' and KCSL > 0 and PHID = '" + GridLot.DataKeys[rowIndex][0] + "'"))
            {
                Alert.Show("商品" + GridLot.DataKeys[rowIndex][1] + "该批次仍有库存,不允许删除!");
                return;
            }
            PageContext.RegisterStartupScript(GridLot.GetDeleteRowReference(rowIndex));
            DbHelperOra.ExecuteSql("Delete from DOC_GOODSPH t WHERE T.GDSEQ ='" + GridLot.DataKeys[rowIndex][1] + "'  and T.PHID = '" + GridLot.DataKeys[rowIndex][0] + "'");
        }
Ejemplo n.º 2
0
        private void ShowPHWindow(string rowId)
        {
            String gdseq = Doc.GetGridInf(GridGoods, rowId, "GDSEQ");

            if (gdseq.Length < 1)
            {
                Alert.Show("请先选择商品信息!", "异常信息", MessageBoxIcon.Question);
                return;
            }
            String ph = Doc.GetGridInf(GridGoods, 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);
                }
            }
        }
Ejemplo n.º 3
0
        public void DataSearch()
        {
            int    total = 0;
            string sql   = "SELECT PH.*,F_GETHISINFO(SP.GDSEQ,'GDNAME') GDNAME FROM DOC_GOODSPH PH,DOC_GOODS SP WHERE PH.GDSEQ=SP.GDSEQ AND (sp.gdname LIKE '%{0}%' OR sp.GDSEQ LIKE '%{0}%' OR PH.PH LIKE '%{0}%') ORDER BY PH.YXQZ";

            GridLot.DataSource  = PubFunc.DbGetPage(GridLot.PageIndex, GridLot.PageSize, string.Format(sql, trbSearch.Text), ref total);
            GridLot.RecordCount = total;
            GridLot.DataBind();
        }
Ejemplo n.º 4
0
        protected void btnSch_Click(object sender, EventArgs e)
        {
            string sql = @"select  SP.*,f_getusername(manager) managername from  SYS_DEPT SP WHERE  SP.FLAG='Y'
                            and F_CHK_DATARANGE(CODE, '{0}') = 'Y' ";

            if (tgbDept.Text.Trim().Length > 0)
            {
                sql += String.Format(" AND (SP.CODE LIKE '%{0}%' OR SP.NAME LIKE '%{0}%')", tgbDept.Text.Trim());
            }
            GridLot.DataSource = DbHelperOra.Query(String.Format(sql + " ORDER BY SP.CODE", UserAction.UserID)).Tables[0];
            GridLot.DataBind();
        }
Ejemplo n.º 5
0
        protected void btnadd_Click(object sender, EventArgs e)
        {
            //if (PubFunc.FormDataCheck(FormDoc).Length > 1) return;
            tgbDept.Text = "";
            PubFunc.Form2Lock(FormDoc, true);
            string sql = @"select  SP.*,f_getusername(manager) managername from  SYS_DEPT SP WHERE  SP.FLAG='Y'
                            and F_CHK_DATARANGE(CODE, '{0}') = 'Y' 
                        ORDER BY SP.CODE";

            GridLot.DataSource = DbHelperOra.Query(String.Format(sql, UserAction.UserID)).Tables[0];
            GridLot.DataBind();
            WindowLot.Hidden = false;
        }
Ejemplo n.º 6
0
        protected void btnClosePostBack_Click(object sender, EventArgs e)
        {
            if (DbHelperOra.Exists("SELECT 1 FROM DAT_CK_DOC WHERE SEQNO ='" + hfdDept.Text + "' AND FLAG = 'Y'"))
            {
                Alert.Show("单据已被确认,请检查!", MessageBoxIcon.Warning);
                btnUpt.Hidden = true;
                return;
            }
            //更改预占数
            JArray Jary = GridLot.GetMergedData();

            if (Jary[0]["status"].ToString() != "unchanged")
            {
                Decimal modsl = Convert.ToDecimal(Jary[0]["values"]["XSSL"] ?? "0");
                Decimal kcsl  = Convert.ToDecimal(GridLot.DataKeys[0][0] ?? "0");
                if (kcsl < modsl)
                {
                    Alert.Show("修改商品的预出数不能大于库存!", MessageBoxIcon.Warning);
                    return;
                }
                if (hfdDept.Text.Substring(0, 2) == "DS" && modsl > 0 && modsl.ToString() != GridLot.DataKeys[0][1].ToString())
                {
                    if (modsl.ToString() != GridLot.DataKeys[0][2].ToString())//不等于定数含量
                    {
                        Alert.Show("定数只能整包出库或不出库!", MessageBoxIcon.Warning);
                        return;
                    }
                }
                OracleParameter[] parameters = new OracleParameter[]
                {
                    new OracleParameter("VI_BILLNO", OracleDbType.Varchar2),
                    new OracleParameter("VI_BILLTYPE", OracleDbType.Varchar2),
                    new OracleParameter("VI_ROWNO", OracleDbType.Int32),
                    new OracleParameter("VI_GDSEQ", OracleDbType.Varchar2),
                    new OracleParameter("VI_SLOLD", OracleDbType.Decimal),
                    new OracleParameter("VI_SLNEW", OracleDbType.Decimal)
                };
                parameters[0].Value = hfdDept.Text;
                parameters[1].Value = hfdDept.Text.Substring(0, 3);
                parameters[2].Value = GridGoods.DataKeys[GridGoods.SelectedRowIndex][1];
                parameters[3].Value = GridGoods.DataKeys[GridGoods.SelectedRowIndex][2];
                parameters[4].Value = GridLot.DataKeys[0][1];
                parameters[5].Value = modsl;
                DbHelperOra.RunProcedure("STOCK.P_STOCK_LOCKMOD", parameters);
                DbHelperOra.ExecuteSql(String.Format("UPDATE DAT_CK_COM SET XSSL = {0},bzsl = {0},dhsl = {0},fpsl = {0},hsje = {0}*hsjj WHERE SEQNO = '{1}' AND ROWNO = {2}", modsl, hfdDept.Text, GridGoods.DataKeys[GridGoods.SelectedRowIndex][1]));
                DbHelperOra.ExecuteSql(String.Format("UPDATE DAT_CK_DOC SET SUBSUM = (SELECT SUM(HSJE) FROM DAT_CK_COM WHERE SEQNO ='{0}') WHERE SEQNO ='{0}'", hfdDept.Text));
            }
            WinLot.Hidden = true;
            OperLog("波次拣货", "修改出库数【" + hfdDept.Text + "】");
            DataSearch();
        }
Ejemplo n.º 7
0
        protected override void billGoods()
        {
            if (PubFunc.FormDataCheck(FormDoc).Length > 1)
            {
                return;
            }
            billLockDoc(true);
            tbxMEMO.Enabled = true;
            //绑定库存,区分代管和非代管的供应商
            string strSql = "";

            strSql = @"SELECT A.*,B.GDNAME,b.PIZNO PZWH,F_GETUNITNAME(A.UNIT) UNITNAME,0 SL FROM DAT_GOODSSTOCK A, DOC_GOODS B 
                            WHERE A.GDSEQ = B.GDSEQ AND A.KCSL >0 AND A.DEPTID = '" + ddlDEPTID.SelectedValue + "' ORDER BY PH DESC";

            GridLot.DataSource = DbHelperOra.Query(strSql).Tables[0];
            GridLot.DataBind();
            WindowLot.Hidden = false;
        }
Ejemplo n.º 8
0
        protected void btnUpt_Click(object sender, EventArgs e)
        {
            if (GridGoods.SelectedRowIDArray.Length < 1)
            {
                Alert.Show("请选择需要修改出库数量的商品!", MessageBoxIcon.Warning);
                return;
            }
            Object obj = DbHelperOra.GetSingle("SELECT DEPTOUT FROM DAT_CK_DOC WHERE SEQNO ='" + hfdDept.Text + "' AND FLAG <> 'Y'");

            if ((obj ?? "").ToString().Length < 1)
            {
                Alert.Show("单据已被确认,请检查!", MessageBoxIcon.Warning);
                btnUpt.Hidden = true;
                return;
            }
            String sql = @"SELECT A.*,XSSL XSSL_OLD,
                            NVL((SELECT SUM(KCSL - LOCKSL) FROM DAT_GOODSSTOCK B WHERE B.GDSEQ = A.GDSEQ AND B.DEPTID = '{2}' AND B.KCSL > B.LOCKSL),0)+A.XSSL KCSL
                            FROM DAT_CK_COM A
                            WHERE A.SEQNO = '{0}' AND ROWNO = {1}";

            GridLot.DataSource = DbHelperOra.Query(String.Format(sql, hfdDept.Text, GridGoods.DataKeys[GridGoods.SelectedRowIndex][1], obj.ToString())).Tables[0];
            GridLot.DataBind();
            WinLot.Hidden = false;
        }
Ejemplo n.º 9
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);
                    }
                }
            }
        }
Ejemplo n.º 10
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);
                }
            }
        }
Ejemplo n.º 11
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")
            {
                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)
                {
                    decimal.TryParse(dic["BZSL"].ToString(), out jg);
                    bzslTotal += jg;

                    feeTotal += Convert.ToDecimal(dic["HSJJ"] ?? "0") * Convert.ToDecimal(dic["BZSL"] ?? "0") * 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;
            }
            else if (e.ColumnID == "PH")
            {
                JObject defaultObj = Doc.GetJObject(GridGoods, e.RowID);
                String  Sql        = string.Format("SELECT SUM(A.KCSL),A.PH,A.YXQZ,A.RQ_SC,B.PIZNO PZWH FROM DAT_GOODSSTOCK A,DOC_GOODS B WHERE A.DEPTID = '{0}' AND A.GDSEQ ='{1}' AND A.GDSEQ=B.GDSEQ  AND KCSL > LOCKSL GROUP BY PH,YXQZ,B.PIZNO,A.RQ_SC ", docDEPTOUT.SelectedValue, defaultObj["GDSEQ"].ToString());
                if (defaultObj["PH"].ToString() != "\\")
                {
                    Sql = string.Format("SELECT SUM(A.KCSL),A.PH,A.YXQZ,A.RQ_SC FROM DAT_GOODSSTOCK A WHERE A.DEPTID = '{0}' AND A.GDSEQ ='{1}'AND PH = '{2}'  AND KCSL > LOCKSL GROUP BY PH,YXQZ,A.RQ_SC", docDEPTOUT.SelectedValue, defaultObj["GDSEQ"].ToString(), defaultObj["PH"]);
                }
                DataTable dtPH = DbHelperOra.Query(Sql).Tables[0];
                if (dtPH != null && dtPH.Rows.Count > 0)
                {
                    if (dtPH.Rows.Count == 1)
                    {
                        defaultObj["PH"]    = dtPH.Rows[0]["PH"].ToString();
                        defaultObj["YXQZ"]  = dtPH.Rows[0]["YXQZ"].ToString();
                        defaultObj["RQ_SC"] = dtPH.Rows[0]["RQ_SC"].ToString();
                        PageContext.RegisterStartupScript(GridGoods.GetUpdateCellValueReference(strCell[0], defaultObj));
                    }
                    else
                    {
                        GridLot.DataSource = dtPH;
                        GridLot.DataBind();
                        WindowLot.Hidden = false;
                    }
                }
                //else
                //{
                //    Alert.Show("科室无可调出库存!", "提示信息", MessageBoxIcon.Warning);
                //    return;
                //}
            }
        }