233a9f6a00936f3cfcaa35915d3042e196244f35.svn-base 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883
  1. package xin.glue.ui.H.H02;
  2. import java.math.BigDecimal;
  3. import java.sql.CallableStatement;
  4. import java.sql.SQLException;
  5. import java.text.DateFormat;
  6. import java.text.SimpleDateFormat;
  7. import java.util.Date;
  8. import xin.glue.nui.G.G02.SmsProgTcSend;
  9. import xin.glue.ui.common.ProduceFactory;
  10. import com.posdata.glue.PosException;
  11. import com.posdata.glue.biz.activity.PosActivity;
  12. import com.posdata.glue.biz.constants.PosBizControlConstants;
  13. import com.posdata.glue.biz.control.PosBizControlIF;
  14. import com.posdata.glue.biz.control.PosBizProvider;
  15. import com.posdata.glue.component.PosConstants;
  16. import com.posdata.glue.context.PosContext;
  17. import com.posdata.glue.dao.vo.PosParameter;
  18. import com.posdata.glue.dao.vo.PosRow;
  19. import com.posdata.glue.dao.vo.PosRowSet;
  20. import com.posdata.glue.msg.PosMESMessageImpl;
  21. import com.posdata.glue.msg.PosMessage;
  22. import com.posdata.glue.util.log.PosLog;
  23. import com.posdata.glue.util.log.PosLogFactory;
  24. public class PosSaveMillResult extends PosActivity
  25. {
  26. static PosLog logger = PosLogFactory.getLogger(PosSaveMillResult.class);
  27. public String runActivity(PosContext context)
  28. {
  29. logger.logInfo(" UIH020030 PosSaveMillResult save ");
  30. //从页面获取的数据
  31. String[] MSG_SLAB_NO = (String[])context.get("SLAB_NO");
  32. String[] MSG_COIL_NO = (String[])context.get("COIL_NO");
  33. //统计日
  34. String[] MSG_XIN_DATE = (String[])context.get("XIN_DATE");
  35. String[] MSG_WKSHIFT = (String[])context.get("WKSHIFT");
  36. String[] MSG_WKGROUP = (String[])context.get("WKGROUP");
  37. String[] MSG_WK_EMP_NO = (String[])context.get("WK_EMP_NO");
  38. String[] MSG_COIL_THK = (String[])context.get("COIL_THK");
  39. String[] MSG_COIL_WTH = (String[])context.get("COIL_WTH");
  40. String[] MSG_COIL_LTH = (String[])context.get("COIL_LEN");
  41. //实际重量
  42. String[] MSG_ACT_WGT = (String[])context.get("ACT_WGT");
  43. String[] MSG_COIL_OUTDIA = (String[])context.get("COIL_OUTDIA");
  44. String[] MSG_COIL_INDIA = (String[])context.get("COIL_INDIA");
  45. String[] MSG_DC_NO = (String[])context.get("DC_NO");
  46. String[] MSG_DC_ON_DTIME = (String[])context.get("DC_ON_DTIME");
  47. String[] MSG_DC_OFF_DTIME = (String[])context.get("DC_OFF_DTIME");
  48. //区分代码
  49. String[] MSG_MISSNO_CLF_CD = (String[])context.get("MISSNO_CLF_CD");
  50. //理由代码
  51. String[] MSG_MISSNO_CAUSE_CD = (String[])context.get("MISSNO_CAUSE_CD");
  52. //区域代码
  53. String[] MISSNO_CAUSE_QY = (String[])context.get("MISSNO_CAUSE_QY");
  54. //发生时间
  55. String[] MSG_MISSNO_DTIME = (String[])context.get("MISSNO_DTIME");
  56. //废弃宽度
  57. String[] MISSNO_BAR_THK = (String[])context.get("MISSNO_BAR_THK");
  58. //废弃厚度
  59. String[] MISSNO_BAR_WTH = (String[])context.get("MISSNO_BAR_WTH");
  60. //废弃重量
  61. String[] MISSNO_BAR_WGT = (String[])context.get("MISSNO_BAR_WGT");
  62. //登录人
  63. String[] REG_ID = (String[])context.get("REG_ID");
  64. //登录人
  65. String[] CHKUPD = (String[])context.get("CHKUPD");
  66. //这里加入加热炉入炉状态控制,只有为2的状态才可以继续进行操作
  67. PosParameter paramw = new PosParameter();
  68. paramw.setWhereClauseParameter(0, MSG_SLAB_NO[0]);
  69. paramw.setWhereClauseParameter(1, MSG_COIL_NO[0]);
  70. PosRowSet slabVow = getDao("mesdao").find("UIH020030_03.select", paramw);
  71. String RHF_STAT = null;
  72. //捕获数据格式异常,不抛出写入日志中。避免内存溢出
  73. try{
  74. //这里的状态用于表示,钢卷如果吊销或者加回的情况下。不能录入轧制实际
  75. if(slabVow.hasNext()){
  76. PosRow Vow = slabVow.next();
  77. RHF_STAT = (String) Vow.getAttribute("RHF_STAT");
  78. }
  79. //这里只有出过炉的和轧过的才可以进行轧制实际操作
  80. if(RHF_STAT.equals("2") || RHF_STAT.equals("4")||RHF_STAT.equals("3")){
  81. if (MSG_DC_OFF_DTIME[0] == null || MSG_DC_OFF_DTIME[0].equals("")) {
  82. DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
  83. MSG_DC_OFF_DTIME[0] = formatter.format(new Date());
  84. }
  85. String sqlc = "SELECT COIL_NO,nvl(WGT_TIME,to_char(sysdate,'yyyymmddhh24miss')) WGT_TIME FROM TBH02_COIL_COMM WHERE COIL_NO = ?";
  86. String timec;
  87. Date datec = new Date();
  88. DateFormat sdfc = new SimpleDateFormat("yyyyMMddHHmmss");
  89. //这里取出钢卷状态,如果为1的情况说明是出过炉的可以调用轧制和废弃品质和进程。如果为2是轧制过的,只能调用废弃的品质和进程.如果是为3是轧过或者做过其它处理就不调用品质和进程
  90. PosParameter paramc = new PosParameter();
  91. paramc.setWhereClauseParameter(0,MSG_COIL_NO[0] );
  92. PosRowSet CoilVo1 = getDao("mesdao").findByQueryStatement(sqlc, paramc);
  93. /* if (CoilVo1.hasNext()) {
  94. PosRow CoilROW = CoilVo1.next();
  95. //根据钢卷接收的二级电文时间与保存时间对比,超过24小时不允许修改
  96. //如果前端传入参数CHKUPD为1,表示特殊权限运行修改 20190518 wl
  97. timec = (String)CoilROW.getAttribute("WGT_TIME");
  98. Date d = sdfc.parse(timec); // 将日期和时间的字符串表示形式转换为其等效的 DateTime。
  99. int hours = (int) ((datec.getTime() - d.getTime()) / (1000 * 60 * 60));
  100. if(hours>24)
  101. {
  102. if(CHKUPD==null||!"1".equals(CHKUPD[0]))
  103. {
  104. String vtemp="TST";
  105. context.put("rs", vtemp);
  106. return PosBizControlConstants.SUCCESS;
  107. }
  108. }
  109. }*/ //20220112王小云要求去掉限制
  110. Number CalWgt = null;
  111. String sql0 = "SELECT SLAB_WGT,CUR_PROG_CD,SLAB_THK,SLAB_WTH,SLAB_LEN from TBG02_SLAB_COMM WHERE SLAB_NO = ?";
  112. PosParameter param4 = new PosParameter();
  113. param4.setWhereClauseParameter(0,MSG_SLAB_NO[0]);
  114. PosRowSet slabVo = getDao("mesdao").findByQueryStatement(sql0, param4);
  115. Number SlabWgt = null;
  116. //所有的单位都为MM,具体的转换等业务人员确定
  117. Number SlabThk = null;
  118. Number SlabWth = null;
  119. Number SlabLen = null;
  120. if (slabVo.hasNext() ) {
  121. PosRow slabROW = slabVo.next();
  122. //这里没有 CHRGING_BEF_WGT 用 SLAB_WGT 板坯重量
  123. SlabWgt = (Number)slabROW.getAttribute("SLAB_WGT");
  124. SlabThk = (Number)slabROW.getAttribute("SLAB_THK");
  125. SlabWth = (Number)slabROW.getAttribute("SLAB_WTH");
  126. SlabLen = (Number)slabROW.getAttribute("SLAB_LEN");
  127. //现在进程状态,后面没有用到
  128. //SlabProgCd = (String)slabROW.getAttribute("CUR_PROG_CD");
  129. }
  130. if (SlabWgt != null ) {
  131. //这里的计算重量需要业务人员确认
  132. CalWgt = SlabWgt;
  133. }
  134. String CoilLth =null;
  135. if (MSG_COIL_LTH[0] == null || MSG_COIL_LTH[0].equals("")) {
  136. if(MSG_COIL_WTH[0] != null || MSG_COIL_THK[0] != null ) {
  137. String sqlCal = "SELECT TO_CHAR(ROUND((?*?*?)/(?*?),1)) COIL_LTH from dual ";
  138. PosParameter paramu = new PosParameter();
  139. paramu.setWhereClauseParameter(0,SlabThk);
  140. paramu.setWhereClauseParameter(1,SlabWth);
  141. paramu.setWhereClauseParameter(2,SlabLen);
  142. paramu.setWhereClauseParameter(3,MSG_COIL_THK[0]);
  143. paramu.setWhereClauseParameter(4,MSG_COIL_WTH[0]);
  144. PosRowSet calVo = getDao("mesdao").findByQueryStatement(sqlCal, paramu);
  145. if (calVo.hasNext()) {
  146. PosRow calROW = calVo.next();
  147. CoilLth = (String)calROW.getAttribute("COIL_LTH");
  148. logger.logInfo("PosSaveMillResult 如果钢卷长度的计算公式:slab_thk*slab_wth*slab_len/coil_thk*coil_wth 单位为mm");
  149. logger.logInfo("PosSaveMillResult 如果钢卷长度为空的情况下,长度为 :"+CoilLth);
  150. }
  151. }
  152. if (CoilLth != null ) {
  153. MSG_COIL_LTH[0] = CoilLth;
  154. }
  155. }
  156. String sql = "SELECT * from TBH02_MILL_RESULT WHERE COIL_NO = ?";
  157. PosParameter param0 = new PosParameter();
  158. param0.setWhereClauseParameter(0,MSG_COIL_NO[0] );
  159. PosRowSet millVo = getDao("mesdao").findByQueryStatement(sql, param0);
  160. PosParameter param1 = new PosParameter();
  161. PosParameter param2 = new PosParameter();
  162. PosParameter param22 = new PosParameter();
  163. PosParameter param3 = new PosParameter();
  164. PosParameter param11 = new PosParameter();
  165. PosParameter param12 = new PosParameter();
  166. PosParameter param33 = new PosParameter();
  167. //查询钢卷轧制实际中是否存在值
  168. if(millVo.hasNext()){
  169. param1.setValueParamter(0,MSG_XIN_DATE[0] );
  170. param1.setValueParamter(1,MSG_WKSHIFT[0] );
  171. param1.setValueParamter(2,MSG_WKGROUP[0] );
  172. param1.setValueParamter(3,MSG_WK_EMP_NO[0] );
  173. param1.setValueParamter(4,MSG_COIL_THK[0] );
  174. param1.setValueParamter(5,MSG_COIL_WTH[0] );
  175. param1.setValueParamter(6,MSG_COIL_LTH[0] );
  176. param1.setValueParamter(7,MSG_ACT_WGT[0] );
  177. param1.setValueParamter(8,MSG_COIL_OUTDIA[0] );
  178. param1.setValueParamter(9,MSG_COIL_INDIA[0] );
  179. param1.setValueParamter(10,MSG_DC_NO[0] );
  180. param1.setValueParamter(11,MSG_DC_ON_DTIME[0] );
  181. param1.setValueParamter(12,MSG_DC_OFF_DTIME[0] );
  182. param1.setValueParamter(13,MSG_MISSNO_CLF_CD[0] );
  183. param1.setValueParamter(14,MSG_MISSNO_CAUSE_CD[0] );
  184. param1.setValueParamter(15,MSG_MISSNO_DTIME[0] );
  185. param1.setValueParamter(16,MSG_SLAB_NO[0] );
  186. param1.setValueParamter(17,MISSNO_BAR_THK[0] );
  187. param1.setValueParamter(18,MISSNO_BAR_WTH[0] );
  188. param1.setValueParamter(19,MISSNO_BAR_WGT[0] );
  189. param1.setValueParamter(20,REG_ID[0] );
  190. param1.setValueParamter(21,MISSNO_CAUSE_QY[0] );
  191. param1.setValueParamter(22,MSG_COIL_NO[0] );
  192. getDao("mesdao").update("UIH020030_MILL.update", param1);
  193. }else{
  194. param1.setValueParamter(0,MSG_COIL_NO[0] );
  195. param1.setValueParamter(1,MSG_SLAB_NO[0] );
  196. param1.setValueParamter(2,MSG_XIN_DATE[0] );
  197. param1.setValueParamter(3,MSG_WKSHIFT[0] );
  198. param1.setValueParamter(4,MSG_WKGROUP[0] );
  199. param1.setValueParamter(5,MSG_WK_EMP_NO[0] );
  200. param1.setValueParamter(6,MSG_COIL_THK[0] );
  201. param1.setValueParamter(7,MSG_COIL_WTH[0] );
  202. param1.setValueParamter(8,MSG_COIL_LTH[0] );
  203. param1.setValueParamter(9,MSG_ACT_WGT[0] );
  204. param1.setValueParamter(10,MSG_COIL_OUTDIA[0] );
  205. param1.setValueParamter(11,MSG_COIL_INDIA[0] );
  206. param1.setValueParamter(12,MSG_DC_NO[0] );
  207. param1.setValueParamter(13,MSG_DC_ON_DTIME[0] );
  208. param1.setValueParamter(14,MSG_DC_OFF_DTIME[0] );
  209. param1.setValueParamter(15,MSG_MISSNO_CLF_CD[0] );
  210. param1.setValueParamter(16,MSG_MISSNO_CAUSE_CD[0] );
  211. param1.setValueParamter(17,MSG_MISSNO_DTIME[0] );
  212. param1.setValueParamter(18,MISSNO_BAR_THK[0] );
  213. param1.setValueParamter(19,MISSNO_BAR_WTH[0] );
  214. param1.setValueParamter(20,MISSNO_BAR_WGT[0] );
  215. param1.setValueParamter(21,REG_ID[0] );
  216. param1.setValueParamter(22,MISSNO_CAUSE_QY[0] );
  217. getDao("mesdao").insert("UIH020030_MILL.insert",param1);
  218. }
  219. //用来更新钢卷公共表的
  220. String SPEC_STL_GRD = null;
  221. String XIN_SPEC_STL_GRD = null;
  222. String SPEC_SPEC_ABBSYM = null;
  223. String SPEC_DEVLMT_DTIME = null;
  224. String SPEC_ORD_NO = null;
  225. String SPEC_ORD_SEQ = null;
  226. String SPEC_ORD_USE_CD = null;
  227. String ROUTE = null;
  228. BigDecimal SLAB_EDT_SEQ = null;
  229. String SPEC_ORDCUST_CD = null;
  230. String SPEC_DEST_CD = null;
  231. String SPEC_SPM_YN = null;
  232. String SpmYn = null;
  233. String SPEC_PATH_MILL_CD = null;
  234. String SPEC_PACK_METHOD = null;
  235. Number SPEC_THK = null;
  236. Number SPEC_WTH = null;
  237. Number SPEC_LEN = null;
  238. Number SPEC_WGT = null;
  239. Number SPEC_WGT_MIN = null;
  240. Number SPEC_WGT_MAX = null;
  241. Number SPEC_INDIA = null;
  242. Number SPEC_OUTDIA = null;
  243. //产品代码
  244. String SPEC_PRODNM_CD = null;
  245. //板坯重量
  246. //Number slab_wgt = null;
  247. //用来更新钢卷详细表的
  248. String COIL_CUT_SEQ = null;
  249. Number SPEC_ORD_THK = null;
  250. Number SPEC_ORD_WTH = null;
  251. Number SPEC_ORD_LEN = null;
  252. Number SPEC_ORD_WGT = null;
  253. Number SPEC_ORD_WGT_MIN = null;
  254. Number SPEC_ORD_WGT_MAX = null;
  255. Number SPEC_ORD_INDIA = null;
  256. Number SPEC_ORD_OUTDIA = null;
  257. String SPEC_ORD_FL = null;
  258. //取轧制计划中的相关信息,放入钢卷公共表中
  259. PosRowSet SpecMillVo = (PosRowSet) context.get("SpecMillResult");
  260. SpecMillVo.reset();
  261. if (SpecMillVo.hasNext() ) {
  262. PosRow SpecMillROW = SpecMillVo.next();
  263. //牌号
  264. SPEC_STL_GRD = (String)SpecMillROW.getAttribute("STL_GRD");
  265. XIN_SPEC_STL_GRD = (String)SpecMillROW.getAttribute("SPEC_STL_GRD");
  266. //标准号
  267. SPEC_SPEC_ABBSYM = (String)SpecMillROW.getAttribute("SPEC_ABBSYM");
  268. //交货期
  269. SPEC_DEVLMT_DTIME = (String)SpecMillROW.getAttribute("DELV_REQ_DATE");
  270. //合同号
  271. SPEC_ORD_NO = (String)SpecMillROW.getAttribute("ORD_NO");
  272. //订单号
  273. SPEC_ORD_SEQ = (String)SpecMillROW.getAttribute("ORD_SEQ");
  274. //订单用途代码
  275. SPEC_ORD_USE_CD = (String)SpecMillROW.getAttribute("ORD_USEAGE_CD");
  276. //定单去向
  277. ROUTE = (String)SpecMillROW.getAttribute("ROUTE");
  278. //板坯编制号
  279. SLAB_EDT_SEQ = (BigDecimal)SpecMillROW.getAttribute("SLAB_EDT_SEQ");
  280. //客户代码
  281. SPEC_ORDCUST_CD = (String)SpecMillROW.getAttribute("ORD_CUST_CD");
  282. SPEC_DEST_CD = (String)SpecMillROW.getAttribute("DEST_CD");
  283. //平整分卷指定判断
  284. SPEC_SPM_YN = (String)SpecMillROW.getAttribute("SPM_PROC_YN");
  285. //改变平整分卷标志
  286. if (SPEC_SPM_YN != null && SPEC_SPM_YN.equals("Y")) {
  287. SpmYn = "1";
  288. } else {
  289. SpmYn = "";
  290. }
  291. SPEC_PATH_MILL_CD = (String)SpecMillROW.getAttribute("PATH_MILL_CD");
  292. SPEC_PACK_METHOD = (String)SpecMillROW.getAttribute("PACK_METHOD");
  293. SPEC_THK = (Number)SpecMillROW.getAttribute("ORD_THK");
  294. SPEC_WTH = (Number)SpecMillROW.getAttribute("ORD_WTH");
  295. SPEC_LEN = (Number)SpecMillROW.getAttribute("SPEC_LEN");
  296. SPEC_WGT = (Number)SpecMillROW.getAttribute("ORD_WGT");
  297. SPEC_WGT_MIN = (Number)SpecMillROW.getAttribute("ORD_WGT_MIN");
  298. SPEC_WGT_MAX = (Number)SpecMillROW.getAttribute("ORD_WGT_MAX");
  299. SPEC_INDIA = (Number)SpecMillROW.getAttribute("ORD_INDIA");
  300. SPEC_OUTDIA = (Number)SpecMillROW.getAttribute("ORD_OUTDIA");
  301. }
  302. String StatCd = null;
  303. String ProgCd = null;
  304. if (MSG_MISSNO_CLF_CD[0] != null && !MSG_MISSNO_CLF_CD[0].equals("")) {
  305. //钢卷状态,这里只要存在废弃原因代码钢卷的状态就为3.不论中厚板还是废钢所有的废弃代码都为C
  306. StatCd = "3";
  307. } else {
  308. StatCd = "2";
  309. }
  310. // 从TBG02_SLAB_COMM中取得 产品代码 需要插入到TBH02_COIL_COMM表中
  311. param11.setWhereClauseParameter(0, MSG_SLAB_NO[0]);
  312. PosRowSet rowset1 = this.getDao("mesdao").find("NIH020050_03.select",param11);
  313. if(rowset1.hasNext()){
  314. PosRow row1 = rowset1.next();
  315. SPEC_PRODNM_CD = (String)row1.getAttribute("PRODNM_CD"); //产品代码
  316. //与后面冲突,所以屏蔽掉 TL 20100507
  317. //slab_wgt = (Number)row1.getAttribute("SLAB_WGT"); //板坯重量
  318. }
  319. String Prog_Cd = null;
  320. String COIL_STAT = null;
  321. /*
  322. String time = null;
  323. Date date = new Date();
  324. DateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
  325. */
  326. String sql2 = "SELECT COIL_NO,CUR_PROG_CD,COIL_STAT,nvl(WGT_TIME,to_char(sysdate,'yyyymmddhh24miss')) WGT_TIME FROM TBH02_COIL_COMM WHERE COIL_NO = ?";
  327. //这里取出钢卷状态,如果为1的情况说明是出过炉的可以调用轧制和废弃品质和进程。如果为2是轧制过的,只能调用废弃的品质和进程.如果是为3是轧过或者做过其它处理就不调用品质和进程
  328. param2.setWhereClauseParameter(0,MSG_COIL_NO[0] );
  329. PosRowSet CoilVo = getDao("mesdao").findByQueryStatement(sql2, param2);
  330. if (CoilVo.hasNext()) {
  331. PosRow CoilROW = CoilVo.next();
  332. ProgCd = (String)CoilROW.getAttribute("CUR_PROG_CD");
  333. COIL_STAT = (String)CoilROW.getAttribute("COIL_STAT");
  334. if (ProgCd == null || ProgCd.equals("") || ProgCd.equals("SED")|| ProgCd.equals("SRC")){//20220112王小云要求加入余材
  335. if (ProgCd!= null && !ProgCd.equals("SED")) {
  336. Prog_Cd = "SRC";
  337. } else {
  338. Prog_Cd = "SED";
  339. }
  340. // if(!MSG_MISSNO_CLF_CD[0].equals("C")){//20230307
  341. //写入操作记录 20190513 wl
  342. param33.setValueParamter(0,REG_ID[0] );
  343. param33.setValueParamter(1,MSG_COIL_NO[0] );
  344. getDao("mesdao").update("UIH020030_COIL_HIS.insert",param33);
  345. param22.setValueParamter(0,MSG_SLAB_NO[0] );
  346. param22.setValueParamter(1,StatCd );
  347. param22.setValueParamter(2,MSG_DC_OFF_DTIME[0] );
  348. param22.setValueParamter(3,MSG_COIL_THK[0] );
  349. param22.setValueParamter(4,MSG_COIL_WTH[0] );
  350. param22.setValueParamter(5,MSG_COIL_LTH[0] );
  351. //实际重量 分卷界面可以改磅重,当原磅重为空的时候此界面可以录入磅重 20211013
  352. param22.setValueParamter(6,MSG_ACT_WGT[0] );
  353. //板坯重量对应钢卷的计算重量,存在问题
  354. param22.setValueParamter(7,CalWgt );
  355. param22.setValueParamter(8,MSG_COIL_OUTDIA[0] );
  356. param22.setValueParamter(9,MSG_COIL_INDIA[0] );
  357. param22.setValueParamter(10,MSG_MISSNO_CLF_CD[0] );
  358. param22.setValueParamter(11,MSG_MISSNO_CAUSE_CD[0] );
  359. param22.setValueParamter(12,MSG_MISSNO_DTIME[0] );
  360. param22.setValueParamter(13,Prog_Cd );
  361. param22.setValueParamter(14,MSG_DC_ON_DTIME[0] );
  362. param22.setValueParamter(15,MSG_DC_OFF_DTIME[0] );
  363. param22.setValueParamter(16,MISSNO_CAUSE_QY[0] );
  364. param22.setValueParamter(17,MSG_COIL_NO[0] );
  365. //加入废钢原因、废钢处理时间、SCRAP_WGT,在输入废弃原因代码的时候
  366. getDao("mesdao").update("UIH020030_COIL.update",param22);
  367. //写入操作记录 20190513 wl
  368. param33 = new PosParameter();
  369. param33.setValueParamter(0,MSG_SLAB_NO[0] );
  370. param33.setValueParamter(1,MSG_COIL_LTH[0] );
  371. param33.setValueParamter(2,MSG_COIL_OUTDIA[0] );
  372. param33.setValueParamter(3,MSG_COIL_THK[0] );
  373. param33.setValueParamter(4,MSG_COIL_WTH[0] );
  374. param33.setValueParamter(5,MSG_ACT_WGT[0] );
  375. param33.setValueParamter(6,REG_ID[0] );
  376. getDao("mesdao").update("UIH020030_COIL_HIS2.insert",param33);
  377. //}
  378. // 更新TBH02_COIL_COMM_D表
  379. /*
  380. param12.setWhereClauseParameter(0, COIL_CUT_SEQ);
  381. param12.setWhereClauseParameter(1, SPEC_ORD_THK);
  382. param12.setWhereClauseParameter(2, SPEC_ORD_WTH);
  383. param12.setWhereClauseParameter(3, SPEC_ORD_LEN);
  384. param12.setWhereClauseParameter(4, SPEC_ORD_WGT);
  385. param12.setWhereClauseParameter(5, SPEC_ORD_WGT_MIN);
  386. param12.setWhereClauseParameter(6, SPEC_ORD_WGT_MAX);
  387. param12.setWhereClauseParameter(7, SPEC_ORD_INDIA);
  388. param12.setWhereClauseParameter(8, SPEC_ORD_OUTDIA);
  389. param12.setWhereClauseParameter(9, SPEC_ORD_NO);
  390. param12.setWhereClauseParameter(10, SPEC_ORD_SEQ);
  391. param12.setWhereClauseParameter(11, SPEC_ORD_FL);
  392. param12.setWhereClauseParameter(12, MSG_COIL_NO[0]);
  393. //这里与NIU 同步,一样的做法
  394. this.getDao("mesdao").update("NIH020050_03.update",param12);
  395. */
  396. }
  397. } else {
  398. param22.setValueParamter(0,MSG_COIL_NO[0] );
  399. param22.setValueParamter(1,MSG_SLAB_NO[0] );
  400. //卷取结束时刻 对应 轧钢时间
  401. param22.setValueParamter(2,MSG_DC_OFF_DTIME[0] );
  402. param22.setValueParamter(3,SPEC_STL_GRD );
  403. param22.setValueParamter(4,SPEC_SPEC_ABBSYM );
  404. param22.setValueParamter(5,SPEC_ORD_NO );
  405. param22.setValueParamter(6,SPEC_ORD_SEQ );
  406. param22.setValueParamter(7,SPEC_ORD_USE_CD );
  407. param22.setValueParamter(8,SPEC_PRODNM_CD );
  408. param22.setValueParamter(9,SPEC_ORD_FL );
  409. param22.setValueParamter(10,MSG_COIL_THK[0] );
  410. param22.setValueParamter(11,MSG_COIL_WTH[0] );
  411. param22.setValueParamter(12,MSG_COIL_LTH[0] );
  412. param22.setValueParamter(13,MSG_ACT_WGT[0] );
  413. param22.setValueParamter(14,CalWgt );
  414. param22.setValueParamter(15,MSG_COIL_OUTDIA[0] );
  415. param22.setValueParamter(16,MSG_COIL_INDIA [0] );
  416. param22.setValueParamter(17,MSG_MISSNO_CLF_CD[0] );
  417. param22.setValueParamter(18,MSG_MISSNO_CAUSE_CD[0] );
  418. param22.setValueParamter(19,MSG_MISSNO_DTIME[0] );
  419. //使用转换后的平整分卷标志
  420. param22.setValueParamter(20,SpmYn);
  421. param22.setValueParamter(21,SPEC_DEVLMT_DTIME );
  422. param22.setValueParamter(22,SPEC_ORDCUST_CD );
  423. param22.setValueParamter(23,SPEC_PATH_MILL_CD );
  424. param22.setValueParamter(24,SPEC_PACK_METHOD );
  425. param22.setValueParamter(25,SPEC_INDIA );
  426. param22.setValueParamter(26,SPEC_OUTDIA );
  427. param22.setValueParamter(27,SPEC_THK );
  428. param22.setValueParamter(28,SPEC_WTH );
  429. param22.setValueParamter(29,SPEC_WGT );
  430. param22.setValueParamter(30,SPEC_DEST_CD );
  431. param22.setValueParamter(31,MSG_DC_ON_DTIME[0] );
  432. param22.setValueParamter(32,MSG_DC_OFF_DTIME[0] );
  433. param22.setValueParamter(33,StatCd );
  434. param22.setValueParamter(34,XIN_SPEC_STL_GRD );
  435. param22.setValueParamter(35,MISSNO_CAUSE_QY[0] );
  436. //加入废钢原因、废钢处理时间、SCRAP_WGT,在输入废弃原因代码的时候
  437. getDao("mesdao").insert("UIH020030_COIL.insert",param22);
  438. //写入操作记录 20190513 wl
  439. param33.setValueParamter(0,MSG_SLAB_NO[0] );
  440. param33.setValueParamter(1,MSG_COIL_LTH[0] );
  441. param33.setValueParamter(2,MSG_COIL_OUTDIA[0] );
  442. param33.setValueParamter(3,MSG_COIL_THK[0] );
  443. param33.setValueParamter(4,MSG_COIL_WTH[0] );
  444. param33.setValueParamter(5,MSG_ACT_WGT[0] );
  445. param33.setValueParamter(6,REG_ID[0] );
  446. getDao("mesdao").update("UIH020030_COIL_HIS2.insert",param33);
  447. // 从TBF02_SPEC_MILL_D中取得数据 需要插入到TBH02_COIL_COMM_d表中
  448. param3.setWhereClauseParameter(0, SLAB_EDT_SEQ);
  449. PosRowSet SpecMillVo_D = this.getDao("mesdao").find("NIH020050_04.select",param3);
  450. while (SpecMillVo_D.hasNext() ) {
  451. PosRow SpecMillROW_D = SpecMillVo_D.next();
  452. //切割顺序
  453. COIL_CUT_SEQ = (String)SpecMillROW_D.getAttribute("COIL_CUT_SEQ");
  454. //订单厚度
  455. SPEC_ORD_THK = (Number)SpecMillROW_D.getAttribute("ORD_THK");
  456. // 订单宽度
  457. SPEC_ORD_WTH = (Number)SpecMillROW_D.getAttribute("ORD_WTH");
  458. // 订单长度
  459. SPEC_ORD_LEN = (Number)SpecMillROW_D.getAttribute("ORD_LEN");
  460. //订单重量
  461. SPEC_ORD_WGT = (Number)SpecMillROW_D.getAttribute("ORD_WGT");
  462. //订单重量上限
  463. SPEC_ORD_WGT_MIN = (Number)SpecMillROW_D.getAttribute("ORD_WGT_MIN");
  464. //订单重量下限
  465. SPEC_ORD_WGT_MAX = (Number)SpecMillROW_D.getAttribute("ORD_WGT_MAX");
  466. //定单内径
  467. SPEC_ORD_INDIA = (Number)SpecMillROW_D.getAttribute("ORD_INDIA");
  468. //定单外径
  469. SPEC_ORD_OUTDIA = (Number)SpecMillROW_D.getAttribute("ORD_OUTDIA");
  470. //定单余材区分
  471. SPEC_ORD_FL = (String)SpecMillROW_D.getAttribute("ORD_FL");
  472. //状态区分没有实际作用,所以不取出来
  473. //插入钢卷详细信息表,与NIU对应起来
  474. param12.setValueParamter(0, MSG_COIL_NO[0]);
  475. param12.setValueParamter(1, COIL_CUT_SEQ);
  476. param12.setValueParamter(2, SPEC_ORD_THK);
  477. param12.setValueParamter(3, SPEC_ORD_WTH);
  478. param12.setValueParamter(4, SPEC_ORD_LEN);
  479. param12.setValueParamter(5, SPEC_ORD_WGT);
  480. param12.setValueParamter(6, SPEC_ORD_WGT_MIN);
  481. param12.setValueParamter(7, SPEC_ORD_WGT_MAX);
  482. param12.setValueParamter(8, SPEC_ORD_INDIA);
  483. param12.setValueParamter(9, SPEC_ORD_OUTDIA);
  484. param12.setValueParamter(10, SPEC_ORD_NO);
  485. param12.setValueParamter(11, SPEC_ORD_SEQ);
  486. param12.setValueParamter(12, SPEC_ORD_FL);
  487. this.getDao("mesdao").insert("NIH020050_03.insert",param12);
  488. }
  489. }
  490. if (ProgCd == null || ProgCd.equals("") || ProgCd.equals("SED"))
  491. {
  492. PosParameter param13 = new PosParameter();
  493. param13.setWhereClauseParameter(0, MSG_SLAB_NO[0] );
  494. param13.setWhereClauseParameter(1, MSG_COIL_NO[0] );
  495. PosRowSet specMillVo = getDao("mesdao").find("NIH020020_SPEC_MILL.select", param13);
  496. if (specMillVo.hasNext()) {
  497. PosRow specMillROW = specMillVo.next();
  498. Number SlabEdtSeq = (Number)specMillROW.getAttribute("SLAB_EDT_SEQ");
  499. PosParameter param14 = new PosParameter();
  500. param14.setWhereClauseParameter(0, "C" );
  501. param14.setWhereClauseParameter(1, MSG_SLAB_NO[0] );
  502. param14.setWhereClauseParameter(2, MSG_COIL_NO[0] );
  503. getDao("mesdao").update("NIH020020_SPEC_MILL.update", param14);
  504. PosParameter param15 = new PosParameter();
  505. param15.setWhereClauseParameter(0, "C" );
  506. param15.setWhereClauseParameter(1, SlabEdtSeq );
  507. getDao("mesdao").update("NIH020020_SPEC_MILL_D.update", param15);
  508. PosParameter param16 = new PosParameter();
  509. param16.setWhereClauseParameter(0, "C" );
  510. param16.setWhereClauseParameter(1, SlabEdtSeq );
  511. getDao("mesdao").update("NIH020020_MILL_IDX.update", param16);
  512. }
  513. PosParameter param5 = new PosParameter();
  514. //TL 卷取
  515. param5.setWhereClauseParameter(0, "4");
  516. param5.setWhereClauseParameter(1, MSG_SLAB_NO[0]);
  517. param5.setWhereClauseParameter(2, MSG_COIL_NO[0]);
  518. getDao("mesdao").update("UIH020020_07.update", param5);
  519. PosParameter param6 = new PosParameter();
  520. param6.setWhereClauseParameter(0, MSG_SLAB_NO[0]);
  521. getDao("mesdao").update("UIH020020_08.update", param6);
  522. if(COIL_STAT.equals("3")){//20230302
  523. if(MSG_MISSNO_CLF_CD[0].equals("C")){//如果人工录入轧废信息,需要手动新增轧制消耗、计划产出、产品判废 2021-12-09
  524. ProduceFactory PD= new ProduceFactory();
  525. PD.ErpDataCover("HSLAB",MSG_SLAB_NO[0],"41A","0","O","加热炉二级","热轧轧制");
  526. PD.ErpDataCover("HFG",MSG_SLAB_NO[0],"11A","0","O","计划产出","热轧轧制");
  527. PD.ErpDataCover("HFG",MSG_SLAB_NO[0],"11AZ","0","O","计划产出判废","热轧轧制");
  528. }
  529. }
  530. //这里需要判断,如果存在钢卷废弃区分代码的话就不能调用品质的存储过程和相应的进程类
  531. if( !MSG_MISSNO_CLF_CD[0].equals("") && MSG_MISSNO_CLF_CD[0] != null){
  532. if(!COIL_STAT.equals("3")){
  533. if(MSG_MISSNO_CLF_CD[0].equals("C")){//如果人工录入轧废信息,需要手动新增轧制消耗、计划产出、产品判废 2021-12-09
  534. ProduceFactory PD= new ProduceFactory();
  535. PD.ErpDataCover("HSLAB",MSG_SLAB_NO[0],"41A","0","O","加热炉二级","热轧轧制");
  536. PD.ErpDataCover("HFG",MSG_SLAB_NO[0],"11A","0","O","计划产出","热轧轧制");
  537. PD.ErpDataCover("HFG",MSG_SLAB_NO[0],"11AZ","0","O","计划产出判废","热轧轧制");
  538. }
  539. logger.logInfo("PosSaveMillResult 废弃的钢卷状态为 :"+COIL_STAT);
  540. String SlabCurrProgCd = null;
  541. String SlabBefProgCd = null;
  542. String SlabOrdNo = null;
  543. String SlabOrdSeq = null;
  544. BigDecimal Slab_Wgt = null;
  545. PosParameter param9 = new PosParameter();
  546. param9.setWhereClauseParameter(0, MSG_SLAB_NO[0] );
  547. PosRowSet SlabEndVo = getDao("mesdao").find("NIH020030_SLAB.select", param9);
  548. if(SlabEndVo.hasNext()) {
  549. PosRow SlabEndROW = SlabEndVo.next();
  550. SlabCurrProgCd = (String)SlabEndROW.getAttribute("CUR_PROG_CD");
  551. SlabBefProgCd = (String)SlabEndROW.getAttribute("BEF_PROG_CD");
  552. SlabOrdNo = (String)SlabEndROW.getAttribute("ORD_NO");
  553. SlabOrdSeq = (String)SlabEndROW.getAttribute("ORD_SEQ");
  554. Slab_Wgt = (BigDecimal)SlabEndROW.getAttribute("SLAB_WGT");
  555. }
  556. SendProg_NIE012070( MSG_SLAB_NO[0] ,SlabOrdNo,SlabOrdSeq,SlabCurrProgCd,SlabBefProgCd,"TM",Slab_Wgt,MSG_WK_EMP_NO[0] );
  557. //BigDecimal CoilWgt = new BigDecimal(MSG_ACT_WGT[0]);
  558. //当前状态和前状态都为空,留到后面与现场人员确定
  559. //SendProg_NIE012070( MSG_COIL_NO[0] ,SPEC_ORD_NO,SPEC_ORD_SEQ,"","","AR",CoilWgt,MSG_WK_EMP_NO[0] );
  560. SendProg_NIE012080();
  561. //这里如果存在轧废的情况,需要调用品质的存储过程
  562. logger.logInfo("PosSaveMillResult---> NIB027010 TC sql call" );
  563. CallableStatement PlRtn = getDao("mesdao").getCallableStatement("NIH020020_NIB027010");
  564. logger.logInfo("PosSaveMillResult---> NIB027010 TC try" );
  565. try {
  566. if(PlRtn != null) {
  567. PlRtn.setString(1,MSG_COIL_NO[0]);
  568. //新增加一个字段,为了废弃的时候使用
  569. PlRtn.setString(2,"C");
  570. PlRtn.registerOutParameter(3, java.sql.Types.VARCHAR);
  571. PlRtn.registerOutParameter(4, java.sql.Types.VARCHAR);
  572. PlRtn.execute();
  573. String sRetCode = PlRtn.getString(3);
  574. String sRetMsg = PlRtn.getString(4);
  575. logger.logInfo("PosSaveMillResult---> NIB027010 TC PlRtn1:["+sRetCode+"]:"+ sRetMsg);
  576. } else {
  577. logger.logInfo("PosSaveMillResult---> NIB027010 PlRtn2:"+PlRtn );
  578. }
  579. } catch (SQLException e) {
  580. throw new PosException(e.getMessage());
  581. }finally
  582. {
  583. if (PlRtn != null)
  584. {
  585. try
  586. {
  587. PlRtn.close();
  588. }
  589. catch (SQLException e)
  590. {
  591. logger.logWarn(e.getMessage(), e);
  592. logger.logInfo("PosSaveMillResult---> NIB027010 SQLException:"+e );
  593. }
  594. }
  595. }
  596. }else{
  597. logger.logInfo("PosSaveMillResult 废弃的钢卷不能调用品质和进程,钢卷状态为 :"+COIL_STAT);
  598. }
  599. } else{
  600. if(COIL_STAT.equals("1") || COIL_STAT.equals("")){
  601. logger.logInfo("PosSaveMillResult 轧制的钢卷状态为 :"+COIL_STAT);
  602. //TL 加入调用品质的存储过程 COPY XinSaveRhfExtract NIB028070 081216
  603. CallableStatement PlRtn = getDao("mesdao").getCallableStatement("NIH020050_NIB028040");
  604. try {
  605. if(PlRtn != null) {
  606. PlRtn.setString(1, MSG_COIL_NO[0]);
  607. PlRtn.registerOutParameter(2, java.sql.Types.VARCHAR);
  608. PlRtn.registerOutParameter(3, java.sql.Types.VARCHAR);
  609. PlRtn.execute();
  610. String sRetCode = PlRtn.getString(2);
  611. String sRetMsg = PlRtn.getString(3);
  612. logger.logInfo("PosSAveOutHeatFurnace---> NIB028040 TC PlRtn1:["+sRetCode+"]:"+ sRetMsg);
  613. }
  614. } catch (SQLException e) {
  615. throw new PosException(e.getMessage());
  616. }finally
  617. {
  618. if (PlRtn != null)
  619. {
  620. try
  621. {
  622. PlRtn.close();
  623. }
  624. catch (SQLException e)
  625. {
  626. logger.logWarn(e.getMessage(), e);
  627. }
  628. }
  629. }
  630. String SlabCurrProgCd = null;
  631. String SlabBefProgCd = null;
  632. String SlabOrdNo = null;
  633. String SlabOrdSeq = null;
  634. BigDecimal Slab_Wgt = null;
  635. PosParameter param9 = new PosParameter();
  636. param9.setWhereClauseParameter(0, MSG_SLAB_NO[0] );
  637. PosRowSet SlabEndVo = getDao("mesdao").find("NIH020030_SLAB.select", param9);
  638. if(SlabEndVo.hasNext()) {
  639. PosRow SlabEndROW = SlabEndVo.next();
  640. SlabCurrProgCd = (String)SlabEndROW.getAttribute("CUR_PROG_CD");
  641. SlabBefProgCd = (String)SlabEndROW.getAttribute("BEF_PROG_CD");
  642. SlabOrdNo = (String)SlabEndROW.getAttribute("ORD_NO");
  643. SlabOrdSeq = (String)SlabEndROW.getAttribute("ORD_SEQ");
  644. Slab_Wgt = (BigDecimal)SlabEndROW.getAttribute("SLAB_WGT");
  645. }
  646. SendProg_NIE012070( MSG_SLAB_NO[0] ,SlabOrdNo,SlabOrdSeq,SlabCurrProgCd,SlabBefProgCd,"TM",Slab_Wgt,MSG_WK_EMP_NO[0] );
  647. BigDecimal CoilWgt = new BigDecimal(MSG_ACT_WGT[0]);
  648. SendProg_NIE012070( MSG_COIL_NO[0] ,SPEC_ORD_NO,SPEC_ORD_SEQ,"SED","","AR",CoilWgt,MSG_WK_EMP_NO[0] );
  649. SendProg_NIE012080();
  650. }else{
  651. logger.logInfo("PosSaveMillResult 多次轧制的钢卷不能调用品质和进程,钢卷状态为 :"+COIL_STAT);
  652. }
  653. }
  654. }
  655. } else{
  656. logger.logInfo("PosSaveMillResult 入炉状态不为2 不能进行轧制实际 :"+RHF_STAT);
  657. String vtemp="RHF_STAT";
  658. context.put("rs", vtemp);
  659. }
  660. }catch(Exception e){
  661. logger.logInfo("PosSaveMillResult 数据格式异常 :"+e.getMessage());
  662. }
  663. return PosBizControlConstants.SUCCESS;
  664. }
  665. public void SendProg_NIE012070(String MatNo,String sOrdNo,String sOrdSeq,String sProgCd,String sBefProgCd,String sKind,BigDecimal wgt,String RegId )
  666. {
  667. logger.logInfo(" XinSaveCcmResult SendProg_NIE012070 ");
  668. PosContext context = new PosContext();
  669. PosMessage message = new PosMESMessageImpl();
  670. String TcId = "NIE012070";
  671. message.setTCID(TcId);
  672. message.setObject("MSG_ID",TcId);
  673. message.setObject("BEF_ORD_NO",null);
  674. message.setObject("BEF_ORD_SEQ",null);
  675. message.setObject("ORD_NO",sOrdNo);
  676. message.setObject("ORD_SEQ",sOrdSeq);
  677. message.setObject("BEF_PROG_CD",sBefProgCd);
  678. message.setObject("PROG_CD",sProgCd);
  679. message.setObject("MAT_TYPE",sKind);
  680. message.setObject("MAT_NO",MatNo);
  681. message.setObject("WGT", wgt );
  682. message.setObject("PGMID","PosSaveMillResult");
  683. message.setObject("REG_ID","");
  684. context.setMessage(message);
  685. this.processComponent(PosConstants.CREATE_MESSAGE, context);
  686. String transactionCode = context.getMessage().getTC();
  687. message.setTCID(TcId);
  688. String serviceName = "NIE012070";
  689. String SERVICE_POSTFIX = "-service";
  690. context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX);
  691. context.setMessage(message);
  692. PosBizControlIF controller = PosBizProvider.getController();
  693. controller.doSubController(context,false);
  694. }
  695. public void SendProg_NIE012080()
  696. {
  697. PosContext context = new PosContext();
  698. PosMessage message = new PosMESMessageImpl();
  699. String TcId = "NIE012080";
  700. message.setTCID(TcId);
  701. message.setObject("MSG_ID",TcId);
  702. message.setObject("AA",null);
  703. context.setMessage(message);
  704. this.processComponent(PosConstants.CREATE_MESSAGE, context);
  705. String transactionCode = context.getMessage().getTC();
  706. message.setTCID(TcId);
  707. String serviceName = "NIE012080";
  708. String SERVICE_POSTFIX = "-service";
  709. context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX);
  710. context.setMessage(message);
  711. PosBizControlIF controller = PosBizProvider.getController();
  712. controller.doSubController(context,false);
  713. }
  714. }