SMRFC00700.js 89 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182
  1. /* ---------------------------------------------------------------------
  2. *
  3. * SMRFC00700_고정자산바코드출력.xrw (SMRFC00700.xfm - JScript )
  4. *
  5. * - Version :
  6. * 1) : Ver.1.00.01
  7. * : Create By
  8. * : 2008.08.22
  9. ---------------------------------------------------------------------- */
  10. function fInitialize()
  11. {
  12. misfGridInit(grd_fixasetlist); // 고정자산 List
  13. misfGridInit(grd_cpfixasetlist); // 고정자산 (바코드)List
  14. misfGridInit(grd_barcodetarget); // Barcode Print target Grid
  15. rszfGoodFlagListByPgmGubn(cmb_goodflag_search,"2");
  16. model.resetInstanceNode("/root/send");
  17. misfComboComCdListMulti("C0048","cmb_instcd_search");
  18. model.setValue("/root/send/fixasetlist/instcd_search", getUserInfo("dutplceinstcd")); // 기관 설정
  19. fSetPrintUseCheck();
  20. //misfMsterDetailSet(grd_fixasetlist, null, "TRRFC00202", "N");
  21. addComboItem("cmb_goodflag_search", "- 전 체 -", "", "above");
  22. // 대분류,중분류 코드 콤보 설정.
  23. rszfLMSComboList("FIX_ALL", "", "", "cmb_lrgcd_search", "", "L", "Y");
  24. rszfLMSComboList("FIX_ALL", "ALL", "", "cmb_mdlcd_search", "", "M", "Y");
  25. cmb_goodflag_search.select(0);
  26. cmb_goodflag_search.dispatch("xforms-value-changed");
  27. var curdate = getCurrentDate();
  28. var cvtdate = curdate.toDate("YYYYMMDD");
  29. //model.setValue(ipt_possnfrdd_search.attribute("ref") ,cvtdate.getAddDate(-1,"Y").getDateFormat("YYYYMMDD"));
  30. //model.setValue(ipt_possntodd_search.attribute("ref") ,curdate);
  31. //바코드 object 선언
  32. misfMakeBrcdPrntObjHanDo("CommAX");
  33. grd_fixasetlist.fixedcellcheckbox(0,grd_fixasetlist.colRef("choice"),true) = true;
  34. grd_cpfixasetlist.fixedcellcheckbox(0,grd_fixasetlist.colRef("choice"),false) = true;
  35. model.makeValue("/root/main/barcdprntsetup/comm",2);
  36. model.refresh();
  37. model.setFocus("ipt_fixasetcd_search");
  38. }
  39. function fSetPrintUseCheck()
  40. {
  41. /* var instcd = model.getValue(cmb_instcd_search.attribute("ref")).getTrim();
  42. if (instcd == "014"){
  43. //btn_prntset.visible = "false";
  44. }else{
  45. //btn_prntset.visible = "true";
  46. }
  47. model.refresh();*/
  48. }
  49. function fGridItemCheck( choiceFlag )
  50. {
  51. var choiceCnt = 0;
  52. if (grd_fixasetlist.rows - grd_fixasetlist.fixedRows <= 0 ) {
  53. messageBox("선택할 데이터가","I004");
  54. return false;
  55. }
  56. if ( choiceFlag == "check" ) {
  57. /*
  58. var goodflagengnm = "";
  59. var goodmodel = "";
  60. var possndd = "";
  61. var mngtdeptnm = "";
  62. var fixasetcd = "";
  63. var instcd = "";
  64. var goodflaghngnm = "";
  65. var installplcecd = "";
  66. var installplcenm = "";
  67. var cntrdeptnm = "";
  68. var suplplcenm = "";
  69. var barcdprntyn = "";
  70. var i = 1;
  71. for( cnt = grd_fixasetlist.fixedRows; cnt < grd_fixasetlist.rows ; cnt++ ) {
  72. if( grd_fixasetlist.valueMatrix( cnt, grd_fixasetlist.colRef("choice") ) == "Y") {
  73. choiceCnt = choiceCnt + 1;
  74. grd_barcodetarget.addRow(false); //그리드 열추가
  75. goodflagengnm = model.getValue("/root/main/list/fixaset/fixasetlist["+cnt+"]/goodflagengnm");
  76. goodmodel = model.getValue("/root/main/list/fixaset/fixasetlist["+cnt+"]/goodmodel");
  77. possndd = model.getValue("/root/main/list/fixaset/fixasetlist["+cnt+"]/possndd");
  78. mngtdeptnm = model.getValue("/root/main/list/fixaset/fixasetlist["+cnt+"]/mngtdeptnm");
  79. fixasetcd = model.getValue("/root/main/list/fixaset/fixasetlist["+cnt+"]/fixasetcd");
  80. instcd = model.getValue("/root/main/list/fixaset/fixasetlist["+cnt+"]/instcd");
  81. goodflaghngnm = model.getValue("/root/main/list/fixaset/fixasetlist["+cnt+"]/goodflaghngnm");
  82. installplcecd = model.getValue("/root/main/list/fixaset/fixasetlist["+cnt+"]/installplcecd");
  83. installplcenm = model.getValue("/root/main/list/fixaset/fixasetlist["+cnt+"]/installplcenm");
  84. cntrdeptnm = model.getValue("/root/main/list/fixaset/fixasetlist["+cnt+"]/cntrdeptnm");
  85. suplplcenm = model.getValue("/root/main/list/fixaset/fixasetlist["+cnt+"]/suplplcenm");
  86. //필요한 항목들을 전부 노드에서 가져와서 변수에 저장한다음 프린트한다.
  87. /*
  88. 장비명 goodflagengnm
  89. 모델명+제조원 goodmodel
  90. SN+취득일자 ?? + possndd
  91. 부서명(관리) mngtdeptnm
  92. 코드번호(바코드번호) fixasetcd
  93. 바코드
  94. */
  95. //바코드출력 함수 호출 및 매개변수 넘겨주기
  96. //BarcodePrtRFCMFACD(goodflagengnm , goodmodel , possndd , mngtdeptnm , fixasetcd);
  97. //선택된 고정자산자료들을 해당 노드에 부어주고 그 엄마 노드를 펑션에 보내서 바코드 출력하는 데 쓴다.
  98. /*
  99. model.setValue("/root/send/barcodetarget["+i+"]/fixasetcd" , fixasetcd , true );
  100. model.setValue("/root/send/barcodetarget["+i+"]/goodflagengnm" , goodflagengnm , true );
  101. model.setValue("/root/send/barcodetarget["+i+"]/goodmodel" , goodmodel , true );
  102. model.setValue("/root/send/barcodetarget["+i+"]/possndd" , possndd , true );
  103. model.setValue("/root/send/barcodetarget["+i+"]/mngtdeptnm" , mngtdeptnm , true );
  104. model.setValue("/root/send/barcodetarget["+i+"]/instcd" , instcd );
  105. model.setValue("/root/send/barcodetarget["+i+"]/goodflaghngnm" , goodflaghngnm , true );
  106. model.setValue("/root/send/barcodetarget["+i+"]/installplcecd" , installplcecd , true );
  107. model.setValue("/root/send/barcodetarget["+i+"]/installplcenm" , installplcenm , true );
  108. model.setValue("/root/send/barcodetarget["+i+"]/cntrdeptnm" , cntrdeptnm , true );
  109. model.setValue("/root/send/barcodetarget["+i+"]/suplplcenm" , suplplcenm , true );
  110. //출력함수에 해당 노드 첫번째 를 넘기고 출력이 잘 되었다면 그리드의 스테이터스를 update로 하고
  111. //출력여부를 Y로 셋팅한다.
  112. //바코드출력 함수 호출 및 매개변수(해당노드) 넘겨주기
  113. //BarcodePrtRFCMFACD(goodflagengnm , goodmodel , possndd , mngtdeptnm , fixasetcd);
  114. grd_barcodetarget.rowStatus(i) = 2;
  115. i = i+1;
  116. }
  117. }
  118. model.refresh();
  119. */
  120. model.resetInstanceNode("/root/copytemp");
  121. var varcopy = instance1.selectNodes(grd_fixasetlist.nodeset + "[choice='Y']");
  122. if ( varcopy.length == 0 ) {
  123. messageBox("선택한 데이터가","I004");
  124. return false;
  125. }
  126. }
  127. return true;
  128. }
  129. function fItemAllChoice( vFlag ) {
  130. if( fGridItemCheck()!=true ) return;
  131. var node = instance1.selectNodes(grd_fixasetlist.attribute("nodeset") + "/choice");
  132. for(var i=0; i<node.length; i++) {
  133. if(node.item(i).readOnly == false)
  134. node.item(i).value = vFlag;
  135. }
  136. }
  137. function fBarcodePrt() {
  138. misfGridInit(grd_cpfixasetlist); // 고정자산 (바코드)List
  139. var instcd = model.getValue(cmb_instcd_search.attribute("ref"));
  140. var goodnm, mngtdeptnm, installplcenm;
  141. var cnt = 0;
  142. if (instcd == '014'){
  143. var node = instance1.selectSingleNode("/root/main/list/fixaset/fixasetlist[choice='Y']");
  144. if (node == null){
  145. messageBox("선택할 데이터가","I004");
  146. return false;
  147. }
  148. for (var i = grd_fixasetlist.fixedRows;i<grd_fixasetlist.rows;i++){
  149. var chk = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("choice")).getTrim();
  150. var goodflag = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("goodflag")).getTrim();
  151. if (chk == "Y"){
  152. // [2010.08.26]AS-IS 코드 TO_BE 코드 전환을 위한 물품구분 변경 (goodflag= E) => (goodflag= EQ)
  153. if (goodflag == "EQ"){
  154. goodnm = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("goodflagengnm")).getTrim();
  155. }else{
  156. goodnm = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("goodflaghngnm")).getTrim();
  157. }
  158. grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("goodnm1")) = goodnm.cut(goodnm.num(goodnm, 20));
  159. grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("goodnm2")) = goodnm.substr2(goodnm.num(goodnm, 20)-1, goodnm.length);
  160. mngtdeptnm = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("mngtdeptnm")).getTrim();
  161. installplcenm = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("installplcenm")).getTrim();
  162. if (installplcenm == ""){
  163. deptnm = mngtdeptnm;
  164. }else{
  165. deptnm = mngtdeptnm + "/" + installplcenm;
  166. }
  167. grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("deptnm1")) = deptnm.cut(deptnm.num(deptnm, 20));
  168. grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("deptnm2")) = deptnm.substr2(deptnm.num(deptnm, 20)-1, deptnm.length);
  169. grd_cpfixasetlist.addRow(false);
  170. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("goodnm1" )) = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("goodnm1" ));
  171. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("goodnm2" )) = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("goodnm2" ));
  172. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("goodmodel")) = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("goodmodel"));
  173. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("mngtno" )) = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("mngtno" ));
  174. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("deptnm1" )) = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("deptnm1" ));
  175. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("deptnm2" )) = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("deptnm2" ));
  176. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("possndd" )) = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("possndd" ));
  177. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("fixasetcd")) = grd_fixasetlist.valueMatrix(i, grd_fixasetlist.colRef("fixasetcd"));
  178. }
  179. }
  180. exeReportPreview("RPRFC00701","XMLSTR");
  181. }else{
  182. fBarcodePrt_CmdType();
  183. }
  184. }
  185. function fBarcodePrt_CmdType(){
  186. if( fGridItemCheck( "check" ) != true ) return;
  187. misfGridInit(grd_barcodetarget); // Barcode Print target Grid 초기화
  188. model.resetInstanceNode("/root/copytemp");
  189. var varcopy = instance1.selectNodes(grd_fixasetlist.nodeset + "[choice='Y']");
  190. if ( varcopy.length > 0 ) {
  191. var rCSV = getNodeListCSV(varcopy);
  192. //model.setValue("/root/copytemp", rCSV);
  193. //var CSV = model.getValue("/root/copytemp");
  194. //setCSVToNode("/root/send", CSV, "barcodetarget");
  195. setCSVToNode("/root/main", rCSV, "barcodetarget");
  196. }
  197. /*
  198. for( cnt = grd_fixasetlist.fixedRows; cnt < grd_fixasetlist.rows; cnt++ ) {
  199. if ( grd_fixasetlist.valueMatrix( cnt, grd_fixasetlist.colRef("choice") ) == "Y" ) {
  200. grd_barcodetarget.addItem();
  201. grd_barcodetarget.valueMatrix( grd_barcodetarget.rows - grd_barcodetarget.fixedRows, grd_barcodetarget.colRef("instcd") ) = grd_fixasetlist.valueMatrix( cnt, grd_fixasetlist.colRef("instcd"))
  202. }
  203. }
  204. */
  205. //grd_barcodetarget.gridToInstance();
  206. model.refresh();
  207. for ( i = grd_barcodetarget.fixedRows ; i< grd_barcodetarget.rows; i++) {
  208. //라벨출력 한줄씩 시키고 라벨 출력 했으면 해당 row를 update로 바꾼다
  209. grd_barcodetarget.rowStatus(i) = 2;
  210. }
  211. /*
  212. var nowdate = getCurrentDate();
  213. var checkdate = nowdate.toDate("YYYYMMDD");
  214. var checkdatestring = checkdate.getDateFormat("YYYYMMDD");
  215. var nextcheckdatestring = checkdate.getAddDate(+1,"Y").getDateFormat("YYYYMMDD")
  216. */
  217. model.setValue("/root/send/barcodetarget" ,grd_barcodetarget.getUpdateData());
  218. if (model.getValue(cmb_instcd_search.attribute("ref")) == "013"){
  219. if ( BarcodePrtRFCMFACD_013("/root/main/barcdprntsetup","/root/main/barcodetarget") == false ) //바코드출력
  220. {
  221. return;
  222. }
  223. }else if ((model.getValue(cmb_instcd_search.attribute("ref")) == "114")||(model.getValue(cmb_instcd_search.attribute("ref")) == "032")||(model.getValue(cmb_instcd_search.attribute("ref")) == "103")){
  224. if ( BarcodePrtRFCMFACD_103("/root/main/barcdprntsetup","/root/main/barcodetarget") == false ) //바코드출력
  225. {
  226. return;
  227. }
  228. }else if (model.getValue(cmb_instcd_search.attribute("ref")) == "014"){
  229. BarcodePrtRFCMFACD_014(); //바코드출력
  230. }else if (model.getValue(cmb_instcd_search.attribute("ref")) == "011"){
  231. if ( BarcodePrtRFCMFACD_011("/root/main/barcdprntsetup","/root/main/barcodetarget") == false ) //바코드출력
  232. {
  233. return;
  234. }
  235. }else{
  236. if ( BarcodePrtRFCMFACD("/root/main/barcdprntsetup","/root/main/barcodetarget") == false ) //바코드출력
  237. {
  238. return;
  239. }
  240. }
  241. /*
  242. if ( BarcodePrtRFCMFACD("/root/main/barcdprntsetup","/root/main/barcodetarget") == false ) //바코드출력
  243. {
  244. return;
  245. }*/
  246. //바코드 출력한 물품들 출력여부를 Y로 셋팅한다.
  247. misfSave("TXRFC00701");
  248. //바뀐 그리드에 row에 update를 submit 날려서 DB에 저장한다.
  249. //현재 노드셋을 다 넘겨준다.
  250. //var today = curdate.toString();
  251. //alert(today);
  252. //BarcodePrtRFCMFACD("/root/main/barcdprntsetup","/root/send/barcodetarget",checkdatestring , nextcheckdatestring);
  253. btn_search.dispatch("DOMActivate");
  254. }
  255. //프린터 설정
  256. function fSetPrint() {
  257. var count = getNodesetCount("/root/main/barcdprntsetup/prntsetupinfo/setupinfo");
  258. if(count == 0) {
  259. model.makeNode("/root/main/barcdprntsetup/prntsetupinfo/setupinfo");
  260. }
  261. open("SPRPZ00700_바코드프린터설정.xrw", "", "", "", "", "/root/main/barcdprntsetup/prntsetupinfo/setupinfo", "/root/main/barcdprntsetup/prntsetupinfo/setupinfo");
  262. }
  263. /*
  264. *바코드 출력 함수
  265. * psRef 바코드프린트 셋팅관련 노드셋
  266. * pRef 고정자산 프린트 관련 노드셋
  267. * cvtdate 점검일(오늘날짜)
  268. * nextcvtdate 다음점검일(현재는 일년뒤로 셋팅되어 있음)
  269. */
  270. function BarcodePrtRFCMFACD(psRef , pRef , cvtdate , nextcvtdate , pKCount , pPCount){
  271. var vInstance = document.models(0).instances(0);
  272. var cntHR = vInstance.selectNodes(pRef).length; // 고정자산 프린트 할 전체 목록의 갯수
  273. var barcdRef = "/root/main/barcdprntsetup/prntsetupinfo/setupinfo"; // 바코드프린터 셋팅관련
  274. var sPrntKind = model.getValue(barcdRef + "[1]/prntkind"); // 바코드프린터 종류
  275. var portOpenTF = "";
  276. // Lcount , Mcont
  277. var KCount = 0;
  278. var PCount = 0;
  279. if (pKCount == null || pKCount == ""){
  280. KCount = 0;
  281. }else{
  282. KCount = pKCount;
  283. }
  284. if (pPCount == null || pPCount == ""){
  285. PCount = 0;
  286. }else{
  287. PCount = pPCount;
  288. }
  289. if (cntHR > 0 && sPrntKind != 0){
  290. var sCommKind = model.getValue(barcdRef + "[1]/commkind"); //통신유형(PRT , COM , TCP/IP)
  291. var sLeftBank = model.getValue(barcdRef + "[1]/blank/left"); //왼쪽여백
  292. var sTopBank = model.getValue(barcdRef + "[1]/blank/top"); //위쪽여백
  293. if (sCommKind == "01") { //통신유형(PRT)
  294. var sSetUpVal = model.getValue(barcdRef + "[1]/comm01/setupval");
  295. } else if (sCommKind == "02") { //통신유형(COM)
  296. var sComm = model.getValue(barcdRef + "[1]/comm02/comm" ); //COM Port
  297. var sDataBit = model.getValue(barcdRef + "[1]/comm02/databit" ); //Data Bit
  298. var sStopBit = model.getValue(barcdRef + "[1]/comm02/stopbit" ); //Stop Bit
  299. var sBaudRate = model.getValue(barcdRef + "[1]/comm02/baudrate"); //Baud Rate
  300. var sParity = model.getValue(barcdRef + "[1]/comm02/parity" ); //Parity
  301. CommAX.CommPort = sComm;
  302. CommAX.Settings = sBaudRate + "," + sParity + "," + sDataBit + "," + sStopBit;
  303. if(KCount > 0){
  304. //이미 포트 오픈 되어 있으므로 "TRUE" 셋팅
  305. portOpenTF = "TRUE";
  306. }else if(KCount == 0){
  307. //port open 반환값 -> String 문자 포트 오픈 성공이면 "TRUE" , 실패하면 "FALSE"
  308. portOpenTF = CommAX.PortOpen("true");
  309. }
  310. } else if (sCommKind == "03") { //통신유형(TCP/IP)
  311. var sSetUpVal = model.getValue(barcdRef + "[1]/comm03/setupval");
  312. }
  313. var DeptNm = "";
  314. if ( (portOpenTF == "TRUE" && sCommKind == "02")
  315. ||(sCommKind == "01") || (sCommKind == "03")){
  316. for (i=1 ; i<= cntHR;i++){
  317. var goodflag = model.getvalue(pRef+ "["+i+"]/goodflag" ).getTrim();
  318. var fixasetcd = model.getvalue(pRef+ "["+i+"]/fixasetcd" ).getTrim();
  319. var goodflagengnm = model.getvalue(pRef+ "["+i+"]/goodflagengnm").getTrim();
  320. var goodmodel = model.getvalue(pRef+ "["+i+"]/goodmodel" ).getTrim();
  321. var possndd = model.getvalue(pRef+ "["+i+"]/possndd" ).getTrim();
  322. var mngtdeptnm = model.getvalue(pRef+ "["+i+"]/mngtdeptnm" ).getTrim();
  323. var mngtno = model.getvalue(pRef+ "["+i+"]/mngtno" ).getTrim();
  324. var instcd = model.getvalue(pRef+ "["+i+"]/instcd" ).getTrim();
  325. var goodflaghngnm = model.getvalue(pRef+ "["+i+"]/goodflaghngnm").getTrim();
  326. var installplcecd = model.getvalue(pRef+ "["+i+"]/installplcecd").getTrim();
  327. var installplcenm = model.getvalue(pRef+ "["+i+"]/installplcenm").getTrim();
  328. var cntrdeptnm = model.getvalue(pRef+ "["+i+"]/cntrdeptnm" ).getTrim();
  329. var suplplcenm = model.getvalue(pRef+ "["+i+"]/suplplcenm" ).getTrim();
  330. var prodcmpynm = model.getvalue(pRef+ "["+i+"]/prodcmpynm" ).getTrim();
  331. var leftmargin = 250;
  332. var leftmarginother = 10;
  333. //시작 위치 설정
  334. if (sLeftBank == "" || sLeftBank == "-") sLeftBank = leftmargin; //350
  335. if (sTopBank == "" || sTopBank == "-") sTopBank = 20;
  336. var sSndMsg = "";
  337. if(sPrntKind == "1") {
  338. sSndMsg += misfBP_StartFormat(sLeftBank, sTopBank); // 시작위치 셋팅
  339. //sSndMsg += misfBP_ChangeFont("A", 0, 0); // 폰트 설정
  340. //misfBP_FieldDataHNEW(pX, pY, pW, pH, pData)
  341. //시작(X, Y)
  342. //sSndMsg += misfBP_StartFormat(0, 30);
  343. sSndMsg += "^SEE:UHANGUL.DAT^FS^CWQ,E:AAAAA.FNT^FS^CI26^FO10,46^AQN,16,16^FD^FS";
  344. //장비명
  345. //[2010.08.26]AS-IS 코드 TO_BE 코드 전환을 위한 물품구분 변경 (goodflag= E) => (goodflag= EQ)
  346. if (goodflag == "EQ"){
  347. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 15 , 25 , 25 , goodflagengnm.substr(0,20));
  348. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 47 , 25 , 25 , goodflagengnm.substr(20,20));
  349. }else{
  350. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 15 , 25 , 25 , goodflaghngnm.substr(0,20));
  351. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 47 , 25 , 25 , goodflaghngnm.substr(20,20));
  352. }
  353. //모델명
  354. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 75 , 24 , 24 , "- "+goodmodel);
  355. //취득일자(일-월-년 순서로 출력)+SN
  356. //[2010.08.26]AS-IS 코드 TO_BE 코드 전환을 위한 물품구분 변경 (goodflag= G) => (goodflag= GE)
  357. if (goodflag == "GE") {
  358. sSndMsg += misfBP_FieldDataHNEW(leftmarginother, 105 , 24 , 24 , "- "+possndd.substr(6,2)+possndd.substr(4,2)+possndd.substr(2,2)+mngtno); //82
  359. }else {
  360. sSndMsg += misfBP_FieldDataHNEW(leftmarginother, 105 , 24 , 24 , "- "+possndd.substr(6,2)+possndd.substr(4,2)+possndd.substr(2,2)+"_"+mngtno); //82
  361. }
  362. //부서명(관리부서)
  363. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 140 , 24 , 24 , "- "+mngtdeptnm); //100 , mngtdeptnm
  364. //[2010.08.26]AS-IS 코드 TO_BE 코드 전환을 위한 물품구분 변경 (goodflag= E) => (goodflag= EQ)
  365. if (goodflag == "EQ"){
  366. //제조원(장비만...)
  367. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 172 , 24 , 24 , "- "+prodcmpynm);
  368. }else{
  369. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 172 , 24 , 24 , "-");
  370. }
  371. //코드번호
  372. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 205 , 24 , 24 , "- "+fixasetcd);
  373. //바코드
  374. sSndMsg += misfBP_ChangeFont("F", 10, 10);
  375. sSndMsg += misfBP_BarCode_Code39NEW(0, 240, "N", 50, "*" +fixasetcd + "*"); // 바코드 //114
  376. sSndMsg += misfBP_EndFormat();
  377. if(sCommKind == "01") {
  378. CommAX.SendMessageToLPT(sSndMsg);
  379. } else if(sCommKind == "02") {
  380. CommAX.SendMessage(sSndMsg);
  381. }
  382. }//end if(sPrntKind == "1")
  383. }//end for
  384. //portopen이 true이고 통신유형이 com이고 출력할 병리 바코드가 없을때 port close
  385. if( portOpenTF == "TRUE" && sCommKind == "02" && PCount == 0){
  386. CommAX.PortOpen("false");
  387. }
  388. }else if((portOpenTF = "FALSE" && sCommKind == "02")){
  389. messageBox("아래 사항을 확인후 재출력해주십시오."
  390. + " \n 1.프린트설정 화면에서 통신유형을 com 으로 선택한 경우 port 번호 확인"
  391. + " \n 2.케이블 확인"
  392. + " \n 3.먼저 출력중인 바코드 확인(모두 출력된 후 재출력하십시오.)", "I", "");
  393. return false;
  394. }
  395. }//End if
  396. }//End Function
  397. function BarcodePrtRFCMFACD_011(psRef , pRef , cvtdate , nextcvtdate , pKCount , pPCount){
  398. var vInstance = document.models(0).instances(0);
  399. var cntHR = vInstance.selectNodes(pRef).length; // 고정자산 프린트 할 전체 목록의 갯수
  400. var barcdRef = "/root/main/barcdprntsetup/prntsetupinfo/setupinfo"; // 바코드프린터 셋팅관련
  401. var sPrntKind = model.getValue(barcdRef + "[1]/prntkind"); // 바코드프린터 종류
  402. var portOpenTF = "";
  403. // Lcount , Mcont
  404. var KCount = 0;
  405. var PCount = 0;
  406. if (pKCount == null || pKCount == ""){
  407. KCount = 0;
  408. }else{
  409. KCount = pKCount;
  410. }
  411. if (pPCount == null || pPCount == ""){
  412. PCount = 0;
  413. }else{
  414. PCount = pPCount;
  415. }
  416. if (cntHR > 0 && sPrntKind != 0){
  417. var sCommKind = model.getValue(barcdRef + "[1]/commkind"); //통신유형(PRT , COM , TCP/IP)
  418. var sLeftBank = model.getValue(barcdRef + "[1]/blank/left"); //왼쪽여백
  419. var sTopBank = model.getValue(barcdRef + "[1]/blank/top"); //위쪽여백
  420. if (sCommKind == "01") { //통신유형(PRT)
  421. var sSetUpVal = model.getValue(barcdRef + "[1]/comm01/setupval");
  422. } else if (sCommKind == "02") { //통신유형(COM)
  423. var sComm = model.getValue(barcdRef + "[1]/comm02/comm" ); //COM Port
  424. var sDataBit = model.getValue(barcdRef + "[1]/comm02/databit" ); //Data Bit
  425. var sStopBit = model.getValue(barcdRef + "[1]/comm02/stopbit" ); //Stop Bit
  426. var sBaudRate = model.getValue(barcdRef + "[1]/comm02/baudrate"); //Baud Rate
  427. var sParity = model.getValue(barcdRef + "[1]/comm02/parity" ); //Parity
  428. CommAX.CommPort = sComm;
  429. CommAX.Settings = sBaudRate + "," + sParity + "," + sDataBit + "," + sStopBit;
  430. if(KCount > 0){
  431. //이미 포트 오픈 되어 있으므로 "TRUE" 셋팅
  432. portOpenTF = "TRUE";
  433. }else if(KCount == 0){
  434. //port open 반환값 -> String 문자 포트 오픈 성공이면 "TRUE" , 실패하면 "FALSE"
  435. portOpenTF = CommAX.PortOpen("true");
  436. }
  437. } else if (sCommKind == "03") { //통신유형(TCP/IP)
  438. var sSetUpVal = model.getValue(barcdRef + "[1]/comm03/setupval");
  439. }
  440. var DeptNm = "";
  441. if ( (portOpenTF == "TRUE" && sCommKind == "02")
  442. ||(sCommKind == "01") || (sCommKind == "03")){
  443. for (i=1 ; i<= cntHR;i++){
  444. var goodflag = model.getvalue(pRef+ "["+i+"]/goodflag" ).getTrim();
  445. var fixasetcd = model.getvalue(pRef+ "["+i+"]/fixasetcd" ).getTrim();
  446. var goodflagengnm = model.getvalue(pRef+ "["+i+"]/goodflagengnm").getTrim();
  447. var goodmodel = model.getvalue(pRef+ "["+i+"]/goodmodel" ).getTrim();
  448. var possndd = model.getvalue(pRef+ "["+i+"]/possndd" ).getTrim();
  449. var mngtdeptnm = model.getvalue(pRef+ "["+i+"]/mngtdeptnm" ).getTrim();
  450. var mngtno = model.getvalue(pRef+ "["+i+"]/mngtno" ).getTrim();
  451. var instcd = model.getvalue(pRef+ "["+i+"]/instcd" ).getTrim();
  452. var goodflaghngnm = model.getvalue(pRef+ "["+i+"]/goodflaghngnm").getTrim();
  453. var installplcecd = model.getvalue(pRef+ "["+i+"]/installplcecd").getTrim();
  454. var installplcenm = model.getvalue(pRef+ "["+i+"]/installplcenm").getTrim();
  455. var cntrdeptnm = model.getvalue(pRef+ "["+i+"]/cntrdeptnm" ).getTrim();
  456. var suplplcenm = model.getvalue(pRef+ "["+i+"]/suplplcenm" ).getTrim();
  457. var prodcmpynm = model.getvalue(pRef+ "["+i+"]/prodcmpynm" ).getTrim();
  458. var leftmargin = 250;
  459. var leftmarginother = 10;
  460. //시작 위치 설정
  461. if (sLeftBank == "" || sLeftBank == "-") sLeftBank = leftmargin; //350
  462. if (sTopBank == "" || sTopBank == "-") sTopBank = 20;
  463. var sSndMsg = "";
  464. if(sPrntKind == "1") {
  465. sSndMsg += misfBP_StartFormat(sLeftBank, sTopBank); // 시작위치 셋팅
  466. //sSndMsg += misfBP_ChangeFont("A", 0, 0); // 폰트 설정
  467. //misfBP_FieldDataHNEW(pX, pY, pW, pH, pData)
  468. //시작(X, Y)
  469. //sSndMsg += misfBP_StartFormat(0, 30);
  470. sSndMsg += "^SEE:UHANGUL.DAT^FS^CWQ,E:AAAAA.FNT^FS^CI26^FO10,46^AQN,16,16^FD^FS";
  471. //장비명
  472. //[2010.08.26]AS-IS 코드 TO_BE 코드 전환을 위한 물품구분 변경 (goodflag= E) => (goodflag= EQ)
  473. if (goodflag == "EQ"){
  474. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 15 , 27 , 27 , goodflagengnm.substr(0,20));
  475. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 47 , 27 , 27 , goodflagengnm.substr(20,20));
  476. }else{
  477. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 15 , 27 , 27 , goodflaghngnm.substr(0,20));
  478. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 47 , 27 , 27 , goodflaghngnm.substr(20,20));
  479. }
  480. //모델명
  481. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 75 , 24 , 24 , "- "+goodmodel);
  482. //취득일자(일-월-년 순서로 출력)+SN
  483. sSndMsg += misfBP_FieldDataHNEW(leftmarginother, 105 , 24 , 24 , "- "+possndd.substr(0,4)+"-"+possndd.substr(4,2)+"-"+possndd.substr(6,2)+"_"+mngtno); //82
  484. //부서명(관리부서)
  485. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 140 , 24 , 24 , "- "+mngtdeptnm); //100 , mngtdeptnm
  486. //[2010.08.26]AS-IS 코드 TO_BE 코드 전환을 위한 물품구분 변경 (goodflag= E) => (goodflag= EQ)
  487. if (goodflag == "EQ"){
  488. //제조원(장비만...)
  489. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 172 , 24 , 24 , "- "+prodcmpynm);
  490. }else{
  491. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 172 , 24 , 24 , "-");
  492. }
  493. //코드번호
  494. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 205 , 30 , 30 , "- "+fixasetcd);
  495. //바코드
  496. sSndMsg += misfBP_ChangeFont("F", 10, 10);
  497. sSndMsg += misfBP_BarCode_Code39NEW(0, 240, "N", 50, "*" +fixasetcd + "*"); // 바코드 //114
  498. sSndMsg += misfBP_EndFormat();
  499. if(sCommKind == "01") {
  500. CommAX.SendMessageToLPT(sSndMsg);
  501. } else if(sCommKind == "02") {
  502. CommAX.SendMessage(sSndMsg);
  503. }
  504. }//end if(sPrntKind == "1")
  505. }//end for
  506. //portopen이 true이고 통신유형이 com이고 출력할 병리 바코드가 없을때 port close
  507. if( portOpenTF == "TRUE" && sCommKind == "02" && PCount == 0){
  508. CommAX.PortOpen("false");
  509. }
  510. }else if((portOpenTF = "FALSE" && sCommKind == "02")){
  511. messageBox("아래 사항을 확인후 재출력해주십시오."
  512. + " \n 1.프린트설정 화면에서 통신유형을 com 으로 선택한 경우 port 번호 확인"
  513. + " \n 2.케이블 확인"
  514. + " \n 3.먼저 출력중인 바코드 확인(모두 출력된 후 재출력하십시오.)", "I", "");
  515. return false;
  516. }
  517. }//End if
  518. }//End Function
  519. function BarcodePrtRFCMFACD_103(psRef , pRef , cvtdate , nextcvtdate , pKCount , pPCount){
  520. var vInstance = document.models(0).instances(0);
  521. var cntHR = vInstance.selectNodes(pRef).length; // 고정자산 프린트 할 전체 목록의 갯수
  522. var barcdRef = "/root/main/barcdprntsetup/prntsetupinfo/setupinfo"; // 바코드프린터 셋팅관련
  523. var sPrntKind = model.getValue(barcdRef + "[1]/prntkind"); // 바코드프린터 종류
  524. var portOpenTF = "";
  525. // Lcount , Mcont
  526. var KCount = 0;
  527. var PCount = 0;
  528. if (pKCount == null || pKCount == ""){
  529. KCount = 0;
  530. }else{
  531. KCount = pKCount;
  532. }
  533. if (pPCount == null || pPCount == ""){
  534. PCount = 0;
  535. }else{
  536. PCount = pPCount;
  537. }
  538. if (cntHR > 0 && sPrntKind != 0){
  539. var sCommKind = model.getValue(barcdRef + "[1]/commkind"); //통신유형(PRT , COM , TCP/IP)
  540. var sLeftBank = model.getValue(barcdRef + "[1]/blank/left"); //왼쪽여백
  541. var sTopBank = model.getValue(barcdRef + "[1]/blank/top"); //위쪽여백
  542. if (sCommKind == "01") { //통신유형(PRT)
  543. var sSetUpVal = model.getValue(barcdRef + "[1]/comm01/setupval");
  544. } else if (sCommKind == "02") { //통신유형(COM)
  545. var sComm = model.getValue(barcdRef + "[1]/comm02/comm" ); //COM Port
  546. var sDataBit = model.getValue(barcdRef + "[1]/comm02/databit" ); //Data Bit
  547. var sStopBit = model.getValue(barcdRef + "[1]/comm02/stopbit" ); //Stop Bit
  548. var sBaudRate = model.getValue(barcdRef + "[1]/comm02/baudrate"); //Baud Rate
  549. var sParity = model.getValue(barcdRef + "[1]/comm02/parity" ); //Parity
  550. CommAX.CommPort = sComm;
  551. CommAX.Settings = sBaudRate + "," + sParity + "," + sDataBit + "," + sStopBit;
  552. if(KCount > 0){
  553. //이미 포트 오픈 되어 있으므로 "TRUE" 셋팅
  554. portOpenTF = "TRUE";
  555. }else if(KCount == 0){
  556. //port open 반환값 -> String 문자 포트 오픈 성공이면 "TRUE" , 실패하면 "FALSE"
  557. portOpenTF = CommAX.PortOpen("true");
  558. }
  559. } else if (sCommKind == "03") { //통신유형(TCP/IP)
  560. var sSetUpVal = model.getValue(barcdRef + "[1]/comm03/setupval");
  561. }
  562. var DeptNm = "";
  563. if ( (portOpenTF == "TRUE" && sCommKind == "02")
  564. ||(sCommKind == "01") || (sCommKind == "03")){
  565. for (i=1 ; i<= cntHR;i++){
  566. var goodflag = model.getvalue(pRef+ "["+i+"]/goodflag" ).getTrim();
  567. var fixasetcd = model.getvalue(pRef+ "["+i+"]/fixasetcd" ).getTrim();
  568. var goodflagengnm = model.getvalue(pRef+ "["+i+"]/goodflagengnm").getTrim();
  569. var goodmodel = model.getvalue(pRef+ "["+i+"]/goodmodel" ).getTrim();
  570. var possndd = model.getvalue(pRef+ "["+i+"]/possndd" ).getTrim();
  571. var mngtdeptnm = model.getvalue(pRef+ "["+i+"]/mngtdeptnm" ).getTrim();
  572. var mngtno = model.getvalue(pRef+ "["+i+"]/mngtno" ).getTrim();
  573. var instcd = model.getvalue(pRef+ "["+i+"]/instcd" ).getTrim();
  574. var goodflaghngnm = model.getvalue(pRef+ "["+i+"]/goodflaghngnm").getTrim();
  575. var installplcecd = model.getvalue(pRef+ "["+i+"]/installplcecd").getTrim();
  576. var installplcenm = model.getvalue(pRef+ "["+i+"]/installplcenm").getTrim();
  577. var cntrdeptnm = model.getvalue(pRef+ "["+i+"]/cntrdeptnm" ).getTrim();
  578. var suplplcenm = model.getvalue(pRef+ "["+i+"]/suplplcenm" ).getTrim();
  579. var prodcmpynm = model.getvalue(pRef+ "["+i+"]/prodcmpynm" ).getTrim();
  580. var leftmargin = 220;
  581. var leftmarginother = 270;
  582. //시작 위치 설정
  583. if (sLeftBank == "" || sLeftBank == "-") sLeftBank = leftmargin; //350
  584. if (sTopBank == "" || sTopBank == "-") sTopBank = 20;
  585. var sSndMsg = "";
  586. if(sPrntKind == "1") {
  587. sSndMsg += misfBP_StartFormat(sLeftBank, sTopBank); // 시작위치 셋팅
  588. //sSndMsg += misfBP_ChangeFont("A", 0, 0); // 폰트 설정
  589. //misfBP_FieldDataHNEW(pX, pY, pW, pH, pData)
  590. //시작(X, Y)
  591. //sSndMsg += misfBP_StartFormat(0, 30);
  592. sSndMsg += "^SEE:UHANGUL.DAT^FS^CWQ,E:AAAAA.FNT^FS^CI26^FO10,46^AQN,16,16^FD^FS";
  593. //장비명
  594. //[2010.08.26]AS-IS 코드 TO_BE 코드 전환을 위한 물품구분 변경 (goodflag= E) => (goodflag= EQ)
  595. if (goodflag == "EQ"){
  596. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 15 , 25 , 25 , goodflagengnm.substr(0,27));
  597. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 47 , 25 , 25 , goodflagengnm.substr(27,20));
  598. }else{
  599. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 15 , 25 , 25 , goodflaghngnm.substr(0,27));
  600. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 47 , 25 , 25 , goodflaghngnm.substr(27,20));
  601. }
  602. //모델명
  603. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 75 , 24 , 24 , "- "+goodmodel);
  604. //취득일자(일-월-년 순서로 출력)+SN
  605. //if (goodflag == "G") {
  606. // sSndMsg += misfBP_FieldDataHNEW(leftmarginother, 105 , 24 , 24 , "- "+possndd.substr(6,2)+possndd.substr(4,2)+possndd.substr(2,2)+mngtno); //82
  607. //}else {
  608. // sSndMsg += misfBP_FieldDataHNEW(leftmarginother, 105 , 24 , 24 , "- "+possndd.substr(6,2)+possndd.substr(4,2)+possndd.substr(2,2)+"_"+mngtno); //82
  609. //}
  610. sSndMsg += misfBP_FieldDataHNEW(leftmarginother, 105 , 24 , 24 , "- "+possndd.substr(6,2)+possndd.substr(4,2)+possndd.substr(2,2)+"_"+mngtno); //82
  611. //부서명(관리부서)
  612. //sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 140 , 24 , 24 , "- "+mngtdeptnm); //100 , mngtdeptnm
  613. //부서명(관리부서)+설치장소
  614. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 140 , 24 , 24 , "- "+mngtdeptnm+"_"+installplcenm ); //100 , mngtdeptnm
  615. //if (goodflag == "E"){
  616. //제조원(장비만...)
  617. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 172 , 24 , 24 , "- "+prodcmpynm);
  618. //}else{
  619. //sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 172 , 24 , 24 , "-");
  620. //}
  621. //코드번호
  622. sSndMsg += misfBP_FieldDataHNEW(leftmarginother , 205 , 24 , 24 , "- "+fixasetcd);
  623. //바코드
  624. sSndMsg += misfBP_ChangeFont("F", 10, 10);
  625. sSndMsg += misfBP_BarCode_Code39NEW(310, 240, "N", 50, "*" +fixasetcd + "*"); // 바코드 //114
  626. //title
  627. if (instcd == '114'){
  628. sSndMsg += misfBP_FieldDataHNEW(70 , 195 , 28 , 28 , "산학협력단");
  629. }else if (instcd == '032'){
  630. sSndMsg += misfBP_FieldDataHNEW(60 , 195 , 28 , 28 , "의과학연구원");
  631. }
  632. sSndMsg += misfBP_EndFormat();
  633. if(sCommKind == "01") {
  634. CommAX.SendMessageToLPT(sSndMsg);
  635. } else if(sCommKind == "02") {
  636. CommAX.SendMessage(sSndMsg);
  637. }
  638. }//end if(sPrntKind == "1")
  639. }//end for
  640. //portopen이 true이고 통신유형이 com이고 출력할 병리 바코드가 없을때 port close
  641. if( portOpenTF == "TRUE" && sCommKind == "02" && PCount == 0){
  642. CommAX.PortOpen("false");
  643. }
  644. }else if((portOpenTF = "FALSE" && sCommKind == "02")){
  645. messageBox("아래 사항을 확인후 재출력해주십시오."
  646. + " \n 1.프린트설정 화면에서 통신유형을 com 으로 선택한 경우 port 번호 확인"
  647. + " \n 2.케이블 확인"
  648. + " \n 3.먼저 출력중인 바코드 확인(모두 출력된 후 재출력하십시오.)", "I", "");
  649. return false;
  650. }
  651. }//End if
  652. }//End Function
  653. function fBarElementPrt(pValue, pSndMsg, iXPos, iYPos)
  654. {
  655. var aStr = "";
  656. var iWidth = 0;
  657. var aFlag = new Array();
  658. aStr = misfGetHanGul(pValue, aFlag);
  659. for (var iNo=0; iNo < aStr.length; iNo++) {
  660. if (aFlag[iNo] == "E") {
  661. pSndMsg += "^CF030,30^FO"+(Number(iXPos)+Number(iWidth))+","+ iYPos +"^FD" + aStr[iNo] + "^FS";
  662. iWidth = iWidth + (Number(aStr[iNo].length) * 14);
  663. } else {
  664. pSndMsg += CommAX.PrtImgOut((Number(iXPos)+Number(iWidth)), iYPos, aStr[iNo], 1, 1);
  665. pSndMsg += CommAX.HanImageData();
  666. iWidth = iWidth + (Number(aStr[iNo].length) * 24);
  667. }
  668. }
  669. return pSndMsg;
  670. }
  671. /*
  672. *바코드 출력 함수
  673. * psRef 바코드프린트 셋팅관련 노드셋
  674. * pRef 고정자산 프린트 관련 노드셋
  675. * cvtdate 점검일(오늘날짜)
  676. * nextcvtdate 다음점검일(현재는 일년뒤로 셋팅되어 있음)
  677. */
  678. function BarcodePrtRFCMFACD_013(psRef , pRef , cvtdate , nextcvtdate , pKCount , pPCount){
  679. var vInstance = document.models(0).instances(0);
  680. var cntHR = vInstance.selectNodes(pRef).length; //고정자산 프린트 할 전체 목록의 갯수
  681. var barcdRef = "/root/main/barcdprntsetup/prntsetupinfo/setupinfo"; //바코드프린터 셋팅관련
  682. var sPrntKind = model.getValue(barcdRef + "[1]/prntkind"); //바코드프린터 종류
  683. var portOpenTF = "";
  684. // Lcount , Mcont
  685. var KCount = 0;
  686. var PCount = 0;
  687. if (pKCount == null || pKCount == ""){
  688. KCount = 0;
  689. }else{
  690. KCount = pKCount;
  691. }
  692. if (pPCount == null || pPCount == ""){
  693. PCount = 0;
  694. }else{
  695. PCount = pPCount;
  696. }
  697. //
  698. if (cntHR > 0 && sPrntKind != 0){
  699. var sCommKind = model.getValue(barcdRef + "[1]/commkind"); //통신유형(PRT , COM , TCP/IP)
  700. var sLeftBank = model.getValue(barcdRef + "[1]/blank/left"); //왼쪽여백
  701. var sTopBank = model.getValue(barcdRef + "[1]/blank/top"); //위쪽여백
  702. if (sCommKind == "01") { //통신유형(PRT)
  703. var sSetUpVal = model.getValue(barcdRef + "[1]/comm01/setupval");
  704. if(KCount > 0){
  705. //이미 포트 오픈 되어 있으므로 "TRUE" 셋팅
  706. portOpenTF = "TRUE";
  707. }else if(KCount == 0){
  708. portOpenTF = CommAX.PortOpen("true");
  709. }
  710. } else if (sCommKind == "02") { //통신유형(COM)
  711. var sComm = model.getValue(barcdRef + "[1]/comm02/comm" ); //COM Port
  712. var sDataBit = model.getValue(barcdRef + "[1]/comm02/databit" ); //Data Bit
  713. var sStopBit = model.getValue(barcdRef + "[1]/comm02/stopbit" ); //Stop Bit
  714. var sBaudRate = model.getValue(barcdRef + "[1]/comm02/baudrate"); //Baud Rate
  715. var sParity = model.getValue(barcdRef + "[1]/comm02/parity" ); //Parity
  716. CommAX.CommPort = sComm;
  717. CommAX.Settings = sBaudRate + "," + sParity + "," + sDataBit + "," + sStopBit;
  718. if(KCount > 0){
  719. //이미 포트 오픈 되어 있으므로 "TRUE" 셋팅
  720. portOpenTF = "TRUE";
  721. }else if(KCount == 0){
  722. //port open 반환값 -> String 문자 포트 오픈 성공이면 "TRUE" , 실패하면 "FALSE"
  723. portOpenTF = CommAX.PortOpen("true");
  724. }
  725. } else if (sCommKind == "03") { //통신유형(TCP/IP)
  726. var sSetUpVal = model.getValue(barcdRef + "[1]/comm03/setupval");
  727. }
  728. var DeptNm = "";
  729. if ( (portOpenTF == "TRUE" && sCommKind == "02")
  730. ||(sCommKind == "01") || (sCommKind == "03")){
  731. for (i=1 ; i<= cntHR;i++){
  732. var fixasetcd = model.getvalue(pRef+ "["+i+"]/fixasetcd" ).getTrim();
  733. var goodflagengnm = model.getvalue(pRef+ "["+i+"]/goodflagengnm").getTrim();
  734. var goodmodel = model.getvalue(pRef+ "["+i+"]/goodmodel" ).getTrim();
  735. var possndd = model.getvalue(pRef+ "["+i+"]/possndd" ).getTrim();
  736. var mngtdeptnm = model.getvalue(pRef+ "["+i+"]/mngtdeptnm" ).getTrim();
  737. var mngtno = model.getvalue(pRef+ "["+i+"]/mngtno" ).getTrim();
  738. var instcd = model.getvalue(pRef+ "["+i+"]/instcd" ).getTrim();
  739. var goodflaghngnm = model.getvalue(pRef+ "["+i+"]/goodflaghngnm").getTrim();
  740. var installplcecd = model.getvalue(pRef+ "["+i+"]/installplcecd").getTrim();
  741. var installplcenm = model.getvalue(pRef+ "["+i+"]/installplcenm").getTrim();
  742. var cntrdeptnm = model.getvalue(pRef+ "["+i+"]/cntrdeptnm" ).getTrim();
  743. var suplplcenm = model.getvalue(pRef+ "["+i+"]/suplplcenm" ).getTrim();
  744. var sSndMsg = "";
  745. var iXPos = 0, iYPos = 0;
  746. if(sPrntKind == "1") {
  747. //시작(X, Y)
  748. sSndMsg += misfBP_StartFormat(0, 0); // 시작위치 셋팅
  749. iXPos = Number(sLeftBank) + 190;
  750. iYPos = Number(sTopBank) + 115;
  751. //제품명
  752. sSndMsg += fBarElementPrt(goodflagengnm, sSndMsg, iXPos, iYPos);
  753. if(sCommKind == "01") {
  754. CommAX.SendMessageToLPT(sSndMsg);
  755. sSndMsg = "";
  756. } else if(sCommKind == "02") {
  757. CommAX.SendMessage(sSndMsg);
  758. sSndMsg = "";
  759. }
  760. //Serial No.
  761. iYPos += 30;
  762. sSndMsg += fBarElementPrt("S/N:"+mngtno, sSndMsg, iXPos, iYPos);
  763. //사용부서
  764. iYPos += 60;
  765. sSndMsg += fBarElementPrt(mngtdeptnm, sSndMsg, iXPos, iYPos);
  766. if(sCommKind == "01") {
  767. CommAX.SendMessageToLPT(sSndMsg);
  768. sSndMsg = "";
  769. } else if(sCommKind == "02") {
  770. CommAX.SendMessage(sSndMsg);
  771. sSndMsg = "";
  772. }
  773. //구입일자
  774. iYPos += 50;
  775. sSndMsg += misfBP_ChangeFont("C", 18, 18); // 폰트 설정
  776. sSndMsg += misfBP_FieldDataA(iXPos, iYPos, possndd.substr(0,4)+"-"+possndd.substr(4,2)
  777. +"-"+possndd.substr(6,2));
  778. //자산코드
  779. iYPos += 50;
  780. sSndMsg += misfBP_ChangeFont("B", 17, 17); // 폰트 설정
  781. //sSndMsg += misfBP_FieldDataA(iXPos, iYPos, fixasetcd);
  782. sSndMsg += misfBP_FieldDataA(iXPos, iYPos, fixasetcd.substr(0,1)+"-"+fixasetcd.substr(1,2)
  783. +"-"+fixasetcd.substr(3,2)
  784. +"-"+fixasetcd.substr(5,fixasetcd.length-4));
  785. //자산코드(바코드 type)
  786. iXPos = 80;
  787. iYPos += 40;
  788. sSndMsg += misfBP_ChangeFont("C", 35, 35); // 폰트 설정
  789. sSndMsg += misfBP_BarCode_Code39NEW(iXPos, iYPos, "N", 70, "*" +fixasetcd + "*"); // 바코드 //114
  790. sSndMsg += misfBP_EndFormat();
  791. if(sCommKind == "01") {
  792. CommAX.SendMessageToLPT(sSndMsg);
  793. } else if(sCommKind == "02") {
  794. CommAX.SendMessage(sSndMsg);
  795. }
  796. }//end if(sPrntKind == "1")
  797. }//end for
  798. //portopen이 true이고 통신유형이 com이고 출력할 병리 바코드가 없을때 port close
  799. if( portOpenTF == "TRUE" && sCommKind == "02" && PCount == 0){
  800. CommAX.PortOpen("false");
  801. }
  802. }else if((portOpenTF = "FALSE" && sCommKind == "02")){
  803. messageBox("아래 사항을 확인후 재출력해주십시오."
  804. + " \n 1.프린트설정 화면에서 통신유형을 com 으로 선택한 경우 port 번호 확인"
  805. + " \n 2.케이블 확인"
  806. + " \n 3.먼저 출력중인 바코드 확인(모두 출력된 후 재출력하십시오.)", "I", "");
  807. return false;
  808. }
  809. }//End if
  810. }//End Function
  811. function fGetBrcdPrntInfo() {
  812. model.makeNode("/root/main/barcdprntsetup");
  813. model.makeNode("/root/send/scrnid");
  814. model.setValue("/root/send/scrnid", getScreenID());
  815. model.createChild("xforms:submission", "id:TRRPZ00701;mediatype:application/x-www-form-urlencoded; method:post; ref:" + "/root/send" + "; resultref:" + "/root/main/barcdprntsetup" + "; ");
  816. submit("TRRPZ00701");
  817. }
  818. // 경북대 병원 버전
  819. function fBarcodePrtKnu() {
  820. //misfGridInit(grd_cpfixasetlist); // 고정자산 (바코드)List
  821. var instcd = model.getValue(cmb_instcd_search.attribute("ref"));
  822. var goodnm, mngtdeptnm, installplcenm;
  823. var cnt = 0;
  824. var node = instance1.selectNodes("/root/main/list/fixaset/fixasetlist[choice='Y']");
  825. if (node == null || node.length < 1){
  826. messageBox("선택 된 자산이","I004");
  827. return false;
  828. }
  829. for (var i=0; i<node.length; i++) {
  830. var selectItem = node.item(i);
  831. if(selectItem.selectSingleNode("choice").readOnly == false) {
  832. var goodflag = selectItem.selectSingleNode("goodflag").value.getTrim();
  833. // [2010.08.26]AS-IS 코드 TO_BE 코드 전환을 위한 물품구분 변경 (goodflag= E) => (goodflag= EQ)
  834. if (goodflag == "EQ") {
  835. goodnm = selectItem.selectSingleNode("goodflagengnm").value.getTrim();
  836. } else {
  837. goodnm = selectItem.selectSingleNode("goodflaghngnm").value.getTrim();
  838. }
  839. mngtdeptnm = selectItem.selectSingleNode("mngtdeptnm").value.getTrim();
  840. installplcenm = selectItem.selectSingleNode("installplcenm").value.getTrim();
  841. grd_cpfixasetlist.addRow(false);
  842. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("instcd" )) = selectItem.selectSingleNode("instcd").value;
  843. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("fixasetcd" )) = selectItem.selectSingleNode("fixasetcd").value;
  844. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("possndd" )) = selectItem.selectSingleNode("possndd").value;
  845. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("goodnm1" )) = goodnm;
  846. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("goodspec" )) = selectItem.selectSingleNode("goodspec").value;
  847. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("deptnm1" )) = mngtdeptnm;
  848. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("deptnm2" )) = installplcenm;
  849. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("mngtno" )) = selectItem.selectSingleNode("mngtno").value;
  850. grd_cpfixasetlist.valueMatrix(grd_cpfixasetlist.row, grd_cpfixasetlist.colRef("suplplcenm" )) = selectItem.selectSingleNode("suplplcenm").value;
  851. selectItem.selectSingleNode("choice").readOnly = true;
  852. }
  853. }
  854. grd_fixasetlist.refresh();
  855. if(grd_cpfixasetlist.rows - grd_cpfixasetlist.fixedRows > 0) {
  856. btn_deleteall.disabled = false;
  857. btn_barcodeprt.disabled = false;
  858. }
  859. //exeReportPreview("RPRFC00702","XMLSTR");
  860. }
  861. function fCheckSelectList() {
  862. var newGrid = grd_fixasetlist;
  863. var selGrid = grd_cpfixasetlist;
  864. var newNodeList = instance1.selectNodes(grd_fixasetlist.attribute("nodeset"));
  865. var selNodeList = instance1.selectNodes(grd_cpfixasetlist.attribute("nodeset") + "/fixasetcd");
  866. if(newNodeList == null || newNodeList.length < 1 || selNodeList == null || selNodeList.length < 1) return;
  867. for(var i=0; i<newNodeList.length; i++) {
  868. var selectItem = newNodeList.item(i);
  869. var instcd = selectItem.selectSingleNode("instcd").value;
  870. var fixasetcd = selectItem.selectSingleNode("fixasetcd").value;
  871. var checkNode = instance1.selectNodes(grd_cpfixasetlist.attribute("nodeset") + "[instcd='" + instcd + "' and fixasetcd='" + fixasetcd + "']");
  872. if(checkNode != null && checkNode.length > 0) {
  873. var choice = selectItem.selectSingleNode("choice");
  874. choice.value = "Y";
  875. choice.readOnly = true;
  876. }
  877. }
  878. grd_fixasetlist.refresh();
  879. }
  880. function fDelPrintList(delType) {
  881. var delGrid = grd_cpfixasetlist;
  882. var node = instance1.selectNodes(delGrid.attribute("nodeset") + "[choice='Y']");
  883. if (delType != "DeleteAll" && (node == null || node.length < 1)){
  884. messageBox("선택 된 자산이","I004");
  885. return false;
  886. }
  887. for(i=delGrid.rows; i >= delGrid.fixedRows;i--){
  888. var instcd = delGrid.valueMatrix(i, delGrid.colRef("instcd"));
  889. var fixasetcd = delGrid.valueMatrix(i, delGrid.colRef("fixasetcd"));
  890. var choice = delGrid.valueMatrix(i, delGrid.colRef("choice"));
  891. if(choice == "Y" || delType == "DeleteAll") {
  892. var checkNode = instance1.selectNodes(grd_fixasetlist.attribute("nodeset") + "[instcd='" + instcd + "' and fixasetcd='" + fixasetcd + "']");
  893. if(checkNode != null && checkNode.length > 0) {
  894. var choice = checkNode.item(0).selectSingleNode("choice");
  895. choice.value = "N";
  896. choice.readOnly = false;
  897. }
  898. delGrid.deleteRow(i,false);
  899. }
  900. }
  901. delGrid.fixedcellischeck(0, grd_fixasetlist.colRef("choice")) = false;
  902. if(grd_cpfixasetlist.rows - grd_cpfixasetlist.fixedRows <= 0) {
  903. btn_deleteall.disabled = true;
  904. btn_barcodeprt.disabled = true;
  905. }
  906. }
  907. /* ------------------------------------------------- */
  908. /* ------End Of List ------------------------------- */
  909. /* -------------------------------------------------- */