protected void tbxBARCODE_TextChanged(object sender, EventArgs e) { if (docDEPTGROUP.SelectedValue.Length > 0) { //长度不够 if (tbxBARCODE.Text.Trim().Length < Doc.LENCODE()) { return; } } else { //科室赋值 object obj = DbHelperOra.GetSingle("SELECT sjcode FROM SYS_DEPT WHERE CODE = '" + tbxBARCODE.Text.Trim() + "' AND TYPE = '5'"); if ((obj ?? "").ToString().Length > 0) { docDEPTGROUP.SelectedValue = tbxBARCODE.Text.Trim(); docDEPTID.Text = obj.ToString(); } else { Alert.Show("请首先选择科室或扫描科室工作牌!", "提示信息", MessageBoxIcon.Warning); } tbxBARCODE.Text = ""; tbxBARCODE.Focus(); return; } #region 扫描试剂条码 if (tbxBARCODE.Text.Trim().Substring(0, 1).ToUpper() == "3") { List <Dictionary <string, object> > newDict = GridGoods.GetNewAddedList().ToList(); for (int i = 0; i < newDict.Count; i++) { string barcode_old = (newDict[i]["ONECODE"] ?? "").ToString(); if (barcode_old == tbxBARCODE.Text) { Alert.Show("扫描的试剂条码已存在!", "消息提示", MessageBoxIcon.Warning); tbxBARCODE.Text = ""; tbxBARCODE.Focus(); return; } } DataTable barcode = DbHelperOra.Query("SELECT A.*,B.HSJJ FROM DAT_BARCODE_SJ A,DOC_GOODS B WHERE A.GDSEQ=B.GDSEQ AND A.GDBARCODE = '" + tbxBARCODE.Text + "' AND A.FLAG IN ('N','R') AND B.FLAG IN('Y','T')").Tables[0]; if (barcode != null && barcode.Rows.Count > 0) { string code = barcode.Rows[0]["GDSEQ"].ToString(); string dept = docDEPTID.Text; 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.Double")); dt_goods.Columns.Add("DHSL", Type.GetType("System.Double")); dt_goods.Columns.Add("NUM5", Type.GetType("System.Double")); dt_goods.Columns.Add("HSJE", Type.GetType("System.Double")); DataRow dr_goods = dt_goods.Rows[0]; dr_goods["BZSL"] = barcode.Rows[0]["SL"]; dr_goods["DHSL"] = barcode.Rows[0]["SL"]; object kcsl = DbHelperOra.GetSingle("SELECT SUM(KCSL-locksl) FROM DAT_GOODSSTOCK WHERE DEPTID = '" + dept + "' AND GDSEQ = '" + code + "' AND PHID = '" + barcode.Rows[0]["PH"].ToString() + "'"); dr_goods["NUM5"] = kcsl ?? 0; dr_goods["HSJE"] = Convert.ToDecimal(barcode.Rows[0]["SL"]) * Convert.ToDecimal(barcode.Rows[0]["HSJJ"]); dr_goods["PH"] = barcode.Rows[0]["PH"]; dr_goods["PZWH"] = barcode.Rows[0]["PZWH"]; dr_goods["RQ_SC"] = barcode.Rows[0]["RQ_SC"]; dr_goods["YXQZ"] = barcode.Rows[0]["YXQZ"]; dr_goods["HWID"] = barcode.Rows[0]["HWID"]; dr_goods["ONECODE"] = tbxBARCODE.Text; PubFunc.GridRowAdd(GridGoods, dr_goods, false); tbxNUM.Text = (Convert.ToInt16(tbxNUM.Text) + 1).ToString(); tbxBARCODE.Text = ""; tbxBARCODE.Focus(); } else { Alert.Show(string.Format("部门【{0}】尚未配置商品【{1}】!!!", docDEPTID.Text, code), MessageBoxIcon.Warning); } } } else { Alert.Show("扫描条码不存在或已被出库使用,请检查!!!"); tbxBARCODE.Text = ""; tbxBARCODE.Focus(); } } else { Alert.Show("条码异常,请检查后重新输入。", "操作提示", MessageBoxIcon.Warning); tbxBARCODE.Text = ""; tbxBARCODE.Focus(); } #endregion }
protected void Window2_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["CKKCSL"].ColumnName = "NUM1"; 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("DHSL", Type.GetType("System.Int32")); dt.Columns.Add("HSJE", Type.GetType("System.Double")); dt.Columns.Add("BZSL", Type.GetType("System.String")); string someDjbh = string.Empty; bool getDjbh = false; foreach (DataRow row in dt.Rows) { row["MEMO"] = row["ISZS"]; row["DHSL"] = "0"; row["HSJE"] = "0"; row["BZSL"] = "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); } }
/// <summary> /// FineUIPro.Grid控件数据加载 /// </summary> /// <param name="row">要加载的行数据</param> /// <param name="firstRow">是否插入指定行</param> /// <param name="flag">数据来源:NEW-从数据库中获得,用于商品新增时;OLD-从销售单据明细中获得,用于修改或审核时</param> private void LoadGridRow(DataRow row, bool firstRow = true, string flag = "NEW") { PubFunc.GridRowAdd(GridGoods, row, firstRow); }
/// <summary> /// FineUIPro.Grid控件数据加载 /// </summary> /// <param name="row">要加载的行数据</param> /// <param name="firstRow">是否插入指定行</param> /// <param name="flag">数据来源:NEW-从数据库中获得,用于商品新增时;OLD-从销售单据明细中获得,用于修改或审核时</param> private void LoadGridRow(DataRow row, bool firstRow = true, string flag = "NEW") { row["HSJE"] = Convert.ToDecimal(row["HSJJ"]) * Convert.ToDecimal(row["BZHL"]); PubFunc.GridRowAdd(GridGoods, row, false); }
protected override void billOpen(string strBillno) { DataTable dtDoc = DbHelperOra.Query(string.Format(strDocSql, strBillno)).Tables[0]; PubFunc.FormDataSet(FormDoc, dtDoc.Rows[0]); PageContext.RegisterStartupScript(GridGoods.GetRejectChangesReference()); decimal bzslTotal = 0, feeTotal = 0, dhslTotal = 0; DataTable dtBill = DbHelperOra.Query(string.Format(strComSql, strBillno, docDEPTOUT.SelectedValue)).Tables[0]; if (dtBill != null && dtBill.Rows.Count > 0) { foreach (DataRow row in dtBill.Rows) { bzslTotal += Convert.ToDecimal(row["BZSL"]); feeTotal += Convert.ToDecimal(row["HSJE"]); dhslTotal += Convert.ToDecimal(row["DHSL"]); } PubFunc.GridRowAdd(GridGoods, dtBill); } //计算合计数量 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; PubFunc.FormLock(FormDoc, true, ""); TabStrip1.ActiveTabIndex = 1; //增加按钮控制 if (docFLAG.SelectedValue == "N" || docFLAG.SelectedValue == "R") { docMEMO.Enabled = true; btnDel.Enabled = true; btnSave.Enabled = true; btnAudit.Enabled = true; btnCancel.Enabled = false; btnPrt.Enabled = false; btnPrint.Enabled = false; btnDelRow.Enabled = true; btnGoods.Enabled = true; trbBARCODE.Enabled = true; } else if (docFLAG.SelectedValue == "A") { docMEMO.Enabled = false; btnDel.Enabled = false; btnSave.Enabled = false; btnAudit.Enabled = true; btnCancel.Enabled = true; btnPrt.Enabled = false; btnPrint.Enabled = false; btnDelRow.Enabled = false; btnGoods.Enabled = false; } else { docMEMO.Enabled = false; btnDel.Enabled = false; btnSave.Enabled = false; btnAudit.Enabled = false; btnCancel.Enabled = false; btnPrt.Enabled = true; btnPrint.Enabled = true; btnDelRow.Enabled = false; btnGoods.Enabled = false; } }
protected override void billOpen(string strBillno) { DataTable dtDoc = DbHelperOra.Query(string.Format(strDocSql, strBillno)).Tables[0]; PubFunc.FormDataSet(FormDoc, dtDoc.Rows[0]); PageContext.RegisterStartupScript(GridGoods.GetRejectChangesReference()); string str = string.Format(strComSql, strBillno); int i = 0; DataTable dtBill = DbHelperOra.Query(string.Format(strComSql, strBillno)).Tables[0]; decimal bzslTotal = 0, feeTotal = 0; if (dtBill != null && dtBill.Rows.Count > 0) { foreach (DataRow row in dtBill.Rows) { //LoadGridRow(row, false, "DSC"); bzslTotal += Convert.ToDecimal(row["CH"] ?? "0"); feeTotal += Convert.ToDecimal(row["HSJJ"] ?? "0") * Convert.ToDecimal(row["BZHL"] ?? "0") * Convert.ToDecimal(row["CH"] ?? "0"); } /* * 修 改 人 :袁鹏 修改时间:2015-04-13 * 信息说明:这种加载方法比LoadGridRow(row, false, "DSC")更高效 * 研发组织:威高讯通信息科技有限公司 */ PubFunc.GridRowAdd(GridGoods, dtBill); } //trbEditorGDSEQ.Enabled = false; PubFunc.FormLock(FormDoc, true, ""); //计算合计数量 JObject summary = new JObject(); summary.Add("GDNAME", "本页合计"); summary.Add("CH", bzslTotal.ToString()); summary.Add("CHJE", feeTotal.ToString("F2")); GridGoods.SummaryData = summary; TabStrip1.ActiveTabIndex = 1; //根据状态屏蔽按钮 if (docFLAG.SelectedValue == "M") { docMEMO.Enabled = true; BtnPrintJh.Enabled = false; btnPrint.Enabled = false; btnPrintBQ.Enabled = false; btnDel.Enabled = true; btnSave.Enabled = true; btnAudit.Enabled = true; btnDelRow.Enabled = true; btnGoods.Enabled = true; btnAudit2.Enabled = false; btnRtn.Enabled = false; } else if (docFLAG.SelectedValue == "Y") { BtnPrintJh.Enabled = true; btnPrint.Enabled = true; btnPrintBQ.Enabled = true; btnDel.Enabled = false; btnSave.Enabled = false; btnAudit.Enabled = false; btnDelRow.Enabled = false; btnGoods.Enabled = false; btnAudit2.Enabled = false; btnRtn.Enabled = false; } else if (docFLAG.SelectedValue == "N") { BtnPrintJh.Enabled = false; btnPrint.Enabled = false; btnPrintBQ.Enabled = false; btnDel.Enabled = false; btnSave.Enabled = false; btnAudit.Enabled = false; btnDelRow.Enabled = false; btnGoods.Enabled = false; btnAudit2.Enabled = false; btnRtn.Enabled = true; } else { BtnPrintJh.Enabled = false; btnPrint.Enabled = false; btnPrintBQ.Enabled = false; btnDel.Enabled = false; btnSave.Enabled = false; btnAudit.Enabled = false; btnDelRow.Enabled = false; btnGoods.Enabled = false; btnAudit2.Enabled = true; btnRtn.Enabled = false; } }
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"); } } }