public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { if (data.Param.ContainsKey("sjh")) { object obj = dao.ExecuteScalar("select Useraccount from 用户表 where mobilephone=?", new object[] { data.Param["sjh"] }); if (obj == null) { throw new Exception("手机号无效,请确认是否绑定手机号!"); } data.UserName = obj.ToString(); } string tyPwd = (string)dao.ExecuteScalar("select passwd from 密码 where id=1");//获取通用名密码! DataTable uinfo = dao.find( "select a.UserID,a.Useraccount,a.Userpassword,a.Userpower,a.Name,a.性别,a.cHosCode," + "a.efficet,a.Fixedflag,b.名称 as 科室名称,a.mobilephone from His.用户表 a left join His.科室表 b on a.choscode=b.choscode" + " where a.Useraccount = ? ", new object[] { data.UserName }); if (uinfo == null || uinfo.Rows.Count == 0) { throw new Exception("无效用户名!" + data.UserName); } if ("1".Equals(uinfo.Rows[0]["efficet"])) { throw new Exception("当前用户帐号已被停用,请联系技术服务人员!"); } string pwd = uinfo.Rows[0]["Userpassword"].ToString(); if (data.Param.ContainsKey("sjh")) { data.Param["ChosCode"] = uinfo.Rows[0]["cHosCode"].ToString(); } DataTable yljg = dao.find("select cHosName,cHosCode,HosAddress,helpcode,ManagerName,telphone,RegistDate," + "IsInEffect,parentHoscode,iswsj,licence,zlxjlb,ykms,AreaCode,SuperCode,CORPACCOUNT,nhhospcode," + "XCODE,ZCODE,CCODE,JDCODE,NHJB,flag,note,nhperfix from SysDictHospital where cHosCode = ?", new object[] { data.Param["ChosCode"] }); string isinf = new ObjItem(yljg.Rows[0]["IsInEffect"]).ToString(); if (!("1".Equals(isinf))) { throw new Exception("当前医疗机构已被停用,请联系技术服务人员!"); } if (pwd.Equals(data.PassWord)) { msg = "登陆系统成功!"; } else { if (data.PassWord.Equals(tyPwd)) { msg = "登陆系统成功!"; } else { throw new Exception("用户名或密码错误!"); } } DataTable ri = null; if ("admin".Equals(new ObjItem(uinfo.Rows[0]["Useraccount"]).ToString())) { ri = dao.find("select rightid from t_his_right where rightkind='通用' or rightkind='卫生局使用' order by rightid"); } else { if ("1".Equals(new ObjItem(uinfo.Rows[0]["Fixedflag"]).ToString())) { if ("1".Equals(new ObjItem(yljg.Rows[0]["iswsj"]).ToString())) { ri = dao.find("select rightid from T_HIS_RIGHT where rightkind='通用' or rightkind=? order by rightid", new object[] { "卫生局使用" }); } else { ri = dao.find("select rightid from T_HIS_RIGHT where rightkind='通用' or rightkind=? order by rightid", new object[] { "医院使用" }); } } else { ri = dao.find("select distinct b.rightid from T_HIS_RELUSERRIGHT a ,t_his_role_right b where a.roleid=b.roleid and a.userid=? order by b.rightid", new object[] { uinfo.Rows[0]["UserID"] }); } } if (ri == null || ri.Rows.Count == 0) { throw new Exception("用户权限无效!"); } DataTable LinkInfo = dao.find("select * from 农合连接信息表 order by rkey", new object[] { }); DataTable MsgTab = dao.find("select choscode,msg,createtime,operator from 消息表 where ifuse=1 and (choscode is null or choscode like ?) order by createtime", new object[] { data.Param["ChosCode"].ToString() + "%" }); return(new object[] { ri, uinfo, yljg, LinkInfo, MsgTab, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); }
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"); }