📄 fypzdwh_ypggwh.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Sybase.DataWindow;
using Oracle.DataAccess.Client;
using Qeb.Control;
using Qeb.DBProxy;
using Qeb.Support;
using Qeb.Support.Common;
namespace Qeb.YK
{
public partial class FYpZdWh_YpGgWh : Qeb.Control.FBase
{
//药品规格ID 0表示新增
private string m_YpGgId = "";
//药品ID
private string m_YpId = "";
//药品名称
private string m_YpMc = "";
//药品类型
private string m_YpLx = "";
public FYpZdWh_YpGgWh()
{
InitializeComponent();
dwYpGg.LibraryList = PBL.YkPbl;
dwYpGg.DataWindowObject = YkDataObjects.D_Yk_YpGgWh;
}
internal void SetId(string ypGgId,string ypId,string ypMc,string ypLx)
{
m_YpGgId = ypGgId;
m_YpId = ypId;
m_YpMc = ypMc;
m_YpLx = ypLx;
labelYpMc.Text = "药品名称:" + m_YpMc;
if (m_YpGgId == "0")
{
this.Text = "药品规格维护 新增";
}
else
{
this.Text = "药品规格维护 修改";
}
}
private void btnClose_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private void FYpZdWh_YpGgWh_Load(object sender, EventArgs e)
{
DbProxyClient proxy = App.DbProxy;
if (m_YpGgId == "0")
{
int row = dwYpGg.InsertRow(0);
//药品ID
dwYpGg.SetItemString(row,"ypid", m_YpId);
//药品名称
dwYpGg.SetItemString(row, "ypmc", m_YpMc);
//药品类型
dwYpGg.SetItemString(row, "yplx", m_YpLx);
//皮试标志
dwYpGg.SetItemDecimal(row, "psbz", 0);
//大输液标志
dwYpGg.SetItemDecimal(row, "dsybz", 0);
//复方标志
dwYpGg.SetItemDecimal(row, "ffbz", 0);
//作废标志
dwYpGg.SetItemDecimal(row, "zfbz", 0);
//管理模式 默认总量
dwYpGg.SetItemString(row, "glms", "1");
#region 生成输入码
string srm1 = "";
string srm2 = "";
string srm3 = "";
string errMsg = StringHelper.GetSrm(m_YpMc, true, ref srm1, ref srm2, ref srm3);
if (errMsg == "")
{
dwYpGg.SetItemString(1, "srm1", srm1);
dwYpGg.SetItemString(1, "srm2", srm2);
dwYpGg.SetItemString(1, "srm3", srm3);
}
else
{
MessageBox.Show("生成输入码发生异常:"+errMsg, MsgTitle.Error);
}
#endregion
}
else
{
try
{
proxy.Clear();
proxy.AddRetrieveParam("p_ypggid", m_YpGgId);
proxy.Retrieve(dwYpGg);
}
catch (System.Exception ex)
{
MessageBox.Show("检索药品规格信息发生异常:"+ex.Message,MsgTitle.Error);
this.btnSave.Enabled = false;
}
try
{
dwYpGg.SetProperty("jl.protect", "1");
dwYpGg.SetProperty("jldw.protect", "1");
dwYpGg.SetProperty("tj.protect", "1");
dwYpGg.SetProperty("tjdw.protect", "1");
dwYpGg.SetProperty("nd.protect", "1");
dwYpGg.SetProperty("bzl.protect", "1");
dwYpGg.SetProperty("bzdw.protect", "1");
dwYpGg.SetProperty("zxdw.protect", "1");
}
catch(Exception ex)
{
MessageBox.Show("设置数据窗编辑属性发生异常:" + ex.Message, MsgTitle.Error);
this.btnSave.Enabled = false;
}
}
#region 检索子数据窗口
try
{ //帐薄类别
DataWindowChild dwcZbLb = dwYpGg.GetChild("zblbid");
proxy.Clear();
proxy.AddRetrieveParam("p_yplx", m_YpLx);
proxy.Retrieve(dwcZbLb);
//用药梯次
DataWindowChild dwcYyTc = dwYpGg.GetChild("yytc");
proxy.Clear();
proxy.AddRetrieveParam("p_flid", GyDmDefine.DMFL_YYTC);
proxy.Retrieve(dwcYyTc);
//剂型
DataWindowChild dwcJx = dwYpGg.GetChild("jxid");
proxy.Clear();
proxy.Retrieve(dwcJx);
//剂量单位
DataWindowChild dwcJlDw = dwYpGg.GetChild("jldw");
proxy.Clear();
proxy.Retrieve(dwcJlDw);
//体积单位
DataWindowChild dwcTjDw = dwYpGg.GetChild("tjdw");
dwcJlDw.ShareData(dwcTjDw);
//包装单位
DataWindowChild dwcBzDw = dwYpGg.GetChild("bzdw");
dwcJlDw.ShareData(dwcBzDw);
//最小单位
DataWindowChild dwcZxDw = dwYpGg.GetChild("zxdw");
dwcJlDw.ShareData(dwcZxDw);
}
catch(Exception ex)
{
MessageBox.Show("检索子数据窗口发生异常:" + ex.Message, MsgTitle.Error);
}
#endregion
}
#region 设置药品规格
private void SetYpGg()
{
dwYpGg.AcceptText();
//浓度
decimal nd = 0;
if (!dwYpGg.IsItemNull(1,"nd"))
nd = dwYpGg.GetItemDecimal(1, "nd");
//剂量
decimal jl = 0;
if (!dwYpGg.IsItemNull(1, "jl"))
jl = dwYpGg.GetItemDecimal(1, "jl");
//剂量单位
string jlDw = "";
if (!dwYpGg.IsItemNull(1, "jldw"))
jlDw = dwYpGg.GetItemString(1, "jldw");
//体积
decimal tj = 0;
if (!dwYpGg.IsItemNull(1, "tj"))
tj = dwYpGg.GetItemDecimal(1, "tj");
//体积单位
string tjDw = "";
if (!dwYpGg.IsItemNull(1, "tjdw"))
tjDw = dwYpGg.GetItemString(1, "tjdw");
//包装量
decimal bzl = 0;
if (!dwYpGg.IsItemNull(1, "bzl"))
bzl = dwYpGg.GetItemDecimal(1, "bzl");
//最小单位
string zxDw = "";
if (!dwYpGg.IsItemNull(1, "zxdw"))
zxDw = dwYpGg.GetItemString(1, "zxdw");
string ypGg = "";
if (nd > 0)
ypGg = nd.ToString("#0.##") + "% ";
if (jl > 0)
ypGg += jl.ToString("##0.##");
if (jlDw != "")
{
if (tj > 0)
ypGg += jlDw + "/" + tj.ToString("##0.##") + tjDw;
else
ypGg += jlDw;
ypGg += "*"+bzl.ToString("####.##") + zxDw;
}
else
{
if (tj > 0)
ypGg += tj.ToString("##0.##");
if (tjDw != "")
ypGg += tjDw;
if (ypGg == "")
ypGg = bzl.ToString("####.##") + zxDw;
else
ypGg += "*" + bzl.ToString("####.##") + zxDw;
}
dwYpGg.SetItemString(1, "ypgg", ypGg);
}
#endregion
private void dwYpGg_ItemError(object sender, ItemErrorEventArgs e)
{
e.Action = ItemErrorAction.RejectWithNoMessage;
}
private bool CheckYpGgXx()
{
if (!dwYpGg.AcceptText())
return false;
//帐薄类别
if (dwYpGg.IsItemNull(1, "zblbid") || dwYpGg.GetItemString(1, "zblbid") == "")
{
MessageBox.Show("帐薄类别不能为空,请输入!", MsgTitle.Prompt);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -