//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 { private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); #region 获取数据 /// ///查询宽厚板板坯信息 /// /// 所有符合条件的板坯 public IList GetWidThkSlab(string strWHere) { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList ltSlab = new List(); 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 or CSDD.SLAB_NO= substr(a.MOTHER_SLAB,1,10) or CSDD.SLAB_NO=(select substr(MOTHER_SLAB,1,10) from nisco.fp_slab where slab_no= substr(a.MOTHER_SLAB,1,10)))) > 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 like ('2430307505%') "); // strSql.AppendLine(" AND SLAB_NO in ('2311219005','2311219709','2410008808','2331057509','2311143003','2311143004','2311143005','2311143006','2321109301','2311059508','2311137502','2311172402','2430010002','2430010104') "); //strSql.AppendLine(" AND A.CUR_INV in ( 'H2','52','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('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 A.LEN<3900) ) 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 not ( (select COUNT(*) from nisco.fp_slab_C2 WHERE SLAB_NO=A.SLAB_NO AND FL='1')<1 and (select COUNT(*) from nisco.fp_slab_C3 WHERE SLAB_NO=A.SLAB_NO AND FL='True')>0 )"); 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') "); // 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.板坯已有往板卷0库或宽厚板库的转库计划,不允许替代。 /// 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("db_sur")) { ltSlab = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetWidThkSlab 报错", ex); } return ltSlab; } /// /// 获取订单物理属性QP_QLTY_MATR /// /// public IList GetQP_QLTY_MATR(string strWhere) { 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(" 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' and A.ord_fl='1' "); strSql.AppendLine("And B.REQ_SEQ_NO = A.REQ_SEQ_NO "); strSql.AppendLine("AND B.REC_STS = '1') + "); strSql.AppendLine("(case when boi.size_knd = '02'then GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0)) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) "); strSql.AppendLine("else 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) end ) >= 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) or boi.ord_no in('OMH23040079','OMH23040083','EMH23060012') or boi.ord_no like 'OM6%' )) "); strSql.AppendLine("AND boi.CFM_MILL_PLT='C2'"); //strSql.AppendLine(" boi.ORD_NO || '-' || boi.ORD_ITEM in ('OMZ23030001-003')"); 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, BOI.ORD_LEN_MIN "); strSql.AppendLine(", BOI.ORD_LEN_MAX, BOI.MATR_FL, BOI.CONT_END_DATE, BOI.CONT_END_TIME, BOI.CONT_END_EMP_ID, BOI.VESSEL_NO, BOI.CUST_REQ_NO, BOI.COLOR_STROKE, BOI.RELEASE_DATE "); strSql.AppendLine(", BOI.RELEASE_TIME, BOI.RELEASE_EMP_ID, BOI.PLN_SMS_PLT, BOI.PLN_MILL_PLT, BOI.CFM_SMS_PLT, BOI.CFM_MILL_PLT, BOI.HTM_SHOT_BLAST "); strSql.AppendLine(", BOI.INS_DATE, BOI.INS_TIME, BOI.INS_EMPID, BOI.INS_PGMID, BOI.UPD_DATE, BOI.UPD_TIME, BOI.UPD_EMPID, BOI.UPD_PGMID, BOI.SEALMEMO "); strSql.AppendLine(", BOI.INSPUNITCODEA, BOI.INSPUNITCODEB, BOI.INSPUNITCODEC, BOI.PRODSPECNOA, BOI.PRODSPECNOB, BOI.PRODSPECNOC, BOI.PAINTNUM, BOI.LP_HD_THK, BOI.LP_MD_THK, BOI.LP_TL_THK "); strSql.AppendLine(", BOI.LP_LEN1, BOI.LP_LEN2, BOI.LP_LEN3, BOI.LP_LEN4, BOI.LP_LEN5, BOI.IMP_CONT, BOI.INSPECT_ORGAN, BOI.CONTRACT_NO, BOI.TRIAL_PRODUCT, BOI.TRIAL_NUM, BOI.TRIAL_STR "); strSql.AppendLine(", BOI.TRIAL_END, BOI.SIDEMARK, BOI.JIT_STRINGA, BOI.JIT_STRINGB, BOI.JIT_STRINGC, BOI.JITID, BOI.JIT_FLAG, BOI.QO_FL, BOI.SAMPLE_MEMO, BOI.SIZE_MEMO, BOI.PACK_MEMO "); strSql.AppendLine(", BOI.FLUSH_FL, BOI.APPOINT_PLT, BOI.MORD_DESIGN_WGT, BOI.MORD_FL, BOI.APPOINT_PLT_REASON, BOI.SURFACE_REQUESTS, BOI.STAMP_FL, BOI.UST_INSP_FL, BOI.SPRAY_FL "); strSql.AppendLine(", BOI.BUFPOOL_CD, BOI.MULTI_INSP_FL, BOI.CONTRACT_DATE, BOI.DELIVERY_STATUS, BOI.CUST_CLASS, BOI.CUST_LEVEL, BOI.SPECIAL_OPR_REQ, BOI.WITNESS_CONTENT, BOI.COGGING_FLAG "); strSql.AppendLine(", BOI.STD_DET_CLASS_CD, BOI.STD_DET_CLASS_LVL, BOI.CERT_NOTE, BOI.INSPECT_FLAG, BOI.E2E_CUST, BOI.CUST_PURCHASE, BOI.GUID, BOI.NEW_CLASS_STATE, BOI.FACEPAINT "); strSql.AppendLine(", BOI.IS_JC, BOI.UST_JC, BOI.LEVEL_JM, BOI.ORDER_NOFH, BOI.ITEM_NOFH, BOI.ORDER_THK_JC, BOI.ORDER_THK_FC, BOI.TYPEFH, BOI.PRODTYPENO, BOI.STEEL_SPRAY "); strSql.AppendLine(", BOI.STEEL_PACK, BOI.STEEL_SHOTBLAST, BOI.STEEL_SLOTEPROCESS, BOI.ORDERQTY, BOI.ORDER_CNT, BOI.DELIVERY_STATUS1, BOI.DELIVERY_STATUS2, BOI.DELIVERY_STATUS3 "); strSql.AppendLine(", BOI.SPECNOA, BOI.SPECNOB, BOI.SPECNOC, BOI.SPECNOA_YY, BOI.SPECNOB_YY, BOI.SPECNOC_YY, BOI.INSPUNITCODE, BOI.SUBCUSTNO, BOI.ISSHIPORDER, BOI.SAILINGDATE "); strSql.AppendLine(", BOI.MARINEBOARD, BOI.ORDERNOYPK, BOI.ORDERITEMYPK, BOI.SORTINGMARK, BOI.UST_FL_PRINT, BOI.PRINTUTLEVEL, BOI.RULLBOARDCUT, BOI.PAINTUPT, BOI.ORDERPRICEB "); strSql.AppendLine(", BOI.ADJUSTPRICE, BOI.HOTUT, BOI.HOTUTRATE, BOI.SPECIALSIGN, BOI.UST_MODE, BOI.INSP_CD1, BOI.INSP_CD2, BOI.QKL_CUSTNO "); strSql.AppendLine(", CPP.ORD_WGT "); //strSql.AppendLine(",FLOOR((NVL(CPP.ORD_REM_WGT, 0) - CPP.ORD_WGT * (CPP.DEL_TOL_MAX + ABS(CPP.DEL_TOL_MIN)) / 100) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)) AS SUB_LACK_NUM"); //欠量上线 strSql.AppendLine(" ,NVL((SELECT sum(A.WGT) "); strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B "); strSql.AppendLine(" WHERE "); strSql.AppendLine("1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM "); strSql.AppendLine("AND A.BLOCK_SEQ >= '01' "); strSql.AppendLine("AND A.SEQ >= '01' and A.ord_fl='1' "); 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' and A.ord_fl='1' "); 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' WHEN BOI.STDSPEC LIKE 'NMXY%' THEN '1' ELSE '0' END ) XY_FLG "); strSql.AppendLine(",(CASE WHEN instr( DECODE(QQT.MLT_PROC_LINE, '1', QQT.MLT_PROC_CD, QQT.MLT_PROC_CD2),'BH') > 0 THEN '1' ELSE '0' END ) VAC_FLG\r\n"); strSql.AppendLine(",(CASE WHEN(SELECT COUNT(*) FROM NISCO.QP_QLTY_MATR_HA QQMH WHERE QQMH.ORD_NO = BOI.ORD_NO AND QQMH.ORD_ITEM = BOI.ORD_ITEM AND QQMH.TEST_KND IN('8', '9')) > 0 THEN '1' ELSE '0' END ) Z_FLG "); strSql.AppendLine(",CASE WHEN BOI.CUST_DEL_TO_DATE > TO_CHAR(SYSDATE + 7, 'YYYYMMdd') THEN 0 ELSE 1 END DEL_FLG"); //strSql.AppendLine(",'4'AS SUB_LACK_NUM"); //strSql.AppendLine(",'4'AS LACK_NUM"); strSql.AppendLine(", (SELECT COUNT(A.REQ_SEQ_NO) "); strSql.AppendLine(" FROM NISCO.EP_REQ_SLAB_D A, NISCO.EP_REQ_SLAB B "); strSql.AppendLine(" WHERE "); strSql.AppendLine(" 1 = 1 AND A.ORD_NO = BOI.ORD_NO AND A.ORD_ITEM = BOI.ORD_ITEM "); strSql.AppendLine(" AND A.BLOCK_SEQ >= '01' "); strSql.AppendLine(" AND A.SEQ >= '01' and A.ord_fl='1' "); 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' and A.ord_fl='1' "); 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' and A.ord_fl='1' "); strSql.AppendLine("And B.REQ_SEQ_NO = A.REQ_SEQ_NO "); strSql.AppendLine("AND B.REC_STS = '1') + "); strSql.AppendLine("(case when boi.size_knd = '02'then GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0)) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) "); strSql.AppendLine("else 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) end ) >= 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) or boi.ord_no in('OMH23040079','OMH23040083') or boi.ord_no like 'OM6%' )) "); strSql.AppendLine("AND boi.CFM_MILL_PLT='C2'"); strSql.AppendLine("AND (boi.CUST_DEL_TO_DATE>= to_char(sysdate-183,'YYYYMMDD') OR BOI.ORD_NO LIKE 'OMA%' )"); strSql.AppendLine("AND boi.STDSPEC NOT LIKE '%-KP'"); strSql.AppendLine(" and (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' and A.ord_fl='1' "); 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))/TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3) >=0.5 "); //strSql.AppendLine(" and boi.ORD_NO in ('OMH23110020','OMH23110021','OMH23110041','OM423120007')"); //strSql.AppendLine(" AND boi.ORD_NO || '-' || boi.ORD_ITEM in ('OMZ24030002-003')"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { gpPlates = db.Query(strSql.ToString()); // logger.Info(gpPlates.Count.ToString()); //gpPlates = CommonUtils.DataTableToList(a); // logger.Info("gpPlates :" + a.Rows.Count); } } catch (Exception ex) { logger.Error("GetOrder 报错", ex); } return gpPlates; } /// /// 根据订单号找到对应的订单要求化学成分 /// /// 对应的化学成分集合 /// 方法如果被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("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' and A.ord_fl='1' "); strSql.AppendLine("And B.REQ_SEQ_NO = A.REQ_SEQ_NO "); strSql.AppendLine("AND B.REC_STS = '1') + "); strSql.AppendLine("(case when boi.size_knd = '02'then GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0) ) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) "); strSql.AppendLine("else 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) end ) >= 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) or boi.ord_no in('OMH23040079','OMH23040083') or boi.ord_no like 'OM6%')) "); strSql.AppendLine("AND boi.CFM_MILL_PLT='C2'"); //strSql.AppendLine(" boi.ORD_NO || '-' || boi.ORD_ITEM in ('OMZ23030001-003')"); 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 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 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' and A.ord_fl='1' "); strSql.AppendLine("And B.REQ_SEQ_NO = A.REQ_SEQ_NO "); strSql.AppendLine("AND B.REC_STS = '1') + "); strSql.AppendLine("(case when boi.size_knd = '02'then GREATEST(FLOOR((NVL(CPP.ORD_REM_WGT, 0) ) / TRUNC(((BOI.ORD_WID / 1000) * (BOI.ORD_LEN / 1000) * (BOI.ORD_THK / 1000)) * 7.85, 3)),0) "); strSql.AppendLine("else 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) end ) >= 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) or boi.ord_no in('OMH23040079','OMH23040083') or boi.ord_no like 'OM6%' )) "); //strSql.AppendLine(" boi.ORD_NO || '-' || boi.ORD_ITEM in ('EM523010005-009')"); 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_STD_CROP_LEN_TEST() { 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_TEST"); 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 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.*,'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( "); 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 ( 'H2','52','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 NOT (A.THK>=360 AND A.LEN <2500 ) "); 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') "); //strSql.AppendLine(" AND slab_no='2330896106' "); // 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(" 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,'N') LIKE '%C2' || '%') OR ((NVL(A.PLAN_MILL_PLT,'N') LIKE 'C1'|| '%') AND (A.CUR_INV ='HB' OR A.THK>230 OR A.LEN<3900) ) or (select COUNT(*) from nisco.fp_slab_C2 WHERE SLAB_NO=A.SLAB_NO AND FL='1')>0 ) "); strSql.AppendLine(" AND NVL(A.PLAN_SLAB_MERGE_FL,'N') = 'N' ) "); 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("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 CNCS WHERE NVL( CNCS.CLASS_FL , ' ')<>' '"); 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 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("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 = '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("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; } /// /// 根据钢板板坯号找到对应炉号,根据炉号找到对应化学成分 /// /// 对应的化学成分集合 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("WHERE 1 = 1 "); // strSql.AppendLine(" AND SLAB_NO in ('2320231308')"); //strSql.AppendLine(" AND A.CUR_INV IN ('H2','52', '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('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.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 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') "); 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 A.LEN<3900) ) or (select COUNT(*) from nisco.fp_slab_C2 WHERE SLAB_NO=A.SLAB_NO AND FL='1')>0 ) "); strSql.AppendLine(" AND NVL(A.PLAN_SLAB_MERGE_FL,'N') = 'N' "); 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 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 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' and A.ord_fl='1' "); 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 GetAngleWidLimit() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gGPTHKADD = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM ANGLE_WID_LIMIT"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gGPTHKADD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetAngleWidLimit 报错", ex); } return gGPTHKADD; } /// /// 获取处置措施信息 /// /// 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 substr(SLAB_NO, 1, 8) IN( "); strSql.AppendLine("SELECT "); strSql.AppendLine("substr(SLAB_NO, 1, 8) "); strSql.AppendLine("FROM NISCO.FP_SLAB A "); strSql.AppendLine("WHERE 1 = 1 "); //strSql.AppendLine(" AND A.CUR_INV in ('H2','52', '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('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.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 A.LEN<3900)) 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 ( (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') ) "); // 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 ))"); 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 getEP_SLAB_DES() //{ // StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 // DataTable dtCheck = new DataTable(); // IList ltFP_SLAB_DES = new List(); // 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('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.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 NOT (A.THK>=360 AND A.LEN <2500 ) "); // strSql.AppendLine(" AND not (substr(A.LOC,1,7) in ('S7I1701','S7I1702','S7I1703','S7I1801','S7I1802','S7I1803') and CUR_INV='00') "); // strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO) < 1 )"); // 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("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.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.SLAB_NO "); strSql.AppendLine("WHERE FSD_1.SLAB_NO IN( "); strSql.AppendLine("SELECT fsd.SLAB_NO FROM NISCO.EP_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 ('H2','52','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('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.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 NOT (A.THK>=360 AND A.LEN <2500 ) "); 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') "); //strSql.AppendLine(" AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO) < 1 )"); 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 A.LEN<3900) ) or (select COUNT(*) from nisco.fp_slab_C2 WHERE SLAB_NO=A.SLAB_NO AND FL='1')>0 ) "); strSql.AppendLine(") GROUP BY fsd.SLAB_NO "); strSql.AppendLine(" HAVING(COUNT(fsd.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("db_sur")) { ltFP_SLAB_DES = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetFP_SLAB_DES 报错 : ", ex); } return ltFP_SLAB_DES; } /// /// 获取炼钢板坯设计信息 /// /// public IList getYIElD_CONTROL() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltYIElD_CONTROL = new List(); strSql.AppendLine("SELECT * from nisco.Yield_control"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltYIElD_CONTROL = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("getYIElD_CONTROL 报错 : ", ex); } return ltYIElD_CONTROL; } /// /// 获取交货期超量规则 /// /// public IList getBP_FD_DATE() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 DataTable dtCheck = new DataTable(); IList ltBP_FD_DATEL = new List(); strSql.AppendLine("SELECT * from nisco.BP_FD_DATE"); try { //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { ltBP_FD_DATEL = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("getBP_FD_DATE 报错 : ", ex); } return ltBP_FD_DATEL; } /// /// 镍系钢种 修磨表 /// /// 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 GetFB_SLAB_001() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gLFB_SLAB_001 = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM NISCO.FB_SLAB_001"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { gLFB_SLAB_001 = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetFB_SLAB_001 报错", ex); } return gLFB_SLAB_001; } /// /// 优先订单 /// /// public IList GetTB_APPOINT_ORDER() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gLTB_APPOINT_ORDER = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_APPOINT_ORDER"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gLTB_APPOINT_ORDER = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("gLTB_APPOINT_ORDER 报错", ex); } return gLTB_APPOINT_ORDER; } /// /// 455 454 453 炉内加长板数量 /// /// public IList GetAddPlateCount() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList 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 ( SELECT substr(A.SLAB_NO,1,8) FROM NISCO.FP_SLAB A WHERE 1 = 1 AND(A.PROC_CD = 'CAC' OR ((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) AND A.PROC_CD='CAD' ) 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 ) AND A.ORD_FL = '2' AND A.REC_STS = '2' AND NVL(A.OUT_PLT_CD,'9') <> '0' AND A.WGT > 0 AND NVL(A.PLAN_SLAB_CUT_FL,'N') = 'N' AND NVL(A.QUALITY_UPD_GRD, 'N') NOT IN('N','E') AND LEAST(A.WID, A.LEN) >= 1600 AND GREATEST(A.WID, A.LEN) >= 2500 AND NOT (A.THK>=360 AND A.LEN <2500 ) 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') and stlgrd in ('B19110M2CRA','B20072NMQT6','B20072NMQT9') AND((SELECT COUNT(*) FROM NISCO.FB_SLAB_001 R WHERE R.SLAB_NO = A.SLAB_NO) < 1 ) AND A.THK >= 120 AND NVL(A.PLAN_SLAB_MERGE_FL,'N') = 'N' 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 A.LEN<3900) ) or (select COUNT(*) from nisco.fp_slab_C2 WHERE SLAB_NO=A.SLAB_NO AND FL='1')>0 ) ) and aply_stdspec like 'JX/NG_2362_45%' group by substr(plate_no,1,8) ,thk ,aply_stdspec"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db_sur")) { gGPTHKADD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("AddPlateCount 报错", ex); } return gGPTHKADD; } /// /// 获取预留钢种 /// /// public IList GetTB_STLGRD_CHMC() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gLTB_STLGRD_CHMC = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM tb_stlgrd_chmc WHERE plt='C2'"); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gLTB_STLGRD_CHMC = db.Query(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 gLTB_CNF_C2 = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_CNF_C2 "); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gLTB_CNF_C2 = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("gLTB_CNF_C2 报错", ex); } return gLTB_CNF_C2.FirstOrDefault(); } public IList getTB_YIELD_CONTROL() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gLTB_YIELD_CONTROL = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_YIELD_CONTROL "); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gLTB_YIELD_CONTROL = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("getTB_YIELD_CONTROL 报错", ex); } return gLTB_YIELD_CONTROL; } public IList getFP_SLAB_ADD() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList 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("db_sur")) { gLFP_SLAB_ADD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("getFP_SLAB_ADD 报错", ex); } return gLFP_SLAB_ADD; } //不可替代订单 public IList getTB_SLAB_ORD_SPE() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gLTB_SLAB_ORD_SPE = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT ORD_NO,ORD_ITEM FROM TB_SLAB_ORD_SPE "); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gLTB_SLAB_ORD_SPE = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("getFP_SLAB_ADD 报错", ex); } return gLTB_SLAB_ORD_SPE; } /// /// 在途的仓库 /// /// 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("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 A.LEN<3900) ) 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("db_sur")) { ltCP_MOVE_SLT = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("GetCPMOVESLT 报错 : ", ex); } return ltCP_MOVE_SLT; } //台式炉不可替代钢种 public IList getTB_BTF_STLGRD() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gLTB_BTF_STLGRD = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_BTF_STLGRD "); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gLTB_BTF_STLGRD = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("getTB_BTF_STLGRD 报错", ex); } return gLTB_BTF_STLGRD; } //只允许一型设计 public IList getTB_ONLY_TYPE() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gLTB_ONLY_TYPE = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_ONLY_TYPE "); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gLTB_ONLY_TYPE = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("getTB_ONLY_TYPE 报错", ex); } return gLTB_ONLY_TYPE; } //不匹配垛位 public IList getTB_YARD_SPE() { StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 IList gLTB_YARD_SPE = null; //查询可用订单以及常用字段 try { strSql.AppendLine("SELECT * FROM TB_YARD_SPE "); //开启数据库连接查询数据 using (IDbContext db = ObjectContainer.GetObject("db")) { gLTB_YARD_SPE = db.Query(strSql.ToString()); } } catch (Exception ex) { logger.Error("getTB_ONLY_TYPE 报错", ex); } return gLTB_YARD_SPE; } #endregion #region 临时储存BTF //public IList LINSHI() //{ // StringBuilder strSql = new StringBuilder(); //声明拼接Sql语句变量 // IList gLTB_BTF_STLGRD = null; // //查询可用订单以及常用字段 // try // { // strSql.AppendLine("SELECT * FROM NISCO.QP_STD_HEAD "); // //开启数据库连接查询数据 // using (IDbContext db = ObjectContainer.GetObject("db_sur")) // { // gLTB_BTF_STLGRD = db.Query(strSql.ToString()); // } // } // catch (Exception ex) // { // logger.Error("getTB_BTF_STLGRD 报错", ex); // } // return gLTB_BTF_STLGRD; //} //public static void SaveS(IList ltFSD) //{ // using (IDbContext db = ObjectContainer.GetObject("db")) // { // try // { // //因为是同时操作两个表, 所以开启事务 // db.BeginTransaction(); // db.Execute("DELETE FROM TB_BTF_STLGRD"); // db.Insert(ltFSD); // db.Commit(); // } // catch (Exception ex) // { // //数据如果发生错误则回滚 // db.Rollback(); // logger.ErrorFormat("存储错误!信息:{0}", ex.ToString()); // } // } //} #endregion #region 存储数据 public static void SaveFSD(IList ltFSD) { using (IDbContext db = ObjectContainer.GetObject("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(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("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(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(item); fP_SLAB_DES_HIS.SUB_TIME = date.ToString(); db.Insert(fP_SLAB_DES_HIS); } db.Commit(); } catch (Exception ex) { //数据如果发生错误则回滚 db.Rollback(); logger.ErrorFormat("存储错误!信息:{0}", ex.ToString()); } } } public static void SaveStat(IList ltFSD) { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 db.BeginTransaction(); //db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C2' AND HAN_RSL IS NULL"); db.Insert(ltFSD); db.Commit(); } catch (Exception ex) { //数据如果发生错误则回滚 db.Rollback(); logger.ErrorFormat("存储错误!信息:{0}", ex.ToString()); } } } public static void SaveORDER(IList ltFSD) { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 db.BeginTransaction(); DateTime date = DateTime.Now.AddDays(-6); //db.Execute("DELETE FROM FP_SLAB_DES WHERE PLT='C2' AND HAN_RSL IS NULL"); db.Execute("DELETE from BP_ORDER_C2 where TO_CHAR(TO_DATE(ins_time, 'yyyy-MM-dd HH24:mi:ss'), 'yyyyMMdd') <= TO_CHAR(trunc(sysdate-6), 'yyyyMMdd')"); db.Insert(ltFSD); db.Commit(); } catch (Exception ex) { //数据如果发生错误则回滚 db.Rollback(); logger.ErrorFormat("存储错误!信息:{0}", ex.ToString()); } } } #endregion 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 DeleteSlab(string DeleteSlab) { using (IDbContext db = ObjectContainer.GetObject("db")) { try { //因为是同时操作两个表, 所以开启事务 db.BeginTransaction(); db.Execute("DELETE FROM FP_SLAB_DES WHERE 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()); } } } /// /// 整理 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(); } } }