using log4net; using MES.Interface; using SlabHandle.Enity; using SOA.Objects; using SOA.Persistent; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Reflection; using System.Text; namespace SlabHandle { public class SlabServiceTest { private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); #region 获取数据 /// ///查询中板板坯信息 /// /// 所有符合条件的板坯 public IList GetMediumSlab(string strWHere) { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList ltSlab = new List(); strSql.AppendLine(" SELECT DISTINCT A.SLAB_NO "); strSql.AppendLine(",QNC.STEEL_GRD_DETAIL "); strSql.AppendLine(", OCCR_CD, PLT, PRC_LINE, REC_STS, A.PROC_CD, BEF_PROC_CD, A.PROD_CD, A.STLGRD, A.THK "); strSql.AppendLine(", CASE WHEN A.WID > A.LEN THEN A.LEN ELSE A.WID END WID , CASE WHEN A.WID < A.LEN THEN A.LEN ELSE A.WID END LEN "); strSql.AppendLine(", A.WGT, CAL_WGT, THK_GRP, WID_GRP, OVER_FL, A.ORD_FL, WOO_RSN "); strSql.AppendLine(", A.ORD_NO, A.ORD_ITEM, ORG_ORD_NO, ORG_ORD_ITEM, ENDUSE_CD "); strSql.AppendLine(", DEL_TO_DATE, PROD_DATE, PROD_TIME, SHIFT, GROUP_CD, LOC, BED_PILE_DATE, SMP_FL, SMP_LOC, SMP_LEN, SMP_NO "); strSql.AppendLine(", INSP_EMP, DSC_DATE, DSC_TIME, PROD_GRD, SURF_GRD, QUALITY_GRD, QUALITY_UPD_GRD, APLY_STDSPEC "); strSql.AppendLine(", APLY_ENDUSE_CD, IN_PLT_CD, IN_PLT, IN_PLT_DATE, IN_PLT_TIME, IN_CAR_NO, IN_SHEET_NO, IN_PLT_CO "); strSql.AppendLine(", OUT_PLT_CD, OUT_PLT, OUT_PLT_DATE, OUT_PLT_TIME, OUT_CAR_NO, OUT_SHEET_NO, HOUSING_DATE, HOUSING_TIME "); strSql.AppendLine(", SHP_IST_NO, SHP_IST_DATE, SHP_IST_TIME, SHP_DATE, SHP_TIME, TRNS_NO, CAR_NO, TRNS_CMPY_CD, SHP_EMP "); strSql.AppendLine(", TRAIN_LINE_NAME, DEST_DETAIL, CERT_RPT_FL, CERT_RPT_DATE, CERT_RPT_TIME, SHP_IST_CAN_DATE, SHP_IST_CAN_TIME "); strSql.AppendLine(", SHP_IST_CAN_FL "); strSql.AppendLine(", A.INS_DATE, A.INS_EMP_CD "); strSql.AppendLine(", A.INS_PGMID, A.UPD_DATE, A.UPD_EMP_CD, A.UPD_PGM "); strSql.AppendLine(", SF_ORNOT, SLAB_RHF_IN_DATE "); strSql.AppendLine(", RHF_REJ_ORNOT, AIM_HCR_KND, HCR_KND, PRC, SCR_ORNOT, END_RES, MOTHER_SLAB, ORD_THK, ORD_WID, ORD_LEN, ORD_WGT "); strSql.AppendLine(", QUALITY_ID, TAPER_LEN, HEAD_SLAB_WID, TAIL_SLAB_WID, CUST_CD, IN_SLAB_NO, CUR_HCR_KND, WGT_L2, QUALITY_ID_L2 "); strSql.AppendLine(", CUR_INV, SIZE_KND, MIXED_FL, BAOXIN_IF_DATE, CUST_SPEC_NO, STLGRD_UPD_FL, BEF_STLGRD, WGT_CAL_L2, LOAD_WGT "); strSql.AppendLine(", CHG_GRD_RES, MAT_OWNER_FL, MAT_OWNER_CUST_CD, 'C3' PLAN_MILL_PLT, USE_MILL_PLT, PLAN_SLAB_CUT_CNT, CLAIM_RES "); strSql.AppendLine(", CLAIM_DATE, CLAIM_THK, CLAIM_WID, CLAIM_LEN, CLAIM_WGT, HTM_ORD_METH, HTM_RLT_METH, HTM_STATUS, SLAB_BACK_CNT "); strSql.AppendLine(", CUT_CNT, HTM_CNT, ERP_IF_DATE, PLAN_SLAB_CUT_FL, INGOT_FL, HEAD_SLAB_THK, TAIL_SLAB_THK, PLAN_SLAB_MERGE_FL "); strSql.AppendLine(", 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 "); strSql.AppendLine(", SMP_CAST_NO, SMP_FREQENCY, SMP_NOTE, SMP_NOTE1, SMP_NOTE2, SLAB_NO1, SLAB_NO2, UST_RLT_CD, UST_RSLT, UST_METH "); strSql.AppendLine(", CUT_AM, CUT_BM, CUT_CM, CUT_DM, CUT_EM, CUT_FM, MOTHER_SLAB_BILLET, BILLET_TYPE, MOTHER_SLAB_ELEC, RES_CM "); strSql.AppendLine(", RES_DM, RES_EM, RES_FM, RES_GM, CASE WHEN A.WID < A.LEN THEN A.LEN ELSE A.WID END REM_LEN ,CASE WHEN A.WID < A.LEN THEN A.LEN ELSE A.WID END REM_LEN_CAL , A.WGT REM_WGT "); strSql.AppendLine(", A.LEN ORG_LEN, A.WID ORG_WID, A.LEN ACT_LEN "); strSql.AppendLine(", 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(",(CASE WHEN(SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET CSDD WHERE (CSDD.EST_CD LIKE '0002') AND CSDD.SLAB_NO = A.SLAB_NO) > 0 THEN '1' else '0' end) JR_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(",0 GRP_COUNT_1,0 GRP_COUNT_2,0 GRP_COUNT_3,0 GRP_COUNT_4,0 GRP_COUNT_5,NULL TSSLog ,0 SUB_SORT,0 ORD_DATE_NUM "); //低倍要求 (DB_FLG),查询不到数据为1 查询到数据为 0 strSql.AppendLine(",CASE WHEN (SELECT COUNT(T.SLAB_NO) "); strSql.AppendLine("FROM NISCO.CP_SLAB_DELI_DET t "); strSql.AppendLine(" WHERE SLAB_NO = A.SLAB_NO "); strSql.AppendLine("AND t.REASON_CD = '3010' "); strSql.AppendLine("AND t.REASON_COMMENT = '低倍不符合要求' "); strSql.AppendLine("AND t.EST_CD = '0001') =0 THEN '1' ELSE '0' END DB_FLG "); strSql.AppendLine("FROM NISCO.FP_SLAB A "); strSql.AppendLine("LEFT JOIN NISCO.CP_SLAB_DELI_DET CSDD_1 ON CSDD_1.SLAB_NO = A.SLAB_NO"); strSql.AppendLine("LEFT JOIN NISCO.CP_SLAB_DELI_DET CSDD_2 ON CSDD_2.SLAB_NO = A.SLAB_NO"); strSql.AppendLine("LEFT JOIN NISCO.QP_NISCO_CHMC QNC ON QNC.STLGRD = A.STLGRD"); strSql.AppendLine("WHERE 1 = 1 "); ////TODO:测试数据 strSql.AppendLine(" AND A.SLAB_NO = '2430408334'"); //if (strWHere != string.Empty) //{ // strSql.AppendLine("AND A.SLAB_NO IN (" + strWHere + ")"); //} ////00库 S7I1701、S7I1702、S7I1703、S7I1801、S7I1802、S7I1803, //strSql.AppendLine(" AND (A.CUR_INV IN('ZB','ZZ','HB','B1','52','C7','HC') " + // "OR ( A.CUR_INV ='00' AND ( A.LOC NOT LIKE 'S3E04%' AND A.LOC NOT LIKE 'S3E05%' AND A.LOC NOT LIKE 'S3E06%' AND SUBSTR(A.LOC,1,7) <> 'S0A0101' " + // "AND SUBSTR(A.LOC,1,7) NOT IN ('S7I1701','S7I1702','S7I1703','S7I1801','S7I1802','S7I1803') ))) ");// //strSql.AppendLine(" AND (A.PROC_CD = 'CAC' AND (SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0003','2010') ) = 0) "); //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( "); //strSql.AppendLine(" (NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C3%') "); //strSql.AppendLine(" OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C1%' AND A.CUR_INV <> 'ZB' "); //strSql.AppendLine(" AND((A.LEN > A.WID) OR(A.LEN < A.WID AND A.WID < 2700)) "); //strSql.AppendLine(" AND((GREATEST(A.WID, A.LEN) < 3900 or LEAST(A.WID, A.LEN) < 1600 AND A.THK <= 220)) "); //strSql.AppendLine(" OR((CSDD_1.EST_COMMENT LIKE '%金润%' OR CSDD_2.EST_COMMENT LIKE '%金润%') ) OR A.SLAB_NO IN(SELECT SLAB_NO FROM NISCO.FP_SLAB_C3 FSC3 WHERE 1=1 ) ) "); //strSql.AppendLine("OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C2%' AND A.CUR_INV <> 'ZB'"); //strSql.AppendLine("AND((((A.LEN > A.WID) OR(A.LEN < A.WID AND A.WID < 2700)) "); //strSql.AppendLine("AND(((GREATEST(A.WID, A.LEN) < 2500 OR LEAST(A.WID, A.LEN) < 1600) AND A.THK <= 320) OR"); //strSql.AppendLine("((CSDD_1.EST_COMMENT LIKE '%金润%' OR CSDD_2.EST_COMMENT LIKE '%金润%') ) )) "); //strSql.AppendLine("OR A.SLAB_NO IN(SELECT SLAB_NO FROM NISCO.FP_SLAB_C3 FSC3 WHERE 1=1 ) --AND UPPER(FSC3.FL) = 'TRUE' AND FSC3.PLT = 'C2')"); //strSql.AppendLine(" )) "); //strSql.AppendLine(" OR A.CUR_INV = 'ZB' "); //strSql.AppendLine(" OR (QNC.STEEL_GRD_DETAIL IN('06Ni9(9%Ni)', '06Ni9DR', '5Ni', 'X12Ni5(5Ni)', 'X7Ni9', '7Ni') AND(CSDD_1.EST_COMMENT LIKE '%轧后判废%' OR CSDD_2.EST_COMMENT LIKE '%轧后判废%'))"); //strSql.AppendLine(" ) "); //strSql.AppendLine(" AND((GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 800 AND A.THK > 50) "); //strSql.AppendLine(" OR(GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 850 AND A.THK = 50))---短尺 "); //strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO AND R.TYPE1 ='B' ) < 1 )"); //strSql.AppendLine(" AND ((A.CUR_INV ='ZB' AND A.WGT <=33) OR (A.CUR_INV IN('00','ZZ','HB','B1','52','C7','HC') AND A.WGT <32 ))"); ////P_SLAB_DELI_DET表中字段EST_CD是5或者6开头是协议板。 //strSql.AppendLine(" ORDER BY A.LOC DESC, A.SLAB_NO ASC "); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltSlab = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetMediumSlab 报错", ex); } return ltSlab; } /// /// 暂时未用的板坯信息 /// /// /// public DataTable GetSlab(string strSlabNo) { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtReturn = new DataTable(); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { strSql.AppendLine("SELECT * FROM NISCO.FP_SLAB A "); strSql.AppendLine("WHERE 1 = 1 "); strSql.AppendLine("AND A.SLAB_NO = '" + strSlabNo + "'"); dtReturn = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetSlab 报错", ex); } return dtReturn; } /// /// 获取订单物理属性QP_QLTY_MATR /// /// public IList GetQP_QLTY_MATR() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltQP_QLTY_MATR = 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 QQM "); //strSql.AppendLine(" where(QQM.ORD_NO || '-' || QQM.ORD_ITEM) IN( "); strSql.AppendLine(" where(QQM.ORD_NO, QQM.ORD_ITEM) IN( "); //strSql.AppendLine(" 'OMK24050015-009' "); //OMK24010042-002 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(0, (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') "); 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='C3' "); strSql.AppendLine("AND (boi.ORD_NO NOT LIKE 'OMZ%' OR (boi.ORD_NO LIKE 'OMZ%' AND boi.STDSPEC LIKE '%KRZN-A%'))"); strSql.AppendLine("AND((BOI.CUST_DEL_TO_DATE > TO_CHAR(SYSDATE - 183, 'YYYYMMdd')) OR(boi.ORD_NO LIKE 'OMA%'))"); strSql.AppendLine(" )"); strSql.AppendLine(") T WHERE T.RK = 1"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltQP_QLTY_MATR = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("QP_QLTY_MATR 报错 : ", ex); } return ltQP_QLTY_MATR; } /// /// 可用订单选择 /// 订单欠量字段 ORD_REM_CNT /// /// 所有符合条件的订单 集合 public IList GetOrder(string strWHereOrd) { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 StringBuilder strRemSql = new StringBuilder(); //声明订单欠量sql IList 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, CASE WHEN BOI.SIZE_KND='02' THEN BOI.ORD_LEN_MIN +100 ELSE BOI.ORD_LEN_MIN END ORD_LEN_MIN "); strSql.AppendLine(", CASE WHEN BOI.SIZE_KND='02' THEN BOI.ORD_LEN_MAX -100 ELSE BOI.ORD_LEN_MAX END 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 ,CPP.SMS_DUEDATE , CPP.ORD_REM_WGT,((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85 ORD_SIG_WGT "); //strSql.AppendLine(",FLOOR((NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)) AS SUB_LACK_NUM"); strSql.AppendLine(",(NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) AS SUB_LACK_WGT "); strSql.AppendLine(",NVL(QQT.HTM_METH1,' ') HTM_METH1 "); strSql.AppendLine(",NVL(QQT.HTM_METH2,' ') HTM_METH2 "); strSql.AppendLine(",NVL(QQT.HTM_METH3,' ') HTM_METH3 "); //HTM_COND1 strSql.AppendLine(",NVL(QQT.HTM_COND1,' ') HTM_COND1 "); strSql.AppendLine(",NVL(QQT.HTM_COND2,' ') HTM_COND2 "); strSql.AppendLine(",NVL(QQT.HTM_COND3,' ') HTM_COND3 "); strSql.AppendLine(",CASE WHEN BOI.CUST_DEL_TO_DATE > TO_CHAR(SYSDATE + 7, 'YYYYMMdd') THEN 0 ELSE 1 END DEL_FLG"); //欠量上线 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(",QSH.STDSPEC_NAME_ENG "); strSql.AppendLine(",QSH.STDSPEC_STLGRD"); //成品成分 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(",(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 "); 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(" ,'5' 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(0, 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(", ( 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(0, 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"); //低倍FLG 低倍FLG要求 >0 有要求 1 ;=0 无要求 0 。 strSql.AppendLine(",CASE WHEN (SELECT COUNT(*) FROM NISCO.qp_qlty_slab_lowpower QQSL"); strSql.AppendLine("WHERE QQSL.ORD_NO = BOI.ORD_NO AND QQSL.ORD_ITEM = BOI.ORD_ITEM)>0 THEN '1' ELSE '0' END DB_FLG "); 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 BOI.ORD_NO || '-' || BOI.ORD_ITEM IN ('OMK24050015-009')"); //OMK24050015 009 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(0, (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') "); 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='C3' "); strSql.AppendLine("AND (boi.ORD_NO NOT LIKE 'OMZ%' OR (boi.ORD_NO LIKE 'OMZ%' AND boi.STDSPEC LIKE '%KRZN-A%'))"); strSql.AppendLine("AND((BOI.CUST_DEL_TO_DATE > TO_CHAR(SYSDATE - 183, 'YYYYMMdd')) OR(boi.ORD_NO LIKE 'OMA%'))"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { gpPlates = db.Query(strSql.ToString()); //logger.Info("订单SQL:" + 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; } /// /// 根据订单号找到对应的订单要求化学成分 /// /// 对应的化学成分集合 /// 方法如果被static修饰, 则在接口中无法被发现(原因不详) public IList GetOrderChemistry() { 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(" 'OMK24050015-009'"); 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(0, (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') "); 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='C3' "); strSql.AppendLine("AND (boi.ORD_NO NOT LIKE 'OMZ%' OR (boi.ORD_NO LIKE 'OMZ%' AND boi.STDSPEC LIKE '%KRZN-A%'))"); strSql.AppendLine("AND((BOI.CUST_DEL_TO_DATE > TO_CHAR(SYSDATE - 183, 'YYYYMMdd')) OR(boi.ORD_NO LIKE 'OMA%'))"); 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("GetOrderChemistry 报错 : ", ex); } return orderChemistrys; } /// /// 获取订单生产规范设计结果主表的信息 /// /// 订单的条件 /// public IList GetQP_QLTY_TECH(string strWHereOrd) { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltQP_QLTY_TECH = 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 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(0, (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') "); 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='C3' "); strSql.AppendLine("AND (boi.ORD_NO NOT LIKE 'OMZ%' OR (boi.ORD_NO LIKE 'OMZ%' AND boi.STDSPEC LIKE '%KRZN-A%'))"); strSql.AppendLine("AND((BOI.CUST_DEL_TO_DATE > TO_CHAR(SYSDATE - 183, 'YYYYMMdd')) OR(boi.ORD_NO LIKE 'OMA%'))"); strSql.AppendLine(strWHereOrd); strSql.AppendLine(") "); strSql.AppendLine(") T WHERE T.rk = 1 "); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltQP_QLTY_TECH = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetQP_QLTY_TECH 报错 : ", ex); } return ltQP_QLTY_TECH; } /// /// 获取订单生产规范设计结果主表的信息 /// /// 订单的条件 /// public IList GetEP_STD_CROP_LEN() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltEP_STD_CROP_LEN = new List(); strSql.AppendLine("SELECT * FROM NISCO.EP_STD_CROP_LEN"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltEP_STD_CROP_LEN = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetEP_STD_CROP_LEN 报错 : ", ex); } return ltEP_STD_CROP_LEN; } /// /// 轧件长度余量标准 /// /// public IList GetEP_PLATELEN_M() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltEP_PLATELEN_M = new List(); strSql.AppendLine("SELECT * FROM NISCO.EP_PLATELEN_M"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltEP_PLATELEN_M = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetEP_PLATELEN_M 报错 : ", ex); } return ltEP_PLATELEN_M; } /// /// 宽厚上下限 /// /// public IList GetEP_PLATEWID_STD() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltEP_PLATEWID_STD = new List(); strSql.AppendLine("SELECT * FROM NISCO.EP_PLATEWID_STD"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltEP_PLATEWID_STD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetEP_PLATEWID_STD 报错 : ", ex); } return ltEP_PLATEWID_STD; } /// /// 宽厚上下限 /// /// public IList GetQP_STD_HEAD() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltQP_STD_HEAD = new List(); strSql.AppendLine("SELECT * FROM NISCO.QP_STD_HEAD"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltQP_STD_HEAD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetQP_STD_HEAD 报错 : ", ex); } return ltQP_STD_HEAD; } /// /// /// /// public IList GetQP_PROD_RATIO() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltQP_PROD_RATIO = new List(); strSql.AppendLine("SELECT * FROM NISCO.QP_PROD_RATIO"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltQP_PROD_RATIO = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetQP_PROD_RATIO 报错 : ", ex); } return ltQP_PROD_RATIO; } /// /// 不可替代订单查询 /// /// public IList GetTBSLABORDSPE() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gTBSLABORDSPE = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_SLAB_ORD_SPE "); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gTBSLABORDSPE = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GeTBSLABORDSPE 报错", ex); } return gTBSLABORDSPE; } /// /// 板坯设计标准 /// /// public IList GetEP_SLABDESIGN() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltEP_SLABDESIGN = new List(); strSql.AppendLine("SELECT * FROM NISCO.EP_SLABDESIGN"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltEP_SLABDESIGN = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetEP_SLABDESIGN 报错 : ", ex); } return ltEP_SLABDESIGN; } /// /// 获取轧件长度限制标准信息 /// /// public IList getEP_ASROLL_LEN_STD() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltEP_ASROLL_LEN_STD = new List(); strSql.AppendLine("SELECT * FROM NISCO.EP_ASROLL_LEN_STD"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltEP_ASROLL_LEN_STD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetEP_ASROLL_LEN_STD 报错 : ", ex); } return ltEP_ASROLL_LEN_STD; } /// /// 获取钢种组信息 /// /// public IList getEP_GRD_GROUP() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltEP_GRD_GROUP = new List(); strSql.AppendLine("SELECT * FROM NISCO.EP_GRD_GROUP"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltEP_GRD_GROUP = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetEP_GRD_GROUP 报错 : ", ex); } return ltEP_GRD_GROUP; } /// /// 厚度附加值标准数据表 /// /// public IList getGP_THK_ADD() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltGP_THK_ADD = new List(); strSql.AppendLine("SELECT * FROM NISCO.GP_THK_ADD"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltGP_THK_ADD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("getGP_THK_ADD 报错 : ", ex); } return ltGP_THK_ADD; } /// /// 获取加热炉信息 /// /// public IList getEP_FUR_SIZE_STD() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltEP_FUR_SIZE_STD = new List(); strSql.AppendLine("SELECT * FROM NISCO.EP_FUR_SIZE_STD"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltEP_FUR_SIZE_STD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetEP_FUR_SIZE_STD 报错 : ", ex); } return ltEP_FUR_SIZE_STD; } /// /// 获取板坯设计信息 /// /// public IList getFP_SLAB_DES() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltFP_SLAB_DES = new List(); strSql.AppendLine("SELECT fsd_1.*,'C3' PLT,'' POSITION_X,'' POSITION_Y,'' POSITION_TYPE,'' 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" + ",'' FL" + ",'' OVER_FL2" + " FROM NISCO.EP_SLAB_DES FSD_1 "); strSql.AppendLine("LEFT JOIN NISCO.FP_SLAB fs "); strSql.AppendLine("ON fs.SLAB_NO = fsd_1.SLAB_NO "); strSql.AppendLine("LEFT JOIN NISCO.CP_REP_HIS CRH ON CRH.MAT_NO = FS.SLAB_NO "); strSql.AppendLine("WHERE FSD_1.SLAB_NO IN( "); strSql.AppendLine("SELECT fsd.SLAB_NO FROM NISCO.FP_SLAB_DES fsd WHERE fsd.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.PROC_CD = 'CAC' AND (SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0003','2010') ) = 0) "); //strSql.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C " + // "WHERE C.SLAB_NO = A.SLAB_NO " + // "AND C.REASON_CD IN ('1080','2014','2015','2018','2026','3014','5011','5013','8081') " + // "AND EST_CD IS NULL) >0) "); //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 = '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 'C3' || '%' "); strSql.AppendLine(" AND((NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C3%') "); strSql.AppendLine(" OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C1%' AND( A.LEN <= 3900 AND A.WID <= 2600 AND A.THK <= 220)) "); strSql.AppendLine(" OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C2%' AND((GREATEST(A.WID, A.LEN) < 2500 OR LEAST(A.WID, A.LEN) < 1600) AND A.THK <= 320)) "); strSql.AppendLine(" ) "); strSql.AppendLine(" AND((GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 800 AND A.THK > 50) "); strSql.AppendLine(" OR(GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 850 AND A.THK = 50)))---短尺 "); //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(" AND CRH.MAT_NO IS NULL "); strSql.AppendLine("AND SUBSTR(fsd_1.SLAB_NO,'9','1')< 3 ");// strSql.AppendLine(" ORDER BY fsd_1.SLAB_NO DESC, fsd_1.BLOCK_SEQ,fsd_1.seq "); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltFP_SLAB_DES = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetFP_SLAB_DES 报错 : ", ex); } return ltFP_SLAB_DES; } /// /// 获取炼钢板坯设计信息 /// /// public IList getEP_SLAB_DES() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltFP_SLAB_DES = new List(); strSql.AppendLine("SELECT fsd_1.*,'C3' 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("LEFT JOIN NISCO.CP_REP_HIS CRH ON CRH.MAT_NO = FS.SLAB_NO "); strSql.AppendLine("WHERE FSD_1.SLAB_NO IN( "); strSql.AppendLine("SELECT fsd.SLAB_NO FROM NISCO.FP_SLAB_DES fsd WHERE fsd.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','ZZ','HB','B1','52','C7','HC') " + "OR ( A.CUR_INV ='00' AND ( A.LOC NOT LIKE 'S3E04%' AND A.LOC NOT LIKE 'S3E05%' AND A.LOC NOT LIKE 'S3E06%' AND SUBSTR(A.LOC,1,7) <> 'S0A0101' " + "AND SUBSTR(A.LOC,1,7) NOT IN ('S7I1701','S7I1702','S7I1703','S7I1801','S7I1802','S7I1803') ))) ");// strSql.AppendLine(" AND (A.PROC_CD = 'CAC' AND (SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0003','2010') ) = 0) "); //strSql.AppendLine(" ((SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C " + // "WHERE C.SLAB_NO = A.SLAB_NO " + // "AND C.REASON_CD IN ('1080','2014','2015','2018','2026','3014','5011','5013','8081') " + // "AND EST_CD IS NULL) >0) "); //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 = '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 'C3' || '%' "); strSql.AppendLine(" AND((NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C3%') "); strSql.AppendLine(" OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C1%' AND( A.LEN <= 3900 AND A.WID <= 2600 AND A.THK <= 220)) "); strSql.AppendLine(" OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C2%' AND((GREATEST(A.WID, A.LEN) < 2500 OR LEAST(A.WID, A.LEN) < 1600) AND A.THK <= 320)) "); strSql.AppendLine(" ) "); strSql.AppendLine(" AND((GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 800 AND A.THK > 50) "); strSql.AppendLine(" OR(GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 850 AND A.THK = 50)))---短尺 "); //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(" AND CRH.MAT_NO IS NULL "); strSql.AppendLine("AND SUBSTR(fsd_1.SLAB_NO,'9','1')< 3 ");// strSql.AppendLine(" ORDER BY fsd_1.SLAB_NO DESC, fsd_1.BLOCK_SEQ,fsd_1.seq "); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltFP_SLAB_DES = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetFP_SLAB_DES 报错 : ", ex); } return ltFP_SLAB_DES; } /// /// 替代厚度限制 /// /// public IList getSUBS_THICK_LIMIT() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltSUBS_THICK_LIMIT = new List(); strSql.AppendLine("SELECT * FROM SUBS_THICK_LIMIT"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { ltSUBS_THICK_LIMIT = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetSUBS_THICK_LIMIT 报错 : ", ex); } return ltSUBS_THICK_LIMIT; } /// /// 钢种说明 /// /// public IList getQP_NISCO_CHMC() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltQP_NISCO_CHMC = new List(); strSql.AppendLine("SELECT * FROM NISCO.QP_NISCO_CHMC "); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltQP_NISCO_CHMC = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetQP_NISCO_CHMC 报错 : ", ex); } return ltQP_NISCO_CHMC; } /// /// 一坯多钢种信息 /// /// public IList getCP_NISCO_CHMC_SL() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltCP_NISCO_CHMC_SL = new List(); strSql.AppendLine("SELECT * FROM NISCO.CP_NISCO_CHMC_SL"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltCP_NISCO_CHMC_SL = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetCP_NISCO_CHMC_SL 报错 : ", ex); } return ltCP_NISCO_CHMC_SL; } /// /// 获取配置信息 /// /// public IList getTB_SLAB_CONF() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltTB_SLAB_CONF = new List(); strSql.AppendLine("SELECT * FROM TB_SLAB_CONF"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { ltTB_SLAB_CONF = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetTB_SLAB_CONF 报错 : ", ex); } return ltTB_SLAB_CONF; } /// /// 异钢种替代工艺 /// /// public IList getQP_QLTY_TECH_REPLACE() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltQP_QLTY_TECH_REPLACE = new List(); strSql.AppendLine("SELECT * FROM NISCO.QP_QLTY_TECH_REPLACE"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltQP_QLTY_TECH_REPLACE = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetQP_QLTY_TECH_REPLACE 报错 : ", ex); } return ltQP_QLTY_TECH_REPLACE; } /// /// 炼钢缓冲区主表 /// /// public IList getEP_REQ_SLAB() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltEP_REQ_SLAB = new List(); //strSql.AppendLine("SELECT ROWNUM,ERS.* FROM NISCO.EP_REQ_SLAB ERS"); //strSql.AppendLine("WHERE ERS.REC_STS = '1' AND ERS.REQ_PLT ='C3'"); strSql.AppendLine("SELECT '' 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 = 'C3' "); strSql.AppendLine("ORDER BY ERS.SLAB_LEN) T "); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltEP_REQ_SLAB = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetEP_REQ_SLAB 报错 : ", ex); } return ltEP_REQ_SLAB; } /// /// 炼钢缓冲区 详细设计表 /// /// public IList getEP_REQ_SLAB_D() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltEP_REQ_SLAB_D = new List(); //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 = 'C3')"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltEP_REQ_SLAB_D = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetEP_REQ_SLAB_D 报错 : ", ex); } return ltEP_REQ_SLAB_D; } /// /// 根据订单号找到对应的订单要求化学成分 /// /// 对应的化学成分集合 /// 方法如果被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') + GREATEST(0, 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') "); //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.ORD_NO NOT LIKE 'OMZ%' OR (boi.ORD_NO LIKE 'OMZ%' AND boi.STDSPEC LIKE '%KRZN-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; } /// /// 根据钢板板坯号找到对应炉号,根据炉号找到对应化学成分 /// /// 对应的化学成分集合 public IList GetChemistry() { 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 "); strSql.AppendLine("A.HEAT_NO "); strSql.AppendLine("FROM NISCO.FP_SLAB A "); strSql.AppendLine("LEFT JOIN NISCO.CP_SLAB_DELI_DET CSDD_1 ON CSDD_1.SLAB_NO = A.SLAB_NO"); strSql.AppendLine("LEFT JOIN NISCO.CP_SLAB_DELI_DET CSDD_2 ON CSDD_2.SLAB_NO = A.SLAB_NO"); strSql.AppendLine("LEFT JOIN NISCO.QP_NISCO_CHMC QNC ON QNC.STLGRD = A.STLGRD"); strSql.AppendLine("WHERE 1 = 1 "); strSql.AppendLine(" AND A.SLAB_NO = '2430408334 '"); //strSql.AppendLine(" AND (A.CUR_INV IN('ZB','ZZ','HB','B1','52','C7','HC') " + // "OR ( A.CUR_INV ='00' AND ( A.LOC NOT LIKE 'S3E04%' AND A.LOC NOT LIKE 'S3E05%' AND A.LOC NOT LIKE 'S3E06%' AND SUBSTR(A.LOC,1,7) <> 'S0A0101' " + // "AND SUBSTR(A.LOC,1,7) NOT IN ('S7I1701','S7I1702','S7I1703','S7I1801','S7I1802','S7I1803') ))) ");// ////TODO:测试20230104 //strSql.AppendLine(" AND (A.PROC_CD = 'CAC' AND (SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0003','2010') ) = 0) "); //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( "); //strSql.AppendLine(" (NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C3%') "); //strSql.AppendLine(" OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C1%' AND A.CUR_INV <> 'ZB' "); //strSql.AppendLine(" AND((A.LEN > A.WID) OR(A.LEN < A.WID AND A.WID < 2700)) "); //strSql.AppendLine(" AND((GREATEST(A.WID, A.LEN) < 3900 or LEAST(A.WID, A.LEN) < 1600 AND A.THK <= 220)) "); //strSql.AppendLine(" OR((CSDD_1.EST_COMMENT LIKE '%金润%' OR CSDD_2.EST_COMMENT LIKE '%金润%') ) OR A.SLAB_NO IN(SELECT SLAB_NO FROM NISCO.FP_SLAB_C3 FSC3 WHERE 1=1 )) "); //strSql.AppendLine("OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C2%' AND A.CUR_INV <> 'ZB'"); //strSql.AppendLine("AND((((A.LEN > A.WID) OR(A.LEN < A.WID AND A.WID < 2700)) "); //strSql.AppendLine("AND(((GREATEST(A.WID, A.LEN) < 2500 OR LEAST(A.WID, A.LEN) < 1600) AND A.THK <= 320) OR"); //strSql.AppendLine("((CSDD_1.EST_COMMENT LIKE '%金润%' OR CSDD_2.EST_COMMENT LIKE '%金润%') ) )) "); //strSql.AppendLine("OR A.SLAB_NO IN(SELECT SLAB_NO FROM NISCO.FP_SLAB_C3 FSC3 WHERE 1=1 ) -- UPPER(FSC3.FL) = 'TRUE' AND FSC3.PLT = 'C2')"); //strSql.AppendLine(" )) "); //strSql.AppendLine(" OR A.CUR_INV = 'ZB' "); //strSql.AppendLine(" OR (QNC.STEEL_GRD_DETAIL IN('06Ni9(9%Ni)', '06Ni9DR', '5Ni', 'X12Ni5(5Ni)', 'X7Ni9', '7Ni') AND(CSDD_1.EST_COMMENT LIKE '%轧后判废%' OR CSDD_2.EST_COMMENT LIKE '%轧后判废%'))"); //strSql.AppendLine(" ) "); //strSql.AppendLine(" AND((GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 800 AND A.THK > 50) "); //strSql.AppendLine(" OR(GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 850 AND A.THK = 50))---短尺 "); //strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO AND R.TYPE1 ='B' ) < 1 )"); //strSql.AppendLine(" AND ((A.CUR_INV ='ZB' AND A.WGT <=33) OR (A.CUR_INV IN('00','ZZ','HB','B1','52','C7','HC') AND A.WGT <32 ))"); 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 GetFP_CAD_INF() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltFP_CAD_INF = new List(); strSql.AppendLine(" SELECT* FROM NISCO.FP_CAD_INF WHERE SLAB_NO IN( "); strSql.AppendLine(" SELECT fs.SLAB_NO "); strSql.AppendLine(" FROM NISCO.FP_SLAB fs "); strSql.AppendLine(" START WITH fs.SLAB_NO "); strSql.AppendLine(" IN "); strSql.AppendLine(" ( '2430408334 ' "); //strSql.AppendLine(" SELECT DISTINCT A.SLAB_NO "); //strSql.AppendLine("FROM NISCO.FP_SLAB A "); //strSql.AppendLine("LEFT JOIN NISCO.CP_SLAB_DELI_DET CSDD_1 ON CSDD_1.SLAB_NO = A.SLAB_NO"); //strSql.AppendLine("LEFT JOIN NISCO.CP_SLAB_DELI_DET CSDD_2 ON CSDD_2.SLAB_NO = A.SLAB_NO"); //strSql.AppendLine("LEFT JOIN NISCO.QP_NISCO_CHMC QNC ON QNC.STLGRD = A.STLGRD"); //strSql.AppendLine("WHERE 1 = 1 "); ////00库 S7I1701、S7I1702、S7I1703、S7I1801、S7I1802、S7I1803, //strSql.AppendLine(" AND (A.CUR_INV IN('ZB','ZZ','HB','B1','52','C7','HC') " + // "OR ( A.CUR_INV ='00' AND ( A.LOC NOT LIKE 'S3E04%' AND A.LOC NOT LIKE 'S3E05%' AND A.LOC NOT LIKE 'S3E06%' " + // "AND SUBSTR(A.LOC,1,7) NOT IN ('S7I1701','S7I1702','S7I1703','S7I1801','S7I1802','S7I1803') ))) ");// //strSql.AppendLine(" AND (A.PROC_CD = 'CAC' AND (SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0003','2010') ) = 0) "); //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( "); //strSql.AppendLine(" (NVL(A.PLAN_MILL_PLT, ' ') LIKE '%C3%') "); //strSql.AppendLine(" OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C1%' AND A.CUR_INV <> 'ZB' "); //strSql.AppendLine(" AND((A.LEN > A.WID) OR(A.LEN < A.WID AND A.WID < 2700)) "); //strSql.AppendLine(" AND((GREATEST(A.WID, A.LEN) < 3900 or LEAST(A.WID, A.LEN) < 1600 AND A.THK <= 220)) "); //strSql.AppendLine(" OR((CSDD_1.EST_COMMENT LIKE '%金润%' OR CSDD_2.EST_COMMENT LIKE '%金润%') ) OR A.SLAB_NO IN(SELECT SLAB_NO FROM NISCO.FP_SLAB_C3 FSC3 WHERE 1=1 ) ) "); //strSql.AppendLine("OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C2%' AND A.CUR_INV <> 'ZB'"); //strSql.AppendLine("AND((((A.LEN > A.WID) OR(A.LEN < A.WID AND A.WID < 2700)) "); //strSql.AppendLine("AND(((GREATEST(A.WID, A.LEN) < 2500 OR LEAST(A.WID, A.LEN) < 1600) AND A.THK <= 320) OR"); //strSql.AppendLine("((CSDD_1.EST_COMMENT LIKE '%金润%' OR CSDD_2.EST_COMMENT LIKE '%金润%') ) )) "); //strSql.AppendLine("OR A.SLAB_NO IN(SELECT SLAB_NO FROM NISCO.FP_SLAB_C3 FSC3 WHERE 1=1 ) --AND UPPER(FSC3.FL) = 'TRUE' AND FSC3.PLT = 'C2')"); //strSql.AppendLine(" )) "); //strSql.AppendLine(" OR A.CUR_INV = 'ZB' "); //strSql.AppendLine(" OR (QNC.STEEL_GRD_DETAIL IN('06Ni9(9%Ni)', '06Ni9DR', '5Ni', 'X12Ni5(5Ni)', 'X7Ni9', '7Ni') AND(CSDD_1.EST_COMMENT LIKE '%轧后判废%' OR CSDD_2.EST_COMMENT LIKE '%轧后判废%'))"); //strSql.AppendLine(" ) "); //strSql.AppendLine(" AND((GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 800 AND A.THK > 50) "); //strSql.AppendLine(" OR(GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 850 AND A.THK = 50))---短尺 "); //strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO AND R.TYPE1 ='B' ) < 1 )"); //strSql.AppendLine(" AND ((A.CUR_INV ='ZB' AND A.WGT <=33) OR (A.CUR_INV IN('00','ZZ','HB','B1','52','C7','HC') AND A.WGT <32 ))"); strSql.AppendLine(") "); strSql.AppendLine("CONNECT BY PRIOR fs.MOTHER_SLAB = fs.SLAB_NO -- 父子关系连接条件 "); strSql.AppendLine(") "); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltFP_CAD_INF = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetFP_CAD_INF 报错 : ", ex); } return ltFP_CAD_INF; } //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 GetSlabRelation() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltSLAB_RELATION = new List(); strSql.AppendLine(" SELECT fs.SLAB_NO ,fs.MOTHER_SLAB "); strSql.AppendLine(" FROM NISCO.FP_SLAB fs "); strSql.AppendLine(" START WITH fs.SLAB_NO "); strSql.AppendLine(" IN "); strSql.AppendLine(" ( '2430408334 ' "); //strSql.AppendLine(" SELECT DISTINCT A.SLAB_NO "); //strSql.AppendLine("FROM NISCO.FP_SLAB A "); //strSql.AppendLine("LEFT JOIN NISCO.CP_SLAB_DELI_DET CSDD_1 ON CSDD_1.SLAB_NO = A.SLAB_NO"); //strSql.AppendLine("LEFT JOIN NISCO.CP_SLAB_DELI_DET CSDD_2 ON CSDD_2.SLAB_NO = A.SLAB_NO"); //strSql.AppendLine("LEFT JOIN NISCO.QP_NISCO_CHMC QNC ON QNC.STLGRD = A.STLGRD"); //strSql.AppendLine("WHERE 1 = 1 "); ////00库 S7I1701、S7I1702、S7I1703、S7I1801、S7I1802、S7I1803, //strSql.AppendLine(" AND (A.CUR_INV IN('ZB','ZZ','HB','B1','52','C7','HC') " + // "OR ( A.CUR_INV ='00' AND ( A.LOC NOT LIKE 'S3E04%' AND A.LOC NOT LIKE 'S3E05%' AND A.LOC NOT LIKE 'S3E06%' " + // "AND SUBSTR(A.LOC,1,7) NOT IN ('S7I1701','S7I1702','S7I1703','S7I1801','S7I1802','S7I1803') ))) ");// //strSql.AppendLine(" AND (A.PROC_CD = 'CAC' AND (SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0003','2010') ) = 0) "); //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( "); //strSql.AppendLine(" (NVL(A.PLAN_MILL_PLT, ' ') LIKE '%C3%') "); //strSql.AppendLine(" OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C1%' AND A.CUR_INV <> 'ZB' "); //strSql.AppendLine(" AND((A.LEN > A.WID) OR(A.LEN < A.WID AND A.WID < 2700)) "); //strSql.AppendLine(" AND((GREATEST(A.WID, A.LEN) < 3900 or LEAST(A.WID, A.LEN) < 1600 AND A.THK <= 220)) "); //strSql.AppendLine(" OR((CSDD_1.EST_COMMENT LIKE '%金润%' OR CSDD_2.EST_COMMENT LIKE '%金润%') ) OR A.SLAB_NO IN(SELECT SLAB_NO FROM NISCO.FP_SLAB_C3 FSC3 WHERE 1=1 ) ) "); //strSql.AppendLine("OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C2%' AND A.CUR_INV <> 'ZB'"); //strSql.AppendLine("AND((((A.LEN > A.WID) OR(A.LEN < A.WID AND A.WID < 2700)) "); //strSql.AppendLine("AND(((GREATEST(A.WID, A.LEN) < 2500 OR LEAST(A.WID, A.LEN) < 1600) AND A.THK <= 320) OR"); //strSql.AppendLine("((CSDD_1.EST_COMMENT LIKE '%金润%' OR CSDD_2.EST_COMMENT LIKE '%金润%') ) )) "); //strSql.AppendLine("OR A.SLAB_NO IN(SELECT SLAB_NO FROM NISCO.FP_SLAB_C3 FSC3 WHERE 1=1 ) --AND UPPER(FSC3.FL) = 'TRUE' AND FSC3.PLT = 'C2')"); //strSql.AppendLine(" )) "); //strSql.AppendLine(" OR A.CUR_INV = 'ZB' "); //strSql.AppendLine(" OR (QNC.STEEL_GRD_DETAIL IN('06Ni9(9%Ni)', '06Ni9DR', '5Ni', 'X12Ni5(5Ni)', 'X7Ni9', '7Ni') AND(CSDD_1.EST_COMMENT LIKE '%轧后判废%' OR CSDD_2.EST_COMMENT LIKE '%轧后判废%'))"); //strSql.AppendLine(" ) "); //strSql.AppendLine(" AND((GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 800 AND A.THK > 50) "); //strSql.AppendLine(" OR(GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 850 AND A.THK = 50))---短尺 "); //strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO AND R.TYPE1 ='B' ) < 1 )"); //strSql.AppendLine(" AND ((A.CUR_INV ='ZB' AND A.WGT <=33) OR (A.CUR_INV IN('00','ZZ','HB','B1','52','C7','HC') AND A.WGT <32 ))"); strSql.AppendLine(") "); strSql.AppendLine("CONNECT BY PRIOR fs.MOTHER_SLAB = fs.SLAB_NO -- 父子关系连接条件 "); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltSLAB_RELATION = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetSLAB_RELATION 报错 : ", ex); } return ltSLAB_RELATION; } public IList GetFPSLABADD() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gGPSLABADD = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM NISCO.fp_slab_add fsa WHERE fsa.SLAB_TYPE LIKE '%CZC1%' OR fsa.SLAB_TYPE LIKE '%CZC2%' OR fsa.SLAB_TYPE LIKE '%CZC3%'"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { gGPSLABADD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetFPSLABADD 报错", ex); } return gGPSLABADD; } public IList GetFPSLAB001() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gFPSLAB001 = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM NISCO.FB_SLAB_001"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { gFPSLAB001 = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetFPSLAB001 报错", ex); } return gFPSLAB001; } public IList GetFPSLABC3() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gFPSLAB001 = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM NISCO.FP_SLAB_C3"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { gFPSLAB001 = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetFPSLABC3 报错", ex); } return gFPSLAB001; } public IList GetTBCNFC3() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gTBCNFC3 = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_CNF_C3"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gTBCNFC3 = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetFPSLABC3 报错", ex); } return gTBCNFC3; } /// /// 选择的炉号 /// /// public IList GetTBHEATSPE() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gTBHEATSPE = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_HEAT_SPE"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gTBHEATSPE = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetTBHEATSPE 报错", ex); } return gTBHEATSPE; } /// /// 可选择钢种 /// /// public IList GetTBC3STLGRDSEL() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gTBC3STLGRDSEL = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_C3_STLGRD_SEL"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gTBC3STLGRDSEL = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetTBC3STLGRDSEL 报错", ex); } return gTBC3STLGRDSEL; } /// /// 在途的仓库 /// /// public IList GetCPMOVESLT(string strWHere) { 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 A.SLAB_NO "); strSql.AppendLine("FROM NISCO.FP_SLAB A "); strSql.AppendLine("LEFT JOIN NISCO.CP_SLAB_DELI_DET CSDD_1 ON CSDD_1.SLAB_NO = A.SLAB_NO"); strSql.AppendLine("LEFT JOIN NISCO.CP_SLAB_DELI_DET CSDD_2 ON CSDD_2.SLAB_NO = A.SLAB_NO"); strSql.AppendLine("LEFT JOIN NISCO.QP_NISCO_CHMC QNC ON QNC.STLGRD = A.STLGRD"); strSql.AppendLine("WHERE 1 = 1 "); if (strWHere != string.Empty) { strSql.AppendLine("AND A.SLAB_NO IN (" + strWHere + ")"); } //00库 S7I1701、S7I1702、S7I1703、S7I1801、S7I1802、S7I1803, strSql.AppendLine(" AND (A.CUR_INV IN('ZB','ZZ','HB','B1','52','C7','HC') " + "OR ( A.CUR_INV ='00' AND ( A.LOC NOT LIKE 'S3E04%' AND A.LOC NOT LIKE 'S3E05%' AND A.LOC NOT LIKE 'S3E06%' AND SUBSTR(A.LOC,1,7) <> 'S0A0101' " + "AND SUBSTR(A.LOC,1,7) NOT IN ('S7I1701','S7I1702','S7I1703','S7I1801','S7I1802','S7I1803') ))) ");// strSql.AppendLine(" AND (A.PROC_CD = 'CAC' AND (SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET C WHERE C.SLAB_NO = A.SLAB_NO AND C.EST_CD IN ('0003','2010') ) = 0) "); 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( "); strSql.AppendLine(" (NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C3%') "); strSql.AppendLine(" OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C1%' AND A.CUR_INV <> 'ZB' "); strSql.AppendLine(" AND((A.LEN > A.WID) OR(A.LEN < A.WID AND A.WID < 2700)) "); strSql.AppendLine(" AND((GREATEST(A.WID, A.LEN) < 3900 or LEAST(A.WID, A.LEN) < 1600 AND A.THK <= 220)) "); strSql.AppendLine(" OR((CSDD_1.EST_COMMENT LIKE '%金润%' OR CSDD_2.EST_COMMENT LIKE '%金润%') ) OR A.SLAB_NO IN(SELECT SLAB_NO FROM NISCO.FP_SLAB_C3 FSC3 WHERE 1=1 ) ) "); strSql.AppendLine("OR(NVL(A.PLAN_MILL_PLT, ' ') LIKE 'C2%' AND A.CUR_INV <> 'ZB'"); strSql.AppendLine("AND((((A.LEN > A.WID) OR(A.LEN < A.WID AND A.WID < 2700)) "); strSql.AppendLine("AND(((GREATEST(A.WID, A.LEN) < 2500 OR LEAST(A.WID, A.LEN) < 1600) AND A.THK <= 320) OR"); strSql.AppendLine("((CSDD_1.EST_COMMENT LIKE '%金润%' OR CSDD_2.EST_COMMENT LIKE '%金润%') ) )) "); strSql.AppendLine("OR A.SLAB_NO IN(SELECT SLAB_NO FROM NISCO.FP_SLAB_C3 FSC3 WHERE 1=1 ) --AND UPPER(FSC3.FL) = 'TRUE' AND FSC3.PLT = 'C2')"); strSql.AppendLine(" )) "); strSql.AppendLine(" OR A.CUR_INV = 'ZB' "); strSql.AppendLine(" OR (QNC.STEEL_GRD_DETAIL IN('06Ni9(9%Ni)', '06Ni9DR', '5Ni', 'X12Ni5(5Ni)', 'X7Ni9', '7Ni') AND(CSDD_1.EST_COMMENT LIKE '%轧后判废%' OR CSDD_2.EST_COMMENT LIKE '%轧后判废%'))"); strSql.AppendLine(" ) "); strSql.AppendLine(" AND((GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 800 AND A.THK > 50) "); strSql.AppendLine(" OR(GREATEST(A.WID, A.LEN) >= 2050 AND LEAST(A.WID, A.LEN) >= 850 AND A.THK = 50))---短尺 "); strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO AND R.TYPE1 ='B' ) < 1 )"); strSql.AppendLine(" AND ((A.CUR_INV ='ZB' AND A.WGT <=33) OR (A.CUR_INV IN('00','ZZ','HB','B1','52','C7','HC') AND A.WGT <32 ))"); //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("db_sur")) { ltCP_MOVE_SLT = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetCPMOVESLT 报错 : ", ex); } return ltCP_MOVE_SLT; } /// /// 获取指定优先订单 /// /// public IList GetTBAPPOINTORDER() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gTBAPPOINTORDER = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_APPOINT_ORDER"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gTBAPPOINTORDER = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetTBAPPOINTORDER 报错", ex); } return gTBAPPOINTORDER; } /// /// 获取保留钢种 /// /// public IList GetTB_STLGRD_CHMC() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gTBAPPOINTORDER = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_STLGRD_CHMC WHERE PLT = 'C3'"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gTBAPPOINTORDER = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetTB_STLGRD_CHMC 报错", ex); } return gTBAPPOINTORDER; } /// /// 镍系钢种 修磨表 /// /// public IList GetSPECIAL_VARIETIES() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gGPTHKADD = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM NISCO.SPECIAL_VARIETIES"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { gGPTHKADD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetSPECIAL_VARIETIES 报错", ex); } return gGPTHKADD; } /// /// 获取板坯订单分析数据 /// /// public IList GetTB_SLAB_ORD_DATE() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gGPTHKADD = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_SLAB_ORD_DATE"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gGPTHKADD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetTB_SLAB_ORD_DATE 报错", ex); } return gGPTHKADD; } /// /// 获取指定板坯指定订单数据 /// /// public IList GetTB_SLAB_APPOINTSUBSTITUTE() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gGPTHKADD = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_SLAB_APPOINTSUBSTITUTE"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gGPTHKADD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetTB_SLAB_APPOINTSUBSTITUTE 报错", ex); } return gGPTHKADD; } /// /// 获取处置措施信息,判断协议 /// /// /// public IList getTB_SLAB_XY(string strSlabNo) { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltTB_SLAB_XY = new List(); //strSql.AppendLine("SELECT * FROM NISCO.EP_GRD_GROUP"); strSql.AppendLine(" SELECT A.SLAB_NO, "); 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(",(CASE WHEN(SELECT COUNT(*) FROM NISCO.CP_SLAB_DELI_DET CSDD WHERE (CSDD.EST_CD LIKE '0002') AND CSDD.SLAB_NO = A.SLAB_NO) > 0 THEN '1' else '0' end) JR_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(" EST_COMMENT "); strSql.AppendLine("FROM( "); strSql.AppendLine("SELECT fs.SLAB_NO "); strSql.AppendLine("FROM NISCO.FP_SLAB fs "); strSql.AppendLine("START WITH fs.SLAB_NO IN( "); strSql.AppendLine("'" + strSlabNo + "'"); strSql.AppendLine(")-- 子节点的条件 "); strSql.AppendLine("CONNECT BY PRIOR fs.MOTHER_SLAB = fs.SLAB_NO-- 父子关系连接条件 "); strSql.AppendLine(") A "); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltTB_SLAB_XY = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetTB_SLAB_XY 报错 : ", ex); } return ltTB_SLAB_XY; } 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("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 GetTBYARDSPE() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gTBSLABORDSPE = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_YARD_SPE WHERE PLT='C3' "); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gTBSLABORDSPE = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetTBYARDSPE 报错", ex); } return gTBSLABORDSPE; } /// /// 跨厂替代 /// /// public IList GetTBPLTSPE() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gBPLTSPE = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_PLT_SPE "); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gBPLTSPE = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetTBPLTSPE 报错", ex); } return gBPLTSPE; } #endregion 获取数据 #region 存储数据 public static void SaveSlabOrdDate(IList ltTSOD) { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 IList ltSlabNo = new List(); if (ltTSOD.Count() > 0) { DateTime now = DateTime.Now; if (now.Hour == 0) { //半夜零点数据清空 db.BeginTransaction(); db.Execute("DELETE FROM TB_SLAB_ORD_DATE"); db.Commit(); } db.BeginTransaction(); foreach (TB_SLAB_ORD_DATE item in ltTSOD) { if (!ltSlabNo.Contains(item.SLAB_NO)) { db.Execute("DELETE FROM TB_SLAB_ORD_DATE WHERE SLAB_NO = '" + item.SLAB_NO + "'"); ltSlabNo.Add(item.SLAB_NO); } int intDB = db.Insert(item); } db.Commit(); } } catch (Exception ex) { //数据如果发生错误则回滚 db.Rollback(); logger.ErrorFormat("存储错误!信息:{0}", ex.ToString()); } } } /// /// 匹配结果日志数据 /// /// public static void SaveSlabSubLog(TB_C3_SUB_LOG ltSubLog) { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 IList ltSlabNo = new List(); db.BeginTransaction(); int intDB = db.Insert(ltSubLog); db.Commit(); } catch (Exception ex) { //数据如果发生错误则回滚 db.Rollback(); logger.ErrorFormat("存储错误!信息:{0}", ex.ToString()); } } } public static void SaveSlabStat(TB_SLAB_STAT TSS) { using (IDbContext db = ObjectContainer.GetObject("db")) { try { db.BeginTransaction(); db.Insert(TSS); db.Commit(); } catch (Exception ex) { //数据如果发生错误则回滚 db.Rollback(); logger.ErrorFormat("存储错误!信息:{0}", ex.ToString()); } } } public static void SaveFSD(IList ltFSD) { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 if (ltFSD.Count() > 0) { db.BeginTransaction(); db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C3' AND SLAB_NO = '" + ltFSD.FirstOrDefault().SLAB_NO + "'"); int intDB = db.Insert(ltFSD); db.Commit(); #region PDO db.BeginTransaction(); FP_SLAB_DES supData = new FP_SLAB_DES(); supData = db.Query("SELECT * FROM FP_SLAB_DES " + "WHERE PLT='C3' " + " AND SLAB_NO = '" + ltFSD.FirstOrDefault().SLAB_NO + "'" + " AND BLOCK_SEQ = '00' AND SEQ = '00' AND SLAB_CUT_SEQ ='01'").FirstOrDefault(); if (supData != null) { TBDIPDO InsertPDO = GetTBDIBKDPDO(supData); db.Insert(InsertPDO); DateTime date = DateTime.Now; List ltFSD2 = db.Query("SELECT * FROM FP_SLAB_DES " + "WHERE PLT='C3' " + " AND SLAB_NO = '" + ltFSD.FirstOrDefault().SLAB_NO + "'").ToList(); foreach (FP_SLAB_DES item in ltFSD2) { FP_SLAB_DES_HIS fP_SLAB_DES_HIS = new FP_SLAB_DES_HIS(); fP_SLAB_DES_HIS = CopyToModel(item); fP_SLAB_DES_HIS.SUB_TIME = date.ToString(); db.Insert(fP_SLAB_DES_HIS); } } db.Commit(); #endregion PDO } } catch (Exception ex) { //数据如果发生错误则回滚 db.Rollback(); logger.ErrorFormat("存储错误!信息:{0}", ex.ToString()); } } } public static void SaveWIDFSD(IList ltFSD) { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 if (ltFSD.Count() > 0) { db.BeginTransaction(); db.Execute("DELETE FROM FP_SLAB_DES_HB WHERE PLT='C3' AND SLAB_NO = '" + ltFSD.FirstOrDefault().SLAB_NO + "'"); int intDB = db.Insert(ltFSD); db.Commit(); #region PDO db.BeginTransaction(); FP_SLAB_DES supData = new FP_SLAB_DES(); supData = db.Query("SELECT * FROM FP_SLAB_DES_HB " + "WHERE PLT='C3' " + " AND SLAB_NO = '" + ltFSD.FirstOrDefault().SLAB_NO + "'" + " AND BLOCK_SEQ = '00' AND SEQ = '00' AND SLAB_CUT_SEQ ='01'").FirstOrDefault(); if (supData != null) { TBDIPDO InsertPDO = GetTBDIBKDPDO(supData); db.Insert(InsertPDO); } db.Commit(); #endregion PDO } } catch (Exception ex) { //数据如果发生错误则回滚 db.Rollback(); logger.ErrorFormat("存储错误!信息:{0}", ex.ToString()); } } } public static void DeleteFSD_SlabNo(string strSlabNo) { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 db.BeginTransaction(); db.Execute("DELETE FROM FP_SLAB_DES WHERE SLAB_NO = '" + strSlabNo + "'"); db.Commit(); } catch (Exception ex) { //数据如果发生错误则回滚 db.Rollback(); logger.ErrorFormat("删除错误!信息:{0}", ex.ToString()); } } } public static FP_SLAB_DES_HIS CopyToModel(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(); 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; } /// /// 删除数据 /// /// public static void DeleteFSD() { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 db.BeginTransaction(); db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C3' AND HAN_RSL IS NULL "); //挂回原订单数据删除 //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()); } } } /// /// 删除数据挂回原订单 /// /// public static void DeleteFSDBackOrder() { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 db.BeginTransaction(); //db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C3' AND HAN_RSL IS NULL "); //挂回原订单数据删除 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()); } } } /// /// 删除数据炼钢缓冲区 /// /// public static void DeleteFSDBuffer() { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 db.BeginTransaction(); //db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C3' AND HAN_RSL IS NULL "); //挂回原订单数据删除 db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C3' AND HAN_RSL IS NULL AND SUB_KIND='2'"); db.Commit(); } catch (Exception ex) { //数据如果发生错误则回滚 db.Rollback(); logger.ErrorFormat("删除错误!信息:{0}", ex.ToString()); } } } /// /// 删除数据自动匹配 /// /// public static void DeleteFSDAuto() { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 db.BeginTransaction(); //db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C3' AND HAN_RSL IS NULL "); //挂回原订单数据删除 db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C3' AND HAN_RSL IS NULL AND SUB_KIND='3'"); db.Commit(); } catch (Exception ex) { //数据如果发生错误则回滚 db.Rollback(); logger.ErrorFormat("删除错误!信息:{0}", ex.ToString()); } } } public static void SaveFSD_TEST(IList ltFSD) { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 db.BeginTransaction(); db.Insert(ltFSD); db.Commit(); } catch (Exception ex) { //数据如果发生错误则回滚 db.Rollback(); logger.ErrorFormat("存储错误!信息:{0}", ex.ToString()); } } } #endregion 存储数据 #region 方法 /// /// 整理 PDO 实体类数据 /// /// 钢板数据 /// 订单数据库 /// 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; } /// /// 获取时间戳 /// /// public static string GetTimeStamp() { TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 8, 0, 0, 0); return Convert.ToInt64(ts.TotalMilliseconds).ToString(); } #endregion 方法 } }