using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pub_Class; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Web.Http; using WebAPI.Models; namespace WebAPI.Controllers { public class Gy_BadReasonController : ApiController { public DBUtility.ClsPub.Enum_BillStatus BillStatus; private json objJsonResult = new json(); SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); DataSet ds; /// /// 返回不良原因列表 ///参数:string sql。 ///返回值:object。 /// [Route("Gy_BadReason/list")] [HttpGet] public object list(string sWhere,string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_BadReason", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } if (sWhere == null || sWhere.Equals("")) { ds = oCN.RunProcReturn("select * from h_v_IF_BadReasonList " + sWhere+ " order by 不良原因代码 ", "h_v_IF_BadReasonList"); } else { string sql1 = "select * from h_v_IF_BadReasonList where 1 = 1"; string sql = sql1 + sWhere+ " order by 不良原因代码 "; ds = oCN.RunProcReturn(sql, "h_v_IF_BadReasonList"); } //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } //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) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #region 不良原因审核、反审核 /// /// /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_BadReason")] [HttpGet] public object AuditGy_BadReason(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_BadReason_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_BadReason where HItemID=" + HInterID, "Gy_BadReason"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_BadReason set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_BadReason set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 不良原因禁用、反禁用 /// /// /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_BadReason")] [HttpGet] public object StopGy_BadReason(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_BadReason_Stop", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_BadReason where HItemID=" + HInterID, "Gy_BadReason"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_BadReason set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_BadReason set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 不良类型 查询 [Route("Gy_BadReason/Gy_BadTypeList")] [HttpGet] public object Gy_BadTypeList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_BadType_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_gy_BadTypeList where 1 = 1"; string sql = sql1 + sWhere + " order by 不良类型代码 "; ds = oCN.RunProcReturn(sql, "h_v_gy_BadTypeList"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 不良后果 查询,审核,反审核,禁用,反禁用 /// /// 不良后果 查询 /// /// /// /// [Route("Gy_BadReason/Gy_BadResultList")] [HttpGet] public object Gy_BadResultList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_BadResult_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_Gy_BadResult where 1 = 1"; string sql = sql1 + sWhere + " order by 不良后果代码 "; ds = oCN.RunProcReturn(sql, "h_v_Gy_BadResult"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 不良后果审核、反审核 /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_BadResult")] [HttpGet] public object AuditGy_BadResult(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_BadResult_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_BadResult where HItemID=" + HInterID, "Gy_BadResult"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_BadResult set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_BadResult set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 不良后果禁用、反禁用 /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_BadResult")] [HttpGet] public object StopGy_BadResult(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_BadResult_Close", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_BadResult where HItemID=" + HInterID, "Gy_BadResult"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_BadResult set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_BadResult set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 检测值 查询,审核,反审核,禁用,反禁用 /// /// 检测值 查询 /// /// /// /// [Route("Gy_BadReason/Gy_InspectValueList")] [HttpGet] public object Gy_InspectValueList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_InspectValue_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_Gy_InspectValue where 1 = 1"; string sql = sql1 + sWhere + " order by 检测值代码 "; ds = oCN.RunProcReturn(sql, "h_v_Gy_InspectValue"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 检测值审核、反审核 /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_InspectValue")] [HttpGet] public object AuditGy_InspectValue(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectValue_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_InspectValue where HItemID=" + HInterID, "Gy_InspectValue"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_InspectValue set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_InspectValue set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 检测值禁用、反禁用 /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_InspectValue")] [HttpGet] public object StopGy_InspectValue(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectValue_Close", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_InspectValue where HItemID=" + HInterID, "Gy_InspectValue"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_InspectValue set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_InspectValue set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 检验方法 查询,审核,反审核,禁用,反禁用 /// /// 检验方法 查询 /// /// /// /// [Route("Gy_BadReason/Gy_InspectMethodList")] [HttpGet] public object Gy_InspectMethodList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_InspectMethod_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_Gy_InspectMethod where 1 = 1"; string sql = sql1 + sWhere + " order by 检验方法代码 "; ds = oCN.RunProcReturn(sql, "h_v_Gy_InspectMethod"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 检验方法审核、反审核 /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_InspectMethod")] [HttpGet] public object AuditGy_InspectMethod(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectMethod_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_InspectMethod where HItemID=" + HInterID, "Gy_InspectMethod"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_InspectMethod set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_InspectMethod set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 检验方法禁用、反禁用 /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_InspectMethod")] [HttpGet] public object StopGy_InspectMethod(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectMethod_Close", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_InspectMethod where HItemID=" + HInterID, "Gy_InspectMethod"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_InspectMethod set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_InspectMethod set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 质量标准 查询,审核,反审核,禁用,反禁用 /// /// 质量标准 查询 /// /// /// /// [Route("Gy_BadReason/Gy_QualityStdList")] [HttpGet] public object Gy_QualityStdList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_QualityStd_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_Gy_QualityStd where 1 = 1"; string sql = sql1 + sWhere + " order by 质量标准代码 "; ds = oCN.RunProcReturn(sql, "h_v_Gy_QualityStd"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 质量标准 审核、反审核 /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_QualityStd")] [HttpGet] public object AuditGy_QualityStd(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_QualityStd_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_QualityStd where HItemID=" + HInterID, "Gy_QualityStd"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_QualityStd set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_QualityStd set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 质量标准禁用、反禁用 /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_QualityStd")] [HttpGet] public object StopGy_QualityStd(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_QualityStd_Close", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_QualityStd where HItemID=" + HInterID, "Gy_QualityStd"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_QualityStd set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_QualityStd set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 不良类型审核、反审核 /// /// /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_BadType")] [HttpGet] public object AuditGy_BadType(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_BadType_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_BadType where HItemID=" + HInterID, "Gy_BadType"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_BadType set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_BadType set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 不良类型禁用、反禁用 /// /// /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_BadType")] [HttpGet] public object StopGy_BadType(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_BadType_Stop", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_BadType where HItemID=" + HInterID, "Gy_BadType"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_BadType set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_BadType set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 检验仪器 查询,审核,反审核,禁用,反禁用 /// /// 检验仪器 查询 /// /// /// /// [Route("Gy_BadReason/Gy_InspectInstruMentList")] [HttpGet] public object Gy_InspectInstruMentList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_InspectInstruMent_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_Gy_InspectInstruMent where 1 = 1"; string sql = sql1 + sWhere + " order by 检验仪器代码 "; ds = oCN.RunProcReturn(sql, "h_v_Gy_InspectInstruMent"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 检验仪器 审核、反审核 /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_InspectInstruMent")] [HttpGet] public object AuditGy_InspectInstruMent(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectInstruMent_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_InspectInstruMent where HItemID=" + HInterID, "Gy_InspectInstruMent"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_InspectInstruMent set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_InspectInstruMent set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 检验仪器 禁用、反禁用 /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_InspectInstruMent")] [HttpGet] public object StopGy_InspectInstruMent(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectInstruMent_Close", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_InspectInstruMent where HItemID=" + HInterID, "Gy_InspectInstruMent"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_InspectInstruMent set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_InspectInstruMent set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 检验依据 查询,审核,反审核,禁用,反禁用 /// /// 检验依据 查询 /// /// /// /// [Route("Gy_BadReason/Gy_InspectBasisList")] [HttpGet] public object Gy_InspectBasisList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_InspectBasis_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_Gy_InspectBasis where 1 = 1"; string sql = sql1 + sWhere + " order by 检验依据代码 "; ds = oCN.RunProcReturn(sql, "h_v_Gy_InspectBasis"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 检验依据 审核、反审核 /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_InspectBasis")] [HttpGet] public object AuditGy_InspectBasis(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectBasis_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_InspectBasis where HItemID=" + HInterID, "Gy_InspectBasis"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_InspectBasis set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_InspectBasis set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 检验依据 禁用、反禁用 /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_InspectBasis")] [HttpGet] public object StopGy_InspectBasis(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_InspectBasis_Close", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_InspectBasis where HItemID=" + HInterID, "Gy_InspectBasis"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_InspectBasis set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_InspectBasis set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 岗位技能 查询,审核,反审核,禁用,反禁用 /// /// 岗位技能 查询 /// /// /// /// [Route("Gy_BadReason/Gy_PostSkillList")] [HttpGet] public object Gy_PostSkillList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_PostSkill_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_Gy_PostSkill where 1 = 1"; string sql = sql1 + sWhere + " order by 岗位技能代码 "; ds = oCN.RunProcReturn(sql, "h_v_Gy_PostSkill"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 岗位技能 审核、反审核 /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_PostSkill")] [HttpGet] public object AuditGy_PostSkill(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_PostSkill_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_PostSkill where HItemID=" + HInterID, "Gy_PostSkill"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_PostSkill set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_PostSkill set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 岗位技能 禁用、反禁用 /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_PostSkill")] [HttpGet] public object StopGy_PostSkill(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_PostSkill_Close", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_PostSkill where HItemID=" + HInterID, "Gy_PostSkill"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_PostSkill set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_PostSkill set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 岗位 查询,审核,反审核,禁用,反禁用 /// /// 岗位 查询 /// /// /// /// [Route("Gy_BadReason/Gy_PostList")] [HttpGet] public object Gy_PostList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_Post_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_Gy_Post where 1 = 1"; string sql = sql1 + sWhere + " order by 岗位代码 "; ds = oCN.RunProcReturn(sql, "h_v_Gy_Post"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 岗位 审核、反审核 /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_Post")] [HttpGet] public object AuditGy_Post(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_Post_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_Post where HItemID=" + HInterID, "Gy_Post"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_Post set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_Post set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 岗位 禁用、反禁用 /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_Post")] [HttpGet] public object StopGy_Post(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_Post_Close", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_Post where HItemID=" + HInterID, "Gy_Post"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_Post set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_Post set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 调拨类型 查询,审核,反审核,禁用,反禁用 /// /// 调拨类型 查询 /// /// /// /// [Route("Gy_BadReason/Gy_StockMoveStyleList")] [HttpGet] public object Gy_StockMoveStyleList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_StockMoveStyle_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_Gy_StockMoveStyle where 1 = 1"; string sql = sql1 + sWhere + " order by 调拨类型代码 "; ds = oCN.RunProcReturn(sql, "h_v_Gy_StockMoveStyle"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 调拨类型 审核、反审核 /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_StockMoveStyle")] [HttpGet] public object AuditGy_StockMoveStyle(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_StockMoveStyle_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_StockMoveStyle where HItemID=" + HInterID, "Gy_StockMoveStyle"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_StockMoveStyle set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_StockMoveStyle set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 调拨类型 禁用、反禁用 /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_StockMoveStyle")] [HttpGet] public object StopGy_StockMoveStyle(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_StockMoveStyle_Close", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_StockMoveStyle where HItemID=" + HInterID, "Gy_StockMoveStyle"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_StockMoveStyle set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_StockMoveStyle set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 入库类型 查询,审核,反审核,禁用,反禁用 /// /// 入库类型 查询 /// /// /// /// [Route("Gy_BadReason/Gy_StockInStyleList")] [HttpGet] public object Gy_StockInStyleList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_StockInStyle_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_Gy_StockInStyle where 1 = 1"; string sql = sql1 + sWhere + " order by 入库类型代码 "; ds = oCN.RunProcReturn(sql, "h_v_Gy_StockInStyle"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 入库类型 审核、反审核 /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_StockInStyle")] [HttpGet] public object AuditGy_StockInStyle(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_StockInStyle_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_StockInStyle where HItemID=" + HInterID, "Gy_StockInStyle"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_StockInStyle set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_StockInStyle set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 入库类型 禁用、反禁用 /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_StockInStyle")] [HttpGet] public object StopGy_StockInStyle(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_StockInStyle_Close", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_StockInStyle where HItemID=" + HInterID, "Gy_StockInStyle"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_StockInStyle set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_StockInStyle set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 出库类型 查询,审核,反审核,禁用,反禁用 /// /// 出库类型 查询 /// /// /// /// [Route("Gy_BadReason/Gy_StockOutStyleList")] [HttpGet] public object Gy_StockOutStyleList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_StockOutStyle_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_Gy_StockOutStyle where 1 = 1"; string sql = sql1 + sWhere + " order by 出库类型代码 "; ds = oCN.RunProcReturn(sql, "h_v_Gy_StockOutStyle"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 出库类型 审核、反审核 /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_StockOutStyle")] [HttpGet] public object AuditGy_StockOutStyle(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_StockOutStyle_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_StockOutStyle where HItemID=" + HInterID, "Gy_StockOutStyle"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_StockOutStyle set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_StockOutStyle set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } /// /// 出库类型 禁用、反禁用 /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_StockOutStyle")] [HttpGet] public object StopGy_StockOutStyle(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_StockOutStyle_Close", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_StockOutStyle where HItemID=" + HInterID, "Gy_StockOutStyle"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_StockOutStyle set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_StockOutStyle set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常类型 查询 [Route("Gy_BadReason/Gy_ErrTypeList")] [HttpGet] public object Gy_ErrTypeList(string sWhere, string user) { try { List columnNameList = new List(); //查看权限 if (!DBUtility.ClsPub.Security_Log("Gy_ErrType_Query", 1, false, user)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "无查看权限!"; objJsonResult.data = null; return objJsonResult; } string sql1 = "select * from h_v_Gy_ErrTypeList where 1 = 1"; string sql = sql1 + sWhere + " order by 异常类型代码 "; ds = oCN.RunProcReturn(sql, "h_v_Gy_ErrTypeList"); //添加列名 foreach (DataColumn col in ds.Tables[0].Columns) { Type dataType = col.DataType; string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 } objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "Sucess!"; objJsonResult.data = ds.Tables[0]; objJsonResult.list = columnNameList; return objJsonResult; } catch (Exception e) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "Exception!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常类型审核、反审核 /// /// /// /// 单据ID /// 审核(0),反审核(1) /// 审核人 /// [Route("Gy_BadReason/AuditGy_ErrType")] [HttpGet] public object AuditGy_ErrType(int HInterID, int IsAudit, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_ErrType_Check", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_ErrType where HItemID=" + HInterID, "Gy_ErrType"); if (ds.Tables[0].Rows.Count > 0) { if (IsAudit == 0) //审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已审核!不能再次审核!"; objJsonResult.data = null; return objJsonResult; } } if (IsAudit == 1) //反审核判断 { if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未审核!不需要反审核!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsAudit == 0) //审核判断 { oCN.RunProc("update Gy_ErrType set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "审核成功"; objJsonResult.data = null; } if (IsAudit == 1) //反审核判断 { oCN.RunProc("update Gy_ErrType set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反审核成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion #region 异常类型禁用、反禁用 /// /// /// /// 单据ID /// 禁用(0),反禁用(1) /// 审核人 /// [Route("Gy_BadReason/StopGy_ErrType")] [HttpGet] public object StopGy_ErrType(int HInterID, int IsStop, string CurUserName) { try { //审核权限 if (!DBUtility.ClsPub.Security_Log_second("Gy_ErrType_Stop", 1, false, CurUserName)) { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败!无权限!"; objJsonResult.data = null; return objJsonResult; } var ds = oCN.RunProcReturn("select * from Gy_ErrType where HItemID=" + HInterID, "Gy_ErrType"); if (ds.Tables[0].Rows.Count > 0) { if (IsStop == 0) //禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() != "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据已禁用!不能再次禁用!"; objJsonResult.data = null; return objJsonResult; } } if (IsStop == 1) //反禁用判断 { if (ds.Tables[0].Rows[0]["HStopEmp"].ToString() == "") { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据未禁用!不需要反禁用!"; objJsonResult.data = null; return objJsonResult; } } } else { objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "单据不存在!"; objJsonResult.data = null; return objJsonResult; } oCN.BeginTran(); if (IsStop == 0) //禁用判断 { oCN.RunProc("update Gy_ErrType set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "禁用成功"; objJsonResult.data = null; } if (IsStop == 1) //反禁用判断 { oCN.RunProc("update Gy_ErrType set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID); objJsonResult.code = "1"; objJsonResult.count = 1; objJsonResult.Message = "反禁用成功"; objJsonResult.data = null; } oCN.Commit(); return objJsonResult; } catch (Exception e) { oCN.RollBack(); objJsonResult.code = "0"; objJsonResult.count = 0; objJsonResult.Message = "禁用失败或者反禁用失败!" + e.ToString(); objJsonResult.data = null; return objJsonResult; } } #endregion } }