ca123bda4894f90eb45dd0e81d80abfa9030bbf0.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?xml-stylesheet href="../../css/body.css" type="text/css" ?>
  3. <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2002/01/xforms" xmlns:ev="http://www.w3.org/2001/xml-events">
  4. <xhtml:head>
  5. <xhtml:title>
  6. <![CDATA[热轧作业>>钢卷库管理>>钢卷标识打印(UIH050500)]]>
  7. </xhtml:title>
  8. <model id="model1">
  9. <instance id="instance1">
  10. <root xmlns="">
  11. <reqData/>
  12. <resData/>
  13. <datagrid1>
  14. </datagrid1>
  15. <datagrid2>
  16. <COILResult_VO/>
  17. </datagrid2>
  18. <searchData>
  19. <DLIV_DIRNO/>
  20. </searchData>
  21. </root>
  22. </instance>
  23. </model>
  24. <script type="javascript" src="../../js/boaMsg.js"/>
  25. <script type="javascript" src="../../js/boaCommon.js"/>
  26. <script type="javascript">
  27. <![CDATA[
  28. function InitParams(node) {
  29. if (typeof node == "undefined" && typeof node != "object") return;
  30. model.removenode("/root/initData/rcvInfo");
  31. model.makeNode("/root/initData/rcvInfo");
  32. var nodeList = node.childNodes;
  33. node = model.instances(0).selectSingleNode("/root/initData/rcvInfo");
  34. for (var i = 0; i < nodeList.length; i++)
  35. node.appendChild(nodeList.item(i));
  36. }
  37. function Init(node)
  38. {
  39. InitParams(node);
  40. }
  41. function find(){
  42. model.removenode("/root/reqData");
  43. model.makeNode("/root/reqData");
  44. model.removenode("/root/datagrid1");
  45. model.makeNode("/root/datagrid1");
  46. //不能为空
  47. if(model.getValue("/root/searchData/DLIV_DIRNO") == ""){
  48. alert(" 发货指示号不能为空!!!! ");
  49. return;
  50. }
  51. if(model.getValue("/root/searchData/DLIV_DIRNO").length < 8){
  52. alert(" 发运指示号长度不正确!!! ");
  53. return;
  54. }
  55. //不选择就查全部
  56. model.duplicate("/root/reqData","/root/searchData/DLIV_DIRNO");
  57. commSubmit("UIH050500-service", "find", "glueAction.do");
  58. commAppendData("/root/datagrid1/COILResult_VO","/root/resData/COILResult_VO");
  59. model.refresh();
  60. for(var i = datagrid1.fixedRows; i <= datagrid1.rows; i++)
  61. {
  62. if( datagrid1.valueMatrix(i , datagrid1.colRef("H05_COIL_WGT"))
  63. != datagrid1.valueMatrix(i , datagrid1.colRef("ACT_WGT") )
  64. )
  65. {
  66. datagrid1.cellStyle("background-color" , i , datagrid1.colRef("H05_COIL_WGT")) = "#ff00ff";
  67. }
  68. else
  69. {
  70. datagrid1.cellStyle("background-color" , i , datagrid1.colRef("H05_COIL_WGT")) = "#ffffff";
  71. }
  72. }
  73. }
  74. function save(){
  75. model.removenode("/root/reqData");
  76. model.makeNode("/root/reqData");
  77. commMultiUpdate(datagrid1,"/root/reqData","A",true,"rowStuts");
  78. //这里加入登录用户名,会不会与已有的initData冲突
  79. model.makeValue("/root/reqData/REG_ID",model.getValue("/root/initData/rcvInfo/REG_ID"));
  80. commSubmit("UIH050500-service", "save", "glueAction.do");
  81. model.refresh();
  82. if(model.getValue("/root/resData/rs_VO/rs_Row") == "ERRORC"){
  83. alert(" 钢卷没有打印出明细,不能进行标签打印操作 ");
  84. return;
  85. }
  86. if(model.getValue("/root/resData/rs_VO/rs_Row") == "ERRORT"){
  87. alert(" 钢卷没有排车,不能进行标签打印操作 ");
  88. return;
  89. }
  90. if(model.getValue("/root/resData/rs_VO/rs_Row") == "DLIV_TP"){
  91. alert(" 钢卷没有排车,请联系管理员 ");
  92. return;
  93. }
  94. alert(" 钢卷标志保存成功! ");
  95. //再查询一次
  96. find();
  97. }
  98. function saveExcelScript(sDGridName, sExcelSheetName, saveType) {
  99. var sExcelName = window.fileDialog( "save", "", false, "SaveFileName", "xls", "Excel Files(*.xls)|*.xls" );
  100. if ( sExcelName == "" ) {
  101. return;
  102. }
  103. // var sCSVName = "C:\\TFSmartUpdater\\" + sExcelName.lastIndexOf(".") +".csv";
  104. //这里先把数据放入csv文件,再从csv导入xls
  105. var sCSVName = sExcelName +".csv";
  106. // alert("sExcelName = ["+ sExcelName +"]\nsCSVName = ["+ sCSVName + "]");
  107. eval(sDGridName).saveText(sCSVName, "\n", ",", '\:', true); //DataGrid의 내용을 CSV파일로 생성
  108. ObjTFExcel.launchNewInstance(0); //Execute EXCEL
  109. ObjTFExcel.createWorkbook(); //Create new Workbook(for example:Sheet1,Sheet2,Sheet3) -- createWorkBook(Excel-TemplateFile)
  110. ObjTFExcel.loadCSV(sCSVName); //Loading Contents, from CSV to Excel
  111. //Setting up EXCEL Layout.
  112. //这里可以指定特定的行列不
  113. var nRows = sDGridName.rows - sDGridName.fixedRows + 1;
  114. var nCols = sDGridName.cols;
  115. ObjTFExcel.fontcolor ( 01, 01, nRows, nCols ) = "#000000" ;
  116. ObjTFExcel.font ( 01, 01, nRows, nCols ) = "SimSun" ;
  117. //这里不需要加入边框信息
  118. //ObjTFExcel.setBorderColor( 02, 02, nRows, nCols, "#000000") ;
  119. ObjTFExcel.bold ( 01, 01, nRows, nCols ) = true ;
  120. ObjTFExcel.fontsize ( 01, 01, nRows, nCols ) = 12 ;
  121. ObjTFExcel.underline ( 01, 01, nRows, nCols ) = 0 ;
  122. ObjTFExcel.valign ( 01, 01, nRows, nCols ) ="middle" ;
  123. ObjTFExcel.halign ( 01, 02, nRows, nCols ) ="left" ;
  124. //Query-Results Data
  125. var iRow = 1; // iRow = HeaderLine + 1;
  126. for(var i = iRow; i <= nRows; i++ ) {
  127. if( (i%8) == 1 ) {
  128. ObjTFExcel.rowHeight( i ) = 60;
  129. ObjTFExcel.mergeCell( i, 01, i, nCols );
  130. } else {
  131. //这里设置标志主题的行宽
  132. ObjTFExcel.rowHeight( i ) = 40;
  133. }
  134. }
  135. ObjTFExcel.colwidth ( 01 ) = 20 ;
  136. ObjTFExcel.colwidth ( 02 ) = 20 ;
  137. ObjTFExcel.colwidth ( 03 ) = 20 ;
  138. ObjTFExcel.colwidth ( 04 ) = 20 ;
  139. ObjTFExcel.sheetName(1) = sExcelSheetName;
  140. ObjTFExcel.save(sExcelName); //Saving EXCEL
  141. ObjTFExcel.close(); //Closing EXCEL. (You must be closed EXCEL !!!)
  142. window.exec("EXCEL.EXE", sExcelName); //Openning EXCEL
  143. }
  144. ]]>
  145. </script>
  146. </xhtml:head>
  147. <xhtml:body>
  148. <caption id="caption1" class="cell" style="left:0px; top:10px; width:80px; height:20px; ">发货指示号</caption>
  149. <object id="ObjTFExcel" clsid="{fe8d1001-6a9d-424d-ae2a-301493bb12da}" style="left:215px; top:10px; width:155px; height:25px; "/>
  150. <datagrid id="datagrid1" nodeset="/root/datagrid1/COILResult_VO/COILResult_Row" scroll="both" caption="选择^钢卷号^生产流水号^板坯号^原牌号^修改后牌号^合同号^重量^接口重量^单重下限^单重上限^订单规格^生产日期^标准^打印次数^打印页数^检验员^许可证号^许可证标识^备注^" colsep="^" colwidth="35, 90, 90, 80, 80, 100, 90, 80, 61, 71, 56, 80, 90, 80, 81, 100, 100, 100, 83, 200, 100" defaultrows="100" mergecellsfixedrows="bycolrec" rowheight="30" rowsep="|" style="left:0px; top:45px; width:980px; height:555px; ">
  151. <col checkvalue="Y,N" ref="CHK" type="checkbox"/>
  152. <col editable="false" ref="OLD_SAMPL_NO" type="input" style="background-color:#ffffff; "/>
  153. <col editable="false" ref="COIL_NO" type="input" style="background-color:#ffffff; "/>
  154. <col editable="false" ref="SLAB_NO" type="input" style="background-color:#ffffff; "/>
  155. <col editable="false" ref="SPEC_STL_GRD" type="input" style="background-color:#ffffff; "/>
  156. <col ref="CHANGE_SPEC_STL_GRD" type="input" maxlength="20" style="background-color:#ffff99; "/>
  157. <col editable="false" ref="ORD_NO" type="input" style="background-color:#ffffff; "/>
  158. <col editable="false" ref="ACT_WGT" type="input" style="background-color:#ffffff; "/>
  159. <col ref="H05_COIL_WGT"/>
  160. <col ref="ORD_UNIT_WGT_MIN"/>
  161. <col ref="ORD_UNIT_WGT_MAX"/>
  162. <col editable="false" ref="THK_WTH" type="input" style="background-color:#ffffff; "/>
  163. <col editable="false" ref="MILL_DTIME" type="input" style="background-color:#ffffff; "/>
  164. <col editable="false" ref="SPEC_ABBSYM" type="input" style="background-color:#ffffff; "/>
  165. <col editable="false" ref="PRINT_CNT" type="input" style="background-color:#ffffff; "/>
  166. <col ref="COIL_PAGES" type="combo" style="background-color:#ffff99; ">
  167. <choices>
  168. <item>
  169. <label>1</label>
  170. <value>1</value>
  171. </item>
  172. <item>
  173. <label>2</label>
  174. <value>2</value>
  175. </item>
  176. <item>
  177. <label>3</label>
  178. <value>3</value>
  179. </item>
  180. </choices>
  181. </col>
  182. <col ref="CHECKER_ID" type="input" maxlength="10" style="background-color:#ffff99; "/>
  183. <col ref="LICENSE_NO" type="input" maxlength="20" style="background-color:#ffff99; "/>
  184. <col ref="LICENSE_MARK" visibility="hidden"/>
  185. <col ref="COIL_MARK_RESVER" type="input" maxlength="50" style="background-color:#ffff99; "/>
  186. <col ref="DLIV_DIRNO" visibility="hidden"/>
  187. </datagrid>
  188. <button id="button2" visibility="hidden" style="left:910px; top:20px; width:65px; height:25px; ">
  189. <caption>导出excel</caption>
  190. <script type="javascript" ev:event="DOMActivate">
  191. <![CDATA[
  192. model.removenode("/root/datagrid2");
  193. model.makeNode("/root/datagrid2");
  194. model.refresh();
  195. var sCol_1 = "";
  196. var sCol_2 = "";
  197. var sCol_3 = "";
  198. var sCol_4 = "";
  199. var nRows2 = datagrid2.rows - datagrid2.fixedRows + 1;
  200. //alert("nRows2 : "+nRows2);
  201. //这里需要为导出方法准备数据,以键值对的形式
  202. for(var i= datagrid1.fixedRows;i<datagrid1.rows;i++){
  203. if(datagrid1.valueMatrix(i,datagrid1.colRef("CHK")) == "Y"){
  204. //在这里按照需要打印的格式,拼成报表.这里nRows2 + 6代表的是总行数
  205. for(var k=nRows2 ;k <= (nRows2 + 6); k++){
  206. //这里使用套打格式的方法处理
  207. if(((k%8) == 1) || ((k%8) == 0) ) {
  208. sCol_1 = "";
  209. sCol_2 = "";
  210. sCol_3 = "";
  211. sCol_4 = "";
  212. }else if( (k%8) == 2 ) {
  213. sCol_1 = " ";
  214. sCol_2 = model.getValue("/root/resData/COILResult_VO/COILResult_Row["+ i +"]/COIL_NO" );
  215. sCol_3 = " ";
  216. sCol_4 = model.getValue("/root/resData/COILResult_VO/COILResult_Row["+ i +"]/OLD_SAMPL_NO" );
  217. } else if( (k%8) == 3 ) {
  218. sCol_1 = " ";
  219. sCol_2 = model.getValue("/root/resData/COILResult_VO/COILResult_Row["+ i +"]/CHARE_NO" );
  220. sCol_3 = " ";
  221. sCol_4 = model.getValue("/root/resData/COILResult_VO/COILResult_Row["+ i +"]/SPEC_STL_GRD" );
  222. } else if( (k%8) == 4 ) {
  223. sCol_1 = " ";
  224. sCol_2 = model.getValue("/root/resData/COILResult_VO/COILResult_Row["+ i +"]/ORD_NO" );
  225. sCol_3 = " ";
  226. sCol_4 = model.getValue("/root/resData/COILResult_VO/COILResult_Row["+ i +"]/ACT_WGT" );
  227. } else if( (k%8) == 5 ) {
  228. sCol_1 = " ";
  229. sCol_2 = model.getValue("/root/resData/COILResult_VO/COILResult_Row["+ i +"]/THK_WTH" );
  230. sCol_3 = " ";
  231. sCol_4 = model.getValue("/root/resData/COILResult_VO/COILResult_Row["+ i +"]/MILL_DTIME" );
  232. }else if( (k%8) == 6 ) {
  233. sCol_1 = " ";
  234. sCol_2 = model.getValue("/root/resData/COILResult_VO/COILResult_Row["+ i +"]/SPEC_ABBSYM" );
  235. sCol_3 = " ";
  236. sCol_4 = model.getValue("/root/resData/COILResult_VO/COILResult_Row["+ i +"]/CHECKER_ID" );
  237. }else if( (k%8) == 7 ) {
  238. sCol_1 = " ";
  239. sCol_2 = model.getValue("/root/resData/COILResult_VO/COILResult_Row["+ i +"]/LICENSE_NO" );
  240. sCol_3 = " ";
  241. sCol_4 = model.getValue("/root/resData/COILResult_VO/COILResult_Row["+ i +"]/LICENSE_MARK" );
  242. }
  243. model.makeValue("/root/datagrid2/COILResult_VO/COILResult_Row["+ k +"]/COL_1" , sCol_1 );
  244. model.makeValue("/root/datagrid2/COILResult_VO/COILResult_Row["+ k +"]/COL_2" , sCol_2 );
  245. model.makeValue("/root/datagrid2/COILResult_VO/COILResult_Row["+ k +"]/COL_3" , sCol_3 );
  246. model.makeValue("/root/datagrid2/COILResult_VO/COILResult_Row["+ k +"]/COL_4" , sCol_4 );
  247. }
  248. }
  249. }
  250. model.refresh();
  251. saveExcelScript(datagrid2, "Sheet1");
  252. ]]>
  253. </script>
  254. <hint>
  255. <![CDATA[导出的EXCEL文件请保存在C盘,
  256. 保存在桌面会提示相应的错误信息。
  257. ]]>
  258. </hint>
  259. </button>
  260. <datagrid id="datagrid2" nodeset="/root/datagrid2/COILResult_VO/COILResult_Row" visibility="hidden" caption="col1^col2^col3^col4" colsep="^" colwidth="100, 100, 100, 100" defaultrows="100" mergecellsfixedrows="bycolrec" rowsep="|" style="left:40px; top:105px; width:425px; height:460px; ">
  261. <col ref="COL_1" type="output"/>
  262. <col ref="COL_2"/>
  263. <col ref="COL_3"/>
  264. <col ref="COL_4"/>
  265. </datagrid>
  266. <input id="input1" ref="/root/searchData/DLIV_DIRNO" maxlength="12" style="left:80px; top:10px; width:115px; height:20px; "/>
  267. <button id="button1" visibility="hidden" style="left:600px; top:20px; width:100px; height:20px; ">
  268. <caption>button1</caption>
  269. <script type="javascript" ev:event="onclick">
  270. <![CDATA[
  271. find();
  272. ]]>
  273. </script>
  274. </button>
  275. </xhtml:body>
  276. </xhtml:html>