wtt
2025-04-28 51aa625a0301d6be922d7e878aa5def8fd0ebb8f
WebAPI/Controllers/WebAPIController.cs
@@ -2219,6 +2219,103 @@
        }
        /// <summary>
        /// 获取环境检验方案列表
        /// <summary>
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Web/Gy_EnvironmentTestSchemeBillList_Json")]
        [HttpGet]
        public object Gy_EnvironmentTestSchemeBillList_Json(string sWhere)
        {
            DataSet ds;
            if (sWhere != "")
            {
                sWhere = " and ( 生产部门 like '%" + sWhere + "%' or 工作中心 like '%" + sWhere + "%' or 工序名称 like '%" + sWhere + "%' or 检测项目 like '%" + sWhere + "%' ) ";
            }
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn("select  * from h_v_Gy_EnvironmentTestSchemeBillList_PDA where 审核人 !='' and 关闭人=''  " + sWhere + " Order by 单据号 ", "h_v_Gy_EnvironmentTestSchemeBillList_PDA");
                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>
        /// 获取环境检测项目列表
        /// <summary>
        ///参数:string sql。
        ///返回值:object。
        /// </summary>
        [Route("Web/Gy_EnvironmentTestItemList_Json")]
        [HttpGet]
        public object Gy_EnvironmentTestItemList_Json(string sWhere)
        {
            DataSet ds;
            if (sWhere != "")
            {
                sWhere = " and ( HNumber like '%" + sWhere + "%' or HName like '%" + sWhere + "%'  ) ";
            }
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn("select HItemID ,HName 环境检测项目,HNumber 环境检测代码 from Gy_EnvironmentTestItem where ISNULL(HCheckTime,'')!='' and HStopflag =0  " + sWhere + " Order by HNumber ", "Gy_EnvironmentTestItem");
                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>
        /// 获取银行列表
        /// <summary>
        ///参数:string sql。
@@ -17791,6 +17888,193 @@
        }
        #endregion
        #region  设备节拍维护  设置列表/保存/编辑/删除方法
        /// <summary>
        ///  项目费用分类 保存
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("SaveSb_EqiupMaterWorkTime")]
        [HttpPost]
        public object SaveSb_EqiupMaterWorkTime([FromBody] JObject msg)
        {
            DataSet ds;
            var _value = msg["msg"].ToString();
            string msg3 = _value.ToString();
            string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg1 = sArray[0].ToString();
            string msg2 = sArray[1].ToString();
            Int64 HItemID = 0;
            SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
            //获取最大ID值赋值
            DataSet Maxds = oCN.RunProcReturn("select isNull(MAX(HItemID),0) HItemID from EqiupMaterWorkTimes ", "EqiupMaterWorkTimes");
            if (Maxds != null || Maxds.Tables[0].Rows.Count > 0)
            {
                //HItemID= Maxds.Tables[0].Rows[0]["HItemID"]
                var maxid = Convert.ToInt32(Maxds.Tables[0].Rows[0]["HItemID"]);
                maxid += 1;
                HItemID = maxid;
            }
            ListModels oListModels = new ListModels();
            try
            {
                //保存权限
                if (!DBUtility.ClsPub.Security_Log("EqiupMaterWorkTimes_Edit", 1, false, msg2))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无保存权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                WebAPI.DLL.ClsEqiupMaterWorkTimes_Ctl oBill = new WebAPI.DLL.ClsEqiupMaterWorkTimes_Ctl();
                List<Model.ClsEqiupMaterWorkTimes_Model> lsmain = new List<Model.ClsEqiupMaterWorkTimes_Model>();
                msg1 = msg1.Replace("\\", "");
                msg1 = msg1.Replace("\n", "");
                lsmain = oListModels.getObjectByJson_EqiupMaterWorkTimes(msg1);
                foreach (ClsEqiupMaterWorkTimes_Model item in lsmain)
                {
                    oBill.oModel = item;
                }
                //保存
                //保存完毕后处理
                bool bResult;
                if (oBill.oModel.HItemID == 0)
                {
                    bResult = oBill.AddNew();
                }
                else
                {
                    bResult = oBill.ModifyByID(oBill.oModel.HItemID);
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "保存失败!" + e.ToString();
                objJsonResult.data = 1;
                return objJsonResult;
            }
        }
        /// <summary>
        /// 设备节拍维护 获取信息
        /// </summary>
        /// <returns></returns>
        [Route("GetEqiupMaterWorkTimeDetail")]
        [HttpGet]
        public ApiResult<DataSet> GetEqiupMaterWorkTimeDetail(string HID)
        {
            var model = LuBaoSevice.GetEqiupMaterWorkTimeDetail(HID);
            return model;
        }
        /// <summary>
        /// 设备节拍维护 删除功能
        /// </summary>
        /// <returns></returns>
        [Route("DeltetEqiupMaterWorkTime")]
        [HttpGet]
        public object DeltetEqiupMaterWorkTime(string HItemID, string user)
        {
            DataSet ds;
            try
            {
                //删除权限
                if (!DBUtility.ClsPub.Security_Log("EqiupMaterWorkTimes_Delete", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (string.IsNullOrWhiteSpace(HItemID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HItemID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from EqiupMaterWorkTimes where HItemID=" + HItemID, "EqiupMaterWorkTimes");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已审核!不能进行删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已禁用!不能进行删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.RunProc("delete from EqiupMaterWorkTimes where HItemID=" + HItemID);
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "数据删除成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        /// <summary>
        /// 用关联工序获取信息
@@ -19007,23 +19291,19 @@
        /// <returns></returns>
        [Route("Web/GetSc_ProcessExchangeBillListView")]
        [HttpGet]
        public object GetSc_ProcessExchangeBillListView(string ICMOBill, int OrganizationID)
        {
            if (ICMOBill != "" & ICMOBill != null)
            {
                sWhere = " where 1=1 and 单据号 like '%" + ICMOBill + "%' ";
            }
        public object GetSc_ProcessExchangeBillListView(string sWhere,int OrganizationID)
        {
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("select top 500 * from h_v_Sc_ProcessExchangeBillList where 1=1  order by 单据号 desc,hsubid", "h_v_Sc_ProcessExchangeBillList");
                }
                    ds = oCN.RunProcReturn("select top 300 * from h_v_Sc_ProcessExchangeBillList_PDA where 1=1  order by 单据号 desc,hsubid", "h_v_Sc_ProcessExchangeBillList_PDA");
                }
                else
                {
                    string sql = "select * from h_v_Sc_ProcessExchangeBillList " + sWhere + " order by 单据号 desc,hsubid ";
                    ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessExchangeBillList");
                    string sql = "select * from h_v_Sc_ProcessExchangeBillList_PDA  where 1=1 " + sWhere + " order by 单据号 desc,hsubid ";
                    ds = oCN.RunProcReturn(sql, "h_v_Sc_ProcessExchangeBillList_PDA");
                }
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {
@@ -20687,6 +20967,33 @@
                return objJsonResult;
            }
        }
        //获取所有模块页面
        [Route("Web/ModePageList")]
        [HttpGet]
        public object ModePageList()
        {
            try
            {
                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                ds = oCn.RunProcReturn("Select * from Gy_Menu_1 where isnull(Hurl,'')  like'%html%'  Order by HItemID ", "Gy_Menu");     //获取Gy_Menu_1中的所有菜单信息,用于为menuInitList列表充
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "查询成功!";
                objJsonResult.data = ds;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "查询失败!";
                objJsonResult.data = e.ToString();
                return objJsonResult;
            }
        }
        #endregion
        #region 保存自定义数据
@@ -20786,7 +21093,7 @@
        //快捷方式自定义菜单:获取树组件数据
        [Route("Web/Xt_UserFastMenu_Display")]
        [HttpGet]
        public object Xt_UserFastMenu_Display(string HMakeName, string HType)
        public object Xt_UserFastMenu_Display(string HMakeName, string HType,string HModelAtributos)
        {
            try
            {
@@ -20811,7 +21118,7 @@
                    menuInit.HSelected = false;
                    //判断用户是否选中显示该菜单
                    String sql = "Select * from Xt_UserFastMenu where HSubFuncID = '" + ds.Tables[0].Rows[i]["HItemID"] + "' and HUserID='" + HMakeName + "'";
                    String sql = "Select * from Xt_UserFastMenu where HSubFuncID = '" + ds.Tables[0].Rows[i]["HItemID"] + "' and HUserID='" + HMakeName + "' and HModelAtributos='" + HModelAtributos + "'";
                    ds1 = oCn.RunProcReturn(sql, "Xt_UserFastMenu");
                    if (ds1.Tables[0].Rows.Count > 0)                           //对于Gy_Menu_1表中的菜单节点,通过检索在Gy_MenuDefineSet表中对应用户是否存在该节点的信息,判断该用户是否选中该节点需要加载显示在侧菜单栏
                    {
@@ -20879,6 +21186,7 @@
                string HMakeName = sArray[1].ToString();
                string saveData = sArray[0].ToString();
                string HTypes = sArray[2].ToString();
                string HModelAtributos = sArray[3].ToString();
                List<SaveDefineMenu> saveDataList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SaveDefineMenu>>(saveData);
                //声明数据库操作工具
@@ -20888,7 +21196,7 @@
                oCN.BeginTran();
                //删除当前用户的自定义数据
                string sql = "delete from Xt_UserFastMenu where HUserID = '" + HMakeName + "' and HType = '" + HTypes + "'";
                string sql = "delete from Xt_UserFastMenu where HUserID = '" + HMakeName + "' and HType = '" + HTypes + "' and HModelAtributos = '" + HModelAtributos + "'";
                oCN.RunProc(sql);
                //插入当前用户最新的自定义数据
@@ -20907,7 +21215,7 @@
                            string HCaption = ds.Tables[0].Rows[0]["HName"].ToString();
                            string HType = ds.Tables[0].Rows[0]["HType"].ToString();
                            sql = "insert into Xt_UserFastMenu(HUserID,HSubFuncID,HCaption,HType) values('" + HUserID + "','" + HSubFuncID + "','" + HCaption + "','" + HType + "')";
                            sql = "insert into Xt_UserFastMenu(HUserID,HSubFuncID,HCaption,HType,HModelAtributos) values('" + HUserID + "','" + HSubFuncID + "','" + HCaption + "','" + HType + "','"+ HModelAtributos + "')";
                            oCN.RunProc(sql);
                        }
                    }
@@ -20937,17 +21245,17 @@
        //快捷方式自定义菜单:获取树组件数据
        [Route("Web/Xt_UserFastMenu_Init")]
        [HttpGet]
        public object Xt_UserFastMenu_Init(string HMakeName, string HType)
        public object Xt_UserFastMenu_Init(string HMakeName, string HType,string HModelAtributos)
        {
            try
            {
                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                string sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = '" + HMakeName + "' and b.HType = '" + HType + "' Order by a.HItemID";
                string sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = '" + HMakeName + "' and b.HType = '" + HType + "'  and a.HModelAtributos = '" + HModelAtributos + "' Order by a.HItemID";
                ds = oCn.RunProcReturn(sql, "Xt_UserFastMenu");     //获取Xt_UserFastMenu中该用户设置的自定义菜单信息,用于在前端加载
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = 'admin' and b.HType = '" + HType + "' Order by a.HItemID";
                    sql = "select a.HSubFuncID, a.HCaption,a.HPicNum,b.Hurl,isnull(HTranslationText_English,HName) HTranslationText_English,isnull(HTranslationText_Spain,HName) HTranslationText_Spain from Xt_UserFastMenu as a join Gy_Menu_1 as b on a.HSubFuncID = b.HItemID  where a.HUserID = 'admin' and b.HType = '" + HType + "' and a.HModelAtributos = '" + HModelAtributos + "' Order by a.HItemID";
                    ds = oCn.RunProcReturn(sql, "Xt_UserFastMenu");     //获取Xt_UserFastMenu中该用户设置的自定义菜单信息,用于在前端加载
                }