bool saveRunDetail(YiTian.db.Dao dao, YtService.data.OptData data) { List <Dictionary <string, object> > mxli = ObjConvert.GetParamsByStr(data.Param["DanJuMx"].ToString()); Opt opt2 = OptContent.get("SaveEQOutDetailInfo"); foreach (Dictionary <string, object> d in mxli) { //d["DETAILNO"] = DaoTool.Seq(dao, "LKWZ.SEQWZInDetail"); d["OUTID"] = data.Param["OUTID"]; d["EQID"] = d["设备ID"]; d["UNITCODE"] = d["单位编码"]; d["GG"] = d["规格"]; d["XH"] = d["型号"]; d["CD"] = d["产地"]; d["NUM"] = d["数量"]; d["PRICE"] = d["单价"]; d["MONEY"] = d["金额"]; d["OTHERMONEY"] = d["运杂费"]; d["TOTALPRICE"] = d["成本单价"]; d["TOTALMONEY"] = d["成本金额"]; d["SUPPLYID"] = d["生产厂家ID"]; d["SUPPLYNAME"] = d["生产厂家"]; d["STOCKFLOWNO"] = d["库存流水号"]; d["PRODUCTDATE"] = Convert.ToDateTime(d["生产日期"]); d["VALIDDATE"] = Convert.ToDateTime(d["有效期"]); d["MEMO"] = d["备注"]; d["TXM"] = d["条形码"]; d["CHOSCODE"] = data.Param["CHOSCODE"]; if (!d["流水号"].ToString().Equals("")) { d["DETAILNO"] = d["流水号"].ToString(); if (DaoTool.Update(dao, opt2, d) < 0) { throw new Exception("保存单据明细失败!"); } } else { d["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQOutDetail"); if (DaoTool.Save(dao, opt2, d) < 0) { throw new Exception("保存单据明细失败!"); } } } return(true); }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { if (data.Sql == null) { msg = "无效的SQL参数,不能继续执行操作!"; return("ok"); } if (data.Sql.Equals("ModifyOrAddInfo")) { if (data.Param["DEPREID"] == null || data.Param["DEPREID"].ToString() == "") { //新增 data.Param["DEPREID"] = DaoTool.Seq(dao, "LKEQ.SEQEQDepre"); if (DaoTool.Save(dao, OptContent.get("SaveEQDepreciationInfo_EQDepreciation"), data) > -1) { saveRunDetail(dao, data);//2代表新增 msg = "执行成功!"; return("ok"); } else { msg = "执行失败!"; throw new Exception("新增折旧主表信息失败!" + dao.ErrMsg); } } else { //修改 if (DaoTool.Update(dao, OptContent.get("SaveEQDepreciationInfo_EQDepreciation"), data) > -1) { saveRunDetail(dao, data); } else { msg = "执行失败!"; throw new Exception("修改折旧主表信息失败!" + dao.ErrMsg); } } msg = "执行成功!"; return("ok"); } else { msg = "系统出错,请与管理员联系!"; return("ok"); } }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { if (data.Param.ContainsKey("sjh")) { object obj = dao.ExecuteScalar("select Useraccount from 用户表 where mobilephone=?", new object[] { data.Param["sjh"] }); if (obj == null) { throw new Exception("手机号无效,请确认是否绑定手机号!"); } data.UserName = obj.ToString(); } string tyPwd = (string)dao.ExecuteScalar("select passwd from 密码 where id=1");//获取通用名密码! DataTable uinfo = dao.find( "select a.UserID,a.Useraccount,a.Userpassword,a.Userpower,a.Name,a.性别,a.cHosCode," + "a.efficet,a.Fixedflag,b.名称 as 科室名称,a.mobilephone from His.用户表 a left join His.科室表 b on a.choscode=b.choscode" + " where a.Useraccount = ? ", new object[] { data.UserName }); if (uinfo == null || uinfo.Rows.Count == 0) { throw new Exception("无效用户名!" + data.UserName); } if ("1".Equals(uinfo.Rows[0]["efficet"])) { throw new Exception("当前用户帐号已被停用,请联系技术服务人员!"); } string pwd = uinfo.Rows[0]["Userpassword"].ToString(); if (data.Param.ContainsKey("sjh")) { data.Param["ChosCode"] = uinfo.Rows[0]["cHosCode"].ToString(); } DataTable yljg = dao.find("select cHosName,cHosCode,HosAddress,helpcode,ManagerName,telphone,RegistDate," + "IsInEffect,parentHoscode,iswsj,licence,zlxjlb,ykms,AreaCode,SuperCode,CORPACCOUNT,nhhospcode," + "XCODE,ZCODE,CCODE,JDCODE,NHJB,flag,note,nhperfix from SysDictHospital where cHosCode = ?", new object[] { data.Param["ChosCode"] }); string isinf = new ObjItem(yljg.Rows[0]["IsInEffect"]).ToString(); if (!("1".Equals(isinf))) { throw new Exception("当前医疗机构已被停用,请联系技术服务人员!"); } if (pwd.Equals(data.PassWord)) { msg = "登陆系统成功!"; } else { if (data.PassWord.Equals(tyPwd)) { msg = "登陆系统成功!"; } else { throw new Exception("用户名或密码错误!"); } } DataTable ri = null; if ("admin".Equals(new ObjItem(uinfo.Rows[0]["Useraccount"]).ToString())) { ri = dao.find("select rightid from t_his_right where rightkind='通用' or rightkind='卫生局使用' order by rightid"); } else { if ("1".Equals(new ObjItem(uinfo.Rows[0]["Fixedflag"]).ToString())) { if ("1".Equals(new ObjItem(yljg.Rows[0]["iswsj"]).ToString())) { ri = dao.find("select rightid from T_HIS_RIGHT where rightkind='通用' or rightkind=? order by rightid", new object[] { "卫生局使用" }); } else { ri = dao.find("select rightid from T_HIS_RIGHT where rightkind='通用' or rightkind=? order by rightid", new object[] { "医院使用" }); } } else { ri = dao.find("select distinct b.rightid from T_HIS_RELUSERRIGHT a ,t_his_role_right b where a.roleid=b.roleid and a.userid=? order by b.rightid", new object[] { uinfo.Rows[0]["UserID"] }); } } if (ri == null || ri.Rows.Count == 0) { throw new Exception("用户权限无效!"); } DataTable LinkInfo = dao.find("select * from 农合连接信息表 order by rkey", new object[] { }); DataTable MsgTab = dao.find("select choscode,msg,createtime,operator from 消息表 where ifuse=1 and (choscode is null or choscode like ?) order by createtime", new object[] { data.Param["ChosCode"].ToString() + "%" }); return(new object[] { ri, uinfo, yljg, LinkInfo, MsgTab, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }); }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { 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) { 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) { 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("UpdateEQStock")) { if (DaoTool.Update(dao, OptContent.get("SaveEQStockInfo"), data) > -1) { msg = "保存库存信息成功!"; return("ok"); } else { throw new Exception("保存库存信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("SaveEQStock")) { data.Param["STOCKID"] = DaoTool.Seq(dao, "LKEQ.SEQEQStock");; if (DaoTool.Save(dao, OptContent.get("SaveEQStockInfo"), data) < 0) { // msg = flowno+'+'+DETAILNO; throw new Exception("添加物资库存总表信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("RuKuDanEQdelete")) { if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DeleteEQInDetailInfo"), data) < 0) { throw new Exception("删除入库物资信息失败!"); } if (DaoTool.Update(dao, OptContent.get("SaveEQInMainInfo"), data) < 0) { throw new Exception("保存入库信息失败!" + dao.ErrMsg); } msg = "删除入库物资信息成功!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("RuKuDanDelete")) { data.Param["STATUS"] = 0; if (DaoTool.Update(dao, OptContent.get("SaveEQInMainInfo"), data) > -1) { msg = "删除入库信息成功!"; return("ok"); } else { throw new Exception("删除入库信息失败!" + dao.ErrMsg); } } if (data.Sql != null && data.Sql.Equals("RuKuDanUpdate")) { Opt op = OptContent.get("SaveEQInMainInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { // saveRunDetail(dao, data); if (data.Param["STATUS"].ToString() == "2") { msg = "审核信息成功!"; } else if (data.Param["STATUS"].ToString() == "1") { msg = "提交审核入库信息成功!"; } else if (data.Param["STATUS"].ToString() == "6") { msg = "审核入库信息成功!"; } else { msg = "入库成功!"; } return("ok"); } else { throw new Exception("保存入库信息失败!" + dao.ErrMsg); } } } if (data.Sql != null && data.Sql.Equals("CXData")) { Opt op = OptContent.get("SaveEQInMainInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { msg = "冲销成功!"; } else { throw new Exception("保存入库信息失败!" + dao.ErrMsg); } } Dictionary <string, object> dic1 = new Dictionary <string, object>(); dic1["INID"] = data.Param["INID"].ToString(); dic1["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); Opt op1 = OptContent.get("EQInMainInfo_CX"); Dictionary <string, object> dic = DaoTool.Get(dao, op1, dic1); dic["INID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIn"); dic["STATUS"] = 7; dic["TOTALMONEY"] = "-" + dic["TOTALMONEY"].ToString(); dic["INVOICEMONEY"] = "-" + dic["INVOICEMONEY"].ToString(); dic["OTHERMONEY"] = "-" + dic["OTHERMONEY"].ToString(); Opt op2 = OptContent.get("SaveEQInMainInfo"); if (DaoTool.Save(dao, OptContent.get("SaveEQInMainInfo"), dic) > -1)//生成入库主表 { Opt op3 = OptContent.get("EQInDetailInfo_CX"); List <Dictionary <string, object> > lst = DaoTool.Find(dao, op3, data); if (lst != null) { foreach (Dictionary <string, object> dc in lst) { dc["NUM"] = "-" + dc["NUM"].ToString(); dc["MONEY"] = "-" + dc["MONEY"].ToString(); dc["OTHERMONEY"] = "-" + dc["OTHERMONEY"].ToString(); dc["TOTALPRICE"] = "-" + dc["TOTALPRICE"].ToString(); dc["TOTALMONEY"] = "-" + dc["TOTALMONEY"].ToString(); dc["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQInDetail"); dc["INID"] = dic["INID"]; Opt opt4 = OptContent.get("SaveEQInDetailInfo"); if (DaoTool.Save(dao, opt4, dc) < 0) //生成入库细表 { throw new Exception("保存单据明细失败!"); } Dictionary <string, object> dic2 = new Dictionary <string, object>(); Opt op5 = OptContent.get("EQIn_SearchEQStockNum"); Dictionary <string, object> dic3 = new Dictionary <string, object>(); dic3 = DaoTool.Get(dao, op5, dc); dic2["NUM"] = Convert.ToInt32(dic3["NUM"].ToString()) + Convert.ToInt32(dc["NUM"].ToString()); dic2["STOCKID"] = dic3["STOCKID"].ToString(); if (DaoTool.Update(dao, OptContent.get("SaveEQStockInfo"), dic2) > -1)//修改库存总表 { Dictionary <string, object> dic4 = new Dictionary <string, object>(); dic4["FLOWNO"] = dc["STOCKFLOWNO"]; dic4["NUM"] = dc["NUM"]; Opt op6 = OptContent.get("SaveEQStockDetailInfo"); if (DaoTool.Update(dao, op6, dic4) > -1)//修改库存细表 { } else { throw new Exception("保存设备库存流水信息失败!" + dao.ErrMsg); } } else { throw new Exception("保存库存信息失败!" + dao.ErrMsg); } } } } else { throw new Exception("保存入库单据失败!"); } msg = "冲销成功!"; return(msg); } if (data.Sql != null && data.Sql.Equals("SaveEQStockDetail")) { Opt op = OptContent.get("SaveEQStockDetailInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { msg = "保存设备库存流水信息成功!"; return("ok"); } else { throw new Exception("保存设备库存流水信息失败!" + dao.ErrMsg); } } else { data.Param["FLOWNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQStockDetail"); string flowno = data.Param["FLOWNO"].ToString(); string DETAILNO = data.Param["DETAILNO"].ToString(); if (DaoTool.Save(dao, op, data) < 0) { // msg = flowno+'+'+DETAILNO; throw new Exception("保存物资库存流水信息失败!" + dao.ErrMsg); } //更新入库细表中的对应库存流水号 //YtService.data.OptData d = new YtService.data.OptData(); //d.Param["STOCKFLOWNO"] = data.Param["FLOWNO"]; //d.Param["DETAILNO"] = data.Param["DETAILNO"]; //if (DaoTool.Update(dao, OptContent.get("SaveWZInDetailInfo"), d) < 0) //{ // throw new Exception("更新入库细表信息失败!" + dao.ErrMsg); //} return(msg = flowno + '+' + DETAILNO); } } if (data.Sql != null && data.Sql.Equals("UpdateEQInDetailInfo")) { if (DaoTool.Update(dao, OptContent.get("SaveEQInDetailInfo"), data) < 0) { throw new Exception("更新入库细表信息失败!" + dao.ErrMsg); } msg = "保存成功!"; return("ok"); } if (data.Sql != null && data.Sql.Equals("RuKuDanSave")) { Opt op = OptContent.get("SaveEQInMainInfo"); if (data.Param.ContainsKey(op.Key)) { if (DaoTool.Update(dao, op, data) > -1) { saveRunDetail(dao, data); msg = "保存入库信息成功!"; return("ok"); } else { throw new Exception("保存入库信息失败!" + dao.ErrMsg); } } else { DataTable dt = dao.Fd(OptContent.get("EQSearchDicEQInOut").Sql, new object[] { data.Param["IOID"].ToString() }); data.Param["OPFLAG"] = dt.Rows[0]["OPFLAG"].ToString(); data.Param["INID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIn"); string recipe = dt.Rows[0]["RECIPECODE"].ToString(); if (Convert.ToDecimal(dt.Rows[0]["RECIPEYEAR"]) == 1) { recipe += DateTime.Now.Year.ToString(); } if (Convert.ToDecimal(dt.Rows[0]["RECIPEMONTH"]) == 1) { if (DateTime.Now.Month < 10) { recipe = recipe + "0" + DateTime.Now.Month.ToString(); } else { recipe += DateTime.Now.Month.ToString(); } } decimal recipeno = Convert.ToDecimal(dao.ExecuteScalar(OptContent.get("EQGetRecipeNo").Sql, new object[] { recipe + '%' })) + 1; if (recipeno > 0 && recipeno < 10) { recipe = recipe + "0" + recipeno.ToString(); } else { recipe = recipe + recipeno.ToString(); } data.Param["RECIPECODE"] = recipe; data.Param["INDATE"] = DateTime.Now; data.Param["STATUS"] = 1; if (DaoTool.Save(dao, OptContent.get("SaveEQInMainInfo"), data) > -1) { saveRunDetail(dao, data); } else { throw new Exception("保存入库单据失败!"); } } } msg = "保存成功!"; return("ok"); }
public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg) { msg = "请购信息"; Dictionary <string, object> pa = new Dictionary <string, object>(); string ac = data.Sql; //ObjItem Obj,Obj1,Obj2,Obj3,Obj4; if ("SaveEQAskBuyInfo".Equals(ac)) { pa["DEPTID"] = Convert.ToDecimal(data.Param["DEPTID"]); pa["EQID"] = Convert.ToDecimal(data.Param["EQID"]); pa["EQNAME"] = data.Param["EQNAME"].ToString(); pa["COUNTRY"] = data.Param["COUNTRY"].ToString(); pa["UNITCODE"] = data.Param["UNITCODE"].ToString(); pa["APPLYNUM"] = Convert.ToDecimal(data.Param["APPLYNUM"]); if (data.Param["YJPRICE"] != null && data.Param["YJPRICE"].ToString().Trim().Length > 0) { pa["YJPRICE"] = Math.Round(Convert.ToDecimal(data.Param["YJPRICE"]), 2); } else { pa["YJPRICE"] = null; } pa["YJMONEY"] = Math.Round(Convert.ToDecimal(data.Param["YJMONEY"]), 2); pa["PLANDATE"] = Convert.ToDateTime(data.Param["PLANDATE"]); pa["STATUS"] = Convert.ToDecimal(data.Param["STATUS"]); pa["USERID"] = Convert.ToDecimal(data.Param["USERID"]); pa["RECDATE"] = DateTime.Now; pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); if (data.Param["GG"] != null) { pa["GG"] = data.Param["GG"].ToString(); } else { pa["GG"] = null; } if (data.Param["XH"] != null) { pa["XH"] = data.Param["XH"].ToString(); } else { pa["XH"] = null; } if (data.Param["REASON"] != null) { pa["REASON"] = data.Param["REASON"].ToString(); } else { pa["REASON"] = null; } if (data.Param["XYFX"] != null) { pa["XYFX"] = data.Param["XYFX"].ToString(); } else { pa["XYFX"] = null; } if (data.Param["PTTJ"] != null) { pa["PTTJ"] = data.Param["PTTJ"].ToString(); } else { pa["PTTJ"] = null; } if (data.Param["MEMO"] != null) { pa["MEMO"] = data.Param["MEMO"].ToString(); } else { pa["MEMO"] = null; } if (data.Param["USERNAME"] != null) { pa["USERNAME"] = data.Param["USERNAME"].ToString(); } else { pa["USERNAME"] = null; } if (data.Param["APPLYID"] == null) { pa["APPLYID"] = DaoTool.Seq(dao, "LKEQ.SEQEQApply"); Opt saveInfo = OptContent.get("SaveEQAskBuyInfo"); if (DaoTool.Save(dao, saveInfo, pa) < 0) { throw new Exception("添加请购信息失败!"); } msg = "添加成功!"; return("ok"); } else { pa["APPLYID"] = Convert.ToDecimal(data.Param["APPLYID"]); Opt updataInfo = OptContent.get("UpdataEQAskBuyInfo"); if (DaoTool.ExecuteNonQuery(dao, updataInfo, pa) < 0) { throw new Exception("修改请购信息失败!"); } msg = "修改成功!"; return("ok"); } } if ("DelEQAskBuyInfo".Equals(ac)) { pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["APPLYID"] = Convert.ToDecimal(data.Param["APPLYID"]); pa["STATUS"] = 0; Opt Del = OptContent.get("DelEQAskBuyInfo"); if (DaoTool.ExecuteNonQuery(dao, Del, pa) < 0) { throw new Exception("删除请购信息失败!"); } msg = "删除成功!"; return("ok"); } if ("Submit_EQAskBuyInfo".Equals(ac)) { pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["APPLYID"] = Convert.ToDecimal(data.Param["APPLYID"]); pa["STATUS"] = 1; Opt Del = OptContent.get("Submit_EQAskBuyInfo"); if (DaoTool.ExecuteNonQuery(dao, Del, pa) < 0) { throw new Exception("提交请购信息失败!"); } msg = "提交成功!"; return("ok"); } if ("EQAskBuyInfo_SHCG".Equals(ac)) { Opt stop = OptContent.get("EQAskBuyInfo_SHCG"); pa["APPLYID"] = Convert.ToDecimal(data.Param["APPLYID"]); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["SHNUM"] = Convert.ToDecimal(data.Param["SHNUM"]); pa["RECDATE"] = DateTime.Now; pa["SHDATE"] = Convert.ToDateTime(data.Param["SHDATE"]); pa["SHUSERID"] = Convert.ToDecimal(data.Param["SHUSERID"]); pa["STATUS"] = 6; if (data.Param["SHUSERNAME"] != null) { pa["SHUSERNAME"] = data.Param["SHUSERNAME"].ToString(); } else { pa["SHUSERNAME"] = null; } if (DaoTool.ExecuteNonQuery(dao, stop, pa) < 0) { throw new Exception("审核操作失败!"); } msg = "审核操作成功!"; return("ok"); } if ("EQAskBuyInfo_SHSB".Equals(ac)) { Opt start = OptContent.get("EQAskBuyInfo_SHSB"); pa["CHOSCODE"] = data.Param["CHOSCODE"].ToString(); pa["APPLYID"] = Convert.ToDecimal(data.Param["APPLYID"]); pa["STATUS"] = 2; if (DaoTool.ExecuteNonQuery(dao, start, pa) < 0) { throw new Exception("审核操作失败!"); } msg = "审核操作成功!"; return("ok"); } return("ok"); }
bool saveRunDetail(YiTian.db.Dao dao, YtService.data.OptData data) { List <Dictionary <string, object> > XiList = ObjConvert.GetParamsByStr(data.Param["XiBiaoXML"].ToString()); Opt opt2 = OptContent.get("SaveEQDepreciationDetailInfo_EQDepreciation"); foreach (Dictionary <string, object> d in XiList) { //不管折旧ID是否为空,我都先取值 d["DEPREID"] = d["折旧ID"]; d["CARDID"] = d["卡片ID"]; d["TOTALZJ"] = d["累计折旧"]; d["MONTHZJ"] = d["本月折旧"]; d["TOTALWORK"] = d["总工作量"]; d["TOTALEDWORK"] = d["累计工作量"]; d["MONTHWORK"] = d["本月工作量"]; d["MEMO"] = d["备注"]; d["CHOSCODE"] = data.Param["CHOSCODE"]; d["USERID"] = data.Param["USERID"]; d["USERNAME"] = data.Param["USERNAME"]; d["RECDATE"] = DateTime.Now; //如果不为空,肯定是编辑 那么就是进行更新即可 if (!d["折旧ID"].ToString().Equals("")) { if (DaoTool.Update(dao, opt2, d) < 0) { throw new Exception("保存折旧明细失败!" + dao.ErrMsg); } } else//折旧ID为空,那么这里的卡片id全部是新增的[包含编辑或者是新增过来] { //d["DEPREID"] = d["折旧ID"]; d["DEPREID"] = data.Param["DEPREID"]; if (DaoTool.Save(dao, opt2, d) < 0) { throw new Exception("新增折旧明细失败!" + dao.ErrMsg); } //这里对这些新增的卡片折旧进行数据更新[可能存在原本的折旧,工作量为空的情况] //if ((d["TOTALEDWORK"] != null || !d["TOTALEDWORK"].ToString().Equals("")) && (d["TOTALZJ"] != null || d["TOTALZJ"].ToString().Equals(""))) if ((!d["TOTALEDWORK"].ToString().Equals("")) && (!d["TOTALZJ"].ToString().Equals(""))) { // MessageBox.Show("1 全部不为null"); dao.ExecuteNonQuery("UPDATE LKEQ.EQCARDREC SET TOTALZJ=TOTALZJ +" + Convert.ToDouble(d["MONTHZJ"]) + " ,TOTALEDWORK=TOTALEDWORK + " + Convert.ToDouble(d["MONTHWORK"]) + " WHERE CARDID=" + d["CARDID"].ToString() + " AND CHOSCODE=" + d["CHOSCODE"].ToString()); } if ((!d["TOTALEDWORK"].ToString().Equals("")) && (d["TOTALZJ"].ToString().Equals(""))) { // MessageBox.Show("2 折旧为null"); dao.ExecuteNonQuery("UPDATE LKEQ.EQCARDREC SET TOTALZJ=" + Convert.ToDouble(d["MONTHZJ"]) + " ,TOTALEDWORK=TOTALEDWORK + " + Convert.ToDouble(d["MONTHWORK"]) + " WHERE CARDID=" + d["CARDID"].ToString() + " AND CHOSCODE=" + d["CHOSCODE"].ToString()); } if ((d["TOTALEDWORK"].ToString().Equals("")) && (!d["TOTALZJ"].ToString().Equals(""))) { // MessageBox.Show("3 工作量为null"); dao.ExecuteNonQuery("UPDATE LKEQ.EQCARDREC SET TOTALZJ=TOTALZJ +" + Convert.ToDouble(d["MONTHZJ"]) + " ,TOTALEDWORK=" + Convert.ToDouble(d["MONTHWORK"]) + " WHERE CARDID=" + d["CARDID"].ToString() + " AND CHOSCODE=" + d["CHOSCODE"].ToString()); } if ((d["TOTALEDWORK"].ToString().Equals("")) && (d["TOTALZJ"].ToString().Equals(""))) { // MessageBox.Show("4 全部为null"); dao.ExecuteNonQuery("UPDATE LKEQ.EQCARDREC SET TOTALZJ=" + Convert.ToDouble(d["MONTHZJ"]) + " ,TOTALEDWORK= " + Convert.ToDouble(d["MONTHWORK"]) + " WHERE CARDID=" + d["CARDID"].ToString() + " AND CHOSCODE=" + d["CHOSCODE"].ToString()); } } } return(true); }
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"); } }