yusijie
2024-03-12 abf59bc386d65013b4782eb0b3af463457dbe968
WebAPI/Controllers/WebAPIController.cs
@@ -143,6 +143,56 @@
            }
        }
        /// <summary>
        /// 自动获取基础资料 流水号 就是代码
        /// </summary>
        /// <param name="HBillType"></param>
        /// <returns></returns>
        [Route("Web/GetMAXNumber")]
        [HttpGet]
        public object GetMAXNumber(string HBillType,string HName,string TableName)
        {
            try
            {
                string HNumber = "";
                HNumber = DBUtility.ClsPub.CreateHNumber(HBillType,HName, TableName, ref DBUtility.ClsPub.sExeReturnInfo, true);
                //----------创建虚表------------------------
                DataTable dt_Main = new DataTable("Json");
                dt_Main.Columns.Add("HNumber", typeof(string));
                //---------创建新行------------------------
                DataRow dr_main = dt_Main.NewRow();//创建新行
                dt_Main.Rows.Add(dr_main);//将新行加入到表中
                dr_main["HNumber"] = DBUtility.ClsPub.isStrNull(HNumber);
                if (HNumber == null)
                {
                    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;
            }
        }
        //[Route("Web/Get_MaxBillNoAndID")]
        //[HttpGet]
@@ -8109,14 +8159,34 @@
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Gy_ProjectMoney where HItemID=" + HItemID, "Gy_ProjectMoney");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                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.Message = "单据不存在!";
                    objJsonResult.data = null;
                    return objJsonResult; ;
                    return objJsonResult;
                }
@@ -8951,11 +9021,11 @@
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (sWhere == null || sWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn("Select HInterID,HEquipFileNumber,HName  from Gy_EquipFileBillMain where 0=0 Order by HInterID ", "Gy_EquipFileBillMain");
                    ds = oCN.RunProcReturn("Select HInterID,HEquipFileNumber,HName,HModel2  from Gy_EquipFileBillMain where 0=0 Order by HInterID ", "Gy_EquipFileBillMain");
                }
                else
                {
                    string sql1 = "Select HInterID,HEquipFileNumber,HName  from Gy_EquipFileBillMain where 0=0  ";
                    string sql1 = "Select HInterID,HEquipFileNumber,HName,HModel2  from Gy_EquipFileBillMain where 0=0  ";
                    string sql = sql1 + sWhere;
                    ds = oCN.RunProcReturn(sql, "Gy_EquipFileBillMain");
                }
@@ -9984,7 +10054,7 @@
        /// <returns></returns>
        [Route("Web/GetItemByEquipFile")]
        [HttpGet]
        public object GetItemByEquipFile(int EquipProjectID,string Type)
        public object GetItemByEquipFile(int EquipProjectID,string Type,string HDate)
        {
            if (EquipProjectID <= 0)
            {
@@ -10014,7 +10084,8 @@
                }
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                string sql = string.Format(@"select * from " + HView + " where HInterID = " + EquipProjectID);
                //string sql = string.Format(@"select * from " + HView + " where HInterID = " + EquipProjectID);
                string sql = string.Format(@"Exec h_p_Sb_GetCheckItem_PDA '" + EquipProjectID + "','" + Type + "','" + HDate + "'");
                ds = oCN.RunProcReturn(sql, HView);
                if (ds == null || ds.Tables[0].Rows.Count <= 0)
                {
@@ -10049,7 +10120,7 @@
        /// <returns></returns>
        [Route("Web/GetEquipmentBillsList")]
        [HttpGet]
        public object GetEquipmentBillsList(string sWhere, string Type)
        public object GetEquipmentBillsList(string sWhere, string Type,string user)
        {            
            try
            {
@@ -10064,7 +10135,7 @@
                        HView = "h_v_Sb_EquipMaintainBillList";
                        break;
                    case "WX":
                        HView = "h_v_Sb_EquipRepairCheckBillList";
                        HView = "h_v_Sb_EquipRepairWorkBillList";
                        break;
                    case "GZ":
                        HView = "h_v_Sb_EquipConkBookBillList";
@@ -10081,6 +10152,15 @@
                }
                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 + "'";
                }
                string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere);
                ds = oCN.RunProcReturn(sql, HView);
                //添加列名