|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | public class QC_ManagementController : ApiController | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #region 错误返回方法 | 
|---|
|  |  |  | // GET: QC_Management | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有返回任何记录!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | 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]; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //else | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //objJsonResult.code = "0"; | 
|---|
|  |  |  | //objJsonResult.count = 0; | 
|---|
|  |  |  | //objJsonResult.Message = "无数据"; | 
|---|
|  |  |  | //objJsonResult.data = null; | 
|---|
|  |  |  | //return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | #region [伪删除模式] | 
|---|
|  |  |  | ///// <summary> | 
|---|
|  |  |  | ///// 首件检验逻辑删除功能 | 
|---|
|  |  |  | ///// </summary> | 
|---|
|  |  |  | ///// <returns></returns> | 
|---|
|  |  |  | //[Route("DeltetQC_FirstPieceCheck")] | 
|---|
|  |  |  | //[HttpGet] | 
|---|
|  |  |  | //public object DeltetQC_FirstPieceCheck(string HInterID,string user) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    DataSet ds; | 
|---|
|  |  |  | //    string ModRightNameCheck = "QC_FirstPieceCheckBill_Delete"; | 
|---|
|  |  |  | //    try | 
|---|
|  |  |  | //    { | 
|---|
|  |  |  | //        //删除权限 | 
|---|
|  |  |  | //        if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, user)) | 
|---|
|  |  |  | //        { | 
|---|
|  |  |  | //            objJsonResult.code = "0"; | 
|---|
|  |  |  | //            objJsonResult.count = 0; | 
|---|
|  |  |  | //            objJsonResult.Message = "审核失败!无权限!"; | 
|---|
|  |  |  | //            objJsonResult.data = null; | 
|---|
|  |  |  | //            return objJsonResult; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | //        if (string.IsNullOrWhiteSpace(HInterID)) | 
|---|
|  |  |  | //        { | 
|---|
|  |  |  | //            objJsonResult.code = "0"; | 
|---|
|  |  |  | //            objJsonResult.count = 0; | 
|---|
|  |  |  | //            objJsonResult.Message = "HInterID为空!"; | 
|---|
|  |  |  | //            objJsonResult.data = null; | 
|---|
|  |  |  | //            return objJsonResult; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        oCN.BeginTran();//开始事务 | 
|---|
|  |  |  | //        ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillMain where HInterID=" + HInterID, "QC_FirstPieceCheckBillMain"); | 
|---|
|  |  |  | //        DataSet ds2 = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillSub where HInterID=" + HInterID, "QC_FirstPieceCheckBillSub"); | 
|---|
|  |  |  | //        if (ds == null || ds.Tables[0].Rows.Count == 0 || ds2 == null || ds2.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | //        { | 
|---|
|  |  |  | //            objJsonResult.code = "0"; | 
|---|
|  |  |  | //            objJsonResult.count = 0; | 
|---|
|  |  |  | //            objJsonResult.Message = "没有这个单据,无法删除!"; | 
|---|
|  |  |  | //            objJsonResult.data = null; | 
|---|
|  |  |  | //            return objJsonResult; ; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        var HCloseMan = Convert.ToString(ds.Tables[0].Rows[0]["HCloseMan"]); | 
|---|
|  |  |  | //        var HCloseMan2 = Convert.ToString(ds2.Tables[0].Rows[0]["HCloseMan"]); | 
|---|
|  |  |  | //        if (!string.IsNullOrWhiteSpace(HCloseMan) || !string.IsNullOrWhiteSpace(HCloseMan2)) | 
|---|
|  |  |  | //        { | 
|---|
|  |  |  | //            oCN.RollBack();//回滚事务 | 
|---|
|  |  |  | //            objJsonResult.code = "0"; | 
|---|
|  |  |  | //            objJsonResult.count = 0; | 
|---|
|  |  |  | //            objJsonResult.Message = "单据已删除无法再次删除!"; | 
|---|
|  |  |  | //            objJsonResult.data = null; | 
|---|
|  |  |  | //            return objJsonResult; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //        oCN.RunProc("update QC_FirstPieceCheckBillMain set HCloseMan='-1',HCloseDate=GETDATE()  where HInterID=" + HInterID); | 
|---|
|  |  |  | //        oCN.RunProc("update QC_FirstPieceCheckBillSub set HCloseMan='-1',HEntryCloseDate=GETDATE()  where HInterID=" + HInterID); | 
|---|
|  |  |  | //        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; | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | #endregion | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 首件检验逻辑删除功能 | 
|---|
|  |  |  | 
|---|
|  |  |  | /// <returns></returns> | 
|---|
|  |  |  | [Route("DeltetQC_FirstPieceCheck")] | 
|---|
|  |  |  | [HttpGet] | 
|---|
|  |  |  | public object DeltetQC_FirstPieceCheck(string HInterID,string user) | 
|---|
|  |  |  | public object DeltetQC_FirstPieceCheck(string HInterID, string user) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | DataSet ds; | 
|---|
|  |  |  | string ModRightNameCheck = "QC_FirstPieceCheckBill_Delete"; | 
|---|
|  |  |  | try | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "审核失败!无权限!"; | 
|---|
|  |  |  | objJsonResult.Message = "删除失败!无权限!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
|---|
|  |  |  | if (string.IsNullOrWhiteSpace(HInterID)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | oCN.BeginTran();//开始事务 | 
|---|
|  |  |  | ds = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillMain where HInterID=" + HInterID, "QC_FirstPieceCheckBillMain"); | 
|---|
|  |  |  | DataSet ds2 = oCN.RunProcReturn("select * from QC_FirstPieceCheckBillSub where HInterID=" + HInterID, "QC_FirstPieceCheckBillSub"); | 
|---|
|  |  |  | if (ds == null || ds.Tables[0].Rows.Count == 0 || ds2 == null || ds2.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "没有这个单据,无法删除!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var HCloseMan = Convert.ToString(ds.Tables[0].Rows[0]["HCloseMan"]); | 
|---|
|  |  |  | var HCloseMan2 = Convert.ToString(ds2.Tables[0].Rows[0]["HCloseMan"]); | 
|---|
|  |  |  | if (!string.IsNullOrWhiteSpace(HCloseMan) || !string.IsNullOrWhiteSpace(HCloseMan2)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack();//回滚事务 | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "单据已删除无法再次删除!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | oCN.RunProc("update QC_FirstPieceCheckBillMain set HCloseMan='-1',HCloseDate=GETDATE()  where HInterID=" + HInterID); | 
|---|
|  |  |  | oCN.RunProc("update QC_FirstPieceCheckBillSub set HCloseMan='-1',HEntryCloseDate=GETDATE()  where HInterID=" + HInterID); | 
|---|
|  |  |  | oCN.Commit();//提交事务 | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | //开始事物 | 
|---|
|  |  |  | oCN.BeginTran(); | 
|---|
|  |  |  | oCN.RunProc("Delete From QC_FirstPieceCheckBillMain where HInterID = " + HInterID); | 
|---|
|  |  |  | oCN.RunProc("Delete From QC_FirstPieceCheckBillSub where HInterID = " + HInterID); | 
|---|
|  |  |  | oCN.RunProc("Delete From QC_FirstPieceCheckBillSub_ValueGrid where HInterID = " + HInterID); | 
|---|
|  |  |  | oCN.RunProc("Delete From QC_FirstPieceCheckBillSub_Result where HInterID = " + HInterID); | 
|---|
|  |  |  | //提交事务 | 
|---|
|  |  |  | oCN.Commit(); | 
|---|
|  |  |  | objJsonResult.code = "1"; | 
|---|
|  |  |  | objJsonResult.count = 1; | 
|---|
|  |  |  | objJsonResult.Message = "* 单据删除成功!"; | 
|---|
|  |  |  | objJsonResult.Message = "删除成功!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; ; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); //回滚事物 | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "删除失败!" + e.ToString(); | 
|---|