2f4aee4cd1f6122bb5deba23a05511bf2312f59a.svn-base 81 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957
  1. package QCM.JHY01.JHY0103;
  2. import java.sql.ResultSet;
  3. import java.sql.ResultSetMetaData;
  4. import java.sql.SQLException;
  5. import java.text.SimpleDateFormat;
  6. import java.util.Date;
  7. import java.util.HashMap;
  8. import java.util.List;
  9. import org.apache.commons.lang.StringUtils;
  10. import org.apache.ibatis.session.SqlSession;
  11. import com.alibaba.fastjson.JSONArray;
  12. import com.alibaba.fastjson.JSONException;
  13. import com.alibaba.fastjson.JSONObject;
  14. import CoreFS.SA01.CoreIComponent;
  15. import CoreFS.SA06.CoreReturnObject;
  16. /**
  17. * 查询第三方认证申报信息
  18. * @author freedom
  19. *
  20. */
  21. public class QuerryThirdInfo extends CoreIComponent{
  22. CoreReturnObject cro = new CoreReturnObject();
  23. SqlSession SqlSession = QCM.COMMUNAL.SqlSessionBuilder.openSqlSession();
  24. QCM.COMMUNAL.OrderSqMapper mapper = SqlSession.getMapper(QCM.COMMUNAL.OrderSqMapper.class);
  25. public String StrSky(String begintime,String endtime){
  26. String sql = "select (to_date('"+endtime+"','yyyy-MM-dd') - to_date('"+begintime+"','yyyy-MM-dd')) SKY from dual";
  27. HashMap list = mapper.queryOne(sql);
  28. Double ble = Double.parseDouble(list.get("SKY").toString());
  29. String tstr="FALSE";
  30. if(ble>=0 && ble <=183 ){//半年182.5
  31. tstr="TRUE";
  32. }
  33. return tstr;
  34. }
  35. /**
  36. * 查询发起的第三方申报记录(按轧批)
  37. * @param strDate
  38. * @param endDate
  39. * @param orgName
  40. * @param batch
  41. * @param design_key
  42. * @return
  43. */
  44. public CoreReturnObject QueryBatchNo(String strDate,String endDate,String orgName,String batch,String shordh) {
  45. try {
  46. if (StringUtils.isNotBlank(strDate)&& StringUtils.isNotBlank(endDate)) {
  47. String sky=StrSky(strDate,endDate);
  48. if(sky.equals("FALSE")){
  49. SqlSession.close();
  50. cro.setV_errCode(-1);
  51. cro.setV_errMsg("查询时间不能大于半年,请核实查询时间条件!");
  52. return cro;
  53. }
  54. }
  55. String sql = "select max(m.Cert_No) 认证申报编号,\r\n" +
  56. " max(m.Cert_Inst_Code) 认证机构代码,\r\n" +
  57. " max(m.Cert_Inst_Name) 认证机构,\r\n" +
  58. " max(m.Cert_Status) 确认状态,\r\n" +
  59. " max(m.Apply_Org_No) 申请机构编码,\r\n" +
  60. " max(m.Apply_Org_Desc) 申请机构,\r\n" +
  61. " max(m.Dep_Type_Code) 部门级别,\r\n" +
  62. " max(m.Memo) 备注,\r\n" +
  63. " max(m.Create_Name) 申报人,\r\n" +
  64. " max(to_char(m.Create_Time, 'yyyy-MM-dd hh24:mi:ss')) 申报时间,\r\n" +
  65. " max(m.Send_Flag) 发送状态,\r\n" +
  66. " count(t.Material_No) Material_No,\r\n" +
  67. " max(t.DESIGN_KEY) DESIGN_KEY, \r\n" +
  68. " max(t.PSC) PSC,\r\n" +
  69. " max(t.PSC_DESC) PSC_DESC,\r\n" +
  70. " max(t.PROD_CODE)PROD_CODE,\r\n" +
  71. " max(t.PROD_NAME)PROD_NAME,\r\n" +
  72. " max(t.STEEL_CODE)STEEL_CODE,\r\n" +
  73. " max(t.STEEL_NAME)STEEL_NAME,\r\n" +
  74. " max(t.STD_CODE)STD_CODE,\r\n" +
  75. " max(t.STD_NAME)STD_NAME,\r\n" +
  76. " max(t.DELIVERY_STATE_CODE)DELIVERY_STATE_CODE,\r\n" +
  77. " max(t.DELIVERY_STATE_DESC)DELIVERY_STATE_DESC,\r\n" +
  78. " max(t.DELIVERY_DATE)DELIVERY_DATE,\r\n" +
  79. " max(t.CUT_TYPE)CUT_TYPE,\r\n" +
  80. " max(t.HEAT_NO)HEAT_NO,\r\n" +
  81. " t.BATCH_NO,\r\n" +
  82. " max(t.INSPECTION_LOT)INSPECTION_LOT,\r\n" +
  83. " max(t.BOARD_NO)BOARD_NO,\r\n" +
  84. " max(t.THICK)THICK,\r\n" +
  85. " max(t.WIDTH)WIDTH,\r\n" +
  86. " max(t.LENGTH)LENGTH,\r\n" +
  87. " sum(nvl(t.mat_weight2,t.MAT_WEIGHT))MAT_WEIGHT,\r\n" +
  88. " max(t.PLINE_CODE)PLINE_CODE,\r\n" +
  89. " max(t.VESSEL)VESSEL,\r\n" +
  90. " max(t.PLINE_NAME)PLINE_NAME,\r\n" +
  91. " max(APPROACH)APPROACH,\r\n" +
  92. " max(INCEPTCORPCODE)INCEPTCORPCODE,\r\n" +
  93. " max(BUYERCODE)BUYERCODE,\r\n" +
  94. " max(CONTRACT_NO)CONTRACT_NO,\r\n" +
  95. " max(decode((SELECT count(1)\r\n" +
  96. " from zj_result_all@xgcx z\r\n" +
  97. " where z.JUDGERESULT = '1' and z.BILLETID = T.Material_No), \r\n" +
  98. " '0',\r\n" +
  99. " '否',\r\n" +
  100. " '是')) PHYFSTSRESULT1,\r\n" +
  101. //" max((select Z.fst_judgeresult\r\n" +
  102. //" from ZJ_RESULT_ALL@XGCX z\r\n" +
  103. //" where Z.BILLETID = T.MATERIAL_NO)) PHYFSTSRESULT\r\n" +
  104. " '1' PHYFSTSRESULT \r\n" +
  105. " from QCM_MAT_CERT_D t\r\n" +
  106. " left join QCM_MAT_CERT_M m\r\n" +
  107. " on t.cert_no = m.cert_no\r\n" +
  108. "where 1=1 and t.VALIDFLAG is null ";
  109. if(!"".equals(orgName)){
  110. sql += " and m.CERT_INST_NAME like '"+orgName+"%' ";
  111. }
  112. if(!"".equals(batch)){
  113. sql +=" and t.BATCH_NO like '"+batch+"%' ";
  114. }
  115. if(!"".equals(shordh)){
  116. sql +=" and t.DESIGN_KEY like '"+shordh+"%' ";
  117. }
  118. if(!"".equals(strDate)){
  119. sql +=" and m.CREATE_TIME >= to_date('"+strDate+" 00:00:01','yyyy-mm-dd,hh24:mi:ss')" ;
  120. }
  121. if(!"".equals(endDate)){
  122. sql +=" and m.CREATE_TIME <= to_date('"+endDate+" 23:59:59','yyyy-mm-dd,hh24:mi:ss')";
  123. }
  124. sql += " group by t.BATCH_NO ";
  125. StringBuffer sqlucomm = new StringBuffer();
  126. sqlucomm.append(sql);
  127. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  128. cro.setResult(listEle);
  129. //cro.setResult(jsonArray);
  130. } catch(Exception ex){
  131. cro.setV_errCode(-1);
  132. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  133. SqlSession.rollback();
  134. }
  135. SqlSession.close();
  136. return cro;
  137. }
  138. /**
  139. * 查询发起的第三方申报记录
  140. * @param strDate
  141. * @param endDate
  142. * @param orgName
  143. * @param batch
  144. * @param design_key
  145. * @return
  146. */
  147. public CoreReturnObject QueryMainInfo(String strDate,String endDate,String orgName,String batch,String shordh) {
  148. StringBuffer sqlucomm = new StringBuffer();
  149. sqlucomm.append("select CERT_NO,CERT_INST_CODE,CERT_INST_NAME,CERT_STATUS,APPLY_ORG_NO,");
  150. sqlucomm.append("APPLY_ORG_DESC,DEP_TYPE_CODE,DUTY_ID,INSTANCE_ID,MEMO,CREATE_ID,CREATE_NAME,");
  151. sqlucomm.append(" SEND_FLAG,");
  152. sqlucomm.append("to_char(CREATE_TIME,'yyyy-MM-dd hh24:mi:ss') CREATE_TIME,UPDATE_ID,UPDATE_NAME,to_char(UPDATE_TIME,'yyyy-MM-dd hh24:mi:ss')UPDATE_TIME FROM QCM_MAT_CERT_M WHERE 1=1");
  153. if(!"".equals(orgName)){
  154. sqlucomm.append(" and CERT_INST_NAME like '%"+orgName+"%' ");
  155. }
  156. if(!"".equals(strDate)){
  157. sqlucomm.append(" and CREATE_TIME >= to_date('"+strDate+" 00:00:01','yyyy-mm-dd,hh24:mi:ss')");
  158. }
  159. if(!"".equals(endDate)){
  160. sqlucomm.append(" and CREATE_TIME <= to_date('"+endDate+" 23:59:59','yyyy-mm-dd,hh24:mi:ss')");
  161. }
  162. try {
  163. ResultSet results=this.getDao("testDao").ExceuteQueryForResultSet(sqlucomm.toString());
  164. JSONArray jsonArray=resultSetToJsonArry(results);
  165. cro.setResult(jsonArray);
  166. } catch (SQLException e) {
  167. // TODO Auto-generated catch block
  168. e.printStackTrace();
  169. }
  170. return cro;
  171. }
  172. //申报记录事件 查询发起的第三方申报子数据
  173. public CoreReturnObject QueryDetailInfo(String cert_no,String batch,String design_key) {
  174. StringBuffer sqlucomm = new StringBuffer();
  175. sqlucomm.append("select CERT_NO,MATERIAL_NO,DESIGN_KEY,PSC,PROD_CODE,");
  176. sqlucomm.append("PROD_NAME,STEEL_CODE,STEEL_NAME,STD_CODE,STD_NAME,to_char(to_date(DELIVERY_DATE,'yyyy-MM-dd hh24:mi:ss'),'yyyy-MM-dd') DELIVERY_DATE,CUT_TYPE,");
  177. sqlucomm.append("HEAT_NO,BATCH_NO,INSPECTION_LOT,BOARD_NO,THICK,WIDTH,LENGTH,MAT_WEIGHT,PLINE_CODE,PLINE_NAME FROM QCM_MAT_CERT_D WHERE 1=1 and VALIDFLAG is null ");
  178. if(!"".equals(cert_no)){
  179. sqlucomm.append(" and CERT_NO like '"+cert_no+"%' ");
  180. }
  181. if(!"".equals(batch)){
  182. sqlucomm.append(" and BATCH_NO like '"+batch+"%' ");
  183. }
  184. if(!"".equals(design_key)){
  185. sqlucomm.append(" and DESIGN_KEY like '"+design_key+"%' ");
  186. }
  187. try {
  188. ResultSet results=this.getDao("testDao").ExceuteQueryForResultSet(sqlucomm.toString());
  189. JSONArray jsonArray=resultSetToJsonArry(results);
  190. cro.setResult(jsonArray);
  191. } catch (SQLException e) {
  192. // TODO Auto-generated catch block
  193. e.printStackTrace();
  194. }
  195. return cro;
  196. }
  197. //申报记录 合并
  198. public CoreReturnObject QueryMainInfoHb(String strDate,String endDate,String cert_inst_name,String BATCH_NO,String design_key,String prod_namemome,String pline_name,String certNo) {
  199. try {
  200. if (StringUtils.isNotBlank(strDate)&& StringUtils.isNotBlank(endDate)) {
  201. String sky=StrSky(strDate,endDate);
  202. if(sky.equals("FALSE")){
  203. SqlSession.close();
  204. cro.setV_errCode(-1);
  205. cro.setV_errMsg("查询时间不能大于半年,请核实查询时间条件!");
  206. return cro;
  207. }
  208. }
  209. String sql="select m.Cert_No 认证申报编号, "
  210. +" m.Cert_Inst_Code 认证机构代码, "
  211. // +" m.Cert_Inst_Name 认证机构, "
  212. +" dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) from qcm_ord_design_std_pic p where p.design_key = t.design_key)) 认证机构,"
  213. +" m.Cert_Status 确认状态, "
  214. +" m.Apply_Org_No 申请机构编码, "
  215. +" m.Apply_Org_Desc 申请机构, "
  216. +" m.Dep_Type_Code 部门级别, "
  217. +" case t.PLINE_CODE "
  218. +" when '4001ZB1' then "
  219. +" decode((nvl((select ORDERNO "
  220. +" from kcz_turnofflist@xgcx z "
  221. +" where z.billetid = t.Material_No), "
  222. +" 'null')), "
  223. +" 'null', "
  224. +" '已脱单', "
  225. +" decode((select count(1) from kcz_turnofflist@xgcx z,sel_pactdetail_new@xgcx s where z.orderno=s.ORDERNO and z.billetid = t.Material_No ), "
  226. +" '0','已换老单' ,m.Memo)) "
  227. +" when '4001HB1' then "
  228. +" decode((nvl((select ALLOTORDERFORM "
  229. +" from kcH_turnofflist@xgcx h "
  230. +" where h.billetid = t.Material_No), "
  231. +" 'null')), "
  232. +" 'null', "
  233. +" '已脱单', "
  234. +" decode((select count(1) from kcH_turnofflist@xgcx h,sel_pactdetail_new@xgcx s where h.ALLOTORDERFORM=s.ORDERNO and h.billetid = t.Material_No ), "
  235. +" '0','已换老单' ,m.Memo)) "
  236. +" end 备注, "
  237. +" m.Create_Name 申报人, "
  238. +" to_char(m.Create_Time,'yyyy-MM-dd hh24:mi:ss') 申报时间, "
  239. +" m.Send_Flag 发送状态, "
  240. +" t.Material_No, "
  241. +" t.DESIGN_KEY, "
  242. +" t.PSC, "
  243. +" t.PSC_DESC, "
  244. +" t.PROD_CODE, "
  245. +" t.PROD_NAME, "
  246. +" t.STEEL_CODE, "
  247. +" t.STEEL_NAME, "
  248. +" t.STD_CODE, "
  249. +" t.STD_NAME, "
  250. +" t.DELIVERY_STATE_CODE, "
  251. +" t.DELIVERY_STATE_DESC, "
  252. +" t.DELIVERY_DATE, "
  253. +" t.CUT_TYPE, "
  254. +" t.HEAT_NO, "
  255. +" t.BATCH_NO, "
  256. +" t.INSPECTION_LOT, "
  257. +" t.BOARD_NO, "
  258. +" t.THICK, "
  259. +" t.WIDTH, "
  260. +" t.LENGTH, "
  261. +" nvl(t.mat_weight2,to_char(t.MAT_WEIGHT, 'fm990.099')) MAT_WEIGHT, "
  262. +" t.PLINE_CODE, "
  263. +" t.VESSEL, "
  264. +" t.PLINE_NAME,APPROACH,INCEPTCORPCODE,BUYERCODE,CONTRACT_NO, "
  265. //+" case when substr(t.DESIGN_KEY,0,2) = '19' then '非计划' else decode((SELECT count(1) from zj_result_all@xgcx z "
  266. // +" where z.JUDGERESULT = '1' and z.BILLETID = T.Material_No) ,'0','待判','船检合格') end PHYFSTSRESULT1, "
  267. +" case t.PLINE_CODE "
  268. +" when '4001ZB1' then "
  269. +" decode((nvl(substr((select ORDERNO from kcz_turnofflist@xgcx z where z.billetid = t.Material_No), 0, 2),'null')),'19','非计划', "
  270. +" decode((SELECT count(1) from zj_result_all@xgcx z where z.JUDGERESULT = '1' and z.BILLETID = T.Material_No), "
  271. +" '0', '待判','船检合格') ) "
  272. +" when '4001HB1' then "
  273. +" decode((nvl(substr((select ALLOTORDERFORM from kcH_turnofflist@xgcx h where h.billetid = T.Material_No), 0, 2),'null')),'19','非计划', "
  274. +" decode((SELECT count(1) from zj_result_all@xgcx z where z.JUDGERESULT = '1' and z.BILLETID = T.Material_No), "
  275. +" '0', '待判','船检合格') ) "
  276. +" end PHYFSTSRESULT1, "
  277. +" (select Z.fst_judgeresult from ZJ_RESULT_ALL@XGCX z where Z.BILLETID = T.MATERIAL_NO and rownum=1) PHYFSTSRESULT,"
  278. // +" '1' PHYFSTSRESULT, "
  279. +" (select to_char(Z.fst_judge_time,'yyyy-MM-dd hh24:mi:ss') from ZJ_RESULT_ALL@XGCX z where Z.BILLETID = T.MATERIAL_NO) 初检时间, "
  280. + " t.VALIDFLAG,t.JUDGERESULT_NAME,t.JUDGERESULT_MEMO "
  281. +" from QCM_MAT_CERT_D t "
  282. +" left join QCM_MAT_CERT_M m "
  283. +" on t.cert_no = m.cert_no "
  284. + " where 1=1 and (t.VALIDFLAG is null or t.VALIDFLAG = '1' ) ";
  285. if(!"".equals(cert_inst_name)){
  286. sql += " and m.CERT_INST_NAME like '%"+cert_inst_name+"%' ";
  287. }
  288. if(!"".equals(BATCH_NO)){
  289. sql +=" and t.BATCH_NO like '"+BATCH_NO+"%' ";
  290. }
  291. if(!"".equals(design_key)){
  292. sql +=" and t.DESIGN_KEY like '"+design_key+"%' ";
  293. }
  294. if(!"".equals(prod_namemome)){
  295. sql +=" and t.PSC_DESC like '"+prod_namemome+"%' ";
  296. }
  297. if(!"".equals(pline_name)){
  298. sql +=" and t.PLINE_NAME like '"+pline_name+"%' ";
  299. }
  300. if(!"".equals(certNo)){
  301. sql +=" and t.CERT_NO = '"+certNo+"' ";
  302. }
  303. if(!"".equals(strDate)){
  304. sql +=" and m.CREATE_TIME >= to_date('"+strDate+" 00:00:01','yyyy-mm-dd,hh24:mi:ss')" ;
  305. }
  306. if(!"".equals(endDate)){
  307. sql +=" and m.CREATE_TIME <= to_date('"+endDate+" 23:59:59','yyyy-mm-dd,hh24:mi:ss')";
  308. }
  309. sql +=" order by m.CREATE_TIME desc";
  310. StringBuffer sqlucomm = new StringBuffer();
  311. sqlucomm.append(sql);
  312. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  313. cro.setResult(listEle);
  314. }catch(Exception ex){
  315. cro.setV_errCode(-1);
  316. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  317. SqlSession.rollback();
  318. }
  319. SqlSession.close();
  320. return cro;
  321. }
  322. /**
  323. * 查询库存数据厚板线
  324. * @param strDate
  325. * @param endDate
  326. * @param orgName
  327. * @param batch
  328. * @param design_key
  329. * @return
  330. */
  331. public CoreReturnObject QueryKSInfo_N(String starttime,String endtime,String batch_no,String org_name,String design_key,String prod_namemome,String radio,String radioYN) {
  332. String sql2="";
  333. if (StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)) {
  334. String sky=StrSky(starttime,endtime);
  335. if(sky.equals("FALSE")){
  336. SqlSession.close();
  337. cro.setV_errCode(-1);
  338. cro.setV_errMsg("查询时间不能大于半年,请核实查询时间条件!");
  339. return cro;
  340. }
  341. }
  342. if(StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)){
  343. sql2 +=" and t.creattime >= to_date('"+starttime+" 00:00:00', 'yyyy-MM-dd hh24:mi:ss')";
  344. sql2 +=" and t.creattime <= to_date('"+endtime+" 23:59:59', 'yyyy-MM-dd hh24:mi:ss') ";
  345. }
  346. if(!"".equals(org_name)){
  347. sql2 +=" and P.CERT_INST_NAME = '"+org_name+"' ";
  348. }
  349. String sql ="select * from (SELECT distinct T.BILLETID MATERIAL_NO, "
  350. +" '' VESSEL, "
  351. +" P.DELIVERY_STATE_CODE, "
  352. +" P.DELIVERY_STATE_DESC, "
  353. +" TO_CHAR(A.SENDBEGINDATE, 'YYYY-MM-DD') DELIVERY_DATE, "
  354. +" C2N@XGCX(T.CUTSIDESTATE) CUT_TYPE, "
  355. +" T.STOVENO HEAT_NO, "
  356. +" T.ROLLNUMBER BATCH_NO, "
  357. +" Z.BILLETID_JY INSPECTION_LOT, "
  358. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  359. +" T.PLY THICK, "
  360. +" T.WIDTH, "
  361. +" T.LENGTH, "
  362. +" T.THEORYWEIGHT MAT_WEIGHT, "
  363. +" '4001HB1' PLINE_CODE, "
  364. +" '厚板线' PLINE_NAME, "
  365. +" P.CERT_INST_CODE CERT_INST_CODE, "
  366. //+" P.CERT_INST_NAME CERT_INST_NAME, "
  367. //+" dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY)) CERT_INST_NAME,"
  368. +" case when P.THREE_MEMO is not null then P.THREE_MEMO else dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) "
  369. +" from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY )) end CERT_INST_NAME, "
  370. +" P.CREATE_ID, "
  371. +" P.CREATE_NAME, "
  372. +" P.PSC, "
  373. +" P.PROD_CODE, "
  374. +" P.PROD_NAME, "
  375. +" P.STEEL_CODE, "
  376. +" P.STEEL_NAME, "
  377. +" P.STD_CODE, "
  378. +" P.STD_NAME, "
  379. // +" P.DESIGN_KEY, "
  380. +" A.ORDERNO DESIGN_KEY, "
  381. +" P.PSC_DESC, "
  382. //+" Z.fst_judgeresult PHYFSTSRESULT, "
  383. +" case when z.JUDGERESULT = 1 then '1' else Z.fst_judgeresult end PHYFSTSRESULT,"
  384. +" case when substr(P.DESIGN_KEY,0,2) = '19' then '非计划' "
  385. +" else decode(z.JUDGERESULT, '1', '船检合格', '待判') end PHYFSTSRESULT1, "
  386. +" A.PACTNO 合同号, "
  387. +" (select inceptcorpname from sel_inceptcorpinfo@xgcx where INCEPTCORPCODE = A.INCEPTCORPCODE) INCEPTCORPCODE, "
  388. +" (select buyername from sel_buyerbaseinfo@xgcx where buyercode = A.BUYERCODE) BUYERCODE, to_char(t.creattime,'yyyy-MM-dd hh24:mi:ss') 创建时间,"
  389. + " to_char(Z.fst_judge_time, 'yyyy-MM-dd hh24:mi:ss') 初检时间 "
  390. +" FROM KCH_TURNOFFLIST@XGCX T, "
  391. +" SEL_PACTDETAIL_NEW@XGCX A, "
  392. +" QCM_JHY_SAMPLE_R_ORD P, "
  393. +" ZJ_RESULT_ALL@XGCX Z "
  394. +" WHERE A.ORDERNO = T.ALLOTORDERFORM "
  395. +" AND A.PSRNO = P.PSC "
  396. +" and to_char(T.PLY, 'fm990.099') = to_char(p.thick, 'fm990.099') "
  397. +" and A.STEELCODE= t.DETERMINANTCARDNUMBER "
  398. +" and A.STEELCODE = p.steel_code "
  399. +" and t.DETERMINANTCARDNUMBER = p.steel_code "
  400. //+" AND A.ORDERNO = P.DESIGN_KEY "
  401. // +" and T.ALLOTORDERFORM = p.design_key"
  402. +" and t.ROLLNUMBER = p.batch_no "
  403. +" AND Z.BILLETID = T.BILLETID "
  404. //+" and p.inspection_lot= Z.BILLETID_JY "
  405. +" and P.DELIVERY_STATE_DESC = A.STANDSTATUS "
  406. +" AND T.BILLETID NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where d.steel_code=p.steel_code and d.Validflag is null) "
  407. // +" AND Z.CIC_IS_LOCK = '0' "
  408. // +" AND Z.PIC_IS_LOCK = '0' "
  409. // +" AND Z.SIC_IS_LOCK = '0' "
  410. // +" AND Z.DIC_IS_LOCK = '0' "
  411. // +" AND Z.SFU_IS_LOCK = '0' "
  412. // +" AND Z.SFD_IS_LOCK = '0' "
  413. // +" AND Z.SFE_IS_LOCK = '0' "
  414. +" AND P.CERT_INST_CODE != '5000' "
  415. + " and P.CERT_INST_CODE != 'IC003' "
  416. + " and P.CERT_INST_CODE != 'IC004' "
  417. + " and P.CERT_INST_CODE != 'IC001' "
  418. // (or (P.CERT_INST_CODE = 'IC001' AND LENGTH(P.THREE_MEMO)>=6) )
  419. // + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社,中国船级社') "
  420. + " and P.CERT_INST_CODE != 'IC010'"
  421. + " and Z.BILLETID_JY like T.ROLLNUMBER||'%' and T.ROLLNUMBER LIKE 'H%'"
  422. + sql2
  423. + ")t";
  424. //+" AND P.CERT_INST_CODE != '5000' "
  425. //+ " and P.CERT_INST_CODE != 'IC003' and P.CERT_INST_CODE != 'IC004' and P.CERT_INST_CODE != 'IC001' "
  426. //+ " and P.CERT_INST_CODE != 'IC010'"
  427. // " and T.ROLLNUMBER LIKE 'H%'";
  428. // +" AND STORAGESTATUS = '501602' ";
  429. sql +=" where 1=1 ";
  430. if(!"".equals(batch_no)){
  431. sql +=" and t.BATCH_NO like '"+batch_no+"%' ";
  432. }
  433. /* if(!"".equals(org_name)){
  434. sql +=" and t.CERT_INST_NAME like '%"+org_name+"%' ";
  435. }*/
  436. if(!"".equals(prod_namemome)){
  437. sql +=" and t.PSC_DESC like '"+prod_namemome+"%' ";
  438. }
  439. if(!"".equals(design_key)){
  440. sql +=" and t.DESIGN_KEY like '"+design_key+"%' ";
  441. }
  442. if(radio.equals("1")){
  443. sql +=" and t.PHYFSTSRESULT = '1' ";//t.fst_judgeresult
  444. }else if(radio.equals("0")){
  445. sql +=" and t.PHYFSTSRESULT <> '1' ";
  446. }
  447. if(radioYN.equals("1")){
  448. sql +=" and t.PHYFSTSRESULT1 = '船检合格' ";
  449. }else if(radioYN.equals("0")){
  450. sql +=" and t.PHYFSTSRESULT1 = '待判' ";
  451. }
  452. if(StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)){
  453. //sql +=" and t.创建时间 >= '"+starttime+" 00:00:00' ";
  454. //sql +=" and t.创建时间 <= '"+endtime+" 24:00:00' ";
  455. }
  456. StringBuffer sqlucomm = new StringBuffer();
  457. sqlucomm.append(sql);
  458. try {
  459. /*ResultSet results=this.getDao("testDao").ExceuteQueryForResultSet(sqlucomm.toString());
  460. JSONArray jsonArray=resultSetToJsonArry(results);
  461. cro.setResult(jsonArray); */
  462. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  463. if(listEle == null || listEle.size() <=0){
  464. listEle = QueryKSInfo2(starttime,endtime,batch_no,org_name,design_key,prod_namemome,radio,radioYN);
  465. }
  466. cro.setResult(listEle);
  467. } catch (Exception ex) {
  468. cro.setV_errCode(-1);
  469. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  470. SqlSession.rollback();
  471. }
  472. SqlSession.close();
  473. return cro;
  474. }
  475. public List<HashMap> QueryKSInfo2(String starttime,String endtime,String batch_no,String org_name,String design_key,String prod_namemome,String radio,String radioYN) {
  476. String sql2="";
  477. if(StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)){
  478. sql2 +=" and t.creattime >= to_date('"+starttime+" 00:00:00', 'yyyy-MM-dd hh24:mi:ss')";
  479. sql2 +=" and t.creattime <= to_date('"+endtime+" 23:59:59', 'yyyy-MM-dd hh24:mi:ss') ";
  480. }
  481. if(!"".equals(org_name)){
  482. sql2 +=" and P.CERT_INST_NAME = '"+org_name+"' ";
  483. }
  484. String sql ="select * from (SELECT distinct T.BILLETID MATERIAL_NO, "
  485. +" '' VESSEL, "
  486. +" P.DELIVERY_STATE_CODE, "
  487. +" P.DELIVERY_STATE_DESC, "
  488. +" TO_CHAR(A.SENDBEGINDATE, 'YYYY-MM-DD') DELIVERY_DATE, "
  489. +" C2N@XGCX(T.CUTSIDESTATE) CUT_TYPE, "
  490. +" T.STOVENO HEAT_NO, "
  491. +" T.ROLLNUMBER BATCH_NO, "
  492. +" Z.BILLETID_JY INSPECTION_LOT, "
  493. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  494. +" T.PLY THICK, "
  495. +" T.WIDTH, "
  496. +" T.LENGTH, "
  497. +" T.THEORYWEIGHT MAT_WEIGHT, "
  498. +" '4001HB1' PLINE_CODE, "
  499. +" '厚板线' PLINE_NAME, "
  500. +" P.CERT_INST_CODE CERT_INST_CODE, "
  501. +" case when P.THREE_MEMO is not null then P.THREE_MEMO else dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) "
  502. +" from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY )) end CERT_INST_NAME, "
  503. +" P.CREATE_ID, "
  504. +" P.CREATE_NAME, "
  505. +" P.PSC, "
  506. +" P.PROD_CODE, "
  507. +" P.PROD_NAME, "
  508. +" P.STEEL_CODE, "
  509. +" P.STEEL_NAME, "
  510. +" P.STD_CODE, "
  511. +" P.STD_NAME, "
  512. +" A.ORDERNO DESIGN_KEY, "
  513. +" P.PSC_DESC, "
  514. +" case when z.JUDGERESULT = 1 then '1' else Z.fst_judgeresult end PHYFSTSRESULT,"
  515. +" case when substr(P.DESIGN_KEY,0,2) = '19' then '非计划' "
  516. +" else decode(z.JUDGERESULT, '1', '船检合格', '待判') end PHYFSTSRESULT1, "
  517. +" A.PACTNO 合同号, "
  518. +" (select inceptcorpname from sel_inceptcorpinfo@xgcx where INCEPTCORPCODE = A.INCEPTCORPCODE) INCEPTCORPCODE, "
  519. +" (select buyername from sel_buyerbaseinfo@xgcx where buyercode = A.BUYERCODE) BUYERCODE, to_char(t.creattime,'yyyy-MM-dd hh24:mi:ss') 创建时间,"
  520. + " to_char(Z.fst_judge_time, 'yyyy-MM-dd hh24:mi:ss') 初检时间 "
  521. +" FROM KCH_TURNOFFLIST@XGCX T, "
  522. +" SEL_PACTDETAIL_NEW@XGCX A, "
  523. +" QCM_JHY_SAMPLE_R_ORD P, "
  524. +" ZJ_RESULT_ALL@XGCX Z "
  525. +" WHERE A.ORDERNO = T.ALLOTORDERFORM "
  526. +" and to_char(T.PLY, 'fm990.099') = to_char(p.thick, 'fm990.099') "
  527. +" and A.STEELCODE= t.DETERMINANTCARDNUMBER "
  528. +" and t.ROLLNUMBER = p.batch_no "
  529. +" AND Z.BILLETID = T.BILLETID "
  530. +" and p.inspection_lot= Z.BILLETID_JY "
  531. +" and P.DELIVERY_STATE_DESC = A.STANDSTATUS "
  532. +" AND T.BILLETID NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where d.steel_code=p.steel_code and d.Validflag is null) "
  533. +" AND P.CERT_INST_CODE != '5000' "
  534. + " and P.CERT_INST_CODE != 'IC003' "
  535. + " and P.CERT_INST_CODE != 'IC004' "
  536. + " and (P.CERT_INST_CODE != 'IC001' or (P.CERT_INST_CODE = 'IC001' AND LENGTH(P.THREE_MEMO)>=6) ) "
  537. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社,中国船级社') "
  538. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('检测中心,挪威船级社') "
  539. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社') "
  540. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('韩国船级社,挪威船级社') "
  541. + " and P.CERT_INST_CODE != 'IC010'"
  542. + " and Z.BILLETID_JY like T.ROLLNUMBER||'%' and T.ROLLNUMBER LIKE 'H%'"
  543. + sql2
  544. + ")t";
  545. sql +=" where 1=1 and t.CERT_INST_CODE != 'IC001' "
  546. + " AND T.BATCH_NO NOT IN (SELECT D.BATCH_NO FROM QCM_MAT_CERT_D D where D.CREATE_TIME <= TO_DATE('2024-12-18 00:00:00','YYYY-MM-DD HH24:MI:SS') ) ";
  547. if(!"".equals(batch_no)){
  548. sql +=" and t.BATCH_NO like '"+batch_no+"%' ";
  549. }
  550. if(!"".equals(prod_namemome)){
  551. sql +=" and t.PSC_DESC like '"+prod_namemome+"%' ";
  552. }
  553. if(!"".equals(design_key)){
  554. sql +=" and t.DESIGN_KEY like '"+design_key+"%' ";
  555. }
  556. if(radio.equals("1")){
  557. sql +=" and t.PHYFSTSRESULT = '1' ";
  558. }else if(radio.equals("0")){
  559. sql +=" and t.PHYFSTSRESULT <> '1' ";
  560. }
  561. if(radioYN.equals("1")){
  562. sql +=" and t.PHYFSTSRESULT1 = '船检合格' ";
  563. }else if(radioYN.equals("0")){
  564. sql +=" and t.PHYFSTSRESULT1 = '待判' ";
  565. }
  566. StringBuffer sqlucomm = new StringBuffer();
  567. sqlucomm.append(sql);
  568. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  569. return listEle;
  570. }
  571. /**
  572. * 查询库存数据中板线
  573. * @param strDate
  574. * @param endDate
  575. * @param orgName
  576. * @param batch
  577. * @param design_key
  578. * @return
  579. * */
  580. public CoreReturnObject QueryKczInfo_N(String starttime,String endtime,String batch_no,String org_name,String design_key,String prod_namemome, String radio,String radioYN) {
  581. String sql2="";
  582. if (StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)) {
  583. String sky=StrSky(starttime,endtime);
  584. if(sky.equals("FALSE")){
  585. SqlSession.close();
  586. cro.setV_errCode(-1);
  587. cro.setV_errMsg("查询时间不能大于半年,请核实查询时间条件!");
  588. return cro;
  589. }
  590. }
  591. if(StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)){
  592. sql2 +=" and t.creattime >= to_date('"+starttime+" 00:00:00', 'yyyy-MM-dd hh24:mi:ss')";
  593. sql2 +=" and t.creattime <= to_date('"+endtime+" 23:59:59', 'yyyy-MM-dd hh24:mi:ss') ";
  594. }
  595. if(!"".equals(org_name)){
  596. sql2 +=" and P.CERT_INST_NAME = '"+org_name+"' ";
  597. }
  598. String sql = "select * from ( SELECT distinct T.BILLETID MATERIAL_NO, "
  599. +" '' VESSEL, "
  600. +" P.DELIVERY_STATE_CODE, "
  601. +" P.DELIVERY_STATE_DESC, "
  602. +" TO_CHAR(A.SENDBEGINDATE, 'YYYY-MM-DD') DELIVERY_DATE, "
  603. +" C2N@XGCX(T.CUTSIDESTATE) CUT_TYPE, "
  604. +" T.STOVENO HEAT_NO, "
  605. +" T.ROLLNUMBER BATCH_NO, "
  606. +" Z.BILLETID_JY INSPECTION_LOT, "
  607. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  608. +" T.PLY THICK, "
  609. +" T.WIDTH, "
  610. +" T.LENGTH, "
  611. +" T.THEORYWEIGHT MAT_WEIGHT, "
  612. +" '4001ZB1' PLINE_CODE, "
  613. +" '中板线' PLINE_NAME, "
  614. +" P.CERT_INST_CODE CERT_INST_CODE, "
  615. // +" P.CERT_INST_NAME CERT_INST_NAME, "
  616. // +" dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY)) CERT_INST_NAME,"
  617. +" case when P.THREE_MEMO is not null then P.THREE_MEMO else dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) "
  618. +" from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY )) end CERT_INST_NAME, "
  619. +" P.CREATE_ID, "
  620. +" P.CREATE_NAME, "
  621. +" P.PSC, "
  622. +" P.PROD_CODE, "
  623. +" P.PROD_NAME, "
  624. +" P.STEEL_CODE, "
  625. +" P.STEEL_NAME, "
  626. +" P.STD_CODE, "
  627. +" P.STD_NAME, "
  628. //+" P.DESIGN_KEY, "
  629. +" A.ORDERNO DESIGN_KEY, "
  630. +" P.PSC_DESC, "
  631. //+" Z.fst_judgeresult PHYFSTSRESULT, "
  632. +" case when z.JUDGERESULT = 1 then '1' else Z.fst_judgeresult end PHYFSTSRESULT,"
  633. +" case when substr(P.DESIGN_KEY,0,2) = '19' then '非计划' "
  634. +" else decode(z.JUDGERESULT, '1', '船检合格', '待判') end PHYFSTSRESULT1, "
  635. +" A.PACTNO 合同号, "
  636. +" (select inceptcorpname from sel_inceptcorpinfo@xgcx where INCEPTCORPCODE = A.INCEPTCORPCODE) INCEPTCORPCODE, "
  637. +" (select buyername from sel_buyerbaseinfo@xgcx where buyercode = A.BUYERCODE) BUYERCODE,to_char(t.creattime,'yyyy-MM-dd hh24:mi:ss') 创建时间 ,"
  638. + " to_char(Z.fst_judge_time, 'yyyy-MM-dd hh24:mi:ss') 初检时间 "
  639. +" FROM KCZ_TURNOFFLIST@XGCX T, "
  640. +" SEL_PACTDETAIL_NEW@XGCX A, "
  641. +" QCM_JHY_SAMPLE_R_ORD P, "
  642. +" ZJ_RESULT_ALL@XGCX Z "
  643. +" WHERE A.ORDERNO = T.ORDERNO "
  644. +" AND A.PSRNO = P.PSC and T.PLY = p.thick "
  645. //+" AND A.ORDERNO = P.DESIGN_KEY "
  646. //+" and T.ORDERNO = p.design_key"
  647. +" and t.ROLLNUMBER = p.batch_no "
  648. +" AND Z.BILLETID = T.BILLETID "
  649. //+" and p.inspection_lot = Z.BILLETID_JY "
  650. +" and P.DELIVERY_STATE_DESC = A.STANDSTATUS "
  651. +" AND T.BILLETID NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where d.steel_code=p.steel_code and d.Validflag is null) "
  652. // +" AND Z.CIC_IS_LOCK = '0' "
  653. // +" AND Z.PIC_IS_LOCK = '0' "
  654. // +" AND Z.SIC_IS_LOCK = '0' "
  655. // +" AND Z.DIC_IS_LOCK = '0' "
  656. // +" AND Z.SFU_IS_LOCK = '0' "
  657. // +" AND Z.SFD_IS_LOCK = '0' "
  658. // +" AND Z.SFE_IS_LOCK = '0' "
  659. +" and t.ISVALID <> '0' "
  660. +" AND P.CERT_INST_CODE != '5000' "
  661. + " and P.CERT_INST_CODE != 'IC003' "
  662. + " and P.CERT_INST_CODE != 'IC004' "
  663. + " and P.CERT_INST_CODE != 'IC001' "
  664. //(or (P.CERT_INST_CODE = 'IC001' AND LENGTH(P.THREE_MEMO)>=6) )
  665. //+ " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社,中国船级社') "
  666. + " and P.CERT_INST_CODE != 'IC010'"
  667. + " and P.INSPECTION_LOT like T.ROLLNUMBER||'%' and T.ROLLNUMBER LIKE 'Z%' "
  668. + sql2
  669. + ")t";
  670. //+" AND P.CERT_INST_CODE != '5000' "
  671. //+ " and P.CERT_INST_CODE != 'IC003' and P.CERT_INST_CODE != 'IC004' and P.CERT_INST_CODE != 'IC001' "
  672. // + " and P.CERT_INST_CODE != 'IC010' "
  673. // " and T.ROLLNUMBER LIKE 'Z%'";
  674. //+" AND STORAGESTATUS = '501602' ";
  675. sql +=" where 1=1 ";
  676. if(!"".equals(batch_no)){
  677. sql +=" and t.BATCH_NO like '"+batch_no+"%' ";
  678. }
  679. /* if(!"".equals(org_name)){
  680. sql +=" and t.CERT_INST_NAME like '%"+org_name+"%' ";
  681. }*/
  682. if(!"".equals(prod_namemome)){
  683. sql +=" and t.PSC_DESC like '"+prod_namemome+"%' ";
  684. }
  685. if(!"".equals(design_key)){
  686. sql +=" and t.DESIGN_KEY like '"+design_key+"%' ";
  687. }
  688. if(radio.equals("1")){
  689. sql +=" and t.PHYFSTSRESULT = '1' ";//fst_judgeresult
  690. }else if(radio.equals("0")){
  691. sql +=" and t.PHYFSTSRESULT <> '1' ";
  692. }
  693. if(radioYN.equals("1")){
  694. sql +=" and t.PHYFSTSRESULT1 = '船检合格' ";
  695. }else if(radioYN.equals("0")){
  696. sql +=" and t.PHYFSTSRESULT1 = '待判' ";
  697. }
  698. if(StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)){
  699. sql +=" and t.创建时间 >= '"+starttime+" 00:00:00' ";
  700. sql +=" and t.创建时间 <= '"+endtime+" 24:00:00' ";
  701. }
  702. StringBuffer sqlucomm = new StringBuffer();
  703. sqlucomm.append(sql);
  704. try {
  705. /*ResultSet results=this.getDao("testDao").ExceuteQueryForResultSet(sqlucomm.toString());
  706. JSONArray jsonArray=resultSetToJsonArry(results);
  707. cro.setResult(jsonArray); */
  708. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  709. if(listEle == null || listEle.size() <=0){
  710. listEle = QueryKczInfo2(starttime,endtime,batch_no,org_name,design_key,prod_namemome,radio,radioYN);
  711. }
  712. cro.setResult(listEle);
  713. } catch (Exception ex) {
  714. cro.setV_errCode(-1);
  715. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  716. SqlSession.rollback();
  717. }
  718. SqlSession.close();
  719. return cro;
  720. }
  721. public List<HashMap> QueryKczInfo2(String starttime,String endtime,String batch_no,String org_name,String design_key,String prod_namemome, String radio,String radioYN) {
  722. String sql2="";
  723. if(StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)){
  724. sql2 +=" and t.creattime >= to_date('"+starttime+" 00:00:00', 'yyyy-MM-dd hh24:mi:ss')";
  725. sql2 +=" and t.creattime <= to_date('"+endtime+" 23:59:59', 'yyyy-MM-dd hh24:mi:ss') ";
  726. }
  727. if(!"".equals(org_name)){
  728. sql2 +=" and P.CERT_INST_NAME = '"+org_name+"' ";
  729. }
  730. String sql = "select * from ( SELECT distinct T.BILLETID MATERIAL_NO, "
  731. +" '' VESSEL, "
  732. +" P.DELIVERY_STATE_CODE, "
  733. +" P.DELIVERY_STATE_DESC, "
  734. +" TO_CHAR(A.SENDBEGINDATE, 'YYYY-MM-DD') DELIVERY_DATE, "
  735. +" C2N@XGCX(T.CUTSIDESTATE) CUT_TYPE, "
  736. +" T.STOVENO HEAT_NO, "
  737. +" T.ROLLNUMBER BATCH_NO, "
  738. +" Z.BILLETID_JY INSPECTION_LOT, "
  739. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  740. +" T.PLY THICK, "
  741. +" T.WIDTH, "
  742. +" T.LENGTH, "
  743. +" T.THEORYWEIGHT MAT_WEIGHT, "
  744. +" '4001ZB1' PLINE_CODE, "
  745. +" '中板线' PLINE_NAME, "
  746. +" P.CERT_INST_CODE CERT_INST_CODE, "
  747. +" case when P.THREE_MEMO is not null then P.THREE_MEMO else dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) "
  748. +" from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY )) end CERT_INST_NAME, "
  749. +" P.CREATE_ID, "
  750. +" P.CREATE_NAME, "
  751. +" P.PSC, "
  752. +" P.PROD_CODE, "
  753. +" P.PROD_NAME, "
  754. +" P.STEEL_CODE, "
  755. +" P.STEEL_NAME, "
  756. +" P.STD_CODE, "
  757. +" P.STD_NAME, "
  758. +" A.ORDERNO DESIGN_KEY, "
  759. +" P.PSC_DESC, "
  760. +" case when z.JUDGERESULT = 1 then '1' else Z.fst_judgeresult end PHYFSTSRESULT,"
  761. +" case when substr(P.DESIGN_KEY,0,2) = '19' then '非计划' "
  762. +" else decode(z.JUDGERESULT, '1', '船检合格', '待判') end PHYFSTSRESULT1, "
  763. +" A.PACTNO 合同号, "
  764. +" (select inceptcorpname from sel_inceptcorpinfo@xgcx where INCEPTCORPCODE = A.INCEPTCORPCODE) INCEPTCORPCODE, "
  765. +" (select buyername from sel_buyerbaseinfo@xgcx where buyercode = A.BUYERCODE) BUYERCODE,to_char(t.creattime,'yyyy-MM-dd hh24:mi:ss') 创建时间 ,"
  766. + " to_char(Z.fst_judge_time, 'yyyy-MM-dd hh24:mi:ss') 初检时间 "
  767. +" FROM KCZ_TURNOFFLIST@XGCX T, "
  768. +" SEL_PACTDETAIL_NEW@XGCX A, "
  769. +" QCM_JHY_SAMPLE_R_ORD P, "
  770. +" ZJ_RESULT_ALL@XGCX Z "
  771. +" WHERE A.ORDERNO = T.ORDERNO "
  772. + " and to_char(T.PLY, 'fm990.099') = to_char(p.thick, 'fm990.099')"
  773. +" and t.ROLLNUMBER = p.batch_no "
  774. +" AND Z.BILLETID = T.BILLETID "
  775. +" and p.inspection_lot = Z.BILLETID_JY "
  776. +" and P.DELIVERY_STATE_DESC = A.STANDSTATUS "
  777. +" AND T.BILLETID NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where d.steel_code=p.steel_code and d.Validflag is null) "
  778. +" and t.ISVALID <> '0' "
  779. +" AND P.CERT_INST_CODE != '5000' "
  780. + " and P.CERT_INST_CODE != 'IC003' "
  781. + " and P.CERT_INST_CODE != 'IC004' "
  782. + " and (P.CERT_INST_CODE != 'IC001' or (P.CERT_INST_CODE = 'IC001' AND LENGTH(P.THREE_MEMO)>=6) ) "
  783. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社,中国船级社') "
  784. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('检测中心,挪威船级社') "
  785. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社') "
  786. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('韩国船级社,挪威船级社') "
  787. + " and P.CERT_INST_CODE != 'IC010'"
  788. + " and P.INSPECTION_LOT like T.ROLLNUMBER||'%' and T.ROLLNUMBER LIKE 'Z%' "
  789. + sql2
  790. + ")t";
  791. sql +=" where 1=1 and t.CERT_INST_CODE != 'IC001' "
  792. + " AND T.BATCH_NO NOT IN (SELECT D.BATCH_NO FROM QCM_MAT_CERT_D D where D.CREATE_TIME <= TO_DATE('2024-12-18 00:00:00','YYYY-MM-DD HH24:MI:SS') ) ";
  793. if(!"".equals(batch_no)){
  794. sql +=" and t.BATCH_NO like '"+batch_no+"%' ";
  795. }
  796. if(!"".equals(prod_namemome)){
  797. sql +=" and t.PSC_DESC like '"+prod_namemome+"%' ";
  798. }
  799. if(!"".equals(design_key)){
  800. sql +=" and t.DESIGN_KEY like '"+design_key+"%' ";
  801. }
  802. if(radio.equals("1")){
  803. sql +=" and t.PHYFSTSRESULT = '1' ";
  804. }else if(radio.equals("0")){
  805. sql +=" and t.PHYFSTSRESULT <> '1' ";
  806. }
  807. if(radioYN.equals("1")){
  808. sql +=" and t.PHYFSTSRESULT1 = '船检合格' ";
  809. }else if(radioYN.equals("0")){
  810. sql +=" and t.PHYFSTSRESULT1 = '待判' ";
  811. }
  812. if(StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)){
  813. sql +=" and t.创建时间 >= '"+starttime+" 00:00:00' ";
  814. sql +=" and t.创建时间 <= '"+endtime+" 24:00:00' ";
  815. }
  816. StringBuffer sqlucomm = new StringBuffer();
  817. sqlucomm.append(sql);
  818. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  819. return listEle;
  820. }
  821. public CoreReturnObject QueryKSAllInfo(String starttime,String endtime,String batch_no,String org_name,String design_key,String prod_namemome, String radio,String radioYN){
  822. String sql2="";
  823. String sql3="";
  824. if (StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)) {
  825. String sky=StrSky(starttime,endtime);
  826. if(sky.equals("FALSE")){
  827. SqlSession.close();
  828. cro.setV_errCode(-1);
  829. cro.setV_errMsg("查询时间不能大于半年,请核实查询时间条件!");
  830. return cro;
  831. }
  832. }
  833. if(StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)){
  834. sql2 +=" and t.creattime >= to_date('"+starttime+" 00:00:00', 'yyyy-MM-dd hh24:mi:ss')";
  835. sql2 +=" and t.creattime <= to_date('"+endtime+" 23:59:59', 'yyyy-MM-dd hh24:mi:ss') ";
  836. }
  837. if(!"".equals(org_name)){
  838. sql2 +=" and P.CERT_INST_NAME = '"+org_name+"' ";
  839. }
  840. sql3 +=" where 1=1 ";
  841. if(!"".equals(batch_no)){
  842. sql3 +=" and t.BATCH_NO like '"+batch_no+"%' ";
  843. }
  844. if(!"".equals(prod_namemome)){
  845. sql3 +=" and t.PSC_DESC like '"+prod_namemome+"%' ";
  846. }
  847. if(!"".equals(design_key)){
  848. sql3 +=" and t.DESIGN_KEY like '"+design_key+"%' ";
  849. }
  850. if(radio.equals("1")){
  851. sql3 +=" and t.PHYFSTSRESULT = '1' ";
  852. }else if(radio.equals("0")){
  853. sql3 +=" and t.PHYFSTSRESULT <> '1' ";
  854. }
  855. if(radioYN.equals("1")){
  856. sql3 +=" and t.PHYFSTSRESULT1 = '船检合格' ";
  857. }else if(radioYN.equals("0")){
  858. sql3 +=" and t.PHYFSTSRESULT1 = '待判' ";
  859. }
  860. if(StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)){
  861. sql3 +=" and t.创建时间 >= '"+starttime+" 00:00:00' ";
  862. sql3 +=" and t.创建时间 <= '"+endtime+" 24:00:00' ";
  863. }
  864. String sql = "select * from ( SELECT distinct T.BILLETID MATERIAL_NO, "
  865. +" '' VESSEL, "
  866. +" P.DELIVERY_STATE_CODE, "
  867. +" P.DELIVERY_STATE_DESC, "
  868. +" TO_CHAR(A.SENDBEGINDATE, 'YYYY-MM-DD') DELIVERY_DATE, "
  869. +" C2N@XGCX(T.CUTSIDESTATE) CUT_TYPE, "
  870. +" T.STOVENO HEAT_NO, "
  871. +" T.ROLLNUMBER BATCH_NO, "
  872. +" Z.BILLETID_JY INSPECTION_LOT, "
  873. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  874. +" T.PLY THICK, "
  875. +" T.WIDTH, "
  876. +" T.LENGTH, "
  877. +" T.THEORYWEIGHT MAT_WEIGHT, "
  878. +" '4001ZB1' PLINE_CODE, "
  879. +" '中板线' PLINE_NAME, "
  880. +" P.CERT_INST_CODE CERT_INST_CODE, "
  881. +" case when P.THREE_MEMO is not null then P.THREE_MEMO else dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) "
  882. +" from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY )) end CERT_INST_NAME, "
  883. +" P.CREATE_ID, "
  884. +" P.CREATE_NAME, "
  885. +" P.PSC, "
  886. +" P.PROD_CODE, "
  887. +" P.PROD_NAME, "
  888. +" P.STEEL_CODE, "
  889. +" P.STEEL_NAME, "
  890. +" P.STD_CODE, "
  891. +" P.STD_NAME, "
  892. +" A.ORDERNO DESIGN_KEY, "
  893. +" P.PSC_DESC, "
  894. +" case when z.JUDGERESULT = 1 then '1' else Z.fst_judgeresult end PHYFSTSRESULT,"
  895. +" case when substr(P.DESIGN_KEY,0,2) = '19' then '非计划' "
  896. +" else decode(z.JUDGERESULT, '1', '船检合格', '待判') end PHYFSTSRESULT1, "
  897. +" A.PACTNO 合同号, "
  898. +" (select inceptcorpname from sel_inceptcorpinfo@xgcx where INCEPTCORPCODE = A.INCEPTCORPCODE) INCEPTCORPCODE, "
  899. +" (select buyername from sel_buyerbaseinfo@xgcx where buyercode = A.BUYERCODE) BUYERCODE,to_char(t.creattime,'yyyy-MM-dd hh24:mi:ss') 创建时间 ,"
  900. +" to_char(Z.fst_judge_time, 'yyyy-MM-dd hh24:mi:ss') 初检时间 "
  901. +" FROM KCZ_TURNOFFLIST@XGCX T, "
  902. +" SEL_PACTDETAIL_NEW@XGCX A, "
  903. +" QCM_JHY_SAMPLE_R_ORD P, "
  904. +" ZJ_RESULT_ALL@XGCX Z "
  905. +" WHERE A.ORDERNO = T.ORDERNO "
  906. +" AND A.PSRNO = P.PSC and T.PLY = p.thick "
  907. +" and t.ROLLNUMBER = p.batch_no "
  908. +" AND Z.BILLETID = T.BILLETID "
  909. +" and P.DELIVERY_STATE_DESC = A.STANDSTATUS "
  910. +" AND T.BILLETID NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where d.steel_code=p.steel_code and (d.Validflag is null or d.validflag='0')) "
  911. +" and t.ISVALID <> '0' "
  912. +" AND P.CERT_INST_CODE != '5000' "
  913. +" and P.CERT_INST_CODE != 'IC003' "
  914. +" and P.CERT_INST_CODE != 'IC004' "
  915. +" and P.CERT_INST_CODE != 'IC001' "
  916. +" and P.CERT_INST_CODE != 'IC010'"
  917. +" and P.INSPECTION_LOT like T.ROLLNUMBER||'%' and T.ROLLNUMBER LIKE 'Z%' "
  918. + sql2
  919. + ")t"+sql3
  920. +" union "
  921. +" select * from ( SELECT distinct T.BILLETID MATERIAL_NO, "
  922. +" '' VESSEL, "
  923. +" P.DELIVERY_STATE_CODE, "
  924. +" P.DELIVERY_STATE_DESC, "
  925. +" TO_CHAR(A.SENDBEGINDATE, 'YYYY-MM-DD') DELIVERY_DATE, "
  926. +" C2N@XGCX(T.CUTSIDESTATE) CUT_TYPE, "
  927. +" T.STOVENO HEAT_NO, "
  928. +" T.ROLLNUMBER BATCH_NO, "
  929. +" Z.BILLETID_JY INSPECTION_LOT, "
  930. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  931. +" T.PLY THICK, "
  932. +" T.WIDTH, "
  933. +" T.LENGTH, "
  934. +" T.THEORYWEIGHT MAT_WEIGHT, "
  935. +" '4001ZB1' PLINE_CODE, "
  936. +" '中板线' PLINE_NAME, "
  937. +" P.CERT_INST_CODE CERT_INST_CODE, "
  938. +" case when P.THREE_MEMO is not null then P.THREE_MEMO else dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) "
  939. +" from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY )) end CERT_INST_NAME, "
  940. +" P.CREATE_ID, "
  941. +" P.CREATE_NAME, "
  942. +" P.PSC, "
  943. +" P.PROD_CODE, "
  944. +" P.PROD_NAME, "
  945. +" P.STEEL_CODE, "
  946. +" P.STEEL_NAME, "
  947. +" P.STD_CODE, "
  948. +" P.STD_NAME, "
  949. +" A.ORDERNO DESIGN_KEY, "
  950. +" P.PSC_DESC, "
  951. +" case when z.JUDGERESULT = 1 then '1' else Z.fst_judgeresult end PHYFSTSRESULT,"
  952. +" case when substr(P.DESIGN_KEY,0,2) = '19' then '非计划' "
  953. +" else decode(z.JUDGERESULT, '1', '船检合格', '待判') end PHYFSTSRESULT1, "
  954. +" A.PACTNO 合同号, "
  955. +" (select inceptcorpname from sel_inceptcorpinfo@xgcx where INCEPTCORPCODE = A.INCEPTCORPCODE) INCEPTCORPCODE, "
  956. +" (select buyername from sel_buyerbaseinfo@xgcx where buyercode = A.BUYERCODE) BUYERCODE,to_char(t.creattime,'yyyy-MM-dd hh24:mi:ss') 创建时间 ,"
  957. +" to_char(Z.fst_judge_time, 'yyyy-MM-dd hh24:mi:ss') 初检时间 "
  958. +" FROM KCZ_TURNOFFLIST@XGCX T, "
  959. +" SEL_PACTDETAIL_NEW@XGCX A, "
  960. +" QCM_JHY_SAMPLE_R_ORD P, "
  961. +" ZJ_RESULT_ALL@XGCX Z "
  962. +" WHERE A.ORDERNO = T.ORDERNO "
  963. +" and to_char(T.PLY, 'fm990.099') = to_char(p.thick, 'fm990.099')"
  964. +" and t.ROLLNUMBER = p.batch_no "
  965. +" AND Z.BILLETID = T.BILLETID "
  966. +" and p.inspection_lot = Z.BILLETID_JY "
  967. +" and P.DELIVERY_STATE_DESC = A.STANDSTATUS "
  968. +" AND T.BILLETID NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where d.steel_code=p.steel_code and (d.Validflag is null or d.validflag='0')) "
  969. +" and t.ISVALID <> '0' "
  970. +" AND P.CERT_INST_CODE != '5000' "
  971. + " and P.CERT_INST_CODE != 'IC003' "
  972. + " and P.CERT_INST_CODE != 'IC004' "
  973. + " and (P.CERT_INST_CODE != 'IC001' or (P.CERT_INST_CODE = 'IC001' AND LENGTH(P.THREE_MEMO)>=6) ) "
  974. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社,中国船级社') "
  975. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('检测中心,挪威船级社') "
  976. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社') "
  977. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('韩国船级社,挪威船级社') "
  978. + " and P.CERT_INST_CODE != 'IC010'"
  979. + " and P.INSPECTION_LOT like T.ROLLNUMBER||'%' and T.ROLLNUMBER LIKE 'Z%' "
  980. + sql2
  981. + ")t"+sql3
  982. +" and t.CERT_INST_CODE != 'IC001' "
  983. +" AND T.MATERIAL_NO NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where D.CREATE_TIME <= TO_DATE('2024-12-18 00:00:00','YYYY-MM-DD HH24:MI:SS') )";
  984. sql +=" union select * from (SELECT distinct T.BILLETID MATERIAL_NO, "
  985. +" '' VESSEL, "
  986. +" P.DELIVERY_STATE_CODE, "
  987. +" P.DELIVERY_STATE_DESC, "
  988. +" TO_CHAR(A.SENDBEGINDATE, 'YYYY-MM-DD') DELIVERY_DATE, "
  989. +" C2N@XGCX(T.CUTSIDESTATE) CUT_TYPE, "
  990. +" T.STOVENO HEAT_NO, "
  991. +" T.ROLLNUMBER BATCH_NO, "
  992. +" Z.BILLETID_JY INSPECTION_LOT, "
  993. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  994. +" T.PLY THICK, "
  995. +" T.WIDTH, "
  996. +" T.LENGTH, "
  997. +" T.THEORYWEIGHT MAT_WEIGHT, "
  998. +" '4001HB1' PLINE_CODE, "
  999. +" '厚板线' PLINE_NAME, "
  1000. +" P.CERT_INST_CODE CERT_INST_CODE, "
  1001. +" case when P.THREE_MEMO is not null then P.THREE_MEMO else dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) "
  1002. +" from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY )) end CERT_INST_NAME, "
  1003. +" P.CREATE_ID, "
  1004. +" P.CREATE_NAME, "
  1005. +" P.PSC, "
  1006. +" P.PROD_CODE, "
  1007. +" P.PROD_NAME, "
  1008. +" P.STEEL_CODE, "
  1009. +" P.STEEL_NAME, "
  1010. +" P.STD_CODE, "
  1011. +" P.STD_NAME, "
  1012. +" A.ORDERNO DESIGN_KEY, "
  1013. +" P.PSC_DESC, "
  1014. +" case when z.JUDGERESULT = 1 then '1' else Z.fst_judgeresult end PHYFSTSRESULT,"
  1015. +" case when substr(P.DESIGN_KEY,0,2) = '19' then '非计划' "
  1016. +" else decode(z.JUDGERESULT, '1', '船检合格', '待判') end PHYFSTSRESULT1, "
  1017. +" A.PACTNO 合同号, "
  1018. +" (select inceptcorpname from sel_inceptcorpinfo@xgcx where INCEPTCORPCODE = A.INCEPTCORPCODE) INCEPTCORPCODE, "
  1019. +" (select buyername from sel_buyerbaseinfo@xgcx where buyercode = A.BUYERCODE) BUYERCODE, to_char(t.creattime,'yyyy-MM-dd hh24:mi:ss') 创建时间,"
  1020. +" to_char(Z.fst_judge_time, 'yyyy-MM-dd hh24:mi:ss') 初检时间 "
  1021. +" FROM KCH_TURNOFFLIST@XGCX T, "
  1022. +" SEL_PACTDETAIL_NEW@XGCX A, "
  1023. +" QCM_JHY_SAMPLE_R_ORD P, "
  1024. +" ZJ_RESULT_ALL@XGCX Z "
  1025. +" WHERE A.ORDERNO = T.ALLOTORDERFORM "
  1026. +" AND A.PSRNO = P.PSC "
  1027. +" and to_char(T.PLY, 'fm990.099') = to_char(p.thick, 'fm990.099') "
  1028. +" and A.STEELCODE= t.DETERMINANTCARDNUMBER "
  1029. +" and A.STEELCODE = p.steel_code "
  1030. +" and t.DETERMINANTCARDNUMBER = p.steel_code "
  1031. +" and t.ROLLNUMBER = p.batch_no "
  1032. +" AND Z.BILLETID = T.BILLETID "
  1033. +" and P.DELIVERY_STATE_DESC = A.STANDSTATUS "
  1034. +" AND T.BILLETID NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where d.steel_code=p.steel_code and (d.Validflag is null or d.validflag='0')) "
  1035. +" AND P.CERT_INST_CODE != '5000' "
  1036. + " and P.CERT_INST_CODE != 'IC003' "
  1037. + " and P.CERT_INST_CODE != 'IC004' "
  1038. + " and P.CERT_INST_CODE != 'IC001' "
  1039. + " and P.CERT_INST_CODE != 'IC010'"
  1040. + " and Z.BILLETID_JY like T.ROLLNUMBER||'%' and T.ROLLNUMBER LIKE 'H%'"
  1041. + sql2
  1042. + ")t"
  1043. + sql3
  1044. +"union"
  1045. +" select * from (SELECT distinct T.BILLETID MATERIAL_NO, "
  1046. +" '' VESSEL, "
  1047. +" P.DELIVERY_STATE_CODE, "
  1048. +" P.DELIVERY_STATE_DESC, "
  1049. +" TO_CHAR(A.SENDBEGINDATE, 'YYYY-MM-DD') DELIVERY_DATE, "
  1050. +" C2N@XGCX(T.CUTSIDESTATE) CUT_TYPE, "
  1051. +" T.STOVENO HEAT_NO, "
  1052. +" T.ROLLNUMBER BATCH_NO, "
  1053. +" Z.BILLETID_JY INSPECTION_LOT, "
  1054. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  1055. +" T.PLY THICK, "
  1056. +" T.WIDTH, "
  1057. +" T.LENGTH, "
  1058. +" T.THEORYWEIGHT MAT_WEIGHT, "
  1059. +" '4001HB1' PLINE_CODE, "
  1060. +" '厚板线' PLINE_NAME, "
  1061. +" P.CERT_INST_CODE CERT_INST_CODE, "
  1062. +" case when P.THREE_MEMO is not null then P.THREE_MEMO else dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) "
  1063. +" from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY )) end CERT_INST_NAME, "
  1064. +" P.CREATE_ID, "
  1065. +" P.CREATE_NAME, "
  1066. +" P.PSC, "
  1067. +" P.PROD_CODE, "
  1068. +" P.PROD_NAME, "
  1069. +" P.STEEL_CODE, "
  1070. +" P.STEEL_NAME, "
  1071. +" P.STD_CODE, "
  1072. +" P.STD_NAME, "
  1073. +" A.ORDERNO DESIGN_KEY, "
  1074. +" P.PSC_DESC, "
  1075. +" case when z.JUDGERESULT = 1 then '1' else Z.fst_judgeresult end PHYFSTSRESULT,"
  1076. +" case when substr(P.DESIGN_KEY,0,2) = '19' then '非计划' "
  1077. +" else decode(z.JUDGERESULT, '1', '船检合格', '待判') end PHYFSTSRESULT1, "
  1078. +" A.PACTNO 合同号, "
  1079. +" (select inceptcorpname from sel_inceptcorpinfo@xgcx where INCEPTCORPCODE = A.INCEPTCORPCODE) INCEPTCORPCODE, "
  1080. +" (select buyername from sel_buyerbaseinfo@xgcx where buyercode = A.BUYERCODE) BUYERCODE, to_char(t.creattime,'yyyy-MM-dd hh24:mi:ss') 创建时间,"
  1081. +" to_char(Z.fst_judge_time, 'yyyy-MM-dd hh24:mi:ss') 初检时间 "
  1082. +" FROM KCH_TURNOFFLIST@XGCX T, "
  1083. +" SEL_PACTDETAIL_NEW@XGCX A, "
  1084. +" QCM_JHY_SAMPLE_R_ORD P, "
  1085. +" ZJ_RESULT_ALL@XGCX Z "
  1086. +" WHERE A.ORDERNO = T.ALLOTORDERFORM "
  1087. +" and to_char(T.PLY, 'fm990.099') = to_char(p.thick, 'fm990.099') "
  1088. +" and A.STEELCODE= t.DETERMINANTCARDNUMBER "
  1089. +" and t.ROLLNUMBER = p.batch_no "
  1090. +" AND Z.BILLETID = T.BILLETID "
  1091. +" and p.inspection_lot= Z.BILLETID_JY "
  1092. +" and P.DELIVERY_STATE_DESC = A.STANDSTATUS "
  1093. +" AND T.BILLETID NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where d.steel_code=p.steel_code and (d.Validflag is null or d.validflag='0')) "
  1094. +" AND P.CERT_INST_CODE != '5000' "
  1095. + " and P.CERT_INST_CODE != 'IC003' "
  1096. + " and P.CERT_INST_CODE != 'IC004' "
  1097. + " and (P.CERT_INST_CODE != 'IC001' or (P.CERT_INST_CODE = 'IC001' AND LENGTH(P.THREE_MEMO)>=6) ) "
  1098. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社,中国船级社') "
  1099. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('检测中心,挪威船级社') "
  1100. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社') "
  1101. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('韩国船级社,挪威船级社') "
  1102. + " and P.CERT_INST_CODE != 'IC010'"
  1103. + " and Z.BILLETID_JY like T.ROLLNUMBER||'%' and T.ROLLNUMBER LIKE 'H%'"
  1104. + sql2
  1105. + ")t "+sql3
  1106. +" and t.CERT_INST_CODE != 'IC001' "
  1107. +" AND T.MATERIAL_NO NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where D.CREATE_TIME <= TO_DATE('2024-12-18 00:00:00','YYYY-MM-DD HH24:MI:SS') )";
  1108. StringBuffer sqlucomm = new StringBuffer();
  1109. sqlucomm.append(sql);
  1110. // System.out.println(sql);
  1111. try {
  1112. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1113. cro.setResult(listEle);
  1114. } catch (Exception ex) {
  1115. cro.setV_errCode(-1);
  1116. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  1117. SqlSession.rollback();
  1118. }
  1119. SqlSession.close();
  1120. return cro;
  1121. }
  1122. /**
  1123. * 导出 查询库存数据
  1124. * @param strDate
  1125. * @param endDate
  1126. * @param orgName
  1127. * @param batch
  1128. * @param design_key
  1129. * @return
  1130. */
  1131. public CoreReturnObject KsQueryExcel(String starttime,String endtime,String batch_no,String org_name,String design_key,String prod_namemome,String pline_name) {
  1132. String sql = " select count (1) 块数, "
  1133. +" t.HEAT_NO 冶炼炉号, "
  1134. +" t.BATCH_NO 轧编号, "
  1135. +" t.STEEL_NAME 牌号, "
  1136. +" t.THICK 厚度, "
  1137. +" sum(t.MAT_WEIGHT) 重量, "
  1138. +" t.DELIVERY_STATE_DESC 交货状态, "
  1139. +" t.PHYFSTSRESULT1 是否已船检合格, t.memo 订单备注 "
  1140. +" from ( "
  1141. +" select t.HEAT_NO, "
  1142. +" t.BATCH_NO, "
  1143. +" case when "
  1144. +" (select max(nvl(MAIN_STEEL_CODE,'1')) from QCM_ORD_DESIGN_STD_PIC_SMP s where s.design_key = t.design_key) = t.STEEL_NAME "
  1145. +" then t.STEEL_NAME else t.STEEL_NAME || '(副)' end STEEL_NAME, "
  1146. +" t.THICK, "
  1147. +" nvl(t.mat_weight2, to_char(t.MAT_WEIGHT, 'fm990.099')) MAT_WEIGHT, "
  1148. +" t.DELIVERY_STATE_DESC, "
  1149. +" decode((SELECT count(1) "
  1150. +" from zj_result_all@xgcx z "
  1151. +" where z.JUDGERESULT = '1' and z.BILLETID = T.Material_No) "
  1152. +" ,'0','否','是') PHYFSTSRESULT1, "
  1153. +" (select me.memo from QCM_ORD_DESIGN_MEMO me where me.design_key = t.design_key and rownum=1) memo "
  1154. +" from QCM_MAT_CERT_D t "
  1155. +" left join QCM_MAT_CERT_M m "
  1156. +" on t.cert_no = m.cert_no "
  1157. +" where 1 = 1 and (t.VALIDFLAG is null or t.VALIDFLAG = '1' ) ";
  1158. if(!"".equals(pline_name)&& !"全部".equals(pline_name)){
  1159. sql +=" and t.PLINE_NAME like '"+pline_name+"%' ";
  1160. }
  1161. if(!"".equals(org_name) && !"全部".equals(org_name)){
  1162. sql +=" and m.CERT_INST_NAME like '%"+org_name+"%' ";
  1163. }
  1164. if(!"".equals(design_key) && design_key!=null){
  1165. sql +=" and t.design_key like '"+design_key+"%' ";
  1166. }
  1167. if(!"".equals(prod_namemome) && prod_namemome!=null){
  1168. sql +=" and t.psc_desc like '"+prod_namemome+"%' ";
  1169. }
  1170. if(!"".equals(starttime)){
  1171. sql += " and t.CREATE_TIME >= to_date('"+starttime+" 00:00:00','yyyy-mm-dd,hh24:mi:ss')";
  1172. }
  1173. if(!"".equals(endtime)){
  1174. sql += " and t.CREATE_TIME <= to_date('"+endtime+" 23:59:59','yyyy-mm-dd,hh24:mi:ss')";
  1175. }
  1176. sql +=" order by m.CREATE_TIME desc ) t "
  1177. +" group by "
  1178. +" t.HEAT_NO, "
  1179. +" t.BATCH_NO, "
  1180. +" t.STEEL_NAME, "
  1181. +" t.THICK, "
  1182. +" t.DELIVERY_STATE_DESC, "
  1183. +" t.PHYFSTSRESULT1, t.memo "
  1184. + " order by t.BATCH_NO" ;
  1185. StringBuffer sqlucomm = new StringBuffer();
  1186. sqlucomm.append(sql);
  1187. try {
  1188. /*ResultSet results=this.getDao("testDao").ExceuteQueryForResultSet(sqlucomm.toString());
  1189. JSONArray jsonArray=resultSetToJsonArry(results);
  1190. cro.setResult(jsonArray); */
  1191. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1192. cro.setResult(listEle);
  1193. } catch (Exception ex) {
  1194. cro.setV_errCode(-1);
  1195. cro.setV_errMsg("导出失败!"+ex.getMessage());
  1196. SqlSession.rollback();
  1197. }
  1198. SqlSession.close();
  1199. return cro;
  1200. }
  1201. /**
  1202. *ResultSet转换为JSON数组
  1203. *
  1204. * @param ResultSet
  1205. * @return JSONArray
  1206. */
  1207. public static JSONArray resultSetToJsonArry(ResultSet rs) throws SQLException, JSONException {
  1208. JSONArray array = new JSONArray();
  1209. ResultSetMetaData metaData = rs.getMetaData();
  1210. int columnCount = metaData.getColumnCount();
  1211. while (rs.next()) {
  1212. JSONObject jsonObj = new JSONObject();
  1213. for (int i = 1; i <= columnCount; i++) {
  1214. String columnName = metaData.getColumnLabel(i);
  1215. String value = rs.getString(columnName);
  1216. jsonObj.put(columnName, value);
  1217. }
  1218. array.add(jsonObj);
  1219. }
  1220. return array;
  1221. }
  1222. /**
  1223. * 认证机构
  1224. * @param strDate
  1225. * @param endDate
  1226. * @param orgName
  1227. * @param batch
  1228. * @param design_key
  1229. * @return
  1230. */
  1231. public CoreReturnObject getCertInstCode() {
  1232. String sql = " select CERT_INST_CODE,CERT_INST_NAME from qcm_jhy_sample_r_ord r "
  1233. +" group by CERT_INST_CODE,CERT_INST_NAME order by r.cert_inst_code ";
  1234. StringBuffer sqlucomm = new StringBuffer();
  1235. sqlucomm.append(sql);
  1236. try {
  1237. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1238. cro.setResult(listEle);
  1239. } catch (Exception ex) {
  1240. cro.setV_errCode(-1);
  1241. cro.setV_errMsg("查询认证机构失败!"+ex.getMessage());
  1242. SqlSession.rollback();
  1243. }
  1244. SqlSession.close();
  1245. return cro;
  1246. }
  1247. /**
  1248. * 查询第三方见证数据
  1249. * @return
  1250. */
  1251. public CoreReturnObject getMatWitneD(HashMap parmas) {
  1252. try {
  1253. String sql = "select "
  1254. +" t1.matwitne, "
  1255. +" t1.design_key, "
  1256. +" t1.steel_code, "
  1257. +" t1.steel_name, "
  1258. +" t1.thick, "
  1259. +" t1.heat_no, "
  1260. +" t1.batch_no, "
  1261. +" t1.material_no, "
  1262. +" t1.smp_no, "
  1263. +" t1.specimen_no, "
  1264. +" t1.inspection_lot, "
  1265. +" t1.freq_code, "
  1266. +" t1.freq_name, "
  1267. +" t1.smp_type_code, "
  1268. +" t1.smp_type_name, "
  1269. +" t1.smp_location_code, "
  1270. +" t1.smp_location, "
  1271. +" t1.board_no, "
  1272. +" t1.pline_code, "
  1273. +" t1.pline_name, "
  1274. +" t1.process_nos, "
  1275. +" t1.phy_item, "
  1276. +" t1.smp_catg, "
  1277. +" t1.cert_inst_code, "
  1278. +" t1.cert_inst_name, "
  1279. +" t1.psc, "
  1280. +" t1.psc_desc, "
  1281. +" t1.delivery_state_code, "
  1282. +" t1.delivery_state_desc, "
  1283. +" t1.width, "
  1284. +" t1.length, "
  1285. +" t1.msc_pline, "
  1286. +" t1.process_code, "
  1287. +" t1.prod_code, "
  1288. +" t1.prod_name, "
  1289. +" t1.std_code, "
  1290. +" t1.std_name, "
  1291. +" t1.three_memo, "
  1292. +" t1.memo, "
  1293. +" t1.improve_memo, "
  1294. +" t1.create_time "
  1295. +" from ( select QCM_MAT_WITNE(r.design_key,r.batch_no,r.inspection_lot) MATWITNE, r.design_key, "
  1296. +" r.steel_code, "
  1297. +" r.steel_name, "
  1298. +" r.thick, "
  1299. +" t.heat_no, "
  1300. +" t.batch_no, "
  1301. +" t.material_no, "
  1302. +" t.smp_no, "
  1303. +" t.specimen_no, "
  1304. +" t.inspection_lot, "
  1305. +" t.freq_code, "
  1306. +" t.freq_name, "
  1307. +" t.smp_type_code, "
  1308. +" t.smp_type_name, "
  1309. +" t.smp_location_code, "
  1310. +" t.smp_location, "
  1311. +" t.board_no, "
  1312. +" t.pline_code, "
  1313. +" t.pline_name, "
  1314. +" t.process_nos, "
  1315. +" t.phy_item, "
  1316. +" m.smp_catg, "
  1317. +" m.cert_inst_code, "
  1318. +" m.cert_inst_name, "
  1319. +" r.psc, "
  1320. +" r.psc_desc, "
  1321. +" r.delivery_state_code, "
  1322. +" r.delivery_state_desc, "
  1323. +" r.width, "
  1324. +" r.length, "
  1325. +" r.msc_pline, "
  1326. +" r.process_code, "
  1327. +" r.prod_code, "
  1328. +" r.prod_name, "
  1329. +" r.std_code, "
  1330. +" r.std_name, "
  1331. +" r.three_memo, "
  1332. +" t.memo, "
  1333. +" t.improve_memo, "
  1334. +" to_char(t.create_time,'yyyy-MM-dd hh24:mi:ss') create_time "
  1335. +" from qcm_jhy_sample_consign_d t, "
  1336. +" qcm_jhy_sample_consign_m m, "
  1337. +" qcm_jhy_sample_r_ord r "
  1338. +" where t.smp_no = m.smp_no "
  1339. +" and t.smp_no = r.smp_no "
  1340. +" and m.smp_no = r.smp_no "
  1341. +" and r.CERT_INST_CODE in ('IC013','IC012','IC026','IC011','IC014','IC015','IC016','IC017','IC018','IC019','IC020','IC021','IC022','IC023','IC024','IC026') "
  1342. +" and t.status not in ('3','6','5') "
  1343. +" and t.freq_code <> 'D' and t.Smp_Type_Code='0' "
  1344. +" and t.Mat_Witne is null ";
  1345. if(StringUtils.isNotBlank(parmas.get("STARTTIME").toString())&& StringUtils.isNotBlank(parmas.get("ENDTIME").toString())){
  1346. sql +=" and t.create_time >= to_date('"+parmas.get("STARTTIME")+" 00:00:00', 'yyyy-MM-dd hh24:mi:ss')";
  1347. sql +=" and t.create_time <= to_date('"+parmas.get("ENDTIME")+" 23:59:59', 'yyyy-MM-dd hh24:mi:ss') ";
  1348. }
  1349. if (StringUtils.isNotBlank(parmas.get("CERT_INST_NAME").toString())) {
  1350. sql +=" and m.cert_inst_name = '"+parmas.get("CERT_INST_NAME")+"' ";
  1351. }
  1352. if (StringUtils.isNotBlank(parmas.get("BATCH_NO").toString())) {
  1353. sql +=" and t.BATCH_NO = '"+parmas.get("BATCH_NO")+"' ";
  1354. }
  1355. if (StringUtils.isNotBlank(parmas.get("DESIGN_KEY").toString())) {
  1356. sql +=" and r.DESIGN_KEY like '"+parmas.get("DESIGN_KEY")+"%' ";
  1357. }
  1358. if (StringUtils.isNotBlank(parmas.get("STEEL_CODE").toString())) {
  1359. sql +=" and r.STEEL_CODE like '"+parmas.get("STEEL_CODE")+"%' ";
  1360. }
  1361. if (parmas.get("PLINENAME").toString().equals("全部")) {
  1362. sql +=" and t.pline_code in ('ZB1','HB1') ";
  1363. }else{
  1364. sql +=" and t.pline_code ='"+parmas.get("PLINENAME")+"' ";
  1365. }
  1366. sql +=")t1 where 1=1 ";
  1367. if (parmas.get("RADIO").toString().equals("1") || parmas.get("RADIO").toString().equals("0")) {
  1368. sql +=" and t1.matwitne ='"+parmas.get("RADIO")+"' ";
  1369. }
  1370. List<HashMap> listEle= mapper.query(sql.toString());
  1371. cro.setResult(listEle);
  1372. } catch (Exception ex) {
  1373. cro.setV_errCode(-1);
  1374. cro.setV_errMsg("查询失败!"+ex.getMessage());
  1375. SqlSession.rollback();
  1376. }
  1377. SqlSession.close();
  1378. return cro;
  1379. }
  1380. /**
  1381. * 查询第三方见证申报数据
  1382. * @return
  1383. */
  1384. public CoreReturnObject getQcmMatWitneD(HashMap parmas) {
  1385. try {
  1386. String sql = " select '1' matwitne,design_key, "
  1387. +" steel_code, "
  1388. +" steel_name, "
  1389. +" thick, "
  1390. +" heat_no, "
  1391. +" batch_no, "
  1392. +" material_no, "
  1393. +" smp_no, "
  1394. +" specimen_no, "
  1395. +" inspection_lot, "
  1396. +" freq_code, "
  1397. +" freq_name, "
  1398. +" smp_type_code, "
  1399. +" smp_type_name, "
  1400. +" smp_location_code, "
  1401. +" smp_location, "
  1402. +" board_no, "
  1403. +" pline_code, "
  1404. +" pline_name, "
  1405. +" process_nos, "
  1406. +" phy_item, "
  1407. +" smp_catg, "
  1408. +" cert_inst_code, "
  1409. +" cert_inst_name, "
  1410. +" psc, "
  1411. +" psc_desc, "
  1412. +" delivery_state_code, "
  1413. +" delivery_state_desc, "
  1414. +" width, "
  1415. +" length, "
  1416. +" msc_pline, "
  1417. +" process_code, "
  1418. +" prod_code, "
  1419. +" prod_name, "
  1420. +" std_code, "
  1421. +" std_name, "
  1422. +" three_memo, "
  1423. +" memo, "
  1424. +" improve_memo, "
  1425. +" to_char(create_time,'yyyy-MM-dd hh24:mi:ss') create_time, "
  1426. +" create_name "
  1427. +" from qcm_mat_witne_d t where 1=1 ";
  1428. if(StringUtils.isNotBlank(parmas.get("STARTTIME").toString())&& StringUtils.isNotBlank(parmas.get("ENDTIME").toString())){
  1429. sql +=" and t.create_time >= to_date('"+parmas.get("STARTTIME")+" 00:00:00', 'yyyy-MM-dd hh24:mi:ss')";
  1430. sql +=" and t.create_time <= to_date('"+parmas.get("ENDTIME")+" 23:59:59', 'yyyy-MM-dd hh24:mi:ss') ";
  1431. }
  1432. if (StringUtils.isNotBlank(parmas.get("CERT_INST_NAME").toString())) {
  1433. sql +=" and t.cert_inst_name = '"+parmas.get("CERT_INST_NAME")+"' ";
  1434. }
  1435. if (StringUtils.isNotBlank(parmas.get("BATCH_NO").toString())) {
  1436. sql +=" and t.BATCH_NO = '"+parmas.get("BATCH_NO")+"' ";
  1437. }
  1438. if (StringUtils.isNotBlank(parmas.get("DESIGN_KEY").toString())) {
  1439. sql +=" and t.DESIGN_KEY = '"+parmas.get("DESIGN_KEY")+"' ";
  1440. }
  1441. if (StringUtils.isNotBlank(parmas.get("STEEL_CODE").toString())) {
  1442. sql +=" and t.STEEL_CODE = '"+parmas.get("STEEL_CODE")+"' ";
  1443. }
  1444. if (parmas.get("PLINENAME").toString().equals("全部")) {
  1445. sql +=" and t.pline_code in ('ZB1','HB1') ";
  1446. }else{
  1447. sql +=" and t.pline_code ='"+parmas.get("PLINENAME")+"' ";
  1448. }
  1449. List<HashMap> listEle= mapper.query(sql.toString());
  1450. cro.setResult(listEle);
  1451. } catch (Exception ex) {
  1452. cro.setV_errCode(-1);
  1453. cro.setV_errMsg("查询失败!"+ex.getMessage());
  1454. SqlSession.rollback();
  1455. }
  1456. SqlSession.close();
  1457. return cro;
  1458. }
  1459. //新
  1460. /**
  1461. * 查询库存数据厚板线
  1462. * @param strDate
  1463. * @param endDate
  1464. * @param orgName
  1465. * @param batch
  1466. * @param design_key
  1467. * @return
  1468. */
  1469. public CoreReturnObject QueryKSInfo(String starttime,String endtime,String batch_no,String org_name,String design_key,String prod_namemome,String radio,String radioYN) {
  1470. String sql2="";
  1471. String sql3="";
  1472. if (StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)) {
  1473. String sky=StrSky(starttime,endtime);
  1474. if(sky.equals("FALSE")){
  1475. SqlSession.close();
  1476. cro.setV_errCode(-1);
  1477. cro.setV_errMsg("查询时间不能大于半年,请核实查询时间条件!");
  1478. return cro;
  1479. }
  1480. }
  1481. if(StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)){
  1482. sql2 +=" and t.creattime >= to_date('"+starttime+" 00:00:00', 'yyyy-MM-dd hh24:mi:ss')";
  1483. sql2 +=" and t.creattime <= to_date('"+endtime+" 23:59:59', 'yyyy-MM-dd hh24:mi:ss') ";
  1484. }
  1485. if(!"".equals(org_name)){
  1486. sql2 +=" and P.CERT_INST_NAME = '"+org_name+"' ";
  1487. }
  1488. sql3 +=" where 1=1 ";
  1489. if(!"".equals(batch_no)){
  1490. sql3 +=" and t.BATCH_NO like '"+batch_no+"%' ";
  1491. }
  1492. if(!"".equals(prod_namemome)){
  1493. sql3 +=" and t.PSC_DESC like '"+prod_namemome+"%' ";
  1494. }
  1495. if(!"".equals(design_key)){
  1496. sql3 +=" and t.DESIGN_KEY like '"+design_key+"%' ";
  1497. }
  1498. if(radio.equals("1")){
  1499. sql3 +=" and t.PHYFSTSRESULT = '1' ";
  1500. }else if(radio.equals("0")){
  1501. sql3 +=" and t.PHYFSTSRESULT <> '1' ";
  1502. }
  1503. if(radioYN.equals("1")){
  1504. sql3 +=" and t.PHYFSTSRESULT1 = '船检合格' ";
  1505. }else if(radioYN.equals("0")){
  1506. sql3 +=" and t.PHYFSTSRESULT1 = '待判' ";
  1507. }
  1508. String sql ="select * from (SELECT distinct T.BILLETID MATERIAL_NO, "
  1509. +" '' VESSEL, "
  1510. +" P.DELIVERY_STATE_CODE, "
  1511. +" P.DELIVERY_STATE_DESC, "
  1512. +" TO_CHAR(A.SENDBEGINDATE, 'YYYY-MM-DD') DELIVERY_DATE, "
  1513. +" C2N@XGCX(T.CUTSIDESTATE) CUT_TYPE, "
  1514. +" T.STOVENO HEAT_NO, "
  1515. +" T.ROLLNUMBER BATCH_NO, "
  1516. +" Z.BILLETID_JY INSPECTION_LOT, "
  1517. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  1518. +" T.PLY THICK, "
  1519. +" T.WIDTH, "
  1520. +" T.LENGTH, "
  1521. +" T.THEORYWEIGHT MAT_WEIGHT, "
  1522. +" '4001HB1' PLINE_CODE, "
  1523. +" '厚板线' PLINE_NAME, "
  1524. +" P.CERT_INST_CODE CERT_INST_CODE, "
  1525. +" case when P.THREE_MEMO is not null then P.THREE_MEMO else dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) "
  1526. +" from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY )) end CERT_INST_NAME, "
  1527. +" P.CREATE_ID, "
  1528. +" P.CREATE_NAME, "
  1529. +" P.PSC, "
  1530. +" P.PROD_CODE, "
  1531. +" P.PROD_NAME, "
  1532. +" P.STEEL_CODE, "
  1533. +" P.STEEL_NAME, "
  1534. +" P.STD_CODE, "
  1535. +" P.STD_NAME, "
  1536. +" A.ORDERNO DESIGN_KEY, "
  1537. +" P.PSC_DESC, "
  1538. +" case when z.JUDGERESULT = 1 then '1' else Z.fst_judgeresult end PHYFSTSRESULT,"
  1539. +" case when substr(P.DESIGN_KEY,0,2) = '19' then '非计划' "
  1540. +" else decode(z.JUDGERESULT, '1', '船检合格', '待判') end PHYFSTSRESULT1, "
  1541. +" A.PACTNO 合同号, "
  1542. +" (select inceptcorpname from sel_inceptcorpinfo@xgcx where INCEPTCORPCODE = A.INCEPTCORPCODE) INCEPTCORPCODE, "
  1543. +" (select buyername from sel_buyerbaseinfo@xgcx where buyercode = A.BUYERCODE) BUYERCODE, to_char(t.creattime,'yyyy-MM-dd hh24:mi:ss') 创建时间,"
  1544. +" to_char(Z.fst_judge_time, 'yyyy-MM-dd hh24:mi:ss') 初检时间 "
  1545. +" FROM KCH_TURNOFFLIST@XGCX T, "
  1546. +" SEL_PACTDETAIL_NEW@XGCX A, "
  1547. +" QCM_JHY_SAMPLE_R_ORD P, "
  1548. +" ZJ_RESULT_ALL@XGCX Z "
  1549. +" WHERE A.ORDERNO = T.ALLOTORDERFORM "
  1550. +" AND A.PSRNO = P.PSC "
  1551. +" and to_char(T.PLY, 'fm990.099') = to_char(p.thick, 'fm990.099') "
  1552. +" and A.STEELCODE= t.DETERMINANTCARDNUMBER "
  1553. +" and A.STEELCODE = p.steel_code "
  1554. +" and t.DETERMINANTCARDNUMBER = p.steel_code "
  1555. +" and t.ROLLNUMBER = p.batch_no "
  1556. +" AND Z.BILLETID = T.BILLETID "
  1557. +" and P.DELIVERY_STATE_DESC = A.STANDSTATUS "
  1558. +" AND T.BILLETID NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where d.steel_code=p.steel_code and (d.Validflag is null or d.validflag='0')) "
  1559. +" AND P.CERT_INST_CODE != '5000' "
  1560. + " and P.CERT_INST_CODE != 'IC003' "
  1561. + " and P.CERT_INST_CODE != 'IC004' "
  1562. + " and P.CERT_INST_CODE != 'IC001' "
  1563. + " and P.CERT_INST_CODE != 'IC010'"
  1564. + " and Z.BILLETID_JY like T.ROLLNUMBER||'%' and T.ROLLNUMBER LIKE 'H%'"
  1565. + sql2
  1566. + ")t"
  1567. + sql3
  1568. +"union"
  1569. +" select * from (SELECT distinct T.BILLETID MATERIAL_NO, "
  1570. +" '' VESSEL, "
  1571. +" P.DELIVERY_STATE_CODE, "
  1572. +" P.DELIVERY_STATE_DESC, "
  1573. +" TO_CHAR(A.SENDBEGINDATE, 'YYYY-MM-DD') DELIVERY_DATE, "
  1574. +" C2N@XGCX(T.CUTSIDESTATE) CUT_TYPE, "
  1575. +" T.STOVENO HEAT_NO, "
  1576. +" T.ROLLNUMBER BATCH_NO, "
  1577. +" Z.BILLETID_JY INSPECTION_LOT, "
  1578. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  1579. +" T.PLY THICK, "
  1580. +" T.WIDTH, "
  1581. +" T.LENGTH, "
  1582. +" T.THEORYWEIGHT MAT_WEIGHT, "
  1583. +" '4001HB1' PLINE_CODE, "
  1584. +" '厚板线' PLINE_NAME, "
  1585. +" P.CERT_INST_CODE CERT_INST_CODE, "
  1586. +" case when P.THREE_MEMO is not null then P.THREE_MEMO else dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) "
  1587. +" from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY )) end CERT_INST_NAME, "
  1588. +" P.CREATE_ID, "
  1589. +" P.CREATE_NAME, "
  1590. +" P.PSC, "
  1591. +" P.PROD_CODE, "
  1592. +" P.PROD_NAME, "
  1593. +" P.STEEL_CODE, "
  1594. +" P.STEEL_NAME, "
  1595. +" P.STD_CODE, "
  1596. +" P.STD_NAME, "
  1597. +" A.ORDERNO DESIGN_KEY, "
  1598. +" P.PSC_DESC, "
  1599. +" case when z.JUDGERESULT = 1 then '1' else Z.fst_judgeresult end PHYFSTSRESULT,"
  1600. +" case when substr(P.DESIGN_KEY,0,2) = '19' then '非计划' "
  1601. +" else decode(z.JUDGERESULT, '1', '船检合格', '待判') end PHYFSTSRESULT1, "
  1602. +" A.PACTNO 合同号, "
  1603. +" (select inceptcorpname from sel_inceptcorpinfo@xgcx where INCEPTCORPCODE = A.INCEPTCORPCODE) INCEPTCORPCODE, "
  1604. +" (select buyername from sel_buyerbaseinfo@xgcx where buyercode = A.BUYERCODE) BUYERCODE, to_char(t.creattime,'yyyy-MM-dd hh24:mi:ss') 创建时间,"
  1605. +" to_char(Z.fst_judge_time, 'yyyy-MM-dd hh24:mi:ss') 初检时间 "
  1606. +" FROM KCH_TURNOFFLIST@XGCX T, "
  1607. +" SEL_PACTDETAIL_NEW@XGCX A, "
  1608. +" QCM_JHY_SAMPLE_R_ORD P, "
  1609. +" ZJ_RESULT_ALL@XGCX Z "
  1610. +" WHERE A.ORDERNO = T.ALLOTORDERFORM "
  1611. +" and to_char(T.PLY, 'fm990.099') = to_char(p.thick, 'fm990.099') "
  1612. +" and A.STEELCODE= t.DETERMINANTCARDNUMBER "
  1613. +" and t.ROLLNUMBER = p.batch_no "
  1614. +" AND Z.BILLETID = T.BILLETID "
  1615. +" and p.inspection_lot= Z.BILLETID_JY "
  1616. +" and P.DELIVERY_STATE_DESC = A.STANDSTATUS "
  1617. +" AND T.BILLETID NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where d.steel_code=p.steel_code and (d.Validflag is null or d.validflag='0')) "
  1618. +" AND P.CERT_INST_CODE != '5000' "
  1619. + " and P.CERT_INST_CODE != 'IC003' "
  1620. + " and P.CERT_INST_CODE != 'IC004' "
  1621. + " and (P.CERT_INST_CODE != 'IC001' or (P.CERT_INST_CODE = 'IC001' AND LENGTH(P.THREE_MEMO)>=6) ) "
  1622. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社,中国船级社') "
  1623. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('检测中心,挪威船级社') "
  1624. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社') "
  1625. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('韩国船级社,挪威船级社') "
  1626. + " and P.CERT_INST_CODE != 'IC010'"
  1627. + " and Z.BILLETID_JY like T.ROLLNUMBER||'%' and T.ROLLNUMBER LIKE 'H%'"
  1628. + sql2
  1629. + ")t "+sql3
  1630. +" and t.CERT_INST_CODE != 'IC001' "
  1631. +" AND T.MATERIAL_NO NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where D.CREATE_TIME <= TO_DATE('2024-12-18 00:00:00','YYYY-MM-DD HH24:MI:SS') )";
  1632. StringBuffer sqlucomm = new StringBuffer();
  1633. sqlucomm.append(sql);
  1634. try {
  1635. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1636. cro.setResult(listEle);
  1637. } catch (Exception ex) {
  1638. cro.setV_errCode(-1);
  1639. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  1640. SqlSession.rollback();
  1641. }
  1642. SqlSession.close();
  1643. return cro;
  1644. }
  1645. /**
  1646. * 查询库存数据中板线
  1647. * @param strDate
  1648. * @param endDate
  1649. * @param orgName
  1650. * @param batch
  1651. * @param design_key
  1652. * @return
  1653. * */
  1654. public CoreReturnObject QueryKczInfo(String starttime,String endtime,String batch_no,String org_name,String design_key,String prod_namemome, String radio,String radioYN) {
  1655. String sql2="";
  1656. String sql3="";
  1657. if (StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)) {
  1658. String sky=StrSky(starttime,endtime);
  1659. if(sky.equals("FALSE")){
  1660. SqlSession.close();
  1661. cro.setV_errCode(-1);
  1662. cro.setV_errMsg("查询时间不能大于半年,请核实查询时间条件!");
  1663. return cro;
  1664. }
  1665. }
  1666. if(StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)){
  1667. sql2 +=" and t.creattime >= to_date('"+starttime+" 00:00:00', 'yyyy-MM-dd hh24:mi:ss')";
  1668. sql2 +=" and t.creattime <= to_date('"+endtime+" 23:59:59', 'yyyy-MM-dd hh24:mi:ss') ";
  1669. }
  1670. if(!"".equals(org_name)){
  1671. sql2 +=" and P.CERT_INST_NAME = '"+org_name+"' ";
  1672. }
  1673. sql3 +=" where 1=1 ";
  1674. if(!"".equals(batch_no)){
  1675. sql3 +=" and t.BATCH_NO like '"+batch_no+"%' ";
  1676. }
  1677. if(!"".equals(prod_namemome)){
  1678. sql3 +=" and t.PSC_DESC like '"+prod_namemome+"%' ";
  1679. }
  1680. if(!"".equals(design_key)){
  1681. sql3 +=" and t.DESIGN_KEY like '"+design_key+"%' ";
  1682. }
  1683. if(radio.equals("1")){
  1684. sql3 +=" and t.PHYFSTSRESULT = '1' ";//fst_judgeresult
  1685. }else if(radio.equals("0")){
  1686. sql3 +=" and t.PHYFSTSRESULT <> '1' ";
  1687. }
  1688. if(radioYN.equals("1")){
  1689. sql3 +=" and t.PHYFSTSRESULT1 = '船检合格' ";
  1690. }else if(radioYN.equals("0")){
  1691. sql3 +=" and t.PHYFSTSRESULT1 = '待判' ";
  1692. }
  1693. if(StringUtils.isNotBlank(starttime)&& StringUtils.isNotBlank(endtime)){
  1694. sql3 +=" and t.创建时间 >= '"+starttime+" 00:00:00' ";
  1695. sql3 +=" and t.创建时间 <= '"+endtime+" 24:00:00' ";
  1696. }
  1697. String sql = "select * from ( SELECT distinct T.BILLETID MATERIAL_NO, "
  1698. +" '' VESSEL, "
  1699. +" P.DELIVERY_STATE_CODE, "
  1700. +" P.DELIVERY_STATE_DESC, "
  1701. +" TO_CHAR(A.SENDBEGINDATE, 'YYYY-MM-DD') DELIVERY_DATE, "
  1702. +" C2N@XGCX(T.CUTSIDESTATE) CUT_TYPE, "
  1703. +" T.STOVENO HEAT_NO, "
  1704. +" T.ROLLNUMBER BATCH_NO, "
  1705. +" Z.BILLETID_JY INSPECTION_LOT, "
  1706. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  1707. +" T.PLY THICK, "
  1708. +" T.WIDTH, "
  1709. +" T.LENGTH, "
  1710. +" T.THEORYWEIGHT MAT_WEIGHT, "
  1711. +" '4001ZB1' PLINE_CODE, "
  1712. +" '中板线' PLINE_NAME, "
  1713. +" P.CERT_INST_CODE CERT_INST_CODE, "
  1714. +" case when P.THREE_MEMO is not null then P.THREE_MEMO else dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) "
  1715. +" from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY )) end CERT_INST_NAME, "
  1716. +" P.CREATE_ID, "
  1717. +" P.CREATE_NAME, "
  1718. +" P.PSC, "
  1719. +" P.PROD_CODE, "
  1720. +" P.PROD_NAME, "
  1721. +" P.STEEL_CODE, "
  1722. +" P.STEEL_NAME, "
  1723. +" P.STD_CODE, "
  1724. +" P.STD_NAME, "
  1725. +" A.ORDERNO DESIGN_KEY, "
  1726. +" P.PSC_DESC, "
  1727. +" case when z.JUDGERESULT = 1 then '1' else Z.fst_judgeresult end PHYFSTSRESULT,"
  1728. +" case when substr(P.DESIGN_KEY,0,2) = '19' then '非计划' "
  1729. +" else decode(z.JUDGERESULT, '1', '船检合格', '待判') end PHYFSTSRESULT1, "
  1730. +" A.PACTNO 合同号, "
  1731. +" (select inceptcorpname from sel_inceptcorpinfo@xgcx where INCEPTCORPCODE = A.INCEPTCORPCODE) INCEPTCORPCODE, "
  1732. +" (select buyername from sel_buyerbaseinfo@xgcx where buyercode = A.BUYERCODE) BUYERCODE,to_char(t.creattime,'yyyy-MM-dd hh24:mi:ss') 创建时间 ,"
  1733. + " to_char(Z.fst_judge_time, 'yyyy-MM-dd hh24:mi:ss') 初检时间 "
  1734. +" FROM KCZ_TURNOFFLIST@XGCX T, "
  1735. +" SEL_PACTDETAIL_NEW@XGCX A, "
  1736. +" QCM_JHY_SAMPLE_R_ORD P, "
  1737. +" ZJ_RESULT_ALL@XGCX Z "
  1738. +" WHERE A.ORDERNO = T.ORDERNO "
  1739. +" AND A.PSRNO = P.PSC and T.PLY = p.thick "
  1740. +" and t.ROLLNUMBER = p.batch_no "
  1741. +" AND Z.BILLETID = T.BILLETID "
  1742. +" and P.DELIVERY_STATE_DESC = A.STANDSTATUS "
  1743. +" AND T.BILLETID NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where d.steel_code=p.steel_code and (d.Validflag is null or d.validflag='0')) "
  1744. +" and t.ISVALID <> '0' "
  1745. +" AND P.CERT_INST_CODE != '5000' "
  1746. + " and P.CERT_INST_CODE != 'IC003' "
  1747. + " and P.CERT_INST_CODE != 'IC004' "
  1748. + " and P.CERT_INST_CODE != 'IC001' "
  1749. + " and P.CERT_INST_CODE != 'IC010'"
  1750. + " and P.INSPECTION_LOT like T.ROLLNUMBER||'%' and T.ROLLNUMBER LIKE 'Z%' "
  1751. + sql2
  1752. + ")t"+sql3
  1753. +" union "
  1754. +" select * from ( SELECT distinct T.BILLETID MATERIAL_NO, "
  1755. +" '' VESSEL, "
  1756. +" P.DELIVERY_STATE_CODE, "
  1757. +" P.DELIVERY_STATE_DESC, "
  1758. +" TO_CHAR(A.SENDBEGINDATE, 'YYYY-MM-DD') DELIVERY_DATE, "
  1759. +" C2N@XGCX(T.CUTSIDESTATE) CUT_TYPE, "
  1760. +" T.STOVENO HEAT_NO, "
  1761. +" T.ROLLNUMBER BATCH_NO, "
  1762. +" Z.BILLETID_JY INSPECTION_LOT, "
  1763. +" T.MOTHERBOARDNUMBER BOARD_NO, "
  1764. +" T.PLY THICK, "
  1765. +" T.WIDTH, "
  1766. +" T.LENGTH, "
  1767. +" T.THEORYWEIGHT MAT_WEIGHT, "
  1768. +" '4001ZB1' PLINE_CODE, "
  1769. +" '中板线' PLINE_NAME, "
  1770. +" P.CERT_INST_CODE CERT_INST_CODE, "
  1771. +" case when P.THREE_MEMO is not null then P.THREE_MEMO else dbms_lob.substr((select wmsys.wm_concat(DISTINCT Org_Name) "
  1772. +" from qcm_ord_design_std_pic c where c.design_key = P.DESIGN_KEY )) end CERT_INST_NAME, "
  1773. +" P.CREATE_ID, "
  1774. +" P.CREATE_NAME, "
  1775. +" P.PSC, "
  1776. +" P.PROD_CODE, "
  1777. +" P.PROD_NAME, "
  1778. +" P.STEEL_CODE, "
  1779. +" P.STEEL_NAME, "
  1780. +" P.STD_CODE, "
  1781. +" P.STD_NAME, "
  1782. +" A.ORDERNO DESIGN_KEY, "
  1783. +" P.PSC_DESC, "
  1784. +" case when z.JUDGERESULT = 1 then '1' else Z.fst_judgeresult end PHYFSTSRESULT,"
  1785. +" case when substr(P.DESIGN_KEY,0,2) = '19' then '非计划' "
  1786. +" else decode(z.JUDGERESULT, '1', '船检合格', '待判') end PHYFSTSRESULT1, "
  1787. +" A.PACTNO 合同号, "
  1788. +" (select inceptcorpname from sel_inceptcorpinfo@xgcx where INCEPTCORPCODE = A.INCEPTCORPCODE) INCEPTCORPCODE, "
  1789. +" (select buyername from sel_buyerbaseinfo@xgcx where buyercode = A.BUYERCODE) BUYERCODE,to_char(t.creattime,'yyyy-MM-dd hh24:mi:ss') 创建时间 ,"
  1790. +" to_char(Z.fst_judge_time, 'yyyy-MM-dd hh24:mi:ss') 初检时间 "
  1791. +" FROM KCZ_TURNOFFLIST@XGCX T, "
  1792. +" SEL_PACTDETAIL_NEW@XGCX A, "
  1793. +" QCM_JHY_SAMPLE_R_ORD P, "
  1794. +" ZJ_RESULT_ALL@XGCX Z "
  1795. +" WHERE A.ORDERNO = T.ORDERNO "
  1796. +" and to_char(T.PLY, 'fm990.099') = to_char(p.thick, 'fm990.099')"
  1797. +" and t.ROLLNUMBER = p.batch_no "
  1798. +" AND Z.BILLETID = T.BILLETID "
  1799. +" and p.inspection_lot = Z.BILLETID_JY "
  1800. +" and P.DELIVERY_STATE_DESC = A.STANDSTATUS "
  1801. +" AND T.BILLETID NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where d.steel_code=p.steel_code and (d.Validflag is null or d.validflag='0')) "
  1802. +" and t.ISVALID <> '0' "
  1803. +" AND P.CERT_INST_CODE != '5000' "
  1804. + " and P.CERT_INST_CODE != 'IC003' "
  1805. + " and P.CERT_INST_CODE != 'IC004' "
  1806. + " and (P.CERT_INST_CODE != 'IC001' or (P.CERT_INST_CODE = 'IC001' AND LENGTH(P.THREE_MEMO)>=6) ) "
  1807. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社,中国船级社') "
  1808. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('检测中心,挪威船级社') "
  1809. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('挪威船级社') "
  1810. + " AND nvl(P.THREE_MEMO,'null') NOT IN ('韩国船级社,挪威船级社') "
  1811. + " and P.CERT_INST_CODE != 'IC010'"
  1812. + " and P.INSPECTION_LOT like T.ROLLNUMBER||'%' and T.ROLLNUMBER LIKE 'Z%' "
  1813. + sql2
  1814. + ")t"+sql3
  1815. +" and t.CERT_INST_CODE != 'IC001' "
  1816. +" AND T.MATERIAL_NO NOT IN (SELECT D.MATERIAL_NO FROM QCM_MAT_CERT_D D where D.CREATE_TIME <= TO_DATE('2024-12-18 00:00:00','YYYY-MM-DD HH24:MI:SS') )";
  1817. StringBuffer sqlucomm = new StringBuffer();
  1818. sqlucomm.append(sql);
  1819. //System.out.println(sql);
  1820. try {
  1821. List<HashMap> listEle= mapper.query(sqlucomm.toString());
  1822. cro.setResult(listEle);
  1823. } catch (Exception ex) {
  1824. cro.setV_errCode(-1);
  1825. cro.setV_errMsg("获取数据出错"+ex.getMessage());
  1826. SqlSession.rollback();
  1827. }
  1828. SqlSession.close();
  1829. return cro;
  1830. }
  1831. }