duhe
2025-05-27 7632bb98d88c05da859ba0a6030fe0a9d3940b3d
WebAPI/Controllers/BaseSet/Gy_ModelTypeController.cs
@@ -150,6 +150,25 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DataSet ds_check_1 = oCN.RunProcReturn("select * from Gy_MouldType where HItemID =" + HItemID, "Gy_MouldType");
                if (ds_check_1.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败:数据不存在";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else if (ds_check_1.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "删除失败:当前数据已审核,不可删除";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oDeptHlp.GetInfoByID(HItemID))
                {
                    if (oDept.HavChildCodes(HItemID))
@@ -243,6 +262,17 @@
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                bool HEndFlag = list[0].HEndFlag;
                long HUSEORGID = list[0].HUSEORGID;
                DataSet ds_check = oCN.RunProcReturn("select * from Gy_MouldType where HNumber = '" + HNumber + "' and HUSEORGID = " + HUSEORGID, "Gy_MouldType");
                if (ds_check.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "新增失败:当前组织下代码【" + HNumber + "】已存在,请修改代码后重新保存";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //判断权限
                if (!DBUtility.ClsPub.Security_Log(msg4, 1, false, msg3))
@@ -270,9 +300,9 @@
                //主表
                oCN.RunProc("Insert into Gy_MouldType " +
                   " (HNumber,HName,HHelpCode,HShortNumber,HParentID" +
                   ",HLevel,HEndFlag,HStopflag,HRemark,HMakeEmp,HMakeTime) " +
                   ",HLevel,HEndFlag,HStopflag,HRemark,HMakeEmp,HMakeTime,HUSEORGID) " +
                   " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID +
                   "," + HLevel+ "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "','" + msg3 + "',getdate())", ref DBUtility.ClsPub.sExeReturnInfo);
                   "," + HLevel+ "," + Convert.ToString(HEndFlag ? 1 : 0) + "," + Convert.ToString(HStopflag ? 1 : 0) + ",'" + HRemark + "','" + msg3 + "',getdate()," + HUSEORGID + ")", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                oCN.RunProc("Update Gy_MouldType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
                oCN.Commit();
@@ -328,6 +358,35 @@
                string HRemark = list[0].HRemark;
                bool HStopflag = list[0].HStopflag;
                string HUseFlag = list[0].HUseFlag;
                long HUSEORGID = list[0].HUSEORGID;
                DataSet ds_check = oCN.RunProcReturn("select * from Gy_MouldType where HNumber = '" + HNumber + "' and HUSEORGID = " + HUSEORGID + " and HItemID <>" + HItemID,"Gy_MouldType");
                if (ds_check.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "修改失败:当前组织下代码【" + HNumber + "】已存在,请修改代码后重新保存";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                DataSet ds_check_1 = oCN.RunProcReturn("select * from Gy_MouldType where HItemID =" + HItemID, "Gy_MouldType");
                if (ds_check_1.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "修改失败:数据不存在";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else if(ds_check_1.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "修改失败:当前数据已审核,不可修改";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //判断权限
                if (!DBUtility.ClsPub.Security_Log(msg5, 1, false, msg4))
@@ -372,7 +431,8 @@
                    ",HRemark= '" + HRemark + "' " +
                    ",HModifyEmp='" + msg4 + "' " +
                    ",HModifyTime=getdate() " +
                    "Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                    ",HUSEORGID=" + HUSEORGID + " " +
                    " Where HItemID=" + HItemID, ref DBUtility.ClsPub.sExeReturnInfo);
                //修改子项目代码
                //oCN.RunProc("exec h_p_Gy_UpdateNumber Gy_RepairCheck,'" + HNumber + ".','" + this.HOldNumber + ".'", ref DBUtility.ClsPub.sExeReturnInfo);
                //将上级 为非末级
@@ -409,7 +469,8 @@
        {
            try
            {
                ds = oCN.RunProcReturn("select * from Gy_MouldType where HItemID=" + HInterID, "Gy_MouldType");
                string sql = "select a.*,b.HName HParentName from Gy_MouldType as a left join Gy_MouldType as b on a.HParentID = b.HItemID where a.HItemID=" + HInterID;
                ds = oCN.RunProcReturn(sql, "Gy_MouldType");
                objJsonResult.code = "1";
                objJsonResult.count = 1;