4b2ebecf1af194f5fd79e081fd70aef827dd4e4c.svn-base 111 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661
  1. /***文档注释***********************************************
  2. * 作者 :freedom
  3. * 创建日期 :2022-02-24
  4. * 描述 :检验委托-查询材质检验委托
  5. * 注意事项 :
  6. * 遗留BUG :
  7. * 修改日期 :
  8. * 修改人员 :
  9. * 修改内容 :
  10. ***********************************************************/
  11. package QCM.JHY01.JHY0101;
  12. import java.sql.Connection;
  13. import java.sql.PreparedStatement;
  14. import java.sql.ResultSet;
  15. import java.sql.ResultSetMetaData;
  16. import java.sql.SQLException;
  17. import java.util.HashMap;
  18. import java.util.List;
  19. import java.util.TreeSet;
  20. import org.apache.commons.lang.StringUtils;
  21. import org.apache.ibatis.session.SqlSession;
  22. import com.alibaba.fastjson.JSON;
  23. import com.alibaba.fastjson.JSONArray;
  24. import com.alibaba.fastjson.JSONException;
  25. import com.alibaba.fastjson.JSONObject;
  26. import CoreFS.SA01.CoreIComponent;
  27. import CoreFS.SA06.CoreReturnObject;
  28. import QCM.COMMUNAL.QCM02.SqlJoint;
  29. import QCM.JHY01.JHY0102.UpdateInfo;
  30. public class QuerryQltySample extends CoreIComponent {
  31. CoreReturnObject cro = new CoreReturnObject();
  32. SqlSession SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  33. QCM.COMMUNAL.OrderSqMapper mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  34. public String StrSky(String begintime,String endtime){
  35. String sql = "select (to_date('"+endtime+"','yyyy-MM-dd') - to_date('"+begintime+"','yyyy-MM-dd')) SKY from dual";
  36. HashMap list = mapper.queryOne(sql);
  37. Double ble = Double.parseDouble(list.get("SKY").toString());
  38. String tstr="FALSE";
  39. if(ble>=0 && ble <=30 ){
  40. tstr="TRUE";
  41. }
  42. return tstr;
  43. }
  44. /**
  45. * 查询材质试样信息(线棒、连退)
  46. * @param parmas
  47. * @return
  48. */
  49. public CoreReturnObject getQltySampleInfo(HashMap parmas) {
  50. try{
  51. if (!SqlJoint.IsNullOrSpace(parmas.get("STARTTIME").toString()) && !SqlJoint.IsNullOrSpace(parmas.get("ENDTIME").toString())) {
  52. String sky=StrSky(parmas.get("STARTTIME").toString(),parmas.get("ENDTIME").toString());
  53. if(sky.equals("FALSE")){
  54. SqlSession.close();
  55. cro.setV_errCode(-1);
  56. cro.setV_errMsg("查询时间不能大于30天,请核实查询时间条件!");
  57. return cro;
  58. }
  59. }
  60. StringBuffer sqlucomm = new StringBuffer();
  61. sqlucomm.append("select t1.SMP_NO,t1.SPECIMEN_NO,t1.HEAT_NO,t1.BATCH_NO,t1.INSPECTION_LOT,t1.FREQ_CODE,");
  62. sqlucomm.append("t1.FREQ_NAME,t1.MATERIAL_NO,t1.SEND_MEMO,t1.SMP_TYPE_CODE, ");
  63. sqlucomm.append(" case when t1.SMP_TYPE_CODE = '0' then "
  64. +" case when t2.CERT_INST_CODE in ('IC003','IC004','IC001','IC010','5000') then "
  65. +" t1.SMP_TYPE_NAME "
  66. +" else '认证样' end "
  67. +" else t1.SMP_TYPE_NAME "
  68. +" end SMP_TYPE_NAME,");
  69. sqlucomm.append("t1.CONSIGN_NO, t1.CONSIGN_NO_SEQ,t1.TEST_QTY,t1.SMP_QTY,t1.SMP_LOCATION, t1.BOARD_NO, t1.QUOTE_CONSIGN_NO,t1.OLD_CONSIGN_NO,");
  70. sqlucomm.append("t1.PLINE_CODE,t1.PLINE_NAME,t1.STATUS,t1.VALIDFLAG,t1.SOURCE, ");
  71. sqlucomm.append("t1.SEND_NAME,to_char(t1.SEND_TIME,'yyyy-mm-dd hh24:mi:ss') SEND_TIME,");
  72. sqlucomm.append("t1.SOURCE, t1.memo,t1.WEIGHT,t1.WEIGHT_STD,t1.WEIGHT_SFD,t2.SMP_TYPE_CODE as SMP_TYPE_CODE1,t2.SMP_TYPE_NAME as SMP_TYPE_NAME1,");
  73. sqlucomm.append("t2.CERT_INST_CODE,t2.CREATE_NAME,to_char(t1.CREATE_TIME,'yyyy-mm-dd hh24:mi:ss') CREATE_TIME,t2.smp_catg as smp_catg, t2.CERT_INST_NAME,");
  74. sqlucomm.append("t2.BOARD_NO, t2.MATERIAL_NO,t2.psc,t2.psc_desc, "
  75. +" case when t1.phy_item is not null then t1.phy_item else dbms_lob.substr((select wmsys.wm_concat(DISTINCT PHY_NAME_S) "
  76. +" from QCM_JHY_SAMPLE_CONSIGN_D_ITEM WHERE SPECIMEN_NO = t1.SPECIMEN_NO and fy_quote_specimen_no is null)) end PHY_NAME_L_BJ, " );
  77. sqlucomm.append(" ord.DESIGN_KEY,to_char(ord.THICK, 'fm990.099') THICK,ord.WIDTH,");
  78. if(parmas.get("PLINE_NAME").equals("厚板线")){
  79. sqlucomm.append(" (select length from kch_turnofflist@xgcx where BILLETID = t1.MATERIAL_NO and rownum <= 1) LENGTH,");
  80. sqlucomm.append(" (select max(INSTORAGETIME) INTIME from kch_turnofflist@xgcx where BILLETID = t1.MATERIAL_NO and rownum <= 1) INTIME,");
  81. }else if(parmas.get("PLINE_NAME").equals("中板线")){
  82. sqlucomm.append(" (select length from kcz_turnofflist@xgcx where BILLETID = t1.MATERIAL_NO and rownum <= 1) LENGTH,");
  83. sqlucomm.append(" (select max(INTIME) from kcz_turnofflist@xgcx where BILLETID = t1.MATERIAL_NO and rownum <= 1) INTIME,");
  84. }else if (parmas.get("PLINE_CODE").equals("LT")){
  85. sqlucomm.append(" t1.PRINT_LOG,t1.SEND_SEQ,t1.PRINT_SEQ, ");
  86. }else{
  87. sqlucomm.append(" ord.LENGTH,");
  88. }
  89. sqlucomm.append(" ord.DELIVERY_STATE_CODE,ord.DELIVERY_STATE_DESC,ord.PROD_NAME,ord.STEEL_NAME,ord.STD_NAME,t1.ITEM_FLAG ");
  90. sqlucomm.append(" from QCM_JHY_SAMPLE_CONSIGN_D t1 left join QCM_JHY_SAMPLE_CONSIGN_M t2 on t1.SMP_NO=t2.SMP_NO");
  91. sqlucomm.append(" inner join QCM_JHY_SAMPLE_R_ORD ord on t1.smp_no = ord.smp_no ");
  92. sqlucomm.append(" where 1=1");
  93. if (parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  94. && parmas.get("BATCH_NO2")!=null && !"".equals(((String)parmas.get("BATCH_NO2")).trim()) ) {
  95. sqlucomm.append(" and upper(t1.batch_no) >= upper('"+parmas.get("BATCH_NO")+"')");
  96. sqlucomm.append(" and upper(t1.batch_no) <= upper('"+parmas.get("BATCH_NO2")+"')");
  97. }else if(parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  98. && parmas.get("checkboxVal").equals("1")){
  99. sqlucomm.append(" and t1.batch_no like '"+parmas.get("BATCH_NO")+"%' ");
  100. }
  101. if (parmas.get("CERT_INST_NAME")!=null && !"".equals(((String)parmas.get("CERT_INST_NAME")).trim())) {
  102. sqlucomm.append(" and t2.cert_inst_name like '"+parmas.get("CERT_INST_NAME")+"%'");
  103. }
  104. if (parmas.get("STEEL_NAME")!=null && !"".equals(((String)parmas.get("STEEL_NAME")).trim())) {
  105. sqlucomm.append(" and ord.steel_name like '"+parmas.get("STEEL_NAME")+"%'");
  106. }
  107. if (parmas.get("SMP_CATG")!=null && !"".equals(((String)parmas.get("SMP_CATG")).trim())) {
  108. sqlucomm.append(" and t2.smp_catg = '"+parmas.get("SMP_CATG")+"'");
  109. }
  110. if (parmas.get("VALIDFLAG")!=null && !"".equals(((String)parmas.get("VALIDFLAG")).trim())) {
  111. sqlucomm.append(" and t1.validflag='"+parmas.get("VALIDFLAG")+"'");
  112. }
  113. if (parmas.get("STATUS")!=null && !"".equals(((String)parmas.get("STATUS")).trim())) {
  114. sqlucomm.append(" and t1.STATUS='"+parmas.get("STATUS")+"' and t1.STATUS <> '6' ");
  115. }else{
  116. sqlucomm.append(" and t1.STATUS <> '0' and t1.STATUS <> '5' and t1.STATUS <> '6' ");
  117. }
  118. if(parmas.get("DESIGN_KEY")!=null && !"".equals(((String)parmas.get("DESIGN_KEY")).trim())){
  119. sqlucomm.append(" and ord.DESIGN_KEY like '"+parmas.get("DESIGN_KEY")+"%'");
  120. }
  121. if(parmas.get("TAB_NAME")!=null && !"".equals(((String)parmas.get("TAB_NAME")).trim())){
  122. //发送时间
  123. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  124. sqlucomm.append(" and t1.send_time>=to_date(concat('"+parmas.get("STARTTIME")+"',' 00:00:00'),'yyyy-MM-dd HH24:mi:ss')");
  125. }
  126. if (parmas.get("ENDTIME")!=null && !"".equals(((String)parmas.get("ENDTIME")).trim())) {
  127. sqlucomm.append(" and t1.send_time<=to_date(concat('"+parmas.get("ENDTIME")+"',' 23:59:59'),'yyyy-MM-dd HH24:mi:ss') ");
  128. }
  129. }else{
  130. //创建时间
  131. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  132. sqlucomm.append(" and t1.CREATE_TIME>=to_date(concat('"+parmas.get("STARTTIME")+"',' 00:00:00'),'yyyy-MM-dd HH24:mi:ss')");
  133. }
  134. if (parmas.get("ENDTIME")!=null && !"".equals(((String)parmas.get("ENDTIME")).trim())) {
  135. sqlucomm.append(" and t1.CREATE_TIME<=to_date(concat('"+parmas.get("ENDTIME")+"',' 23:59:59'),'yyyy-MM-dd HH24:mi:ss') ");
  136. }
  137. }
  138. if(parmas.get("PLINE_NAME").equals("厚板线")){
  139. sqlucomm.append(" and t1.BATCH_NO like 'H%' ");
  140. }else if(parmas.get("PLINE_NAME").equals("中板线")){
  141. sqlucomm.append(" and t1.BATCH_NO like 'Z%' ");
  142. }
  143. if (parmas.get("PLINE_NAME")!=null && !"".equals(((String)parmas.get("PLINE_NAME")).trim())) {
  144. if(parmas.get("PLINE_NAME").equals("高线")){
  145. sqlucomm.append(" and t2.PLINE_NAME in ('高线','二线厂')");
  146. }else{
  147. sqlucomm.append(" and t2.PLINE_NAME like '"+parmas.get("PLINE_NAME")+"%'");
  148. }
  149. }
  150. if (parmas.get("PLINE_CODE")!=null && !"".equals(((String)parmas.get("PLINE_CODE")).trim())) {
  151. //sqlucomm.append(" and t2.PLINE_CODE = '"+parmas.get("PLINE_CODE")+"'");
  152. }
  153. if (parmas.get("HEAT_NO")!=null && !"".equals(((String)parmas.get("HEAT_NO")).trim())) {
  154. sqlucomm.append(" and t1.HEAT_NO like '"+parmas.get("HEAT_NO")+"%'");
  155. }
  156. if(parmas.get("TAB_NAME")!=null && !"".equals(((String)parmas.get("TAB_NAME")).trim())){
  157. sqlucomm.append(" order by t1.send_time desc,t1.BATCH_NO desc");
  158. }else{
  159. sqlucomm.append(" order by t1.CREATE_TIME desc,t1.BATCH_NO desc ");
  160. }
  161. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  162. cro.setResult(listEle);
  163. }catch(Exception ex){
  164. cro.setV_errCode(-1);
  165. cro.setV_errMsg("获取委托出错"+ex.getMessage());
  166. SqlSession.rollback();
  167. }
  168. SqlSession.close();
  169. return cro;
  170. }
  171. /**
  172. * 查询材质试样信息(中厚板)
  173. * @param parmas
  174. * @return
  175. */
  176. public CoreReturnObject getQltySampleInfoZHB(HashMap parmas) {
  177. try{//t1.PROCESS_NO,
  178. if (!SqlJoint.IsNullOrSpace(parmas.get("STARTTIME").toString()) && !SqlJoint.IsNullOrSpace(parmas.get("ENDTIME").toString())) {
  179. String sky=StrSky(parmas.get("STARTTIME").toString(),parmas.get("ENDTIME").toString());
  180. if(sky.equals("FALSE")){
  181. SqlSession.close();
  182. cro.setV_errCode(-1);
  183. cro.setV_errMsg("查询时间不能大于30天,请核实查询时间条件!");
  184. return cro;
  185. }
  186. }
  187. String sqlzh = "";
  188. String timezh = "";
  189. String taskno = "";
  190. if(parmas.get("PLINE_NAME").equals("厚板线")){
  191. // timezh+="(select length from kch_turnofflist@xgcx where BILLETID = t1.MATERIAL_NO and rownum <= 1) LENGTH,";
  192. // timezh+= "(select max(INSTORAGETIME) INTIME from kch_turnofflist@xgcx where BILLETID = t1.MATERIAL_NO and rownum <= 1) INTIME,";
  193. sqlzh = " left join kch_turnofflist@xgcx st on t1.MATERIAL_NO = st.BILLETID ";
  194. timezh = "to_char(st.INSTORAGETIME, 'yyyy-mm-dd hh24:mi:ss') INTIME, st.RCL_STATE,";//
  195. taskno = "(select TASKNO from zyhb_plandetailofplate@xgcx t where t.SLABNO = t1.material_no and rownum=1) TASKNO,";
  196. }else if(parmas.get("PLINE_NAME").equals("中板线")){
  197. //timezh +="(select length from kcz_turnofflist@xgcx where BILLETID = t1.MATERIAL_NO and rownum <= 1) LENGTH,";
  198. //timezh += "(select max(INTIME) from kcz_turnofflist@xgcx where BILLETID = t1.MATERIAL_NO and rownum <= 1) INTIME,";
  199. sqlzh = " left join kcz_turnofflist@xgcx st on t1.MATERIAL_NO = st.BILLETID ";
  200. timezh = "to_char(st.INTIME, 'yyyy-mm-dd hh24:mi:ss') INTIME, st.RCL_STATE,";//
  201. taskno = "(select TASKNO from mb_plandetailofplate@xgcx t where t.productno = t1.material_no and rownum=1) TASKNO,";
  202. }
  203. String sql = "select t1.SMP_NO, "
  204. +" t1.SPECIMEN_NO, "
  205. +" t1.HEAT_NO, "
  206. +" t1.BATCH_NO, "
  207. +" t1.INSPECTION_LOT, "
  208. +" t1.FREQ_CODE, "
  209. +" t1.FREQ_NAME, "
  210. +" t1.MATERIAL_NO, "
  211. +" t1.SEND_MEMO, "
  212. +" t1.SMP_TYPE_CODE, "
  213. +" case "
  214. +" when t1.SMP_TYPE_CODE = '0' then "
  215. +" case "
  216. +" when t2.CERT_INST_CODE in "
  217. +" ('IC003', 'IC004', 'IC001', 'IC010', '5000') then "
  218. +" t1.SMP_TYPE_NAME "
  219. +" else "
  220. +" '认证样' "
  221. +" end "
  222. +" else "
  223. +" t1.SMP_TYPE_NAME "
  224. +" end SMP_TYPE_NAME, "
  225. +" t1.CONSIGN_NO, "
  226. +" t1.CONSIGN_NO_SEQ, "
  227. +" t1.TEST_QTY, "
  228. +" t1.SMP_QTY, "
  229. +" t1.SMP_LOCATION, "
  230. +" t1.BOARD_NO, "
  231. +" t1.QUOTE_CONSIGN_NO, "
  232. +" t1.OLD_CONSIGN_NO, "
  233. +" t1.PLINE_CODE, "
  234. +" t1.PLINE_NAME, "
  235. +" t1.STATUS, "
  236. //+" t1.VALIDFLAG, "
  237. //+" t1.SOURCE, "
  238. +" t1.SEND_NAME, "
  239. +" to_char(t1.SEND_TIME, 'yyyy-mm-dd hh24:mi:ss') SEND_TIME, "
  240. //+" t1.SOURCE, "
  241. +" t1.memo, "
  242. +" t2.SMP_TYPE_CODE as SMP_TYPE_CODE1, "
  243. +" t2.SMP_TYPE_NAME as SMP_TYPE_NAME1, "
  244. +" t2.CERT_INST_CODE, "
  245. +" t2.CREATE_NAME, "
  246. +" to_char(t1.CREATE_TIME, 'yyyy-mm-dd hh24:mi:ss') CREATE_TIME, "
  247. +" t2.smp_catg as smp_catg, "
  248. +" t2.CERT_INST_NAME, "
  249. //+" t2.BOARD_NO, "
  250. //+" t2.MATERIAL_NO, "
  251. +" t2.psc, "
  252. +" t2.psc_desc, "
  253. +" case when t1.phy_item is not null then "
  254. +" t1.phy_item else "
  255. +" dbms_lob.substr((select wmsys.wm_concat(DISTINCT PHY_NAME_S) "
  256. +" from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  257. +" WHERE SPECIMEN_NO = t1.SPECIMEN_NO "
  258. +" and fy_quote_specimen_no is null)) "
  259. +" end PHY_NAME_L_BJ, "
  260. +" ord.DESIGN_KEY, "
  261. +" to_char(ord.THICK, 'fm990.099') THICK, "
  262. +" ord.WIDTH, "
  263. +" nvl(st.length,ord.length) length , "
  264. +timezh
  265. +taskno
  266. +" t1.PROCESS_NO, ord.DELIVERY_STATE_CODE, "
  267. +" ord.DELIVERY_STATE_DESC, "
  268. +" ord.PROD_NAME, "
  269. +" ord.STEEL_NAME, "
  270. +" ord.STD_NAME, "
  271. +" t1.ITEM_FLAG,t1.IMPROVE_MEMO,t1.PROCESS_NOS,"
  272. + " to_char(t1.COLLECT_TIME, 'yyyy-mm-dd hh24:mi:ss') COLLECT_TIME,"
  273. + " t1.ZHB_SPECIMEN_NO,t1.QUOTE_MEMO,t1.SAMPLE_DELIVERY_TIME,"
  274. + " t1.ONEMEMO,t1.WEIGHT,t1.RZ_MIXROLL,t1.RZ_OLD_SAMPL_NO,t1.RZ_ROLL_SLAB_SEQ,t1.SPECIAL_QUOTE_MEMO,"
  275. + " to_char(t1.STOVE_TIME, 'yyyy-mm-dd hh24:mi:ss') STOVE_TIME,"
  276. + " decode(t1.CHEM_INTERNALCONTROL,'1','符合','0','不符合') CHEM_INTERNALCONTROL, "
  277. + " decode(t1.CRAFT_EXECUTE,'1','符合','0','不符合') CRAFT_EXECUTE, "
  278. + " decode(t1.FUNCTION_FUHE,'1','合格','0','不合格') FUNCTION_FUHE,"
  279. + " decode(t1.SHOULD_SAMPLE,'1','N','0','Y','2','Y(抽样)') SHOULD_SAMPLE,"
  280. + " t1.PRINT_LOG,t1.PRINT_SEQ,t1.PRINT_SEQJ,t1.PLINE_CODE_LIMS "
  281. +" from QCM_JHY_SAMPLE_CONSIGN_D t1 "
  282. +" left join QCM_JHY_SAMPLE_CONSIGN_M t2 "
  283. +" on t1.SMP_NO = t2.SMP_NO "
  284. +" left join QCM_JHY_SAMPLE_R_ORD ord "
  285. +" on t1.smp_no = ord.smp_no ";
  286. sql += sqlzh
  287. +" where 1 = 1 ";
  288. if (parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  289. && parmas.get("BATCH_NO2")!=null && !"".equals(((String)parmas.get("BATCH_NO2")).trim()) ) {
  290. sql +=" and upper(t1.batch_no) >= upper('"+parmas.get("BATCH_NO")+"')";
  291. sql +=" and upper(t1.batch_no) <= upper('"+parmas.get("BATCH_NO2")+"')";
  292. }else if(parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  293. && parmas.get("checkboxVal").equals("1")){
  294. sql +=" and t1.batch_no like '"+parmas.get("BATCH_NO")+"%' ";
  295. }
  296. if (parmas.get("CERT_INST_NAME")!=null && !"".equals(((String)parmas.get("CERT_INST_NAME")).trim())) {
  297. sql +=" and t2.cert_inst_name like '"+parmas.get("CERT_INST_NAME")+"%'";
  298. }
  299. if (parmas.get("STEEL_NAME")!=null && !"".equals(((String)parmas.get("STEEL_NAME")).trim())) {
  300. sql +=" and ord.steel_name like '"+parmas.get("STEEL_NAME")+"%'";
  301. }
  302. if (parmas.get("SMP_CATG")!=null && !"".equals(((String)parmas.get("SMP_CATG")).trim())) {
  303. sql +=" and t2.smp_catg = '"+parmas.get("SMP_CATG")+"'";
  304. }
  305. if (parmas.get("VALIDFLAG")!=null && !"".equals(((String)parmas.get("VALIDFLAG")).trim())) {
  306. sql +=" and t1.validflag='"+parmas.get("VALIDFLAG")+"'";
  307. }
  308. if (parmas.get("STATUS")!=null && !"".equals(((String)parmas.get("STATUS")).trim())) {
  309. sql +=" and t1.STATUS='"+parmas.get("STATUS")+"' and t1.STATUS <> '6' ";
  310. }else{
  311. sql +=" and t1.STATUS not in ('0','5','6') ";
  312. }
  313. if(parmas.get("DESIGN_KEY")!=null && !"".equals(((String)parmas.get("DESIGN_KEY")).trim())){
  314. sql +=" and ord.DESIGN_KEY like '"+parmas.get("DESIGN_KEY")+"%'";
  315. }
  316. if(parmas.get("TAB_NAME")!=null && !"".equals(((String)parmas.get("TAB_NAME")).trim())){
  317. //发送时间
  318. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  319. sql +=" and t1.send_time>=to_date('"+parmas.get("STARTTIME")+" 00:00:00','yyyy-MM-dd HH24:mi:ss')";
  320. }
  321. if (parmas.get("ENDTIME")!=null && !"".equals(((String)parmas.get("ENDTIME")).trim())) {
  322. sql +=" and t1.send_time<=to_date('"+parmas.get("ENDTIME")+" 23:59:59','yyyy-MM-dd HH24:mi:ss') ";
  323. }
  324. }else{
  325. //创建时间
  326. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  327. sql +=" and t1.CREATE_TIME>=to_date('"+parmas.get("STARTTIME")+" 00:00:00','yyyy-MM-dd HH24:mi:ss')";
  328. }
  329. if (parmas.get("ENDTIME")!=null && !"".equals(((String)parmas.get("ENDTIME")).trim())) {
  330. sql +=" and t1.CREATE_TIME<=to_date('"+parmas.get("ENDTIME")+" 23:59:59','yyyy-MM-dd HH24:mi:ss') ";
  331. }
  332. }
  333. if(parmas.get("PLINE_NAME").equals("厚板线")){
  334. sql +=" and t1.BATCH_NO like 'H%' and t1.PLINE_CODE = 'HB1' ";
  335. }else if(parmas.get("PLINE_NAME").equals("中板线")){
  336. sql +=" and t1.BATCH_NO like 'Z%' and t1.PLINE_CODE = 'ZB1' ";
  337. }
  338. if (parmas.get("HEAT_NO")!=null && !"".equals(((String)parmas.get("HEAT_NO")).trim())) {
  339. sql +=" and t1.HEAT_NO like '"+parmas.get("HEAT_NO")+"%'";
  340. }
  341. if (parmas.get("SAMPLE_DELIVERY_TIME")!=null && !"".equals(((String)parmas.get("SAMPLE_DELIVERY_TIME")).trim())) {
  342. sql +=" and t1.SAMPLE_DELIVERY_TIME = '"+parmas.get("SAMPLE_DELIVERY_TIME")+"'";
  343. }
  344. if (parmas.get("RZ_MIXROLL")!=null && !"".equals(((String)parmas.get("RZ_MIXROLL")).trim())) {
  345. sql +=" and t1.RZ_MIXROLL = '"+parmas.get("RZ_MIXROLL")+"'";
  346. }
  347. if(parmas.get("CHECKBOKTXTL").equals("T")){
  348. sql+=" and t1.ZHB_SPECIMEN_NO is not null ";
  349. }
  350. if(parmas.get("TAB_NAME")!=null && !"".equals(((String)parmas.get("TAB_NAME")).trim())){
  351. sql +=" order by t1.send_time desc,t1.BATCH_NO desc";
  352. }else{
  353. sql +=" order by t1.CREATE_TIME desc,t1.BATCH_NO desc ";
  354. }
  355. List<HashMap> listEle= mapper.query(sql.toString());
  356. cro.setResult(listEle);
  357. }catch(Exception ex){
  358. cro.setV_errCode(-1);
  359. cro.setV_errMsg("获取委托出错"+ex.getMessage());
  360. SqlSession.rollback();
  361. }
  362. SqlSession.close();
  363. return cro;
  364. }
  365. /**
  366. * 查询材质试样信息(热轧)
  367. * @param parmas
  368. * @return
  369. */
  370. public CoreReturnObject getQltySampleInfoRZ(HashMap parmas) {
  371. try{
  372. if (!SqlJoint.IsNullOrSpace(parmas.get("STARTTIME").toString()) && !SqlJoint.IsNullOrSpace(parmas.get("ENDTIME").toString())) {
  373. String sky=StrSky(parmas.get("STARTTIME").toString(),parmas.get("ENDTIME").toString());
  374. if(sky.equals("FALSE")){
  375. SqlSession.close();
  376. cro.setV_errCode(-1);
  377. cro.setV_errMsg("查询时间不能大于30天,请核实查询时间条件!");
  378. return cro;
  379. }
  380. }
  381. String sql = "select case when T3.SMP_DIR_PIC_YN = 'N' then '' else QCM_RZ_DATE(SUBSTR(T3.OLD_SAMPL_NO, 1, 10),t3.OLD_SAMPL_NO,t1.specimen_no) end SAMPLE_DATE, "
  382. +" case when T3.SMP_DIR_PIC_YN = 'N' then '' else QCM_RZ_TIME(t1.batch_no,t3.OLD_SAMPL_NO,t1.specimen_no) end JHQ_DATE, "
  383. +" t3.OLD_SAMPL_NO, "
  384. +" t4.ROLL_MANA_NO, "
  385. +" t4.ROLL_SLAB_SEQ, "
  386. +" t4.MIXROLL, "
  387. +" t1.SMP_NO, "
  388. +" t1.SPECIMEN_NO, "
  389. //+" t1.HEAT_NO, "
  390. //+" t1.BATCH_NO, "
  391. +" SUBSTR(T3.SLAB_NO, 1, 10) HEAT_NO,"
  392. +" SUBSTR(T3.OLD_SAMPL_NO, 1, 10) BATCH_NO,"
  393. +" t1.INSPECTION_LOT, "
  394. +" t1.FREQ_CODE, "
  395. +" t1.FREQ_NAME, "
  396. +" t1.MATERIAL_NO, "
  397. +" t1.SEND_MEMO, "
  398. +" t1.SMP_TYPE_CODE, "
  399. //+" t1.SMP_TYPE_NAME, "
  400. +" case when t1.SMP_TYPE_CODE = '0' then "
  401. +" case when t2.CERT_INST_CODE in ('IC003','IC004','IC001','IC010','5000') then "
  402. +" t1.SMP_TYPE_NAME "
  403. +" else '认证样' end "
  404. +" else t1.SMP_TYPE_NAME "
  405. +" end SMP_TYPE_NAME,"
  406. +" t1.CONSIGN_NO, "
  407. +" t1.CONSIGN_NO_SEQ, "
  408. +" t1.TEST_QTY, "
  409. +" t1.SMP_QTY, "
  410. +" t1.SMP_LOCATION, "
  411. +" t1.BOARD_NO, "
  412. +" t1.QUOTE_CONSIGN_NO, "
  413. +" t1.OLD_CONSIGN_NO, "
  414. +" t1.PLINE_CODE, "
  415. +" t1.PLINE_NAME, "
  416. +" t1.STATUS, "
  417. +" t1.VALIDFLAG, "
  418. +" t1.SOURCE, "
  419. +" decode(t1.PLINE_CODE, 'ZB1', '认证样', 'HB1', '船级社留样') 类型, "
  420. +" t1.SEND_NAME, "
  421. +" to_char(t1.SEND_TIME, 'yyyy-mm-dd hh24:mi:ss') SEND_TIME, "
  422. +" t1.SOURCE, "
  423. +" t1.memo, "
  424. +" t1.WEIGHT, "
  425. +" t1.WEIGHT_STD, "
  426. +" t1.WEIGHT_SFD, "
  427. +" t2.SMP_TYPE_CODE as SMP_TYPE_CODE1, "
  428. +" t2.SMP_TYPE_NAME as SMP_TYPE_NAME1, "
  429. +" t2.CERT_INST_CODE, "
  430. +" t2.CREATE_NAME, "
  431. +" to_char(t1.CREATE_TIME, 'yyyy-mm-dd hh24:mi:ss') CREATE_TIME, "
  432. +" t2.smp_catg as smp_catg, "
  433. +" t2.CERT_INST_NAME, "
  434. +" t2.BOARD_NO, "
  435. +" t2.MATERIAL_NO, "
  436. +" t2.psc, "
  437. +" t2.psc_desc, "
  438. +" case when t1.phy_item is not null then "
  439. +" t1.phy_item else "
  440. +" dbms_lob.substr((select wmsys.wm_concat(DISTINCT PHY_NAME_S) "
  441. +" from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  442. +" WHERE SPECIMEN_NO = t1.SPECIMEN_NO "
  443. +" and fy_quote_specimen_no is null)) "
  444. +" end PHY_NAME_L_BJ, "
  445. +" ord.DESIGN_KEY, "
  446. //+" ord.WIDTH, "
  447. // to_char(ord.thick, 'fm990.099')
  448. +" to_char(nvl(ord.thick,t5.ORD_THK), 'fm990.099') THICK,"
  449. +" t5.ORD_WTH WIDTH,"
  450. +" ord.LENGTH, "
  451. +" ord.DELIVERY_STATE_CODE, "
  452. +" ord.DELIVERY_STATE_DESC, "
  453. +" ord.PROD_NAME, "
  454. +" ord.STEEL_NAME, "
  455. +" ord.STD_NAME, "
  456. +" t1.ITEM_FLAG,t1.RZ_OLD_SAMPL_NO RZ_ENTRUST_NUMBER,"
  457. + " DECODE(t3.SPEC_STL_GRD,'Q235B',GETMAXMIXROLL(t4.ROLL_MANA_NO, t4.MIXROLL, t4.COIL_NO),'Q355B', "
  458. + " GETMAXMIXROLL(t4.ROLL_MANA_NO, t4.MIXROLL, t4.COIL_NO),'0') MIXFLAG,"
  459. + " T3.SMP_DIR_PIC_YN,t1.SAMPL_PICK_RY,t1.PRINT_LOG,t1.SEND_SEQ,t1.PRINT_SEQ,t1.QRZ_SPECIMEN_NO "
  460. +" from tbh02_coil_comm t3, "
  461. +" tbf02_spec_mill t4, "
  462. +" TBE02_ORD_PRC t5, "
  463. +" QCM_JHY_SAMPLE_CONSIGN_D t1, "
  464. +" QCM_JHY_SAMPLE_CONSIGN_M t2, "
  465. +" QCM_JHY_SAMPLE_R_ORD ord "
  466. +" where t3.SAMPL_NO = t1.inspection_lot(+) "
  467. +" and t3.COIL_NO = t4.COIL_NO(+) "
  468. +" AND t3.ORD_NO = t5.ORD_NO(+) "
  469. +" AND t3.ORD_SEQ = t5.ORD_SEQ(+) "
  470. +" and t1.SMP_NO = t2.SMP_NO(+) "
  471. +" and t1.smp_no = ord.smp_no(+) and T3.OLD_SAMPL_NO is not null ";
  472. if (parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  473. && parmas.get("BATCH_NO2")!=null && !"".equals(((String)parmas.get("BATCH_NO2")).trim()) ) {
  474. sql +=" and upper(t1.batch_no) >= upper('"+parmas.get("BATCH_NO")+"')";
  475. sql +=" and upper(t1.batch_no) <= upper('"+parmas.get("BATCH_NO2")+"')";
  476. }else if(parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  477. && parmas.get("checkboxVal").equals("1")){
  478. sql +=" and t3.OLD_SAMPL_NO like '"+parmas.get("BATCH_NO")+"%' ";
  479. }
  480. if (parmas.get("CERT_INST_NAME")!=null && !"".equals(((String)parmas.get("CERT_INST_NAME")).trim())) {
  481. sql +=" and t2.cert_inst_name like '"+parmas.get("CERT_INST_NAME")+"%'";
  482. }
  483. if (parmas.get("STEEL_NAME")!=null && !"".equals(((String)parmas.get("STEEL_NAME")).trim())) {
  484. sql +=" and ord.steel_name like '"+parmas.get("STEEL_NAME")+"%'";
  485. }
  486. /* if (parmas.get("SMP_CATG")!=null && !"".equals(((String)parmas.get("SMP_CATG")).trim())) {
  487. //sql +=" and t2.smp_catg = '"+parmas.get("SMP_CATG")+"'";
  488. }
  489. if (parmas.get("VALIDFLAG")!=null && !"".equals(((String)parmas.get("VALIDFLAG")).trim())) {
  490. //sql +=" and t1.validflag='"+parmas.get("VALIDFLAG")+"'";
  491. }
  492. if (parmas.get("STATUS")!=null && !"".equals(((String)parmas.get("STATUS")).trim())) {
  493. //sql +=" and (t1.STATUS is null or t1.STATUS = '0')";
  494. }else{
  495. //sql +=" and t1.STATUS <> '0' ";
  496. }*/
  497. sql +=" and nvl(t1.STATUS ,'null') <> '5' and nvl(t1.STATUS ,'null') <> '6'";//2022 09 28 add by WL
  498. if(parmas.get("TAB_NAME")!=null && !"".equals(((String)parmas.get("TAB_NAME")).trim())){
  499. //发送时间
  500. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  501. sql +=" and t1.send_time>=to_date(concat('"+parmas.get("STARTTIME")+"',' 00:00:00'),'yyyy-MM-dd HH24:mi:ss')";
  502. }
  503. if (parmas.get("ENDTIME")!=null && !"".equals(((String)parmas.get("ENDTIME")).trim())) {
  504. sql +=" and t1.send_time<=to_date(concat('"+parmas.get("ENDTIME")+"',' 23:59:59'),'yyyy-MM-dd HH24:mi:ss') ";
  505. }
  506. }else{
  507. //创建时间
  508. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  509. sql +=" and t3.COIL_END_DTIME between '"+parmas.get("STARTTIME")+"000000' and '"+parmas.get("ENDTIME")+"999999'";
  510. }
  511. }
  512. //轧辊单元
  513. if (parmas.get("ROLL_MANA_NO")!=null && !"".equals(((String)parmas.get("ROLL_MANA_NO")).trim())) {
  514. sql +=" and t4.ROLL_MANA_NO = '"+parmas.get("ROLL_MANA_NO")+"'";
  515. }
  516. //sql +=" and t3.COIL_END_DTIME > '20220915000000' ";
  517. if (parmas.get("HEAT_NO")!=null && !"".equals(((String)parmas.get("HEAT_NO")).trim())) {
  518. sql +=" and t1.HEAT_NO like '"+parmas.get("HEAT_NO")+"%'";
  519. }
  520. sql +=" and nvl(T3.MISSNO_CLF_CD,'null') !='C' ";//C废品,S再回加热炉
  521. if(parmas.get("TAB_NAME")!=null && !"".equals(((String)parmas.get("TAB_NAME")).trim())){
  522. sql +=" order by t1.send_time ,t4.ROLL_MANA_NO, t4.ROLL_SLAB_SEQ asc";
  523. }else{
  524. sql +=" order by t4.ROLL_MANA_NO, t4.ROLL_SLAB_SEQ asc ";
  525. }
  526. List<HashMap> listEle= mapper.query(sql.toString());
  527. cro.setResult(listEle);
  528. }catch(Exception ex){
  529. cro.setV_errCode(-1);
  530. cro.setV_errMsg("获取委托出错"+ex.getMessage());
  531. SqlSession.rollback();
  532. }
  533. SqlSession.close();
  534. return cro;
  535. }
  536. /**
  537. * 查询材质试样信息(热轧记录)
  538. * @param parmas
  539. * @return
  540. */
  541. public CoreReturnObject getQltySampleInfoRZ2(HashMap parmas) {
  542. try{
  543. if (!SqlJoint.IsNullOrSpace(parmas.get("STARTTIME").toString()) && !SqlJoint.IsNullOrSpace(parmas.get("ENDTIME").toString())) {
  544. String sky=StrSky(parmas.get("STARTTIME").toString(),parmas.get("ENDTIME").toString());
  545. if(sky.equals("FALSE")){
  546. SqlSession.close();
  547. cro.setV_errCode(-1);
  548. cro.setV_errMsg("查询时间不能大于30天,请核实查询时间条件!");
  549. return cro;
  550. }
  551. }
  552. StringBuffer sqlucomm = new StringBuffer();
  553. sqlucomm.append("select t1.RZ_ROLL_MANA_NO ROLL_MANA_NO,t1.RZ_MIXROLL MIXROLL,t1.material_no OLD_SAMPL_NO,t1.RZ_ROLL_SLAB_SEQ ROLL_SLAB_SEQ,"
  554. + "t1.RZ_OLD_SAMPL_NO RZ_ENTRUST_NUMBER,t1.SMP_NO,t1.SPECIMEN_NO,t1.HEAT_NO,t1.BATCH_NO,t1.INSPECTION_LOT,t1.FREQ_CODE,");
  555. sqlucomm.append("t1.FREQ_NAME,t1.MATERIAL_NO,t1.SEND_MEMO,t1.SMP_TYPE_CODE, ");
  556. sqlucomm.append(" case when t1.SMP_TYPE_CODE = '0' then "
  557. +" case when t2.CERT_INST_CODE in ('IC003','IC004','IC001','IC010','5000') then "
  558. +" t1.SMP_TYPE_NAME "
  559. +" else '认证样' end "
  560. +" else t1.SMP_TYPE_NAME "
  561. +" end SMP_TYPE_NAME,");
  562. sqlucomm.append("t1.CONSIGN_NO, t1.CONSIGN_NO_SEQ,t1.TEST_QTY,t1.SMP_QTY,t1.SMP_LOCATION, t1.BOARD_NO, t1.QUOTE_CONSIGN_NO,t1.OLD_CONSIGN_NO,");
  563. sqlucomm.append("t1.PLINE_CODE,t1.PLINE_NAME,t1.STATUS,t1.VALIDFLAG,t1.SOURCE,t1.PRINT_LOG,t1.SEND_SEQ,t1.PRINT_SEQ,");
  564. sqlucomm.append("t1.SEND_NAME,to_char(t1.SEND_TIME,'yyyy-mm-dd hh24:mi:ss') SEND_TIME,");
  565. sqlucomm.append("t1.SOURCE, t1.memo,t1.WEIGHT,t1.WEIGHT_STD,t1.WEIGHT_SFD,t2.SMP_TYPE_CODE as SMP_TYPE_CODE1,t2.SMP_TYPE_NAME as SMP_TYPE_NAME1,");
  566. sqlucomm.append("t2.CERT_INST_CODE,t2.CREATE_NAME,to_char(t1.CREATE_TIME,'yyyy-mm-dd hh24:mi:ss') CREATE_TIME,t2.smp_catg as smp_catg, t2.CERT_INST_NAME,");
  567. sqlucomm.append("t2.BOARD_NO, t2.MATERIAL_NO,t2.psc,t2.psc_desc, ");
  568. sqlucomm.append(" ord.DESIGN_KEY,to_char(ord.THICK, 'fm990.099') THICK,ord.WIDTH,ord.LENGTH,");
  569. sqlucomm.append(" ord.DELIVERY_STATE_CODE,ord.DELIVERY_STATE_DESC,ord.PROD_NAME,ord.STEEL_NAME,ord.STD_NAME,t1.ITEM_FLAG,t1.Sampl_Pick_Ry, "
  570. + " case when t1.phy_item is not null then t1.phy_item else dbms_lob.substr((select wmsys.wm_concat(DISTINCT PHY_NAME_S) "
  571. + " from QCM_JHY_SAMPLE_CONSIGN_D_ITEM WHERE SPECIMEN_NO = t1.SPECIMEN_NO and fy_quote_specimen_no is null)) end PHY_NAME_L_BJ ");
  572. sqlucomm.append(" from QCM_JHY_SAMPLE_CONSIGN_D t1 left join QCM_JHY_SAMPLE_CONSIGN_M t2 on t1.SMP_NO=t2.SMP_NO");
  573. sqlucomm.append(" inner join QCM_JHY_SAMPLE_R_ORD ord on t1.smp_no = ord.smp_no ");
  574. sqlucomm.append(" where 1=1");
  575. if (parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  576. && parmas.get("BATCH_NO2")!=null && !"".equals(((String)parmas.get("BATCH_NO2")).trim()) ) {
  577. sqlucomm.append(" and upper(t1.batch_no) >= upper('"+parmas.get("BATCH_NO")+"')");
  578. sqlucomm.append(" and upper(t1.batch_no) <= upper('"+parmas.get("BATCH_NO2")+"')");
  579. }else if(parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  580. && parmas.get("checkboxVal").equals("1")){
  581. sqlucomm.append(" and t1.batch_no like '"+parmas.get("BATCH_NO")+"%' ");
  582. }
  583. if (parmas.get("CERT_INST_NAME")!=null && !"".equals(((String)parmas.get("CERT_INST_NAME")).trim())) {
  584. sqlucomm.append(" and t2.cert_inst_name like '"+parmas.get("CERT_INST_NAME")+"%'");
  585. }
  586. if (parmas.get("STEEL_NAME")!=null && !"".equals(((String)parmas.get("STEEL_NAME")).trim())) {
  587. sqlucomm.append(" and ord.steel_name like '"+parmas.get("STEEL_NAME")+"%'");
  588. }
  589. if (parmas.get("SMP_CATG")!=null && !"".equals(((String)parmas.get("SMP_CATG")).trim())) {
  590. sqlucomm.append(" and t2.smp_catg = '"+parmas.get("SMP_CATG")+"'");
  591. }
  592. if (parmas.get("VALIDFLAG")!=null && !"".equals(((String)parmas.get("VALIDFLAG")).trim())) {
  593. sqlucomm.append(" and t1.validflag='"+parmas.get("VALIDFLAG")+"'");
  594. }
  595. if (parmas.get("STATUS")!=null && !"".equals(((String)parmas.get("STATUS")).trim())) {
  596. sqlucomm.append(" and t1.STATUS='"+parmas.get("STATUS")+"' and t1.STATUS <> '6' ");
  597. }else{
  598. sqlucomm.append(" and t1.STATUS <> '0' and t1.STATUS <> '5' and t1.STATUS <> '6' ");
  599. }
  600. if(parmas.get("DESIGN_KEY")!=null && !"".equals(((String)parmas.get("DESIGN_KEY")).trim())){
  601. sqlucomm.append(" and ord.DESIGN_KEY like '"+parmas.get("DESIGN_KEY")+"%'");
  602. }
  603. if(parmas.get("TAB_NAME")!=null && !"".equals(((String)parmas.get("TAB_NAME")).trim())){
  604. //发送时间
  605. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  606. sqlucomm.append(" and t1.send_time>=to_date(concat('"+parmas.get("STARTTIME")+"',' 00:00:00'),'yyyy-MM-dd HH24:mi:ss')");
  607. }
  608. if (parmas.get("ENDTIME")!=null && !"".equals(((String)parmas.get("ENDTIME")).trim())) {
  609. sqlucomm.append(" and t1.send_time<=to_date(concat('"+parmas.get("ENDTIME")+"',' 23:59:59'),'yyyy-MM-dd HH24:mi:ss') ");
  610. }
  611. }else{
  612. //创建时间
  613. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  614. sqlucomm.append(" and t1.CREATE_TIME>=to_date(concat('"+parmas.get("STARTTIME")+"',' 00:00:00'),'yyyy-MM-dd HH24:mi:ss')");
  615. }
  616. if (parmas.get("ENDTIME")!=null && !"".equals(((String)parmas.get("ENDTIME")).trim())) {
  617. sqlucomm.append(" and t1.CREATE_TIME<=to_date(concat('"+parmas.get("ENDTIME")+"',' 23:59:59'),'yyyy-MM-dd HH24:mi:ss') ");
  618. }
  619. }
  620. if (parmas.get("PLINE_NAME")!=null && !"".equals(((String)parmas.get("PLINE_NAME")).trim())) {
  621. sqlucomm.append(" and t2.PLINE_NAME like '"+parmas.get("PLINE_NAME")+"%'");
  622. }
  623. if (parmas.get("PLINE_CODE")!=null && !"".equals(((String)parmas.get("PLINE_CODE")).trim())) {
  624. //sqlucomm.append(" and t2.PLINE_CODE = '"+parmas.get("PLINE_CODE")+"'");
  625. }
  626. if (parmas.get("HEAT_NO")!=null && !"".equals(((String)parmas.get("HEAT_NO")).trim())) {
  627. sqlucomm.append(" and t1.HEAT_NO like '"+parmas.get("HEAT_NO")+"%'");
  628. }
  629. //轧辊单元
  630. if (parmas.get("ROLL_MANA_NO")!=null && !"".equals(((String)parmas.get("ROLL_MANA_NO")).trim())) {
  631. sqlucomm.append(" and t1.RZ_ROLL_MANA_NO = '"+parmas.get("ROLL_MANA_NO")+"'");
  632. }
  633. if(parmas.get("TAB_NAME")!=null && !"".equals(((String)parmas.get("TAB_NAME")).trim())){
  634. sqlucomm.append(" order by t1.send_time desc,t1.BATCH_NO desc");
  635. }else{
  636. sqlucomm.append(" order by t1.CREATE_TIME desc,t1.BATCH_NO desc ");
  637. }
  638. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  639. cro.setResult(listEle);
  640. }catch(Exception ex){
  641. cro.setV_errCode(-1);
  642. cro.setV_errMsg("获取委托出错"+ex.getMessage());
  643. SqlSession.rollback();
  644. }
  645. SqlSession.close();
  646. return cro;
  647. }
  648. /**
  649. * 异常取样卷界面(热轧)
  650. * @param parmas
  651. * @return
  652. */
  653. public CoreReturnObject getQCMRZYZ(HashMap parmas) {
  654. try{
  655. if (!SqlJoint.IsNullOrSpace(parmas.get("STARTTIME").toString()) && !SqlJoint.IsNullOrSpace(parmas.get("ENDTIME").toString())) {
  656. String sky=StrSky(parmas.get("STARTTIME").toString(),parmas.get("ENDTIME").toString());
  657. if(sky.equals("FALSE")){
  658. SqlSession.close();
  659. cro.setV_errCode(-1);
  660. cro.setV_errMsg("查询时间不能大于30天,请核实查询时间条件!");
  661. return cro;
  662. }
  663. }
  664. String sql = "select (select to_char(TO_DATE(t.ORD_DEVLMT_DATE,'YYYY-MM-DD HH24:MI:SS'), 'yyyy-mm-dd') from tba01_ord_line t,tbh02_coil_comm c "
  665. +" where t.ORD_NO = c.ORD_NO and t.ORD_SEQ = c.ORD_SEQ and c.OLD_SAMPL_NO = t3.OLD_SAMPL_NO ) ORD_DEVLMT_DATE, "
  666. +" QCM_RZ_STATUS(t1.batch_no,t3.OLD_SAMPL_NO,t1.specimen_no) JHQ_STATUS, "
  667. +" t3.OLD_SAMPL_NO, "
  668. +" t4.ROLL_MANA_NO, "
  669. +" t4.ROLL_SLAB_SEQ, "
  670. +" t4.MIXROLL, "
  671. +" t1.SMP_NO, "
  672. +" t1.SPECIMEN_NO, "
  673. +" SUBSTR(T3.SLAB_NO, 1, 10) HEAT_NO,"
  674. +" SUBSTR(T3.OLD_SAMPL_NO, 1, 10) BATCH_NO,"
  675. +" t1.INSPECTION_LOT, "
  676. +" t1.FREQ_CODE, "
  677. +" t1.FREQ_NAME, "
  678. +" t1.MATERIAL_NO, "
  679. +" t1.SEND_MEMO, "
  680. +" t1.SMP_TYPE_CODE, "
  681. +" t1.SMP_TYPE_NAME, "
  682. +" t1.CONSIGN_NO, "
  683. +" t1.CONSIGN_NO_SEQ, "
  684. +" t1.TEST_QTY, "
  685. +" t1.SMP_QTY, "
  686. +" t1.SMP_LOCATION, "
  687. +" t1.BOARD_NO, "
  688. +" t1.QUOTE_CONSIGN_NO, "
  689. +" t1.OLD_CONSIGN_NO, "
  690. +" t1.PLINE_CODE, "
  691. +" t1.PLINE_NAME, "
  692. +" t1.STATUS, "
  693. +" t1.VALIDFLAG, "
  694. +" t1.SOURCE, "
  695. +" t1.SEND_NAME, "
  696. +" to_char(t1.SEND_TIME, 'yyyy-mm-dd hh24:mi:ss') SEND_TIME, "
  697. +" t1.SOURCE, "
  698. +" t1.memo, "
  699. +" t1.WEIGHT, "
  700. +" t1.WEIGHT_STD, "
  701. +" t1.WEIGHT_SFD, "
  702. +" t2.SMP_TYPE_CODE as SMP_TYPE_CODE1, "
  703. +" t2.SMP_TYPE_NAME as SMP_TYPE_NAME1, "
  704. +" t2.CERT_INST_CODE, "
  705. +" t2.CREATE_NAME, "
  706. +" to_char(t1.CREATE_TIME, 'yyyy-mm-dd hh24:mi:ss') CREATE_TIME, "
  707. +" t2.smp_catg as smp_catg, "
  708. +" t2.CERT_INST_NAME, "
  709. +" t2.BOARD_NO, "
  710. +" t2.MATERIAL_NO, "
  711. +" t2.psc, "
  712. +" t2.psc_desc, "
  713. +" ord.DESIGN_KEY,"
  714. +" t1.PHY_ITEM, "
  715. +" to_char(ord.thick, 'fm990.099') THICK,"
  716. +" t5.ORD_WTH WIDTH,"
  717. +" ord.LENGTH, "
  718. +" ord.DELIVERY_STATE_CODE, "
  719. +" ord.DELIVERY_STATE_DESC, "
  720. +" ord.PROD_NAME, "
  721. +" ord.STEEL_NAME, "
  722. +" ord.STD_NAME, "
  723. +" t1.ITEM_FLAG,t1.RZ_OLD_SAMPL_NO RZ_ENTRUST_NUMBER,"
  724. + " DECODE(t3.SPEC_STL_GRD,'Q235B',GETMAXMIXROLL(t4.ROLL_MANA_NO, t4.MIXROLL, t4.COIL_NO),'Q355B', "
  725. + " GETMAXMIXROLL(t4.ROLL_MANA_NO, t4.MIXROLL, t4.COIL_NO),'0') MIXFLAG,"
  726. + " T3.SMP_DIR_PIC_YN,t1.SAMPL_PICK_RY,t1.PRINT_LOG,t1.SEND_SEQ,t1.PRINT_SEQ "
  727. +" from tbh02_coil_comm t3, "
  728. +" tbf02_spec_mill t4, "
  729. +" TBE02_ORD_PRC t5, "
  730. +" QCM_JHY_SAMPLE_CONSIGN_D t1, "
  731. +" QCM_JHY_SAMPLE_CONSIGN_M t2, "
  732. +" QCM_JHY_SAMPLE_R_ORD ord "
  733. +" where t3.SAMPL_NO = t1.inspection_lot(+) "
  734. +" and t3.COIL_NO = t4.COIL_NO(+) "
  735. +" AND t3.ORD_NO = t5.ORD_NO(+) "
  736. +" AND t3.ORD_SEQ = t5.ORD_SEQ(+) "
  737. +" and t1.SMP_NO = t2.SMP_NO(+) "
  738. +" and t1.smp_no = ord.smp_no(+) and T3.OLD_SAMPL_NO is not null ";
  739. if (parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  740. && parmas.get("BATCH_NO2")!=null && !"".equals(((String)parmas.get("BATCH_NO2")).trim()) ) {
  741. sql +=" and upper(t1.batch_no) >= upper('"+parmas.get("BATCH_NO")+"')";
  742. sql +=" and upper(t1.batch_no) <= upper('"+parmas.get("BATCH_NO2")+"')";
  743. }else if(parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  744. && parmas.get("checkboxVal").equals("1")){
  745. sql +=" and t3.OLD_SAMPL_NO like '"+parmas.get("BATCH_NO")+"%' ";
  746. }
  747. if (parmas.get("CERT_INST_NAME")!=null && !"".equals(((String)parmas.get("CERT_INST_NAME")).trim())) {
  748. sql +=" and t2.cert_inst_name like '"+parmas.get("CERT_INST_NAME")+"%'";
  749. }
  750. if (parmas.get("STEEL_NAME")!=null && !"".equals(((String)parmas.get("STEEL_NAME")).trim())) {
  751. sql +=" and ord.steel_name like '"+parmas.get("STEEL_NAME")+"%'";
  752. }
  753. sql +=" and t1.STATUS = '0' AND nvl(T3.SMP_DIR_PIC_YN,'null') !='N' ";
  754. //卷取时间
  755. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  756. sql +=" and t3.COIL_END_DTIME between '"+parmas.get("STARTTIME")+"000000' and '"+parmas.get("ENDTIME")+"999999'";
  757. }
  758. //轧辊单元
  759. if (parmas.get("ROLL_MANA_NO")!=null && !"".equals(((String)parmas.get("ROLL_MANA_NO")).trim())) {
  760. sql +=" and t4.ROLL_MANA_NO = '"+parmas.get("ROLL_MANA_NO")+"'";
  761. }
  762. if (parmas.get("HEAT_NO")!=null && !"".equals(((String)parmas.get("HEAT_NO")).trim())) {
  763. sql +=" and t1.HEAT_NO like '"+parmas.get("HEAT_NO")+"%'";
  764. }
  765. sql +=" and nvl(T3.MISSNO_CLF_CD,'null') !='C' ";//C废品,S再回加热炉
  766. sql +=" order by t4.ROLL_MANA_NO, t4.ROLL_SLAB_SEQ asc ";
  767. List<HashMap> listEle= mapper.query(sql.toString());
  768. cro.setResult(listEle);
  769. }catch(Exception ex){
  770. cro.setV_errCode(-1);
  771. cro.setV_errMsg("获取异常取样卷出错"+ex.getMessage());
  772. SqlSession.rollback();
  773. }
  774. SqlSession.close();
  775. return cro;
  776. }
  777. /**
  778. * 查询下拉框 轧批号
  779. * @param parmas
  780. * @return
  781. */
  782. public CoreReturnObject getBatchNo(String heatNo,String plineCode) {
  783. try{
  784. heatNo = heatNo.substring(0, 9);//一共10位 截取9位 最后一位字母不要
  785. String strPlineCode = "";
  786. if(!plineCode.equals("ZB1") && !plineCode.equals("HB1") ){
  787. strPlineCode = " and t.pline_code = '"+plineCode+"' ";
  788. }else{
  789. strPlineCode = " and t.pline_code in ('ZB1','HB1') ";
  790. }
  791. String sql ="";
  792. sql ="";
  793. sql = "select t.BATCH_NO from QCM_JHY_SAMPLE_CONSIGN_D t "
  794. +" where t.heat_no like '"+heatNo+"%' and t.FREQ_CODE ='D' and t.QUOTE_CONSIGN_NO is not null "
  795. +strPlineCode
  796. +" group by t.batch_no order by t.batch_no ";
  797. List<HashMap> listEle= mapper.query(sql.toString());
  798. cro.setResult(listEle);
  799. }catch(Exception ex){
  800. cro.setV_errCode(-1);
  801. cro.setV_errMsg("获取下拉框【轧批号】出错"+ex.getMessage());
  802. SqlSession.rollback();
  803. }
  804. SqlSession.close();
  805. return cro;
  806. }
  807. /**
  808. * 查询下拉框 子板号
  809. * @param parmas
  810. * @return
  811. */
  812. public CoreReturnObject getBilletId(String batchNo,String plineCode) {
  813. try{
  814. StringBuffer sqlucomm = new StringBuffer();
  815. if(plineCode.equals("HB1")){
  816. //厚
  817. sqlucomm.append("select BILLETID as MATERIAL_NO from kch_turnofflist@xgcx where ROLLNUMBER='"+batchNo+"'"
  818. + " union select SLABNO MATERIAL_NO from ZYHB_PLANDETAILOFPLATE@xgcx where BATCHNO='"+batchNo+"' ");
  819. }else if(plineCode.equals("ZB1")){
  820. //中
  821. sqlucomm.append("select BILLETID as MATERIAL_NO from kcz_turnofflist@xgcx where ROLLNUMBER = '"+batchNo+"' "
  822. + " union select PRODUCTNO MATERIAL_NO from MB_PLANDETAILOFPLATE@xgcx where BATCHNO='"+batchNo+"' ");
  823. }else if(plineCode.equals("GX1") || plineCode.equals("BC2") || plineCode.equals("GX2")){
  824. //线棒
  825. sqlucomm.append("select BILLETID as MATERIAL_NO from kcx_turnofflist@xgcx where BILLETID like '"+batchNo+"'||'%' ");
  826. }else if(plineCode.equals("RZ1")){
  827. //热轧
  828. sqlucomm.append("select OLD_SAMPL_NO as MATERIAL_NO from tbh02_coil_comm where OLD_SAMPL_NO like '"+batchNo+"'||'%' ");
  829. }else if(plineCode.equals("LT1")){
  830. //连退
  831. sqlucomm.append("select OLD_SAMPL_NO as MATERIAL_NO from C_TBC02_COIL_COMM where OLD_SAMPL_NO like '"+batchNo+"'||'%' ");
  832. }else if(plineCode.equals("YT1")){
  833. sqlucomm.append("SELECT t.COILNO as MATERIAL_NO FROM YDM_PRODUCT_DETAIL@LINK_YTG T WHERE t.BATCHNO = '"+batchNo+"' AND t.ORDERNO IS NOT NULL ORDER BY T.COILNO ");
  834. }
  835. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  836. cro.setResult(listEle);
  837. }catch(Exception ex){
  838. cro.setV_errCode(-1);
  839. cro.setV_errMsg("获取下拉框【取样材料号】出错"+ex.getMessage());
  840. SqlSession.rollback();
  841. }
  842. SqlSession.close();
  843. return cro;
  844. }
  845. /**
  846. * 查询下拉框 热处理号
  847. * @param parmas
  848. * @return
  849. */
  850. public CoreReturnObject getProcessNo(String batchNo,String plineCode) {
  851. try{
  852. StringBuffer sqlucomm = new StringBuffer();
  853. if(plineCode.equals("HB1")){
  854. //厚
  855. sqlucomm.append("select RCL_STATE from kch_turnofflist@xgcx where ROLLNUMBER='"+batchNo+"' and allotorderform is not null group by RCL_STATE ");
  856. }else if(plineCode.equals("ZB1")){
  857. //中
  858. sqlucomm.append("select RCL_STATE from kcz_turnofflist@xgcx where ROLLNUMBER = '"+batchNo+"' and orderno is not null group by RCL_STATE ");
  859. }
  860. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  861. cro.setResult(listEle);
  862. }catch(Exception ex){
  863. cro.setV_errCode(-1);
  864. cro.setV_errMsg("获取下拉框【热处理号】出错"+ex.getMessage());
  865. SqlSession.rollback();
  866. }
  867. SqlSession.close();
  868. return cro;
  869. }
  870. /**
  871. * 查询材质合同信息
  872. * @param parmas
  873. * @return
  874. */
  875. public CoreReturnObject getQltySampleOrd(String smp_no) {
  876. try{
  877. StringBuffer sqlucomm = new StringBuffer();
  878. sqlucomm.append("SELECT DESIGN_KEY,SMP_NO,PSC,PSC_DESC,to_char(THICK,'fm90.099') THICK,WIDTH,LENGTH,"
  879. + " HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE,DELIVERY_STATE_DESC,PLINE_CODE,"
  880. + " PLINE_NAME,PROD_NAME,STEEL_NAME,STD_NAME FROM QCM_JHY_SAMPLE_R_ORD WHERE SMP_NO='"+smp_no+"'");
  881. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  882. cro.setResult(listEle);
  883. }catch(Exception ex){
  884. cro.setV_errCode(-1);
  885. cro.setV_errMsg("获取材质合同信息出错"+ex.getMessage());
  886. SqlSession.rollback();
  887. }
  888. SqlSession.close();
  889. return cro;
  890. }
  891. public CoreReturnObject getQltySampleOrdNew(String smp_no) {
  892. try{
  893. StringBuffer sqlucomm = new StringBuffer();
  894. sqlucomm.append("SELECT DESIGN_KEY,SMP_NO,PSC,PSC_DESC,to_char(THICK,'fm990.099') THICK,WIDTH,LENGTH,"
  895. + " HEAT_NO,BATCH_NO,INSPECTION_LOT,DELIVERY_STATE_CODE,DELIVERY_STATE_DESC,PLINE_CODE,"
  896. + " PLINE_NAME,PROD_NAME,STEEL_NAME,STD_NAME FROM QCM_JHY_SAMPLE_R_ORD WHERE SMP_NO='"+smp_no+"' ");
  897. /* cro = this.getDao("testDao").ExcuteQuery(
  898. sqlucomm.toString(),
  899. new Object[] { smp_no });*/
  900. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  901. cro.setResult(listEle);
  902. }catch(Exception ex){
  903. SqlSession.rollback();
  904. }
  905. SqlSession.close();
  906. return cro;
  907. }
  908. /**
  909. * 查询材质检验项目信息
  910. * @param parmas
  911. * @return
  912. * @throws SQLException
  913. */
  914. public CoreReturnObject getQltySampleItem(String specimen_no) throws SQLException {
  915. StringBuffer sqlucomm = new StringBuffer();
  916. sqlucomm.append("SELECT SPECIMEN_NO,SEQ,SMP_NO,PHY_NAME_L,PHY_CODE_L,PHY_CODE_M,PHY_NAME_M,");
  917. sqlucomm.append("PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,ITEM_CODE_S,ITEM_NAME_S,");
  918. sqlucomm.append("ISJUDGE,JUDGE_BASIS,PHY_UNIT,QUOTE_SPECIMEN_NO,QUOTE_SEQ,MEMO,ITEM_CODE_L,ITEM_DESC_L,");
  919. sqlucomm.append(" ITEM_FLAG FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM WHERE SPECIMEN_NO='"+specimen_no+"' order by seq asc");
  920. ResultSet results=this.getDao("testDao").ExceuteQueryForResultSet(sqlucomm.toString());
  921. if (results!=null ){
  922. JSONArray jsonArray=resultSetToJsonArry(results);
  923. results.close();
  924. for (int i = 0; i < jsonArray.size(); i++) {
  925. JSONObject result = (JSONObject)jsonArray.get(i);
  926. if (result.get("QUOTE_SPECIMEN_NO")!=null && !"".equals((String)result.get("QUOTE_SPECIMEN_NO"))) {
  927. sqlucomm.setLength(0);
  928. sqlucomm.append("SELECT R.VAL1,R.VAL2,R.VAL3 FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM J RIGHT JOIN QCM_JHY_INSP_PHYSICS R ON R.SPECIMEN_NO=J.SPECIMEN_NO ");
  929. sqlucomm.append("AND R.PHY_CODE_M=J.PHY_CODE_M AND R.PHY_CODE_S=J.PHY_CODE_S AND R.ITEM_CODE_D=J.ITEM_CODE_D AND R.ITEM_CODE_T=J.ITEM_CODE_T ");
  930. sqlucomm.append("AND R.ITEM_CODE_S=J.ITEM_CODE_S AND J.SPECIMEN_NO='"+result.get("QUOTE_SPECIMEN_NO")+"' AND SEQ="+result.get("QUOTE_SEQ"));
  931. ResultSet quoteResults=this.getDao("testDao").ExceuteQueryForResultSet(sqlucomm.toString());
  932. if (quoteResults!=null){
  933. JSONObject jsonQuote=(JSONObject)resultSetToJsonArry(quoteResults).get(0);
  934. quoteResults.close();
  935. result.put("VAL1", jsonQuote.get("VAL1"));
  936. result.put("VAL2", jsonQuote.get("VAL2"));
  937. result.put("VAL3", jsonQuote.get("VAL3"));
  938. }
  939. }
  940. }
  941. cro.setResult(jsonArray);
  942. }
  943. SqlSession.close();
  944. return cro;
  945. }
  946. public CoreReturnObject getQltySampleItemNew(String specimen_no) throws SQLException {
  947. try{
  948. String sqlmba = " select r.design_key,m.* from QCM_JHY_SAMPLE_CONSIGN_D t,QCM_JHY_SAMPLE_CONSIGN_M m,QCM_JHY_SAMPLE_R_ORD r "
  949. +" where t.smp_no = m.smp_no and m.smp_no = r.smp_no and t.specimen_no = '"+specimen_no+"' ";
  950. List<HashMap> mbahm= mapper.query(sqlmba.toString());
  951. String lrasql="";
  952. String lrasql2="";
  953. if(mbahm.get(0).get("PLINE_CODE").equals("ZB1")|| mbahm.get(0).get("PLINE_CODE").equals("HB1")){
  954. lrasql=",t.MEMOLAR,t.STDMIN,t.STDMAX";
  955. }else if(mbahm.get(0).get("PLINE_CODE").equals("RZ1")){
  956. lrasql=",t.STDMIN,t.STDMAX";
  957. }
  958. if(mbahm.get(0).get("PLINE_CODE").equals("GX1")|| mbahm.get(0).get("PLINE_CODE").equals("GX2") || mbahm.get(0).get("PLINE_CODE").equals("BC2")){
  959. lrasql2="order by t.phy_code_l desc, t.PHY_CODE_M asc, t.phy_code_s asc";
  960. }else{
  961. lrasql2="order by t.phy_code_l asc,t.PHY_CODE_M asc,t.phy_code_s asc";
  962. }
  963. String sql ="";
  964. if(mbahm.get(0).get("SMP_CATG").toString().equals("A")){
  965. sql ="select t.CHEM_CODE PHY_NAME_S from QCM_ORD_DESIGN_SAMPLE_D t where t.design_key ='"+mbahm.get(0).get("DESIGN_KEY").toString()+"'";
  966. }else{
  967. sql = "SELECT decode(t.SPECL_FL,'0','交付标准','1','特殊要求','4','加取项目样') SPECL_FL,"
  968. + " t.SPECIMEN_NO,t.SEQ,t.SMP_NO,t.PHY_NAME_L,t.PHY_CODE_L,t.PHY_CODE_M,t.PHY_NAME_M,"
  969. +"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,"
  970. +"t.ISJUDGE,t.JUDGE_BASIS,t.PHY_UNIT,t.QUOTE_SPECIMEN_NO,t.QUOTE_SEQ,t.MEMO,t.ITEM_CODE_L,t.ITEM_DESC_L,"
  971. +"t.ITEM_FLAG,t.QUOTE_MEMO,r.VAL1,r.VAL2,r.VAL3,t.STDMEMO "
  972. +lrasql
  973. + " FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM t,QCM_JHY_INSP_PHYSICS r "
  974. + " WHERE t.SPECIMEN_NO = r.Specimen_No(+) "
  975. + " and t.seq = r.seq(+) "
  976. + " AND t.PHY_CODE_L = r.Phy_Code_l(+) "
  977. + " AND t.PHY_CODE_M = r.Phy_Code_m(+) "
  978. + " AND t.PHY_CODE_S = r.Phy_Code_s(+) "
  979. + " and t.SPECIMEN_NO='"+specimen_no+"' and t.FY_QUOTE_SPECIMEN_NO is null "
  980. + lrasql2;
  981. }
  982. List<HashMap> listEle= mapper.query(sql.toString());
  983. cro.setResult(listEle);
  984. }catch(Exception ex){
  985. SqlSession.rollback();
  986. }
  987. SqlSession.close();
  988. return cro;
  989. }
  990. //中厚板导出界面 子级
  991. public CoreReturnObject getQltySampleItemNew2(String specimen_no) throws SQLException {
  992. try{
  993. String sql ="";
  994. sql = "SELECT decode(t.SPECL_FL,'0','交付标准','1','特殊要求','4','加取项目样') 标准类型,"
  995. + " t.SPECIMEN_NO 取样编号,t.SEQ 项目序号,t.SMP_NO 试样号,t.PHY_NAME_L 检验大项,t.PHY_NAME_M 试样组,"
  996. +" t.PHY_NAME_S 材质检验项,t.ITEM_NAME_D 试验方向,t.ITEM_NAME_T 试验温度,t.ITEM_NAME_S 试样尺寸,t.ITEM_DESC_L 试验位置,"
  997. +" r.VAL1 值1,r.VAL2 值2,r.VAL3 值3,t.PHY_UNIT 值单位 "
  998. + " FROM QCM_JHY_SAMPLE_CONSIGN_D_ITEM t,QCM_JHY_INSP_PHYSICS r "
  999. + " WHERE t.SPECIMEN_NO = r.Specimen_No(+) "
  1000. + " and t.seq = r.seq(+) "
  1001. + " AND t.PHY_CODE_L = r.Phy_Code_l(+) "
  1002. + " AND t.PHY_CODE_M = r.Phy_Code_m(+) "
  1003. + " AND t.PHY_CODE_S = r.Phy_Code_s(+) "
  1004. + " and t.SPECIMEN_NO='"+specimen_no+"' and t.FY_QUOTE_SPECIMEN_NO is null "
  1005. + " order by t.phy_code_l asc,t.PHY_CODE_M asc,t.phy_code_s asc ";
  1006. List<HashMap> listEle= mapper.query(sql.toString());
  1007. cro.setResult(listEle);
  1008. }catch(Exception ex){
  1009. SqlSession.rollback();
  1010. }
  1011. SqlSession.close();
  1012. return cro;
  1013. }
  1014. /**
  1015. *ResultSet转换为JSON数组
  1016. *
  1017. * @param ResultSet
  1018. * @return JSONArray
  1019. */
  1020. public static JSONArray resultSetToJsonArry(ResultSet rs) throws SQLException, JSONException {
  1021. JSONArray array = new JSONArray();
  1022. ResultSetMetaData metaData = rs.getMetaData();
  1023. int columnCount = metaData.getColumnCount();
  1024. while (rs.next()) {
  1025. JSONObject jsonObj = new JSONObject();
  1026. for (int i = 1; i <= columnCount; i++) {
  1027. String columnName = metaData.getColumnLabel(i);
  1028. String value = rs.getString(columnName);
  1029. jsonObj.put(columnName, value);
  1030. }
  1031. array.add(jsonObj);
  1032. }
  1033. return array;
  1034. }
  1035. /**
  1036. * 查询质量设计-交付标准-材质标准
  1037. * @param parmas
  1038. * @return
  1039. */
  1040. public CoreReturnObject getQltyBasePhy(String phyDescL,String phyDescM,String phyNameS,String plineCode) {
  1041. try{
  1042. String sql="";
  1043. if(plineCode.equals("ZHB")){
  1044. sql = " and PROCESS_CODE in ('ZB1','HB1','HT1') ";
  1045. }else if(plineCode.equals("GB")){
  1046. sql = " and PROCESS_CODE in ('GX1','BC1','BC2','GX2') ";
  1047. }
  1048. else if(plineCode.equals("LT1")){
  1049. sql = " and PROCESS_CODE ='LT1' ";
  1050. }
  1051. else if(plineCode.equals("RZ1")){
  1052. sql = " and PROCESS_CODE ='RZ1' ";
  1053. }
  1054. else if(plineCode.equals("YT1")){
  1055. sql = " and PROCESS_CODE = 'YT1' ";
  1056. }
  1057. if(!"".equals(phyDescL)){
  1058. sql += " and phy_desc_l = '"+phyDescL+"' ";
  1059. }
  1060. if(!"".equals(phyDescM)){
  1061. sql += " and phy_desc_m = '"+phyDescM+"' ";
  1062. }
  1063. if(!"".equals(phyNameS)){
  1064. sql += " and phy_name_s = '"+phyNameS+"' ";
  1065. }
  1066. StringBuffer sqlucomm = new StringBuffer();
  1067. sqlucomm.append(" select distinct phy_code_l,phy_code_m, phy_code_s,item_code_d,item_code_t,item_code_s,item_code_l, ");
  1068. sqlucomm.append(" phy_desc_l, phy_desc_m,phy_name_s,item_desc_d,item_desc_t,item_desc_s,item_desc_l,");
  1069. sqlucomm.append(" ISJUDGE,JUDGE_BASIS,PHY_UNIT,MEMO ");
  1070. sqlucomm.append(" from (select phy_code_l,phy_code_m, phy_code_s,item_code_d,item_code_t,item_code_s, phy_desc_l, phy_desc_m, ");
  1071. sqlucomm.append(" phy_name_s,item_desc_d,item_desc_t,item_desc_s, isjudge,judge_basis,phy_unit, STDMEMO MEMO, item_code_l, ");
  1072. sqlucomm.append(" item_desc_l,sample_style_code,sample_style_name, stdmin_sign,stdmin,stdmax_sign,stdmax,org_code,");
  1073. sqlucomm.append(" org_name,psc_desc,prod_code,prod_name, steel_code, steel_name,std_code,std_name,to_char(CREATE_TIME,'yyyy-MM-dd') CREATE_TIME");
  1074. sqlucomm.append(" from qcm_ord_design_std_pic where 1=1 "
  1075. + sql
  1076. + " ) t");
  1077. sqlucomm.append(" where 1=1");
  1078. if(!"".equals(phyDescL)){
  1079. sqlucomm.append(" and lower(phy_desc_l) like lower('"+phyDescL+"%') ");
  1080. }
  1081. if(!"".equals(phyDescM)){
  1082. sqlucomm.append(" and lower(phy_desc_m) like lower('"+phyDescM+"%') ");
  1083. }
  1084. if(!"".equals(phyNameS)){
  1085. sqlucomm.append(" and lower(phy_name_s) like lower('"+phyNameS+"%') ");
  1086. }
  1087. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1088. cro.setResult(listEle);
  1089. }catch(Exception ex){
  1090. cro.setV_errCode(-1);
  1091. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  1092. SqlSession.rollback();
  1093. }
  1094. SqlSession.close();
  1095. return cro;
  1096. }
  1097. /**
  1098. * 材质大类描述 下拉框
  1099. * @param parmas
  1100. * @return
  1101. */
  1102. public CoreReturnObject getPhyDescL(String plineCode) {
  1103. try{
  1104. String sql="";
  1105. if(plineCode.equals("ZHB")){
  1106. sql = " and PROCESS_CODE in ('ZB1','HB1','HT1') ";
  1107. }else if(plineCode.equals("GB")){
  1108. sql = " and PROCESS_CODE in ('GX1','BC1','BC2','GX2') ";
  1109. }
  1110. else if(plineCode.equals("LT1")){
  1111. sql = " and PROCESS_CODE ='LT1' ";
  1112. }
  1113. else if(plineCode.equals("RZ1")){
  1114. sql = " and PROCESS_CODE ='RZ1' ";
  1115. }
  1116. else if(plineCode.equals("YT1")){
  1117. sql = " and PROCESS_CODE = 'YT1' ";
  1118. }
  1119. StringBuffer sqlucomm = new StringBuffer();
  1120. sqlucomm.append("select phy_code_l, phy_desc_l from qcm_ord_design_std_pic where 1 = 1 "
  1121. + sql
  1122. + " group by phy_code_l, phy_desc_l");
  1123. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1124. cro.setResult(listEle);
  1125. }catch(Exception ex){
  1126. cro.setV_errCode(-1);
  1127. cro.setV_errMsg("获取材质大类描述数据出错"+ex.getMessage());
  1128. SqlSession.rollback();
  1129. }
  1130. SqlSession.close();
  1131. return cro;
  1132. }
  1133. /**
  1134. * 材质试样组描述 下拉框
  1135. * @param parmas
  1136. * @return
  1137. */
  1138. public CoreReturnObject getPhyDescM(String phyDescL,String plineCode) {
  1139. try{
  1140. /*String sql="";
  1141. if(plineCode.equals("ZHB")){
  1142. sql = " and PROCESS_CODE in ('ZB1','HB1','HT1') ";
  1143. }else if(plineCode.equals("GB")){
  1144. sql = " and PROCESS_CODE in ('GX1','BC1','BC2','GX2') ";
  1145. }
  1146. else if(plineCode.equals("LT1")){
  1147. sql = " and PROCESS_CODE ='LT1' ";
  1148. }
  1149. else if(plineCode.equals("RZ1")){
  1150. sql = " and PROCESS_CODE ='RZ1' ";
  1151. }
  1152. else if(plineCode.equals("YT1")){
  1153. sql = " and PROCESS_CODE = 'YT1' ";
  1154. }*/
  1155. String sqlphy= "select t.* from QCM_JHY_SAMPLE_CONSIGN_D_ITEM t where phy_name_l = '"+phyDescL+"' and rownum=1 ";
  1156. List<HashMap> listphy= mapper.query(sqlphy.toString());
  1157. String phyCodeL=listphy.get(0).get("PHY_CODE_L").toString();
  1158. StringBuffer sqlucomm = new StringBuffer();
  1159. sqlucomm.append("select phy_code_m, phy_name_m as phy_desc_m from QCM_JHY_SAMPLE_CONSIGN_D_ITEM ");
  1160. sqlucomm.append(" where 1 = 1 and phy_name_l = '"+phyDescL+"' and PHY_CODE_L= '"+phyCodeL+"' "
  1161. //+ sql
  1162. + " group by phy_code_m, phy_name_m");
  1163. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1164. cro.setResult(listEle);
  1165. }catch(Exception ex){
  1166. cro.setV_errCode(-1);
  1167. cro.setV_errMsg("获取材质试样组描述数据出错"+ex.getMessage());
  1168. SqlSession.rollback();
  1169. }
  1170. SqlSession.close();
  1171. return cro;
  1172. }
  1173. /**
  1174. * 材质检验项名称 下拉框
  1175. * @param parmas
  1176. * @return
  1177. */
  1178. public CoreReturnObject getPhyNameS(String phyDescL,String phyDescM,String plineCode) {
  1179. try{
  1180. /* String sql="";
  1181. if(plineCode.equals("ZHB")){
  1182. sql = " and PROCESS_CODE in ('ZB1','HB1','HT1') ";
  1183. }else if(plineCode.equals("GB")){
  1184. sql = " and PROCESS_CODE in ('GX1','BC1','BC2','GX2') ";
  1185. }
  1186. else if(plineCode.equals("LT1")){
  1187. sql = " and PROCESS_CODE ='LT1' ";
  1188. }
  1189. else if(plineCode.equals("RZ1")){
  1190. sql = " and PROCESS_CODE ='RZ1' ";
  1191. }
  1192. else if(plineCode.equals("YT1")){
  1193. sql = " and PROCESS_CODE = 'YT1' ";
  1194. }*/
  1195. StringBuffer sqlucomm = new StringBuffer();
  1196. sqlucomm.append("select phy_code_s, phy_name_s from QCM_JHY_SAMPLE_CONSIGN_D_ITEM ");
  1197. sqlucomm.append(" where 1 = 1 and phy_name_l = '"+phyDescL+"' and phy_name_m = '"+phyDescM+"' "
  1198. //+ sql
  1199. + " group by phy_code_s, phy_name_s order by phy_code_s ");
  1200. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1201. cro.setResult(listEle);
  1202. }catch(Exception ex){
  1203. cro.setV_errCode(-1);
  1204. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  1205. SqlSession.rollback();
  1206. }
  1207. SqlSession.close();
  1208. return cro;
  1209. }
  1210. /**
  1211. * 添加检验项
  1212. */
  1213. public CoreReturnObject addPhyItem(String jsonArray,String specimen_no,String smp_no) {
  1214. //获取取样编号向下最大流水号
  1215. StringBuffer sqlucomm = new StringBuffer();
  1216. PreparedStatement ps = null;
  1217. Connection cn = this.getDao("testDao").getConnection();
  1218. ResultSet rs =null;
  1219. ResultSet results=null;
  1220. JSONArray tarArr=JSON.parseArray(jsonArray);
  1221. try {
  1222. //验证只有未发送的才可以添加检验项
  1223. sqlucomm.append("select count(1) from QCM_JHY_SAMPLE_CONSIGN_D where SPECIMEN_NO='"+specimen_no+"' and STATUS <> '0'");
  1224. rs =this.getDao("testDao").ExceuteQueryForResultSet(sqlucomm.toString());
  1225. if(rs.next()){
  1226. if(rs.getInt(1)>0){
  1227. cro.setV_errCode(-1);
  1228. cro.setV_errMsg("只有待发送的数据才能够添加检验项,请核实数据状态!");
  1229. return cro;
  1230. }
  1231. }
  1232. rs.close();
  1233. //获取取样编号对应的项目,判断是否存在重复
  1234. sqlucomm.setLength(0);
  1235. sqlucomm.append("select * from QCM_JHY_SAMPLE_CONSIGN_D_ITEM where SPECIMEN_NO='"+specimen_no+"'");
  1236. results=this.getDao("testDao").ExceuteQueryForResultSet(sqlucomm.toString());
  1237. JSONArray jsonObject=QuerryQltySample.resultSetToJsonArry(results);
  1238. results.close();
  1239. if (jsonObject!=null && jsonObject.size()>0) {
  1240. String oldStr="";
  1241. String newStr="";
  1242. for (int i = 0; i < jsonObject.size(); i++) {
  1243. JSONObject oldTar=jsonObject.getJSONObject(i);
  1244. oldStr=oldTar.getString("PHY_CODE_L")+"-";
  1245. oldStr=oldStr+oldTar.getString("PHY_CODE_M")+"-";
  1246. oldStr=oldStr+oldTar.getString("PHY_CODE_S")+"-";
  1247. if (oldTar.getString("ITEM_CODE_D")==null && !"".equals(oldTar.getString("ITEM_CODE_D"))) {
  1248. oldStr=oldStr+oldTar.getString("ITEM_CODE_D")+"-";
  1249. }else{
  1250. oldStr=oldStr+"null"+"-";
  1251. }
  1252. if (oldTar.getString("ITEM_CODE_T")==null && !"".equals(oldTar.getString("ITEM_CODE_T"))) {
  1253. oldStr=oldStr+oldTar.getString("ITEM_CODE_T")+"-";
  1254. }else{
  1255. oldStr=oldStr+"null"+"-";
  1256. }
  1257. if (oldTar.getString("ITEM_CODE_S")==null && !"".equals(oldTar.getString("ITEM_CODE_S"))) {
  1258. oldStr=oldStr+oldTar.getString("ITEM_CODE_S");
  1259. }else{
  1260. oldStr=oldStr+"null";
  1261. }
  1262. for (int j = 0; j < tarArr.size(); j++) {
  1263. JSONObject newTar=tarArr.getJSONObject(j);
  1264. newStr=newTar.getString("PHY_CODE_L")+"-";
  1265. newStr=newStr+newTar.getString("PHY_CODE_M")+"-";
  1266. newStr=newStr+newTar.getString("PHY_CODE_S")+"-";
  1267. if (newTar.getString("ITEM_CODE_D")==null && !"".equals(newTar.getString("ITEM_CODE_D"))) {
  1268. newStr=newStr+newTar.getString("ITEM_CODE_D")+"-";
  1269. }else{
  1270. newStr=newStr+"null"+"-";
  1271. }
  1272. if (newTar.getString("ITEM_CODE_T")==null && !"".equals(newTar.getString("ITEM_CODE_T"))) {
  1273. newStr=newStr+newTar.getString("ITEM_CODE_T")+"-";
  1274. }else{
  1275. newStr=newStr+"null"+"-";
  1276. }
  1277. if (newTar.getString("ITEM_CODE_S")==null && !"".equals(newTar.getString("ITEM_CODE_S"))) {
  1278. newStr=newStr+newTar.getString("ITEM_CODE_S");
  1279. }else{
  1280. newStr=newStr+"null";
  1281. }
  1282. if (oldStr.equals(newStr)) {
  1283. cro.setV_errCode(-1);
  1284. cro.setV_errMsg("原检验项已经存在["+newTar.getString("PHY_NAME_S")+"]项目,不能重复添加,请核实数据状态!");
  1285. return cro;
  1286. }
  1287. }
  1288. }
  1289. }
  1290. //获取最大流水号
  1291. sqlucomm.setLength(0);
  1292. sqlucomm.append("select max(SEQ) AS SEQ from QCM_JHY_SAMPLE_CONSIGN_D_ITEM where SPECIMEN_NO='"+specimen_no+"'");
  1293. Integer SEQ=0;
  1294. results=this.getDao("testDao").ExceuteQueryForResultSet(sqlucomm.toString());
  1295. if (results.next()) {
  1296. SEQ=results.getInt("SEQ");
  1297. SEQ++;
  1298. }
  1299. results.close();
  1300. cn.setAutoCommit(false);
  1301. sqlucomm.setLength(0);
  1302. sqlucomm.append("INSERT INTO QCM_JHY_SAMPLE_CONSIGN_D_ITEM (");
  1303. sqlucomm.append("SPECIMEN_NO,SEQ,SMP_NO,PHY_NAME_L,PHY_CODE_L,");
  1304. sqlucomm.append("PHY_CODE_M,PHY_NAME_M,PHY_CODE_S,PHY_NAME_S,ITEM_CODE_D,ITEM_NAME_D,ITEM_CODE_T,ITEM_NAME_T,");
  1305. sqlucomm.append("ITEM_CODE_S,ITEM_NAME_S,ISJUDGE,JUDGE_BASIS,PHY_UNIT,GROUP_SEQ,QUOTE_SPECIMEN_NO,");
  1306. sqlucomm.append("QUOTE_SEQ,MEMO,ITEM_CODE_L,ITEM_DESC_L,ITEM_FLAG) VALUES (");
  1307. sqlucomm.append("?,?,?,?,?,");
  1308. sqlucomm.append("?,?,?,?,?,?,?,?,");
  1309. sqlucomm.append("?,?,?,?,?,?,?,");
  1310. sqlucomm.append("?,?,?,?,'1')");
  1311. ps = cn.prepareStatement(sqlucomm.toString());
  1312. for (int i = 0; i < tarArr.size(); i++) {
  1313. JSONObject jsonObj = tarArr.getJSONObject(i);
  1314. jsonObj.put("SPECIMEN_NO", specimen_no);
  1315. jsonObj.put("SMP_NO", smp_no);
  1316. jsonObj.put("SEQ", SEQ++);
  1317. FillPhyItem(ps, jsonObj);
  1318. ps.addBatch();
  1319. }
  1320. ps.executeBatch();
  1321. ps.clearBatch();
  1322. ps.close();
  1323. cn.commit();
  1324. cro.setV_errCode(0);
  1325. cro.setV_errMsg("操作成功!");
  1326. } catch (Exception e) {
  1327. // TODO Auto-generated catch block
  1328. e.printStackTrace();
  1329. }finally {
  1330. try {
  1331. if(null != results)
  1332. results.close();
  1333. if(null != rs)
  1334. rs.close();
  1335. if(null != ps)
  1336. ps.close();
  1337. if(null != cn)
  1338. cn.close();;
  1339. } catch (SQLException e) {
  1340. e.printStackTrace();
  1341. }
  1342. }
  1343. SqlSession.close();
  1344. return cro;
  1345. }
  1346. void FillPhyItem(PreparedStatement pSta1 , JSONObject qlty) throws Exception{
  1347. pSta1.setString(1,qlty.getString("SPECIMEN_NO"));
  1348. pSta1.setLong(2, qlty.getLong("SEQ"));
  1349. pSta1.setString(3, qlty.getString("SMP_NO"));
  1350. pSta1.setString(4, qlty.getString("PHY_NAME_L"));
  1351. pSta1.setString(5, qlty.getString("PHY_CODE_L"));
  1352. pSta1.setString(6, qlty.getString("PHY_CODE_M"));
  1353. pSta1.setString(7, qlty.getString("PHY_NAME_M"));
  1354. pSta1.setString(8, qlty.getString("PHY_CODE_S"));
  1355. pSta1.setString(9, qlty.getString("PHY_NAME_S"));
  1356. pSta1.setString(10, qlty.getString("ITEM_CODE_D"));
  1357. pSta1.setString(11, qlty.getString("ITEM_NAME_D"));
  1358. pSta1.setString(12, qlty.getString("ITEM_CODE_T"));
  1359. pSta1.setString(13, qlty.getString("ITEM_NAME_T"));
  1360. pSta1.setString(14, qlty.getString("ITEM_CODE_S"));
  1361. pSta1.setString(15, qlty.getString("ITEM_NAME_S"));
  1362. pSta1.setString(16, qlty.getString("ISJUDGE"));
  1363. pSta1.setString(17, qlty.getString("JUDGE_BASIS"));
  1364. pSta1.setString(18, qlty.getString("PHY_UNIT"));
  1365. pSta1.setString(19, qlty.getString("GROUP_SEQ"));
  1366. pSta1.setString(20, qlty.getString("QUOTE_SPECIMEN_NO"));
  1367. pSta1.setString(21, qlty.getString("QUOTE_SEQ"));
  1368. pSta1.setString(22, qlty.getString("MEMO"));
  1369. pSta1.setString(23, qlty.getString("ITEM_CODE_L"));
  1370. pSta1.setString(24, qlty.getString("ITEM_DESC_L"));
  1371. }
  1372. /**
  1373. * 人工委托 厚板线
  1374. * @param parmas
  1375. * @return
  1376. */
  1377. public CoreReturnObject getKchTurnofFlist(String DesignKey,String HeatNo,String BatchNo) {
  1378. try{
  1379. if(StringUtils.isBlank(BatchNo) && StringUtils.isBlank(DesignKey)){
  1380. cro.setV_errCode(-1);
  1381. cro.setV_errMsg("轧批号不能为空!!!");
  1382. SqlSession.rollback();
  1383. return cro;
  1384. }
  1385. String sql ="SELECT decode(GET_LRAWEGHT_YN(t.GRADE_CODE),'1',GET_LRAWEGHT,'0','') LRAWEGHT,t.* ,"
  1386. + " case when nvl((select count(1) num from qcm_jhy_sample_r_ord r where r.design_key = t.design_key and r.batch_no = t.batch_no),'0') = '0' then '否' else '是' end NUMUER "
  1387. + " FROM "
  1388. +" (SELECT '' RCL_STATE,T.ORDERID DESIGN_KEY,A.PSRNO PSC, "
  1389. +" to_char(T.HEATNO) HEAT_NO,T.BATCHNO BATCH_NO,T.MOTHERSLAB BOARD_NO, "
  1390. +" to_char(T.STEELTYPE) GRADE_CODE,to_char(T.STEELTYPE) GRADE_NAME,'ABBR' PLINE_ABBR,T.SLABNO MATERIAL_NO, "
  1391. +" 'L-HPT-00005872' MSC_PLINE,'HB1' PLINE_CODE,'厚板线' PLINE_NAME,A.STANDROLLER DELIVERY_STATE_CODE, "
  1392. +" A.STANDSTATUS DELIVERY_STATE_DESC,'HR' PROCESS_CODE,T.THICK THICK, T.WIDTH WIDTH,T.LEN LENGTH, "
  1393. +" nvl(T.BILLETID_SY,T.BATCHNO||'0001') INSPECTION_LOT, "
  1394. +" (select CASE WHEN COUNT(1)>0 THEN '1' ELSE '0' END from QCM_ORD_DESIGN_SAMPLE_M where design_key= T.ORDERID) IS_QTLY, "
  1395. +" (select CASE WHEN COUNT(1)>0 THEN '1' ELSE '0' END from QCM_ORD_DESIGN_STD_CIC where design_key=T.ORDERID "
  1396. +" and std_type_code='C') IS_CHEM,'0' TYPE,' ' MEMO,' ' QLTY_SMP_NO,A.ISTHIRD VESSEL,A.SAMPLINGREQUESTTIME "
  1397. +" FROM ZYHB_PLANDETAILOFPLATE@xgcx T,SEL_PACTDETAIL_NEW@xgcx A "
  1398. +" WHERE T.ORDERID = A.ORDERNO "
  1399. + " and T.SLABNO not in (select T.BILLETID from KCH_TURNOFFLIST@xgcx T where t.ROLLNUMBER like '"+BatchNo+"%' )"
  1400. + " and T.ORDERID is not null "
  1401. // +" AND T.MAKETIME > SYSDATE - 15 "
  1402. // +" AND A.SAMPLINGREQUESTTIME IN ('A','AB') "
  1403. +" union all "
  1404. +" SELECT t.RCL_STATE,T.ALLOTORDERFORM DESIGN_KEY,A.PSRNO PSC, "
  1405. +" T.STOVENO HEAT_NO,T.ROLLNUMBER BATCH_NO,T.MOTHERBOARDNUMBER BOARD_NO, "
  1406. +" T.DETERMINANTCARDNUMBER GRADE_CODE,T.DETERMINANTCARDNUMBER GRADE_NAME,'ABBR' PLINE_ABBR,T.BILLETID MATERIAL_NO, "
  1407. +" 'L-HPT-00005872' MSC_PLINE,'HB1' PLINE_CODE,'厚板线' PLINE_NAME,A.STANDROLLER DELIVERY_STATE_CODE, "
  1408. +" A.STANDSTATUS DELIVERY_STATE_DESC,'HR' PROCESS_CODE,T.PLY THICK,T.WIDTH WIDTH,T.LENGTH LENGTH, "
  1409. +" nvl(T.BILLETID_HB_SY,T.ROLLNUMBER||'0001') INSPECTION_LOT, "
  1410. +" (select CASE WHEN COUNT(1)>0 THEN '1' ELSE '0' END from QCM_ORD_DESIGN_SAMPLE_M where design_key= T.ALLOTORDERFORM) IS_QTLY, "
  1411. +" (select CASE WHEN COUNT(1)>0 THEN '1' ELSE '0' END from QCM_ORD_DESIGN_STD_CIC where design_key=T.ALLOTORDERFORM "
  1412. +" and std_type_code='C') IS_CHEM,'0' TYPE,' ' MEMO,' ' QLTY_SMP_NO,A.ISTHIRD VESSEL,A.SAMPLINGREQUESTTIME "
  1413. +" FROM KCH_TURNOFFLIST@xgcx T,SEL_PACTDETAIL_NEW@xgcx A "
  1414. +" WHERE T.ALLOTORDERFORM = A.ORDERNO"
  1415. + " and T.ALLOTORDERFORM is not null "
  1416. // +" AND (select count(1) from zyzb_heatinfo@xgcx "
  1417. // +" where ISOUT = '1' and ISVALID = '1' and BILLETID = t.billetid and substr(RCL_STATE,3,1) = 'O') > 0 "
  1418. // +" AND T.CREATTIME > SYSDATE - 15 "
  1419. // +" AND A.SAMPLINGREQUESTTIME IN ('B','AB') "
  1420. +" AND T.PSTATFLAG <> '0' "
  1421. +" )t WHERE (t.IS_QTLY <> 0 OR t.IS_CHEM > 0) ";
  1422. if(DesignKey != null && !DesignKey.equals("")){
  1423. sql += " and t.DESIGN_KEY like '"+DesignKey+"%'";//销售订单号
  1424. }
  1425. if(HeatNo != null && !HeatNo.equals("")){
  1426. sql += " and t.HEAT_NO like '"+HeatNo+"%'";//炉号
  1427. }
  1428. if(BatchNo != null && !BatchNo.equals("")){
  1429. sql += " and t.BATCH_NO like '"+BatchNo+"%'";//轧批号
  1430. }
  1431. sql +=" and t.BATCH_NO like 'H%' order by t.MATERIAL_NO desc";
  1432. StringBuffer sqlucomm = new StringBuffer();
  1433. sqlucomm.append(sql);
  1434. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1435. cro.setResult(listEle);
  1436. }catch(Exception ex){
  1437. cro.setV_errCode(-1);
  1438. cro.setV_errMsg("获取厚板线数据出错"+ex.getMessage());
  1439. SqlSession.rollback();
  1440. }
  1441. SqlSession.close();
  1442. return cro;
  1443. }
  1444. /**
  1445. * 人工委托 中板线
  1446. * @param parmas
  1447. * @return
  1448. */
  1449. public CoreReturnObject getKczTurnofFlist(String DesignKey,String HeatNo,String BatchNo) {
  1450. try{
  1451. if(StringUtils.isBlank(BatchNo)&& StringUtils.isBlank(DesignKey)){
  1452. cro.setV_errCode(-1);
  1453. cro.setV_errMsg("轧批号不能为空!!!");
  1454. SqlSession.rollback();
  1455. return cro;
  1456. }
  1457. String sql = "SELECT decode(GET_LRAWEGHT_YN(t.GRADE_CODE),'1',GET_LRAWEGHT,'0','') LRAWEGHT,t.* ,"
  1458. + " case when nvl((select count(1) num from qcm_jhy_sample_r_ord r where r.design_key = t.design_key and r.batch_no = t.batch_no),'0') = '0' then '否' else '是' end NUMUER "
  1459. +" FROM (SELECT '' RCL_STATE,T.ORDERNO DESIGN_KEY, "
  1460. +" A.PSRNO PSC, "
  1461. +" to_char(T.HEATNO) HEAT_NO, "
  1462. +" T.BATCHNO BATCH_NO, "
  1463. +" T.MOTHERPLATEID BOARD_NO, "
  1464. +" to_char(T.STEELCODE) GRADE_CODE, "
  1465. +" to_char(T.STEELCODE) GRADE_NAME, "
  1466. +" 'ABBR' PLINE_ABBR, "
  1467. +" T.PRODUCTNO MATERIAL_NO, "
  1468. +" 'L-HPT-00005872' MSC_PLINE, "
  1469. +" 'ZB1' PLINE_CODE, "
  1470. +" '中板线' PLINE_NAME, "
  1471. +" A.STANDROLLER DELIVERY_STATE_CODE, "
  1472. +" A.STANDSTATUS DELIVERY_STATE_DESC, "
  1473. +" 'HR' PROCESS_CODE, "
  1474. +" T.HEIGHT THICK, "
  1475. +" T.WIDTH WIDTH, "
  1476. +" T.LENGTH LENGTH, "
  1477. +" nvl(T.BILLETID_SY, T.BATCHNO || '0001') INSPECTION_LOT, "
  1478. +" (select CASE "
  1479. +" WHEN COUNT(1) > 0 THEN "
  1480. +" '1' "
  1481. +" ELSE "
  1482. +" '0' "
  1483. +" END "
  1484. +" from QCM_ORD_DESIGN_SAMPLE_M "
  1485. +" where design_key = T.ORDERNO) IS_QTLY, "
  1486. +" (select CASE "
  1487. +" WHEN COUNT(1) > 0 THEN "
  1488. +" '1' "
  1489. +" ELSE "
  1490. +" '0' "
  1491. +" END "
  1492. +" from QCM_ORD_DESIGN_STD_CIC "
  1493. +" where design_key = T.ORDERNO "
  1494. +" and std_type_code = 'C') IS_CHEM, "
  1495. +" '0' TYPE, "
  1496. +" ' ' MEMO, "
  1497. +" ' ' QLTY_SMP_NO, "
  1498. +" A.ISTHIRD VESSEL, "
  1499. +" (SELECT min(ALLPHYTESTNAMES) FROM LH_SAMPLE_CONSIGN_DETAIL@xgcx where PID_MB_CB_ID = t.productno) ALLPHYTESTNAMES, "
  1500. // +" dbms_lob.substr((select wmsys.wm_concat(DISTINCT phy_name_s) from QCM_ORD_DESIGN_STD_PIC WHERE design_key=T.ORDERNO)) ALLPHYTESTNAMES2"
  1501. // +"(select wmsys.wm_concat(DISTINCT phy_name_s) from QCM_ORD_DESIGN_STD_PIC WHERE design_key = T.ORDERNO) ALLPHYTESTNAMES2"
  1502. +" (select listagg(phy_name_s,',')within group(order by phy_name_s)from "
  1503. +" (select distinct phy_name_s,design_key from QCM_ORD_DESIGN_STD_PIC) "
  1504. +" WHERE design_key = T.ORDERNO ) ALLPHYTESTNAMES2, "
  1505. +" A.SAMPLINGREQUESTTIME "
  1506. +" FROM MB_PLANDETAILOFPLATE@xgcx T, SEL_PACTDETAIL_NEW@xgcx A "
  1507. +" WHERE T.ORDERNO = A.ORDERNO "
  1508. + " and T.PRODUCTNO not in (select T.BILLETID from KCZ_TURNOFFLIST@xgcx T where t.ROLLNUMBER like '"+BatchNo+"%' )"
  1509. + " and T.ORDERNO is not null "
  1510. // +" AND T.MAKETIME > SYSDATE - 3 "
  1511. +" AND A.SAMPLINGREQUESTTIME IN ('A', 'AB') "
  1512. +" union all "
  1513. +" SELECT t.RCL_STATE,T.ORDERNO DESIGN_KEY, "
  1514. +" A.PSRNO PSC, "
  1515. +" T.STOVENO HEAT_NO, "
  1516. +" T.ROLLNUMBER BATCH_NO, "
  1517. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  1518. +" T.DETERMINANTCARDNUMBER GRADE_CODE, "
  1519. +" T.DETERMINANTCARDNUMBER GRADE_NAME, "
  1520. +" 'ABBR' PLINE_ABBR, "
  1521. +" T.BILLETID MATERIAL_NO, "
  1522. +" 'L-HPT-00005872' MSC_PLINE, "
  1523. +" 'ZB1' PLINE_CODE, "
  1524. +" '中板线' PLINE_NAME, "
  1525. +" A.STANDROLLER DELIVERY_STATE_CODE, "
  1526. +" A.STANDSTATUS DELIVERY_STATE_DESC, "
  1527. +" 'HR' PROCESS_CODE, "
  1528. +" T.PLY THICK, "
  1529. +" T.WIDTH WIDTH, "
  1530. +" T.LENGTH LENGTH, "
  1531. +" nvl(T.BILLETID_SY, T.ROLLNUMBER || '0001') INSPECTION_LOT, "
  1532. +" (select CASE "
  1533. +" WHEN COUNT(1) > 0 THEN "
  1534. +" '1' "
  1535. +" ELSE "
  1536. +" '0' "
  1537. +" END "
  1538. +" from QCM_ORD_DESIGN_SAMPLE_M "
  1539. +" where design_key = T.ORDERNO) IS_QTLY, "
  1540. +" (select CASE "
  1541. +" WHEN COUNT(1) > 0 THEN "
  1542. +" '1' "
  1543. +" ELSE "
  1544. +" '0' "
  1545. +" END "
  1546. +" from QCM_ORD_DESIGN_STD_CIC "
  1547. +" where design_key = T.ORDERNO "
  1548. +" and std_type_code = 'C') IS_CHEM, "
  1549. +" '0' TYPE, "
  1550. +" ' ' MEMO, "
  1551. +" ' ' QLTY_SMP_NO, "
  1552. +" A.ISTHIRD VESSEL, "
  1553. +" (SELECT min(ALLPHYTESTNAMES) FROM LH_SAMPLE_CONSIGN_DETAIL@xgcx where PID_MB_CB_ID = t.BILLETID) ALLPHYTESTNAMES, "
  1554. // +" dbms_lob.substr((select wmsys.wm_concat(DISTINCT phy_name_s) from QCM_ORD_DESIGN_STD_PIC WHERE design_key=T.ORDERNO)) ALLPHYTESTNAMES2"
  1555. // +"(select wmsys.wm_concat(DISTINCT phy_name_s) from QCM_ORD_DESIGN_STD_PIC WHERE design_key = T.ORDERNO) ALLPHYTESTNAMES2"
  1556. +" (select listagg(phy_name_s,',')within group(order by phy_name_s)from "
  1557. +" (select distinct phy_name_s,design_key from QCM_ORD_DESIGN_STD_PIC) "
  1558. +" WHERE design_key = T.ORDERNO ) ALLPHYTESTNAMES2, "
  1559. +" A.SAMPLINGREQUESTTIME "
  1560. +" FROM KCZ_TURNOFFLIST@xgcx T, SEL_PACTDETAIL_NEW@xgcx A "
  1561. +" WHERE T.ORDERNO = A.ORDERNO "
  1562. + " and T.ORDERNO is not null "
  1563. // +" AND T.CREATTIME > SYSDATE - 3 "
  1564. // +" AND (select count(1) "
  1565. // +" from zyzb_heatinfo@xgcx "
  1566. // +" where ISOUT = '1' "
  1567. // +" and ISVALID = '1' "
  1568. // +" and BILLETID = t.billetid "
  1569. // +" and substr(RCL_STATE, 3, 1) = 'O') > 0 "
  1570. // +" AND A.SAMPLINGREQUESTTIME IN ('B', 'AB') "
  1571. +" AND T.ISVALID <> '0') t "
  1572. +" WHERE (t.IS_QTLY <> 0 OR t.IS_CHEM > 0) ";
  1573. if(DesignKey != null && !DesignKey.equals("")){
  1574. sql += " and t.DESIGN_KEY like '"+DesignKey+"%'";//销售订单号
  1575. }
  1576. if(HeatNo != null && !HeatNo.equals("")){
  1577. sql += " and t.HEAT_NO like '"+HeatNo+"%'";//炉号
  1578. }
  1579. if(BatchNo != null && !BatchNo.equals("")){
  1580. sql += " and t.BATCH_NO like '"+BatchNo+"%'";//轧批号
  1581. }
  1582. sql +=" and t.BATCH_NO like 'Z%' order by t.MATERIAL_NO desc";
  1583. StringBuffer sqlucomm = new StringBuffer();
  1584. sqlucomm.append(sql);
  1585. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1586. cro.setResult(listEle);
  1587. /*cro = this.getDao("testDao").ExcuteQuery(sql.toString());*/
  1588. }catch(Exception ex){
  1589. cro.setV_errCode(-1);
  1590. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  1591. SqlSession.rollback();
  1592. }
  1593. SqlSession.close();
  1594. return cro;
  1595. }
  1596. /**
  1597. * 人工委托 高棒线
  1598. * @param parmas
  1599. * @return
  1600. */
  1601. public CoreReturnObject getKcxTurnofFlist(String DesignKey,String HeatNo,String BatchNo) {
  1602. try{
  1603. /* String sql = " SELECT (SELECT MAX(BILLETID_JY) FROM ZJ_RESULT_ALL@xgcx WHERE BILLETID = T.BILLETID) as INSPECTION_LOT,ORDERNO as DESIGN_KEY, "
  1604. +" (SELECT PSRNO FROM SEL_PACTDETAIL@xgcx WHERE ORDERNO = T.ORDERNO) as PSC,STOVENO as HEAT_NO,ROLLNUMBER as BATCH_NO,ROLLNUMBER as BOARD_NO, "
  1605. +" (SELECT MAX(STEELCODE) FROM kcx_stufflist@xgcx WHERE STOVENO = T.STOVENO) as GRADE_CODE, "
  1606. +" (SELECT MAX(STEELCODE) FROM kcx_stufflist@xgcx WHERE STOVENO = T.STOVENO) as GRADE_NAME, "
  1607. +" BILLETID as MATERIAL_NO,SUBSTR(PLD,5,3) as MSC_PLINE,SUBSTR(PLD,5,3) as PLINE_CODE,C2N@xgcx(PLD) as PLINE_NAME, "
  1608. +" (select max(STANDROLLER) from sel_pactdetail where ORDERNO = t.ORDERNO) as DELIVERY_STATE_CODE, "
  1609. +" (select max(STANDROLLER) from sel_pactdetail where ORDERNO = t.ORDERNO) as DELIVERY_STATE_DESC,"
  1610. +" '' as PROCESS_CODE,PLY as THICK,WIDTH,LENGTH,'1' as IS_QTLY,'1' as IS_CHEM,'0' as TYPE,'' as MEMO "
  1611. +" FROM KCX_TURNOFFLIST@xgcx T WHERE 1=1 ";//BILLETID LIKE 'Y2%'
  1612. if(DesignKey != null && !DesignKey.equals("")){
  1613. sql += " and ALLOTORDERFORM like '%"+DesignKey+"%'";//销售订单号
  1614. }
  1615. if(HeatNo != null && !HeatNo.equals("")){
  1616. sql += " and STOVENO like '%"+HeatNo+"%'";//炉号
  1617. }
  1618. if(BatchNo != null && !BatchNo.equals("")){
  1619. sql += " and ROLLNUMBER like '%"+BatchNo+"%'";//轧批号
  1620. }
  1621. if((DesignKey == null || DesignKey.equals(""))
  1622. && (HeatNo == null || HeatNo.equals(""))
  1623. && (BatchNo == null || BatchNo.equals("")) ){
  1624. sql += " and T.intime > sysdate - 3 ";
  1625. }
  1626. sql +=" AND T.DETERMINANTRESULT IS NOT NULL order by BILLETID desc";*/
  1627. //--'ABBR' PLINE_ABBR, -- ' ' QLTY_SMP_NO, -- T.INTIME
  1628. if(StringUtils.isBlank(BatchNo)){
  1629. cro.setV_errCode(-1);
  1630. cro.setV_errMsg("轧批号不能为空!!!");
  1631. SqlSession.rollback();
  1632. return cro;
  1633. }
  1634. String sql = "SELECT * "
  1635. +" FROM (SELECT T.ORDERNO DESIGN_KEY, "
  1636. +" A.PSRNO PSC, "
  1637. +" T.STOVENO HEAT_NO, "
  1638. +" T.ROLLNUMBER BATCH_NO, "
  1639. +" T.ROLLNUMBER BOARD_NO, "
  1640. +" T.DETERMINANTCARDNUMBER GRADE_CODE, "
  1641. +" T.DETERMINANTCARDNUMBER GRADE_NAME, "
  1642. +" "
  1643. +" T.BILLETID MATERIAL_NO, "
  1644. +" 'L-HPT-00005872' MSC_PLINE, "
  1645. +" substr(T.PLD, 5, 3) PLINE_CODE, "
  1646. +" C2N@xgcx(T.PLD) PLINE_NAME, "
  1647. +" A.STANDROLLER DELIVERY_STATE_CODE, "
  1648. +" A.STANDSTATUS DELIVERY_STATE_DESC, "
  1649. +" 'HR' PROCESS_CODE, "
  1650. +" A.HEIGHT THICK, "
  1651. +" A.WIDTH WIDTH, "
  1652. +" A.LENGTH LENGTH, "
  1653. +" nvl(T.BILLETID_SY, T.ROLLNUMBER || '0001') INSPECTION_LOT, "
  1654. +" (select CASE WHEN COUNT(1)>0 THEN '1' ELSE '0' END from QCM_ORD_DESIGN_SAMPLE_M where design_key= T.ORDERNO) IS_QTLY, "
  1655. +" (select CASE WHEN COUNT(1)>0 THEN '1' ELSE '0' END from QCM_ORD_DESIGN_STD_CIC where design_key=T.ORDERNO and std_type_code='C') IS_CHEM, "
  1656. +" '0' TYPE, "
  1657. +" ' ' MEMO, "
  1658. +" "
  1659. +" nvl(A.XB_BATCHWEIGHT_MAX, '0') WEIGHT_STD, "
  1660. +" nvl((select sum(WEIGHT) "
  1661. +" from kcx_stuffoutstorage@xgcx "
  1662. +" where ROLLNO = t.rollnumber "
  1663. +" AND ISVALID = '1'), "
  1664. +" (select sum(THEORYWEIGHT) "
  1665. +" from kcx_turnofflist "
  1666. +" where ROLLNUMBER = t.rollnumber)) WEIGHT, "
  1667. +" nvl(A.ADDFREQNUM, '0') WEIGHT_SFD "
  1668. +" "
  1669. +" FROM KCX_TURNOFFLIST@xgcx T, SEL_PACTDETAIL_NEW@xgcx A "
  1670. +" WHERE T.ORDERNO = A.ORDERNO ";
  1671. if(DesignKey != null && !DesignKey.equals("")){
  1672. sql += " and ORDERNO like '"+DesignKey+"%'";//销售订单号
  1673. }
  1674. if(HeatNo != null && !HeatNo.equals("")){
  1675. sql += " and STOVENO like '"+HeatNo+"%'";//炉号
  1676. }
  1677. if(BatchNo != null && !BatchNo.equals("")){
  1678. sql += " and ROLLNUMBER like '"+BatchNo+"%'";//轧批号
  1679. }
  1680. //AND T.INTIME > SYSDATE - 3 AND T.DETERMINANTRESULT IS NOT NULL
  1681. sql +=" order by t.intime desc)"
  1682. +" WHERE (IS_QTLY <> 0 OR IS_CHEM > 0)";
  1683. StringBuffer sqlucomm = new StringBuffer();
  1684. sqlucomm.append(sql);
  1685. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1686. cro.setResult(listEle);
  1687. }catch(Exception ex){
  1688. cro.setV_errCode(-1);
  1689. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  1690. SqlSession.rollback();
  1691. }
  1692. SqlSession.close();
  1693. return cro;
  1694. }
  1695. /**
  1696. * 人工委托 热轧线 @sq101
  1697. * @param parmas
  1698. * @return
  1699. */
  1700. public CoreReturnObject getHotRoll(String DesignKey,String HeatNo,String BatchNo) {
  1701. try{
  1702. if(StringUtils.isBlank(BatchNo)){
  1703. cro.setV_errCode(-1);
  1704. cro.setV_errMsg("轧批号不能为空!!!");
  1705. SqlSession.rollback();
  1706. return cro;
  1707. }
  1708. String sql = " select * from(select DISTINCT T1.SAMPL_NO INSPECTION_LOT, "
  1709. + " T1.ORD_NO || T1.ORD_SEQ DESIGN_KEY, "
  1710. + " (SELECT T.PSC "
  1711. + " FROM QCM_ORD_DESIGN_STD_PIC T "
  1712. + " WHERE T.DESIGN_KEY = T1.ORD_NO || T1.ORD_SEQ AND ROWNUM = 1) PSC, "
  1713. + " SUBSTR(T1.SLAB_NO, 1, 10) HEAT_NO, "
  1714. + " SUBSTR(T1.OLD_SAMPL_NO, 1, 10) BATCH_NO, "
  1715. + " T1.SLAB_NO BOARD_NO, "
  1716. + " t1.STL_GRD GRADE_CODE, "
  1717. + " t1.STL_GRD GRADE_name, "
  1718. + " 'RZ10' PLINE_ABBR, "
  1719. + " T1.OLD_SAMPL_NO MATERIAL_NO, "
  1720. + " 'RZ' MSC_PLINE, "
  1721. + " 'RZ1' PLINE_CODE, "
  1722. + " '热轧' PLINE_NAME, "
  1723. + " t2.PRODNM_CD DELIVERY_STATE_CODE, "
  1724. + " t2.PRODNM_CD DELIVERY_STATE_desc, "
  1725. + " '' PROCESS_CODE, "
  1726. + " t2.ORD_THK THICK, "
  1727. + " t2.ORD_WTH WIDTH, "
  1728. + " t1.COIL_LEN LENGTH, "
  1729. + " '1' IS_QTLY, "
  1730. + " '0' IS_CHEM, "
  1731. + " '0' TYPE, "
  1732. + " '' MEMO, "
  1733. + " '' QLTY_OLD_INSPECTION, "
  1734. + " '' CHEM_OLD_INSPECTION "
  1735. + " from qcm_judge_coil_result t, tbh02_coil_comm t1 ,TBE02_ORD_PRC T2"
  1736. +" where t1.OLD_SAMPL_NO = t.COIL_NO "
  1737. + " AND T1.ORD_NO=T2.ORD_NO AND T1.ORD_SEQ=T2.ORD_SEQ ";
  1738. if(DesignKey != null && !DesignKey.equals("")){
  1739. sql += " and T1.ORD_NO || T1.ORD_SEQ like '"+DesignKey+"%'";//销售订单号
  1740. }
  1741. if(HeatNo != null && !HeatNo.equals("")){
  1742. sql += " and T1.SLAB_NO like '"+HeatNo+"%'";//炉号
  1743. }
  1744. if(BatchNo != null && !BatchNo.equals("")){
  1745. sql += " and T1.OLD_SAMPL_NO like '"+BatchNo+"%'";//轧批号
  1746. }
  1747. sql +=" order by T1.SAMPL_NO desc)t";
  1748. sql +=" where t.psc is not null ";
  1749. StringBuffer sqlucomm = new StringBuffer();
  1750. sqlucomm.append(sql);
  1751. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1752. cro.setResult(listEle);
  1753. }catch(Exception ex){
  1754. cro.setV_errCode(-1);
  1755. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  1756. SqlSession.rollback();
  1757. }
  1758. SqlSession.close();
  1759. return cro;
  1760. }
  1761. /**
  1762. * 人工委托 连退线
  1763. * @param parmas
  1764. * @return
  1765. */
  1766. public CoreReturnObject getRetreat(String DesignKey,String HeatNo,String BatchNo) {
  1767. try{
  1768. if(StringUtils.isBlank(BatchNo)){
  1769. cro.setV_errCode(-1);
  1770. cro.setV_errMsg("轧批号不能为空!!!");
  1771. SqlSession.rollback();
  1772. return cro;
  1773. }
  1774. String sql = " select * from( select DISTINCT T1.SMP_NO INSPECTION_LOT, "
  1775. + " T1.ORD_NO || T1.ORD_SEQ DESIGN_KEY, "
  1776. + " (SELECT T.PSC FROM QCM_ORD_DESIGN_STD_PIC T "
  1777. + " WHERE T.DESIGN_KEY = T1.ORD_NO || T1.ORD_SEQ AND ROWNUM = 1) PSC, "
  1778. + " SUBSTR(T1.SLAB_NO, 1, 10) HEAT_NO, "
  1779. + " SUBSTR(T1.OLD_SAMPL_NO, 1, 12) BATCH_NO, "
  1780. + " T1.SLAB_NO BOARD_NO, "
  1781. + " t1.SPEC_STL_GRD GRADE_CODE, "
  1782. + " t1.SPEC_STL_GRD GRADE_name, "
  1783. + " 'LT10' PLINE_ABBR, "
  1784. + " T1.OLD_SAMPL_NO MATERIAL_NO, "
  1785. + " 'LT' MSC_PLINE, "
  1786. + " 'LT1' PLINE_CODE, "
  1787. + " '连退' PLINE_NAME, "
  1788. + " t2.C_PRODNM_CD DELIVERY_STATE_CODE, "
  1789. + " t2.C_PRODNM_CD DELIVERY_STATE_desc, "
  1790. + " '' PROCESS_CODE, "
  1791. + " t2.C_ORD_THK THICK, "
  1792. + " t2.C_ORD_WTH WIDTH, "
  1793. + " t1.COIL_LEN LENGTH, "
  1794. + " '1' IS_QTLY, "
  1795. + " '0' IS_CHEM, "
  1796. + " '0' TYPE, "
  1797. + " '' MEMO, "
  1798. + " '' QLTY_OLD_INSPECTION, "
  1799. + " '' CHEM_OLD_INSPECTION "
  1800. + " from qcm_judge_coil_result t, C_TBC02_COIL_COMM t1,TBE02_ORD_PRC T2 "
  1801. +" where t1.OLD_sampl_no = t.coil_no "
  1802. + " AND T1.ORD_NO=T2.ORD_NO AND T1.ORD_SEQ=T2.ORD_SEQ ";
  1803. if(DesignKey != null && !DesignKey.equals("")){
  1804. sql += " and T1.ORD_NO || T1.ORD_SEQ like '"+DesignKey+"%'";//销售订单号
  1805. }
  1806. if(HeatNo != null && !HeatNo.equals("")){
  1807. sql += " and T1.SLAB_NO like '"+HeatNo+"%'";//炉号
  1808. }
  1809. if(BatchNo != null && !BatchNo.equals("")){
  1810. sql += " and T1.OLD_SAMPL_NO like '"+BatchNo+"%'";//轧批号
  1811. }
  1812. sql +=" order by T1.SMP_NO desc ) t";
  1813. sql +=" where t.psc is not null ";
  1814. StringBuffer sqlucomm = new StringBuffer();
  1815. sqlucomm.append(sql);
  1816. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1817. cro.setResult(listEle);
  1818. }catch(Exception ex){
  1819. cro.setV_errCode(-1);
  1820. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  1821. SqlSession.rollback();
  1822. }
  1823. SqlSession.close();
  1824. return cro;
  1825. }
  1826. //查询人工委托的数据是否已委托还未发送
  1827. public CoreReturnObject selEntrust(String date) {
  1828. ResultSet rs =null;
  1829. JSONArray jsonArray = JSON.parseArray(date);
  1830. if (jsonArray==null || jsonArray.size()<1) {
  1831. cro.setV_errCode(-1);
  1832. cro.setV_errMsg("请传入参数!");
  1833. return cro;
  1834. }
  1835. try {
  1836. //循环执行每一条数据
  1837. for(int i=0; i < jsonArray.size();i++){
  1838. JSONObject jobject=jsonArray.getJSONObject(i);
  1839. String designKey = (String)jobject.get("DESIGN_KEY");//订单号
  1840. String BATCH_NO = (String)jobject.get("BATCH_NO");//
  1841. String PLINE_CODE = (String)jobject.get("PLINE_CODE");//
  1842. String sql = " select count(*) countnum from QCM_JHY_SAMPLE_R_ORD ord inner join QCM_JHY_SAMPLE_CONSIGN_D d on ord.smp_no = d.smp_no "
  1843. + " where ord.inspection_lot = d.inspection_lot and ord.psc = ord.psc and ord.heat_no = d.heat_no "
  1844. + " and ord.batch_no = ord.batch_no and d.status = '0' and ord.design_key ='"+designKey+"' and d.PLINE_CODE = '"+PLINE_CODE+"' ";
  1845. sql += "and ord.BATCH_NO ='"+BATCH_NO+"'";
  1846. StringBuffer sqlucomm = new StringBuffer();
  1847. sqlucomm.append(sql);
  1848. rs =this.getDao("testDao").ExceuteQueryForResultSet(sqlucomm.toString());
  1849. if(rs.next()){
  1850. if(rs.getInt(1)>0){
  1851. cro.setV_errCode(1);
  1852. SqlSession.close();
  1853. return cro;
  1854. }
  1855. }
  1856. }
  1857. } catch (SQLException e) {
  1858. // TODO Auto-generated catch block
  1859. e.printStackTrace();
  1860. }
  1861. cro.setV_errCode(0);
  1862. SqlSession.close();
  1863. return cro;
  1864. }
  1865. /**
  1866. * 导出中厚板
  1867. * @param parmas
  1868. * @return
  1869. */
  1870. public CoreReturnObject ZHBQueryExcel(HashMap parmas) {
  1871. try{
  1872. if (!SqlJoint.IsNullOrSpace(parmas.get("STARTTIME").toString()) && !SqlJoint.IsNullOrSpace(parmas.get("ENDTIME").toString())) {
  1873. String sky=StrSky(parmas.get("STARTTIME").toString(),parmas.get("ENDTIME").toString());
  1874. if(sky.equals("FALSE")){
  1875. SqlSession.close();
  1876. cro.setV_errCode(-1);
  1877. cro.setV_errMsg("查询时间不能大于30天,请核实查询时间条件!");
  1878. return cro;
  1879. }
  1880. }
  1881. String sqlzh = "";
  1882. String timezh = "";
  1883. if(parmas.get("PLINE_NAME").equals("厚板线")){
  1884. sqlzh = " left join kch_turnofflist@xgcx st on t1.MATERIAL_NO = st.BILLETID ";
  1885. timezh = "to_char(st.INSTORAGETIME, 'yyyy-mm-dd hh24:mi:ss') 入库时间, st.RCL_STATE 库存热处理号,";
  1886. }else if(parmas.get("PLINE_NAME").equals("中板线")){
  1887. sqlzh = " left join kcz_turnofflist@xgcx st on t1.MATERIAL_NO = st.BILLETID ";
  1888. timezh = "to_char(st.INTIME, 'yyyy-mm-dd hh24:mi:ss') 入库时间, st.RCL_STATE 库存热处理号,";
  1889. }
  1890. String sql = "select "
  1891. +timezh
  1892. + " t1.PROCESS_NOS 委托热处理号,"
  1893. +" t1.IMPROVE_MEMO 性能改善标志,"
  1894. +" t1.HEAT_NO 炉号, "
  1895. +" t1.BATCH_NO 轧批号, "
  1896. +" t1.BOARD_NO 母板号, "
  1897. + " t1.SMP_NO 试样号, "
  1898. +" ord.DESIGN_KEY 订单号, "
  1899. +" ord.STEEL_NAME 牌号, "
  1900. +" to_char(ord.THICK, 'fm990.099') 厚度, "
  1901. +" t1.MATERIAL_NO 取样材料号, "
  1902. +" case when t1.phy_item is not null then "
  1903. +" t1.phy_item else "
  1904. +" dbms_lob.substr((select wmsys.wm_concat(DISTINCT PHY_NAME_S) "
  1905. +" from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  1906. +" WHERE SPECIMEN_NO = t1.SPECIMEN_NO "
  1907. +" and fy_quote_specimen_no is null)) "
  1908. +" end 检验项目, "
  1909. +" t1.FREQ_NAME 取样频次, "
  1910. +" case "
  1911. +" when t1.SMP_TYPE_CODE = '0' then "
  1912. +" case "
  1913. +" when t2.CERT_INST_CODE in "
  1914. +" ('IC003', 'IC004', 'IC001', 'IC010', '5000') then "
  1915. +" t1.SMP_TYPE_NAME "
  1916. +" else "
  1917. +" '认证样' "
  1918. +" end "
  1919. +" else "
  1920. +" t1.SMP_TYPE_NAME "
  1921. +" end 取样类型, "
  1922. +" t1.SMP_LOCATION 取样位置, "
  1923. +" t1.SPECIMEN_NO 取样编号, "
  1924. +" t1.QUOTE_CONSIGN_NO 引用取样编号, "
  1925. + " t1.ZHB_SPECIMEN_NO 合并取样编号,"
  1926. +" decode(t1.STATUS,'1','已引用','2','已接收','3','已完成','7','确认接收样') 状态, "
  1927. +" t2.CERT_INST_NAME 认证机构, "
  1928. +" ord.DELIVERY_STATE_DESC 交货状态, "
  1929. +" ord.PROD_NAME 产品名称, "
  1930. +" ord.STD_NAME 执行标准, "
  1931. +" t2.psc 产品规范代码, "
  1932. +" t2.psc_desc 产品规范描述, "
  1933. +" ord.WIDTH 宽, "
  1934. +" st.length 长, "
  1935. +" t1.INSPECTION_LOT 检验号, "
  1936. +" t1.PLINE_NAME 产线, "
  1937. +" t1.SEND_MEMO 发送备注, "
  1938. +" t1.CONSIGN_NO 委托编号, "
  1939. +" t1.CONSIGN_NO_SEQ 委托编号序号, "
  1940. +" t1.TEST_QTY 试验次数, "
  1941. +" t1.SMP_QTY 取样数量, "
  1942. +" t2.SMP_TYPE_NAME 试样类型, "
  1943. +" t2.smp_catg 试样类别, "
  1944. +" t1.memo 订单备注, "
  1945. + " t1.SAMPLE_DELIVERY_TIME 送样时间点,"
  1946. + " to_char(t1.COLLECT_TIME, 'yyyy-mm-dd hh24:mi:ss') LIMS接收时间,"
  1947. +" t1.SEND_NAME 发送人, "
  1948. +" to_char(t1.SEND_TIME, 'yyyy-mm-dd hh24:mi:ss') 发送时间, "
  1949. +" to_char(t1.CREATE_TIME, 'yyyy-mm-dd hh24:mi:ss') 创建时间,"
  1950. + " t1.rz_mixroll 组批区间,to_char(t1.STOVE_TIME, 'yyyy-mm-dd hh24:mi:ss') 加热炉出炉时间,"
  1951. + " decode(t1.SHOULD_SAMPLE,'1','N','0','Y','2','Y(抽样)') 是否预测抽样,"
  1952. + " decode(t1.FUNCTION_FUHE,'1','合格','0','不合格') 预测性能,"
  1953. + " decode(t1.CRAFT_EXECUTE,'1','符合','0','不符合') 工艺是否符合,"
  1954. + " decode(t1.CHEM_INTERNALCONTROL,'1','符合','0','不符合') 成分是否符合"
  1955. +" from QCM_JHY_SAMPLE_CONSIGN_D t1 "
  1956. +" left join QCM_JHY_SAMPLE_CONSIGN_M t2 "
  1957. +" on t1.SMP_NO = t2.SMP_NO "
  1958. +" left join QCM_JHY_SAMPLE_R_ORD ord "
  1959. +" on t1.smp_no = ord.smp_no ";
  1960. sql += sqlzh
  1961. +" where 1 = 1 ";
  1962. if (parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  1963. && parmas.get("BATCH_NO2")!=null && !"".equals(((String)parmas.get("BATCH_NO2")).trim()) ) {
  1964. sql +=" and upper(t1.batch_no) >= upper('"+parmas.get("BATCH_NO")+"')";
  1965. sql +=" and upper(t1.batch_no) <= upper('"+parmas.get("BATCH_NO2")+"')";
  1966. }else if(parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  1967. && parmas.get("checkboxVal").equals("1")){
  1968. sql +=" and t1.batch_no like '"+parmas.get("BATCH_NO")+"%' ";
  1969. }
  1970. if (parmas.get("CERT_INST_NAME")!=null && !"".equals(((String)parmas.get("CERT_INST_NAME")).trim())) {
  1971. sql +=" and t2.cert_inst_name like '"+parmas.get("CERT_INST_NAME")+"%'";
  1972. }
  1973. if (parmas.get("STEEL_NAME")!=null && !"".equals(((String)parmas.get("STEEL_NAME")).trim())) {
  1974. sql +=" and ord.steel_name like '"+parmas.get("STEEL_NAME")+"%'";
  1975. }
  1976. if (parmas.get("SMP_CATG")!=null && !"".equals(((String)parmas.get("SMP_CATG")).trim())) {
  1977. sql +=" and t2.smp_catg = '"+parmas.get("SMP_CATG")+"'";
  1978. }
  1979. if (parmas.get("VALIDFLAG")!=null && !"".equals(((String)parmas.get("VALIDFLAG")).trim())) {
  1980. sql +=" and t1.validflag='"+parmas.get("VALIDFLAG")+"'";
  1981. }
  1982. if (parmas.get("STATUS")!=null && !"".equals(((String)parmas.get("STATUS")).trim())) {
  1983. sql +=" and t1.STATUS='"+parmas.get("STATUS")+"' and t1.STATUS <> '6' ";
  1984. }else{
  1985. sql +=" and t1.STATUS not in ('0','5','6') ";
  1986. }
  1987. if(parmas.get("DESIGN_KEY")!=null && !"".equals(((String)parmas.get("DESIGN_KEY")).trim())){
  1988. sql +=" and ord.DESIGN_KEY like '"+parmas.get("DESIGN_KEY")+"%'";
  1989. }
  1990. if(parmas.get("CHECKBOKTXTL").equals("T")){
  1991. sql+=" and t1.ZHB_SPECIMEN_NO is not null ";
  1992. }
  1993. if(parmas.get("TAB_NAME")!=null && !"".equals(((String)parmas.get("TAB_NAME")).trim())){
  1994. //发送时间
  1995. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  1996. sql +=" and t1.send_time>=to_date('"+parmas.get("STARTTIME")+" 00:00:00','yyyy-MM-dd HH24:mi:ss')";
  1997. }
  1998. if (parmas.get("ENDTIME")!=null && !"".equals(((String)parmas.get("ENDTIME")).trim())) {
  1999. sql +=" and t1.send_time<=to_date('"+parmas.get("ENDTIME")+" 23:59:59','yyyy-MM-dd HH24:mi:ss') ";
  2000. }
  2001. }else{
  2002. //创建时间
  2003. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  2004. sql +=" and t1.CREATE_TIME>=to_date('"+parmas.get("STARTTIME")+" 00:00:00','yyyy-MM-dd HH24:mi:ss')";
  2005. }
  2006. if (parmas.get("ENDTIME")!=null && !"".equals(((String)parmas.get("ENDTIME")).trim())) {
  2007. sql +=" and t1.CREATE_TIME<=to_date('"+parmas.get("ENDTIME")+" 23:59:59','yyyy-MM-dd HH24:mi:ss') ";
  2008. }
  2009. }
  2010. if(parmas.get("PLINE_NAME").equals("厚板线")){
  2011. sql +=" and t1.BATCH_NO like 'H%' and t1.PLINE_CODE = 'HB1' ";
  2012. }else if(parmas.get("PLINE_NAME").equals("中板线")){
  2013. sql +=" and t1.BATCH_NO like 'Z%' and t1.PLINE_CODE = 'ZB1' ";
  2014. }
  2015. if (parmas.get("HEAT_NO")!=null && !"".equals(((String)parmas.get("HEAT_NO")).trim())) {
  2016. sql +=" and t1.HEAT_NO like '"+parmas.get("HEAT_NO")+"%'";
  2017. }
  2018. if (parmas.get("SAMPLE_DELIVERY_TIME")!=null && !"".equals(((String)parmas.get("SAMPLE_DELIVERY_TIME")).trim())) {
  2019. sql +=" and t1.SAMPLE_DELIVERY_TIME = '"+parmas.get("SAMPLE_DELIVERY_TIME")+"'";
  2020. }
  2021. if(parmas.get("TAB_NAME")!=null && !"".equals(((String)parmas.get("TAB_NAME")).trim())){
  2022. sql +=" order by t1.send_time desc,t1.BATCH_NO desc";
  2023. }else{
  2024. sql +=" order by t1.CREATE_TIME desc,t1.BATCH_NO desc ";
  2025. }
  2026. List<HashMap> listEle= mapper.query(sql.toString());
  2027. cro.setResult(listEle);
  2028. }catch(Exception ex){
  2029. cro.setV_errCode(-1);
  2030. cro.setV_errMsg("导出失败"+ex.getMessage());
  2031. SqlSession.rollback();
  2032. }
  2033. SqlSession.close();
  2034. return cro;
  2035. }
  2036. /**
  2037. * 中板线 查询是否有复样这个轧批号
  2038. * @param parmas
  2039. * @return
  2040. */
  2041. public CoreReturnObject getDuplicateSample(String BATCH_NO,String PLINE_CODE,String INSPECTION_LOT) {
  2042. try{
  2043. //and t.INSPECTION_LOT = '"+INSPECTION_LOT+"' 初样引用复样 降级
  2044. String sql= "select count(1) count from qcm_jhy_sample_consign_d t "
  2045. + " where t.batch_no = '"+BATCH_NO+"' and t.pline_code = '"+PLINE_CODE+"' "
  2046. + " and t.freq_code <> 'D' and t.smp_type_code = '1' ";
  2047. List<HashMap> listEle= mapper.query(sql.toString());
  2048. cro.setResult(listEle);
  2049. }catch(Exception ex){
  2050. cro.setV_errCode(-1);
  2051. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  2052. SqlSession.rollback();
  2053. }
  2054. SqlSession.close();
  2055. return cro;
  2056. }
  2057. /**
  2058. * 查询材质试样信息(优特钢)
  2059. * @param parmas
  2060. * @return
  2061. */
  2062. public CoreReturnObject getQltySampleInfoYT(HashMap parmas) {
  2063. try{
  2064. if (!SqlJoint.IsNullOrSpace(parmas.get("STARTTIME").toString()) && !SqlJoint.IsNullOrSpace(parmas.get("ENDTIME").toString())) {
  2065. String sky=StrSky(parmas.get("STARTTIME").toString(),parmas.get("ENDTIME").toString());
  2066. if(sky.equals("FALSE")){
  2067. SqlSession.close();
  2068. cro.setV_errCode(-1);
  2069. cro.setV_errMsg("查询时间不能大于30天,请核实查询时间条件!");
  2070. return cro;
  2071. }
  2072. }
  2073. String sql = "select t1.SMP_NO, "
  2074. +" t1.SPECIMEN_NO, "
  2075. +" t1.HEAT_NO, "
  2076. +" t1.BATCH_NO, "
  2077. +" t1.INSPECTION_LOT, "
  2078. +" t1.FREQ_CODE, "
  2079. +" t1.FREQ_NAME, "
  2080. +" t1.MATERIAL_NO, "
  2081. +" t1.SEND_MEMO, "
  2082. +" t1.SMP_TYPE_CODE, "
  2083. +" case "
  2084. +" when t1.SMP_TYPE_CODE = '0' then "
  2085. +" case "
  2086. +" when t2.CERT_INST_CODE in "
  2087. +" ('IC003', 'IC004', 'IC001', 'IC010', '5000') then "
  2088. +" t1.SMP_TYPE_NAME "
  2089. +" else "
  2090. +" '认证样' "
  2091. +" end "
  2092. +" else "
  2093. +" t1.SMP_TYPE_NAME "
  2094. +" end SMP_TYPE_NAME, "
  2095. +" t1.CONSIGN_NO, "
  2096. +" t1.CONSIGN_NO_SEQ, "
  2097. +" t1.TEST_QTY, "
  2098. +" t1.SMP_QTY, "
  2099. +" t1.SMP_LOCATION, "
  2100. +" t1.BOARD_NO, "
  2101. +" t1.QUOTE_CONSIGN_NO, "
  2102. +" t1.OLD_CONSIGN_NO, "
  2103. +" t1.PLINE_CODE, "
  2104. +" t1.PLINE_NAME, "
  2105. +" t1.STATUS, "
  2106. +" t1.SEND_NAME, "
  2107. +" to_char(t1.SEND_TIME, 'yyyy-mm-dd hh24:mi:ss') SEND_TIME, "
  2108. +" t1.memo, "
  2109. +" t2.SMP_TYPE_CODE as SMP_TYPE_CODE1, "
  2110. +" t2.SMP_TYPE_NAME as SMP_TYPE_NAME1, "
  2111. +" t2.CERT_INST_CODE, "
  2112. +" t2.CREATE_NAME, "
  2113. +" to_char(t1.CREATE_TIME, 'yyyy-mm-dd hh24:mi:ss') CREATE_TIME, "
  2114. +" t2.smp_catg as smp_catg, "
  2115. +" t2.CERT_INST_NAME, "
  2116. +" t2.psc, "
  2117. +" t2.psc_desc, "
  2118. +" case when t1.phy_item is not null then "
  2119. +" t1.phy_item else "
  2120. +" dbms_lob.substr((select wmsys.wm_concat(DISTINCT PHY_NAME_S) "
  2121. +" from QCM_JHY_SAMPLE_CONSIGN_D_ITEM "
  2122. +" WHERE SPECIMEN_NO = t1.SPECIMEN_NO "
  2123. +" and fy_quote_specimen_no is null)) "
  2124. +" end PHY_NAME_L_BJ, "
  2125. +" ord.DESIGN_KEY, "
  2126. +" to_char(ord.THICK, 'fm990.099') THICK, "
  2127. +" ord.WIDTH, "
  2128. +" ord.length , "
  2129. +" ord.DELIVERY_STATE_CODE, "
  2130. +" ord.DELIVERY_STATE_DESC, "
  2131. +" ord.PROD_NAME, "
  2132. +" ord.STEEL_NAME, "
  2133. +" ord.STD_NAME, "
  2134. +" t1.ITEM_FLAG,to_char(t1.COLLECT_TIME, 'yyyy-mm-dd hh24:mi:ss') COLLECT_TIME,"
  2135. + " t1.PRINT_LOG,t1.PROCESS_CODE "
  2136. +" from QCM_JHY_SAMPLE_CONSIGN_D t1 "
  2137. +" left join QCM_JHY_SAMPLE_CONSIGN_M t2 "
  2138. +" on t1.SMP_NO = t2.SMP_NO "
  2139. +" left join QCM_JHY_SAMPLE_R_ORD ord "
  2140. +" on t1.smp_no = ord.smp_no "
  2141. +" where 1 = 1 and t1.PLINE_CODE = 'YT1' ";
  2142. if(parmas.get("MATERIAL_NO")!=null && !"".equals(((String)parmas.get("MATERIAL_NO")).trim())
  2143. && parmas.get("checkboxVal").equals("1")){
  2144. sql +=" and t1.MATERIAL_NO like '"+parmas.get("MATERIAL_NO")+"%' ";
  2145. }
  2146. if (parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())
  2147. && parmas.get("BATCH_NO2")!=null && !"".equals(((String)parmas.get("BATCH_NO2")).trim()) ) {
  2148. sql +=" and upper(t1.batch_no) >= upper('"+parmas.get("BATCH_NO")+"')";
  2149. sql +=" and upper(t1.batch_no) <= upper('"+parmas.get("BATCH_NO2")+"')";
  2150. }else if(parmas.get("BATCH_NO")!=null && !"".equals(((String)parmas.get("BATCH_NO")).trim())){
  2151. sql +=" and t1.batch_no like '"+parmas.get("BATCH_NO")+"%' ";
  2152. }
  2153. if (parmas.get("CERT_INST_NAME")!=null && !"".equals(((String)parmas.get("CERT_INST_NAME")).trim())) {
  2154. sql +=" and t2.cert_inst_name like '"+parmas.get("CERT_INST_NAME")+"%'";
  2155. }
  2156. if (parmas.get("SMP_CATG")!=null && !"".equals(((String)parmas.get("SMP_CATG")).trim())) {
  2157. sql +=" and t2.smp_catg = '"+parmas.get("SMP_CATG")+"'";
  2158. }
  2159. if (parmas.get("VALIDFLAG")!=null && !"".equals(((String)parmas.get("VALIDFLAG")).trim())) {
  2160. sql +=" and t1.validflag='"+parmas.get("VALIDFLAG")+"'";
  2161. }
  2162. if (parmas.get("STATUS")!=null && !"".equals(((String)parmas.get("STATUS")).trim())) {
  2163. sql +=" and t1.STATUS='"+parmas.get("STATUS")+"' and t1.STATUS <> '6' ";
  2164. }else{
  2165. sql +=" and t1.STATUS not in ('0','5','6') ";
  2166. }
  2167. if(parmas.get("DESIGN_KEY")!=null && !"".equals(((String)parmas.get("DESIGN_KEY")).trim())){
  2168. sql +=" and ord.DESIGN_KEY like '"+parmas.get("DESIGN_KEY")+"%'";
  2169. }
  2170. if(parmas.get("TAB_NAME")!=null && !"".equals(((String)parmas.get("TAB_NAME")).trim())){
  2171. //发送时间
  2172. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  2173. sql +=" and t1.send_time>=to_date('"+parmas.get("STARTTIME")+" 00:00:00','yyyy-MM-dd HH24:mi:ss')";
  2174. }
  2175. if (parmas.get("ENDTIME")!=null && !"".equals(((String)parmas.get("ENDTIME")).trim())) {
  2176. sql +=" and t1.send_time<=to_date('"+parmas.get("ENDTIME")+" 23:59:59','yyyy-MM-dd HH24:mi:ss') ";
  2177. }
  2178. }else{
  2179. //创建时间
  2180. if (parmas.get("STARTTIME")!=null && !"".equals(((String)parmas.get("STARTTIME")).trim())) {
  2181. sql +=" and t1.CREATE_TIME>=to_date('"+parmas.get("STARTTIME")+" 00:00:00','yyyy-MM-dd HH24:mi:ss')";
  2182. }
  2183. if (parmas.get("ENDTIME")!=null && !"".equals(((String)parmas.get("ENDTIME")).trim())) {
  2184. sql +=" and t1.CREATE_TIME<=to_date('"+parmas.get("ENDTIME")+" 23:59:59','yyyy-MM-dd HH24:mi:ss') ";
  2185. }
  2186. }
  2187. if (parmas.get("HEAT_NO")!=null && !"".equals(((String)parmas.get("HEAT_NO")).trim())) {
  2188. sql +=" and t1.HEAT_NO like '"+parmas.get("HEAT_NO")+"%'";
  2189. }
  2190. if (parmas.get("SAMPLE_DELIVERY_TIME")!=null && !"".equals(((String)parmas.get("SAMPLE_DELIVERY_TIME")).trim())) {
  2191. sql +=" and t1.SAMPLE_DELIVERY_TIME = '"+parmas.get("SAMPLE_DELIVERY_TIME")+"'";
  2192. }
  2193. if(parmas.get("TAB_NAME")!=null && !"".equals(((String)parmas.get("TAB_NAME")).trim())){
  2194. sql +=" order by t1.send_time desc,t1.BATCH_NO desc";
  2195. }else{
  2196. sql +=" order by t1.CREATE_TIME desc,t1.BATCH_NO desc ";
  2197. }
  2198. List<HashMap> listEle= mapper.query(sql.toString());
  2199. cro.setResult(listEle);
  2200. }catch(Exception ex){
  2201. cro.setV_errCode(-1);
  2202. cro.setV_errMsg("获取委托出错"+ex.getMessage());
  2203. SqlSession.rollback();
  2204. }
  2205. SqlSession.close();
  2206. return cro;
  2207. }
  2208. /**
  2209. * 人工委托 优特钢
  2210. * @param parmas
  2211. * @return
  2212. */
  2213. public CoreReturnObject getTurnofFlistYT(String DesignKey,String COILNO,String BatchNo) {
  2214. try{
  2215. if(StringUtils.isBlank(BatchNo) && StringUtils.isBlank(DesignKey) && StringUtils.isBlank(COILNO)){
  2216. cro.setV_errCode(-1);
  2217. cro.setV_errMsg("轧批号不能为空!!!");
  2218. SqlSession.rollback();
  2219. return cro;
  2220. }
  2221. String sql =" select '' INSPECTION_LOT, "
  2222. +" substr(t.ORDERNO,0,LENGTH(t.ORDERNO)-3) DESIGN_KEY,"
  2223. +" '' PSC, "
  2224. +" t.HEATNO HEAT_NO, "
  2225. +" t.BATCHNO BATCH_NO, "
  2226. +" substr(t.COILNO,0,length(t.COILNO)-2) BOARD_NO, "
  2227. +" cbs.STEEL_CODE GRADE_CODE, "
  2228. +" cbs.STEEL_NAME GRADE_NAME, "
  2229. +" t.COILNO MATERIAL_NO, "
  2230. +" '' MSC_PLINE, "
  2231. +" 'YT1' PLINE_CODE, "
  2232. +" '优特钢' PLINE_NAME, "
  2233. +" t.DELIVERY_STATE_CODE, "
  2234. +" t.DELIVERY_STATE_DESC, "
  2235. +" t.MACHINE_NAME PROCESS_CODE, "
  2236. +" t.THICK, "
  2237. +" t.WIDTH, "
  2238. +" t.LENGTH, "
  2239. +" '1' IS_QTLY, "
  2240. +" (select CASE "
  2241. +" WHEN COUNT(1) > 0 THEN "
  2242. +" '1' "
  2243. +" ELSE "
  2244. +" '0' "
  2245. +" END "
  2246. +" from QCM_ORD_DESIGN_STD_CIC "
  2247. +" where design_key = T.ORDERNO "
  2248. +" and std_type_code = 'C') IS_CHEM, "
  2249. +" '0' TYPE, "
  2250. +" '' MEMO "
  2251. +" from YDM_PRODUCT_DETAIL@LINK_YTG t "
  2252. +" left join COM_BASE_STEEL@LINK_YTG cbs "
  2253. +" on t.STEELCODE = cbs.STEEL_CODE "
  2254. +" where 1=1 AND t.ORDERNO IS NOT NULL ";
  2255. if(DesignKey != null && !DesignKey.equals("")){
  2256. sql += " and t.ORDERNO like '"+DesignKey+"%'";//销售订单号
  2257. }
  2258. if(COILNO != null && !COILNO.equals("")){
  2259. sql += " and t.COILNO like '"+COILNO+"%'";//子板号
  2260. }
  2261. if(BatchNo != null && !BatchNo.equals("")){
  2262. sql += " and t.BATCHNO like '"+BatchNo+"%'";//轧批号
  2263. }
  2264. sql +=" order by t.COILNO desc";
  2265. StringBuffer sqlucomm = new StringBuffer();
  2266. sqlucomm.append(sql);
  2267. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  2268. cro.setResult(listEle);
  2269. }catch(Exception ex){
  2270. cro.setV_errCode(-1);
  2271. cro.setV_errMsg("获取厚板线数据出错"+ex.getMessage());
  2272. SqlSession.rollback();
  2273. }
  2274. SqlSession.close();
  2275. return cro;
  2276. }
  2277. /**
  2278. * 查询人工选样(热轧)
  2279. * @param parmas
  2280. * @return
  2281. */
  2282. public CoreReturnObject getQltyRZSpecimenNo(String specimenNo,String plineCode,String thick) {
  2283. try{
  2284. String[] ja=specimenNo.split(",");
  2285. String msInfo="";
  2286. if (ja!=null && ja.length>0) {
  2287. for (int i = 0; i < ja.length; i++) {
  2288. String sp = ja[i];
  2289. if ("".equals(msInfo)) {
  2290. msInfo="'"+sp+"'";
  2291. }else{
  2292. msInfo=msInfo+"'"+sp+"'";
  2293. }
  2294. if (i !=ja.length-1) {
  2295. msInfo=msInfo+",";
  2296. }
  2297. }
  2298. }
  2299. String sql = "select t3.OLD_SAMPL_NO,t1.BATCH_NO,t1.SPECIMEN_NO,t1.SMP_TYPE_CODE,r.THICK,r.HEAT_NO "
  2300. +" from tbh02_coil_comm t3, "
  2301. +" QCM_JHY_SAMPLE_CONSIGN_D t1, "
  2302. +" qcm_jhy_sample_r_ord r "
  2303. +" where t3.SAMPL_NO = t1.inspection_lot "
  2304. +" and t1.smp_no = r.smp_no "
  2305. +" and t3.SAMPL_NO = r.inspection_lot "
  2306. +" and t1.inspection_lot = r.inspection_lot "
  2307. +" and T3.OLD_SAMPL_NO is not null "
  2308. +" and t1.specimen_no in ("+msInfo+") "
  2309. +" and to_char(r.thick, 'fm990.099') = to_char('"+thick+"', 'fm990.099') "
  2310. +" and t1.pline_code = 'RZ1' "
  2311. +" and t1.STATUS='0' "
  2312. +" and nvl(T3.MISSNO_CLF_CD, 'null') != 'C' "
  2313. +" order by t3.OLD_SAMPL_NO asc ";
  2314. List<HashMap> listEle= mapper.query(sql.toString());
  2315. cro.setResult(listEle);
  2316. }catch(Exception ex){
  2317. cro.setV_errCode(-1);
  2318. cro.setV_errMsg("获取出错"+ex.getMessage());
  2319. SqlSession.rollback();
  2320. }
  2321. SqlSession.close();
  2322. return cro;
  2323. }
  2324. /**
  2325. * 查询人工选样(热轧)限制提示
  2326. * @param parmas
  2327. * @return
  2328. */
  2329. public CoreReturnObject getQltyRZHeatNo(String specimenNo) {
  2330. try{
  2331. TreeSet<String> treeSet = new TreeSet<String>();
  2332. TreeSet<String> treeSet1 = new TreeSet<String>();
  2333. String[] ja=specimenNo.split(",");
  2334. String msInfo="";
  2335. if (ja!=null && ja.length>0) {
  2336. for (int i = 0; i < ja.length; i++) {
  2337. String sp = ja[i];
  2338. // String jsno2= sp.substring(sp.length()-2);//截取后两位 测试
  2339. if ("".equals(msInfo)) {
  2340. msInfo="'"+sp+"'";
  2341. }else{
  2342. msInfo=msInfo+"'"+sp+"'";
  2343. }
  2344. if (i !=ja.length-1) {
  2345. msInfo=msInfo+",";
  2346. }
  2347. }
  2348. }
  2349. String sql = " select r.design_key,r.steel_code,t.* from qcm_jhy_sample_consign_d t,qcm_jhy_sample_r_ord r "
  2350. + " where t.smp_no = r.smp_no and t.specimen_no in ("+msInfo+") ";
  2351. List<HashMap> listEle= mapper.query(sql.toString());
  2352. if(listEle==null || listEle.size()<=0){
  2353. cro.setV_errCode(-1);
  2354. cro.setV_errMsg("未找到相应数据!");
  2355. return cro;
  2356. }
  2357. String sqlitme="select t.THICK,t.specimen_no,t.batch_no,t.n from (select To_Number(r.THICK) THICK,d.specimen_no,d.batch_no, "
  2358. +" (select count(1) from qcm_jhy_sample_consign_d_item i where i.specimen_no = d.specimen_no and i.seq < 50) n "
  2359. +" from qcm_jhy_sample_consign_d d, qcm_jhy_sample_r_ord r where d.smp_no = r.smp_no and d.specimen_no in ("+msInfo+") order by r.thick desc "
  2360. +" ) t order by t.THICK desc,t.n desc ";
  2361. List<HashMap> hmitme= mapper.query(sqlitme.toString());
  2362. if(hmitme!=null && hmitme.size()>=1){
  2363. //获取最大的规格数据
  2364. String batch_no= hmitme.get(0).get("BATCH_NO").toString();
  2365. String THICK= hmitme.get(0).get("THICK").toString();
  2366. int nmu= Integer.parseInt(hmitme.get(0).get("N").toString());
  2367. for (int i = 0; i < hmitme.size(); i++) {
  2368. HashMap obj=hmitme.get(i);
  2369. String batch_no2= obj.get("BATCH_NO").toString();
  2370. String THICK2= obj.get("THICK").toString();
  2371. int nmu2= Integer.parseInt(obj.get("N").toString());
  2372. if(nmu2 > nmu){
  2373. String memo="选样中最大规格轧批号["+batch_no+"]["+THICK+"]有"+nmu+"个检验项,轧批号["+batch_no2+"]["+THICK2+"]有"+nmu2+"个检验项,请核实选样委托!";
  2374. cro.setV_errCode(-1);
  2375. cro.setV_errMsg(memo);
  2376. return cro;
  2377. }
  2378. }
  2379. }
  2380. for (int i = 0; i < listEle.size(); i++) {
  2381. HashMap obj=listEle.get(i);
  2382. String SPECIMEN_NO=obj.get("SPECIMEN_NO").toString();
  2383. String heatNo=obj.get("HEAT_NO").toString();
  2384. heatNo = heatNo.substring(0, heatNo.length()-1);
  2385. treeSet.add(heatNo);
  2386. treeSet1.add((String)obj.get("SMP_TYPE_CODE"));
  2387. if("3".equals((String)obj.get("SMP_TYPE_CODE"))){
  2388. cro.setV_errCode(-1);
  2389. cro.setV_errMsg("件件取样不能用人工选样按钮!");
  2390. return cro;
  2391. }
  2392. UpdateInfo uinfo= new UpdateInfo();
  2393. uinfo.doPhyItem(SPECIMEN_NO);
  2394. //拿到牌号去查当前牌号是否可以人工选样
  2395. String steelCode=obj.get("STEEL_CODE").toString();
  2396. String sqlCode="select t.* from QCM_JHY_STEEL t where t.regulation = 'RZ1' and t.yn_log = '1' and t.steel_name = '"+steelCode+"' ";
  2397. List<HashMap> listCode= mapper.query(sqlCode.toString());
  2398. if(listCode==null || listCode.size()<=0){
  2399. String batchNo=obj.get("BATCH_NO").toString();
  2400. cro.setV_errCode(-1);
  2401. cro.setV_errMsg("轧批号:"+batchNo+",牌号:"+steelCode+",不能用人工选样发送按钮,优钢组批钢种并不包含这个牌号!请核实牌号数据!");
  2402. return cro;
  2403. }
  2404. }
  2405. if(treeSet.size()>=2){
  2406. cro.setV_errCode(-1);
  2407. cro.setV_errMsg("只能同炉号选样!");
  2408. return cro;
  2409. }
  2410. if(treeSet1.size()>=2){
  2411. cro.setV_errCode(-1);
  2412. cro.setV_errMsg("只能勾选同一取样类型!");
  2413. return cro;
  2414. }
  2415. cro.setV_errCode(0);
  2416. }catch(Exception ex){
  2417. cro.setV_errCode(-1);
  2418. cro.setV_errMsg("获取出错"+ex.getMessage());
  2419. SqlSession.rollback();
  2420. }finally {
  2421. SqlSession.close();
  2422. }
  2423. return cro;
  2424. }
  2425. }