|
|
|
|
using ibk.IPD.Common;
|
|
|
|
|
using ibk.IPD.Entity;
|
|
|
|
|
using ibk.IPD.Entity.IPD_MR.HotRoll;
|
|
|
|
|
using ibk.IPD.Entity.IPD_MR.HotRoll.QueryArgs;
|
|
|
|
|
using log4net;
|
|
|
|
|
using SOA.Objects;
|
|
|
|
|
using SOA.Persistent;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Web.Http;
|
|
|
|
|
/********************************************************
|
|
|
|
|
* 简 介:南钢热轧制造规范管理
|
|
|
|
|
* 产品厚度轧制长度标准规范维护后端接口
|
|
|
|
|
* 版本号:V1.0
|
|
|
|
|
* 日 期:2022年04月11日
|
|
|
|
|
* 创建者: 李跃升
|
|
|
|
|
* Copy Right: 北京科技大学设计研究院有限公司
|
|
|
|
|
********************************************************/
|
|
|
|
|
namespace ibk.IPD.Controller.IPD_MR.HotRoll
|
|
|
|
|
{
|
|
|
|
|
[RoutePrefix("ipd/ipdMr")]
|
|
|
|
|
public class RollLenStdController : ApiController
|
|
|
|
|
{
|
|
|
|
|
private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询接口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="queryArgs"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("hotRoll/getRollLenStd")]
|
|
|
|
|
public RequestEntity GetRollLenStd(EpAsrollLenStdQueryArgs queryArgs)
|
|
|
|
|
{
|
|
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
|
|
|
|
//查询语句日期时间拼接起来格式化成yyyy-mm-dd hh24:mi:ss
|
|
|
|
|
//PLT , PRC_LINE , THK_MIN , THK_MAX , ASROLL_LEN_MIN , ASROLL_LEN_MAX , STLGRD , ASROLL_WID_MIN , ASROLL_WID_MAX
|
|
|
|
|
strSql.AppendLine("SELECT t.PLT,t.PRC_LINE,t.THK_MIN,t.THK_MAX ,t.ASROLL_LEN_MIN , t.ASROLL_LEN_MAX ,t.STLGRD ,t.ASROLL_WID_MIN , t.ASROLL_WID_MAX " +
|
|
|
|
|
//" ,to_date(t.UPD_DATE ||t. UPD_TIME,'yyyy-mm-dd hh24:mi:ss') as UPD_DATE,t.UPD_TIME,t.UPD_EMP, TO_DATE(NVL(t.INS_DATE, '') || NVL(t.INS_TIME, ''), 'yyyy-mm-dd hh24:mi:ss') as INS_DATE,t.INS_TIME,t.INS_EMP" +
|
|
|
|
|
" ,'' as UPD_DATE,'' UPD_TIME,'' UPD_EMP, '' as INS_DATE,'' INS_TIME,'' INS_EMP" +
|
|
|
|
|
",qnc.steel_grd_detail FROM EP_ASROLL_LEN_STD t left join qp_nisco_chmc qnc on qnc.stlgrd=t.stlgrd WHERE 1=1");
|
|
|
|
|
if (queryArgs != null)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.PLT)) strSql.AppendLine(" AND PLT LIKE '%" + queryArgs.PLT + "%'");
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.PRC_LINE)) strSql.AppendLine(" AND PRC_LINE LIKE '%" + queryArgs.PRC_LINE + "%'");
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.THK_MIN) && CommonUtils.IsNumber(queryArgs.THK_MIN)) strSql.AppendLine(" AND THK_MIN >=" + queryArgs.THK_MIN);
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.THK_MAX) && CommonUtils.IsNumber(queryArgs.THK_MAX)) strSql.AppendLine(" AND THK_MAX <=" + queryArgs.THK_MAX);
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.ASROLL_LEN_MIN) && CommonUtils.IsNumber(queryArgs.ASROLL_LEN_MIN)) strSql.AppendLine(" AND ASROLL_LEN_MIN >=" + queryArgs.ASROLL_LEN_MIN);
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.ASROLL_LEN_MAX) && CommonUtils.IsNumber(queryArgs.ASROLL_LEN_MAX)) strSql.AppendLine(" AND ASROLL_LEN_MAX <=" + queryArgs.ASROLL_LEN_MAX);
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.STLGRD)) strSql.AppendLine(" AND STLGRD LIKE '%" + queryArgs.STLGRD + "%'");
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.ASROLL_WID_MIN) && CommonUtils.IsNumber(queryArgs.ASROLL_WID_MIN)) strSql.AppendLine(" AND ASROLL_LEN_MIN >=" + queryArgs.ASROLL_WID_MIN);
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.ASROLL_WID_MAX) && CommonUtils.IsNumber(queryArgs.ASROLL_WID_MAX)) strSql.AppendLine(" AND ASROLL_WID_MAX <=" + queryArgs.ASROLL_WID_MAX);
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(CommonUtils.ObjectToStr(queryArgs.START_TIME)) && CommonUtils.ObjectToStr(queryArgs.START_TIME) != "0001/1/1 0:00:00") strSql.AppendLine(" AND to_date(INS_DATE || INS_TIME,'yyyy-mm-dd hh24:mi:ss') >= to_date('" + CommonUtils.ObjectToStr(queryArgs.START_TIME) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(CommonUtils.ObjectToStr(queryArgs.END_TIME)) && CommonUtils.ObjectToStr(queryArgs.END_TIME) != "0001/1/1 0:00:00") strSql.AppendLine(" AND to_date(INS_DATE || INS_TIME,'yyyy-mm-dd hh24:mi:ss') <= to_date('" + CommonUtils.ObjectToStr(queryArgs.END_TIME) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//开启数据库连接查询数据
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
|
|
{
|
|
|
|
|
strSql.AppendLine("Order By PLT,PRC_LINE");
|
|
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
|
|
result.data = db.Query<EP_ASROLL_LEN_STD>(strSql.ToString());
|
|
|
|
|
if (dtCheck.Rows.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "操作成功!";
|
|
|
|
|
result.code = "1";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.msg = "未找到查询所需数据!";
|
|
|
|
|
result.code = "1";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
logger.Error("GetRollLenStd 报错", ex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 添加接口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="insertModel"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("hotRoll/addRollLenStd")]
|
|
|
|
|
public RequestEntity AddRollLenStd(EP_ASROLL_LEN_STD insertModel)
|
|
|
|
|
{
|
|
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
#region 参数判断
|
|
|
|
|
//PLT , PRC_LINE , THK_MIN , THK_MAX , ASROLL_LEN_MIN , ASROLL_LEN_MAX , STLGRD , ASROLL_WID_MIN , ASROLL_WID_MAX
|
|
|
|
|
if (string.IsNullOrEmpty(insertModel.PLT) || insertModel.PLT.Length > 2)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "工厂不可为空且长度不可超过2!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(insertModel.PRC_LINE) || insertModel.PRC_LINE.Length > 2)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "机号不可为空且长度不可超过1!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(insertModel.THK_MIN) || !CommonUtils.IsNumber(insertModel.THK_MIN) || insertModel.THK_MIN.Length > 6)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "厚度下限值 不可为空且长度不可超过6或不是数字!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(insertModel.THK_MAX) || !CommonUtils.IsNumber(insertModel.THK_MAX) || insertModel.THK_MAX.Length > 6)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "厚度上限值 不可为空且长度不可超过6或不是数字!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(insertModel.ASROLL_LEN_MIN))
|
|
|
|
|
if (!CommonUtils.IsNumber(insertModel.ASROLL_LEN_MIN) || insertModel.ASROLL_LEN_MIN.Length > 8)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "轧件长度下限 长度不可超过8或不是数字!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(insertModel.ASROLL_LEN_MAX))
|
|
|
|
|
if (!CommonUtils.IsNumber(insertModel.ASROLL_LEN_MAX) || insertModel.ASROLL_LEN_MAX.Length > 8)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "轧件长度上限 长度不可超过8或不是数字!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(insertModel.STLGRD) || insertModel.STLGRD.Length > 11)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "钢种不可为空且长度不可超过11!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(insertModel.ASROLL_WID_MIN) || !CommonUtils.IsNumber(insertModel.ASROLL_WID_MIN) || insertModel.ASROLL_WID_MIN.Length > 6)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "坯料宽度下限 不可为空且长度不可超过6或不是数字!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(insertModel.ASROLL_WID_MAX) || !CommonUtils.IsNumber(insertModel.ASROLL_WID_MAX) || insertModel.ASROLL_WID_MAX.Length > 6)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "坯料宽度上限 不可为空且长度不可超过6或不是数字!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
// 拼接主键重复check查询语句
|
|
|
|
|
//PLT , PRC_LINE , THK_MIN , THK_MAX ,STLGRD , ASROLL_WID_MIN , ASROLL_WID_MAX
|
|
|
|
|
strSql.AppendLine("SELECT * FROM EP_ASROLL_LEN_STD WHERE 1=1 ");
|
|
|
|
|
strSql.AppendLine(string.Format("AND PLT = '{0}' AND PRC_LINE = '{1}' AND THK_MIN = '{2}' AND THK_MAX = '{3}' AND STLGRD = '{4}' AND ASROLL_WID_MIN = '{5}' AND ASROLL_WID_MAX = '{6}' ", insertModel.PLT, insertModel.PRC_LINE, insertModel.THK_MIN, insertModel.THK_MAX, insertModel.STLGRD, insertModel.ASROLL_WID_MIN, insertModel.ASROLL_WID_MAX));
|
|
|
|
|
|
|
|
|
|
insertModel.INS_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
|
|
insertModel.INS_TIME = dtNow.ToString("HHmmss");
|
|
|
|
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
|
|
{
|
|
|
|
|
// 执行主键重复查询
|
|
|
|
|
DataTable dtCheck = db.Query(strSql.ToString());
|
|
|
|
|
|
|
|
|
|
if (dtCheck.Rows.Count > 0) // 若数据库中存在则返回错误码0并msg提示用户
|
|
|
|
|
{
|
|
|
|
|
result.msg = "数据已存在,请确认后重试!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (db.Insert<EP_ASROLL_LEN_STD>(insertModel) > 0)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "操作成功";
|
|
|
|
|
result.code = "1";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
logger.Error("AddRollLenStd 报错 : ", ex);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新接口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="requestData"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("hotRoll/updRollLenStd")]
|
|
|
|
|
public RequestEntity UpdRollLenStd(IList<EP_ASROLL_LEN_STD> requestData)
|
|
|
|
|
{
|
|
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
DataTable dtCheckSelf = new DataTable();
|
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
StringBuilder strSqlSelf = new StringBuilder();
|
|
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
requestData[1].UPD_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
|
|
requestData[1].UPD_TIME = dtNow.ToString("HHmmss");
|
|
|
|
|
|
|
|
|
|
#region 参数判断
|
|
|
|
|
//PLT , PRC_LINE , THK_MIN , THK_MAX , ASROLL_LEN_MIN , ASROLL_LEN_MAX , STLGRD , ASROLL_WID_MIN , ASROLL_WID_MAX
|
|
|
|
|
if (string.IsNullOrEmpty(requestData[1].PLT) || requestData[1].PLT.Length > 2)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "工厂不可为空且长度不可超过2!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(requestData[1].PRC_LINE) || requestData[1].PRC_LINE.Length > 2)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "机号不可为空且长度不可超过1!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(requestData[1].THK_MIN) || !CommonUtils.IsNumber(requestData[1].THK_MIN) || requestData[1].THK_MIN.Length > 6)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "厚度下限值 不可为空且长度不可超过6或不是数字!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(requestData[1].THK_MAX) || !CommonUtils.IsNumber(requestData[1].THK_MAX) || requestData[1].THK_MAX.Length > 6)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "厚度上限值 不可为空且长度不可超过6或不是数字!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(requestData[1].ASROLL_LEN_MIN))
|
|
|
|
|
if (!CommonUtils.IsNumber(requestData[1].ASROLL_LEN_MIN) || requestData[1].ASROLL_LEN_MIN.Length > 8)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "轧件长度下限 长度不可超过8或不是数字!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(requestData[1].ASROLL_LEN_MAX))
|
|
|
|
|
if (!CommonUtils.IsNumber(requestData[1].ASROLL_LEN_MAX) || requestData[1].ASROLL_LEN_MAX.Length > 8)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "轧件长度上限 长度不可超过8或不是数字!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(requestData[1].STLGRD) || requestData[1].STLGRD.Length > 11)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "钢种不可为空且长度不可超过11!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(requestData[1].ASROLL_WID_MIN) || !CommonUtils.IsNumber(requestData[1].ASROLL_WID_MIN) || requestData[1].ASROLL_WID_MIN.Length > 6)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "坯料宽度下限 不可为空且长度不可超过6或不是数字!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(requestData[1].ASROLL_WID_MAX) || !CommonUtils.IsNumber(requestData[1].ASROLL_WID_MAX) || requestData[1].ASROLL_WID_MAX.Length > 6)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "坯料宽度上限 不可为空且长度不可超过6或不是数字!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
|
|
{
|
|
|
|
|
// 查询是否有主键相同数据
|
|
|
|
|
//PLT , PRC_LINE , THK_MIN , THK_MAX ,STLGRD , ASROLL_WID_MIN , ASROLL_WID_MAX
|
|
|
|
|
strSql.AppendLine("SELECT * FROM EP_ASROLL_LEN_STD WHERE 1=1 ");
|
|
|
|
|
strSql.AppendLine(string.Format("AND PLT = '{0}' AND PRC_LINE = '{1}' AND THK_MIN = '{2}' AND THK_MAX = '{3}' AND STLGRD = '{4}' AND ASROLL_WID_MIN = '{5}' AND ASROLL_WID_MAX = '{6}' ",
|
|
|
|
|
requestData[1].PLT, requestData[1].PRC_LINE, requestData[1].THK_MIN, requestData[1].THK_MAX, requestData[1].STLGRD, requestData[1].ASROLL_WID_MIN, requestData[1].ASROLL_WID_MAX));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//PLT , PRC_LINE , THK_MIN , THK_MAX ,STLGRD , ASROLL_WID_MIN , ASROLL_WID_MAX
|
|
|
|
|
strSqlSelf.AppendLine("SELECT * FROM EP_ASROLL_LEN_STD WHERE 1=1 ");
|
|
|
|
|
strSqlSelf.AppendLine(string.Format("AND PLT = '{0}' AND PRC_LINE = '{1}' AND THK_MIN = '{2}' AND THK_MAX = '{3}' AND STLGRD = '{4}' AND ASROLL_WID_MIN = '{5}' AND ASROLL_WID_MAX = '{6}' ",
|
|
|
|
|
requestData[0].PLT, requestData[0].PRC_LINE, requestData[0].THK_MIN, requestData[0].THK_MAX, requestData[0].STLGRD, requestData[0].ASROLL_WID_MIN, requestData[0].ASROLL_WID_MAX));
|
|
|
|
|
|
|
|
|
|
// 执行主键重复查询
|
|
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
|
|
dtCheckSelf = db.Query(strSqlSelf.ToString());
|
|
|
|
|
if (dtCheck.Rows.Count > 0 && !CommonUtils.CompareDataTable(dtCheck, dtCheckSelf))
|
|
|
|
|
{
|
|
|
|
|
result.msg = "数据已存在,请确认后重试!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//更新哪些字段
|
|
|
|
|
//PLT , PRC_LINE , THK_MIN , THK_MAX , ASROLL_LEN_MIN , ASROLL_LEN_MAX , STLGRD , ASROLL_WID_MIN , ASROLL_WID_MAX
|
|
|
|
|
if (db.Execute("UPDATE EP_ASROLL_LEN_STD SET " + string.Format(" PLT = '{0}' , PRC_LINE = '{1}' , THK_MIN = '{2}' , THK_MAX = '{3}' , ASROLL_LEN_MIN = '{4}' ,ASROLL_LEN_MAX = '{5}' , STLGRD = '{6}' , ASROLL_WID_MIN = '{7}',ASROLL_WID_MAX = '{8}', UPD_DATE = '{9}',UPD_TIME='{10}',UPD_EMP = '{11}' ",
|
|
|
|
|
requestData[1].PLT, requestData[1].PRC_LINE, requestData[1].THK_MIN, requestData[1].THK_MAX, requestData[1].ASROLL_LEN_MIN, requestData[1].ASROLL_LEN_MAX, requestData[1].STLGRD, requestData[1].ASROLL_WID_MIN, requestData[1].ASROLL_WID_MAX, requestData[1].UPD_DATE, requestData[1].UPD_TIME, requestData[1].UPD_EMP) +
|
|
|
|
|
//根据主键字段可以确定唯一数据即要修改的数据
|
|
|
|
|
//PLT , PRC_LINE , THK_MIN , THK_MAX ,STLGRD , ASROLL_WID_MIN , ASROLL_WID_MAX
|
|
|
|
|
string.Format("WHERE PLT = '{0}' AND PRC_LINE = '{1}' AND THK_MIN = '{2}' AND THK_MAX = '{3}' AND STLGRD = '{4}' AND ASROLL_WID_MIN = '{5}' AND ASROLL_WID_MAX = '{6}' ",
|
|
|
|
|
requestData[0].PLT, requestData[0].PRC_LINE, requestData[0].THK_MIN, requestData[0].THK_MAX, requestData[0].STLGRD, requestData[0].ASROLL_WID_MIN, requestData[0].ASROLL_WID_MAX)) > 0)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "操作成功";
|
|
|
|
|
result.code = "1";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.msg = "数据未发生改变,请确认后重试!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
logger.Error("UpdRollLenStd 报错", ex);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除接口
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="delModel"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("hotRoll/delRollLenStd")]
|
|
|
|
|
public RequestEntity DelRollLenStd(EP_ASROLL_LEN_STD delModel)
|
|
|
|
|
{
|
|
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// 拼接主键重复check查询语句
|
|
|
|
|
strSql.AppendLine("DELETE FROM EP_ASROLL_LEN_STD WHERE 1=1 ");
|
|
|
|
|
strSql.AppendLine(string.Format("AND PLT = '{0}' AND PRC_LINE = '{1}' AND THK_MIN = '{2}' AND THK_MAX = '{3}' AND STLGRD = '{4}' AND ASROLL_WID_MIN = '{5}' AND ASROLL_WID_MAX = '{6}' ", delModel.PLT, delModel.PRC_LINE, delModel.THK_MIN, delModel.THK_MAX, delModel.STLGRD, delModel.ASROLL_WID_MIN, delModel.ASROLL_WID_MAX));
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
|
|
result.msg = "操作成功";
|
|
|
|
|
result.code = "1";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
|
|
result.code = "0";
|
|
|
|
|
logger.Error("AddRollLenStd 报错", ex);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|