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.Param.ContainsKey("dicgrpid")) { if (DaoTool.Update(dao, OptContent.get("SaveDictGrounp"), data) > 0) { msg = "更新成功!"; return("ok"); } else { throw new Exception("保存失败!"); } } else { int i = DaoTool.ExecuteScalar(dao, OptContent.get("GetMaxDictGrounpId"), data).ToInt() + 1; data.Param["dicgrpid"] = i; if (DaoTool.Save(dao, OptContent.get("SaveDictGrounp"), data) > 0) { msg = "保存成功!"; return("ok"); } else { throw new Exception("保存失败!"); } } }
/* * public static string getNextDJHId(string id) * { * if (id.Length != 12) * { * return null; * } * string t = id.Substring(0, 2); * id = id.Substring(2); * * long num = long.Parse(id); * string next = (num + 1) + ""; * StringBuilder sbf = new StringBuilder(); * for (int i = 0; i < (10 - next.Length); i++) * { * sbf.Append("0"); * } * sbf.Append(next); * * return t+ sbf.ToString(); * } * * public static string getNextId2(string id,int l) * { * if (id.Length <2) * { * return null; * } * string t = id.Substring(0, 2); * id = id.Substring(2); * * long num = long.Parse(id); * string next = (num + 1) + ""; * StringBuilder sbf = new StringBuilder(); * for (int i = 0; i < (l-2 - next.Length); i++) * { * sbf.Append("0"); * } * sbf.Append(next); * * return t + sbf.ToString(); * } */ /// <summary> /// 获取住院号 /// </summary> /// <param name="dao"></param> /// <param name="data"></param> /// <returns></returns> public static string getZyNextNum(Dao dao, YtService.data.OptData data) { Dictionary <string, object> gz = DaoTool.Get(dao, OptContent.get("ZY_GetDJHGZ"), data); if (gz == null) { gz = new Dictionary <string, object>(); gz["前缀规则"] = "YYYYMM"; gz["主体是否补零"] = "0"; gz["主体长度"] = "5"; gz["起始号"] = null; } string d = ""; try { string qz = getPrestring(gz["前缀规则"].ToString()); string qsh = ""; if (gz["起始号"] != null) { qsh = gz["起始号"].ToString(); } qsh = qsh.Trim(); int ztlength = new ObjItem(gz["主体长度"]).ToInt(); if (ztlength == 0) { ztlength = 5; } data.Param["住院号"] = qz + "%"; data.Param["length"] = qz.Length + ztlength; d = DaoTool.ExecuteScalar(dao, OptContent.get("ZY_GetMaxDJH"), data).ToString(); if (d == null) { d = qz + getBegin(qsh, gz["前缀规则"].ToString(), ztlength, gz["主体是否补零"].ToString()); } else { if (isLowBegin(d, qsh, gz["前缀规则"].ToString())) { d = qz + getBegin(qsh, gz["前缀规则"].ToString(), ztlength, gz["主体是否补零"].ToString()); } else { d = qz + getMaxpre(d, gz["前缀规则"].ToString(), ztlength, gz["主体是否补零"].ToString()); } } } catch { d = ""; } return(d); }
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) { msg = "缺省SQL参数,无法继续进行操作!"; return("ok"); } if (data.Sql.Equals("ModifyOrAddZhu")) { //只有当新增主表的时候才需要生成对应的recipecode if (data.Param["RECIPECODE"] == null || data.Param["RECIPECODE"].ToString() == "") { DataTable dt = DaoTool.FindDT(dao, OptContent.get("GetRecipeCodeInEQOutInfo"), data); if (dt.Rows.Count <= 0 || dt == null) { throw new Exception("无法查找到单据前缀" + dao.ErrMsg); } DataRow row = dt.Rows[0]; data.Param["RECIPECODE"] = Recipecode(row["RECIPECODE"].ToString(), Convert.ToInt32(row["RECIPEYEAR"]), Convert.ToInt32(row["RECIPEMONTH"]), Convert.ToInt32(row["RECIPELENGTH"])); data.Param.Add("RECIPECODEHelp", data.Param["RECIPECODE"].ToString() + "%"); data.Param["RECIPECODE"] = data.Param["RECIPECODE"] + DaoTool.ExecuteScalar(dao, OptContent.get("GetrecipeCodeNo"), data).ToInt().ToString("D2"); } if (data.Param["OUTID"] == null || data.Param["OUTID"].ToString() == "") { data.Param["OUTID"] = DaoTool.Seq(dao, "LKEQ.SEQEQOut"); OutIdHelp = data.Param["OUTID"].ToString(); if (DaoTool.Save(dao, OptContent.get("ModifyOutMainInfo"), data) < 0) { msg = "执行失败!"; throw new Exception("新增设备领用的主表信息失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } if (DaoTool.Update(dao, OptContent.get("ModifyOutMainInfo"), data) < 0) { msg = "执行失败!"; throw new Exception("修改设备领用的出库主表信息失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } if (data.Sql.Equals("ModifyOrAddXi")) { //如果出库Id为空的话,肯定操作为新增,肯定都是新增的细表行。 首先获取生成的主表OUTID if (data.Param["OUTID"] == null || data.Param["OUTID"].ToString() == "") { data.Param["OUTID"] = OutIdHelp; data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQOutDetail"); if (DaoTool.Save(dao, OptContent.get("ModifyOutXiBiaoInfo"), data) < 0) { msg = "执行失败!"; throw new Exception("修改设备领用的出库细表失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } else//操作为修改 { if (data.Param["DETAILNO"] == null || data.Param["DETAILNO"].ToString().Trim() == "") { //为新增的数据 新增完之后返回 data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQOutDetail"); if (DaoTool.Save(dao, OptContent.get("ModifyOutXiBiaoInfo"), data) < 0) { msg = "执行失败!"; throw new Exception("修改设备领用的出库细表失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } if (DaoTool.Update(dao, OptContent.get("ModifyOutXiBiaoInfo"), data) < 0) { msg = "执行失败!"; throw new Exception("修改设备领用的出库细表失败!" + dao.ErrMsg); } msg = "执行成功!"; //能够retrun ok 说明 要么是前面新增的对了,要么是后面的修改正确,不然都是throw出去 return("ok"); } } if (data.Sql.Equals("SHOutMainInfo")) { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("UpdateStatusInLingYong"), data) < 0) { msg = "执行失败!"; throw new Exception("更新审核状态失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } //===================================审核部分===================================== //入库主表 if (data.Sql.Equals("InsertInMain")) { data.Param["INID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIN"); InIdHelp = data.Param["INID"].ToString(); DataTable dt = DaoTool.FindDT(dao, OptContent.get("GetRecipeCodeInEQOutInfo"), data); if (dt.Rows.Count <= 0 || dt == null) { throw new Exception("无法查找到单据前缀" + dao.ErrMsg); } DataRow row = dt.Rows[0]; data.Param["RECIPECODE"] = Recipecode(row["RECIPECODE"].ToString(), Convert.ToInt32(row["RECIPEYEAR"]), Convert.ToInt32(row["RECIPEMONTH"]), Convert.ToInt32(row["RECIPELENGTH"])); data.Param.Add("RECIPECODEHelp", data.Param["RECIPECODE"].ToString() + "%"); data.Param["RECIPECODE"] = data.Param["RECIPECODE"] + DaoTool.ExecuteScalar(dao, OptContent.get("GetrecipeCodeNo"), data).ToInt().ToString("D2"); RecipeCodeInMain = data.Param["RECIPECODE"].ToString(); SHDHHelp = data.Param["SHDH"]; SUPPLYIDHelp = data.Param["SUPPLYID"]; SUPPLYNAMEHelp = data.Param["SUPPLYNAME"]; if (DaoTool.Save(dao, OptContent.get("SaveEQInMainInfoCX"), data) < 0) { msg = "执行失败!"; throw new Exception("入库主表的信息插入失败!" + dao.ErrMsg); } //更新对应生成的INID至当前的出库主表 dao.ExecuteNonQuery("UPDATE LKEQ.EQOUTMAIN SET INID=" + data.Param["INID"].ToString() + " WHERE CHOSCODE=" + data.Param["CHOSCODE"] + " AND OUTID=" + data.Param["OUTID"].ToString()); msg = "执行成功!"; return("ok"); } //入库细表 if (data.Sql != null && data.Sql.Equals("InsertEQInDetail")) { data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQINDETAIL"); InDetailNoHelp = data.Param["DETAILNO"].ToString(); data.Param["INID"] = InIdHelp; if (DaoTool.Save(dao, OptContent.get("SaveEQInDetail"), data) < 0) { msg = "执行失败!"; throw new Exception("入库细表信息执行失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } //库存主表 可能不会执行 【只有在库存主表,不存在该设备的信息】 if (data.Sql != null && data.Sql.Equals("InsertStockMain")) { data.Param["STOCKID"] = DaoTool.Seq(dao, "LKEQ.SEQEQSTOCK"); //在每执行一次对库存总表的插入,都会更新一次stockid,否则,就是针对 一个stockid的插入流水 StockIdHelp = data.Param["STOCKID"].ToString(); if (DaoTool.Save(dao, OptContent.get("SaveEQStock"), data) < 0) { msg = "执行失败!"; throw new Exception("库存主表信息执行失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } //库存流水 if (data.Sql != null && data.Sql.Equals("InsertStockDetail")) { data.Param["FLOWNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQSTOCKDETAIL"); data.Param["INID"] = InIdHelp; data.Param["RECIPECODE"] = RecipeCodeInMain; data.Param["SHDH"] = SHDHHelp; data.Param["GHSUPPLYID"] = SUPPLYIDHelp; data.Param["GHSUPPLYNAME"] = SUPPLYNAMEHelp; if (data.Param["STOCKID"] == null || data.Param["STOCKID"].ToString() == "") { data.Param["STOCKID"] = StockIdHelp; } if (DaoTool.Save(dao, OptContent.get("SaveEQStockDetail"), data) < 0) { msg = "执行失败!"; throw new Exception("库存流水信息执行失败!" + dao.ErrMsg); } //更新至入库细表 dao.ExecuteNonQuery("UPDATE LKEQ.EQINDETAIL SET STOCKFLOWNO=" + data.Param["FLOWNO"].ToString() + " WHERE CHOSCODE=" + data.Param["CHOSCODE"] + " AND DETAILNO=" + InDetailNoHelp); msg = "执行成功!"; return("ok"); } //冲销操作================================================================================= if (data.Sql != null && data.Sql.Equals("ChongXiaoRuChu")) { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("ChongXiaoChuKuStatusChange"), data) < 0) { msg = "执行失败!"; throw new Exception("修改出库主表冲销状态失败!" + dao.ErrMsg); } if (DaoTool.ExecuteNonQuery(dao, OptContent.get("ChongXiaoRuKuStatusChange"), data) < 0) { msg = "执行失败!"; throw new Exception("修改入库主表冲销状态失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } //插入出库主表 if (data.Sql != null && data.Sql.Equals("ChongXiaoZhuChuKu")) { data.Param["OUTID"] = DaoTool.Seq(dao, "LKEQ.SEQEQOut"); OutIdCXHelp = data.Param["OUTID"].ToString(); if (DaoTool.Save(dao, OptContent.get("ModifyOutMainInfo"), data) < 0) { msg = "执行失败!"; throw new Exception("插入冲销出库主表失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } //出库细表 if (data.Sql != null && data.Sql.Equals("ChongXiaoXiChuKu")) { data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQOutDetail"); data.Param["OUTID"] = OutIdCXHelp; if (DaoTool.Save(dao, OptContent.get("ModifyOutXiBiaoInfo"), data) < 0) { msg = "执行失败!"; throw new Exception("插入冲销出库细表失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } //入库主表 if (data.Sql != null && data.Sql.Equals("ChongXiaoZhuRuKu")) { data.Param["INID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIN"); InIdCXHelp = data.Param["INID"].ToString(); if (DaoTool.Save(dao, OptContent.get("SaveEQInMainInfoCX"), data) < 0) { throw new Exception("插入冲销入库主表失败!" + dao.ErrMsg); } dao.ExecuteNonQuery("UPDATE LKEQ.EQOUTMAIN SET INID=" + data.Param["INID"].ToString() + " WHERE CHOSCODE= " + data.Param["CHOSCODE"].ToString() + " AND OUTID=" + OutIdCXHelp); msg = "执行成功!"; return("ok"); } //入库细表 if (data.Sql != null && data.Sql.Equals("ChongXiaoXiRuKu")) { data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQINDETAIL"); data.Param["INID"] = InIdCXHelp; if (DaoTool.Save(dao, OptContent.get("SaveEQInDetail"), data) < 0) { throw new Exception("插入冲销细表失败!" + dao.ErrMsg); } 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 && data.Sql.Equals("Del")) { int ifuse = DaoTool.ExecuteScalar(dao, OptContent.get("EQUnitIsUse2"), data).ToInt(); if (ifuse > 0) { //throw new Exception("物资单位已经被系统使用,不能删除!"); msg = "设备单位已经被系统使用,不能删除!"; return("ok"); } int rw = DaoTool.ExecuteNonQuery(dao, OptContent.get("DelEQUnitInfo"), data); if (rw < 0) { throw new Exception("删除设备单位信息失败!"); } msg = "设备单位已删除!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("Save")) { Opt op = OptContent.get("SaveEQUnitInfo"); if (data.Param.ContainsValue(op.Key)) { int repeat = DaoTool.ExecuteScalar(dao, OptContent.get("ModifyEQUnitIsRepeat"), data).ToInt(); if (repeat > 0) { //throw new Exception("已经存在该物资价格体系信息,不能修改成该名称!" + dao.ErrMsg); msg = "已经存在该设备项目信息,不能修改成该名称!"; return("ok"); } int tr = DaoTool.ExecuteScalar(dao, OptContent.get("DefaultEQUnit"), data).ToInt(); if ((data.Param["DEFVALUE"].ToString() == "1") && tr > 0) { data.Params = new object[] { data.Param["DICGRPID"], data.Param["DICID"] }; dao.ExecuteNonQuery(OptContent.get("SetDefaultEQUnit").Sql, data.Params); } if (DaoTool.Update(dao, op, data) > -1) { msg = "保存设备单位信息成功!"; return("ok"); } else { throw new Exception("保存设备单位信息失败!" + dao.ErrMsg); } } else { int repeat = DaoTool.ExecuteScalar(dao, OptContent.get("AddEQUnitIsRepeat"), data).ToInt(); if (repeat > 0) { //throw new Exception("已经存在该物资价格体系信息!" + dao.ErrMsg); msg = "已经存在该设备项目信息!"; return("ok"); } int dicid_int = DaoTool.ExecuteScalar(dao, OptContent.get("SaveEQUnitInfo_seq"), data).ToInt() + 1; //if (dicid_int >= 0 && dicid_int < 10) //{ // data.Param["DICID"] = "0" + dicid_int.ToString(); //} //else //{ // data.Param["DICID"] = dicid_int.ToString(); //} //int tr = DaoTool.ExecuteScalar(dao, OptContent.get("DefaultWZUnit"), data).ToInt(); data.Param["DICID"] = dicid_int.ToString(); if ((data.Param["DEFVALUE"].ToString() == "1") && DaoTool.ExecuteScalar(dao, OptContent.get("DefaultEQUnit"), data).ToInt() > 0) { data.Params = new object[] { data.Param["DICGRPID"], data.Param["DICID"] }; dao.ExecuteNonQuery(OptContent.get("SetDefaultEQUnit").Sql, data.Params); } if (DaoTool.Save(dao, op, data) > -1) { msg = "添加成功!"; 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) { //SysValueManag if (data.Sql == null) { throw new Exception("Sql内容为空!"); } else if (data.Sql.Equals("Del")) { int count = DaoTool.ExecuteScalar(dao, OptContent.get("InOutIsSy"), data).ToInt(); if (count > 0) { // throw new Exception("此入出类型已经被系统使用,不能删除!"); msg = "此入出类型已经被系统使用,不能删除!"; return("ok"); } if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DelInOutInfo"), data) < 0) { throw new Exception("删除此入出类型失败!"); } msg = "此入出类型已删除!"; return("ok"); } else if (data.Sql.Equals("Add")) { Opt op = OptContent.get("SaveInOutInfo"); data.Param["IOID"] = DaoTool.Seq(dao, "LKWZ.SEQWZIO");; data.Param["RECDATE"] = DateTime.Now; if (data.Param["IFDEFAULT"] != null && data.Param["IFDEFAULT"].ToString() == "1") { dao.ExecuteNonQuery("update LKWZ.DICTWZINOUT set IFDEFAULT=0 where CHOSCODE='" + data.Param["CHOSCODE"].ToString() + "' and IOFALG=" + data.Param["IOFLAG"].ToString() + " and OPFLAG=" + data.Param["OPFLAG"].ToString()); } if (DaoTool.Save(dao, op, data) > -1) { msg = "统计类别添加成功!"; return("ok"); } else { throw new Exception("统计类别添加失败!" + dao.ErrMsg); } } else if (data.Sql.Equals("Update")) { Opt op = OptContent.get("SaveInOutInfo"); data.Param["RECDATE"] = DateTime.Now; if (data.Param["IFDEFAULT"] != null && data.Param["IFDEFAULT"].ToString() == "1") { dao.ExecuteNonQuery("update LKWZ.DICTWZINOUT set IFDEFAULT=0 where CHOSCODE='" + data.Param["CHOSCODE"].ToString() + "'"); } if (DaoTool.Update(dao, op, data) > -1) { msg = "统计类别更新成功!"; return("ok"); } else { throw new Exception("统计类别更新失败!" + dao.ErrMsg); } } else if (data.Sql.Equals("TingYong")) { Opt op = OptContent.get("SetInOutUnUsed"); if (DaoTool.ExecuteNonQuery(dao, op, data) != 1) { throw new Exception("停用失败!" + dao.ErrMsg); } msg = "此入出类型停用成功!"; return("ok"); } else if (data.Sql.Equals("QiYong")) { Opt op = OptContent.get("SetInOutUsed"); if (DaoTool.ExecuteNonQuery(dao, op, data) != 1) { throw new Exception("启用失败!" + dao.ErrMsg); } msg = "此入出类型启用成功!"; return("ok"); } else if (data.Sql.Equals("Copy")) { int count = DaoTool.ExecuteScalar(dao, OptContent.get("CheckInOutIsNull"), data).ToInt(); if (count == 0) { DataTable dt = DaoTool.FindDT(dao, OptContent.get("FindInOutCcode0"), data); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow r in dt.Rows) { data.Param["IOID"] = DaoTool.Seq(dao, "LKWZ.SEQWZIO"); 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["USEST"] = r["USEST"]; data.Param["USEND"] = r["USEND"]; data.Param["USERD"] = r["USERD"]; data.Param["OPFLAG"] = r["OPFLAG"]; data.Param["IFDEFAULT"] = r["IFDEFAULT"]; data.Param["RECDATE"] = DateTime.Now; if (DaoTool.Save(dao, OptContent.get("SaveInOutInfo"), data) != 1) { throw new Exception("复制失败,!" + dao.ErrMsg); } } } msg = "复制成功!"; return("ok"); } else { msg = "已存在本医疗结构的出入类型,复制失败!"; return("ok"); } } else if (data.Sql.Equals("Find")) { msg = "查找成功!"; return("ok"); } msg = "成功!"; 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, Obj4; if ("SaveChangShangInfo".Equals(ac)) { pa["IFFACTORY"] = Convert.ToDecimal(data.Param["IFFACTORY"]); pa["IFSUPPLY"] = Convert.ToDecimal(data.Param["IFSUPPLY"]); pa["IFUSE"] = Convert.ToDecimal(data.Param["IFUSE"]); pa["USERID"] = Convert.ToDecimal(data.Param["USERID"]); pa["SUPPLYNAME"] = data.Param["SUPPLYNAME"].ToString(); pa["USERNAME"] = data.Param["USERNAME"].ToString(); pa["RECDATE"] = DateTime.Now; pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); if (data.Param["PYCODE"] != null) { pa["PYCODE"] = data.Param["PYCODE"].ToString(); } else { pa["PYCODE"] = null; } if (data.Param["WBCODE"] != null) { pa["WBCODE"] = data.Param["WBCODE"].ToString(); } else { pa["WBCODE"] = null; } if (data.Param["UNITPROPERTY"] != null) { pa["UNITPROPERTY"] = data.Param["UNITPROPERTY"].ToString(); } else { pa["UNITPROPERTY"] = null; } if (data.Param["QYDM"] != null) { pa["QYDM"] = data.Param["QYDM"].ToString(); } else { pa["QYDM"] = null; } if (data.Param["FRDB"] != null) { pa["FRDB"] = data.Param["FRDB"].ToString(); } else { pa["FRDB"] = null; } if (data.Param["UNITBANK"] != null) { pa["UNITBANK"] = data.Param["UNITBANK"].ToString(); } else { pa["UNITBANK"] = null; } if (data.Param["BANKACCOUNT"] != null) { pa["BANKACCOUNT"] = data.Param["BANKACCOUNT"].ToString(); } else { pa["BANKACCOUNT"] = null; } if (data.Param["ADDRESS"] != null) { pa["ADDRESS"] = data.Param["ADDRESS"].ToString(); } else { pa["ADDRESS"] = null; } if (data.Param["RELMAN"] != null) { pa["RELMAN"] = data.Param["RELMAN"].ToString(); } else { pa["RELMAN"] = null; } if (data.Param["RELPHONE"] != null) { pa["RELPHONE"] = data.Param["RELPHONE"].ToString(); } else { pa["RELPHONE"] = null; } if (data.Param["POST"] != null) { pa["POST"] = data.Param["POST"].ToString(); } else { pa["POST"] = null; } if (data.Param["FAX"] != null) { pa["FAX"] = data.Param["FAX"].ToString(); } else { pa["FAX"] = null; } if (data.Param["JYXKZ"] != null) { pa["JYXKZ"] = data.Param["JYXKZ"].ToString(); } else { pa["JYXKZ"] = null; } if (data.Param["YYZZ"] != null) { pa["YYZZ"] = data.Param["YYZZ"].ToString(); } else { pa["YYZZ"] = null; } if (data.Param["MEMO"] != null) { pa["MEMO"] = data.Param["MEMO"].ToString(); } else { pa["MEMO"] = null; } if (data.Param["TAXCODE"] != null) { pa["TAXCODE"] = data.Param["TAXCODE"].ToString(); } else { pa["TAXCODE"] = null; } if (data.Param["SUPPLYID"] == null)//新增 { pa["SUPPLYID"] = DaoTool.Seq(dao, "LKEQ.SEQEQSUPPLY"); Opt saveInfo = OptContent.get("EQSaveChangShangInfo"); Opt name = OptContent.get("EQSaveChangShangInfo_Name"); Obj = DaoTool.ExecuteScalar(dao, name, pa); if (!Obj.IsNull) { msg = "名称重复!"; return("ok"); } if (DaoTool.Save(dao, saveInfo, pa) < 0) { throw new Exception("添加厂商信息失败!"); } msg = "添加成功!"; return("ok"); } else //修改 { pa["SUPPLYID"] = Convert.ToDecimal(data.Param["SUPPLYID"]); Opt updataInfo = OptContent.get("EQUpdataChangShangInfo"); Opt updataname = OptContent.get("EQUpdataChangShangInfo_Name"); Obj = DaoTool.ExecuteScalar(dao, updataname, pa); if (!Obj.IsNull) { msg = "名称重复!"; return("ok"); } if (DaoTool.ExecuteNonQuery(dao, updataInfo, pa) < 0) { throw new Exception("修改厂商信息失败!"); } msg = "修改成功!"; return("ok"); } } if ("EQDelChangShangInfo".Equals(ac)) { Opt Del = OptContent.get("EQDelChangShangInfo"); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["IFUSE"] = Convert.ToDecimal(data.Param["IFUSE"]); pa["SUPPLYID"] = data.Param["SUPPLYID"].ToString(); Opt values1 = OptContent.get("EQDelChangShangInfo_Use1"); Opt values2 = OptContent.get("EQDelChangShangInfo_Use2"); //Opt values3 = OptContent.get("EQDelChangShangInfo_Use3"); Opt values4 = OptContent.get("EQDelChangShangInfo_Use4"); Obj1 = DaoTool.ExecuteScalar(dao, values1, pa); Obj2 = DaoTool.ExecuteScalar(dao, values2, pa); //Obj3 = DaoTool.ExecuteScalar(dao, values3, pa);|| !Obj3.IsNull Obj4 = DaoTool.ExecuteScalar(dao, values4, pa); if (!Obj1.IsNull || !Obj2.IsNull || !Obj4.IsNull) { msg = "不能删除已使用的厂商,只能停用!"; return("ok"); } // //DaoTool. //if (Obj.ToString()=="1") //{ // msg = "已使用过,不能删除只能停用!"; // return "ok"; //} //string values1 = LData.Es("DelChangShangInfo_Use1", "LKWZ", new object[] { dr["厂商ID"], His.his.Choscode }); //string values2 = LData.Es("DelChangShangInfo_Use2", null, new object[] { dr["厂商ID"], His.his.Choscode }); //string values3 = LData.Es("DelChangShangInfo_Use3", null, new object[] { dr["厂商ID"], His.his.Choscode }); //string values4 = LData.Es("DelChangShangInfo_Use4", null, new object[] { dr["厂商ID"], His.his.Choscode }); if (DaoTool.ExecuteNonQuery(dao, Del, pa) < 0) { throw new Exception("删除厂商信息失败!"); } msg = "删除成功!"; return("ok"); } if ("StopWZSupplyInfo".Equals(ac)) { Opt stop = OptContent.get("EQStartOrStopChangShangInfo"); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["SUPPLYID"] = data.Param["SUPPLYID"].ToString(); pa["IFUSE"] = 0; if (DaoTool.ExecuteNonQuery(dao, stop, pa) < 0) { throw new Exception("停用厂商信息失败!"); } msg = "停用成功!"; return("ok"); } if ("StartWZSupplyInfo".Equals(ac)) { Opt start = OptContent.get("EQStartOrStopChangShangInfo"); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["SUPPLYID"] = data.Param["SUPPLYID"].ToString(); pa["IFUSE"] = 1; 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) { msg = "维修类别信息"; Dictionary <string, object> pa = new Dictionary <string, object>(); string ac = data.Sql; ObjItem Obj, Obj1; if ("SaveDateDivideInfo".Equals(ac)) { pa["DATENAME"] = data.Param["DATENAME"].ToString(); pa["USERID"] = Convert.ToDecimal(data.Param["USERID"]); pa["USERNAME"] = data.Param["USERNAME"].ToString(); pa["RECDATE"] = DateTime.Now; pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["BEGINDATE"] = DateTime.Parse(Convert.ToDateTime(data.Param["BEGINDATE"]).ToString("yyyy-MM-dd")); pa["ENDDATE"] = DateTime.Parse(Convert.ToDateTime(data.Param["ENDDATE"]).ToString("yyyy-MM-dd")); if (data.Param["MEMO"] != null) { pa["MEMO"] = data.Param["MEMO"].ToString(); } else { pa["MEMO"] = null; } if (data.Param["DATEID"] == null)//新增 { Opt saveInfo_REPAIRCODE = OptContent.get("EQSaveDateDivideInfo_ID"); Obj = DaoTool.ExecuteScalar(dao, saveInfo_REPAIRCODE, pa); if (Obj.IsNull) { pa["DATEID"] = 1; } else { pa["DATEID"] = Obj.ToInt() + 1; } Opt saveInfo = OptContent.get("EQSaveDateDivideInfo"); Opt name = OptContent.get("EQSaveDateDivideInfo_Name"); //Opt Date = OptContent.get("EQSaveDateDivideInfo_Date");//判断日期是否重复? Obj = DaoTool.ExecuteScalar(dao, name, pa); if (!Obj.IsNull) { msg = "名称重复!"; return("ok"); } if (DaoTool.Save(dao, saveInfo, pa) < 0) { throw new Exception("添加新的期间划分信息失败!"); } msg = "添加成功!"; return("ok"); } else //修改 { pa["DATEID"] = Convert.ToDecimal(data.Param["DATEID"]); Opt updataInfo = OptContent.get("EQUpdataDateDivideInfo"); Opt updataname = OptContent.get("EQUpdataDateDivideInfo_Name"); //Opt Date = OptContent.get("EQSaveDateDivideInfo_Date");//判断日期是否重复? Obj = DaoTool.ExecuteScalar(dao, updataname, pa); if (!Obj.IsNull) { msg = "名称重复!"; return("ok"); } if (DaoTool.ExecuteNonQuery(dao, updataInfo, pa) < 0) { throw new Exception("修改期间划分信息失败!"); } msg = "修改成功!"; return("ok"); } } if ("DelDateDivideInfo".Equals(ac)) { Opt Del = OptContent.get("DelDateDivideInfo"); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["DATEID"] = data.Param["DATEID"].ToString(); Opt values1 = OptContent.get("EQDelDateDivideInfo_Use1"); Obj1 = DaoTool.ExecuteScalar(dao, values1, pa); if (!Obj1.IsNull) { msg = "不能删除已使用的期间划分,只能停用!"; return("ok"); } if (DaoTool.ExecuteNonQuery(dao, Del, pa) < 0) { throw new Exception("删除期间划分失败!"); } msg = "删除成功!"; return("ok"); } return("ok"); }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { #region 前期的一些绑定 if (data.Sql == null) { msg = "缺省SQL参数,无法再服务端进行操作!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("BindWareName")) { msg = "绑定成功"; return(DaoTool.FindDT(dao, OptContent.get("FindWareNameInEQDiaoBo"), data)); } if (data.Sql != null && data.Sql.Equals("BindOutName")) { msg = "绑定成功"; return(DaoTool.FindDT(dao, OptContent.get("FindOutNameInEQDiaoBo"), data)); } if (data.Sql != null && data.Sql.Equals("BindUnitCode")) { msg = "绑定成功"; return(DaoTool.FindDT(dao, OptContent.get("FindUnitNameInEQDiaoBo"), data)); } if (data.Sql != null && data.Sql.Equals("BindEQIDInfo")) { msg = "绑定成功"; return(DaoTool.FindDT(dao, OptContent.get("FindEQIdNameInEQDiaoBo"), data)); } //包含 提交审核与软删除 if (data.Sql != null && data.Sql == "SubmitShenHeOrDel") { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("submitShenHeInfo"), data) < 0) { throw new Exception("更改设备调拨的审核状态信息失败!"); } msg = "执行成功!"; return("ok"); } #endregion //对主表的操作 if (data.Sql != null && data.Sql.Equals("ModifyZhuOrAdd")) { //1、对OUTMAIN进行更新操作 if (data.Param["RECIPECODE"] == null || data.Param["RECIPECODE"].ToString() == "") { DataTable dt = DaoTool.FindDT(dao, OptContent.get("GetRecipeCodeInEQOutInfo"), data); if (dt.Rows.Count <= 0 || dt == null) { throw new Exception("无法查找到单据前缀,是否调拨方式数据错误" + dao.ErrMsg); } DataRow row = dt.Rows[0]; data.Param["RECIPECODE"] = Recipecode(row["RECIPECODE"].ToString(), Convert.ToInt32(row["RECIPEYEAR"]), Convert.ToInt32(row["RECIPEMONTH"]), Convert.ToInt32(row["RECIPELENGTH"])); data.Param.Add("RECIPECODEHelp", data.Param["RECIPECODE"].ToString() + "%"); data.Param["RECIPECODE"] = data.Param["RECIPECODE"] + DaoTool.ExecuteScalar(dao, OptContent.get("GetrecipeCodeNo"), data).ToInt().ToString("D2"); } if (data.Param["OUTID"] == null || data.Param["OUTID"].ToString() == "") { data.Param["OUTID"] = DaoTool.Seq(dao, "LKEQ.SEQEQOut"); OutIdHelp = data.Param["OUTID"].ToString(); if (DaoTool.Save(dao, OptContent.get("ModifyOutMainInfo"), data) < 0) { msg = "执行失败!"; throw new Exception("新增设备调拨的主表信息失败!" + dao.ErrMsg); } SaveDiaoBoXiInfo(dao, data); msg = "执行成功!"; return("ok"); } if (DaoTool.Update(dao, OptContent.get("ModifyOutMainInfo"), data) < 0) { msg = "执行失败!"; throw new Exception("修改设备调拨的主表信息失败!" + dao.ErrMsg); } SaveDiaoBoXiInfo(dao, data); msg = "执行成功!"; return("ok"); } // ModifyOrAddXi if (data.Sql.Equals("ModifyOrAddXi")) { //如果出库ID为空的话 肯定是新增操作 if (data.Param["OUTID"].ToString().Trim() == "" || data.Param["OUTID"] == null) { data.Param["OUTID"] = OutIdHelp; data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQOutDetail"); if (DaoTool.Save(dao, OptContent.get("ModifyOutXiBiaoInfo"), data) < 0) { throw new Exception("修改设备调拨的出库细表失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } else { if (data.Param["DETAILNO"] == null || data.Param["DETAILNO"].ToString().Trim() == "") { //该行为新增的数据 新增完之后返回 data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQOutDetail"); if (DaoTool.Save(dao, OptContent.get("ModifyOutXiBiaoInfo"), data) < 0) { msg = "执行失败!"; throw new Exception("修改设备调拨的出库细表失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } if (DaoTool.Update(dao, OptContent.get("ModifyOutXiBiaoInfo"), data) < 0) { msg = "执行失败!"; throw new Exception("修改设备调拨的出库细表失败!" + dao.ErrMsg); } msg = "执行成功!"; //能够retrun ok 说明 要么是前面新增的对了,要么是后面的修改正确,不然都是throw出去 return("ok"); } } if (data.Sql != null && data.Sql.Equals("ShenHeOutEQInfo")) { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("ShenHeEQOutAndDetailInfo"), data) > 0) { msg = "执行成功!"; return("ok"); } else { msg = "执行失败!"; throw new Exception("审核过程中,数据库操作失败!" + dao.ErrMsg); } } if (data.Sql.Equals("SendOutId")) { OutId = data.Param["OUTID"].ToString(); msg = "执行成功!"; return("ok"); } //===================================审核部分=============================== //入库主表 if (data.Sql != null && data.Sql.Equals("InsertInMain")) { data.Param["INID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIN"); InIdHelp = data.Param["INID"].ToString(); DataTable dt = DaoTool.FindDT(dao, OptContent.get("GetRecipeCodeInEQOutInfo"), data); if (dt.Rows.Count <= 0 || dt == null) { throw new Exception("无法查找到单据前缀,是否调拨方式数据错误" + dao.ErrMsg); } DataRow row = dt.Rows[0]; data.Param["RECIPECODE"] = Recipecode(row["RECIPECODE"].ToString(), Convert.ToInt32(row["RECIPEYEAR"]), Convert.ToInt32(row["RECIPEMONTH"]), Convert.ToInt32(row["RECIPELENGTH"])); data.Param.Add("RECIPECODEHelp", data.Param["RECIPECODE"].ToString() + "%"); data.Param["RECIPECODE"] = data.Param["RECIPECODE"] + DaoTool.ExecuteScalar(dao, OptContent.get("GetrecipeCodeNo"), data).ToInt().ToString("D2"); //一次审核,只生成一次入库主表的单据号 RecipeCodeInMain = data.Param["RECIPECODE"].ToString(); if (DaoTool.Save(dao, OptContent.get("SaveEQInMainInfoCX"), data) < 0) { throw new Exception("入库主表信息执行失败" + dao.ErrMsg); } //记得更新对应出库主表的INID dao.ExecuteNonQuery("UPDATE LKEQ.EQOUTMAIN SET INID=" + data.Param["INID"].ToString() + " WHERE CHOSCODE=" + data.Param["CHOSCODE"] + " AND OUTID=" + OutId); msg = "执行成功!"; return("ok"); } //库存主表 可能不会执行 【只有在库存主表,不存在该设备的信息】 if (data.Sql != null && data.Sql.Equals("InsertStockMain")) { data.Param["STOCKID"] = DaoTool.Seq(dao, "LKEQ.SEQEQSTOCK"); //在每执行一次对库存总表的插入,都会更新一次stockid,否则,就是针对一个stockid的插入流水了 StockId = data.Param["STOCKID"].ToString(); if (DaoTool.Save(dao, OptContent.get("SaveEQStock"), data) < 0) { throw new Exception("库存主表信息执行失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } //库存流水 if (data.Sql != null && data.Sql.Equals("InsertStockDetail")) { data.Param["FLOWNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQSTOCKDETAIL"); StockFlowNo = data.Param["FLOWNO"].ToString(); data.Param["RECIPECODE"] = RecipeCodeInMain; if (data.Param["STOCKID"] == null || data.Param["STOCKID"].ToString() == "") { data.Param["STOCKID"] = StockId;//在客户端已经经过了判断,要么存在,要么不存在就是库存总表进行了新的插入,直接获取 } if (DaoTool.Save(dao, OptContent.get("SaveEQStockDetail"), data) < 0) { throw new Exception("库存流水信息执行失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } //入库细表 if (data.Sql != null && data.Sql.Equals("InsertEQInDetail")) { data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQINDETAIL"); data.Param["STOCKFLOWNO"] = StockFlowNo.ToString(); data.Param["INID"] = InIdHelp; if (DaoTool.Save(dao, OptContent.get("SaveEQInDetail"), data) < 0) { throw new Exception("入库细表信息执行失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } //=================================关于冲销的操作========================== //原始数据的状态更改 if (data.Sql != null && data.Sql.Equals("ChongXiaoRuChu")) { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("ChongXiaoChuKuStatusChange"), data) < 0) { throw new Exception("修改出库主表冲销状态失败!" + dao.ErrMsg); } data.Param.Add("INID", dao.Es("SELECT INID FROM LKEQ.EQOUTMAIN WHERE OUTID=" + data.Param["OUTID"].ToString()).ToString()); if (DaoTool.ExecuteNonQuery(dao, OptContent.get("ChongXiaoRuKuStatusChange"), data) < 0) { throw new Exception("修改入库主表冲销状态失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } //插入出库主表 if (data.Sql != null && data.Sql.Equals("ChongXiaoZhuChuKu")) { data.Param["OUTID"] = DaoTool.Seq(dao, "LKEQ.SEQEQOut"); OutIdCX = data.Param["OUTID"].ToString(); if (DaoTool.Save(dao, OptContent.get("ModifyOutMainInfo"), data) < 0) { throw new Exception("插入冲销出库主表失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } //出库细表 if (data.Sql != null && data.Sql.Equals("ChongXiaoXiChuKu")) { data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQOutDetail"); data.Param["OUTID"] = OutIdCX; if (DaoTool.Save(dao, OptContent.get("ModifyOutXiBiaoInfo"), data) < 0) { throw new Exception("插入冲销出库细表失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } //入库主表 if (data.Sql != null && data.Sql.Equals("ChongXiaoZhuRuKu")) { data.Param["INID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIN"); InIdCX = data.Param["INID"].ToString(); if (DaoTool.Save(dao, OptContent.get("SaveEQInMainInfoCX"), data) < 0) { throw new Exception("插入冲销入库主表失败!" + dao.ErrMsg); } dao.ExecuteNonQuery("UPDATE LKEQ.EQOUTMAIN SET INID=" + data.Param["INID"].ToString() + " WHERE CHOSCODE= " + data.Param["CHOSCODE"].ToString() + " AND OUTID=" + OutIdCX); msg = "执行成功!"; return("ok"); } //入库细表 if (data.Sql != null && data.Sql.Equals("ChongXiaoXiRuKu")) { data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQINDETAIL"); data.Param["INID"] = InIdCX; if (DaoTool.Save(dao, OptContent.get("SaveEQInDetail"), data) < 0) { throw new Exception("插入冲销细表失败!" + dao.ErrMsg); } msg = "执行成功!"; return("ok"); } else { msg = "系统错误,请与管理员进行联系!"; return("ok"); } }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { #region 停用,启用,删除 if (data.Sql != null && data.Sql.Equals("TingYong")) { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("QiTingEQStatus_EQStatusManag"), data) < 0) { throw new Exception("停用设备状态信息失败!" + dao.ErrMsg); } msg = "停用设备状态信息成功!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("QiYong")) { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("QiTingEQStatus_EQStatusManag"), data) < 0) { throw new Exception("启用设备状态信息失败!" + dao.ErrMsg); } msg = "启用设备状态信息成功!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("Del")) { //检查是否被其他表所使用,这里是EQCARDREC if (DaoTool.ExecuteScalar(dao, OptContent.get("IfHaveUseEQStatus"), data).ToInt() > 0) { msg = "该条设备状态信息被其他数据所使用,无法删除"; return("ok"); } //如果能够执行到这儿的话,说明不被其他数据所使用 if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DelEQStatusInfo"), data) > 0) { msg = "删除该条设备状态信息成功"; return("ok"); } else { throw new Exception("删除该条设备状态信息失败" + dao.ErrMsg); } } #endregion if (data.Sql != null && data.Sql.Equals("Add")) { //求状态编码[等于0 表示没有数据 且至少成功。] int statuscode_int = DaoTool.ExecuteScalar(dao, OptContent.get("GetStatusCodeMax_EQStatusManag"), data).ToInt() + 1; if (statuscode_int > 0 && statuscode_int < 10) { data.Param["STATUSCODE"] = "0" + statuscode_int.ToString(); } if (statuscode_int >= 100) { msg = "状态编码已满,不能继续添加!"; return("ok"); } if (statuscode_int >= 10 && statuscode_int < 100) { data.Param["STATUSCODE"] = statuscode_int.ToString(); } //判断名称是否重复 if (DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveRepetEQStatusName"), data).ToInt() > 0) { msg = "已经存在该状态名称,请修改后提交!"; return("ok"); } if (DaoTool.Save(dao, OptContent.get("SaveEQStatusInfo"), data) > -1) { msg = "增加设备状态信息成功!"; return("ok"); } else { throw new Exception("增加设备状态信息失败" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("Modify")) { //判断名称是否重复 if (DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveRepetEQStatusName"), data).ToInt() > 0) { msg = "已经存在该状态名称,请修改后提交!"; return("ok"); } if (DaoTool.Update(dao, OptContent.get("SaveEQStatusInfo"), data) > -1) { msg = "修改设备状态信息成功!"; return("ok"); } else { throw new Exception("修改设备状态信息失败" + dao.ErrMsg); } } else { msg = "系统错误,请与管理员取得联系!"; 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; if ("SaveFixKindInfo".Equals(ac)) { pa["IFDEFAULT"] = Convert.ToDecimal(data.Param["IFDEFAULT"]); pa["IFUSE"] = Convert.ToDecimal(data.Param["IFUSE"]); pa["USERID"] = Convert.ToDecimal(data.Param["USERID"]); pa["REPAIRNAME"] = data.Param["REPAIRNAME"].ToString(); pa["USERNAME"] = data.Param["USERNAME"].ToString(); pa["RECDATE"] = DateTime.Now; pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); if (data.Param["PYCODE"] != null) { pa["PYCODE"] = data.Param["PYCODE"].ToString(); } else { pa["PYCODE"] = null; } if (data.Param["WBCODE"] != null) { pa["WBCODE"] = data.Param["WBCODE"].ToString(); } else { pa["WBCODE"] = null; } if (data.Param["MEMO"] != null) { pa["MEMO"] = data.Param["MEMO"].ToString(); } else { pa["MEMO"] = null; } if (data.Param["IFDEFAULT"].ToString() == "1") { Opt EQIfHaveValue_FixKindInfo = OptContent.get("EQIfHaveValue_FixKindInfo"); ObjItem robjitm = DaoTool.ExecuteScalar(dao, EQIfHaveValue_FixKindInfo, data); if (!robjitm.IsNull) { Opt EQIfOnlyOne_FixKindInfo = OptContent.get("EQIfOnlyOne_FixKindInfo"); int rownum = DaoTool.ExecuteNonQuery(dao, EQIfOnlyOne_FixKindInfo, pa); if (rownum < 1) { throw new Exception("修改设备类别信息的默认值失败!"); } } } if (data.Param["REPAIRCODE"] == null)//新增 { Opt saveInfo_REPAIRCODE = OptContent.get("EQSaveFixKindInfo_REPAIRCODE"); Obj = DaoTool.ExecuteScalar(dao, saveInfo_REPAIRCODE, pa); if (Obj.IsNull) { pa["REPAIRCODE"] = "01"; } else if ((Obj.ToInt() + 1).ToString().Trim().Length == 1) { pa["REPAIRCODE"] = "0" + (Obj.ToInt() + 1).ToString(); } else { pa["REPAIRCODE"] = (Obj.ToInt() + 1).ToString(); } Opt saveInfo = OptContent.get("EQSaveFixKindInfo"); Opt name = OptContent.get("EQSaveFixKindInfo_Name"); Obj = DaoTool.ExecuteScalar(dao, name, pa); if (!Obj.IsNull) { msg = "名称重复!"; return("ok"); } if (DaoTool.Save(dao, saveInfo, pa) < 0) { throw new Exception("添加设备类别信息失败!"); } msg = "添加成功!"; return("ok"); } else //修改 { pa["REPAIRCODE"] = Convert.ToDecimal(data.Param["REPAIRCODE"]); Opt updataInfo = OptContent.get("EQUpdataFixKindInfo"); Opt updataname = OptContent.get("EQUpdataFixKindInfo_Name"); Obj = DaoTool.ExecuteScalar(dao, updataname, pa); if (!Obj.IsNull) { msg = "名称重复!"; return("ok"); } if (DaoTool.ExecuteNonQuery(dao, updataInfo, pa) < 0) { throw new Exception("修改维修类别信息失败!"); } msg = "修改成功!"; return("ok"); } } if ("DelFixKindInfo".Equals(ac)) { Opt Del = OptContent.get("DelFixKindInfo"); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["REPAIRCODE"] = data.Param["REPAIRCODE"].ToString(); Opt values1 = OptContent.get("EQDelFixKindInfo_Use1"); Obj1 = DaoTool.ExecuteScalar(dao, values1, pa); if (!Obj1.IsNull) { msg = "不能删除已使用的维修类别,只能停用!"; return("ok"); } if (DaoTool.ExecuteNonQuery(dao, Del, pa) < 0) { throw new Exception("删除维修类别失败!"); } msg = "删除成功!"; return("ok"); } if ("StopEQFixKindInfo".Equals(ac)) { Opt stop = OptContent.get("EQStartOrStopFixKindInfo"); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["REPAIRCODE"] = data.Param["REPAIRCODE"].ToString(); pa["IFUSE"] = 0; if (DaoTool.ExecuteNonQuery(dao, stop, pa) < 0) { throw new Exception("停用该维修类别信息失败!"); } msg = "停用成功!"; return("ok"); } if ("StartEQFixKindInfo".Equals(ac)) { Opt start = OptContent.get("EQStartOrStopFixKindInfo"); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["REPAIRCODE"] = data.Param["REPAIRCODE"].ToString(); pa["IFUSE"] = 1; 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 && data.Sql.Equals("UpdateEQStock")) { if (DaoTool.Update(dao, OptContent.get("SaveEQStockInfo1"), 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("SaveEQStockInfo1"), data) < 0) { // msg = flowno+'+'+DETAILNO; throw new Exception("添加物资库存总表信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("ChuKuDanEQdelete")) { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DeleteEQOutDetailInfo"), data) < 0) { throw new Exception("删除出库物资信息失败!"); } if (DaoTool.Update(dao, OptContent.get("SaveEQOutMainInfo"), data) < 0) { throw new Exception("保存出库信息失败!" + dao.ErrMsg); } msg = "删除出库物资信息成功!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("CHUKuDanDelete")) { data.Param["STATUS"] = 0; if (DaoTool.Update(dao, OptContent.get("SaveEQOutMainInfo"), data) > -1) { msg = "删除出库信息成功!"; return("ok"); } else { throw new Exception("删除出库信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("ChuKuDanUpdate")) { Opt op = OptContent.get("SaveEQOutMainInfo"); 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("SaveEQOutMainInfo"); 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["OUTID"] = data.Param["OUTID"].ToString(); dic1["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); Opt op1 = OptContent.get("EQOutMainInfo_CX"); Dictionary <string, object> dic = DaoTool.Get(dao, op1, dic1); dic["OUTID"] = DaoTool.Seq(dao, "LKEQ.SEQEQOUT"); dic["STATUS"] = 7; dic["TOTALMONEY"] = "-" + dic["TOTALMONEY"].ToString(); Opt op2 = OptContent.get("SaveEQOutMainInfo"); if (DaoTool.Save(dao, OptContent.get("SaveEQOutMainInfo"), dic) > -1)//生成出库主表 { Opt op3 = OptContent.get("EQOutDetailInfo_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.SEQEQOutDetail"); dc["OUTID"] = dic["OUTID"]; Opt opt4 = OptContent.get("SaveEQOutDetailInfo"); if (DaoTool.Save(dao, opt4, dc) < 0) //生成入库细表 { throw new Exception("保存单据明细失败!"); } Dictionary <string, object> dic2 = new Dictionary <string, object>(); Opt op5 = OptContent.get("EQOut_SearchEQStockNum1"); 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("SaveEQStockInfo1"), dic2) > -1)//修改库存总表 { Dictionary <string, object> dic4 = new Dictionary <string, object>(); Opt op7 = OptContent.get("EQOut_SearchEQStockOutNum"); ObjItem objitm = DaoTool.ExecuteScalar(dao, op7, dc); dic4["FLOWNO"] = dc["STOCKFLOWNO"]; dic4["OUTNUM"] = Convert.ToInt32(objitm.ToString()) + Convert.ToInt32(dc["NUM"].ToString()); Opt op6 = OptContent.get("SaveEQStockDetailInfo1"); 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("SaveEQStockDetailInfo1"); 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); // } //return msg = flowno + '+' + DETAILNO; //} } if (data.Sql != null && data.Sql.Equals("ChuKuDanSave")) { Opt op = OptContent.get("SaveEQOutMainInfo"); 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["OUTID"] = DaoTool.Seq(dao, "LKEQ.SEQEQOut"); 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("EQGetOutRecipeNo1").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("SaveEQOutMainInfo"), 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) { 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("系统出错,请与管理员联系!"); } }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { if (data.Sql == null) { throw new Exception("Sql内容为空!"); } else if (data.Sql.Equals("Del")) { int count = DaoTool.ExecuteScalar(dao, OptContent.get("CkIsSy"), data).ToInt(); if (count > 0) { // throw new Exception("此统计类别已经被系统使用,不能删除!"); msg = "此统计类别已经被系统使用,不能删除!"; return("ok"); } if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DelCkInfo"), data) < 0) { throw new Exception("删除统计类别信息失败!"); } if (DaoTool.ExecuteScalar(dao, OptContent.get("GetCk_seq"), data).ToInt() == 0) { data.Param["COUNTCODE"] = data.Param["SUPERCODE"]; DaoTool.ExecuteNonQuery(dao, OptContent.get("SetSuperCkEnd"), data); } msg = "此统计类别已删除!"; return("ok"); } else if (data.Sql.Equals("Add")) { Opt op = OptContent.get("SaveCkInfo"); data.Param["COUNTCODE"] = (DaoTool.ExecuteScalar(dao, OptContent.get("GetCk_seq"), data).ToInt() + 1).ToString("00"); if (!data.Param["SUPERCODE"].ToString().Equals("0")) { data.Param["COUNTCODE"] = data.Param["SUPERCODE"].ToString() + data.Param["COUNTCODE"].ToString(); } data.Param["RECDATE"] = DateTime.Now; if (DaoTool.Save(dao, op, data) > -1) { Opt op1 = OptContent.get("SetSuperCkNotEnd"); data.Param["COUNTCODE"] = data.Param["SUPERCODE"]; if (data.Param["COUNTCODE"].ToString() != "0") { if (DaoTool.ExecuteNonQuery(dao, op1, data) != 1) { throw new Exception("更新父节点状态失败!" + dao.ErrMsg); } } msg = "统计类别添加成功!"; return("ok"); } else { throw new Exception("统计类别添加失败!" + dao.ErrMsg); } } else if (data.Sql.Equals("Update")) { Opt op = OptContent.get("SaveCkInfo"); //data.Param["COUNTCODE"] = DaoTool.ExecuteScalar(dao, OptContent.get("GetCk_seq"), data).ToInt() + 1; data.Param["RECDATE"] = DateTime.Now; if (DaoTool.Update(dao, op, data) > -1) { msg = "统计类别更新成功!"; return("ok"); } else { throw new Exception("统计类别更新失败!" + dao.ErrMsg); } } else if (data.Sql.Equals("TingYong")) { Opt op = OptContent.get("SetCkUnUsed"); if (DaoTool.ExecuteNonQuery(dao, op, data) != 1) { throw new Exception("停用失败!" + dao.ErrMsg); } msg = "统计类别停用成功!"; return("ok"); } else if (data.Sql.Equals("QiYong")) { Opt op = OptContent.get("SetCkUsed"); if (DaoTool.ExecuteNonQuery(dao, op, data) != 1) { throw new Exception("启用失败!" + dao.ErrMsg); } msg = "统计类别启用成功!"; return("ok"); } else if (data.Sql.Equals("Find")) { msg = "查找成功!"; return("ok"); } msg = "成功!"; 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, Obj5, Obj6, Obj8; if ("SaveDictEQInfo".Equals(ac)) { pa["EQNAME"] = data.Param["EQNAME"].ToString(); pa["KINDCODE"] = data.Param["KINDCODE"].ToString(); pa["COUNTCODE"] = data.Param["COUNTCODE"].ToString(); pa["UNITCODE"] = data.Param["UNITCODE"].ToString(); pa["IFJL"] = Convert.ToDecimal(data.Param["IFJL"]); pa["IFUSE"] = Convert.ToDecimal(data.Param["IFUSE"]); pa["ZJTYPE"] = Convert.ToDecimal(data.Param["ZJTYPE"]); pa["ZJRATE"] = Math.Round(Convert.ToDecimal(data.Param["ZJRATE"]), 2); pa["USERID"] = Convert.ToDecimal(data.Param["USERID"]); pa["RECDATE"] = DateTime.Now; pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); if (data.Param["WORKUNITCODE"] != null) { pa["WORKUNITCODE"] = data.Param["WORKUNITCODE"].ToString(); } else { pa["WORKUNITCODE"] = null; } if (data.Param["USERNAME"] != null) { pa["USERNAME"] = data.Param["USERNAME"].ToString(); } else { pa["USERNAME"] = null; } if (data.Param["PYCODE"] != null) { pa["PYCODE"] = data.Param["PYCODE"].ToString(); } else { pa["PYCODE"] = null; } if (data.Param["WBCODE"] != null) { pa["WBCODE"] = data.Param["WBCODE"].ToString(); } else { pa["WBCODE"] = null; } if (data.Param["SHORTNAME"] != null) { pa["SHORTNAME"] = data.Param["SHORTNAME"].ToString(); } else { pa["SHORTNAME"] = null; } if (data.Param["SHORTCODE"] != null) { pa["SHORTCODE"] = data.Param["SHORTCODE"].ToString(); } else { pa["SHORTCODE"] = null; } if (data.Param["ALIASNAME"] != null) { pa["ALIASNAME"] = data.Param["ALIASNAME"].ToString(); } else { pa["ALIASNAME"] = null; } if (data.Param["ALIASCODE"] != null) { pa["ALIASCODE"] = data.Param["ALIASCODE"].ToString(); } else { pa["ALIASCODE"] = null; } 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["PRODUCTPLACE"] != null) { pa["PRODUCTPLACE"] = data.Param["PRODUCTPLACE"].ToString(); } else { pa["PRODUCTPLACE"] = null; } if (data.Param["TXM"] != null) { pa["TXM"] = data.Param["TXM"].ToString(); } else { pa["TXM"] = null; } if (data.Param["MEMO"] != null) { pa["MEMO"] = data.Param["MEMO"].ToString(); } else { pa["MEMO"] = null; } if (data.Param["EQID"] == null) { pa["EQID"] = DaoTool.Seq(dao, "LKEQ.SEQEQ"); Opt saveInfo = OptContent.get("SaveDictEQInfo"); Opt name = OptContent.get("SaveDictEQInfo_Name"); Obj = DaoTool.ExecuteScalar(dao, name, pa); if (!Obj.IsNull) { msg = "名称重复!"; return("ok"); } if (DaoTool.Save(dao, saveInfo, pa) < 0) { throw new Exception("添加设备信息失败!"); } msg = "添加成功!"; return("ok"); } else { pa["EQID"] = Convert.ToDecimal(data.Param["EQID"]); Opt updataInfo = OptContent.get("UpdataDictEQInfoInfo"); Opt updataname = OptContent.get("UpdataDictEQInfoInfo_Name"); Obj = DaoTool.ExecuteScalar(dao, updataname, pa); if (!Obj.IsNull) { msg = "名称重复!"; return("ok"); } if (DaoTool.ExecuteNonQuery(dao, updataInfo, pa) < 0) { throw new Exception("修改设备信息失败!"); } msg = "修改成功!"; return("ok"); } } if ("DelEQDictInfo".Equals(ac)) { pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["EQID"] = Convert.ToDecimal(data.Param["EQID"]); Opt Del = OptContent.get("DelEQDictInfo"); Opt values1 = OptContent.get("DelEQDictInfo_Use1"); Opt values2 = OptContent.get("DelEQDictInfo_Use2"); Opt values3 = OptContent.get("DelEQDictInfo_Use3"); Opt values4 = OptContent.get("DelEQDictInfo_Use4"); Opt values5 = OptContent.get("DelEQDictInfo_Use5"); Opt values6 = OptContent.get("DelEQDictInfo_Use6"); //Opt values7 = OptContent.get("DelWZDictInfo_Use7");//有可能这里还有涉及到其他表的可能。 || !Obj7.IsNull Opt values8 = OptContent.get("DelEQDictInfo_Use8"); Obj1 = DaoTool.ExecuteScalar(dao, values1, pa); Obj2 = DaoTool.ExecuteScalar(dao, values2, pa); Obj3 = DaoTool.ExecuteScalar(dao, values3, pa); Obj4 = DaoTool.ExecuteScalar(dao, values4, pa); Obj5 = DaoTool.ExecuteScalar(dao, values5, pa); Obj6 = DaoTool.ExecuteScalar(dao, values6, pa); //Obj7 = DaoTool.ExecuteScalar(dao, values7, pa); Obj8 = DaoTool.ExecuteScalar(dao, values8, pa); if (!Obj1.IsNull || !Obj2.IsNull || !Obj3.IsNull || !Obj4.IsNull || !Obj5.IsNull || !Obj6.IsNull || !Obj8.IsNull) { msg = "不能删除已使用的设备,只能停用!"; return("ok"); } if (DaoTool.ExecuteNonQuery(dao, Del, pa) < 0) { throw new Exception("删除设备信息失败!"); } msg = "删除成功!"; return("ok"); } if ("StopEQDictInfo".Equals(ac)) { Opt stop = OptContent.get("StartOrStopEQDictInfo"); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["EQID"] = data.Param["EQID"].ToString(); pa["IFUSE"] = 0; if (DaoTool.ExecuteNonQuery(dao, stop, pa) < 0) { throw new Exception("停用设备信息失败!"); } msg = "停用成功!"; return("ok"); } if ("StartEQDictInfo".Equals(ac)) { Opt start = OptContent.get("StartOrStopEQDictInfo"); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["EQID"] = data.Param["EQID"].ToString(); pa["IFUSE"] = 1; 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("QiYong")) { Opt op = OptContent.get("QiTingEQCountKind"); if (DaoTool.ExecuteNonQuery(dao, op, data) > 0) { msg = "启用该统计类别信息成功!"; return("ok"); } else { throw new Exception("启用该统计类别信息失败!"); } } if (data.Sql != null && data.Sql.Equals("TingYong")) { Opt op = OptContent.get("QiTingEQCountKind"); if (DaoTool.ExecuteNonQuery(dao, op, data) > 0) { msg = "停用该统计类别信息成功!"; return("ok"); } else { throw new Exception("停用该统计类别信息失败"); } } if (data.Sql != null && data.Sql.Equals("Del")) { Opt op = OptContent.get("IfHaveUse_EQCountKindManag"); if (DaoTool.ExecuteScalar(dao, op, data).ToInt() > 0) { //被使用 msg = "该设备统计类别已被使用,不能删除,只能停用!"; return("ok"); } if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DelEQCKInfo_EQCountKindManag"), data) < 0) { throw new Exception("删除设备统计类别信息失败"); } //在配置端已经设置好为 当前COUNTCODE作为SUPERCODE的子目录[IsHaveChildCK] if (DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveChildCK"), data).ToInt() == 0) { //检验一次,若节点下没有子节点,则更新其为末节点 SetCKSuperEnd DaoTool.ExecuteNonQuery(dao, OptContent.get("SetSuperEQCKEnd_EQCountKindManag"), data); } msg = "删除设备统计类别信息成功!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("Add")) { Opt op = OptContent.get("SaveCountKind"); //当上级节点确定,获取下级节点的个数+1为下级节点的一部分 data.Param["COUNTCODE"] = (DaoTool.ExecuteScalar(dao, OptContent.get("GetEQCountCode"), data).ToInt() + 1).ToString("00"); //当上级节点不为0[根节点] 其实在客户端就已经写好了,这里只是校验一下 if (!data.Param["SUPERCODE"].ToString().Equals("0")) { data.Param["COUNTCODE"] = data.Param["SUPERCODE"].ToString() + data.Param["COUNTCODE"].ToString(); } data.Param["RECDATE"] = DateTime.Now; if (DaoTool.ExecuteScalar(dao, OptContent.get("isRepeatCountName"), data).ToInt() == 0) { if (DaoTool.Save(dao, op, data) > -1) { //保存了之后,我们必须将对应的父节点设置为非末节点 Opt op1 = OptContent.get("SetSuperEQCKNotEnd"); data.Param["COUNTCODE"] = data.Param["SUPERCODE"]; if (data.Param["COUNTCODE"].ToString() != "0") { if (DaoTool.ExecuteNonQuery(dao, op1, data) != 1) { throw new Exception("更新父节点状态失败!" + dao.ErrMsg); } } msg = "设备统计类别添加成功!"; return("ok"); } else { throw new Exception("设备统计类别添加失败!" + dao.ErrMsg); } } else { msg = "已经存在该统计类别名称!"; return("ok"); } } if (data.Sql != null && data.Sql.Equals("Modify")) { Opt op = OptContent.get("SaveCountKind"); data.Param["RECDATE"] = DateTime.Now; if (DaoTool.ExecuteScalar(dao, OptContent.get("isRepeatCountName"), data).ToInt() == 0) { //当设置为末节点时,检查其是否包含子节点 if (data.Param["IFEND"].ToString() == "1") { if (DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveChildCK"), data).ToInt() > 0) { msg = "该节点下包含子节点,不能设置其为末节点!"; return("ok"); } else { if (DaoTool.Update(dao, op, data) > -1) { msg = "更新设备统计类别信息成功!"; return("ok"); } else { throw new Exception("更新设备统计类别失败!" + dao.ErrMsg); } } } else { if (DaoTool.Update(dao, op, data) > -1) { msg = "更新设备统计类别信息成功!"; return("ok"); } else { throw new Exception("更新设备统计类别失败!" + dao.ErrMsg); } } } else { msg = "已经存在该统计类别名称!"; return("ok"); } } else { msg = "系统出错,请联系管理员!"; return("ok"); } }
public object Run(Dao dao, YtService.data.OptData data, out string msg) { msg = "设备信息"; Dictionary <string, object> pa = new Dictionary <string, object>(); string ac = data.Sql; ObjItem obj; object OBJ; if ("SaveEQKindInfo".Equals(ac)) { pa["KINDNAME"] = data.Param["KINDNAME"].ToString(); pa["USERNAME"] = data.Param["USERNAME"].ToString(); pa["IFUSE"] = Convert.ToDecimal(data.Param["IFUSE"]); pa["RECDATE"] = DateTime.Now; pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["USERID"] = Convert.ToDecimal(data.Param["USERID"]); pa["IFEND"] = Convert.ToDecimal(data.Param["IFEND"]); if (data.Param["PREFIX"] != null) { pa["PREFIX"] = data.Param["PREFIX"].ToString(); } else { pa["PREFIX"] = null; } if (data.Param["MEMO"] != null) { pa["MEMO"] = data.Param["MEMO"].ToString(); } else { pa["MEMO"] = null; } if (data.Param["PYCODE"] != null) { pa["PYCODE"] = data.Param["PYCODE"].ToString(); } else { pa["PYCODE"] = null; } if (data.Param["WBCODE"] != null) { pa["WBCODE"] = data.Param["WBCODE"].ToString(); } else { pa["WBCODE"] = null; } pa["SUPERCODE"] = data.Param["SUPERCODE"].ToString(); pa["KINDCODE"] = data.Param["KINDCODE"].ToString(); Opt cfmx = OptContent.get("EQKindSave"); Opt cop_Name = OptContent.get("CompareEQKindName"); Opt cop_Code = OptContent.get("CompareEQKindCode"); Opt changeUpCodesIfEnd = OptContent.get("changeUpCodesIfEnd"); obj = DaoTool.ExecuteScalar(dao, cop_Name, pa); if (!obj.IsNull) { msg = "名称重复!"; return("ok"); } if (DaoTool.Save(dao, cfmx, pa) < 0) { throw new Exception("添加设备信息失败!"); } if (DaoTool.ExecuteNonQuery(dao, changeUpCodesIfEnd, pa) < 0) { throw new Exception("修改上级是否末阶段失败!"); } msg = "添加成功!"; return("ok"); } if ("UpdataEQKindInfo".Equals(ac)) { pa["KINDNAME"] = data.Param["KINDNAME"].ToString(); pa["USERNAME"] = data.Param["USERNAME"].ToString(); pa["IFUSE"] = Convert.ToDecimal(data.Param["IFUSE"]); pa["RECDATE"] = DateTime.Now; pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["USERID"] = Convert.ToDecimal(data.Param["USERID"]); pa["IFEND"] = Convert.ToDecimal(data.Param["IFEND"]); if (data.Param["PREFIX"] != null) { pa["PREFIX"] = data.Param["PREFIX"].ToString(); } else { pa["PREFIX"] = null; } if (data.Param["MEMO"] != null) { pa["MEMO"] = data.Param["MEMO"].ToString(); } else { pa["MEMO"] = null; } if (data.Param["PYCODE"] != null) { pa["PYCODE"] = data.Param["PYCODE"].ToString(); } else { pa["PYCODE"] = null; } if (data.Param["WBCODE"] != null) { pa["WBCODE"] = data.Param["WBCODE"].ToString(); } else { pa["WBCODE"] = null; } pa["SUPERCODE"] = data.Param["SUPERCODE"].ToString(); pa["KINDCODE"] = data.Param["KINDCODE"].ToString(); pa["SELECTCODE"] = data.Param["SELECTCODE"].ToString(); Opt Updatacop_Name = OptContent.get("UpdataCompareEQKindName"); Opt Updatacop_Code = OptContent.get("CompareEQKindCode"); Opt Updatacop_UpCode = OptContent.get("CompareEQKindUpCode"); Opt WZKindUpdata = OptContent.get("EQKindUpdata"); Opt changeUpCodesIfEnd = OptContent.get("changeUpCodesIfEnd"); obj = DaoTool.ExecuteScalar(dao, Updatacop_Name, pa); if (!obj.IsNull) { msg = "名称重复!"; return("ok"); } if (DaoTool.ExecuteNonQuery(dao, WZKindUpdata, pa) < 0) { throw new Exception("修改设备信息失败!"); } if (DaoTool.ExecuteNonQuery(dao, changeUpCodesIfEnd, pa) < 0) { throw new Exception("修改上级末节点失败!"); } msg = "修改成功!"; return("ok"); } if ("DelEQKindInfo".Equals(ac)) { pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["KINDCODE"] = data.Param["KINDCODE"].ToString(); pa["SUPERCODE"] = data.Param["SUPERCODE"].ToString(); Opt del = OptContent.get("EQKinddel"); Opt del_Find = OptContent.get("EQKinddel_Find"); Opt ifhavechildren = OptContent.get("ifhavechildren"); Opt changeUpCodesIsEnd = OptContent.get("changeUpCodesIsEnd"); //if (DaoTool.ExecuteNonQuery(dao, del_Find, pa) < 0)//是否使用过 // throw new Exception("使用过只能停用不能删除!"); OBJ = DaoTool.ExecuteScalar(dao, del_Find, pa).Get(); //if (Convert.ToInt32(OBJ) == 1) // throw new Exception("使用过只能停用不能删除!"); if (DaoTool.ExecuteNonQuery(dao, del, pa) < 0) { throw new Exception("删除设备成功!"); } if (DaoTool.ExecuteScalar(dao, ifhavechildren, pa).IsNull) { if (DaoTool.ExecuteNonQuery(dao, changeUpCodesIsEnd, pa) < 0) { throw new Exception("修改上级末节点失败!"); } } msg = "删除成功!"; return("ok"); } if ("StartEQKindInfo".Equals(ac)) { pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["KINDCODE"] = data.Param["KINDCODE"].ToString(); Opt stop = OptContent.get("StartorStopEQKindInfo"); pa["IFUSE"] = 1; if (DaoTool.ExecuteNonQuery(dao, stop, pa) < 0) { throw new Exception("启用设备失败!"); } msg = "启用设备成功!"; return("ok"); } if ("StopEQKindInfo".Equals(ac)) { pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["KINDCODE"] = data.Param["KINDCODE"].ToString(); Opt start = OptContent.get("StartorStopEQKindInfo"); Opt canstop = OptContent.get("CanStopEQKindInfo"); pa["IFUSE"] = 0; //if (DaoTool.ExecuteNonQuery(dao, del_Find, pa) < 0)//是否使用过 // throw new Exception("使用过只能停用不能删除!"); OBJ = DaoTool.ExecuteScalar(dao, canstop, pa).Get(); if (Convert.ToInt32(OBJ) == 0) { throw new Exception("不是末节点不能停用!"); } if (DaoTool.ExecuteNonQuery(dao, start, pa) < 0) { throw new Exception("启用设备失败!"); } msg = "停用设备成功!"; return("ok"); } if ("CopyEQKindInfo".Equals(ac)) { Opt Copy = OptContent.get("CopyEQKindInfo"); Opt cfmx = OptContent.get("EQKindSave"); DataTable dt = DaoTool.FindDT(dao, Copy, data); foreach (DataRow dr in dt.Rows) { if (dr["KINDNAME"] != null) { pa["KINDNAME"] = dr["KINDNAME"].ToString(); } else { pa["KINDNAME"] = null; } if (dr["PYCODE"] != null) { pa["PYCODE"] = dr["PYCODE"].ToString(); } else { pa["PYCODE"] = null; } if (dr["USERNAME"] != null) { pa["USERNAME"] = dr["USERNAME"].ToString(); } else { pa["USERNAME"] = null; } if (dr["MEMO"] != null) { pa["MEMO"] = dr["MEMO"].ToString(); } else { pa["MEMO"] = null; } pa["IFUSE"] = Convert.ToDecimal(dr["IFUSE"]); pa["RECDATE"] = Convert.ToDateTime(dr["RECDATE"]); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["USERNAME"] = dr["USERNAME"].ToString(); pa["USERID"] = dr["USERID"].ToString(); pa["IFEND"] = Convert.ToDecimal(dr["IFEND"]); pa["SUPERCODE"] = dr["SUPERCODE"].ToString(); pa["KINDCODE"] = dr["KINDCODE"].ToString(); DaoTool.Save(dao, cfmx, pa); } msg = "复制成功!"; return("ok"); } return("ok"); }