|
|
using System;
|
|
|
using System.Reflection;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Web.Http;
|
|
|
using System.Data;
|
|
|
using log4net;
|
|
|
using ibk.IPD.Entity;
|
|
|
using SOA.Expression.Data;
|
|
|
using SOA.Persistent;
|
|
|
using SOA.Objects;
|
|
|
using ibk.IPD.Common;
|
|
|
using ibk.IPD.Entity.IPD_MR.HotRoll;
|
|
|
using ibk.IPD.Entity.IpdMr.Basic;
|
|
|
|
|
|
/********************************************************
|
|
|
* 简 介:南钢余坯余材充当项目规范管理模块后端接口
|
|
|
* 南钢热轧制造管理规范
|
|
|
* 母板长度余量维护后端接口
|
|
|
* 版本号:V1.0
|
|
|
* 日 期:2022年03月07日
|
|
|
* 创建者: 陈波
|
|
|
* Copy Right: 北京科技大学设计研究院有限公司
|
|
|
********************************************************/
|
|
|
namespace ibk.IPD.Service.Controller
|
|
|
{
|
|
|
|
|
|
[RoutePrefix("ipd/ipdMr")]
|
|
|
public class StdMgtController : ApiController
|
|
|
{
|
|
|
private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
|
|
/// <summary>
|
|
|
/// 查询接口
|
|
|
/// </summary>
|
|
|
/// <param name="queryArgs"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("hotRoll/getstdmgtinfos")]
|
|
|
public RequestEntity GetStdMgtInfos(ProductLineQueryArgs queryArgs)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
DataTable cdDataTable = new DataTable();
|
|
|
|
|
|
//开启数据库链接
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.APLY_ITEM))
|
|
|
{
|
|
|
//查询适用项目中文代表的适用项目
|
|
|
//第一版查询字典中适用项目对应的英文名
|
|
|
//cdDataTable = db.Query("SELECT CD FROM ZP_CD WHERE CD_NAME = '" + queryArgs.APLY_ITEM + "'");
|
|
|
//第二版查询使用项目表中对应的英文名
|
|
|
cdDataTable = db.Query("SELECT APLY_ITEM FROM ZP_APLY_ITEM WHERE APLY_ITEM_NAME = '" + queryArgs.APLY_ITEM + "'");
|
|
|
//----------------------------------------------
|
|
|
//获取datatable的第几列数据, 目前是第0列
|
|
|
var Array = from DataRow dr in cdDataTable.Rows select dr[0];
|
|
|
//获取第0列第0个数据, 赋值给APLY_ITEM
|
|
|
queryArgs.APLY_ITEM = (string)Array.First();
|
|
|
//----------------------------------------------
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//查询语句日期时间拼接起来格式化成yyyy-mm-dd hh24:mi:ss
|
|
|
//第一版母板长度余量本身查询
|
|
|
//strSql.AppendLine("SELECT PLT,PRC_LINE,APLY_ITEM,PROD_THK_MIN,PROD_THK_MAX,MINI,MAXI,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,IF_HOT,STLGRD FROM EP_PLATELEN_M WHERE 1=1");
|
|
|
//第二版母板长度余量和字典连接
|
|
|
//strSql.AppendLine("SELECT A.PLT,A.PRC_LINE,A.APLY_ITEM,A.PROD_THK_MIN,A.PROD_THK_MAX,A.MINI,A.MAXI,to_date(A.INS_DATE || A.INS_TIME,'yyyy-mm-dd hh24:mi:ss') as INS_DATE,A.INS_TIME,A.INS_EMP,to_date(A.UPD_DATE || A.UPD_TIME,'yyyy-mm-dd hh24:mi:ss') as UPD_DATE,A.UPD_TIME,A.UPD_EMP,A.IF_HOT,A.STLGRD , B.CD_NAME FROM EP_PLATELEN_M A LEFT JOIN ZP_CD B ON A.APLY_ITEM = B.CD WHERE 1=1");
|
|
|
//第三版母板长度余量和适用项目规范连接
|
|
|
strSql.AppendLine("SELECT A.PLT,A.PRC_LINE,A.APLY_ITEM,A.PROD_THK_MIN,A.PROD_THK_MAX,A.MINI,A.MAXI,to_date(A.INS_DATE || A.INS_TIME,'yyyy-mm-dd hh24:mi:ss') as INS_DATE,A.INS_TIME,A.INS_EMP,to_date(A.UPD_DATE || A.UPD_TIME,'yyyy-mm-dd hh24:mi:ss') as UPD_DATE,A.UPD_TIME,A.UPD_EMP,A.IF_HOT,A.STLGRD , B.APLY_ITEM_NAME FROM EP_PLATELEN_M A LEFT JOIN ZP_APLY_ITEM B ON A.APLY_ITEM = B.APLY_ITEM WHERE 1=1");
|
|
|
if (queryArgs != null)
|
|
|
{
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.PLT)) strSql.AppendLine(" AND A.PLT LIKE '%" + queryArgs.PLT + "%'");
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.PRC_LINE)) strSql.AppendLine(" AND A.PRC_LINE LIKE '%" + queryArgs.PRC_LINE + "%'");
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.APLY_ITEM)) strSql.AppendLine(" AND A.APLY_ITEM LIKE '%" + queryArgs.APLY_ITEM + "%'");
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.IF_HOT)) strSql.AppendLine(" AND A.IF_HOT LIKE '%" + queryArgs.IF_HOT + "%'");
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.STLGRD)) strSql.AppendLine(" AND A.STLGRD LIKE '%" + queryArgs.STLGRD + "%'");
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.CD_NAME)) strSql.AppendLine(" AND B.CD_NAME LIKE '%" + queryArgs.CD_NAME + "%'");
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(CommonUtils.ObjectToStr(queryArgs.START_TIME)) && CommonUtils.ObjectToStr(queryArgs.START_TIME) != "0001/1/1 0:00:00") strSql.AppendLine(" AND to_date(A.INS_DATE || A.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(A.INS_DATE || A.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<ProductionLineRequest>(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("GetStdMgtInfos 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("hotRoll/addstdmgtinfos")]
|
|
|
public RequestEntity AddStdMgtInfos(ProductionLineRequest insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
DataTable cdDataTable = new DataTable();
|
|
|
ProductionLine productionLine = new ProductionLine();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
//适用项目
|
|
|
//string aplyItem = insertModel.APLY_ITEM;
|
|
|
try
|
|
|
{
|
|
|
|
|
|
#region 不可为空字段判断
|
|
|
//PLT, PRC_LINE, APLY_ITEM, PROD_THK_MIN, PROD_THK_MAX, MINI, MAXI, IF_HOT
|
|
|
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 > 1)
|
|
|
{
|
|
|
result.msg = "机号不可为空且长度不可超过1!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(insertModel.APLY_ITEM))
|
|
|
{
|
|
|
result.msg = "适用项目不可为空!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrEmpty(insertModel.PROD_THK_MIN) || !CommonUtils.IsNumber(insertModel.PROD_THK_MIN) || insertModel.PROD_THK_MIN.Length > 6)
|
|
|
{
|
|
|
result.msg = "产品厚度下限是不可为空的数字且长度不可超过6!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(insertModel.PROD_THK_MAX) || !CommonUtils.IsNumber(insertModel.PROD_THK_MAX) || insertModel.PROD_THK_MAX.Length > 6)
|
|
|
{
|
|
|
result.msg = "产品厚度上限是不可为空的数字且长度不可超过6!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(insertModel.MINI) || !CommonUtils.IsNumber(insertModel.MINI) || insertModel.MINI.Length > 9)
|
|
|
{
|
|
|
result.msg = "下限是不可为空的数字且长度不可超过9!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(insertModel.MAXI) || !CommonUtils.IsNumber(insertModel.MAXI) || insertModel.MAXI.Length > 9)
|
|
|
{
|
|
|
result.msg = "上限是不可为空的数字且长度不可超过9!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrEmpty(insertModel.IF_HOT) || (!insertModel.IF_HOT.Equals("Q") && !insertModel.IF_HOT.Equals("N")))
|
|
|
{
|
|
|
result.msg = "是否热处理不可为空且只能是 Q 或 N !";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(insertModel.STLGRD))
|
|
|
if (insertModel.STLGRD.Length > 500)
|
|
|
{
|
|
|
result.msg = "钢种长度不可超过500!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
// 拼接主键重复check查询语句
|
|
|
strSql.AppendLine("SELECT * FROM EP_PLATELEN_M WHERE 1=1 ");
|
|
|
strSql.AppendLine(string.Format("AND PLT = '{0}' AND PRC_LINE = '{1}' AND APLY_ITEM = '{2}' AND PROD_THK_MIN = '{3}' AND PROD_THK_MAX = '{4}' AND MINI = '{5}' AND MAXI = '{6}' AND IF_HOT = '{7}'", insertModel.PLT, insertModel.PRC_LINE, insertModel.APLY_ITEM, insertModel.PROD_THK_MIN, insertModel.PROD_THK_MAX, insertModel.MINI, insertModel.MAXI, insertModel.IF_HOT));
|
|
|
|
|
|
|
|
|
insertModel.INS_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
insertModel.INS_TIME = dtNow.ToString("HHmmss");
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
//查询适用项目中文代表的适用项目
|
|
|
//cdDataTable = db.Query("SELECT CD FROM ZP_CD WHERE CD_NAME = '" + insertModel.APLY_ITEM + "'");
|
|
|
//----------------------------------------------
|
|
|
//获取datatable的第几列数据, 目前是第0列
|
|
|
//var Array = from DataRow dr in cdDataTable.Rows select dr[0];
|
|
|
//获取第0列第0个数据, 赋值给APLY_ITEM
|
|
|
//insertModel.APLY_ITEM = (string)Array.First();
|
|
|
//----------------------------------------------
|
|
|
// 执行主键重复查询
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
|
|
|
if (dtCheck.Rows.Count > 0) // 若数据库中存在则返回错误码0并msg提示用户
|
|
|
{
|
|
|
result.msg = "数据已存在,请确认后重试!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
//由于原表没有ProductionLineRequest这个表, 所以将值赋予ProductionLine
|
|
|
//PLT, PRC_LINE, APLY_ITEM, PROD_THK_MIN, PROD_THK_MAX, MINI, MAXI, IF_HOT,STLGRD
|
|
|
productionLine.PLT = insertModel.PLT;
|
|
|
productionLine.PRC_LINE = insertModel.PRC_LINE;
|
|
|
productionLine.APLY_ITEM = insertModel.APLY_ITEM;
|
|
|
productionLine.PROD_THK_MIN = insertModel.PROD_THK_MIN;
|
|
|
productionLine.PROD_THK_MAX = insertModel.PROD_THK_MAX;
|
|
|
productionLine.MINI = insertModel.MINI;
|
|
|
productionLine.MAXI = insertModel.MAXI;
|
|
|
productionLine.IF_HOT = insertModel.IF_HOT;
|
|
|
productionLine.STLGRD = insertModel.STLGRD;
|
|
|
productionLine.INS_DATE = insertModel.INS_DATE;
|
|
|
productionLine.INS_TIME = insertModel.INS_TIME;
|
|
|
if (db.Insert<ProductionLine>(productionLine) > 0) // 执行插入数据操作
|
|
|
{
|
|
|
result.msg = "操作成功";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddStdMgtInfos 报错", ex);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新接口
|
|
|
/// </summary>
|
|
|
/// <param name="requestData"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("hotRoll/uptstdmgtinfos")]
|
|
|
public RequestEntity UptStdMgtInfos(IList<ProductionLineRequest> requestData)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
DataTable dtCheckSelf = new DataTable();
|
|
|
DataTable cdDataTable = new DataTable();
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
StringBuilder strSqlSelf = new StringBuilder();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
#region 不可为空字段判断
|
|
|
//PLT, PRC_LINE, APLY_ITEM, PROD_THK_MIN, PROD_THK_MAX, MINI, MAXI, IF_HOT
|
|
|
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 > 1)
|
|
|
{
|
|
|
result.msg = "机号不可为空且长度不可超过1!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(requestData[1].APLY_ITEM) || requestData[1].APLY_ITEM.Length > 15)
|
|
|
{
|
|
|
result.msg = "适用项目不可为空!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(requestData[1].PROD_THK_MIN) || !CommonUtils.IsNumber(requestData[1].PROD_THK_MIN) || requestData[1].PROD_THK_MIN.Length > 6)
|
|
|
{
|
|
|
result.msg = "产品厚度下限是不可为空的数字且长度不可超过6!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(requestData[1].PROD_THK_MAX) || !CommonUtils.IsNumber(requestData[1].PROD_THK_MAX) || requestData[1].PROD_THK_MAX.Length > 6)
|
|
|
{
|
|
|
result.msg = "产品厚度上限是不可为空的数字且长度不可超过6!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(requestData[1].MINI) || !CommonUtils.IsNumber(requestData[1].MINI) || requestData[1].MINI.Length > 9)
|
|
|
{
|
|
|
result.msg = "下限是不可为空的数字且长度不可超过9!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(requestData[1].MAXI) || !CommonUtils.IsNumber(requestData[1].MAXI) || requestData[1].MAXI.Length > 9)
|
|
|
{
|
|
|
result.msg = "上限是不可为空的数字且长度不可超过9!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrEmpty(requestData[1].IF_HOT) || (!requestData[1].IF_HOT.Equals("Q") && !requestData[1].IF_HOT.Equals("N")))
|
|
|
{
|
|
|
result.msg = "是否热处理不可为空且只能是 Q 或 N !";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(requestData[1].STLGRD))
|
|
|
if (requestData[1].STLGRD.Length > 500)
|
|
|
{
|
|
|
result.msg = "钢种长度不可超过500!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
requestData[1].UPD_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
requestData[1].UPD_TIME = dtNow.ToString("HHmmss");
|
|
|
try
|
|
|
{
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
// 拼接主键重复check查询语句
|
|
|
strSql.AppendLine("SELECT * FROM EP_PLATELEN_M WHERE 1=1 ");
|
|
|
strSql.AppendLine(string.Format("AND PLT = '{0}' AND PRC_LINE = '{1}' AND APLY_ITEM = '{2}' AND PROD_THK_MIN = '{3}' AND PROD_THK_MAX = '{4}' AND MINI = '{5}' AND MAXI = '{6}' AND IF_HOT = '{7}'", requestData[1].PLT, requestData[1].PRC_LINE, requestData[1].APLY_ITEM, requestData[1].PROD_THK_MIN, requestData[1].PROD_THK_MAX, requestData[1].MINI, requestData[1].MAXI, requestData[1].IF_HOT));
|
|
|
|
|
|
strSqlSelf.AppendLine("SELECT * FROM EP_PLATELEN_M WHERE 1=1 ");
|
|
|
strSqlSelf.AppendLine(string.Format("AND PLT = '{0}' AND PRC_LINE = '{1}' AND APLY_ITEM = '{2}' AND PROD_THK_MIN = '{3}' AND PROD_THK_MAX = '{4}' AND MINI = '{5}' AND MAXI = '{6}' AND IF_HOT = '{7}'", requestData[0].PLT, requestData[0].PRC_LINE, requestData[0].APLY_ITEM, requestData[0].PROD_THK_MIN, requestData[0].PROD_THK_MAX, requestData[0].MINI, requestData[0].MAXI, requestData[0].IF_HOT));
|
|
|
// 执行主键重复查询
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
dtCheckSelf = db.Query(strSqlSelf.ToString());
|
|
|
|
|
|
if (dtCheck.Rows.Count > 0 && !CommonUtils.CompareDataTable(dtCheck, dtCheckSelf)) // 若数据库中存在则返回错误码0并msg提示用户
|
|
|
{
|
|
|
result.msg = "数据已存在,请确认后重试!";
|
|
|
result.code = "0";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (db.Execute("UPDATE EP_PLATELEN_M SET " + string.Format(" PLT = '{0}' , PRC_LINE = '{1}' , APLY_ITEM = '{2}' , PROD_THK_MIN = '{3}' , PROD_THK_MAX = '{4}' , MINI = '{5}' , MAXI = '{6}' , IF_HOT = '{7}', STLGRD = '{8}', UPD_DATE = '{9}',UPD_TIME='{10}' ", requestData[1].PLT, requestData[1].PRC_LINE, requestData[1].APLY_ITEM, requestData[1].PROD_THK_MIN, requestData[1].PROD_THK_MAX, requestData[1].MINI, requestData[1].MAXI, requestData[1].IF_HOT, requestData[1].STLGRD, requestData[1].UPD_DATE, requestData[1].UPD_TIME) +
|
|
|
string.Format("WHERE 1=1 AND PLT = '{0}' AND PRC_LINE = '{1}' AND APLY_ITEM = '{2}' AND PROD_THK_MIN = '{3}' AND PROD_THK_MAX = '{4}' AND MINI = '{5}' AND MAXI = '{6}' AND IF_HOT = '{7}'", requestData[0].PLT, requestData[0].PRC_LINE, requestData[0].APLY_ITEM, requestData[0].PROD_THK_MIN, requestData[0].PROD_THK_MAX, requestData[0].MINI, requestData[0].MAXI, requestData[0].IF_HOT)) > 0) // 执行插入数据操作
|
|
|
{
|
|
|
result.msg = "操作成功";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "数据未发生改变,请确认后重试!";
|
|
|
result.code = "0";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("UptStdMgtInfos 报错", ex);
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="delModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("hotRoll/delstdmgtinfos")]
|
|
|
public RequestEntity DelStdMgtInfos(ProductionLine delModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
// 拼接主键重复check查询语句
|
|
|
strSql.AppendLine("DELETE FROM EP_PLATELEN_M WHERE 1=1 ");
|
|
|
strSql.AppendLine(string.Format("AND PLT = '{0}' AND PRC_LINE = '{1}' AND APLY_ITEM = '{2}' AND PROD_THK_MIN = '{3}' AND PROD_THK_MAX = '{4}' AND MINI = '{5}' AND MAXI = '{6}' AND IF_HOT = '{7}'", delModel.PLT, delModel.PRC_LINE, delModel.APLY_ITEM, delModel.PROD_THK_MIN, delModel.PROD_THK_MAX, delModel.MINI, delModel.MAXI, delModel.IF_HOT));
|
|
|
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("AddStdMgtInfos 报错", ex);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|