Exemple #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("保存项目信息失败!");
                    }
                }
            }
        }
Exemple #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");
            }
        }
Exemple #3
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("保存失败!");
         }
     }
 }
Exemple #4
0
        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);
        }
Exemple #5
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);
        }
Exemple #6
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");
            }
        }
Exemple #7
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");
        }
Exemple #8
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);
             }
         }
     }
 }
Exemple #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["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");
            }
        }
Exemple #10
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");
        }
Exemple #11
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");
            }
        }
Exemple #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 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);
            }
        }
Exemple #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["NOID"] == null || data.Param["NOID"].ToString() == "")
                {
                    data.Param["NOID"] = DaoTool.Seq(dao, "LKEQ.SEQEQXZNo");
                    Opt op = OptContent.get("SaveEQAccount");

                    if (DaoTool.Save(dao, op, data) < 0)
                    {
                        msg = "执行失败!";
                        throw new Exception("新增设备下账记录失败!" + dao.ErrMsg);
                    }
                    msg = "新增检查记录成功!";
                    return("ok");
                }

                if (DaoTool.Update(dao, OptContent.get("SaveEQAccount"), data) < 0)
                {
                    msg = "执行失败!";
                    throw new Exception("修改设备下账记录失败!" + dao.ErrMsg);
                }
                msg = "修改下账记录成功!";
                return("ok");
            }
            if (data.Sql != null && data.Sql.Equals("JDPass"))
            {
                data.Param["JDDATE"] = DateTime.Now;
                if (DaoTool.Update(dao, OptContent.get("SaveEQAccount"), data) > -1)
                {
                    msg = "鉴定下账信息成功!";
                    return("ok");
                }
                else
                {
                    throw new Exception("鉴定下账信息失败!" + dao.ErrMsg);
                }
            }
            if (data.Sql != null && data.Sql.Equals("JDNo"))
            {
                if (DaoTool.Update(dao, OptContent.get("SaveEQAccount"), data) > -1)
                {
                    msg = "鉴定下账信息成功!";
                    return("ok");
                }
                else
                {
                    throw new Exception("鉴定下账信息失败!" + dao.ErrMsg);
                }
            }
            if (data.Sql != null && data.Sql.Equals("SHPass"))
            {
                Opt op = OptContent.get("ChangTheStatus_EQAccount");
                data.Param["SHDATE"] = DateTime.Now;
                if (DaoTool.Update(dao, OptContent.get("SaveEQAccount"), data) > -1)
                {
                    if (DaoTool.ExecuteNonQuery(dao, op, data) > 0)
                    {
                        msg = "审核下账信息成功!";

                        return("ok");
                    }
                    else
                    {
                        throw new Exception("修改卡片设备状态失败!" + dao.ErrMsg);
                    }
                }
                else
                {
                    throw new Exception("审核下账信息失败!" + dao.ErrMsg);
                }
            }

            if (data.Sql != null && data.Sql.Equals("SHNo"))
            {
                if (DaoTool.Update(dao, OptContent.get("SaveEQAccount"), data) > -1)
                {
                    msg = "审核下账信息成功!";
                    return("ok");
                }
                else
                {
                    throw new Exception("审核下账信息失败!" + dao.ErrMsg);
                }
            }

            else
            {
                msg = "系统出错,请与管理员联系!";
                return("ok");
            }
        }
Exemple #14
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");
        }
Exemple #15
0
        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);
            }
        }
Exemple #16
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");
        }
Exemple #17
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            if (data.Sql != null && data.Sql.Equals("EQPurchasePlanDelete"))//删除主表
            {
                data.Param["STATUS"] = 0;
                if (DaoTool.Update(dao, OptContent.get("SaveEQPlanMainInfo"), data) > -1)
                {
                    msg = "删除采购计划信息成功!";
                    return("ok");
                }
                else
                {
                    throw new Exception("删除采购计划信息失败!" + dao.ErrMsg);
                }
            }
            if (data.Sql != null && data.Sql.Equals("PlanDanUpdate_SH"))
            {
                Opt op = OptContent.get("SaveEQPlanMainInfo");

                if (data.Param.ContainsKey(op.Key))
                {
                    if (DaoTool.Update(dao, op, data) > -1)
                    {
                        // saveRunDetail(dao, data);
                        //if (data.Param["STATUS"].ToString() == "2")
                        //{

                        //}

                        msg = "审核采购计划信息成功!";
                        return("ok");
                    }
                    else
                    {
                        throw new Exception("审核采购计划信息失败!" + dao.ErrMsg);
                    }
                }
            }
            if (data.Sql != null && data.Sql.Equals("PlanDanUpdata_Submit"))
            {
                Opt op = OptContent.get("SaveEQPlanMainInfo");

                if (data.Param.ContainsKey(op.Key))
                {
                    if (DaoTool.Update(dao, op, data) > -1)
                    {
                        msg = "提交采购计划信息成功!";
                        return("ok");
                    }
                    else
                    {
                        throw new Exception("提交采购计划信息失败!" + dao.ErrMsg);
                    }
                }
            }
            if (data.Sql != null && data.Sql.Equals("PlanDanEQdelete"))
            {
                //删除采购计划细表记录
                if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DeleteEQPlanDetailInfo"), data) < 0)
                {
                    throw new Exception("删除采购设备信息失败!");
                }
                //更新采购计划主表信息
                if (DaoTool.Update(dao, OptContent.get("SaveEQPlanMainInfo"), data) < 0)
                {
                    throw new Exception("保存采购计划单失败!" + dao.ErrMsg);
                }
                msg = "删除采购设备信息成功!";
                return("ok");
            }
            //if (data.Sql != null && data.Sql.Equals("UpdateWZPlanDan"))
            //{
            //    if (DaoTool.Update(dao, OptContent.get("SaveWZPlanMainInfo"), data) > -1)
            //    {
            //        //savePlanDetail(dao, data);
            //        msg = "保存采购计划信息成功!";
            //        return "ok";
            //    }
            //    else
            //    {
            //        throw new Exception("保存采购计划信息失败!" + dao.ErrMsg);
            //    }
            //}

            if (data.Sql != null && data.Sql.Equals("PlanDanSave"))
            {
                Opt op = OptContent.get("SaveEQPlanMainInfo");
                if (data.Param.ContainsKey(op.Key))
                {
                    if (DaoTool.Update(dao, op, data) > -1)
                    {
                        savePlanDetail(dao, data);
                        msg = "保存设备计划信息成功!";
                        return("ok");
                    }
                    else
                    {
                        throw new Exception("保存设备计划信息失败!" + dao.ErrMsg);
                    }
                }
                else
                {
                    data.Param["PLANID"] = DaoTool.Seq(dao, "LKEQ.SEQEQPlan");
                    if (DaoTool.Save(dao, op, data) > -1)
                    {
                        savePlanDetail(dao, data);
                        msg = "添加设备计划成功!";
                        return("ok");
                    }
                    else
                    {
                        throw new Exception("添加设备计划失败!" + dao.ErrMsg);
                    }
                }
            }
            msg = "保存成功!";
            return("ok");
        }
Exemple #18
0
        bool saveRunDetail(YiTian.db.Dao dao, YtService.data.OptData data)
        {
            List <Dictionary <string, object> > XiList = ObjConvert.GetParamsByStr(data.Param["XiBiaoXML"].ToString());
            Opt opt2 = OptContent.get("SaveEQDepreciationDetailInfo_EQDepreciation");

            foreach (Dictionary <string, object> d in XiList)
            {
                //不管折旧ID是否为空,我都先取值
                d["DEPREID"]     = d["折旧ID"];
                d["CARDID"]      = d["卡片ID"];
                d["TOTALZJ"]     = d["累计折旧"];
                d["MONTHZJ"]     = d["本月折旧"];
                d["TOTALWORK"]   = d["总工作量"];
                d["TOTALEDWORK"] = d["累计工作量"];
                d["MONTHWORK"]   = d["本月工作量"];
                d["MEMO"]        = d["备注"];
                d["CHOSCODE"]    = data.Param["CHOSCODE"];
                d["USERID"]      = data.Param["USERID"];
                d["USERNAME"]    = data.Param["USERNAME"];
                d["RECDATE"]     = DateTime.Now;

                //如果不为空,肯定是编辑 那么就是进行更新即可
                if (!d["折旧ID"].ToString().Equals(""))
                {
                    if (DaoTool.Update(dao, opt2, d) < 0)
                    {
                        throw new Exception("保存折旧明细失败!" + dao.ErrMsg);
                    }
                }
                else//折旧ID为空,那么这里的卡片id全部是新增的[包含编辑或者是新增过来]
                {
                    //d["DEPREID"] = d["折旧ID"];
                    d["DEPREID"] = data.Param["DEPREID"];
                    if (DaoTool.Save(dao, opt2, d) < 0)
                    {
                        throw new Exception("新增折旧明细失败!" + dao.ErrMsg);
                    }

                    //这里对这些新增的卡片折旧进行数据更新[可能存在原本的折旧,工作量为空的情况]
                    //if ((d["TOTALEDWORK"] != null || !d["TOTALEDWORK"].ToString().Equals("")) && (d["TOTALZJ"] != null || d["TOTALZJ"].ToString().Equals("")))
                    if ((!d["TOTALEDWORK"].ToString().Equals("")) && (!d["TOTALZJ"].ToString().Equals("")))
                    {
                        // MessageBox.Show("1 全部不为null");
                        dao.ExecuteNonQuery("UPDATE LKEQ.EQCARDREC SET TOTALZJ=TOTALZJ +" + Convert.ToDouble(d["MONTHZJ"]) + " ,TOTALEDWORK=TOTALEDWORK + " + Convert.ToDouble(d["MONTHWORK"]) + "  WHERE CARDID=" + d["CARDID"].ToString() + " AND CHOSCODE=" + d["CHOSCODE"].ToString());
                    }
                    if ((!d["TOTALEDWORK"].ToString().Equals("")) && (d["TOTALZJ"].ToString().Equals("")))
                    {
                        //  MessageBox.Show("2 折旧为null");
                        dao.ExecuteNonQuery("UPDATE LKEQ.EQCARDREC SET TOTALZJ=" + Convert.ToDouble(d["MONTHZJ"]) + " ,TOTALEDWORK=TOTALEDWORK + " + Convert.ToDouble(d["MONTHWORK"]) + "  WHERE CARDID=" + d["CARDID"].ToString() + " AND CHOSCODE=" + d["CHOSCODE"].ToString());
                    }

                    if ((d["TOTALEDWORK"].ToString().Equals("")) && (!d["TOTALZJ"].ToString().Equals("")))
                    {
                        // MessageBox.Show("3 工作量为null");
                        dao.ExecuteNonQuery("UPDATE LKEQ.EQCARDREC SET TOTALZJ=TOTALZJ +" + Convert.ToDouble(d["MONTHZJ"]) + " ,TOTALEDWORK=" + Convert.ToDouble(d["MONTHWORK"]) + "  WHERE CARDID=" + d["CARDID"].ToString() + " AND CHOSCODE=" + d["CHOSCODE"].ToString());
                    }

                    if ((d["TOTALEDWORK"].ToString().Equals("")) && (d["TOTALZJ"].ToString().Equals("")))
                    {
                        // MessageBox.Show("4 全部为null");
                        dao.ExecuteNonQuery("UPDATE LKEQ.EQCARDREC SET TOTALZJ=" + Convert.ToDouble(d["MONTHZJ"]) + " ,TOTALEDWORK= " + Convert.ToDouble(d["MONTHWORK"]) + "  WHERE CARDID=" + d["CARDID"].ToString() + " AND CHOSCODE=" + d["CHOSCODE"].ToString());
                    }
                }
            }
            return(true);
        }
Exemple #19
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            if (data.Sql != null && data.Sql.Equals("TingYong"))
            {
                if (DaoTool.ExecuteNonQuery(dao, OptContent.get("QiTingEQInOutInfo_EQInOutManag"), data) > 0)
                {
                    msg = "停用该条设备入出库记录成功!";
                    return("ok");
                }
                else
                {
                    throw new Exception("停用该条设备入出库信息失败!" + dao.ErrMsg);
                }
            }


            if (data.Sql != null && data.Sql.Equals("QiYong"))
            {
                if (DaoTool.ExecuteNonQuery(dao, OptContent.get("QiTingEQInOutInfo_EQInOutManag"), data) > 0)
                {
                    msg = "启用该条设备入出库记录成功!";
                    return("ok");
                }
                else
                {
                    throw new Exception("启用该条设备入出库记录失败!" + dao.ErrMsg);
                }
            }


            if (data.Sql != null && data.Sql.Equals("Del"))
            {
                if (DaoTool.ExecuteScalar(dao, OptContent.get("IfHaveUseEQInOut"), data).ToInt() > 0)
                {
                    msg = "该条设备入出库记录已被使用,无法删除!";
                    return("ok");
                }
                if (DaoTool.ExecuteNonQuery(dao, OptContent.get("DelEQInOutInfo_EQInOutManag"), data) > 0)
                {
                    msg = "删除该条设备入出库记录成功!";
                    return("ok");
                }
                else
                {
                    throw new Exception("删除该条设备入出库记录失败!" + dao.ErrMsg);
                }
            }


            //----------------------------------这里的代码有些重复,有时间再进行复用操作【关键是msg 这里怎么办?】-------------------------------


            if (data.Sql != null && data.Sql.Equals("Modify"))
            {
                //惯例: 名称是否重复 // 相同的医疗机构编码、入出标志、操作标志的记录里,只能有一条记录的该值为1
                if (DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveRepeatInOutName"), data).ToInt() > 0)
                {
                    msg = "存在相同的设备入出库名称,请修改后再进行操作";
                    return("ok");
                }
                //MessageBox.Show("执行到修改2");
                if (data.Param["IFDEFAULT"].ToString() == "1" && DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveMoreDefault_EQInOutManag"), data).ToInt() > 0)
                {
                    msg = "相同的医疗机构编码、入出标志、操作标志的记录里,只能有一条记录的默认值为是!";
                    return("ok");
                }
                //MessageBox.Show("执行到修改3");
                //验证:对于一个医疗机构来说,其操作类别为(1:调拨;2:申领;3:盘点)的出入库类型记录
                //其入库和出库的类型记录,分别各有且只能有一条记录;
                //如医疗机构甲,其调拨的入库方式,只能有一种方式,其调拨的出库方式,也只能有一种方式;
                if (data.Param["OPFLAG"].ToString() != "0" && DaoTool.ExecuteScalar(dao, OptContent.get("IsSingleInOutOfCHOS"), data).ToInt() > 0)
                {
                    //针对1,2,3
                    msg = "操作为调拨,申领,盘点的记录,其出库与入库的记录只能各有一条,请修改后再进行操作";
                    return("ok");
                }
                //MessageBox.Show("执行到修改4");

                if (DaoTool.Update(dao, OptContent.get("SaveEQInOutInfo"), data) < 0)
                {
                    throw new Exception("修改该条设备入出库记录失败!");
                }
                msg = "修改该条设备入出库记录成功!";
                return("ok");
            }



            if (data.Sql != null && data.Sql.Equals("Add"))
            {
                //首先设置好ID:
                data.Param["IOID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIO");

                //验证是否重名
                if (DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveRepeatInOutName"), data).ToInt() > 0)
                {
                    msg = "存在相同的设备入出库名称,请修改后再进行操作";
                    return("ok");
                }

                if (data.Param["IFDEFAULT"].ToString() == "1" && DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveMoreDefault_EQInOutManag"), data).ToInt() > 0)
                {
                    msg = "相同的医疗机构编码、入出标志、操作标志的记录里,只能有一条记录的默认值为是!";
                    return("ok");
                }
                if (data.Param["OPFLAG"].ToString() != "0" && DaoTool.ExecuteScalar(dao, OptContent.get("IsSingleInOutOfCHOS"), data).ToInt() > 0)
                {
                    //针对1,2,3
                    msg = "操作为调拨,申领,盘点的记录,其出库与入库的记录只能各有一条,请修改后再进行操作";
                    return("ok");
                }
                if (DaoTool.Save(dao, OptContent.get("SaveEQInOutInfo"), data) < 0)
                {
                    throw new Exception("新增设备入出库记录失败!");
                }
                msg = "新增设备入出库记录成功!";
                return("ok");
            }

            if (data.Sql != null && data.Sql.Equals("CopyChoscodeData"))
            {
                //验证本机构是否包含数据
                int count = DaoTool.ExecuteScalar(dao, OptContent.get("IsHaveAnyDataEQInOut_EQInOutManag"), data).ToInt();
                if (count == 0)
                {
                    DataTable dt = DaoTool.FindDT(dao, OptContent.get("FindEQInOutcode0_EQInOutManag"), data);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (DataRow r in dt.Rows)
                        {
                            int statuscode_int = DaoTool.ExecuteScalar(dao, OptContent.get("GetEQInOutIDMax"), data).ToInt() + 1;
                            data.Param["IOID"]         = DaoTool.Seq(dao, "LKEQ.SEQEQIO");
                            data.Param["IONAME"]       = r["IONAME"];
                            data.Param["PYCODE"]       = r["PYCODE"];
                            data.Param["WBCODE"]       = r["WBCODE"];
                            data.Param["IFUSE"]        = r["IFUSE"];
                            data.Param["RECIPECODE"]   = r["RECIPECODE"];
                            data.Param["RECIPELENGTH"] = r["RECIPELENGTH"];
                            data.Param["RECIPEYEAR"]   = r["RECIPEYEAR"];
                            data.Param["RECIPEMONTH"]  = r["RECIPEMONTH"];
                            data.Param["MEMO"]         = r["MEMO"];
                            data.Param["IOFLAG"]       = r["IOFLAG"];
                            data.Param["OPFLAG"]       = r["OPFLAG"];
                            data.Param["IFDEFAULT"]    = r["IFDEFAULT"];
                            data.Param["RECDATE"]      = DateTime.Now;
                            if (DaoTool.Save(dao, OptContent.get("SaveEQInOutInfo"), data) < 0)
                            {
                                throw new Exception("复制失败!" + dao.ErrMsg);
                            }
                        }
                    }
                    msg = "复制成功!";
                    return("ok");
                }
                else
                {
                    msg = "已存在本医疗结构的出入类型,复制失败!";
                    return("ok");
                }
            }
            else
            {
                msg = "系统故障,请与管理员联系!";
                return("ok");
            }
        }
Exemple #20
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            #region 前期的一些绑定
            if (data.Sql == null)
            {
                msg = "缺省SQL参数,无法再服务端进行操作!";
                return("ok");
            }
            if (data.Sql != null && data.Sql.Equals("BindWareName"))
            {
                msg = "绑定成功";
                return(DaoTool.FindDT(dao, OptContent.get("FindWareNameInEQDiaoBo"), data));
            }

            if (data.Sql != null && data.Sql.Equals("BindOutName"))
            {
                msg = "绑定成功";
                return(DaoTool.FindDT(dao, OptContent.get("FindOutNameInEQDiaoBo"), data));
            }
            if (data.Sql != null && data.Sql.Equals("BindUnitCode"))
            {
                msg = "绑定成功";
                return(DaoTool.FindDT(dao, OptContent.get("FindUnitNameInEQDiaoBo"), data));
            }
            if (data.Sql != null && data.Sql.Equals("BindEQIDInfo"))
            {
                msg = "绑定成功";
                return(DaoTool.FindDT(dao, OptContent.get("FindEQIdNameInEQDiaoBo"), data));
            }

            //包含 提交审核与软删除
            if (data.Sql != null && data.Sql == "SubmitShenHeOrDel")
            {
                if (DaoTool.ExecuteNonQuery(dao, OptContent.get("submitShenHeInfo"), data) < 0)
                {
                    throw new Exception("更改设备调拨的审核状态信息失败!");
                }
                msg = "执行成功!";
                return("ok");
            }

            #endregion

            //对主表的操作
            if (data.Sql != null && data.Sql.Equals("ModifyZhuOrAdd"))
            {
                //1、对OUTMAIN进行更新操作
                if (data.Param["RECIPECODE"] == null || data.Param["RECIPECODE"].ToString() == "")
                {
                    DataTable dt = DaoTool.FindDT(dao, OptContent.get("GetRecipeCodeInEQOutInfo"), data);
                    if (dt.Rows.Count <= 0 || dt == null)
                    {
                        throw new Exception("无法查找到单据前缀,是否调拨方式数据错误" + dao.ErrMsg);
                    }
                    DataRow row = dt.Rows[0];
                    data.Param["RECIPECODE"] = Recipecode(row["RECIPECODE"].ToString(), Convert.ToInt32(row["RECIPEYEAR"]), Convert.ToInt32(row["RECIPEMONTH"]), Convert.ToInt32(row["RECIPELENGTH"]));
                    data.Param.Add("RECIPECODEHelp", data.Param["RECIPECODE"].ToString() + "%");
                    data.Param["RECIPECODE"] = data.Param["RECIPECODE"] + DaoTool.ExecuteScalar(dao, OptContent.get("GetrecipeCodeNo"), data).ToInt().ToString("D2");
                }

                if (data.Param["OUTID"] == null || data.Param["OUTID"].ToString() == "")
                {
                    data.Param["OUTID"] = DaoTool.Seq(dao, "LKEQ.SEQEQOut");
                    OutIdHelp           = data.Param["OUTID"].ToString();
                    if (DaoTool.Save(dao, OptContent.get("ModifyOutMainInfo"), data) < 0)
                    {
                        msg = "执行失败!";
                        throw new Exception("新增设备调拨的主表信息失败!" + dao.ErrMsg);
                    }
                    SaveDiaoBoXiInfo(dao, data);
                    msg = "执行成功!";
                    return("ok");
                }
                if (DaoTool.Update(dao, OptContent.get("ModifyOutMainInfo"), data) < 0)
                {
                    msg = "执行失败!";
                    throw new Exception("修改设备调拨的主表信息失败!" + dao.ErrMsg);
                }
                SaveDiaoBoXiInfo(dao, data);
                msg = "执行成功!";
                return("ok");
            }



            // ModifyOrAddXi
            if (data.Sql.Equals("ModifyOrAddXi"))
            {
                //如果出库ID为空的话  肯定是新增操作
                if (data.Param["OUTID"].ToString().Trim() == "" || data.Param["OUTID"] == null)
                {
                    data.Param["OUTID"]    = OutIdHelp;
                    data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQOutDetail");
                    if (DaoTool.Save(dao, OptContent.get("ModifyOutXiBiaoInfo"), data) < 0)
                    {
                        throw new Exception("修改设备调拨的出库细表失败!" + dao.ErrMsg);
                    }
                    msg = "执行成功!";
                    return("ok");
                }
                else
                {
                    if (data.Param["DETAILNO"] == null || data.Param["DETAILNO"].ToString().Trim() == "")
                    {
                        //该行为新增的数据  新增完之后返回
                        data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQOutDetail");
                        if (DaoTool.Save(dao, OptContent.get("ModifyOutXiBiaoInfo"), data) < 0)
                        {
                            msg = "执行失败!";
                            throw new Exception("修改设备调拨的出库细表失败!" + dao.ErrMsg);
                        }
                        msg = "执行成功!";
                        return("ok");
                    }
                    if (DaoTool.Update(dao, OptContent.get("ModifyOutXiBiaoInfo"), data) < 0)
                    {
                        msg = "执行失败!";
                        throw new Exception("修改设备调拨的出库细表失败!" + dao.ErrMsg);
                    }
                    msg = "执行成功!";
                    //能够retrun ok 说明 要么是前面新增的对了,要么是后面的修改正确,不然都是throw出去
                    return("ok");
                }
            }

            if (data.Sql != null && data.Sql.Equals("ShenHeOutEQInfo"))
            {
                if (DaoTool.ExecuteNonQuery(dao, OptContent.get("ShenHeEQOutAndDetailInfo"), data) > 0)
                {
                    msg = "执行成功!";
                    return("ok");
                }
                else
                {
                    msg = "执行失败!";
                    throw new Exception("审核过程中,数据库操作失败!" + dao.ErrMsg);
                }
            }

            if (data.Sql.Equals("SendOutId"))
            {
                OutId = data.Param["OUTID"].ToString();
                msg   = "执行成功!";
                return("ok");
            }



            //===================================审核部分===============================

            //入库主表
            if (data.Sql != null && data.Sql.Equals("InsertInMain"))
            {
                data.Param["INID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIN");

                InIdHelp = data.Param["INID"].ToString();
                DataTable dt = DaoTool.FindDT(dao, OptContent.get("GetRecipeCodeInEQOutInfo"), data);
                if (dt.Rows.Count <= 0 || dt == null)
                {
                    throw new Exception("无法查找到单据前缀,是否调拨方式数据错误" + dao.ErrMsg);
                }
                DataRow row = dt.Rows[0];
                data.Param["RECIPECODE"] = Recipecode(row["RECIPECODE"].ToString(), Convert.ToInt32(row["RECIPEYEAR"]), Convert.ToInt32(row["RECIPEMONTH"]), Convert.ToInt32(row["RECIPELENGTH"]));
                data.Param.Add("RECIPECODEHelp", data.Param["RECIPECODE"].ToString() + "%");
                data.Param["RECIPECODE"] = data.Param["RECIPECODE"] + DaoTool.ExecuteScalar(dao, OptContent.get("GetrecipeCodeNo"), data).ToInt().ToString("D2");

                //一次审核,只生成一次入库主表的单据号
                RecipeCodeInMain = data.Param["RECIPECODE"].ToString();

                if (DaoTool.Save(dao, OptContent.get("SaveEQInMainInfoCX"), data) < 0)
                {
                    throw new Exception("入库主表信息执行失败" + dao.ErrMsg);
                }
                //记得更新对应出库主表的INID
                dao.ExecuteNonQuery("UPDATE LKEQ.EQOUTMAIN SET INID=" + data.Param["INID"].ToString() + " WHERE CHOSCODE=" + data.Param["CHOSCODE"] + "  AND OUTID=" + OutId);
                msg = "执行成功!";
                return("ok");
            }


            //库存主表   可能不会执行  【只有在库存主表,不存在该设备的信息】
            if (data.Sql != null && data.Sql.Equals("InsertStockMain"))
            {
                data.Param["STOCKID"] = DaoTool.Seq(dao, "LKEQ.SEQEQSTOCK");
                //在每执行一次对库存总表的插入,都会更新一次stockid,否则,就是针对一个stockid的插入流水了
                StockId = data.Param["STOCKID"].ToString();

                if (DaoTool.Save(dao, OptContent.get("SaveEQStock"), data) < 0)
                {
                    throw new Exception("库存主表信息执行失败!" + dao.ErrMsg);
                }
                msg = "执行成功!";
                return("ok");
            }

            //库存流水
            if (data.Sql != null && data.Sql.Equals("InsertStockDetail"))
            {
                data.Param["FLOWNO"]     = DaoTool.Seq(dao, "LKEQ.SEQEQSTOCKDETAIL");
                StockFlowNo              = data.Param["FLOWNO"].ToString();
                data.Param["RECIPECODE"] = RecipeCodeInMain;
                if (data.Param["STOCKID"] == null || data.Param["STOCKID"].ToString() == "")
                {
                    data.Param["STOCKID"] = StockId;//在客户端已经经过了判断,要么存在,要么不存在就是库存总表进行了新的插入,直接获取
                }

                if (DaoTool.Save(dao, OptContent.get("SaveEQStockDetail"), data) < 0)
                {
                    throw new Exception("库存流水信息执行失败!" + dao.ErrMsg);
                }
                msg = "执行成功!";
                return("ok");
            }

            //入库细表
            if (data.Sql != null && data.Sql.Equals("InsertEQInDetail"))
            {
                data.Param["DETAILNO"]    = DaoTool.Seq(dao, "LKEQ.SEQEQINDETAIL");
                data.Param["STOCKFLOWNO"] = StockFlowNo.ToString();
                data.Param["INID"]        = InIdHelp;
                if (DaoTool.Save(dao, OptContent.get("SaveEQInDetail"), data) < 0)
                {
                    throw new Exception("入库细表信息执行失败!" + dao.ErrMsg);
                }
                msg = "执行成功!";
                return("ok");
            }



            //=================================关于冲销的操作==========================

            //原始数据的状态更改
            if (data.Sql != null && data.Sql.Equals("ChongXiaoRuChu"))
            {
                if (DaoTool.ExecuteNonQuery(dao, OptContent.get("ChongXiaoChuKuStatusChange"), data) < 0)
                {
                    throw new Exception("修改出库主表冲销状态失败!" + dao.ErrMsg);
                }
                data.Param.Add("INID", dao.Es("SELECT INID FROM LKEQ.EQOUTMAIN WHERE OUTID=" + data.Param["OUTID"].ToString()).ToString());
                if (DaoTool.ExecuteNonQuery(dao, OptContent.get("ChongXiaoRuKuStatusChange"), data) < 0)
                {
                    throw new Exception("修改入库主表冲销状态失败!" + dao.ErrMsg);
                }
                msg = "执行成功!";
                return("ok");
            }

            //插入出库主表
            if (data.Sql != null && data.Sql.Equals("ChongXiaoZhuChuKu"))
            {
                data.Param["OUTID"] = DaoTool.Seq(dao, "LKEQ.SEQEQOut");
                OutIdCX             = data.Param["OUTID"].ToString();
                if (DaoTool.Save(dao, OptContent.get("ModifyOutMainInfo"), data) < 0)
                {
                    throw new Exception("插入冲销出库主表失败!" + dao.ErrMsg);
                }
                msg = "执行成功!";
                return("ok");
            }

            //出库细表
            if (data.Sql != null && data.Sql.Equals("ChongXiaoXiChuKu"))
            {
                data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQOutDetail");
                data.Param["OUTID"]    = OutIdCX;
                if (DaoTool.Save(dao, OptContent.get("ModifyOutXiBiaoInfo"), data) < 0)
                {
                    throw new Exception("插入冲销出库细表失败!" + dao.ErrMsg);
                }
                msg = "执行成功!";
                return("ok");
            }

            //入库主表
            if (data.Sql != null && data.Sql.Equals("ChongXiaoZhuRuKu"))
            {
                data.Param["INID"] = DaoTool.Seq(dao, "LKEQ.SEQEQIN");
                InIdCX             = data.Param["INID"].ToString();
                if (DaoTool.Save(dao, OptContent.get("SaveEQInMainInfoCX"), data) < 0)
                {
                    throw new Exception("插入冲销入库主表失败!" + dao.ErrMsg);
                }

                dao.ExecuteNonQuery("UPDATE LKEQ.EQOUTMAIN SET INID=" + data.Param["INID"].ToString() + "  WHERE CHOSCODE= " + data.Param["CHOSCODE"].ToString() + "  AND OUTID=" + OutIdCX);
                msg = "执行成功!";
                return("ok");
            }

            //入库细表

            if (data.Sql != null && data.Sql.Equals("ChongXiaoXiRuKu"))
            {
                data.Param["DETAILNO"] = DaoTool.Seq(dao, "LKEQ.SEQEQINDETAIL");
                data.Param["INID"]     = InIdCX;
                if (DaoTool.Save(dao, OptContent.get("SaveEQInDetail"), data) < 0)
                {
                    throw new Exception("插入冲销细表失败!" + dao.ErrMsg);
                }
                msg = "执行成功!";
                return("ok");
            }

            else
            {
                msg = "系统错误,请与管理员进行联系!";
                return("ok");
            }
        }
Exemple #21
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");
            }
        }
Exemple #22
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");
            }
        }
Exemple #23
0
        public object Run(YiTian.db.Dao dao, YtService.data.OptData data, out string msg)
        {
            if (data.Sql == null)
            {
                throw new Exception("SQL参数为空!");
            }


            if (data.Sql.Equals("ModifyZhuInfo"))
            {
                if (DaoTool.Update(dao, OptContent.get("SaveEQCardRecInfo"), data) < 0)
                {
                    msg = "执行失败!";
                    throw new Exception("设备卡片记录表更新失败!" + dao.ErrMsg);
                }
                //更新对应的设备数目
                DaoTool.ExecuteNonQuery(dao, OptContent.get("UpdateCardNumInCardInfo"), data);
                msg = "执行成功!";
                return("ok");
            }
            if (data.Sql.Equals("ModifyCCInfo"))
            {
                if (data.Param["IsUpdateCC"].ToString() == "1")
                {
                    if (DaoTool.Update(dao, OptContent.get("SaveEQCardCCInfo"), data) < 0)
                    {
                        throw new Exception("设备财产记录表更新失败!" + dao.ErrMsg);
                    }
                }
                else
                {
                    if (DaoTool.Save(dao, OptContent.get("SaveEQCardCCInfo"), data) < 0)
                    {
                        throw new Exception("设备财产记录表新增失败!" + dao.ErrMsg);
                    }
                }
                msg = "执行成功!";
                return("ok");
            }
            if (data.Sql.Equals("ModifySMInfo"))
            {
                if (data.Param["IsUpdateSM"].ToString() == "1")
                {
                    if (DaoTool.Update(dao, OptContent.get("SaveEQCardSMInfo"), data) < 0)
                    {
                        throw new Exception("设备说明记录表更新失败!" + dao.ErrMsg);
                    }
                }
                else
                {
                    if (DaoTool.Save(dao, OptContent.get("SaveEQCardSMInfo"), data) < 0)
                    {
                        throw new Exception("设备说明记录表新增失败!" + dao.ErrMsg);
                    }
                }
                msg = "执行成功!";
                return("ok");
            }

            if (data.Sql.Equals("ModifyFJInfo"))
            {
                if (data.Param["IsUpdateFJ"].ToString() == "1")
                {
                    if (DaoTool.Update(dao, OptContent.get("SaveEQCardFJInfo"), data) < 0)
                    {
                        throw new Exception("设备附件记录表更新失败!" + dao.ErrMsg);
                    }
                }
                else
                {
                    //若为新增,则 行号需要改变
                    // data.Param.Remove("IsUpdateFJ");
                    data.Param["ROWNO"] = DaoTool.ExecuteScalar(dao, OptContent.get("FindRowNoInFJ"), data).ToInt() + 1;
                    if (DaoTool.Save(dao, OptContent.get("SaveEQCardFJInfo"), data) < 0)
                    {
                        throw new Exception("设备附件记录表新增失败!" + dao.ErrMsg);
                    }
                }
                msg = "执行成功!";
                return("ok");
            }


            if (data.Sql.Equals("ModifyJLInfo"))
            {
                if (data.Param["IsUpdateJL"].ToString() == "1")
                {
                    if (DaoTool.Update(dao, OptContent.get("SaveEQCardJLInfo"), data) < 0)
                    {
                        throw new Exception("设备计量记录表更新失败!" + dao.ErrMsg);
                    }
                }
                else
                {
                    data.Param["ROWNO"] = DaoTool.ExecuteScalar(dao, OptContent.get("FindRowNoInFJ"), data).ToInt() + 1;
                    if (DaoTool.Save(dao, OptContent.get("SaveEQCardJLInfo"), data) < 0)
                    {
                        throw new Exception("设备计量记录表新增失败!" + dao.ErrMsg);
                    }
                }
                msg = "执行成功!";
                return("ok");
            }

            //前面全部为修改部分  下面开始处理新增部分



            if (data.Sql.Equals("AddZhuInfo"))
            {
                // if(data.Param["IsFlag"]!=null||data.Param["IsFlag"].ToString()="")
                data.Param["CARDID"] = DaoTool.Seq(dao, "LKEQ.SEQEQCardUse");
                CardId = Convert.ToInt32(data.Param["CARDID"]);

                string Prefix  = dao.Es("SELECT PREFIX FROM LKEQ.DICTEQKIND WHERE CHOSCODE=" + data.Param["CHOSCODE"].ToString() + "  AND KINDCODE=(SELECT KINDCODE FROM LKEQ.DICTEQ WHERE EQID=" + data.Param["EQID"].ToString() + " AND CHOSCODE=" + data.Param["CHOSCODE"].ToString() + ")").ToString().ToUpper();
                int    LengthG = Convert.ToInt32(dao.Es("SELECT DISTINCT SYSVALUE FROM HIS.系统参数 WHERE ID=2206"));//长度

                //可以直接这样搜索是前缀一样,比较的是后面的数字

                object MaxFirst = dao.Es("SELECT MAX(CARDCODE) FROM LKEQ.EQCARDREC WHERE EQID=" + data.Param["EQID"].ToString() + " AND CHOSCODE=" + data.Param["CHOSCODE"].ToString() + " AND CARDCODE LIKE " + "'%" + Prefix + "%'");
                string Max;
                if (MaxFirst == null)
                {
                    Max = "1";
                }
                else
                {
                    Max = MaxFirst.ToString();
                    if (Max.Contains(Prefix))
                    {
                        Max = ((Convert.ToInt64(Max.Substring(Max.LastIndexOf(Prefix) + Prefix.Length))) + 1).ToString();
                    }
                    else
                    {
                        Max = "1";
                    }
                }
                data.Param["CARDCODE"] = Prefix + 0.ToString("D" + (LengthG - Max.Length)) + Max;
                if (DaoTool.Save(dao, OptContent.get("SaveEQCardRecInfo"), data) < 0)
                {
                    throw new Exception("设备卡片主表新增失败!" + dao.ErrMsg);
                }
                //同样的更新数目到库存流水表
                DaoTool.ExecuteNonQuery(dao, OptContent.get("UpdateCardNumInCardInfo"), data);
                msg = "执行成功!";
                return("ok");
                //
            }
            if (data.Sql.Equals("AddJLInfo"))
            {
                data.Param["CARDID"] = CardId;
                data.Param["ROWNO"]  = DaoTool.ExecuteScalar(dao, OptContent.get("FindRowNoInFJ"), data).ToInt() + 1;
                if (DaoTool.Save(dao, OptContent.get("SaveEQCardJLInfo"), data) < 0)
                {
                    throw new Exception("设备计量信息新增失败!" + dao.ErrMsg);
                }
                msg = "执行成功!";
                return("ok");
            }
            if (data.Sql.Equals("AddCCInfo"))
            {
                data.Param["CARDID"] = CardId;
                if (DaoTool.Save(dao, OptContent.get("SaveEQCardCCInfo"), data) < 0)
                {
                    throw new Exception("设备财产信息新增失败!" + dao.ErrMsg);
                }
                msg = "执行成功!";
                return("ok");
            }
            if (data.Sql.Equals("AddFJInfo"))
            {
                data.Param["CARDID"] = CardId;
                data.Param["ROWNO"]  = DaoTool.ExecuteScalar(dao, OptContent.get("FindRowNoInFJ"), data).ToInt() + 1;
                if (DaoTool.Save(dao, OptContent.get("SaveEQCardFJInfo"), data) < 0)
                {
                    throw new Exception("设备附件信息新增失败!" + dao.ErrMsg);
                }
                msg = "执行成功!";
                return("ok");
            }
            if (data.Sql.Equals("AddSMInfo"))
            {
                data.Param["CARDID"] = CardId;
                if (DaoTool.Save(dao, OptContent.get("SaveEQCardSMInfo"), data) < 0)
                {
                    throw new Exception("设备说明信息新增失败!" + dao.ErrMsg);
                }
                msg = "执行成功!";
                return("ok");
            }


            else
            {
                throw new Exception("系统出错,请与管理员联系!");
            }
        }