using ibk.IPD.Entity;
using ibk.IPD.Entity.IPD_MR.HotRoll;
using ibk.IPD.Entity.IPD_PS;
using ibk.IPD.Entity.IpdPs;
using log4net;
using SinglePlateHandle.Enity;
using SOA.Objects;
using SOA.Persistent;
using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using System.Text;
using QP_STD_HEAD = ibk.IPD.Entity.IPD_PS.QP_STD_HEAD;
namespace ibk.IPD.Service.IPD_PS
{
public class SurMatSubService
{
private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
#region 获取存储数据
///
/// 获取所有未确认数据
///
///
public IList GetUnConSUPERSEDE()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gSUPERSEDE = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM SUPERSEDE");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
gSUPERSEDE = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetUnConSUPERSEDE 报错", ex);
}
return gSUPERSEDE;
}
public IList GetUnConSUPERSEDEHIS()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gSUPERSEDE = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM SUPERSEDE_HISTORY where 1=1");
strSql.AppendLine(" and HAN_RSL <> 'S'");
strSql.AppendLine(" and to_date(SUB_DATE,'yyyy-mm-dd hh24:mi:ss') < to_date('" + DateTime.Now.AddDays(-1) + "','yyyy-mm-dd hh24:mi:ss')");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
gSUPERSEDE = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetUnConSUPERSEDE 报错", ex);
}
return gSUPERSEDE;
}
public IList GetONWAY_PLA_FUNGIBLE_SPECI()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gSUPERSEDE = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM ONWAY_PLA_FUNGIBLE_SPECI where 1=1");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
gSUPERSEDE = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetUnConSUPERSEDE 报错", ex);
}
return gSUPERSEDE;
}
public IList GetSTDSPEC_Only_One()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gSTDSPEC = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine(" select STDSPEC from NISCO.BP_ORDER_ITEM boi where boi.CUST_DEL_TO_DATE > TO_CHAR(SYSdate + '-90' ,'yyyyMMdd') GROUP BY STDSPEC HAVING count(STDSPEC) =1");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
gSTDSPEC = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetSTDSPEC_Only_One 报错", ex);
}
return gSTDSPEC;
}
/////
///// 可用订单选择
///// 订单欠量字段 ORD_REM_CNT
/////
///// 所有符合条件的订单 集合
//public IList GetOrder(string strWHereOrd, string strSpecialOrd)
//{
// StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
// StringBuilder strRemSql = new StringBuilder(); //声明订单欠量sql
// IList gpPlates = null;
// //查询可用订单以及常用字段
// strSql.AppendLine(" SELECT ");
// strSql.AppendLine(" BOI.ORD_NO, BOI.ORD_ITEM, 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, BOI.STLGRD, BOI.PAYMENT_COND, BOI.DEL_COND, BOI.DEL_TOL_UNIT, BOI.DEL_TOL_MAX, BOI.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 ");
// //TODO:TEST_DATA
// 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(",1 AS SUB_LACK_NUM ");
// 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(",QQT.HTM_METH1 ");
// strSql.AppendLine(",QQT.HTM_METH2 ");
// strSql.AppendLine(",QQT.HTM_METH3 ");
// strSql.AppendLine(",count(EP_SLAB_B.REQ_SEQ_NO) SLAB_LACK_NUM , count(EP_SLAB_B.REQ_SEQ_NO) + 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 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.EP_REQ_SLAB EP_SLAB ");
// strSql.AppendLine("ON EP_SLAB.ORD_NO = QQD.ORD_NO ");
// strSql.AppendLine("AND EP_SLAB.ORD_ITEM = QQD.ORD_ITEM ");
// strSql.AppendLine("LEFT JOIN NISCO.EP_REQ_SLAB_D EP_SLAB");
// strSql.AppendLine("ON EP_SLAB.ORD_NO = QQD.ORD_NO ");
// strSql.AppendLine("AND EP_SLAB.ORD_ITEM = QQD.ORD_ITEM ");
// strSql.AppendLine("AND EP_SLAB.BLOCK_SEQ >= '01'");
// strSql.AppendLine("AND EP_SLAB.SEQ >= '01'");
// strSql.AppendLine("LEFT JOIN NISCO.EP_REQ_SLAB EP_SLAB_B");
// strSql.AppendLine("ON EP_SLAB.REQ_SEQ_NO = EP_SLAB_B.REQ_SEQ_NO");
// strSql.AppendLine("AND EP_SLAB_B.REC_STS = '1'");
// //TODO:TEST_DATA
// strSql.AppendLine("WHERE 1=1 ");
// strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
// strSql.AppendLine("AND boi.PROD_CD = 'PP' ");
// strSql.AppendLine("AND boi.REC_STS = '2' ");
// strSql.AppendLine("and boi.ORD_STS IN('E', 'D') ");
// strSql.AppendLine("AND boi.ord_knd IN('A') ");
// strSql.AppendLine("AND boi.ORD_NO NOT LIKE 'OMZ%'");
// strSql.AppendLine(strWHereOrd);
// strSql.AppendLine(strSpecialOrd);
// //strSql.AppendLine(" or boi.ORD_NO ='OMC22100055'");
// //strSql.AppendLine(" AND boi.ORD_ITEM ='106'");
// strSql.AppendLine("GROUP BY BOI.ORD_NO, BOI.ORD_ITEM, 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, BOI.STLGRD, BOI.PAYMENT_COND, BOI.DEL_COND, BOI.DEL_TOL_UNIT, BOI.DEL_TOL_MAX, BOI.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 ,FLOOR( (NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)) ,(NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) ");
// strSql.AppendLine(", QQT.HTM_METH1 ");
// strSql.AppendLine(", QQT.HTM_METH2 ");
// strSql.AppendLine(", QQT.HTM_METH3 ");
// try
// {
// //开启数据库连接查询数据
// using (IDbContext db = ObjectContainer.GetObject("db_sur"))
// {
// gpPlates = db.Query(strSql.ToString());
// // logger.Info(gpPlates.Count.ToString());
// //gpPlates = CommonUtils.DataTableToList(a);
// // logger.Info("gpPlates :" + a.Rows.Count);
// }
// }
// catch (Exception ex)
// {
// logger.Error("GetOrder 报错", ex);
// }
// return gpPlates;
//}
///
/// 可用订单选择
/// 订单欠量字段 ORD_REM_CNT
///
/// 所有符合条件的订单 集合
public IList GetOrder(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
StringBuilder strRemSql = new StringBuilder(); //声明订单欠量sql
IList gpPlates = null;
//查询可用订单以及常用字段
strSql.AppendLine(" SELECT ");
strSql.AppendLine(" BOI.ORD_NO, BOI.ORD_ITEM, 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, BOI.STLGRD, BOI.PAYMENT_COND, BOI.DEL_COND, BOI.DEL_TOL_UNIT, BOI.DEL_TOL_MAX, BOI.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 ");
//TODO:TEST_DATA
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(",1 AS SUB_LACK_NUM ");
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(",QQT.HTM_METH1 ");
strSql.AppendLine(",QQT.HTM_METH2 ");
strSql.AppendLine(",QQT.HTM_METH3 ");
strSql.AppendLine(",count(EP_SLAB_D.REQ_SEQ_NO) SLAB_LACK_NUM , count(EP_SLAB_D.REQ_SEQ_NO) + 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 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.EP_REQ_SLAB EP_SLAB_B ");
strSql.AppendLine("ON EP_SLAB_B.ORD_NO = QQD.ORD_NO ");
strSql.AppendLine("AND EP_SLAB_B.ORD_ITEM = QQD.ORD_ITEM ");
strSql.AppendLine("AND EP_SLAB_B.REC_STS = '1'");
//strSql.AppendLine("LEFT JOIN NISCO.EP_REQ_SLAB EP_SLAB_B");
//strSql.AppendLine("ON EP_SLAB.REQ_SEQ_NO = EP_SLAB_B.REQ_SEQ_NO");
strSql.AppendLine("LEFT JOIN NISCO.EP_REQ_SLAB_D EP_SLAB_D");
strSql.AppendLine("ON EP_SLAB_D.ORD_NO = QQD.ORD_NO ");
strSql.AppendLine("AND EP_SLAB_D.REQ_SEQ_NO= EP_SLAB_D.REQ_SEQ_NO");
strSql.AppendLine("AND EP_SLAB_D.ORD_ITEM = QQD.ORD_ITEM ");
strSql.AppendLine("AND EP_SLAB_D.BLOCK_SEQ >= '01'");
strSql.AppendLine("AND EP_SLAB_D.SEQ >= '01'");
strSql.AppendLine("AND EP_SLAB_B.REC_STS = '1'");
//TODO:TEST_DATA
strSql.AppendLine("WHERE 1=1 ");
strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
strSql.AppendLine("AND boi.PROD_CD = 'PP' ");
strSql.AppendLine("AND boi.REC_STS = '2' ");
strSql.AppendLine("and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine("AND boi.ord_knd IN('A') ");
//strSql.AppendLine("AND boi.ORD_NO NOT LIKE 'OMZ%'");
strSql.AppendLine(strWHereOrd);
strSql.AppendLine(strSpecialOrd);
//strSql.AppendLine(" or boi.ORD_NO ='OMD22110005'");
//strSql.AppendLine(" AND boi.ORD_ITEM ='100'");
strSql.AppendLine("GROUP BY BOI.ORD_NO, BOI.ORD_ITEM, 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, BOI.STLGRD, BOI.PAYMENT_COND, BOI.DEL_COND, BOI.DEL_TOL_UNIT, BOI.DEL_TOL_MAX, BOI.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 ,FLOOR( (NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)) ,(NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) ");
strSql.AppendLine(", QQT.HTM_METH1 ");
strSql.AppendLine(", QQT.HTM_METH2 ");
strSql.AppendLine(", QQT.HTM_METH3 ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
gpPlates = db.Query(strSql.ToString());
// logger.Info(gpPlates.Count.ToString());
//gpPlates = CommonUtils.DataTableToList(a);
// logger.Info("gpPlates :" + a.Rows.Count);
}
}
catch (Exception ex)
{
logger.Error("GetOrder 报错", ex);
}
return gpPlates;
}
///
///查询所有余材的信息
///
/// 所有符合条件的XAC,DZB,DZE,QAB 状态余材 集合
public IList GetGP_SMP_NO(string strWHerePlate, string strNotinPlate)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gpPlates = new List();
//查询语句日期时间拼接起来格式化成yyyy-mm-dd hh24:mi:ss PROD_WGT
strSql.AppendLine("SELECT");
strSql.AppendLine(" distinct GP.PLATE_NO ,GP.SMP_NO ");
strSql.AppendLine("FROM NISCO.GP_PLATE GP where smp_no is not null ");
strSql.AppendLine(strWHerePlate);
strSql.AppendLine(strNotinPlate);
strSql.AppendLine("ORDER BY GP.PLATE_NO");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
gpPlates = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetGP_SMP_NO 报错", ex);
}
return gpPlates;
}
///
///查询降级到余材
///
/// 所有符合条件的XAC,DZB,DZE,QAB 状态余材 集合
public IList GetREP_TYP()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gpPlates = new List();
//查询语句日期时间拼接起来格式化成yyyy-mm-dd hh24:mi:ss PROD_WGT
strSql.AppendLine("SELECT");
strSql.AppendLine(" * FROM NISCO.CP_REP_HIS ");
strSql.AppendLine(" WHERE 1=1 ");
strSql.AppendLine(" AND REP_TYP = '1' ");
strSql.AppendLine(" AND INS_EMP = '0007299' ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
gpPlates = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetREP_TYP 报错", ex);
}
return gpPlates;
}
///
///查询所有余材的信息
///
/// 所有符合条件的XAC,DZB,DZE,QAB 状态余材 集合
public IList GetAllMat(string strWHerePlate, string strNotinPlate)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gpPlates = new List();
//查询语句日期时间拼接起来格式化成yyyy-mm-dd hh24:mi:ss PROD_WGT
strSql.AppendLine("SELECT");
strSql.AppendLine(" GP.PLATE_NO ");
strSql.AppendLine(",GI.INSP_B_DEP_FLAW2 ");
strSql.AppendLine(",(SELECT COUNT(*) ");
strSql.AppendLine(" FROM NISCO.GP_USTRESULT GU ");
strSql.AppendLine(" WHERE GU.PLATE_NO = TRIM(GP.PLATE_NO) ");
strSql.AppendLine(" AND GU.UST_DEC = 'Y') GU_CNT ");
strSql.AppendLine(", QQD.THK_TOL_MIN ,QQD.THK_TOL_MAX , GP.OCCR_CD, GP.PLT, GP.PRC_LINE, GP.REC_STS, GP.PROC_CD, GP.BEF_PROC_CD, GP.PROD_CD, GP.STLGRD");
strSql.AppendLine(", CASE WHEN gpr.THK > 0 and gp.PROC_CD <> 'XAC' THEN gpr.THK ELSE gp.THK END THK");
strSql.AppendLine(", CASE WHEN gpr.WID > 0 and gp.PROC_CD <> 'XAC' THEN gpr.WID ELSE gp.WID END WID");
strSql.AppendLine(", CASE WHEN gpr.LEN > 0 and gp.PROC_CD <> 'XAC' THEN gpr.LEN ELSE gp.LEN END LEN");
strSql.AppendLine(", GP.WGT, GP.CAL_WGT, GP.THK_GRP, GP.WID_GRP, GP.OVER_FL, GP.ORD_FL, GP.WOO_RSN ");
strSql.AppendLine(", GP.ORD_NO, GP.ORD_ITEM, GP.ORG_ORD_NO, GP.ORG_ORD_ITEM, GP.ENDUSE_CD, GP.DEL_TO_DATE, GP.PROD_DATE ");
strSql.AppendLine(", GP.PROD_TIME, GP.SHIFT, GP.GROUP_CD, GP.LOC, GP.BED_PILE_DATE, GP.SMP_FL, GP.SMP_LOC, GP.SMP_LEN ");
strSql.AppendLine(", GP.SMP_NO, GP.INSP_EMP, GP.DSC_DATE, GP.DSC_TIME, GP.PROD_GRD, GP.SURF_GRD, GP.QUALITY_GRD ");
strSql.AppendLine(", GP.QUALITY_UPD_GRD, GP.APLY_STDSPEC, GP.APLY_ENDUSE_CD, GP.IN_PLT_CD, GP.IN_PLT, GP.IN_PLT_DATE ");
strSql.AppendLine(", GP.IN_PLT_TIME, GP.IN_CAR_NO, GP.SLAB_NO, GP.IN_PLT_CO, GP.OUT_PLT_CD, GP.OUT_PLT, GP.OUT_PLT_DATE ");
strSql.AppendLine(", GP.OUT_PLT_TIME, GP.OUT_CAR_NO, GP.OUT_SHEET_NO, GP.HOUSING_DATE, GP.HOUSING_TIME, GP.SHP_IST_NO ");
strSql.AppendLine(", GP.SHP_IST_DATE, GP.SHP_IST_TIME, GP.SHP_DATE, GP.SHP_TIME, GP.TRNS_NO, GP.CAR_NO, GP.TRNS_CMPY_CD ");
strSql.AppendLine(", GP.SHP_EMP, GP.TRAIN_LINE_NAME, GP.DEST_DETAIL, GP.CERT_RPT_FL, GP.CERT_RPT_DATE, GP.CERT_RPT_TIME ");
strSql.AppendLine(", GP.SHP_IST_CAN_DATE, GP.SHP_IST_CAN_TIME, GP.SHP_IST_CAN_FL, GP.INS_DATE, GP.INS_EMP_CD, GP.INS_PGMID ");
strSql.AppendLine(", GP.UPD_DATE, GP.UPD_EMP_CD, GP.UPD_PGM, GP.PLATE_SEC, GP.CR_CD, GP.PILE_NO, GP.PRC, GP.SF_ORNOT, GP.UST_FL ");
strSql.AppendLine(", GP.TRIM_FL, GP.END_RES, GP.ORG_PLATE, GP.ORD_THK, GP.ORD_WID, GP.ORD_LEN, GP.ORD_WGT, GP.NEXT_PROC ");
strSql.AppendLine(", GP.ACT_SMP_FL, GP.ACT_SMP_LEN, GP.CUST_CD, GP.CUR_INV, GP.BEF_APLY_STDSPEC, GP.STDSPEC_UPD_FL ");
strSql.AppendLine(", GP.SIZE_KND, GP.BAOXIN_IF_DATE, GP.SLAB_WGT, GP.CUST_SPEC_NO, GP.LOAD_WGT, GP.PRICE_GRD ");
strSql.AppendLine(", GP.PRICE_GRD_DATE, GP.PRICE_GRD_TIME, GP.PRICE_GRD_EMP_CD, GP.CHG_GRD_RES, GP.MARKING_FL ");
strSql.AppendLine(", GP.MAT_OWNER_FL, GP.MAT_OWNER_CUST_CD, GP.RSLT_PROC_CD, GP.UST_RLT_CD, GP.UST_STATUS ");
strSql.AppendLine(", GP.HTM_SHOT_BLAST, GP.HTM_SHOT_BLAST_RLT, GP.HTM_RSLT_FL, GP.HTM_METH1, GP.HTM_COND1 ");
strSql.AppendLine(", GP.HTM_RLT_METH1, GP.HTM_METH2, GP.HTM_COND2, GP.HTM_RLT_METH2, GP.HTM_METH3, GP.HTM_COND3 ");
strSql.AppendLine(", GP.HTM_RLT_METH3, GP.HTM_METH4, GP.HTM_COND4, GP.HTM_RLT_METH4, GP.HTM_METH5, GP.HTM_COND5 ");
strSql.AppendLine(", GP.HTM_RLT_METH5, GP.GRID_FL, GP.GRID_RSLT, GP.CL_FL, GP.CL_RSLT, GP.GAS_FL, GP.GAS_RSLT, GP.UST_CNT ");
strSql.AppendLine(", GP.CUT_CNT, GP.HTM_CNT, GP.CL_CNT, GP.SB_CNT, GP.GRD_CNT, GP.CLAIM_RES, GP.CLAIM_DATE, GP.CLAIM_THK ");
strSql.AppendLine(", GP.CLAIM_WID, GP.CLAIM_LEN, GP.CLAIM_WGT, GP.ERP_IF_DATE, GP.NEXT_PLAN_HTM, GP.NEXT_PLAN_HTM_COND ");
strSql.AppendLine(", GP.PLAN_CUT_CNT, GP.SMP_SET_FL, GP.FP_FL, GP.FP_RSLT, GP.FP_CNT, GP.ACT_SMP_FL_R, GP.ACT_SMP_LEN_R ");
strSql.AppendLine(", GP.SMP_NO_R, GP.ERP_MPLATE_CHK, GP.ERP_PLATE_IN ");
strSql.AppendLine(", '' SUB_PRO_STA, '' SUB_CON_STA, '' SUB_CUT_POS_1,'' SUB_FULL,'' SUB_LACK_CON ");
strSql.AppendLine(", '' SUB_CUT_POS_2, '' SUB_ORD_NO, '' SUB_ORD_ITEM, '' SUB_ORD_REM, '' SUB_SUR_LEN_1, '' SUB_SUR_WID_1 ");
strSql.AppendLine(", '' SUB_SUR_LEN_2, '' SUB_SUR_WID_2, '' SUB_SUR_STA_1, '' SUB_SUR_STA_2, '' SUB_LOS_WGT, '' SUB_DATE ");
strSql.AppendLine(", '' SUB_NUM, '' SUB_DIR, '' SUB_US_WID, '' SUB_US_LEN, '' SUB_CUT_X, '' SUB_CUT_Y, '' SUB_USER ");
strSql.AppendLine(",bob.ORD_NO BOB_ORD_NO --//--替代前订单订单号 ");
strSql.AppendLine(",bob.ORD_ITEM BOB_ORD_ITEM --//--替代前订单序列 ");
strSql.AppendLine(",bob.STDSPEC BOB_STDSPEC --//--替代前订单订单标准 ");
strSql.AppendLine(",bob.ORD_THK BOB_ORD_THK --//--替代前订单厚度 ");
strSql.AppendLine(",bob.ORD_WID BOB_ORD_WID --//--替代前订单宽度 ");
strSql.AppendLine(",bob.ORD_LEN BOB_ORD_LEN --//--替代前订单长度 ");
strSql.AppendLine(",bob.PROD_WGT BOB_WGT_UNIT --//--替代前订单重量 ");
strSql.AppendLine(",bob.CUST_CD BOB_CUST_CD --//--替代前订单客户名称 ");
strSql.AppendLine(",bob.ENDUSE_CD BOB_ENDUSE_CD --//--替代前订单订单用途 ");
strSql.AppendLine(",bob.ORD_KND BOB_ORD_KND --//--替代前订单订单种类 ");
strSql.AppendLine(",boo.ORD_NO BOO_ORD_NO --//--原始订单订单号 ");
strSql.AppendLine(",boo.ORD_ITEM BOO_ORD_ITEM --//--原始订单序列 ");
strSql.AppendLine(",boo.STDSPEC BOO_STDSPEC --//--原始订单订单标准 ");
strSql.AppendLine(",boo.ORD_THK BOO_ORD_THK --//--原始订单厚度 ");
strSql.AppendLine(",boo.ORD_WID BOO_ORD_WID --//--原始订单宽度 ");
strSql.AppendLine(",boo.ORD_LEN BOO_ORD_LEN --//--原始订单长度 ");
strSql.AppendLine(",boo.PROD_WGT BOO_WGT_UNIT --//--原始订单重量 ");
strSql.AppendLine(",boo.CUST_CD BOO_CUST_CD --//--原始订单客户名称 ");
strSql.AppendLine(", CASE WHEN gpr.THK > 0 and gpr.WID > 0 and gpr.LEN >0 and gp.PROC_CD <> 'XAC' THEN 1 ELSE 0 END IS_CP_MOVE ");
strSql.AppendLine(", CASE WHEN UST.UST_DEC = 'N' and UST.UST_DEC_FP_1 = 'Y' THEN 1 ELSE 0 END IS_UST ");
strSql.AppendLine("FROM NISCO.GP_PLATE GP ");
strSql.AppendLine("LEFT JOIN NISCO.BP_ORDER_ITEM bob ON gp.ORD_NO = bob.ORD_NO AND gp.ORD_ITEM = bob.ORD_ITEM--// ");
strSql.AppendLine("LEFT JOIN NISCO.BP_ORDER_ITEM boo ON gp.ORG_ORD_NO = boo.ORD_NO AND gp.ORG_ORD_ITEM = boo.ORD_ITEM--// ");
strSql.AppendLine("LEFT JOIN NISCO.QP_QLTY_DELV QQD ON gp.ORG_ORD_NO = QQD.ORD_NO AND gp.ORG_ORD_ITEM = QQD.ORD_ITEM--// ");
strSql.AppendLine("LEFT JOIN NISCO.GP_PLATE_REPLACE gpr ON gpr.PLATE_NO = gp.PLATE_NO ");
strSql.AppendLine("LEFT JOIN NISCO.GP_INSPPLATE GI ON GI.MAT_NO = GP.PLATE_NO ");
strSql.AppendLine("LEFT JOIN NISCO.GP_USTRESULT UST ON UST.PLATE_NO = GP.PLATE_NO ");
strSql.AppendLine("WHERE 1=1 ");
strSql.AppendLine("AND GP.proc_cd IN('DZB','DZE','QAB','XAC') AND GP.PROD_CD = 'PP' AND GP.REC_STS = '2' and GP.ord_fl='2' ");
strSql.AppendLine("AND(CASE WHEN GP.proc_cd = 'XAC' AND GP.PROD_GRD = '1' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'QAB' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZB' AND GP.SURF_GRD = '4' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZE' AND GP.SURF_GRD = '4' THEN 1 ");
strSql.AppendLine("WHEN UST.UST_DEC = 'N' and UST.UST_DEC_FP_1 = 'Y' AND (GP.SURF_GRD = '1' OR GP.SURF_GRD = '2' OR GP.SURF_GRD = '3' OR GP.SURF_GRD = '4') THEN 1 ELSE 0 END) = 1 ");
strSql.AppendLine("AND(CASE WHEN GP.proc_cd = 'XAC' AND GP.PRICE_GRD = '2' AND trunc(months_between(sysdate,to_date(PROD_DATE,'yyyymmdd'))) <'3' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd <> 'XAC' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'XAC' AND GP.PRICE_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'XAC' AND GP.PRICE_GRD is null THEN 1 ");
strSql.AppendLine("WHEN UST.UST_DEC = 'N' and UST.UST_DEC_FP_1 = 'Y' AND (GP.SURF_GRD = '1' OR GP.SURF_GRD = '2' OR GP.SURF_GRD = '3' OR GP.SURF_GRD = '4') THEN 1 ELSE 0 END) = 1 ");
strSql.AppendLine("AND GP.APLY_STDSPEC NOT LIKE '%NG-XY%'");
strSql.AppendLine("AND GP.Len <50000 "); //钢板长度上限50米
strSql.AppendLine(strWHerePlate);
strSql.AppendLine(strNotinPlate);
strSql.AppendLine("ORDER BY GP.PLATE_NO");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
gpPlates = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetAllMat 报错", ex);
}
return gpPlates;
}
///
///查询所有余材的信息
///
/// 所有符合条件的XAC,DZB,DZE,QAB 状态余材 集合
public IList GetAllCGB(string strWHerePlate, string strNotinPlate)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gpPlates = new List();
//查询语句日期时间拼接起来格式化成yyyy-mm-dd hh24:mi:ss PROD_WGT
strSql.AppendLine("SELECT");
strSql.AppendLine(" GP.PLATE_NO ");
strSql.AppendLine(",GI.INSP_B_DEP_FLAW2 ");
strSql.AppendLine(",(SELECT COUNT(*) ");
strSql.AppendLine(" FROM NISCO.GP_USTRESULT GU ");
strSql.AppendLine(" WHERE GU.PLATE_NO = TRIM(GP.PLATE_NO) ");
strSql.AppendLine(" AND GU.UST_DEC = 'Y') GU_CNT ");
strSql.AppendLine(", QQD.THK_TOL_MIN ,QQD.THK_TOL_MAX , GP.OCCR_CD, GP.PLT, GP.PRC_LINE, GP.REC_STS, GP.PROC_CD, GP.BEF_PROC_CD, GP.PROD_CD, GP.STLGRD");
strSql.AppendLine(", CASE WHEN gpr.THK > 0 and gp.PROC_CD <> 'XAC' THEN gpr.THK ELSE gp.THK END THK");
strSql.AppendLine(", CASE WHEN gpr.WID > 0 and gp.PROC_CD <> 'XAC' THEN gpr.WID ELSE gp.WID END WID");
strSql.AppendLine(", CASE WHEN gpr.LEN > 0 and gp.PROC_CD <> 'XAC' THEN gpr.LEN ELSE gp.LEN END LEN");
strSql.AppendLine(", GP.WGT, GP.CAL_WGT, GP.THK_GRP, GP.WID_GRP, GP.OVER_FL, GP.ORD_FL, GP.WOO_RSN ");
strSql.AppendLine(", GP.ORD_NO, GP.ORD_ITEM, GP.ORG_ORD_NO, GP.ORG_ORD_ITEM, GP.ENDUSE_CD, GP.DEL_TO_DATE, GP.PROD_DATE ");
strSql.AppendLine(", GP.PROD_TIME, GP.SHIFT, GP.GROUP_CD, GP.LOC, GP.BED_PILE_DATE, GP.SMP_FL, GP.SMP_LOC, GP.SMP_LEN ");
strSql.AppendLine(", GP.SMP_NO, GP.INSP_EMP, GP.DSC_DATE, GP.DSC_TIME, GP.PROD_GRD, GP.SURF_GRD, GP.QUALITY_GRD ");
strSql.AppendLine(", GP.QUALITY_UPD_GRD, GP.APLY_STDSPEC, GP.APLY_ENDUSE_CD, GP.IN_PLT_CD, GP.IN_PLT, GP.IN_PLT_DATE ");
strSql.AppendLine(", GP.IN_PLT_TIME, GP.IN_CAR_NO, GP.SLAB_NO, GP.IN_PLT_CO, GP.OUT_PLT_CD, GP.OUT_PLT, GP.OUT_PLT_DATE ");
strSql.AppendLine(", GP.OUT_PLT_TIME, GP.OUT_CAR_NO, GP.OUT_SHEET_NO, GP.HOUSING_DATE, GP.HOUSING_TIME, GP.SHP_IST_NO ");
strSql.AppendLine(", GP.SHP_IST_DATE, GP.SHP_IST_TIME, GP.SHP_DATE, GP.SHP_TIME, GP.TRNS_NO, GP.CAR_NO, GP.TRNS_CMPY_CD ");
strSql.AppendLine(", GP.SHP_EMP, GP.TRAIN_LINE_NAME, GP.DEST_DETAIL, GP.CERT_RPT_FL, GP.CERT_RPT_DATE, GP.CERT_RPT_TIME ");
strSql.AppendLine(", GP.SHP_IST_CAN_DATE, GP.SHP_IST_CAN_TIME, GP.SHP_IST_CAN_FL, GP.INS_DATE, GP.INS_EMP_CD, GP.INS_PGMID ");
strSql.AppendLine(", GP.UPD_DATE, GP.UPD_EMP_CD, GP.UPD_PGM, GP.PLATE_SEC, GP.CR_CD, GP.PILE_NO, GP.PRC, GP.SF_ORNOT, GP.UST_FL ");
strSql.AppendLine(", GP.TRIM_FL, GP.END_RES, GP.ORG_PLATE, GP.ORD_THK, GP.ORD_WID, GP.ORD_LEN, GP.ORD_WGT, GP.NEXT_PROC ");
strSql.AppendLine(", GP.ACT_SMP_FL, GP.ACT_SMP_LEN, GP.CUST_CD, GP.CUR_INV, GP.BEF_APLY_STDSPEC, GP.STDSPEC_UPD_FL ");
strSql.AppendLine(", GP.SIZE_KND, GP.BAOXIN_IF_DATE, GP.SLAB_WGT, GP.CUST_SPEC_NO, GP.LOAD_WGT, GP.PRICE_GRD ");
strSql.AppendLine(", GP.PRICE_GRD_DATE, GP.PRICE_GRD_TIME, GP.PRICE_GRD_EMP_CD, GP.CHG_GRD_RES, GP.MARKING_FL ");
strSql.AppendLine(", GP.MAT_OWNER_FL, GP.MAT_OWNER_CUST_CD, GP.RSLT_PROC_CD, GP.UST_RLT_CD, GP.UST_STATUS ");
strSql.AppendLine(", GP.HTM_SHOT_BLAST, GP.HTM_SHOT_BLAST_RLT, GP.HTM_RSLT_FL, GP.HTM_METH1, GP.HTM_COND1 ");
strSql.AppendLine(", GP.HTM_RLT_METH1, GP.HTM_METH2, GP.HTM_COND2, GP.HTM_RLT_METH2, GP.HTM_METH3, GP.HTM_COND3 ");
strSql.AppendLine(", GP.HTM_RLT_METH3, GP.HTM_METH4, GP.HTM_COND4, GP.HTM_RLT_METH4, GP.HTM_METH5, GP.HTM_COND5 ");
strSql.AppendLine(", GP.HTM_RLT_METH5, GP.GRID_FL, GP.GRID_RSLT, GP.CL_FL, GP.CL_RSLT, GP.GAS_FL, GP.GAS_RSLT, GP.UST_CNT ");
strSql.AppendLine(", GP.CUT_CNT, GP.HTM_CNT, GP.CL_CNT, GP.SB_CNT, GP.GRD_CNT, GP.CLAIM_RES, GP.CLAIM_DATE, GP.CLAIM_THK ");
strSql.AppendLine(", GP.CLAIM_WID, GP.CLAIM_LEN, GP.CLAIM_WGT, GP.ERP_IF_DATE, GP.NEXT_PLAN_HTM, GP.NEXT_PLAN_HTM_COND ");
strSql.AppendLine(", GP.PLAN_CUT_CNT, GP.SMP_SET_FL, GP.FP_FL, GP.FP_RSLT, GP.FP_CNT, GP.ACT_SMP_FL_R, GP.ACT_SMP_LEN_R ");
strSql.AppendLine(", GP.SMP_NO_R, GP.ERP_MPLATE_CHK, GP.ERP_PLATE_IN ");
strSql.AppendLine(", '' SUB_PRO_STA, '' SUB_CON_STA, '' SUB_CUT_POS_1,'' SUB_FULL,'' SUB_LACK_CON ");
strSql.AppendLine(", '' SUB_CUT_POS_2, '' SUB_ORD_NO, '' SUB_ORD_ITEM, '' SUB_ORD_REM, '' SUB_SUR_LEN_1, '' SUB_SUR_WID_1 ");
strSql.AppendLine(", '' SUB_SUR_LEN_2, '' SUB_SUR_WID_2, '' SUB_SUR_STA_1, '' SUB_SUR_STA_2, '' SUB_LOS_WGT, '' SUB_DATE ");
strSql.AppendLine(", '' SUB_NUM, '' SUB_DIR, '' SUB_US_WID, '' SUB_US_LEN, '' SUB_CUT_X, '' SUB_CUT_Y, '' SUB_USER ");
strSql.AppendLine(",bob.ORD_NO BOB_ORD_NO --//--替代前订单订单号 ");
strSql.AppendLine(",bob.ORD_ITEM BOB_ORD_ITEM --//--替代前订单序列 ");
strSql.AppendLine(",bob.STDSPEC BOB_STDSPEC --//--替代前订单订单标准 ");
strSql.AppendLine(",bob.ORD_THK BOB_ORD_THK --//--替代前订单厚度 ");
strSql.AppendLine(",bob.ORD_WID BOB_ORD_WID --//--替代前订单宽度 ");
strSql.AppendLine(",bob.ORD_LEN BOB_ORD_LEN --//--替代前订单长度 ");
strSql.AppendLine(",bob.PROD_WGT BOB_WGT_UNIT --//--替代前订单重量 ");
strSql.AppendLine(",bob.CUST_CD BOB_CUST_CD --//--替代前订单客户名称 ");
strSql.AppendLine(",bob.ENDUSE_CD BOB_ENDUSE_CD --//--替代前订单订单用途 ");
strSql.AppendLine(",bob.ORD_KND BOB_ORD_KND --//--替代前订单订单种类 ");
strSql.AppendLine(",boo.ORD_NO BOO_ORD_NO --//--原始订单订单号 ");
strSql.AppendLine(",boo.ORD_ITEM BOO_ORD_ITEM --//--原始订单序列 ");
strSql.AppendLine(",boo.STDSPEC BOO_STDSPEC --//--原始订单订单标准 ");
strSql.AppendLine(",boo.ORD_THK BOO_ORD_THK --//--原始订单厚度 ");
strSql.AppendLine(",boo.ORD_WID BOO_ORD_WID --//--原始订单宽度 ");
strSql.AppendLine(",boo.ORD_LEN BOO_ORD_LEN --//--原始订单长度 ");
strSql.AppendLine(",boo.PROD_WGT BOO_WGT_UNIT --//--原始订单重量 ");
strSql.AppendLine(",boo.CUST_CD BOO_CUST_CD --//--原始订单客户名称 ");
strSql.AppendLine(", CASE WHEN gpr.THK > 0 and gpr.WID > 0 and gpr.LEN >0 and gp.PROC_CD <> 'XAC' THEN 1 ELSE 0 END IS_CP_MOVE ");
strSql.AppendLine(", CASE WHEN UST.UST_DEC = 'N' and UST.UST_DEC_FP_1 = 'Y' THEN 1 ELSE 0 END IS_UST ");
strSql.AppendLine("FROM NISCO.GP_PLATE GP ");
strSql.AppendLine("LEFT JOIN NISCO.BP_ORDER_ITEM bob ON gp.ORD_NO = bob.ORD_NO AND gp.ORD_ITEM = bob.ORD_ITEM--// ");
strSql.AppendLine("LEFT JOIN NISCO.BP_ORDER_ITEM boo ON gp.ORG_ORD_NO = boo.ORD_NO AND gp.ORG_ORD_ITEM = boo.ORD_ITEM--// ");
strSql.AppendLine("LEFT JOIN NISCO.QP_QLTY_DELV QQD ON gp.ORG_ORD_NO = QQD.ORD_NO AND gp.ORG_ORD_ITEM = QQD.ORD_ITEM--// ");
strSql.AppendLine("LEFT JOIN NISCO.GP_PLATE_REPLACE gpr ON gpr.PLATE_NO = gp.PLATE_NO ");
strSql.AppendLine("LEFT JOIN NISCO.GP_INSPPLATE GI ON GI.MAT_NO = GP.PLATE_NO ");
strSql.AppendLine("LEFT JOIN NISCO.GP_USTRESULT UST ON UST.PLATE_NO = GP.PLATE_NO ");
strSql.AppendLine("WHERE 1=1 ");
strSql.AppendLine("AND GP.proc_cd IN('DZB','DZE','QAB','XAC') AND GP.REC_STS = '2' and GP.ord_fl='2' ");
strSql.AppendLine("AND(CASE WHEN GP.proc_cd = 'XAC' AND GP.PROD_GRD = '1' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'QAB' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZB' AND GP.SURF_GRD = '4' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZE' AND GP.SURF_GRD = '4' THEN 1 ");
strSql.AppendLine("WHEN UST.UST_DEC = 'N' and UST.UST_DEC_FP_1 = 'Y' AND (GP.SURF_GRD = '1' OR GP.SURF_GRD = '2' OR GP.SURF_GRD = '3' OR GP.SURF_GRD = '4') THEN 1 ELSE 0 END) = 1 ");
strSql.AppendLine("AND(CASE WHEN GP.proc_cd = 'XAC' AND GP.PRICE_GRD = '2' AND trunc(months_between(sysdate,to_date(PROD_DATE,'yyyymmdd'))) <'3' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd <> 'XAC' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'XAC' AND GP.PRICE_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'XAC' AND GP.PRICE_GRD is null THEN 1 ");
strSql.AppendLine("WHEN UST.UST_DEC = 'N' and UST.UST_DEC_FP_1 = 'Y' AND (GP.SURF_GRD = '1' OR GP.SURF_GRD = '2' OR GP.SURF_GRD = '3' OR GP.SURF_GRD = '4') THEN 1 ELSE 0 END) = 1 ");
strSql.AppendLine("AND GP.APLY_STDSPEC NOT LIKE '%NG-XY%'");
//strSql.AppendLine("AND GP.Len <50000 "); //钢板长度上限50米
strSql.AppendLine("AND length(GP.PLATE_NO) =12"); //钢板长度上限50米
strSql.AppendLine(strWHerePlate);
strSql.AppendLine(strNotinPlate);
strSql.AppendLine("ORDER BY GP.PLATE_NO");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
gpPlates = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetAllCGB 报错", ex);
}
return gpPlates;
}
///
/// 获取标准集合
///
/// 所有标准的集合
public IList GetStandGroup()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gpPlates = new List();
strSql.AppendLine("SELECT ");
strSql.AppendLine(" STLGRD ");
strSql.AppendLine(" , STEEL_GRD_DETAIL ");
strSql.AppendLine(" , STL_SEQ ");
strSql.AppendLine(" , STDSPEC ");
strSql.AppendLine(" , THK_MIN ");
strSql.AppendLine(" , THK_MAX ");
strSql.AppendLine(" , INS_DATE ");
strSql.AppendLine(" , INS_TIME ");
strSql.AppendLine(" , INS_EMP ");
strSql.AppendLine(" , UPD_DATE ");
strSql.AppendLine(" , UPD_TIME ");
strSql.AppendLine(" , UPD_EMP ");
strSql.AppendLine(" , STLGRD_FL ");
strSql.AppendLine(" , ZZ_PLT ");
strSql.AppendLine(" , ZZ_PLT_DESP ");
strSql.AppendLine("FROM NISCO.CP_NISCO_CHMC_SL ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
gpPlates = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetStandGroup 报错", ex);
}
return gpPlates;
}
///
/// 根据订单号找到对应的订单要求化学成分
///
/// 对应的化学成分集合
/// 方法如果被static修饰, 则在接口中无法被发现(原因不详)
public IList GetOrderChemistry(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList orderChemistrys = new List();
strSql.AppendLine("SELECT T.*FROM(");
strSql.AppendLine("SELECT QQC.*, rank() over(partition by QQC.ord_no, QQC.ord_item order by knd desc) rk from NISCO.QP_QLTY_CHEM QQC where (QQC.ORD_NO, QQC.ORD_ITEM) IN(");
strSql.AppendLine("SELECT");
strSql.AppendLine("TO_CHAR(BOI.ORD_NO), TO_CHAR(BOI.ORD_ITEM)");
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("WHERE 1 = 1 ");
strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
strSql.AppendLine("AND boi.PROD_CD = 'PP'");
strSql.AppendLine("AND boi.REC_STS = '2' ");
strSql.AppendLine("and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine("AND boi.ord_knd IN('A') ");
strSql.AppendLine(strWHereOrd);
strSql.AppendLine(strSpecialOrd);
strSql.AppendLine(") ");
strSql.AppendLine(" AND QQC.KND IN ('1','2') ) T WHERE T.rk = 1 ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
orderChemistrys = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetSurplusMaterial 报错 : ", ex);
}
return orderChemistrys;
}
///
/// 获取订单化学属性QP_QLTY_CHEM_FP
///
///
public IList GetQP_QLTY_CHEM_FP(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltQP_QLTY_MATR_MAIN = new List();
//strSql.AppendLine(" select t.ord_no,t.ord_item,t.knd,t.CHEM_COMP_CD,t.FOMULA_CD,t.CHEM_COMP_MIN, t.CHEM_COMP_MAX,t.CHEM_DIFF_MIN,t.CHEM_DIFF_MAX,t.SMP_CNT,t.GC_NO,t.CHEM_DIGIT,SMP_GC_TYPE from (select t.ord_no,t.ord_item,t.knd,t.CHEM_COMP_CD,t.FOMULA_CD,t.CHEM_COMP_MIN, t.CHEM_COMP_MAX,t.CHEM_DIFF_MIN,t.CHEM_DIFF_MAX,t.SMP_CNT,t.GC_NO,t.CHEM_DIGIT,t.SMP_GC_TYPE, ");
strSql.AppendLine(" select ORD_NO,ORD_ITEM,KND,CHEM_COMP_CD,FOMULA_CD,CHEM_COMP_MIN,CHEM_COMP_MAX,INS_DATE,INS_TIME,UPD_DATE,UPD_TIME,UPD_EMP,CHEM_DIFF_MIN,CHEM_DIFF_MAX,SMP_CNT,GC_NO,CHEM_DIGIT,SMP_GC_TYPE from (select t.*, ");
strSql.AppendLine(" rank() over(partition by t.ord_no,t.ord_item order by knd desc) rk from nisco.QP_QLTY_CHEM_FP t ");
strSql.AppendLine(" where t.knd in ('4','5') and (ord_no,ord_item) in(select BOI.ORD_NO,BOI.ORD_ITEM from NISCO.BP_ORDER_ITEM boi ");
//strSql.AppendLine(" where 1=1 and (ord_no,ord_item) in(select BOI.ORD_NO,BOI.ORD_ITEM from NISCO.BP_ORDER_ITEM boi ");
strSql.AppendLine(" INNER JOIN NISCO.cp_prc CPP ");
strSql.AppendLine(" ON BOI.ORD_NO = CPP.ORD_NO ");
strSql.AppendLine(" AND BOI.ORD_ITEM = CPP.ORD_ITEM ");
strSql.AppendLine(" where BOI.ORD_WID > 0 ");
strSql.AppendLine(" AND BOI.ORD_LEN > 0 ");
strSql.AppendLine(" AND BOI.ORD_THK > 0 ");
strSql.AppendLine(" and boi.PROD_CD = 'PP' ");
strSql.AppendLine(" AND boi.REC_STS = '2' ");
strSql.AppendLine(" and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine(" AND boi.ord_knd IN('A') ");
strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
strSql.AppendLine(strWHereOrd);
strSql.AppendLine(strSpecialOrd);
strSql.AppendLine(" )");
//strSql.AppendLine(" AND t.KND IN ('1','2') ) t where rk = 1 ");
strSql.AppendLine(" ) t where rk = 1 ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltQP_QLTY_MATR_MAIN = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetQP_QLTY_CHEM_FP 报错 : ", ex);
}
return ltQP_QLTY_MATR_MAIN;
}
///
/// 根据钢板板坯号找到对应炉号,根据炉号找到对应化学成分
///
/// 对应的化学成分集合
public IList GetChemistry(string strWHerePlate)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList chemistrys = new List();
strSql.AppendLine("SELECT* FROM NISCO.QP_CHEM_RSLT WHERE HEAT_NO IN ");
strSql.AppendLine("(SELECT DISTINCT HEAT_NO FROM NISCO.FP_SLAB WHERE SLAB_NO IN ");
strSql.AppendLine("(SELECT DISTINCT GP.SLAB_NO FROM NISCO.GP_PLATE GP ");
strSql.AppendLine(" WHERE GP.proc_cd IN('DZB','DZE','QAB','XAC') AND GP.PROD_CD = 'PP' AND GP.REC_STS = '2' and GP.ord_fl='2' ");
strSql.AppendLine("AND(CASE WHEN GP.proc_cd = 'XAC' AND GP.PROD_GRD = '1' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'QAB' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZB' AND GP.SURF_GRD = '4' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZE' AND GP.SURF_GRD = '4' THEN 1 ELSE 0 END) = 1 ");
strSql.AppendLine(strWHerePlate);
strSql.AppendLine(") ");
strSql.AppendLine(") ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
chemistrys = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetChemistry 报错 : ", ex);
}
return chemistrys;
}
///
/// 根据钢板板坯号找到对应炉号,根据炉号找到对应化学成分
///
/// 对应的化学成分集合
public IList GetQP_CHEM_RSLT_FP(string strWHerePlate)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList chemistrys = new List();
strSql.AppendLine(" SELECT* FROM NISCO.QP_CHEM_RSLT_FP WHERE substr(SMP_NO,1,8) IN "); //版批号前8位是炉号
strSql.AppendLine("(SELECT DISTINCT HEAT_NO FROM NISCO.FP_SLAB WHERE SLAB_NO IN ");
strSql.AppendLine("(SELECT DISTINCT GP.SLAB_NO FROM NISCO.GP_PLATE GP ");
strSql.AppendLine(" WHERE GP.proc_cd IN('DZB','DZE','QAB','XAC') AND GP.PROD_CD = 'PP' AND GP.REC_STS = '2' and GP.ord_fl='2' ");
strSql.AppendLine("AND(CASE WHEN GP.proc_cd = 'XAC' AND GP.PROD_GRD = '1' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'QAB' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZB' AND GP.SURF_GRD = '4' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZE' AND GP.SURF_GRD = '4' THEN 1 ELSE 0 END) = 1 ");
strSql.AppendLine(strWHerePlate);
strSql.AppendLine(") ");
strSql.AppendLine(") ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
chemistrys = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetQP_CHEM_RSLT_FP 报错 : ", ex);
}
return chemistrys;
}
///
/// 获取钢板的炉号
///
///
///
public IList GetHeat(string strWHerePlate)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList chemistrys = new List();
strSql.AppendLine("SELECT* FROM NISCO.FP_SLAB WHERE SLAB_NO IN ");
strSql.AppendLine("(SELECT DISTINCT GP.SLAB_NO FROM NISCO.GP_PLATE GP ");
strSql.AppendLine(" WHERE GP.proc_cd IN('DZB','DZE','QAB','XAC') AND GP.PROD_CD = 'PP' AND GP.REC_STS = '2' and GP.ord_fl='2' ");
strSql.AppendLine("AND(CASE WHEN GP.proc_cd = 'XAC' AND GP.PROD_GRD = '1' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'QAB' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZB' AND GP.SURF_GRD = '4' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZE' AND GP.SURF_GRD = '4' THEN 1 ELSE 0 END) = 1 ");
strSql.AppendLine(strWHerePlate);
strSql.AppendLine(") ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
chemistrys = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetChemistry 报错 : ", ex);
}
return chemistrys;
}
///
/// 获取钢板信息
///
///
///
public GP_PLATE GetPlate(string strWHerePlate)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
GP_PLATE rePlate = new GP_PLATE();
strSql.AppendFormat("SELECT * FROM NISCO.GP_PLATE WHERE PLATE_NO ='{0}'", strWHerePlate);
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
rePlate = db.QuerySingle(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetPlate 报错 : ", ex);
}
return rePlate;
}
///
/// 获取订单物理属性
///
///
public IList GetQP_QLTY_MATR()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltQP_QLTY_MATR = new List();
strSql.AppendLine("SELECT* from QP_QLTY_MATR where(ORD_NO || '-' || ORD_ITEM) IN(");
strSql.AppendLine("SELECT");
strSql.AppendLine("TO_CHAR(BOI.ORD_NO) || '-' || TO_CHAR(BOI.ORD_ITEM)");
strSql.AppendLine("FROM cp_prc CPP ");
strSql.AppendLine("INNER JOIN ");
strSql.AppendLine("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("WHERE CPP.ORD_REM_WGT / (((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85) > 1");
strSql.AppendLine("AND boi.PROD_CD = 'PP' ");
strSql.AppendLine("AND boi.REC_STS = '2' ");
strSql.AppendLine("and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine("AND boi.ord_knd IN('A') ");
strSql.AppendLine("OR (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') > 0 ");
strSql.AppendLine(")");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltQP_QLTY_MATR = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetChemistry 报错 : ", ex);
}
return ltQP_QLTY_MATR;
}
///
/// 获取钢板物理特性
///
///
public IList GetQP_TEST_RSLT()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltQP_TEST_RSLT = new List();
//strSql.AppendLine(string.Format("SELECT * FROM QP_CHEM_RSLT WHERE HEAT_NO = (SELECT HEAT_NO FROM FP_SLAB WHERE SLAB_NO = '{0}')", plate.SLAB_NO));
strSql.AppendLine("SELECT * FROM QP_TEST_RSLT WHERE SMP_NO IN ");
strSql.AppendLine("(SELECT DISTINCT GP.SMP_NO FROM GP_PLATE GP ");
strSql.AppendLine("WHERE proc_cd IN('DZB','DZE','QAB','XAC') AND PROD_CD = 'PP' AND REC_STS = '2' ");
strSql.AppendLine("AND(CASE WHEN proc_cd = 'XAC' AND PROD_GRD = '1' AND SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN proc_cd = 'QAB' AND PROD_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZB' AND GP.SURF_GRD = '4' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZE' AND GP.SURF_GRD = '4' THEN 1 ELSE 0 END) = 1 ");
strSql.AppendLine(") ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltQP_TEST_RSLT = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetChemistry 报错 : ", ex);
}
return ltQP_TEST_RSLT;
}
///
/// 获取钢板物理特性
///
///
public IList GetZP_CD()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltZP_CD = new List();
//strSql.AppendLine(string.Format("SELECT * FROM QP_CHEM_RSLT WHERE HEAT_NO = (SELECT HEAT_NO FROM FP_SLAB WHERE SLAB_NO = '{0}')", plate.SLAB_NO));
strSql.AppendLine("select * from ZP_CD where cd_mana_no='G0099' ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
ltZP_CD = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetZP_CD 报错 : ", ex);
}
return ltZP_CD;
}
///
/// 获取DZB处理仓库
///
///
public IList GetDZBWar()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltZP_CD = new List();
strSql.AppendLine("select * from ZP_CD where cd_mana_no='WLCK' ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
ltZP_CD = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetZP_CD 报错 : ", ex);
}
return ltZP_CD;
}
///
/// 获取DZB处理仓库
///
///
public IList GetRCLLW()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltZP_CD = new List();
strSql.AppendLine("select * from ZP_CD where cd_mana_no='RCLLW' ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
ltZP_CD = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetRCLLW 报错 : ", ex);
}
return ltZP_CD;
}
///
/// 获取厚度公差配置
///
///
public IList GetGCJJ()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltZP_CD = new List();
strSql.AppendLine(" SELECT * from THK_TOLER_INTER ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
ltZP_CD = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetGCJJ 报错 : ", ex);
}
return ltZP_CD;
}
//
/// 获取历史信息
///
///
///
public IList GetHistory()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltHISTORY = new List();
strSql.AppendLine("SELECT * FROM SUPERSEDE_HISTORY WHERE 1=1 ");
strSql.AppendLine(" and to_date(SUB_DATE ,'yyyy-mm-dd hh24:mi:ss') > to_date('" + DateTime.Now.AddDays(-2) + "','yyyy-mm-dd hh24:mi:ss')");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
ltHISTORY = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetPlate 报错 : ", ex);
}
return ltHISTORY;
}
///
/// 替代确认数据
///
/// 替代确认数据 实体类集合
public void UpdateManual(IList ltManual)
{
using (IDbContext db = ObjectContainer.GetObject("db"))
{
try
{
string upd_date = DateTime.Now.ToString("yyyyMMdd");
string upd_time = DateTime.Now.ToString("HHmmss");
//开启事务
db.BeginTransaction();
bool b = true;
#region 自动确认
foreach (TB_PLATE_MANUAL model in ltManual)
{
string strSql = string.Format("Update TB_PLATE_MANUAL Set RETURN_RESULTS = '{0}' WHERE PLATE_NO = '{1}' AND ORD_NO = '{2}' AND ORD_ITEM = '{3}'", model.RETURN_RESULTS, model.PLATE_NO, model.ORD_NO, model.ORD_ITEM);
if (db.Execute(strSql) == 0)
{
b = false;
break;
}
}
#endregion
if (b)
{
//数据操作成功则保存数据
db.Commit();
}
else
{
//操作失败回滚数据到初始状态
db.Rollback();
}
}
catch (Exception ex)
{
//数据如果发生错误则回滚
db.Rollback();
logger.Error("UpdateManual 报错", ex);
}
}
}
///
/// 替代确认数据
///
/// 替代确认数据 实体类集合
public void SaveSupersede(IList ltSup, IList ltsupOrd)
{
using (IDbContext db = ObjectContainer.GetObject("db"))
{
try
{
//因为是同时操作两个表, 所以开启事务
db.BeginTransaction();
db.Insert(ltSup);
db.Insert(ltsupOrd);
bool b = true;
#region 自动确认
foreach (SUPERSEDE delAddModel in ltSup)
{
string strSql = string.Format("DELETE FROM SUPERSEDE WHERE PLATE_NO = '{0}' AND APLY_STDSPEC = '{1}' AND ORD_NO = '{2}' AND ORD_ITEM = '{3}'", delAddModel.PLATE_NO, delAddModel.APLY_STDSPEC, delAddModel.ORD_NO, delAddModel.ORD_ITEM);
//将匹配表的记录信息复制给历史记录表
SUPERSEDE_CONFIRAM sc = new SUPERSEDE_CONFIRAM
{
PLATE_NO = delAddModel.PLATE_NO,
PROC_CD = delAddModel.PROC_CD,
ORD_NO = delAddModel.ORD_NO,
ORD_ITEM = delAddModel.ORD_ITEM,
INS_DATE = DateTime.Now.ToString("yyyyMMdd"),
INS_TIME = DateTime.Now.ToString("HHmmss"),
//替代状态
STATE = "1"
};
SUPERSEDE supData = new SUPERSEDE();
string strSqlSup = "SELECT * FROM SUPERSEDE WHERE PLATE_NO ='" + delAddModel.PLATE_NO + "'";
//获取替代信息
supData = db.QuerySingle(strSqlSup);
//替代履历
SUPERSEDE_HISTORY supHis = GetSupHis(supData);
//PDO
TBDIPDO InsertPDO = GetTBDIBKDPDO(supData);
db.Insert(InsertPDO);
//db.Insert(supHis);
if (db.Execute(strSql) == 0)
{
b = false;
break;
}
if (db.Insert(supHis) == 0)
{
b = false;
break;
}
}
#endregion
if (b)
{
//数据操作成功则保存数据
db.Commit();
}
else
{
//操作失败回滚数据到初始状态
db.Rollback();
}
}
catch (Exception ex)
{
//数据如果发生错误则回滚
db.Rollback();
logger.Error("DelSupAddSupersedeConfiram 报错", ex);
}
}
}
///
/// 删除不可替代钢板
///
/// 替代确认数据 实体类集合
public void deleteTBPLATESPE(List delModel)
{
//RequestEntity result = new RequestEntity();
StringBuilder strSql = new StringBuilder();
try
{
using (IDbContext db = ObjectContainer.GetObject("db"))
{
foreach (var model in delModel)
{
try
{
//PLATE_NO
strSql.AppendLine("DELETE FROM TB_PLATE_SPE WHERE 1=1 ");
strSql.AppendLine(string.Format("AND PLATE_NO like '%{0}%' ", model.PLATE_NO));
db.Execute(strSql.ToString()); // 执行删除数据操作
//执行完操作之后清空strSql 准备下次 appendLine
strSql.Length = 0;
}
catch
{
logger.Error("该条记录删除失败: " + delModel.ToString());
}
}
}
}
catch (Exception ex)
{
logger.Error("DelTbPlateSpe 报错", ex);
}
//return result;
}
//
/// 替代数据
///
/// 替代数据 实体类集合
public void SaveProcessData(TB_PROCESS_DATA data)
{
using (IDbContext db = ObjectContainer.GetObject("db"))
{
try
{
db.Insert(data);
}
catch (Exception ex)
{
logger.Info("替代确认错误信息:" + ex.ToString());
}
}
}
public void SaveSupersedetest(IList ltSup, IList ltsupOrd)
{
using (IDbContext db = ObjectContainer.GetObject("db"))
{
try
{
//因为是同时操作两个表, 所以开启事务
db.BeginTransaction();
if(ltSup.Count>0)
{
db.Insert(ltSup);
}
if (ltsupOrd.Count>0)
{
db.Insert(ltsupOrd);
}
bool b = true;
//if (db.Execute(strSql) == 0)
//{
// b = false;
// //break;
//}
//if (db.Insert(supHis) == 0)
//{
// b = false;
// //break;
//}
if (b)
{
//数据操作成功则保存数据
db.Commit();
}
else
{
//操作失败回滚数据到初始状态
db.Rollback();
}
}
catch (Exception ex)
{
//数据如果发生错误则回滚
db.Rollback();
logger.Error("DelSupAddSupersedeConfiram 报错", ex);
}
}
}
///
/// 获取时间戳
///
///
public static string GetTimeStamp()
{
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 8, 0, 0, 0);
return Convert.ToInt64(ts.TotalMilliseconds).ToString();
}
///
/// 整理 PDO 实体类数据
///
/// 钢板数据
/// 订单数据库
///
public static TBDIPDO GetTBDIBKDPDO(SUPERSEDE prsup)
{
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();
if (prsup.PROC_CD == "XAC")
{
strData.Append(("BKDERP001").PadRight(10));//FORMID:10位 ,BKDERP001 固定
strData.Append(prsup.ID.PadRight(12)); // 业务ID号 NUMBER(12) 流水号,需要再应答中带回
strData.Append(prsup.SUB_FULL); // 替代类型:VARCHAR2(1), C - 完全替代,P - 退判替代
strData.Append((prsup.PLATE_NO).PadRight(14));// 钢板号: VARCHAR2(14)
strData.Append((prsup.ORD_NO).PadRight(11));// 订单号: VARCHAR2(11)
strData.Append((prsup.ORD_ITEM).PadRight(4)); // 订单项次号: VARCHAR2(4)
strData.Append(GetSlabNo(prsup).PadRight(14)); // 板坯号: VARCHAR2(14)
if (prsup.SUB_FULL != "C")
{
if (!string.IsNullOrEmpty(prsup.SUB_LACK_CON))
{
if (prsup.SUB_LACK_CON.Contains("取样"))
{
strData.Append("1"); // 取样: VARCHAR2(1)
}
else
{
strData.Append("0"); // 不取样: VARCHAR2(1)
}
}
else
{
strData.Append("0"); // 不取样: VARCHAR2(1)
}
}
else
{
strData.Append("0"); // 不取样: VARCHAR2(1)
}
//是否终结
if (prsup.IS_END == "是")
{
strData.Append("1"); // 终结订单: VARCHAR2(1)
}
else
{
strData.Append("0"); // 非终结订单: VARCHAR2(1)
}
if (prsup.SPLITTING == "1")
{
decimal len = Convert.ToDecimal(prsup.GP_LEN);
string SPLITTING = "B";
strData.Append((SPLITTING).PadRight(20)); //分板备注: VARCHAR2(20)
strData.Append((len.ToString()).PadRight(5)); //单定尺 订单长度 : VARCHAR2(5)
}
if (prsup.SPLITTING == "2")
{
string SPLITTING = "A";
strData.Append((SPLITTING).PadRight(20)); //分板备注: VARCHAR2(20)
strData.Append((prsup.CUTTING_LEN).PadRight(5)); //单定尺 订单长度 : VARCHAR2(5)
}
if (string.IsNullOrEmpty(prsup.SPLITTING))
{
string SPLITTING = "";
string dec = "";
strData.Append((SPLITTING).PadRight(20)); //分板备注: VARCHAR2(20)
strData.Append((prsup.GP_LEN).PadRight(5)); //单定尺 订单长度 : VARCHAR2(5)
}
Result.QUEUEID = "BKDERP000";
}
else
{
strData.Append(("BKDMES002").PadRight(10));// FORMID:10位 ,BKDMES002 固定
strData.Append(prsup.ID.PadRight(12));// 业务ID号 NUMBER(12) 流水号,需要再应答中带回
strData.Append(prsup.SUB_FULL); // 替代类型:VARCHAR2(1), C - 完全替代,P - 退判替代
strData.Append((prsup.PLATE_NO).PadRight(14)); // 钢板号: VARCHAR2(14)
strData.Append((prsup.ORD_NO).PadRight(11));// 订单号: VARCHAR2(11)
strData.Append((prsup.ORD_ITEM).PadRight(4)); // 订单项次号: VARCHAR2(4)
strData.Append(GetSlabNo(prsup).PadRight(14)); // 板坯号: VARCHAR2(14)
if (prsup.SUB_FULL != "C")
{
if (!string.IsNullOrEmpty(prsup.SUB_LACK_CON))
{
if (prsup.SUB_LACK_CON.Contains("取样"))
{
strData.Append("1"); // 取样: VARCHAR2(1)
}
else
{
strData.Append("0"); // 不取样: VARCHAR2(1)
}
}
else
{
strData.Append("0"); // 不取样: VARCHAR2(1)
}
}
else
{
strData.Append("0"); // 不取样: VARCHAR2(1)
}
//是否终结
if (prsup.IS_END == "是")
{
strData.Append("1"); // 终结订单: VARCHAR2(1)
}
else
{
strData.Append("0"); // 非终结订单: VARCHAR2(1)
}
if (prsup.SPLITTING == "1")
{
decimal len = Convert.ToDecimal(prsup.GP_LEN);
string SPLITTING = "B";// 分板:长度倍尺分板
strData.Append((SPLITTING).PadRight(20)); //分板备注: VARCHAR2(20)
strData.Append((len.ToString()).PadRight(5)); //单定尺 订单长度 : VARCHAR2(5)
}
if (prsup.SPLITTING == "2")
{
string SPLITTING = "A";//A 分板: 一块正品一块余材;
strData.Append((SPLITTING).PadRight(20)); //分板备注: VARCHAR2(20)
strData.Append((prsup.CUTTING_LEN).PadRight(5)); //单定尺 订单长度 : VARCHAR2(5)
}
if (string.IsNullOrEmpty(prsup.SPLITTING))
{
string SPLITTING = "";
string dec = "";
strData.Append((SPLITTING).PadRight(20)); //分板备注: VARCHAR2(20)
strData.Append((prsup.GP_LEN).PadRight(5)); //单定尺 订单长度 : VARCHAR2(5)
}
Result.QUEUEID = "BKDMES000";
}
//化学成分N
if (prsup.SUB_LACK_CON == null)
{
strData.Append("0");
}
else
{
if (prsup.SUB_LACK_CON.Contains("化学成分N"))
{
strData.Append("1");
}
else
{
strData.Append("0");
}
}
Result.DATA = strData.ToString();
return Result;
}
///
/// 获取缓冲区板坯号
///
/// 变量数据
///
public static string GetSlabNo(SUPERSEDE prsup)
{
string strSlabNo = string.Empty;
DataTable dtReturn = new DataTable();
StringBuilder strSql = new StringBuilder();
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
//strSql.AppendLine(" SELECT ");
//strSql.AppendLine(" R.SLAB_NO ");
//strSql.AppendLine(" ,R.REQ_SEQ_NO ");
//strSql.AppendLine(" , R.ORD_NO ");
//strSql.AppendLine(" , R.ORD_ITEM ");
//strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB R ");
//strSql.AppendLine(" WHERE R.SUPLY_SMS_PLT = 'B1' ");
//strSql.AppendLine(" AND R.REQ_SEQ_NO NOT IN(SELECT REQ_SEQ_NO ");
//strSql.AppendLine(" FROM NISCO.EP_SLAB_EDT ");
//strSql.AppendLine(" WHERE REQ_SEQ_NO IS NOT NULL) ");
//strSql.AppendLine(" AND NVL(R.CNF_FL,' ') = 'F' ");
//strSql.AppendLine(" AND NVL(R.REC_STS,' ') = '1' ");
strSql.AppendLine(" SELECT 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 ");
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' ");
strSql.AppendFormat(" AND A.ORD_NO = '{0}' ", prsup.ORD_NO);
strSql.AppendFormat(" AND A.ORD_ITEM = '{0}' ", prsup.ORD_ITEM);
dtReturn = db.Query(strSql.ToString());
if (dtReturn.Rows.Count > 0)
{
strSlabNo = dtReturn.Rows[0]["REQ_SEQ_NO"].ToString();
}
}
}
catch (Exception)
{
}
//if (prsup.SLAB_LACK_FLG=="1")//欠量不用炼钢缓存区的量
//{
// strSlabNo = String.Empty;
//}
return strSlabNo;
}
public static SUPERSEDE_HISTORY GetSupHis(SUPERSEDE prsup)
{
SUPERSEDE_HISTORY Result = new SUPERSEDE_HISTORY();
Result.APLY_STDSPEC = prsup.APLY_STDSPEC;
Result.ID = prsup.ID;
Result.PLATE_NO = prsup.PLATE_NO;
Result.APLY_STDSPEC = prsup.APLY_STDSPEC;
Result.PROC_CD = prsup.PROC_CD;
Result.THK = prsup.THK;
Result.WID = prsup.WID;
Result.LEN = prsup.LEN;
Result.WGT = prsup.WGT;
Result.REDO_HOT = prsup.REDO_HOT;
Result.SIZE_KND = prsup.SIZE_KND;
Result.TRIMMING = prsup.TRIMMING;
Result.ORD_NO = prsup.ORD_NO;
Result.SUB_RATE = prsup.SUB_RATE;
Result.ORD_ITEM = prsup.ORD_ITEM;
Result.STLGRD = prsup.STLGRD;
Result.TRIMMING_WID = prsup.TRIMMING_WID;
Result.TRIMMING_LEN = prsup.TRIMMING_LEN;
Result.SURPLUS_WID = prsup.SURPLUS_WID;
Result.SURPLUS_LEN = prsup.SURPLUS_LEN;
Result.PLATE_SIZE = prsup.PLATE_SIZE;
Result.SUB_DATE = prsup.SUB_DATE;
Result.GP_THK = prsup.GP_THK;
Result.GP_WID = prsup.GP_WID;
Result.GP_LEN = prsup.GP_LEN;
Result.GP_WGT = prsup.GP_WGT;
Result.GP_APLY_STDSPEC = prsup.GP_APLY_STDSPEC;
Result.GP_ORD_FL = prsup.GP_ORD_FL;
Result.GP_SURF_GRD = prsup.GP_SURF_GRD;
Result.BOI_ORD_NO = prsup.BOI_ORD_NO;
Result.BOI_ORD_ITEM = prsup.BOI_ORD_ITEM;
Result.BOI_STDSPEC = prsup.BOI_STDSPEC;
Result.BOI_ORD_THK = prsup.BOI_ORD_THK;
Result.BOI_ORD_WID = prsup.BOI_ORD_WID;
Result.BOI_ORD_LEN = prsup.BOI_ORD_LEN;
Result.BOI_WGT_UNIT = prsup.BOI_WGT_UNIT;
Result.BOI_CUST_CD = prsup.BOI_CUST_CD;
Result.BOI_ENDUSE_CD = prsup.BOI_ENDUSE_CD;
Result.BOI_ORD_KND = prsup.BOI_ORD_KND;
Result.BOB_ORD_NO = prsup.BOB_ORD_NO;
Result.BOB_ORD_ITEM = prsup.BOB_ORD_ITEM;
Result.BOB_STDSPEC = prsup.BOB_STDSPEC;
Result.BOB_ORD_THK = prsup.BOB_ORD_THK;
Result.BOB_ORD_WID = prsup.BOB_ORD_WID;
Result.BOB_ORD_LEN = prsup.BOB_ORD_LEN;
Result.BOB_WGT_UNIT = prsup.BOB_WGT_UNIT;
Result.BOB_CUST_CD = prsup.BOB_CUST_CD;
Result.BOB_ENDUSE_CD = prsup.BOB_ENDUSE_CD;
Result.BOB_ORD_KND = prsup.BOB_ORD_KND;
Result.BOO_ORD_NO = prsup.BOO_ORD_NO;
Result.BOO_ORD_ITEM = prsup.BOO_ORD_ITEM;
Result.BOO_STDSPEC = prsup.BOO_STDSPEC;
Result.BOO_ORD_THK = prsup.BOO_ORD_THK;
Result.BOO_ORD_WID = prsup.BOO_ORD_WID;
Result.BOO_ORD_LEN = prsup.BOO_ORD_LEN;
Result.BOO_WGT_UNIT = prsup.BOO_WGT_UNIT;
Result.BOO_CUST_CD = prsup.BOO_CUST_CD;
Result.SUB_USER = prsup.SUB_USER;
Result.SUR_PRO_REM = prsup.SUR_PRO_REM;
Result.GP_PLT = prsup.GP_PLT;
Result.GP_PROD_TIME = prsup.GP_PROD_TIME;
Result.SUR_FIR_TIM = prsup.SUR_FIR_TIM;
Result.GP_WOO_RSN = prsup.GP_WOO_RSN;
Result.SUR_COM = prsup.SUR_COM;
Result.SUB_NUM = prsup.SUB_NUM;
Result.SUB_DIR = prsup.SUB_DIR;
Result.SUB_US_WID = prsup.SUB_US_WID;
Result.SUB_US_LEN = prsup.SUB_US_LEN;
Result.SUB_CUT_X = prsup.SUB_CUT_X;
Result.SUB_CUT_Y = prsup.SUB_CUT_Y;
Result.SUB_LOS_WGT = prsup.SUB_LOS_WGT;
Result.SUB_FOR = prsup.SUB_FOR;
Result.SUB_REM = prsup.SUB_REM;
Result.GP_CUR_INV = prsup.GP_CUR_INV;
Result.GP_TRIM_FL = prsup.GP_TRIM_FL;
Result.GP_SIZE_KND = prsup.GP_SIZE_KND;
Result.ORD_REM = prsup.ORD_REM;
Result.GP_UST_RLT_CD = prsup.GP_UST_RLT_CD;
Result.GP_GAS_FL = prsup.GP_GAS_FL;
Result.GP_CL_FL = prsup.GP_CL_FL;
Result.GP_HTM_CNT = prsup.GP_HTM_CNT;
Result.GP_STLGRD = prsup.GP_STLGRD;
Result.BOI_SURFACE_REQUESTS = prsup.BOI_SURFACE_REQUESTS;
Result.BOI_VESSEL_NO = prsup.BOI_VESSEL_NO;
Result.BOI_SIDEMARK = prsup.BOI_SIDEMARK;
Result.BOI_FACEPAINT = prsup.BOI_FACEPAINT;
Result.BOI_SEALMEMO = prsup.BOI_SEALMEMO;
Result.BOI_ORD_PROD_END_TIME = prsup.BOI_ORD_PROD_END_TIME;
Result.BOI_PROD_CD = prsup.BOI_PROD_CD;
Result.BOI_DOME_FL = prsup.BOI_DOME_FL;
Result.BOI_DEL_FR_DATE = prsup.BOI_DEL_TO_DATE;
Result.SUB_FULL = prsup.SUB_FULL;
Result.SUB_LACK_CON = prsup.SUB_LACK_CON;
//TODO:履历信息
Result.CON_DATE = DateTime.Now.ToString();
Result.CON_USER = "Auto";
Result.CON_RSL = "1";
Result.PROD_GRD = prsup.PROD_GRD;
Result.CUR_INV = prsup.CUR_INV;
Result.LOC = prsup.LOC;
Result.EFF_RATE = prsup.EFF_RATE;
Result.PRICE_GRD = prsup.PRICE_GRD;
Result.STATE = "1";
Result.SUB_LACK_NUM = prsup.SUB_LACK_NUM;
Result.ORD_WGT = prsup.ORD_WGT;
Result.SUB_LACK_WGT = prsup.SUB_LACK_WGT;
Result.SLAB_LACK_NUM = prsup.SLAB_LACK_NUM;
Result.LACK_NUM = prsup.LACK_NUM;
Result.SLAB_LACK_FLG = prsup.SLAB_LACK_FLG;
Result.Cutting_WGT = prsup.Cutting_WGT;
Result.STEEL_SCRAP_WGT = prsup.STEEL_SCRAP_WGT;
Result.SUB_PLATE_WGT = prsup.SUB_PLATE_WGT;
Result.CUTTING_LEN = prsup.CUTTING_LEN;
Result.CUTTING_WID = prsup.CUTTING_WID;
Result.CUTTING_THK = prsup.CUTTING_THK;
Result.IS_END = prsup.IS_END;
Result.SPLITTING = prsup.SPLITTING;
return Result;
}
///
/// 获取配置参数
///
///
public IList GetTBPSRules()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gTBSubRules = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM TB_PS_CONFIG");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
gTBSubRules = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetTBSubRules 报错", ex);
}
return gTBSubRules;
}
///
/// GetTB_NEW_PLATEAND GP.REC_STS = '2' and GP.ord_fl = '2'
///
///
public IList GetTB_NEW_PLATE()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltTB_NEW_PLATE = new List();
strSql.AppendLine("SELECT * FROM TB_NEW_PLATE ");
strSql.AppendLine(" WHERE STATUS ='N'");
strSql.AppendLine(" and to_date(INS_DATE || INS_TIME,'yyyy-mm-dd hh24:mi:ss') > to_date('" + DateTime.Now.AddHours(-1) + "','yyyy-mm-dd hh24:mi:ss')");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
ltTB_NEW_PLATE = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetTB_NEW_PLATE 报错 : ", ex);
}
return ltTB_NEW_PLATE;
}
///
/// GetTB_NEW_PLATEAND GP.REC_STS = '2' and GP.ord_fl = '2'
///
///
public IList GetSUB_TYPE_MGT()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltSUB_TYPE_MGT = new List();
strSql.AppendLine("SELECT * FROM SUB_TYPE_MGT ");
strSql.AppendLine(" WHERE IS_RUN ='是'");
//strSql.AppendLine(" and to_date(INS_DATE || INS_TIME,'yyyy-mm-dd hh24:mi:ss') > to_date('" + DateTime.Now.AddHours(-1) + "','yyyy-mm-dd hh24:mi:ss')");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
ltSUB_TYPE_MGT = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetTB_NEW_PLATE 报错 : ", ex);
}
return ltSUB_TYPE_MGT;
}
///
/// 在途的仓库
///
///
public IList GetCPMOVESLT(string strWHerePlate)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltCP_MOVE_SLT = new List();
strSql.AppendLine("SELECT * FROM( ");
strSql.AppendLine("SELECT ");
strSql.AppendLine("rank() over(partition BY CMS.MAT_NO order by CMS.SND_TIME desc) rk ,CMS.* ");
strSql.AppendLine("FROM NISCO.CP_MOVE_SLT CMS ");
strSql.AppendLine(" WHERE CMS.MAT_NO IN ");
strSql.AppendLine("(SELECT DISTINCT GP.PLATE_NO FROM NISCO.GP_PLATE GP ");
strSql.AppendLine(" WHERE GP.proc_cd IN('DZB','DZE','QAB','XAC') AND GP.PROD_CD = 'PP' AND GP.REC_STS = '2' and GP.ord_fl = '2' ");
strSql.AppendLine("AND(CASE WHEN GP.proc_cd = 'XAC' AND GP.PROD_GRD = '1' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'QAB' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZB' AND GP.SURF_GRD = '4' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZE' AND GP.SURF_GRD = '4' THEN 1 ELSE 0 END) = 1 ");
strSql.AppendLine(strWHerePlate);
strSql.AppendLine(") ) ");
strSql.AppendLine("WHERE rk = 1 ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltCP_MOVE_SLT = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetChemistry 报错 : ", ex);
}
return ltCP_MOVE_SLT;
}
public IList GetWarDiffDays()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gTBSubRules = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM REMA_PLA_SUBSI_WAREH_MANAGE");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
gTBSubRules = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetWarDiffDays 报错", ex);
}
return gTBSubRules;
}
public IList GetTB_PLATE_MANUAL(string strWHerePlate)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gTBSubRules = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM TB_PLATE_MANUAL where 1=1 ");
if(!string.IsNullOrEmpty(strWHerePlate))
{
strSql.AppendLine(" AND PLATE_NO IN ("+ strWHerePlate+")");
}
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
gTBSubRules = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetWarDiffDays 报错", ex);
}
return gTBSubRules;
}
public IList GetLOCMSNAGE()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gTBSubRules = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM REMA_PLA_SUBSI_LOC_MANAGE");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
gTBSubRules = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetWarDiffDays 报错", ex);
}
return gTBSubRules;
}
public IList GetGP_PLATE(string strNotinPlate)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gGP_PLATE = null;
//查询可用订单以及常用字段
strSql.AppendLine("SELECT");
strSql.AppendLine(" GP.PLATE_NO ");
strSql.AppendLine(",GI.INSP_B_DEP_FLAW2 ");
strSql.AppendLine(",(SELECT COUNT(*) ");
strSql.AppendLine(" FROM NISCO.GP_USTRESULT GU ");
strSql.AppendLine(" WHERE GU.PLATE_NO = TRIM(GP.PLATE_NO) ");
strSql.AppendLine(" AND GU.UST_DEC = 'Y') GU_CNT ");
strSql.AppendLine(", QQD.THK_TOL_MIN ,QQD.THK_TOL_MAX , GP.OCCR_CD, GP.PLT, GP.PRC_LINE, GP.REC_STS, GP.PROC_CD, GP.BEF_PROC_CD, GP.PROD_CD, GP.STLGRD");
strSql.AppendLine(", CASE WHEN gpr.THK > 0 and gp.PROC_CD <> 'XAC' THEN gpr.THK ELSE gp.THK END THK");
strSql.AppendLine(", CASE WHEN gpr.WID > 0 and gp.PROC_CD <> 'XAC' THEN gpr.WID ELSE gp.WID END WID");
strSql.AppendLine(", CASE WHEN gpr.LEN > 0 and gp.PROC_CD <> 'XAC' THEN gpr.LEN ELSE gp.LEN END LEN");
//strSql.AppendLine(",GP.THK");
//strSql.AppendLine(",GP.WID");
//strSql.AppendLine(",GP.LEN");
strSql.AppendLine(", GP.WGT, GP.CAL_WGT, GP.THK_GRP, GP.WID_GRP, GP.OVER_FL, GP.ORD_FL, GP.WOO_RSN ");
strSql.AppendLine(", GP.ORD_NO, GP.ORD_ITEM, GP.ORG_ORD_NO, GP.ORG_ORD_ITEM, GP.ENDUSE_CD, GP.DEL_TO_DATE, GP.PROD_DATE ");
strSql.AppendLine(", GP.PROD_TIME, GP.SHIFT, GP.GROUP_CD, GP.LOC, GP.BED_PILE_DATE, GP.SMP_FL, GP.SMP_LOC, GP.SMP_LEN ");
strSql.AppendLine(", GP.SMP_NO, GP.INSP_EMP, GP.DSC_DATE, GP.DSC_TIME, GP.PROD_GRD, GP.SURF_GRD, GP.QUALITY_GRD ");
strSql.AppendLine(", GP.QUALITY_UPD_GRD, GP.APLY_STDSPEC, GP.APLY_ENDUSE_CD, GP.IN_PLT_CD, GP.IN_PLT, GP.IN_PLT_DATE ");
strSql.AppendLine(", GP.IN_PLT_TIME, GP.IN_CAR_NO, GP.SLAB_NO, GP.IN_PLT_CO, GP.OUT_PLT_CD, GP.OUT_PLT, GP.OUT_PLT_DATE ");
strSql.AppendLine(", GP.OUT_PLT_TIME, GP.OUT_CAR_NO, GP.OUT_SHEET_NO, GP.HOUSING_DATE, GP.HOUSING_TIME, GP.SHP_IST_NO ");
strSql.AppendLine(", GP.SHP_IST_DATE, GP.SHP_IST_TIME, GP.SHP_DATE, GP.SHP_TIME, GP.TRNS_NO, GP.CAR_NO, GP.TRNS_CMPY_CD ");
strSql.AppendLine(", GP.SHP_EMP, GP.TRAIN_LINE_NAME, GP.DEST_DETAIL, GP.CERT_RPT_FL, GP.CERT_RPT_DATE, GP.CERT_RPT_TIME ");
strSql.AppendLine(", GP.SHP_IST_CAN_DATE, GP.SHP_IST_CAN_TIME, GP.SHP_IST_CAN_FL, GP.INS_DATE, GP.INS_EMP_CD, GP.INS_PGMID ");
strSql.AppendLine(", GP.UPD_DATE, GP.UPD_EMP_CD, GP.UPD_PGM, GP.PLATE_SEC, GP.CR_CD, GP.PILE_NO, GP.PRC, GP.SF_ORNOT, GP.UST_FL ");
strSql.AppendLine(", GP.TRIM_FL, GP.END_RES, GP.ORG_PLATE, GP.ORD_THK, GP.ORD_WID, GP.ORD_LEN, GP.ORD_WGT, GP.NEXT_PROC ");
strSql.AppendLine(", GP.ACT_SMP_FL, GP.ACT_SMP_LEN, GP.CUST_CD, GP.CUR_INV, GP.BEF_APLY_STDSPEC, GP.STDSPEC_UPD_FL ");
strSql.AppendLine(", GP.SIZE_KND, GP.BAOXIN_IF_DATE, GP.SLAB_WGT, GP.CUST_SPEC_NO, GP.LOAD_WGT, GP.PRICE_GRD ");
strSql.AppendLine(", GP.PRICE_GRD_DATE, GP.PRICE_GRD_TIME, GP.PRICE_GRD_EMP_CD, GP.CHG_GRD_RES, GP.MARKING_FL ");
strSql.AppendLine(", GP.MAT_OWNER_FL, GP.MAT_OWNER_CUST_CD, GP.RSLT_PROC_CD, GP.UST_RLT_CD, GP.UST_STATUS ");
strSql.AppendLine(", GP.HTM_SHOT_BLAST, GP.HTM_SHOT_BLAST_RLT, GP.HTM_RSLT_FL, GP.HTM_METH1, GP.HTM_COND1 ");
strSql.AppendLine(", GP.HTM_RLT_METH1, GP.HTM_METH2, GP.HTM_COND2, GP.HTM_RLT_METH2, GP.HTM_METH3, GP.HTM_COND3 ");
strSql.AppendLine(", GP.HTM_RLT_METH3, GP.HTM_METH4, GP.HTM_COND4, GP.HTM_RLT_METH4, GP.HTM_METH5, GP.HTM_COND5 ");
strSql.AppendLine(", GP.HTM_RLT_METH5, GP.GRID_FL, GP.GRID_RSLT, GP.CL_FL, GP.CL_RSLT, GP.GAS_FL, GP.GAS_RSLT, GP.UST_CNT ");
strSql.AppendLine(", GP.CUT_CNT, GP.HTM_CNT, GP.CL_CNT, GP.SB_CNT, GP.GRD_CNT, GP.CLAIM_RES, GP.CLAIM_DATE, GP.CLAIM_THK ");
strSql.AppendLine(", GP.CLAIM_WID, GP.CLAIM_LEN, GP.CLAIM_WGT, GP.ERP_IF_DATE, GP.NEXT_PLAN_HTM, GP.NEXT_PLAN_HTM_COND ");
strSql.AppendLine(", GP.PLAN_CUT_CNT, GP.SMP_SET_FL, GP.FP_FL, GP.FP_RSLT, GP.FP_CNT, GP.ACT_SMP_FL_R, GP.ACT_SMP_LEN_R ");
strSql.AppendLine(", GP.SMP_NO_R, GP.ERP_MPLATE_CHK, GP.ERP_PLATE_IN ");
strSql.AppendLine(", '' SUB_PRO_STA, '' SUB_CON_STA, '' SUB_CUT_POS_1,'' SUB_FULL,'' SUB_LACK_CON ");
strSql.AppendLine(", '' SUB_CUT_POS_2, '' SUB_ORD_NO, '' SUB_ORD_ITEM, '' SUB_ORD_REM, '' SUB_SUR_LEN_1, '' SUB_SUR_WID_1 ");
strSql.AppendLine(", '' SUB_SUR_LEN_2, '' SUB_SUR_WID_2, '' SUB_SUR_STA_1, '' SUB_SUR_STA_2, '' SUB_LOS_WGT, '' SUB_DATE ");
strSql.AppendLine(", '' SUB_NUM, '' SUB_DIR, '' SUB_US_WID, '' SUB_US_LEN, '' SUB_CUT_X, '' SUB_CUT_Y, '' SUB_USER ");
strSql.AppendLine(",bob.ORD_NO BOB_ORD_NO --//--替代前订单订单号 ");
strSql.AppendLine(",bob.ORD_ITEM BOB_ORD_ITEM --//--替代前订单序列 ");
strSql.AppendLine(",bob.STDSPEC BOB_STDSPEC --//--替代前订单订单标准 ");
strSql.AppendLine(",bob.ORD_THK BOB_ORD_THK --//--替代前订单厚度 ");
strSql.AppendLine(",bob.ORD_WID BOB_ORD_WID --//--替代前订单宽度 ");
strSql.AppendLine(",bob.ORD_LEN BOB_ORD_LEN --//--替代前订单长度 ");
strSql.AppendLine(",bob.PROD_WGT BOB_WGT_UNIT --//--替代前订单重量 ");
strSql.AppendLine(",bob.CUST_CD BOB_CUST_CD --//--替代前订单客户名称 ");
strSql.AppendLine(",bob.ENDUSE_CD BOB_ENDUSE_CD --//--替代前订单订单用途 ");
strSql.AppendLine(",bob.ORD_KND BOB_ORD_KND --//--替代前订单订单种类 ");
strSql.AppendLine(",boo.ORD_NO BOO_ORD_NO --//--原始订单订单号 ");
strSql.AppendLine(",boo.ORD_ITEM BOO_ORD_ITEM --//--原始订单序列 ");
strSql.AppendLine(",boo.STDSPEC BOO_STDSPEC --//--原始订单订单标准 ");
strSql.AppendLine(",boo.ORD_THK BOO_ORD_THK --//--原始订单厚度 ");
strSql.AppendLine(",boo.ORD_WID BOO_ORD_WID --//--原始订单宽度 ");
strSql.AppendLine(",boo.ORD_LEN BOO_ORD_LEN --//--原始订单长度 ");
strSql.AppendLine(",boo.PROD_WGT BOO_WGT_UNIT --//--原始订单重量 ");
strSql.AppendLine(",boo.CUST_CD BOO_CUST_CD --//--原始订单客户名称 ");
strSql.AppendLine("FROM NISCO.GP_PLATE GP ");
strSql.AppendLine("LEFT JOIN NISCO.BP_ORDER_ITEM bob ON gp.ORD_NO = bob.ORD_NO AND gp.ORD_ITEM = bob.ORD_ITEM--// ");
strSql.AppendLine("LEFT JOIN NISCO.BP_ORDER_ITEM boo ON gp.ORG_ORD_NO = boo.ORD_NO AND gp.ORG_ORD_ITEM = boo.ORD_ITEM--// ");
strSql.AppendLine("LEFT JOIN NISCO.QP_QLTY_DELV QQD ON gp.ORG_ORD_NO = QQD.ORD_NO AND gp.ORG_ORD_ITEM = QQD.ORD_ITEM--// ");
strSql.AppendLine("LEFT JOIN NISCO.GP_PLATE_REPLACE gpr ON gpr.PLATE_NO = gp.PLATE_NO ");
strSql.AppendLine("LEFT JOIN NISCO.GP_INSPPLATE GI ON GI.MAT_NO = GP.PLATE_NO ");
strSql.AppendLine("WHERE 1=1 ");
strSql.AppendLine("AND GP.proc_cd IN('DZB','DZE','QAB','XAC') AND GP.PROD_CD = 'PP' AND GP.REC_STS = '2' and GP.ord_fl='2' ");
strSql.AppendLine("AND(CASE WHEN GP.proc_cd = 'XAC' AND GP.PROD_GRD = '1' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'QAB' AND GP.SURF_GRD = '1' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZB' AND GP.SURF_GRD = '4' THEN 1 ");
strSql.AppendLine("WHEN GP.proc_cd = 'DZE' AND GP.SURF_GRD = '4' THEN 1 ELSE 0 END) = 1 ");
strSql.AppendLine("AND GP.APLY_STDSPEC NOT LIKE '%NG-XY%'");
strSql.AppendLine("AND GP.Len <50000 "); //钢板长度上限50米
strSql.AppendLine(strNotinPlate);
strSql.AppendLine("ORDER BY GP.PLATE_NO");
//开启数据库连接查询数据
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
gGP_PLATE = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetGP_PLATE 报错", ex);
}
return gGP_PLATE;
}
///
/// 更新配置参数
///
public void UpdateTbPSConf(TB_PS_CONFIG prTBSubRules)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
//查询可用订单以及常用字段
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
StringBuilder strsql = new StringBuilder();
if (prTBSubRules.ID != string.Empty)
{
strsql.AppendLine("UPDATE TB_PS_CONFIG SET ID='" + prTBSubRules.ID + "'");
if (!string.IsNullOrEmpty(prTBSubRules.LOOP_CYC))
{
strsql.AppendLine(", LOOP_CYC='" + prTBSubRules.LOOP_CYC + "'");
}
if (!string.IsNullOrEmpty(prTBSubRules.EFF_LEN))
{
strsql.AppendLine(", EFF_LEN='" + prTBSubRules.EFF_LEN + "'");
}
if (!string.IsNullOrEmpty(prTBSubRules.EFF_WID))
{
strsql.AppendLine(", EFF_WID='" + prTBSubRules.EFF_WID + "'");
}
if (!string.IsNullOrEmpty(prTBSubRules.ORD_DAYS_DIFF))
{
strsql.AppendLine(", ORD_DAYS_DIFF='" + prTBSubRules.ORD_DAYS_DIFF + "'");
}
if (!string.IsNullOrEmpty(prTBSubRules.PLATE_DAYS_DIFF))
{
strsql.AppendLine(", PLATE_DAYS_DIFF='" + prTBSubRules.PLATE_DAYS_DIFF + "'");
}
if (!string.IsNullOrEmpty(prTBSubRules.SUB_RATE))
{
strsql.AppendLine(", SUB_RATE='" + prTBSubRules.SUB_RATE + "'");
}
if (!string.IsNullOrEmpty(prTBSubRules.SUB_REM))
{
strsql.AppendLine(", SUB_REM='" + prTBSubRules.SUB_REM + "'");
}
if (!string.IsNullOrEmpty(prTBSubRules.SPLITTING_LEN))
{
strsql.AppendLine(", SPLITTING_LEN='" + prTBSubRules.SPLITTING_LEN + "'");
}
strsql.AppendLine("WHERE ID='" + prTBSubRules.ID + "'");
}
db.Execute(strsql.ToString());
}
}
catch (Exception ex)
{
logger.Error("UpdateParaConf 报错", ex);
}
}
public IList GetQPSTDHEAD()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gQPSTDHEAD = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM NISCO.QP_STD_HEAD");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
gQPSTDHEAD = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetQPSTDHEAD 报错", ex);
}
return gQPSTDHEAD;
}
public IList GetGPTHKADD()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gGPTHKADD = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM NISCO.GP_THK_ADD");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
gGPTHKADD = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetGPTHKADD 报错", ex);
}
return gGPTHKADD;
}
public IList GetTBPlateSpe()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gTBPlateSpe = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM TB_PLATE_SPE");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
gTBPlateSpe = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetTBPlateSpe 报错", ex);
}
return gTBPlateSpe;
}
public IList GetTB_PLATE_SPE()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gTB_PLATE_SPE = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM TB_PLATE_SPE WHERE 1 = 1");
//strSql.AppendLine(" and to_date(INS_DATE || INS_TIME ,'yyyy-mm-dd hh24:mi:ss') < to_date('" + DateTime.Now.AddDays(-1) + "','yyyy-mm-dd hh24:mi:ss')");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
gTB_PLATE_SPE = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetTB_PLATE_SPE 报错", ex);
}
return gTB_PLATE_SPE;
}
public IList GetTBOrdSpe()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gTBOrdSpe = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM TB_ORD_SPE");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
gTBOrdSpe = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetTBOrdSpe 报错", ex);
}
return gTBOrdSpe;
}
public IList GetTbSpecialOrd(string ORD_FLG)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gTBOrdSpe = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM TB_SPECIAL_ORD where 1=1 ");
//if (!string.IsNullOrWhiteSpace(ORD_FLG)) strSql.AppendLine(" AND ORD_FLG = '" + ORD_FLG + "'");
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db"))
{
gTBOrdSpe = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetTBOrdSpe 报错", ex);
}
return gTBOrdSpe;
}
///
/// 是否可替代记录
///
///
public IList GetGpPlateReplace(string PLATE_NO = null)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gGpPlateReplace = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM NISCO.GP_PLATE_REPLACE GP where 1=1 ");
if (!string.IsNullOrEmpty(PLATE_NO))
{
strSql.AppendLine(PLATE_NO);
}
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
gGpPlateReplace = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetGpPlateReplace 报错", ex);
}
return gGpPlateReplace;
}
///
/// 获取保留的余材
///
///
public IList GetGP_ZZP_YJ()
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltGetGP_ZZP_YJ = new List();
strSql.AppendLine("select * from NISCO.GP_ZZP_YJ ");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltGetGP_ZZP_YJ = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetGP_ZZP_YJ 报错 : ", ex);
}
return ltGetGP_ZZP_YJ;
}
public IList GetYCTDWH(string strWhereSTD)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
IList gYCTDWH = null;
//查询可用订单以及常用字段
try
{
strSql.AppendLine("SELECT * FROM NISCO.YCTD_WH");
strSql.AppendLine("WHERE 1=1 ");
strSql.AppendLine(strWhereSTD);
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
gYCTDWH = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetYCTDWH 报错", ex);
}
return gYCTDWH;
}
#endregion 获取存储数据
#region 订单物理特性
///
/// 获取订单物理属性QP_QLTY_MATR_MAIN
///
///
public IList GetQP_QLTY_MATR_MAIN(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltQP_QLTY_MATR_MAIN = new List();
strSql.AppendLine(" SELECT* FROM(SELECT QQM.*,");
strSql.AppendLine(" rank() over(partition by QQM.ord_no, QQM.ord_item order by knd desc) rk");
strSql.AppendLine(" from NISCO.QP_QLTY_MATR_MAIN QQM ");
strSql.AppendLine(" where(QQM.ORD_NO, QQM.ORD_ITEM) IN( ");
strSql.AppendLine(" SELECT ");
strSql.AppendLine(" TO_CHAR(BOI.ORD_NO), TO_CHAR(BOI.ORD_ITEM) ");
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("WHERE 1=1 ");// ROUND(CPP.ORD_REM_WGT / (((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)) >= 1");
strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
strSql.AppendLine(" AND boi.PROD_CD = 'PP' ");
strSql.AppendLine(" AND boi.REC_STS = '2' ");
strSql.AppendLine(" and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine(" AND boi.ord_knd IN('A') ");
strSql.AppendLine(strWHereOrd);
strSql.AppendLine(strSpecialOrd);
strSql.AppendLine(" )");
strSql.AppendLine(") T WHERE T.RK = 1");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltQP_QLTY_MATR_MAIN = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("QP_QLTY_MATR_MAIN 报错 : ", ex);
}
return ltQP_QLTY_MATR_MAIN;
}
///
/// 获取订单物理属性QP_QLTY_MATR_HA
///
///
public IList GetQP_QLTY_MATR_HA(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltQP_QLTY_MATR_HA = new List();
strSql.AppendLine(" SELECT* FROM(SELECT QQM.*,");
strSql.AppendLine(" rank() over(partition by QQM.ord_no, QQM.ord_item order by knd desc) rk");
strSql.AppendLine(" from NISCO.QP_QLTY_MATR_HA QQM ");
strSql.AppendLine(" where(QQM.ORD_NO, QQM.ORD_ITEM) IN( ");
strSql.AppendLine(" SELECT ");
strSql.AppendLine(" TO_CHAR(BOI.ORD_NO), TO_CHAR(BOI.ORD_ITEM) ");
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("WHERE 1=1 ");
strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
strSql.AppendLine(" AND boi.PROD_CD = 'PP' ");
strSql.AppendLine(" AND boi.REC_STS = '2' ");
strSql.AppendLine(" and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine(" AND boi.ord_knd IN('A') ");
strSql.AppendLine(strWHereOrd);
strSql.AppendLine(strSpecialOrd);
strSql.AppendLine(" )");
strSql.AppendLine(") T WHERE T.RK = 1");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltQP_QLTY_MATR_HA = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetQP_QLTY_MATR_HA 报错 : ", ex);
}
return ltQP_QLTY_MATR_HA;
}
///
/// 获取订单物理属性QP_QLTY_MATR_HB
///
///
public IList GetQP_QLTY_MATR_HB(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltQP_QLTY_MATR_HB = new List();
strSql.AppendLine(" SELECT* FROM(SELECT QQM.*,");
strSql.AppendLine(" rank() over(partition by QQM.ord_no, QQM.ord_item order by knd desc) rk");
strSql.AppendLine(" from NISCO.QP_QLTY_MATR_HB QQM ");
strSql.AppendLine(" where(QQM.ORD_NO, QQM.ORD_ITEM) IN( ");
strSql.AppendLine(" SELECT ");
strSql.AppendLine(" TO_CHAR(BOI.ORD_NO), TO_CHAR(BOI.ORD_ITEM) ");
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("WHERE 1=1 ");
strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
strSql.AppendLine(" AND boi.PROD_CD = 'PP' ");
strSql.AppendLine(" AND boi.REC_STS = '2' ");
strSql.AppendLine(" and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine(" AND boi.ord_knd IN('A') ");
strSql.AppendLine(strWHereOrd);
strSql.AppendLine(strSpecialOrd);
strSql.AppendLine(" )");
strSql.AppendLine(") T WHERE T.RK = 1");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltQP_QLTY_MATR_HB = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetQP_QLTY_MATR_HB 报错 : ", ex);
}
return ltQP_QLTY_MATR_HB;
}
///
/// 获取订单物理属性QP_QLTY_MATR_HC
///
///
public IList GetQP_QLTY_MATR_HC(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltQP_QLTY_MATR_HC = new List();
strSql.AppendLine(" SELECT* FROM(SELECT QQM.*,");
strSql.AppendLine(" rank() over(partition by QQM.ord_no, QQM.ord_item order by knd desc) rk");
strSql.AppendLine(" from NISCO.QP_QLTY_MATR_HC QQM ");
strSql.AppendLine(" where(QQM.ORD_NO, QQM.ORD_ITEM) IN( ");
strSql.AppendLine(" SELECT ");
strSql.AppendLine(" TO_CHAR(BOI.ORD_NO), TO_CHAR(BOI.ORD_ITEM) ");
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("WHERE 1=1 ");
strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
strSql.AppendLine(" AND boi.PROD_CD = 'PP' ");
strSql.AppendLine(" AND boi.REC_STS = '2' ");
strSql.AppendLine(" and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine(" AND boi.ord_knd IN('A') ");
strSql.AppendLine(strWHereOrd);
strSql.AppendLine(strSpecialOrd);
strSql.AppendLine(" )");
strSql.AppendLine(") T WHERE T.RK = 1");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltQP_QLTY_MATR_HC = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetQP_QLTY_MATR_HC 报错 : ", ex);
}
return ltQP_QLTY_MATR_HC;
}
///
/// 获取订单物理属性QP_QLTY_MATR_HD
///
///
public IList GetQP_QLTY_MATR_HD(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltQP_QLTY_MATR_HD = new List();
strSql.AppendLine(" SELECT* FROM(SELECT QQM.*,");
strSql.AppendLine(" rank() over(partition by QQM.ord_no, QQM.ord_item order by knd desc) rk");
strSql.AppendLine(" from NISCO.QP_QLTY_MATR_HD QQM ");
strSql.AppendLine(" where(QQM.ORD_NO, QQM.ORD_ITEM) IN( ");
strSql.AppendLine(" SELECT ");
strSql.AppendLine(" TO_CHAR(BOI.ORD_NO), TO_CHAR(BOI.ORD_ITEM) ");
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("WHERE 1=1 ");
strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
strSql.AppendLine(" AND boi.PROD_CD = 'PP' ");
strSql.AppendLine(" AND boi.REC_STS = '2' ");
strSql.AppendLine(" and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine(" AND boi.ord_knd IN('A') ");
strSql.AppendLine(strWHereOrd);
strSql.AppendLine(strSpecialOrd);
strSql.AppendLine(" )");
strSql.AppendLine(") T WHERE T.RK = 1");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltQP_QLTY_MATR_HD = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetQP_QLTY_MATR_HD 报错 : ", ex);
}
return ltQP_QLTY_MATR_HD;
}
///
/// 获取订单物理属性QP_QLTY_MATR_HE
///
///
public IList GetQP_QLTY_MATR_HE(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltQP_QLTY_MATR_HE = new List();
strSql.AppendLine(" SELECT* FROM(SELECT QQM.*,");
strSql.AppendLine(" rank() over(partition by QQM.ord_no, QQM.ord_item order by knd desc) rk");
strSql.AppendLine(" from NISCO.QP_QLTY_MATR_HE QQM ");
strSql.AppendLine(" where(QQM.ORD_NO, QQM.ORD_ITEM) IN( ");
strSql.AppendLine(" SELECT ");
strSql.AppendLine(" TO_CHAR(BOI.ORD_NO), TO_CHAR(BOI.ORD_ITEM) ");
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("WHERE 1=1 ");
strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
strSql.AppendLine(" AND boi.PROD_CD = 'PP' ");
strSql.AppendLine(" AND boi.REC_STS = '2' ");
strSql.AppendLine(" and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine(" AND boi.ord_knd IN('A') ");
strSql.AppendLine(strWHereOrd);
strSql.AppendLine(strSpecialOrd);
strSql.AppendLine(" )");
strSql.AppendLine(") T WHERE T.RK = 1");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltQP_QLTY_MATR_HE = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetQP_QLTY_MATR_HE 报错 : ", ex);
}
return ltQP_QLTY_MATR_HE;
}
///
/// 获取订单物理属性QP_QLTY_MATR_HF
///
///
public IList GetQP_QLTY_MATR_HF(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltQP_QLTY_MATR_HF = new List();
strSql.AppendLine(" SELECT* FROM(SELECT QQM.*,");
strSql.AppendLine(" rank() over(partition by QQM.ord_no, QQM.ord_item order by knd desc) rk");
strSql.AppendLine(" from NISCO.QP_QLTY_MATR_HF QQM ");
strSql.AppendLine(" where(QQM.ORD_NO, QQM.ORD_ITEM) IN( ");
strSql.AppendLine(" SELECT ");
strSql.AppendLine(" TO_CHAR(BOI.ORD_NO), TO_CHAR(BOI.ORD_ITEM) ");
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("WHERE 1=1 ");
strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
strSql.AppendLine(" AND boi.PROD_CD = 'PP' ");
strSql.AppendLine(" AND boi.REC_STS = '2' ");
strSql.AppendLine(" and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine(" AND boi.ord_knd IN('A') ");
strSql.AppendLine(strWHereOrd);
strSql.AppendLine(strSpecialOrd);
strSql.AppendLine(" )");
strSql.AppendLine(") T WHERE T.RK = 1");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltQP_QLTY_MATR_HF = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetQP_QLTY_MATR_HF 报错 : ", ex);
}
return ltQP_QLTY_MATR_HF;
}
///
/// 获取订单物理属性QP_QLTY_MATR_HJ
///
///
public IList GetQP_QLTY_MATR_HJ(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltQP_QLTY_MATR_HJ = new List();
strSql.AppendLine(" SELECT* FROM(SELECT QQM.*,");
strSql.AppendLine(" rank() over(partition by QQM.ord_no, QQM.ord_item order by knd desc) rk");
strSql.AppendLine(" from NISCO.QP_QLTY_MATR_HJ QQM ");
strSql.AppendLine(" where(QQM.ORD_NO, QQM.ORD_ITEM) IN( ");
strSql.AppendLine(" SELECT ");
strSql.AppendLine(" TO_CHAR(BOI.ORD_NO), TO_CHAR(BOI.ORD_ITEM) ");
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("WHERE 1=1 ");
strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
strSql.AppendLine(" AND boi.PROD_CD = 'PP' ");
strSql.AppendLine(" AND boi.REC_STS = '2' ");
strSql.AppendLine(" and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine(" AND boi.ord_knd IN('A') ");
strSql.AppendLine(strWHereOrd);
strSql.AppendLine(strSpecialOrd);
strSql.AppendLine(" )");
strSql.AppendLine(") T WHERE T.RK = 1");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltQP_QLTY_MATR_HJ = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetQP_QLTY_MATR_HJ 报错 : ", ex);
}
return ltQP_QLTY_MATR_HJ;
}
///
/// 获取订单物理属性QP_QLTY_MATR_HK
///
///
public IList GetQP_QLTY_MATR_HK(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList ltQP_QLTY_MATR_HK = new List();
strSql.AppendLine(" SELECT* FROM(SELECT QQM.*,");
strSql.AppendLine(" rank() over(partition by QQM.ord_no, QQM.ord_item order by knd desc) rk");
strSql.AppendLine(" from NISCO.QP_QLTY_MATR_HK QQM ");
strSql.AppendLine(" where(QQM.ORD_NO, QQM.ORD_ITEM) IN( ");
strSql.AppendLine(" SELECT ");
strSql.AppendLine(" TO_CHAR(BOI.ORD_NO), TO_CHAR(BOI.ORD_ITEM) ");
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("WHERE 1=1 ");
strSql.AppendLine(" AND ((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') + NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100)/(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85)>=0.95 ");
strSql.AppendLine(" AND boi.PROD_CD = 'PP' ");
strSql.AppendLine(" AND boi.REC_STS = '2' ");
strSql.AppendLine(" and boi.ORD_STS IN('E', 'D') ");
strSql.AppendLine(" AND boi.ord_knd IN('A') ");
strSql.AppendLine(strWHereOrd);
strSql.AppendLine(strSpecialOrd);
strSql.AppendLine(" )");
strSql.AppendLine(") T WHERE T.RK = 1");
try
{
//开启数据库连接查询数据
using (IDbContext db = ObjectContainer.GetObject("db_sur"))
{
ltQP_QLTY_MATR_HK = db.Query(strSql.ToString());
}
}
catch (Exception ex)
{
logger.Error("GetQP_QLTY_MATR_HK 报错 : ", ex);
}
return ltQP_QLTY_MATR_HK;
}
///
/// 获取订单物理属性QP_QLTY_MATR_HM
///
///
public IList GetQP_QLTY_MATR_HM(string strWHereOrd, string strSpecialOrd)
{
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
DataTable dtCheck = new DataTable();
IList