duhe
2024-10-31 1fc7938f16689dd47e508d37710f37384899adce
WebAPI/Controllers/WebAPIController.cs
@@ -181,7 +181,7 @@
                string sErrMsg = "";
                Int64 HInterID = 0;//显示的字段
                HInterID = DBUtility.ClsPub.CreateBillID_Prod(HBillType, ref sErrMsg);
                HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(HBillType, ref sErrMsg, true);
                //HBillNo = DBUtility.ClsPub.CreateBillCode_Prod(HBillType, ref sErrMsg, true);
                DataSet ds;
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
@@ -435,47 +435,57 @@
        /// <returns></returns>
        [Route("Web/GetXGPassword")]
        [HttpGet]
        public object GetXGPassword(string UserName, string oldPassword, string PassWord, string Repassword)
        public object GetXGPassword(string UserName, string oldPassword, string PassWord, string Repassword,string HCloudUserName,string HCloudUserPsd)
        {
            try
            {
                ClsCN oCn = new ClsCN();
                DataSet oDs = new DataSet();
                //==========
                oDs = oCn.RunProcReturn("select Czmm from  Gy_Czygl where Czybm='" + UserName + "'", "Gy_Czygl");
                if (PassWord.Trim() != Repassword.Trim())
                if(PassWord!=null)
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "2次密码不一致!";
                    objjson.data = oDs.Tables[0];
                    return objjson; ;
                }
                //===========
                if (oDs == null || oDs.Tables[0].Rows.Count == 0)
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "没有这个用户,不能修改密码!";
                    objjson.data = null;
                    return objjson; ;
                }
                else
                {
                    oCn.RunProc("update  Gy_Czygl set Czmm='" + ClsPub.StrToPsd(PassWord.Trim()) + "' where Czybm='" + UserName.Trim() + "'");
                    oDs = oCn.RunProcReturn("select Czmm from  Gy_Czygl where Czybm='" + UserName + "'", "Gy_Czygl");
                    if (PassWord.Trim() != Repassword.Trim())
                    {
                        objjson.code = "0";
                        objjson.count = 0;
                        objjson.Message = "2次密码不一致!";
                        objjson.data = oDs.Tables[0];
                        return objjson; ;
                    }
                    //===========
                    if (oDs == null || oDs.Tables[0].Rows.Count == 0)
                    {
                        objjson.code = "0";
                        objjson.count = 0;
                        objjson.Message = "没有这个用户,不能修改密码!";
                        objjson.data = null;
                        return objjson; ;
                    }
                    oCn.RunProc("update  Gy_Czygl set Czmm='" + ClsPub.StrToPsd(PassWord.Trim()) + "',HCloudUserName = '" + HCloudUserName+ "',HCloudUserPsd = '" + HCloudUserPsd+ "' where Czybm='" + UserName.Trim() + "'");
                    objjson.code = "0";
                    objjson.count = 1;
                    objjson.Message = "* 密码修改成功!";
                    objjson.data = null;
                    return objjson;
                }
                else
                {
                    oCn.RunProc("update  Gy_Czygl set HCloudUserName = '" + HCloudUserName + "',HCloudUserPsd = '" + HCloudUserPsd + "' where Czybm='" + UserName.Trim() + "'");
                    objjson.code = "0";
                    objjson.count = 1;
                    objjson.Message = "* 金蝶云账号修改成功!";
                    objjson.data = null;
                    return objjson; ;
                }
            }
            catch (Exception)
            catch (Exception e)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "修改密码异常!";
                objjson.Message = "修改密码异常!" + e.ToString();
                objjson.data = null;
                return objjson; ;
            }
@@ -1498,6 +1508,52 @@
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn("Select HItemID,班组代码 班组代码,班组名称 班组 from h_v_GroupList where 1=1 " + sWhere + " Order by HItemID ", "h_v_GroupList");
                if (ds == null || ds.Tables[0].Rows.Count <= 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 = ds.Tables[0];
                    return objjson;
                }
            }
            catch (Exception e)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取失败" + e.ToString();
                objjson.data = null;
                return objjson;
            }
        }
        /// <summary>
        /// 获取班组列表  根据用户对应班组关系,获取用户对应的班组
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Web/GetGroupListByUser_Json")]
        [HttpGet]
        public object GetGroupListByUser_Json(string sWhere, string user)
        {
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                //根据用户对应班组的关系,过滤条件中增加只显示对应的班组
                DataSet dsHitemID = oCN.RunProcReturn("exec h_p_Gy_GetSQLGroupByUser '" + user + "'", "h_p_Gy_GetSQLGroupByUser");
                sWhere = sWhere + DBUtility.ClsPub.isStrNull(dsHitemID.Tables[0].Rows[0]["HBack"]);
                DataSet ds = oCN.RunProcReturn("Select HItemID,班组代码 班组代码,班组名称 班组 from h_v_GroupList where 1=1 " + sWhere + " Order by HItemID ", "h_v_GroupList");
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {
                    objjson.code = "0";
@@ -14161,7 +14217,7 @@
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn(" select * from h_v_Sc_ProcessExchangeBillList where 1=1 and 日期>=DATEADD(MONTH,-2,GETDATE()) order by 单据号 desc,hsubid", "h_v_Sc_ProcessExchangeBillList");
                    ds = oCN.RunProcReturn("select top 500 * from h_v_Sc_ProcessExchangeBillList where 1=1  order by 单据号 desc,hsubid", "h_v_Sc_ProcessExchangeBillList");
                }
                else
                {
@@ -14712,6 +14768,61 @@
                return objjson;
            }
        }
        #region 条码主档分页列表
        [Route("Gy_BarCodeBillList/page")]
        [HttpGet]
        public json Gy_BarCodeBillListPage(string sWhere, string user, int page, int size)
        {
            DataSet ds;
            json res = new json();
            try
            {
                List<object> columnNameList = new List<object>();
                //判断是否有查询权限
                if (!DBUtility.ClsPub.Security_Log("Gy_BarCodeBill_Query", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无权限查询!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("exec h_p_IF_BarCodeBillList " + page + "," + size + ",''", "h_p_IF_BarCodeBillList");
                }
                else
                {
                    ds = oCN.RunProcReturn("exec h_p_IF_BarCodeBillList " + page + "," + size + ",'" + sWhere + "'", "h_p_IF_BarCodeBillList");
                }
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                res.code = CodeConstant.SUCCEED;
                res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                res.Message = "Sucess!";
                res.list = columnNameList;
                res.data = ds.Tables[0];
                return res;
            }
            catch (Exception e)
            {
                res.code = CodeConstant.FAIL;
                res.count = CountConstant.FAIL;
                res.Message = "Exception!" + e.ToString();
                res.data = null;
                return res;
            }
        }
        #endregion
        /// <summary>
        /// 根据设备保养规程显示设备保养规程项目
        /// </summary>