596eb423ad5762b0ae2fd4a4c73209c37ad9dc56.svn-base 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. package xin.glue.ui.G.G04;
  2. import java.math.BigDecimal;
  3. import java.sql.CallableStatement;
  4. import java.text.DateFormat;
  5. import java.text.SimpleDateFormat;
  6. import java.util.Date;
  7. import com.posdata.glue.PosException;
  8. import com.posdata.glue.biz.activity.PosActivity;
  9. import com.posdata.glue.biz.constants.PosBizControlConstants;
  10. import com.posdata.glue.biz.control.PosBizControlIF;
  11. import com.posdata.glue.biz.control.PosBizProvider;
  12. import com.posdata.glue.component.PosConstants;
  13. import com.posdata.glue.context.PosContext;
  14. import com.posdata.glue.dao.vo.PosParameter;
  15. import com.posdata.glue.dao.vo.PosRow;
  16. import com.posdata.glue.dao.vo.PosRowSet;
  17. import com.posdata.glue.msg.PosMESMessageImpl;
  18. import com.posdata.glue.msg.PosMessage;
  19. public class XinSaveSlabRecut extends PosActivity {
  20. public String runActivity(PosContext context) {
  21. String[] REG_ID = (String[])context.get("REG_ID");
  22. String[] ORL_SLAB_NO = (String[])context.get("ORL_SLAB_NO");
  23. String[] REG_SHIP = (String[])context.get("REG_SHIP");
  24. String[] REG_GROUP = (String[])context.get("REG_GROUP");
  25. String[] CUT_CNT = (String[])context.get("CUT_CNT");
  26. String[] CHARGE_NO = (String[])context.get("CHARGE_NO");
  27. String[] MODIFY_CODE = (String[])context.get("MODIFY_CODE");
  28. String[] SLAB_NO = (String[])context.get("SLAB_NO");
  29. String[] SLAB_THK = (String[])context.get("SLAB_THK");
  30. String[] SLAB_WTH = (String[])context.get("SLAB_WTH");
  31. String[] SLAB_LEN = (String[])context.get("SLAB_LEN");
  32. String[] SLAB_WGT = (String[])context.get("SLAB_WGT");
  33. String[] SLAB_SIZE_DEC_GRD = (String[])context.get("SLAB_SIZE_DEC_GRD");
  34. String[] CUR_LOAD_LOC = (String[])context.get("CUR_LOAD_LOC");
  35. String[] ORL_LOAD_LOC = (String[])context.get("ORL_LOAD_LOC");
  36. String[] DSN_SLAB_NO = (String[])context.get("DSN_SLAB_NO");
  37. String[] SUB_DSN_SLAB_NO = (String[])context.get("SUB_DSN_SLAB_NO");
  38. String[] SLAB_CUT_SEQ = (String[])context.get("SLAB_CUT_SEQ");
  39. //磅重
  40. String[] weight_wgt = new String[SLAB_NO.length];
  41. PosParameter param = null;
  42. String OrdNo = "";
  43. String OrdSeq = "";
  44. String OrdFl = "";
  45. String CurProgCd = "";
  46. String BefProgCd = "";
  47. String BefOrdNo = "";
  48. String BefOrdSeq = "";
  49. String NonOrdResCd = "";
  50. String NonOrdResDate = "";
  51. String smsYardEntDtime = "";
  52. String slabStockEntDtime = "";
  53. String slabRt = "";
  54. String SLAB_EXT_RZ_TIME = "";
  55. param = new PosParameter();
  56. param.setWhereClauseParameter(0,ORL_SLAB_NO[0]);
  57. PosRowSet slabComVo = getDao("mesdao").find("UIG040070_04.select", param);
  58. if (slabComVo.hasNext()) {
  59. PosRow slabComROW = slabComVo.next();
  60. OrdNo = (String)slabComROW.getAttribute("ORD_NO");
  61. OrdSeq = (String)slabComROW.getAttribute("ORD_SEQ");
  62. CurProgCd = (String)slabComROW.getAttribute("CUR_PROG_CD");
  63. OrdFl = (String)slabComROW.getAttribute("ORD_FL");
  64. smsYardEntDtime = (String)slabComROW.getAttribute("SMS_YARD_ENT_DTIME");
  65. slabStockEntDtime = (String)slabComROW.getAttribute("SLAB_STOCK_ENT_DTIME");
  66. slabRt = (String)slabComROW.getAttribute("SLAB_RT");
  67. SLAB_EXT_RZ_TIME = (String)slabComROW.getAttribute("SLAB_EXT_RZ_TIME");
  68. BefProgCd = CurProgCd;
  69. BefOrdNo = OrdNo;
  70. BefOrdSeq = OrdSeq;
  71. }else{
  72. context.put("MESSAGES", " 错误,缺少板坯信息! ");
  73. return PosBizControlConstants.SUCCESS;
  74. }
  75. if(!(CurProgCd.equals("RBA")||CurProgCd.equals("RRC")||CurProgCd.equals("RGB"))){
  76. context.put("MESSAGES", " 坯料状态错误,不能操作! ");
  77. return PosBizControlConstants.SUCCESS;
  78. }
  79. //区分炼钢热轧入库
  80. if(ORL_LOAD_LOC[0] == "" || ORL_LOAD_LOC[0] == null)
  81. {
  82. context.put("MESSAGES", " 错误,原坯料无垛位! ");
  83. return PosBizControlConstants.SUCCESS;
  84. }
  85. if(ORL_LOAD_LOC[0].substring(0, 1).equals("L") || ORL_LOAD_LOC[0].substring(0, 1).equals("H")){
  86. DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
  87. smsYardEntDtime = formatter.format(new Date());
  88. }else if(ORL_LOAD_LOC[0].substring(0, 1).equals("Z")){
  89. DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
  90. slabStockEntDtime = formatter.format(new Date());
  91. }/*else{
  92. context.put("MESSAGES", " 错误,坯料不在库! ");
  93. return PosBizControlConstants.SUCCESS;
  94. }*/
  95. String sql = "SELECT COILSTAT(T.SLAB_NO) STAT_FLAG FROM TBG02_SLAB_COMM T WHERE T.SLAB_NO = ?";
  96. param = new PosParameter();
  97. param.setWhereClauseParameter(0, ORL_SLAB_NO[0]);
  98. PosRowSet rowset = this.getDao("mesdao").findByQueryStatement(sql, param);
  99. if (rowset.hasNext())//查询库存信息 已出库板坯不允许强制结束
  100. {
  101. PosRow row = rowset.next();
  102. String stat = (String)row.getAttribute("STAT_FLAG");//
  103. if(!"在库".equals(stat)){
  104. context.put("MESSAGES", ORL_SLAB_NO[0] + "板坯已不在炼钢库,不允许进行分切操作,请核实");
  105. return PosBizControlConstants.SUCCESS;
  106. }
  107. }
  108. //未指示切割 全部降为余材
  109. if(MODIFY_CODE[0].equals("02")){
  110. CurProgCd = slabRt.equals("H")?"RRC":"RGB";
  111. OrdFl = "2";
  112. OrdNo = "";
  113. OrdSeq = "";
  114. NonOrdResCd = "3A"; //尺寸变更
  115. DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
  116. NonOrdResDate = formatter.format(new Date());
  117. // 指示切割
  118. }else if(MODIFY_CODE[0].equals("03")){
  119. CurProgCd = slabRt.equals("H")?"RRC":"RGB";
  120. OrdFl = "1";
  121. //OrdNo = "";
  122. //OrdSeq = "";
  123. //NonOrdResCd = "3A"; //尺寸变更
  124. //DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
  125. //NonOrdResDate = formatter.format(new Date());
  126. }
  127. if(SLAB_NO.length > 0 ){
  128. //磅重分摊 短坯走理论,长坯为母坯磅重减去短坯理重 子坯只有两块
  129. double weightAll = 0.0;
  130. double lengthOld = 0.0;
  131. double lengthAll = 0.0;
  132. param = new PosParameter();
  133. param.setWhereClauseParameter(0, ORL_SLAB_NO[0]);
  134. PosRowSet SlabInfo = getDao("mesdao").find("UIG040070_SLAB_COMM_ALL.select", param);
  135. if(SlabInfo.hasNext()){
  136. PosRow SlabInfoRow = SlabInfo.next();
  137. BigDecimal weight_wgt1 = (BigDecimal)SlabInfoRow.getAttribute("WEIGHT_WGT");
  138. lengthOld = Double.parseDouble(SlabInfoRow.getAttribute("SLAB_LEN").toString());
  139. if(weight_wgt1 != null && weight_wgt1.doubleValue() != 0){
  140. weightAll = Double.parseDouble(SlabInfoRow.getAttribute("WEIGHT_WGT").toString());
  141. }else{
  142. weightAll = Double.parseDouble(SlabInfoRow.getAttribute("SLAB_WGT").toString());
  143. }
  144. for(int i = 0 ; i < SLAB_NO.length ; i++){
  145. if(i+1 < SLAB_NO.length){
  146. if(Integer.parseInt(SLAB_LEN[i]) < Integer.parseInt(SLAB_LEN[i+1])){
  147. weight_wgt[i] = Double.parseDouble(SLAB_LEN[i])*Double.parseDouble(SLAB_WTH[i])*Double.parseDouble(SLAB_THK[i])*7.85/1000000000 + "";
  148. weight_wgt[i+1] = weightAll - Double.parseDouble(SLAB_LEN[i])*Double.parseDouble(SLAB_WTH[i])*Double.parseDouble(SLAB_THK[i])*7.85/1000000000 + "";
  149. }else if(Integer.parseInt(SLAB_LEN[i]) > Integer.parseInt(SLAB_LEN[i+1])){
  150. weight_wgt[i+1] = Double.parseDouble(SLAB_LEN[i+1])*Double.parseDouble(SLAB_WTH[i+1])*Double.parseDouble(SLAB_THK[i+1])*7.85/1000000000 + "";
  151. weight_wgt[i] = weightAll - Double.parseDouble(SLAB_LEN[i+1])*Double.parseDouble(SLAB_WTH[i+1])*Double.parseDouble(SLAB_THK[i+1])*7.85/1000000000 + "";
  152. }else{
  153. weight_wgt[i+1] = weightAll/2 + "";
  154. weight_wgt[i] = weightAll/2 + "";
  155. }
  156. }
  157. lengthAll += Double.parseDouble(SLAB_LEN[i]);
  158. }
  159. //总长度限制
  160. if(lengthAll > lengthOld){
  161. context.put("MESSAGES", " 利库子坯总长度大于母坯,请修改母坯定尺后再利库! ");
  162. return PosBizControlConstants.SUCCESS;
  163. }
  164. }else{
  165. context.put("MESSAGES", " 没有此原板坯! ");
  166. return PosBizControlConstants.SUCCESS;
  167. }
  168. for(int i = 0 ; i < SLAB_NO.length ; i++){
  169. String storelay = null;
  170. param = new PosParameter();
  171. if(CUR_LOAD_LOC[i]== null&& CUR_LOAD_LOC[i].equals(""))continue;
  172. param.setWhereClauseParameter(0, CUR_LOAD_LOC[i]);
  173. PosRowSet storelayVo = getDao("mesdao").find("UIG040060_YARD_LAY.select", param);
  174. if(storelayVo.hasNext()){
  175. PosRow storelayRow = storelayVo.next();
  176. storelay = (String)storelayRow.getAttribute("STORELAY");
  177. }else{
  178. context.put("MESSAGES", " 没有此垛位! ");
  179. return PosBizControlConstants.SUCCESS;
  180. }
  181. //理重重新计算
  182. SLAB_WGT[i] = Double.parseDouble(SLAB_LEN[i])*Double.parseDouble(SLAB_WTH[i])*Double.parseDouble(SLAB_THK[i])*7.85/1000000 + "";
  183. param = new PosParameter();
  184. param.setWhereClauseParameter(0, SLAB_NO[i]);
  185. param.setWhereClauseParameter(1, "UIG040070");
  186. param.setWhereClauseParameter(2,CUR_LOAD_LOC[i]);
  187. param.setWhereClauseParameter(3, storelay);
  188. this.getDao("mesdao").update("UIG040070_SLAB_YARD.update", param);
  189. param = new PosParameter();
  190. param.setValueParamter(0, SLAB_NO[i]);
  191. param.setValueParamter(1, CurProgCd );
  192. param.setValueParamter(2, BefOrdNo);
  193. param.setValueParamter(3, BefOrdSeq );
  194. param.setValueParamter(4, OrdNo );
  195. param.setValueParamter(5, OrdSeq );
  196. param.setValueParamter(6, OrdFl );
  197. param.setValueParamter(7, SLAB_THK[i]);
  198. param.setValueParamter(8, SLAB_WTH[i]);
  199. param.setValueParamter(9, SLAB_LEN[i]);
  200. param.setValueParamter(10, SLAB_WGT[i]);
  201. param.setValueParamter(11, MODIFY_CODE[0]);
  202. param.setValueParamter(12, SLAB_THK[i]);
  203. param.setValueParamter(13, SLAB_WTH[i]);
  204. param.setValueParamter(14, SLAB_LEN[i]);
  205. param.setValueParamter(15, SLAB_WGT[i]);
  206. param.setValueParamter(16, REG_SHIP[0]);
  207. param.setValueParamter(17, REG_GROUP[0]);
  208. param.setValueParamter(18, REG_ID[0]);
  209. param.setValueParamter(19, SLAB_SIZE_DEC_GRD[i]);
  210. param.setValueParamter(20, NonOrdResCd);
  211. param.setValueParamter(21, NonOrdResDate);
  212. param.setValueParamter(22, CUR_LOAD_LOC[i] + storelay);
  213. param.setValueParamter(23, smsYardEntDtime);
  214. param.setValueParamter(24, slabStockEntDtime);
  215. param.setValueParamter(25, SLAB_NO[i]);
  216. param.setValueParamter(26, weight_wgt[i]);
  217. param.setValueParamter(27, SLAB_EXT_RZ_TIME);
  218. param.setValueParamter(28, ORL_SLAB_NO[0]);
  219. this.getDao("mesdao").insert("UIG040070_SHR.insert",param);
  220. param = new PosParameter();
  221. param.setValueParamter(0, SLAB_NO[i]);
  222. param.setValueParamter(1, ORL_SLAB_NO[0]);
  223. param.setValueParamter(2, SLAB_NO[i]);
  224. param.setValueParamter(3, SLAB_CUT_SEQ[i]);
  225. param.setValueParamter(4, new BigDecimal(SLAB_THK[i]));
  226. param.setValueParamter(5, new BigDecimal(SLAB_WTH[i]));
  227. param.setValueParamter(6, new BigDecimal(SLAB_LEN[i]));
  228. param.setValueParamter(7, DSN_SLAB_NO[i]);
  229. param.setValueParamter(8, SUB_DSN_SLAB_NO[i]);
  230. param.setValueParamter(9, ORL_SLAB_NO[0]);
  231. this.getDao("mesdao").insert("UIG040070_SHR_COMMD_03.insert",param);
  232. param = new PosParameter();
  233. param.setValueParamter(0, OrdFl);
  234. param.setValueParamter(1, SLAB_NO[i]);
  235. getDao("mesdao").update("UIG040070_SLAB_COMM_D_ORDFL.update", param);
  236. /*新增板坯利库切割表 20211208 jiangxin*/
  237. param = new PosParameter();
  238. param.setValueParamter(0, ORL_SLAB_NO[0]);
  239. param.setValueParamter(1, REG_ID[0]);
  240. param.setValueParamter(2, SLAB_NO[i]);
  241. this.getDao("mesdao").insert("UIG040070_INCISE_01.insert",param);
  242. //指示切割
  243. if(MODIFY_CODE[0].equals("03")){
  244. BigDecimal Wgt = new BigDecimal(SLAB_WGT[i]);
  245. String RtnSizeDec = "";
  246. param = new PosParameter();
  247. param.setWhereClauseParameter(0, SLAB_NO[i]);
  248. param.setWhereClauseParameter(1, new BigDecimal(SLAB_THK[i]));
  249. param.setWhereClauseParameter(2, new BigDecimal(SLAB_WTH[i]));
  250. param.setWhereClauseParameter(3, new BigDecimal(SLAB_LEN[i]));
  251. param.setWhereClauseParameter(4, Wgt);
  252. PosRowSet rowSet = getDao("mesdao").find("UIG040070_SLAB_SIZE_DEC.select", param);
  253. if(rowSet.hasNext()){
  254. PosRow row = rowSet.next();
  255. RtnSizeDec = (String)row.getAttribute("RES");
  256. }else{
  257. context.put("MESSAGES", " 错误,尺寸判定错误! ");
  258. return PosBizControlConstants.FAILURE;
  259. }
  260. if(RtnSizeDec.equals("Y")){
  261. SLAB_SIZE_DEC_GRD[i] = "1";
  262. }else if(RtnSizeDec.equals("N")){
  263. SLAB_SIZE_DEC_GRD[i] = "2";
  264. }else if(RtnSizeDec.equals("F")){
  265. context.put("MESSAGES", " 错误,不能为指示切割! ");
  266. return PosBizControlConstants.FAILURE;
  267. }
  268. //尺寸不合格
  269. if(SLAB_SIZE_DEC_GRD[i].equals("2")){
  270. CurProgCd = slabRt.equals("H")?"RRC":"RGB";
  271. OrdFl = "2";
  272. OrdNo = "";
  273. OrdSeq = "";
  274. NonOrdResCd = "3B"; //尺寸异常
  275. DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
  276. NonOrdResDate = formatter.format(new Date());
  277. }else if(SLAB_SIZE_DEC_GRD[i].equals("1")){
  278. if (OrdFl != null && OrdFl.equals("2")) {
  279. CurProgCd = slabRt.equals("H")?"RRC":"RGB";
  280. } else if (OrdFl.equals("1")){
  281. CurProgCd = "RBA"; //轧钢指示待机
  282. }
  283. }
  284. param = new PosParameter();
  285. param.setWhereClauseParameter(0, OrdFl);
  286. param.setWhereClauseParameter(1, OrdNo);
  287. param.setWhereClauseParameter(2, OrdSeq);
  288. param.setWhereClauseParameter(3, NonOrdResCd);
  289. param.setWhereClauseParameter(4, NonOrdResDate);
  290. param.setWhereClauseParameter(5, CurProgCd);
  291. param.setWhereClauseParameter(6, SLAB_NO[i]);
  292. getDao("mesdao").update("UIG040070_SLAB_SIZE_DEC.update", param);
  293. }
  294. //进程整理
  295. BigDecimal SlabWgt = new BigDecimal(SLAB_WGT[i]);
  296. SendProg_NIE012070(SLAB_NO[i],OrdNo,OrdSeq,BefOrdNo,BefOrdSeq,CurProgCd,BefProgCd,"TM",SlabWgt);
  297. SendProg_NIE012080();
  298. /*财务数据上抛*/
  299. CallableStatement cstm = null;
  300. try
  301. {
  302. cstm = this.getDao("mesdao").getCallableStatement("UPLOAD_DATA.CAL");
  303. cstm.setString(1, SLAB_NO[i]);
  304. cstm.setString(2, "11AD");
  305. cstm.setString(3, "N");
  306. cstm.setString(4, "板坯利库");
  307. cstm.setString(5, REG_ID[0]);
  308. cstm.registerOutParameter(6, java.sql.Types.VARCHAR);
  309. cstm.execute();
  310. String err = cstm.getString(6);
  311. }catch(Exception ex){
  312. ex.printStackTrace();
  313. }
  314. finally{
  315. if(cstm != null){
  316. try{
  317. cstm.close();
  318. }catch(Exception e)
  319. {
  320. e.printStackTrace();
  321. }
  322. }
  323. }
  324. }
  325. //结束母板坯
  326. param = new PosParameter();
  327. param.setWhereClauseParameter(0, ORL_SLAB_NO[0]);
  328. this.getDao("mesdao").update("UIG040070_SLAB_END.update",param);
  329. param = new PosParameter();
  330. param.setWhereClauseParameter(0, ORL_SLAB_NO[0]);
  331. this.getDao("mesdao").update("UIG040070_SLAB_COMM.update", param);
  332. CallableStatement cstm = null;
  333. try
  334. {/*母板坯结束后再上抛母坯*/
  335. cstm = this.getDao("mesdao").getCallableStatement("UPLOAD_DATA.CAL");
  336. cstm.setString(1, ORL_SLAB_NO[0]);
  337. cstm.setString(2, "11AD");
  338. cstm.setString(3, "N");
  339. cstm.setString(4, "板坯利库");
  340. cstm.setString(5, REG_ID[0]);
  341. cstm.registerOutParameter(6, java.sql.Types.VARCHAR);
  342. cstm.execute();
  343. String err = cstm.getString(6);
  344. }catch(Exception ex){
  345. ex.printStackTrace();
  346. }
  347. finally{
  348. if(cstm != null){
  349. try{
  350. cstm.close();
  351. }catch(Exception e)
  352. {
  353. e.printStackTrace();
  354. }
  355. }
  356. }
  357. //整理垛位
  358. SendProg_NIG040200(ORL_LOAD_LOC[0].substring(0,(ORL_LOAD_LOC[0].length()-2)));
  359. context.put("MESSAGES", " 操作成功! ");
  360. }
  361. return PosBizControlConstants.SUCCESS;
  362. }
  363. // SLAB SIZE DECISION ( RESULT SLAB WGT,ORDER WGT COMPARE)
  364. // TBG02_SLAB_COMM--> SLAB_WGT
  365. // TBG02_SLAB_COMM_D --> ORD_NO,ORD_SEQ
  366. // TBA01_ORD_LINE --> PROD_WGT_MIN,PROD_WGT_MAX
  367. public String SlabSizeDec(BigDecimal slabThk,BigDecimal slabWth,BigDecimal slabLen,String SlabNo,BigDecimal SlabWgt)
  368. {
  369. logger.logInfo("XinSaveSlabComm SlabWgt:"+SlabWgt);
  370. BigDecimal SlabThk = slabThk;
  371. BigDecimal SlabWth = slabWth;
  372. BigDecimal SlabLen = slabLen;
  373. BigDecimal ordLen = new BigDecimal(0);
  374. BigDecimal ordWgt = new BigDecimal(0);
  375. BigDecimal coilOutDia = new BigDecimal(0);
  376. BigDecimal coilInDia = new BigDecimal(0);
  377. BigDecimal ordThk = new BigDecimal(0);
  378. BigDecimal ordWth = new BigDecimal(0);
  379. BigDecimal coilThk = new BigDecimal(0);
  380. BigDecimal coilWth = new BigDecimal(0);
  381. PosParameter param1 = new PosParameter();
  382. param1.setWhereClauseParameter(0, SlabNo);
  383. PosRowSet CommDVO = getDao("mesdao").find("NIG020610_SLAB_COMM_D.select", param1);
  384. PosRowSet CommDVO2 = getDao("mesdao").find("UIG020060_SLAB_COMMD_ORD.select",param1);
  385. if(CommDVO2.hasNext()){
  386. PosRow row = CommDVO2.next();
  387. ordThk = (BigDecimal)row.getAttribute("SLAB_THK");
  388. ordWth = (BigDecimal)row.getAttribute("SLAB_WTH");
  389. coilThk = (BigDecimal)row.getAttribute("ORD_THK");
  390. coilWth = (BigDecimal)row.getAttribute("ORD_WTH");
  391. coilInDia = (BigDecimal)row.getAttribute("COIL_INDIA");
  392. }else return "F";
  393. BigDecimal total = ordWth.add(new BigDecimal(100));
  394. if(SlabWth.compareTo(ordWth) < 0||total.compareTo(SlabWth) < 0){
  395. return "N";
  396. }
  397. param1 = new PosParameter();
  398. PosRowSet rateVo = getDao("mesdao").find("UIG020060_proc_rate.select", param1);
  399. BigDecimal procRate = new BigDecimal(1);
  400. if(rateVo.hasNext()){
  401. PosRow posrow = rateVo.next();
  402. procRate = (BigDecimal)posrow.getAttribute("PROC_RATE");
  403. }
  404. if ( CommDVO.hasNext()) {
  405. PosRow CommDROW = CommDVO.next();
  406. BigDecimal PROD_WGT_MIN = (BigDecimal)CommDROW.getAttribute("PROD_WGT_MIN");
  407. BigDecimal PROD_WGT_MAX = (BigDecimal)CommDROW.getAttribute("PROD_WGT_MAX");
  408. logger.logInfo("XinSaveSlabComm PROD_WGT_MIN:"+PROD_WGT_MIN);
  409. logger.logInfo(PROD_WGT_MIN);
  410. logger.logInfo(PROD_WGT_MAX);
  411. ordWgt = SlabWgt.multiply(procRate);
  412. ordWgt = ordWgt.divide(new BigDecimal(100));
  413. logger.logInfo("XinSaveSlabComm ordWgt:"+ ordWgt);
  414. if(PROD_WGT_MIN == null)PROD_WGT_MIN = new BigDecimal(0);
  415. if(PROD_WGT_MAX == null)PROD_WGT_MAX = new BigDecimal(0);
  416. //如果板坯重量不在订单重量范围内
  417. if (ordWgt.compareTo(PROD_WGT_MIN) < 0 || PROD_WGT_MAX.compareTo(ordWgt) < 0 ) {
  418. //取消订单
  419. return "N";
  420. }
  421. }
  422. logger.logInfo("ordWgt=" + ordWgt );
  423. logger.logInfo("ordThk=" + ordThk );
  424. logger.logInfo("SlabWth=" + SlabWth );
  425. ordLen = ordWgt.multiply(new BigDecimal(1000000));
  426. ordLen = ordLen.divide(coilThk,3,BigDecimal.ROUND_HALF_UP);
  427. ordLen = ordLen.divide(coilWth,3,BigDecimal.ROUND_HALF_UP);
  428. ordLen = ordLen.divide(new BigDecimal(7.85),0,BigDecimal.ROUND_HALF_UP);
  429. coilOutDia = new BigDecimal(Math.sqrt(ordWgt.multiply(new BigDecimal(1000000).multiply(new BigDecimal(4)).divide(new BigDecimal(7.85*3.14*0.98),3,BigDecimal.ROUND_HALF_UP).divide(SlabWth,0,BigDecimal.ROUND_HALF_UP)).add(coilInDia.multiply(coilInDia)).doubleValue()));
  430. logger.logInfo("-------------slabThk" + slabThk + "--slabWth" + slabWth + "--slabLen" + slabLen + "--ordLen" + ordLen + "--ordWgt" + ordWgt + "--coilOutDia" + coilOutDia + "--" );
  431. param1 = new PosParameter();
  432. param1.setWhereClauseParameter(0,slabThk);
  433. param1.setWhereClauseParameter(1,slabWth);
  434. param1.setWhereClauseParameter(2,slabLen);
  435. param1.setWhereClauseParameter(3,ordLen);
  436. param1.setWhereClauseParameter(4,ordWgt);
  437. param1.setWhereClauseParameter(5,coilOutDia);
  438. param1.setWhereClauseParameter(6,SlabNo);
  439. int rowset = getDao("mesdao").update("UIG020060_slab_comm_d.update",param1);
  440. return "Y";
  441. }
  442. public PosContext SendProg_NIE012070(String MatNo,String sOrdNo,String sOrdSeq,String sBefOrdNo,String sBefOrdSeq,String sProgCd,String BefProcCd,String sKind,BigDecimal nwgt )
  443. {
  444. PosContext context = new PosContext();
  445. PosMessage message = new PosMESMessageImpl();
  446. String TcId = "NIE012070";
  447. message.setTCID(TcId);
  448. message.setObject("MSG_ID",TcId);
  449. message.setObject("BEF_ORD_NO",sBefOrdNo);
  450. message.setObject("BEF_ORD_SEQ",sBefOrdSeq);
  451. message.setObject("ORD_NO",sOrdNo);
  452. message.setObject("ORD_SEQ",sOrdSeq);
  453. message.setObject("BEF_PROG_CD",BefProcCd);
  454. message.setObject("PROG_CD",sProgCd);
  455. message.setObject("MAT_TYPE",sKind);
  456. message.setObject("MAT_NO",MatNo);
  457. message.setObject("WGT", nwgt );
  458. message.setObject("PGMID","UIG040070");
  459. message.setObject("REG_ID","UIG040070");
  460. message.setTCID(TcId);
  461. context.setMessage(message);
  462. // this.processComponent(PosConstants.CREATE_MESSAGE, context);
  463. // String transactionCode = context.getMessage().getTC();
  464. String SERVICE_POSTFIX = "-service";
  465. context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX);
  466. // context.setMessage(message);
  467. PosBizControlIF controller = PosBizProvider.getController();
  468. controller.doSubController(context,false);
  469. return null;
  470. }
  471. public void SendProg_NIE012080()
  472. {
  473. PosContext context = new PosContext();
  474. PosMessage message = new PosMESMessageImpl();
  475. String TcId = "NIE012080";
  476. message.setTCID(TcId);
  477. message.setObject("MSG_ID",TcId);
  478. message.setObject("AA",null);
  479. context.setMessage(message);
  480. this.processComponent(PosConstants.CREATE_MESSAGE, context);
  481. String transactionCode = context.getMessage().getTC();
  482. message.setTCID(TcId);
  483. String serviceName = "NIE012080";
  484. String SERVICE_POSTFIX = "-service";
  485. context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX);
  486. context.setMessage(message);
  487. PosBizControlIF controller = PosBizProvider.getController();
  488. controller.doSubController(context,false);
  489. }
  490. public String SendProg_NIG040200(String yardAddr)
  491. {
  492. logger.logInfo("PosSaveSlabCutting---> yardAddr:"+yardAddr );
  493. PosContext context = new PosContext();
  494. PosMessage message = new PosMESMessageImpl();
  495. String TcId = "NIG040200";
  496. message.setTCID(TcId);
  497. message.setObject("MSG_ID",TcId);
  498. message.setObject("YARD_ADDR",yardAddr);
  499. context.setMessage(message);
  500. message.setTCID(TcId);
  501. String SERVICE_POSTFIX = "-service";
  502. context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX);
  503. PosBizProvider.getController().doSubController(context, false);
  504. String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG");
  505. logger.logInfo("PosSaveSlabCutting SendProg_NIE012070 SERVICE_ERR_MSG:"+SERVICE_ERR_MSG );
  506. if (SERVICE_ERR_MSG != null)
  507. {
  508. throw new PosException(SERVICE_ERR_MSG);
  509. }
  510. return null;
  511. }
  512. }