ch
2022-11-03 c761ba5bd72e9170c65fad44003e90a61e034b33
WebAPI/Controllers/»ù´¡×ÊÁÏ/»ù´¡×ÊÁÏ/Gy_RepairBillController.cs
@@ -1,4 +1,5 @@
using DBUtility;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -28,7 +29,8 @@
        {
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Gy_Repair", 1, true, user))
                List<object> columnNameList = new List<object>();
                if (!DBUtility.ClsPub.Security_Log("Gy_Repair", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -36,23 +38,34 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select HItemID,HNumber,HName,HLevel, case when HEndFlag<>0 then 'Y'else ' 'end HEndFlag,case when HStopFlag <> 0 then 'Y'else ' 'end HStopFlag, HRemark, HUseFlag from Gy_Repair where 1=1 " + sWhere, "Gy_Repair");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                ds = oCN.RunProcReturn("select * from h_v_Gy_RepairList where 1=1 " + sWhere+ "  order by hitemid", "h_v_Gy_RepairList");
                //添加列名
                foreach (DataColumn col in ds.Tables[0].Columns)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无保养项目数据!";
                    objJsonResult.data = null;
                    return objJsonResult;
                    Type dataType = col.DataType;
                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名
                }
                else
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "查找成功!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
                //if (ds.Tables[0].Rows.Count != 0 || ds != null)
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.data = ds.Tables[0];
                objJsonResult.list = columnNameList;
                return objJsonResult;
                //}
                //else
                //{
                //objJsonResult.code = "0";
                //objJsonResult.count = 0;
                //objJsonResult.Message = "无数据";
                //objJsonResult.data = null;
                //return objJsonResult;
                //}
            }
            catch (Exception e)
            {
@@ -73,7 +86,7 @@
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Gy_Repair_Delete", 1, true, User))
                if (!DBUtility.ClsPub.Security_Log("Gy_Repair_Delete", 1, false, User))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -166,7 +179,7 @@
                string HUseFlag = list[0].HUseFlag;
                //判断权限
                if (!ClsPub.Security_Log("Gy_Repair_Edit", 1, true, msg4))
                if (!ClsPub.Security_Log("Gy_Repair_Edit", 1, false, msg4))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -181,15 +194,6 @@
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "代码中不能出现连续‘.’并且首位末位不能为‘.’!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oDept.HavSameNumber(HItemID, HNumber))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "代码重复!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -256,7 +260,7 @@
                bool HEndFlag = list[0].HEndFlag;
                //判断权限
                if (!ClsPub.Security_Log("Gy_Repair_Edit", 1, true, msg3))
                if (!ClsPub.Security_Log("Gy_Repair_Edit", 1, false, msg3))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -281,9 +285,9 @@
                //主表
                oCN.RunProc("Insert into Gy_Repair " +
                   " (HNumber,HName,HHelpCode,HShortNumber" +
                   ",HLevel,HEndFlag,HStopflag,HRemark,HMakeTime) " +
                   ",HLevel,HEndFlag,HStopflag,HRemark,HParentID) " +
                   " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," +
                    +HLevel + "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo);
                    +HLevel + ",1," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "',0)", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                //oCN.RunProc("Update Gy_MouldType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCN.Commit();