using Newtonsoft.Json;
|
using Newtonsoft.Json.Linq;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Data.SqlClient;
|
using System.Linq;
|
using System.Net;
|
using System.Net.Http;
|
using System.Web.Http;
|
using WebAPI.Models;
|
|
|
namespace WebAPI.Controllers.基础资料.基础资料
|
{
|
public class Gy_BilloriginController : ApiController
|
{
|
private json objJsonResult = new json();
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
DataSet ds;
|
// GET: Xt_BillSourceSet
|
#region 单据 列表
|
[Route("Gy_BilloriginController/BilloriginList")]
|
[HttpGet]
|
public object BilloriginList(string sWhere, string user, string Organization)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//编辑权限
|
if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePrice_Query", 1, false, user))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "无查看权限!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
string sql1 = string.Format(@"select * from h_v_Xt_BillSourceSetList where 1 = 1 ");
|
ds = oCN.RunProcReturn(sql1, "h_v_Xt_BillSourceSetList");
|
|
//添加列名
|
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.list = columnNameList;
|
objJsonResult.data = ds.Tables[0];
|
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_BilloriginController/cx")]
|
[HttpGet]
|
public object cx(string HItemID, string user)
|
{
|
try
|
{
|
List<object> columnNameList = new List<object>();
|
//编辑权限
|
if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePrice_Edit", 1, false, user))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "无查看权限!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
string sql1 = string.Format(@"select * from Xt_BillSourceSet where HItemID = " + HItemID);
|
|
ds = oCN.RunProcReturn(sql1, "Xt_BillSourceSet");
|
|
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "Sucess!";
|
objJsonResult.data = ds.Tables[0];
|
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_BilloriginController/AddBill")]
|
[HttpPost]
|
public object AddBill([FromBody] JObject msg)
|
{
|
try
|
{
|
var _value = msg["msg"].ToString();
|
string msg3 = _value.ToString();
|
//string[] sArray = msg3.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
//string msg1 = sArray[0].ToString();
|
//string msg2 = sArray[1].ToString();
|
string msg2 = msg3.ToString();
|
|
//反序列化
|
msg2 = "[" + msg2.ToString() + "]";
|
|
List<Models.ClsGy_Billorigin> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsGy_Billorigin>>(msg2);
|
|
int HItemID = list[0].HItemID;
|
int HNumber = list[0].HNumber;
|
string HName = list[0].HName;
|
string HHelpCode = list[0].HHelpCode;
|
string HShortNumber = list[0].HShortNumber;
|
string HParentID = list[0].HParentID;
|
string HLevel = list[0].HLevel;
|
string HEndFlag = list[0].HEndFlag;
|
string HRemark = list[0].HRemark;
|
string HSourceBillTypeName = list[0].HSourceBillTypeName;
|
string HSourceBillType = list[0].HSourceBillType;
|
string HRedBlueFlag = list[0].HRedBlueFlag;
|
string HStopFlag = list[0].HStopFlag;
|
///
|
string HViewName = list[0].HViewName;
|
string HReportTitle = list[0].HReportTitle;
|
string HCondtion = list[0].HCondtion;
|
string HOrderSql = list[0].HOrderSql;
|
string HKeyCol = list[0].HKeyCol;
|
//判断权限
|
//if (!ClsPub.Security_Log("Gy_DotCheck_Edit", 1, false, msg3))
|
//{
|
// objJsonResult.code = "0";
|
// objJsonResult.count = 0;
|
// objJsonResult.Message = "没有找到该功能模块!";
|
// objJsonResult.data = null;
|
// return objJsonResult;
|
//}
|
//若MAINDI重复则重新获取
|
oCN.BeginTran();
|
|
|
|
//主表
|
oCN.RunProc("INSERT INTO Xt_BillSourceSet " +
|
"(HNumber, HName, HHelpCode, HShortNumber, HParentID, HLevel, HEndFlag, HRemark, " +
|
"HSourceBillType, HSourceBillTypeName, HRedBlueFlag, HStopFlag, " +
|
"HViewName, HReportTitle, HCondtion, HOrderSql, HKeyCol) " +
|
"VALUES('" + HNumber + "', '" + HName + "', '" +
|
HHelpCode + "', '" + HShortNumber + "', " +
|
(string.IsNullOrEmpty(HParentID) ? "0" : HParentID) + ", " +
|
(string.IsNullOrEmpty(HLevel) ? "0" : HLevel) + ", " +
|
(string.IsNullOrEmpty(HEndFlag) ? "0" : HEndFlag) + ", '" +
|
HRemark + "', '" +
|
HSourceBillType + "', '" + HSourceBillTypeName + "', " +
|
(string.IsNullOrEmpty(HRedBlueFlag) ? "0" : HRedBlueFlag) + ", " +
|
(string.IsNullOrEmpty(HStopFlag) ? "0" : HStopFlag) + ", '" +
|
HViewName + "', '" + HReportTitle + "', '" +
|
HCondtion + "', '" + HOrderSql + "', '" +
|
HKeyCol + "')",
|
ref DBUtility.ClsPub.sExeReturnInfo);
|
|
|
oCN.Commit();
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "新增成功!";
|
//objJsonResult.data = null;
|
return objJsonResult;
|
}
|
catch (Exception e)
|
{
|
oCN.RollBack();
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "Exception!" + e.Message;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region 修改保存
|
[Route("Gy_BilloriginController/EditBill")]
|
[HttpPost]
|
public object EditBill([FromBody] JObject msg)
|
{
|
|
try
|
{
|
var _value = msg["msg"].ToString();
|
string msg3 = _value.ToString();
|
string msg2 = msg3.ToString();
|
|
//反序列化
|
msg2 = "[" + msg2.ToString() + "]";
|
List<Models.ClsGy_Billorigin> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ClsGy_Billorigin>>(msg2);
|
int HItemID = list[0].HItemID;
|
int HNumber = list[0].HNumber;
|
string HName = list[0].HName;
|
string HHelpCode = list[0].HHelpCode;
|
string HShortNumber = list[0].HShortNumber;
|
string HParentID = list[0].HParentID;
|
string HLevel = list[0].HLevel;
|
string HEndFlag = list[0].HEndFlag;
|
string HRemark = list[0].HRemark;
|
string HSourceBillTypeName = list[0].HSourceBillTypeName;
|
string HSourceBillType = list[0].HSourceBillType;
|
string HRedBlueFlag = list[0].HRedBlueFlag;
|
string HStopFlag = list[0].HStopFlag;
|
///
|
string HViewName = list[0].HViewName;
|
string HReportTitle = list[0].HReportTitle;
|
string HCondtion = list[0].HCondtion;
|
string HOrderSql = list[0].HOrderSql;
|
string HKeyCol = list[0].HKeyCol;
|
|
//判断权限
|
//if (!ClsPub.Security_Log("Gy_DotCheck_Edit", 1, false, msg3))
|
//{
|
// objJsonResult.code = "0";
|
// objJsonResult.count = 0;
|
// objJsonResult.Message = "没有找到该功能模块!";
|
// objJsonResult.data = null;
|
// return objJsonResult;
|
//}
|
|
//若MAINDI重复则重新获取
|
oCN.BeginTran();
|
|
|
|
|
//主表
|
oCN.RunProc("UPDATE Xt_BillSourceSet SET " +
|
"HNumber='" + HNumber + "', " +
|
"HName='" + HName + "', " +
|
"HHelpCode='" + HHelpCode + "', " +
|
"HKeyCol='" + HKeyCol + "', " +
|
"HOrderSql='" + HOrderSql + "', " +
|
"HViewName='" + HViewName + "', " +
|
"HEndFlag='" + HEndFlag + "', " +
|
"HRemark='" + HRemark + "', " +
|
"HSourceBillTypeName='" + HSourceBillTypeName + "', " +
|
"HSourceBillType='" + HSourceBillType + "', " +
|
"HRedBlueFlag='" + HRedBlueFlag + "', " +
|
"HStopFlag='" + HStopFlag + "'" +
|
" WHERE HItemID=" + HItemID,
|
ref DBUtility.ClsPub.sExeReturnInfo);
|
|
|
oCN.Commit();
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "修改成功!";
|
//objJsonResult.data = null;
|
return objJsonResult;
|
}
|
catch (Exception e)
|
{
|
oCN.RollBack();
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "Exception!" + e.Message;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
}
|
#endregion
|
|
#region 删除
|
[Route("Gy_BilloriginController/Delete")]
|
[HttpGet]
|
public object Delete(string HItemID, string user)
|
{
|
DataSet ds;
|
try
|
{
|
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
|
//删除权限
|
if (!DBUtility.ClsPub.Security_Log("Gy_MatePrice_Delete", 1, false, user))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "无删除权限";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
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 Xt_BillSourceSet where HItemID=" + HItemID, "Xt_BillSourceSet");
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "没有数据,无法删除!";
|
objJsonResult.data = null;
|
return objJsonResult; ;
|
}
|
//var HStopflag = Convert.ToBoolean(ds.Tables[0].Rows[0]["HStopflag"]);
|
if (ds.Tables[0].Rows[0]["HCheckEmp"].ToString() != "")
|
{
|
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "数据已审核无法删除!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
oCN.RunProc("delete from Xt_BillSourceSet 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;
|
}
|
}
|
#endregion
|
|
#region 审核、反审核
|
|
[Route("Gy_MatePriceController/MatePriceCheck")]
|
[HttpGet]
|
public object MatePriceCheck(int HInterID, int IsAudit, string CurUserName)
|
{
|
Int64 lngBillKey = 0;
|
lngBillKey = DBUtility.ClsPub.isLong(HInterID);
|
DAL.ClsGy_MatePrice_Ctl oBill = new DAL.ClsGy_MatePrice_Ctl();
|
List<Model.ClsGy_MatePrice_Model> lsmain = new List<Model.ClsGy_MatePrice_Model>();
|
try
|
{
|
//审核权限
|
if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePrice_Check", 1, false, CurUserName))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "审核失败!无权限!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
if (lngBillKey == 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
////针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作
|
//if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据
|
//{
|
// if (oBill.oModel.HCheckEmp.Trim() != "")
|
// {
|
// objJsonResult.code = "0";
|
// objJsonResult.count = 0;
|
// objJsonResult.Message = "单据已关闭!不能再次审核!";
|
// objJsonResult.data = null;
|
// return objJsonResult;
|
// }
|
// //if (oBill.omodel.HDeleteMan.Trim() != "")
|
// //{
|
// // objJsonResult.code = "0";
|
// // objJsonResult.count = 0;
|
// // objJsonResult.Message = "单据已作废!不能再次审核!";
|
// // objJsonResult.data = null;
|
// // return objJsonResult;
|
// //}
|
//}
|
//else
|
//{
|
// objJsonResult.code = "0";
|
// objJsonResult.count = 0;
|
// objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
|
// objJsonResult.data = null;
|
// return objJsonResult;
|
//}
|
|
var ds = oCN.RunProcReturn("select * from Gy_MaterPrice where HItemID=" + HInterID, "Gy_MaterPrice");
|
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) //审核判断
|
{
|
|
//审核前控制=========================================
|
string sql1 = "exec h_p_Gy_MaterPrice_BeforeCheckCtrl " + HInterID + ",'" + CurUserName + "'";
|
ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPrice_BeforeCheckCtrl");
|
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
|
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
//==================================================================================
|
|
|
oCN.RunProc("update Gy_MaterPrice set HCheckEmp='" + CurUserName + "',HCheckTime=getdate() where HItemID=" + HInterID);
|
|
|
//审核后控制=========================================
|
string sql2 = "exec h_p_Gy_MaterPrice_AfterCheckCtrl " + HInterID + ",'" + CurUserName + "'";
|
ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterCheckCtrl");
|
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "审核失败!原因:审核后判断失败,请与网络管理人员联系";
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
|
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
//==================================================================================
|
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "审核成功";
|
objJsonResult.data = null;
|
}
|
if (IsAudit == 1) //反审核判断
|
{
|
|
//反审核前控制=========================================
|
string sql1 = "exec h_p_Gy_MaterPrice_BeforeUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
|
ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPrice_BeforeUnCheckCtrl");
|
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
|
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
//==================================================================================
|
|
|
|
oCN.RunProc("update Gy_MaterPrice set HCheckEmp='',HCheckTime=null where HItemID=" + HInterID);
|
|
|
//反审核后控制=========================================
|
string sql2 = "exec h_p_Gy_MaterPrice_AfterUnCheckCtrl " + HInterID + ",'" + CurUserName + "'";
|
ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterUnCheckCtrl");
|
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反审核失败!原因:反审核后判断失败,请与网络管理人员联系";
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
|
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
//==================================================================================
|
|
|
|
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_MatePriceController/StopGy_MaterPrice")]
|
[HttpGet]
|
public object StopGy_MaterPrice(int HInterID, int IsStop, string CurUserName)
|
{
|
try
|
{
|
//禁用权限
|
if (!DBUtility.ClsPub.Security_Log_second("Gy_MatePrice_Stop", 1, false, CurUserName))
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 0;
|
objJsonResult.Message = "禁用失败!无权限!";
|
objJsonResult.data = null;
|
return objJsonResult;
|
}
|
|
var ds = oCN.RunProcReturn("select * from Gy_MaterPrice where HItemID=" + HInterID, "Gy_MaterPrice");
|
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) //禁用判断
|
{
|
|
//禁用前控制=========================================
|
string sql1 = "exec h_p_Gy_MaterPrice_BeforeStopCtrl " + HInterID + ",'" + CurUserName + "'";
|
ds = oCN.RunProcReturn(sql1, "h_p_Gy_MaterPrice_BeforeStopCtrl");
|
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "禁用失败!原因:禁用前判断失败,请与网络管理人员联系";
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
|
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
//==================================================================================
|
|
|
oCN.RunProc("update Gy_MaterPrice set HStopEmp='" + CurUserName + "',HStopTime=getdate(),HStopflag=1 where HItemID=" + HInterID);
|
|
|
//禁用后控制=========================================
|
string sql2 = "exec h_p_Gy_MaterPrice_AfterStopCtrl " + HInterID + ",'" + CurUserName + "'";
|
ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterStopCtrl");
|
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "禁用失败!原因:禁用后判断失败,请与网络管理人员联系";
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
|
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
//==================================================================================
|
|
|
objJsonResult.code = "1";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "禁用成功";
|
objJsonResult.data = null;
|
}
|
if (IsStop == 1) //反禁用判断
|
{
|
//反禁用前控制=========================================
|
string sql1 = "exec h_p_Gy_Gy_MaterPrice_BeforeUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
|
ds = oCN.RunProcReturn(sql1, "h_p_Gy_Gy_MaterPrice_BeforeUnStopCtrl");
|
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反禁用失败!原因:反禁用前判断失败,请与网络管理人员联系";
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
|
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
//==================================================================================
|
|
|
oCN.RunProc("update Gy_MaterPrice set HStopEmp='',HStopTime=null,HStopflag=0 where HItemID=" + HInterID);
|
|
|
//反禁用后控制=========================================
|
string sql2 = "exec h_p_Gy_MaterPrice_AfterUnStopCtrl " + HInterID + ",'" + CurUserName + "'";
|
ds = oCN.RunProcReturn(sql2, "h_p_Gy_MaterPrice_AfterUnStopCtrl");
|
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反禁用失败!原因:反禁用后判断失败,请与网络管理人员联系";
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
|
if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
|
{
|
objJsonResult.code = "0";
|
objJsonResult.count = 1;
|
objJsonResult.Message = "反禁用失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
|
objJsonResult.data = null;
|
oCN.RollBack();
|
return objJsonResult;
|
}
|
//==================================================================================
|
|
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
|
|
|
}
|
}
|