/**
 * Copyright (c) 2003-2004 System Integrator Corporation.
 *                 All Rights Reserved.
 */
package jp.co.sint.basic;

import java.text.ParseException;

import jp.co.sint.beans.mallmgr.UIOrderBasic;
import jp.co.sint.config.SIConfig;
import jp.co.sint.tools.SIDateTime;
import jp.co.sint.tools.SIUtil;

import org.apache.log4j.Category;

/**
 * @version $Id: SIShippment.java,v 1.0 2003/09/19 Exp $
 * @author  asakura
* <br>Description:
 * <p>History</p>
 * <p>Author&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Reason</p>
 *  ============&nbsp;&nbsp;&nbsp;==========&nbsp;&nbsp;===========================<br>
 * asakura        2003/09/19 10:49:52  Original
 */
public class SIShippment extends UIOrderBasic {
  
  // ログ用のインスタンスの生成
  private static Category log = Category.getInstance(SIConfig.SILOG4J_WEBSHOP_CATEGORY_NAME);
  
  // 受注番号
  private String orderCode = "";
  
  // 受注配送先項番
  private String deliveryCode = "";
  
  // 受注明細番号
  private String detailCode = "";
  
  // 7.2.0 ST1034 追加 ここから
  // ショップ名
  private String shopName = "";
  
  // 7.2.0 ST1034 追加 ここまで
  
  // 顧客名
  private String custName = "";
  
  // 配送先宛名
  private String deliveryAddress = "";
  
  // 配送種別名称
  private String deliveryTypeName = "";
  
  // 受注日
  private String initDate = "";
  
  // 入金日
  private String receiptDate = "";
  
  // 入金日の年
  private String receiptDateYear = "";
  
  // 入金日の月
  private String receiptDateMonth = "";
  
  // 入金日の日
  private String receiptDateDay = "";
  
  // 配送希望日
  private String deliveryDate = "";
  
  // 配送希望日の年
  protected String deliveryDateYear = "";
  
  // 配送希望日の月
  private String deliveryDateMonth = "";
  
  // 配送希望日の日
  private String deliveryDateDay = "";
  
  // 配送希望時間帯
  private String deliveryTime = "";
  
  // 出荷日
  private String shippmentDate = "";
  
  // 出荷日の年
  protected String shippmentDateYear = "";
  
  // 出荷日の月
  private String shippmentDateMonth = "";
  
  // 出荷日の日
  private String shippmentDateDay = "";
  
  // 自宅フラグ
  private String homeFlg = "0";
  
  // 納品書出力フラグ
  private String deliveryOutputFlg = "";
  
  // 出荷メール送信フラグ
  private String shippmentMailFlg = "0";
  
  // ギフト設定があるか
  private String hasWrapping = "0";
  
  // 到着予定日
  private String arrivalPlanDate = "";
  
  // 到着予定時間
  private String arrivalPlanTime = "";
  
  // ショップコード
  private String shopCode = "";
  
  // 7.3.0 PI-NES0501 追加 ここから
  // 親コード
  private String cmdtyCode = "";
  
  // 在庫コード
  private String individualCode = "";
  
  // 商品名
  private String cmdtyName = "";
  
  // 対応支店コード
  private String branchCode = "";
  
  // 担当者コード
  private String chargeCode = "";
  
  // 委託フラグ
  private String consignFlg = "";
  
  // 7.3.0 PI-NES0501 追加 ここまで
  // 受注状態
  private String status = "";
  
  // 支払区分
  private String paymentFlg = "";
  
  // 出荷完了メール送信日時
  private String shippmentRegistMailDate = "";
  
  // 張替え原価ゼロフラグ
  private boolean isZero = false;
  
  public SIShippment() {
  }
  
  // setter of 受注番号
  public void setOrderCode(String lOrderCode) {
    if (SIUtil.isNull(lOrderCode))
      lOrderCode = "";
    this.orderCode = SIUtil.changeTo(lOrderCode.trim(), this.encode);
  }
  
  // setter of 受注配送先項番
  public void setDeliveryCode(String deliveryCode) {
    if (SIUtil.isNull(deliveryCode))
      deliveryCode = "";
    this.deliveryCode = SIUtil.changeTo(deliveryCode.trim(), this.encode);
  }
  
  // 7.2.0 ST1034 追加 ここから
  // setter of ショップ名
  public void setShopName(String lShopName) {
    if (SIUtil.isNull(lShopName))
      lShopName = "";
    this.shopName = SIUtil.changeTo(lShopName.trim(), this.encode);
  }
  
  // 7.2.0 ST1034 追加 ここまで
  
  // setter of 顧客名
  public void setCustName(String lCustName) {
    if (SIUtil.isNull(lCustName))
      lCustName = "";
    this.custName = SIUtil.changeTo(lCustName.trim(), this.encode);
  }
  
  // setter of 配送先宛名
  public void setDeliveryAddress(String deliveryAddress) {
    if (SIUtil.isNull(deliveryAddress))
      deliveryAddress = "";
    this.deliveryAddress = SIUtil.changeTo(deliveryAddress.trim(), this.encode);
  }
  
  // setter of 配送種別名称
  public void setDeliveryTypeName(String deliveryTypeName) {
    if (SIUtil.isNull(deliveryTypeName))
      deliveryTypeName = "";
    this.deliveryTypeName = SIUtil.changeTo(deliveryTypeName.trim(), this.encode);
  }
  
  // setter of 受注日
  public void setInitDate(String initDate) {
    if (SIUtil.isNull(initDate))
      initDate = "";
    this.initDate = (SIUtil.changeTo(initDate.trim(), this.encode));
  }
  
  // setter of 入金日
  public void setReceiptDate(String lYear, String lMonth, String lDay) {
    this.setReceiptDateYear(lYear);
    this.setReceiptDateMonth(lMonth);
    this.setReceiptDateDay(lDay);
  }
  
  // setter of 入金日
  public void setReceiptDate(String lReceiptDate) {
    if (SIUtil.isNull(lReceiptDate))
      lReceiptDate = "";
    else {
      try {
        SIDateTime lDateTime = new SIDateTime(lReceiptDate, SIConfig.SIDATE_FORMAT);
        setReceiptDate(lDateTime.getYearStr(), lDateTime.getMonthStr(), lDateTime.getDayStr());
      } catch (ParseException e) {
        e.printStackTrace();
      }
    }
    this.receiptDate = lReceiptDate;
  }
  
  // setter of 入金日の年
  public void setReceiptDateYear(String lReceiptDateYear) {
    if (SIUtil.isNull(lReceiptDateYear))
      this.receiptDateYear = "";
    else
      this.receiptDateYear = lReceiptDateYear;
  }
  
  // setter of 入金日の月
  public void setReceiptDateMonth(String lReceiptDateMonth) {
    if (SIUtil.isNull(lReceiptDateMonth))
      this.receiptDateMonth = "";
    else
      this.receiptDateMonth = lReceiptDateMonth;
  }
  
  // setter of 入金日の日
  public void setReceiptDateDay(String lReceiptDateDay) {
    if (SIUtil.isNull(lReceiptDateDay))
      this.receiptDateDay = "";
    else
      this.receiptDateDay = lReceiptDateDay;
  }
  
  // setter of 配送希望日
  public void setDeliveryDate(String lYear, String lMonth, String lDay) {
    this.setDeliveryDateYear(lYear);
    this.setDeliveryDateMonth(lMonth);
    this.setDeliveryDateDay(lDay);
  }
  
  // setter of 配送希望日
  public void setDeliveryDate(String deliveryDate) {
    if (SIUtil.isNull(deliveryDate))
      deliveryDate = "";
    else {
      try {
        SIDateTime lDateTime = new SIDateTime(deliveryDate, SIConfig.SIDATE_FORMAT);
        setDeliveryDate(lDateTime.getYearStr(), lDateTime.getMonthStr(), lDateTime.getDayStr());
      } catch (ParseException e) {
        e.printStackTrace();
      }
    }
    this.deliveryDate = deliveryDate;
  }
  
  // setter of 配送希望日の年
  public void setDeliveryDateYear(String lDeliveryDateYear) {
    if (SIUtil.isNull(lDeliveryDateYear))
      this.deliveryDateYear = "";
    else
      this.deliveryDateYear = lDeliveryDateYear;
  }
  
  // setter of 配送希望日の月
  public void setDeliveryDateMonth(String lDeliveryDateMonth) {
    if (SIUtil.isNull(lDeliveryDateMonth))
      this.deliveryDateMonth = "";
    else
      this.deliveryDateMonth = lDeliveryDateMonth;
  }
  
  // setter of 配送希望日の日
  public void setDeliveryDateDay(String lDeliveryDateDay) {
    if (SIUtil.isNull(lDeliveryDateDay))
      this.deliveryDateDay = "";
    else
      this.deliveryDateDay = lDeliveryDateDay;
  }
  
  // setter of 配送希望時間帯
  public void setDeliveryTime(String str) {
    if (SIUtil.isNull(str))
      this.deliveryTime = "";
    else
      this.deliveryTime = str;
  }
  
  // setter of 出荷日
  public void setShippmentDate(String lYear, String lMonth, String lDay) {
    this.setShippmentDateYear(lYear);
    this.setShippmentDateMonth(lMonth);
    this.setShippmentDateDay(lDay);
  }
  
  public void setHomeFlg(String lHomeFlg) {
    if (SIUtil.isNull(lHomeFlg))
      this.deliveryDateDay = "0";
    else
      this.homeFlg = lHomeFlg;
  }
  
  // setter of 出荷日
  public void setShippmentDate(String shippmentDate) {
    if (SIUtil.isNull(shippmentDate))
      shippmentDate = "";
    else {
      try {
        SIDateTime lDateTime = new SIDateTime(shippmentDate, SIConfig.SIDATE_FORMAT);
        setShippmentDate(lDateTime.getYearStr(), lDateTime.getMonthStr(), lDateTime.getDayStr());
      } catch (ParseException e) {
        e.printStackTrace();
      }
    }
    this.shippmentDate = shippmentDate;
  }
  
  // setter of 出荷日の年
  public void setShippmentDateYear(String lshippmentDateYear) {
    if (SIUtil.isNull(lshippmentDateYear))
      this.shippmentDateYear = "";
    else
      this.shippmentDateYear = lshippmentDateYear;
  }
  
  // setter of 出荷日の月
  public void setShippmentDateMonth(String lshippmentDateMonth) {
    if (SIUtil.isNull(lshippmentDateMonth))
      this.shippmentDateMonth = "";
    else
      this.shippmentDateMonth = lshippmentDateMonth;
  }
  
  // setter of 出荷日の日
  public void setShippmentDateDay(String lshippmentDateDay) {
    if (SIUtil.isNull(lshippmentDateDay))
      this.shippmentDateDay = "";
    else
      this.shippmentDateDay = lshippmentDateDay;
  }
  
  public void setDeliveryOutputFlg(String str) {
    if (SIUtil.isNull(str))
      this.deliveryOutputFlg = "";
    else
      this.deliveryOutputFlg = str;
  }
  
  public void setShippmentMailFlg(String str) {
    if (SIUtil.isNull(str))
      this.shippmentMailFlg = "0";
    else
      this.shippmentMailFlg = str;
  }
  
  public void setHasWrapping(String str) {
    if (SIUtil.isNull(str))
      this.hasWrapping = "0";
    else
      this.hasWrapping = str;
  }
  
  public void setArrivalPlanDate(String str) {
    if (SIUtil.isNull(str))
      str = "";
    this.arrivalPlanDate = str;
  }
  
  public void setArrivalPlanTime(String str) {
    if (SIUtil.isNull(str))
      str = "";
    this.arrivalPlanTime = str;
  }
  
  public void setShopCode(String str) {
    if (SIUtil.isNull(str))
      str = "";
    this.shopCode = str;
  }
  
  // getter of 受注番号
  public String getOrderCode() {
    return this.orderCode;
  }
  
  // getter of 受注配送先項番
  public String getDeliveryCode() {
    return this.deliveryCode;
  }
  
  // getter of 顧客名
  public String getCustName() {
    return this.custName;
  }
  
  // 7.2.0 ST1034 追加 ここから
  // getter of ショップ名
  public String getShopName() {
    return this.shopName;
  }
  
  // 7.2.0 ST1034 追加 ここまで
  
  // getter of 配送先宛名
  public String getDeliveryAddress() {
    return this.deliveryAddress;
  }
  
  // getter of 配送種別名称
  public String getDeliveryTypeName() {
    return this.deliveryTypeName;
  }
  
  // getter of 受注日
  public String getInitDate() {
    return this.initDate.substring(2, 10);
  }
  
  // getter of 受注日
  public String getInitFullDateTime() {
    return this.initDate;
  }
  
  // getter of 受注日
  public String getInitFullDate() {
    return this.initDate.substring(0, 10);
  }
  
  // getter of 入金日
  public String getReceiptDate() {
    if (SIUtil.isNotNull(getReceiptDateYear()) && SIUtil.isNotNull(getReceiptDateMonth()) && SIUtil.isNotNull(getReceiptDateDay()))
      return getReceiptDateYear().substring(2) + "/" + getReceiptDateMonth() + "/" + getReceiptDateDay();
    else
      return "";
  }
  
  public String getReceiptDateYear() {
    return this.receiptDateYear;
  }
  
  public String getReceiptDateMonth() {
    return this.receiptDateMonth;
  }
  
  public String getReceiptDateDay() {
    return this.receiptDateDay;
  }
  
  // getter of 配送希望日
  public String getDeliveryDate() {
    if (SIUtil.isNotNull(getDeliveryDateYear()) && SIUtil.isNotNull(getDeliveryDateMonth()) && SIUtil.isNotNull(getDeliveryDateDay()))
      return getDeliveryDateYear().substring(2) + "/" + getDeliveryDateMonth() + "/" + getDeliveryDateDay();
    else
      return "";
  }
  
  public String getDeliveryDateTxt() {
    if (SIUtil.isNull(getDeliveryDate())) return "指定なし";
    else if ("00/01/01".equals(getDeliveryDate())) return "最短到着日";
    else return getDeliveryDate();
  }
  
  public String getDeliveryDateYear() {
    return this.deliveryDateYear;
  }
  
  public String getDeliveryDateMonth() {
    return this.deliveryDateMonth;
  }
  
  public String getDeliveryDateDay() {
    return this.deliveryDateDay;
  }
  
  // getter of 配送希望時間帯
  public String getDeliveryTime() {
    return this.deliveryTime;
  }
  
  // getter of 出荷日
  public String getShippmentDate() {
    if (SIUtil.isNotNull(getShippmentDateYear()) && SIUtil.isNotNull(getShippmentDateMonth()) && SIUtil.isNotNull(getShippmentDateDay()))
      return getShippmentDateYear().substring(2) + "/" + getShippmentDateMonth() + "/" + getShippmentDateDay();
    else
      return "";
  }
  
  public String getShippmentFullDate() {
    return SIDateTime.getDate(getShippmentDateYear(), getShippmentDateMonth(), getShippmentDateDay());
  }
  
  public String getShippmentDateYear() {
    return this.shippmentDateYear;
  }
  
  public String getShippmentDateMonth() {
    return this.shippmentDateMonth;
  }
  
  public String getShippmentDateDay() {
    return this.shippmentDateDay;
  }
  
  public String getHomeFlg() {
    return this.homeFlg;
  }
  
  public String getDeliveryOutputFlg() {
    return this.deliveryOutputFlg;
  }
  
  public String getShippmentMailFlg() {
    return this.shippmentMailFlg;
  }
  
  public String getHasWrapping() {
    return this.hasWrapping;
  }
  
  public String getArrivalPlanDate() {
    return this.arrivalPlanDate;
  }
  
  public String getArrivalPlanTime() {
    return this.arrivalPlanTime;
  }
  
  public String getShopCode() {
    return this.shopCode;
  }
  
  // 7.3.0 PI-NES0501 追加 ここから
  /**
   * @return branchCode を戻します。
   */
  public String getBranchCode() {
    return branchCode;
  }
  
  /**
   * @return chargeCode を戻します。
   */
  public String getChargeCode() {
    return chargeCode;
  }
  
  /**
   * @return cmdtyName を戻します。
   */
  public String getCmdtyName() {
    return cmdtyName;
  }
  
  /**
   * @return consignFlg を戻します。
   */
  public String getConsignFlg() {
    return consignFlg;
  }
  
  /**
   * @param branchCode branchCode を設定。
   */
  public void setBranchCode(String branchCode) {
    this.branchCode = branchCode;
  }
  
  /**
   * @param chargeCode chargeCode を設定。
   */
  public void setChargeCode(String chargeCode) {
    this.chargeCode = chargeCode;
  }
  
  /**
   * @param cmdtyName cmdtyName を設定。
   */
  public void setCmdtyName(String cmdtyName) {
    this.cmdtyName = cmdtyName;
  }
  
  /**
   * @param consignFlg consignFlg を設定。
   */
  public void setConsignFlg(String consignFlg) {
    this.consignFlg = consignFlg;
  }
  
  /**
   * @return detailCode を戻します。
   */
  public String getDetailCode() {
    return detailCode;
  }
  
  /**
   * @param detailCode detailCode を設定。
   */
  public void setDetailCode(String detailCode) {
    this.detailCode = detailCode;
  }
  
  public String getCmdtyCode() {
    return cmdtyCode;
  }
  
  public void setCmdtyCode(String cmdtyCode) {
    this.cmdtyCode = cmdtyCode;
  }
  
  public String getIndividualCode() {
    return individualCode;
  }
  
  public void setIndividualCode(String individualCode) {
    this.individualCode = individualCode;
  }
  
  // 7.3.0 PI-NES0501 追加 ここまで
  public String getStatus() {
    return status;
  }
  
  public void setStatus(String status) {
    this.status = status;
  }
  
  public String getPaymentFlg() {
    return paymentFlg;
  }
  
  public void setPaymentFlg(String paymentFlg) {
    this.paymentFlg = paymentFlg;
  }
  
  public String getShippmentRegistMailDate() {
    return shippmentRegistMailDate;
  }
  
  public void setShippmentRegistMailDate(String shippmentRegistMailDate) {
    this.shippmentRegistMailDate = shippmentRegistMailDate;
  }
  
  public boolean isZero() {
    return isZero;
  }
  
  public void setZero(boolean isZero) {
    this.isZero = isZero;
  }
  
}