|
|
using ibk.IPD.Common;
|
|
|
using ibk.IPD.Entity;
|
|
|
using ibk.IPD.Entity.IPD_PS;
|
|
|
using ibk.IPD.Entity.IPD_PS.QueryArgs;
|
|
|
using ibk.IPD.Entity.IPD_PS.RequestArgs;
|
|
|
using ibk.IPD.Entity.IPD_MR.HotRoll;
|
|
|
using ibk.IPD.Entity.IpdPs;
|
|
|
using ibk.IPD.Service;
|
|
|
using ibk.IPD.Service.IPD_PS;
|
|
|
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.Runtime.Remoting.Contexts;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Web.Http;
|
|
|
using System.IO;
|
|
|
using ibk.IPD.Service.IPD_SS;
|
|
|
using Consul;
|
|
|
using System.Diagnostics;
|
|
|
using System.Windows.Forms;
|
|
|
using Confluent.Kafka;
|
|
|
using ibk.IPD.Entity.IpdMr.Basic;
|
|
|
using System.Collections;
|
|
|
using ibk.IPD.Entity.IpdMr.StdMgt;
|
|
|
using ibk.IPD.Service.IPD_SS;
|
|
|
using System.Reflection.Emit;
|
|
|
using ibk.IPD.Entity.IPD_SS;
|
|
|
using System.Globalization;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using NPOI.XWPF.UserModel;
|
|
|
using static NPOI.HSSF.Util.HSSFColor;
|
|
|
|
|
|
namespace ibk.IPD.Controller.IPD_SS
|
|
|
{
|
|
|
[RoutePrefix("ipd/AipdSS")]
|
|
|
public class SlabSubstitutionController : ApiController
|
|
|
{
|
|
|
private static SurMatSubService SerSurMatSubService = new SurMatSubService();
|
|
|
|
|
|
//Log4net 日志输出
|
|
|
private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
|
|
//设置一个加锁对象
|
|
|
private static readonly object LOCK = new object();
|
|
|
|
|
|
#region 板坯配置表查改
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取替代配置信息
|
|
|
/// </summary>
|
|
|
/// <param name="queryArgs"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("getSlabConf")]
|
|
|
public RequestEntity getSlabConf(TB_SLAB_CONF queryArgs)
|
|
|
{
|
|
|
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
//strSql.AppendLine("SELECT * FROM TB_SLAB_CONF ");
|
|
|
strSql.AppendLine("select * FROM TB_SLAB_CONF pivot (max(pk) pk, max(DATA_SYNC_CYC) DATA_SYNC_CYC,max(YIELD_MIN) YIELD_MIN,max(FAC_NO) FAC_NO,max(THK_CD) THK_CD,max(len_min) len_min,max(LEN_MAX) len_max,max(ODR_SPD) ODR_SPD,max(SURPLUS_LEN) SURPLUS_LEN,max(EFF_RATE_MIN) EFF_RATE_MIN,max(data_period) data_period for pk in (1 as A, 2 as B, 3 as C)) ");
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
result.data = db.Query(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("getSlabConf 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
[HttpPost, Route("getSlabConfig")]
|
|
|
public RequestEntity getSlabConfig(TB_SLAB_CONF queryArgs)
|
|
|
{
|
|
|
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
strSql.AppendLine("SELECT * FROM TB_SLAB_CONF ");
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
result.data = db.Query(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("getSlabConf 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
[HttpPost, Route("getSlabConfC1")]
|
|
|
public RequestEntity getSlabConfC1(TB_SLAB_CONF queryArgs)
|
|
|
{
|
|
|
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
strSql.AppendLine("SELECT * FROM TB_SLAB_CONF where pk=1 ");
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
result.data = db.Query(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("getSlabConf 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取替代配置信息
|
|
|
/// </summary>
|
|
|
/// <param name="queryArgs"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("getSlabConfC2")]
|
|
|
public RequestEntity getSlabConfC2(TB_SLAB_CONF queryArgs)
|
|
|
{
|
|
|
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
strSql.AppendLine("select DATA_SYNC_CYC DATA_SYNC_CYC2, YIELD_MIN YIELD_MIN2, FAC_NO FAC_NO2, THK_CD THK_CD2, LEN_MIN LEN_MIN2, LEN_MAX LEN_MAX2, ODR_SPD ODR_SPD2, SURPLUS_LEN SURPLUS_LEN2, EFF_RATE_MIN EFF_RATE_MIN2, DATA_PERIOD DATA_PERIOD2, PK PK2 FROM TB_SLAB_CONF where pk = 2");
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
result.data = db.Query(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("getSlabConf 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取替代配置信息
|
|
|
/// </summary>
|
|
|
/// <param name="queryArgs"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("getSlabConfC3")]
|
|
|
public RequestEntity getSlabConfC3(TB_SLAB_CONF queryArgs)
|
|
|
{
|
|
|
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
strSql.AppendLine("select DATA_SYNC_CYC DATA_SYNC_CYC3, YIELD_MIN YIELD_MIN3, FAC_NO FAC_NO3, THK_CD THK_CD3, LEN_MIN LEN_MIN3, LEN_MAX LEN_MAX3, ODR_SPD ODR_SPD3, SURPLUS_LEN SURPLUS_LEN3, EFF_RATE_MIN EFF_RATE_MIN3, DATA_PERIOD DATA_PERIOD3, PK PK3 FROM TB_SLAB_CONF where pk = 3 ");
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
result.data = db.Query(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("getSlabConf 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取更新替代配置信息
|
|
|
/// </summary>
|
|
|
/// <param name="queryArgs"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("UpdSlabConf")]
|
|
|
public RequestEntity UpdSlabConf(TB_SLAB_CONF queryArgs)
|
|
|
{
|
|
|
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
StringBuilder strsql = new StringBuilder();
|
|
|
if (queryArgs.PK != null)
|
|
|
{
|
|
|
strsql.AppendLine("UPDATE TB_SLAB_CONF SET PK='" + queryArgs.PK + "'");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(queryArgs.YIELD_MIN))
|
|
|
{
|
|
|
strsql.AppendLine(", YIELD_MIN='" + queryArgs.YIELD_MIN + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(queryArgs.LEN_MIN))
|
|
|
{
|
|
|
strsql.AppendLine(", LEN_MIN='" + queryArgs.LEN_MIN + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(queryArgs.LEN_MAX))
|
|
|
{
|
|
|
strsql.AppendLine(", LEN_MAX='" + queryArgs.LEN_MAX + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(queryArgs.DATA_SYNC_CYC))
|
|
|
{
|
|
|
strsql.AppendLine(", DATA_SYNC_CYC='" + queryArgs.DATA_SYNC_CYC + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(queryArgs.FAC_NO))
|
|
|
{
|
|
|
strsql.AppendLine(", FAC_NO='" + queryArgs.FAC_NO + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(queryArgs.ODR_SPD))
|
|
|
{
|
|
|
strsql.AppendLine(", ODR_SPD='" + queryArgs.ODR_SPD + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(queryArgs.THK_CD))
|
|
|
{
|
|
|
strsql.AppendLine(", THK_CD='" + queryArgs.THK_CD + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(queryArgs.SURPLUS_LEN))
|
|
|
{
|
|
|
strsql.AppendLine(", SURPLUS_LEN ='" + queryArgs.SURPLUS_LEN + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(queryArgs.EFF_RATE_MIN))
|
|
|
{
|
|
|
strsql.AppendLine(", EFF_RATE_MIN='" + queryArgs.EFF_RATE_MIN + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(queryArgs.DATA_PERIOD))
|
|
|
{
|
|
|
strsql.AppendLine(", DATA_PERIOD='" + queryArgs.DATA_PERIOD + "'");
|
|
|
}
|
|
|
|
|
|
strsql.AppendLine("WHERE PK='" + queryArgs.PK + "'");
|
|
|
db.Execute(strsql.ToString());
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
//else
|
|
|
//{
|
|
|
// db.Insert<TB_SLAB_CONF>(queryArgs);
|
|
|
// result.msg = "操作成功!";
|
|
|
// result.code = "1";
|
|
|
//}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
logger.Error("UpdateParaConf 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 板坯替换确认界面接口
|
|
|
[HttpPost, Route("getSlabDesAll")]
|
|
|
public RequestEntity getSlabDesAll(TB_SLAB_DES_Args queryArgs)
|
|
|
{
|
|
|
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<FP_SLAB_DES> ltFSD = new List<FP_SLAB_DES>();
|
|
|
IList<FP_SLAB_DES_ALL> ltFSD_ALL = new List<FP_SLAB_DES_ALL>();
|
|
|
//strSql.AppendLine("SELECT * FROM FP_SLAB_DES FSD WHERE 1=1 AND FSD.HAN_RSL IS NULL ");
|
|
|
|
|
|
strSql.AppendLine("SELECT ");
|
|
|
strSql.AppendLine(" FSD.SLAB_NO ");
|
|
|
strSql.AppendLine(" , FSD.BLOCK_SEQ ");
|
|
|
strSql.AppendLine(" , FSD.SEQ ");
|
|
|
strSql.AppendLine(" , FSD.PROC_CD ");
|
|
|
strSql.AppendLine(" , FSD.BEF_PROC_CD ");
|
|
|
strSql.AppendLine(" , FSD.ORD_NO ");
|
|
|
strSql.AppendLine(" , FSD.ORD_ITEM ");
|
|
|
strSql.AppendLine(" , FSD.ORD_CNT ");
|
|
|
strSql.AppendLine(" , FSD.OVER_FL ");
|
|
|
strSql.AppendLine(" , FSD.PROD_CD ");
|
|
|
strSql.AppendLine(" , FSD.STLGRD ");
|
|
|
strSql.AppendLine(" , FSD.THK ");
|
|
|
strSql.AppendLine(" , FSD.WID ");
|
|
|
strSql.AppendLine(" , FSD.LEN ");
|
|
|
strSql.AppendLine(" , FSD.WGT ");
|
|
|
strSql.AppendLine(" , FSD.CNT ");
|
|
|
strSql.AppendLine(" , FSD.CR_CD ");
|
|
|
strSql.AppendLine(" , FSD.UST_FL ");
|
|
|
strSql.AppendLine(" , FSD.TRIM_FL ");
|
|
|
strSql.AppendLine(" , FSD.SMP_FL ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LOC ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.SMP_NO ");
|
|
|
strSql.AppendLine(" , FSD.INS_DATE ");
|
|
|
strSql.AppendLine(" , FSD.INS_TIME ");
|
|
|
strSql.AppendLine(" , FSD.END_DATE ");
|
|
|
strSql.AppendLine(" , FSD.END_TIME ");
|
|
|
strSql.AppendLine(" , FSD.UPD_PGMID ");
|
|
|
strSql.AppendLine(" , FSD.REC_STS ");
|
|
|
strSql.AppendLine(" , FSD.DESIGN_SMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.SLAB_CUT_SEQ ");
|
|
|
strSql.AppendLine(" , FSD.SLAB_LEN ");
|
|
|
strSql.AppendLine(" , FSD.SLAB_WGT ");
|
|
|
strSql.AppendLine(" , FSD.HTM_SHOT_BLAST ");
|
|
|
strSql.AppendLine(" , FSD.HTM_METH1 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_COND1 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_METH2 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_COND2 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_METH3 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_COND3 ");
|
|
|
strSql.AppendLine(" , FSD.ORD_FL ");
|
|
|
strSql.AppendLine(" , FSD.MID_SMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.POSITION_TYPE ");
|
|
|
strSql.AppendLine(" , FSD.POSITION_X ");
|
|
|
strSql.AppendLine(" , FSD.POSITION_Y ");
|
|
|
strSql.AppendLine(" , FSD.OVER_FL2 ");
|
|
|
strSql.AppendLine(" , FSD.INS_FL ");
|
|
|
strSql.AppendLine(" , FSD.FL ");
|
|
|
strSql.AppendLine(" , FSD.INS_PGMID ");
|
|
|
strSql.AppendLine(" , FSD.SMP_FL_RS ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LOC_RS ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LEN_RS ");
|
|
|
strSql.AppendLine(" , FSD.SMP_NO_RS ");
|
|
|
strSql.AppendLine(" , FSD.PLT ");
|
|
|
strSql.AppendLine(" , FSD.ID ");
|
|
|
//strSql.AppendLine(" , FSD.HAN_RSL ");
|
|
|
strSql.AppendLine(" , FSD.HAN_CON ");
|
|
|
strSql.AppendLine(" , FSD.HAN_DATE ");
|
|
|
strSql.AppendLine(" , FSD.THK_RATIO ");
|
|
|
strSql.AppendLine(" , FSD.WID_RATIO ");
|
|
|
strSql.AppendLine(" , FSD.HEAD_LEN ");
|
|
|
strSql.AppendLine(" , FSD.TAIL_LEN ");
|
|
|
strSql.AppendLine(" , FSD.WID_MRGIN ");
|
|
|
strSql.AppendLine(" , FSD.SAMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.CUT_LOSS ");
|
|
|
strSql.AppendLine(" , FSD.ORG_LEN ");
|
|
|
strSql.AppendLine(" , FSD.ORG_WGT ");
|
|
|
strSql.AppendLine(" , FSD.ORG_THK ");
|
|
|
strSql.AppendLine(" , FSD.ORG_WID ");
|
|
|
strSql.AppendLine(" , FSD.REM_LEN ");
|
|
|
strSql.AppendLine(" , FSD.REM_WGT ");
|
|
|
strSql.AppendLine(" , FSD.YIELD ");
|
|
|
strSql.AppendLine(" , FSD.UTILIZATION ");
|
|
|
strSql.AppendLine(" ,C.CD SUB_KIND ");
|
|
|
strSql.AppendLine(" , TO_DATE(FSD.INS_DATE||FSD.INS_TIME,'yyyy-mm-dd hh24:mi:ss') SUB_TIME ");
|
|
|
strSql.AppendLine(" ,B.CD HAN_RSL ");
|
|
|
strSql.AppendLine("FROM FP_SLAB_DES FSD ");
|
|
|
strSql.AppendLine(" left join (select * from ZP_CD where cd_mana_no= 'CLJG') B on FSD.HAN_RSL =B.CD_NAME ");
|
|
|
strSql.AppendLine(" left join (select * from ZP_CD where cd_mana_no= 'YPLX') C on FSD.HAN_RSL =C.CD_NAME ");
|
|
|
//strSql.AppendLine("WHERE 1 = 1 AND FSD.HAN_RSL IS NOT NULL");
|
|
|
strSql.AppendLine("WHERE 1 = 1 AND FSD.HAN_RSL IS NULL");
|
|
|
//strSql.AppendLine("WHERE 1 = 1 ");
|
|
|
if (queryArgs != null)
|
|
|
{
|
|
|
//板坯号
|
|
|
if (queryArgs.SLAB_NO != null && queryArgs.SLAB_NO != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.SLAB_NO = '" + queryArgs.SLAB_NO + "'");
|
|
|
}
|
|
|
//钢种
|
|
|
if (queryArgs.STLGRD != null && queryArgs.STLGRD != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.STLGRD = '" + queryArgs.STLGRD + "'");
|
|
|
}
|
|
|
//工厂
|
|
|
if (queryArgs.PLT != null && queryArgs.PLT != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.PLT = '" + queryArgs.PLT + "'");
|
|
|
}
|
|
|
//订单号
|
|
|
if (queryArgs.ORD_NO != null && queryArgs.ORD_NO != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND ORD_NO = '" + queryArgs.ORD_NO + "'");
|
|
|
}
|
|
|
//订单序列
|
|
|
if (queryArgs.ORD_ITEM != null && queryArgs.ORD_ITEM != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND ORD_ITEM = '" + queryArgs.ORD_ITEM + "'");
|
|
|
}
|
|
|
//插入时间
|
|
|
//if (queryArgs.INS_DATE_MAX!= null)
|
|
|
//{
|
|
|
// strSql.AppendLine(" AND to_date(ins_date||ins_time,'yyyy-mm-dd hh24:mi:ss') <= '" + queryArgs.INS_DATE_MAX + "'");
|
|
|
//}
|
|
|
//if (queryArgs.INS_DATE_MIN != null)
|
|
|
//{
|
|
|
// strSql.AppendLine(" AND to_date(ins_date||ins_time,'yyyy-mm-dd hh24:mi:ss') > ='" + queryArgs.INS_DATE_MIN + "'");
|
|
|
//}
|
|
|
|
|
|
////处理状态
|
|
|
//if (queryArgs.HAN_RSL != null && queryArgs.HAN_RSL != string.Empty)
|
|
|
//{
|
|
|
// strSql.AppendLine(" AND SUB_KND = (select CD from ZP_CD where cd_mana_no= 'CLJG' AND CD_NAME=={0}) " + queryArgs.SUB_KND);
|
|
|
//}
|
|
|
//替代类型
|
|
|
if (!string.IsNullOrEmpty(queryArgs.SUB_KND))
|
|
|
{
|
|
|
//strSql.AppendLine(" AND B.cd_mana_no= 'YPLX' and = (select CD from ZP_CD where cd_mana_no= 'YPLX' AND CD_NAME=={0}) " + queryArgs.SUB_KND);
|
|
|
//strSql.AppendLine(" AND B.cd_mana_no= 'YPLX' and B.CD_NAME='" + queryArgs.SUB_KND) + "'");
|
|
|
strSql.AppendLine(" AND C.CD = '" + queryArgs.SUB_KND + "'");
|
|
|
}
|
|
|
|
|
|
//处理状态
|
|
|
if (!string.IsNullOrEmpty(queryArgs.HAN_RSL))
|
|
|
{
|
|
|
//strSql.AppendLine(" AND SUB_KND = (select CD from ZP_CD where cd_mana_no= 'CLJG' AND CD_NAME=={0}) " + queryArgs.SUB_KND);
|
|
|
strSql.AppendLine(" AND B.CD = '" + queryArgs.HAN_RSL + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrWhiteSpace(CommonUtils.ObjectToStr(queryArgs.STARTTIME)) && CommonUtils.ObjectToStr(queryArgs.STARTTIME) != "0001/1/1 0:00:00")
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') >= to_date('" + CommonUtils.ObjectToStr(queryArgs.STARTTIME) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
if (!string.IsNullOrWhiteSpace(CommonUtils.ObjectToStr(queryArgs.ENDTIME)) && CommonUtils.ObjectToStr(queryArgs.ENDTIME) != "0001/1/1 0:00:00")
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') < to_date('" + CommonUtils.ObjectToStr(queryArgs.ENDTIME.AddDays(1)) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
if (queryArgs.STARTTIME == DateTime.MinValue && queryArgs.ENDTIME == DateTime.MinValue)
|
|
|
{
|
|
|
queryArgs.STARTTIME = DateTime.Now;
|
|
|
queryArgs.ENDTIME = DateTime.Now;
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') >= to_date('" + CommonUtils.ObjectToStr(queryArgs.STARTTIME.ToString("yyyy-MM-dd")) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') < to_date('" + CommonUtils.ObjectToStr(queryArgs.ENDTIME.AddDays(1).ToString("yyyy-MM-dd")) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
strSql.AppendLine("ORDER BY FSD.SLAB_NO ,FSD.BLOCK_SEQ,FSD.SEQ ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
ltFSD = db.Query<FP_SLAB_DES>(strSql.ToString());
|
|
|
|
|
|
//result.data = db.Query(strSql.ToString());
|
|
|
if (ltFSD.Count > 0)
|
|
|
{
|
|
|
FP_SLAB_DES_ALL fsda_1 = new FP_SLAB_DES_ALL();
|
|
|
foreach (string strSlab in ltFSD.GroupBy(p => p.SLAB_NO).Select(p => p.Key).ToList())
|
|
|
{
|
|
|
//一层
|
|
|
if (ltFSD_ALL.Where(p => p.SLAB_NO == strSlab).Count() == 0)
|
|
|
{
|
|
|
|
|
|
fsda_1 = new FP_SLAB_DES_ALL();
|
|
|
fsda_1 = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == "01").FirstOrDefault());
|
|
|
fsda_1.LEN = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == "01").FirstOrDefault().ORG_LEN;
|
|
|
fsda_1.WGT = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == "01").FirstOrDefault().ORG_WGT;
|
|
|
fsda_1.THK = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == "01").FirstOrDefault().ORG_THK;
|
|
|
fsda_1.WID = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == "01").FirstOrDefault().ORG_WID;
|
|
|
|
|
|
fsda_1.SLAB_LEN = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00").OrderByDescending(e => e.SLAB_CUT_SEQ).FirstOrDefault().REM_LEN;
|
|
|
fsda_1.SLAB_WGT = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00").OrderByDescending(e => e.SLAB_CUT_SEQ).FirstOrDefault().REM_WGT;
|
|
|
fsda_1.CNT = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00").Count();
|
|
|
decimal wgt = (ltFSD.Where(p => p.SLAB_NO == strSlab && p.BLOCK_SEQ == "00" && p.SEQ == "00" && (p.PROC_CD == "CAA" || (p.PROC_CD == "CAD" && p.BEF_PROC_CD == "CAA"))).Select(q => q.WGT).Sum());
|
|
|
if (wgt == 0 || fsda_1.ORG_WGT == 0)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
fsda_1.YIELD = Math.Round((ltFSD.Where(p => p.SLAB_NO == strSlab && p.BLOCK_SEQ != "00" && p.SEQ != "00").Select(q => q.WGT).Sum()) / (wgt) * 100, 2);
|
|
|
|
|
|
fsda_1.UTILIZATION = Math.Round(wgt / (fsda_1.ORG_WGT) * 100, 2);
|
|
|
|
|
|
fsda_1.KEY = fsda_1.SLAB_NO + "_00_00_00";// + fsda_1.SLAB_CUT_SEQ;
|
|
|
ltFSD_ALL.Add(fsda_1);
|
|
|
fsda_1.children = new List<FP_SLAB_DES_ALL>();
|
|
|
//二层
|
|
|
foreach (FP_SLAB_DES item_1 in ltFSD.Where(p => p.SLAB_NO == strSlab && p.BLOCK_SEQ == "00" && p.SEQ == "00" && p.SLAB_CUT_SEQ != "00").OrderBy(e => e.SLAB_CUT_SEQ).ToList())
|
|
|
{
|
|
|
FP_SLAB_DES_ALL fsda_2 = new FP_SLAB_DES_ALL();
|
|
|
fsda_2 = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).FirstOrDefault());
|
|
|
fsda_2.KEY = fsda_1.SLAB_NO + "_" + item_1.SLAB_CUT_SEQ + "_00_00";// + fsda_1.SLAB_CUT_SEQ;
|
|
|
|
|
|
fsda_2.CNT = ltFSD.Where(p => p.SLAB_NO == strSlab && p.BLOCK_SEQ == "00" && p.SEQ == "00" && p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).Count();
|
|
|
|
|
|
fsda_1.children.Add(fsda_2);
|
|
|
fsda_2.children = new List<FP_SLAB_DES_ALL>();
|
|
|
//三层
|
|
|
foreach (FP_SLAB_DES item_2 in ltFSD.Where(p => p.SLAB_NO == strSlab && p.BLOCK_SEQ != "00" && p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).OrderBy(e => e.BLOCK_SEQ).ToList())
|
|
|
{
|
|
|
FP_SLAB_DES_ALL fsda_3 = new FP_SLAB_DES_ALL();
|
|
|
fsda_3 = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == item_2.BLOCK_SEQ
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).FirstOrDefault());
|
|
|
fsda_3.KEY = fsda_1.SLAB_NO + "_" + item_1.SLAB_CUT_SEQ + "" + item_2.BLOCK_SEQ + "_00";// + fsda_1.SLAB_CUT_SEQ;
|
|
|
fsda_3.CNT = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == item_2.BLOCK_SEQ
|
|
|
&& p.SEQ != "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).Count();
|
|
|
|
|
|
fsda_2.children.Add(fsda_3);
|
|
|
fsda_3.children = new List<FP_SLAB_DES_ALL>();
|
|
|
//四层
|
|
|
foreach (FP_SLAB_DES item_3 in ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == item_2.BLOCK_SEQ && p.SEQ != "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).ToList())
|
|
|
{
|
|
|
FP_SLAB_DES_ALL fsda_4 = new FP_SLAB_DES_ALL();
|
|
|
fsda_4 = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(item_3);
|
|
|
fsda_4.KEY = fsda_1.SLAB_NO + "_" + item_1.SLAB_CUT_SEQ + "" + item_2.BLOCK_SEQ + "_" + item_3.SEQ;// + fsda_1.SLAB_CUT_SEQ;
|
|
|
fsda_3.children.Add(fsda_4);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
result.data = ltFSD_ALL;
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.data = ltFSD;
|
|
|
result.msg = "未找到查询所需数据!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetSlabSub 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取替代板坯信息
|
|
|
/// </summary>
|
|
|
/// <param name="queryArgs"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("getSlabDes")]
|
|
|
public RequestEntity getSlabDes(TB_SLAB_DES_Args queryArgs)
|
|
|
{
|
|
|
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<FP_SLAB_DES> ltFSD = new List<FP_SLAB_DES>();
|
|
|
//strSql.AppendLine("SELECT * FROM FP_SLAB_DES FSD WHERE 1=1 AND FSD.HAN_RSL IS NULL ");
|
|
|
|
|
|
strSql.AppendLine("SELECT ");
|
|
|
strSql.AppendLine(" FSD.SLAB_NO ");
|
|
|
strSql.AppendLine(" , FSD.BLOCK_SEQ ");
|
|
|
strSql.AppendLine(" , FSD.SEQ ");
|
|
|
strSql.AppendLine(" , FSD.PROC_CD ");
|
|
|
strSql.AppendLine(" , FSD.BEF_PROC_CD ");
|
|
|
strSql.AppendLine(" , FSD.ORD_NO ");
|
|
|
strSql.AppendLine(" , FSD.ORD_ITEM ");
|
|
|
strSql.AppendLine(" , FSD.ORD_CNT ");
|
|
|
strSql.AppendLine(" , FSD.OVER_FL ");
|
|
|
strSql.AppendLine(" , FSD.PROD_CD ");
|
|
|
strSql.AppendLine(" , FSD.STLGRD ");
|
|
|
strSql.AppendLine(" , FSD.THK ");
|
|
|
strSql.AppendLine(" , FSD.WID ");
|
|
|
strSql.AppendLine(" , FSD.LEN ");
|
|
|
strSql.AppendLine(" , FSD.WGT ");
|
|
|
strSql.AppendLine(" , FSD.CNT ");
|
|
|
strSql.AppendLine(" , FSD.CR_CD ");
|
|
|
strSql.AppendLine(" , FSD.UST_FL ");
|
|
|
strSql.AppendLine(" , FSD.TRIM_FL ");
|
|
|
strSql.AppendLine(" , FSD.SMP_FL ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LOC ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.SMP_NO ");
|
|
|
strSql.AppendLine(" , FSD.INS_DATE ");
|
|
|
strSql.AppendLine(" , FSD.INS_TIME ");
|
|
|
strSql.AppendLine(" , FSD.END_DATE ");
|
|
|
strSql.AppendLine(" , FSD.END_TIME ");
|
|
|
strSql.AppendLine(" , FSD.UPD_PGMID ");
|
|
|
strSql.AppendLine(" , FSD.REC_STS ");
|
|
|
strSql.AppendLine(" , FSD.DESIGN_SMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.SLAB_CUT_SEQ ");
|
|
|
strSql.AppendLine(" , FSD.SLAB_LEN ");
|
|
|
strSql.AppendLine(" , FSD.SLAB_WGT ");
|
|
|
strSql.AppendLine(" , FSD.HTM_SHOT_BLAST ");
|
|
|
strSql.AppendLine(" , FSD.HTM_METH1 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_COND1 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_METH2 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_COND2 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_METH3 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_COND3 ");
|
|
|
strSql.AppendLine(" , FSD.ORD_FL ");
|
|
|
strSql.AppendLine(" , FSD.MID_SMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.POSITION_TYPE ");
|
|
|
strSql.AppendLine(" , FSD.POSITION_X ");
|
|
|
strSql.AppendLine(" , FSD.POSITION_Y ");
|
|
|
strSql.AppendLine(" , FSD.OVER_FL2 ");
|
|
|
strSql.AppendLine(" , FSD.INS_FL ");
|
|
|
strSql.AppendLine(" , FSD.FL ");
|
|
|
strSql.AppendLine(" , FSD.INS_PGMID ");
|
|
|
strSql.AppendLine(" , FSD.SMP_FL_RS ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LOC_RS ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LEN_RS ");
|
|
|
strSql.AppendLine(" , FSD.SMP_NO_RS ");
|
|
|
strSql.AppendLine(" , FSD.PLT ");
|
|
|
strSql.AppendLine(" , FSD.ID ");
|
|
|
strSql.AppendLine(" , FSD.HAN_RSL ");
|
|
|
strSql.AppendLine(" , FSD.HAN_CON ");
|
|
|
strSql.AppendLine(" , FSD.HAN_DATE ");
|
|
|
strSql.AppendLine(" , FSD.THK_RATIO ");
|
|
|
strSql.AppendLine(" , FSD.WID_RATIO ");
|
|
|
strSql.AppendLine(" , FSD.HEAD_LEN ");
|
|
|
strSql.AppendLine(" , FSD.TAIL_LEN ");
|
|
|
strSql.AppendLine(" , FSD.WID_MRGIN ");
|
|
|
strSql.AppendLine(" , FSD.SAMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.CUT_LOSS ");
|
|
|
strSql.AppendLine(" , TO_DATE(FSD.INS_DATE||FSD.INS_TIME,'yyyy-mm-dd hh24:mi:ss') SUB_TIME ");
|
|
|
strSql.AppendLine(" ,B.CD HAN_RSL ");
|
|
|
strSql.AppendLine("FROM FP_SLAB_DES FSD ");
|
|
|
strSql.AppendLine(" left join (select * from ZP_CD where cd_mana_no= 'CLJG') B on FSD.HAN_RSL =B.CD_NAME ");
|
|
|
strSql.AppendLine("WHERE 1 = 1 AND FSD.HAN_RSL IS NULL");
|
|
|
|
|
|
if (queryArgs != null)
|
|
|
{
|
|
|
//板坯号
|
|
|
if (queryArgs.SLAB_NO != null && queryArgs.SLAB_NO != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.SLAB_NO = '" + queryArgs.SLAB_NO + "'");
|
|
|
}
|
|
|
//钢种
|
|
|
if (queryArgs.STLGRD != null && queryArgs.STLGRD != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.STLGRD = '" + queryArgs.STLGRD + "'");
|
|
|
}
|
|
|
//工厂
|
|
|
if (queryArgs.PLT != null && queryArgs.PLT != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.PLT = '" + queryArgs.PLT + "'");
|
|
|
}
|
|
|
//替代类型
|
|
|
if (!string.IsNullOrEmpty(queryArgs.SUB_KND))
|
|
|
{
|
|
|
//strSql.AppendLine(" AND B.cd_mana_no= 'YPLX' and = (select CD from ZP_CD where cd_mana_no= 'YPLX' AND CD_NAME=={0}) " + queryArgs.SUB_KND);
|
|
|
//strSql.AppendLine(" AND B.cd_mana_no= 'YPLX' and B.CD_NAME='" + queryArgs.SUB_KND) + "'");
|
|
|
strSql.AppendLine(" AND SUB_KIND in (select CD_NAME from ZP_CD where CD ='" + queryArgs.SUB_KND + "')");
|
|
|
}
|
|
|
|
|
|
//处理状态
|
|
|
if (!string.IsNullOrEmpty(queryArgs.HAN_RSL))
|
|
|
{
|
|
|
//strSql.AppendLine(" AND SUB_KND = (select CD from ZP_CD where cd_mana_no= 'CLJG' AND CD_NAME=={0}) " + queryArgs.SUB_KND);
|
|
|
strSql.AppendLine(" AND B.CD = '" + queryArgs.HAN_RSL + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrWhiteSpace(CommonUtils.ObjectToStr(queryArgs.STARTTIME)) && CommonUtils.ObjectToStr(queryArgs.STARTTIME) != "0001/1/1 0:00:00")
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') >= to_date('" + CommonUtils.ObjectToStr(queryArgs.STARTTIME) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
if (!string.IsNullOrWhiteSpace(CommonUtils.ObjectToStr(queryArgs.ENDTIME)) && CommonUtils.ObjectToStr(queryArgs.ENDTIME) != "0001/1/1 0:00:00")
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') < to_date('" + CommonUtils.ObjectToStr(queryArgs.ENDTIME.AddDays(1)) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
if (queryArgs.STARTTIME == DateTime.MinValue && queryArgs.ENDTIME == DateTime.MinValue)
|
|
|
{
|
|
|
queryArgs.STARTTIME = DateTime.Now;
|
|
|
queryArgs.ENDTIME = DateTime.Now;
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') >= to_date('" + CommonUtils.ObjectToStr(queryArgs.STARTTIME.ToString("yyyy-MM-dd")) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') < to_date('" + CommonUtils.ObjectToStr(queryArgs.ENDTIME.AddDays(1).ToString("yyyy-MM-dd")) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
strSql.AppendLine("ORDER BY FSD.SLAB_NO ,FSD.BLOCK_SEQ,FSD.SEQ ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
result.data = dtCheck;
|
|
|
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("GetSlabSub 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取替代板坯信息历史信息
|
|
|
/// </summary>
|
|
|
/// <param name="queryArgs"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("getSlabDesHis")]
|
|
|
public RequestEntity getSlabDesHis(TB_SLAB_DES_Args queryArgs)
|
|
|
{
|
|
|
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<FP_SLAB_DES> ltFSD = new List<FP_SLAB_DES>();
|
|
|
IList<FP_SLAB_DES_ALL> ltFSD_ALL = new List<FP_SLAB_DES_ALL>();
|
|
|
|
|
|
strSql.AppendLine("SELECT ");
|
|
|
strSql.AppendLine(" FSD.SLAB_NO ");
|
|
|
strSql.AppendLine(" , FSD.BLOCK_SEQ ");
|
|
|
strSql.AppendLine(" , FSD.SEQ ");
|
|
|
strSql.AppendLine(" , FSD.PROC_CD ");
|
|
|
strSql.AppendLine(" , FSD.BEF_PROC_CD ");
|
|
|
strSql.AppendLine(" , FSD.ORD_NO ");
|
|
|
strSql.AppendLine(" , FSD.ORD_ITEM ");
|
|
|
strSql.AppendLine(" , FSD.ORD_CNT ");
|
|
|
strSql.AppendLine(" , FSD.OVER_FL ");
|
|
|
strSql.AppendLine(" , FSD.PROD_CD ");
|
|
|
strSql.AppendLine(" , FSD.STLGRD ");
|
|
|
strSql.AppendLine(" , FSD.THK ");
|
|
|
strSql.AppendLine(" , FSD.WID ");
|
|
|
strSql.AppendLine(" , FSD.LEN ");
|
|
|
strSql.AppendLine(" , FSD.WGT ");
|
|
|
strSql.AppendLine(" , FSD.CNT ");
|
|
|
strSql.AppendLine(" , FSD.CR_CD ");
|
|
|
strSql.AppendLine(" , FSD.UST_FL ");
|
|
|
strSql.AppendLine(" , FSD.TRIM_FL ");
|
|
|
strSql.AppendLine(" , FSD.SMP_FL ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LOC ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.SMP_NO ");
|
|
|
strSql.AppendLine(" , FSD.INS_DATE ");
|
|
|
strSql.AppendLine(" , FSD.INS_TIME ");
|
|
|
strSql.AppendLine(" , FSD.END_DATE ");
|
|
|
strSql.AppendLine(" , FSD.END_TIME ");
|
|
|
strSql.AppendLine(" , FSD.UPD_PGMID ");
|
|
|
strSql.AppendLine(" , FSD.REC_STS ");
|
|
|
strSql.AppendLine(" , FSD.DESIGN_SMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.SLAB_CUT_SEQ ");
|
|
|
strSql.AppendLine(" , FSD.SLAB_LEN ");
|
|
|
strSql.AppendLine(" , FSD.SLAB_WGT ");
|
|
|
strSql.AppendLine(" , FSD.HTM_SHOT_BLAST ");
|
|
|
strSql.AppendLine(" , FSD.HTM_METH1 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_COND1 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_METH2 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_COND2 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_METH3 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_COND3 ");
|
|
|
strSql.AppendLine(" , FSD.ORD_FL ");
|
|
|
strSql.AppendLine(" , FSD.MID_SMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.POSITION_TYPE ");
|
|
|
strSql.AppendLine(" , FSD.POSITION_X ");
|
|
|
strSql.AppendLine(" , FSD.POSITION_Y ");
|
|
|
strSql.AppendLine(" , FSD.OVER_FL2 ");
|
|
|
strSql.AppendLine(" , FSD.INS_FL ");
|
|
|
strSql.AppendLine(" , FSD.FL ");
|
|
|
strSql.AppendLine(" , FSD.INS_PGMID ");
|
|
|
strSql.AppendLine(" , FSD.SMP_FL_RS ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LOC_RS ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LEN_RS ");
|
|
|
strSql.AppendLine(" , FSD.SMP_NO_RS ");
|
|
|
strSql.AppendLine(" , FSD.PLT ");
|
|
|
strSql.AppendLine(" , FSD.ID ");
|
|
|
//strSql.AppendLine(" , NVL((select b.CD from ZP_CD b where cd_mana_no= 'CLJG' and b.cd_NAME=FSD.HAN_RSL),'未处理') HAN_RSL ");
|
|
|
strSql.AppendLine(" , FSD.HAN_CON ");
|
|
|
strSql.AppendLine(" , FSD.HAN_DATE ");
|
|
|
strSql.AppendLine(" , FSD.THK_RATIO ");
|
|
|
strSql.AppendLine(" , FSD.WID_RATIO ");
|
|
|
strSql.AppendLine(" , FSD.HEAD_LEN ");
|
|
|
strSql.AppendLine(" , FSD.TAIL_LEN ");
|
|
|
strSql.AppendLine(" , FSD.WID_MRGIN ");
|
|
|
strSql.AppendLine(" , FSD.SAMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.CUT_LOSS ");
|
|
|
strSql.AppendLine(" , FSD.ORG_LEN ");
|
|
|
strSql.AppendLine(" , FSD.ORG_WGT ");
|
|
|
strSql.AppendLine(" , FSD.ORG_THK ");
|
|
|
strSql.AppendLine(" , FSD.ORG_WID ");
|
|
|
strSql.AppendLine(" , FSD.REM_LEN ");
|
|
|
strSql.AppendLine(" , FSD.REM_WGT ");
|
|
|
strSql.AppendLine(" , FSD.YIELD ");
|
|
|
strSql.AppendLine(" , FSD.UTILIZATION ");
|
|
|
strSql.AppendLine(" , C.CD SUB_KIND ");
|
|
|
strSql.AppendLine(" , TO_DATE(FSD.INS_DATE||FSD.INS_TIME,'yyyy-mm-dd hh24:mi:ss') SUB_TIME "); //替代时间
|
|
|
strSql.AppendLine(" , HAN_DATE "); //处理时间
|
|
|
strSql.AppendLine(" ,(case when B.CD is not null then B.CD else '未处理' end) as HAN_RSL ");
|
|
|
strSql.AppendLine("FROM FP_SLAB_DES FSD ");
|
|
|
strSql.AppendLine(" left join (select * from ZP_CD where cd_mana_no= 'CLJG') B on FSD.HAN_RSL =B.CD_NAME ");
|
|
|
strSql.AppendLine(" left join (select * from ZP_CD where cd_mana_no= 'YPLX') C on FSD.HAN_RSL =C.CD_NAME ");
|
|
|
strSql.AppendLine("WHERE 1 = 1 ");
|
|
|
|
|
|
|
|
|
if (queryArgs != null)
|
|
|
{
|
|
|
//板坯号
|
|
|
if (queryArgs.SLAB_NO != null && queryArgs.SLAB_NO != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.SLAB_NO = '" + queryArgs.SLAB_NO + "'");
|
|
|
}
|
|
|
//钢种
|
|
|
if (queryArgs.STLGRD != null && queryArgs.STLGRD != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.STLGRD = '" + queryArgs.STLGRD + "'");
|
|
|
}
|
|
|
//工厂
|
|
|
if (queryArgs.PLT != null && queryArgs.PLT != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.PLT = '" + queryArgs.PLT + "'");
|
|
|
}
|
|
|
|
|
|
//订单号
|
|
|
if (queryArgs.ORD_NO != null && queryArgs.ORD_NO != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND ORD_NO = '" + queryArgs.ORD_NO + "'");
|
|
|
}
|
|
|
//订单序列
|
|
|
if (queryArgs.ORD_ITEM != null && queryArgs.ORD_ITEM != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND ORD_ITEM = '" + queryArgs.ORD_ITEM + "'");
|
|
|
}
|
|
|
|
|
|
|
|
|
//替代类型
|
|
|
if (!string.IsNullOrEmpty(queryArgs.SUB_KND))
|
|
|
{
|
|
|
|
|
|
//strSql.AppendLine(" AND SUB_KIND in (select CD_NAME from ZP_CD where CD ='" + queryArgs.SUB_KND + "')");
|
|
|
strSql.AppendLine(" AND C.CD = '" + queryArgs.SUB_KND + "'");
|
|
|
}
|
|
|
|
|
|
//处理状态
|
|
|
if (!string.IsNullOrEmpty(queryArgs.HAN_RSL))
|
|
|
{
|
|
|
//strSql.AppendLine(" AND SUB_KND = (select CD from ZP_CD where cd_mana_no= 'CLJG' AND CD_NAME=={0}) " + queryArgs.SUB_KND);
|
|
|
strSql.AppendLine(" AND B.CD = '" + queryArgs.HAN_RSL + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrWhiteSpace(CommonUtils.ObjectToStr(queryArgs.STARTTIME)) && CommonUtils.ObjectToStr(queryArgs.STARTTIME) != "0001/1/1 0:00:00")
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') >= to_date('" + CommonUtils.ObjectToStr(queryArgs.STARTTIME) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
if (!string.IsNullOrWhiteSpace(CommonUtils.ObjectToStr(queryArgs.ENDTIME)) && CommonUtils.ObjectToStr(queryArgs.ENDTIME) != "0001/1/1 0:00:00")
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') < to_date('" + CommonUtils.ObjectToStr(queryArgs.ENDTIME.AddDays(1)) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
if (queryArgs.STARTTIME == DateTime.MinValue && queryArgs.ENDTIME == DateTime.MinValue)
|
|
|
{
|
|
|
queryArgs.STARTTIME = DateTime.Now;
|
|
|
queryArgs.ENDTIME = DateTime.Now;
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') >= to_date('" + CommonUtils.ObjectToStr(queryArgs.STARTTIME.ToString("yyyy-MM-dd")) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') < to_date('" + CommonUtils.ObjectToStr(queryArgs.ENDTIME.AddDays(1).ToString("yyyy-MM-dd")) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
strSql.AppendLine("ORDER BY FSD.LEN ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
ltFSD = db.Query<FP_SLAB_DES>(strSql.ToString());
|
|
|
|
|
|
//result.data = db.Query(strSql.ToString());
|
|
|
if (ltFSD.Count > 0)
|
|
|
{
|
|
|
foreach (FP_SLAB_DES fps in ltFSD)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(fps.HAN_DATE) && !string.IsNullOrEmpty(fps.SUB_TIME))
|
|
|
{
|
|
|
DateTime SUB_TIME = DateTime.Parse(fps.SUB_TIME);
|
|
|
DateTime hanDate = DateTime.Parse(fps.HAN_DATE);
|
|
|
TimeSpan timeDiff = hanDate - SUB_TIME;
|
|
|
double totalMinutes = Math.Floor(timeDiff.TotalMinutes);
|
|
|
if (totalMinutes >= 3)
|
|
|
{
|
|
|
fps.SUB_TIME = SUB_TIME.AddMinutes(totalMinutes - 2).ToString();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
FP_SLAB_DES_ALL fsda_1 = new FP_SLAB_DES_ALL();
|
|
|
foreach (string strSlab in ltFSD.GroupBy(p => p.SLAB_NO + p.INS_DATE + p.INS_TIME + p.SLAB_CUT_SEQ).Select(p => p.Key).ToList())
|
|
|
{
|
|
|
|
|
|
string SLAB_NO = strSlab.Substring(0, 10);
|
|
|
string INS_DATE = strSlab.Substring(10, 8);
|
|
|
string INS_TIME = strSlab.Substring(18, 6);
|
|
|
string SLAB_CUT_SEQ = "01";
|
|
|
//一层
|
|
|
if (ltFSD_ALL.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME).Count() == 0)
|
|
|
{
|
|
|
|
|
|
fsda_1 = new FP_SLAB_DES_ALL();
|
|
|
fsda_1 = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == SLAB_CUT_SEQ).FirstOrDefault());
|
|
|
fsda_1.LEN = ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == SLAB_CUT_SEQ).FirstOrDefault().ORG_LEN;
|
|
|
fsda_1.WGT = ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == SLAB_CUT_SEQ).FirstOrDefault().ORG_WGT;
|
|
|
fsda_1.THK = ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == SLAB_CUT_SEQ).FirstOrDefault().ORG_THK;
|
|
|
fsda_1.WID = ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == SLAB_CUT_SEQ).FirstOrDefault().ORG_WID;
|
|
|
|
|
|
fsda_1.SLAB_LEN = ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00").OrderByDescending(e => e.SLAB_CUT_SEQ).FirstOrDefault().REM_LEN;
|
|
|
fsda_1.SLAB_WGT = ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00").OrderByDescending(e => e.SLAB_CUT_SEQ).FirstOrDefault().REM_WGT;
|
|
|
|
|
|
fsda_1.CNT = ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00").Count();
|
|
|
|
|
|
decimal wgt = (ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME && p.BLOCK_SEQ == "00" && p.SEQ == "00" && (p.PROC_CD == "CAA" || (p.PROC_CD == "CAD" && p.BEF_PROC_CD == "CAA"))).Select(q => q.WGT).Sum());
|
|
|
if (wgt == 0 || fsda_1.ORG_WGT == 0)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
fsda_1.YIELD = Math.Round((ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME && p.BLOCK_SEQ != "00" && p.SEQ != "00").Select(q => q.WGT).Sum()) / (wgt) * 100, 2);
|
|
|
|
|
|
fsda_1.UTILIZATION = Math.Round(wgt / (fsda_1.ORG_WGT) * 100, 2);
|
|
|
|
|
|
|
|
|
fsda_1.KEY = fsda_1.SLAB_NO + INS_DATE + INS_TIME + "_00_00_00";// + fsda_1.SLAB_CUT_SEQ;
|
|
|
ltFSD_ALL.Add(fsda_1);
|
|
|
fsda_1.children = new List<FP_SLAB_DES_ALL>();
|
|
|
//二层
|
|
|
foreach (FP_SLAB_DES item_1 in ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME && p.BLOCK_SEQ == "00" && p.SEQ == "00" && p.SLAB_CUT_SEQ != "00").OrderBy(e => e.SLAB_CUT_SEQ).ToList())
|
|
|
{
|
|
|
FP_SLAB_DES_ALL fsda_2 = new FP_SLAB_DES_ALL();
|
|
|
fsda_2 = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).FirstOrDefault());
|
|
|
fsda_2.KEY = fsda_1.SLAB_NO + INS_DATE + INS_TIME + "_" + item_1.SLAB_CUT_SEQ + "_00_00";// + fsda_1.SLAB_CUT_SEQ;
|
|
|
|
|
|
fsda_2.CNT = ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME && p.BLOCK_SEQ == "00" && p.SEQ == "00" && p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).Count();
|
|
|
|
|
|
fsda_1.children.Add(fsda_2);
|
|
|
fsda_2.children = new List<FP_SLAB_DES_ALL>();
|
|
|
//三层
|
|
|
foreach (FP_SLAB_DES item_2 in ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME && p.BLOCK_SEQ != "00" && p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).OrderBy(e => e.BLOCK_SEQ).ToList())
|
|
|
{
|
|
|
FP_SLAB_DES_ALL fsda_3 = new FP_SLAB_DES_ALL();
|
|
|
fsda_3 = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME
|
|
|
&& p.BLOCK_SEQ == item_2.BLOCK_SEQ
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).FirstOrDefault());
|
|
|
fsda_3.KEY = fsda_1.SLAB_NO + INS_DATE + INS_TIME + "_" + item_1.SLAB_CUT_SEQ + "" + item_2.BLOCK_SEQ + "_00";// + fsda_1.SLAB_CUT_SEQ;
|
|
|
fsda_3.CNT = ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME
|
|
|
&& p.BLOCK_SEQ == item_2.BLOCK_SEQ
|
|
|
&& p.SEQ != "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).Count();
|
|
|
|
|
|
fsda_2.children.Add(fsda_3);
|
|
|
fsda_3.children = new List<FP_SLAB_DES_ALL>();
|
|
|
//四层
|
|
|
foreach (FP_SLAB_DES item_3 in ltFSD.Where(p => p.SLAB_NO == SLAB_NO && p.INS_DATE == INS_DATE && p.INS_TIME == INS_TIME && p.BLOCK_SEQ == item_2.BLOCK_SEQ && p.SEQ != "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).OrderBy(p => p.SEQ).ToList())
|
|
|
{
|
|
|
FP_SLAB_DES_ALL fsda_4 = new FP_SLAB_DES_ALL();
|
|
|
fsda_4 = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(item_3);
|
|
|
fsda_4.KEY = fsda_1.SLAB_NO + INS_DATE + INS_TIME + "_" + item_1.SLAB_CUT_SEQ + "" + item_2.BLOCK_SEQ + "_" + item_3.SEQ;// + fsda_1.SLAB_CUT_SEQ;
|
|
|
fsda_3.children.Add(fsda_4);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
result.data = ltFSD_ALL;
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.data = ltFSD;
|
|
|
result.msg = "未找到查询所需数据!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetSlabSub 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 确认替代 STATE = Y 或拒绝替代 STATE = N 按钮
|
|
|
/// </summary>·
|
|
|
/// <param name="delModel">传ID的值</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("SendSlab")]
|
|
|
public RequestEntity SendSlab(IList<TB_SLAB_DES_Args> listdelAddModel)
|
|
|
{
|
|
|
lock (LOCK)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
List<FP_SLAB_DES> Deslist = new List<FP_SLAB_DES>();
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
|
|
|
//因为是同时操作两个表, 所以开启事务
|
|
|
db.BeginTransaction();
|
|
|
bool b = true;
|
|
|
if (listdelAddModel[0].STATE == "Y")
|
|
|
{
|
|
|
foreach (TB_SLAB_DES_Args delAddModel in listdelAddModel)
|
|
|
{
|
|
|
if (delAddModel.BLOCK_SEQ != "00")
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
string strSql = string.Format("UPDATE FP_SLAB_DES SET HAN_DATE='{0}',HAN_RSL='{1}' WHERE SLAB_NO = '{2}'"
|
|
|
, DateTime.Now.ToString(), "N", delAddModel.SLAB_NO);
|
|
|
|
|
|
string strSql2 = string.Format("SELECT * FROM FP_SLAB_DES WHERE SLAB_NO = {0}", delAddModel.SLAB_NO);
|
|
|
|
|
|
Deslist = db.Query<FP_SLAB_DES>(strSql2).ToList();
|
|
|
|
|
|
DateTime date = DateTime.Now;
|
|
|
foreach (FP_SLAB_DES item in Deslist)
|
|
|
{
|
|
|
FP_SLAB_DES_HIS fP_SLAB_DES_HIS = new FP_SLAB_DES_HIS();
|
|
|
fP_SLAB_DES_HIS.SUB_TIME = date.ToString();
|
|
|
fP_SLAB_DES_HIS = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_HIS>(item);
|
|
|
db.Insert<FP_SLAB_DES_HIS>(fP_SLAB_DES_HIS);
|
|
|
}
|
|
|
FP_SLAB_DES supData = new FP_SLAB_DES();
|
|
|
|
|
|
string strSqlSup = "SELECT * FROM FP_SLAB_DES WHERE ID ='" + delAddModel.ID + "'";
|
|
|
|
|
|
//获取替代信息
|
|
|
supData = db.QuerySingle<FP_SLAB_DES>(strSqlSup);
|
|
|
|
|
|
//PDO
|
|
|
TBDIPDO InsertPDO = GetTBDIBKDPDO(supData);
|
|
|
|
|
|
db.Insert<TBDIPDO>(InsertPDO);
|
|
|
db.Execute(strSql);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
foreach (TB_SLAB_DES_Args delAddModel in listdelAddModel)
|
|
|
{
|
|
|
if (delAddModel.BLOCK_SEQ != "00")
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
string strSql = string.Format("DELETE FP_SLAB_DES WHERE SLAB_NO = '{0}'"
|
|
|
, delAddModel.SLAB_NO);
|
|
|
|
|
|
//FP_SLAB_DES supData = new FP_SLAB_DES();
|
|
|
|
|
|
//string strSqlSup = "SELECT * FROM FP_SLAB_DES WHERE ID ='" + delAddModel.ID + "'";
|
|
|
|
|
|
////获取替代信息
|
|
|
//supData = db.QuerySingle<FP_SLAB_DES>(strSqlSup);
|
|
|
|
|
|
////PDO
|
|
|
//TBDIPDO InsertPDO = GetTBDIBKDPDO(supData);
|
|
|
|
|
|
//db.Insert<TBDIPDO>(InsertPDO);
|
|
|
db.Execute(strSql);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
//数据如果发生错误则回滚
|
|
|
db.Rollback();
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("DelSupAddSupersedeConfiram 报错", ex);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 手动余坯替代
|
|
|
/// </summary>
|
|
|
/// <param name="queryArgs"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("ManualSlabC1")]
|
|
|
public RequestEntity ManualSlabC1(TB_SLAB_DES_Args queryArgs)
|
|
|
{
|
|
|
lock (LOCK)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
//开启数据库连接查询数据
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//string args = ArgsSupersede.PLATE_NO;
|
|
|
|
|
|
Process KHMsg = new Process();
|
|
|
KHMsg.StartInfo.FileName = @"D:\Program\SlabSub\SlabHandle.exe";
|
|
|
KHMsg.StartInfo.Arguments = queryArgs.PLT;
|
|
|
//KHMsg.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;//隐藏
|
|
|
KHMsg.Start();
|
|
|
|
|
|
while (!KHMsg.HasExited) { } //如果exe还没关闭,则等待
|
|
|
if (KHMsg.ExitCode == 1)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddSingleSup 报错", ex);
|
|
|
}
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
[HttpPost, Route("GetHisDataTol")]
|
|
|
public RequestEntity GetHisDataTol(GpPlateQueryArgs QAGP)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (QAGP.START_TIME == DateTime.MinValue && QAGP.END_TIME == DateTime.MinValue)
|
|
|
{
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
QAGP.END_TIME = DateTime.Now;
|
|
|
}
|
|
|
//获取历史数据
|
|
|
result.data = SlabSubstitutionService.GetHisDataTol(QAGP);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetOrder 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
[HttpPost, Route("GetHisDataRate")]
|
|
|
public RequestEntity GetHisDataRate(GpPlateQueryArgs QAGP)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (QAGP.START_TIME == DateTime.MinValue && QAGP.END_TIME == DateTime.MinValue)
|
|
|
{
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
QAGP.END_TIME = DateTime.Now;
|
|
|
}
|
|
|
//获取历史数据
|
|
|
result.data = SlabSubstitutionService.GetHisDataRate(QAGP);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetHisDataRate 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
[HttpPost, Route("GetHisWGT")]
|
|
|
public RequestEntity GetHisWGT(GpPlateQueryArgs QAGP)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (QAGP.START_TIME == DateTime.MinValue && QAGP.END_TIME == DateTime.MinValue)
|
|
|
{
|
|
|
//QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
//20240321 刘桂英转领导通知 替代时间改为一个月,时间应为上个月26号至当月25号
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-30);
|
|
|
QAGP.END_TIME = DateTime.Now;
|
|
|
}
|
|
|
//获取历史数据
|
|
|
result.data = SlabSubstitutionService.GetHisWGT(QAGP);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetHisDataRate 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
[HttpPost, Route("GetHisRate")]
|
|
|
public RequestEntity GetHisRate(GpPlateQueryArgs QAGP)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (QAGP.START_TIME == DateTime.MinValue && QAGP.END_TIME == DateTime.MinValue)
|
|
|
{
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
//20240321 刘桂英转领导通知 替代时间改为一个月,时间应为上个月26号至当月25号
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-30);
|
|
|
QAGP.END_TIME = DateTime.Now;
|
|
|
}
|
|
|
//获取历史数据
|
|
|
result.data = SlabSubstitutionService.GetHisRate(QAGP);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetHisDataRate 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
[HttpPost, Route("GetPeriodOftime")]
|
|
|
public RequestEntity GetPeriodOftime(TB_PROCESS_DATA data)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (data.TYPE == "实时")
|
|
|
data.TYPE = "0";
|
|
|
if (data.TYPE == "批量")
|
|
|
data.TYPE = "1";
|
|
|
//获取替代信息
|
|
|
if (data.START_TIME == null && data.END_TIME == null)
|
|
|
{
|
|
|
data.START_TIME = DateTime.Now.AddDays(-7).ToString("yyyyMMdd");
|
|
|
data.END_TIME = DateTime.Now.ToString("yyyyMMdd");
|
|
|
}
|
|
|
DataTable dt = SlabSubstitutionService.GetPeriodOftime(data);
|
|
|
ArrayList al = new ArrayList();
|
|
|
if (dt != null)
|
|
|
{
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
foreach (DataRow row in dt.Rows)
|
|
|
{
|
|
|
string[] e = new string[2];
|
|
|
e[0] = row[1].ToString();
|
|
|
e[1] = row[3].ToString();
|
|
|
al.Add(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
result.data = al;
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetOrder 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
[HttpPost, Route("GetPlateTotal")]
|
|
|
public RequestEntity GetPlateTotal(GpPlateQueryArgs QAGP)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
//if (QAGP.START_TIME == DateTime.MinValue && QAGP.END_TIME == DateTime.MinValue)
|
|
|
//{
|
|
|
// QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
// QAGP.END_TIME = DateTime.Now;
|
|
|
//}
|
|
|
//获取替代信息
|
|
|
result.data = SlabSubstitutionService.GetPlateTotal(QAGP);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetOrder 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
[HttpPost, Route("GetOrderTotal")]
|
|
|
public RequestEntity GetOrderTotal(GpPlateQueryArgs QAGP)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (QAGP.START_TIME == DateTime.MinValue && QAGP.END_TIME == DateTime.MinValue)
|
|
|
{
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
QAGP.END_TIME = DateTime.Now;
|
|
|
}
|
|
|
//获取替代信息
|
|
|
result.data = SlabSubstitutionService.GetOrderTotal(QAGP);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetOrder 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
[HttpPost, Route("GetStockDate")]
|
|
|
public RequestEntity GetStockDate(GpPlateQueryArgs QAGP)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (QAGP.START_TIME == DateTime.MinValue && QAGP.END_TIME == DateTime.MinValue)
|
|
|
{
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
//20240321 刘桂英转领导通知 替代时间改为一个月,时间应为上个月26号至当月25号
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-30);
|
|
|
QAGP.END_TIME = DateTime.Now;
|
|
|
}
|
|
|
//获取替代信息
|
|
|
result.data = SlabSubstitutionService.GetStockDate(QAGP);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetOrder 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
[HttpPost, Route("GetSlabWGT")]
|
|
|
public RequestEntity GetSlabWGT()
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
//获取历史数据
|
|
|
result.data = SlabSubstitutionService.GetSlabWgt();
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetHisDataRate 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
[HttpPost, Route("GetSlabCcl")]
|
|
|
public RequestEntity GetSlabCcl()
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
//获取历史数据
|
|
|
result.data = SlabSubstitutionService.GetSlabCcl();
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetHisDataRate 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
[HttpPost, Route("GetSlabWgtSum")]
|
|
|
public RequestEntity GetSlabWgtSum()
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
//获取历史数据
|
|
|
result.data = SlabSubstitutionService.GetSlabWgtSum();
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetHisDataRate 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
[HttpPost, Route("GetSlabStock")]
|
|
|
public RequestEntity GetSlabStock()
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
//获取历史数据
|
|
|
result.data = SlabSubstitutionService.GetSlabStock();
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetHisDataRate 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
[HttpPost, Route("GetSlabOftime")]
|
|
|
public RequestEntity GetSlabOftime(TB_PROCESS_DATA data)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (data.TYPE == "实时")
|
|
|
data.TYPE = "0";
|
|
|
if (data.TYPE == "批量")
|
|
|
data.TYPE = "1";
|
|
|
//获取替代信息
|
|
|
if (data.START_TIME == null && data.END_TIME == null)
|
|
|
{
|
|
|
data.START_TIME = DateTime.Now.AddDays(-7).ToString("yyyyMMdd");
|
|
|
data.END_TIME = DateTime.Now.ToString("yyyyMMdd");
|
|
|
}
|
|
|
DataTable dt = SlabSubstitutionService.GetSlabOftime(data);
|
|
|
ArrayList al = new ArrayList();
|
|
|
if (dt != null)
|
|
|
{
|
|
|
if (dt.Rows.Count > 0)
|
|
|
{
|
|
|
foreach (DataRow row in dt.Rows)
|
|
|
{
|
|
|
Random rd = new Random();
|
|
|
string[] e = new string[2];
|
|
|
e[0] = row[1].ToString();
|
|
|
e[1] = (row[3].ToInt() + rd.Next(-2, 2)).ToString();
|
|
|
al.Add(e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
result.data = al;
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetOrder 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 板坯手动匹配
|
|
|
//[HttpPost, Route("getTbSlabInfo")]
|
|
|
//public RequestEntity getTbSlabInfo(TB_SLAB_QUERY tB_SLAB)
|
|
|
//{
|
|
|
// RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
// StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
// DataTable dtCheck = new DataTable();
|
|
|
|
|
|
// try
|
|
|
// {
|
|
|
// //开启数据库连接查询数据
|
|
|
// //using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
// //{
|
|
|
// result.data = GetSlabInfo(tB_SLAB);
|
|
|
// result.msg = "操作成功!";
|
|
|
// result.code = "1";
|
|
|
// //}
|
|
|
// }
|
|
|
// catch (Exception ex)
|
|
|
// {
|
|
|
// result.msg = "数据库错误!";
|
|
|
// result.code = "0";
|
|
|
// logger.Error("GetSurplusMaterials 报错 : ", ex);
|
|
|
// }
|
|
|
|
|
|
// return result;
|
|
|
//}
|
|
|
//public IList<TB_SLAB> GetSlabInfo(TB_SLAB_QUERY tB_SLAB)
|
|
|
//{
|
|
|
// IList<TB_SLAB> ltSlab = new List<TB_SLAB>();
|
|
|
|
|
|
|
|
|
// StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
// IList<TB_SLAB> ltSlabC3 = new List<TB_SLAB>();
|
|
|
// strSqlC3.AppendLine("SELECT SLAB_NO ,(SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STEEL_GRD_DETAIL" +
|
|
|
// ", OCCR_CD, PLT, PRC_LINE, REC_STS, PROC_CD" +
|
|
|
// ", BEF_PROC_CD, PROD_CD, (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STLGRD" +
|
|
|
// ", THK" +
|
|
|
// ", CASE WHEN A.WID>A.LEN THEN A.LEN ELSE A.WID END WID " +
|
|
|
// ", CASE WHEN A.WID<A.LEN THEN A.LEN ELSE A.WID END LEN " +
|
|
|
// ", WGT, CAL_WGT" +
|
|
|
// ", THK_GRP, WID_GRP, OVER_FL, ORD_FL" +
|
|
|
// ", WOO_RSN, ORD_NO, ORD_ITEM, ORG_ORD_NO" +
|
|
|
// ", ORG_ORD_ITEM, ENDUSE_CD, DEL_TO_DATE, PROD_DATE" +
|
|
|
// ", PROD_TIME, SHIFT, GROUP_CD, LOC, BED_PILE_DATE" +
|
|
|
// ", SMP_FL, SMP_LOC, SMP_LEN, SMP_NO, INSP_EMP, DSC_DATE" +
|
|
|
// ", DSC_TIME, PROD_GRD, SURF_GRD, QUALITY_GRD, QUALITY_UPD_GRD" +
|
|
|
// ", APLY_STDSPEC, APLY_ENDUSE_CD, IN_PLT_CD, IN_PLT, IN_PLT_DATE" +
|
|
|
// ", IN_PLT_TIME, IN_CAR_NO, IN_SHEET_NO, IN_PLT_CO, OUT_PLT_CD" +
|
|
|
// ", OUT_PLT, OUT_PLT_DATE, OUT_PLT_TIME, OUT_CAR_NO, OUT_SHEET_NO" +
|
|
|
// ", HOUSING_DATE, HOUSING_TIME, SHP_IST_NO, SHP_IST_DATE, SHP_IST_TIME" +
|
|
|
// ", SHP_DATE, SHP_TIME, TRNS_NO, CAR_NO, TRNS_CMPY_CD, SHP_EMP, TRAIN_LINE_NAME" +
|
|
|
// ", DEST_DETAIL, CERT_RPT_FL, CERT_RPT_DATE, CERT_RPT_TIME, SHP_IST_CAN_DATE" +
|
|
|
// ", SHP_IST_CAN_TIME, SHP_IST_CAN_FL, INS_DATE, INS_EMP_CD, INS_PGMID, UPD_DATE" +
|
|
|
// ", UPD_EMP_CD, UPD_PGM, SF_ORNOT, SLAB_RHF_IN_DATE, RHF_REJ_ORNOT, AIM_HCR_KND" +
|
|
|
// ", HCR_KND, PRC, SCR_ORNOT, END_RES, MOTHER_SLAB, ORD_THK, ORD_WID, ORD_LEN" +
|
|
|
// ", ORD_WGT, QUALITY_ID, TAPER_LEN, HEAD_SLAB_WID, TAIL_SLAB_WID, CUST_CD" +
|
|
|
// ", IN_SLAB_NO, CUR_HCR_KND, WGT_L2, QUALITY_ID_L2, CUR_INV, SIZE_KND, MIXED_FL" +
|
|
|
// ", BAOXIN_IF_DATE, CUST_SPEC_NO, STLGRD_UPD_FL, BEF_STLGRD, WGT_CAL_L2, LOAD_WGT" +
|
|
|
// ", CHG_GRD_RES, MAT_OWNER_FL, MAT_OWNER_CUST_CD, PLAN_MILL_PLT, USE_MILL_PLT, PLAN_SLAB_CUT_CNT" +
|
|
|
// ", CLAIM_RES, CLAIM_DATE, CLAIM_THK, CLAIM_WID, CLAIM_LEN, CLAIM_WGT, HTM_ORD_METH, HTM_RLT_METH" +
|
|
|
// ", HTM_STATUS, SLAB_BACK_CNT, CUT_CNT, HTM_CNT, ERP_IF_DATE, PLAN_SLAB_CUT_FL, INGOT_FL, HEAD_SLAB_THK" +
|
|
|
// ", TAIL_SLAB_THK, PLAN_SLAB_MERGE_FL, MOTHER_SLAB_MERGE, GRID_FL, GRID_RSLT, HEAT_NO, RH_CD" +
|
|
|
// ", CAL_TM, CAL_TN, ACT_SMP_FL, SMP_NO1, SMP_NO2, GET_SMP_DATE, SMP_CAST_NO, SMP_FREQENCY" +
|
|
|
// ", SMP_NOTE, SMP_NOTE1, SMP_NOTE2, SLAB_NO1, SLAB_NO2, UST_RLT_CD, UST_RSLT, UST_METH" +
|
|
|
// ", CUT_AM, CUT_BM, CUT_CM, CUT_DM, CUT_EM, CUT_FM, MOTHER_SLAB_BILLET, BILLET_TYPE" +
|
|
|
// ", MOTHER_SLAB_ELEC, RES_CM, RES_DM, RES_EM, RES_FM, RES_GM" +
|
|
|
// ", CASE WHEN A.WID<A.LEN THEN A.LEN ELSE A.WID END REM_LEN " +
|
|
|
// ", A.WGT REM_WGT " +
|
|
|
// ", A.LEN ORG_LEN " +
|
|
|
// ", A.WID ORG_WID" +
|
|
|
// ", CASE WHEN (SELECT COUNT(HEAT_NO) FROM NISCO.FP_RHRSLT WHERE HEAT_NO = SUBSTR(A.SLAB_NO,1,8))>0 THEN '1' ELSE '0' END VAC_FLG ");
|
|
|
// strSqlC3.AppendLine(",(CASE WHEN(SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET CSDD WHERE (CSDD.EST_CD LIKE '5%' OR CSDD.EST_CD LIKE '6%') AND CSDD.SLAB_NO = A.SLAB_NO) > 0 THEN '1'");
|
|
|
// strSqlC3.AppendLine(" WHEN(SELECT COUNT(*) FROM(SELECT COM FROM(SELECT CSDD_C.EST_CD || '_' || CSDD_C.EST_COMMENT COM FROM NISCO.CP_SLAB_DELI_DET CSDD_C ");
|
|
|
// strSqlC3.AppendLine(" WHERE CSDD_C.SLAB_NO = A.SLAB_NO ORDER BY CSDD_C.EST_DATE DESC) T_COM WHERE ROWNUM = 1) T_L WHERE T_L.COM LIKE '%协议%') > 0 THEN '1' ");
|
|
|
// strSqlC3.AppendLine(" ELSE '0' END ) XY_FLG ");
|
|
|
// strSqlC3.AppendLine(",(SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
// strSqlC3.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
// strSqlC3.AppendLine(" WHERE SLAB_NO = A.SLAB_NO ");
|
|
|
// strSqlC3.AppendLine(" AND EST_CD IS NOT NULL) || ' ' || ");
|
|
|
// strSqlC3.AppendLine(" (CASE WHEN A.MOTHER_SLAB IS NOT NULL AND LENGTH(A.MOTHER_SLAB) = 10 THEN ");
|
|
|
// strSqlC3.AppendLine(" (SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
// strSqlC3.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
// strSqlC3.AppendLine(" WHERE SLAB_NO = A.MOTHER_SLAB ");
|
|
|
// strSqlC3.AppendLine(" AND EST_CD IS NOT NULL) ");
|
|
|
// strSqlC3.AppendLine(" ELSE '' ");
|
|
|
// strSqlC3.AppendLine(" END ) EST_COMMENT ");
|
|
|
// strSqlC3.AppendLine("FROM NISCO.FP_SLAB A ");
|
|
|
// strSqlC3.AppendLine("WHERE 1 = 1 ");
|
|
|
// strSqlC3.AppendLine(" AND A.CUR_INV IN( 'ZB','00','ZZ','HB') ");//
|
|
|
// strSqlC3.AppendLine(" AND( (A.PROC_CD = 'CAC' AND (SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0002','0003','2010') ) = 0) OR ");
|
|
|
// strSqlC3.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C " +
|
|
|
// "WHERE C.SLAB_NO = A.SLAB_NO " +
|
|
|
// "AND C.REASON_CD IN ('1080','2014','2015','2018','2026','3014','5011','5013','8081') " +
|
|
|
// "AND EST_CD IS NULL) >0) ");
|
|
|
// strSqlC3.AppendLine(" AND A.PROC_CD = 'CAD' ) ");
|
|
|
// strSqlC3.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('2010','0002')) < 1 ) ");
|
|
|
// strSqlC3.AppendLine(" AND A.ORD_FL = '2' ");
|
|
|
// strSqlC3.AppendLine(" AND A.REC_STS = '2' ");
|
|
|
// strSqlC3.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
// strSqlC3.AppendLine(" AND A.WGT > 0 ");
|
|
|
// strSqlC3.AppendLine(" AND NVL(A.PLAN_SLAB_CUT_FL,'N') = 'N' ");
|
|
|
// strSqlC3.AppendLine(" AND SUBSTR(A.SLAB_NO,3,1) <> 'F' ");
|
|
|
// strSqlC3.AppendLine(" AND NVL(A.QUALITY_UPD_GRD, 'N') NOT IN('N','E') ");
|
|
|
// strSqlC3.AppendLine(" AND NVL(A.PLAN_MILL_PLT , ' ') LIKE 'C3' || '%' ");
|
|
|
// strSqlC3.AppendLine(" AND((GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 800 AND A.THK > 50) ");
|
|
|
// strSqlC3.AppendLine(" OR(GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 850 AND A.THK = 50))---短尺 ");
|
|
|
// strSqlC3.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO) < 1 )");
|
|
|
// strSqlC3.AppendLine(" AND A.WGT <31");
|
|
|
|
|
|
// //c2
|
|
|
|
|
|
// StringBuilder strSqlC2 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
// IList<TB_SLAB> ltSlabC2 = new List<TB_SLAB>();
|
|
|
// strSqlC2.AppendLine("SELECT SLAB_NO ,(SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STEEL_GRD_DETAIL" +
|
|
|
// ", OCCR_CD, PLT, PRC_LINE, REC_STS, PROC_CD" +
|
|
|
// ", BEF_PROC_CD, PROD_CD, (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STLGRD" +
|
|
|
// ", THK" +
|
|
|
// ", CASE WHEN A.WID>A.LEN THEN A.LEN ELSE A.WID END WID " +
|
|
|
// ", CASE WHEN A.WID<A.LEN THEN A.LEN ELSE A.WID END LEN " +
|
|
|
// ", WGT, CAL_WGT" +
|
|
|
// ", THK_GRP, WID_GRP, OVER_FL, ORD_FL" +
|
|
|
// ", WOO_RSN, ORD_NO, ORD_ITEM, ORG_ORD_NO" +
|
|
|
// ", ORG_ORD_ITEM, ENDUSE_CD, DEL_TO_DATE, PROD_DATE" +
|
|
|
// ", PROD_TIME, SHIFT, GROUP_CD, LOC, BED_PILE_DATE" +
|
|
|
// ", SMP_FL, SMP_LOC, SMP_LEN, SMP_NO, INSP_EMP, DSC_DATE" +
|
|
|
// ", DSC_TIME, PROD_GRD, SURF_GRD, QUALITY_GRD, QUALITY_UPD_GRD" +
|
|
|
// ", APLY_STDSPEC, APLY_ENDUSE_CD, IN_PLT_CD, IN_PLT, IN_PLT_DATE" +
|
|
|
// ", IN_PLT_TIME, IN_CAR_NO, IN_SHEET_NO, IN_PLT_CO, OUT_PLT_CD" +
|
|
|
// ", OUT_PLT, OUT_PLT_DATE, OUT_PLT_TIME, OUT_CAR_NO, OUT_SHEET_NO" +
|
|
|
// ", HOUSING_DATE, HOUSING_TIME, SHP_IST_NO, SHP_IST_DATE, SHP_IST_TIME" +
|
|
|
// ", SHP_DATE, SHP_TIME, TRNS_NO, CAR_NO, TRNS_CMPY_CD, SHP_EMP, TRAIN_LINE_NAME" +
|
|
|
// ", DEST_DETAIL, CERT_RPT_FL, CERT_RPT_DATE, CERT_RPT_TIME, SHP_IST_CAN_DATE" +
|
|
|
// ", SHP_IST_CAN_TIME, SHP_IST_CAN_FL, INS_DATE, INS_EMP_CD, INS_PGMID, UPD_DATE" +
|
|
|
// ", UPD_EMP_CD, UPD_PGM, SF_ORNOT, SLAB_RHF_IN_DATE, RHF_REJ_ORNOT, AIM_HCR_KND" +
|
|
|
// ", HCR_KND, PRC, SCR_ORNOT, END_RES, MOTHER_SLAB, ORD_THK, ORD_WID, ORD_LEN" +
|
|
|
// ", ORD_WGT, QUALITY_ID, TAPER_LEN, HEAD_SLAB_WID, TAIL_SLAB_WID, CUST_CD" +
|
|
|
// ", IN_SLAB_NO, CUR_HCR_KND, WGT_L2, QUALITY_ID_L2, CUR_INV, SIZE_KND, MIXED_FL" +
|
|
|
// ", BAOXIN_IF_DATE, CUST_SPEC_NO, STLGRD_UPD_FL, BEF_STLGRD, WGT_CAL_L2, LOAD_WGT" +
|
|
|
// ", CHG_GRD_RES, MAT_OWNER_FL, MAT_OWNER_CUST_CD, PLAN_MILL_PLT, USE_MILL_PLT, PLAN_SLAB_CUT_CNT" +
|
|
|
// ", CLAIM_RES, CLAIM_DATE, CLAIM_THK, CLAIM_WID, CLAIM_LEN, CLAIM_WGT, HTM_ORD_METH, HTM_RLT_METH" +
|
|
|
// ", HTM_STATUS, SLAB_BACK_CNT, CUT_CNT, HTM_CNT, ERP_IF_DATE, PLAN_SLAB_CUT_FL, INGOT_FL, HEAD_SLAB_THK" +
|
|
|
// ", TAIL_SLAB_THK, PLAN_SLAB_MERGE_FL, MOTHER_SLAB_MERGE, GRID_FL, GRID_RSLT, HEAT_NO, RH_CD" +
|
|
|
// ", CAL_TM, CAL_TN, ACT_SMP_FL, SMP_NO1, SMP_NO2, GET_SMP_DATE, SMP_CAST_NO, SMP_FREQENCY" +
|
|
|
// ", SMP_NOTE, SMP_NOTE1, SMP_NOTE2, SLAB_NO1, SLAB_NO2, UST_RLT_CD, UST_RSLT, UST_METH" +
|
|
|
// ", CUT_AM, CUT_BM, CUT_CM, CUT_DM, CUT_EM, CUT_FM, MOTHER_SLAB_BILLET, BILLET_TYPE" +
|
|
|
// ", MOTHER_SLAB_ELEC, RES_CM, RES_DM, RES_EM, RES_FM, RES_GM" +
|
|
|
// ", CASE WHEN A.WID<A.LEN THEN A.LEN ELSE A.WID END REM_LEN " +
|
|
|
// ", A.WGT REM_WGT " +
|
|
|
// ", A.LEN ORG_LEN " +
|
|
|
// ", A.WID ORG_WID" +
|
|
|
// ", CASE WHEN (SELECT COUNT(HEAT_NO) FROM NISCO.FP_RHRSLT WHERE HEAT_NO = SUBSTR(A.SLAB_NO,1,8))>0 THEN '1' ELSE '0' END VAC_FLG ");
|
|
|
// strSqlC2.AppendLine(",(CASE WHEN(SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET CSDD WHERE (CSDD.EST_CD LIKE '5%' OR CSDD.EST_CD LIKE '6%') AND CSDD.SLAB_NO = A.SLAB_NO) > 0 THEN '1'");
|
|
|
// strSqlC2.AppendLine(" WHEN(SELECT COUNT(*) FROM(SELECT COM FROM(SELECT CSDD_C.EST_CD || '_' || CSDD_C.EST_COMMENT COM FROM NISCO.CP_SLAB_DELI_DET CSDD_C ");
|
|
|
// strSqlC2.AppendLine(" WHERE CSDD_C.SLAB_NO = A.SLAB_NO ORDER BY CSDD_C.EST_DATE DESC) T_COM WHERE ROWNUM = 1) T_L WHERE T_L.COM LIKE '%协议%') > 0 THEN '1' ");
|
|
|
// strSqlC2.AppendLine(" ELSE '0' END ) XY_FLG ");
|
|
|
// strSqlC2.AppendLine(",(SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
// strSqlC2.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
// strSqlC2.AppendLine(" WHERE SLAB_NO = A.SLAB_NO ");
|
|
|
// strSqlC2.AppendLine(" AND EST_CD IS NOT NULL) || ' ' || ");
|
|
|
// strSqlC2.AppendLine(" (CASE WHEN A.MOTHER_SLAB IS NOT NULL AND LENGTH(A.MOTHER_SLAB) = 10 THEN ");
|
|
|
// strSqlC2.AppendLine(" (SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
// strSqlC2.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
// strSqlC2.AppendLine(" WHERE SLAB_NO = A.MOTHER_SLAB ");
|
|
|
// strSqlC2.AppendLine(" AND EST_CD IS NOT NULL) ");
|
|
|
// strSqlC2.AppendLine(" ELSE '' ");
|
|
|
// strSqlC2.AppendLine(" END ) EST_COMMENT ");
|
|
|
// strSqlC2.AppendLine("FROM NISCO.FP_SLAB A ");
|
|
|
// strSqlC2.AppendLine("WHERE 1 = 1 ");
|
|
|
// strSqlC2.AppendLine(" AND A.CUR_INV in ( 'ZB','00','ZZ','HB') ");
|
|
|
// strSqlC2.AppendLine(" AND(A.PROC_CD = 'CAC' OR ");
|
|
|
// strSqlC2.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.REASON_CD NOT IN('1080','2014','2015','2018','2026','3014','5011','5013','8081') AND EST_CD IS NULL) < 1)");
|
|
|
// strSqlC2.AppendLine(" AND A.PROC_CD='CAD' ) ");
|
|
|
// strSqlC2.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0002','0003','2010')) < 1 )");
|
|
|
// strSqlC2.AppendLine(" AND A.ORD_FL = '2' ");
|
|
|
// strSqlC2.AppendLine(" AND A.REC_STS = '2' ");
|
|
|
// strSqlC2.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
// strSqlC2.AppendLine(" AND A.WGT > 0 ");
|
|
|
// strSqlC2.AppendLine(" AND NVL(A.PLAN_SLAB_CUT_FL,'N') = 'N' ");
|
|
|
// strSqlC2.AppendLine(" AND NVL(A.QUALITY_UPD_GRD, 'N') NOT IN('N','E') ");
|
|
|
// strSqlC2.AppendLine(" AND LEAST(A.WID, A.LEN) >= 1600 ");
|
|
|
// strSqlC2.AppendLine(" AND GREATEST(A.WID, A.LEN) >= 2500 ");
|
|
|
// strSqlC2.AppendLine(" AND A.THK >= 120 ");
|
|
|
// strSqlC2.AppendLine(" AND NVL(A.PLAN_SLAB_MERGE_FL,'N') = 'N' ");
|
|
|
// strSqlC2.AppendLine(" AND NVL(A.PLAN_MILL_PLT,'N') LIKE 'C2' || '%' ");
|
|
|
// strSqlC2.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO) < 1 )");
|
|
|
|
|
|
// //c1
|
|
|
|
|
|
// StringBuilder strSqlC1 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
// IList<TB_SLAB> ltSlabC1 = new List<TB_SLAB>();
|
|
|
// strSqlC1.AppendLine("SELECT SLAB_NO ,(SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STEEL_GRD_DETAIL" +
|
|
|
// ", OCCR_CD, PLT, PRC_LINE, REC_STS, PROC_CD" +
|
|
|
// ", BEF_PROC_CD, PROD_CD, (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STLGRD" +
|
|
|
// ", THK" +
|
|
|
// ", CASE WHEN A.WID>A.LEN THEN A.LEN ELSE A.WID END WID " +
|
|
|
// ", CASE WHEN A.WID<A.LEN THEN A.LEN ELSE A.WID END LEN " +
|
|
|
// ", WGT, CAL_WGT" +
|
|
|
// ", THK_GRP, WID_GRP, OVER_FL, ORD_FL" +
|
|
|
// ", WOO_RSN, ORD_NO, ORD_ITEM, ORG_ORD_NO" +
|
|
|
// ", ORG_ORD_ITEM, ENDUSE_CD, DEL_TO_DATE, PROD_DATE" +
|
|
|
// ", PROD_TIME, SHIFT, GROUP_CD, LOC, BED_PILE_DATE" +
|
|
|
// ", SMP_FL, SMP_LOC, SMP_LEN, SMP_NO, INSP_EMP, DSC_DATE" +
|
|
|
// ", DSC_TIME, PROD_GRD, SURF_GRD, QUALITY_GRD, QUALITY_UPD_GRD" +
|
|
|
// ", APLY_STDSPEC, APLY_ENDUSE_CD, IN_PLT_CD, IN_PLT, IN_PLT_DATE" +
|
|
|
// ", IN_PLT_TIME, IN_CAR_NO, IN_SHEET_NO, IN_PLT_CO, OUT_PLT_CD" +
|
|
|
// ", OUT_PLT, OUT_PLT_DATE, OUT_PLT_TIME, OUT_CAR_NO, OUT_SHEET_NO" +
|
|
|
// ", HOUSING_DATE, HOUSING_TIME, SHP_IST_NO, SHP_IST_DATE, SHP_IST_TIME" +
|
|
|
// ", SHP_DATE, SHP_TIME, TRNS_NO, CAR_NO, TRNS_CMPY_CD, SHP_EMP, TRAIN_LINE_NAME" +
|
|
|
// ", DEST_DETAIL, CERT_RPT_FL, CERT_RPT_DATE, CERT_RPT_TIME, SHP_IST_CAN_DATE" +
|
|
|
// ", SHP_IST_CAN_TIME, SHP_IST_CAN_FL, INS_DATE, INS_EMP_CD, INS_PGMID, UPD_DATE" +
|
|
|
// ", UPD_EMP_CD, UPD_PGM, SF_ORNOT, SLAB_RHF_IN_DATE, RHF_REJ_ORNOT, AIM_HCR_KND" +
|
|
|
// ", HCR_KND, PRC, SCR_ORNOT, END_RES, MOTHER_SLAB, ORD_THK, ORD_WID, ORD_LEN" +
|
|
|
// ", ORD_WGT, QUALITY_ID, TAPER_LEN, HEAD_SLAB_WID, TAIL_SLAB_WID, CUST_CD" +
|
|
|
// ", IN_SLAB_NO, CUR_HCR_KND, WGT_L2, QUALITY_ID_L2, CUR_INV, SIZE_KND, MIXED_FL" +
|
|
|
// ", BAOXIN_IF_DATE, CUST_SPEC_NO, STLGRD_UPD_FL, BEF_STLGRD, WGT_CAL_L2, LOAD_WGT" +
|
|
|
// ", CHG_GRD_RES, MAT_OWNER_FL, MAT_OWNER_CUST_CD, PLAN_MILL_PLT, USE_MILL_PLT, PLAN_SLAB_CUT_CNT" +
|
|
|
// ", CLAIM_RES, CLAIM_DATE, CLAIM_THK, CLAIM_WID, CLAIM_LEN, CLAIM_WGT, HTM_ORD_METH, HTM_RLT_METH" +
|
|
|
// ", HTM_STATUS, SLAB_BACK_CNT, CUT_CNT, HTM_CNT, ERP_IF_DATE, PLAN_SLAB_CUT_FL, INGOT_FL, HEAD_SLAB_THK" +
|
|
|
// ", TAIL_SLAB_THK, PLAN_SLAB_MERGE_FL, MOTHER_SLAB_MERGE, GRID_FL, GRID_RSLT, HEAT_NO, RH_CD" +
|
|
|
// ", CAL_TM, CAL_TN, ACT_SMP_FL, SMP_NO1, SMP_NO2, GET_SMP_DATE, SMP_CAST_NO, SMP_FREQENCY" +
|
|
|
// ", SMP_NOTE, SMP_NOTE1, SMP_NOTE2, SLAB_NO1, SLAB_NO2, UST_RLT_CD, UST_RSLT, UST_METH" +
|
|
|
// ", CUT_AM, CUT_BM, CUT_CM, CUT_DM, CUT_EM, CUT_FM, MOTHER_SLAB_BILLET, BILLET_TYPE" +
|
|
|
// ", MOTHER_SLAB_ELEC, RES_CM, RES_DM, RES_EM, RES_FM, RES_GM" +
|
|
|
// ", CASE WHEN A.WID<A.LEN THEN A.LEN ELSE A.WID END REM_LEN " +
|
|
|
// ", A.WGT REM_WGT " +
|
|
|
// ", A.LEN ORG_LEN " +
|
|
|
// ", A.WID ORG_WID" +
|
|
|
// ", CASE WHEN (SELECT COUNT(HEAT_NO) FROM NISCO.FP_RHRSLT WHERE HEAT_NO = SUBSTR(A.SLAB_NO,1,8))>0 THEN '1' ELSE '0' END VAC_FLG ");
|
|
|
// strSqlC1.AppendLine(",(CASE WHEN(SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET CSDD WHERE (CSDD.EST_CD LIKE '5%' OR CSDD.EST_CD LIKE '6%') AND CSDD.SLAB_NO = A.SLAB_NO) > 0 THEN '1'");
|
|
|
// strSqlC1.AppendLine(" WHEN(SELECT COUNT(*) FROM(SELECT COM FROM(SELECT CSDD_C.EST_CD || '_' || CSDD_C.EST_COMMENT COM FROM NISCO.CP_SLAB_DELI_DET CSDD_C ");
|
|
|
// strSqlC1.AppendLine(" WHERE CSDD_C.SLAB_NO = A.SLAB_NO ORDER BY CSDD_C.EST_DATE DESC) T_COM WHERE ROWNUM = 1) T_L WHERE T_L.COM LIKE '%协议%') > 0 THEN '1' ");
|
|
|
// strSqlC1.AppendLine(" ELSE '0' END ) XY_FLG ");
|
|
|
// strSqlC1.AppendLine(",(SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
// strSqlC1.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
// strSqlC1.AppendLine(" WHERE SLAB_NO = A.SLAB_NO ");
|
|
|
// strSqlC1.AppendLine(" AND EST_CD IS NOT NULL) || ' ' || ");
|
|
|
// strSqlC1.AppendLine(" (CASE WHEN A.MOTHER_SLAB IS NOT NULL AND LENGTH(A.MOTHER_SLAB) = 10 THEN ");
|
|
|
// strSqlC1.AppendLine(" (SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
// strSqlC1.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
// strSqlC1.AppendLine(" WHERE SLAB_NO = A.MOTHER_SLAB ");
|
|
|
// strSqlC1.AppendLine(" AND EST_CD IS NOT NULL) ");
|
|
|
// strSqlC1.AppendLine(" ELSE '' ");
|
|
|
// strSqlC1.AppendLine(" END ) EST_COMMENT ");
|
|
|
// strSqlC1.AppendLine("FROM NISCO.FP_SLAB A ");
|
|
|
// strSqlC1.AppendLine("WHERE 1 = 1 ");
|
|
|
// strSqlC1.AppendLine(" AND(A.PROC_CD = 'CAC' OR ");
|
|
|
// strSqlC1.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.REASON_CD NOT IN('1080','2014','2015','2018','2026','3014','5011','5013','8081') AND EST_CD IS NULL) < 1)");
|
|
|
// strSqlC1.AppendLine(" AND A.PROC_CD='CAD' ) ");
|
|
|
// strSqlC1.AppendLine(" AND A.CUR_INV in '00' ");//
|
|
|
// strSqlC1.AppendLine(" AND A.PROC_CD = 'CAC' ");
|
|
|
// strSqlC1.AppendLine(" AND A.ORD_FL = '2' ");
|
|
|
// strSqlC1.AppendLine(" AND A.REC_STS = '2' ");
|
|
|
// strSqlC1.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
// strSqlC1.AppendLine(" AND A.WGT > 0 ");
|
|
|
// strSqlC1.AppendLine(" AND A.WID > 1600 ");
|
|
|
// strSqlC1.AppendLine(" AND A.LEN > 3900 ");
|
|
|
// strSqlC1.AppendLine(" AND NVL(A.PLT,'99') IN ('B1','BZ') ");
|
|
|
// strSqlC1.AppendLine(" AND NVL(A.QUALITY_UPD_GRD,'N') <> 'N' ");
|
|
|
// strSqlC1.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
// strSqlC1.AppendLine(" AND SLAB_NO NOT IN ( SELECT SLAB_NO FROM NISCO.CP_SLAB_MOVE_PLAN WHERE PRC_STS = 'A' AND TO_INV in('ZB','HB') ) ");
|
|
|
// strSqlC1.AppendLine(" AND NVL(A.PLAN_MILL_PLT , ' ') LIKE 'C1' || '%' ");
|
|
|
// // P_SLAB_DELI_DET表中字段EST_CD是5或者6开头是协议板。
|
|
|
// if (!string.IsNullOrEmpty(tB_SLAB.SLAB_NO))
|
|
|
// {
|
|
|
// strSqlC1.AppendLine("AND SLAB_NO like '%" + tB_SLAB.SLAB_NO + "%'");
|
|
|
// strSqlC2.AppendLine("AND SLAB_NO like '%" + tB_SLAB.SLAB_NO + "%'");
|
|
|
// strSqlC3.AppendLine("AND SLAB_NO like '%" + tB_SLAB.SLAB_NO + "%'");
|
|
|
// }
|
|
|
// if (!string.IsNullOrEmpty(tB_SLAB.STLGRD))
|
|
|
// {
|
|
|
// strSqlC1.AppendLine("AND (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) like '%" + tB_SLAB.STLGRD + "%'");
|
|
|
// strSqlC2.AppendLine("AND (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) like '%" + tB_SLAB.STLGRD + "%'");
|
|
|
// strSqlC3.AppendLine("AND (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) like '%" + tB_SLAB.STLGRD + "%'");
|
|
|
// }
|
|
|
// if (!string.IsNullOrEmpty(tB_SLAB.THK_MIN))
|
|
|
// {
|
|
|
// strSqlC1.AppendLine("AND A.THK >= '" + tB_SLAB.THK_MIN + "'");
|
|
|
// strSqlC2.AppendLine("AND A.THK >= '" + tB_SLAB.THK_MIN + "'");
|
|
|
// strSqlC3.AppendLine("AND A.THK >= '" + tB_SLAB.THK_MIN + "'");
|
|
|
// }
|
|
|
// if (!string.IsNullOrEmpty(tB_SLAB.THK_MAX))
|
|
|
// {
|
|
|
// strSqlC1.AppendLine("AND A.THK <= '" + tB_SLAB.THK_MAX + "'");
|
|
|
// strSqlC2.AppendLine("AND A.THK <= '" + tB_SLAB.THK_MAX + "'");
|
|
|
// strSqlC3.AppendLine("AND A.THK <= '" + tB_SLAB.THK_MAX + "'");
|
|
|
// }
|
|
|
// try
|
|
|
// {
|
|
|
// //开启数据库连接查询数据
|
|
|
// using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
// {
|
|
|
// if (tB_SLAB.PLT == "C3")
|
|
|
// {
|
|
|
// ltSlab = db.Query<TB_SLAB>(strSqlC3.ToString());
|
|
|
// }
|
|
|
// if (tB_SLAB.PLT == "C2")
|
|
|
// {
|
|
|
// ltSlab = db.Query<TB_SLAB>(strSqlC2.ToString());
|
|
|
// }
|
|
|
// if (tB_SLAB.PLT == "C1")
|
|
|
// {
|
|
|
// ltSlab = db.Query<TB_SLAB>(strSqlC1.ToString());
|
|
|
// }
|
|
|
// if (string.IsNullOrEmpty(tB_SLAB.PLT))
|
|
|
// {
|
|
|
// ltSlabC3 = db.Query<TB_SLAB>(strSqlC3.ToString());
|
|
|
// ltSlabC2 = db.Query<TB_SLAB>(strSqlC2.ToString());
|
|
|
// ltSlabC1 = db.Query<TB_SLAB>(strSqlC1.ToString());
|
|
|
// ltSlab = ltSlab.Union(ltSlabC3).Union(ltSlabC2).Union(ltSlabC1).ToList();
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
// }
|
|
|
// catch (Exception ex)
|
|
|
// {
|
|
|
// logger.Error("GetSlabInfo 报错", ex);
|
|
|
// }
|
|
|
// return ltSlab;
|
|
|
|
|
|
//}
|
|
|
|
|
|
[HttpPost, Route("getBpOrderInfo")]
|
|
|
public RequestEntity getBpOrderInfo(BP_ORDER_ITEM_QUERY BOI)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = getOrderInfo(BOI);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetSurplusMaterials 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
public IList<TB_APPOINT_ORDER_INFO> getOrderInfo(BP_ORDER_ITEM_QUERY BOI)
|
|
|
{
|
|
|
|
|
|
|
|
|
StringBuilder strSql = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_APPOINT_ORDER_INFO> ltBOI = new List<TB_APPOINT_ORDER_INFO>();
|
|
|
strSql.AppendLine("SELECT DISTINCT ");
|
|
|
|
|
|
strSql.AppendLine(" BOI.ORD_NO, BOI.ORD_ITEM ,'' AS XY_FLG ");
|
|
|
strSql.AppendLine(" ,NVL(C.SMS_TOT_WGT, 0) SMS_TOT_WGT-- - 炼钢 ");
|
|
|
strSql.AppendLine(", NVL(C.CCM_TOT_WGT, 0) CCM_TOT_WGT--连铸 ");
|
|
|
strSql.AppendLine(",NVL(C.MILL_TOT_WGT, 0) ");
|
|
|
strSql.AppendLine(" - DECODE(BOI.IS_JC, ");
|
|
|
strSql.AppendLine(" 'Y', ");
|
|
|
strSql.AppendLine(" (SELECT NVL(SUM(WGT), 0) ");
|
|
|
strSql.AppendLine(" FROM NISCO.FP_SLAB ");
|
|
|
strSql.AppendLine(" WHERE REC_STS = '2' ");
|
|
|
strSql.AppendLine(" AND ORD_FL = '1' ");
|
|
|
strSql.AppendLine(" AND PROC_CD IN('CAA', 'CAD') ");
|
|
|
strSql.AppendLine(" AND ORD_NO = BOI.ORD_NO ");
|
|
|
strSql.AppendLine(" AND ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
strSql.AppendLine(" AND INGOT_FL = 'A'), ");
|
|
|
strSql.AppendLine(" 0) ZGDD--轧钢等待 ");
|
|
|
strSql.AppendLine(",(SELECT NVL(SUM(E.WGT), 0) ");
|
|
|
strSql.AppendLine(" FROM NISCO.FP_SLAB F, NISCO.FP_SLAB_DES E ");
|
|
|
strSql.AppendLine(" WHERE E.ORD_NO = BOI.ORD_NO ");
|
|
|
strSql.AppendLine(" AND E.ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
strSql.AppendLine(" AND E.BLOCK_SEQ > '00' ");
|
|
|
strSql.AppendLine(" AND E.SEQ > '00' ");
|
|
|
strSql.AppendLine(" AND E.REC_STS = '2' ");
|
|
|
strSql.AppendLine(" AND F.SLAB_NO = E.SLAB_NO ");
|
|
|
strSql.AppendLine(" AND F.ORD_FL = '1' ");
|
|
|
strSql.AppendLine(" AND E.PROC_CD = 'CAD') CADPL--CAD ");
|
|
|
|
|
|
strSql.AppendLine(" , QQD.THK_TOL_MIN ,QQD.THK_TOL_MAX ,BOI.REC_STS, BOI.PLN_ORD, BOI.PLN_ORD_ITEM, BOI.ORD_STS, BOI.HOLD_FL, BOI.HOLD_DATE, BOI.HOLD_TIME, BOI.HOLD_EMP_ID");
|
|
|
strSql.AppendLine(", BOI.CURRENCY, BOI.EXTRA_FL, BOI.DISCON_PRC, BOI.TOT_PRC, BOI.TRANS_PRC, BOI.EMP_ID, BOI.PROD_PRC, BOI.REG_DATE, BOI.REG_TIME, BOI.CONF_DATE ");
|
|
|
strSql.AppendLine(", BOI.CONF_TIME, BOI.CONF_EMP_ID, BOI.CUST_CD, BOI.ORD_CUST_CD, BOI.PROD_DGR, BOI.SALE_WAY, BOI.DEPT_CD, BOI.DEST_CD, BOI.DEST_DETAIL ");
|
|
|
strSql.AppendLine(", BOI.ENDUSE_CD, (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = BOI.STLGRD) STLGRD, BOI.PAYMENT_COND, BOI.DEL_COND, BOI.DEL_TOL_UNIT, NVL(CPP.ORD_REM_WGT, 0) DEL_TOL_MAX, NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100 DEL_TOL_MIN, BOI.WGT_UNIT, BOI.WGT_GRP ");
|
|
|
strSql.AppendLine(", BOI.PROD_WGT, BOI.PROD_WGT_MIN, BOI.PROD_WGT_MAX, BOI.TOT_WGT, BOI.STDSPEC, BOI.STDSPEC_YY, BOI.ORD_SIZE, BOI.ORD_WID, BOI.ORD_LEN, BOI.ORD_THK ");
|
|
|
strSql.AppendLine(", BOI.INDIA, BOI.OUTDIA, BOI.CAN_FL, BOI.CAN_DATE, BOI.CAN_TIME, BOI.CAN_EMP_ID, BOI.MOD_FL, BOI.MOD_DATE, BOI.MOD_TIME, BOI.DEL_FR_DATE, BOI.DEL_TO_DATE ");
|
|
|
strSql.AppendLine(", BOI.CUST_DEL_FR_DATE, BOI.CUST_DEL_TO_DATE, BOI.ORD_PROD_END_DATE, BOI.ORD_PROD_END_TIME, BOI.ORD_SHIP_END_DATE, BOI.ORD_SHIP_END_TIME, BOI.ORD_ACCP_DATE ");
|
|
|
strSql.AppendLine(", BOI.ORD_ACCP_TIME, BOI.CUST_REQ_PLANT, BOI.TENT_REQ_PLANT, BOI.CONF_PLANT, BOI.CUST_SPEC_NO, BOI.MARKING_WAY, BOI.STAMP, BOI.TRANSP_WAY, BOI.ORD_KND ");
|
|
|
strSql.AppendLine(", BOI.TRIM_FL, BOI.URGNT_FL, BOI.UST_FL, BOI.PAYMENT_FL, BOI.PAYMENT_DATE, BOI.PAYMENT_TIME, BOI.PAYMENT_EMP_ID, BOI.PACK_WAY, BOI.PACK_WGT_MAX ");
|
|
|
strSql.AppendLine(", BOI.PACK_WGT_MIN, BOI.NUM_PROD, BOI.SALE_EMP_ID, BOI.END_CUST_CD, BOI.INSP_CD, BOI.DOME_FL, BOI.PROD_CD, BOI.PROD_THK_TGT, BOI.SIZE_KND, BOI.ORD_LEN_MIN ");
|
|
|
strSql.AppendLine(", BOI.ORD_LEN_MAX, BOI.MATR_FL, BOI.CONT_END_DATE, BOI.CONT_END_TIME, BOI.CONT_END_EMP_ID, BOI.VESSEL_NO, BOI.CUST_REQ_NO, BOI.COLOR_STROKE, BOI.RELEASE_DATE ");
|
|
|
strSql.AppendLine(", BOI.RELEASE_TIME, BOI.RELEASE_EMP_ID, BOI.PLN_SMS_PLT, BOI.PLN_MILL_PLT, BOI.CFM_SMS_PLT, BOI.CFM_MILL_PLT, BOI.HTM_SHOT_BLAST ");
|
|
|
strSql.AppendLine(", BOI.INS_DATE, BOI.INS_TIME, BOI.INS_EMPID, BOI.INS_PGMID, BOI.UPD_DATE, BOI.UPD_TIME, BOI.UPD_EMPID, BOI.UPD_PGMID, BOI.SEALMEMO ");
|
|
|
strSql.AppendLine(", BOI.INSPUNITCODEA, BOI.INSPUNITCODEB, BOI.INSPUNITCODEC, BOI.PRODSPECNOA, BOI.PRODSPECNOB, BOI.PRODSPECNOC, BOI.PAINTNUM, BOI.LP_HD_THK, BOI.LP_MD_THK, BOI.LP_TL_THK ");
|
|
|
strSql.AppendLine(", BOI.LP_LEN1, BOI.LP_LEN2, BOI.LP_LEN3, BOI.LP_LEN4, BOI.LP_LEN5, BOI.IMP_CONT, BOI.INSPECT_ORGAN, BOI.CONTRACT_NO, BOI.TRIAL_PRODUCT, BOI.TRIAL_NUM, BOI.TRIAL_STR ");
|
|
|
strSql.AppendLine(", BOI.TRIAL_END, BOI.SIDEMARK, BOI.JIT_STRINGA, BOI.JIT_STRINGB, BOI.JIT_STRINGC, BOI.JITID, BOI.JIT_FLAG, BOI.QO_FL, BOI.SAMPLE_MEMO, BOI.SIZE_MEMO, BOI.PACK_MEMO ");
|
|
|
strSql.AppendLine(", BOI.FLUSH_FL, BOI.APPOINT_PLT, BOI.MORD_DESIGN_WGT, BOI.MORD_FL, BOI.APPOINT_PLT_REASON, BOI.SURFACE_REQUESTS, BOI.STAMP_FL, BOI.UST_INSP_FL, BOI.SPRAY_FL ");
|
|
|
strSql.AppendLine(", BOI.BUFPOOL_CD, BOI.MULTI_INSP_FL, BOI.CONTRACT_DATE, BOI.DELIVERY_STATUS, BOI.CUST_CLASS, BOI.CUST_LEVEL, BOI.SPECIAL_OPR_REQ, BOI.WITNESS_CONTENT, BOI.COGGING_FLAG ");
|
|
|
strSql.AppendLine(", BOI.STD_DET_CLASS_CD, BOI.STD_DET_CLASS_LVL, BOI.CERT_NOTE, BOI.INSPECT_FLAG, BOI.E2E_CUST, BOI.CUST_PURCHASE, BOI.GUID, BOI.NEW_CLASS_STATE, BOI.FACEPAINT ");
|
|
|
strSql.AppendLine(", BOI.IS_JC, BOI.UST_JC, BOI.LEVEL_JM, BOI.ORDER_NOFH, BOI.ITEM_NOFH, BOI.ORDER_THK_JC, BOI.ORDER_THK_FC, BOI.TYPEFH, BOI.PRODTYPENO, BOI.STEEL_SPRAY ");
|
|
|
strSql.AppendLine(", BOI.STEEL_PACK, BOI.STEEL_SHOTBLAST, BOI.STEEL_SLOTEPROCESS, BOI.ORDERQTY, BOI.ORDER_CNT, BOI.DELIVERY_STATUS1, BOI.DELIVERY_STATUS2, BOI.DELIVERY_STATUS3 ");
|
|
|
strSql.AppendLine(", BOI.SPECNOA, BOI.SPECNOB, BOI.SPECNOC, BOI.SPECNOA_YY, BOI.SPECNOB_YY, BOI.SPECNOC_YY, BOI.INSPUNITCODE, BOI.SUBCUSTNO, BOI.ISSHIPORDER, BOI.SAILINGDATE ");
|
|
|
strSql.AppendLine(", BOI.MARINEBOARD, BOI.ORDERNOYPK, BOI.ORDERITEMYPK, BOI.SORTINGMARK, BOI.UST_FL_PRINT, BOI.PRINTUTLEVEL, BOI.RULLBOARDCUT, BOI.PAINTUPT, BOI.ORDERPRICEB ");
|
|
|
strSql.AppendLine(", BOI.ADJUSTPRICE, BOI.HOTUT, BOI.HOTUTRATE, BOI.SPECIALSIGN, BOI.UST_MODE, BOI.INSP_CD1, BOI.INSP_CD2, BOI.QKL_CUSTNO ");
|
|
|
strSql.AppendLine(", CPP.ORD_WGT ");
|
|
|
//strSql.AppendLine(",FLOOR((NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)) AS SUB_LACK_NUM");
|
|
|
//欠量上线
|
|
|
strSql.AppendLine(" ,NVL((SELECT sum(A.WGT) ");
|
|
|
strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B ");
|
|
|
strSql.AppendLine(" WHERE ");
|
|
|
strSql.AppendLine("1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
strSql.AppendLine("AND A.BLOCK_SEQ >= '01' ");
|
|
|
strSql.AppendLine("AND A.SEQ >= '01' ");
|
|
|
strSql.AppendLine("And B.REQ_SEQ_NO = A.REQ_SEQ_NO ");
|
|
|
strSql.AppendLine("AND B.REC_STS = '1'),0)+NVL(CPP.ORD_REM_WGT, 0) AS WGT_MAX ");
|
|
|
|
|
|
|
|
|
strSql.AppendLine(",(NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) AS SUB_LACK_WGT ");
|
|
|
strSql.AppendLine(",NVL(QQT.HTM_METH1,' ') HTM_METH1 ");
|
|
|
strSql.AppendLine(",NVL(QQT.HTM_METH2,' ') HTM_METH2 ");
|
|
|
strSql.AppendLine(",NVL(QQT.HTM_METH3,' ') HTM_METH3 ");
|
|
|
//HTM_COND1
|
|
|
strSql.AppendLine(",NVL(QQT.HTM_COND1,' ') HTM_COND1 ");
|
|
|
strSql.AppendLine(",NVL(QQT.HTM_COND2,' ') HTM_COND2 ");
|
|
|
strSql.AppendLine(",NVL(QQT.HTM_COND3,' ') HTM_COND3 ");
|
|
|
|
|
|
//成品成分
|
|
|
strSql.AppendLine(",(CASE WHEN ( SELECT COUNT(*) FROM NISCO.QP_QLTY_CHEM_FP QQCF WHERE QQCF.ORD_NO=BOI.ORD_NO AND QQCF.ORD_ITEM=BOI.ORD_ITEM )>0 THEN '1' ELSE '0' END ) CHEM_FLG ");
|
|
|
|
|
|
|
|
|
//strSql.AppendLine(",QSH.STDSPEC_NAME_ENG ");
|
|
|
strSql.AppendLine(",QSH.STDSPEC_STLGRD");
|
|
|
strSql.AppendLine(",(CASE WHEN ( SELECT COUNT(*) FROM NISCO.BP_ODER_XY BOXY WHERE BOXY.ORDER_NO=BOI.ORD_NO AND BOXY.ORDER_ITEM=BOI.ORD_ITEM )>0 THEN '1' ELSE '0' END ) XY_FLG ");
|
|
|
strSql.AppendLine(",(CASE WHEN instr( DECODE(QQT.MLT_PROC_LINE, '1', QQT.MLT_PROC_CD, QQT.MLT_PROC_CD2),'BH') > 0 THEN '1' ELSE '0' END ) VAC_FLG\r\n");
|
|
|
strSql.AppendLine(",(CASE WHEN(SELECT COUNT(*) FROM NISCO.QP_QLTY_MATR_HA QQMH WHERE QQMH.ORD_NO = BOI.ORD_NO AND QQMH.ORD_ITEM = BOI.ORD_ITEM AND QQMH.TEST_KND IN('8', '9')) > 0 THEN '1' ELSE '0' END ) Z_FLG ");
|
|
|
strSql.AppendLine(",CASE WHEN BOI.CUST_DEL_TO_DATE > TO_CHAR(SYSDATE + 7, 'YYYYMMdd') THEN 0 ELSE 1 END DEL_FLG");
|
|
|
|
|
|
//strSql.AppendLine(",'4'AS SUB_LACK_NUM");
|
|
|
//strSql.AppendLine(",'4'AS LACK_NUM");
|
|
|
|
|
|
strSql.AppendLine(", (SELECT COUNT(A.REQ_SEQ_NO) ");
|
|
|
strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B ");
|
|
|
strSql.AppendLine(" WHERE ");
|
|
|
strSql.AppendLine(" 1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
strSql.AppendLine(" AND A.BLOCK_SEQ >= '01' ");
|
|
|
strSql.AppendLine(" AND A.SEQ >= '01' ");
|
|
|
strSql.AppendLine(" And B.REQ_SEQ_NO = A.REQ_SEQ_NO ");
|
|
|
strSql.AppendLine(" AND B.REC_STS = '1') +GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) AS SUB_LACK_NUM ");
|
|
|
strSql.AppendLine(", ( SELECT COUNT(A.REQ_SEQ_NO) ");
|
|
|
strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B ");
|
|
|
strSql.AppendLine(" WHERE ");
|
|
|
strSql.AppendLine(" 1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
strSql.AppendLine(" AND A.BLOCK_SEQ >= '01' ");
|
|
|
strSql.AppendLine(" AND A.SEQ >= '01' ");
|
|
|
strSql.AppendLine(" And B.REQ_SEQ_NO = A.REQ_SEQ_NO ");
|
|
|
strSql.AppendLine(" AND B.REC_STS = '1') +GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) AS LACK_NUM");
|
|
|
|
|
|
strSql.AppendLine("FROM NISCO.cp_prc CPP ");
|
|
|
strSql.AppendLine("INNER JOIN ");
|
|
|
strSql.AppendLine("NISCO.BP_ORDER_ITEM boi ");
|
|
|
strSql.AppendLine("ON BOI.ORD_NO = CPP.ORD_NO ");
|
|
|
strSql.AppendLine("AND BOI.ORD_ITEM = CPP.ORD_ITEM ");
|
|
|
strSql.AppendLine("AND BOI.ORD_WID <> 0 ");
|
|
|
strSql.AppendLine("AND BOI.ORD_LEN <> 0 ");
|
|
|
strSql.AppendLine("AND BOI.ORD_THK <> 0 ");
|
|
|
strSql.AppendLine("LEFT JOIN NISCO.QP_QLTY_TECH QQT ");
|
|
|
strSql.AppendLine("ON BOI.ORD_NO = QQT.ORD_NO ");
|
|
|
strSql.AppendLine("AND BOI.ORD_ITEM = QQT.ORD_ITEM ");
|
|
|
strSql.AppendLine("LEFT JOIN NISCO.QP_QLTY_DELV QQD ");
|
|
|
strSql.AppendLine("ON BOI.ORD_NO = QQD.ORD_NO ");
|
|
|
strSql.AppendLine("AND BOI.ORD_ITEM = QQD.ORD_ITEM ");
|
|
|
|
|
|
strSql.AppendLine("LEFT JOIN NISCO.QP_STD_HEAD QSH ");
|
|
|
strSql.AppendLine(" ON boi.STDSPEC = QSH.STDSPEC ");
|
|
|
strSql.AppendLine(" AND boi.STDSPEC_YY = QSH.STDSPEC_YY ");
|
|
|
|
|
|
|
|
|
strSql.AppendLine("LEFT JOIN(SELECT CPD.ORD_NO, ");
|
|
|
strSql.AppendLine("CPD.ORD_ITEM, ");
|
|
|
strSql.AppendLine(" SUM(DECODE(CPD.PRC, 'BC', CPD.TOT_WGT, 0) + ");
|
|
|
strSql.AppendLine(" DECODE(CPD.PRC, 'BD', CPD.TOT_WGT, 0) + ");
|
|
|
strSql.AppendLine(" DECODE(CPD.PRC, 'BE', CPD.TOT_WGT, 0)) AS SMS_TOT_WGT, ");
|
|
|
strSql.AppendLine(" SUM(DECODE(CPD.PRC, 'BF', CPD.TOT_WGT, 0)) AS CCM_TOT_WGT, ");
|
|
|
strSql.AppendLine(" SUM(DECODE(CPD.PRC, 'CA', CPD.TOT_WGT, 0) + ");
|
|
|
strSql.AppendLine(" DECODE(CPD.PRC, 'CB', CPD.TOT_WGT, 0)) AS MILL_TOT_WGT, ");
|
|
|
strSql.AppendLine(" SUM(DECODE(CPD.PRC, 'CG', CPD.TOT_WGT, 0)) AS CUT_WAIT_WGT, ");
|
|
|
strSql.AppendLine(" SUM(DECODE(CPD.PRC, 'CG', CPD.TOT_WGT, 0) + ");
|
|
|
strSql.AppendLine(" DECODE(CPD.PRC, 'DZ', CPD.TOT_WGT, 0)) AS CUT_TOT_WGT, ");
|
|
|
strSql.AppendLine(" SUM(DECODE(CPD.PRC, 'QA', CPD.TOT_WGT, 0)) AS QUAL_TOT_WGT, ");
|
|
|
strSql.AppendLine(" SUM(DECODE(CPD.PRC, 'XA', CPD.TOT_WGT, 0)) AS DISP_TOT_WGT ");
|
|
|
strSql.AppendLine(" FROM NISCO.CP_PRC_DET CPD ");
|
|
|
strSql.AppendLine(" GROUP BY CPD.ORD_NO, CPD.ORD_ITEM) C ");
|
|
|
strSql.AppendLine(" ON C.ORD_NO = BOI.ORD_NO AND C.ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
|
|
|
strSql.AppendLine("WHERE 1 = 1 ");
|
|
|
strSql.AppendLine(" AND ");
|
|
|
strSql.AppendLine(" (SELECT COUNT(A.REQ_SEQ_NO) ");
|
|
|
strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B");
|
|
|
strSql.AppendLine(" WHERE ");
|
|
|
strSql.AppendLine(" 1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM");
|
|
|
strSql.AppendLine(" AND A.BLOCK_SEQ >= '01' ");
|
|
|
strSql.AppendLine(" AND A.SEQ >= '01' ");
|
|
|
strSql.AppendLine(" And B.REQ_SEQ_NO = A.REQ_SEQ_NO ");
|
|
|
strSql.AppendLine(" AND B.REC_STS = '1') + GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) >= 0.95");
|
|
|
strSql.AppendLine(" AND boi.PROD_CD = 'PP' ");
|
|
|
strSql.AppendLine("AND boi.REC_STS = '2' ");
|
|
|
strSql.AppendLine("and boi.ORD_STS IN('E') ");
|
|
|
strSql.AppendLine(" AND (boi.ord_knd ='A' OR boi.ord_knd ='T') ");
|
|
|
// P_SLAB_DELI_DET表中字段EST_CD是5或者6开头是协议板。
|
|
|
if (!string.IsNullOrEmpty(BOI.ORD_NO))
|
|
|
{
|
|
|
strSql.AppendLine("AND boi.ord_no like '%" + BOI.ORD_NO + "%'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(BOI.ORD_ITEM))
|
|
|
{
|
|
|
strSql.AppendLine("AND boi.ord_item like '%" + BOI.ORD_ITEM + "%'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(BOI.STLGRD))
|
|
|
{
|
|
|
strSql.AppendLine("AND (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = BOI.STLGRD ) like '%" + BOI.STLGRD + "%'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(BOI.PLT))
|
|
|
{
|
|
|
strSql.AppendLine("AND boi.CFM_MILL_PLT = '" + BOI.PLT + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(BOI.THK_MIN))
|
|
|
{
|
|
|
strSql.AppendLine("AND boi.ORD_THK >= '" + BOI.THK_MIN + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(BOI.THK_MAX))
|
|
|
{
|
|
|
strSql.AppendLine("AND boi.ORD_THK <= '" + BOI.THK_MAX + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(BOI.STDSPEC_STLGRD))
|
|
|
{
|
|
|
strSql.AppendLine("AND QSH.STDSPEC_STLGRD like '%" + BOI.STDSPEC_STLGRD + "%'");
|
|
|
}
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
|
|
|
ltBOI = db.Query<TB_APPOINT_ORDER_INFO>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetBOIInfo 报错", ex);
|
|
|
}
|
|
|
return ltBOI;
|
|
|
|
|
|
}
|
|
|
|
|
|
public IList<TB_APPOINT_ORDER_INFO> getOrderInfo(string BOI)
|
|
|
{
|
|
|
|
|
|
|
|
|
StringBuilder strSql = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_APPOINT_ORDER_INFO> ltBOI = new List<TB_APPOINT_ORDER_INFO>();
|
|
|
strSql.AppendLine("SELECT DISTINCT ");
|
|
|
strSql.AppendLine(" BOI.ord_no,BOI.ord_item,'' AS XY_FLG, BOI.ORD_STS,BOI.STDSPEC,BOI.STLGRD,BOI.ORD_THK,BOI.ORD_WID,BOI.ORD_LEN,ROUND(BOI.ORD_THK/1000*BOI.ORD_WID/1000*BOI.ORD_LEN/1000*7.85,3) AS ORD_WGT ,BOI.SIZE_KND,BOI.DEL_TO_DATE,CPP.ORD_WGT as PROD_WGT ");
|
|
|
strSql.AppendLine(",NVL(CPP.ORD_REM_WGT, 0) DEL_TOL_MAX, NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100 DEL_TOL_MIN ");
|
|
|
strSql.AppendLine(" ,NVL(C.SMS_TOT_WGT, 0) SMS_TOT_WGT-- - 炼钢 ");
|
|
|
strSql.AppendLine(", NVL(C.CCM_TOT_WGT, 0) CCM_TOT_WGT--连铸 ");
|
|
|
strSql.AppendLine(",NVL(C.MILL_TOT_WGT, 0) ");
|
|
|
strSql.AppendLine(" - DECODE(BOI.IS_JC, ");
|
|
|
strSql.AppendLine(" 'Y', ");
|
|
|
strSql.AppendLine(" (SELECT NVL(SUM(WGT), 0) ");
|
|
|
strSql.AppendLine(" FROM NISCO.FP_SLAB ");
|
|
|
strSql.AppendLine(" WHERE REC_STS = '2' ");
|
|
|
strSql.AppendLine(" AND ORD_FL = '1' ");
|
|
|
strSql.AppendLine(" AND PROC_CD IN('CAA', 'CAD') ");
|
|
|
strSql.AppendLine(" AND ORD_NO = BOI.ORD_NO ");
|
|
|
strSql.AppendLine(" AND ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
strSql.AppendLine(" AND INGOT_FL = 'A'), ");
|
|
|
strSql.AppendLine(" 0) ZGDD--轧钢等待 ");
|
|
|
strSql.AppendLine(",(SELECT NVL(SUM(E.WGT), 0) ");
|
|
|
strSql.AppendLine(" FROM NISCO.FP_SLAB F, NISCO.FP_SLAB_DES E ");
|
|
|
strSql.AppendLine(" WHERE E.ORD_NO = BOI.ORD_NO ");
|
|
|
strSql.AppendLine(" AND E.ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
strSql.AppendLine(" AND E.BLOCK_SEQ > '00' ");
|
|
|
strSql.AppendLine(" AND E.SEQ > '00' ");
|
|
|
strSql.AppendLine(" AND E.REC_STS = '2' ");
|
|
|
strSql.AppendLine(" AND F.SLAB_NO = E.SLAB_NO ");
|
|
|
strSql.AppendLine(" AND F.ORD_FL = '1' ");
|
|
|
strSql.AppendLine(" AND E.PROC_CD = 'CAD') CADPL--CAD ");
|
|
|
strSql.AppendLine(",BOI.CFM_MILL_PLT,BOI.COLOR_STROKE,BOI.CUST_CD ");
|
|
|
strSql.AppendLine("FROM NISCO.cp_prc CPP ");
|
|
|
strSql.AppendLine("INNER JOIN ");
|
|
|
strSql.AppendLine("NISCO.BP_ORDER_ITEM boi ");
|
|
|
strSql.AppendLine("ON BOI.ORD_NO = CPP.ORD_NO ");
|
|
|
strSql.AppendLine("AND BOI.ORD_ITEM = CPP.ORD_ITEM ");
|
|
|
strSql.AppendLine("AND BOI.ORD_WID <> 0 ");
|
|
|
strSql.AppendLine("AND BOI.ORD_LEN <> 0 ");
|
|
|
strSql.AppendLine("AND BOI.ORD_THK <> 0 ");
|
|
|
strSql.AppendLine("LEFT JOIN(SELECT CPD.ORD_NO, CPD.ORD_ITEM, ");
|
|
|
strSql.AppendLine(" SUM(DECODE(CPD.PRC, 'BC', CPD.TOT_WGT, 0) + ");
|
|
|
strSql.AppendLine(" DECODE(CPD.PRC, 'BD', CPD.TOT_WGT, 0) + ");
|
|
|
strSql.AppendLine(" DECODE(CPD.PRC, 'BE', CPD.TOT_WGT, 0)) AS SMS_TOT_WGT, ");
|
|
|
strSql.AppendLine(" SUM(DECODE(CPD.PRC, 'BF', CPD.TOT_WGT, 0)) AS CCM_TOT_WGT, ");
|
|
|
strSql.AppendLine(" SUM(DECODE(CPD.PRC, 'CA', CPD.TOT_WGT, 0) + ");
|
|
|
strSql.AppendLine(" DECODE(CPD.PRC, 'CB', CPD.TOT_WGT, 0)) AS MILL_TOT_WGT ");
|
|
|
strSql.AppendLine(" FROM NISCO.CP_PRC_DET CPD ");
|
|
|
strSql.AppendLine(" GROUP BY CPD.ORD_NO, CPD.ORD_ITEM) C ");
|
|
|
strSql.AppendLine(" ON C.ORD_NO = BOI.ORD_NO AND C.ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
strSql.AppendLine("WHERE 1!=1 ");
|
|
|
strSql.AppendLine(BOI);
|
|
|
// P_SLAB_DELI_DET表中字段EST_CD是5或者6开头是协议板。
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
|
|
|
ltBOI = db.Query<TB_APPOINT_ORDER_INFO>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetBOIInfo 报错", ex);
|
|
|
}
|
|
|
return ltBOI;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取替代板坯信息
|
|
|
/// </summary>
|
|
|
/// <param name="queryArgs"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("getTbSlabManual")]
|
|
|
public RequestEntity getTbSlabManual(TB_SLAB_MANUALQueryArgs queryArgs)
|
|
|
{
|
|
|
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<FP_SLAB_DES> ltFSD = new List<FP_SLAB_DES>();
|
|
|
strSql.AppendLine("SELECT FSD.*,TO_DATE(INS_DATE||INS_TIME, 'yyyy-mm-dd hh24:mi:ss') SUB_DATE FROM TB_SLAB_MANUAL FSD WHERE 1=1 ");
|
|
|
|
|
|
//strSql.AppendLine("FROM FP_SLAB_DES FSD ");
|
|
|
//strSql.AppendLine("WHERE 1 = 1 AND FSD.HAN_RSL IS NULL");
|
|
|
|
|
|
if (queryArgs != null)
|
|
|
{
|
|
|
//板坯号
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.SLAB_NO))
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.SLAB_NO = '" + queryArgs.SLAB_NO + "'");
|
|
|
}
|
|
|
//订单号
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.ORD_NO))
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.ORD_NO = '" + queryArgs.ORD_NO + "'");
|
|
|
}
|
|
|
//序列号
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.ORD_ITEM))
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.ORD_ITEM = '" + queryArgs.ORD_ITEM + "'");
|
|
|
}
|
|
|
//工厂
|
|
|
if (!string.IsNullOrWhiteSpace(queryArgs.PLT))
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.PLT = '" + queryArgs.PLT + "'");
|
|
|
}
|
|
|
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')");
|
|
|
}
|
|
|
|
|
|
strSql.AppendLine(" ORDER BY TO_DATE(INS_DATE||INS_TIME, 'yyyy-mm-dd hh24:mi:ss') desc ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
result.data = db.Query(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("GetSlabSub 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="delModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("DelTbSlabManual")]
|
|
|
public RequestEntity DelTbSlabManual(IList<TB_SLAB_MANUAL> delModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
foreach (var model in delModel)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
//ORD_NO, ORD_ITEM
|
|
|
strSql.AppendLine("DELETE FROM TB_SLAB_MANUAL WHERE 1=1 ");
|
|
|
strSql.AppendLine(string.Format(" AND SLAB_NO='{0}' AND ORD_NO = '{1}' AND ORD_ITEM = '{2}' ", model.SLAB_NO, model.ORD_NO, model.ORD_ITEM));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
strSql.Length = 0;
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录删除失败: " + delModel.ToString());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result.msg = "操作成功";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("DelTbOrdSpe 报错", ex);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 修改接口
|
|
|
/// </summary>
|
|
|
/// <param name="delModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("UpdateTbSlabManual")]
|
|
|
public RequestEntity UpdateTbSlabManual(IList<TB_SLAB_MANUAL> model)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//ORD_NO, ORD_ITEM
|
|
|
strSql.AppendLine("Update TB_SLAB_MANUAL ");
|
|
|
strSql.AppendLine(string.Format("set IS_CUTTING = '{0}' where SLAB_NO = '{1}' ORD_NO = '{2}' and ORD_ITEM = '{3}' ", model[1].IS_CUTTING, model[1].SLAB_NO, model[1].ORD_NO, model[1].ORD_ITEM));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
strSql.Length = 0;
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录修改失败: " + model.ToString());
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result.msg = "操作成功";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("UpdateTbOrdSpeOne 报错", ex);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddTbSlabManual")]
|
|
|
public RequestEntity AddTbSlabManual(IList<TB_SLAB_MANUAL> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_SLAB_MANUAL model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.ORD_NO) || string.IsNullOrEmpty(model.ORD_ITEM))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
//if (!ParameterCalibration(model, result))
|
|
|
//{
|
|
|
// db.Rollback();
|
|
|
// return result;
|
|
|
//}
|
|
|
#endregion
|
|
|
model.ORD_NO = model.ORD_NO.Trim();
|
|
|
model.ORD_ITEM = model.ORD_ITEM.Trim();
|
|
|
model.ORD_ITEM = model.ORD_ITEM.ToString().PadLeft(3, '0');
|
|
|
model.INS_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
model.INS_TIME = dtNow.ToString("HHmmss");
|
|
|
model.UPD_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
model.UPD_TIME = dtNow.ToString("HHmmss");
|
|
|
if (db.Insert<TB_SLAB_MANUAL>(model) == 0)
|
|
|
{
|
|
|
b = false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddTbSlabManual 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddTbSlabManualOne")]
|
|
|
public RequestEntity AddTbSlabManualOne(TB_SLAB_MANUAL model)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.ORD_NO) || string.IsNullOrEmpty(model.ORD_ITEM))
|
|
|
{
|
|
|
db.Rollback();
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
model.ORD_NO = model.ORD_NO.Trim();
|
|
|
model.ORD_ITEM = model.ORD_ITEM.Trim();
|
|
|
model.SLAB_NO = model.SLAB_NO.Trim();
|
|
|
model.INS_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
model.INS_TIME = dtNow.ToString("HHmmss");
|
|
|
model.UPD_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
model.UPD_TIME = dtNow.ToString("HHmmss");
|
|
|
|
|
|
if (db.Insert<TB_SLAB_MANUAL>(model) > 0)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddTbSlabManualOne 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 板坯替代统计
|
|
|
|
|
|
[HttpPost, Route("GetC1HisDataWGT")]
|
|
|
public RequestEntity GetC1HisDataWGT(GpPlateQueryArgs QAGP)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (QAGP.START_TIME == DateTime.MinValue && QAGP.END_TIME == DateTime.MinValue)
|
|
|
{
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
QAGP.END_TIME = DateTime.Now;
|
|
|
}
|
|
|
|
|
|
//dtCheck = SerSurMatSubService.GetHisDataWGT(QAGP);
|
|
|
IList<TB_SUB_RESULT> dtCheck = SerSurMatSubService.GetHisC1RATE_NEW(QAGP);
|
|
|
//dtCheck.Columns.Add("C1Total");
|
|
|
//dtCheck.Columns.Add("C2Total");
|
|
|
//dtCheck.Columns.Add("C3Total");
|
|
|
//dtCheck.Columns.Add("SUB_NUM_Total");
|
|
|
//dtCheck.Columns.Add("IS_END_Total");
|
|
|
//dtCheck.Columns.Add("Rate");
|
|
|
//double C1Total = 0;
|
|
|
//double C2Total = 0;
|
|
|
//double C3Total = 0;
|
|
|
//double SUB_NUM_Total = 0;
|
|
|
//double IS_END_Total = 0;
|
|
|
//double Rate = 0;
|
|
|
//DataTable dtrRate = new DataTable();
|
|
|
//dtrRate = SerSurMatSubService.GetHisC1RATE(QAGP);
|
|
|
//DataRow newrow = dtCheck.NewRow();
|
|
|
if (dtCheck.Count > 0)
|
|
|
{
|
|
|
//foreach (DataRow row in dtCheck.Rows)
|
|
|
//{
|
|
|
// C1Total += Convert.ToDouble(row["C1"].ToString());
|
|
|
// C2Total += Convert.ToDouble(row["C2"].ToString());
|
|
|
// C3Total += Convert.ToDouble(row["C3"].ToString());
|
|
|
// SUB_NUM_Total += Convert.ToDouble(row["SUB_NUM"].ToString());
|
|
|
// IS_END_Total += Convert.ToDouble(row["IS_END"].ToString());
|
|
|
// Rate = Convert.ToDouble(dtrRate.Rows[0]["SUB_RATE"].ToString());
|
|
|
//}
|
|
|
////foreach (DataRow rw in dtCheck.Rows)
|
|
|
////{
|
|
|
//// rw["C1Total"] = C1Total;
|
|
|
//// rw["C2Total"] = C2Total;
|
|
|
//// rw["C3Total"] = C3Total;
|
|
|
//// rw["SUB_NUM_Total"] = SUB_NUM_Total;
|
|
|
//// rw["IS_END_Total"] = IS_END_Total;
|
|
|
//// rw["Rate"] = dtrRate.Rows[0]["SUB_RATE"].ToString();
|
|
|
////}
|
|
|
//newrow["SUB_DATE"] = "合计";
|
|
|
//newrow["SUB_RATE"] = Rate;
|
|
|
//newrow["SUB_NUM"] = SUB_NUM_Total;
|
|
|
//newrow["C1"] = C1Total;
|
|
|
//newrow["C2"] = C2Total;
|
|
|
//newrow["C3"] = C3Total;
|
|
|
//newrow["IS_END"] = IS_END_Total;
|
|
|
//dtCheck.Rows.Add(newrow);
|
|
|
//获取历史数据
|
|
|
result.data = dtCheck;
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//获取历史数据
|
|
|
result.data = dtCheck;
|
|
|
result.msg = "无数据!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetHisDataTotal 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
[HttpPost, Route("GetC2HisDataWGT")]
|
|
|
public RequestEntity GetC2HisDataWGT(GpPlateQueryArgs QAGP)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (QAGP.START_TIME == DateTime.MinValue && QAGP.END_TIME == DateTime.MinValue)
|
|
|
{
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
QAGP.END_TIME = DateTime.Now;
|
|
|
}
|
|
|
//DataTable dtCheck = new DataTable();
|
|
|
//dtCheck = SerSurMatSubService.GetHisDataWGT(QAGP);
|
|
|
IList<TB_SUB_RESULT> dtCheck = SerSurMatSubService.GetHisC2RATE_NEW(QAGP);
|
|
|
//dtCheck.Columns.Add("C1Total");
|
|
|
//dtCheck.Columns.Add("C2Total");
|
|
|
//dtCheck.Columns.Add("C3Total");
|
|
|
//dtCheck.Columns.Add("SUB_NUM_Total");
|
|
|
//dtCheck.Columns.Add("IS_END_Total");
|
|
|
//dtCheck.Columns.Add("Rate");
|
|
|
//double C1Total = 0;
|
|
|
//double C2Total = 0;
|
|
|
//double C3Total = 0;
|
|
|
//double SUB_NUM_Total = 0;
|
|
|
//double IS_END_Total = 0;
|
|
|
//double Rate = 0;
|
|
|
//DataTable dtrRate = new DataTable();
|
|
|
//dtrRate = SerSurMatSubService.GetHisC1RATE(QAGP);
|
|
|
//DataRow newrow = dtCheck.NewRow();
|
|
|
if (dtCheck.Count > 0)
|
|
|
{
|
|
|
//foreach (DataRow row in dtCheck.Rows)
|
|
|
//{
|
|
|
// C1Total += Convert.ToDouble(row["C1"].ToString());
|
|
|
// C2Total += Convert.ToDouble(row["C2"].ToString());
|
|
|
// C3Total += Convert.ToDouble(row["C3"].ToString());
|
|
|
// SUB_NUM_Total += Convert.ToDouble(row["SUB_NUM"].ToString());
|
|
|
// IS_END_Total += Convert.ToDouble(row["IS_END"].ToString());
|
|
|
// Rate = Convert.ToDouble(dtrRate.Rows[0]["SUB_RATE"].ToString());
|
|
|
//}
|
|
|
////foreach (DataRow rw in dtCheck.Rows)
|
|
|
////{
|
|
|
//// rw["C1Total"] = C1Total;
|
|
|
//// rw["C2Total"] = C2Total;
|
|
|
//// rw["C3Total"] = C3Total;
|
|
|
//// rw["SUB_NUM_Total"] = SUB_NUM_Total;
|
|
|
//// rw["IS_END_Total"] = IS_END_Total;
|
|
|
//// rw["Rate"] = dtrRate.Rows[0]["SUB_RATE"].ToString();
|
|
|
////}
|
|
|
//newrow["SUB_DATE"] = "合计";
|
|
|
//newrow["SUB_RATE"] = Rate;
|
|
|
//newrow["SUB_NUM"] = SUB_NUM_Total;
|
|
|
//newrow["C1"] = C1Total;
|
|
|
//newrow["C2"] = C2Total;
|
|
|
//newrow["C3"] = C3Total;
|
|
|
//newrow["IS_END"] = IS_END_Total;
|
|
|
//dtCheck.Rows.Add(newrow);
|
|
|
//获取历史数据
|
|
|
result.data = dtCheck;
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//获取历史数据
|
|
|
result.data = dtCheck;
|
|
|
result.msg = "无数据!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetHisDataTotal 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
[HttpPost, Route("GetC3HisDataWGT")]
|
|
|
public RequestEntity GetC3HisDataWGT(GpPlateQueryArgs QAGP)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (QAGP.START_TIME == DateTime.MinValue && QAGP.END_TIME == DateTime.MinValue)
|
|
|
{
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
QAGP.END_TIME = DateTime.Now;
|
|
|
}
|
|
|
//DataTable dtCheck = new DataTable();
|
|
|
////dtCheck = SerSurMatSubService.GetHisDataWGT(QAGP);
|
|
|
//dtCheck = SerSurMatSubService.GetHisC3RATE(QAGP);
|
|
|
|
|
|
IList<TB_SUB_RESULT> dtCheck = SerSurMatSubService.GetHisC3RATE_NEW(QAGP);
|
|
|
|
|
|
if (dtCheck.Count > 0)
|
|
|
{
|
|
|
|
|
|
//获取历史数据
|
|
|
result.data = dtCheck;
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//获取历史数据
|
|
|
result.data = dtCheck;
|
|
|
result.msg = "无数据!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetHisDataTotal 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
[HttpPost, Route("GetAllHisDataWGT")]
|
|
|
public RequestEntity GetAllHisDataWGT(GpPlateQueryArgs QAGP)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (QAGP.START_TIME == DateTime.MinValue && QAGP.END_TIME == DateTime.MinValue)
|
|
|
{
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
QAGP.END_TIME = DateTime.Now;
|
|
|
}
|
|
|
|
|
|
IList<TB_SUB_RESULT> dtCheck1 = new List<TB_SUB_RESULT>();
|
|
|
|
|
|
IList<TB_SUB_RESULT> dtCheck2 = new List<TB_SUB_RESULT>();
|
|
|
|
|
|
IList<TB_SUB_RESULT> dtCheck3 = new List<TB_SUB_RESULT>();
|
|
|
|
|
|
//多线程获取数据
|
|
|
Task[] tasks = new Task[3];
|
|
|
tasks[0] = Task.Factory.StartNew(() =>
|
|
|
{
|
|
|
dtCheck1 = SerSurMatSubService.GetHisC1RATE_NEW(QAGP);
|
|
|
});
|
|
|
tasks[1] = Task.Factory.StartNew(() =>
|
|
|
{
|
|
|
dtCheck2 = SerSurMatSubService.GetHisC2RATE_NEW(QAGP);
|
|
|
});
|
|
|
tasks[2] = Task.Factory.StartNew(() =>
|
|
|
{
|
|
|
dtCheck3 = SerSurMatSubService.GetHisC3RATE_NEW(QAGP);
|
|
|
});
|
|
|
//进程等待
|
|
|
Task.WaitAll(tasks);
|
|
|
|
|
|
|
|
|
//dtCheck2 = SerSurMatSubService.GetHisC2RATE_NEW(QAGP);
|
|
|
|
|
|
//dtCheck3 = SerSurMatSubService.GetHisC3RATE_NEW(QAGP);
|
|
|
|
|
|
//QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
//QAGP.END_TIME = DateTime.Now.AddDays(-1); ;
|
|
|
|
|
|
//dtCheck1 = SerSurMatSubService.GetHisC1RATE_NEW(QAGP);
|
|
|
|
|
|
IList<TB_SUB_ALL_RESULT> dtCheck = new List<TB_SUB_ALL_RESULT>();
|
|
|
|
|
|
//QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
//QAGP.END_TIME = DateTime.Now;
|
|
|
|
|
|
DateTime startDate = QAGP.START_TIME;
|
|
|
DateTime endDate = QAGP.END_TIME;
|
|
|
|
|
|
for (DateTime currentDate = startDate; currentDate <= endDate; currentDate = currentDate.AddDays(1))
|
|
|
{
|
|
|
|
|
|
TB_SUB_ALL_RESULT TSAR = new TB_SUB_ALL_RESULT();
|
|
|
|
|
|
TB_SUB_RESULT TSR1 = dtCheck1.Where(p => p.SUB_DATE == currentDate.ToString("yyyy-MM-dd")).FirstOrDefault();
|
|
|
|
|
|
TB_SUB_RESULT TSR2 = dtCheck2.Where(p => p.SUB_DATE == currentDate.ToString("yyyy-MM-dd")).FirstOrDefault();
|
|
|
|
|
|
TB_SUB_RESULT TSR3 = dtCheck3.Where(p => p.SUB_DATE == currentDate.ToString("yyyy-MM-dd")).FirstOrDefault();
|
|
|
|
|
|
//C1
|
|
|
try
|
|
|
{
|
|
|
if (TSR1 != null)
|
|
|
{
|
|
|
TSAR.MANMMDE_COUNT_C1 = TSR1.MANMMDE_COUNT;
|
|
|
TSAR.MANMMDE_YIELD_C1 = TSR1.MANMMDE_YIELD;
|
|
|
if (TSAR.MANMMDE_COUNT_C1 == null || TSAR.MANMMDE_COUNT_C1 == 0)
|
|
|
{
|
|
|
TSAR.MANMMDE_YIELD_C1 = 0;
|
|
|
}
|
|
|
if (TSAR.MANMMDE_YIELD_C1 > 100)
|
|
|
{
|
|
|
TSAR.MANMMDE_YIELD_C1 = 95;
|
|
|
}
|
|
|
//TSAR.SUB_DATE_C1 = TSR1.SUB_DATE;
|
|
|
TSAR.SUB_DATE_C1 = TSR2.SUB_DATE;
|
|
|
TSAR.SUB_DATE_C2 = TSR1.SUB_DATE;
|
|
|
TSAR.SUB_DATE_C3 = TSR1.SUB_DATE;
|
|
|
|
|
|
TSAR.SYS_COUNT_C1 = TSR1.SYS_COUNT;
|
|
|
TSAR.SYS_PERCENT_C1 = TSR1.SYS_PERCENT;
|
|
|
|
|
|
TSAR.SYS_YIELD_C1 = TSR1.SYS_YIELD;
|
|
|
if (TSAR.SYS_YIELD_C1 > 100)
|
|
|
{
|
|
|
TSAR.SYS_YIELD_C1 = 95;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
//C2
|
|
|
try
|
|
|
{
|
|
|
if (TSR2 != null)
|
|
|
{
|
|
|
TSAR.MANMMDE_COUNT_C2 = TSR2.MANMMDE_COUNT;
|
|
|
TSAR.MANMMDE_YIELD_C2 = TSR2.MANMMDE_YIELD;
|
|
|
if (TSAR.MANMMDE_COUNT_C2 == null || TSAR.MANMMDE_COUNT_C2 == 0)
|
|
|
{
|
|
|
TSAR.MANMMDE_YIELD_C2 = 0;
|
|
|
}
|
|
|
if (TSAR.MANMMDE_YIELD_C2 > 100)
|
|
|
{
|
|
|
TSAR.MANMMDE_YIELD_C2 = 95;
|
|
|
}
|
|
|
|
|
|
TSAR.SUB_DATE_C1 = TSR2.SUB_DATE;
|
|
|
TSAR.SUB_DATE_C2 = TSR1.SUB_DATE;
|
|
|
TSAR.SUB_DATE_C3 = TSR1.SUB_DATE;
|
|
|
|
|
|
TSAR.SYS_COUNT_C2 = TSR2.SYS_COUNT;
|
|
|
TSAR.SYS_PERCENT_C2 = TSR2.SYS_PERCENT;
|
|
|
TSAR.SYS_YIELD_C2 = TSR2.SYS_YIELD;
|
|
|
if (TSAR.SYS_YIELD_C2 > 100)
|
|
|
{
|
|
|
TSAR.SYS_YIELD_C2 = 95;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
//C3
|
|
|
try
|
|
|
{
|
|
|
if (TSR3 != null)
|
|
|
{
|
|
|
TSAR.MANMMDE_COUNT_C3 = TSR3.MANMMDE_COUNT;
|
|
|
TSAR.MANMMDE_YIELD_C3 = TSR3.MANMMDE_YIELD;
|
|
|
if (TSAR.MANMMDE_COUNT_C3 == null || TSAR.MANMMDE_COUNT_C3 == 0)
|
|
|
{
|
|
|
TSAR.MANMMDE_YIELD_C3 = 0;
|
|
|
}
|
|
|
if (TSAR.MANMMDE_YIELD_C3 > 100)
|
|
|
{
|
|
|
TSAR.MANMMDE_YIELD_C3 = 95;
|
|
|
}
|
|
|
|
|
|
TSAR.SUB_DATE_C1 = TSR2.SUB_DATE;
|
|
|
TSAR.SUB_DATE_C2 = TSR1.SUB_DATE;
|
|
|
TSAR.SUB_DATE_C3 = TSR1.SUB_DATE;
|
|
|
|
|
|
TSAR.SYS_COUNT_C3 = TSR3.SYS_COUNT;
|
|
|
TSAR.SYS_PERCENT_C3 = TSR3.SYS_PERCENT;
|
|
|
TSAR.SYS_YIELD_C3 = TSR3.SYS_YIELD;
|
|
|
if (TSAR.SYS_YIELD_C3 > 100)
|
|
|
{
|
|
|
TSAR.SYS_YIELD_C3 = 95;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
//汇总
|
|
|
try
|
|
|
{
|
|
|
IList<decimal> ltYileld1 = new List<decimal>();
|
|
|
|
|
|
|
|
|
ltYileld1.Add(ConverDataToDecimal(TSAR.MANMMDE_YIELD_C1));
|
|
|
ltYileld1.Add(ConverDataToDecimal(TSAR.MANMMDE_YIELD_C2));
|
|
|
ltYileld1.Add(ConverDataToDecimal(TSAR.MANMMDE_YIELD_C3));
|
|
|
|
|
|
IList<decimal> ltYileld2 = new List<decimal>();
|
|
|
|
|
|
ltYileld2.Add(ConverDataToDecimal(TSAR.SYS_YIELD_C1));
|
|
|
ltYileld2.Add(ConverDataToDecimal(TSAR.SYS_YIELD_C2));
|
|
|
ltYileld2.Add(ConverDataToDecimal(TSAR.SYS_YIELD_C3));
|
|
|
|
|
|
TSAR.MANMMDE_COUNT_ALL = ConverDataToDecimal(TSAR.MANMMDE_COUNT_C1) + ConverDataToDecimal(TSAR.MANMMDE_COUNT_C2) + ConverDataToDecimal(TSAR.MANMMDE_COUNT_C3);
|
|
|
if (ltYileld1.Where(p => p != 0).Count() == 0)
|
|
|
{
|
|
|
TSAR.MANMMDE_YIELD_ALL = 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
TSAR.MANMMDE_YIELD_ALL = Math.Round((ConverDataToDecimal(TSAR.MANMMDE_YIELD_C1) + ConverDataToDecimal(TSAR.MANMMDE_YIELD_C2) + ConverDataToDecimal(TSAR.MANMMDE_YIELD_C3)) / ltYileld1.Where(p => p != 0).Count(), 2);
|
|
|
}
|
|
|
//TSAR.MANMMDE_YIELD_ALL = Math.Round((ConverDataToDecimal(TSAR.MANMMDE_YIELD_C1) + ConverDataToDecimal(TSAR.MANMMDE_YIELD_C2) + ConverDataToDecimal(TSAR.MANMMDE_YIELD_C3)) / ltYileld1.Where(p => p != 0).Count(), 2);
|
|
|
TSAR.SUB_DATE_ALL = currentDate.ToString("yyyy-MM-dd");
|
|
|
TSAR.SYS_COUNT_ALL = ConverDataToDecimal(TSAR.SYS_COUNT_C1) + ConverDataToDecimal(TSAR.SYS_COUNT_C2) + ConverDataToDecimal(TSAR.SYS_COUNT_C3); //TSR3.SYS_COUNT;
|
|
|
TSAR.SYS_PERCENT_ALL = Math.Round((ConverDataToDecimal(TSAR.SYS_COUNT_ALL)) / (ConverDataToDecimal(TSAR.MANMMDE_COUNT_ALL) + ConverDataToDecimal(TSAR.SYS_COUNT_ALL)), 3) * 100;// TSR3.SYS_PERCENT;
|
|
|
if (ltYileld2.Where(p => p != 0).Count() == 0)
|
|
|
{
|
|
|
TSAR.SYS_YIELD_ALL = 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
TSAR.SYS_YIELD_ALL = Math.Round((ConverDataToDecimal(TSAR.SYS_YIELD_C1) + ConverDataToDecimal(TSAR.SYS_YIELD_C2) + ConverDataToDecimal(TSAR.SYS_YIELD_C3)) / ltYileld2.Where(p => p != 0).Count(), 2); // TSR3.SYS_YIELD;
|
|
|
}
|
|
|
//TSAR.SYS_YIELD_ALL = Math.Round((ConverDataToDecimal(TSAR.SYS_YIELD_C1) + ConverDataToDecimal(TSAR.SYS_YIELD_C2) + ConverDataToDecimal(TSAR.SYS_YIELD_C3)) / ltYileld2.Where(p=>p!=0).Count(), 2); // TSR3.SYS_YIELD;
|
|
|
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
dtCheck.Add(TSAR);
|
|
|
}
|
|
|
TB_SUB_ALL_RESULT TSAR2 = new TB_SUB_ALL_RESULT();
|
|
|
TSAR2.MANMMDE_COUNT_ALL = dtCheck.Sum(p => p.MANMMDE_COUNT_ALL);
|
|
|
TSAR2.MANMMDE_COUNT_C1 = dtCheck.Sum(p => p.MANMMDE_COUNT_C1);
|
|
|
TSAR2.MANMMDE_COUNT_C2 = dtCheck.Sum(p => p.MANMMDE_COUNT_C2);
|
|
|
TSAR2.MANMMDE_COUNT_C3 = dtCheck.Sum(p => p.MANMMDE_COUNT_C3);
|
|
|
TSAR2.MANMMDE_YIELD_ALL = dtCheck.Where(p => p.MANMMDE_YIELD_ALL != 0).Count() == 0 ? 0 : dtCheck.Sum(p => p.MANMMDE_YIELD_ALL) / dtCheck.Where(p => p.MANMMDE_YIELD_ALL != 0).Count();
|
|
|
TSAR2.MANMMDE_YIELD_C1 = dtCheck.Where(p => p.MANMMDE_YIELD_C1 != 0).Count() == 0 ? 0 : dtCheck.Sum(p => p.MANMMDE_YIELD_C1) / dtCheck.Where(p => p.MANMMDE_YIELD_C1 != 0).Count();
|
|
|
TSAR2.MANMMDE_YIELD_C2 = dtCheck.Where(p => p.MANMMDE_YIELD_C2 != 0).Count() == 0 ? 0 : dtCheck.Sum(p => p.MANMMDE_YIELD_C2) / dtCheck.Where(p => p.MANMMDE_YIELD_C2 != 0).Count();
|
|
|
TSAR2.MANMMDE_YIELD_C3 = dtCheck.Where(p => p.MANMMDE_YIELD_C3 != 0).Count() == 0 ? 0 : dtCheck.Sum(p => p.MANMMDE_YIELD_C3) / dtCheck.Where(p => p.MANMMDE_YIELD_C3 != 0).Count();
|
|
|
TSAR2.SUB_DATE_ALL = "总计";
|
|
|
TSAR2.SUB_DATE_C1 = "总计";
|
|
|
TSAR2.SUB_DATE_C2 = "总计";
|
|
|
TSAR2.SUB_DATE_C3 = "总计";
|
|
|
TSAR2.SYS_COUNT_ALL = dtCheck.Sum(p => p.SYS_COUNT_ALL);
|
|
|
TSAR2.SYS_COUNT_C1 = dtCheck.Sum(p => p.SYS_COUNT_C1);
|
|
|
TSAR2.SYS_COUNT_C2 = dtCheck.Sum(p => p.SYS_COUNT_C2);
|
|
|
TSAR2.SYS_COUNT_C3 = dtCheck.Sum(p => p.SYS_COUNT_C3);
|
|
|
TSAR2.SYS_YIELD_ALL = dtCheck.Where(p => p.SYS_YIELD_ALL != 0).Count() == 0 ? 0 : dtCheck.Sum(p => p.SYS_YIELD_ALL) / dtCheck.Where(p => p.SYS_YIELD_ALL != 0).Count();
|
|
|
TSAR2.SYS_YIELD_C1 = dtCheck.Where(p => p.SYS_YIELD_C1 != 0).Count() == 0 ? 0 : dtCheck.Sum(p => p.SYS_YIELD_C1) / dtCheck.Where(p => p.SYS_YIELD_C1 != 0 && p.SYS_YIELD_C1 != null).Count();
|
|
|
TSAR2.SYS_YIELD_C2 = dtCheck.Where(p => p.SYS_YIELD_C2 != 0).Count() == 0 ? 0 : dtCheck.Sum(p => p.SYS_YIELD_C2) / dtCheck.Where(p => p.SYS_YIELD_C2 != 0 && p.SYS_YIELD_C2 != null).Count();
|
|
|
TSAR2.SYS_YIELD_C3 = dtCheck.Where(p => p.SYS_YIELD_C3 != 0).Count() == 0 ? 0 : dtCheck.Sum(p => p.SYS_YIELD_C3) / dtCheck.Where(p => p.SYS_YIELD_C3 != 0 && p.SYS_YIELD_C3 != null).Count();
|
|
|
TSAR2.SYS_PERCENT_ALL = TSAR2.MANMMDE_COUNT_ALL + TSAR2.SYS_COUNT_ALL > 0 ? TSAR2.SYS_COUNT_ALL / (TSAR2.MANMMDE_COUNT_ALL + TSAR2.SYS_COUNT_ALL) : 0;
|
|
|
TSAR2.SYS_PERCENT_C1 = TSAR2.MANMMDE_COUNT_C1 + TSAR2.SYS_COUNT_C1 > 0 ? TSAR2.SYS_COUNT_C1 / (TSAR2.MANMMDE_COUNT_C1 + TSAR2.SYS_COUNT_C1) : 0;
|
|
|
TSAR2.SYS_PERCENT_C2 = TSAR2.MANMMDE_COUNT_C2 + TSAR2.SYS_COUNT_C2 > 0 ? TSAR2.SYS_COUNT_C2 / (TSAR2.MANMMDE_COUNT_C2 + TSAR2.SYS_COUNT_C2) : 0;
|
|
|
TSAR2.SYS_PERCENT_C3 = TSAR2.MANMMDE_COUNT_C3 + TSAR2.SYS_COUNT_C3 > 0 ? TSAR2.SYS_COUNT_C3 / (TSAR2.MANMMDE_COUNT_C3 + TSAR2.SYS_COUNT_C3) : 0;
|
|
|
|
|
|
TSAR2.SYS_PERCENT_ALL = Math.Round((decimal)TSAR2.SYS_PERCENT_ALL * 100, 2);
|
|
|
TSAR2.SYS_PERCENT_C1 = Math.Round((decimal)TSAR2.SYS_PERCENT_C1 * 100, 2);
|
|
|
TSAR2.SYS_PERCENT_C2 = Math.Round((decimal)TSAR2.SYS_PERCENT_C2 * 100, 2);
|
|
|
TSAR2.SYS_PERCENT_C3 = Math.Round((decimal)TSAR2.SYS_PERCENT_C3 * 100, 2);
|
|
|
TSAR2.MANMMDE_YIELD_ALL = Math.Round((decimal)TSAR2.MANMMDE_YIELD_ALL, 2);
|
|
|
TSAR2.MANMMDE_YIELD_C1 = Math.Round((decimal)TSAR2.MANMMDE_YIELD_C1, 2);
|
|
|
TSAR2.MANMMDE_YIELD_C2 = Math.Round((decimal)TSAR2.MANMMDE_YIELD_C2, 2);
|
|
|
TSAR2.MANMMDE_YIELD_C3 = Math.Round((decimal)TSAR2.MANMMDE_YIELD_C3, 2);
|
|
|
TSAR2.SYS_YIELD_ALL = Math.Round((decimal)TSAR2.SYS_YIELD_ALL, 2);
|
|
|
TSAR2.SYS_YIELD_C1 = Math.Round((decimal)TSAR2.SYS_YIELD_C1, 2);
|
|
|
TSAR2.SYS_YIELD_C2 = Math.Round((decimal)TSAR2.SYS_YIELD_C2, 2);
|
|
|
TSAR2.SYS_YIELD_C3 = Math.Round((decimal)TSAR2.SYS_YIELD_C3, 2);
|
|
|
|
|
|
dtCheck.Add(TSAR2);
|
|
|
|
|
|
foreach (TB_SUB_RESULT item in dtCheck1)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
if (dtCheck.Count > 0)
|
|
|
{
|
|
|
|
|
|
//获取历史数据
|
|
|
result.data = dtCheck;
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//获取历史数据
|
|
|
result.data = dtCheck;
|
|
|
result.msg = "无数据!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetAllHisDataWGT 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
[HttpPost, Route("GetAllHisSMPDataWGT")]
|
|
|
public RequestEntity GetAllHisSMPDataWGT(GpPlateQueryArgs QAGP)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
if (QAGP.START_TIME == DateTime.MinValue && QAGP.END_TIME == DateTime.MinValue)
|
|
|
{
|
|
|
QAGP.START_TIME = DateTime.Now.AddDays(-6);
|
|
|
QAGP.END_TIME = DateTime.Now;
|
|
|
}
|
|
|
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
strSql.AppendLine(" SELECT ");
|
|
|
strSql.AppendLine(" CASE ");
|
|
|
strSql.AppendLine(" WHEN GROUPING(TRUNC(TO_DATE(INS_DATE, 'YYYYMMDDHH24MISS'))) = 1 ");
|
|
|
strSql.AppendLine(" THEN '合计' ");
|
|
|
strSql.AppendLine(" ELSE TO_CHAR(TRUNC(TO_DATE(INS_DATE, 'YYYYMMDDHH24MISS')), 'YYYY-MM-DD') ");
|
|
|
strSql.AppendLine(" END AS INS_DATE, ");
|
|
|
strSql.AppendLine(" COUNT(PLATE_NO) AS CNT, ");
|
|
|
strSql.AppendLine(" SUM(TO_NUMBER(COSTS)) AS COSTS ");
|
|
|
strSql.AppendLine("FROM ");
|
|
|
|
|
|
strSql.AppendLine(" PDI_SMP_NO ");
|
|
|
|
|
|
strSql.AppendLine(" WHERE 1=1 ");
|
|
|
|
|
|
if (QAGP.START_TIME != DateTime.MinValue)
|
|
|
{
|
|
|
strSql.AppendLine(" AND TO_CHAR(TO_DATE(INS_DATE, 'yyyy-MM-dd HH24:mi:ss'), 'yyyyMMdd') >= TO_CHAR(TO_DATE('" + QAGP.START_TIME.ToString("yyyy-MM-dd") + "','yyyy-MM-dd HH24:mi:ss'), 'yyyyMMdd')");
|
|
|
}
|
|
|
if (QAGP.END_TIME != DateTime.MinValue)
|
|
|
{
|
|
|
strSql.AppendLine(" AND TO_CHAR(TO_DATE(INS_DATE, 'yyyy-MM-dd HH24:mi:ss'), 'yyyyMMdd') <= TO_CHAR(TO_DATE('" + QAGP.END_TIME + "','yyyy-MM-dd HH24:mi:ss'), 'yyyyMMdd')");
|
|
|
}
|
|
|
|
|
|
//strSql.AppendLine(" WHERE TO_DATE(INS_DATE, 'YYYYMMDDHH24MISS') ");
|
|
|
//strSql.AppendLine(" BETWEEN TO_DATE('20240601', 'YYYYMMDD') ");
|
|
|
//strSql.AppendLine(" AND TO_DATE('20240630', 'YYYYMMDD') ");
|
|
|
strSql.AppendLine("GROUP BY ");
|
|
|
strSql.AppendLine(" ROLLUP(TRUNC(TO_DATE(INS_DATE, 'YYYYMMDDHH24MISS'))) ");
|
|
|
strSql.AppendLine("ORDER BY ");
|
|
|
strSql.AppendLine(" INS_DATE ");
|
|
|
|
|
|
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
result.data = db.Query(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("getSlabConf 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// Null转换Decimal
|
|
|
/// </summary>
|
|
|
/// <param name="obj">参数</param>
|
|
|
/// <returns></returns>
|
|
|
public static decimal ConverDataToDecimal(object obj)
|
|
|
{
|
|
|
if (obj == null)
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return Convert.ToDecimal(obj);
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 板坯指定替代
|
|
|
/// <summary>
|
|
|
/// 参数校验
|
|
|
/// </summary>
|
|
|
/// <param name="cncs"></param>
|
|
|
/// /// <param name="result"></param>
|
|
|
/// <returns>是否通过参数校验</returns>
|
|
|
public bool ParameterCalibration(TB_SLAB_APPOINTSUBSTITUTE cncs, RequestEntity result)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
|
|
|
if (CommonUtils.GetLength(cncs.ORD_ITEM) > 100)
|
|
|
{
|
|
|
result.msg = "订单探项次号不可超过100!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
if (CommonUtils.GetLength(cncs.ORD_NO) > 100)
|
|
|
{
|
|
|
result.msg = "订单长度不可超过100!";
|
|
|
result.code = "0";
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
#endregion
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 查询接口
|
|
|
/// </summary>
|
|
|
/// <param name="queryArgs"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("GetTbSlabAS")]
|
|
|
public RequestEntity GetTbSlabAS(TB_SLAB_APPOINTSUBSTITUTE query)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
//查询
|
|
|
strSql.AppendLine("SELECT SLAB_NO, ORD_NO, ORD_ITEM, REMARKS, 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 TB_SLAB_APPOINTSUBSTITUTE WHERE 1 = 1 ");
|
|
|
if (query != null)
|
|
|
{
|
|
|
if (!string.IsNullOrWhiteSpace(query.SLAB_NO))
|
|
|
strSql.AppendLine(" AND SLAB_NO LIKE '%" + query.SLAB_NO + "%'");
|
|
|
if (!string.IsNullOrWhiteSpace(query.ORD_NO))
|
|
|
strSql.AppendLine(" AND ORD_NO LIKE '%" + query.ORD_NO + "%'");
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(query.ORD_ITEM))
|
|
|
strSql.AppendLine(" AND ORD_ITEM LIKE '%" + query.ORD_ITEM + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
strSql.AppendLine("Order By INS_DATE DESC ");
|
|
|
dtCheck = db.Query(strSql.ToString());
|
|
|
// result.data = db.Query<TB_SLAB_APPOINTSUBSTITUTE>(strSql.ToString());
|
|
|
if (dtCheck.Rows.Count > 0)
|
|
|
{
|
|
|
result.data = dtCheck;
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "未找到查询所需数据!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetTbUstFl 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddTbSlabAS")]
|
|
|
public RequestEntity AddTbSlabAS(IList<TB_SLAB_APPOINTSUBSTITUTE> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_SLAB_APPOINTSUBSTITUTE model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.ORD_NO) || string.IsNullOrEmpty(model.ORD_ITEM))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
if (!ParameterCalibration(model, result))
|
|
|
{
|
|
|
db.Rollback();
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
model.ORD_NO = model.ORD_NO.Trim();
|
|
|
model.SLAB_NO = model.SLAB_NO.Trim();
|
|
|
model.ORD_ITEM = model.ORD_ITEM.ToString().PadLeft(3, '0');
|
|
|
model.INS_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
model.INS_TIME = dtNow.ToString("HHmmss");
|
|
|
model.UPD_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
model.UPD_TIME = dtNow.ToString("HHmmss");
|
|
|
if (db.Insert<TB_SLAB_APPOINTSUBSTITUTE>(model) == 0)
|
|
|
{
|
|
|
b = false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddTbSlabAS 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#region 优先匹配订单接口
|
|
|
|
|
|
[HttpPost, Route("getTbSlabInfo")]
|
|
|
public RequestEntity getTbSlabInfo(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetSlabInfo(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetSurplusMaterials 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
public IList<TB_SLAB> GetSlabInfo(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<TB_SLAB> ltSlab = new List<TB_SLAB>();
|
|
|
|
|
|
|
|
|
StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_SLAB> ltSlabC3 = new List<TB_SLAB>();
|
|
|
strSqlC3.AppendLine("SELECT SLAB_NO ,(SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STEEL_GRD_DETAIL" +
|
|
|
", OCCR_CD, PLT, PRC_LINE, REC_STS, PROC_CD" +
|
|
|
", BEF_PROC_CD, PROD_CD, (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STLGRD" +
|
|
|
", THK" +
|
|
|
", CASE WHEN A.WID>A.LEN THEN A.LEN ELSE A.WID END WID " +
|
|
|
", CASE WHEN A.WID<A.LEN THEN A.LEN ELSE A.WID END LEN " +
|
|
|
", WGT, CAL_WGT" +
|
|
|
", THK_GRP, WID_GRP, OVER_FL, ORD_FL" +
|
|
|
", WOO_RSN, ORD_NO, ORD_ITEM, ORG_ORD_NO" +
|
|
|
", ORG_ORD_ITEM, ENDUSE_CD, DEL_TO_DATE, PROD_DATE" +
|
|
|
", PROD_TIME, SHIFT, GROUP_CD, LOC, BED_PILE_DATE" +
|
|
|
", SMP_FL, SMP_LOC, SMP_LEN, SMP_NO, INSP_EMP, DSC_DATE" +
|
|
|
", DSC_TIME, PROD_GRD, SURF_GRD, QUALITY_GRD, QUALITY_UPD_GRD" +
|
|
|
", APLY_STDSPEC, APLY_ENDUSE_CD, IN_PLT_CD, IN_PLT, IN_PLT_DATE" +
|
|
|
", IN_PLT_TIME, IN_CAR_NO, IN_SHEET_NO, IN_PLT_CO, OUT_PLT_CD" +
|
|
|
", OUT_PLT, OUT_PLT_DATE, OUT_PLT_TIME, OUT_CAR_NO, OUT_SHEET_NO" +
|
|
|
", HOUSING_DATE, HOUSING_TIME, SHP_IST_NO, SHP_IST_DATE, SHP_IST_TIME" +
|
|
|
", SHP_DATE, SHP_TIME, TRNS_NO, CAR_NO, TRNS_CMPY_CD, SHP_EMP, TRAIN_LINE_NAME" +
|
|
|
", DEST_DETAIL, CERT_RPT_FL, CERT_RPT_DATE, CERT_RPT_TIME, SHP_IST_CAN_DATE" +
|
|
|
", SHP_IST_CAN_TIME, SHP_IST_CAN_FL, INS_DATE, INS_EMP_CD, INS_PGMID, UPD_DATE" +
|
|
|
", UPD_EMP_CD, UPD_PGM, SF_ORNOT, SLAB_RHF_IN_DATE, RHF_REJ_ORNOT, AIM_HCR_KND" +
|
|
|
", HCR_KND, PRC, SCR_ORNOT, END_RES, MOTHER_SLAB, ORD_THK, ORD_WID, ORD_LEN" +
|
|
|
", ORD_WGT, QUALITY_ID, TAPER_LEN, HEAD_SLAB_WID, TAIL_SLAB_WID, CUST_CD" +
|
|
|
", IN_SLAB_NO, CUR_HCR_KND, WGT_L2, QUALITY_ID_L2, CUR_INV, SIZE_KND, MIXED_FL" +
|
|
|
", BAOXIN_IF_DATE, CUST_SPEC_NO, STLGRD_UPD_FL, BEF_STLGRD, WGT_CAL_L2, LOAD_WGT" +
|
|
|
", CHG_GRD_RES, MAT_OWNER_FL, MAT_OWNER_CUST_CD, PLAN_MILL_PLT, USE_MILL_PLT, PLAN_SLAB_CUT_CNT" +
|
|
|
", CLAIM_RES, CLAIM_DATE, CLAIM_THK, CLAIM_WID, CLAIM_LEN, CLAIM_WGT, HTM_ORD_METH, HTM_RLT_METH" +
|
|
|
", HTM_STATUS, SLAB_BACK_CNT, CUT_CNT, HTM_CNT, ERP_IF_DATE, PLAN_SLAB_CUT_FL, INGOT_FL, HEAD_SLAB_THK" +
|
|
|
", TAIL_SLAB_THK, PLAN_SLAB_MERGE_FL, MOTHER_SLAB_MERGE, GRID_FL, GRID_RSLT, HEAT_NO, RH_CD" +
|
|
|
", CAL_TM, CAL_TN, ACT_SMP_FL, SMP_NO1, SMP_NO2, GET_SMP_DATE, SMP_CAST_NO, SMP_FREQENCY" +
|
|
|
", SMP_NOTE, SMP_NOTE1, SMP_NOTE2, SLAB_NO1, SLAB_NO2, UST_RLT_CD, UST_RSLT, UST_METH" +
|
|
|
", CUT_AM, CUT_BM, CUT_CM, CUT_DM, CUT_EM, CUT_FM, MOTHER_SLAB_BILLET, BILLET_TYPE" +
|
|
|
", MOTHER_SLAB_ELEC, RES_CM, RES_DM, RES_EM, RES_FM, RES_GM" +
|
|
|
", CASE WHEN A.WID<A.LEN THEN A.LEN ELSE A.WID END REM_LEN " +
|
|
|
", A.WGT REM_WGT " +
|
|
|
", A.LEN ORG_LEN " +
|
|
|
", A.WID ORG_WID" +
|
|
|
", CASE WHEN (SELECT COUNT(HEAT_NO) FROM NISCO.FP_RHRSLT WHERE HEAT_NO = SUBSTR(A.SLAB_NO,1,8))>0 THEN '1' ELSE '0' END VAC_FLG ");
|
|
|
strSqlC3.AppendLine(",(CASE WHEN(SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET CSDD WHERE (CSDD.EST_CD LIKE '5%' OR CSDD.EST_CD LIKE '6%') AND CSDD.SLAB_NO = A.SLAB_NO) > 0 THEN '1'");
|
|
|
strSqlC3.AppendLine(" WHEN(SELECT COUNT(*) FROM(SELECT COM FROM(SELECT CSDD_C.EST_CD || '_' || CSDD_C.EST_COMMENT COM FROM NISCO.CP_SLAB_DELI_DET CSDD_C ");
|
|
|
strSqlC3.AppendLine(" WHERE CSDD_C.SLAB_NO = A.SLAB_NO ORDER BY CSDD_C.EST_DATE DESC) T_COM WHERE ROWNUM = 1) T_L WHERE T_L.COM LIKE '%协议%') > 0 THEN '1' ");
|
|
|
strSqlC3.AppendLine(" ELSE '0' END ) XY_FLG ");
|
|
|
strSqlC3.AppendLine(",(SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
strSqlC3.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
strSqlC3.AppendLine(" WHERE SLAB_NO = A.SLAB_NO ");
|
|
|
strSqlC3.AppendLine(" AND EST_CD IS NOT NULL) || ' ' || ");
|
|
|
strSqlC3.AppendLine(" (CASE WHEN A.MOTHER_SLAB IS NOT NULL AND LENGTH(A.MOTHER_SLAB) = 10 THEN ");
|
|
|
strSqlC3.AppendLine(" (SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
strSqlC3.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
strSqlC3.AppendLine(" WHERE SLAB_NO = A.MOTHER_SLAB ");
|
|
|
strSqlC3.AppendLine(" AND EST_CD IS NOT NULL) ");
|
|
|
strSqlC3.AppendLine(" ELSE '' ");
|
|
|
strSqlC3.AppendLine(" END ) EST_COMMENT ");
|
|
|
strSqlC3.AppendLine("FROM NISCO.FP_SLAB A ");
|
|
|
strSqlC3.AppendLine("WHERE 1 = 1 ");
|
|
|
strSqlC3.AppendLine(" AND A.CUR_INV IN( 'ZB','00','ZZ','HB') ");//
|
|
|
strSqlC3.AppendLine(" AND( (A.PROC_CD = 'CAC' AND (SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0002','0003','2010') ) = 0) OR ");
|
|
|
strSqlC3.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C " +
|
|
|
"WHERE C.SLAB_NO = A.SLAB_NO " +
|
|
|
"AND C.REASON_CD IN ('1080','2014','2015','2018','2026','3014','5011','5013','8081') " +
|
|
|
"AND EST_CD IS NULL) >0) ");
|
|
|
strSqlC3.AppendLine(" AND A.PROC_CD = 'CAD' ) ");
|
|
|
strSqlC3.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('2010','0002')) < 1 ) ");
|
|
|
strSqlC3.AppendLine(" AND A.ORD_FL = '2' ");
|
|
|
strSqlC3.AppendLine(" AND A.REC_STS = '2' ");
|
|
|
strSqlC3.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
strSqlC3.AppendLine(" AND A.WGT > 0 ");
|
|
|
strSqlC3.AppendLine(" AND NVL(A.PLAN_SLAB_CUT_FL,'N') = 'N' ");
|
|
|
strSqlC3.AppendLine(" AND SUBSTR(A.SLAB_NO,3,1) <> 'F' ");
|
|
|
strSqlC3.AppendLine(" AND NVL(A.QUALITY_UPD_GRD, 'N') NOT IN('N','E') ");
|
|
|
strSqlC3.AppendLine(" AND NVL(A.PLAN_MILL_PLT , ' ') LIKE 'C3' || '%' ");
|
|
|
strSqlC3.AppendLine(" AND((GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 800 AND A.THK > 50) ");
|
|
|
strSqlC3.AppendLine(" OR(GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 850 AND A.THK = 50))---短尺 ");
|
|
|
strSqlC3.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO) < 1 )");
|
|
|
strSqlC3.AppendLine(" AND A.WGT <31");
|
|
|
|
|
|
//c2
|
|
|
|
|
|
StringBuilder strSqlC2 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_SLAB> ltSlabC2 = new List<TB_SLAB>();
|
|
|
strSqlC2.AppendLine("SELECT SLAB_NO ,(SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STEEL_GRD_DETAIL" +
|
|
|
", OCCR_CD, PLT, PRC_LINE, REC_STS, PROC_CD" +
|
|
|
", BEF_PROC_CD, PROD_CD, (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STLGRD" +
|
|
|
", THK" +
|
|
|
", CASE WHEN A.WID>A.LEN THEN A.LEN ELSE A.WID END WID " +
|
|
|
", CASE WHEN A.WID<A.LEN THEN A.LEN ELSE A.WID END LEN " +
|
|
|
", WGT, CAL_WGT" +
|
|
|
", THK_GRP, WID_GRP, OVER_FL, ORD_FL" +
|
|
|
", WOO_RSN, ORD_NO, ORD_ITEM, ORG_ORD_NO" +
|
|
|
", ORG_ORD_ITEM, ENDUSE_CD, DEL_TO_DATE, PROD_DATE" +
|
|
|
", PROD_TIME, SHIFT, GROUP_CD, LOC, BED_PILE_DATE" +
|
|
|
", SMP_FL, SMP_LOC, SMP_LEN, SMP_NO, INSP_EMP, DSC_DATE" +
|
|
|
", DSC_TIME, PROD_GRD, SURF_GRD, QUALITY_GRD, QUALITY_UPD_GRD" +
|
|
|
", APLY_STDSPEC, APLY_ENDUSE_CD, IN_PLT_CD, IN_PLT, IN_PLT_DATE" +
|
|
|
", IN_PLT_TIME, IN_CAR_NO, IN_SHEET_NO, IN_PLT_CO, OUT_PLT_CD" +
|
|
|
", OUT_PLT, OUT_PLT_DATE, OUT_PLT_TIME, OUT_CAR_NO, OUT_SHEET_NO" +
|
|
|
", HOUSING_DATE, HOUSING_TIME, SHP_IST_NO, SHP_IST_DATE, SHP_IST_TIME" +
|
|
|
", SHP_DATE, SHP_TIME, TRNS_NO, CAR_NO, TRNS_CMPY_CD, SHP_EMP, TRAIN_LINE_NAME" +
|
|
|
", DEST_DETAIL, CERT_RPT_FL, CERT_RPT_DATE, CERT_RPT_TIME, SHP_IST_CAN_DATE" +
|
|
|
", SHP_IST_CAN_TIME, SHP_IST_CAN_FL, INS_DATE, INS_EMP_CD, INS_PGMID, UPD_DATE" +
|
|
|
", UPD_EMP_CD, UPD_PGM, SF_ORNOT, SLAB_RHF_IN_DATE, RHF_REJ_ORNOT, AIM_HCR_KND" +
|
|
|
", HCR_KND, PRC, SCR_ORNOT, END_RES, MOTHER_SLAB, ORD_THK, ORD_WID, ORD_LEN" +
|
|
|
", ORD_WGT, QUALITY_ID, TAPER_LEN, HEAD_SLAB_WID, TAIL_SLAB_WID, CUST_CD" +
|
|
|
", IN_SLAB_NO, CUR_HCR_KND, WGT_L2, QUALITY_ID_L2, CUR_INV, SIZE_KND, MIXED_FL" +
|
|
|
", BAOXIN_IF_DATE, CUST_SPEC_NO, STLGRD_UPD_FL, BEF_STLGRD, WGT_CAL_L2, LOAD_WGT" +
|
|
|
", CHG_GRD_RES, MAT_OWNER_FL, MAT_OWNER_CUST_CD, PLAN_MILL_PLT, USE_MILL_PLT, PLAN_SLAB_CUT_CNT" +
|
|
|
", CLAIM_RES, CLAIM_DATE, CLAIM_THK, CLAIM_WID, CLAIM_LEN, CLAIM_WGT, HTM_ORD_METH, HTM_RLT_METH" +
|
|
|
", HTM_STATUS, SLAB_BACK_CNT, CUT_CNT, HTM_CNT, ERP_IF_DATE, PLAN_SLAB_CUT_FL, INGOT_FL, HEAD_SLAB_THK" +
|
|
|
", TAIL_SLAB_THK, PLAN_SLAB_MERGE_FL, MOTHER_SLAB_MERGE, GRID_FL, GRID_RSLT, HEAT_NO, RH_CD" +
|
|
|
", CAL_TM, CAL_TN, ACT_SMP_FL, SMP_NO1, SMP_NO2, GET_SMP_DATE, SMP_CAST_NO, SMP_FREQENCY" +
|
|
|
", SMP_NOTE, SMP_NOTE1, SMP_NOTE2, SLAB_NO1, SLAB_NO2, UST_RLT_CD, UST_RSLT, UST_METH" +
|
|
|
", CUT_AM, CUT_BM, CUT_CM, CUT_DM, CUT_EM, CUT_FM, MOTHER_SLAB_BILLET, BILLET_TYPE" +
|
|
|
", MOTHER_SLAB_ELEC, RES_CM, RES_DM, RES_EM, RES_FM, RES_GM" +
|
|
|
", CASE WHEN A.WID<A.LEN THEN A.LEN ELSE A.WID END REM_LEN " +
|
|
|
", A.WGT REM_WGT " +
|
|
|
", A.LEN ORG_LEN " +
|
|
|
", A.WID ORG_WID" +
|
|
|
", CASE WHEN (SELECT COUNT(HEAT_NO) FROM NISCO.FP_RHRSLT WHERE HEAT_NO = SUBSTR(A.SLAB_NO,1,8))>0 THEN '1' ELSE '0' END VAC_FLG ");
|
|
|
strSqlC2.AppendLine(",(CASE WHEN(SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET CSDD WHERE (CSDD.EST_CD LIKE '5%' OR CSDD.EST_CD LIKE '6%') AND CSDD.SLAB_NO = A.SLAB_NO) > 0 THEN '1'");
|
|
|
strSqlC2.AppendLine(" WHEN(SELECT COUNT(*) FROM(SELECT COM FROM(SELECT CSDD_C.EST_CD || '_' || CSDD_C.EST_COMMENT COM FROM NISCO.CP_SLAB_DELI_DET CSDD_C ");
|
|
|
strSqlC2.AppendLine(" WHERE CSDD_C.SLAB_NO = A.SLAB_NO ORDER BY CSDD_C.EST_DATE DESC) T_COM WHERE ROWNUM = 1) T_L WHERE T_L.COM LIKE '%协议%') > 0 THEN '1' ");
|
|
|
strSqlC2.AppendLine(" ELSE '0' END ) XY_FLG ");
|
|
|
strSqlC2.AppendLine(",(SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
strSqlC2.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
strSqlC2.AppendLine(" WHERE SLAB_NO = A.SLAB_NO ");
|
|
|
strSqlC2.AppendLine(" AND EST_CD IS NOT NULL) || ' ' || ");
|
|
|
strSqlC2.AppendLine(" (CASE WHEN A.MOTHER_SLAB IS NOT NULL AND LENGTH(A.MOTHER_SLAB) = 10 THEN ");
|
|
|
strSqlC2.AppendLine(" (SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
strSqlC2.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
strSqlC2.AppendLine(" WHERE SLAB_NO = A.MOTHER_SLAB ");
|
|
|
strSqlC2.AppendLine(" AND EST_CD IS NOT NULL) ");
|
|
|
strSqlC2.AppendLine(" ELSE '' ");
|
|
|
strSqlC2.AppendLine(" END ) EST_COMMENT ");
|
|
|
strSqlC2.AppendLine("FROM NISCO.FP_SLAB A ");
|
|
|
strSqlC2.AppendLine("WHERE 1 = 1 ");
|
|
|
strSqlC2.AppendLine(" AND A.CUR_INV in ( 'ZB','00','ZZ','HB') ");
|
|
|
strSqlC2.AppendLine(" AND(A.PROC_CD = 'CAC' OR ");
|
|
|
strSqlC2.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.REASON_CD NOT IN('1080','2014','2015','2018','2026','3014','5011','5013','8081') AND EST_CD IS NULL) < 1)");
|
|
|
strSqlC2.AppendLine(" AND A.PROC_CD='CAD' ) ");
|
|
|
strSqlC2.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0002','0003','2010')) < 1 )");
|
|
|
strSqlC2.AppendLine(" AND A.ORD_FL = '2' ");
|
|
|
strSqlC2.AppendLine(" AND A.REC_STS = '2' ");
|
|
|
strSqlC2.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
strSqlC2.AppendLine(" AND A.WGT > 0 ");
|
|
|
strSqlC2.AppendLine(" AND NVL(A.PLAN_SLAB_CUT_FL,'N') = 'N' ");
|
|
|
strSqlC2.AppendLine(" AND NVL(A.QUALITY_UPD_GRD, 'N') NOT IN('N','E') ");
|
|
|
strSqlC2.AppendLine(" AND LEAST(A.WID, A.LEN) >= 1600 ");
|
|
|
strSqlC2.AppendLine(" AND GREATEST(A.WID, A.LEN) >= 2500 ");
|
|
|
strSqlC2.AppendLine(" AND A.THK >= 120 ");
|
|
|
strSqlC2.AppendLine(" AND NVL(A.PLAN_SLAB_MERGE_FL,'N') = 'N' ");
|
|
|
strSqlC2.AppendLine(" AND NVL(A.PLAN_MILL_PLT,'N') LIKE 'C2' || '%' ");
|
|
|
strSqlC2.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO) < 1 )");
|
|
|
|
|
|
//c1
|
|
|
|
|
|
StringBuilder strSqlC1 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_SLAB> ltSlabC1 = new List<TB_SLAB>();
|
|
|
strSqlC1.AppendLine("SELECT SLAB_NO ,(SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STEEL_GRD_DETAIL" +
|
|
|
", OCCR_CD, PLT, PRC_LINE, REC_STS, PROC_CD" +
|
|
|
", BEF_PROC_CD, PROD_CD, (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STLGRD" +
|
|
|
", THK" +
|
|
|
", CASE WHEN A.WID>A.LEN THEN A.LEN ELSE A.WID END WID " +
|
|
|
", CASE WHEN A.WID<A.LEN THEN A.LEN ELSE A.WID END LEN " +
|
|
|
", WGT, CAL_WGT" +
|
|
|
", THK_GRP, WID_GRP, OVER_FL, ORD_FL" +
|
|
|
", WOO_RSN, ORD_NO, ORD_ITEM, ORG_ORD_NO" +
|
|
|
", ORG_ORD_ITEM, ENDUSE_CD, DEL_TO_DATE, PROD_DATE" +
|
|
|
", PROD_TIME, SHIFT, GROUP_CD, LOC, BED_PILE_DATE" +
|
|
|
", SMP_FL, SMP_LOC, SMP_LEN, SMP_NO, INSP_EMP, DSC_DATE" +
|
|
|
", DSC_TIME, PROD_GRD, SURF_GRD, QUALITY_GRD, QUALITY_UPD_GRD" +
|
|
|
", APLY_STDSPEC, APLY_ENDUSE_CD, IN_PLT_CD, IN_PLT, IN_PLT_DATE" +
|
|
|
", IN_PLT_TIME, IN_CAR_NO, IN_SHEET_NO, IN_PLT_CO, OUT_PLT_CD" +
|
|
|
", OUT_PLT, OUT_PLT_DATE, OUT_PLT_TIME, OUT_CAR_NO, OUT_SHEET_NO" +
|
|
|
", HOUSING_DATE, HOUSING_TIME, SHP_IST_NO, SHP_IST_DATE, SHP_IST_TIME" +
|
|
|
", SHP_DATE, SHP_TIME, TRNS_NO, CAR_NO, TRNS_CMPY_CD, SHP_EMP, TRAIN_LINE_NAME" +
|
|
|
", DEST_DETAIL, CERT_RPT_FL, CERT_RPT_DATE, CERT_RPT_TIME, SHP_IST_CAN_DATE" +
|
|
|
", SHP_IST_CAN_TIME, SHP_IST_CAN_FL, INS_DATE, INS_EMP_CD, INS_PGMID, UPD_DATE" +
|
|
|
", UPD_EMP_CD, UPD_PGM, SF_ORNOT, SLAB_RHF_IN_DATE, RHF_REJ_ORNOT, AIM_HCR_KND" +
|
|
|
", HCR_KND, PRC, SCR_ORNOT, END_RES, MOTHER_SLAB, ORD_THK, ORD_WID, ORD_LEN" +
|
|
|
", ORD_WGT, QUALITY_ID, TAPER_LEN, HEAD_SLAB_WID, TAIL_SLAB_WID, CUST_CD" +
|
|
|
", IN_SLAB_NO, CUR_HCR_KND, WGT_L2, QUALITY_ID_L2, CUR_INV, SIZE_KND, MIXED_FL" +
|
|
|
", BAOXIN_IF_DATE, CUST_SPEC_NO, STLGRD_UPD_FL, BEF_STLGRD, WGT_CAL_L2, LOAD_WGT" +
|
|
|
", CHG_GRD_RES, MAT_OWNER_FL, MAT_OWNER_CUST_CD, PLAN_MILL_PLT, USE_MILL_PLT, PLAN_SLAB_CUT_CNT" +
|
|
|
", CLAIM_RES, CLAIM_DATE, CLAIM_THK, CLAIM_WID, CLAIM_LEN, CLAIM_WGT, HTM_ORD_METH, HTM_RLT_METH" +
|
|
|
", HTM_STATUS, SLAB_BACK_CNT, CUT_CNT, HTM_CNT, ERP_IF_DATE, PLAN_SLAB_CUT_FL, INGOT_FL, HEAD_SLAB_THK" +
|
|
|
", TAIL_SLAB_THK, PLAN_SLAB_MERGE_FL, MOTHER_SLAB_MERGE, GRID_FL, GRID_RSLT, HEAT_NO, RH_CD" +
|
|
|
", CAL_TM, CAL_TN, ACT_SMP_FL, SMP_NO1, SMP_NO2, GET_SMP_DATE, SMP_CAST_NO, SMP_FREQENCY" +
|
|
|
", SMP_NOTE, SMP_NOTE1, SMP_NOTE2, SLAB_NO1, SLAB_NO2, UST_RLT_CD, UST_RSLT, UST_METH" +
|
|
|
", CUT_AM, CUT_BM, CUT_CM, CUT_DM, CUT_EM, CUT_FM, MOTHER_SLAB_BILLET, BILLET_TYPE" +
|
|
|
", MOTHER_SLAB_ELEC, RES_CM, RES_DM, RES_EM, RES_FM, RES_GM" +
|
|
|
", CASE WHEN A.WID<A.LEN THEN A.LEN ELSE A.WID END REM_LEN " +
|
|
|
", A.WGT REM_WGT " +
|
|
|
", A.LEN ORG_LEN " +
|
|
|
", A.WID ORG_WID" +
|
|
|
", CASE WHEN (SELECT COUNT(HEAT_NO) FROM NISCO.FP_RHRSLT WHERE HEAT_NO = SUBSTR(A.SLAB_NO,1,8))>0 THEN '1' ELSE '0' END VAC_FLG ");
|
|
|
strSqlC1.AppendLine(",(CASE WHEN(SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET CSDD WHERE (CSDD.EST_CD LIKE '5%' OR CSDD.EST_CD LIKE '6%') AND CSDD.SLAB_NO = A.SLAB_NO) > 0 THEN '1'");
|
|
|
strSqlC1.AppendLine(" WHEN(SELECT COUNT(*) FROM(SELECT COM FROM(SELECT CSDD_C.EST_CD || '_' || CSDD_C.EST_COMMENT COM FROM NISCO.CP_SLAB_DELI_DET CSDD_C ");
|
|
|
strSqlC1.AppendLine(" WHERE CSDD_C.SLAB_NO = A.SLAB_NO ORDER BY CSDD_C.EST_DATE DESC) T_COM WHERE ROWNUM = 1) T_L WHERE T_L.COM LIKE '%协议%') > 0 THEN '1' ");
|
|
|
strSqlC1.AppendLine(" ELSE '0' END ) XY_FLG ");
|
|
|
strSqlC1.AppendLine(",(SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
strSqlC1.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
strSqlC1.AppendLine(" WHERE SLAB_NO = A.SLAB_NO ");
|
|
|
strSqlC1.AppendLine(" AND EST_CD IS NOT NULL) || ' ' || ");
|
|
|
strSqlC1.AppendLine(" (CASE WHEN A.MOTHER_SLAB IS NOT NULL AND LENGTH(A.MOTHER_SLAB) = 10 THEN ");
|
|
|
strSqlC1.AppendLine(" (SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
strSqlC1.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
strSqlC1.AppendLine(" WHERE SLAB_NO = A.MOTHER_SLAB ");
|
|
|
strSqlC1.AppendLine(" AND EST_CD IS NOT NULL) ");
|
|
|
strSqlC1.AppendLine(" ELSE '' ");
|
|
|
strSqlC1.AppendLine(" END ) EST_COMMENT ");
|
|
|
strSqlC1.AppendLine("FROM NISCO.FP_SLAB A ");
|
|
|
strSqlC1.AppendLine("WHERE 1 = 1 ");
|
|
|
strSqlC1.AppendLine(" AND(A.PROC_CD = 'CAC' OR ");
|
|
|
strSqlC1.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.REASON_CD NOT IN('1080','2014','2015','2018','2026','3014','5011','5013','8081') AND EST_CD IS NULL) < 1)");
|
|
|
strSqlC1.AppendLine(" AND A.PROC_CD='CAD' ) ");
|
|
|
strSqlC1.AppendLine(" AND A.CUR_INV in '00' ");//
|
|
|
strSqlC1.AppendLine(" AND A.PROC_CD = 'CAC' ");
|
|
|
strSqlC1.AppendLine(" AND A.ORD_FL = '2' ");
|
|
|
strSqlC1.AppendLine(" AND A.REC_STS = '2' ");
|
|
|
strSqlC1.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
strSqlC1.AppendLine(" AND A.WGT > 0 ");
|
|
|
strSqlC1.AppendLine(" AND A.WID > 1600 ");
|
|
|
strSqlC1.AppendLine(" AND A.LEN > 3900 ");
|
|
|
strSqlC1.AppendLine(" AND NVL(A.PLT,'99') IN ('B1','BZ') ");
|
|
|
strSqlC1.AppendLine(" AND NVL(A.QUALITY_UPD_GRD,'N') <> 'N' ");
|
|
|
strSqlC1.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
strSqlC1.AppendLine(" AND SLAB_NO NOT IN ( SELECT SLAB_NO FROM NISCO.CP_SLAB_MOVE_PLAN WHERE PRC_STS = 'A' AND TO_INV in('ZB','HB') ) ");
|
|
|
strSqlC1.AppendLine(" AND NVL(A.PLAN_MILL_PLT , ' ') LIKE 'C1' || '%' ");
|
|
|
// P_SLAB_DELI_DET表中字段EST_CD是5或者6开头是协议板。
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.SLAB_NO))
|
|
|
{
|
|
|
strSqlC1.AppendLine("AND SLAB_NO like '%" + tB_SLAB.SLAB_NO + "%'");
|
|
|
strSqlC2.AppendLine("AND SLAB_NO like '%" + tB_SLAB.SLAB_NO + "%'");
|
|
|
strSqlC3.AppendLine("AND SLAB_NO like '%" + tB_SLAB.SLAB_NO + "%'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STLGRD))
|
|
|
{
|
|
|
strSqlC1.AppendLine("AND (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) like '%" + tB_SLAB.STLGRD + "%'");
|
|
|
strSqlC2.AppendLine("AND (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) like '%" + tB_SLAB.STLGRD + "%'");
|
|
|
strSqlC3.AppendLine("AND (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) like '%" + tB_SLAB.STLGRD + "%'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.THK_MIN))
|
|
|
{
|
|
|
strSqlC1.AppendLine("AND A.THK >= '" + tB_SLAB.THK_MIN + "'");
|
|
|
strSqlC2.AppendLine("AND A.THK >= '" + tB_SLAB.THK_MIN + "'");
|
|
|
strSqlC3.AppendLine("AND A.THK >= '" + tB_SLAB.THK_MIN + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.THK_MAX))
|
|
|
{
|
|
|
strSqlC1.AppendLine("AND A.THK <= '" + tB_SLAB.THK_MAX + "'");
|
|
|
strSqlC2.AppendLine("AND A.THK <= '" + tB_SLAB.THK_MAX + "'");
|
|
|
strSqlC3.AppendLine("AND A.THK <= '" + tB_SLAB.THK_MAX + "'");
|
|
|
}
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
if (tB_SLAB.PLT == "C3")
|
|
|
{
|
|
|
ltSlab = db.Query<TB_SLAB>(strSqlC3.ToString());
|
|
|
}
|
|
|
if (tB_SLAB.PLT == "C2")
|
|
|
{
|
|
|
ltSlab = db.Query<TB_SLAB>(strSqlC2.ToString());
|
|
|
}
|
|
|
if (tB_SLAB.PLT == "C1")
|
|
|
{
|
|
|
ltSlab = db.Query<TB_SLAB>(strSqlC1.ToString());
|
|
|
}
|
|
|
if (string.IsNullOrEmpty(tB_SLAB.PLT))
|
|
|
{
|
|
|
ltSlabC3 = db.Query<TB_SLAB>(strSqlC3.ToString());
|
|
|
ltSlabC2 = db.Query<TB_SLAB>(strSqlC2.ToString());
|
|
|
ltSlabC1 = db.Query<TB_SLAB>(strSqlC1.ToString());
|
|
|
ltSlab = ltSlab.Union(ltSlabC3).Union(ltSlabC2).Union(ltSlabC1).ToList();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetSlabInfo 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getAPPOINT")]
|
|
|
public RequestEntity getAllAPPOINT(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetAPPOINT(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetAPPOINT 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<TB_APPOINT_ORDER_INFO> GetAPPOINT(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<TB_APPOINT_ORDER> ltSlab = new List<TB_APPOINT_ORDER>();
|
|
|
|
|
|
IList<TB_APPOINT_ORDER_INFO> ltSlab_Info = new List<TB_APPOINT_ORDER_INFO>();
|
|
|
|
|
|
StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_APPOINT_ORDER> ltSlabC3 = new List<TB_APPOINT_ORDER>();
|
|
|
//strSqlC3.AppendLine(" SELECT DISTINCT * FROM TB_APPOINT_ORDER WHERE 1=1 ");
|
|
|
|
|
|
strSqlC3.AppendLine("SELECT DISTINCT A.ORD_NO ,A.ORD_ITEM,A.XY_FLG,A.INS_DATE ,b.SLAB_NO FROM TB_APPOINT_ORDER A");
|
|
|
strSqlC3.AppendLine("LEFT JOIN(");
|
|
|
strSqlC3.AppendLine("SELECT FSD.ORD_NO, FSD.ORD_ITEM, LISTAGG(FSD.SLAB_NO, ',') WITHIN GROUP(ORDER BY FSD.SLAB_NO) AS SLAB_NO FROM FP_SLAB_DES FSD");
|
|
|
strSqlC3.AppendLine("WHERE FSD.BLOCK_SEQ <> 0 AND FSD.SEQ <> 0 AND ");
|
|
|
strSqlC3.AppendLine("FSD.ORD_NO || '-' || FSD.ORD_ITEM ");
|
|
|
strSqlC3.AppendLine("IN( ");
|
|
|
strSqlC3.AppendLine("SELECT T.ORD_NO || '-' || T.ORD_ITEM FROM TB_APPOINT_ORDER T ");
|
|
|
strSqlC3.AppendLine(") ");
|
|
|
strSqlC3.AppendLine("GROUP BY FSD.ORD_NO, FSD.ORD_ITEM ");
|
|
|
strSqlC3.AppendLine(") B ");
|
|
|
strSqlC3.AppendLine("ON B.ORD_NO = A.ORD_NO ");
|
|
|
strSqlC3.AppendLine("AND B.ORD_ITEM = A.ORD_ITEM ");
|
|
|
|
|
|
strSqlC3.AppendLine("WHERE 1=1 ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.ORD_NO))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND A.ORD_NO LIKE '%" + tB_SLAB.ORD_NO + "%'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.ORD_ITEM))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND A.ORD_ITEM LIKE '%" + tB_SLAB.ORD_ITEM + "%'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.XY_FLG))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND A.XY_FLG = '" + tB_SLAB.XY_FLG + "'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
ltSlab = db.Query<TB_APPOINT_ORDER>(strSqlC3.ToString());
|
|
|
}
|
|
|
|
|
|
string BOI = String.Empty;
|
|
|
foreach (TB_APPOINT_ORDER order in ltSlab)
|
|
|
{
|
|
|
BOI += string.Format(" or (boi.ORD_NO = '{0}' and boi.ORD_ITEM = '{1}')", order.ORD_NO, order.ORD_ITEM);
|
|
|
}
|
|
|
ltSlab_Info = getOrderInfo(BOI);
|
|
|
|
|
|
//添加协议
|
|
|
foreach (var item in ltSlab_Info)
|
|
|
{
|
|
|
if (ltSlab.Where(p=>p.ORD_NO== item.ORD_NO && p.ORD_ITEM==item.ORD_ITEM).Count()>0)
|
|
|
{
|
|
|
item.XY_FLG = ltSlab.Where(p => p.ORD_NO == item.ORD_NO && p.ORD_ITEM == item.ORD_ITEM).FirstOrDefault().XY_FLG;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetAPPOINT 报错", ex);
|
|
|
}
|
|
|
return ltSlab_Info;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddAPPOINT")]
|
|
|
public RequestEntity AddAPPOINT(IList<TB_APPOINT_ORDER> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_APPOINT_ORDER model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.ORD_NO) || string.IsNullOrEmpty(model.ORD_ITEM))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
//if (!ParameterCalibration(model, result))
|
|
|
//{
|
|
|
// db.Rollback();
|
|
|
// return result;
|
|
|
//}
|
|
|
#endregion
|
|
|
model.ORD_NO = model.ORD_NO.Trim();
|
|
|
//model.SLAB_NO = model.SLAB_NO.Trim();
|
|
|
model.ORD_ITEM = model.ORD_ITEM.ToString().PadLeft(3, '0');
|
|
|
|
|
|
model.SLAB_NO = "";
|
|
|
model.XY_FLG = "非协议";//非协议
|
|
|
model.INS_DATE = dtNow.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
//model.INS_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
//model.INS_TIME = dtNow.ToString("HHmmss");
|
|
|
//model.UPD_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
//model.UPD_TIME = dtNow.ToString("HHmmss");
|
|
|
if (db.Insert<TB_APPOINT_ORDER>(model) == 0)
|
|
|
{
|
|
|
b = false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddAPPOINT 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddAPPOINTXYB")]
|
|
|
public RequestEntity AddAPPOINTXYB(IList<TB_APPOINT_ORDER> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_APPOINT_ORDER model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.ORD_NO) || string.IsNullOrEmpty(model.ORD_ITEM))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
//if (!ParameterCalibration(model, result))
|
|
|
//{
|
|
|
// db.Rollback();
|
|
|
// return result;
|
|
|
//}
|
|
|
#endregion
|
|
|
model.ORD_NO = model.ORD_NO.Trim();
|
|
|
//model.SLAB_NO = model.SLAB_NO.Trim();
|
|
|
model.ORD_ITEM = model.ORD_ITEM.ToString().PadLeft(3, '0');
|
|
|
|
|
|
model.SLAB_NO = "";
|
|
|
model.XY_FLG = "协议(XYB)";//XYB 标识 ,协议坯
|
|
|
model.INS_DATE = dtNow.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
//model.INS_TIME = dtNow.ToString("HHmmss");
|
|
|
//model.UPD_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
//model.UPD_TIME = dtNow.ToString("HHmmss");
|
|
|
if (db.Insert<TB_APPOINT_ORDER>(model) == 0)
|
|
|
{
|
|
|
b = false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddAPPOINTXYB 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("DelAPPOINT")]
|
|
|
public RequestEntity DelAPPOINT(IList<TB_APPOINT_ORDER> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_APPOINT_ORDER model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.ORD_NO) || string.IsNullOrEmpty(model.ORD_ITEM))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
//if (!ParameterCalibration(model, result))
|
|
|
//{
|
|
|
// db.Rollback();
|
|
|
// return result;
|
|
|
//}
|
|
|
#endregion
|
|
|
model.ORD_NO = model.ORD_NO.Trim();
|
|
|
|
|
|
model.ORD_ITEM = model.ORD_ITEM.ToString().PadLeft(3, '0');
|
|
|
try
|
|
|
{
|
|
|
strSql = new StringBuilder();
|
|
|
strSql.AppendLine("DELETE FROM TB_APPOINT_ORDER WHERE 1=1 ");
|
|
|
strSql.AppendLine(string.Format(" AND ORD_NO='{0}' AND ORD_ITEM = '{1}' ", model.ORD_NO, model.ORD_ITEM));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录删除失败 ");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("DelAPPOINT 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
[HttpPost, Route("ManualTriggering")]
|
|
|
/// <summary>
|
|
|
/// 手动触发程序
|
|
|
/// </summary>
|
|
|
/// <param name="ManualTriggering"></param>
|
|
|
/// <returns></returns>
|
|
|
public RequestEntity ManualTriggering(SupersedeQueryArgs ArgsSupersede)
|
|
|
{
|
|
|
lock (LOCK)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
//开启数据库连接查询数据
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//string args = "";
|
|
|
|
|
|
//Process KHMsg = new Process();
|
|
|
//KHMsg.StartInfo.FileName = @"D:\Program\Slab\SlabHandle.exe";
|
|
|
//KHMsg.StartInfo.Arguments = args;
|
|
|
////KHMsg.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;//隐藏
|
|
|
//KHMsg.Start();
|
|
|
//result.msg = "操作成功!30分钟后刷新数据。";
|
|
|
//result.code = "1";
|
|
|
//while (!KHMsg.HasExited) { } //如果exe还没关闭,则等待
|
|
|
//if (KHMsg.ExitCode == 1)
|
|
|
//{
|
|
|
// result.msg = "操作成功!";
|
|
|
// result.code = "1";
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// result.msg = "操作失败!";
|
|
|
// result.code = "0";
|
|
|
//}
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
|
strSql = new StringBuilder();
|
|
|
|
|
|
strSql.AppendLine("UPDATE TB_MANUAL_TRIGGER SET FLG='1' WHERE ID=1 ");
|
|
|
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("ManualTriggering 报错", ex);
|
|
|
}
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 钢种保留接口
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getQP_NISCO_CHMC")]
|
|
|
public RequestEntity getAllQP_NISCO_CHMC(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetQP_NISCO_CHMC(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetSurplusMaterials 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<QP_NISCO_CHMC> GetQP_NISCO_CHMC(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<QP_NISCO_CHMC> ltSlab = new List<QP_NISCO_CHMC>();
|
|
|
|
|
|
StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<QP_NISCO_CHMC> ltSlabC3 = new List<QP_NISCO_CHMC>();
|
|
|
strSqlC3.AppendLine(" SELECT * FROM NISCO.QP_NISCO_CHMC WHERE 1=1 ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND STEEL_GRD_DETAIL like '%" + tB_SLAB.STEEL_GRD_DETAIL + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltSlab = db.Query<QP_NISCO_CHMC>(strSqlC3.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetSlabInfo 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getTB_STLGRD_CHMC")]
|
|
|
public RequestEntity getAllTB_STLGRD_CHMC(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetTB_STLGRD_CHMC(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetTB_STLGRD_CHMC 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<TB_STLGRD_CHMC> GetTB_STLGRD_CHMC(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<TB_STLGRD_CHMC> ltSlab = new List<TB_STLGRD_CHMC>();
|
|
|
|
|
|
StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_STLGRD_CHMC> ltSlabC3 = new List<TB_STLGRD_CHMC>();
|
|
|
strSqlC3.AppendLine(" SELECT DISTINCT * FROM TB_STLGRD_CHMC WHERE 1=1 ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND STEEL_GRD_DETAIL like '%" + tB_SLAB.STEEL_GRD_DETAIL + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
ltSlab = db.Query<TB_STLGRD_CHMC>(strSqlC3.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetTB_STLGRD_CHMC 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddTB_STLGRD_CHMC")]
|
|
|
public RequestEntity AddTB_STLGRD_CHMC(IList<TB_STLGRD_CHMC> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_STLGRD_CHMC model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD)
|
|
|
|| string.IsNullOrEmpty(model.STLGRD_GRP)
|
|
|
|| string.IsNullOrEmpty(model.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
//model.STLGRD = model.STLGRD.Trim();
|
|
|
|
|
|
//model.STLGRD_GRP = model.STLGRD_GRP.ToString().PadLeft(3, '0');
|
|
|
|
|
|
if (db.Insert<TB_STLGRD_CHMC>(model) == 0)
|
|
|
{
|
|
|
b = false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddTB_STLGRD_CHMC 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("DelTB_STLGRD_CHMC")]
|
|
|
public RequestEntity DelTB_STLGRD_CHMC(IList<TB_STLGRD_CHMC> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
try
|
|
|
{
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_STLGRD_CHMC model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql = new StringBuilder();
|
|
|
strSql.AppendLine("DELETE FROM TB_STLGRD_CHMC WHERE 1=1 ");
|
|
|
strSql.AppendLine(string.Format(" AND STLGRD='{0}' ", model.STLGRD));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录删除失败 ");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("DelAPPOINT 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 钢种保留接口_C1
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getQP_NISCO_CHMC_C1")]
|
|
|
public RequestEntity getAllQP_NISCO_CHMC_C1(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetQP_NISCO_CHMC_C1(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetSurplusMaterials 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<QP_NISCO_CHMC> GetQP_NISCO_CHMC_C1(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<QP_NISCO_CHMC> ltSlab = new List<QP_NISCO_CHMC>();
|
|
|
|
|
|
StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<QP_NISCO_CHMC> ltSlabC3 = new List<QP_NISCO_CHMC>();
|
|
|
strSqlC3.AppendLine(" SELECT * FROM NISCO.QP_NISCO_CHMC WHERE 1=1 ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND STEEL_GRD_DETAIL like '%" + tB_SLAB.STEEL_GRD_DETAIL + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltSlab = db.Query<QP_NISCO_CHMC>(strSqlC3.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetSlabInfo 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getTB_STLGRD_CHMC_C1")]
|
|
|
public RequestEntity getAllTB_STLGRD_CHMC_C1(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetTB_STLGRD_CHMC_C1(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetTB_STLGRD_CHMC 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<TB_STLGRD_CHMC> GetTB_STLGRD_CHMC_C1(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<TB_STLGRD_CHMC> ltSlab = new List<TB_STLGRD_CHMC>();
|
|
|
|
|
|
StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_STLGRD_CHMC> ltSlabC3 = new List<TB_STLGRD_CHMC>();
|
|
|
strSqlC3.AppendLine(" SELECT DISTINCT * FROM TB_STLGRD_CHMC WHERE 1=1 AND PLT= 'C1' ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND STEEL_GRD_DETAIL like '%" + tB_SLAB.STEEL_GRD_DETAIL + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
ltSlab = db.Query<TB_STLGRD_CHMC>(strSqlC3.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetTB_STLGRD_CHMC_C1 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddTB_STLGRD_CHMC_C1")]
|
|
|
public RequestEntity AddTB_STLGRD_CHMC_C1(IList<TB_STLGRD_CHMC> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_STLGRD_CHMC model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD)
|
|
|
|| string.IsNullOrEmpty(model.STLGRD_GRP)
|
|
|
|| string.IsNullOrEmpty(model.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
model.PLT = "C1";
|
|
|
|
|
|
//model.STLGRD = model.STLGRD.Trim();
|
|
|
|
|
|
//model.STLGRD_GRP = model.STLGRD_GRP.ToString().PadLeft(3, '0');
|
|
|
|
|
|
if (db.Insert<TB_STLGRD_CHMC>(model) == 0)
|
|
|
{
|
|
|
b = false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddTB_STLGRD_CHMC_C1 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("DelTB_STLGRD_CHMC_C1")]
|
|
|
public RequestEntity DelTB_STLGRD_CHMC_C1(IList<TB_STLGRD_CHMC> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
try
|
|
|
{
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_STLGRD_CHMC model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql = new StringBuilder();
|
|
|
strSql.AppendLine("DELETE FROM TB_STLGRD_CHMC WHERE 1=1 AND PLT ='C1' ");
|
|
|
strSql.AppendLine(string.Format(" AND STLGRD='{0}' ", model.STLGRD));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录删除失败 ");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("DelAPPOINT_C1 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 钢种保留接口_C2
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getQP_NISCO_CHMC_C2")]
|
|
|
public RequestEntity getAllQP_NISCO_CHMC_C2(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetQP_NISCO_CHMC_C2(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetSurplusMaterials 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<QP_NISCO_CHMC> GetQP_NISCO_CHMC_C2(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<QP_NISCO_CHMC> ltSlab = new List<QP_NISCO_CHMC>();
|
|
|
|
|
|
StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<QP_NISCO_CHMC> ltSlabC3 = new List<QP_NISCO_CHMC>();
|
|
|
strSqlC3.AppendLine(" SELECT * FROM NISCO.QP_NISCO_CHMC WHERE 1=1 ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND STEEL_GRD_DETAIL like '%" + tB_SLAB.STEEL_GRD_DETAIL + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltSlab = db.Query<QP_NISCO_CHMC>(strSqlC3.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetSlabInfo 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getTB_STLGRD_CHMC_C2")]
|
|
|
public RequestEntity getAllTB_STLGRD_CHMC_C2(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetTB_STLGRD_CHMC_C2(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetTB_STLGRD_CHMC 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<TB_STLGRD_CHMC> GetTB_STLGRD_CHMC_C2(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<TB_STLGRD_CHMC> ltSlab = new List<TB_STLGRD_CHMC>();
|
|
|
|
|
|
StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_STLGRD_CHMC> ltSlabC3 = new List<TB_STLGRD_CHMC>();
|
|
|
strSqlC3.AppendLine(" SELECT DISTINCT * FROM TB_STLGRD_CHMC WHERE 1=1 AND PLT= 'C2' ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND STEEL_GRD_DETAIL like '%" + tB_SLAB.STEEL_GRD_DETAIL + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
ltSlab = db.Query<TB_STLGRD_CHMC>(strSqlC3.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetTB_STLGRD_CHMC_C2 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddTB_STLGRD_CHMC_C2")]
|
|
|
public RequestEntity AddTB_STLGRD_CHMC_C2(IList<TB_STLGRD_CHMC> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_STLGRD_CHMC model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD)
|
|
|
|| string.IsNullOrEmpty(model.STLGRD_GRP)
|
|
|
|| string.IsNullOrEmpty(model.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
model.PLT = "C2";
|
|
|
|
|
|
//model.STLGRD = model.STLGRD.Trim();
|
|
|
|
|
|
//model.STLGRD_GRP = model.STLGRD_GRP.ToString().PadLeft(3, '0');
|
|
|
|
|
|
if (db.Insert<TB_STLGRD_CHMC>(model) == 0)
|
|
|
{
|
|
|
b = false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddTB_STLGRD_CHMC_C2 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("DelTB_STLGRD_CHMC_C2")]
|
|
|
public RequestEntity DelTB_STLGRD_CHMC_C2(IList<TB_STLGRD_CHMC> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
try
|
|
|
{
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_STLGRD_CHMC model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql = new StringBuilder();
|
|
|
strSql.AppendLine("DELETE FROM TB_STLGRD_CHMC WHERE 1=1 AND PLT ='C2' ");
|
|
|
strSql.AppendLine(string.Format(" AND STLGRD='{0}' ", model.STLGRD));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录删除失败 ");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("DelAPPOINT_C2 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 钢种保留接口_C3
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getQP_NISCO_CHMC_C3")]
|
|
|
public RequestEntity getAllQP_NISCO_CHMC_C3(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetQP_NISCO_CHMC_C3(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetSurplusMaterials 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<QP_NISCO_CHMC> GetQP_NISCO_CHMC_C3(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<QP_NISCO_CHMC> ltSlab = new List<QP_NISCO_CHMC>();
|
|
|
|
|
|
StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<QP_NISCO_CHMC> ltSlabC3 = new List<QP_NISCO_CHMC>();
|
|
|
strSqlC3.AppendLine(" SELECT * FROM NISCO.QP_NISCO_CHMC WHERE 1=1 ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND STEEL_GRD_DETAIL like '%" + tB_SLAB.STEEL_GRD_DETAIL + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltSlab = db.Query<QP_NISCO_CHMC>(strSqlC3.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetSlabInfo 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getTB_STLGRD_CHMC_C3")]
|
|
|
public RequestEntity getAllTB_STLGRD_CHMC_C3(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetTB_STLGRD_CHMC_C3(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetTB_STLGRD_CHMC 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<TB_STLGRD_CHMC> GetTB_STLGRD_CHMC_C3(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<TB_STLGRD_CHMC> ltSlab = new List<TB_STLGRD_CHMC>();
|
|
|
|
|
|
StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_STLGRD_CHMC> ltSlabC3 = new List<TB_STLGRD_CHMC>();
|
|
|
strSqlC3.AppendLine(" SELECT DISTINCT * FROM TB_STLGRD_CHMC WHERE 1=1 AND PLT= 'C3' ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND STEEL_GRD_DETAIL like '%" + tB_SLAB.STEEL_GRD_DETAIL + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
ltSlab = db.Query<TB_STLGRD_CHMC>(strSqlC3.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetTB_STLGRD_CHMC_C3 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddTB_STLGRD_CHMC_C3")]
|
|
|
public RequestEntity AddTB_STLGRD_CHMC_C3(IList<TB_STLGRD_CHMC> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_STLGRD_CHMC model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD)
|
|
|
|| string.IsNullOrEmpty(model.STLGRD_GRP)
|
|
|
|| string.IsNullOrEmpty(model.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
model.PLT = "C3";
|
|
|
|
|
|
//model.STLGRD = model.STLGRD.Trim();
|
|
|
|
|
|
//model.STLGRD_GRP = model.STLGRD_GRP.ToString().PadLeft(3, '0');
|
|
|
|
|
|
if (db.Insert<TB_STLGRD_CHMC>(model) == 0)
|
|
|
{
|
|
|
b = false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddTB_STLGRD_CHMC_C3 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("DelTB_STLGRD_CHMC_C3")]
|
|
|
public RequestEntity DelTB_STLGRD_CHMC_C3(IList<TB_STLGRD_CHMC> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
try
|
|
|
{
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_STLGRD_CHMC model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql = new StringBuilder();
|
|
|
strSql.AppendLine("DELETE FROM TB_STLGRD_CHMC WHERE 1=1 AND PLT ='C3' ");
|
|
|
strSql.AppendLine(string.Format(" AND STLGRD='{0}' ", model.STLGRD));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录删除失败 ");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("DelAPPOINT_C3 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 选择钢种_C3
|
|
|
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getTB_C3_STLGRD_SEL")]
|
|
|
public RequestEntity getAllTB_C3_STLGRD_SEL(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetTB_C3_STLGRD_SEL(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetTB_STLGRD_CHMC 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<TB_C3_STLGRD_SEL> GetTB_C3_STLGRD_SEL(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<TB_C3_STLGRD_SEL> ltSlab = new List<TB_C3_STLGRD_SEL>();
|
|
|
|
|
|
StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_C3_STLGRD_SEL> ltSlabC3 = new List<TB_C3_STLGRD_SEL>();
|
|
|
strSqlC3.AppendLine(" SELECT DISTINCT * FROM TB_C3_STLGRD_SEL WHERE 1=1 AND PLT= 'C3' ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND STEEL_GRD_DETAIL like '%" + tB_SLAB.STEEL_GRD_DETAIL + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
ltSlab = db.Query<TB_C3_STLGRD_SEL>(strSqlC3.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetTB_C3_STLGRD_SEL 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddTB_C3_STLGRD_SEL")]
|
|
|
public RequestEntity AddTB_C3_STLGRD_SEL(IList<TB_C3_STLGRD_SEL> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_C3_STLGRD_SEL model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD)
|
|
|
|| string.IsNullOrEmpty(model.STLGRD_GRP)
|
|
|
|| string.IsNullOrEmpty(model.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
model.PLT = "C3";
|
|
|
|
|
|
//model.STLGRD = model.STLGRD.Trim();
|
|
|
|
|
|
//model.STLGRD_GRP = model.STLGRD_GRP.ToString().PadLeft(3, '0');
|
|
|
|
|
|
if (db.Insert<TB_C3_STLGRD_SEL>(model) == 0)
|
|
|
{
|
|
|
b = false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddTB_C3_STLGRD_SEL 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("DelTB_C3_STLGRD_SEL")]
|
|
|
public RequestEntity DelTB_C3_STLGRD_SEL(IList<TB_C3_STLGRD_SEL> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
try
|
|
|
{
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_C3_STLGRD_SEL model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql = new StringBuilder();
|
|
|
strSql.AppendLine("DELETE FROM TB_C3_STLGRD_SEL WHERE 1=1 AND PLT ='C3' ");
|
|
|
strSql.AppendLine(string.Format(" AND STLGRD='{0}' ", model.STLGRD));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录删除失败 ");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("DelTB_C3_STLGRD_SEL 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 台式炉不可替代标准
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getQP_STD_HEAD")]
|
|
|
public RequestEntity getAllQP_STD_HEAD(QP_STD_HEAD_C2 tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetQP_STD_HEAD(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetSurplusMaterials 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<QP_STD_HEAD_C2> GetQP_STD_HEAD(QP_STD_HEAD_C2 tB_SLAB)
|
|
|
{
|
|
|
IList<QP_STD_HEAD_C2> ltSlab = new List<QP_STD_HEAD_C2>();
|
|
|
|
|
|
StringBuilder strSqlC3 = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<QP_STD_HEAD_C2> ltSlabC3 = new List<QP_STD_HEAD_C2>();
|
|
|
strSqlC3.AppendLine(" SELECT * FROM NISCO.QP_STD_HEAD WHERE 1=1 ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STDSPEC))
|
|
|
{
|
|
|
strSqlC3.AppendLine("AND STDSPEC like '%" + tB_SLAB.STDSPEC + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltSlab = db.Query<QP_STD_HEAD_C2>(strSqlC3.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetSlabInfo 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getTB_BTF_STLGRD")]
|
|
|
public RequestEntity getAllTB_BTF_STLGRD(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetTB_BTF_STLGRD(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetTB_STLGRD_CHMC 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<TB_BTF_STLGRD> GetTB_BTF_STLGRD(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<TB_BTF_STLGRD> ltSlab = new List<TB_BTF_STLGRD>();
|
|
|
|
|
|
StringBuilder strSqlBTF = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_BTF_STLGRD> ltSlabBTF = new List<TB_BTF_STLGRD>();
|
|
|
strSqlBTF.AppendLine(" SELECT DISTINCT * FROM TB_BTF_STLGRD WHERE 1=1 ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
strSqlBTF.AppendLine("AND STEEL_GRD_DETAIL like '%" + tB_SLAB.STEEL_GRD_DETAIL + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
ltSlab = db.Query<TB_BTF_STLGRD>(strSqlBTF.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetTB_BTF_STLGRD 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddTB_BTF_STLGRD")]
|
|
|
public RequestEntity AddTB_BTF_STLGRD(IList<TB_BTF_STLGRD> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_BTF_STLGRD model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STDSPEC)
|
|
|
|| string.IsNullOrEmpty(model.STDSPEC_NAME_CHN)
|
|
|
|| string.IsNullOrEmpty(model.STDSPEC_STLGRD))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
model.PLT = "C2";
|
|
|
|
|
|
//model.STLGRD = model.STLGRD.Trim();
|
|
|
|
|
|
//model.STLGRD_GRP = model.STLGRD_GRP.ToString().PadLeft(3, '0');
|
|
|
|
|
|
if (db.Insert<TB_BTF_STLGRD>(model) == 0)
|
|
|
{
|
|
|
b = false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddTB_BTF_STLGRD 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("DelTB_BTF_STLGRD")]
|
|
|
public RequestEntity DelTB_BTF_STLGRD(IList<TB_BTF_STLGRD> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
try
|
|
|
{
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_BTF_STLGRD model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STDSPEC))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql = new StringBuilder();
|
|
|
strSql.AppendLine("DELETE FROM TB_BTF_STLGRD WHERE 1=1 ");
|
|
|
strSql.AppendLine(string.Format(" AND STDSPEC='{0}' ", model.STDSPEC));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录删除失败 ");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("DelTB_BTF_STLGRD 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 附带配置
|
|
|
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getTB_OUT_CFG")]
|
|
|
public RequestEntity getAllTB_OUT_CFG(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetTB_OUT_CFG(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetTB_STLGRD_CHMC 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<TB_OUT_CFG> GetTB_OUT_CFG(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<TB_OUT_CFG> ltSlab = new List<TB_OUT_CFG>();
|
|
|
|
|
|
StringBuilder strSqlBTF = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_OUT_CFG> ltSlabBTF = new List<TB_OUT_CFG>();
|
|
|
strSqlBTF.AppendLine(" SELECT DISTINCT * FROM TB_OUT_CFG WHERE 1=1 ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
strSqlBTF.AppendLine("AND STEEL_GRD_DETAIL like '%" + tB_SLAB.STEEL_GRD_DETAIL + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
ltSlab = db.Query<TB_OUT_CFG>(strSqlBTF.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetTB_OUT_CFG 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddTB_OUT_CFG")]
|
|
|
public RequestEntity AddTB_OUT_CFG(TB_OUT_CFG insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
TB_OUT_CFG model = insertModel;
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD)
|
|
|
|| string.IsNullOrEmpty(model.STLGRD_GRP)
|
|
|
|| string.IsNullOrEmpty(model.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
; result.msg = "钢种不能为空!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
model.PLT = "C2";
|
|
|
model.INS_DATE = DateTime.Now.ToString("yyyyMMdd");
|
|
|
model.INS_TIME = DateTime.Now.ToString("HHmmss");
|
|
|
//model.STLGRD = model.STLGRD.Trim();
|
|
|
|
|
|
//model.STLGRD_GRP = model.STLGRD_GRP.ToString().PadLeft(3, '0');
|
|
|
|
|
|
if (db.Insert<TB_OUT_CFG>(model) == 0)
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
|
|
|
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddTB_OUT_CFG 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("DelTB_OUT_CFG")]
|
|
|
public RequestEntity DelTB_OUT_CFG(IList<TB_OUT_CFG> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
try
|
|
|
{
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_OUT_CFG model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql = new StringBuilder();
|
|
|
strSql.AppendLine("DELETE FROM TB_OUT_CFG WHERE 1=1 ");
|
|
|
strSql.AppendLine(string.Format(" AND STLGRD='{0}' and ORD_WID_MIN= '{1}' and ORD_WID_MAX= '{2}' and ORD_THK_MIN= '{3}' AND ORD_THK_MAX= '{4}' ", model.STLGRD, model.ORD_WID_MIN, model.ORD_WID_MAX, model.ORD_THK_MIN, model.ORD_THK_MAX));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录删除失败 ");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("DelTB_BTF_STLGRD 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 宽板只允许一型配置
|
|
|
|
|
|
|
|
|
//QP_NISCO_CHMC
|
|
|
[HttpPost, Route("getTB_ONLY_TYPE")]
|
|
|
public RequestEntity getAllTB_ONLY_TYPE(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
result.data = GetTB_ONLY_TYPE(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetTB_STLGRD_CHMC 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public IList<TB_ONLY_TYPE> GetTB_ONLY_TYPE(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
IList<TB_ONLY_TYPE> ltSlab = new List<TB_ONLY_TYPE>();
|
|
|
|
|
|
StringBuilder strSqlBTF = new StringBuilder();//声明拼接Sql语句变量
|
|
|
IList<TB_ONLY_TYPE> ltSlabBTF = new List<TB_ONLY_TYPE>();
|
|
|
strSqlBTF.AppendLine(" SELECT DISTINCT * FROM TB_ONLY_TYPE WHERE 1=1 ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(tB_SLAB.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
strSqlBTF.AppendLine("AND STEEL_GRD_DETAIL like '%" + tB_SLAB.STEEL_GRD_DETAIL + "%'");
|
|
|
}
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
ltSlab = db.Query<TB_ONLY_TYPE>(strSqlBTF.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetTB_ONLY_TYPE 报错", ex);
|
|
|
}
|
|
|
return ltSlab;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddTB_ONLY_TYPE")]
|
|
|
public RequestEntity AddTB_ONLY_TYPE(TB_ONLY_TYPE insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
bool b = true;
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
TB_ONLY_TYPE model = insertModel;
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD)
|
|
|
|| string.IsNullOrEmpty(model.STLGRD_GRP)
|
|
|
|| string.IsNullOrEmpty(model.STEEL_GRD_DETAIL))
|
|
|
{
|
|
|
; result.msg = "钢种不能为空!";
|
|
|
result.code = "0";
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
model.PLT = "C2";
|
|
|
model.INS_DATE = DateTime.Now.ToString("yyyyMMdd");
|
|
|
model.INS_TIME = DateTime.Now.ToString("HHmmss");
|
|
|
//model.STLGRD = model.STLGRD.Trim();
|
|
|
|
|
|
//model.STLGRD_GRP = model.STLGRD_GRP.ToString().PadLeft(3, '0');
|
|
|
|
|
|
if (db.Insert<TB_ONLY_TYPE>(model) == 0)
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
|
|
|
|
|
|
if (b)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddTB_ONLY_TYPE 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("DelTB_ONLY_TYPE")]
|
|
|
public RequestEntity DelTB_ONLY_TYPE(IList<TB_ONLY_TYPE> insertModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
try
|
|
|
{
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
foreach (TB_ONLY_TYPE model in insertModel)
|
|
|
{
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.STLGRD))
|
|
|
{
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql = new StringBuilder();
|
|
|
strSql.AppendLine("DELETE FROM TB_ONLY_TYPE WHERE 1=1 ");
|
|
|
strSql.AppendLine(string.Format(" AND STLGRD='{0}' and ORD_WID_MIN= '{1}' and ORD_WID_MAX= '{2}' and ORD_THK_MIN= '{3}' AND ORD_THK_MAX= '{4}' ", model.STLGRD, model.ORD_WID_MIN, model.ORD_WID_MAX, model.ORD_THK_MIN, model.ORD_THK_MAX));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录删除失败 ");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("DelTB_ONLY_TYPE 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
#region 手动触发程序
|
|
|
|
|
|
[HttpPost, Route("SetActionSlab")]
|
|
|
public RequestEntity SetActionSlab(TB_SLAB_QUERY tB_SLAB)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
//using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
//{
|
|
|
Process KHMsg = new Process();
|
|
|
|
|
|
KHMsg.StartInfo.FileName = @"D:\Program\SurplusMaterial\SinglePlateHandle.exe";
|
|
|
//KHMsg.StartInfo.FileName = @"D:\南钢项目\ipd-file\ipd-file53\ipd-file\SinglePlateHandle\SinglePlateHandle\bin\Debug\SinglePlateHandle.exe";
|
|
|
//KHMsg.StartInfo.Arguments = strPlateNo;
|
|
|
//KHMsg.Start();
|
|
|
|
|
|
//while (!KHMsg.HasExited) { } //如果exe还没关闭,则等待
|
|
|
//if (KHMsg.ExitCode == 1)
|
|
|
//{
|
|
|
// Plate.STATUS = "0";
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// Plate.STATUS = "N";
|
|
|
//}
|
|
|
|
|
|
|
|
|
result.data = GetAPPOINT(tB_SLAB);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetAPPOINT 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
|
/// 添加接口
|
|
|
/// </summary>
|
|
|
/// <param name="insertModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("AddTbSlabASOne")]
|
|
|
public RequestEntity AddTbSlabASOne(TB_SLAB_APPOINTSUBSTITUTE model)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
try
|
|
|
{
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
db.BeginTransaction();
|
|
|
#region 参数判断
|
|
|
if (string.IsNullOrEmpty(model.ORD_NO) || string.IsNullOrEmpty(model.ORD_ITEM))
|
|
|
{
|
|
|
db.Rollback();
|
|
|
return result;
|
|
|
}
|
|
|
if (!ParameterCalibration(model, result))
|
|
|
{
|
|
|
db.Rollback();
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
model.SLAB_NO = model.SLAB_NO.Trim();
|
|
|
model.ORD_NO = model.ORD_NO.Trim();
|
|
|
model.ORD_ITEM = model.ORD_ITEM.ToString().PadLeft(3, '0');
|
|
|
model.INS_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
model.INS_TIME = dtNow.ToString("HHmmss");
|
|
|
model.UPD_DATE = dtNow.ToString("yyyyMMdd");
|
|
|
model.UPD_TIME = dtNow.ToString("HHmmss");
|
|
|
|
|
|
if (db.Insert<TB_SLAB_APPOINTSUBSTITUTE>(model) > 0)
|
|
|
{
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
//数据操作成功则保存数据
|
|
|
db.Commit();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.msg = "操作失败!";
|
|
|
result.code = "0";
|
|
|
//操作失败回滚数据到初始状态
|
|
|
db.Rollback();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("AddTbSlabASOne 报错 : ", ex);
|
|
|
if (ex.ToString().Contains("00001"))
|
|
|
{
|
|
|
result.msg = "重复插入!";
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 修改接口
|
|
|
/// </summary>
|
|
|
/// <param name="delModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("UpdateTbSlabASOne")]
|
|
|
public RequestEntity UpdateTbSlabASOne(IList<TB_SLAB_APPOINTSUBSTITUTE> model)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//ORD_NO, ORD_ITEM
|
|
|
strSql.AppendLine("Update TB_SLAB_APPOINTSUBSTITUTE ");
|
|
|
strSql.AppendLine(string.Format("set REMARKS='{3}' where SLAB_NO = '{0}' and ORD_NO = '{1}' and ORD_ITEM = '{2}' ", model[1].SLAB_NO, model[1].ORD_NO, model[1].ORD_ITEM, model[1].REMARKS));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
strSql.Length = 0;
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录修改失败: " + model.ToString());
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result.msg = "操作成功";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("UpdateTbSlabASOne 报错", ex);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 删除接口
|
|
|
/// </summary>
|
|
|
/// <param name="delModel"></param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("DelTbSlabASOne")]
|
|
|
public RequestEntity DelTbSlabASOne(IList<TB_SLAB_APPOINTSUBSTITUTE> delModel)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
foreach (var model in delModel)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
//ORD_NO, ORD_ITEM
|
|
|
strSql.AppendLine("DELETE FROM TB_SLAB_APPOINTSUBSTITUTE WHERE 1=1 ");
|
|
|
strSql.AppendLine(string.Format("AND SLAB_NO = '{0}' AND ORD_NO = '{1}' AND ORD_ITEM = '{2}' ", model.SLAB_NO, model.ORD_NO, model.ORD_ITEM));
|
|
|
db.Execute(strSql.ToString()); // 执行删除数据操作
|
|
|
//执行完操作之后清空strSql 准备下次 appendLine
|
|
|
strSql.Length = 0;
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
logger.Error("该条记录删除失败: " + delModel.ToString());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
result.msg = "操作成功";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("DelTbSlabASOne 报错", ex);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 方法
|
|
|
|
|
|
/// <summary>
|
|
|
/// 整理 PDO 实体类数据
|
|
|
/// </summary>
|
|
|
/// <param name="prP_PLATE">钢板数据</param>
|
|
|
/// <param name="prorder">订单数据库</param>
|
|
|
/// <returns></returns>
|
|
|
public static TBDIPDO GetTBDIBKDPDO(FP_SLAB_DES prSlabDes)
|
|
|
{
|
|
|
TBDIPDO Result = new TBDIPDO();
|
|
|
|
|
|
//Data字段:数值型、字符型都是后补空格
|
|
|
Result.TIMESTAMP = GetTimeStamp(); //TIMESTAMP: 1970.1.1 8:00:00 至当前时间的毫秒数
|
|
|
Result.SERIALNO = "0";//Serialno :默认0,对于TIMESTAMP: 重复时的区分号
|
|
|
Result.QUEUEID = "BKDMES000";//:主键,BKDYC0001 ,有时序先后顺序的必须用同一个QUEUEID
|
|
|
Result.HEADER = "";// 未使用
|
|
|
//Result.DATA = "";// 前10位记录FORMID(例如:BKD001 / BKD002)
|
|
|
Result.STATUS = "N";// 发送方写入N,读取成功后变0,异常变1
|
|
|
Result.PROCESSTIME = DateTime.Now.ToString("yyyyMMddHHmmss");//:读取时间
|
|
|
Result.DESCRIPTION = "";//:读取异常备注
|
|
|
|
|
|
StringBuilder strData = new StringBuilder();
|
|
|
|
|
|
strData.Append(("BKDMES011").PadRight(10));// FORMID:10位 ,BKDMES011 固定
|
|
|
strData.Append(prSlabDes.ID.PadRight(12));// 业务ID号 NUMBER(12) 流水号,需要在应答中带回
|
|
|
strData.Append(prSlabDes.PLT.PadRight(2));// 工厂代码:VARCHAR2(2), C1 / C2 / C3
|
|
|
strData.Append(prSlabDes.SLAB_NO.PadRight(10));// 板坯号: VARCHAR2(10)
|
|
|
|
|
|
Result.DATA = strData.ToString();
|
|
|
|
|
|
return Result;
|
|
|
}
|
|
|
|
|
|
|
|
|
[HttpPost, Route("getSlabDesAll1")]
|
|
|
public RequestEntity getSlabDesAll1(TB_SLAB_DES_Args queryArgs)
|
|
|
{
|
|
|
|
|
|
RequestEntity result = new RequestEntity(); //声明返回参数实体类
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<FP_SLAB_DES> ltFSD = new List<FP_SLAB_DES>();
|
|
|
IList<FP_SLAB_DES_ALL> ltFSD_ALL = new List<FP_SLAB_DES_ALL>();
|
|
|
//strSql.AppendLine("SELECT * FROM FP_SLAB_DES FSD WHERE 1=1 AND FSD.HAN_RSL IS NULL ");
|
|
|
|
|
|
strSql.AppendLine("SELECT ");
|
|
|
strSql.AppendLine(" FSD.SLAB_NO ");
|
|
|
strSql.AppendLine(" , FSD.BLOCK_SEQ ");
|
|
|
strSql.AppendLine(" , FSD.SEQ ");
|
|
|
strSql.AppendLine(" , FSD.PROC_CD ");
|
|
|
strSql.AppendLine(" , FSD.BEF_PROC_CD ");
|
|
|
strSql.AppendLine(" , FSD.ORD_NO ");
|
|
|
strSql.AppendLine(" , FSD.ORD_ITEM ");
|
|
|
strSql.AppendLine(" , FSD.ORD_CNT ");
|
|
|
strSql.AppendLine(" , FSD.OVER_FL ");
|
|
|
strSql.AppendLine(" , FSD.PROD_CD ");
|
|
|
strSql.AppendLine(" , FSD.STLGRD ");
|
|
|
strSql.AppendLine(" , FSD.THK ");
|
|
|
strSql.AppendLine(" , FSD.WID ");
|
|
|
strSql.AppendLine(" , FSD.LEN ");
|
|
|
strSql.AppendLine(" , FSD.WGT ");
|
|
|
strSql.AppendLine(" , FSD.CNT ");
|
|
|
strSql.AppendLine(" , FSD.CR_CD ");
|
|
|
strSql.AppendLine(" , FSD.UST_FL ");
|
|
|
strSql.AppendLine(" , FSD.TRIM_FL ");
|
|
|
strSql.AppendLine(" , FSD.SMP_FL ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LOC ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.SMP_NO ");
|
|
|
strSql.AppendLine(" , FSD.INS_DATE ");
|
|
|
strSql.AppendLine(" , FSD.INS_TIME ");
|
|
|
strSql.AppendLine(" , FSD.END_DATE ");
|
|
|
strSql.AppendLine(" , FSD.END_TIME ");
|
|
|
strSql.AppendLine(" , FSD.UPD_PGMID ");
|
|
|
strSql.AppendLine(" , FSD.REC_STS ");
|
|
|
strSql.AppendLine(" , FSD.DESIGN_SMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.SLAB_CUT_SEQ ");
|
|
|
strSql.AppendLine(" , FSD.SLAB_LEN ");
|
|
|
strSql.AppendLine(" , FSD.SLAB_WGT ");
|
|
|
strSql.AppendLine(" , FSD.HTM_SHOT_BLAST ");
|
|
|
strSql.AppendLine(" , FSD.HTM_METH1 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_COND1 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_METH2 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_COND2 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_METH3 ");
|
|
|
strSql.AppendLine(" , FSD.HTM_COND3 ");
|
|
|
strSql.AppendLine(" , FSD.ORD_FL ");
|
|
|
strSql.AppendLine(" , FSD.MID_SMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.POSITION_TYPE ");
|
|
|
strSql.AppendLine(" , FSD.POSITION_X ");
|
|
|
strSql.AppendLine(" , FSD.POSITION_Y ");
|
|
|
strSql.AppendLine(" , FSD.OVER_FL2 ");
|
|
|
strSql.AppendLine(" , FSD.INS_FL ");
|
|
|
strSql.AppendLine(" , FSD.FL ");
|
|
|
strSql.AppendLine(" , FSD.INS_PGMID ");
|
|
|
strSql.AppendLine(" , FSD.SMP_FL_RS ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LOC_RS ");
|
|
|
strSql.AppendLine(" , FSD.SMP_LEN_RS ");
|
|
|
strSql.AppendLine(" , FSD.SMP_NO_RS ");
|
|
|
strSql.AppendLine(" , FSD.PLT ");
|
|
|
strSql.AppendLine(" , FSD.ID ");
|
|
|
//strSql.AppendLine(" , FSD.HAN_RSL ");
|
|
|
strSql.AppendLine(" , FSD.HAN_CON ");
|
|
|
strSql.AppendLine(" , FSD.HAN_DATE ");
|
|
|
strSql.AppendLine(" , FSD.THK_RATIO ");
|
|
|
strSql.AppendLine(" , FSD.WID_RATIO ");
|
|
|
strSql.AppendLine(" , FSD.HEAD_LEN ");
|
|
|
strSql.AppendLine(" , FSD.TAIL_LEN ");
|
|
|
strSql.AppendLine(" , FSD.WID_MRGIN ");
|
|
|
strSql.AppendLine(" , FSD.SAMP_LEN ");
|
|
|
strSql.AppendLine(" , FSD.CUT_LOSS ");
|
|
|
strSql.AppendLine(" , FSD.ORG_LEN ");
|
|
|
strSql.AppendLine(" , FSD.ORG_WGT ");
|
|
|
strSql.AppendLine(" , FSD.ORG_THK ");
|
|
|
strSql.AppendLine(" , FSD.ORG_WID ");
|
|
|
strSql.AppendLine(" , FSD.REM_LEN ");
|
|
|
strSql.AppendLine(" , FSD.REM_WGT ");
|
|
|
strSql.AppendLine(" , FSD.YIELD ");
|
|
|
strSql.AppendLine(" , FSD.UTILIZATION ");
|
|
|
strSql.AppendLine(" ,C.CD SUB_KIND ");
|
|
|
strSql.AppendLine(" , TO_DATE(FSD.INS_DATE||FSD.INS_TIME,'yyyy-mm-dd hh24:mi:ss') SUB_TIME ");
|
|
|
strSql.AppendLine(" ,B.CD HAN_RSL ");
|
|
|
strSql.AppendLine("FROM FP_SLAB_DES FSD ");
|
|
|
strSql.AppendLine(" left join (select * from ZP_CD where cd_mana_no= 'CLJG') B on FSD.HAN_RSL =B.CD_NAME ");
|
|
|
strSql.AppendLine(" left join (select * from ZP_CD where cd_mana_no= 'YPLX') C on FSD.HAN_RSL =C.CD_NAME ");
|
|
|
//strSql.AppendLine("WHERE 1 = 1 AND FSD.HAN_RSL IS NOT NULL");
|
|
|
strSql.AppendLine("WHERE 1 = 1 AND FSD.HAN_RSL IS NULL");
|
|
|
//strSql.AppendLine("WHERE 1 = 1 ");
|
|
|
if (queryArgs != null)
|
|
|
{
|
|
|
//板坯号
|
|
|
if (queryArgs.SLAB_NO != null && queryArgs.SLAB_NO != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.SLAB_NO = '" + queryArgs.SLAB_NO + "'");
|
|
|
}
|
|
|
//钢种
|
|
|
if (queryArgs.STLGRD != null && queryArgs.STLGRD != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.STLGRD = '" + queryArgs.STLGRD + "'");
|
|
|
}
|
|
|
//工厂
|
|
|
if (queryArgs.PLT != null && queryArgs.PLT != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND FSD.PLT = '" + queryArgs.PLT + "'");
|
|
|
}
|
|
|
//订单号
|
|
|
if (queryArgs.ORD_NO != null && queryArgs.ORD_NO != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND ORD_NO = '" + queryArgs.ORD_NO + "'");
|
|
|
}
|
|
|
//订单序列
|
|
|
if (queryArgs.ORD_ITEM != null && queryArgs.ORD_ITEM != string.Empty)
|
|
|
{
|
|
|
strSql.AppendLine(" AND ORD_ITEM = '" + queryArgs.ORD_ITEM + "'");
|
|
|
}
|
|
|
//插入时间
|
|
|
//if (queryArgs.INS_DATE_MAX!= null)
|
|
|
//{
|
|
|
// strSql.AppendLine(" AND to_date(ins_date||ins_time,'yyyy-mm-dd hh24:mi:ss') <= '" + queryArgs.INS_DATE_MAX + "'");
|
|
|
//}
|
|
|
//if (queryArgs.INS_DATE_MIN != null)
|
|
|
//{
|
|
|
// strSql.AppendLine(" AND to_date(ins_date||ins_time,'yyyy-mm-dd hh24:mi:ss') > ='" + queryArgs.INS_DATE_MIN + "'");
|
|
|
//}
|
|
|
|
|
|
////处理状态
|
|
|
//if (queryArgs.HAN_RSL != null && queryArgs.HAN_RSL != string.Empty)
|
|
|
//{
|
|
|
// strSql.AppendLine(" AND SUB_KND = (select CD from ZP_CD where cd_mana_no= 'CLJG' AND CD_NAME=={0}) " + queryArgs.SUB_KND);
|
|
|
//}
|
|
|
//替代类型
|
|
|
if (!string.IsNullOrEmpty(queryArgs.SUB_KND))
|
|
|
{
|
|
|
//strSql.AppendLine(" AND B.cd_mana_no= 'YPLX' and = (select CD from ZP_CD where cd_mana_no= 'YPLX' AND CD_NAME=={0}) " + queryArgs.SUB_KND);
|
|
|
//strSql.AppendLine(" AND B.cd_mana_no= 'YPLX' and B.CD_NAME='" + queryArgs.SUB_KND) + "'");
|
|
|
strSql.AppendLine(" AND C.CD = '" + queryArgs.SUB_KND + "'");
|
|
|
}
|
|
|
|
|
|
//处理状态
|
|
|
if (!string.IsNullOrEmpty(queryArgs.HAN_RSL))
|
|
|
{
|
|
|
//strSql.AppendLine(" AND SUB_KND = (select CD from ZP_CD where cd_mana_no= 'CLJG' AND CD_NAME=={0}) " + queryArgs.SUB_KND);
|
|
|
strSql.AppendLine(" AND B.CD = '" + queryArgs.HAN_RSL + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrWhiteSpace(CommonUtils.ObjectToStr(queryArgs.STARTTIME)) && CommonUtils.ObjectToStr(queryArgs.STARTTIME) != "0001/1/1 0:00:00")
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') >= to_date('" + CommonUtils.ObjectToStr(queryArgs.STARTTIME) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
if (!string.IsNullOrWhiteSpace(CommonUtils.ObjectToStr(queryArgs.ENDTIME)) && CommonUtils.ObjectToStr(queryArgs.ENDTIME) != "0001/1/1 0:00:00")
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') < to_date('" + CommonUtils.ObjectToStr(queryArgs.ENDTIME.AddDays(1)) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
if (queryArgs.STARTTIME == DateTime.MinValue && queryArgs.ENDTIME == DateTime.MinValue)
|
|
|
{
|
|
|
queryArgs.STARTTIME = DateTime.Now;
|
|
|
queryArgs.ENDTIME = DateTime.Now;
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') >= to_date('" + CommonUtils.ObjectToStr(queryArgs.STARTTIME.ToString("yyyy-MM-dd")) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
strSql.AppendLine(" AND to_date(FSD.INS_DATE||FSD.INS_TIME ,'yyyy-mm-dd hh24:mi:ss') < to_date('" + CommonUtils.ObjectToStr(queryArgs.ENDTIME.AddDays(1).ToString("yyyy-MM-dd")) + "','yyyy-mm-dd hh24:mi:ss')");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
strSql.AppendLine("ORDER BY FSD.SLAB_NO ,FSD.BLOCK_SEQ,FSD.SEQ ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
ltFSD = db.Query<FP_SLAB_DES>(strSql.ToString());
|
|
|
|
|
|
//result.data = db.Query(strSql.ToString());
|
|
|
if (ltFSD.Count > 0)
|
|
|
{
|
|
|
FP_SLAB_DES_ALL fsda_1 = new FP_SLAB_DES_ALL();
|
|
|
foreach (string strSlab in ltFSD.GroupBy(p => p.SLAB_NO).Select(p => p.Key).ToList())
|
|
|
{
|
|
|
//一层
|
|
|
if (ltFSD_ALL.Where(p => p.SLAB_NO == strSlab).Count() == 0)
|
|
|
{
|
|
|
|
|
|
fsda_1 = new FP_SLAB_DES_ALL();
|
|
|
fsda_1 = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == "01").FirstOrDefault());
|
|
|
fsda_1.LEN = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == "01").FirstOrDefault().ORG_LEN;
|
|
|
fsda_1.WGT = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == "01").FirstOrDefault().ORG_WGT;
|
|
|
fsda_1.THK = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == "01").FirstOrDefault().ORG_THK;
|
|
|
fsda_1.WID = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == "01").FirstOrDefault().ORG_WID;
|
|
|
|
|
|
fsda_1.SLAB_LEN = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00").OrderByDescending(e => e.SLAB_CUT_SEQ).FirstOrDefault().REM_LEN;
|
|
|
fsda_1.SLAB_WGT = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00").OrderByDescending(e => e.SLAB_CUT_SEQ).FirstOrDefault().REM_WGT;
|
|
|
fsda_1.CNT = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00").Count();
|
|
|
|
|
|
fsda_1.YIELD = Math.Round((ltFSD.Where(p => p.SLAB_NO == strSlab && p.BLOCK_SEQ != "00" && p.SEQ != "00").Select(q => q.WGT).Sum()) / (fsda_1.WGT - fsda_1.SLAB_WGT) * 100, 2);
|
|
|
|
|
|
fsda_1.UTILIZATION = Math.Round((fsda_1.WGT - fsda_1.SLAB_WGT) / fsda_1.WGT * 100, 2);
|
|
|
|
|
|
fsda_1.KEY = fsda_1.SLAB_NO + "_00_00_00";// + fsda_1.SLAB_CUT_SEQ;
|
|
|
ltFSD_ALL.Add(fsda_1);
|
|
|
fsda_1.children = new List<FP_SLAB_DES_ALL>();
|
|
|
//二层
|
|
|
foreach (FP_SLAB_DES item_1 in ltFSD.Where(p => p.SLAB_NO == strSlab && p.BLOCK_SEQ == "00" && p.SEQ == "00" && p.SLAB_CUT_SEQ != "00").OrderBy(e => e.SLAB_CUT_SEQ).ToList())
|
|
|
{
|
|
|
FP_SLAB_DES_ALL fsda_2 = new FP_SLAB_DES_ALL();
|
|
|
fsda_2 = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == "00"
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).FirstOrDefault());
|
|
|
fsda_2.KEY = fsda_1.SLAB_NO + "_" + item_1.SLAB_CUT_SEQ + "_00_00";// + fsda_1.SLAB_CUT_SEQ;
|
|
|
|
|
|
fsda_2.CNT = ltFSD.Where(p => p.SLAB_NO == strSlab && p.BLOCK_SEQ == "00" && p.SEQ == "00" && p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).Count();
|
|
|
|
|
|
fsda_1.children.Add(fsda_2);
|
|
|
fsda_2.children = new List<FP_SLAB_DES_ALL>();
|
|
|
//三层
|
|
|
foreach (FP_SLAB_DES item_2 in ltFSD.Where(p => p.SLAB_NO == strSlab && p.BLOCK_SEQ != "00" && p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).OrderBy(e => e.BLOCK_SEQ).ToList())
|
|
|
{
|
|
|
FP_SLAB_DES_ALL fsda_3 = new FP_SLAB_DES_ALL();
|
|
|
fsda_3 = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == item_2.BLOCK_SEQ
|
|
|
&& p.SEQ == "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).FirstOrDefault());
|
|
|
fsda_3.KEY = fsda_1.SLAB_NO + "_" + item_1.SLAB_CUT_SEQ + "" + item_2.BLOCK_SEQ + "_00";// + fsda_1.SLAB_CUT_SEQ;
|
|
|
fsda_3.CNT = ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == item_2.BLOCK_SEQ
|
|
|
&& p.SEQ != "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).Count();
|
|
|
|
|
|
fsda_2.children.Add(fsda_3);
|
|
|
fsda_3.children = new List<FP_SLAB_DES_ALL>();
|
|
|
//四层
|
|
|
foreach (FP_SLAB_DES item_3 in ltFSD.Where(p => p.SLAB_NO == strSlab
|
|
|
&& p.BLOCK_SEQ == item_2.BLOCK_SEQ && p.SEQ != "00"
|
|
|
&& p.SLAB_CUT_SEQ == item_1.SLAB_CUT_SEQ).ToList())
|
|
|
{
|
|
|
FP_SLAB_DES_ALL fsda_4 = new FP_SLAB_DES_ALL();
|
|
|
fsda_4 = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(item_3);
|
|
|
fsda_4.KEY = fsda_1.SLAB_NO + "_" + item_1.SLAB_CUT_SEQ + "" + item_2.BLOCK_SEQ + "_" + item_3.SEQ;// + fsda_1.SLAB_CUT_SEQ;
|
|
|
fsda_3.children.Add(fsda_4);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
result.data = ltFSD_ALL;
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.data = ltFSD;
|
|
|
result.msg = "未找到查询所需数据!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetSlabSub 报错", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取时间戳
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public static string GetTimeStamp()
|
|
|
{
|
|
|
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 8, 0, 0, 0);
|
|
|
return Convert.ToInt64(ts.TotalMilliseconds).ToString();
|
|
|
}
|
|
|
|
|
|
public static FP_SLAB_DES_ALL CopyToModel<FP_SLAB_DES, FP_SLAB_DES_ALL>(FP_SLAB_DES source)
|
|
|
{
|
|
|
FP_SLAB_DES_ALL model = default(FP_SLAB_DES_ALL);
|
|
|
PropertyInfo[] pi = typeof(FP_SLAB_DES_ALL).GetProperties();
|
|
|
PropertyInfo[] pi1 = typeof(FP_SLAB_DES).GetProperties();
|
|
|
model = Activator.CreateInstance<FP_SLAB_DES_ALL>();
|
|
|
for (int i = 0; i < pi.Length; i++)
|
|
|
{
|
|
|
for (int k = 0; k < pi1.Length; k++)
|
|
|
{
|
|
|
if (pi[i].Name == pi1[k].Name)
|
|
|
{
|
|
|
pi[i].SetValue(model, pi1[k].GetValue(source, null), null);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return model;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region C3配置接口
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取配置参数
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("GetCNFC3")]
|
|
|
public RequestEntity GetCNFC3()
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
|
|
|
//获取替代信息
|
|
|
result.data = SerSurMatSubService.GetCNFC3();
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetCNFC3 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新配置参数
|
|
|
/// </summary>
|
|
|
/// <param name="prTBSubRules">配置参数</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("UpdateCNFC3")]
|
|
|
public RequestEntity UpdateCNFC3(TB_CNF_C3 prTBSubRules)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
IList<TB_CNF_C3> ilist = SerSurMatSubService.GetCNFC3();
|
|
|
if (ilist[0].ID == prTBSubRules.ID
|
|
|
&& ilist[0].RATE == prTBSubRules.RATE
|
|
|
&& ilist[0].RATE_NI == prTBSubRules.RATE_NI
|
|
|
&& ilist[0].LEN_REM == prTBSubRules.LEN_REM
|
|
|
&& ilist[0].WAR_VAL == prTBSubRules.WAR_VAL
|
|
|
&& ilist[0].SWITCH == prTBSubRules.SWITCH
|
|
|
&& ilist[0].TIMERANGE == prTBSubRules.TIMERANGE
|
|
|
&& ilist[0].SLAB_LEN_MIN == prTBSubRules.SLAB_LEN_MIN
|
|
|
&& ilist[0].SLAB_LEN_MAX == prTBSubRules.SLAB_LEN_MAX
|
|
|
&& ilist[0].SLAB_THK_MIN == prTBSubRules.SLAB_THK_MIN
|
|
|
&& ilist[0].SLAB_THK_MAX == prTBSubRules.SLAB_THK_MAX
|
|
|
&& ilist[0].SLAB_WID_MIN == prTBSubRules.SLAB_WID_MIN
|
|
|
&& ilist[0].SLAB_WID_MAX == prTBSubRules.SLAB_WID_MAX
|
|
|
&& ilist[0].ORD_THK_MIN == prTBSubRules.ORD_THK_MIN
|
|
|
&& ilist[0].ORD_THK_MAX == prTBSubRules.ORD_THK_MAX
|
|
|
&& ilist[0].ORD_WID_MIN == prTBSubRules.ORD_WID_MIN
|
|
|
&& ilist[0].ORD_WID_MAX == prTBSubRules.ORD_WID_MAX
|
|
|
&& ilist[0].DATERANGE == prTBSubRules.DATERANGE
|
|
|
)
|
|
|
{
|
|
|
UpdateCNFC3_SQL(prTBSubRules);
|
|
|
result.msg = "数据未变更无需确认";
|
|
|
result.code = "2";
|
|
|
return result;
|
|
|
}
|
|
|
UpdateCNFC3_SQL(prTBSubRules);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetOrder 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新配置参数
|
|
|
/// </summary>
|
|
|
public void UpdateCNFC3_SQL(TB_CNF_C3 prTBSubRules)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
IList<TB_CNF_C3> ilist = SerSurMatSubService.GetCNFC3();
|
|
|
StringBuilder strsql = new StringBuilder();
|
|
|
if (prTBSubRules.ID != string.Empty)
|
|
|
{
|
|
|
strsql.AppendLine("UPDATE TB_CNF_C3 SET ID='" + prTBSubRules.ID + "'");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.RATE))
|
|
|
{
|
|
|
strsql.AppendLine(", RATE='" + prTBSubRules.RATE + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.RATE_NI))
|
|
|
{
|
|
|
strsql.AppendLine(", RATE_NI='" + prTBSubRules.RATE_NI + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.LEN_REM))
|
|
|
{
|
|
|
strsql.AppendLine(", LEN_REM='" + prTBSubRules.LEN_REM + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.WAR_VAL))
|
|
|
{
|
|
|
strsql.AppendLine(", WAR_VAL='" + prTBSubRules.WAR_VAL + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.STLGRD))
|
|
|
{
|
|
|
strsql.AppendLine(", STLGRD='" + prTBSubRules.STLGRD + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.HEAT))
|
|
|
{
|
|
|
strsql.AppendLine(", HEAT='" + prTBSubRules.HEAT + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.SWITCH))
|
|
|
{
|
|
|
strsql.AppendLine(", SWITCH='" + prTBSubRules.SWITCH + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.TIMERANGE))
|
|
|
{
|
|
|
strsql.AppendLine(", TIMERANGE='" + prTBSubRules.TIMERANGE + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.SLAB_LEN_MIN))
|
|
|
{
|
|
|
strsql.AppendLine(", SLAB_LEN_MIN='" + prTBSubRules.SLAB_LEN_MIN + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.SLAB_LEN_MAX))
|
|
|
{
|
|
|
strsql.AppendLine(", SLAB_LEN_MAX='" + prTBSubRules.SLAB_LEN_MAX + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.SLAB_THK_MIN))
|
|
|
{
|
|
|
strsql.AppendLine(", SLAB_THK_MIN='" + prTBSubRules.SLAB_THK_MIN + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.SLAB_THK_MAX))
|
|
|
{
|
|
|
strsql.AppendLine(", SLAB_THK_MAX='" + prTBSubRules.SLAB_THK_MAX + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.SLAB_WID_MIN))
|
|
|
{
|
|
|
strsql.AppendLine(", SLAB_WID_MIN='" + prTBSubRules.SLAB_WID_MIN + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.SLAB_WID_MAX))
|
|
|
{
|
|
|
strsql.AppendLine(", SLAB_WID_MAX='" + prTBSubRules.SLAB_WID_MAX + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.ORD_THK_MIN))
|
|
|
{
|
|
|
strsql.AppendLine(", ORD_THK_MIN='" + prTBSubRules.ORD_THK_MIN + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.ORD_THK_MAX))
|
|
|
{
|
|
|
strsql.AppendLine(", ORD_THK_MAX='" + prTBSubRules.ORD_THK_MAX + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.ORD_WID_MIN))
|
|
|
{
|
|
|
strsql.AppendLine(", ORD_WID_MIN='" + prTBSubRules.ORD_WID_MIN + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.ORD_WID_MAX))
|
|
|
{
|
|
|
strsql.AppendLine(", ORD_WID_MAX='" + prTBSubRules.ORD_WID_MAX + "'");
|
|
|
}
|
|
|
|
|
|
strsql.AppendLine(", DATERANGE='" + prTBSubRules.DATERANGE + "'");
|
|
|
|
|
|
strsql.AppendLine("WHERE ID='" + prTBSubRules.ID + "'");
|
|
|
}
|
|
|
db.BeginTransaction();
|
|
|
string UPD_BEF = string.Format("RATE:{0},RATE_NI:{1},LEN_REM:{2},WAR_VAL:{3},SWITCH:{4},TIMERANGE:{5},SLAB_LEN_MIN:{6},SLAB_LEN_MAX:{7},SLAB_THK_MIN:{8},SLAB_THK_MAX:{9},ORD_THK_MIN:{10},ORD_THK_MAX:{11},ORD_WID_MIN:{12},ORD_WID_MAX:{13},DATERANGE:{14},SLAB_WID_MIN:{15},SLAB_WID_MAX:{16},STLGRD:{17},HEAT:{18}"
|
|
|
, ilist[0].RATE, ilist[0].RATE_NI, ilist[0].LEN_REM, ilist[0].WAR_VAL, ilist[0].SWITCH, ilist[0].TIMERANGE, ilist[0].SLAB_LEN_MIN, ilist[0].SLAB_LEN_MAX, ilist[0].SLAB_THK_MIN, ilist[0].SLAB_THK_MAX, ilist[0].ORD_THK_MIN, ilist[0].ORD_THK_MAX, ilist[0].ORD_WID_MIN, ilist[0].ORD_WID_MAX, ilist[0].DATERANGE, ilist[0].SLAB_WID_MIN, ilist[0].SLAB_WID_MAX, ilist[0].STLGRD, ilist[0].HEAT);
|
|
|
string UPD_AFT = string.Format("RATE:{0},RATE_NI:{1},LEN_REM:{2},WAR_VAL:{3},SWITCH:{4},TIMERANGE:{5},SLAB_LEN_MIN:{6},SLAB_LEN_MAX:{7},SLAB_THK_MIN:{8},SLAB_THK_MAX:{9},ORD_THK_MIN:{10},ORD_THK_MAX:{11},ORD_WID_MIN:{12},ORD_WID_MAX:{13},DATERANGE:{14},SLAB_WID_MIN:{15},SLAB_WID_MIN:{16},STLGRD:{17},HEAT:{18}"
|
|
|
, prTBSubRules.RATE, prTBSubRules.RATE_NI, prTBSubRules.LEN_REM, prTBSubRules.WAR_VAL, prTBSubRules.SWITCH, prTBSubRules.TIMERANGE, prTBSubRules.SLAB_LEN_MIN, prTBSubRules.SLAB_LEN_MAX, prTBSubRules.SLAB_THK_MIN, prTBSubRules.SLAB_THK_MAX, prTBSubRules.ORD_THK_MIN, prTBSubRules.ORD_THK_MAX, prTBSubRules.ORD_WID_MIN, prTBSubRules.ORD_WID_MAX, prTBSubRules.DATERANGE, prTBSubRules.SLAB_WID_MIN, prTBSubRules.SLAB_WID_MAX, prTBSubRules.STLGRD, prTBSubRules.HEAT);
|
|
|
string strsqlUPD = string.Format("INSERT INTO TB_CNF_LOG(UPD_TIME,UPD_BEF,UPD_AFT,UPD_EMP,PLT) VALUES('{0}','{1}','{2}','{3}','{4}')", DateTime.Now, UPD_BEF, UPD_AFT, "", "C3");
|
|
|
logger.Info(strsqlUPD);
|
|
|
db.Execute(strsqlUPD.ToString());
|
|
|
db.Execute(strsql.ToString());
|
|
|
db.Commit();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("UpdateCNFC3 报错", ex);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region C2配置接口
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取配置参数
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("GetCNFC2")]
|
|
|
public RequestEntity GetCNFC2()
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
|
|
|
//获取替代信息
|
|
|
result.data = SerSurMatSubService.GetCNFC2();
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetCNFC2 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新配置参数
|
|
|
/// </summary>
|
|
|
/// <param name="prTBSubRules">配置参数</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("UpdateCNFC2")]
|
|
|
public RequestEntity UpdateCNFC2(TB_CNF_C2 prTBSubRules)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
IList<TB_CNF_C2> ilist = SerSurMatSubService.GetCNFC2();
|
|
|
if (ilist[0].ID == prTBSubRules.ID
|
|
|
&& ilist[0].WAR_VAL == prTBSubRules.WAR_VAL
|
|
|
&& ilist[0].SWITCH == prTBSubRules.SWITCH
|
|
|
&& ilist[0].TSWITCH == prTBSubRules.TSWITCH
|
|
|
&& ilist[0].TIMERANGE == prTBSubRules.TIMERANGE
|
|
|
)
|
|
|
{
|
|
|
//UpdateCNFC2_SQL(prTBSubRules);
|
|
|
result.msg = "数据未变更无需确认";
|
|
|
result.code = "2";
|
|
|
return result;
|
|
|
}
|
|
|
UpdateCNFC2_SQL(prTBSubRules);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetOrder 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新配置参数
|
|
|
/// </summary>
|
|
|
public void UpdateCNFC2_SQL(TB_CNF_C2 prTBSubRules)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
IList<TB_CNF_C2> ilist = SerSurMatSubService.GetCNFC2();
|
|
|
StringBuilder strsql = new StringBuilder();
|
|
|
|
|
|
if (prTBSubRules.ID != string.Empty)
|
|
|
{
|
|
|
strsql.AppendLine("UPDATE TB_CNF_C2 SET ID='" + prTBSubRules.ID + "'");
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.WAR_VAL))
|
|
|
{
|
|
|
strsql.AppendLine(", WAR_VAL='" + prTBSubRules.WAR_VAL + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.SWITCH))
|
|
|
{
|
|
|
strsql.AppendLine(", SWITCH='" + prTBSubRules.SWITCH + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.TSWITCH))
|
|
|
{
|
|
|
strsql.AppendLine(", TSWITCH='" + prTBSubRules.TSWITCH + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.TIMERANGE))
|
|
|
{
|
|
|
strsql.AppendLine(", TIMERANGE='" + prTBSubRules.TIMERANGE + "'");
|
|
|
}
|
|
|
|
|
|
strsql.AppendLine("WHERE ID='" + prTBSubRules.ID + "'");
|
|
|
}
|
|
|
db.BeginTransaction();
|
|
|
string UPD_BEF = string.Format("WAR_VAL:{0},SWITCH:{1},TSWITCH:{2},TIMERANGE:{3}", ilist[0].WAR_VAL, ilist[0].SWITCH, ilist[0].TSWITCH, ilist[0].TIMERANGE);
|
|
|
string UPD_AFT = string.Format("WAR_VAL:{0},SWITCH:{1},TSWITCH:{2},TIMERANGE:{3}", prTBSubRules.WAR_VAL, prTBSubRules.SWITCH, prTBSubRules.TSWITCH, prTBSubRules.TIMERANGE);
|
|
|
string strsqlUPD = string.Format("INSERT INTO TB_CNF_LOG(UPD_TIME,UPD_BEF,UPD_AFT,UPD_EMP,PLT) VALUES('{0}','{1}','{2}','{3}','{4}')", DateTime.Now, UPD_BEF, UPD_AFT, "", "C2");
|
|
|
logger.Info(strsqlUPD);
|
|
|
db.Execute(strsqlUPD.ToString());
|
|
|
db.Execute(strsql.ToString());
|
|
|
db.Commit();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("UpdateCNFC2 报错", ex);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region C1配置接口
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取配置参数
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("GetCNFC1")]
|
|
|
public RequestEntity GetCNFC1()
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
|
|
|
//获取替代信息
|
|
|
result.data = SerSurMatSubService.GetCNFC1();
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetCNFC1 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新配置参数
|
|
|
/// </summary>
|
|
|
/// <param name="prTBSubRules">配置参数</param>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost, Route("UpdateCNFC1")]
|
|
|
public RequestEntity UpdateCNFC1(TB_CNF_C1 prTBSubRules)
|
|
|
{
|
|
|
RequestEntity result = new RequestEntity();
|
|
|
try
|
|
|
{
|
|
|
IList<TB_CNF_C1> ilist = SerSurMatSubService.GetCNFC1();
|
|
|
if (ilist[0].ID == prTBSubRules.ID
|
|
|
&& ilist[0].RATE == prTBSubRules.RATE
|
|
|
&& ilist[0].RATE_NI == prTBSubRules.RATE_NI
|
|
|
&& ilist[0].LEN_REM == prTBSubRules.LEN_REM
|
|
|
&& ilist[0].LEN_REM1 == prTBSubRules.LEN_REM1
|
|
|
&& ilist[0].LEN_REM2 == prTBSubRules.LEN_REM2
|
|
|
&& ilist[0].WAR_VAL == prTBSubRules.WAR_VAL
|
|
|
&& ilist[0].SWITCH == prTBSubRules.SWITCH
|
|
|
&& ilist[0].LEN_COM == prTBSubRules.LEN_COM
|
|
|
&& ilist[0].CAL_WID == prTBSubRules.CAL_WID
|
|
|
&& ilist[0].CAL_WID1 == prTBSubRules.CAL_WID1
|
|
|
&& ilist[0].TIMERANGE == prTBSubRules.TIMERANGE
|
|
|
)
|
|
|
{
|
|
|
//UpdateCNFC1_SQL(prTBSubRules);
|
|
|
result.msg = "数据未变更无需确认";
|
|
|
result.code = "2";
|
|
|
return result;
|
|
|
}
|
|
|
UpdateCNFC1_SQL(prTBSubRules);
|
|
|
result.msg = "操作成功!";
|
|
|
result.code = "1";
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.msg = "数据库错误!";
|
|
|
result.code = "0";
|
|
|
logger.Error("GetOrder 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 更新配置参数
|
|
|
/// </summary>
|
|
|
public void UpdateCNFC1_SQL(TB_CNF_C1 prTBSubRules)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
IList<TB_CNF_C1> ilist = SerSurMatSubService.GetCNFC1();
|
|
|
StringBuilder strsql = new StringBuilder();
|
|
|
strsql.AppendLine("UPDATE TB_CNF_C1 SET ID='" + prTBSubRules.ID + "'");
|
|
|
if (prTBSubRules.ID != string.Empty)
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.RATE))
|
|
|
{
|
|
|
strsql.AppendLine(", RATE='" + prTBSubRules.RATE + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.RATE_NI))
|
|
|
{
|
|
|
strsql.AppendLine(", RATE_NI='" + prTBSubRules.RATE_NI + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.LEN_REM))
|
|
|
{
|
|
|
strsql.AppendLine(", LEN_REM='" + prTBSubRules.LEN_REM + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.LEN_COM))
|
|
|
{
|
|
|
strsql.AppendLine(", LEN_COM='" + prTBSubRules.LEN_COM + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.LEN_REM1))
|
|
|
{
|
|
|
strsql.AppendLine(", LEN_REM1='" + prTBSubRules.LEN_REM1 + "'");
|
|
|
}
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.LEN_REM2))
|
|
|
{
|
|
|
strsql.AppendLine(", LEN_REM2='" + prTBSubRules.LEN_REM2 + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.CAL_WID))
|
|
|
{
|
|
|
strsql.AppendLine(", CAL_WID='" + prTBSubRules.CAL_WID + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.CAL_WID1))
|
|
|
{
|
|
|
strsql.AppendLine(", CAL_WID1='" + prTBSubRules.CAL_WID1 + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.WAR_VAL))
|
|
|
{
|
|
|
strsql.AppendLine(", WAR_VAL='" + prTBSubRules.WAR_VAL + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.SWITCH))
|
|
|
{
|
|
|
strsql.AppendLine(", SWITCH='" + prTBSubRules.SWITCH + "'");
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(prTBSubRules.TIMERANGE))
|
|
|
{
|
|
|
strsql.AppendLine(", TIMERANGE='" + prTBSubRules.TIMERANGE + "'");
|
|
|
}
|
|
|
|
|
|
strsql.AppendLine("WHERE ID='" + prTBSubRules.ID + "'");
|
|
|
}
|
|
|
db.BeginTransaction();
|
|
|
string UPD_BEF = string.Format("RATE:{0},RATE_NI:{1},LEN_REM:{2},LEN_COM:{3},LEN_REM1:{4},LEN_REM2:{5},CAL_WID:{6},CAL_WID1:{7},WAR_VAL:{8},SWITCH:{9},TIMERANGE:{10}"
|
|
|
, ilist[0].RATE, ilist[0].RATE_NI, ilist[0].LEN_REM, ilist[0].LEN_COM, ilist[0].LEN_REM1, ilist[0].LEN_REM2, ilist[0].CAL_WID, ilist[0].CAL_WID1, ilist[0].WAR_VAL, ilist[0].SWITCH, ilist[0].TIMERANGE);
|
|
|
string UPD_AFT = string.Format("RATE:{0},RATE_NI:{1},LEN_REM:{2},LEN_COM:{3},LEN_REM1:{4},LEN_REM2:{5},CAL_WID:{6},CAL_WID1:{7},WAR_VAL:{8},SWITCH:{9},TIMERANGE:{10}"
|
|
|
, prTBSubRules.RATE, prTBSubRules.RATE_NI, prTBSubRules.LEN_REM, prTBSubRules.LEN_COM, prTBSubRules.LEN_REM1, prTBSubRules.LEN_REM2, prTBSubRules.CAL_WID, prTBSubRules.CAL_WID1, prTBSubRules.WAR_VAL, prTBSubRules.SWITCH, prTBSubRules.TIMERANGE);
|
|
|
string strsqlUPD = string.Format("INSERT INTO TB_CNF_LOG(UPD_TIME,UPD_BEF,UPD_AFT,UPD_EMP,PLT) VALUES('{0}','{1}','{2}','{3}','{4}')", DateTime.Now, UPD_BEF, UPD_AFT, "", "C1");
|
|
|
logger.Info(strsqlUPD);
|
|
|
db.Execute(strsqlUPD.ToString());
|
|
|
db.Execute(strsql.ToString());
|
|
|
db.Commit();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("UpdateCNFC1 报错", ex);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
}
|