/// <summary> /// 打印 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { KPS.Model.GouJinInfo _Modelinfo = (KPS.Model.GouJinInfo)_control.GetSaveData(); ListPrint print = new ListPrint(_Modelinfo); print.ShowDialog(); }
/// <summary> /// 1.诊断试剂购进 /// </summary> private void ManagerZDSJGJ() { bool bolState = false; try { KPS.Model.GouJinInfo _Modelinfo = (KPS.Model.GouJinInfo)_control.GetSaveData(); _Modelinfo.DataType = thisdeviceinfo.DeviceID; KPS.BLL.GouJinManager gjmanager = new GouJinManager(); if (ModelData != null) { _Modelinfo.ID = ((GouJinInfo)ModelData).ID; bolState = gjmanager.Update(_Modelinfo); } else { bolState = gjmanager.Add(_Modelinfo); if (bolState) { //库存中新增购进记录 KPS.BLL.InventoryManager inventorymg = new InventoryManager(); inventorymg.Add(_Modelinfo); } } } catch (Exception ex) { bolState = false; } ShowMsgStateInfo(bolState, ModelData); }
/// <summary> /// 保存表单数据 /// </summary> public override object GetSaveData() { KPS.Model.GouJinInfo gjinfo = new GouJinInfo(); gjinfo.p_clmc = textBox13.Text.Trim(); gjinfo.p_cpmc = txtbox1.Text.Trim(); gjinfo.p_date = dateTimePicker1.Value; gjinfo.p_dw = textBox1.Text.Trim(); gjinfo.p_ggxh = txtbox2.Text.Trim(); gjinfo.p_gys = textBox2.Text.Trim(); gjinfo.p_jsr = textBox5.Text.Trim(); gjinfo.p_mjph = textBox9.Text.Trim(); gjinfo.p_ph = textBox14.Text.Trim(); gjinfo.p_sl1 =(int)numericUpDown1.Value; gjinfo.p_sl2 =numericUpDown2.Value.ToString("0.00"); gjinfo.p_zczh = string.Format("食药监械({0})字 第({1})号", textBox7.Text.Trim(),textBox3.Text.Trim()); gjinfo.p_zzs = textBox4.Text.Trim(); gjinfo.RemarkInfo = txtRemark.Text.Trim();//备注信息 gjinfo.Reconfirm = txtreconfirm.Text.Trim();//复核人 gjinfo.p_valid = dtimevalid.Value;//有效期 return gjinfo; }
/// <summary> /// 购进信息打印 /// </summary> /// <param name="_GoujinInfo"></param> public ListPrint(KPS.Model.GouJinInfo _GoujinInfo) { goujininfo = _GoujinInfo; InitializeComponent(); PrintGouJinInfo();//打印购进记录信息 }
/// <summary> /// 增加一条数据(内部根据 产品名称+厂家+注册证号+批号 判断是否已存在,若存在则只更新数量) /// </summary> public bool Add(KPS.Model.GouJinInfo model) { bool _bolSucced = false; bool _RecordIsExt = false; int _ToltalRecordCount = 0; int _RecordID = -1; #region 判断产品记录是否已存在 StringBuilder strQuerySQL = new StringBuilder(); strQuerySQL.Append("select ID,p_date,p_cpmc,p_ggxh,p_clmc,p_ph,p_dw,p_sl1,p_mjph,p_zzs,p_zczh,p_gys,p_sl2,p_jsr,DataType,RemarkInfo "); strQuerySQL.Append(" FROM PSI_Inventory where p_cpmc=@p_cpmc and p_zczh=@p_zczh and p_zzs=@p_zzs and p_ph=@p_ph"); OleDbParameter[] parameters = { new OleDbParameter("@p_cpmc", OleDbType.VarChar, 255), new OleDbParameter("@p_zczh", OleDbType.VarChar, 255), new OleDbParameter("@p_zzs", OleDbType.VarChar, 255), new OleDbParameter("@p_ph", OleDbType.VarChar, 255) }; parameters[0].Value = model.p_cpmc; parameters[1].Value = model.p_zczh; parameters[2].Value = model.p_zzs; parameters[3].Value = model.p_ph; DataSet _ds = DbHelperOleDb.Query(strQuerySQL.ToString(), parameters); if (_ds != null && _ds.Tables[0].Rows.Count > 0) { try { _ToltalRecordCount = Convert.ToInt32(_ds.Tables[0].Rows[0]["p_sl1"]); _RecordID = Convert.ToInt32(_ds.Tables[0].Rows[0]["ID"]); _RecordIsExt = true; } catch (Exception ex) { } } #endregion if (!_RecordIsExt) { #region 新增记录 StringBuilder strSql = new StringBuilder(); strSql.Append("insert into PSI_Inventory("); strSql.Append("p_date,p_cpmc,p_ggxh,p_clmc,p_ph,p_dw,p_sl1,p_mjph,p_zzs,p_zczh,p_gys,p_sl2,p_jsr,DataType,RemarkInfo)"); strSql.Append(" values ("); strSql.Append("@p_date,@p_cpmc,@p_ggxh,@p_clmc,@p_ph,@p_dw,@p_sl1,@p_mjph,@p_zzs,@p_zczh,@p_gys,@p_sl2,@p_jsr,@DataType,@RemarkInfo)"); OleDbParameter[] parameterstwo = { new OleDbParameter("@p_date", OleDbType.Date), new OleDbParameter("@p_cpmc", OleDbType.VarChar, 255), new OleDbParameter("@p_ggxh", OleDbType.VarChar, 255), new OleDbParameter("@p_clmc", OleDbType.VarChar, 255), new OleDbParameter("@p_ph", OleDbType.VarChar, 255), new OleDbParameter("@p_dw", OleDbType.VarChar, 255), new OleDbParameter("@p_sl1", OleDbType.Integer, 4), new OleDbParameter("@p_mjph", OleDbType.VarChar, 255), new OleDbParameter("@p_zzs", OleDbType.VarChar, 255), new OleDbParameter("@p_zczh", OleDbType.VarChar, 255), new OleDbParameter("@p_gys", OleDbType.VarChar, 255), new OleDbParameter("@p_sl2", OleDbType.VarChar, 255), new OleDbParameter("@p_jsr", OleDbType.VarChar, 255), new OleDbParameter("@DataType", OleDbType.Integer, 4), new OleDbParameter("@RemarkInfo", OleDbType.VarChar, 255) }; parameterstwo[0].Value = model.p_date; parameterstwo[1].Value = model.p_cpmc; parameterstwo[2].Value = model.p_ggxh; parameterstwo[3].Value = model.p_clmc; parameterstwo[4].Value = model.p_ph; parameterstwo[5].Value = model.p_dw; parameterstwo[6].Value = model.p_sl1; parameterstwo[7].Value = model.p_mjph; parameterstwo[8].Value = model.p_zzs; parameterstwo[9].Value = model.p_zczh; parameterstwo[10].Value = model.p_gys; parameterstwo[11].Value = model.p_sl2; parameterstwo[12].Value = model.p_jsr; parameterstwo[13].Value = model.DataType; parameterstwo[14].Value = model.RemarkInfo; int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameterstwo); if (rows > 0) { _bolSucced = true; } else { _bolSucced = false; } #endregion } else { int SurplusNumber = _ToltalRecordCount + model.p_sl1.Value;//统计总数量 #region 更新产品库存数量 StringBuilder strSql = new StringBuilder(); strSql.Append("update PSI_Inventory set "); strSql.Append("p_sl1=@p_sl1,"); strSql.Append("p_date=@p_date"); strSql.Append(" where ID=@ID"); OleDbParameter[] upparameters = { new OleDbParameter("@p_sl1", OleDbType.Integer, 4), new OleDbParameter("@p_date", OleDbType.Date), new OleDbParameter("@ID", OleDbType.Integer, 4) }; upparameters[0].Value = SurplusNumber; upparameters[1].Value = DateTime.Now; upparameters[2].Value = _RecordID; int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), upparameters); if (rows > 0) { return(true); } else { return(false); } #endregion } return(_bolSucced); }
/// <summary> /// 得到一个对象实体 /// </summary> public KPS.Model.GouJinInfo DataRowToModel(DataRow row) { KPS.Model.GouJinInfo model = new KPS.Model.GouJinInfo(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = int.Parse(row["ID"].ToString()); } if (row["p_date"] != null && row["p_date"].ToString() != "") { model.p_date = DateTime.Parse(row["p_date"].ToString()); } if (row["p_cpmc"] != null) { model.p_cpmc = row["p_cpmc"].ToString(); } if (row["p_ggxh"] != null) { model.p_ggxh = row["p_ggxh"].ToString(); } if (row["p_clmc"] != null) { model.p_clmc = row["p_clmc"].ToString(); } if (row["p_ph"] != null) { model.p_ph = row["p_ph"].ToString(); } if (row["p_dw"] != null) { model.p_dw = row["p_dw"].ToString(); } if (row["p_sl1"] != null && row["p_sl1"].ToString() != "") { model.p_sl1 = int.Parse(row["p_sl1"].ToString()); } if (row["p_mjph"] != null) { model.p_mjph = row["p_mjph"].ToString(); } if (row["p_zzs"] != null) { model.p_zzs = row["p_zzs"].ToString(); } if (row["p_zczh"] != null) { model.p_zczh = row["p_zczh"].ToString(); } if (row["p_gys"] != null) { model.p_gys = row["p_gys"].ToString(); } if (row["p_sl2"] != null) { model.p_sl2 = row["p_sl2"].ToString(); } if (row["p_jsr"] != null) { model.p_jsr = row["p_jsr"].ToString(); } if (row["DataType"] != null) { model.DataType = Convert.ToInt32(row["DataType"]); } if (row["RemarkInfo"] != null) { model.RemarkInfo = row["RemarkInfo"].ToString(); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(KPS.Model.GouJinInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update PSI_Inventory set "); strSql.Append("p_date=@p_date,"); strSql.Append("p_cpmc=@p_cpmc,"); strSql.Append("p_ggxh=@p_ggxh,"); strSql.Append("p_clmc=@p_clmc,"); strSql.Append("p_ph=@p_ph,"); strSql.Append("p_dw=@p_dw,"); strSql.Append("p_sl1=@p_sl1,"); strSql.Append("p_mjph=@p_mjph,"); strSql.Append("p_zzs=@p_zzs,"); strSql.Append("p_zczh=@p_zczh,"); strSql.Append("p_gys=@p_gys,"); strSql.Append("p_sl2=@p_sl2,"); strSql.Append("p_jsr=@p_jsr,"); strSql.Append("DataType=@DataType,"); strSql.Append("RemarkInfo=@RemarkInfo"); strSql.Append(" where ID=@ID"); OleDbParameter[] parameters = { new OleDbParameter("@p_date", OleDbType.Date), new OleDbParameter("@p_cpmc", OleDbType.VarChar, 255), new OleDbParameter("@p_ggxh", OleDbType.VarChar, 255), new OleDbParameter("@p_clmc", OleDbType.VarChar, 255), new OleDbParameter("@p_ph", OleDbType.VarChar, 255), new OleDbParameter("@p_dw", OleDbType.VarChar, 255), new OleDbParameter("@p_sl1", OleDbType.Integer, 4), new OleDbParameter("@p_mjph", OleDbType.VarChar, 255), new OleDbParameter("@p_zzs", OleDbType.VarChar, 255), new OleDbParameter("@p_zczh", OleDbType.VarChar, 255), new OleDbParameter("@p_gys", OleDbType.VarChar, 255), new OleDbParameter("@p_sl2", OleDbType.VarChar, 255), new OleDbParameter("@p_jsr", OleDbType.VarChar, 255), new OleDbParameter("@DataType", OleDbType.Integer, 4), new OleDbParameter("@RemarkInfo", OleDbType.VarChar, 255), new OleDbParameter("@ID", OleDbType.Integer, 4) }; parameters[0].Value = model.p_date; parameters[1].Value = model.p_cpmc; parameters[2].Value = model.p_ggxh; parameters[3].Value = model.p_clmc; parameters[4].Value = model.p_ph; parameters[5].Value = model.p_dw; parameters[6].Value = model.p_sl1; parameters[7].Value = model.p_mjph; parameters[8].Value = model.p_zzs; parameters[9].Value = model.p_zczh; parameters[10].Value = model.p_gys; parameters[11].Value = model.p_sl2; parameters[12].Value = model.p_jsr; parameters[13].Value = model.DataType; parameters[14].Value = model.RemarkInfo; parameters[15].Value = model.ID; int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
private string TotalMoney(GouJinInfo _goujinInfo) { string strReturnValue = "0.00"; try { int _Number = _goujinInfo.p_sl1.Value; double _price = Convert.ToDouble(_goujinInfo.p_sl2); double TotalValue = _price * _Number; strReturnValue = TotalValue.ToString("n"); } catch (Exception ex) { } return strReturnValue; }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(KPS.Model.GouJinInfo model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(KPS.Model.GouJinInfo model) { return(dal.Add(model)); }
/// <summary> /// 得到一个对象实体 /// </summary> public KPS.Model.GouJinInfo DataRowToModel(DataRow row) { KPS.Model.GouJinInfo model = new KPS.Model.GouJinInfo(); if (row != null) { if(row["ID"]!=null && row["ID"].ToString()!="") { model.ID=int.Parse(row["ID"].ToString()); } if(row["p_date"]!=null && row["p_date"].ToString()!="") { model.p_date=DateTime.Parse(row["p_date"].ToString()); } if(row["p_cpmc"]!=null) { model.p_cpmc=row["p_cpmc"].ToString(); } if(row["p_ggxh"]!=null) { model.p_ggxh=row["p_ggxh"].ToString(); } if(row["p_clmc"]!=null) { model.p_clmc=row["p_clmc"].ToString(); } if(row["p_ph"]!=null) { model.p_ph=row["p_ph"].ToString(); } if(row["p_dw"]!=null) { model.p_dw=row["p_dw"].ToString(); } if(row["p_sl1"]!=null && row["p_sl1"].ToString()!="") { model.p_sl1=int.Parse(row["p_sl1"].ToString()); } if(row["p_mjph"]!=null) { model.p_mjph=row["p_mjph"].ToString(); } if(row["p_zzs"]!=null) { model.p_zzs=row["p_zzs"].ToString(); } if(row["p_zczh"]!=null) { model.p_zczh=row["p_zczh"].ToString(); } if(row["p_gys"]!=null) { model.p_gys=row["p_gys"].ToString(); } if(row["p_sl2"]!=null) { model.p_sl2=row["p_sl2"].ToString(); } if(row["p_jsr"]!=null) { model.p_jsr=row["p_jsr"].ToString(); } if(row["DataType"]!=null) { model.DataType=Convert.ToInt32(row["DataType"]); } if (row["RemarkInfo"] != null) { model.RemarkInfo=row["RemarkInfo"].ToString(); } } return model; }
/// <summary> /// 诊断试剂购进信息编辑 /// </summary> /// <param name="_GJModel"></param> public ZDSJGJ(GouJinInfo _GJModel) { _ThisModel = _GJModel; InitializeComponent(); }