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) { #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) { if (data.Sql != null && data.Sql.Equals("EQPurchasePlanDelete"))//删除主表 { data.Param["STATUS"] = 0; if (DaoTool.Update(dao, OptContent.get("SaveEQPlanMainInfo"), data) > -1) { msg = "删除采购计划信息成功!"; return("ok"); } else { throw new Exception("删除采购计划信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("PlanDanUpdate_SH")) { Opt op = OptContent.get("SaveEQPlanMainInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { // saveRunDetail(dao, data); //if (data.Param["STATUS"].ToString() == "2") //{ //} msg = "审核采购计划信息成功!"; return("ok"); } else { throw new Exception("审核采购计划信息失败!" + dao.ErrMsg); } } } if (data.Sql != null && data.Sql.Equals("PlanDanUpdata_Submit")) { Opt op = OptContent.get("SaveEQPlanMainInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { msg = "提交采购计划信息成功!"; return("ok"); } else { throw new Exception("提交采购计划信息失败!" + dao.ErrMsg); } } } if (data.Sql != null && data.Sql.Equals("PlanDanEQdelete")) { //删除采购计划细表记录 if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DeleteEQPlanDetailInfo"), data) < 0) { throw new Exception("删除采购设备信息失败!"); } //更新采购计划主表信息 if (DaoTool.Update(dao, OptContent.get("SaveEQPlanMainInfo"), data) < 0) { throw new Exception("保存采购计划单失败!" + dao.ErrMsg); } msg = "删除采购设备信息成功!"; return("ok"); } //if (data.Sql != null && data.Sql.Equals("UpdateWZPlanDan")) //{ // if (DaoTool.Update(dao, OptContent.get("SaveWZPlanMainInfo"), data) > -1) // { // //savePlanDetail(dao, data); // msg = "保存采购计划信息成功!"; // return "ok"; // } // else // { // throw new Exception("保存采购计划信息失败!" + dao.ErrMsg); // } //} if (data.Sql != null && data.Sql.Equals("PlanDanSave")) { Opt op = OptContent.get("SaveEQPlanMainInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { savePlanDetail(dao, data); msg = "保存设备计划信息成功!"; return("ok"); } else { throw new Exception("保存设备计划信息失败!" + dao.ErrMsg); } } else { data.Param["PLANID"] = DaoTool.Seq(dao, "LKEQ.SEQEQPlan"); if (DaoTool.Save(dao, op, data) > -1) { savePlanDetail(dao, data); msg = "添加设备计划成功!"; return("ok"); } else { throw new Exception("添加设备计划失败!" + dao.ErrMsg); } } } msg = "保存成功!"; return("ok"); }
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["NOID"] == null || data.Param["NOID"].ToString() == "") { data.Param["NOID"] = DaoTool.Seq(dao, "LKEQ.SEQEQXZNo"); Opt op = OptContent.get("SaveEQAccount"); if (DaoTool.Save(dao, op, data) < 0) { msg = "执行失败!"; throw new Exception("新增设备下账记录失败!" + dao.ErrMsg); } msg = "新增检查记录成功!"; return("ok"); } if (DaoTool.Update(dao, OptContent.get("SaveEQAccount"), data) < 0) { msg = "执行失败!"; throw new Exception("修改设备下账记录失败!" + dao.ErrMsg); } msg = "修改下账记录成功!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("JDPass")) { data.Param["JDDATE"] = DateTime.Now; if (DaoTool.Update(dao, OptContent.get("SaveEQAccount"), data) > -1) { msg = "鉴定下账信息成功!"; return("ok"); } else { throw new Exception("鉴定下账信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("JDNo")) { if (DaoTool.Update(dao, OptContent.get("SaveEQAccount"), data) > -1) { msg = "鉴定下账信息成功!"; return("ok"); } else { throw new Exception("鉴定下账信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("SHPass")) { Opt op = OptContent.get("ChangTheStatus_EQAccount"); data.Param["SHDATE"] = DateTime.Now; if (DaoTool.Update(dao, OptContent.get("SaveEQAccount"), data) > -1) { if (DaoTool.ExecuteNonQuery(dao, op, data) > 0) { msg = "审核下账信息成功!"; return("ok"); } else { throw new Exception("修改卡片设备状态失败!" + dao.ErrMsg); } } else { throw new Exception("审核下账信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("SHNo")) { if (DaoTool.Update(dao, OptContent.get("SaveEQAccount"), data) > -1) { msg = "审核下账信息成功!"; return("ok"); } else { throw new Exception("审核下账信息失败!" + dao.ErrMsg); } } 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"); }