package QCM.JHY01.JHY0102; import java.math.BigDecimal; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.TreeSet; import java.util.UUID; import org.apache.commons.lang.StringUtils; import org.apache.ibatis.session.SqlSession; import CoreFS.SA01.CoreIComponent; import CoreFS.SA06.CoreReturnObject; import QCM.COMMUNAL.VO.QcmJudgeLog; import QCM.COMMUNAL.VO.QcmJudgeOperateLog; import QCM.JHY01.VO.JhyQltyModel; import QCM.JHY01.VO.JhySampleDItemModel; import QCM.JHY01.VO.JhySampleDModel; import QCM.JHY01.VO.JhySampleMMdoel; import QCM.JHY01.VO.JhySampleOrdMdoel; import QCM.QCM03.QCM0301.QcmJhyElementsServiceImpl; public class UpdateInfo extends CoreIComponent{ CoreReturnObject cro = new CoreReturnObject(); ResultSet rs = null; SqlSession SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession(); QCM.COMMUNAL.OrderSqMapper mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class); /** * 修改热处理号 取样材料号 (作废) * @param materialInfo * @return * @throws Exception */ public CoreReturnObject doAllUpdate(HashMap parmas) throws Exception { try { String rclState = "000000"; /*String sqls= ""; if(parmas.get("PLINE_CODE").equals("ZB1")){ sqls = " select t.* from KCZ_TURNOFFLIST@xgcx t where t.BILLETID = '"+parmas.get("MATERIAL_NO")+"'" + " and t.rcl_state is not null "; } if(parmas.get("PLINE_CODE").equals("HB1")){ sqls = " select t.* from KCH_TURNOFFLIST@xgcx t where t.BILLETID = '"+parmas.get("MATERIAL_NO")+"'" + " and t.rcl_state is not null "; } List tarMemo=mapper.query(sqls.toString()); if (tarMemo!=null && tarMemo.size()>=1){ if(StringUtils.isNotBlank(tarMemo.get(0).get("RCL_STATE").toString())){ rclState = (String) tarMemo.get(0).get("RCL_STATE"); } } if(rclState.equals("000000")){ rclState=parmas.get("PROCESS_NOS").toString(); }*/ rclState=parmas.get("PROCESS_NOS").toString(); String processNo =""; String sqlStr =""; //判断是否是模拟焊后 String sqlmn="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.SMP_NO = '"+parmas.get("SMP_NO")+"' and t.SMP_LOCATION like '%模拟焊后%' and t.smp_type_code = '0' "; List map2=mapper.query(sqlmn.toString()); if(map2!=null && map2.size()>=1){ sqlStr="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+parmas.get("SMP_NO")+"' and t.smp_type_code='0' and t.freq_code <>'D'"; }else{ sqlStr = "select * from QCM_JHY_SAMPLE_CONSIGN_D t" + " where t.BATCH_NO = '"+parmas.get("BATCH_NO")+"' " + " and t.SPECIMEN_NO = '"+parmas.get("SPECIMEN_NO")+"' " + " and t.SMP_NO = '"+parmas.get("SMP_NO")+"' "; } List map=mapper.query(sqlStr.toString()); if(map !=null && map.size()>=1){ String str = parmas.get("USER_NAME")+"修改热处理号为"+rclState; for (HashMap hashMap : map) { sqlStr=""; sqlStr="update QCM_JHY_SAMPLE_CONSIGN_D t set PROCESS_NOS='"+rclState+"'," + " MATERIAL_NO='"+parmas.get("MATERIAL_NO")+"'," + " ARTIFICIAL_MEMO=t.ARTIFICIAL_MEMO||',"+str+"'||'原委托热处理号为:'||t.PROCESS_NOS " + " where t.BATCH_NO = '"+hashMap.get("BATCH_NO")+"' " + " and t.SPECIMEN_NO = '"+hashMap.get("SPECIMEN_NO")+"' " + " and t.SMP_NO = '"+hashMap.get("SMP_NO")+"' "; mapper.updateJudgeStatus(sqlStr.toString()); String strMemo = "取样编号:"+hashMap.get("SPECIMEN_NO")+str+",原委托热处理号为:"+hashMap.get("PROCESS_NOS") +"原子板号:"+hashMap.get("MATERIAL_NO")+"现子板号:"+parmas.get("MATERIAL_NO"); QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(parmas.get("USER_NAME").toString()); qjog.setBatchno(parmas.get("BATCH_NO") == null ?"":parmas.get("BATCH_NO").toString()); qjog.setOperate_type("修改"); qjog.setParams(parmas.get("MATERIAL_NO") == null ?"":parmas.get("MATERIAL_NO").toString()); qjog.setProd_line(parmas.get("PLINE_CODE") == null ?"":parmas.get("PLINE_CODE").toString()); qjog.setMemo(strMemo); mapper.insertQcmJudgeOperateLog(qjog); } } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("修改失败!"); return cro; } SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); return cro; } /** * 修改取样材料号 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject updateMaterialNo(ArrayList smpNo,ArrayList specimenNo,ArrayList batchNo,ArrayList materialNo, ArrayList sendMemo, ArrayList inspectionLot,ArrayList plineCode) throws Exception { try { for (int i = 0; i < smpNo.size(); i++) { UpdateInfo uinfo= new UpdateInfo(); uinfo.doPhyItem(specimenNo.get(i).toString()); StringBuffer sqlucomm = new StringBuffer(); if(plineCode.get(i).equals("ZB1") || plineCode.get(i).equals("HB1")){ String mater = materialNo.get(i).toString(); String boardNo=mater.substring(0,mater.lastIndexOf(".")); sqlucomm.append(" update qcm_jhy_sample_consign_d set MATERIAL_NO = '"+materialNo.get(i)+"' "); sqlucomm.append(" , SEND_MEMO = '"+sendMemo.get(i)+"' ,BOARD_NO='"+boardNo+"' "); sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' "); sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' "); this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString()); String mstr=" update QCM_JHY_SAMPLE_CONSIGN_M set MATERIAL_NO='"+materialNo.get(i)+"' ,BOARD_NO='"+boardNo+"' " + " where SMP_NO = '"+smpNo.get(i)+"' and BATCH_NO = '"+batchNo.get(i)+"' "; this.getDao("testDao").ExcuteNonQuery(mstr.toString()); }else{ sqlucomm.append(" update qcm_jhy_sample_consign_d set MATERIAL_NO = '"+materialNo.get(i)+"' "); sqlucomm.append(" , SEND_MEMO = '"+sendMemo.get(i)+"' "); sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' "); sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' "); this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString()); } if(plineCode.get(i).equals("ZB1") || plineCode.get(i).equals("HB1")){ String sqlAmemo="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+specimenNo.get(i)+"' and t.Artificial_Memo like '%原委托热处理号%'"; List hmAmemo=mapper.query(sqlAmemo.toString()); String sqlAmemo2="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+specimenNo.get(i)+"' and t.FREQ_CODE in ('C','H','I')"; List hmAmemo2=mapper.query(sqlAmemo2.toString()); //中板线 厚板线热处理号 if((plineCode.get(i).equals("ZB1") || plineCode.get(i).equals("HB1")) && hmAmemo.size()<=0 && hmAmemo2.size()>=1){ String sqls= ""; sqls="select r.rcl_state from (select t.RCL_STATE from KCZ_TURNOFFLIST@xgcx t where t.BILLETID = '"+materialNo.get(i)+"' " +" and t.rcl_state is not null " +" union " +" select t.RCL_STATE from KCH_TURNOFFLIST@xgcx t where t.BILLETID = '"+materialNo.get(i)+"' " +" and t.rcl_state is not null) r group by r.rcl_state order by r.rcl_state desc "; List tarMemo=mapper.query(sqls.toString()); if (tarMemo!=null && tarMemo.size()>=1 && StringUtils.isNotBlank(tarMemo.get(0).get("RCL_STATE").toString())) { if(tarMemo.get(0).get("RCL_STATE").toString().contains("G")){ continue; } //性能改善限制 String sqlim =" select t.* from qcm_jhy_sample_consign_d t where t.specimen_no='"+specimenNo.get(i)+"' and IMPROVE_MEMO='性能改善' "; List hmim=mapper.query(sqlim.toString()); if(hmim!=null && hmim.size()>=1){ if(!tarMemo.get(0).get("RCL_STATE").toString().contains("G")){ continue; } } if(tarMemo.get(0).get("RCL_STATE").toString().contains("G")){ //19HJGP String sql =" select t.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and r.design_key like '19HJGP%' " +" and t.freq_code<>'D' and t.specimen_no='"+specimenNo.get(i)+"' "; List hmap=mapper.query(sql.toString()); if(hmap!=null && hmap.size()>=1){ sqlucomm.setLength(0); sqlucomm.append(" update qcm_jhy_sample_consign_d set ARTIFICIAL_MEMO=ARTIFICIAL_MEMO ||',初委托热处理号'||PROCESS_NOS ,PROCESS_NO = '"+tarMemo.get(0).get("RCL_STATE")+"',PROCESS_NOS= '"+tarMemo.get(0).get("RCL_STATE")+"' "); sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' "); sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' "); this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString()); } continue; } String sql ="select * from qcm_jhy_sample_consign_d where SMP_NO = '"+smpNo.get(i)+"' " + " and SPECIMEN_NO = '"+specimenNo.get(i)+"' and FREQ_CODE <> 'D' "; List hmap=mapper.query(sql.toString()); if(hmap!=null && hmap.size()>=1){ if(StringUtils.isNotBlank(hmap.get(0).get("FREQ_CODE").toString()) && !hmap.get(0).get("FREQ_CODE").equals("D")){ sqlucomm.setLength(0); sqlucomm.append(" update qcm_jhy_sample_consign_d set ARTIFICIAL_MEMO=ARTIFICIAL_MEMO ||',初委托热处理号'||PROCESS_NOS ,PROCESS_NO = '"+tarMemo.get(0).get("RCL_STATE")+"',PROCESS_NOS= '"+tarMemo.get(0).get("RCL_STATE")+"' "); sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' "); sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' "); this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString()); } }else{ sql=""; sql ="select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t " +" where t.specimen_no = '"+specimenNo.get(i)+"' " +" and t.seq >= 50 " +" and t.phy_code_l <> 'HJ' "; hmap = null; hmap=mapper.query(sql.toString()); if(hmap!=null && hmap.size()>=1){ sql=""; sql ="select * from qcm_jhy_sample_consign_d where SMP_NO = '"+smpNo.get(i)+"' " + " and SPECIMEN_NO = '"+specimenNo.get(i)+"' and SMP_TYPE_CODE in ('1','3','4') "; }else{ sql=""; sql ="select * from qcm_jhy_sample_consign_d where SMP_NO = '"+smpNo.get(i)+"' " + " and SPECIMEN_NO = '"+specimenNo.get(i)+"' and SMP_TYPE_CODE in ('3','4') "; } hmap = null; hmap=mapper.query(sql.toString()); if(hmap!=null && hmap.size()>=1){ sqlucomm.setLength(0); sqlucomm.append(" update qcm_jhy_sample_consign_d set ARTIFICIAL_MEMO=ARTIFICIAL_MEMO ||',初委托热处理号'||PROCESS_NOS,PROCESS_NO = '"+tarMemo.get(0).get("RCL_STATE")+"',PROCESS_NOS= '"+tarMemo.get(0).get("RCL_STATE")+"' "); sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' "); sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' "); this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString()); } } }else{ sqlucomm.setLength(0); sqlucomm.append(" update qcm_jhy_sample_consign_d set PROCESS_NO = '000000' "); sqlucomm.append(" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' "); sqlucomm.append(" and BATCH_NO = '"+batchNo.get(i)+"' "); this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString()); } } } //热轧 连退 复制 初样委托 选择物料号时 修改 相应的检验号 /* if(plineCode.get(i).equals("RZ1") || plineCode.get(i).equals("LT1")){ String sql = "update QCM_JUDGE_COIL_RESULT set INSPECTION_LOT = '"+inspectionLot.get(i)+"' " + " where COIL_NO = '"+materialNo.get(i)+"' "; this.getDao("testDao").ExcuteNonQuery(sql.toString()); }*/ } } catch (Exception e) { } SqlSession.close(); return cro; } /** * 复样 修改轧批号 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject updateBatchNo(ArrayList smpNo,ArrayList specimenNo,ArrayList batchNo,ArrayList materialNo, ArrayList sendMemo, ArrayList inspectionLot,ArrayList plineCode) throws Exception { Connection conn = this.getDao("testDao").getConnection(); try { String maxVal =""; String minVal = ""; TreeSet treeSet = new TreeSet(); TreeSet treeSet2 = new TreeSet(); for (int i = 0; i < batchNo.size(); i++) { treeSet.add(batchNo.get(i)); treeSet2.add(specimenNo.get(i)); } if(treeSet2.size() != 1){ cro.setV_errCode(-1); cro.setV_errMsg("请勾选一个轧批修改!不能同时修改两个轧批"); return cro; } //判断是否是一个轧批号 if(smpNo.size()>1){ maxVal = treeSet.last();//最大值 minVal = treeSet.first() ;//最小值 } String sqlsp="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+treeSet2.first()+"' and rownum=1 "; List sphm=mapper.query(sqlsp.toString()); if(sphm!=null && sphm.size()>=1){ if(treeSet.first().equals(sphm.get(0).get("BATCH_NO").toString())){ cro.setV_errCode(-1); cro.setV_errMsg("修改轧批号不能修改为同轧号请核实修改数据!"); return cro; } } for (int i = 0; i < smpNo.size(); i++) { String sqlno=" select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.specimen_no = '"+specimenNo.get(i)+"' and rownum = 1 "; List listhm=mapper.query(sqlno.toString()); String storage = "{CALL ZHB1_HJ_HEATNO_QUOTE(?,?,?,?,?)}"; CallableStatement cstm = conn.prepareCall(storage); cstm.setString(1,batchNo.get(i)); cstm.setString(2,smpNo.get(i)); cstm.setString(3,specimenNo.get(i)); cstm.setString(4,sendMemo.get(i)); cstm.registerOutParameter(5,java.sql.Types.VARCHAR); cstm.execute(); if(cstm.getString(5) != null){ if(!cstm.getString(5).equals("1")){ SqlSession.close(); conn.close(); cro.setV_errCode(-1); cro.setV_errMsg(cstm.getString(5).toString()); return cro; } } cstm.close(); //判断当前订单下是否还有复样 if(listhm !=null && listhm.size()>=1){ String DESIGN_KEY = listhm.get(0).get("DESIGN_KEY").toString(); String INSPECTION_LOT = listhm.get(0).get("INSPECTION_LOT").toString(); String BATCH_NO = listhm.get(0).get("BATCH_NO").toString(); String sqlf="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.freq_code = 'D' and t.smp_type_code = '1' " +" and r.design_key = '"+DESIGN_KEY+"' and r.batch_no = '"+BATCH_NO+"' " +" and r.inspection_lot = '"+INSPECTION_LOT+"' and rownum = 1 "; List list2=mapper.query(sqlf.toString()); if(list2 != null && list2.size()>=1){ String sql2="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.freq_code = 'D' and t.smp_type_code = '0' " +" and r.design_key = '"+DESIGN_KEY+"' and r.batch_no = '"+BATCH_NO+"' " +" and r.inspection_lot = '"+INSPECTION_LOT+"' and rownum = 1 "; List list3=mapper.query(sql2.toString()); if(list3 != null && list3.size()>=1){ //有复样,但是初没有清空检验号 String sql3 =" update QCM_JHY_SAMPLE_R_ORD set inspection_lot = '' " +" where SMP_NO = '"+list3.get(0).get("SMP_NO")+"' and batch_no = '"+list3.get(0).get("BATCH_NO")+"' "; mapper.updateJudgeStatus(sql3.toString()); } } } SqlSession.commit(); SqlSession.close(); conn.close(); cro.setV_errCode(1); cro.setV_errMsg("修改轧批号成功!"); return cro; } /* for (int i = 0; i < smpNo.size(); i++) { //判断当前试样号是否有两个复样 如果一个试样号下有两个复样说明复样夹杂时 只有一个轧批号满足条件复样 String smpNoDSql = " select * from qcm_jhy_sample_consign_d t " +" where t.smp_no = '"+smpNo.get(i)+"' " +" and t.smp_type_code = '1' " +" and t.freq_code = 'D' "; List smpNoDSqlhm=mapper.query(smpNoDSql.toString()); if(smpNoDSqlhm !=null && smpNoDSqlhm.size()>=2){ //当前修改的轧批号是否初样已判定 String ordSql = "select r.* from qcm_jhy_sample_r_ord r,qcm_jhy_sample_consign_d t " +" where r.smp_no = t.smp_no " +" and t.SMP_TYPE_CODE = '0' " +" and r.batch_no = '"+batchNo.get(i)+"' " +" and r.judge_status = '0' "; List ordhm=mapper.query(ordSql.toString()); if(ordhm !=null && ordhm.size()>=1){ String storage = "{CALL ZHB1_HJ_HEATNO_QUOTE(?,?,?,?,?)}"; CallableStatement cstm = conn.prepareCall(storage); cstm.setString(1,batchNo.get(i)); cstm.setString(2,smpNo.get(i)); cstm.setString(3,specimenNo.get(i)); cstm.setString(4,sendMemo.get(i)); cstm.registerOutParameter(5,java.sql.Types.VARCHAR); cstm.execute(); if(cstm.getString(5) != null){ if(!cstm.getString(5).equals("1")){ SqlSession.close(); conn.close(); cro.setV_errCode(-1); cro.setV_errMsg(cstm.getString(5).toString()); return cro; } } cstm.close(); SqlSession.commit(); SqlSession.close(); conn.close(); cro.setV_errCode(1); cro.setV_errMsg("修改轧批号成功!"); //初样未判定 //cro.setV_errCode(-1); //cro.setV_errMsg("轧批号【"+batchNo.get(i)+"】初样未判定,请选择其它轧批号"); return cro; }else{ String batchPline2 = batchNo.get(i).substring(0, 1); String batchPlines2 = batchPline2; String batchNoplieCode = ""; if(batchPlines2.equals("Z")){ batchNoplieCode = "ZB1"; }else if (batchPlines2.equals("H")){ batchNoplieCode = "HB1"; } String smp_no = createQltySamNo(batchNoplieCode);//新试样号 String specimen_no = createSpecimen_no(smp_no);//新取样材料号 String delSmpNo = smpNo.get(i);//要删除的试样号 String delSpecimenNo =""; String sqlitem = "select * from qcm_jhy_sample_consign_d_item t where t.specimen_no='"+specimenNo.get(i)+"' and t.phy_code_l='HJ' and t.seq >=50 "; List sqlitemHM=mapper.query(sqlitem.toString()); if(sqlitemHM==null || sqlitemHM.size()<=0){ delSpecimenNo = specimenNo.get(i);//要删除的取样编号 }else{ sqlitem=""; sqlitem = " select * from qcm_jhy_sample_consign_d t " +" where t.smp_no = '"+smpNo.get(i)+"' " +" and t.smp_type_code = '1' " +" and t.freq_code = 'D' and t.specimen_no<>'"+specimenNo.get(i)+"' "; sqlitemHM.clear(); sqlitemHM=mapper.query(sqlitem.toString()); if(sqlitemHM!=null && sqlitemHM.size()>=1){ delSpecimenNo = sqlitemHM.get(0).get("SPECIMEN_NO").toString();//要删除的取样编号 }else{ delSpecimenNo = specimenNo.get(i);//要删除的取样编号 } } String sql ="select * from qcm_jhy_sample_consign_d t " +" where t.smp_no = '"+delSmpNo+"' " +" and t.specimen_no = '"+delSpecimenNo+"' " +" and t.freq_code = 'D' " +" and t.smp_type_code = '1' "; List hmSql=mapper.query(sql.toString()); if(hmSql!=null && hmSql.size()==1){ //删除最开始的复样 sql =""; sql =" delete from QCM_JHY_INSP_PHYSICS t where t.SPECIMEN_NO='"+delSpecimenNo+"' "; mapper.delete(sql.toString()); sql =""; sql =" delete from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.SPECIMEN_NO='"+delSpecimenNo+"' and t.SMP_NO='"+delSmpNo+"' "; mapper.delete(sql.toString()); sql =""; sql =" delete from QCM_JHY_SAMPLE_CONSIGN_D t where t.SPECIMEN_NO='"+delSpecimenNo+"' and t.SMP_NO='"+delSmpNo+"' "; mapper.delete(sql.toString()); //要修改成的轧批号初样的轧批信息 sql =""; sql = "select t.* from qcm_jhy_sample_consign_d t " +" where t.SMP_TYPE_CODE = '0' " +" and t.batch_no = '"+batchNo.get(i)+"' " +" and t.freq_code = 'D' and rownum = 1 "; List ydhm=mapper.query(sql.toString()); if(ydhm!=null && ydhm.size()>=1){ sql = ""; sql ="Insert into QCM_JHY_SAMPLE_CONSIGN_M(SMP_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, " +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, " +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,ITEM_FLAG,DUPLICATE_SAMPLE) " +" select '"+smp_no+"',HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,MATERIAL_NO,PSC, " +" PSC_DESC,SMP_CATG,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE,SMP_TYPE_NAME,GRADE_CODE,GRADE_NAME, " +" PLINE_CODE,PLINE_NAME,VALIDFLAG,MEMO,'sys','sys',sysdate,ITEM_FLAG,'复样' " +" from QCM_JHY_SAMPLE_CONSIGN_M t where t.SMP_NO = '"+ydhm.get(0).get("SMP_NO")+"'" + " and t.batch_no = '"+ydhm.get(0).get("BATCH_NO")+"' and rownum <= 1 "; mapper.insert(sql); sql = ""; sql = "Insert into QCM_JHY_SAMPLE_R_ORD(DESIGN_KEY,SMP_NO,PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE, " + " DELIVERY_STATE_DESC,THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME, " + " SMP_TYPE_CODE,SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,PHY_ID,JUDGE_STATUS,PROD_CODE," + " PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,CREATE_TIME,CREATE_ID,CREATE_NAME,DUPLICATE_SAMPLE) " + " select DESIGN_KEY,'"+smp_no+"',PSC,PSC_DESC,HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE,DELIVERY_STATE_DESC, " + " THICK,WIDTH,LENGTH,PLINE_CODE,PLINE_NAME,MSC_PLINE,PROCESS_CODE,CERT_INST_CODE,CERT_INST_NAME,SMP_TYPE_CODE," + " SMP_TYPE_NAME,SMELTING_CNT,PRODUCT_CNT,ASSAY_NO_CP,ASSAY_NO_RL,CIC_ID,PHY_ID,'0',PROD_CODE,PROD_NAME,STEEL_CODE, " + " STEEL_NAME,STD_CODE,STD_NAME,sysdate,'sys','sys','复样' " + " from QCM_JHY_SAMPLE_R_ORD t where t.SMP_NO = '"+ydhm.get(0).get("SMP_NO")+"' " + " and t.batch_no = '"+ydhm.get(0).get("BATCH_NO")+"' and rownum <= 1 "; mapper.insert(sql); //把选中的初样轧批号 检验号置空 sql =""; sql +=" update QCM_JHY_SAMPLE_R_ORD set inspection_lot = '' "; sql +=" where SMP_NO = '"+ydhm.get(0).get("SMP_NO")+"' and batch_no = '"+ydhm.get(0).get("BATCH_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); //插入D表 sql = ""; sql = "insert into qcm_jhy_sample_consign_d " +" (smp_no, specimen_no, heat_no, batch_no, inspection_lot, freq_code, freq_name, material_no, smp_type_code, smp_type_name, consign_no, consign_no_seq, test_qty, smp_qty, smp_location, board_no, old_consign_no, pline_code, pline_name, status, validflag, source, guid, chem_item, product_cnt, create_time, smp_location_code, memo, weight, weight_std, weight_sfd, process_no, quote_batch_no,PROCESS_NOS,PROCESS_CODE,ARTIFICIAL_MEMO) " +" select " +" '"+smp_no+"', '"+specimen_no+"', heat_no, batch_no, inspection_lot, freq_code, freq_name, material_no, '1', '复样', consign_no, consign_no_seq, test_qty, smp_qty, smp_location, board_no, '"+ydhm.get(0).get("SPECIMEN_NO")+"', pline_code, pline_name, '0', validflag, source, guid, chem_item, product_cnt, sysdate, smp_location_code, memo, weight, weight_std, weight_sfd, process_no, '"+ydhm.get(0).get("BATCH_NO")+"',PROCESS_NOS,PROCESS_CODE,'复样修改轧批号' " +" from qcm_jhy_sample_consign_d t " +" where t.SMP_NO = '"+ydhm.get(0).get("SMP_NO")+"' and t.heat_no = '"+ydhm.get(0).get("HEAT_NO")+"' and t.batch_no = '"+ydhm.get(0).get("BATCH_NO")+"' and t.freq_code = 'D' and t.smp_type_code = '0' and rownum <= 1"; mapper.insert(sql); //插入ITEM表 sql = ""; sql = "insert into qcm_jhy_sample_consign_d_item " +" (specimen_no, seq, smp_no, phy_name_l, phy_code_l, phy_code_m, phy_name_m, phy_code_s, phy_name_s, item_code_d, item_name_d, item_code_t, item_name_t, item_code_s, item_name_s, item_code_l, item_desc_l, stdmin_sign, stdmin, stdmax_sign, stdmax, test_qty, smp_qty, specl_fl, isjudge, judge_basis, phy_unit, group_seq, quote_seq, item_flag, memo, create_id, create_name, create_time, stdmemo, resmp_seq, phy_group_code) " +" select '"+specimen_no+"', seq, '"+smp_no+"', phy_name_l, phy_code_l, phy_code_m, phy_name_m, phy_code_s, phy_name_s, item_code_d, item_name_d, item_code_t, item_name_t, item_code_s, item_name_s, item_code_l, item_desc_l, stdmin_sign, stdmin, stdmax_sign, stdmax, test_qty, smp_qty, specl_fl, isjudge, judge_basis, phy_unit, group_seq, quote_seq, item_flag, memo, '复样','复样' , SYSDATE, stdmemo, resmp_seq, phy_group_code " +" from qcm_jhy_sample_consign_d_item t where t.specimen_no = '"+ydhm.get(0).get("SPECIMEN_NO")+"' "; mapper.insert(sql); //复样 引用 当前轧批初样实绩 //查询当前初样取样编号的所有实绩 sql = ""; sql = " select t.* from QCM_JHY_INSP_PHYSICS t " +" where t.specimen_no in (select d.specimen_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.smp_no = '"+ydhm.get(0).get("SMP_NO")+"' ) " + " order by t.SPECIMEN_NO asc, t.phy_code_l asc,t.phy_code_s asc "; List hmPhysics = mapper.query(sql.toString()); //把初样的项目 放到 复样中 for (HashMap hashMap1 : hmPhysics) { sql = ""; sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+specimen_no+"'"; List seqhm = mapper.query(sql.toString()); BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ"); String seqs = big.toString(); Integer seqint = Integer.parseInt(seqs); sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO) " +" select '"+specimen_no+"','"+seqint+"',TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO,'"+(String)hashMap1.get("SPECIMEN_NO")+"' from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' " + " and t.phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' " + " and t.phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' " + " and t.PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' " + " and t.test_qty = '"+hashMap1.get("TEST_QTY")+"' "; mapper.insert(sql); sql = ""; sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM " +" (SPECIMEN_NO,SEQ,SMP_NO,PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, " +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, " +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, " +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, " +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO) " +" select '"+specimen_no+"','"+seqint+"','"+smp_no+"',PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, " +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, " +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, " +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, " +" PHY_GROUP_CODE,'"+(String)hashMap1.get("SPECIMEN_NO")+"' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM " + " where specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' " + " and phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' " + " and PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' " + " and phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' "; mapper.insert(sql); } }else{ cro.setV_errCode(-1); cro.setV_errMsg("轧批号【"+batchNo.get(i)+"】未找到初样信息"); return cro; } } } continue; } //查找复样的原本轧批号 String dsql = "select t.BATCH_NO,t.HEAT_NO,t.smp_no from QCM_JHY_SAMPLE_CONSIGN_D t where " + " t.SPECIMEN_NO = '"+specimenNo.get(i)+"' and t.SMP_TYPE_CODE= '1' "; List SampleD=mapper.query(dsql.toString()); if (SampleD == null || SampleD.size()<0) { cro.setV_errCode(-1); cro.setV_errMsg("没有找到相应的复样轧批号【"+batchNo.get(i)+"】"); return cro; } dsql =""; dsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo.get(i)+"' " + " and t.smp_type_code='0' and t.freq_code<>'D' "; List SampleD2=mapper.query(dsql.toString()); if(SampleD2 != null && SampleD2.size()>=1){ String storage = "{CALL ZHB1_HJ_HEATNO_QUOTE(?,?,?,?,?)}"; CallableStatement cstm = conn.prepareCall(storage); cstm.setString(1,batchNo.get(i)); cstm.setString(2,smpNo.get(i)); cstm.setString(3,specimenNo.get(i)); cstm.setString(4,sendMemo.get(i)); cstm.registerOutParameter(5,java.sql.Types.VARCHAR); cstm.execute(); if(cstm.getString(5) != null){ if(!cstm.getString(5).equals("1")){ SqlSession.close(); conn.close(); cro.setV_errCode(-1); cro.setV_errMsg(cstm.getString(5).toString()); return cro; } } cstm.close(); SqlSession.commit(); SqlSession.close(); conn.close(); cro.setV_errCode(1); cro.setV_errMsg("修改轧批号成功!"); return cro; } //查询当前轧批ord表 dsql =""; dsql = "select m.INSPECTION_LOT,d.SMP_LOCATION,d.smp_no,d.specimen_no,d.heat_no,d.batch_no,d.freq_code,d.freq_name,d.material_no,d.smp_type_code,d.smp_type_name," + " d.board_no,d.pline_code,d.pline_name,d.process_no,d.process_nos,m.GRADE_CODE,m.GRADE_NAME,r.psc,r.psc_desc,r.delivery_state_code,r.delivery_state_desc,r.thick,r.width," + " r.length,r. msc_pline,r.process_code,r.cert_inst_code,r.cert_inst_name,r.smp_type_code,r.smp_type_name,r.prod_code,r.prod_name," + " r.steel_code,r.steel_name,r.std_code,r.std_name,r.DESIGN_KEY" + " from qcm_jhy_sample_consign_d d,qcm_jhy_sample_consign_m m,qcm_jhy_sample_r_ord r " +" where d.smp_no = m.smp_no " +" and d.smp_no = r.smp_no " +" and m.smp_no = r.smp_no " +" and r.batch_no = '"+batchNo.get(i)+"' and d.Freq_Code = 'D' and d.smp_type_code='0' and rownum = 1 "; List map=mapper.query(dsql.toString()); if(map == null || map.size()<=0){ cro.setV_errCode(-1); cro.setV_errMsg("没有查找到当前要修改的轧批的信息!!!"); return cro; } String sql =""; sql +=" update QCM_JHY_SAMPLE_CONSIGN_M set BATCH_NO = '"+batchNo.get(i)+"',inspection_lot = '"+batchNo.get(i)+"0001'," + " BOARD_NO='"+map.get(0).get("BOARD_NO")+"',PSC='"+map.get(0).get("PSC")+"', PSC_DESC='"+map.get(0).get("PSC_DESC")+"'," + " CERT_INST_CODE='"+map.get(0).get("CERT_INST_CODE")+"',CERT_INST_NAME='"+map.get(0).get("CERT_INST_NAME")+"'," + " GRADE_CODE='"+map.get(0).get("GRADE_CODE")+"',GRADE_NAME='"+map.get(0).get("GRADE_NAME")+"'," + " PLINE_CODE='"+map.get(0).get("PLINE_CODE")+"',PLINE_NAME='"+map.get(0).get("PLINE_NAME")+"'," + " MATERIAL_NO='"+map.get(0).get("MATERIAL_NO")+"'"; sql +=" where SMP_NO = '"+smpNo.get(i)+"' "; mapper.updateJudgeStatus(sql.toString()); sql =""; sql +=" update QCM_JHY_SAMPLE_R_ORD set BATCH_NO = '"+batchNo.get(i)+"' ,INSPECTION_LOT = '"+batchNo.get(i)+"0001'," + "PSC='"+map.get(0).get("PSC")+"', PSC_DESC='"+map.get(0).get("PSC_DESC")+"'," + "DELIVERY_STATE_CODE='"+map.get(0).get("DELIVERY_STATE_CODE")+"',DELIVERY_STATE_DESC='"+map.get(0).get("DELIVERY_STATE_DESC")+"', " + "THICK='"+map.get(0).get("THICK")+"', WIDTH='"+map.get(0).get("WIDTH")+"', LENGTH='"+map.get(0).get("LENGTH")+"'," + "PLINE_CODE='"+map.get(0).get("PLINE_CODE")+"',PLINE_NAME='"+map.get(0).get("PLINE_NAME")+"'," + "CERT_INST_CODE='"+map.get(0).get("CERT_INST_CODE")+"',CERT_INST_NAME='"+map.get(0).get("CERT_INST_NAME")+"', " + "PROD_CODE='"+map.get(0).get("PROD_CODE")+"',PROD_NAME='"+map.get(0).get("PROD_NAME")+"'," + "STEEL_CODE='"+map.get(0).get("STEEL_CODE")+"',STEEL_NAME='"+map.get(0).get("STEEL_NAME")+"'," + "STD_CODE='"+map.get(0).get("STD_CODE")+"',STD_NAME='"+map.get(0).get("STD_NAME")+"'," + "DESIGN_KEY='"+map.get(0).get("DESIGN_KEY")+"' "; sql +=" where SMP_NO = '"+smpNo.get(i)+"' "; mapper.updateJudgeStatus(sql.toString()); //把选中的初样轧批号 检验号置空 sql =""; sql +=" update QCM_JHY_SAMPLE_R_ORD set inspection_lot = '' "; sql +=" where SMP_NO in (select SMP_NO from QCM_JHY_SAMPLE_CONSIGN_D " + " where BATCH_NO = '"+batchNo.get(i)+"' and freq_code = 'D' AND smp_type_code='0' ) "; mapper.updateJudgeStatus(sql.toString()); //把换下来的初样轧批号 检验号返回原来的检验号 for (HashMap hm : SampleD) { sql =""; sql +=" update QCM_JHY_SAMPLE_R_ORD set inspection_lot = '"+hm.get("BATCH_NO")+"0001' "; sql +=" where BATCH_NO in (select batch_no from QCM_JHY_SAMPLE_CONSIGN_D " + " where BATCH_NO = '"+hm.get("BATCH_NO")+"' and freq_code = 'D' AND smp_type_code='0' ) "; mapper.updateJudgeStatus(sql.toString()); } String batchPline2 = batchNo.get(i).substring(0, 1); String batchPlines2 = batchPline2; String batchNoplieCode = ""; if(batchPlines2.equals("Z")){ batchNoplieCode = "ZB1"; }else if (batchPlines2.equals("H")){ batchNoplieCode = "HB1"; } if(batchNoplieCode.equals("HB1")){ //厚 sql =""; sql = "select BILLETID as MATERIAL_NO from kch_turnofflist@xgcx where BILLETID like '"+batchNo.get(i)+"'||'%' and rownum=1 "; }else if(batchNoplieCode.equals("ZB1")){ //中 sql =""; sql = "select BILLETID as MATERIAL_NO from kcz_turnofflist@xgcx where BILLETID like '"+batchNo.get(i)+"'||'%' and rownum=1 "; } List listEle= mapper.query(sql.toString()); String VmaterialNo = ""; if(listEle!=null && listEle.size()>=1){ VmaterialNo = listEle.get(0).get("MATERIAL_NO").toString(); } //换成修改的轧批号 sql =""; sql +=" update QCM_JHY_SAMPLE_CONSIGN_D set BATCH_NO = '"+batchNo.get(i)+"',inspection_lot = '"+batchNo.get(i)+"0001',MATERIAL_NO='"+VmaterialNo+"'," + " FREQ_CODE='"+map.get(0).get("FREQ_CODE")+"',FREQ_NAME='"+map.get(0).get("FREQ_NAME")+"'," + " SMP_LOCATION='"+map.get(0).get("SMP_LOCATION")+"',BOARD_NO='"+map.get(0).get("BOARD_NO")+"'," + " PLINE_CODE='"+map.get(0).get("PLINE_CODE")+"',PLINE_NAME='"+map.get(0).get("PLINE_NAME")+"'," + " process_no='"+map.get(0).get("process_no")+"',PROCESS_NOS='"+map.get(0).get("PROCESS_NOS")+"' "; sql +=" where SMP_NO = '"+smpNo.get(i)+"' and SPECIMEN_NO = '"+specimenNo.get(i)+"' "; mapper.updateJudgeStatus(sql.toString()); //删除当前复样的初样 sql =""; sql +=" delete from QCM_JHY_INSP_PHYSICS t where t.SPECIMEN_NO='"+specimenNo.get(i)+"' and t.SEQ >= 50 "; mapper.delete(sql.toString()); sql =""; sql +=" delete from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.SPECIMEN_NO='"+specimenNo.get(i)+"' and t.SEQ >= 50 "; mapper.delete(sql.toString()); //复样 引用 当前轧批初样实绩 //查询当前初样取样编号的所有实绩 sql = ""; sql = " select t.* from QCM_JHY_INSP_PHYSICS t " +" where t.specimen_no in (select d.specimen_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.smp_no = '"+map.get(0).get("SMP_NO")+"' ) " + " order by t.SPECIMEN_NO asc, t.phy_code_l asc,t.phy_code_s asc "; List hmPhysics = mapper.query(sql.toString()); //把初样的项目 放到 复样中 for (HashMap hashMap1 : hmPhysics) { sql = ""; sql = "select decode(max(seq),'','49',max(seq))+1 as SEQ from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+specimenNo.get(i)+"'"; List seqhm = mapper.query(sql.toString()); BigDecimal big = (BigDecimal)seqhm.get(0).get("SEQ"); String seqs = big.toString(); Integer seqint = Integer.parseInt(seqs); sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO,QUOTE_SPECIMEN_NO,QUOTE_STATUS) " +" select '"+specimenNo.get(i)+"','"+seqint+"',TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,GUID,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO,'"+(String)hashMap1.get("SPECIMEN_NO")+"','0' from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' " + " and t.phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' " + " and t.phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' " + " and t.PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' " + " and t.test_qty = '"+hashMap1.get("TEST_QTY")+"' "; mapper.insert(sql); sql = ""; sql = "insert into QCM_JHY_SAMPLE_CONSIGN_D_ITEM " +" (SPECIMEN_NO,SEQ,SMP_NO,PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, " +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, " +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, " +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, " +" PHY_GROUP_CODE,FY_QUOTE_SPECIMEN_NO,FY_QUOTE_STATUS) " +" select '"+specimenNo.get(i)+"','"+seqint+"','"+smpNo.get(i)+"',PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S, " +" ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,ITEM_CODE_L,ITEM_DESC_L, " +" STDMIN_SIGN,STDMIN,STDMAX_SIGN,STDMAX,TEST_QTY,SMP_QTY,SPECL_FL,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ, " +" QUOTE_SPECIMEN_NO,QUOTE_SEQ,ITEM_FLAG,MEMO,CREATE_ID,CREATE_NAME,CREATE_TIME,STDMEMO,RESMP_SEQ, " +" PHY_GROUP_CODE,'"+(String)hashMap1.get("SPECIMEN_NO")+"','0' from QCM_JHY_SAMPLE_CONSIGN_D_ITEM " + " where specimen_no = '"+(String)hashMap1.get("SPECIMEN_NO")+"' " + " and phy_code_l = '"+hashMap1.get("PHY_CODE_L")+"' " + " and PHY_CODE_M = '"+hashMap1.get("PHY_CODE_M")+"' " + " and phy_code_s = '"+hashMap1.get("PHY_CODE_S")+"' "; mapper.insert(sql); } }*/ } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("修改轧批号失败!"); return cro; } SqlSession.commit(); SqlSession.close(); conn.close(); cro.setV_errCode(1); cro.setV_errMsg("修改轧批号成功!"); return cro; } /** * 初样 修改取样轧批号按炉 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject DoUpRefBatchNo(ArrayList smpNo,ArrayList specimenNo,ArrayList batchNo,ArrayList heatnNo, ArrayList materialNo, ArrayList sendMemo,ArrayList inspectionLot,ArrayList plineCode) throws Exception { try { TreeSet treeSet = new TreeSet(); for (int i = 0; i < batchNo.size(); i++) { treeSet.add(batchNo.get(i)); } if(treeSet.size() != 1){ cro.setV_errCode(-1); cro.setV_errMsg("只能按同炉修改取样轧批号,请一个轧批一个轧批修改"); return cro; } //判断该轧批号有没有生成委托 String dsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where " + " t.BATCH_NO = '"+batchNo.get(0)+"' and t.SMP_TYPE_CODE= '0' and t.freq_code = 'D' and rownum <= 1"; List SampleD=mapper.query(dsql.toString()); if (SampleD == null || SampleD.size()<0) { cro.setV_errCode(-1); cro.setV_errMsg("轧批号【'"+batchNo.get(0)+"'】按炉取样还未生成委托!"); return cro; } for (int i = 0; i < treeSet.size(); i++) { //查到当前轧批的取样编号 String selsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where " + " t.SMP_NO = '"+smpNo.get(i)+"' and t.SMP_TYPE_CODE= '0' and t.freq_code = 'D' and rownum <= 1 "; List selhmbno=mapper.query(selsql.toString()); if(selhmbno!=null && selhmbno.size()>=1){ if(selhmbno.get(0).get("BATCH_NO").toString().equals(batchNo.get(i))){ cro.setV_errCode(-1); cro.setV_errMsg("同轧批修改!无效操作!"); return cro; } } //查到当前轧批的取样编号 String sNOsql = "select t.SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D t where " + " t.BATCH_NO = '"+batchNo.get(0)+"' and t.SMP_TYPE_CODE= '0' and t.freq_code = 'D' and rownum <= 1 "; List fYspecimenNo=mapper.query(sNOsql.toString()); String logmemo = specimenNo.get(i)+','+materialNo.get(i)+"初样夹杂修改成"+batchNo.get(i); String sql3= "INSERT INTO QCM_JUDGE_OPERATE_LOG (OPERATE_TYPE,PARAMS,OPERATE_NAME,PROD_LINE,BATCHNO,MEMO) " + " VALUES('初样修改夹杂接口','"+materialNo.get(i)+"','createQtlySample','"+plineCode.get(i)+"'," + " '"+batchNo.get(i)+"','"+logmemo+"') "; mapper.insert(sql3); //修改引用取样编号 当前 String sql =" update QCM_JHY_SAMPLE_CONSIGN_D " + " set QUOTE_CONSIGN_NO = '' , STATUS = '0', SEND_ID='',SEND_NAME = '',SEND_TIME = '' "; sql +=" where SPECIMEN_NO = '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' "; //this.getDao("testDao").ExcuteNonQuery(sql.toString()); mapper.updateJudgeStatus(sql.toString()); sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM set QUOTE_SPECIMEN_NO = '' "; sql +=" where SPECIMEN_NO = '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' "; //this.getDao("testDao").ExcuteNonQuery(sql.toString()); mapper.updateJudgeStatus(sql.toString()); //修改其它引用轧批 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D " + " set QUOTE_CONSIGN_NO = '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' , STATUS = '1', SEND_ID='sys',SEND_NAME = '引用发送',SEND_TIME = sysdate "; sql +=" where HEAT_NO = '"+heatnNo.get(0)+"' and SPECIMEN_NO <> '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' and freq_code = 'D' "; //this.getDao("testDao").ExcuteNonQuery(sql.toString()); mapper.updateJudgeStatus(sql.toString()); //查询当前炉号的引用取样编号 String sNOsqls = "select t.SPECIMEN_NO from QCM_JHY_SAMPLE_CONSIGN_D t " + " where HEAT_NO = '"+heatnNo.get(0)+"' and SPECIMEN_NO <> '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' and freq_code = 'D' "; List listhm=mapper.query(sNOsqls.toString()); if (listhm != null && listhm.size()>0) { for (HashMap hashMap : listhm) { sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM set QUOTE_SPECIMEN_NO = '"+fYspecimenNo.get(0).get("SPECIMEN_NO")+"' "; sql +=" where SPECIMEN_NO = '"+hashMap.get("SPECIMEN_NO")+"' "; //this.getDao("testDao").ExcuteNonQuery(sql.toString()); mapper.updateJudgeStatus(sql.toString()); } } } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("修改轧批号失败!"); return cro; } SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); cro.setV_errMsg("修改轧批号成功!"); return cro; } /** * 删除检验项 检验委托明细项目表 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject deleteInfo(String seq,String specimenNo) throws Exception { try { StringBuffer sqlucomm = new StringBuffer(); sqlucomm.append(" delete from qcm_jhy_sample_consign_d_item "); sqlucomm.append(" where SPECIMEN_NO = '"+specimenNo+"' and SEQ = '"+seq+"' "); this.getDao("testDao").ExcuteNonQuery(sqlucomm.toString()); } catch (Exception e) { cro.setV_errCode(-1); cro.setV_errMsg("删除失败!"); return cro; } cro.setV_errCode(1); cro.setV_errMsg("删除成功!"); return cro; } /** * 删除委托 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject DoDelete(ArrayList batchNo,ArrayList designKey,ArrayList smpNo,ArrayList specimenNo,ArrayList smpTypeName,String userName) throws Exception { try { Integer num = 0; TreeSet treeSet = new TreeSet(); for(String batchNoVal : batchNo){ if(StringUtils.isBlank(batchNoVal)){ cro.setV_errCode(-1); cro.setV_errMsg("轧批号为空!!!"); return cro; } treeSet.add(batchNoVal); num++; } if(treeSet.size()>1){ cro.setV_errCode(-1); cro.setV_errMsg("只能删除同轧批号的委托!!!"); return cro; } //件件取样 /* for(int i=0;i hm=mapper.query(jsql.toString()); if(hm != null && hm.size()>=1){ for (HashMap hmap : hm) { String spmNo= hmap.get("SMP_NO").toString(); //删除 检验委托明细项目表 String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimen+"' "; mapper.delete(sql.toString()); //删除 检验委托明细表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no= '"+specimen+"' "; mapper.delete(sql.toString()); //删除 检验委托主表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+spmNo+"' "; mapper.delete(sql.toString()); //删除 试样号与合同信息关系表 sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.smp_no = '"+spmNo+"' "; mapper.delete(sql.toString()); } } }*/ for(int i=0;i hm=mapper.query(jsql.toString()); if(hm != null && hm.size()>=1){ continue; }*/ //线棒限制 String BCGX="select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where " + " t.SPECIMEN_NO = '"+specimenNo.get(i)+"' and t.pline_code in ('BC2','GX1','GX2') and rownum = 1 "; List bcgxhm=mapper.query(BCGX.toString()); if (bcgxhm != null && bcgxhm.size()>=1) { String BATCH_NO_BCGX = bcgxhm.get(0).get("BATCH_NO").toString(); String INSPECTION_LOT_BCGX= bcgxhm.get(0).get("INSPECTION_LOT").toString(); String BCGX2=" select * from qcm_jhy_sample_r_ord r " + " where r.batch_no = '"+BATCH_NO_BCGX+"' and r.inspection_lot = '"+INSPECTION_LOT_BCGX+"' " + " and r.judge_status = '1' and r.inspection_lot is not null "; List bcgxhm2=mapper.query(BCGX2.toString()); if(bcgxhm2 !=null && bcgxhm2.size()>=1){ cro.setV_errCode(-1); cro.setV_errMsg("【"+BATCH_NO_BCGX+"】轧批下的委托有判定请撤销判定再删除!"); return cro; } } String dsql="select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t where " + " t.QUOTE_CONSIGN_NO = '"+specimenNo.get(i)+"' and FREQ_CODE = 'D' "; List Sampley=mapper.query(dsql.toString()); if (Sampley != null && Sampley.size()>=1) { if(!Sampley.get(0).get("CNUM").toString().equals("0")){ cro.setV_errCode(-1); cro.setV_errMsg("该夹杂已被同炉的夹杂引用不能删除!!!"); return cro; } } //英国250吨 dsql=""; dsql="select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t, qcm_jhy_sample_consign_d d " + " where t.specimen_no = d.specimen_no and d.pline_code in ('ZB1','HB1') and t.Quote_Specimen_No = '"+specimenNo.get(i)+"' "; List lrastr=mapper.query(dsql.toString()); if (lrastr != null && lrastr.size()>=1) { if(!lrastr.get(0).get("CNUM").toString().equals("0")){ cro.setV_errCode(-1); cro.setV_errMsg("该轧批已被引用英国船级社!!!"); return cro; } } TreeSet treeSteelCode = new TreeSet(); //牌号 TreeSet treeSpecimenNo = new TreeSet(); //取样编号 int numsno=0; //XGEC- 订单开头的一个订单两个牌号 String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t,Qcm_Jhy_Sample_r_Ord r " + " where t.SMP_NO=r.SMP_NO and r.DESIGN_KEY = '"+designKey.get(i)+"' and t.batch_no = '"+batchNo.get(i)+"' "; List lists = mapper.query(sqlLog); if(lists!=null && lists.size()>1){ for (HashMap hashMap : lists) { treeSteelCode.add(hashMap.get("STEEL_CODE").toString()); treeSpecimenNo.add(hashMap.get("SPECIMEN_NO").toString()); } if(treeSteelCode.size()>=2){//一个订单两个牌号,需要一起删除 for (String strsno : treeSpecimenNo) { for(int j=0;j SampleD=mapper.query(dsql.toString()); if (SampleD == null || SampleD.size()<=0 || SampleD.get(0).get("CNUM").toString().equals("0")) { cro.setV_errCode(-1); cro.setV_errMsg("检验委托明细表未找到相应数据!!!"); return cro; } for(int i=0;i hm=mapper.query(jsql.toString()); if(hm != null && hm.size()>=1){ continue; }*/ String sqlLog = "select nvl(t.PROCESS_NOS,'null') PROCESS_NOS1,t.*,r.* from QCM_JHY_SAMPLE_CONSIGN_D t,Qcm_Jhy_Sample_r_Ord r " + " where t.SMP_NO=r.SMP_NO and t.specimen_no = '"+specimenNo.get(i)+"'"; List lists = mapper.query(sqlLog); for (HashMap list : lists) { String strMemo = list.get("SPECIMEN_NO").toString()+","+list.get("DESIGN_KEY").toString()+","+list.get("STEEL_CODE").toString()+"," +list.get("THICK").toString()+","+list.get("INSPECTION_LOT").toString()+","+list.get("SMP_TYPE_NAME").toString()+"," +list.get("PROCESS_NOS1").toString(); QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(userName); qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString()); qjog.setOperate_type("删除检验委托"); qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString()); qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString()); qjog.setMemo(strMemo); mapper.insertQcmJudgeOperateLog(qjog); } if(smpTypeName.get(i).equals("初样") || smpTypeName.get(i).equals("认证样") || smpTypeName.get(i).equals("按母板取样") ){ //记录删除的数据 String sqlDel = " Insert into QCM_JHY_SAMPLE_CONSIGN_D_DEL(SMP_NO,SPECIMEN_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,FREQ_CODE,FREQ_NAME,MATERIAL_NO,SMP_TYPE_CODE,SMP_TYPE_NAME,CONSIGN_NO,CONSIGN_NO_SEQ,TEST_QTY,SMP_QTY,SMP_LOCATION,BOARD_NO,QUOTE_CONSIGN_NO,OLD_CONSIGN_NO,PLINE_CODE,PLINE_NAME,STATUS,VALIDFLAG,SOURCE,GUID,SEND_ID,SEND_NAME,SEND_TIME,CHEM_ITEM,PRODUCT_CNT,CREATE_TIME,SMP_LOCATION_CODE,MEMO,WEIGHT,WEIGHT_STD,WEIGHT_SFD,SPECIMENNOZH,SEND_MEMO,ITEM_FLAG,CREATETIMEDEL,CREATENAMEDEL,ARTIFICIAL_MEMO) " + " select SMP_NO,SPECIMEN_NO,HEAT_NO,BATCH_NO,INSPECTION_LOT,FREQ_CODE,FREQ_NAME,MATERIAL_NO,SMP_TYPE_CODE,SMP_TYPE_NAME,CONSIGN_NO,CONSIGN_NO_SEQ,TEST_QTY,SMP_QTY,SMP_LOCATION,BOARD_NO,QUOTE_CONSIGN_NO,OLD_CONSIGN_NO,PLINE_CODE,PLINE_NAME,STATUS,VALIDFLAG,SOURCE,GUID,SEND_ID,SEND_NAME,SEND_TIME,CHEM_ITEM,PRODUCT_CNT,CREATE_TIME,SMP_LOCATION_CODE,MEMO,WEIGHT,WEIGHT_STD,WEIGHT_SFD,'删除委托接口',SEND_MEMO,ITEM_FLAG,SYSDATE,'"+userName+"S',ARTIFICIAL_MEMO from QCM_JHY_SAMPLE_CONSIGN_D d" + " where d.smp_no = '"+smpNo.get(i)+"' and d.specimen_no= '"+specimenNo.get(i)+"' and d.batch_no = '"+batchNo.get(i)+"' "; mapper.insert(sqlDel); dsql =""; dsql = "select count(1) cnum from QCM_JHY_SAMPLE_CONSIGN_D t where " + " t.smp_no = '"+smpNo.get(i)+"' "; List smpNot=mapper.query(dsql.toString()); if(smpNot!=null && smpNot.size()>=1 && !smpNot.get(0).get("CNUM").toString().equals("1")){ //删除 检验委托明细项目表 String sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+specimenNo.get(i)+"' "; mapper.delete(sql.toString()); //删除 检验委托明细项目表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo.get(i)+"' "; mapper.delete(sql.toString()); //删除 检验委托明细表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo.get(i)+"' and t.specimen_no= '"+specimenNo.get(i)+"'" + " and t.batch_no = '"+batchNo.get(i)+"' "; mapper.delete(sql.toString()); }else{ //删除 检验委托明细项目表 String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo.get(i)+"' "; mapper.delete(sql.toString()); //删除 检验委托明细表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo.get(i)+"' and t.specimen_no= '"+specimenNo.get(i)+"'" + " and t.batch_no = '"+batchNo.get(i)+"' "; mapper.delete(sql.toString()); //删除 检验委托主表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+smpNo.get(i)+"' " + " and t.batch_no = '"+batchNo.get(i)+"' "; mapper.delete(sql.toString()); //删除 试样号与合同信息关系表 sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.design_key = '"+designKey.get(i)+"' and t.smp_no = '"+smpNo.get(i)+"' " + " and t.batch_no = '"+batchNo.get(i)+"' "; mapper.delete(sql.toString()); //删除 检验委托明细项目表 sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+specimenNo.get(i)+"' "; mapper.delete(sql.toString()); } }else if (smpTypeName.get(0).equals("复样")){ //删除 检验委托明细项目表 String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo.get(i)+"' "; mapper.delete(sql.toString()); //删除 检验委托明细表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo.get(i)+"' and t.specimen_no= '"+specimenNo.get(i)+"'" + " and t.batch_no = '"+batchNo.get(i)+"' and t.smp_type_code = '1' "; mapper.delete(sql.toString()); //删除 检验委托主表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+smpNo.get(i)+"' " + " and t.batch_no = '"+batchNo.get(i)+"' and t.DUPLICATE_SAMPLE = '复样' "; mapper.delete(sql.toString()); //删除 试样号与合同信息关系表 sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.design_key = '"+designKey.get(i)+"' and t.smp_no = '"+smpNo.get(i)+"' " + " and t.batch_no = '"+batchNo.get(i)+"' and t.DUPLICATE_SAMPLE = '复样' "; mapper.delete(sql.toString()); //如果要删除复样委托时 也要删除实绩表qcm_jhy_insp_physics //删除 检验委托明细项目表 sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+specimenNo.get(i)+"' "; mapper.delete(sql.toString()); } } //删除复样时 初样检验号返回 if (smpTypeName.get(0).equals("复样")){ for (String batchNo2 : treeSet) { //把初样的检验号 修改到ord表中 String sql =" select t.smp_no,t.inspection_lot from QCM_JHY_SAMPLE_CONSIGN_D t " +" where t.smp_type_code = '0' and t.batch_no = '"+batchNo2+"' "; List hmap = mapper.query(sql.toString()); for (HashMap hm : hmap) { sql =" update QCM_JHY_SAMPLE_R_ORD t set t.inspection_lot = '"+(String)hm.get("INSPECTION_LOT")+"' " + " where t.smp_no = '"+(String)hm.get("SMP_NO")+"' and t.batch_no = '"+batchNo2+"' "; mapper.updateJudgeStatus(sql.toString()); } } } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("删除委托失败!"); return cro; } SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); cro.setV_errMsg("删除委托成功!"); return cro; } /** * 取消复样接口 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject DoDeleteFY(String batchNo,String designKey,String smpNo,String userName,String steelCode,String thick) throws Exception { try { Integer num = 0; String PLINE_CODE=""; TreeSet treeSet = new TreeSet(); if(StringUtils.isBlank(batchNo)){ cro.setV_errCode(-1); cro.setV_errMsg("轧批号为空!!!"); return cro; } if(StringUtils.isBlank(designKey)){ cro.setV_errCode(-1); cro.setV_errMsg("订单号为空!!!"); return cro; } if(StringUtils.isBlank(smpNo)){ cro.setV_errCode(-1); cro.setV_errMsg("试样号为空!!!"); return cro; } if(StringUtils.isBlank(steelCode)){ cro.setV_errCode(-1); cro.setV_errMsg("牌号为空!!!"); return cro; } if(StringUtils.isBlank(thick)){ cro.setV_errCode(-1); cro.setV_errMsg("规格为空!!!"); return cro; } String dinsql = "select nvl(t.PROCESS_NOS,'null') PROCESS_NOS1,t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no " + " and t.batch_no like '"+batchNo+"%' and t.SMP_TYPE_CODE= '0' and t.SMP_NO = '"+smpNo+"' " + " and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099') "; List Samplein=mapper.query(dinsql.toString()); if(Samplein == null || Samplein.size()<=0){ cro.setV_errCode(1); cro.setV_errMsg("未找到该试样号的初样信息:"+smpNo); return cro; } PLINE_CODE=Samplein.get(0).get("PLINE_CODE").toString();//产线 String strMemo = "试样号:"+smpNo+','+designKey+','+steelCode+','+thick; if(Samplein.get(0).get("PLINE_CODE").toString().equals("HB1") || Samplein.get(0).get("PLINE_CODE").toString().equals("ZB1")){ strMemo+=",热处理号:"+Samplein.get(0).get("PROCESS_NOS1").toString(); } QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(userName); qjog.setBatchno(batchNo); qjog.setOperate_type("取消复样委托"); qjog.setParams(Samplein.get(0).get("MATERIAL_NO").toString()); qjog.setProd_line(Samplein.get(0).get("PLINE_CODE").toString()); qjog.setMemo(strMemo); mapper.insertQcmJudgeOperateLog(qjog); //检验委托明细表 String dsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no " + " and t.batch_no like '"+batchNo+"%' and t.SMP_TYPE_CODE= '1' and r.DESIGN_KEY='"+designKey+"' " + " and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099') " + " and t.FREQ_CODE = '"+Samplein.get(0).get("FREQ_CODE")+"' and r.INSPECTION_LOT = '"+Samplein.get(0).get("INSPECTION_LOT")+"' "; List SampleD=mapper.query(dsql.toString()); if (SampleD == null || SampleD.size()<=0) { dsql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no " + " and t.batch_no like '"+batchNo+"%' and t.SMP_TYPE_CODE= '1' " + " and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099')" + " and t.FREQ_CODE = '"+Samplein.get(0).get("FREQ_CODE")+"' and r.INSPECTION_LOT = '"+Samplein.get(0).get("INSPECTION_LOT")+"'"; SampleD=null; SampleD=mapper.query(dsql.toString()); if (SampleD == null || SampleD.size()<=0) { SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); cro.setV_errMsg("取消复样委托成功!"); return cro; } } for (HashMap hm : SampleD) { if(!hm.get("STATUS").equals("0")){ SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("轧批号【'"+batchNo+"'】已发送委托不可撤销!"); return cro; } } for (HashMap hmap : SampleD) { //删除 检验委托明细项目表 String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+hmap.get("SPECIMEN_NO")+"' "; mapper.delete(sql.toString()); //删除 检验委托明细表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+hmap.get("SMP_NO")+"' and t.specimen_no= '"+hmap.get("SPECIMEN_NO")+"'" + " and t.batch_no like '"+batchNo+"%' and t.smp_type_code = '1' "; mapper.delete(sql.toString()); //删除 检验委托主表 /* sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+hmap.get("SMP_NO")+"' " + " and t.batch_no like '"+batchNo+"%' and t.DUPLICATE_SAMPLE = '复样' "; mapper.delete(sql.toString());*/ //删除 试样号与合同信息关系表 /* sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.smp_no = '"+hmap.get("SMP_NO")+"' " + " and t.batch_no like '"+batchNo+"%' and t.DUPLICATE_SAMPLE = '复样' "; mapper.delete(sql.toString());*/ //如果要删除复样委托时 也要删除实绩表qcm_jhy_insp_physics //删除 检验委托明细项目表 sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+hmap.get("SPECIMEN_NO")+"' "; mapper.delete(sql.toString()); } for (HashMap hmap : SampleD) { //删除 检验委托主表 String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+hmap.get("SMP_NO")+"' " + " and t.batch_no like '"+batchNo+"%' and t.DUPLICATE_SAMPLE = '复样' "; mapper.delete(sql.toString()); //删除 试样号与合同信息关系表 sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.smp_no = '"+hmap.get("SMP_NO")+"' " + " and t.batch_no like '"+batchNo+"%' and t.DUPLICATE_SAMPLE = '复样' "; mapper.delete(sql.toString()); } String strSmpNo = " and r.SMP_NO = '"+smpNo+"' "; if(PLINE_CODE.equals("GX1") || PLINE_CODE.equals("GX2") || PLINE_CODE.equals("BC2")){ strSmpNo=""; } //删除复样时 初样检验号返回 //把初样的检验号 修改到ord表中 String sql =" select t.smp_no,t.inspection_lot from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no " +" and t.smp_type_code = '0' and t.batch_no like '"+batchNo+"%' and r.DESIGN_KEY='"+designKey+"' " +" and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099')" + strSmpNo; List hmap = mapper.query(sql.toString()); if(hmap==null || hmap.size()<=0){ sql =" select t.smp_no,t.inspection_lot from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no " +" and t.smp_type_code = '0' and t.batch_no like '"+batchNo+"%' " + strSmpNo +" and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099')"; hmap=null; hmap = mapper.query(sql.toString()); } for (HashMap hm : hmap) { sql =" update QCM_JHY_SAMPLE_R_ORD t set t.inspection_lot = '"+(String)hm.get("INSPECTION_LOT")+"' " + " where t.smp_no = '"+(String)hm.get("SMP_NO")+"' and t.batch_no like '"+batchNo+"%' "; mapper.updateJudgeStatus(sql.toString()); } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("取消复样委托失败!"); return cro; } SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); cro.setV_errMsg("取消复样委托成功!"); return cro; } /** * 取消件件取样接口 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject DoDeleteJ(String materialNo,String designKey,String smpNo,String userName,String steelCode,String thick) throws Exception { try { if(StringUtils.isBlank(materialNo)){ cro.setV_errCode(-1); cro.setV_errMsg("子板号为空!!!"); return cro; } if(StringUtils.isBlank(designKey)){ cro.setV_errCode(-1); cro.setV_errMsg("订单号为空!!!"); return cro; } if(StringUtils.isBlank(smpNo)){//为原不合格的试样号 cro.setV_errCode(-1); cro.setV_errMsg("试样号为空!!!"); return cro; } if(StringUtils.isBlank(steelCode)){ cro.setV_errCode(-1); cro.setV_errMsg("牌号为空!!!"); return cro; } if(StringUtils.isBlank(thick)){ cro.setV_errCode(-1); cro.setV_errMsg("规格为空!!!"); return cro; } String dinsql = "select nvl(t.PROCESS_NOS, 'null') PROCESS_NOS,t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no " + " and t.MATERIAL_NO = '"+materialNo+"' and t.SMP_TYPE_CODE= '3' and r.DESIGN_KEY = '"+designKey+"' " + " and r.steel_code = '"+steelCode+"' and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099') and rownum=1 "; List Samplein=mapper.query(dinsql.toString()); if(Samplein == null || Samplein.size()<=0){ cro.setV_errCode(1); cro.setV_errMsg("未找到该子板号件件取样信息:"+materialNo); return cro; } if(!Samplein.get(0).get("STATUS").equals("0")){ cro.setV_errCode(-1); cro.setV_errMsg("子板号【'"+materialNo+"'】件件取样已发送委托不可取消!请先把委托撤销回来"); return cro; } String strMemo = "原试样号:"+smpNo+','+designKey+','+steelCode+','+thick; if(Samplein.get(0).get("PLINE_CODE").toString().equals("HB1") || Samplein.get(0).get("PLINE_CODE").toString().equals("ZB1")){ strMemo+=",热处理号:"+Samplein.get(0).get("PROCESS_NOS").toString(); } QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(userName); qjog.setBatchno(Samplein.get(0).get("BATCH_NO").toString()); qjog.setOperate_type("取消件件取样委托"); qjog.setParams(Samplein.get(0).get("MATERIAL_NO").toString()); qjog.setProd_line(Samplein.get(0).get("PLINE_CODE").toString()); qjog.setMemo(strMemo); mapper.insertQcmJudgeOperateLog(qjog); for (HashMap hmap : Samplein) { String spmNo= hmap.get("SMP_NO").toString(); String specimenNO= hmap.get("SPECIMEN_NO").toString(); //删除 检验委托明细项目表 String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNO+"' "; mapper.delete(sql.toString()); //删除 检验委托明细表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no= '"+specimenNO+"' "; mapper.delete(sql.toString()); //删除 检验委托主表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+spmNo+"' "; mapper.delete(sql.toString()); //删除 试样号与合同信息关系表 sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.smp_no = '"+spmNo+"' "; mapper.delete(sql.toString()); sql = "DELETE QCM_JHY_INSP_PHYSICS t where t.specimen_no= '"+specimenNO+"' "; mapper.delete(sql.toString()); } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("取消件件取样委托失败!"); return cro; } SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); cro.setV_errMsg("取消件件取样委托成功!"); return cro; } /** * 初样 撤销复制当前委托一条 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject DoDelWtZy(String batchNo,String designKey,String smpNo,String specimenNo,String userName) throws Exception { try { if(StringUtils.isBlank(batchNo)){ cro.setV_errCode(-1); cro.setV_errMsg("轧批号为空!!!"); return cro; } if(StringUtils.isBlank(smpNo)){ cro.setV_errCode(-1); cro.setV_errMsg("试样号为空!!!"); return cro; } if(StringUtils.isBlank(specimenNo)){ cro.setV_errCode(-1); cro.setV_errMsg("取样编号为空!!!"); return cro; } if(StringUtils.isBlank(designKey)){ cro.setV_errCode(-1); cro.setV_errMsg("订单号为空!!!"); return cro; } //删除 检验委托明细项目表 String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo+"' and t.item_flag = '1' "; mapper.delete(sql.toString()); //删除 检验委托明细表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo+"' and t.specimen_no= '"+specimenNo+"'" + " and t.batch_no = '"+batchNo+"' and t.item_flag = '1' "; mapper.delete(sql.toString()); //删除 试样号与合同信息关系表 sql = "DELETE QCM_JHY_SAMPLE_R_ORD t where t.design_key = '"+designKey+"' and t.smp_no = '"+smpNo+"' " + " and t.batch_no = '"+batchNo+"' and t.item_flag = '1' "; mapper.delete(sql.toString()); //删除 检验委托主表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_M t where t.smp_no = '"+smpNo+"' " + " and t.batch_no = '"+batchNo+"' and t.item_flag = '1' "; mapper.delete(sql.toString()); String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no like '"+specimenNo+"'"; List lists = mapper.query(sqlLog); for (HashMap list : lists) { QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(userName); qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString()); qjog.setOperate_type("撤销初样检验委托[复制]"); qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString()); qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString()); mapper.insertQcmJudgeOperateLog(qjog); } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("撤销失败![复制委托]"); return cro; } SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); cro.setV_errMsg("撤销复制委托成功!"); return cro; } /** * 复样 撤销复制当前委托一条 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject DoDelWtFy(String batchNo,String designKey,String smpNo,String specimenNo,String userName) throws Exception { try { if(StringUtils.isBlank(batchNo)){ cro.setV_errCode(-1); cro.setV_errMsg("轧批号为空!!!"); return cro; } if(StringUtils.isBlank(smpNo)){ cro.setV_errCode(-1); cro.setV_errMsg("试样号为空!!!"); return cro; } if(StringUtils.isBlank(specimenNo)){ cro.setV_errCode(-1); cro.setV_errMsg("取样编号为空!!!"); return cro; } if(StringUtils.isBlank(designKey)){ cro.setV_errCode(-1); cro.setV_errMsg("订单号为空!!!"); return cro; } //删除 检验委托明细项目表 String sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no= '"+specimenNo+"' and t.item_flag = '1' "; mapper.delete(sql.toString()); //删除 检验委托明细表 sql = "DELETE QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+smpNo+"' and t.specimen_no= '"+specimenNo+"'" + " and t.batch_no = '"+batchNo+"' and t.item_flag = '1' "; mapper.delete(sql.toString()); String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no like '"+specimenNo+"'"; List lists = mapper.query(sqlLog); for (HashMap list : lists) { QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(userName); qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString()); qjog.setOperate_type("撤销复样检验委托[复制]"); qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString()); qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString()); mapper.insertQcmJudgeOperateLog(qjog); } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("撤销复样委托失败![复制]"); return cro; } SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); cro.setV_errMsg("撤销复样委托成功![复制]"); return cro; } /** * 初样 新增当前复制委托一条 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject DoAddWtZy(String batchNo,String designKey,String smpNo,String specimenNo,String userName) throws Exception { try { String plineCode = ""; String inspectionLot = "";//检验号 String smp_no = "";//试样号 String specimen_no = "";//取样编号 String material_no = "";//取样材料号 if(StringUtils.isBlank(batchNo)){ cro.setV_errCode(-1); cro.setV_errMsg("轧批号为空!!!"); return cro; } if(StringUtils.isBlank(smpNo)){ cro.setV_errCode(-1); cro.setV_errMsg("试样号为空!!!"); return cro; } if(StringUtils.isBlank(specimenNo)){ cro.setV_errCode(-1); cro.setV_errMsg("取样编号为空!!!"); return cro; } if(StringUtils.isBlank(designKey)){ cro.setV_errCode(-1); cro.setV_errMsg("订单号为空!!!"); return cro; } //检验委托主表 String sql = "select * from QCM_JHY_SAMPLE_CONSIGN_M t where " + " t.smp_no = '"+smpNo+"' and t.batch_no = '"+batchNo+"' "; List SampleM=mapper.query(sql.toString()); if (SampleM == null || SampleM.size()<0) { cro.setV_errCode(-1); cro.setV_errMsg("检验委托主表未找到相应数据!!!"); return cro; } //D表 用来做中厚板子板复制 sql = ""; sql = "select t.freq_code from QCM_JHY_SAMPLE_CONSIGN_D t where " + " t.smp_no = '"+smpNo+"' and t.batch_no = '"+batchNo+"' " + " and t.specimen_no = '"+specimenNo+"' "; List SampleM2=mapper.query(sql.toString()); HashMap SampleMs = SampleM.get(0); //产线 热轧 连退 产线 需要修改检验号 plineCode = (String) SampleMs.get("PLINE_CODE"); if(plineCode.equals("RZ1") || plineCode.equals("LT1")){ sql = "select max(to_number(substr(t.inspection_lot,-3))) maxlot from QCM_JHY_SAMPLE_CONSIGN_M t where " + " t.batch_no = '"+batchNo+"' "; List maxInspectionLot=mapper.query(sql.toString()); BigDecimal cou = (BigDecimal)maxInspectionLot.get(0).get("MAXLOT"); String coun2 = cou.toString(); Integer integ2 = Integer.parseInt(coun2); String lotnum = integ2.toString(); if (lotnum ==null || "".equals(lotnum)) { if(plineCode.equals("RZ1")){ inspectionLot=batchNo+ String.format("%05d", 1);//轧批号+00001 }else if(plineCode.equals("LT1")){ inspectionLot=batchNo+ String.format("%03d", 1);//轧批号+001 } }else{ Integer lonums=Integer.parseInt(lotnum); lonums++; if(plineCode.equals("RZ1")){ inspectionLot=batchNo+ String.format("%05d", lonums);//轧批号+00001 }else if(plineCode.equals("LT1")){ inspectionLot=batchNo+ String.format("%03d", lonums);//轧批号+001 } } }else if(plineCode.equals("HB1") || plineCode.equals("ZB1")){ if(SampleM2.get(0).get("FREQ_CODE").equals("C")|| SampleM2.get(0).get("FREQ_CODE").equals("H")){//子板复制 sql = ""; sql = "select max(to_number(substr(t.inspection_lot,-3))) MAXLOT from QCM_JHY_SAMPLE_CONSIGN_D t where " + " t.batch_no = '"+batchNo+"' "; List SampleM3=mapper.query(sql.toString()); BigDecimal cou = (BigDecimal)SampleM3.get(0).get("MAXLOT"); String coun2 = cou.toString(); Integer integ2 = Integer.parseInt(coun2); String lotnum = integ2.toString(); if (lotnum ==null || "".equals(lotnum) || lotnum.equals("0")) { inspectionLot=batchNo+ String.format("%04d", 1);//轧批号+0001 }else{ Integer lonums=Integer.parseInt(lotnum); lonums++; inspectionLot=batchNo+ String.format("%04d", lonums);//轧批号+0001 } } } //生成试样信息主表 (检验委托主表) smp_no = createQltySamNo((String) SampleMs.get("PLINE_CODE")); JhySampleMMdoel model=getSampleM(smp_no,SampleMs,userName); if(plineCode.equals("RZ1") || plineCode.equals("LT1")){ model.setInspection_lot(inspectionLot);//卷板 修改检验号 }else if((plineCode.equals("HB1") || plineCode.equals("ZB1")) && (SampleM2.get(0).get("FREQ_CODE").equals("C")||SampleM2.get(0).get("FREQ_CODE").equals("H"))){ sql =""; if(plineCode.equals("HB1")){ //厚 sql+="select min(t.MATERIAL_NO) MATERIAL_NO from (select BILLETID as MATERIAL_NO from kch_turnofflist@xgcx where BILLETID like '"+batchNo+"'||'%' )t" + " where t.MATERIAL_NO not in " + "(select d.material_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.material_no like '"+batchNo + "%' and d.pline_code = '"+plineCode+"') "; }else if(plineCode.equals("ZB1")){ //中 sql+="select min(t.MATERIAL_NO) MATERIAL_NO from (select BILLETID as MATERIAL_NO from kcz_turnofflist@xgcx where BILLETID like '"+batchNo+"'||'%' )t" + " where t.MATERIAL_NO not in" + " (select d.material_no from QCM_JHY_SAMPLE_CONSIGN_D d where d.material_no like '"+batchNo + "%' and d.pline_code = '"+plineCode+"') "; } List SampleM3=mapper.query(sql.toString()); material_no = (String)SampleM3.get(0).get("MATERIAL_NO"); model.setMaterial_no(material_no);//取样材料号 model.setInspection_lot(inspectionLot);// 修改检验号 } mapper.insertSampleM(model); sql = ""; //试样号与合同信息关系表 sql = "select * from QCM_JHY_SAMPLE_R_ORD t where " + " t.DESIGN_KEY = '"+designKey+"' and t.smp_no = '"+smpNo+"' " + " and t.batch_no = '"+batchNo+"' "; List rord=mapper.query(sql.toString()); if (rord == null || rord.size()<0) { cro.setV_errCode(-1); cro.setV_errMsg("生成合同表未找到相应数据!!!"); return cro; } HashMap rords = rord.get(0); //生成合同表 JhySampleOrdMdoel ord=getSampleOrd(smp_no,rords,userName); if(plineCode.equals("RZ1") || plineCode.equals("LT1")){ ord.setInspection_lot(inspectionLot);//卷板 修改检验号 }else if((plineCode.equals("HB1") || plineCode.equals("ZB1")) && (SampleM2.get(0).get("FREQ_CODE").equals("C")|| SampleM2.get(0).get("FREQ_CODE").equals("H"))){ ord.setInspection_lot(inspectionLot);// 修改检验号 } mapper.insertSampleOrd(ord); sql = ""; //检验委托明细表 sql = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where " + " t.smp_no = '"+smpNo+"' and t.specimen_no = '"+specimenNo+"' and t.batch_no = '"+batchNo+"' "; List SampleD=mapper.query(sql.toString()); if (SampleD == null || SampleD.size()<0) { cro.setV_errCode(-1); cro.setV_errMsg("检验委托明细表未找到相应数据!!!"); return cro; } HashMap SampleDs = SampleD.get(0); specimen_no = createSpecimen_no(smp_no); JhySampleDModel modelD = getSampleD(smp_no,specimen_no, SampleDs); if(plineCode.equals("RZ1") || plineCode.equals("LT1")){ modelD.setInspection_lot(inspectionLot);//卷板 修改检验号 }else if((plineCode.equals("HB1") || plineCode.equals("ZB1")) && (SampleM2.get(0).get("FREQ_CODE").equals("C")||SampleM2.get(0).get("FREQ_CODE").equals("H"))){ modelD.setMaterial_no(material_no);//取样材料号 modelD.setInspection_lot(inspectionLot);// 修改检验号 String sqlzj = ""; sqlzj += " update zj_result_all@xgcx t set t.billetid_jy = '"+inspectionLot+"' "; sqlzj += " where t.billetid = '"+material_no+"' "; mapper.updateJudgeStatus(sqlzj.toString()); } mapper.insertSampleD(modelD); sql = ""; //检验委托明细项目表 sql = "select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where " + " t.smp_no = '"+smpNo+"' and t.specimen_no = '"+specimenNo+"' "; List SampleDitem=mapper.query(sql.toString()); if (SampleDitem == null || SampleDitem.size()<0) { cro.setV_errCode(-1); cro.setV_errMsg("检验委托明细项目表未找到相应数据!!!"); return cro; } for(HashMap map : SampleDitem){ //生成材质项目表 JhySampleDItemModel item=getSampleItem(smp_no,specimen_no,map,userName); mapper.insertSampleItem(item); } String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no like '"+specimenNo+"'"; List lists = mapper.query(sqlLog); for (HashMap list : lists) { QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(userName); qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString()); qjog.setOperate_type("复制初样检验委托"); qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString()); qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString()); //qjog.setMemo(zhyy); mapper.insertQcmJudgeOperateLog(qjog); } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("新增初样委托失败!"); return cro; } SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); cro.setV_errMsg("新增初样委托成功!"); return cro; } /** * 复样 新增当前复制委托一条 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject DoAddWtFy(String batchNo,String designKey,String smpNo,String specimenNo,String userName) throws Exception { try { String smp_no = "";//试样号 String specimen_no = "";//取样编号 if(StringUtils.isBlank(batchNo)){ cro.setV_errCode(-1); cro.setV_errMsg("轧批号为空!!!"); return cro; } if(StringUtils.isBlank(smpNo)){ cro.setV_errCode(-1); cro.setV_errMsg("试样号为空!!!"); return cro; } if(StringUtils.isBlank(specimenNo)){ cro.setV_errCode(-1); cro.setV_errMsg("取样编号为空!!!"); return cro; } if(StringUtils.isBlank(designKey)){ cro.setV_errCode(-1); cro.setV_errMsg("订单号为空!!!"); return cro; } String sql = ""; //检验委托明细表 sql = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where " + " t.smp_no = '"+smpNo+"' and t.specimen_no = '"+specimenNo+"' and t.batch_no = '"+batchNo+"' "; List SampleD=mapper.query(sql.toString()); if (SampleD == null || SampleD.size()<0) { cro.setV_errCode(-1); cro.setV_errMsg("检验委托明细表未找到相应数据!!!"); return cro; } HashMap SampleDs = SampleD.get(0); specimen_no = createSpecimen_no((String) SampleDs.get("SMP_NO")); JhySampleDModel modelD = getSampleD((String) SampleDs.get("SMP_NO"),specimen_no, SampleDs); mapper.insertSampleD(modelD); sql = ""; //检验委托明细项目表 sql = "select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where " + " t.smp_no = '"+smpNo+"' and t.specimen_no = '"+specimenNo+"' and t.fy_quote_specimen_no is null "; List SampleDitem=mapper.query(sql.toString()); if (SampleDitem == null || SampleDitem.size()<0) { cro.setV_errCode(-1); cro.setV_errMsg("检验委托明细项目表未找到相应数据!!!"); return cro; } for(HashMap map : SampleDitem){ smp_no = (String)map.get("SMP_NO"); //生成材质项目表 JhySampleDItemModel item=getSampleItem(smp_no,specimen_no,map,userName); mapper.insertSampleItem(item); } String sqlLog = "select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no like '"+specimenNo+"'"; List lists = mapper.query(sqlLog); for (HashMap list : lists) { QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(userName); qjog.setBatchno(list.get("BATCH_NO") == null ?"":list.get("BATCH_NO").toString()); qjog.setOperate_type("复制复样检验委托"); qjog.setParams(list.get("MATERIAL_NO") == null ?"":list.get("MATERIAL_NO").toString()); qjog.setProd_line(list.get("PLINE_CODE") == null ?"":list.get("PLINE_CODE").toString()); //qjog.setMemo(zhyy); mapper.insertQcmJudgeOperateLog(qjog); } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("新增复样委托失败!"); return cro; } SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); cro.setV_errMsg("新增复样委托成功!"); return cro; } /** * 创建试样号 * @param pline_code 产线代码 * @return */ private String createQltySamNo(String pline_code) { // TODO Auto-generated method stub String smp_no=""; SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd"); if (pline_code.length()>3){ pline_code=pline_code.substring(0,3); }else if (pline_code.length()==2){ pline_code="0"+pline_code; }else if (pline_code.length()==1){ pline_code="00"+pline_code; } String syh = pline_code +sdf.format(new Date()); StringBuffer sqlucomm = new StringBuffer(); sqlucomm.append("SELECT max(to_number(substr(smp_no,10))) SMP_NO FROM QCM_JHY_SAMPLE_CONSIGN_M WHERE SMP_NO like '"+syh+"%' "); HashMap result=mapper.queryOne(sqlucomm.toString()); BigDecimal seq=BigDecimal.ZERO; if (result!=null && result.get("SMP_NO")!=null ) { seq=(BigDecimal)result.get("SMP_NO"); } seq=seq.add(BigDecimal.ONE); smp_no=syh+ String.format("%04d", seq.intValue()); return smp_no; } /** * 获取取样编号 * * @param smp_no * @return */ private String createSpecimen_no(String smp_no) { // TODO Auto-generated method stub String specimen_no = ""; StringBuffer sqlucomm = new StringBuffer(); sqlucomm.append("SELECT max(to_number(substr(SPECIMEN_NO,14))) SPECIMEN_NO FROM QCM_JHY_SAMPLE_CONSIGN_D " + "WHERE SPECIMEN_NO like '" + smp_no + "%' and SMP_NO='" + smp_no + "'"); HashMap result = mapper.queryOne(sqlucomm.toString()); BigDecimal seq = BigDecimal.ZERO; if (result != null && result.get("SPECIMEN_NO") != null) { seq = (BigDecimal) result.get("SPECIMEN_NO"); } seq = seq.add(BigDecimal.ONE); specimen_no = smp_no + String.format("%02d", seq.intValue()); return specimen_no; } /** * 设置试样信息主表对象值 * @param smp_no * @param qlty * @param smp_catg * @return */ private JhySampleMMdoel getSampleM(String smp_no, HashMap qlty,String userName) { // TODO Auto-generated method stub JhySampleMMdoel model=new JhySampleMMdoel(); model.setSmp_no(smp_no); model.setHeat_no((String) qlty.get("HEAT_NO")); model.setBatch_no((String) qlty.get("BATCH_NO")); model.setInspection_lot((String) qlty.get("INSPECTION_LOT")); model.setBoard_no((String) qlty.get("BOARD_NO")); model.setMaterial_no((String) qlty.get("MATERIAL_NO")); model.setPsc((String) qlty.get("PSC")); model.setPsc_desc((String) qlty.get("PSC_DESC")); model.setSmp_catg((String) qlty.get("SMP_CATG")); model.setCert_inst_code((String) qlty.get("CERT_INST_CODE")); model.setCert_inst_name((String) qlty.get("CERT_INST_NAME")); //试样类型 model.setSmp_type_code((String) qlty.get("SMP_TYPE_CODE")); model.setSmp_type_name((String) qlty.get("SMP_TYPE_NAME")); model.setGrade_code((String) qlty.get("GRADE_CODE")); model.setGrade_name((String) qlty.get("GRADE_NAME")); model.setPline_code((String) qlty.get("PLINE_CODE")); model.setPline_name((String) qlty.get("PLINE_NAME")); model.setCreate_id((String) qlty.get("CREATE_ID")); model.setCreate_name(userName); model.setCreate_time(new Date()); model.setItem_flag("1");//人工 return model; } /** * 设置试样信息明细表对象值 * @param smp_no * @param qlty * @return */ private JhySampleOrdMdoel getSampleOrd(String smp_no, HashMap qlty,String userName) { // TODO Auto-generated method stub JhySampleOrdMdoel ord=new JhySampleOrdMdoel(); ord.setSmp_no(smp_no); ord.setDesign_key((String) qlty.get("DESIGN_KEY")); ord.setPsc((String) qlty.get("PSC")); ord.setPsc_desc((String) qlty.get("PSC_DESC")); ord.setHeat_no((String) qlty.get("HEAT_NO")); ord.setBatch_no((String) qlty.get("BATCH_NO")); ord.setInspection_lot((String) qlty.get("INSPECTION_LOT")); ord.setDelivery_state_code((String) qlty.get("DELIVERY_STATE_CODE")); ord.setDelivery_state_desc((String) qlty.get("DELIVERY_STATE_DESC")); ord.setThick((String) qlty.get("THICK")); ord.setWidth((String) qlty.get("WIDTH")); ord.setLength((String) qlty.get("LENGTH")); ord.setPline_code((String) qlty.get("PLINE_CODE")); ord.setPline_name((String) qlty.get("PLINE_NAME")); ord.setMsc_pline((String) qlty.get("MSC_PLINE")); ord.setProcess_code((String) qlty.get("PROCESS_CODE")); ord.setCert_inst_code((String) qlty.get("CERT_INST_CODE")); ord.setCert_inst_name((String) qlty.get("CERT_INST_NAME")); ord.setSmp_type_code((String) qlty.get("SMP_TYPE_CODE")); ord.setSmp_type_name((String) qlty.get("SMP_TYPE_NAME")); ord.setProduct_cnt((BigDecimal) qlty.get("PRODUCT_CNT")); ord.setProd_code((String) qlty.get("PROD_CODE")); ord.setProd_name((String) qlty.get("PROD_NAME")); ord.setSteel_code((String) qlty.get("STEEL_CODE")); ord.setSteel_name((String) qlty.get("STEEL_NAME")); ord.setStd_code((String) qlty.get("STD_CODE")); ord.setStd_name((String) qlty.get("STD_NAME")); ord.setCreate_id((String) qlty.get("CREATE_ID")); ord.setCreate_name(userName); ord.setCreate_time(new Date()); ord.setItem_flag("1"); return ord; } /** * QCM_JHY_SAMPLE_CONSIGN_D 检验委托明细表 赋值 * * @param smp_no * @return */ private JhySampleDModel getSampleD(String smp_no,String specimen_no, HashMap result) { // TODO Auto-generated method stub JhySampleDModel model = new JhySampleDModel(); model.setSmp_no(smp_no); model.setSpecimen_no(specimen_no); model.setHeat_no((String) result.get("HEAT_NO")); model.setBatch_no((String) result.get("BATCH_NO")); model.setInspection_lot((String) result.get("INSPECTION_LOT")); model.setFreq_code((String) result.get("FREQ_CODE")); model.setFreq_name((String) result.get("FREQ_NAME")); model.setMaterial_no((String) result.get("MATERIAL_NO"));// 取样材料号 // 样品类型 model.setSmp_type_code((String) result.get("SMP_TYPE_CODE")); model.setSmp_type_name((String) result.get("SMP_TYPE_NAME")); // 试验次数 model.setTest_qty((BigDecimal) result.get("TEST_QTY")); model.setSmp_qty((BigDecimal) result.get("SMP_QTY")); model.setSmp_location((String) result.get("SMP_LOCATION")); model.setBoard_no((String) result.get("BOARD_NO")); model.setQuote_consign_no((String) result.get("QUOTE_CONSIGN_NO")); // 初样取样编号 model.setOld_consign_no((String) result.get("OLD_CONSIGN_NO")); model.setPline_code((String) result.get("PLINE_CODE")); model.setPline_name((String) result.get("PLINE_NAME")); model.setStatus("0"); model.setValidflag("1"); model.setSource((String) result.get("SOURCE")); model.setGuid(this.getUUID()); model.setChem_item((String) result.get("CHEM_ITEM")); model.setProduct_cnt((BigDecimal) result.get("PRODUCT_CNT")); model.setSmp_location_code((String) result.get("SMP_LOCATION_CODE")); model.setMemo((String) result.get("MEMO")); model.setWeight((String)result.get("WEIGHT")); model.setWeight_std((String)result.get("WEIGHT_STD")); model.setWeight_sfd((String)result.get("WEIGHT_SFD")); model.setItem_flag("1"); return model; } /** * 获取材质项目对象 * @param smp_no * @param specimen_no * @param qlty * @return * @throws Exception */ private JhySampleDItemModel getSampleItem(String smp_no, String specimen_no, HashMap qlty,String userName) throws Exception { JhySampleDItemModel model=new JhySampleDItemModel(); model.setSmp_no(smp_no); model.setSpecimen_no(specimen_no); model.setSeq(createItemSeq(smp_no,specimen_no)); model.setPhy_code_l((String)qlty.get("PHY_CODE_L"));; model.setPhy_code_m((String)qlty.get("PHY_CODE_M")); model.setPhy_code_s((String)qlty.get("PHY_CODE_S")); model.setPhy_name_l((String)qlty.get("PHY_NAME_L")); model.setPhy_name_m((String)qlty.get("PHY_NAME_M")); model.setPhy_name_s((String)qlty.get("PHY_NAME_S")); model.setItem_code_d((String)qlty.get("ITEM_CODE_D")); model.setItem_code_t((String)qlty.get("ITEM_CODE_T")); model.setItem_code_s((String)qlty.get("ITEM_CODE_S")); model.setItem_code_l((String)qlty.get("ITEM_CODE_L")); model.setItem_name_d((String)qlty.get("ITEM_NAME_D")); model.setItem_name_t((String)qlty.get("ITEM_NAME_T")); model.setItem_name_s((String)qlty.get("ITEM_NAME_S")); model.setItem_desc_l((String)qlty.get("ITEM_DESC_L")); model.setStdmax((String)qlty.get("STDMAX")); model.setStdmax_sign((String)qlty.get("STDMAX_SIGN")); model.setStdmin((String)qlty.get("STDMIN")); model.setStdmin_sign((String)qlty.get("STDMIN_SIGN")); //试验次数 model.setTest_qty((BigDecimal) qlty.get("TEST_QTY")); model.setSmp_qty((BigDecimal) qlty.get("SMP_QTY")); model.setSpecl_fl((String)qlty.get("SPECL_FL")); model.setIsjudge((String)qlty.get("ISJUDGE")); model.setPhy_unit((String)qlty.get("PHY_UNIT")); model.setGroup_seq((String)qlty.get("GROUP_SEQ")); model.setQuote_specimen_no((String)qlty.get("QUOTE_SPECIMEN_NO")); model.setQuote_seq((Integer)qlty.get("QUOTE_SEQ")); model.setMemo((String)qlty.get("MEMO")); model.setCreate_id((String)qlty.get("CREATE_ID")); model.setCreate_name(userName); model.setCreate_time(new Date()); model.setStdmemo((String)qlty.get("STDMEMO")); model.setPhy_group_code((String)qlty.get("PHY_GROUP_CODE")); model.setResmp_seq((String)qlty.get("RESMP_SEQ")); model.setItem_flag("1"); //样品类型 return model; } /** * 生成不带 "-" 的UUID * * @return */ private String getUUID() { UUID uuid = UUID.randomUUID(); String str = uuid.toString(); String uuidStr = str.replace("-", ""); return uuidStr; } /** * 创建项目seq * * @param specimen_no * @param smp_no * @param cn * @return * @throws Exception */ private Integer createItemSeq(String smp_no, String specimen_no) throws Exception { StringBuffer sqlucomm = new StringBuffer(); sqlucomm.append("SELECT max(SEQ) SEQ FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM WHERE SMP_NO ='" + smp_no + "' and SPECIMEN_NO='" + specimen_no + "'"); HashMap result = mapper.queryOne(sqlucomm.toString()); Integer SEQ = 0; if (result != null && result.get("SEQ") != null) { SEQ = ((BigDecimal) result.get("SEQ")).intValue(); } SEQ++; return SEQ; } /** * 不同订单 同轧批号 项目一样引用 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject DoQuoteBatchNo(HashMap parmas) throws Exception { try { String strSql=" and r.CERT_INST_CODE !='IC005' ";//美国船级社不能被引用 //判断是否是模拟焊后 模拟焊后不可引用 231201上午开会决定的 String mlhSql="select t.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r " + " where t.smp_no = r.smp_no and r.design_key not like '19%' " + " and t.smp_no = '"+parmas.get("SMP_NO")+"' and t.SMP_LOCATION like '%模拟焊后%' and rownum <= 1 "; HashMap resultMlh = mapper.queryOne(mlhSql.toString()); if(resultMlh != null && resultMlh.size()>=1){ String msgmemo="订单号:"+parmas.get("DESIGN_KEY")+"下的轧批号:"+parmas.get("BATCH_NO")+"委托需全部下发实绩样委托!请核实数据"; SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("引用失败!当前轧批订单号下有模拟焊后标准,技术中心规定订单号下有模拟焊后标准不可引用需送实物样,"+msgmemo); return cro; } //厚板是手动选择,中板自动 小于等于-40度冲击都单独送样做 if(parmas.get("PLINE_CODE").equals("ZB1")){ String zbSql = " select i.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r,qcm_jhy_sample_consign_d_item i " +" where t.smp_no = r.smp_no and t.specimen_no = i.specimen_no and r.smp_no = i.smp_no and i.phy_code_l = 'HC' " +" and r.design_key not like '19%' and to_number(REGEXP_REPLACE(i.item_code_t,'[^-0-9]','')) <= -40 " +" and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and rownum <= 1 "; HashMap hmapZb = mapper.queryOne(zbSql.toString()); if(hmapZb != null && hmapZb.size()>=1){ String msgmemo="订单号:"+parmas.get("DESIGN_KEY")+"轧批号:"+parmas.get("BATCH_NO"); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("引用失败!勾选的轧批中有冲击项目并且是小于等于-40度不可引用需要下发委托,"+msgmemo); return cro; } } String MATERIAL_NO = "1"; String smpLocationCode = ""; String CERT_INST_CODE = ""; String FREQ_CODE = ""; String sql=""; sql = " select r.CERT_INST_CODE,t.* from QCM_JHY_SAMPLE_CONSIGN_D t, qcm_jhy_sample_r_ord r" + " where t.smp_no = r.smp_no and t.SPECIMEN_NO='"+parmas.get("SPECIMEN_NO")+"' and rownum <= 1"; HashMap resultM = mapper.queryOne(sql.toString()); if(resultM != null && resultM.size()>=1){ MATERIAL_NO = resultM.get("MATERIAL_NO").toString(); smpLocationCode = resultM.get("SMP_LOCATION_CODE").toString(); CERT_INST_CODE = resultM.get("CERT_INST_CODE").toString(); FREQ_CODE = resultM.get("FREQ_CODE").toString(); } //记录 QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(parmas.get("CREATE_NAME")== null ?"":parmas.get("CREATE_NAME").toString()); qjog.setBatchno(parmas.get("BATCH_NO") == null ?"":parmas.get("BATCH_NO").toString()); qjog.setOperate_type("引用同批实绩"); qjog.setParams(MATERIAL_NO == null ?"":MATERIAL_NO); qjog.setProd_line(parmas.get("PLINE_CODE") == null ?"":parmas.get("PLINE_CODE").toString()); qjog.setMemo(parmas.get("SPECIMEN_NO").toString()); mapper.insertQcmJudgeOperateLog(qjog); //19订单引用 String dkey = parmas.get("DESIGN_KEY").toString().substring(0, 2); if("19".equals(dkey)){//19订单 parmas.put("DESIGN_KEY", parmas.get("DESIGN_KEY").toString()); if(parmas.get("SEND_ID").equals("1")){ parmas.put("SEND_ID", "系统自动"); parmas.put("CREATE_NAME", "系统自动"); } String ret = DoQuoteBatchNo191(parmas); if(!ret.equals("1")){ SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("引用失败!"+ret); return cro; } SqlSession.close(); cro.setV_errCode(1); cro.setV_errMsg("引用成功!"); return cro; } //复样引用 if(parmas.get("SMP_TYPE_CODE").toString().equals("1")){ String ret = DoQuoteBatchNoFy(parmas); if(!ret.equals("1")){ SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("引用失败!"+ret); return cro; } SqlSession.close(); cro.setV_errCode(1); cro.setV_errMsg("引用成功!"); return cro; } //判断是否是船检 String strAgent=""; String strZ="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no " +" and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and r.Cert_Inst_Code in ('IC002','IC005','IC006','IC007','IC009','IC008') and rownum <= 1"; HashMap hmZ=mapper.queryOne(strZ.toString()); if(hmZ!=null && hmZ.size()>=1){ //同牌号同规格 strAgent = " and r.steel_code = '"+hmZ.get("STEEL_CODE")+"' and r.thick = '"+hmZ.get("THICK")+"' and r.CERT_INST_CODE != '5000' "; } //引用中有两条委托 两条委托中都有冲击 而冲击温度不一样 String HCSTR="0"; HashMap result=null; sql =""; sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.PHY_CODE_L='HC' "; List hmHC=mapper.query(sql.toString()); if(hmHC!=null && hmHC.size()>=1){ String nuowei = ""; if("IC001".equals(CERT_INST_CODE)){//判断是否是挪威 挪威冲击温度一致可引用 nuowei =" and i.Item_Code_t = '"+hmHC.get(0).get("ITEM_CODE_T")+"' "; HCSTR="1"; } if(FREQ_CODE.equals("C") || FREQ_CODE.equals("H") || FREQ_CODE.equals("I")){ nuowei +=" and t.MATERIAL_NO = '"+MATERIAL_NO+"' "; } sql=""; sql="select t.* from qcm_jhy_sample_r_ord r,qcm_jhy_sample_consign_d t,qcm_jhy_sample_consign_d_item i " +" where t.smp_no = r.smp_no and t.specimen_no = i.specimen_no and i.seq<=49 and i.Item_Code_t <= '"+hmHC.get(0).get("ITEM_CODE_T")+"' " +" and t.batch_no = '"+parmas.get("BATCH_NO")+"' and i.Phy_Code_l='HC' and t.status='3' and t.freq_code <> 'D' and t.CHEM_ITEM is null " +" and t.smp_type_code = '0' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' and t.SMP_LOCATION_CODE='"+smpLocationCode+"' " +" and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') " + strAgent + strSql +nuowei +" order by Item_Code_t asc "; List hmHC2=mapper.query(sql.toString()); if(hmHC2!=null && hmHC2.size()>=1){ sql =""; sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no = '"+hmHC2.get(0).get("SPECIMEN_NO")+"' and rownum <= 1 "; result=null; result = mapper.queryOne(sql.toString()); HCSTR="1"; } } if("0".equals(HCSTR)){ //同子板引用 sql =""; sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' " +" and t.freq_code <> 'D' and CHEM_ITEM is null and t.MATERIAL_NO = '"+MATERIAL_NO+"' and t.SMP_LOCATION_CODE='"+smpLocationCode+"' " +" and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') " + strAgent + strSql +" and rownum <= 1 order by t.send_time asc "; result=null; result = mapper.queryOne(sql.toString()); //同订单引用 if(result == null || result.size()<=0){ sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' and t.freq_code <> 'D' " +" and t.CHEM_ITEM is null and r.DESIGN_KEY = '"+parmas.get("DESIGN_KEY")+"' " + strAgent + strSql +" and rownum <= 1 order by t.send_time asc "; result=null; result = mapper.queryOne(sql.toString()); //同规格同牌号 if(result == null || result.size()<=0){ sql =""; sql = "select * from (select * from (" + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* " + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' and t.SMP_LOCATION_CODE='"+smpLocationCode+"' " +" and t.freq_code <> 'D' and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = '"+parmas.get("THICK")+"' " + strSql +" and r.steel_name = '"+parmas.get("STEEL_NAME")+"' ) t order by t.nums desc) t where rownum=1 "; result=null; result = mapper.queryOne(sql.toString()); //同规格引用 if(result == null || result.size()<=0){ sql =""; sql = "select * from (select * from (" +" select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* " +" from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' and t.SMP_LOCATION_CODE='"+smpLocationCode+"' " +" and t.freq_code <> 'D' and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = '"+parmas.get("THICK")+"' " + strAgent + strSql +" ) t order by t.nums desc) t where rownum=1 "; result=null; result = mapper.queryOne(sql.toString()); //随机引用 if((result == null || result.size()<=0) && strAgent.length()<=0){ sql=""; sql = "select * from (select * from (select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums, t.* " + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r where t.smp_no = r.smp_no " + strSql + " and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " + " and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' " + " and t.freq_code <> 'D' and t.CHEM_ITEM is null ) t order by t.nums desc) t where rownum=1 "; result=null; result = mapper.queryOne(sql.toString()); } } } } } if (result != null && result.size()>=1) { //判断厚度是否大于引用的厚度 sql =""; sql = "select to_char(t.THICK, 'fm990.099') THICK,t.* from Qcm_Jhy_Sample_r_Ord t where t.SMP_NO = '"+result.get("SMP_NO")+"' and rownum <= 1 "; List OrdLists=mapper.query(sql.toString()); if(OrdLists!=null && OrdLists.size()>=1){ String thick2 = OrdLists.get(0).get("THICK").toString(); String thick = parmas.get("THICK").toString(); if(!thick2.equals(thick)){ SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("引用失败!规格不一样"); return cro; } } //查询引用的所有明细 240308增加代码 and t.specl_fl <> '4' 把加项项目排除 sql =""; sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.specl_fl <> '4' "; List qltyLists=mapper.query(sql.toString()); List qltyLists2=null; //查询是否有LRA加项项目 sql=""; sql="select * from qcm_jhy_sample_consign_d_item i where i.specimen_no = '"+result.get("SPECIMEN_NO")+"' and i.specl_fl = '4' and i.phy_code_l='HC' "; List qltyLRA=mapper.query(sql.toString()); if(qltyLRA!=null && qltyLRA.size()>=1){ //查询被引用的所有明细 sql =""; sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' and t.quote_specimen_no is null and t.phy_code_l<>'HC' "; qltyLists2=mapper.query(sql.toString()); }else{ //查询被引用的所有明细 sql =""; sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' and t.quote_specimen_no is null "; qltyLists2=mapper.query(sql.toString()); } Integer bQuote = qltyLists.size();//引用 Integer yQuote = qltyLists2.size();//被引用 int quotenum = 0;//已引用数据 String hbB01 ="";//弯曲 //引用 for (int i = 0; i < qltyLists.size(); i++) {//引用在外层循环 对比 引用中有没有相应的项目有 插入 if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){ hbB01 ="0"; }else{ hbB01 =""; } //代码 String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码 String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码 String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码 String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码 String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用 String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码 //名称 String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码 String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码 String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码 String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码 String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用 String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码 String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码 String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L"); BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ"); String bigdjs = seq.toString(); Integer bigd4 = Integer.parseInt(bigdjs); String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS; newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null"); newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null"); newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null"); //newItem=newItem+"-"+(itemCodeL!=null?itemCodeL:"null"); //弯曲 ///// String newItemHB=phyCodeL+"-"+phyCodeM+"-"+phyCodeS+"-"+(itemCodeD!=null?itemCodeD:"null")+"-"+(itemCodeT!=null?itemCodeT:"null"); //被引用 for (HashMap hashMap : qltyLists2) { //代码 String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码 String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码 String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码 String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码 String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用 String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码 String itemCodeL2 = (String) hashMap.get("ITEM_CODE_L");//试验位置代码 String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2; newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null"); newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null"); newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null"); //newItem2=newItem2+"-"+(itemCodeL2!=null?itemCodeL2:"null"); //弯曲 ///// String newItemHB2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2+"-"+(itemCodeD2!=null?itemCodeD2:"null")+"-"+(itemCodeT2!=null?itemCodeT2:"null"); //判断是否是冲击试验 if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){ if(phyCodeS.equals(phyCodeS2)){ Integer co1t= Integer.parseInt(itemCodeT);//引用 Integer co2t= Integer.parseInt(itemCodeT2);//被引用 if(co1t >= co2t){ sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; break; } } }/*else if (phyCodeS.equals("B01")){//弯曲试验 冷弯(面弯)试验///// //标准一样的引用 if(newItemHB.equals(newItemHB2)){ sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; hbB01 ="1"; break; } }*/else{//其它试验 //标准一样的引用 if(newItem.equals(newItem2)){ sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; break; } } } //申报:郭明清 主题:非计划船板改普板,冷弯需要系统默认合格 申报时间:2023-04-27 16:49:59 //原牌号为船板 BV/IC003法国船级社,KR/IC004韩国船级社,DNV/IC001挪威船级社,CCS/IC010中国船级社 、ABS/IC005美国船级社、LR/IC009 英国船级社、NK/KA36/IC006 日本船级社、RINA/IC007 意大利船级社 、RS/IC002 俄罗斯 IC012 客户认证 //改成普锰板(Q235A/B、Q345A/B、Q355B) //被引用是原牌号船板 引用是改判 普锰板 //弯曲 默认合格 if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){ sql=""; sql="select d.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r " +" where d.smp_no = r.smp_no and r.steel_code in ('Q235A','Q235B','Q345A','Q345B','Q355B') " +" and d.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "; List hashMap=mapper.query(sql.toString()); if(hashMap!=null && hashMap.size()>=1){ sql=""; sql="select r.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r " +" where d.smp_no = r.smp_no and r.cert_inst_code in ('IC005','IC009','IC006','IC007','IC002','IC003','IC004','IC001','IC010') " +" and d.specimen_no = '"+result.get("SPECIMEN_NO")+"' "; List hashMap2=mapper.query(sql.toString()); //船板没有弯曲 sql=""; sql="select * from qcm_jhy_sample_consign_d_item where specimen_no = '"+result.get("SPECIMEN_NO")+"' and phy_code_s='B01' "; List hashMap3=mapper.query(sql.toString()); if(hashMap2!=null && hashMap2.size()>=1 && hashMap3.size()<=0 ){ sql=""; sql="insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, " +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) " +" select t.specimen_no,t.seq,t.test_qty,t.phy_code_l,t.phy_name_l,t.phy_code_m,t.phy_name_m,t.phy_code_s,t.phy_name_s,t.item_code_d,t.item_name_d, " +" t.item_code_t,t.item_name_t,t.item_code_s,t.item_name_s,'合格','合格','"+parmas.get("CREATE_NAME")+"',sysdate,'0','合格','合格',t.item_code_l,t.item_desc_l, " +" t.phy_unit,'默认合格' " +" from qcm_jhy_sample_consign_d_item t " +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' " +" and t.phy_code_s = 'B01' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; } } } } //被引用的项目 全部 已引用 if(quotenum == qltyLists.size()){ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"'," + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); //往log表中插入p sql = ""; sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) " +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')"; mapper.insert(sql); }else{ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); } }else{ SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("该轧批未返回实绩或没有引用的对象!请在委托记录中核实相应委托数据"); return cro; } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("引用失败!"+e.getMessage()); return cro; } SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); cro.setV_errMsg("引用成功!"); return cro; } /** * 19订单自动引用 不同订单 同轧批号 项目一样引用 * @param materialInfo * @return * @throws Exception */ public void DoQuoteBatchNo19(HashMap parmas) throws Exception { SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession(); mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class); try { String chiStr = ""; String process_nos=""; String pno1=""; String pno2=""; String pno3=""; if(parmas.get("CREATE_NAME").equals("调试人员")){ parmas.put("SEND_ID", "系统自动"); parmas.put("CREATE_NAME", "系统自动"); } //判断是否按子板取样 19订单 String chi = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and rownum <= 1 "; List CHILists=mapper.query(chi.toString()); if(CHILists != null && CHILists.size()>=1 ){ process_nos=CHILists.get(0).get("PROCESS_NOS").toString(); if(CHILists.get(0).get("FREQ_CODE").equals("C") || CHILists.get(0).get("FREQ_CODE").equals("H") || CHILists.get(0).get("FREQ_CODE").equals("I")){ chiStr = " and t.MATERIAL_NO = '"+CHILists.get(0).get("MATERIAL_NO")+"' "; } } pno1=process_nos.substring(0, 1);//第一位 pno2=process_nos.substring(3, 4);//第四位 pno3=process_nos.substring(4, 5);//第五位 String sql =""; sql = "select * from (select * from (" + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no AND i.Phy_Code_l <> 'HJ') nums,t.* " + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status = '3' and t.freq_code <> 'D' and t.CHEM_ITEM is null " +" and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') and r.DESIGN_KEY not like '19%' " + chiStr +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' " +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' " +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' " + " ) t where t.nums !=0 order by t.nums desc) t where rownum=1 "; HashMap result = mapper.queryOne(sql.toString()); if(result==null || result.size()<=0){ sql = "select t.* from (select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no AND i.Phy_Code_l <> 'HJ') nums, t.* from QCM_JHY_SAMPLE_CONSIGN_D t " +" where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status = '3' " +" and t.freq_code <> 'D' and CHEM_ITEM is null " +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' " +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' " +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' " +" and rownum <= 1 order by t.send_time asc ) t where t.nums != 0"; result=null; result = mapper.queryOne(sql.toString()); } if (result != null && result.size()>=1) { //判断厚度是否大于引用的厚度 sql =""; sql = "select To_Number(t.thick) thick from Qcm_Jhy_Sample_r_Ord t where t.SMP_NO = '"+result.get("SMP_NO")+"' and rownum <= 1 "; List OrdLists=mapper.query(sql.toString()); if(OrdLists!=null && OrdLists.size()>=1 && !StringUtils.isBlank(OrdLists.get(0).get("THICK").toString())){ String hmap2 = OrdLists.get(0).get("THICK").toString(); double thick1 = Double.parseDouble(hmap2); String thick = parmas.get("THICK").toString(); double thick2 = Double.parseDouble(thick); if(thick2>thick1){ String str =thick2+">"+thick1; //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '19订单委托厚度大于引用厚度不可引用:'||'"+str+"' ,t.ARTIFICIAL_MEMO='0' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); SqlSession.commit(); SqlSession.close(); return;//被引用不能大于引用 } if((thick1-thick2)>=3){ String str =thick2+"<"+thick1; sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '19订单委托厚度小于引用厚度不可超过2mm,超过2mm不可引用:'||'"+str+"' ,t.ARTIFICIAL_MEMO='0' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); SqlSession.commit(); SqlSession.close(); return;//引用-被引用不能大于等于3 小2mm } } //查询被引用的所有明细 sql =""; sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "; List qltyLists=mapper.query(sql.toString()); //查询引用的所有明细 sql =""; sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' " + " and t.quote_specimen_no is null and t.VAL1 is not null and t.create_name <>'现场默认' "; List qltyLists2=mapper.query(sql.toString()); Integer bQuote = qltyLists.size();//被引用 Integer yQuote = qltyLists2.size();//引用 int quotenum = 0;//已引用数据 String hbB01 ="";//弯曲 //被引用 for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入 if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){ hbB01 ="0"; }else{ hbB01 =""; } //代码 String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码 String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码 String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码 String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码 String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用 String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码 //名称 String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码 String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码 String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码 String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码 String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用 String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码 String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码 String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L"); BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ"); String bigdjs = seq.toString(); Integer bigd4 = Integer.parseInt(bigdjs); String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS; newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null"); newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null"); newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null"); //引用 for (HashMap hashMap : qltyLists2) { //代码 String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码 String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码 String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码 String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码 String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用 String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码 String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2; newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null"); newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null"); newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null"); //判断是否是冲击试验 if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){ if(phyCodeS.equals(phyCodeS2)){ double co1t = Double.valueOf(itemCodeT); double co2t = Double.valueOf(itemCodeT2); //Integer co1t= Integer.parseInt(itemCodeT);//被引用 //Integer co2t= Integer.parseInt(itemCodeT2);//引用 if(co1t >= co2t){ sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; break; } } }else{//其它试验 //标准一样的引用 if(newItem.equals(newItem2)){ sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; if("B01".equals(phyCodeS2) && "B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){ hbB01="1"; } break; } } } //中厚板非计划处置维护 袁传泉 2023-11-07 10:47:23 if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){ sql=""; sql="insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, " +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) " +" select t.specimen_no,t.seq,t.test_qty,t.phy_code_l,t.phy_name_l,t.phy_code_m,t.phy_name_m,t.phy_code_s,t.phy_name_s,t.item_code_d,t.item_name_d, " +" t.item_code_t,t.item_name_t,t.item_code_s,t.item_name_s,'合格','合格','"+parmas.get("CREATE_NAME")+"',sysdate,'0','合格','合格',t.item_code_l,t.item_desc_l, " +" t.phy_unit,'默认合格' " +" from qcm_jhy_sample_consign_d_item t " +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' " +" and t.phy_code_s = 'B01' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; } //申报:郭明清 主题:非计划船板改普板,冷弯需要系统默认合格 申报时间:2023-04-27 16:49:59 //原牌号为船板 BV/IC003法国船级社,KR/IC004韩国船级社,DNV/IC001挪威船级社,CCS/IC010中国船级社 、ABS/IC005美国船级社、LR/IC009 英国船级社、NK/KA36/IC006 日本船级社、RINA/IC007 意大利船级社 、RS/IC002 俄罗斯 IC012 客户认证 //改成普锰板(Q235A/B、Q345A/B、Q355B) //被引用是原牌号船板 引用是改判 普锰板 //弯曲 默认合格 /*if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){ sql=""; sql="select d.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r " +" where d.smp_no = r.smp_no and r.steel_code in ('Q235A','Q235B','Q345A','Q345B','Q355B') " +" and d.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "; List hashMap=mapper.query(sql.toString()); if(hashMap!=null && hashMap.size()>=1){ sql=""; sql="select r.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r " +" where d.smp_no = r.smp_no and r.cert_inst_code in ('IC005','IC009','IC006','IC007','IC002','IC003','IC004','IC001','IC010') " +" and d.specimen_no = '"+result.get("SPECIMEN_NO")+"' "; List hashMap2=mapper.query(sql.toString()); //船板没有弯曲 sql=""; sql="select * from qcm_jhy_sample_consign_d_item where specimen_no = '"+result.get("SPECIMEN_NO")+"' and phy_code_s='B01' "; List hashMap3=mapper.query(sql.toString()); if(hashMap2!=null && hashMap2.size()>=1 && hashMap3.size()<=0 ){ sql=""; sql="insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, " +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) " +" select t.specimen_no,t.seq,t.test_qty,t.phy_code_l,t.phy_name_l,t.phy_code_m,t.phy_name_m,t.phy_code_s,t.phy_name_s,t.item_code_d,t.item_name_d, " +" t.item_code_t,t.item_name_t,t.item_code_s,t.item_name_s,'合格','合格','"+parmas.get("CREATE_NAME")+"',sysdate,'0','合格','合格',t.item_code_l,t.item_desc_l, " +" t.phy_unit,'默认合格' " +" from qcm_jhy_sample_consign_d_item t " +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' " +" and t.phy_code_s = 'B01' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; } } }*/ } //19HJGP 不自动下发 sql=""; sql="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r " + " where t.smp_no = r.smp_no and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and r.design_key like '19HJGP%' and rownum=1 "; HashMap resultHJGP = mapper.queryOne(sql.toString()); if(resultHJGP!=null && resultHJGP.size()>=1){ if(quotenum == qltyLists.size()){ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"'," + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); //往log表中插入p sql = ""; sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) " +" VALUES ( 'P', '"+resultHJGP.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')"; mapper.insert(sql); }else if(quotenum==0){ sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '未找到一项可以引用的项目,订单标准全部不一样' ,t.ARTIFICIAL_MEMO='0' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); }else{ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' , t.ARTIFICIAL_MEMO='0', " + " t.ONEMEMO ='需下发委托' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); } }else{ //被引用的项目 全部 已引用 if(quotenum!=0){ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"'," + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); //往log表中插入p sql = ""; sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) " +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')"; mapper.insert(sql); }else if(quotenum==0){ sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '未找到一项可以引用的项目,订单标准全部不一样' ,t.ARTIFICIAL_MEMO='0' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); } } }else{ sql=""; sql = "select * from (select * from (" + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* " + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status in('0','2','7') " +" and t.freq_code <> 'D' and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') " +" and r.DESIGN_KEY not like '19%' " +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' " +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' " +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' " + ") t order by t.nums desc) t where rownum=1 "; result=null; result = mapper.queryOne(sql.toString()); if(result==null || result.size()<=0){ sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status in('0','2','7') " +" and t.freq_code <> 'D' and r.DESIGN_KEY not like '19%' and CHEM_ITEM is null " +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' " +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' " +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' " +" and rownum <= 1 order by t.send_time asc "; result=null; result = mapper.queryOne(sql.toString()); } if (result != null && result.size()>=1) { sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '力学性能实绩未返回或未下发委托,请等实绩返回人工引用' ,t.ARTIFICIAL_MEMO='1' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); }else{ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '没有找到相应力学性能委托' ,t.ARTIFICIAL_MEMO='0' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); } } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); } SqlSession.commit(); SqlSession.close(); } public String DoQuoteBatchNo191(HashMap parmas) throws Exception { SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession(); mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class); String retnum = "0"; try { String process_nos=""; String pno1=""; String pno2=""; String pno3=""; String chiStr = ""; //判断是否按子板取样 19订单 String chi = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and rownum <= 1 "; List CHILists=mapper.query(chi.toString()); if(CHILists != null && CHILists.size()>=1 ){ process_nos=CHILists.get(0).get("PROCESS_NOS").toString(); if(CHILists.get(0).get("FREQ_CODE").equals("C") || CHILists.get(0).get("FREQ_CODE").equals("H") || CHILists.get(0).get("FREQ_CODE").equals("I")){ chiStr = " and t.MATERIAL_NO = '"+CHILists.get(0).get("MATERIAL_NO")+"' "; } } pno1=process_nos.substring(0, 1);//第一位 pno2=process_nos.substring(3, 4);//第四位 pno3=process_nos.substring(4, 5);//第五位 //and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' String sql =""; sql = "select * from (select * from (" + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no AND i.Phy_Code_l <> 'HJ' ) nums,t.* " + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status = '3' and t.freq_code <> 'D' and t.CHEM_ITEM is null " + " and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') and r.DESIGN_KEY not like '19%' " + chiStr +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' " +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' " +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' " + " ) t where t.nums !=0 order by t.nums desc) t where rownum=1 "; HashMap result = mapper.queryOne(sql.toString()); if(result==null || result.size()<=0){ sql = "select t.* from (select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no AND i.Phy_Code_l <> 'HJ') nums, t.* from QCM_JHY_SAMPLE_CONSIGN_D t " +" where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status = '3' " +" and t.freq_code <> 'D' and CHEM_ITEM is null " +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' " +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' " +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' " +" and rownum <= 1 order by t.send_time asc ) t where t.nums != 0"; result=null; result = mapper.queryOne(sql.toString()); } if (result != null && result.size()>=1) { //判断厚度是否大于引用的厚度 sql =""; sql = "select To_Number(t.thick) thick from Qcm_Jhy_Sample_r_Ord t where t.SMP_NO = '"+result.get("SMP_NO")+"' and rownum <= 1 "; List OrdLists=mapper.query(sql.toString()); if(OrdLists!=null && OrdLists.size()>=1 && !StringUtils.isBlank(OrdLists.get(0).get("THICK").toString())){ String hmap2 = OrdLists.get(0).get("THICK").toString(); double thick1 = Double.parseDouble(hmap2); String thick = parmas.get("THICK").toString(); double thick2 = Double.parseDouble(thick); if(thick2>thick1){ String str =thick2+">"+thick1; //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '19订单委托厚度大于引用厚度不可引用:'||'"+str+"' ,t.ARTIFICIAL_MEMO='0' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); SqlSession.commit(); SqlSession.close(); return "厚度大于引用厚度不能引用";//被引用不能大于引用 } if((thick1-thick2)>=3){ String str =thick2+"<"+thick1; sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '19订单委托厚度小于引用厚度不可超过2mm,超过2mm不可引用:'||'"+str+"' ,t.ARTIFICIAL_MEMO='0' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); SqlSession.commit(); SqlSession.close(); return "只能引用大2mm厚度";//引用-被引用不能大于等于3 小2mm } } //查询被引用的所有明细 sql =""; sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "; List qltyLists=mapper.query(sql.toString()); //查询引用的所有明细 sql =""; sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' " + " and t.quote_specimen_no is null and t.val1 is not null and t.create_name <>'现场默认' "; List qltyLists2=mapper.query(sql.toString()); Integer bQuote = qltyLists.size();//被引用 Integer yQuote = qltyLists2.size();//引用 int quotenum = 0;//已引用数据 String hbB01 ="";//弯曲 //被引用 for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入 //System.out.println("======="+qltyLists.get(i).get("PHY_CODE_S")); if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){ hbB01 ="0"; }else{ hbB01 =""; } //代码 String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码 String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码 String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码 String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码 String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用 String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码 //名称 String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码 String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码 String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码 String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码 String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用 String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码 String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码 String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L"); BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ"); String bigdjs = seq.toString(); Integer bigd4 = Integer.parseInt(bigdjs); String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS; newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null"); newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null"); newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null"); //引用 for (HashMap hashMap : qltyLists2) { //代码 String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码 String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码 String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码 String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码 String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用 String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码 String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2; newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null"); newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null"); newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null"); //判断是否是冲击试验 if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){ if(phyCodeS.equals(phyCodeS2)){ double co1t = Double.valueOf(itemCodeT); double co2t = Double.valueOf(itemCodeT2); //Integer co1t= Integer.parseInt(itemCodeT);//被引用 //Integer co2t= Integer.parseInt(itemCodeT2);//引用 if(co1t >= co2t){ sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; break; } } }else{//其它试验 //标准一样的引用 if(newItem.equals(newItem2)){ sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; if("B01".equals(phyCodeS2) && "B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))){ hbB01="1"; } break; } } } if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){ sql=""; sql="insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, " +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) " +" select t.specimen_no,t.seq,t.test_qty,t.phy_code_l,t.phy_name_l,t.phy_code_m,t.phy_name_m,t.phy_code_s,t.phy_name_s,t.item_code_d,t.item_name_d, " +" t.item_code_t,t.item_name_t,t.item_code_s,t.item_name_s,'合格','合格','"+parmas.get("CREATE_NAME")+"',sysdate,'0','合格','合格',t.item_code_l,t.item_desc_l, " +" t.phy_unit,'默认合格' " +" from qcm_jhy_sample_consign_d_item t " +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' " +" and t.phy_code_s = 'B01' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; } //申报:郭明清 主题:非计划船板改普板,冷弯需要系统默认合格 申报时间:2023-04-27 16:49:59 //原牌号为船板 BV/IC003法国船级社,KR/IC004韩国船级社,DNV/IC001挪威船级社,CCS/IC010中国船级社 、ABS/IC005美国船级社、LR/IC009 英国船级社、NK/KA36/IC006 日本船级社、RINA/IC007 意大利船级社 、RS/IC002 俄罗斯 IC012 客户认证 //改成普锰板(Q235A/B、Q345A/B、Q355B) //被引用是原牌号船板 引用是改判 普锰板 //弯曲 默认合格 /* if("B01".equals((String) qltyLists.get(i).get("PHY_CODE_S"))&& !"".equals(hbB01) && hbB01.equals("0")){ sql=""; sql="select d.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r " +" where d.smp_no = r.smp_no and r.steel_code in ('Q235A','Q235B','Q345A','Q345B','Q355B') " +" and d.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "; List hashMap=mapper.query(sql.toString()); if(hashMap!=null && hashMap.size()>=1){ sql=""; sql="select r.* from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r " +" where d.smp_no = r.smp_no and r.cert_inst_code in ('IC005','IC009','IC006','IC007','IC002','IC003','IC004','IC001','IC010') " +" and d.specimen_no = '"+result.get("SPECIMEN_NO")+"' "; List hashMap2=mapper.query(sql.toString()); //船板没有弯曲 sql=""; sql="select * from qcm_jhy_sample_consign_d_item where specimen_no = '"+result.get("SPECIMEN_NO")+"' and phy_code_s='B01' "; List hashMap3=mapper.query(sql.toString()); if(hashMap2!=null && hashMap2.size()>=1 && hashMap3.size()<=0 ){ sql=""; sql="insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,AVG_VAL,CREATE_NAME,CREATE_TIME,DEFECT_FLAG,MAX_VAL, " +" MIN_VAL,ITEM_CODE_L,ITEM_DESC_L,PHY_UNIT,MEMO) " +" select t.specimen_no,t.seq,t.test_qty,t.phy_code_l,t.phy_name_l,t.phy_code_m,t.phy_name_m,t.phy_code_s,t.phy_name_s,t.item_code_d,t.item_name_d, " +" t.item_code_t,t.item_name_t,t.item_code_s,t.item_name_s,'合格','合格','"+parmas.get("CREATE_NAME")+"',sysdate,'0','合格','合格',t.item_code_l,t.item_desc_l, " +" t.phy_unit,'默认合格' " +" from qcm_jhy_sample_consign_d_item t " +" where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' " +" and t.phy_code_s = 'B01' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '默认合格' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.phy_code_s = 'B01' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; } } }*/ } //19HJGP 不自动下发 sql=""; sql="select r.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r " + " where t.smp_no = r.smp_no and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and r.design_key like '19HJGP%' and rownum=1 "; HashMap resultHJGP = mapper.queryOne(sql.toString()); if(resultHJGP!=null && resultHJGP.size()>=1){ if(quotenum == qltyLists.size()){ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"'," + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); //往log表中插入p sql = ""; sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) " +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')"; mapper.insert(sql); retnum = "1"; }else if(quotenum==0){ sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '未找到一项可以引用的项目,订单标准全部不一样' ,t.ARTIFICIAL_MEMO='0' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); }else{ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩', t.ARTIFICIAL_MEMO='0', " + " t.ONEMEMO ='需下发委托' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); } }else{ //被引用的项目 全部 已引用 if(quotenum!=0){ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"'," + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); //往log表中插入p sql = ""; sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) " +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')"; mapper.insert(sql); retnum = "1"; }else if(quotenum==0){ sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '未找到一项可以引用的项目,订单标准全部不一样' ,t.ARTIFICIAL_MEMO='0' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); } } }else{ sql=""; sql = "select * from (select * from (" + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* " + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status in('0','2','7') " +" and t.freq_code <> 'D' and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') " +" and r.DESIGN_KEY not like '19%' " +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' " +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' " +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' " +") t order by t.nums desc) t where rownum=1 "; result=null; result = mapper.queryOne(sql.toString()); if(result==null || result.size()<=0){ sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status in('0','2','7') " +" and t.freq_code <> 'D' and r.DESIGN_KEY not like '19%' and CHEM_ITEM is null " +" and substr(t.PROCESS_NOS,0,1)='"+pno1+"' " +" and substr(t.PROCESS_NOS,4,1)='"+pno2+"' " +" and substr(t.PROCESS_NOS,5,1)='"+pno3+"' " +" and rownum <= 1 order by t.send_time asc "; result=null; result = mapper.queryOne(sql.toString()); } if (result != null && result.size()>=1) { sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '力学性能实绩未返回或未下发委托,请等实绩返回人工引用' ,t.ARTIFICIAL_MEMO='1' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); }else{ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '没有找到相应力学性能委托' ,t.ARTIFICIAL_MEMO='0' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); } } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); } SqlSession.commit(); SqlSession.close(); return retnum; } /** * 复样引用 * @param materialInfo * @return * @throws Exception */ public String DoQuoteBatchNoFy(HashMap parmas) throws Exception { String retnum = "0"; try { String StrSpecimenNO=""; TreeSet treeSet = new TreeSet();//取样编号 String fysql=" select t.* from QCM_JHY_SAMPLE_CONSIGN_D t where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " + " and t.smp_type_code = '1' and t.status = '3' and nvl(t.QUOTE_MEMO, 'null') <> '引用实绩' and t.freq_code <> 'D' and t.CHEM_ITEM is null "; List hmfy=mapper.query(fysql.toString()); if(hmfy!=null && hmfy.size()>=1){ for (HashMap hashMap : hmfy) { fysql=""; fysql="select * from qcm_jhy_sample_consign_d_item t where t.quote_memo like '%"+hashMap.get("SPECIMEN_NO")+"'"; List hmfy2=mapper.query(fysql.toString()); if(hmfy2==null || hmfy2.size()<=0){ treeSet.add((String)hashMap.get("SPECIMEN_NO")); } } } String sql=""; if(treeSet.size()>=1){ sql="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+treeSet.first()+"' and rownum=1"; }else{ sql = "select * from (select * from (select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums, t.* " + " from QCM_JHY_SAMPLE_CONSIGN_D t " +" where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '1' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' " + " and t.freq_code <> 'D' and t.CHEM_ITEM is null ) t order by t.nums desc) t where rownum=1 "; } HashMap result = mapper.queryOne(sql.toString()); if (result != null && result.size()>=1) { //查询引用的所有明细 sql =""; sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and seq<=49 "; List qltyLists=mapper.query(sql.toString()); //查询被引用的所有明细 sql =""; sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' and t.quote_specimen_no is null and seq<=49 "; List qltyLists2=mapper.query(sql.toString()); Integer bQuote = qltyLists.size();//引用 Integer yQuote = qltyLists2.size();//被引用 int quotenum = 0;//已引用数据 //被引用 for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入 //代码 String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码 String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码 String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码 String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码 String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用 String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码 //名称 String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码 String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码 String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码 String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码 String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用 String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码 String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码 String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L"); BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ"); String bigdjs = seq.toString(); Integer bigd4 = Integer.parseInt(bigdjs); String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS; newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null"); newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null"); newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null"); //newItem=newItem+"-"+(itemCodeL!=null?itemCodeL:"null"); //引用 for (HashMap hashMap : qltyLists2) { //代码 String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码 String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码 String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码 String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码 String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用 String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码 String itemCodeL2 = (String) hashMap.get("ITEM_CODE_L");//试验位置代码 String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2; newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null"); newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null"); newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null"); //newItem2=newItem2+"-"+(itemCodeL2!=null?itemCodeL2:"null"); //判断是否是冲击试验 if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){ if(phyCodeS.equals(phyCodeS2)){ Integer co1t= Integer.parseInt(itemCodeT);//被引用 Integer co2t= Integer.parseInt(itemCodeT2);//引用 if(co1t >= co2t){ sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; break; } } }else{//其它试验 //标准一样的引用 if(newItem.equals(newItem2)){ sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; break; } } } } //被引用的项目 全部 已引用 if(quotenum == qltyLists.size()){ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"'," + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); //往log表中插入p sql = ""; sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) " +" VALUES ( 'Q', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')"; mapper.insert(sql); retnum="1"; }else{ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); } }else{ SqlSession.close(); return "该轧批未返回实绩或没有引用的对象!请在委托记录中核实相应委托数据"; } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); return "引用失败!"; } SqlSession.commit(); doPhyItem(parmas.get("SPECIMEN_NO").toString()); SqlSession.close(); return retnum; } /** * 39 49 59订单自动引用 不同订单 同轧批号 项目一样引用 * @param materialInfo * @return * @throws Exception */ public void DoQuoteRZLT(HashMap parmas) throws Exception { SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession(); mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class); try { if(parmas.get("CREATE_NAME").equals("调试人员")){ parmas.put("SEND_ID", "系统自动"); parmas.put("CREATE_NAME", "系统自动"); } //and t.freq_code <> 'D' String sql =""; sql = "select * from (select * from (" + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* " + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' " + " and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') " + " and r.DESIGN_KEY not like '39%' and r.DESIGN_KEY not like '49%' and r.DESIGN_KEY not like '59%' " + " ) t order by t.nums desc) t where rownum=1 "; HashMap result = mapper.queryOne(sql.toString()); //and t.freq_code <> 'D' if(result==null || result.size()<=0){ sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t " +" where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status = '3' and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' " + " and CHEM_ITEM is null and rownum <= 1 order by t.send_time asc "; result=null; result = mapper.queryOne(sql.toString()); } if (result != null && result.size()>=1) { //查询引用的所有明细是不是只有拉伸 横向可以替代纵向 //当卷板存在横向试验时,且只有一组拉伸试样时,改判后需要纵向实验数据,可以直接用横向替代纵向。 //热轧:改判,只有一组拉伸试样时并且方向是(纵向)时,横向可以替代纵向,直接把横向的值引用到纵向上 //连退:改判,只有一组拉伸试样时并且方向是(纵向)时,横向可以替代纵向,直接把横向的值引用到纵向上,但是断后伸长率(横向A50 套纵向A50 )、(横向A80 套纵向A80 ) //连退改判:断后伸长率:A50转成A80需要将A50的值乘以0.829; A80转成A50需要乘以1.207 //主题:卷板改判规则维护01 申报人员:夏鹏 申报时间:2023-05-04 15:19:01 String HAStr=""; sql =""; sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.PHY_CODE_L <>'HA' "; List qltyListsHA=mapper.query(sql.toString()); if(qltyListsHA==null || qltyListsHA.size()<=0){ HAStr="HA";//只有拉伸 } //查询引用的所有明细 sql =""; sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "; List qltyLists=mapper.query(sql.toString()); //查询被引用的所有明细 sql =""; sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get("SPECIMEN_NO")+"' and t.quote_specimen_no is null and t.VAL1 is not null "; List qltyLists2=mapper.query(sql.toString()); Integer bQuote = qltyLists.size();//引用 Integer yQuote = qltyLists2.size();//被引用 int quotenum = 0;//已引用数据 //引用 for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入 //代码 String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码 String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码 String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码 String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码 String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用 String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码 //名称 String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码 String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码 String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码 String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码 String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用 String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码 String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码 String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L"); BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ"); String bigdjs = seq.toString(); Integer bigd4 = Integer.parseInt(bigdjs); //横向替代纵向 只有拉伸并且引用是纵向B 横向A 被引用不管是横向还是纵向都能把值给到引用上面 //连退改判:(断后伸长率)A50转成A80需要将A50的值乘以0.829; A80转成A50需要乘以1.207 String EAFStr=""; String PhyUnit="";//值单位 if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("B")){ itemCodeD="B"; //断后伸长率 && qltyLists.get(i).get("SPECIMEN_NO").toString().contains("LT1") if(phyCodeS.equals("A06")){ PhyUnit=(String) qltyLists.get(i).get("PHY_UNIT"); } }else if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("A") && phyCodeS.equals("A06")){ PhyUnit=(String) qltyLists.get(i).get("PHY_UNIT"); } String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS; if(phyCodeL.equals("HV") && qltyLists.get(i).get("SPECIMEN_NO").toString().contains("LT1")){ //连退 粗糙度 试验方向 不参于判断 newItem=newItem+"-"+"null"; }else{ newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null"); } newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null"); newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null"); if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("B")){ //断后伸长率 要加上值单位去判 && qltyLists.get(i).get("SPECIMEN_NO").toString().contains("LT1") if(phyCodeS.equals("A06")){ newItem=newItem+"-"+(PhyUnit!=null?PhyUnit:"null"); } }else if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("A") && phyCodeS.equals("A06")){ newItem=newItem+"-"+(PhyUnit!=null?PhyUnit:"null"); } //被引用 for (HashMap hashMap : qltyLists2) { //代码 String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码 String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码 String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码 String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码 String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用 String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码 String PhyUnit2=""; //横向替代纵向 只有拉伸并且引用是纵向B 被引用不管是横向还是纵向都能把值给到引用上面 if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("B")){ itemCodeD2="B";//被引用 不管是横向还是纵向都能把值给到引用上 //断后伸长率 && hashMap.get("SPECIMEN_NO").toString().contains("LT1") if(phyCodeS2.equals("A06")){ sql =""; sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t " + " where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' and t.PHY_CODE_S='A06' AND t.seq<=49 "; List qltyListsA=mapper.query(sql.toString()); PhyUnit2=(String) qltyListsA.get(0).get("PHY_UNIT"); } }else if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("A") && phyCodeS.equals("A06") && itemCodeD2.equals("A") && phyCodeS2.equals("A06")){ sql =""; sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t " + " where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' and t.PHY_CODE_S='A06' AND t.seq<=49 "; List qltyListsA=mapper.query(sql.toString()); PhyUnit2=(String) qltyListsA.get(0).get("PHY_UNIT"); } String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2; if(phyCodeL2.equals("HV") && hashMap.get("SPECIMEN_NO").toString().contains("LT1")){ //连退 粗糙度 试验方向 不参于判断 newItem2=newItem2+"-"+"null"; }else{ newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null"); } newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null"); newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null"); if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("B")){ //断后伸长率 && hashMap.get("SPECIMEN_NO").toString().contains("LT1") if(phyCodeS2.equals("A06")){ newItem2=newItem2+"-"+(PhyUnit2!=null?PhyUnit2:"null"); } }else if(!"".equals(HAStr) && HAStr.equals("HA") && itemCodeD.equals("A") && phyCodeS.equals("A06") && itemCodeD2.equals("A") && phyCodeS2.equals("A06")){ newItem2=newItem2+"-"+(PhyUnit2!=null?PhyUnit2:"null"); } //判断是否是冲击试验 if(phyCodeS.equals("C01") || phyCodeS.equals("C02")){ if(phyCodeS.equals(phyCodeS2)){ Integer co1t= Integer.parseInt(itemCodeT);//被引用 Integer co2t= Integer.parseInt(itemCodeT2);//引用 if(co1t >= co2t){ sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; break; } } }else{//其它试验 //标准一样的引用 if(newItem.equals(newItem2)){ sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; break; }else if(phyCodeS.equals("A06") && phyCodeS2.equals("A06") && HAStr.equals("HA") && (itemCodeD.equals("B") || (itemCodeD.equals("A") && itemCodeD2.equals("A")) )){ //判断当前值单位是50mm 80mm if("50mm".equals(PhyUnit)){ if("80mm".equals(PhyUnit2)){ //A50=A80*1.207 sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',JHY02.ROUDN_MATH_JGXY((val1*1.207), 0.5),JHY02.ROUDN_MATH_JGXY((val2*1.207), 0.5),JHY02.ROUDN_MATH_JGXY((val3*1.207), 0.5)," +" VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, VAL13,VAL14,VAL15,JHY02.ROUDN_MATH_JGXY((avg_val*1.207), 0.5),'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG," +" JHY02.ROUDN_MATH_JGXY((max_val*1.207), 0.5),JHY02.ROUDN_MATH_JGXY((min_val*1.207), 0.5),'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); } } else if("80mm".equals(PhyUnit)){ if("50mm".equals(PhyUnit2)){ //A80=A50*0.829 sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+parmas.get("SPECIMEN_NO")+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',JHY02.ROUDN_MATH_JGXY((val1*0.829), 0.5),JHY02.ROUDN_MATH_JGXY((val2*0.829), 0.5),JHY02.ROUDN_MATH_JGXY((val3*0.829), 0.5)," +" VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12,VAL13,VAL14,VAL15,JHY02.ROUDN_MATH_JGXY((avg_val*0.829), 0.5),'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG," +" JHY02.ROUDN_MATH_JGXY((max_val*0.829), 0.5),JHY02.ROUDN_MATH_JGXY((min_val*0.829), 0.5),'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); } } //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+result.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; break; } } } } String ABATCHLOG = ""; String sqlrz="select t.COIL_NO,t.ABATCHLOG from qcm_judge_coil_result t where t.COIL_NO in ( " +" select d.material_no from qcm_jhy_sample_consign_d d where d.specimen_no = '"+parmas.get("SPECIMEN_NO")+"') " +" and t.abatchlog is not null and rownum=1 "; HashMap resultrz = mapper.queryOne(sqlrz.toString()); if(resultrz!=null && resultrz.size()>=1){ ABATCHLOG = resultrz.get("ABATCHLOG").toString(); } //被引用的项目 全部 已引用 if(quotenum==bQuote){ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("SEND_ID")+"',t.IMPROVE_MEMO= '"+ABATCHLOG+"' , " + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); //往log表中插入p sql = ""; sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) " +" VALUES ( 'P', '"+parmas.get("SMP_NO")+"', SYSDATE,'system','"+parmas.get("PLINE_CODE")+"')"; mapper.insert(sql); }else{ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩',t.IMPROVE_MEMO= '"+ABATCHLOG+"' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); } }else{ sql=""; sql = "select * from (select * from (" + " select (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = t.specimen_no) nums,t.* " + " from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status in('0','2','7') and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' " + " and t.freq_code <> 'D' and t.CHEM_ITEM is null and to_char(r.thick, 'fm990.099') = to_char('"+parmas.get("THICK")+"', 'fm990.099') " + " and r.DESIGN_KEY not like '39%' and r.DESIGN_KEY not like '49%' and r.DESIGN_KEY not like '59%' " + " ) t order by t.nums desc) t where rownum=1 "; result=null; result = mapper.queryOne(sql.toString()); if(result==null || result.size()<=0){ sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"' " +" and t.smp_type_code = '0' and t.status in('0','2','7') and nvl(t.QUOTE_MEMO ,'null') <> '引用实绩' " + " and t.freq_code <> 'D' " + " and r.DESIGN_KEY not like '39%' and r.DESIGN_KEY not like '49%' and r.DESIGN_KEY not like '59%' " + " and CHEM_ITEM is null and rownum <= 1 order by t.send_time asc "; result=null; result = mapper.queryOne(sql.toString()); } if (result != null && result.size()>=1) { sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '力学性能实绩未返回或未下发委托,请等实绩返回人工引用',t.ARTIFICIAL_MEMO='1' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); }else{ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '没有找到相应力学性能委托' ,t.ARTIFICIAL_MEMO='0' " + " where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.pline_code = '"+parmas.get("PLINE_CODE")+"'" + " and SPECIMEN_NO ='"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); } } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); } SqlSession.commit(); SqlSession.close(); } /** * 线棒LS订单自动引用 不同订单 同轧批号 项目一样引用 * @param materialInfo * @return * @throws Exception */ public void DoQuoteXB(HashMap parmas) throws Exception { SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession(); mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class); try { String strsql=""; if(parmas.get("MEMOLOG").equals("0")){//按子板件件取样 strsql = " AND T.MATERIAL_NO='"+parmas.get("MATERIAL_NO")+"' "; } //查询当前生成的委托 String sql ="SELECT T.SPECIMEN_NO,T.BATCH_NO,T.SMP_NO,T.PLINE_CODE," +" (SELECT COUNT(1) FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM I WHERE I.SPECIMEN_NO = T.SPECIMEN_NO) COUNTN " +" FROM QCM_JHY_SAMPLE_CONSIGN_D T,QCM_JHY_SAMPLE_R_ORD R WHERE T.SMP_NO = R.SMP_NO AND T.PLINE_CODE IN ('GX1','GX2','BC2') AND T.SMP_TYPE_CODE ='0' " +" AND R.DESIGN_KEY = '"+parmas.get("DESIGN_KEY")+"' AND R.BATCH_NO ='"+parmas.get("BATCH_NO")+"' and t.status = '0' " +strsql + " ORDER BY COUNTN DESC "; List result1 = mapper.query(sql.toString()); if(result1==null || result1.size()<=0){ return; } //查询最初的委托 AND R.DESIGN_KEY not like 'LS%' SOURCE:是否正常批 String sql2 = "SELECT T.SPECIMEN_NO,T.BATCH_NO,(SELECT COUNT(1) FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM I WHERE I.SPECIMEN_NO = T.SPECIMEN_NO) COUNTN " +" FROM QCM_JHY_SAMPLE_CONSIGN_D T,QCM_JHY_SAMPLE_R_ORD R " +" WHERE T.SMP_NO = R.SMP_NO AND T.PLINE_CODE IN ('GX1','GX2','BC2') AND T.SMP_TYPE_CODE ='0' AND T.SOURCE= '0' " +" AND T.QUOTE_MEMO IS NULL AND T.STATUS = '3' AND R.BATCH_NO ='"+parmas.get("BATCH_NO")+"' " +" ORDER BY COUNTN DESC "; List result = mapper.query(sql2.toString()); if (result != null && result.size()>=1) { for (int a = 0; a < result1.size(); a++) { //查询引用的所有明细 sql =""; sql = "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+result1.get(a).get("SPECIMEN_NO")+"' "; List qltyLists=mapper.query(sql.toString()); //查询被引用的所有明细 sql =""; sql = "select t.* from QCM_JHY_INSP_PHYSICS t where t.specimen_no = '"+result.get(a).get("SPECIMEN_NO")+"' "; List qltyLists2=mapper.query(sql.toString()); if(qltyLists2==null || qltyLists2.size()<=0){ continue; } Integer bQuote = qltyLists.size();//引用 int quotenum = 0;//已引用数据 //引用 for (int i = 0; i < qltyLists.size(); i++) {//被引用在外层循环 对比 引用中有没有相应的项目有 插入 String specimenNo=(String) qltyLists.get(i).get("SPECIMEN_NO"); //代码 String phyCodeL = (String) qltyLists.get(i).get("PHY_CODE_L");//材质检验大项代码 String phyCodeM = (String) qltyLists.get(i).get("PHY_CODE_M");//试样组代码 String phyCodeS = (String) qltyLists.get(i).get("PHY_CODE_S");//材质检验项目代码 String itemCodeD = (String) qltyLists.get(i).get("ITEM_CODE_D");//试验方向代码 String itemCodeT = (String) qltyLists.get(i).get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用 String itemCodeS = (String) qltyLists.get(i).get("ITEM_CODE_S");//试样尺寸代码 //名称 String phyNameL = (String) qltyLists.get(i).get("PHY_NAME_L");//材质检验大项代码 String phyNameM = (String) qltyLists.get(i).get("PHY_NAME_M");//试样组代码 String phyNameS = (String) qltyLists.get(i).get("PHY_NAME_S");//材质检验项目代码 String itemNameD = (String) qltyLists.get(i).get("ITEM_NAME_D");//试验方向代码 String itemNameT = (String) qltyLists.get(i).get("ITEM_NAME_T");//试验温度代码 试验温度代码 冲击 被引用 String itemNameS = (String) qltyLists.get(i).get("ITEM_NAME_S");//试样尺寸代码 String itemCodeL = (String) qltyLists.get(i).get("ITEM_CODE_L");//试验位置代码 String itemDescL = (String) qltyLists.get(i).get("ITEM_DESC_L"); BigDecimal seq = (BigDecimal) qltyLists.get(i).get("SEQ"); String bigdjs = seq.toString(); Integer bigd4 = Integer.parseInt(bigdjs); String newItem=phyCodeL+"-"+phyCodeM+"-"+phyCodeS; newItem=newItem+"-"+(itemCodeD!=null?itemCodeD:"null"); newItem=newItem+"-"+(itemCodeT!=null?itemCodeT:"null"); newItem=newItem+"-"+(itemCodeS!=null?itemCodeS:"null"); newItem=newItem+"-"+(itemCodeL!=null?itemCodeL:"null"); //被引用 for (HashMap hashMap : qltyLists2) { //代码 String phyCodeL2 = (String) hashMap.get("PHY_CODE_L");//材质检验大项代码 String phyCodeM2 = (String) hashMap.get("PHY_CODE_M");//试样组代码 String phyCodeS2 = (String) hashMap.get("PHY_CODE_S");//材质检验项目代码 String itemCodeD2 = (String) hashMap.get("ITEM_CODE_D");//试验方向代码 String itemCodeT2 = (String) hashMap.get("ITEM_CODE_T");//试验温度代码 试验温度代码 冲击 被引用 String itemCodeS2 = (String) hashMap.get("ITEM_CODE_S");//试样尺寸代码 String itemCodeL2 = (String) hashMap.get("ITEM_CODE_L");//试验位置代码 String newItem2=phyCodeL2+"-"+phyCodeM2+"-"+phyCodeS2; newItem2=newItem2+"-"+(itemCodeD2!=null?itemCodeD2:"null"); newItem2=newItem2+"-"+(itemCodeT2!=null?itemCodeT2:"null"); newItem2=newItem2+"-"+(itemCodeS2!=null?itemCodeS2:"null"); newItem2=newItem2+"-"+(itemCodeL2!=null?itemCodeL2:"null"); //标准一样的引用 if(newItem.equals(newItem2)){ sql = ""; sql = " insert into QCM_JHY_INSP_PHYSICS " +" (SPECIMEN_NO,SEQ,TEST_QTY,PHY_CODE_L,PHY_NAME_L,PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D, " +" ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,CREATE_NAME,CREATE_TIME,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,ITEM_CODE_L,ITEM_DESC_L, " +" PHY_UNIT,MEMO) " +" select '"+specimenNo+"','"+bigd4+"',TEST_QTY,'"+phyCodeL+"','"+phyNameL+"','"+phyCodeM+"','"+phyNameM+"','"+phyCodeS+"','"+phyNameS+"','"+itemCodeD+"','"+itemNameD+"', " +" '"+itemCodeT+"','"+itemNameT+"','"+itemCodeS+"','"+itemNameS+"',VAL1,VAL2,VAL3,VAL4,VAL5,VAL6,VAL7,VAL8,VAL9,VAL10,VAL11,VAL12, " +" VAL13,VAL14,VAL15,AVG_VAL,'"+parmas.get("CREATE_NAME")+"',sysdate,GROUP_SEQ,DEFECT_FLAG,MAX_VAL,MIN_VAL,'"+itemCodeL+"','"+itemDescL+"', " +" PHY_UNIT,MEMO from QCM_JHY_INSP_PHYSICS t " + " where t.specimen_no = '"+(String)hashMap.get("SPECIMEN_NO")+"' " + "and t.seq = '"+hashMap.get("SEQ")+"' "; mapper.insert(sql); //修改ITEM表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t set t.QUOTE_MEMO = '已引用"+hashMap.get("SPECIMEN_NO")+"' " + " where t.SPECIMEN_NO ='"+specimenNo+"' and t.seq = '"+seq+"' "; mapper.updateJudgeStatus(sql.toString()); quotenum++; break; } } } //被引用的项目 全部 已引用 if(quotenum==bQuote){ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.STATUS = '3',t.SEND_ID = '"+parmas.get("CREATE_ID")+"', " + " t.SEND_NAME = '"+parmas.get("CREATE_NAME")+"',t.SEND_TIME = sysdate,t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' " + " where t.batch_no = '"+result1.get(a).get("BATCH_NO")+"' and t.pline_code = '"+result1.get(a).get("PLINE_CODE")+"' " + " and t.SPECIMEN_NO ='"+result1.get(a).get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); //往log表中插入p sql = ""; sql = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) " +" VALUES ( 'P', '"+result1.get(a).get("SMP_NO")+"', SYSDATE,'system','"+result1.get(a).get("PLINE_CODE")+"')"; mapper.insert(sql); }else{ //修改D表 sql = ""; sql =" update QCM_JHY_SAMPLE_CONSIGN_D t set t.SEND_MEMO = '有引用',t.QUOTE_MEMO = '引用实绩' " + " where t.batch_no = '"+result1.get(a).get("BATCH_NO")+"' and t.pline_code = '"+result1.get(a).get("PLINE_CODE")+"' " + " and t.SPECIMEN_NO ='"+result1.get(a).get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(sql.toString()); } } } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); } SqlSession.commit(); SqlSession.close(); } /** * 修改热轧清空组批区间 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject DoCleanUpMixRoll(HashMap parmas) throws Exception { try { String logmemo ="轧批号:"+parmas.get("BATCH_NO").toString()+','+"子板号:"+ parmas.get("MATERIAL_NO").toString()+','+ "组批区间"+parmas.get("MIXROLL").toString()+','+"产线:"+parmas.get("PLINE_CODE").toString()+','+ "操作人:"+parmas.get("USER_NAME").toString(); String sql= "INSERT INTO QCM_JUDGE_OPERATE_LOG (OPERATE_TYPE,PARAMS,OPERATE_NAME,PROD_LINE,BATCHNO,MEMO) " + " VALUES('热轧清除组批区间','"+parmas.get("MATERIAL_NO")+"','DoCleanUpMixRoll','"+parmas.get("PLINE_CODE")+"'," + " '"+parmas.get("BATCH_NO")+"','"+logmemo+"') "; mapper.insert(sql); String sqlStr="update tbf02_spec_mill t " + " set MIXROLL='' " + " where t.COIL_NO in ( " + " select COIL_NO from tbh02_coil_comm c where c.OLD_SAMPL_NO like '"+parmas.get("BATCH_NO").toString()+"%' " + " ) "; mapper.updateJudgeStatus(sqlStr.toString()); } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("清空组批区间失败!"+e.getMessage()); return cro; } SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); return cro; } /** * 项目集 取样位置 * @param materialInfo * @return * @throws Exception */ public void doPhyItem(String SPECIMEN_NO) throws Exception { SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession(); mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class); try { String sqlitem = "select * from qcm_jhy_sample_consign_d t " +" where t.phy_item is null " +" and t.specimen_no = '"+SPECIMEN_NO+"' "; List PhyItem=mapper.query(sqlitem.toString()); if(PhyItem!=null && PhyItem.size()>=1){ String sqlItem = "select GET_ITEM_SPECIMEN_NO('"+SPECIMEN_NO+"') PHY_ITEM from dual"; List vhchm=mapper.query(sqlItem.toString()); if(vhchm!=null && vhchm.size()>=1 && !vhchm.get(0).get("PHY_ITEM").equals("NULL")){ String sql = " update QCM_JHY_SAMPLE_CONSIGN_D t " +" set PHY_ITEM= '"+vhchm.get(0).get("PHY_ITEM").toString()+"' " +" where t.SPECIMEN_NO='"+SPECIMEN_NO+"' "; mapper.UpdateQcmWt(sql); } } String getcin = "select r.* from qcm_jhy_sample_consign_d t, qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no and t.specimen_no ='"+SPECIMEN_NO+"' " +" and r.Three_Memo is null and r.pline_code in ('ZB1','HB1') "; List getcinHM=mapper.query(getcin.toString()); if(getcinHM!=null && getcinHM.size()>=1){ String sqlItem2 = "select GET_CERT_INST_NAME('"+SPECIMEN_NO+"') PHY_ITEM from dual"; List vhchm2=mapper.query(sqlItem2.toString()); if(vhchm2!=null && vhchm2.size()>=1 && !vhchm2.get(0).get("PHY_ITEM").equals("NULL")){ String sql = " update qcm_jhy_sample_r_ord t " +" set THREE_MEMO= '"+vhchm2.get(0).get("PHY_ITEM").toString()+"' " +" where t.SMP_NO in ( select d.smp_no from qcm_jhy_sample_consign_d d where d.specimen_no = '"+SPECIMEN_NO+"') "; mapper.updateJudgeStatus(sql.toString()); } } TreeSet treeSet = new TreeSet(); String SQLsmpLocation = "select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t " +" where t.SMP_LOCATION is null " +" and t.specimen_no = '"+SPECIMEN_NO+"' "; List PhySp=mapper.query(SQLsmpLocation.toString()); if(PhySp!=null && PhySp.size()>=1){ treeSet.add(SPECIMEN_NO); for (HashMap hashMap : PhySp) { String fyQuoteSpecimenNo=String.valueOf(hashMap.get("FY_QUOTE_SPECIMEN_NO")); if(fyQuoteSpecimenNo!=null && !"".equals(fyQuoteSpecimenNo) && !"null".equals(fyQuoteSpecimenNo)){ treeSet.add(fyQuoteSpecimenNo); } } if(treeSet.size()>=1){ for (String str : treeSet) { //查出取样位置 String sqlsl="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+str+"' and rownum = 1 "; List sqlslhm=mapper.query(sqlsl.toString()); if(sqlslhm!=null && sqlslhm.size()>=1){ String SMP_LOCATION=sqlslhm.get(0).get("SMP_LOCATION").toString();//取样位置 String sql="select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.specimen_no = '"+str+"' " + " and t.SMP_LOCATION is null and t.FY_QUOTE_SPECIMEN_NO is null "; List hashMap=mapper.query(sql.toString()); if(hashMap!=null && hashMap.size()>=1){ sql=""; sql = " update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t " +" set SMP_LOCATION= '"+SMP_LOCATION+"' " +" where t.SPECIMEN_NO='"+str+"' and t.SMP_LOCATION is null and t.FY_QUOTE_SPECIMEN_NO is null "; mapper.UpdateQcmWt(sql); } sql=""; sql="select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where t.FY_QUOTE_SPECIMEN_NO = '"+str+"' " + " and t.SMP_LOCATION is null and t.SEQ>=50 "; List hashMap2=mapper.query(sql.toString()); if(hashMap2!=null && hashMap2.size()>=1){ sql=""; sql = " update QCM_JHY_SAMPLE_CONSIGN_D_ITEM t " +" set SMP_LOCATION= '"+SMP_LOCATION+"' " +" where t.FY_QUOTE_SPECIMEN_NO='"+str+"' and t.SMP_LOCATION is null and t.SEQ>=50 "; mapper.UpdateQcmWt(sql); } } } } } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); } SqlSession.commit(); SqlSession.close(); } //19订单刷新 or t.onememo is null) public void AutoTimeZHB(String usreName) throws Exception { SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession(); mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class); try { String sql="select * from ( " +" select t.create_time,r.design_key,r.batch_no,r.heat_no,r.smp_no,t.specimen_no,t.freq_code,t.pline_code,t.smp_type_code,r.thick, " +" (select COUNT(1) from qcm_jhy_sample_consign_d d,qcm_jhy_sample_r_ord r where d.smp_no= r.smp_no and d.batch_no=t.batch_no " + " and d.status='3' and d.freq_code<>'D' and r.design_key not like '19%' and substr(d.process_nos, 0, 1) =substr(t.process_nos, 0, 1) " + " and substr(d.process_nos, 4, 1) =substr(t.process_nos, 4, 1) and substr(d.process_nos, 5, 1) =substr(t.process_nos, 5, 1) ) NUMM," + " (select count(1) from zj_result_all@xgcx z where z.billetid= t.material_no and z.JUDGERESULT='0' ) JUDGERESULT " +" from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no " +" and r.design_key like '19%' " +" and (t.ONEMEMO='力学性能实绩未返回或未下发委托,请等实绩返回人工引用' or t.onememo is null) " +" and nvl(t.ARTIFICIAL_MEMO,'1') ='1' " +" and t.status = '0' " +" and r.judge_status = '0' and t.freq_code <>'D' and t.pline_code in ('ZB1','HB1') " +" order by t.create_time" +" ) f " +" where f.numm<>'0' and f.JUDGERESULT>=1 and f.CREATE_TIME>=to_date('2023-01-18 00:00:00','yyyy-MM-dd HH24:mi:ss')" +" and rownum<=20 "; List qltyLists=mapper.query(sql.toString()); if(qltyLists!=null && qltyLists.size()>=1){ for (int i = 0; i < qltyLists.size(); i++) { HashMap Quotehm =new HashMap(); Quotehm.put("HEAT_NO", qltyLists.get(i).get("HEAT_NO").toString()); Quotehm.put("BATCH_NO", qltyLists.get(i).get("BATCH_NO").toString()); Quotehm.put("SMP_NO", qltyLists.get(i).get("SMP_NO").toString()); Quotehm.put("SPECIMEN_NO", qltyLists.get(i).get("SPECIMEN_NO").toString()); Quotehm.put("FREQ_CODE", qltyLists.get(i).get("FREQ_CODE").toString()); Quotehm.put("PLINE_CODE", qltyLists.get(i).get("PLINE_CODE").toString()); Quotehm.put("SMP_TYPE_CODE", qltyLists.get(i).get("SMP_TYPE_CODE").toString()); Quotehm.put("SEND_ID", "系统自动"); Quotehm.put("CREATE_NAME", "系统自动"); Quotehm.put("THICK", qltyLists.get(i).get("THICK").toString()); Quotehm.put("DESIGN_KEY", qltyLists.get(i).get("DESIGN_KEY").toString()); String str=DoQuoteBatchNo191(Quotehm); if("1".equals(str)){ System.out.println(i+": 19刷新接口:"+qltyLists.get(i).get("BATCH_NO")+"、"+qltyLists.get(i).get("SPECIMEN_NO")+"成功"); }else{ System.out.println(i+": 19刷新接口:"+qltyLists.get(i).get("BATCH_NO")+"、"+qltyLists.get(i).get("SPECIMEN_NO")+"失败!"+str); } } } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); System.out.println("2:调用19失败!"+e.getMessage()); }finally { SqlSession.close(); } } //SQLS订单号多次换单导致材质判定时检验号被清空判不了 public void AutoTimeSQLS(String usreName) throws Exception { SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession(); mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class); try { String sql="select t.*,r.DESIGN_KEY,r.STEEL_CODE,r.THICK from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no " +" and r.design_key not like '19%' " +" and t.pline_code in ('ZB1','HB1') " +" and r.Judge_Status='1' " +" and r.Judge_Result_Code='3' " +" and r.Judge_Result_Desc = '没在库' " +" and t.freq_code <> 'D' and t.smp_type_code = '0' " +" and r.memo is null "; List qltyLists=mapper.query(sql.toString()); if(qltyLists!=null && qltyLists.size()>=1){ for (int i = 0; i < qltyLists.size(); i++) { String SMP_NO=qltyLists.get(i).get("SMP_NO").toString(); String BATCH_NO=qltyLists.get(i).get("BATCH_NO").toString(); String MATERIAL_NO=qltyLists.get(i).get("MATERIAL_NO").toString(); String BOARD_NO=qltyLists.get(i).get("BOARD_NO").toString(); String INSPECTION_LOT=qltyLists.get(i).get("INSPECTION_LOT").toString(); String PLINE_CODE=qltyLists.get(i).get("PLINE_CODE").toString(); String FREQ_CODE=qltyLists.get(i).get("FREQ_CODE").toString(); String DESIGN_KEY=qltyLists.get(i).get("DESIGN_KEY").toString(); String STEEL_CODE=qltyLists.get(i).get("STEEL_CODE").toString(); String THICK=qltyLists.get(i).get("THICK").toString(); String sql2="select * from zj_result_all@xgcx t " + " where t.billetid = '"+MATERIAL_NO+"' and t.BILLETID_JY is null "; List qltyLists2=mapper.query(sql2.toString()); if(qltyLists2!=null && qltyLists2.size()>=1){ String sqlzj = " update zj_result_all@xgcx t set t.billetid_jy = '"+INSPECTION_LOT+"' " + " where t.billetid='"+MATERIAL_NO+"' "; mapper.updateJudgeStatus(sqlzj.toString()); //r.design_key like 'SQLS%' String sqlord = " update qcm_jhy_sample_r_ord r " +" set r.Judge_Status='0',r.Judge_Result_Code='', " +" r.Judge_Result_Desc = '',r.memo='订单:'||'"+DESIGN_KEY+"' " +" where 1=1 " +" and r.Smp_No='"+SMP_NO+"' "; mapper.updateJudgeStatus(sqlord.toString()); String sqlP = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) " +" VALUES ( 'P', '"+SMP_NO+"', SYSDATE,'system','"+PLINE_CODE+"')"; mapper.insert(sqlP); System.out.println("调用"+DESIGN_KEY+"订单接口成功:轧批号:"+BATCH_NO+"、试样号:"+SMP_NO); }else{ String lot="0"; HashMap hashMapStr =new HashMap(); hashMapStr.put("BATCH_NO", BATCH_NO); hashMapStr.put("PLINE_CODE", PLINE_CODE); hashMapStr.put("DESIGN_KEY", DESIGN_KEY); hashMapStr.put("STEEL_CODE", STEEL_CODE); hashMapStr.put("THICK", THICK); hashMapStr.put("BOARD_NO", BOARD_NO); hashMapStr.put("FREQ_CODE", FREQ_CODE); hashMapStr.put("MATERIAL_NO", MATERIAL_NO); String deystr = DESIGN_KEY.substring(0, 2); if(!"19".equals(deystr)){ String sqlstr = ZHBJudgeStatus(hashMapStr); List kczh=mapper.query(sqlstr.toString()); if (kczh!=null && kczh.size()>=1) { for (HashMap hashMap : kczh) { String bcon = "select nvl(t.BILLETID_JY,'0') BILLETID_JY,t.* from zj_result_all@xgcx t " + " where t.billetid = '"+(String)hashMap.get("MATERIAL_NO")+"' " + " and rownum <= 1 "; List billetidJy = mapper.query(bcon.toString()); if(billetidJy != null && billetidJy.size() >=1 && !billetidJy.get(0).get("BILLETID_JY").equals(INSPECTION_LOT)){ mapper.zjResultAllZHB(MATERIAL_NO,INSPECTION_LOT); lot="1"; } } } } if(lot.equals("1")){ String sqlord = " update qcm_jhy_sample_r_ord r " +" set r.memo='订单:'||'"+DESIGN_KEY+"',JUDGE_STATUS='0',JUDGE_RESULT_CODE='',JUDGE_RESULT_DESC='' " +" where 1=1 " +" and r.Smp_No='"+SMP_NO+"' "; mapper.updateJudgeStatus(sqlord.toString()); String sqlP = " INSERT INTO QCM_JUDGE_LOG ( JUDGE_TYPE,MATERIAL_NO,CREATE_TIME,CREATE_NAME,PROD_LINE) " +" VALUES ( 'P', '"+SMP_NO+"', SYSDATE,'system','"+PLINE_CODE+"')"; mapper.insert(sqlP); }else{ String sqlord = " update qcm_jhy_sample_r_ord r " +" set r.memo='订单:'||'"+DESIGN_KEY+"' " +" where 1=1 " +" and r.Smp_No='"+SMP_NO+"' "; mapper.updateJudgeStatus(sqlord.toString()); } System.out.println("调用"+DESIGN_KEY+"订单接口检验号不为空:轧批号:"+BATCH_NO+"、试样号:"+SMP_NO); } } } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); System.out.println("2:调用SQLS订单接口失败!"+e.getMessage()); } SqlSession.commit(); SqlSession.close(); } public String ZHBJudgeStatus(HashMap hashMapStr){ String freqCode=""; //按母板取样 if(hashMapStr.get("FREQ_CODE").equals("B") || hashMapStr.get("FREQ_CODE").equals("F") || hashMapStr.get("FREQ_CODE").equals("G")){ freqCode =" and t.BOARD_NO = '"+hashMapStr.get("BOARD_NO")+"' "; }else if(hashMapStr.get("FREQ_CODE").equals("C") || hashMapStr.get("FREQ_CODE").equals("H") || hashMapStr.get("FREQ_CODE").equals("I")){ freqCode =" and t.MATERIAL_NO = '"+hashMapStr.get("MATERIAL_NO")+"' "; } String materialNosql=""; if(hashMapStr.get("PLINE_CODE").equals("ZB1")){ materialNosql = "SELECT t.* " +" FROM (SELECT A.SAMPLINGREQUESTTIME,T.ORDERNO DESIGN_KEY,T.BATCHNO BATCH_NO,to_char(T.STEELCODE) GRADE_CODE,T.HEIGHT THICK,T.PRODUCTNO MATERIAL_NO " +" ,T.MOTHERPLATEID BOARD_NO FROM MB_PLANDETAILOFPLATE@xgcx T, SEL_PACTDETAIL_NEW@xgcx A " +" WHERE T.ORDERNO = A.ORDERNO " +" and T.PRODUCTNO not in " +" (select T.BILLETID from KCZ_TURNOFFLIST@xgcx T where t.ROLLNUMBER = '"+hashMapStr.get("BATCH_NO")+"') " +" and T.ORDERNO is not null AND A.SAMPLINGREQUESTTIME IN ('A', 'AB') " +" union all " +" SELECT A.SAMPLINGREQUESTTIME,T.ORDERNO DESIGN_KEY,T.ROLLNUMBER BATCH_NO,T.DETERMINANTCARDNUMBER GRADE_CODE,T.PLY THICK,T.BILLETID MATERIAL_NO " +" ,T.MOTHERBOARDNUMBER BOARD_NO FROM KCZ_TURNOFFLIST@xgcx T, SEL_PACTDETAIL_NEW@xgcx A " +" WHERE T.ORDERNO = A.ORDERNO and T.ORDERNO is not null AND T.ISVALID <> '0') t " +" WHERE t.BATCH_NO = '"+hashMapStr.get("BATCH_NO")+"' and t.BATCH_NO like 'Z%' " +" and t.GRADE_CODE = '"+hashMapStr.get("STEEL_CODE")+"' and to_char(t.THICK, 'fm990.099') = to_char('"+hashMapStr.get("THICK")+"', 'fm990.099') " +" and T.DESIGN_KEY = '"+hashMapStr.get("DESIGN_KEY")+"' " + freqCode + " group by t.SAMPLINGREQUESTTIME,T.DESIGN_KEY,T.BATCH_NO,T.GRADE_CODE,T.THICK,t.MATERIAL_NO,t.BOARD_NO order by t.MATERIAL_NO "; }else if(hashMapStr.get("PLINE_CODE").equals("HB1")){ materialNosql ="SELECT t.* " +" FROM (SELECT A.SAMPLINGREQUESTTIME,T.ORDERID DESIGN_KEY,T.BATCHNO BATCH_NO,to_char(T.STEELTYPE) GRADE_CODE,T.THICK THICK,T.SLABNO MATERIAL_NO, " +" T.MOTHERSLAB BOARD_NO FROM ZYHB_PLANDETAILOFPLATE@xgcx T, SEL_PACTDETAIL_NEW@xgcx A " +" WHERE T.ORDERID = A.ORDERNO " +" and T.SLABNO not in " +" (select T.BILLETID from KCH_TURNOFFLIST@xgcx T where t.ROLLNUMBER = '"+hashMapStr.get("BATCH_NO")+"') " +" and T.ORDERID is not null " +" union all " +" SELECT A.SAMPLINGREQUESTTIME,T.ALLOTORDERFORM DESIGN_KEY,T.ROLLNUMBER BATCH_NO,T.DETERMINANTCARDNUMBER GRADE_CODE,T.PLY THICK,T.BILLETID MATERIAL_NO " +" ,T.MOTHERBOARDNUMBER BOARD_NO FROM KCH_TURNOFFLIST@xgcx T, SEL_PACTDETAIL_NEW@xgcx A " +" WHERE T.ALLOTORDERFORM = A.ORDERNO and T.ALLOTORDERFORM is not null AND T.PSTATFLAG <> '0') t " +" WHERE t.BATCH_NO = '"+hashMapStr.get("BATCH_NO")+"' and t.BATCH_NO like 'H%' " +" and t.GRADE_CODE = '"+hashMapStr.get("STEEL_CODE")+"' and to_char(t.THICK, 'fm990.099') = to_char('"+hashMapStr.get("THICK")+"', 'fm990.099') " +" and T.DESIGN_KEY = '"+hashMapStr.get("DESIGN_KEY")+"' " + freqCode +" group by t.SAMPLINGREQUESTTIME,T.DESIGN_KEY,T.BATCH_NO,T.GRADE_CODE,T.THICK,t.MATERIAL_NO,t.BOARD_NO order by t.MATERIAL_NO asc"; } return materialNosql; } //自动刷激光 public void AutoTimeJG() throws Exception { try { SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession(); mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class); String sql="select t.* from QCM_JHY_SAMPLE_CONSIGN_JG t where t.yn = 'Y' and rownum <=100 ORDER BY T.CREATE_TIME "; List qltyLists=mapper.query(sql.toString()); if(qltyLists!=null && qltyLists.size()>=1){ for (int i = 0; i < qltyLists.size(); i++) { HashMap Quotehm =new HashMap(); String SPECIMEN_NO = qltyLists.get(i).get("SPECIMEN_NO").toString(); Quotehm.put("SPECIMEN_NO", SPECIMEN_NO); Quotehm.put("BATCH_NO", qltyLists.get(i).get("BATCH_NO").toString()); Quotehm.put("PLINE_CODE", qltyLists.get(i).get("PLINE_CODE").toString()); Send2 jg=new Send2(); CoreReturnObject oj=jg.SendJG(SPECIMEN_NO,"JG","JG",Quotehm); String rinfo=oj.getV_errMsg().toString(); if(rinfo.equals("待发送的检验委托数据已经不存在,请核实数据!")){ String sqlord = " update QCM_JHY_SAMPLE_CONSIGN_JG r set r.SUCCESS_MEMO='"+rinfo+"',r.YN='N' " +" where r.SPECIMEN_NO='"+SPECIMEN_NO+"' "; mapper.updateJudgeStatus(sqlord.toString()); SqlSession.commit(); } } } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); System.out.println("发送激光接口失败:"+e.getMessage()); }finally { SqlSession.close(); } } //电弧炉熔炼成分自动判定 public void AutoTimeHDL() throws Exception { try { SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession(); mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class); String sql="select f.HEAT_NO,f.MATERIAL_NO,f.DESIGN_KEY,f.SNAME,f.STEEL_CODE,f.ASSAY_NO from ( " +" select k.STOVENO HEAT_NO,k.BILLETID MATERIAL_NO,k.ORDERNO DESIGN_KEY,'system' SNAME,k.DETERMINANTCARDNUMBER STEEL_CODE,t.ASSAY_NO " +" from kcx_turnofflist@xgcx k,zj_result_all@xgcx z,qcm_jhy_insp_elements t " +" where k.BILLETID = z.BILLETID " +" and k.STOVENO = t.HEAT_NO " +" and t.heat_no like 'E%' " +" and z.JUDGERESULT = '0' " +" and z.R_CHEMRESULT = '0' " +" and z.CREATE_TIME > TO_DATE('2024-09-01 00:00:01','YYYY-MM-DD HH24:MI:SS') " +" and k.STOVENO is not null " +" and k.BILLETID is not null " +" and k.ORDERNO is not null " +" and k.DETERMINANTCARDNUMBER is not null " +" and t.ASSAY_NO is not null " +" group by k.STOVENO,k.BILLETID,k.ORDERNO,k.DETERMINANTCARDNUMBER,t.ASSAY_NO " +" order by k.BILLETID) f " +" where rownum <=100 "; List qltyLists=mapper.query(sql.toString()); if(qltyLists!=null && qltyLists.size()>=1){ for (int i = 0; i < qltyLists.size(); i++) { String heat_no = qltyLists.get(i).get("HEAT_NO").toString();//炉号 String material_no = qltyLists.get(i).get("MATERIAL_NO").toString();//子板号 String design_key = qltyLists.get(i).get("DESIGN_KEY").toString();//订单号 String username = qltyLists.get(i).get("SNAME").toString();//操作人 String grade_name = qltyLists.get(i).get("STEEL_CODE").toString();//牌号 String assay_no = qltyLists.get(i).get("ASSAY_NO").toString();//成分化验号 ArrayList list = new ArrayList(); list.add(assay_no); System.out.println("\n子板号:"+material_no); QcmJhyElementsServiceImpl impl = new QcmJhyElementsServiceImpl(); impl.RlChemJudgeByHuman(heat_no, material_no, design_key, username, grade_name, list); System.out.println("\n子板号:"+material_no+"结束"); } } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); System.out.println("电弧炉熔炼成分自动判定失败:"+e.getMessage()); }finally { SqlSession.close(); } } /** * 调整热处理号 * @param materialInfo * @return * @throws Exception */ public CoreReturnObject doProcessNos(HashMap parmas) throws Exception { try { String rclState =parmas.get("PROCESS_NOS").toString();//修改的热处理号 String sqlStr =""; //判断是否是模拟焊后 String sqlmn="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.SMP_NO = '"+parmas.get("SMP_NO")+"' and t.SMP_LOCATION like '%模拟焊后%' "; List map2=mapper.query(sqlmn.toString()); if(map2!=null && map2.size()>=1){ sqlStr="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.smp_no = '"+parmas.get("SMP_NO")+"' "; }else{ sqlStr = "select * from QCM_JHY_SAMPLE_CONSIGN_D t" + " where t.BATCH_NO = '"+parmas.get("BATCH_NO")+"' " + " and t.SMP_NO = '"+parmas.get("SMP_NO")+"' "; // sqlStr = "select * from QCM_JHY_SAMPLE_CONSIGN_D t" // + " where t.BATCH_NO = '"+parmas.get("BATCH_NO")+"' " // + " and t.SPECIMEN_NO = '"+parmas.get("SPECIMEN_NO")+"' " // + " and t.SMP_NO = '"+parmas.get("SMP_NO")+"' "; } List map=mapper.query(sqlStr.toString()); if(map !=null && map.size()>=1){ String str = parmas.get("USER_NAME")+"修改热处理号为"+rclState; for (HashMap hashMap : map) { sqlStr=""; sqlStr="select * from QCM_JHY_SAMPLE_CONSIGN_D t where t.specimen_no = '"+hashMap.get("SPECIMEN_NO")+"' and t.process_nos <>'"+rclState+"'"; List mappr=mapper.query(sqlStr.toString()); if(mappr!=null && mappr.size()>=1){ sqlStr=""; sqlStr="update QCM_JHY_SAMPLE_CONSIGN_D t set PROCESS_NOS='"+rclState+"'," + " ARTIFICIAL_MEMO=t.ARTIFICIAL_MEMO||',"+str+"'||'原委托热处理号为:'||t.PROCESS_NOS " + " where t.BATCH_NO = '"+hashMap.get("BATCH_NO")+"' " + " and t.SPECIMEN_NO = '"+hashMap.get("SPECIMEN_NO")+"' " + " and t.SMP_NO = '"+hashMap.get("SMP_NO")+"' "; mapper.updateJudgeStatus(sqlStr.toString()); String strMemo = "取样编号:"+hashMap.get("SPECIMEN_NO")+str+",原委托热处理号为:"+hashMap.get("PROCESS_NOS"); QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(parmas.get("USER_NAME").toString()); qjog.setBatchno(parmas.get("BATCH_NO") == null ?"":parmas.get("BATCH_NO").toString()); qjog.setOperate_type("调整热处理号"); qjog.setParams(parmas.get("MATERIAL_NO") == null ?"":parmas.get("MATERIAL_NO").toString()); qjog.setProd_line(parmas.get("PLINE_CODE") == null ?"":parmas.get("PLINE_CODE").toString()); qjog.setMemo(strMemo); mapper.insertQcmJudgeOperateLog(qjog); } } /* if(map.get(0).get("STATUS").toString().equals("3")){ String INSPECTION_LOT = map.get(0).get("INSPECTION_LOT").toString(); String PLINE_CODE = map.get(0).get("PLINE_CODE").toString(); QcmJudgeLog qjlt = new QcmJudgeLog(); qjlt.setJudge_type("R"); qjlt.setMaterial_no(INSPECTION_LOT); qjlt.setCreate_name("sysZH"); qjlt.setProd_line(PLINE_CODE); mapper.insertQcmJudgeLog(qjlt); }*/ } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("调整失败!"); return cro; } SqlSession.commit(); SqlSession.close(); cro.setV_errCode(1); return cro; } //打印标识 public CoreReturnObject doPrintLog(String specimenNo) throws Exception { try { String sql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.print_log = '已打印' where t.specimen_no = '"+specimenNo+"' "; mapper.updateJudgeStatus(sql.toString()); } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("打印失败!"); return cro; } SqlSession.commit(); SqlSession.close(); return cro; } //一键删除委托 public CoreReturnObject doDelAllWT(HashMap parmas) throws Exception { try { String upsql=""; String sql="select * from qcm_jhy_sample_consign_d t,qcm_jhy_sample_consign_m m, qcm_jhy_sample_r_ord r " +" where t.smp_no = r.smp_no " +" and t.smp_no = m.smp_no " +" and m.smp_no = r.smp_no " +" and t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "; List hmap=mapper.query(sql.toString()); if(hmap!=null && hmap.size()>=1){ //材质判定 if(!hmap.get(0).get("STATUS").equals("0") && (hmap.get(0).get("JUDGE_RESULT_CODE").equals("1") || hmap.get(0).get("JUDGE_RESULT_CODE").equals("2"))){ upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '已材质判定请取消判定' where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(upsql.toString()); SqlSession.commit(); SqlSession.close(); return cro; } //不是按炉 下发委托 未撤回 if(!hmap.get(0).get("STATUS").equals("0") && !hmap.get(0).get("FREQ_CODE").equals("D")){ upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '已下发委托未撤回' where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(upsql.toString()); SqlSession.commit(); SqlSession.close(); return cro; } //按炉 送样委托 未撤回 if(!hmap.get(0).get("STATUS").equals("0") && hmap.get(0).get("FREQ_CODE").equals("D") && hmap.get(0).get("QUOTE_CONSIGN_NO")==null){ upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.ONEMEMO = '送样夹杂已下发委托未撤回' where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(upsql.toString()); SqlSession.commit(); SqlSession.close(); return cro; } } //String uuid=this.getUUID(); upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set VALIDFLAG='0',t.STATUS = '6',t.HEAT_NO='del' || t.HEAT_NO " + " where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.smp_no = '"+parmas.get("SMP_NO")+"' "; mapper.updateJudgeStatus(upsql.toString()); //夹杂复样按炉 /*if(hmap.get(0).get("SMP_TYPE_CODE").equals("1") && hmap.get(0).get("FREQ_CODE").equals("D") && !hmap.get(0).get("JUDGE_RESULT_CODE").equals("1")){ upsql= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.HEAT_NO='del' || t.HEAT_NO " + " where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' and t.smp_no = '"+parmas.get("SMP_NO")+"' "; mapper.updateJudgeStatus(upsql.toString()); }*/ String strMemo = parmas.get("DESIGN_KEY").toString()+','+hmap.get(0).get("STEEL_CODE")+','+hmap.get(0).get("THICK") +",取样编号:"+parmas.get("SPECIMEN_NO")+"频次:"+hmap.get(0).get("FREQ_CODE")+"原因:"+parmas.get("MEMO").toString(); QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(parmas.get("USER_NAME").toString()); qjog.setBatchno(parmas.get("BATCH_NO") == null ?"":parmas.get("BATCH_NO").toString()); qjog.setOperate_type("一键删除委托"); qjog.setParams(parmas.get("MATERIAL_NO") == null ?"":parmas.get("MATERIAL_NO").toString()); qjog.setProd_line(parmas.get("PLINE_CODE") == null ?"":parmas.get("PLINE_CODE").toString()); qjog.setJudge_result(parmas.get("DESIGN_KEY") == null ?"":parmas.get("DESIGN_KEY").toString()); qjog.setMemo(strMemo); mapper.insertQcmJudgeOperateLog(qjog); sql=" select * from qcm_jhy_sample_consign_d t " +" where t.smp_no = '"+parmas.get("SMP_NO")+"' and t.status <> '6' "; List hmapwt=mapper.query(sql.toString()); if(hmapwt==null || hmapwt.size()<=0){ upsql= " update Qcm_Jhy_Sample_r_Ord t set t.DESIGN_KEY = 'del' || t.DESIGN_KEY,t.THICK='del' || t.THICK,t.INSPECTION_LOT='',t.HEAT_NO='del' || t.HEAT_NO " + " where t.smp_no = '"+parmas.get("SMP_NO")+"' "; mapper.updateJudgeStatus(upsql.toString()); } } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("一键删除失败!"); return cro; } SqlSession.commit(); SqlSession.close(); return cro; } //修改LRA public CoreReturnObject UPZHBLRA(HashMap parmas) throws Exception { try { //查询出系统默认指定的样数据 String sql="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "; List hmap=mapper.query(sql.toString()); if(hmap==null || hmap.size()<=0){ cro.setV_errCode(-1); cro.setV_errMsg("未找到相应修改数据!"); return cro; } String special_quote_memo = hmap.get(0).get("SPECIAL_QUOTE_MEMO").toString(); String BATCH_NO = hmap.get(0).get("BATCH_NO").toString(); //查询出修改的数据 sql=""; sql="select * from qcm_jhy_sample_consign_d t where t.specimen_no = '"+parmas.get("SPECIMEN_NO_CK")+"' "; List hmLAR=mapper.query(sql.toString()); if(hmLAR==null || hmLAR.size()<=0){ cro.setV_errCode(-1); cro.setV_errMsg("未找到相应修改数据!"); return cro; } String BATCH_NO_CK=hmLAR.get(0).get("BATCH_NO").toString();//人工指定的轧批号 String SPECIMEN_NO_CK=parmas.get("SPECIMEN_NO_CK").toString();//人工指定的取样编号 String MATERIAL_NO_CK=hmLAR.get(0).get("MATERIAL_NO").toString(); String PLINE_CODE_CK=hmLAR.get(0).get("PLINE_CODE").toString(); String DESIGN_KEY_CK=hmLAR.get(0).get("DESIGN_KEY").toString(); //开始修改人工指定的轧批 String updateD= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.SPECIAL_QUOTE_MEMO = '"+special_quote_memo+"' where t.specimen_no = '"+parmas.get("SPECIMEN_NO_CK")+"' "; mapper.updateJudgeStatus(updateD.toString()); String updateI = " update qcm_jhy_sample_consign_d_item t " +" set QUOTE_SPECIMEN_NO= '',QUOTE_SEQ = '',QUOTE_MEMO='', MEMOLAR='' " +" where t.SPECIMEN_NO='"+parmas.get("SPECIMEN_NO_CK")+"' and t.PHY_CODE_L = 'HC' "; mapper.updateJudgeStatus(updateI.toString()); //清空默认指定的轧批D表 updateD=""; updateD= " update QCM_JHY_SAMPLE_CONSIGN_D t set t.SPECIAL_QUOTE_MEMO = '' where t.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(updateD.toString()); //只要是还没有判定的就换成指定的引用轧批 sql=""; sql="select i.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_consign_d_item i " +" where t.specimen_no = i.specimen_no and t.status != '3' " +" and (i.specimen_no = '"+parmas.get("SPECIMEN_NO")+"' or i.quote_specimen_no = '"+parmas.get("SPECIMEN_NO")+"') " +" and i.Phy_Code_l = 'HC' "; List hmitem=mapper.query(sql.toString()); if(hmitem!=null && hmitem.size()>=1){ TreeSet specimenNo=new TreeSet();//取样编号 for (int i = 0; i < hmitem.size(); i++) { HashMap obj=hmitem.get(i); specimenNo.add((String)obj.get("SPECIMEN_NO")); } //循环改值 for(String str : specimenNo){ String updateItem= " update qcm_jhy_sample_consign_d_item t " +" set QUOTE_SPECIMEN_NO= '"+SPECIMEN_NO_CK+"',QUOTE_MEMO='已引用'||'"+SPECIMEN_NO_CK+"', " + " MEMOLAR='加项项目已引用'||'"+BATCH_NO_CK+"' " +" where t.SPECIMEN_NO='"+str+"' and t.PHY_CODE_L = 'HC' "; mapper.updateJudgeStatus(updateItem.toString()); } } String strMemo = BATCH_NO+"修改成"+BATCH_NO_CK+"送样,取样编号:"+SPECIMEN_NO_CK; QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(parmas.get("USER_NAME").toString()); qjog.setBatchno(BATCH_NO_CK); qjog.setOperate_type("修改LRA"); qjog.setParams(MATERIAL_NO_CK); qjog.setProd_line(PLINE_CODE_CK); qjog.setJudge_result(DESIGN_KEY_CK); qjog.setMemo(strMemo); mapper.insertQcmJudgeOperateLog(qjog); } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("修改失败!"); return cro; } SqlSession.commit(); SqlSession.close(); return cro; } //预测换样 public CoreReturnObject doForecastRZ(HashMap parmas) throws Exception { try { String sql="select * from qcm_jhy_sample_consign_d t where t.batch_no = '"+parmas.get("BATCH_NO")+"' and t.specimen_no ='"+parmas.get("SPECIMEN_NO")+"' " +" and t.rz_roll_mana_no is not null and t.status = '3' and rownum = 1"; List hmap=mapper.query(sql.toString()); if(hmap==null || hmap.size()<=0){ cro.setV_errCode(-1); cro.setV_errMsg("未找到相应数据!"); return cro; } String RZ_ROLL_MANA_NO = hmap.get(0).get("RZ_ROLL_MANA_NO").toString();//轧辊单元 String RZ_MIXROLL = hmap.get(0).get("RZ_MIXROLL").toString();//组批区间 String RZ_OLD_SAMPL_NO = hmap.get(0).get("RZ_OLD_SAMPL_NO").toString();//预测抽样卷 String BATCH_NO = parmas.get("BATCH_NO").toString();//轧批号 String INSPECTION_LOT = hmap.get(0).get("INSPECTION_LOT").toString();//检验号 String sql2 = "select * from qcm_jhy_sample_consign_d t where t.RZ_ROLL_MANA_NO = '"+RZ_ROLL_MANA_NO+"' and t.rz_mixroll = '"+RZ_MIXROLL+"' " +" and t.Rz_Old_Sampl_No = '"+RZ_OLD_SAMPL_NO+"' and t.batch_no <>'"+BATCH_NO+"' and t.pline_code = 'RZ1' "; List hmap2=mapper.query(sql2.toString()); if(hmap2==null || hmap2.size()<=0){ cro.setV_errCode(-1); cro.setV_errMsg("未找到相应预测数据!"); return cro; } for (int i = 0; i < hmap2.size(); i++) { HashMap obj=hmap2.get(i); String SMP_NO = obj.get("SMP_NO").toString(); String SPECIMEN_NO = obj.get("SPECIMEN_NO").toString(); //修改ORD表 String ordUpSql="update QCM_JHY_SAMPLE_R_ORD ord set ord.judge_status = '0' where ord.pline_code = 'RZ1' and ord.smp_no = '"+SMP_NO+"' "; mapper.updateJudgeStatus(ordUpSql.toString()); //修改D表 String dUpSql = " update qcm_jhy_sample_consign_d t set t.status = '0' ,t.send_id = '',t.send_name = '',t.send_time = '', " + " t.RZ_ROLL_MANA_NO = '',t.rz_mixroll = '',t.Rz_Old_Sampl_No = '',t.RZ_ROLL_SLAB_SEQ = '',t.CONSIGN_NO = '', " + " t.CONSIGN_NO_SEQ = '' where t.SPECIMEN_NO = '"+SPECIMEN_NO+"' "; mapper.updateJudgeStatus(dUpSql.toString()); } //修改D表 String dUpSql = " update qcm_jhy_sample_consign_d t set t.SEND_MEMO = '预测换样' where t.SPECIMEN_NO = '"+parmas.get("SPECIMEN_NO")+"' "; mapper.updateJudgeStatus(dUpSql.toString()); //预测抽样第一次不合格清除 String millUpSql = "update tbf02_spec_mill t set MIXROLL='' where t.COIL_NO in ( " +" select COIL_NO from tbh02_coil_comm c where c.OLD_SAMPL_NO like '"+BATCH_NO+"%' )"; mapper.updateJudgeStatus(millUpSql.toString()); //查询预测下的所有子板 String coilSelSql="select t.pic_is_lock,t.inspection_lot,t.COIL_NO from qcm_judge_coil_result t " +" where t.INSPECTION_LOT = '"+INSPECTION_LOT+"' and t.COIL_NO not like '"+BATCH_NO+"%' "; List hmap3=mapper.query(coilSelSql.toString()); if(hmap3 != null && hmap3.size()>=1){ for (int i = 0; i < hmap3.size(); i++) { HashMap obj=hmap3.get(i); String COIL_NO = obj.get("COIL_NO").toString();//子板号 //异常处理界面解锁 String lockUpSql="update qcm_judge_locking a set a.unlock_type_code = '9', a.unlock_type_desc = '解除' " +" where MATERIAL_NO ='"+COIL_NO+"' and unlock_type_code is null and lock_type_code = 'P' "; mapper.updateJudgeStatus(lockUpSql.toString()); //热轧库存表解锁 String coilUpSql="UPDATE qcm_judge_coil_result T SET T.PIC_IS_LOCK = '0' where t.COIL_NO = '"+COIL_NO+"' "; mapper.updateJudgeStatus(coilUpSql.toString()); } } QcmJudgeOperateLog qjog = new QcmJudgeOperateLog(); qjog.setOperate_name(parmas.get("USER_NAME").toString()); qjog.setBatchno(BATCH_NO); qjog.setOperate_type("热轧预测换样"); qjog.setParams(RZ_OLD_SAMPL_NO); qjog.setProd_line("RZ1"); qjog.setMemo(RZ_ROLL_MANA_NO+":"+RZ_MIXROLL+":"+BATCH_NO +":"+parmas.get("SPECIMEN_NO").toString()); mapper.insertQcmJudgeOperateLog(qjog); } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("预测换样失败!"); return cro; } SqlSession.commit(); SqlSession.close(); return cro; } //重置船检编号 public CoreReturnObject upShipInspec(HashMap parmas) throws Exception { try { String cic= parmas.get("CERT_INST_CODE").toString(); String uid= parmas.get("USERID").toString(); String una= parmas.get("USERNAME").toString(); // String YYMM= parmas.get("YYMM").toString(); String upsql="update QCM_JHY_SHIP_INSPEC t set t.yn_log = '0' where t.Cert_Inst_Code = '"+cic+"' "; mapper.updateJudgeStatus(upsql.toString()); String insql = "insert into qcm_jhy_ship_inspec " +" (cert_inst_code, cert_inst_name, pline_code, yymm,create_id, create_name, fh_log) " +" select t.cert_inst_code,t.cert_inst_name,t.pline_code,to_char(sysdate,'yymm'), " +" '"+uid+"','"+una+"',t.fh_log from qcm_jhy_ship_inspec t where t.Cert_Inst_Code = '"+cic+"' and rownum = 1 "; mapper.insert(insql); /*SimpleDateFormat sdf = new SimpleDateFormat("yyMM"); String syh = sdf.format(new Date()); String syh1=syh;*/ String FH_LOG= parmas.get("FH_LOG").toString();//缩写 // syh+=FH_LOG; /* if(!YYMM.equals(syh1)){ YYMM+=FH_LOG; String uplog = "update QCM_JHY_SAMPLE_CONSIGN_D t set t.PRINT_SEQJLOT = '0' where t.PRINT_SEQJ like '"+YYMM+"%' and t.pline_code in ('ZB1','HB1') "; mapper.updateJudgeStatus(uplog.toString()); }*/ String uplog = "update QCM_JHY_SAMPLE_CONSIGN_D t set t.PRINT_SEQJLOT = '0' where t.PRINT_SEQJ like '"+FH_LOG+"%' and t.pline_code in ('ZB1','HB1') "; mapper.updateJudgeStatus(uplog.toString()); SqlSession.commit(); } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("重置失败!"); return cro; } cro.setV_errCode(1); cro.setV_errMsg("重置成功!"); SqlSession.close(); return cro; } //新增螺纹钢牌号 public CoreReturnObject AddLWGSTEEL(HashMap parmas) throws Exception { try { String steel=parmas.get("STEEL").toString(); String userid=parmas.get("USERID").toString(); String username=parmas.get("USERNAME").toString(); String sql="SELECT (max(T.SEQ) + 1) SEQ FROM QCM_JHY_STEEL T "; HashMap result=mapper.queryOne(sql.toString()); BigDecimal seq=BigDecimal.ZERO; if (result!=null && result.get("SEQ")!=null ) { seq=(BigDecimal)result.get("SEQ"); } String insql = "insert into QCM_JHY_STEEL " +" (SEQ, STEEL_NAME, REGULATION, CONTAIN,CREATE_ID, CREATE_NAME) " +" VALUES ('"+seq+"','"+steel+"','1','0','"+userid+"','"+username+"')"; mapper.insert(insql); SqlSession.commit(); } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("增加失败!"+e.getMessage()); return cro; } cro.setV_errCode(1); cro.setV_errMsg("增加成功"); SqlSession.close(); return cro; } //删除螺纹钢牌号 public CoreReturnObject delLWGSTEEL(HashMap parmas) throws Exception { try { String steel=parmas.get("STEEL").toString(); String userid=parmas.get("USERID").toString(); String username=parmas.get("USERNAME").toString(); String sql = "update QCM_JHY_STEEL t " +" set t.yn_log = '0',t.delete_id='"+userid+"',t.delete_name='"+username+"',t.delete_time=sysdate " +" where t.steel_name = '"+steel+"' "; mapper.updateJudgeStatus(sql.toString()); SqlSession.commit(); } catch (Exception e) { SqlSession.rollback(); SqlSession.close(); cro.setV_errCode(-1); cro.setV_errMsg("增加失败!"+e.getMessage()); return cro; } cro.setV_errCode(1); cro.setV_errMsg("增加成功"); SqlSession.close(); return cro; } }