智云SRM-WEBAPI(目前客户通用API)
WebAPI/Controllers/WebAPIController.cs
@@ -209,7 +209,7 @@
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "登录成功!";
                    objJsonResult.data = ds.Tables[0];
                    objJsonResult.data = ds;
                    Add_Log("主界面", UserName, "登录");
                    return objJsonResult;
                }
@@ -230,7 +230,8 @@
            try
            {
                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                DS = oCn.RunProcReturn("select * from Gy_Czygl where Czybm='" + MainID + "' and Czmm='" + sPsd + "' ", "Gy_Czygl");
                //DS = oCn.RunProcReturn("select * from Gy_Czygl where Czybm='" + MainID + "' and Czmm='" + sPsd + "' ", "Gy_Czygl");
                DS = oCn.RunProcReturn("exec h_p_SRM_GetSupIDByUser '" + MainID + "','" + sPsd + "'", "h_p_SRM_GetSupIDByUser");
                if (DS.Tables[0].Rows.Count == 0)
                    return null;
                else
@@ -468,6 +469,87 @@
            }
        }
        /// <summary>
        /// 设置默认打印模板
        /// </summary>
        /// <returns></returns>
        [Route("Open_PrintTem/DefaultOpenTmp")]
        [HttpGet]
        public object DefaultOpenTmp(string HNumber, string HName)
        {
            ClsCN oCn = new ClsCN();
            try
            {
                oCn.BeginTran();
                //先把此模块下的模板默认模板标记都关闭
                oCn.RunProc("update SRM_OpenTmp set HStdFlag = 0 where HNumber='" + HNumber + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                //更新当前模板为默认模板
                oCn.RunProc("update SRM_OpenTmp set HStdFlag = 1 where HNumber='" + HNumber + "' and HName='" + HName + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                objjson.code = "0";
                objjson.count = 1;
                objjson.Message = "设置成功!";
                objjson.data = null;
                return objjson;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "设置失败" + e.ToString();
                objjson.data = null;
                return objjson;
            }
        }
        #region [获取默认打印模板]
        /// <summary>
        /// 获取打印模板列表
        /// </summary>
        /// <returns></returns>
        [Route("Open_PrintTem/GetDefaultOpenTmp_Json")]
        [HttpGet]
        public object GetDefaultOpenTmp_Json(string HNumber)
        {
            sWhere = " Where 默认标记=1 ";
            //sWhere = " Where HStopFlag=0  and HEndFlag=1  and HUSEORGID = " + DBUtility.ClsPub.HORGANIZATIONSID.ToString();
            if (HNumber != "")
            {
                sWhere = sWhere + " and ( HNumber = '" + HNumber + "') ";
            }
            ClsCN oCn = new ClsCN();
            try
            {
                ds = oCn.RunProcReturn("select * from h_v_IF_OpenTmpList " + sWhere, "h_v_IF_OpenTmpList");
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败,没有设置默认模板" + DBUtility.ClsPub.sErrInfo;
                    objjson.data = null;
                    return objjson;
                }
                else
                {
                    objjson.code = "0";
                    objjson.count = 1;
                    objjson.Message = "获取成功!";
                    objjson.data = ds.Tables[0];
                    return objjson;
                }
            }
            catch (Exception ex)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "异常" + ex.ToString();
                objjson.data = null;
                return objjson;
            }
        }
        #endregion
        #region 基础资料
        /// <summary>
        /// 获取仓库列表
@@ -923,6 +1005,54 @@
            }
        }
        /// <summary>
        /// 获取单据ID,编号
        /// </summary>
        /// <param name="sMsg"></param>
        /// <returns></returns>
        [Route("Web/GetMAXNum_New")]
        [HttpGet]
        public object GetMAXNum_New(string HBillType)
        {
            try
            {
                Int64 HInterID = 0;//显示的字段
                HInterID = CreateBillID(HBillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //----------创建虚表------------------------
                DataTable dt_Main = new DataTable("Json");
                dt_Main.Columns.Add("HInterID", typeof(int));
                //---------创建新行------------------------
                DataRow dr_main = dt_Main.NewRow();//创建新行
                dt_Main.Rows.Add(dr_main);//将新行加入到表中
                dr_main["HInterID"] = DBUtility.ClsPub.isLong(HInterID);
                if (HInterID == 0)
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败";
                    objjson.data = null;
                    return objjson;
                }
                else
                {
                    objjson.code = "0";
                    objjson.count = 1;
                    objjson.Message = "获取成功";
                    objjson.data = dt_Main;
                    return objjson;
                }
            }
            catch (Exception e)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取失败" + e.ToString();
                objjson.data = null;
                return objjson;
            }
        }
        //得到最大HINTERID
        public static Int64 CreateBillID(string BillCode, ref string sReturn)
        {