|
|
using ibk.IPD.Common;
|
|
|
using ibk.IPD.Entity;
|
|
|
using ibk.IPD.Entity.IPD_MR.HotTreatment;
|
|
|
using ibk.IPD.Entity.IPD_MR.HotTreatment.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年05月12日
|
|
|
* 创建者: 李跃升
|
|
|
* Copy Right: 北京科技大学设计研究院有限公司
|
|
|
********************************************************/
|
|
|
namespace ibk.IPD.Controller.IPD_MR.HotTreatment
|
|
|
{
|
|
|
[RoutePrefix("ipd/ipdMr")]
|
|
|
public class PlateIntoFurnaceController : ApiController
|
|
|
{
|
|
|
private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 参数校验
|
|
|
/// </summary>
|
|
|
/// <param name="cncs"></param>
|
|
|
/// /// <param name="result"></param>
|
|
|
/// <returns>是否通过参数校验</returns>
|
|
|
public bool ParameterCalibration(HEAT_TREAT_PLA_ENTRY_SPECI cncs, RequestEntity result)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.FUR_NUM))
|
|
|
if (CommonUtils.GetLength(cncs.FUR_NUM) > 20)
|
|
|
{
|
|
|
result.msg = "炉座号长度不可超过20!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.CATEGORY))
|
|
|
if (CommonUtils.GetLength(cncs.CATEGORY) > 20)
|
|
|
{
|
|
|
result.msg = "类别长度不可超过20!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.FUNCTION))
|
|
|
if (CommonUtils.GetLength(cncs.FUNCTION) > 40)
|
|
|
{
|
|
|
result.msg = "功能长度不可超过40!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.THK_MIN))
|
|
|
if (!CommonUtils.IsNumber(cncs.THK_MIN) || cncs.THK_MIN.Length > 3)
|
|
|
{
|
|
|
result.msg = "厚度最小值(mm)是长度不可超过3的数字!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.THK_MAX))
|
|
|
if (!CommonUtils.IsNumber(cncs.THK_MAX) || cncs.THK_MAX.Length > 3)
|
|
|
{
|
|
|
result.msg = "厚度最大值(mm)是长度不可超过3的数字!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.WIDTH_MIN))
|
|
|
if (!CommonUtils.IsNumber(cncs.WIDTH_MIN) || cncs.WIDTH_MIN.Length > 4)
|
|
|
{
|
|
|
result.msg = "宽度最小值(mm)是长度不可超过4的数字!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.WIDTH_MAX))
|
|
|
if (!CommonUtils.IsNumber(cncs.WIDTH_MAX) || cncs.WIDTH_MAX.Length > 4)
|
|
|
{
|
|
|
result.msg = "宽度最大值(mm)是长度不可超过4的数字!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.LENGTH_MIN))
|
|
|
if (!CommonUtils.IsNumber(cncs.LENGTH_MIN) || cncs.LENGTH_MIN.Length > 7)
|
|
|
{
|
|
|
result.msg = "长度最小值(mm)是长度不可超过7的数字!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.LENGTH_MAX))
|
|
|
if (!CommonUtils.IsNumber(cncs.LENGTH_MAX) || cncs.LENGTH_MAX.Length >7)
|
|
|
{
|
|
|
result.msg = "长度最大值(mm)是长度不可超过7的数字!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.FUR_LEN))
|
|
|
if (!CommonUtils.IsNumber(cncs.FUR_LEN) || cncs.FUR_LEN.Length > 3)
|
|
|
{
|
|
|
result.msg = "炉长(m)是长度不可超过3的数字!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.SINGLE_WEI_MAX))
|
|
|
if (CommonUtils.GetLength(cncs.SINGLE_WEI_MAX) > 5)
|
|
|
{
|
|
|
result.msg = "最大单重(t)长度不可超过5!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.TEMP_REGION_MIN))
|
|
|
if (!CommonUtils.IsNumber(cncs.TEMP_REGION_MIN) || cncs.TEMP_REGION_MIN.Length > 4)
|
|
|
{
|
|
|
result.msg = "温度最小值是长度不可超过3的数字!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cncs.TEMP_REGION_MAX))
|
|
|
if (!CommonUtils.IsNumber(cncs.TEMP_REGION_MAX) || cncs.TEMP_REGION_MAX.Length > 4)
|
|
|
{
|
|
|
result.msg = "温度最大值是长度不可超过3的数字!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取主键的条件
|
|
|
/// </summary>
|
|
|
/// <param name="primaryKeyEntity"></param>
|
|
|
/// <returns>AND 开头的 主键条件字符串</returns>
|
|
|
public string GetPrimaryKeyString(HEAT_TREAT_PLA_ENTRY_SPECI primaryKeyEntity)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
//if (!string.IsNullOrWhiteSpace(primaryKeyEntity.APLY_ITEM))
|
|
|
//因为主键是自增主键, 所以将判断主键重复换成重复数据判断
|
|
|
|
|
|
strSql.AppendLine(" AND FUR_NUM = '" + primaryKeyEntity.FUR_NUM + "'");
|
|
|
strSql.AppendLine(" AND CATEGORY = '" + primaryKeyEntity.CATEGORY + "'");
|
|
|
strSql.AppendLine(" AND FUNCTION = '" + primaryKeyEntity.FUNCTION + "'");
|
|
|
strSql.AppendLine(" AND THK_MIN = '" + primaryKeyEntity.THK_MIN + "'");
|
|
|
strSql.AppendLine(" AND THK_MAX = '" + primaryKeyEntity.THK_MAX + "'");
|
|
|
strSql.AppendLine(" AND WIDTH_MIN = '" + primaryKeyEntity.WIDTH_MIN + "'");
|
|
|
strSql.AppendLine(" AND WIDTH_MAX = '" + primaryKeyEntity.WIDTH_MAX + "'");
|
|
|
strSql.AppendLine(" AND LENGTH_MIN = '" + primaryKeyEntity.LENGTH_MIN + "'");
|
|
|
strSql.AppendLine(" AND LENGTH_MAX = '" + primaryKeyEntity.LENGTH_MAX + "'");
|
|
|
strSql.AppendLine(" AND FUR_LEN = '" + primaryKeyEntity.FUR_LEN + "'");
|
|
|
strSql.AppendLine(" AND SINGLE_WEI_MAX = '" + primaryKeyEntity.SINGLE_WEI_MAX + "'");
|
|
|
strSql.AppendLine(" AND TEMP_REGION_MIN = '" + primaryKeyEntity.TEMP_REGION_MIN + "'");
|
|
|
strSql.AppendLine(" AND TEMP_REGION_MAX = '" + primaryKeyEntity.TEMP_REGION_MAX + "'");
|
|
|
return strSql.ToString();
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取主键查询的sql
|
|
|
/// </summary>
|
|
|
/// <param name="checkEntity"></param>
|
|
|
/// <returns>主键查询sql</returns>
|
|
|
public string GetCheckString(HEAT_TREAT_PLA_ENTRY_SPECI checkEntity)
|
|
|
{
|
|
|
string strSql = "SELECT * FROM HEAT_TREAT_PLA_ENTRY_SPECI WHERE 1=1 " + GetPrimaryKeyString(checkEntity);
|
|
|
return strSql;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 查询接口
|
|
|
/// </summary>
|
|
|
/// <param name="queryArgs"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("hotTreatment/getPlateIntoFurnace")]
|
|
|
public RequestEntity GetPlateIntoFurnace(HeatTreatPlaEntrySpeciQueryArgs queryArgs)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
//查询
|
|
|
//PK , FUR_NUM,CATEGORY,FUNCTION,THK_MIN,THK_MAX, WIDTH_MIN, WIDTH_MAX, LENGTH_MIN,LENGTH_MAX,FUR_LEN,SINGLE_WEI_MAX,TEMP_REGION_MIN,TEMP_REGION_MAX
|
|
|
strSql.AppendLine("SELECT PK , FUR_NUM,CATEGORY,FUNCTION,THK_MIN,THK_MAX,WIDTH_MIN,WIDTH_MAX,LENGTH_MIN,LENGTH_MAX,FUR_LEN,SINGLE_WEI_MAX,TEMP_REGION_MIN,TEMP_REGION_MAX ,to_date(INS_DATE || INS_TIME ,'yyyy-mm-dd hh24:mi:ss') as INS_DATE ,INS_TIME,INS_EMP , to_date(UPD_DATE || UPD_TIME ,'yyyy-mm-dd hh24:mi:ss') as UPD_DATE, UPD_TIME,UPD_EMP FROM HEAT_TREAT_PLA_ENTRY_SPECI WHERE 1 = 1 ");
|
|
|
if (queryArgs != null)
|
|
|
{
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.FUR_NUM)) strSql.AppendLine(" AND FUR_NUM LIKE '%" + queryArgs.FUR_NUM + "%'");
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.FUR_NUM)) strSql.AppendLine(" AND CATEGORY LIKE '%" + queryArgs.CATEGORY + "%'");
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.FUR_NUM)) strSql.AppendLine(" AND FUNCTION LIKE '%" + queryArgs.FUNCTION + "%'");
|
|
|
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.WIDTH_MIN) && CommonUtils.IsNumber(queryArgs.WIDTH_MIN)) strSql.AppendLine(" AND WIDTH_MIN >=" + queryArgs.WIDTH_MIN);
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.WIDTH_MAX) && CommonUtils.IsNumber(queryArgs.WIDTH_MAX)) strSql.AppendLine(" AND WIDTH_MAX <=" + queryArgs.WIDTH_MAX);
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.LENGTH_MIN) && CommonUtils.IsNumber(queryArgs.LENGTH_MIN)) strSql.AppendLine(" AND LENGTH_MIN >=" + queryArgs.LENGTH_MIN);
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.LENGTH_MAX) && CommonUtils.IsNumber(queryArgs.LENGTH_MAX)) strSql.AppendLine(" AND LENGTH_MAX <=" + queryArgs.LENGTH_MAX);
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.START_FUR_LEN) && CommonUtils.IsNumber(queryArgs.START_FUR_LEN)) strSql.AppendLine(" AND FUR_LEN >=" + queryArgs.START_FUR_LEN);
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.END_FUR_LEN) && CommonUtils.IsNumber(queryArgs.END_FUR_LEN)) strSql.AppendLine(" AND FUR_LEN <=" + queryArgs.END_FUR_LEN);
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.START_SINGLE_WEI_MAX) && CommonUtils.IsNumber(queryArgs.START_SINGLE_WEI_MAX)) strSql.AppendLine(" AND SINGLE_WEI_MAX >=" + queryArgs.START_SINGLE_WEI_MAX);
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.END_SINGLE_WEI_MAX) && CommonUtils.IsNumber(queryArgs.END_SINGLE_WEI_MAX)) strSql.AppendLine(" AND SINGLE_WEI_MAX <=" + queryArgs.END_SINGLE_WEI_MAX);
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.TEMP_REGION_MIN) && CommonUtils.IsNumber(queryArgs.TEMP_REGION_MIN)) strSql.AppendLine(" AND TEMP_REGION_MIN >=" + queryArgs.TEMP_REGION_MIN);
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.TEMP_REGION_MAX) && CommonUtils.IsNumber(queryArgs.TEMP_REGION_MAX)) strSql.AppendLine(" AND TEMP_REGION_MAX <=" + queryArgs.TEMP_REGION_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 ,'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 ,'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 INS_DATE DESC ");
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
result.data = db.Query<HEAT_TREAT_PLA_ENTRY_SPECI>(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("GetPlateIntoFurnace 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("hotTreatment/addPlateIntoFurnace")]
|
|
|
public RequestEntity AddPlateIntoFurnace(HEAT_TREAT_PLA_ENTRY_SPECI insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (!ParameterCalibration(insertModel, result))
|
|
|
return result;
|
|
|
#endregion
|
|
|
|
|
|
insertModel.INS_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
insertModel.INS_TIME = dtNow.ToString("HHmmss");
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
// 执行主键重复查询
|
|
|
DataTable dtCheck = db.Query(GetCheckString(insertModel));
|
|
|
|
|
|
if (dtCheck.Rows.Count > 0) // 若数据库中存在则返回错误码0并msg提示用户
|
|
|
{
|
|
|
result.msg = "数据已存在,请确认后重试!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
if (db.Insert<HEAT_TREAT_PLA_ENTRY_SPECI>(insertModel) > 0)
|
|
|
{
|
|
|
result.msg = "操作成功";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddPlateIntoFurnace 报错 : ", ex);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新接口
|
|
|
/// </summary>
|
|
|
/// <param name="requestData"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("hotTreatment/updPlateIntoFurnace")]
|
|
|
public RequestEntity UpdPlateIntoFurnace(IList<HEAT_TREAT_PLA_ENTRY_SPECI> 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 参数判断
|
|
|
if (!ParameterCalibration(requestData[1], result))
|
|
|
return result;
|
|
|
#endregion
|
|
|
try
|
|
|
{
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
// 执行主键重复查询
|
|
|
dtCheck = db.Query(GetCheckString(requestData[1]));
|
|
|
dtCheckSelf = db.Query(GetCheckString(requestData[0]));
|
|
|
|
|
|
if (dtCheck.Rows.Count > 0 && !CommonUtils.CompareDataTable(dtCheck, dtCheckSelf)) // 若数据库中存在则返回错误码0并msg提示用户
|
|
|
{
|
|
|
result.msg = "数据已存在,请确认后重试!";
|
|
|
result.code = "0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//更新哪些字段
|
|
|
//FUR_NUM , CATEGORY , FUNCTION , THK_MIN , THK_MAX , WIDTH_MIN , WIDTH_MAX , LENGTH_MIN ,LENGTH_MAX, FUR_LEN, SINGLE_WEI_MAX, TEMP_REGION_MIN, TEMP_REGION_MAX
|
|
|
if (db.Execute("UPDATE HEAT_TREAT_PLA_ENTRY_SPECI SET " + string.Format(" FUR_NUM = '{0}' , CATEGORY = '{1}' , FUNCTION = '{2}' , THK_MIN = '{3}' , THK_MAX = '{4}' , WIDTH_MIN = '{5}' , WIDTH_MAX = '{6}' , LENGTH_MIN = '{7}' , LENGTH_MAX = '{8}' , FUR_LEN = '{9}' , SINGLE_WEI_MAX = '{10}' , TEMP_REGION_MIN = '{11}' , TEMP_REGION_MAX = '{12}' , UPD_DATE = '{13}' , UPD_TIME='{14}',UPD_EMP = '{15}' WHERE 1 = 1 ",
|
|
|
requestData[1].FUR_NUM, requestData[1].CATEGORY, requestData[1].FUNCTION, requestData[1].THK_MIN, requestData[1].THK_MAX, requestData[1].WIDTH_MIN, requestData[1].WIDTH_MAX, requestData[1].LENGTH_MIN, requestData[1].LENGTH_MAX, requestData[1].FUR_LEN, requestData[1].SINGLE_WEI_MAX, requestData[1].TEMP_REGION_MIN, requestData[1].TEMP_REGION_MAX, requestData[1].UPD_DATE, requestData[1].UPD_TIME, requestData[1].UPD_EMP) +
|
|
|
//根据主键字段可以确定唯一数据即要修改的数据
|
|
|
string.Format(" AND PK = {0}", requestData[0].PK)) > 0)
|
|
|
{
|
|
|
result.msg = "操作成功";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "数据未发生改变,请确认后重试!";
|
|
|
result.code = "0";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("UpdPlateIntoFurnace 报错", ex);
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="delModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("hotTreatment/delPlateIntoFurnace")]
|
|
|
public RequestEntity DelPlateIntoFurnace(HEAT_TREAT_PLA_ENTRY_SPECI delModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("DELETE FROM HEAT_TREAT_PLA_ENTRY_SPECI WHERE 1=1 AND");
|
|
|
strSql.AppendLine(string.Format("PK = {0}", delModel.PK));
|
|
|
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("DelPlateIntoFurnace 报错", ex);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|