public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { if (data.Sql != null && data.Sql.Equals("Del")) { int count = DaoTool.ExecuteScalar(dao, OptContent.get("XmIsSy"), data).ToInt(); if (count > 0) { throw new Exception("项目信息已经被系统使用,不能删除!"); } if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DelXmInfo"), data) < 0) { throw new Exception("删除项目信息失败!"); } msg = "项目信息已删除!"; return("ok"); } else if (data.Sql != null && data.Sql.Equals("CheckNHCode")) { msg = "项目信息已删除!"; return("ok"); } else { Opt op = OptContent.get("SaveXmInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { /* if (DaoTool.ExecuteNonQuery(dao, OptContent.get("UpdateZYCFMXInfo"), data) < 0) * { * throw new Exception("更新住院处方明细失败!"); * } * if (DaoTool.ExecuteNonQuery(dao, OptContent.get("UpdateMZCFMXInfo"), data) < 0) * { * throw new Exception("更新门诊处方明细失败!"); * } */ msg = "保存项目信息成功!"; return("ok"); } else { throw new Exception("保存项目信息失败!"); } } else { data.Param[op.Key] = DaoTool.ExecuteScalar(dao, OptContent.get("XmiInfo_seq"), data).ToInt() + 1; if (DaoTool.Save(dao, op, data) > -1) { msg = "保存项目信息成功!"; return("ok"); } else { throw new Exception("保存项目信息失败!"); } } } }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { if (data.Sql != null && data.Sql.Equals("Delete")) { Opt opt = OptContent.get("DeleteEQKind"); if (DaoTool.ExecuteNonQuery(dao, opt, data) < 0) { throw new Exception("删除设备类别信息失败!" + dao.ErrMsg); } msg = "设备类别已删除"; return("ok"); } if (data.Sql != null && data.Sql.Equals("Save")) { Opt opt = OptContent.get("SaveSetEQDetail"); if (DaoTool.Save(dao, opt, data) > -1) { msg = "设置管理的设备类别成功!"; return("ok"); } else { throw new Exception("设置管理的设备类别失败" + dao.ErrMsg); } } else { throw new Exception("设置管理的设备类别失败" + dao.ErrMsg); } }
bool saveRunDetail(YiTian.db.Dao dao, YtService.data.OptData data) { List <Dictionary <string, object> > mxli = ObjConvert.GetParamsByStr(data.Param["DanJuMx"].ToString()); Opt opt2 = OptContent.get("SaveEQOutDetailInfo"); foreach (Dictionary <string, object> d in mxli) { //d["DETAILNO"] = DaoTool.Seq(dao, "LKWZ.SEQWZInDetail"); d["OUTID"] = data.Param["OUTID"]; d["EQID"] = d["设备ID"]; d["UNITCODE"] = d["单位编码"]; d["GG"] = d["规格"]; d["XH"] = d["型号"]; d["CD"] = d["产地"]; d["NUM"] = d["数量"]; d["PRICE"] = d["单价"]; d["MONEY"] = d["金额"]; d["OTHERMONEY"] = d["运杂费"]; d["TOTALPRICE"] = d["成本单价"]; d["TOTALMONEY"] = d["成本金额"]; d["SUPPLYID"] = d["生产厂家ID"]; d["SUPPLYNAME"] = d["生产厂家"]; d["STOCKFLOWNO"] = d["库存流水号"]; d["PRODUCTDATE"] = Convert.ToDateTime(d["生产日期"]); d["VALIDDATE"] = Convert.ToDateTime(d["有效期"]); d["MEMO"] = d["备注"]; d["TXM"] = d["条形码"]; d["CHOSCODE"] = data.Param["CHOSCODE"]; if (!d["流水号"].ToString().Equals("")) { d["DETAILNO"] = d["流水号"].ToString(); if (DaoTool.Update(dao, opt2, d) < 0) { throw new Exception("保存单据明细失败!"); } } else { d["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQOutDetail"); if (DaoTool.Save(dao, opt2, d) < 0) { throw new Exception("保存单据明细失败!"); } } } return(true); }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { if (data.Sql == null) { msg = "无效的SQL参数,不能继续执行操作!"; return("ok"); } if (data.Sql.Equals("ModifyOrAddInfo")) { if (data.Param["DEPREID"] == null || data.Param["DEPREID"].ToString() == "") { //新增 data.Param["DEPREID"] = DaoTool.Seq(dao, "LKEQ.SEQEQDepre"); if (DaoTool.Save(dao, OptContent.get("SaveEQDepreciationInfo_EQDepreciation"), data) > -1) { saveRunDetail(dao, data);//2代表新增 msg = "执行成功!"; return("ok"); } else { msg = "执行失败!"; throw new Exception("新增折旧主表信息失败!" + dao.ErrMsg); } } else { //修改 if (DaoTool.Update(dao, OptContent.get("SaveEQDepreciationInfo_EQDepreciation"), data) > -1) { saveRunDetail(dao, data); } else { msg = "执行失败!"; throw new Exception("修改折旧主表信息失败!" + dao.ErrMsg); } } msg = "执行成功!"; return("ok"); } else { msg = "系统出错,请与管理员联系!"; return("ok"); } }
bool savePlanDetail(YiTian.db.Dao dao, YtService.data.OptData data) { List <Dictionary <string, object> > mxli = ObjConvert.GetParamsByStr(data.Param["DanJuMx"].ToString()); Opt opt2 = OptContent.get("SaveEQPlanDetailInfo"); foreach (Dictionary <string, object> d in mxli) { //d["DETAILNO"] = DaoTool.Seq(dao, "LKWZ.SEQWZInDetail"); d["PLANID"] = data.Param["PLANID"]; d["APPLYID"] = d["请购ID"]; d["EQID"] = d["设备ID"]; d["EQNAME"] = d["设备名称"]; d["GG"] = d["规格"]; d["XH"] = d["型号"]; d["XH"] = d["型号"]; d["COUNTRY"] = d["国别"]; d["UNITCODE"] = d["单位编码"]; d["NOWNUM"] = d["当前库存数量"]; d["NUM"] = d["采购数量"]; d["PRICE"] = d["采购单价"]; d["MONEY"] = d["采购金额"]; d["SCS"] = d["生产商"]; d["GYS"] = d["供应商"]; d["MEMO"] = d["备注"]; d["TXM"] = d["条形码"]; d["CHOSCODE"] = data.Param["CHOSCODE"]; d["STOCKFLOWNO"] = d["对应的库存流水表的流水号"]; if (!d["行号"].ToString().Equals("")) { d["ROWNO"] = d["行号"].ToString(); if (DaoTool.Update(dao, opt2, d) < 0) { throw new Exception("保存单据明细失败!"); } } else { object rw = dao.Es(OptContent.get("EQGetROWNO").Sql, new object[] { data.Param["PLANID"] }); //data.Param["ROWNO"] = Convert.ToDecimal(rw) + 1; d["ROWNO"] = Convert.ToDecimal(rw) + 1; if (DaoTool.Save(dao, opt2, d) < 0) { throw new Exception("添加单据明细失败!"); } } } return(true); }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { string A = data.Sql; Opt op = OptContent.get("SaveYPGYSInfo"); if ("Del".Equals(A)) { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DelGhDwInfo"), data) < 0) { throw new Exception("删除供货商信息失败!"); } msg = "供货商信息已删除!"; return("ok"); } else if ("Save".Equals(A)) { if (DaoTool.ExecuteScalar(dao, OptContent.get("HaveGhDwInfo"), data).ToInt() > 0) { throw new Exception("编号为【" + data.Param["编号"].ToString() + "】的单位已经存在!"); } if (DaoTool.Save(dao, op, data) > -1) { msg = "保存成功!"; return("ok"); } else { throw new Exception("保存失败!"); } } else if ("Update".Equals(A)) { if (DaoTool.Update(dao, op, data) > -1) { msg = "保存成功!"; return("ok"); } else { throw new Exception("保存失败!"); } } msg = "ok"; return("ok"); }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { if (data.Sql != null && data.Sql.Equals("Del")) { int count = DaoTool.ExecuteScalar(dao, OptContent.get("YaoPingIsSy"), data).ToInt(); if (count > 0) throw new Exception("药品已经被系统使用,不能删除!"); if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DelYaoPingInfo"), data) < 0) { throw new Exception("删除药品信息失败!"); } msg = "药品已删除!"; return "ok"; } else { Opt op = OptContent.get("SaveYPDictInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { msg = "保存项目信息成功!"; return "ok"; } else { throw new Exception("保存项目信息失败!"+dao.ErrMsg); } } else { data.Param["药品编码"] = DaoTool.ExecuteScalar(dao, OptContent.get("SaveYPDictInfo_seq"), data).ToInt() + 1; if (DaoTool.Save(dao, op, data) > -1) { msg = "保存药品信息成功"; return "ok"; } else { throw new Exception("保存药品信息失败!" + dao.ErrMsg); } } } }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { #region 针对删除 //针对删除 if (data.Sql != null && data.Sql.Equals("Del")) { //验证是否在其他表中被使用 if (DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveUseEQWareInfo"), data).ToInt() > 0) { msg = "库房被使用,不能被删除,只能进行停用操作!"; return("ok"); } Opt op = OptContent.get("DelEQInfo"); if (DaoTool.ExecuteNonQuery(dao, op, data) > 0) { msg = "库房删除成功"; return("ok"); } else { throw new Exception("库房删除失败" + dao.ErrMsg); } } #endregion #region 针对停用 //针对停用 if (data.Sql != null && data.Sql.Equals("Disa")) { Opt op = OptContent.get("SaveEQInfo"); if (data.Param.ContainsValue(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { msg = "停用库房信息成功!"; return("ok"); } else { throw new Exception("停用库房信息失败!" + dao.ErrMsg); } } } #endregion #region 针对启用 //针对启用 if (data.Sql != null && data.Sql.Equals("Enab")) { Opt op = OptContent.get("SaveEQInfo"); if (data.Param.ContainsValue(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { msg = "启用库房信息成功"; return("ok"); } else { throw new Exception("启用库房信息失败!" + dao.ErrMsg); } } } #endregion //针对保存 if (data.Sql != null && data.Sql.Equals("Save")) { Opt op = OptContent.get("SaveEQInfo"); //感觉就是一个小陷阱,原来是value 如果为修改 if (data.Param.ContainsValue(op.Key)) { //更新设备库房信息 string kd = "0"; int repeat = DaoTool.ExecuteScalar(dao, OptContent.get("ModifyEQInfoIsRepeat"), data).ToInt(); if (repeat > 0) { msg = "已经存在该库房信息,不能修改成该名称!"; return("ok"); } //判断是否存在该类别编码([DICTEQWAREDETAIL]) kindcode [如果存在则置为1] int tr = DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveEQkindcode"), data).ToInt(); if (tr > 0) { kd = "1"; } if (DaoTool.Update(dao, op, data) > -1) { msg = kd + "," + "保存库房信息成功!"; return("ok"); } else { throw new Exception("保存库房信息失败!" + dao.ErrMsg); } } else { //增加设备库房信息 string wd = null; int repeat = DaoTool.ExecuteScalar(dao, OptContent.get("AddEQInfoIsRepeat"), data).ToInt();//添加时 名字是否重复了 if (repeat > 0) { msg = "已经存在该库房信息!"; return("ok"); } int warecode_int = DaoTool.ExecuteScalar(dao, OptContent.get("SaveEQInfo_seq"), data).ToInt() + 1;//+1是新增一个 if (warecode_int == 100) { msg = "库房已满,不能继续添加!"; return("ok"); } //用于转化库房编码,当库房编码小于10,则前面添加0 wd是将库房编码返回去? if (warecode_int >= 0 && warecode_int < 10) { data.Param["warecode"] = "0" + warecode_int.ToString(); wd = "0" + warecode_int.ToString(); } else { data.Param["warecode"] = warecode_int.ToString(); wd = warecode_int.ToString(); } if (DaoTool.Save(dao, op, data) > -1) { msg = wd + "," + "添加成功";//作为返回 return("ok"); } else { throw new Exception("添加库房信息失败!" + dao.ErrMsg); } } } else { throw new Exception("保存设备信息失败!" + dao.ErrMsg); } }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { if (data.Sql != null && data.Sql.Equals("UpdateEQStock")) { if (DaoTool.Update(dao, OptContent.get("SaveEQStockInfo"), data) > -1) { msg = "保存库存信息成功!"; return("ok"); } else { throw new Exception("保存库存信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("SaveEQStock")) { data.Param["STOCKID"] = DaoTool.Seq(dao, "LKEQ.SEQEQStock");; if (DaoTool.Save(dao, OptContent.get("SaveEQStockInfo"), data) < 0) { // msg = flowno+'+'+DETAILNO; throw new Exception("添加物资库存总表信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("RuKuDanEQdelete")) { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DeleteEQInDetailInfo"), data) < 0) { throw new Exception("删除入库物资信息失败!"); } if (DaoTool.Update(dao, OptContent.get("SaveEQInMainInfo"), data) < 0) { throw new Exception("保存入库信息失败!" + dao.ErrMsg); } msg = "删除入库物资信息成功!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("RuKuDanDelete")) { data.Param["STATUS"] = 0; if (DaoTool.Update(dao, OptContent.get("SaveEQInMainInfo"), data) > -1) { msg = "删除入库信息成功!"; return("ok"); } else { throw new Exception("删除入库信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("RuKuDanUpdate")) { Opt op = OptContent.get("SaveEQInMainInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { // saveRunDetail(dao, data); if (data.Param["STATUS"].ToString() == "2") { msg = "审核信息成功!"; } else if (data.Param["STATUS"].ToString() == "1") { msg = "提交审核入库信息成功!"; } else if (data.Param["STATUS"].ToString() == "6") { msg = "审核入库信息成功!"; } else { msg = "入库成功!"; } return("ok"); } else { throw new Exception("保存入库信息失败!" + dao.ErrMsg); } } } if (data.Sql != null && data.Sql.Equals("CXData")) { Opt op = OptContent.get("SaveEQInMainInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { msg = "冲销成功!"; } else { throw new Exception("保存入库信息失败!" + dao.ErrMsg); } } Dictionary <string, object> dic1 = new Dictionary <string, object>(); dic1["INID"] = data.Param["INID"].ToString(); dic1["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); Opt op1 = OptContent.get("EQInMainInfo_CX"); Dictionary <string, object> dic = DaoTool.Get(dao, op1, dic1); dic["INID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIn"); dic["STATUS"] = 7; dic["TOTALMONEY"] = "-" + dic["TOTALMONEY"].ToString(); dic["INVOICEMONEY"] = "-" + dic["INVOICEMONEY"].ToString(); dic["OTHERMONEY"] = "-" + dic["OTHERMONEY"].ToString(); Opt op2 = OptContent.get("SaveEQInMainInfo"); if (DaoTool.Save(dao, OptContent.get("SaveEQInMainInfo"), dic) > -1)//生成入库主表 { Opt op3 = OptContent.get("EQInDetailInfo_CX"); List <Dictionary <string, object> > lst = DaoTool.Find(dao, op3, data); if (lst != null) { foreach (Dictionary <string, object> dc in lst) { dc["NUM"] = "-" + dc["NUM"].ToString(); dc["MONEY"] = "-" + dc["MONEY"].ToString(); dc["OTHERMONEY"] = "-" + dc["OTHERMONEY"].ToString(); dc["TOTALPRICE"] = "-" + dc["TOTALPRICE"].ToString(); dc["TOTALMONEY"] = "-" + dc["TOTALMONEY"].ToString(); dc["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQInDetail"); dc["INID"] = dic["INID"]; Opt opt4 = OptContent.get("SaveEQInDetailInfo"); if (DaoTool.Save(dao, opt4, dc) < 0) //生成入库细表 { throw new Exception("保存单据明细失败!"); } Dictionary <string, object> dic2 = new Dictionary <string, object>(); Opt op5 = OptContent.get("EQIn_SearchEQStockNum"); Dictionary <string, object> dic3 = new Dictionary <string, object>(); dic3 = DaoTool.Get(dao, op5, dc); dic2["NUM"] = Convert.ToInt32(dic3["NUM"].ToString()) + Convert.ToInt32(dc["NUM"].ToString()); dic2["STOCKID"] = dic3["STOCKID"].ToString(); if (DaoTool.Update(dao, OptContent.get("SaveEQStockInfo"), dic2) > -1)//修改库存总表 { Dictionary <string, object> dic4 = new Dictionary <string, object>(); dic4["FLOWNO"] = dc["STOCKFLOWNO"]; dic4["NUM"] = dc["NUM"]; Opt op6 = OptContent.get("SaveEQStockDetailInfo"); if (DaoTool.Update(dao, op6, dic4) > -1)//修改库存细表 { } else { throw new Exception("保存设备库存流水信息失败!" + dao.ErrMsg); } } else { throw new Exception("保存库存信息失败!" + dao.ErrMsg); } } } } else { throw new Exception("保存入库单据失败!"); } msg = "冲销成功!"; return(msg); } if (data.Sql != null && data.Sql.Equals("SaveEQStockDetail")) { Opt op = OptContent.get("SaveEQStockDetailInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { msg = "保存设备库存流水信息成功!"; return("ok"); } else { throw new Exception("保存设备库存流水信息失败!" + dao.ErrMsg); } } else { data.Param["FLOWNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQStockDetail"); string flowno = data.Param["FLOWNO"].ToString(); string DETAILNO = data.Param["DETAILNO"].ToString(); if (DaoTool.Save(dao, op, data) < 0) { // msg = flowno+'+'+DETAILNO; throw new Exception("保存物资库存流水信息失败!" + dao.ErrMsg); } //更新入库细表中的对应库存流水号 //YtService.data.OptData d = new YtService.data.OptData(); //d.Param["STOCKFLOWNO"] = data.Param["FLOWNO"]; //d.Param["DETAILNO"] = data.Param["DETAILNO"]; //if (DaoTool.Update(dao, OptContent.get("SaveWZInDetailInfo"), d) < 0) //{ // throw new Exception("更新入库细表信息失败!" + dao.ErrMsg); //} return(msg = flowno + '+' + DETAILNO); } } if (data.Sql != null && data.Sql.Equals("UpdateEQInDetailInfo")) { if (DaoTool.Update(dao, OptContent.get("SaveEQInDetailInfo"), data) < 0) { throw new Exception("更新入库细表信息失败!" + dao.ErrMsg); } msg = "保存成功!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("RuKuDanSave")) { Opt op = OptContent.get("SaveEQInMainInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { saveRunDetail(dao, data); msg = "保存入库信息成功!"; return("ok"); } else { throw new Exception("保存入库信息失败!" + dao.ErrMsg); } } else { DataTable dt = dao.Fd(OptContent.get("EQSearchDicEQInOut").Sql, new object[] { data.Param["IOID"].ToString() }); data.Param["OPFLAG"] = dt.Rows[0]["OPFLAG"].ToString(); data.Param["INID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIn"); string recipe = dt.Rows[0]["RECIPECODE"].ToString(); if (Convert.ToDecimal(dt.Rows[0]["RECIPEYEAR"]) == 1) { recipe += DateTime.Now.Year.ToString(); } if (Convert.ToDecimal(dt.Rows[0]["RECIPEMONTH"]) == 1) { if (DateTime.Now.Month < 10) { recipe = recipe + "0" + DateTime.Now.Month.ToString(); } else { recipe += DateTime.Now.Month.ToString(); } } decimal recipeno = Convert.ToDecimal(dao.ExecuteScalar(OptContent.get("EQGetRecipeNo").Sql, new object[] { recipe + '%' })) + 1; if (recipeno > 0 && recipeno < 10) { recipe = recipe + "0" + recipeno.ToString(); } else { recipe = recipe + recipeno.ToString(); } data.Param["RECIPECODE"] = recipe; data.Param["INDATE"] = DateTime.Now; data.Param["STATUS"] = 1; if (DaoTool.Save(dao, OptContent.get("SaveEQInMainInfo"), data) > -1) { saveRunDetail(dao, data); } else { throw new Exception("保存入库单据失败!"); } } } msg = "保存成功!"; return("ok"); }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { string ac = data.Sql; msg = ""; if ("EditPwd".Equals(ac)) { DataTable dt = dao.find("select a.userpassword from 用户表 a where a.userid=? and a.choscode=? " , new object[] { data.Param["UserId"], data.Param["cHosCode"] } ); if (dt == null || dt.Rows.Count == 0) { throw new Exception("用户无效!"); } string pd = ""; if (dt.Rows[0][0] != null) { pd = dt.Rows[0][0].ToString(); } if (!data.Param["oldPwd"].ToString().Equals(pd)) { throw new Exception("原密码错误!"); } if (data.Param.ContainsKey("sjh")) { object obj1 = dao.ExecuteScalar("select count(*) from 用户表 a where a.mobilephone=?" , new object[] { data.Param["sjh"] } ); if (int.Parse(obj1.ToString()) > 0) { throw new Exception("您输入的手机号已被其他用户绑定,请重新输入!"); } int i = dao.ExecuteNonQuery("update 用户表 set mobilephone=? where userid=? and choscode=?" , new object[] { data.Param["sjh"], data.Param["UserId"], data.Param["cHosCode"] } ); if (i < 0) { throw new Exception("帮定手机号失败!"); } } int b = dao.ExecuteNonQuery("update 用户表 set userpassword=? where userid=? and choscode=?" , new object[] { data.Param["Pwd"], data.Param["UserId"], data.Param["cHosCode"] } ); if (b < 0) { throw new Exception("修改用户密码失败!"); } msg = "修改密码成功!"; } else if ("RegCardSet".Equals(ac)) { if (!data.Param.ContainsKey("密码")) { throw new Exception("输入的密码无效请重新输入!"); } string pwd = data.Param["密码"].ToString(); object p = dao.ExecuteScalar("select passwd from 密码 where id=4"); if (p != null) { if (!p.ToString().Equals(pwd)) { throw new Exception("输入的密码无效请重新输入!"); } } else { throw new Exception("输入的密码无效请重新输入!"); } DataTable dt = dao.find("select 1 from 就诊卡范围表 where (开始号 between ? and ? or 结束号 between ? and ?) and length(开始号)=?" , new object[] { data.Param["开始号"], data.Param["结束号"], data.Param["开始号"], data.Param["结束号"], data.Param["长度"] } ); if (dt != null && dt.Rows.Count > 0) { throw new Exception("输入的就诊卡号已被领用过,请重新录入号码"); } Opt op = OptContent.get("sys_SaveRegCard"); if (DaoTool.Save(dao, op, data) > -1) { msg = "保存就诊卡数据成功!"; } else { throw new Exception("就诊卡领用失败"); } } else if ("SaveOpLog".Equals(ac)) { if (dao.ExecuteNonQuery("insert into 特殊操作日志(choscode,chosname,操作功能,操作员,操作机器,辅助说明) values('" + data.Param["choscode"].ToString() + "','" + data.Param["chosname"].ToString() + "'," + data.Param["funID"].ToString() + ",'" + data.Param["username"].ToString() + "','" + data.Param["hostinfo"].ToString() + "','" + data.Param["说明"].ToString() + "')") < 0) { throw new Exception("保存操作日志错误." + dao.ErrMsg); } else { msg = "ok"; } } return("ok"); }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { msg = "请购信息"; Dictionary <string, object> pa = new Dictionary <string, object>(); string ac = data.Sql; //ObjItem Obj,Obj1,Obj2,Obj3,Obj4; if ("SaveEQAskBuyInfo".Equals(ac)) { pa["DEPTID"] = Convert.ToDecimal(data.Param["DEPTID"]); pa["EQID"] = Convert.ToDecimal(data.Param["EQID"]); pa["EQNAME"] = data.Param["EQNAME"].ToString(); pa["COUNTRY"] = data.Param["COUNTRY"].ToString(); pa["UNITCODE"] = data.Param["UNITCODE"].ToString(); pa["APPLYNUM"] = Convert.ToDecimal(data.Param["APPLYNUM"]); if (data.Param["YJPRICE"] != null && data.Param["YJPRICE"].ToString().Trim().Length > 0) { pa["YJPRICE"] = Math.Round(Convert.ToDecimal(data.Param["YJPRICE"]), 2); } else { pa["YJPRICE"] = null; } pa["YJMONEY"] = Math.Round(Convert.ToDecimal(data.Param["YJMONEY"]), 2); pa["PLANDATE"] = Convert.ToDateTime(data.Param["PLANDATE"]); pa["STATUS"] = Convert.ToDecimal(data.Param["STATUS"]); pa["USERID"] = Convert.ToDecimal(data.Param["USERID"]); pa["RECDATE"] = DateTime.Now; pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); if (data.Param["GG"] != null) { pa["GG"] = data.Param["GG"].ToString(); } else { pa["GG"] = null; } if (data.Param["XH"] != null) { pa["XH"] = data.Param["XH"].ToString(); } else { pa["XH"] = null; } if (data.Param["REASON"] != null) { pa["REASON"] = data.Param["REASON"].ToString(); } else { pa["REASON"] = null; } if (data.Param["XYFX"] != null) { pa["XYFX"] = data.Param["XYFX"].ToString(); } else { pa["XYFX"] = null; } if (data.Param["PTTJ"] != null) { pa["PTTJ"] = data.Param["PTTJ"].ToString(); } else { pa["PTTJ"] = null; } if (data.Param["MEMO"] != null) { pa["MEMO"] = data.Param["MEMO"].ToString(); } else { pa["MEMO"] = null; } if (data.Param["USERNAME"] != null) { pa["USERNAME"] = data.Param["USERNAME"].ToString(); } else { pa["USERNAME"] = null; } if (data.Param["APPLYID"] == null) { pa["APPLYID"] = DaoTool.Seq(dao, "LKEQ.SEQEQApply"); Opt saveInfo = OptContent.get("SaveEQAskBuyInfo"); if (DaoTool.Save(dao, saveInfo, pa) < 0) { throw new Exception("添加请购信息失败!"); } msg = "添加成功!"; return("ok"); } else { pa["APPLYID"] = Convert.ToDecimal(data.Param["APPLYID"]); Opt updataInfo = OptContent.get("UpdataEQAskBuyInfo"); if (DaoTool.ExecuteNonQuery(dao, updataInfo, pa) < 0) { throw new Exception("修改请购信息失败!"); } msg = "修改成功!"; return("ok"); } } if ("DelEQAskBuyInfo".Equals(ac)) { pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["APPLYID"] = Convert.ToDecimal(data.Param["APPLYID"]); pa["STATUS"] = 0; Opt Del = OptContent.get("DelEQAskBuyInfo"); if (DaoTool.ExecuteNonQuery(dao, Del, pa) < 0) { throw new Exception("删除请购信息失败!"); } msg = "删除成功!"; return("ok"); } if ("Submit_EQAskBuyInfo".Equals(ac)) { pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["APPLYID"] = Convert.ToDecimal(data.Param["APPLYID"]); pa["STATUS"] = 1; Opt Del = OptContent.get("Submit_EQAskBuyInfo"); if (DaoTool.ExecuteNonQuery(dao, Del, pa) < 0) { throw new Exception("提交请购信息失败!"); } msg = "提交成功!"; return("ok"); } if ("EQAskBuyInfo_SHCG".Equals(ac)) { Opt stop = OptContent.get("EQAskBuyInfo_SHCG"); pa["APPLYID"] = Convert.ToDecimal(data.Param["APPLYID"]); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["SHNUM"] = Convert.ToDecimal(data.Param["SHNUM"]); pa["RECDATE"] = DateTime.Now; pa["SHDATE"] = Convert.ToDateTime(data.Param["SHDATE"]); pa["SHUSERID"] = Convert.ToDecimal(data.Param["SHUSERID"]); pa["STATUS"] = 6; if (data.Param["SHUSERNAME"] != null) { pa["SHUSERNAME"] = data.Param["SHUSERNAME"].ToString(); } else { pa["SHUSERNAME"] = null; } if (DaoTool.ExecuteNonQuery(dao, stop, pa) < 0) { throw new Exception("审核操作失败!"); } msg = "审核操作成功!"; return("ok"); } if ("EQAskBuyInfo_SHSB".Equals(ac)) { Opt start = OptContent.get("EQAskBuyInfo_SHSB"); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["APPLYID"] = Convert.ToDecimal(data.Param["APPLYID"]); pa["STATUS"] = 2; if (DaoTool.ExecuteNonQuery(dao, start, pa) < 0) { throw new Exception("审核操作失败!"); } msg = "审核操作成功!"; return("ok"); } return("ok"); }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { if (data.Sql != null && data.Sql.Equals("TingYong")) { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("QiTingEQInOutInfo_EQInOutManag"), data) > 0) { msg = "停用该条设备入出库记录成功!"; return("ok"); } else { throw new Exception("停用该条设备入出库信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("QiYong")) { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("QiTingEQInOutInfo_EQInOutManag"), data) > 0) { msg = "启用该条设备入出库记录成功!"; return("ok"); } else { throw new Exception("启用该条设备入出库记录失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("Del")) { if (DaoTool.ExecuteScalar(dao, OptContent.get("IfHaveUseEQInOut"), data).ToInt() > 0) { msg = "该条设备入出库记录已被使用,无法删除!"; return("ok"); } if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DelEQInOutInfo_EQInOutManag"), data) > 0) { msg = "删除该条设备入出库记录成功!"; return("ok"); } else { throw new Exception("删除该条设备入出库记录失败!" + dao.ErrMsg); } } //----------------------------------这里的代码有些重复,有时间再进行复用操作【关键是msg 这里怎么办?】------------------------------- if (data.Sql != null && data.Sql.Equals("Modify")) { //惯例: 名称是否重复 // 相同的医疗机构编码、入出标志、操作标志的记录里,只能有一条记录的该值为1 if (DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveRepeatInOutName"), data).ToInt() > 0) { msg = "存在相同的设备入出库名称,请修改后再进行操作"; return("ok"); } //MessageBox.Show("执行到修改2"); if (data.Param["IFDEFAULT"].ToString() == "1" && DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveMoreDefault_EQInOutManag"), data).ToInt() > 0) { msg = "相同的医疗机构编码、入出标志、操作标志的记录里,只能有一条记录的默认值为是!"; return("ok"); } //MessageBox.Show("执行到修改3"); //验证:对于一个医疗机构来说,其操作类别为(1:调拨;2:申领;3:盘点)的出入库类型记录 //其入库和出库的类型记录,分别各有且只能有一条记录; //如医疗机构甲,其调拨的入库方式,只能有一种方式,其调拨的出库方式,也只能有一种方式; if (data.Param["OPFLAG"].ToString() != "0" && DaoTool.ExecuteScalar(dao, OptContent.get("IsSingleInOutOfCHOS"), data).ToInt() > 0) { //针对1,2,3 msg = "操作为调拨,申领,盘点的记录,其出库与入库的记录只能各有一条,请修改后再进行操作"; return("ok"); } //MessageBox.Show("执行到修改4"); if (DaoTool.Update(dao, OptContent.get("SaveEQInOutInfo"), data) < 0) { throw new Exception("修改该条设备入出库记录失败!"); } msg = "修改该条设备入出库记录成功!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("Add")) { //首先设置好ID: data.Param["IOID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIO"); //验证是否重名 if (DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveRepeatInOutName"), data).ToInt() > 0) { msg = "存在相同的设备入出库名称,请修改后再进行操作"; return("ok"); } if (data.Param["IFDEFAULT"].ToString() == "1" && DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveMoreDefault_EQInOutManag"), data).ToInt() > 0) { msg = "相同的医疗机构编码、入出标志、操作标志的记录里,只能有一条记录的默认值为是!"; return("ok"); } if (data.Param["OPFLAG"].ToString() != "0" && DaoTool.ExecuteScalar(dao, OptContent.get("IsSingleInOutOfCHOS"), data).ToInt() > 0) { //针对1,2,3 msg = "操作为调拨,申领,盘点的记录,其出库与入库的记录只能各有一条,请修改后再进行操作"; return("ok"); } if (DaoTool.Save(dao, OptContent.get("SaveEQInOutInfo"), data) < 0) { throw new Exception("新增设备入出库记录失败!"); } msg = "新增设备入出库记录成功!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("CopyChoscodeData")) { //验证本机构是否包含数据 int count = DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveAnyDataEQInOut_EQInOutManag"), data).ToInt(); if (count == 0) { DataTable dt = DaoTool.FindDT(dao, OptContent.get("FindEQInOutcode0_EQInOutManag"), data); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow r in dt.Rows) { int statuscode_int = DaoTool.ExecuteScalar(dao, OptContent.get("GetEQInOutIDMax"), data).ToInt() + 1; data.Param["IOID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIO"); data.Param["IONAME"] = r["IONAME"]; data.Param["PYCODE"] = r["PYCODE"]; data.Param["WBCODE"] = r["WBCODE"]; data.Param["IFUSE"] = r["IFUSE"]; data.Param["RECIPECODE"] = r["RECIPECODE"]; data.Param["RECIPELENGTH"] = r["RECIPELENGTH"]; data.Param["RECIPEYEAR"] = r["RECIPEYEAR"]; data.Param["RECIPEMONTH"] = r["RECIPEMONTH"]; data.Param["MEMO"] = r["MEMO"]; data.Param["IOFLAG"] = r["IOFLAG"]; data.Param["OPFLAG"] = r["OPFLAG"]; data.Param["IFDEFAULT"] = r["IFDEFAULT"]; data.Param["RECDATE"] = DateTime.Now; if (DaoTool.Save(dao, OptContent.get("SaveEQInOutInfo"), data) < 0) { throw new Exception("复制失败!" + dao.ErrMsg); } } } msg = "复制成功!"; return("ok"); } else { msg = "已存在本医疗结构的出入类型,复制失败!"; return("ok"); } } else { msg = "系统故障,请与管理员联系!"; return("ok"); } }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { if (data.Sql == null) { throw new Exception("SQL参数为空!"); } if (data.Sql.Equals("ModifyZhuInfo")) { if (DaoTool.Update(dao, OptContent.get("SaveEQCardRecInfo"), data) < 0) { msg = "执行失败!"; throw new Exception("设备卡片记录表更新失败!" + dao.ErrMsg); } //更新对应的设备数目 DaoTool.ExecuteNonQuery(dao, OptContent.get("UpdateCardNumInCardInfo"), data); msg = "执行成功!"; return("ok"); } if (data.Sql.Equals("ModifyCCInfo")) { if (data.Param["IsUpdateCC"].ToString() == "1") { if (DaoTool.Update(dao, OptContent.get("SaveEQCardCCInfo"), data) < 0) { throw new Exception("设备财产记录表更新失败!" + dao.ErrMsg); } } else { if (DaoTool.Save(dao, OptContent.get("SaveEQCardCCInfo"), data) < 0) { throw new Exception("设备财产记录表新增失败!" + dao.ErrMsg); } } msg = "执行成功!"; return("ok"); } if (data.Sql.Equals("ModifySMInfo")) { if (data.Param["IsUpdateSM"].ToString() == "1") { if (DaoTool.Update(dao, OptContent.get("SaveEQCardSMInfo"), data) < 0) { throw new Exception("设备说明记录表更新失败!" + dao.ErrMsg); } } else { if (DaoTool.Save(dao, OptContent.get("SaveEQCardSMInfo"), data) < 0) { throw new Exception("设备说明记录表新增失败!" + dao.ErrMsg); } } msg = "执行成功!"; return("ok"); } if (data.Sql.Equals("ModifyFJInfo")) { if (data.Param["IsUpdateFJ"].ToString() == "1") { if (DaoTool.Update(dao, OptContent.get("SaveEQCardFJInfo"), data) < 0) { throw new Exception("设备附件记录表更新失败!" + dao.ErrMsg); } } else { //若为新增,则 行号需要改变 // data.Param.Remove("IsUpdateFJ"); data.Param["ROWNO"] = DaoTool.ExecuteScalar(dao, OptContent.get("FindRowNoInFJ"), data).ToInt() + 1; if (DaoTool.Save(dao, OptContent.get("SaveEQCardFJInfo"), data) < 0) { throw new Exception("设备附件记录表新增失败!" + dao.ErrMsg); } } msg = "执行成功!"; return("ok"); } if (data.Sql.Equals("ModifyJLInfo")) { if (data.Param["IsUpdateJL"].ToString() == "1") { if (DaoTool.Update(dao, OptContent.get("SaveEQCardJLInfo"), data) < 0) { throw new Exception("设备计量记录表更新失败!" + dao.ErrMsg); } } else { data.Param["ROWNO"] = DaoTool.ExecuteScalar(dao, OptContent.get("FindRowNoInFJ"), data).ToInt() + 1; if (DaoTool.Save(dao, OptContent.get("SaveEQCardJLInfo"), data) < 0) { throw new Exception("设备计量记录表新增失败!" + dao.ErrMsg); } } msg = "执行成功!"; return("ok"); } //前面全部为修改部分 下面开始处理新增部分 if (data.Sql.Equals("AddZhuInfo")) { // if(data.Param["IsFlag"]!=null||data.Param["IsFlag"].ToString()="") data.Param["CARDID"] = DaoTool.Seq(dao, "LKEQ.SEQEQCardUse"); CardId = Convert.ToInt32(data.Param["CARDID"]); string Prefix = dao.Es("SELECT PREFIX FROM LKEQ.DICTEQKIND WHERE CHOSCODE=" + data.Param["CHOSCODE"].ToString() + " AND KINDCODE=(SELECT KINDCODE FROM LKEQ.DICTEQ WHERE EQID=" + data.Param["EQID"].ToString() + " AND CHOSCODE=" + data.Param["CHOSCODE"].ToString() + ")").ToString().ToUpper(); int LengthG = Convert.ToInt32(dao.Es("SELECT DISTINCT SYSVALUE FROM HIS.系统参数 WHERE ID=2206"));//长度 //可以直接这样搜索是前缀一样,比较的是后面的数字 object MaxFirst = dao.Es("SELECT MAX(CARDCODE) FROM LKEQ.EQCARDREC WHERE EQID=" + data.Param["EQID"].ToString() + " AND CHOSCODE=" + data.Param["CHOSCODE"].ToString() + " AND CARDCODE LIKE " + "'%" + Prefix + "%'"); string Max; if (MaxFirst == null) { Max = "1"; } else { Max = MaxFirst.ToString(); if (Max.Contains(Prefix)) { Max = ((Convert.ToInt64(Max.Substring(Max.LastIndexOf(Prefix) + Prefix.Length))) + 1).ToString(); } else { Max = "1"; } } data.Param["CARDCODE"] = Prefix + 0.ToString("D" + (LengthG - Max.Length)) + Max; if (DaoTool.Save(dao, OptContent.get("SaveEQCardRecInfo"), data) < 0) { throw new Exception("设备卡片主表新增失败!" + dao.ErrMsg); } //同样的更新数目到库存流水表 DaoTool.ExecuteNonQuery(dao, OptContent.get("UpdateCardNumInCardInfo"), data); msg = "执行成功!"; return("ok"); // } if (data.Sql.Equals("AddJLInfo")) { data.Param["CARDID"] = CardId; data.Param["ROWNO"] = DaoTool.ExecuteScalar(dao, OptContent.get("FindRowNoInFJ"), data).ToInt() + 1; if (DaoTool.Save(dao, OptContent.get("SaveEQCardJLInfo"), data) < 0) { throw new Exception("设备计量信息新增失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } if (data.Sql.Equals("AddCCInfo")) { data.Param["CARDID"] = CardId; if (DaoTool.Save(dao, OptContent.get("SaveEQCardCCInfo"), data) < 0) { throw new Exception("设备财产信息新增失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } if (data.Sql.Equals("AddFJInfo")) { data.Param["CARDID"] = CardId; data.Param["ROWNO"] = DaoTool.ExecuteScalar(dao, OptContent.get("FindRowNoInFJ"), data).ToInt() + 1; if (DaoTool.Save(dao, OptContent.get("SaveEQCardFJInfo"), data) < 0) { throw new Exception("设备附件信息新增失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } if (data.Sql.Equals("AddSMInfo")) { data.Param["CARDID"] = CardId; if (DaoTool.Save(dao, OptContent.get("SaveEQCardSMInfo"), data) < 0) { throw new Exception("设备说明信息新增失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } else { throw new Exception("系统出错,请与管理员联系!"); } }