WebAPI/Controllers/WebAPIController.cs
@@ -20,6 +20,8 @@
using WebAPI.Models;
using WebAPI.Service;
using SyntacticSugar.constant;
using System.Text.RegularExpressions;
using WebAPI.Utility;
namespace WebAPI.Controllers
{
@@ -392,7 +394,7 @@
                    objJsonResult.Message = "登录异常!Token 生成异常,无法获取公司信息!";
                }
                string tokenStr = Utility.JWTHelper.GenerateToken(UserName.Trim(), DBUtility.ClsPub.StrToPsd(PassWord.Trim()));
                string tokenStr = Utility.JWTHelper.GenerateToken(ds.Tables[0].Rows[0]["Czybm"].ToString(), ds.Tables[0].Rows[0]["Czymc"].ToString());
                objjson.code = "0";
@@ -409,7 +411,7 @@
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "[0000-1-074]登录异常!" + e.Message;
                objjson.Message = "[0000-1-074]登录异常!" + e;
                objjson.data = null;
                return objjson; ;
            }
@@ -3478,6 +3480,7 @@
        /// <returns></returns>
        [Route("SaveGy_BadType")]
        [HttpPost]
        [Permission(HModName = "Gy_BadType", Operate = "_Edit")]
        public object SaveGy_BadType([FromBody] JObject msg)
        {
            DataSet ds;
@@ -3697,6 +3700,7 @@
        /// <returns></returns>
        [Route("GetGy_BadTypeDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_BadType", Operate = "_Query")]
        public ApiResult<DataSet> GetGy_BadTypeDetail(string HID)
        {
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_gy_BadTypeList  where HItemID= " + HID + " ", "h_v_gy_BadTypeList");
@@ -3711,6 +3715,8 @@
        /// <returns></returns>
        [Route("DeltetGy_BadType")]
        [HttpGet]
        [Permission(HModName = "Gy_BadType", Operate = "_Drop")]
        public object DeltetGy_BadType(string HItemID, string user)
        {
            DataSet ds;
@@ -4149,6 +4155,7 @@
        /// <returns></returns>
        [Route("SaveGy_ErrType")]
        [HttpPost]
        [Permission(HModName = "Gy_ErrType", Operate = "_Edit")]
        public object SaveGy_ErrType([FromBody] JObject msg)
        {
            DataSet ds;
@@ -4362,6 +4369,7 @@
        /// <returns></returns>
        [Route("GetGy_ErrTypeDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_ErrType", Operate = "_Query")]
        public ApiResult<DataSet> GetGy_ErrTypeDetail(string HID)
        {
            var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_ErrTypeList  where HItemID= " + HID + " ", "h_v_Gy_ErrTypeList");
@@ -4377,6 +4385,7 @@
        /// <returns></returns>
        [Route("DeltetGy_ErrType")]
        [HttpGet]
        [Permission(HModName = "Gy_ErrType", Operate = "_Drop")]
        public object DeltetGy_ErrType(string HItemID, string user)
        {
            DataSet ds;
@@ -4435,6 +4444,7 @@
        #region 异常类型审核/反审核
        [Route("Gy_ErrType/AuditGy_ErrType")]
        [HttpGet]
        [Permission(HModName = "Gy_ErrType", Operate = "_Check")]
        public object AuditGy_ErrType(string HInterID, int Type, string user)
        {
            try
@@ -4801,6 +4811,7 @@
        /// <returns></returns>
        [Route("SaveGy_BadResultList")]
        [HttpPost]
        [Permission(HModName = "Gy_BadResult", Operate = "_Edit")]
        public object SaveGy_BadResultList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -5022,6 +5033,8 @@
        /// <returns></returns>
        [Route("GetGy_BadResultDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_BadResult", Operate = "_Query")]
        public ApiResult<DataSet> GetGy_BadResultDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_BadResultBillDetail(HID);
@@ -5034,6 +5047,8 @@
        /// <returns></returns>
        [Route("DeltetGy_BadResult")]
        [HttpGet]
        [Permission(HModName = "Gy_BadResult", Operate = "_Drop")]
        public object DeltetGy_BadResult(string HItemID, string user)
        {
            DataSet ds;
@@ -5436,6 +5451,7 @@
        /// <returns></returns>
        [Route("SaveGy_InspectValueList")]
        [HttpPost]
        [Permission(HModName = "Gy_InspectValue", Operate = "_Edit")]
        public object SaveGy_InspectValueList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -5646,6 +5662,7 @@
        /// <returns></returns>
        [Route("GetGy_InspectValueDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_InspectValue", Operate = "_Query")]
        public ApiResult<DataSet> GetGy_InspectValueDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_InspectValueBillDetail(HID);
@@ -5658,6 +5675,7 @@
        /// <returns></returns>
        [Route("DeltetGy_InspectValue")]
        [HttpGet]
        [Permission(HModName = "Gy_InspectValue", Operate = "_Drop")]
        public object DeltetGy_InspectValue(string HItemID, string user)
        {
            DataSet ds;
@@ -5987,6 +6005,7 @@
        /// <returns></returns>
        [Route("SaveGy_InspectMethodList")]
        [HttpPost]
        [Permission(HModName = "Gy_InspectMethod", Operate = "_Edit")]
        public object SaveGy_InspectMethodList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -6196,6 +6215,7 @@
        /// <returns></returns>
        [Route("GetGy_InspectMethodDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_InspectMethod", Operate = "_Query")]
        public ApiResult<DataSet> GetGy_InspectMethodDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_InspectMethodBillDetail(HID);
@@ -6208,6 +6228,7 @@
        /// <returns></returns>
        [Route("DeltetGy_InspectMethod")]
        [HttpGet]
        [Permission(HModName = "Gy_InspectMethod", Operate = "_Drop")]
        public object DeltetGy_InspectMethod(string HItemID, string user)
        {
            DataSet ds;
@@ -6288,6 +6309,7 @@
        /// <returns></returns>
        [Route("SaveGy_QualityStdList")]
        [HttpPost]
        [Permission(HModName = "Gy_QualityStd", Operate = "_Edit")]
        public object SaveGy_QualityStdList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -6501,6 +6523,7 @@
        /// <returns></returns>
        [Route("GetGy_QualityStdDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_QualityStd", Operate = "_Query")]
        public ApiResult<DataSet> GetGy_QualityStdDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_QualityStdBillDetail(HID);
@@ -6513,6 +6536,7 @@
        /// <returns></returns>
        [Route("DeltetGy_QualityStd")]
        [HttpGet]
        [Permission(HModName = "Gy_QualityStd", Operate = "_Drop")]
        public object DeltetGy_QualityStd(string HItemID, string user)
        {
            DataSet ds;
@@ -6593,6 +6617,7 @@
        /// <returns></returns>
        [Route("SaveGy_InspectInstruMentList")]
        [HttpPost]
        [Permission(HModName = "Gy_InspectInstruMent", Operate = "_Edit")]
        public object SaveGy_InspectInstruMentList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -6805,6 +6830,7 @@
        /// <returns></returns>
        [Route("GetGy_InspectInstruMentDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_InspectInstruMent", Operate = "_Query")]
        public ApiResult<DataSet> GetGy_InspectInstruMentDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_InspectInstruMentBillDetail(HID);
@@ -6817,6 +6843,7 @@
        /// <returns></returns>
        [Route("DeltetGy_InspectInstruMent")]
        [HttpGet]
        [Permission(HModName = "Gy_InspectInstruMent", Operate = "_Drop")]
        public object DeltetGy_InspectInstruMent(string HItemID, string user)
        {
            DataSet ds;
@@ -7127,6 +7154,7 @@
        /// <returns></returns>
        [Route("SaveGy_InspectBasisList")]
        [HttpPost]
        [Permission(HModName = "Gy_InspectBasis", Operate = "_Edit")]
        public object SaveGy_InspectBasisList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -7337,6 +7365,7 @@
        /// <returns></returns>
        [Route("GetGy_InspectBasisDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_InspectBasis", Operate = "_Query")]
        public ApiResult<DataSet> GetGy_InspectBasisDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_InspectBasisBillDetail(HID);
@@ -7349,6 +7378,7 @@
        /// <returns></returns>
        [Route("DeltetGy_InspectBasis")]
        [HttpGet]
        [Permission(HModName = "Gy_InspectBasis", Operate = "_Drop")]
        public object DeltetGy_InspectBasis(string HItemID, string user)
        {
            DataSet ds;
@@ -7429,6 +7459,7 @@
        /// <returns></returns>
        [Route("SaveGy_PostSkillList")]
        [HttpPost]
        [Permission(HModName = "Gy_PostSkill_Edit")]
        public object SaveGy_PostSkillList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -7642,6 +7673,7 @@
        /// <returns></returns>
        [Route("GetGy_PostSkillDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_PostSkill_Query")]
        public ApiResult<DataSet> GetGy_PostSkillDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_PostSkillDetail(HID);
@@ -7654,6 +7686,7 @@
        /// <returns></returns>
        [Route("DeltetGy_PostSkill")]
        [HttpGet]
        [Permission(HModName = "Gy_PostSkill_Drop")]
        public object DeltetGy_PostSkill(string HItemID, string user)
        {
            DataSet ds;
@@ -8071,6 +8104,7 @@
        /// <returns></returns>
        [Route("SaveGy_PostList")]
        [HttpPost]
        [Permission(HModName = "Gy_Post_Edit")]
        public object SaveGy_PostList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -8284,6 +8318,7 @@
        /// <returns></returns>
        [Route("GetGy_PostDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_Post_Query")]
        public ApiResult<DataSet> GetGy_PostDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_PostDetail(HID);
@@ -8296,6 +8331,7 @@
        /// <returns></returns>
        [Route("DeltetGy_Post")]
        [HttpGet]
        [Permission(HModName = "Gy_Post_Drop")]
        public object DeltetGy_Post(string HItemID, string user)
        {
            DataSet ds;
@@ -8564,6 +8600,7 @@
        #region 岗位项目 导入(保存)
        [Route("Gy_Post/Gy_Post_btnSave")]
        [HttpPost]
        [Permission(HModName = "Gy_Post_Edit")]
        public object Gy_Post_btnSave([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
@@ -8684,6 +8721,7 @@
        /// <returns></returns>
        [Route("SaveGy_StockMoveStyleList")]
        [HttpPost]
        [Permission(HModName = "Gy_StockMoveStyle_Edit")]
        public object SaveGy_StockMoveStyleList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -8887,6 +8925,7 @@
        /// <returns></returns>
        [Route("GetGy_StockMoveStyleDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_StockMoveStyle_Query")]
        public ApiResult<DataSet> GetGy_StockMoveStyleDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_StockMoveStyleDetail(HID);
@@ -8899,6 +8938,7 @@
        /// <returns></returns>
        [Route("DeltetGy_StockMoveStyle")]
        [HttpGet]
        [Permission(HModName = "Gy_StockMoveStyle_Drop")]
        public object DeltetGy_StockMoveStyle(string HItemID, string user)
        {
            DataSet ds;
@@ -8964,6 +9004,7 @@
        /// <returns></returns>
        [Route("SaveGy_StockInStyleList")]
        [HttpPost]
        [Permission(HModName = "Gy_StockInStyle_Edit")]
        public object SaveGy_StockInStyleList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -9167,6 +9208,7 @@
        /// <returns></returns>
        [Route("GetGy_StockInStyleDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_StockInStyle_Query")]
        public ApiResult<DataSet> GetGy_StockInStyleDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_StockInStyleDetail(HID);
@@ -9179,6 +9221,7 @@
        /// <returns></returns>
        [Route("DeltetGy_StockInStyle")]
        [HttpGet]
        [Permission(HModName = "Gy_StockInStyle_Drop")]
        public object DeltetGy_StockInStyle(string HItemID, string user)
        {
            DataSet ds;
@@ -9244,6 +9287,7 @@
        /// <returns></returns>
        [Route("SaveGy_StockOutStyleList")]
        [HttpPost]
        [Permission(HModName = "Gy_StockOutStyle_Edit")]
        public object SaveGy_StockOutStyleList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -9447,6 +9491,7 @@
        /// <returns></returns>
        [Route("GetGy_StockOutStyleDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_StockOutStyle_Query")]
        public ApiResult<DataSet> GetGy_StockOutStyleDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_StockOutStyleDetail(HID);
@@ -9459,6 +9504,7 @@
        /// <returns></returns>
        [Route("DeltetGy_StockOutStyle")]
        [HttpGet]
        [Permission(HModName = "Gy_StockOutStyle_Drop")]
        public object DeltetGy_StockOutStyle(string HItemID, string user)
        {
            DataSet ds;
@@ -9524,6 +9570,7 @@
        /// <returns></returns>
        [Route("SaveGy_AreaSetList")]
        [HttpPost]
        [Permission(HModName = "Gy_AreaSet_Edit")]
        public object SaveGy_AreaSetList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -9727,6 +9774,7 @@
        /// <returns></returns>
        [Route("GetGy_AreaSetDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_AreaSet_Query")]
        public ApiResult<DataSet> GetGy_AreaSetDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_AreaSetDetail(HID);
@@ -9739,6 +9787,7 @@
        /// <returns></returns>
        [Route("DeltetGy_AreaSet")]
        [HttpGet]
        [Permission(HModName = "Gy_AreaSet_Drop")]
        public object DeltetGy_AreaSet(string HItemID, string user)
        {
            DataSet ds;
@@ -9804,6 +9853,7 @@
        /// <returns></returns>
        [Route("SaveGy_SellStyleList")]
        [HttpPost]
        [Permission(HModName = "Gy_SellStyle_Edit")]
        public object SaveGy_SellStyleList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -10007,6 +10057,7 @@
        /// <returns></returns>
        [Route("GetGy_SellStyleDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_SellStyle_Query")]
        public ApiResult<DataSet> GetGy_SellStyleDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_SellStyleDetail(HID);
@@ -10019,6 +10070,7 @@
        /// <returns></returns>
        [Route("DeltetGy_SellStyle")]
        [HttpGet]
        [Permission(HModName = "Gy_SellStyle_Drop")]
        public object DeltetGy_SellStyle(string HItemID, string user)
        {
            DataSet ds;
@@ -10084,6 +10136,7 @@
        /// <returns></returns>
        [Route("SaveGy_PoStockStyleList")]
        [HttpPost]
        [Permission(HModName = "Gy_PoStockStyle_Edit")]
        public object SaveGy_PoStockStyleList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -10287,6 +10340,7 @@
        /// <returns></returns>
        [Route("GetGy_PoStockStyleDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_PoStockStyle_Query")]
        public ApiResult<DataSet> GetGy_PoStockStyleDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_PoStockStyleDetail(HID);
@@ -10299,6 +10353,7 @@
        /// <returns></returns>
        [Route("DeltetGy_PoStockStyle")]
        [HttpGet]
        [Permission(HModName = "Gy_PoStockStyle_Drop")]
        public object DeltetGy_PoStockStyle(string HItemID, string user)
        {
            DataSet ds;
@@ -10364,6 +10419,7 @@
        /// <returns></returns>
        [Route("SaveGy_SupTypeList")]
        [HttpPost]
        [Permission(HModName = "Gy_SupType_Edit")]
        public object SaveGy_SupTypeList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -10567,6 +10623,7 @@
        /// <returns></returns>
        [Route("GetGy_SupTypeDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_SupType_Query")]
        public ApiResult<DataSet> GetGy_SupTypeDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_SupTypeDetail(HID);
@@ -10579,6 +10636,7 @@
        /// <returns></returns>
        [Route("DeltetGy_SupType")]
        [HttpGet]
        [Permission(HModName = "Gy_SupType_Drop")]
        public object DeltetGy_SupType(string HItemID, string user)
        {
            DataSet ds;
@@ -10795,6 +10853,7 @@
        #region 供应商分类项目 导入(保存)
        [Route("Gy_SupType/Gy_SupType_btnSave")]
        [HttpPost]
        [Permission(HModName = "Gy_SupType_Edit")]
        public object Gy_SupType_btnSave([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
@@ -11246,6 +11305,7 @@
        /// <returns></returns>
        [Route("SaveGy_CusTypeList")]
        [HttpPost]
        [Permission(HModName = "Gy_CusType_Edit")]
        public object SaveGy_CusTypeList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -11449,6 +11509,7 @@
        /// <returns></returns>
        [Route("GetGy_CusTypeDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_CusType_Query")]
        public ApiResult<DataSet> GetGy_CusTypeDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_CusTypeDetail(HID);
@@ -11461,6 +11522,7 @@
        /// <returns></returns>
        [Route("DeltetGy_CusType")]
        [HttpGet]
        [Permission(HModName = "Gy_CusType_Drop")]
        public object DeltetGy_CusType(string HItemID, string user)
        {
            DataSet ds;
@@ -11678,6 +11740,7 @@
        #region 客户分类项目 导入(保存)
        [Route("Gy_CusType/Gy_CusType_btnSave")]
        [HttpPost]
        [Permission(HModName = "Gy_CusType_Edit")]
        public object Gy_CusType_btnSave([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
@@ -11798,6 +11861,7 @@
        /// <returns></returns>
        [Route("SaveGy_StockCheckItemList")]
        [HttpPost]
        [Permission(HModName = "Gy_StockCheckItem_Edit")]
        public object SaveGy_StockCheckItemList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -12001,6 +12065,7 @@
        /// <returns></returns>
        [Route("GetGy_StockCheckItemDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_StockCheckItem_Query")]
        public ApiResult<DataSet> GetGy_StockCheckItemDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_StockCheckItemDetail(HID);
@@ -12013,6 +12078,7 @@
        /// <returns></returns>
        [Route("DeltetGy_StockCheckItem")]
        [HttpGet]
        [Permission(HModName = "Gy_StockCheckItem_Drop")]
        public object DeltetGy_StockCheckItem(string HItemID, string user)
        {
            DataSet ds;
@@ -12078,6 +12144,7 @@
        /// <returns></returns>
        [Route("SaveGy_ProjectMoneyList")]
        [HttpPost]
        [Permission(HModName = "Gy_ProjectMoney_Edit")]
        public object SaveGy_ProjectMoneyList([FromBody] JObject msg)
        {
            DataSet ds;
@@ -12280,6 +12347,8 @@
        /// <returns></returns>
        [Route("GetGy_ProjectMoneyDetail")]
        [HttpGet]
        [Permission(HModName = "Gy_ProjectMoney_Query")]
        public ApiResult<DataSet> GetGy_ProjectMoneyDetail(string HID)
        {
            var model = LuBaoSevice.GetGy_ProjectMoneyDetail(HID);
@@ -12292,6 +12361,7 @@
        /// <returns></returns>
        [Route("DeltetGy_ProjectMoney")]
        [HttpGet]
        [Permission(HModName = "Gy_ProjectMoney_Drop")]
        public object DeltetGy_ProjectMoney(string HItemID, string user)
        {
            DataSet ds;
@@ -18733,6 +18803,7 @@
        /// <returns></returns>
        [Route("Xt_User/Gy_UserByUserListDrop")]
        [HttpGet]
        [Permission(HModName = "Gy_UserByUser_Drop")]
        public object DeltetGy_Material(string HItemID, string user)
        {
            DataSet ds;
@@ -18822,6 +18893,8 @@
        /// <returns></returns>
        [Route("Gy_UserByUserEdit")]
        [HttpGet]
        [Permission(HModName = "Gy_UserByUser_Query")]
        public ApiResult<DataSet> Gy_UserByUserEdit(string HID)
        {
            var model = LuBaoSevice.Gy_UserByUserEdit(HID);
@@ -19350,6 +19423,7 @@
        /// <returns></returns>
        [Route("Web/GetClassTimePrjGroupBillEdit_Json")]
        [HttpGet]
        public object GetClassTimePrjGroupBillEdit_Json(string sWhere)
        {
            //if (!DBUtility.ClsPub.Security_Log("Gy_ClassTimePrj", 1, false, user))
@@ -19443,6 +19517,7 @@
        /// <returns></returns>
        [Route("Web/SaveGetClassTimePrjGroupList")]
        [HttpGet]
        [Permission(HModName = "Gy_ClassTimePrj")]
        public object SaveGetClassTimePrjGroupList(string HNumber, string HName, string HDeptID, string refSav, string user, string HItem)
        {
@@ -20473,7 +20548,7 @@
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取失败" + ex.ToString();
                objjson.Message = "获取失败" + ex.Message.ToString();
                objjson.data = null;
                return objjson;
            }
@@ -20968,7 +21043,18 @@
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败,明细查无数据";
                    if(Type == "DJ")
                    {
                        objjson.Message = "获取失败,模具无绑定的点检规程";
                    }
                    else if (Type == "BY")
                    {
                        objjson.Message = "获取失败,模具无绑定的保养规程";
                    }
                    else
                    {
                        objjson.Message = "获取失败,明细查无数据";
                    }
                    objjson.data = null;
                    return objjson;
                }
@@ -21169,12 +21255,12 @@
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn("select ManagerFlag from gy_czygl where czymc='" + user.Trim() + "'", "gy_czygl");
                if (!(bool)ds.Tables[0].Rows[0]["ManagerFlag"])  //是否管理员
                {
                    //不是管理员
                    sWhere += " and 制单人 = '" + user + "'";
                }
                //ds = oCN.RunProcReturn("select ManagerFlag from gy_czygl where czymc='" + user.Trim() + "'", "gy_czygl");
                //if (!(bool)ds.Tables[0].Rows[0]["ManagerFlag"])  //是否管理员
                //{
                //    //不是管理员
                //    sWhere += " and 制单人 = '" + user + "'";
                //}
                string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere + " order by 日期 desc, hmainid desc");
@@ -22852,6 +22938,7 @@
        /// <returns></returns>
        [Route("Web/GetModuleName")]
        [HttpGet]
        [AllowAnonymous]
        public object GetModuleName(string HModuleType)
        {
            try
@@ -23455,6 +23542,7 @@
        #region 用于连接的健康度检验,只要能访问通这个接口,则表明连接可用
        [Route("Health")]
        [HttpGet]
        [AllowAnonymous]
        public IHttpActionResult CheckHealth()
        {
            // 返回 200 状态码 确认健康状态
@@ -23555,7 +23643,7 @@
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败, 单据无返回值!";
                    objjson.Message = "无待上模单据!";
                    objjson.data = null;
                    return objjson;
                }else
@@ -23610,7 +23698,7 @@
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败, 单据无返回值!";
                    objjson.Message = "无待开工单据!";
                    objjson.data = null;
                    return objjson;
                }
@@ -23667,7 +23755,7 @@
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败, 单据无返回值!";
                    objjson.Message = "无待下模单据!";
                    objjson.data = null;
                    return objjson;
                }
@@ -23991,5 +24079,561 @@
            }
        }
        #endregion
        #region  APP登录权限验证接口
        /// <summary>
        /// APP登录权限验证接口
        /// </summary>
        [Route("Auth/CheckAppLoginAuth")]
        [HttpPost]
        public object CheckAppLoginAuth()
        {
            try
            {
                // 获取请求参数
                string orgID = HttpContext.Current.Request.Form["orgID"] ?? "";
                string orgName = HttpContext.Current.Request.Form["orgName"] ?? "";
                string serverUrl = HttpContext.Current.Request.Form["serverUrl"] ?? "";
                string phoneType = HttpContext.Current.Request.Form["phoneType"] ?? "";
                string userAccount = HttpContext.Current.Request.Form["userAccount"] ?? "";
                string other = HttpContext.Current.Request.Form["other"] ?? "";
                // 参数验证
                if (string.IsNullOrEmpty(userAccount))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "账号不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrEmpty(orgID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "组织ID不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                // 参数安全处理(防止注入)
                orgID = orgID.Replace("'", "''");
                orgName = orgName.Replace("'", "''");
                serverUrl = serverUrl.Replace("'", "''");
                phoneType = phoneType.Replace("'", "''");
                userAccount = userAccount.Replace("'", "''");
                // 执行固定存储过程
                string sql = $"EXEC SP_CheckAppLoginAuth '{orgID}', '{orgName}', '{serverUrl}', '{phoneType}','{userAccount}','{other}'";
                ds = oCN.RunProcReturn(sql, "SP_CheckAppLoginAuth");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    int result = Convert.ToInt32(ds.Tables[0].Rows[0]["Result"]);
                    string message = ds.Tables[0].Rows[0]["Message"].ToString();
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = message;
                    objJsonResult.data = ds.Tables[0];
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "验证接口返回异常!";
                    objJsonResult.data = null;
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 蓝牙打印机获取打印模板
        public class PrintRequestDto
        {
            public string ptMode { get; set; }
            public string templateName { get; set; }
            public JArray msg { get; set; } // 你的批量数据
        }
        /// <summary>
        /// ptMode: 打印模式,即需要那种打印指令,CPCL,TSPL,ESC,ZPL 中选择
        /// templateName: 模板名,根据模板去指定目录下根据后缀找文件
        /// msg: 打印内容
        /// </summary>
        /// <param name="ptMode"></param>
        /// <param name="templateName"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        [Route("WebAPI/getBLEPrintTemplate")]
        [HttpPost]
        public object getBLEPrintTemplate([FromBody] PrintRequestDto dto)
        {
            var ptMode = dto.ptMode;
            var templateName = dto.templateName;
            var msg = dto.msg;
            if (string.IsNullOrWhiteSpace(ptMode))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "未选择打印模式,无法生成打印模板!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            if (string.IsNullOrWhiteSpace(templateName))
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "未选择打印模板,无法生成打印模板!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            string suffix = ".txt";
            string folder = "ptTemplate";
            // 匹配 {{ 字段名 }} 所需正则表达式 支持中文
            var regex = new Regex(@"{{\s*([\u4e00-\u9fa5a-zA-Z0-9_\s]+?)\s*}}", RegexOptions.Singleline);
            // 匹配 矩形框 位置 宽高 所需正则表达式
            var RectRegex = new Regex(@"^\^FO(\d+),(\d+)\^GB(\d+),(\d+)", RegexOptions.Singleline);
            // 匹配 模板字符串 所在行 位置 宽高 所需正则表达式 支持中文
            var fieldRegex = new Regex(@"\^FO(\d+),(\d+)\^A[A-Z]+,(\d+),(\d+).*?\{\{\s*([\u4e00-\u9fa5a-zA-Z0-9_\s]+?)\s*\}\}", RegexOptions.Singleline);
            if (ptMode == "ZPL")
            {
                suffix = ".zpl";
                folder = "ZPLTemplate";
            }
            try
            {
                // 读取模板文件
                string rootPath = System.Web.HttpContext.Current.Server.MapPath("~/");
                string templateDir = Path.Combine(rootPath, folder);
                string templateFile = Path.Combine(templateDir, templateName+suffix);
                // 如果目录不存在
                if (!Directory.Exists(templateDir))
                {
                    Directory.CreateDirectory(templateDir);
                }
                // 如果文件不存在
                if (!File.Exists(templateFile))
                {
                    objJsonResult.code = "0";
                    objJsonResult.Message = $"模板文件不存在:{templateFile}";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                // 读取模板(UTF8 支持中文)
                string templateContent = File.ReadAllText(templateFile, Encoding.UTF8);
                // 逐行读取模板文件
                var lines = templateContent.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None);
                var sb = new StringBuilder();
                foreach(JToken JOneKVP in msg)
                {
                    if(JOneKVP is JObject item)
                    {
                        //foreach (var line in lines)
                        //{
                            //string currentLine = line;
                            //// 跳过注释行 //
                            //if (currentLine.TrimStart().StartsWith("//"))
                            //{
                                //continue;
                            //}
                            //// 正则表达式匹配 {{ 字段名 }} 所在行的字段,如果有,则进行替换,没有,则默认为空字符串
                            //currentLine = regex.Replace(currentLine, match =>
                            //{
                                ////判断上一行是否为矩形行,如果是矩形行,则根据矩形行的宽高判断字符是否需要换行
                                //string fieldName = match.Groups[1].Value.Trim();
                                //if (msg != null && item.ContainsKey(fieldName))
                                //{
                                    //return item[fieldName]?.ToString() ?? "";
                                //}
                                //return "";
                            //});
                            //// 将所有 \n 的换行符 替换为 \r\n
                            //sb.Append(currentLine);
                            //sb.Append("\r\n"); // 标准换行
                        //}
                        for(int i = 0; i<lines.Length; i++)
                        {
                            string currentLine = lines[i];
                            string preLine = "";
                            string concatStr = "";
                            if(i>0)
                            {
                                // 获取当前行的上一行,用于判断是否是矩形框
                                preLine = lines[i - 1];
                            }
                            // 跳过注释行 //
                            if (currentLine.TrimStart().StartsWith("//"))
                            {
                                continue;
                            }
                            // 判断矩形框,如果前一行是矩形框,则需判断该行字符串长度是否超长
                            if(!getConcatStr(rectRegex: RectRegex, fieldRegex: fieldRegex,
                                PreLine: preLine, CurrLine: currentLine, fieldObject: item,
                                templateRegex: regex,
                                ref concatStr))
                            {
                                // 正则表达式匹配 {{ 字段名 }} 所在行的字段,如果有,则进行替换,没有,则默认为空字符串
                                concatStr = regex.Replace(currentLine, match =>
                                {
                                    string fieldName = match.Groups[1].Value.Trim();
                                    if (msg != null && item.ContainsKey(fieldName))
                                    {
                                        return item[fieldName]?.ToString() ?? "";
                                    }
                                    return "";
                                });
                            }
                            if(string.IsNullOrWhiteSpace(concatStr))
                            {
                                concatStr = currentLine;
                            }
                            // 将所有 \n 的换行符 替换为 \r\n
                            sb.Append(concatStr);
                            sb.Append("\r\n"); // 标准换行
                        }
                    }
                }
                string result = sb.ToString().TrimEnd();
                // 返回渲染后的打印指令
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = $"模板渲染成功";
                objJsonResult.data = result;
                return objJsonResult;
            }
            catch (Exception ex)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = $"模板渲染失败:{ex}";
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        private bool getConcatStr(Regex rectRegex, Regex fieldRegex,
            string PreLine, string CurrLine, JObject fieldObject, Regex templateRegex, ref string concatStr)
        {
            var rectRegexResult = rectRegex.Match(PreLine);
            var fieldRegexResult = fieldRegex.Match(CurrLine);
            var templateRegexResult = templateRegex.Match(CurrLine);
            if (!rectRegexResult.Success)
            {
                return false;
            }
            if(!fieldRegexResult.Success)
            {
                return false;
            }
            if(!templateRegexResult.Success)
            {
                return false;
            }
            // 矩形 位置 宽高
            int rectLocationX = int.Parse(rectRegexResult.Groups[1].Value);
            int rectLocationY = int.Parse(rectRegexResult.Groups[2].Value);
            int rectWidth = int.Parse(rectRegexResult.Groups[3].Value);
            int rectHeight = int.Parse(rectRegexResult.Groups[4].Value);
            // 模板字符串 位置 字符宽高
            int fieldLocationX = int.Parse(fieldRegexResult.Groups[1].Value);
            int fieldLocationY = int.Parse(fieldRegexResult.Groups[2].Value);
            int fieldWidth = int.Parse(fieldRegexResult.Groups[3].Value);
            int fieldHeight = int.Parse(fieldRegexResult.Groups[4].Value);
            var fieldName = fieldRegexResult.Groups[5].Value;
            JToken fieldValueToken = "";
            fieldObject.TryGetValue(fieldName, out fieldValueToken);
            if (string.IsNullOrWhiteSpace(fieldValueToken?.ToString()))
            {
                return false;
            }
            string fieldValue = fieldValueToken.ToString();
            if (fieldValue.Length * fieldWidth > rectWidth)
            {
                // 字符串长度大于矩形的最大长度 则文本需要从矩形的Y位置开始渲染
                fieldLocationY = rectLocationY;
                // 获取换行所需的行数
                int lineCount = int.Parse(Math.Ceiling((float)fieldValue.Length / fieldWidth).ToString());
                // 计算换行后的最大行数 * 字符高度 是否大于矩形最大高度
                if(lineCount * fieldHeight > rectHeight)
                {
                    fieldHeight = int.Parse(Math.Floor((float)rectHeight / lineCount).ToString());
                    fieldWidth = fieldHeight;
                }
                // 计算每行应该放多少字符
                int maxCharsPerLine = (int)Math.Ceiling((double)fieldValue.Length / lineCount);
                for (int i = 0; i < lineCount; i++)
                {
                    // 起始位置
                    int start = i * maxCharsPerLine;
                    // 剩余多少字符
                    int remaining = fieldValue.Length - start;
                    if (remaining <= 0)
                        break;
                    // 本次取几个字符
                    int take = Math.Min(maxCharsPerLine, remaining);
                    // 截取当前行文本
                    string lineText = fieldValue.Substring(start, take);
                    // 计算新行坐标
                    int newY = fieldLocationY + i * fieldHeight;
                    // 替换拼接
                    concatStr += fieldRegex.Replace(CurrLine, m =>
                        $"^FO{fieldLocationX},{newY}^AJN,{fieldWidth},{fieldHeight}^CI28^FD{lineText}^FS"
                    );
                }
                return true;
            }
            return false;
        }
        #endregion
        #region APP根据设备id进行自动登录
        [HttpGet]
        [Route("Web/getSysParameter")]
        public object getSysParameter(string HClientID)
        {
            var HValue = oSystemParameter.GetSingleSystemParameter("uni-app_savelogin", ref DBUtility.ClsPub.sExeReturnInfo);
            if (HValue == "3" && HClientID != null)
            {
                DataSet ds = oCN.RunProcReturn("select * from Gy_UserClientIdRelation where HClientID= '" + HClientID + "'", "Gy_UserClientIdRelation");
                if (ds != null && ds.Tables.Count > 0)
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "根据设备自动登录";
                    objJsonResult.data = HValue;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "系统参数不存在,请联系管理";
                    objJsonResult.data = 0;
                    return objJsonResult;
                }
            }
            else if (HValue == "2" || HValue == "1")
            {
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "保存成功";
                objJsonResult.data = HValue;
                return objJsonResult;
            }
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "系统参数不存在,请联系管理";
                objJsonResult.data = 0;
                return objJsonResult;
            }
        }
        #endregion
        #region 根据表名获取sql语句
        [HttpGet]
        [Route("Web/getSQL")]
        public object getSQL(string TableName, string ModeName, string OpertionType, string Identityid)
        {
            if (OpertionType == "insert")
            {
                string sql = $"select * from {TableName}";
                DataSet ds = oCN.RunProcReturn(sql, TableName);
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "系统参数不存在,请联系管理";
                    objJsonResult.data = 0;
                    return objJsonResult;
                }
                sql = $"exec h_p_sqlhelper '{TableName}'";
                ds = oCN.RunProcReturn(sql, "h_p_sqlhelper");
                if (ds == null || ds.Tables.Count < 2 || ds.Tables[1].Rows.Count <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "系统参数不存在,请联系管理";
                    objJsonResult.data = 0;
                    return objJsonResult;
                }
                StringBuilder sb = new StringBuilder();
                string columnsStr = ds.Tables[0].Rows[0][0].ToString();
                sb.AppendLine($"sqlRes = $\"INSERT INTO [{TableName}] ({columnsStr})");
                sb.AppendLine("                VALUES (");
                // 2. 拼接 VALUES 里面的参数
                int count = ds.Tables[1].Rows.Count;
                for (int i = 0; i < count; i++)
                {
                    string propName = ds.Tables[1].Rows[i][0].ToString();
                    string valueFormat = "";
                    if (propName == "HMakeDate")
                    {
                        valueFormat = "getdata()";
                    }
                    else if (propName == "HERPItemID")
                    {
                        valueFormat = "'{0}'";
                    }
                    else
                    {
                        valueFormat = $"'{{{ModeName}.{propName}}}'"; // 默认通用逻辑
                    }
                    sb.Append("                " + valueFormat);
                    if (i < count - 1)
                    {
                        sb.Append(",");
                    }
                    sb.AppendLine();
                }
                sb.AppendLine("                ); \";");
                sb.Append(" oCN.RunProc(sqlRes);");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "成功";
                objJsonResult.data = sb;
                return objJsonResult;
            }
            else
            {
                string whereKey = Identityid;
                string sql = $"select * from {TableName}";
                DataSet ds = oCN.RunProcReturn(sql, TableName);
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "系统参数不存在,请联系管理";
                    objJsonResult.data = 0;
                    return objJsonResult;
                }
                sql = $"exec h_p_sqlhelper '{TableName}'";
                ds = oCN.RunProcReturn(sql, "h_p_sqlhelper");
                if (ds == null || ds.Tables.Count < 2 || ds.Tables[1].Rows.Count <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "系统参数不存在,请联系管理";
                    objJsonResult.data = 0;
                    return objJsonResult;
                }
                StringBuilder sb = new StringBuilder();
                sb.Append($"sqlRes =$\"Update {TableName} set ");
                int count = ds.Tables[1].Rows.Count;
                int setFieldCount = 0;
                for (int i = 0; i < count; i++)
                {
                    string propName = ds.Tables[1].Rows[i][0].ToString();
                    if (propName == whereKey)
                        continue;
                    if (setFieldCount > 0)
                    {
                        sb.Append(",");
                    }
                    string valueFormat = "";
                    if (propName == "HModifyTime" || propName == "HUpDateDate")
                    {
                        valueFormat = $"{propName}=getdate()";
                    }
                    else
                    {
                        valueFormat = $"{propName}='{{{ModeName}.{propName}}}'";
                    }
                    sb.Append("\r\n                " + valueFormat);
                    setFieldCount++;
                }
                sb.Append($" where {whereKey}='{{{ModeName}.{whereKey}}}'\"");
                sb.AppendLine();
                sb.Append("oCN.RunProc(sqlRes);");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "成功";
                objJsonResult.data = sb;
                return objJsonResult;
            }
        }
        #endregion
    }
}