PageRenderTime 58ms CodeModel.GetById 18ms app.highlight 34ms RepoModel.GetById 1ms app.codeStats 0ms

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