/webccr/src/com/emis/caesar/senao/event/button/TBtnPreOrder.java

https://bitbucket.org/sanliou/synccr · Java · 525 lines · 434 code · 39 blank · 52 comment · 84 complexity · 21ec033f2c8d9c8918c6e34e90054c61 MD5 · raw file

  1. package com.emis.caesar.senao.event.button;
  2. import com.emis.caesar.senao.data.TEntryEdit;
  3. import com.emis.caesar.senao.data.TEntryEdits;
  4. import com.emis.caesar.senao.event.TButtonEventContext;
  5. import com.emis.caesar.senao.event.TForceAssignSalesEventContext;
  6. import com.emis.caesar.senao.unit.TCcrConst;
  7. import com.emis.caesar.senao.unit.sale.TSaleItem;
  8. import com.emis.caesar.senao.util.EDCUtil;
  9. import com.emis.caesarui.webccr.webccr;
  10. import com.emis.util.emisUtil;
  11. import com.vaadin.ui.UI;
  12. import java.util.ArrayList;
  13. import java.util.HashMap;
  14. /**
  15. * 預購取件 (目前設定一個預購單號,只會有一種型態(PRE_ORDER_REF))
  16. * 兩種情況
  17. * 1.入帳商品被判斷為預購品時, 需輸入預購單號. 取得預購資料判斷
  18. * 2.由功能鍵輸入預購單號, 帶入預購商品
  19. */
  20. public class TBtnPreOrder extends TForceAssignSalesEventContext {
  21. TEntryEdits FoEntryEdits = null;
  22. ArrayList<HashMap> listSaleG = null;// 預購單資料
  23. ArrayList<HashMap> listENT = null; // 企客案資料
  24. private String sCM_PRE_ORDNO = ""; // 預購單號 SALE_G.CM_PRE_ORDNO / EC_PREORDER_PRICE_INFO.EC_PREORDER_NO
  25. private String sPRE_ORDER_REF = ""; // 預約購機型態
  26. boolean isCM_PRICE = false; // CM_PRICE 價格由預購單拋轉(Y/N)
  27. boolean isOpenPromo = false; // 是否搭配促案 (非欄位,isOpenPromo()判斷)
  28. private boolean isPLUinto = false; // 是否為PLU執行
  29. private TBtnPLU btnPLU = null; // PLU傳過來原本的PLU
  30. private String PLU_P_NO = ""; // PLU傳過來P_NO
  31. private String sP_NO = ""; // 新增品項
  32. private String sSL_KEY = ""; // SALE_G.SL_KEY
  33. private String sRECNO = ""; // SALE_G.RECNO
  34. private int iNowIndex = 0; // 目前執行listSaleG的index
  35. private int iNowIndexENT = 0; // 目前執行listENT的index
  36. private boolean isDOA = false; // 是否為福利品
  37. private boolean isENT = false; // 是否為企客案
  38. private String sPAY_NO = TCcrConst.PAY_UNKNOW; // 企客案 付款類型: 現金、信用卡 (TCcrConst.PAY_CASH / TCcrConst.PAY_CREDIT)
  39. private String sPAY_PRICE = "0"; // 企客案 付款金額
  40. private String sINSP_KIND = ""; // 分期數
  41. private String sBindKey = ""; // 綁定值
  42. //
  43. public boolean runEventMethod(String sMethod_) {
  44. if (sMethod_.equals("clickOK")) {
  45. return clickOK();
  46. } else if (sMethod_.equals("clickCancel")) {
  47. return clickCancel();
  48. } else if (sMethod_.equals("runGeneralPLU")) {
  49. return runGeneralPLU(); // 直接走一般PLU流程
  50. } else if (sMethod_.equals("PLU_OK")) {
  51. return PLU_OK();
  52. } else if (sMethod_.equals("PLU_OR_OK")) {
  53. return PLU_OR_OK();
  54. } else if (sMethod_.equals("PLU_OK_END")) {
  55. return PLU_OK_END();
  56. } else if (sMethod_.equals("PLU_ERR")) {
  57. return PLU_ERR();
  58. } else if (sMethod_.equals("ENTcancel")) {
  59. return clickCancel();
  60. } else if (sMethod_.equals("ENTok")) {
  61. return ENTok();
  62. } else if (sMethod_.equals("PLU_ENT_OK")) {
  63. return PLU_ENT_OK();
  64. } else if (sMethod_.equals("PAY_OK_MSG")) {
  65. return PAY_OK_MSG();
  66. } else if (sMethod_.equals("PAY_ERROR_MSG")) {
  67. return PAY_ERROR_MSG();
  68. } else if (sMethod_.equals("PAY_ERROR")) {
  69. return PAY_ERROR();
  70. }
  71. else {
  72. return super.runEventMethod(sMethod_);
  73. }
  74. }
  75. protected boolean clickOK() {
  76. // 取得 預購取件 資料
  77. sCM_PRE_ORDNO = FoEntryEdits.getEdit(0).getText(); // 預購單號
  78. if (FoSale != null) {
  79. if (FoSale.isPreOrder(sCM_PRE_ORDNO)) {
  80. FsErrMsg = "預購單號不可重複輸入!!";
  81. return eventOver(false);
  82. }
  83. }
  84. listSaleG = FoCcr.getDbData.getPreOrder(FoCcr.getStore().FLDxS_NO, sCM_PRE_ORDNO, PLU_P_NO);
  85. if (listSaleG == null || listSaleG.isEmpty()) {
  86. if (isPLUinto) {
  87. // PLU商品進來,無預購資料,提示”非預購機,按一般商品入帳”.後續則直接走一般PLU流程
  88. FoCcr.UInotify.swErrMsgWithBtnEvent("非預購機,按一般商品入帳", this, "runGeneralPLU");
  89. return handover();
  90. }
  91. FsErrMsg = "無預購資料";
  92. return eventOver(false);
  93. }
  94. HashMap<String,String> mapSaleG;
  95. for (int i = 0; i < listSaleG.size(); i++) {
  96. mapSaleG = listSaleG.get(i);
  97. // 企客案(ENT)
  98. if ((TCcrConst.PREORDER_ENT).equals(mapSaleG.get("PRE_ORDER_REF"))) {
  99. isENT = true;
  100. } else if ((TCcrConst.PREORDER_DOA).equals(mapSaleG.get("PRE_ORDER_REF"))) {
  101. isDOA = true;
  102. }
  103. }
  104. /*
  105. PLU進入之商品 (”門號申辦”及”領機”之帶入商品)
  106. SALE_G.PRE_ORDER_REF='DOA'時,
  107. 不適用於由”門號申辦”及”領機”之帶入商品.
  108. 提示”福利品僅能空機銷售, 無法搭配門號銷售”
  109. 繼續跑PLU
  110. */
  111. if (isPLUinto) {
  112. if (isDOA) {
  113. if ((TSaleItem.PRJ_SALE).equals(btnPLU.ACT_CODE) || (TSaleItem.PRJ_RECEIVE_PHONE).equals(btnPLU.ACT_CODE)) {
  114. FoCcr.UInotify.swErrMsgWithBtnEvent("該商品為福利品,無法搭配門號銷售或領機", this, "runGeneralPLU");
  115. return handover();
  116. }
  117. }
  118. }
  119. // 給入綁定值
  120. sBindKey = (FoSale.getSaleItemCount() + 1) + "";
  121. // 企客案(ENT) 判斷
  122. if (isENT) {
  123. // 檢查是否有輸入業務員
  124. if (FoCcr.getUser() == null) {
  125. FsErrMsg = "請輸入業務員";
  126. return eventOver(false);
  127. } else {
  128. if (emisUtil.isEmpty(FoCcr.getUser().getFLDxST_KEY())) {
  129. FsErrMsg = "請輸入業務員";
  130. return eventOver(false);
  131. }
  132. }
  133. if (FoSale.getRealSaleItemCount() != 0) {
  134. FsErrMsg = "已有交易品項不可使用本功能之企客案";
  135. return eventOver(false);
  136. }
  137. // 檢查是否有輸入經銷商代碼
  138. if (emisUtil.isEmpty(FoSale.getFsCS_NO())) {
  139. FsErrMsg = "此為企客案,請先輸入經銷商代碼";
  140. return eventOver(false);
  141. }
  142. return doENT();
  143. }
  144. return execute();
  145. }
  146. protected boolean clickCancel() {
  147. if (isPLUinto) {
  148. return runGeneralPLU();
  149. }
  150. FsErrMsg = TCcrConst.MSG_HIDE;
  151. return eventOver(false);
  152. }
  153. protected boolean runGeneralPLU() {
  154. // 繼續執行原本的PLU
  155. TBtnPLU _oEvent = btnPLU;
  156. _oEvent.setPreOrderRtn(true); // 設定不執行預購取件,返回執行原本的PLU
  157. return _oEvent.validate();
  158. }
  159. protected boolean PLU_OK() {
  160. iNowIndex ++;
  161. return execute();
  162. }
  163. protected boolean PLU_OR_OK() {
  164. iNowIndex ++;
  165. PLU_P_NO = ""; // 清空PLU傳過來的商品品號
  166. return execute();
  167. }
  168. // 最後一筆PLU,結束這個事件
  169. protected boolean PLU_OK_END() {
  170. return finalProcedure();
  171. }
  172. protected boolean PLU_ERR() {
  173. ((webccr) UI.getCurrent()).getlog().info(webccr.class, sP_NO + "品項新增失敗!");
  174. FsErrMsg = TCcrConst.MSG_HIDE;
  175. return eventOver(false);
  176. }
  177. protected boolean ENTok() {
  178. if (FoEntryEdits != null) {
  179. if (FoEntryEdits.getEdit(0) != null) {
  180. sPAY_NO = FoEntryEdits.getEdit(0).getText();
  181. sPAY_PRICE = FoEntryEdits.getEdit(1).getText();
  182. sINSP_KIND = FoEntryEdits.getEdit(2).getText();
  183. // 將SALE_G.SL_KEY和RECNO 寫入listENT
  184. saleGmatchENT();
  185. doListENT();
  186. }
  187. }
  188. FsErrMsg = TCcrConst.MSG_HIDE;
  189. return eventOver(false);
  190. }
  191. protected boolean PLU_ENT_OK() {
  192. iNowIndexENT ++;
  193. return doListENT();
  194. }
  195. protected boolean PAY_OK_MSG() {
  196. isENT = false; // 信用卡付完款,不會再跑eventOver中的付款
  197. FoCcr.UInotify.swMessage("交易完成!");
  198. return eventOver(true);
  199. }
  200. protected boolean PAY_ERROR_MSG() {
  201. // 主要是信用付款會失敗(取消用信用卡交易)
  202. FoCcr.UInotify.swErrMsgWithBtnEvent("付款失敗,請重新交易!", this, "PAY_ERROR");
  203. return eventOver(false);
  204. }
  205. protected boolean PAY_ERROR() {
  206. // 取消交易
  207. TBtnCancelSale _oCancelSaleEvent = new TBtnCancelSale(false);
  208. _oCancelSaleEvent.go();
  209. return eventOver(false);
  210. }
  211. // 檢核條件
  212. protected boolean verifyPrecondition() {
  213. if (!forceAssignSales()) {
  214. FsErrMsg = TCcrConst.MSG_HIDE;
  215. return eventOver(false);
  216. }
  217. return entryData();
  218. }
  219. public boolean entryData() {
  220. FoEntryEdits = new TEntryEdits("預購取件");
  221. FoEntryEdits.addEdit(new TEntryEdit("預購單號", true, false)); //不限定英數
  222. FoCcr.UInotify.swEntryEdits(FoEntryEdits, this, "clickOK", "clickCancel");
  223. return handover();
  224. }
  225. public boolean execute() {
  226. /*
  227. 當 非企客案 PRE_ORDER_REF != 'ENT'
  228. 執行listSaleG內的全部商品,跑PLU
  229. 執行PLU成功==>PLU_OK()
  230. ==> 1.更新iNowIndex,決定目前的商品
  231. 2.execute()
  232. 如果為最後一筆資料 iNowIndex == (listSaleG.size()-1)
  233. ==> PLU_OK_END() 1.finalProcedure()
  234. */
  235. doListG();
  236. return handover();
  237. }
  238. protected boolean doListG() {
  239. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "===第" + iNowIndex + "筆===");
  240. if (iNowIndex < listSaleG.size()) {
  241. HashMap<String,String> mapSaleG;
  242. String sCM_PRICE = "";
  243. String sCM_PAYFOR = "";
  244. int iSL_PRICE = -1;
  245. String sMethodOK = "PLU_OK";
  246. // 最後一筆
  247. if (iNowIndex == (listSaleG.size()-1)) {
  248. sMethodOK = "PLU_OK_END";
  249. }
  250. mapSaleG = listSaleG.get(iNowIndex);
  251. sP_NO = mapSaleG.get("P_NO");
  252. sPRE_ORDER_REF = mapSaleG.get("PRE_ORDER_REF");
  253. sSL_KEY = mapSaleG.get("SL_KEY");
  254. sRECNO = mapSaleG.get("RECNO");
  255. sCM_PRICE = mapSaleG.get("CM_PRICE");
  256. sCM_PAYFOR = mapSaleG.get("CM_PAYFOR");
  257. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "SL_KEY:" + sSL_KEY);
  258. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "RECNO:" + sRECNO);
  259. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "P_NO:" + sP_NO);
  260. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "PRE_ORDER_REF:" + sPRE_ORDER_REF);
  261. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "CM_PRICE:" + sCM_PRICE);
  262. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "CM_PAYFOR:" + sCM_PAYFOR);
  263. // N==>取VPLU_WEBCCR.P_PRICE;Y==>取SALE_G.SL_PRICE
  264. isCM_PRICE = "Y".equals(sCM_PRICE) ? true : false;
  265. if (isCM_PRICE) {
  266. iSL_PRICE = emisUtil.parseInt(mapSaleG.get("SL_PRICE"));
  267. }
  268. // C (S4預購、iPhone預購)搭配促案 可能不只有C而已 反向判斷
  269. if (!TCcrConst.PREORDER_PVON.equals(sPRE_ORDER_REF) &&
  270. !TCcrConst.PREORDER_DOA.equals(sPRE_ORDER_REF) &&
  271. !TCcrConst.PREORDER_OLT.equals(sPRE_ORDER_REF) &&
  272. !TCcrConst.PREORDER_GEN.equals(sPRE_ORDER_REF) &&
  273. !TCcrConst.PREORDER_ENT.equals(sPRE_ORDER_REF)) {
  274. isOpenPromo = true;
  275. } else {
  276. isOpenPromo = false;
  277. }
  278. runPLU(iSL_PRICE, sMethodOK);
  279. }
  280. return handover();
  281. }
  282. protected boolean runPLU(int iPrice, String sMethodOK) {
  283. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "===runPLU===");
  284. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "PLU_P_NO:" + PLU_P_NO);
  285. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "P_NO:" + sP_NO);
  286. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "isOpenPromo:" + isOpenPromo);
  287. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "isCM_PRICE:" + isCM_PRICE);
  288. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "iPrice:" + iPrice);
  289. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "sMethodOK:" + sMethodOK);
  290. TBtnPLU _oEvent = new TBtnPLU();
  291. // 如果由PLU入之商品和預購取件之商品相同,使用原本之PLU (”門號申辦”及”領機”使用)
  292. if (PLU_P_NO.equals(sP_NO)) {
  293. sMethodOK = "PLU_OR_OK";
  294. _oEvent = btnPLU;
  295. }
  296. _oEvent.setOpenPromo(isOpenPromo);
  297. _oEvent.setFsNo(sP_NO);
  298. if (isCM_PRICE) {
  299. _oEvent.setFsAmt(iPrice);
  300. }
  301. _oEvent.setFbChangePrice(isCM_PRICE); // 設定為固定傳入價格
  302. _oEvent.setPreOrder(true);
  303. _oEvent.setCM_PRE_ORDNO(sCM_PRE_ORDNO);
  304. _oEvent.setPreOrderSL_KEY(sSL_KEY);
  305. _oEvent.setPreOrderRECNO(sRECNO);
  306. _oEvent.setFsServiceBindKey(sBindKey); // 一併商品同預購單號之商品 以RECNO為主
  307. _oEvent.setOtherEvent_(this);
  308. _oEvent.setOtherMethodOK_(sMethodOK);
  309. _oEvent.setOtherMethodCancel_("PLU_ERR");
  310. if (PLU_P_NO.equals(sP_NO)) {
  311. return _oEvent.validate();
  312. }
  313. return _oEvent.go();
  314. }
  315. protected boolean doENT() {
  316. // 企客案(信義企客、等等)
  317. listENT = FoCcr.getDbData.getPreOrderCsNO(FoCcr.getStore().FLDxS_NO, sCM_PRE_ORDNO);
  318. if (!listENT.isEmpty()) {
  319. // 切換狀態
  320. FiNextState = TCcrConst.CPS_WAIT_PAY;
  321. FoEntryEdits = new TEntryEdits("");
  322. FoCcr.UInotify.swPreOrderCsNo(FoEntryEdits, this, listENT, "ENTok", "ENTcancel");
  323. return handover();
  324. } else {
  325. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "---查無企客案資料---");
  326. FsErrMsg = "查無企客案資料!";
  327. return eventOver(false);
  328. }
  329. }
  330. protected boolean saleGmatchENT() {
  331. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "===saleGmatchENT===");
  332. HashMap<String,String> mapSaleG;
  333. HashMap<String,String> mapENT;
  334. String sP_NO_SALE_G = "";
  335. String sSL_KEY_SALE_G = "";
  336. String sRECNO_SALE_G = "";
  337. String sP_NO_ENT = "";
  338. String sSL_KEY_ENT = "";
  339. String sRECNO_ENT = "";
  340. for (int i = 0; i < listSaleG.size(); i++) {
  341. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "---i=" + i + "---");
  342. mapSaleG = listSaleG.get(i);
  343. sP_NO_SALE_G = mapSaleG.get("P_NO");
  344. sSL_KEY_SALE_G = mapSaleG.get("SL_KEY");
  345. sRECNO_SALE_G = mapSaleG.get("RECNO");
  346. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "sP_NO_SALE_G = " + sP_NO_SALE_G);
  347. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "sSL_KEY_SALE_G = " + sSL_KEY_SALE_G);
  348. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "sRECNO_SALE_G = " + sRECNO_SALE_G);
  349. for (int j = 0; j < listENT.size(); j++) {
  350. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "-j=" + j + "-");
  351. mapENT = listENT.get(j);
  352. sP_NO_ENT = mapENT.get("P_NO");
  353. sSL_KEY_ENT = mapENT.get("SL_KEY");
  354. sRECNO_ENT = mapENT.get("RECNO");
  355. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "sP_NO_ENT = " + sP_NO_ENT);
  356. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "sSL_KEY_ENT = " + sSL_KEY_ENT);
  357. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "sRECNO_ENT = " + sRECNO_ENT);
  358. // 如果此筆mapENT的SL_KEY和RECNO為空,檢查P_NO是否相同,相同,就將mapSaleG的SL_KEY和RECNO塞到此筆mapENT
  359. if (emisUtil.isEmpty(sSL_KEY_ENT) && emisUtil.isEmpty(sRECNO_ENT)) {
  360. if (sP_NO_SALE_G.equals(sP_NO_ENT)) {
  361. mapENT.put("SL_KEY", sSL_KEY_SALE_G);
  362. mapENT.put("RECNO", sRECNO_SALE_G);
  363. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "--P_NO相等--");
  364. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "SL_KEY = " + mapENT.get("SL_KEY"));
  365. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "RECNO = " + mapENT.get("RECNO"));
  366. break;
  367. }
  368. }
  369. }
  370. }
  371. return handover();
  372. }
  373. protected boolean doListENT() {
  374. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "===第" + iNowIndexENT + "筆===");
  375. if (iNowIndexENT < listENT.size()) {
  376. HashMap<String,String> mapENT;
  377. String sCASH_PRICE = ""; // 現金金額
  378. String sCREDIT_PRICE = "";// 信用卡金額
  379. String sINSP_KIND = ""; // 分期數
  380. int iSL_PRICE = -1;
  381. String sMethodOK = "PLU_ENT_OK";
  382. // 最後一筆
  383. if (iNowIndexENT == (listENT.size()-1)) {
  384. sMethodOK = "PLU_OK_END";
  385. }
  386. mapENT = listENT.get(iNowIndexENT);
  387. sP_NO = mapENT.get("P_NO");
  388. sSL_KEY = mapENT.get("SL_KEY");
  389. sRECNO = mapENT.get("RECNO");
  390. sCASH_PRICE = mapENT.get("CASH_PRICE");
  391. sCREDIT_PRICE = mapENT.get("CREDIT_PRICE");
  392. sINSP_KIND = mapENT.get("INSP_KIND");
  393. // 付款方式
  394. if ((TCcrConst.PAY_CASH).equals(sPAY_NO)) {
  395. iSL_PRICE = emisUtil.parseInt(sCASH_PRICE);
  396. } else if ((TCcrConst.PAY_CREDIT).equals(sPAY_NO)) {
  397. iSL_PRICE = emisUtil.parseInt(sCREDIT_PRICE);
  398. }
  399. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "P_NO:" + sP_NO);
  400. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "SL_KEY:" + sSL_KEY);
  401. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "RECNO:" + sRECNO);
  402. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "付款類型:" + sPAY_NO);
  403. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "CASH_PRICE:" + sCASH_PRICE);
  404. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "CREDIT_PRICE:" + sCREDIT_PRICE);
  405. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "金額:" + iSL_PRICE);
  406. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "INSP_KIND:" + sINSP_KIND);
  407. isOpenPromo = false;
  408. isCM_PRICE = true;
  409. runPLU(iSL_PRICE, sMethodOK);
  410. }
  411. return handover();
  412. }
  413. protected boolean payment() {
  414. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "----付款模式---");
  415. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "付款方式 = " + sPAY_NO);
  416. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "付款金額 = " + sPAY_PRICE);
  417. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "分期付款 = " + sINSP_KIND);
  418. String sPAY_NO_NAME = TCcrConst.PAY_NAME_UNKNOW;
  419. int iPAY_PRICE = emisUtil.parseInt(sPAY_PRICE);
  420. if ((TCcrConst.PAY_CASH).equals(sPAY_NO)) {
  421. sPAY_NO_NAME = TCcrConst.PAY_NAME_CASH;
  422. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "1.現金付款,結束交易");
  423. TBtnPayCash _oPayCashEvent = new TBtnPayCash(false);
  424. return _oPayCashEvent.go();
  425. } else if ((TCcrConst.PAY_CREDIT).equals(sPAY_NO)) {
  426. sPAY_NO_NAME = TCcrConst.PAY_NAME_CREDIT;
  427. ((webccr) UI.getCurrent()).getlog().info(webccr.class, "2.信用卡付款,結束交易");
  428. // 參考TBtnCreditStage.java
  429. int iTransType = EDCUtil.NORMAIL_SALE; // 一般銷售
  430. if (!emisUtil.isEmpty(sINSP_KIND)) {
  431. iTransType = EDCUtil.CARD_CREDITSTAGE; // 分期
  432. }
  433. // 這個目的只是要信用卡畫面取消,會跑eventOver,去跑runEventMethod
  434. TButtonEventContext eventContext = new TButtonEventContext();
  435. EDCUtil edcUtil = new EDCUtil(iTransType, eventContext, false);
  436. // 傳入金額與分期數
  437. edcUtil.setiCreditStageAmt(iPAY_PRICE); // 刷卡金額
  438. edcUtil.setsStage(sINSP_KIND); // 分期數
  439. edcUtil.getParentEvent().setOtherEvent_(this);
  440. edcUtil.getParentEvent().setOtherMethodOK_("PAY_OK_MSG");
  441. edcUtil.getParentEvent().setOtherMethodCancel_("PAY_ERROR_MSG");
  442. edcUtil.openPartWin();
  443. return false; // 信用卡付款會開視窗,所以return false,尚未付款成功
  444. }
  445. return false;
  446. }
  447. public boolean eventOver(boolean bSuccess_) {
  448. // 按鈕先解鎖
  449. FoCcr.setLockBtn(false);
  450. if (bSuccess_) {
  451. // 企客案才需新增付款,結束交易
  452. if (isENT) {
  453. if (payment()) {
  454. FoCcr.UInotify.swMessage("交易完成!");
  455. return handover();
  456. }
  457. return handover();
  458. }
  459. // 更新畫面資訊
  460. FoCcr.UInotify.updateMainForm();
  461. }
  462. return super.eventOver(bSuccess_);
  463. }
  464. // 通知主畫面變更內容顯示
  465. protected void NotifyMainFormUpdate() {
  466. FoCcr.UInotify.updateMainForm();
  467. }
  468. public boolean isPLUinto() {
  469. return isPLUinto;
  470. }
  471. public void setPLUinto(boolean isPLUinto) {
  472. this.isPLUinto = isPLUinto;
  473. }
  474. public TBtnPLU getBtnPLU() {
  475. return btnPLU;
  476. }
  477. public void setBtnPLU(TBtnPLU btnPLU) {
  478. this.btnPLU = btnPLU;
  479. }
  480. public String getPLU_P_NO() {
  481. return PLU_P_NO;
  482. }
  483. public void setPLU_P_NO(String PLU_P_NO) {
  484. this.PLU_P_NO = PLU_P_NO;
  485. }
  486. }