YYC
2023-11-05 a6013fee1895815cda77bfdcb5e5b9f4d190640b
igds-inout/src/main/java/com/ld/igds/m/InoutManageUtil.java
@@ -2,128 +2,149 @@
import com.ld.igds.models.InoutPlan;
import com.ld.igds.util.ContextUtil;
import java.util.List;
/**
 * 出入库--管理功能相关常量
 *
 * @author:
 *
 * @author:
 */
public class InoutManageUtil {
   /**
    * 计划类型-采购计划
    */
   public static final String PLAN_TYPE_1 = "1";
   /**
    * 计划类型-销售计划
    */
   public static final String PLAN_TYPE_2 = "2";
   /**
    * 计划类型-轮换计划
    */
   public static final String PLAN_TYPE_3 = "3";
   /**
    * 计划类型-加工计划
    */
   public static final String PLAN_TYPE_4 = "4";
    /**
     * 计划类型-采购计划
     */
    public static final String PLAN_TYPE_1 = "1";
    /**
     * 计划类型-销售计划
     */
    public static final String PLAN_TYPE_2 = "2";
    /**
     * 计划类型-轮换计划
     */
    public static final String PLAN_TYPE_3 = "3";
   /**
    * 计划详细类型-轮入
    */
   public static final String PLAN_TYPE_TURN_IN = "2";
   /**
    * 计划详细类型-轮出
    */
   public static final String PLAN_TYPE_TURN_OUT = "1";
    /**
     * 计划类型-加工计划
     */
    public static final String PLAN_TYPE_4 = "4";
   /**
    * 审核状态-待审核
    */
   public static final String AUDIT_NONE = "NONE";
   /**
    * 审核状态-通过
    */
   public static final String AUDIT_PASS = "PASS";
   /**
    * 审核状态-拒绝
    */
   public static final String AUDIT_UNPASS = "UNPASS";
    /**
     * 计划详细类型-轮入
     */
    public static final String PLAN_TYPE_TURN_IN = "2";
    /**
     * 计划详细类型-轮出
     */
    public static final String PLAN_TYPE_TURN_OUT = "1";
   /**
    * 合同类型-代储合同
    */
   public static final String CONTRACT_TYPE_3 = "3";
   /**
    * 合同类型-采购合同
    */
   public static final String CONTRACT_TYPE_2 = "2";
   /**
    * 合同类型-销售合同
    */
   public static final String CONTRACT_TYPE_1 = "1";
    /**
     * 审核状态-待审核
     */
    public static final String AUDIT_NONE = "NONE";
    /**
     * 审核状态-通过
     */
    public static final String AUDIT_PASS = "PASS";
    /**
     * 审核状态-拒绝
     */
    public static final String AUDIT_UNPASS = "UNPASS";
   /**
    * 客户类型 - 企业
    */
   public static final String CUSTOMER_TYPE_1 = "1";
   /**
    * 客户类型 - 个人
    */
   public static final String CUSTOMER_TYPE_2 = "2";
    /**
     * 合同类型-代储合同
     */
    public static final String CONTRACT_TYPE_3 = "3";
    /**
     * 合同类型-采购合同
     */
    public static final String CONTRACT_TYPE_2 = "2";
    /**
     * 合同类型-销售合同
     */
    public static final String CONTRACT_TYPE_1 = "1";
   /**
    * 根据类型创建计划ID
    *
    * @param type
    */
   public static String createPlanId(String type, String year, List<InoutPlan> list) {
      String index = "001";
      if(list != null && list.size() > 0){
         String[] arr = list.get(0).getId().split("_");
         int temp = Integer.valueOf(arr[2]) + 1;
         index = temp + "";
      }
      if(index.length() == 1){
         index = "00" + index;
      }
      if(index.length() == 2){
         index = "0" + index;
      }
      if (PLAN_TYPE_1.equals(type)) {
         return "CGJH_" + year + "_" + index;
      }
      if (PLAN_TYPE_2.equals(type)) {
         return "XSJH_" + year + "_" + index;
      }
      if (PLAN_TYPE_3.equals(type)) {
         return "LHJH_" + year + "_" + index;
      }
      if (PLAN_TYPE_4.equals(type)) {
         return "JGJH_" + year + "_" + index;
      }
      return "QTJH" + year + "_" + index;
   }
    /**
     * 客户类型 - 企业
     */
    public static final String CUSTOMER_TYPE_1 = "1";
    /**
     * 客户类型 - 个人
     */
    public static final String CUSTOMER_TYPE_2 = "2";
    /**
     * 结算与合同一致性 - 符合
     */
    public static final String CONSISTENCY_1 = "1";
    /**
     * 结算与合同一致性 - 不符合
     */
    public static final String CONSISTENCY_2 = "2";
    /**
     * 缓存-性质转变ID
     */
    public static final String CACHE_STOCK_ID = "STOCK_ID";
    /**
     * 缓存-性质转变ID
     */
    public static final String CACHE_VARIETY_ID = "VARIETY_ID";
    /**
     * 缓存-损溢ID
     */
    public static final String CACHE_LOSS_OVER_ID = "LOSS_OVER_ID";
   /**
    * 根据类型创建合同ID
    * @param type
    * @return
    */
   public static String createContractId(String type) {
      String id = ContextUtil.getTimeId();
      if (CONTRACT_TYPE_1.equals(type)) {
         return "XSHT_" + id;
      }
      if (CONTRACT_TYPE_2.equals(type)) {
         return "CGHT_" + id;
      }
      if (CONTRACT_TYPE_3.equals(type)) {
         return "LHHT_" + id;
      }
      return id;
   }
    /**
     * 根据类型创建计划ID
     *
     * @param type
     */
    public static String createPlanId(String type, String year, List<InoutPlan> list) {
        String index = "001";
        if (list != null && list.size() > 0) {
            String[] arr = list.get(0).getId().split("_");
            int temp = Integer.valueOf(arr[2]) + 1;
            index = temp + "";
        }
        if (index.length() == 1) {
            index = "00" + index;
        }
        if (index.length() == 2) {
            index = "0" + index;
        }
        if (PLAN_TYPE_1.equals(type)) {
            return "CGJH_" + year + "_" + index;
        }
        if (PLAN_TYPE_2.equals(type)) {
            return "XSJH_" + year + "_" + index;
        }
        if (PLAN_TYPE_3.equals(type)) {
            return "LHJH_" + year + "_" + index;
        }
        if (PLAN_TYPE_4.equals(type)) {
            return "JGJH_" + year + "_" + index;
        }
        return "QTJH" + year + "_" + index;
    }
    /**
     * 根据类型创建合同ID
     *
     * @param type
     * @return
     */
    public static String createContractId(String type) {
        String id = ContextUtil.getTimeId();
        if (CONTRACT_TYPE_1.equals(type)) {
            return "XSHT_" + id;
        }
        if (CONTRACT_TYPE_2.equals(type)) {
            return "CGHT_" + id;
        }
        if (CONTRACT_TYPE_3.equals(type)) {
            return "LHHT_" + id;
        }
        return id;
    }
}