chenhaozhe
2025-05-30 edcd7574e709748c5d3ccc0bd54930414ddcfc9a
WebAPI/Controllers/BaseSet/Gy_ConkTypeController.cs
@@ -18,6 +18,7 @@
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        ClsXt_SystemParameter oClsXt_SystemParameter = new ClsXt_SystemParameter();
        /// <summary>
        /// 返回故障类别列表
@@ -169,7 +170,7 @@
                    //保存前控制=========================================      
                    string sql1 = "exec h_p_Gy_ConkType_BeforeSaveCtrl " + HMakeEmp + ",'" + 1 + "'";
                    string sql1 = "exec h_p_Gy_ConkType_BeforeSaveCtrl '" + HNumber + "','" + HName + "'," + HUSEORGID + ",1,0";
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_ConkType_BeforeSaveCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
@@ -185,7 +186,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
@@ -235,7 +236,7 @@
                    oCN.BeginTran();
                    //保存前控制=========================================      
                    string sql1 = "exec h_p_Gy_ConkType_BeforeSaveCtrl " + HMakeEmp + ",'" + 2 + "'";
                    string sql1 = "exec h_p_Gy_ConkType_BeforeSaveCtrl '" + HNumber + "','" + HName + "'," + HUSEORGID + ",3," + HItemID;
                    ds = oCN.RunProcReturn(sql1, "h_p_Gy_ConkType_BeforeSaveCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
@@ -251,7 +252,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.Message = "保存失败!原因:" + ds.Tables[0].Rows[0]["HBackRemark"].ToString(); ;
                        objJsonResult.data = null;
                        oCN.RollBack();
                        return objJsonResult;
@@ -306,11 +307,48 @@
     
                    oCN.Commit();
                }
                objJsonResult.code = "0";
                //自动审核功能
                if (HItemID == 0)
                {
                    ds = oCN.RunProcReturn("select HItemID,HNumber,HName from Gy_ConkType with(nolock) where HNumber='" + HNumber + "' and HUSEORGID = " + HUSEORGID, "Gy_ConkType");
                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "保存成功!自动审核失败找不到对应单据";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else if (ds.Tables[0].Rows.Count > 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "相同使用组织下,出现" + ds.Tables[0].Rows.Count + "个相同的代码:" + ds.Tables[0].Rows[0]["HNumber"];
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        string sAutoCheck = oClsXt_SystemParameter.GetSingleSystemParameter("Gy_ConkType_AutoCheck", ref DBUtility.ClsPub.sExeReturnInfo);
                        objJsonResult.Verify = "N";
                        if (sAutoCheck == "Y")
                        {
                            objJsonResult.code = "1";
                            objJsonResult.count = 1;
                            objJsonResult.Message = "保存成功";
                            objJsonResult.data = ds.Tables[0].Rows[0]["HItemID"].ToString();
                            objJsonResult.Verify = "Y";
                            return objJsonResult;
                        }
                    }
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "保存成功!";
                //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单");
                objJsonResult.data = 1;
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
@@ -336,7 +374,7 @@
            try
            {
                ds = oCN.RunProcReturn("select * from h_v_Gy_ConkTypeList where HitemID=" + HInterID, "h_v_Gy_ConkTypeList");
                ds = oCN.RunProcReturn("select * from h_v_Gy_ConkType_Edit where HitemID=" + HInterID, "h_v_Gy_ConkType_Edit");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
@@ -364,7 +402,7 @@
            }
        }
        [Route("DeltetGy_ConkType")]
        [HttpGet]
        public object DeltetGy_ConkType(string HItemID, string user)
@@ -420,6 +458,17 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "" || ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据当前处于不能删除状态!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                //删除前控制=========================================      
                string sql1 = "exec h_p_Gy_ConkType_BeforeDelCtrl " + HItemID + ",'" + user + "'";
                ds = oCN.RunProcReturn(sql1, "h_p_Gy_ConkType_BeforeDelCtrl");