|
|
//using System;
|
|
|
//using System.Collections.Generic;
|
|
|
//using System.Linq;
|
|
|
//using System.Text;
|
|
|
//using System.Threading.Tasks;
|
|
|
|
|
|
//namespace SlabHandle
|
|
|
//{
|
|
|
// internal class SlabWidThkService
|
|
|
// {
|
|
|
// }
|
|
|
//}
|
|
|
using Confluent.Kafka;
|
|
|
using log4net;
|
|
|
using SlabHandle.Enity;
|
|
|
using SOA.Objects;
|
|
|
using SOA.Persistent;
|
|
|
using System;
|
|
|
using System.Collections.Concurrent;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
using System.Linq;
|
|
|
using System.Reflection;
|
|
|
using System.Security.Cryptography;
|
|
|
using System.Text;
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
namespace SlabHandle
|
|
|
{
|
|
|
public class SlabWidThkService_test
|
|
|
{
|
|
|
private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
private static string slab = " AND SLAB_NO in ('2410198603') ";
|
|
|
private static string boi = " boi.ORD_NO || '-' || boi.ORD_ITEM in ('OMA24010014-041')";
|
|
|
private static string lack_num = ",'8'AS SUB_LACK_NUM,'8'AS LACK_NUM";
|
|
|
private static string wgt_max = ",'200' AS WGT_MAX ";
|
|
|
private static string wgt_min = ",'150' AS WGT_MIN ";
|
|
|
#region 获取数据
|
|
|
|
|
|
/// <summary>
|
|
|
///查询宽厚板板坯信息
|
|
|
/// </summary>
|
|
|
/// <returns>所有符合条件的板坯</returns>
|
|
|
public IList<TB_SLAB> GetWidThkSlab(string strWHere)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<TB_SLAB> ltSlab = new List<TB_SLAB>();
|
|
|
|
|
|
strSql.AppendLine("SELECT SLAB_NO ,(SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = A.STLGRD ) STEEL_GRD_DETAIL" +
|
|
|
", OCCR_CD, PLT, PRC_LINE, REC_STS, PROC_CD" +
|
|
|
", BEF_PROC_CD, PROD_CD, A.STLGRD STLGRD" +
|
|
|
", THK" +
|
|
|
", A.WID WID " +
|
|
|
", A.LEN LEN " +
|
|
|
", WGT, CAL_WGT" +
|
|
|
", THK_GRP, WID_GRP, OVER_FL, ORD_FL" +
|
|
|
", WOO_RSN, ORD_NO, ORD_ITEM, ORG_ORD_NO" +
|
|
|
", ORG_ORD_ITEM, ENDUSE_CD, DEL_TO_DATE, PROD_DATE" +
|
|
|
", PROD_TIME, SHIFT, GROUP_CD, NVL(LOC,' ') LOC, BED_PILE_DATE" +
|
|
|
", SMP_FL, SMP_LOC, SMP_LEN, SMP_NO, INSP_EMP, DSC_DATE" +
|
|
|
", DSC_TIME, PROD_GRD, SURF_GRD, QUALITY_GRD, QUALITY_UPD_GRD" +
|
|
|
", APLY_STDSPEC, APLY_ENDUSE_CD, IN_PLT_CD, IN_PLT, IN_PLT_DATE" +
|
|
|
", IN_PLT_TIME, IN_CAR_NO, IN_SHEET_NO, IN_PLT_CO, OUT_PLT_CD" +
|
|
|
", OUT_PLT, OUT_PLT_DATE, OUT_PLT_TIME, OUT_CAR_NO, OUT_SHEET_NO" +
|
|
|
", HOUSING_DATE, HOUSING_TIME, SHP_IST_NO, SHP_IST_DATE, SHP_IST_TIME" +
|
|
|
", SHP_DATE, SHP_TIME, TRNS_NO, CAR_NO, TRNS_CMPY_CD, SHP_EMP, TRAIN_LINE_NAME" +
|
|
|
", DEST_DETAIL, CERT_RPT_FL, CERT_RPT_DATE, CERT_RPT_TIME, SHP_IST_CAN_DATE" +
|
|
|
", SHP_IST_CAN_TIME, SHP_IST_CAN_FL, INS_DATE, INS_EMP_CD, INS_PGMID, UPD_DATE" +
|
|
|
", UPD_EMP_CD, UPD_PGM, SF_ORNOT, SLAB_RHF_IN_DATE, RHF_REJ_ORNOT, AIM_HCR_KND" +
|
|
|
", HCR_KND, PRC, SCR_ORNOT, END_RES, substr(MOTHER_SLAB,1,10) MOTHER_SLAB, ORD_THK, ORD_WID, ORD_LEN" +
|
|
|
", ORD_WGT, QUALITY_ID, TAPER_LEN, HEAD_SLAB_WID, TAIL_SLAB_WID, CUST_CD" +
|
|
|
", IN_SLAB_NO, CUR_HCR_KND, WGT_L2, QUALITY_ID_L2, CUR_INV, SIZE_KND, MIXED_FL" +
|
|
|
", BAOXIN_IF_DATE, CUST_SPEC_NO, STLGRD_UPD_FL, BEF_STLGRD, WGT_CAL_L2, LOAD_WGT" +
|
|
|
", CHG_GRD_RES, MAT_OWNER_FL, MAT_OWNER_CUST_CD, PLAN_MILL_PLT, USE_MILL_PLT, PLAN_SLAB_CUT_CNT" +
|
|
|
", CLAIM_RES, CLAIM_DATE, CLAIM_THK, CLAIM_WID, CLAIM_LEN, CLAIM_WGT, HTM_ORD_METH, HTM_RLT_METH" +
|
|
|
", HTM_STATUS, SLAB_BACK_CNT, CUT_CNT, HTM_CNT, ERP_IF_DATE, PLAN_SLAB_CUT_FL, INGOT_FL, HEAD_SLAB_THK" +
|
|
|
", TAIL_SLAB_THK, PLAN_SLAB_MERGE_FL, MOTHER_SLAB_MERGE, GRID_FL, GRID_RSLT, HEAT_NO, RH_CD" +
|
|
|
", CAL_TM, CAL_TN, ACT_SMP_FL, SMP_NO1, SMP_NO2, GET_SMP_DATE, SMP_CAST_NO, SMP_FREQENCY" +
|
|
|
", SMP_NOTE, SMP_NOTE1, SMP_NOTE2, SLAB_NO1, SLAB_NO2, UST_RLT_CD, UST_RSLT, UST_METH" +
|
|
|
", CUT_AM, CUT_BM, CUT_CM, CUT_DM, CUT_EM, CUT_FM, MOTHER_SLAB_BILLET, BILLET_TYPE" +
|
|
|
", MOTHER_SLAB_ELEC, RES_CM, RES_DM, RES_EM, RES_FM, RES_GM" +
|
|
|
", A.LEN REM_LEN " +
|
|
|
", A.WGT REM_WGT " +
|
|
|
", A.LEN ORG_LEN " +
|
|
|
", A.WID ORG_WID " +
|
|
|
", A.LEN ACT_LEN " +
|
|
|
", CASE WHEN (SELECT COUNT(HEAT_NO) FROM NISCO.FP_RHRSLT WHERE HEAT_NO = SUBSTR(A.SLAB_NO,1,8))>0 THEN '1' ELSE '0' END VAC_FLG ");
|
|
|
strSql.AppendLine(",(CASE WHEN(SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET CSDD WHERE (CSDD.EST_CD LIKE '5%' OR CSDD.EST_CD LIKE '6%') AND CSDD.SLAB_NO = A.SLAB_NO) > 0 THEN '1'");
|
|
|
strSql.AppendLine(" WHEN(SELECT COUNT(*) FROM(SELECT COM FROM(SELECT CSDD_C.EST_CD || '_' || CSDD_C.EST_COMMENT COM FROM NISCO.CP_SLAB_DELI_DET CSDD_C ");
|
|
|
strSql.AppendLine(" WHERE CSDD_C.SLAB_NO = A.SLAB_NO ORDER BY CSDD_C.EST_DATE DESC) T_COM WHERE ROWNUM = 1) T_L WHERE T_L.COM LIKE '%协议%') > 0 THEN '1' ");
|
|
|
strSql.AppendLine(" ELSE '0' END ) XY_FLG ");
|
|
|
|
|
|
strSql.AppendLine(",(SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
strSql.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
strSql.AppendLine(" WHERE SLAB_NO = A.SLAB_NO ");
|
|
|
strSql.AppendLine(" AND EST_CD IS NOT NULL) || ' ' || ");
|
|
|
strSql.AppendLine(" (CASE WHEN A.MOTHER_SLAB IS NOT NULL AND LENGTH(A.MOTHER_SLAB) = 10 THEN ");
|
|
|
strSql.AppendLine(" (SELECT wmsys.wm_concat(EST_CD || EST_COMMENT) ");
|
|
|
strSql.AppendLine(" FROM NISCO.CP_SLAB_DELI_DET ");
|
|
|
strSql.AppendLine(" WHERE SLAB_NO = A.MOTHER_SLAB ");
|
|
|
strSql.AppendLine(" AND EST_CD IS NOT NULL) ");
|
|
|
strSql.AppendLine(" ELSE '' ");
|
|
|
strSql.AppendLine(" END ) EST_COMMENT ");
|
|
|
|
|
|
strSql.AppendLine(" , (case when (select substr(MOTHER_SLAB,1,10) from nisco.fp_slab where slab_no=substr(a.MOTHER_SLAB,1,10)) is not null then (select substr(MOTHER_SLAB,1,10) from nisco.fp_slab where slab_no=substr(a.MOTHER_SLAB,1,10)) else '' end) Gmother_slab ");
|
|
|
//低倍标记 0为低倍不合
|
|
|
strSql.AppendLine(" , case when (SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD = '0001' AND C.REASON_CD = '3010' AND C.REASON_COMMENT = '低倍不符合要求') >0 THEN 1 ELSE 0 END FLG_LOWPOWER");
|
|
|
strSql.AppendLine("FROM NISCO.FP_SLAB A ");
|
|
|
strSql.AppendLine("WHERE 1 = 1 ");
|
|
|
|
|
|
//测试数据
|
|
|
//strSql.AppendLine(" AND SLAB_NO in ('2320233331') ");
|
|
|
|
|
|
strSql.AppendLine(slab);
|
|
|
|
|
|
//strSql.AppendLine(" AND A.CUR_INV in ( 'ZB','00','ZZ','HB','C7') ");
|
|
|
//strSql.AppendLine(" AND(A.PROC_CD = 'CAC' OR ");
|
|
|
//strSql.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.REASON_CD NOT IN('1080','2014','2015','2018','2026','3014','5011','5013','8081') AND EST_CD IS NULL) < 1)");
|
|
|
//strSql.AppendLine(" AND A.PROC_CD='CAD' ) ");
|
|
|
//strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0002','0003','2010')) < 1 )");
|
|
|
//strSql.AppendLine(" AND A.ORD_FL = '2' ");
|
|
|
//strSql.AppendLine(" AND A.REC_STS = '2' ");
|
|
|
//strSql.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
//strSql.AppendLine(" AND A.WGT > 0 ");
|
|
|
//strSql.AppendLine(" AND NVL(A.PLAN_SLAB_CUT_FL,'N') = 'N' ");
|
|
|
//strSql.AppendLine(" AND NVL(A.QUALITY_UPD_GRD, 'N') NOT IN('N','E') ");
|
|
|
//strSql.AppendLine(" AND LEAST(A.WID, A.LEN) >= 1600 ");
|
|
|
//strSql.AppendLine(" AND GREATEST(A.WID, A.LEN) >= 2500 ");
|
|
|
//strSql.AppendLine(" AND A.THK >= 120 ");
|
|
|
//strSql.AppendLine(" AND NVL(A.PLAN_SLAB_MERGE_FL,'N') = 'N' ");
|
|
|
//strSql.AppendLine(" AND NVL(A.PLAN_MILL_PLT,'N') LIKE 'C2' || '%' ");
|
|
|
|
|
|
// 2.2.4.4.4.3.5.人工锁定的板坯,不允许替代
|
|
|
//strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO) < 1 )");
|
|
|
|
|
|
//2.2.4.4.4.3.6.订单有低倍要求并且物料低倍等级不合格的板坯,不允许替代。
|
|
|
/// strSql.AppendLine(" AND ( ( (SELECT COUNT(*) FROM NISCO.qp_qlty_slab_lowpower Q WHERE Q.ORD_NO =A.ORD_NO AND Q.ORD_ITEM=A.ORD_ITEM) >= 1) AND A.QUALITY_GRD = '4' AND ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD = '0001' AND C.REASON_CD = '3010' AND C.REASON_COMMENT = '低倍不符合要求') < 1 ))");
|
|
|
|
|
|
/// 2.2.4.4.4.3.8.板坯已有往板卷库或宽厚板库的转库计划,不允许替代。
|
|
|
/// strSql.AppendLine("and (SELECT COUNT(*) FROM NISCO.CP_SLAB_MOVE_PLAN M WHERE M.SLAB_NO = A.SLAB_NO AND M.TO_INV IN ('00','ZB') AND M.PRC_STS = 'A')=0");
|
|
|
|
|
|
strSql.AppendLine(" ORDER BY A.LOC DESC, A.SLAB_NO ASC ");
|
|
|
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltSlab = db.Query<TB_SLAB>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetWidThkSlab 报错", ex);
|
|
|
}
|
|
|
|
|
|
return ltSlab;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取订单物理属性QP_QLTY_MATR
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<QP_QLTY_MATR> GetQP_QLTY_MATR(string strWhere)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
IList<QP_QLTY_MATR> ltQP_QLTY_MATR = new List<QP_QLTY_MATR>();
|
|
|
|
|
|
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 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 ");
|
|
|
//strSql.AppendLine(" (SELECT COUNT(A.REQ_SEQ_NO) ");
|
|
|
//strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B");
|
|
|
//strSql.AppendLine(" WHERE ");
|
|
|
//strSql.AppendLine(" 1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM");
|
|
|
//strSql.AppendLine(" AND A.BLOCK_SEQ >= '01' ");
|
|
|
//strSql.AppendLine(" AND A.SEQ >= '01' ");
|
|
|
//strSql.AppendLine(" And B.REQ_SEQ_NO = A.REQ_SEQ_NO ");
|
|
|
//strSql.AppendLine(" AND B.REC_STS = '1') + GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) >= 0.95");
|
|
|
//strSql.AppendLine(" AND boi.PROD_CD = 'PP' ");
|
|
|
//strSql.AppendLine(" AND boi.REC_STS = '2' ");
|
|
|
//strSql.AppendLine(" and boi.ORD_STS IN('E', 'D') ");
|
|
|
//strSql.AppendLine(" AND (boi.ord_knd ='A' OR (boi.ord_knd ='T' AND (SELECT COUNT(*) FROM NISCO.BP_ODER_XY BOXY WHERE BOXY.ORDER_NO=BOI.ORD_NO AND BOXY.ORDER_ITEM=BOI.ORD_ITEM )>0)) ");
|
|
|
//strSql.AppendLine("AND boi.CFM_MILL_PLT='C2'");
|
|
|
strSql.AppendLine(boi);
|
|
|
strSql.AppendLine(" )");
|
|
|
strSql.AppendLine(") T WHERE T.RK = 1");
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltQP_QLTY_MATR = db.Query<QP_QLTY_MATR>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("QP_QLTY_MATR 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltQP_QLTY_MATR;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 可用订单选择
|
|
|
/// 订单欠量字段 ORD_REM_CNT
|
|
|
/// </summary>
|
|
|
/// <returns>所有符合条件的订单 集合</returns>
|
|
|
public IList<BP_ORDER_ITEM> GetOrder(string strWHereOrd)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
StringBuilder strRemSql = new StringBuilder(); //声明订单欠量sql
|
|
|
IList<BP_ORDER_ITEM> gpPlates = null;
|
|
|
|
|
|
strSql.AppendLine("SELECT DISTINCT ");
|
|
|
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 ");
|
|
|
//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(wgt_max);
|
|
|
strSql.AppendLine(wgt_min);
|
|
|
//strSql.AppendLine(" ,NVL((SELECT sum(A.WGT) ");
|
|
|
//strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B ");
|
|
|
//strSql.AppendLine(" WHERE ");
|
|
|
//strSql.AppendLine("1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
//strSql.AppendLine("AND A.BLOCK_SEQ >= '01' ");
|
|
|
//strSql.AppendLine("AND A.SEQ >= '01' ");
|
|
|
//strSql.AppendLine("And B.REQ_SEQ_NO = A.REQ_SEQ_NO ");
|
|
|
//strSql.AppendLine("AND B.REC_STS = '1'),0)+NVL(CPP.ORD_REM_WGT, 0) AS WGT_MAX ");
|
|
|
|
|
|
////欠量下线
|
|
|
//strSql.AppendLine(" ,NVL((SELECT sum(A.WGT) ");
|
|
|
//strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B ");
|
|
|
//strSql.AppendLine(" WHERE ");
|
|
|
//strSql.AppendLine("1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
//strSql.AppendLine("AND A.BLOCK_SEQ >= '01' ");
|
|
|
//strSql.AppendLine("AND A.SEQ >= '01' ");
|
|
|
//strSql.AppendLine("And B.REQ_SEQ_NO = A.REQ_SEQ_NO ");
|
|
|
//strSql.AppendLine("AND B.REC_STS = '1'),0)+(NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) AS WGT_MIN ");
|
|
|
|
|
|
|
|
|
strSql.AppendLine(",(NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) AS SUB_LACK_WGT ");
|
|
|
strSql.AppendLine(",NVL(QQT.HTM_METH1,' ') HTM_METH1 ");
|
|
|
strSql.AppendLine(",NVL(QQT.HTM_METH2,' ') HTM_METH2 ");
|
|
|
strSql.AppendLine(",NVL(QQT.HTM_METH3,' ') HTM_METH3 ");
|
|
|
//HTM_COND1
|
|
|
strSql.AppendLine(",NVL(QQT.HTM_COND1,' ') HTM_COND1 ");
|
|
|
strSql.AppendLine(",NVL(QQT.HTM_COND2,' ') HTM_COND2 ");
|
|
|
strSql.AppendLine(",NVL(QQT.HTM_COND3,' ') HTM_COND3 ");
|
|
|
strSql.AppendLine(",NVL(QQT.CR_CD_3,' ') CR_CD_3 ");
|
|
|
strSql.AppendLine(",NVL(QQT.CR_MILL_RATET1,'0') CR_MILL_RATET1 ");
|
|
|
strSql.AppendLine(" , '0' as FIRST_FLG ");
|
|
|
//成品成分
|
|
|
strSql.AppendLine(",(CASE WHEN ( SELECT COUNT(*) FROM NISCO.QP_QLTY_CHEM_FP QQCF WHERE QQCF.ORD_NO=BOI.ORD_NO AND QQCF.ORD_ITEM=BOI.ORD_ITEM )>0 THEN '1' ELSE '0' END ) CHEM_FLG ");
|
|
|
|
|
|
|
|
|
//strSql.AppendLine(",QSH.STDSPEC_NAME_ENG ");
|
|
|
strSql.AppendLine(",QSH.STDSPEC_STLGRD");
|
|
|
strSql.AppendLine(",(CASE WHEN ( SELECT COUNT(*) FROM NISCO.BP_ODER_XY BOXY WHERE BOXY.ORDER_NO=BOI.ORD_NO AND BOXY.ORDER_ITEM=BOI.ORD_ITEM )>0 THEN '1' ELSE '0' END ) XY_FLG ");
|
|
|
strSql.AppendLine(",(CASE WHEN instr( DECODE(QQT.MLT_PROC_LINE, '1', QQT.MLT_PROC_CD, QQT.MLT_PROC_CD2),'BH') > 0 THEN '1' ELSE '0' END ) VAC_FLG\r\n");
|
|
|
strSql.AppendLine(",(CASE WHEN(SELECT COUNT(*) FROM NISCO.QP_QLTY_MATR_HA QQMH WHERE QQMH.ORD_NO = BOI.ORD_NO AND QQMH.ORD_ITEM = BOI.ORD_ITEM AND QQMH.TEST_KND IN('8', '9')) > 0 THEN '1' ELSE '0' END ) Z_FLG ");
|
|
|
strSql.AppendLine(",CASE WHEN BOI.CUST_DEL_TO_DATE > TO_CHAR(SYSDATE + 7, 'YYYYMMdd') THEN 0 ELSE 1 END DEL_FLG");
|
|
|
|
|
|
strSql.AppendLine(lack_num);
|
|
|
|
|
|
strSql.AppendLine(", (SELECT COUNT(A.REQ_SEQ_NO) ");
|
|
|
strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B ");
|
|
|
strSql.AppendLine(" WHERE ");
|
|
|
strSql.AppendLine(" 1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
strSql.AppendLine(" AND A.BLOCK_SEQ >= '01' ");
|
|
|
strSql.AppendLine(" AND A.SEQ >= '01' ");
|
|
|
strSql.AppendLine(" And B.REQ_SEQ_NO = A.REQ_SEQ_NO ");
|
|
|
strSql.AppendLine(" AND B.REC_STS = '1') +GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) AS SUB_LACK_NUM ");
|
|
|
strSql.AppendLine(", ( SELECT COUNT(A.REQ_SEQ_NO) ");
|
|
|
strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B ");
|
|
|
strSql.AppendLine(" WHERE ");
|
|
|
strSql.AppendLine(" 1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM ");
|
|
|
strSql.AppendLine(" AND A.BLOCK_SEQ >= '01' ");
|
|
|
strSql.AppendLine(" AND A.SEQ >= '01' ");
|
|
|
strSql.AppendLine(" And B.REQ_SEQ_NO = A.REQ_SEQ_NO ");
|
|
|
strSql.AppendLine(" AND B.REC_STS = '1') +GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) AS LACK_NUM");
|
|
|
//低倍标记 1为有低倍要求
|
|
|
strSql.AppendLine(" , case when (SELECT COUNT(*) FROM NISCO.qp_qlty_slab_lowpower where ord_no=boi.ord_no and ord_item=boi.ord_item)<1 THEN 0 ELSE 1 END FLG_LOWPOWER");
|
|
|
// 高表标记 1是高表
|
|
|
strSql.AppendLine(", CASE WHEN BOI.STD_DET_CLASS_LVL IN('G1','G2') and (SELECT STEEL_GRD_DETAIL FROM NISCO.QP_NISCO_CHMC WHERE STLGRD = BOI.STLGRD) not in ('Q550-QT-1','Q550-QT-2','Q906-1','Q960-2','Q960-3','Q890-1','Q890-2') THEN 1 ELSE 0 END FLG_GB");
|
|
|
|
|
|
strSql.AppendLine("FROM NISCO.cp_prc CPP ");
|
|
|
strSql.AppendLine("INNER JOIN ");
|
|
|
strSql.AppendLine("NISCO.BP_ORDER_ITEM boi ");
|
|
|
strSql.AppendLine("ON BOI.ORD_NO = CPP.ORD_NO ");
|
|
|
strSql.AppendLine("AND BOI.ORD_ITEM = CPP.ORD_ITEM ");
|
|
|
strSql.AppendLine("AND BOI.ORD_WID <> 0 ");
|
|
|
strSql.AppendLine("AND BOI.ORD_LEN <> 0 ");
|
|
|
strSql.AppendLine("AND BOI.ORD_THK <> 0 ");
|
|
|
strSql.AppendLine("LEFT JOIN NISCO.QP_QLTY_TECH QQT ");
|
|
|
strSql.AppendLine("ON BOI.ORD_NO = QQT.ORD_NO ");
|
|
|
strSql.AppendLine("AND BOI.ORD_ITEM = QQT.ORD_ITEM ");
|
|
|
strSql.AppendLine("LEFT JOIN NISCO.QP_QLTY_DELV QQD ");
|
|
|
strSql.AppendLine("ON BOI.ORD_NO = QQD.ORD_NO ");
|
|
|
strSql.AppendLine("AND BOI.ORD_ITEM = QQD.ORD_ITEM ");
|
|
|
|
|
|
strSql.AppendLine("LEFT JOIN NISCO.QP_STD_HEAD QSH ");
|
|
|
strSql.AppendLine(" ON boi.STDSPEC = QSH.STDSPEC ");
|
|
|
strSql.AppendLine(" AND boi.STDSPEC_YY = QSH.STDSPEC_YY ");
|
|
|
strSql.AppendLine("WHERE 1 = 1 ");
|
|
|
strSql.AppendLine(" AND ");
|
|
|
//strSql.AppendLine(" (SELECT COUNT(A.REQ_SEQ_NO) ");
|
|
|
//strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B");
|
|
|
//strSql.AppendLine(" WHERE ");
|
|
|
//strSql.AppendLine(" 1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM");
|
|
|
//strSql.AppendLine(" AND A.BLOCK_SEQ >= '01' ");
|
|
|
//strSql.AppendLine(" AND A.SEQ >= '01' ");
|
|
|
//strSql.AppendLine(" And B.REQ_SEQ_NO = A.REQ_SEQ_NO ");
|
|
|
//strSql.AppendLine(" AND B.REC_STS = '1') + GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) >= 0.95");
|
|
|
//strSql.AppendLine(" AND boi.PROD_CD = 'PP' ");
|
|
|
//strSql.AppendLine("AND boi.REC_STS = '2' ");
|
|
|
//strSql.AppendLine("and boi.ORD_STS IN('E') ");
|
|
|
//strSql.AppendLine(" AND (boi.ord_knd ='A' OR (boi.ord_knd ='T' AND (SELECT COUNT(*) FROM NISCO.BP_ODER_XY BOXY WHERE BOXY.ORDER_NO=BOI.ORD_NO AND BOXY.ORDER_ITEM=BOI.ORD_ITEM )>0)) ");
|
|
|
//strSql.AppendLine("AND boi.CFM_MILL_PLT='C2'");
|
|
|
|
|
|
|
|
|
strSql.AppendLine(boi);
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
gpPlates = db.Query<BP_ORDER_ITEM>(strSql.ToString());
|
|
|
// logger.Info(gpPlates.Count.ToString());
|
|
|
//gpPlates = CommonUtils.DataTableToList<BP_ORDER_ITEM>(a);
|
|
|
// logger.Info("gpPlates :" + a.Rows.Count);
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetOrder 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gpPlates;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据订单号找到对应的订单要求化学成分
|
|
|
/// </summary>
|
|
|
/// <returns>对应的化学成分集合</returns>
|
|
|
/// 方法如果被static修饰, 则在接口中无法被发现(原因不详)
|
|
|
public IList<QP_QLTY_CHEM> GetOrderChemistry()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<QP_QLTY_CHEM> orderChemistrys = new List<QP_QLTY_CHEM>();
|
|
|
|
|
|
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 AND ");
|
|
|
//strSql.AppendLine(" (SELECT COUNT(A.REQ_SEQ_NO) ");
|
|
|
//strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B");
|
|
|
//strSql.AppendLine(" WHERE ");
|
|
|
//strSql.AppendLine(" 1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM");
|
|
|
//strSql.AppendLine(" AND A.BLOCK_SEQ >= '01' ");
|
|
|
//strSql.AppendLine(" AND A.SEQ >= '01' ");
|
|
|
//strSql.AppendLine(" And B.REQ_SEQ_NO = A.REQ_SEQ_NO ");
|
|
|
//strSql.AppendLine(" AND B.REC_STS = '1') + GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) >= 0.95");
|
|
|
//strSql.AppendLine("AND boi.PROD_CD = 'PP'");
|
|
|
//strSql.AppendLine("AND boi.REC_STS = '2' ");
|
|
|
//strSql.AppendLine("and boi.ORD_STS IN('E', 'D') ");
|
|
|
//strSql.AppendLine(" AND (boi.ord_knd ='A' OR (boi.ord_knd ='T' AND (SELECT COUNT(*) FROM NISCO.BP_ODER_XY BOXY WHERE BOXY.ORDER_NO=BOI.ORD_NO AND BOXY.ORDER_ITEM=BOI.ORD_ITEM )>0)) ");
|
|
|
//strSql.AppendLine("AND boi.CFM_MILL_PLT='C2'");
|
|
|
strSql.AppendLine(boi);
|
|
|
|
|
|
strSql.AppendLine(") ");
|
|
|
strSql.AppendLine(" AND QQC.KND IN ('1','2') ) T WHERE T.rk = 1 ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
orderChemistrys = db.Query<QP_QLTY_CHEM>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetSurplusMaterial 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return orderChemistrys;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取订单生产规范设计结果主表的信息
|
|
|
/// </summary>
|
|
|
/// <param name="strWHereOrd">订单的条件</param>
|
|
|
/// <returns></returns>
|
|
|
public IList<QP_QLTY_TECH> GetQP_QLTY_TECH(string strWHereOrd)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<QP_QLTY_TECH> ltQP_QLTY_TECH = new List<QP_QLTY_TECH>();
|
|
|
|
|
|
|
|
|
strSql.AppendLine("SELECT T.*FROM(");
|
|
|
strSql.AppendLine(" SELECT QQT.ORD_NO, QQT.ORD_ITEM , DECODE(QQT.MLT_PROC_LINE, '1', QQT.MLT_PROC_CD, QQT.MLT_PROC_CD2) MLT_PROC_CD,rank() over(partition by QQT.ord_no, QQT.ord_item order by knd desc) rk from NISCO.QP_QLTY_TECH QQT where(QQT.ORD_NO, QQT.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 AND ");
|
|
|
//strSql.AppendLine(" (SELECT COUNT(A.REQ_SEQ_NO) ");
|
|
|
//strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B");
|
|
|
//strSql.AppendLine(" WHERE ");
|
|
|
//strSql.AppendLine(" 1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM");
|
|
|
//strSql.AppendLine(" AND A.BLOCK_SEQ >= '01' ");
|
|
|
//strSql.AppendLine(" AND A.SEQ >= '01' ");
|
|
|
//strSql.AppendLine(" And B.REQ_SEQ_NO = A.REQ_SEQ_NO ");
|
|
|
//strSql.AppendLine(" AND B.REC_STS = '1') + GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) >= 0.95");
|
|
|
//strSql.AppendLine("AND boi.PROD_CD = 'PP'");
|
|
|
//strSql.AppendLine("AND boi.REC_STS = '2' ");
|
|
|
//strSql.AppendLine("and boi.ORD_STS IN('E', 'D') ");
|
|
|
//strSql.AppendLine(" AND (boi.ord_knd ='A' OR (boi.ord_knd ='T' AND (SELECT COUNT(*) FROM NISCO.BP_ODER_XY BOXY WHERE BOXY.ORDER_NO=BOI.ORD_NO AND BOXY.ORDER_ITEM=BOI.ORD_ITEM )>0)) ");
|
|
|
strSql.AppendLine(boi);
|
|
|
strSql.AppendLine(strWHereOrd);
|
|
|
strSql.AppendLine(") ");
|
|
|
strSql.AppendLine(") T WHERE T.rk = 1 ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltQP_QLTY_TECH = db.Query<QP_QLTY_TECH>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetQP_QLTY_TECH 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltQP_QLTY_TECH;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取订单生产规范设计结果主表的信息
|
|
|
/// </summary>
|
|
|
/// <param name="strWHereOrd">订单的条件</param>
|
|
|
/// <returns></returns>
|
|
|
public IList<EP_STD_CROP_LEN> GetEP_STD_CROP_LEN()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<EP_STD_CROP_LEN> ltEP_STD_CROP_LEN = new List<EP_STD_CROP_LEN>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.EP_STD_CROP_LEN");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltEP_STD_CROP_LEN = db.Query<EP_STD_CROP_LEN>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetEP_STD_CROP_LEN 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltEP_STD_CROP_LEN;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取订单生产规范设计结果主表的信息
|
|
|
/// </summary>
|
|
|
/// <param name="strWHereOrd">订单的条件</param>
|
|
|
/// <returns></returns>
|
|
|
public IList<EP_STD_CROP_LEN> GetEP_STD_CROP_LEN_TEST()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<EP_STD_CROP_LEN> ltEP_STD_CROP_LEN = new List<EP_STD_CROP_LEN>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.EP_STD_CROP_LEN_TEST");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltEP_STD_CROP_LEN = db.Query<EP_STD_CROP_LEN>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetEP_STD_CROP_LEN 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltEP_STD_CROP_LEN;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 轧件长度余量标准
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<EP_PLATELEN_M> GetEP_PLATELEN_M()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<EP_PLATELEN_M> ltEP_PLATELEN_M = new List<EP_PLATELEN_M>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.EP_PLATELEN_M");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltEP_PLATELEN_M = db.Query<EP_PLATELEN_M>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetEP_PLATELEN_M 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltEP_PLATELEN_M;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 宽厚上下限
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<EP_PLATEWID_STD> GetEP_PLATEWID_STD()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<EP_PLATEWID_STD> ltEP_PLATEWID_STD = new List<EP_PLATEWID_STD>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.EP_PLATEWID_STD");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltEP_PLATEWID_STD = db.Query<EP_PLATEWID_STD>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetEP_PLATEWID_STD 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltEP_PLATEWID_STD;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 宽厚上下限
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<QP_STD_HEAD> GetQP_STD_HEAD()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<QP_STD_HEAD> ltQP_STD_HEAD = new List<QP_STD_HEAD>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.QP_STD_HEAD");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltQP_STD_HEAD = db.Query<QP_STD_HEAD>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetQP_STD_HEAD 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltQP_STD_HEAD;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<QP_PROD_RATIO> GetQP_PROD_RATIO()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<QP_PROD_RATIO> ltQP_PROD_RATIO = new List<QP_PROD_RATIO>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.QP_PROD_RATIO");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltQP_PROD_RATIO = db.Query<QP_PROD_RATIO>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetQP_PROD_RATIO 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltQP_PROD_RATIO;
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 板坯设计标准
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<EP_SLABDESIGN> GetEP_SLABDESIGN()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<EP_SLABDESIGN> ltEP_SLABDESIGN = new List<EP_SLABDESIGN>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.EP_SLABDESIGN");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltEP_SLABDESIGN = db.Query<EP_SLABDESIGN>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetEP_SLABDESIGN 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltEP_SLABDESIGN;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取轧件长度限制标准信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<EP_ASROLL_LEN_STD> getEP_ASROLL_LEN_STD()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<EP_ASROLL_LEN_STD> ltEP_ASROLL_LEN_STD = new List<EP_ASROLL_LEN_STD>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.EP_ASROLL_LEN_STD");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltEP_ASROLL_LEN_STD = db.Query<EP_ASROLL_LEN_STD>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetEP_ASROLL_LEN_STD 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltEP_ASROLL_LEN_STD;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取钢种组信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<EP_GRD_GROUP> getEP_GRD_GROUP()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<EP_GRD_GROUP> ltEP_GRD_GROUP = new List<EP_GRD_GROUP>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.EP_GRD_GROUP");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltEP_GRD_GROUP = db.Query<EP_GRD_GROUP>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetEP_GRD_GROUP 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltEP_GRD_GROUP;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 厚度附加值标准数据表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<GP_THK_ADD> getGP_THK_ADD()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<GP_THK_ADD> ltGP_THK_ADD = new List<GP_THK_ADD>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.GP_THK_ADD");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltGP_THK_ADD = db.Query<GP_THK_ADD>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("getGP_THK_ADD 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltGP_THK_ADD;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取加热炉信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<EP_FUR_SIZE_STD> getEP_FUR_SIZE_STD()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<EP_FUR_SIZE_STD> ltEP_FUR_SIZE_STD = new List<EP_FUR_SIZE_STD>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.EP_FUR_SIZE_STD");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltEP_FUR_SIZE_STD = db.Query<EP_FUR_SIZE_STD>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetEP_FUR_SIZE_STD 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltEP_FUR_SIZE_STD;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取板坯设计信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<FP_SLAB_DES> getFP_SLAB_DES()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<FP_SLAB_DES> ltFP_SLAB_DES = new List<FP_SLAB_DES>();
|
|
|
|
|
|
strSql.AppendLine("SELECT fsd_1.*,'C2' PLT,'' ID ,'' HAN_RSL ,'' HAN_CON, '' HAN_DATE" +
|
|
|
",'' THK_RATIO" +
|
|
|
",'' WID_RATIO" +
|
|
|
",'' HEAD_LEN" +
|
|
|
",'' TAIL_LEN" +
|
|
|
",'' WID_MRGIN" +
|
|
|
",'' SAMP_LEN" +
|
|
|
",'' CUT_LOSS" +
|
|
|
",'' ORG_LEN" +
|
|
|
",'' ORG_WGT" +
|
|
|
",'' ORG_THK" +
|
|
|
",'' ORG_WID" +
|
|
|
",'' REM_LEN" +
|
|
|
",'' REM_WGT" +
|
|
|
",'' REQ_SEQ_NO" +
|
|
|
",'' SUB_KIND" +
|
|
|
" FROM NISCO.FP_SLAB_DES FSD_1 ");
|
|
|
strSql.AppendLine("LEFT JOIN NISCO.FP_SLAB fs ");
|
|
|
strSql.AppendLine("ON fs.SLAB_NO = fsd_1.SLAB_NO ");
|
|
|
strSql.AppendLine("WHERE FSD_1.SLAB_NO IN( select slab_no from nisco.fp_slab where 1=1 ");
|
|
|
//strSql.AppendLine("SELECT fsd.SLAB_NO FROM NISCO.FP_SLAB_DES fsd WHERE fsd.SLAB_NO IN ( ");
|
|
|
strSql.AppendLine(slab);
|
|
|
//strSql.AppendLine(" SELECT A.SLAB_NO ");
|
|
|
//strSql.AppendLine(" FROM NISCO.FP_SLAB A ");
|
|
|
//strSql.AppendLine("WHERE 1 = 1 ");
|
|
|
//strSql.AppendLine(" AND A.CUR_INV IN ( 'ZB','00','ZZ','HB','C7') ");
|
|
|
//strSql.AppendLine(" AND(A.PROC_CD = 'CAC' OR ");
|
|
|
//strSql.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.REASON_CD NOT IN('1080','2014','2015','2018','2026','3014','5011','5013','8081') AND EST_CD IS NULL) < 1)");
|
|
|
//strSql.AppendLine(" AND A.PROC_CD='CAD' ) ");
|
|
|
//strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0002','0003','2010')) < 1 )");
|
|
|
//strSql.AppendLine(" AND A.ORD_FL = '2' ");
|
|
|
//strSql.AppendLine(" AND A.REC_STS = '2' ");
|
|
|
//strSql.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
//strSql.AppendLine(" AND A.WGT > 0 ");
|
|
|
//strSql.AppendLine(" AND NVL(A.PLAN_SLAB_CUT_FL,'N') = 'N' ");
|
|
|
//strSql.AppendLine(" AND SUBSTR(A.SLAB_NO,3,1) <> 'F' ");
|
|
|
//strSql.AppendLine(" AND NVL(A.QUALITY_UPD_GRD, 'N') NOT IN('N','E') ");
|
|
|
//strSql.AppendLine(" AND NVL(A.PLAN_MILL_PLT , ' ') LIKE 'C2' || '%' ");
|
|
|
//strSql.AppendLine(" AND NVL(A.PLAN_SLAB_MERGE_FL,'N') = 'N' ) ");
|
|
|
//strSql.AppendLine(" AND PROC_CD = 'CAC' ");
|
|
|
//strSql.AppendLine(" GROUP BY fsd.SLAB_NO ");
|
|
|
//strSql.AppendLine(" HAVING(COUNT(fsd.SLAB_NO) > 3) ");
|
|
|
strSql.AppendLine(" ) ");
|
|
|
//strSql.AppendLine(" AND fsd_1.ORD_CNT > 0 ");
|
|
|
/// strSql.AppendLine(" ORDER BY fsd_1.SLAB_NO DESC, fsd_1.BLOCK_SEQ,fsd_1.seq ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltFP_SLAB_DES = db.Query<FP_SLAB_DES>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetFP_SLAB_DES 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltFP_SLAB_DES;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 替代厚度限制
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<SUBS_THICK_LIMIT> getSUBS_THICK_LIMIT()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<SUBS_THICK_LIMIT> ltSUBS_THICK_LIMIT = new List<SUBS_THICK_LIMIT>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM SUBS_THICK_LIMIT");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
ltSUBS_THICK_LIMIT = db.Query<SUBS_THICK_LIMIT>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetSUBS_THICK_LIMIT 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltSUBS_THICK_LIMIT;
|
|
|
}
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 钢种说明
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<QP_NISCO_CHMC> getQP_NISCO_CHMC()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<QP_NISCO_CHMC> ltQP_NISCO_CHMC = new List<QP_NISCO_CHMC>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.QP_NISCO_CHMC");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltQP_NISCO_CHMC = db.Query<QP_NISCO_CHMC>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetQP_NISCO_CHMC 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltQP_NISCO_CHMC;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 一坯多钢种信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<CP_NISCO_CHMC_SL> getCP_NISCO_CHMC_SL()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<CP_NISCO_CHMC_SL> ltCP_NISCO_CHMC_SL = new List<CP_NISCO_CHMC_SL>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.CP_NISCO_CHMC_SL");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltCP_NISCO_CHMC_SL = db.Query<CP_NISCO_CHMC_SL>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetCP_NISCO_CHMC_SL 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltCP_NISCO_CHMC_SL;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取配置信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<TB_SLAB_CONF> getTB_SLAB_CONF()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<TB_SLAB_CONF> ltTB_SLAB_CONF = new List<TB_SLAB_CONF>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM TB_SLAB_CONF");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
ltTB_SLAB_CONF = db.Query<TB_SLAB_CONF>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetTB_SLAB_CONF 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltTB_SLAB_CONF;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 异钢种替代工艺
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<QP_QLTY_TECH_REPLACE> getQP_QLTY_TECH_REPLACE()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<QP_QLTY_TECH_REPLACE> ltQP_QLTY_TECH_REPLACE = new List<QP_QLTY_TECH_REPLACE>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.QP_QLTY_TECH_REPLACE");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltQP_QLTY_TECH_REPLACE = db.Query<QP_QLTY_TECH_REPLACE>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetQP_QLTY_TECH_REPLACE 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltQP_QLTY_TECH_REPLACE;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 炼钢缓冲区主表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<EP_REQ_SLAB> getEP_REQ_SLAB()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<EP_REQ_SLAB> ltEP_REQ_SLAB = new List<EP_REQ_SLAB>();
|
|
|
|
|
|
strSql.AppendLine("SELECT round(to_number(slab_wgt))*10000+rownum ROW_NUM,rownum,T.*FROM( ");
|
|
|
strSql.AppendLine("SELECT ERS.* FROM NISCO.EP_REQ_SLAB ERS ");
|
|
|
strSql.AppendLine("WHERE ERS.REC_STS = '1' AND ERS.REQ_PLT = 'C2' ");
|
|
|
strSql.AppendLine("AND (select count(*) from NISCO.EP_REQ_SLAB_D ERSD where ERSD.REQ_SEQ_NO=ERS.REQ_SEQ_NO)>=3 ");
|
|
|
strSql.AppendLine("ORDER BY ERS.SLAB_LEN) T ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltEP_REQ_SLAB = db.Query<EP_REQ_SLAB>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetEP_REQ_SLAB 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltEP_REQ_SLAB;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 炼钢缓冲区 详细设计表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<EP_REQ_SLAB_D> getEP_REQ_SLAB_D()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<EP_REQ_SLAB_D> ltEP_REQ_SLAB_D = new List<EP_REQ_SLAB_D>();
|
|
|
|
|
|
//strSql.AppendLine("SELECT * FROM NISCO.EP_REQ_SLAB_D");
|
|
|
strSql.AppendLine("SELECT ERSD.* ,'' USE_FLG FROM NISCO.EP_REQ_SLAB_D ERSD WHERE ERSD.REQ_SEQ_NO IN(");
|
|
|
strSql.AppendLine("SELECT ERS.REQ_SEQ_NO FROM NISCO.EP_REQ_SLAB ERS");
|
|
|
strSql.AppendLine("WHERE ERS.REC_STS = '1' AND ERS.REQ_PLT = 'C2'");
|
|
|
strSql.AppendLine("AND (select count(*) from NISCO.EP_REQ_SLAB_D ERSD where ERSD.REQ_SEQ_NO=ERS.REQ_SEQ_NO)>=3) ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltEP_REQ_SLAB_D = db.Query<EP_REQ_SLAB_D>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetEP_REQ_SLAB_D 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltEP_REQ_SLAB_D;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 根据钢板板坯号找到对应炉号,根据炉号找到对应化学成分
|
|
|
/// </summary>
|
|
|
/// <returns>对应的化学成分集合</returns>
|
|
|
public IList<QP_CHEM_RSLT> GetChemistry()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
IList<QP_CHEM_RSLT> chemistrys = new List<QP_CHEM_RSLT>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.QP_CHEM_RSLT WHERE HEAT_NO IN ( ");
|
|
|
strSql.AppendLine("SELECT ");
|
|
|
strSql.AppendLine("A.HEAT_NO ");
|
|
|
strSql.AppendLine("FROM NISCO.FP_SLAB A ");
|
|
|
strSql.AppendLine("WHERE 1 = 1 ");
|
|
|
strSql.AppendLine(slab);
|
|
|
//strSql.AppendLine(" AND A.CUR_INV IN ( 'ZB','00','ZZ','HB','C7') ");
|
|
|
//strSql.AppendLine(" AND(A.PROC_CD = 'CAC' OR ");
|
|
|
//strSql.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.REASON_CD NOT IN('1080','2014','2015','2018','2026','3014','5011','5013','8081') AND EST_CD IS NULL) < 1)");
|
|
|
//strSql.AppendLine(" AND A.PROC_CD='CAD' ) ");
|
|
|
//strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0002','0003','2010')) < 1 )");
|
|
|
//strSql.AppendLine(" AND A.ORD_FL = '2' ");
|
|
|
//strSql.AppendLine(" AND A.REC_STS = '2' ");
|
|
|
//strSql.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
//strSql.AppendLine(" AND A.WGT > 0 ");
|
|
|
//strSql.AppendLine(" AND NVL(A.PLAN_SLAB_CUT_FL,'N') = 'N' ");
|
|
|
//strSql.AppendLine(" AND SUBSTR(A.SLAB_NO,3,1) <> 'F' ");
|
|
|
//strSql.AppendLine(" AND NVL(A.QUALITY_UPD_GRD, 'N') NOT IN('N','E') ");
|
|
|
//strSql.AppendLine(" AND NVL(A.PLAN_MILL_PLT , ' ') LIKE 'C2' || '%' ");
|
|
|
//strSql.AppendLine(" AND NVL(A.PLAN_SLAB_MERGE_FL,'N') = 'N' ");
|
|
|
|
|
|
strSql.AppendLine(") ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
chemistrys = db.Query<QP_CHEM_RSLT>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetChemistry 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return chemistrys;
|
|
|
}
|
|
|
|
|
|
/// 删除数据
|
|
|
/// </summary>
|
|
|
/// <param name="ltFSD"></param>
|
|
|
public static void DeleteSlab(string DeleteSlab)
|
|
|
{
|
|
|
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//因为是同时操作两个表, 所以开启事务
|
|
|
db.BeginTransaction();
|
|
|
|
|
|
db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C2' AND slab_no='" + DeleteSlab + "'");
|
|
|
//挂回原订单数据删除
|
|
|
//db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C3' AND HAN_RSL IS NULL AND SUB_KIND='1'");
|
|
|
|
|
|
db.Commit();
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
//数据如果发生错误则回滚
|
|
|
db.Rollback();
|
|
|
logger.ErrorFormat("删除错误!信息:{0}", ex.ToString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取炼钢板坯设计信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<YIElD_CONTROL> getYIElD_CONTROL()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<YIElD_CONTROL> ltYIElD_CONTROL = new List<YIElD_CONTROL>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * from nisco.Yield_control");
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltYIElD_CONTROL = db.Query<YIElD_CONTROL>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("getYIElD_CONTROL 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltYIElD_CONTROL;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取炼钢板坯设计信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<FP_SLAB_DES> getEP_SLAB_DES()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<FP_SLAB_DES> ltFP_SLAB_DES = new List<FP_SLAB_DES>();
|
|
|
|
|
|
strSql.AppendLine("SELECT " + "fsd_1.ACT_SLAB_NO SLAB_NO," +
|
|
|
"fsd_1.*,'C2' PLT,'' ID ,'' HAN_RSL ,'' HAN_CON, '' HAN_DATE" +
|
|
|
",'' THK_RATIO" +
|
|
|
",'' WID_RATIO" +
|
|
|
",'' HEAD_LEN" +
|
|
|
",'' TAIL_LEN" +
|
|
|
",'' WID_MRGIN" +
|
|
|
",'' SAMP_LEN" +
|
|
|
",'' CUT_LOSS" +
|
|
|
",'' ORG_LEN" +
|
|
|
",'' ORG_WGT" +
|
|
|
",'' ORG_THK" +
|
|
|
",'' ORG_WID" +
|
|
|
",'' REM_LEN" +
|
|
|
",'' REM_WGT" +
|
|
|
",'' REQ_SEQ_NO" +
|
|
|
",'' SUB_KIND" +
|
|
|
",'' POSITION_TYPE" +
|
|
|
",'' POSITION_X" +
|
|
|
",'' POSITION_Y" +
|
|
|
",'' FL" +
|
|
|
" FROM NISCO.EP_SLAB_DES FSD_1 ");
|
|
|
strSql.AppendLine("LEFT JOIN NISCO.FP_SLAB fs ");
|
|
|
strSql.AppendLine("ON fs.SLAB_NO = fsd_1.ACT_SLAB_NO ");
|
|
|
strSql.AppendLine("WHERE FSD_1.ACT_SLAB_NO IN( ");
|
|
|
strSql.AppendLine("SELECT fsd.ACT_SLAB_NO FROM NISCO.EP_SLAB_DES fsd WHERE fsd.ACT_SLAB_NO IN ( ");
|
|
|
|
|
|
strSql.AppendLine(" SELECT A.SLAB_NO ");
|
|
|
strSql.AppendLine(" FROM NISCO.FP_SLAB A ");
|
|
|
strSql.AppendLine("WHERE 1 = 1 ");
|
|
|
strSql.AppendLine(" AND A.CUR_INV in ( 'ZB','00','ZZ','HB','C7') ");
|
|
|
strSql.AppendLine(" AND(A.PROC_CD = 'CAC' OR ");
|
|
|
strSql.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.REASON_CD NOT IN('1080','2014','2015','2018','2026','3014','5011','5013','8081') AND EST_CD IS NULL) < 1)");
|
|
|
strSql.AppendLine(" AND A.PROC_CD='CAD' ) ");
|
|
|
strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0002','0003','2010')) < 1 )");
|
|
|
strSql.AppendLine(" AND A.ORD_FL = '2' ");
|
|
|
strSql.AppendLine(" AND A.REC_STS = '2' ");
|
|
|
strSql.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
strSql.AppendLine(" AND A.WGT > 0 ");
|
|
|
strSql.AppendLine(" AND NVL(A.PLAN_SLAB_CUT_FL,'N') = 'N' ");
|
|
|
strSql.AppendLine(" AND NVL(A.QUALITY_UPD_GRD, 'N') NOT IN('N','E') ");
|
|
|
strSql.AppendLine(" AND LEAST(A.WID, A.LEN) >= 1600 ");
|
|
|
strSql.AppendLine(" AND GREATEST(A.WID, A.LEN) >= 2500 ");
|
|
|
strSql.AppendLine(" AND A.THK >= 120 ");
|
|
|
strSql.AppendLine(" AND NVL(A.PLAN_SLAB_MERGE_FL,'N') = 'N' ");
|
|
|
strSql.AppendLine(" AND NVL(A.PLAN_MILL_PLT,'N') LIKE 'C2' || '%' ) ");
|
|
|
|
|
|
strSql.AppendLine(" GROUP BY fsd.ACT_SLAB_NO ");
|
|
|
strSql.AppendLine(" HAVING(COUNT(fsd.ACT_SLAB_NO) > 3) ");
|
|
|
strSql.AppendLine(" ) ");
|
|
|
strSql.AppendLine(" ORDER BY fsd_1.SLAB_NO DESC, fsd_1.BLOCK_SEQ,fsd_1.seq ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltFP_SLAB_DES = db.Query<FP_SLAB_DES>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetFP_SLAB_DES 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltFP_SLAB_DES;
|
|
|
}
|
|
|
|
|
|
public IList<GP_THK_ADD> GetGPTHKADD()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<GP_THK_ADD> gGPTHKADD = null;
|
|
|
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.GP_THK_ADD");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
gGPTHKADD = db.Query<GP_THK_ADD>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetGPTHKADD 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gGPTHKADD;
|
|
|
}
|
|
|
|
|
|
public static string GetSlabNo(FP_SLAB_DES FSD)
|
|
|
{
|
|
|
string strSlabNo = string.Empty;
|
|
|
DataTable dtReturn = new DataTable();
|
|
|
StringBuilder strSql = new StringBuilder();
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
|
|
|
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}' ", FSD.ORD_NO);
|
|
|
strSql.AppendFormat(" AND A.ORD_ITEM = '{0}' ", FSD.ORD_ITEM);
|
|
|
|
|
|
dtReturn = db.Query(strSql.ToString());
|
|
|
|
|
|
if (dtReturn.Rows.Count > 0)
|
|
|
{
|
|
|
strSlabNo = dtReturn.Rows[0]["REQ_SEQ_NO"].ToString();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
return strSlabNo;
|
|
|
}
|
|
|
|
|
|
//角轧轧制厚度限制
|
|
|
public IList<ANGLE_WID_LIMIT> GetAngleWidLimit()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<ANGLE_WID_LIMIT> gGPTHKADD = null;
|
|
|
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT * FROM ANGLE_WID_LIMIT");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
gGPTHKADD = db.Query<ANGLE_WID_LIMIT>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetAngleWidLimit 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gGPTHKADD;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取处置措施信息
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<FP_CAD_INF> GetFP_CAD_INF()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
IList<FP_CAD_INF> ltFP_CAD_INF = new List<FP_CAD_INF>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.FP_CAD_INF WHERE substr(SLAB_NO,1,8) IN ( ");
|
|
|
strSql.AppendLine("SELECT ");
|
|
|
strSql.AppendLine("substr(A.SLAB_NO ,1,8 ) ");
|
|
|
strSql.AppendLine("FROM NISCO.FP_SLAB A ");
|
|
|
strSql.AppendLine("WHERE 1 = 1 ");
|
|
|
//测试数据
|
|
|
//strSql.AppendLine(" AND SLAB_NO in ('2310142001') ");
|
|
|
|
|
|
strSql.AppendLine(slab);
|
|
|
|
|
|
//strSql.AppendLine(" AND A.CUR_INV in ( 'ZB','00','ZZ','HB','C7') ");
|
|
|
//strSql.AppendLine(" AND(A.PROC_CD = 'CAC' OR ");
|
|
|
//strSql.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.REASON_CD NOT IN('1080','2014','2015','2018','2026','3014','5011','5013','8081') AND EST_CD IS NULL) < 1)");
|
|
|
//strSql.AppendLine(" AND A.PROC_CD='CAD' ) ");
|
|
|
//strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0002','0003','2010')) < 1 )");
|
|
|
//strSql.AppendLine(" AND A.ORD_FL = '2' ");
|
|
|
//strSql.AppendLine(" AND A.REC_STS = '2' ");
|
|
|
//strSql.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
//strSql.AppendLine(" AND A.WGT > 0 ");
|
|
|
//strSql.AppendLine(" AND NVL(A.PLAN_SLAB_CUT_FL,'N') = 'N' ");
|
|
|
//strSql.AppendLine(" AND NVL(A.QUALITY_UPD_GRD, 'N') NOT IN('N','E') ");
|
|
|
//strSql.AppendLine(" AND LEAST(A.WID, A.LEN) >= 1600 ");
|
|
|
//strSql.AppendLine(" AND GREATEST(A.WID, A.LEN) >= 2500 ");
|
|
|
//strSql.AppendLine(" AND A.THK >= 120 ");
|
|
|
//strSql.AppendLine(" AND NVL(A.PLAN_SLAB_MERGE_FL,'N') = 'N' ");
|
|
|
//strSql.AppendLine(" AND NVL(A.PLAN_MILL_PLT,'N') LIKE 'C2' || '%' ");
|
|
|
|
|
|
//// 2.2.4.4.4.3.5.人工锁定的板坯,不允许替代
|
|
|
//strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO) < 1 )");
|
|
|
|
|
|
strSql.AppendLine(") ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltFP_CAD_INF = db.Query<FP_CAD_INF>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetFP_CAD_INF 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltFP_CAD_INF;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 预留
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<FB_SLAB_001> GetFB_SLAB_001()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<FB_SLAB_001> gLFB_SLAB_001 = null;
|
|
|
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.FB_SLAB_001");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
gLFB_SLAB_001 = db.Query<FB_SLAB_001>(strSql.ToString());
|
|
|
gLFB_SLAB_001= new List<FB_SLAB_001>();
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetFB_SLAB_001 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gLFB_SLAB_001;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 455 454 453 炉内加长板数量
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<AddPlateCount> GetAddPlateCount()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<AddPlateCount> gGPTHKADD = null;
|
|
|
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine(@"select substr(plate_no,1,8) HEAT_NO,thk ,aply_stdspec
|
|
|
,count(case when mod(to_number(ord_item),2)=0 then 1 else null end ) COUNT
|
|
|
from nisco.GP_PLATE where prod_cd='PP'
|
|
|
and substr(plate_no,1,8) in
|
|
|
(
|
|
|
'23204718'
|
|
|
)
|
|
|
and aply_stdspec like 'JX/NG_2362_45%'
|
|
|
group by substr(plate_no,1,8) ,thk ,aply_stdspec");
|
|
|
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
gGPTHKADD = db.Query<AddPlateCount>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("AddPlateCount 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gGPTHKADD;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 镍系钢种 修磨表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<TB_APPOINT_ORDER> GetTB_APPOINT_ORDER()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<TB_APPOINT_ORDER> gLTB_APPOINT_ORDER = null;
|
|
|
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT * FROM TB_APPOINT_ORDER");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
gLTB_APPOINT_ORDER = db.Query<TB_APPOINT_ORDER>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("gLTB_APPOINT_ORDER 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gLTB_APPOINT_ORDER;
|
|
|
}
|
|
|
|
|
|
|
|
|
public IList<TB_STLGRD_CHMC> GetTB_STLGRD_CHMC()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<TB_STLGRD_CHMC> gLTB_STLGRD_CHMC = null;
|
|
|
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT * FROM tb_stlgrd_chmc WHERE plt='C2'");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
gLTB_STLGRD_CHMC = db.Query<TB_STLGRD_CHMC>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("gLTB_APPOINT_ORDER 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gLTB_STLGRD_CHMC;
|
|
|
}
|
|
|
|
|
|
public TB_CNF_C2 getTB_CNF_C2()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<TB_CNF_C2> gLTB_CNF_C2 = null;
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT * FROM TB_CNF_C2 ");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
gLTB_CNF_C2 = db.Query<TB_CNF_C2>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("gLTB_CNF_C2 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gLTB_CNF_C2.FirstOrDefault();
|
|
|
}
|
|
|
|
|
|
|
|
|
public IList<TB_YIELD_CONTROL> getTB_YIELD_CONTROL()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<TB_YIELD_CONTROL> gLTB_YIELD_CONTROL = null;
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT * FROM TB_YIELD_CONTROL ");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
gLTB_YIELD_CONTROL = db.Query<TB_YIELD_CONTROL>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("getTB_YIELD_CONTROL 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gLTB_YIELD_CONTROL;
|
|
|
}
|
|
|
public IList<FP_SLAB_ADD> getFP_SLAB_ADD()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<FP_SLAB_ADD> gLFP_SLAB_ADD = null;
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT * FROM Nisco.FP_SLAB_ADD where slab_type in ('CZC1''CZC2','CZC3') ");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
gLFP_SLAB_ADD = db.Query<FP_SLAB_ADD>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("getFP_SLAB_ADD 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gLFP_SLAB_ADD;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 在途的仓库
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<CP_MOVE_SLT> GetCPMOVESLT(string strWHere)
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
|
|
|
IList<CP_MOVE_SLT> ltCP_MOVE_SLT = new List<CP_MOVE_SLT>();
|
|
|
|
|
|
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 A.SLAB_NO ");
|
|
|
|
|
|
strSql.AppendLine("FROM NISCO.FP_SLAB A ");
|
|
|
strSql.AppendLine("WHERE 1 = 1 ");
|
|
|
|
|
|
strSql.AppendLine(" AND(A.PROC_CD = 'CAC' OR ");
|
|
|
strSql.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.REASON_CD NOT IN('2015','5019','1080','2018','2025','2024') AND EST_CD IS NULL) < 1)");
|
|
|
strSql.AppendLine(" AND A.PROC_CD='CAD' ) ");
|
|
|
strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0002','0003','2010')) < 1 )");
|
|
|
|
|
|
|
|
|
strSql.AppendLine(" AND A.PROC_CD = 'CAC' ");
|
|
|
strSql.AppendLine(" AND A.ORD_FL = '2' ");
|
|
|
strSql.AppendLine(" AND A.REC_STS = '2' ");
|
|
|
strSql.AppendLine(" AND NVL(A.OUT_PLT_CD,'9') <> '0' ");
|
|
|
strSql.AppendLine(" AND A.WGT > 0 ");
|
|
|
strSql.AppendLine(" AND NVL(A.PLAN_SLAB_CUT_FL,'N') = 'N' ");
|
|
|
strSql.AppendLine(" AND NVL(A.QUALITY_UPD_GRD, 'N') NOT IN('N','E') ");
|
|
|
strSql.AppendLine(" AND LEAST(A.WID, A.LEN) >= 1600 ");
|
|
|
strSql.AppendLine(" AND GREATEST(A.WID, A.LEN) >= 2500 ");
|
|
|
strSql.AppendLine(" AND A.THK >= 120 ");
|
|
|
strSql.AppendLine(" AND NVL(A.PLAN_SLAB_MERGE_FL,'N') = 'N' ");
|
|
|
strSql.AppendLine(" AND ( (NVL(A.PLAN_MILL_PLT,'N') LIKE 'C2' || '%') OR ((NVL(A.PLAN_MILL_PLT,'N') LIKE 'C1'|| '%') AND (A.CUR_INV ='HB' OR A.THK>230) ) or (select COUNT(*) from nisco.fp_slab_C2 WHERE SLAB_NO=A.SLAB_NO AND FL='1')>0 ) ");
|
|
|
//strSql.AppendLine(" AND NOT (A.THK>=200 AND THK<=320 AND A.WGT <12 ) ");
|
|
|
strSql.AppendLine(" AND NOT (A.THK>=360 AND A.LEN <2500 ) ");
|
|
|
strSql.AppendLine(" AND NOT (A.THK<160 AND A.LEN >12000 ) ");
|
|
|
strSql.AppendLine(" AND (select COUNT(*) from nisco.fp_slab_C3 WHERE SLAB_NO=A.SLAB_NO AND FL='True')<1");
|
|
|
strSql.AppendLine(" AND not ( (substr(A.LOC,1,7) in ('S7I1701','S7I1702','S7I1703','S7I1801','S7I1802','S7I1803') or substr(A.LOC,1,5) in ('S3E04','S3E05','S3E06') ) and CUR_INV='00') ");
|
|
|
//P_SLAB_DELI_DET表中字段EST_CD是5或者6开头是协议板。
|
|
|
//strSql.AppendLine(" ORDER BY A.LOC DESC, A.SLAB_NO ASC ");
|
|
|
|
|
|
//strSql.AppendLine(strWHerePlate);
|
|
|
strSql.AppendLine(") ");
|
|
|
strSql.AppendLine(" ) WHERE rk = 1 ");
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltCP_MOVE_SLT = db.Query<CP_MOVE_SLT>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetCPMOVESLT 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltCP_MOVE_SLT;
|
|
|
}
|
|
|
//不可替代订单
|
|
|
public IList<TB_SLAB_ORD_SPE> getTB_SLAB_ORD_SPE()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<TB_SLAB_ORD_SPE> gLTB_SLAB_ORD_SPE = null;
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT ORD_NO,ORD_ITEM FROM TB_SLAB_ORD_SPE ");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
gLTB_SLAB_ORD_SPE = db.Query<TB_SLAB_ORD_SPE>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("getFP_SLAB_ADD 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gLTB_SLAB_ORD_SPE;
|
|
|
}
|
|
|
|
|
|
//台式炉不可替代钢种
|
|
|
public IList<TB_BTF_STLGRD> getTB_BTF_STLGRD()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<TB_BTF_STLGRD> gLTB_BTF_STLGRD = null;
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT * FROM TB_BTF_STLGRD ");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
gLTB_BTF_STLGRD = db.Query<TB_BTF_STLGRD>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("getTB_BTF_STLGRD 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gLTB_BTF_STLGRD;
|
|
|
}
|
|
|
|
|
|
//只允许一型设计
|
|
|
public IList<TB_ONLY_TYPE> getTB_ONLY_TYPE()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<TB_ONLY_TYPE> gLTB_ONLY_TYPE = null;
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT * FROM TB_ONLY_TYPE ");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
gLTB_ONLY_TYPE = db.Query<TB_ONLY_TYPE>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("getTB_ONLY_TYPE 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gLTB_ONLY_TYPE;
|
|
|
}
|
|
|
|
|
|
//不匹配垛位
|
|
|
public IList<TB_YARD_SPE> getTB_YARD_SPE()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<TB_YARD_SPE> gLTB_YARD_SPE = null;
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT * FROM TB_YARD_SPE ");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
gLTB_YARD_SPE = db.Query<TB_YARD_SPE>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("getTB_ONLY_TYPE 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gLTB_YARD_SPE;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 存储数据
|
|
|
public static void SaveFSD(IList<FP_SLAB_DES> ltFSD)
|
|
|
{
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db"))
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
//因为是同时操作两个表, 所以开启事务
|
|
|
db.BeginTransaction();
|
|
|
//db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C2' AND HAN_RSL IS NULL");
|
|
|
foreach (string item in ltFSD.GroupBy(p => p.SLAB_NO).Select(q => q.Key))
|
|
|
{
|
|
|
db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C2' AND SLAB_NO = '" + item + "'");
|
|
|
}
|
|
|
|
|
|
int intDB = db.Insert<FP_SLAB_DES>(ltFSD);
|
|
|
|
|
|
FP_SLAB_DES supData = new FP_SLAB_DES();
|
|
|
|
|
|
foreach (string item in ltFSD.GroupBy(p => p.SLAB_NO).Select(q => q.Key))
|
|
|
{
|
|
|
supData = db.Query<FP_SLAB_DES>("SELECT * FROM FP_SLAB_DES " +
|
|
|
"WHERE PLT='C2' " +
|
|
|
" AND SLAB_NO = '" + item + "'" +
|
|
|
" AND BLOCK_SEQ = '00' AND SEQ = '00' AND SLAB_CUT_SEQ ='01'").FirstOrDefault();
|
|
|
if (supData != null)
|
|
|
{
|
|
|
TBDIPDO InsertPDO = GetTBDIBKDPDO(supData);
|
|
|
db.Insert<TBDIPDO>(InsertPDO);
|
|
|
}
|
|
|
}
|
|
|
db.Commit();
|
|
|
|
|
|
|
|
|
db.BeginTransaction();
|
|
|
DateTime date = DateTime.Now;
|
|
|
foreach (FP_SLAB_DES item in ltFSD)
|
|
|
{
|
|
|
FP_SLAB_DES_HIS fP_SLAB_DES_HIS = new FP_SLAB_DES_HIS();
|
|
|
fP_SLAB_DES_HIS = CopyToModel<FP_SLAB_DES, FP_SLAB_DES_HIS>(item);
|
|
|
fP_SLAB_DES_HIS.SUB_TIME = date.ToString();
|
|
|
db.Insert<FP_SLAB_DES_HIS>(fP_SLAB_DES_HIS);
|
|
|
}
|
|
|
db.Commit();
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
//数据如果发生错误则回滚
|
|
|
db.Rollback();
|
|
|
logger.ErrorFormat("存储错误!信息:{0}", ex.ToString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 获取交货期超量规则
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<BP_FD_DATE> getBP_FD_DATE()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
DataTable dtCheck = new DataTable();
|
|
|
IList<BP_FD_DATE> ltBP_FD_DATEL = new List<BP_FD_DATE>();
|
|
|
|
|
|
strSql.AppendLine("SELECT * from nisco.BP_FD_DATE");
|
|
|
try
|
|
|
{
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
ltBP_FD_DATEL = db.Query<BP_FD_DATE>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("getBP_FD_DATE 报错 : ", ex);
|
|
|
}
|
|
|
|
|
|
return ltBP_FD_DATEL;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 镍系钢种 修磨表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public IList<SPECIAL_VARIETIES> GetSPECIAL_VARIETIES()
|
|
|
{
|
|
|
StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量
|
|
|
IList<SPECIAL_VARIETIES> gGPTHKADD = null;
|
|
|
|
|
|
//查询可用订单以及常用字段
|
|
|
|
|
|
try
|
|
|
{
|
|
|
strSql.AppendLine("SELECT * FROM NISCO.SPECIAL_VARIETIES");
|
|
|
//开启数据库连接查询数据
|
|
|
using (IDbContext db = ObjectContainer.GetObject<IDbContext>("db_sur"))
|
|
|
{
|
|
|
gGPTHKADD = db.Query<SPECIAL_VARIETIES>(strSql.ToString());
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
logger.Error("GetSPECIAL_VARIETIES 报错", ex);
|
|
|
}
|
|
|
|
|
|
return gGPTHKADD;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
public static FP_SLAB_DES_HIS CopyToModel<FP_SLAB_DES, FP_SLAB_DES_HIS>(FP_SLAB_DES source)
|
|
|
{
|
|
|
FP_SLAB_DES_HIS model = default(FP_SLAB_DES_HIS);
|
|
|
PropertyInfo[] pi = typeof(FP_SLAB_DES_HIS).GetProperties();
|
|
|
PropertyInfo[] pi1 = typeof(FP_SLAB_DES).GetProperties();
|
|
|
model = Activator.CreateInstance<FP_SLAB_DES_HIS>();
|
|
|
for (int i = 0; i < pi.Length; i++)
|
|
|
{
|
|
|
for (int k = 0; k < pi1.Length; k++)
|
|
|
{
|
|
|
if (pi[i].Name == pi1[k].Name)
|
|
|
{
|
|
|
pi[i].SetValue(model, pi1[k].GetValue(source, null), null);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return model;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 整理 PDO 实体类数据
|
|
|
/// </summary>
|
|
|
/// <param name="prP_PLATE">钢板数据</param>
|
|
|
/// <param name="prorder">订单数据库</param>
|
|
|
/// <returns></returns>
|
|
|
public static TBDIPDO GetTBDIBKDPDO(FP_SLAB_DES prSlabDes)
|
|
|
{
|
|
|
TBDIPDO Result = new TBDIPDO();
|
|
|
|
|
|
//Data字段:数值型、字符型都是后补空格
|
|
|
Result.TIMESTAMP = GetTimeStamp(); //TIMESTAMP: 1970.1.1 8:00:00 至当前时间的毫秒数
|
|
|
Result.SERIALNO = "0";//Serialno :默认0,对于TIMESTAMP: 重复时的区分号
|
|
|
Result.QUEUEID = "BKDMES000";//:主键,BKDYC0001 ,有时序先后顺序的必须用同一个QUEUEID
|
|
|
Result.HEADER = "";// 未使用
|
|
|
//Result.DATA = "";// 前10位记录FORMID(例如:BKD001 / BKD002)
|
|
|
Result.STATUS = "N";// 发送方写入N,读取成功后变0,异常变1
|
|
|
Result.PROCESSTIME = DateTime.Now.ToString("yyyyMMddHHmmss");//:读取时间
|
|
|
Result.DESCRIPTION = "";//:读取异常备注
|
|
|
|
|
|
StringBuilder strData = new StringBuilder();
|
|
|
|
|
|
strData.Append(("BKDMES011").PadRight(10));// FORMID:10位 ,BKDMES011 固定
|
|
|
strData.Append(prSlabDes.ID.PadRight(12));// 业务ID号 NUMBER(12) 流水号,需要在应答中带回
|
|
|
strData.Append(prSlabDes.PLT.PadRight(2));// 工厂代码:VARCHAR2(2), C1 / C2 / C3
|
|
|
strData.Append(prSlabDes.SLAB_NO.PadRight(10));// 板坯号: VARCHAR2(10)
|
|
|
|
|
|
Result.DATA = strData.ToString();
|
|
|
|
|
|
return Result;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取时间戳
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
public static string GetTimeStamp()
|
|
|
{
|
|
|
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 8, 0, 0, 0);
|
|
|
return Convert.ToInt64(ts.TotalMilliseconds).ToString();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} |