zrg
2024-07-30 67bfff895914fe3d56f1c1c4c5e39efb5fec2a06
WebAPI/Controllers/SCGL/Gy_SourceWorkStationSetController.cs
@@ -171,5 +171,57 @@
        }
        #endregion
        /// <summary>
        /// 生产工位列表删除功能
        /// </summary>
        /// <returns></returns>
        [Route("DeltetGy_SourceWorkStation")]
        [HttpGet]
        public object DeltetGy_SourceWorkStation(string HItemID, string user)
        {
            DataSet ds;
            DataSet ds1;
            try
            {
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (string.IsNullOrWhiteSpace(HItemID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HItemID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.BeginTran();//开始事务
                ds = oCN.RunProcReturn("select * from Gy_SourceWorkStationSet where HItemID=" + HItemID, "Gy_SourceWorkStationSet");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有数据,无法删除!";
                    objJsonResult.data = null;
                    return objJsonResult; ;
                }
                oCN.RunProc("delete from Gy_SourceWorkStationSet where HItemID=" + HItemID);
                oCN.Commit();//提交事务
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "* 数据删除成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "删除失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
    }
}