예제 #1
0
        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("保存项目信息失败!");
                    }
                }
            }
        }
예제 #2
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            if (data.Sql == null || data.Sql == "")
            {
                msg = "没有传入有效的SQL参数,无法进行操作!";
                return("ok");
            }

            if (data.Sql.Equals("AddOrSaveEQUseManage"))
            {
                if (data.Param["USEID"] == null || data.Param["USEID"].ToString() == "")
                {
                    data.Param["USEID"] = DaoTool.Seq(dao, "LKEQ.SEQEQUse");
                    if (DaoTool.Save(dao, OptContent.get("SaveEQCardUseInfo_UseManagEdit"), data) < 0)
                    {
                        msg = "执行失败!";
                        throw new Exception("新增设备使用记录失败!" + dao.ErrMsg);
                    }
                    msg = "执行成功!";
                    return("ok");
                }
                if (DaoTool.Update(dao, OptContent.get("SaveEQCardUseInfo_UseManagEdit"), data) < 0)
                {
                    msg = "执行失败!";
                    throw new Exception("修改设备使用记录失败!" + dao.ErrMsg);
                }
                msg = "执行成功!";
                return("ok");
            }
            else
            {
                msg = "系统出错,请与管理员联系!";
                return("ok");
            }
        }
예제 #3
0
 public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
 {
     if (data.Sql.Equals("") || data.Sql == null)
     {
         msg = "SQL参数错误,无法继续进行操作!";
         return("ok");
     }
     if (data.Sql.Equals("QueRenYueJie"))
     {
         //月结的时候就是新增自动折旧【所以 折旧ID肯定为空】
         data.Param["DEPREID"] = DaoTool.Seq(dao, "LKEQ.SEQEQDepre");
         if (DaoTool.Save(dao, OptContent.get("SaveEQDepreciationInfo_EQDepreciation"), data) > -1)
         {
             saveRunDetail(dao, data);
             msg = "执行成功!";
             return("ok");
         }
         else
         {
             msg = "执行失败!";
             throw new Exception("新增折旧主表信息失败!" + dao.ErrMsg);
         }
     }
     else
     {
         msg = "系统出错,请与管理员联系!";
         return("ok");
     }
 }
예제 #4
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            if (data.Sql != null && data.Sql.Equals("Delete"))
            {
                Opt opt = OptContent.get("DeleteEQKind");
                if (DaoTool.ExecuteNonQuery(dao, opt, data) < 0)
                {
                    throw new Exception("删除设备类别信息失败!" + dao.ErrMsg);
                }
                msg = "设备类别已删除";
                return("ok");
            }

            if (data.Sql != null && data.Sql.Equals("Save"))
            {
                Opt opt = OptContent.get("SaveSetEQDetail");
                if (DaoTool.Save(dao, opt, data) > -1)
                {
                    msg = "设置管理的设备类别成功!";
                    return("ok");
                }
                else
                {
                    throw new Exception("设置管理的设备类别失败" + dao.ErrMsg);
                }
            }

            else
            {
                throw new Exception("设置管理的设备类别失败" + dao.ErrMsg);
            }
        }
예제 #5
0
 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("保存失败!");
         }
     }
 }
예제 #6
0
파일: Util.cs 프로젝트: yuonceruyi/LKEQ
        /*
         * 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);
        }
예제 #7
0
        /// <summary>
        /// 这里均为套用前面的设备折旧的保存
        /// </summary>
        /// <param name="dao"></param>
        /// <param name="data"></param>
        /// <returns></returns>

        bool saveRunDetail(YiTian.db.Dao dao, YtService.data.OptData data)
        {
            List <Dictionary <string, object> > XiList = ObjConvert.GetParamsByStr(data.Param["XmlDataList"].ToString());
            Opt opt2 = OptContent.get("SaveEQDepreciationDetailInfo_EQDepreciation");

            foreach (Dictionary <string, object> d in XiList)
            {
                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;
                //全部为新增过来的折旧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);
        }
예제 #8
0
파일: EQOutSvr.cs 프로젝트: yuonceruyi/LKEQ
        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);
        }
예제 #9
0
        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");
            }
        }
예제 #10
0
        bool savePlanDetail(YiTian.db.Dao dao, YtService.data.OptData data)
        {
            List <Dictionary <string, object> > mxli = ObjConvert.GetParamsByStr(data.Param["DanJuMx"].ToString());
            Opt opt2 = OptContent.get("SaveEQPlanDetailInfo");

            foreach (Dictionary <string, object> d in mxli)
            {
                //d["DETAILNO"] = DaoTool.Seq(dao, "LKWZ.SEQWZInDetail");
                d["PLANID"]      = data.Param["PLANID"];
                d["APPLYID"]     = d["请购ID"];
                d["EQID"]        = d["设备ID"];
                d["EQNAME"]      = d["设备名称"];
                d["GG"]          = d["规格"];
                d["XH"]          = d["型号"];
                d["XH"]          = d["型号"];
                d["COUNTRY"]     = d["国别"];
                d["UNITCODE"]    = d["单位编码"];
                d["NOWNUM"]      = d["当前库存数量"];
                d["NUM"]         = d["采购数量"];
                d["PRICE"]       = d["采购单价"];
                d["MONEY"]       = d["采购金额"];
                d["SCS"]         = d["生产商"];
                d["GYS"]         = d["供应商"];
                d["MEMO"]        = d["备注"];
                d["TXM"]         = d["条形码"];
                d["CHOSCODE"]    = data.Param["CHOSCODE"];
                d["STOCKFLOWNO"] = d["对应的库存流水表的流水号"];
                if (!d["行号"].ToString().Equals(""))
                {
                    d["ROWNO"] = d["行号"].ToString();
                    if (DaoTool.Update(dao, opt2, d) < 0)
                    {
                        throw new Exception("保存单据明细失败!");
                    }
                }
                else
                {
                    object rw = dao.Es(OptContent.get("EQGetROWNO").Sql, new object[] { data.Param["PLANID"] });
                    //data.Param["ROWNO"] = Convert.ToDecimal(rw) + 1;
                    d["ROWNO"] = Convert.ToDecimal(rw) + 1;
                    if (DaoTool.Save(dao, opt2, d) < 0)
                    {
                        throw new Exception("添加单据明细失败!");
                    }
                }
            }
            return(true);
        }
예제 #11
0
        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");
        }
예제 #12
0
 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);
             }
         }
     }
 }
예제 #13
0
        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["MAINTAINID"] == null || data.Param["MAINTAINID"].ToString() == "")
                {
                    data.Param["MAINTAINID"] = DaoTool.Seq(dao, "LKEQ.SEQEQMaintain");
                    if (DaoTool.Save(dao, OptContent.get("SaveEQMaintainInfo_EQKeepFitManag"), data) < 0)
                    {
                        msg = "执行失败!";
                        throw new Exception("新增设备保养记录失败!" + dao.ErrMsg);
                    }
                    msg = "新增保养记录成功!";
                    return("ok");
                }

                if (DaoTool.Update(dao, OptContent.get("SaveEQMaintainInfo_EQKeepFitManag"), data) < 0)
                {
                    msg = "执行失败!";
                    throw new Exception("修改设备保养记录失败!" + dao.ErrMsg);
                }
                msg = "修改保养记录成功!";
                return("ok");
            }

            else
            {
                msg = "系统出错,请与管理员联系!";
                return("ok");
            }
        }
예제 #14
0
파일: yljgWin.cs 프로젝트: yuonceruyi/LKEQ
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            string A = data.Sql;

            msg = "";
            if ("Del".Equals(A))
            {
                object p = dao.ExecuteScalar("select count(*) num from 用户表 where fixedflag=0 and cHosCode = '" + data.Param["choscode"] + "'");
                if (p != null && int.Parse(p.ToString()) > 0)
                {
                    throw new Exception("当前医疗机构已被使用,不能删除!");
                }

                object p2 = dao.ExecuteScalar("select count(*) num from sysdicthospital where parenthoscode = '" + data.Param["choscode"] + "'");
                if (p2 != null && int.Parse(p2.ToString()) > 0)
                {
                    throw new Exception("当前医疗机构还有子机构,不能删除!");
                }

                if (dao.ExecuteNonQuery("DELETE FROM sysdicthospital WHERE cHosCode='" + data.Param["choscode"] + "'") < 0)
                {
                    throw new Exception("删除医疗机构失败!");
                }

                //msg = "删除成功完成!";
            }
            else if ("SaveNHFare".Equals(A))  //保存农合诊疗及药品字典
            {
                List <Dictionary <string, object> > mxli = ObjConvert.GetParamsByStr(StringZip.Decompress(data.Param["nhdatamx"].ToString()));
                Opt NhZLData = OptContent.get("nh_FareZLDict");
                Opt NhYPData = OptContent.get("nh_FareYPDict");
                if (mxli == null || mxli.Count == 0)
                {
                    throw new Exception("无农合费用字典明细!");
                }

                string vchoscode = data.Param["cHosCode"].ToString();
                int    rank      = int.Parse(data.Param["rank"].ToString());

                if (dao.ExecuteNonQuery("DELETE FROM 农合药品表 WHERE cHosCode='" + vchoscode + "' and RANK=" + rank) < 0)
                {
                    throw new Exception("删除农合药品数据出错!");
                }
                if (dao.ExecuteNonQuery("DELETE FROM 农合项目表 WHERE cHosCode='" + vchoscode + "' and RANK=" + rank) < 0)
                {
                    throw new Exception("删除农合项目数据出错!");
                }

                foreach (Dictionary <string, object> pa in mxli)
                {
                    pa["rank"]     = rank;
                    pa["cHosCode"] = vchoscode;
                    if (pa["农合类别"].ToString().Equals("02") || pa["农合类别"].ToString().Equals("09"))
                    {
                        if (DaoTool.Save(dao, NhYPData, pa) < 0)
                        {
                            throw new Exception("保存农合费用字典药品明细失败!");
                        }
                    }
                    else
                    {
                        if (pa["农合类别"].ToString().Equals("05") || pa["农合类别"].ToString().Equals("10"))
                        {
                            if (DaoTool.Save(dao, NhYPData, pa) < 0)
                            {
                                throw new Exception("保存农合费用字典药品明细失败!");
                            }
                        }

                        if (DaoTool.Save(dao, NhZLData, pa) < 0)
                        {
                            throw new Exception("保存农合费用字典诊疗明细失败!");
                        }
                    }
                }
            }
            else if ("SaveICD10".Equals(A))  //保存农合疾病字典
            {
                List <Dictionary <string, object> > mxli = ObjConvert.GetParamsByStr(StringZip.Decompress(data.Param["icd10"].ToString()));
                Opt NhicdData = OptContent.get("nh_saveICDDict");
                if (mxli == null || mxli.Count == 0)
                {
                    throw new Exception("无农合疾病字典明细!");
                }

                dao.ExecuteNonQuery("truncate table 农合疾病表");  //永远返回-1

                foreach (Dictionary <string, object> pa in mxli)
                {
                    if (DaoTool.Save(dao, NhicdData, pa) < 0)
                    {
                        throw new Exception("保存农合疾病字典失败!");
                    }
                }
                dao.ExecuteNonQuery("update 农合疾病表 t set t.orderid=(select ordid from jb where 编码=t.农合编码) where exists(select * from jb where 编码=t.农合编码)");
            }

            else if ("SaveSS".Equals(A))  //保存农合手术字典
            {
                List <Dictionary <string, object> > mxli = ObjConvert.GetParamsByStr(StringZip.Decompress(data.Param["SS"].ToString()));
                Opt NhicdData = OptContent.get("nh_saveSSDict");
                if (mxli == null || mxli.Count == 0)
                {
                    throw new Exception("无农合手术字典明细!");
                }
                dao.ExecuteNonQuery("truncate table 农合手术表");

                foreach (Dictionary <string, object> pa in mxli)
                {
                    if (DaoTool.Save(dao, NhicdData, pa) < 0)
                    {
                        throw new Exception("保存农合手术字典失败!");
                    }
                }
            }

            else if ("CheckNHFare".Equals(A))  //保存并进行核对农合费用项目
            {
                List <Dictionary <string, object> > mxli = ObjConvert.GetParamsByStr(StringZip.Decompress(data.Param["nhdatamx"].ToString()));
                Opt NhZLData = OptContent.get("nh_FareZLDict");
                Opt NhYPData = OptContent.get("nh_FareYPDict");
                if (mxli == null || mxli.Count == 0)
                {
                    throw new Exception("无农合费用字典明细!");
                }

                string vchoscode = data.Param["cHosCode"].ToString();
                int    rank      = int.Parse(data.Param["rank"].ToString());

                if (dao.ExecuteNonQuery("DELETE FROM 农合药品表BK WHERE cHosCode='" + vchoscode + "' and RANK=" + rank) < 0)
                {
                    throw new Exception("删除农合药品BK数据出错!");
                }

                if (dao.ExecuteNonQuery("DELETE FROM 农合项目表BK WHERE cHosCode='" + vchoscode + "' and RANK=" + rank) < 0)
                {
                    throw new Exception("删除农合项目BK数据出错!");
                }

                if (dao.ExecuteNonQuery("Insert into 农合药品表BK(农合编码,农合名称,农合类别,保内外,报补比例,单位,rank,updatetime,基药标志,cHosCode) " +
                                        "Select 农合编码,农合名称,农合类别,保内外,报补比例,单位,rank,updatetime,基药标志,cHosCode from 农合药品表 WHERE cHosCode='" + vchoscode + "' and RANK=" + rank) < 0)
                {
                    throw new Exception("插入农合药品BK数据出错!");
                }

                if (dao.ExecuteNonQuery("Insert into 农合项目表BK(农合编码,农合名称,农合类别,保内外,报补比例,单位,rank,updatetime,基药标志,cHosCode) " +
                                        "Select 农合编码,农合名称,农合类别,保内外,报补比例,单位,rank,updatetime,基药标志,cHosCode from 农合项目表 WHERE cHosCode='" + vchoscode + "' and RANK=" + rank) < 0)
                {
                    throw new Exception("插入农合项目BK数据出错!");
                }

                if (dao.ExecuteNonQuery("DELETE FROM 农合药品表 WHERE cHosCode='" + vchoscode + "' and RANK=" + rank) < 0)
                {
                    throw new Exception("删除农合药品数据出错!");
                }
                if (dao.ExecuteNonQuery("DELETE FROM 农合项目表 WHERE cHosCode='" + vchoscode + "' and RANK=" + rank) < 0)
                {
                    throw new Exception("删除农合项目数据出错!");
                }

                foreach (Dictionary <string, object> pa in mxli)
                {
                    pa["rank"]     = rank;
                    pa["cHosCode"] = vchoscode;
                    if (pa["农合类别"].ToString().Equals("02") || pa["农合类别"].ToString().Equals("09"))
                    {
                        if (DaoTool.Save(dao, NhYPData, pa) < 0)
                        {
                            throw new Exception("保存农合费用字典药品明细失败!");
                        }
                    }
                    else
                    {
                        if (pa["农合类别"].ToString().Equals("05") || pa["农合类别"].ToString().Equals("10"))
                        {
                            if (DaoTool.Save(dao, NhYPData, pa) < 0)
                            {
                                throw new Exception("保存农合费用字典药品明细失败!");
                            }
                        }

                        if (DaoTool.Save(dao, NhZLData, pa) < 0)
                        {
                            throw new Exception("保存农合费用字典诊疗明细失败!");
                        }
                    }
                }
            }

            else if ("getLog".Equals(A))  //生成日志数据
            {
                dao.ExecuteNonQuery(" begin PCK_HisCommUse.sp_SaveNHChangeFareLog('" + data.Param["cHosCode"].ToString() + "' ," + data.Param["rank"].ToString() + "); end;");

                dao.ExecuteNonQuery(" begin PCK_HisCommUse.sp_CheckNHFareDict('" + data.Param["cHosCode"].ToString() + "' ," + data.Param["rank"].ToString() + "); end;");
                //   throw new Exception("生成农合更新日志失败!");
            }

            else if ("SavejmFare".Equals(A))  //保存安顺地区城镇医保费用目录
            {
                List <Dictionary <string, object> > mxli = ObjConvert.GetParamsByStr(StringZip.Decompress(data.Param["datamx"].ToString()));
                Opt fareData = OptContent.get("jm_savefareDict");
                if (mxli == null || mxli.Count == 0)
                {
                    throw new Exception("无居保目录明细!");
                }
                if (dao.ExecuteNonQuery("delete 地区居保目录 where choscode='" + data.Param["cHosCode"].ToString() + "'") < 0)
                {
                    throw new Exception("保存费用目录失败del!");
                }

                string bm;
                foreach (Dictionary <string, object> pa in mxli)
                {
                    bm = pa["大类编码"].ToString();
                    if (bm.Equals("81"))
                    {
                        pa["ypflag"] = 1;
                    }
                    else if (bm.Equals("11") || bm.Equals("12") || bm.Equals("13"))
                    {
                        pa["ypflag"] = 2;
                    }
                    else
                    {
                        pa["ypflag"] = 0;
                    }

                    pa["拼音码"]      = pa["拼音码"].ToString().ToLower();
                    pa["choscode"] = data.Param["cHosCode"].ToString();
                    if (DaoTool.Save(dao, fareData, pa) < 0)
                    {
                        throw new Exception("保存居保目录明细失败!");
                    }
                }
            }
            else if ("dictcopy".Equals(A))  //机构字典相互复制
            {
                if (dao.ExecuteNonQuery(" begin PCK_HisCommUse.sp_jgDictCopy('" +
                                        data.Param["fromHosCode"].ToString() + "' ,'" + data.Param["toHosCode"].ToString() + "' ,'" +
                                        data.Param["ypflag"].ToString() + "' ,'" + data.Param["nhcode"].ToString() + "'); end;") < 0)
                {
                    if (dao.ErrMsg != null)
                    {
                        throw new Exception(dao.ErrMsg);
                    }
                }
            }
            else if ("delyw".Equals(A))  //业务数据删除
            {
                if (dao.ExecuteNonQuery(" begin PCK_HisCommUse.sp_clearData('" + data.Param["choscode"].ToString() + "'," +
                                        data.Param["flag"].ToString() + "); end;") < 0)
                {
                    if (dao.ErrMsg != null)
                    {
                        throw new Exception(dao.ErrMsg);
                    }
                }
            }
            else if ("delypdict".Equals(A))  //药品字典删除
            {
                object p = dao.ExecuteScalar("select count(*) num from 库存药品 where cHosCode = " + data.Param["choscode"].ToString());
                if (p != null && int.Parse(p.ToString()) > 0)
                {
                    throw new Exception("当前医疗还有库存药品业务数据,不能直接删除字典!");
                }

                if (dao.ExecuteNonQuery("delete 药品字典表 where choscode='" + data.Param["choscode"].ToString() + "'") < 0)
                {
                    throw new Exception("药品字典删除失败!");
                }
            }
            else if ("setFlag".Equals(A))  //设置机构提示信息
            {
                if (dao.ExecuteNonQuery(" update sysdicthospital set flag=" + data.Param["flag"].ToString() + ",LICENCE='" +
                                        data.Param["info"].ToString() + "' where CHOSCODE='" + data.Param["cHosCode"].ToString() + "'") < 0)
                {
                    if (dao.ErrMsg != null)
                    {
                        throw new Exception(dao.ErrMsg);
                    }
                }
            }


            return("ok");
        }
예제 #15
0
        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");
        }
예제 #16
0
파일: Util.cs 프로젝트: yuonceruyi/LKEQ
        /// <summary>
        /// 保存员工持款信息
        /// </summary>
        /// <param name="dao"></param>
        /// <param name="data"></param>
        /// <param name="cklx">持款类型 1 挂号 2 门诊 3 住院 4 其他</param>
        /// <param name="je">收款金额</param>
        /// <param name="lsh">流水号 或就诊好</param>
        /// <param name="lx">类型</param>
        /// <param name="allowNull">是否允许持款为空</param>
        public static void SaveYgCk(Dao dao, OptData data, int cklx, decimal je, string lsh, string lx, bool allowNull)
        {
            Dictionary <string, object> param = DaoTool.Get(dao, OptContent.get("MZ_HaveCKList"), data);

            if (param == null)
            {
                if (!allowNull)
                {
                    throw new Exception("员工持款信息无效!");
                }
                data.Param["收款日期"]  = DateTime.Now;
                data.Param["累计持款额"] = je;
                data.Param["累计交款额"] = 0;
                if (cklx == 1)
                {
                    data.Param["挂号人数"] = 1;
                }
                if (cklx == 2)
                {
                    data.Param["门诊人数"] = 1;
                }
                if (DaoTool.Save(dao, OptContent.get("MZ_SaveYGCK"), data) < 0)
                {
                    throw new Exception("保存员工持款信息失败!");
                }
            }
            else
            {
                param["收款日期"]  = DateTime.Now;
                param["累计持款额"] = (new ObjItem(param["累计持款额"]).ToDecimal() + je);
                if (je > 0)
                {
                    if (cklx == 1)
                    {
                        param["挂号人数"] = (new ObjItem(param["挂号人数"]).ToInt() + 1);
                    }
                    if (cklx == 2)
                    {
                        param["门诊人数"] = (new ObjItem(param["门诊人数"]).ToInt() + 1);
                    }
                }
                else
                {
                    if (cklx == 1)
                    {
                        param["挂号人数"] = (new ObjItem(param["挂号人数"]).ToInt() - 1);
                    }
                    if (cklx == 2)
                    {
                        param["门诊人数"] = (new ObjItem(param["门诊人数"]).ToInt() - 1);
                    }
                    decimal ck = new ObjItem(param["累计持款额"]).ToDecimal() + je;
                    // if (ck < 0)
                    //throw new Exception("员工持款额不足于支付退款");
                }
                param["cHosCode"] = data.Param["cHosCode"];
                if (DaoTool.ExecuteNonQuery(dao, OptContent.get("MZ_UpdateYGCKINFO"), param) < 0)
                {
                    throw new Exception("更新员工持款信息失败!");
                }
            }
            data.Param["发生金额"] = je;
            data.Param["发生时间"] = DateTime.Now;
            data.Param["类型"]   = lx;
            data.Param["就诊号"]  = lsh;
            if (DaoTool.Save(dao, OptContent.get("MZ_SaveYGZJL"), data) < 0)
            {
                throw new Exception("保存员工资金流信息失败!");
            }
        }
예제 #17
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            string    ccode = data.Param["cHosCode"].ToString();
            DataTable dt    = new DataTable();

            dt.Columns.Add(new DataColumn("名称"));
            dt.Columns.Add(new DataColumn("值"));

            /*string supcode = "" ;
             * if (ccode.Trim().Length > 7)
             * {
             *  supcode = ccode.Substring(0, ccode.Length - 2);
             * }
             * else {
             *  supcode = ccode;
             * }
             * //获取农合前缀
             * DataRow  r =  dt.NewRow();
             * object qz = dao.ExecuteScalar("select nhperfix from SYSDICTHOSPITAL where cHosCode=?", new object[] { supcode });
             * if (qz == null)
             * {
             *  r["名称"] = "NHPREFIX";
             *  r["值"] = "";
             * }
             * else {
             *  r["名称"] = "NHPREFIX";
             *  r["值"] = qz.ToString();
             * }
             * dt.Rows.Add(r);
             *
             * object NHHOSCODE = dao.ExecuteScalar("select nhhospcode from SYSDICTHOSPITAL where cHosCode=?", new object[] { ccode });
             * DataRow rd = dt.NewRow();
             * if (NHHOSCODE == null)
             * {
             *  rd["名称"] = "NHHOSCODE";
             *  rd["值"] = "";
             * }
             * else
             * {
             *  rd["名称"] = "NHHOSCODE";
             *  rd["值"] = NHHOSCODE.ToString();
             * }
             * dt.Rows.Add(rd);
             *
             * object areacode = dao.ExecuteScalar("select areacode from SYSDICTHOSPITAL where cHosCode=?", new object[] { ccode });
             * DataRow rd1 = dt.NewRow();
             * if (areacode == null)
             * {
             *  rd1["名称"] = "AREACODE";
             *  rd1["值"] = "";
             * }
             * else
             * {
             *  rd1["名称"] = "AREACODE";
             *  rd1["值"] = areacode.ToString();
             * }
             * dt.Rows.Add(rd1);   */

            msg = "OK";

            DataTable hisYBParam = dao.find("select t.* from 医保设置表 t where t.choscode=?", new object[] { ccode });

            string    sql     = OptContent.get("Get_SuperCode").Sql;
            DataTable sup     = dao.find(sql, new object[] { ccode });
            string    wsjcode = sup.Rows[0][0].ToString();

            DataTable hisPa = dao.find("select ID,sysvalue from 系统参数 t where (choscode is null or choscode=? or choscode=?) and not exists" +
                                       "(select * from 系统参数 where (choscode=? or choscode=?) and t.id=id and length(nvl(t.choscode,' '))<length(choscode) )",
                                       new object[] { ccode, wsjcode, ccode, wsjcode });   //优先取医院设置的系统参数,再到卫生局设置的系统参数,再取全省系统参数

            DataRow rdwsj      = dt.NewRow();
            DataRow usnode     = dt.NewRow();
            DataRow rdnhperfix = dt.NewRow();

            rdwsj["名称"]      = "WSJCODE";
            usnode["名称"]     = "USEZBY";
            rdnhperfix["名称"] = "NHPERFIX";
            if (sup != null)
            {
                rdwsj["值"]      = sup.Rows[0][0].ToString();
                rdnhperfix["值"] = sup.Rows[0][2].ToString();
                if (sup.Rows[0][1] != null && sup.Rows[0][1].ToString().Length > 0)
                {
                    usnode["值"] = sup.Rows[0][1].ToString();
                }
                else
                {
                    usnode["值"] = "0";
                }
            }
            else
            {
                rdwsj["值"]      = "";
                usnode["值"]     = "0";
                rdnhperfix["值"] = "";
            }
            dt.Rows.Add(rdwsj);
            dt.Rows.Add(usnode);
            dt.Rows.Add(rdnhperfix);
            return(new object[] { dt, hisPa, sup, hisYBParam });
        }
예제 #18
0
파일: EQWare.cs 프로젝트: yuonceruyi/LKEQ
        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);
            }
        }
예제 #19
0
        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");
            }
        }
예제 #20
0
        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);
            }
        }
예제 #21
0
        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");
        }
예제 #22
0
        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");
        }
예제 #23
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            string ac = data.Sql;

            msg = "";
            if ("EditPwd".Equals(ac))
            {
                DataTable dt = dao.find("select a.userpassword from 用户表 a where   a.userid=? and a.choscode=? "
                                        , new object[] { data.Param["UserId"], data.Param["cHosCode"] }
                                        );
                if (dt == null || dt.Rows.Count == 0)
                {
                    throw new Exception("用户无效!");
                }
                string pd = "";
                if (dt.Rows[0][0] != null)
                {
                    pd = dt.Rows[0][0].ToString();
                }

                if (!data.Param["oldPwd"].ToString().Equals(pd))
                {
                    throw new Exception("原密码错误!");
                }
                if (data.Param.ContainsKey("sjh"))
                {
                    object obj1 = dao.ExecuteScalar("select count(*) from 用户表 a where a.mobilephone=?"
                                                    , new object[] { data.Param["sjh"] }
                                                    );
                    if (int.Parse(obj1.ToString()) > 0)
                    {
                        throw new Exception("您输入的手机号已被其他用户绑定,请重新输入!");
                    }
                    int i = dao.ExecuteNonQuery("update  用户表 set mobilephone=? where  userid=? and choscode=?"
                                                , new object[] { data.Param["sjh"], data.Param["UserId"], data.Param["cHosCode"] }
                                                );
                    if (i < 0)
                    {
                        throw new Exception("帮定手机号失败!");
                    }
                }
                int b = dao.ExecuteNonQuery("update  用户表 set userpassword=? where  userid=? and choscode=?"
                                            , new object[] { data.Param["Pwd"], data.Param["UserId"], data.Param["cHosCode"] }
                                            );
                if (b < 0)
                {
                    throw new Exception("修改用户密码失败!");
                }
                msg = "修改密码成功!";
            }
            else if ("RegCardSet".Equals(ac))
            {
                if (!data.Param.ContainsKey("密码"))
                {
                    throw new Exception("输入的密码无效请重新输入!");
                }
                string pwd = data.Param["密码"].ToString();
                object p   = dao.ExecuteScalar("select passwd from 密码 where id=4");
                if (p != null)
                {
                    if (!p.ToString().Equals(pwd))
                    {
                        throw new Exception("输入的密码无效请重新输入!");
                    }
                }
                else
                {
                    throw new Exception("输入的密码无效请重新输入!");
                }

                DataTable dt = dao.find("select 1 from 就诊卡范围表 where (开始号 between ? and ? or 结束号 between ? and ?) and length(开始号)=?"
                                        , new object[] { data.Param["开始号"], data.Param["结束号"], data.Param["开始号"], data.Param["结束号"], data.Param["长度"] }
                                        );
                if (dt != null && dt.Rows.Count > 0)
                {
                    throw new Exception("输入的就诊卡号已被领用过,请重新录入号码");
                }

                Opt op = OptContent.get("sys_SaveRegCard");
                if (DaoTool.Save(dao, op, data) > -1)
                {
                    msg = "保存就诊卡数据成功!";
                }
                else
                {
                    throw new Exception("就诊卡领用失败");
                }
            }
            else if ("SaveOpLog".Equals(ac))
            {
                if (dao.ExecuteNonQuery("insert into 特殊操作日志(choscode,chosname,操作功能,操作员,操作机器,辅助说明) values('" +
                                        data.Param["choscode"].ToString() + "','" + data.Param["chosname"].ToString() + "'," +
                                        data.Param["funID"].ToString() + ",'" + data.Param["username"].ToString() + "','" +
                                        data.Param["hostinfo"].ToString() + "','" + data.Param["说明"].ToString() + "')") < 0)
                {
                    throw new Exception("保存操作日志错误." + dao.ErrMsg);
                }
                else
                {
                    msg = "ok";
                }
            }


            return("ok");
        }
예제 #24
0
        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");
        }
예제 #25
0
        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");
            }
        }
예제 #26
0
        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");
        }
예제 #27
0
        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");
        }
예제 #28
0
        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");
            }
        }
예제 #29
0
        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");
        }
예제 #30
0
        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");
        }